diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4881715dc9842..3999c923e4efc 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -580,6 +580,10 @@ # ServiceLabel: %Monitor - Exporter %Service Attention /sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/ @cijothomas @reyang @rajkumar-rangaraj @TimothyMothra @vishweshbankwar +# PRLabel: %Monitor - LiveMetrics +# ServiceLabel: %Monitor - LiveMetrics %Service Attention +/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/ @cijothomas @reyang @rajkumar-rangaraj @TimothyMothra @vishweshbankwar + # ServiceLabel: %MySQL %Service Attention /sdk/mysql/Microsoft.Azure.Management.MySQL/ @ajlam @ambhatna @kummanish diff --git a/.vscode/cspell.json b/.vscode/cspell.json index d3445a442d4e5..72a3b11059499 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -638,7 +638,9 @@ "Ocsp", "Afri", "Apac", - "Latam" + "Latam", + "Fips", + "Diffie" ] }, { @@ -1234,6 +1236,15 @@ "words": [ "resourceid" ] + }, + { + "filename": "**/sdk/hybridnetwork/**/*.cs", + "words": [ + "Nfvi", + "nfvi", + "NFVIs", + "nfvis" + ] } ], "allowCompoundWords": true diff --git a/common/ManagementTestShared/Redesign/ManagementMockingPatternTests.cs b/common/ManagementTestShared/Redesign/ManagementMockingPatternTests.cs new file mode 100644 index 0000000000000..16a918130d4a7 --- /dev/null +++ b/common/ManagementTestShared/Redesign/ManagementMockingPatternTests.cs @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Moq; +using Moq.Language; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.TestFramework +{ + public sealed class ManagementMockingPatternTests + { + private const string TestFrameworkAssembly = "Azure.ResourceManager.TestFramework"; + private const string AssemblyPrefix = "Azure.ResourceManager."; + private const string ResourceManagerAssemblyName = "Azure.ResourceManager"; + private const string TestAssemblySuffix = ".Tests"; + + [Test] + public void ValidateMockingPattern() + { + var testAssembly = Assembly.GetExecutingAssembly(); + var assemblyName = testAssembly.GetName().Name; + Assert.IsTrue(assemblyName.EndsWith(TestAssemblySuffix), $"The test assembly should end with {TestAssemblySuffix}"); + var rpNamespace = assemblyName.Substring(0, assemblyName.Length - TestAssemblySuffix.Length); + + if (rpNamespace == ResourceManagerAssemblyName || rpNamespace == TestFrameworkAssembly) + { + // in Azure.ResourceManager, we do not have extension methods therefore there is nothing to validate + return; + } + + TestContext.WriteLine($"Testing assembly {rpNamespace}"); + + if (!rpNamespace.StartsWith(AssemblyPrefix)) + { + return; + } + + // find the SDK assembly by filtering the assemblies in current domain, or load it if not found (when there is no test case) + var sdkAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == rpNamespace) ?? Assembly.Load(rpNamespace); + + Assert.IsNotNull(sdkAssembly, $"The SDK assembly {rpNamespace} not found"); + + // find the extension class + foreach (var type in sdkAssembly.GetTypes()) + { + if (IsExtensionsType(type, rpNamespace)) + { + TestContext.WriteLine($"Verifying class {type}"); + CheckExtensionsType(sdkAssembly, type); + } + } + } + + private static bool IsExtensionsType(Type type, string assemblyNamespace) + { + return type.IsPublic && + type.Namespace.StartsWith(assemblyNamespace) && + type.Name.EndsWith("Extensions") && + type.IsClass && // this should be a class + type.IsSealed && type.IsAbstract; // this is checking if the class is static + } + + private static void CheckExtensionsType(Assembly sdkAssembly, Type extensionType) + { + var rpNamespace = extensionType.Namespace; + var rpName = GetRPName(rpNamespace); + + Assert.IsNotNull(extensionType); + + foreach (var method in extensionType.GetMethods(BindingFlags.Public | BindingFlags.Static)) + { + ValidateMethod(sdkAssembly, method, rpNamespace, rpName); + } + } + + private static string GetRPName(string rpNamespace) + { + // there is an assertion of the prefix, therefore this is safe. + var trailing = rpNamespace.Substring(AssemblyPrefix.Length); + var segments = trailing.Split('.'); + var rpName = string.Join("", segments.Select(s => char.ToUpper(s[0]) + s.Substring(1))); + return rpName; + } + + private static void ValidateMethod(Assembly assembly, MethodInfo method, string rpNamespace, string rpName) + { + // the method should be public, static and extension + if (!method.IsStatic || !method.IsPublic || !method.IsDefined(typeof(ExtensionAttribute), true)) + return; + + // ignore those obsolete methods + if (method.IsDefined(typeof(ObsoleteAttribute), true)) + return; + + // finds the corresponding mocking extension class + var parameters = method.GetParameters(); + var extendedType = parameters[0].ParameterType; + + var mockingExtensionTypeName = GetMockableResourceTypeName(rpNamespace, rpName, extendedType.Name); + + var mockingExtensionType = assembly.GetType(mockingExtensionTypeName); + Assert.IsNotNull(mockingExtensionType, $"The mocking extension class {mockingExtensionTypeName} must exist"); + Assert.IsTrue(mockingExtensionType.IsPublic, $"The mocking extension class {mockingExtensionType} must be public"); + + // validate the mocking extension class has a method with the exact name and parameter list + var expectedTypes = parameters.Skip(1).Select(p => p.ParameterType).ToArray(); + var methodOnExtension = mockingExtensionType.GetMethod(method.Name, parameters.Skip(1).Select(p => p.ParameterType).ToArray()); + + Assert.IsNotNull(methodOnExtension, $"The class {mockingExtensionType} must have method {method}"); + Assert.IsTrue(methodOnExtension.IsVirtual, $"The method on {mockingExtensionType} must be virtual"); + Assert.IsTrue(methodOnExtension.IsPublic, $"The method on {mockingExtensionType} must be public"); + + // validate they should both have or both not have the EditorBrowsable(Never) attribute + Assert.AreEqual(method.IsDefined(typeof(EditorBrowsableAttribute)), methodOnExtension.IsDefined(typeof(EditorBrowsableAttribute)), $"The method {method} and {methodOnExtension} should both have or neither have the EditorBrowsableAttribute on them"); + + ValidateMocking(extendedType, mockingExtensionType, method, methodOnExtension); + } + + private static string GetMockableResourceTypeName(string rpNamespace, string rpName, string extendedResourceName) + => $"{rpNamespace}.Mocking.Mockable{rpName}{extendedResourceName}"; + + private static void ValidateMocking(Type extendedType, Type mockingExtensionType, MethodInfo extensionMethod, MethodInfo methodOnExtension) + { + // construct a mock instance for the extendee + var mock = (Mock)Activator.CreateInstance(typeof(Mock<>).MakeGenericType(extendedType)); + // construct a mock instance for the mocking extension + var extensionMock = (Mock)Activator.CreateInstance(typeof(Mock<>).MakeGenericType(mockingExtensionType)); + // mock the GetCachedClient + MockGetCachedClientMethod(mock, extensionMock, extendedType, mockingExtensionType); + // mock the method on MockingExtension + MockMethodOnMockingExtension(extensionMock, mockingExtensionType, methodOnExtension); + + // call the method on the mock result + var arguments = new List() { mock.Object }; + foreach (var p in extensionMethod.GetParameters().Skip(1)) + { + object i = p.ParameterType.IsValueType ? Activator.CreateInstance(p.ParameterType) : null; + arguments.Add(i); + } + try + { + var result = extensionMethod.Invoke(null, arguments.ToArray()); + + Assert.IsNotNull(result, $"Mocking of extension method {extensionMethod} is not working properly, please check the implementation to ensure it to call the method with same name and parameter list in {mockingExtensionType}"); + } + catch (Exception) + { + Assert.Fail($"Mocking of extension method {extensionMethod} is not working properly, please check the implementation to ensure it to call the method with same name and parameter list in {mockingExtensionType}"); + } + } + + private static void MockGetCachedClientMethod(Mock mock, Mock extensionMock, Type extendedType, Type mockingExtensionType) + { + // get the setup method for Mock so that we could call it. + var setupMethod = FindSetupMethod(mock.GetType()).MakeGenericMethod(mockingExtensionType); + // construct the expression to use in the Setup method `extendee => extendee.GetCachedClient(It.IsAny>())` + var expression = ConstructGetCachedClientExpression(extendedType, mockingExtensionType); + // invoke the setup method + var getCachedClientResult = setupMethod.Invoke(mock, new object[] { expression }); + // find the Returns method on the result + var returnsMethod = FindReturnsMethod(getCachedClientResult.GetType(), mockingExtensionType); + // call the Returns method + returnsMethod.Invoke(getCachedClientResult, new object[] { extensionMock.Object }); + } + + private static void MockMethodOnMockingExtension(object extensionMock, Type mockingExtensionType, MethodInfo methodOnExtension) + { + var returnType = methodOnExtension.ReturnType; + var setupMethod = FindSetupMethod(extensionMock.GetType()).MakeGenericMethod(returnType); + // construct the expression that calls this method + var expression = ConstructMethodExpression(mockingExtensionType, methodOnExtension); + // invoke the setup method + var methodResult = setupMethod.Invoke(extensionMock, new object[] { expression }); + if (returnType.IsGenericType && returnType.GetGenericTypeDefinition() == typeof(Task<>)) + { + returnType = returnType.GenericTypeArguments.Single(); + // find the ReturnsAsync method on ReturnsExtensions + var returnsMethod = GetReturnsAsyncMethod().MakeGenericMethod(mockingExtensionType, returnType); + // construct a mock instance for the result so that the mock method no longer returns null + var resultMock = (Mock)Activator.CreateInstance(typeof(Mock<>).MakeGenericType(returnType)); + // since ReturnsAsync is an extension method, we need to call it in the static method way + returnsMethod.Invoke(null, new object[] { methodResult, resultMock.Object }); + } + else + { + // find the Returns method on the result + var returnsMethod = FindReturnsMethod(methodResult.GetType(), returnType); + // construct a mock instance for the result so that the mock method no longer returns null + var resultMock = (Mock)Activator.CreateInstance(typeof(Mock<>).MakeGenericType(returnType)); + // call the Returns method + returnsMethod.Invoke(methodResult, new object[] { resultMock.Object }); + } + } + + private static MethodInfo _returnsAsyncMethod = null; + + private static MethodInfo GetReturnsAsyncMethod() + { + if (_returnsAsyncMethod != null) + { + return _returnsAsyncMethod; + } + + var returnsAsyncMethods = typeof(ReturnsExtensions).GetMethods().Where(m => m.Name == "ReturnsAsync"); + + // Get the method with the desired type of the second generic parameter of the IReturns interface + foreach (var method in returnsAsyncMethods) + { + // we want to find this method: IReturnsResult ReturnsAsync(this IReturns> mock, TResult value) + if (!method.IsGenericMethod) + continue; + var genericArguments = method.GetGenericArguments(); + if (genericArguments.Length != 2) + continue; + var parameters = method.GetParameters(); + if (parameters.Length != 2) + continue; + var firstType = typeof(IReturns<,>).MakeGenericType(genericArguments[0], typeof(Task<>).MakeGenericType(genericArguments[1])); + var secondType = genericArguments[1]; + if (firstType == parameters[0].ParameterType && secondType == parameters[1].ParameterType) + { + _returnsAsyncMethod = method; + break; + } + } + + return _returnsAsyncMethod; + } + + private static LambdaExpression ConstructGetCachedClientExpression(Type extendedType, Type mockingExtensionType) + { + // step 1: construct an expression: It.IsAny>() + var funcType = typeof(Func<,>).MakeGenericType(typeof(ArmClient), mockingExtensionType); + var itIsAnyExpression = Expression.Call(isAnyMethod.MakeGenericMethod(funcType)); + // step 2: get the expression of `extendee.GetCachedClient(It.IsAny>())` + var parameter = Expression.Parameter(extendedType, "extendee"); + var methodCallExpression = Expression.Call(parameter, "GetCachedClient", new[] { mockingExtensionType }, itIsAnyExpression); + // step 3: get the lambda: `extendee => extendee.GetCachedClient(It.IsAny>())` + return Expression.Lambda(methodCallExpression, parameter); + } + + private static LambdaExpression ConstructMethodExpression(Type mockingExtensionType, MethodInfo methodOnExtension) + { + var parameters = methodOnExtension.GetParameters(); + // construct an expression like `e.TheMethod(default, default, default, default);` + var parameter = Expression.Parameter(mockingExtensionType, "e"); + var arguments = new List(); + foreach (var p in parameters) + { + arguments.Add(Expression.Default(p.ParameterType)); + } + var methodCallExpression = Expression.Call(parameter, methodOnExtension, arguments); + // change it to a lambda + return Expression.Lambda(methodCallExpression, parameter); + } + + private static MethodInfo FindSetupMethod(Type mock) + { + var methods = mock.GetMethods(BindingFlags.Public | BindingFlags.Instance); + return methods.Single(m => m.Name == "Setup" && m.IsGenericMethod); + } + + private static MethodInfo FindReturnsMethod(Type instance, Type resultType) + { + return instance.GetMethod("Returns", new[] { resultType }); + } + + private static readonly MethodInfo isAnyMethod = typeof(It).GetMethod(nameof(It.IsAny), BindingFlags.Public | BindingFlags.Static); + } +} diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index 12c789eeb4df1..6368cba9998ea 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -103,7 +103,7 @@ - + @@ -176,7 +176,7 @@ All should have PrivateAssets="All" set so they don't become package dependencies --> - + diff --git a/eng/common/pipelines/templates/jobs/prepare-pipelines.yml b/eng/common/pipelines/templates/jobs/prepare-pipelines.yml index 424f587ae1267..9cbabda43285b 100644 --- a/eng/common/pipelines/templates/jobs/prepare-pipelines.yml +++ b/eng/common/pipelines/templates/jobs/prepare-pipelines.yml @@ -23,6 +23,14 @@ jobs: name: azsdk-pool-mms-ubuntu-2204-general vmImage: ubuntu-22.04 steps: + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + parameters: + Paths: + - 'sdk/**/*.yml' + - '!sdk/**/test-recordings/*' + - '!sdk/**/recordings/*' + - '!sdk/**/SessionRecords/*' + - '!sdk/**/session-records/*' - template: /eng/common/pipelines/templates/steps/install-pipeline-generation.yml - template: /eng/common/pipelines/templates/steps/set-default-branch.yml # This covers our public repos. diff --git a/eng/common/scripts/Save-Package-Properties.ps1 b/eng/common/scripts/Save-Package-Properties.ps1 index 44f622357753c..0e8ce26aa654d 100644 --- a/eng/common/scripts/Save-Package-Properties.ps1 +++ b/eng/common/scripts/Save-Package-Properties.ps1 @@ -101,34 +101,36 @@ if ($allPackageProperties) } foreach($pkg in $allPackageProperties) { - Write-Host "Package Name: $($pkg.Name)" - Write-Host "Package Version: $($pkg.Version)" - Write-Host "Package SDK Type: $($pkg.SdkType)" - Write-Host "Artifact Name: $($pkg.ArtifactName)" - Write-Host "Release date: $($pkg.ReleaseStatus)" - $configFilePrefix = $pkg.Name - if ($pkg.ArtifactName) - { - $configFilePrefix = $pkg.ArtifactName + if ($pkg.Name) { + Write-Host "Package Name: $($pkg.Name)" + Write-Host "Package Version: $($pkg.Version)" + Write-Host "Package SDK Type: $($pkg.SdkType)" + Write-Host "Artifact Name: $($pkg.ArtifactName)" + Write-Host "Release date: $($pkg.ReleaseStatus)" + $configFilePrefix = $pkg.Name + if ($pkg.ArtifactName) + { + $configFilePrefix = $pkg.ArtifactName + } + $outputPath = Join-Path -Path $outDirectory "$configFilePrefix.json" + Write-Host "Output path of json file: $outputPath" + $outDir = Split-Path $outputPath -parent + if (-not (Test-Path -path $outDir)) + { + Write-Host "Creating directory $($outDir) for json property file" + New-Item -ItemType Directory -Path $outDir + } + + # If package properties for a track 2 (IsNewSdk = true) package has + # already been written, skip writing to that same path. + if ($exportedPaths.ContainsKey($outputPath) -and $exportedPaths[$outputPath].IsNewSdk -eq $true) { + Write-Host "Track 2 package info with file name $($outputPath) already exported. Skipping export." + continue + } + $exportedPaths[$outputPath] = $pkg + + SetOutput $outputPath $pkg } - $outputPath = Join-Path -Path $outDirectory "$configFilePrefix.json" - Write-Host "Output path of json file: $outputPath" - $outDir = Split-Path $outputPath -parent - if (-not (Test-Path -path $outDir)) - { - Write-Host "Creating directory $($outDir) for json property file" - New-Item -ItemType Directory -Path $outDir - } - - # If package properties for a track 2 (IsNewSdk = true) package has - # already been written, skip writing to that same path. - if ($exportedPaths.ContainsKey($outputPath) -and $exportedPaths[$outputPath].IsNewSdk -eq $true) { - Write-Host "Track 2 package info with file name $($outputPath) already exported. Skipping export." - continue - } - $exportedPaths[$outputPath] = $pkg - - SetOutput $outputPath $pkg } Get-ChildItem -Path $outDirectory diff --git a/eng/common/testproxy/target_version.txt b/eng/common/testproxy/target_version.txt index 49c8aea654f18..1dbfeeb059f34 100644 --- a/eng/common/testproxy/target_version.txt +++ b/eng/common/testproxy/target_version.txt @@ -1 +1 @@ -1.0.0-dev.20230912.4 +1.0.0-dev.20231030.1 diff --git a/eng/common/testproxy/test-proxy-tool.yml b/eng/common/testproxy/test-proxy-tool.yml index bffc68309c04e..22e4a7da4346f 100644 --- a/eng/common/testproxy/test-proxy-tool.yml +++ b/eng/common/testproxy/test-proxy-tool.yml @@ -22,7 +22,6 @@ steps: - pwsh: | $version = $(Get-Content "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt" -Raw).Trim() - dotnet tool install azure.sdk.tools.testproxy ` --tool-path $(Build.BinariesDirectory)/test-proxy ` --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json ` @@ -44,14 +43,14 @@ steps: - pwsh: | Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe ` - -ArgumentList "--storage-location ${{ parameters.rootFolder }}" ` + -ArgumentList "start --storage-location ${{ parameters.rootFolder }} -U" ` -NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log displayName: 'Run the testproxy - windows' condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }}) # nohup does NOT continue beyond the current session if you use it within powershell - bash: | - nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > ${{ parameters.rootFolder }}/test-proxy.log & + nohup $(Build.BinariesDirectory)/test-proxy/test-proxy &>$(Build.SourcesDirectory)/test-proxy.log & displayName: "Run the testproxy - linux/mac" condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }}) workingDirectory: "${{ parameters.rootFolder }}" diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index 370f74a31f66c..a8fd5f666221a 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-csharp": "0.2.0-beta.20231027.1" + "@azure-tools/typespec-csharp": "0.2.0-beta.20231102.4" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -17,9 +17,9 @@ } }, "node_modules/@autorest/csharp": { - "version": "3.0.0-beta.20231027.1", - "resolved": "https://registry.npmjs.org/@autorest/csharp/-/csharp-3.0.0-beta.20231027.1.tgz", - "integrity": "sha512-sjgeo/AzsjFnL3DDey6CpuIJgAVIySRJRAupzzgkWQrPz/JG7GSLTheUl4uJwz5Z1jJxqQwIMQiqHi2krwxw4A==" + "version": "3.0.0-beta.20231102.4", + "resolved": "https://registry.npmjs.org/@autorest/csharp/-/csharp-3.0.0-beta.20231102.4.tgz", + "integrity": "sha512-Kz7PNcLgShsNrtrkf+uuwGWRo5xcFyUGhv/0I7+eAqDdDaoG7bzattXj+v49a1ktyODjUh522MJQ+kUD35FYPA==" }, "node_modules/@azure-tools/typespec-azure-core": { "version": "0.35.0", @@ -49,11 +49,11 @@ } }, "node_modules/@azure-tools/typespec-csharp": { - "version": "0.2.0-beta.20231027.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-csharp/-/typespec-csharp-0.2.0-beta.20231027.1.tgz", - "integrity": "sha512-qC3xu94VfU2taY7D0sFN9WZn1ehDqDbBj/I/20q6vKyeScolU3kXWMQP1Uyym2vDEMDCOCHrXbi3Gg4t1DUmnA==", + "version": "0.2.0-beta.20231102.4", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-csharp/-/typespec-csharp-0.2.0-beta.20231102.4.tgz", + "integrity": "sha512-1psK7PCyvZ0m7McH3zs/VdfQ3IN/hirlaALd/hyz5lOJeyTR61bqk6FCJqQ0cFvSAzkoLW8VrAkamh8JmMxf2A==", "dependencies": { - "@autorest/csharp": "3.0.0-beta.20231027.1", + "@autorest/csharp": "3.0.0-beta.20231102.4", "@azure-tools/typespec-azure-core": "0.35.0", "@azure-tools/typespec-client-generator-core": "0.35.0", "@typespec/compiler": "0.49.0", @@ -299,15 +299,15 @@ "integrity": "sha512-HlJjF3wxV4R2VQkFpKe0YqJLilYNgtRtsqqZtby7RkVsSs+i+vbyzjtUwpFEdUCKcrGzCiEJE7F/0mKjh0sunA==" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", - "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.1.tgz", + "integrity": "sha512-w0tiiRc9I4S5XSXXrMHOWgHgxbrBn1Ro+PmiYhSg2ZVdxrAJtQgzU5o2m1BfP6UOn7Vxcc6152vFjQfmZR4xEg==", "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/type-utils": "6.9.0", - "@typescript-eslint/utils": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/scope-manager": "6.9.1", + "@typescript-eslint/type-utils": "6.9.1", + "@typescript-eslint/utils": "6.9.1", + "@typescript-eslint/visitor-keys": "6.9.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -333,14 +333,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.0.tgz", - "integrity": "sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==", - "dependencies": { - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.1.tgz", + "integrity": "sha512-C7AK2wn43GSaCUZ9do6Ksgi2g3mwFkMO3Cis96kzmgudoVaKyt62yNzJOktP0HDLb/iO2O0n2lBOzJgr6Q/cyg==", + "dependencies": { + "@typescript-eslint/scope-manager": "6.9.1", + "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/typescript-estree": "6.9.1", + "@typescript-eslint/visitor-keys": "6.9.1", "debug": "^4.3.4" }, "engines": { @@ -360,12 +360,12 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", - "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.1.tgz", + "integrity": "sha512-38IxvKB6NAne3g/+MyXMs2Cda/Sz+CEpmm+KLGEM8hx/CvnSRuw51i8ukfwB/B/sESdeTGet1NH1Wj7I0YXswg==", "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0" + "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/visitor-keys": "6.9.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -376,12 +376,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", - "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.1.tgz", + "integrity": "sha512-eh2oHaUKCK58qIeYp19F5V5TbpM52680sB4zNSz29VBQPTWIlE/hCj5P5B1AChxECe/fmZlspAWFuRniep1Skg==", "dependencies": { - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/utils": "6.9.0", + "@typescript-eslint/typescript-estree": "6.9.1", + "@typescript-eslint/utils": "6.9.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -402,9 +402,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", - "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.1.tgz", + "integrity": "sha512-BUGslGOb14zUHOUmDB2FfT6SI1CcZEJYfF3qFwBeUrU6srJfzANonwRYHDpLBuzbq3HaoF2XL2hcr01c8f8OaQ==", "engines": { "node": "^16.0.0 || >=18.0.0" }, @@ -414,12 +414,12 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", - "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.1.tgz", + "integrity": "sha512-U+mUylTHfcqeO7mLWVQ5W/tMLXqVpRv61wm9ZtfE5egz7gtnmqVIw9ryh0mgIlkKk9rZLY3UHygsBSdB9/ftyw==", "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/visitor-keys": "6.9.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -467,16 +467,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", - "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.1.tgz", + "integrity": "sha512-L1T0A5nFdQrMVunpZgzqPL6y2wVreSyHhKGZryS6jrEN7bD9NplVAyMryUhXsQ4TWLnZmxc2ekar/lSGIlprCA==", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/scope-manager": "6.9.1", + "@typescript-eslint/types": "6.9.1", + "@typescript-eslint/typescript-estree": "6.9.1", "semver": "^7.5.4" }, "engines": { @@ -491,11 +491,11 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", - "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.1.tgz", + "integrity": "sha512-MUaPUe/QRLEffARsmNfmpghuQkW436DvESW+h+M52w0coICHRfD6Np9/K6PdACwnrq1HmuLl+cSPZaJmeVPkSw==", "dependencies": { - "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/types": "6.9.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -2730,9 +2730,9 @@ } }, "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "engines": { "node": ">=6" } @@ -3445,9 +3445,9 @@ } }, "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "engines": { "node": ">= 10.0.0" } @@ -3660,9 +3660,9 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yaml": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz", - "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", "engines": { "node": ">= 14" } diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 4469f6b8c6ed2..73fd93e026b10 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,6 +1,6 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-csharp": "0.2.0-beta.20231027.1" + "@azure-tools/typespec-csharp": "0.2.0-beta.20231102.4" } } diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 1746edb9a8699..768dbb3a8634b 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -588,42 +588,80 @@ function Get-dotnet-EmitterAdditionalOptions([string]$projectDirectory) { } function Update-dotnet-GeneratedSdks([string]$PackageDirectoriesFile) { - $showSummary = ($env:SYSTEM_DEBUG -eq 'true') -or ($VerbosePreference -ne 'SilentlyContinue') - $summaryArgs = $showSummary ? "/v:n /ds" : "" - - $packageDirectories = Get-Content $PackageDirectoriesFile | ConvertFrom-Json + Push-Location $RepoRoot + try { + Write-Host "`n`n======================================================================" + Write-Host "Generating projects" -ForegroundColor Yellow + Write-Host "======================================================================`n" - $directoriesWithErrors = @() + $packageDirectories = Get-Content $PackageDirectoriesFile | ConvertFrom-Json - Invoke-LoggedCommand "npm install -g autorest" + # Build the project list override file - foreach ($directory in $packageDirectories) { - Push-Location $RepoRoot - try { - Write-Host "`n`n======================================================================" - Write-Host "Generating projects under directory '$directory'" -ForegroundColor Yellow - Write-Host "======================================================================`n" + $lines = @('', ' ') - Invoke-LoggedCommand "dotnet msbuild /restore /t:GenerateCode /p:Scope=`"$directory`" $summaryArgs eng\service.proj" -GroupOutput + foreach ($directory in $packageDirectories) { + $projects = Get-ChildItem -Path "$RepoRoot/sdk/$directory" -Filter "*.csproj" -Recurse + foreach ($project in $projects) { + $lines += " " + } } - catch { - Write-Host "##[error]Error generating project under directory $directory" - Write-Host $_.Exception.Message - $directoriesWithErrors += $directory + + $lines += ' ', '' + $artifactsPath = Join-Path $RepoRoot "artifacts" + $projectListOverrideFile = Join-Path $artifactsPath "GeneratedSdks.proj" + + Write-Host "Creating project list override file $projectListOverrideFile`:" + $lines | ForEach-Object { " $_" } | Out-Host + + New-Item $artifactsPath -ItemType Directory -Force | Out-Null + $lines | Out-File $projectListOverrideFile -Encoding UTF8 + Write-Host "`n" + + # Initialize npm and npx cache + Write-Host "##[group]Initializing npm and npx cache" + + ## Generate code in sdk/template to prime the npx and npm cache + Push-Location "$RepoRoot/sdk/template/Azure.Template/src" + try { + Write-Host "Building then resetting sdk/template/Azure.Template/src" + Invoke-LoggedCommand "dotnet build /t:GenerateCode" + Invoke-LoggedCommand "git restore ." + Invoke-LoggedCommand "git clean . --force" } finally { Pop-Location } - } - if($directoriesWithErrors.Count -gt 0) { - Write-Host "##[error]Generation errors found in $($directoriesWithErrors.Count) directories:" + ## Run npm install over emitter-package.json in a temp folder to prime the npm cache + $tempFolder = New-TemporaryFile + $tempFolder | Remove-Item -Force + New-Item $tempFolder -ItemType Directory -Force | Out-Null - foreach ($directory in $directoriesWithErrors) { - Write-Host " $directory" + Push-Location $tempFolder + try { + Copy-Item "$RepoRoot/eng/emitter-package.json" "package.json" + if(Test-Path "$RepoRoot/eng/emitter-package-lock.json") { + Copy-Item "$RepoRoot/eng/emitter-package-lock.json" "package-lock.json" + Invoke-LoggedCommand "npm ci" + } else { + Invoke-LoggedCommand "npm install" + } + } + finally { + Pop-Location + $tempFolder | Remove-Item -Force -Recurse } - exit 1 - } + Write-Host "##[endgroup]" + + # Generate projects + $showSummary = ($env:SYSTEM_DEBUG -eq 'true') -or ($VerbosePreference -ne 'SilentlyContinue') + $summaryArgs = $showSummary ? "/v:n /ds" : "" + Invoke-LoggedCommand "dotnet msbuild /restore /t:GenerateCode /p:ProjectListOverrideFile=$(Resolve-Path $projectListOverrideFile -Relative) $summaryArgs eng\service.proj" -GroupOutput + } + finally { + Pop-Location + } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/Azure.ResourceManager.Advisor.sln b/sdk/advisor/Azure.ResourceManager.Advisor/Azure.ResourceManager.Advisor.sln index 151029b6a6d8c..d132e6b57d3d2 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/Azure.ResourceManager.Advisor.sln +++ b/sdk/advisor/Azure.ResourceManager.Advisor/Azure.ResourceManager.Advisor.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{3CFA86D2-8987-4247-93B5-8E7D91CD8B23}") = "Azure.ResourceManager.Advisor", "src\Azure.ResourceManager.Advisor.csproj", "{C6634A97-0E02-4AF4-A77C-5AF88B98F6DF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Advisor", "src\Azure.ResourceManager.Advisor.csproj", "{C6634A97-0E02-4AF4-A77C-5AF88B98F6DF}" EndProject -Project("{3CFA86D2-8987-4247-93B5-8E7D91CD8B23}") = "Azure.ResourceManager.Advisor.Tests", "tests\Azure.ResourceManager.Advisor.Tests.csproj", "{7098C3E5-3FD8-436A-AA52-633760A3FBBB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Advisor.Tests", "tests\Azure.ResourceManager.Advisor.Tests.csproj", "{7098C3E5-3FD8-436A-AA52-633760A3FBBB}" EndProject -Project("{3CFA86D2-8987-4247-93B5-8E7D91CD8B23}") = "Azure.ResourceManager.Advisor.Samples", "samples\Azure.ResourceManager.Advisor.Samples.csproj", "{97FA6568-948B-4053-B8FB-D478BAD2562C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Advisor.Samples", "samples\Azure.ResourceManager.Advisor.Samples.csproj", "{97FA6568-948B-4053-B8FB-D478BAD2562C}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A9E8060A-363D-4107-8D1D-8C1B37D0A77E} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {7098C3E5-3FD8-436A-AA52-633760A3FBBB}.Release|x64.Build.0 = Release|Any CPU {7098C3E5-3FD8-436A-AA52-633760A3FBBB}.Release|x86.ActiveCfg = Release|Any CPU {7098C3E5-3FD8-436A-AA52-633760A3FBBB}.Release|x86.Build.0 = Release|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Debug|x64.ActiveCfg = Debug|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Debug|x64.Build.0 = Debug|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Debug|x86.ActiveCfg = Debug|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Debug|x86.Build.0 = Debug|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Release|Any CPU.Build.0 = Release|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Release|x64.ActiveCfg = Release|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Release|x64.Build.0 = Release|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Release|x86.ActiveCfg = Release|Any CPU + {97FA6568-948B-4053-B8FB-D478BAD2562C}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A9E8060A-363D-4107-8D1D-8C1B37D0A77E} EndGlobalSection EndGlobal diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/api/Azure.ResourceManager.Advisor.netstandard2.0.cs b/sdk/advisor/Azure.ResourceManager.Advisor/api/Azure.ResourceManager.Advisor.netstandard2.0.cs index 5757353c37b39..8a969502b359f 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/api/Azure.ResourceManager.Advisor.netstandard2.0.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/api/Azure.ResourceManager.Advisor.netstandard2.0.cs @@ -144,6 +144,48 @@ protected SuppressionContractResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Advisor.SuppressionContractData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Advisor.Mocking +{ + public partial class MockableAdvisorArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAdvisorArmClient() { } + public virtual Azure.ResourceManager.Advisor.MetadataEntityResource GetMetadataEntityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetResourceRecommendationBase(Azure.Core.ResourceIdentifier scope, string recommendationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceRecommendationBaseAsync(Azure.Core.ResourceIdentifier scope, string recommendationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Advisor.ResourceRecommendationBaseResource GetResourceRecommendationBaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Advisor.ResourceRecommendationBaseCollection GetResourceRecommendationBases(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Advisor.SuppressionContractResource GetSuppressionContractResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAdvisorResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAdvisorResourceGroupResource() { } + public virtual Azure.Response CreateConfiguration(Azure.ResourceManager.Advisor.Models.ConfigurationName configurationName, Azure.ResourceManager.Advisor.Models.ConfigData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateConfigurationAsync(Azure.ResourceManager.Advisor.Models.ConfigurationName configurationName, Azure.ResourceManager.Advisor.Models.ConfigData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConfigurations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfigurationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAdvisorSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAdvisorSubscriptionResource() { } + public virtual Azure.Response CreateConfiguration(Azure.ResourceManager.Advisor.Models.ConfigurationName configurationName, Azure.ResourceManager.Advisor.Models.ConfigData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateConfigurationAsync(Azure.ResourceManager.Advisor.Models.ConfigurationName configurationName, Azure.ResourceManager.Advisor.Models.ConfigData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GenerateRecommendation(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GenerateRecommendationAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConfigurations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfigurationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetGenerateStatusRecommendation(System.Guid operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetGenerateStatusRecommendationAsync(System.Guid operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSuppressionContracts(int? top = default(int?), string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSuppressionContractsAsync(int? top = default(int?), string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAdvisorTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableAdvisorTenantResource() { } + public virtual Azure.ResourceManager.Advisor.MetadataEntityCollection GetMetadataEntities() { throw null; } + public virtual Azure.Response GetMetadataEntity(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMetadataEntityAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Advisor.Models { public static partial class ArmAdvisorModelFactory diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/AdvisorExtensions.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/AdvisorExtensions.cs index 25075484a2300..c5b7ff693fca0 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/AdvisorExtensions.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/AdvisorExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Advisor.Mocking; using Azure.ResourceManager.Advisor.Models; using Azure.ResourceManager.Resources; @@ -19,133 +20,39 @@ namespace Azure.ResourceManager.Advisor /// A class to add extension methods to Azure.ResourceManager.Advisor. public static partial class AdvisorExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableAdvisorArmClient GetMockableAdvisorArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAdvisorArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAdvisorResourceGroupResource GetMockableAdvisorResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAdvisorResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAdvisorSubscriptionResource GetMockableAdvisorSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAdvisorSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAdvisorTenantResource GetMockableAdvisorTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAdvisorTenantResource(client, resource.Id)); } - 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); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region MetadataEntityResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static MetadataEntityResource GetMetadataEntityResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - MetadataEntityResource.ValidateResourceId(id); - return new MetadataEntityResource(client, id); - } - ); - } - #endregion - - #region ResourceRecommendationBaseResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceRecommendationBaseResource GetResourceRecommendationBaseResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ResourceRecommendationBaseResource.ValidateResourceId(id); - return new ResourceRecommendationBaseResource(client, id); - } - ); - } - #endregion - - #region SuppressionContractResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of ResourceRecommendationBaseResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SuppressionContractResource GetSuppressionContractResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - SuppressionContractResource.ValidateResourceId(id); - return new SuppressionContractResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of ResourceRecommendationBaseResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of ResourceRecommendationBaseResources and their operations over a ResourceRecommendationBaseResource. public static ResourceRecommendationBaseCollection GetResourceRecommendationBases(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetResourceRecommendationBases(); + return GetMockableAdvisorArmClient(client).GetResourceRecommendationBases(scope); } /// @@ -160,17 +67,21 @@ public static ResourceRecommendationBaseCollection GetResourceRecommendationBase /// Recommendations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The recommendation ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceRecommendationBaseAsync(this ArmClient client, ResourceIdentifier scope, string recommendationId, CancellationToken cancellationToken = default) { - return await client.GetResourceRecommendationBases(scope).GetAsync(recommendationId, cancellationToken).ConfigureAwait(false); + return await GetMockableAdvisorArmClient(client).GetResourceRecommendationBaseAsync(scope, recommendationId, cancellationToken).ConfigureAwait(false); } /// @@ -185,17 +96,69 @@ public static async Task> GetResour /// Recommendations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The recommendation ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceRecommendationBase(this ArmClient client, ResourceIdentifier scope, string recommendationId, CancellationToken cancellationToken = default) { - return client.GetResourceRecommendationBases(scope).Get(recommendationId, cancellationToken); + return GetMockableAdvisorArmClient(client).GetResourceRecommendationBase(scope, recommendationId, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MetadataEntityResource GetMetadataEntityResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAdvisorArmClient(client).GetMetadataEntityResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceRecommendationBaseResource GetResourceRecommendationBaseResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAdvisorArmClient(client).GetResourceRecommendationBaseResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SuppressionContractResource GetSuppressionContractResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAdvisorArmClient(client).GetSuppressionContractResource(id); } /// @@ -210,13 +173,17 @@ public static Response GetResourceRecommenda /// Configurations_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConfigurationsAsync(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationsAsync(cancellationToken); + return GetMockableAdvisorResourceGroupResource(resourceGroupResource).GetConfigurationsAsync(cancellationToken); } /// @@ -231,13 +198,17 @@ public static AsyncPageable GetConfigurationsAsync(this ResourceGrou /// Configurations_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConfigurations(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurations(cancellationToken); + return GetMockableAdvisorResourceGroupResource(resourceGroupResource).GetConfigurations(cancellationToken); } /// @@ -252,6 +223,10 @@ public static Pageable GetConfigurations(this ResourceGroupResource /// Configurations_CreateInResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Advisor configuration name. Value must be 'default'. @@ -260,9 +235,7 @@ public static Pageable GetConfigurations(this ResourceGroupResource /// is null. public static async Task> CreateConfigurationAsync(this ResourceGroupResource resourceGroupResource, ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateConfigurationAsync(configurationName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableAdvisorResourceGroupResource(resourceGroupResource).CreateConfigurationAsync(configurationName, data, cancellationToken).ConfigureAwait(false); } /// @@ -277,6 +250,10 @@ public static async Task> CreateConfigurationAsync(this Res /// Configurations_CreateInResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Advisor configuration name. Value must be 'default'. @@ -285,9 +262,7 @@ public static async Task> CreateConfigurationAsync(this Res /// is null. public static Response CreateConfiguration(this ResourceGroupResource resourceGroupResource, ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateConfiguration(configurationName, data, cancellationToken); + return GetMockableAdvisorResourceGroupResource(resourceGroupResource).CreateConfiguration(configurationName, data, cancellationToken); } /// @@ -302,13 +277,17 @@ public static Response CreateConfiguration(this ResourceGroupResourc /// Configurations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConfigurationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurationsAsync(cancellationToken); + return GetMockableAdvisorSubscriptionResource(subscriptionResource).GetConfigurationsAsync(cancellationToken); } /// @@ -323,13 +302,17 @@ public static AsyncPageable GetConfigurationsAsync(this Subscription /// Configurations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConfigurations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurations(cancellationToken); + return GetMockableAdvisorSubscriptionResource(subscriptionResource).GetConfigurations(cancellationToken); } /// @@ -344,6 +327,10 @@ public static Pageable GetConfigurations(this SubscriptionResource s /// Configurations_CreateInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Advisor configuration name. Value must be 'default'. @@ -352,9 +339,7 @@ public static Pageable GetConfigurations(this SubscriptionResource s /// is null. public static async Task> CreateConfigurationAsync(this SubscriptionResource subscriptionResource, ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CreateConfigurationAsync(configurationName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableAdvisorSubscriptionResource(subscriptionResource).CreateConfigurationAsync(configurationName, data, cancellationToken).ConfigureAwait(false); } /// @@ -369,6 +354,10 @@ public static async Task> CreateConfigurationAsync(this Sub /// Configurations_CreateInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Advisor configuration name. Value must be 'default'. @@ -377,9 +366,7 @@ public static async Task> CreateConfigurationAsync(this Sub /// is null. public static Response CreateConfiguration(this SubscriptionResource subscriptionResource, ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CreateConfiguration(configurationName, data, cancellationToken); + return GetMockableAdvisorSubscriptionResource(subscriptionResource).CreateConfiguration(configurationName, data, cancellationToken); } /// @@ -394,12 +381,16 @@ public static Response CreateConfiguration(this SubscriptionResource /// Recommendations_Generate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task GenerateRecommendationAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GenerateRecommendationAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableAdvisorSubscriptionResource(subscriptionResource).GenerateRecommendationAsync(cancellationToken).ConfigureAwait(false); } /// @@ -414,12 +405,16 @@ public static async Task GenerateRecommendationAsync(this Subscription /// Recommendations_Generate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GenerateRecommendation(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GenerateRecommendation(cancellationToken); + return GetMockableAdvisorSubscriptionResource(subscriptionResource).GenerateRecommendation(cancellationToken); } /// @@ -434,13 +429,17 @@ public static Response GenerateRecommendation(this SubscriptionResource subscrip /// Recommendations_GetGenerateStatus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The operation ID, which can be found from the Location field in the generate recommendation response header. /// The cancellation token to use. public static async Task GetGenerateStatusRecommendationAsync(this SubscriptionResource subscriptionResource, Guid operationId, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetGenerateStatusRecommendationAsync(operationId, cancellationToken).ConfigureAwait(false); + return await GetMockableAdvisorSubscriptionResource(subscriptionResource).GetGenerateStatusRecommendationAsync(operationId, cancellationToken).ConfigureAwait(false); } /// @@ -455,13 +454,17 @@ public static async Task GetGenerateStatusRecommendationAsync(this Sub /// Recommendations_GetGenerateStatus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The operation ID, which can be found from the Location field in the generate recommendation response header. /// The cancellation token to use. public static Response GetGenerateStatusRecommendation(this SubscriptionResource subscriptionResource, Guid operationId, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGenerateStatusRecommendation(operationId, cancellationToken); + return GetMockableAdvisorSubscriptionResource(subscriptionResource).GetGenerateStatusRecommendation(operationId, cancellationToken); } /// @@ -476,6 +479,10 @@ public static Response GetGenerateStatusRecommendation(this SubscriptionResource /// Suppressions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The number of suppressions per page if a paged version of this API is being used. @@ -484,7 +491,7 @@ public static Response GetGenerateStatusRecommendation(this SubscriptionResource /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSuppressionContractsAsync(this SubscriptionResource subscriptionResource, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSuppressionContractsAsync(top, skipToken, cancellationToken); + return GetMockableAdvisorSubscriptionResource(subscriptionResource).GetSuppressionContractsAsync(top, skipToken, cancellationToken); } /// @@ -499,6 +506,10 @@ public static AsyncPageable GetSuppressionContracts /// Suppressions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The number of suppressions per page if a paged version of this API is being used. @@ -507,15 +518,21 @@ public static AsyncPageable GetSuppressionContracts /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSuppressionContracts(this SubscriptionResource subscriptionResource, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSuppressionContracts(top, skipToken, cancellationToken); + return GetMockableAdvisorSubscriptionResource(subscriptionResource).GetSuppressionContracts(top, skipToken, cancellationToken); } - /// Gets a collection of MetadataEntityResources in the TenantResource. + /// + /// Gets a collection of MetadataEntityResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MetadataEntityResources and their operations over a MetadataEntityResource. public static MetadataEntityCollection GetMetadataEntities(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetMetadataEntities(); + return GetMockableAdvisorTenantResource(tenantResource).GetMetadataEntities(); } /// @@ -530,16 +547,20 @@ public static MetadataEntityCollection GetMetadataEntities(this TenantResource t /// RecommendationMetadata_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of metadata entity. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMetadataEntityAsync(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) { - return await tenantResource.GetMetadataEntities().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAdvisorTenantResource(tenantResource).GetMetadataEntityAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -554,16 +575,20 @@ public static async Task> GetMetadataEntityAsyn /// RecommendationMetadata_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of metadata entity. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMetadataEntity(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) { - return tenantResource.GetMetadataEntities().Get(name, cancellationToken); + return GetMockableAdvisorTenantResource(tenantResource).GetMetadataEntity(name, cancellationToken); } } } diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index fad87f407baa7..0000000000000 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Advisor -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ResourceRecommendationBaseResources in the ArmResource. - /// An object representing collection of ResourceRecommendationBaseResources and their operations over a ResourceRecommendationBaseResource. - public virtual ResourceRecommendationBaseCollection GetResourceRecommendationBases() - { - return GetCachedClient(Client => new ResourceRecommendationBaseCollection(Client, Id)); - } - } -} diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorArmClient.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorArmClient.cs new file mode 100644 index 0000000000000..9a4b0a4f85d90 --- /dev/null +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorArmClient.cs @@ -0,0 +1,135 @@ +// 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.Advisor; + +namespace Azure.ResourceManager.Advisor.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAdvisorArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAdvisorArmClient() + { + } + + /// 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 MockableAdvisorArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAdvisorArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ResourceRecommendationBaseResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of ResourceRecommendationBaseResources and their operations over a ResourceRecommendationBaseResource. + public virtual ResourceRecommendationBaseCollection GetResourceRecommendationBases(ResourceIdentifier scope) + { + return new ResourceRecommendationBaseCollection(Client, scope); + } + + /// + /// Obtains details of a cached recommendation. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId} + /// + /// + /// Operation Id + /// Recommendations_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The recommendation ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceRecommendationBaseAsync(ResourceIdentifier scope, string recommendationId, CancellationToken cancellationToken = default) + { + return await GetResourceRecommendationBases(scope).GetAsync(recommendationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Obtains details of a cached recommendation. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId} + /// + /// + /// Operation Id + /// Recommendations_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The recommendation ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceRecommendationBase(ResourceIdentifier scope, string recommendationId, CancellationToken cancellationToken = default) + { + return GetResourceRecommendationBases(scope).Get(recommendationId, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MetadataEntityResource GetMetadataEntityResource(ResourceIdentifier id) + { + MetadataEntityResource.ValidateResourceId(id); + return new MetadataEntityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceRecommendationBaseResource GetResourceRecommendationBaseResource(ResourceIdentifier id) + { + ResourceRecommendationBaseResource.ValidateResourceId(id); + return new ResourceRecommendationBaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SuppressionContractResource GetSuppressionContractResource(ResourceIdentifier id) + { + SuppressionContractResource.ValidateResourceId(id); + return new SuppressionContractResource(Client, id); + } + } +} diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorResourceGroupResource.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorResourceGroupResource.cs new file mode 100644 index 0000000000000..13d2ef0b3d614 --- /dev/null +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorResourceGroupResource.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Advisor; +using Azure.ResourceManager.Advisor.Models; + +namespace Azure.ResourceManager.Advisor.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAdvisorResourceGroupResource : ArmResource + { + private ClientDiagnostics _configurationsClientDiagnostics; + private ConfigurationsRestOperations _configurationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAdvisorResourceGroupResource() + { + } + + /// 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 MockableAdvisorResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ConfigurationsClientDiagnostics => _configurationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Advisor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationsRestOperations ConfigurationsRestClient => _configurationsRestClient ??= new ConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Retrieve Azure Advisor configurations. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations + /// + /// + /// Operation Id + /// Configurations_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ConfigData.DeserializeConfigData, ConfigurationsClientDiagnostics, Pipeline, "MockableAdvisorResourceGroupResource.GetConfigurations", "value", null, cancellationToken); + } + + /// + /// Retrieve Azure Advisor configurations. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations + /// + /// + /// Operation Id + /// Configurations_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ConfigData.DeserializeConfigData, ConfigurationsClientDiagnostics, Pipeline, "MockableAdvisorResourceGroupResource.GetConfigurations", "value", null, cancellationToken); + } + + /// + /// Create/Overwrite Azure Advisor configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_CreateInResourceGroup + /// + /// + /// + /// Advisor configuration name. Value must be 'default'. + /// The Azure Advisor configuration data structure. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateConfigurationAsync(ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationsClientDiagnostics.CreateScope("MockableAdvisorResourceGroupResource.CreateConfiguration"); + scope.Start(); + try + { + var response = await ConfigurationsRestClient.CreateInResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create/Overwrite Azure Advisor configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_CreateInResourceGroup + /// + /// + /// + /// Advisor configuration name. Value must be 'default'. + /// The Azure Advisor configuration data structure. + /// The cancellation token to use. + /// is null. + public virtual Response CreateConfiguration(ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationsClientDiagnostics.CreateScope("MockableAdvisorResourceGroupResource.CreateConfiguration"); + scope.Start(); + try + { + var response = ConfigurationsRestClient.CreateInResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, configurationName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorSubscriptionResource.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorSubscriptionResource.cs new file mode 100644 index 0000000000000..487c3b5797808 --- /dev/null +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorSubscriptionResource.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Advisor; +using Azure.ResourceManager.Advisor.Models; + +namespace Azure.ResourceManager.Advisor.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAdvisorSubscriptionResource : ArmResource + { + private ClientDiagnostics _configurationsClientDiagnostics; + private ConfigurationsRestOperations _configurationsRestClient; + private ClientDiagnostics _resourceRecommendationBaseRecommendationsClientDiagnostics; + private RecommendationsRestOperations _resourceRecommendationBaseRecommendationsRestClient; + private ClientDiagnostics _suppressionContractSuppressionsClientDiagnostics; + private SuppressionsRestOperations _suppressionContractSuppressionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAdvisorSubscriptionResource() + { + } + + /// 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 MockableAdvisorSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ConfigurationsClientDiagnostics => _configurationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Advisor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationsRestOperations ConfigurationsRestClient => _configurationsRestClient ??= new ConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ResourceRecommendationBaseRecommendationsClientDiagnostics => _resourceRecommendationBaseRecommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Advisor", ResourceRecommendationBaseResource.ResourceType.Namespace, Diagnostics); + private RecommendationsRestOperations ResourceRecommendationBaseRecommendationsRestClient => _resourceRecommendationBaseRecommendationsRestClient ??= new RecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ResourceRecommendationBaseResource.ResourceType)); + private ClientDiagnostics SuppressionContractSuppressionsClientDiagnostics => _suppressionContractSuppressionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Advisor", SuppressionContractResource.ResourceType.Namespace, Diagnostics); + private SuppressionsRestOperations SuppressionContractSuppressionsRestClient => _suppressionContractSuppressionsRestClient ??= new SuppressionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SuppressionContractResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations + /// + /// + /// Operation Id + /// Configurations_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConfigData.DeserializeConfigData, ConfigurationsClientDiagnostics, Pipeline, "MockableAdvisorSubscriptionResource.GetConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations + /// + /// + /// Operation Id + /// Configurations_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConfigData.DeserializeConfigData, ConfigurationsClientDiagnostics, Pipeline, "MockableAdvisorSubscriptionResource.GetConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_CreateInSubscription + /// + /// + /// + /// Advisor configuration name. Value must be 'default'. + /// The Azure Advisor configuration data structure. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateConfigurationAsync(ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationsClientDiagnostics.CreateScope("MockableAdvisorSubscriptionResource.CreateConfiguration"); + scope.Start(); + try + { + var response = await ConfigurationsRestClient.CreateInSubscriptionAsync(Id.SubscriptionId, configurationName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName} + /// + /// + /// Operation Id + /// Configurations_CreateInSubscription + /// + /// + /// + /// Advisor configuration name. Value must be 'default'. + /// The Azure Advisor configuration data structure. + /// The cancellation token to use. + /// is null. + public virtual Response CreateConfiguration(ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationsClientDiagnostics.CreateScope("MockableAdvisorSubscriptionResource.CreateConfiguration"); + scope.Start(); + try + { + var response = ConfigurationsRestClient.CreateInSubscription(Id.SubscriptionId, configurationName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations + /// + /// + /// Operation Id + /// Recommendations_Generate + /// + /// + /// + /// The cancellation token to use. + public virtual async Task GenerateRecommendationAsync(CancellationToken cancellationToken = default) + { + using var scope = ResourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("MockableAdvisorSubscriptionResource.GenerateRecommendation"); + scope.Start(); + try + { + var response = await ResourceRecommendationBaseRecommendationsRestClient.GenerateAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations + /// + /// + /// Operation Id + /// Recommendations_Generate + /// + /// + /// + /// The cancellation token to use. + public virtual Response GenerateRecommendation(CancellationToken cancellationToken = default) + { + using var scope = ResourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("MockableAdvisorSubscriptionResource.GenerateRecommendation"); + scope.Start(); + try + { + var response = ResourceRecommendationBaseRecommendationsRestClient.Generate(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId} + /// + /// + /// Operation Id + /// Recommendations_GetGenerateStatus + /// + /// + /// + /// The operation ID, which can be found from the Location field in the generate recommendation response header. + /// The cancellation token to use. + public virtual async Task GetGenerateStatusRecommendationAsync(Guid operationId, CancellationToken cancellationToken = default) + { + using var scope = ResourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("MockableAdvisorSubscriptionResource.GetGenerateStatusRecommendation"); + scope.Start(); + try + { + var response = await ResourceRecommendationBaseRecommendationsRestClient.GetGenerateStatusAsync(Id.SubscriptionId, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId} + /// + /// + /// Operation Id + /// Recommendations_GetGenerateStatus + /// + /// + /// + /// The operation ID, which can be found from the Location field in the generate recommendation response header. + /// The cancellation token to use. + public virtual Response GetGenerateStatusRecommendation(Guid operationId, CancellationToken cancellationToken = default) + { + using var scope = ResourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("MockableAdvisorSubscriptionResource.GetGenerateStatusRecommendation"); + scope.Start(); + try + { + var response = ResourceRecommendationBaseRecommendationsRestClient.GetGenerateStatus(Id.SubscriptionId, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions + /// + /// + /// Operation Id + /// Suppressions_List + /// + /// + /// + /// The number of suppressions per page if a paged version of this API is being used. + /// The page-continuation token to use with a paged version of this API. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSuppressionContractsAsync(int? top = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SuppressionContractSuppressionsRestClient.CreateListRequest(Id.SubscriptionId, top, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SuppressionContractSuppressionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SuppressionContractResource(Client, SuppressionContractData.DeserializeSuppressionContractData(e)), SuppressionContractSuppressionsClientDiagnostics, Pipeline, "MockableAdvisorSubscriptionResource.GetSuppressionContracts", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions + /// + /// + /// Operation Id + /// Suppressions_List + /// + /// + /// + /// The number of suppressions per page if a paged version of this API is being used. + /// The page-continuation token to use with a paged version of this API. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSuppressionContracts(int? top = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SuppressionContractSuppressionsRestClient.CreateListRequest(Id.SubscriptionId, top, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SuppressionContractSuppressionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SuppressionContractResource(Client, SuppressionContractData.DeserializeSuppressionContractData(e)), SuppressionContractSuppressionsClientDiagnostics, Pipeline, "MockableAdvisorSubscriptionResource.GetSuppressionContracts", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorTenantResource.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorTenantResource.cs new file mode 100644 index 0000000000000..59d7eb2649ef5 --- /dev/null +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/MockableAdvisorTenantResource.cs @@ -0,0 +1,92 @@ +// 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.Advisor; + +namespace Azure.ResourceManager.Advisor.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableAdvisorTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAdvisorTenantResource() + { + } + + /// 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 MockableAdvisorTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MetadataEntityResources in the TenantResource. + /// An object representing collection of MetadataEntityResources and their operations over a MetadataEntityResource. + public virtual MetadataEntityCollection GetMetadataEntities() + { + return GetCachedClient(client => new MetadataEntityCollection(client, Id)); + } + + /// + /// Gets the metadata entity. + /// + /// + /// Request Path + /// /providers/Microsoft.Advisor/metadata/{name} + /// + /// + /// Operation Id + /// RecommendationMetadata_Get + /// + /// + /// + /// Name of metadata entity. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMetadataEntityAsync(string name, CancellationToken cancellationToken = default) + { + return await GetMetadataEntities().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the metadata entity. + /// + /// + /// Request Path + /// /providers/Microsoft.Advisor/metadata/{name} + /// + /// + /// Operation Id + /// RecommendationMetadata_Get + /// + /// + /// + /// Name of metadata entity. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMetadataEntity(string name, CancellationToken cancellationToken = default) + { + return GetMetadataEntities().Get(name, cancellationToken); + } + } +} diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 82d84ad305839..0000000000000 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Advisor.Models; - -namespace Azure.ResourceManager.Advisor -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _configurationsClientDiagnostics; - private ConfigurationsRestOperations _configurationsRestClient; - - /// 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 ClientDiagnostics ConfigurationsClientDiagnostics => _configurationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Advisor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ConfigurationsRestOperations ConfigurationsRestClient => _configurationsRestClient ??= new ConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Retrieve Azure Advisor configurations. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations - /// - /// - /// Operation Id - /// Configurations_ListByResourceGroup - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ConfigData.DeserializeConfigData, ConfigurationsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurations", "value", null, cancellationToken); - } - - /// - /// Retrieve Azure Advisor configurations. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations - /// - /// - /// Operation Id - /// Configurations_ListByResourceGroup - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ConfigData.DeserializeConfigData, ConfigurationsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurations", "value", null, cancellationToken); - } - - /// - /// Create/Overwrite Azure Advisor configuration. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName} - /// - /// - /// Operation Id - /// Configurations_CreateInResourceGroup - /// - /// - /// - /// Advisor configuration name. Value must be 'default'. - /// The Azure Advisor configuration data structure. - /// The cancellation token to use. - public virtual async Task> CreateConfigurationAsync(ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateConfiguration"); - scope.Start(); - try - { - var response = await ConfigurationsRestClient.CreateInResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create/Overwrite Azure Advisor configuration. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName} - /// - /// - /// Operation Id - /// Configurations_CreateInResourceGroup - /// - /// - /// - /// Advisor configuration name. Value must be 'default'. - /// The Azure Advisor configuration data structure. - /// The cancellation token to use. - public virtual Response CreateConfiguration(ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateConfiguration"); - scope.Start(); - try - { - var response = ConfigurationsRestClient.CreateInResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, configurationName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 8522f25ddb5ed..0000000000000 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Advisor.Models; - -namespace Azure.ResourceManager.Advisor -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _configurationsClientDiagnostics; - private ConfigurationsRestOperations _configurationsRestClient; - private ClientDiagnostics _resourceRecommendationBaseRecommendationsClientDiagnostics; - private RecommendationsRestOperations _resourceRecommendationBaseRecommendationsRestClient; - private ClientDiagnostics _suppressionContractSuppressionsClientDiagnostics; - private SuppressionsRestOperations _suppressionContractSuppressionsRestClient; - - /// 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 ConfigurationsClientDiagnostics => _configurationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Advisor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ConfigurationsRestOperations ConfigurationsRestClient => _configurationsRestClient ??= new ConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ResourceRecommendationBaseRecommendationsClientDiagnostics => _resourceRecommendationBaseRecommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Advisor", ResourceRecommendationBaseResource.ResourceType.Namespace, Diagnostics); - private RecommendationsRestOperations ResourceRecommendationBaseRecommendationsRestClient => _resourceRecommendationBaseRecommendationsRestClient ??= new RecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ResourceRecommendationBaseResource.ResourceType)); - private ClientDiagnostics SuppressionContractSuppressionsClientDiagnostics => _suppressionContractSuppressionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Advisor", SuppressionContractResource.ResourceType.Namespace, Diagnostics); - private SuppressionsRestOperations SuppressionContractSuppressionsRestClient => _suppressionContractSuppressionsRestClient ??= new SuppressionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SuppressionContractResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations - /// - /// - /// Operation Id - /// Configurations_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConfigData.DeserializeConfigData, ConfigurationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations - /// - /// - /// Operation Id - /// Configurations_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConfigData.DeserializeConfigData, ConfigurationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName} - /// - /// - /// Operation Id - /// Configurations_CreateInSubscription - /// - /// - /// - /// Advisor configuration name. Value must be 'default'. - /// The Azure Advisor configuration data structure. - /// The cancellation token to use. - public virtual async Task> CreateConfigurationAsync(ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateConfiguration"); - scope.Start(); - try - { - var response = await ConfigurationsRestClient.CreateInSubscriptionAsync(Id.SubscriptionId, configurationName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName} - /// - /// - /// Operation Id - /// Configurations_CreateInSubscription - /// - /// - /// - /// Advisor configuration name. Value must be 'default'. - /// The Azure Advisor configuration data structure. - /// The cancellation token to use. - public virtual Response CreateConfiguration(ConfigurationName configurationName, ConfigData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateConfiguration"); - scope.Start(); - try - { - var response = ConfigurationsRestClient.CreateInSubscription(Id.SubscriptionId, configurationName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations - /// - /// - /// Operation Id - /// Recommendations_Generate - /// - /// - /// - /// The cancellation token to use. - public virtual async Task GenerateRecommendationAsync(CancellationToken cancellationToken = default) - { - using var scope = ResourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GenerateRecommendation"); - scope.Start(); - try - { - var response = await ResourceRecommendationBaseRecommendationsRestClient.GenerateAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations - /// - /// - /// Operation Id - /// Recommendations_Generate - /// - /// - /// - /// The cancellation token to use. - public virtual Response GenerateRecommendation(CancellationToken cancellationToken = default) - { - using var scope = ResourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GenerateRecommendation"); - scope.Start(); - try - { - var response = ResourceRecommendationBaseRecommendationsRestClient.Generate(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId} - /// - /// - /// Operation Id - /// Recommendations_GetGenerateStatus - /// - /// - /// - /// The operation ID, which can be found from the Location field in the generate recommendation response header. - /// The cancellation token to use. - public virtual async Task GetGenerateStatusRecommendationAsync(Guid operationId, CancellationToken cancellationToken = default) - { - using var scope = ResourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGenerateStatusRecommendation"); - scope.Start(); - try - { - var response = await ResourceRecommendationBaseRecommendationsRestClient.GetGenerateStatusAsync(Id.SubscriptionId, operationId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId} - /// - /// - /// Operation Id - /// Recommendations_GetGenerateStatus - /// - /// - /// - /// The operation ID, which can be found from the Location field in the generate recommendation response header. - /// The cancellation token to use. - public virtual Response GetGenerateStatusRecommendation(Guid operationId, CancellationToken cancellationToken = default) - { - using var scope = ResourceRecommendationBaseRecommendationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGenerateStatusRecommendation"); - scope.Start(); - try - { - var response = ResourceRecommendationBaseRecommendationsRestClient.GetGenerateStatus(Id.SubscriptionId, operationId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions - /// - /// - /// Operation Id - /// Suppressions_List - /// - /// - /// - /// The number of suppressions per page if a paged version of this API is being used. - /// The page-continuation token to use with a paged version of this API. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSuppressionContractsAsync(int? top = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SuppressionContractSuppressionsRestClient.CreateListRequest(Id.SubscriptionId, top, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SuppressionContractSuppressionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SuppressionContractResource(Client, SuppressionContractData.DeserializeSuppressionContractData(e)), SuppressionContractSuppressionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSuppressionContracts", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions - /// - /// - /// Operation Id - /// Suppressions_List - /// - /// - /// - /// The number of suppressions per page if a paged version of this API is being used. - /// The page-continuation token to use with a paged version of this API. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSuppressionContracts(int? top = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SuppressionContractSuppressionsRestClient.CreateListRequest(Id.SubscriptionId, top, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SuppressionContractSuppressionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SuppressionContractResource(Client, SuppressionContractData.DeserializeSuppressionContractData(e)), SuppressionContractSuppressionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSuppressionContracts", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 80d853e6ef1b3..0000000000000 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Advisor -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of MetadataEntityResources in the TenantResource. - /// An object representing collection of MetadataEntityResources and their operations over a MetadataEntityResource. - public virtual MetadataEntityCollection GetMetadataEntities() - { - return GetCachedClient(Client => new MetadataEntityCollection(Client, Id)); - } - } -} diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityResource.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityResource.cs index bf4bb4c11efc0..0baea71d9433d 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityResource.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/MetadataEntityResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.Advisor public partial class MetadataEntityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string name) { var resourceId = $"/providers/Microsoft.Advisor/metadata/{name}"; diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseResource.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseResource.cs index ac101318f892e..cf8cb07c4061a 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseResource.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Advisor public partial class ResourceRecommendationBaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The recommendationId. public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string recommendationId) { var resourceId = $"{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}"; @@ -90,7 +92,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SuppressionContractResources and their operations over a SuppressionContractResource. public virtual SuppressionContractCollection GetSuppressionContracts() { - return GetCachedClient(Client => new SuppressionContractCollection(Client, Id)); + return GetCachedClient(client => new SuppressionContractCollection(client, Id)); } /// @@ -108,8 +110,8 @@ public virtual SuppressionContractCollection GetSuppressionContracts() /// /// The name of the suppression. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSuppressionContractAsync(string name, CancellationToken cancellationToken = default) { @@ -131,8 +133,8 @@ public virtual async Task> GetSuppressionC /// /// The name of the suppression. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSuppressionContract(string name, CancellationToken cancellationToken = default) { diff --git a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractResource.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractResource.cs index 2c45f1d821d3a..be503d2844184 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractResource.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/SuppressionContractResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Advisor public partial class SuppressionContractResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The recommendationId. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string recommendationId, string name) { var resourceId = $"{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}"; diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/api/Azure.ResourceManager.AgFoodPlatform.netstandard2.0.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/api/Azure.ResourceManager.AgFoodPlatform.netstandard2.0.cs index 21f71310d1749..ffe0a31819e19 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/api/Azure.ResourceManager.AgFoodPlatform.netstandard2.0.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/api/Azure.ResourceManager.AgFoodPlatform.netstandard2.0.cs @@ -148,7 +148,7 @@ protected FarmBeatCollection() { } } public partial class FarmBeatData : Azure.ResourceManager.Models.TrackedResourceData { - public FarmBeatData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FarmBeatData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Uri InstanceUri { get { throw null; } } public Azure.ResourceManager.AgFoodPlatform.AgFoodPlatformPrivateEndpointConnectionData PrivateEndpointConnections { get { throw null; } } @@ -227,6 +227,40 @@ protected FarmBeatsExtensionResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.AgFoodPlatform.Mocking +{ + public partial class MockableAgFoodPlatformArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAgFoodPlatformArmClient() { } + public virtual Azure.ResourceManager.AgFoodPlatform.AgFoodPlatformPrivateEndpointConnectionResource GetAgFoodPlatformPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AgFoodPlatform.AgFoodPlatformPrivateLinkResource GetAgFoodPlatformPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AgFoodPlatform.ExtensionResource GetExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AgFoodPlatform.FarmBeatResource GetFarmBeatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AgFoodPlatform.FarmBeatsExtensionResource GetFarmBeatsExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAgFoodPlatformResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAgFoodPlatformResourceGroupResource() { } + public virtual Azure.Response GetFarmBeat(string farmBeatsResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFarmBeatAsync(string farmBeatsResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AgFoodPlatform.FarmBeatCollection GetFarmBeats() { throw null; } + } + public partial class MockableAgFoodPlatformSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAgFoodPlatformSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityLocation(Azure.ResourceManager.AgFoodPlatform.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityLocationAsync(Azure.ResourceManager.AgFoodPlatform.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetFarmBeats(int? maxPageSize = default(int?), string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFarmBeatsAsync(int? maxPageSize = default(int?), string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAgFoodPlatformTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableAgFoodPlatformTenantResource() { } + public virtual Azure.Response GetFarmBeatsExtension(string farmBeatsExtensionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFarmBeatsExtensionAsync(string farmBeatsExtensionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AgFoodPlatform.FarmBeatsExtensionCollection GetFarmBeatsExtensions() { throw null; } + } +} namespace Azure.ResourceManager.AgFoodPlatform.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionResource.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionResource.cs index 65f58e3e9f22b..9d61b6da268d7 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionResource.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AgFoodPlatform public partial class AgFoodPlatformPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The farmBeatsResourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string farmBeatsResourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResource.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResource.cs index 6b22c89d4b9cc..8e4f3ceeca079 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResource.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/AgFoodPlatformPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AgFoodPlatform public partial class AgFoodPlatformPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The farmBeatsResourceName. + /// The subResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string farmBeatsResourceName, string subResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources/{subResourceName}"; diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionResource.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionResource.cs index bf9d2987bc93d..b5cc8792d65a1 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionResource.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/ExtensionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AgFoodPlatform public partial class ExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The farmBeatsResourceName. + /// The extensionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string farmBeatsResourceName, string extensionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}"; diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/AgFoodPlatformExtensions.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/AgFoodPlatformExtensions.cs index b8c180120633e..21e9afb3de07a 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/AgFoodPlatformExtensions.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/AgFoodPlatformExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.AgFoodPlatform.Mocking; using Azure.ResourceManager.AgFoodPlatform.Models; using Azure.ResourceManager.Resources; @@ -19,154 +20,118 @@ namespace Azure.ResourceManager.AgFoodPlatform /// A class to add extension methods to Azure.ResourceManager.AgFoodPlatform. public static partial class AgFoodPlatformExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAgFoodPlatformArmClient GetMockableAgFoodPlatformArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAgFoodPlatformArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAgFoodPlatformResourceGroupResource GetMockableAgFoodPlatformResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAgFoodPlatformResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAgFoodPlatformSubscriptionResource GetMockableAgFoodPlatformSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAgFoodPlatformSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAgFoodPlatformTenantResource GetMockableAgFoodPlatformTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAgFoodPlatformTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region ExtensionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExtensionResource GetExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExtensionResource.ValidateResourceId(id); - return new ExtensionResource(client, id); - } - ); + return GetMockableAgFoodPlatformArmClient(client).GetExtensionResource(id); } - #endregion - #region FarmBeatsExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FarmBeatsExtensionResource GetFarmBeatsExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FarmBeatsExtensionResource.ValidateResourceId(id); - return new FarmBeatsExtensionResource(client, id); - } - ); + return GetMockableAgFoodPlatformArmClient(client).GetFarmBeatsExtensionResource(id); } - #endregion - #region FarmBeatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FarmBeatResource GetFarmBeatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FarmBeatResource.ValidateResourceId(id); - return new FarmBeatResource(client, id); - } - ); + return GetMockableAgFoodPlatformArmClient(client).GetFarmBeatResource(id); } - #endregion - #region AgFoodPlatformPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AgFoodPlatformPrivateEndpointConnectionResource GetAgFoodPlatformPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AgFoodPlatformPrivateEndpointConnectionResource.ValidateResourceId(id); - return new AgFoodPlatformPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableAgFoodPlatformArmClient(client).GetAgFoodPlatformPrivateEndpointConnectionResource(id); } - #endregion - #region AgFoodPlatformPrivateLinkResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AgFoodPlatformPrivateLinkResource GetAgFoodPlatformPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AgFoodPlatformPrivateLinkResource.ValidateResourceId(id); - return new AgFoodPlatformPrivateLinkResource(client, id); - } - ); + return GetMockableAgFoodPlatformArmClient(client).GetAgFoodPlatformPrivateLinkResource(id); } - #endregion - /// Gets a collection of FarmBeatResources in the ResourceGroupResource. + /// + /// Gets a collection of FarmBeatResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of FarmBeatResources and their operations over a FarmBeatResource. public static FarmBeatCollection GetFarmBeats(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetFarmBeats(); + return GetMockableAgFoodPlatformResourceGroupResource(resourceGroupResource).GetFarmBeats(); } /// @@ -181,16 +146,20 @@ public static FarmBeatCollection GetFarmBeats(this ResourceGroupResource resourc /// FarmBeatsModels_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// FarmBeats resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetFarmBeatAsync(this ResourceGroupResource resourceGroupResource, string farmBeatsResourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetFarmBeats().GetAsync(farmBeatsResourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableAgFoodPlatformResourceGroupResource(resourceGroupResource).GetFarmBeatAsync(farmBeatsResourceName, cancellationToken).ConfigureAwait(false); } /// @@ -205,16 +174,20 @@ public static async Task> GetFarmBeatAsync(this Resou /// FarmBeatsModels_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// FarmBeats resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetFarmBeat(this ResourceGroupResource resourceGroupResource, string farmBeatsResourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetFarmBeats().Get(farmBeatsResourceName, cancellationToken); + return GetMockableAgFoodPlatformResourceGroupResource(resourceGroupResource).GetFarmBeat(farmBeatsResourceName, cancellationToken); } /// @@ -229,6 +202,10 @@ public static Response GetFarmBeat(this ResourceGroupResource /// FarmBeatsModels_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// @@ -240,7 +217,7 @@ public static Response GetFarmBeat(this ResourceGroupResource /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetFarmBeatsAsync(this SubscriptionResource subscriptionResource, int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFarmBeatsAsync(maxPageSize, skipToken, cancellationToken); + return GetMockableAgFoodPlatformSubscriptionResource(subscriptionResource).GetFarmBeatsAsync(maxPageSize, skipToken, cancellationToken); } /// @@ -255,6 +232,10 @@ public static AsyncPageable GetFarmBeatsAsync(this Subscriptio /// FarmBeatsModels_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// @@ -266,7 +247,7 @@ public static AsyncPageable GetFarmBeatsAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetFarmBeats(this SubscriptionResource subscriptionResource, int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFarmBeats(maxPageSize, skipToken, cancellationToken); + return GetMockableAgFoodPlatformSubscriptionResource(subscriptionResource).GetFarmBeats(maxPageSize, skipToken, cancellationToken); } /// @@ -281,6 +262,10 @@ public static Pageable GetFarmBeats(this SubscriptionResource /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// NameAvailabilityRequest object. @@ -288,9 +273,7 @@ public static Pageable GetFarmBeats(this SubscriptionResource /// is null. public static async Task> CheckNameAvailabilityLocationAsync(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityLocationAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableAgFoodPlatformSubscriptionResource(subscriptionResource).CheckNameAvailabilityLocationAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -305,6 +288,10 @@ public static async Task> CheckNameAvail /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// NameAvailabilityRequest object. @@ -312,17 +299,21 @@ public static async Task> CheckNameAvail /// is null. public static Response CheckNameAvailabilityLocation(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityLocation(content, cancellationToken); + return GetMockableAgFoodPlatformSubscriptionResource(subscriptionResource).CheckNameAvailabilityLocation(content, cancellationToken); } - /// Gets a collection of FarmBeatsExtensionResources in the TenantResource. + /// + /// Gets a collection of FarmBeatsExtensionResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of FarmBeatsExtensionResources and their operations over a FarmBeatsExtensionResource. public static FarmBeatsExtensionCollection GetFarmBeatsExtensions(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetFarmBeatsExtensions(); + return GetMockableAgFoodPlatformTenantResource(tenantResource).GetFarmBeatsExtensions(); } /// @@ -337,16 +328,20 @@ public static FarmBeatsExtensionCollection GetFarmBeatsExtensions(this TenantRes /// FarmBeatsExtensions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// farmBeatsExtensionId to be queried. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetFarmBeatsExtensionAsync(this TenantResource tenantResource, string farmBeatsExtensionId, CancellationToken cancellationToken = default) { - return await tenantResource.GetFarmBeatsExtensions().GetAsync(farmBeatsExtensionId, cancellationToken).ConfigureAwait(false); + return await GetMockableAgFoodPlatformTenantResource(tenantResource).GetFarmBeatsExtensionAsync(farmBeatsExtensionId, cancellationToken).ConfigureAwait(false); } /// @@ -361,16 +356,20 @@ public static async Task> GetFarmBeatsExten /// FarmBeatsExtensions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// farmBeatsExtensionId to be queried. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetFarmBeatsExtension(this TenantResource tenantResource, string farmBeatsExtensionId, CancellationToken cancellationToken = default) { - return tenantResource.GetFarmBeatsExtensions().Get(farmBeatsExtensionId, cancellationToken); + return GetMockableAgFoodPlatformTenantResource(tenantResource).GetFarmBeatsExtension(farmBeatsExtensionId, cancellationToken); } } } diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformArmClient.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformArmClient.cs new file mode 100644 index 0000000000000..296a3b8aa9ba5 --- /dev/null +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.AgFoodPlatform; + +namespace Azure.ResourceManager.AgFoodPlatform.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAgFoodPlatformArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAgFoodPlatformArmClient() + { + } + + /// 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 MockableAgFoodPlatformArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAgFoodPlatformArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExtensionResource GetExtensionResource(ResourceIdentifier id) + { + ExtensionResource.ValidateResourceId(id); + return new ExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FarmBeatsExtensionResource GetFarmBeatsExtensionResource(ResourceIdentifier id) + { + FarmBeatsExtensionResource.ValidateResourceId(id); + return new FarmBeatsExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FarmBeatResource GetFarmBeatResource(ResourceIdentifier id) + { + FarmBeatResource.ValidateResourceId(id); + return new FarmBeatResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AgFoodPlatformPrivateEndpointConnectionResource GetAgFoodPlatformPrivateEndpointConnectionResource(ResourceIdentifier id) + { + AgFoodPlatformPrivateEndpointConnectionResource.ValidateResourceId(id); + return new AgFoodPlatformPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AgFoodPlatformPrivateLinkResource GetAgFoodPlatformPrivateLinkResource(ResourceIdentifier id) + { + AgFoodPlatformPrivateLinkResource.ValidateResourceId(id); + return new AgFoodPlatformPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformResourceGroupResource.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformResourceGroupResource.cs new file mode 100644 index 0000000000000..a3a6eea9b71a9 --- /dev/null +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.AgFoodPlatform; + +namespace Azure.ResourceManager.AgFoodPlatform.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAgFoodPlatformResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAgFoodPlatformResourceGroupResource() + { + } + + /// 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 MockableAgFoodPlatformResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of FarmBeatResources in the ResourceGroupResource. + /// An object representing collection of FarmBeatResources and their operations over a FarmBeatResource. + public virtual FarmBeatCollection GetFarmBeats() + { + return GetCachedClient(client => new FarmBeatCollection(client, Id)); + } + + /// + /// Get FarmBeats resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName} + /// + /// + /// Operation Id + /// FarmBeatsModels_Get + /// + /// + /// + /// FarmBeats resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFarmBeatAsync(string farmBeatsResourceName, CancellationToken cancellationToken = default) + { + return await GetFarmBeats().GetAsync(farmBeatsResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get FarmBeats resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName} + /// + /// + /// Operation Id + /// FarmBeatsModels_Get + /// + /// + /// + /// FarmBeats resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFarmBeat(string farmBeatsResourceName, CancellationToken cancellationToken = default) + { + return GetFarmBeats().Get(farmBeatsResourceName, cancellationToken); + } + } +} diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformSubscriptionResource.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformSubscriptionResource.cs new file mode 100644 index 0000000000000..c3c289f6f43f3 --- /dev/null +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformSubscriptionResource.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AgFoodPlatform; +using Azure.ResourceManager.AgFoodPlatform.Models; + +namespace Azure.ResourceManager.AgFoodPlatform.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAgFoodPlatformSubscriptionResource : ArmResource + { + private ClientDiagnostics _farmBeatFarmBeatsModelsClientDiagnostics; + private FarmBeatsModelsRestOperations _farmBeatFarmBeatsModelsRestClient; + private ClientDiagnostics _locationsClientDiagnostics; + private LocationsRestOperations _locationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAgFoodPlatformSubscriptionResource() + { + } + + /// 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 MockableAgFoodPlatformSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics FarmBeatFarmBeatsModelsClientDiagnostics => _farmBeatFarmBeatsModelsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AgFoodPlatform", FarmBeatResource.ResourceType.Namespace, Diagnostics); + private FarmBeatsModelsRestOperations FarmBeatFarmBeatsModelsRestClient => _farmBeatFarmBeatsModelsRestClient ??= new FarmBeatsModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FarmBeatResource.ResourceType)); + private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AgFoodPlatform", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the FarmBeats instances for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/farmBeats + /// + /// + /// Operation Id + /// FarmBeatsModels_ListBySubscription + /// + /// + /// + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFarmBeatsAsync(int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), FarmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "MockableAgFoodPlatformSubscriptionResource.GetFarmBeats", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the FarmBeats instances for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/farmBeats + /// + /// + /// Operation Id + /// FarmBeatsModels_ListBySubscription + /// + /// + /// + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFarmBeats(int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), FarmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "MockableAgFoodPlatformSubscriptionResource.GetFarmBeats", "value", "nextLink", cancellationToken); + } + + /// + /// Checks the name availability of the resource with requested resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// NameAvailabilityRequest object. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNameAvailabilityLocationAsync(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableAgFoodPlatformSubscriptionResource.CheckNameAvailabilityLocation"); + scope.Start(); + try + { + var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks the name availability of the resource with requested resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// NameAvailabilityRequest object. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNameAvailabilityLocation(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableAgFoodPlatformSubscriptionResource.CheckNameAvailabilityLocation"); + scope.Start(); + try + { + var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformTenantResource.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformTenantResource.cs new file mode 100644 index 0000000000000..e4db68c412dba --- /dev/null +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/MockableAgFoodPlatformTenantResource.cs @@ -0,0 +1,92 @@ +// 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.AgFoodPlatform; + +namespace Azure.ResourceManager.AgFoodPlatform.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableAgFoodPlatformTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAgFoodPlatformTenantResource() + { + } + + /// 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 MockableAgFoodPlatformTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of FarmBeatsExtensionResources in the TenantResource. + /// An object representing collection of FarmBeatsExtensionResources and their operations over a FarmBeatsExtensionResource. + public virtual FarmBeatsExtensionCollection GetFarmBeatsExtensions() + { + return GetCachedClient(client => new FarmBeatsExtensionCollection(client, Id)); + } + + /// + /// Get farmBeats extension. + /// + /// + /// Request Path + /// /providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions/{farmBeatsExtensionId} + /// + /// + /// Operation Id + /// FarmBeatsExtensions_Get + /// + /// + /// + /// farmBeatsExtensionId to be queried. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFarmBeatsExtensionAsync(string farmBeatsExtensionId, CancellationToken cancellationToken = default) + { + return await GetFarmBeatsExtensions().GetAsync(farmBeatsExtensionId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get farmBeats extension. + /// + /// + /// Request Path + /// /providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions/{farmBeatsExtensionId} + /// + /// + /// Operation Id + /// FarmBeatsExtensions_Get + /// + /// + /// + /// farmBeatsExtensionId to be queried. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFarmBeatsExtension(string farmBeatsExtensionId, CancellationToken cancellationToken = default) + { + return GetFarmBeatsExtensions().Get(farmBeatsExtensionId, cancellationToken); + } + } +} diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index e81402522c472..0000000000000 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.AgFoodPlatform -{ - /// 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 FarmBeatResources in the ResourceGroupResource. - /// An object representing collection of FarmBeatResources and their operations over a FarmBeatResource. - public virtual FarmBeatCollection GetFarmBeats() - { - return GetCachedClient(Client => new FarmBeatCollection(Client, Id)); - } - } -} diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 515f535a6c993..0000000000000 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AgFoodPlatform.Models; - -namespace Azure.ResourceManager.AgFoodPlatform -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _farmBeatFarmBeatsModelsClientDiagnostics; - private FarmBeatsModelsRestOperations _farmBeatFarmBeatsModelsRestClient; - private ClientDiagnostics _locationsClientDiagnostics; - private LocationsRestOperations _locationsRestClient; - - /// 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 FarmBeatFarmBeatsModelsClientDiagnostics => _farmBeatFarmBeatsModelsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AgFoodPlatform", FarmBeatResource.ResourceType.Namespace, Diagnostics); - private FarmBeatsModelsRestOperations FarmBeatFarmBeatsModelsRestClient => _farmBeatFarmBeatsModelsRestClient ??= new FarmBeatsModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FarmBeatResource.ResourceType)); - private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AgFoodPlatform", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists the FarmBeats instances for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/farmBeats - /// - /// - /// Operation Id - /// FarmBeatsModels_ListBySubscription - /// - /// - /// - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetFarmBeatsAsync(int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), FarmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFarmBeats", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the FarmBeats instances for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/farmBeats - /// - /// - /// Operation Id - /// FarmBeatsModels_ListBySubscription - /// - /// - /// - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetFarmBeats(int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FarmBeatFarmBeatsModelsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FarmBeatResource(Client, FarmBeatData.DeserializeFarmBeatData(e)), FarmBeatFarmBeatsModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFarmBeats", "value", "nextLink", cancellationToken); - } - - /// - /// Checks the name availability of the resource with requested resource name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// NameAvailabilityRequest object. - /// The cancellation token to use. - public virtual async Task> CheckNameAvailabilityLocationAsync(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityLocation"); - scope.Start(); - try - { - var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks the name availability of the resource with requested resource name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// NameAvailabilityRequest object. - /// The cancellation token to use. - public virtual Response CheckNameAvailabilityLocation(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityLocation"); - scope.Start(); - try - { - var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 5d348e71c3643..0000000000000 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.AgFoodPlatform -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of FarmBeatsExtensionResources in the TenantResource. - /// An object representing collection of FarmBeatsExtensionResources and their operations over a FarmBeatsExtensionResource. - public virtual FarmBeatsExtensionCollection GetFarmBeatsExtensions() - { - return GetCachedClient(Client => new FarmBeatsExtensionCollection(Client, Id)); - } - } -} diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatResource.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatResource.cs index 921bc54e5779c..c48cdc9adf3ff 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatResource.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.AgFoodPlatform public partial class FarmBeatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The farmBeatsResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string farmBeatsResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ExtensionResources and their operations over a ExtensionResource. public virtual ExtensionCollection GetExtensions() { - return GetCachedClient(Client => new ExtensionCollection(Client, Id)); + return GetCachedClient(client => new ExtensionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ExtensionCollection GetExtensions() /// /// Id of extension resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExtensionAsync(string extensionId, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetExtensionAsync(string /// /// Id of extension resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExtension(string extensionId, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetExtension(string extensionId, Canc /// An object representing collection of AgFoodPlatformPrivateEndpointConnectionResources and their operations over a AgFoodPlatformPrivateEndpointConnectionResource. public virtual AgFoodPlatformPrivateEndpointConnectionCollection GetAgFoodPlatformPrivateEndpointConnections() { - return GetCachedClient(Client => new AgFoodPlatformPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new AgFoodPlatformPrivateEndpointConnectionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual AgFoodPlatformPrivateEndpointConnectionCollection GetAgFoodPlatfo /// /// Private endpoint connection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAgFoodPlatformPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task /// Private endpoint connection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAgFoodPlatformPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetAgFo /// An object representing collection of AgFoodPlatformPrivateLinkResources and their operations over a AgFoodPlatformPrivateLinkResource. public virtual AgFoodPlatformPrivateLinkResourceCollection GetAgFoodPlatformPrivateLinkResources() { - return GetCachedClient(Client => new AgFoodPlatformPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new AgFoodPlatformPrivateLinkResourceCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual AgFoodPlatformPrivateLinkResourceCollection GetAgFoodPlatformPriv /// /// Sub resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAgFoodPlatformPrivateLinkResourceAsync(string subResourceName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetAgFood /// /// Sub resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAgFoodPlatformPrivateLinkResource(string subResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionResource.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionResource.cs index 61cff80bea32c..f29ab40c5d7b2 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionResource.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatsExtensionResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.AgFoodPlatform public partial class FarmBeatsExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The farmBeatsExtensionId. public static ResourceIdentifier CreateResourceIdentifier(string farmBeatsExtensionId) { var resourceId = $"/providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions/{farmBeatsExtensionId}"; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_ApplicationData.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_ApplicationData.cs index 37f7c06698a19..f24dcfa4cbfa5 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_ApplicationData.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_ApplicationData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Attachments.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Attachments.cs index d61859d1ce48c..a4a6e36419e19 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Attachments.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Attachments.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.IO; using System.Text.Json; using System.Threading.Tasks; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Boundaries.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Boundaries.cs index 7929bad0756a0..f2aaa29fe6815 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Boundaries.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Boundaries.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_CropProducts.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_CropProducts.cs index a5845ca7b172b..5f14c89c4d3c4 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_CropProducts.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_CropProducts.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Crops.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Crops.cs index 9822df4bf4504..929f51c61e8b4 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Crops.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Crops.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_DeviceDataModels.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_DeviceDataModels.cs index 856bc792b09d8..32014a5d65e59 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_DeviceDataModels.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_DeviceDataModels.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Devices.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Devices.cs index 80077b5b817c4..ce4c534219d4a 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Devices.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Devices.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_FarmerOAuthTokens.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_FarmerOAuthTokens.cs index e4caafa46a8c0..aaa61e7dfbcb5 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_FarmerOAuthTokens.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_FarmerOAuthTokens.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Farms.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Farms.cs index b3e770274d6df..632e040aa6d60 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Farms.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Farms.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Fields.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Fields.cs index e487714c14715..a59ad0cca576f 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Fields.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Fields.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_HarvestData.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_HarvestData.cs index f3fcd77eed3bb..2ee4f3b13c337 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_HarvestData.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_HarvestData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_InsightAttachments.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_InsightAttachments.cs index 0f840aff679d6..4fb2dea0f083d 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_InsightAttachments.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_InsightAttachments.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.IO; using System.Text.Json; using System.Threading.Tasks; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Insights.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Insights.cs index ceebbd53fc746..0460f60d20346 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Insights.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Insights.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_ManagementZones.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_ManagementZones.cs index 5469e32c5481c..dc3434f79e46c 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_ManagementZones.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_ManagementZones.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_NutrientAnalyses.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_NutrientAnalyses.cs index acd259fb651af..2900c9370fe3f 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_NutrientAnalyses.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_NutrientAnalyses.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_OAuthProviders.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_OAuthProviders.cs index 240bd6cada815..35911b49784ec 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_OAuthProviders.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_OAuthProviders.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Parties.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Parties.cs index 3f86def8caf1e..e07e386f7b679 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Parties.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Parties.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PlantTissueAnalyses.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PlantTissueAnalyses.cs index c4511a4781189..4f511a74bf864 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PlantTissueAnalyses.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PlantTissueAnalyses.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PlantingData.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PlantingData.cs index 485f8accbf078..2b22ff5c6aa02 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PlantingData.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PlantingData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PrescriptionMaps.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PrescriptionMaps.cs index 93aca99d3a272..7fefe0554fdaa 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PrescriptionMaps.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_PrescriptionMaps.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Prescriptions.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Prescriptions.cs index 17fdceccefb61..336389e7f718b 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Prescriptions.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Prescriptions.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Scenes.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Scenes.cs index cee0fc9d27a30..c9bc2ea708e21 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Scenes.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Scenes.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.IO; using System.Text.Json; using System.Threading.Tasks; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SeasonalFields.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SeasonalFields.cs index 8daa33d405013..2d2f8446be17e 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SeasonalFields.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SeasonalFields.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Seasons.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Seasons.cs index be6dd895e8d9e..fbdce01490428 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Seasons.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Seasons.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorDataModels.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorDataModels.cs index 9af0eba83c478..14051badb446e 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorDataModels.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorDataModels.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorMappings.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorMappings.cs index ee74ba24bb6bc..85b4fb840f28d 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorMappings.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorMappings.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorPartnerIntegrations.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorPartnerIntegrations.cs index 687ccac9ec05b..a914e4848fc08 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorPartnerIntegrations.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_SensorPartnerIntegrations.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Sensors.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Sensors.cs index d72286de21cd0..d90d153d311fb 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Sensors.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Sensors.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_TillageData.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_TillageData.cs index ee1df3d0a915b..fa823ffbc48ab 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_TillageData.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_TillageData.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Zones.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Zones.cs index b9fdb1ebf439b..17bceec234dfc 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Zones.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/Generated/Samples/Samples_Zones.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/api/Azure.ResourceManager.AlertsManagement.netstandard2.0.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/api/Azure.ResourceManager.AlertsManagement.netstandard2.0.cs index 65d27f1a5f2a5..3b515453f6c81 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/api/Azure.ResourceManager.AlertsManagement.netstandard2.0.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/api/Azure.ResourceManager.AlertsManagement.netstandard2.0.cs @@ -19,7 +19,7 @@ protected AlertProcessingRuleCollection() { } } public partial class AlertProcessingRuleData : Azure.ResourceManager.Models.TrackedResourceData { - public AlertProcessingRuleData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AlertProcessingRuleData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.AlertsManagement.Models.AlertProcessingRuleProperties Properties { get { throw null; } set { } } } public partial class AlertProcessingRuleResource : Azure.ResourceManager.ArmResource @@ -151,6 +151,45 @@ protected SmartGroupResource() { } public virtual System.Threading.Tasks.Task> GetHistoryAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.AlertsManagement.Mocking +{ + public partial class MockableAlertsManagementArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAlertsManagementArmClient() { } + public virtual Azure.ResourceManager.AlertsManagement.AlertProcessingRuleResource GetAlertProcessingRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AlertsManagement.ServiceAlertResource GetServiceAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AlertsManagement.SmartGroupResource GetSmartGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAlertsManagementResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAlertsManagementResourceGroupResource() { } + public virtual Azure.Response GetAlertProcessingRule(string alertProcessingRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAlertProcessingRuleAsync(string alertProcessingRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AlertsManagement.AlertProcessingRuleCollection GetAlertProcessingRules() { throw null; } + } + public partial class MockableAlertsManagementSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAlertsManagementSubscriptionResource() { } + public virtual Azure.Pageable GetAlertProcessingRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAlertProcessingRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetServiceAlert(System.Guid alertId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceAlertAsync(System.Guid alertId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AlertsManagement.ServiceAlertCollection GetServiceAlerts() { throw null; } + public virtual Azure.Response GetServiceAlertSummary(Azure.ResourceManager.AlertsManagement.Models.AlertsSummaryGroupByField groupby, bool? includeSmartGroupsCount = default(bool?), string targetResource = null, string targetResourceType = null, string targetResourceGroup = null, Azure.ResourceManager.AlertsManagement.Models.MonitorServiceSourceForAlert? monitorService = default(Azure.ResourceManager.AlertsManagement.Models.MonitorServiceSourceForAlert?), Azure.ResourceManager.AlertsManagement.Models.MonitorCondition? monitorCondition = default(Azure.ResourceManager.AlertsManagement.Models.MonitorCondition?), Azure.ResourceManager.AlertsManagement.Models.ServiceAlertSeverity? severity = default(Azure.ResourceManager.AlertsManagement.Models.ServiceAlertSeverity?), Azure.ResourceManager.AlertsManagement.Models.ServiceAlertState? alertState = default(Azure.ResourceManager.AlertsManagement.Models.ServiceAlertState?), string alertRule = null, Azure.ResourceManager.AlertsManagement.Models.TimeRangeFilter? timeRange = default(Azure.ResourceManager.AlertsManagement.Models.TimeRangeFilter?), string customTimeRange = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetServiceAlertSummary(Azure.ResourceManager.AlertsManagement.Models.SubscriptionResourceGetServiceAlertSummaryOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceAlertSummaryAsync(Azure.ResourceManager.AlertsManagement.Models.AlertsSummaryGroupByField groupby, bool? includeSmartGroupsCount = default(bool?), string targetResource = null, string targetResourceType = null, string targetResourceGroup = null, Azure.ResourceManager.AlertsManagement.Models.MonitorServiceSourceForAlert? monitorService = default(Azure.ResourceManager.AlertsManagement.Models.MonitorServiceSourceForAlert?), Azure.ResourceManager.AlertsManagement.Models.MonitorCondition? monitorCondition = default(Azure.ResourceManager.AlertsManagement.Models.MonitorCondition?), Azure.ResourceManager.AlertsManagement.Models.ServiceAlertSeverity? severity = default(Azure.ResourceManager.AlertsManagement.Models.ServiceAlertSeverity?), Azure.ResourceManager.AlertsManagement.Models.ServiceAlertState? alertState = default(Azure.ResourceManager.AlertsManagement.Models.ServiceAlertState?), string alertRule = null, Azure.ResourceManager.AlertsManagement.Models.TimeRangeFilter? timeRange = default(Azure.ResourceManager.AlertsManagement.Models.TimeRangeFilter?), string customTimeRange = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceAlertSummaryAsync(Azure.ResourceManager.AlertsManagement.Models.SubscriptionResourceGetServiceAlertSummaryOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSmartGroup(System.Guid smartGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSmartGroupAsync(System.Guid smartGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AlertsManagement.SmartGroupCollection GetSmartGroups() { throw null; } + } + public partial class MockableAlertsManagementTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableAlertsManagementTenantResource() { } + public virtual Azure.Response GetServiceAlertMetadata(Azure.ResourceManager.AlertsManagement.Models.RetrievedInformationIdentifier identifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceAlertMetadataAsync(Azure.ResourceManager.AlertsManagement.Models.RetrievedInformationIdentifier identifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.AlertsManagement.Models { public abstract partial class AlertProcessingRuleAction diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Custom/Extensions/AlertsManagementExtensions.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Custom/Extensions/AlertsManagementExtensions.cs index ef495fafb8ae2..0600a9f4183db 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Custom/Extensions/AlertsManagementExtensions.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Custom/Extensions/AlertsManagementExtensions.cs @@ -39,19 +39,7 @@ public static partial class AlertsManagementExtensions /// The cancellation token to use. public static async Task> GetServiceAlertSummaryAsync(this SubscriptionResource subscriptionResource, AlertsSummaryGroupByField groupby, bool? includeSmartGroupsCount = null, string targetResource = null, string targetResourceType = null, string targetResourceGroup = null, MonitorServiceSourceForAlert? monitorService = null, MonitorCondition? monitorCondition = null, ServiceAlertSeverity? severity = null, ServiceAlertState? alertState = null, string alertRule = null, TimeRangeFilter? timeRange = null, string customTimeRange = null, CancellationToken cancellationToken = default) { - SubscriptionResourceGetServiceAlertSummaryOptions options = new SubscriptionResourceGetServiceAlertSummaryOptions(groupby); - options.IncludeSmartGroupsCount = includeSmartGroupsCount; - options.TargetResource = targetResource; - options.TargetResourceType = targetResourceType; - options.TargetResourceGroup = targetResourceGroup; - options.MonitorService = monitorService; - options.MonitorCondition = monitorCondition; - options.Severity = severity; - options.AlertState = alertState; - options.AlertRule = alertRule; - options.TimeRange = timeRange; - options.CustomTimeRange = customTimeRange; - return await subscriptionResource.GetServiceAlertSummaryAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetServiceAlertSummaryAsync(groupby, includeSmartGroupsCount, targetResource, targetResourceType, targetResourceGroup, monitorService, monitorCondition, severity, alertState, alertRule, timeRange, customTimeRange, cancellationToken).ConfigureAwait(false); } /// @@ -83,19 +71,7 @@ public static async Task> GetServiceAlertSummaryAs /// The cancellation token to use. public static Response GetServiceAlertSummary(this SubscriptionResource subscriptionResource, AlertsSummaryGroupByField groupby, bool? includeSmartGroupsCount = null, string targetResource = null, string targetResourceType = null, string targetResourceGroup = null, MonitorServiceSourceForAlert? monitorService = null, MonitorCondition? monitorCondition = null, ServiceAlertSeverity? severity = null, ServiceAlertState? alertState = null, string alertRule = null, TimeRangeFilter? timeRange = null, string customTimeRange = null, CancellationToken cancellationToken = default) { - SubscriptionResourceGetServiceAlertSummaryOptions options = new SubscriptionResourceGetServiceAlertSummaryOptions(groupby); - options.IncludeSmartGroupsCount = includeSmartGroupsCount; - options.TargetResource = targetResource; - options.TargetResourceType = targetResourceType; - options.TargetResourceGroup = targetResourceGroup; - options.MonitorService = monitorService; - options.MonitorCondition = monitorCondition; - options.Severity = severity; - options.AlertState = alertState; - options.AlertRule = alertRule; - options.TimeRange = timeRange; - options.CustomTimeRange = customTimeRange; - return subscriptionResource.GetServiceAlertSummary(options, cancellationToken); + return GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetServiceAlertSummary(groupby, includeSmartGroupsCount, targetResource, targetResourceType, targetResourceGroup, monitorService, monitorCondition, severity, alertState, alertRule, timeRange, customTimeRange, cancellationToken); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Custom/Extensions/MockableAlertsManagementSubscriptionResource.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Custom/Extensions/MockableAlertsManagementSubscriptionResource.cs new file mode 100644 index 0000000000000..591410394979a --- /dev/null +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Custom/Extensions/MockableAlertsManagementSubscriptionResource.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure.ResourceManager.AlertsManagement.Models; + +namespace Azure.ResourceManager.AlertsManagement.Mocking +{ + public partial class MockableAlertsManagementSubscriptionResource : ArmResource + { + /// + /// Get a summarized count of your alerts grouped by various parameters (e.g. grouping by 'Severity' returns the count of alerts for each severity). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary + /// + /// + /// Operation Id + /// Alerts_GetSummary + /// + /// + /// + /// This parameter allows the result set to be grouped by input fields (Maximum 2 comma separated fields supported). For example, groupby=severity or groupby=severity,alertstate. + /// Include count of the SmartGroups as part of the summary. Default value is 'false'. + /// Filter by target resource( which is full ARM ID) Default value is select all. + /// Filter by target resource type. Default value is select all. + /// Filter by target resource group name. Default value is select all. + /// Filter by monitor service which generates the alert instance. Default value is select all. + /// Filter by monitor condition which is either 'Fired' or 'Resolved'. Default value is to select all. + /// Filter by severity. Default value is select all. + /// Filter by state of the alert instance. Default value is to select all. + /// Filter by specific alert rule. Default value is to select all. + /// Filter by time range by below listed values. Default value is 1 day. + /// Filter by custom time range in the format <start-time>/<end-time> where time is in (ISO-8601 format)'. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. + /// The cancellation token to use. + public virtual async Task> GetServiceAlertSummaryAsync(AlertsSummaryGroupByField groupby, bool? includeSmartGroupsCount = null, string targetResource = null, string targetResourceType = null, string targetResourceGroup = null, MonitorServiceSourceForAlert? monitorService = null, MonitorCondition? monitorCondition = null, ServiceAlertSeverity? severity = null, ServiceAlertState? alertState = null, string alertRule = null, TimeRangeFilter? timeRange = null, string customTimeRange = null, CancellationToken cancellationToken = default) + { + SubscriptionResourceGetServiceAlertSummaryOptions options = new SubscriptionResourceGetServiceAlertSummaryOptions(groupby); + options.IncludeSmartGroupsCount = includeSmartGroupsCount; + options.TargetResource = targetResource; + options.TargetResourceType = targetResourceType; + options.TargetResourceGroup = targetResourceGroup; + options.MonitorService = monitorService; + options.MonitorCondition = monitorCondition; + options.Severity = severity; + options.AlertState = alertState; + options.AlertRule = alertRule; + options.TimeRange = timeRange; + options.CustomTimeRange = customTimeRange; + return await GetServiceAlertSummaryAsync(options, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a summarized count of your alerts grouped by various parameters (e.g. grouping by 'Severity' returns the count of alerts for each severity). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary + /// + /// + /// Operation Id + /// Alerts_GetSummary + /// + /// + /// + /// This parameter allows the result set to be grouped by input fields (Maximum 2 comma separated fields supported). For example, groupby=severity or groupby=severity,alertstate. + /// Include count of the SmartGroups as part of the summary. Default value is 'false'. + /// Filter by target resource( which is full ARM ID) Default value is select all. + /// Filter by target resource type. Default value is select all. + /// Filter by target resource group name. Default value is select all. + /// Filter by monitor service which generates the alert instance. Default value is select all. + /// Filter by monitor condition which is either 'Fired' or 'Resolved'. Default value is to select all. + /// Filter by severity. Default value is select all. + /// Filter by state of the alert instance. Default value is to select all. + /// Filter by specific alert rule. Default value is to select all. + /// Filter by time range by below listed values. Default value is 1 day. + /// Filter by custom time range in the format <start-time>/<end-time> where time is in (ISO-8601 format)'. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. + /// The cancellation token to use. + public virtual Response GetServiceAlertSummary(AlertsSummaryGroupByField groupby, bool? includeSmartGroupsCount = null, string targetResource = null, string targetResourceType = null, string targetResourceGroup = null, MonitorServiceSourceForAlert? monitorService = null, MonitorCondition? monitorCondition = null, ServiceAlertSeverity? severity = null, ServiceAlertState? alertState = null, string alertRule = null, TimeRangeFilter? timeRange = null, string customTimeRange = null, CancellationToken cancellationToken = default) + { + SubscriptionResourceGetServiceAlertSummaryOptions options = new SubscriptionResourceGetServiceAlertSummaryOptions(groupby); + options.IncludeSmartGroupsCount = includeSmartGroupsCount; + options.TargetResource = targetResource; + options.TargetResourceType = targetResourceType; + options.TargetResourceGroup = targetResourceGroup; + options.MonitorService = monitorService; + options.MonitorCondition = monitorCondition; + options.Severity = severity; + options.AlertState = alertState; + options.AlertRule = alertRule; + options.TimeRange = timeRange; + options.CustomTimeRange = customTimeRange; + return GetServiceAlertSummary(options, cancellationToken); + } + } +} diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleResource.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleResource.cs index fc69b48de8b21..183a61d0762ed 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleResource.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/AlertProcessingRuleResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.AlertsManagement public partial class AlertProcessingRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The alertProcessingRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string alertProcessingRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules/{alertProcessingRuleName}"; diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/AlertsManagementExtensions.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/AlertsManagementExtensions.cs index 696c1cd905bff..64b8625214983 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/AlertsManagementExtensions.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/AlertsManagementExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.AlertsManagement.Mocking; using Azure.ResourceManager.AlertsManagement.Models; using Azure.ResourceManager.Resources; @@ -19,116 +20,86 @@ namespace Azure.ResourceManager.AlertsManagement /// A class to add extension methods to Azure.ResourceManager.AlertsManagement. public static partial class AlertsManagementExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAlertsManagementArmClient GetMockableAlertsManagementArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAlertsManagementArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAlertsManagementResourceGroupResource GetMockableAlertsManagementResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAlertsManagementResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAlertsManagementSubscriptionResource GetMockableAlertsManagementSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAlertsManagementSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAlertsManagementTenantResource GetMockableAlertsManagementTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAlertsManagementTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region AlertProcessingRuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AlertProcessingRuleResource GetAlertProcessingRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AlertProcessingRuleResource.ValidateResourceId(id); - return new AlertProcessingRuleResource(client, id); - } - ); + return GetMockableAlertsManagementArmClient(client).GetAlertProcessingRuleResource(id); } - #endregion - #region ServiceAlertResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceAlertResource GetServiceAlertResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceAlertResource.ValidateResourceId(id); - return new ServiceAlertResource(client, id); - } - ); + return GetMockableAlertsManagementArmClient(client).GetServiceAlertResource(id); } - #endregion - #region SmartGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SmartGroupResource GetSmartGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SmartGroupResource.ValidateResourceId(id); - return new SmartGroupResource(client, id); - } - ); + return GetMockableAlertsManagementArmClient(client).GetSmartGroupResource(id); } - #endregion - /// Gets a collection of AlertProcessingRuleResources in the ResourceGroupResource. + /// + /// Gets a collection of AlertProcessingRuleResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AlertProcessingRuleResources and their operations over a AlertProcessingRuleResource. public static AlertProcessingRuleCollection GetAlertProcessingRules(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAlertProcessingRules(); + return GetMockableAlertsManagementResourceGroupResource(resourceGroupResource).GetAlertProcessingRules(); } /// @@ -143,16 +114,20 @@ public static AlertProcessingRuleCollection GetAlertProcessingRules(this Resourc /// AlertProcessingRules_GetByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the alert processing rule that needs to be fetched. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAlertProcessingRuleAsync(this ResourceGroupResource resourceGroupResource, string alertProcessingRuleName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAlertProcessingRules().GetAsync(alertProcessingRuleName, cancellationToken).ConfigureAwait(false); + return await GetMockableAlertsManagementResourceGroupResource(resourceGroupResource).GetAlertProcessingRuleAsync(alertProcessingRuleName, cancellationToken).ConfigureAwait(false); } /// @@ -167,24 +142,34 @@ public static async Task> GetAlertProcessi /// AlertProcessingRules_GetByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the alert processing rule that needs to be fetched. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAlertProcessingRule(this ResourceGroupResource resourceGroupResource, string alertProcessingRuleName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAlertProcessingRules().Get(alertProcessingRuleName, cancellationToken); + return GetMockableAlertsManagementResourceGroupResource(resourceGroupResource).GetAlertProcessingRule(alertProcessingRuleName, cancellationToken); } - /// Gets a collection of ServiceAlertResources in the SubscriptionResource. + /// + /// Gets a collection of ServiceAlertResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ServiceAlertResources and their operations over a ServiceAlertResource. public static ServiceAlertCollection GetServiceAlerts(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceAlerts(); + return GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetServiceAlerts(); } /// @@ -199,6 +184,10 @@ public static ServiceAlertCollection GetServiceAlerts(this SubscriptionResource /// Alerts_GetById /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Unique ID of an alert instance. @@ -206,7 +195,7 @@ public static ServiceAlertCollection GetServiceAlerts(this SubscriptionResource [ForwardsClientCalls] public static async Task> GetServiceAlertAsync(this SubscriptionResource subscriptionResource, Guid alertId, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetServiceAlerts().GetAsync(alertId, cancellationToken).ConfigureAwait(false); + return await GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetServiceAlertAsync(alertId, cancellationToken).ConfigureAwait(false); } /// @@ -221,6 +210,10 @@ public static async Task> GetServiceAlertAsync(th /// Alerts_GetById /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Unique ID of an alert instance. @@ -228,15 +221,21 @@ public static async Task> GetServiceAlertAsync(th [ForwardsClientCalls] public static Response GetServiceAlert(this SubscriptionResource subscriptionResource, Guid alertId, CancellationToken cancellationToken = default) { - return subscriptionResource.GetServiceAlerts().Get(alertId, cancellationToken); + return GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetServiceAlert(alertId, cancellationToken); } - /// Gets a collection of SmartGroupResources in the SubscriptionResource. + /// + /// Gets a collection of SmartGroupResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SmartGroupResources and their operations over a SmartGroupResource. public static SmartGroupCollection GetSmartGroups(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSmartGroups(); + return GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetSmartGroups(); } /// @@ -251,6 +250,10 @@ public static SmartGroupCollection GetSmartGroups(this SubscriptionResource subs /// SmartGroups_GetById /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Smart group unique id. @@ -258,7 +261,7 @@ public static SmartGroupCollection GetSmartGroups(this SubscriptionResource subs [ForwardsClientCalls] public static async Task> GetSmartGroupAsync(this SubscriptionResource subscriptionResource, Guid smartGroupId, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSmartGroups().GetAsync(smartGroupId, cancellationToken).ConfigureAwait(false); + return await GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetSmartGroupAsync(smartGroupId, cancellationToken).ConfigureAwait(false); } /// @@ -273,6 +276,10 @@ public static async Task> GetSmartGroupAsync(this S /// SmartGroups_GetById /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Smart group unique id. @@ -280,7 +287,7 @@ public static async Task> GetSmartGroupAsync(this S [ForwardsClientCalls] public static Response GetSmartGroup(this SubscriptionResource subscriptionResource, Guid smartGroupId, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSmartGroups().Get(smartGroupId, cancellationToken); + return GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetSmartGroup(smartGroupId, cancellationToken); } /// @@ -295,13 +302,17 @@ public static Response GetSmartGroup(this SubscriptionResour /// AlertProcessingRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAlertProcessingRulesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAlertProcessingRulesAsync(cancellationToken); + return GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetAlertProcessingRulesAsync(cancellationToken); } /// @@ -316,13 +327,17 @@ public static AsyncPageable GetAlertProcessingRules /// AlertProcessingRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAlertProcessingRules(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAlertProcessingRules(cancellationToken); + return GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetAlertProcessingRules(cancellationToken); } /// @@ -337,6 +352,10 @@ public static Pageable GetAlertProcessingRules(this /// Alerts_GetSummary /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -344,9 +363,7 @@ public static Pageable GetAlertProcessingRules(this /// is null. public static async Task> GetServiceAlertSummaryAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetServiceAlertSummaryOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceAlertSummaryAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetServiceAlertSummaryAsync(options, cancellationToken).ConfigureAwait(false); } /// @@ -361,6 +378,10 @@ public static async Task> GetServiceAlertSummaryAs /// Alerts_GetSummary /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -368,9 +389,7 @@ public static async Task> GetServiceAlertSummaryAs /// is null. public static Response GetServiceAlertSummary(this SubscriptionResource subscriptionResource, SubscriptionResourceGetServiceAlertSummaryOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceAlertSummary(options, cancellationToken); + return GetMockableAlertsManagementSubscriptionResource(subscriptionResource).GetServiceAlertSummary(options, cancellationToken); } /// @@ -385,13 +404,17 @@ public static Response GetServiceAlertSummary(this Subscrip /// Alerts_MetaData /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Identification of the information to be retrieved by API call. /// The cancellation token to use. public static async Task> GetServiceAlertMetadataAsync(this TenantResource tenantResource, RetrievedInformationIdentifier identifier, CancellationToken cancellationToken = default) { - return await GetTenantResourceExtensionClient(tenantResource).GetServiceAlertMetadataAsync(identifier, cancellationToken).ConfigureAwait(false); + return await GetMockableAlertsManagementTenantResource(tenantResource).GetServiceAlertMetadataAsync(identifier, cancellationToken).ConfigureAwait(false); } /// @@ -406,13 +429,17 @@ public static async Task> GetServiceAlertMetadata /// Alerts_MetaData /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Identification of the information to be retrieved by API call. /// The cancellation token to use. public static Response GetServiceAlertMetadata(this TenantResource tenantResource, RetrievedInformationIdentifier identifier, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetServiceAlertMetadata(identifier, cancellationToken); + return GetMockableAlertsManagementTenantResource(tenantResource).GetServiceAlertMetadata(identifier, cancellationToken); } } } diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementArmClient.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementArmClient.cs new file mode 100644 index 0000000000000..567359f122300 --- /dev/null +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.AlertsManagement; + +namespace Azure.ResourceManager.AlertsManagement.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAlertsManagementArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAlertsManagementArmClient() + { + } + + /// 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 MockableAlertsManagementArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAlertsManagementArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AlertProcessingRuleResource GetAlertProcessingRuleResource(ResourceIdentifier id) + { + AlertProcessingRuleResource.ValidateResourceId(id); + return new AlertProcessingRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceAlertResource GetServiceAlertResource(ResourceIdentifier id) + { + ServiceAlertResource.ValidateResourceId(id); + return new ServiceAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SmartGroupResource GetSmartGroupResource(ResourceIdentifier id) + { + SmartGroupResource.ValidateResourceId(id); + return new SmartGroupResource(Client, id); + } + } +} diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementResourceGroupResource.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementResourceGroupResource.cs new file mode 100644 index 0000000000000..e882895bdfcbb --- /dev/null +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.AlertsManagement; + +namespace Azure.ResourceManager.AlertsManagement.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAlertsManagementResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAlertsManagementResourceGroupResource() + { + } + + /// 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 MockableAlertsManagementResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AlertProcessingRuleResources in the ResourceGroupResource. + /// An object representing collection of AlertProcessingRuleResources and their operations over a AlertProcessingRuleResource. + public virtual AlertProcessingRuleCollection GetAlertProcessingRules() + { + return GetCachedClient(client => new AlertProcessingRuleCollection(client, Id)); + } + + /// + /// Get an alert processing rule by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules/{alertProcessingRuleName} + /// + /// + /// Operation Id + /// AlertProcessingRules_GetByName + /// + /// + /// + /// The name of the alert processing rule that needs to be fetched. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAlertProcessingRuleAsync(string alertProcessingRuleName, CancellationToken cancellationToken = default) + { + return await GetAlertProcessingRules().GetAsync(alertProcessingRuleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an alert processing rule by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules/{alertProcessingRuleName} + /// + /// + /// Operation Id + /// AlertProcessingRules_GetByName + /// + /// + /// + /// The name of the alert processing rule that needs to be fetched. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAlertProcessingRule(string alertProcessingRuleName, CancellationToken cancellationToken = default) + { + return GetAlertProcessingRules().Get(alertProcessingRuleName, cancellationToken); + } + } +} diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementSubscriptionResource.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementSubscriptionResource.cs new file mode 100644 index 0000000000000..cfe39b1884894 --- /dev/null +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementSubscriptionResource.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AlertsManagement; +using Azure.ResourceManager.AlertsManagement.Models; + +namespace Azure.ResourceManager.AlertsManagement.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAlertsManagementSubscriptionResource : ArmResource + { + private ClientDiagnostics _alertProcessingRuleClientDiagnostics; + private AlertProcessingRulesRestOperations _alertProcessingRuleRestClient; + private ClientDiagnostics _serviceAlertAlertsClientDiagnostics; + private AlertsRestOperations _serviceAlertAlertsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAlertsManagementSubscriptionResource() + { + } + + /// 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 MockableAlertsManagementSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AlertProcessingRuleClientDiagnostics => _alertProcessingRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AlertsManagement", AlertProcessingRuleResource.ResourceType.Namespace, Diagnostics); + private AlertProcessingRulesRestOperations AlertProcessingRuleRestClient => _alertProcessingRuleRestClient ??= new AlertProcessingRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AlertProcessingRuleResource.ResourceType)); + private ClientDiagnostics ServiceAlertAlertsClientDiagnostics => _serviceAlertAlertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AlertsManagement", ServiceAlertResource.ResourceType.Namespace, Diagnostics); + private AlertsRestOperations ServiceAlertAlertsRestClient => _serviceAlertAlertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceAlertResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ServiceAlertResources in the SubscriptionResource. + /// An object representing collection of ServiceAlertResources and their operations over a ServiceAlertResource. + public virtual ServiceAlertCollection GetServiceAlerts() + { + return GetCachedClient(client => new ServiceAlertCollection(client, Id)); + } + + /// + /// Get information related to a specific alert + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId} + /// + /// + /// Operation Id + /// Alerts_GetById + /// + /// + /// + /// Unique ID of an alert instance. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceAlertAsync(Guid alertId, CancellationToken cancellationToken = default) + { + return await GetServiceAlerts().GetAsync(alertId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information related to a specific alert + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId} + /// + /// + /// Operation Id + /// Alerts_GetById + /// + /// + /// + /// Unique ID of an alert instance. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceAlert(Guid alertId, CancellationToken cancellationToken = default) + { + return GetServiceAlerts().Get(alertId, cancellationToken); + } + + /// Gets a collection of SmartGroupResources in the SubscriptionResource. + /// An object representing collection of SmartGroupResources and their operations over a SmartGroupResource. + public virtual SmartGroupCollection GetSmartGroups() + { + return GetCachedClient(client => new SmartGroupCollection(client, Id)); + } + + /// + /// Get information related to a specific Smart Group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId} + /// + /// + /// Operation Id + /// SmartGroups_GetById + /// + /// + /// + /// Smart group unique id. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetSmartGroupAsync(Guid smartGroupId, CancellationToken cancellationToken = default) + { + return await GetSmartGroups().GetAsync(smartGroupId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information related to a specific Smart Group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId} + /// + /// + /// Operation Id + /// SmartGroups_GetById + /// + /// + /// + /// Smart group unique id. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetSmartGroup(Guid smartGroupId, CancellationToken cancellationToken = default) + { + return GetSmartGroups().Get(smartGroupId, cancellationToken); + } + + /// + /// List all alert processing rules in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/actionRules + /// + /// + /// Operation Id + /// AlertProcessingRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAlertProcessingRulesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AlertProcessingRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertProcessingRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), AlertProcessingRuleClientDiagnostics, Pipeline, "MockableAlertsManagementSubscriptionResource.GetAlertProcessingRules", "value", "nextLink", cancellationToken); + } + + /// + /// List all alert processing rules in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/actionRules + /// + /// + /// Operation Id + /// AlertProcessingRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAlertProcessingRules(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AlertProcessingRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertProcessingRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), AlertProcessingRuleClientDiagnostics, Pipeline, "MockableAlertsManagementSubscriptionResource.GetAlertProcessingRules", "value", "nextLink", cancellationToken); + } + + /// + /// Get a summarized count of your alerts grouped by various parameters (e.g. grouping by 'Severity' returns the count of alerts for each severity). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary + /// + /// + /// Operation Id + /// Alerts_GetSummary + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetServiceAlertSummaryAsync(SubscriptionResourceGetServiceAlertSummaryOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = ServiceAlertAlertsClientDiagnostics.CreateScope("MockableAlertsManagementSubscriptionResource.GetServiceAlertSummary"); + scope.Start(); + try + { + var response = await ServiceAlertAlertsRestClient.GetSummaryAsync(Id.SubscriptionId, options.Groupby, options.IncludeSmartGroupsCount, options.TargetResource, options.TargetResourceType, options.TargetResourceGroup, options.MonitorService, options.MonitorCondition, options.Severity, options.AlertState, options.AlertRule, options.TimeRange, options.CustomTimeRange, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a summarized count of your alerts grouped by various parameters (e.g. grouping by 'Severity' returns the count of alerts for each severity). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary + /// + /// + /// Operation Id + /// Alerts_GetSummary + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual Response GetServiceAlertSummary(SubscriptionResourceGetServiceAlertSummaryOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = ServiceAlertAlertsClientDiagnostics.CreateScope("MockableAlertsManagementSubscriptionResource.GetServiceAlertSummary"); + scope.Start(); + try + { + var response = ServiceAlertAlertsRestClient.GetSummary(Id.SubscriptionId, options.Groupby, options.IncludeSmartGroupsCount, options.TargetResource, options.TargetResourceType, options.TargetResourceGroup, options.MonitorService, options.MonitorCondition, options.Severity, options.AlertState, options.AlertRule, options.TimeRange, options.CustomTimeRange, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementTenantResource.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementTenantResource.cs new file mode 100644 index 0000000000000..1f134a22b1e03 --- /dev/null +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/MockableAlertsManagementTenantResource.cs @@ -0,0 +1,109 @@ +// 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; +using Azure.ResourceManager.AlertsManagement; +using Azure.ResourceManager.AlertsManagement.Models; + +namespace Azure.ResourceManager.AlertsManagement.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableAlertsManagementTenantResource : ArmResource + { + private ClientDiagnostics _serviceAlertAlertsClientDiagnostics; + private AlertsRestOperations _serviceAlertAlertsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAlertsManagementTenantResource() + { + } + + /// 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 MockableAlertsManagementTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ServiceAlertAlertsClientDiagnostics => _serviceAlertAlertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AlertsManagement", ServiceAlertResource.ResourceType.Namespace, Diagnostics); + private AlertsRestOperations ServiceAlertAlertsRestClient => _serviceAlertAlertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceAlertResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List alerts meta data information based on value of identifier parameter. + /// + /// + /// Request Path + /// /providers/Microsoft.AlertsManagement/alertsMetaData + /// + /// + /// Operation Id + /// Alerts_MetaData + /// + /// + /// + /// Identification of the information to be retrieved by API call. + /// The cancellation token to use. + public virtual async Task> GetServiceAlertMetadataAsync(RetrievedInformationIdentifier identifier, CancellationToken cancellationToken = default) + { + using var scope = ServiceAlertAlertsClientDiagnostics.CreateScope("MockableAlertsManagementTenantResource.GetServiceAlertMetadata"); + scope.Start(); + try + { + var response = await ServiceAlertAlertsRestClient.MetaDataAsync(identifier, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List alerts meta data information based on value of identifier parameter. + /// + /// + /// Request Path + /// /providers/Microsoft.AlertsManagement/alertsMetaData + /// + /// + /// Operation Id + /// Alerts_MetaData + /// + /// + /// + /// Identification of the information to be retrieved by API call. + /// The cancellation token to use. + public virtual Response GetServiceAlertMetadata(RetrievedInformationIdentifier identifier, CancellationToken cancellationToken = default) + { + using var scope = ServiceAlertAlertsClientDiagnostics.CreateScope("MockableAlertsManagementTenantResource.GetServiceAlertMetadata"); + scope.Start(); + try + { + var response = ServiceAlertAlertsRestClient.MetaData(identifier, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3fb689387e6c5..0000000000000 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.AlertsManagement -{ - /// 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 AlertProcessingRuleResources in the ResourceGroupResource. - /// An object representing collection of AlertProcessingRuleResources and their operations over a AlertProcessingRuleResource. - public virtual AlertProcessingRuleCollection GetAlertProcessingRules() - { - return GetCachedClient(Client => new AlertProcessingRuleCollection(Client, Id)); - } - } -} diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index a877d5bacda0f..0000000000000 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AlertsManagement.Models; - -namespace Azure.ResourceManager.AlertsManagement -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _alertProcessingRuleClientDiagnostics; - private AlertProcessingRulesRestOperations _alertProcessingRuleRestClient; - private ClientDiagnostics _serviceAlertAlertsClientDiagnostics; - private AlertsRestOperations _serviceAlertAlertsRestClient; - - /// 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 AlertProcessingRuleClientDiagnostics => _alertProcessingRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AlertsManagement", AlertProcessingRuleResource.ResourceType.Namespace, Diagnostics); - private AlertProcessingRulesRestOperations AlertProcessingRuleRestClient => _alertProcessingRuleRestClient ??= new AlertProcessingRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AlertProcessingRuleResource.ResourceType)); - private ClientDiagnostics ServiceAlertAlertsClientDiagnostics => _serviceAlertAlertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AlertsManagement", ServiceAlertResource.ResourceType.Namespace, Diagnostics); - private AlertsRestOperations ServiceAlertAlertsRestClient => _serviceAlertAlertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceAlertResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ServiceAlertResources in the SubscriptionResource. - /// An object representing collection of ServiceAlertResources and their operations over a ServiceAlertResource. - public virtual ServiceAlertCollection GetServiceAlerts() - { - return GetCachedClient(Client => new ServiceAlertCollection(Client, Id)); - } - - /// Gets a collection of SmartGroupResources in the SubscriptionResource. - /// An object representing collection of SmartGroupResources and their operations over a SmartGroupResource. - public virtual SmartGroupCollection GetSmartGroups() - { - return GetCachedClient(Client => new SmartGroupCollection(Client, Id)); - } - - /// - /// List all alert processing rules in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/actionRules - /// - /// - /// Operation Id - /// AlertProcessingRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAlertProcessingRulesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AlertProcessingRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertProcessingRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), AlertProcessingRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlertProcessingRules", "value", "nextLink", cancellationToken); - } - - /// - /// List all alert processing rules in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/actionRules - /// - /// - /// Operation Id - /// AlertProcessingRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAlertProcessingRules(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AlertProcessingRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertProcessingRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AlertProcessingRuleResource(Client, AlertProcessingRuleData.DeserializeAlertProcessingRuleData(e)), AlertProcessingRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlertProcessingRules", "value", "nextLink", cancellationToken); - } - - /// - /// Get a summarized count of your alerts grouped by various parameters (e.g. grouping by 'Severity' returns the count of alerts for each severity). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary - /// - /// - /// Operation Id - /// Alerts_GetSummary - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual async Task> GetServiceAlertSummaryAsync(SubscriptionResourceGetServiceAlertSummaryOptions options, CancellationToken cancellationToken = default) - { - using var scope = ServiceAlertAlertsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetServiceAlertSummary"); - scope.Start(); - try - { - var response = await ServiceAlertAlertsRestClient.GetSummaryAsync(Id.SubscriptionId, options.Groupby, options.IncludeSmartGroupsCount, options.TargetResource, options.TargetResourceType, options.TargetResourceGroup, options.MonitorService, options.MonitorCondition, options.Severity, options.AlertState, options.AlertRule, options.TimeRange, options.CustomTimeRange, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a summarized count of your alerts grouped by various parameters (e.g. grouping by 'Severity' returns the count of alerts for each severity). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary - /// - /// - /// Operation Id - /// Alerts_GetSummary - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual Response GetServiceAlertSummary(SubscriptionResourceGetServiceAlertSummaryOptions options, CancellationToken cancellationToken = default) - { - using var scope = ServiceAlertAlertsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetServiceAlertSummary"); - scope.Start(); - try - { - var response = ServiceAlertAlertsRestClient.GetSummary(Id.SubscriptionId, options.Groupby, options.IncludeSmartGroupsCount, options.TargetResource, options.TargetResourceType, options.TargetResourceGroup, options.MonitorService, options.MonitorCondition, options.Severity, options.AlertState, options.AlertRule, options.TimeRange, options.CustomTimeRange, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 6044f8925f41a..0000000000000 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,108 +0,0 @@ -// 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; -using Azure.ResourceManager.AlertsManagement.Models; - -namespace Azure.ResourceManager.AlertsManagement -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _serviceAlertAlertsClientDiagnostics; - private AlertsRestOperations _serviceAlertAlertsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics ServiceAlertAlertsClientDiagnostics => _serviceAlertAlertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AlertsManagement", ServiceAlertResource.ResourceType.Namespace, Diagnostics); - private AlertsRestOperations ServiceAlertAlertsRestClient => _serviceAlertAlertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceAlertResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List alerts meta data information based on value of identifier parameter. - /// - /// - /// Request Path - /// /providers/Microsoft.AlertsManagement/alertsMetaData - /// - /// - /// Operation Id - /// Alerts_MetaData - /// - /// - /// - /// Identification of the information to be retrieved by API call. - /// The cancellation token to use. - public virtual async Task> GetServiceAlertMetadataAsync(RetrievedInformationIdentifier identifier, CancellationToken cancellationToken = default) - { - using var scope = ServiceAlertAlertsClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetServiceAlertMetadata"); - scope.Start(); - try - { - var response = await ServiceAlertAlertsRestClient.MetaDataAsync(identifier, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List alerts meta data information based on value of identifier parameter. - /// - /// - /// Request Path - /// /providers/Microsoft.AlertsManagement/alertsMetaData - /// - /// - /// Operation Id - /// Alerts_MetaData - /// - /// - /// - /// Identification of the information to be retrieved by API call. - /// The cancellation token to use. - public virtual Response GetServiceAlertMetadata(RetrievedInformationIdentifier identifier, CancellationToken cancellationToken = default) - { - using var scope = ServiceAlertAlertsClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetServiceAlertMetadata"); - scope.Start(); - try - { - var response = ServiceAlertAlertsRestClient.MetaData(identifier, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertResource.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertResource.cs index 325875d58a578..7de775acb0b7c 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertResource.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/ServiceAlertResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.AlertsManagement public partial class ServiceAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The alertId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Guid alertId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}"; diff --git a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupResource.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupResource.cs index 5c86ffba5dd0b..39c3a93b022e4 100644 --- a/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupResource.cs +++ b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/SmartGroupResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.AlertsManagement public partial class SmartGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The smartGroupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Guid smartGroupId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId}"; diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/api/Azure.ResourceManager.Analysis.netstandard2.0.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/api/Azure.ResourceManager.Analysis.netstandard2.0.cs index aec6622f6a75d..eac30f2d8dec5 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/api/Azure.ResourceManager.Analysis.netstandard2.0.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/api/Azure.ResourceManager.Analysis.netstandard2.0.cs @@ -32,7 +32,7 @@ protected AnalysisServerCollection() { } } public partial class AnalysisServerData : Azure.ResourceManager.Models.TrackedResourceData { - public AnalysisServerData(Azure.Core.AzureLocation location, Azure.ResourceManager.Analysis.Models.AnalysisResourceSku analysisSku) : base (default(Azure.Core.AzureLocation)) { } + public AnalysisServerData(Azure.Core.AzureLocation location, Azure.ResourceManager.Analysis.Models.AnalysisResourceSku analysisSku) { } public Azure.ResourceManager.Analysis.Models.AnalysisResourceSku AnalysisServerSku { get { throw null; } set { } } public Azure.ResourceManager.Analysis.Models.AnalysisResourceSku AnalysisSku { get { throw null; } set { } } public System.Collections.Generic.IList AsAdministratorIdentities { get { throw null; } } @@ -77,6 +77,31 @@ protected AnalysisServerResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Analysis.Models.AnalysisServerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Analysis.Mocking +{ + public partial class MockableAnalysisArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAnalysisArmClient() { } + public virtual Azure.ResourceManager.Analysis.AnalysisServerResource GetAnalysisServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAnalysisResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAnalysisResourceGroupResource() { } + public virtual Azure.Response GetAnalysisServer(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAnalysisServerAsync(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Analysis.AnalysisServerCollection GetAnalysisServers() { throw null; } + } + public partial class MockableAnalysisSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAnalysisSubscriptionResource() { } + public virtual Azure.Response CheckAnalysisServerNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.Analysis.Models.AnalysisServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckAnalysisServerNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Analysis.Models.AnalysisServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAnalysisServers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAnalysisServersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEligibleSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEligibleSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Analysis.Models { public enum AnalysisConnectionMode diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerResource.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerResource.cs index 1871950fdd31c..3ec397cdec6b7 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerResource.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/AnalysisServerResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Analysis public partial class AnalysisServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}"; diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/AnalysisExtensions.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/AnalysisExtensions.cs index 7c9add1f45640..a6401d183a71f 100644 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/AnalysisExtensions.cs +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/AnalysisExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Analysis.Mocking; using Azure.ResourceManager.Analysis.Models; using Azure.ResourceManager.Resources; @@ -19,62 +20,49 @@ namespace Azure.ResourceManager.Analysis /// A class to add extension methods to Azure.ResourceManager.Analysis. public static partial class AnalysisExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAnalysisArmClient GetMockableAnalysisArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAnalysisArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAnalysisResourceGroupResource GetMockableAnalysisResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAnalysisResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAnalysisSubscriptionResource GetMockableAnalysisSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAnalysisSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AnalysisServerResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AnalysisServerResource GetAnalysisServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AnalysisServerResource.ValidateResourceId(id); - return new AnalysisServerResource(client, id); - } - ); + return GetMockableAnalysisArmClient(client).GetAnalysisServerResource(id); } - #endregion - /// Gets a collection of AnalysisServerResources in the ResourceGroupResource. + /// + /// Gets a collection of AnalysisServerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AnalysisServerResources and their operations over a AnalysisServerResource. public static AnalysisServerCollection GetAnalysisServers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAnalysisServers(); + return GetMockableAnalysisResourceGroupResource(resourceGroupResource).GetAnalysisServers(); } /// @@ -89,16 +77,20 @@ public static AnalysisServerCollection GetAnalysisServers(this ResourceGroupReso /// Servers_GetDetails /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum of 63. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAnalysisServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAnalysisServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + return await GetMockableAnalysisResourceGroupResource(resourceGroupResource).GetAnalysisServerAsync(serverName, cancellationToken).ConfigureAwait(false); } /// @@ -113,16 +105,20 @@ public static async Task> GetAnalysisServerAsyn /// Servers_GetDetails /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum of 63. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAnalysisServer(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAnalysisServers().Get(serverName, cancellationToken); + return GetMockableAnalysisResourceGroupResource(resourceGroupResource).GetAnalysisServer(serverName, cancellationToken); } /// @@ -137,13 +133,17 @@ public static Response GetAnalysisServer(this ResourceGr /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAnalysisServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAnalysisServersAsync(cancellationToken); + return GetMockableAnalysisSubscriptionResource(subscriptionResource).GetAnalysisServersAsync(cancellationToken); } /// @@ -158,13 +158,17 @@ public static AsyncPageable GetAnalysisServersAsync(this /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAnalysisServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAnalysisServers(cancellationToken); + return GetMockableAnalysisSubscriptionResource(subscriptionResource).GetAnalysisServers(cancellationToken); } /// @@ -179,13 +183,17 @@ public static Pageable GetAnalysisServers(this Subscript /// Servers_ListSkusForNew /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEligibleSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEligibleSkusAsync(cancellationToken); + return GetMockableAnalysisSubscriptionResource(subscriptionResource).GetEligibleSkusAsync(cancellationToken); } /// @@ -200,13 +208,17 @@ public static AsyncPageable GetEligibleSkusAsync(this Subsc /// Servers_ListSkusForNew /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEligibleSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEligibleSkus(cancellationToken); + return GetMockableAnalysisSubscriptionResource(subscriptionResource).GetEligibleSkus(cancellationToken); } /// @@ -221,6 +233,10 @@ public static Pageable GetEligibleSkus(this SubscriptionRes /// Servers_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region name which the operation will lookup into. @@ -229,9 +245,7 @@ public static Pageable GetEligibleSkus(this SubscriptionRes /// is null. public static async Task> CheckAnalysisServerNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, AnalysisServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAnalysisServerNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableAnalysisSubscriptionResource(subscriptionResource).CheckAnalysisServerNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -246,6 +260,10 @@ public static async Task> CheckAn /// Servers_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region name which the operation will lookup into. @@ -254,9 +272,7 @@ public static async Task> CheckAn /// is null. public static Response CheckAnalysisServerNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, AnalysisServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAnalysisServerNameAvailability(location, content, cancellationToken); + return GetMockableAnalysisSubscriptionResource(subscriptionResource).CheckAnalysisServerNameAvailability(location, content, cancellationToken); } } } diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisArmClient.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisArmClient.cs new file mode 100644 index 0000000000000..839d8bc7c7cc8 --- /dev/null +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Analysis; + +namespace Azure.ResourceManager.Analysis.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAnalysisArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAnalysisArmClient() + { + } + + /// 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 MockableAnalysisArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAnalysisArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AnalysisServerResource GetAnalysisServerResource(ResourceIdentifier id) + { + AnalysisServerResource.ValidateResourceId(id); + return new AnalysisServerResource(Client, id); + } + } +} diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisResourceGroupResource.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisResourceGroupResource.cs new file mode 100644 index 0000000000000..539da24a6984c --- /dev/null +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Analysis; + +namespace Azure.ResourceManager.Analysis.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAnalysisResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAnalysisResourceGroupResource() + { + } + + /// 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 MockableAnalysisResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AnalysisServerResources in the ResourceGroupResource. + /// An object representing collection of AnalysisServerResources and their operations over a AnalysisServerResource. + public virtual AnalysisServerCollection GetAnalysisServers() + { + return GetCachedClient(client => new AnalysisServerCollection(client, Id)); + } + + /// + /// Gets details about the specified Analysis Services server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_GetDetails + /// + /// + /// + /// The name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAnalysisServerAsync(string serverName, CancellationToken cancellationToken = default) + { + return await GetAnalysisServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details about the specified Analysis Services server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_GetDetails + /// + /// + /// + /// The name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAnalysisServer(string serverName, CancellationToken cancellationToken = default) + { + return GetAnalysisServers().Get(serverName, cancellationToken); + } + } +} diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisSubscriptionResource.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisSubscriptionResource.cs new file mode 100644 index 0000000000000..8bfad24f121ed --- /dev/null +++ b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/MockableAnalysisSubscriptionResource.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Analysis; +using Azure.ResourceManager.Analysis.Models; + +namespace Azure.ResourceManager.Analysis.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAnalysisSubscriptionResource : ArmResource + { + private ClientDiagnostics _analysisServerServersClientDiagnostics; + private ServersRestOperations _analysisServerServersRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAnalysisSubscriptionResource() + { + } + + /// 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 MockableAnalysisSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AnalysisServerServersClientDiagnostics => _analysisServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Analysis", AnalysisServerResource.ResourceType.Namespace, Diagnostics); + private ServersRestOperations AnalysisServerServersRestClient => _analysisServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AnalysisServerResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all the Analysis Services servers for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/servers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAnalysisServersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), AnalysisServerServersClientDiagnostics, Pipeline, "MockableAnalysisSubscriptionResource.GetAnalysisServers", "value", null, cancellationToken); + } + + /// + /// Lists all the Analysis Services servers for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/servers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAnalysisServers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), AnalysisServerServersClientDiagnostics, Pipeline, "MockableAnalysisSubscriptionResource.GetAnalysisServers", "value", null, cancellationToken); + } + + /// + /// Lists eligible SKUs for Analysis Services resource provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/skus + /// + /// + /// Operation Id + /// Servers_ListSkusForNew + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEligibleSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListSkusForNewRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, AnalysisResourceSku.DeserializeAnalysisResourceSku, AnalysisServerServersClientDiagnostics, Pipeline, "MockableAnalysisSubscriptionResource.GetEligibleSkus", "value", null, cancellationToken); + } + + /// + /// Lists eligible SKUs for Analysis Services resource provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/skus + /// + /// + /// Operation Id + /// Servers_ListSkusForNew + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEligibleSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListSkusForNewRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, AnalysisResourceSku.DeserializeAnalysisResourceSku, AnalysisServerServersClientDiagnostics, Pipeline, "MockableAnalysisSubscriptionResource.GetEligibleSkus", "value", null, cancellationToken); + } + + /// + /// Check the name availability in the target location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Servers_CheckNameAvailability + /// + /// + /// + /// The region name which the operation will lookup into. + /// Contains the information used to provision the Analysis Services server. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckAnalysisServerNameAvailabilityAsync(AzureLocation location, AnalysisServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = AnalysisServerServersClientDiagnostics.CreateScope("MockableAnalysisSubscriptionResource.CheckAnalysisServerNameAvailability"); + scope.Start(); + try + { + var response = await AnalysisServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the name availability in the target location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Servers_CheckNameAvailability + /// + /// + /// + /// The region name which the operation will lookup into. + /// Contains the information used to provision the Analysis Services server. + /// The cancellation token to use. + /// is null. + public virtual Response CheckAnalysisServerNameAvailability(AzureLocation location, AnalysisServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = AnalysisServerServersClientDiagnostics.CreateScope("MockableAnalysisSubscriptionResource.CheckAnalysisServerNameAvailability"); + scope.Start(); + try + { + var response = AnalysisServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index a8e8918ddb9e9..0000000000000 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Analysis -{ - /// 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 AnalysisServerResources in the ResourceGroupResource. - /// An object representing collection of AnalysisServerResources and their operations over a AnalysisServerResource. - public virtual AnalysisServerCollection GetAnalysisServers() - { - return GetCachedClient(Client => new AnalysisServerCollection(Client, Id)); - } - } -} diff --git a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 26ad12d2073c4..0000000000000 --- a/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Analysis.Models; - -namespace Azure.ResourceManager.Analysis -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _analysisServerServersClientDiagnostics; - private ServersRestOperations _analysisServerServersRestClient; - - /// 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 AnalysisServerServersClientDiagnostics => _analysisServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Analysis", AnalysisServerResource.ResourceType.Namespace, Diagnostics); - private ServersRestOperations AnalysisServerServersRestClient => _analysisServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AnalysisServerResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all the Analysis Services servers for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/servers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAnalysisServersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), AnalysisServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAnalysisServers", "value", null, cancellationToken); - } - - /// - /// Lists all the Analysis Services servers for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/servers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAnalysisServers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AnalysisServerResource(Client, AnalysisServerData.DeserializeAnalysisServerData(e)), AnalysisServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAnalysisServers", "value", null, cancellationToken); - } - - /// - /// Lists eligible SKUs for Analysis Services resource provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/skus - /// - /// - /// Operation Id - /// Servers_ListSkusForNew - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEligibleSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListSkusForNewRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, AnalysisResourceSku.DeserializeAnalysisResourceSku, AnalysisServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEligibleSkus", "value", null, cancellationToken); - } - - /// - /// Lists eligible SKUs for Analysis Services resource provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/skus - /// - /// - /// Operation Id - /// Servers_ListSkusForNew - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEligibleSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AnalysisServerServersRestClient.CreateListSkusForNewRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, AnalysisResourceSku.DeserializeAnalysisResourceSku, AnalysisServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEligibleSkus", "value", null, cancellationToken); - } - - /// - /// Check the name availability in the target location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Servers_CheckNameAvailability - /// - /// - /// - /// The region name which the operation will lookup into. - /// Contains the information used to provision the Analysis Services server. - /// The cancellation token to use. - public virtual async Task> CheckAnalysisServerNameAvailabilityAsync(AzureLocation location, AnalysisServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = AnalysisServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAnalysisServerNameAvailability"); - scope.Start(); - try - { - var response = await AnalysisServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the name availability in the target location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Servers_CheckNameAvailability - /// - /// - /// - /// The region name which the operation will lookup into. - /// Contains the information used to provision the Analysis Services server. - /// The cancellation token to use. - public virtual Response CheckAnalysisServerNameAvailability(AzureLocation location, AnalysisServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = AnalysisServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAnalysisServerNameAvailability"); - scope.Start(); - try - { - var response = AnalysisServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/api/Azure.ResourceManager.ApiCenter.netstandard2.0.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/api/Azure.ResourceManager.ApiCenter.netstandard2.0.cs index 0f795eedef271..a8c1c0fe544ea 100644 --- a/sdk/apicenter/Azure.ResourceManager.ApiCenter/api/Azure.ResourceManager.ApiCenter.netstandard2.0.cs +++ b/sdk/apicenter/Azure.ResourceManager.ApiCenter/api/Azure.ResourceManager.ApiCenter.netstandard2.0.cs @@ -28,7 +28,7 @@ protected ApiCenterServiceCollection() { } } public partial class ApiCenterServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public ApiCenterServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ApiCenterServiceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.ApiCenter.Models.ApiCenterProvisioningState? ProvisioningState { get { throw null; } } } @@ -47,6 +47,27 @@ protected ApiCenterServiceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.ApiCenter.Models.ApiCenterServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ApiCenter.Mocking +{ + public partial class MockableApiCenterArmClient : Azure.ResourceManager.ArmResource + { + protected MockableApiCenterArmClient() { } + public virtual Azure.ResourceManager.ApiCenter.ApiCenterServiceResource GetApiCenterServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableApiCenterResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableApiCenterResourceGroupResource() { } + public virtual Azure.Response GetApiCenterService(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApiCenterServiceAsync(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApiCenter.ApiCenterServiceCollection GetApiCenterServices() { throw null; } + } + public partial class MockableApiCenterSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableApiCenterSubscriptionResource() { } + public virtual Azure.Pageable GetApiCenterServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApiCenterServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ApiCenter.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/ApiCenterServiceResource.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/ApiCenterServiceResource.cs index e2a3d4d9532d3..b43926f643f4d 100644 --- a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/ApiCenterServiceResource.cs +++ b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/ApiCenterServiceResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.ApiCenter public partial class ApiCenterServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}"; diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/ApiCenterExtensions.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/ApiCenterExtensions.cs index 49aee9aaaf89f..501f1fa21e9c0 100644 --- a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/ApiCenterExtensions.cs +++ b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/ApiCenterExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ApiCenter.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ApiCenter @@ -18,62 +19,49 @@ namespace Azure.ResourceManager.ApiCenter /// A class to add extension methods to Azure.ResourceManager.ApiCenter. public static partial class ApiCenterExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableApiCenterArmClient GetMockableApiCenterArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableApiCenterArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableApiCenterResourceGroupResource GetMockableApiCenterResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableApiCenterResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableApiCenterSubscriptionResource GetMockableApiCenterSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableApiCenterSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ApiCenterServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiCenterServiceResource GetApiCenterServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiCenterServiceResource.ValidateResourceId(id); - return new ApiCenterServiceResource(client, id); - } - ); + return GetMockableApiCenterArmClient(client).GetApiCenterServiceResource(id); } - #endregion - /// Gets a collection of ApiCenterServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of ApiCenterServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ApiCenterServiceResources and their operations over a ApiCenterServiceResource. public static ApiCenterServiceCollection GetApiCenterServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApiCenterServices(); + return GetMockableApiCenterResourceGroupResource(resourceGroupResource).GetApiCenterServices(); } /// @@ -88,16 +76,20 @@ public static ApiCenterServiceCollection GetApiCenterServices(this ResourceGroup /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Service name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetApiCenterServiceAsync(this ResourceGroupResource resourceGroupResource, string serviceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetApiCenterServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + return await GetMockableApiCenterResourceGroupResource(resourceGroupResource).GetApiCenterServiceAsync(serviceName, cancellationToken).ConfigureAwait(false); } /// @@ -112,16 +104,20 @@ public static async Task> GetApiCenterService /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Service name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetApiCenterService(this ResourceGroupResource resourceGroupResource, string serviceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetApiCenterServices().Get(serviceName, cancellationToken); + return GetMockableApiCenterResourceGroupResource(resourceGroupResource).GetApiCenterService(serviceName, cancellationToken); } /// @@ -136,13 +132,17 @@ public static Response GetApiCenterService(this Resour /// Services_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApiCenterServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiCenterServicesAsync(cancellationToken); + return GetMockableApiCenterSubscriptionResource(subscriptionResource).GetApiCenterServicesAsync(cancellationToken); } /// @@ -157,13 +157,17 @@ public static AsyncPageable GetApiCenterServicesAsync( /// Services_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApiCenterServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiCenterServices(cancellationToken); + return GetMockableApiCenterSubscriptionResource(subscriptionResource).GetApiCenterServices(cancellationToken); } } } diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterArmClient.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterArmClient.cs new file mode 100644 index 0000000000000..6cbc98792bfde --- /dev/null +++ b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiCenter; + +namespace Azure.ResourceManager.ApiCenter.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableApiCenterArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableApiCenterArmClient() + { + } + + /// 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 MockableApiCenterArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableApiCenterArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiCenterServiceResource GetApiCenterServiceResource(ResourceIdentifier id) + { + ApiCenterServiceResource.ValidateResourceId(id); + return new ApiCenterServiceResource(Client, id); + } + } +} diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterResourceGroupResource.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterResourceGroupResource.cs new file mode 100644 index 0000000000000..1febef32b3f4b --- /dev/null +++ b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ApiCenter; + +namespace Azure.ResourceManager.ApiCenter.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableApiCenterResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableApiCenterResourceGroupResource() + { + } + + /// 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 MockableApiCenterResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ApiCenterServiceResources in the ResourceGroupResource. + /// An object representing collection of ApiCenterServiceResources and their operations over a ApiCenterServiceResource. + public virtual ApiCenterServiceCollection GetApiCenterServices() + { + return GetCachedClient(client => new ApiCenterServiceCollection(client, Id)); + } + + /// + /// Get service + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Service name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetApiCenterServiceAsync(string serviceName, CancellationToken cancellationToken = default) + { + return await GetApiCenterServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get service + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Service name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetApiCenterService(string serviceName, CancellationToken cancellationToken = default) + { + return GetApiCenterServices().Get(serviceName, cancellationToken); + } + } +} diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterSubscriptionResource.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterSubscriptionResource.cs new file mode 100644 index 0000000000000..436fda06e1291 --- /dev/null +++ b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/MockableApiCenterSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiCenter; + +namespace Azure.ResourceManager.ApiCenter.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableApiCenterSubscriptionResource : ArmResource + { + private ClientDiagnostics _apiCenterServiceServicesClientDiagnostics; + private ServicesRestOperations _apiCenterServiceServicesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableApiCenterSubscriptionResource() + { + } + + /// 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 MockableApiCenterSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ApiCenterServiceServicesClientDiagnostics => _apiCenterServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApiCenter", ApiCenterServiceResource.ResourceType.Namespace, Diagnostics); + private ServicesRestOperations ApiCenterServiceServicesRestClient => _apiCenterServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApiCenterServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists services within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services + /// + /// + /// Operation Id + /// Services_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApiCenterServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApiCenterServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiCenterServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiCenterServiceResource(Client, ApiCenterServiceData.DeserializeApiCenterServiceData(e)), ApiCenterServiceServicesClientDiagnostics, Pipeline, "MockableApiCenterSubscriptionResource.GetApiCenterServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists services within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services + /// + /// + /// Operation Id + /// Services_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApiCenterServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApiCenterServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiCenterServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiCenterServiceResource(Client, ApiCenterServiceData.DeserializeApiCenterServiceData(e)), ApiCenterServiceServicesClientDiagnostics, Pipeline, "MockableApiCenterSubscriptionResource.GetApiCenterServices", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index bdd156bb3e0da..0000000000000 --- a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ApiCenter -{ - /// 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 ApiCenterServiceResources in the ResourceGroupResource. - /// An object representing collection of ApiCenterServiceResources and their operations over a ApiCenterServiceResource. - public virtual ApiCenterServiceCollection GetApiCenterServices() - { - return GetCachedClient(Client => new ApiCenterServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b92d0fd599023..0000000000000 --- a/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ApiCenter -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _apiCenterServiceServicesClientDiagnostics; - private ServicesRestOperations _apiCenterServiceServicesRestClient; - - /// 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 ApiCenterServiceServicesClientDiagnostics => _apiCenterServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApiCenter", ApiCenterServiceResource.ResourceType.Namespace, Diagnostics); - private ServicesRestOperations ApiCenterServiceServicesRestClient => _apiCenterServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApiCenterServiceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists services within an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services - /// - /// - /// Operation Id - /// Services_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApiCenterServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApiCenterServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiCenterServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiCenterServiceResource(Client, ApiCenterServiceData.DeserializeApiCenterServiceData(e)), ApiCenterServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiCenterServices", "value", "nextLink", cancellationToken); - } - - /// - /// Lists services within an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services - /// - /// - /// Operation Id - /// Services_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApiCenterServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApiCenterServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiCenterServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiCenterServiceResource(Client, ApiCenterServiceData.DeserializeApiCenterServiceData(e)), ApiCenterServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiCenterServices", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/api/Azure.ResourceManager.ApiManagement.netstandard2.0.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/api/Azure.ResourceManager.ApiManagement.netstandard2.0.cs index 710b048d624e7..0a94be8f1de33 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/api/Azure.ResourceManager.ApiManagement.netstandard2.0.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/api/Azure.ResourceManager.ApiManagement.netstandard2.0.cs @@ -1410,7 +1410,7 @@ protected ApiManagementServiceCollection() { } } public partial class ApiManagementServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public ApiManagementServiceData(Azure.Core.AzureLocation location, Azure.ResourceManager.ApiManagement.Models.ApiManagementServiceSkuProperties sku, string publisherEmail, string publisherName) : base (default(Azure.Core.AzureLocation)) { } + public ApiManagementServiceData(Azure.Core.AzureLocation location, Azure.ResourceManager.ApiManagement.Models.ApiManagementServiceSkuProperties sku, string publisherEmail, string publisherName) { } public System.Collections.Generic.IList AdditionalLocations { get { throw null; } } public System.Collections.Generic.IList Certificates { get { throw null; } } public System.DateTimeOffset? CreatedAtUtc { get { throw null; } } @@ -2309,6 +2309,86 @@ public UserContractData() { } public Azure.ResourceManager.ApiManagement.Models.ApiManagementUserState? State { get { throw null; } set { } } } } +namespace Azure.ResourceManager.ApiManagement.Mocking +{ + public partial class MockableApiManagementArmClient : Azure.ResourceManager.ArmResource + { + protected MockableApiManagementArmClient() { } + public virtual Azure.ResourceManager.ApiManagement.ApiDiagnosticResource GetApiDiagnosticResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiIssueAttachmentResource GetApiIssueAttachmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiIssueCommentResource GetApiIssueCommentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiIssueResource GetApiIssueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementAuthorizationServerResource GetApiManagementAuthorizationServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementBackendResource GetApiManagementBackendResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementCacheResource GetApiManagementCacheResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementCertificateResource GetApiManagementCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementDeletedServiceResource GetApiManagementDeletedServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementDiagnosticResource GetApiManagementDiagnosticResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementEmailTemplateResource GetApiManagementEmailTemplateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementGatewayCertificateAuthorityResource GetApiManagementGatewayCertificateAuthorityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementGatewayHostnameConfigurationResource GetApiManagementGatewayHostnameConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementGatewayResource GetApiManagementGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementGlobalSchemaResource GetApiManagementGlobalSchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementGroupResource GetApiManagementGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementIdentityProviderResource GetApiManagementIdentityProviderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementIssueResource GetApiManagementIssueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementLoggerResource GetApiManagementLoggerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementNamedValueResource GetApiManagementNamedValueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementNotificationResource GetApiManagementNotificationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementOpenIdConnectProviderResource GetApiManagementOpenIdConnectProviderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementPolicyResource GetApiManagementPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementPortalDelegationSettingResource GetApiManagementPortalDelegationSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementPortalRevisionResource GetApiManagementPortalRevisionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementPortalSignInSettingResource GetApiManagementPortalSignInSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementPortalSignUpSettingResource GetApiManagementPortalSignUpSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementPrivateEndpointConnectionResource GetApiManagementPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementPrivateLinkResource GetApiManagementPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementProductPolicyResource GetApiManagementProductPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementProductResource GetApiManagementProductResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementProductTagResource GetApiManagementProductTagResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementServiceResource GetApiManagementServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementSubscriptionResource GetApiManagementSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementTagResource GetApiManagementTagResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementTenantSettingResource GetApiManagementTenantSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementUserResource GetApiManagementUserResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementUserSubscriptionResource GetApiManagementUserSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiOperationPolicyResource GetApiOperationPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiOperationResource GetApiOperationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiOperationTagResource GetApiOperationTagResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiPolicyResource GetApiPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiReleaseResource GetApiReleaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiResource GetApiResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiSchemaResource GetApiSchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiTagDescriptionResource GetApiTagDescriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiTagResource GetApiTagResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiVersionSetResource GetApiVersionSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.TenantAccessInfoResource GetTenantAccessInfoResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableApiManagementResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableApiManagementResourceGroupResource() { } + public virtual Azure.Response GetApiManagementService(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApiManagementServiceAsync(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementServiceCollection GetApiManagementServices() { throw null; } + } + public partial class MockableApiManagementSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableApiManagementSubscriptionResource() { } + public virtual Azure.Response CheckApiManagementServiceNameAvailability(Azure.ResourceManager.ApiManagement.Models.ApiManagementServiceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckApiManagementServiceNameAvailabilityAsync(Azure.ResourceManager.ApiManagement.Models.ApiManagementServiceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetApiManagementDeletedService(Azure.Core.AzureLocation location, string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApiManagementDeletedServiceAsync(Azure.Core.AzureLocation location, string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApiManagement.ApiManagementDeletedServiceCollection GetApiManagementDeletedServices() { throw null; } + public virtual Azure.Pageable GetApiManagementDeletedServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApiManagementDeletedServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetApiManagementServiceDomainOwnershipIdentifier(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApiManagementServiceDomainOwnershipIdentifierAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetApiManagementServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApiManagementServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetApiManagementSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApiManagementSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ApiManagement.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs index 716ad76b8c196..fcbebaa455b6e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiDiagnosticResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiDiagnosticResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The diagnosticId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string diagnosticId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics/{diagnosticId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentResource.cs index 5c115398f1fe4..c168c82f4f816 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueAttachmentResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiIssueAttachmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The issueId. + /// The attachmentId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string issueId, string attachmentId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentResource.cs index fbcf96bead08f..e427744ff4088 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueCommentResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiIssueCommentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The issueId. + /// The commentId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string issueId, string commentId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs index b3b97299b5444..d46de2266ae75 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiIssueResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The issueId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string issueId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ApiIssueCommentResources and their operations over a ApiIssueCommentResource. public virtual ApiIssueCommentCollection GetApiIssueComments() { - return GetCachedClient(Client => new ApiIssueCommentCollection(Client, Id)); + return GetCachedClient(client => new ApiIssueCommentCollection(client, Id)); } /// @@ -109,8 +114,8 @@ public virtual ApiIssueCommentCollection GetApiIssueComments() /// /// Comment identifier within an Issue. Must be unique in the current Issue. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiIssueCommentAsync(string commentId, CancellationToken cancellationToken = default) { @@ -132,8 +137,8 @@ public virtual async Task> GetApiIssueCommentA /// /// Comment identifier within an Issue. Must be unique in the current Issue. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiIssueComment(string commentId, CancellationToken cancellationToken = default) { @@ -144,7 +149,7 @@ public virtual Response GetApiIssueComment(string comme /// An object representing collection of ApiIssueAttachmentResources and their operations over a ApiIssueAttachmentResource. public virtual ApiIssueAttachmentCollection GetApiIssueAttachments() { - return GetCachedClient(Client => new ApiIssueAttachmentCollection(Client, Id)); + return GetCachedClient(client => new ApiIssueAttachmentCollection(client, Id)); } /// @@ -162,8 +167,8 @@ public virtual ApiIssueAttachmentCollection GetApiIssueAttachments() /// /// Attachment identifier within an Issue. Must be unique in the current Issue. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiIssueAttachmentAsync(string attachmentId, CancellationToken cancellationToken = default) { @@ -185,8 +190,8 @@ public virtual async Task> GetApiIssueAttac /// /// Attachment identifier within an Issue. Must be unique in the current Issue. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiIssueAttachment(string attachmentId, CancellationToken cancellationToken = default) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerResource.cs index a457862e1816a..2066ca4d10498 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementAuthorizationServerResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementAuthorizationServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The authsid. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string authsid) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs index 6fe935696defd..fcd0a8cdbd18b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementBackendResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementBackendResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The backendId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string backendId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backends/{backendId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheResource.cs index 5b0fd867d99a5..8d2f6dbcbb806 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCacheResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementCacheResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The cacheId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string cacheId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateResource.cs index 3571263e17110..223eae6aa0211 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementCertificateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The certificateId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string certificateId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/certificates/{certificateId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceResource.cs index c41899e6cf230..7177b687e8897 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDeletedServiceResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementDeletedServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticResource.cs index 71665d6bcdfff..d12e0717b7c85 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementDiagnosticResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementDiagnosticResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The diagnosticId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string diagnosticId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/diagnostics/{diagnosticId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateResource.cs index 269d0652ddb71..05c5325128b11 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementEmailTemplateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementEmailTemplateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The templateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, TemplateName templateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/templates/{templateName}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityResource.cs index 297db93e4050b..8b98c5683cd79 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayCertificateAuthorityResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementGatewayCertificateAuthorityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The gatewayId. + /// The certificateId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, string certificateId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/certificateAuthorities/{certificateId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationResource.cs index b76ff2b4aab33..66d96601867ad 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayHostnameConfigurationResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementGatewayHostnameConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The gatewayId. + /// The hcId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId, string hcId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}/hostnameConfigurations/{hcId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs index 3763ef75b01e0..395415766efcd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The gatewayId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string gatewayId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/gateways/{gatewayId}"; @@ -96,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ApiManagementGatewayHostnameConfigurationResources and their operations over a ApiManagementGatewayHostnameConfigurationResource. public virtual ApiManagementGatewayHostnameConfigurationCollection GetApiManagementGatewayHostnameConfigurations() { - return GetCachedClient(Client => new ApiManagementGatewayHostnameConfigurationCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementGatewayHostnameConfigurationCollection(client, Id)); } /// @@ -114,8 +118,8 @@ public virtual ApiManagementGatewayHostnameConfigurationCollection GetApiManagem /// /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementGatewayHostnameConfigurationAsync(string hcId, CancellationToken cancellationToken = default) { @@ -137,8 +141,8 @@ public virtual async Task /// Gateway hostname configuration identifier. Must be unique in the scope of parent Gateway entity. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementGatewayHostnameConfiguration(string hcId, CancellationToken cancellationToken = default) { @@ -149,7 +153,7 @@ public virtual Response GetAp /// An object representing collection of ApiManagementGatewayCertificateAuthorityResources and their operations over a ApiManagementGatewayCertificateAuthorityResource. public virtual ApiManagementGatewayCertificateAuthorityCollection GetApiManagementGatewayCertificateAuthorities() { - return GetCachedClient(Client => new ApiManagementGatewayCertificateAuthorityCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementGatewayCertificateAuthorityCollection(client, Id)); } /// @@ -167,8 +171,8 @@ public virtual ApiManagementGatewayCertificateAuthorityCollection GetApiManageme /// /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementGatewayCertificateAuthorityAsync(string certificateId, CancellationToken cancellationToken = default) { @@ -190,8 +194,8 @@ public virtual async Task /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementGatewayCertificateAuthority(string certificateId, CancellationToken cancellationToken = default) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs index 895e1e2f6916f..471e52f1aa47b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGlobalSchemaResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementGlobalSchemaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The schemaId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string schemaId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs index 6f6a4e273f24e..c078cedd1290c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGroupResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The groupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string groupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderResource.cs index 3117679daf189..12ffcc56ef3d0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIdentityProviderResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementIdentityProviderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The identityProviderName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, IdentityProviderType identityProviderName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/identityProviders/{identityProviderName}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueResource.cs index 553e9fe3fe05d..b4df75b74cbb7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementIssueResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementIssueResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The issueId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string issueId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/issues/{issueId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerResource.cs index 215f5aaafe831..876fdee128c50 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementLoggerResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementLoggerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The loggerId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string loggerId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/loggers/{loggerId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs index f01f823290f1e..c1f749dfed438 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNamedValueResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementNamedValueResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The namedValueId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string namedValueId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/namedValues/{namedValueId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs index f44f98b949a49..83b5d54220792 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementNotificationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementNotificationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The notificationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, NotificationName notificationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/notifications/{notificationName}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderResource.cs index 0afd747087c3a..d366f1289857b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementOpenIdConnectProviderResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementOpenIdConnectProviderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The openId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string openId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/openidConnectProviders/{openId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyResource.cs index 4b816ecf4b703..3d263516e745e 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The policyId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, PolicyName policyId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalDelegationSettingResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalDelegationSettingResource.cs index a45b46bb5354f..81a2d6ac0791b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalDelegationSettingResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalDelegationSettingResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementPortalDelegationSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/delegation"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionResource.cs index 3c9d57d6bbe8c..87d31d6c3b3f2 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalRevisionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementPortalRevisionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The portalRevisionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string portalRevisionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignInSettingResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignInSettingResource.cs index 713f63c996d22..fa527e647c455 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignInSettingResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignInSettingResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementPortalSignInSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signin"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignUpSettingResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignUpSettingResource.cs index 3b4805219a236..2ced31add09f1 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignUpSettingResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPortalSignUpSettingResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementPortalSignUpSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalsettings/signup"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionResource.cs index 0a11af2f8bba3..0dc1784658b8c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResource.cs index 10086f752cd70..956a91a683a7a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The privateLinkSubResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string privateLinkSubResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/privateLinkResources/{privateLinkSubResourceName}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs index 13bd27033ea8f..b062d71417125 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementProductPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The productId. + /// The policyId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId, PolicyName policyId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/policies/{policyId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs index 35ab6ba07b7c7..d371fa1aaf32d 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementProductResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The productId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}"; @@ -104,7 +108,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ApiManagementProductPolicyResources and their operations over a ApiManagementProductPolicyResource. public virtual ApiManagementProductPolicyCollection GetApiManagementProductPolicies() { - return GetCachedClient(Client => new ApiManagementProductPolicyCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementProductPolicyCollection(client, Id)); } /// @@ -155,7 +159,7 @@ public virtual Response GetApiManagementProd /// An object representing collection of ApiManagementProductTagResources and their operations over a ApiManagementProductTagResource. public virtual ApiManagementProductTagCollection GetApiManagementProductTags() { - return GetCachedClient(Client => new ApiManagementProductTagCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementProductTagCollection(client, Id)); } /// @@ -173,8 +177,8 @@ public virtual ApiManagementProductTagCollection GetApiManagementProductTags() /// /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementProductTagAsync(string tagId, CancellationToken cancellationToken = default) { @@ -196,8 +200,8 @@ public virtual async Task> GetApiManag /// /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementProductTag(string tagId, CancellationToken cancellationToken = default) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs index 6c7af5970e880..c7fbcb9714287 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductTagResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementProductTagResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The productId. + /// The tagId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string productId, string tagId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/products/{productId}/tags/{tagId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs index 1b89d70f1f12c..3fa464f3f389b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"; @@ -161,7 +164,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ApiResources and their operations over a ApiResource. public virtual ApiCollection GetApis() { - return GetCachedClient(Client => new ApiCollection(Client, Id)); + return GetCachedClient(client => new ApiCollection(client, Id)); } /// @@ -179,8 +182,8 @@ public virtual ApiCollection GetApis() /// /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiAsync(string apiId, CancellationToken cancellationToken = default) { @@ -202,8 +205,8 @@ public virtual async Task> GetApiAsync(string apiId, Cance /// /// API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApi(string apiId, CancellationToken cancellationToken = default) { @@ -214,7 +217,7 @@ public virtual Response GetApi(string apiId, CancellationToken canc /// An object representing collection of ApiManagementPolicyResources and their operations over a ApiManagementPolicyResource. public virtual ApiManagementPolicyCollection GetApiManagementPolicies() { - return GetCachedClient(Client => new ApiManagementPolicyCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementPolicyCollection(client, Id)); } /// @@ -265,7 +268,7 @@ public virtual Response GetApiManagementPolicy(Poli /// An object representing collection of ApiManagementTagResources and their operations over a ApiManagementTagResource. public virtual ApiManagementTagCollection GetApiManagementTags() { - return GetCachedClient(Client => new ApiManagementTagCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementTagCollection(client, Id)); } /// @@ -283,8 +286,8 @@ public virtual ApiManagementTagCollection GetApiManagementTags() /// /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementTagAsync(string tagId, CancellationToken cancellationToken = default) { @@ -306,8 +309,8 @@ public virtual async Task> GetApiManagementTa /// /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementTag(string tagId, CancellationToken cancellationToken = default) { @@ -318,7 +321,7 @@ public virtual Response GetApiManagementTag(string tag /// An object representing collection of ApiManagementDiagnosticResources and their operations over a ApiManagementDiagnosticResource. public virtual ApiManagementDiagnosticCollection GetApiManagementDiagnostics() { - return GetCachedClient(Client => new ApiManagementDiagnosticCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementDiagnosticCollection(client, Id)); } /// @@ -336,8 +339,8 @@ public virtual ApiManagementDiagnosticCollection GetApiManagementDiagnostics() /// /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementDiagnosticAsync(string diagnosticId, CancellationToken cancellationToken = default) { @@ -359,8 +362,8 @@ public virtual async Task> GetApiManag /// /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementDiagnostic(string diagnosticId, CancellationToken cancellationToken = default) { @@ -371,7 +374,7 @@ public virtual Response GetApiManagementDiagnos /// An object representing collection of ApiManagementIssueResources and their operations over a ApiManagementIssueResource. public virtual ApiManagementIssueCollection GetApiManagementIssues() { - return GetCachedClient(Client => new ApiManagementIssueCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementIssueCollection(client, Id)); } /// @@ -389,8 +392,8 @@ public virtual ApiManagementIssueCollection GetApiManagementIssues() /// /// Issue identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementIssueAsync(string issueId, CancellationToken cancellationToken = default) { @@ -412,8 +415,8 @@ public virtual async Task> GetApiManagement /// /// Issue identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementIssue(string issueId, CancellationToken cancellationToken = default) { @@ -424,7 +427,7 @@ public virtual Response GetApiManagementIssue(string /// An object representing collection of ApiVersionSetResources and their operations over a ApiVersionSetResource. public virtual ApiVersionSetCollection GetApiVersionSets() { - return GetCachedClient(Client => new ApiVersionSetCollection(Client, Id)); + return GetCachedClient(client => new ApiVersionSetCollection(client, Id)); } /// @@ -442,8 +445,8 @@ public virtual ApiVersionSetCollection GetApiVersionSets() /// /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiVersionSetAsync(string versionSetId, CancellationToken cancellationToken = default) { @@ -465,8 +468,8 @@ public virtual async Task> GetApiVersionSetAsync /// /// Api Version Set identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiVersionSet(string versionSetId, CancellationToken cancellationToken = default) { @@ -477,7 +480,7 @@ public virtual Response GetApiVersionSet(string versionSe /// An object representing collection of ApiManagementAuthorizationServerResources and their operations over a ApiManagementAuthorizationServerResource. public virtual ApiManagementAuthorizationServerCollection GetApiManagementAuthorizationServers() { - return GetCachedClient(Client => new ApiManagementAuthorizationServerCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementAuthorizationServerCollection(client, Id)); } /// @@ -495,8 +498,8 @@ public virtual ApiManagementAuthorizationServerCollection GetApiManagementAuthor /// /// Identifier of the authorization server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementAuthorizationServerAsync(string authsid, CancellationToken cancellationToken = default) { @@ -518,8 +521,8 @@ public virtual async Task> Ge /// /// Identifier of the authorization server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementAuthorizationServer(string authsid, CancellationToken cancellationToken = default) { @@ -530,7 +533,7 @@ public virtual Response GetApiManageme /// An object representing collection of ApiManagementBackendResources and their operations over a ApiManagementBackendResource. public virtual ApiManagementBackendCollection GetApiManagementBackends() { - return GetCachedClient(Client => new ApiManagementBackendCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementBackendCollection(client, Id)); } /// @@ -548,8 +551,8 @@ public virtual ApiManagementBackendCollection GetApiManagementBackends() /// /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementBackendAsync(string backendId, CancellationToken cancellationToken = default) { @@ -571,8 +574,8 @@ public virtual async Task> GetApiManageme /// /// Identifier of the Backend entity. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementBackend(string backendId, CancellationToken cancellationToken = default) { @@ -583,7 +586,7 @@ public virtual Response GetApiManagementBackend(st /// An object representing collection of ApiManagementCacheResources and their operations over a ApiManagementCacheResource. public virtual ApiManagementCacheCollection GetApiManagementCaches() { - return GetCachedClient(Client => new ApiManagementCacheCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementCacheCollection(client, Id)); } /// @@ -601,8 +604,8 @@ public virtual ApiManagementCacheCollection GetApiManagementCaches() /// /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementCacheAsync(string cacheId, CancellationToken cancellationToken = default) { @@ -624,8 +627,8 @@ public virtual async Task> GetApiManagement /// /// Identifier of the Cache entity. Cache identifier (should be either 'default' or valid Azure region identifier). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementCache(string cacheId, CancellationToken cancellationToken = default) { @@ -636,7 +639,7 @@ public virtual Response GetApiManagementCache(string /// An object representing collection of ApiManagementCertificateResources and their operations over a ApiManagementCertificateResource. public virtual ApiManagementCertificateCollection GetApiManagementCertificates() { - return GetCachedClient(Client => new ApiManagementCertificateCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementCertificateCollection(client, Id)); } /// @@ -654,8 +657,8 @@ public virtual ApiManagementCertificateCollection GetApiManagementCertificates() /// /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementCertificateAsync(string certificateId, CancellationToken cancellationToken = default) { @@ -677,8 +680,8 @@ public virtual async Task> GetApiMana /// /// Identifier of the certificate entity. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementCertificate(string certificateId, CancellationToken cancellationToken = default) { @@ -689,7 +692,7 @@ public virtual Response GetApiManagementCertif /// An object representing collection of ApiManagementEmailTemplateResources and their operations over a ApiManagementEmailTemplateResource. public virtual ApiManagementEmailTemplateCollection GetApiManagementEmailTemplates() { - return GetCachedClient(Client => new ApiManagementEmailTemplateCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementEmailTemplateCollection(client, Id)); } /// @@ -738,7 +741,7 @@ public virtual Response GetApiManagementEmai /// An object representing collection of ApiManagementGatewayResources and their operations over a ApiManagementGatewayResource. public virtual ApiManagementGatewayCollection GetApiManagementGateways() { - return GetCachedClient(Client => new ApiManagementGatewayCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementGatewayCollection(client, Id)); } /// @@ -756,8 +759,8 @@ public virtual ApiManagementGatewayCollection GetApiManagementGateways() /// /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementGatewayAsync(string gatewayId, CancellationToken cancellationToken = default) { @@ -779,8 +782,8 @@ public virtual async Task> GetApiManageme /// /// Gateway entity identifier. Must be unique in the current API Management service instance. Must not have value 'managed'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementGateway(string gatewayId, CancellationToken cancellationToken = default) { @@ -791,7 +794,7 @@ public virtual Response GetApiManagementGateway(st /// An object representing collection of ApiManagementGroupResources and their operations over a ApiManagementGroupResource. public virtual ApiManagementGroupCollection GetApiManagementGroups() { - return GetCachedClient(Client => new ApiManagementGroupCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementGroupCollection(client, Id)); } /// @@ -809,8 +812,8 @@ public virtual ApiManagementGroupCollection GetApiManagementGroups() /// /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementGroupAsync(string groupId, CancellationToken cancellationToken = default) { @@ -832,8 +835,8 @@ public virtual async Task> GetApiManagement /// /// Group identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementGroup(string groupId, CancellationToken cancellationToken = default) { @@ -844,7 +847,7 @@ public virtual Response GetApiManagementGroup(string /// An object representing collection of ApiManagementIdentityProviderResources and their operations over a ApiManagementIdentityProviderResource. public virtual ApiManagementIdentityProviderCollection GetApiManagementIdentityProviders() { - return GetCachedClient(Client => new ApiManagementIdentityProviderCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementIdentityProviderCollection(client, Id)); } /// @@ -893,7 +896,7 @@ public virtual Response GetApiManagementI /// An object representing collection of ApiManagementLoggerResources and their operations over a ApiManagementLoggerResource. public virtual ApiManagementLoggerCollection GetApiManagementLoggers() { - return GetCachedClient(Client => new ApiManagementLoggerCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementLoggerCollection(client, Id)); } /// @@ -911,8 +914,8 @@ public virtual ApiManagementLoggerCollection GetApiManagementLoggers() /// /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementLoggerAsync(string loggerId, CancellationToken cancellationToken = default) { @@ -934,8 +937,8 @@ public virtual async Task> GetApiManagemen /// /// Logger identifier. Must be unique in the API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementLogger(string loggerId, CancellationToken cancellationToken = default) { @@ -946,7 +949,7 @@ public virtual Response GetApiManagementLogger(stri /// An object representing collection of ApiManagementNamedValueResources and their operations over a ApiManagementNamedValueResource. public virtual ApiManagementNamedValueCollection GetApiManagementNamedValues() { - return GetCachedClient(Client => new ApiManagementNamedValueCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementNamedValueCollection(client, Id)); } /// @@ -964,8 +967,8 @@ public virtual ApiManagementNamedValueCollection GetApiManagementNamedValues() /// /// Identifier of the NamedValue. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementNamedValueAsync(string namedValueId, CancellationToken cancellationToken = default) { @@ -987,8 +990,8 @@ public virtual async Task> GetApiManag /// /// Identifier of the NamedValue. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementNamedValue(string namedValueId, CancellationToken cancellationToken = default) { @@ -999,7 +1002,7 @@ public virtual Response GetApiManagementNamedVa /// An object representing collection of ApiManagementNotificationResources and their operations over a ApiManagementNotificationResource. public virtual ApiManagementNotificationCollection GetApiManagementNotifications() { - return GetCachedClient(Client => new ApiManagementNotificationCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementNotificationCollection(client, Id)); } /// @@ -1048,7 +1051,7 @@ public virtual Response GetApiManagementNotif /// An object representing collection of ApiManagementOpenIdConnectProviderResources and their operations over a ApiManagementOpenIdConnectProviderResource. public virtual ApiManagementOpenIdConnectProviderCollection GetApiManagementOpenIdConnectProviders() { - return GetCachedClient(Client => new ApiManagementOpenIdConnectProviderCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementOpenIdConnectProviderCollection(client, Id)); } /// @@ -1066,8 +1069,8 @@ public virtual ApiManagementOpenIdConnectProviderCollection GetApiManagementOpen /// /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementOpenIdConnectProviderAsync(string openId, CancellationToken cancellationToken = default) { @@ -1089,8 +1092,8 @@ public virtual async Task> /// /// Identifier of the OpenID Connect Provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementOpenIdConnectProvider(string openId, CancellationToken cancellationToken = default) { @@ -1101,7 +1104,7 @@ public virtual Response GetApiManage /// An object representing collection of ApiManagementPortalRevisionResources and their operations over a ApiManagementPortalRevisionResource. public virtual ApiManagementPortalRevisionCollection GetApiManagementPortalRevisions() { - return GetCachedClient(Client => new ApiManagementPortalRevisionCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementPortalRevisionCollection(client, Id)); } /// @@ -1119,8 +1122,8 @@ public virtual ApiManagementPortalRevisionCollection GetApiManagementPortalRevis /// /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementPortalRevisionAsync(string portalRevisionId, CancellationToken cancellationToken = default) { @@ -1142,8 +1145,8 @@ public virtual async Task> GetApiM /// /// Portal revision identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementPortalRevision(string portalRevisionId, CancellationToken cancellationToken = default) { @@ -1175,7 +1178,7 @@ public virtual ApiManagementPortalDelegationSettingResource GetApiManagementPort /// An object representing collection of ApiManagementPrivateEndpointConnectionResources and their operations over a ApiManagementPrivateEndpointConnectionResource. public virtual ApiManagementPrivateEndpointConnectionCollection GetApiManagementPrivateEndpointConnections() { - return GetCachedClient(Client => new ApiManagementPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementPrivateEndpointConnectionCollection(client, Id)); } /// @@ -1193,8 +1196,8 @@ public virtual ApiManagementPrivateEndpointConnectionCollection GetApiManagement /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -1216,8 +1219,8 @@ public virtual async Task /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -1228,7 +1231,7 @@ public virtual Response GetApiMa /// An object representing collection of ApiManagementPrivateLinkResources and their operations over a ApiManagementPrivateLinkResource. public virtual ApiManagementPrivateLinkResourceCollection GetApiManagementPrivateLinkResources() { - return GetCachedClient(Client => new ApiManagementPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementPrivateLinkResourceCollection(client, Id)); } /// @@ -1246,8 +1249,8 @@ public virtual ApiManagementPrivateLinkResourceCollection GetApiManagementPrivat /// /// Name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementPrivateLinkResourceAsync(string privateLinkSubResourceName, CancellationToken cancellationToken = default) { @@ -1269,8 +1272,8 @@ public virtual async Task> GetApiMana /// /// Name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementPrivateLinkResource(string privateLinkSubResourceName, CancellationToken cancellationToken = default) { @@ -1281,7 +1284,7 @@ public virtual Response GetApiManagementPrivat /// An object representing collection of ApiManagementProductResources and their operations over a ApiManagementProductResource. public virtual ApiManagementProductCollection GetApiManagementProducts() { - return GetCachedClient(Client => new ApiManagementProductCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementProductCollection(client, Id)); } /// @@ -1299,8 +1302,8 @@ public virtual ApiManagementProductCollection GetApiManagementProducts() /// /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementProductAsync(string productId, CancellationToken cancellationToken = default) { @@ -1322,8 +1325,8 @@ public virtual async Task> GetApiManageme /// /// Product identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementProduct(string productId, CancellationToken cancellationToken = default) { @@ -1334,7 +1337,7 @@ public virtual Response GetApiManagementProduct(st /// An object representing collection of ApiManagementGlobalSchemaResources and their operations over a ApiManagementGlobalSchemaResource. public virtual ApiManagementGlobalSchemaCollection GetApiManagementGlobalSchemas() { - return GetCachedClient(Client => new ApiManagementGlobalSchemaCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementGlobalSchemaCollection(client, Id)); } /// @@ -1352,8 +1355,8 @@ public virtual ApiManagementGlobalSchemaCollection GetApiManagementGlobalSchemas /// /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementGlobalSchemaAsync(string schemaId, CancellationToken cancellationToken = default) { @@ -1375,8 +1378,8 @@ public virtual async Task> GetApiMan /// /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementGlobalSchema(string schemaId, CancellationToken cancellationToken = default) { @@ -1387,7 +1390,7 @@ public virtual Response GetApiManagementGloba /// An object representing collection of ApiManagementTenantSettingResources and their operations over a ApiManagementTenantSettingResource. public virtual ApiManagementTenantSettingCollection GetApiManagementTenantSettings() { - return GetCachedClient(Client => new ApiManagementTenantSettingCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementTenantSettingCollection(client, Id)); } /// @@ -1436,7 +1439,7 @@ public virtual Response GetApiManagementTena /// An object representing collection of ApiManagementSubscriptionResources and their operations over a ApiManagementSubscriptionResource. public virtual ApiManagementSubscriptionCollection GetApiManagementSubscriptions() { - return GetCachedClient(Client => new ApiManagementSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementSubscriptionCollection(client, Id)); } /// @@ -1454,8 +1457,8 @@ public virtual ApiManagementSubscriptionCollection GetApiManagementSubscriptions /// /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementSubscriptionAsync(string sid, CancellationToken cancellationToken = default) { @@ -1477,8 +1480,8 @@ public virtual async Task> GetApiMan /// /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementSubscription(string sid, CancellationToken cancellationToken = default) { @@ -1489,7 +1492,7 @@ public virtual Response GetApiManagementSubsc /// An object representing collection of TenantAccessInfoResources and their operations over a TenantAccessInfoResource. public virtual TenantAccessInfoCollection GetTenantAccessInfos() { - return GetCachedClient(Client => new TenantAccessInfoCollection(Client, Id)); + return GetCachedClient(client => new TenantAccessInfoCollection(client, Id)); } /// @@ -1538,7 +1541,7 @@ public virtual Response GetTenantAccessInfo(AccessName /// An object representing collection of ApiManagementUserResources and their operations over a ApiManagementUserResource. public virtual ApiManagementUserCollection GetApiManagementUsers() { - return GetCachedClient(Client => new ApiManagementUserCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementUserCollection(client, Id)); } /// @@ -1556,8 +1559,8 @@ public virtual ApiManagementUserCollection GetApiManagementUsers() /// /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementUserAsync(string userId, CancellationToken cancellationToken = default) { @@ -1579,8 +1582,8 @@ public virtual async Task> GetApiManagementU /// /// User identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementUser(string userId, CancellationToken cancellationToken = default) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs index c16b875df6282..f9e0f4a93e298 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementSubscriptionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The sid. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string sid) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs index c61139dda16ba..baf5a3e47ca68 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTagResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementTagResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The tagId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string tagId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tags/{tagId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingResource.cs index 8467b44597d36..b9b59e3ebe70f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementTenantSettingResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementTenantSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The settingsType. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, SettingsType settingsType) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/settings/{settingsType}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs index 287453f9eafd9..3f92409aab6a0 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementUserResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The userId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string userId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}"; @@ -104,7 +108,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ApiManagementUserSubscriptionResources and their operations over a ApiManagementUserSubscriptionResource. public virtual ApiManagementUserSubscriptionCollection GetApiManagementUserSubscriptions() { - return GetCachedClient(Client => new ApiManagementUserSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new ApiManagementUserSubscriptionCollection(client, Id)); } /// @@ -122,8 +126,8 @@ public virtual ApiManagementUserSubscriptionCollection GetApiManagementUserSubsc /// /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiManagementUserSubscriptionAsync(string sid, CancellationToken cancellationToken = default) { @@ -145,8 +149,8 @@ public virtual async Task> GetAp /// /// Subscription entity Identifier. The entity represents the association between a user and a product in API Management. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiManagementUserSubscription(string sid, CancellationToken cancellationToken = default) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionResource.cs index 4ac611d152d92..5990bfc409c76 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserSubscriptionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiManagementUserSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The userId. + /// The sid. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string userId, string sid) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/subscriptions/{sid}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs index 0be4a20631248..19b98555c7406 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationPolicyResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiOperationPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The operationId. + /// The policyId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, PolicyName policyId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs index 2aedff01129d5..f0ef8a50cd94c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiOperationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The operationId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ApiOperationPolicyResources and their operations over a ApiOperationPolicyResource. public virtual ApiOperationPolicyCollection GetApiOperationPolicies() { - return GetCachedClient(Client => new ApiOperationPolicyCollection(Client, Id)); + return GetCachedClient(client => new ApiOperationPolicyCollection(client, Id)); } /// @@ -142,7 +147,7 @@ public virtual Response GetApiOperationPolicy(Policy /// An object representing collection of ApiOperationTagResources and their operations over a ApiOperationTagResource. public virtual ApiOperationTagCollection GetApiOperationTags() { - return GetCachedClient(Client => new ApiOperationTagCollection(Client, Id)); + return GetCachedClient(client => new ApiOperationTagCollection(client, Id)); } /// @@ -160,8 +165,8 @@ public virtual ApiOperationTagCollection GetApiOperationTags() /// /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiOperationTagAsync(string tagId, CancellationToken cancellationToken = default) { @@ -183,8 +188,8 @@ public virtual async Task> GetApiOperationTagA /// /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiOperationTag(string tagId, CancellationToken cancellationToken = default) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs index e47445d6b0eb2..48044ce8e230a 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationTagResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiOperationTagResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The operationId. + /// The tagId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string operationId, string tagId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/tags/{tagId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs index 668f59c6afd3b..d8169420734a7 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The policyId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, PolicyName policyId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/{policyId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs index c8c9f87542dad..b54040d6e3489 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiReleaseResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiReleaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The releaseId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string releaseId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/releases/{releaseId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs index 4cf65f833cf04..c7361392e55c5 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}"; @@ -104,7 +108,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ApiReleaseResources and their operations over a ApiReleaseResource. public virtual ApiReleaseCollection GetApiReleases() { - return GetCachedClient(Client => new ApiReleaseCollection(Client, Id)); + return GetCachedClient(client => new ApiReleaseCollection(client, Id)); } /// @@ -122,8 +126,8 @@ public virtual ApiReleaseCollection GetApiReleases() /// /// Release identifier within an API. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiReleaseAsync(string releaseId, CancellationToken cancellationToken = default) { @@ -145,8 +149,8 @@ public virtual async Task> GetApiReleaseAsync(strin /// /// Release identifier within an API. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiRelease(string releaseId, CancellationToken cancellationToken = default) { @@ -157,7 +161,7 @@ public virtual Response GetApiRelease(string releaseId, Canc /// An object representing collection of ApiOperationResources and their operations over a ApiOperationResource. public virtual ApiOperationCollection GetApiOperations() { - return GetCachedClient(Client => new ApiOperationCollection(Client, Id)); + return GetCachedClient(client => new ApiOperationCollection(client, Id)); } /// @@ -175,8 +179,8 @@ public virtual ApiOperationCollection GetApiOperations() /// /// Operation identifier within an API. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiOperationAsync(string operationId, CancellationToken cancellationToken = default) { @@ -198,8 +202,8 @@ public virtual async Task> GetApiOperationAsync(s /// /// Operation identifier within an API. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiOperation(string operationId, CancellationToken cancellationToken = default) { @@ -210,7 +214,7 @@ public virtual Response GetApiOperation(string operationId /// An object representing collection of ApiPolicyResources and their operations over a ApiPolicyResource. public virtual ApiPolicyCollection GetApiPolicies() { - return GetCachedClient(Client => new ApiPolicyCollection(Client, Id)); + return GetCachedClient(client => new ApiPolicyCollection(client, Id)); } /// @@ -261,7 +265,7 @@ public virtual Response GetApiPolicy(PolicyName policyId, Pol /// An object representing collection of ApiTagResources and their operations over a ApiTagResource. public virtual ApiTagCollection GetApiTags() { - return GetCachedClient(Client => new ApiTagCollection(Client, Id)); + return GetCachedClient(client => new ApiTagCollection(client, Id)); } /// @@ -279,8 +283,8 @@ public virtual ApiTagCollection GetApiTags() /// /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiTagAsync(string tagId, CancellationToken cancellationToken = default) { @@ -302,8 +306,8 @@ public virtual async Task> GetApiTagAsync(string tagId, /// /// Tag identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiTag(string tagId, CancellationToken cancellationToken = default) { @@ -314,7 +318,7 @@ public virtual Response GetApiTag(string tagId, CancellationToke /// An object representing collection of ApiSchemaResources and their operations over a ApiSchemaResource. public virtual ApiSchemaCollection GetApiSchemas() { - return GetCachedClient(Client => new ApiSchemaCollection(Client, Id)); + return GetCachedClient(client => new ApiSchemaCollection(client, Id)); } /// @@ -332,8 +336,8 @@ public virtual ApiSchemaCollection GetApiSchemas() /// /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiSchemaAsync(string schemaId, CancellationToken cancellationToken = default) { @@ -355,8 +359,8 @@ public virtual async Task> GetApiSchemaAsync(string /// /// Schema id identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiSchema(string schemaId, CancellationToken cancellationToken = default) { @@ -367,7 +371,7 @@ public virtual Response GetApiSchema(string schemaId, Cancell /// An object representing collection of ApiDiagnosticResources and their operations over a ApiDiagnosticResource. public virtual ApiDiagnosticCollection GetApiDiagnostics() { - return GetCachedClient(Client => new ApiDiagnosticCollection(Client, Id)); + return GetCachedClient(client => new ApiDiagnosticCollection(client, Id)); } /// @@ -385,8 +389,8 @@ public virtual ApiDiagnosticCollection GetApiDiagnostics() /// /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiDiagnosticAsync(string diagnosticId, CancellationToken cancellationToken = default) { @@ -408,8 +412,8 @@ public virtual async Task> GetApiDiagnosticAsync /// /// Diagnostic identifier. Must be unique in the current API Management service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiDiagnostic(string diagnosticId, CancellationToken cancellationToken = default) { @@ -420,7 +424,7 @@ public virtual Response GetApiDiagnostic(string diagnosti /// An object representing collection of ApiIssueResources and their operations over a ApiIssueResource. public virtual ApiIssueCollection GetApiIssues() { - return GetCachedClient(Client => new ApiIssueCollection(Client, Id)); + return GetCachedClient(client => new ApiIssueCollection(client, Id)); } /// @@ -439,8 +443,8 @@ public virtual ApiIssueCollection GetApiIssues() /// Issue identifier. Must be unique in the current API Management service instance. /// Expand the comment attachments. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiIssueAsync(string issueId, bool? expandCommentsAttachments = null, CancellationToken cancellationToken = default) { @@ -463,8 +467,8 @@ public virtual async Task> GetApiIssueAsync(string is /// Issue identifier. Must be unique in the current API Management service instance. /// Expand the comment attachments. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiIssue(string issueId, bool? expandCommentsAttachments = null, CancellationToken cancellationToken = default) { @@ -475,7 +479,7 @@ public virtual Response GetApiIssue(string issueId, bool? expa /// An object representing collection of ApiTagDescriptionResources and their operations over a ApiTagDescriptionResource. public virtual ApiTagDescriptionCollection GetApiTagDescriptions() { - return GetCachedClient(Client => new ApiTagDescriptionCollection(Client, Id)); + return GetCachedClient(client => new ApiTagDescriptionCollection(client, Id)); } /// @@ -493,8 +497,8 @@ public virtual ApiTagDescriptionCollection GetApiTagDescriptions() /// /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApiTagDescriptionAsync(string tagDescriptionId, CancellationToken cancellationToken = default) { @@ -516,8 +520,8 @@ public virtual async Task> GetApiTagDescript /// /// Tag description identifier. Used when creating tagDescription for API/Tag association. Based on API and Tag names. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApiTagDescription(string tagDescriptionId, CancellationToken cancellationToken = default) { diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs index b766bf2577dfe..c6881ec6bf1ba 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiSchemaResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiSchemaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The schemaId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string schemaId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/schemas/{schemaId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs index ac20bc7195d8d..ba814ac91ae85 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagDescriptionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiTagDescriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The tagDescriptionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string tagDescriptionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tagDescriptions/{tagDescriptionId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs index b927e9cbbcab6..05873f7b4ab6f 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiTagResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiTagResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiId. + /// The tagId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiId, string tagId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/tags/{tagId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs index 5988a147144a6..ffd9fb6ad4961 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiVersionSetResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class ApiVersionSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The versionSetId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string versionSetId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}"; diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs index 21bf4ef2b5721..2661f3617c172 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement.Mocking; using Azure.ResourceManager.ApiManagement.Models; using Azure.ResourceManager.Resources; @@ -19,974 +20,817 @@ namespace Azure.ResourceManager.ApiManagement /// A class to add extension methods to Azure.ResourceManager.ApiManagement. public static partial class ApiManagementExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableApiManagementArmClient GetMockableApiManagementArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableApiManagementArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableApiManagementResourceGroupResource GetMockableApiManagementResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableApiManagementResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableApiManagementSubscriptionResource GetMockableApiManagementSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableApiManagementSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ApiResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiResource GetApiResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiResource.ValidateResourceId(id); - return new ApiResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiResource(id); } - #endregion - #region ApiReleaseResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiReleaseResource GetApiReleaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiReleaseResource.ValidateResourceId(id); - return new ApiReleaseResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiReleaseResource(id); } - #endregion - #region ApiOperationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiOperationResource GetApiOperationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiOperationResource.ValidateResourceId(id); - return new ApiOperationResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiOperationResource(id); } - #endregion - #region ApiOperationPolicyResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiOperationPolicyResource GetApiOperationPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiOperationPolicyResource.ValidateResourceId(id); - return new ApiOperationPolicyResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiOperationPolicyResource(id); } - #endregion - #region ApiPolicyResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiPolicyResource GetApiPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiPolicyResource.ValidateResourceId(id); - return new ApiPolicyResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiPolicyResource(id); } - #endregion - #region ApiManagementPolicyResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementPolicyResource GetApiManagementPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementPolicyResource.ValidateResourceId(id); - return new ApiManagementPolicyResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementPolicyResource(id); } - #endregion - #region ApiManagementProductPolicyResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementProductPolicyResource GetApiManagementProductPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementProductPolicyResource.ValidateResourceId(id); - return new ApiManagementProductPolicyResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementProductPolicyResource(id); } - #endregion - #region ApiOperationTagResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiOperationTagResource GetApiOperationTagResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiOperationTagResource.ValidateResourceId(id); - return new ApiOperationTagResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiOperationTagResource(id); } - #endregion - #region ApiTagResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiTagResource GetApiTagResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiTagResource.ValidateResourceId(id); - return new ApiTagResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiTagResource(id); } - #endregion - #region ApiManagementProductTagResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementProductTagResource GetApiManagementProductTagResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementProductTagResource.ValidateResourceId(id); - return new ApiManagementProductTagResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementProductTagResource(id); } - #endregion - #region ApiManagementTagResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementTagResource GetApiManagementTagResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementTagResource.ValidateResourceId(id); - return new ApiManagementTagResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementTagResource(id); } - #endregion - #region ApiSchemaResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiSchemaResource GetApiSchemaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiSchemaResource.ValidateResourceId(id); - return new ApiSchemaResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiSchemaResource(id); } - #endregion - #region ApiDiagnosticResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiDiagnosticResource GetApiDiagnosticResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiDiagnosticResource.ValidateResourceId(id); - return new ApiDiagnosticResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiDiagnosticResource(id); } - #endregion - #region ApiManagementDiagnosticResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementDiagnosticResource GetApiManagementDiagnosticResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementDiagnosticResource.ValidateResourceId(id); - return new ApiManagementDiagnosticResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementDiagnosticResource(id); } - #endregion - #region ApiIssueResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiIssueResource GetApiIssueResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiIssueResource.ValidateResourceId(id); - return new ApiIssueResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiIssueResource(id); } - #endregion - #region ApiManagementIssueResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementIssueResource GetApiManagementIssueResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementIssueResource.ValidateResourceId(id); - return new ApiManagementIssueResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementIssueResource(id); } - #endregion - #region ApiIssueCommentResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiIssueCommentResource GetApiIssueCommentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiIssueCommentResource.ValidateResourceId(id); - return new ApiIssueCommentResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiIssueCommentResource(id); } - #endregion - #region ApiIssueAttachmentResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiIssueAttachmentResource GetApiIssueAttachmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiIssueAttachmentResource.ValidateResourceId(id); - return new ApiIssueAttachmentResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiIssueAttachmentResource(id); } - #endregion - #region ApiTagDescriptionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiTagDescriptionResource GetApiTagDescriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiTagDescriptionResource.ValidateResourceId(id); - return new ApiTagDescriptionResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiTagDescriptionResource(id); } - #endregion - #region ApiVersionSetResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiVersionSetResource GetApiVersionSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiVersionSetResource.ValidateResourceId(id); - return new ApiVersionSetResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiVersionSetResource(id); } - #endregion - #region ApiManagementAuthorizationServerResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementAuthorizationServerResource GetApiManagementAuthorizationServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementAuthorizationServerResource.ValidateResourceId(id); - return new ApiManagementAuthorizationServerResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementAuthorizationServerResource(id); } - #endregion - #region ApiManagementBackendResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementBackendResource GetApiManagementBackendResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementBackendResource.ValidateResourceId(id); - return new ApiManagementBackendResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementBackendResource(id); } - #endregion - #region ApiManagementCacheResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementCacheResource GetApiManagementCacheResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementCacheResource.ValidateResourceId(id); - return new ApiManagementCacheResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementCacheResource(id); } - #endregion - #region ApiManagementCertificateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementCertificateResource GetApiManagementCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementCertificateResource.ValidateResourceId(id); - return new ApiManagementCertificateResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementCertificateResource(id); } - #endregion - #region ApiManagementDeletedServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementDeletedServiceResource GetApiManagementDeletedServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementDeletedServiceResource.ValidateResourceId(id); - return new ApiManagementDeletedServiceResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementDeletedServiceResource(id); } - #endregion - #region ApiManagementServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementServiceResource GetApiManagementServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementServiceResource.ValidateResourceId(id); - return new ApiManagementServiceResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementServiceResource(id); } - #endregion - #region ApiManagementEmailTemplateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementEmailTemplateResource GetApiManagementEmailTemplateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementEmailTemplateResource.ValidateResourceId(id); - return new ApiManagementEmailTemplateResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementEmailTemplateResource(id); } - #endregion - #region ApiManagementGatewayResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementGatewayResource GetApiManagementGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementGatewayResource.ValidateResourceId(id); - return new ApiManagementGatewayResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementGatewayResource(id); } - #endregion - #region ApiManagementGatewayHostnameConfigurationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementGatewayHostnameConfigurationResource GetApiManagementGatewayHostnameConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementGatewayHostnameConfigurationResource.ValidateResourceId(id); - return new ApiManagementGatewayHostnameConfigurationResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementGatewayHostnameConfigurationResource(id); } - #endregion - #region ApiManagementGatewayCertificateAuthorityResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementGatewayCertificateAuthorityResource GetApiManagementGatewayCertificateAuthorityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementGatewayCertificateAuthorityResource.ValidateResourceId(id); - return new ApiManagementGatewayCertificateAuthorityResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementGatewayCertificateAuthorityResource(id); } - #endregion - #region ApiManagementGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementGroupResource GetApiManagementGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementGroupResource.ValidateResourceId(id); - return new ApiManagementGroupResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementGroupResource(id); } - #endregion - #region ApiManagementIdentityProviderResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementIdentityProviderResource GetApiManagementIdentityProviderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementIdentityProviderResource.ValidateResourceId(id); - return new ApiManagementIdentityProviderResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementIdentityProviderResource(id); } - #endregion - #region ApiManagementLoggerResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementLoggerResource GetApiManagementLoggerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementLoggerResource.ValidateResourceId(id); - return new ApiManagementLoggerResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementLoggerResource(id); } - #endregion - #region ApiManagementNamedValueResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementNamedValueResource GetApiManagementNamedValueResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementNamedValueResource.ValidateResourceId(id); - return new ApiManagementNamedValueResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementNamedValueResource(id); } - #endregion - #region ApiManagementNotificationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementNotificationResource GetApiManagementNotificationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementNotificationResource.ValidateResourceId(id); - return new ApiManagementNotificationResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementNotificationResource(id); } - #endregion - #region ApiManagementOpenIdConnectProviderResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementOpenIdConnectProviderResource GetApiManagementOpenIdConnectProviderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementOpenIdConnectProviderResource.ValidateResourceId(id); - return new ApiManagementOpenIdConnectProviderResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementOpenIdConnectProviderResource(id); } - #endregion - #region ApiManagementPortalRevisionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementPortalRevisionResource GetApiManagementPortalRevisionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementPortalRevisionResource.ValidateResourceId(id); - return new ApiManagementPortalRevisionResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementPortalRevisionResource(id); } - #endregion - #region ApiManagementPortalSignInSettingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementPortalSignInSettingResource GetApiManagementPortalSignInSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementPortalSignInSettingResource.ValidateResourceId(id); - return new ApiManagementPortalSignInSettingResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementPortalSignInSettingResource(id); } - #endregion - #region ApiManagementPortalSignUpSettingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementPortalSignUpSettingResource GetApiManagementPortalSignUpSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementPortalSignUpSettingResource.ValidateResourceId(id); - return new ApiManagementPortalSignUpSettingResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementPortalSignUpSettingResource(id); } - #endregion - #region ApiManagementPortalDelegationSettingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementPortalDelegationSettingResource GetApiManagementPortalDelegationSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementPortalDelegationSettingResource.ValidateResourceId(id); - return new ApiManagementPortalDelegationSettingResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementPortalDelegationSettingResource(id); } - #endregion - #region ApiManagementPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementPrivateEndpointConnectionResource GetApiManagementPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementPrivateEndpointConnectionResource.ValidateResourceId(id); - return new ApiManagementPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementPrivateEndpointConnectionResource(id); } - #endregion - #region ApiManagementPrivateLinkResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementPrivateLinkResource GetApiManagementPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementPrivateLinkResource.ValidateResourceId(id); - return new ApiManagementPrivateLinkResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementPrivateLinkResource(id); } - #endregion - #region ApiManagementProductResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementProductResource GetApiManagementProductResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementProductResource.ValidateResourceId(id); - return new ApiManagementProductResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementProductResource(id); } - #endregion - #region ApiManagementGlobalSchemaResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementGlobalSchemaResource GetApiManagementGlobalSchemaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementGlobalSchemaResource.ValidateResourceId(id); - return new ApiManagementGlobalSchemaResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementGlobalSchemaResource(id); } - #endregion - #region ApiManagementTenantSettingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementTenantSettingResource GetApiManagementTenantSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementTenantSettingResource.ValidateResourceId(id); - return new ApiManagementTenantSettingResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementTenantSettingResource(id); } - #endregion - #region ApiManagementSubscriptionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementSubscriptionResource GetApiManagementSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementSubscriptionResource.ValidateResourceId(id); - return new ApiManagementSubscriptionResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementSubscriptionResource(id); } - #endregion - #region ApiManagementUserSubscriptionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementUserSubscriptionResource GetApiManagementUserSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementUserSubscriptionResource.ValidateResourceId(id); - return new ApiManagementUserSubscriptionResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementUserSubscriptionResource(id); } - #endregion - #region TenantAccessInfoResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TenantAccessInfoResource GetTenantAccessInfoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TenantAccessInfoResource.ValidateResourceId(id); - return new TenantAccessInfoResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetTenantAccessInfoResource(id); } - #endregion - #region ApiManagementUserResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApiManagementUserResource GetApiManagementUserResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApiManagementUserResource.ValidateResourceId(id); - return new ApiManagementUserResource(client, id); - } - ); + return GetMockableApiManagementArmClient(client).GetApiManagementUserResource(id); } - #endregion - /// Gets a collection of ApiManagementServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of ApiManagementServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ApiManagementServiceResources and their operations over a ApiManagementServiceResource. public static ApiManagementServiceCollection GetApiManagementServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApiManagementServices(); + return GetMockableApiManagementResourceGroupResource(resourceGroupResource).GetApiManagementServices(); } /// @@ -1001,16 +845,20 @@ public static ApiManagementServiceCollection GetApiManagementServices(this Resou /// ApiManagementService_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the API Management service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetApiManagementServiceAsync(this ResourceGroupResource resourceGroupResource, string serviceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetApiManagementServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + return await GetMockableApiManagementResourceGroupResource(resourceGroupResource).GetApiManagementServiceAsync(serviceName, cancellationToken).ConfigureAwait(false); } /// @@ -1025,24 +873,34 @@ public static async Task> GetApiManagemen /// ApiManagementService_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the API Management service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetApiManagementService(this ResourceGroupResource resourceGroupResource, string serviceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetApiManagementServices().Get(serviceName, cancellationToken); + return GetMockableApiManagementResourceGroupResource(resourceGroupResource).GetApiManagementService(serviceName, cancellationToken); } - /// Gets a collection of ApiManagementDeletedServiceResources in the SubscriptionResource. + /// + /// Gets a collection of ApiManagementDeletedServiceResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ApiManagementDeletedServiceResources and their operations over a ApiManagementDeletedServiceResource. public static ApiManagementDeletedServiceCollection GetApiManagementDeletedServices(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementDeletedServices(); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementDeletedServices(); } /// @@ -1057,17 +915,21 @@ public static ApiManagementDeletedServiceCollection GetApiManagementDeletedServi /// DeletedServices_GetByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetApiManagementDeletedServiceAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string serviceName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetApiManagementDeletedServices().GetAsync(location, serviceName, cancellationToken).ConfigureAwait(false); + return await GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementDeletedServiceAsync(location, serviceName, cancellationToken).ConfigureAwait(false); } /// @@ -1082,17 +944,21 @@ public static async Task> GetApiMa /// DeletedServices_GetByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the deleted API Management service. /// The name of the API Management service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetApiManagementDeletedService(this SubscriptionResource subscriptionResource, AzureLocation location, string serviceName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetApiManagementDeletedServices().Get(location, serviceName, cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementDeletedService(location, serviceName, cancellationToken); } /// @@ -1107,13 +973,17 @@ public static Response GetApiManagementDele /// DeletedServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApiManagementDeletedServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementDeletedServicesAsync(cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementDeletedServicesAsync(cancellationToken); } /// @@ -1128,13 +998,17 @@ public static AsyncPageable GetApiManagemen /// DeletedServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApiManagementDeletedServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementDeletedServices(cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementDeletedServices(cancellationToken); } /// @@ -1149,13 +1023,17 @@ public static Pageable GetApiManagementDele /// ApiManagementService_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApiManagementServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementServicesAsync(cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementServicesAsync(cancellationToken); } /// @@ -1170,13 +1048,17 @@ public static AsyncPageable GetApiManagementServic /// ApiManagementService_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApiManagementServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementServices(cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementServices(cancellationToken); } /// @@ -1191,6 +1073,10 @@ public static Pageable GetApiManagementServices(th /// ApiManagementService_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters supplied to the CheckNameAvailability operation. @@ -1198,9 +1084,7 @@ public static Pageable GetApiManagementServices(th /// is null. public static async Task> CheckApiManagementServiceNameAvailabilityAsync(this SubscriptionResource subscriptionResource, ApiManagementServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckApiManagementServiceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableApiManagementSubscriptionResource(subscriptionResource).CheckApiManagementServiceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -1215,6 +1099,10 @@ public static async Task> C /// ApiManagementService_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters supplied to the CheckNameAvailability operation. @@ -1222,9 +1110,7 @@ public static async Task> C /// is null. public static Response CheckApiManagementServiceNameAvailability(this SubscriptionResource subscriptionResource, ApiManagementServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckApiManagementServiceNameAvailability(content, cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).CheckApiManagementServiceNameAvailability(content, cancellationToken); } /// @@ -1239,12 +1125,16 @@ public static Response CheckApiManag /// ApiManagementService_GetDomainOwnershipIdentifier /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetApiManagementServiceDomainOwnershipIdentifierAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementServiceDomainOwnershipIdentifierAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementServiceDomainOwnershipIdentifierAsync(cancellationToken).ConfigureAwait(false); } /// @@ -1259,12 +1149,16 @@ public static async TaskApiManagementService_GetDomainOwnershipIdentifier /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetApiManagementServiceDomainOwnershipIdentifier(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementServiceDomainOwnershipIdentifier(cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementServiceDomainOwnershipIdentifier(cancellationToken); } /// @@ -1279,13 +1173,17 @@ public static Response G /// ApiManagementSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApiManagementSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementSkusAsync(cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementSkusAsync(cancellationToken); } /// @@ -1300,13 +1198,17 @@ public static AsyncPageable GetApiManagementSkusAsync(this Sub /// ApiManagementSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApiManagementSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApiManagementSkus(cancellationToken); + return GetMockableApiManagementSubscriptionResource(subscriptionResource).GetApiManagementSkus(cancellationToken); } } } diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementArmClient.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementArmClient.cs new file mode 100644 index 0000000000000..996931579f57b --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementArmClient.cs @@ -0,0 +1,627 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableApiManagementArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableApiManagementArmClient() + { + } + + /// 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 MockableApiManagementArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableApiManagementArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiResource GetApiResource(ResourceIdentifier id) + { + ApiResource.ValidateResourceId(id); + return new ApiResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiReleaseResource GetApiReleaseResource(ResourceIdentifier id) + { + ApiReleaseResource.ValidateResourceId(id); + return new ApiReleaseResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiOperationResource GetApiOperationResource(ResourceIdentifier id) + { + ApiOperationResource.ValidateResourceId(id); + return new ApiOperationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiOperationPolicyResource GetApiOperationPolicyResource(ResourceIdentifier id) + { + ApiOperationPolicyResource.ValidateResourceId(id); + return new ApiOperationPolicyResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiPolicyResource GetApiPolicyResource(ResourceIdentifier id) + { + ApiPolicyResource.ValidateResourceId(id); + return new ApiPolicyResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementPolicyResource GetApiManagementPolicyResource(ResourceIdentifier id) + { + ApiManagementPolicyResource.ValidateResourceId(id); + return new ApiManagementPolicyResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementProductPolicyResource GetApiManagementProductPolicyResource(ResourceIdentifier id) + { + ApiManagementProductPolicyResource.ValidateResourceId(id); + return new ApiManagementProductPolicyResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiOperationTagResource GetApiOperationTagResource(ResourceIdentifier id) + { + ApiOperationTagResource.ValidateResourceId(id); + return new ApiOperationTagResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiTagResource GetApiTagResource(ResourceIdentifier id) + { + ApiTagResource.ValidateResourceId(id); + return new ApiTagResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementProductTagResource GetApiManagementProductTagResource(ResourceIdentifier id) + { + ApiManagementProductTagResource.ValidateResourceId(id); + return new ApiManagementProductTagResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementTagResource GetApiManagementTagResource(ResourceIdentifier id) + { + ApiManagementTagResource.ValidateResourceId(id); + return new ApiManagementTagResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiSchemaResource GetApiSchemaResource(ResourceIdentifier id) + { + ApiSchemaResource.ValidateResourceId(id); + return new ApiSchemaResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiDiagnosticResource GetApiDiagnosticResource(ResourceIdentifier id) + { + ApiDiagnosticResource.ValidateResourceId(id); + return new ApiDiagnosticResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementDiagnosticResource GetApiManagementDiagnosticResource(ResourceIdentifier id) + { + ApiManagementDiagnosticResource.ValidateResourceId(id); + return new ApiManagementDiagnosticResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiIssueResource GetApiIssueResource(ResourceIdentifier id) + { + ApiIssueResource.ValidateResourceId(id); + return new ApiIssueResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementIssueResource GetApiManagementIssueResource(ResourceIdentifier id) + { + ApiManagementIssueResource.ValidateResourceId(id); + return new ApiManagementIssueResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiIssueCommentResource GetApiIssueCommentResource(ResourceIdentifier id) + { + ApiIssueCommentResource.ValidateResourceId(id); + return new ApiIssueCommentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiIssueAttachmentResource GetApiIssueAttachmentResource(ResourceIdentifier id) + { + ApiIssueAttachmentResource.ValidateResourceId(id); + return new ApiIssueAttachmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiTagDescriptionResource GetApiTagDescriptionResource(ResourceIdentifier id) + { + ApiTagDescriptionResource.ValidateResourceId(id); + return new ApiTagDescriptionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiVersionSetResource GetApiVersionSetResource(ResourceIdentifier id) + { + ApiVersionSetResource.ValidateResourceId(id); + return new ApiVersionSetResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementAuthorizationServerResource GetApiManagementAuthorizationServerResource(ResourceIdentifier id) + { + ApiManagementAuthorizationServerResource.ValidateResourceId(id); + return new ApiManagementAuthorizationServerResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementBackendResource GetApiManagementBackendResource(ResourceIdentifier id) + { + ApiManagementBackendResource.ValidateResourceId(id); + return new ApiManagementBackendResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementCacheResource GetApiManagementCacheResource(ResourceIdentifier id) + { + ApiManagementCacheResource.ValidateResourceId(id); + return new ApiManagementCacheResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementCertificateResource GetApiManagementCertificateResource(ResourceIdentifier id) + { + ApiManagementCertificateResource.ValidateResourceId(id); + return new ApiManagementCertificateResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementDeletedServiceResource GetApiManagementDeletedServiceResource(ResourceIdentifier id) + { + ApiManagementDeletedServiceResource.ValidateResourceId(id); + return new ApiManagementDeletedServiceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementServiceResource GetApiManagementServiceResource(ResourceIdentifier id) + { + ApiManagementServiceResource.ValidateResourceId(id); + return new ApiManagementServiceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementEmailTemplateResource GetApiManagementEmailTemplateResource(ResourceIdentifier id) + { + ApiManagementEmailTemplateResource.ValidateResourceId(id); + return new ApiManagementEmailTemplateResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementGatewayResource GetApiManagementGatewayResource(ResourceIdentifier id) + { + ApiManagementGatewayResource.ValidateResourceId(id); + return new ApiManagementGatewayResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementGatewayHostnameConfigurationResource GetApiManagementGatewayHostnameConfigurationResource(ResourceIdentifier id) + { + ApiManagementGatewayHostnameConfigurationResource.ValidateResourceId(id); + return new ApiManagementGatewayHostnameConfigurationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementGatewayCertificateAuthorityResource GetApiManagementGatewayCertificateAuthorityResource(ResourceIdentifier id) + { + ApiManagementGatewayCertificateAuthorityResource.ValidateResourceId(id); + return new ApiManagementGatewayCertificateAuthorityResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementGroupResource GetApiManagementGroupResource(ResourceIdentifier id) + { + ApiManagementGroupResource.ValidateResourceId(id); + return new ApiManagementGroupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementIdentityProviderResource GetApiManagementIdentityProviderResource(ResourceIdentifier id) + { + ApiManagementIdentityProviderResource.ValidateResourceId(id); + return new ApiManagementIdentityProviderResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementLoggerResource GetApiManagementLoggerResource(ResourceIdentifier id) + { + ApiManagementLoggerResource.ValidateResourceId(id); + return new ApiManagementLoggerResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementNamedValueResource GetApiManagementNamedValueResource(ResourceIdentifier id) + { + ApiManagementNamedValueResource.ValidateResourceId(id); + return new ApiManagementNamedValueResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementNotificationResource GetApiManagementNotificationResource(ResourceIdentifier id) + { + ApiManagementNotificationResource.ValidateResourceId(id); + return new ApiManagementNotificationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementOpenIdConnectProviderResource GetApiManagementOpenIdConnectProviderResource(ResourceIdentifier id) + { + ApiManagementOpenIdConnectProviderResource.ValidateResourceId(id); + return new ApiManagementOpenIdConnectProviderResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementPortalRevisionResource GetApiManagementPortalRevisionResource(ResourceIdentifier id) + { + ApiManagementPortalRevisionResource.ValidateResourceId(id); + return new ApiManagementPortalRevisionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementPortalSignInSettingResource GetApiManagementPortalSignInSettingResource(ResourceIdentifier id) + { + ApiManagementPortalSignInSettingResource.ValidateResourceId(id); + return new ApiManagementPortalSignInSettingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementPortalSignUpSettingResource GetApiManagementPortalSignUpSettingResource(ResourceIdentifier id) + { + ApiManagementPortalSignUpSettingResource.ValidateResourceId(id); + return new ApiManagementPortalSignUpSettingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementPortalDelegationSettingResource GetApiManagementPortalDelegationSettingResource(ResourceIdentifier id) + { + ApiManagementPortalDelegationSettingResource.ValidateResourceId(id); + return new ApiManagementPortalDelegationSettingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementPrivateEndpointConnectionResource GetApiManagementPrivateEndpointConnectionResource(ResourceIdentifier id) + { + ApiManagementPrivateEndpointConnectionResource.ValidateResourceId(id); + return new ApiManagementPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementPrivateLinkResource GetApiManagementPrivateLinkResource(ResourceIdentifier id) + { + ApiManagementPrivateLinkResource.ValidateResourceId(id); + return new ApiManagementPrivateLinkResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementProductResource GetApiManagementProductResource(ResourceIdentifier id) + { + ApiManagementProductResource.ValidateResourceId(id); + return new ApiManagementProductResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementGlobalSchemaResource GetApiManagementGlobalSchemaResource(ResourceIdentifier id) + { + ApiManagementGlobalSchemaResource.ValidateResourceId(id); + return new ApiManagementGlobalSchemaResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementTenantSettingResource GetApiManagementTenantSettingResource(ResourceIdentifier id) + { + ApiManagementTenantSettingResource.ValidateResourceId(id); + return new ApiManagementTenantSettingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementSubscriptionResource GetApiManagementSubscriptionResource(ResourceIdentifier id) + { + ApiManagementSubscriptionResource.ValidateResourceId(id); + return new ApiManagementSubscriptionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementUserSubscriptionResource GetApiManagementUserSubscriptionResource(ResourceIdentifier id) + { + ApiManagementUserSubscriptionResource.ValidateResourceId(id); + return new ApiManagementUserSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantAccessInfoResource GetTenantAccessInfoResource(ResourceIdentifier id) + { + TenantAccessInfoResource.ValidateResourceId(id); + return new TenantAccessInfoResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApiManagementUserResource GetApiManagementUserResource(ResourceIdentifier id) + { + ApiManagementUserResource.ValidateResourceId(id); + return new ApiManagementUserResource(Client, id); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementResourceGroupResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementResourceGroupResource.cs new file mode 100644 index 0000000000000..f677389194927 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ApiManagement; + +namespace Azure.ResourceManager.ApiManagement.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableApiManagementResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableApiManagementResourceGroupResource() + { + } + + /// 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 MockableApiManagementResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ApiManagementServiceResources in the ResourceGroupResource. + /// An object representing collection of ApiManagementServiceResources and their operations over a ApiManagementServiceResource. + public virtual ApiManagementServiceCollection GetApiManagementServices() + { + return GetCachedClient(client => new ApiManagementServiceCollection(client, Id)); + } + + /// + /// Gets an API Management service resource description. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName} + /// + /// + /// Operation Id + /// ApiManagementService_Get + /// + /// + /// + /// The name of the API Management service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetApiManagementServiceAsync(string serviceName, CancellationToken cancellationToken = default) + { + return await GetApiManagementServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an API Management service resource description. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName} + /// + /// + /// Operation Id + /// ApiManagementService_Get + /// + /// + /// + /// The name of the API Management service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetApiManagementService(string serviceName, CancellationToken cancellationToken = default) + { + return GetApiManagementServices().Get(serviceName, cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementSubscriptionResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementSubscriptionResource.cs new file mode 100644 index 0000000000000..d49e522f989c2 --- /dev/null +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/MockableApiManagementSubscriptionResource.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApiManagement; +using Azure.ResourceManager.ApiManagement.Models; + +namespace Azure.ResourceManager.ApiManagement.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableApiManagementSubscriptionResource : ArmResource + { + private ClientDiagnostics _apiManagementDeletedServiceDeletedServicesClientDiagnostics; + private DeletedServicesRestOperations _apiManagementDeletedServiceDeletedServicesRestClient; + private ClientDiagnostics _apiManagementServiceClientDiagnostics; + private ApiManagementServiceRestOperations _apiManagementServiceRestClient; + private ClientDiagnostics _apiManagementSkusClientDiagnostics; + private ApiManagementSkusRestOperations _apiManagementSkusRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableApiManagementSubscriptionResource() + { + } + + /// 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 MockableApiManagementSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ApiManagementDeletedServiceDeletedServicesClientDiagnostics => _apiManagementDeletedServiceDeletedServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementDeletedServiceResource.ResourceType.Namespace, Diagnostics); + private DeletedServicesRestOperations ApiManagementDeletedServiceDeletedServicesRestClient => _apiManagementDeletedServiceDeletedServicesRestClient ??= new DeletedServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApiManagementDeletedServiceResource.ResourceType)); + private ClientDiagnostics ApiManagementServiceClientDiagnostics => _apiManagementServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementServiceResource.ResourceType.Namespace, Diagnostics); + private ApiManagementServiceRestOperations ApiManagementServiceRestClient => _apiManagementServiceRestClient ??= new ApiManagementServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApiManagementServiceResource.ResourceType)); + private ClientDiagnostics ApiManagementSkusClientDiagnostics => _apiManagementSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ApiManagementSkusRestOperations ApiManagementSkusRestClient => _apiManagementSkusRestClient ??= new ApiManagementSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ApiManagementDeletedServiceResources in the SubscriptionResource. + /// An object representing collection of ApiManagementDeletedServiceResources and their operations over a ApiManagementDeletedServiceResource. + public virtual ApiManagementDeletedServiceCollection GetApiManagementDeletedServices() + { + return GetCachedClient(client => new ApiManagementDeletedServiceCollection(client, Id)); + } + + /// + /// Get soft-deleted Api Management Service by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName} + /// + /// + /// Operation Id + /// DeletedServices_GetByName + /// + /// + /// + /// The location of the deleted API Management service. + /// The name of the API Management service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetApiManagementDeletedServiceAsync(AzureLocation location, string serviceName, CancellationToken cancellationToken = default) + { + return await GetApiManagementDeletedServices().GetAsync(location, serviceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get soft-deleted Api Management Service by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName} + /// + /// + /// Operation Id + /// DeletedServices_GetByName + /// + /// + /// + /// The location of the deleted API Management service. + /// The name of the API Management service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetApiManagementDeletedService(AzureLocation location, string serviceName, CancellationToken cancellationToken = default) + { + return GetApiManagementDeletedServices().Get(location, serviceName, cancellationToken); + } + + /// + /// Lists all soft-deleted services available for undelete for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices + /// + /// + /// Operation Id + /// DeletedServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApiManagementDeletedServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementDeletedServiceResource(Client, ApiManagementDeletedServiceData.DeserializeApiManagementDeletedServiceData(e)), ApiManagementDeletedServiceDeletedServicesClientDiagnostics, Pipeline, "MockableApiManagementSubscriptionResource.GetApiManagementDeletedServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all soft-deleted services available for undelete for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices + /// + /// + /// Operation Id + /// DeletedServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApiManagementDeletedServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementDeletedServiceResource(Client, ApiManagementDeletedServiceData.DeserializeApiManagementDeletedServiceData(e)), ApiManagementDeletedServiceDeletedServicesClientDiagnostics, Pipeline, "MockableApiManagementSubscriptionResource.GetApiManagementDeletedServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all API Management services within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service + /// + /// + /// Operation Id + /// ApiManagementService_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApiManagementServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementServiceRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementServiceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), ApiManagementServiceClientDiagnostics, Pipeline, "MockableApiManagementSubscriptionResource.GetApiManagementServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all API Management services within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service + /// + /// + /// Operation Id + /// ApiManagementService_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApiManagementServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementServiceRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementServiceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), ApiManagementServiceClientDiagnostics, Pipeline, "MockableApiManagementSubscriptionResource.GetApiManagementServices", "value", "nextLink", cancellationToken); + } + + /// + /// Checks availability and correctness of a name for an API Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability + /// + /// + /// Operation Id + /// ApiManagementService_CheckNameAvailability + /// + /// + /// + /// Parameters supplied to the CheckNameAvailability operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckApiManagementServiceNameAvailabilityAsync(ApiManagementServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ApiManagementServiceClientDiagnostics.CreateScope("MockableApiManagementSubscriptionResource.CheckApiManagementServiceNameAvailability"); + scope.Start(); + try + { + var response = await ApiManagementServiceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks availability and correctness of a name for an API Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability + /// + /// + /// Operation Id + /// ApiManagementService_CheckNameAvailability + /// + /// + /// + /// Parameters supplied to the CheckNameAvailability operation. + /// The cancellation token to use. + /// is null. + public virtual Response CheckApiManagementServiceNameAvailability(ApiManagementServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ApiManagementServiceClientDiagnostics.CreateScope("MockableApiManagementSubscriptionResource.CheckApiManagementServiceNameAvailability"); + scope.Start(); + try + { + var response = ApiManagementServiceRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the custom domain ownership identifier for an API Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier + /// + /// + /// Operation Id + /// ApiManagementService_GetDomainOwnershipIdentifier + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetApiManagementServiceDomainOwnershipIdentifierAsync(CancellationToken cancellationToken = default) + { + using var scope = ApiManagementServiceClientDiagnostics.CreateScope("MockableApiManagementSubscriptionResource.GetApiManagementServiceDomainOwnershipIdentifier"); + scope.Start(); + try + { + var response = await ApiManagementServiceRestClient.GetDomainOwnershipIdentifierAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the custom domain ownership identifier for an API Management service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier + /// + /// + /// Operation Id + /// ApiManagementService_GetDomainOwnershipIdentifier + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetApiManagementServiceDomainOwnershipIdentifier(CancellationToken cancellationToken = default) + { + using var scope = ApiManagementServiceClientDiagnostics.CreateScope("MockableApiManagementSubscriptionResource.GetApiManagementServiceDomainOwnershipIdentifier"); + scope.Start(); + try + { + var response = ApiManagementServiceRestClient.GetDomainOwnershipIdentifier(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus + /// + /// + /// Operation Id + /// ApiManagementSkus_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApiManagementSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementSkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementSku.DeserializeApiManagementSku, ApiManagementSkusClientDiagnostics, Pipeline, "MockableApiManagementSubscriptionResource.GetApiManagementSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus + /// + /// + /// Operation Id + /// ApiManagementSkus_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApiManagementSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementSkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementSku.DeserializeApiManagementSku, ApiManagementSkusClientDiagnostics, Pipeline, "MockableApiManagementSubscriptionResource.GetApiManagementSkus", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 424939d021d54..0000000000000 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ApiManagement -{ - /// 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 ApiManagementServiceResources in the ResourceGroupResource. - /// An object representing collection of ApiManagementServiceResources and their operations over a ApiManagementServiceResource. - public virtual ApiManagementServiceCollection GetApiManagementServices() - { - return GetCachedClient(Client => new ApiManagementServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b0e7d9db183e8..0000000000000 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ApiManagement.Models; - -namespace Azure.ResourceManager.ApiManagement -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _apiManagementDeletedServiceDeletedServicesClientDiagnostics; - private DeletedServicesRestOperations _apiManagementDeletedServiceDeletedServicesRestClient; - private ClientDiagnostics _apiManagementServiceClientDiagnostics; - private ApiManagementServiceRestOperations _apiManagementServiceRestClient; - private ClientDiagnostics _apiManagementSkusClientDiagnostics; - private ApiManagementSkusRestOperations _apiManagementSkusRestClient; - - /// 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 ApiManagementDeletedServiceDeletedServicesClientDiagnostics => _apiManagementDeletedServiceDeletedServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementDeletedServiceResource.ResourceType.Namespace, Diagnostics); - private DeletedServicesRestOperations ApiManagementDeletedServiceDeletedServicesRestClient => _apiManagementDeletedServiceDeletedServicesRestClient ??= new DeletedServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApiManagementDeletedServiceResource.ResourceType)); - private ClientDiagnostics ApiManagementServiceClientDiagnostics => _apiManagementServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ApiManagementServiceResource.ResourceType.Namespace, Diagnostics); - private ApiManagementServiceRestOperations ApiManagementServiceRestClient => _apiManagementServiceRestClient ??= new ApiManagementServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApiManagementServiceResource.ResourceType)); - private ClientDiagnostics ApiManagementSkusClientDiagnostics => _apiManagementSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApiManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ApiManagementSkusRestOperations ApiManagementSkusRestClient => _apiManagementSkusRestClient ??= new ApiManagementSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ApiManagementDeletedServiceResources in the SubscriptionResource. - /// An object representing collection of ApiManagementDeletedServiceResources and their operations over a ApiManagementDeletedServiceResource. - public virtual ApiManagementDeletedServiceCollection GetApiManagementDeletedServices() - { - return GetCachedClient(Client => new ApiManagementDeletedServiceCollection(Client, Id)); - } - - /// - /// Lists all soft-deleted services available for undelete for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices - /// - /// - /// Operation Id - /// DeletedServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApiManagementDeletedServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementDeletedServiceResource(Client, ApiManagementDeletedServiceData.DeserializeApiManagementDeletedServiceData(e)), ApiManagementDeletedServiceDeletedServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementDeletedServices", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all soft-deleted services available for undelete for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices - /// - /// - /// Operation Id - /// DeletedServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApiManagementDeletedServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementDeletedServiceDeletedServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementDeletedServiceResource(Client, ApiManagementDeletedServiceData.DeserializeApiManagementDeletedServiceData(e)), ApiManagementDeletedServiceDeletedServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementDeletedServices", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all API Management services within an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service - /// - /// - /// Operation Id - /// ApiManagementService_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApiManagementServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementServiceRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementServiceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), ApiManagementServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementServices", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all API Management services within an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service - /// - /// - /// Operation Id - /// ApiManagementService_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApiManagementServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementServiceRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementServiceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApiManagementServiceResource(Client, ApiManagementServiceData.DeserializeApiManagementServiceData(e)), ApiManagementServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementServices", "value", "nextLink", cancellationToken); - } - - /// - /// Checks availability and correctness of a name for an API Management service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability - /// - /// - /// Operation Id - /// ApiManagementService_CheckNameAvailability - /// - /// - /// - /// Parameters supplied to the CheckNameAvailability operation. - /// The cancellation token to use. - public virtual async Task> CheckApiManagementServiceNameAvailabilityAsync(ApiManagementServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ApiManagementServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckApiManagementServiceNameAvailability"); - scope.Start(); - try - { - var response = await ApiManagementServiceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks availability and correctness of a name for an API Management service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability - /// - /// - /// Operation Id - /// ApiManagementService_CheckNameAvailability - /// - /// - /// - /// Parameters supplied to the CheckNameAvailability operation. - /// The cancellation token to use. - public virtual Response CheckApiManagementServiceNameAvailability(ApiManagementServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ApiManagementServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckApiManagementServiceNameAvailability"); - scope.Start(); - try - { - var response = ApiManagementServiceRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the custom domain ownership identifier for an API Management service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier - /// - /// - /// Operation Id - /// ApiManagementService_GetDomainOwnershipIdentifier - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetApiManagementServiceDomainOwnershipIdentifierAsync(CancellationToken cancellationToken = default) - { - using var scope = ApiManagementServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetApiManagementServiceDomainOwnershipIdentifier"); - scope.Start(); - try - { - var response = await ApiManagementServiceRestClient.GetDomainOwnershipIdentifierAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the custom domain ownership identifier for an API Management service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/getDomainOwnershipIdentifier - /// - /// - /// Operation Id - /// ApiManagementService_GetDomainOwnershipIdentifier - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetApiManagementServiceDomainOwnershipIdentifier(CancellationToken cancellationToken = default) - { - using var scope = ApiManagementServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetApiManagementServiceDomainOwnershipIdentifier"); - scope.Start(); - try - { - var response = ApiManagementServiceRestClient.GetDomainOwnershipIdentifier(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus - /// - /// - /// Operation Id - /// ApiManagementSkus_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApiManagementSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementSkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApiManagementSku.DeserializeApiManagementSku, ApiManagementSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus - /// - /// - /// Operation Id - /// ApiManagementSkus_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApiManagementSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApiManagementSkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApiManagementSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApiManagementSku.DeserializeApiManagementSku, ApiManagementSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApiManagementSkus", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoResource.cs index 686c22d0a960f..a8ea00914b71c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/TenantAccessInfoResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApiManagement public partial class TenantAccessInfoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The accessName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, AccessName accessName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}"; diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/Azure.ResourceManager.AppComplianceAutomation.sln b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/Azure.ResourceManager.AppComplianceAutomation.sln index de2df5e10148d..8aeb37ea43928 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/Azure.ResourceManager.AppComplianceAutomation.sln +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/Azure.ResourceManager.AppComplianceAutomation.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{AF237844-264B-4650-941B-7745D6DEAC52}") = "Azure.ResourceManager.AppComplianceAutomation", "src\Azure.ResourceManager.AppComplianceAutomation.csproj", "{D30FC631-9EED-4753-A1DC-F57E4B6F13B3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.AppComplianceAutomation", "src\Azure.ResourceManager.AppComplianceAutomation.csproj", "{D30FC631-9EED-4753-A1DC-F57E4B6F13B3}" EndProject -Project("{AF237844-264B-4650-941B-7745D6DEAC52}") = "Azure.ResourceManager.AppComplianceAutomation.Tests", "tests\Azure.ResourceManager.AppComplianceAutomation.Tests.csproj", "{2F79F425-2B2A-4727-9785-23810B6913D0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.AppComplianceAutomation.Tests", "tests\Azure.ResourceManager.AppComplianceAutomation.Tests.csproj", "{2F79F425-2B2A-4727-9785-23810B6913D0}" EndProject -Project("{AF237844-264B-4650-941B-7745D6DEAC52}") = "Azure.ResourceManager.AppComplianceAutomation.Samples", "samples\Azure.ResourceManager.AppComplianceAutomation.Samples.csproj", "{B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.AppComplianceAutomation.Samples", "samples\Azure.ResourceManager.AppComplianceAutomation.Samples.csproj", "{B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {AFA4A893-17C1-4AAC-91F2-264A048CCFF5} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {2F79F425-2B2A-4727-9785-23810B6913D0}.Release|x64.Build.0 = Release|Any CPU {2F79F425-2B2A-4727-9785-23810B6913D0}.Release|x86.ActiveCfg = Release|Any CPU {2F79F425-2B2A-4727-9785-23810B6913D0}.Release|x86.Build.0 = Release|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Debug|x64.ActiveCfg = Debug|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Debug|x64.Build.0 = Debug|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Debug|x86.ActiveCfg = Debug|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Debug|x86.Build.0 = Debug|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Release|Any CPU.Build.0 = Release|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Release|x64.ActiveCfg = Release|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Release|x64.Build.0 = Release|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Release|x86.ActiveCfg = Release|Any CPU + {B5195FB6-D96A-49D9-87CC-D35BF1AB31D6}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AFA4A893-17C1-4AAC-91F2-264A048CCFF5} EndGlobalSection EndGlobal diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/api/Azure.ResourceManager.AppComplianceAutomation.netstandard2.0.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/api/Azure.ResourceManager.AppComplianceAutomation.netstandard2.0.cs index 4aa4be550af03..25d467ca89582 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/api/Azure.ResourceManager.AppComplianceAutomation.netstandard2.0.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/api/Azure.ResourceManager.AppComplianceAutomation.netstandard2.0.cs @@ -80,6 +80,22 @@ public SnapshotResourceData() { } public Azure.ResourceManager.AppComplianceAutomation.Models.SnapshotProperties Properties { get { throw null; } } } } +namespace Azure.ResourceManager.AppComplianceAutomation.Mocking +{ + public partial class MockableAppComplianceAutomationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAppComplianceAutomationArmClient() { } + public virtual Azure.ResourceManager.AppComplianceAutomation.ReportResource GetReportResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppComplianceAutomation.SnapshotResource GetSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAppComplianceAutomationTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableAppComplianceAutomationTenantResource() { } + public virtual Azure.Response GetReportResource(string reportName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetReportResourceAsync(string reportName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppComplianceAutomation.ReportResourceCollection GetReportResources() { throw null; } + } +} namespace Azure.ResourceManager.AppComplianceAutomation.Models { public static partial class ArmAppComplianceAutomationModelFactory diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/AppComplianceAutomationExtensions.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/AppComplianceAutomationExtensions.cs index ff726ecb921fa..8902ddd2616d7 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/AppComplianceAutomationExtensions.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/AppComplianceAutomationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.AppComplianceAutomation.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.AppComplianceAutomation @@ -18,65 +19,60 @@ namespace Azure.ResourceManager.AppComplianceAutomation /// A class to add extension methods to Azure.ResourceManager.AppComplianceAutomation. public static partial class AppComplianceAutomationExtensions { - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableAppComplianceAutomationArmClient GetMockableAppComplianceAutomationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAppComplianceAutomationArmClient(client0)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAppComplianceAutomationTenantResource GetMockableAppComplianceAutomationTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAppComplianceAutomationTenantResource(client, resource.Id)); } - #region ReportResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ReportResource GetReportResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ReportResource.ValidateResourceId(id); - return new ReportResource(client, id); - } - ); + return GetMockableAppComplianceAutomationArmClient(client).GetReportResource(id); } - #endregion - #region SnapshotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SnapshotResource GetSnapshotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SnapshotResource.ValidateResourceId(id); - return new SnapshotResource(client, id); - } - ); + return GetMockableAppComplianceAutomationArmClient(client).GetSnapshotResource(id); } - #endregion - /// Gets a collection of ReportResources in the TenantResource. + /// + /// Gets a collection of ReportResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ReportResources and their operations over a ReportResource. public static ReportResourceCollection GetReportResources(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetReportResources(); + return GetMockableAppComplianceAutomationTenantResource(tenantResource).GetReportResources(); } /// @@ -91,16 +87,20 @@ public static ReportResourceCollection GetReportResources(this TenantResource te /// Report_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Report Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetReportResourceAsync(this TenantResource tenantResource, string reportName, CancellationToken cancellationToken = default) { - return await tenantResource.GetReportResources().GetAsync(reportName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppComplianceAutomationTenantResource(tenantResource).GetReportResourceAsync(reportName, cancellationToken).ConfigureAwait(false); } /// @@ -115,16 +115,20 @@ public static async Task> GetReportResourceAsync(this T /// Report_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Report Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetReportResource(this TenantResource tenantResource, string reportName, CancellationToken cancellationToken = default) { - return tenantResource.GetReportResources().Get(reportName, cancellationToken); + return GetMockableAppComplianceAutomationTenantResource(tenantResource).GetReportResource(reportName, cancellationToken); } } } diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/MockableAppComplianceAutomationArmClient.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/MockableAppComplianceAutomationArmClient.cs new file mode 100644 index 0000000000000..6aac8bfa4b8a4 --- /dev/null +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/MockableAppComplianceAutomationArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.AppComplianceAutomation; + +namespace Azure.ResourceManager.AppComplianceAutomation.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAppComplianceAutomationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppComplianceAutomationArmClient() + { + } + + /// 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 MockableAppComplianceAutomationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAppComplianceAutomationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReportResource GetReportResource(ResourceIdentifier id) + { + ReportResource.ValidateResourceId(id); + return new ReportResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SnapshotResource GetSnapshotResource(ResourceIdentifier id) + { + SnapshotResource.ValidateResourceId(id); + return new SnapshotResource(Client, id); + } + } +} diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/MockableAppComplianceAutomationTenantResource.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/MockableAppComplianceAutomationTenantResource.cs new file mode 100644 index 0000000000000..6683707f44102 --- /dev/null +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/MockableAppComplianceAutomationTenantResource.cs @@ -0,0 +1,92 @@ +// 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.AppComplianceAutomation; + +namespace Azure.ResourceManager.AppComplianceAutomation.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableAppComplianceAutomationTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppComplianceAutomationTenantResource() + { + } + + /// 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 MockableAppComplianceAutomationTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ReportResources in the TenantResource. + /// An object representing collection of ReportResources and their operations over a ReportResource. + public virtual ReportResourceCollection GetReportResources() + { + return GetCachedClient(client => new ReportResourceCollection(client, Id)); + } + + /// + /// Get the AppComplianceAutomation report and its properties. + /// + /// + /// Request Path + /// /providers/Microsoft.AppComplianceAutomation/reports/{reportName} + /// + /// + /// Operation Id + /// Report_Get + /// + /// + /// + /// Report Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetReportResourceAsync(string reportName, CancellationToken cancellationToken = default) + { + return await GetReportResources().GetAsync(reportName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the AppComplianceAutomation report and its properties. + /// + /// + /// Request Path + /// /providers/Microsoft.AppComplianceAutomation/reports/{reportName} + /// + /// + /// Operation Id + /// Report_Get + /// + /// + /// + /// Report Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetReportResource(string reportName, CancellationToken cancellationToken = default) + { + return GetReportResources().Get(reportName, cancellationToken); + } + } +} diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 4aa288688b79f..0000000000000 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.AppComplianceAutomation -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ReportResources in the TenantResource. - /// An object representing collection of ReportResources and their operations over a ReportResource. - public virtual ReportResourceCollection GetReportResources() - { - return GetCachedClient(Client => new ReportResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResource.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResource.cs index ef8c111c5c9ed..1540b981eebe6 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResource.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResource.cs @@ -27,6 +27,7 @@ namespace Azure.ResourceManager.AppComplianceAutomation public partial class ReportResource : ArmResource { /// Generate the resource identifier of a instance. + /// The reportName. public static ResourceIdentifier CreateResourceIdentifier(string reportName) { var resourceId = $"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}"; @@ -92,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SnapshotResources and their operations over a SnapshotResource. public virtual SnapshotResourceCollection GetSnapshotResources() { - return GetCachedClient(Client => new SnapshotResourceCollection(Client, Id)); + return GetCachedClient(client => new SnapshotResourceCollection(client, Id)); } /// @@ -110,8 +111,8 @@ public virtual SnapshotResourceCollection GetSnapshotResources() /// /// Snapshot Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSnapshotResourceAsync(string snapshotName, CancellationToken cancellationToken = default) { @@ -133,8 +134,8 @@ public virtual async Task> GetSnapshotResourceAsync(s /// /// Snapshot Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSnapshotResource(string snapshotName, CancellationToken cancellationToken = default) { diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResource.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResource.cs index d4432922f0564..e10275745adca 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResource.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/SnapshotResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.AppComplianceAutomation public partial class SnapshotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The reportName. + /// The snapshotName. public static ResourceIdentifier CreateResourceIdentifier(string reportName, string snapshotName) { var resourceId = $"/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/snapshots/{snapshotName}"; diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/api/Azure.ResourceManager.AppConfiguration.netstandard2.0.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/api/Azure.ResourceManager.AppConfiguration.netstandard2.0.cs index b94a686678c22..3933f8c0ce52f 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/api/Azure.ResourceManager.AppConfiguration.netstandard2.0.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/api/Azure.ResourceManager.AppConfiguration.netstandard2.0.cs @@ -156,7 +156,7 @@ protected AppConfigurationStoreCollection() { } } public partial class AppConfigurationStoreData : Azure.ResourceManager.Models.TrackedResourceData { - public AppConfigurationStoreData(Azure.Core.AzureLocation location, Azure.ResourceManager.AppConfiguration.Models.AppConfigurationSku sku) : base (default(Azure.Core.AzureLocation)) { } + public AppConfigurationStoreData(Azure.Core.AzureLocation location, Azure.ResourceManager.AppConfiguration.Models.AppConfigurationSku sku) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.AppConfiguration.Models.AppConfigurationCreateMode? CreateMode { get { throw null; } set { } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -259,6 +259,36 @@ protected DeletedAppConfigurationStoreResource() { } public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.AppConfiguration.Mocking +{ + public partial class MockableAppConfigurationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAppConfigurationArmClient() { } + public virtual Azure.ResourceManager.AppConfiguration.AppConfigurationKeyValueResource GetAppConfigurationKeyValueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppConfiguration.AppConfigurationPrivateEndpointConnectionResource GetAppConfigurationPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppConfiguration.AppConfigurationPrivateLinkResource GetAppConfigurationPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppConfiguration.AppConfigurationStoreResource GetAppConfigurationStoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppConfiguration.DeletedAppConfigurationStoreResource GetDeletedAppConfigurationStoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAppConfigurationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAppConfigurationResourceGroupResource() { } + public virtual Azure.Response GetAppConfigurationStore(string configStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppConfigurationStoreAsync(string configStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppConfiguration.AppConfigurationStoreCollection GetAppConfigurationStores() { throw null; } + } + public partial class MockableAppConfigurationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAppConfigurationSubscriptionResource() { } + public virtual Azure.Response CheckAppConfigurationNameAvailability(Azure.ResourceManager.AppConfiguration.Models.AppConfigurationNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckAppConfigurationNameAvailabilityAsync(Azure.ResourceManager.AppConfiguration.Models.AppConfigurationNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppConfigurationStores(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppConfigurationStoresAsync(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeletedAppConfigurationStore(Azure.Core.AzureLocation location, string configStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeletedAppConfigurationStoreAsync(Azure.Core.AzureLocation location, string configStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppConfiguration.DeletedAppConfigurationStoreCollection GetDeletedAppConfigurationStores() { throw null; } + } +} namespace Azure.ResourceManager.AppConfiguration.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueResource.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueResource.cs index 4c798095448bf..5ea981621342c 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueResource.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationKeyValueResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppConfiguration public partial class AppConfigurationKeyValueResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The configStoreName. + /// The keyValueName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configStoreName, string keyValueName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"; diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionResource.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionResource.cs index 6c5b3e88f2d0a..32c1dcdf1849f 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionResource.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppConfiguration public partial class AppConfigurationPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The configStoreName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configStoreName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResource.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResource.cs index 093910b63b8b1..3d655b9502c8a 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResource.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppConfiguration public partial class AppConfigurationPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The configStoreName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configStoreName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"; diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreResource.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreResource.cs index f8e89f86a9ec4..c5745f2cbafb9 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreResource.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.AppConfiguration public partial class AppConfigurationStoreResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The configStoreName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configStoreName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppConfigurationPrivateEndpointConnectionResources and their operations over a AppConfigurationPrivateEndpointConnectionResource. public virtual AppConfigurationPrivateEndpointConnectionCollection GetAppConfigurationPrivateEndpointConnections() { - return GetCachedClient(Client => new AppConfigurationPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new AppConfigurationPrivateEndpointConnectionCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual AppConfigurationPrivateEndpointConnectionCollection GetAppConfigu /// /// Private endpoint connection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppConfigurationPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task /// Private endpoint connection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppConfigurationPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -147,7 +150,7 @@ public virtual Response GetAp /// An object representing collection of AppConfigurationPrivateLinkResources and their operations over a AppConfigurationPrivateLinkResource. public virtual AppConfigurationPrivateLinkResourceCollection GetAppConfigurationPrivateLinkResources() { - return GetCachedClient(Client => new AppConfigurationPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new AppConfigurationPrivateLinkResourceCollection(client, Id)); } /// @@ -165,8 +168,8 @@ public virtual AppConfigurationPrivateLinkResourceCollection GetAppConfiguration /// /// The name of the private link resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppConfigurationPrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -188,8 +191,8 @@ public virtual async Task> GetAppC /// /// The name of the private link resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppConfigurationPrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -200,7 +203,7 @@ public virtual Response GetAppConfiguration /// An object representing collection of AppConfigurationKeyValueResources and their operations over a AppConfigurationKeyValueResource. public virtual AppConfigurationKeyValueCollection GetAppConfigurationKeyValues() { - return GetCachedClient(Client => new AppConfigurationKeyValueCollection(Client, Id)); + return GetCachedClient(client => new AppConfigurationKeyValueCollection(client, Id)); } /// @@ -218,8 +221,8 @@ public virtual AppConfigurationKeyValueCollection GetAppConfigurationKeyValues() /// /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppConfigurationKeyValueAsync(string keyValueName, CancellationToken cancellationToken = default) { @@ -241,8 +244,8 @@ public virtual async Task> GetAppConf /// /// Identifier of key and label combination. Key and label are joined by $ character. Label is optional. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppConfigurationKeyValue(string keyValueName, CancellationToken cancellationToken = default) { diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreResource.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreResource.cs index 4f792de26791d..2d7c78680c11f 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreResource.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/DeletedAppConfigurationStoreResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.AppConfiguration public partial class DeletedAppConfigurationStoreResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The configStoreName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string configStoreName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"; diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/AppConfigurationExtensions.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/AppConfigurationExtensions.cs index 19bdec3a69ecb..4296c8d3be261 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/AppConfigurationExtensions.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/AppConfigurationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.AppConfiguration.Mocking; using Azure.ResourceManager.AppConfiguration.Models; using Azure.ResourceManager.Resources; @@ -19,138 +20,113 @@ namespace Azure.ResourceManager.AppConfiguration /// A class to add extension methods to Azure.ResourceManager.AppConfiguration. public static partial class AppConfigurationExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAppConfigurationArmClient GetMockableAppConfigurationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAppConfigurationArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAppConfigurationResourceGroupResource GetMockableAppConfigurationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAppConfigurationResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAppConfigurationSubscriptionResource GetMockableAppConfigurationSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAppConfigurationSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AppConfigurationStoreResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppConfigurationStoreResource GetAppConfigurationStoreResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppConfigurationStoreResource.ValidateResourceId(id); - return new AppConfigurationStoreResource(client, id); - } - ); + return GetMockableAppConfigurationArmClient(client).GetAppConfigurationStoreResource(id); } - #endregion - #region DeletedAppConfigurationStoreResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeletedAppConfigurationStoreResource GetDeletedAppConfigurationStoreResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeletedAppConfigurationStoreResource.ValidateResourceId(id); - return new DeletedAppConfigurationStoreResource(client, id); - } - ); + return GetMockableAppConfigurationArmClient(client).GetDeletedAppConfigurationStoreResource(id); } - #endregion - #region AppConfigurationPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppConfigurationPrivateEndpointConnectionResource GetAppConfigurationPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppConfigurationPrivateEndpointConnectionResource.ValidateResourceId(id); - return new AppConfigurationPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableAppConfigurationArmClient(client).GetAppConfigurationPrivateEndpointConnectionResource(id); } - #endregion - #region AppConfigurationPrivateLinkResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppConfigurationPrivateLinkResource GetAppConfigurationPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppConfigurationPrivateLinkResource.ValidateResourceId(id); - return new AppConfigurationPrivateLinkResource(client, id); - } - ); + return GetMockableAppConfigurationArmClient(client).GetAppConfigurationPrivateLinkResource(id); } - #endregion - #region AppConfigurationKeyValueResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppConfigurationKeyValueResource GetAppConfigurationKeyValueResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppConfigurationKeyValueResource.ValidateResourceId(id); - return new AppConfigurationKeyValueResource(client, id); - } - ); + return GetMockableAppConfigurationArmClient(client).GetAppConfigurationKeyValueResource(id); } - #endregion - /// Gets a collection of AppConfigurationStoreResources in the ResourceGroupResource. + /// + /// Gets a collection of AppConfigurationStoreResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AppConfigurationStoreResources and their operations over a AppConfigurationStoreResource. public static AppConfigurationStoreCollection GetAppConfigurationStores(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAppConfigurationStores(); + return GetMockableAppConfigurationResourceGroupResource(resourceGroupResource).GetAppConfigurationStores(); } /// @@ -165,16 +141,20 @@ public static AppConfigurationStoreCollection GetAppConfigurationStores(this Res /// ConfigurationStores_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the configuration store. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAppConfigurationStoreAsync(this ResourceGroupResource resourceGroupResource, string configStoreName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAppConfigurationStores().GetAsync(configStoreName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppConfigurationResourceGroupResource(resourceGroupResource).GetAppConfigurationStoreAsync(configStoreName, cancellationToken).ConfigureAwait(false); } /// @@ -189,24 +169,34 @@ public static async Task> GetAppConfigur /// ConfigurationStores_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the configuration store. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAppConfigurationStore(this ResourceGroupResource resourceGroupResource, string configStoreName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAppConfigurationStores().Get(configStoreName, cancellationToken); + return GetMockableAppConfigurationResourceGroupResource(resourceGroupResource).GetAppConfigurationStore(configStoreName, cancellationToken); } - /// Gets a collection of DeletedAppConfigurationStoreResources in the SubscriptionResource. + /// + /// Gets a collection of DeletedAppConfigurationStoreResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DeletedAppConfigurationStoreResources and their operations over a DeletedAppConfigurationStoreResource. public static DeletedAppConfigurationStoreCollection GetDeletedAppConfigurationStores(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedAppConfigurationStores(); + return GetMockableAppConfigurationSubscriptionResource(subscriptionResource).GetDeletedAppConfigurationStores(); } /// @@ -221,17 +211,21 @@ public static DeletedAppConfigurationStoreCollection GetDeletedAppConfigurationS /// ConfigurationStores_GetDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location in which uniqueness will be verified. /// The name of the configuration store. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDeletedAppConfigurationStoreAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string configStoreName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetDeletedAppConfigurationStores().GetAsync(location, configStoreName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppConfigurationSubscriptionResource(subscriptionResource).GetDeletedAppConfigurationStoreAsync(location, configStoreName, cancellationToken).ConfigureAwait(false); } /// @@ -246,17 +240,21 @@ public static async Task> GetDele /// ConfigurationStores_GetDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location in which uniqueness will be verified. /// The name of the configuration store. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDeletedAppConfigurationStore(this SubscriptionResource subscriptionResource, AzureLocation location, string configStoreName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetDeletedAppConfigurationStores().Get(location, configStoreName, cancellationToken); + return GetMockableAppConfigurationSubscriptionResource(subscriptionResource).GetDeletedAppConfigurationStore(location, configStoreName, cancellationToken); } /// @@ -271,6 +269,10 @@ public static Response GetDeletedAppConfig /// ConfigurationStores_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. @@ -278,7 +280,7 @@ public static Response GetDeletedAppConfig /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAppConfigurationStoresAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppConfigurationStoresAsync(skipToken, cancellationToken); + return GetMockableAppConfigurationSubscriptionResource(subscriptionResource).GetAppConfigurationStoresAsync(skipToken, cancellationToken); } /// @@ -293,6 +295,10 @@ public static AsyncPageable GetAppConfigurationSt /// ConfigurationStores_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. @@ -300,7 +306,7 @@ public static AsyncPageable GetAppConfigurationSt /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAppConfigurationStores(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppConfigurationStores(skipToken, cancellationToken); + return GetMockableAppConfigurationSubscriptionResource(subscriptionResource).GetAppConfigurationStores(skipToken, cancellationToken); } /// @@ -315,6 +321,10 @@ public static Pageable GetAppConfigurationStores( /// CheckAppConfigurationNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The object containing information for the availability request. @@ -322,9 +332,7 @@ public static Pageable GetAppConfigurationStores( /// is null. public static async Task> CheckAppConfigurationNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AppConfigurationNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAppConfigurationNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableAppConfigurationSubscriptionResource(subscriptionResource).CheckAppConfigurationNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -339,6 +347,10 @@ public static async Task> Check /// CheckAppConfigurationNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The object containing information for the availability request. @@ -346,9 +358,7 @@ public static async Task> Check /// is null. public static Response CheckAppConfigurationNameAvailability(this SubscriptionResource subscriptionResource, AppConfigurationNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAppConfigurationNameAvailability(content, cancellationToken); + return GetMockableAppConfigurationSubscriptionResource(subscriptionResource).CheckAppConfigurationNameAvailability(content, cancellationToken); } } } diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationArmClient.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationArmClient.cs new file mode 100644 index 0000000000000..6b917ed5dacc2 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.AppConfiguration; + +namespace Azure.ResourceManager.AppConfiguration.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAppConfigurationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppConfigurationArmClient() + { + } + + /// 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 MockableAppConfigurationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAppConfigurationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppConfigurationStoreResource GetAppConfigurationStoreResource(ResourceIdentifier id) + { + AppConfigurationStoreResource.ValidateResourceId(id); + return new AppConfigurationStoreResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeletedAppConfigurationStoreResource GetDeletedAppConfigurationStoreResource(ResourceIdentifier id) + { + DeletedAppConfigurationStoreResource.ValidateResourceId(id); + return new DeletedAppConfigurationStoreResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppConfigurationPrivateEndpointConnectionResource GetAppConfigurationPrivateEndpointConnectionResource(ResourceIdentifier id) + { + AppConfigurationPrivateEndpointConnectionResource.ValidateResourceId(id); + return new AppConfigurationPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppConfigurationPrivateLinkResource GetAppConfigurationPrivateLinkResource(ResourceIdentifier id) + { + AppConfigurationPrivateLinkResource.ValidateResourceId(id); + return new AppConfigurationPrivateLinkResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppConfigurationKeyValueResource GetAppConfigurationKeyValueResource(ResourceIdentifier id) + { + AppConfigurationKeyValueResource.ValidateResourceId(id); + return new AppConfigurationKeyValueResource(Client, id); + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationResourceGroupResource.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationResourceGroupResource.cs new file mode 100644 index 0000000000000..2e46c36ff4185 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.AppConfiguration; + +namespace Azure.ResourceManager.AppConfiguration.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAppConfigurationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppConfigurationResourceGroupResource() + { + } + + /// 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 MockableAppConfigurationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AppConfigurationStoreResources in the ResourceGroupResource. + /// An object representing collection of AppConfigurationStoreResources and their operations over a AppConfigurationStoreResource. + public virtual AppConfigurationStoreCollection GetAppConfigurationStores() + { + return GetCachedClient(client => new AppConfigurationStoreCollection(client, Id)); + } + + /// + /// Gets the properties of the specified configuration store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName} + /// + /// + /// Operation Id + /// ConfigurationStores_Get + /// + /// + /// + /// The name of the configuration store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAppConfigurationStoreAsync(string configStoreName, CancellationToken cancellationToken = default) + { + return await GetAppConfigurationStores().GetAsync(configStoreName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of the specified configuration store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName} + /// + /// + /// Operation Id + /// ConfigurationStores_Get + /// + /// + /// + /// The name of the configuration store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAppConfigurationStore(string configStoreName, CancellationToken cancellationToken = default) + { + return GetAppConfigurationStores().Get(configStoreName, cancellationToken); + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationSubscriptionResource.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationSubscriptionResource.cs new file mode 100644 index 0000000000000..78b1a43fd7776 --- /dev/null +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/MockableAppConfigurationSubscriptionResource.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppConfiguration; +using Azure.ResourceManager.AppConfiguration.Models; + +namespace Azure.ResourceManager.AppConfiguration.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAppConfigurationSubscriptionResource : ArmResource + { + private ClientDiagnostics _appConfigurationStoreConfigurationStoresClientDiagnostics; + private ConfigurationStoresRestOperations _appConfigurationStoreConfigurationStoresRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private AppConfigurationManagementRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAppConfigurationSubscriptionResource() + { + } + + /// 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 MockableAppConfigurationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AppConfigurationStoreConfigurationStoresClientDiagnostics => _appConfigurationStoreConfigurationStoresClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppConfiguration", AppConfigurationStoreResource.ResourceType.Namespace, Diagnostics); + private ConfigurationStoresRestOperations AppConfigurationStoreConfigurationStoresRestClient => _appConfigurationStoreConfigurationStoresRestClient ??= new ConfigurationStoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppConfigurationStoreResource.ResourceType)); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppConfiguration", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AppConfigurationManagementRestOperations DefaultRestClient => _defaultRestClient ??= new AppConfigurationManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DeletedAppConfigurationStoreResources in the SubscriptionResource. + /// An object representing collection of DeletedAppConfigurationStoreResources and their operations over a DeletedAppConfigurationStoreResource. + public virtual DeletedAppConfigurationStoreCollection GetDeletedAppConfigurationStores() + { + return GetCachedClient(client => new DeletedAppConfigurationStoreCollection(client, Id)); + } + + /// + /// Gets a deleted Azure app configuration store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName} + /// + /// + /// Operation Id + /// ConfigurationStores_GetDeleted + /// + /// + /// + /// The location in which uniqueness will be verified. + /// The name of the configuration store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeletedAppConfigurationStoreAsync(AzureLocation location, string configStoreName, CancellationToken cancellationToken = default) + { + return await GetDeletedAppConfigurationStores().GetAsync(location, configStoreName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deleted Azure app configuration store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName} + /// + /// + /// Operation Id + /// ConfigurationStores_GetDeleted + /// + /// + /// + /// The location in which uniqueness will be verified. + /// The name of the configuration store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeletedAppConfigurationStore(AzureLocation location, string configStoreName, CancellationToken cancellationToken = default) + { + return GetDeletedAppConfigurationStores().Get(location, configStoreName, cancellationToken); + } + + /// + /// Lists the configuration stores for a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores + /// + /// + /// Operation Id + /// ConfigurationStores_List + /// + /// + /// + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppConfigurationStoresAsync(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppConfigurationStoreConfigurationStoresRestClient.CreateListRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppConfigurationStoreConfigurationStoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), AppConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "MockableAppConfigurationSubscriptionResource.GetAppConfigurationStores", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the configuration stores for a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores + /// + /// + /// Operation Id + /// ConfigurationStores_List + /// + /// + /// + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppConfigurationStores(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppConfigurationStoreConfigurationStoresRestClient.CreateListRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppConfigurationStoreConfigurationStoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), AppConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "MockableAppConfigurationSubscriptionResource.GetAppConfigurationStores", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether the configuration store name is available for use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability + /// + /// + /// Operation Id + /// CheckAppConfigurationNameAvailability + /// + /// + /// + /// The object containing information for the availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckAppConfigurationNameAvailabilityAsync(AppConfigurationNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppConfigurationSubscriptionResource.CheckAppConfigurationNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckAppConfigurationNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the configuration store name is available for use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability + /// + /// + /// Operation Id + /// CheckAppConfigurationNameAvailability + /// + /// + /// + /// The object containing information for the availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckAppConfigurationNameAvailability(AppConfigurationNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppConfigurationSubscriptionResource.CheckAppConfigurationNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckAppConfigurationNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index aeccdc3ce25de..0000000000000 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.AppConfiguration -{ - /// 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 AppConfigurationStoreResources in the ResourceGroupResource. - /// An object representing collection of AppConfigurationStoreResources and their operations over a AppConfigurationStoreResource. - public virtual AppConfigurationStoreCollection GetAppConfigurationStores() - { - return GetCachedClient(Client => new AppConfigurationStoreCollection(Client, Id)); - } - } -} diff --git a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 38b913e098b69..0000000000000 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppConfiguration.Models; - -namespace Azure.ResourceManager.AppConfiguration -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _appConfigurationStoreConfigurationStoresClientDiagnostics; - private ConfigurationStoresRestOperations _appConfigurationStoreConfigurationStoresRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private AppConfigurationManagementRestOperations _defaultRestClient; - - /// 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 AppConfigurationStoreConfigurationStoresClientDiagnostics => _appConfigurationStoreConfigurationStoresClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppConfiguration", AppConfigurationStoreResource.ResourceType.Namespace, Diagnostics); - private ConfigurationStoresRestOperations AppConfigurationStoreConfigurationStoresRestClient => _appConfigurationStoreConfigurationStoresRestClient ??= new ConfigurationStoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppConfigurationStoreResource.ResourceType)); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppConfiguration", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AppConfigurationManagementRestOperations DefaultRestClient => _defaultRestClient ??= new AppConfigurationManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DeletedAppConfigurationStoreResources in the SubscriptionResource. - /// An object representing collection of DeletedAppConfigurationStoreResources and their operations over a DeletedAppConfigurationStoreResource. - public virtual DeletedAppConfigurationStoreCollection GetDeletedAppConfigurationStores() - { - return GetCachedClient(Client => new DeletedAppConfigurationStoreCollection(Client, Id)); - } - - /// - /// Lists the configuration stores for a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores - /// - /// - /// Operation Id - /// ConfigurationStores_List - /// - /// - /// - /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppConfigurationStoresAsync(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppConfigurationStoreConfigurationStoresRestClient.CreateListRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppConfigurationStoreConfigurationStoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), AppConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppConfigurationStores", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the configuration stores for a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores - /// - /// - /// Operation Id - /// ConfigurationStores_List - /// - /// - /// - /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppConfigurationStores(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppConfigurationStoreConfigurationStoresRestClient.CreateListRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppConfigurationStoreConfigurationStoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppConfigurationStoreResource(Client, AppConfigurationStoreData.DeserializeAppConfigurationStoreData(e)), AppConfigurationStoreConfigurationStoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppConfigurationStores", "value", "nextLink", cancellationToken); - } - - /// - /// Checks whether the configuration store name is available for use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability - /// - /// - /// Operation Id - /// CheckAppConfigurationNameAvailability - /// - /// - /// - /// The object containing information for the availability request. - /// The cancellation token to use. - public virtual async Task> CheckAppConfigurationNameAvailabilityAsync(AppConfigurationNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAppConfigurationNameAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckAppConfigurationNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether the configuration store name is available for use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability - /// - /// - /// Operation Id - /// CheckAppConfigurationNameAvailability - /// - /// - /// - /// The object containing information for the availability request. - /// The cancellation token to use. - public virtual Response CheckAppConfigurationNameAvailability(AppConfigurationNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAppConfigurationNameAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckAppConfigurationNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/Azure.ResourceManager.ApplicationInsights.sln b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/Azure.ResourceManager.ApplicationInsights.sln index f851ddc87af28..3d48fbf0e7ec9 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/Azure.ResourceManager.ApplicationInsights.sln +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/Azure.ResourceManager.ApplicationInsights.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{CC2251C1-B552-4C6E-88DA-91AC17643DB4}") = "Azure.ResourceManager.ApplicationInsights", "src\Azure.ResourceManager.ApplicationInsights.csproj", "{D9D99296-1A5B-49B9-8E2F-F2CCB794BF5F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ApplicationInsights", "src\Azure.ResourceManager.ApplicationInsights.csproj", "{D9D99296-1A5B-49B9-8E2F-F2CCB794BF5F}" EndProject -Project("{CC2251C1-B552-4C6E-88DA-91AC17643DB4}") = "Azure.ResourceManager.ApplicationInsights.Tests", "tests\Azure.ResourceManager.ApplicationInsights.Tests.csproj", "{954CE9EA-36B4-4CD0-ABEF-0FFCBA12B97C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ApplicationInsights.Tests", "tests\Azure.ResourceManager.ApplicationInsights.Tests.csproj", "{954CE9EA-36B4-4CD0-ABEF-0FFCBA12B97C}" EndProject -Project("{CC2251C1-B552-4C6E-88DA-91AC17643DB4}") = "Azure.ResourceManager.ApplicationInsights.Samples", "samples\Azure.ResourceManager.ApplicationInsights.Samples.csproj", "{BF224368-A419-4A9A-AE39-D2649E28978D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ApplicationInsights.Samples", "samples\Azure.ResourceManager.ApplicationInsights.Samples.csproj", "{BF224368-A419-4A9A-AE39-D2649E28978D}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8CF2BAA0-C4E3-4A74-9B63-21F74F284092} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {954CE9EA-36B4-4CD0-ABEF-0FFCBA12B97C}.Release|x64.Build.0 = Release|Any CPU {954CE9EA-36B4-4CD0-ABEF-0FFCBA12B97C}.Release|x86.ActiveCfg = Release|Any CPU {954CE9EA-36B4-4CD0-ABEF-0FFCBA12B97C}.Release|x86.Build.0 = Release|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Debug|x64.ActiveCfg = Debug|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Debug|x64.Build.0 = Debug|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Debug|x86.ActiveCfg = Debug|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Debug|x86.Build.0 = Debug|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Release|Any CPU.Build.0 = Release|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Release|x64.ActiveCfg = Release|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Release|x64.Build.0 = Release|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Release|x86.ActiveCfg = Release|Any CPU + {BF224368-A419-4A9A-AE39-D2649E28978D}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8CF2BAA0-C4E3-4A74-9B63-21F74F284092} EndGlobalSection EndGlobal diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/api/Azure.ResourceManager.ApplicationInsights.netstandard2.0.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/api/Azure.ResourceManager.ApplicationInsights.netstandard2.0.cs index a10ebbd8dc821..8dc3b2c66b4d7 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/api/Azure.ResourceManager.ApplicationInsights.netstandard2.0.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/api/Azure.ResourceManager.ApplicationInsights.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ApplicationInsightsComponentCollection() { } } public partial class ApplicationInsightsComponentData : Azure.ResourceManager.Models.TrackedResourceData { - public ApplicationInsightsComponentData(Azure.Core.AzureLocation location, string kind) : base (default(Azure.Core.AzureLocation)) { } + public ApplicationInsightsComponentData(Azure.Core.AzureLocation location, string kind) { } public string AppId { get { throw null; } } public string ApplicationId { get { throw null; } } public Azure.ResourceManager.ApplicationInsights.Models.ApplicationType? ApplicationType { get { throw null; } set { } } @@ -284,7 +284,7 @@ protected WebTestCollection() { } } public partial class WebTestData : Azure.ResourceManager.Models.TrackedResourceData { - public WebTestData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public WebTestData(Azure.Core.AzureLocation location) { } public string Description { get { throw null; } set { } } public int? FrequencyInSeconds { get { throw null; } set { } } public bool? IsEnabled { get { throw null; } set { } } @@ -336,7 +336,7 @@ protected WorkbookCollection() { } } public partial class WorkbookData : Azure.ResourceManager.Models.TrackedResourceData { - public WorkbookData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public WorkbookData(Azure.Core.AzureLocation location) { } public string Category { get { throw null; } set { } } public string Description { get { throw null; } set { } } public string DisplayName { get { throw null; } set { } } @@ -418,7 +418,7 @@ protected WorkbookTemplateCollection() { } } public partial class WorkbookTemplateData : Azure.ResourceManager.Models.TrackedResourceData { - public WorkbookTemplateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public WorkbookTemplateData(Azure.Core.AzureLocation location) { } public string Author { get { throw null; } set { } } public System.Collections.Generic.IList Galleries { get { throw null; } } public System.Collections.Generic.IDictionary> LocalizedGalleries { get { throw null; } } @@ -446,6 +446,53 @@ protected WorkbookTemplateResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.ApplicationInsights.Models.WorkbookTemplatePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ApplicationInsights.Mocking +{ + public partial class MockableApplicationInsightsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableApplicationInsightsArmClient() { } + public virtual Azure.ResourceManager.ApplicationInsights.ApplicationInsightsComponentResource GetApplicationInsightsComponentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.ComponentLinkedStorageAccountResource GetComponentLinkedStorageAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetLiveToken(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLiveTokenAsync(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.MyWorkbookResource GetMyWorkbookResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.WebTestResource GetWebTestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.WorkbookResource GetWorkbookResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.WorkbookRevisionResource GetWorkbookRevisionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.WorkbookTemplateResource GetWorkbookTemplateResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableApplicationInsightsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableApplicationInsightsResourceGroupResource() { } + public virtual Azure.Response GetApplicationInsightsComponent(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApplicationInsightsComponentAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.ApplicationInsightsComponentCollection GetApplicationInsightsComponents() { throw null; } + public virtual Azure.Response GetMyWorkbook(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMyWorkbookAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.MyWorkbookCollection GetMyWorkbooks() { throw null; } + public virtual Azure.Response GetWebTest(string webTestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWebTestAsync(string webTestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.WebTestCollection GetWebTests() { throw null; } + public virtual Azure.Response GetWorkbook(string resourceName, bool? canFetchContent = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWorkbookAsync(string resourceName, bool? canFetchContent = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.WorkbookCollection GetWorkbooks() { throw null; } + public virtual Azure.Response GetWorkbookTemplate(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWorkbookTemplateAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ApplicationInsights.WorkbookTemplateCollection GetWorkbookTemplates() { throw null; } + } + public partial class MockableApplicationInsightsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableApplicationInsightsSubscriptionResource() { } + public virtual Azure.Pageable GetApplicationInsightsComponents(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApplicationInsightsComponentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMyWorkbooks(Azure.ResourceManager.ApplicationInsights.Models.CategoryType category, System.Collections.Generic.IEnumerable tags = null, bool? canFetchContent = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMyWorkbooksAsync(Azure.ResourceManager.ApplicationInsights.Models.CategoryType category, System.Collections.Generic.IEnumerable tags = null, bool? canFetchContent = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWebTests(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWebTestsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWorkbooks(Azure.ResourceManager.ApplicationInsights.Models.CategoryType category, System.Collections.Generic.IEnumerable tags = null, bool? canFetchContent = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWorkbooksAsync(Azure.ResourceManager.ApplicationInsights.Models.CategoryType category, System.Collections.Generic.IEnumerable tags = null, bool? canFetchContent = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ApplicationInsights.Models { public partial class Annotation diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs index cf8e7b14dbbc2..f91a65c0ba728 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ApplicationInsights public partial class ApplicationInsightsComponentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}"; @@ -147,7 +150,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ComponentLinkedStorageAccountResources and their operations over a ComponentLinkedStorageAccountResource. public virtual ComponentLinkedStorageAccountCollection GetComponentLinkedStorageAccounts() { - return GetCachedClient(Client => new ComponentLinkedStorageAccountCollection(Client, Id)); + return GetCachedClient(client => new ComponentLinkedStorageAccountCollection(client, Id)); } /// diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountResource.cs index 6ff46ee1b5fce..24a8e1cffa325 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ComponentLinkedStorageAccountResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ApplicationInsights public partial class ComponentLinkedStorageAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The storageType. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, StorageType storageType) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}"; diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ApplicationInsightsExtensions.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ApplicationInsightsExtensions.cs index d6ac02a73524a..02a132ccd0e6c 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ApplicationInsightsExtensions.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ApplicationInsightsExtensions.cs @@ -12,6 +12,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ApplicationInsights.Mocking; using Azure.ResourceManager.ApplicationInsights.Models; using Azure.ResourceManager.Resources; @@ -20,234 +21,195 @@ namespace Azure.ResourceManager.ApplicationInsights /// A class to add extension methods to Azure.ResourceManager.ApplicationInsights. public static partial class ApplicationInsightsExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableApplicationInsightsArmClient GetMockableApplicationInsightsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableApplicationInsightsArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableApplicationInsightsResourceGroupResource GetMockableApplicationInsightsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableApplicationInsightsResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableApplicationInsightsSubscriptionResource GetMockableApplicationInsightsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableApplicationInsightsSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + /// + /// **Gets an access token for live metrics stream data.** + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/generatelivetoken + /// + /// + /// Operation Id + /// LiveToken_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The cancellation token to use. + public static async Task> GetLiveTokenAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return await GetMockableApplicationInsightsArmClient(client).GetLiveTokenAsync(scope, cancellationToken).ConfigureAwait(false); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + /// + /// **Gets an access token for live metrics stream data.** + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/generatelivetoken + /// + /// + /// Operation Id + /// LiveToken_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The cancellation token to use. + public static Response GetLiveToken(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return GetMockableApplicationInsightsArmClient(client).GetLiveToken(scope, cancellationToken); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ApplicationInsightsComponentResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApplicationInsightsComponentResource GetApplicationInsightsComponentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApplicationInsightsComponentResource.ValidateResourceId(id); - return new ApplicationInsightsComponentResource(client, id); - } - ); + return GetMockableApplicationInsightsArmClient(client).GetApplicationInsightsComponentResource(id); } - #endregion - #region WebTestResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebTestResource GetWebTestResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebTestResource.ValidateResourceId(id); - return new WebTestResource(client, id); - } - ); + return GetMockableApplicationInsightsArmClient(client).GetWebTestResource(id); } - #endregion - #region WorkbookTemplateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkbookTemplateResource GetWorkbookTemplateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkbookTemplateResource.ValidateResourceId(id); - return new WorkbookTemplateResource(client, id); - } - ); + return GetMockableApplicationInsightsArmClient(client).GetWorkbookTemplateResource(id); } - #endregion - #region MyWorkbookResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MyWorkbookResource GetMyWorkbookResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MyWorkbookResource.ValidateResourceId(id); - return new MyWorkbookResource(client, id); - } - ); + return GetMockableApplicationInsightsArmClient(client).GetMyWorkbookResource(id); } - #endregion - #region WorkbookResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkbookResource GetWorkbookResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkbookResource.ValidateResourceId(id); - return new WorkbookResource(client, id); - } - ); + return GetMockableApplicationInsightsArmClient(client).GetWorkbookResource(id); } - #endregion - #region WorkbookRevisionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkbookRevisionResource GetWorkbookRevisionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkbookRevisionResource.ValidateResourceId(id); - return new WorkbookRevisionResource(client, id); - } - ); + return GetMockableApplicationInsightsArmClient(client).GetWorkbookRevisionResource(id); } - #endregion - #region ComponentLinkedStorageAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ComponentLinkedStorageAccountResource GetComponentLinkedStorageAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ComponentLinkedStorageAccountResource.ValidateResourceId(id); - return new ComponentLinkedStorageAccountResource(client, id); - } - ); - } - #endregion - - /// - /// **Gets an access token for live metrics stream data.** - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/generatelivetoken - /// - /// - /// Operation Id - /// LiveToken_Get - /// - /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The cancellation token to use. - public static async Task> GetLiveTokenAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) - { - return await GetArmResourceExtensionClient(client, scope).GetLiveTokenAsync(cancellationToken).ConfigureAwait(false); + return GetMockableApplicationInsightsArmClient(client).GetComponentLinkedStorageAccountResource(id); } /// - /// **Gets an access token for live metrics stream data.** - /// + /// Gets a collection of ApplicationInsightsComponentResources in the ResourceGroupResource. /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/generatelivetoken - /// - /// - /// Operation Id - /// LiveToken_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The cancellation token to use. - public static Response GetLiveToken(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) - { - return GetArmResourceExtensionClient(client, scope).GetLiveToken(cancellationToken); - } - - /// Gets a collection of ApplicationInsightsComponentResources in the ResourceGroupResource. /// The instance the method will execute against. /// An object representing collection of ApplicationInsightsComponentResources and their operations over a ApplicationInsightsComponentResource. public static ApplicationInsightsComponentCollection GetApplicationInsightsComponents(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplicationInsightsComponents(); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetApplicationInsightsComponents(); } /// @@ -262,16 +224,20 @@ public static ApplicationInsightsComponentCollection GetApplicationInsightsCompo /// Components_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Application Insights component resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetApplicationInsightsComponentAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetApplicationInsightsComponents().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetApplicationInsightsComponentAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -286,24 +252,34 @@ public static async Task> GetAppl /// Components_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Application Insights component resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetApplicationInsightsComponent(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetApplicationInsightsComponents().Get(resourceName, cancellationToken); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetApplicationInsightsComponent(resourceName, cancellationToken); } - /// Gets a collection of WebTestResources in the ResourceGroupResource. + /// + /// Gets a collection of WebTestResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of WebTestResources and their operations over a WebTestResource. public static WebTestCollection GetWebTests(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetWebTests(); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWebTests(); } /// @@ -318,16 +294,20 @@ public static WebTestCollection GetWebTests(this ResourceGroupResource resourceG /// WebTests_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Application Insights WebTest resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetWebTestAsync(this ResourceGroupResource resourceGroupResource, string webTestName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetWebTests().GetAsync(webTestName, cancellationToken).ConfigureAwait(false); + return await GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWebTestAsync(webTestName, cancellationToken).ConfigureAwait(false); } /// @@ -342,24 +322,34 @@ public static async Task> GetWebTestAsync(this Resourc /// WebTests_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Application Insights WebTest resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetWebTest(this ResourceGroupResource resourceGroupResource, string webTestName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetWebTests().Get(webTestName, cancellationToken); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWebTest(webTestName, cancellationToken); } - /// Gets a collection of WorkbookTemplateResources in the ResourceGroupResource. + /// + /// Gets a collection of WorkbookTemplateResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of WorkbookTemplateResources and their operations over a WorkbookTemplateResource. public static WorkbookTemplateCollection GetWorkbookTemplates(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetWorkbookTemplates(); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWorkbookTemplates(); } /// @@ -374,16 +364,20 @@ public static WorkbookTemplateCollection GetWorkbookTemplates(this ResourceGroup /// WorkbookTemplates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Application Insights component resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetWorkbookTemplateAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetWorkbookTemplates().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWorkbookTemplateAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -398,24 +392,34 @@ public static async Task> GetWorkbookTemplate /// WorkbookTemplates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Application Insights component resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetWorkbookTemplate(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetWorkbookTemplates().Get(resourceName, cancellationToken); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWorkbookTemplate(resourceName, cancellationToken); } - /// Gets a collection of MyWorkbookResources in the ResourceGroupResource. + /// + /// Gets a collection of MyWorkbookResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MyWorkbookResources and their operations over a MyWorkbookResource. public static MyWorkbookCollection GetMyWorkbooks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMyWorkbooks(); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetMyWorkbooks(); } /// @@ -430,16 +434,20 @@ public static MyWorkbookCollection GetMyWorkbooks(this ResourceGroupResource res /// MyWorkbooks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Application Insights component resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMyWorkbookAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMyWorkbooks().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetMyWorkbookAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -454,24 +462,34 @@ public static async Task> GetMyWorkbookAsync(this R /// MyWorkbooks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Application Insights component resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMyWorkbook(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMyWorkbooks().Get(resourceName, cancellationToken); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetMyWorkbook(resourceName, cancellationToken); } - /// Gets a collection of WorkbookResources in the ResourceGroupResource. + /// + /// Gets a collection of WorkbookResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of WorkbookResources and their operations over a WorkbookResource. public static WorkbookCollection GetWorkbooks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetWorkbooks(); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWorkbooks(); } /// @@ -486,17 +504,21 @@ public static WorkbookCollection GetWorkbooks(this ResourceGroupResource resourc /// Workbooks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetWorkbookAsync(this ResourceGroupResource resourceGroupResource, string resourceName, bool? canFetchContent = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetWorkbooks().GetAsync(resourceName, canFetchContent, cancellationToken).ConfigureAwait(false); + return await GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWorkbookAsync(resourceName, canFetchContent, cancellationToken).ConfigureAwait(false); } /// @@ -511,17 +533,21 @@ public static async Task> GetWorkbookAsync(this Resou /// Workbooks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetWorkbook(this ResourceGroupResource resourceGroupResource, string resourceName, bool? canFetchContent = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetWorkbooks().Get(resourceName, canFetchContent, cancellationToken); + return GetMockableApplicationInsightsResourceGroupResource(resourceGroupResource).GetWorkbook(resourceName, canFetchContent, cancellationToken); } /// @@ -536,13 +562,17 @@ public static Response GetWorkbook(this ResourceGroupResource /// Components_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApplicationInsightsComponentsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationInsightsComponentsAsync(cancellationToken); + return GetMockableApplicationInsightsSubscriptionResource(subscriptionResource).GetApplicationInsightsComponentsAsync(cancellationToken); } /// @@ -557,13 +587,17 @@ public static AsyncPageable GetApplication /// Components_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApplicationInsightsComponents(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationInsightsComponents(cancellationToken); + return GetMockableApplicationInsightsSubscriptionResource(subscriptionResource).GetApplicationInsightsComponents(cancellationToken); } /// @@ -578,13 +612,17 @@ public static Pageable GetApplicationInsig /// WebTests_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetWebTestsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWebTestsAsync(cancellationToken); + return GetMockableApplicationInsightsSubscriptionResource(subscriptionResource).GetWebTestsAsync(cancellationToken); } /// @@ -599,13 +637,17 @@ public static AsyncPageable GetWebTestsAsync(this SubscriptionR /// WebTests_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetWebTests(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWebTests(cancellationToken); + return GetMockableApplicationInsightsSubscriptionResource(subscriptionResource).GetWebTests(cancellationToken); } /// @@ -620,6 +662,10 @@ public static Pageable GetWebTests(this SubscriptionResource su /// MyWorkbooks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Category of workbook to return. @@ -629,7 +675,7 @@ public static Pageable GetWebTests(this SubscriptionResource su /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetMyWorkbooksAsync(this SubscriptionResource subscriptionResource, CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMyWorkbooksAsync(category, tags, canFetchContent, cancellationToken); + return GetMockableApplicationInsightsSubscriptionResource(subscriptionResource).GetMyWorkbooksAsync(category, tags, canFetchContent, cancellationToken); } /// @@ -644,6 +690,10 @@ public static AsyncPageable GetMyWorkbooksAsync(this Subscri /// MyWorkbooks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Category of workbook to return. @@ -653,7 +703,7 @@ public static AsyncPageable GetMyWorkbooksAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetMyWorkbooks(this SubscriptionResource subscriptionResource, CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMyWorkbooks(category, tags, canFetchContent, cancellationToken); + return GetMockableApplicationInsightsSubscriptionResource(subscriptionResource).GetMyWorkbooks(category, tags, canFetchContent, cancellationToken); } /// @@ -668,6 +718,10 @@ public static Pageable GetMyWorkbooks(this SubscriptionResou /// Workbooks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Category of workbook to return. @@ -677,7 +731,7 @@ public static Pageable GetMyWorkbooks(this SubscriptionResou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetWorkbooksAsync(this SubscriptionResource subscriptionResource, CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWorkbooksAsync(category, tags, canFetchContent, cancellationToken); + return GetMockableApplicationInsightsSubscriptionResource(subscriptionResource).GetWorkbooksAsync(category, tags, canFetchContent, cancellationToken); } /// @@ -692,6 +746,10 @@ public static AsyncPageable GetWorkbooksAsync(this Subscriptio /// Workbooks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Category of workbook to return. @@ -701,7 +759,7 @@ public static AsyncPageable GetWorkbooksAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetWorkbooks(this SubscriptionResource subscriptionResource, CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWorkbooks(category, tags, canFetchContent, cancellationToken); + return GetMockableApplicationInsightsSubscriptionResource(subscriptionResource).GetWorkbooks(category, tags, canFetchContent, cancellationToken); } } } diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 89c956e7f0763..0000000000000 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,106 +0,0 @@ -// 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; -using Azure.ResourceManager.ApplicationInsights.Models; - -namespace Azure.ResourceManager.ApplicationInsights -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _liveTokenClientDiagnostics; - private LiveTokenRestOperations _liveTokenRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics LiveTokenClientDiagnostics => _liveTokenClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LiveTokenRestOperations LiveTokenRestClient => _liveTokenRestClient ??= new LiveTokenRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// **Gets an access token for live metrics stream data.** - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/generatelivetoken - /// - /// - /// Operation Id - /// LiveToken_Get - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetLiveTokenAsync(CancellationToken cancellationToken = default) - { - using var scope = LiveTokenClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetLiveToken"); - scope.Start(); - try - { - var response = await LiveTokenRestClient.GetAsync(Id, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// **Gets an access token for live metrics stream data.** - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/generatelivetoken - /// - /// - /// Operation Id - /// LiveToken_Get - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetLiveToken(CancellationToken cancellationToken = default) - { - using var scope = LiveTokenClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetLiveToken"); - scope.Start(); - try - { - var response = LiveTokenRestClient.Get(Id, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsArmClient.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsArmClient.cs new file mode 100644 index 0000000000000..4b551627f9be5 --- /dev/null +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsArmClient.cs @@ -0,0 +1,196 @@ +// 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; +using Azure.ResourceManager.ApplicationInsights; +using Azure.ResourceManager.ApplicationInsights.Models; + +namespace Azure.ResourceManager.ApplicationInsights.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableApplicationInsightsArmClient : ArmResource + { + private ClientDiagnostics _liveTokenClientDiagnostics; + private LiveTokenRestOperations _liveTokenRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableApplicationInsightsArmClient() + { + } + + /// 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 MockableApplicationInsightsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableApplicationInsightsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics LiveTokenClientDiagnostics => _liveTokenClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LiveTokenRestOperations LiveTokenRestClient => _liveTokenRestClient ??= new LiveTokenRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// **Gets an access token for live metrics stream data.** + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/generatelivetoken + /// + /// + /// Operation Id + /// LiveToken_Get + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + public virtual async Task> GetLiveTokenAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + using var scope0 = LiveTokenClientDiagnostics.CreateScope("MockableApplicationInsightsArmClient.GetLiveToken"); + scope0.Start(); + try + { + var response = await LiveTokenRestClient.GetAsync(scope, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// **Gets an access token for live metrics stream data.** + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/generatelivetoken + /// + /// + /// Operation Id + /// LiveToken_Get + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + public virtual Response GetLiveToken(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + using var scope0 = LiveTokenClientDiagnostics.CreateScope("MockableApplicationInsightsArmClient.GetLiveToken"); + scope0.Start(); + try + { + var response = LiveTokenRestClient.Get(scope, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApplicationInsightsComponentResource GetApplicationInsightsComponentResource(ResourceIdentifier id) + { + ApplicationInsightsComponentResource.ValidateResourceId(id); + return new ApplicationInsightsComponentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebTestResource GetWebTestResource(ResourceIdentifier id) + { + WebTestResource.ValidateResourceId(id); + return new WebTestResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkbookTemplateResource GetWorkbookTemplateResource(ResourceIdentifier id) + { + WorkbookTemplateResource.ValidateResourceId(id); + return new WorkbookTemplateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MyWorkbookResource GetMyWorkbookResource(ResourceIdentifier id) + { + MyWorkbookResource.ValidateResourceId(id); + return new MyWorkbookResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkbookResource GetWorkbookResource(ResourceIdentifier id) + { + WorkbookResource.ValidateResourceId(id); + return new WorkbookResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkbookRevisionResource GetWorkbookRevisionResource(ResourceIdentifier id) + { + WorkbookRevisionResource.ValidateResourceId(id); + return new WorkbookRevisionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ComponentLinkedStorageAccountResource GetComponentLinkedStorageAccountResource(ResourceIdentifier id) + { + ComponentLinkedStorageAccountResource.ValidateResourceId(id); + return new ComponentLinkedStorageAccountResource(Client, id); + } + } +} diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsResourceGroupResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsResourceGroupResource.cs new file mode 100644 index 0000000000000..07a98a3f058c3 --- /dev/null +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsResourceGroupResource.cs @@ -0,0 +1,306 @@ +// 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.ApplicationInsights; + +namespace Azure.ResourceManager.ApplicationInsights.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableApplicationInsightsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableApplicationInsightsResourceGroupResource() + { + } + + /// 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 MockableApplicationInsightsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ApplicationInsightsComponentResources in the ResourceGroupResource. + /// An object representing collection of ApplicationInsightsComponentResources and their operations over a ApplicationInsightsComponentResource. + public virtual ApplicationInsightsComponentCollection GetApplicationInsightsComponents() + { + return GetCachedClient(client => new ApplicationInsightsComponentCollection(client, Id)); + } + + /// + /// Returns an Application Insights component. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetApplicationInsightsComponentAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetApplicationInsightsComponents().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns an Application Insights component. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetApplicationInsightsComponent(string resourceName, CancellationToken cancellationToken = default) + { + return GetApplicationInsightsComponents().Get(resourceName, cancellationToken); + } + + /// Gets a collection of WebTestResources in the ResourceGroupResource. + /// An object representing collection of WebTestResources and their operations over a WebTestResource. + public virtual WebTestCollection GetWebTests() + { + return GetCachedClient(client => new WebTestCollection(client, Id)); + } + + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName} + /// + /// + /// Operation Id + /// WebTests_Get + /// + /// + /// + /// The name of the Application Insights WebTest resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWebTestAsync(string webTestName, CancellationToken cancellationToken = default) + { + return await GetWebTests().GetAsync(webTestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName} + /// + /// + /// Operation Id + /// WebTests_Get + /// + /// + /// + /// The name of the Application Insights WebTest resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWebTest(string webTestName, CancellationToken cancellationToken = default) + { + return GetWebTests().Get(webTestName, cancellationToken); + } + + /// Gets a collection of WorkbookTemplateResources in the ResourceGroupResource. + /// An object representing collection of WorkbookTemplateResources and their operations over a WorkbookTemplateResource. + public virtual WorkbookTemplateCollection GetWorkbookTemplates() + { + return GetCachedClient(client => new WorkbookTemplateCollection(client, Id)); + } + + /// + /// Get a single workbook template by its resourceName. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName} + /// + /// + /// Operation Id + /// WorkbookTemplates_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWorkbookTemplateAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetWorkbookTemplates().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a single workbook template by its resourceName. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName} + /// + /// + /// Operation Id + /// WorkbookTemplates_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWorkbookTemplate(string resourceName, CancellationToken cancellationToken = default) + { + return GetWorkbookTemplates().Get(resourceName, cancellationToken); + } + + /// Gets a collection of MyWorkbookResources in the ResourceGroupResource. + /// An object representing collection of MyWorkbookResources and their operations over a MyWorkbookResource. + public virtual MyWorkbookCollection GetMyWorkbooks() + { + return GetCachedClient(client => new MyWorkbookCollection(client, Id)); + } + + /// + /// Get a single private workbook by its resourceName. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName} + /// + /// + /// Operation Id + /// MyWorkbooks_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMyWorkbookAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetMyWorkbooks().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a single private workbook by its resourceName. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName} + /// + /// + /// Operation Id + /// MyWorkbooks_Get + /// + /// + /// + /// The name of the Application Insights component resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMyWorkbook(string resourceName, CancellationToken cancellationToken = default) + { + return GetMyWorkbooks().Get(resourceName, cancellationToken); + } + + /// Gets a collection of WorkbookResources in the ResourceGroupResource. + /// An object representing collection of WorkbookResources and their operations over a WorkbookResource. + public virtual WorkbookCollection GetWorkbooks() + { + return GetCachedClient(client => new WorkbookCollection(client, Id)); + } + + /// + /// Get a single workbook by its resourceName. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName} + /// + /// + /// Operation Id + /// Workbooks_Get + /// + /// + /// + /// The name of the resource. + /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWorkbookAsync(string resourceName, bool? canFetchContent = null, CancellationToken cancellationToken = default) + { + return await GetWorkbooks().GetAsync(resourceName, canFetchContent, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a single workbook by its resourceName. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName} + /// + /// + /// Operation Id + /// Workbooks_Get + /// + /// + /// + /// The name of the resource. + /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWorkbook(string resourceName, bool? canFetchContent = null, CancellationToken cancellationToken = default) + { + return GetWorkbooks().Get(resourceName, canFetchContent, cancellationToken); + } + } +} diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsSubscriptionResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsSubscriptionResource.cs new file mode 100644 index 0000000000000..7ff44134dd1b8 --- /dev/null +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/MockableApplicationInsightsSubscriptionResource.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ApplicationInsights; +using Azure.ResourceManager.ApplicationInsights.Models; + +namespace Azure.ResourceManager.ApplicationInsights.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableApplicationInsightsSubscriptionResource : ArmResource + { + private ClientDiagnostics _applicationInsightsComponentComponentsClientDiagnostics; + private ComponentsRestOperations _applicationInsightsComponentComponentsRestClient; + private ClientDiagnostics _webTestClientDiagnostics; + private WebTestsRestOperations _webTestRestClient; + private ClientDiagnostics _myWorkbookClientDiagnostics; + private MyWorkbooksRestOperations _myWorkbookRestClient; + private ClientDiagnostics _workbookClientDiagnostics; + private WorkbooksRestOperations _workbookRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableApplicationInsightsSubscriptionResource() + { + } + + /// 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 MockableApplicationInsightsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ApplicationInsightsComponentComponentsClientDiagnostics => _applicationInsightsComponentComponentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", ApplicationInsightsComponentResource.ResourceType.Namespace, Diagnostics); + private ComponentsRestOperations ApplicationInsightsComponentComponentsRestClient => _applicationInsightsComponentComponentsRestClient ??= new ComponentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApplicationInsightsComponentResource.ResourceType)); + private ClientDiagnostics WebTestClientDiagnostics => _webTestClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", WebTestResource.ResourceType.Namespace, Diagnostics); + private WebTestsRestOperations WebTestRestClient => _webTestRestClient ??= new WebTestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WebTestResource.ResourceType)); + private ClientDiagnostics MyWorkbookClientDiagnostics => _myWorkbookClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", MyWorkbookResource.ResourceType.Namespace, Diagnostics); + private MyWorkbooksRestOperations MyWorkbookRestClient => _myWorkbookRestClient ??= new MyWorkbooksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MyWorkbookResource.ResourceType)); + private ClientDiagnostics WorkbookClientDiagnostics => _workbookClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", WorkbookResource.ResourceType.Namespace, Diagnostics); + private WorkbooksRestOperations WorkbookRestClient => _workbookRestClient ??= new WorkbooksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WorkbookResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/components + /// + /// + /// Operation Id + /// Components_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApplicationInsightsComponentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationInsightsComponentComponentsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationInsightsComponentComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), ApplicationInsightsComponentComponentsClientDiagnostics, Pipeline, "MockableApplicationInsightsSubscriptionResource.GetApplicationInsightsComponents", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/components + /// + /// + /// Operation Id + /// Components_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApplicationInsightsComponents(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationInsightsComponentComponentsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationInsightsComponentComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), ApplicationInsightsComponentComponentsClientDiagnostics, Pipeline, "MockableApplicationInsightsSubscriptionResource.GetApplicationInsightsComponents", "value", "nextLink", cancellationToken); + } + + /// + /// Get all Application Insights web test definitions for the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests + /// + /// + /// Operation Id + /// WebTests_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWebTestsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WebTestRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebTestRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), WebTestClientDiagnostics, Pipeline, "MockableApplicationInsightsSubscriptionResource.GetWebTests", "value", "nextLink", cancellationToken); + } + + /// + /// Get all Application Insights web test definitions for the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests + /// + /// + /// Operation Id + /// WebTests_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWebTests(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WebTestRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebTestRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), WebTestClientDiagnostics, Pipeline, "MockableApplicationInsightsSubscriptionResource.GetWebTests", "value", "nextLink", cancellationToken); + } + + /// + /// Get all private workbooks defined within a specified subscription and category. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks + /// + /// + /// Operation Id + /// MyWorkbooks_ListBySubscription + /// + /// + /// + /// Category of workbook to return. + /// Tags presents on each workbook returned. + /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMyWorkbooksAsync(CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MyWorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MyWorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), MyWorkbookClientDiagnostics, Pipeline, "MockableApplicationInsightsSubscriptionResource.GetMyWorkbooks", "value", "nextLink", cancellationToken); + } + + /// + /// Get all private workbooks defined within a specified subscription and category. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks + /// + /// + /// Operation Id + /// MyWorkbooks_ListBySubscription + /// + /// + /// + /// Category of workbook to return. + /// Tags presents on each workbook returned. + /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMyWorkbooks(CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MyWorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MyWorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), MyWorkbookClientDiagnostics, Pipeline, "MockableApplicationInsightsSubscriptionResource.GetMyWorkbooks", "value", "nextLink", cancellationToken); + } + + /// + /// Get all Workbooks defined within a specified subscription and category. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks + /// + /// + /// Operation Id + /// Workbooks_ListBySubscription + /// + /// + /// + /// Category of workbook to return. + /// Tags presents on each workbook returned. + /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkbooksAsync(CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), WorkbookClientDiagnostics, Pipeline, "MockableApplicationInsightsSubscriptionResource.GetWorkbooks", "value", "nextLink", cancellationToken); + } + + /// + /// Get all Workbooks defined within a specified subscription and category. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks + /// + /// + /// Operation Id + /// Workbooks_ListBySubscription + /// + /// + /// + /// Category of workbook to return. + /// Tags presents on each workbook returned. + /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkbooks(CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), WorkbookClientDiagnostics, Pipeline, "MockableApplicationInsightsSubscriptionResource.GetWorkbooks", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 312f16219f002..0000000000000 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ApplicationInsights -{ - /// 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 ApplicationInsightsComponentResources in the ResourceGroupResource. - /// An object representing collection of ApplicationInsightsComponentResources and their operations over a ApplicationInsightsComponentResource. - public virtual ApplicationInsightsComponentCollection GetApplicationInsightsComponents() - { - return GetCachedClient(Client => new ApplicationInsightsComponentCollection(Client, Id)); - } - - /// Gets a collection of WebTestResources in the ResourceGroupResource. - /// An object representing collection of WebTestResources and their operations over a WebTestResource. - public virtual WebTestCollection GetWebTests() - { - return GetCachedClient(Client => new WebTestCollection(Client, Id)); - } - - /// Gets a collection of WorkbookTemplateResources in the ResourceGroupResource. - /// An object representing collection of WorkbookTemplateResources and their operations over a WorkbookTemplateResource. - public virtual WorkbookTemplateCollection GetWorkbookTemplates() - { - return GetCachedClient(Client => new WorkbookTemplateCollection(Client, Id)); - } - - /// Gets a collection of MyWorkbookResources in the ResourceGroupResource. - /// An object representing collection of MyWorkbookResources and their operations over a MyWorkbookResource. - public virtual MyWorkbookCollection GetMyWorkbooks() - { - return GetCachedClient(Client => new MyWorkbookCollection(Client, Id)); - } - - /// Gets a collection of WorkbookResources in the ResourceGroupResource. - /// An object representing collection of WorkbookResources and their operations over a WorkbookResource. - public virtual WorkbookCollection GetWorkbooks() - { - return GetCachedClient(Client => new WorkbookCollection(Client, Id)); - } - } -} diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index ba6c2fd5c9126..0000000000000 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ApplicationInsights.Models; - -namespace Azure.ResourceManager.ApplicationInsights -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _applicationInsightsComponentComponentsClientDiagnostics; - private ComponentsRestOperations _applicationInsightsComponentComponentsRestClient; - private ClientDiagnostics _webTestClientDiagnostics; - private WebTestsRestOperations _webTestRestClient; - private ClientDiagnostics _myWorkbookClientDiagnostics; - private MyWorkbooksRestOperations _myWorkbookRestClient; - private ClientDiagnostics _workbookClientDiagnostics; - private WorkbooksRestOperations _workbookRestClient; - - /// 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 ApplicationInsightsComponentComponentsClientDiagnostics => _applicationInsightsComponentComponentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", ApplicationInsightsComponentResource.ResourceType.Namespace, Diagnostics); - private ComponentsRestOperations ApplicationInsightsComponentComponentsRestClient => _applicationInsightsComponentComponentsRestClient ??= new ComponentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApplicationInsightsComponentResource.ResourceType)); - private ClientDiagnostics WebTestClientDiagnostics => _webTestClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", WebTestResource.ResourceType.Namespace, Diagnostics); - private WebTestsRestOperations WebTestRestClient => _webTestRestClient ??= new WebTestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WebTestResource.ResourceType)); - private ClientDiagnostics MyWorkbookClientDiagnostics => _myWorkbookClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", MyWorkbookResource.ResourceType.Namespace, Diagnostics); - private MyWorkbooksRestOperations MyWorkbookRestClient => _myWorkbookRestClient ??= new MyWorkbooksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MyWorkbookResource.ResourceType)); - private ClientDiagnostics WorkbookClientDiagnostics => _workbookClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ApplicationInsights", WorkbookResource.ResourceType.Namespace, Diagnostics); - private WorkbooksRestOperations WorkbookRestClient => _workbookRestClient ??= new WorkbooksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WorkbookResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets a list of all Application Insights components within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/components - /// - /// - /// Operation Id - /// Components_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApplicationInsightsComponentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationInsightsComponentComponentsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationInsightsComponentComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), ApplicationInsightsComponentComponentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationInsightsComponents", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all Application Insights components within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/components - /// - /// - /// Operation Id - /// Components_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApplicationInsightsComponents(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationInsightsComponentComponentsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationInsightsComponentComponentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApplicationInsightsComponentResource(Client, ApplicationInsightsComponentData.DeserializeApplicationInsightsComponentData(e)), ApplicationInsightsComponentComponentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationInsightsComponents", "value", "nextLink", cancellationToken); - } - - /// - /// Get all Application Insights web test definitions for the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests - /// - /// - /// Operation Id - /// WebTests_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWebTestsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WebTestRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebTestRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), WebTestClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebTests", "value", "nextLink", cancellationToken); - } - - /// - /// Get all Application Insights web test definitions for the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests - /// - /// - /// Operation Id - /// WebTests_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWebTests(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WebTestRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebTestRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebTestResource(Client, WebTestData.DeserializeWebTestData(e)), WebTestClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebTests", "value", "nextLink", cancellationToken); - } - - /// - /// Get all private workbooks defined within a specified subscription and category. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks - /// - /// - /// Operation Id - /// MyWorkbooks_ListBySubscription - /// - /// - /// - /// Category of workbook to return. - /// Tags presents on each workbook returned. - /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMyWorkbooksAsync(CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MyWorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MyWorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), MyWorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMyWorkbooks", "value", "nextLink", cancellationToken); - } - - /// - /// Get all private workbooks defined within a specified subscription and category. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks - /// - /// - /// Operation Id - /// MyWorkbooks_ListBySubscription - /// - /// - /// - /// Category of workbook to return. - /// Tags presents on each workbook returned. - /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMyWorkbooks(CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MyWorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MyWorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MyWorkbookResource(Client, MyWorkbookData.DeserializeMyWorkbookData(e)), MyWorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMyWorkbooks", "value", "nextLink", cancellationToken); - } - - /// - /// Get all Workbooks defined within a specified subscription and category. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks - /// - /// - /// Operation Id - /// Workbooks_ListBySubscription - /// - /// - /// - /// Category of workbook to return. - /// Tags presents on each workbook returned. - /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkbooksAsync(CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), WorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWorkbooks", "value", "nextLink", cancellationToken); - } - - /// - /// Get all Workbooks defined within a specified subscription and category. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks - /// - /// - /// Operation Id - /// Workbooks_ListBySubscription - /// - /// - /// - /// Category of workbook to return. - /// Tags presents on each workbook returned. - /// Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkbooks(CategoryType category, IEnumerable tags = null, bool? canFetchContent = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WorkbookRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, category, tags, canFetchContent); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WorkbookRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, category, tags, canFetchContent); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkbookResource(Client, WorkbookData.DeserializeWorkbookData(e)), WorkbookClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWorkbooks", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookResource.cs index 1f00264e9e8f9..9f5f2601c11d3 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/MyWorkbookResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.ApplicationInsights public partial class MyWorkbookResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}"; diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestResource.cs index 6e02136fc656b..58a2d3e859931 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WebTestResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ApplicationInsights public partial class WebTestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The webTestName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string webTestName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}"; diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookResource.cs index 250fe2f8ef9c4..17ffe422bec3f 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ApplicationInsights public partial class WorkbookResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of WorkbookRevisionResources and their operations over a WorkbookRevisionResource. public virtual WorkbookRevisionCollection GetWorkbookRevisions() { - return GetCachedClient(Client => new WorkbookRevisionCollection(Client, Id)); + return GetCachedClient(client => new WorkbookRevisionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual WorkbookRevisionCollection GetWorkbookRevisions() /// /// The id of the workbook's revision. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkbookRevisionAsync(string revisionId, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetWorkbookRevisio /// /// The id of the workbook's revision. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkbookRevision(string revisionId, CancellationToken cancellationToken = default) { diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionResource.cs index b89d68f620c1d..024626f169f15 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookRevisionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ApplicationInsights public partial class WorkbookRevisionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The revisionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string revisionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId}"; diff --git a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateResource.cs index ee7064ac6c5b9..3e6322f3c3232 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookTemplateResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ApplicationInsights public partial class WorkbookTemplateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/api/Azure.ResourceManager.AppPlatform.netstandard2.0.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/api/Azure.ResourceManager.AppPlatform.netstandard2.0.cs index 70a374c7abc23..746d55485cf9a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/api/Azure.ResourceManager.AppPlatform.netstandard2.0.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/api/Azure.ResourceManager.AppPlatform.netstandard2.0.cs @@ -773,7 +773,7 @@ protected AppPlatformServiceCollection() { } } public partial class AppPlatformServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public AppPlatformServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AppPlatformServiceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.AppPlatform.Models.AppPlatformServiceProperties Properties { get { throw null; } set { } } public Azure.ResourceManager.AppPlatform.Models.AppPlatformSku Sku { get { throw null; } set { } } } @@ -972,6 +972,60 @@ protected AppPlatformSupportedStackResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.AppPlatform.Mocking +{ + public partial class MockableAppPlatformArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAppPlatformArmClient() { } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformApiPortalCustomDomainResource GetAppPlatformApiPortalCustomDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformApiPortalResource GetAppPlatformApiPortalResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformAppResource GetAppPlatformAppResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformBindingResource GetAppPlatformBindingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformBuilderResource GetAppPlatformBuilderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformBuildpackBindingResource GetAppPlatformBuildpackBindingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformBuildResource GetAppPlatformBuildResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformBuildResultResource GetAppPlatformBuildResultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformBuildServiceAgentPoolResource GetAppPlatformBuildServiceAgentPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformBuildServiceResource GetAppPlatformBuildServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformCertificateResource GetAppPlatformCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformConfigServerResource GetAppPlatformConfigServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformConfigurationServiceResource GetAppPlatformConfigurationServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformCustomDomainResource GetAppPlatformCustomDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformDeploymentResource GetAppPlatformDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformGatewayCustomDomainResource GetAppPlatformGatewayCustomDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformGatewayResource GetAppPlatformGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformGatewayRouteConfigResource GetAppPlatformGatewayRouteConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformMonitoringSettingResource GetAppPlatformMonitoringSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformServiceRegistryResource GetAppPlatformServiceRegistryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformServiceResource GetAppPlatformServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformStorageResource GetAppPlatformStorageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformSupportedBuildpackResource GetAppPlatformSupportedBuildpackResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformSupportedStackResource GetAppPlatformSupportedStackResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAppPlatformResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAppPlatformResourceGroupResource() { } + public virtual Azure.Response GetAppPlatformService(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppPlatformServiceAsync(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppPlatform.AppPlatformServiceCollection GetAppPlatformServices() { throw null; } + } + public partial class MockableAppPlatformSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAppPlatformSubscriptionResource() { } + public virtual Azure.Response CheckAppPlatformNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.AppPlatform.Models.AppPlatformNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckAppPlatformNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.AppPlatform.Models.AppPlatformNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppPlatformServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppPlatformServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAppPlatformTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableAppPlatformTenantResource() { } + public virtual Azure.Pageable GetRuntimeVersions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRuntimeVersionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.AppPlatform.Models { public partial class ActiveAppPlatformDeploymentsContent diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainResource.cs index 1fa50ef3c1fac..a3f028d5e2bb1 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalCustomDomainResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformApiPortalCustomDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiPortalName. + /// The domainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiPortalName, string domainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalResource.cs index 27e5bfa4addcb..4087b2c2e49a4 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformApiPortalResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The apiPortalName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string apiPortalName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppPlatformApiPortalCustomDomainResources and their operations over a AppPlatformApiPortalCustomDomainResource. public virtual AppPlatformApiPortalCustomDomainCollection GetAppPlatformApiPortalCustomDomains() { - return GetCachedClient(Client => new AppPlatformApiPortalCustomDomainCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformApiPortalCustomDomainCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual AppPlatformApiPortalCustomDomainCollection GetAppPlatformApiPorta /// /// The name of the API portal custom domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformApiPortalCustomDomainAsync(string domainName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> Ge /// /// The name of the API portal custom domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformApiPortalCustomDomain(string domainName, CancellationToken cancellationToken = default) { diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppResource.cs index 7b5721c54a65a..6ec4f000f76f7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformAppResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The appName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string appName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppPlatformBindingResources and their operations over a AppPlatformBindingResource. public virtual AppPlatformBindingCollection GetAppPlatformBindings() { - return GetCachedClient(Client => new AppPlatformBindingCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformBindingCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual AppPlatformBindingCollection GetAppPlatformBindings() /// /// The name of the Binding resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformBindingAsync(string bindingName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetAppPlatformBi /// /// The name of the Binding resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformBinding(string bindingName, CancellationToken cancellationToken = default) { @@ -144,7 +148,7 @@ public virtual Response GetAppPlatformBinding(string /// An object representing collection of AppPlatformCustomDomainResources and their operations over a AppPlatformCustomDomainResource. public virtual AppPlatformCustomDomainCollection GetAppPlatformCustomDomains() { - return GetCachedClient(Client => new AppPlatformCustomDomainCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformCustomDomainCollection(client, Id)); } /// @@ -162,8 +166,8 @@ public virtual AppPlatformCustomDomainCollection GetAppPlatformCustomDomains() /// /// The name of the custom domain resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformCustomDomainAsync(string domainName, CancellationToken cancellationToken = default) { @@ -185,8 +189,8 @@ public virtual async Task> GetAppPlatf /// /// The name of the custom domain resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformCustomDomain(string domainName, CancellationToken cancellationToken = default) { @@ -197,7 +201,7 @@ public virtual Response GetAppPlatformCustomDom /// An object representing collection of AppPlatformDeploymentResources and their operations over a AppPlatformDeploymentResource. public virtual AppPlatformDeploymentCollection GetAppPlatformDeployments() { - return GetCachedClient(Client => new AppPlatformDeploymentCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformDeploymentCollection(client, Id)); } /// @@ -215,8 +219,8 @@ public virtual AppPlatformDeploymentCollection GetAppPlatformDeployments() /// /// The name of the Deployment resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) { @@ -238,8 +242,8 @@ public virtual async Task> GetAppPlatfor /// /// The name of the Deployment resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformDeployment(string deploymentName, CancellationToken cancellationToken = default) { diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingResource.cs index 9eaf3b4f89d62..ccabd065fb6f7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBindingResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformBindingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The appName. + /// The bindingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string appName, string bindingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResource.cs index 3736a727acefe..ed84d04196003 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformBuildResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The buildServiceName. + /// The buildName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string buildName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppPlatformBuildResultResources and their operations over a AppPlatformBuildResultResource. public virtual AppPlatformBuildResultCollection GetAppPlatformBuildResults() { - return GetCachedClient(Client => new AppPlatformBuildResultCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformBuildResultCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual AppPlatformBuildResultCollection GetAppPlatformBuildResults() /// /// The name of the build result resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformBuildResultAsync(string buildResultName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetAppPlatfo /// /// The name of the build result resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformBuildResult(string buildResultName, CancellationToken cancellationToken = default) { diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultResource.cs index 4faaed330abe6..9f09cea259af0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResultResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformBuildResultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The buildServiceName. + /// The buildName. + /// The buildResultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string buildName, string buildResultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolResource.cs index e4a4f864e6235..0cd6fdd462705 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceAgentPoolResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformBuildServiceAgentPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The buildServiceName. + /// The agentPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string agentPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceResource.cs index 03053830625de..e2bd5c9dfb9ec 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformBuildServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The buildServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppPlatformBuildResources and their operations over a AppPlatformBuildResource. public virtual AppPlatformBuildCollection GetAppPlatformBuilds() { - return GetCachedClient(Client => new AppPlatformBuildCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformBuildCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual AppPlatformBuildCollection GetAppPlatformBuilds() /// /// The name of the build resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformBuildAsync(string buildName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetAppPlatformBuil /// /// The name of the build resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformBuild(string buildName, CancellationToken cancellationToken = default) { @@ -144,7 +148,7 @@ public virtual Response GetAppPlatformBuild(string bui /// An object representing collection of AppPlatformSupportedBuildpackResources and their operations over a AppPlatformSupportedBuildpackResource. public virtual AppPlatformSupportedBuildpackCollection GetAppPlatformSupportedBuildpacks() { - return GetCachedClient(Client => new AppPlatformSupportedBuildpackCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformSupportedBuildpackCollection(client, Id)); } /// @@ -162,8 +166,8 @@ public virtual AppPlatformSupportedBuildpackCollection GetAppPlatformSupportedBu /// /// The name of the buildpack resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformSupportedBuildpackAsync(string buildpackName, CancellationToken cancellationToken = default) { @@ -185,8 +189,8 @@ public virtual async Task> GetAp /// /// The name of the buildpack resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformSupportedBuildpack(string buildpackName, CancellationToken cancellationToken = default) { @@ -197,7 +201,7 @@ public virtual Response GetAppPlatformSup /// An object representing collection of AppPlatformSupportedStackResources and their operations over a AppPlatformSupportedStackResource. public virtual AppPlatformSupportedStackCollection GetAppPlatformSupportedStacks() { - return GetCachedClient(Client => new AppPlatformSupportedStackCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformSupportedStackCollection(client, Id)); } /// @@ -215,8 +219,8 @@ public virtual AppPlatformSupportedStackCollection GetAppPlatformSupportedStacks /// /// The name of the stack resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformSupportedStackAsync(string stackName, CancellationToken cancellationToken = default) { @@ -238,8 +242,8 @@ public virtual async Task> GetAppPla /// /// The name of the stack resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformSupportedStack(string stackName, CancellationToken cancellationToken = default) { @@ -250,7 +254,7 @@ public virtual Response GetAppPlatformSupport /// An object representing collection of AppPlatformBuilderResources and their operations over a AppPlatformBuilderResource. public virtual AppPlatformBuilderCollection GetAppPlatformBuilders() { - return GetCachedClient(Client => new AppPlatformBuilderCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformBuilderCollection(client, Id)); } /// @@ -268,8 +272,8 @@ public virtual AppPlatformBuilderCollection GetAppPlatformBuilders() /// /// The name of the builder resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformBuilderAsync(string builderName, CancellationToken cancellationToken = default) { @@ -291,8 +295,8 @@ public virtual async Task> GetAppPlatformBu /// /// The name of the builder resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformBuilder(string builderName, CancellationToken cancellationToken = default) { @@ -303,7 +307,7 @@ public virtual Response GetAppPlatformBuilder(string /// An object representing collection of AppPlatformBuildServiceAgentPoolResources and their operations over a AppPlatformBuildServiceAgentPoolResource. public virtual AppPlatformBuildServiceAgentPoolCollection GetAppPlatformBuildServiceAgentPools() { - return GetCachedClient(Client => new AppPlatformBuildServiceAgentPoolCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformBuildServiceAgentPoolCollection(client, Id)); } /// @@ -321,8 +325,8 @@ public virtual AppPlatformBuildServiceAgentPoolCollection GetAppPlatformBuildSer /// /// The name of the build service agent pool resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformBuildServiceAgentPoolAsync(string agentPoolName, CancellationToken cancellationToken = default) { @@ -344,8 +348,8 @@ public virtual async Task> Ge /// /// The name of the build service agent pool resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformBuildServiceAgentPool(string agentPoolName, CancellationToken cancellationToken = default) { diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs index d99eb8506a86e..90118cf235b96 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformBuilderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The buildServiceName. + /// The builderName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string builderName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppPlatformBuildpackBindingResources and their operations over a AppPlatformBuildpackBindingResource. public virtual AppPlatformBuildpackBindingCollection GetAppPlatformBuildpackBindings() { - return GetCachedClient(Client => new AppPlatformBuildpackBindingCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformBuildpackBindingCollection(client, Id)); } /// @@ -109,8 +114,8 @@ public virtual AppPlatformBuildpackBindingCollection GetAppPlatformBuildpackBind /// /// The name of the Buildpack Binding Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformBuildpackBindingAsync(string buildpackBindingName, CancellationToken cancellationToken = default) { @@ -132,8 +137,8 @@ public virtual async Task> GetAppP /// /// The name of the Buildpack Binding Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformBuildpackBinding(string buildpackBindingName, CancellationToken cancellationToken = default) { diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingResource.cs index 4977c3d00da43..ba1244f8bcf6c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildpackBindingResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformBuildpackBindingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The buildServiceName. + /// The builderName. + /// The buildpackBindingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string builderName, string buildpackBindingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateResource.cs index 9823eb61d6e7c..08ad6e3a32331 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCertificateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigServerResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigServerResource.cs index 5328c79bafc87..a5506521e173d 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigServerResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigServerResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformConfigServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceResource.cs index 0608c2c4ab530..82e916b0ca089 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformConfigurationServiceResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformConfigurationServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The configurationServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string configurationServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainResource.cs index 263680b962cb1..9db0f2765c2e7 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformCustomDomainResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformCustomDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The appName. + /// The domainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string appName, string domainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentResource.cs index 44704b5db1118..29ad780f22fe9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformDeploymentResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The appName. + /// The deploymentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string appName, string deploymentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainResource.cs index 5eaf656410b07..d3a1e34c709ca 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayCustomDomainResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformGatewayCustomDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The gatewayName. + /// The domainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string gatewayName, string domainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayResource.cs index 2a4a52e4a3b98..8b62e4d845838 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The gatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string gatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppPlatformGatewayRouteConfigResources and their operations over a AppPlatformGatewayRouteConfigResource. public virtual AppPlatformGatewayRouteConfigCollection GetAppPlatformGatewayRouteConfigs() { - return GetCachedClient(Client => new AppPlatformGatewayRouteConfigCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformGatewayRouteConfigCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual AppPlatformGatewayRouteConfigCollection GetAppPlatformGatewayRout /// /// The name of the Spring Cloud Gateway route config. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformGatewayRouteConfigAsync(string routeConfigName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetAp /// /// The name of the Spring Cloud Gateway route config. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformGatewayRouteConfig(string routeConfigName, CancellationToken cancellationToken = default) { @@ -144,7 +148,7 @@ public virtual Response GetAppPlatformGat /// An object representing collection of AppPlatformGatewayCustomDomainResources and their operations over a AppPlatformGatewayCustomDomainResource. public virtual AppPlatformGatewayCustomDomainCollection GetAppPlatformGatewayCustomDomains() { - return GetCachedClient(Client => new AppPlatformGatewayCustomDomainCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformGatewayCustomDomainCollection(client, Id)); } /// @@ -162,8 +166,8 @@ public virtual AppPlatformGatewayCustomDomainCollection GetAppPlatformGatewayCus /// /// The name of the Spring Cloud Gateway custom domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformGatewayCustomDomainAsync(string domainName, CancellationToken cancellationToken = default) { @@ -185,8 +189,8 @@ public virtual async Task> GetA /// /// The name of the Spring Cloud Gateway custom domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformGatewayCustomDomain(string domainName, CancellationToken cancellationToken = default) { diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigResource.cs index 348e83e13ed8b..8922da4e3e949 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayRouteConfigResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformGatewayRouteConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The gatewayName. + /// The routeConfigName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string gatewayName, string routeConfigName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformMonitoringSettingResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformMonitoringSettingResource.cs index 694af570a5704..93ec12ce72250 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformMonitoringSettingResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformMonitoringSettingResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformMonitoringSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryResource.cs index 03d660669f13e..f0ee3b16d9d65 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceRegistryResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformServiceRegistryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The serviceRegistryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string serviceRegistryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs index d9a3afe487d49..e7d1d1a039523 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"; @@ -111,7 +114,7 @@ public virtual AppPlatformConfigServerResource GetAppPlatformConfigServer() /// An object representing collection of AppPlatformConfigurationServiceResources and their operations over a AppPlatformConfigurationServiceResource. public virtual AppPlatformConfigurationServiceCollection GetAppPlatformConfigurationServices() { - return GetCachedClient(Client => new AppPlatformConfigurationServiceCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformConfigurationServiceCollection(client, Id)); } /// @@ -129,8 +132,8 @@ public virtual AppPlatformConfigurationServiceCollection GetAppPlatformConfigura /// /// The name of Application Configuration Service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformConfigurationServiceAsync(string configurationServiceName, CancellationToken cancellationToken = default) { @@ -152,8 +155,8 @@ public virtual async Task> Get /// /// The name of Application Configuration Service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformConfigurationService(string configurationServiceName, CancellationToken cancellationToken = default) { @@ -164,7 +167,7 @@ public virtual Response GetAppPlatformC /// An object representing collection of AppPlatformServiceRegistryResources and their operations over a AppPlatformServiceRegistryResource. public virtual AppPlatformServiceRegistryCollection GetAppPlatformServiceRegistries() { - return GetCachedClient(Client => new AppPlatformServiceRegistryCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformServiceRegistryCollection(client, Id)); } /// @@ -182,8 +185,8 @@ public virtual AppPlatformServiceRegistryCollection GetAppPlatformServiceRegistr /// /// The name of Service Registry. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformServiceRegistryAsync(string serviceRegistryName, CancellationToken cancellationToken = default) { @@ -205,8 +208,8 @@ public virtual async Task> GetAppPl /// /// The name of Service Registry. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformServiceRegistry(string serviceRegistryName, CancellationToken cancellationToken = default) { @@ -217,7 +220,7 @@ public virtual Response GetAppPlatformServic /// An object representing collection of AppPlatformBuildServiceResources and their operations over a AppPlatformBuildServiceResource. public virtual AppPlatformBuildServiceCollection GetAppPlatformBuildServices() { - return GetCachedClient(Client => new AppPlatformBuildServiceCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformBuildServiceCollection(client, Id)); } /// @@ -235,8 +238,8 @@ public virtual AppPlatformBuildServiceCollection GetAppPlatformBuildServices() /// /// The name of the build service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformBuildServiceAsync(string buildServiceName, CancellationToken cancellationToken = default) { @@ -258,8 +261,8 @@ public virtual async Task> GetAppPlatf /// /// The name of the build service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformBuildService(string buildServiceName, CancellationToken cancellationToken = default) { @@ -277,7 +280,7 @@ public virtual AppPlatformMonitoringSettingResource GetAppPlatformMonitoringSett /// An object representing collection of AppPlatformAppResources and their operations over a AppPlatformAppResource. public virtual AppPlatformAppCollection GetAppPlatformApps() { - return GetCachedClient(Client => new AppPlatformAppCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformAppCollection(client, Id)); } /// @@ -296,8 +299,8 @@ public virtual AppPlatformAppCollection GetAppPlatformApps() /// The name of the App resource. /// Indicates whether sync status. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformAppAsync(string appName, string syncStatus = null, CancellationToken cancellationToken = default) { @@ -320,8 +323,8 @@ public virtual async Task> GetAppPlatformAppAsy /// The name of the App resource. /// Indicates whether sync status. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformApp(string appName, string syncStatus = null, CancellationToken cancellationToken = default) { @@ -332,7 +335,7 @@ public virtual Response GetAppPlatformApp(string appName /// An object representing collection of AppPlatformStorageResources and their operations over a AppPlatformStorageResource. public virtual AppPlatformStorageCollection GetAppPlatformStorages() { - return GetCachedClient(Client => new AppPlatformStorageCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformStorageCollection(client, Id)); } /// @@ -350,8 +353,8 @@ public virtual AppPlatformStorageCollection GetAppPlatformStorages() /// /// The name of the storage resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformStorageAsync(string storageName, CancellationToken cancellationToken = default) { @@ -373,8 +376,8 @@ public virtual async Task> GetAppPlatformSt /// /// The name of the storage resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformStorage(string storageName, CancellationToken cancellationToken = default) { @@ -385,7 +388,7 @@ public virtual Response GetAppPlatformStorage(string /// An object representing collection of AppPlatformCertificateResources and their operations over a AppPlatformCertificateResource. public virtual AppPlatformCertificateCollection GetAppPlatformCertificates() { - return GetCachedClient(Client => new AppPlatformCertificateCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformCertificateCollection(client, Id)); } /// @@ -403,8 +406,8 @@ public virtual AppPlatformCertificateCollection GetAppPlatformCertificates() /// /// The name of the certificate resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -426,8 +429,8 @@ public virtual async Task> GetAppPlatfo /// /// The name of the certificate resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -438,7 +441,7 @@ public virtual Response GetAppPlatformCertificat /// An object representing collection of AppPlatformGatewayResources and their operations over a AppPlatformGatewayResource. public virtual AppPlatformGatewayCollection GetAppPlatformGateways() { - return GetCachedClient(Client => new AppPlatformGatewayCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformGatewayCollection(client, Id)); } /// @@ -456,8 +459,8 @@ public virtual AppPlatformGatewayCollection GetAppPlatformGateways() /// /// The name of Spring Cloud Gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformGatewayAsync(string gatewayName, CancellationToken cancellationToken = default) { @@ -479,8 +482,8 @@ public virtual async Task> GetAppPlatformGa /// /// The name of Spring Cloud Gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformGateway(string gatewayName, CancellationToken cancellationToken = default) { @@ -491,7 +494,7 @@ public virtual Response GetAppPlatformGateway(string /// An object representing collection of AppPlatformApiPortalResources and their operations over a AppPlatformApiPortalResource. public virtual AppPlatformApiPortalCollection GetAppPlatformApiPortals() { - return GetCachedClient(Client => new AppPlatformApiPortalCollection(Client, Id)); + return GetCachedClient(client => new AppPlatformApiPortalCollection(client, Id)); } /// @@ -509,8 +512,8 @@ public virtual AppPlatformApiPortalCollection GetAppPlatformApiPortals() /// /// The name of API portal. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppPlatformApiPortalAsync(string apiPortalName, CancellationToken cancellationToken = default) { @@ -532,8 +535,8 @@ public virtual async Task> GetAppPlatform /// /// The name of API portal. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppPlatformApiPortal(string apiPortalName, CancellationToken cancellationToken = default) { diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageResource.cs index 2649df8e693e5..f2f9e095fc75c 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformStorageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformStorageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The storageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string storageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackResource.cs index 3aab934189999..776dcfab030c3 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedBuildpackResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformSupportedBuildpackResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The buildServiceName. + /// The buildpackName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string buildpackName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackResource.cs index 4ee3a2edb19f3..8cfce2cabb5ac 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformSupportedStackResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppPlatform public partial class AppPlatformSupportedStackResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The buildServiceName. + /// The stackName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string stackName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"; diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/AppPlatformExtensions.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/AppPlatformExtensions.cs index 1516512c796b7..d8df28f7a1ced 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/AppPlatformExtensions.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/AppPlatformExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.AppPlatform.Mocking; using Azure.ResourceManager.AppPlatform.Models; using Azure.ResourceManager.Resources; @@ -19,515 +20,422 @@ namespace Azure.ResourceManager.AppPlatform /// A class to add extension methods to Azure.ResourceManager.AppPlatform. public static partial class AppPlatformExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAppPlatformArmClient GetMockableAppPlatformArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAppPlatformArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAppPlatformResourceGroupResource GetMockableAppPlatformResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAppPlatformResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAppPlatformSubscriptionResource GetMockableAppPlatformSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAppPlatformSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAppPlatformTenantResource GetMockableAppPlatformTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAppPlatformTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region AppPlatformServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformServiceResource GetAppPlatformServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformServiceResource.ValidateResourceId(id); - return new AppPlatformServiceResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformServiceResource(id); } - #endregion - #region AppPlatformConfigServerResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformConfigServerResource GetAppPlatformConfigServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformConfigServerResource.ValidateResourceId(id); - return new AppPlatformConfigServerResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformConfigServerResource(id); } - #endregion - #region AppPlatformConfigurationServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformConfigurationServiceResource GetAppPlatformConfigurationServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformConfigurationServiceResource.ValidateResourceId(id); - return new AppPlatformConfigurationServiceResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformConfigurationServiceResource(id); } - #endregion - #region AppPlatformServiceRegistryResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformServiceRegistryResource GetAppPlatformServiceRegistryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformServiceRegistryResource.ValidateResourceId(id); - return new AppPlatformServiceRegistryResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformServiceRegistryResource(id); } - #endregion - #region AppPlatformBuildServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformBuildServiceResource GetAppPlatformBuildServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformBuildServiceResource.ValidateResourceId(id); - return new AppPlatformBuildServiceResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformBuildServiceResource(id); } - #endregion - #region AppPlatformBuildResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformBuildResource GetAppPlatformBuildResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformBuildResource.ValidateResourceId(id); - return new AppPlatformBuildResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformBuildResource(id); } - #endregion - #region AppPlatformBuildResultResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformBuildResultResource GetAppPlatformBuildResultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformBuildResultResource.ValidateResourceId(id); - return new AppPlatformBuildResultResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformBuildResultResource(id); } - #endregion - #region AppPlatformSupportedBuildpackResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformSupportedBuildpackResource GetAppPlatformSupportedBuildpackResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformSupportedBuildpackResource.ValidateResourceId(id); - return new AppPlatformSupportedBuildpackResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformSupportedBuildpackResource(id); } - #endregion - #region AppPlatformSupportedStackResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformSupportedStackResource GetAppPlatformSupportedStackResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformSupportedStackResource.ValidateResourceId(id); - return new AppPlatformSupportedStackResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformSupportedStackResource(id); } - #endregion - #region AppPlatformBuildpackBindingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformBuildpackBindingResource GetAppPlatformBuildpackBindingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformBuildpackBindingResource.ValidateResourceId(id); - return new AppPlatformBuildpackBindingResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformBuildpackBindingResource(id); } - #endregion - #region AppPlatformBuilderResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformBuilderResource GetAppPlatformBuilderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformBuilderResource.ValidateResourceId(id); - return new AppPlatformBuilderResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformBuilderResource(id); } - #endregion - #region AppPlatformBuildServiceAgentPoolResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformBuildServiceAgentPoolResource GetAppPlatformBuildServiceAgentPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformBuildServiceAgentPoolResource.ValidateResourceId(id); - return new AppPlatformBuildServiceAgentPoolResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformBuildServiceAgentPoolResource(id); } - #endregion - #region AppPlatformMonitoringSettingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformMonitoringSettingResource GetAppPlatformMonitoringSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformMonitoringSettingResource.ValidateResourceId(id); - return new AppPlatformMonitoringSettingResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformMonitoringSettingResource(id); } - #endregion - #region AppPlatformAppResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformAppResource GetAppPlatformAppResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformAppResource.ValidateResourceId(id); - return new AppPlatformAppResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformAppResource(id); } - #endregion - #region AppPlatformBindingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformBindingResource GetAppPlatformBindingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformBindingResource.ValidateResourceId(id); - return new AppPlatformBindingResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformBindingResource(id); } - #endregion - #region AppPlatformStorageResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformStorageResource GetAppPlatformStorageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformStorageResource.ValidateResourceId(id); - return new AppPlatformStorageResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformStorageResource(id); } - #endregion - #region AppPlatformCertificateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformCertificateResource GetAppPlatformCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformCertificateResource.ValidateResourceId(id); - return new AppPlatformCertificateResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformCertificateResource(id); } - #endregion - #region AppPlatformCustomDomainResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformCustomDomainResource GetAppPlatformCustomDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformCustomDomainResource.ValidateResourceId(id); - return new AppPlatformCustomDomainResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformCustomDomainResource(id); } - #endregion - #region AppPlatformDeploymentResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformDeploymentResource GetAppPlatformDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformDeploymentResource.ValidateResourceId(id); - return new AppPlatformDeploymentResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformDeploymentResource(id); } - #endregion - #region AppPlatformGatewayResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformGatewayResource GetAppPlatformGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformGatewayResource.ValidateResourceId(id); - return new AppPlatformGatewayResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformGatewayResource(id); } - #endregion - #region AppPlatformGatewayRouteConfigResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformGatewayRouteConfigResource GetAppPlatformGatewayRouteConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformGatewayRouteConfigResource.ValidateResourceId(id); - return new AppPlatformGatewayRouteConfigResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformGatewayRouteConfigResource(id); } - #endregion - #region AppPlatformGatewayCustomDomainResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformGatewayCustomDomainResource GetAppPlatformGatewayCustomDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformGatewayCustomDomainResource.ValidateResourceId(id); - return new AppPlatformGatewayCustomDomainResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformGatewayCustomDomainResource(id); } - #endregion - #region AppPlatformApiPortalResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformApiPortalResource GetAppPlatformApiPortalResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformApiPortalResource.ValidateResourceId(id); - return new AppPlatformApiPortalResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformApiPortalResource(id); } - #endregion - #region AppPlatformApiPortalCustomDomainResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppPlatformApiPortalCustomDomainResource GetAppPlatformApiPortalCustomDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppPlatformApiPortalCustomDomainResource.ValidateResourceId(id); - return new AppPlatformApiPortalCustomDomainResource(client, id); - } - ); + return GetMockableAppPlatformArmClient(client).GetAppPlatformApiPortalCustomDomainResource(id); } - #endregion - /// Gets a collection of AppPlatformServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of AppPlatformServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AppPlatformServiceResources and their operations over a AppPlatformServiceResource. public static AppPlatformServiceCollection GetAppPlatformServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAppPlatformServices(); + return GetMockableAppPlatformResourceGroupResource(resourceGroupResource).GetAppPlatformServices(); } /// @@ -542,16 +450,20 @@ public static AppPlatformServiceCollection GetAppPlatformServices(this ResourceG /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAppPlatformServiceAsync(this ResourceGroupResource resourceGroupResource, string serviceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAppPlatformServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppPlatformResourceGroupResource(resourceGroupResource).GetAppPlatformServiceAsync(serviceName, cancellationToken).ConfigureAwait(false); } /// @@ -566,16 +478,20 @@ public static async Task> GetAppPlatformSer /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAppPlatformService(this ResourceGroupResource resourceGroupResource, string serviceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAppPlatformServices().Get(serviceName, cancellationToken); + return GetMockableAppPlatformResourceGroupResource(resourceGroupResource).GetAppPlatformService(serviceName, cancellationToken); } /// @@ -590,6 +506,10 @@ public static Response GetAppPlatformService(this Re /// Services_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the region. @@ -598,9 +518,7 @@ public static Response GetAppPlatformService(this Re /// is null. public static async Task> CheckAppPlatformNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, AppPlatformNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAppPlatformNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableAppPlatformSubscriptionResource(subscriptionResource).CheckAppPlatformNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -615,6 +533,10 @@ public static async Task> CheckAppPl /// Services_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the region. @@ -623,9 +545,7 @@ public static async Task> CheckAppPl /// is null. public static Response CheckAppPlatformNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, AppPlatformNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAppPlatformNameAvailability(location, content, cancellationToken); + return GetMockableAppPlatformSubscriptionResource(subscriptionResource).CheckAppPlatformNameAvailability(location, content, cancellationToken); } /// @@ -640,13 +560,17 @@ public static Response CheckAppPlatformNameAv /// Services_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppPlatformServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppPlatformServicesAsync(cancellationToken); + return GetMockableAppPlatformSubscriptionResource(subscriptionResource).GetAppPlatformServicesAsync(cancellationToken); } /// @@ -661,13 +585,17 @@ public static AsyncPageable GetAppPlatformServicesAs /// Services_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppPlatformServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppPlatformServices(cancellationToken); + return GetMockableAppPlatformSubscriptionResource(subscriptionResource).GetAppPlatformServices(cancellationToken); } /// @@ -682,13 +610,17 @@ public static Pageable GetAppPlatformServices(this S /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusAsync(cancellationToken); + return GetMockableAppPlatformSubscriptionResource(subscriptionResource).GetSkusAsync(cancellationToken); } /// @@ -703,13 +635,17 @@ public static AsyncPageable GetSkusAsync(this Subscript /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkus(cancellationToken); + return GetMockableAppPlatformSubscriptionResource(subscriptionResource).GetSkus(cancellationToken); } /// @@ -724,13 +660,17 @@ public static Pageable GetSkus(this SubscriptionResourc /// RuntimeVersions_ListRuntimeVersions /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRuntimeVersionsAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetRuntimeVersionsAsync(cancellationToken); + return GetMockableAppPlatformTenantResource(tenantResource).GetRuntimeVersionsAsync(cancellationToken); } /// @@ -745,13 +685,17 @@ public static AsyncPageable GetRuntimeVersio /// RuntimeVersions_ListRuntimeVersions /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRuntimeVersions(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetRuntimeVersions(cancellationToken); + return GetMockableAppPlatformTenantResource(tenantResource).GetRuntimeVersions(cancellationToken); } } } diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformArmClient.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformArmClient.cs new file mode 100644 index 0000000000000..68bfe33b07d3f --- /dev/null +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformArmClient.cs @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.AppPlatform; + +namespace Azure.ResourceManager.AppPlatform.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAppPlatformArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppPlatformArmClient() + { + } + + /// 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 MockableAppPlatformArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAppPlatformArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformServiceResource GetAppPlatformServiceResource(ResourceIdentifier id) + { + AppPlatformServiceResource.ValidateResourceId(id); + return new AppPlatformServiceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformConfigServerResource GetAppPlatformConfigServerResource(ResourceIdentifier id) + { + AppPlatformConfigServerResource.ValidateResourceId(id); + return new AppPlatformConfigServerResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformConfigurationServiceResource GetAppPlatformConfigurationServiceResource(ResourceIdentifier id) + { + AppPlatformConfigurationServiceResource.ValidateResourceId(id); + return new AppPlatformConfigurationServiceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformServiceRegistryResource GetAppPlatformServiceRegistryResource(ResourceIdentifier id) + { + AppPlatformServiceRegistryResource.ValidateResourceId(id); + return new AppPlatformServiceRegistryResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformBuildServiceResource GetAppPlatformBuildServiceResource(ResourceIdentifier id) + { + AppPlatformBuildServiceResource.ValidateResourceId(id); + return new AppPlatformBuildServiceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformBuildResource GetAppPlatformBuildResource(ResourceIdentifier id) + { + AppPlatformBuildResource.ValidateResourceId(id); + return new AppPlatformBuildResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformBuildResultResource GetAppPlatformBuildResultResource(ResourceIdentifier id) + { + AppPlatformBuildResultResource.ValidateResourceId(id); + return new AppPlatformBuildResultResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformSupportedBuildpackResource GetAppPlatformSupportedBuildpackResource(ResourceIdentifier id) + { + AppPlatformSupportedBuildpackResource.ValidateResourceId(id); + return new AppPlatformSupportedBuildpackResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformSupportedStackResource GetAppPlatformSupportedStackResource(ResourceIdentifier id) + { + AppPlatformSupportedStackResource.ValidateResourceId(id); + return new AppPlatformSupportedStackResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformBuildpackBindingResource GetAppPlatformBuildpackBindingResource(ResourceIdentifier id) + { + AppPlatformBuildpackBindingResource.ValidateResourceId(id); + return new AppPlatformBuildpackBindingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformBuilderResource GetAppPlatformBuilderResource(ResourceIdentifier id) + { + AppPlatformBuilderResource.ValidateResourceId(id); + return new AppPlatformBuilderResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformBuildServiceAgentPoolResource GetAppPlatformBuildServiceAgentPoolResource(ResourceIdentifier id) + { + AppPlatformBuildServiceAgentPoolResource.ValidateResourceId(id); + return new AppPlatformBuildServiceAgentPoolResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformMonitoringSettingResource GetAppPlatformMonitoringSettingResource(ResourceIdentifier id) + { + AppPlatformMonitoringSettingResource.ValidateResourceId(id); + return new AppPlatformMonitoringSettingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformAppResource GetAppPlatformAppResource(ResourceIdentifier id) + { + AppPlatformAppResource.ValidateResourceId(id); + return new AppPlatformAppResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformBindingResource GetAppPlatformBindingResource(ResourceIdentifier id) + { + AppPlatformBindingResource.ValidateResourceId(id); + return new AppPlatformBindingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformStorageResource GetAppPlatformStorageResource(ResourceIdentifier id) + { + AppPlatformStorageResource.ValidateResourceId(id); + return new AppPlatformStorageResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformCertificateResource GetAppPlatformCertificateResource(ResourceIdentifier id) + { + AppPlatformCertificateResource.ValidateResourceId(id); + return new AppPlatformCertificateResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformCustomDomainResource GetAppPlatformCustomDomainResource(ResourceIdentifier id) + { + AppPlatformCustomDomainResource.ValidateResourceId(id); + return new AppPlatformCustomDomainResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformDeploymentResource GetAppPlatformDeploymentResource(ResourceIdentifier id) + { + AppPlatformDeploymentResource.ValidateResourceId(id); + return new AppPlatformDeploymentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformGatewayResource GetAppPlatformGatewayResource(ResourceIdentifier id) + { + AppPlatformGatewayResource.ValidateResourceId(id); + return new AppPlatformGatewayResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformGatewayRouteConfigResource GetAppPlatformGatewayRouteConfigResource(ResourceIdentifier id) + { + AppPlatformGatewayRouteConfigResource.ValidateResourceId(id); + return new AppPlatformGatewayRouteConfigResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformGatewayCustomDomainResource GetAppPlatformGatewayCustomDomainResource(ResourceIdentifier id) + { + AppPlatformGatewayCustomDomainResource.ValidateResourceId(id); + return new AppPlatformGatewayCustomDomainResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformApiPortalResource GetAppPlatformApiPortalResource(ResourceIdentifier id) + { + AppPlatformApiPortalResource.ValidateResourceId(id); + return new AppPlatformApiPortalResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppPlatformApiPortalCustomDomainResource GetAppPlatformApiPortalCustomDomainResource(ResourceIdentifier id) + { + AppPlatformApiPortalCustomDomainResource.ValidateResourceId(id); + return new AppPlatformApiPortalCustomDomainResource(Client, id); + } + } +} diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformResourceGroupResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformResourceGroupResource.cs new file mode 100644 index 0000000000000..ad4ce20855a7e --- /dev/null +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.AppPlatform; + +namespace Azure.ResourceManager.AppPlatform.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAppPlatformResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppPlatformResourceGroupResource() + { + } + + /// 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 MockableAppPlatformResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AppPlatformServiceResources in the ResourceGroupResource. + /// An object representing collection of AppPlatformServiceResources and their operations over a AppPlatformServiceResource. + public virtual AppPlatformServiceCollection GetAppPlatformServices() + { + return GetCachedClient(client => new AppPlatformServiceCollection(client, Id)); + } + + /// + /// Get a Service and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the Service resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAppPlatformServiceAsync(string serviceName, CancellationToken cancellationToken = default) + { + return await GetAppPlatformServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Service and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the Service resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAppPlatformService(string serviceName, CancellationToken cancellationToken = default) + { + return GetAppPlatformServices().Get(serviceName, cancellationToken); + } + } +} diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformSubscriptionResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformSubscriptionResource.cs new file mode 100644 index 0000000000000..d660e5a8339fa --- /dev/null +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformSubscriptionResource.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppPlatform; +using Azure.ResourceManager.AppPlatform.Models; + +namespace Azure.ResourceManager.AppPlatform.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAppPlatformSubscriptionResource : ArmResource + { + private ClientDiagnostics _appPlatformServiceServicesClientDiagnostics; + private ServicesRestOperations _appPlatformServiceServicesRestClient; + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAppPlatformSubscriptionResource() + { + } + + /// 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 MockableAppPlatformSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AppPlatformServiceServicesClientDiagnostics => _appPlatformServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppPlatform", AppPlatformServiceResource.ResourceType.Namespace, Diagnostics); + private ServicesRestOperations AppPlatformServiceServicesRestClient => _appPlatformServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppPlatformServiceResource.ResourceType)); + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppPlatform", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks that the resource name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Services_CheckNameAvailability + /// + /// + /// + /// the region. + /// Parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckAppPlatformNameAvailabilityAsync(AzureLocation location, AppPlatformNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = AppPlatformServiceServicesClientDiagnostics.CreateScope("MockableAppPlatformSubscriptionResource.CheckAppPlatformNameAvailability"); + scope.Start(); + try + { + var response = await AppPlatformServiceServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the resource name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Services_CheckNameAvailability + /// + /// + /// + /// the region. + /// Parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual Response CheckAppPlatformNameAvailability(AzureLocation location, AppPlatformNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = AppPlatformServiceServicesClientDiagnostics.CreateScope("MockableAppPlatformSubscriptionResource.CheckAppPlatformNameAvailability"); + scope.Start(); + try + { + var response = AppPlatformServiceServicesRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring + /// + /// + /// Operation Id + /// Services_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppPlatformServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), AppPlatformServiceServicesClientDiagnostics, Pipeline, "MockableAppPlatformSubscriptionResource.GetAppPlatformServices", "value", "nextLink", cancellationToken); + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring + /// + /// + /// Operation Id + /// Services_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppPlatformServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), AppPlatformServiceServicesClientDiagnostics, Pipeline, "MockableAppPlatformSubscriptionResource.GetAppPlatformServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available skus of the Microsoft.AppPlatform provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableAppPlatformSku.DeserializeAvailableAppPlatformSku, SkusClientDiagnostics, Pipeline, "MockableAppPlatformSubscriptionResource.GetSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available skus of the Microsoft.AppPlatform provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableAppPlatformSku.DeserializeAvailableAppPlatformSku, SkusClientDiagnostics, Pipeline, "MockableAppPlatformSubscriptionResource.GetSkus", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformTenantResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformTenantResource.cs new file mode 100644 index 0000000000000..51f6688558d25 --- /dev/null +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/MockableAppPlatformTenantResource.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppPlatform; +using Azure.ResourceManager.AppPlatform.Models; + +namespace Azure.ResourceManager.AppPlatform.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableAppPlatformTenantResource : ArmResource + { + private ClientDiagnostics _runtimeVersionsClientDiagnostics; + private RuntimeVersionsRestOperations _runtimeVersionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAppPlatformTenantResource() + { + } + + /// 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 MockableAppPlatformTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics RuntimeVersionsClientDiagnostics => _runtimeVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppPlatform", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private RuntimeVersionsRestOperations RuntimeVersionsRestClient => _runtimeVersionsRestClient ??= new RuntimeVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + /// + /// + /// Request Path + /// /providers/Microsoft.AppPlatform/runtimeVersions + /// + /// + /// Operation Id + /// RuntimeVersions_ListRuntimeVersions + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRuntimeVersionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RuntimeVersionsRestClient.CreateListRuntimeVersionsRequest(); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, AppPlatformSupportedRuntimeVersion.DeserializeAppPlatformSupportedRuntimeVersion, RuntimeVersionsClientDiagnostics, Pipeline, "MockableAppPlatformTenantResource.GetRuntimeVersions", "value", null, cancellationToken); + } + + /// + /// Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + /// + /// + /// Request Path + /// /providers/Microsoft.AppPlatform/runtimeVersions + /// + /// + /// Operation Id + /// RuntimeVersions_ListRuntimeVersions + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRuntimeVersions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RuntimeVersionsRestClient.CreateListRuntimeVersionsRequest(); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, AppPlatformSupportedRuntimeVersion.DeserializeAppPlatformSupportedRuntimeVersion, RuntimeVersionsClientDiagnostics, Pipeline, "MockableAppPlatformTenantResource.GetRuntimeVersions", "value", null, cancellationToken); + } + } +} diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 400370c8364be..0000000000000 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.AppPlatform -{ - /// 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 AppPlatformServiceResources in the ResourceGroupResource. - /// An object representing collection of AppPlatformServiceResources and their operations over a AppPlatformServiceResource. - public virtual AppPlatformServiceCollection GetAppPlatformServices() - { - return GetCachedClient(Client => new AppPlatformServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d08e81e73920c..0000000000000 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppPlatform.Models; - -namespace Azure.ResourceManager.AppPlatform -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _appPlatformServiceServicesClientDiagnostics; - private ServicesRestOperations _appPlatformServiceServicesRestClient; - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; - - /// 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 AppPlatformServiceServicesClientDiagnostics => _appPlatformServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppPlatform", AppPlatformServiceResource.ResourceType.Namespace, Diagnostics); - private ServicesRestOperations AppPlatformServiceServicesRestClient => _appPlatformServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppPlatformServiceResource.ResourceType)); - private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppPlatform", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks that the resource name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Services_CheckNameAvailability - /// - /// - /// - /// the region. - /// Parameters supplied to the operation. - /// The cancellation token to use. - public virtual async Task> CheckAppPlatformNameAvailabilityAsync(AzureLocation location, AppPlatformNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = AppPlatformServiceServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAppPlatformNameAvailability"); - scope.Start(); - try - { - var response = await AppPlatformServiceServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the resource name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Services_CheckNameAvailability - /// - /// - /// - /// the region. - /// Parameters supplied to the operation. - /// The cancellation token to use. - public virtual Response CheckAppPlatformNameAvailability(AzureLocation location, AppPlatformNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = AppPlatformServiceServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAppPlatformNameAvailability"); - scope.Start(); - try - { - var response = AppPlatformServiceServicesRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring - /// - /// - /// Operation Id - /// Services_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppPlatformServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), AppPlatformServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppPlatformServices", "value", "nextLink", cancellationToken); - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring - /// - /// - /// Operation Id - /// Services_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppPlatformServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppPlatformServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppPlatformServiceResource(Client, AppPlatformServiceData.DeserializeAppPlatformServiceData(e)), AppPlatformServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppPlatformServices", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available skus of the Microsoft.AppPlatform provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableAppPlatformSku.DeserializeAvailableAppPlatformSku, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available skus of the Microsoft.AppPlatform provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableAppPlatformSku.DeserializeAvailableAppPlatformSku, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 57a5c43f05301..0000000000000 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppPlatform.Models; - -namespace Azure.ResourceManager.AppPlatform -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _runtimeVersionsClientDiagnostics; - private RuntimeVersionsRestOperations _runtimeVersionsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics RuntimeVersionsClientDiagnostics => _runtimeVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppPlatform", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private RuntimeVersionsRestOperations RuntimeVersionsRestClient => _runtimeVersionsRestClient ??= new RuntimeVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - /// - /// - /// Request Path - /// /providers/Microsoft.AppPlatform/runtimeVersions - /// - /// - /// Operation Id - /// RuntimeVersions_ListRuntimeVersions - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRuntimeVersionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RuntimeVersionsRestClient.CreateListRuntimeVersionsRequest(); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, AppPlatformSupportedRuntimeVersion.DeserializeAppPlatformSupportedRuntimeVersion, RuntimeVersionsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetRuntimeVersions", "value", null, cancellationToken); - } - - /// - /// Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - /// - /// - /// Request Path - /// /providers/Microsoft.AppPlatform/runtimeVersions - /// - /// - /// Operation Id - /// RuntimeVersions_ListRuntimeVersions - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRuntimeVersions(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RuntimeVersionsRestClient.CreateListRuntimeVersionsRequest(); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, AppPlatformSupportedRuntimeVersion.DeserializeAppPlatformSupportedRuntimeVersion, RuntimeVersionsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetRuntimeVersions", "value", null, cancellationToken); - } - } -} diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/Azure.ResourceManager.ArcScVmm.sln b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/Azure.ResourceManager.ArcScVmm.sln index 1ff85d2810aab..070391daf75d3 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/Azure.ResourceManager.ArcScVmm.sln +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/Azure.ResourceManager.ArcScVmm.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{347E65B8-3333-4784-B984-6FD944DF92EB}") = "Azure.ResourceManager.ArcScVmm", "src\Azure.ResourceManager.ArcScVmm.csproj", "{3CC0294D-0BEA-460E-BB1C-30C25A295F3C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ArcScVmm", "src\Azure.ResourceManager.ArcScVmm.csproj", "{3CC0294D-0BEA-460E-BB1C-30C25A295F3C}" EndProject -Project("{347E65B8-3333-4784-B984-6FD944DF92EB}") = "Azure.ResourceManager.ArcScVmm.Tests", "tests\Azure.ResourceManager.ArcScVmm.Tests.csproj", "{ED4AF246-F1C9-47E1-B883-187D791F649B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ArcScVmm.Tests", "tests\Azure.ResourceManager.ArcScVmm.Tests.csproj", "{ED4AF246-F1C9-47E1-B883-187D791F649B}" EndProject -Project("{347E65B8-3333-4784-B984-6FD944DF92EB}") = "Azure.ResourceManager.ArcScVmm.Samples", "samples\Azure.ResourceManager.ArcScVmm.Samples.csproj", "{FB238127-13FF-4870-8EB7-8025FF98F8CE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ArcScVmm.Samples", "samples\Azure.ResourceManager.ArcScVmm.Samples.csproj", "{FB238127-13FF-4870-8EB7-8025FF98F8CE}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {864AFC20-1BCA-484E-9A60-FB3833E5224E} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {ED4AF246-F1C9-47E1-B883-187D791F649B}.Release|x64.Build.0 = Release|Any CPU {ED4AF246-F1C9-47E1-B883-187D791F649B}.Release|x86.ActiveCfg = Release|Any CPU {ED4AF246-F1C9-47E1-B883-187D791F649B}.Release|x86.Build.0 = Release|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Debug|x64.ActiveCfg = Debug|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Debug|x64.Build.0 = Debug|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Debug|x86.ActiveCfg = Debug|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Debug|x86.Build.0 = Debug|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Release|Any CPU.Build.0 = Release|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Release|x64.ActiveCfg = Release|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Release|x64.Build.0 = Release|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Release|x86.ActiveCfg = Release|Any CPU + {FB238127-13FF-4870-8EB7-8025FF98F8CE}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {864AFC20-1BCA-484E-9A60-FB3833E5224E} EndGlobalSection EndGlobal diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/api/Azure.ResourceManager.ArcScVmm.netstandard2.0.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/api/Azure.ResourceManager.ArcScVmm.netstandard2.0.cs index e7f554aad7e96..5ca86d01c2d05 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/api/Azure.ResourceManager.ArcScVmm.netstandard2.0.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/api/Azure.ResourceManager.ArcScVmm.netstandard2.0.cs @@ -99,7 +99,7 @@ protected ScVmmAvailabilitySetCollection() { } } public partial class ScVmmAvailabilitySetData : Azure.ResourceManager.Models.TrackedResourceData { - public ScVmmAvailabilitySetData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ScVmmAvailabilitySetData(Azure.Core.AzureLocation location) { } public string AvailabilitySetName { get { throw null; } set { } } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } @@ -144,7 +144,7 @@ protected ScVmmCloudCollection() { } } public partial class ScVmmCloudData : Azure.ResourceManager.Models.TrackedResourceData { - public ScVmmCloudData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation) : base (default(Azure.Core.AzureLocation)) { } + public ScVmmCloudData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation) { } public Azure.ResourceManager.ArcScVmm.Models.CloudCapacity CloudCapacity { get { throw null; } } public string CloudName { get { throw null; } } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } @@ -193,7 +193,7 @@ protected ScVmmServerCollection() { } } public partial class ScVmmServerData : Azure.ResourceManager.Models.TrackedResourceData { - public ScVmmServerData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation, string fqdn) : base (default(Azure.Core.AzureLocation)) { } + public ScVmmServerData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation, string fqdn) { } public string ConnectionStatus { get { throw null; } } public Azure.ResourceManager.ArcScVmm.Models.VmmServerPropertiesCredentials Credentials { get { throw null; } set { } } public string ErrorMessage { get { throw null; } } @@ -246,7 +246,7 @@ protected ScVmmVirtualMachineCollection() { } } public partial class ScVmmVirtualMachineData : Azure.ResourceManager.Models.TrackedResourceData { - public ScVmmVirtualMachineData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation) : base (default(Azure.Core.AzureLocation)) { } + public ScVmmVirtualMachineData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation) { } public System.Collections.Generic.IList AvailabilitySets { get { throw null; } } public System.Collections.Generic.IList Checkpoints { get { throw null; } } public string CheckpointType { get { throw null; } set { } } @@ -316,7 +316,7 @@ protected ScVmmVirtualMachineTemplateCollection() { } } public partial class ScVmmVirtualMachineTemplateData : Azure.ResourceManager.Models.TrackedResourceData { - public ScVmmVirtualMachineTemplateData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation) : base (default(Azure.Core.AzureLocation)) { } + public ScVmmVirtualMachineTemplateData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation) { } public string ComputerName { get { throw null; } } public int? CpuCount { get { throw null; } } public System.Collections.Generic.IReadOnlyList Disks { get { throw null; } } @@ -376,7 +376,7 @@ protected ScVmmVirtualNetworkCollection() { } } public partial class ScVmmVirtualNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public ScVmmVirtualNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation) : base (default(Azure.Core.AzureLocation)) { } + public ScVmmVirtualNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation) { } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public string InventoryItemId { get { throw null; } set { } } public string NetworkName { get { throw null; } } @@ -405,6 +405,58 @@ protected ScVmmVirtualNetworkResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ArcScVmm.Models.ResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ArcScVmm.Mocking +{ + public partial class MockableArcScVmmArmClient : Azure.ResourceManager.ArmResource + { + protected MockableArcScVmmArmClient() { } + public virtual Azure.ResourceManager.ArcScVmm.InventoryItemResource GetInventoryItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmAvailabilitySetResource GetScVmmAvailabilitySetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmCloudResource GetScVmmCloudResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmServerResource GetScVmmServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmVirtualMachineResource GetScVmmVirtualMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmVirtualMachineTemplateResource GetScVmmVirtualMachineTemplateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmVirtualNetworkResource GetScVmmVirtualNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableArcScVmmResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableArcScVmmResourceGroupResource() { } + public virtual Azure.Response GetScVmmAvailabilitySet(string availabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScVmmAvailabilitySetAsync(string availabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmAvailabilitySetCollection GetScVmmAvailabilitySets() { throw null; } + public virtual Azure.Response GetScVmmCloud(string cloudName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScVmmCloudAsync(string cloudName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmCloudCollection GetScVmmClouds() { throw null; } + public virtual Azure.Response GetScVmmServer(string vmmServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScVmmServerAsync(string vmmServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmServerCollection GetScVmmServers() { throw null; } + public virtual Azure.Response GetScVmmVirtualMachine(string virtualMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScVmmVirtualMachineAsync(string virtualMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmVirtualMachineCollection GetScVmmVirtualMachines() { throw null; } + public virtual Azure.Response GetScVmmVirtualMachineTemplate(string virtualMachineTemplateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScVmmVirtualMachineTemplateAsync(string virtualMachineTemplateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmVirtualMachineTemplateCollection GetScVmmVirtualMachineTemplates() { throw null; } + public virtual Azure.Response GetScVmmVirtualNetwork(string virtualNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScVmmVirtualNetworkAsync(string virtualNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArcScVmm.ScVmmVirtualNetworkCollection GetScVmmVirtualNetworks() { throw null; } + } + public partial class MockableArcScVmmSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableArcScVmmSubscriptionResource() { } + public virtual Azure.Pageable GetScVmmAvailabilitySets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetScVmmAvailabilitySetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetScVmmClouds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetScVmmCloudsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetScVmmServers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetScVmmServersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetScVmmVirtualMachines(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetScVmmVirtualMachinesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetScVmmVirtualMachineTemplates(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetScVmmVirtualMachineTemplatesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetScVmmVirtualNetworks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetScVmmVirtualNetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ArcScVmm.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/ArcScVmmExtensions.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/ArcScVmmExtensions.cs index 98a9494813055..d49cae70ef64e 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/ArcScVmmExtensions.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/ArcScVmmExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ArcScVmm.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ArcScVmm @@ -18,176 +19,145 @@ namespace Azure.ResourceManager.ArcScVmm /// A class to add extension methods to Azure.ResourceManager.ArcScVmm. public static partial class ArcScVmmExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableArcScVmmArmClient GetMockableArcScVmmArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableArcScVmmArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableArcScVmmResourceGroupResource GetMockableArcScVmmResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableArcScVmmResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableArcScVmmSubscriptionResource GetMockableArcScVmmSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableArcScVmmSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ScVmmServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScVmmServerResource GetScVmmServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScVmmServerResource.ValidateResourceId(id); - return new ScVmmServerResource(client, id); - } - ); + return GetMockableArcScVmmArmClient(client).GetScVmmServerResource(id); } - #endregion - #region ScVmmCloudResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScVmmCloudResource GetScVmmCloudResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScVmmCloudResource.ValidateResourceId(id); - return new ScVmmCloudResource(client, id); - } - ); + return GetMockableArcScVmmArmClient(client).GetScVmmCloudResource(id); } - #endregion - #region ScVmmVirtualNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScVmmVirtualNetworkResource GetScVmmVirtualNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScVmmVirtualNetworkResource.ValidateResourceId(id); - return new ScVmmVirtualNetworkResource(client, id); - } - ); + return GetMockableArcScVmmArmClient(client).GetScVmmVirtualNetworkResource(id); } - #endregion - #region ScVmmVirtualMachineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScVmmVirtualMachineResource GetScVmmVirtualMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScVmmVirtualMachineResource.ValidateResourceId(id); - return new ScVmmVirtualMachineResource(client, id); - } - ); + return GetMockableArcScVmmArmClient(client).GetScVmmVirtualMachineResource(id); } - #endregion - #region ScVmmVirtualMachineTemplateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScVmmVirtualMachineTemplateResource GetScVmmVirtualMachineTemplateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScVmmVirtualMachineTemplateResource.ValidateResourceId(id); - return new ScVmmVirtualMachineTemplateResource(client, id); - } - ); + return GetMockableArcScVmmArmClient(client).GetScVmmVirtualMachineTemplateResource(id); } - #endregion - #region ScVmmAvailabilitySetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScVmmAvailabilitySetResource GetScVmmAvailabilitySetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScVmmAvailabilitySetResource.ValidateResourceId(id); - return new ScVmmAvailabilitySetResource(client, id); - } - ); + return GetMockableArcScVmmArmClient(client).GetScVmmAvailabilitySetResource(id); } - #endregion - #region InventoryItemResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static InventoryItemResource GetInventoryItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - InventoryItemResource.ValidateResourceId(id); - return new InventoryItemResource(client, id); - } - ); + return GetMockableArcScVmmArmClient(client).GetInventoryItemResource(id); } - #endregion - /// Gets a collection of ScVmmServerResources in the ResourceGroupResource. + /// + /// Gets a collection of ScVmmServerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ScVmmServerResources and their operations over a ScVmmServerResource. public static ScVmmServerCollection GetScVmmServers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetScVmmServers(); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmServers(); } /// @@ -202,16 +172,20 @@ public static ScVmmServerCollection GetScVmmServers(this ResourceGroupResource r /// VmmServers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the VMMServer. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScVmmServerAsync(this ResourceGroupResource resourceGroupResource, string vmmServerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetScVmmServers().GetAsync(vmmServerName, cancellationToken).ConfigureAwait(false); + return await GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmServerAsync(vmmServerName, cancellationToken).ConfigureAwait(false); } /// @@ -226,24 +200,34 @@ public static async Task> GetScVmmServerAsync(this /// VmmServers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the VMMServer. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScVmmServer(this ResourceGroupResource resourceGroupResource, string vmmServerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetScVmmServers().Get(vmmServerName, cancellationToken); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmServer(vmmServerName, cancellationToken); } - /// Gets a collection of ScVmmCloudResources in the ResourceGroupResource. + /// + /// Gets a collection of ScVmmCloudResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ScVmmCloudResources and their operations over a ScVmmCloudResource. public static ScVmmCloudCollection GetScVmmClouds(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetScVmmClouds(); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmClouds(); } /// @@ -258,16 +242,20 @@ public static ScVmmCloudCollection GetScVmmClouds(this ResourceGroupResource res /// Clouds_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScVmmCloudAsync(this ResourceGroupResource resourceGroupResource, string cloudName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetScVmmClouds().GetAsync(cloudName, cancellationToken).ConfigureAwait(false); + return await GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmCloudAsync(cloudName, cancellationToken).ConfigureAwait(false); } /// @@ -282,24 +270,34 @@ public static async Task> GetScVmmCloudAsync(this R /// Clouds_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScVmmCloud(this ResourceGroupResource resourceGroupResource, string cloudName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetScVmmClouds().Get(cloudName, cancellationToken); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmCloud(cloudName, cancellationToken); } - /// Gets a collection of ScVmmVirtualNetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of ScVmmVirtualNetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ScVmmVirtualNetworkResources and their operations over a ScVmmVirtualNetworkResource. public static ScVmmVirtualNetworkCollection GetScVmmVirtualNetworks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetScVmmVirtualNetworks(); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualNetworks(); } /// @@ -314,16 +312,20 @@ public static ScVmmVirtualNetworkCollection GetScVmmVirtualNetworks(this Resourc /// VirtualNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the VirtualNetwork. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScVmmVirtualNetworkAsync(this ResourceGroupResource resourceGroupResource, string virtualNetworkName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetScVmmVirtualNetworks().GetAsync(virtualNetworkName, cancellationToken).ConfigureAwait(false); + return await GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualNetworkAsync(virtualNetworkName, cancellationToken).ConfigureAwait(false); } /// @@ -338,24 +340,34 @@ public static async Task> GetScVmmVirtualN /// VirtualNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the VirtualNetwork. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScVmmVirtualNetwork(this ResourceGroupResource resourceGroupResource, string virtualNetworkName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetScVmmVirtualNetworks().Get(virtualNetworkName, cancellationToken); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualNetwork(virtualNetworkName, cancellationToken); } - /// Gets a collection of ScVmmVirtualMachineResources in the ResourceGroupResource. + /// + /// Gets a collection of ScVmmVirtualMachineResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ScVmmVirtualMachineResources and their operations over a ScVmmVirtualMachineResource. public static ScVmmVirtualMachineCollection GetScVmmVirtualMachines(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetScVmmVirtualMachines(); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualMachines(); } /// @@ -370,16 +382,20 @@ public static ScVmmVirtualMachineCollection GetScVmmVirtualMachines(this Resourc /// VirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the VirtualMachine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScVmmVirtualMachineAsync(this ResourceGroupResource resourceGroupResource, string virtualMachineName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetScVmmVirtualMachines().GetAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); + return await GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualMachineAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); } /// @@ -394,24 +410,34 @@ public static async Task> GetScVmmVirtualM /// VirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the VirtualMachine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScVmmVirtualMachine(this ResourceGroupResource resourceGroupResource, string virtualMachineName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetScVmmVirtualMachines().Get(virtualMachineName, cancellationToken); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualMachine(virtualMachineName, cancellationToken); } - /// Gets a collection of ScVmmVirtualMachineTemplateResources in the ResourceGroupResource. + /// + /// Gets a collection of ScVmmVirtualMachineTemplateResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ScVmmVirtualMachineTemplateResources and their operations over a ScVmmVirtualMachineTemplateResource. public static ScVmmVirtualMachineTemplateCollection GetScVmmVirtualMachineTemplates(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetScVmmVirtualMachineTemplates(); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualMachineTemplates(); } /// @@ -426,16 +452,20 @@ public static ScVmmVirtualMachineTemplateCollection GetScVmmVirtualMachineTempla /// VirtualMachineTemplates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the VirtualMachineTemplate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScVmmVirtualMachineTemplateAsync(this ResourceGroupResource resourceGroupResource, string virtualMachineTemplateName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetScVmmVirtualMachineTemplates().GetAsync(virtualMachineTemplateName, cancellationToken).ConfigureAwait(false); + return await GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualMachineTemplateAsync(virtualMachineTemplateName, cancellationToken).ConfigureAwait(false); } /// @@ -450,24 +480,34 @@ public static async Task> GetScVmm /// VirtualMachineTemplates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the VirtualMachineTemplate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScVmmVirtualMachineTemplate(this ResourceGroupResource resourceGroupResource, string virtualMachineTemplateName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetScVmmVirtualMachineTemplates().Get(virtualMachineTemplateName, cancellationToken); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmVirtualMachineTemplate(virtualMachineTemplateName, cancellationToken); } - /// Gets a collection of ScVmmAvailabilitySetResources in the ResourceGroupResource. + /// + /// Gets a collection of ScVmmAvailabilitySetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ScVmmAvailabilitySetResources and their operations over a ScVmmAvailabilitySetResource. public static ScVmmAvailabilitySetCollection GetScVmmAvailabilitySets(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetScVmmAvailabilitySets(); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmAvailabilitySets(); } /// @@ -482,16 +522,20 @@ public static ScVmmAvailabilitySetCollection GetScVmmAvailabilitySets(this Resou /// AvailabilitySets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the AvailabilitySet. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScVmmAvailabilitySetAsync(this ResourceGroupResource resourceGroupResource, string availabilitySetName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetScVmmAvailabilitySets().GetAsync(availabilitySetName, cancellationToken).ConfigureAwait(false); + return await GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmAvailabilitySetAsync(availabilitySetName, cancellationToken).ConfigureAwait(false); } /// @@ -506,16 +550,20 @@ public static async Task> GetScVmmAvailab /// AvailabilitySets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the AvailabilitySet. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScVmmAvailabilitySet(this ResourceGroupResource resourceGroupResource, string availabilitySetName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetScVmmAvailabilitySets().Get(availabilitySetName, cancellationToken); + return GetMockableArcScVmmResourceGroupResource(resourceGroupResource).GetScVmmAvailabilitySet(availabilitySetName, cancellationToken); } /// @@ -530,13 +578,17 @@ public static Response GetScVmmAvailabilitySet(thi /// VmmServers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmServersAsync(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmServersAsync(cancellationToken); } /// @@ -551,13 +603,17 @@ public static AsyncPageable GetScVmmServersAsync(this Subsc /// VmmServers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmServers(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmServers(cancellationToken); } /// @@ -572,13 +628,17 @@ public static Pageable GetScVmmServers(this SubscriptionRes /// Clouds_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmCloudsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmCloudsAsync(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmCloudsAsync(cancellationToken); } /// @@ -593,13 +653,17 @@ public static AsyncPageable GetScVmmCloudsAsync(this Subscri /// Clouds_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmClouds(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmClouds(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmClouds(cancellationToken); } /// @@ -614,13 +678,17 @@ public static Pageable GetScVmmClouds(this SubscriptionResou /// VirtualNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmVirtualNetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmVirtualNetworksAsync(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmVirtualNetworksAsync(cancellationToken); } /// @@ -635,13 +703,17 @@ public static AsyncPageable GetScVmmVirtualNetworks /// VirtualNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmVirtualNetworks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmVirtualNetworks(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmVirtualNetworks(cancellationToken); } /// @@ -656,13 +728,17 @@ public static Pageable GetScVmmVirtualNetworks(this /// VirtualMachines_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmVirtualMachinesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmVirtualMachinesAsync(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmVirtualMachinesAsync(cancellationToken); } /// @@ -677,13 +753,17 @@ public static AsyncPageable GetScVmmVirtualMachines /// VirtualMachines_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmVirtualMachines(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmVirtualMachines(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmVirtualMachines(cancellationToken); } /// @@ -698,13 +778,17 @@ public static Pageable GetScVmmVirtualMachines(this /// VirtualMachineTemplates_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmVirtualMachineTemplatesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmVirtualMachineTemplatesAsync(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmVirtualMachineTemplatesAsync(cancellationToken); } /// @@ -719,13 +803,17 @@ public static AsyncPageable GetScVmmVirtual /// VirtualMachineTemplates_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmVirtualMachineTemplates(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmVirtualMachineTemplates(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmVirtualMachineTemplates(cancellationToken); } /// @@ -740,13 +828,17 @@ public static Pageable GetScVmmVirtualMachi /// AvailabilitySets_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmAvailabilitySetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmAvailabilitySetsAsync(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmAvailabilitySetsAsync(cancellationToken); } /// @@ -761,13 +853,17 @@ public static AsyncPageable GetScVmmAvailabilitySe /// AvailabilitySets_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScVmmAvailabilitySets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScVmmAvailabilitySets(cancellationToken); + return GetMockableArcScVmmSubscriptionResource(subscriptionResource).GetScVmmAvailabilitySets(cancellationToken); } } } diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmArmClient.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmArmClient.cs new file mode 100644 index 0000000000000..7c5048cb3a37a --- /dev/null +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ArcScVmm; + +namespace Azure.ResourceManager.ArcScVmm.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableArcScVmmArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableArcScVmmArmClient() + { + } + + /// 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 MockableArcScVmmArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableArcScVmmArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScVmmServerResource GetScVmmServerResource(ResourceIdentifier id) + { + ScVmmServerResource.ValidateResourceId(id); + return new ScVmmServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScVmmCloudResource GetScVmmCloudResource(ResourceIdentifier id) + { + ScVmmCloudResource.ValidateResourceId(id); + return new ScVmmCloudResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScVmmVirtualNetworkResource GetScVmmVirtualNetworkResource(ResourceIdentifier id) + { + ScVmmVirtualNetworkResource.ValidateResourceId(id); + return new ScVmmVirtualNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScVmmVirtualMachineResource GetScVmmVirtualMachineResource(ResourceIdentifier id) + { + ScVmmVirtualMachineResource.ValidateResourceId(id); + return new ScVmmVirtualMachineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScVmmVirtualMachineTemplateResource GetScVmmVirtualMachineTemplateResource(ResourceIdentifier id) + { + ScVmmVirtualMachineTemplateResource.ValidateResourceId(id); + return new ScVmmVirtualMachineTemplateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScVmmAvailabilitySetResource GetScVmmAvailabilitySetResource(ResourceIdentifier id) + { + ScVmmAvailabilitySetResource.ValidateResourceId(id); + return new ScVmmAvailabilitySetResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual InventoryItemResource GetInventoryItemResource(ResourceIdentifier id) + { + InventoryItemResource.ValidateResourceId(id); + return new InventoryItemResource(Client, id); + } + } +} diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmResourceGroupResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmResourceGroupResource.cs new file mode 100644 index 0000000000000..bcd18a9c27b7a --- /dev/null +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmResourceGroupResource.cs @@ -0,0 +1,357 @@ +// 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.ArcScVmm; + +namespace Azure.ResourceManager.ArcScVmm.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableArcScVmmResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableArcScVmmResourceGroupResource() + { + } + + /// 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 MockableArcScVmmResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ScVmmServerResources in the ResourceGroupResource. + /// An object representing collection of ScVmmServerResources and their operations over a ScVmmServerResource. + public virtual ScVmmServerCollection GetScVmmServers() + { + return GetCachedClient(client => new ScVmmServerCollection(client, Id)); + } + + /// + /// Implements VMMServer GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName} + /// + /// + /// Operation Id + /// VmmServers_Get + /// + /// + /// + /// Name of the VMMServer. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScVmmServerAsync(string vmmServerName, CancellationToken cancellationToken = default) + { + return await GetScVmmServers().GetAsync(vmmServerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements VMMServer GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName} + /// + /// + /// Operation Id + /// VmmServers_Get + /// + /// + /// + /// Name of the VMMServer. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScVmmServer(string vmmServerName, CancellationToken cancellationToken = default) + { + return GetScVmmServers().Get(vmmServerName, cancellationToken); + } + + /// Gets a collection of ScVmmCloudResources in the ResourceGroupResource. + /// An object representing collection of ScVmmCloudResources and their operations over a ScVmmCloudResource. + public virtual ScVmmCloudCollection GetScVmmClouds() + { + return GetCachedClient(client => new ScVmmCloudCollection(client, Id)); + } + + /// + /// Implements Cloud GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName} + /// + /// + /// Operation Id + /// Clouds_Get + /// + /// + /// + /// Name of the Cloud. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScVmmCloudAsync(string cloudName, CancellationToken cancellationToken = default) + { + return await GetScVmmClouds().GetAsync(cloudName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements Cloud GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName} + /// + /// + /// Operation Id + /// Clouds_Get + /// + /// + /// + /// Name of the Cloud. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScVmmCloud(string cloudName, CancellationToken cancellationToken = default) + { + return GetScVmmClouds().Get(cloudName, cancellationToken); + } + + /// Gets a collection of ScVmmVirtualNetworkResources in the ResourceGroupResource. + /// An object representing collection of ScVmmVirtualNetworkResources and their operations over a ScVmmVirtualNetworkResource. + public virtual ScVmmVirtualNetworkCollection GetScVmmVirtualNetworks() + { + return GetCachedClient(client => new ScVmmVirtualNetworkCollection(client, Id)); + } + + /// + /// Implements VirtualNetwork GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// Name of the VirtualNetwork. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScVmmVirtualNetworkAsync(string virtualNetworkName, CancellationToken cancellationToken = default) + { + return await GetScVmmVirtualNetworks().GetAsync(virtualNetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements VirtualNetwork GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// Name of the VirtualNetwork. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScVmmVirtualNetwork(string virtualNetworkName, CancellationToken cancellationToken = default) + { + return GetScVmmVirtualNetworks().Get(virtualNetworkName, cancellationToken); + } + + /// Gets a collection of ScVmmVirtualMachineResources in the ResourceGroupResource. + /// An object representing collection of ScVmmVirtualMachineResources and their operations over a ScVmmVirtualMachineResource. + public virtual ScVmmVirtualMachineCollection GetScVmmVirtualMachines() + { + return GetCachedClient(client => new ScVmmVirtualMachineCollection(client, Id)); + } + + /// + /// Implements VirtualMachine GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Name of the VirtualMachine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScVmmVirtualMachineAsync(string virtualMachineName, CancellationToken cancellationToken = default) + { + return await GetScVmmVirtualMachines().GetAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements VirtualMachine GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Name of the VirtualMachine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScVmmVirtualMachine(string virtualMachineName, CancellationToken cancellationToken = default) + { + return GetScVmmVirtualMachines().Get(virtualMachineName, cancellationToken); + } + + /// Gets a collection of ScVmmVirtualMachineTemplateResources in the ResourceGroupResource. + /// An object representing collection of ScVmmVirtualMachineTemplateResources and their operations over a ScVmmVirtualMachineTemplateResource. + public virtual ScVmmVirtualMachineTemplateCollection GetScVmmVirtualMachineTemplates() + { + return GetCachedClient(client => new ScVmmVirtualMachineTemplateCollection(client, Id)); + } + + /// + /// Implements VirtualMachineTemplate GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName} + /// + /// + /// Operation Id + /// VirtualMachineTemplates_Get + /// + /// + /// + /// Name of the VirtualMachineTemplate. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScVmmVirtualMachineTemplateAsync(string virtualMachineTemplateName, CancellationToken cancellationToken = default) + { + return await GetScVmmVirtualMachineTemplates().GetAsync(virtualMachineTemplateName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements VirtualMachineTemplate GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName} + /// + /// + /// Operation Id + /// VirtualMachineTemplates_Get + /// + /// + /// + /// Name of the VirtualMachineTemplate. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScVmmVirtualMachineTemplate(string virtualMachineTemplateName, CancellationToken cancellationToken = default) + { + return GetScVmmVirtualMachineTemplates().Get(virtualMachineTemplateName, cancellationToken); + } + + /// Gets a collection of ScVmmAvailabilitySetResources in the ResourceGroupResource. + /// An object representing collection of ScVmmAvailabilitySetResources and their operations over a ScVmmAvailabilitySetResource. + public virtual ScVmmAvailabilitySetCollection GetScVmmAvailabilitySets() + { + return GetCachedClient(client => new ScVmmAvailabilitySetCollection(client, Id)); + } + + /// + /// Implements AvailabilitySet GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName} + /// + /// + /// Operation Id + /// AvailabilitySets_Get + /// + /// + /// + /// Name of the AvailabilitySet. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScVmmAvailabilitySetAsync(string availabilitySetName, CancellationToken cancellationToken = default) + { + return await GetScVmmAvailabilitySets().GetAsync(availabilitySetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements AvailabilitySet GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName} + /// + /// + /// Operation Id + /// AvailabilitySets_Get + /// + /// + /// + /// Name of the AvailabilitySet. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScVmmAvailabilitySet(string availabilitySetName, CancellationToken cancellationToken = default) + { + return GetScVmmAvailabilitySets().Get(availabilitySetName, cancellationToken); + } + } +} diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmSubscriptionResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmSubscriptionResource.cs new file mode 100644 index 0000000000000..4d96a7806b74f --- /dev/null +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/MockableArcScVmmSubscriptionResource.cs @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ArcScVmm; + +namespace Azure.ResourceManager.ArcScVmm.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableArcScVmmSubscriptionResource : ArmResource + { + private ClientDiagnostics _scVmmServerVmmServersClientDiagnostics; + private VmmServersRestOperations _scVmmServerVmmServersRestClient; + private ClientDiagnostics _scVmmCloudCloudsClientDiagnostics; + private CloudsRestOperations _scVmmCloudCloudsRestClient; + private ClientDiagnostics _scVmmVirtualNetworkVirtualNetworksClientDiagnostics; + private VirtualNetworksRestOperations _scVmmVirtualNetworkVirtualNetworksRestClient; + private ClientDiagnostics _scVmmVirtualMachineVirtualMachinesClientDiagnostics; + private VirtualMachinesRestOperations _scVmmVirtualMachineVirtualMachinesRestClient; + private ClientDiagnostics _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics; + private VirtualMachineTemplatesRestOperations _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient; + private ClientDiagnostics _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics; + private AvailabilitySetsRestOperations _scVmmAvailabilitySetAvailabilitySetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableArcScVmmSubscriptionResource() + { + } + + /// 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 MockableArcScVmmSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ScVmmServerVmmServersClientDiagnostics => _scVmmServerVmmServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmServerResource.ResourceType.Namespace, Diagnostics); + private VmmServersRestOperations ScVmmServerVmmServersRestClient => _scVmmServerVmmServersRestClient ??= new VmmServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmServerResource.ResourceType)); + private ClientDiagnostics ScVmmCloudCloudsClientDiagnostics => _scVmmCloudCloudsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmCloudResource.ResourceType.Namespace, Diagnostics); + private CloudsRestOperations ScVmmCloudCloudsRestClient => _scVmmCloudCloudsRestClient ??= new CloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmCloudResource.ResourceType)); + private ClientDiagnostics ScVmmVirtualNetworkVirtualNetworksClientDiagnostics => _scVmmVirtualNetworkVirtualNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmVirtualNetworkResource.ResourceType.Namespace, Diagnostics); + private VirtualNetworksRestOperations ScVmmVirtualNetworkVirtualNetworksRestClient => _scVmmVirtualNetworkVirtualNetworksRestClient ??= new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmVirtualNetworkResource.ResourceType)); + private ClientDiagnostics ScVmmVirtualMachineVirtualMachinesClientDiagnostics => _scVmmVirtualMachineVirtualMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmVirtualMachineResource.ResourceType.Namespace, Diagnostics); + private VirtualMachinesRestOperations ScVmmVirtualMachineVirtualMachinesRestClient => _scVmmVirtualMachineVirtualMachinesRestClient ??= new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmVirtualMachineResource.ResourceType)); + private ClientDiagnostics ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics => _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmVirtualMachineTemplateResource.ResourceType.Namespace, Diagnostics); + private VirtualMachineTemplatesRestOperations ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient => _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient ??= new VirtualMachineTemplatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmVirtualMachineTemplateResource.ResourceType)); + private ClientDiagnostics ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics => _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmAvailabilitySetResource.ResourceType.Namespace, Diagnostics); + private AvailabilitySetsRestOperations ScVmmAvailabilitySetAvailabilitySetsRestClient => _scVmmAvailabilitySetAvailabilitySetsRestClient ??= new AvailabilitySetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmAvailabilitySetResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List of VmmServers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/vmmServers + /// + /// + /// Operation Id + /// VmmServers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScVmmServersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), ScVmmServerVmmServersClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmServers", "value", "nextLink", cancellationToken); + } + + /// + /// List of VmmServers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/vmmServers + /// + /// + /// Operation Id + /// VmmServers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScVmmServers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), ScVmmServerVmmServersClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmServers", "value", "nextLink", cancellationToken); + } + + /// + /// List of Clouds in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/clouds + /// + /// + /// Operation Id + /// Clouds_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScVmmCloudsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), ScVmmCloudCloudsClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmClouds", "value", "nextLink", cancellationToken); + } + + /// + /// List of Clouds in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/clouds + /// + /// + /// Operation Id + /// Clouds_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScVmmClouds(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), ScVmmCloudCloudsClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmClouds", "value", "nextLink", cancellationToken); + } + + /// + /// List of VirtualNetworks in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualNetworks + /// + /// + /// Operation Id + /// VirtualNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScVmmVirtualNetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), ScVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmVirtualNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// List of VirtualNetworks in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualNetworks + /// + /// + /// Operation Id + /// VirtualNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScVmmVirtualNetworks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), ScVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmVirtualNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// List of VirtualMachines in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScVmmVirtualMachinesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), ScVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmVirtualMachines", "value", "nextLink", cancellationToken); + } + + /// + /// List of VirtualMachines in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScVmmVirtualMachines(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), ScVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmVirtualMachines", "value", "nextLink", cancellationToken); + } + + /// + /// List of VirtualMachineTemplates in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachineTemplates + /// + /// + /// Operation Id + /// VirtualMachineTemplates_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScVmmVirtualMachineTemplatesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmVirtualMachineTemplates", "value", "nextLink", cancellationToken); + } + + /// + /// List of VirtualMachineTemplates in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachineTemplates + /// + /// + /// Operation Id + /// VirtualMachineTemplates_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScVmmVirtualMachineTemplates(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmVirtualMachineTemplates", "value", "nextLink", cancellationToken); + } + + /// + /// List of AvailabilitySets in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/availabilitySets + /// + /// + /// Operation Id + /// AvailabilitySets_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScVmmAvailabilitySetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmAvailabilitySets", "value", "nextLink", cancellationToken); + } + + /// + /// List of AvailabilitySets in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/availabilitySets + /// + /// + /// Operation Id + /// AvailabilitySets_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScVmmAvailabilitySets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "MockableArcScVmmSubscriptionResource.GetScVmmAvailabilitySets", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 4cdb2ba54f5d3..0000000000000 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ArcScVmm -{ - /// 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 ScVmmServerResources in the ResourceGroupResource. - /// An object representing collection of ScVmmServerResources and their operations over a ScVmmServerResource. - public virtual ScVmmServerCollection GetScVmmServers() - { - return GetCachedClient(Client => new ScVmmServerCollection(Client, Id)); - } - - /// Gets a collection of ScVmmCloudResources in the ResourceGroupResource. - /// An object representing collection of ScVmmCloudResources and their operations over a ScVmmCloudResource. - public virtual ScVmmCloudCollection GetScVmmClouds() - { - return GetCachedClient(Client => new ScVmmCloudCollection(Client, Id)); - } - - /// Gets a collection of ScVmmVirtualNetworkResources in the ResourceGroupResource. - /// An object representing collection of ScVmmVirtualNetworkResources and their operations over a ScVmmVirtualNetworkResource. - public virtual ScVmmVirtualNetworkCollection GetScVmmVirtualNetworks() - { - return GetCachedClient(Client => new ScVmmVirtualNetworkCollection(Client, Id)); - } - - /// Gets a collection of ScVmmVirtualMachineResources in the ResourceGroupResource. - /// An object representing collection of ScVmmVirtualMachineResources and their operations over a ScVmmVirtualMachineResource. - public virtual ScVmmVirtualMachineCollection GetScVmmVirtualMachines() - { - return GetCachedClient(Client => new ScVmmVirtualMachineCollection(Client, Id)); - } - - /// Gets a collection of ScVmmVirtualMachineTemplateResources in the ResourceGroupResource. - /// An object representing collection of ScVmmVirtualMachineTemplateResources and their operations over a ScVmmVirtualMachineTemplateResource. - public virtual ScVmmVirtualMachineTemplateCollection GetScVmmVirtualMachineTemplates() - { - return GetCachedClient(Client => new ScVmmVirtualMachineTemplateCollection(Client, Id)); - } - - /// Gets a collection of ScVmmAvailabilitySetResources in the ResourceGroupResource. - /// An object representing collection of ScVmmAvailabilitySetResources and their operations over a ScVmmAvailabilitySetResource. - public virtual ScVmmAvailabilitySetCollection GetScVmmAvailabilitySets() - { - return GetCachedClient(Client => new ScVmmAvailabilitySetCollection(Client, Id)); - } - } -} diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 3b8b499bc4284..0000000000000 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ArcScVmm -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _scVmmServerVmmServersClientDiagnostics; - private VmmServersRestOperations _scVmmServerVmmServersRestClient; - private ClientDiagnostics _scVmmCloudCloudsClientDiagnostics; - private CloudsRestOperations _scVmmCloudCloudsRestClient; - private ClientDiagnostics _scVmmVirtualNetworkVirtualNetworksClientDiagnostics; - private VirtualNetworksRestOperations _scVmmVirtualNetworkVirtualNetworksRestClient; - private ClientDiagnostics _scVmmVirtualMachineVirtualMachinesClientDiagnostics; - private VirtualMachinesRestOperations _scVmmVirtualMachineVirtualMachinesRestClient; - private ClientDiagnostics _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics; - private VirtualMachineTemplatesRestOperations _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient; - private ClientDiagnostics _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics; - private AvailabilitySetsRestOperations _scVmmAvailabilitySetAvailabilitySetsRestClient; - - /// 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 ScVmmServerVmmServersClientDiagnostics => _scVmmServerVmmServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmServerResource.ResourceType.Namespace, Diagnostics); - private VmmServersRestOperations ScVmmServerVmmServersRestClient => _scVmmServerVmmServersRestClient ??= new VmmServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmServerResource.ResourceType)); - private ClientDiagnostics ScVmmCloudCloudsClientDiagnostics => _scVmmCloudCloudsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmCloudResource.ResourceType.Namespace, Diagnostics); - private CloudsRestOperations ScVmmCloudCloudsRestClient => _scVmmCloudCloudsRestClient ??= new CloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmCloudResource.ResourceType)); - private ClientDiagnostics ScVmmVirtualNetworkVirtualNetworksClientDiagnostics => _scVmmVirtualNetworkVirtualNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmVirtualNetworkResource.ResourceType.Namespace, Diagnostics); - private VirtualNetworksRestOperations ScVmmVirtualNetworkVirtualNetworksRestClient => _scVmmVirtualNetworkVirtualNetworksRestClient ??= new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmVirtualNetworkResource.ResourceType)); - private ClientDiagnostics ScVmmVirtualMachineVirtualMachinesClientDiagnostics => _scVmmVirtualMachineVirtualMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmVirtualMachineResource.ResourceType.Namespace, Diagnostics); - private VirtualMachinesRestOperations ScVmmVirtualMachineVirtualMachinesRestClient => _scVmmVirtualMachineVirtualMachinesRestClient ??= new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmVirtualMachineResource.ResourceType)); - private ClientDiagnostics ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics => _scVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmVirtualMachineTemplateResource.ResourceType.Namespace, Diagnostics); - private VirtualMachineTemplatesRestOperations ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient => _scVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient ??= new VirtualMachineTemplatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmVirtualMachineTemplateResource.ResourceType)); - private ClientDiagnostics ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics => _scVmmAvailabilitySetAvailabilitySetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ArcScVmm", ScVmmAvailabilitySetResource.ResourceType.Namespace, Diagnostics); - private AvailabilitySetsRestOperations ScVmmAvailabilitySetAvailabilitySetsRestClient => _scVmmAvailabilitySetAvailabilitySetsRestClient ??= new AvailabilitySetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScVmmAvailabilitySetResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List of VmmServers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/vmmServers - /// - /// - /// Operation Id - /// VmmServers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScVmmServersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), ScVmmServerVmmServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmServers", "value", "nextLink", cancellationToken); - } - - /// - /// List of VmmServers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/vmmServers - /// - /// - /// Operation Id - /// VmmServers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScVmmServers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmServerVmmServersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmServerResource(Client, ScVmmServerData.DeserializeScVmmServerData(e)), ScVmmServerVmmServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmServers", "value", "nextLink", cancellationToken); - } - - /// - /// List of Clouds in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/clouds - /// - /// - /// Operation Id - /// Clouds_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScVmmCloudsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), ScVmmCloudCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmClouds", "value", "nextLink", cancellationToken); - } - - /// - /// List of Clouds in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/clouds - /// - /// - /// Operation Id - /// Clouds_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScVmmClouds(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmCloudCloudsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmCloudResource(Client, ScVmmCloudData.DeserializeScVmmCloudData(e)), ScVmmCloudCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmClouds", "value", "nextLink", cancellationToken); - } - - /// - /// List of VirtualNetworks in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualNetworks - /// - /// - /// Operation Id - /// VirtualNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScVmmVirtualNetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), ScVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// List of VirtualNetworks in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualNetworks - /// - /// - /// Operation Id - /// VirtualNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScVmmVirtualNetworks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualNetworkVirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualNetworkResource(Client, ScVmmVirtualNetworkData.DeserializeScVmmVirtualNetworkData(e)), ScVmmVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// List of VirtualMachines in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScVmmVirtualMachinesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), ScVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachines", "value", "nextLink", cancellationToken); - } - - /// - /// List of VirtualMachines in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScVmmVirtualMachines(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineResource(Client, ScVmmVirtualMachineData.DeserializeScVmmVirtualMachineData(e)), ScVmmVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachines", "value", "nextLink", cancellationToken); - } - - /// - /// List of VirtualMachineTemplates in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachineTemplates - /// - /// - /// Operation Id - /// VirtualMachineTemplates_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScVmmVirtualMachineTemplatesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachineTemplates", "value", "nextLink", cancellationToken); - } - - /// - /// List of VirtualMachineTemplates in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachineTemplates - /// - /// - /// Operation Id - /// VirtualMachineTemplates_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScVmmVirtualMachineTemplates(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmVirtualMachineTemplateVirtualMachineTemplatesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmVirtualMachineTemplateResource(Client, ScVmmVirtualMachineTemplateData.DeserializeScVmmVirtualMachineTemplateData(e)), ScVmmVirtualMachineTemplateVirtualMachineTemplatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmVirtualMachineTemplates", "value", "nextLink", cancellationToken); - } - - /// - /// List of AvailabilitySets in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/availabilitySets - /// - /// - /// Operation Id - /// AvailabilitySets_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScVmmAvailabilitySetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmAvailabilitySets", "value", "nextLink", cancellationToken); - } - - /// - /// List of AvailabilitySets in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/availabilitySets - /// - /// - /// Operation Id - /// AvailabilitySets_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScVmmAvailabilitySets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScVmmAvailabilitySetAvailabilitySetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScVmmAvailabilitySetResource(Client, ScVmmAvailabilitySetData.DeserializeScVmmAvailabilitySetData(e)), ScVmmAvailabilitySetAvailabilitySetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScVmmAvailabilitySets", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemResource.cs index 8561ae2604b13..85e68a7b19b84 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemResource.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/InventoryItemResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ArcScVmm public partial class InventoryItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmmServerName. + /// The inventoryItemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmmServerName, string inventoryItemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemName}"; diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetResource.cs index a1f74147e663f..652e0c824ab8e 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetResource.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmAvailabilitySetResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ArcScVmm public partial class ScVmmAvailabilitySetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The availabilitySetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string availabilitySetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetName}"; diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudResource.cs index 62e74ac17faa2..079513c13deb7 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudResource.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmCloudResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ArcScVmm public partial class ScVmmCloudResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cloudName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cloudName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudName}"; diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerResource.cs index b8d3ba732e585..fecd11e3063ed 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerResource.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ArcScVmm public partial class ScVmmServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmmServerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmmServerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of InventoryItemResources and their operations over a InventoryItemResource. public virtual InventoryItemCollection GetInventoryItems() { - return GetCachedClient(Client => new InventoryItemCollection(Client, Id)); + return GetCachedClient(client => new InventoryItemCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual InventoryItemCollection GetInventoryItems() /// /// Name of the inventoryItem. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetInventoryItemAsync(string inventoryItemName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetInventoryItemAsync /// /// Name of the inventoryItem. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetInventoryItem(string inventoryItemName, CancellationToken cancellationToken = default) { diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineResource.cs index 664a0d9186ac3..7bffb292a3365 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineResource.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ArcScVmm public partial class ScVmmVirtualMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachines/{virtualMachineName}"; diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateResource.cs index 110a4bde5052a..bb76c2c869fc0 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateResource.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualMachineTemplateResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ArcScVmm public partial class ScVmmVirtualMachineTemplateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineTemplateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineTemplateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}"; diff --git a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkResource.cs index 41004fee35689..b0fdb20d05725 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkResource.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmVirtualNetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ArcScVmm public partial class ScVmmVirtualNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}"; diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs index 1c057f1843487..c10b2686321be 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs @@ -71,7 +71,7 @@ protected AttestationProviderCollection() { } } public partial class AttestationProviderData : Azure.ResourceManager.Models.TrackedResourceData { - public AttestationProviderData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AttestationProviderData(Azure.Core.AzureLocation location) { } public System.Uri AttestUri { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } @@ -104,6 +104,32 @@ protected AttestationProviderResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Attestation.Models.AttestationProviderPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Attestation.Mocking +{ + public partial class MockableAttestationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAttestationArmClient() { } + public virtual Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionResource GetAttestationPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Attestation.AttestationProviderResource GetAttestationProviderResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAttestationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAttestationResourceGroupResource() { } + public virtual Azure.Response GetAttestationProvider(string providerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAttestationProviderAsync(string providerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Attestation.AttestationProviderCollection GetAttestationProviders() { throw null; } + } + public partial class MockableAttestationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAttestationSubscriptionResource() { } + public virtual Azure.Pageable GetAttestationProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAttestationProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAttestationProvidersByDefaultProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAttestationProvidersByDefaultProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDefaultByLocationAttestationProvider(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDefaultByLocationAttestationProviderAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Attestation.Models { public static partial class ArmAttestationModelFactory diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.cs index 8c8a9bd25ceb5..eb7f1fb4e9a78 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Attestation public partial class AttestationPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The providerName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs index f29ea881582e3..694dd47a1275f 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Attestation public partial class AttestationProviderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The providerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AttestationPrivateEndpointConnectionResources and their operations over a AttestationPrivateEndpointConnectionResource. public virtual AttestationPrivateEndpointConnectionCollection GetAttestationPrivateEndpointConnections() { - return GetCachedClient(Client => new AttestationPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new AttestationPrivateEndpointConnectionCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual AttestationPrivateEndpointConnectionCollection GetAttestationPriv /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAttestationPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAttestationPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/AttestationExtensions.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/AttestationExtensions.cs index 2eb6d2f9fa274..287530942b9f5 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/AttestationExtensions.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/AttestationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Attestation.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Attestation @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.Attestation /// A class to add extension methods to Azure.ResourceManager.Attestation. public static partial class AttestationExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAttestationArmClient GetMockableAttestationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAttestationArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAttestationResourceGroupResource GetMockableAttestationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAttestationResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAttestationSubscriptionResource GetMockableAttestationSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAttestationSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AttestationProviderResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AttestationProviderResource GetAttestationProviderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AttestationProviderResource.ValidateResourceId(id); - return new AttestationProviderResource(client, id); - } - ); + return GetMockableAttestationArmClient(client).GetAttestationProviderResource(id); } - #endregion - #region AttestationPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AttestationPrivateEndpointConnectionResource GetAttestationPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AttestationPrivateEndpointConnectionResource.ValidateResourceId(id); - return new AttestationPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableAttestationArmClient(client).GetAttestationPrivateEndpointConnectionResource(id); } - #endregion - /// Gets a collection of AttestationProviderResources in the ResourceGroupResource. + /// + /// Gets a collection of AttestationProviderResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AttestationProviderResources and their operations over a AttestationProviderResource. public static AttestationProviderCollection GetAttestationProviders(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAttestationProviders(); + return GetMockableAttestationResourceGroupResource(resourceGroupResource).GetAttestationProviders(); } /// @@ -107,16 +92,20 @@ public static AttestationProviderCollection GetAttestationProviders(this Resourc /// AttestationProviders_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the attestation provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAttestationProviderAsync(this ResourceGroupResource resourceGroupResource, string providerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAttestationProviders().GetAsync(providerName, cancellationToken).ConfigureAwait(false); + return await GetMockableAttestationResourceGroupResource(resourceGroupResource).GetAttestationProviderAsync(providerName, cancellationToken).ConfigureAwait(false); } /// @@ -131,16 +120,20 @@ public static async Task> GetAttestationPr /// AttestationProviders_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the attestation provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAttestationProvider(this ResourceGroupResource resourceGroupResource, string providerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAttestationProviders().Get(providerName, cancellationToken); + return GetMockableAttestationResourceGroupResource(resourceGroupResource).GetAttestationProvider(providerName, cancellationToken); } /// @@ -155,13 +148,17 @@ public static Response GetAttestationProvider(this /// AttestationProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAttestationProvidersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAttestationProvidersAsync(cancellationToken); + return GetMockableAttestationSubscriptionResource(subscriptionResource).GetAttestationProvidersAsync(cancellationToken); } /// @@ -176,13 +173,17 @@ public static AsyncPageable GetAttestationProviders /// AttestationProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAttestationProviders(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAttestationProviders(cancellationToken); + return GetMockableAttestationSubscriptionResource(subscriptionResource).GetAttestationProviders(cancellationToken); } /// @@ -197,13 +198,17 @@ public static Pageable GetAttestationProviders(this /// AttestationProviders_ListDefault /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAttestationProvidersByDefaultProviderAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAttestationProvidersByDefaultProviderAsync(cancellationToken); + return GetMockableAttestationSubscriptionResource(subscriptionResource).GetAttestationProvidersByDefaultProviderAsync(cancellationToken); } /// @@ -218,13 +223,17 @@ public static AsyncPageable GetAttestationProviders /// AttestationProviders_ListDefault /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAttestationProvidersByDefaultProvider(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAttestationProvidersByDefaultProvider(cancellationToken); + return GetMockableAttestationSubscriptionResource(subscriptionResource).GetAttestationProvidersByDefaultProvider(cancellationToken); } /// @@ -239,13 +248,17 @@ public static Pageable GetAttestationProvidersByDef /// AttestationProviders_GetDefaultByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the default provider. /// The cancellation token to use. public static async Task> GetDefaultByLocationAttestationProviderAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetDefaultByLocationAttestationProviderAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableAttestationSubscriptionResource(subscriptionResource).GetDefaultByLocationAttestationProviderAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -260,13 +273,17 @@ public static async Task> GetDefaultByLoca /// AttestationProviders_GetDefaultByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the default provider. /// The cancellation token to use. public static Response GetDefaultByLocationAttestationProvider(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDefaultByLocationAttestationProvider(location, cancellationToken); + return GetMockableAttestationSubscriptionResource(subscriptionResource).GetDefaultByLocationAttestationProvider(location, cancellationToken); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationArmClient.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationArmClient.cs new file mode 100644 index 0000000000000..94468aa48695f --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAttestationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAttestationArmClient() + { + } + + /// 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 MockableAttestationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAttestationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AttestationProviderResource GetAttestationProviderResource(ResourceIdentifier id) + { + AttestationProviderResource.ValidateResourceId(id); + return new AttestationProviderResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AttestationPrivateEndpointConnectionResource GetAttestationPrivateEndpointConnectionResource(ResourceIdentifier id) + { + AttestationPrivateEndpointConnectionResource.ValidateResourceId(id); + return new AttestationPrivateEndpointConnectionResource(Client, id); + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationResourceGroupResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationResourceGroupResource.cs new file mode 100644 index 0000000000000..c388fb621aabe --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Attestation; + +namespace Azure.ResourceManager.Attestation.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAttestationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAttestationResourceGroupResource() + { + } + + /// 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 MockableAttestationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AttestationProviderResources in the ResourceGroupResource. + /// An object representing collection of AttestationProviderResources and their operations over a AttestationProviderResource. + public virtual AttestationProviderCollection GetAttestationProviders() + { + return GetCachedClient(client => new AttestationProviderCollection(client, Id)); + } + + /// + /// Get the status of Attestation Provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// + /// + /// Operation Id + /// AttestationProviders_Get + /// + /// + /// + /// Name of the attestation provider. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAttestationProviderAsync(string providerName, CancellationToken cancellationToken = default) + { + return await GetAttestationProviders().GetAsync(providerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the status of Attestation Provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// + /// + /// Operation Id + /// AttestationProviders_Get + /// + /// + /// + /// Name of the attestation provider. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAttestationProvider(string providerName, CancellationToken cancellationToken = default) + { + return GetAttestationProviders().Get(providerName, cancellationToken); + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationSubscriptionResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationSubscriptionResource.cs new file mode 100644 index 0000000000000..d46ee47c26aa3 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationSubscriptionResource.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAttestationSubscriptionResource : ArmResource + { + private ClientDiagnostics _attestationProviderClientDiagnostics; + private AttestationProvidersRestOperations _attestationProviderRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAttestationSubscriptionResource() + { + } + + /// 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 MockableAttestationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AttestationProviderClientDiagnostics => _attestationProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Attestation", AttestationProviderResource.ResourceType.Namespace, Diagnostics); + private AttestationProvidersRestOperations AttestationProviderRestClient => _attestationProviderRestClient ??= new AttestationProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AttestationProviderResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns a list of attestation providers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders + /// + /// + /// Operation Id + /// AttestationProviders_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAttestationProvidersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "MockableAttestationSubscriptionResource.GetAttestationProviders", "value", null, cancellationToken); + } + + /// + /// Returns a list of attestation providers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders + /// + /// + /// Operation Id + /// AttestationProviders_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAttestationProviders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "MockableAttestationSubscriptionResource.GetAttestationProviders", "value", null, cancellationToken); + } + + /// + /// Get the default provider + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders + /// + /// + /// Operation Id + /// AttestationProviders_ListDefault + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAttestationProvidersByDefaultProviderAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListDefaultRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "MockableAttestationSubscriptionResource.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); + } + + /// + /// Get the default provider + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders + /// + /// + /// Operation Id + /// AttestationProviders_ListDefault + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAttestationProvidersByDefaultProvider(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListDefaultRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "MockableAttestationSubscriptionResource.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); + } + + /// + /// Get the default provider by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider + /// + /// + /// Operation Id + /// AttestationProviders_GetDefaultByLocation + /// + /// + /// + /// The location of the default provider. + /// The cancellation token to use. + public virtual async Task> GetDefaultByLocationAttestationProviderAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = AttestationProviderClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetDefaultByLocationAttestationProvider"); + scope.Start(); + try + { + var response = await AttestationProviderRestClient.GetDefaultByLocationAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default provider by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider + /// + /// + /// Operation Id + /// AttestationProviders_GetDefaultByLocation + /// + /// + /// + /// The location of the default provider. + /// The cancellation token to use. + public virtual Response GetDefaultByLocationAttestationProvider(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = AttestationProviderClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetDefaultByLocationAttestationProvider"); + scope.Start(); + try + { + var response = AttestationProviderRestClient.GetDefaultByLocation(Id.SubscriptionId, location, cancellationToken); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d6350d52e2ffe..0000000000000 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Attestation -{ - /// 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 AttestationProviderResources in the ResourceGroupResource. - /// An object representing collection of AttestationProviderResources and their operations over a AttestationProviderResource. - public virtual AttestationProviderCollection GetAttestationProviders() - { - return GetCachedClient(Client => new AttestationProviderCollection(Client, Id)); - } - } -} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index feff75ddea9da..0000000000000 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Attestation -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _attestationProviderClientDiagnostics; - private AttestationProvidersRestOperations _attestationProviderRestClient; - - /// 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 AttestationProviderClientDiagnostics => _attestationProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Attestation", AttestationProviderResource.ResourceType.Namespace, Diagnostics); - private AttestationProvidersRestOperations AttestationProviderRestClient => _attestationProviderRestClient ??= new AttestationProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AttestationProviderResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns a list of attestation providers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders - /// - /// - /// Operation Id - /// AttestationProviders_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAttestationProvidersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProviders", "value", null, cancellationToken); - } - - /// - /// Returns a list of attestation providers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders - /// - /// - /// Operation Id - /// AttestationProviders_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAttestationProviders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProviders", "value", null, cancellationToken); - } - - /// - /// Get the default provider - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders - /// - /// - /// Operation Id - /// AttestationProviders_ListDefault - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAttestationProvidersByDefaultProviderAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListDefaultRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); - } - - /// - /// Get the default provider - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders - /// - /// - /// Operation Id - /// AttestationProviders_ListDefault - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAttestationProvidersByDefaultProvider(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListDefaultRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); - } - - /// - /// Get the default provider by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider - /// - /// - /// Operation Id - /// AttestationProviders_GetDefaultByLocation - /// - /// - /// - /// The location of the default provider. - /// The cancellation token to use. - public virtual async Task> GetDefaultByLocationAttestationProviderAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = AttestationProviderClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetDefaultByLocationAttestationProvider"); - scope.Start(); - try - { - var response = await AttestationProviderRestClient.GetDefaultByLocationAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the default provider by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider - /// - /// - /// Operation Id - /// AttestationProviders_GetDefaultByLocation - /// - /// - /// - /// The location of the default provider. - /// The cancellation token to use. - public virtual Response GetDefaultByLocationAttestationProvider(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = AttestationProviderClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetDefaultByLocationAttestationProvider"); - scope.Start(); - try - { - var response = AttestationProviderRestClient.GetDefaultByLocation(Id.SubscriptionId, location, cancellationToken); - return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/Azure.ResourceManager.Authorization.sln b/sdk/authorization/Azure.ResourceManager.Authorization/Azure.ResourceManager.Authorization.sln index 358e101288431..dfdd3541d0447 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/Azure.ResourceManager.Authorization.sln +++ b/sdk/authorization/Azure.ResourceManager.Authorization/Azure.ResourceManager.Authorization.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{69D366FC-0520-49EE-8222-69CBAA6EE34F}") = "Azure.ResourceManager.Authorization", "src\Azure.ResourceManager.Authorization.csproj", "{C6DE6182-C96E-47A2-9EFF-580413BC03DA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Authorization", "src\Azure.ResourceManager.Authorization.csproj", "{C6DE6182-C96E-47A2-9EFF-580413BC03DA}" EndProject -Project("{69D366FC-0520-49EE-8222-69CBAA6EE34F}") = "Azure.ResourceManager.Authorization.Tests", "tests\Azure.ResourceManager.Authorization.Tests.csproj", "{FAC8AF17-FF76-4D99-B0D9-A7B7D73977A3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Authorization.Tests", "tests\Azure.ResourceManager.Authorization.Tests.csproj", "{FAC8AF17-FF76-4D99-B0D9-A7B7D73977A3}" EndProject -Project("{69D366FC-0520-49EE-8222-69CBAA6EE34F}") = "Azure.ResourceManager.Authorization.Samples", "samples\Azure.ResourceManager.Authorization.Samples.csproj", "{712FF3EC-BBBD-41AE-A669-F09F913A1348}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Authorization.Samples", "samples\Azure.ResourceManager.Authorization.Samples.csproj", "{712FF3EC-BBBD-41AE-A669-F09F913A1348}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {69102F5E-2B0C-4B4E-B182-4F9228CC3EEF} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {FAC8AF17-FF76-4D99-B0D9-A7B7D73977A3}.Release|x64.Build.0 = Release|Any CPU {FAC8AF17-FF76-4D99-B0D9-A7B7D73977A3}.Release|x86.ActiveCfg = Release|Any CPU {FAC8AF17-FF76-4D99-B0D9-A7B7D73977A3}.Release|x86.Build.0 = Release|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Debug|Any CPU.Build.0 = Debug|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Debug|x64.ActiveCfg = Debug|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Debug|x64.Build.0 = Debug|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Debug|x86.ActiveCfg = Debug|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Debug|x86.Build.0 = Debug|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Release|Any CPU.ActiveCfg = Release|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Release|Any CPU.Build.0 = Release|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Release|x64.ActiveCfg = Release|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Release|x64.Build.0 = Release|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Release|x86.ActiveCfg = Release|Any CPU + {712FF3EC-BBBD-41AE-A669-F09F913A1348}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {69102F5E-2B0C-4B4E-B182-4F9228CC3EEF} EndGlobalSection EndGlobal diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/api/Azure.ResourceManager.Authorization.netstandard2.0.cs b/sdk/authorization/Azure.ResourceManager.Authorization/api/Azure.ResourceManager.Authorization.netstandard2.0.cs index b01555959ae76..eba122ae683c6 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/api/Azure.ResourceManager.Authorization.netstandard2.0.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/api/Azure.ResourceManager.Authorization.netstandard2.0.cs @@ -620,6 +620,120 @@ protected RoleManagementPolicyResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Authorization.RoleManagementPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Authorization.Mocking +{ + public partial class MockableAuthorizationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAuthorizationArmClient() { } + public virtual Azure.ResourceManager.Authorization.AuthorizationProviderOperationsMetadataResource GetAuthorizationProviderOperationsMetadataResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetAuthorizationRoleDefinition(Azure.Core.ResourceIdentifier scope, Azure.Core.ResourceIdentifier roleDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAuthorizationRoleDefinitionAsync(Azure.Core.ResourceIdentifier scope, Azure.Core.ResourceIdentifier roleDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.AuthorizationRoleDefinitionResource GetAuthorizationRoleDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefinitions(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetDenyAssignment(Azure.Core.ResourceIdentifier scope, string denyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDenyAssignmentAsync(Azure.Core.ResourceIdentifier scope, string denyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.DenyAssignmentResource GetDenyAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.DenyAssignmentCollection GetDenyAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetEligibleChildResources(Azure.Core.ResourceIdentifier scope, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEligibleChildResourcesAsync(Azure.Core.ResourceIdentifier scope, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRoleAssignment(Azure.Core.ResourceIdentifier scope, string roleAssignmentName, string tenantId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentAsync(Azure.Core.ResourceIdentifier scope, string roleAssignmentName, string tenantId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentResource GetRoleAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentCollection GetRoleAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetRoleAssignmentSchedule(Azure.Core.ResourceIdentifier scope, string roleAssignmentScheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentScheduleAsync(Azure.Core.ResourceIdentifier scope, string roleAssignmentScheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRoleAssignmentScheduleInstance(Azure.Core.ResourceIdentifier scope, string roleAssignmentScheduleInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentScheduleInstanceAsync(Azure.Core.ResourceIdentifier scope, string roleAssignmentScheduleInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleInstanceResource GetRoleAssignmentScheduleInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleInstanceCollection GetRoleAssignmentScheduleInstances(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetRoleAssignmentScheduleRequest(Azure.Core.ResourceIdentifier scope, string roleAssignmentScheduleRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentScheduleRequestAsync(Azure.Core.ResourceIdentifier scope, string roleAssignmentScheduleRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleRequestResource GetRoleAssignmentScheduleRequestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleRequests(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleResource GetRoleAssignmentScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleCollection GetRoleAssignmentSchedules(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetRoleEligibilitySchedule(Azure.Core.ResourceIdentifier scope, string roleEligibilityScheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleEligibilityScheduleAsync(Azure.Core.ResourceIdentifier scope, string roleEligibilityScheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRoleEligibilityScheduleInstance(Azure.Core.ResourceIdentifier scope, string roleEligibilityScheduleInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleEligibilityScheduleInstanceAsync(Azure.Core.ResourceIdentifier scope, string roleEligibilityScheduleInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleInstanceResource GetRoleEligibilityScheduleInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleInstanceCollection GetRoleEligibilityScheduleInstances(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetRoleEligibilityScheduleRequest(Azure.Core.ResourceIdentifier scope, string roleEligibilityScheduleRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleEligibilityScheduleRequestAsync(Azure.Core.ResourceIdentifier scope, string roleEligibilityScheduleRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleRequestResource GetRoleEligibilityScheduleRequestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleRequestCollection GetRoleEligibilityScheduleRequests(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleResource GetRoleEligibilityScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleCollection GetRoleEligibilitySchedules(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleManagementPolicyCollection GetRoleManagementPolicies(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetRoleManagementPolicy(Azure.Core.ResourceIdentifier scope, string roleManagementPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRoleManagementPolicyAssignment(Azure.Core.ResourceIdentifier scope, string roleManagementPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleManagementPolicyAssignmentAsync(Azure.Core.ResourceIdentifier scope, string roleManagementPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleManagementPolicyAssignmentResource GetRoleManagementPolicyAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleManagementPolicyAsync(Azure.Core.ResourceIdentifier scope, string roleManagementPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleManagementPolicyResource GetRoleManagementPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAuthorizationArmResource : Azure.ResourceManager.ArmResource + { + protected MockableAuthorizationArmResource() { } + public virtual Azure.Response GetAuthorizationRoleDefinition(Azure.Core.ResourceIdentifier roleDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAuthorizationRoleDefinitionAsync(Azure.Core.ResourceIdentifier roleDefinitionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefinitions() { throw null; } + public virtual Azure.Response GetDenyAssignment(string denyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDenyAssignmentAsync(string denyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.DenyAssignmentCollection GetDenyAssignments() { throw null; } + public virtual Azure.Response GetRoleAssignment(string roleAssignmentName, string tenantId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentAsync(string roleAssignmentName, string tenantId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentCollection GetRoleAssignments() { throw null; } + public virtual Azure.Response GetRoleAssignmentSchedule(string roleAssignmentScheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentScheduleAsync(string roleAssignmentScheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRoleAssignmentScheduleInstance(string roleAssignmentScheduleInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentScheduleInstanceAsync(string roleAssignmentScheduleInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleInstanceCollection GetRoleAssignmentScheduleInstances() { throw null; } + public virtual Azure.Response GetRoleAssignmentScheduleRequest(string roleAssignmentScheduleRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleAssignmentScheduleRequestAsync(string roleAssignmentScheduleRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleRequests() { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleAssignmentScheduleCollection GetRoleAssignmentSchedules() { throw null; } + public virtual Azure.Response GetRoleEligibilitySchedule(string roleEligibilityScheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleEligibilityScheduleAsync(string roleEligibilityScheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRoleEligibilityScheduleInstance(string roleEligibilityScheduleInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleEligibilityScheduleInstanceAsync(string roleEligibilityScheduleInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleInstanceCollection GetRoleEligibilityScheduleInstances() { throw null; } + public virtual Azure.Response GetRoleEligibilityScheduleRequest(string roleEligibilityScheduleRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleEligibilityScheduleRequestAsync(string roleEligibilityScheduleRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleRequestCollection GetRoleEligibilityScheduleRequests() { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleEligibilityScheduleCollection GetRoleEligibilitySchedules() { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleManagementPolicyCollection GetRoleManagementPolicies() { throw null; } + public virtual Azure.Response GetRoleManagementPolicy(string roleManagementPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRoleManagementPolicyAssignment(string roleManagementPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleManagementPolicyAssignmentAsync(string roleManagementPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAssignments() { throw null; } + public virtual System.Threading.Tasks.Task> GetRoleManagementPolicyAsync(string roleManagementPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAuthorizationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAuthorizationResourceGroupResource() { } + public virtual Azure.Pageable GetAzurePermissionsForResourceGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAzurePermissionsForResourceGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAzurePermissionsForResources(string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAzurePermissionsForResourcesAsync(string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAuthorizationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAuthorizationSubscriptionResource() { } + public virtual Azure.Pageable GetClassicAdministrators(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetClassicAdministratorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAuthorizationTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableAuthorizationTenantResource() { } + public virtual Azure.Response ElevateAccessGlobalAdministrator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ElevateAccessGlobalAdministratorAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Authorization.AuthorizationProviderOperationsMetadataCollection GetAllAuthorizationProviderOperationsMetadata() { throw null; } + public virtual Azure.Response GetAuthorizationProviderOperationsMetadata(string resourceProviderNamespace, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAuthorizationProviderOperationsMetadataAsync(string resourceProviderNamespace, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Authorization.Models { public static partial class ArmAuthorizationModelFactory diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_ArmResourceExtensions.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_ArmResourceExtensions.cs deleted file mode 100644 index cd8ab4c9bd348..0000000000000 --- a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_ArmResourceExtensions.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager; -using Azure.ResourceManager.Authorization.Models; - -namespace Azure.ResourceManager.Authorization.Samples -{ - public partial class Sample_ArmResourceExtensions - { - // GetEligibleChildResourcesByScope - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetEligibleChildResources_GetEligibleChildResourcesByScope() - { - // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetEligibleChildResourcesByScope.json - // this example is just showing the usage of "EligibleChildResources_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // invoke the operation and iterate over the result - string scope = "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"; - ResourceIdentifier scope0 = new ResourceIdentifier(string.Format("/{0}", scope)); - string filter = "resourceType+eq+'resourcegroup'"; - await foreach (EligibleChildResource item in client.GetEligibleChildResourcesAsync(scope0, filter: filter)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine($"Succeeded"); - } - } -} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataResource.cs index 6aee4d5835907..212a55d69a2df 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationProviderOperationsMetadataResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.Authorization public partial class AuthorizationProviderOperationsMetadataResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceProviderNamespace. public static ResourceIdentifier CreateResourceIdentifier(string resourceProviderNamespace) { var resourceId = $"/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionResource.cs index 14ec4369261e9..d5a8148f48a06 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/AuthorizationRoleDefinitionResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class AuthorizationRoleDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleDefinitionId. public static ResourceIdentifier CreateResourceIdentifier(string scope, ResourceIdentifier roleDefinitionId) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentResource.cs index 1f6c3685484a0..9847f76f8a934 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/DenyAssignmentResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class DenyAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The denyAssignmentId. public static ResourceIdentifier CreateResourceIdentifier(string scope, string denyAssignmentId) { var resourceId = $"{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 3022e42d44c9e..0000000000000 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Authorization.Models; - -namespace Azure.ResourceManager.Authorization -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _eligibleChildResourcesClientDiagnostics; - private EligibleChildResourcesRestOperations _eligibleChildResourcesRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics EligibleChildResourcesClientDiagnostics => _eligibleChildResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EligibleChildResourcesRestOperations EligibleChildResourcesRestClient => _eligibleChildResourcesRestClient ??= new EligibleChildResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DenyAssignmentResources in the ArmResource. - /// An object representing collection of DenyAssignmentResources and their operations over a DenyAssignmentResource. - public virtual DenyAssignmentCollection GetDenyAssignments() - { - return GetCachedClient(Client => new DenyAssignmentCollection(Client, Id)); - } - - /// Gets a collection of RoleAssignmentResources in the ArmResource. - /// An object representing collection of RoleAssignmentResources and their operations over a RoleAssignmentResource. - public virtual RoleAssignmentCollection GetRoleAssignments() - { - return GetCachedClient(Client => new RoleAssignmentCollection(Client, Id)); - } - - /// Gets a collection of AuthorizationRoleDefinitionResources in the ArmResource. - /// An object representing collection of AuthorizationRoleDefinitionResources and their operations over a AuthorizationRoleDefinitionResource. - public virtual AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefinitions() - { - return GetCachedClient(Client => new AuthorizationRoleDefinitionCollection(Client, Id)); - } - - /// Gets a collection of RoleAssignmentScheduleResources in the ArmResource. - /// An object representing collection of RoleAssignmentScheduleResources and their operations over a RoleAssignmentScheduleResource. - public virtual RoleAssignmentScheduleCollection GetRoleAssignmentSchedules() - { - return GetCachedClient(Client => new RoleAssignmentScheduleCollection(Client, Id)); - } - - /// Gets a collection of RoleAssignmentScheduleInstanceResources in the ArmResource. - /// An object representing collection of RoleAssignmentScheduleInstanceResources and their operations over a RoleAssignmentScheduleInstanceResource. - public virtual RoleAssignmentScheduleInstanceCollection GetRoleAssignmentScheduleInstances() - { - return GetCachedClient(Client => new RoleAssignmentScheduleInstanceCollection(Client, Id)); - } - - /// Gets a collection of RoleAssignmentScheduleRequestResources in the ArmResource. - /// An object representing collection of RoleAssignmentScheduleRequestResources and their operations over a RoleAssignmentScheduleRequestResource. - public virtual RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleRequests() - { - return GetCachedClient(Client => new RoleAssignmentScheduleRequestCollection(Client, Id)); - } - - /// Gets a collection of RoleEligibilityScheduleResources in the ArmResource. - /// An object representing collection of RoleEligibilityScheduleResources and their operations over a RoleEligibilityScheduleResource. - public virtual RoleEligibilityScheduleCollection GetRoleEligibilitySchedules() - { - return GetCachedClient(Client => new RoleEligibilityScheduleCollection(Client, Id)); - } - - /// Gets a collection of RoleEligibilityScheduleInstanceResources in the ArmResource. - /// An object representing collection of RoleEligibilityScheduleInstanceResources and their operations over a RoleEligibilityScheduleInstanceResource. - public virtual RoleEligibilityScheduleInstanceCollection GetRoleEligibilityScheduleInstances() - { - return GetCachedClient(Client => new RoleEligibilityScheduleInstanceCollection(Client, Id)); - } - - /// Gets a collection of RoleEligibilityScheduleRequestResources in the ArmResource. - /// An object representing collection of RoleEligibilityScheduleRequestResources and their operations over a RoleEligibilityScheduleRequestResource. - public virtual RoleEligibilityScheduleRequestCollection GetRoleEligibilityScheduleRequests() - { - return GetCachedClient(Client => new RoleEligibilityScheduleRequestCollection(Client, Id)); - } - - /// Gets a collection of RoleManagementPolicyResources in the ArmResource. - /// An object representing collection of RoleManagementPolicyResources and their operations over a RoleManagementPolicyResource. - public virtual RoleManagementPolicyCollection GetRoleManagementPolicies() - { - return GetCachedClient(Client => new RoleManagementPolicyCollection(Client, Id)); - } - - /// Gets a collection of RoleManagementPolicyAssignmentResources in the ArmResource. - /// An object representing collection of RoleManagementPolicyAssignmentResources and their operations over a RoleManagementPolicyAssignmentResource. - public virtual RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAssignments() - { - return GetCachedClient(Client => new RoleManagementPolicyAssignmentCollection(Client, Id)); - } - - /// - /// Get the child resources of a resource on which user has eligible access - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/eligibleChildResources - /// - /// - /// Operation Id - /// EligibleChildResources_Get - /// - /// - /// - /// The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. Use $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' or 'ResourceGroup'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEligibleChildResourcesAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EligibleChildResourcesRestClient.CreateGetRequest(Id, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EligibleChildResourcesRestClient.CreateGetNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EligibleChildResource.DeserializeEligibleChildResource, EligibleChildResourcesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetEligibleChildResources", "value", "nextLink", cancellationToken); - } - - /// - /// Get the child resources of a resource on which user has eligible access - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/eligibleChildResources - /// - /// - /// Operation Id - /// EligibleChildResources_Get - /// - /// - /// - /// The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. Use $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' or 'ResourceGroup'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEligibleChildResources(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EligibleChildResourcesRestClient.CreateGetRequest(Id, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EligibleChildResourcesRestClient.CreateGetNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EligibleChildResource.DeserializeEligibleChildResource, EligibleChildResourcesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetEligibleChildResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/AuthorizationExtensions.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/AuthorizationExtensions.cs index 04f0656d20a84..17e78c1f633c9 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/AuthorizationExtensions.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/AuthorizationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Authorization.Mocking; using Azure.ResourceManager.Authorization.Models; using Azure.ResourceManager.Resources; @@ -19,312 +20,1088 @@ namespace Azure.ResourceManager.Authorization /// A class to add extension methods to Azure.ResourceManager.Authorization. public static partial class AuthorizationExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableAuthorizationArmClient GetMockableAuthorizationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAuthorizationArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAuthorizationArmResource GetMockableAuthorizationArmResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAuthorizationArmResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAuthorizationResourceGroupResource GetMockableAuthorizationResourceGroupResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAuthorizationResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAuthorizationSubscriptionResource GetMockableAuthorizationSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAuthorizationSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAuthorizationTenantResource GetMockableAuthorizationTenantResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAuthorizationTenantResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + /// + /// Gets a collection of DenyAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of DenyAssignmentResources and their operations over a DenyAssignmentResource. + public static DenyAssignmentCollection GetDenyAssignments(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetDenyAssignments(scope); + } + + /// + /// Get the specified deny assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} + /// + /// + /// Operation Id + /// DenyAssignments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The ID of the deny assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDenyAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string denyAssignmentId, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetDenyAssignmentAsync(scope, denyAssignmentId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified deny assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} + /// + /// + /// Operation Id + /// DenyAssignments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The ID of the deny assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDenyAssignment(this ArmClient client, ResourceIdentifier scope, string denyAssignmentId, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetDenyAssignment(scope, denyAssignmentId, cancellationToken); + } + + /// + /// Gets a collection of RoleAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleAssignmentResources and their operations over a RoleAssignmentResource. + public static RoleAssignmentCollection GetRoleAssignments(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleAssignments(scope); + } + + /// + /// Get a role assignment by scope and name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of the role assignment. It can be any valid GUID. + /// Tenant ID for cross-tenant request. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static async Task> GetRoleAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleAssignmentAsync(scope, roleAssignmentName, tenantId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a role assignment by scope and name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of the role assignment. It can be any valid GUID. + /// Tenant ID for cross-tenant request. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static Response GetRoleAssignment(this ArmClient client, ResourceIdentifier scope, string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleAssignment(scope, roleAssignmentName, tenantId, cancellationToken); + } + + /// + /// Gets a collection of AuthorizationRoleDefinitionResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of AuthorizationRoleDefinitionResources and their operations over a AuthorizationRoleDefinitionResource. + public static AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefinitions(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetAuthorizationRoleDefinitions(scope); + } + + /// + /// Get role definition by name (GUID). + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// RoleDefinitions_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The ID of the role definition. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static async Task> GetAuthorizationRoleDefinitionAsync(this ArmClient client, ResourceIdentifier scope, ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetAuthorizationRoleDefinitionAsync(scope, roleDefinitionId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get role definition by name (GUID). + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// RoleDefinitions_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The ID of the role definition. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static Response GetAuthorizationRoleDefinition(this ArmClient client, ResourceIdentifier scope, ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetAuthorizationRoleDefinition(scope, roleDefinitionId, cancellationToken); + } + + /// + /// Gets a collection of RoleAssignmentScheduleResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleAssignmentScheduleResources and their operations over a RoleAssignmentScheduleResource. + public static RoleAssignmentScheduleCollection GetRoleAssignmentSchedules(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentSchedules(scope); + } + + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} + /// + /// + /// Operation Id + /// RoleAssignmentSchedules_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRoleAssignmentScheduleAsync(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleAsync(scope, roleAssignmentScheduleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} + /// + /// + /// Operation Id + /// RoleAssignmentSchedules_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRoleAssignmentSchedule(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentSchedule(scope, roleAssignmentScheduleName, cancellationToken); + } + + /// + /// Gets a collection of RoleAssignmentScheduleInstanceResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleAssignmentScheduleInstanceResources and their operations over a RoleAssignmentScheduleInstanceResource. + public static RoleAssignmentScheduleInstanceCollection GetRoleAssignmentScheduleInstances(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleInstances(scope); + } + + /// + /// Gets the specified role assignment schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleInstances_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (hash of schedule name + time) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRoleAssignmentScheduleInstanceAsync(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleInstanceAsync(scope, roleAssignmentScheduleInstanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified role assignment schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleInstances_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (hash of schedule name + time) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRoleAssignmentScheduleInstance(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleInstance(scope, roleAssignmentScheduleInstanceName, cancellationToken); + } + + /// + /// Gets a collection of RoleAssignmentScheduleRequestResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleAssignmentScheduleRequestResources and their operations over a RoleAssignmentScheduleRequestResource. + public static RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleRequests(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleRequests(scope); + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleRequests_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role assignment schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRoleAssignmentScheduleRequestAsync(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleRequestAsync(scope, roleAssignmentScheduleRequestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleRequests_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role assignment schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRoleAssignmentScheduleRequest(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleRequest(scope, roleAssignmentScheduleRequestName, cancellationToken); + } + + /// + /// Gets a collection of RoleEligibilityScheduleResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleEligibilityScheduleResources and their operations over a RoleEligibilityScheduleResource. + public static RoleEligibilityScheduleCollection GetRoleEligibilitySchedules(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleEligibilitySchedules(scope); + } + + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} + /// + /// + /// Operation Id + /// RoleEligibilitySchedules_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRoleEligibilityScheduleAsync(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleName, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleAsync(scope, roleEligibilityScheduleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} + /// + /// + /// Operation Id + /// RoleEligibilitySchedules_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRoleEligibilitySchedule(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleName, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleEligibilitySchedule(scope, roleEligibilityScheduleName, cancellationToken); + } + + /// + /// Gets a collection of RoleEligibilityScheduleInstanceResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleEligibilityScheduleInstanceResources and their operations over a RoleEligibilityScheduleInstanceResource. + public static RoleEligibilityScheduleInstanceCollection GetRoleEligibilityScheduleInstances(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleInstances(scope); + } + + /// + /// Gets the specified role eligibility schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleInstances_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (hash of schedule name + time) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRoleEligibilityScheduleInstanceAsync(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleInstanceAsync(scope, roleEligibilityScheduleInstanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified role eligibility schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleInstances_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (hash of schedule name + time) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRoleEligibilityScheduleInstance(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleInstance(scope, roleEligibilityScheduleInstanceName, cancellationToken); + } + + /// + /// Gets a collection of RoleEligibilityScheduleRequestResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleEligibilityScheduleRequestResources and their operations over a RoleEligibilityScheduleRequestResource. + public static RoleEligibilityScheduleRequestCollection GetRoleEligibilityScheduleRequests(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleRequests(scope); + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleRequests_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role eligibility schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRoleEligibilityScheduleRequestAsync(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleRequestAsync(scope, roleEligibilityScheduleRequestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleRequests_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role eligibility schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRoleEligibilityScheduleRequest(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleRequest(scope, roleEligibilityScheduleRequestName, cancellationToken); + } + + /// + /// Gets a collection of RoleManagementPolicyResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleManagementPolicyResources and their operations over a RoleManagementPolicyResource. + public static RoleManagementPolicyCollection GetRoleManagementPolicies(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleManagementPolicies(scope); + } + + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} + /// + /// + /// Operation Id + /// RoleManagementPolicies_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role management policy to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRoleManagementPolicyAsync(this ArmClient client, ResourceIdentifier scope, string roleManagementPolicyName, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleManagementPolicyAsync(scope, roleManagementPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} + /// + /// + /// Operation Id + /// RoleManagementPolicies_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name (guid) of the role management policy to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRoleManagementPolicy(this ArmClient client, ResourceIdentifier scope, string roleManagementPolicyName, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleManagementPolicy(scope, roleManagementPolicyName, cancellationToken); + } + + /// + /// Gets a collection of RoleManagementPolicyAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of RoleManagementPolicyAssignmentResources and their operations over a RoleManagementPolicyAssignmentResource. + public static RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAssignments(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableAuthorizationArmClient(client).GetRoleManagementPolicyAssignments(scope); + } + + /// + /// Get the specified role management policy assignment for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} + /// + /// + /// Operation Id + /// RoleManagementPolicyAssignments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of format {guid_guid} the role management policy assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRoleManagementPolicyAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) + { + return await GetMockableAuthorizationArmClient(client).GetRoleManagementPolicyAssignmentAsync(scope, roleManagementPolicyAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role management policy assignment for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} + /// + /// + /// Operation Id + /// RoleManagementPolicyAssignments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of format {guid_guid} the role management policy assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRoleManagementPolicyAssignment(this ArmClient client, ResourceIdentifier scope, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) + { + return GetMockableAuthorizationArmClient(client).GetRoleManagementPolicyAssignment(scope, roleManagementPolicyAssignmentName, cancellationToken); + } + + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/eligibleChildResources + /// + /// + /// Operation Id + /// EligibleChildResources_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. Use $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' or 'ResourceGroup'. + /// The cancellation token to use. + public static AsyncPageable GetEligibleChildResourcesAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return GetMockableAuthorizationArmClient(client).GetEligibleChildResourcesAsync(scope, filter, cancellationToken); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/eligibleChildResources + /// + /// + /// Operation Id + /// EligibleChildResources_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. Use $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' or 'ResourceGroup'. + /// The cancellation token to use. + public static Pageable GetEligibleChildResources(this ArmClient client, ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return GetMockableAuthorizationArmClient(client).GetEligibleChildResources(scope, filter, cancellationToken); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region DenyAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DenyAssignmentResource GetDenyAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DenyAssignmentResource.ValidateResourceId(id); - return new DenyAssignmentResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetDenyAssignmentResource(id); } - #endregion - #region AuthorizationProviderOperationsMetadataResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AuthorizationProviderOperationsMetadataResource GetAuthorizationProviderOperationsMetadataResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AuthorizationProviderOperationsMetadataResource.ValidateResourceId(id); - return new AuthorizationProviderOperationsMetadataResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetAuthorizationProviderOperationsMetadataResource(id); } - #endregion - #region RoleAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleAssignmentResource GetRoleAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleAssignmentResource.ValidateResourceId(id); - return new RoleAssignmentResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentResource(id); } - #endregion - #region AuthorizationRoleDefinitionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AuthorizationRoleDefinitionResource GetAuthorizationRoleDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AuthorizationRoleDefinitionResource.ValidateResourceId(id); - return new AuthorizationRoleDefinitionResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetAuthorizationRoleDefinitionResource(id); } - #endregion - #region RoleAssignmentScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleAssignmentScheduleResource GetRoleAssignmentScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleAssignmentScheduleResource.ValidateResourceId(id); - return new RoleAssignmentScheduleResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleResource(id); } - #endregion - #region RoleAssignmentScheduleInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleAssignmentScheduleInstanceResource GetRoleAssignmentScheduleInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleAssignmentScheduleInstanceResource.ValidateResourceId(id); - return new RoleAssignmentScheduleInstanceResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleInstanceResource(id); } - #endregion - #region RoleAssignmentScheduleRequestResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleAssignmentScheduleRequestResource GetRoleAssignmentScheduleRequestResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleAssignmentScheduleRequestResource.ValidateResourceId(id); - return new RoleAssignmentScheduleRequestResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleAssignmentScheduleRequestResource(id); } - #endregion - #region RoleEligibilityScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleEligibilityScheduleResource GetRoleEligibilityScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleEligibilityScheduleResource.ValidateResourceId(id); - return new RoleEligibilityScheduleResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleResource(id); } - #endregion - #region RoleEligibilityScheduleInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleEligibilityScheduleInstanceResource GetRoleEligibilityScheduleInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleEligibilityScheduleInstanceResource.ValidateResourceId(id); - return new RoleEligibilityScheduleInstanceResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleInstanceResource(id); } - #endregion - #region RoleEligibilityScheduleRequestResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleEligibilityScheduleRequestResource GetRoleEligibilityScheduleRequestResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleEligibilityScheduleRequestResource.ValidateResourceId(id); - return new RoleEligibilityScheduleRequestResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleEligibilityScheduleRequestResource(id); } - #endregion - #region RoleManagementPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleManagementPolicyResource GetRoleManagementPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleManagementPolicyResource.ValidateResourceId(id); - return new RoleManagementPolicyResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleManagementPolicyResource(id); } - #endregion - #region RoleManagementPolicyAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleManagementPolicyAssignmentResource GetRoleManagementPolicyAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleManagementPolicyAssignmentResource.ValidateResourceId(id); - return new RoleManagementPolicyAssignmentResource(client, id); - } - ); + return GetMockableAuthorizationArmClient(client).GetRoleManagementPolicyAssignmentResource(id); } - #endregion - /// Gets a collection of DenyAssignmentResources in the ArmResource. + /// + /// Gets a collection of DenyAssignmentResources in the ArmResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DenyAssignmentResources and their operations over a DenyAssignmentResource. public static DenyAssignmentCollection GetDenyAssignments(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetDenyAssignments(); - } - - /// Gets a collection of DenyAssignmentResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of DenyAssignmentResources and their operations over a DenyAssignmentResource. - public static DenyAssignmentCollection GetDenyAssignments(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetDenyAssignments(); + return GetMockableAuthorizationArmResource(armResource).GetDenyAssignments(); } /// @@ -339,16 +1116,20 @@ public static DenyAssignmentCollection GetDenyAssignments(this ArmClient client, /// DenyAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID of the deny assignment to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDenyAssignmentAsync(this ArmResource armResource, string denyAssignmentId, CancellationToken cancellationToken = default) { - return await armResource.GetDenyAssignments().GetAsync(denyAssignmentId, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetDenyAssignmentAsync(denyAssignmentId, cancellationToken).ConfigureAwait(false); } /// @@ -363,83 +1144,34 @@ public static async Task> GetDenyAssignmentAsyn /// DenyAssignments_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The ID of the deny assignment to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetDenyAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string denyAssignmentId, CancellationToken cancellationToken = default) - { - return await client.GetDenyAssignments(scope).GetAsync(denyAssignmentId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the specified deny assignment. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} - /// /// - /// Operation Id - /// DenyAssignments_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The ID of the deny assignment to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDenyAssignment(this ArmResource armResource, string denyAssignmentId, CancellationToken cancellationToken = default) { - return armResource.GetDenyAssignments().Get(denyAssignmentId, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetDenyAssignment(denyAssignmentId, cancellationToken); } /// - /// Get the specified deny assignment. - /// + /// Gets a collection of RoleAssignmentResources in the ArmResource. /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} - /// - /// - /// Operation Id - /// DenyAssignments_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The ID of the deny assignment to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetDenyAssignment(this ArmClient client, ResourceIdentifier scope, string denyAssignmentId, CancellationToken cancellationToken = default) - { - return client.GetDenyAssignments(scope).Get(denyAssignmentId, cancellationToken); - } - - /// Gets a collection of RoleAssignmentResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of RoleAssignmentResources and their operations over a RoleAssignmentResource. public static RoleAssignmentCollection GetRoleAssignments(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetRoleAssignments(); - } - - /// Gets a collection of RoleAssignmentResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleAssignmentResources and their operations over a RoleAssignmentResource. - public static RoleAssignmentCollection GetRoleAssignments(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleAssignments(); + return GetMockableAuthorizationArmResource(armResource).GetRoleAssignments(); } /// @@ -454,6 +1186,10 @@ public static RoleAssignmentCollection GetRoleAssignments(this ArmClient client, /// RoleAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the role assignment. It can be any valid GUID. @@ -463,7 +1199,7 @@ public static RoleAssignmentCollection GetRoleAssignments(this ArmClient client, [ForwardsClientCalls] public static async Task> GetRoleAssignmentAsync(this ArmResource armResource, string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) { - return await armResource.GetRoleAssignments().GetAsync(roleAssignmentName, tenantId, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentAsync(roleAssignmentName, tenantId, cancellationToken).ConfigureAwait(false); } /// @@ -478,31 +1214,10 @@ public static async Task> GetRoleAssignmentAsyn /// RoleAssignments_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name of the role assignment. It can be any valid GUID. - /// Tenant ID for cross-tenant request. - /// The cancellation token to use. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) - { - return await client.GetRoleAssignments(scope).GetAsync(roleAssignmentName, tenantId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get a role assignment by scope and name. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} - /// /// - /// Operation Id - /// RoleAssignments_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The name of the role assignment. It can be any valid GUID. @@ -512,49 +1227,21 @@ public static async Task> GetRoleAssignmentAsyn [ForwardsClientCalls] public static Response GetRoleAssignment(this ArmResource armResource, string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) { - return armResource.GetRoleAssignments().Get(roleAssignmentName, tenantId, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleAssignment(roleAssignmentName, tenantId, cancellationToken); } /// - /// Get a role assignment by scope and name. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} - /// + /// Gets a collection of AuthorizationRoleDefinitionResources in the ArmResource. /// - /// Operation Id - /// RoleAssignments_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name of the role assignment. It can be any valid GUID. - /// Tenant ID for cross-tenant request. - /// The cancellation token to use. - /// is null. - [ForwardsClientCalls] - public static Response GetRoleAssignment(this ArmClient client, ResourceIdentifier scope, string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) - { - return client.GetRoleAssignments(scope).Get(roleAssignmentName, tenantId, cancellationToken); - } - - /// Gets a collection of AuthorizationRoleDefinitionResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of AuthorizationRoleDefinitionResources and their operations over a AuthorizationRoleDefinitionResource. public static AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefinitions(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetAuthorizationRoleDefinitions(); - } - - /// Gets a collection of AuthorizationRoleDefinitionResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of AuthorizationRoleDefinitionResources and their operations over a AuthorizationRoleDefinitionResource. - public static AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefinitions(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetAuthorizationRoleDefinitions(); + return GetMockableAuthorizationArmResource(armResource).GetAuthorizationRoleDefinitions(); } /// @@ -569,6 +1256,10 @@ public static AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefiniti /// RoleDefinitions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID of the role definition. @@ -577,7 +1268,7 @@ public static AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefiniti [ForwardsClientCalls] public static async Task> GetAuthorizationRoleDefinitionAsync(this ArmResource armResource, ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) { - return await armResource.GetAuthorizationRoleDefinitions().GetAsync(roleDefinitionId, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetAuthorizationRoleDefinitionAsync(roleDefinitionId, cancellationToken).ConfigureAwait(false); } /// @@ -592,30 +1283,10 @@ public static async Task> GetAutho /// RoleDefinitions_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The ID of the role definition. - /// The cancellation token to use. - /// is null. - [ForwardsClientCalls] - public static async Task> GetAuthorizationRoleDefinitionAsync(this ArmClient client, ResourceIdentifier scope, ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) - { - return await client.GetAuthorizationRoleDefinitions(scope).GetAsync(roleDefinitionId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get role definition by name (GUID). - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} - /// /// - /// Operation Id - /// RoleDefinitions_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The ID of the role definition. @@ -624,72 +1295,21 @@ public static async Task> GetAutho [ForwardsClientCalls] public static Response GetAuthorizationRoleDefinition(this ArmResource armResource, ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) { - return armResource.GetAuthorizationRoleDefinitions().Get(roleDefinitionId, cancellationToken); - } - - /// - /// Get role definition by name (GUID). - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} - /// - /// - /// Operation Id - /// RoleDefinitions_Get - /// - /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The ID of the role definition. - /// The cancellation token to use. - /// is null. - [ForwardsClientCalls] - public static Response GetAuthorizationRoleDefinition(this ArmClient client, ResourceIdentifier scope, ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) - { - return client.GetAuthorizationRoleDefinitions(scope).Get(roleDefinitionId, cancellationToken); - } - - /// Gets a collection of RoleAssignmentScheduleResources in the ArmResource. - /// The instance the method will execute against. - /// An object representing collection of RoleAssignmentScheduleResources and their operations over a RoleAssignmentScheduleResource. - public static RoleAssignmentScheduleCollection GetRoleAssignmentSchedules(this ArmResource armResource) - { - return GetArmResourceExtensionClient(armResource).GetRoleAssignmentSchedules(); - } - - /// Gets a collection of RoleAssignmentScheduleResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleAssignmentScheduleResources and their operations over a RoleAssignmentScheduleResource. - public static RoleAssignmentScheduleCollection GetRoleAssignmentSchedules(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleAssignmentSchedules(); + return GetMockableAuthorizationArmResource(armResource).GetAuthorizationRoleDefinition(roleDefinitionId, cancellationToken); } /// - /// Get the specified role assignment schedule for a resource scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} - /// + /// Gets a collection of RoleAssignmentScheduleResources in the ArmResource. /// - /// Operation Id - /// RoleAssignmentSchedules_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// - /// - /// The instance the method will execute against. - /// The name (guid) of the role assignment schedule to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleAssignmentScheduleAsync(this ArmResource armResource, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + /// + /// The instance the method will execute against. + /// An object representing collection of RoleAssignmentScheduleResources and their operations over a RoleAssignmentScheduleResource. + public static RoleAssignmentScheduleCollection GetRoleAssignmentSchedules(this ArmResource armResource) { - return await armResource.GetRoleAssignmentSchedules().GetAsync(roleAssignmentScheduleName, cancellationToken).ConfigureAwait(false); + return GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentSchedules(); } /// @@ -704,17 +1324,20 @@ public static async Task> GetRoleAssign /// RoleAssignmentSchedules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. + /// The instance the method will execute against. /// The name (guid) of the role assignment schedule to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetRoleAssignmentScheduleAsync(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + public static async Task> GetRoleAssignmentScheduleAsync(this ArmResource armResource, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) { - return await client.GetRoleAssignmentSchedules(scope).GetAsync(roleAssignmentScheduleName, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentScheduleAsync(roleAssignmentScheduleName, cancellationToken).ConfigureAwait(false); } /// @@ -729,58 +1352,34 @@ public static async Task> GetRoleAssign /// RoleAssignmentSchedules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name (guid) of the role assignment schedule to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRoleAssignmentSchedule(this ArmResource armResource, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) { - return armResource.GetRoleAssignmentSchedules().Get(roleAssignmentScheduleName, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentSchedule(roleAssignmentScheduleName, cancellationToken); } /// - /// Get the specified role assignment schedule for a resource scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} - /// + /// Gets a collection of RoleAssignmentScheduleInstanceResources in the ArmResource. /// - /// Operation Id - /// RoleAssignmentSchedules_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role assignment schedule to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetRoleAssignmentSchedule(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) - { - return client.GetRoleAssignmentSchedules(scope).Get(roleAssignmentScheduleName, cancellationToken); - } - - /// Gets a collection of RoleAssignmentScheduleInstanceResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of RoleAssignmentScheduleInstanceResources and their operations over a RoleAssignmentScheduleInstanceResource. public static RoleAssignmentScheduleInstanceCollection GetRoleAssignmentScheduleInstances(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetRoleAssignmentScheduleInstances(); - } - - /// Gets a collection of RoleAssignmentScheduleInstanceResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleAssignmentScheduleInstanceResources and their operations over a RoleAssignmentScheduleInstanceResource. - public static RoleAssignmentScheduleInstanceCollection GetRoleAssignmentScheduleInstances(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleAssignmentScheduleInstances(); + return GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentScheduleInstances(); } /// @@ -795,16 +1394,20 @@ public static RoleAssignmentScheduleInstanceCollection GetRoleAssignmentSchedule /// RoleAssignmentScheduleInstances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name (hash of schedule name + time) of the role assignment schedule to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRoleAssignmentScheduleInstanceAsync(this ArmResource armResource, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) { - return await armResource.GetRoleAssignmentScheduleInstances().GetAsync(roleAssignmentScheduleInstanceName, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentScheduleInstanceAsync(roleAssignmentScheduleInstanceName, cancellationToken).ConfigureAwait(false); } /// @@ -819,83 +1422,34 @@ public static async Task> GetRo /// RoleAssignmentScheduleInstances_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (hash of schedule name + time) of the role assignment schedule to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleAssignmentScheduleInstanceAsync(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) - { - return await client.GetRoleAssignmentScheduleInstances(scope).GetAsync(roleAssignmentScheduleInstanceName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets the specified role assignment schedule instance. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} - /// /// - /// Operation Id - /// RoleAssignmentScheduleInstances_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The name (hash of schedule name + time) of the role assignment schedule to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRoleAssignmentScheduleInstance(this ArmResource armResource, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) { - return armResource.GetRoleAssignmentScheduleInstances().Get(roleAssignmentScheduleInstanceName, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentScheduleInstance(roleAssignmentScheduleInstanceName, cancellationToken); } /// - /// Gets the specified role assignment schedule instance. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} - /// + /// Gets a collection of RoleAssignmentScheduleRequestResources in the ArmResource. /// - /// Operation Id - /// RoleAssignmentScheduleInstances_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (hash of schedule name + time) of the role assignment schedule to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetRoleAssignmentScheduleInstance(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) - { - return client.GetRoleAssignmentScheduleInstances(scope).Get(roleAssignmentScheduleInstanceName, cancellationToken); - } - - /// Gets a collection of RoleAssignmentScheduleRequestResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of RoleAssignmentScheduleRequestResources and their operations over a RoleAssignmentScheduleRequestResource. public static RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleRequests(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetRoleAssignmentScheduleRequests(); - } - - /// Gets a collection of RoleAssignmentScheduleRequestResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleAssignmentScheduleRequestResources and their operations over a RoleAssignmentScheduleRequestResource. - public static RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleRequests(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleAssignmentScheduleRequests(); + return GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentScheduleRequests(); } /// @@ -910,16 +1464,20 @@ public static RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleR /// RoleAssignmentScheduleRequests_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name (guid) of the role assignment schedule request to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRoleAssignmentScheduleRequestAsync(this ArmResource armResource, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) { - return await armResource.GetRoleAssignmentScheduleRequests().GetAsync(roleAssignmentScheduleRequestName, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentScheduleRequestAsync(roleAssignmentScheduleRequestName, cancellationToken).ConfigureAwait(false); } /// @@ -934,83 +1492,34 @@ public static async Task> GetRol /// RoleAssignmentScheduleRequests_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role assignment schedule request to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleAssignmentScheduleRequestAsync(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) - { - return await client.GetRoleAssignmentScheduleRequests(scope).GetAsync(roleAssignmentScheduleRequestName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the specified role assignment schedule request. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} - /// /// - /// Operation Id - /// RoleAssignmentScheduleRequests_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The name (guid) of the role assignment schedule request to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRoleAssignmentScheduleRequest(this ArmResource armResource, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) { - return armResource.GetRoleAssignmentScheduleRequests().Get(roleAssignmentScheduleRequestName, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleAssignmentScheduleRequest(roleAssignmentScheduleRequestName, cancellationToken); } /// - /// Get the specified role assignment schedule request. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} - /// + /// Gets a collection of RoleEligibilityScheduleResources in the ArmResource. /// - /// Operation Id - /// RoleAssignmentScheduleRequests_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role assignment schedule request to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetRoleAssignmentScheduleRequest(this ArmClient client, ResourceIdentifier scope, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) - { - return client.GetRoleAssignmentScheduleRequests(scope).Get(roleAssignmentScheduleRequestName, cancellationToken); - } - - /// Gets a collection of RoleEligibilityScheduleResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of RoleEligibilityScheduleResources and their operations over a RoleEligibilityScheduleResource. public static RoleEligibilityScheduleCollection GetRoleEligibilitySchedules(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetRoleEligibilitySchedules(); - } - - /// Gets a collection of RoleEligibilityScheduleResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleEligibilityScheduleResources and their operations over a RoleEligibilityScheduleResource. - public static RoleEligibilityScheduleCollection GetRoleEligibilitySchedules(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleEligibilitySchedules(); + return GetMockableAuthorizationArmResource(armResource).GetRoleEligibilitySchedules(); } /// @@ -1025,16 +1534,20 @@ public static RoleEligibilityScheduleCollection GetRoleEligibilitySchedules(this /// RoleEligibilitySchedules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name (guid) of the role eligibility schedule to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRoleEligibilityScheduleAsync(this ArmResource armResource, string roleEligibilityScheduleName, CancellationToken cancellationToken = default) { - return await armResource.GetRoleEligibilitySchedules().GetAsync(roleEligibilityScheduleName, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetRoleEligibilityScheduleAsync(roleEligibilityScheduleName, cancellationToken).ConfigureAwait(false); } /// @@ -1049,132 +1562,34 @@ public static async Task> GetRoleEligi /// RoleEligibilitySchedules_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role eligibility schedule to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleEligibilityScheduleAsync(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleName, CancellationToken cancellationToken = default) - { - return await client.GetRoleEligibilitySchedules(scope).GetAsync(roleEligibilityScheduleName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the specified role eligibility schedule for a resource scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} - /// /// - /// Operation Id - /// RoleEligibilitySchedules_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The name (guid) of the role eligibility schedule to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRoleEligibilitySchedule(this ArmResource armResource, string roleEligibilityScheduleName, CancellationToken cancellationToken = default) { - return armResource.GetRoleEligibilitySchedules().Get(roleEligibilityScheduleName, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleEligibilitySchedule(roleEligibilityScheduleName, cancellationToken); } /// - /// Get the specified role eligibility schedule for a resource scope - /// + /// Gets a collection of RoleEligibilityScheduleInstanceResources in the ArmResource. /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} - /// - /// - /// Operation Id - /// RoleEligibilitySchedules_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role eligibility schedule to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetRoleEligibilitySchedule(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleName, CancellationToken cancellationToken = default) - { - return client.GetRoleEligibilitySchedules(scope).Get(roleEligibilityScheduleName, cancellationToken); - } - - /// Gets a collection of RoleEligibilityScheduleInstanceResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of RoleEligibilityScheduleInstanceResources and their operations over a RoleEligibilityScheduleInstanceResource. public static RoleEligibilityScheduleInstanceCollection GetRoleEligibilityScheduleInstances(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetRoleEligibilityScheduleInstances(); - } - - /// Gets a collection of RoleEligibilityScheduleInstanceResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleEligibilityScheduleInstanceResources and their operations over a RoleEligibilityScheduleInstanceResource. - public static RoleEligibilityScheduleInstanceCollection GetRoleEligibilityScheduleInstances(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleEligibilityScheduleInstances(); - } - - /// - /// Gets the specified role eligibility schedule instance. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} - /// - /// - /// Operation Id - /// RoleEligibilityScheduleInstances_Get - /// - /// - /// - /// The instance the method will execute against. - /// The name (hash of schedule name + time) of the role eligibility schedule to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleEligibilityScheduleInstanceAsync(this ArmResource armResource, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) - { - return await armResource.GetRoleEligibilityScheduleInstances().GetAsync(roleEligibilityScheduleInstanceName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets the specified role eligibility schedule instance. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} - /// - /// - /// Operation Id - /// RoleEligibilityScheduleInstances_Get - /// - /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (hash of schedule name + time) of the role eligibility schedule to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleEligibilityScheduleInstanceAsync(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) - { - return await client.GetRoleEligibilityScheduleInstances(scope).GetAsync(roleEligibilityScheduleInstanceName, cancellationToken).ConfigureAwait(false); + return GetMockableAuthorizationArmResource(armResource).GetRoleEligibilityScheduleInstances(); } /// @@ -1189,16 +1604,20 @@ public static async Task> GetR /// RoleEligibilityScheduleInstances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name (hash of schedule name + time) of the role eligibility schedule to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetRoleEligibilityScheduleInstance(this ArmResource armResource, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + public static async Task> GetRoleEligibilityScheduleInstanceAsync(this ArmResource armResource, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) { - return armResource.GetRoleEligibilityScheduleInstances().Get(roleEligibilityScheduleInstanceName, cancellationToken); + return await GetMockableAuthorizationArmResource(armResource).GetRoleEligibilityScheduleInstanceAsync(roleEligibilityScheduleInstanceName, cancellationToken).ConfigureAwait(false); } /// @@ -1213,34 +1632,34 @@ public static Response GetRoleEligibili /// RoleEligibilityScheduleInstances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. + /// The instance the method will execute against. /// The name (hash of schedule name + time) of the role eligibility schedule to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetRoleEligibilityScheduleInstance(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + public static Response GetRoleEligibilityScheduleInstance(this ArmResource armResource, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) { - return client.GetRoleEligibilityScheduleInstances(scope).Get(roleEligibilityScheduleInstanceName, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleEligibilityScheduleInstance(roleEligibilityScheduleInstanceName, cancellationToken); } - /// Gets a collection of RoleEligibilityScheduleRequestResources in the ArmResource. + /// + /// Gets a collection of RoleEligibilityScheduleRequestResources in the ArmResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RoleEligibilityScheduleRequestResources and their operations over a RoleEligibilityScheduleRequestResource. public static RoleEligibilityScheduleRequestCollection GetRoleEligibilityScheduleRequests(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetRoleEligibilityScheduleRequests(); - } - - /// Gets a collection of RoleEligibilityScheduleRequestResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleEligibilityScheduleRequestResources and their operations over a RoleEligibilityScheduleRequestResource. - public static RoleEligibilityScheduleRequestCollection GetRoleEligibilityScheduleRequests(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleEligibilityScheduleRequests(); + return GetMockableAuthorizationArmResource(armResource).GetRoleEligibilityScheduleRequests(); } /// @@ -1255,16 +1674,20 @@ public static RoleEligibilityScheduleRequestCollection GetRoleEligibilitySchedul /// RoleEligibilityScheduleRequests_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name (guid) of the role eligibility schedule request to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRoleEligibilityScheduleRequestAsync(this ArmResource armResource, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) { - return await armResource.GetRoleEligibilityScheduleRequests().GetAsync(roleEligibilityScheduleRequestName, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetRoleEligibilityScheduleRequestAsync(roleEligibilityScheduleRequestName, cancellationToken).ConfigureAwait(false); } /// @@ -1279,83 +1702,34 @@ public static async Task> GetRo /// RoleEligibilityScheduleRequests_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role eligibility schedule request to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleEligibilityScheduleRequestAsync(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) - { - return await client.GetRoleEligibilityScheduleRequests(scope).GetAsync(roleEligibilityScheduleRequestName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the specified role eligibility schedule request. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} - /// /// - /// Operation Id - /// RoleEligibilityScheduleRequests_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The name (guid) of the role eligibility schedule request to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRoleEligibilityScheduleRequest(this ArmResource armResource, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) { - return armResource.GetRoleEligibilityScheduleRequests().Get(roleEligibilityScheduleRequestName, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleEligibilityScheduleRequest(roleEligibilityScheduleRequestName, cancellationToken); } /// - /// Get the specified role eligibility schedule request. - /// + /// Gets a collection of RoleManagementPolicyResources in the ArmResource. /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} - /// - /// - /// Operation Id - /// RoleEligibilityScheduleRequests_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role eligibility schedule request to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetRoleEligibilityScheduleRequest(this ArmClient client, ResourceIdentifier scope, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) - { - return client.GetRoleEligibilityScheduleRequests(scope).Get(roleEligibilityScheduleRequestName, cancellationToken); - } - - /// Gets a collection of RoleManagementPolicyResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of RoleManagementPolicyResources and their operations over a RoleManagementPolicyResource. public static RoleManagementPolicyCollection GetRoleManagementPolicies(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetRoleManagementPolicies(); - } - - /// Gets a collection of RoleManagementPolicyResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleManagementPolicyResources and their operations over a RoleManagementPolicyResource. - public static RoleManagementPolicyCollection GetRoleManagementPolicies(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleManagementPolicies(); + return GetMockableAuthorizationArmResource(armResource).GetRoleManagementPolicies(); } /// @@ -1370,16 +1744,20 @@ public static RoleManagementPolicyCollection GetRoleManagementPolicies(this ArmC /// RoleManagementPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name (guid) of the role management policy to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRoleManagementPolicyAsync(this ArmResource armResource, string roleManagementPolicyName, CancellationToken cancellationToken = default) { - return await armResource.GetRoleManagementPolicies().GetAsync(roleManagementPolicyName, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetRoleManagementPolicyAsync(roleManagementPolicyName, cancellationToken).ConfigureAwait(false); } /// @@ -1394,83 +1772,34 @@ public static async Task> GetRoleManageme /// RoleManagementPolicies_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role management policy to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleManagementPolicyAsync(this ArmClient client, ResourceIdentifier scope, string roleManagementPolicyName, CancellationToken cancellationToken = default) - { - return await client.GetRoleManagementPolicies(scope).GetAsync(roleManagementPolicyName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the specified role management policy for a resource scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} - /// /// - /// Operation Id - /// RoleManagementPolicies_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The name (guid) of the role management policy to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRoleManagementPolicy(this ArmResource armResource, string roleManagementPolicyName, CancellationToken cancellationToken = default) { - return armResource.GetRoleManagementPolicies().Get(roleManagementPolicyName, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleManagementPolicy(roleManagementPolicyName, cancellationToken); } /// - /// Get the specified role management policy for a resource scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} - /// + /// Gets a collection of RoleManagementPolicyAssignmentResources in the ArmResource. /// - /// Operation Id - /// RoleManagementPolicies_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name (guid) of the role management policy to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetRoleManagementPolicy(this ArmClient client, ResourceIdentifier scope, string roleManagementPolicyName, CancellationToken cancellationToken = default) - { - return client.GetRoleManagementPolicies(scope).Get(roleManagementPolicyName, cancellationToken); - } - - /// Gets a collection of RoleManagementPolicyAssignmentResources in the ArmResource. /// The instance the method will execute against. /// An object representing collection of RoleManagementPolicyAssignmentResources and their operations over a RoleManagementPolicyAssignmentResource. public static RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAssignments(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetRoleManagementPolicyAssignments(); - } - - /// Gets a collection of RoleManagementPolicyAssignmentResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of RoleManagementPolicyAssignmentResources and their operations over a RoleManagementPolicyAssignmentResource. - public static RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAssignments(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetRoleManagementPolicyAssignments(); + return GetMockableAuthorizationArmResource(armResource).GetRoleManagementPolicyAssignments(); } /// @@ -1485,16 +1814,20 @@ public static RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAs /// RoleManagementPolicyAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of format {guid_guid} the role management policy assignment to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRoleManagementPolicyAssignmentAsync(this ArmResource armResource, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) { - return await armResource.GetRoleManagementPolicyAssignments().GetAsync(roleManagementPolicyAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationArmResource(armResource).GetRoleManagementPolicyAssignmentAsync(roleManagementPolicyAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -1509,110 +1842,20 @@ public static async Task> GetRo /// RoleManagementPolicyAssignments_Get /// /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name of format {guid_guid} the role management policy assignment to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetRoleManagementPolicyAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) - { - return await client.GetRoleManagementPolicyAssignments(scope).GetAsync(roleManagementPolicyAssignmentName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the specified role management policy assignment for a resource scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} - /// /// - /// Operation Id - /// RoleManagementPolicyAssignments_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. /// The name of format {guid_guid} the role management policy assignment to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - [ForwardsClientCalls] - public static Response GetRoleManagementPolicyAssignment(this ArmResource armResource, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) - { - return armResource.GetRoleManagementPolicyAssignments().Get(roleManagementPolicyAssignmentName, cancellationToken); - } - - /// - /// Get the specified role management policy assignment for a resource scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} - /// - /// - /// Operation Id - /// RoleManagementPolicyAssignments_Get - /// - /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name of format {guid_guid} the role management policy assignment to get. - /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// is null. [ForwardsClientCalls] - public static Response GetRoleManagementPolicyAssignment(this ArmClient client, ResourceIdentifier scope, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) - { - return client.GetRoleManagementPolicyAssignments(scope).Get(roleManagementPolicyAssignmentName, cancellationToken); - } - - /// - /// Get the child resources of a resource on which user has eligible access - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/eligibleChildResources - /// - /// - /// Operation Id - /// EligibleChildResources_Get - /// - /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. Use $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' or 'ResourceGroup'. - /// The cancellation token to use. - public static AsyncPageable GetEligibleChildResourcesAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) - { - return GetArmResourceExtensionClient(client, scope).GetEligibleChildResourcesAsync(filter, cancellationToken); - } - - /// - /// Get the child resources of a resource on which user has eligible access - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/eligibleChildResources - /// - /// - /// Operation Id - /// EligibleChildResources_Get - /// - /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. Use $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' or 'ResourceGroup'. - /// The cancellation token to use. - public static Pageable GetEligibleChildResources(this ArmClient client, ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) + public static Response GetRoleManagementPolicyAssignment(this ArmResource armResource, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetEligibleChildResources(filter, cancellationToken); + return GetMockableAuthorizationArmResource(armResource).GetRoleManagementPolicyAssignment(roleManagementPolicyAssignmentName, cancellationToken); } /// @@ -1627,13 +1870,17 @@ public static Pageable GetEligibleChildResources(this Arm /// AzurePermissionsForResourceGroup_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzurePermissionsForResourceGroupsAsync(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAzurePermissionsForResourceGroupsAsync(cancellationToken); + return GetMockableAuthorizationResourceGroupResource(resourceGroupResource).GetAzurePermissionsForResourceGroupsAsync(cancellationToken); } /// @@ -1648,13 +1895,17 @@ public static AsyncPageable GetAzurePermissionsForReso /// AzurePermissionsForResourceGroup_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzurePermissionsForResourceGroups(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAzurePermissionsForResourceGroups(cancellationToken); + return GetMockableAuthorizationResourceGroupResource(resourceGroupResource).GetAzurePermissionsForResourceGroups(cancellationToken); } /// @@ -1669,6 +1920,10 @@ public static Pageable GetAzurePermissionsForResourceG /// AzurePermissionsForResource_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace of the resource provider. @@ -1681,12 +1936,7 @@ public static Pageable GetAzurePermissionsForResourceG /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAzurePermissionsForResourcesAsync(this ResourceGroupResource resourceGroupResource, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(resourceProviderNamespace, nameof(resourceProviderNamespace)); - Argument.AssertNotNull(parentResourcePath, nameof(parentResourcePath)); - Argument.AssertNotNull(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAzurePermissionsForResourcesAsync(resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancellationToken); + return GetMockableAuthorizationResourceGroupResource(resourceGroupResource).GetAzurePermissionsForResourcesAsync(resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancellationToken); } /// @@ -1701,6 +1951,10 @@ public static AsyncPageable GetAzurePermissionsForReso /// AzurePermissionsForResource_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace of the resource provider. @@ -1713,12 +1967,7 @@ public static AsyncPageable GetAzurePermissionsForReso /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAzurePermissionsForResources(this ResourceGroupResource resourceGroupResource, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(resourceProviderNamespace, nameof(resourceProviderNamespace)); - Argument.AssertNotNull(parentResourcePath, nameof(parentResourcePath)); - Argument.AssertNotNull(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAzurePermissionsForResources(resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancellationToken); + return GetMockableAuthorizationResourceGroupResource(resourceGroupResource).GetAzurePermissionsForResources(resourceProviderNamespace, parentResourcePath, resourceType, resourceName, cancellationToken); } /// @@ -1733,13 +1982,17 @@ public static Pageable GetAzurePermissionsForResources /// ClassicAdministrators_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetClassicAdministratorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClassicAdministratorsAsync(cancellationToken); + return GetMockableAuthorizationSubscriptionResource(subscriptionResource).GetClassicAdministratorsAsync(cancellationToken); } /// @@ -1754,21 +2007,31 @@ public static AsyncPageable GetClassicAdminis /// ClassicAdministrators_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetClassicAdministrators(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClassicAdministrators(cancellationToken); + return GetMockableAuthorizationSubscriptionResource(subscriptionResource).GetClassicAdministrators(cancellationToken); } - /// Gets a collection of AuthorizationProviderOperationsMetadataResources in the TenantResource. + /// + /// Gets a collection of AuthorizationProviderOperationsMetadataResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AuthorizationProviderOperationsMetadataResources and their operations over a AuthorizationProviderOperationsMetadataResource. public static AuthorizationProviderOperationsMetadataCollection GetAllAuthorizationProviderOperationsMetadata(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetAllAuthorizationProviderOperationsMetadata(); + return GetMockableAuthorizationTenantResource(tenantResource).GetAllAuthorizationProviderOperationsMetadata(); } /// @@ -1783,6 +2046,10 @@ public static AuthorizationProviderOperationsMetadataCollection GetAllAuthorizat /// ProviderOperationsMetadata_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace of the resource provider. @@ -1792,7 +2059,7 @@ public static AuthorizationProviderOperationsMetadataCollection GetAllAuthorizat [ForwardsClientCalls] public static async Task> GetAuthorizationProviderOperationsMetadataAsync(this TenantResource tenantResource, string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) { - return await tenantResource.GetAllAuthorizationProviderOperationsMetadata().GetAsync(resourceProviderNamespace, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationTenantResource(tenantResource).GetAuthorizationProviderOperationsMetadataAsync(resourceProviderNamespace, expand, cancellationToken).ConfigureAwait(false); } /// @@ -1807,6 +2074,10 @@ public static async TaskProviderOperationsMetadata_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace of the resource provider. @@ -1816,7 +2087,7 @@ public static async Task GetAuthorizationProviderOperationsMetadata(this TenantResource tenantResource, string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) { - return tenantResource.GetAllAuthorizationProviderOperationsMetadata().Get(resourceProviderNamespace, expand, cancellationToken); + return GetMockableAuthorizationTenantResource(tenantResource).GetAuthorizationProviderOperationsMetadata(resourceProviderNamespace, expand, cancellationToken); } /// @@ -1831,12 +2102,16 @@ public static Response GetAutho /// GlobalAdministrator_ElevateAccess /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task ElevateAccessGlobalAdministratorAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return await GetTenantResourceExtensionClient(tenantResource).ElevateAccessGlobalAdministratorAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableAuthorizationTenantResource(tenantResource).ElevateAccessGlobalAdministratorAsync(cancellationToken).ConfigureAwait(false); } /// @@ -1851,12 +2126,16 @@ public static async Task ElevateAccessGlobalAdministratorAsync(this Te /// GlobalAdministrator_ElevateAccess /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response ElevateAccessGlobalAdministrator(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).ElevateAccessGlobalAdministrator(cancellationToken); + return GetMockableAuthorizationTenantResource(tenantResource).ElevateAccessGlobalAdministrator(cancellationToken); } } } diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationArmClient.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationArmClient.cs new file mode 100644 index 0000000000000..dc0cf07c99bc4 --- /dev/null +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationArmClient.cs @@ -0,0 +1,857 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Authorization; +using Azure.ResourceManager.Authorization.Models; + +namespace Azure.ResourceManager.Authorization.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAuthorizationArmClient : ArmResource + { + private ClientDiagnostics _eligibleChildResourcesClientDiagnostics; + private EligibleChildResourcesRestOperations _eligibleChildResourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAuthorizationArmClient() + { + } + + /// 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 MockableAuthorizationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAuthorizationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics EligibleChildResourcesClientDiagnostics => _eligibleChildResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private EligibleChildResourcesRestOperations EligibleChildResourcesRestClient => _eligibleChildResourcesRestClient ??= new EligibleChildResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DenyAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of DenyAssignmentResources and their operations over a DenyAssignmentResource. + public virtual DenyAssignmentCollection GetDenyAssignments(ResourceIdentifier scope) + { + return new DenyAssignmentCollection(Client, scope); + } + + /// + /// Get the specified deny assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} + /// + /// + /// Operation Id + /// DenyAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The ID of the deny assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDenyAssignmentAsync(ResourceIdentifier scope, string denyAssignmentId, CancellationToken cancellationToken = default) + { + return await GetDenyAssignments(scope).GetAsync(denyAssignmentId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified deny assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} + /// + /// + /// Operation Id + /// DenyAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The ID of the deny assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDenyAssignment(ResourceIdentifier scope, string denyAssignmentId, CancellationToken cancellationToken = default) + { + return GetDenyAssignments(scope).Get(denyAssignmentId, cancellationToken); + } + + /// Gets a collection of RoleAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleAssignmentResources and their operations over a RoleAssignmentResource. + public virtual RoleAssignmentCollection GetRoleAssignments(ResourceIdentifier scope) + { + return new RoleAssignmentCollection(Client, scope); + } + + /// + /// Get a role assignment by scope and name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the role assignment. It can be any valid GUID. + /// Tenant ID for cross-tenant request. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetRoleAssignmentAsync(ResourceIdentifier scope, string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) + { + return await GetRoleAssignments(scope).GetAsync(roleAssignmentName, tenantId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a role assignment by scope and name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the role assignment. It can be any valid GUID. + /// Tenant ID for cross-tenant request. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetRoleAssignment(ResourceIdentifier scope, string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) + { + return GetRoleAssignments(scope).Get(roleAssignmentName, tenantId, cancellationToken); + } + + /// Gets a collection of AuthorizationRoleDefinitionResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of AuthorizationRoleDefinitionResources and their operations over a AuthorizationRoleDefinitionResource. + public virtual AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefinitions(ResourceIdentifier scope) + { + return new AuthorizationRoleDefinitionCollection(Client, scope); + } + + /// + /// Get role definition by name (GUID). + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// RoleDefinitions_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The ID of the role definition. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationRoleDefinitionAsync(ResourceIdentifier scope, ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) + { + return await GetAuthorizationRoleDefinitions(scope).GetAsync(roleDefinitionId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get role definition by name (GUID). + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// RoleDefinitions_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The ID of the role definition. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetAuthorizationRoleDefinition(ResourceIdentifier scope, ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) + { + return GetAuthorizationRoleDefinitions(scope).Get(roleDefinitionId, cancellationToken); + } + + /// Gets a collection of RoleAssignmentScheduleResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleAssignmentScheduleResources and their operations over a RoleAssignmentScheduleResource. + public virtual RoleAssignmentScheduleCollection GetRoleAssignmentSchedules(ResourceIdentifier scope) + { + return new RoleAssignmentScheduleCollection(Client, scope); + } + + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} + /// + /// + /// Operation Id + /// RoleAssignmentSchedules_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleAssignmentScheduleAsync(ResourceIdentifier scope, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + { + return await GetRoleAssignmentSchedules(scope).GetAsync(roleAssignmentScheduleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} + /// + /// + /// Operation Id + /// RoleAssignmentSchedules_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleAssignmentSchedule(ResourceIdentifier scope, string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + { + return GetRoleAssignmentSchedules(scope).Get(roleAssignmentScheduleName, cancellationToken); + } + + /// Gets a collection of RoleAssignmentScheduleInstanceResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleAssignmentScheduleInstanceResources and their operations over a RoleAssignmentScheduleInstanceResource. + public virtual RoleAssignmentScheduleInstanceCollection GetRoleAssignmentScheduleInstances(ResourceIdentifier scope) + { + return new RoleAssignmentScheduleInstanceCollection(Client, scope); + } + + /// + /// Gets the specified role assignment schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleInstances_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (hash of schedule name + time) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleAssignmentScheduleInstanceAsync(ResourceIdentifier scope, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) + { + return await GetRoleAssignmentScheduleInstances(scope).GetAsync(roleAssignmentScheduleInstanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified role assignment schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleInstances_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (hash of schedule name + time) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleAssignmentScheduleInstance(ResourceIdentifier scope, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) + { + return GetRoleAssignmentScheduleInstances(scope).Get(roleAssignmentScheduleInstanceName, cancellationToken); + } + + /// Gets a collection of RoleAssignmentScheduleRequestResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleAssignmentScheduleRequestResources and their operations over a RoleAssignmentScheduleRequestResource. + public virtual RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleRequests(ResourceIdentifier scope) + { + return new RoleAssignmentScheduleRequestCollection(Client, scope); + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleRequests_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role assignment schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleAssignmentScheduleRequestAsync(ResourceIdentifier scope, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) + { + return await GetRoleAssignmentScheduleRequests(scope).GetAsync(roleAssignmentScheduleRequestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleRequests_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role assignment schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleAssignmentScheduleRequest(ResourceIdentifier scope, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) + { + return GetRoleAssignmentScheduleRequests(scope).Get(roleAssignmentScheduleRequestName, cancellationToken); + } + + /// Gets a collection of RoleEligibilityScheduleResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleEligibilityScheduleResources and their operations over a RoleEligibilityScheduleResource. + public virtual RoleEligibilityScheduleCollection GetRoleEligibilitySchedules(ResourceIdentifier scope) + { + return new RoleEligibilityScheduleCollection(Client, scope); + } + + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} + /// + /// + /// Operation Id + /// RoleEligibilitySchedules_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleEligibilityScheduleAsync(ResourceIdentifier scope, string roleEligibilityScheduleName, CancellationToken cancellationToken = default) + { + return await GetRoleEligibilitySchedules(scope).GetAsync(roleEligibilityScheduleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} + /// + /// + /// Operation Id + /// RoleEligibilitySchedules_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleEligibilitySchedule(ResourceIdentifier scope, string roleEligibilityScheduleName, CancellationToken cancellationToken = default) + { + return GetRoleEligibilitySchedules(scope).Get(roleEligibilityScheduleName, cancellationToken); + } + + /// Gets a collection of RoleEligibilityScheduleInstanceResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleEligibilityScheduleInstanceResources and their operations over a RoleEligibilityScheduleInstanceResource. + public virtual RoleEligibilityScheduleInstanceCollection GetRoleEligibilityScheduleInstances(ResourceIdentifier scope) + { + return new RoleEligibilityScheduleInstanceCollection(Client, scope); + } + + /// + /// Gets the specified role eligibility schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleInstances_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (hash of schedule name + time) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleEligibilityScheduleInstanceAsync(ResourceIdentifier scope, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + { + return await GetRoleEligibilityScheduleInstances(scope).GetAsync(roleEligibilityScheduleInstanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified role eligibility schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleInstances_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (hash of schedule name + time) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleEligibilityScheduleInstance(ResourceIdentifier scope, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + { + return GetRoleEligibilityScheduleInstances(scope).Get(roleEligibilityScheduleInstanceName, cancellationToken); + } + + /// Gets a collection of RoleEligibilityScheduleRequestResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleEligibilityScheduleRequestResources and their operations over a RoleEligibilityScheduleRequestResource. + public virtual RoleEligibilityScheduleRequestCollection GetRoleEligibilityScheduleRequests(ResourceIdentifier scope) + { + return new RoleEligibilityScheduleRequestCollection(Client, scope); + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleRequests_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role eligibility schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleEligibilityScheduleRequestAsync(ResourceIdentifier scope, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) + { + return await GetRoleEligibilityScheduleRequests(scope).GetAsync(roleEligibilityScheduleRequestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleRequests_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role eligibility schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleEligibilityScheduleRequest(ResourceIdentifier scope, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) + { + return GetRoleEligibilityScheduleRequests(scope).Get(roleEligibilityScheduleRequestName, cancellationToken); + } + + /// Gets a collection of RoleManagementPolicyResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleManagementPolicyResources and their operations over a RoleManagementPolicyResource. + public virtual RoleManagementPolicyCollection GetRoleManagementPolicies(ResourceIdentifier scope) + { + return new RoleManagementPolicyCollection(Client, scope); + } + + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} + /// + /// + /// Operation Id + /// RoleManagementPolicies_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role management policy to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleManagementPolicyAsync(ResourceIdentifier scope, string roleManagementPolicyName, CancellationToken cancellationToken = default) + { + return await GetRoleManagementPolicies(scope).GetAsync(roleManagementPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} + /// + /// + /// Operation Id + /// RoleManagementPolicies_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name (guid) of the role management policy to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleManagementPolicy(ResourceIdentifier scope, string roleManagementPolicyName, CancellationToken cancellationToken = default) + { + return GetRoleManagementPolicies(scope).Get(roleManagementPolicyName, cancellationToken); + } + + /// Gets a collection of RoleManagementPolicyAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of RoleManagementPolicyAssignmentResources and their operations over a RoleManagementPolicyAssignmentResource. + public virtual RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAssignments(ResourceIdentifier scope) + { + return new RoleManagementPolicyAssignmentCollection(Client, scope); + } + + /// + /// Get the specified role management policy assignment for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} + /// + /// + /// Operation Id + /// RoleManagementPolicyAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of format {guid_guid} the role management policy assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleManagementPolicyAssignmentAsync(ResourceIdentifier scope, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) + { + return await GetRoleManagementPolicyAssignments(scope).GetAsync(roleManagementPolicyAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role management policy assignment for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} + /// + /// + /// Operation Id + /// RoleManagementPolicyAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of format {guid_guid} the role management policy assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleManagementPolicyAssignment(ResourceIdentifier scope, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) + { + return GetRoleManagementPolicyAssignments(scope).Get(roleManagementPolicyAssignmentName, cancellationToken); + } + + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/eligibleChildResources + /// + /// + /// Operation Id + /// EligibleChildResources_Get + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. Use $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' or 'ResourceGroup'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEligibleChildResourcesAsync(ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EligibleChildResourcesRestClient.CreateGetRequest(scope, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EligibleChildResourcesRestClient.CreateGetNextPageRequest(nextLink, scope, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EligibleChildResource.DeserializeEligibleChildResource, EligibleChildResourcesClientDiagnostics, Pipeline, "MockableAuthorizationArmClient.GetEligibleChildResources", "value", "nextLink", cancellationToken); + } + + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/eligibleChildResources + /// + /// + /// Operation Id + /// EligibleChildResources_Get + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. Use $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' or 'ResourceGroup'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEligibleChildResources(ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EligibleChildResourcesRestClient.CreateGetRequest(scope, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EligibleChildResourcesRestClient.CreateGetNextPageRequest(nextLink, scope, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EligibleChildResource.DeserializeEligibleChildResource, EligibleChildResourcesClientDiagnostics, Pipeline, "MockableAuthorizationArmClient.GetEligibleChildResources", "value", "nextLink", cancellationToken); + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DenyAssignmentResource GetDenyAssignmentResource(ResourceIdentifier id) + { + DenyAssignmentResource.ValidateResourceId(id); + return new DenyAssignmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AuthorizationProviderOperationsMetadataResource GetAuthorizationProviderOperationsMetadataResource(ResourceIdentifier id) + { + AuthorizationProviderOperationsMetadataResource.ValidateResourceId(id); + return new AuthorizationProviderOperationsMetadataResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleAssignmentResource GetRoleAssignmentResource(ResourceIdentifier id) + { + RoleAssignmentResource.ValidateResourceId(id); + return new RoleAssignmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AuthorizationRoleDefinitionResource GetAuthorizationRoleDefinitionResource(ResourceIdentifier id) + { + AuthorizationRoleDefinitionResource.ValidateResourceId(id); + return new AuthorizationRoleDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleAssignmentScheduleResource GetRoleAssignmentScheduleResource(ResourceIdentifier id) + { + RoleAssignmentScheduleResource.ValidateResourceId(id); + return new RoleAssignmentScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleAssignmentScheduleInstanceResource GetRoleAssignmentScheduleInstanceResource(ResourceIdentifier id) + { + RoleAssignmentScheduleInstanceResource.ValidateResourceId(id); + return new RoleAssignmentScheduleInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleAssignmentScheduleRequestResource GetRoleAssignmentScheduleRequestResource(ResourceIdentifier id) + { + RoleAssignmentScheduleRequestResource.ValidateResourceId(id); + return new RoleAssignmentScheduleRequestResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleEligibilityScheduleResource GetRoleEligibilityScheduleResource(ResourceIdentifier id) + { + RoleEligibilityScheduleResource.ValidateResourceId(id); + return new RoleEligibilityScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleEligibilityScheduleInstanceResource GetRoleEligibilityScheduleInstanceResource(ResourceIdentifier id) + { + RoleEligibilityScheduleInstanceResource.ValidateResourceId(id); + return new RoleEligibilityScheduleInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleEligibilityScheduleRequestResource GetRoleEligibilityScheduleRequestResource(ResourceIdentifier id) + { + RoleEligibilityScheduleRequestResource.ValidateResourceId(id); + return new RoleEligibilityScheduleRequestResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleManagementPolicyResource GetRoleManagementPolicyResource(ResourceIdentifier id) + { + RoleManagementPolicyResource.ValidateResourceId(id); + return new RoleManagementPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleManagementPolicyAssignmentResource GetRoleManagementPolicyAssignmentResource(ResourceIdentifier id) + { + RoleManagementPolicyAssignmentResource.ValidateResourceId(id); + return new RoleManagementPolicyAssignmentResource(Client, id); + } + } +} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationArmResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationArmResource.cs new file mode 100644 index 0000000000000..4edd9c0206ce9 --- /dev/null +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationArmResource.cs @@ -0,0 +1,620 @@ +// 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.Authorization; + +namespace Azure.ResourceManager.Authorization.Mocking +{ + /// A class to add extension methods to ArmResource. + public partial class MockableAuthorizationArmResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAuthorizationArmResource() + { + } + + /// 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 MockableAuthorizationArmResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DenyAssignmentResources in the ArmResource. + /// An object representing collection of DenyAssignmentResources and their operations over a DenyAssignmentResource. + public virtual DenyAssignmentCollection GetDenyAssignments() + { + return GetCachedClient(client => new DenyAssignmentCollection(client, Id)); + } + + /// + /// Get the specified deny assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} + /// + /// + /// Operation Id + /// DenyAssignments_Get + /// + /// + /// + /// The ID of the deny assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDenyAssignmentAsync(string denyAssignmentId, CancellationToken cancellationToken = default) + { + return await GetDenyAssignments().GetAsync(denyAssignmentId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified deny assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} + /// + /// + /// Operation Id + /// DenyAssignments_Get + /// + /// + /// + /// The ID of the deny assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDenyAssignment(string denyAssignmentId, CancellationToken cancellationToken = default) + { + return GetDenyAssignments().Get(denyAssignmentId, cancellationToken); + } + + /// Gets a collection of RoleAssignmentResources in the ArmResource. + /// An object representing collection of RoleAssignmentResources and their operations over a RoleAssignmentResource. + public virtual RoleAssignmentCollection GetRoleAssignments() + { + return GetCachedClient(client => new RoleAssignmentCollection(client, Id)); + } + + /// + /// Get a role assignment by scope and name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// The name of the role assignment. It can be any valid GUID. + /// Tenant ID for cross-tenant request. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetRoleAssignmentAsync(string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) + { + return await GetRoleAssignments().GetAsync(roleAssignmentName, tenantId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a role assignment by scope and name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName} + /// + /// + /// Operation Id + /// RoleAssignments_Get + /// + /// + /// + /// The name of the role assignment. It can be any valid GUID. + /// Tenant ID for cross-tenant request. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetRoleAssignment(string roleAssignmentName, string tenantId = null, CancellationToken cancellationToken = default) + { + return GetRoleAssignments().Get(roleAssignmentName, tenantId, cancellationToken); + } + + /// Gets a collection of AuthorizationRoleDefinitionResources in the ArmResource. + /// An object representing collection of AuthorizationRoleDefinitionResources and their operations over a AuthorizationRoleDefinitionResource. + public virtual AuthorizationRoleDefinitionCollection GetAuthorizationRoleDefinitions() + { + return GetCachedClient(client => new AuthorizationRoleDefinitionCollection(client, Id)); + } + + /// + /// Get role definition by name (GUID). + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// RoleDefinitions_Get + /// + /// + /// + /// The ID of the role definition. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationRoleDefinitionAsync(ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) + { + return await GetAuthorizationRoleDefinitions().GetAsync(roleDefinitionId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get role definition by name (GUID). + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + /// + /// + /// Operation Id + /// RoleDefinitions_Get + /// + /// + /// + /// The ID of the role definition. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetAuthorizationRoleDefinition(ResourceIdentifier roleDefinitionId, CancellationToken cancellationToken = default) + { + return GetAuthorizationRoleDefinitions().Get(roleDefinitionId, cancellationToken); + } + + /// Gets a collection of RoleAssignmentScheduleResources in the ArmResource. + /// An object representing collection of RoleAssignmentScheduleResources and their operations over a RoleAssignmentScheduleResource. + public virtual RoleAssignmentScheduleCollection GetRoleAssignmentSchedules() + { + return GetCachedClient(client => new RoleAssignmentScheduleCollection(client, Id)); + } + + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} + /// + /// + /// Operation Id + /// RoleAssignmentSchedules_Get + /// + /// + /// + /// The name (guid) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleAssignmentScheduleAsync(string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + { + return await GetRoleAssignmentSchedules().GetAsync(roleAssignmentScheduleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName} + /// + /// + /// Operation Id + /// RoleAssignmentSchedules_Get + /// + /// + /// + /// The name (guid) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleAssignmentSchedule(string roleAssignmentScheduleName, CancellationToken cancellationToken = default) + { + return GetRoleAssignmentSchedules().Get(roleAssignmentScheduleName, cancellationToken); + } + + /// Gets a collection of RoleAssignmentScheduleInstanceResources in the ArmResource. + /// An object representing collection of RoleAssignmentScheduleInstanceResources and their operations over a RoleAssignmentScheduleInstanceResource. + public virtual RoleAssignmentScheduleInstanceCollection GetRoleAssignmentScheduleInstances() + { + return GetCachedClient(client => new RoleAssignmentScheduleInstanceCollection(client, Id)); + } + + /// + /// Gets the specified role assignment schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleInstances_Get + /// + /// + /// + /// The name (hash of schedule name + time) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleAssignmentScheduleInstanceAsync(string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) + { + return await GetRoleAssignmentScheduleInstances().GetAsync(roleAssignmentScheduleInstanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified role assignment schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleInstances_Get + /// + /// + /// + /// The name (hash of schedule name + time) of the role assignment schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleAssignmentScheduleInstance(string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default) + { + return GetRoleAssignmentScheduleInstances().Get(roleAssignmentScheduleInstanceName, cancellationToken); + } + + /// Gets a collection of RoleAssignmentScheduleRequestResources in the ArmResource. + /// An object representing collection of RoleAssignmentScheduleRequestResources and their operations over a RoleAssignmentScheduleRequestResource. + public virtual RoleAssignmentScheduleRequestCollection GetRoleAssignmentScheduleRequests() + { + return GetCachedClient(client => new RoleAssignmentScheduleRequestCollection(client, Id)); + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleRequests_Get + /// + /// + /// + /// The name (guid) of the role assignment schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleAssignmentScheduleRequestAsync(string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) + { + return await GetRoleAssignmentScheduleRequests().GetAsync(roleAssignmentScheduleRequestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName} + /// + /// + /// Operation Id + /// RoleAssignmentScheduleRequests_Get + /// + /// + /// + /// The name (guid) of the role assignment schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleAssignmentScheduleRequest(string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default) + { + return GetRoleAssignmentScheduleRequests().Get(roleAssignmentScheduleRequestName, cancellationToken); + } + + /// Gets a collection of RoleEligibilityScheduleResources in the ArmResource. + /// An object representing collection of RoleEligibilityScheduleResources and their operations over a RoleEligibilityScheduleResource. + public virtual RoleEligibilityScheduleCollection GetRoleEligibilitySchedules() + { + return GetCachedClient(client => new RoleEligibilityScheduleCollection(client, Id)); + } + + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} + /// + /// + /// Operation Id + /// RoleEligibilitySchedules_Get + /// + /// + /// + /// The name (guid) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleEligibilityScheduleAsync(string roleEligibilityScheduleName, CancellationToken cancellationToken = default) + { + return await GetRoleEligibilitySchedules().GetAsync(roleEligibilityScheduleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName} + /// + /// + /// Operation Id + /// RoleEligibilitySchedules_Get + /// + /// + /// + /// The name (guid) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleEligibilitySchedule(string roleEligibilityScheduleName, CancellationToken cancellationToken = default) + { + return GetRoleEligibilitySchedules().Get(roleEligibilityScheduleName, cancellationToken); + } + + /// Gets a collection of RoleEligibilityScheduleInstanceResources in the ArmResource. + /// An object representing collection of RoleEligibilityScheduleInstanceResources and their operations over a RoleEligibilityScheduleInstanceResource. + public virtual RoleEligibilityScheduleInstanceCollection GetRoleEligibilityScheduleInstances() + { + return GetCachedClient(client => new RoleEligibilityScheduleInstanceCollection(client, Id)); + } + + /// + /// Gets the specified role eligibility schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleInstances_Get + /// + /// + /// + /// The name (hash of schedule name + time) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleEligibilityScheduleInstanceAsync(string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + { + return await GetRoleEligibilityScheduleInstances().GetAsync(roleEligibilityScheduleInstanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified role eligibility schedule instance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleInstances_Get + /// + /// + /// + /// The name (hash of schedule name + time) of the role eligibility schedule to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleEligibilityScheduleInstance(string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default) + { + return GetRoleEligibilityScheduleInstances().Get(roleEligibilityScheduleInstanceName, cancellationToken); + } + + /// Gets a collection of RoleEligibilityScheduleRequestResources in the ArmResource. + /// An object representing collection of RoleEligibilityScheduleRequestResources and their operations over a RoleEligibilityScheduleRequestResource. + public virtual RoleEligibilityScheduleRequestCollection GetRoleEligibilityScheduleRequests() + { + return GetCachedClient(client => new RoleEligibilityScheduleRequestCollection(client, Id)); + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleRequests_Get + /// + /// + /// + /// The name (guid) of the role eligibility schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleEligibilityScheduleRequestAsync(string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) + { + return await GetRoleEligibilityScheduleRequests().GetAsync(roleEligibilityScheduleRequestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName} + /// + /// + /// Operation Id + /// RoleEligibilityScheduleRequests_Get + /// + /// + /// + /// The name (guid) of the role eligibility schedule request to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleEligibilityScheduleRequest(string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default) + { + return GetRoleEligibilityScheduleRequests().Get(roleEligibilityScheduleRequestName, cancellationToken); + } + + /// Gets a collection of RoleManagementPolicyResources in the ArmResource. + /// An object representing collection of RoleManagementPolicyResources and their operations over a RoleManagementPolicyResource. + public virtual RoleManagementPolicyCollection GetRoleManagementPolicies() + { + return GetCachedClient(client => new RoleManagementPolicyCollection(client, Id)); + } + + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} + /// + /// + /// Operation Id + /// RoleManagementPolicies_Get + /// + /// + /// + /// The name (guid) of the role management policy to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleManagementPolicyAsync(string roleManagementPolicyName, CancellationToken cancellationToken = default) + { + return await GetRoleManagementPolicies().GetAsync(roleManagementPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName} + /// + /// + /// Operation Id + /// RoleManagementPolicies_Get + /// + /// + /// + /// The name (guid) of the role management policy to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleManagementPolicy(string roleManagementPolicyName, CancellationToken cancellationToken = default) + { + return GetRoleManagementPolicies().Get(roleManagementPolicyName, cancellationToken); + } + + /// Gets a collection of RoleManagementPolicyAssignmentResources in the ArmResource. + /// An object representing collection of RoleManagementPolicyAssignmentResources and their operations over a RoleManagementPolicyAssignmentResource. + public virtual RoleManagementPolicyAssignmentCollection GetRoleManagementPolicyAssignments() + { + return GetCachedClient(client => new RoleManagementPolicyAssignmentCollection(client, Id)); + } + + /// + /// Get the specified role management policy assignment for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} + /// + /// + /// Operation Id + /// RoleManagementPolicyAssignments_Get + /// + /// + /// + /// The name of format {guid_guid} the role management policy assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRoleManagementPolicyAssignmentAsync(string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) + { + return await GetRoleManagementPolicyAssignments().GetAsync(roleManagementPolicyAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified role management policy assignment for a resource scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName} + /// + /// + /// Operation Id + /// RoleManagementPolicyAssignments_Get + /// + /// + /// + /// The name of format {guid_guid} the role management policy assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRoleManagementPolicyAssignment(string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default) + { + return GetRoleManagementPolicyAssignments().Get(roleManagementPolicyAssignmentName, cancellationToken); + } + } +} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationResourceGroupResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationResourceGroupResource.cs new file mode 100644 index 0000000000000..0b04be1b0529e --- /dev/null +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationResourceGroupResource.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Authorization; +using Azure.ResourceManager.Authorization.Models; + +namespace Azure.ResourceManager.Authorization.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAuthorizationResourceGroupResource : ArmResource + { + private ClientDiagnostics _azurePermissionsForResourceGroupClientDiagnostics; + private AzurePermissionsForResourceGroupRestOperations _azurePermissionsForResourceGroupRestClient; + private ClientDiagnostics _azurePermissionsForResourceClientDiagnostics; + private AzurePermissionsForResourceRestOperations _azurePermissionsForResourceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAuthorizationResourceGroupResource() + { + } + + /// 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 MockableAuthorizationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AzurePermissionsForResourceGroupClientDiagnostics => _azurePermissionsForResourceGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzurePermissionsForResourceGroupRestOperations AzurePermissionsForResourceGroupRestClient => _azurePermissionsForResourceGroupRestClient ??= new AzurePermissionsForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AzurePermissionsForResourceClientDiagnostics => _azurePermissionsForResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzurePermissionsForResourceRestOperations AzurePermissionsForResourceRestClient => _azurePermissionsForResourceRestClient ??= new AzurePermissionsForResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all permissions the caller has for a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions + /// + /// + /// Operation Id + /// AzurePermissionsForResourceGroup_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAzurePermissionsForResourceGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzurePermissionsForResourceGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzurePermissionsForResourceGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RoleDefinitionPermission.DeserializeRoleDefinitionPermission, AzurePermissionsForResourceGroupClientDiagnostics, Pipeline, "MockableAuthorizationResourceGroupResource.GetAzurePermissionsForResourceGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all permissions the caller has for a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions + /// + /// + /// Operation Id + /// AzurePermissionsForResourceGroup_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAzurePermissionsForResourceGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzurePermissionsForResourceGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzurePermissionsForResourceGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RoleDefinitionPermission.DeserializeRoleDefinitionPermission, AzurePermissionsForResourceGroupClientDiagnostics, Pipeline, "MockableAuthorizationResourceGroupResource.GetAzurePermissionsForResourceGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all permissions the caller has for a resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions + /// + /// + /// Operation Id + /// AzurePermissionsForResource_List + /// + /// + /// + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource. + /// The name of the resource to get the permissions for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAzurePermissionsForResourcesAsync(string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceProviderNamespace, nameof(resourceProviderNamespace)); + Argument.AssertNotNull(parentResourcePath, nameof(parentResourcePath)); + Argument.AssertNotNull(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => AzurePermissionsForResourceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzurePermissionsForResourceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RoleDefinitionPermission.DeserializeRoleDefinitionPermission, AzurePermissionsForResourceClientDiagnostics, Pipeline, "MockableAuthorizationResourceGroupResource.GetAzurePermissionsForResources", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all permissions the caller has for a resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions + /// + /// + /// Operation Id + /// AzurePermissionsForResource_List + /// + /// + /// + /// The namespace of the resource provider. + /// The parent resource identity. + /// The resource type of the resource. + /// The name of the resource to get the permissions for. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAzurePermissionsForResources(string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceProviderNamespace, nameof(resourceProviderNamespace)); + Argument.AssertNotNull(parentResourcePath, nameof(parentResourcePath)); + Argument.AssertNotNull(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => AzurePermissionsForResourceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzurePermissionsForResourceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RoleDefinitionPermission.DeserializeRoleDefinitionPermission, AzurePermissionsForResourceClientDiagnostics, Pipeline, "MockableAuthorizationResourceGroupResource.GetAzurePermissionsForResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationSubscriptionResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationSubscriptionResource.cs new file mode 100644 index 0000000000000..030b4690d1e21 --- /dev/null +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationSubscriptionResource.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Authorization; +using Azure.ResourceManager.Authorization.Models; + +namespace Azure.ResourceManager.Authorization.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAuthorizationSubscriptionResource : ArmResource + { + private ClientDiagnostics _classicAdministratorsClientDiagnostics; + private ClassicAdministratorsRestOperations _classicAdministratorsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAuthorizationSubscriptionResource() + { + } + + /// 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 MockableAuthorizationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ClassicAdministratorsClientDiagnostics => _classicAdministratorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ClassicAdministratorsRestOperations ClassicAdministratorsRestClient => _classicAdministratorsRestClient ??= new ClassicAdministratorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets service administrator, account administrator, and co-administrators for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators + /// + /// + /// Operation Id + /// ClassicAdministrators_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetClassicAdministratorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ClassicAdministratorsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ClassicAdministratorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AuthorizationClassicAdministrator.DeserializeAuthorizationClassicAdministrator, ClassicAdministratorsClientDiagnostics, Pipeline, "MockableAuthorizationSubscriptionResource.GetClassicAdministrators", "value", "nextLink", cancellationToken); + } + + /// + /// Gets service administrator, account administrator, and co-administrators for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators + /// + /// + /// Operation Id + /// ClassicAdministrators_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetClassicAdministrators(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ClassicAdministratorsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ClassicAdministratorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AuthorizationClassicAdministrator.DeserializeAuthorizationClassicAdministrator, ClassicAdministratorsClientDiagnostics, Pipeline, "MockableAuthorizationSubscriptionResource.GetClassicAdministrators", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationTenantResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationTenantResource.cs new file mode 100644 index 0000000000000..ec42976f14257 --- /dev/null +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/MockableAuthorizationTenantResource.cs @@ -0,0 +1,159 @@ +// 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; +using Azure.ResourceManager.Authorization; + +namespace Azure.ResourceManager.Authorization.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableAuthorizationTenantResource : ArmResource + { + private ClientDiagnostics _globalAdministratorClientDiagnostics; + private GlobalAdministratorRestOperations _globalAdministratorRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAuthorizationTenantResource() + { + } + + /// 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 MockableAuthorizationTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics GlobalAdministratorClientDiagnostics => _globalAdministratorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private GlobalAdministratorRestOperations GlobalAdministratorRestClient => _globalAdministratorRestClient ??= new GlobalAdministratorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AuthorizationProviderOperationsMetadataResources in the TenantResource. + /// An object representing collection of AuthorizationProviderOperationsMetadataResources and their operations over a AuthorizationProviderOperationsMetadataResource. + public virtual AuthorizationProviderOperationsMetadataCollection GetAllAuthorizationProviderOperationsMetadata() + { + return GetCachedClient(client => new AuthorizationProviderOperationsMetadataCollection(client, Id)); + } + + /// + /// Gets provider operations metadata for the specified resource provider. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace} + /// + /// + /// Operation Id + /// ProviderOperationsMetadata_Get + /// + /// + /// + /// The namespace of the resource provider. + /// Specifies whether to expand the values. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetAuthorizationProviderOperationsMetadataAsync(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + return await GetAllAuthorizationProviderOperationsMetadata().GetAsync(resourceProviderNamespace, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets provider operations metadata for the specified resource provider. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace} + /// + /// + /// Operation Id + /// ProviderOperationsMetadata_Get + /// + /// + /// + /// The namespace of the resource provider. + /// Specifies whether to expand the values. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetAuthorizationProviderOperationsMetadata(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) + { + return GetAllAuthorizationProviderOperationsMetadata().Get(resourceProviderNamespace, expand, cancellationToken); + } + + /// + /// Elevates access for a Global Administrator. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/elevateAccess + /// + /// + /// Operation Id + /// GlobalAdministrator_ElevateAccess + /// + /// + /// + /// The cancellation token to use. + public virtual async Task ElevateAccessGlobalAdministratorAsync(CancellationToken cancellationToken = default) + { + using var scope = GlobalAdministratorClientDiagnostics.CreateScope("MockableAuthorizationTenantResource.ElevateAccessGlobalAdministrator"); + scope.Start(); + try + { + var response = await GlobalAdministratorRestClient.ElevateAccessAsync(cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Elevates access for a Global Administrator. + /// + /// + /// Request Path + /// /providers/Microsoft.Authorization/elevateAccess + /// + /// + /// Operation Id + /// GlobalAdministrator_ElevateAccess + /// + /// + /// + /// The cancellation token to use. + public virtual Response ElevateAccessGlobalAdministrator(CancellationToken cancellationToken = default) + { + using var scope = GlobalAdministratorClientDiagnostics.CreateScope("MockableAuthorizationTenantResource.ElevateAccessGlobalAdministrator"); + scope.Start(); + try + { + var response = GlobalAdministratorRestClient.ElevateAccess(cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ccda8fa0f68e7..0000000000000 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Authorization.Models; - -namespace Azure.ResourceManager.Authorization -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _azurePermissionsForResourceGroupClientDiagnostics; - private AzurePermissionsForResourceGroupRestOperations _azurePermissionsForResourceGroupRestClient; - private ClientDiagnostics _azurePermissionsForResourceClientDiagnostics; - private AzurePermissionsForResourceRestOperations _azurePermissionsForResourceRestClient; - - /// 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 ClientDiagnostics AzurePermissionsForResourceGroupClientDiagnostics => _azurePermissionsForResourceGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AzurePermissionsForResourceGroupRestOperations AzurePermissionsForResourceGroupRestClient => _azurePermissionsForResourceGroupRestClient ??= new AzurePermissionsForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AzurePermissionsForResourceClientDiagnostics => _azurePermissionsForResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AzurePermissionsForResourceRestOperations AzurePermissionsForResourceRestClient => _azurePermissionsForResourceRestClient ??= new AzurePermissionsForResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets all permissions the caller has for a resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions - /// - /// - /// Operation Id - /// AzurePermissionsForResourceGroup_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAzurePermissionsForResourceGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzurePermissionsForResourceGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzurePermissionsForResourceGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RoleDefinitionPermission.DeserializeRoleDefinitionPermission, AzurePermissionsForResourceGroupClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAzurePermissionsForResourceGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all permissions the caller has for a resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions - /// - /// - /// Operation Id - /// AzurePermissionsForResourceGroup_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAzurePermissionsForResourceGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzurePermissionsForResourceGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzurePermissionsForResourceGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RoleDefinitionPermission.DeserializeRoleDefinitionPermission, AzurePermissionsForResourceGroupClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAzurePermissionsForResourceGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions - /// - /// - /// Operation Id - /// AzurePermissionsForResource_List - /// - /// - /// - /// The namespace of the resource provider. - /// The parent resource identity. - /// The resource type of the resource. - /// The name of the resource to get the permissions for. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAzurePermissionsForResourcesAsync(string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzurePermissionsForResourceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzurePermissionsForResourceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RoleDefinitionPermission.DeserializeRoleDefinitionPermission, AzurePermissionsForResourceClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAzurePermissionsForResources", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions - /// - /// - /// Operation Id - /// AzurePermissionsForResource_List - /// - /// - /// - /// The namespace of the resource provider. - /// The parent resource identity. - /// The resource type of the resource. - /// The name of the resource to get the permissions for. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAzurePermissionsForResources(string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzurePermissionsForResourceRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzurePermissionsForResourceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RoleDefinitionPermission.DeserializeRoleDefinitionPermission, AzurePermissionsForResourceClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAzurePermissionsForResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index e92eb289b53a1..0000000000000 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Authorization.Models; - -namespace Azure.ResourceManager.Authorization -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _classicAdministratorsClientDiagnostics; - private ClassicAdministratorsRestOperations _classicAdministratorsRestClient; - - /// 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 ClassicAdministratorsClientDiagnostics => _classicAdministratorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ClassicAdministratorsRestOperations ClassicAdministratorsRestClient => _classicAdministratorsRestClient ??= new ClassicAdministratorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets service administrator, account administrator, and co-administrators for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators - /// - /// - /// Operation Id - /// ClassicAdministrators_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetClassicAdministratorsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClassicAdministratorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ClassicAdministratorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AuthorizationClassicAdministrator.DeserializeAuthorizationClassicAdministrator, ClassicAdministratorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClassicAdministrators", "value", "nextLink", cancellationToken); - } - - /// - /// Gets service administrator, account administrator, and co-administrators for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators - /// - /// - /// Operation Id - /// ClassicAdministrators_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetClassicAdministrators(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClassicAdministratorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ClassicAdministratorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AuthorizationClassicAdministrator.DeserializeAuthorizationClassicAdministrator, ClassicAdministratorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClassicAdministrators", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 0a3ef7b8099e4..0000000000000 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,112 +0,0 @@ -// 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.Authorization -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _globalAdministratorClientDiagnostics; - private GlobalAdministratorRestOperations _globalAdministratorRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics GlobalAdministratorClientDiagnostics => _globalAdministratorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Authorization", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private GlobalAdministratorRestOperations GlobalAdministratorRestClient => _globalAdministratorRestClient ??= new GlobalAdministratorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of AuthorizationProviderOperationsMetadataResources in the TenantResource. - /// An object representing collection of AuthorizationProviderOperationsMetadataResources and their operations over a AuthorizationProviderOperationsMetadataResource. - public virtual AuthorizationProviderOperationsMetadataCollection GetAllAuthorizationProviderOperationsMetadata() - { - return GetCachedClient(Client => new AuthorizationProviderOperationsMetadataCollection(Client, Id)); - } - - /// - /// Elevates access for a Global Administrator. - /// - /// - /// Request Path - /// /providers/Microsoft.Authorization/elevateAccess - /// - /// - /// Operation Id - /// GlobalAdministrator_ElevateAccess - /// - /// - /// - /// The cancellation token to use. - public virtual async Task ElevateAccessGlobalAdministratorAsync(CancellationToken cancellationToken = default) - { - using var scope = GlobalAdministratorClientDiagnostics.CreateScope("TenantResourceExtensionClient.ElevateAccessGlobalAdministrator"); - scope.Start(); - try - { - var response = await GlobalAdministratorRestClient.ElevateAccessAsync(cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Elevates access for a Global Administrator. - /// - /// - /// Request Path - /// /providers/Microsoft.Authorization/elevateAccess - /// - /// - /// Operation Id - /// GlobalAdministrator_ElevateAccess - /// - /// - /// - /// The cancellation token to use. - public virtual Response ElevateAccessGlobalAdministrator(CancellationToken cancellationToken = default) - { - using var scope = GlobalAdministratorClientDiagnostics.CreateScope("TenantResourceExtensionClient.ElevateAccessGlobalAdministrator"); - scope.Start(); - try - { - var response = GlobalAdministratorRestClient.ElevateAccess(cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentResource.cs index 2b56e1d84d2cc..bf24af68cc155 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleAssignmentName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceResource.cs index 60cfde8ceca92..3721b86abc433 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleInstanceResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleAssignmentScheduleInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleAssignmentScheduleInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleAssignmentScheduleInstanceName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestResource.cs index 2d5ca80943558..1786a5af5aeef 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleRequestResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleAssignmentScheduleRequestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleAssignmentScheduleRequestName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleAssignmentScheduleRequestName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleResource.cs index 119b26142e92f..f84e5ef857322 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleAssignmentScheduleResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleAssignmentScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleAssignmentScheduleName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleAssignmentScheduleName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceResource.cs index bb7e3280c7b17..8a560b69e8711 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleInstanceResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleEligibilityScheduleInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleEligibilityScheduleInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleEligibilityScheduleInstanceName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestResource.cs index eb08e22a22be3..29db8feb8bb2c 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleRequestResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleEligibilityScheduleRequestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleEligibilityScheduleRequestName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleEligibilityScheduleRequestName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleResource.cs index 54fc65ec0c13a..29a8300dece63 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleEligibilityScheduleResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleEligibilityScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleEligibilityScheduleName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleEligibilityScheduleName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentResource.cs index 7bcc9efadfd66..44a203884fabc 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyAssignmentResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleManagementPolicyAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleManagementPolicyAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleManagementPolicyAssignmentName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"; diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyResource.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyResource.cs index d980747c2ae79..ddf9b27ee324b 100644 --- a/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyResource.cs +++ b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/RoleManagementPolicyResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Authorization public partial class RoleManagementPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The roleManagementPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string roleManagementPolicyName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"; diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/api/Azure.ResourceManager.Automanage.netstandard2.0.cs b/sdk/automanage/Azure.ResourceManager.Automanage/api/Azure.ResourceManager.Automanage.netstandard2.0.cs index 7503a1d37fd2c..bfe26fbb3f999 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/api/Azure.ResourceManager.Automanage.netstandard2.0.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/api/Azure.ResourceManager.Automanage.netstandard2.0.cs @@ -69,7 +69,7 @@ protected AutomanageConfigurationProfileCollection() { } } public partial class AutomanageConfigurationProfileData : Azure.ResourceManager.Models.TrackedResourceData { - public AutomanageConfigurationProfileData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AutomanageConfigurationProfileData(Azure.Core.AzureLocation location) { } public System.BinaryData Configuration { get { throw null; } set { } } } public partial class AutomanageConfigurationProfileResource : Azure.ResourceManager.ArmResource @@ -343,6 +343,55 @@ protected AutomanageVmConfigurationProfileAssignmentResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Automanage.AutomanageConfigurationProfileAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Automanage.Mocking +{ + public partial class MockableAutomanageArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAutomanageArmClient() { } + public virtual Azure.ResourceManager.Automanage.AutomanageBestPracticeResource GetAutomanageBestPracticeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageConfigurationProfileResource GetAutomanageConfigurationProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageConfigurationProfileVersionResource GetAutomanageConfigurationProfileVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetAutomanageHciClusterConfigurationProfileAssignment(Azure.Core.ResourceIdentifier scope, string configurationProfileAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutomanageHciClusterConfigurationProfileAssignmentAsync(Azure.Core.ResourceIdentifier scope, string configurationProfileAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageHciClusterConfigurationProfileAssignmentReportResource GetAutomanageHciClusterConfigurationProfileAssignmentReportResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageHciClusterConfigurationProfileAssignmentResource GetAutomanageHciClusterConfigurationProfileAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageHciClusterConfigurationProfileAssignmentCollection GetAutomanageHciClusterConfigurationProfileAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetAutomanageHcrpConfigurationProfileAssignment(Azure.Core.ResourceIdentifier scope, string configurationProfileAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutomanageHcrpConfigurationProfileAssignmentAsync(Azure.Core.ResourceIdentifier scope, string configurationProfileAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageHcrpConfigurationProfileAssignmentReportResource GetAutomanageHcrpConfigurationProfileAssignmentReportResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageHcrpConfigurationProfileAssignmentResource GetAutomanageHcrpConfigurationProfileAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageHcrpConfigurationProfileAssignmentCollection GetAutomanageHcrpConfigurationProfileAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetAutomanageVmConfigurationProfileAssignment(Azure.Core.ResourceIdentifier scope, string configurationProfileAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutomanageVmConfigurationProfileAssignmentAsync(Azure.Core.ResourceIdentifier scope, string configurationProfileAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageVmConfigurationProfileAssignmentReportResource GetAutomanageVmConfigurationProfileAssignmentReportResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageVmConfigurationProfileAssignmentResource GetAutomanageVmConfigurationProfileAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageVmConfigurationProfileAssignmentCollection GetAutomanageVmConfigurationProfileAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + } + public partial class MockableAutomanageResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAutomanageResourceGroupResource() { } + public virtual Azure.Response GetAutomanageConfigurationProfile(string configurationProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutomanageConfigurationProfileAsync(string configurationProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageConfigurationProfileCollection GetAutomanageConfigurationProfiles() { throw null; } + } + public partial class MockableAutomanageSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAutomanageSubscriptionResource() { } + public virtual Azure.Pageable GetAutomanageConfigurationProfiles(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAutomanageConfigurationProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetServicePrincipal(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServicePrincipalAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetServicePrincipals(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetServicePrincipalsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAutomanageTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableAutomanageTenantResource() { } + public virtual Azure.Response GetAutomanageBestPractice(string bestPracticeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutomanageBestPracticeAsync(string bestPracticeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Automanage.AutomanageBestPracticeCollection GetAutomanageBestPractices() { throw null; } + } +} namespace Azure.ResourceManager.Automanage.Models { public static partial class ArmAutomanageModelFactory diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeResource.cs index 08d56029ac460..c814ce7021305 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageBestPracticeResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageBestPracticeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The bestPracticeName. public static ResourceIdentifier CreateResourceIdentifier(string bestPracticeName) { var resourceId = $"/providers/Microsoft.Automanage/bestPractices/{bestPracticeName}"; diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileResource.cs index 9066d58d1d95c..c4e219cceff33 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageConfigurationProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The configurationProfileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configurationProfileName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AutomanageConfigurationProfileVersionResources and their operations over a AutomanageConfigurationProfileVersionResource. public virtual AutomanageConfigurationProfileVersionCollection GetAutomanageConfigurationProfileVersions() { - return GetCachedClient(Client => new AutomanageConfigurationProfileVersionCollection(Client, Id)); + return GetCachedClient(client => new AutomanageConfigurationProfileVersionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual AutomanageConfigurationProfileVersionCollection GetAutomanageConf /// /// The configuration profile version name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomanageConfigurationProfileVersionAsync(string versionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task /// The configuration profile version name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomanageConfigurationProfileVersion(string versionName, CancellationToken cancellationToken = default) { diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionResource.cs index 82fbc5a8060f7..885965443046c 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileVersionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageConfigurationProfileVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The configurationProfileName. + /// The versionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configurationProfileName, string versionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName}/versions/{versionName}"; diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportResource.cs index f8bd209d164f1..bdb56419ce2db 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentReportResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageHciClusterConfigurationProfileAssignmentReportResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The configurationProfileAssignmentName. + /// The reportName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string configurationProfileAssignmentName, string reportName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}"; diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentResource.cs index 12dbc74103977..22914fe8d6ef7 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageHciClusterConfigurationProfileAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The configurationProfileAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string configurationProfileAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AutomanageHciClusterConfigurationProfileAssignmentReportResources and their operations over a AutomanageHciClusterConfigurationProfileAssignmentReportResource. public virtual AutomanageHciClusterConfigurationProfileAssignmentReportCollection GetAutomanageHciClusterConfigurationProfileAssignmentReports() { - return GetCachedClient(Client => new AutomanageHciClusterConfigurationProfileAssignmentReportCollection(Client, Id)); + return GetCachedClient(client => new AutomanageHciClusterConfigurationProfileAssignmentReportCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual AutomanageHciClusterConfigurationProfileAssignmentReportCollectio /// /// The report name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomanageHciClusterConfigurationProfileAssignmentReportAsync(string reportName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task /// The report name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomanageHciClusterConfigurationProfileAssignmentReport(string reportName, CancellationToken cancellationToken = default) { diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportResource.cs index 13e095da72f97..a4f0f396880d1 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentReportResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageHcrpConfigurationProfileAssignmentReportResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The machineName. + /// The configurationProfileAssignmentName. + /// The reportName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string machineName, string configurationProfileAssignmentName, string reportName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}"; diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentResource.cs index 8ab0eb8e62270..a315b12120dba 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageHcrpConfigurationProfileAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The machineName. + /// The configurationProfileAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string machineName, string configurationProfileAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AutomanageHcrpConfigurationProfileAssignmentReportResources and their operations over a AutomanageHcrpConfigurationProfileAssignmentReportResource. public virtual AutomanageHcrpConfigurationProfileAssignmentReportCollection GetAutomanageHcrpConfigurationProfileAssignmentReports() { - return GetCachedClient(Client => new AutomanageHcrpConfigurationProfileAssignmentReportCollection(Client, Id)); + return GetCachedClient(client => new AutomanageHcrpConfigurationProfileAssignmentReportCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual AutomanageHcrpConfigurationProfileAssignmentReportCollection GetA /// /// The report name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomanageHcrpConfigurationProfileAssignmentReportAsync(string reportName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task /// The report name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomanageHcrpConfigurationProfileAssignmentReport(string reportName, CancellationToken cancellationToken = default) { diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportResource.cs index 6fdc47074197d..8c5c70ef44d18 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentReportResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageVmConfigurationProfileAssignmentReportResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmName. + /// The configurationProfileAssignmentName. + /// The reportName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmName, string configurationProfileAssignmentName, string reportName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}"; diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentResource.cs index 2e19d658f0109..92dbf3df91ed1 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Automanage public partial class AutomanageVmConfigurationProfileAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmName. + /// The configurationProfileAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmName, string configurationProfileAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AutomanageVmConfigurationProfileAssignmentReportResources and their operations over a AutomanageVmConfigurationProfileAssignmentReportResource. public virtual AutomanageVmConfigurationProfileAssignmentReportCollection GetAutomanageVmConfigurationProfileAssignmentReports() { - return GetCachedClient(Client => new AutomanageVmConfigurationProfileAssignmentReportCollection(Client, Id)); + return GetCachedClient(client => new AutomanageVmConfigurationProfileAssignmentReportCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual AutomanageVmConfigurationProfileAssignmentReportCollection GetAut /// /// The report name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomanageVmConfigurationProfileAssignmentReportAsync(string reportName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task /// The report name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomanageVmConfigurationProfileAssignmentReport(string reportName, CancellationToken cancellationToken = default) { diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 1f83f1bd36a8e..0000000000000 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Automanage -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of AutomanageVmConfigurationProfileAssignmentResources in the ArmResource. - /// An object representing collection of AutomanageVmConfigurationProfileAssignmentResources and their operations over a AutomanageVmConfigurationProfileAssignmentResource. - public virtual AutomanageVmConfigurationProfileAssignmentCollection GetAutomanageVmConfigurationProfileAssignments() - { - return GetCachedClient(Client => new AutomanageVmConfigurationProfileAssignmentCollection(Client, Id)); - } - - /// Gets a collection of AutomanageHcrpConfigurationProfileAssignmentResources in the ArmResource. - /// An object representing collection of AutomanageHcrpConfigurationProfileAssignmentResources and their operations over a AutomanageHcrpConfigurationProfileAssignmentResource. - public virtual AutomanageHcrpConfigurationProfileAssignmentCollection GetAutomanageHcrpConfigurationProfileAssignments() - { - return GetCachedClient(Client => new AutomanageHcrpConfigurationProfileAssignmentCollection(Client, Id)); - } - - /// Gets a collection of AutomanageHciClusterConfigurationProfileAssignmentResources in the ArmResource. - /// An object representing collection of AutomanageHciClusterConfigurationProfileAssignmentResources and their operations over a AutomanageHciClusterConfigurationProfileAssignmentResource. - public virtual AutomanageHciClusterConfigurationProfileAssignmentCollection GetAutomanageHciClusterConfigurationProfileAssignments() - { - return GetCachedClient(Client => new AutomanageHciClusterConfigurationProfileAssignmentCollection(Client, Id)); - } - } -} diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/AutomanageExtensions.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/AutomanageExtensions.cs index 2e9f223dfa6da..50311e2e75d96 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/AutomanageExtensions.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/AutomanageExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Automanage.Mocking; using Azure.ResourceManager.Automanage.Models; using Azure.ResourceManager.Resources; @@ -19,251 +20,39 @@ namespace Azure.ResourceManager.Automanage /// A class to add extension methods to Azure.ResourceManager.Automanage. public static partial class AutomanageExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableAutomanageArmClient GetMockableAutomanageArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAutomanageArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAutomanageResourceGroupResource GetMockableAutomanageResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAutomanageResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAutomanageSubscriptionResource GetMockableAutomanageSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAutomanageSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAutomanageTenantResource GetMockableAutomanageTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAutomanageTenantResource(client, resource.Id)); } - 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); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region AutomanageBestPracticeResource - /// - /// 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 AutomanageBestPracticeResource GetAutomanageBestPracticeResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageBestPracticeResource.ValidateResourceId(id); - return new AutomanageBestPracticeResource(client, id); - } - ); - } - #endregion - - #region AutomanageConfigurationProfileResource - /// - /// 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 AutomanageConfigurationProfileResource GetAutomanageConfigurationProfileResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageConfigurationProfileResource.ValidateResourceId(id); - return new AutomanageConfigurationProfileResource(client, id); - } - ); - } - #endregion - - #region AutomanageConfigurationProfileVersionResource - /// - /// 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 AutomanageConfigurationProfileVersionResource GetAutomanageConfigurationProfileVersionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageConfigurationProfileVersionResource.ValidateResourceId(id); - return new AutomanageConfigurationProfileVersionResource(client, id); - } - ); - } - #endregion - - #region AutomanageVmConfigurationProfileAssignmentResource - /// - /// 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 AutomanageVmConfigurationProfileAssignmentResource GetAutomanageVmConfigurationProfileAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageVmConfigurationProfileAssignmentResource.ValidateResourceId(id); - return new AutomanageVmConfigurationProfileAssignmentResource(client, id); - } - ); - } - #endregion - - #region AutomanageHcrpConfigurationProfileAssignmentResource - /// - /// 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 AutomanageHcrpConfigurationProfileAssignmentResource GetAutomanageHcrpConfigurationProfileAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageHcrpConfigurationProfileAssignmentResource.ValidateResourceId(id); - return new AutomanageHcrpConfigurationProfileAssignmentResource(client, id); - } - ); - } - #endregion - - #region AutomanageHciClusterConfigurationProfileAssignmentResource - /// - /// 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 AutomanageHciClusterConfigurationProfileAssignmentResource GetAutomanageHciClusterConfigurationProfileAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageHciClusterConfigurationProfileAssignmentResource.ValidateResourceId(id); - return new AutomanageHciClusterConfigurationProfileAssignmentResource(client, id); - } - ); - } - #endregion - - #region AutomanageVmConfigurationProfileAssignmentReportResource /// - /// 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 AutomanageVmConfigurationProfileAssignmentReportResource GetAutomanageVmConfigurationProfileAssignmentReportResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageVmConfigurationProfileAssignmentReportResource.ValidateResourceId(id); - return new AutomanageVmConfigurationProfileAssignmentReportResource(client, id); - } - ); - } - #endregion - - #region AutomanageHcrpConfigurationProfileAssignmentReportResource - /// - /// 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 AutomanageHcrpConfigurationProfileAssignmentReportResource GetAutomanageHcrpConfigurationProfileAssignmentReportResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageHcrpConfigurationProfileAssignmentReportResource.ValidateResourceId(id); - return new AutomanageHcrpConfigurationProfileAssignmentReportResource(client, id); - } - ); - } - #endregion - - #region AutomanageHciClusterConfigurationProfileAssignmentReportResource - /// - /// 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. + /// Gets a collection of AutomanageVmConfigurationProfileAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static AutomanageHciClusterConfigurationProfileAssignmentReportResource GetAutomanageHciClusterConfigurationProfileAssignmentReportResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutomanageHciClusterConfigurationProfileAssignmentReportResource.ValidateResourceId(id); - return new AutomanageHciClusterConfigurationProfileAssignmentReportResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of AutomanageVmConfigurationProfileAssignmentResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachines. /// An object representing collection of AutomanageVmConfigurationProfileAssignmentResources and their operations over a AutomanageVmConfigurationProfileAssignmentResource. public static AutomanageVmConfigurationProfileAssignmentCollection GetAutomanageVmConfigurationProfileAssignments(this ArmClient client, ResourceIdentifier scope) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachines", scope.ResourceType)); - } - return GetArmResourceExtensionClient(client, scope).GetAutomanageVmConfigurationProfileAssignments(); + return GetMockableAutomanageArmClient(client).GetAutomanageVmConfigurationProfileAssignments(scope); } /// @@ -278,21 +67,21 @@ public static AutomanageVmConfigurationProfileAssignmentCollection GetAutomanage /// ConfigurationProfileAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachines. /// The configuration profile assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutomanageVmConfigurationProfileAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachines", scope.ResourceType)); - } - return await client.GetAutomanageVmConfigurationProfileAssignments(scope).GetAsync(configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableAutomanageArmClient(client).GetAutomanageVmConfigurationProfileAssignmentAsync(scope, configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -307,34 +96,36 @@ public static async TaskConfigurationProfileAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachines. /// The configuration profile assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutomanageVmConfigurationProfileAssignment(this ArmClient client, ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachines", scope.ResourceType)); - } - return client.GetAutomanageVmConfigurationProfileAssignments(scope).Get(configurationProfileAssignmentName, cancellationToken); + return GetMockableAutomanageArmClient(client).GetAutomanageVmConfigurationProfileAssignment(scope, configurationProfileAssignmentName, cancellationToken); } - /// Gets a collection of AutomanageHcrpConfigurationProfileAssignmentResources in the ArmResource. + /// + /// Gets a collection of AutomanageHcrpConfigurationProfileAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.HybridCompute/machines. /// An object representing collection of AutomanageHcrpConfigurationProfileAssignmentResources and their operations over a AutomanageHcrpConfigurationProfileAssignmentResource. public static AutomanageHcrpConfigurationProfileAssignmentCollection GetAutomanageHcrpConfigurationProfileAssignments(this ArmClient client, ResourceIdentifier scope) { - if (!scope.ResourceType.Equals("Microsoft.HybridCompute/machines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.HybridCompute/machines", scope.ResourceType)); - } - return GetArmResourceExtensionClient(client, scope).GetAutomanageHcrpConfigurationProfileAssignments(); + return GetMockableAutomanageArmClient(client).GetAutomanageHcrpConfigurationProfileAssignments(scope); } /// @@ -349,21 +140,21 @@ public static AutomanageHcrpConfigurationProfileAssignmentCollection GetAutomana /// ConfigurationProfileHCRPAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.HybridCompute/machines. /// The configuration profile assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutomanageHcrpConfigurationProfileAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.HybridCompute/machines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.HybridCompute/machines", scope.ResourceType)); - } - return await client.GetAutomanageHcrpConfigurationProfileAssignments(scope).GetAsync(configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableAutomanageArmClient(client).GetAutomanageHcrpConfigurationProfileAssignmentAsync(scope, configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -378,34 +169,36 @@ public static async TaskConfigurationProfileHCRPAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.HybridCompute/machines. /// The configuration profile assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutomanageHcrpConfigurationProfileAssignment(this ArmClient client, ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.HybridCompute/machines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.HybridCompute/machines", scope.ResourceType)); - } - return client.GetAutomanageHcrpConfigurationProfileAssignments(scope).Get(configurationProfileAssignmentName, cancellationToken); + return GetMockableAutomanageArmClient(client).GetAutomanageHcrpConfigurationProfileAssignment(scope, configurationProfileAssignmentName, cancellationToken); } - /// Gets a collection of AutomanageHciClusterConfigurationProfileAssignmentResources in the ArmResource. + /// + /// Gets a collection of AutomanageHciClusterConfigurationProfileAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.AzureStackHci/clusters. /// An object representing collection of AutomanageHciClusterConfigurationProfileAssignmentResources and their operations over a AutomanageHciClusterConfigurationProfileAssignmentResource. public static AutomanageHciClusterConfigurationProfileAssignmentCollection GetAutomanageHciClusterConfigurationProfileAssignments(this ArmClient client, ResourceIdentifier scope) { - if (!scope.ResourceType.Equals("Microsoft.AzureStackHci/clusters")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.AzureStackHci/clusters", scope.ResourceType)); - } - return GetArmResourceExtensionClient(client, scope).GetAutomanageHciClusterConfigurationProfileAssignments(); + return GetMockableAutomanageArmClient(client).GetAutomanageHciClusterConfigurationProfileAssignments(scope); } /// @@ -420,21 +213,21 @@ public static AutomanageHciClusterConfigurationProfileAssignmentCollection GetAu /// ConfigurationProfileHCIAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.AzureStackHci/clusters. /// The configuration profile assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutomanageHciClusterConfigurationProfileAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.AzureStackHci/clusters")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.AzureStackHci/clusters", scope.ResourceType)); - } - return await client.GetAutomanageHciClusterConfigurationProfileAssignments(scope).GetAsync(configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableAutomanageArmClient(client).GetAutomanageHciClusterConfigurationProfileAssignmentAsync(scope, configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -449,29 +242,179 @@ public static async TaskConfigurationProfileHCIAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.AzureStackHci/clusters. /// The configuration profile assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutomanageHciClusterConfigurationProfileAssignment(this ArmClient client, ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.AzureStackHci/clusters")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.AzureStackHci/clusters", scope.ResourceType)); - } - return client.GetAutomanageHciClusterConfigurationProfileAssignments(scope).Get(configurationProfileAssignmentName, cancellationToken); + return GetMockableAutomanageArmClient(client).GetAutomanageHciClusterConfigurationProfileAssignment(scope, configurationProfileAssignmentName, cancellationToken); } - /// Gets a collection of AutomanageConfigurationProfileResources in the ResourceGroupResource. + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageBestPracticeResource GetAutomanageBestPracticeResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageBestPracticeResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageConfigurationProfileResource GetAutomanageConfigurationProfileResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageConfigurationProfileResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageConfigurationProfileVersionResource GetAutomanageConfigurationProfileVersionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageConfigurationProfileVersionResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageVmConfigurationProfileAssignmentResource GetAutomanageVmConfigurationProfileAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageVmConfigurationProfileAssignmentResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageHcrpConfigurationProfileAssignmentResource GetAutomanageHcrpConfigurationProfileAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageHcrpConfigurationProfileAssignmentResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageHciClusterConfigurationProfileAssignmentResource GetAutomanageHciClusterConfigurationProfileAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageHciClusterConfigurationProfileAssignmentResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageVmConfigurationProfileAssignmentReportResource GetAutomanageVmConfigurationProfileAssignmentReportResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageVmConfigurationProfileAssignmentReportResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageHcrpConfigurationProfileAssignmentReportResource GetAutomanageHcrpConfigurationProfileAssignmentReportResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageHcrpConfigurationProfileAssignmentReportResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutomanageHciClusterConfigurationProfileAssignmentReportResource GetAutomanageHciClusterConfigurationProfileAssignmentReportResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableAutomanageArmClient(client).GetAutomanageHciClusterConfigurationProfileAssignmentReportResource(id); + } + + /// + /// Gets a collection of AutomanageConfigurationProfileResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AutomanageConfigurationProfileResources and their operations over a AutomanageConfigurationProfileResource. public static AutomanageConfigurationProfileCollection GetAutomanageConfigurationProfiles(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAutomanageConfigurationProfiles(); + return GetMockableAutomanageResourceGroupResource(resourceGroupResource).GetAutomanageConfigurationProfiles(); } /// @@ -486,16 +429,20 @@ public static AutomanageConfigurationProfileCollection GetAutomanageConfiguratio /// ConfigurationProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The configuration profile name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutomanageConfigurationProfileAsync(this ResourceGroupResource resourceGroupResource, string configurationProfileName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAutomanageConfigurationProfiles().GetAsync(configurationProfileName, cancellationToken).ConfigureAwait(false); + return await GetMockableAutomanageResourceGroupResource(resourceGroupResource).GetAutomanageConfigurationProfileAsync(configurationProfileName, cancellationToken).ConfigureAwait(false); } /// @@ -510,16 +457,20 @@ public static async Task> GetAu /// ConfigurationProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The configuration profile name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutomanageConfigurationProfile(this ResourceGroupResource resourceGroupResource, string configurationProfileName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAutomanageConfigurationProfiles().Get(configurationProfileName, cancellationToken); + return GetMockableAutomanageResourceGroupResource(resourceGroupResource).GetAutomanageConfigurationProfile(configurationProfileName, cancellationToken); } /// @@ -534,13 +485,17 @@ public static Response GetAutomanageConf /// ConfigurationProfiles_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAutomanageConfigurationProfilesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutomanageConfigurationProfilesAsync(cancellationToken); + return GetMockableAutomanageSubscriptionResource(subscriptionResource).GetAutomanageConfigurationProfilesAsync(cancellationToken); } /// @@ -555,13 +510,17 @@ public static AsyncPageable GetAutomanag /// ConfigurationProfiles_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAutomanageConfigurationProfiles(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutomanageConfigurationProfiles(cancellationToken); + return GetMockableAutomanageSubscriptionResource(subscriptionResource).GetAutomanageConfigurationProfiles(cancellationToken); } /// @@ -576,13 +535,17 @@ public static Pageable GetAutomanageConf /// ServicePrincipals_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServicePrincipalsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServicePrincipalsAsync(cancellationToken); + return GetMockableAutomanageSubscriptionResource(subscriptionResource).GetServicePrincipalsAsync(cancellationToken); } /// @@ -597,13 +560,17 @@ public static AsyncPageable GetServicePrincipals /// ServicePrincipals_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServicePrincipals(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServicePrincipals(cancellationToken); + return GetMockableAutomanageSubscriptionResource(subscriptionResource).GetServicePrincipals(cancellationToken); } /// @@ -618,12 +585,16 @@ public static Pageable GetServicePrincipals(this /// ServicePrincipals_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetServicePrincipalAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetServicePrincipalAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableAutomanageSubscriptionResource(subscriptionResource).GetServicePrincipalAsync(cancellationToken).ConfigureAwait(false); } /// @@ -638,20 +609,30 @@ public static async Task> GetServicePri /// ServicePrincipals_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetServicePrincipal(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServicePrincipal(cancellationToken); + return GetMockableAutomanageSubscriptionResource(subscriptionResource).GetServicePrincipal(cancellationToken); } - /// Gets a collection of AutomanageBestPracticeResources in the TenantResource. + /// + /// Gets a collection of AutomanageBestPracticeResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AutomanageBestPracticeResources and their operations over a AutomanageBestPracticeResource. public static AutomanageBestPracticeCollection GetAutomanageBestPractices(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetAutomanageBestPractices(); + return GetMockableAutomanageTenantResource(tenantResource).GetAutomanageBestPractices(); } /// @@ -666,16 +647,20 @@ public static AutomanageBestPracticeCollection GetAutomanageBestPractices(this T /// BestPractices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Automanage best practice name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutomanageBestPracticeAsync(this TenantResource tenantResource, string bestPracticeName, CancellationToken cancellationToken = default) { - return await tenantResource.GetAutomanageBestPractices().GetAsync(bestPracticeName, cancellationToken).ConfigureAwait(false); + return await GetMockableAutomanageTenantResource(tenantResource).GetAutomanageBestPracticeAsync(bestPracticeName, cancellationToken).ConfigureAwait(false); } /// @@ -690,16 +675,20 @@ public static async Task> GetAutomanage /// BestPractices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Automanage best practice name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutomanageBestPractice(this TenantResource tenantResource, string bestPracticeName, CancellationToken cancellationToken = default) { - return tenantResource.GetAutomanageBestPractices().Get(bestPracticeName, cancellationToken); + return GetMockableAutomanageTenantResource(tenantResource).GetAutomanageBestPractice(bestPracticeName, cancellationToken); } } } diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageArmClient.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageArmClient.cs new file mode 100644 index 0000000000000..f02e8b84a893e --- /dev/null +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageArmClient.cs @@ -0,0 +1,331 @@ +// 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.Automanage; + +namespace Azure.ResourceManager.Automanage.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAutomanageArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAutomanageArmClient() + { + } + + /// 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 MockableAutomanageArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAutomanageArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AutomanageVmConfigurationProfileAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of AutomanageVmConfigurationProfileAssignmentResources and their operations over a AutomanageVmConfigurationProfileAssignmentResource. + public virtual AutomanageVmConfigurationProfileAssignmentCollection GetAutomanageVmConfigurationProfileAssignments(ResourceIdentifier scope) + { + if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachines")) + { + throw new ArgumentException(string.Format("Invalid resource type {0}, expected Microsoft.Compute/virtualMachines", scope.ResourceType)); + } + return new AutomanageVmConfigurationProfileAssignmentCollection(Client, scope); + } + + /// + /// Get information about a configuration profile assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutomanageVmConfigurationProfileAssignmentAsync(ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + return await GetAutomanageVmConfigurationProfileAssignments(scope).GetAsync(configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a configuration profile assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutomanageVmConfigurationProfileAssignment(ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + return GetAutomanageVmConfigurationProfileAssignments(scope).Get(configurationProfileAssignmentName, cancellationToken); + } + + /// Gets a collection of AutomanageHcrpConfigurationProfileAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of AutomanageHcrpConfigurationProfileAssignmentResources and their operations over a AutomanageHcrpConfigurationProfileAssignmentResource. + public virtual AutomanageHcrpConfigurationProfileAssignmentCollection GetAutomanageHcrpConfigurationProfileAssignments(ResourceIdentifier scope) + { + if (!scope.ResourceType.Equals("Microsoft.HybridCompute/machines")) + { + throw new ArgumentException(string.Format("Invalid resource type {0}, expected Microsoft.HybridCompute/machines", scope.ResourceType)); + } + return new AutomanageHcrpConfigurationProfileAssignmentCollection(Client, scope); + } + + /// + /// Get information about a configuration profile assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileHCRPAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutomanageHcrpConfigurationProfileAssignmentAsync(ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + return await GetAutomanageHcrpConfigurationProfileAssignments(scope).GetAsync(configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a configuration profile assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileHCRPAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutomanageHcrpConfigurationProfileAssignment(ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + return GetAutomanageHcrpConfigurationProfileAssignments(scope).Get(configurationProfileAssignmentName, cancellationToken); + } + + /// Gets a collection of AutomanageHciClusterConfigurationProfileAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of AutomanageHciClusterConfigurationProfileAssignmentResources and their operations over a AutomanageHciClusterConfigurationProfileAssignmentResource. + public virtual AutomanageHciClusterConfigurationProfileAssignmentCollection GetAutomanageHciClusterConfigurationProfileAssignments(ResourceIdentifier scope) + { + if (!scope.ResourceType.Equals("Microsoft.AzureStackHci/clusters")) + { + throw new ArgumentException(string.Format("Invalid resource type {0}, expected Microsoft.AzureStackHci/clusters", scope.ResourceType)); + } + return new AutomanageHciClusterConfigurationProfileAssignmentCollection(Client, scope); + } + + /// + /// Get information about a configuration profile assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileHCIAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutomanageHciClusterConfigurationProfileAssignmentAsync(ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + return await GetAutomanageHciClusterConfigurationProfileAssignments(scope).GetAsync(configurationProfileAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a configuration profile assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationProfileHCIAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The configuration profile assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutomanageHciClusterConfigurationProfileAssignment(ResourceIdentifier scope, string configurationProfileAssignmentName, CancellationToken cancellationToken = default) + { + return GetAutomanageHciClusterConfigurationProfileAssignments(scope).Get(configurationProfileAssignmentName, cancellationToken); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageBestPracticeResource GetAutomanageBestPracticeResource(ResourceIdentifier id) + { + AutomanageBestPracticeResource.ValidateResourceId(id); + return new AutomanageBestPracticeResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageConfigurationProfileResource GetAutomanageConfigurationProfileResource(ResourceIdentifier id) + { + AutomanageConfigurationProfileResource.ValidateResourceId(id); + return new AutomanageConfigurationProfileResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageConfigurationProfileVersionResource GetAutomanageConfigurationProfileVersionResource(ResourceIdentifier id) + { + AutomanageConfigurationProfileVersionResource.ValidateResourceId(id); + return new AutomanageConfigurationProfileVersionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageVmConfigurationProfileAssignmentResource GetAutomanageVmConfigurationProfileAssignmentResource(ResourceIdentifier id) + { + AutomanageVmConfigurationProfileAssignmentResource.ValidateResourceId(id); + return new AutomanageVmConfigurationProfileAssignmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageHcrpConfigurationProfileAssignmentResource GetAutomanageHcrpConfigurationProfileAssignmentResource(ResourceIdentifier id) + { + AutomanageHcrpConfigurationProfileAssignmentResource.ValidateResourceId(id); + return new AutomanageHcrpConfigurationProfileAssignmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageHciClusterConfigurationProfileAssignmentResource GetAutomanageHciClusterConfigurationProfileAssignmentResource(ResourceIdentifier id) + { + AutomanageHciClusterConfigurationProfileAssignmentResource.ValidateResourceId(id); + return new AutomanageHciClusterConfigurationProfileAssignmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageVmConfigurationProfileAssignmentReportResource GetAutomanageVmConfigurationProfileAssignmentReportResource(ResourceIdentifier id) + { + AutomanageVmConfigurationProfileAssignmentReportResource.ValidateResourceId(id); + return new AutomanageVmConfigurationProfileAssignmentReportResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageHcrpConfigurationProfileAssignmentReportResource GetAutomanageHcrpConfigurationProfileAssignmentReportResource(ResourceIdentifier id) + { + AutomanageHcrpConfigurationProfileAssignmentReportResource.ValidateResourceId(id); + return new AutomanageHcrpConfigurationProfileAssignmentReportResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomanageHciClusterConfigurationProfileAssignmentReportResource GetAutomanageHciClusterConfigurationProfileAssignmentReportResource(ResourceIdentifier id) + { + AutomanageHciClusterConfigurationProfileAssignmentReportResource.ValidateResourceId(id); + return new AutomanageHciClusterConfigurationProfileAssignmentReportResource(Client, id); + } + } +} diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageResourceGroupResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageResourceGroupResource.cs new file mode 100644 index 0000000000000..2bc5fe9caf615 --- /dev/null +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Automanage; + +namespace Azure.ResourceManager.Automanage.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAutomanageResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAutomanageResourceGroupResource() + { + } + + /// 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 MockableAutomanageResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AutomanageConfigurationProfileResources in the ResourceGroupResource. + /// An object representing collection of AutomanageConfigurationProfileResources and their operations over a AutomanageConfigurationProfileResource. + public virtual AutomanageConfigurationProfileCollection GetAutomanageConfigurationProfiles() + { + return GetCachedClient(client => new AutomanageConfigurationProfileCollection(client, Id)); + } + + /// + /// Get information about a configuration profile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName} + /// + /// + /// Operation Id + /// ConfigurationProfiles_Get + /// + /// + /// + /// The configuration profile name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutomanageConfigurationProfileAsync(string configurationProfileName, CancellationToken cancellationToken = default) + { + return await GetAutomanageConfigurationProfiles().GetAsync(configurationProfileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a configuration profile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automanage/configurationProfiles/{configurationProfileName} + /// + /// + /// Operation Id + /// ConfigurationProfiles_Get + /// + /// + /// + /// The configuration profile name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutomanageConfigurationProfile(string configurationProfileName, CancellationToken cancellationToken = default) + { + return GetAutomanageConfigurationProfiles().Get(configurationProfileName, cancellationToken); + } + } +} diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageSubscriptionResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageSubscriptionResource.cs new file mode 100644 index 0000000000000..ec7d7840c7cb9 --- /dev/null +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageSubscriptionResource.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Automanage; +using Azure.ResourceManager.Automanage.Models; + +namespace Azure.ResourceManager.Automanage.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAutomanageSubscriptionResource : ArmResource + { + private ClientDiagnostics _automanageConfigurationProfileConfigurationProfilesClientDiagnostics; + private ConfigurationProfilesRestOperations _automanageConfigurationProfileConfigurationProfilesRestClient; + private ClientDiagnostics _servicePrincipalsClientDiagnostics; + private ServicePrincipalsRestOperations _servicePrincipalsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAutomanageSubscriptionResource() + { + } + + /// 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 MockableAutomanageSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics => _automanageConfigurationProfileConfigurationProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Automanage", AutomanageConfigurationProfileResource.ResourceType.Namespace, Diagnostics); + private ConfigurationProfilesRestOperations AutomanageConfigurationProfileConfigurationProfilesRestClient => _automanageConfigurationProfileConfigurationProfilesRestClient ??= new ConfigurationProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AutomanageConfigurationProfileResource.ResourceType)); + private ClientDiagnostics ServicePrincipalsClientDiagnostics => _servicePrincipalsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Automanage", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ServicePrincipalsRestOperations ServicePrincipalsRestClient => _servicePrincipalsRestClient ??= new ServicePrincipalsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Retrieve a list of configuration profile within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfiles + /// + /// + /// Operation Id + /// ConfigurationProfiles_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAutomanageConfigurationProfilesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AutomanageConfigurationProfileConfigurationProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "MockableAutomanageSubscriptionResource.GetAutomanageConfigurationProfiles", "value", null, cancellationToken); + } + + /// + /// Retrieve a list of configuration profile within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfiles + /// + /// + /// Operation Id + /// ConfigurationProfiles_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAutomanageConfigurationProfiles(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AutomanageConfigurationProfileConfigurationProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "MockableAutomanageSubscriptionResource.GetAutomanageConfigurationProfiles", "value", null, cancellationToken); + } + + /// + /// Get the Automanage AAD first party Application Service Principal details for the subscription id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals + /// + /// + /// Operation Id + /// ServicePrincipals_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetServicePrincipalsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServicePrincipalsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, AutomanageServicePrincipalData.DeserializeAutomanageServicePrincipalData, ServicePrincipalsClientDiagnostics, Pipeline, "MockableAutomanageSubscriptionResource.GetServicePrincipals", "value", null, cancellationToken); + } + + /// + /// Get the Automanage AAD first party Application Service Principal details for the subscription id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals + /// + /// + /// Operation Id + /// ServicePrincipals_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetServicePrincipals(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServicePrincipalsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, AutomanageServicePrincipalData.DeserializeAutomanageServicePrincipalData, ServicePrincipalsClientDiagnostics, Pipeline, "MockableAutomanageSubscriptionResource.GetServicePrincipals", "value", null, cancellationToken); + } + + /// + /// Get the Automanage AAD first party Application Service Principal details for the subscription id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals/default + /// + /// + /// Operation Id + /// ServicePrincipals_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetServicePrincipalAsync(CancellationToken cancellationToken = default) + { + using var scope = ServicePrincipalsClientDiagnostics.CreateScope("MockableAutomanageSubscriptionResource.GetServicePrincipal"); + scope.Start(); + try + { + var response = await ServicePrincipalsRestClient.GetAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Automanage AAD first party Application Service Principal details for the subscription id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals/default + /// + /// + /// Operation Id + /// ServicePrincipals_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetServicePrincipal(CancellationToken cancellationToken = default) + { + using var scope = ServicePrincipalsClientDiagnostics.CreateScope("MockableAutomanageSubscriptionResource.GetServicePrincipal"); + scope.Start(); + try + { + var response = ServicePrincipalsRestClient.Get(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageTenantResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageTenantResource.cs new file mode 100644 index 0000000000000..f7315047b8e8b --- /dev/null +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/MockableAutomanageTenantResource.cs @@ -0,0 +1,92 @@ +// 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.Automanage; + +namespace Azure.ResourceManager.Automanage.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableAutomanageTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAutomanageTenantResource() + { + } + + /// 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 MockableAutomanageTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AutomanageBestPracticeResources in the TenantResource. + /// An object representing collection of AutomanageBestPracticeResources and their operations over a AutomanageBestPracticeResource. + public virtual AutomanageBestPracticeCollection GetAutomanageBestPractices() + { + return GetCachedClient(client => new AutomanageBestPracticeCollection(client, Id)); + } + + /// + /// Get information about a Automanage best practice + /// + /// + /// Request Path + /// /providers/Microsoft.Automanage/bestPractices/{bestPracticeName} + /// + /// + /// Operation Id + /// BestPractices_Get + /// + /// + /// + /// The Automanage best practice name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutomanageBestPracticeAsync(string bestPracticeName, CancellationToken cancellationToken = default) + { + return await GetAutomanageBestPractices().GetAsync(bestPracticeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a Automanage best practice + /// + /// + /// Request Path + /// /providers/Microsoft.Automanage/bestPractices/{bestPracticeName} + /// + /// + /// Operation Id + /// BestPractices_Get + /// + /// + /// + /// The Automanage best practice name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutomanageBestPractice(string bestPracticeName, CancellationToken cancellationToken = default) + { + return GetAutomanageBestPractices().Get(bestPracticeName, cancellationToken); + } + } +} diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 80056435c5029..0000000000000 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Automanage -{ - /// 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 AutomanageConfigurationProfileResources in the ResourceGroupResource. - /// An object representing collection of AutomanageConfigurationProfileResources and their operations over a AutomanageConfigurationProfileResource. - public virtual AutomanageConfigurationProfileCollection GetAutomanageConfigurationProfiles() - { - return GetCachedClient(Client => new AutomanageConfigurationProfileCollection(Client, Id)); - } - } -} diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index e028579e77a9b..0000000000000 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Automanage.Models; - -namespace Azure.ResourceManager.Automanage -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _automanageConfigurationProfileConfigurationProfilesClientDiagnostics; - private ConfigurationProfilesRestOperations _automanageConfigurationProfileConfigurationProfilesRestClient; - private ClientDiagnostics _servicePrincipalsClientDiagnostics; - private ServicePrincipalsRestOperations _servicePrincipalsRestClient; - - /// 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 AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics => _automanageConfigurationProfileConfigurationProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Automanage", AutomanageConfigurationProfileResource.ResourceType.Namespace, Diagnostics); - private ConfigurationProfilesRestOperations AutomanageConfigurationProfileConfigurationProfilesRestClient => _automanageConfigurationProfileConfigurationProfilesRestClient ??= new ConfigurationProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AutomanageConfigurationProfileResource.ResourceType)); - private ClientDiagnostics ServicePrincipalsClientDiagnostics => _servicePrincipalsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Automanage", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ServicePrincipalsRestOperations ServicePrincipalsRestClient => _servicePrincipalsRestClient ??= new ServicePrincipalsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Retrieve a list of configuration profile within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfiles - /// - /// - /// Operation Id - /// ConfigurationProfiles_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAutomanageConfigurationProfilesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AutomanageConfigurationProfileConfigurationProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomanageConfigurationProfiles", "value", null, cancellationToken); - } - - /// - /// Retrieve a list of configuration profile within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/configurationProfiles - /// - /// - /// Operation Id - /// ConfigurationProfiles_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAutomanageConfigurationProfiles(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AutomanageConfigurationProfileConfigurationProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutomanageConfigurationProfileResource(Client, AutomanageConfigurationProfileData.DeserializeAutomanageConfigurationProfileData(e)), AutomanageConfigurationProfileConfigurationProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomanageConfigurationProfiles", "value", null, cancellationToken); - } - - /// - /// Get the Automanage AAD first party Application Service Principal details for the subscription id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals - /// - /// - /// Operation Id - /// ServicePrincipals_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetServicePrincipalsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServicePrincipalsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, AutomanageServicePrincipalData.DeserializeAutomanageServicePrincipalData, ServicePrincipalsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServicePrincipals", "value", null, cancellationToken); - } - - /// - /// Get the Automanage AAD first party Application Service Principal details for the subscription id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals - /// - /// - /// Operation Id - /// ServicePrincipals_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetServicePrincipals(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServicePrincipalsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, AutomanageServicePrincipalData.DeserializeAutomanageServicePrincipalData, ServicePrincipalsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServicePrincipals", "value", null, cancellationToken); - } - - /// - /// Get the Automanage AAD first party Application Service Principal details for the subscription id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals/default - /// - /// - /// Operation Id - /// ServicePrincipals_Get - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetServicePrincipalAsync(CancellationToken cancellationToken = default) - { - using var scope = ServicePrincipalsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetServicePrincipal"); - scope.Start(); - try - { - var response = await ServicePrincipalsRestClient.GetAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the Automanage AAD first party Application Service Principal details for the subscription id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals/default - /// - /// - /// Operation Id - /// ServicePrincipals_Get - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetServicePrincipal(CancellationToken cancellationToken = default) - { - using var scope = ServicePrincipalsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetServicePrincipal"); - scope.Start(); - try - { - var response = ServicePrincipalsRestClient.Get(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index a7a4d95ff0488..0000000000000 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Automanage -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of AutomanageBestPracticeResources in the TenantResource. - /// An object representing collection of AutomanageBestPracticeResources and their operations over a AutomanageBestPracticeResource. - public virtual AutomanageBestPracticeCollection GetAutomanageBestPractices() - { - return GetCachedClient(Client => new AutomanageBestPracticeCollection(Client, Id)); - } - } -} diff --git a/sdk/automation/Azure.ResourceManager.Automation/api/Azure.ResourceManager.Automation.netstandard2.0.cs b/sdk/automation/Azure.ResourceManager.Automation/api/Azure.ResourceManager.Automation.netstandard2.0.cs index 169441bd4bbe8..54123090f9ab9 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/api/Azure.ResourceManager.Automation.netstandard2.0.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/api/Azure.ResourceManager.Automation.netstandard2.0.cs @@ -19,7 +19,7 @@ protected AutomationAccountCollection() { } } public partial class AutomationAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public AutomationAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AutomationAccountData(Azure.Core.AzureLocation location) { } public System.Uri AutomationHybridServiceUri { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } set { } } @@ -532,7 +532,7 @@ protected AutomationJobScheduleResource() { } } public partial class AutomationModuleData : Azure.ResourceManager.Models.TrackedResourceData { - public AutomationModuleData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AutomationModuleData(Azure.Core.AzureLocation location) { } public int? ActivityCount { get { throw null; } set { } } public Azure.ResourceManager.Automation.Models.AutomationContentLink ContentLink { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } set { } } @@ -603,7 +603,7 @@ protected AutomationRunbookCollection() { } } public partial class AutomationRunbookData : Azure.ResourceManager.Models.TrackedResourceData { - public AutomationRunbookData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AutomationRunbookData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } set { } } public string Description { get { throw null; } set { } } public Azure.ResourceManager.Automation.Models.AutomationRunbookDraft Draft { get { throw null; } set { } } @@ -829,7 +829,7 @@ protected AutomationWatcherCollection() { } } public partial class AutomationWatcherData : Azure.ResourceManager.Models.TrackedResourceData { - public AutomationWatcherData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AutomationWatcherData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } @@ -971,7 +971,7 @@ protected DscConfigurationCollection() { } } public partial class DscConfigurationData : Azure.ResourceManager.Models.TrackedResourceData { - public DscConfigurationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DscConfigurationData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } set { } } public string Description { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } @@ -1224,6 +1224,51 @@ protected SoftwareUpdateConfigurationResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Automation.SoftwareUpdateConfigurationData data, string clientRequestId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Automation.Mocking +{ + public partial class MockableAutomationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAutomationArmClient() { } + public virtual Azure.ResourceManager.Automation.AutomationAccountModuleResource GetAutomationAccountModuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationAccountPython2PackageResource GetAutomationAccountPython2PackageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationAccountResource GetAutomationAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationCertificateResource GetAutomationCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationConnectionResource GetAutomationConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationConnectionTypeResource GetAutomationConnectionTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationCredentialResource GetAutomationCredentialResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationJobResource GetAutomationJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationJobScheduleResource GetAutomationJobScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationPrivateEndpointConnectionResource GetAutomationPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationRunbookResource GetAutomationRunbookResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationScheduleResource GetAutomationScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationSourceControlResource GetAutomationSourceControlResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationVariableResource GetAutomationVariableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationWatcherResource GetAutomationWatcherResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationWebhookResource GetAutomationWebhookResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.DscCompilationJobResource GetDscCompilationJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.DscConfigurationResource GetDscConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.DscNodeConfigurationResource GetDscNodeConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.DscNodeResource GetDscNodeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.HybridRunbookWorkerGroupResource GetHybridRunbookWorkerGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.HybridRunbookWorkerResource GetHybridRunbookWorkerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Automation.SoftwareUpdateConfigurationResource GetSoftwareUpdateConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAutomationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAutomationResourceGroupResource() { } + public virtual Azure.Response GetAutomationAccount(string automationAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutomationAccountAsync(string automationAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Automation.AutomationAccountCollection GetAutomationAccounts() { throw null; } + } + public partial class MockableAutomationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAutomationSubscriptionResource() { } + public virtual Azure.Pageable GetAutomationAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAutomationAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeletedAutomationAccountsBySubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedAutomationAccountsBySubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Automation.Models { public partial class AgentRegistration diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleResource.cs index 4c27d6a14bde5..dfb7a782ecf1a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountModuleResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationAccountModuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The moduleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string moduleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageResource.cs index a0c0225bfa1ea..409c32c36c24c 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountPython2PackageResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationAccountPython2PackageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The packageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string packageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountResource.cs index 3813c0b5295d0..31538ec528ff2 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Automation public partial class AutomationAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"; @@ -152,7 +155,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AutomationPrivateEndpointConnectionResources and their operations over a AutomationPrivateEndpointConnectionResource. public virtual AutomationPrivateEndpointConnectionCollection GetAutomationPrivateEndpointConnections() { - return GetCachedClient(Client => new AutomationPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new AutomationPrivateEndpointConnectionCollection(client, Id)); } /// @@ -170,8 +173,8 @@ public virtual AutomationPrivateEndpointConnectionCollection GetAutomationPrivat /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -193,8 +196,8 @@ public virtual async Task> /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -205,7 +208,7 @@ public virtual Response GetAutomati /// An object representing collection of AutomationAccountPython2PackageResources and their operations over a AutomationAccountPython2PackageResource. public virtual AutomationAccountPython2PackageCollection GetAutomationAccountPython2Packages() { - return GetCachedClient(Client => new AutomationAccountPython2PackageCollection(Client, Id)); + return GetCachedClient(client => new AutomationAccountPython2PackageCollection(client, Id)); } /// @@ -223,8 +226,8 @@ public virtual AutomationAccountPython2PackageCollection GetAutomationAccountPyt /// /// The python package name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationAccountPython2PackageAsync(string packageName, CancellationToken cancellationToken = default) { @@ -246,8 +249,8 @@ public virtual async Task> Get /// /// The python package name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationAccountPython2Package(string packageName, CancellationToken cancellationToken = default) { @@ -258,7 +261,7 @@ public virtual Response GetAutomationAc /// An object representing collection of AutomationAccountModuleResources and their operations over a AutomationAccountModuleResource. public virtual AutomationAccountModuleCollection GetAutomationAccountModules() { - return GetCachedClient(Client => new AutomationAccountModuleCollection(Client, Id)); + return GetCachedClient(client => new AutomationAccountModuleCollection(client, Id)); } /// @@ -276,8 +279,8 @@ public virtual AutomationAccountModuleCollection GetAutomationAccountModules() /// /// The module name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationAccountModuleAsync(string moduleName, CancellationToken cancellationToken = default) { @@ -299,8 +302,8 @@ public virtual async Task> GetAutomati /// /// The module name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationAccountModule(string moduleName, CancellationToken cancellationToken = default) { @@ -311,7 +314,7 @@ public virtual Response GetAutomationAccountMod /// An object representing collection of DscNodeResources and their operations over a DscNodeResource. public virtual DscNodeCollection GetDscNodes() { - return GetCachedClient(Client => new DscNodeCollection(Client, Id)); + return GetCachedClient(client => new DscNodeCollection(client, Id)); } /// @@ -329,8 +332,8 @@ public virtual DscNodeCollection GetDscNodes() /// /// The node id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDscNodeAsync(string nodeId, CancellationToken cancellationToken = default) { @@ -352,8 +355,8 @@ public virtual async Task> GetDscNodeAsync(string node /// /// The node id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDscNode(string nodeId, CancellationToken cancellationToken = default) { @@ -364,7 +367,7 @@ public virtual Response GetDscNode(string nodeId, CancellationT /// An object representing collection of DscNodeConfigurationResources and their operations over a DscNodeConfigurationResource. public virtual DscNodeConfigurationCollection GetDscNodeConfigurations() { - return GetCachedClient(Client => new DscNodeConfigurationCollection(Client, Id)); + return GetCachedClient(client => new DscNodeConfigurationCollection(client, Id)); } /// @@ -382,8 +385,8 @@ public virtual DscNodeConfigurationCollection GetDscNodeConfigurations() /// /// The Dsc node configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDscNodeConfigurationAsync(string nodeConfigurationName, CancellationToken cancellationToken = default) { @@ -405,8 +408,8 @@ public virtual async Task> GetDscNodeConf /// /// The Dsc node configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDscNodeConfiguration(string nodeConfigurationName, CancellationToken cancellationToken = default) { @@ -417,7 +420,7 @@ public virtual Response GetDscNodeConfiguration(st /// An object representing collection of DscCompilationJobResources and their operations over a DscCompilationJobResource. public virtual DscCompilationJobCollection GetDscCompilationJobs() { - return GetCachedClient(Client => new DscCompilationJobCollection(Client, Id)); + return GetCachedClient(client => new DscCompilationJobCollection(client, Id)); } /// @@ -435,8 +438,8 @@ public virtual DscCompilationJobCollection GetDscCompilationJobs() /// /// The DSC configuration Id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDscCompilationJobAsync(string compilationJobName, CancellationToken cancellationToken = default) { @@ -458,8 +461,8 @@ public virtual async Task> GetDscCompilation /// /// The DSC configuration Id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDscCompilationJob(string compilationJobName, CancellationToken cancellationToken = default) { @@ -470,7 +473,7 @@ public virtual Response GetDscCompilationJob(string c /// An object representing collection of AutomationSourceControlResources and their operations over a AutomationSourceControlResource. public virtual AutomationSourceControlCollection GetAutomationSourceControls() { - return GetCachedClient(Client => new AutomationSourceControlCollection(Client, Id)); + return GetCachedClient(client => new AutomationSourceControlCollection(client, Id)); } /// @@ -488,8 +491,8 @@ public virtual AutomationSourceControlCollection GetAutomationSourceControls() /// /// The name of source control. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationSourceControlAsync(string sourceControlName, CancellationToken cancellationToken = default) { @@ -511,8 +514,8 @@ public virtual async Task> GetAutomati /// /// The name of source control. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationSourceControl(string sourceControlName, CancellationToken cancellationToken = default) { @@ -523,7 +526,7 @@ public virtual Response GetAutomationSourceCont /// An object representing collection of AutomationCertificateResources and their operations over a AutomationCertificateResource. public virtual AutomationCertificateCollection GetAutomationCertificates() { - return GetCachedClient(Client => new AutomationCertificateCollection(Client, Id)); + return GetCachedClient(client => new AutomationCertificateCollection(client, Id)); } /// @@ -541,8 +544,8 @@ public virtual AutomationCertificateCollection GetAutomationCertificates() /// /// The name of certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -564,8 +567,8 @@ public virtual async Task> GetAutomation /// /// The name of certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -576,7 +579,7 @@ public virtual Response GetAutomationCertificate( /// An object representing collection of AutomationConnectionResources and their operations over a AutomationConnectionResource. public virtual AutomationConnectionCollection GetAutomationConnections() { - return GetCachedClient(Client => new AutomationConnectionCollection(Client, Id)); + return GetCachedClient(client => new AutomationConnectionCollection(client, Id)); } /// @@ -594,8 +597,8 @@ public virtual AutomationConnectionCollection GetAutomationConnections() /// /// The name of connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -617,8 +620,8 @@ public virtual async Task> GetAutomationC /// /// The name of connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationConnection(string connectionName, CancellationToken cancellationToken = default) { @@ -629,7 +632,7 @@ public virtual Response GetAutomationConnection(st /// An object representing collection of AutomationConnectionTypeResources and their operations over a AutomationConnectionTypeResource. public virtual AutomationConnectionTypeCollection GetAutomationConnectionTypes() { - return GetCachedClient(Client => new AutomationConnectionTypeCollection(Client, Id)); + return GetCachedClient(client => new AutomationConnectionTypeCollection(client, Id)); } /// @@ -647,8 +650,8 @@ public virtual AutomationConnectionTypeCollection GetAutomationConnectionTypes() /// /// The name of connection type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationConnectionTypeAsync(string connectionTypeName, CancellationToken cancellationToken = default) { @@ -670,8 +673,8 @@ public virtual async Task> GetAutomat /// /// The name of connection type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationConnectionType(string connectionTypeName, CancellationToken cancellationToken = default) { @@ -682,7 +685,7 @@ public virtual Response GetAutomationConnectio /// An object representing collection of AutomationCredentialResources and their operations over a AutomationCredentialResource. public virtual AutomationCredentialCollection GetAutomationCredentials() { - return GetCachedClient(Client => new AutomationCredentialCollection(Client, Id)); + return GetCachedClient(client => new AutomationCredentialCollection(client, Id)); } /// @@ -700,8 +703,8 @@ public virtual AutomationCredentialCollection GetAutomationCredentials() /// /// The name of credential. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationCredentialAsync(string credentialName, CancellationToken cancellationToken = default) { @@ -723,8 +726,8 @@ public virtual async Task> GetAutomationC /// /// The name of credential. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationCredential(string credentialName, CancellationToken cancellationToken = default) { @@ -735,7 +738,7 @@ public virtual Response GetAutomationCredential(st /// An object representing collection of AutomationJobScheduleResources and their operations over a AutomationJobScheduleResource. public virtual AutomationJobScheduleCollection GetAutomationJobSchedules() { - return GetCachedClient(Client => new AutomationJobScheduleCollection(Client, Id)); + return GetCachedClient(client => new AutomationJobScheduleCollection(client, Id)); } /// @@ -784,7 +787,7 @@ public virtual Response GetAutomationJobSchedule( /// An object representing collection of AutomationScheduleResources and their operations over a AutomationScheduleResource. public virtual AutomationScheduleCollection GetAutomationSchedules() { - return GetCachedClient(Client => new AutomationScheduleCollection(Client, Id)); + return GetCachedClient(client => new AutomationScheduleCollection(client, Id)); } /// @@ -802,8 +805,8 @@ public virtual AutomationScheduleCollection GetAutomationSchedules() /// /// The schedule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationScheduleAsync(string scheduleName, CancellationToken cancellationToken = default) { @@ -825,8 +828,8 @@ public virtual async Task> GetAutomationSch /// /// The schedule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationSchedule(string scheduleName, CancellationToken cancellationToken = default) { @@ -837,7 +840,7 @@ public virtual Response GetAutomationSchedule(string /// An object representing collection of AutomationVariableResources and their operations over a AutomationVariableResource. public virtual AutomationVariableCollection GetAutomationVariables() { - return GetCachedClient(Client => new AutomationVariableCollection(Client, Id)); + return GetCachedClient(client => new AutomationVariableCollection(client, Id)); } /// @@ -855,8 +858,8 @@ public virtual AutomationVariableCollection GetAutomationVariables() /// /// The name of variable. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationVariableAsync(string variableName, CancellationToken cancellationToken = default) { @@ -878,8 +881,8 @@ public virtual async Task> GetAutomationVar /// /// The name of variable. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationVariable(string variableName, CancellationToken cancellationToken = default) { @@ -890,7 +893,7 @@ public virtual Response GetAutomationVariable(string /// An object representing collection of AutomationWatcherResources and their operations over a AutomationWatcherResource. public virtual AutomationWatcherCollection GetAutomationWatchers() { - return GetCachedClient(Client => new AutomationWatcherCollection(Client, Id)); + return GetCachedClient(client => new AutomationWatcherCollection(client, Id)); } /// @@ -908,8 +911,8 @@ public virtual AutomationWatcherCollection GetAutomationWatchers() /// /// The watcher name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationWatcherAsync(string watcherName, CancellationToken cancellationToken = default) { @@ -931,8 +934,8 @@ public virtual async Task> GetAutomationWatc /// /// The watcher name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationWatcher(string watcherName, CancellationToken cancellationToken = default) { @@ -943,7 +946,7 @@ public virtual Response GetAutomationWatcher(string w /// An object representing collection of DscConfigurationResources and their operations over a DscConfigurationResource. public virtual DscConfigurationCollection GetDscConfigurations() { - return GetCachedClient(Client => new DscConfigurationCollection(Client, Id)); + return GetCachedClient(client => new DscConfigurationCollection(client, Id)); } /// @@ -961,8 +964,8 @@ public virtual DscConfigurationCollection GetDscConfigurations() /// /// The configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDscConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -984,8 +987,8 @@ public virtual async Task> GetDscConfiguratio /// /// The configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDscConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -996,7 +999,7 @@ public virtual Response GetDscConfiguration(string con /// An object representing collection of AutomationJobResources and their operations over a AutomationJobResource. public virtual AutomationJobCollection GetAutomationJobs() { - return GetCachedClient(Client => new AutomationJobCollection(Client, Id)); + return GetCachedClient(client => new AutomationJobCollection(client, Id)); } /// @@ -1015,8 +1018,8 @@ public virtual AutomationJobCollection GetAutomationJobs() /// The job name. /// Identifies this specific client request. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationJobAsync(string jobName, string clientRequestId = null, CancellationToken cancellationToken = default) { @@ -1039,8 +1042,8 @@ public virtual async Task> GetAutomationJobAsync /// The job name. /// Identifies this specific client request. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationJob(string jobName, string clientRequestId = null, CancellationToken cancellationToken = default) { @@ -1051,7 +1054,7 @@ public virtual Response GetAutomationJob(string jobName, /// An object representing collection of SoftwareUpdateConfigurationResources and their operations over a SoftwareUpdateConfigurationResource. public virtual SoftwareUpdateConfigurationCollection GetSoftwareUpdateConfigurations() { - return GetCachedClient(Client => new SoftwareUpdateConfigurationCollection(Client, Id)); + return GetCachedClient(client => new SoftwareUpdateConfigurationCollection(client, Id)); } /// @@ -1070,8 +1073,8 @@ public virtual SoftwareUpdateConfigurationCollection GetSoftwareUpdateConfigurat /// The name of the software update configuration to be created. /// Identifies this specific client request. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSoftwareUpdateConfigurationAsync(string softwareUpdateConfigurationName, string clientRequestId = null, CancellationToken cancellationToken = default) { @@ -1094,8 +1097,8 @@ public virtual async Task> GetSoft /// The name of the software update configuration to be created. /// Identifies this specific client request. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSoftwareUpdateConfiguration(string softwareUpdateConfigurationName, string clientRequestId = null, CancellationToken cancellationToken = default) { @@ -1106,7 +1109,7 @@ public virtual Response GetSoftwareUpdateCo /// An object representing collection of AutomationRunbookResources and their operations over a AutomationRunbookResource. public virtual AutomationRunbookCollection GetAutomationRunbooks() { - return GetCachedClient(Client => new AutomationRunbookCollection(Client, Id)); + return GetCachedClient(client => new AutomationRunbookCollection(client, Id)); } /// @@ -1124,8 +1127,8 @@ public virtual AutomationRunbookCollection GetAutomationRunbooks() /// /// The runbook name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationRunbookAsync(string runbookName, CancellationToken cancellationToken = default) { @@ -1147,8 +1150,8 @@ public virtual async Task> GetAutomationRunb /// /// The runbook name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationRunbook(string runbookName, CancellationToken cancellationToken = default) { @@ -1159,7 +1162,7 @@ public virtual Response GetAutomationRunbook(string r /// An object representing collection of AutomationWebhookResources and their operations over a AutomationWebhookResource. public virtual AutomationWebhookCollection GetAutomationWebhooks() { - return GetCachedClient(Client => new AutomationWebhookCollection(Client, Id)); + return GetCachedClient(client => new AutomationWebhookCollection(client, Id)); } /// @@ -1177,8 +1180,8 @@ public virtual AutomationWebhookCollection GetAutomationWebhooks() /// /// The webhook name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAutomationWebhookAsync(string webhookName, CancellationToken cancellationToken = default) { @@ -1200,8 +1203,8 @@ public virtual async Task> GetAutomationWebh /// /// The webhook name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAutomationWebhook(string webhookName, CancellationToken cancellationToken = default) { @@ -1212,7 +1215,7 @@ public virtual Response GetAutomationWebhook(string w /// An object representing collection of HybridRunbookWorkerGroupResources and their operations over a HybridRunbookWorkerGroupResource. public virtual HybridRunbookWorkerGroupCollection GetHybridRunbookWorkerGroups() { - return GetCachedClient(Client => new HybridRunbookWorkerGroupCollection(Client, Id)); + return GetCachedClient(client => new HybridRunbookWorkerGroupCollection(client, Id)); } /// @@ -1230,8 +1233,8 @@ public virtual HybridRunbookWorkerGroupCollection GetHybridRunbookWorkerGroups() /// /// The hybrid runbook worker group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHybridRunbookWorkerGroupAsync(string hybridRunbookWorkerGroupName, CancellationToken cancellationToken = default) { @@ -1253,8 +1256,8 @@ public virtual async Task> GetHybridR /// /// The hybrid runbook worker group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHybridRunbookWorkerGroup(string hybridRunbookWorkerGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateResource.cs index e07ec4c588698..515114842ac78 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCertificateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionResource.cs index 7d23158e1e93e..4d8810f61925e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeResource.cs index a66d515701f97..4eed4587efd4b 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationConnectionTypeResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationConnectionTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The connectionTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string connectionTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialResource.cs index f789633ae68c2..d4a44bd12f18e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationCredentialResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationCredentialResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The credentialName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string credentialName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobResource.cs index a54c5e60d8944..fee5c5be05b8e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleResource.cs index e7a89a48884ca..47429821e14c8 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationJobScheduleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationJobScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The jobScheduleId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, Guid jobScheduleId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionResource.cs index c502a2ef8ad6f..42d4dce9f13b0 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookResource.cs index dbba069df255e..4f7223e2d213e 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationRunbookResource.cs @@ -29,6 +29,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationRunbookResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The runbookName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string runbookName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleResource.cs index c59baa73ada74..259a9d871469a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationScheduleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The scheduleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string scheduleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlResource.cs index d0a52f4087be0..455c37c59019f 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationSourceControlResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationSourceControlResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The sourceControlName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string sourceControlName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableResource.cs index e56d00d15587d..a28e347dcbfad 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationVariableResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationVariableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The variableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string variableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherResource.cs index f5fc7ea2fa577..cce2a8a58414d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWatcherResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationWatcherResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The watcherName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string watcherName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookResource.cs index 6b1429240997e..80ea1ea3d7d1d 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationWebhookResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class AutomationWebhookResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The webhookName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string webhookName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobResource.cs index 008bcb4e73563..0daa57f5f8ad3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscCompilationJobResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class DscCompilationJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The compilationJobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string compilationJobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationResource.cs index c4b8315c82be5..cc2b89c0492e5 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscConfigurationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Automation public partial class DscConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationResource.cs index 4c2fdd3f2dbcb..d8e350d6a70e6 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeConfigurationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class DscNodeConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The nodeConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string nodeConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeResource.cs index 649d3568a459e..b0d2d30ed2080 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/DscNodeResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Automation public partial class DscNodeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The nodeId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string nodeId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/AutomationExtensions.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/AutomationExtensions.cs index fb4adce2a7e8c..30a46f19353eb 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/AutomationExtensions.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/AutomationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Automation.Mocking; using Azure.ResourceManager.Automation.Models; using Azure.ResourceManager.Resources; @@ -19,480 +20,401 @@ namespace Azure.ResourceManager.Automation /// A class to add extension methods to Azure.ResourceManager.Automation. public static partial class AutomationExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAutomationArmClient GetMockableAutomationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAutomationArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAutomationResourceGroupResource GetMockableAutomationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAutomationResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAutomationSubscriptionResource GetMockableAutomationSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAutomationSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AutomationPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationPrivateEndpointConnectionResource GetAutomationPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationPrivateEndpointConnectionResource.ValidateResourceId(id); - return new AutomationPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationPrivateEndpointConnectionResource(id); } - #endregion - #region AutomationAccountPython2PackageResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationAccountPython2PackageResource GetAutomationAccountPython2PackageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationAccountPython2PackageResource.ValidateResourceId(id); - return new AutomationAccountPython2PackageResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationAccountPython2PackageResource(id); } - #endregion - #region AutomationAccountModuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationAccountModuleResource GetAutomationAccountModuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationAccountModuleResource.ValidateResourceId(id); - return new AutomationAccountModuleResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationAccountModuleResource(id); } - #endregion - #region DscNodeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DscNodeResource GetDscNodeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DscNodeResource.ValidateResourceId(id); - return new DscNodeResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetDscNodeResource(id); } - #endregion - #region DscNodeConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DscNodeConfigurationResource GetDscNodeConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DscNodeConfigurationResource.ValidateResourceId(id); - return new DscNodeConfigurationResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetDscNodeConfigurationResource(id); } - #endregion - #region DscCompilationJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DscCompilationJobResource GetDscCompilationJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DscCompilationJobResource.ValidateResourceId(id); - return new DscCompilationJobResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetDscCompilationJobResource(id); } - #endregion - #region AutomationSourceControlResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationSourceControlResource GetAutomationSourceControlResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationSourceControlResource.ValidateResourceId(id); - return new AutomationSourceControlResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationSourceControlResource(id); } - #endregion - #region AutomationAccountResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationAccountResource GetAutomationAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationAccountResource.ValidateResourceId(id); - return new AutomationAccountResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationAccountResource(id); } - #endregion - #region AutomationCertificateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationCertificateResource GetAutomationCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationCertificateResource.ValidateResourceId(id); - return new AutomationCertificateResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationCertificateResource(id); } - #endregion - #region AutomationConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationConnectionResource GetAutomationConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationConnectionResource.ValidateResourceId(id); - return new AutomationConnectionResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationConnectionResource(id); } - #endregion - #region AutomationConnectionTypeResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationConnectionTypeResource GetAutomationConnectionTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationConnectionTypeResource.ValidateResourceId(id); - return new AutomationConnectionTypeResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationConnectionTypeResource(id); } - #endregion - #region AutomationCredentialResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationCredentialResource GetAutomationCredentialResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationCredentialResource.ValidateResourceId(id); - return new AutomationCredentialResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationCredentialResource(id); } - #endregion - #region AutomationJobScheduleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationJobScheduleResource GetAutomationJobScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationJobScheduleResource.ValidateResourceId(id); - return new AutomationJobScheduleResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationJobScheduleResource(id); } - #endregion - #region AutomationScheduleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationScheduleResource GetAutomationScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationScheduleResource.ValidateResourceId(id); - return new AutomationScheduleResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationScheduleResource(id); } - #endregion - #region AutomationVariableResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationVariableResource GetAutomationVariableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationVariableResource.ValidateResourceId(id); - return new AutomationVariableResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationVariableResource(id); } - #endregion - #region AutomationWatcherResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationWatcherResource GetAutomationWatcherResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationWatcherResource.ValidateResourceId(id); - return new AutomationWatcherResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationWatcherResource(id); } - #endregion - #region DscConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DscConfigurationResource GetDscConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DscConfigurationResource.ValidateResourceId(id); - return new DscConfigurationResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetDscConfigurationResource(id); } - #endregion - #region AutomationJobResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationJobResource GetAutomationJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationJobResource.ValidateResourceId(id); - return new AutomationJobResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationJobResource(id); } - #endregion - #region SoftwareUpdateConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SoftwareUpdateConfigurationResource GetSoftwareUpdateConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SoftwareUpdateConfigurationResource.ValidateResourceId(id); - return new SoftwareUpdateConfigurationResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetSoftwareUpdateConfigurationResource(id); } - #endregion - #region AutomationRunbookResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationRunbookResource GetAutomationRunbookResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationRunbookResource.ValidateResourceId(id); - return new AutomationRunbookResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationRunbookResource(id); } - #endregion - #region AutomationWebhookResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutomationWebhookResource GetAutomationWebhookResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutomationWebhookResource.ValidateResourceId(id); - return new AutomationWebhookResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetAutomationWebhookResource(id); } - #endregion - #region HybridRunbookWorkerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridRunbookWorkerResource GetHybridRunbookWorkerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridRunbookWorkerResource.ValidateResourceId(id); - return new HybridRunbookWorkerResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetHybridRunbookWorkerResource(id); } - #endregion - #region HybridRunbookWorkerGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridRunbookWorkerGroupResource GetHybridRunbookWorkerGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridRunbookWorkerGroupResource.ValidateResourceId(id); - return new HybridRunbookWorkerGroupResource(client, id); - } - ); + return GetMockableAutomationArmClient(client).GetHybridRunbookWorkerGroupResource(id); } - #endregion - /// Gets a collection of AutomationAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of AutomationAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AutomationAccountResources and their operations over a AutomationAccountResource. public static AutomationAccountCollection GetAutomationAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAutomationAccounts(); + return GetMockableAutomationResourceGroupResource(resourceGroupResource).GetAutomationAccounts(); } /// @@ -507,16 +429,20 @@ public static AutomationAccountCollection GetAutomationAccounts(this ResourceGro /// AutomationAccount_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the automation account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutomationAccountAsync(this ResourceGroupResource resourceGroupResource, string automationAccountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAutomationAccounts().GetAsync(automationAccountName, cancellationToken).ConfigureAwait(false); + return await GetMockableAutomationResourceGroupResource(resourceGroupResource).GetAutomationAccountAsync(automationAccountName, cancellationToken).ConfigureAwait(false); } /// @@ -531,16 +457,20 @@ public static async Task> GetAutomationAccou /// AutomationAccount_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the automation account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutomationAccount(this ResourceGroupResource resourceGroupResource, string automationAccountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAutomationAccounts().Get(automationAccountName, cancellationToken); + return GetMockableAutomationResourceGroupResource(resourceGroupResource).GetAutomationAccount(automationAccountName, cancellationToken); } /// @@ -555,13 +485,17 @@ public static Response GetAutomationAccount(this Reso /// AutomationAccount_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAutomationAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutomationAccountsAsync(cancellationToken); + return GetMockableAutomationSubscriptionResource(subscriptionResource).GetAutomationAccountsAsync(cancellationToken); } /// @@ -576,13 +510,17 @@ public static AsyncPageable GetAutomationAccountsAsyn /// AutomationAccount_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAutomationAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutomationAccounts(cancellationToken); + return GetMockableAutomationSubscriptionResource(subscriptionResource).GetAutomationAccounts(cancellationToken); } /// @@ -597,13 +535,17 @@ public static Pageable GetAutomationAccounts(this Sub /// deletedAutomationAccounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedAutomationAccountsBySubscriptionAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedAutomationAccountsBySubscriptionAsync(cancellationToken); + return GetMockableAutomationSubscriptionResource(subscriptionResource).GetDeletedAutomationAccountsBySubscriptionAsync(cancellationToken); } /// @@ -618,13 +560,17 @@ public static AsyncPageable GetDeletedAutomationAccoun /// deletedAutomationAccounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedAutomationAccountsBySubscription(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedAutomationAccountsBySubscription(cancellationToken); + return GetMockableAutomationSubscriptionResource(subscriptionResource).GetDeletedAutomationAccountsBySubscription(cancellationToken); } } } diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationArmClient.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationArmClient.cs new file mode 100644 index 0000000000000..c9579f82643e8 --- /dev/null +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationArmClient.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Automation; + +namespace Azure.ResourceManager.Automation.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAutomationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAutomationArmClient() + { + } + + /// 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 MockableAutomationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAutomationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationPrivateEndpointConnectionResource GetAutomationPrivateEndpointConnectionResource(ResourceIdentifier id) + { + AutomationPrivateEndpointConnectionResource.ValidateResourceId(id); + return new AutomationPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationAccountPython2PackageResource GetAutomationAccountPython2PackageResource(ResourceIdentifier id) + { + AutomationAccountPython2PackageResource.ValidateResourceId(id); + return new AutomationAccountPython2PackageResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationAccountModuleResource GetAutomationAccountModuleResource(ResourceIdentifier id) + { + AutomationAccountModuleResource.ValidateResourceId(id); + return new AutomationAccountModuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DscNodeResource GetDscNodeResource(ResourceIdentifier id) + { + DscNodeResource.ValidateResourceId(id); + return new DscNodeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DscNodeConfigurationResource GetDscNodeConfigurationResource(ResourceIdentifier id) + { + DscNodeConfigurationResource.ValidateResourceId(id); + return new DscNodeConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DscCompilationJobResource GetDscCompilationJobResource(ResourceIdentifier id) + { + DscCompilationJobResource.ValidateResourceId(id); + return new DscCompilationJobResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationSourceControlResource GetAutomationSourceControlResource(ResourceIdentifier id) + { + AutomationSourceControlResource.ValidateResourceId(id); + return new AutomationSourceControlResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationAccountResource GetAutomationAccountResource(ResourceIdentifier id) + { + AutomationAccountResource.ValidateResourceId(id); + return new AutomationAccountResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationCertificateResource GetAutomationCertificateResource(ResourceIdentifier id) + { + AutomationCertificateResource.ValidateResourceId(id); + return new AutomationCertificateResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationConnectionResource GetAutomationConnectionResource(ResourceIdentifier id) + { + AutomationConnectionResource.ValidateResourceId(id); + return new AutomationConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationConnectionTypeResource GetAutomationConnectionTypeResource(ResourceIdentifier id) + { + AutomationConnectionTypeResource.ValidateResourceId(id); + return new AutomationConnectionTypeResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationCredentialResource GetAutomationCredentialResource(ResourceIdentifier id) + { + AutomationCredentialResource.ValidateResourceId(id); + return new AutomationCredentialResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationJobScheduleResource GetAutomationJobScheduleResource(ResourceIdentifier id) + { + AutomationJobScheduleResource.ValidateResourceId(id); + return new AutomationJobScheduleResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationScheduleResource GetAutomationScheduleResource(ResourceIdentifier id) + { + AutomationScheduleResource.ValidateResourceId(id); + return new AutomationScheduleResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationVariableResource GetAutomationVariableResource(ResourceIdentifier id) + { + AutomationVariableResource.ValidateResourceId(id); + return new AutomationVariableResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationWatcherResource GetAutomationWatcherResource(ResourceIdentifier id) + { + AutomationWatcherResource.ValidateResourceId(id); + return new AutomationWatcherResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DscConfigurationResource GetDscConfigurationResource(ResourceIdentifier id) + { + DscConfigurationResource.ValidateResourceId(id); + return new DscConfigurationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationJobResource GetAutomationJobResource(ResourceIdentifier id) + { + AutomationJobResource.ValidateResourceId(id); + return new AutomationJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SoftwareUpdateConfigurationResource GetSoftwareUpdateConfigurationResource(ResourceIdentifier id) + { + SoftwareUpdateConfigurationResource.ValidateResourceId(id); + return new SoftwareUpdateConfigurationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationRunbookResource GetAutomationRunbookResource(ResourceIdentifier id) + { + AutomationRunbookResource.ValidateResourceId(id); + return new AutomationRunbookResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutomationWebhookResource GetAutomationWebhookResource(ResourceIdentifier id) + { + AutomationWebhookResource.ValidateResourceId(id); + return new AutomationWebhookResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridRunbookWorkerResource GetHybridRunbookWorkerResource(ResourceIdentifier id) + { + HybridRunbookWorkerResource.ValidateResourceId(id); + return new HybridRunbookWorkerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridRunbookWorkerGroupResource GetHybridRunbookWorkerGroupResource(ResourceIdentifier id) + { + HybridRunbookWorkerGroupResource.ValidateResourceId(id); + return new HybridRunbookWorkerGroupResource(Client, id); + } + } +} diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationResourceGroupResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationResourceGroupResource.cs new file mode 100644 index 0000000000000..1c9d13ae4fdc5 --- /dev/null +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Automation; + +namespace Azure.ResourceManager.Automation.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAutomationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAutomationResourceGroupResource() + { + } + + /// 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 MockableAutomationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AutomationAccountResources in the ResourceGroupResource. + /// An object representing collection of AutomationAccountResources and their operations over a AutomationAccountResource. + public virtual AutomationAccountCollection GetAutomationAccounts() + { + return GetCachedClient(client => new AutomationAccountCollection(client, Id)); + } + + /// + /// Get information about an Automation Account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName} + /// + /// + /// Operation Id + /// AutomationAccount_Get + /// + /// + /// + /// The name of the automation account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutomationAccountAsync(string automationAccountName, CancellationToken cancellationToken = default) + { + return await GetAutomationAccounts().GetAsync(automationAccountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about an Automation Account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName} + /// + /// + /// Operation Id + /// AutomationAccount_Get + /// + /// + /// + /// The name of the automation account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutomationAccount(string automationAccountName, CancellationToken cancellationToken = default) + { + return GetAutomationAccounts().Get(automationAccountName, cancellationToken); + } + } +} diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationSubscriptionResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationSubscriptionResource.cs new file mode 100644 index 0000000000000..e093af78764f0 --- /dev/null +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/MockableAutomationSubscriptionResource.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Automation; +using Azure.ResourceManager.Automation.Models; + +namespace Azure.ResourceManager.Automation.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAutomationSubscriptionResource : ArmResource + { + private ClientDiagnostics _automationAccountClientDiagnostics; + private AutomationAccountRestOperations _automationAccountRestClient; + private ClientDiagnostics _deletedAutomationAccountsClientDiagnostics; + private DeletedAutomationAccountsRestOperations _deletedAutomationAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAutomationSubscriptionResource() + { + } + + /// 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 MockableAutomationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AutomationAccountClientDiagnostics => _automationAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Automation", AutomationAccountResource.ResourceType.Namespace, Diagnostics); + private AutomationAccountRestOperations AutomationAccountRestClient => _automationAccountRestClient ??= new AutomationAccountRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AutomationAccountResource.ResourceType)); + private ClientDiagnostics deletedAutomationAccountsClientDiagnostics => _deletedAutomationAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Automation", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DeletedAutomationAccountsRestOperations deletedAutomationAccountsRestClient => _deletedAutomationAccountsRestClient ??= new DeletedAutomationAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Retrieve a list of accounts within a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts + /// + /// + /// Operation Id + /// AutomationAccount_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAutomationAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AutomationAccountRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutomationAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), AutomationAccountClientDiagnostics, Pipeline, "MockableAutomationSubscriptionResource.GetAutomationAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieve a list of accounts within a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts + /// + /// + /// Operation Id + /// AutomationAccount_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAutomationAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AutomationAccountRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutomationAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), AutomationAccountClientDiagnostics, Pipeline, "MockableAutomationSubscriptionResource.GetAutomationAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieve deleted automation account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automation/deletedAutomationAccounts + /// + /// + /// Operation Id + /// deletedAutomationAccounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedAutomationAccountsBySubscriptionAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => deletedAutomationAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DeletedAutomationAccount.DeserializeDeletedAutomationAccount, deletedAutomationAccountsClientDiagnostics, Pipeline, "MockableAutomationSubscriptionResource.GetDeletedAutomationAccountsBySubscription", "value", null, cancellationToken); + } + + /// + /// Retrieve deleted automation account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Automation/deletedAutomationAccounts + /// + /// + /// Operation Id + /// deletedAutomationAccounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedAutomationAccountsBySubscription(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => deletedAutomationAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, DeletedAutomationAccount.DeserializeDeletedAutomationAccount, deletedAutomationAccountsClientDiagnostics, Pipeline, "MockableAutomationSubscriptionResource.GetDeletedAutomationAccountsBySubscription", "value", null, cancellationToken); + } + } +} diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 7151b395f5d4a..0000000000000 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Automation -{ - /// 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 AutomationAccountResources in the ResourceGroupResource. - /// An object representing collection of AutomationAccountResources and their operations over a AutomationAccountResource. - public virtual AutomationAccountCollection GetAutomationAccounts() - { - return GetCachedClient(Client => new AutomationAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 31a4ee41b1179..0000000000000 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Automation.Models; - -namespace Azure.ResourceManager.Automation -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _automationAccountClientDiagnostics; - private AutomationAccountRestOperations _automationAccountRestClient; - private ClientDiagnostics _deletedAutomationAccountsClientDiagnostics; - private DeletedAutomationAccountsRestOperations _deletedAutomationAccountsRestClient; - - /// 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 AutomationAccountClientDiagnostics => _automationAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Automation", AutomationAccountResource.ResourceType.Namespace, Diagnostics); - private AutomationAccountRestOperations AutomationAccountRestClient => _automationAccountRestClient ??= new AutomationAccountRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AutomationAccountResource.ResourceType)); - private ClientDiagnostics deletedAutomationAccountsClientDiagnostics => _deletedAutomationAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Automation", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DeletedAutomationAccountsRestOperations deletedAutomationAccountsRestClient => _deletedAutomationAccountsRestClient ??= new DeletedAutomationAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Retrieve a list of accounts within a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts - /// - /// - /// Operation Id - /// AutomationAccount_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAutomationAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AutomationAccountRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutomationAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), AutomationAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomationAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieve a list of accounts within a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts - /// - /// - /// Operation Id - /// AutomationAccount_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAutomationAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AutomationAccountRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutomationAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutomationAccountResource(Client, AutomationAccountData.DeserializeAutomationAccountData(e)), AutomationAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutomationAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieve deleted automation account. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automation/deletedAutomationAccounts - /// - /// - /// Operation Id - /// deletedAutomationAccounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedAutomationAccountsBySubscriptionAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => deletedAutomationAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DeletedAutomationAccount.DeserializeDeletedAutomationAccount, deletedAutomationAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAutomationAccountsBySubscription", "value", null, cancellationToken); - } - - /// - /// Retrieve deleted automation account. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Automation/deletedAutomationAccounts - /// - /// - /// Operation Id - /// deletedAutomationAccounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedAutomationAccountsBySubscription(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => deletedAutomationAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, DeletedAutomationAccount.DeserializeDeletedAutomationAccount, deletedAutomationAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAutomationAccountsBySubscription", "value", null, cancellationToken); - } - } -} diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupResource.cs index de7b28d5bc9c1..29680c97f31ee 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Automation public partial class HybridRunbookWorkerGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The hybridRunbookWorkerGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HybridRunbookWorkerResources and their operations over a HybridRunbookWorkerResource. public virtual HybridRunbookWorkerCollection GetHybridRunbookWorkers() { - return GetCachedClient(Client => new HybridRunbookWorkerCollection(Client, Id)); + return GetCachedClient(client => new HybridRunbookWorkerCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual HybridRunbookWorkerCollection GetHybridRunbookWorkers() /// /// The hybrid runbook worker id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHybridRunbookWorkerAsync(string hybridRunbookWorkerId, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetHybridRunboo /// /// The hybrid runbook worker id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHybridRunbookWorker(string hybridRunbookWorkerId, CancellationToken cancellationToken = default) { diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerResource.cs index 5b80699c1ecdf..37adf1e903e69 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Automation public partial class HybridRunbookWorkerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The hybridRunbookWorkerGroupName. + /// The hybridRunbookWorkerId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName, string hybridRunbookWorkerId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}"; diff --git a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationResource.cs index bf966d7d8a797..44a6e7d424ad3 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/SoftwareUpdateConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Automation public partial class SoftwareUpdateConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationAccountName. + /// The softwareUpdateConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationAccountName, string softwareUpdateConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/Azure.ResourceManager.Avs.sln b/sdk/avs/Azure.ResourceManager.Avs/Azure.ResourceManager.Avs.sln index 72cc53ab7c3ed..2be8d1bd9ee07 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/Azure.ResourceManager.Avs.sln +++ b/sdk/avs/Azure.ResourceManager.Avs/Azure.ResourceManager.Avs.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{5B30A6C9-8F7C-499D-A725-EA03E8882458}") = "Azure.ResourceManager.Avs", "src\Azure.ResourceManager.Avs.csproj", "{702E46D7-6C74-4447-9B3E-C66BBDFE253A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Avs", "src\Azure.ResourceManager.Avs.csproj", "{702E46D7-6C74-4447-9B3E-C66BBDFE253A}" EndProject -Project("{5B30A6C9-8F7C-499D-A725-EA03E8882458}") = "Azure.ResourceManager.Avs.Tests", "tests\Azure.ResourceManager.Avs.Tests.csproj", "{E024EB23-1536-4B05-AA4B-53E131E6DDD7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Avs.Tests", "tests\Azure.ResourceManager.Avs.Tests.csproj", "{E024EB23-1536-4B05-AA4B-53E131E6DDD7}" EndProject -Project("{5B30A6C9-8F7C-499D-A725-EA03E8882458}") = "Azure.ResourceManager.Avs.Samples", "samples\Azure.ResourceManager.Avs.Samples.csproj", "{a814622b-76ab-4d85-bfd6-370994955eaa}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Avs.Samples", "samples\Azure.ResourceManager.Avs.Samples.csproj", "{A814622B-76AB-4D85-BFD6-370994955EAA}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {82B4A9B0-CBCF-4A87-9524-69B8199C2FF8} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {E024EB23-1536-4B05-AA4B-53E131E6DDD7}.Release|x64.Build.0 = Release|Any CPU {E024EB23-1536-4B05-AA4B-53E131E6DDD7}.Release|x86.ActiveCfg = Release|Any CPU {E024EB23-1536-4B05-AA4B-53E131E6DDD7}.Release|x86.Build.0 = Release|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Debug|x64.ActiveCfg = Debug|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Debug|x64.Build.0 = Debug|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Debug|x86.ActiveCfg = Debug|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Debug|x86.Build.0 = Debug|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Release|Any CPU.Build.0 = Release|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Release|x64.ActiveCfg = Release|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Release|x64.Build.0 = Release|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Release|x86.ActiveCfg = Release|Any CPU + {A814622B-76AB-4D85-BFD6-370994955EAA}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {82B4A9B0-CBCF-4A87-9524-69B8199C2FF8} EndGlobalSection EndGlobal diff --git a/sdk/avs/Azure.ResourceManager.Avs/api/Azure.ResourceManager.Avs.netstandard2.0.cs b/sdk/avs/Azure.ResourceManager.Avs/api/Azure.ResourceManager.Avs.netstandard2.0.cs index ab1574b577906..97492c1e96e4b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/api/Azure.ResourceManager.Avs.netstandard2.0.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/api/Azure.ResourceManager.Avs.netstandard2.0.cs @@ -215,7 +215,7 @@ protected AvsPrivateCloudCollection() { } } public partial class AvsPrivateCloudData : Azure.ResourceManager.Models.TrackedResourceData { - public AvsPrivateCloudData(Azure.Core.AzureLocation location, Azure.ResourceManager.Avs.Models.AvsSku sku) : base (default(Azure.Core.AzureLocation)) { } + public AvsPrivateCloudData(Azure.Core.AzureLocation location, Azure.ResourceManager.Avs.Models.AvsSku sku) { } public Azure.ResourceManager.Avs.Models.PrivateCloudAvailabilityProperties Availability { get { throw null; } set { } } public Azure.ResourceManager.Avs.Models.ExpressRouteCircuit Circuit { get { throw null; } set { } } public Azure.ResourceManager.Avs.Models.CustomerManagedEncryption Encryption { get { throw null; } set { } } @@ -1006,6 +1006,55 @@ protected WorkloadNetworkVmGroupResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Avs.WorkloadNetworkVmGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Avs.Mocking +{ + public partial class MockableAvsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAvsArmClient() { } + public virtual Azure.ResourceManager.Avs.AvsCloudLinkResource GetAvsCloudLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.AvsPrivateCloudAddonResource GetAvsPrivateCloudAddonResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.AvsPrivateCloudClusterResource GetAvsPrivateCloudClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.AvsPrivateCloudClusterVirtualMachineResource GetAvsPrivateCloudClusterVirtualMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.AvsPrivateCloudDatastoreResource GetAvsPrivateCloudDatastoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.AvsPrivateCloudResource GetAvsPrivateCloudResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.ExpressRouteAuthorizationResource GetExpressRouteAuthorizationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.GlobalReachConnectionResource GetGlobalReachConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.HcxEnterpriseSiteResource GetHcxEnterpriseSiteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.PlacementPolicyResource GetPlacementPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.ScriptCmdletResource GetScriptCmdletResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.ScriptExecutionResource GetScriptExecutionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.ScriptPackageResource GetScriptPackageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkDhcpResource GetWorkloadNetworkDhcpResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkDnsServiceResource GetWorkloadNetworkDnsServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkDnsZoneResource GetWorkloadNetworkDnsZoneResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkGatewayResource GetWorkloadNetworkGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkPortMirroringProfileResource GetWorkloadNetworkPortMirroringProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkPublicIPResource GetWorkloadNetworkPublicIPResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkResource GetWorkloadNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkSegmentResource GetWorkloadNetworkSegmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkVirtualMachineResource GetWorkloadNetworkVirtualMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Avs.WorkloadNetworkVmGroupResource GetWorkloadNetworkVmGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAvsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAvsResourceGroupResource() { } + public virtual Azure.Response GetAvsPrivateCloud(string privateCloudName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvsPrivateCloudAsync(string privateCloudName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Avs.AvsPrivateCloudCollection GetAvsPrivateClouds() { throw null; } + } + public partial class MockableAvsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAvsSubscriptionResource() { } + public virtual Azure.Response CheckAvsQuotaAvailability(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckAvsQuotaAvailabilityAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckAvsTrialAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.Avs.Models.AvsSku sku = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckAvsTrialAvailability(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual System.Threading.Tasks.Task> CheckAvsTrialAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Avs.Models.AvsSku sku = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckAvsTrialAvailabilityAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual Azure.Pageable GetAvsPrivateClouds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvsPrivateCloudsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Avs.Models { public partial class AddonArcProperties : Azure.ResourceManager.Avs.Models.AvsPrivateCloudAddonProperties diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Customized/Extensions/AvsExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Customized/Extensions/AvsExtensions.cs index fbc0915cd71ad..8f828c1c3718a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Customized/Extensions/AvsExtensions.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Customized/Extensions/AvsExtensions.cs @@ -32,8 +32,7 @@ public static partial class AvsExtensions /// The cancellation token to use. public static async Task> CheckAvsTrialAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken) { - AvsSku sku = null; - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAvsTrialAvailabilityAsync(location, sku, cancellationToken).ConfigureAwait(false); + return await GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsTrialAvailabilityAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -54,8 +53,7 @@ public static async Task> Check /// The cancellation token to use. public static Response CheckAvsTrialAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken) { - AvsSku sku = null; - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAvsTrialAvailability(location, sku, cancellationToken); + return GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsTrialAvailability(location, cancellationToken); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Customized/Extensions/MockableAvsSubscriptionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Customized/Extensions/MockableAvsSubscriptionResource.cs new file mode 100644 index 0000000000000..9c2eb482a175e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Customized/Extensions/MockableAvsSubscriptionResource.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAvsSubscriptionResource : ArmResource + { + /// + /// Return trial status for subscription by region + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// + /// + /// Operation Id + /// Locations_CheckTrialAvailability + /// + /// + /// + /// Azure region. + /// The cancellation token to use. + public virtual async Task> CheckAvsTrialAvailabilityAsync(AzureLocation location, CancellationToken cancellationToken) + { + return await CheckAvsTrialAvailabilityAsync(location, null, cancellationToken).ConfigureAwait(false); + } + + /// + /// Return trial status for subscription by region + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// + /// + /// Operation Id + /// Locations_CheckTrialAvailability + /// + /// + /// + /// Azure region. + /// The cancellation token to use. + public virtual Response CheckAvsTrialAvailability(AzureLocation location, CancellationToken cancellationToken) + { + return CheckAvsTrialAvailability(location, null, cancellationToken); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.cs index d950bb66e86aa..210142882e0b5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsCloudLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class AvsCloudLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The cloudLinkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.cs index 9b58057176f4d..e815c1667869e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudAddonResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class AvsPrivateCloudAddonResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The addonName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs index 6a18d92c8a41d..2d664e38371eb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Avs public partial class AvsPrivateCloudClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AvsPrivateCloudDatastoreResources and their operations over a AvsPrivateCloudDatastoreResource. public virtual AvsPrivateCloudDatastoreCollection GetAvsPrivateCloudDatastores() { - return GetCachedClient(Client => new AvsPrivateCloudDatastoreCollection(Client, Id)); + return GetCachedClient(client => new AvsPrivateCloudDatastoreCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual AvsPrivateCloudDatastoreCollection GetAvsPrivateCloudDatastores() /// /// Name of the datastore in the private cloud cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAvsPrivateCloudDatastoreAsync(string datastoreName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetAvsPriv /// /// Name of the datastore in the private cloud cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAvsPrivateCloudDatastore(string datastoreName, CancellationToken cancellationToken = default) { @@ -145,7 +149,7 @@ public virtual Response GetAvsPrivateCloudData /// An object representing collection of AvsPrivateCloudClusterVirtualMachineResources and their operations over a AvsPrivateCloudClusterVirtualMachineResource. public virtual AvsPrivateCloudClusterVirtualMachineCollection GetAvsPrivateCloudClusterVirtualMachines() { - return GetCachedClient(Client => new AvsPrivateCloudClusterVirtualMachineCollection(Client, Id)); + return GetCachedClient(client => new AvsPrivateCloudClusterVirtualMachineCollection(client, Id)); } /// @@ -163,8 +167,8 @@ public virtual AvsPrivateCloudClusterVirtualMachineCollection GetAvsPrivateCloud /// /// Virtual Machine identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAvsPrivateCloudClusterVirtualMachineAsync(string virtualMachineId, CancellationToken cancellationToken = default) { @@ -186,8 +190,8 @@ public virtual async Task /// /// Virtual Machine identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAvsPrivateCloudClusterVirtualMachine(string virtualMachineId, CancellationToken cancellationToken = default) { @@ -198,7 +202,7 @@ public virtual Response GetAvsPriv /// An object representing collection of PlacementPolicyResources and their operations over a PlacementPolicyResource. public virtual PlacementPolicyCollection GetPlacementPolicies() { - return GetCachedClient(Client => new PlacementPolicyCollection(Client, Id)); + return GetCachedClient(client => new PlacementPolicyCollection(client, Id)); } /// @@ -216,8 +220,8 @@ public virtual PlacementPolicyCollection GetPlacementPolicies() /// /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPlacementPolicyAsync(string placementPolicyName, CancellationToken cancellationToken = default) { @@ -239,8 +243,8 @@ public virtual async Task> GetPlacementPolicyA /// /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPlacementPolicy(string placementPolicyName, CancellationToken cancellationToken = default) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.cs index c4becd976d085..484500f00f956 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterVirtualMachineResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Avs public partial class AvsPrivateCloudClusterVirtualMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The clusterName. + /// The virtualMachineId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.cs index 298e19f388375..358e0051da14f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudDatastoreResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Avs public partial class AvsPrivateCloudDatastoreResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The clusterName. + /// The datastoreName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs index 1150efd670137..9ae0cc1227271 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Avs public partial class AvsPrivateCloudResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AvsPrivateCloudClusterResources and their operations over a AvsPrivateCloudClusterResource. public virtual AvsPrivateCloudClusterCollection GetAvsPrivateCloudClusters() { - return GetCachedClient(Client => new AvsPrivateCloudClusterCollection(Client, Id)); + return GetCachedClient(client => new AvsPrivateCloudClusterCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual AvsPrivateCloudClusterCollection GetAvsPrivateCloudClusters() /// /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAvsPrivateCloudClusterAsync(string clusterName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetAvsPrivat /// /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAvsPrivateCloudCluster(string clusterName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetAvsPrivateCloudCluste /// An object representing collection of HcxEnterpriseSiteResources and their operations over a HcxEnterpriseSiteResource. public virtual HcxEnterpriseSiteCollection GetHcxEnterpriseSites() { - return GetCachedClient(Client => new HcxEnterpriseSiteCollection(Client, Id)); + return GetCachedClient(client => new HcxEnterpriseSiteCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual HcxEnterpriseSiteCollection GetHcxEnterpriseSites() /// /// Name of the HCX Enterprise Site in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHcxEnterpriseSiteAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetHcxEnterpriseS /// /// Name of the HCX Enterprise Site in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHcxEnterpriseSite(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetHcxEnterpriseSite(string h /// An object representing collection of ExpressRouteAuthorizationResources and their operations over a ExpressRouteAuthorizationResource. public virtual ExpressRouteAuthorizationCollection GetExpressRouteAuthorizations() { - return GetCachedClient(Client => new ExpressRouteAuthorizationCollection(Client, Id)); + return GetCachedClient(client => new ExpressRouteAuthorizationCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual ExpressRouteAuthorizationCollection GetExpressRouteAuthorizations /// /// Name of the ExpressRoute Circuit Authorization in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExpressRouteAuthorizationAsync(string authorizationName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetExpres /// /// Name of the ExpressRoute Circuit Authorization in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExpressRouteAuthorization(string authorizationName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetExpressRouteAuthor /// An object representing collection of GlobalReachConnectionResources and their operations over a GlobalReachConnectionResource. public virtual GlobalReachConnectionCollection GetGlobalReachConnections() { - return GetCachedClient(Client => new GlobalReachConnectionCollection(Client, Id)); + return GetCachedClient(client => new GlobalReachConnectionCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual GlobalReachConnectionCollection GetGlobalReachConnections() /// /// Name of the global reach connection in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGlobalReachConnectionAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetGlobalReac /// /// Name of the global reach connection in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGlobalReachConnection(string globalReachConnectionName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetGlobalReachConnection( /// An object representing collection of WorkloadNetworkResources and their operations over a WorkloadNetworkResource. public virtual WorkloadNetworkCollection GetWorkloadNetworks() { - return GetCachedClient(Client => new WorkloadNetworkCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkCollection(client, Id)); } /// @@ -354,7 +357,7 @@ public virtual Response GetWorkloadNetwork(WorkloadNetw /// An object representing collection of WorkloadNetworkSegmentResources and their operations over a WorkloadNetworkSegmentResource. public virtual WorkloadNetworkSegmentCollection GetWorkloadNetworkSegments() { - return GetCachedClient(Client => new WorkloadNetworkSegmentCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkSegmentCollection(client, Id)); } /// @@ -372,8 +375,8 @@ public virtual WorkloadNetworkSegmentCollection GetWorkloadNetworkSegments() /// /// NSX Segment identifier. Generally the same as the Segment's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkSegmentAsync(string segmentId, CancellationToken cancellationToken = default) { @@ -395,8 +398,8 @@ public virtual async Task> GetWorkloadN /// /// NSX Segment identifier. Generally the same as the Segment's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkSegment(string segmentId, CancellationToken cancellationToken = default) { @@ -407,7 +410,7 @@ public virtual Response GetWorkloadNetworkSegmen /// An object representing collection of WorkloadNetworkDhcpResources and their operations over a WorkloadNetworkDhcpResource. public virtual WorkloadNetworkDhcpCollection GetWorkloadNetworkDhcps() { - return GetCachedClient(Client => new WorkloadNetworkDhcpCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkDhcpCollection(client, Id)); } /// @@ -425,8 +428,8 @@ public virtual WorkloadNetworkDhcpCollection GetWorkloadNetworkDhcps() /// /// NSX DHCP identifier. Generally the same as the DHCP display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkDhcpAsync(string dhcpId, CancellationToken cancellationToken = default) { @@ -448,8 +451,8 @@ public virtual async Task> GetWorkloadNetw /// /// NSX DHCP identifier. Generally the same as the DHCP display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkDhcp(string dhcpId, CancellationToken cancellationToken = default) { @@ -460,7 +463,7 @@ public virtual Response GetWorkloadNetworkDhcp(stri /// An object representing collection of WorkloadNetworkGatewayResources and their operations over a WorkloadNetworkGatewayResource. public virtual WorkloadNetworkGatewayCollection GetWorkloadNetworkGateways() { - return GetCachedClient(Client => new WorkloadNetworkGatewayCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkGatewayCollection(client, Id)); } /// @@ -478,8 +481,8 @@ public virtual WorkloadNetworkGatewayCollection GetWorkloadNetworkGateways() /// /// NSX Gateway identifier. Generally the same as the Gateway's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkGatewayAsync(string gatewayId, CancellationToken cancellationToken = default) { @@ -501,8 +504,8 @@ public virtual async Task> GetWorkloadN /// /// NSX Gateway identifier. Generally the same as the Gateway's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkGateway(string gatewayId, CancellationToken cancellationToken = default) { @@ -513,7 +516,7 @@ public virtual Response GetWorkloadNetworkGatewa /// An object representing collection of WorkloadNetworkPortMirroringProfileResources and their operations over a WorkloadNetworkPortMirroringProfileResource. public virtual WorkloadNetworkPortMirroringProfileCollection GetWorkloadNetworkPortMirroringProfiles() { - return GetCachedClient(Client => new WorkloadNetworkPortMirroringProfileCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkPortMirroringProfileCollection(client, Id)); } /// @@ -531,8 +534,8 @@ public virtual WorkloadNetworkPortMirroringProfileCollection GetWorkloadNetworkP /// /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkPortMirroringProfileAsync(string portMirroringId, CancellationToken cancellationToken = default) { @@ -554,8 +557,8 @@ public virtual async Task> /// /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkPortMirroringProfile(string portMirroringId, CancellationToken cancellationToken = default) { @@ -566,7 +569,7 @@ public virtual Response GetWorkload /// An object representing collection of WorkloadNetworkVmGroupResources and their operations over a WorkloadNetworkVmGroupResource. public virtual WorkloadNetworkVmGroupCollection GetWorkloadNetworkVmGroups() { - return GetCachedClient(Client => new WorkloadNetworkVmGroupCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkVmGroupCollection(client, Id)); } /// @@ -584,8 +587,8 @@ public virtual WorkloadNetworkVmGroupCollection GetWorkloadNetworkVmGroups() /// /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkVmGroupAsync(string vmGroupId, CancellationToken cancellationToken = default) { @@ -607,8 +610,8 @@ public virtual async Task> GetWorkloadN /// /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkVmGroup(string vmGroupId, CancellationToken cancellationToken = default) { @@ -619,7 +622,7 @@ public virtual Response GetWorkloadNetworkVmGrou /// An object representing collection of WorkloadNetworkVirtualMachineResources and their operations over a WorkloadNetworkVirtualMachineResource. public virtual WorkloadNetworkVirtualMachineCollection GetWorkloadNetworkVirtualMachines() { - return GetCachedClient(Client => new WorkloadNetworkVirtualMachineCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkVirtualMachineCollection(client, Id)); } /// @@ -637,8 +640,8 @@ public virtual WorkloadNetworkVirtualMachineCollection GetWorkloadNetworkVirtual /// /// Virtual Machine identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkVirtualMachineAsync(string virtualMachineId, CancellationToken cancellationToken = default) { @@ -660,8 +663,8 @@ public virtual async Task> GetWo /// /// Virtual Machine identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkVirtualMachine(string virtualMachineId, CancellationToken cancellationToken = default) { @@ -672,7 +675,7 @@ public virtual Response GetWorkloadNetwor /// An object representing collection of WorkloadNetworkDnsServiceResources and their operations over a WorkloadNetworkDnsServiceResource. public virtual WorkloadNetworkDnsServiceCollection GetWorkloadNetworkDnsServices() { - return GetCachedClient(Client => new WorkloadNetworkDnsServiceCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkDnsServiceCollection(client, Id)); } /// @@ -690,8 +693,8 @@ public virtual WorkloadNetworkDnsServiceCollection GetWorkloadNetworkDnsServices /// /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkDnsServiceAsync(string dnsServiceId, CancellationToken cancellationToken = default) { @@ -713,8 +716,8 @@ public virtual async Task> GetWorklo /// /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkDnsService(string dnsServiceId, CancellationToken cancellationToken = default) { @@ -725,7 +728,7 @@ public virtual Response GetWorkloadNetworkDns /// An object representing collection of WorkloadNetworkDnsZoneResources and their operations over a WorkloadNetworkDnsZoneResource. public virtual WorkloadNetworkDnsZoneCollection GetWorkloadNetworkDnsZones() { - return GetCachedClient(Client => new WorkloadNetworkDnsZoneCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkDnsZoneCollection(client, Id)); } /// @@ -743,8 +746,8 @@ public virtual WorkloadNetworkDnsZoneCollection GetWorkloadNetworkDnsZones() /// /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkDnsZoneAsync(string dnsZoneId, CancellationToken cancellationToken = default) { @@ -766,8 +769,8 @@ public virtual async Task> GetWorkloadN /// /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkDnsZone(string dnsZoneId, CancellationToken cancellationToken = default) { @@ -778,7 +781,7 @@ public virtual Response GetWorkloadNetworkDnsZon /// An object representing collection of WorkloadNetworkPublicIPResources and their operations over a WorkloadNetworkPublicIPResource. public virtual WorkloadNetworkPublicIPCollection GetWorkloadNetworkPublicIPs() { - return GetCachedClient(Client => new WorkloadNetworkPublicIPCollection(Client, Id)); + return GetCachedClient(client => new WorkloadNetworkPublicIPCollection(client, Id)); } /// @@ -796,8 +799,8 @@ public virtual WorkloadNetworkPublicIPCollection GetWorkloadNetworkPublicIPs() /// /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadNetworkPublicIPAsync(string publicIPId, CancellationToken cancellationToken = default) { @@ -819,8 +822,8 @@ public virtual async Task> GetWorkload /// /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadNetworkPublicIP(string publicIPId, CancellationToken cancellationToken = default) { @@ -831,7 +834,7 @@ public virtual Response GetWorkloadNetworkPubli /// An object representing collection of AvsCloudLinkResources and their operations over a AvsCloudLinkResource. public virtual AvsCloudLinkCollection GetAvsCloudLinks() { - return GetCachedClient(Client => new AvsCloudLinkCollection(Client, Id)); + return GetCachedClient(client => new AvsCloudLinkCollection(client, Id)); } /// @@ -849,8 +852,8 @@ public virtual AvsCloudLinkCollection GetAvsCloudLinks() /// /// Name of the cloud link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAvsCloudLinkAsync(string cloudLinkName, CancellationToken cancellationToken = default) { @@ -872,8 +875,8 @@ public virtual async Task> GetAvsCloudLinkAsync(s /// /// Name of the cloud link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAvsCloudLink(string cloudLinkName, CancellationToken cancellationToken = default) { @@ -884,7 +887,7 @@ public virtual Response GetAvsCloudLink(string cloudLinkNa /// An object representing collection of AvsPrivateCloudAddonResources and their operations over a AvsPrivateCloudAddonResource. public virtual AvsPrivateCloudAddonCollection GetAvsPrivateCloudAddons() { - return GetCachedClient(Client => new AvsPrivateCloudAddonCollection(Client, Id)); + return GetCachedClient(client => new AvsPrivateCloudAddonCollection(client, Id)); } /// @@ -902,8 +905,8 @@ public virtual AvsPrivateCloudAddonCollection GetAvsPrivateCloudAddons() /// /// Name of the addon for the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAvsPrivateCloudAddonAsync(string addonName, CancellationToken cancellationToken = default) { @@ -925,8 +928,8 @@ public virtual async Task> GetAvsPrivateC /// /// Name of the addon for the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAvsPrivateCloudAddon(string addonName, CancellationToken cancellationToken = default) { @@ -937,7 +940,7 @@ public virtual Response GetAvsPrivateCloudAddon(st /// An object representing collection of ScriptPackageResources and their operations over a ScriptPackageResource. public virtual ScriptPackageCollection GetScriptPackages() { - return GetCachedClient(Client => new ScriptPackageCollection(Client, Id)); + return GetCachedClient(client => new ScriptPackageCollection(client, Id)); } /// @@ -955,8 +958,8 @@ public virtual ScriptPackageCollection GetScriptPackages() /// /// Name of the script package in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetScriptPackageAsync(string scriptPackageName, CancellationToken cancellationToken = default) { @@ -978,8 +981,8 @@ public virtual async Task> GetScriptPackageAsync /// /// Name of the script package in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetScriptPackage(string scriptPackageName, CancellationToken cancellationToken = default) { @@ -990,7 +993,7 @@ public virtual Response GetScriptPackage(string scriptPac /// An object representing collection of ScriptExecutionResources and their operations over a ScriptExecutionResource. public virtual ScriptExecutionCollection GetScriptExecutions() { - return GetCachedClient(Client => new ScriptExecutionCollection(Client, Id)); + return GetCachedClient(client => new ScriptExecutionCollection(client, Id)); } /// @@ -1008,8 +1011,8 @@ public virtual ScriptExecutionCollection GetScriptExecutions() /// /// Name of the user-invoked script execution resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetScriptExecutionAsync(string scriptExecutionName, CancellationToken cancellationToken = default) { @@ -1031,8 +1034,8 @@ public virtual async Task> GetScriptExecutionA /// /// Name of the user-invoked script execution resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetScriptExecution(string scriptExecutionName, CancellationToken cancellationToken = default) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationResource.cs index c68f2e33e313f..554cbb3681a37 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class ExpressRouteAuthorizationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The authorizationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs index d9641c4abe2c8..9a6921ae501f5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Mocking; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Resources; @@ -19,480 +20,401 @@ namespace Azure.ResourceManager.Avs /// A class to add extension methods to Azure.ResourceManager.Avs. public static partial class AvsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAvsArmClient GetMockableAvsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAvsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAvsResourceGroupResource GetMockableAvsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAvsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAvsSubscriptionResource GetMockableAvsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAvsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AvsPrivateCloudResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvsPrivateCloudResource GetAvsPrivateCloudResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvsPrivateCloudResource.ValidateResourceId(id); - return new AvsPrivateCloudResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetAvsPrivateCloudResource(id); } - #endregion - #region AvsPrivateCloudClusterResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvsPrivateCloudClusterResource GetAvsPrivateCloudClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvsPrivateCloudClusterResource.ValidateResourceId(id); - return new AvsPrivateCloudClusterResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetAvsPrivateCloudClusterResource(id); } - #endregion - #region AvsPrivateCloudDatastoreResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvsPrivateCloudDatastoreResource GetAvsPrivateCloudDatastoreResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvsPrivateCloudDatastoreResource.ValidateResourceId(id); - return new AvsPrivateCloudDatastoreResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetAvsPrivateCloudDatastoreResource(id); } - #endregion - #region HcxEnterpriseSiteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HcxEnterpriseSiteResource GetHcxEnterpriseSiteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HcxEnterpriseSiteResource.ValidateResourceId(id); - return new HcxEnterpriseSiteResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetHcxEnterpriseSiteResource(id); } - #endregion - #region ExpressRouteAuthorizationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteAuthorizationResource GetExpressRouteAuthorizationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteAuthorizationResource.ValidateResourceId(id); - return new ExpressRouteAuthorizationResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetExpressRouteAuthorizationResource(id); } - #endregion - #region GlobalReachConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GlobalReachConnectionResource GetGlobalReachConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GlobalReachConnectionResource.ValidateResourceId(id); - return new GlobalReachConnectionResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetGlobalReachConnectionResource(id); } - #endregion - #region WorkloadNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkResource GetWorkloadNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkResource.ValidateResourceId(id); - return new WorkloadNetworkResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkResource(id); } - #endregion - #region WorkloadNetworkSegmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkSegmentResource GetWorkloadNetworkSegmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkSegmentResource.ValidateResourceId(id); - return new WorkloadNetworkSegmentResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkSegmentResource(id); } - #endregion - #region WorkloadNetworkDhcpResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkDhcpResource GetWorkloadNetworkDhcpResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkDhcpResource.ValidateResourceId(id); - return new WorkloadNetworkDhcpResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkDhcpResource(id); } - #endregion - #region WorkloadNetworkGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkGatewayResource GetWorkloadNetworkGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkGatewayResource.ValidateResourceId(id); - return new WorkloadNetworkGatewayResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkGatewayResource(id); } - #endregion - #region WorkloadNetworkPortMirroringProfileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkPortMirroringProfileResource GetWorkloadNetworkPortMirroringProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkPortMirroringProfileResource.ValidateResourceId(id); - return new WorkloadNetworkPortMirroringProfileResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkPortMirroringProfileResource(id); } - #endregion - #region WorkloadNetworkVmGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkVmGroupResource GetWorkloadNetworkVmGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkVmGroupResource.ValidateResourceId(id); - return new WorkloadNetworkVmGroupResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkVmGroupResource(id); } - #endregion - #region WorkloadNetworkVirtualMachineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkVirtualMachineResource GetWorkloadNetworkVirtualMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkVirtualMachineResource.ValidateResourceId(id); - return new WorkloadNetworkVirtualMachineResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkVirtualMachineResource(id); } - #endregion - #region WorkloadNetworkDnsServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkDnsServiceResource GetWorkloadNetworkDnsServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkDnsServiceResource.ValidateResourceId(id); - return new WorkloadNetworkDnsServiceResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkDnsServiceResource(id); } - #endregion - #region WorkloadNetworkDnsZoneResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkDnsZoneResource GetWorkloadNetworkDnsZoneResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkDnsZoneResource.ValidateResourceId(id); - return new WorkloadNetworkDnsZoneResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkDnsZoneResource(id); } - #endregion - #region WorkloadNetworkPublicIPResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadNetworkPublicIPResource GetWorkloadNetworkPublicIPResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadNetworkPublicIPResource.ValidateResourceId(id); - return new WorkloadNetworkPublicIPResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetWorkloadNetworkPublicIPResource(id); } - #endregion - #region AvsCloudLinkResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvsCloudLinkResource GetAvsCloudLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvsCloudLinkResource.ValidateResourceId(id); - return new AvsCloudLinkResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetAvsCloudLinkResource(id); } - #endregion - #region AvsPrivateCloudAddonResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvsPrivateCloudAddonResource GetAvsPrivateCloudAddonResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvsPrivateCloudAddonResource.ValidateResourceId(id); - return new AvsPrivateCloudAddonResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetAvsPrivateCloudAddonResource(id); } - #endregion - #region AvsPrivateCloudClusterVirtualMachineResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvsPrivateCloudClusterVirtualMachineResource GetAvsPrivateCloudClusterVirtualMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvsPrivateCloudClusterVirtualMachineResource.ValidateResourceId(id); - return new AvsPrivateCloudClusterVirtualMachineResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetAvsPrivateCloudClusterVirtualMachineResource(id); } - #endregion - #region PlacementPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PlacementPolicyResource GetPlacementPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PlacementPolicyResource.ValidateResourceId(id); - return new PlacementPolicyResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetPlacementPolicyResource(id); } - #endregion - #region ScriptPackageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScriptPackageResource GetScriptPackageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScriptPackageResource.ValidateResourceId(id); - return new ScriptPackageResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetScriptPackageResource(id); } - #endregion - #region ScriptCmdletResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScriptCmdletResource GetScriptCmdletResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScriptCmdletResource.ValidateResourceId(id); - return new ScriptCmdletResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetScriptCmdletResource(id); } - #endregion - #region ScriptExecutionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScriptExecutionResource GetScriptExecutionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScriptExecutionResource.ValidateResourceId(id); - return new ScriptExecutionResource(client, id); - } - ); + return GetMockableAvsArmClient(client).GetScriptExecutionResource(id); } - #endregion - /// Gets a collection of AvsPrivateCloudResources in the ResourceGroupResource. + /// + /// Gets a collection of AvsPrivateCloudResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AvsPrivateCloudResources and their operations over a AvsPrivateCloudResource. public static AvsPrivateCloudCollection GetAvsPrivateClouds(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvsPrivateClouds(); + return GetMockableAvsResourceGroupResource(resourceGroupResource).GetAvsPrivateClouds(); } /// @@ -507,16 +429,20 @@ public static AvsPrivateCloudCollection GetAvsPrivateClouds(this ResourceGroupRe /// PrivateClouds_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAvsPrivateCloudAsync(this ResourceGroupResource resourceGroupResource, string privateCloudName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAvsPrivateClouds().GetAsync(privateCloudName, cancellationToken).ConfigureAwait(false); + return await GetMockableAvsResourceGroupResource(resourceGroupResource).GetAvsPrivateCloudAsync(privateCloudName, cancellationToken).ConfigureAwait(false); } /// @@ -531,16 +457,20 @@ public static async Task> GetAvsPrivateCloudAs /// PrivateClouds_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAvsPrivateCloud(this ResourceGroupResource resourceGroupResource, string privateCloudName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAvsPrivateClouds().Get(privateCloudName, cancellationToken); + return GetMockableAvsResourceGroupResource(resourceGroupResource).GetAvsPrivateCloud(privateCloudName, cancellationToken); } /// @@ -555,6 +485,10 @@ public static Response GetAvsPrivateCloud(this Resource /// Locations_CheckTrialAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region. @@ -562,7 +496,7 @@ public static Response GetAvsPrivateCloud(this Resource /// The cancellation token to use. public static async Task> CheckAvsTrialAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAvsTrialAvailabilityAsync(location, sku, cancellationToken).ConfigureAwait(false); + return await GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsTrialAvailabilityAsync(location, sku, cancellationToken).ConfigureAwait(false); } /// @@ -577,6 +511,10 @@ public static async Task> Check /// Locations_CheckTrialAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region. @@ -584,7 +522,7 @@ public static async Task> Check /// The cancellation token to use. public static Response CheckAvsTrialAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAvsTrialAvailability(location, sku, cancellationToken); + return GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsTrialAvailability(location, sku, cancellationToken); } /// @@ -599,13 +537,17 @@ public static Response CheckAvsTrialAvai /// Locations_CheckQuotaAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region. /// The cancellation token to use. public static async Task> CheckAvsQuotaAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAvsQuotaAvailabilityAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsQuotaAvailabilityAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -620,13 +562,17 @@ public static async Task> Check /// Locations_CheckQuotaAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region. /// The cancellation token to use. public static Response CheckAvsQuotaAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAvsQuotaAvailability(location, cancellationToken); + return GetMockableAvsSubscriptionResource(subscriptionResource).CheckAvsQuotaAvailability(location, cancellationToken); } /// @@ -641,13 +587,17 @@ public static Response CheckAvsQuotaAvai /// PrivateClouds_ListInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvsPrivateCloudsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvsPrivateCloudsAsync(cancellationToken); + return GetMockableAvsSubscriptionResource(subscriptionResource).GetAvsPrivateCloudsAsync(cancellationToken); } /// @@ -662,13 +612,17 @@ public static AsyncPageable GetAvsPrivateCloudsAsync(th /// PrivateClouds_ListInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvsPrivateClouds(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvsPrivateClouds(cancellationToken); + return GetMockableAvsSubscriptionResource(subscriptionResource).GetAvsPrivateClouds(cancellationToken); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsArmClient.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsArmClient.cs new file mode 100644 index 0000000000000..ba7fdb8150616 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsArmClient.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAvsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAvsArmClient() + { + } + + /// 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 MockableAvsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAvsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvsPrivateCloudResource GetAvsPrivateCloudResource(ResourceIdentifier id) + { + AvsPrivateCloudResource.ValidateResourceId(id); + return new AvsPrivateCloudResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvsPrivateCloudClusterResource GetAvsPrivateCloudClusterResource(ResourceIdentifier id) + { + AvsPrivateCloudClusterResource.ValidateResourceId(id); + return new AvsPrivateCloudClusterResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvsPrivateCloudDatastoreResource GetAvsPrivateCloudDatastoreResource(ResourceIdentifier id) + { + AvsPrivateCloudDatastoreResource.ValidateResourceId(id); + return new AvsPrivateCloudDatastoreResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HcxEnterpriseSiteResource GetHcxEnterpriseSiteResource(ResourceIdentifier id) + { + HcxEnterpriseSiteResource.ValidateResourceId(id); + return new HcxEnterpriseSiteResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteAuthorizationResource GetExpressRouteAuthorizationResource(ResourceIdentifier id) + { + ExpressRouteAuthorizationResource.ValidateResourceId(id); + return new ExpressRouteAuthorizationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GlobalReachConnectionResource GetGlobalReachConnectionResource(ResourceIdentifier id) + { + GlobalReachConnectionResource.ValidateResourceId(id); + return new GlobalReachConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkResource GetWorkloadNetworkResource(ResourceIdentifier id) + { + WorkloadNetworkResource.ValidateResourceId(id); + return new WorkloadNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkSegmentResource GetWorkloadNetworkSegmentResource(ResourceIdentifier id) + { + WorkloadNetworkSegmentResource.ValidateResourceId(id); + return new WorkloadNetworkSegmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkDhcpResource GetWorkloadNetworkDhcpResource(ResourceIdentifier id) + { + WorkloadNetworkDhcpResource.ValidateResourceId(id); + return new WorkloadNetworkDhcpResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkGatewayResource GetWorkloadNetworkGatewayResource(ResourceIdentifier id) + { + WorkloadNetworkGatewayResource.ValidateResourceId(id); + return new WorkloadNetworkGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkPortMirroringProfileResource GetWorkloadNetworkPortMirroringProfileResource(ResourceIdentifier id) + { + WorkloadNetworkPortMirroringProfileResource.ValidateResourceId(id); + return new WorkloadNetworkPortMirroringProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkVmGroupResource GetWorkloadNetworkVmGroupResource(ResourceIdentifier id) + { + WorkloadNetworkVmGroupResource.ValidateResourceId(id); + return new WorkloadNetworkVmGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkVirtualMachineResource GetWorkloadNetworkVirtualMachineResource(ResourceIdentifier id) + { + WorkloadNetworkVirtualMachineResource.ValidateResourceId(id); + return new WorkloadNetworkVirtualMachineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkDnsServiceResource GetWorkloadNetworkDnsServiceResource(ResourceIdentifier id) + { + WorkloadNetworkDnsServiceResource.ValidateResourceId(id); + return new WorkloadNetworkDnsServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkDnsZoneResource GetWorkloadNetworkDnsZoneResource(ResourceIdentifier id) + { + WorkloadNetworkDnsZoneResource.ValidateResourceId(id); + return new WorkloadNetworkDnsZoneResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadNetworkPublicIPResource GetWorkloadNetworkPublicIPResource(ResourceIdentifier id) + { + WorkloadNetworkPublicIPResource.ValidateResourceId(id); + return new WorkloadNetworkPublicIPResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvsCloudLinkResource GetAvsCloudLinkResource(ResourceIdentifier id) + { + AvsCloudLinkResource.ValidateResourceId(id); + return new AvsCloudLinkResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvsPrivateCloudAddonResource GetAvsPrivateCloudAddonResource(ResourceIdentifier id) + { + AvsPrivateCloudAddonResource.ValidateResourceId(id); + return new AvsPrivateCloudAddonResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvsPrivateCloudClusterVirtualMachineResource GetAvsPrivateCloudClusterVirtualMachineResource(ResourceIdentifier id) + { + AvsPrivateCloudClusterVirtualMachineResource.ValidateResourceId(id); + return new AvsPrivateCloudClusterVirtualMachineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PlacementPolicyResource GetPlacementPolicyResource(ResourceIdentifier id) + { + PlacementPolicyResource.ValidateResourceId(id); + return new PlacementPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScriptPackageResource GetScriptPackageResource(ResourceIdentifier id) + { + ScriptPackageResource.ValidateResourceId(id); + return new ScriptPackageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScriptCmdletResource GetScriptCmdletResource(ResourceIdentifier id) + { + ScriptCmdletResource.ValidateResourceId(id); + return new ScriptCmdletResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScriptExecutionResource GetScriptExecutionResource(ResourceIdentifier id) + { + ScriptExecutionResource.ValidateResourceId(id); + return new ScriptExecutionResource(Client, id); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsResourceGroupResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsResourceGroupResource.cs new file mode 100644 index 0000000000000..4fbe22fac5aec --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Avs; + +namespace Azure.ResourceManager.Avs.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAvsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAvsResourceGroupResource() + { + } + + /// 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 MockableAvsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AvsPrivateCloudResources in the ResourceGroupResource. + /// An object representing collection of AvsPrivateCloudResources and their operations over a AvsPrivateCloudResource. + public virtual AvsPrivateCloudCollection GetAvsPrivateClouds() + { + return GetCachedClient(client => new AvsPrivateCloudCollection(client, Id)); + } + + /// + /// Get a private cloud + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName} + /// + /// + /// Operation Id + /// PrivateClouds_Get + /// + /// + /// + /// Name of the private cloud. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAvsPrivateCloudAsync(string privateCloudName, CancellationToken cancellationToken = default) + { + return await GetAvsPrivateClouds().GetAsync(privateCloudName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a private cloud + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName} + /// + /// + /// Operation Id + /// PrivateClouds_Get + /// + /// + /// + /// Name of the private cloud. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAvsPrivateCloud(string privateCloudName, CancellationToken cancellationToken = default) + { + return GetAvsPrivateClouds().Get(privateCloudName, cancellationToken); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsSubscriptionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsSubscriptionResource.cs new file mode 100644 index 0000000000000..fa24cbe97cad4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/MockableAvsSubscriptionResource.cs @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAvsSubscriptionResource : ArmResource + { + private ClientDiagnostics _locationsClientDiagnostics; + private LocationsRestOperations _locationsRestClient; + private ClientDiagnostics _avsPrivateCloudPrivateCloudsClientDiagnostics; + private PrivateCloudsRestOperations _avsPrivateCloudPrivateCloudsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAvsSubscriptionResource() + { + } + + /// 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 MockableAvsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AvsPrivateCloudPrivateCloudsClientDiagnostics => _avsPrivateCloudPrivateCloudsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Avs", AvsPrivateCloudResource.ResourceType.Namespace, Diagnostics); + private PrivateCloudsRestOperations AvsPrivateCloudPrivateCloudsRestClient => _avsPrivateCloudPrivateCloudsRestClient ??= new PrivateCloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AvsPrivateCloudResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Return trial status for subscription by region + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// + /// + /// Operation Id + /// Locations_CheckTrialAvailability + /// + /// + /// + /// Azure region. + /// The sku to check for trial availability. + /// The cancellation token to use. + public virtual async Task> CheckAvsTrialAvailabilityAsync(AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckAvsTrialAvailability"); + scope.Start(); + try + { + var response = await LocationsRestClient.CheckTrialAvailabilityAsync(Id.SubscriptionId, location, sku, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Return trial status for subscription by region + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability + /// + /// + /// Operation Id + /// Locations_CheckTrialAvailability + /// + /// + /// + /// Azure region. + /// The sku to check for trial availability. + /// The cancellation token to use. + public virtual Response CheckAvsTrialAvailability(AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckAvsTrialAvailability"); + scope.Start(); + try + { + var response = LocationsRestClient.CheckTrialAvailability(Id.SubscriptionId, location, sku, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Return quota for subscription by region + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability + /// + /// + /// Operation Id + /// Locations_CheckQuotaAvailability + /// + /// + /// + /// Azure region. + /// The cancellation token to use. + public virtual async Task> CheckAvsQuotaAvailabilityAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckAvsQuotaAvailability"); + scope.Start(); + try + { + var response = await LocationsRestClient.CheckQuotaAvailabilityAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Return quota for subscription by region + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability + /// + /// + /// Operation Id + /// Locations_CheckQuotaAvailability + /// + /// + /// + /// Azure region. + /// The cancellation token to use. + public virtual Response CheckAvsQuotaAvailability(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableAvsSubscriptionResource.CheckAvsQuotaAvailability"); + scope.Start(); + try + { + var response = LocationsRestClient.CheckQuotaAvailability(Id.SubscriptionId, location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List private clouds in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds + /// + /// + /// Operation Id + /// PrivateClouds_ListInSubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvsPrivateCloudsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "MockableAvsSubscriptionResource.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); + } + + /// + /// List private clouds in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds + /// + /// + /// Operation Id + /// PrivateClouds_ListInSubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvsPrivateClouds(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "MockableAvsSubscriptionResource.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index f27d9ee87b0d2..0000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Avs -{ - /// 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 AvsPrivateCloudResources in the ResourceGroupResource. - /// An object representing collection of AvsPrivateCloudResources and their operations over a AvsPrivateCloudResource. - public virtual AvsPrivateCloudCollection GetAvsPrivateClouds() - { - return GetCachedClient(Client => new AvsPrivateCloudCollection(Client, Id)); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 44ae45f535360..0000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; - -namespace Azure.ResourceManager.Avs -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _locationsClientDiagnostics; - private LocationsRestOperations _locationsRestClient; - private ClientDiagnostics _avsPrivateCloudPrivateCloudsClientDiagnostics; - private PrivateCloudsRestOperations _avsPrivateCloudPrivateCloudsRestClient; - - /// 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 LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Avs", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AvsPrivateCloudPrivateCloudsClientDiagnostics => _avsPrivateCloudPrivateCloudsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Avs", AvsPrivateCloudResource.ResourceType.Namespace, Diagnostics); - private PrivateCloudsRestOperations AvsPrivateCloudPrivateCloudsRestClient => _avsPrivateCloudPrivateCloudsRestClient ??= new PrivateCloudsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AvsPrivateCloudResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Return trial status for subscription by region - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability - /// - /// - /// Operation Id - /// Locations_CheckTrialAvailability - /// - /// - /// - /// Azure region. - /// The sku to check for trial availability. - /// The cancellation token to use. - public virtual async Task> CheckAvsTrialAvailabilityAsync(AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAvsTrialAvailability"); - scope.Start(); - try - { - var response = await LocationsRestClient.CheckTrialAvailabilityAsync(Id.SubscriptionId, location, sku, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Return trial status for subscription by region - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability - /// - /// - /// Operation Id - /// Locations_CheckTrialAvailability - /// - /// - /// - /// Azure region. - /// The sku to check for trial availability. - /// The cancellation token to use. - public virtual Response CheckAvsTrialAvailability(AzureLocation location, AvsSku sku = null, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAvsTrialAvailability"); - scope.Start(); - try - { - var response = LocationsRestClient.CheckTrialAvailability(Id.SubscriptionId, location, sku, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Return quota for subscription by region - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability - /// - /// - /// Operation Id - /// Locations_CheckQuotaAvailability - /// - /// - /// - /// Azure region. - /// The cancellation token to use. - public virtual async Task> CheckAvsQuotaAvailabilityAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAvsQuotaAvailability"); - scope.Start(); - try - { - var response = await LocationsRestClient.CheckQuotaAvailabilityAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Return quota for subscription by region - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability - /// - /// - /// Operation Id - /// Locations_CheckQuotaAvailability - /// - /// - /// - /// Azure region. - /// The cancellation token to use. - public virtual Response CheckAvsQuotaAvailability(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAvsQuotaAvailability"); - scope.Start(); - try - { - var response = LocationsRestClient.CheckQuotaAvailability(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List private clouds in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds - /// - /// - /// Operation Id - /// PrivateClouds_ListInSubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvsPrivateCloudsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); - } - - /// - /// List private clouds in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds - /// - /// - /// Operation Id - /// PrivateClouds_ListInSubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvsPrivateClouds(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvsPrivateCloudPrivateCloudsRestClient.CreateListInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvsPrivateCloudResource(Client, AvsPrivateCloudData.DeserializeAvsPrivateCloudData(e)), AvsPrivateCloudPrivateCloudsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvsPrivateClouds", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionResource.cs index a0af1a13666c5..b35da7ab3b378 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class GlobalReachConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The globalReachConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteResource.cs index 5c0761960007b..cf5e739bc3fb2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class HcxEnterpriseSiteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The hcxEnterpriseSiteName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyResource.cs index 0cd3724492306..17513cedab586 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Avs public partial class PlacementPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The clusterName. + /// The placementPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletResource.cs index 5d321c89642f8..88b7e4ac1064c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Avs public partial class ScriptCmdletResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The scriptPackageName. + /// The scriptCmdletName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionResource.cs index d5959af541002..d82e5f839545b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Avs public partial class ScriptExecutionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The scriptExecutionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs index f00d9bde6426d..52ed1caf242c7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class ScriptPackageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The scriptPackageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ScriptCmdletResources and their operations over a ScriptCmdletResource. public virtual ScriptCmdletCollection GetScriptCmdlets() { - return GetCachedClient(Client => new ScriptCmdletCollection(Client, Id)); + return GetCachedClient(client => new ScriptCmdletCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual ScriptCmdletCollection GetScriptCmdlets() /// /// Name of the script cmdlet resource in the script package in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetScriptCmdletAsync(string scriptCmdletName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetScriptCmdletAsync(s /// /// Name of the script cmdlet resource in the script package in the private cloud. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetScriptCmdlet(string scriptCmdletName, CancellationToken cancellationToken = default) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.cs index a076b24d56a16..379af89f2fd2a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkDhcpResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The dhcpId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.cs index ec33842cf3c43..6eb075359b6cf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkDnsServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The dnsServiceId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.cs index 3baeb07a64436..30949f37d7a58 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkDnsZoneResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The dnsZoneId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayResource.cs index 187f9da6c76d6..92f6d4adacf09 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The gatewayId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.cs index 7e53598c448a6..1cee5a4971852 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringProfileResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkPortMirroringProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The portMirroringId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.cs index 2a09193779cef..7298354cd65f3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkPublicIPResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The publicIPId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkResource.cs index 9c3328746d05d..cc1251e65c5bd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The workloadNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, WorkloadNetworkName workloadNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentResource.cs index 82492290158ff..720121edcc2e3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkSegmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The segmentId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineResource.cs index a942df4291a9e..cb17e8dea75ce 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkVirtualMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The virtualMachineId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}"; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.cs index f1b403d058511..f652d458ed7eb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVmGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Avs public partial class WorkloadNetworkVmGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateCloudName. + /// The vmGroupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"; diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/api/Azure.ResourceManager.Hci.netstandard2.0.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/api/Azure.ResourceManager.Hci.netstandard2.0.cs index 75bd75cc1e5a4..f9db59bb364b2 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/api/Azure.ResourceManager.Hci.netstandard2.0.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/api/Azure.ResourceManager.Hci.netstandard2.0.cs @@ -118,7 +118,7 @@ protected HciClusterCollection() { } } public partial class HciClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public HciClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HciClusterData(Azure.Core.AzureLocation location) { } public System.Guid? AadApplicationObjectId { get { throw null; } set { } } public System.Guid? AadClientId { get { throw null; } set { } } public System.Guid? AadServicePrincipalObjectId { get { throw null; } set { } } @@ -444,6 +444,35 @@ protected UpdateSummaryResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Hci.Mocking +{ + public partial class MockableHciArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHciArmClient() { } + public virtual Azure.ResourceManager.Hci.ArcExtensionResource GetArcExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Hci.ArcSettingResource GetArcSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Hci.HciClusterResource GetHciClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Hci.HciSkuResource GetHciSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Hci.OfferResource GetOfferResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Hci.PublisherResource GetPublisherResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Hci.UpdateResource GetUpdateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Hci.UpdateRunResource GetUpdateRunResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Hci.UpdateSummaryResource GetUpdateSummaryResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHciResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHciResourceGroupResource() { } + public virtual Azure.Response GetHciCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHciClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Hci.HciClusterCollection GetHciClusters() { throw null; } + } + public partial class MockableHciSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHciSubscriptionResource() { } + public virtual Azure.Pageable GetHciClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHciClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Hci.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionResource.cs index ba5dc73931921..b5107a18031a2 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcExtensionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Hci public partial class ArcExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The arcSettingName. + /// The extensionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string arcSettingName, string extensionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"; diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingResource.cs index 32ed6a53a2068..31e37f4c1a46d 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Hci public partial class ArcSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The arcSettingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string arcSettingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ArcExtensionResources and their operations over a ArcExtensionResource. public virtual ArcExtensionCollection GetArcExtensions() { - return GetCachedClient(Client => new ArcExtensionCollection(Client, Id)); + return GetCachedClient(client => new ArcExtensionCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual ArcExtensionCollection GetArcExtensions() /// /// The name of the machine extension. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetArcExtensionAsync(string extensionName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetArcExtensionAsync(s /// /// The name of the machine extension. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetArcExtension(string extensionName, CancellationToken cancellationToken = default) { diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/HciExtensions.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/HciExtensions.cs index 25e60f41d1d1d..a0f985d5e172c 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/HciExtensions.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/HciExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Hci.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Hci @@ -18,214 +19,177 @@ namespace Azure.ResourceManager.Hci /// A class to add extension methods to Azure.ResourceManager.Hci. public static partial class HciExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableHciArmClient GetMockableHciArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHciArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableHciResourceGroupResource GetMockableHciResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableHciResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableHciSubscriptionResource GetMockableHciSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableHciSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ArcSettingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ArcSettingResource GetArcSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ArcSettingResource.ValidateResourceId(id); - return new ArcSettingResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetArcSettingResource(id); } - #endregion - #region HciClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HciClusterResource GetHciClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HciClusterResource.ValidateResourceId(id); - return new HciClusterResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetHciClusterResource(id); } - #endregion - #region ArcExtensionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ArcExtensionResource GetArcExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ArcExtensionResource.ValidateResourceId(id); - return new ArcExtensionResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetArcExtensionResource(id); } - #endregion - #region OfferResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OfferResource GetOfferResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OfferResource.ValidateResourceId(id); - return new OfferResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetOfferResource(id); } - #endregion - #region PublisherResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PublisherResource GetPublisherResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PublisherResource.ValidateResourceId(id); - return new PublisherResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetPublisherResource(id); } - #endregion - #region HciSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HciSkuResource GetHciSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HciSkuResource.ValidateResourceId(id); - return new HciSkuResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetHciSkuResource(id); } - #endregion - #region UpdateRunResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static UpdateRunResource GetUpdateRunResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - UpdateRunResource.ValidateResourceId(id); - return new UpdateRunResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetUpdateRunResource(id); } - #endregion - #region UpdateSummaryResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static UpdateSummaryResource GetUpdateSummaryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - UpdateSummaryResource.ValidateResourceId(id); - return new UpdateSummaryResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetUpdateSummaryResource(id); } - #endregion - #region UpdateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static UpdateResource GetUpdateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - UpdateResource.ValidateResourceId(id); - return new UpdateResource(client, id); - } - ); + return GetMockableHciArmClient(client).GetUpdateResource(id); } - #endregion - /// Gets a collection of HciClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of HciClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HciClusterResources and their operations over a HciClusterResource. public static HciClusterCollection GetHciClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHciClusters(); + return GetMockableHciResourceGroupResource(resourceGroupResource).GetHciClusters(); } /// @@ -240,16 +204,20 @@ public static HciClusterCollection GetHciClusters(this ResourceGroupResource res /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHciClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHciClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableHciResourceGroupResource(resourceGroupResource).GetHciClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -264,16 +232,20 @@ public static async Task> GetHciClusterAsync(this R /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHciCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHciClusters().Get(clusterName, cancellationToken); + return GetMockableHciResourceGroupResource(resourceGroupResource).GetHciCluster(clusterName, cancellationToken); } /// @@ -288,13 +260,17 @@ public static Response GetHciCluster(this ResourceGroupResou /// Clusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHciClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHciClustersAsync(cancellationToken); + return GetMockableHciSubscriptionResource(subscriptionResource).GetHciClustersAsync(cancellationToken); } /// @@ -309,13 +285,17 @@ public static AsyncPageable GetHciClustersAsync(this Subscri /// Clusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHciClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHciClusters(cancellationToken); + return GetMockableHciSubscriptionResource(subscriptionResource).GetHciClusters(cancellationToken); } } } diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciArmClient.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciArmClient.cs new file mode 100644 index 0000000000000..532a4de0d1188 --- /dev/null +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciArmClient.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Hci; + +namespace Azure.ResourceManager.Hci.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHciArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHciArmClient() + { + } + + /// 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 MockableHciArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHciArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ArcSettingResource GetArcSettingResource(ResourceIdentifier id) + { + ArcSettingResource.ValidateResourceId(id); + return new ArcSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HciClusterResource GetHciClusterResource(ResourceIdentifier id) + { + HciClusterResource.ValidateResourceId(id); + return new HciClusterResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ArcExtensionResource GetArcExtensionResource(ResourceIdentifier id) + { + ArcExtensionResource.ValidateResourceId(id); + return new ArcExtensionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OfferResource GetOfferResource(ResourceIdentifier id) + { + OfferResource.ValidateResourceId(id); + return new OfferResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PublisherResource GetPublisherResource(ResourceIdentifier id) + { + PublisherResource.ValidateResourceId(id); + return new PublisherResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HciSkuResource GetHciSkuResource(ResourceIdentifier id) + { + HciSkuResource.ValidateResourceId(id); + return new HciSkuResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual UpdateRunResource GetUpdateRunResource(ResourceIdentifier id) + { + UpdateRunResource.ValidateResourceId(id); + return new UpdateRunResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual UpdateSummaryResource GetUpdateSummaryResource(ResourceIdentifier id) + { + UpdateSummaryResource.ValidateResourceId(id); + return new UpdateSummaryResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual UpdateResource GetUpdateResource(ResourceIdentifier id) + { + UpdateResource.ValidateResourceId(id); + return new UpdateResource(Client, id); + } + } +} diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciResourceGroupResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciResourceGroupResource.cs new file mode 100644 index 0000000000000..103e50f4fc6cc --- /dev/null +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Hci; + +namespace Azure.ResourceManager.Hci.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHciResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHciResourceGroupResource() + { + } + + /// 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 MockableHciResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of HciClusterResources in the ResourceGroupResource. + /// An object representing collection of HciClusterResources and their operations over a HciClusterResource. + public virtual HciClusterCollection GetHciClusters() + { + return GetCachedClient(client => new HciClusterCollection(client, Id)); + } + + /// + /// Get HCI cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHciClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetHciClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get HCI cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHciCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetHciClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciSubscriptionResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciSubscriptionResource.cs new file mode 100644 index 0000000000000..27b4e35f1a263 --- /dev/null +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/MockableHciSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Hci; + +namespace Azure.ResourceManager.Hci.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHciSubscriptionResource : ArmResource + { + private ClientDiagnostics _hciClusterClustersClientDiagnostics; + private ClustersRestOperations _hciClusterClustersRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHciSubscriptionResource() + { + } + + /// 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 MockableHciSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics HciClusterClustersClientDiagnostics => _hciClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Hci", HciClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations HciClusterClustersRestClient => _hciClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HciClusterResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all HCI clusters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters + /// + /// + /// Operation Id + /// Clusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHciClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HciClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HciClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), HciClusterClustersClientDiagnostics, Pipeline, "MockableHciSubscriptionResource.GetHciClusters", "value", "nextLink", cancellationToken); + } + + /// + /// List all HCI clusters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters + /// + /// + /// Operation Id + /// Clusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHciClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HciClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HciClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), HciClusterClustersClientDiagnostics, Pipeline, "MockableHciSubscriptionResource.GetHciClusters", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index a89e10777a6f2..0000000000000 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Hci -{ - /// 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 HciClusterResources in the ResourceGroupResource. - /// An object representing collection of HciClusterResources and their operations over a HciClusterResource. - public virtual HciClusterCollection GetHciClusters() - { - return GetCachedClient(Client => new HciClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 9b937d2dced46..0000000000000 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Hci -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _hciClusterClustersClientDiagnostics; - private ClustersRestOperations _hciClusterClustersRestClient; - - /// 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 HciClusterClustersClientDiagnostics => _hciClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Hci", HciClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations HciClusterClustersRestClient => _hciClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HciClusterResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all HCI clusters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters - /// - /// - /// Operation Id - /// Clusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHciClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HciClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HciClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), HciClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHciClusters", "value", "nextLink", cancellationToken); - } - - /// - /// List all HCI clusters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters - /// - /// - /// Operation Id - /// Clusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHciClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HciClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HciClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HciClusterResource(Client, HciClusterData.DeserializeHciClusterData(e)), HciClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHciClusters", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs index 209a217201a55..f2b753b688ff1 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Hci public partial class HciClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"; @@ -99,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ArcSettingResources and their operations over a ArcSettingResource. public virtual ArcSettingCollection GetArcSettings() { - return GetCachedClient(Client => new ArcSettingCollection(Client, Id)); + return GetCachedClient(client => new ArcSettingCollection(client, Id)); } /// @@ -117,8 +120,8 @@ public virtual ArcSettingCollection GetArcSettings() /// /// The name of the proxy resource holding details of HCI ArcSetting information. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetArcSettingAsync(string arcSettingName, CancellationToken cancellationToken = default) { @@ -140,8 +143,8 @@ public virtual async Task> GetArcSettingAsync(strin /// /// The name of the proxy resource holding details of HCI ArcSetting information. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetArcSetting(string arcSettingName, CancellationToken cancellationToken = default) { @@ -152,7 +155,7 @@ public virtual Response GetArcSetting(string arcSettingName, /// An object representing collection of PublisherResources and their operations over a PublisherResource. public virtual PublisherCollection GetPublishers() { - return GetCachedClient(Client => new PublisherCollection(Client, Id)); + return GetCachedClient(client => new PublisherCollection(client, Id)); } /// @@ -170,8 +173,8 @@ public virtual PublisherCollection GetPublishers() /// /// The name of the publisher available within HCI cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPublisherAsync(string publisherName, CancellationToken cancellationToken = default) { @@ -193,8 +196,8 @@ public virtual async Task> GetPublisherAsync(string /// /// The name of the publisher available within HCI cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPublisher(string publisherName, CancellationToken cancellationToken = default) { @@ -212,7 +215,7 @@ public virtual UpdateSummaryResource GetUpdateSummary() /// An object representing collection of UpdateResources and their operations over a UpdateResource. public virtual UpdateCollection GetUpdates() { - return GetCachedClient(Client => new UpdateCollection(Client, Id)); + return GetCachedClient(client => new UpdateCollection(client, Id)); } /// @@ -230,8 +233,8 @@ public virtual UpdateCollection GetUpdates() /// /// The name of the Update. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetUpdateAsync(string updateName, CancellationToken cancellationToken = default) { @@ -253,8 +256,8 @@ public virtual async Task> GetUpdateAsync(string update /// /// The name of the Update. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetUpdate(string updateName, CancellationToken cancellationToken = default) { diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuResource.cs index fe7b54bf0b9e3..3b5102365545c 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciSkuResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Hci public partial class HciSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The publisherName. + /// The offerName. + /// The skuName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string publisherName, string offerName, string skuName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}/skus/{skuName}"; diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferResource.cs index 5584fe0251bb7..657a31a52a1f0 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Hci public partial class OfferResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The publisherName. + /// The offerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string publisherName, string offerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}/offers/{offerName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HciSkuResources and their operations over a HciSkuResource. public virtual HciSkuCollection GetHciSkus() { - return GetCachedClient(Client => new HciSkuCollection(Client, Id)); + return GetCachedClient(client => new HciSkuCollection(client, Id)); } /// @@ -109,8 +114,8 @@ public virtual HciSkuCollection GetHciSkus() /// The name of the SKU available within HCI cluster. /// Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHciSkuAsync(string skuName, string expand = null, CancellationToken cancellationToken = default) { @@ -133,8 +138,8 @@ public virtual async Task> GetHciSkuAsync(string skuNam /// The name of the SKU available within HCI cluster. /// Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHciSku(string skuName, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherResource.cs index dfbe6758b34f9..bc86589877efc 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Hci public partial class PublisherResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The publisherName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string publisherName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/publishers/{publisherName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of OfferResources and their operations over a OfferResource. public virtual OfferCollection GetOffers() { - return GetCachedClient(Client => new OfferCollection(Client, Id)); + return GetCachedClient(client => new OfferCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual OfferCollection GetOffers() /// The name of the offer available within HCI cluster. /// Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOfferAsync(string offerName, string expand = null, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetOfferAsync(string offerNam /// The name of the offer available within HCI cluster. /// Specify $expand=content,contentVersion to populate additional fields related to the marketplace offer. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOffer(string offerName, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateResource.cs index fa00365e06fa7..9c45acf47a119 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Hci public partial class UpdateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The updateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string updateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of UpdateRunResources and their operations over a UpdateRunResource. public virtual UpdateRunCollection GetUpdateRuns() { - return GetCachedClient(Client => new UpdateRunCollection(Client, Id)); + return GetCachedClient(client => new UpdateRunCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual UpdateRunCollection GetUpdateRuns() /// /// The name of the Update Run. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetUpdateRunAsync(string updateRunName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetUpdateRunAsync(string /// /// The name of the Update Run. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetUpdateRun(string updateRunName, CancellationToken cancellationToken = default) { diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunResource.cs index 56aa9bafe3d30..fa2cc47efec18 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateRunResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Hci public partial class UpdateRunResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The updateName. + /// The updateRunName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string updateName, string updateRunName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updates/{updateName}/updateRuns/{updateRunName}"; diff --git a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateSummaryResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateSummaryResource.cs index 6bf63c8712c97..33e21616af891 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateSummaryResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateSummaryResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Hci public partial class UpdateSummaryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/updateSummaries/default"; diff --git a/sdk/batch/Azure.ResourceManager.Batch/api/Azure.ResourceManager.Batch.netstandard2.0.cs b/sdk/batch/Azure.ResourceManager.Batch/api/Azure.ResourceManager.Batch.netstandard2.0.cs index e21badacc5713..4f13137f5323f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/api/Azure.ResourceManager.Batch.netstandard2.0.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/api/Azure.ResourceManager.Batch.netstandard2.0.cs @@ -417,6 +417,42 @@ public BatchPrivateLinkResourceData() { } public System.Collections.Generic.IReadOnlyList RequiredZoneNames { get { throw null; } } } } +namespace Azure.ResourceManager.Batch.Mocking +{ + public partial class MockableBatchArmClient : Azure.ResourceManager.ArmResource + { + protected MockableBatchArmClient() { } + public virtual Azure.ResourceManager.Batch.BatchAccountCertificateResource GetBatchAccountCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Batch.BatchAccountDetectorResource GetBatchAccountDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Batch.BatchAccountPoolResource GetBatchAccountPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Batch.BatchAccountResource GetBatchAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Batch.BatchApplicationPackageResource GetBatchApplicationPackageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Batch.BatchApplicationResource GetBatchApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Batch.BatchPrivateEndpointConnectionResource GetBatchPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Batch.BatchPrivateLinkResource GetBatchPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableBatchResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableBatchResourceGroupResource() { } + public virtual Azure.Response GetBatchAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBatchAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Batch.BatchAccountCollection GetBatchAccounts() { throw null; } + } + public partial class MockableBatchSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableBatchSubscriptionResource() { } + public virtual Azure.Response CheckBatchNameAvailability(Azure.Core.AzureLocation locationName, Azure.ResourceManager.Batch.Models.BatchNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckBatchNameAvailabilityAsync(Azure.Core.AzureLocation locationName, Azure.ResourceManager.Batch.Models.BatchNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBatchAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBatchAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBatchQuotas(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBatchQuotasAsync(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBatchSupportedCloudServiceSkus(Azure.Core.AzureLocation locationName, int? maxresults = default(int?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBatchSupportedCloudServiceSkusAsync(Azure.Core.AzureLocation locationName, int? maxresults = default(int?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBatchSupportedVirtualMachineSkus(Azure.Core.AzureLocation locationName, int? maxresults = default(int?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBatchSupportedVirtualMachineSkusAsync(Azure.Core.AzureLocation locationName, int? maxresults = default(int?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Batch.Models { public static partial class ArmBatchModelFactory diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateResource.cs index 197457d00f45e..bac6d68adaffe 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountCertificateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Batch public partial class BatchAccountCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"; diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorResource.cs index 3e2d5164c640e..5ff86ee239066 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountDetectorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Batch public partial class BatchAccountDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The detectorId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string detectorId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}"; diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolResource.cs index 5f0ef4868e495..1fdc1eb0fcd1e 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountPoolResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Batch public partial class BatchAccountPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"; diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountResource.cs index e636a97d9a6e8..c85613cba5a2a 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Batch public partial class BatchAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BatchAccountDetectorResources and their operations over a BatchAccountDetectorResource. public virtual BatchAccountDetectorCollection GetBatchAccountDetectors() { - return GetCachedClient(Client => new BatchAccountDetectorCollection(Client, Id)); + return GetCachedClient(client => new BatchAccountDetectorCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual BatchAccountDetectorCollection GetBatchAccountDetectors() /// /// The name of the detector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBatchAccountDetectorAsync(string detectorId, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetBatchAccoun /// /// The name of the detector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBatchAccountDetector(string detectorId, CancellationToken cancellationToken = default) { @@ -147,7 +150,7 @@ public virtual Response GetBatchAccountDetector(st /// An object representing collection of BatchApplicationResources and their operations over a BatchApplicationResource. public virtual BatchApplicationCollection GetBatchApplications() { - return GetCachedClient(Client => new BatchApplicationCollection(Client, Id)); + return GetCachedClient(client => new BatchApplicationCollection(client, Id)); } /// @@ -165,8 +168,8 @@ public virtual BatchApplicationCollection GetBatchApplications() /// /// The name of the application. This must be unique within the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBatchApplicationAsync(string applicationName, CancellationToken cancellationToken = default) { @@ -188,8 +191,8 @@ public virtual async Task> GetBatchApplicatio /// /// The name of the application. This must be unique within the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBatchApplication(string applicationName, CancellationToken cancellationToken = default) { @@ -200,7 +203,7 @@ public virtual Response GetBatchApplication(string app /// An object representing collection of BatchAccountCertificateResources and their operations over a BatchAccountCertificateResource. public virtual BatchAccountCertificateCollection GetBatchAccountCertificates() { - return GetCachedClient(Client => new BatchAccountCertificateCollection(Client, Id)); + return GetCachedClient(client => new BatchAccountCertificateCollection(client, Id)); } /// @@ -218,8 +221,8 @@ public virtual BatchAccountCertificateCollection GetBatchAccountCertificates() /// /// The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBatchAccountCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -241,8 +244,8 @@ public virtual async Task> GetBatchAcc /// /// The identifier for the certificate. This must be made up of algorithm and thumbprint separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBatchAccountCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -253,7 +256,7 @@ public virtual Response GetBatchAccountCertific /// An object representing collection of BatchPrivateLinkResources and their operations over a BatchPrivateLinkResource. public virtual BatchPrivateLinkResourceCollection GetBatchPrivateLinkResources() { - return GetCachedClient(Client => new BatchPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new BatchPrivateLinkResourceCollection(client, Id)); } /// @@ -271,8 +274,8 @@ public virtual BatchPrivateLinkResourceCollection GetBatchPrivateLinkResources() /// /// The private link resource name. This must be unique within the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBatchPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -294,8 +297,8 @@ public virtual async Task> GetBatchPrivateLin /// /// The private link resource name. This must be unique within the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBatchPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -306,7 +309,7 @@ public virtual Response GetBatchPrivateLinkResource(st /// An object representing collection of BatchPrivateEndpointConnectionResources and their operations over a BatchPrivateEndpointConnectionResource. public virtual BatchPrivateEndpointConnectionCollection GetBatchPrivateEndpointConnections() { - return GetCachedClient(Client => new BatchPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new BatchPrivateEndpointConnectionCollection(client, Id)); } /// @@ -324,8 +327,8 @@ public virtual BatchPrivateEndpointConnectionCollection GetBatchPrivateEndpointC /// /// The private endpoint connection name. This must be unique within the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBatchPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -347,8 +350,8 @@ public virtual async Task> GetB /// /// The private endpoint connection name. This must be unique within the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBatchPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -359,7 +362,7 @@ public virtual Response GetBatchPrivateE /// An object representing collection of BatchAccountPoolResources and their operations over a BatchAccountPoolResource. public virtual BatchAccountPoolCollection GetBatchAccountPools() { - return GetCachedClient(Client => new BatchAccountPoolCollection(Client, Id)); + return GetCachedClient(client => new BatchAccountPoolCollection(client, Id)); } /// @@ -377,8 +380,8 @@ public virtual BatchAccountPoolCollection GetBatchAccountPools() /// /// The pool name. This must be unique within the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBatchAccountPoolAsync(string poolName, CancellationToken cancellationToken = default) { @@ -400,8 +403,8 @@ public virtual async Task> GetBatchAccountPoo /// /// The pool name. This must be unique within the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBatchAccountPool(string poolName, CancellationToken cancellationToken = default) { diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageResource.cs index 7095f0b9e61eb..0f199114c490f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationPackageResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Batch public partial class BatchApplicationPackageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The applicationName. + /// The versionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string applicationName, string versionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"; diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationResource.cs index 76bd53762a23b..7faf2d66d8f9d 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Batch public partial class BatchApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The applicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string applicationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BatchApplicationPackageResources and their operations over a BatchApplicationPackageResource. public virtual BatchApplicationPackageCollection GetBatchApplicationPackages() { - return GetCachedClient(Client => new BatchApplicationPackageCollection(Client, Id)); + return GetCachedClient(client => new BatchApplicationPackageCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual BatchApplicationPackageCollection GetBatchApplicationPackages() /// /// The version of the application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBatchApplicationPackageAsync(string versionName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetBatchApp /// /// The version of the application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBatchApplicationPackage(string versionName, CancellationToken cancellationToken = default) { diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionResource.cs index 54458feaf0d68..458134a2cfe10 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Batch public partial class BatchPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResource.cs index 8a9306e005389..908cc22a9260c 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Batch public partial class BatchPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/BatchExtensions.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/BatchExtensions.cs index 964d5f613f4bc..cbda3688e8f7c 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/BatchExtensions.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/BatchExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Batch.Mocking; using Azure.ResourceManager.Batch.Models; using Azure.ResourceManager.Resources; @@ -19,195 +20,161 @@ namespace Azure.ResourceManager.Batch /// A class to add extension methods to Azure.ResourceManager.Batch. public static partial class BatchExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableBatchArmClient GetMockableBatchArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableBatchArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableBatchResourceGroupResource GetMockableBatchResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableBatchResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableBatchSubscriptionResource GetMockableBatchSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableBatchSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region BatchAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BatchAccountResource GetBatchAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BatchAccountResource.ValidateResourceId(id); - return new BatchAccountResource(client, id); - } - ); + return GetMockableBatchArmClient(client).GetBatchAccountResource(id); } - #endregion - #region BatchAccountDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BatchAccountDetectorResource GetBatchAccountDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BatchAccountDetectorResource.ValidateResourceId(id); - return new BatchAccountDetectorResource(client, id); - } - ); + return GetMockableBatchArmClient(client).GetBatchAccountDetectorResource(id); } - #endregion - #region BatchApplicationPackageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BatchApplicationPackageResource GetBatchApplicationPackageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BatchApplicationPackageResource.ValidateResourceId(id); - return new BatchApplicationPackageResource(client, id); - } - ); + return GetMockableBatchArmClient(client).GetBatchApplicationPackageResource(id); } - #endregion - #region BatchApplicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BatchApplicationResource GetBatchApplicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BatchApplicationResource.ValidateResourceId(id); - return new BatchApplicationResource(client, id); - } - ); + return GetMockableBatchArmClient(client).GetBatchApplicationResource(id); } - #endregion - #region BatchAccountCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BatchAccountCertificateResource GetBatchAccountCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BatchAccountCertificateResource.ValidateResourceId(id); - return new BatchAccountCertificateResource(client, id); - } - ); + return GetMockableBatchArmClient(client).GetBatchAccountCertificateResource(id); } - #endregion - #region BatchPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BatchPrivateLinkResource GetBatchPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BatchPrivateLinkResource.ValidateResourceId(id); - return new BatchPrivateLinkResource(client, id); - } - ); + return GetMockableBatchArmClient(client).GetBatchPrivateLinkResource(id); } - #endregion - #region BatchPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BatchPrivateEndpointConnectionResource GetBatchPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BatchPrivateEndpointConnectionResource.ValidateResourceId(id); - return new BatchPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableBatchArmClient(client).GetBatchPrivateEndpointConnectionResource(id); } - #endregion - #region BatchAccountPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BatchAccountPoolResource GetBatchAccountPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BatchAccountPoolResource.ValidateResourceId(id); - return new BatchAccountPoolResource(client, id); - } - ); + return GetMockableBatchArmClient(client).GetBatchAccountPoolResource(id); } - #endregion - /// Gets a collection of BatchAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of BatchAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BatchAccountResources and their operations over a BatchAccountResource. public static BatchAccountCollection GetBatchAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBatchAccounts(); + return GetMockableBatchResourceGroupResource(resourceGroupResource).GetBatchAccounts(); } /// @@ -222,16 +189,20 @@ public static BatchAccountCollection GetBatchAccounts(this ResourceGroupResource /// BatchAccount_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Batch account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBatchAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBatchAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableBatchResourceGroupResource(resourceGroupResource).GetBatchAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -246,16 +217,20 @@ public static async Task> GetBatchAccountAsync(th /// BatchAccount_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Batch account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBatchAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBatchAccounts().Get(accountName, cancellationToken); + return GetMockableBatchResourceGroupResource(resourceGroupResource).GetBatchAccount(accountName, cancellationToken); } /// @@ -270,13 +245,17 @@ public static Response GetBatchAccount(this ResourceGroupR /// BatchAccount_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBatchAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBatchAccountsAsync(cancellationToken); + return GetMockableBatchSubscriptionResource(subscriptionResource).GetBatchAccountsAsync(cancellationToken); } /// @@ -291,13 +270,17 @@ public static AsyncPageable GetBatchAccountsAsync(this Sub /// BatchAccount_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBatchAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBatchAccounts(cancellationToken); + return GetMockableBatchSubscriptionResource(subscriptionResource).GetBatchAccounts(cancellationToken); } /// @@ -312,13 +295,17 @@ public static Pageable GetBatchAccounts(this SubscriptionR /// Location_GetQuotas /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region for which to retrieve Batch service quotas. /// The cancellation token to use. public static async Task> GetBatchQuotasAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetBatchQuotasAsync(locationName, cancellationToken).ConfigureAwait(false); + return await GetMockableBatchSubscriptionResource(subscriptionResource).GetBatchQuotasAsync(locationName, cancellationToken).ConfigureAwait(false); } /// @@ -333,13 +320,17 @@ public static async Task> GetBatchQuotasAsync(this /// Location_GetQuotas /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region for which to retrieve Batch service quotas. /// The cancellation token to use. public static Response GetBatchQuotas(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBatchQuotas(locationName, cancellationToken); + return GetMockableBatchSubscriptionResource(subscriptionResource).GetBatchQuotas(locationName, cancellationToken); } /// @@ -354,6 +345,10 @@ public static Response GetBatchQuotas(this SubscriptionResou /// Location_ListSupportedVirtualMachineSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region for which to retrieve Batch service supported SKUs. @@ -363,7 +358,7 @@ public static Response GetBatchQuotas(this SubscriptionResou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBatchSupportedVirtualMachineSkusAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBatchSupportedVirtualMachineSkusAsync(locationName, maxresults, filter, cancellationToken); + return GetMockableBatchSubscriptionResource(subscriptionResource).GetBatchSupportedVirtualMachineSkusAsync(locationName, maxresults, filter, cancellationToken); } /// @@ -378,6 +373,10 @@ public static AsyncPageable GetBatchSupportedVirtualMachineSk /// Location_ListSupportedVirtualMachineSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region for which to retrieve Batch service supported SKUs. @@ -387,7 +386,7 @@ public static AsyncPageable GetBatchSupportedVirtualMachineSk /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBatchSupportedVirtualMachineSkus(this SubscriptionResource subscriptionResource, AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBatchSupportedVirtualMachineSkus(locationName, maxresults, filter, cancellationToken); + return GetMockableBatchSubscriptionResource(subscriptionResource).GetBatchSupportedVirtualMachineSkus(locationName, maxresults, filter, cancellationToken); } /// @@ -402,6 +401,10 @@ public static Pageable GetBatchSupportedVirtualMachineSkus(th /// Location_ListSupportedCloudServiceSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region for which to retrieve Batch service supported SKUs. @@ -411,7 +414,7 @@ public static Pageable GetBatchSupportedVirtualMachineSkus(th /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBatchSupportedCloudServiceSkusAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBatchSupportedCloudServiceSkusAsync(locationName, maxresults, filter, cancellationToken); + return GetMockableBatchSubscriptionResource(subscriptionResource).GetBatchSupportedCloudServiceSkusAsync(locationName, maxresults, filter, cancellationToken); } /// @@ -426,6 +429,10 @@ public static AsyncPageable GetBatchSupportedCloudServiceSkus /// Location_ListSupportedCloudServiceSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region for which to retrieve Batch service supported SKUs. @@ -435,7 +442,7 @@ public static AsyncPageable GetBatchSupportedCloudServiceSkus /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBatchSupportedCloudServiceSkus(this SubscriptionResource subscriptionResource, AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBatchSupportedCloudServiceSkus(locationName, maxresults, filter, cancellationToken); + return GetMockableBatchSubscriptionResource(subscriptionResource).GetBatchSupportedCloudServiceSkus(locationName, maxresults, filter, cancellationToken); } /// @@ -450,6 +457,10 @@ public static Pageable GetBatchSupportedCloudServiceSkus(this /// Location_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The desired region for the name check. @@ -458,9 +469,7 @@ public static Pageable GetBatchSupportedCloudServiceSkus(this /// is null. public static async Task> CheckBatchNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, BatchNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckBatchNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); + return await GetMockableBatchSubscriptionResource(subscriptionResource).CheckBatchNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); } /// @@ -475,6 +484,10 @@ public static async Task> CheckBatchNameAv /// Location_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The desired region for the name check. @@ -483,9 +496,7 @@ public static async Task> CheckBatchNameAv /// is null. public static Response CheckBatchNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation locationName, BatchNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckBatchNameAvailability(locationName, content, cancellationToken); + return GetMockableBatchSubscriptionResource(subscriptionResource).CheckBatchNameAvailability(locationName, content, cancellationToken); } } } diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchArmClient.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchArmClient.cs new file mode 100644 index 0000000000000..ccb28ef1a5ae2 --- /dev/null +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchArmClient.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Batch; + +namespace Azure.ResourceManager.Batch.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableBatchArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableBatchArmClient() + { + } + + /// 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 MockableBatchArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableBatchArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BatchAccountResource GetBatchAccountResource(ResourceIdentifier id) + { + BatchAccountResource.ValidateResourceId(id); + return new BatchAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BatchAccountDetectorResource GetBatchAccountDetectorResource(ResourceIdentifier id) + { + BatchAccountDetectorResource.ValidateResourceId(id); + return new BatchAccountDetectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BatchApplicationPackageResource GetBatchApplicationPackageResource(ResourceIdentifier id) + { + BatchApplicationPackageResource.ValidateResourceId(id); + return new BatchApplicationPackageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BatchApplicationResource GetBatchApplicationResource(ResourceIdentifier id) + { + BatchApplicationResource.ValidateResourceId(id); + return new BatchApplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BatchAccountCertificateResource GetBatchAccountCertificateResource(ResourceIdentifier id) + { + BatchAccountCertificateResource.ValidateResourceId(id); + return new BatchAccountCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BatchPrivateLinkResource GetBatchPrivateLinkResource(ResourceIdentifier id) + { + BatchPrivateLinkResource.ValidateResourceId(id); + return new BatchPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BatchPrivateEndpointConnectionResource GetBatchPrivateEndpointConnectionResource(ResourceIdentifier id) + { + BatchPrivateEndpointConnectionResource.ValidateResourceId(id); + return new BatchPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BatchAccountPoolResource GetBatchAccountPoolResource(ResourceIdentifier id) + { + BatchAccountPoolResource.ValidateResourceId(id); + return new BatchAccountPoolResource(Client, id); + } + } +} diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchResourceGroupResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchResourceGroupResource.cs new file mode 100644 index 0000000000000..00311c9e23f20 --- /dev/null +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Batch; + +namespace Azure.ResourceManager.Batch.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableBatchResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableBatchResourceGroupResource() + { + } + + /// 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 MockableBatchResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of BatchAccountResources in the ResourceGroupResource. + /// An object representing collection of BatchAccountResources and their operations over a BatchAccountResource. + public virtual BatchAccountCollection GetBatchAccounts() + { + return GetCachedClient(client => new BatchAccountCollection(client, Id)); + } + + /// + /// Gets information about the specified Batch account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName} + /// + /// + /// Operation Id + /// BatchAccount_Get + /// + /// + /// + /// The name of the Batch account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBatchAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetBatchAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified Batch account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName} + /// + /// + /// Operation Id + /// BatchAccount_Get + /// + /// + /// + /// The name of the Batch account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBatchAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetBatchAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchSubscriptionResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchSubscriptionResource.cs new file mode 100644 index 0000000000000..4fa529810c7ba --- /dev/null +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/MockableBatchSubscriptionResource.cs @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Batch; +using Azure.ResourceManager.Batch.Models; + +namespace Azure.ResourceManager.Batch.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableBatchSubscriptionResource : ArmResource + { + private ClientDiagnostics _batchAccountClientDiagnostics; + private BatchAccountRestOperations _batchAccountRestClient; + private ClientDiagnostics _locationClientDiagnostics; + private LocationRestOperations _locationRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableBatchSubscriptionResource() + { + } + + /// 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 MockableBatchSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics BatchAccountClientDiagnostics => _batchAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Batch", BatchAccountResource.ResourceType.Namespace, Diagnostics); + private BatchAccountRestOperations BatchAccountRestClient => _batchAccountRestClient ??= new BatchAccountRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BatchAccountResource.ResourceType)); + private ClientDiagnostics LocationClientDiagnostics => _locationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Batch", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationRestOperations LocationRestClient => _locationRestClient ??= new LocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts + /// + /// + /// Operation Id + /// BatchAccount_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBatchAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BatchAccountRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BatchAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), BatchAccountClientDiagnostics, Pipeline, "MockableBatchSubscriptionResource.GetBatchAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts + /// + /// + /// Operation Id + /// BatchAccount_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBatchAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BatchAccountRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BatchAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), BatchAccountClientDiagnostics, Pipeline, "MockableBatchSubscriptionResource.GetBatchAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the Batch service quotas for the specified subscription at the given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas + /// + /// + /// Operation Id + /// Location_GetQuotas + /// + /// + /// + /// The region for which to retrieve Batch service quotas. + /// The cancellation token to use. + public virtual async Task> GetBatchQuotasAsync(AzureLocation locationName, CancellationToken cancellationToken = default) + { + using var scope = LocationClientDiagnostics.CreateScope("MockableBatchSubscriptionResource.GetBatchQuotas"); + scope.Start(); + try + { + var response = await LocationRestClient.GetQuotasAsync(Id.SubscriptionId, locationName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the Batch service quotas for the specified subscription at the given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas + /// + /// + /// Operation Id + /// Location_GetQuotas + /// + /// + /// + /// The region for which to retrieve Batch service quotas. + /// The cancellation token to use. + public virtual Response GetBatchQuotas(AzureLocation locationName, CancellationToken cancellationToken = default) + { + using var scope = LocationClientDiagnostics.CreateScope("MockableBatchSubscriptionResource.GetBatchQuotas"); + scope.Start(); + try + { + var response = LocationRestClient.GetQuotas(Id.SubscriptionId, locationName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus + /// + /// + /// Operation Id + /// Location_ListSupportedVirtualMachineSkus + /// + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// The maximum number of items to return in the response. + /// OData filter expression. Valid properties for filtering are "familyName". + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBatchSupportedVirtualMachineSkusAsync(AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListSupportedVirtualMachineSkusRequest(Id.SubscriptionId, locationName, maxresults, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListSupportedVirtualMachineSkusNextPageRequest(nextLink, Id.SubscriptionId, locationName, maxresults, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BatchSupportedSku.DeserializeBatchSupportedSku, LocationClientDiagnostics, Pipeline, "MockableBatchSubscriptionResource.GetBatchSupportedVirtualMachineSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus + /// + /// + /// Operation Id + /// Location_ListSupportedVirtualMachineSkus + /// + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// The maximum number of items to return in the response. + /// OData filter expression. Valid properties for filtering are "familyName". + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBatchSupportedVirtualMachineSkus(AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListSupportedVirtualMachineSkusRequest(Id.SubscriptionId, locationName, maxresults, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListSupportedVirtualMachineSkusNextPageRequest(nextLink, Id.SubscriptionId, locationName, maxresults, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BatchSupportedSku.DeserializeBatchSupportedSku, LocationClientDiagnostics, Pipeline, "MockableBatchSubscriptionResource.GetBatchSupportedVirtualMachineSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus + /// + /// + /// Operation Id + /// Location_ListSupportedCloudServiceSkus + /// + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// The maximum number of items to return in the response. + /// OData filter expression. Valid properties for filtering are "familyName". + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBatchSupportedCloudServiceSkusAsync(AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListSupportedCloudServiceSkusRequest(Id.SubscriptionId, locationName, maxresults, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListSupportedCloudServiceSkusNextPageRequest(nextLink, Id.SubscriptionId, locationName, maxresults, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BatchSupportedSku.DeserializeBatchSupportedSku, LocationClientDiagnostics, Pipeline, "MockableBatchSubscriptionResource.GetBatchSupportedCloudServiceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus + /// + /// + /// Operation Id + /// Location_ListSupportedCloudServiceSkus + /// + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// The maximum number of items to return in the response. + /// OData filter expression. Valid properties for filtering are "familyName". + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBatchSupportedCloudServiceSkus(AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListSupportedCloudServiceSkusRequest(Id.SubscriptionId, locationName, maxresults, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListSupportedCloudServiceSkusNextPageRequest(nextLink, Id.SubscriptionId, locationName, maxresults, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BatchSupportedSku.DeserializeBatchSupportedSku, LocationClientDiagnostics, Pipeline, "MockableBatchSubscriptionResource.GetBatchSupportedCloudServiceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether the Batch account name is available in the specified region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// Location_CheckNameAvailability + /// + /// + /// + /// The desired region for the name check. + /// Properties needed to check the availability of a name. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckBatchNameAvailabilityAsync(AzureLocation locationName, BatchNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationClientDiagnostics.CreateScope("MockableBatchSubscriptionResource.CheckBatchNameAvailability"); + scope.Start(); + try + { + var response = await LocationRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the Batch account name is available in the specified region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// Location_CheckNameAvailability + /// + /// + /// + /// The desired region for the name check. + /// Properties needed to check the availability of a name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckBatchNameAvailability(AzureLocation locationName, BatchNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationClientDiagnostics.CreateScope("MockableBatchSubscriptionResource.CheckBatchNameAvailability"); + scope.Start(); + try + { + var response = LocationRestClient.CheckNameAvailability(Id.SubscriptionId, locationName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 95dbff85384c6..0000000000000 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Batch -{ - /// 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 BatchAccountResources in the ResourceGroupResource. - /// An object representing collection of BatchAccountResources and their operations over a BatchAccountResource. - public virtual BatchAccountCollection GetBatchAccounts() - { - return GetCachedClient(Client => new BatchAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 90cea14bd93e4..0000000000000 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,321 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Batch.Models; - -namespace Azure.ResourceManager.Batch -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _batchAccountClientDiagnostics; - private BatchAccountRestOperations _batchAccountRestClient; - private ClientDiagnostics _locationClientDiagnostics; - private LocationRestOperations _locationRestClient; - - /// 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 BatchAccountClientDiagnostics => _batchAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Batch", BatchAccountResource.ResourceType.Namespace, Diagnostics); - private BatchAccountRestOperations BatchAccountRestClient => _batchAccountRestClient ??= new BatchAccountRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BatchAccountResource.ResourceType)); - private ClientDiagnostics LocationClientDiagnostics => _locationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Batch", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationRestOperations LocationRestClient => _locationRestClient ??= new LocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets information about the Batch accounts associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts - /// - /// - /// Operation Id - /// BatchAccount_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBatchAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BatchAccountRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BatchAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), BatchAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets information about the Batch accounts associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts - /// - /// - /// Operation Id - /// BatchAccount_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBatchAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BatchAccountRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BatchAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BatchAccountResource(Client, BatchAccountData.DeserializeBatchAccountData(e)), BatchAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the Batch service quotas for the specified subscription at the given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas - /// - /// - /// Operation Id - /// Location_GetQuotas - /// - /// - /// - /// The region for which to retrieve Batch service quotas. - /// The cancellation token to use. - public virtual async Task> GetBatchQuotasAsync(AzureLocation locationName, CancellationToken cancellationToken = default) - { - using var scope = LocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetBatchQuotas"); - scope.Start(); - try - { - var response = await LocationRestClient.GetQuotasAsync(Id.SubscriptionId, locationName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the Batch service quotas for the specified subscription at the given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas - /// - /// - /// Operation Id - /// Location_GetQuotas - /// - /// - /// - /// The region for which to retrieve Batch service quotas. - /// The cancellation token to use. - public virtual Response GetBatchQuotas(AzureLocation locationName, CancellationToken cancellationToken = default) - { - using var scope = LocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetBatchQuotas"); - scope.Start(); - try - { - var response = LocationRestClient.GetQuotas(Id.SubscriptionId, locationName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the list of Batch supported Virtual Machine VM sizes available at the given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus - /// - /// - /// Operation Id - /// Location_ListSupportedVirtualMachineSkus - /// - /// - /// - /// The region for which to retrieve Batch service supported SKUs. - /// The maximum number of items to return in the response. - /// OData filter expression. Valid properties for filtering are "familyName". - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBatchSupportedVirtualMachineSkusAsync(AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListSupportedVirtualMachineSkusRequest(Id.SubscriptionId, locationName, maxresults, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListSupportedVirtualMachineSkusNextPageRequest(nextLink, Id.SubscriptionId, locationName, maxresults, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BatchSupportedSku.DeserializeBatchSupportedSku, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchSupportedVirtualMachineSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Batch supported Virtual Machine VM sizes available at the given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus - /// - /// - /// Operation Id - /// Location_ListSupportedVirtualMachineSkus - /// - /// - /// - /// The region for which to retrieve Batch service supported SKUs. - /// The maximum number of items to return in the response. - /// OData filter expression. Valid properties for filtering are "familyName". - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBatchSupportedVirtualMachineSkus(AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListSupportedVirtualMachineSkusRequest(Id.SubscriptionId, locationName, maxresults, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListSupportedVirtualMachineSkusNextPageRequest(nextLink, Id.SubscriptionId, locationName, maxresults, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BatchSupportedSku.DeserializeBatchSupportedSku, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchSupportedVirtualMachineSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Batch supported Cloud Service VM sizes available at the given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus - /// - /// - /// Operation Id - /// Location_ListSupportedCloudServiceSkus - /// - /// - /// - /// The region for which to retrieve Batch service supported SKUs. - /// The maximum number of items to return in the response. - /// OData filter expression. Valid properties for filtering are "familyName". - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBatchSupportedCloudServiceSkusAsync(AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListSupportedCloudServiceSkusRequest(Id.SubscriptionId, locationName, maxresults, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListSupportedCloudServiceSkusNextPageRequest(nextLink, Id.SubscriptionId, locationName, maxresults, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BatchSupportedSku.DeserializeBatchSupportedSku, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchSupportedCloudServiceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Batch supported Cloud Service VM sizes available at the given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus - /// - /// - /// Operation Id - /// Location_ListSupportedCloudServiceSkus - /// - /// - /// - /// The region for which to retrieve Batch service supported SKUs. - /// The maximum number of items to return in the response. - /// OData filter expression. Valid properties for filtering are "familyName". - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBatchSupportedCloudServiceSkus(AzureLocation locationName, int? maxresults = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListSupportedCloudServiceSkusRequest(Id.SubscriptionId, locationName, maxresults, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListSupportedCloudServiceSkusNextPageRequest(nextLink, Id.SubscriptionId, locationName, maxresults, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BatchSupportedSku.DeserializeBatchSupportedSku, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBatchSupportedCloudServiceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Checks whether the Batch account name is available in the specified region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// Location_CheckNameAvailability - /// - /// - /// - /// The desired region for the name check. - /// Properties needed to check the availability of a name. - /// The cancellation token to use. - public virtual async Task> CheckBatchNameAvailabilityAsync(AzureLocation locationName, BatchNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckBatchNameAvailability"); - scope.Start(); - try - { - var response = await LocationRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether the Batch account name is available in the specified region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// Location_CheckNameAvailability - /// - /// - /// - /// The desired region for the name check. - /// Properties needed to check the availability of a name. - /// The cancellation token to use. - public virtual Response CheckBatchNameAvailability(AzureLocation locationName, BatchNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckBatchNameAvailability"); - scope.Start(); - try - { - var response = LocationRestClient.CheckNameAvailability(Id.SubscriptionId, locationName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/billing/Azure.ResourceManager.Billing/Azure.ResourceManager.Billing.sln b/sdk/billing/Azure.ResourceManager.Billing/Azure.ResourceManager.Billing.sln index f66e5f140697d..2a372ea5d6a28 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/Azure.ResourceManager.Billing.sln +++ b/sdk/billing/Azure.ResourceManager.Billing/Azure.ResourceManager.Billing.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FD77ECA1-142F-41A2-AD10-463CD3B6A518}") = "Azure.ResourceManager.Billing", "src\Azure.ResourceManager.Billing.csproj", "{D1952E96-7C55-4DF2-BD8F-6638F1EE0FA2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Billing", "src\Azure.ResourceManager.Billing.csproj", "{D1952E96-7C55-4DF2-BD8F-6638F1EE0FA2}" EndProject -Project("{FD77ECA1-142F-41A2-AD10-463CD3B6A518}") = "Azure.ResourceManager.Billing.Tests", "tests\Azure.ResourceManager.Billing.Tests.csproj", "{CFACB7E4-012B-489F-A164-BA56803B8333}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Billing.Tests", "tests\Azure.ResourceManager.Billing.Tests.csproj", "{CFACB7E4-012B-489F-A164-BA56803B8333}" EndProject -Project("{FD77ECA1-142F-41A2-AD10-463CD3B6A518}") = "Azure.ResourceManager.Billing.Samples", "samples\Azure.ResourceManager.Billing.Samples.csproj", "{4B75865B-4288-4894-BC38-657A199AC03E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Billing.Samples", "samples\Azure.ResourceManager.Billing.Samples.csproj", "{4B75865B-4288-4894-BC38-657A199AC03E}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A9107B8F-EB93-4A99-8901-FBBEF549D749} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {CFACB7E4-012B-489F-A164-BA56803B8333}.Release|x64.Build.0 = Release|Any CPU {CFACB7E4-012B-489F-A164-BA56803B8333}.Release|x86.ActiveCfg = Release|Any CPU {CFACB7E4-012B-489F-A164-BA56803B8333}.Release|x86.Build.0 = Release|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Debug|x64.ActiveCfg = Debug|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Debug|x64.Build.0 = Debug|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Debug|x86.ActiveCfg = Debug|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Debug|x86.Build.0 = Debug|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Release|Any CPU.Build.0 = Release|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Release|x64.ActiveCfg = Release|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Release|x64.Build.0 = Release|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Release|x86.ActiveCfg = Release|Any CPU + {4B75865B-4288-4894-BC38-657A199AC03E}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A9107B8F-EB93-4A99-8901-FBBEF549D749} EndGlobalSection EndGlobal diff --git a/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.netstandard2.0.cs b/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.netstandard2.0.cs index aa9ef286bd455..0a0ccde0c352d 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.netstandard2.0.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.netstandard2.0.cs @@ -269,6 +269,37 @@ protected BillingSubscriptionResource() { } public virtual System.Threading.Tasks.Task> ValidateMoveEligibilityAsync(Azure.ResourceManager.Billing.Models.BillingSubscriptionMoveContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Billing.Mocking +{ + public partial class MockableBillingArmClient : Azure.ResourceManager.ArmResource + { + protected MockableBillingArmClient() { } + public virtual Azure.ResourceManager.Billing.BillingAccountPaymentMethodResource GetBillingAccountPaymentMethodResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingPaymentMethodLinkResource GetBillingPaymentMethodLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingPaymentMethodResource GetBillingPaymentMethodResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingSubscriptionAliasResource GetBillingSubscriptionAliasResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingSubscriptionResource GetBillingSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableBillingTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableBillingTenantResource() { } + public virtual Azure.Response GetBillingAccountPaymentMethod(string billingAccountName, string paymentMethodName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingAccountPaymentMethodAsync(string billingAccountName, string paymentMethodName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingAccountPaymentMethodCollection GetBillingAccountPaymentMethods(string billingAccountName) { throw null; } + public virtual Azure.Response GetBillingPaymentMethod(string paymentMethodName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingPaymentMethodAsync(string paymentMethodName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBillingPaymentMethodLink(string billingAccountName, string billingProfileName, string paymentMethodName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingPaymentMethodLinkAsync(string billingAccountName, string billingProfileName, string paymentMethodName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingPaymentMethodLinkCollection GetBillingPaymentMethodLinks(string billingAccountName, string billingProfileName) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingPaymentMethodCollection GetBillingPaymentMethods() { throw null; } + public virtual Azure.Response GetBillingSubscription(string billingAccountName, string billingSubscriptionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBillingSubscriptionAlias(string billingAccountName, string aliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingSubscriptionAliasAsync(string billingAccountName, string aliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingSubscriptionAliasCollection GetBillingSubscriptionAliases(string billingAccountName) { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingSubscriptionAsync(string billingAccountName, string billingSubscriptionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Billing.BillingSubscriptionCollection GetBillingSubscriptions(string billingAccountName) { throw null; } + } +} namespace Azure.ResourceManager.Billing.Models { public static partial class ArmBillingModelFactory diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodResource.cs index 8510ece1c2a84..1abe9bf4bdfd9 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodResource.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingAccountPaymentMethodResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Billing public partial class BillingAccountPaymentMethodResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountName. + /// The paymentMethodName. public static ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string paymentMethodName) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods/{paymentMethodName}"; diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkResource.cs index 2e5aa012e466e..ad8e179c02ae2 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkResource.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodLinkResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Billing public partial class BillingPaymentMethodLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountName. + /// The billingProfileName. + /// The paymentMethodName. public static ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string billingProfileName, string paymentMethodName) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/{paymentMethodName}"; diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodResource.cs index 321093ed58b4c..e9d95c2c6fb7c 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodResource.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingPaymentMethodResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.Billing public partial class BillingPaymentMethodResource : ArmResource { /// Generate the resource identifier of a instance. + /// The paymentMethodName. public static ResourceIdentifier CreateResourceIdentifier(string paymentMethodName) { var resourceId = $"/providers/Microsoft.Billing/paymentMethods/{paymentMethodName}"; diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasResource.cs index 1d95ade8a2a29..326abe20a205f 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasResource.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Billing public partial class BillingSubscriptionAliasResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountName. + /// The aliasName. public static ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string aliasName) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName}"; diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionResource.cs index 24f5e3a94ce00..d58fbd3d6455d 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionResource.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.Billing public partial class BillingSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountName. + /// The billingSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string billingSubscriptionName) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}"; diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs index 3d964d62bf371..9ae5b1c5b877c 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Billing.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Billing @@ -18,127 +19,111 @@ namespace Azure.ResourceManager.Billing /// A class to add extension methods to Azure.ResourceManager.Billing. public static partial class BillingExtensions { - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableBillingArmClient GetMockableBillingArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableBillingArmClient(client0)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableBillingTenantResource GetMockableBillingTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableBillingTenantResource(client, resource.Id)); } - #region BillingSubscriptionResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingSubscriptionResource GetBillingSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingSubscriptionResource.ValidateResourceId(id); - return new BillingSubscriptionResource(client, id); - } - ); + return GetMockableBillingArmClient(client).GetBillingSubscriptionResource(id); } - #endregion - #region BillingSubscriptionAliasResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingSubscriptionAliasResource GetBillingSubscriptionAliasResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingSubscriptionAliasResource.ValidateResourceId(id); - return new BillingSubscriptionAliasResource(client, id); - } - ); + return GetMockableBillingArmClient(client).GetBillingSubscriptionAliasResource(id); } - #endregion - #region BillingPaymentMethodResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingPaymentMethodResource GetBillingPaymentMethodResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingPaymentMethodResource.ValidateResourceId(id); - return new BillingPaymentMethodResource(client, id); - } - ); + return GetMockableBillingArmClient(client).GetBillingPaymentMethodResource(id); } - #endregion - #region BillingAccountPaymentMethodResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingAccountPaymentMethodResource GetBillingAccountPaymentMethodResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingAccountPaymentMethodResource.ValidateResourceId(id); - return new BillingAccountPaymentMethodResource(client, id); - } - ); + return GetMockableBillingArmClient(client).GetBillingAccountPaymentMethodResource(id); } - #endregion - #region BillingPaymentMethodLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingPaymentMethodLinkResource GetBillingPaymentMethodLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingPaymentMethodLinkResource.ValidateResourceId(id); - return new BillingPaymentMethodLinkResource(client, id); - } - ); + return GetMockableBillingArmClient(client).GetBillingPaymentMethodLinkResource(id); } - #endregion - /// Gets a collection of BillingSubscriptionResources in the TenantResource. + /// + /// Gets a collection of BillingSubscriptionResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of BillingSubscriptionResources and their operations over a BillingSubscriptionResource. public static BillingSubscriptionCollection GetBillingSubscriptions(this TenantResource tenantResource, string billingAccountName) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - - return GetTenantResourceExtensionClient(tenantResource).GetBillingSubscriptions(billingAccountName); + return GetMockableBillingTenantResource(tenantResource).GetBillingSubscriptions(billingAccountName); } /// @@ -153,17 +138,21 @@ public static BillingSubscriptionCollection GetBillingSubscriptions(this TenantR /// BillingSubscriptions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a subscription. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingSubscriptionAsync(this TenantResource tenantResource, string billingAccountName, string billingSubscriptionName, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingSubscriptions(billingAccountName).GetAsync(billingSubscriptionName, cancellationToken).ConfigureAwait(false); + return await GetMockableBillingTenantResource(tenantResource).GetBillingSubscriptionAsync(billingAccountName, billingSubscriptionName, cancellationToken).ConfigureAwait(false); } /// @@ -178,30 +167,38 @@ public static async Task> GetBillingSubscr /// BillingSubscriptions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a subscription. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingSubscription(this TenantResource tenantResource, string billingAccountName, string billingSubscriptionName, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingSubscriptions(billingAccountName).Get(billingSubscriptionName, cancellationToken); + return GetMockableBillingTenantResource(tenantResource).GetBillingSubscription(billingAccountName, billingSubscriptionName, cancellationToken); } - /// Gets a collection of BillingSubscriptionAliasResources in the TenantResource. + /// + /// Gets a collection of BillingSubscriptionAliasResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of BillingSubscriptionAliasResources and their operations over a BillingSubscriptionAliasResource. public static BillingSubscriptionAliasCollection GetBillingSubscriptionAliases(this TenantResource tenantResource, string billingAccountName) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - - return GetTenantResourceExtensionClient(tenantResource).GetBillingSubscriptionAliases(billingAccountName); + return GetMockableBillingTenantResource(tenantResource).GetBillingSubscriptionAliases(billingAccountName); } /// @@ -216,17 +213,21 @@ public static BillingSubscriptionAliasCollection GetBillingSubscriptionAliases(t /// BillingSubscriptionsAliases_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a subscription alias. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingSubscriptionAliasAsync(this TenantResource tenantResource, string billingAccountName, string aliasName, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingSubscriptionAliases(billingAccountName).GetAsync(aliasName, cancellationToken).ConfigureAwait(false); + return await GetMockableBillingTenantResource(tenantResource).GetBillingSubscriptionAliasAsync(billingAccountName, aliasName, cancellationToken).ConfigureAwait(false); } /// @@ -241,25 +242,35 @@ public static async Task> GetBillingS /// BillingSubscriptionsAliases_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a subscription alias. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingSubscriptionAlias(this TenantResource tenantResource, string billingAccountName, string aliasName, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingSubscriptionAliases(billingAccountName).Get(aliasName, cancellationToken); + return GetMockableBillingTenantResource(tenantResource).GetBillingSubscriptionAlias(billingAccountName, aliasName, cancellationToken); } - /// Gets a collection of BillingPaymentMethodResources in the TenantResource. + /// + /// Gets a collection of BillingPaymentMethodResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BillingPaymentMethodResources and their operations over a BillingPaymentMethodResource. public static BillingPaymentMethodCollection GetBillingPaymentMethods(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetBillingPaymentMethods(); + return GetMockableBillingTenantResource(tenantResource).GetBillingPaymentMethods(); } /// @@ -274,16 +285,20 @@ public static BillingPaymentMethodCollection GetBillingPaymentMethods(this Tenan /// PaymentMethods_GetByUser /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a payment method. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingPaymentMethodAsync(this TenantResource tenantResource, string paymentMethodName, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingPaymentMethods().GetAsync(paymentMethodName, cancellationToken).ConfigureAwait(false); + return await GetMockableBillingTenantResource(tenantResource).GetBillingPaymentMethodAsync(paymentMethodName, cancellationToken).ConfigureAwait(false); } /// @@ -298,29 +313,37 @@ public static async Task> GetBillingPayme /// PaymentMethods_GetByUser /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a payment method. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingPaymentMethod(this TenantResource tenantResource, string paymentMethodName, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingPaymentMethods().Get(paymentMethodName, cancellationToken); + return GetMockableBillingTenantResource(tenantResource).GetBillingPaymentMethod(paymentMethodName, cancellationToken); } - /// Gets a collection of BillingAccountPaymentMethodResources in the TenantResource. + /// + /// Gets a collection of BillingAccountPaymentMethodResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of BillingAccountPaymentMethodResources and their operations over a BillingAccountPaymentMethodResource. public static BillingAccountPaymentMethodCollection GetBillingAccountPaymentMethods(this TenantResource tenantResource, string billingAccountName) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - - return GetTenantResourceExtensionClient(tenantResource).GetBillingAccountPaymentMethods(billingAccountName); + return GetMockableBillingTenantResource(tenantResource).GetBillingAccountPaymentMethods(billingAccountName); } /// @@ -335,17 +358,21 @@ public static BillingAccountPaymentMethodCollection GetBillingAccountPaymentMeth /// PaymentMethods_GetByBillingAccount /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a payment method. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingAccountPaymentMethodAsync(this TenantResource tenantResource, string billingAccountName, string paymentMethodName, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingAccountPaymentMethods(billingAccountName).GetAsync(paymentMethodName, cancellationToken).ConfigureAwait(false); + return await GetMockableBillingTenantResource(tenantResource).GetBillingAccountPaymentMethodAsync(billingAccountName, paymentMethodName, cancellationToken).ConfigureAwait(false); } /// @@ -360,32 +387,39 @@ public static async Task> GetBilli /// PaymentMethods_GetByBillingAccount /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a payment method. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingAccountPaymentMethod(this TenantResource tenantResource, string billingAccountName, string paymentMethodName, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingAccountPaymentMethods(billingAccountName).Get(paymentMethodName, cancellationToken); + return GetMockableBillingTenantResource(tenantResource).GetBillingAccountPaymentMethod(billingAccountName, paymentMethodName, cancellationToken); } - /// Gets a collection of BillingPaymentMethodLinkResources in the TenantResource. + /// + /// Gets a collection of BillingPaymentMethodLinkResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a billing profile. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. /// An object representing collection of BillingPaymentMethodLinkResources and their operations over a BillingPaymentMethodLinkResource. public static BillingPaymentMethodLinkCollection GetBillingPaymentMethodLinks(this TenantResource tenantResource, string billingAccountName, string billingProfileName) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - - return GetTenantResourceExtensionClient(tenantResource).GetBillingPaymentMethodLinks(billingAccountName, billingProfileName); + return GetMockableBillingTenantResource(tenantResource).GetBillingPaymentMethodLinks(billingAccountName, billingProfileName); } /// @@ -400,18 +434,22 @@ public static BillingPaymentMethodLinkCollection GetBillingPaymentMethodLinks(th /// PaymentMethods_GetByBillingProfile /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a billing profile. /// The ID that uniquely identifies a payment method. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingPaymentMethodLinkAsync(this TenantResource tenantResource, string billingAccountName, string billingProfileName, string paymentMethodName, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingPaymentMethodLinks(billingAccountName, billingProfileName).GetAsync(paymentMethodName, cancellationToken).ConfigureAwait(false); + return await GetMockableBillingTenantResource(tenantResource).GetBillingPaymentMethodLinkAsync(billingAccountName, billingProfileName, paymentMethodName, cancellationToken).ConfigureAwait(false); } /// @@ -426,18 +464,22 @@ public static async Task> GetBillingP /// PaymentMethods_GetByBillingProfile /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ID that uniquely identifies a billing account. /// The ID that uniquely identifies a billing profile. /// The ID that uniquely identifies a payment method. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingPaymentMethodLink(this TenantResource tenantResource, string billingAccountName, string billingProfileName, string paymentMethodName, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingPaymentMethodLinks(billingAccountName, billingProfileName).Get(paymentMethodName, cancellationToken); + return GetMockableBillingTenantResource(tenantResource).GetBillingPaymentMethodLink(billingAccountName, billingProfileName, paymentMethodName, cancellationToken); } } } diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingArmClient.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingArmClient.cs new file mode 100644 index 0000000000000..5a426c89d6263 --- /dev/null +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Billing; + +namespace Azure.ResourceManager.Billing.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableBillingArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableBillingArmClient() + { + } + + /// 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 MockableBillingArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableBillingArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingSubscriptionResource GetBillingSubscriptionResource(ResourceIdentifier id) + { + BillingSubscriptionResource.ValidateResourceId(id); + return new BillingSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingSubscriptionAliasResource GetBillingSubscriptionAliasResource(ResourceIdentifier id) + { + BillingSubscriptionAliasResource.ValidateResourceId(id); + return new BillingSubscriptionAliasResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingPaymentMethodResource GetBillingPaymentMethodResource(ResourceIdentifier id) + { + BillingPaymentMethodResource.ValidateResourceId(id); + return new BillingPaymentMethodResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingAccountPaymentMethodResource GetBillingAccountPaymentMethodResource(ResourceIdentifier id) + { + BillingAccountPaymentMethodResource.ValidateResourceId(id); + return new BillingAccountPaymentMethodResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingPaymentMethodLinkResource GetBillingPaymentMethodLinkResource(ResourceIdentifier id) + { + BillingPaymentMethodLinkResource.ValidateResourceId(id); + return new BillingPaymentMethodLinkResource(Client, id); + } + } +} diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingTenantResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingTenantResource.cs new file mode 100644 index 0000000000000..62a8277a2b629 --- /dev/null +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingTenantResource.cs @@ -0,0 +1,327 @@ +// 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.Billing; + +namespace Azure.ResourceManager.Billing.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableBillingTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableBillingTenantResource() + { + } + + /// 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 MockableBillingTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of BillingSubscriptionResources in the TenantResource. + /// The ID that uniquely identifies a billing account. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of BillingSubscriptionResources and their operations over a BillingSubscriptionResource. + public virtual BillingSubscriptionCollection GetBillingSubscriptions(string billingAccountName) + { + return new BillingSubscriptionCollection(Client, Id, billingAccountName); + } + + /// + /// Gets a subscription by its ID. The operation is currently supported for billing accounts with agreement type Microsoft Customer Agreement, Microsoft Partner Agreement and Microsoft Online Services Program. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName} + /// + /// + /// Operation Id + /// BillingSubscriptions_Get + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a subscription. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingSubscriptionAsync(string billingAccountName, string billingSubscriptionName, CancellationToken cancellationToken = default) + { + return await GetBillingSubscriptions(billingAccountName).GetAsync(billingSubscriptionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a subscription by its ID. The operation is currently supported for billing accounts with agreement type Microsoft Customer Agreement, Microsoft Partner Agreement and Microsoft Online Services Program. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName} + /// + /// + /// Operation Id + /// BillingSubscriptions_Get + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a subscription. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingSubscription(string billingAccountName, string billingSubscriptionName, CancellationToken cancellationToken = default) + { + return GetBillingSubscriptions(billingAccountName).Get(billingSubscriptionName, cancellationToken); + } + + /// Gets a collection of BillingSubscriptionAliasResources in the TenantResource. + /// The ID that uniquely identifies a billing account. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of BillingSubscriptionAliasResources and their operations over a BillingSubscriptionAliasResource. + public virtual BillingSubscriptionAliasCollection GetBillingSubscriptionAliases(string billingAccountName) + { + return new BillingSubscriptionAliasCollection(Client, Id, billingAccountName); + } + + /// + /// Gets a subscription by its alias ID. The operation is supported for seat based billing subscriptions. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName} + /// + /// + /// Operation Id + /// BillingSubscriptionsAliases_Get + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a subscription alias. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingSubscriptionAliasAsync(string billingAccountName, string aliasName, CancellationToken cancellationToken = default) + { + return await GetBillingSubscriptionAliases(billingAccountName).GetAsync(aliasName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a subscription by its alias ID. The operation is supported for seat based billing subscriptions. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName} + /// + /// + /// Operation Id + /// BillingSubscriptionsAliases_Get + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a subscription alias. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingSubscriptionAlias(string billingAccountName, string aliasName, CancellationToken cancellationToken = default) + { + return GetBillingSubscriptionAliases(billingAccountName).Get(aliasName, cancellationToken); + } + + /// Gets a collection of BillingPaymentMethodResources in the TenantResource. + /// An object representing collection of BillingPaymentMethodResources and their operations over a BillingPaymentMethodResource. + public virtual BillingPaymentMethodCollection GetBillingPaymentMethods() + { + return GetCachedClient(client => new BillingPaymentMethodCollection(client, Id)); + } + + /// + /// Gets a payment method owned by the caller. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/paymentMethods/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByUser + /// + /// + /// + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingPaymentMethodAsync(string paymentMethodName, CancellationToken cancellationToken = default) + { + return await GetBillingPaymentMethods().GetAsync(paymentMethodName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a payment method owned by the caller. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/paymentMethods/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByUser + /// + /// + /// + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingPaymentMethod(string paymentMethodName, CancellationToken cancellationToken = default) + { + return GetBillingPaymentMethods().Get(paymentMethodName, cancellationToken); + } + + /// Gets a collection of BillingAccountPaymentMethodResources in the TenantResource. + /// The ID that uniquely identifies a billing account. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of BillingAccountPaymentMethodResources and their operations over a BillingAccountPaymentMethodResource. + public virtual BillingAccountPaymentMethodCollection GetBillingAccountPaymentMethods(string billingAccountName) + { + return new BillingAccountPaymentMethodCollection(Client, Id, billingAccountName); + } + + /// + /// Gets a payment method available for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByBillingAccount + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingAccountPaymentMethodAsync(string billingAccountName, string paymentMethodName, CancellationToken cancellationToken = default) + { + return await GetBillingAccountPaymentMethods(billingAccountName).GetAsync(paymentMethodName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a payment method available for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByBillingAccount + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingAccountPaymentMethod(string billingAccountName, string paymentMethodName, CancellationToken cancellationToken = default) + { + return GetBillingAccountPaymentMethods(billingAccountName).Get(paymentMethodName, cancellationToken); + } + + /// Gets a collection of BillingPaymentMethodLinkResources in the TenantResource. + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of BillingPaymentMethodLinkResources and their operations over a BillingPaymentMethodLinkResource. + public virtual BillingPaymentMethodLinkCollection GetBillingPaymentMethodLinks(string billingAccountName, string billingProfileName) + { + return new BillingPaymentMethodLinkCollection(Client, Id, billingAccountName, billingProfileName); + } + + /// + /// Gets a payment method linked with a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByBillingProfile + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingPaymentMethodLinkAsync(string billingAccountName, string billingProfileName, string paymentMethodName, CancellationToken cancellationToken = default) + { + return await GetBillingPaymentMethodLinks(billingAccountName, billingProfileName).GetAsync(paymentMethodName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a payment method linked with a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/{paymentMethodName} + /// + /// + /// Operation Id + /// PaymentMethods_GetByBillingProfile + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// The ID that uniquely identifies a payment method. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingPaymentMethodLink(string billingAccountName, string billingProfileName, string paymentMethodName, CancellationToken cancellationToken = default) + { + return GetBillingPaymentMethodLinks(billingAccountName, billingProfileName).Get(paymentMethodName, cancellationToken); + } + } +} diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 24b3e3b5fd9ff..0000000000000 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Billing -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of BillingSubscriptionResources in the TenantResource. - /// The ID that uniquely identifies a billing account. - /// An object representing collection of BillingSubscriptionResources and their operations over a BillingSubscriptionResource. - public virtual BillingSubscriptionCollection GetBillingSubscriptions(string billingAccountName) - { - return new BillingSubscriptionCollection(Client, Id, billingAccountName); - } - - /// Gets a collection of BillingSubscriptionAliasResources in the TenantResource. - /// The ID that uniquely identifies a billing account. - /// An object representing collection of BillingSubscriptionAliasResources and their operations over a BillingSubscriptionAliasResource. - public virtual BillingSubscriptionAliasCollection GetBillingSubscriptionAliases(string billingAccountName) - { - return new BillingSubscriptionAliasCollection(Client, Id, billingAccountName); - } - - /// Gets a collection of BillingPaymentMethodResources in the TenantResource. - /// An object representing collection of BillingPaymentMethodResources and their operations over a BillingPaymentMethodResource. - public virtual BillingPaymentMethodCollection GetBillingPaymentMethods() - { - return GetCachedClient(Client => new BillingPaymentMethodCollection(Client, Id)); - } - - /// Gets a collection of BillingAccountPaymentMethodResources in the TenantResource. - /// The ID that uniquely identifies a billing account. - /// An object representing collection of BillingAccountPaymentMethodResources and their operations over a BillingAccountPaymentMethodResource. - public virtual BillingAccountPaymentMethodCollection GetBillingAccountPaymentMethods(string billingAccountName) - { - return new BillingAccountPaymentMethodCollection(Client, Id, billingAccountName); - } - - /// Gets a collection of BillingPaymentMethodLinkResources in the TenantResource. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// An object representing collection of BillingPaymentMethodLinkResources and their operations over a BillingPaymentMethodLinkResource. - public virtual BillingPaymentMethodLinkCollection GetBillingPaymentMethodLinks(string billingAccountName, string billingProfileName) - { - return new BillingPaymentMethodLinkCollection(Client, Id, billingAccountName, billingProfileName); - } - } -} diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/api/Azure.ResourceManager.BillingBenefits.netstandard2.0.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/api/Azure.ResourceManager.BillingBenefits.netstandard2.0.cs index b07246235e98d..5d347bc0c8fb1 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/api/Azure.ResourceManager.BillingBenefits.netstandard2.0.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/api/Azure.ResourceManager.BillingBenefits.netstandard2.0.cs @@ -208,6 +208,34 @@ protected BillingBenefitsSavingsPlanResource() { } public virtual Azure.AsyncPageable ValidateUpdateAsync(Azure.ResourceManager.BillingBenefits.Models.SavingsPlanUpdateValidateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.BillingBenefits.Mocking +{ + public partial class MockableBillingBenefitsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableBillingBenefitsArmClient() { } + public virtual Azure.ResourceManager.BillingBenefits.BillingBenefitsReservationOrderAliasResource GetBillingBenefitsReservationOrderAliasResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.BillingBenefits.BillingBenefitsSavingsPlanOrderAliasResource GetBillingBenefitsSavingsPlanOrderAliasResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.BillingBenefits.BillingBenefitsSavingsPlanOrderResource GetBillingBenefitsSavingsPlanOrderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.BillingBenefits.BillingBenefitsSavingsPlanResource GetBillingBenefitsSavingsPlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableBillingBenefitsTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableBillingBenefitsTenantResource() { } + public virtual Azure.Response GetBillingBenefitsReservationOrderAlias(string reservationOrderAliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingBenefitsReservationOrderAliasAsync(string reservationOrderAliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.BillingBenefits.BillingBenefitsReservationOrderAliasCollection GetBillingBenefitsReservationOrderAliases() { throw null; } + public virtual Azure.Response GetBillingBenefitsSavingsPlanOrder(string savingsPlanOrderId, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBillingBenefitsSavingsPlanOrderAlias(string savingsPlanOrderAliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingBenefitsSavingsPlanOrderAliasAsync(string savingsPlanOrderAliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.BillingBenefits.BillingBenefitsSavingsPlanOrderAliasCollection GetBillingBenefitsSavingsPlanOrderAliases() { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingBenefitsSavingsPlanOrderAsync(string savingsPlanOrderId, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.BillingBenefits.BillingBenefitsSavingsPlanOrderCollection GetBillingBenefitsSavingsPlanOrders() { throw null; } + public virtual Azure.Pageable GetBillingBenefitsSavingsPlans(Azure.ResourceManager.BillingBenefits.Models.TenantResourceGetBillingBenefitsSavingsPlansOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBillingBenefitsSavingsPlansAsync(Azure.ResourceManager.BillingBenefits.Models.TenantResourceGetBillingBenefitsSavingsPlansOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ValidatePurchase(Azure.ResourceManager.BillingBenefits.Models.SavingsPlanPurchaseValidateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ValidatePurchaseAsync(Azure.ResourceManager.BillingBenefits.Models.SavingsPlanPurchaseValidateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.BillingBenefits.Models { public static partial class ArmBillingBenefitsModelFactory diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasResource.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasResource.cs index fc70ca80ad388..3afbb9dcf1377 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasResource.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsReservationOrderAliasResource.cs @@ -27,6 +27,7 @@ namespace Azure.ResourceManager.BillingBenefits public partial class BillingBenefitsReservationOrderAliasResource : ArmResource { /// Generate the resource identifier of a instance. + /// The reservationOrderAliasName. public static ResourceIdentifier CreateResourceIdentifier(string reservationOrderAliasName) { var resourceId = $"/providers/Microsoft.BillingBenefits/reservationOrderAliases/{reservationOrderAliasName}"; diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasResource.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasResource.cs index 183f2f8726a98..da706fdb74fac 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasResource.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderAliasResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.BillingBenefits public partial class BillingBenefitsSavingsPlanOrderAliasResource : ArmResource { /// Generate the resource identifier of a instance. + /// The savingsPlanOrderAliasName. public static ResourceIdentifier CreateResourceIdentifier(string savingsPlanOrderAliasName) { var resourceId = $"/providers/Microsoft.BillingBenefits/savingsPlanOrderAliases/{savingsPlanOrderAliasName}"; diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderResource.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderResource.cs index b3ffbdd53aceb..628d4de72c433 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderResource.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderResource.cs @@ -27,6 +27,7 @@ namespace Azure.ResourceManager.BillingBenefits public partial class BillingBenefitsSavingsPlanOrderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The savingsPlanOrderId. public static ResourceIdentifier CreateResourceIdentifier(string savingsPlanOrderId) { var resourceId = $"/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}"; @@ -92,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BillingBenefitsSavingsPlanResources and their operations over a BillingBenefitsSavingsPlanResource. public virtual BillingBenefitsSavingsPlanCollection GetBillingBenefitsSavingsPlans() { - return GetCachedClient(Client => new BillingBenefitsSavingsPlanCollection(Client, Id)); + return GetCachedClient(client => new BillingBenefitsSavingsPlanCollection(client, Id)); } /// @@ -111,8 +112,8 @@ public virtual BillingBenefitsSavingsPlanCollection GetBillingBenefitsSavingsPla /// ID of the savings plan. /// May be used to expand the detail information of some properties. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBillingBenefitsSavingsPlanAsync(string savingsPlanId, string expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +136,8 @@ public virtual async Task> GetBilli /// ID of the savings plan. /// May be used to expand the detail information of some properties. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBillingBenefitsSavingsPlan(string savingsPlanId, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanResource.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanResource.cs index 3a3170b310cc6..4347f6cf0e4c8 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanResource.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.BillingBenefits public partial class BillingBenefitsSavingsPlanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The savingsPlanOrderId. + /// The savingsPlanId. public static ResourceIdentifier CreateResourceIdentifier(string savingsPlanOrderId, string savingsPlanId) { var resourceId = $"/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}"; diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/BillingBenefitsExtensions.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/BillingBenefitsExtensions.cs index af6709fdd4e83..9554266d62ffa 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/BillingBenefitsExtensions.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/BillingBenefitsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.BillingBenefits.Mocking; using Azure.ResourceManager.BillingBenefits.Models; using Azure.ResourceManager.Resources; @@ -19,103 +20,92 @@ namespace Azure.ResourceManager.BillingBenefits /// A class to add extension methods to Azure.ResourceManager.BillingBenefits. public static partial class BillingBenefitsExtensions { - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableBillingBenefitsArmClient GetMockableBillingBenefitsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableBillingBenefitsArmClient(client0)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableBillingBenefitsTenantResource GetMockableBillingBenefitsTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableBillingBenefitsTenantResource(client, resource.Id)); } - #region BillingBenefitsSavingsPlanOrderAliasResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingBenefitsSavingsPlanOrderAliasResource GetBillingBenefitsSavingsPlanOrderAliasResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingBenefitsSavingsPlanOrderAliasResource.ValidateResourceId(id); - return new BillingBenefitsSavingsPlanOrderAliasResource(client, id); - } - ); + return GetMockableBillingBenefitsArmClient(client).GetBillingBenefitsSavingsPlanOrderAliasResource(id); } - #endregion - #region BillingBenefitsSavingsPlanOrderResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingBenefitsSavingsPlanOrderResource GetBillingBenefitsSavingsPlanOrderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingBenefitsSavingsPlanOrderResource.ValidateResourceId(id); - return new BillingBenefitsSavingsPlanOrderResource(client, id); - } - ); + return GetMockableBillingBenefitsArmClient(client).GetBillingBenefitsSavingsPlanOrderResource(id); } - #endregion - #region BillingBenefitsSavingsPlanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingBenefitsSavingsPlanResource GetBillingBenefitsSavingsPlanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingBenefitsSavingsPlanResource.ValidateResourceId(id); - return new BillingBenefitsSavingsPlanResource(client, id); - } - ); + return GetMockableBillingBenefitsArmClient(client).GetBillingBenefitsSavingsPlanResource(id); } - #endregion - #region BillingBenefitsReservationOrderAliasResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingBenefitsReservationOrderAliasResource GetBillingBenefitsReservationOrderAliasResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingBenefitsReservationOrderAliasResource.ValidateResourceId(id); - return new BillingBenefitsReservationOrderAliasResource(client, id); - } - ); + return GetMockableBillingBenefitsArmClient(client).GetBillingBenefitsReservationOrderAliasResource(id); } - #endregion - /// Gets a collection of BillingBenefitsSavingsPlanOrderAliasResources in the TenantResource. + /// + /// Gets a collection of BillingBenefitsSavingsPlanOrderAliasResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BillingBenefitsSavingsPlanOrderAliasResources and their operations over a BillingBenefitsSavingsPlanOrderAliasResource. public static BillingBenefitsSavingsPlanOrderAliasCollection GetBillingBenefitsSavingsPlanOrderAliases(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetBillingBenefitsSavingsPlanOrderAliases(); + return GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsSavingsPlanOrderAliases(); } /// @@ -130,16 +120,20 @@ public static BillingBenefitsSavingsPlanOrderAliasCollection GetBillingBenefitsS /// SavingsPlanOrderAlias_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the savings plan order alias. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingBenefitsSavingsPlanOrderAliasAsync(this TenantResource tenantResource, string savingsPlanOrderAliasName, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingBenefitsSavingsPlanOrderAliases().GetAsync(savingsPlanOrderAliasName, cancellationToken).ConfigureAwait(false); + return await GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsSavingsPlanOrderAliasAsync(savingsPlanOrderAliasName, cancellationToken).ConfigureAwait(false); } /// @@ -154,24 +148,34 @@ public static async Task> /// SavingsPlanOrderAlias_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the savings plan order alias. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingBenefitsSavingsPlanOrderAlias(this TenantResource tenantResource, string savingsPlanOrderAliasName, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingBenefitsSavingsPlanOrderAliases().Get(savingsPlanOrderAliasName, cancellationToken); + return GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsSavingsPlanOrderAlias(savingsPlanOrderAliasName, cancellationToken); } - /// Gets a collection of BillingBenefitsSavingsPlanOrderResources in the TenantResource. + /// + /// Gets a collection of BillingBenefitsSavingsPlanOrderResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BillingBenefitsSavingsPlanOrderResources and their operations over a BillingBenefitsSavingsPlanOrderResource. public static BillingBenefitsSavingsPlanOrderCollection GetBillingBenefitsSavingsPlanOrders(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetBillingBenefitsSavingsPlanOrders(); + return GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsSavingsPlanOrders(); } /// @@ -186,17 +190,21 @@ public static BillingBenefitsSavingsPlanOrderCollection GetBillingBenefitsSaving /// SavingsPlanOrder_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Order ID of the savings plan. /// May be used to expand the detail information of some properties. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingBenefitsSavingsPlanOrderAsync(this TenantResource tenantResource, string savingsPlanOrderId, string expand = null, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingBenefitsSavingsPlanOrders().GetAsync(savingsPlanOrderId, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsSavingsPlanOrderAsync(savingsPlanOrderId, expand, cancellationToken).ConfigureAwait(false); } /// @@ -211,25 +219,35 @@ public static async Task> GetB /// SavingsPlanOrder_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Order ID of the savings plan. /// May be used to expand the detail information of some properties. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingBenefitsSavingsPlanOrder(this TenantResource tenantResource, string savingsPlanOrderId, string expand = null, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingBenefitsSavingsPlanOrders().Get(savingsPlanOrderId, expand, cancellationToken); + return GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsSavingsPlanOrder(savingsPlanOrderId, expand, cancellationToken); } - /// Gets a collection of BillingBenefitsReservationOrderAliasResources in the TenantResource. + /// + /// Gets a collection of BillingBenefitsReservationOrderAliasResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BillingBenefitsReservationOrderAliasResources and their operations over a BillingBenefitsReservationOrderAliasResource. public static BillingBenefitsReservationOrderAliasCollection GetBillingBenefitsReservationOrderAliases(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetBillingBenefitsReservationOrderAliases(); + return GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsReservationOrderAliases(); } /// @@ -244,16 +262,20 @@ public static BillingBenefitsReservationOrderAliasCollection GetBillingBenefitsR /// ReservationOrderAlias_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the reservation order alias. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingBenefitsReservationOrderAliasAsync(this TenantResource tenantResource, string reservationOrderAliasName, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingBenefitsReservationOrderAliases().GetAsync(reservationOrderAliasName, cancellationToken).ConfigureAwait(false); + return await GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsReservationOrderAliasAsync(reservationOrderAliasName, cancellationToken).ConfigureAwait(false); } /// @@ -268,16 +290,20 @@ public static async Task> /// ReservationOrderAlias_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the reservation order alias. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingBenefitsReservationOrderAlias(this TenantResource tenantResource, string reservationOrderAliasName, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingBenefitsReservationOrderAliases().Get(reservationOrderAliasName, cancellationToken); + return GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsReservationOrderAlias(reservationOrderAliasName, cancellationToken); } /// @@ -292,6 +318,10 @@ public static Response GetBillingB /// SavingsPlan_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -299,9 +329,7 @@ public static Response GetBillingB /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBillingBenefitsSavingsPlansAsync(this TenantResource tenantResource, TenantResourceGetBillingBenefitsSavingsPlansOptions options, CancellationToken cancellationToken = default) { - options ??= new TenantResourceGetBillingBenefitsSavingsPlansOptions(); - - return GetTenantResourceExtensionClient(tenantResource).GetBillingBenefitsSavingsPlansAsync(options, cancellationToken); + return GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsSavingsPlansAsync(options, cancellationToken); } /// @@ -316,6 +344,10 @@ public static AsyncPageable GetBillingBenefi /// SavingsPlan_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -323,9 +355,7 @@ public static AsyncPageable GetBillingBenefi /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBillingBenefitsSavingsPlans(this TenantResource tenantResource, TenantResourceGetBillingBenefitsSavingsPlansOptions options, CancellationToken cancellationToken = default) { - options ??= new TenantResourceGetBillingBenefitsSavingsPlansOptions(); - - return GetTenantResourceExtensionClient(tenantResource).GetBillingBenefitsSavingsPlans(options, cancellationToken); + return GetMockableBillingBenefitsTenantResource(tenantResource).GetBillingBenefitsSavingsPlans(options, cancellationToken); } /// @@ -340,6 +370,10 @@ public static Pageable GetBillingBenefitsSav /// ValidatePurchase /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Request body for validating the purchase of a savings plan. @@ -348,9 +382,7 @@ public static Pageable GetBillingBenefitsSav /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable ValidatePurchaseAsync(this TenantResource tenantResource, SavingsPlanPurchaseValidateContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).ValidatePurchaseAsync(content, cancellationToken); + return GetMockableBillingBenefitsTenantResource(tenantResource).ValidatePurchaseAsync(content, cancellationToken); } /// @@ -365,6 +397,10 @@ public static AsyncPageable ValidatePurchaseAsync(thi /// ValidatePurchase /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Request body for validating the purchase of a savings plan. @@ -373,9 +409,7 @@ public static AsyncPageable ValidatePurchaseAsync(thi /// A collection of that may take multiple service requests to iterate over. public static Pageable ValidatePurchase(this TenantResource tenantResource, SavingsPlanPurchaseValidateContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).ValidatePurchase(content, cancellationToken); + return GetMockableBillingBenefitsTenantResource(tenantResource).ValidatePurchase(content, cancellationToken); } } } diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/MockableBillingBenefitsArmClient.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/MockableBillingBenefitsArmClient.cs new file mode 100644 index 0000000000000..c0c65402367fa --- /dev/null +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/MockableBillingBenefitsArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.BillingBenefits; + +namespace Azure.ResourceManager.BillingBenefits.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableBillingBenefitsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableBillingBenefitsArmClient() + { + } + + /// 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 MockableBillingBenefitsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableBillingBenefitsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingBenefitsSavingsPlanOrderAliasResource GetBillingBenefitsSavingsPlanOrderAliasResource(ResourceIdentifier id) + { + BillingBenefitsSavingsPlanOrderAliasResource.ValidateResourceId(id); + return new BillingBenefitsSavingsPlanOrderAliasResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingBenefitsSavingsPlanOrderResource GetBillingBenefitsSavingsPlanOrderResource(ResourceIdentifier id) + { + BillingBenefitsSavingsPlanOrderResource.ValidateResourceId(id); + return new BillingBenefitsSavingsPlanOrderResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingBenefitsSavingsPlanResource GetBillingBenefitsSavingsPlanResource(ResourceIdentifier id) + { + BillingBenefitsSavingsPlanResource.ValidateResourceId(id); + return new BillingBenefitsSavingsPlanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingBenefitsReservationOrderAliasResource GetBillingBenefitsReservationOrderAliasResource(ResourceIdentifier id) + { + BillingBenefitsReservationOrderAliasResource.ValidateResourceId(id); + return new BillingBenefitsReservationOrderAliasResource(Client, id); + } + } +} diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/MockableBillingBenefitsTenantResource.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/MockableBillingBenefitsTenantResource.cs new file mode 100644 index 0000000000000..361441cc31c74 --- /dev/null +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/MockableBillingBenefitsTenantResource.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.BillingBenefits; +using Azure.ResourceManager.BillingBenefits.Models; + +namespace Azure.ResourceManager.BillingBenefits.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableBillingBenefitsTenantResource : ArmResource + { + private ClientDiagnostics _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics; + private SavingsPlanRestOperations _billingBenefitsSavingsPlanSavingsPlanRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private BillingBenefitsRPRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableBillingBenefitsTenantResource() + { + } + + /// 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 MockableBillingBenefitsTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics => _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BillingBenefits", BillingBenefitsSavingsPlanResource.ResourceType.Namespace, Diagnostics); + private SavingsPlanRestOperations BillingBenefitsSavingsPlanSavingsPlanRestClient => _billingBenefitsSavingsPlanSavingsPlanRestClient ??= new SavingsPlanRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BillingBenefitsSavingsPlanResource.ResourceType)); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BillingBenefits", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BillingBenefitsRPRestOperations DefaultRestClient => _defaultRestClient ??= new BillingBenefitsRPRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of BillingBenefitsSavingsPlanOrderAliasResources in the TenantResource. + /// An object representing collection of BillingBenefitsSavingsPlanOrderAliasResources and their operations over a BillingBenefitsSavingsPlanOrderAliasResource. + public virtual BillingBenefitsSavingsPlanOrderAliasCollection GetBillingBenefitsSavingsPlanOrderAliases() + { + return GetCachedClient(client => new BillingBenefitsSavingsPlanOrderAliasCollection(client, Id)); + } + + /// + /// Get a savings plan. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrderAliases/{savingsPlanOrderAliasName} + /// + /// + /// Operation Id + /// SavingsPlanOrderAlias_Get + /// + /// + /// + /// Name of the savings plan order alias. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingBenefitsSavingsPlanOrderAliasAsync(string savingsPlanOrderAliasName, CancellationToken cancellationToken = default) + { + return await GetBillingBenefitsSavingsPlanOrderAliases().GetAsync(savingsPlanOrderAliasName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a savings plan. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrderAliases/{savingsPlanOrderAliasName} + /// + /// + /// Operation Id + /// SavingsPlanOrderAlias_Get + /// + /// + /// + /// Name of the savings plan order alias. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingBenefitsSavingsPlanOrderAlias(string savingsPlanOrderAliasName, CancellationToken cancellationToken = default) + { + return GetBillingBenefitsSavingsPlanOrderAliases().Get(savingsPlanOrderAliasName, cancellationToken); + } + + /// Gets a collection of BillingBenefitsSavingsPlanOrderResources in the TenantResource. + /// An object representing collection of BillingBenefitsSavingsPlanOrderResources and their operations over a BillingBenefitsSavingsPlanOrderResource. + public virtual BillingBenefitsSavingsPlanOrderCollection GetBillingBenefitsSavingsPlanOrders() + { + return GetCachedClient(client => new BillingBenefitsSavingsPlanOrderCollection(client, Id)); + } + + /// + /// Get a savings plan order. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId} + /// + /// + /// Operation Id + /// SavingsPlanOrder_Get + /// + /// + /// + /// Order ID of the savings plan. + /// May be used to expand the detail information of some properties. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingBenefitsSavingsPlanOrderAsync(string savingsPlanOrderId, string expand = null, CancellationToken cancellationToken = default) + { + return await GetBillingBenefitsSavingsPlanOrders().GetAsync(savingsPlanOrderId, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a savings plan order. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId} + /// + /// + /// Operation Id + /// SavingsPlanOrder_Get + /// + /// + /// + /// Order ID of the savings plan. + /// May be used to expand the detail information of some properties. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingBenefitsSavingsPlanOrder(string savingsPlanOrderId, string expand = null, CancellationToken cancellationToken = default) + { + return GetBillingBenefitsSavingsPlanOrders().Get(savingsPlanOrderId, expand, cancellationToken); + } + + /// Gets a collection of BillingBenefitsReservationOrderAliasResources in the TenantResource. + /// An object representing collection of BillingBenefitsReservationOrderAliasResources and their operations over a BillingBenefitsReservationOrderAliasResource. + public virtual BillingBenefitsReservationOrderAliasCollection GetBillingBenefitsReservationOrderAliases() + { + return GetCachedClient(client => new BillingBenefitsReservationOrderAliasCollection(client, Id)); + } + + /// + /// Get a reservation order alias. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/reservationOrderAliases/{reservationOrderAliasName} + /// + /// + /// Operation Id + /// ReservationOrderAlias_Get + /// + /// + /// + /// Name of the reservation order alias. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingBenefitsReservationOrderAliasAsync(string reservationOrderAliasName, CancellationToken cancellationToken = default) + { + return await GetBillingBenefitsReservationOrderAliases().GetAsync(reservationOrderAliasName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a reservation order alias. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/reservationOrderAliases/{reservationOrderAliasName} + /// + /// + /// Operation Id + /// ReservationOrderAlias_Get + /// + /// + /// + /// Name of the reservation order alias. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingBenefitsReservationOrderAlias(string reservationOrderAliasName, CancellationToken cancellationToken = default) + { + return GetBillingBenefitsReservationOrderAliases().Get(reservationOrderAliasName, cancellationToken); + } + + /// + /// List savings plans. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlans + /// + /// + /// Operation Id + /// SavingsPlan_ListAll + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBillingBenefitsSavingsPlansAsync(TenantResourceGetBillingBenefitsSavingsPlansOptions options, CancellationToken cancellationToken = default) + { + options ??= new TenantResourceGetBillingBenefitsSavingsPlansOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllRequest(options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "MockableBillingBenefitsTenantResource.GetBillingBenefitsSavingsPlans", "value", "nextLink", cancellationToken); + } + + /// + /// List savings plans. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlans + /// + /// + /// Operation Id + /// SavingsPlan_ListAll + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBillingBenefitsSavingsPlans(TenantResourceGetBillingBenefitsSavingsPlansOptions options, CancellationToken cancellationToken = default) + { + options ??= new TenantResourceGetBillingBenefitsSavingsPlansOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllRequest(options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "MockableBillingBenefitsTenantResource.GetBillingBenefitsSavingsPlans", "value", "nextLink", cancellationToken); + } + + /// + /// Validate savings plan purchase. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/validate + /// + /// + /// Operation Id + /// ValidatePurchase + /// + /// + /// + /// Request body for validating the purchase of a savings plan. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ValidatePurchaseAsync(SavingsPlanPurchaseValidateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateValidatePurchaseRequest(content); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateValidatePurchaseNextPageRequest(nextLink, content); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SavingsPlanValidateResult.DeserializeSavingsPlanValidateResult, DefaultClientDiagnostics, Pipeline, "MockableBillingBenefitsTenantResource.ValidatePurchase", "benefits", "nextLink", cancellationToken); + } + + /// + /// Validate savings plan purchase. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/validate + /// + /// + /// Operation Id + /// ValidatePurchase + /// + /// + /// + /// Request body for validating the purchase of a savings plan. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ValidatePurchase(SavingsPlanPurchaseValidateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateValidatePurchaseRequest(content); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateValidatePurchaseNextPageRequest(nextLink, content); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SavingsPlanValidateResult.DeserializeSavingsPlanValidateResult, DefaultClientDiagnostics, Pipeline, "MockableBillingBenefitsTenantResource.ValidatePurchase", "benefits", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 1508ec66d244b..0000000000000 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.BillingBenefits.Models; - -namespace Azure.ResourceManager.BillingBenefits -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics; - private SavingsPlanRestOperations _billingBenefitsSavingsPlanSavingsPlanRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private BillingBenefitsRPRestOperations _defaultRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics => _billingBenefitsSavingsPlanSavingsPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BillingBenefits", BillingBenefitsSavingsPlanResource.ResourceType.Namespace, Diagnostics); - private SavingsPlanRestOperations BillingBenefitsSavingsPlanSavingsPlanRestClient => _billingBenefitsSavingsPlanSavingsPlanRestClient ??= new SavingsPlanRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BillingBenefitsSavingsPlanResource.ResourceType)); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BillingBenefits", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BillingBenefitsRPRestOperations DefaultRestClient => _defaultRestClient ??= new BillingBenefitsRPRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of BillingBenefitsSavingsPlanOrderAliasResources in the TenantResource. - /// An object representing collection of BillingBenefitsSavingsPlanOrderAliasResources and their operations over a BillingBenefitsSavingsPlanOrderAliasResource. - public virtual BillingBenefitsSavingsPlanOrderAliasCollection GetBillingBenefitsSavingsPlanOrderAliases() - { - return GetCachedClient(Client => new BillingBenefitsSavingsPlanOrderAliasCollection(Client, Id)); - } - - /// Gets a collection of BillingBenefitsSavingsPlanOrderResources in the TenantResource. - /// An object representing collection of BillingBenefitsSavingsPlanOrderResources and their operations over a BillingBenefitsSavingsPlanOrderResource. - public virtual BillingBenefitsSavingsPlanOrderCollection GetBillingBenefitsSavingsPlanOrders() - { - return GetCachedClient(Client => new BillingBenefitsSavingsPlanOrderCollection(Client, Id)); - } - - /// Gets a collection of BillingBenefitsReservationOrderAliasResources in the TenantResource. - /// An object representing collection of BillingBenefitsReservationOrderAliasResources and their operations over a BillingBenefitsReservationOrderAliasResource. - public virtual BillingBenefitsReservationOrderAliasCollection GetBillingBenefitsReservationOrderAliases() - { - return GetCachedClient(Client => new BillingBenefitsReservationOrderAliasCollection(Client, Id)); - } - - /// - /// List savings plans. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlans - /// - /// - /// Operation Id - /// SavingsPlan_ListAll - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBillingBenefitsSavingsPlansAsync(TenantResourceGetBillingBenefitsSavingsPlansOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllRequest(options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBillingBenefitsSavingsPlans", "value", "nextLink", cancellationToken); - } - - /// - /// List savings plans. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlans - /// - /// - /// Operation Id - /// SavingsPlan_ListAll - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBillingBenefitsSavingsPlans(TenantResourceGetBillingBenefitsSavingsPlansOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllRequest(options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BillingBenefitsSavingsPlanSavingsPlanRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.OrderBy, options.RefreshSummary, options.SkipToken, options.SelectedState, options.Take); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingBenefitsSavingsPlanResource(Client, BillingBenefitsSavingsPlanData.DeserializeBillingBenefitsSavingsPlanData(e)), BillingBenefitsSavingsPlanSavingsPlanClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBillingBenefitsSavingsPlans", "value", "nextLink", cancellationToken); - } - - /// - /// Validate savings plan purchase. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/validate - /// - /// - /// Operation Id - /// ValidatePurchase - /// - /// - /// - /// Request body for validating the purchase of a savings plan. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable ValidatePurchaseAsync(SavingsPlanPurchaseValidateContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateValidatePurchaseRequest(content); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateValidatePurchaseNextPageRequest(nextLink, content); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SavingsPlanValidateResult.DeserializeSavingsPlanValidateResult, DefaultClientDiagnostics, Pipeline, "TenantResourceExtensionClient.ValidatePurchase", "benefits", "nextLink", cancellationToken); - } - - /// - /// Validate savings plan purchase. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/validate - /// - /// - /// Operation Id - /// ValidatePurchase - /// - /// - /// - /// Request body for validating the purchase of a savings plan. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable ValidatePurchase(SavingsPlanPurchaseValidateContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateValidatePurchaseRequest(content); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateValidatePurchaseNextPageRequest(nextLink, content); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SavingsPlanValidateResult.DeserializeSavingsPlanValidateResult, DefaultClientDiagnostics, Pipeline, "TenantResourceExtensionClient.ValidatePurchase", "benefits", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/api/Azure.ResourceManager.Blueprint.netstandard2.0.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/api/Azure.ResourceManager.Blueprint.netstandard2.0.cs index af085eff46721..2b752a2fa898d 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/api/Azure.ResourceManager.Blueprint.netstandard2.0.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/api/Azure.ResourceManager.Blueprint.netstandard2.0.cs @@ -254,6 +254,25 @@ protected PublishedBlueprintResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Blueprint.PublishedBlueprintData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Blueprint.Mocking +{ + public partial class MockableBlueprintArmClient : Azure.ResourceManager.ArmResource + { + protected MockableBlueprintArmClient() { } + public virtual Azure.Response GetAssignment(Azure.Core.ResourceIdentifier scope, string assignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAssignmentAsync(Azure.Core.ResourceIdentifier scope, string assignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Blueprint.AssignmentOperationResource GetAssignmentOperationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Blueprint.AssignmentResource GetAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Blueprint.AssignmentCollection GetAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetBlueprint(Azure.Core.ResourceIdentifier scope, string blueprintName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Blueprint.BlueprintArtifactResource GetBlueprintArtifactResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual System.Threading.Tasks.Task> GetBlueprintAsync(Azure.Core.ResourceIdentifier scope, string blueprintName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Blueprint.BlueprintResource GetBlueprintResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Blueprint.BlueprintCollection GetBlueprints(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Blueprint.BlueprintVersionArtifactResource GetBlueprintVersionArtifactResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Blueprint.PublishedBlueprintResource GetPublishedBlueprintResource(Azure.Core.ResourceIdentifier id) { throw null; } + } +} namespace Azure.ResourceManager.Blueprint.Models { public static partial class ArmBlueprintModelFactory diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationResource.cs index 42b8055c6e34a..b90629d4da318 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentOperationResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Blueprint public partial class AssignmentOperationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceScope. + /// The assignmentName. + /// The assignmentOperationName. public static ResourceIdentifier CreateResourceIdentifier(string resourceScope, string assignmentName, string assignmentOperationName) { var resourceId = $"{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}/assignmentOperations/{assignmentOperationName}"; diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentResource.cs index 78f2d75289fe6..6f38f0889f593 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Blueprint public partial class AssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceScope. + /// The assignmentName. public static ResourceIdentifier CreateResourceIdentifier(string resourceScope, string assignmentName) { var resourceId = $"{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName}"; @@ -91,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AssignmentOperationResources and their operations over a AssignmentOperationResource. public virtual AssignmentOperationCollection GetAssignmentOperations() { - return GetCachedClient(Client => new AssignmentOperationCollection(Client, Id)); + return GetCachedClient(client => new AssignmentOperationCollection(client, Id)); } /// @@ -109,8 +111,8 @@ public virtual AssignmentOperationCollection GetAssignmentOperations() /// /// Name of the blueprint assignment operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAssignmentOperationAsync(string assignmentOperationName, CancellationToken cancellationToken = default) { @@ -132,8 +134,8 @@ public virtual async Task> GetAssignmentOp /// /// Name of the blueprint assignment operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAssignmentOperation(string assignmentOperationName, CancellationToken cancellationToken = default) { diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactResource.cs index 36f5a0e5010a9..b3604f1a78ee4 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintArtifactResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Blueprint public partial class BlueprintArtifactResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceScope. + /// The blueprintName. + /// The artifactName. public static ResourceIdentifier CreateResourceIdentifier(string resourceScope, string blueprintName, string artifactName) { var resourceId = $"{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}"; diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs index d64496c84ecbe..a5c350e296e77 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Blueprint public partial class BlueprintResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceScope. + /// The blueprintName. public static ResourceIdentifier CreateResourceIdentifier(string resourceScope, string blueprintName) { var resourceId = $"{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}"; @@ -96,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BlueprintArtifactResources and their operations over a BlueprintArtifactResource. public virtual BlueprintArtifactCollection GetBlueprintArtifacts() { - return GetCachedClient(Client => new BlueprintArtifactCollection(Client, Id)); + return GetCachedClient(client => new BlueprintArtifactCollection(client, Id)); } /// @@ -114,8 +116,8 @@ public virtual BlueprintArtifactCollection GetBlueprintArtifacts() /// /// Name of the blueprint artifact. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBlueprintArtifactAsync(string artifactName, CancellationToken cancellationToken = default) { @@ -137,8 +139,8 @@ public virtual async Task> GetBlueprintArtif /// /// Name of the blueprint artifact. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBlueprintArtifact(string artifactName, CancellationToken cancellationToken = default) { @@ -149,7 +151,7 @@ public virtual Response GetBlueprintArtifact(string a /// An object representing collection of PublishedBlueprintResources and their operations over a PublishedBlueprintResource. public virtual PublishedBlueprintCollection GetPublishedBlueprints() { - return GetCachedClient(Client => new PublishedBlueprintCollection(Client, Id)); + return GetCachedClient(client => new PublishedBlueprintCollection(client, Id)); } /// @@ -167,8 +169,8 @@ public virtual PublishedBlueprintCollection GetPublishedBlueprints() /// /// Version of the published blueprint definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPublishedBlueprintAsync(string versionId, CancellationToken cancellationToken = default) { @@ -190,8 +192,8 @@ public virtual async Task> GetPublishedBlue /// /// Version of the published blueprint definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPublishedBlueprint(string versionId, CancellationToken cancellationToken = default) { diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactResource.cs index ab997a3a6e71c..1acf5110d86fd 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintVersionArtifactResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Blueprint public partial class BlueprintVersionArtifactResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceScope. + /// The blueprintName. + /// The versionId. + /// The artifactName. public static ResourceIdentifier CreateResourceIdentifier(string resourceScope, string blueprintName, string versionId, string artifactName) { var resourceId = $"{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}/artifacts/{artifactName}"; diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index e5e798f947bac..0000000000000 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Blueprint -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of BlueprintResources in the ArmResource. - /// An object representing collection of BlueprintResources and their operations over a BlueprintResource. - public virtual BlueprintCollection GetBlueprints() - { - return GetCachedClient(Client => new BlueprintCollection(Client, Id)); - } - - /// Gets a collection of AssignmentResources in the ArmResource. - /// An object representing collection of AssignmentResources and their operations over a AssignmentResource. - public virtual AssignmentCollection GetAssignments() - { - return GetCachedClient(Client => new AssignmentCollection(Client, Id)); - } - } -} diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/BlueprintExtensions.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/BlueprintExtensions.cs index d4773d4dffd37..22452b796ecf6 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/BlueprintExtensions.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/BlueprintExtensions.cs @@ -11,148 +11,31 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Blueprint.Mocking; namespace Azure.ResourceManager.Blueprint { /// A class to add extension methods to Azure.ResourceManager.Blueprint. public static partial class BlueprintExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableBlueprintArmClient GetMockableBlueprintArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableBlueprintArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); - } - #region BlueprintResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static BlueprintResource GetBlueprintResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - BlueprintResource.ValidateResourceId(id); - return new BlueprintResource(client, id); - } - ); - } - #endregion - - #region BlueprintArtifactResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static BlueprintArtifactResource GetBlueprintArtifactResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - BlueprintArtifactResource.ValidateResourceId(id); - return new BlueprintArtifactResource(client, id); - } - ); - } - #endregion - - #region BlueprintVersionArtifactResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static BlueprintVersionArtifactResource GetBlueprintVersionArtifactResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - BlueprintVersionArtifactResource.ValidateResourceId(id); - return new BlueprintVersionArtifactResource(client, id); - } - ); - } - #endregion - - #region PublishedBlueprintResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static PublishedBlueprintResource GetPublishedBlueprintResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - PublishedBlueprintResource.ValidateResourceId(id); - return new PublishedBlueprintResource(client, id); - } - ); - } - #endregion - - #region AssignmentResource - /// - /// 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 AssignmentResource GetAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AssignmentResource.ValidateResourceId(id); - return new AssignmentResource(client, id); - } - ); - } - #endregion - - #region AssignmentOperationResource - /// - /// 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. + /// Gets a collection of BlueprintResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static AssignmentOperationResource GetAssignmentOperationResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AssignmentOperationResource.ValidateResourceId(id); - return new AssignmentOperationResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of BlueprintResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of BlueprintResources and their operations over a BlueprintResource. public static BlueprintCollection GetBlueprints(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetBlueprints(); + return GetMockableBlueprintArmClient(client).GetBlueprints(scope); } /// @@ -167,17 +50,21 @@ public static BlueprintCollection GetBlueprints(this ArmClient client, ResourceI /// Blueprints_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Name of the blueprint definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBlueprintAsync(this ArmClient client, ResourceIdentifier scope, string blueprintName, CancellationToken cancellationToken = default) { - return await client.GetBlueprints(scope).GetAsync(blueprintName, cancellationToken).ConfigureAwait(false); + return await GetMockableBlueprintArmClient(client).GetBlueprintAsync(scope, blueprintName, cancellationToken).ConfigureAwait(false); } /// @@ -192,26 +79,36 @@ public static async Task> GetBlueprintAsync(this Arm /// Blueprints_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Name of the blueprint definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBlueprint(this ArmClient client, ResourceIdentifier scope, string blueprintName, CancellationToken cancellationToken = default) { - return client.GetBlueprints(scope).Get(blueprintName, cancellationToken); + return GetMockableBlueprintArmClient(client).GetBlueprint(scope, blueprintName, cancellationToken); } - /// Gets a collection of AssignmentResources in the ArmResource. + /// + /// Gets a collection of AssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of AssignmentResources and their operations over a AssignmentResource. public static AssignmentCollection GetAssignments(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetAssignments(); + return GetMockableBlueprintArmClient(client).GetAssignments(scope); } /// @@ -226,17 +123,21 @@ public static AssignmentCollection GetAssignments(this ArmClient client, Resourc /// Assignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Name of the blueprint assignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string assignmentName, CancellationToken cancellationToken = default) { - return await client.GetAssignments(scope).GetAsync(assignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableBlueprintArmClient(client).GetAssignmentAsync(scope, assignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -251,17 +152,117 @@ public static async Task> GetAssignmentAsync(this A /// Assignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Name of the blueprint assignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAssignment(this ArmClient client, ResourceIdentifier scope, string assignmentName, CancellationToken cancellationToken = default) { - return client.GetAssignments(scope).Get(assignmentName, cancellationToken); + return GetMockableBlueprintArmClient(client).GetAssignment(scope, assignmentName, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static BlueprintResource GetBlueprintResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableBlueprintArmClient(client).GetBlueprintResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static BlueprintArtifactResource GetBlueprintArtifactResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableBlueprintArmClient(client).GetBlueprintArtifactResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static BlueprintVersionArtifactResource GetBlueprintVersionArtifactResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableBlueprintArmClient(client).GetBlueprintVersionArtifactResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PublishedBlueprintResource GetPublishedBlueprintResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableBlueprintArmClient(client).GetPublishedBlueprintResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AssignmentResource GetAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableBlueprintArmClient(client).GetAssignmentResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AssignmentOperationResource GetAssignmentOperationResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableBlueprintArmClient(client).GetAssignmentOperationResource(id); } } } diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/MockableBlueprintArmClient.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/MockableBlueprintArmClient.cs new file mode 100644 index 0000000000000..0d622c4d7c5c2 --- /dev/null +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/MockableBlueprintArmClient.cs @@ -0,0 +1,227 @@ +// 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.Blueprint; + +namespace Azure.ResourceManager.Blueprint.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableBlueprintArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableBlueprintArmClient() + { + } + + /// 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 MockableBlueprintArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableBlueprintArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of BlueprintResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of BlueprintResources and their operations over a BlueprintResource. + public virtual BlueprintCollection GetBlueprints(ResourceIdentifier scope) + { + return new BlueprintCollection(Client, scope); + } + + /// + /// Get a blueprint definition. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName} + /// + /// + /// Operation Id + /// Blueprints_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Name of the blueprint definition. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBlueprintAsync(ResourceIdentifier scope, string blueprintName, CancellationToken cancellationToken = default) + { + return await GetBlueprints(scope).GetAsync(blueprintName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a blueprint definition. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName} + /// + /// + /// Operation Id + /// Blueprints_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Name of the blueprint definition. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBlueprint(ResourceIdentifier scope, string blueprintName, CancellationToken cancellationToken = default) + { + return GetBlueprints(scope).Get(blueprintName, cancellationToken); + } + + /// Gets a collection of AssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of AssignmentResources and their operations over a AssignmentResource. + public virtual AssignmentCollection GetAssignments(ResourceIdentifier scope) + { + return new AssignmentCollection(Client, scope); + } + + /// + /// Get a blueprint assignment. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName} + /// + /// + /// Operation Id + /// Assignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Name of the blueprint assignment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAssignmentAsync(ResourceIdentifier scope, string assignmentName, CancellationToken cancellationToken = default) + { + return await GetAssignments(scope).GetAsync(assignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a blueprint assignment. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Blueprint/blueprintAssignments/{assignmentName} + /// + /// + /// Operation Id + /// Assignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Name of the blueprint assignment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAssignment(ResourceIdentifier scope, string assignmentName, CancellationToken cancellationToken = default) + { + return GetAssignments(scope).Get(assignmentName, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BlueprintResource GetBlueprintResource(ResourceIdentifier id) + { + BlueprintResource.ValidateResourceId(id); + return new BlueprintResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BlueprintArtifactResource GetBlueprintArtifactResource(ResourceIdentifier id) + { + BlueprintArtifactResource.ValidateResourceId(id); + return new BlueprintArtifactResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BlueprintVersionArtifactResource GetBlueprintVersionArtifactResource(ResourceIdentifier id) + { + BlueprintVersionArtifactResource.ValidateResourceId(id); + return new BlueprintVersionArtifactResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PublishedBlueprintResource GetPublishedBlueprintResource(ResourceIdentifier id) + { + PublishedBlueprintResource.ValidateResourceId(id); + return new PublishedBlueprintResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AssignmentResource GetAssignmentResource(ResourceIdentifier id) + { + AssignmentResource.ValidateResourceId(id); + return new AssignmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AssignmentOperationResource GetAssignmentOperationResource(ResourceIdentifier id) + { + AssignmentOperationResource.ValidateResourceId(id); + return new AssignmentOperationResource(Client, id); + } + } +} diff --git a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintResource.cs index 27e61c7bc1c0f..502f8df74fba9 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Blueprint public partial class PublishedBlueprintResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceScope. + /// The blueprintName. + /// The versionId. public static ResourceIdentifier CreateResourceIdentifier(string resourceScope, string blueprintName, string versionId) { var resourceId = $"{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}"; @@ -90,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BlueprintVersionArtifactResources and their operations over a BlueprintVersionArtifactResource. public virtual BlueprintVersionArtifactCollection GetBlueprintVersionArtifacts() { - return GetCachedClient(Client => new BlueprintVersionArtifactCollection(Client, Id)); + return GetCachedClient(client => new BlueprintVersionArtifactCollection(client, Id)); } /// @@ -108,8 +111,8 @@ public virtual BlueprintVersionArtifactCollection GetBlueprintVersionArtifacts() /// /// Name of the blueprint artifact. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBlueprintVersionArtifactAsync(string artifactName, CancellationToken cancellationToken = default) { @@ -131,8 +134,8 @@ public virtual async Task> GetBluepri /// /// Name of the blueprint artifact. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBlueprintVersionArtifact(string artifactName, CancellationToken cancellationToken = default) { diff --git a/sdk/botservice/Azure.ResourceManager.BotService/Azure.ResourceManager.BotService.sln b/sdk/botservice/Azure.ResourceManager.BotService/Azure.ResourceManager.BotService.sln index 7190c14af7c8e..0257348f2aca4 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/Azure.ResourceManager.BotService.sln +++ b/sdk/botservice/Azure.ResourceManager.BotService/Azure.ResourceManager.BotService.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{033000A1-3A25-487B-B72A-402785A74714}") = "Azure.ResourceManager.BotService", "src\Azure.ResourceManager.BotService.csproj", "{D37EF77E-D0CF-4339-8000-4BDEC0CB303A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.BotService", "src\Azure.ResourceManager.BotService.csproj", "{D37EF77E-D0CF-4339-8000-4BDEC0CB303A}" EndProject -Project("{033000A1-3A25-487B-B72A-402785A74714}") = "Azure.ResourceManager.BotService.Tests", "tests\Azure.ResourceManager.BotService.Tests.csproj", "{F3F8C7F9-6A80-4F28-8D8B-481C110C0684}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.BotService.Tests", "tests\Azure.ResourceManager.BotService.Tests.csproj", "{F3F8C7F9-6A80-4F28-8D8B-481C110C0684}" EndProject -Project("{033000A1-3A25-487B-B72A-402785A74714}") = "Azure.ResourceManager.BotService.Samples", "samples\Azure.ResourceManager.BotService.Samples.csproj", "{7179BA90-02B0-44F6-A088-0C81D76DC54F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.BotService.Samples", "samples\Azure.ResourceManager.BotService.Samples.csproj", "{7179BA90-02B0-44F6-A088-0C81D76DC54F}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6FCA241E-71B0-47CA-9CFD-2F81FE50A37C} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {F3F8C7F9-6A80-4F28-8D8B-481C110C0684}.Release|x64.Build.0 = Release|Any CPU {F3F8C7F9-6A80-4F28-8D8B-481C110C0684}.Release|x86.ActiveCfg = Release|Any CPU {F3F8C7F9-6A80-4F28-8D8B-481C110C0684}.Release|x86.Build.0 = Release|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Debug|x64.ActiveCfg = Debug|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Debug|x64.Build.0 = Debug|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Debug|x86.ActiveCfg = Debug|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Debug|x86.Build.0 = Debug|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Release|Any CPU.Build.0 = Release|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Release|x64.ActiveCfg = Release|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Release|x64.Build.0 = Release|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Release|x86.ActiveCfg = Release|Any CPU + {7179BA90-02B0-44F6-A088-0C81D76DC54F}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6FCA241E-71B0-47CA-9CFD-2F81FE50A37C} EndGlobalSection EndGlobal diff --git a/sdk/botservice/Azure.ResourceManager.BotService/api/Azure.ResourceManager.BotService.netstandard2.0.cs b/sdk/botservice/Azure.ResourceManager.BotService/api/Azure.ResourceManager.BotService.netstandard2.0.cs index 0033ff51d7418..60e112068fc98 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/api/Azure.ResourceManager.BotService.netstandard2.0.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/api/Azure.ResourceManager.BotService.netstandard2.0.cs @@ -19,7 +19,7 @@ protected BotChannelCollection() { } } public partial class BotChannelData : Azure.ResourceManager.Models.TrackedResourceData { - public BotChannelData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BotChannelData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.BotService.Models.BotServiceKind? Kind { get { throw null; } set { } } public Azure.ResourceManager.BotService.Models.BotChannelProperties Properties { get { throw null; } set { } } @@ -84,7 +84,7 @@ protected BotConnectionSettingCollection() { } } public partial class BotConnectionSettingData : Azure.ResourceManager.Models.TrackedResourceData { - public BotConnectionSettingData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BotConnectionSettingData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.BotService.Models.BotServiceKind? Kind { get { throw null; } set { } } public Azure.ResourceManager.BotService.Models.BotConnectionSettingProperties Properties { get { throw null; } set { } } @@ -115,7 +115,7 @@ protected BotConnectionSettingResource() { } } public partial class BotData : Azure.ResourceManager.Models.TrackedResourceData { - public BotData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BotData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.BotService.Models.BotServiceKind? Kind { get { throw null; } set { } } public Azure.ResourceManager.BotService.Models.BotProperties Properties { get { throw null; } set { } } @@ -217,6 +217,42 @@ protected BotServicePrivateEndpointConnectionResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.BotService.BotServicePrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.BotService.Mocking +{ + public partial class MockableBotServiceArmClient : Azure.ResourceManager.ArmResource + { + protected MockableBotServiceArmClient() { } + public virtual Azure.ResourceManager.BotService.BotChannelResource GetBotChannelResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.BotService.BotConnectionSettingResource GetBotConnectionSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.BotService.BotResource GetBotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.BotService.BotServicePrivateEndpointConnectionResource GetBotServicePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableBotServiceResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableBotServiceResourceGroupResource() { } + public virtual Azure.Response GetBot(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBotAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.BotService.BotCollection GetBots() { throw null; } + } + public partial class MockableBotServiceSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableBotServiceSubscriptionResource() { } + public virtual Azure.Pageable GetBotConnectionServiceProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBotConnectionServiceProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBots(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBotsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBotServiceHostSettings(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBotServiceHostSettingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBotServiceQnAMakerEndpointKey(Azure.ResourceManager.BotService.Models.GetBotServiceQnAMakerEndpointKeyContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBotServiceQnAMakerEndpointKeyAsync(Azure.ResourceManager.BotService.Models.GetBotServiceQnAMakerEndpointKeyContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableBotServiceTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableBotServiceTenantResource() { } + public virtual Azure.Response CheckBotServiceNameAvailability(Azure.ResourceManager.BotService.Models.BotServiceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckBotServiceNameAvailabilityAsync(Azure.ResourceManager.BotService.Models.BotServiceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.BotService.Models { public partial class AcsChatChannel : Azure.ResourceManager.BotService.Models.BotChannelProperties @@ -286,7 +322,7 @@ public static partial class ArmBotServiceModelFactory } public partial class BotChannelGetWithKeysResult : Azure.ResourceManager.Models.TrackedResourceData { - public BotChannelGetWithKeysResult(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BotChannelGetWithKeysResult(Azure.Core.AzureLocation location) { } public string ChangedTime { get { throw null; } set { } } public string EntityTag { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelResource.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelResource.cs index 84eb8869a506b..753e972c68cff 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelResource.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotChannelResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.BotService public partial class BotChannelResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The channelName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, BotChannelName channelName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingResource.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingResource.cs index 1b8221798edb5..77502c8eabdc5 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingResource.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotConnectionSettingResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.BotService public partial class BotConnectionSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotResource.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotResource.cs index db81696f3b2be..ed41df02cf238 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotResource.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.BotService public partial class BotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"; @@ -106,7 +109,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BotChannelResources and their operations over a BotChannelResource. public virtual BotChannelCollection GetBotChannels() { - return GetCachedClient(Client => new BotChannelCollection(Client, Id)); + return GetCachedClient(client => new BotChannelCollection(client, Id)); } /// @@ -155,7 +158,7 @@ public virtual Response GetBotChannel(BotChannelName channel /// An object representing collection of BotConnectionSettingResources and their operations over a BotConnectionSettingResource. public virtual BotConnectionSettingCollection GetBotConnectionSettings() { - return GetCachedClient(Client => new BotConnectionSettingCollection(Client, Id)); + return GetCachedClient(client => new BotConnectionSettingCollection(client, Id)); } /// @@ -173,8 +176,8 @@ public virtual BotConnectionSettingCollection GetBotConnectionSettings() /// /// The name of the Bot Service Connection Setting resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBotConnectionSettingAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -196,8 +199,8 @@ public virtual async Task> GetBotConnecti /// /// The name of the Bot Service Connection Setting resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBotConnectionSetting(string connectionName, CancellationToken cancellationToken = default) { @@ -208,7 +211,7 @@ public virtual Response GetBotConnectionSetting(st /// An object representing collection of BotServicePrivateEndpointConnectionResources and their operations over a BotServicePrivateEndpointConnectionResource. public virtual BotServicePrivateEndpointConnectionCollection GetBotServicePrivateEndpointConnections() { - return GetCachedClient(Client => new BotServicePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new BotServicePrivateEndpointConnectionCollection(client, Id)); } /// @@ -226,8 +229,8 @@ public virtual BotServicePrivateEndpointConnectionCollection GetBotServicePrivat /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBotServicePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -249,8 +252,8 @@ public virtual async Task> /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBotServicePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionResource.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionResource.cs index 009ddc8120226..ae61347a16b06 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionResource.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotServicePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.BotService public partial class BotServicePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/BotServiceExtensions.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/BotServiceExtensions.cs index 4eb4e44ed9cc0..e7214d47daa1e 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/BotServiceExtensions.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/BotServiceExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.BotService.Mocking; using Azure.ResourceManager.BotService.Models; using Azure.ResourceManager.Resources; @@ -19,135 +20,102 @@ namespace Azure.ResourceManager.BotService /// A class to add extension methods to Azure.ResourceManager.BotService. public static partial class BotServiceExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableBotServiceArmClient GetMockableBotServiceArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableBotServiceArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableBotServiceResourceGroupResource GetMockableBotServiceResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableBotServiceResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableBotServiceSubscriptionResource GetMockableBotServiceSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableBotServiceSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableBotServiceTenantResource GetMockableBotServiceTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableBotServiceTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region BotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BotResource GetBotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BotResource.ValidateResourceId(id); - return new BotResource(client, id); - } - ); + return GetMockableBotServiceArmClient(client).GetBotResource(id); } - #endregion - #region BotChannelResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BotChannelResource GetBotChannelResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BotChannelResource.ValidateResourceId(id); - return new BotChannelResource(client, id); - } - ); + return GetMockableBotServiceArmClient(client).GetBotChannelResource(id); } - #endregion - #region BotConnectionSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BotConnectionSettingResource GetBotConnectionSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BotConnectionSettingResource.ValidateResourceId(id); - return new BotConnectionSettingResource(client, id); - } - ); + return GetMockableBotServiceArmClient(client).GetBotConnectionSettingResource(id); } - #endregion - #region BotServicePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BotServicePrivateEndpointConnectionResource GetBotServicePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BotServicePrivateEndpointConnectionResource.ValidateResourceId(id); - return new BotServicePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableBotServiceArmClient(client).GetBotServicePrivateEndpointConnectionResource(id); } - #endregion - /// Gets a collection of BotResources in the ResourceGroupResource. + /// + /// Gets a collection of BotResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BotResources and their operations over a BotResource. public static BotCollection GetBots(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBots(); + return GetMockableBotServiceResourceGroupResource(resourceGroupResource).GetBots(); } /// @@ -162,16 +130,20 @@ public static BotCollection GetBots(this ResourceGroupResource resourceGroupReso /// Bots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Bot resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBotAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBots().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableBotServiceResourceGroupResource(resourceGroupResource).GetBotAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -186,16 +158,20 @@ public static async Task> GetBotAsync(this ResourceGroupRe /// Bots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Bot resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBot(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBots().Get(resourceName, cancellationToken); + return GetMockableBotServiceResourceGroupResource(resourceGroupResource).GetBot(resourceName, cancellationToken); } /// @@ -210,13 +186,17 @@ public static Response GetBot(this ResourceGroupResource resourceGr /// Bots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBotsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBotsAsync(cancellationToken); + return GetMockableBotServiceSubscriptionResource(subscriptionResource).GetBotsAsync(cancellationToken); } /// @@ -231,13 +211,17 @@ public static AsyncPageable GetBotsAsync(this SubscriptionResource /// Bots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBots(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBots(cancellationToken); + return GetMockableBotServiceSubscriptionResource(subscriptionResource).GetBots(cancellationToken); } /// @@ -252,13 +236,17 @@ public static Pageable GetBots(this SubscriptionResource subscripti /// BotConnection_ListServiceProviders /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBotConnectionServiceProvidersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBotConnectionServiceProvidersAsync(cancellationToken); + return GetMockableBotServiceSubscriptionResource(subscriptionResource).GetBotConnectionServiceProvidersAsync(cancellationToken); } /// @@ -273,13 +261,17 @@ public static AsyncPageable GetBotConnectionServiceProviders /// BotConnection_ListServiceProviders /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBotConnectionServiceProviders(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBotConnectionServiceProviders(cancellationToken); + return GetMockableBotServiceSubscriptionResource(subscriptionResource).GetBotConnectionServiceProviders(cancellationToken); } /// @@ -294,6 +286,10 @@ public static Pageable GetBotConnectionServiceProviders(this /// QnAMakerEndpointKeys_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The request body parameters to provide for the check name availability request. @@ -301,9 +297,7 @@ public static Pageable GetBotConnectionServiceProviders(this /// is null. public static async Task> GetBotServiceQnAMakerEndpointKeyAsync(this SubscriptionResource subscriptionResource, GetBotServiceQnAMakerEndpointKeyContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetBotServiceQnAMakerEndpointKeyAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableBotServiceSubscriptionResource(subscriptionResource).GetBotServiceQnAMakerEndpointKeyAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -318,6 +312,10 @@ public static async Task> GetBo /// QnAMakerEndpointKeys_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The request body parameters to provide for the check name availability request. @@ -325,9 +323,7 @@ public static async Task> GetBo /// is null. public static Response GetBotServiceQnAMakerEndpointKey(this SubscriptionResource subscriptionResource, GetBotServiceQnAMakerEndpointKeyContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBotServiceQnAMakerEndpointKey(content, cancellationToken); + return GetMockableBotServiceSubscriptionResource(subscriptionResource).GetBotServiceQnAMakerEndpointKey(content, cancellationToken); } /// @@ -342,12 +338,16 @@ public static Response GetBotServiceQnAM /// HostSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetBotServiceHostSettingsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetBotServiceHostSettingsAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableBotServiceSubscriptionResource(subscriptionResource).GetBotServiceHostSettingsAsync(cancellationToken).ConfigureAwait(false); } /// @@ -362,12 +362,16 @@ public static async Task> GetBotServiceHo /// HostSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetBotServiceHostSettings(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBotServiceHostSettings(cancellationToken); + return GetMockableBotServiceSubscriptionResource(subscriptionResource).GetBotServiceHostSettings(cancellationToken); } /// @@ -382,6 +386,10 @@ public static Response GetBotServiceHostSettings(t /// Bots_GetCheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The request body parameters to provide for the check name availability request. @@ -389,9 +397,7 @@ public static Response GetBotServiceHostSettings(t /// is null. public static async Task> CheckBotServiceNameAvailabilityAsync(this TenantResource tenantResource, BotServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).CheckBotServiceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableBotServiceTenantResource(tenantResource).CheckBotServiceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -406,6 +412,10 @@ public static async Task> CheckBotSer /// Bots_GetCheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The request body parameters to provide for the check name availability request. @@ -413,9 +423,7 @@ public static async Task> CheckBotSer /// is null. public static Response CheckBotServiceNameAvailability(this TenantResource tenantResource, BotServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).CheckBotServiceNameAvailability(content, cancellationToken); + return GetMockableBotServiceTenantResource(tenantResource).CheckBotServiceNameAvailability(content, cancellationToken); } } } diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceArmClient.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceArmClient.cs new file mode 100644 index 0000000000000..976e82b4a5c39 --- /dev/null +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.BotService; + +namespace Azure.ResourceManager.BotService.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableBotServiceArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableBotServiceArmClient() + { + } + + /// 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 MockableBotServiceArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableBotServiceArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BotResource GetBotResource(ResourceIdentifier id) + { + BotResource.ValidateResourceId(id); + return new BotResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BotChannelResource GetBotChannelResource(ResourceIdentifier id) + { + BotChannelResource.ValidateResourceId(id); + return new BotChannelResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BotConnectionSettingResource GetBotConnectionSettingResource(ResourceIdentifier id) + { + BotConnectionSettingResource.ValidateResourceId(id); + return new BotConnectionSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BotServicePrivateEndpointConnectionResource GetBotServicePrivateEndpointConnectionResource(ResourceIdentifier id) + { + BotServicePrivateEndpointConnectionResource.ValidateResourceId(id); + return new BotServicePrivateEndpointConnectionResource(Client, id); + } + } +} diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceResourceGroupResource.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceResourceGroupResource.cs new file mode 100644 index 0000000000000..3757eca7ddb5e --- /dev/null +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.BotService; + +namespace Azure.ResourceManager.BotService.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableBotServiceResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableBotServiceResourceGroupResource() + { + } + + /// 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 MockableBotServiceResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of BotResources in the ResourceGroupResource. + /// An object representing collection of BotResources and their operations over a BotResource. + public virtual BotCollection GetBots() + { + return GetCachedClient(client => new BotCollection(client, Id)); + } + + /// + /// Returns a BotService specified by the parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName} + /// + /// + /// Operation Id + /// Bots_Get + /// + /// + /// + /// The name of the Bot resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBotAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetBots().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a BotService specified by the parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName} + /// + /// + /// Operation Id + /// Bots_Get + /// + /// + /// + /// The name of the Bot resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBot(string resourceName, CancellationToken cancellationToken = default) + { + return GetBots().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceSubscriptionResource.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceSubscriptionResource.cs new file mode 100644 index 0000000000000..e84f7f7ca0fe2 --- /dev/null +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceSubscriptionResource.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.BotService; +using Azure.ResourceManager.BotService.Models; + +namespace Azure.ResourceManager.BotService.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableBotServiceSubscriptionResource : ArmResource + { + private ClientDiagnostics _botClientDiagnostics; + private BotsRestOperations _botRestClient; + private ClientDiagnostics _botConnectionSettingBotConnectionClientDiagnostics; + private BotConnectionRestOperations _botConnectionSettingBotConnectionRestClient; + private ClientDiagnostics _qnAMakerEndpointKeysClientDiagnostics; + private QnAMakerEndpointKeysRestOperations _qnAMakerEndpointKeysRestClient; + private ClientDiagnostics _hostSettingsClientDiagnostics; + private HostSettingsRestOperations _hostSettingsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableBotServiceSubscriptionResource() + { + } + + /// 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 MockableBotServiceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics BotClientDiagnostics => _botClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", BotResource.ResourceType.Namespace, Diagnostics); + private BotsRestOperations BotRestClient => _botRestClient ??= new BotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BotResource.ResourceType)); + private ClientDiagnostics BotConnectionSettingBotConnectionClientDiagnostics => _botConnectionSettingBotConnectionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", BotConnectionSettingResource.ResourceType.Namespace, Diagnostics); + private BotConnectionRestOperations BotConnectionSettingBotConnectionRestClient => _botConnectionSettingBotConnectionRestClient ??= new BotConnectionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BotConnectionSettingResource.ResourceType)); + private ClientDiagnostics QnAMakerEndpointKeysClientDiagnostics => _qnAMakerEndpointKeysClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private QnAMakerEndpointKeysRestOperations QnAMakerEndpointKeysRestClient => _qnAMakerEndpointKeysRestClient ??= new QnAMakerEndpointKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics HostSettingsClientDiagnostics => _hostSettingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private HostSettingsRestOperations HostSettingsRestClient => _hostSettingsRestClient ??= new HostSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices + /// + /// + /// Operation Id + /// Bots_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBotsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BotRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BotResource(Client, BotData.DeserializeBotData(e)), BotClientDiagnostics, Pipeline, "MockableBotServiceSubscriptionResource.GetBots", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices + /// + /// + /// Operation Id + /// Bots_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBots(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BotRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BotResource(Client, BotData.DeserializeBotData(e)), BotClientDiagnostics, Pipeline, "MockableBotServiceSubscriptionResource.GetBots", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the available Service Providers for creating Connection Settings + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders + /// + /// + /// Operation Id + /// BotConnection_ListServiceProviders + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBotConnectionServiceProvidersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BotConnectionSettingBotConnectionRestClient.CreateListServiceProvidersRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, BotServiceProvider.DeserializeBotServiceProvider, BotConnectionSettingBotConnectionClientDiagnostics, Pipeline, "MockableBotServiceSubscriptionResource.GetBotConnectionServiceProviders", "value", null, cancellationToken); + } + + /// + /// Lists the available Service Providers for creating Connection Settings + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders + /// + /// + /// Operation Id + /// BotConnection_ListServiceProviders + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBotConnectionServiceProviders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BotConnectionSettingBotConnectionRestClient.CreateListServiceProvidersRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, BotServiceProvider.DeserializeBotServiceProvider, BotConnectionSettingBotConnectionClientDiagnostics, Pipeline, "MockableBotServiceSubscriptionResource.GetBotConnectionServiceProviders", "value", null, cancellationToken); + } + + /// + /// Lists the QnA Maker endpoint keys + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys + /// + /// + /// Operation Id + /// QnAMakerEndpointKeys_Get + /// + /// + /// + /// The request body parameters to provide for the check name availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetBotServiceQnAMakerEndpointKeyAsync(GetBotServiceQnAMakerEndpointKeyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = QnAMakerEndpointKeysClientDiagnostics.CreateScope("MockableBotServiceSubscriptionResource.GetBotServiceQnAMakerEndpointKey"); + scope.Start(); + try + { + var response = await QnAMakerEndpointKeysRestClient.GetAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the QnA Maker endpoint keys + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys + /// + /// + /// Operation Id + /// QnAMakerEndpointKeys_Get + /// + /// + /// + /// The request body parameters to provide for the check name availability request. + /// The cancellation token to use. + /// is null. + public virtual Response GetBotServiceQnAMakerEndpointKey(GetBotServiceQnAMakerEndpointKeyContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = QnAMakerEndpointKeysClientDiagnostics.CreateScope("MockableBotServiceSubscriptionResource.GetBotServiceQnAMakerEndpointKey"); + scope.Start(); + try + { + var response = QnAMakerEndpointKeysRestClient.Get(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get per subscription settings needed to host bot in compute resource such as Azure App Service + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings + /// + /// + /// Operation Id + /// HostSettings_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetBotServiceHostSettingsAsync(CancellationToken cancellationToken = default) + { + using var scope = HostSettingsClientDiagnostics.CreateScope("MockableBotServiceSubscriptionResource.GetBotServiceHostSettings"); + scope.Start(); + try + { + var response = await HostSettingsRestClient.GetAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get per subscription settings needed to host bot in compute resource such as Azure App Service + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings + /// + /// + /// Operation Id + /// HostSettings_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetBotServiceHostSettings(CancellationToken cancellationToken = default) + { + using var scope = HostSettingsClientDiagnostics.CreateScope("MockableBotServiceSubscriptionResource.GetBotServiceHostSettings"); + scope.Start(); + try + { + var response = HostSettingsRestClient.Get(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceTenantResource.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceTenantResource.cs new file mode 100644 index 0000000000000..194143d0c9aed --- /dev/null +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/MockableBotServiceTenantResource.cs @@ -0,0 +1,115 @@ +// 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; +using Azure.ResourceManager.BotService; +using Azure.ResourceManager.BotService.Models; + +namespace Azure.ResourceManager.BotService.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableBotServiceTenantResource : ArmResource + { + private ClientDiagnostics _botClientDiagnostics; + private BotsRestOperations _botRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableBotServiceTenantResource() + { + } + + /// 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 MockableBotServiceTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics BotClientDiagnostics => _botClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", BotResource.ResourceType.Namespace, Diagnostics); + private BotsRestOperations BotRestClient => _botRestClient ??= new BotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BotResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Check whether a bot name is available. + /// + /// + /// Request Path + /// /providers/Microsoft.BotService/checkNameAvailability + /// + /// + /// Operation Id + /// Bots_GetCheckNameAvailability + /// + /// + /// + /// The request body parameters to provide for the check name availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckBotServiceNameAvailabilityAsync(BotServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BotClientDiagnostics.CreateScope("MockableBotServiceTenantResource.CheckBotServiceNameAvailability"); + scope.Start(); + try + { + var response = await BotRestClient.GetCheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check whether a bot name is available. + /// + /// + /// Request Path + /// /providers/Microsoft.BotService/checkNameAvailability + /// + /// + /// Operation Id + /// Bots_GetCheckNameAvailability + /// + /// + /// + /// The request body parameters to provide for the check name availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckBotServiceNameAvailability(BotServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BotClientDiagnostics.CreateScope("MockableBotServiceTenantResource.CheckBotServiceNameAvailability"); + scope.Start(); + try + { + var response = BotRestClient.GetCheckNameAvailability(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ed082aca11749..0000000000000 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.BotService -{ - /// 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 BotResources in the ResourceGroupResource. - /// An object representing collection of BotResources and their operations over a BotResource. - public virtual BotCollection GetBots() - { - return GetCachedClient(Client => new BotCollection(Client, Id)); - } - } -} diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 1ee03e510f373..0000000000000 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.BotService.Models; - -namespace Azure.ResourceManager.BotService -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _botClientDiagnostics; - private BotsRestOperations _botRestClient; - private ClientDiagnostics _botConnectionSettingBotConnectionClientDiagnostics; - private BotConnectionRestOperations _botConnectionSettingBotConnectionRestClient; - private ClientDiagnostics _qnAMakerEndpointKeysClientDiagnostics; - private QnAMakerEndpointKeysRestOperations _qnAMakerEndpointKeysRestClient; - private ClientDiagnostics _hostSettingsClientDiagnostics; - private HostSettingsRestOperations _hostSettingsRestClient; - - /// 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 BotClientDiagnostics => _botClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", BotResource.ResourceType.Namespace, Diagnostics); - private BotsRestOperations BotRestClient => _botRestClient ??= new BotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BotResource.ResourceType)); - private ClientDiagnostics BotConnectionSettingBotConnectionClientDiagnostics => _botConnectionSettingBotConnectionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", BotConnectionSettingResource.ResourceType.Namespace, Diagnostics); - private BotConnectionRestOperations BotConnectionSettingBotConnectionRestClient => _botConnectionSettingBotConnectionRestClient ??= new BotConnectionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BotConnectionSettingResource.ResourceType)); - private ClientDiagnostics QnAMakerEndpointKeysClientDiagnostics => _qnAMakerEndpointKeysClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private QnAMakerEndpointKeysRestOperations QnAMakerEndpointKeysRestClient => _qnAMakerEndpointKeysRestClient ??= new QnAMakerEndpointKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics HostSettingsClientDiagnostics => _hostSettingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private HostSettingsRestOperations HostSettingsRestClient => _hostSettingsRestClient ??= new HostSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices - /// - /// - /// Operation Id - /// Bots_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBotsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BotRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BotResource(Client, BotData.DeserializeBotData(e)), BotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBots", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices - /// - /// - /// Operation Id - /// Bots_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBots(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BotRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BotResource(Client, BotData.DeserializeBotData(e)), BotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBots", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the available Service Providers for creating Connection Settings - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders - /// - /// - /// Operation Id - /// BotConnection_ListServiceProviders - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBotConnectionServiceProvidersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BotConnectionSettingBotConnectionRestClient.CreateListServiceProvidersRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, BotServiceProvider.DeserializeBotServiceProvider, BotConnectionSettingBotConnectionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBotConnectionServiceProviders", "value", null, cancellationToken); - } - - /// - /// Lists the available Service Providers for creating Connection Settings - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders - /// - /// - /// Operation Id - /// BotConnection_ListServiceProviders - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBotConnectionServiceProviders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BotConnectionSettingBotConnectionRestClient.CreateListServiceProvidersRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, BotServiceProvider.DeserializeBotServiceProvider, BotConnectionSettingBotConnectionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBotConnectionServiceProviders", "value", null, cancellationToken); - } - - /// - /// Lists the QnA Maker endpoint keys - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys - /// - /// - /// Operation Id - /// QnAMakerEndpointKeys_Get - /// - /// - /// - /// The request body parameters to provide for the check name availability request. - /// The cancellation token to use. - public virtual async Task> GetBotServiceQnAMakerEndpointKeyAsync(GetBotServiceQnAMakerEndpointKeyContent content, CancellationToken cancellationToken = default) - { - using var scope = QnAMakerEndpointKeysClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetBotServiceQnAMakerEndpointKey"); - scope.Start(); - try - { - var response = await QnAMakerEndpointKeysRestClient.GetAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the QnA Maker endpoint keys - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys - /// - /// - /// Operation Id - /// QnAMakerEndpointKeys_Get - /// - /// - /// - /// The request body parameters to provide for the check name availability request. - /// The cancellation token to use. - public virtual Response GetBotServiceQnAMakerEndpointKey(GetBotServiceQnAMakerEndpointKeyContent content, CancellationToken cancellationToken = default) - { - using var scope = QnAMakerEndpointKeysClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetBotServiceQnAMakerEndpointKey"); - scope.Start(); - try - { - var response = QnAMakerEndpointKeysRestClient.Get(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get per subscription settings needed to host bot in compute resource such as Azure App Service - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings - /// - /// - /// Operation Id - /// HostSettings_Get - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetBotServiceHostSettingsAsync(CancellationToken cancellationToken = default) - { - using var scope = HostSettingsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetBotServiceHostSettings"); - scope.Start(); - try - { - var response = await HostSettingsRestClient.GetAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get per subscription settings needed to host bot in compute resource such as Azure App Service - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings - /// - /// - /// Operation Id - /// HostSettings_Get - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetBotServiceHostSettings(CancellationToken cancellationToken = default) - { - using var scope = HostSettingsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetBotServiceHostSettings"); - scope.Start(); - try - { - var response = HostSettingsRestClient.Get(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index d932c20a1a6ec..0000000000000 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,108 +0,0 @@ -// 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; -using Azure.ResourceManager.BotService.Models; - -namespace Azure.ResourceManager.BotService -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _botClientDiagnostics; - private BotsRestOperations _botRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics BotClientDiagnostics => _botClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.BotService", BotResource.ResourceType.Namespace, Diagnostics); - private BotsRestOperations BotRestClient => _botRestClient ??= new BotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BotResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Check whether a bot name is available. - /// - /// - /// Request Path - /// /providers/Microsoft.BotService/checkNameAvailability - /// - /// - /// Operation Id - /// Bots_GetCheckNameAvailability - /// - /// - /// - /// The request body parameters to provide for the check name availability request. - /// The cancellation token to use. - public virtual async Task> CheckBotServiceNameAvailabilityAsync(BotServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = BotClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckBotServiceNameAvailability"); - scope.Start(); - try - { - var response = await BotRestClient.GetCheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check whether a bot name is available. - /// - /// - /// Request Path - /// /providers/Microsoft.BotService/checkNameAvailability - /// - /// - /// Operation Id - /// Bots_GetCheckNameAvailability - /// - /// - /// - /// The request body parameters to provide for the check name availability request. - /// The cancellation token to use. - public virtual Response CheckBotServiceNameAvailability(BotServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = BotClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckBotServiceNameAvailability"); - scope.Start(); - try - { - var response = BotRestClient.GetCheckNameAvailability(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/api/Azure.ResourceManager.Cdn.netstandard2.0.cs b/sdk/cdn/Azure.ResourceManager.Cdn/api/Azure.ResourceManager.Cdn.netstandard2.0.cs index 8ffe95e7fadf4..3bdbc917c5727 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/api/Azure.ResourceManager.Cdn.netstandard2.0.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/api/Azure.ResourceManager.Cdn.netstandard2.0.cs @@ -65,7 +65,7 @@ protected CdnEndpointCollection() { } } public partial class CdnEndpointData : Azure.ResourceManager.Models.TrackedResourceData { - public CdnEndpointData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CdnEndpointData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList ContentTypesToCompress { get { throw null; } } public System.Collections.Generic.IReadOnlyList CustomDomains { get { throw null; } } public Azure.Core.ResourceIdentifier DefaultOriginGroupId { get { throw null; } set { } } @@ -277,7 +277,7 @@ protected CdnWebApplicationFirewallPolicyCollection() { } } public partial class CdnWebApplicationFirewallPolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public CdnWebApplicationFirewallPolicyData(Azure.Core.AzureLocation location, Azure.ResourceManager.Cdn.Models.CdnSku sku) : base (default(Azure.Core.AzureLocation)) { } + public CdnWebApplicationFirewallPolicyData(Azure.Core.AzureLocation location, Azure.ResourceManager.Cdn.Models.CdnSku sku) { } public System.Collections.Generic.IList CustomRules { get { throw null; } } public System.Collections.Generic.IReadOnlyList EndpointLinks { get { throw null; } } public Azure.ETag? ETag { get { throw null; } set { } } @@ -373,7 +373,7 @@ protected FrontDoorEndpointCollection() { } } public partial class FrontDoorEndpointData : Azure.ResourceManager.Models.TrackedResourceData { - public FrontDoorEndpointData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FrontDoorEndpointData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Cdn.Models.DomainNameLabelScope? AutoGeneratedDomainNameLabelScope { get { throw null; } set { } } public Azure.ResourceManager.Cdn.Models.FrontDoorDeploymentStatus? DeploymentStatus { get { throw null; } } public Azure.ResourceManager.Cdn.Models.EnabledState? EnabledState { get { throw null; } set { } } @@ -736,7 +736,7 @@ protected ProfileCollection() { } } public partial class ProfileData : Azure.ResourceManager.Models.TrackedResourceData { - public ProfileData(Azure.Core.AzureLocation location, Azure.ResourceManager.Cdn.Models.CdnSku sku) : base (default(Azure.Core.AzureLocation)) { } + public ProfileData(Azure.Core.AzureLocation location, Azure.ResourceManager.Cdn.Models.CdnSku sku) { } public System.Guid? FrontDoorId { get { throw null; } } public string Kind { get { throw null; } } public int? OriginResponseTimeoutSeconds { get { throw null; } set { } } @@ -816,6 +816,62 @@ protected ProfileResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Cdn.Models.ProfilePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Cdn.Mocking +{ + public partial class MockableCdnArmClient : Azure.ResourceManager.ArmResource + { + protected MockableCdnArmClient() { } + public virtual Azure.ResourceManager.Cdn.CdnCustomDomainResource GetCdnCustomDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.CdnEndpointResource GetCdnEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.CdnOriginGroupResource GetCdnOriginGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.CdnOriginResource GetCdnOriginResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.CdnWebApplicationFirewallPolicyResource GetCdnWebApplicationFirewallPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorCustomDomainResource GetFrontDoorCustomDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorEndpointResource GetFrontDoorEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorOriginGroupResource GetFrontDoorOriginGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorOriginResource GetFrontDoorOriginResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorRouteResource GetFrontDoorRouteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorRuleResource GetFrontDoorRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorRuleSetResource GetFrontDoorRuleSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorSecretResource GetFrontDoorSecretResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.FrontDoorSecurityPolicyResource GetFrontDoorSecurityPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Cdn.ProfileResource GetProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableCdnResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableCdnResourceGroupResource() { } + public virtual Azure.Response CheckEndpointNameAvailability(Azure.ResourceManager.Cdn.Models.EndpointNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckEndpointNameAvailabilityAsync(Azure.ResourceManager.Cdn.Models.EndpointNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Cdn.CdnWebApplicationFirewallPolicyCollection GetCdnWebApplicationFirewallPolicies() { throw null; } + public virtual Azure.Response GetCdnWebApplicationFirewallPolicy(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCdnWebApplicationFirewallPolicyAsync(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetProfile(string profileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetProfileAsync(string profileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Cdn.ProfileCollection GetProfiles() { throw null; } + } + public partial class MockableCdnSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableCdnSubscriptionResource() { } + public virtual Azure.Response CheckCdnNameAvailabilityWithSubscription(Azure.ResourceManager.Cdn.Models.CdnNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckCdnNameAvailabilityWithSubscriptionAsync(Azure.ResourceManager.Cdn.Models.CdnNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedRuleSets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedRuleSetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProfiles(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetResourceUsages(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetResourceUsagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ValidateProbe(Azure.ResourceManager.Cdn.Models.ValidateProbeContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateProbeAsync(Azure.ResourceManager.Cdn.Models.ValidateProbeContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableCdnTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableCdnTenantResource() { } + public virtual Azure.Response CheckCdnNameAvailability(Azure.ResourceManager.Cdn.Models.CdnNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckCdnNameAvailabilityAsync(Azure.ResourceManager.Cdn.Models.CdnNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEdgeNodes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEdgeNodesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Cdn.Models { public static partial class ArmCdnModelFactory diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainResource.cs index 8643aac891301..5671ac7401db4 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnCustomDomainResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Cdn public partial class CdnCustomDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The endpointName. + /// The customDomainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string endpointName, string customDomainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointResource.cs index 75b5be037f9b2..3332dc38819bd 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Cdn public partial class CdnEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The endpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string endpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}"; @@ -93,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CdnOriginResources and their operations over a CdnOriginResource. public virtual CdnOriginCollection GetCdnOrigins() { - return GetCachedClient(Client => new CdnOriginCollection(Client, Id)); + return GetCachedClient(client => new CdnOriginCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual CdnOriginCollection GetCdnOrigins() /// /// Name of the origin which is unique within the endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCdnOriginAsync(string originName, CancellationToken cancellationToken = default) { @@ -134,8 +138,8 @@ public virtual async Task> GetCdnOriginAsync(string /// /// Name of the origin which is unique within the endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCdnOrigin(string originName, CancellationToken cancellationToken = default) { @@ -146,7 +150,7 @@ public virtual Response GetCdnOrigin(string originName, Cance /// An object representing collection of CdnOriginGroupResources and their operations over a CdnOriginGroupResource. public virtual CdnOriginGroupCollection GetCdnOriginGroups() { - return GetCachedClient(Client => new CdnOriginGroupCollection(Client, Id)); + return GetCachedClient(client => new CdnOriginGroupCollection(client, Id)); } /// @@ -164,8 +168,8 @@ public virtual CdnOriginGroupCollection GetCdnOriginGroups() /// /// Name of the origin group which is unique within the endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCdnOriginGroupAsync(string originGroupName, CancellationToken cancellationToken = default) { @@ -187,8 +191,8 @@ public virtual async Task> GetCdnOriginGroupAsy /// /// Name of the origin group which is unique within the endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCdnOriginGroup(string originGroupName, CancellationToken cancellationToken = default) { @@ -199,7 +203,7 @@ public virtual Response GetCdnOriginGroup(string originG /// An object representing collection of CdnCustomDomainResources and their operations over a CdnCustomDomainResource. public virtual CdnCustomDomainCollection GetCdnCustomDomains() { - return GetCachedClient(Client => new CdnCustomDomainCollection(Client, Id)); + return GetCachedClient(client => new CdnCustomDomainCollection(client, Id)); } /// @@ -217,8 +221,8 @@ public virtual CdnCustomDomainCollection GetCdnCustomDomains() /// /// Name of the custom domain within an endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCdnCustomDomainAsync(string customDomainName, CancellationToken cancellationToken = default) { @@ -240,8 +244,8 @@ public virtual async Task> GetCdnCustomDomainA /// /// Name of the custom domain within an endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCdnCustomDomain(string customDomainName, CancellationToken cancellationToken = default) { diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupResource.cs index ad2a1a8b20973..3b1e8f12729c1 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginGroupResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Cdn public partial class CdnOriginGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The endpointName. + /// The originGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string endpointName, string originGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/originGroups/{originGroupName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginResource.cs index d863642e39299..da8a16cbbd27f 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnOriginResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Cdn public partial class CdnOriginResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The endpointName. + /// The originName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string endpointName, string originName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyResource.cs index 69930f416df50..00c878e97f860 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnWebApplicationFirewallPolicyResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Cdn public partial class CdnWebApplicationFirewallPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/CdnExtensions.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/CdnExtensions.cs index 33559f67d6c8f..7ed94c92359b0 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/CdnExtensions.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/CdnExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Cdn.Mocking; using Azure.ResourceManager.Cdn.Models; using Azure.ResourceManager.Resources; @@ -19,344 +20,278 @@ namespace Azure.ResourceManager.Cdn /// A class to add extension methods to Azure.ResourceManager.Cdn. public static partial class CdnExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableCdnArmClient GetMockableCdnArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableCdnArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCdnResourceGroupResource GetMockableCdnResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCdnResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableCdnSubscriptionResource GetMockableCdnSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableCdnSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCdnTenantResource GetMockableCdnTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCdnTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region FrontDoorCustomDomainResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorCustomDomainResource GetFrontDoorCustomDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorCustomDomainResource.ValidateResourceId(id); - return new FrontDoorCustomDomainResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorCustomDomainResource(id); } - #endregion - #region FrontDoorEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorEndpointResource GetFrontDoorEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorEndpointResource.ValidateResourceId(id); - return new FrontDoorEndpointResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorEndpointResource(id); } - #endregion - #region FrontDoorOriginGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorOriginGroupResource GetFrontDoorOriginGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorOriginGroupResource.ValidateResourceId(id); - return new FrontDoorOriginGroupResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorOriginGroupResource(id); } - #endregion - #region FrontDoorOriginResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorOriginResource GetFrontDoorOriginResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorOriginResource.ValidateResourceId(id); - return new FrontDoorOriginResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorOriginResource(id); } - #endregion - #region FrontDoorRouteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorRouteResource GetFrontDoorRouteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorRouteResource.ValidateResourceId(id); - return new FrontDoorRouteResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorRouteResource(id); } - #endregion - #region FrontDoorRuleSetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorRuleSetResource GetFrontDoorRuleSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorRuleSetResource.ValidateResourceId(id); - return new FrontDoorRuleSetResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorRuleSetResource(id); } - #endregion - #region FrontDoorRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorRuleResource GetFrontDoorRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorRuleResource.ValidateResourceId(id); - return new FrontDoorRuleResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorRuleResource(id); } - #endregion - #region FrontDoorSecurityPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorSecurityPolicyResource GetFrontDoorSecurityPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorSecurityPolicyResource.ValidateResourceId(id); - return new FrontDoorSecurityPolicyResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorSecurityPolicyResource(id); } - #endregion - #region FrontDoorSecretResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorSecretResource GetFrontDoorSecretResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorSecretResource.ValidateResourceId(id); - return new FrontDoorSecretResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetFrontDoorSecretResource(id); } - #endregion - #region ProfileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProfileResource GetProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProfileResource.ValidateResourceId(id); - return new ProfileResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetProfileResource(id); } - #endregion - #region CdnEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CdnEndpointResource GetCdnEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CdnEndpointResource.ValidateResourceId(id); - return new CdnEndpointResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetCdnEndpointResource(id); } - #endregion - #region CdnOriginResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CdnOriginResource GetCdnOriginResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CdnOriginResource.ValidateResourceId(id); - return new CdnOriginResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetCdnOriginResource(id); } - #endregion - #region CdnOriginGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CdnOriginGroupResource GetCdnOriginGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CdnOriginGroupResource.ValidateResourceId(id); - return new CdnOriginGroupResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetCdnOriginGroupResource(id); } - #endregion - #region CdnCustomDomainResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CdnCustomDomainResource GetCdnCustomDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CdnCustomDomainResource.ValidateResourceId(id); - return new CdnCustomDomainResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetCdnCustomDomainResource(id); } - #endregion - #region CdnWebApplicationFirewallPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CdnWebApplicationFirewallPolicyResource GetCdnWebApplicationFirewallPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CdnWebApplicationFirewallPolicyResource.ValidateResourceId(id); - return new CdnWebApplicationFirewallPolicyResource(client, id); - } - ); + return GetMockableCdnArmClient(client).GetCdnWebApplicationFirewallPolicyResource(id); } - #endregion - /// Gets a collection of ProfileResources in the ResourceGroupResource. + /// + /// Gets a collection of ProfileResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ProfileResources and their operations over a ProfileResource. public static ProfileCollection GetProfiles(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetProfiles(); + return GetMockableCdnResourceGroupResource(resourceGroupResource).GetProfiles(); } /// @@ -371,16 +306,20 @@ public static ProfileCollection GetProfiles(this ResourceGroupResource resourceG /// Profiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetProfileAsync(this ResourceGroupResource resourceGroupResource, string profileName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetProfiles().GetAsync(profileName, cancellationToken).ConfigureAwait(false); + return await GetMockableCdnResourceGroupResource(resourceGroupResource).GetProfileAsync(profileName, cancellationToken).ConfigureAwait(false); } /// @@ -395,24 +334,34 @@ public static async Task> GetProfileAsync(this Resourc /// Profiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetProfile(this ResourceGroupResource resourceGroupResource, string profileName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetProfiles().Get(profileName, cancellationToken); + return GetMockableCdnResourceGroupResource(resourceGroupResource).GetProfile(profileName, cancellationToken); } - /// Gets a collection of CdnWebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of CdnWebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CdnWebApplicationFirewallPolicyResources and their operations over a CdnWebApplicationFirewallPolicyResource. public static CdnWebApplicationFirewallPolicyCollection GetCdnWebApplicationFirewallPolicies(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCdnWebApplicationFirewallPolicies(); + return GetMockableCdnResourceGroupResource(resourceGroupResource).GetCdnWebApplicationFirewallPolicies(); } /// @@ -427,16 +376,20 @@ public static CdnWebApplicationFirewallPolicyCollection GetCdnWebApplicationFire /// Policies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the CdnWebApplicationFirewallPolicy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCdnWebApplicationFirewallPolicyAsync(this ResourceGroupResource resourceGroupResource, string policyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCdnWebApplicationFirewallPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); + return await GetMockableCdnResourceGroupResource(resourceGroupResource).GetCdnWebApplicationFirewallPolicyAsync(policyName, cancellationToken).ConfigureAwait(false); } /// @@ -451,16 +404,20 @@ public static async Task> GetC /// Policies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the CdnWebApplicationFirewallPolicy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCdnWebApplicationFirewallPolicy(this ResourceGroupResource resourceGroupResource, string policyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCdnWebApplicationFirewallPolicies().Get(policyName, cancellationToken); + return GetMockableCdnResourceGroupResource(resourceGroupResource).GetCdnWebApplicationFirewallPolicy(policyName, cancellationToken); } /// @@ -475,6 +432,10 @@ public static Response GetCdnWebApplica /// CheckEndpointNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -482,9 +443,7 @@ public static Response GetCdnWebApplica /// is null. public static async Task> CheckEndpointNameAvailabilityAsync(this ResourceGroupResource resourceGroupResource, EndpointNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckEndpointNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCdnResourceGroupResource(resourceGroupResource).CheckEndpointNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -499,6 +458,10 @@ public static async Task> CheckEndpoint /// CheckEndpointNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -506,9 +469,7 @@ public static async Task> CheckEndpoint /// is null. public static Response CheckEndpointNameAvailability(this ResourceGroupResource resourceGroupResource, EndpointNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckEndpointNameAvailability(content, cancellationToken); + return GetMockableCdnResourceGroupResource(resourceGroupResource).CheckEndpointNameAvailability(content, cancellationToken); } /// @@ -523,6 +484,10 @@ public static Response CheckEndpointNameAvailabi /// CheckNameAvailabilityWithSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -530,9 +495,7 @@ public static Response CheckEndpointNameAvailabi /// is null. public static async Task> CheckCdnNameAvailabilityWithSubscriptionAsync(this SubscriptionResource subscriptionResource, CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckCdnNameAvailabilityWithSubscriptionAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCdnSubscriptionResource(subscriptionResource).CheckCdnNameAvailabilityWithSubscriptionAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -547,6 +510,10 @@ public static async Task> CheckCdnNameAvaila /// CheckNameAvailabilityWithSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -554,9 +521,7 @@ public static async Task> CheckCdnNameAvaila /// is null. public static Response CheckCdnNameAvailabilityWithSubscription(this SubscriptionResource subscriptionResource, CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckCdnNameAvailabilityWithSubscription(content, cancellationToken); + return GetMockableCdnSubscriptionResource(subscriptionResource).CheckCdnNameAvailabilityWithSubscription(content, cancellationToken); } /// @@ -571,6 +536,10 @@ public static Response CheckCdnNameAvailabilityWithSu /// ValidateProbe /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -578,9 +547,7 @@ public static Response CheckCdnNameAvailabilityWithSu /// is null. public static async Task> ValidateProbeAsync(this SubscriptionResource subscriptionResource, ValidateProbeContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateProbeAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCdnSubscriptionResource(subscriptionResource).ValidateProbeAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -595,6 +562,10 @@ public static async Task> ValidateProbeAsync(this /// ValidateProbe /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -602,9 +573,7 @@ public static async Task> ValidateProbeAsync(this /// is null. public static Response ValidateProbe(this SubscriptionResource subscriptionResource, ValidateProbeContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateProbe(content, cancellationToken); + return GetMockableCdnSubscriptionResource(subscriptionResource).ValidateProbe(content, cancellationToken); } /// @@ -619,13 +588,17 @@ public static Response ValidateProbe(this SubscriptionResou /// Profiles_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetProfilesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProfilesAsync(cancellationToken); + return GetMockableCdnSubscriptionResource(subscriptionResource).GetProfilesAsync(cancellationToken); } /// @@ -640,13 +613,17 @@ public static AsyncPageable GetProfilesAsync(this SubscriptionR /// Profiles_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetProfiles(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProfiles(cancellationToken); + return GetMockableCdnSubscriptionResource(subscriptionResource).GetProfiles(cancellationToken); } /// @@ -661,13 +638,17 @@ public static Pageable GetProfiles(this SubscriptionResource su /// ResourceUsage_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourceUsagesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceUsagesAsync(cancellationToken); + return GetMockableCdnSubscriptionResource(subscriptionResource).GetResourceUsagesAsync(cancellationToken); } /// @@ -682,13 +663,17 @@ public static AsyncPageable GetResourceUsagesAsync(this SubscriptionRe /// ResourceUsage_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourceUsages(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceUsages(cancellationToken); + return GetMockableCdnSubscriptionResource(subscriptionResource).GetResourceUsages(cancellationToken); } /// @@ -703,13 +688,17 @@ public static Pageable GetResourceUsages(this SubscriptionResource sub /// ManagedRuleSets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedRuleSetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedRuleSetsAsync(cancellationToken); + return GetMockableCdnSubscriptionResource(subscriptionResource).GetManagedRuleSetsAsync(cancellationToken); } /// @@ -724,13 +713,17 @@ public static AsyncPageable GetManagedRuleSetsAsync(th /// ManagedRuleSets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedRuleSets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedRuleSets(cancellationToken); + return GetMockableCdnSubscriptionResource(subscriptionResource).GetManagedRuleSets(cancellationToken); } /// @@ -745,6 +738,10 @@ public static Pageable GetManagedRuleSets(this Subscri /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -752,9 +749,7 @@ public static Pageable GetManagedRuleSets(this Subscri /// is null. public static async Task> CheckCdnNameAvailabilityAsync(this TenantResource tenantResource, CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).CheckCdnNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCdnTenantResource(tenantResource).CheckCdnNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -769,6 +764,10 @@ public static async Task> CheckCdnNameAvaila /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -776,9 +775,7 @@ public static async Task> CheckCdnNameAvaila /// is null. public static Response CheckCdnNameAvailability(this TenantResource tenantResource, CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).CheckCdnNameAvailability(content, cancellationToken); + return GetMockableCdnTenantResource(tenantResource).CheckCdnNameAvailability(content, cancellationToken); } /// @@ -793,13 +790,17 @@ public static Response CheckCdnNameAvailability(this /// EdgeNodes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEdgeNodesAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetEdgeNodesAsync(cancellationToken); + return GetMockableCdnTenantResource(tenantResource).GetEdgeNodesAsync(cancellationToken); } /// @@ -814,13 +815,17 @@ public static AsyncPageable GetEdgeNodesAsync(this TenantResource tena /// EdgeNodes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEdgeNodes(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetEdgeNodes(cancellationToken); + return GetMockableCdnTenantResource(tenantResource).GetEdgeNodes(cancellationToken); } } } diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnArmClient.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnArmClient.cs new file mode 100644 index 0000000000000..b18dd1bc1747a --- /dev/null +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnArmClient.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Cdn; + +namespace Azure.ResourceManager.Cdn.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableCdnArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCdnArmClient() + { + } + + /// 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 MockableCdnArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableCdnArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorCustomDomainResource GetFrontDoorCustomDomainResource(ResourceIdentifier id) + { + FrontDoorCustomDomainResource.ValidateResourceId(id); + return new FrontDoorCustomDomainResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorEndpointResource GetFrontDoorEndpointResource(ResourceIdentifier id) + { + FrontDoorEndpointResource.ValidateResourceId(id); + return new FrontDoorEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorOriginGroupResource GetFrontDoorOriginGroupResource(ResourceIdentifier id) + { + FrontDoorOriginGroupResource.ValidateResourceId(id); + return new FrontDoorOriginGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorOriginResource GetFrontDoorOriginResource(ResourceIdentifier id) + { + FrontDoorOriginResource.ValidateResourceId(id); + return new FrontDoorOriginResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorRouteResource GetFrontDoorRouteResource(ResourceIdentifier id) + { + FrontDoorRouteResource.ValidateResourceId(id); + return new FrontDoorRouteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorRuleSetResource GetFrontDoorRuleSetResource(ResourceIdentifier id) + { + FrontDoorRuleSetResource.ValidateResourceId(id); + return new FrontDoorRuleSetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorRuleResource GetFrontDoorRuleResource(ResourceIdentifier id) + { + FrontDoorRuleResource.ValidateResourceId(id); + return new FrontDoorRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorSecurityPolicyResource GetFrontDoorSecurityPolicyResource(ResourceIdentifier id) + { + FrontDoorSecurityPolicyResource.ValidateResourceId(id); + return new FrontDoorSecurityPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorSecretResource GetFrontDoorSecretResource(ResourceIdentifier id) + { + FrontDoorSecretResource.ValidateResourceId(id); + return new FrontDoorSecretResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProfileResource GetProfileResource(ResourceIdentifier id) + { + ProfileResource.ValidateResourceId(id); + return new ProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CdnEndpointResource GetCdnEndpointResource(ResourceIdentifier id) + { + CdnEndpointResource.ValidateResourceId(id); + return new CdnEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CdnOriginResource GetCdnOriginResource(ResourceIdentifier id) + { + CdnOriginResource.ValidateResourceId(id); + return new CdnOriginResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CdnOriginGroupResource GetCdnOriginGroupResource(ResourceIdentifier id) + { + CdnOriginGroupResource.ValidateResourceId(id); + return new CdnOriginGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CdnCustomDomainResource GetCdnCustomDomainResource(ResourceIdentifier id) + { + CdnCustomDomainResource.ValidateResourceId(id); + return new CdnCustomDomainResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CdnWebApplicationFirewallPolicyResource GetCdnWebApplicationFirewallPolicyResource(ResourceIdentifier id) + { + CdnWebApplicationFirewallPolicyResource.ValidateResourceId(id); + return new CdnWebApplicationFirewallPolicyResource(Client, id); + } + } +} diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnResourceGroupResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnResourceGroupResource.cs new file mode 100644 index 0000000000000..9fe87d3275f68 --- /dev/null +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnResourceGroupResource.cs @@ -0,0 +1,221 @@ +// 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; +using Azure.ResourceManager.Cdn; +using Azure.ResourceManager.Cdn.Models; + +namespace Azure.ResourceManager.Cdn.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableCdnResourceGroupResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private CdnManagementRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCdnResourceGroupResource() + { + } + + /// 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 MockableCdnResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CdnManagementRestOperations DefaultRestClient => _defaultRestClient ??= new CdnManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ProfileResources in the ResourceGroupResource. + /// An object representing collection of ProfileResources and their operations over a ProfileResource. + public virtual ProfileCollection GetProfiles() + { + return GetCachedClient(client => new ProfileCollection(client, Id)); + } + + /// + /// Gets an Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified profile name under the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetProfileAsync(string profileName, CancellationToken cancellationToken = default) + { + return await GetProfiles().GetAsync(profileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an Azure Front Door Standard or Azure Front Door Premium or CDN profile with the specified profile name under the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// Name of the Azure Front Door Standard or Azure Front Door Premium or CDN profile which is unique within the resource group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetProfile(string profileName, CancellationToken cancellationToken = default) + { + return GetProfiles().Get(profileName, cancellationToken); + } + + /// Gets a collection of CdnWebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// An object representing collection of CdnWebApplicationFirewallPolicyResources and their operations over a CdnWebApplicationFirewallPolicyResource. + public virtual CdnWebApplicationFirewallPolicyCollection GetCdnWebApplicationFirewallPolicies() + { + return GetCachedClient(client => new CdnWebApplicationFirewallPolicyCollection(client, Id)); + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCdnWebApplicationFirewallPolicyAsync(string policyName, CancellationToken cancellationToken = default) + { + return await GetCdnWebApplicationFirewallPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/cdnWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the CdnWebApplicationFirewallPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCdnWebApplicationFirewallPolicy(string policyName, CancellationToken cancellationToken = default) + { + return GetCdnWebApplicationFirewallPolicies().Get(policyName, cancellationToken); + } + + /// + /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a afdx endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability + /// + /// + /// Operation Id + /// CheckEndpointNameAvailability + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckEndpointNameAvailabilityAsync(EndpointNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCdnResourceGroupResource.CheckEndpointNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckEndpointNameAvailabilityAsync(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a afdx endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability + /// + /// + /// Operation Id + /// CheckEndpointNameAvailability + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckEndpointNameAvailability(EndpointNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCdnResourceGroupResource.CheckEndpointNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckEndpointNameAvailability(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnSubscriptionResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnSubscriptionResource.cs new file mode 100644 index 0000000000000..1bff5ee3510c9 --- /dev/null +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnSubscriptionResource.cs @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Cdn; +using Azure.ResourceManager.Cdn.Models; + +namespace Azure.ResourceManager.Cdn.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableCdnSubscriptionResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private CdnManagementRestOperations _defaultRestClient; + private ClientDiagnostics _profileClientDiagnostics; + private ProfilesRestOperations _profileRestClient; + private ClientDiagnostics _resourceUsageClientDiagnostics; + private ResourceUsageRestOperations _resourceUsageRestClient; + private ClientDiagnostics _managedRuleSetsClientDiagnostics; + private ManagedRuleSetsRestOperations _managedRuleSetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCdnSubscriptionResource() + { + } + + /// 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 MockableCdnSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CdnManagementRestOperations DefaultRestClient => _defaultRestClient ??= new CdnManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ProfileClientDiagnostics => _profileClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProfileResource.ResourceType.Namespace, Diagnostics); + private ProfilesRestOperations ProfileRestClient => _profileRestClient ??= new ProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ProfileResource.ResourceType)); + private ClientDiagnostics ResourceUsageClientDiagnostics => _resourceUsageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceUsageRestOperations ResourceUsageRestClient => _resourceUsageRestClient ??= new ResourceUsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ManagedRuleSetsClientDiagnostics => _managedRuleSetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ManagedRuleSetsRestOperations ManagedRuleSetsRestClient => _managedRuleSetsRestClient ??= new ManagedRuleSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailabilityWithSubscription + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckCdnNameAvailabilityWithSubscriptionAsync(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCdnSubscriptionResource.CheckCdnNameAvailabilityWithSubscription"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckNameAvailabilityWithSubscriptionAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailabilityWithSubscription + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckCdnNameAvailabilityWithSubscription(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCdnSubscriptionResource.CheckCdnNameAvailabilityWithSubscription"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckNameAvailabilityWithSubscription(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if the probe path is a valid path and the file can be accessed. Probe path is the path to a file hosted on the origin server to help accelerate the delivery of dynamic content via the CDN endpoint. This path is relative to the origin path specified in the endpoint configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe + /// + /// + /// Operation Id + /// ValidateProbe + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateProbeAsync(ValidateProbeContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCdnSubscriptionResource.ValidateProbe"); + scope.Start(); + try + { + var response = await DefaultRestClient.ValidateProbeAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if the probe path is a valid path and the file can be accessed. Probe path is the path to a file hosted on the origin server to help accelerate the delivery of dynamic content via the CDN endpoint. This path is relative to the origin path specified in the endpoint configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe + /// + /// + /// Operation Id + /// ValidateProbe + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateProbe(ValidateProbeContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCdnSubscriptionResource.ValidateProbe"); + scope.Start(); + try + { + var response = DefaultRestClient.ValidateProbe(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles + /// + /// + /// Operation Id + /// Profiles_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProfilesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProfileRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProfileRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), ProfileClientDiagnostics, Pipeline, "MockableCdnSubscriptionResource.GetProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles + /// + /// + /// Operation Id + /// Profiles_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProfiles(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProfileRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProfileRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), ProfileClientDiagnostics, Pipeline, "MockableCdnSubscriptionResource.GetProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Check the quota and actual usage of the CDN profiles under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage + /// + /// + /// Operation Id + /// ResourceUsage_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetResourceUsagesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceUsageRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceUsageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CdnUsage.DeserializeCdnUsage, ResourceUsageClientDiagnostics, Pipeline, "MockableCdnSubscriptionResource.GetResourceUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Check the quota and actual usage of the CDN profiles under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage + /// + /// + /// Operation Id + /// ResourceUsage_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetResourceUsages(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceUsageRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceUsageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CdnUsage.DeserializeCdnUsage, ResourceUsageClientDiagnostics, Pipeline, "MockableCdnSubscriptionResource.GetResourceUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all available managed rule sets. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets + /// + /// + /// Operation Id + /// ManagedRuleSets_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedRuleSetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedRuleSetsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedRuleSetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedRuleSetDefinition.DeserializeManagedRuleSetDefinition, ManagedRuleSetsClientDiagnostics, Pipeline, "MockableCdnSubscriptionResource.GetManagedRuleSets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all available managed rule sets. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets + /// + /// + /// Operation Id + /// ManagedRuleSets_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedRuleSets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedRuleSetsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedRuleSetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedRuleSetDefinition.DeserializeManagedRuleSetDefinition, ManagedRuleSetsClientDiagnostics, Pipeline, "MockableCdnSubscriptionResource.GetManagedRuleSets", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnTenantResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnTenantResource.cs new file mode 100644 index 0000000000000..1cdafbdbc94be --- /dev/null +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/MockableCdnTenantResource.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Cdn; +using Azure.ResourceManager.Cdn.Models; + +namespace Azure.ResourceManager.Cdn.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableCdnTenantResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private CdnManagementRestOperations _defaultRestClient; + private ClientDiagnostics _edgeNodesClientDiagnostics; + private EdgeNodesRestOperations _edgeNodesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCdnTenantResource() + { + } + + /// 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 MockableCdnTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CdnManagementRestOperations DefaultRestClient => _defaultRestClient ??= new CdnManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics EdgeNodesClientDiagnostics => _edgeNodesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private EdgeNodesRestOperations EdgeNodesRestClient => _edgeNodesRestClient ??= new EdgeNodesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. + /// + /// + /// Request Path + /// /providers/Microsoft.Cdn/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckCdnNameAvailabilityAsync(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCdnTenantResource.CheckCdnNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. + /// + /// + /// Request Path + /// /providers/Microsoft.Cdn/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckCdnNameAvailability(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCdnTenantResource.CheckCdnNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckNameAvailability(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. + /// + /// + /// Request Path + /// /providers/Microsoft.Cdn/edgenodes + /// + /// + /// Operation Id + /// EdgeNodes_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEdgeNodesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeNodesRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeNodesRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EdgeNode.DeserializeEdgeNode, EdgeNodesClientDiagnostics, Pipeline, "MockableCdnTenantResource.GetEdgeNodes", "value", "nextLink", cancellationToken); + } + + /// + /// Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. + /// + /// + /// Request Path + /// /providers/Microsoft.Cdn/edgenodes + /// + /// + /// Operation Id + /// EdgeNodes_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEdgeNodes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeNodesRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeNodesRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EdgeNode.DeserializeEdgeNode, EdgeNodesClientDiagnostics, Pipeline, "MockableCdnTenantResource.GetEdgeNodes", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 96fe20d50a773..0000000000000 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,122 +0,0 @@ -// 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; -using Azure.ResourceManager.Cdn.Models; - -namespace Azure.ResourceManager.Cdn -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private CdnManagementRestOperations _defaultRestClient; - - /// 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 ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CdnManagementRestOperations DefaultRestClient => _defaultRestClient ??= new CdnManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ProfileResources in the ResourceGroupResource. - /// An object representing collection of ProfileResources and their operations over a ProfileResource. - public virtual ProfileCollection GetProfiles() - { - return GetCachedClient(Client => new ProfileCollection(Client, Id)); - } - - /// Gets a collection of CdnWebApplicationFirewallPolicyResources in the ResourceGroupResource. - /// An object representing collection of CdnWebApplicationFirewallPolicyResources and their operations over a CdnWebApplicationFirewallPolicyResource. - public virtual CdnWebApplicationFirewallPolicyCollection GetCdnWebApplicationFirewallPolicies() - { - return GetCachedClient(Client => new CdnWebApplicationFirewallPolicyCollection(Client, Id)); - } - - /// - /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a afdx endpoint. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability - /// - /// - /// Operation Id - /// CheckEndpointNameAvailability - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual async Task> CheckEndpointNameAvailabilityAsync(EndpointNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckEndpointNameAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckEndpointNameAvailabilityAsync(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a afdx endpoint. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/checkEndpointNameAvailability - /// - /// - /// Operation Id - /// CheckEndpointNameAvailability - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual Response CheckEndpointNameAvailability(EndpointNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckEndpointNameAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckEndpointNameAvailability(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 277cbfe600a8c..0000000000000 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,315 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Cdn.Models; - -namespace Azure.ResourceManager.Cdn -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private CdnManagementRestOperations _defaultRestClient; - private ClientDiagnostics _profileClientDiagnostics; - private ProfilesRestOperations _profileRestClient; - private ClientDiagnostics _resourceUsageClientDiagnostics; - private ResourceUsageRestOperations _resourceUsageRestClient; - private ClientDiagnostics _managedRuleSetsClientDiagnostics; - private ManagedRuleSetsRestOperations _managedRuleSetsRestClient; - - /// 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 DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CdnManagementRestOperations DefaultRestClient => _defaultRestClient ??= new CdnManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ProfileClientDiagnostics => _profileClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProfileResource.ResourceType.Namespace, Diagnostics); - private ProfilesRestOperations ProfileRestClient => _profileRestClient ??= new ProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ProfileResource.ResourceType)); - private ClientDiagnostics ResourceUsageClientDiagnostics => _resourceUsageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceUsageRestOperations ResourceUsageRestClient => _resourceUsageRestClient ??= new ResourceUsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ManagedRuleSetsClientDiagnostics => _managedRuleSetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ManagedRuleSetsRestOperations ManagedRuleSetsRestClient => _managedRuleSetsRestClient ??= new ManagedRuleSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailabilityWithSubscription - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual async Task> CheckCdnNameAvailabilityWithSubscriptionAsync(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckCdnNameAvailabilityWithSubscription"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckNameAvailabilityWithSubscriptionAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailabilityWithSubscription - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual Response CheckCdnNameAvailabilityWithSubscription(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckCdnNameAvailabilityWithSubscription"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckNameAvailabilityWithSubscription(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if the probe path is a valid path and the file can be accessed. Probe path is the path to a file hosted on the origin server to help accelerate the delivery of dynamic content via the CDN endpoint. This path is relative to the origin path specified in the endpoint configuration. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe - /// - /// - /// Operation Id - /// ValidateProbe - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual async Task> ValidateProbeAsync(ValidateProbeContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateProbe"); - scope.Start(); - try - { - var response = await DefaultRestClient.ValidateProbeAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if the probe path is a valid path and the file can be accessed. Probe path is the path to a file hosted on the origin server to help accelerate the delivery of dynamic content via the CDN endpoint. This path is relative to the origin path specified in the endpoint configuration. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/validateProbe - /// - /// - /// Operation Id - /// ValidateProbe - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual Response ValidateProbe(ValidateProbeContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateProbe"); - scope.Start(); - try - { - var response = DefaultRestClient.ValidateProbe(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles - /// - /// - /// Operation Id - /// Profiles_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProfilesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProfileRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProfileRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), ProfileClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProfiles", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the Azure Front Door Standard, Azure Front Door Premium, and CDN profiles within an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles - /// - /// - /// Operation Id - /// Profiles_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProfiles(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProfileRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProfileRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProfileResource(Client, ProfileData.DeserializeProfileData(e)), ProfileClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProfiles", "value", "nextLink", cancellationToken); - } - - /// - /// Check the quota and actual usage of the CDN profiles under the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage - /// - /// - /// Operation Id - /// ResourceUsage_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetResourceUsagesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceUsageRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceUsageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CdnUsage.DeserializeCdnUsage, ResourceUsageClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Check the quota and actual usage of the CDN profiles under the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/checkResourceUsage - /// - /// - /// Operation Id - /// ResourceUsage_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetResourceUsages(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceUsageRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceUsageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CdnUsage.DeserializeCdnUsage, ResourceUsageClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all available managed rule sets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets - /// - /// - /// Operation Id - /// ManagedRuleSets_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedRuleSetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedRuleSetsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedRuleSetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedRuleSetDefinition.DeserializeManagedRuleSetDefinition, ManagedRuleSetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedRuleSets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all available managed rule sets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cdn/cdnWebApplicationFirewallManagedRuleSets - /// - /// - /// Operation Id - /// ManagedRuleSets_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedRuleSets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedRuleSetsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedRuleSetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedRuleSetDefinition.DeserializeManagedRuleSetDefinition, ManagedRuleSetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedRuleSets", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 979ac5c9565ae..0000000000000 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Cdn.Models; - -namespace Azure.ResourceManager.Cdn -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private CdnManagementRestOperations _defaultRestClient; - private ClientDiagnostics _edgeNodesClientDiagnostics; - private EdgeNodesRestOperations _edgeNodesRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CdnManagementRestOperations DefaultRestClient => _defaultRestClient ??= new CdnManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics EdgeNodesClientDiagnostics => _edgeNodesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Cdn", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EdgeNodesRestOperations EdgeNodesRestClient => _edgeNodesRestClient ??= new EdgeNodesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. - /// - /// - /// Request Path - /// /providers/Microsoft.Cdn/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual async Task> CheckCdnNameAvailabilityAsync(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckCdnNameAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. - /// - /// - /// Request Path - /// /providers/Microsoft.Cdn/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual Response CheckCdnNameAvailability(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckCdnNameAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckNameAvailability(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. - /// - /// - /// Request Path - /// /providers/Microsoft.Cdn/edgenodes - /// - /// - /// Operation Id - /// EdgeNodes_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeNodesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeNodesRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeNodesRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EdgeNode.DeserializeEdgeNode, EdgeNodesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetEdgeNodes", "value", "nextLink", cancellationToken); - } - - /// - /// Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. - /// - /// - /// Request Path - /// /providers/Microsoft.Cdn/edgenodes - /// - /// - /// Operation Id - /// EdgeNodes_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeNodes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeNodesRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeNodesRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EdgeNode.DeserializeEdgeNode, EdgeNodesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetEdgeNodes", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainResource.cs index 9c966c6ffa9a6..90be499214002 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorCustomDomainResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorCustomDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The customDomainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string customDomainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/customDomains/{customDomainName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointResource.cs index 0444fa36d6a31..6817aefa340f5 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The endpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string endpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}"; @@ -93,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FrontDoorRouteResources and their operations over a FrontDoorRouteResource. public virtual FrontDoorRouteCollection GetFrontDoorRoutes() { - return GetCachedClient(Client => new FrontDoorRouteCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorRouteCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual FrontDoorRouteCollection GetFrontDoorRoutes() /// /// Name of the routing rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorRouteAsync(string routeName, CancellationToken cancellationToken = default) { @@ -134,8 +138,8 @@ public virtual async Task> GetFrontDoorRouteAsy /// /// Name of the routing rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorRoute(string routeName, CancellationToken cancellationToken = default) { diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupResource.cs index 7f21e219876a8..fa321715788dd 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorOriginGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The originGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string originGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FrontDoorOriginResources and their operations over a FrontDoorOriginResource. public virtual FrontDoorOriginCollection GetFrontDoorOrigins() { - return GetCachedClient(Client => new FrontDoorOriginCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorOriginCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual FrontDoorOriginCollection GetFrontDoorOrigins() /// /// Name of the origin which is unique within the profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorOriginAsync(string originName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetFrontDoorOriginA /// /// Name of the origin which is unique within the profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorOrigin(string originName, CancellationToken cancellationToken = default) { diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginResource.cs index 976de8134c846..79c57037fcd29 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorOriginResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The originGroupName. + /// The originName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string originGroupName, string originName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteResource.cs index c59090f3ef200..2997003fcf5dd 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRouteResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorRouteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The endpointName. + /// The routeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string endpointName, string routeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/afdEndpoints/{endpointName}/routes/{routeName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleResource.cs index 8bfeef3a9cfda..ecbc7cbe32eae 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The ruleSetName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string ruleSetName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}/rules/{ruleName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetResource.cs index 28a5a3bd06092..38da1a7be0de6 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorRuleSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The ruleSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string ruleSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/ruleSets/{ruleSetName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FrontDoorRuleResources and their operations over a FrontDoorRuleResource. public virtual FrontDoorRuleCollection GetFrontDoorRules() { - return GetCachedClient(Client => new FrontDoorRuleCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorRuleCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual FrontDoorRuleCollection GetFrontDoorRules() /// /// Name of the delivery rule which is unique within the endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorRuleAsync(string ruleName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetFrontDoorRuleAsync /// /// Name of the delivery rule which is unique within the endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorRule(string ruleName, CancellationToken cancellationToken = default) { diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretResource.cs index fcb1b31d44840..8b650b16e52bd 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecretResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorSecretResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The secretName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string secretName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/secrets/{secretName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyResource.cs index 6ff87cc0a8d6a..02e886dd0ce60 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorSecurityPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Cdn public partial class FrontDoorSecurityPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The securityPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string securityPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/securityPolicies/{securityPolicyName}"; diff --git a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileResource.cs index 1895bb6d9b094..109c7b84b4673 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Cdn public partial class ProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}"; @@ -102,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FrontDoorCustomDomainResources and their operations over a FrontDoorCustomDomainResource. public virtual FrontDoorCustomDomainCollection GetFrontDoorCustomDomains() { - return GetCachedClient(Client => new FrontDoorCustomDomainCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorCustomDomainCollection(client, Id)); } /// @@ -120,8 +123,8 @@ public virtual FrontDoorCustomDomainCollection GetFrontDoorCustomDomains() /// /// Name of the domain under the profile which is unique globally. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorCustomDomainAsync(string customDomainName, CancellationToken cancellationToken = default) { @@ -143,8 +146,8 @@ public virtual async Task> GetFrontDoorC /// /// Name of the domain under the profile which is unique globally. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorCustomDomain(string customDomainName, CancellationToken cancellationToken = default) { @@ -155,7 +158,7 @@ public virtual Response GetFrontDoorCustomDomain( /// An object representing collection of FrontDoorEndpointResources and their operations over a FrontDoorEndpointResource. public virtual FrontDoorEndpointCollection GetFrontDoorEndpoints() { - return GetCachedClient(Client => new FrontDoorEndpointCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorEndpointCollection(client, Id)); } /// @@ -173,8 +176,8 @@ public virtual FrontDoorEndpointCollection GetFrontDoorEndpoints() /// /// Name of the endpoint under the profile which is unique globally. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorEndpointAsync(string endpointName, CancellationToken cancellationToken = default) { @@ -196,8 +199,8 @@ public virtual async Task> GetFrontDoorEndpo /// /// Name of the endpoint under the profile which is unique globally. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorEndpoint(string endpointName, CancellationToken cancellationToken = default) { @@ -208,7 +211,7 @@ public virtual Response GetFrontDoorEndpoint(string e /// An object representing collection of FrontDoorOriginGroupResources and their operations over a FrontDoorOriginGroupResource. public virtual FrontDoorOriginGroupCollection GetFrontDoorOriginGroups() { - return GetCachedClient(Client => new FrontDoorOriginGroupCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorOriginGroupCollection(client, Id)); } /// @@ -226,8 +229,8 @@ public virtual FrontDoorOriginGroupCollection GetFrontDoorOriginGroups() /// /// Name of the origin group which is unique within the endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorOriginGroupAsync(string originGroupName, CancellationToken cancellationToken = default) { @@ -249,8 +252,8 @@ public virtual async Task> GetFrontDoorOr /// /// Name of the origin group which is unique within the endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorOriginGroup(string originGroupName, CancellationToken cancellationToken = default) { @@ -261,7 +264,7 @@ public virtual Response GetFrontDoorOriginGroup(st /// An object representing collection of FrontDoorRuleSetResources and their operations over a FrontDoorRuleSetResource. public virtual FrontDoorRuleSetCollection GetFrontDoorRuleSets() { - return GetCachedClient(Client => new FrontDoorRuleSetCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorRuleSetCollection(client, Id)); } /// @@ -279,8 +282,8 @@ public virtual FrontDoorRuleSetCollection GetFrontDoorRuleSets() /// /// Name of the rule set under the profile which is unique globally. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorRuleSetAsync(string ruleSetName, CancellationToken cancellationToken = default) { @@ -302,8 +305,8 @@ public virtual async Task> GetFrontDoorRuleSe /// /// Name of the rule set under the profile which is unique globally. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorRuleSet(string ruleSetName, CancellationToken cancellationToken = default) { @@ -314,7 +317,7 @@ public virtual Response GetFrontDoorRuleSet(string rul /// An object representing collection of FrontDoorSecurityPolicyResources and their operations over a FrontDoorSecurityPolicyResource. public virtual FrontDoorSecurityPolicyCollection GetFrontDoorSecurityPolicies() { - return GetCachedClient(Client => new FrontDoorSecurityPolicyCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorSecurityPolicyCollection(client, Id)); } /// @@ -332,8 +335,8 @@ public virtual FrontDoorSecurityPolicyCollection GetFrontDoorSecurityPolicies() /// /// Name of the security policy under the profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorSecurityPolicyAsync(string securityPolicyName, CancellationToken cancellationToken = default) { @@ -355,8 +358,8 @@ public virtual async Task> GetFrontDoo /// /// Name of the security policy under the profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorSecurityPolicy(string securityPolicyName, CancellationToken cancellationToken = default) { @@ -367,7 +370,7 @@ public virtual Response GetFrontDoorSecurityPol /// An object representing collection of FrontDoorSecretResources and their operations over a FrontDoorSecretResource. public virtual FrontDoorSecretCollection GetFrontDoorSecrets() { - return GetCachedClient(Client => new FrontDoorSecretCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorSecretCollection(client, Id)); } /// @@ -385,8 +388,8 @@ public virtual FrontDoorSecretCollection GetFrontDoorSecrets() /// /// Name of the Secret under the profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorSecretAsync(string secretName, CancellationToken cancellationToken = default) { @@ -408,8 +411,8 @@ public virtual async Task> GetFrontDoorSecretA /// /// Name of the Secret under the profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorSecret(string secretName, CancellationToken cancellationToken = default) { @@ -420,7 +423,7 @@ public virtual Response GetFrontDoorSecret(string secre /// An object representing collection of CdnEndpointResources and their operations over a CdnEndpointResource. public virtual CdnEndpointCollection GetCdnEndpoints() { - return GetCachedClient(Client => new CdnEndpointCollection(Client, Id)); + return GetCachedClient(client => new CdnEndpointCollection(client, Id)); } /// @@ -438,8 +441,8 @@ public virtual CdnEndpointCollection GetCdnEndpoints() /// /// Name of the endpoint under the profile which is unique globally. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCdnEndpointAsync(string endpointName, CancellationToken cancellationToken = default) { @@ -461,8 +464,8 @@ public virtual async Task> GetCdnEndpointAsync(str /// /// Name of the endpoint under the profile which is unique globally. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCdnEndpoint(string endpointName, CancellationToken cancellationToken = default) { diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/api/Azure.ResourceManager.ChangeAnalysis.netstandard2.0.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/api/Azure.ResourceManager.ChangeAnalysis.netstandard2.0.cs index b1c4dbea31803..1825d68ce7c62 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/api/Azure.ResourceManager.ChangeAnalysis.netstandard2.0.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/api/Azure.ResourceManager.ChangeAnalysis.netstandard2.0.cs @@ -10,6 +10,27 @@ public static partial class ChangeAnalysisExtensions public static Azure.AsyncPageable GetResourceChangesAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string resourceId, System.DateTimeOffset startTime, System.DateTimeOffset endTime, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ChangeAnalysis.Mocking +{ + public partial class MockableChangeAnalysisResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableChangeAnalysisResourceGroupResource() { } + public virtual Azure.Pageable GetChangesByResourceGroup(System.DateTimeOffset startTime, System.DateTimeOffset endTime, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetChangesByResourceGroupAsync(System.DateTimeOffset startTime, System.DateTimeOffset endTime, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableChangeAnalysisSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableChangeAnalysisSubscriptionResource() { } + public virtual Azure.Pageable GetChangesBySubscription(System.DateTimeOffset startTime, System.DateTimeOffset endTime, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetChangesBySubscriptionAsync(System.DateTimeOffset startTime, System.DateTimeOffset endTime, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableChangeAnalysisTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableChangeAnalysisTenantResource() { } + public virtual Azure.Pageable GetResourceChanges(string resourceId, System.DateTimeOffset startTime, System.DateTimeOffset endTime, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetResourceChangesAsync(string resourceId, System.DateTimeOffset startTime, System.DateTimeOffset endTime, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ChangeAnalysis.Models { public static partial class ArmChangeAnalysisModelFactory diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/ChangeAnalysisExtensions.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/ChangeAnalysisExtensions.cs index b9522805852bd..799aee5717fcb 100644 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/ChangeAnalysisExtensions.cs +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/ChangeAnalysisExtensions.cs @@ -8,8 +8,8 @@ using System; using System.Threading; using Azure; -using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ChangeAnalysis.Mocking; using Azure.ResourceManager.ChangeAnalysis.Models; using Azure.ResourceManager.Resources; @@ -18,52 +18,19 @@ namespace Azure.ResourceManager.ChangeAnalysis /// A class to add extension methods to Azure.ResourceManager.ChangeAnalysis. public static partial class ChangeAnalysisExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableChangeAnalysisResourceGroupResource GetMockableChangeAnalysisResourceGroupResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableChangeAnalysisResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableChangeAnalysisSubscriptionResource GetMockableChangeAnalysisSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableChangeAnalysisSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableChangeAnalysisTenantResource GetMockableChangeAnalysisTenantResource(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); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableChangeAnalysisTenantResource(client, resource.Id)); } /// @@ -78,6 +45,10 @@ private static TenantResourceExtensionClient GetTenantResourceExtensionClient(Ar /// Changes_ListChangesByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specifies the start time of the changes request. @@ -87,7 +58,7 @@ private static TenantResourceExtensionClient GetTenantResourceExtensionClient(Ar /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetChangesByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetChangesByResourceGroupAsync(startTime, endTime, skipToken, cancellationToken); + return GetMockableChangeAnalysisResourceGroupResource(resourceGroupResource).GetChangesByResourceGroupAsync(startTime, endTime, skipToken, cancellationToken); } /// @@ -102,6 +73,10 @@ public static AsyncPageable GetChangesByResourceGroupAsync(t /// Changes_ListChangesByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specifies the start time of the changes request. @@ -111,7 +86,7 @@ public static AsyncPageable GetChangesByResourceGroupAsync(t /// A collection of that may take multiple service requests to iterate over. public static Pageable GetChangesByResourceGroup(this ResourceGroupResource resourceGroupResource, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetChangesByResourceGroup(startTime, endTime, skipToken, cancellationToken); + return GetMockableChangeAnalysisResourceGroupResource(resourceGroupResource).GetChangesByResourceGroup(startTime, endTime, skipToken, cancellationToken); } /// @@ -126,6 +101,10 @@ public static Pageable GetChangesByResourceGroup(this Resour /// Changes_ListChangesBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specifies the start time of the changes request. @@ -135,7 +114,7 @@ public static Pageable GetChangesByResourceGroup(this Resour /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetChangesBySubscriptionAsync(this SubscriptionResource subscriptionResource, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetChangesBySubscriptionAsync(startTime, endTime, skipToken, cancellationToken); + return GetMockableChangeAnalysisSubscriptionResource(subscriptionResource).GetChangesBySubscriptionAsync(startTime, endTime, skipToken, cancellationToken); } /// @@ -150,6 +129,10 @@ public static AsyncPageable GetChangesBySubscriptionAsync(th /// Changes_ListChangesBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specifies the start time of the changes request. @@ -159,7 +142,7 @@ public static AsyncPageable GetChangesBySubscriptionAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetChangesBySubscription(this SubscriptionResource subscriptionResource, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetChangesBySubscription(startTime, endTime, skipToken, cancellationToken); + return GetMockableChangeAnalysisSubscriptionResource(subscriptionResource).GetChangesBySubscription(startTime, endTime, skipToken, cancellationToken); } /// @@ -174,6 +157,10 @@ public static Pageable GetChangesBySubscription(this Subscri /// ResourceChanges_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The identifier of the resource. @@ -186,9 +173,7 @@ public static Pageable GetChangesBySubscription(this Subscri /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetResourceChangesAsync(this TenantResource tenantResource, string resourceId, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceId, nameof(resourceId)); - - return GetTenantResourceExtensionClient(tenantResource).GetResourceChangesAsync(resourceId, startTime, endTime, skipToken, cancellationToken); + return GetMockableChangeAnalysisTenantResource(tenantResource).GetResourceChangesAsync(resourceId, startTime, endTime, skipToken, cancellationToken); } /// @@ -203,6 +188,10 @@ public static AsyncPageable GetResourceChangesAsync(this Ten /// ResourceChanges_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The identifier of the resource. @@ -215,9 +204,7 @@ public static AsyncPageable GetResourceChangesAsync(this Ten /// A collection of that may take multiple service requests to iterate over. public static Pageable GetResourceChanges(this TenantResource tenantResource, string resourceId, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceId, nameof(resourceId)); - - return GetTenantResourceExtensionClient(tenantResource).GetResourceChanges(resourceId, startTime, endTime, skipToken, cancellationToken); + return GetMockableChangeAnalysisTenantResource(tenantResource).GetResourceChanges(resourceId, startTime, endTime, skipToken, cancellationToken); } } } diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisResourceGroupResource.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisResourceGroupResource.cs new file mode 100644 index 0000000000000..75f3219d8b840 --- /dev/null +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisResourceGroupResource.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ChangeAnalysis; +using Azure.ResourceManager.ChangeAnalysis.Models; + +namespace Azure.ResourceManager.ChangeAnalysis.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableChangeAnalysisResourceGroupResource : ArmResource + { + private ClientDiagnostics _changesClientDiagnostics; + private ChangesRestOperations _changesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableChangeAnalysisResourceGroupResource() + { + } + + /// 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 MockableChangeAnalysisResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ChangesClientDiagnostics => _changesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ChangeAnalysis", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ChangesRestOperations ChangesRestClient => _changesRestClient ??= new ChangesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List the changes of a resource group within the specified time range. Customer data will always be masked. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ChangeAnalysis/changes + /// + /// + /// Operation Id + /// Changes_ListChangesByResourceGroup + /// + /// + /// + /// Specifies the start time of the changes request. + /// Specifies the end time of the changes request. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetChangesByResourceGroupAsync(DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChangesRestClient.CreateListChangesByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, startTime, endTime, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChangesRestClient.CreateListChangesByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, startTime, endTime, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ChangesClientDiagnostics, Pipeline, "MockableChangeAnalysisResourceGroupResource.GetChangesByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// List the changes of a resource group within the specified time range. Customer data will always be masked. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ChangeAnalysis/changes + /// + /// + /// Operation Id + /// Changes_ListChangesByResourceGroup + /// + /// + /// + /// Specifies the start time of the changes request. + /// Specifies the end time of the changes request. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetChangesByResourceGroup(DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChangesRestClient.CreateListChangesByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, startTime, endTime, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChangesRestClient.CreateListChangesByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, startTime, endTime, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ChangesClientDiagnostics, Pipeline, "MockableChangeAnalysisResourceGroupResource.GetChangesByResourceGroup", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisSubscriptionResource.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisSubscriptionResource.cs new file mode 100644 index 0000000000000..168579f3ebaf2 --- /dev/null +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisSubscriptionResource.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ChangeAnalysis; +using Azure.ResourceManager.ChangeAnalysis.Models; + +namespace Azure.ResourceManager.ChangeAnalysis.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableChangeAnalysisSubscriptionResource : ArmResource + { + private ClientDiagnostics _changesClientDiagnostics; + private ChangesRestOperations _changesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableChangeAnalysisSubscriptionResource() + { + } + + /// 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 MockableChangeAnalysisSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ChangesClientDiagnostics => _changesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ChangeAnalysis", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ChangesRestOperations ChangesRestClient => _changesRestClient ??= new ChangesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List the changes of a subscription within the specified time range. Customer data will always be masked. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/changes + /// + /// + /// Operation Id + /// Changes_ListChangesBySubscription + /// + /// + /// + /// Specifies the start time of the changes request. + /// Specifies the end time of the changes request. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetChangesBySubscriptionAsync(DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChangesRestClient.CreateListChangesBySubscriptionRequest(Id.SubscriptionId, startTime, endTime, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChangesRestClient.CreateListChangesBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, startTime, endTime, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ChangesClientDiagnostics, Pipeline, "MockableChangeAnalysisSubscriptionResource.GetChangesBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// List the changes of a subscription within the specified time range. Customer data will always be masked. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/changes + /// + /// + /// Operation Id + /// Changes_ListChangesBySubscription + /// + /// + /// + /// Specifies the start time of the changes request. + /// Specifies the end time of the changes request. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetChangesBySubscription(DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChangesRestClient.CreateListChangesBySubscriptionRequest(Id.SubscriptionId, startTime, endTime, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChangesRestClient.CreateListChangesBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, startTime, endTime, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ChangesClientDiagnostics, Pipeline, "MockableChangeAnalysisSubscriptionResource.GetChangesBySubscription", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisTenantResource.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisTenantResource.cs new file mode 100644 index 0000000000000..dd34455f09b99 --- /dev/null +++ b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/MockableChangeAnalysisTenantResource.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ChangeAnalysis; +using Azure.ResourceManager.ChangeAnalysis.Models; + +namespace Azure.ResourceManager.ChangeAnalysis.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableChangeAnalysisTenantResource : ArmResource + { + private ClientDiagnostics _resourceChangesClientDiagnostics; + private ResourceChangesRestOperations _resourceChangesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableChangeAnalysisTenantResource() + { + } + + /// 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 MockableChangeAnalysisTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ResourceChangesClientDiagnostics => _resourceChangesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ChangeAnalysis", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceChangesRestOperations ResourceChangesRestClient => _resourceChangesRestClient ??= new ResourceChangesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't have access. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.ChangeAnalysis/resourceChanges + /// + /// + /// Operation Id + /// ResourceChanges_List + /// + /// + /// + /// The identifier of the resource. + /// Specifies the start time of the changes request. + /// Specifies the end time of the changes request. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetResourceChangesAsync(string resourceId, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceId, nameof(resourceId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceChangesRestClient.CreateListRequest(resourceId, startTime, endTime, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceChangesRestClient.CreateListNextPageRequest(nextLink, resourceId, startTime, endTime, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ResourceChangesClientDiagnostics, Pipeline, "MockableChangeAnalysisTenantResource.GetResourceChanges", "value", "nextLink", cancellationToken); + } + + /// + /// List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't have access. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.ChangeAnalysis/resourceChanges + /// + /// + /// Operation Id + /// ResourceChanges_List + /// + /// + /// + /// The identifier of the resource. + /// Specifies the start time of the changes request. + /// Specifies the end time of the changes request. + /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetResourceChanges(string resourceId, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceId, nameof(resourceId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceChangesRestClient.CreateListRequest(resourceId, startTime, endTime, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceChangesRestClient.CreateListNextPageRequest(nextLink, resourceId, startTime, endTime, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ResourceChangesClientDiagnostics, Pipeline, "MockableChangeAnalysisTenantResource.GetResourceChanges", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 1a781308b8001..0000000000000 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ChangeAnalysis.Models; - -namespace Azure.ResourceManager.ChangeAnalysis -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _changesClientDiagnostics; - private ChangesRestOperations _changesRestClient; - - /// 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 ClientDiagnostics ChangesClientDiagnostics => _changesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ChangeAnalysis", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ChangesRestOperations ChangesRestClient => _changesRestClient ??= new ChangesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List the changes of a resource group within the specified time range. Customer data will always be masked. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ChangeAnalysis/changes - /// - /// - /// Operation Id - /// Changes_ListChangesByResourceGroup - /// - /// - /// - /// Specifies the start time of the changes request. - /// Specifies the end time of the changes request. - /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetChangesByResourceGroupAsync(DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChangesRestClient.CreateListChangesByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, startTime, endTime, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChangesRestClient.CreateListChangesByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, startTime, endTime, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ChangesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetChangesByResourceGroup", "value", "nextLink", cancellationToken); - } - - /// - /// List the changes of a resource group within the specified time range. Customer data will always be masked. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ChangeAnalysis/changes - /// - /// - /// Operation Id - /// Changes_ListChangesByResourceGroup - /// - /// - /// - /// Specifies the start time of the changes request. - /// Specifies the end time of the changes request. - /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetChangesByResourceGroup(DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChangesRestClient.CreateListChangesByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, startTime, endTime, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChangesRestClient.CreateListChangesByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, startTime, endTime, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ChangesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetChangesByResourceGroup", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 1e322024f1334..0000000000000 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ChangeAnalysis.Models; - -namespace Azure.ResourceManager.ChangeAnalysis -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _changesClientDiagnostics; - private ChangesRestOperations _changesRestClient; - - /// 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 ChangesClientDiagnostics => _changesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ChangeAnalysis", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ChangesRestOperations ChangesRestClient => _changesRestClient ??= new ChangesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List the changes of a subscription within the specified time range. Customer data will always be masked. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/changes - /// - /// - /// Operation Id - /// Changes_ListChangesBySubscription - /// - /// - /// - /// Specifies the start time of the changes request. - /// Specifies the end time of the changes request. - /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetChangesBySubscriptionAsync(DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChangesRestClient.CreateListChangesBySubscriptionRequest(Id.SubscriptionId, startTime, endTime, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChangesRestClient.CreateListChangesBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, startTime, endTime, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ChangesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetChangesBySubscription", "value", "nextLink", cancellationToken); - } - - /// - /// List the changes of a subscription within the specified time range. Customer data will always be masked. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/changes - /// - /// - /// Operation Id - /// Changes_ListChangesBySubscription - /// - /// - /// - /// Specifies the start time of the changes request. - /// Specifies the end time of the changes request. - /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetChangesBySubscription(DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChangesRestClient.CreateListChangesBySubscriptionRequest(Id.SubscriptionId, startTime, endTime, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChangesRestClient.CreateListChangesBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, startTime, endTime, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ChangesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetChangesBySubscription", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 2b60242e5f210..0000000000000 --- a/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ChangeAnalysis.Models; - -namespace Azure.ResourceManager.ChangeAnalysis -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _resourceChangesClientDiagnostics; - private ResourceChangesRestOperations _resourceChangesRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics ResourceChangesClientDiagnostics => _resourceChangesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ChangeAnalysis", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceChangesRestOperations ResourceChangesRestClient => _resourceChangesRestClient ??= new ResourceChangesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't have access. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.ChangeAnalysis/resourceChanges - /// - /// - /// Operation Id - /// ResourceChanges_List - /// - /// - /// - /// The identifier of the resource. - /// Specifies the start time of the changes request. - /// Specifies the end time of the changes request. - /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetResourceChangesAsync(string resourceId, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceChangesRestClient.CreateListRequest(resourceId, startTime, endTime, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceChangesRestClient.CreateListNextPageRequest(nextLink, resourceId, startTime, endTime, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ResourceChangesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetResourceChanges", "value", "nextLink", cancellationToken); - } - - /// - /// List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't have access. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.ChangeAnalysis/resourceChanges - /// - /// - /// Operation Id - /// ResourceChanges_List - /// - /// - /// - /// The identifier of the resource. - /// Specifies the start time of the changes request. - /// Specifies the end time of the changes request. - /// A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetResourceChanges(string resourceId, DateTimeOffset startTime, DateTimeOffset endTime, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceChangesRestClient.CreateListRequest(resourceId, startTime, endTime, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceChangesRestClient.CreateListNextPageRequest(nextLink, resourceId, startTime, endTime, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DetectedChangeData.DeserializeDetectedChangeData, ResourceChangesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetResourceChanges", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/api/Azure.ResourceManager.Chaos.netstandard2.0.cs b/sdk/chaos/Azure.ResourceManager.Chaos/api/Azure.ResourceManager.Chaos.netstandard2.0.cs index 93fb56e10dee8..546ddb10fa5d2 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/api/Azure.ResourceManager.Chaos.netstandard2.0.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/api/Azure.ResourceManager.Chaos.netstandard2.0.cs @@ -120,7 +120,7 @@ protected ExperimentCollection() { } } public partial class ExperimentData : Azure.ResourceManager.Models.TrackedResourceData { - public ExperimentData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable steps, System.Collections.Generic.IEnumerable selectors) : base (default(Azure.Core.AzureLocation)) { } + public ExperimentData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable steps, System.Collections.Generic.IEnumerable selectors) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList Selectors { get { throw null; } } public bool? StartOnCreation { get { throw null; } set { } } @@ -297,6 +297,39 @@ protected TargetTypeResource() { } public virtual Azure.ResourceManager.Chaos.CapabilityTypeCollection GetCapabilityTypes() { throw null; } } } +namespace Azure.ResourceManager.Chaos.Mocking +{ + public partial class MockableChaosArmClient : Azure.ResourceManager.ArmResource + { + protected MockableChaosArmClient() { } + public virtual Azure.ResourceManager.Chaos.CapabilityResource GetCapabilityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Chaos.CapabilityTypeResource GetCapabilityTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Chaos.ExperimentExecutionDetailResource GetExperimentExecutionDetailResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Chaos.ExperimentResource GetExperimentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Chaos.ExperimentStatusResource GetExperimentStatusResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Chaos.TargetResource GetTargetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Chaos.TargetTypeResource GetTargetTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableChaosResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableChaosResourceGroupResource() { } + public virtual Azure.Response GetExperiment(string experimentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExperimentAsync(string experimentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Chaos.ExperimentCollection GetExperiments() { throw null; } + public virtual Azure.Response GetTarget(string parentProviderNamespace, string parentResourceType, string parentResourceName, string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTargetAsync(string parentProviderNamespace, string parentResourceType, string parentResourceName, string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Chaos.TargetCollection GetTargets(string parentProviderNamespace, string parentResourceType, string parentResourceName) { throw null; } + } + public partial class MockableChaosSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableChaosSubscriptionResource() { } + public virtual Azure.Pageable GetExperiments(bool? running = default(bool?), string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExperimentsAsync(bool? running = default(bool?), string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTargetType(string locationName, string targetTypeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTargetTypeAsync(string locationName, string targetTypeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Chaos.TargetTypeCollection GetTargetTypes(string locationName) { throw null; } + } +} namespace Azure.ResourceManager.Chaos.Models { public abstract partial class Action diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityResource.cs index c36ca2c7e6f91..5c1dbe19ad86e 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Chaos public partial class CapabilityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The parentProviderNamespace. + /// The parentResourceType. + /// The parentResourceName. + /// The targetName. + /// The capabilityName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string parentProviderNamespace, string parentResourceType, string parentResourceName, string targetName, string capabilityName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}"; diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeResource.cs index 8f48587424b12..41f32e2dee244 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/CapabilityTypeResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Chaos public partial class CapabilityTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. + /// The targetTypeName. + /// The capabilityTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string locationName, string targetTypeName, string capabilityTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}"; diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailResource.cs index df559eacf2cbb..bd27e6d6be64c 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentExecutionDetailResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Chaos public partial class ExperimentExecutionDetailResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The experimentName. + /// The executionDetailsId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string experimentName, string executionDetailsId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}"; diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentResource.cs index dc58416ff238c..263809bb5e33b 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Chaos public partial class ExperimentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The experimentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string experimentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ExperimentStatusResources and their operations over a ExperimentStatusResource. public virtual ExperimentStatusCollection GetExperimentStatuses() { - return GetCachedClient(Client => new ExperimentStatusCollection(Client, Id)); + return GetCachedClient(client => new ExperimentStatusCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual ExperimentStatusCollection GetExperimentStatuses() /// /// GUID that represents a Experiment status. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExperimentStatusAsync(string statusId, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetExperimentStatu /// /// GUID that represents a Experiment status. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExperimentStatus(string statusId, CancellationToken cancellationToken = default) { @@ -145,7 +148,7 @@ public virtual Response GetExperimentStatus(string sta /// An object representing collection of ExperimentExecutionDetailResources and their operations over a ExperimentExecutionDetailResource. public virtual ExperimentExecutionDetailCollection GetExperimentExecutionDetails() { - return GetCachedClient(Client => new ExperimentExecutionDetailCollection(Client, Id)); + return GetCachedClient(client => new ExperimentExecutionDetailCollection(client, Id)); } /// @@ -163,8 +166,8 @@ public virtual ExperimentExecutionDetailCollection GetExperimentExecutionDetails /// /// GUID that represents a Experiment execution detail. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExperimentExecutionDetailAsync(string executionDetailsId, CancellationToken cancellationToken = default) { @@ -186,8 +189,8 @@ public virtual async Task> GetExperi /// /// GUID that represents a Experiment execution detail. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExperimentExecutionDetail(string executionDetailsId, CancellationToken cancellationToken = default) { diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusResource.cs index 97d88f3b9f756..497975df5433d 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentStatusResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Chaos public partial class ExperimentStatusResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The experimentName. + /// The statusId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string experimentName, string statusId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}"; diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/ChaosExtensions.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/ChaosExtensions.cs index f6b1db062998d..e753a12731b15 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/ChaosExtensions.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/ChaosExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Chaos.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Chaos @@ -18,176 +19,145 @@ namespace Azure.ResourceManager.Chaos /// A class to add extension methods to Azure.ResourceManager.Chaos. public static partial class ChaosExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableChaosArmClient GetMockableChaosArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableChaosArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableChaosResourceGroupResource GetMockableChaosResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableChaosResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableChaosSubscriptionResource GetMockableChaosSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableChaosSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region CapabilityResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CapabilityResource GetCapabilityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CapabilityResource.ValidateResourceId(id); - return new CapabilityResource(client, id); - } - ); + return GetMockableChaosArmClient(client).GetCapabilityResource(id); } - #endregion - #region CapabilityTypeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CapabilityTypeResource GetCapabilityTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CapabilityTypeResource.ValidateResourceId(id); - return new CapabilityTypeResource(client, id); - } - ); + return GetMockableChaosArmClient(client).GetCapabilityTypeResource(id); } - #endregion - #region ExperimentResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExperimentResource GetExperimentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExperimentResource.ValidateResourceId(id); - return new ExperimentResource(client, id); - } - ); + return GetMockableChaosArmClient(client).GetExperimentResource(id); } - #endregion - #region ExperimentStatusResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExperimentStatusResource GetExperimentStatusResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExperimentStatusResource.ValidateResourceId(id); - return new ExperimentStatusResource(client, id); - } - ); + return GetMockableChaosArmClient(client).GetExperimentStatusResource(id); } - #endregion - #region ExperimentExecutionDetailResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExperimentExecutionDetailResource GetExperimentExecutionDetailResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExperimentExecutionDetailResource.ValidateResourceId(id); - return new ExperimentExecutionDetailResource(client, id); - } - ); + return GetMockableChaosArmClient(client).GetExperimentExecutionDetailResource(id); } - #endregion - #region TargetTypeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TargetTypeResource GetTargetTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TargetTypeResource.ValidateResourceId(id); - return new TargetTypeResource(client, id); - } - ); + return GetMockableChaosArmClient(client).GetTargetTypeResource(id); } - #endregion - #region TargetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TargetResource GetTargetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TargetResource.ValidateResourceId(id); - return new TargetResource(client, id); - } - ); + return GetMockableChaosArmClient(client).GetTargetResource(id); } - #endregion - /// Gets a collection of ExperimentResources in the ResourceGroupResource. + /// + /// Gets a collection of ExperimentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ExperimentResources and their operations over a ExperimentResource. public static ExperimentCollection GetExperiments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetExperiments(); + return GetMockableChaosResourceGroupResource(resourceGroupResource).GetExperiments(); } /// @@ -202,16 +172,20 @@ public static ExperimentCollection GetExperiments(this ResourceGroupResource res /// Experiments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// String that represents a Experiment resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetExperimentAsync(this ResourceGroupResource resourceGroupResource, string experimentName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetExperiments().GetAsync(experimentName, cancellationToken).ConfigureAwait(false); + return await GetMockableChaosResourceGroupResource(resourceGroupResource).GetExperimentAsync(experimentName, cancellationToken).ConfigureAwait(false); } /// @@ -226,33 +200,39 @@ public static async Task> GetExperimentAsync(this R /// Experiments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// String that represents a Experiment resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetExperiment(this ResourceGroupResource resourceGroupResource, string experimentName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetExperiments().Get(experimentName, cancellationToken); + return GetMockableChaosResourceGroupResource(resourceGroupResource).GetExperiment(experimentName, cancellationToken); } - /// Gets a collection of TargetResources in the ResourceGroupResource. + /// + /// Gets a collection of TargetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// String that represents a resource provider namespace. /// String that represents a resource type. /// String that represents a resource name. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of TargetResources and their operations over a TargetResource. public static TargetCollection GetTargets(this ResourceGroupResource resourceGroupResource, string parentProviderNamespace, string parentResourceType, string parentResourceName) { - Argument.AssertNotNullOrEmpty(parentProviderNamespace, nameof(parentProviderNamespace)); - Argument.AssertNotNullOrEmpty(parentResourceType, nameof(parentResourceType)); - Argument.AssertNotNullOrEmpty(parentResourceName, nameof(parentResourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetTargets(parentProviderNamespace, parentResourceType, parentResourceName); + return GetMockableChaosResourceGroupResource(resourceGroupResource).GetTargets(parentProviderNamespace, parentResourceType, parentResourceName); } /// @@ -267,6 +247,10 @@ public static TargetCollection GetTargets(this ResourceGroupResource resourceGro /// Targets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// String that represents a resource provider namespace. @@ -274,12 +258,12 @@ public static TargetCollection GetTargets(this ResourceGroupResource resourceGro /// String that represents a resource name. /// String that represents a Target resource name. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTargetAsync(this ResourceGroupResource resourceGroupResource, string parentProviderNamespace, string parentResourceType, string parentResourceName, string targetName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetTargets(parentProviderNamespace, parentResourceType, parentResourceName).GetAsync(targetName, cancellationToken).ConfigureAwait(false); + return await GetMockableChaosResourceGroupResource(resourceGroupResource).GetTargetAsync(parentProviderNamespace, parentResourceType, parentResourceName, targetName, cancellationToken).ConfigureAwait(false); } /// @@ -294,6 +278,10 @@ public static async Task> GetTargetAsync(this ResourceG /// Targets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// String that represents a resource provider namespace. @@ -301,25 +289,29 @@ public static async Task> GetTargetAsync(this ResourceG /// String that represents a resource name. /// String that represents a Target resource name. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTarget(this ResourceGroupResource resourceGroupResource, string parentProviderNamespace, string parentResourceType, string parentResourceName, string targetName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetTargets(parentProviderNamespace, parentResourceType, parentResourceName).Get(targetName, cancellationToken); + return GetMockableChaosResourceGroupResource(resourceGroupResource).GetTarget(parentProviderNamespace, parentResourceType, parentResourceName, targetName, cancellationToken); } - /// Gets a collection of TargetTypeResources in the SubscriptionResource. + /// + /// Gets a collection of TargetTypeResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// String that represents a Location resource name. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of TargetTypeResources and their operations over a TargetTypeResource. public static TargetTypeCollection GetTargetTypes(this SubscriptionResource subscriptionResource, string locationName) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTargetTypes(locationName); + return GetMockableChaosSubscriptionResource(subscriptionResource).GetTargetTypes(locationName); } /// @@ -334,17 +326,21 @@ public static TargetTypeCollection GetTargetTypes(this SubscriptionResource subs /// TargetTypes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// String that represents a Location resource name. /// String that represents a Target Type resource name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTargetTypeAsync(this SubscriptionResource subscriptionResource, string locationName, string targetTypeName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetTargetTypes(locationName).GetAsync(targetTypeName, cancellationToken).ConfigureAwait(false); + return await GetMockableChaosSubscriptionResource(subscriptionResource).GetTargetTypeAsync(locationName, targetTypeName, cancellationToken).ConfigureAwait(false); } /// @@ -359,17 +355,21 @@ public static async Task> GetTargetTypeAsync(this S /// TargetTypes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// String that represents a Location resource name. /// String that represents a Target Type resource name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTargetType(this SubscriptionResource subscriptionResource, string locationName, string targetTypeName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetTargetTypes(locationName).Get(targetTypeName, cancellationToken); + return GetMockableChaosSubscriptionResource(subscriptionResource).GetTargetType(locationName, targetTypeName, cancellationToken); } /// @@ -384,6 +384,10 @@ public static Response GetTargetType(this SubscriptionResour /// Experiments_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. @@ -392,7 +396,7 @@ public static Response GetTargetType(this SubscriptionResour /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetExperimentsAsync(this SubscriptionResource subscriptionResource, bool? running = null, string continuationToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExperimentsAsync(running, continuationToken, cancellationToken); + return GetMockableChaosSubscriptionResource(subscriptionResource).GetExperimentsAsync(running, continuationToken, cancellationToken); } /// @@ -407,6 +411,10 @@ public static AsyncPageable GetExperimentsAsync(this Subscri /// Experiments_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. @@ -415,7 +423,7 @@ public static AsyncPageable GetExperimentsAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetExperiments(this SubscriptionResource subscriptionResource, bool? running = null, string continuationToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExperiments(running, continuationToken, cancellationToken); + return GetMockableChaosSubscriptionResource(subscriptionResource).GetExperiments(running, continuationToken, cancellationToken); } } } diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosArmClient.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosArmClient.cs new file mode 100644 index 0000000000000..b76964ba305d7 --- /dev/null +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Chaos; + +namespace Azure.ResourceManager.Chaos.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableChaosArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableChaosArmClient() + { + } + + /// 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 MockableChaosArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableChaosArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CapabilityResource GetCapabilityResource(ResourceIdentifier id) + { + CapabilityResource.ValidateResourceId(id); + return new CapabilityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CapabilityTypeResource GetCapabilityTypeResource(ResourceIdentifier id) + { + CapabilityTypeResource.ValidateResourceId(id); + return new CapabilityTypeResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExperimentResource GetExperimentResource(ResourceIdentifier id) + { + ExperimentResource.ValidateResourceId(id); + return new ExperimentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExperimentStatusResource GetExperimentStatusResource(ResourceIdentifier id) + { + ExperimentStatusResource.ValidateResourceId(id); + return new ExperimentStatusResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExperimentExecutionDetailResource GetExperimentExecutionDetailResource(ResourceIdentifier id) + { + ExperimentExecutionDetailResource.ValidateResourceId(id); + return new ExperimentExecutionDetailResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TargetTypeResource GetTargetTypeResource(ResourceIdentifier id) + { + TargetTypeResource.ValidateResourceId(id); + return new TargetTypeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TargetResource GetTargetResource(ResourceIdentifier id) + { + TargetResource.ValidateResourceId(id); + return new TargetResource(Client, id); + } + } +} diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosResourceGroupResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosResourceGroupResource.cs new file mode 100644 index 0000000000000..acb0d8962368b --- /dev/null +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosResourceGroupResource.cs @@ -0,0 +1,156 @@ +// 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.Chaos; + +namespace Azure.ResourceManager.Chaos.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableChaosResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableChaosResourceGroupResource() + { + } + + /// 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 MockableChaosResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ExperimentResources in the ResourceGroupResource. + /// An object representing collection of ExperimentResources and their operations over a ExperimentResource. + public virtual ExperimentCollection GetExperiments() + { + return GetCachedClient(client => new ExperimentCollection(client, Id)); + } + + /// + /// Get a Experiment resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName} + /// + /// + /// Operation Id + /// Experiments_Get + /// + /// + /// + /// String that represents a Experiment resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetExperimentAsync(string experimentName, CancellationToken cancellationToken = default) + { + return await GetExperiments().GetAsync(experimentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Experiment resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName} + /// + /// + /// Operation Id + /// Experiments_Get + /// + /// + /// + /// String that represents a Experiment resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetExperiment(string experimentName, CancellationToken cancellationToken = default) + { + return GetExperiments().Get(experimentName, cancellationToken); + } + + /// Gets a collection of TargetResources in the ResourceGroupResource. + /// String that represents a resource provider namespace. + /// String that represents a resource type. + /// String that represents a resource name. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// An object representing collection of TargetResources and their operations over a TargetResource. + public virtual TargetCollection GetTargets(string parentProviderNamespace, string parentResourceType, string parentResourceName) + { + return new TargetCollection(Client, Id, parentProviderNamespace, parentResourceType, parentResourceName); + } + + /// + /// Get a Target resource that extends a tracked regional resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName} + /// + /// + /// Operation Id + /// Targets_Get + /// + /// + /// + /// String that represents a resource provider namespace. + /// String that represents a resource type. + /// String that represents a resource name. + /// String that represents a Target resource name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTargetAsync(string parentProviderNamespace, string parentResourceType, string parentResourceName, string targetName, CancellationToken cancellationToken = default) + { + return await GetTargets(parentProviderNamespace, parentResourceType, parentResourceName).GetAsync(targetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Target resource that extends a tracked regional resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName} + /// + /// + /// Operation Id + /// Targets_Get + /// + /// + /// + /// String that represents a resource provider namespace. + /// String that represents a resource type. + /// String that represents a resource name. + /// String that represents a Target resource name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTarget(string parentProviderNamespace, string parentResourceType, string parentResourceName, string targetName, CancellationToken cancellationToken = default) + { + return GetTargets(parentProviderNamespace, parentResourceType, parentResourceName).Get(targetName, cancellationToken); + } + } +} diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosSubscriptionResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosSubscriptionResource.cs new file mode 100644 index 0000000000000..b4fcaf59ad003 --- /dev/null +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/MockableChaosSubscriptionResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Chaos; + +namespace Azure.ResourceManager.Chaos.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableChaosSubscriptionResource : ArmResource + { + private ClientDiagnostics _experimentClientDiagnostics; + private ExperimentsRestOperations _experimentRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableChaosSubscriptionResource() + { + } + + /// 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 MockableChaosSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ExperimentClientDiagnostics => _experimentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Chaos", ExperimentResource.ResourceType.Namespace, Diagnostics); + private ExperimentsRestOperations ExperimentRestClient => _experimentRestClient ??= new ExperimentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExperimentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of TargetTypeResources in the SubscriptionResource. + /// String that represents a Location resource name. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of TargetTypeResources and their operations over a TargetTypeResource. + public virtual TargetTypeCollection GetTargetTypes(string locationName) + { + return new TargetTypeCollection(Client, Id, locationName); + } + + /// + /// Get a Target Type resources for given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName} + /// + /// + /// Operation Id + /// TargetTypes_Get + /// + /// + /// + /// String that represents a Location resource name. + /// String that represents a Target Type resource name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTargetTypeAsync(string locationName, string targetTypeName, CancellationToken cancellationToken = default) + { + return await GetTargetTypes(locationName).GetAsync(targetTypeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Target Type resources for given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName} + /// + /// + /// Operation Id + /// TargetTypes_Get + /// + /// + /// + /// String that represents a Location resource name. + /// String that represents a Target Type resource name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTargetType(string locationName, string targetTypeName, CancellationToken cancellationToken = default) + { + return GetTargetTypes(locationName).Get(targetTypeName, cancellationToken); + } + + /// + /// Get a list of Experiment resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments + /// + /// + /// Operation Id + /// Experiments_ListAll + /// + /// + /// + /// Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. + /// String that sets the continuation token. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetExperimentsAsync(bool? running = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExperimentRestClient.CreateListAllRequest(Id.SubscriptionId, running, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExperimentRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, running, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), ExperimentClientDiagnostics, Pipeline, "MockableChaosSubscriptionResource.GetExperiments", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of Experiment resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments + /// + /// + /// Operation Id + /// Experiments_ListAll + /// + /// + /// + /// Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. + /// String that sets the continuation token. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetExperiments(bool? running = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExperimentRestClient.CreateListAllRequest(Id.SubscriptionId, running, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExperimentRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, running, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), ExperimentClientDiagnostics, Pipeline, "MockableChaosSubscriptionResource.GetExperiments", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 74cc3789b98be..0000000000000 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Chaos -{ - /// 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 ExperimentResources in the ResourceGroupResource. - /// An object representing collection of ExperimentResources and their operations over a ExperimentResource. - public virtual ExperimentCollection GetExperiments() - { - return GetCachedClient(Client => new ExperimentCollection(Client, Id)); - } - - /// Gets a collection of TargetResources in the ResourceGroupResource. - /// String that represents a resource provider namespace. - /// String that represents a resource type. - /// String that represents a resource name. - /// An object representing collection of TargetResources and their operations over a TargetResource. - public virtual TargetCollection GetTargets(string parentProviderNamespace, string parentResourceType, string parentResourceName) - { - return new TargetCollection(Client, Id, parentProviderNamespace, parentResourceType, parentResourceName); - } - } -} diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 6c32f2eb0fb8b..0000000000000 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Chaos -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _experimentClientDiagnostics; - private ExperimentsRestOperations _experimentRestClient; - - /// 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 ExperimentClientDiagnostics => _experimentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Chaos", ExperimentResource.ResourceType.Namespace, Diagnostics); - private ExperimentsRestOperations ExperimentRestClient => _experimentRestClient ??= new ExperimentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExperimentResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of TargetTypeResources in the SubscriptionResource. - /// String that represents a Location resource name. - /// An object representing collection of TargetTypeResources and their operations over a TargetTypeResource. - public virtual TargetTypeCollection GetTargetTypes(string locationName) - { - return new TargetTypeCollection(Client, Id, locationName); - } - - /// - /// Get a list of Experiment resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments - /// - /// - /// Operation Id - /// Experiments_ListAll - /// - /// - /// - /// Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. - /// String that sets the continuation token. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetExperimentsAsync(bool? running = null, string continuationToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExperimentRestClient.CreateListAllRequest(Id.SubscriptionId, running, continuationToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExperimentRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, running, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), ExperimentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExperiments", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of Experiment resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments - /// - /// - /// Operation Id - /// Experiments_ListAll - /// - /// - /// - /// Optional value that indicates whether to filter results based on if the Experiment is currently running. If null, then the results will not be filtered. - /// String that sets the continuation token. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetExperiments(bool? running = null, string continuationToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExperimentRestClient.CreateListAllRequest(Id.SubscriptionId, running, continuationToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExperimentRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, running, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExperimentResource(Client, ExperimentData.DeserializeExperimentData(e)), ExperimentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExperiments", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetResource.cs index d88d43085bd8d..256e3ac8bfbab 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.Chaos public partial class TargetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The parentProviderNamespace. + /// The parentResourceType. + /// The parentResourceName. + /// The targetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string parentProviderNamespace, string parentResourceType, string parentResourceName, string targetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}"; @@ -92,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CapabilityResources and their operations over a CapabilityResource. public virtual CapabilityCollection GetCapabilities() { - return GetCachedClient(Client => new CapabilityCollection(Client, Id)); + return GetCachedClient(client => new CapabilityCollection(client, Id)); } /// @@ -110,8 +116,8 @@ public virtual CapabilityCollection GetCapabilities() /// /// String that represents a Capability resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCapabilityAsync(string capabilityName, CancellationToken cancellationToken = default) { @@ -133,8 +139,8 @@ public virtual async Task> GetCapabilityAsync(strin /// /// String that represents a Capability resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCapability(string capabilityName, CancellationToken cancellationToken = default) { diff --git a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeResource.cs index 4e9fe2287eb72..a17692ce1a2f5 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Chaos public partial class TargetTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. + /// The targetTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string locationName, string targetTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}"; @@ -91,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CapabilityTypeResources and their operations over a CapabilityTypeResource. public virtual CapabilityTypeCollection GetCapabilityTypes() { - return GetCachedClient(Client => new CapabilityTypeCollection(Client, Id)); + return GetCachedClient(client => new CapabilityTypeCollection(client, Id)); } /// @@ -109,8 +112,8 @@ public virtual CapabilityTypeCollection GetCapabilityTypes() /// /// String that represents a Capability Type resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCapabilityTypeAsync(string capabilityTypeName, CancellationToken cancellationToken = default) { @@ -132,8 +135,8 @@ public virtual async Task> GetCapabilityTypeAsy /// /// String that represents a Capability Type resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCapabilityType(string capabilityTypeName, CancellationToken cancellationToken = default) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/api/Azure.ResourceManager.CognitiveServices.netstandard2.0.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/api/Azure.ResourceManager.CognitiveServices.netstandard2.0.cs index 230159c2a2e54..10c45010f656b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/api/Azure.ResourceManager.CognitiveServices.netstandard2.0.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/api/Azure.ResourceManager.CognitiveServices.netstandard2.0.cs @@ -19,7 +19,7 @@ protected CognitiveServicesAccountCollection() { } } public partial class CognitiveServicesAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public CognitiveServicesAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CognitiveServicesAccountData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public string Kind { get { throw null; } set { } } @@ -344,6 +344,55 @@ protected CommitmentPlanResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.CommitmentPlanData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.CognitiveServices.Mocking +{ + public partial class MockableCognitiveServicesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableCognitiveServicesArmClient() { } + public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountDeploymentResource GetCognitiveServicesAccountDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountResource GetCognitiveServicesAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesCommitmentPlanResource GetCognitiveServicesCommitmentPlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesDeletedAccountResource GetCognitiveServicesDeletedAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesPrivateEndpointConnectionResource GetCognitiveServicesPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CommitmentPlanAccountAssociationResource GetCommitmentPlanAccountAssociationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CommitmentPlanResource GetCommitmentPlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableCognitiveServicesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableCognitiveServicesResourceGroupResource() { } + public virtual Azure.Response GetCognitiveServicesAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCognitiveServicesAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountCollection GetCognitiveServicesAccounts() { throw null; } + public virtual Azure.Response GetCognitiveServicesCommitmentPlan(string commitmentPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCognitiveServicesCommitmentPlanAsync(string commitmentPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesCommitmentPlanCollection GetCognitiveServicesCommitmentPlans() { throw null; } + } + public partial class MockableCognitiveServicesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableCognitiveServicesSubscriptionResource() { } + public virtual Azure.Response CheckDomainAvailability(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesDomainAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDomainAvailabilityAsync(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesDomainAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable CheckSkuAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable CheckSkuAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCognitiveServicesAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCognitiveServicesAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCognitiveServicesCommitmentPlans(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCognitiveServicesCommitmentPlansAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCognitiveServicesDeletedAccount(Azure.Core.AzureLocation location, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCognitiveServicesDeletedAccountAsync(Azure.Core.AzureLocation location, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesDeletedAccountCollection GetCognitiveServicesDeletedAccounts() { throw null; } + public virtual Azure.Pageable GetCommitmentTiers(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCommitmentTiersAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeletedAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetModels(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetModelsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetResourceSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetResourceSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsages(Azure.Core.AzureLocation location, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesAsync(Azure.Core.AzureLocation location, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.CognitiveServices.Models { public partial class AbusePenalty diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs index c1b4d21445032..8c991b22d4585 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CognitiveServices public partial class CognitiveServicesAccountDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The deploymentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string deploymentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}"; diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs index c6ae32bd1ca9e..be18a05176db0 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.CognitiveServices public partial class CognitiveServicesAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CognitiveServicesPrivateEndpointConnectionResources and their operations over a CognitiveServicesPrivateEndpointConnectionResource. public virtual CognitiveServicesPrivateEndpointConnectionCollection GetCognitiveServicesPrivateEndpointConnections() { - return GetCachedClient(Client => new CognitiveServicesPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new CognitiveServicesPrivateEndpointConnectionCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual CognitiveServicesPrivateEndpointConnectionCollection GetCognitive /// /// The name of the private endpoint connection associated with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCognitiveServicesPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task /// The name of the private endpoint connection associated with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCognitiveServicesPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetC /// An object representing collection of CognitiveServicesAccountDeploymentResources and their operations over a CognitiveServicesAccountDeploymentResource. public virtual CognitiveServicesAccountDeploymentCollection GetCognitiveServicesAccountDeployments() { - return GetCachedClient(Client => new CognitiveServicesAccountDeploymentCollection(Client, Id)); + return GetCachedClient(client => new CognitiveServicesAccountDeploymentCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual CognitiveServicesAccountDeploymentCollection GetCognitiveServices /// /// The name of the deployment associated with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCognitiveServicesAccountDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> /// /// The name of the deployment associated with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCognitiveServicesAccountDeployment(string deploymentName, CancellationToken cancellationToken = default) { @@ -204,7 +207,7 @@ public virtual Response GetCognitive /// An object representing collection of CommitmentPlanResources and their operations over a CommitmentPlanResource. public virtual CommitmentPlanCollection GetCommitmentPlans() { - return GetCachedClient(Client => new CommitmentPlanCollection(Client, Id)); + return GetCachedClient(client => new CommitmentPlanCollection(client, Id)); } /// @@ -222,8 +225,8 @@ public virtual CommitmentPlanCollection GetCommitmentPlans() /// /// The name of the commitmentPlan associated with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCommitmentPlanAsync(string commitmentPlanName, CancellationToken cancellationToken = default) { @@ -245,8 +248,8 @@ public virtual async Task> GetCommitmentPlanAsy /// /// The name of the commitmentPlan associated with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCommitmentPlan(string commitmentPlanName, CancellationToken cancellationToken = default) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs index 229e7da09c572..fae0abda50da2 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.CognitiveServices public partial class CognitiveServicesCommitmentPlanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The commitmentPlanName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string commitmentPlanName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CommitmentPlanAccountAssociationResources and their operations over a CommitmentPlanAccountAssociationResource. public virtual CommitmentPlanAccountAssociationCollection GetCommitmentPlanAccountAssociations() { - return GetCachedClient(Client => new CommitmentPlanAccountAssociationCollection(Client, Id)); + return GetCachedClient(client => new CommitmentPlanAccountAssociationCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual CommitmentPlanAccountAssociationCollection GetCommitmentPlanAccou /// /// The name of the commitment plan association with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCommitmentPlanAccountAssociationAsync(string commitmentPlanAssociationName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> Ge /// /// The name of the commitment plan association with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCommitmentPlanAccountAssociation(string commitmentPlanAssociationName, CancellationToken cancellationToken = default) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountResource.cs index 4c2d80cf0de41..31f04a70a5b73 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CognitiveServices public partial class CognitiveServicesDeletedAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}"; diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionResource.cs index ce3a41a9cc0f3..3d5ca46e9cb5a 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CognitiveServices public partial class CognitiveServicesPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationResource.cs index e96345f3d4774..24a771ec1fc35 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CognitiveServices public partial class CommitmentPlanAccountAssociationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The commitmentPlanName. + /// The commitmentPlanAssociationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string commitmentPlanName, string commitmentPlanAssociationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName}"; diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanResource.cs index 37e849e4b1a73..9e85cfc614454 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CognitiveServices public partial class CommitmentPlanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The commitmentPlanName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string commitmentPlanName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}"; diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs index ea024c743dd18..d55e5f9616d9c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices.Mocking; using Azure.ResourceManager.CognitiveServices.Models; using Azure.ResourceManager.Resources; @@ -19,176 +20,145 @@ namespace Azure.ResourceManager.CognitiveServices /// A class to add extension methods to Azure.ResourceManager.CognitiveServices. public static partial class CognitiveServicesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableCognitiveServicesArmClient GetMockableCognitiveServicesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableCognitiveServicesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCognitiveServicesResourceGroupResource GetMockableCognitiveServicesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCognitiveServicesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableCognitiveServicesSubscriptionResource GetMockableCognitiveServicesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableCognitiveServicesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region CognitiveServicesAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CognitiveServicesAccountResource GetCognitiveServicesAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CognitiveServicesAccountResource.ValidateResourceId(id); - return new CognitiveServicesAccountResource(client, id); - } - ); + return GetMockableCognitiveServicesArmClient(client).GetCognitiveServicesAccountResource(id); } - #endregion - #region CognitiveServicesDeletedAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CognitiveServicesDeletedAccountResource GetCognitiveServicesDeletedAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CognitiveServicesDeletedAccountResource.ValidateResourceId(id); - return new CognitiveServicesDeletedAccountResource(client, id); - } - ); + return GetMockableCognitiveServicesArmClient(client).GetCognitiveServicesDeletedAccountResource(id); } - #endregion - #region CognitiveServicesPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CognitiveServicesPrivateEndpointConnectionResource GetCognitiveServicesPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CognitiveServicesPrivateEndpointConnectionResource.ValidateResourceId(id); - return new CognitiveServicesPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableCognitiveServicesArmClient(client).GetCognitiveServicesPrivateEndpointConnectionResource(id); } - #endregion - #region CognitiveServicesAccountDeploymentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CognitiveServicesAccountDeploymentResource GetCognitiveServicesAccountDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CognitiveServicesAccountDeploymentResource.ValidateResourceId(id); - return new CognitiveServicesAccountDeploymentResource(client, id); - } - ); + return GetMockableCognitiveServicesArmClient(client).GetCognitiveServicesAccountDeploymentResource(id); } - #endregion - #region CommitmentPlanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CommitmentPlanResource GetCommitmentPlanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CommitmentPlanResource.ValidateResourceId(id); - return new CommitmentPlanResource(client, id); - } - ); + return GetMockableCognitiveServicesArmClient(client).GetCommitmentPlanResource(id); } - #endregion - #region CognitiveServicesCommitmentPlanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CognitiveServicesCommitmentPlanResource GetCognitiveServicesCommitmentPlanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CognitiveServicesCommitmentPlanResource.ValidateResourceId(id); - return new CognitiveServicesCommitmentPlanResource(client, id); - } - ); + return GetMockableCognitiveServicesArmClient(client).GetCognitiveServicesCommitmentPlanResource(id); } - #endregion - #region CommitmentPlanAccountAssociationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CommitmentPlanAccountAssociationResource GetCommitmentPlanAccountAssociationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CommitmentPlanAccountAssociationResource.ValidateResourceId(id); - return new CommitmentPlanAccountAssociationResource(client, id); - } - ); + return GetMockableCognitiveServicesArmClient(client).GetCommitmentPlanAccountAssociationResource(id); } - #endregion - /// Gets a collection of CognitiveServicesAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of CognitiveServicesAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CognitiveServicesAccountResources and their operations over a CognitiveServicesAccountResource. public static CognitiveServicesAccountCollection GetCognitiveServicesAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCognitiveServicesAccounts(); + return GetMockableCognitiveServicesResourceGroupResource(resourceGroupResource).GetCognitiveServicesAccounts(); } /// @@ -203,16 +173,20 @@ public static CognitiveServicesAccountCollection GetCognitiveServicesAccounts(th /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Cognitive Services account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCognitiveServicesAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCognitiveServicesAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableCognitiveServicesResourceGroupResource(resourceGroupResource).GetCognitiveServicesAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -227,24 +201,34 @@ public static async Task> GetCognitiv /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Cognitive Services account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCognitiveServicesAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCognitiveServicesAccounts().Get(accountName, cancellationToken); + return GetMockableCognitiveServicesResourceGroupResource(resourceGroupResource).GetCognitiveServicesAccount(accountName, cancellationToken); } - /// Gets a collection of CognitiveServicesCommitmentPlanResources in the ResourceGroupResource. + /// + /// Gets a collection of CognitiveServicesCommitmentPlanResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CognitiveServicesCommitmentPlanResources and their operations over a CognitiveServicesCommitmentPlanResource. public static CognitiveServicesCommitmentPlanCollection GetCognitiveServicesCommitmentPlans(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCognitiveServicesCommitmentPlans(); + return GetMockableCognitiveServicesResourceGroupResource(resourceGroupResource).GetCognitiveServicesCommitmentPlans(); } /// @@ -259,16 +243,20 @@ public static CognitiveServicesCommitmentPlanCollection GetCognitiveServicesComm /// CommitmentPlans_GetPlan /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the commitmentPlan associated with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCognitiveServicesCommitmentPlanAsync(this ResourceGroupResource resourceGroupResource, string commitmentPlanName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCognitiveServicesCommitmentPlans().GetAsync(commitmentPlanName, cancellationToken).ConfigureAwait(false); + return await GetMockableCognitiveServicesResourceGroupResource(resourceGroupResource).GetCognitiveServicesCommitmentPlanAsync(commitmentPlanName, cancellationToken).ConfigureAwait(false); } /// @@ -283,24 +271,34 @@ public static async Task> GetC /// CommitmentPlans_GetPlan /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the commitmentPlan associated with the Cognitive Services Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCognitiveServicesCommitmentPlan(this ResourceGroupResource resourceGroupResource, string commitmentPlanName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCognitiveServicesCommitmentPlans().Get(commitmentPlanName, cancellationToken); + return GetMockableCognitiveServicesResourceGroupResource(resourceGroupResource).GetCognitiveServicesCommitmentPlan(commitmentPlanName, cancellationToken); } - /// Gets a collection of CognitiveServicesDeletedAccountResources in the SubscriptionResource. + /// + /// Gets a collection of CognitiveServicesDeletedAccountResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CognitiveServicesDeletedAccountResources and their operations over a CognitiveServicesDeletedAccountResource. public static CognitiveServicesDeletedAccountCollection GetCognitiveServicesDeletedAccounts(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCognitiveServicesDeletedAccounts(); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesDeletedAccounts(); } /// @@ -315,18 +313,22 @@ public static CognitiveServicesDeletedAccountCollection GetCognitiveServicesDele /// DeletedAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. /// The name of the resource group. The name is case insensitive. /// The name of Cognitive Services account. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCognitiveServicesDeletedAccountAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetCognitiveServicesDeletedAccounts().GetAsync(location, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesDeletedAccountAsync(location, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); } /// @@ -341,18 +343,22 @@ public static async Task> GetC /// DeletedAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. /// The name of the resource group. The name is case insensitive. /// The name of Cognitive Services account. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCognitiveServicesDeletedAccount(this SubscriptionResource subscriptionResource, AzureLocation location, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetCognitiveServicesDeletedAccounts().Get(location, resourceGroupName, accountName, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesDeletedAccount(location, resourceGroupName, accountName, cancellationToken); } /// @@ -367,13 +373,17 @@ public static Response GetCognitiveServ /// Accounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCognitiveServicesAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCognitiveServicesAccountsAsync(cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesAccountsAsync(cancellationToken); } /// @@ -388,13 +398,17 @@ public static AsyncPageable GetCognitiveServic /// Accounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCognitiveServicesAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCognitiveServicesAccounts(cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesAccounts(cancellationToken); } /// @@ -409,13 +423,17 @@ public static Pageable GetCognitiveServicesAcc /// DeletedAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedAccountsAsync(cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetDeletedAccountsAsync(cancellationToken); } /// @@ -430,13 +448,17 @@ public static AsyncPageable GetDeletedA /// DeletedAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedAccounts(cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetDeletedAccounts(cancellationToken); } /// @@ -451,13 +473,17 @@ public static Pageable GetDeletedAccoun /// ResourceSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourceSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceSkusAsync(cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetResourceSkusAsync(cancellationToken); } /// @@ -472,13 +498,17 @@ public static AsyncPageable GetResourceSkusAsync( /// ResourceSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourceSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceSkus(cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetResourceSkus(cancellationToken); } /// @@ -493,6 +523,10 @@ public static Pageable GetResourceSkus(this Subsc /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. @@ -501,7 +535,7 @@ public static Pageable GetResourceSkus(this Subsc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesAsync(location, filter, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetUsagesAsync(location, filter, cancellationToken); } /// @@ -516,6 +550,10 @@ public static AsyncPageable GetUsagesAsync(this Subscriptio /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. @@ -524,7 +562,7 @@ public static AsyncPageable GetUsagesAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsages(this SubscriptionResource subscriptionResource, AzureLocation location, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsages(location, filter, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetUsages(location, filter, cancellationToken); } /// @@ -539,6 +577,10 @@ public static Pageable GetUsages(this SubscriptionResource /// CheckSkuAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. @@ -548,9 +590,7 @@ public static Pageable GetUsages(this SubscriptionResource /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable CheckSkuAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CognitiveServicesSkuAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSkuAvailabilityAsync(location, content, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).CheckSkuAvailabilityAsync(location, content, cancellationToken); } /// @@ -565,6 +605,10 @@ public static AsyncPageable CheckSkuAvaila /// CheckSkuAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. @@ -574,9 +618,7 @@ public static AsyncPageable CheckSkuAvaila /// A collection of that may take multiple service requests to iterate over. public static Pageable CheckSkuAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, CognitiveServicesSkuAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSkuAvailability(location, content, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).CheckSkuAvailability(location, content, cancellationToken); } /// @@ -591,6 +633,10 @@ public static Pageable CheckSkuAvailabilit /// CheckDomainAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Check Domain Availability parameter. @@ -598,9 +644,7 @@ public static Pageable CheckSkuAvailabilit /// is null. public static async Task> CheckDomainAvailabilityAsync(this SubscriptionResource subscriptionResource, CognitiveServicesDomainAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDomainAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).CheckDomainAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -615,6 +659,10 @@ public static async Task> Chec /// CheckDomainAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Check Domain Availability parameter. @@ -622,9 +670,7 @@ public static async Task> Chec /// is null. public static Response CheckDomainAvailability(this SubscriptionResource subscriptionResource, CognitiveServicesDomainAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDomainAvailability(content, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).CheckDomainAvailability(content, cancellationToken); } /// @@ -639,6 +685,10 @@ public static Response CheckDomainAvail /// CommitmentTiers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. @@ -646,7 +696,7 @@ public static Response CheckDomainAvail /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCommitmentTiersAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCommitmentTiersAsync(location, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCommitmentTiersAsync(location, cancellationToken); } /// @@ -661,6 +711,10 @@ public static AsyncPageable GetCommitmentTiersAsync(this Subscri /// CommitmentTiers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. @@ -668,7 +722,7 @@ public static AsyncPageable GetCommitmentTiersAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCommitmentTiers(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCommitmentTiers(location, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCommitmentTiers(location, cancellationToken); } /// @@ -683,6 +737,10 @@ public static Pageable GetCommitmentTiers(this SubscriptionResou /// Models_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. @@ -690,7 +748,7 @@ public static Pageable GetCommitmentTiers(this SubscriptionResou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetModelsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetModelsAsync(location, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetModelsAsync(location, cancellationToken); } /// @@ -705,6 +763,10 @@ public static AsyncPageable GetModelsAsync(this Subscrip /// Models_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. @@ -712,7 +774,7 @@ public static AsyncPageable GetModelsAsync(this Subscrip /// A collection of that may take multiple service requests to iterate over. public static Pageable GetModels(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetModels(location, cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetModels(location, cancellationToken); } /// @@ -727,13 +789,17 @@ public static Pageable GetModels(this SubscriptionResour /// CommitmentPlans_ListPlansBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCognitiveServicesCommitmentPlansAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCognitiveServicesCommitmentPlansAsync(cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesCommitmentPlansAsync(cancellationToken); } /// @@ -748,13 +814,17 @@ public static AsyncPageable GetCognitiv /// CommitmentPlans_ListPlansBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCognitiveServicesCommitmentPlans(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCognitiveServicesCommitmentPlans(cancellationToken); + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesCommitmentPlans(cancellationToken); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs new file mode 100644 index 0000000000000..8bffeebed8596 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableCognitiveServicesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCognitiveServicesArmClient() + { + } + + /// 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 MockableCognitiveServicesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableCognitiveServicesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CognitiveServicesAccountResource GetCognitiveServicesAccountResource(ResourceIdentifier id) + { + CognitiveServicesAccountResource.ValidateResourceId(id); + return new CognitiveServicesAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CognitiveServicesDeletedAccountResource GetCognitiveServicesDeletedAccountResource(ResourceIdentifier id) + { + CognitiveServicesDeletedAccountResource.ValidateResourceId(id); + return new CognitiveServicesDeletedAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CognitiveServicesPrivateEndpointConnectionResource GetCognitiveServicesPrivateEndpointConnectionResource(ResourceIdentifier id) + { + CognitiveServicesPrivateEndpointConnectionResource.ValidateResourceId(id); + return new CognitiveServicesPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CognitiveServicesAccountDeploymentResource GetCognitiveServicesAccountDeploymentResource(ResourceIdentifier id) + { + CognitiveServicesAccountDeploymentResource.ValidateResourceId(id); + return new CognitiveServicesAccountDeploymentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CommitmentPlanResource GetCommitmentPlanResource(ResourceIdentifier id) + { + CommitmentPlanResource.ValidateResourceId(id); + return new CommitmentPlanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CognitiveServicesCommitmentPlanResource GetCognitiveServicesCommitmentPlanResource(ResourceIdentifier id) + { + CognitiveServicesCommitmentPlanResource.ValidateResourceId(id); + return new CognitiveServicesCommitmentPlanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CommitmentPlanAccountAssociationResource GetCommitmentPlanAccountAssociationResource(ResourceIdentifier id) + { + CommitmentPlanAccountAssociationResource.ValidateResourceId(id); + return new CommitmentPlanAccountAssociationResource(Client, id); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesResourceGroupResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesResourceGroupResource.cs new file mode 100644 index 0000000000000..8e863be1c673d --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableCognitiveServicesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCognitiveServicesResourceGroupResource() + { + } + + /// 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 MockableCognitiveServicesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CognitiveServicesAccountResources in the ResourceGroupResource. + /// An object representing collection of CognitiveServicesAccountResources and their operations over a CognitiveServicesAccountResource. + public virtual CognitiveServicesAccountCollection GetCognitiveServicesAccounts() + { + return GetCachedClient(client => new CognitiveServicesAccountCollection(client, Id)); + } + + /// + /// Returns a Cognitive Services account specified by the parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCognitiveServicesAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetCognitiveServicesAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a Cognitive Services account specified by the parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCognitiveServicesAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetCognitiveServicesAccounts().Get(accountName, cancellationToken); + } + + /// Gets a collection of CognitiveServicesCommitmentPlanResources in the ResourceGroupResource. + /// An object representing collection of CognitiveServicesCommitmentPlanResources and their operations over a CognitiveServicesCommitmentPlanResource. + public virtual CognitiveServicesCommitmentPlanCollection GetCognitiveServicesCommitmentPlans() + { + return GetCachedClient(client => new CognitiveServicesCommitmentPlanCollection(client, Id)); + } + + /// + /// Returns a Cognitive Services commitment plan specified by the parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetPlan + /// + /// + /// + /// The name of the commitmentPlan associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCognitiveServicesCommitmentPlanAsync(string commitmentPlanName, CancellationToken cancellationToken = default) + { + return await GetCognitiveServicesCommitmentPlans().GetAsync(commitmentPlanName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a Cognitive Services commitment plan specified by the parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetPlan + /// + /// + /// + /// The name of the commitmentPlan associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCognitiveServicesCommitmentPlan(string commitmentPlanName, CancellationToken cancellationToken = default) + { + return GetCognitiveServicesCommitmentPlans().Get(commitmentPlanName, cancellationToken); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs new file mode 100644 index 0000000000000..6a69605accab8 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs @@ -0,0 +1,569 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableCognitiveServicesSubscriptionResource : ArmResource + { + private ClientDiagnostics _cognitiveServicesAccountAccountsClientDiagnostics; + private AccountsRestOperations _cognitiveServicesAccountAccountsRestClient; + private ClientDiagnostics _cognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics; + private DeletedAccountsRestOperations _cognitiveServicesDeletedAccountDeletedAccountsRestClient; + private ClientDiagnostics _resourceSkusClientDiagnostics; + private ResourceSkusRestOperations _resourceSkusRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private CognitiveServicesManagementRestOperations _defaultRestClient; + private ClientDiagnostics _commitmentTiersClientDiagnostics; + private CommitmentTiersRestOperations _commitmentTiersRestClient; + private ClientDiagnostics _modelsClientDiagnostics; + private ModelsRestOperations _modelsRestClient; + private ClientDiagnostics _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics; + private CommitmentPlansRestOperations _cognitiveServicesCommitmentPlanCommitmentPlansRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCognitiveServicesSubscriptionResource() + { + } + + /// 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 MockableCognitiveServicesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CognitiveServicesAccountAccountsClientDiagnostics => _cognitiveServicesAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", CognitiveServicesAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations CognitiveServicesAccountAccountsRestClient => _cognitiveServicesAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CognitiveServicesAccountResource.ResourceType)); + private ClientDiagnostics CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics => _cognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", CognitiveServicesDeletedAccountResource.ResourceType.Namespace, Diagnostics); + private DeletedAccountsRestOperations CognitiveServicesDeletedAccountDeletedAccountsRestClient => _cognitiveServicesDeletedAccountDeletedAccountsRestClient ??= new DeletedAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CognitiveServicesDeletedAccountResource.ResourceType)); + private ClientDiagnostics ResourceSkusClientDiagnostics => _resourceSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceSkusRestOperations ResourceSkusRestClient => _resourceSkusRestClient ??= new ResourceSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CognitiveServicesManagementRestOperations DefaultRestClient => _defaultRestClient ??= new CognitiveServicesManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CommitmentTiersClientDiagnostics => _commitmentTiersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CommitmentTiersRestOperations CommitmentTiersRestClient => _commitmentTiersRestClient ??= new CommitmentTiersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ModelsClientDiagnostics => _modelsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ModelsRestOperations ModelsRestClient => _modelsRestClient ??= new ModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics => _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", CognitiveServicesCommitmentPlanResource.ResourceType.Namespace, Diagnostics); + private CommitmentPlansRestOperations CognitiveServicesCommitmentPlanCommitmentPlansRestClient => _cognitiveServicesCommitmentPlanCommitmentPlansRestClient ??= new CommitmentPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CognitiveServicesCommitmentPlanResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CognitiveServicesDeletedAccountResources in the SubscriptionResource. + /// An object representing collection of CognitiveServicesDeletedAccountResources and their operations over a CognitiveServicesDeletedAccountResource. + public virtual CognitiveServicesDeletedAccountCollection GetCognitiveServicesDeletedAccounts() + { + return GetCachedClient(client => new CognitiveServicesDeletedAccountCollection(client, Id)); + } + + /// + /// Returns a Cognitive Services account specified by the parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName} + /// + /// + /// Operation Id + /// DeletedAccounts_Get + /// + /// + /// + /// Resource location. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCognitiveServicesDeletedAccountAsync(AzureLocation location, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + return await GetCognitiveServicesDeletedAccounts().GetAsync(location, resourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a Cognitive Services account specified by the parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName} + /// + /// + /// Operation Id + /// DeletedAccounts_Get + /// + /// + /// + /// Resource location. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCognitiveServicesDeletedAccount(AzureLocation location, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + return GetCognitiveServicesDeletedAccounts().Get(location, resourceGroupName, accountName, cancellationToken); + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCognitiveServicesAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetCognitiveServicesAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCognitiveServicesAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetCognitiveServicesAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts + /// + /// + /// Operation Id + /// DeletedAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesDeletedAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetDeletedAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts + /// + /// + /// Operation Id + /// DeletedAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesDeletedAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetDeletedAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus + /// + /// + /// Operation Id + /// ResourceSkus_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetResourceSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableCognitiveServicesSku.DeserializeAvailableCognitiveServicesSku, ResourceSkusClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetResourceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus + /// + /// + /// Operation Id + /// ResourceSkus_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetResourceSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableCognitiveServicesSku.DeserializeAvailableCognitiveServicesSku, ResourceSkusClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetResourceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Get usages for the requested subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// Resource location. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(AzureLocation location, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ServiceAccountUsage.DeserializeServiceAccountUsage, UsagesClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Get usages for the requested subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// Resource location. + /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(AzureLocation location, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ServiceAccountUsage.DeserializeServiceAccountUsage, UsagesClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Check available SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability + /// + /// + /// Operation Id + /// CheckSkuAvailability + /// + /// + /// + /// Resource location. + /// Check SKU Availability POST body. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable CheckSkuAvailabilityAsync(AzureLocation location, CognitiveServicesSkuAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateCheckSkuAvailabilityRequest(Id.SubscriptionId, location, content); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CognitiveServicesSkuAvailabilityList.DeserializeCognitiveServicesSkuAvailabilityList, DefaultClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.CheckSkuAvailability", "value", null, cancellationToken); + } + + /// + /// Check available SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability + /// + /// + /// Operation Id + /// CheckSkuAvailability + /// + /// + /// + /// Resource location. + /// Check SKU Availability POST body. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable CheckSkuAvailability(AzureLocation location, CognitiveServicesSkuAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateCheckSkuAvailabilityRequest(Id.SubscriptionId, location, content); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CognitiveServicesSkuAvailabilityList.DeserializeCognitiveServicesSkuAvailabilityList, DefaultClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.CheckSkuAvailability", "value", null, cancellationToken); + } + + /// + /// Check whether a domain is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability + /// + /// + /// Operation Id + /// CheckDomainAvailability + /// + /// + /// + /// Check Domain Availability parameter. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDomainAvailabilityAsync(CognitiveServicesDomainAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCognitiveServicesSubscriptionResource.CheckDomainAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckDomainAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check whether a domain is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability + /// + /// + /// Operation Id + /// CheckDomainAvailability + /// + /// + /// + /// Check Domain Availability parameter. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDomainAvailability(CognitiveServicesDomainAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCognitiveServicesSubscriptionResource.CheckDomainAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckDomainAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Commitment Tiers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers + /// + /// + /// Operation Id + /// CommitmentTiers_List + /// + /// + /// + /// Resource location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCommitmentTiersAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CommitmentTiersRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommitmentTiersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CommitmentTier.DeserializeCommitmentTier, CommitmentTiersClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetCommitmentTiers", "value", "nextLink", cancellationToken); + } + + /// + /// List Commitment Tiers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers + /// + /// + /// Operation Id + /// CommitmentTiers_List + /// + /// + /// + /// Resource location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCommitmentTiers(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CommitmentTiersRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommitmentTiersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CommitmentTier.DeserializeCommitmentTier, CommitmentTiersClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetCommitmentTiers", "value", "nextLink", cancellationToken); + } + + /// + /// List Models. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models + /// + /// + /// Operation Id + /// Models_List + /// + /// + /// + /// Resource location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetModelsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ModelsRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ModelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CognitiveServicesModel.DeserializeCognitiveServicesModel, ModelsClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetModels", "value", "nextLink", cancellationToken); + } + + /// + /// List Models. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models + /// + /// + /// Operation Id + /// Models_List + /// + /// + /// + /// Resource location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetModels(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ModelsRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ModelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CognitiveServicesModel.DeserializeCognitiveServicesModel, ModelsClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetModels", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/commitmentPlans + /// + /// + /// Operation Id + /// CommitmentPlans_ListPlansBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCognitiveServicesCommitmentPlansAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/commitmentPlans + /// + /// + /// Operation Id + /// CommitmentPlans_ListPlansBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCognitiveServicesCommitmentPlans(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 4933b39847467..0000000000000 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CognitiveServices -{ - /// 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 CognitiveServicesAccountResources in the ResourceGroupResource. - /// An object representing collection of CognitiveServicesAccountResources and their operations over a CognitiveServicesAccountResource. - public virtual CognitiveServicesAccountCollection GetCognitiveServicesAccounts() - { - return GetCachedClient(Client => new CognitiveServicesAccountCollection(Client, Id)); - } - - /// Gets a collection of CognitiveServicesCommitmentPlanResources in the ResourceGroupResource. - /// An object representing collection of CognitiveServicesCommitmentPlanResources and their operations over a CognitiveServicesCommitmentPlanResource. - public virtual CognitiveServicesCommitmentPlanCollection GetCognitiveServicesCommitmentPlans() - { - return GetCachedClient(Client => new CognitiveServicesCommitmentPlanCollection(Client, Id)); - } - } -} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 1e92e72295e40..0000000000000 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,506 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.CognitiveServices.Models; - -namespace Azure.ResourceManager.CognitiveServices -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _cognitiveServicesAccountAccountsClientDiagnostics; - private AccountsRestOperations _cognitiveServicesAccountAccountsRestClient; - private ClientDiagnostics _cognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics; - private DeletedAccountsRestOperations _cognitiveServicesDeletedAccountDeletedAccountsRestClient; - private ClientDiagnostics _resourceSkusClientDiagnostics; - private ResourceSkusRestOperations _resourceSkusRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private CognitiveServicesManagementRestOperations _defaultRestClient; - private ClientDiagnostics _commitmentTiersClientDiagnostics; - private CommitmentTiersRestOperations _commitmentTiersRestClient; - private ClientDiagnostics _modelsClientDiagnostics; - private ModelsRestOperations _modelsRestClient; - private ClientDiagnostics _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics; - private CommitmentPlansRestOperations _cognitiveServicesCommitmentPlanCommitmentPlansRestClient; - - /// 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 CognitiveServicesAccountAccountsClientDiagnostics => _cognitiveServicesAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", CognitiveServicesAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations CognitiveServicesAccountAccountsRestClient => _cognitiveServicesAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CognitiveServicesAccountResource.ResourceType)); - private ClientDiagnostics CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics => _cognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", CognitiveServicesDeletedAccountResource.ResourceType.Namespace, Diagnostics); - private DeletedAccountsRestOperations CognitiveServicesDeletedAccountDeletedAccountsRestClient => _cognitiveServicesDeletedAccountDeletedAccountsRestClient ??= new DeletedAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CognitiveServicesDeletedAccountResource.ResourceType)); - private ClientDiagnostics ResourceSkusClientDiagnostics => _resourceSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceSkusRestOperations ResourceSkusRestClient => _resourceSkusRestClient ??= new ResourceSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CognitiveServicesManagementRestOperations DefaultRestClient => _defaultRestClient ??= new CognitiveServicesManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CommitmentTiersClientDiagnostics => _commitmentTiersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CommitmentTiersRestOperations CommitmentTiersRestClient => _commitmentTiersRestClient ??= new CommitmentTiersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ModelsClientDiagnostics => _modelsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ModelsRestOperations ModelsRestClient => _modelsRestClient ??= new ModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics => _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", CognitiveServicesCommitmentPlanResource.ResourceType.Namespace, Diagnostics); - private CommitmentPlansRestOperations CognitiveServicesCommitmentPlanCommitmentPlansRestClient => _cognitiveServicesCommitmentPlanCommitmentPlansRestClient ??= new CommitmentPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CognitiveServicesCommitmentPlanResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of CognitiveServicesDeletedAccountResources in the SubscriptionResource. - /// An object representing collection of CognitiveServicesDeletedAccountResources and their operations over a CognitiveServicesDeletedAccountResource. - public virtual CognitiveServicesDeletedAccountCollection GetCognitiveServicesDeletedAccounts() - { - return GetCachedClient(Client => new CognitiveServicesDeletedAccountCollection(Client, Id)); - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCognitiveServicesAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCognitiveServicesAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts - /// - /// - /// Operation Id - /// DeletedAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesDeletedAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts - /// - /// - /// Operation Id - /// DeletedAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesDeletedAccountDeletedAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesDeletedAccountResource(Client, CognitiveServicesAccountData.DeserializeCognitiveServicesAccountData(e)), CognitiveServicesDeletedAccountDeletedAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus - /// - /// - /// Operation Id - /// ResourceSkus_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetResourceSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableCognitiveServicesSku.DeserializeAvailableCognitiveServicesSku, ResourceSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus - /// - /// - /// Operation Id - /// ResourceSkus_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetResourceSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableCognitiveServicesSku.DeserializeAvailableCognitiveServicesSku, ResourceSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Get usages for the requested subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// Resource location. - /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(AzureLocation location, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ServiceAccountUsage.DeserializeServiceAccountUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Get usages for the requested subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// Resource location. - /// An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(AzureLocation location, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ServiceAccountUsage.DeserializeServiceAccountUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Check available SKUs. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability - /// - /// - /// Operation Id - /// CheckSkuAvailability - /// - /// - /// - /// Resource location. - /// Check SKU Availability POST body. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable CheckSkuAvailabilityAsync(AzureLocation location, CognitiveServicesSkuAvailabilityContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateCheckSkuAvailabilityRequest(Id.SubscriptionId, location, content); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CognitiveServicesSkuAvailabilityList.DeserializeCognitiveServicesSkuAvailabilityList, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.CheckSkuAvailability", "value", null, cancellationToken); - } - - /// - /// Check available SKUs. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability - /// - /// - /// Operation Id - /// CheckSkuAvailability - /// - /// - /// - /// Resource location. - /// Check SKU Availability POST body. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable CheckSkuAvailability(AzureLocation location, CognitiveServicesSkuAvailabilityContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateCheckSkuAvailabilityRequest(Id.SubscriptionId, location, content); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CognitiveServicesSkuAvailabilityList.DeserializeCognitiveServicesSkuAvailabilityList, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.CheckSkuAvailability", "value", null, cancellationToken); - } - - /// - /// Check whether a domain is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability - /// - /// - /// Operation Id - /// CheckDomainAvailability - /// - /// - /// - /// Check Domain Availability parameter. - /// The cancellation token to use. - public virtual async Task> CheckDomainAvailabilityAsync(CognitiveServicesDomainAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDomainAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckDomainAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check whether a domain is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability - /// - /// - /// Operation Id - /// CheckDomainAvailability - /// - /// - /// - /// Check Domain Availability parameter. - /// The cancellation token to use. - public virtual Response CheckDomainAvailability(CognitiveServicesDomainAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDomainAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckDomainAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List Commitment Tiers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers - /// - /// - /// Operation Id - /// CommitmentTiers_List - /// - /// - /// - /// Resource location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCommitmentTiersAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CommitmentTiersRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommitmentTiersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CommitmentTier.DeserializeCommitmentTier, CommitmentTiersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCommitmentTiers", "value", "nextLink", cancellationToken); - } - - /// - /// List Commitment Tiers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers - /// - /// - /// Operation Id - /// CommitmentTiers_List - /// - /// - /// - /// Resource location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCommitmentTiers(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CommitmentTiersRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommitmentTiersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CommitmentTier.DeserializeCommitmentTier, CommitmentTiersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCommitmentTiers", "value", "nextLink", cancellationToken); - } - - /// - /// List Models. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models - /// - /// - /// Operation Id - /// Models_List - /// - /// - /// - /// Resource location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetModelsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ModelsRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ModelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CognitiveServicesModel.DeserializeCognitiveServicesModel, ModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetModels", "value", "nextLink", cancellationToken); - } - - /// - /// List Models. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models - /// - /// - /// Operation Id - /// Models_List - /// - /// - /// - /// Resource location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetModels(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ModelsRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ModelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CognitiveServicesModel.DeserializeCognitiveServicesModel, ModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetModels", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/commitmentPlans - /// - /// - /// Operation Id - /// CommitmentPlans_ListPlansBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCognitiveServicesCommitmentPlansAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/commitmentPlans - /// - /// - /// Operation Id - /// CommitmentPlans_ListPlansBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCognitiveServicesCommitmentPlans(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/CHANGELOG.md b/sdk/communication/Azure.Communication.JobRouter/CHANGELOG.md index aeefffbde61de..09316d82792ac 100644 --- a/sdk/communication/Azure.Communication.JobRouter/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.JobRouter/CHANGELOG.md @@ -1,5 +1,177 @@ # Release History +## 1.0.0 + +### Features Added + +#### RouterAdministrationClient +- Added `RequestContext` to all methods which can override default behaviors of the client pipeline on a per-call basis. +- Added `RequestConditions` to all `Update` methods which can specify HTTP options for conditional requests based on modification time. + +#### RouterClient +- Added `RequestContext` to all methods which can override default behaviors of the client pipeline on a per-call basis. +- Added `RequestConditions` to all `Update` methods which can specify HTTP options for conditional requests based on modification time. + +### Breaking Changes + +#### RouterAdministrationClient +- `GetQueues` returns `AsyncPageable` rather than `Pageable` +- `GetDistributionPolicies` returns `AsyncPageable` rather than `Pageable` +- `GetClassificationPolicies` returns `AsyncPageable` rather than `Pageable` +- `GetExceptionPolicies` returns `AsyncPageable` rather than `Pageable` +- `UpdateQueue(UpdateQueueOptions options, CancellationToken cancellationToken)` changed to `UpdateQueue(RouterQueue queue, CancellationToken cancellationToken)` +- `UpdateDistributionPolicy(UpdateDistributionPolicyOptions options, CancellationToken cancellationToken)` changed to `UpdateDistributionPolicy(DistributionPolicy distributionPolicy, CancellationToken cancellationToken)` +- `UpdateClassificationPolicy(UpdateClassificationPolicyOptions options, CancellationToken cancellationToken)` changed to `UpdateClassificationPolicy(ClassificationPolicy classificationPolicy, CancellationToken cancellationToken)` +- `UpdateExceptionPolicy(UpdateExceptionPolicyOptions options, CancellationToken cancellationToken)` changed to `UpdateExceptionPolicy(ExceptionPolicy exceptionPolicy, CancellationToken cancellationToken)` + +#### RouterClient +- `GetJobs` returns `AsyncPageable` rather than `AsyncPageable` +- `GetWorkers` returns `AsyncPageable` rather than `AsyncPageable` +- `UpdateJob(UpdateJobOptions options, CancellationToken cancellationToken)` changed to `UpdateJob(RouterJob job, CancellationToken cancellationToken)` +- `UpdateWorker(UpdateWorkerOptions options, CancellationToken cancellationToken)` changed to `UpdateWorker(RouterWorker worker, CancellationToken cancellationToken)` +- `CancelJob(CancelJobOptions options, CancellationToken cancellationToken = default)` changed to `CancelJob(string jobId, CancelJobOptions cancelJobOptions = null, CancellationToken cancellationToken = default)` +- `CompleteJob(CompleteJobOptions options, CancellationToken cancellationToken = default)` changed to `CompleteJob(string jobId, CompleteJobOptions completeJobOptions = null, CancellationToken cancellationToken = default)` +- `CloseJob(CloseJobOptions options, CancellationToken cancellationToken = default)` changed to `CloseJob(string jobId, CloseJobOptions closeJobOptions = null, CancellationToken cancellationToken = default)` +- `DeclineJobOffer(DeclineJobOfferOptions options, CancellationToken cancellationToken = default)` changed to `DeclineJobOffer(string workerId, string offerId, DeclineJobOfferOptions declineJobOfferOptions = null, CancellationToken cancellationToken = default)` +- `UnassignJob(UnassignJobOptions options, CancellationToken cancellationToken = default)` changed to `UnassignJob(string jobId, string assignmentId, UnassignJobOptions unassignJobOptions = null, CancellationToken cancellationToken = default)` + +#### CancelJobOptions +- Changed constructor from `CancelJobOptions(string jobId)` to `CancelJobOptions()` + +#### CompleteJobOptions +- Changed constructor from `CompleteJobOptions(string jobId, string assignmentId)` to `CompleteJobOptions(string assignmentId)` + +#### CloseJobOptions +- Changed constructor from `CloseJobOptions(string jobId, string assignmentId)` to `CloseJobOptions(string assignmentId)` + +#### DeclineJobOfferOptions +- Changed constructor from `DeclineJobOfferOptions(string workerId, string offerId)` to `DeclineJobOfferOptions()` + +#### UnassignJobOptions +- Changed constructor from `UnassignJobOptions(string jobId, string assignmentId)` to `UnassignJobOptions()` + +#### RouterJob && CreateJobOptions && CreateJobWithClassificationOptions +- Property `Notes` - Changed from `List` to `IList` +- Property `RequestedWorkerSelectors` - Changed from `List`to `IList` +- Property `Labels` - Changed from `Dictionary` to `IDictionary` +- Property `Tags` - Changed from `Dictionary` to `IDictionary` + +##### RouterJobNote +- Changed constructor from `RouterJobNote()` to `RouterJobNote(string message)` +- Removed setter from `Message` + +#### RouterWorker && CreateWorkerOptions +- Rename property `QueueAssignments` -> `Queues` +- `Queues` - Changed `Dictionary` -> `IList` +- Rename property `TotalCapacity` -> `Capacity` +- Rename property `ChannelConfigurations` -> `Channels` +- `Channels` - Changed `Dictionary` -> `IList` + +#### ClassificationPolicy && CreateClassificationPolicyOptions +- Property `List QueueSelectors` changed to `IList QueueSelectorAttachments` +- Property `List WorkerSelectors` changed to `IList WorkerSelectorAttachments` + +#### ExceptionPolicy && CreateExceptionPolicyOptions +- Property `ExceptionRules` - Changed from `Dictionary` -> `IList` + +##### ExceptionRule +- `Actions` - Changed `Dictionary` -> `IList` + +##### CancelExceptionAction +- Changed constructor from `CancelExceptionAction(string note = null, string dispositionCode = null)` to `CancelExceptionAction()` + +##### ReclassifyExceptionAction +- Changed constructor from `ReclassifyExceptionAction(string classificationPolicyId, IDictionary labelsToUpsert = null)` to `ReclassifyExceptionAction()` +- Removed setter from `LabelsToUpsert` + +#### BestWorkerMode +- Removed constructor `BestWorkerMode(RouterRule scoringRule = null, IList scoringParameterSelectors = null, bool allowScoringBatchOfWorkers = false, int? batchSize = null, bool descendingOrder = true, bool bypassSelectors = false)` + +##### ScoringRuleOptions +- Rename property `AllowScoringBatchOfWorkers` -> `IsBatchScoringEnabled` + +#### FunctionRouterRuleCredential +- Removed properties `AppKey` and `FunctionKey` + +#### OAuth2WebhookClientCredential +- Removed property `ClientSecret` + +#### RouterQueueStatistics +- Changed `IReadOnlyDictionary EstimatedWaitTimeMinutes` to `IDictionary EstimatedWaitTimes` + +#### LabelOperator +- Renamed `GreaterThanEqual` to `GreaterThanOrEqual` +- Renamed `LessThanEqual` to `LessThanOrEqual` + +#### Renames +- `ChannelConfiguration` -> `RouterChannel` +- `Oauth2ClientCredential` -> `OAuth2WebhookClientCredential` +- `LabelValue` -> `RouterValue` + +#### Deletions +- `ClassificationPolicyItem` +- `DistributionPolicyItem` +- `ExceptionPolicyItem` +- `RouterQueueItem` +- `RouterWorkerItem` +- `RouterJobItem` +- `RouterQueueAssignment` +- `UpdateClassificationPolicyOptions` +- `UpdateDistributionPolicyOptions` +- `UpdateExceptionPolicyOptions` +- `UpdateQueueOptions` +- `UpdateWorkerOptions` +- `UpdateJobOptions` + +### Other Changes + +#### ClassificationPolicy +- Add `ETag` +- Added constructor `ClassificationPolicy(string classificationPolicyId)` +- Added setters to `FallbackQueueId`, `Name`, and `PrioritizationRule` + +#### DistributionPolicy +- Add `ETag` +- Added constructor `DistributionPolicy(string distributionPolicyId)` +- Added setters to `Mode` and `Name` + +#### ExceptionPolicy +- Added `ETag` +- Added constructor `ExceptionPolicy(string exceptionPolicyId)` +- Added setter to `Name` + +##### ExceptionRule +- Added `Id` + +##### ExceptionAction +- Added `Id`. Property is read-only. If not provided, it will be generated by the service. + +##### ReclassifyExceptionAction +- Added setter to `ClassificationPolicyId` + +#### RouterChannel +- Added `ChannelId` + +#### RouterJob +- Added `ETag` +- Added constructor `RouterJob(string jobId)` +- Added setters for `ChannelId`, `ChannelReference`, `ClassificationPolicyId`, `DispositionCode`, `MatchingMode`, `Priority`, `QueueId` + +#### RouterQueue +- Added `ETag` +- Added constructor `RouterQueue(string queueId)` +- Added setters for `DistributionPolicyId`, `ExceptionPolicyId` and `Name` + +#### RouterWorker +- Added `ETag` +- Added constructor `RouterWorker(string workerId)` + +#### BestWorkerMode +- Added setters to `ScoringRule` and `ScoringRuleOptions` + +#### OAuth2WebhookClientCredential +- Added constructor `OAuth2WebhookClientCredential(string clientId, string clientSecret)` + ## 1.0.0-beta.4 (Unreleased) ### Features Added diff --git a/sdk/communication/Azure.Communication.JobRouter/README.md b/sdk/communication/Azure.Communication.JobRouter/README.md index f804d06bf4dd9..9e7f2fe8a1649 100644 --- a/sdk/communication/Azure.Communication.JobRouter/README.md +++ b/sdk/communication/Azure.Communication.JobRouter/README.md @@ -117,7 +117,7 @@ Response job = await routerClient.CreateJobAsync( Priority = 1, RequestedWorkerSelectors = { - new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new LabelValue(10)) + new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new RouterValue(10)) } }); ``` @@ -126,11 +126,11 @@ Response job = await routerClient.CreateJobAsync( Now, we register a worker to receive work from that queue, with a label of `Some-Skill` equal to 11. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_RegisterWorker_Async Response worker = await routerClient.CreateWorkerAsync( - new CreateWorkerOptions(workerId: "worker-1", totalCapacity: 1) + new CreateWorkerOptions(workerId: "worker-1", capacity: 1) { - QueueAssignments = { [queue.Value.Id] = new RouterQueueAssignment() }, - Labels = { ["Some-Skill"] = new LabelValue(11) }, - ChannelConfigurations = { ["my-channel"] = new ChannelConfiguration(1) }, + Queues = { queue.Value.Id }, + Labels = { ["Some-Skill"] = new RouterValue(11) }, + Channels = { new RouterChannel("my-channel", 1) }, AvailableForOffers = true, } ); @@ -203,9 +203,7 @@ Console.WriteLine($"Job assignment has been successful: {updatedJob.Value.Status Once the worker is done with the job, the worker has to mark the job as `completed`. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob_Async Response completeJob = await routerClient.CompleteJobAsync( - options: new CompleteJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CompleteJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -217,9 +215,7 @@ Console.WriteLine($"Job has been successfully completed: {completeJob.Status == After a job has been completed, the worker can perform wrap up actions to the job before closing the job and finally releasing its capacity to accept more incoming jobs ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob_Async Response closeJob = await routerClient.CloseJobAsync( - options: new CloseJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -232,7 +228,7 @@ Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobSta ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJobInFuture_Async // Optionally, a job can also be set up to be marked as closed in the future. var closeJobInFuture = await routerClient.CloseJobAsync( - options: new CloseJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" diff --git a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs index bfc667dda38e1..7b9ab2b25ae21 100644 --- a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs @@ -10,122 +10,57 @@ internal AcceptJobOfferResult() { } public partial class BestWorkerMode : Azure.Communication.JobRouter.DistributionMode { public BestWorkerMode() { } - public BestWorkerMode(Azure.Communication.JobRouter.RouterRule scoringRule = null, System.Collections.Generic.IList scoringParameterSelectors = null, bool allowScoringBatchOfWorkers = false, int? batchSize = default(int?), bool descendingOrder = true, bool bypassSelectors = false) { } - public Azure.Communication.JobRouter.RouterRule ScoringRule { get { throw null; } } - public Azure.Communication.JobRouter.ScoringRuleOptions ScoringRuleOptions { get { throw null; } } + public Azure.Communication.JobRouter.RouterRule ScoringRule { get { throw null; } set { } } + public Azure.Communication.JobRouter.ScoringRuleOptions ScoringRuleOptions { get { throw null; } set { } } } public partial class CancelExceptionAction : Azure.Communication.JobRouter.ExceptionAction { - public CancelExceptionAction(string note = null, string dispositionCode = null) { } + public CancelExceptionAction() { } public string DispositionCode { get { throw null; } set { } } public string Note { get { throw null; } set { } } } public partial class CancelJobOptions { - public CancelJobOptions(string jobId) { } - public string DispositionCode { get { throw null; } set { } } - public string JobId { get { throw null; } } - public string Note { get { throw null; } set { } } - } - public partial class CancelJobRequest - { - public CancelJobRequest() { } + public CancelJobOptions() { } public string DispositionCode { get { throw null; } set { } } public string Note { get { throw null; } set { } } } - public partial class ChannelConfiguration - { - internal ChannelConfiguration() { } - public int CapacityCostPerJob { get { throw null; } } - public int? MaxNumberOfJobs { get { throw null; } set { } } - } public partial class ClassificationPolicy { - internal ClassificationPolicy() { } - public string FallbackQueueId { get { throw null; } } - public string Id { get { throw null; } } - public string Name { get { throw null; } } - public Azure.Communication.JobRouter.RouterRule PrioritizationRule { get { throw null; } } - public System.Collections.Generic.List QueueSelectors { get { throw null; } } - public System.Collections.Generic.List WorkerSelectors { get { throw null; } } - } - public partial class ClassificationPolicyItem - { - internal ClassificationPolicyItem() { } - public Azure.Communication.JobRouter.ClassificationPolicy ClassificationPolicy { get { throw null; } } + public ClassificationPolicy(string classificationPolicyId) { } public Azure.ETag ETag { get { throw null; } } + public string FallbackQueueId { get { throw null; } set { } } + public string Id { get { throw null; } } + public string Name { get { throw null; } set { } } + public Azure.Communication.JobRouter.RouterRule PrioritizationRule { get { throw null; } set { } } + public System.Collections.Generic.IList QueueSelectorAttachments { get { throw null; } } + public System.Collections.Generic.IList WorkerSelectorAttachments { get { throw null; } } } public partial class CloseJobOptions { - public CloseJobOptions(string jobId, string assignmentId) { } + public CloseJobOptions(string assignmentId) { } public string AssignmentId { get { throw null; } } public System.DateTimeOffset CloseAt { get { throw null; } set { } } public string DispositionCode { get { throw null; } set { } } - public string JobId { get { throw null; } } public string Note { get { throw null; } set { } } } - public partial class CloseJobRequest - { - public CloseJobRequest(string assignmentId) { } - public string AssignmentId { get { throw null; } } - public System.DateTimeOffset? CloseAt { get { throw null; } set { } } - public string DispositionCode { get { throw null; } set { } } - public string Note { get { throw null; } set { } } - } - public static partial class CommunicationJobRouterModelFactory - { - public static Azure.Communication.JobRouter.AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) { throw null; } - public static Azure.Communication.JobRouter.BestWorkerMode BestWorkerMode(int minConcurrentOffers = 0, int maxConcurrentOffers = 0, bool? bypassSelectors = default(bool?), Azure.Communication.JobRouter.RouterRule scoringRule = null, Azure.Communication.JobRouter.ScoringRuleOptions scoringRuleOptions = null) { throw null; } - public static Azure.Communication.JobRouter.ChannelConfiguration ChannelConfiguration(int capacityCostPerJob = 0, int? maxNumberOfJobs = default(int?)) { throw null; } - public static Azure.Communication.JobRouter.ConditionalQueueSelectorAttachment ConditionalQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition = null, System.Collections.Generic.IEnumerable queueSelectors = null) { throw null; } - public static Azure.Communication.JobRouter.ConditionalWorkerSelectorAttachment ConditionalWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition = null, System.Collections.Generic.IEnumerable workerSelectors = null) { throw null; } - public static Azure.Communication.JobRouter.ExceptionRule ExceptionRule(Azure.Communication.JobRouter.ExceptionTrigger trigger = null, System.Collections.Generic.IDictionary actions = null) { throw null; } - public static Azure.Communication.JobRouter.ExpressionRouterRule ExpressionRouterRule(string language = null, string expression = null) { throw null; } - public static Azure.Communication.JobRouter.FunctionRouterRule FunctionRouterRule(System.Uri functionUri = null, Azure.Communication.JobRouter.FunctionRouterRuleCredential credential = null) { throw null; } - public static Azure.Communication.JobRouter.Oauth2ClientCredential Oauth2ClientCredential(string clientId = null, string clientSecret = null) { throw null; } - public static Azure.Communication.JobRouter.PassThroughQueueSelectorAttachment PassThroughQueueSelectorAttachment(string key = null, Azure.Communication.JobRouter.LabelOperator labelOperator = default(Azure.Communication.JobRouter.LabelOperator)) { throw null; } - public static Azure.Communication.JobRouter.QueueLengthExceptionTrigger QueueLengthExceptionTrigger(int threshold = 0) { throw null; } - public static Azure.Communication.JobRouter.QueueWeightedAllocation QueueWeightedAllocation(double weight = 0, System.Collections.Generic.IEnumerable queueSelectors = null) { throw null; } - public static Azure.Communication.JobRouter.RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, System.DateTimeOffset assignedAt = default(System.DateTimeOffset), System.DateTimeOffset? completedAt = default(System.DateTimeOffset?), System.DateTimeOffset? closedAt = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Communication.JobRouter.RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset? offeredAt = default(System.DateTimeOffset?), System.DateTimeOffset? expiresAt = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Communication.JobRouter.RouterQueueStatistics RouterQueueStatistics(string queueId = null, int length = 0, System.Collections.Generic.IReadOnlyDictionary estimatedWaitTimeMinutes = null, double? longestJobWaitTimeMinutes = default(double?)) { throw null; } - public static Azure.Communication.JobRouter.RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset assignedAt = default(System.DateTimeOffset)) { throw null; } - public static Azure.Communication.JobRouter.RuleEngineQueueSelectorAttachment RuleEngineQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule = null) { throw null; } - public static Azure.Communication.JobRouter.RuleEngineWorkerSelectorAttachment RuleEngineWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule = null) { throw null; } - public static Azure.Communication.JobRouter.ScheduleAndSuspendMode ScheduleAndSuspendMode(System.DateTimeOffset scheduleAt = default(System.DateTimeOffset)) { throw null; } - public static Azure.Communication.JobRouter.ScoringRuleOptions ScoringRuleOptions(int? batchSize = default(int?), System.Collections.Generic.IEnumerable scoringParameters = null, bool? allowScoringBatchOfWorkers = default(bool?), bool? descendingOrder = default(bool?)) { throw null; } - public static Azure.Communication.JobRouter.StaticQueueSelectorAttachment StaticQueueSelectorAttachment(Azure.Communication.JobRouter.RouterQueueSelector queueSelector = null) { throw null; } - public static Azure.Communication.JobRouter.StaticWorkerSelectorAttachment StaticWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterWorkerSelector workerSelector = null) { throw null; } - public static Azure.Communication.JobRouter.UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = 0) { throw null; } - public static Azure.Communication.JobRouter.WebhookRouterRule WebhookRouterRule(System.Uri authorizationServerUri = null, Azure.Communication.JobRouter.Oauth2ClientCredential clientCredential = null, System.Uri webhookUri = null) { throw null; } - public static Azure.Communication.JobRouter.WeightedAllocationQueueSelectorAttachment WeightedAllocationQueueSelectorAttachment(System.Collections.Generic.IEnumerable allocations = null) { throw null; } - public static Azure.Communication.JobRouter.WeightedAllocationWorkerSelectorAttachment WeightedAllocationWorkerSelectorAttachment(System.Collections.Generic.IEnumerable allocations = null) { throw null; } - public static Azure.Communication.JobRouter.WorkerWeightedAllocation WorkerWeightedAllocation(double weight = 0, System.Collections.Generic.IEnumerable workerSelectors = null) { throw null; } - } public partial class CompleteJobOptions { - public CompleteJobOptions(string jobId, string assignmentId) { } - public string AssignmentId { get { throw null; } } - public string JobId { get { throw null; } } - public string Note { get { throw null; } set { } } - } - public partial class CompleteJobRequest - { - public CompleteJobRequest(string assignmentId) { } + public CompleteJobOptions(string assignmentId) { } public string AssignmentId { get { throw null; } } public string Note { get { throw null; } set { } } } public partial class ConditionalQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { - internal ConditionalQueueSelectorAttachment() { } + public ConditionalQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition) { } public Azure.Communication.JobRouter.RouterRule Condition { get { throw null; } } - public System.Collections.Generic.IReadOnlyList QueueSelectors { get { throw null; } } + public System.Collections.Generic.IList QueueSelectors { get { throw null; } } } public partial class ConditionalWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - internal ConditionalWorkerSelectorAttachment() { } + public ConditionalWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition) { } public Azure.Communication.JobRouter.RouterRule Condition { get { throw null; } } - public System.Collections.Generic.IReadOnlyList WorkerSelectors { get { throw null; } } + public System.Collections.Generic.IList WorkerSelectors { get { throw null; } } } public partial class CreateClassificationPolicyOptions { @@ -134,9 +69,9 @@ public CreateClassificationPolicyOptions(string classificationPolicyId) { } public string FallbackQueueId { get { throw null; } set { } } public string Name { get { throw null; } set { } } public Azure.Communication.JobRouter.RouterRule PrioritizationRule { get { throw null; } set { } } - public System.Collections.Generic.List QueueSelectors { get { throw null; } } + public System.Collections.Generic.IList QueueSelectorAttachments { get { throw null; } } public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - public System.Collections.Generic.List WorkerSelectors { get { throw null; } } + public System.Collections.Generic.IList WorkerSelectorAttachments { get { throw null; } } } public partial class CreateDistributionPolicyOptions { @@ -149,9 +84,9 @@ public CreateDistributionPolicyOptions(string distributionPolicyId, System.TimeS } public partial class CreateExceptionPolicyOptions { - public CreateExceptionPolicyOptions(string exceptionPolicyId, System.Collections.Generic.IDictionary exceptionRules) { } + public CreateExceptionPolicyOptions(string exceptionPolicyId, System.Collections.Generic.IList exceptionRules) { } public string ExceptionPolicyId { get { throw null; } } - public System.Collections.Generic.IDictionary ExceptionRules { get { throw null; } } + public System.Collections.Generic.IList ExceptionRules { get { throw null; } } public string Name { get { throw null; } set { } } public Azure.RequestConditions RequestConditions { get { throw null; } set { } } } @@ -161,14 +96,14 @@ public CreateJobOptions(string jobId, string channelId, string queueId) { } public string ChannelId { get { throw null; } } public string ChannelReference { get { throw null; } set { } } public string JobId { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } public Azure.Communication.JobRouter.JobMatchingMode MatchingMode { get { throw null; } set { } } - public System.Collections.Generic.List Notes { get { throw null; } } + public System.Collections.Generic.IList Notes { get { throw null; } } public int? Priority { get { throw null; } set { } } public string QueueId { get { throw null; } } public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public System.Collections.Generic.IList RequestedWorkerSelectors { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } } public partial class CreateJobWithClassificationPolicyOptions { @@ -177,47 +112,40 @@ public CreateJobWithClassificationPolicyOptions(string jobId, string channelId, public string ChannelReference { get { throw null; } set { } } public string ClassificationPolicyId { get { throw null; } set { } } public string JobId { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } public Azure.Communication.JobRouter.JobMatchingMode MatchingMode { get { throw null; } set { } } - public System.Collections.Generic.List Notes { get { throw null; } } + public System.Collections.Generic.IList Notes { get { throw null; } } public int? Priority { get { throw null; } set { } } public string QueueId { get { throw null; } set { } } public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public System.Collections.Generic.IList RequestedWorkerSelectors { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } } public partial class CreateQueueOptions { public CreateQueueOptions(string queueId, string distributionPolicyId) { } public string DistributionPolicyId { get { throw null; } } public string ExceptionPolicyId { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } public string Name { get { throw null; } set { } } public string QueueId { get { throw null; } } public Azure.RequestConditions RequestConditions { get { throw null; } set { } } } public partial class CreateWorkerOptions { - public CreateWorkerOptions(string workerId, int totalCapacity) { } + public CreateWorkerOptions(string workerId, int capacity) { } public bool AvailableForOffers { get { throw null; } set { } } - public System.Collections.Generic.IDictionary ChannelConfigurations { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } - public System.Collections.Generic.IDictionary QueueAssignments { get { throw null; } } + public int Capacity { get { throw null; } } + public System.Collections.Generic.IList Channels { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public System.Collections.Generic.IList Queues { get { throw null; } } public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - public int TotalCapacity { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } public string WorkerId { get { throw null; } } } public partial class DeclineJobOfferOptions { - public DeclineJobOfferOptions(string workerId, string offerId) { } - public string OfferId { get { throw null; } } - public System.DateTimeOffset? RetryOfferAt { get { throw null; } set { } } - public string WorkerId { get { throw null; } } - } - public partial class DeclineJobOfferRequest - { - public DeclineJobOfferRequest() { } + public DeclineJobOfferOptions() { } public System.DateTimeOffset? RetryOfferAt { get { throw null; } set { } } } public partial class DirectMapRouterRule : Azure.Communication.JobRouter.RouterRule @@ -228,49 +156,44 @@ public abstract partial class DistributionMode { protected DistributionMode() { } public bool? BypassSelectors { get { throw null; } set { } } + public string Kind { get { throw null; } protected set { } } public int MaxConcurrentOffers { get { throw null; } set { } } public int MinConcurrentOffers { get { throw null; } set { } } } public partial class DistributionPolicy { - internal DistributionPolicy() { } + public DistributionPolicy(string distributionPolicyId) { } + public Azure.ETag ETag { get { throw null; } } public string Id { get { throw null; } } - public Azure.Communication.JobRouter.DistributionMode Mode { get { throw null; } } - public string Name { get { throw null; } } + public Azure.Communication.JobRouter.DistributionMode Mode { get { throw null; } set { } } + public string Name { get { throw null; } set { } } public System.TimeSpan? OfferExpiresAfter { get { throw null; } set { } } } - public partial class DistributionPolicyItem - { - internal DistributionPolicyItem() { } - public Azure.Communication.JobRouter.DistributionPolicy DistributionPolicy { get { throw null; } } - public Azure.ETag ETag { get { throw null; } } - } public abstract partial class ExceptionAction { protected ExceptionAction() { } - } - public partial class ExceptionPolicy - { - internal ExceptionPolicy() { } - public System.Collections.Generic.IDictionary ExceptionRules { get { throw null; } } public string Id { get { throw null; } } - public string Name { get { throw null; } } + public string Kind { get { throw null; } protected set { } } } - public partial class ExceptionPolicyItem + public partial class ExceptionPolicy { - internal ExceptionPolicyItem() { } + public ExceptionPolicy(string exceptionPolicyId) { } public Azure.ETag ETag { get { throw null; } } - public Azure.Communication.JobRouter.ExceptionPolicy ExceptionPolicy { get { throw null; } } + public System.Collections.Generic.IList ExceptionRules { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } set { } } } public partial class ExceptionRule { - public ExceptionRule(Azure.Communication.JobRouter.ExceptionTrigger trigger, System.Collections.Generic.IDictionary actions) { } - public System.Collections.Generic.IDictionary Actions { get { throw null; } } + public ExceptionRule(string id, Azure.Communication.JobRouter.ExceptionTrigger trigger) { } + public System.Collections.Generic.IList Actions { get { throw null; } } + public string Id { get { throw null; } } public Azure.Communication.JobRouter.ExceptionTrigger Trigger { get { throw null; } } } public abstract partial class ExceptionTrigger { protected ExceptionTrigger() { } + public string Kind { get { throw null; } protected set { } } } public partial class ExpressionRouterRule : Azure.Communication.JobRouter.RouterRule { @@ -288,22 +211,18 @@ public partial class FunctionRouterRuleCredential { public FunctionRouterRuleCredential(string functionKey) { } public FunctionRouterRuleCredential(string appKey, string clientId) { } - public string AppKey { get { throw null; } } - public string ClientId { get { throw null; } } - public string FunctionKey { get { throw null; } } } public abstract partial class JobMatchingMode { - internal JobMatchingMode() { } + protected JobMatchingMode() { } + public string Kind { get { throw null; } protected set { } } } public partial class JobRouterAdministrationClient { protected JobRouterAdministrationClient() { } public JobRouterAdministrationClient(string connectionString) { } public JobRouterAdministrationClient(string connectionString, Azure.Communication.JobRouter.JobRouterClientOptions options) { } - public JobRouterAdministrationClient(System.Uri endpoint) { } public JobRouterAdministrationClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } - public JobRouterAdministrationClient(System.Uri endpoint, Azure.Communication.JobRouter.JobRouterClientOptions options) { } public JobRouterAdministrationClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Response CreateClassificationPolicy(Azure.Communication.JobRouter.CreateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -314,137 +233,136 @@ public JobRouterAdministrationClient(System.Uri endpoint, Azure.Core.TokenCreden public virtual System.Threading.Tasks.Task> CreateExceptionPolicyAsync(Azure.Communication.JobRouter.CreateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateQueue(Azure.Communication.JobRouter.CreateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateQueueAsync(Azure.Communication.JobRouter.CreateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteClassificationPolicy(string id, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteClassificationPolicyAsync(string id, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response DeleteDistributionPolicy(string id, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteDistributionPolicyAsync(string id, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response DeleteExceptionPolicy(string id, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteExceptionPolicyAsync(string id, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response DeleteQueue(string id, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteQueueAsync(string id, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteClassificationPolicy(string classificationPolicyId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteClassificationPolicyAsync(string classificationPolicyId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteDistributionPolicy(string distributionPolicyId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteDistributionPolicyAsync(string distributionPolicyId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteExceptionPolicy(string exceptionPolicyId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteExceptionPolicyAsync(string exceptionPolicyId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteQueue(string queueId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteQueueAsync(string queueId, Azure.RequestContext context = null) { throw null; } public virtual Azure.Pageable GetClassificationPolicies(int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetClassificationPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetClassificationPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetClassificationPoliciesAsync(int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetClassificationPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetClassificationPolicy(string id, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetClassificationPolicy(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetClassificationPolicyAsync(string id, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetClassificationPolicyAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetClassificationPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetClassificationPolicy(string classificationPolicyId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetClassificationPolicy(string classificationPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetClassificationPolicyAsync(string classificationPolicyId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetClassificationPolicyAsync(string classificationPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDistributionPolicies(int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetDistributionPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDistributionPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDistributionPoliciesAsync(int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetDistributionPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetDistributionPolicy(string id, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetDistributionPolicy(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetDistributionPolicyAsync(string id, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetDistributionPolicyAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDistributionPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDistributionPolicy(string distributionPolicyId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetDistributionPolicy(string distributionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetDistributionPolicyAsync(string distributionPolicyId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetDistributionPolicyAsync(string distributionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetExceptionPolicies(int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetExceptionPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetExceptionPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetExceptionPoliciesAsync(int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetExceptionPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetExceptionPolicy(string id, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetExceptionPolicy(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetExceptionPolicyAsync(string id, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetExceptionPolicyAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetQueue(string id, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetQueue(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetQueueAsync(string id, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetQueueAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExceptionPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetExceptionPolicy(string exceptionPolicyId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetExceptionPolicy(string exceptionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetExceptionPolicyAsync(string exceptionPolicyId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetExceptionPolicyAsync(string exceptionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetQueue(string queueId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetQueue(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetQueueAsync(string queueId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetQueueAsync(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetQueues(int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetQueues(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueues(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetQueuesAsync(int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetQueuesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateClassificationPolicy(Azure.Communication.JobRouter.UpdateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateClassificationPolicyAsync(Azure.Communication.JobRouter.UpdateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateDistributionPolicy(Azure.Communication.JobRouter.UpdateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateDistributionPolicyAsync(Azure.Communication.JobRouter.UpdateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateExceptionPolicy(Azure.Communication.JobRouter.UpdateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateExceptionPolicyAsync(Azure.Communication.JobRouter.UpdateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateQueue(Azure.Communication.JobRouter.UpdateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateQueueAsync(Azure.Communication.JobRouter.UpdateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueuesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateClassificationPolicy(Azure.Communication.JobRouter.ClassificationPolicy classificationPolicy, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateClassificationPolicy(string classificationPolicyId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateClassificationPolicyAsync(Azure.Communication.JobRouter.ClassificationPolicy classificationPolicy, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UpdateClassificationPolicyAsync(string classificationPolicyId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response UpdateDistributionPolicy(Azure.Communication.JobRouter.DistributionPolicy distributionPolicy, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateDistributionPolicy(string distributionPolicyId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateDistributionPolicyAsync(Azure.Communication.JobRouter.DistributionPolicy distributionPolicy, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UpdateDistributionPolicyAsync(string distributionPolicyId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response UpdateExceptionPolicy(Azure.Communication.JobRouter.ExceptionPolicy exceptionPolicy, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateExceptionPolicyAsync(Azure.Communication.JobRouter.ExceptionPolicy exceptionPolicy, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateQueue(Azure.Communication.JobRouter.RouterQueue queue, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateQueueAsync(Azure.Communication.JobRouter.RouterQueue queue, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UpdateQueueAsync(string queueId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } } public partial class JobRouterClient { protected JobRouterClient() { } public JobRouterClient(string connectionString) { } public JobRouterClient(string connectionString, Azure.Communication.JobRouter.JobRouterClientOptions options) { } - public JobRouterClient(System.Uri endpoint) { } public JobRouterClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } - public JobRouterClient(System.Uri endpoint, Azure.Communication.JobRouter.JobRouterClientOptions options) { } public JobRouterClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Response AcceptJobOffer(string workerId, string offerId, Azure.RequestContext context) { throw null; } public virtual Azure.Response AcceptJobOffer(string workerId, string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task AcceptJobOfferAsync(string workerId, string offerId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> AcceptJobOfferAsync(string workerId, string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CancelJob(Azure.Communication.JobRouter.CancelJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CancelJob(string id, Azure.Communication.JobRouter.CancelJobRequest cancelJobRequest = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CancelJob(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task CancelJobAsync(Azure.Communication.JobRouter.CancelJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CancelJobAsync(string id, Azure.Communication.JobRouter.CancelJobRequest cancelJobRequest = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CancelJobAsync(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CloseJob(Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CloseJob(string id, Azure.Communication.JobRouter.CloseJobRequest closeJobRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CloseJob(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task CloseJobAsync(Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CloseJobAsync(string id, Azure.Communication.JobRouter.CloseJobRequest closeJobRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CloseJobAsync(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CompleteJob(Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CompleteJob(string id, Azure.Communication.JobRouter.CompleteJobRequest completeJobRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CompleteJob(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task CompleteJobAsync(Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CompleteJobAsync(string id, Azure.Communication.JobRouter.CompleteJobRequest completeJobRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CompleteJobAsync(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response CancelJob(string jobId, Azure.Communication.JobRouter.CancelJobOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelJob(string jobId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task CancelJobAsync(string jobId, Azure.Communication.JobRouter.CancelJobOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response CloseJob(string jobId, Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CloseJob(string jobId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task CloseJobAsync(string jobId, Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CloseJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response CompleteJob(string jobId, Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CompleteJob(string jobId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task CompleteJobAsync(string jobId, Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CompleteJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CreateJob(Azure.Communication.JobRouter.CreateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateJobAsync(Azure.Communication.JobRouter.CreateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateJobWithClassificationPolicy(Azure.Communication.JobRouter.CreateJobWithClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateJobWithClassificationPolicyAsync(Azure.Communication.JobRouter.CreateJobWithClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateWorker(Azure.Communication.JobRouter.CreateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateWorkerAsync(Azure.Communication.JobRouter.CreateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeclineJobOffer(Azure.Communication.JobRouter.DeclineJobOfferOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeclineJobOffer(string workerId, string offerId, Azure.Communication.JobRouter.DeclineJobOfferRequest declineJobOfferRequest = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeclineJobOffer(string workerId, string offerId, Azure.Communication.JobRouter.DeclineJobOfferOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeclineJobOffer(string workerId, string offerId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeclineJobOfferAsync(Azure.Communication.JobRouter.DeclineJobOfferOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeclineJobOfferAsync(string workerId, string offerId, Azure.Communication.JobRouter.DeclineJobOfferRequest declineJobOfferRequest = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeclineJobOfferAsync(string workerId, string offerId, Azure.Communication.JobRouter.DeclineJobOfferOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeclineJobOfferAsync(string workerId, string offerId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response DeleteJob(string id, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteJobAsync(string id, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteJob(string jobId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteJobAsync(string jobId, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response DeleteWorker(string workerId, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteWorkerAsync(string workerId, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response GetJob(string id, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetJob(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetJobAsync(string id, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetJobAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetJobs(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterJobStatusSelector? status = default(Azure.Communication.JobRouter.RouterJobStatusSelector?), string queueId = null, string channelId = null, string classificationPolicyId = null, System.DateTimeOffset? scheduledBefore = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledAfter = default(System.DateTimeOffset?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetJob(string jobId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetJobAsync(string jobId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetJobs(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterJobStatusSelector? status = default(Azure.Communication.JobRouter.RouterJobStatusSelector?), string queueId = null, string channelId = null, string classificationPolicyId = null, System.DateTimeOffset? scheduledBefore = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledAfter = default(System.DateTimeOffset?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetJobs(int? maxpagesize, string status, string queueId, string channelId, string classificationPolicyId, System.DateTimeOffset? scheduledBefore, System.DateTimeOffset? scheduledAfter, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetJobsAsync(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterJobStatusSelector? status = default(Azure.Communication.JobRouter.RouterJobStatusSelector?), string queueId = null, string channelId = null, string classificationPolicyId = null, System.DateTimeOffset? scheduledBefore = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledAfter = default(System.DateTimeOffset?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetJobsAsync(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterJobStatusSelector? status = default(Azure.Communication.JobRouter.RouterJobStatusSelector?), string queueId = null, string channelId = null, string classificationPolicyId = null, System.DateTimeOffset? scheduledBefore = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledAfter = default(System.DateTimeOffset?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetJobsAsync(int? maxpagesize, string status, string queueId, string channelId, string classificationPolicyId, System.DateTimeOffset? scheduledBefore, System.DateTimeOffset? scheduledAfter, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetQueuePosition(string id, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetQueuePosition(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetQueuePositionAsync(string id, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetQueuePositionAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetQueueStatistics(string id, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetQueueStatistics(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task GetQueueStatisticsAsync(string id, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetQueueStatisticsAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetQueuePosition(string jobId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetQueuePosition(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetQueuePositionAsync(string jobId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetQueuePositionAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetQueueStatistics(string queueId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetQueueStatistics(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetQueueStatisticsAsync(string queueId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetQueueStatisticsAsync(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetWorker(string workerId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetWorker(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetWorkerAsync(string workerId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetWorkerAsync(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetWorkers(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterWorkerStateSelector? state = default(Azure.Communication.JobRouter.RouterWorkerStateSelector?), string channelId = null, string queueId = null, bool? hasCapacity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWorkers(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterWorkerStateSelector? state = default(Azure.Communication.JobRouter.RouterWorkerStateSelector?), string channelId = null, string queueId = null, bool? hasCapacity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetWorkers(int? maxpagesize, string state, string channelId, string queueId, bool? hasCapacity, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetWorkersAsync(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterWorkerStateSelector? state = default(Azure.Communication.JobRouter.RouterWorkerStateSelector?), string channelId = null, string queueId = null, bool? hasCapacity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWorkersAsync(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterWorkerStateSelector? state = default(Azure.Communication.JobRouter.RouterWorkerStateSelector?), string channelId = null, string queueId = null, bool? hasCapacity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetWorkersAsync(int? maxpagesize, string state, string channelId, string queueId, bool? hasCapacity, Azure.RequestContext context) { throw null; } public virtual Azure.Response ReclassifyJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ReclassifyJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UnassignJob(Azure.Communication.JobRouter.UnassignJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UnassignJob(string id, string assignmentId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> UnassignJobAsync(Azure.Communication.JobRouter.UnassignJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task UnassignJobAsync(string id, string assignmentId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response UpdateJob(Azure.Communication.JobRouter.UpdateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateJobAsync(Azure.Communication.JobRouter.UpdateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateWorker(Azure.Communication.JobRouter.UpdateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateWorkerAsync(Azure.Communication.JobRouter.UpdateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UnassignJob(string jobId, string assignmentId, Azure.Communication.JobRouter.UnassignJobOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UnassignJob(string jobId, string assignmentId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> UnassignJobAsync(string jobId, string assignmentId, Azure.Communication.JobRouter.UnassignJobOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UnassignJobAsync(string jobId, string assignmentId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response UpdateJob(Azure.Communication.JobRouter.RouterJob job, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateJob(string jobId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateJobAsync(Azure.Communication.JobRouter.RouterJob job, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UpdateJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response UpdateWorker(Azure.Communication.JobRouter.RouterWorker worker, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateWorker(string workerId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateWorkerAsync(Azure.Communication.JobRouter.RouterWorker worker, Azure.RequestConditions requestConditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UpdateWorkerAsync(string workerId, Azure.Core.RequestContent content, Azure.RequestConditions requestConditions = null, Azure.RequestContext context = null) { throw null; } } public partial class JobRouterClientOptions : Azure.Core.ClientOptions { @@ -454,6 +372,36 @@ public enum ServiceVersion V2023_11_01 = 1, } } + public static partial class JobRouterModelFactory + { + public static Azure.Communication.JobRouter.AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) { throw null; } + public static Azure.Communication.JobRouter.CancelExceptionAction CancelExceptionAction(string id = null, string note = null, string dispositionCode = null) { throw null; } + public static Azure.Communication.JobRouter.ConditionalQueueSelectorAttachment ConditionalQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition = null, System.Collections.Generic.IEnumerable queueSelectors = null) { throw null; } + public static Azure.Communication.JobRouter.ConditionalWorkerSelectorAttachment ConditionalWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition = null, System.Collections.Generic.IEnumerable workerSelectors = null) { throw null; } + public static Azure.Communication.JobRouter.ExceptionAction ExceptionAction(string id = null, string kind = null) { throw null; } + public static Azure.Communication.JobRouter.ExceptionRule ExceptionRule(string id = null, Azure.Communication.JobRouter.ExceptionTrigger trigger = null, System.Collections.Generic.IEnumerable actions = null) { throw null; } + public static Azure.Communication.JobRouter.ExpressionRouterRule ExpressionRouterRule(string language = null, string expression = null) { throw null; } + public static Azure.Communication.JobRouter.FunctionRouterRule FunctionRouterRule(System.Uri functionUri = null, Azure.Communication.JobRouter.FunctionRouterRuleCredential credential = null) { throw null; } + public static Azure.Communication.JobRouter.ManualReclassifyExceptionAction ManualReclassifyExceptionAction(string id = null, string queueId = null, int? priority = default(int?), System.Collections.Generic.IEnumerable workerSelectors = null) { throw null; } + public static Azure.Communication.JobRouter.PassThroughQueueSelectorAttachment PassThroughQueueSelectorAttachment(string key = null, Azure.Communication.JobRouter.LabelOperator labelOperator = default(Azure.Communication.JobRouter.LabelOperator)) { throw null; } + public static Azure.Communication.JobRouter.QueueLengthExceptionTrigger QueueLengthExceptionTrigger(int threshold = 0) { throw null; } + public static Azure.Communication.JobRouter.QueueWeightedAllocation QueueWeightedAllocation(double weight = 0, System.Collections.Generic.IEnumerable queueSelectors = null) { throw null; } + public static Azure.Communication.JobRouter.RouterChannel RouterChannel(string channelId = null, int capacityCostPerJob = 0, int? maxNumberOfJobs = default(int?)) { throw null; } + public static Azure.Communication.JobRouter.RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, System.DateTimeOffset assignedAt = default(System.DateTimeOffset), System.DateTimeOffset? completedAt = default(System.DateTimeOffset?), System.DateTimeOffset? closedAt = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Communication.JobRouter.RouterJobNote RouterJobNote(string message = null, System.DateTimeOffset? addedAt = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Communication.JobRouter.RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset? offeredAt = default(System.DateTimeOffset?), System.DateTimeOffset? expiresAt = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Communication.JobRouter.RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset assignedAt = default(System.DateTimeOffset)) { throw null; } + public static Azure.Communication.JobRouter.RuleEngineQueueSelectorAttachment RuleEngineQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule = null) { throw null; } + public static Azure.Communication.JobRouter.RuleEngineWorkerSelectorAttachment RuleEngineWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule = null) { throw null; } + public static Azure.Communication.JobRouter.ScheduleAndSuspendMode ScheduleAndSuspendMode(System.DateTimeOffset scheduleAt = default(System.DateTimeOffset)) { throw null; } + public static Azure.Communication.JobRouter.StaticQueueSelectorAttachment StaticQueueSelectorAttachment(Azure.Communication.JobRouter.RouterQueueSelector queueSelector = null) { throw null; } + public static Azure.Communication.JobRouter.StaticWorkerSelectorAttachment StaticWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterWorkerSelector workerSelector = null) { throw null; } + public static Azure.Communication.JobRouter.UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = 0) { throw null; } + public static Azure.Communication.JobRouter.WebhookRouterRule WebhookRouterRule(System.Uri authorizationServerUri = null, Azure.Communication.JobRouter.OAuth2WebhookClientCredential clientCredential = null, System.Uri webhookUri = null) { throw null; } + public static Azure.Communication.JobRouter.WeightedAllocationQueueSelectorAttachment WeightedAllocationQueueSelectorAttachment(System.Collections.Generic.IEnumerable allocations = null) { throw null; } + public static Azure.Communication.JobRouter.WeightedAllocationWorkerSelectorAttachment WeightedAllocationWorkerSelectorAttachment(System.Collections.Generic.IEnumerable allocations = null) { throw null; } + public static Azure.Communication.JobRouter.WorkerWeightedAllocation WorkerWeightedAllocation(double weight = 0, System.Collections.Generic.IEnumerable workerSelectors = null) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct LabelOperator : System.IEquatable { @@ -462,9 +410,9 @@ public enum ServiceVersion public LabelOperator(string value) { throw null; } public static Azure.Communication.JobRouter.LabelOperator Equal { get { throw null; } } public static Azure.Communication.JobRouter.LabelOperator GreaterThan { get { throw null; } } - public static Azure.Communication.JobRouter.LabelOperator GreaterThanEqual { get { throw null; } } + public static Azure.Communication.JobRouter.LabelOperator GreaterThanOrEqual { get { throw null; } } public static Azure.Communication.JobRouter.LabelOperator LessThan { get { throw null; } } - public static Azure.Communication.JobRouter.LabelOperator LessThanEqual { get { throw null; } } + public static Azure.Communication.JobRouter.LabelOperator LessThanOrEqual { get { throw null; } } public static Azure.Communication.JobRouter.LabelOperator NotEqual { get { throw null; } } public bool Equals(Azure.Communication.JobRouter.LabelOperator other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -476,25 +424,6 @@ public enum ServiceVersion public static bool operator !=(Azure.Communication.JobRouter.LabelOperator left, Azure.Communication.JobRouter.LabelOperator right) { throw null; } public override string ToString() { throw null; } } - public partial class LabelValue : System.IEquatable - { - public LabelValue(bool value) { } - public LabelValue(decimal value) { } - public LabelValue(double value) { } - public LabelValue(int value) { } - public LabelValue(long value) { } - public LabelValue(float value) { } - public LabelValue(string value) { } - public object Value { get { throw null; } } - public bool Equals(Azure.Communication.JobRouter.LabelValue 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.Communication.JobRouter.LabelValue left, Azure.Communication.JobRouter.LabelValue right) { throw null; } - public static bool operator !=(Azure.Communication.JobRouter.LabelValue left, Azure.Communication.JobRouter.LabelValue right) { throw null; } - public override string ToString() { throw null; } - } public partial class LongestIdleMode : Azure.Communication.JobRouter.DistributionMode { public LongestIdleMode() { } @@ -506,11 +435,9 @@ public ManualReclassifyExceptionAction() { } public string QueueId { get { throw null; } set { } } public System.Collections.Generic.IList WorkerSelectors { get { throw null; } } } - public partial class Oauth2ClientCredential + public partial class OAuth2WebhookClientCredential { - internal Oauth2ClientCredential() { } - public string ClientId { get { throw null; } } - public string ClientSecret { get { throw null; } } + public OAuth2WebhookClientCredential(string clientId, string clientSecret) { } } public partial class PassThroughQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { @@ -537,43 +464,52 @@ public QueueLengthExceptionTrigger(int threshold) { } public abstract partial class QueueSelectorAttachment { protected QueueSelectorAttachment() { } + public string Kind { get { throw null; } protected set { } } } public partial class QueueWeightedAllocation { - internal QueueWeightedAllocation() { } + public QueueWeightedAllocation(double weight, System.Collections.Generic.IEnumerable queueSelectors) { } public System.Collections.Generic.IReadOnlyList QueueSelectors { get { throw null; } } public double Weight { get { throw null; } } } public partial class ReclassifyExceptionAction : Azure.Communication.JobRouter.ExceptionAction { - public ReclassifyExceptionAction(string classificationPolicyId, System.Collections.Generic.IDictionary labelsToUpsert = null) { } - public string ClassificationPolicyId { get { throw null; } } - public System.Collections.Generic.IDictionary LabelsToUpsert { get { throw null; } set { } } + public ReclassifyExceptionAction() { } + public string ClassificationPolicyId { get { throw null; } set { } } + public System.Collections.Generic.IDictionary LabelsToUpsert { get { throw null; } } } public partial class RoundRobinMode : Azure.Communication.JobRouter.DistributionMode { public RoundRobinMode() { } } + public partial class RouterChannel + { + public RouterChannel(string channelId, int capacityCostPerJob) { } + public int CapacityCostPerJob { get { throw null; } } + public string ChannelId { get { throw null; } } + public int? MaxNumberOfJobs { get { throw null; } set { } } + } public partial class RouterJob { - internal RouterJob() { } + public RouterJob(string jobId) { } public System.Collections.Generic.IReadOnlyDictionary Assignments { get { throw null; } } public System.Collections.Generic.IReadOnlyList AttachedWorkerSelectors { get { throw null; } } - public string ChannelId { get { throw null; } } - public string ChannelReference { get { throw null; } } - public string ClassificationPolicyId { get { throw null; } } - public string DispositionCode { get { throw null; } } + public string ChannelId { get { throw null; } set { } } + public string ChannelReference { get { throw null; } set { } } + public string ClassificationPolicyId { get { throw null; } set { } } + public string DispositionCode { get { throw null; } set { } } public System.DateTimeOffset? EnqueuedAt { get { throw null; } } + public Azure.ETag ETag { get { throw null; } } public string Id { get { throw null; } } - public System.Collections.Generic.Dictionary Labels { get { throw null; } } - public Azure.Communication.JobRouter.JobMatchingMode MatchingMode { get { throw null; } } - public System.Collections.Generic.List Notes { get { throw null; } } - public int? Priority { get { throw null; } } - public string QueueId { get { throw null; } } - public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public Azure.Communication.JobRouter.JobMatchingMode MatchingMode { get { throw null; } set { } } + public System.Collections.Generic.IList Notes { get { throw null; } } + public int? Priority { get { throw null; } set { } } + public string QueueId { get { throw null; } set { } } + public System.Collections.Generic.IList RequestedWorkerSelectors { get { throw null; } } public System.DateTimeOffset? ScheduledAt { get { throw null; } } public Azure.Communication.JobRouter.RouterJobStatus? Status { get { throw null; } } - public System.Collections.Generic.Dictionary Tags { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } } public partial class RouterJobAssignment { @@ -584,17 +520,11 @@ internal RouterJobAssignment() { } public System.DateTimeOffset? CompletedAt { get { throw null; } } public string WorkerId { get { throw null; } } } - public partial class RouterJobItem - { - internal RouterJobItem() { } - public Azure.ETag ETag { get { throw null; } } - public Azure.Communication.JobRouter.RouterJob Job { get { throw null; } } - } public partial class RouterJobNote { - public RouterJobNote() { } + public RouterJobNote(string message) { } public System.DateTimeOffset? AddedAt { get { throw null; } set { } } - public string Message { get { throw null; } set { } } + public string Message { get { throw null; } } } public partial class RouterJobOffer { @@ -674,56 +604,68 @@ internal RouterJobPositionDetails() { } } public partial class RouterQueue { - internal RouterQueue() { } - public string DistributionPolicyId { get { throw null; } } - public string ExceptionPolicyId { get { throw null; } } - public string Id { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } - public string Name { get { throw null; } } - } - public partial class RouterQueueAssignment - { - public RouterQueueAssignment() { } - } - public partial class RouterQueueItem - { - internal RouterQueueItem() { } + public RouterQueue(string queueId) { } + public string DistributionPolicyId { get { throw null; } set { } } public Azure.ETag ETag { get { throw null; } } - public Azure.Communication.JobRouter.RouterQueue Queue { get { throw null; } } + public string ExceptionPolicyId { get { throw null; } set { } } + public string Id { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public string Name { get { throw null; } set { } } } public partial class RouterQueueSelector { - public RouterQueueSelector(string key, Azure.Communication.JobRouter.LabelOperator labelOperator, Azure.Communication.JobRouter.LabelValue value) { } + public RouterQueueSelector(string key, Azure.Communication.JobRouter.LabelOperator labelOperator, Azure.Communication.JobRouter.RouterValue value) { } public string Key { get { throw null; } } public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } } - public Azure.Communication.JobRouter.LabelValue Value { get { throw null; } } + public Azure.Communication.JobRouter.RouterValue Value { get { throw null; } } } public partial class RouterQueueStatistics { internal RouterQueueStatistics() { } - public System.Collections.Generic.IReadOnlyDictionary EstimatedWaitTimeMinutes { get { throw null; } } + public System.Collections.Generic.IDictionary EstimatedWaitTimes { get { throw null; } } public int Length { get { throw null; } } public double? LongestJobWaitTimeMinutes { get { throw null; } } public string QueueId { get { throw null; } } } public abstract partial class RouterRule { - internal RouterRule() { } + protected RouterRule() { } + public string Kind { get { throw null; } protected set { } } + } + public partial class RouterValue : System.IEquatable + { + public RouterValue(bool value) { } + public RouterValue(decimal value) { } + public RouterValue(double value) { } + public RouterValue(int value) { } + public RouterValue(long value) { } + public RouterValue(float value) { } + public RouterValue(string value) { } + public object Value { get { throw null; } } + public bool Equals(Azure.Communication.JobRouter.RouterValue 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.Communication.JobRouter.RouterValue left, Azure.Communication.JobRouter.RouterValue right) { throw null; } + public static bool operator !=(Azure.Communication.JobRouter.RouterValue left, Azure.Communication.JobRouter.RouterValue right) { throw null; } + public override string ToString() { throw null; } } public partial class RouterWorker { - internal RouterWorker() { } + public RouterWorker(string workerId) { } public System.Collections.Generic.IReadOnlyList AssignedJobs { get { throw null; } } - public bool? AvailableForOffers { get { throw null; } } - public System.Collections.Generic.IDictionary ChannelConfigurations { get { throw null; } } + public bool? AvailableForOffers { get { throw null; } set { } } + public int? Capacity { get { throw null; } set { } } + public System.Collections.Generic.IList Channels { get { throw null; } } + public Azure.ETag ETag { get { throw null; } } public string Id { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } public double? LoadRatio { get { throw null; } } public System.Collections.Generic.IReadOnlyList Offers { get { throw null; } } - public System.Collections.Generic.IDictionary QueueAssignments { get { throw null; } } + public System.Collections.Generic.IList Queues { get { throw null; } } public Azure.Communication.JobRouter.RouterWorkerState? State { get { throw null; } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - public int? TotalCapacity { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } } public partial class RouterWorkerAssignment { @@ -733,22 +675,16 @@ internal RouterWorkerAssignment() { } public int CapacityCost { get { throw null; } } public string JobId { get { throw null; } } } - public partial class RouterWorkerItem - { - internal RouterWorkerItem() { } - public Azure.ETag ETag { get { throw null; } } - public Azure.Communication.JobRouter.RouterWorker Worker { get { throw null; } } - } public partial class RouterWorkerSelector { - public RouterWorkerSelector(string key, Azure.Communication.JobRouter.LabelOperator labelOperator, Azure.Communication.JobRouter.LabelValue value) { } - public bool? Expedite { get { throw null; } } + public RouterWorkerSelector(string key, Azure.Communication.JobRouter.LabelOperator labelOperator, Azure.Communication.JobRouter.RouterValue value) { } + public bool? Expedite { get { throw null; } set { } } public System.TimeSpan? ExpiresAfter { get { throw null; } set { } } public System.DateTimeOffset? ExpiresAt { get { throw null; } set { } } public string Key { get { throw null; } } public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } } public Azure.Communication.JobRouter.RouterWorkerSelectorStatus? Status { get { throw null; } } - public Azure.Communication.JobRouter.LabelValue Value { get { throw null; } set { } } + public Azure.Communication.JobRouter.RouterValue Value { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct RouterWorkerSelectorStatus : System.IEquatable @@ -809,12 +745,12 @@ public RouterWorkerSelector(string key, Azure.Communication.JobRouter.LabelOpera } public partial class RuleEngineQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { - internal RuleEngineQueueSelectorAttachment() { } + public RuleEngineQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule) { } public Azure.Communication.JobRouter.RouterRule Rule { get { throw null; } } } public partial class RuleEngineWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - internal RuleEngineWorkerSelectorAttachment() { } + public RuleEngineWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule) { } public Azure.Communication.JobRouter.RouterRule Rule { get { throw null; } } } public partial class ScheduleAndSuspendMode : Azure.Communication.JobRouter.JobMatchingMode @@ -825,9 +761,9 @@ public ScheduleAndSuspendMode(System.DateTimeOffset scheduleAt) { } public partial class ScoringRuleOptions { internal ScoringRuleOptions() { } - public bool? AllowScoringBatchOfWorkers { get { throw null; } } - public int? BatchSize { get { throw null; } } - public bool? DescendingOrder { get { throw null; } } + public int? BatchSize { get { throw null; } set { } } + public bool? DescendingOrder { get { throw null; } set { } } + public bool? IsBatchScoringEnabled { get { throw null; } set { } } public System.Collections.Generic.IList ScoringParameters { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -850,17 +786,17 @@ internal ScoringRuleOptions() { } } public partial class StaticQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { - internal StaticQueueSelectorAttachment() { } + public StaticQueueSelectorAttachment(Azure.Communication.JobRouter.RouterQueueSelector queueSelector) { } public Azure.Communication.JobRouter.RouterQueueSelector QueueSelector { get { throw null; } } } public partial class StaticRouterRule : Azure.Communication.JobRouter.RouterRule { - public StaticRouterRule(Azure.Communication.JobRouter.LabelValue value) { } - public Azure.Communication.JobRouter.LabelValue Value { get { throw null; } set { } } + public StaticRouterRule(Azure.Communication.JobRouter.RouterValue value) { } + public Azure.Communication.JobRouter.RouterValue Value { get { throw null; } set { } } } public partial class StaticWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - internal StaticWorkerSelectorAttachment() { } + public StaticWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterWorkerSelector workerSelector) { } public Azure.Communication.JobRouter.RouterWorkerSelector WorkerSelector { get { throw null; } } } public partial class SuspendMode : Azure.Communication.JobRouter.JobMatchingMode @@ -869,9 +805,7 @@ public SuspendMode() { } } public partial class UnassignJobOptions { - public UnassignJobOptions(string jobId, string assignmentId) { } - public string AssignmentId { get { throw null; } } - public string JobId { get { throw null; } } + public UnassignJobOptions() { } public bool? SuspendMatching { get { throw null; } set { } } } public partial class UnassignJobResult @@ -880,73 +814,6 @@ internal UnassignJobResult() { } public string JobId { get { throw null; } } public int UnassignmentCount { get { throw null; } } } - public partial class UpdateClassificationPolicyOptions - { - public UpdateClassificationPolicyOptions(string classificationPolicyId) { } - public string ClassificationPolicyId { get { throw null; } } - public string FallbackQueueId { get { throw null; } set { } } - public string Name { get { throw null; } set { } } - public Azure.Communication.JobRouter.RouterRule PrioritizationRule { get { throw null; } set { } } - public System.Collections.Generic.List QueueSelectors { get { throw null; } } - public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - public System.Collections.Generic.List WorkerSelectors { get { throw null; } } - } - public partial class UpdateDistributionPolicyOptions - { - public UpdateDistributionPolicyOptions(string distributionPolicyId) { } - public string DistributionPolicyId { get { throw null; } } - public Azure.Communication.JobRouter.DistributionMode Mode { get { throw null; } set { } } - public string Name { get { throw null; } set { } } - public System.TimeSpan OfferExpiresAfter { get { throw null; } set { } } - public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - } - public partial class UpdateExceptionPolicyOptions - { - public UpdateExceptionPolicyOptions(string exceptionPolicyId) { } - public string ExceptionPolicyId { get { throw null; } } - public System.Collections.Generic.IDictionary ExceptionRules { get { throw null; } } - public string Name { get { throw null; } set { } } - public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - } - public partial class UpdateJobOptions - { - public UpdateJobOptions(string jobId) { } - public string? ChannelId { get { throw null; } set { } } - public string? ChannelReference { get { throw null; } set { } } - public string? ClassificationPolicyId { get { throw null; } set { } } - public string? DispositionCode { get { throw null; } set { } } - public string JobId { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } - public Azure.Communication.JobRouter.JobMatchingMode? MatchingMode { get { throw null; } set { } } - public System.Collections.Generic.List Notes { get { throw null; } } - public int? Priority { get { throw null; } set { } } - public string? QueueId { get { throw null; } set { } } - public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - } - public partial class UpdateQueueOptions - { - public UpdateQueueOptions(string queueId) { } - public string? DistributionPolicyId { get { throw null; } set { } } - public string? ExceptionPolicyId { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } - public string? Name { get { throw null; } set { } } - public string QueueId { get { throw null; } } - public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - } - public partial class UpdateWorkerOptions - { - public UpdateWorkerOptions(string workerId) { } - public bool? AvailableForOffers { get { throw null; } set { } } - public System.Collections.Generic.IDictionary ChannelConfigurations { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } - public System.Collections.Generic.IDictionary QueueAssignments { get { throw null; } } - public Azure.RequestConditions RequestConditions { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - public int? TotalCapacity { get { throw null; } set { } } - public string WorkerId { get { throw null; } } - } public partial class WaitTimeExceptionTrigger : Azure.Communication.JobRouter.ExceptionTrigger { public WaitTimeExceptionTrigger(System.TimeSpan threshold) { } @@ -954,39 +821,30 @@ public WaitTimeExceptionTrigger(System.TimeSpan threshold) { } } public partial class WebhookRouterRule : Azure.Communication.JobRouter.RouterRule { - public WebhookRouterRule(System.Uri authorizationServerUri, Azure.Communication.JobRouter.Oauth2ClientCredential clientCredential, System.Uri webhookUri) { } + public WebhookRouterRule(System.Uri authorizationServerUri, Azure.Communication.JobRouter.OAuth2WebhookClientCredential clientCredential, System.Uri webhookUri) { } public System.Uri AuthorizationServerUri { get { throw null; } } - public Azure.Communication.JobRouter.Oauth2ClientCredential ClientCredential { get { throw null; } } + public Azure.Communication.JobRouter.OAuth2WebhookClientCredential ClientCredential { get { throw null; } } public System.Uri WebhookUri { get { throw null; } } } public partial class WeightedAllocationQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { - internal WeightedAllocationQueueSelectorAttachment() { } + public WeightedAllocationQueueSelectorAttachment(System.Collections.Generic.IEnumerable allocations) { } public System.Collections.Generic.IReadOnlyList Allocations { get { throw null; } } } public partial class WeightedAllocationWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - internal WeightedAllocationWorkerSelectorAttachment() { } + public WeightedAllocationWorkerSelectorAttachment(System.Collections.Generic.IEnumerable allocations) { } public System.Collections.Generic.IReadOnlyList Allocations { get { throw null; } } } public abstract partial class WorkerSelectorAttachment { protected WorkerSelectorAttachment() { } + public string Kind { get { throw null; } protected set { } } } public partial class WorkerWeightedAllocation { - internal WorkerWeightedAllocation() { } + public WorkerWeightedAllocation(double weight, System.Collections.Generic.IEnumerable workerSelectors) { } public double Weight { get { throw null; } } public System.Collections.Generic.IReadOnlyList WorkerSelectors { get { throw null; } } } } -namespace Microsoft.Extensions.Azure -{ - public static partial class CommunicationJobRouterClientBuilderExtensions - { - public static Azure.Core.Extensions.IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddJobRouterClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddJobRouterClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/assets.json b/sdk/communication/Azure.Communication.JobRouter/assets.json index 70009be9e6bad..a7bf16a166d3d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/assets.json +++ b/sdk/communication/Azure.Communication.JobRouter/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/communication/Azure.Communication.JobRouter", - "Tag": "net/communication/Azure.Communication.JobRouter_33a06c6ea8" + "Tag": "net/communication/Azure.Communication.JobRouter_508531d087" } diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrud.md index c1d9ee8475cf9..356312006082a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrud.md @@ -24,32 +24,32 @@ Response classificationPolicy = routerAdministrationClient options: new CreateClassificationPolicyOptions(classificationPolicyId) { Name = "Sample classification policy", - PrioritizationRule = new StaticRouterRule(new LabelValue(10)), - QueueSelectors = + PrioritizationRule = new StaticRouterRule(new RouterValue(10)), + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new LabelValue("NA"))), + new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new RouterValue("NA"))), new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("Product", LabelOperator.Equal, new LabelValue("O365")), - new RouterQueueSelector("QGroup", LabelOperator.Equal, new LabelValue("NA_O365")) + new RouterQueueSelector("Product", LabelOperator.Equal, new RouterValue("O365")), + new RouterQueueSelector("QGroup", LabelOperator.Equal, new RouterValue("NA_O365")) }), }, - WorkerSelectors = + WorkerSelectorAttachments = { new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new LabelValue(true)), - new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(1)) + new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new RouterValue(true)), + new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(1)) }), new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.HighPriority = \"true\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(10)) + new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(10)) }) } }); @@ -71,7 +71,7 @@ Console.WriteLine($"Successfully fetched classification policy with id: {queried ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicy Response updatedClassificationPolicy = routerAdministrationClient.UpdateClassificationPolicy( - new UpdateClassificationPolicyOptions(classificationPolicyId) + new ClassificationPolicy(classificationPolicyId) { PrioritizationRule = new ExpressionRouterRule("If(job.HighPriority = \"true\", 50, 10)") }); @@ -84,12 +84,12 @@ Console.WriteLine($"Classification policy successfully update with new prioritiz ## List classification policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetClassificationPolicies -Pageable classificationPolicies = routerAdministrationClient.GetClassificationPolicies(); -foreach (Page asPage in classificationPolicies.AsPages(pageSizeHint: 10)) +Pageable classificationPolicies = routerAdministrationClient.GetClassificationPolicies(); +foreach (Page asPage in classificationPolicies.AsPages(pageSizeHint: 10)) { - foreach (ClassificationPolicyItem? policy in asPage.Values) + foreach (ClassificationPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing classification policy with id: {policy.ClassificationPolicy.Id}"); + Console.WriteLine($"Listing classification policy with id: {policy.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrudAsync.md index 145ddb5961493..6df0098bc2597 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrudAsync.md @@ -24,32 +24,32 @@ Response classificationPolicy = await routerAdministration options: new CreateClassificationPolicyOptions(classificationPolicyId) { Name = "Sample classification policy", - PrioritizationRule = new StaticRouterRule(new LabelValue(10)), - QueueSelectors = + PrioritizationRule = new StaticRouterRule(new RouterValue(10)), + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new LabelValue("NA"))), + new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new RouterValue("NA"))), new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("Product", LabelOperator.Equal, new LabelValue("O365")), - new RouterQueueSelector("QGroup", LabelOperator.Equal, new LabelValue("NA_O365")) + new RouterQueueSelector("Product", LabelOperator.Equal, new RouterValue("O365")), + new RouterQueueSelector("QGroup", LabelOperator.Equal, new RouterValue("NA_O365")) }), }, - WorkerSelectors = + WorkerSelectorAttachments = { new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new LabelValue(true)), - new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(1)) + new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new RouterValue(true)), + new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(1)) }), new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.HighPriority = \"true\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(10)) + new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(10)) }) } }); @@ -71,7 +71,7 @@ Console.WriteLine($"Successfully fetched classification policy with id: {queried ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicy_Async Response updatedClassificationPolicy = await routerAdministrationClient.UpdateClassificationPolicyAsync( - new UpdateClassificationPolicyOptions(classificationPolicyId) + new ClassificationPolicy(classificationPolicyId) { PrioritizationRule = new ExpressionRouterRule("If(job.HighPriority = \"true\", 50, 10)") }); @@ -85,12 +85,12 @@ Console.WriteLine($"Classification policy successfully update with new prioritiz ## List classification policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetClassificationPolicies_Async -AsyncPageable classificationPolicies = routerAdministrationClient.GetClassificationPoliciesAsync(); -await foreach (Page asPage in classificationPolicies.AsPages(pageSizeHint: 10)) +AsyncPageable classificationPolicies = routerAdministrationClient.GetClassificationPoliciesAsync(); +await foreach (Page asPage in classificationPolicies.AsPages(pageSizeHint: 10)) { - foreach (ClassificationPolicyItem? policy in asPage.Values) + foreach (ClassificationPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing classification policy with id: {policy.ClassificationPolicy.Id}"); + Console.WriteLine($"Listing classification policy with id: {policy.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrud.md index 36910e631521e..81f4f534d59fd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrud.md @@ -45,7 +45,7 @@ Console.WriteLine($"Successfully fetched distribution policy with id: {queriedDi ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicy Response updatedDistributionPolicy = routerAdministrationClient.UpdateDistributionPolicy( - new UpdateDistributionPolicyOptions(distributionPolicyId) + new DistributionPolicy(distributionPolicyId) { // you can update one or more properties of distribution policy Mode = new RoundRobinMode(), @@ -57,12 +57,12 @@ Console.WriteLine($"Distribution policy successfully update with new distributio ## List distribution policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetDistributionPolicies -Pageable distributionPolicies = routerAdministrationClient.GetDistributionPolicies(); -foreach (Page asPage in distributionPolicies.AsPages(pageSizeHint: 10)) +Pageable distributionPolicies = routerAdministrationClient.GetDistributionPolicies(); +foreach (Page asPage in distributionPolicies.AsPages(pageSizeHint: 10)) { - foreach (DistributionPolicyItem? policy in asPage.Values) + foreach (DistributionPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing distribution policy with id: {policy.DistributionPolicy.Id}"); + Console.WriteLine($"Listing distribution policy with id: {policy.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrudAsync.md index 8d63dc1b107a3..36b945facbd2e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrudAsync.md @@ -45,7 +45,7 @@ Console.WriteLine($"Successfully fetched distribution policy with id: {queriedDi ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicy_Async Response updatedDistributionPolicy = await routerAdministrationClient.UpdateDistributionPolicyAsync( - new UpdateDistributionPolicyOptions(distributionPolicyId) + new DistributionPolicy(distributionPolicyId) { // you can update one or more properties of distribution policy Mode = new RoundRobinMode(), @@ -57,12 +57,12 @@ Console.WriteLine($"Distribution policy successfully update with new distributio ## List distribution policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetDistributionPolicies_Async -AsyncPageable distributionPolicies = routerAdministrationClient.GetDistributionPoliciesAsync(); -await foreach (Page asPage in distributionPolicies.AsPages(pageSizeHint: 10)) +AsyncPageable distributionPolicies = routerAdministrationClient.GetDistributionPoliciesAsync(); +await foreach (Page asPage in distributionPolicies.AsPages(pageSizeHint: 10)) { - foreach (DistributionPolicyItem? policy in asPage.Values) + foreach (DistributionPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing distribution policy with id: {policy.DistributionPolicy.Id}"); + Console.WriteLine($"Listing distribution policy with id: {policy.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrud.md index f66d5afd430ae..942758ef89abd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrud.md @@ -27,45 +27,43 @@ string exceptionPolicyId = "my-exception-policy"; // then reclassifies job adding additional labels on the job // define exception trigger for queue over flow -QueueLengthExceptionTrigger queueLengthExceptionTrigger = new QueueLengthExceptionTrigger(10); +var queueLengthExceptionTrigger = new QueueLengthExceptionTrigger(10); // define exception actions that needs to be executed when trigger condition is satisfied -ReclassifyExceptionAction escalateJobOnQueueOverFlow = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-q-over-flow", - labelsToUpsert: new Dictionary() +var escalateJobOnQueueOverFlow = new ReclassifyExceptionAction +{ + ClassificationPolicyId = "escalation-on-q-over-flow", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("QueueOverFlow") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("QueueOverFlow") + } +}; // define second exception trigger for wait time WaitTimeExceptionTrigger waitTimeExceptionTrigger = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(10)); // define exception actions that needs to be executed when trigger condition is satisfied -ReclassifyExceptionAction escalateJobOnWaitTimeExceeded = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-wait-time-exceeded", - labelsToUpsert: new Dictionary() +ReclassifyExceptionAction escalateJobOnWaitTimeExceeded = new() +{ + ClassificationPolicyId = "escalation-on-wait-time-exceeded", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded") + } +}; // define exception rule -Dictionary exceptionRule = new Dictionary() +var exceptionRule = new List { - ["EscalateJobOnQueueOverFlowTrigger"] = new ExceptionRule( + new(id: "EscalateJobOnQueueOverFlowTrigger", trigger: queueLengthExceptionTrigger, - actions: new Dictionary() - { - ["EscalationJobActionOnQueueOverFlow"] = escalateJobOnQueueOverFlow - }), - ["EscalateJobOnWaitTimeExceededTrigger"] = new ExceptionRule( + actions: new List { escalateJobOnQueueOverFlow }), + new(id: "EscalateJobOnWaitTimeExceededTrigger", trigger: waitTimeExceptionTrigger, - actions: new Dictionary() - { - ["EscalationJobActionOnWaitTimeExceed"] = escalateJobOnWaitTimeExceeded - }) + actions: new List { escalateJobOnWaitTimeExceeded }) }; Response exceptionPolicy = routerClient.CreateExceptionPolicy( @@ -102,55 +100,49 @@ Console.WriteLine($"Successfully fetched exception policy with id: {queriedExcep WaitTimeExceptionTrigger escalateJobOnWaitTimeExceed2 = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(2)); // define exception action -ReclassifyExceptionAction escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-wait-time-exceeded", - labelsToUpsert: new Dictionary() +var escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction +{ + ClassificationPolicyId = "escalation-on-wait-time-exceeded", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded2Min") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded2Min") + } +}; Response updateExceptionPolicy = routerClient.UpdateExceptionPolicy( - new UpdateExceptionPolicyOptions(exceptionPolicyId) + new ExceptionPolicy(exceptionPolicyId) { // you can update one or more properties of exception policy - here we are adding one additional exception rule Name = "My updated exception policy", ExceptionRules = { // adding new rule - ["EscalateJobOnWaitTimeExceededTrigger2Min"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnWaitTimeExceededTrigger2Min", trigger: escalateJobOnWaitTimeExceed2, - actions: new Dictionary() - { - ["EscalationJobActionOnWaitTimeExceed"] = escalateJobOnWaitTimeExceeded2 - }), + actions: new List { escalateJobOnWaitTimeExceeded2 }), // modifying existing rule - ["EscalateJobOnQueueOverFlowTrigger"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnQueueOverFlowTrigger", trigger: new QueueLengthExceptionTrigger(100), - actions: new Dictionary() - { - ["EscalationJobActionOnQueueOverFlow"] = escalateJobOnQueueOverFlow - }), - // deleting existing rule - ["EscalateJobOnWaitTimeExceededTrigger"] = null + actions: new List { escalateJobOnQueueOverFlow }) } }); Console.WriteLine($"Exception policy successfully updated with id: {updateExceptionPolicy.Value.Id}"); Console.WriteLine($"Exception policy now has 2 exception rules: {updateExceptionPolicy.Value.ExceptionRules.Count}"); -Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been successfully deleted: {!updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger")}"); -Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger2Min")}"); +Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been successfully deleted: {updateExceptionPolicy.Value.ExceptionRules.All(r => r.Id != "EscalateJobOnWaitTimeExceededTrigger")}"); +Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.Any(r => r.Id == "EscalateJobOnWaitTimeExceededTrigger2Min")}"); ``` ## List exception policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetExceptionPolicies -Pageable exceptionPolicies = routerClient.GetExceptionPolicies(); -foreach (Page asPage in exceptionPolicies.AsPages(pageSizeHint: 10)) +Pageable exceptionPolicies = routerClient.GetExceptionPolicies(); +foreach (Page asPage in exceptionPolicies.AsPages(pageSizeHint: 10)) { - foreach (ExceptionPolicyItem? policy in asPage.Values) + foreach (ExceptionPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {policy.ExceptionPolicy.Id}"); + Console.WriteLine($"Listing exception policy with id: {policy.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrudAsync.md index f9c3efaab3e5f..b91a621065e42 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrudAsync.md @@ -27,45 +27,43 @@ string exceptionPolicyId = "my-exception-policy"; // then reclassifies job adding additional labels on the job // define exception trigger for queue over flow -QueueLengthExceptionTrigger queueLengthExceptionTrigger = new QueueLengthExceptionTrigger(10); +var queueLengthExceptionTrigger = new QueueLengthExceptionTrigger(10); // define exception actions that needs to be executed when trigger condition is satisfied -ReclassifyExceptionAction escalateJobOnQueueOverFlow = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-q-over-flow", - labelsToUpsert: new Dictionary() +ReclassifyExceptionAction escalateJobOnQueueOverFlow = new ReclassifyExceptionAction +{ + ClassificationPolicyId = "escalation-on-q-over-flow", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("QueueOverFlow") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("QueueOverFlow") + } +}; // define second exception trigger for wait time WaitTimeExceptionTrigger waitTimeExceptionTrigger = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(10)); // define exception actions that needs to be executed when trigger condition is satisfied -ReclassifyExceptionAction escalateJobOnWaitTimeExceeded = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-wait-time-exceeded", - labelsToUpsert: new Dictionary() +var escalateJobOnWaitTimeExceeded = new ReclassifyExceptionAction +{ + ClassificationPolicyId = "escalation-on-wait-time-exceeded", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded") + } +}; // define exception rule -Dictionary exceptionRule = new Dictionary() +List exceptionRule = new() { - ["EscalateJobOnQueueOverFlowTrigger"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnQueueOverFlowTrigger", trigger: queueLengthExceptionTrigger, - actions: new Dictionary() - { - ["EscalationJobActionOnQueueOverFlow"] = escalateJobOnQueueOverFlow - }), - ["EscalateJobOnWaitTimeExceededTrigger"] = new ExceptionRule( + actions: new List { escalateJobOnQueueOverFlow }), + new ExceptionRule(id: "EscalateJobOnWaitTimeExceededTrigger", trigger: waitTimeExceptionTrigger, - actions: new Dictionary() - { - ["EscalationJobActionOnWaitTimeExceed"] = escalateJobOnWaitTimeExceeded - }) + actions: new List { escalateJobOnWaitTimeExceeded }) }; Response exceptionPolicy = await routerClient.CreateExceptionPolicyAsync( @@ -99,58 +97,52 @@ Console.WriteLine($"Successfully fetched exception policy with id: {queriedExcep // let's define the new rule to be added // define exception trigger -WaitTimeExceptionTrigger escalateJobOnWaitTimeExceed2 = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(2)); +var escalateJobOnWaitTimeExceed2 = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(2)); // define exception action -ReclassifyExceptionAction escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-wait-time-exceeded", - labelsToUpsert: new Dictionary() +var escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction +{ + ClassificationPolicyId = "escalation-on-wait-time-exceeded", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded2Min") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded2Min") + } +}; Response updateExceptionPolicy = await routerClient.UpdateExceptionPolicyAsync( - new UpdateExceptionPolicyOptions(exceptionPolicyId) + new ExceptionPolicy(exceptionPolicyId) { // you can update one or more properties of exception policy - here we are adding one additional exception rule Name = "My updated exception policy", ExceptionRules = { // adding new rule - ["EscalateJobOnWaitTimeExceededTrigger2Min"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnWaitTimeExceededTrigger2Min", trigger: escalateJobOnWaitTimeExceed2, - actions: new Dictionary() - { - ["EscalationJobActionOnWaitTimeExceed"] = escalateJobOnWaitTimeExceeded2 - }), + actions: new List { escalateJobOnWaitTimeExceeded2 }), // modifying existing rule - ["EscalateJobOnQueueOverFlowTrigger"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnQueueOverFlowTrigger", trigger: new QueueLengthExceptionTrigger(100), - actions: new Dictionary() - { - ["EscalationJobActionOnQueueOverFlow"] = escalateJobOnQueueOverFlow - }), - // deleting existing rule - ["EscalateJobOnWaitTimeExceededTrigger"] = null + actions: new List { escalateJobOnQueueOverFlow }) } }); Console.WriteLine($"Exception policy successfully updated with id: {updateExceptionPolicy.Value.Id}"); Console.WriteLine($"Exception policy now has 2 exception rules: {updateExceptionPolicy.Value.ExceptionRules.Count}"); -Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been successfully deleted: {!updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger")}"); -Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger2Min")}"); +Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been successfully deleted: {updateExceptionPolicy.Value.ExceptionRules.All(r => r.Id == "EscalateJobOnWaitTimeExceededTrigger")}"); +Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.Any(r => r.Id == "EscalateJobOnWaitTimeExceededTrigger2Min")}"); ``` ## List exception policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetExceptionPolicies_Async -AsyncPageable exceptionPolicies = routerClient.GetExceptionPoliciesAsync(); -await foreach (Page asPage in exceptionPolicies.AsPages(pageSizeHint: 10)) +AsyncPageable exceptionPolicies = routerClient.GetExceptionPoliciesAsync(); +await foreach (Page asPage in exceptionPolicies.AsPages(pageSizeHint: 10)) { - foreach (ExceptionPolicyItem? policy in asPage.Values) + foreach (ExceptionPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {policy.ExceptionPolicy.Id}"); + Console.WriteLine($"Listing exception policy with id: {policy.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrud.md index f530cebe25c4b..f65b53060856f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrud.md @@ -49,22 +49,21 @@ Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSeri ## Update a job queue ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue -Response updatedJobQueue = routerAdministrationClient.UpdateQueue( - options: new UpdateQueueOptions(jobQueueId) - { - Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") } - }); +Response updatedJobQueue = routerAdministrationClient.UpdateQueue(new RouterQueue(jobQueueId) +{ + Labels = { ["Additional-Queue-Label"] = new RouterValue("ChatQueue") } +}); ``` ## List job queues ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueues -Pageable jobQueues = routerAdministrationClient.GetQueues(); -foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) +Pageable jobQueues = routerAdministrationClient.GetQueues(); +foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) { - foreach (RouterQueueItem? policy in asPage.Values) + foreach (RouterQueue? policy in asPage.Values) { - Console.WriteLine($"Listing job queue with id: {policy.Queue.Id}"); + Console.WriteLine($"Listing job queue with id: {policy.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrudAsync.md index d765bc0a2bfe8..6094a934cfc2b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrudAsync.md @@ -51,21 +51,21 @@ Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSeri ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue_Async Response updatedJobQueue = await routerAdministrationClient.UpdateQueueAsync( - options: new UpdateQueueOptions(jobQueueId) + new RouterQueue(jobQueueId) { - Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") } + Labels = { ["Additional-Queue-Label"] = new RouterValue("ChatQueue") } }); ``` ## List job queues ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueues_Async -AsyncPageable jobQueues = routerAdministrationClient.GetQueuesAsync(); -await foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) +AsyncPageable jobQueues = routerAdministrationClient.GetQueuesAsync(); +await foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) { - foreach (RouterQueueItem? policy in asPage.Values) + foreach (RouterQueue? policy in asPage.Values) { - Console.WriteLine($"Listing job queue with id: {policy.Queue.Id}"); + Console.WriteLine($"Listing job queue with id: {policy.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md index 3f5852ec0a692..69ff4ccec85b8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md @@ -44,12 +44,12 @@ Console.WriteLine($"Job has been successfully created with status: {job.Value.St Response classificationPolicy = routerAdministrationClient.CreateClassificationPolicy( new CreateClassificationPolicyOptions("classification-policy-id") { - QueueSelectors = + QueueSelectorAttachments = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, - new LabelValue(jobQueue.Value.Id))), + new RouterValue(jobQueue.Value.Id))), }, - PrioritizationRule = new StaticRouterRule(new LabelValue(10)) + PrioritizationRule = new StaticRouterRule(new RouterValue(10)) }); string jobWithCpId = "job-with-cp-id"; @@ -85,8 +85,7 @@ Console.WriteLine($"Job position for id `{jobPositionDetails.Value.JobId}` succe ## Update a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateRouterJob -Response updatedJob = routerClient.UpdateJob( - options: new UpdateJobOptions(jobId: jobId) +Response updatedJob = routerClient.UpdateJob(new RouterJob(jobId) { // one or more job properties can be updated ChannelReference = "45678", @@ -106,11 +105,11 @@ Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId, CancellationTok ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_AcceptJobOffer // in order for the jobs to be router to a worker, we would need to create a worker with the appropriate queue and channel association Response worker = routerClient.CreateWorker( - options: new CreateWorkerOptions(workerId: "router-worker-id", totalCapacity: 100) + options: new CreateWorkerOptions(workerId: "router-worker-id", capacity: 100) { AvailableForOffers = true, // if a worker is not registered, no offer will be issued - ChannelConfigurations = { ["general"] = new ChannelConfiguration(100), }, - QueueAssignments = { [jobQueue.Value.Id] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 100) }, + Queues = { jobQueue.Value.Id } }); // now that we have a registered worker, we can expect offer to be sent to the worker @@ -144,7 +143,7 @@ Console.WriteLine($"Job has been successfully assigned with a worker with assign ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeclineJobOffer // A worker can also choose to decline an offer -Response declineOffer = routerClient.DeclineJobOffer(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); +Response declineOffer = routerClient.DeclineJobOffer(worker.Value.Id, issuedOffer.OfferId); ``` ## Complete a job @@ -152,7 +151,7 @@ Response declineOffer = routerClient.DeclineJobOffer(new DeclineJobOfferOptions( ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CompleteRouterJob // Once a worker completes the job, it needs to mark the job as completed -Response completedJobResult = routerClient.CompleteJob(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); +Response completedJobResult = routerClient.CompleteJob(jobId, new CompleteJobOptions(acceptedJobOffer.Value.AssignmentId)); queriedJob = routerClient.GetJob(jobId); Console.WriteLine($"Job has been successfully completed. Current status: {queriedJob.Value.Status}"); // "Completed" @@ -161,7 +160,7 @@ Console.WriteLine($"Job has been successfully completed. Current status: {querie ## Close a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CloseRouterJob -Response closeJobResult = routerClient.CloseJob(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); +Response closeJobResult = routerClient.CloseJob(jobId, new CloseJobOptions(acceptedJobOffer.Value.AssignmentId)); queriedJob = routerClient.GetJob(jobId); Console.WriteLine($"Job has been successfully closed. Current status: {queriedJob.Value.Status}"); // "Closed" @@ -170,12 +169,12 @@ Console.WriteLine($"Job has been successfully closed. Current status: {queriedJo ## List jobs ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobs -Pageable routerJobs = routerClient.GetJobs(); -foreach (Page asPage in routerJobs.AsPages(pageSizeHint: 10)) +Pageable routerJobs = routerClient.GetJobs(); +foreach (Page asPage in routerJobs.AsPages(pageSizeHint: 10)) { - foreach (RouterJobItem? _job in asPage.Values) + foreach (RouterJob? _job in asPage.Values) { - Console.WriteLine($"Listing router job with id: {_job.Job.Id}"); + Console.WriteLine($"Listing router job with id: {_job.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md index f41b4a598778f..fd84d6fc62d6a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md @@ -45,12 +45,12 @@ Console.WriteLine($"Job has been successfully created with status: {job.Value.St Response classificationPolicy = await routerAdministrationClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions("classification-policy-id") { - QueueSelectors = + QueueSelectorAttachments = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, - new LabelValue(jobQueue.Value.Id))), + new RouterValue(jobQueue.Value.Id))), }, - PrioritizationRule = new StaticRouterRule(new LabelValue(10)) + PrioritizationRule = new StaticRouterRule(new RouterValue(10)) }); string jobWithCpId = "job-with-cp-id"; @@ -86,8 +86,7 @@ Console.WriteLine($"Job position for id `{jobPositionDetails.Value.JobId}` succe ## Update a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateRouterJob_Async -Response updatedJob = await routerClient.UpdateJobAsync( - options: new UpdateJobOptions(jobId: jobId) +Response updatedJob = await routerClient.UpdateJobAsync(new RouterJob(jobId) { // one or more job properties can be updated ChannelReference = "45678", @@ -107,11 +106,11 @@ Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId, Canc ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_AcceptJobOffer_Async // in order for the jobs to be router to a worker, we would need to create a worker with the appropriate queue and channel association Response worker = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: "router-worker-id", totalCapacity: 100) + options: new CreateWorkerOptions(workerId: "router-worker-id", capacity: 100) { AvailableForOffers = true, // if a worker is not registered, no offer will be issued - ChannelConfigurations = { ["general"] = new ChannelConfiguration(100), }, - QueueAssignments = { [jobQueue.Value.Id] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 100) }, + Queues = { jobQueue.Value.Id } }); // now that we have a registered worker, we can expect offer to be sent to the worker @@ -145,7 +144,7 @@ Console.WriteLine($"Job has been successfully assigned with a worker with assign ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeclineJobOffer_Async // A worker can also choose to decline an offer -Response declineOffer = await routerClient.DeclineJobOfferAsync(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); +Response declineOffer = await routerClient.DeclineJobOfferAsync(worker.Value.Id, issuedOffer.OfferId); ``` ## Complete a job @@ -153,7 +152,7 @@ Response declineOffer = await routerClient.DeclineJobOfferAsync(new DeclineJobOf ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CompleteRouterJob_Async // Once a worker completes the job, it needs to mark the job as completed -Response completedJobResult = await routerClient.CompleteJobAsync(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); +Response completedJobResult = await routerClient.CompleteJobAsync(jobId, new CompleteJobOptions(acceptedJobOffer.Value.AssignmentId)); queriedJob = await routerClient.GetJobAsync(jobId); Console.WriteLine($"Job has been successfully completed. Current status: {queriedJob.Value.Status}"); // "Completed" @@ -162,7 +161,7 @@ Console.WriteLine($"Job has been successfully completed. Current status: {querie ## Close a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CloseRouterJob_Async -Response closeJobResult = await routerClient.CloseJobAsync(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); +Response closeJobResult = await routerClient.CloseJobAsync(jobId, new CloseJobOptions(acceptedJobOffer.Value.AssignmentId)); queriedJob = await routerClient.GetJobAsync(jobId); Console.WriteLine($"Job has been successfully closed. Current status: {queriedJob.Value.Status}"); // "Closed" @@ -171,12 +170,12 @@ Console.WriteLine($"Job has been successfully closed. Current status: {queriedJo ## List jobs ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobs_Async -AsyncPageable routerJobs = routerClient.GetJobsAsync(); -await foreach (Page asPage in routerJobs.AsPages(pageSizeHint: 10)) +AsyncPageable routerJobs = routerClient.GetJobsAsync(); +await foreach (Page asPage in routerJobs.AsPages(pageSizeHint: 10)) { - foreach (RouterJobItem? _job in asPage.Values) + foreach (RouterJob? _job in asPage.Values) { - Console.WriteLine($"Listing router job with id: {_job.Job.Id}"); + Console.WriteLine($"Listing router job with id: {_job.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrud.md index 1f5dd8fa7deeb..e98e6cdd45b26 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrud.md @@ -21,30 +21,26 @@ JobRouterAdministrationClient routerAdministrationClient = new JobRouterAdminist string routerWorkerId = "my-router-worker"; Response worker = routerClient.CreateWorker( - new CreateWorkerOptions(workerId: routerWorkerId, totalCapacity: 100) + new CreateWorkerOptions(workerId: routerWorkerId, capacity: 100) { - QueueAssignments = + Queues = { "worker-q-1", "worker-q-2" }, + Channels = { - ["worker-q-1"] = new RouterQueueAssignment(), - ["worker-q-2"] = new RouterQueueAssignment() - }, - ChannelConfigurations = - { - ["WebChat"] = new ChannelConfiguration(1), - ["WebChatEscalated"] = new ChannelConfiguration(20), - ["Voip"] = new ChannelConfiguration(100) + new RouterChannel("WebChat", 1), + new RouterChannel("WebChatEscalated", 20), + new RouterChannel("Voip", 100) }, Labels = { - ["Location"] = new LabelValue("NA"), - ["English"] = new LabelValue(7), - ["O365"] = new LabelValue(true), - ["Xbox_Support"] = new LabelValue(false) + ["Location"] = new RouterValue("NA"), + ["English"] = new RouterValue(7), + ["O365"] = new RouterValue(true), + ["Xbox_Support"] = new RouterValue(false) }, Tags = { - ["Name"] = new LabelValue("John Doe"), - ["Department"] = new LabelValue("IT_HelpDesk") + ["Name"] = new RouterValue("John Doe"), + ["Department"] = new RouterValue("IT_HelpDesk") } } ); @@ -58,7 +54,7 @@ Console.WriteLine($"Router worker successfully created with id: {worker.Value.Id Response queriedWorker = routerClient.GetWorker(routerWorkerId); Console.WriteLine($"Successfully fetched worker with id: {queriedWorker.Value.Id}"); -Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.QueueAssignments.Values.ToList()}"); +Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.Queues}"); ``` ## Update a worker @@ -72,27 +68,26 @@ Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.QueueAss // 5. Increase capacityCostPerJob for channel `WebChatEscalated` to 50 Response updateWorker = routerClient.UpdateWorker( - new UpdateWorkerOptions(routerWorkerId) + new RouterWorker(routerWorkerId) { - QueueAssignments = { ["worker-q-3"] = new RouterQueueAssignment() }, - ChannelConfigurations = { ["WebChatEscalated"] = new ChannelConfiguration(50), }, + Queues = { "worker-q-3", }, + Channels = { new RouterChannel("WebChatEscalated", 50), }, Labels = { - ["O365"] = new LabelValue("Supported"), - ["Xbox_Support"] = new LabelValue(null), - ["Xbox_Support_EN"] = new LabelValue(true), + ["O365"] = new RouterValue("Supported"), + ["Xbox_Support"] = new RouterValue(null), + ["Xbox_Support_EN"] = new RouterValue(true), } }); Console.WriteLine($"Worker successfully updated with id: {updateWorker.Value.Id}"); -Console.Write($"Worker now associated with {updateWorker.Value.QueueAssignments.Count} queues"); // 3 queues +Console.Write($"Worker now associated with {updateWorker.Value.Queues.Count} queues"); // 3 queues ``` ## Register a worker ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_RegisterRouterWorker -updateWorker = routerClient.UpdateWorker( - options: new UpdateWorkerOptions(workerId: routerWorkerId) { AvailableForOffers = true, }); +updateWorker = routerClient.UpdateWorker(new RouterWorker(routerWorkerId) { AvailableForOffers = true, }); Console.WriteLine($"Worker successfully registered with status set to: {updateWorker.Value.State}"); ``` @@ -100,8 +95,7 @@ Console.WriteLine($"Worker successfully registered with status set to: {updateWo ## Deregister a worker ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeregisterRouterWorker -updateWorker = routerClient.UpdateWorker( - options: new UpdateWorkerOptions(workerId: routerWorkerId) { AvailableForOffers = false, }); +updateWorker = routerClient.UpdateWorker(new RouterWorker(routerWorkerId) { AvailableForOffers = false, }); Console.WriteLine($"Worker successfully de-registered with status set to: {updateWorker.Value.State}"); ``` @@ -109,23 +103,23 @@ Console.WriteLine($"Worker successfully de-registered with status set to: {updat ## List workers ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterWorkers -Pageable workers = routerClient.GetWorkers(); -foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) +Pageable workers = routerClient.GetWorkers(); +foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { - foreach (RouterWorkerItem? workerPaged in asPage.Values) + foreach (RouterWorker? workerPaged in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {workerPaged.Worker.Id}"); + Console.WriteLine($"Listing exception policy with id: {workerPaged.Id}"); } } // Additionally workers can be queried with several filters like queueId, capacity, state etc. workers = routerClient.GetWorkers(channelId: "Voip", state: RouterWorkerStateSelector.All); -foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) +foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { - foreach (RouterWorkerItem? workerPaged in asPage.Values) + foreach (RouterWorker? workerPaged in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {workerPaged.Worker.Id}"); + Console.WriteLine($"Listing exception policy with id: {workerPaged.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrudAsync.md index e5701c4e5882d..9df09b951ae20 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrudAsync.md @@ -23,30 +23,26 @@ string routerWorkerId = "my-router-worker"; Response worker = await routerClient.CreateWorkerAsync( new CreateWorkerOptions( workerId: routerWorkerId, - totalCapacity: 100) + capacity: 100) { - QueueAssignments = + Queues = { "worker-q-1", "worker-q-2" }, + Channels = { - ["worker-q-1"] = new RouterQueueAssignment(), - ["worker-q-2"] = new RouterQueueAssignment() - }, - ChannelConfigurations = - { - ["WebChat"] = new ChannelConfiguration(1), - ["WebChatEscalated"] = new ChannelConfiguration(20), - ["Voip"] = new ChannelConfiguration(100) + new RouterChannel("WebChat", 1), + new RouterChannel("WebChatEscalated", 20), + new RouterChannel("Voip",100) }, Labels = { - ["Location"] = new LabelValue("NA"), - ["English"] = new LabelValue(7), - ["O365"] = new LabelValue(true), - ["Xbox_Support"] = new LabelValue(false) + ["Location"] = new RouterValue("NA"), + ["English"] = new RouterValue(7), + ["O365"] = new RouterValue(true), + ["Xbox_Support"] = new RouterValue(false) }, Tags = { - ["Name"] = new LabelValue("John Doe"), - ["Department"] = new LabelValue("IT_HelpDesk") + ["Name"] = new RouterValue("John Doe"), + ["Department"] = new RouterValue("IT_HelpDesk") } } ); @@ -60,7 +56,7 @@ Console.WriteLine($"Router worker successfully created with id: {worker.Value.Id Response queriedWorker = await routerClient.GetWorkerAsync(routerWorkerId); Console.WriteLine($"Successfully fetched worker with id: {queriedWorker.Value.Id}"); -Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.QueueAssignments.Values.ToList()}"); +Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.Queues}"); ``` ## Update a worker @@ -74,27 +70,26 @@ Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.QueueAss // 5. Increase capacityCostPerJob for channel `WebChatEscalated` to 50 Response updateWorker = await routerClient.UpdateWorkerAsync( - new UpdateWorkerOptions(routerWorkerId) + new RouterWorker(routerWorkerId) { - QueueAssignments = { ["worker-q-3"] = new RouterQueueAssignment() }, - ChannelConfigurations = { ["WebChatEscalated"] = new ChannelConfiguration(50), }, + Queues = { "worker-q-3", }, + Channels = { new RouterChannel("WebChatEscalated", 50), }, Labels = { - ["O365"] = new LabelValue("Supported"), - ["Xbox_Support"] = new LabelValue(null), - ["Xbox_Support_EN"] = new LabelValue(true), + ["O365"] = new RouterValue("Supported"), + ["Xbox_Support"] = new RouterValue(null), + ["Xbox_Support_EN"] = new RouterValue(true), } }); Console.WriteLine($"Worker successfully updated with id: {updateWorker.Value.Id}"); -Console.Write($"Worker now associated with {updateWorker.Value.QueueAssignments.Count} queues"); // 3 queues +Console.Write($"Worker now associated with {updateWorker.Value.Queues.Count} queues"); // 3 queues ``` ## Register a worker ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_RegisterRouterWorker_Async -updateWorker = await routerClient.UpdateWorkerAsync( - options: new UpdateWorkerOptions(workerId: routerWorkerId) { AvailableForOffers = true, }); +updateWorker = await routerClient.UpdateWorkerAsync(new RouterWorker(routerWorkerId) { AvailableForOffers = true, }); Console.WriteLine($"Worker successfully registered with status set to: {updateWorker.Value.State}"); ``` @@ -102,8 +97,7 @@ Console.WriteLine($"Worker successfully registered with status set to: {updateWo ## Deregister a worker ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeregisterRouterWorker_Async -updateWorker = await routerClient.UpdateWorkerAsync( - options: new UpdateWorkerOptions(workerId: routerWorkerId) { AvailableForOffers = false, }); +updateWorker = await routerClient.UpdateWorkerAsync(new RouterWorker(routerWorkerId) { AvailableForOffers = false, }); Console.WriteLine($"Worker successfully de-registered with status set to: {updateWorker.Value.State}"); ``` @@ -111,23 +105,23 @@ Console.WriteLine($"Worker successfully de-registered with status set to: {updat ## List workers ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterWorkers_Async -AsyncPageable workers = routerClient.GetWorkersAsync(); -await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) +AsyncPageable workers = routerClient.GetWorkersAsync(); +await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { - foreach (RouterWorkerItem? workerPaged in asPage.Values) + foreach (RouterWorker? workerPaged in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {workerPaged.Worker.Id}"); + Console.WriteLine($"Listing exception policy with id: {workerPaged.Id}"); } } // Additionally workers can be queried with several filters like queueId, capacity, state etc. workers = routerClient.GetWorkersAsync(channelId: "Voip", state: RouterWorkerStateSelector.All); -await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) +await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { - foreach (RouterWorkerItem? workerPaged in asPage.Values) + foreach (RouterWorker? workerPaged in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {workerPaged.Worker.Id}"); + Console.WriteLine($"Listing exception policy with id: {workerPaged.Id}"); } } ``` diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md index a3ed6c6db1b9a..abed9f5ad7152 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md @@ -57,7 +57,7 @@ Response job = routerClient.CreateJob( Priority = 1, RequestedWorkerSelectors = { - new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new LabelValue(10)) + new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new RouterValue(10)) }, }); ``` @@ -68,11 +68,11 @@ Register a worker associated with the queue that was just created. We will assig ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_RegisterWorker Response worker = routerClient.CreateWorker( - new CreateWorkerOptions(workerId: "worker-1", totalCapacity: 1) + new CreateWorkerOptions(workerId: "worker-1", capacity: 1) { - QueueAssignments = { [queue.Value.Id] = new RouterQueueAssignment() }, - Labels = { ["Some-Skill"] = new LabelValue(11) }, - ChannelConfigurations = { ["my-channel"] = new ChannelConfiguration(1) }, + Queues = { queue.Value.Id }, + Labels = { ["Some-Skill"] = new RouterValue(11) }, + Channels = { new RouterChannel("my-channel", 1) }, AvailableForOffers = true, } ); @@ -153,9 +153,7 @@ Once the worker is done with the job, the worker has to mark the job as `complet ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob Response completeJob = routerClient.CompleteJob( - options: new CompleteJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CompleteJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -169,9 +167,7 @@ After a job has been completed, the worker can perform wrap up actions to the jo ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob Response closeJob = routerClient.CloseJob( - options: new CloseJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -184,7 +180,7 @@ Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobSta ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJobInFuture // Optionally, a job can also be set up to be marked as closed in the future. var closeJobInFuture = routerClient.CloseJob( - options: new CloseJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md index bcbecd6c97ad1..e6bb3632f1408 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md @@ -57,7 +57,7 @@ Response job = await routerClient.CreateJobAsync( Priority = 1, RequestedWorkerSelectors = { - new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new LabelValue(10)) + new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new RouterValue(10)) } }); ``` @@ -68,11 +68,11 @@ Register a worker associated with the queue that was just created. We will assig ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_RegisterWorker_Async Response worker = await routerClient.CreateWorkerAsync( - new CreateWorkerOptions(workerId: "worker-1", totalCapacity: 1) + new CreateWorkerOptions(workerId: "worker-1", capacity: 1) { - QueueAssignments = { [queue.Value.Id] = new RouterQueueAssignment() }, - Labels = { ["Some-Skill"] = new LabelValue(11) }, - ChannelConfigurations = { ["my-channel"] = new ChannelConfiguration(1) }, + Queues = { queue.Value.Id }, + Labels = { ["Some-Skill"] = new RouterValue(11) }, + Channels = { new RouterChannel("my-channel", 1) }, AvailableForOffers = true, } ); @@ -153,9 +153,7 @@ Once the worker is done with the job, the worker has to mark the job as `complet ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob_Async Response completeJob = await routerClient.CompleteJobAsync( - options: new CompleteJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CompleteJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -169,9 +167,7 @@ After a job has been completed, the worker can perform wrap up actions to the jo ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob_Async Response closeJob = await routerClient.CloseJobAsync( - options: new CloseJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -184,7 +180,7 @@ Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobSta ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJobInFuture_Async // Optionally, a job can also be set up to be marked as closed in the future. var closeJobInFuture = await routerClient.CloseJobAsync( - options: new CloseJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithPriorityRuleAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithPriorityRuleAsync.md index 7575b8136295d..b200deb15bcca 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithPriorityRuleAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithPriorityRuleAsync.md @@ -27,7 +27,7 @@ string classificationPolicyId = "static-priority"; Response classificationPolicy = await routerAdministration.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(classificationPolicyId: classificationPolicyId) { - PrioritizationRule = new StaticRouterRule(new LabelValue(10)) + PrioritizationRule = new StaticRouterRule(new RouterValue(10)) }); Console.WriteLine($"Classification policy successfully created with id: {classificationPolicy.Value.Id} and priority rule of type: {classificationPolicy.Value.PrioritizationRule.Kind}"); @@ -121,7 +121,7 @@ Response job1 = await routerClient.CreateJobWithClassificationPolicyA QueueId = jobQueueId, Labels = { - ["Escalated"] = new LabelValue(false) + ["Escalated"] = new RouterValue(false) } }); @@ -136,7 +136,7 @@ Response job2 = await routerClient.CreateJobWithClassificationPolicyA QueueId = jobQueueId, Labels = { - ["Escalated"] = new LabelValue(true) + ["Escalated"] = new RouterValue(true) } }); @@ -233,7 +233,7 @@ Response job1 = await routerClient.CreateJobWithClassificationPolicyA QueueId = jobQueueId, Labels = { - ["Escalated"] = new LabelValue(false) + ["Escalated"] = new RouterValue(false) } }); @@ -248,7 +248,7 @@ Response job2 = await routerClient.CreateJobWithClassificationPolicyA QueueId = jobQueueId, Labels = { - ["Escalated"] = new LabelValue(true) + ["Escalated"] = new RouterValue(true) } }); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithQueueSelectorAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithQueueSelectorAsync.md index 609df62b0c977..49c01e500a36b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithQueueSelectorAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithQueueSelectorAsync.md @@ -19,7 +19,7 @@ JobRouterAdministrationClient routerAdministrationClient = new JobRouterAdminist ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_QueueSelectionById // In this scenario we are going to use a classification policy while submitting a job. -// We are going to utilize the 'QueueSelectors' attribute on the classification policy to determine +// We are going to utilize the 'QueueSelectorAttachments' attribute on the classification policy to determine // which queue a job should be enqueued in. For this scenario, we are going to demonstrate // StaticLabelSelector to select a queue directly by its unique ID through the classification policy // Steps @@ -54,9 +54,9 @@ Response cp1 = await routerAdministrationClient.CreateClas new CreateClassificationPolicyOptions(classificationPolicyId: "classification-policy-o365") { Name = "Classification_Policy_O365", - QueueSelectors = + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(queue1.Value.Id))) + new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(queue1.Value.Id))) }, }); @@ -64,9 +64,9 @@ Response cp2 = await routerAdministrationClient.CreateClas new CreateClassificationPolicyOptions(classificationPolicyId: "classification-policy-xbox") { Name = "Classification_Policy_XBox", - QueueSelectors = + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(queue2.Value.Id))) + new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(queue2.Value.Id))) } }); @@ -100,7 +100,7 @@ Console.WriteLine($"XBox job has been enqueued in queue: {queue2.Value.Id}. Stat ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_QueueSelectionByConditionalLabelAttachments // In this scenario we are going to use a classification policy while submitting a job. -// We are going to utilize the 'QueueSelectors' attribute on the classification policy to determine +// We are going to utilize the 'QueueSelectorAttachments' attribute on the classification policy to determine // which queue a job should be enqueued in. For this scenario, we are going to demonstrate // ConditionalLabelSelector to select a queue based on labels associated with a queue // Steps @@ -136,7 +136,7 @@ Response queue1 = await routerAdministrationClient.CreateQueueAsync Name = "Queue_365", Labels = { - ["ProductDetail"] = new LabelValue("Office_Support") + ["ProductDetail"] = new RouterValue("Office_Support") } }); @@ -148,7 +148,7 @@ Response queue2 = await routerAdministrationClient.CreateQueueAsync Name = "Queue_XBox", Labels = { - ["ProductDetail"] = new LabelValue("XBox_Support") + ["ProductDetail"] = new RouterValue("XBox_Support") } }); @@ -156,18 +156,18 @@ Response classificationPolicy = await routerAdministration new CreateClassificationPolicyOptions(classificationPolicyId: "classification-policy") { Name = "Classification_Policy_O365_And_XBox", - QueueSelectors = { + QueueSelectorAttachments = { new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("ProductDetail", LabelOperator.Equal, new LabelValue("Office_Support")) + new RouterQueueSelector("ProductDetail", LabelOperator.Equal, new RouterValue("Office_Support")) }), new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"XBx\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("ProductDetail", LabelOperator.Equal, new LabelValue("XBox_Support")) + new RouterQueueSelector("ProductDetail", LabelOperator.Equal, new RouterValue("XBox_Support")) }) } }); @@ -181,9 +181,9 @@ Response jobO365 = await routerClient.CreateJobWithClassificationPoli ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("en"), - ["Product"] = new LabelValue("O365"), - ["Geo"] = new LabelValue("North America"), + ["Language"] = new RouterValue("en"), + ["Product"] = new RouterValue("O365"), + ["Geo"] = new RouterValue("North America"), }, }); @@ -196,9 +196,9 @@ Response jobXbox = await routerClient.CreateJobWithClassificationPoli ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("en"), - ["Product"] = new LabelValue("XBx"), - ["Geo"] = new LabelValue("North America"), + ["Language"] = new RouterValue("en"), + ["Product"] = new RouterValue("XBx"), + ["Geo"] = new RouterValue("North America"), }, }); @@ -215,7 +215,7 @@ Console.WriteLine($"XBox job has been enqueued in queue: {queue2.Value.Id}. Stat ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_QueueSelectionByPassThroughLabelAttachments // cSpell:ignore EMEA, Emea // In this scenario we are going to use a classification policy while submitting a job. -// We are going to utilize the 'QueueSelectors' attribute on the classification policy to determine +// We are going to utilize the 'QueueSelectorAttachments' attribute on the classification policy to determine // which queue a job should be enqueued in. For this scenario, we are going to demonstrate // PassThroughLabelSelector to select a queue based on labels associated with a queue and the incoming job // Steps @@ -253,9 +253,9 @@ Response queue1 = await routerAdministrationClient.CreateQueueAsync Name = "Queue_365_EN_EMEA", Labels = { - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Language"] = new LabelValue("en"), - ["Region"] = new LabelValue("EMEA"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Language"] = new RouterValue("en"), + ["Region"] = new RouterValue("EMEA"), }, }); @@ -267,9 +267,9 @@ Response queue2 = await routerAdministrationClient.CreateQueueAsync Name = "Queue_365_FR_EMEA", Labels = { - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Language"] = new LabelValue("fr"), - ["Region"] = new LabelValue("EMEA"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Language"] = new RouterValue("fr"), + ["Region"] = new RouterValue("EMEA"), }, }); @@ -281,9 +281,9 @@ Response queue3 = await routerAdministrationClient.CreateQueueAsync Name = "Queue_365_EN_NA", Labels = { - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Language"] = new LabelValue("en"), - ["Region"] = new LabelValue("NA"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Language"] = new RouterValue("en"), + ["Region"] = new RouterValue("NA"), }, }); @@ -291,7 +291,7 @@ Response classificationPolicy = await routerAdministration new CreateClassificationPolicyOptions(classificationPolicyId: "classification-policy") { Name = "Classification_Policy_O365_EMEA_NA", - QueueSelectors = { + QueueSelectorAttachments = { new PassThroughQueueSelectorAttachment("ProductDetail", LabelOperator.Equal), new PassThroughQueueSelectorAttachment("Language", LabelOperator.Equal), new PassThroughQueueSelectorAttachment("Region", LabelOperator.Equal), @@ -307,11 +307,11 @@ Response jobENEmea = await routerClient.CreateJobWithClassificationPo ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("en"), - ["Product"] = new LabelValue("O365"), - ["Geo"] = new LabelValue("Europe, Middle East, Africa"), - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Region"] = new LabelValue("EMEA"), + ["Language"] = new RouterValue("en"), + ["Product"] = new RouterValue("O365"), + ["Geo"] = new RouterValue("Europe, Middle East, Africa"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Region"] = new RouterValue("EMEA"), }, }); @@ -324,11 +324,11 @@ Response jobFREmea = await routerClient.CreateJobWithClassificationPo ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("fr"), - ["Product"] = new LabelValue("O365"), - ["Geo"] = new LabelValue("Europe, Middle East, Africa"), - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Region"] = new LabelValue("EMEA"), + ["Language"] = new RouterValue("fr"), + ["Product"] = new RouterValue("O365"), + ["Geo"] = new RouterValue("Europe, Middle East, Africa"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Region"] = new RouterValue("EMEA"), }, }); @@ -341,11 +341,11 @@ Response jobENNa = await routerClient.CreateJobWithClassificationPoli ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("en"), - ["Product"] = new LabelValue("O365"), - ["Geo"] = new LabelValue("North America"), - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Region"] = new LabelValue("NA"), + ["Language"] = new RouterValue("en"), + ["Product"] = new RouterValue("O365"), + ["Geo"] = new RouterValue("North America"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Region"] = new RouterValue("NA"), }, }); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithWorkerSelectorAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithWorkerSelectorAsync.md index ac5056d74c4f6..5a43be2e4145b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithWorkerSelectorAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithWorkerSelectorAsync.md @@ -19,7 +19,7 @@ JobRouterAdministrationClient routerAdministrationClient = new JobRouterAdminist ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_StaticWorkerSelectors // In this scenario we are going to use a classification policy while submitting a job. -// We are going to utilize the 'WorkerSelectors' attribute on the classification policy to attach +// We are going to utilize the 'WorkerSelectorAttachments' attribute on the classification policy to attach // custom worker selectors to the job. For this scenario, we are going to demonstrate // StaticWorkerSelector to filter workers on static values. // We would like to filter workers on the following criteria:- @@ -35,7 +35,7 @@ JobRouterAdministrationClient routerAdministrationClient = new JobRouterAdminist // 1. Incoming job will have the aforementioned worker selectors attached to it. // 2. Offer will be sent only to the worker who satisfies all three criteria // -// NOTE: All jobs with referencing the classification policy will have the WorkerSelectors attached to them +// NOTE: All jobs with referencing the classification policy will have the WorkerSelectorAttachments attached to them // Set up queue string distributionPolicyId = "distribution-policy-id-2"; @@ -62,11 +62,11 @@ Response cp1 = await routerAdministrationClient.CreateClas new CreateClassificationPolicyOptions(classificationPolicyId: cpId) { Name = "Classification_Policy_O365", - WorkerSelectors = + WorkerSelectorAttachments = { - new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Location", LabelOperator.Equal, new LabelValue("United States"))), - new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Language", LabelOperator.Equal, new LabelValue("en-us"))), - new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Geo", LabelOperator.Equal, new LabelValue("NA"))) + new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Location", LabelOperator.Equal, new RouterValue("United States"))), + new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Language", LabelOperator.Equal, new RouterValue("en-us"))), + new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Geo", LabelOperator.Equal, new RouterValue("NA"))) } }); @@ -75,8 +75,8 @@ Response jobO365 = await routerClient.CreateJobWithClassificationPoli new CreateJobWithClassificationPolicyOptions(jobId: "jobO365", channelId: "general", classificationPolicyId: cp1.Value.Id) { ChannelReference = "12345", - QueueId = queueId, // We only want to attach WorkerSelectors with classification policy this time, so we will specify queueId - Priority = 10, // We only want to attach WorkerSelectors with classification policy this time, so we will specify priority + QueueId = queueId, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify queueId + Priority = 10, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify priority }); @@ -88,29 +88,29 @@ Console.WriteLine($"O365 job has been enqueued in queue: {queue1.Value.Id}. Stat string workerId1 = "worker-id-1"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId1, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId1, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel("general", 10), }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Geo"] = new LabelValue("NA"), - ["Skill_English_Lvl"] = new LabelValue(7), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Geo"] = new RouterValue("NA"), + ["Skill_English_Lvl"] = new RouterValue(7), }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); string workerId2 = "worker-id-2"; Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId2, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId2, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - Labels = { ["Skill_English_Lvl"] = new LabelValue(7) }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Channels = { new RouterChannel("general", 10), }, + Labels = { ["Skill_English_Lvl"] = new RouterValue(7) }, // attaching labels associated with worker + Queues = { queueId } }); @@ -127,7 +127,7 @@ Console.WriteLine($"Worker 2 has not received offer for job: {queriedWorker2.Val ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_CondtitionalWorkerSelectors // In this scenario we are going to use a classification policy while submitting a job. -// We are going to utilize the 'WorkerSelectors' attribute on the classification policy to attach +// We are going to utilize the 'WorkerSelectorAttachments' attribute on the classification policy to attach // custom worker selectors to the job. For this scenario, we are going to demonstrate // ConditionalWorkerSelector to filter workers based on a condition. // We would like to filter workers on the following criteria:- @@ -176,23 +176,23 @@ Response cp1 = await routerAdministrationClient.CreateClas new CreateClassificationPolicyOptions(classificationPolicyId: cpId) { Name = "Classification_Policy_O365", - WorkerSelectors = + WorkerSelectorAttachments = { new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.Location = \"United States\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Language", LabelOperator.Equal, new LabelValue("en-us")), - new RouterWorkerSelector("Geo", LabelOperator.Equal, new LabelValue("NA")), - new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(5)) + new RouterWorkerSelector("Language", LabelOperator.Equal, new RouterValue("en-us")), + new RouterWorkerSelector("Geo", LabelOperator.Equal, new RouterValue("NA")), + new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(5)) }), new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.Location = \"Canada\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Language", LabelOperator.Equal, new LabelValue("en-ca")), - new RouterWorkerSelector("Geo", LabelOperator.Equal, new LabelValue("NA")), - new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(5)) + new RouterWorkerSelector("Language", LabelOperator.Equal, new RouterValue("en-ca")), + new RouterWorkerSelector("Geo", LabelOperator.Equal, new RouterValue("NA")), + new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(5)) }), } }); @@ -202,11 +202,11 @@ Response jobO365 = await routerClient.CreateJobWithClassificationPoli new CreateJobWithClassificationPolicyOptions(jobId: "jobO365", channelId: "general", classificationPolicyId: cp1.Value.Id) { ChannelReference = "12345", - QueueId = queueId, // We only want to attach WorkerSelectors with classification policy this time, so we will specify queueId - Priority = 10, // We only want to attach WorkerSelectors with classification policy this time, so we will specify priority + QueueId = queueId, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify queueId + Priority = 10, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify priority Labels = // we will attach a label to the job which will affects its classification { - ["Location"] = new LabelValue("United States"), + ["Location"] = new RouterValue("United States"), } }); @@ -219,32 +219,32 @@ Console.Write($"O365 job has the following worker selectors attached to it after // Set up two workers string workerId1 = "worker-id-1"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId1, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId1, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel("general", 10), }, Labels = { - ["Language"] = new LabelValue("en-us"), - ["Geo"] = new LabelValue("NA"), - ["Skill_English_Lvl"] = new LabelValue(7) + ["Language"] = new RouterValue("en-us"), + ["Geo"] = new RouterValue("NA"), + ["Skill_English_Lvl"] = new RouterValue(7) }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); string workerId2 = "worker-id-2"; Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId2, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId2, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10) }, + Channels = { new RouterChannel("general", 10) }, Labels = { - ["Language"] = new LabelValue("en-ca"), - ["Geo"] = new LabelValue("NA"), - ["Skill_English_Lvl"] = new LabelValue(7) + ["Language"] = new RouterValue("en-ca"), + ["Geo"] = new RouterValue("NA"), + ["Skill_English_Lvl"] = new RouterValue(7) }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); @@ -262,7 +262,7 @@ Console.WriteLine($"Worker 2 has not received offer for job: {queriedWorker2.Val ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_PassThroughWorkerSelectors // cSpell:ignore XBOX, Xbox // In this scenario we are going to use a classification policy while submitting a job. -// We are going to utilize the 'WorkerSelectors' attribute on the classification policy to attach +// We are going to utilize the 'WorkerSelectorAttachments' attribute on the classification policy to attach // custom worker selectors to the job. For this scenario, we are going to demonstrate // PassThroughWorkerSelectors to filter workers based on a conditions already attached to job. // We would like to filter workers on the following criteria already attached to job:- @@ -305,13 +305,13 @@ Response cp1 = await routerAdministrationClient.CreateClas new CreateClassificationPolicyOptions(classificationPolicyId: cpId) { Name = "Classification_Policy_O365_XBOX", - WorkerSelectors = + WorkerSelectorAttachments = { new PassThroughWorkerSelectorAttachment("Location", LabelOperator.Equal), new PassThroughWorkerSelectorAttachment("Geo", LabelOperator.Equal), new PassThroughWorkerSelectorAttachment("Language", LabelOperator.Equal), new PassThroughWorkerSelectorAttachment("Dept", LabelOperator.Equal), - new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(5))), + new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(5))), } }); @@ -320,14 +320,14 @@ Response jobO365 = await routerClient.CreateJobWithClassificationPoli new CreateJobWithClassificationPolicyOptions(jobId: "jobO365", channelId: "general", classificationPolicyId: cp1.Value.Id) { ChannelReference = "12345", - QueueId = queueId, // We only want to attach WorkerSelectors with classification policy this time, so we will specify queueId - Priority = 10, // We only want to attach WorkerSelectors with classification policy this time, so we will specify priority + QueueId = queueId, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify queueId + Priority = 10, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify priority Labels = // we will attach a label to the job which will affects its classification { - ["Location"] = new LabelValue("United States"), - ["Geo"] = new LabelValue("NA"), - ["Language"] = new LabelValue("en-us"), - ["Dept"] = new LabelValue("O365") + ["Location"] = new RouterValue("United States"), + ["Geo"] = new RouterValue("NA"), + ["Language"] = new RouterValue("en-us"), + ["Dept"] = new RouterValue("O365") } }); @@ -335,14 +335,14 @@ Response jobXbox = await routerClient.CreateJobWithClassificationPoli new CreateJobWithClassificationPolicyOptions(jobId: "jobXbox", channelId: "general", classificationPolicyId: cp1.Value.Id) { ChannelReference = "12345", - QueueId = queueId, // We only want to attach WorkerSelectors with classification policy this time, so we will specify queueId - Priority = 10, // We only want to attach WorkerSelectors with classification policy this time, so we will specify priority + QueueId = queueId, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify queueId + Priority = 10, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify priority Labels = // we will attach a label to the job which will affects its classification { - ["Location"] = new LabelValue("United States"), - ["Geo"] = new LabelValue("NA"), - ["Language"] = new LabelValue("en-us"), - ["Dept"] = new LabelValue("Xbox") + ["Location"] = new RouterValue("United States"), + ["Geo"] = new RouterValue("NA"), + ["Language"] = new RouterValue("en-us"), + ["Dept"] = new RouterValue("Xbox") } }); @@ -360,37 +360,37 @@ Console.Write($"O365 job has the following worker selectors attached to it after // Set up two workers string workerId1 = "worker-id-1"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId1, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId1, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel("general", 10), }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Geo"] = new LabelValue("NA"), - ["Language"] = new LabelValue("en-us"), - ["Dept"] = new LabelValue("O365"), - ["Skill_English_Lvl"] = new LabelValue(10), + ["Location"] = new RouterValue("United States"), + ["Geo"] = new RouterValue("NA"), + ["Language"] = new RouterValue("en-us"), + ["Dept"] = new RouterValue("O365"), + ["Skill_English_Lvl"] = new RouterValue(10), }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); string workerId2 = "worker-id-2"; Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId2, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId2, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel("general", 10), }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Geo"] = new LabelValue("NA"), - ["Language"] = new LabelValue("en-us"), - ["Dept"] = new LabelValue("Xbox"), - ["Skill_English_Lvl"] = new LabelValue(10), + ["Location"] = new RouterValue("United States"), + ["Geo"] = new RouterValue("NA"), + ["Language"] = new RouterValue("en-us"), + ["Dept"] = new RouterValue("Xbox"), + ["Skill_English_Lvl"] = new RouterValue(10), }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_AdvancedDistributionAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_AdvancedDistributionAsync.md index e42980a7ba234..7d499185ee105 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_AdvancedDistributionAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_AdvancedDistributionAsync.md @@ -23,11 +23,14 @@ JobRouterAdministrationClient routerAdministrationClient = new JobRouterAdminist // Create distribution policy string distributionPolicyId = "best-worker-dp-2"; -Response distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync( +var distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync( new CreateDistributionPolicyOptions( distributionPolicyId: distributionPolicyId, offerExpiresAfter: TimeSpan.FromMinutes(5), - mode: new BestWorkerMode(scoringRule: new ExpressionRouterRule("If(worker.HandleEscalation = true, 100, 1)")))); + mode: new BestWorkerMode + { + ScoringRule = new ExpressionRouterRule("If(worker.HandleEscalation = true, 100, 1)") + })); // Create job queue string jobQueueId = "job-queue-id-2"; @@ -42,26 +45,26 @@ string worker1Id = "worker-Id-1"; string worker2Id = "worker-Id-2"; // Worker 1 can handle escalation -Dictionary worker1Labels = new Dictionary() +Dictionary worker1Labels = new Dictionary() ; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { AvailableForOffers = true, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, - Labels = { ["HandleEscalation"] = new LabelValue(true), ["IT_Support"] = new LabelValue(true) }, - QueueAssignments = { [jobQueueId] = new RouterQueueAssignment(), } + Channels = { new RouterChannel(channelId, 10), }, + Labels = { ["HandleEscalation"] = new RouterValue(true), ["IT_Support"] = new RouterValue(true) }, + Queues = { jobQueueId } }); // Worker 2 cannot handle escalation Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { AvailableForOffers = true, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, - Labels = { ["IT_Support"] = new LabelValue(true), }, - QueueAssignments = { [jobQueueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel(channelId, 10), }, + Labels = { ["IT_Support"] = new RouterValue(true), }, + Queues = { jobQueueId }, }); // Create job @@ -69,7 +72,7 @@ string jobId = "job-id-2"; Response job = await routerClient.CreateJobAsync( options: new CreateJobOptions(jobId: jobId, channelId: channelId, queueId: jobQueueId) { - RequestedWorkerSelectors = { new RouterWorkerSelector("IT_Support", LabelOperator.Equal, new LabelValue(true))}, + RequestedWorkerSelectors = { new RouterWorkerSelector("IT_Support", LabelOperator.Equal, new RouterValue(true))}, Priority = 100, }); @@ -250,11 +253,14 @@ Let us set up the rest using the Router SDK. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Distribution_Advanced_Scoring_AzureFunctionRouterRule // Create distribution policy string distributionPolicyId = "best-worker-dp-1"; -Response distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync( +var distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync( new CreateDistributionPolicyOptions( distributionPolicyId: distributionPolicyId, offerExpiresAfter: TimeSpan.FromMinutes(5), - mode: new BestWorkerMode(scoringRule: new FunctionRouterRule(new Uri(""))))); + mode: new BestWorkerMode + { + ScoringRule = new FunctionRouterRule(new Uri("")) + })); // Create job queue string queueId = "job-queue-id-1"; @@ -268,60 +274,60 @@ string channelId = "general"; string workerId1 = "worker-Id-1"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId1, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId1, capacity: 100) { - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Queues = { queueId }, Labels = { - ["HighPrioritySupport"] = new LabelValue(true), - ["HardwareSupport"] = new LabelValue(true), - ["Support_XBOX_SERIES_X"] = new LabelValue(true), - ["English"] = new LabelValue(10), - ["ChatSupport"] = new LabelValue(true), - ["XboxSupport"] = new LabelValue(true) + ["HighPrioritySupport"] = new RouterValue(true), + ["HardwareSupport"] = new RouterValue(true), + ["Support_XBOX_SERIES_X"] = new RouterValue(true), + ["English"] = new RouterValue(10), + ["ChatSupport"] = new RouterValue(true), + ["XboxSupport"] = new RouterValue(true) }, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel(channelId, 10), }, AvailableForOffers = true, }); string workerId2 = "worker-Id-2"; Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId2, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId2, capacity: 100) { - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Queues = { queueId }, Labels = { - ["HighPrioritySupport"] = new LabelValue(true), - ["HardwareSupport"] = new LabelValue(true), - ["Support_XBOX_SERIES_X"] = new LabelValue(true), - ["Support_XBOX_SERIES_S"] = new LabelValue(true), - ["English"] = new LabelValue(8), - ["ChatSupport"] = new LabelValue(true), - ["XboxSupport"] = new LabelValue(true) + ["HighPrioritySupport"] = new RouterValue(true), + ["HardwareSupport"] = new RouterValue(true), + ["Support_XBOX_SERIES_X"] = new RouterValue(true), + ["Support_XBOX_SERIES_S"] = new RouterValue(true), + ["English"] = new RouterValue(8), + ["ChatSupport"] = new RouterValue(true), + ["XboxSupport"] = new RouterValue(true) }, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel(channelId, 10), }, AvailableForOffers = true, }); string workerId3 = "worker-Id-3"; -Dictionary worker3Labels = new Dictionary() +Dictionary worker3Labels = new Dictionary() ; Response worker3 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId3, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId3, capacity: 100) { - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Queues = { queueId }, Labels = { - ["HighPrioritySupport"] = new LabelValue(false), - ["HardwareSupport"] = new LabelValue(true), - ["Support_XBOX"] = new LabelValue(true), - ["English"] = new LabelValue(7), - ["ChatSupport"] = new LabelValue(true), - ["XboxSupport"] = new LabelValue(true), + ["HighPrioritySupport"] = new RouterValue(false), + ["HardwareSupport"] = new RouterValue(true), + ["Support_XBOX"] = new RouterValue(true), + ["English"] = new RouterValue(7), + ["ChatSupport"] = new RouterValue(true), + ["XboxSupport"] = new RouterValue(true), }, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel(channelId, 10), }, AvailableForOffers = true, }); @@ -334,18 +340,18 @@ Response job = await routerClient.CreateJobAsync( queueId: queueId) { Labels = { - ["CommunicationType"] = new LabelValue("Chat"), - ["IssueType"] = new LabelValue("XboxSupport"), - ["Language"] = new LabelValue("en"), - ["HighPriority"] = new LabelValue(true), - ["SubIssueType"] = new LabelValue("ConsoleMalfunction"), - ["ConsoleType"] = new LabelValue("XBOX_SERIES_X"), - ["Model"] = new LabelValue("XBOX_SERIES_X_1TB") + ["CommunicationType"] = new RouterValue("Chat"), + ["IssueType"] = new RouterValue("XboxSupport"), + ["Language"] = new RouterValue("en"), + ["HighPriority"] = new RouterValue(true), + ["SubIssueType"] = new RouterValue("ConsoleMalfunction"), + ["ConsoleType"] = new RouterValue("XBOX_SERIES_X"), + ["Model"] = new RouterValue("XBOX_SERIES_X_1TB") }, RequestedWorkerSelectors = { - new RouterWorkerSelector("English", LabelOperator.GreaterThanEqual, new LabelValue(7)), - new RouterWorkerSelector("ChatSupport", LabelOperator.Equal, new LabelValue(true)), - new RouterWorkerSelector("XboxSupport", LabelOperator.Equal, new LabelValue(true)) + new RouterWorkerSelector("English", LabelOperator.GreaterThanOrEqual, new RouterValue(7)), + new RouterWorkerSelector("ChatSupport", LabelOperator.Equal, new RouterValue(true)), + new RouterWorkerSelector("XboxSupport", LabelOperator.Equal, new RouterValue(true)) }, Priority = 100, }); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_SimpleDistributionAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_SimpleDistributionAsync.md index ad9d9c4b93d2c..15492223e941b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_SimpleDistributionAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_SimpleDistributionAsync.md @@ -46,27 +46,27 @@ string worker1Id = "worker-id-1"; string worker2Id = "worker-id-2"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId }, }); Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId }, }); // Register worker1 -worker1 = await routerClient.UpdateWorkerAsync(new UpdateWorkerOptions(worker1Id) { AvailableForOffers = true }); +worker1 = await routerClient.UpdateWorkerAsync(new RouterWorker(worker1Id) { AvailableForOffers = true }); // wait for 5 seconds to simulate worker 1 has been idle longer await Task.Delay(TimeSpan.FromSeconds(5)); // Register worker2 -worker2 = await routerClient.UpdateWorkerAsync(new UpdateWorkerOptions(worker2Id) { AvailableForOffers = true }); +worker2 = await routerClient.UpdateWorkerAsync(new RouterWorker(worker2Id) { AvailableForOffers = true }); // Create a job string jobId = "job-id-1"; @@ -114,18 +114,18 @@ string worker1Id = "worker-id-1"; string worker2Id = "worker-id-2"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(5), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 5), }, + Queues = { queueId }, AvailableForOffers = true }); Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(5), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general",5), }, + Queues = { queueId }, AvailableForOffers = true, // register worker upon creation }); @@ -190,50 +190,50 @@ string worker2Id = "worker-id-2"; string worker3Id = "worker-id-3"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general",10), }, + Queues = { queueId }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Region"] = new LabelValue("NA"), - ["Hardware_Support"] = new LabelValue(true), - ["Hardware_Support_SurfaceLaptop"] = new LabelValue(true), - ["Language_Skill_Level_EN_US"] = new LabelValue(10), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Region"] = new RouterValue("NA"), + ["Hardware_Support"] = new RouterValue(true), + ["Hardware_Support_SurfaceLaptop"] = new RouterValue(true), + ["Language_Skill_Level_EN_US"] = new RouterValue(10), } }); Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general",10), }, + Queues = { queueId }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Region"] = new LabelValue("NA"), - ["Hardware_Support"] = new LabelValue(true), - ["Hardware_Support_SurfaceLaptop"] = new LabelValue(true), - ["Language_Skill_Level_EN_US"] = new LabelValue(20), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Region"] = new RouterValue("NA"), + ["Hardware_Support"] = new RouterValue(true), + ["Hardware_Support_SurfaceLaptop"] = new RouterValue(true), + ["Language_Skill_Level_EN_US"] = new RouterValue(20), } }); Response worker3 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker3Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker3Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Region"] = new LabelValue("NA"), - ["Hardware_Support"] = new LabelValue(true), - ["Hardware_Support_SurfaceLaptop"] = new LabelValue(false), - ["Language_Skill_Level_EN_US"] = new LabelValue(1), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Region"] = new RouterValue("NA"), + ["Hardware_Support"] = new RouterValue(true), + ["Hardware_Support_SurfaceLaptop"] = new RouterValue(false), + ["Language_Skill_Level_EN_US"] = new RouterValue(1), } }); @@ -243,15 +243,15 @@ Response job = await routerClient.CreateJobAsync( { Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Region"] = new LabelValue("NA"), - ["Hardware_Support"] = new LabelValue(true), - ["Hardware_Support_SurfaceLaptop"] = new LabelValue(true), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Region"] = new RouterValue("NA"), + ["Hardware_Support"] = new RouterValue(true), + ["Hardware_Support_SurfaceLaptop"] = new RouterValue(true), }, RequestedWorkerSelectors = { - new RouterWorkerSelector("Language_Skill_Level_EN_US", LabelOperator.GreaterThanEqual, new LabelValue(0)), + new RouterWorkerSelector("Language_Skill_Level_EN_US", LabelOperator.GreaterThanOrEqual, new RouterValue(0)), } }); @@ -304,18 +304,18 @@ string worker1Id = "worker-id-1"; string worker2Id = "worker-id-2"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId, }, AvailableForOffers = true, }); Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId, }, AvailableForOffers = true, }); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_QueueLengthExceptionTriggerAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_QueueLengthExceptionTriggerAsync.md index ea867b45782d2..1f30a8f73aa68 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_QueueLengthExceptionTriggerAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_QueueLengthExceptionTriggerAsync.md @@ -59,20 +59,17 @@ ManualReclassifyExceptionAction action = new ManualReclassifyExceptionAction Priority = 10, WorkerSelectors = { - new RouterWorkerSelector("ExceptionTriggered", LabelOperator.Equal, new LabelValue(true)) + new RouterWorkerSelector("ExceptionTriggered", LabelOperator.Equal, new RouterValue(true)) } }; Response exceptionPolicy = await routerAdministrationClient.CreateExceptionPolicyAsync(new CreateExceptionPolicyOptions( exceptionPolicyId: exceptionPolicyId, - exceptionRules: new Dictionary() + exceptionRules: new List() { - ["QueueLengthExceptionTrigger"] = new ExceptionRule( + new ExceptionRule(id: "QueueLengthExceptionTrigger", trigger: trigger, - actions: new Dictionary() - { - ["ManualReclassifyExceptionAction"] = action, - }) + actions: new List { action }) })); // create primary queue diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_WaitTimeExceptionAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_WaitTimeExceptionAsync.md index cc9f4601be7c3..a1dc5c00f3e5d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_WaitTimeExceptionAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_WaitTimeExceptionAsync.md @@ -51,20 +51,17 @@ ManualReclassifyExceptionAction action = new ManualReclassifyExceptionAction { QueueId = fallbackQueueId, Priority = 100, - WorkerSelectors = { new RouterWorkerSelector("HandleEscalation", LabelOperator.Equal, new LabelValue(true)) } + WorkerSelectors = { new RouterWorkerSelector("HandleEscalation", LabelOperator.Equal, new RouterValue(true)) } }; string exceptionPolicyId = "execption-policy-id"; Response exceptionPolicy = await routerAdministrationClient.CreateExceptionPolicyAsync(new CreateExceptionPolicyOptions( exceptionPolicyId: exceptionPolicyId, - exceptionRules: new Dictionary() + exceptionRules: new List() { - ["WaitTimeTriggerExceptionRule"] = new ExceptionRule( + new ExceptionRule(id: "WaitTimeTriggerExceptionRule", trigger: trigger, - actions: new Dictionary() - { - ["EscalateJobToFallbackQueueAction"] = action, - }) + actions: new List { action }) })); // Create initial queue diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Extensions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Extensions.cs index de546620226f0..0cd768d549587 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Extensions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Extensions.cs @@ -15,6 +15,11 @@ internal static class Extensions second.ToList().ForEach(pair => first[pair.Key] = pair.Value); return second; } + + public static void AddRange(this IList list, IEnumerable collection) + { + collection.ToList().ForEach(list.Add); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs index 50c3a04217478..ae5c0974051e3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs @@ -21,10 +21,10 @@ internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) } Optional scoringRule = default; Optional scoringRuleOptions = default; - string kind = default; Optional minConcurrentOffers = default; Optional maxConcurrentOffers = default; Optional bypassSelectors = default; + string kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scoringRule"u8)) @@ -42,12 +42,7 @@ internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) { continue; } - scoringRuleOptions = ScoringRuleOptions.DeserializeScoringRuleOptions(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); + scoringRuleOptions = JobRouter.ScoringRuleOptions.DeserializeScoringRuleOptions(property.Value); continue; } if (property.NameEquals("minConcurrentOffers"u8)) @@ -77,8 +72,13 @@ internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) bypassSelectors = property.Value.GetBoolean(); continue; } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } } - return new BestWorkerMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), scoringRule.Value, scoringRuleOptions.Value); + return new BestWorkerMode(minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), kind, scoringRule.Value, scoringRuleOptions.Value); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs index ed62c9500a1a2..e50b7a1d336f3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs @@ -11,7 +11,6 @@ namespace Azure.Communication.JobRouter public partial class BestWorkerMode : DistributionMode { /// Initializes a new instance of BestWorkerMode. - /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// @@ -24,6 +23,7 @@ public partial class BestWorkerMode : DistributionMode /// This flag is intended more for temporary usage. /// By default, set to false. /// + /// The type discriminator describing a sub-type of DistributionMode. /// /// A rule of one of the following types: /// @@ -43,34 +43,10 @@ public partial class BestWorkerMode : DistributionMode /// Encapsulates all options that can be passed as parameters for scoring rule with /// BestWorkerMode /// - internal BestWorkerMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, RouterRule scoringRule, ScoringRuleOptions scoringRuleOptions) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + internal BestWorkerMode(int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, string kind, RouterRule scoringRule, ScoringRuleOptions scoringRuleOptions) : base(minConcurrentOffers, maxConcurrentOffers, bypassSelectors, kind) { ScoringRule = scoringRule; ScoringRuleOptions = scoringRuleOptions; } - - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule - /// providing static rules that always return the same result, regardless of - /// input. - /// DirectMapRule: A rule that return the same labels as the input - /// labels. - /// ExpressionRule: A rule providing inline expression - /// rules. - /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure - /// Function. - /// WebhookRule: A rule providing a binding to a webserver following - /// OAuth2.0 authentication protocol. - /// 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 RouterRule ScoringRule { get; } - /// - /// Encapsulates all options that can be passed as parameters for scoring rule with - /// BestWorkerMode - /// - public ScoringRuleOptions ScoringRuleOptions { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs index 52491f6438e6f..c74667d2829d0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs @@ -21,6 +21,7 @@ internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonEleme } Optional note = default; Optional dispositionCode = default; + Optional id = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -34,13 +35,18 @@ internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonEleme dispositionCode = property.Value.GetString(); continue; } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("kind"u8)) { kind = property.Value.GetString(); continue; } } - return new CancelExceptionAction(kind, note.Value, dispositionCode.Value); + return new CancelExceptionAction(id.Value, kind, note.Value, dispositionCode.Value); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs index 263b0bd975bff..f0721012da1ef 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs @@ -11,13 +11,8 @@ namespace Azure.Communication.JobRouter public partial class CancelExceptionAction : ExceptionAction { /// Initializes a new instance of CancelExceptionAction. - internal CancelExceptionAction() - { - Kind = "cancel"; - } - - /// Initializes a new instance of CancelExceptionAction. - /// Discriminator. + /// Unique Id of the exception action. + /// The type discriminator describing a sub-type of ExceptionAction. /// /// (Optional) A note that will be appended to the jobs' Notes collection with the /// current timestamp. @@ -26,7 +21,7 @@ internal CancelExceptionAction() /// (Optional) Indicates the outcome of the job, populate this field with your own /// custom values. /// - internal CancelExceptionAction(string kind, string note, string dispositionCode) : base(kind) + internal CancelExceptionAction(string id, string kind, string note, string dispositionCode) : base(id, kind) { Note = note; DispositionCode = dispositionCode; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobOptions.Serialization.cs new file mode 100644 index 0000000000000..b8803b7a10c0a --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobOptions.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class CancelJobOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Note)) + { + writer.WritePropertyName("note"u8); + writer.WriteStringValue(Note); + } + if (Optional.IsDefined(DispositionCode)) + { + writer.WritePropertyName("dispositionCode"u8); + writer.WriteStringValue(DispositionCode); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobOptions.cs new file mode 100644 index 0000000000000..9dca12d48c5e8 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobOptions.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Request payload for deleting a job. + public partial class CancelJobOptions + { + /// Initializes a new instance of CancelJobOptions. + public CancelJobOptions() + { + } + + /// Initializes a new instance of CancelJobOptions. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + /// + /// Indicates the outcome of the job, populate this field with your own custom + /// values. + /// If not provided, default value of "Cancelled" is set. + /// + internal CancelJobOptions(string note, string dispositionCode) + { + Note = note; + DispositionCode = dispositionCode; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs deleted file mode 100644 index 51d188a8cbc53..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - public partial class CancelJobRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Note)) - { - writer.WritePropertyName("note"u8); - writer.WriteStringValue(Note); - } - if (Optional.IsDefined(DispositionCode)) - { - writer.WritePropertyName("dispositionCode"u8); - writer.WriteStringValue(DispositionCode); - } - writer.WriteEndObject(); - } - - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs deleted file mode 100644 index c3adddfa4d4b1..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// Request payload for deleting a job. - public partial class CancelJobRequest - { - /// Initializes a new instance of CancelJobRequest. - public CancelJobRequest() - { - } - - /// Initializes a new instance of CancelJobRequest. - /// - /// (Optional) A note that will be appended to the jobs' Notes collection with the - /// current timestamp. - /// - /// - /// Indicates the outcome of the job, populate this field with your own custom - /// values. - /// If not provided, default value of "Cancelled" is set. - /// - internal CancelJobRequest(string note, string dispositionCode) - { - Note = note; - DispositionCode = dispositionCode; - } - - /// - /// (Optional) A note that will be appended to the jobs' Notes collection with the - /// current timestamp. - /// - public string Note { get; set; } - /// - /// Indicates the outcome of the job, populate this field with your own custom - /// values. - /// If not provided, default value of "Cancelled" is set. - /// - public string DispositionCode { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs deleted file mode 100644 index f6b0c5890eb59..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - public partial class ChannelConfiguration - { - internal static ChannelConfiguration DeserializeChannelConfiguration(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int capacityCostPerJob = default; - Optional maxNumberOfJobs = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("capacityCostPerJob"u8)) - { - capacityCostPerJob = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("maxNumberOfJobs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxNumberOfJobs = property.Value.GetInt32(); - continue; - } - } - return new ChannelConfiguration(capacityCostPerJob, Optional.ToNullable(maxNumberOfJobs)); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ChannelConfiguration FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeChannelConfiguration(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs deleted file mode 100644 index 06086cb90081c..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// Represents the capacity a job in this channel will consume from a worker. - public partial class ChannelConfiguration - { - /// Initializes a new instance of ChannelConfiguration. - /// - /// The amount of capacity that an instance of a job of this channel will consume - /// of the total worker capacity. - /// - internal ChannelConfiguration(int capacityCostPerJob) - { - CapacityCostPerJob = capacityCostPerJob; - } - - /// Initializes a new instance of ChannelConfiguration. - /// - /// The amount of capacity that an instance of a job of this channel will consume - /// of the total worker capacity. - /// - /// The maximum number of jobs that can be supported concurrently for this channel. - internal ChannelConfiguration(int capacityCostPerJob, int? maxNumberOfJobs) - { - CapacityCostPerJob = capacityCostPerJob; - MaxNumberOfJobs = maxNumberOfJobs; - } - - /// - /// The amount of capacity that an instance of a job of this channel will consume - /// of the total worker capacity. - /// - public int CapacityCostPerJob { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs index 293451a564c5c..a1f277c670993 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs @@ -20,14 +20,20 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement { return null; } + string etag = default; string id = default; Optional name = default; Optional fallbackQueueId = default; - Optional> queueSelectors = default; + Optional> queueSelectorAttachments = default; Optional prioritizationRule = default; - Optional> workerSelectors = default; + Optional> workerSelectorAttachments = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("etag"u8)) + { + etag = property.Value.GetString(); + continue; + } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -43,7 +49,7 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement fallbackQueueId = property.Value.GetString(); continue; } - if (property.NameEquals("queueSelectors"u8)) + if (property.NameEquals("queueSelectorAttachments"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { @@ -54,7 +60,7 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement { array.Add(QueueSelectorAttachment.DeserializeQueueSelectorAttachment(item)); } - queueSelectors = array; + queueSelectorAttachments = array; continue; } if (property.NameEquals("prioritizationRule"u8)) @@ -66,7 +72,7 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement prioritizationRule = RouterRule.DeserializeRouterRule(property.Value); continue; } - if (property.NameEquals("workerSelectors"u8)) + if (property.NameEquals("workerSelectorAttachments"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { @@ -77,11 +83,11 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement { array.Add(WorkerSelectorAttachment.DeserializeWorkerSelectorAttachment(item)); } - workerSelectors = array; + workerSelectorAttachments = array; continue; } } - return new ClassificationPolicy(id, name.Value, fallbackQueueId.Value, Optional.ToList(queueSelectors), prioritizationRule.Value, Optional.ToList(workerSelectors)); + return new ClassificationPolicy(etag, id, name.Value, fallbackQueueId.Value, Optional.ToList(queueSelectorAttachments), prioritizationRule.Value, Optional.ToList(workerSelectorAttachments)); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs index 5ebe1877a881b..408bb26a05b18 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs @@ -14,10 +14,18 @@ namespace Azure.Communication.JobRouter public partial class ClassificationPolicy { /// Initializes a new instance of ClassificationPolicy. + internal ClassificationPolicy() + { + QueueSelectorAttachments = new ChangeTrackingList(); + WorkerSelectorAttachments = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClassificationPolicy. + /// Concurrency Token. /// Unique identifier of this policy. /// Friendly name of this policy. /// The fallback queue to select if the queue selector doesn't find a match. - /// The queue selectors to resolve a queue for a given job. + /// The queue selector attachments used to resolve a queue for a given job. /// /// A rule of one of the following types: /// @@ -33,17 +41,17 @@ public partial class ClassificationPolicy /// WebhookRule: A rule providing a binding to a webserver following /// OAuth2.0 authentication protocol. /// - /// The worker label selectors to attach to a given job. - internal ClassificationPolicy(string id, string name, string fallbackQueueId, IList queueSelectors, RouterRule prioritizationRule, IList workerSelectors) + /// The worker selector attachments used to attach worker selectors to a given job. + internal ClassificationPolicy(string etag, string id, string name, string fallbackQueueId, IList queueSelectorAttachments, RouterRule prioritizationRule, IList workerSelectorAttachments) { + _etag = etag; Id = id; Name = name; FallbackQueueId = fallbackQueueId; - _queueSelectors = queueSelectors; + QueueSelectorAttachments = queueSelectorAttachments; PrioritizationRule = prioritizationRule; - _workerSelectors = workerSelectors; + WorkerSelectorAttachments = workerSelectorAttachments; } - /// Unique identifier of this policy. public string Id { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs deleted file mode 100644 index f539b800dd544..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; - -namespace Azure.Communication.JobRouter -{ - public partial class ClassificationPolicyItem - { - internal static ClassificationPolicyItem DeserializeClassificationPolicyItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ClassificationPolicy classificationPolicy = default; - string etag = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("classificationPolicy"u8)) - { - classificationPolicy = ClassificationPolicy.DeserializeClassificationPolicy(property.Value); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - } - return new ClassificationPolicyItem(classificationPolicy, etag); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ClassificationPolicyItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeClassificationPolicyItem(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs deleted file mode 100644 index bddd0fd08eb9d..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Paged instance of ClassificationPolicy. - public partial class ClassificationPolicyItem - { - /// Initializes a new instance of ClassificationPolicyItem. - /// A container for the rules that govern how jobs are classified. - /// (Optional) The Concurrency Token. - /// or is null. - internal ClassificationPolicyItem(ClassificationPolicy classificationPolicy, string etag) - { - Argument.AssertNotNull(classificationPolicy, nameof(classificationPolicy)); - Argument.AssertNotNull(etag, nameof(etag)); - - ClassificationPolicy = classificationPolicy; - _etag = etag; - } - - /// A container for the rules that govern how jobs are classified. - public ClassificationPolicy ClassificationPolicy { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobOptions.Serialization.cs new file mode 100644 index 0000000000000..3e1a3e2d8602c --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobOptions.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class CloseJobOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("assignmentId"u8); + writer.WriteStringValue(AssignmentId); + if (Optional.IsDefined(DispositionCode)) + { + writer.WritePropertyName("dispositionCode"u8); + writer.WriteStringValue(DispositionCode); + } + if (Optional.IsDefined(CloseAt)) + { + writer.WritePropertyName("closeAt"u8); + writer.WriteStringValue(CloseAt, "O"); + } + if (Optional.IsDefined(Note)) + { + writer.WritePropertyName("note"u8); + writer.WriteStringValue(Note); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobOptions.cs new file mode 100644 index 0000000000000..c7d66ce9072b8 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobOptions.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Request payload for closing jobs. + public partial class CloseJobOptions + { + /// Initializes a new instance of CloseJobOptions. + /// The assignment within which the job is to be closed. + /// is null. + public CloseJobOptions(string assignmentId) + { + Argument.AssertNotNull(assignmentId, nameof(assignmentId)); + + AssignmentId = assignmentId; + } + + /// Initializes a new instance of CloseJobOptions. + /// The assignment within which the job is to be closed. + /// + /// Indicates the outcome of the job, populate this field with your own custom + /// values. + /// + /// + /// If not provided, worker capacity is released immediately along with a + /// JobClosedEvent notification. + /// If provided, worker capacity is released along + /// with a JobClosedEvent notification at a future time in UTC. + /// + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + internal CloseJobOptions(string assignmentId, string dispositionCode, DateTimeOffset closeAt, string note) + { + AssignmentId = assignmentId; + DispositionCode = dispositionCode; + CloseAt = closeAt; + Note = note; + } + + /// The assignment within which the job is to be closed. + public string AssignmentId { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs deleted file mode 100644 index a4e2db01ac01d..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - public partial class CloseJobRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("assignmentId"u8); - writer.WriteStringValue(AssignmentId); - if (Optional.IsDefined(DispositionCode)) - { - writer.WritePropertyName("dispositionCode"u8); - writer.WriteStringValue(DispositionCode); - } - if (Optional.IsDefined(CloseAt)) - { - writer.WritePropertyName("closeAt"u8); - writer.WriteStringValue(CloseAt.Value, "O"); - } - if (Optional.IsDefined(Note)) - { - writer.WritePropertyName("note"u8); - writer.WriteStringValue(Note); - } - writer.WriteEndObject(); - } - - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs deleted file mode 100644 index 74680e2863d09..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Request payload for closing jobs. - public partial class CloseJobRequest - { - /// Initializes a new instance of CloseJobRequest. - /// The assignment within which the job is to be closed. - /// is null. - public CloseJobRequest(string assignmentId) - { - Argument.AssertNotNull(assignmentId, nameof(assignmentId)); - - AssignmentId = assignmentId; - } - - /// Initializes a new instance of CloseJobRequest. - /// The assignment within which the job is to be closed. - /// - /// Indicates the outcome of the job, populate this field with your own custom - /// values. - /// - /// - /// If not provided, worker capacity is released immediately along with a - /// JobClosedEvent notification. - /// If provided, worker capacity is released along - /// with a JobClosedEvent notification at a future time in UTC. - /// - /// - /// (Optional) A note that will be appended to the jobs' Notes collection with the - /// current timestamp. - /// - internal CloseJobRequest(string assignmentId, string dispositionCode, DateTimeOffset? closeAt, string note) - { - AssignmentId = assignmentId; - DispositionCode = dispositionCode; - CloseAt = closeAt; - Note = note; - } - - /// The assignment within which the job is to be closed. - public string AssignmentId { get; } - /// - /// Indicates the outcome of the job, populate this field with your own custom - /// values. - /// - public string DispositionCode { get; set; } - /// - /// If not provided, worker capacity is released immediately along with a - /// JobClosedEvent notification. - /// If provided, worker capacity is released along - /// with a JobClosedEvent notification at a future time in UTC. - /// - public DateTimeOffset? CloseAt { get; set; } - /// - /// (Optional) A note that will be appended to the jobs' Notes collection with the - /// current timestamp. - /// - public string Note { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs deleted file mode 100644 index 1351535df783a..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Communication.JobRouter; -using Azure.Core.Extensions; - -namespace Microsoft.Extensions.Azure -{ - /// Extension methods to add , to client builder. - public static partial class CommunicationJobRouterClientBuilderExtensions - { - /// Registers a instance. - /// The builder to register with. - /// The Uri to use. - public static IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, Uri endpoint) - where TBuilder : IAzureClientFactoryBuilder - { - return builder.RegisterClientFactory((options) => new JobRouterAdministrationClient(endpoint, options)); - } - - /// Registers a instance. - /// The builder to register with. - /// The Uri to use. - public static IAzureClientBuilder AddJobRouterClient(this TBuilder builder, Uri endpoint) - where TBuilder : IAzureClientFactoryBuilder - { - return builder.RegisterClientFactory((options) => new JobRouterClient(endpoint, options)); - } - - /// Registers a instance. - /// The builder to register with. - /// The configuration values. - public static IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, TConfiguration configuration) - where TBuilder : IAzureClientFactoryBuilderWithConfiguration - { - return builder.RegisterClientFactory(configuration); - } - /// Registers a instance. - /// The builder to register with. - /// The configuration values. - public static IAzureClientBuilder AddJobRouterClient(this TBuilder builder, TConfiguration configuration) - where TBuilder : IAzureClientFactoryBuilderWithConfiguration - { - return builder.RegisterClientFactory(configuration); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs deleted file mode 100644 index 929978e9cebb9..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs +++ /dev/null @@ -1,456 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.Communication.JobRouter -{ - /// Model factory for models. - public static partial class CommunicationJobRouterModelFactory - { - /// Initializes a new instance of BestWorkerMode. - /// Governs the minimum desired number of active concurrent offers a job can have. - /// Governs the maximum number of active concurrent offers a job can have. - /// - /// (Optional) - /// If set to true, then router will match workers to jobs even if they - /// don't match label selectors. - /// Warning: You may get workers that are not - /// qualified for the job they are matched with if you set this - /// variable to true. - /// This flag is intended more for temporary usage. - /// By default, set to false. - /// - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule - /// providing static rules that always return the same result, regardless of - /// input. - /// DirectMapRule: A rule that return the same labels as the input - /// labels. - /// ExpressionRule: A rule providing inline expression - /// rules. - /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure - /// Function. - /// WebhookRule: A rule providing a binding to a webserver following - /// OAuth2.0 authentication protocol. - /// - /// - /// Encapsulates all options that can be passed as parameters for scoring rule with - /// BestWorkerMode - /// - /// A new instance for mocking. - public static BestWorkerMode BestWorkerMode(int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null, RouterRule scoringRule = null, ScoringRuleOptions scoringRuleOptions = null) - { - return new BestWorkerMode("best-worker", minConcurrentOffers, maxConcurrentOffers, bypassSelectors, scoringRule, scoringRuleOptions); - } - - /// Initializes a new instance of ExpressionRouterRule. - /// The expression language to compile to and execute. - /// - /// The string containing the expression to evaluate. Should contain return - /// statement with calculated values. - /// - /// A new instance for mocking. - public static ExpressionRouterRule ExpressionRouterRule(string language = null, string expression = null) - { - return new ExpressionRouterRule("expression-rule", language, expression); - } - - /// Initializes a new instance of FunctionRouterRule. - /// URL for Azure Function. - /// Credentials used to access Azure function rule. - /// A new instance for mocking. - public static FunctionRouterRule FunctionRouterRule(Uri functionUri = null, FunctionRouterRuleCredential credential = null) - { - return new FunctionRouterRule("azure-function-rule", functionUri, credential); - } - - /// Initializes a new instance of WebhookRouterRule. - /// Uri for Authorization Server. - /// - /// OAuth2.0 Credentials used to Contoso's Authorization server. - /// Reference: - /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ - /// - /// Uri for Contoso's Web Server. - /// A new instance for mocking. - public static WebhookRouterRule WebhookRouterRule(Uri authorizationServerUri = null, Oauth2ClientCredential clientCredential = null, Uri webhookUri = null) - { - return new WebhookRouterRule("webhook-rule", authorizationServerUri, clientCredential, webhookUri); - } - - /// Initializes a new instance of Oauth2ClientCredential. - /// ClientId for Contoso Authorization server. - /// Client secret for Contoso Authorization server. - /// A new instance for mocking. - public static Oauth2ClientCredential Oauth2ClientCredential(string clientId = null, string clientSecret = null) - { - return new Oauth2ClientCredential(clientId, clientSecret); - } - - /// Initializes a new instance of ScoringRuleOptions. - /// - /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. - /// Defaults to 20 if not configured. - /// - /// - /// (Optional) List of extra parameters from the job that will be sent as part of - /// the payload to scoring rule. - /// If not set, the job's labels (sent in the payload - /// as `job`) and the job's worker selectors (sent in the payload as - /// `selectors`) - /// are added to the payload of the scoring rule by default. - /// Note: - /// Worker labels are always sent with scoring payload. - /// - /// - /// (Optional) - /// If set to true, will score workers in batches, and the parameter - /// name of the worker labels will be sent as `workers`. - /// By default, set to false - /// and the parameter name for the worker labels will be sent as `worker`. - /// Note: If - /// enabled, use BatchSize to set batch size. - /// - /// - /// (Optional) - /// If false, will sort scores by ascending order. By default, set to - /// true. - /// - /// A new instance for mocking. - public static ScoringRuleOptions ScoringRuleOptions(int? batchSize = null, IEnumerable scoringParameters = null, bool? allowScoringBatchOfWorkers = null, bool? descendingOrder = null) - { - scoringParameters ??= new List(); - - return new ScoringRuleOptions(batchSize, scoringParameters?.ToList(), allowScoringBatchOfWorkers, descendingOrder); - } - - /// Initializes a new instance of ConditionalQueueSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule - /// providing static rules that always return the same result, regardless of - /// input. - /// DirectMapRule: A rule that return the same labels as the input - /// labels. - /// ExpressionRule: A rule providing inline expression - /// rules. - /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure - /// Function. - /// WebhookRule: A rule providing a binding to a webserver following - /// OAuth2.0 authentication protocol. - /// - /// The queue selectors to attach. - /// A new instance for mocking. - public static ConditionalQueueSelectorAttachment ConditionalQueueSelectorAttachment(RouterRule condition = null, IEnumerable queueSelectors = null) - { - queueSelectors ??= new List(); - - return new ConditionalQueueSelectorAttachment("conditional", condition, queueSelectors?.ToList()); - } - - /// Initializes a new instance of PassThroughQueueSelectorAttachment. - /// The label key to query against. - /// Describes how the value of the label is compared to the value pass through. - /// A new instance for mocking. - public static PassThroughQueueSelectorAttachment PassThroughQueueSelectorAttachment(string key = null, LabelOperator labelOperator = default) - { - return new PassThroughQueueSelectorAttachment("pass-through", key, labelOperator); - } - - /// Initializes a new instance of RuleEngineQueueSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule - /// providing static rules that always return the same result, regardless of - /// input. - /// DirectMapRule: A rule that return the same labels as the input - /// labels. - /// ExpressionRule: A rule providing inline expression - /// rules. - /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure - /// Function. - /// WebhookRule: A rule providing a binding to a webserver following - /// OAuth2.0 authentication protocol. - /// - /// A new instance for mocking. - public static RuleEngineQueueSelectorAttachment RuleEngineQueueSelectorAttachment(RouterRule rule = null) - { - return new RuleEngineQueueSelectorAttachment("rule-engine", rule); - } - - /// Initializes a new instance of StaticQueueSelectorAttachment. - /// - /// Describes a condition that must be met against a set of labels for queue - /// selection - /// - /// A new instance for mocking. - public static StaticQueueSelectorAttachment StaticQueueSelectorAttachment(RouterQueueSelector queueSelector = null) - { - return new StaticQueueSelectorAttachment("static", queueSelector); - } - - /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. - /// A collection of percentage based weighted allocations. - /// A new instance for mocking. - public static WeightedAllocationQueueSelectorAttachment WeightedAllocationQueueSelectorAttachment(IEnumerable allocations = null) - { - allocations ??= new List(); - - return new WeightedAllocationQueueSelectorAttachment("weighted-allocation-queue-selector", allocations?.ToList()); - } - - /// Initializes a new instance of QueueWeightedAllocation. - /// The percentage of this weight, expressed as a fraction of 1. - /// - /// A collection of queue selectors that will be applied if this allocation is - /// selected. - /// - /// A new instance for mocking. - public static QueueWeightedAllocation QueueWeightedAllocation(double weight = default, IEnumerable queueSelectors = null) - { - queueSelectors ??= new List(); - - return new QueueWeightedAllocation(weight, queueSelectors?.ToList()); - } - - /// Initializes a new instance of ConditionalWorkerSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule - /// providing static rules that always return the same result, regardless of - /// input. - /// DirectMapRule: A rule that return the same labels as the input - /// labels. - /// ExpressionRule: A rule providing inline expression - /// rules. - /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure - /// Function. - /// WebhookRule: A rule providing a binding to a webserver following - /// OAuth2.0 authentication protocol. - /// - /// The worker selectors to attach. - /// A new instance for mocking. - public static ConditionalWorkerSelectorAttachment ConditionalWorkerSelectorAttachment(RouterRule condition = null, IEnumerable workerSelectors = null) - { - workerSelectors ??= new List(); - - return new ConditionalWorkerSelectorAttachment("conditional", condition, workerSelectors?.ToList()); - } - - /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule - /// providing static rules that always return the same result, regardless of - /// input. - /// DirectMapRule: A rule that return the same labels as the input - /// labels. - /// ExpressionRule: A rule providing inline expression - /// rules. - /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure - /// Function. - /// WebhookRule: A rule providing a binding to a webserver following - /// OAuth2.0 authentication protocol. - /// - /// A new instance for mocking. - public static RuleEngineWorkerSelectorAttachment RuleEngineWorkerSelectorAttachment(RouterRule rule = null) - { - return new RuleEngineWorkerSelectorAttachment("rule-engine", rule); - } - - /// Initializes a new instance of StaticWorkerSelectorAttachment. - /// - /// Describes a condition that must be met against a set of labels for worker - /// selection - /// - /// A new instance for mocking. - public static StaticWorkerSelectorAttachment StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector = null) - { - return new StaticWorkerSelectorAttachment("static", workerSelector); - } - - /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. - /// A collection of percentage based weighted allocations. - /// A new instance for mocking. - public static WeightedAllocationWorkerSelectorAttachment WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations = null) - { - allocations ??= new List(); - - return new WeightedAllocationWorkerSelectorAttachment("weighted-allocation-worker-selector", allocations?.ToList()); - } - - /// Initializes a new instance of WorkerWeightedAllocation. - /// The percentage of this weight, expressed as a fraction of 1. - /// - /// A collection of worker selectors that will be applied if this allocation is - /// selected. - /// - /// A new instance for mocking. - public static WorkerWeightedAllocation WorkerWeightedAllocation(double weight = default, IEnumerable workerSelectors = null) - { - workerSelectors ??= new List(); - - return new WorkerWeightedAllocation(weight, workerSelectors?.ToList()); - } - - /// Initializes a new instance of ExceptionRule. - /// The trigger for this exception rule. - /// - /// A dictionary collection of actions to perform once the exception is triggered. - /// Key is the Id of each exception action. - /// - /// or is null. - /// A new instance for mocking. - public static ExceptionRule ExceptionRule(ExceptionTrigger trigger = null, IDictionary actions = null) - { - if (trigger == null) - { - throw new ArgumentNullException(nameof(trigger)); - } - actions ??= new Dictionary(); - - return new ExceptionRule(trigger, actions); - } - - /// Initializes a new instance of QueueLengthExceptionTrigger. - /// Threshold of number of jobs ahead in the queue to for this trigger to fire. - /// A new instance for mocking. - public static QueueLengthExceptionTrigger QueueLengthExceptionTrigger(int threshold = default) - { - return new QueueLengthExceptionTrigger("queue-length", threshold); - } - - /// Initializes a new instance of RouterJobAssignment. - /// The Id of the job assignment. - /// The Id of the Worker assigned to the job. - /// The assignment time of the job in UTC. - /// The time the job was marked as completed after being assigned in UTC. - /// The time the job was marked as closed after being completed in UTC. - /// A new instance for mocking. - public static RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, DateTimeOffset assignedAt = default, DateTimeOffset? completedAt = null, DateTimeOffset? closedAt = null) - { - return new RouterJobAssignment(assignmentId, workerId, assignedAt, completedAt, closedAt); - } - - /// Initializes a new instance of ScheduleAndSuspendMode. - /// Scheduled time. - /// A new instance for mocking. - public static ScheduleAndSuspendMode ScheduleAndSuspendMode(DateTimeOffset scheduleAt = default) - { - return new ScheduleAndSuspendMode("schedule-and-suspend", scheduleAt); - } - - /// Initializes a new instance of UnassignJobResult. - /// The Id of the job unassigned. - /// The number of times a job is unassigned. At a maximum 3. - /// is null. - /// A new instance for mocking. - public static UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = default) - { - if (jobId == null) - { - throw new ArgumentNullException(nameof(jobId)); - } - - return new UnassignJobResult(jobId, unassignmentCount); - } - - /// Initializes a new instance of AcceptJobOfferResult. - /// The assignment Id that assigns a worker that has accepted an offer to a job. - /// The Id of the job assigned. - /// The Id of the worker that has been assigned this job. - /// , or is null. - /// A new instance for mocking. - public static AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) - { - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - if (jobId == null) - { - throw new ArgumentNullException(nameof(jobId)); - } - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - return new AcceptJobOfferResult(assignmentId, jobId, workerId); - } - - /// Initializes a new instance of RouterQueueStatistics. - /// Id of the queue these details are about. - /// Length of the queue: total number of enqueued jobs. - /// - /// The estimated wait time of this queue rounded up to the nearest minute, grouped - /// by job priority - /// - /// The wait time of the job that has been enqueued in this queue for the longest. - /// A new instance for mocking. - public static RouterQueueStatistics RouterQueueStatistics(string queueId = null, int length = default, IReadOnlyDictionary estimatedWaitTimeMinutes = null, double? longestJobWaitTimeMinutes = null) - { - estimatedWaitTimeMinutes ??= new Dictionary(); - - return new RouterQueueStatistics(queueId, length, estimatedWaitTimeMinutes, longestJobWaitTimeMinutes); - } - - /// Initializes a new instance of ChannelConfiguration. - /// - /// The amount of capacity that an instance of a job of this channel will consume - /// of the total worker capacity. - /// - /// The maximum number of jobs that can be supported concurrently for this channel. - /// A new instance for mocking. - public static ChannelConfiguration ChannelConfiguration(int capacityCostPerJob = default, int? maxNumberOfJobs = null) - { - return new ChannelConfiguration(capacityCostPerJob, maxNumberOfJobs); - } - - /// Initializes a new instance of RouterJobOffer. - /// The Id of the offer. - /// The Id of the job. - /// The capacity cost consumed by the job offer. - /// The time the offer was created in UTC. - /// The time that the offer will expire in UTC. - /// A new instance for mocking. - public static RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = default, DateTimeOffset? offeredAt = null, DateTimeOffset? expiresAt = null) - { - return new RouterJobOffer(offerId, jobId, capacityCost, offeredAt, expiresAt); - } - - /// Initializes a new instance of RouterWorkerAssignment. - /// The Id of the assignment. - /// The Id of the Job assigned. - /// The amount of capacity this assignment has consumed on the worker. - /// The assignment time of the job in UTC. - /// or is null. - /// A new instance for mocking. - public static RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = default, DateTimeOffset assignedAt = default) - { - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - if (jobId == null) - { - throw new ArgumentNullException(nameof(jobId)); - } - - return new RouterWorkerAssignment(assignmentId, jobId, capacityCost, assignedAt); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobOptions.Serialization.cs new file mode 100644 index 0000000000000..ffa61ea0efc7d --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobOptions.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.Communication.JobRouter +{ + public partial class CompleteJobOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("assignmentId"u8); + writer.WriteStringValue(AssignmentId); + if (Optional.IsDefined(Note)) + { + writer.WritePropertyName("note"u8); + writer.WriteStringValue(Note); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobOptions.cs new file mode 100644 index 0000000000000..3522cb8d049f4 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobOptions.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Request payload for completing jobs. + public partial class CompleteJobOptions + { + /// Initializes a new instance of CompleteJobOptions. + /// The assignment within the job to complete. + /// is null. + public CompleteJobOptions(string assignmentId) + { + Argument.AssertNotNull(assignmentId, nameof(assignmentId)); + + AssignmentId = assignmentId; + } + + /// Initializes a new instance of CompleteJobOptions. + /// The assignment within the job to complete. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + internal CompleteJobOptions(string assignmentId, string note) + { + AssignmentId = assignmentId; + Note = note; + } + + /// The assignment within the job to complete. + public string AssignmentId { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs deleted file mode 100644 index 16737f117b9b1..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - public partial class CompleteJobRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("assignmentId"u8); - writer.WriteStringValue(AssignmentId); - if (Optional.IsDefined(Note)) - { - writer.WritePropertyName("note"u8); - writer.WriteStringValue(Note); - } - writer.WriteEndObject(); - } - - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs deleted file mode 100644 index f45bde2d3974c..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Request payload for completing jobs. - public partial class CompleteJobRequest - { - /// Initializes a new instance of CompleteJobRequest. - /// The assignment within the job to complete. - /// is null. - public CompleteJobRequest(string assignmentId) - { - Argument.AssertNotNull(assignmentId, nameof(assignmentId)); - - AssignmentId = assignmentId; - } - - /// Initializes a new instance of CompleteJobRequest. - /// The assignment within the job to complete. - /// - /// (Optional) A note that will be appended to the jobs' Notes collection with the - /// current timestamp. - /// - internal CompleteJobRequest(string assignmentId, string note) - { - AssignmentId = assignmentId; - Note = note; - } - - /// The assignment within the job to complete. - public string AssignmentId { get; } - /// - /// (Optional) A note that will be appended to the jobs' Notes collection with the - /// current timestamp. - /// - public string Note { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs index 25817661672d3..e9d3864f642d7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs @@ -20,7 +20,7 @@ internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSe return null; } RouterRule condition = default; - IReadOnlyList queueSelectors = default; + IList queueSelectors = default; string kind = default; foreach (var property in element.EnumerateObject()) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs index 3518611c8b82c..8d69eab6a8cee 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs @@ -47,7 +47,7 @@ internal ConditionalQueueSelectorAttachment(RouterRule condition, IEnumerable Initializes a new instance of ConditionalQueueSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of QueueSelectorAttachment. /// /// A rule of one of the following types: /// @@ -64,7 +64,7 @@ internal ConditionalQueueSelectorAttachment(RouterRule condition, IEnumerable /// The queue selectors to attach. - internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, IReadOnlyList queueSelectors) : base(kind) + internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, IList queueSelectors) : base(kind) { Condition = condition; QueueSelectors = queueSelectors; @@ -88,7 +88,5 @@ internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, I /// The available derived classes include , , , and . /// public RouterRule Condition { get; } - /// The queue selectors to attach. - public IReadOnlyList QueueSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs index 7a669af531412..0ebaf1d27af7e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs @@ -20,7 +20,7 @@ internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorker return null; } RouterRule condition = default; - IReadOnlyList workerSelectors = default; + IList workerSelectors = default; string kind = default; foreach (var property in element.EnumerateObject()) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs index a3051bde4479b..d4dfa99f31a2d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs @@ -47,7 +47,7 @@ internal ConditionalWorkerSelectorAttachment(RouterRule condition, IEnumerable Initializes a new instance of ConditionalWorkerSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of WorkerSelectorAttachment. /// /// A rule of one of the following types: /// @@ -64,7 +64,7 @@ internal ConditionalWorkerSelectorAttachment(RouterRule condition, IEnumerable /// The worker selectors to attach. - internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, IReadOnlyList workerSelectors) : base(kind) + internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, IList workerSelectors) : base(kind) { Condition = condition; WorkerSelectors = workerSelectors; @@ -88,7 +88,5 @@ internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, /// The available derived classes include , , , and . /// public RouterRule Condition { get; } - /// The worker selectors to attach. - public IReadOnlyList WorkerSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferOptions.Serialization.cs new file mode 100644 index 0000000000000..a9fc052c77fd7 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferOptions.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class DeclineJobOfferOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(RetryOfferAt)) + { + writer.WritePropertyName("retryOfferAt"u8); + writer.WriteStringValue(RetryOfferAt.Value, "O"); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferOptions.cs new file mode 100644 index 0000000000000..55571b1bccb5a --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferOptions.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Communication.JobRouter +{ + /// Request payload for declining offers. + public partial class DeclineJobOfferOptions + { + /// Initializes a new instance of DeclineJobOfferOptions. + public DeclineJobOfferOptions() + { + } + + /// Initializes a new instance of DeclineJobOfferOptions. + /// + /// If the RetryOfferAt is not provided, then this job will not be offered again to + /// the worker who declined this job unless + /// the worker is de-registered and + /// re-registered. If a RetryOfferAt time is provided, then the job will be + /// re-matched to + /// eligible workers at the retry time in UTC. The worker that + /// declined the job will also be eligible for the job at that time. + /// + internal DeclineJobOfferOptions(DateTimeOffset? retryOfferAt) + { + RetryOfferAt = retryOfferAt; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs deleted file mode 100644 index ebf36a41bf6a6..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - public partial class DeclineJobOfferRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(RetryOfferAt)) - { - writer.WritePropertyName("retryOfferAt"u8); - writer.WriteStringValue(RetryOfferAt.Value, "O"); - } - writer.WriteEndObject(); - } - - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs deleted file mode 100644 index 48b0facbed189..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Communication.JobRouter -{ - /// Request payload for declining offers. - public partial class DeclineJobOfferRequest - { - /// Initializes a new instance of DeclineJobOfferRequest. - public DeclineJobOfferRequest() - { - } - - /// Initializes a new instance of DeclineJobOfferRequest. - /// - /// If the RetryOfferAt is not provided, then this job will not be offered again to - /// the worker who declined this job unless - /// the worker is de-registered and - /// re-registered. If a RetryOfferAt time is provided, then the job will be - /// re-matched to - /// eligible workers at the retry time in UTC. The worker that - /// declined the job will also be eligible for the job at that time. - /// - internal DeclineJobOfferRequest(DateTimeOffset? retryOfferAt) - { - RetryOfferAt = retryOfferAt; - } - - /// - /// If the RetryOfferAt is not provided, then this job will not be offered again to - /// the worker who declined this job unless - /// the worker is de-registered and - /// re-registered. If a RetryOfferAt time is provided, then the job will be - /// re-matched to - /// eligible workers at the retry time in UTC. The worker that - /// declined the job will also be eligible for the job at that time. - /// - public DateTimeOffset? RetryOfferAt { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs index c884c50eaa4ab..4ff8b78f23f99 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs @@ -11,7 +11,7 @@ namespace Azure.Communication.JobRouter public partial class DirectMapRouterRule : RouterRule { /// Initializes a new instance of DirectMapRouterRule. - /// Discriminator. + /// The type discriminator describing a sub-type of RouterRule. internal DirectMapRouterRule(string kind) : base(kind) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs index 94f9538c018b1..134846cea8b42 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs @@ -20,7 +20,6 @@ protected DistributionMode() } /// Initializes a new instance of DistributionMode. - /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// @@ -33,15 +32,13 @@ protected DistributionMode() /// This flag is intended more for temporary usage. /// By default, set to false. /// - internal DistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) + /// The type discriminator describing a sub-type of DistributionMode. + internal DistributionMode(int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, string kind) { - Kind = kind; MinConcurrentOffers = minConcurrentOffers; MaxConcurrentOffers = maxConcurrentOffers; BypassSelectors = bypassSelectors; + Kind = kind; } - - /// Discriminator. - internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs index f2fd9c7ccd9d7..c3dd5f029d9a9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs @@ -19,12 +19,18 @@ internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement ele { return null; } + string etag = default; string id = default; Optional name = default; Optional offerExpiresAfterSeconds = default; Optional mode = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("etag"u8)) + { + etag = property.Value.GetString(); + continue; + } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -54,7 +60,7 @@ internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement ele continue; } } - return new DistributionPolicy(id, name.Value, Optional.ToNullable(offerExpiresAfterSeconds), mode.Value); + return new DistributionPolicy(etag, id, name.Value, Optional.ToNullable(offerExpiresAfterSeconds), mode.Value); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs index add1cb5bcc153..03a7497b731a2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs @@ -11,6 +11,12 @@ namespace Azure.Communication.JobRouter public partial class DistributionPolicy { /// Initializes a new instance of DistributionPolicy. + internal DistributionPolicy() + { + } + + /// Initializes a new instance of DistributionPolicy. + /// Concurrency Token. /// The unique identifier of the policy. /// The human readable name of the policy. /// @@ -18,14 +24,14 @@ public partial class DistributionPolicy /// expired. /// /// Abstract base class for defining a distribution mode. - internal DistributionPolicy(string id, string name, double? offerExpiresAfterSeconds, DistributionMode mode) + internal DistributionPolicy(string etag, string id, string name, double? offerExpiresAfterSeconds, DistributionMode mode) { + _etag = etag; Id = id; Name = name; _offerExpiresAfterSeconds = offerExpiresAfterSeconds; Mode = mode; } - /// The unique identifier of the policy. public string Id { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs deleted file mode 100644 index cda8b479e4f8b..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; - -namespace Azure.Communication.JobRouter -{ - public partial class DistributionPolicyItem - { - internal static DistributionPolicyItem DeserializeDistributionPolicyItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DistributionPolicy distributionPolicy = default; - string etag = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("distributionPolicy"u8)) - { - distributionPolicy = DistributionPolicy.DeserializeDistributionPolicy(property.Value); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - } - return new DistributionPolicyItem(distributionPolicy, etag); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static DistributionPolicyItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDistributionPolicyItem(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs deleted file mode 100644 index 2a48b65360093..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Paged instance of DistributionPolicy. - public partial class DistributionPolicyItem - { - /// Initializes a new instance of DistributionPolicyItem. - /// Policy governing how jobs are distributed to workers. - /// (Optional) The Concurrency Token. - /// or is null. - internal DistributionPolicyItem(DistributionPolicy distributionPolicy, string etag) - { - Argument.AssertNotNull(distributionPolicy, nameof(distributionPolicy)); - Argument.AssertNotNull(etag, nameof(etag)); - - DistributionPolicy = distributionPolicy; - _etag = etag; - } - - /// Policy governing how jobs are distributed to workers. - public DistributionPolicy DistributionPolicy { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationClient.xml b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationClient.xml index bf8289c6776b4..d04572ae3cafc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationClient.xml +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationClient.xml @@ -5,111 +5,105 @@ This sample shows how to call GetDistributionPolicyAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetDistributionPolicyAsync(""); +Response response = await client.GetDistributionPolicyAsync(""); ]]> This sample shows how to call GetDistributionPolicyAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetDistributionPolicyAsync(""); +Response response = await client.GetDistributionPolicyAsync(""); ]]> This sample shows how to call GetDistributionPolicy. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetDistributionPolicy(""); +Response response = client.GetDistributionPolicy(""); ]]> This sample shows how to call GetDistributionPolicy with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetDistributionPolicy(""); +Response response = client.GetDistributionPolicy(""); ]]> This sample shows how to call GetDistributionPolicyAsync and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetDistributionPolicyAsync("", null); +Response response = await client.GetDistributionPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetDistributionPolicyAsync with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetDistributionPolicyAsync("", null); +Response response = await client.GetDistributionPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); -Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); ]]> This sample shows how to call GetDistributionPolicy and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetDistributionPolicy("", null); +Response response = client.GetDistributionPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetDistributionPolicy with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetDistributionPolicy("", null); +Response response = client.GetDistributionPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); -Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); +Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); ]]> This sample shows how to call DeleteDistributionPolicyAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.DeleteDistributionPolicyAsync(""); +Response response = await client.DeleteDistributionPolicyAsync(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteDistributionPolicyAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.DeleteDistributionPolicyAsync(""); +Response response = await client.DeleteDistributionPolicyAsync(""); Console.WriteLine(response.Status); ]]> @@ -118,19 +112,17 @@ Console.WriteLine(response.Status); This sample shows how to call DeleteDistributionPolicy. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.DeleteDistributionPolicy(""); +Response response = client.DeleteDistributionPolicy(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteDistributionPolicy with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.DeleteDistributionPolicy(""); +Response response = client.DeleteDistributionPolicy(""); Console.WriteLine(response.Status); ]]> @@ -139,109 +131,103 @@ Console.WriteLine(response.Status); This sample shows how to call GetClassificationPolicyAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetClassificationPolicyAsync(""); +Response response = await client.GetClassificationPolicyAsync(""); ]]> This sample shows how to call GetClassificationPolicyAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetClassificationPolicyAsync(""); +Response response = await client.GetClassificationPolicyAsync(""); ]]> This sample shows how to call GetClassificationPolicy. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetClassificationPolicy(""); +Response response = client.GetClassificationPolicy(""); ]]> This sample shows how to call GetClassificationPolicy with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetClassificationPolicy(""); +Response response = client.GetClassificationPolicy(""); ]]> This sample shows how to call GetClassificationPolicyAsync and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetClassificationPolicyAsync("", null); +Response response = await client.GetClassificationPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetClassificationPolicyAsync with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetClassificationPolicyAsync("", null); +Response response = await client.GetClassificationPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); -Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("queueSelectorAttachments")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("workerSelectorAttachments")[0].GetProperty("kind").ToString()); ]]> This sample shows how to call GetClassificationPolicy and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetClassificationPolicy("", null); +Response response = client.GetClassificationPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetClassificationPolicy with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetClassificationPolicy("", null); +Response response = client.GetClassificationPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); -Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("queueSelectorAttachments")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("workerSelectorAttachments")[0].GetProperty("kind").ToString()); ]]> This sample shows how to call DeleteClassificationPolicyAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.DeleteClassificationPolicyAsync(""); +Response response = await client.DeleteClassificationPolicyAsync(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteClassificationPolicyAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.DeleteClassificationPolicyAsync(""); +Response response = await client.DeleteClassificationPolicyAsync(""); Console.WriteLine(response.Status); ]]> @@ -250,19 +236,17 @@ Console.WriteLine(response.Status); This sample shows how to call DeleteClassificationPolicy. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.DeleteClassificationPolicy(""); +Response response = client.DeleteClassificationPolicy(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteClassificationPolicy with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.DeleteClassificationPolicy(""); +Response response = client.DeleteClassificationPolicy(""); Console.WriteLine(response.Status); ]]> @@ -271,105 +255,103 @@ Console.WriteLine(response.Status); This sample shows how to call GetExceptionPolicyAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetExceptionPolicyAsync(""); +Response response = await client.GetExceptionPolicyAsync(""); ]]> This sample shows how to call GetExceptionPolicyAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetExceptionPolicyAsync(""); +Response response = await client.GetExceptionPolicyAsync(""); ]]> This sample shows how to call GetExceptionPolicy. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetExceptionPolicy(""); +Response response = client.GetExceptionPolicy(""); ]]> This sample shows how to call GetExceptionPolicy with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetExceptionPolicy(""); +Response response = client.GetExceptionPolicy(""); ]]> This sample shows how to call GetExceptionPolicyAsync and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetExceptionPolicyAsync("", null); +Response response = await client.GetExceptionPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetExceptionPolicyAsync with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetExceptionPolicyAsync("", null); +Response response = await client.GetExceptionPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("trigger").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("kind").ToString()); ]]> This sample shows how to call GetExceptionPolicy and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetExceptionPolicy("", null); +Response response = client.GetExceptionPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetExceptionPolicy with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetExceptionPolicy("", null); +Response response = client.GetExceptionPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("trigger").GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("kind").ToString()); ]]> This sample shows how to call DeleteExceptionPolicyAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.DeleteExceptionPolicyAsync(""); +Response response = await client.DeleteExceptionPolicyAsync(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteExceptionPolicyAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.DeleteExceptionPolicyAsync(""); +Response response = await client.DeleteExceptionPolicyAsync(""); Console.WriteLine(response.Status); ]]> @@ -378,19 +360,17 @@ Console.WriteLine(response.Status); This sample shows how to call DeleteExceptionPolicy. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.DeleteExceptionPolicy(""); +Response response = client.DeleteExceptionPolicy(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteExceptionPolicy with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.DeleteExceptionPolicy(""); +Response response = client.DeleteExceptionPolicy(""); Console.WriteLine(response.Status); ]]> @@ -399,56 +379,52 @@ Console.WriteLine(response.Status); This sample shows how to call GetQueueAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetQueueAsync(""); +Response response = await client.GetQueueAsync(""); ]]> This sample shows how to call GetQueueAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetQueueAsync(""); +Response response = await client.GetQueueAsync(""); ]]> This sample shows how to call GetQueue. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetQueue(""); +Response response = client.GetQueue(""); ]]> This sample shows how to call GetQueue with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetQueue(""); +Response response = client.GetQueue(""); ]]> This sample shows how to call GetQueueAsync and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetQueueAsync("", null); +Response response = await client.GetQueueAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetQueueAsync with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.GetQueueAsync("", null); +Response response = await client.GetQueueAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); @@ -460,22 +436,22 @@ Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); This sample shows how to call GetQueue and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetQueue("", null); +Response response = client.GetQueue("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetQueue with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.GetQueue("", null); +Response response = client.GetQueue("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); @@ -487,19 +463,17 @@ Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); This sample shows how to call DeleteQueueAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.DeleteQueueAsync(""); +Response response = await client.DeleteQueueAsync(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteQueueAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = await client.DeleteQueueAsync(""); +Response response = await client.DeleteQueueAsync(""); Console.WriteLine(response.Status); ]]> @@ -508,19 +482,17 @@ Console.WriteLine(response.Status); This sample shows how to call DeleteQueue. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.DeleteQueue(""); +Response response = client.DeleteQueue(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteQueue with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -Response response = client.DeleteQueue(""); +Response response = client.DeleteQueue(""); Console.WriteLine(response.Status); ]]> @@ -529,19 +501,17 @@ Console.WriteLine(response.Status); This sample shows how to call GetDistributionPoliciesAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsync()) +await foreach (DistributionPolicy item in client.GetDistributionPoliciesAsync()) { } ]]> This sample shows how to call GetDistributionPoliciesAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsync(maxpagesize: 1234)) +await foreach (DistributionPolicy item in client.GetDistributionPoliciesAsync(maxpagesize: 1234)) { } ]]> @@ -550,19 +520,17 @@ await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsyn This sample shows how to call GetDistributionPolicies. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -foreach (DistributionPolicyItem item in client.GetDistributionPolicies()) +foreach (DistributionPolicy item in client.GetDistributionPolicies()) { } ]]> This sample shows how to call GetDistributionPolicies with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -foreach (DistributionPolicyItem item in client.GetDistributionPolicies(maxpagesize: 1234)) +foreach (DistributionPolicy item in client.GetDistributionPolicies(maxpagesize: 1234)) { } ]]> @@ -571,32 +539,30 @@ foreach (DistributionPolicyItem item in client.GetDistributionPolicies(maxpagesi This sample shows how to call GetDistributionPoliciesAsync and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetDistributionPoliciesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetDistributionPoliciesAsync with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetDistributionPoliciesAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); } ]]> @@ -604,32 +570,30 @@ await foreach (BinaryData item in client.GetDistributionPoliciesAsync(1234, null This sample shows how to call GetDistributionPolicies and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetDistributionPolicies(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetDistributionPolicies with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetDistributionPolicies(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); } ]]> @@ -637,19 +601,17 @@ foreach (BinaryData item in client.GetDistributionPolicies(1234, null)) This sample shows how to call GetClassificationPoliciesAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -await foreach (ClassificationPolicyItem item in client.GetClassificationPoliciesAsync()) +await foreach (ClassificationPolicy item in client.GetClassificationPoliciesAsync()) { } ]]> This sample shows how to call GetClassificationPoliciesAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -await foreach (ClassificationPolicyItem item in client.GetClassificationPoliciesAsync(maxpagesize: 1234)) +await foreach (ClassificationPolicy item in client.GetClassificationPoliciesAsync(maxpagesize: 1234)) { } ]]> @@ -658,19 +620,17 @@ await foreach (ClassificationPolicyItem item in client.GetClassificationPolicies This sample shows how to call GetClassificationPolicies. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -foreach (ClassificationPolicyItem item in client.GetClassificationPolicies()) +foreach (ClassificationPolicy item in client.GetClassificationPolicies()) { } ]]> This sample shows how to call GetClassificationPolicies with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -foreach (ClassificationPolicyItem item in client.GetClassificationPolicies(maxpagesize: 1234)) +foreach (ClassificationPolicy item in client.GetClassificationPolicies(maxpagesize: 1234)) { } ]]> @@ -679,31 +639,29 @@ foreach (ClassificationPolicyItem item in client.GetClassificationPolicies(maxpa This sample shows how to call GetClassificationPoliciesAsync and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetClassificationPoliciesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetClassificationPoliciesAsync with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetClassificationPoliciesAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("queueSelectorAttachments")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectorAttachments")[0].GetProperty("kind").ToString()); } ]]> @@ -711,31 +669,29 @@ await foreach (BinaryData item in client.GetClassificationPoliciesAsync(1234, nu This sample shows how to call GetClassificationPolicies and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetClassificationPolicies(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetClassificationPolicies with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetClassificationPolicies(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("queueSelectorAttachments")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectorAttachments")[0].GetProperty("kind").ToString()); } ]]> @@ -743,19 +699,17 @@ foreach (BinaryData item in client.GetClassificationPolicies(1234, null)) This sample shows how to call GetExceptionPoliciesAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync()) +await foreach (ExceptionPolicy item in client.GetExceptionPoliciesAsync()) { } ]]> This sample shows how to call GetExceptionPoliciesAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync(maxpagesize: 1234)) +await foreach (ExceptionPolicy item in client.GetExceptionPoliciesAsync(maxpagesize: 1234)) { } ]]> @@ -764,19 +718,17 @@ await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync(maxp This sample shows how to call GetExceptionPolicies. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -foreach (ExceptionPolicyItem item in client.GetExceptionPolicies()) +foreach (ExceptionPolicy item in client.GetExceptionPolicies()) { } ]]> This sample shows how to call GetExceptionPolicies with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -foreach (ExceptionPolicyItem item in client.GetExceptionPolicies(maxpagesize: 1234)) +foreach (ExceptionPolicy item in client.GetExceptionPolicies(maxpagesize: 1234)) { } ]]> @@ -785,29 +737,29 @@ foreach (ExceptionPolicyItem item in client.GetExceptionPolicies(maxpagesize: 12 This sample shows how to call GetExceptionPoliciesAsync and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetExceptionPoliciesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetExceptionPoliciesAsync with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetExceptionPoliciesAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("kind").ToString()); } ]]> @@ -815,29 +767,29 @@ await foreach (BinaryData item in client.GetExceptionPoliciesAsync(1234, null)) This sample shows how to call GetExceptionPolicies and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetExceptionPolicies(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetExceptionPolicies with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetExceptionPolicies(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("kind").ToString()); } ]]> @@ -845,19 +797,17 @@ foreach (BinaryData item in client.GetExceptionPolicies(1234, null)) This sample shows how to call GetQueuesAsync. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -await foreach (RouterQueueItem item in client.GetQueuesAsync()) +await foreach (RouterQueue item in client.GetQueuesAsync()) { } ]]> This sample shows how to call GetQueuesAsync with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -await foreach (RouterQueueItem item in client.GetQueuesAsync(maxpagesize: 1234)) +await foreach (RouterQueue item in client.GetQueuesAsync(maxpagesize: 1234)) { } ]]> @@ -866,19 +816,17 @@ await foreach (RouterQueueItem item in client.GetQueuesAsync(maxpagesize: 1234)) This sample shows how to call GetQueues. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -foreach (RouterQueueItem item in client.GetQueues()) +foreach (RouterQueue item in client.GetQueues()) { } ]]> This sample shows how to call GetQueues with all parameters. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); -foreach (RouterQueueItem item in client.GetQueues(maxpagesize: 1234)) +foreach (RouterQueue item in client.GetQueues(maxpagesize: 1234)) { } ]]> @@ -887,30 +835,28 @@ foreach (RouterQueueItem item in client.GetQueues(maxpagesize: 1234)) This sample shows how to call GetQueuesAsync and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetQueuesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetQueuesAsync with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetQueuesAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); } ]]> @@ -918,30 +864,28 @@ await foreach (BinaryData item in client.GetQueuesAsync(1234, null)) This sample shows how to call GetQueues and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetQueues(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetQueues with all parameters and parse the result. "); -JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); +JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetQueues(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); } ]]> diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterClient.xml b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterClient.xml index bd02e68a9c34f..f7e1cd0d9d19c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterClient.xml +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterClient.xml @@ -5,56 +5,52 @@ This sample shows how to call GetJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetJobAsync(""); +Response response = await client.GetJobAsync(""); ]]> This sample shows how to call GetJobAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetJobAsync(""); +Response response = await client.GetJobAsync(""); ]]> This sample shows how to call GetJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetJob(""); +Response response = client.GetJob(""); ]]> This sample shows how to call GetJob with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetJob(""); +Response response = client.GetJob(""); ]]> This sample shows how to call GetJobAsync and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetJobAsync("", null); +Response response = await client.GetJobAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetJobAsync with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetJobAsync("", null); +Response response = await client.GetJobAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("channelReference").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); @@ -85,7 +81,8 @@ Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProp Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("notes")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("notes")[0].GetProperty("addedAt").ToString()); Console.WriteLine(result.GetProperty("scheduledAt").ToString()); Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToString()); ]]> @@ -94,22 +91,22 @@ Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToStrin This sample shows how to call GetJob and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetJob("", null); +Response response = client.GetJob("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetJob with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetJob("", null); +Response response = client.GetJob("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("channelReference").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); @@ -140,7 +137,8 @@ Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProp Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("notes")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("notes")[0].GetProperty("addedAt").ToString()); Console.WriteLine(result.GetProperty("scheduledAt").ToString()); Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToString()); ]]> @@ -149,19 +147,17 @@ Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToStrin This sample shows how to call DeleteJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.DeleteJobAsync(""); +Response response = await client.DeleteJobAsync(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteJobAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.DeleteJobAsync(""); +Response response = await client.DeleteJobAsync(""); Console.WriteLine(response.Status); ]]> @@ -170,90 +166,82 @@ Console.WriteLine(response.Status); This sample shows how to call DeleteJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.DeleteJob(""); +Response response = client.DeleteJob(""); Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteJob with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.DeleteJob(""); +Response response = client.DeleteJob(""); Console.WriteLine(response.Status); ]]> - + This sample shows how to call CancelJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.CancelJobAsync(""); +Response response = await client.CancelJobAsync(""); ]]> This sample shows how to call CancelJobAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CancelJobRequest cancelJobRequest = new CancelJobRequest +CancelJobOptions options = new CancelJobOptions { Note = "", DispositionCode = "", }; -Response response = await client.CancelJobAsync("", cancelJobRequest: cancelJobRequest); +Response response = await client.CancelJobAsync("", options: options); ]]> - + This sample shows how to call CancelJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.CancelJob(""); +Response response = client.CancelJob(""); ]]> This sample shows how to call CancelJob with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CancelJobRequest cancelJobRequest = new CancelJobRequest +CancelJobOptions options = new CancelJobOptions { Note = "", DispositionCode = "", }; -Response response = client.CancelJob("", cancelJobRequest: cancelJobRequest); +Response response = client.CancelJob("", options: options); ]]> This sample shows how to call CancelJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; -Response response = await client.CancelJobAsync("", content); +Response response = await client.CancelJobAsync("", content); Console.WriteLine(response.Status); ]]> This sample shows how to call CancelJobAsync with all parameters and request content. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { note = "", dispositionCode = "", }); -Response response = await client.CancelJobAsync("", content); +Response response = await client.CancelJobAsync("", content); Console.WriteLine(response.Status); ]]> @@ -262,99 +250,91 @@ Console.WriteLine(response.Status); This sample shows how to call CancelJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; -Response response = client.CancelJob("", content); +Response response = client.CancelJob("", content); Console.WriteLine(response.Status); ]]> This sample shows how to call CancelJob with all parameters and request content. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { note = "", dispositionCode = "", }); -Response response = client.CancelJob("", content); +Response response = client.CancelJob("", content); Console.WriteLine(response.Status); ]]> - + This sample shows how to call CompleteJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CompleteJobRequest completeJobRequest = new CompleteJobRequest(""); -Response response = await client.CompleteJobAsync("", completeJobRequest); +CompleteJobOptions options = new CompleteJobOptions(""); +Response response = await client.CompleteJobAsync("", options); ]]> This sample shows how to call CompleteJobAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CompleteJobRequest completeJobRequest = new CompleteJobRequest("") +CompleteJobOptions options = new CompleteJobOptions("") { Note = "", }; -Response response = await client.CompleteJobAsync("", completeJobRequest); +Response response = await client.CompleteJobAsync("", options); ]]> - + This sample shows how to call CompleteJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CompleteJobRequest completeJobRequest = new CompleteJobRequest(""); -Response response = client.CompleteJob("", completeJobRequest); +CompleteJobOptions options = new CompleteJobOptions(""); +Response response = client.CompleteJob("", options); ]]> This sample shows how to call CompleteJob with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CompleteJobRequest completeJobRequest = new CompleteJobRequest("") +CompleteJobOptions options = new CompleteJobOptions("") { Note = "", }; -Response response = client.CompleteJob("", completeJobRequest); +Response response = client.CompleteJob("", options); ]]> This sample shows how to call CompleteJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", }); -Response response = await client.CompleteJobAsync("", content); +Response response = await client.CompleteJobAsync("", content); Console.WriteLine(response.Status); ]]> This sample shows how to call CompleteJobAsync with all parameters and request content. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", note = "", }); -Response response = await client.CompleteJobAsync("", content); +Response response = await client.CompleteJobAsync("", content); Console.WriteLine(response.Status); ]]> @@ -363,99 +343,91 @@ Console.WriteLine(response.Status); This sample shows how to call CompleteJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", }); -Response response = client.CompleteJob("", content); +Response response = client.CompleteJob("", content); Console.WriteLine(response.Status); ]]> This sample shows how to call CompleteJob with all parameters and request content. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", note = "", }); -Response response = client.CompleteJob("", content); +Response response = client.CompleteJob("", content); Console.WriteLine(response.Status); ]]> - + This sample shows how to call CloseJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CloseJobRequest closeJobRequest = new CloseJobRequest(""); -Response response = await client.CloseJobAsync("", closeJobRequest); +CloseJobOptions options = new CloseJobOptions(""); +Response response = await client.CloseJobAsync("", options); ]]> This sample shows how to call CloseJobAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CloseJobRequest closeJobRequest = new CloseJobRequest("") +CloseJobOptions options = new CloseJobOptions("") { DispositionCode = "", CloseAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), Note = "", }; -Response response = await client.CloseJobAsync("", closeJobRequest); +Response response = await client.CloseJobAsync("", options); ]]> - + This sample shows how to call CloseJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CloseJobRequest closeJobRequest = new CloseJobRequest(""); -Response response = client.CloseJob("", closeJobRequest); +CloseJobOptions options = new CloseJobOptions(""); +Response response = client.CloseJob("", options); ]]> This sample shows how to call CloseJob with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -CloseJobRequest closeJobRequest = new CloseJobRequest("") +CloseJobOptions options = new CloseJobOptions("") { DispositionCode = "", CloseAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), Note = "", }; -Response response = client.CloseJob("", closeJobRequest); +Response response = client.CloseJob("", options); ]]> This sample shows how to call CloseJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", }); -Response response = await client.CloseJobAsync("", content); +Response response = await client.CloseJobAsync("", content); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseJobAsync with all parameters and request content. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { @@ -464,7 +436,7 @@ using RequestContent content = RequestContent.Create(new closeAt = "2022-05-10T14:57:31.2311892-04:00", note = "", }); -Response response = await client.CloseJobAsync("", content); +Response response = await client.CloseJobAsync("", content); Console.WriteLine(response.Status); ]]> @@ -473,21 +445,19 @@ Console.WriteLine(response.Status); This sample shows how to call CloseJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", }); -Response response = client.CloseJob("", content); +Response response = client.CloseJob("", content); Console.WriteLine(response.Status); ]]> This sample shows how to call CloseJob with all parameters and request content. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { @@ -496,7 +466,7 @@ using RequestContent content = RequestContent.Create(new closeAt = "2022-05-10T14:57:31.2311892-04:00", note = "", }); -Response response = client.CloseJob("", content); +Response response = client.CloseJob("", content); Console.WriteLine(response.Status); ]]> @@ -505,44 +475,39 @@ Console.WriteLine(response.Status); This sample shows how to call GetQueuePositionAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetQueuePositionAsync(""); +Response response = await client.GetQueuePositionAsync(""); ]]> This sample shows how to call GetQueuePositionAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetQueuePositionAsync(""); +Response response = await client.GetQueuePositionAsync(""); ]]> This sample shows how to call GetQueuePosition. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetQueuePosition(""); +Response response = client.GetQueuePosition(""); ]]> This sample shows how to call GetQueuePosition with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetQueuePosition(""); +Response response = client.GetQueuePosition(""); ]]> This sample shows how to call GetQueuePositionAsync and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetQueuePositionAsync("", null); +Response response = await client.GetQueuePositionAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -553,10 +518,9 @@ Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); ]]> This sample shows how to call GetQueuePositionAsync with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetQueuePositionAsync("", null); +Response response = await client.GetQueuePositionAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -570,10 +534,9 @@ Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); This sample shows how to call GetQueuePosition and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetQueuePosition("", null); +Response response = client.GetQueuePosition("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -584,10 +547,9 @@ Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); ]]> This sample shows how to call GetQueuePosition with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetQueuePosition("", null); +Response response = client.GetQueuePosition("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -597,57 +559,52 @@ Console.WriteLine(result.GetProperty("queueLength").ToString()); Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString()); ]]> - + This sample shows how to call UnassignJobAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.UnassignJobAsync("", ""); +Response response = await client.UnassignJobAsync("", ""); ]]> This sample shows how to call UnassignJobAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -UnassignJobRequest unassignJobRequest = new UnassignJobRequest +UnassignJobOptions options = new UnassignJobOptions { SuspendMatching = true, }; -Response response = await client.UnassignJobAsync("", "", unassignJobRequest: unassignJobRequest); +Response response = await client.UnassignJobAsync("", "", options: options); ]]> - + This sample shows how to call UnassignJob. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.UnassignJob("", ""); +Response response = client.UnassignJob("", ""); ]]> This sample shows how to call UnassignJob with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -UnassignJobRequest unassignJobRequest = new UnassignJobRequest +UnassignJobOptions options = new UnassignJobOptions { SuspendMatching = true, }; -Response response = client.UnassignJob("", "", unassignJobRequest: unassignJobRequest); +Response response = client.UnassignJob("", "", options: options); ]]> This sample shows how to call UnassignJobAsync and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; -Response response = await client.UnassignJobAsync("", "", content); +Response response = await client.UnassignJobAsync("", "", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -655,14 +612,13 @@ Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); ]]> This sample shows how to call UnassignJobAsync with all parameters and request content and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { suspendMatching = true, }); -Response response = await client.UnassignJobAsync("", "", content); +Response response = await client.UnassignJobAsync("", "", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -673,11 +629,10 @@ Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); This sample shows how to call UnassignJob and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; -Response response = client.UnassignJob("", "", content); +Response response = client.UnassignJob("", "", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -685,14 +640,13 @@ Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); ]]> This sample shows how to call UnassignJob with all parameters and request content and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { suspendMatching = true, }); -Response response = client.UnassignJob("", "", content); +Response response = client.UnassignJob("", "", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -703,15 +657,13 @@ Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); This sample shows how to call AcceptJobOfferAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.AcceptJobOfferAsync("", ""); ]]> This sample shows how to call AcceptJobOfferAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.AcceptJobOfferAsync("", ""); ]]> @@ -720,15 +672,13 @@ Response response = await client.AcceptJobOfferAsync(" This sample shows how to call AcceptJobOffer. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.AcceptJobOffer("", ""); ]]> This sample shows how to call AcceptJobOffer with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.AcceptJobOffer("", ""); ]]> @@ -737,8 +687,7 @@ Response response = client.AcceptJobOffer("", "< This sample shows how to call AcceptJobOfferAsync and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.AcceptJobOfferAsync("", "", null); @@ -749,8 +698,7 @@ Console.WriteLine(result.GetProperty("workerId").ToString()); ]]> This sample shows how to call AcceptJobOfferAsync with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.AcceptJobOfferAsync("", "", null); @@ -764,8 +712,7 @@ Console.WriteLine(result.GetProperty("workerId").ToString()); This sample shows how to call AcceptJobOffer and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.AcceptJobOffer("", "", null); @@ -776,8 +723,7 @@ Console.WriteLine(result.GetProperty("workerId").ToString()); ]]> This sample shows how to call AcceptJobOffer with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.AcceptJobOffer("", "", null); @@ -787,54 +733,49 @@ Console.WriteLine(result.GetProperty("jobId").ToString()); Console.WriteLine(result.GetProperty("workerId").ToString()); ]]> - + This sample shows how to call DeclineJobOfferAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.DeclineJobOfferAsync("", ""); ]]> This sample shows how to call DeclineJobOfferAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -DeclineJobOfferRequest declineJobOfferRequest = new DeclineJobOfferRequest +DeclineJobOfferOptions options = new DeclineJobOfferOptions { RetryOfferAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), }; -Response response = await client.DeclineJobOfferAsync("", "", declineJobOfferRequest: declineJobOfferRequest); +Response response = await client.DeclineJobOfferAsync("", "", options: options); ]]> - + This sample shows how to call DeclineJobOffer. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.DeclineJobOffer("", ""); ]]> This sample shows how to call DeclineJobOffer with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -DeclineJobOfferRequest declineJobOfferRequest = new DeclineJobOfferRequest +DeclineJobOfferOptions options = new DeclineJobOfferOptions { RetryOfferAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), }; -Response response = client.DeclineJobOffer("", "", declineJobOfferRequest: declineJobOfferRequest); +Response response = client.DeclineJobOffer("", "", options: options); ]]> This sample shows how to call DeclineJobOfferAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; Response response = await client.DeclineJobOfferAsync("", "", content); @@ -843,8 +784,7 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call DeclineJobOfferAsync with all parameters and request content. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { @@ -859,8 +799,7 @@ Console.WriteLine(response.Status); This sample shows how to call DeclineJobOffer. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; Response response = client.DeclineJobOffer("", "", content); @@ -869,8 +808,7 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call DeclineJobOffer with all parameters and request content. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { @@ -885,44 +823,39 @@ Console.WriteLine(response.Status); This sample shows how to call GetQueueStatisticsAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetQueueStatisticsAsync(""); +Response response = await client.GetQueueStatisticsAsync(""); ]]> This sample shows how to call GetQueueStatisticsAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetQueueStatisticsAsync(""); +Response response = await client.GetQueueStatisticsAsync(""); ]]> This sample shows how to call GetQueueStatistics. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetQueueStatistics(""); +Response response = client.GetQueueStatistics(""); ]]> This sample shows how to call GetQueueStatistics with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetQueueStatistics(""); +Response response = client.GetQueueStatistics(""); ]]> This sample shows how to call GetQueueStatisticsAsync and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetQueueStatisticsAsync("", null); +Response response = await client.GetQueueStatisticsAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("queueId").ToString()); @@ -930,10 +863,9 @@ Console.WriteLine(result.GetProperty("length").ToString()); ]]> This sample shows how to call GetQueueStatisticsAsync with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = await client.GetQueueStatisticsAsync("", null); +Response response = await client.GetQueueStatisticsAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("queueId").ToString()); @@ -946,10 +878,9 @@ Console.WriteLine(result.GetProperty("longestJobWaitTimeMinutes").ToString()); This sample shows how to call GetQueueStatistics and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetQueueStatistics("", null); +Response response = client.GetQueueStatistics("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("queueId").ToString()); @@ -957,10 +888,9 @@ Console.WriteLine(result.GetProperty("length").ToString()); ]]> This sample shows how to call GetQueueStatistics with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -Response response = client.GetQueueStatistics("", null); +Response response = client.GetQueueStatistics("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("queueId").ToString()); @@ -973,15 +903,13 @@ Console.WriteLine(result.GetProperty("longestJobWaitTimeMinutes").ToString()); This sample shows how to call GetWorkerAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.GetWorkerAsync(""); ]]> This sample shows how to call GetWorkerAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.GetWorkerAsync(""); ]]> @@ -990,15 +918,13 @@ Response response = await client.GetWorkerAsync(""); This sample shows how to call GetWorker. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.GetWorker(""); ]]> This sample shows how to call GetWorker with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.GetWorker(""); ]]> @@ -1007,30 +933,31 @@ Response response = client.GetWorker(""); This sample shows how to call GetWorkerAsync and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.GetWorkerAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetWorkerAsync with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.GetWorkerAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("state").ToString()); -Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("totalCapacity").ToString()); +Console.WriteLine(result.GetProperty("queues")[0].ToString()); +Console.WriteLine(result.GetProperty("capacity").ToString()); Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); -Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); +Console.WriteLine(result.GetProperty("channels")[0].GetProperty("channelId").ToString()); +Console.WriteLine(result.GetProperty("channels")[0].GetProperty("capacityCostPerJob").ToString()); +Console.WriteLine(result.GetProperty("channels")[0].GetProperty("maxNumberOfJobs").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); @@ -1048,30 +975,31 @@ Console.WriteLine(result.GetProperty("availableForOffers").ToString()); This sample shows how to call GetWorker and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.GetWorker("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); ]]> This sample shows how to call GetWorker with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.GetWorker("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("state").ToString()); -Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("totalCapacity").ToString()); +Console.WriteLine(result.GetProperty("queues")[0].ToString()); +Console.WriteLine(result.GetProperty("capacity").ToString()); Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); -Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); +Console.WriteLine(result.GetProperty("channels")[0].GetProperty("channelId").ToString()); +Console.WriteLine(result.GetProperty("channels")[0].GetProperty("capacityCostPerJob").ToString()); +Console.WriteLine(result.GetProperty("channels")[0].GetProperty("maxNumberOfJobs").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); @@ -1089,8 +1017,7 @@ Console.WriteLine(result.GetProperty("availableForOffers").ToString()); This sample shows how to call DeleteWorkerAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.DeleteWorkerAsync(""); @@ -1098,8 +1025,7 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteWorkerAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = await client.DeleteWorkerAsync(""); @@ -1110,8 +1036,7 @@ Console.WriteLine(response.Status); This sample shows how to call DeleteWorker. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.DeleteWorker(""); @@ -1119,8 +1044,7 @@ Console.WriteLine(response.Status); ]]> This sample shows how to call DeleteWorker with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); Response response = client.DeleteWorker(""); @@ -1131,19 +1055,17 @@ Console.WriteLine(response.Status); This sample shows how to call GetJobsAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -await foreach (RouterJobItem item in client.GetJobsAsync()) +await foreach (RouterJob item in client.GetJobsAsync()) { } ]]> This sample shows how to call GetJobsAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -await foreach (RouterJobItem item in client.GetJobsAsync(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) +await foreach (RouterJob item in client.GetJobsAsync(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) { } ]]> @@ -1152,19 +1074,17 @@ await foreach (RouterJobItem item in client.GetJobsAsync(maxpagesize: 1234, stat This sample shows how to call GetJobs. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -foreach (RouterJobItem item in client.GetJobs()) +foreach (RouterJob item in client.GetJobs()) { } ]]> This sample shows how to call GetJobs with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -foreach (RouterJobItem item in client.GetJobs(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) +foreach (RouterJob item in client.GetJobs(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) { } ]]> @@ -1173,58 +1093,57 @@ foreach (RouterJobItem item in client.GetJobs(maxpagesize: 1234, status: RouterJ This sample shows how to call GetJobsAsync and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); await foreach (BinaryData item in client.GetJobsAsync(null, null, null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetJobsAsync with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); await foreach (BinaryData item in client.GetJobsAsync(1234, "all", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("addedAt").ToString()); + Console.WriteLine(result.GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToString()); } ]]> @@ -1232,58 +1151,57 @@ await foreach (BinaryData item in client.GetJobsAsync(1234, "all", "", This sample shows how to call GetJobs and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); foreach (BinaryData item in client.GetJobs(null, null, null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetJobs with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); foreach (BinaryData item in client.GetJobs(1234, "all", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("addedAt").ToString()); + Console.WriteLine(result.GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToString()); } ]]> @@ -1291,19 +1209,17 @@ foreach (BinaryData item in client.GetJobs(1234, "all", "", " This sample shows how to call GetWorkersAsync. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -await foreach (RouterWorkerItem item in client.GetWorkersAsync()) +await foreach (RouterWorker item in client.GetWorkersAsync()) { } ]]> This sample shows how to call GetWorkersAsync with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -await foreach (RouterWorkerItem item in client.GetWorkersAsync(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) +await foreach (RouterWorker item in client.GetWorkersAsync(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) { } ]]> @@ -1312,19 +1228,17 @@ await foreach (RouterWorkerItem item in client.GetWorkersAsync(maxpagesize: 1234 This sample shows how to call GetWorkers. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -foreach (RouterWorkerItem item in client.GetWorkers()) +foreach (RouterWorker item in client.GetWorkers()) { } ]]> This sample shows how to call GetWorkers with all parameters. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); -foreach (RouterWorkerItem item in client.GetWorkers(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) +foreach (RouterWorker item in client.GetWorkers(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) { } ]]> @@ -1333,44 +1247,43 @@ foreach (RouterWorkerItem item in client.GetWorkers(maxpagesize: 1234, state: Ro This sample shows how to call GetWorkersAsync and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); await foreach (BinaryData item in client.GetWorkersAsync(null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetWorkersAsync with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); await foreach (BinaryData item in client.GetWorkersAsync(1234, "active", "", "", true, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("queues")[0].ToString()); + Console.WriteLine(result.GetProperty("capacity").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("availableForOffers").ToString()); } ]]> @@ -1378,44 +1291,43 @@ await foreach (BinaryData item in client.GetWorkersAsync(1234, "active", " This sample shows how to call GetWorkers and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); foreach (BinaryData item in client.GetWorkers(null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } ]]> This sample shows how to call GetWorkers with all parameters and parse the result. "); -JobRouterClient client = new JobRouterClient(endpoint); +JobRouterClient client = new JobRouterClient((string)null); foreach (BinaryData item in client.GetWorkers(1234, "active", "", "", true, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("queues")[0].ToString()); + Console.WriteLine(result.GetProperty("capacity").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("availableForOffers").ToString()); } ]]> diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs index cc41005a23af0..2b7c640ecffe3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs @@ -20,13 +20,15 @@ protected ExceptionAction() } /// Initializes a new instance of ExceptionAction. - /// Discriminator. - internal ExceptionAction(string kind) + /// Unique Id of the exception action. + /// The type discriminator describing a sub-type of ExceptionAction. + internal ExceptionAction(string id, string kind) { + Id = id; Kind = kind; } - /// Discriminator. - internal string Kind { get; set; } + /// Unique Id of the exception action. + public string Id { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs index b64a63d33be1d..c6e85aa86e998 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs @@ -20,11 +20,17 @@ internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element) { return null; } + string etag = default; string id = default; Optional name = default; - Optional> exceptionRules = default; + Optional> exceptionRules = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("etag"u8)) + { + etag = property.Value.GetString(); + continue; + } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -41,16 +47,16 @@ internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) { - dictionary.Add(property0.Name, ExceptionRule.DeserializeExceptionRule(property0.Value)); + array.Add(ExceptionRule.DeserializeExceptionRule(item)); } - exceptionRules = dictionary; + exceptionRules = array; continue; } } - return new ExceptionPolicy(id, name.Value, Optional.ToDictionary(exceptionRules)); + return new ExceptionPolicy(etag, id, name.Value, Optional.ToList(exceptionRules)); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs index b2e161daf7015..0825a468fb0ae 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs @@ -14,19 +14,23 @@ namespace Azure.Communication.JobRouter public partial class ExceptionPolicy { /// Initializes a new instance of ExceptionPolicy. + internal ExceptionPolicy() + { + ExceptionRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of ExceptionPolicy. + /// Concurrency Token. /// The Id of the exception policy. /// (Optional) The name of the exception policy. - /// - /// (Optional) A dictionary collection of exception rules on the exception policy. - /// Key is the Id of each exception rule. - /// - internal ExceptionPolicy(string id, string name, IDictionary exceptionRules) + /// (Optional) A collection of exception rules on the exception policy. + internal ExceptionPolicy(string etag, string id, string name, IList exceptionRules) { + _etag = etag; Id = id; Name = name; - _exceptionRules = exceptionRules; + ExceptionRules = exceptionRules; } - /// The Id of the exception policy. public string Id { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs deleted file mode 100644 index 0f20fa78f79df..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; - -namespace Azure.Communication.JobRouter -{ - public partial class ExceptionPolicyItem - { - internal static ExceptionPolicyItem DeserializeExceptionPolicyItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ExceptionPolicy exceptionPolicy = default; - string etag = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("exceptionPolicy"u8)) - { - exceptionPolicy = ExceptionPolicy.DeserializeExceptionPolicy(property.Value); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - } - return new ExceptionPolicyItem(exceptionPolicy, etag); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ExceptionPolicyItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeExceptionPolicyItem(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs deleted file mode 100644 index d927c358eb57e..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Paged instance of ExceptionPolicy. - public partial class ExceptionPolicyItem - { - /// Initializes a new instance of ExceptionPolicyItem. - /// A policy that defines actions to execute when exception are triggered. - /// (Optional) The Concurrency Token. - /// or is null. - internal ExceptionPolicyItem(ExceptionPolicy exceptionPolicy, string etag) - { - Argument.AssertNotNull(exceptionPolicy, nameof(exceptionPolicy)); - Argument.AssertNotNull(etag, nameof(etag)); - - ExceptionPolicy = exceptionPolicy; - _etag = etag; - } - - /// A policy that defines actions to execute when exception are triggered. - public ExceptionPolicy ExceptionPolicy { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs index 77e2b5c8f04b4..259504dc4583e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs @@ -19,10 +19,16 @@ internal static ExceptionRule DeserializeExceptionRule(JsonElement element) { return null; } + string id = default; ExceptionTrigger trigger = default; - IDictionary actions = default; + IList actions = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("trigger"u8)) { trigger = ExceptionTrigger.DeserializeExceptionTrigger(property.Value); @@ -30,16 +36,16 @@ internal static ExceptionRule DeserializeExceptionRule(JsonElement element) } if (property.NameEquals("actions"u8)) { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) { - dictionary.Add(property0.Name, ExceptionAction.DeserializeExceptionAction(property0.Value)); + array.Add(ExceptionAction.DeserializeExceptionAction(item)); } - actions = dictionary; + actions = array; continue; } } - return new ExceptionRule(trigger, actions); + return new ExceptionRule(id, trigger, actions); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs index 74245ac57ad48..c6f06f1107a31 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Azure.Core; namespace Azure.Communication.JobRouter @@ -14,6 +15,35 @@ namespace Azure.Communication.JobRouter /// A rule that defines actions to execute upon a specific trigger. public partial class ExceptionRule { + /// Initializes a new instance of ExceptionRule. + /// Id of the exception rule. + /// The trigger for this exception rule. + /// A collection of actions to perform once the exception is triggered. + /// , or is null. + internal ExceptionRule(string id, ExceptionTrigger trigger, IEnumerable actions) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(trigger, nameof(trigger)); + Argument.AssertNotNull(actions, nameof(actions)); + + Id = id; + Trigger = trigger; + Actions = actions.ToList(); + } + + /// Initializes a new instance of ExceptionRule. + /// Id of the exception rule. + /// The trigger for this exception rule. + /// A collection of actions to perform once the exception is triggered. + internal ExceptionRule(string id, ExceptionTrigger trigger, IList actions) + { + Id = id; + Trigger = trigger; + Actions = actions; + } + + /// Id of the exception rule. + public string Id { get; } /// /// The trigger for this exception rule /// 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. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs index a060787cfd536..a4092743f2818 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs @@ -20,13 +20,10 @@ protected ExceptionTrigger() } /// Initializes a new instance of ExceptionTrigger. - /// Discriminator. + /// The type discriminator describing a sub-type of ExceptionTrigger. internal ExceptionTrigger(string kind) { Kind = kind; } - - /// Discriminator. - internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs index a5c32dbb509b5..e7fe03c8aa454 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs @@ -14,7 +14,7 @@ namespace Azure.Communication.JobRouter public partial class ExpressionRouterRule : RouterRule { /// Initializes a new instance of ExpressionRouterRule. - /// Discriminator. + /// The type discriminator describing a sub-type of RouterRule. /// The expression language to compile to and execute. /// /// The string containing the expression to evaluate. Should contain return diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs index e7fa933fc92f8..4b919a00a7007 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs @@ -14,7 +14,7 @@ namespace Azure.Communication.JobRouter public partial class FunctionRouterRule : RouterRule { /// Initializes a new instance of FunctionRouterRule. - /// Discriminator. + /// The type discriminator describing a sub-type of RouterRule. /// URL for Azure Function. /// Credentials used to access Azure function rule. internal FunctionRouterRule(string kind, Uri functionUri, FunctionRouterRuleCredential credential) : base(kind) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs index de1d09283948c..826e412869cc5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs @@ -10,6 +10,11 @@ namespace Azure.Communication.JobRouter /// Credentials used to access Azure function rule. public partial class FunctionRouterRuleCredential { + /// Initializes a new instance of FunctionRouterRuleCredential. + internal FunctionRouterRuleCredential() + { + } + /// Initializes a new instance of FunctionRouterRuleCredential. /// (Optional) Access key scoped to a particular function. /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs index 89704cc32f849..fbd6761406379 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs @@ -26,13 +26,15 @@ namespace Azure.Communication.JobRouter public abstract partial class JobMatchingMode { /// Initializes a new instance of JobMatchingMode. - /// Discriminator. + protected JobMatchingMode() + { + } + + /// Initializes a new instance of JobMatchingMode. + /// The type discriminator describing a sub-type of JobMatchingMode. internal JobMatchingMode(string kind) { Kind = kind; } - - /// Discriminator. - internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs index 649cab686303c..773d8343e5926 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs @@ -29,28 +29,6 @@ public partial class JobRouterAdministrationClient /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline => _pipeline; - /// Initializes a new instance of JobRouterAdministrationClient. - /// The Uri to use. - /// is null. - public JobRouterAdministrationClient(Uri endpoint) : this(endpoint, new JobRouterClientOptions()) - { - } - - /// Initializes a new instance of JobRouterAdministrationClient. - /// The Uri to use. - /// The options for configuring the client. - /// is null. - public JobRouterAdministrationClient(Uri endpoint, JobRouterClientOptions options) - { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - options ??= new JobRouterClientOptions(); - - ClientDiagnostics = new ClientDiagnostics(options, true); - _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); - _endpoint = endpoint; - _apiVersion = options.Version; - } - /// /// [Protocol Method] Creates or updates a distribution policy. /// @@ -61,17 +39,17 @@ public JobRouterAdministrationClient(Uri endpoint, JobRouterClientOptions option /// /// /// - /// The unique identifier of the policy. + /// The unique identifier of the policy. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual async Task UpsertDistributionPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual async Task UpsertDistributionPolicyAsync(string distributionPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -81,7 +59,7 @@ internal virtual async Task UpsertDistributionPolicyAsync(string id, R scope.Start(); try { - using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertDistributionPolicyRequest(distributionPolicyId, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -101,17 +79,17 @@ internal virtual async Task UpsertDistributionPolicyAsync(string id, R /// /// /// - /// The unique identifier of the policy. + /// The unique identifier of the policy. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual Response UpsertDistributionPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual Response UpsertDistributionPolicy(string distributionPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -121,7 +99,7 @@ internal virtual Response UpsertDistributionPolicy(string id, RequestContent con scope.Start(); try { - using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertDistributionPolicyRequest(distributionPolicyId, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -132,32 +110,32 @@ internal virtual Response UpsertDistributionPolicy(string id, RequestContent con } /// Retrieves an existing distribution policy by Id. - /// The unique identifier of the policy. + /// The unique identifier of the policy. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual async Task> GetDistributionPolicyAsync(string id, CancellationToken cancellationToken = default) + public virtual async Task> GetDistributionPolicyAsync(string distributionPolicyId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetDistributionPolicyAsync(id, context).ConfigureAwait(false); + Response response = await GetDistributionPolicyAsync(distributionPolicyId, context).ConfigureAwait(false); return Response.FromValue(DistributionPolicy.FromResponse(response), response); } /// Retrieves an existing distribution policy by Id. - /// The unique identifier of the policy. + /// The unique identifier of the policy. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual Response GetDistributionPolicy(string id, CancellationToken cancellationToken = default) + public virtual Response GetDistributionPolicy(string distributionPolicyId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetDistributionPolicy(id, context); + Response response = GetDistributionPolicy(distributionPolicyId, context); return Response.FromValue(DistributionPolicy.FromResponse(response), response); } @@ -176,22 +154,22 @@ public virtual Response GetDistributionPolicy(string id, Can /// /// /// - /// The unique identifier of the policy. + /// The unique identifier of the policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetDistributionPolicyAsync(string id, RequestContext context) + public virtual async Task GetDistributionPolicyAsync(string distributionPolicyId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetDistributionPolicy"); scope.Start(); try { - using HttpMessage message = CreateGetDistributionPolicyRequest(id, context); + using HttpMessage message = CreateGetDistributionPolicyRequest(distributionPolicyId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -216,22 +194,22 @@ public virtual async Task GetDistributionPolicyAsync(string id, Reques /// /// /// - /// The unique identifier of the policy. + /// The unique identifier of the policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response GetDistributionPolicy(string id, RequestContext context) + public virtual Response GetDistributionPolicy(string distributionPolicyId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetDistributionPolicy"); scope.Start(); try { - using HttpMessage message = CreateGetDistributionPolicyRequest(id, context); + using HttpMessage message = CreateGetDistributionPolicyRequest(distributionPolicyId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -252,22 +230,22 @@ public virtual Response GetDistributionPolicy(string id, RequestContext context) /// /// /// - /// The unique identifier of the policy. + /// The unique identifier of the policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task DeleteDistributionPolicyAsync(string id, RequestContext context = null) + public virtual async Task DeleteDistributionPolicyAsync(string distributionPolicyId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteDistributionPolicy"); scope.Start(); try { - using HttpMessage message = CreateDeleteDistributionPolicyRequest(id, context); + using HttpMessage message = CreateDeleteDistributionPolicyRequest(distributionPolicyId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -288,22 +266,22 @@ public virtual async Task DeleteDistributionPolicyAsync(string id, Req /// /// /// - /// The unique identifier of the policy. + /// The unique identifier of the policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response DeleteDistributionPolicy(string id, RequestContext context = null) + public virtual Response DeleteDistributionPolicy(string distributionPolicyId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteDistributionPolicy"); scope.Start(); try { - using HttpMessage message = CreateDeleteDistributionPolicyRequest(id, context); + using HttpMessage message = CreateDeleteDistributionPolicyRequest(distributionPolicyId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -323,17 +301,17 @@ public virtual Response DeleteDistributionPolicy(string id, RequestContext conte /// /// /// - /// Unique identifier of this policy. + /// Unique identifier of this policy. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual async Task UpsertClassificationPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual async Task UpsertClassificationPolicyAsync(string classificationPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -343,7 +321,7 @@ internal virtual async Task UpsertClassificationPolicyAsync(string id, scope.Start(); try { - using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertClassificationPolicyRequest(classificationPolicyId, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -363,17 +341,17 @@ internal virtual async Task UpsertClassificationPolicyAsync(string id, /// /// /// - /// Unique identifier of this policy. + /// Unique identifier of this policy. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual Response UpsertClassificationPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual Response UpsertClassificationPolicy(string classificationPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -383,7 +361,7 @@ internal virtual Response UpsertClassificationPolicy(string id, RequestContent c scope.Start(); try { - using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertClassificationPolicyRequest(classificationPolicyId, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -394,32 +372,32 @@ internal virtual Response UpsertClassificationPolicy(string id, RequestContent c } /// Retrieves an existing classification policy by Id. - /// Unique identifier of this policy. + /// Unique identifier of this policy. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual async Task> GetClassificationPolicyAsync(string id, CancellationToken cancellationToken = default) + public virtual async Task> GetClassificationPolicyAsync(string classificationPolicyId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetClassificationPolicyAsync(id, context).ConfigureAwait(false); + Response response = await GetClassificationPolicyAsync(classificationPolicyId, context).ConfigureAwait(false); return Response.FromValue(ClassificationPolicy.FromResponse(response), response); } /// Retrieves an existing classification policy by Id. - /// Unique identifier of this policy. + /// Unique identifier of this policy. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual Response GetClassificationPolicy(string id, CancellationToken cancellationToken = default) + public virtual Response GetClassificationPolicy(string classificationPolicyId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetClassificationPolicy(id, context); + Response response = GetClassificationPolicy(classificationPolicyId, context); return Response.FromValue(ClassificationPolicy.FromResponse(response), response); } @@ -438,22 +416,22 @@ public virtual Response GetClassificationPolicy(string id, /// /// /// - /// Unique identifier of this policy. + /// Unique identifier of this policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetClassificationPolicyAsync(string id, RequestContext context) + public virtual async Task GetClassificationPolicyAsync(string classificationPolicyId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetClassificationPolicy"); scope.Start(); try { - using HttpMessage message = CreateGetClassificationPolicyRequest(id, context); + using HttpMessage message = CreateGetClassificationPolicyRequest(classificationPolicyId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -478,22 +456,22 @@ public virtual async Task GetClassificationPolicyAsync(string id, Requ /// /// /// - /// Unique identifier of this policy. + /// Unique identifier of this policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response GetClassificationPolicy(string id, RequestContext context) + public virtual Response GetClassificationPolicy(string classificationPolicyId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetClassificationPolicy"); scope.Start(); try { - using HttpMessage message = CreateGetClassificationPolicyRequest(id, context); + using HttpMessage message = CreateGetClassificationPolicyRequest(classificationPolicyId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -514,22 +492,22 @@ public virtual Response GetClassificationPolicy(string id, RequestContext contex /// /// /// - /// Unique identifier of this policy. + /// Unique identifier of this policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task DeleteClassificationPolicyAsync(string id, RequestContext context = null) + public virtual async Task DeleteClassificationPolicyAsync(string classificationPolicyId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteClassificationPolicy"); scope.Start(); try { - using HttpMessage message = CreateDeleteClassificationPolicyRequest(id, context); + using HttpMessage message = CreateDeleteClassificationPolicyRequest(classificationPolicyId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -550,22 +528,22 @@ public virtual async Task DeleteClassificationPolicyAsync(string id, R /// /// /// - /// Unique identifier of this policy. + /// Unique identifier of this policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response DeleteClassificationPolicy(string id, RequestContext context = null) + public virtual Response DeleteClassificationPolicy(string classificationPolicyId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteClassificationPolicy"); scope.Start(); try { - using HttpMessage message = CreateDeleteClassificationPolicyRequest(id, context); + using HttpMessage message = CreateDeleteClassificationPolicyRequest(classificationPolicyId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -585,17 +563,17 @@ public virtual Response DeleteClassificationPolicy(string id, RequestContext con /// /// /// - /// The Id of the exception policy. + /// The Id of the exception policy. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual async Task UpsertExceptionPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual async Task UpsertExceptionPolicyAsync(string exceptionPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -605,7 +583,7 @@ internal virtual async Task UpsertExceptionPolicyAsync(string id, Requ scope.Start(); try { - using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertExceptionPolicyRequest(exceptionPolicyId, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -625,17 +603,17 @@ internal virtual async Task UpsertExceptionPolicyAsync(string id, Requ /// /// /// - /// The Id of the exception policy. + /// The Id of the exception policy. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual Response UpsertExceptionPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual Response UpsertExceptionPolicy(string exceptionPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -645,7 +623,7 @@ internal virtual Response UpsertExceptionPolicy(string id, RequestContent conten scope.Start(); try { - using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertExceptionPolicyRequest(exceptionPolicyId, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -656,32 +634,32 @@ internal virtual Response UpsertExceptionPolicy(string id, RequestContent conten } /// Retrieves an existing exception policy by Id. - /// The Id of the exception policy. + /// The Id of the exception policy. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual async Task> GetExceptionPolicyAsync(string id, CancellationToken cancellationToken = default) + public virtual async Task> GetExceptionPolicyAsync(string exceptionPolicyId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetExceptionPolicyAsync(id, context).ConfigureAwait(false); + Response response = await GetExceptionPolicyAsync(exceptionPolicyId, context).ConfigureAwait(false); return Response.FromValue(ExceptionPolicy.FromResponse(response), response); } /// Retrieves an existing exception policy by Id. - /// The Id of the exception policy. + /// The Id of the exception policy. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual Response GetExceptionPolicy(string id, CancellationToken cancellationToken = default) + public virtual Response GetExceptionPolicy(string exceptionPolicyId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetExceptionPolicy(id, context); + Response response = GetExceptionPolicy(exceptionPolicyId, context); return Response.FromValue(ExceptionPolicy.FromResponse(response), response); } @@ -700,22 +678,22 @@ public virtual Response GetExceptionPolicy(string id, Cancellat /// /// /// - /// The Id of the exception policy. + /// The Id of the exception policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetExceptionPolicyAsync(string id, RequestContext context) + public virtual async Task GetExceptionPolicyAsync(string exceptionPolicyId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetExceptionPolicy"); scope.Start(); try { - using HttpMessage message = CreateGetExceptionPolicyRequest(id, context); + using HttpMessage message = CreateGetExceptionPolicyRequest(exceptionPolicyId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -740,22 +718,22 @@ public virtual async Task GetExceptionPolicyAsync(string id, RequestCo /// /// /// - /// The Id of the exception policy. + /// The Id of the exception policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response GetExceptionPolicy(string id, RequestContext context) + public virtual Response GetExceptionPolicy(string exceptionPolicyId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetExceptionPolicy"); scope.Start(); try { - using HttpMessage message = CreateGetExceptionPolicyRequest(id, context); + using HttpMessage message = CreateGetExceptionPolicyRequest(exceptionPolicyId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -776,22 +754,22 @@ public virtual Response GetExceptionPolicy(string id, RequestContext context) /// /// /// - /// The Id of the exception policy. + /// The Id of the exception policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task DeleteExceptionPolicyAsync(string id, RequestContext context = null) + public virtual async Task DeleteExceptionPolicyAsync(string exceptionPolicyId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteExceptionPolicy"); scope.Start(); try { - using HttpMessage message = CreateDeleteExceptionPolicyRequest(id, context); + using HttpMessage message = CreateDeleteExceptionPolicyRequest(exceptionPolicyId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -812,22 +790,22 @@ public virtual async Task DeleteExceptionPolicyAsync(string id, Reques /// /// /// - /// The Id of the exception policy. + /// The Id of the exception policy. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response DeleteExceptionPolicy(string id, RequestContext context = null) + public virtual Response DeleteExceptionPolicy(string exceptionPolicyId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteExceptionPolicy"); scope.Start(); try { - using HttpMessage message = CreateDeleteExceptionPolicyRequest(id, context); + using HttpMessage message = CreateDeleteExceptionPolicyRequest(exceptionPolicyId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -847,17 +825,17 @@ public virtual Response DeleteExceptionPolicy(string id, RequestContext context /// /// /// - /// The Id of this queue. + /// The Id of this queue. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual async Task UpsertQueueAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual async Task UpsertQueueAsync(string queueId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -867,7 +845,7 @@ internal virtual async Task UpsertQueueAsync(string id, RequestContent scope.Start(); try { - using HttpMessage message = CreateUpsertQueueRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertQueueRequest(queueId, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -887,17 +865,17 @@ internal virtual async Task UpsertQueueAsync(string id, RequestContent /// /// /// - /// The Id of this queue. + /// The Id of this queue. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual Response UpsertQueue(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual Response UpsertQueue(string queueId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -907,7 +885,7 @@ internal virtual Response UpsertQueue(string id, RequestContent content, Request scope.Start(); try { - using HttpMessage message = CreateUpsertQueueRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertQueueRequest(queueId, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -918,32 +896,32 @@ internal virtual Response UpsertQueue(string id, RequestContent content, Request } /// Retrieves an existing queue by Id. - /// The Id of this queue. + /// The Id of this queue. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual async Task> GetQueueAsync(string id, CancellationToken cancellationToken = default) + public virtual async Task> GetQueueAsync(string queueId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetQueueAsync(id, context).ConfigureAwait(false); + Response response = await GetQueueAsync(queueId, context).ConfigureAwait(false); return Response.FromValue(RouterQueue.FromResponse(response), response); } /// Retrieves an existing queue by Id. - /// The Id of this queue. + /// The Id of this queue. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual Response GetQueue(string id, CancellationToken cancellationToken = default) + public virtual Response GetQueue(string queueId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetQueue(id, context); + Response response = GetQueue(queueId, context); return Response.FromValue(RouterQueue.FromResponse(response), response); } @@ -962,22 +940,22 @@ public virtual Response GetQueue(string id, CancellationToken cance /// /// /// - /// The Id of this queue. + /// The Id of this queue. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetQueueAsync(string id, RequestContext context) + public virtual async Task GetQueueAsync(string queueId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetQueue"); scope.Start(); try { - using HttpMessage message = CreateGetQueueRequest(id, context); + using HttpMessage message = CreateGetQueueRequest(queueId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1002,22 +980,22 @@ public virtual async Task GetQueueAsync(string id, RequestContext cont /// /// /// - /// The Id of this queue. + /// The Id of this queue. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response GetQueue(string id, RequestContext context) + public virtual Response GetQueue(string queueId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetQueue"); scope.Start(); try { - using HttpMessage message = CreateGetQueueRequest(id, context); + using HttpMessage message = CreateGetQueueRequest(queueId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1038,22 +1016,22 @@ public virtual Response GetQueue(string id, RequestContext context) /// /// /// - /// The Id of this queue. + /// The Id of this queue. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task DeleteQueueAsync(string id, RequestContext context = null) + public virtual async Task DeleteQueueAsync(string queueId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteQueue"); scope.Start(); try { - using HttpMessage message = CreateDeleteQueueRequest(id, context); + using HttpMessage message = CreateDeleteQueueRequest(queueId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1074,22 +1052,22 @@ public virtual async Task DeleteQueueAsync(string id, RequestContext c /// /// /// - /// The Id of this queue. + /// The Id of this queue. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response DeleteQueue(string id, RequestContext context = null) + public virtual Response DeleteQueue(string queueId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteQueue"); scope.Start(); try { - using HttpMessage message = CreateDeleteQueueRequest(id, context); + using HttpMessage message = CreateDeleteQueueRequest(queueId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1103,24 +1081,24 @@ public virtual Response DeleteQueue(string id, RequestContext context = null) /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual AsyncPageable GetDistributionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetDistributionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DistributionPolicyItem.DeserializeDistributionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetDistributionPolicies", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DistributionPolicy.DeserializeDistributionPolicy, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetDistributionPolicies", "value", "nextLink", context); } /// Retrieves existing distribution policies. /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual Pageable GetDistributionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual Pageable GetDistributionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DistributionPolicyItem.DeserializeDistributionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetDistributionPolicies", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DistributionPolicy.DeserializeDistributionPolicy, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetDistributionPolicies", "value", "nextLink", context); } /// @@ -1181,24 +1159,24 @@ public virtual Pageable GetDistributionPolicies(int? maxpagesize, Re /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual AsyncPageable GetClassificationPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetClassificationPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ClassificationPolicyItem.DeserializeClassificationPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetClassificationPolicies", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ClassificationPolicy.DeserializeClassificationPolicy, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetClassificationPolicies", "value", "nextLink", context); } /// Retrieves existing classification policies. /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual Pageable GetClassificationPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual Pageable GetClassificationPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ClassificationPolicyItem.DeserializeClassificationPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetClassificationPolicies", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ClassificationPolicy.DeserializeClassificationPolicy, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetClassificationPolicies", "value", "nextLink", context); } /// @@ -1259,24 +1237,24 @@ public virtual Pageable GetClassificationPolicies(int? maxpagesize, /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual AsyncPageable GetExceptionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetExceptionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ExceptionPolicyItem.DeserializeExceptionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetExceptionPolicies", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ExceptionPolicy.DeserializeExceptionPolicy, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetExceptionPolicies", "value", "nextLink", context); } /// Retrieves existing exception policies. /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual Pageable GetExceptionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual Pageable GetExceptionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ExceptionPolicyItem.DeserializeExceptionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetExceptionPolicies", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ExceptionPolicy.DeserializeExceptionPolicy, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetExceptionPolicies", "value", "nextLink", context); } /// @@ -1337,24 +1315,24 @@ public virtual Pageable GetExceptionPolicies(int? maxpagesize, Reque /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual AsyncPageable GetQueuesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetQueuesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterQueueItem.DeserializeRouterQueueItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetQueues", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterQueue.DeserializeRouterQueue, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetQueues", "value", "nextLink", context); } /// Retrieves existing queues. /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual Pageable GetQueues(int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual Pageable GetQueues(int? maxpagesize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterQueueItem.DeserializeRouterQueueItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetQueues", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterQueue.DeserializeRouterQueue, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetQueues", "value", "nextLink", context); } /// @@ -1411,7 +1389,7 @@ public virtual Pageable GetQueues(int? maxpagesize, RequestContext c return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.GetQueues", "value", "nextLink", context); } - internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + internal HttpMessage CreateUpsertDistributionPolicyRequest(string distributionPolicyId, RequestContent content, RequestConditions requestConditions, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; @@ -1419,7 +1397,7 @@ internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestCon var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/distributionPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(distributionPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1432,7 +1410,7 @@ internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestCon return message; } - internal HttpMessage CreateGetDistributionPolicyRequest(string id, RequestContext context) + internal HttpMessage CreateGetDistributionPolicyRequest(string distributionPolicyId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1440,7 +1418,7 @@ internal HttpMessage CreateGetDistributionPolicyRequest(string id, RequestContex var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/distributionPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(distributionPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1465,7 +1443,7 @@ internal HttpMessage CreateGetDistributionPoliciesRequest(int? maxpagesize, Requ return message; } - internal HttpMessage CreateDeleteDistributionPolicyRequest(string id, RequestContext context) + internal HttpMessage CreateDeleteDistributionPolicyRequest(string distributionPolicyId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; @@ -1473,14 +1451,14 @@ internal HttpMessage CreateDeleteDistributionPolicyRequest(string id, RequestCon var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/distributionPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(distributionPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + internal HttpMessage CreateUpsertClassificationPolicyRequest(string classificationPolicyId, RequestContent content, RequestConditions requestConditions, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; @@ -1488,7 +1466,7 @@ internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestC var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/classificationPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(classificationPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1501,7 +1479,7 @@ internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestC return message; } - internal HttpMessage CreateGetClassificationPolicyRequest(string id, RequestContext context) + internal HttpMessage CreateGetClassificationPolicyRequest(string classificationPolicyId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1509,7 +1487,7 @@ internal HttpMessage CreateGetClassificationPolicyRequest(string id, RequestCont var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/classificationPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(classificationPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1534,7 +1512,7 @@ internal HttpMessage CreateGetClassificationPoliciesRequest(int? maxpagesize, Re return message; } - internal HttpMessage CreateDeleteClassificationPolicyRequest(string id, RequestContext context) + internal HttpMessage CreateDeleteClassificationPolicyRequest(string classificationPolicyId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; @@ -1542,14 +1520,14 @@ internal HttpMessage CreateDeleteClassificationPolicyRequest(string id, RequestC var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/classificationPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(classificationPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + internal HttpMessage CreateUpsertExceptionPolicyRequest(string exceptionPolicyId, RequestContent content, RequestConditions requestConditions, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; @@ -1557,7 +1535,7 @@ internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestConten var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/exceptionPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(exceptionPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1570,7 +1548,7 @@ internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestConten return message; } - internal HttpMessage CreateGetExceptionPolicyRequest(string id, RequestContext context) + internal HttpMessage CreateGetExceptionPolicyRequest(string exceptionPolicyId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1578,7 +1556,7 @@ internal HttpMessage CreateGetExceptionPolicyRequest(string id, RequestContext c var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/exceptionPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(exceptionPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1603,7 +1581,7 @@ internal HttpMessage CreateGetExceptionPoliciesRequest(int? maxpagesize, Request return message; } - internal HttpMessage CreateDeleteExceptionPolicyRequest(string id, RequestContext context) + internal HttpMessage CreateDeleteExceptionPolicyRequest(string exceptionPolicyId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; @@ -1611,14 +1589,14 @@ internal HttpMessage CreateDeleteExceptionPolicyRequest(string id, RequestContex var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/exceptionPolicies/", false); - uri.AppendPath(id, true); + uri.AppendPath(exceptionPolicyId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + internal HttpMessage CreateUpsertQueueRequest(string queueId, RequestContent content, RequestConditions requestConditions, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; @@ -1626,7 +1604,7 @@ internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content, var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/queues/", false); - uri.AppendPath(id, true); + uri.AppendPath(queueId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1639,7 +1617,7 @@ internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content, return message; } - internal HttpMessage CreateGetQueueRequest(string id, RequestContext context) + internal HttpMessage CreateGetQueueRequest(string queueId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1647,7 +1625,7 @@ internal HttpMessage CreateGetQueueRequest(string id, RequestContext context) var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/queues/", false); - uri.AppendPath(id, true); + uri.AppendPath(queueId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1672,7 +1650,7 @@ internal HttpMessage CreateGetQueuesRequest(int? maxpagesize, RequestContext con return message; } - internal HttpMessage CreateDeleteQueueRequest(string id, RequestContext context) + internal HttpMessage CreateDeleteQueueRequest(string queueId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; @@ -1680,7 +1658,7 @@ internal HttpMessage CreateDeleteQueueRequest(string id, RequestContext context) var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/queues/", false); - uri.AppendPath(id, true); + uri.AppendPath(queueId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs index 6cfcdf8db8785..3c2478f5c3913 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs @@ -30,28 +30,6 @@ public partial class JobRouterClient /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline => _pipeline; - /// Initializes a new instance of JobRouterClient. - /// The Uri to use. - /// is null. - public JobRouterClient(Uri endpoint) : this(endpoint, new JobRouterClientOptions()) - { - } - - /// Initializes a new instance of JobRouterClient. - /// The Uri to use. - /// The options for configuring the client. - /// is null. - public JobRouterClient(Uri endpoint, JobRouterClientOptions options) - { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - options ??= new JobRouterClientOptions(); - - ClientDiagnostics = new ClientDiagnostics(options, true); - _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); - _endpoint = endpoint; - _apiVersion = options.Version; - } - /// /// [Protocol Method] Creates or updates a router job. /// @@ -62,17 +40,17 @@ public JobRouterClient(Uri endpoint, JobRouterClientOptions options) /// /// /// - /// The id of the job. + /// The id of the job. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual async Task UpsertJobAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual async Task UpsertJobAsync(string jobId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -82,7 +60,7 @@ internal virtual async Task UpsertJobAsync(string id, RequestContent c scope.Start(); try { - using HttpMessage message = CreateUpsertJobRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertJobRequest(jobId, content, requestConditions, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -102,17 +80,17 @@ internal virtual async Task UpsertJobAsync(string id, RequestContent c /// /// /// - /// The id of the job. + /// The id of the job. /// The content to send as the body of the request. /// The content to send as the request conditions of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual Response UpsertJob(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + internal virtual Response UpsertJob(string jobId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); Argument.AssertNotNull(content, nameof(content)); Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); @@ -122,7 +100,7 @@ internal virtual Response UpsertJob(string id, RequestContent content, RequestCo scope.Start(); try { - using HttpMessage message = CreateUpsertJobRequest(id, content, requestConditions, context); + using HttpMessage message = CreateUpsertJobRequest(jobId, content, requestConditions, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -133,32 +111,32 @@ internal virtual Response UpsertJob(string id, RequestContent content, RequestCo } /// Retrieves an existing job by Id. - /// The id of the job. + /// The id of the job. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual async Task> GetJobAsync(string id, CancellationToken cancellationToken = default) + public virtual async Task> GetJobAsync(string jobId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetJobAsync(id, context).ConfigureAwait(false); + Response response = await GetJobAsync(jobId, context).ConfigureAwait(false); return Response.FromValue(RouterJob.FromResponse(response), response); } /// Retrieves an existing job by Id. - /// The id of the job. + /// The id of the job. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual Response GetJob(string id, CancellationToken cancellationToken = default) + public virtual Response GetJob(string jobId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetJob(id, context); + Response response = GetJob(jobId, context); return Response.FromValue(RouterJob.FromResponse(response), response); } @@ -177,22 +155,22 @@ public virtual Response GetJob(string id, CancellationToken cancellat /// /// /// - /// The id of the job. + /// The id of the job. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetJobAsync(string id, RequestContext context) + public virtual async Task GetJobAsync(string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetJob"); scope.Start(); try { - using HttpMessage message = CreateGetJobRequest(id, context); + using HttpMessage message = CreateGetJobRequest(jobId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -217,22 +195,22 @@ public virtual async Task GetJobAsync(string id, RequestContext contex /// /// /// - /// The id of the job. + /// The id of the job. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response GetJob(string id, RequestContext context) + public virtual Response GetJob(string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetJob"); scope.Start(); try { - using HttpMessage message = CreateGetJobRequest(id, context); + using HttpMessage message = CreateGetJobRequest(jobId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -253,22 +231,22 @@ public virtual Response GetJob(string id, RequestContext context) /// /// /// - /// The id of the job. + /// The id of the job. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task DeleteJobAsync(string id, RequestContext context = null) + public virtual async Task DeleteJobAsync(string jobId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.DeleteJob"); scope.Start(); try { - using HttpMessage message = CreateDeleteJobRequest(id, context); + using HttpMessage message = CreateDeleteJobRequest(jobId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -289,22 +267,22 @@ public virtual async Task DeleteJobAsync(string id, RequestContext con /// /// /// - /// The id of the job. + /// The id of the job. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response DeleteJob(string id, RequestContext context = null) + public virtual Response DeleteJob(string jobId, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.DeleteJob"); scope.Start(); try { - using HttpMessage message = CreateDeleteJobRequest(id, context); + using HttpMessage message = CreateDeleteJobRequest(jobId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -315,34 +293,34 @@ public virtual Response DeleteJob(string id, RequestContext context = null) } /// Reclassify a job. - /// Id of the job. - /// Request object for reclassifying a job. + /// Id of the job. + /// Request object for reclassifying a job. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual async Task ReclassifyJobAsync(string id, IDictionary reclassifyJobRequest = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual async Task ReclassifyJobAsync(string jobId, IDictionary options = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = RequestContentHelper.FromDictionary(reclassifyJobRequest); - Response response = await ReclassifyJobAsync(id, content, context).ConfigureAwait(false); + using RequestContent content = RequestContentHelper.FromDictionary(options); + Response response = await ReclassifyJobAsync(jobId, content, context).ConfigureAwait(false); return response; } /// Reclassify a job. - /// Id of the job. - /// Request object for reclassifying a job. + /// Id of the job. + /// Request object for reclassifying a job. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - internal virtual Response ReclassifyJob(string id, IDictionary reclassifyJobRequest = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual Response ReclassifyJob(string jobId, IDictionary options = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = RequestContentHelper.FromDictionary(reclassifyJobRequest); - Response response = ReclassifyJob(id, content, context); + using RequestContent content = RequestContentHelper.FromDictionary(options); + Response response = ReclassifyJob(jobId, content, context); return response; } @@ -361,22 +339,22 @@ internal virtual Response ReclassifyJob(string id, IDictionary r /// /// /// - /// Id of the job. + /// Id of the job. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual async Task ReclassifyJobAsync(string id, RequestContent content, RequestContext context = null) + internal virtual async Task ReclassifyJobAsync(string jobId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.ReclassifyJob"); scope.Start(); try { - using HttpMessage message = CreateReclassifyJobRequest(id, content, context); + using HttpMessage message = CreateReclassifyJobRequest(jobId, content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -401,22 +379,22 @@ internal virtual async Task ReclassifyJobAsync(string id, RequestConte /// /// /// - /// Id of the job. + /// Id of the job. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - internal virtual Response ReclassifyJob(string id, RequestContent content, RequestContext context = null) + internal virtual Response ReclassifyJob(string jobId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.ReclassifyJob"); scope.Start(); try { - using HttpMessage message = CreateReclassifyJobRequest(id, content, context); + using HttpMessage message = CreateReclassifyJobRequest(jobId, content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -430,19 +408,19 @@ internal virtual Response ReclassifyJob(string id, RequestContent content, Reque /// Submits request to cancel an existing job by Id while supplying free-form /// cancellation reason. /// - /// Id of the job. - /// Request model for cancelling job. + /// Id of the job. + /// Request model for cancelling job. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task CancelJobAsync(string id, CancelJobRequest cancelJobRequest = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CancelJobAsync(string jobId, CancelJobOptions options = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = cancelJobRequest?.ToRequestContent(); - Response response = await CancelJobAsync(id, content, context).ConfigureAwait(false); + using RequestContent content = options?.ToRequestContent(); + Response response = await CancelJobAsync(jobId, content, context).ConfigureAwait(false); return response; } @@ -450,19 +428,19 @@ public virtual async Task CancelJobAsync(string id, CancelJobRequest c /// Submits request to cancel an existing job by Id while supplying free-form /// cancellation reason. /// - /// Id of the job. - /// Request model for cancelling job. + /// Id of the job. + /// Request model for cancelling job. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response CancelJob(string id, CancelJobRequest cancelJobRequest = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CancelJob(string jobId, CancelJobOptions options = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = cancelJobRequest?.ToRequestContent(); - Response response = CancelJob(id, content, context); + using RequestContent content = options?.ToRequestContent(); + Response response = CancelJob(jobId, content, context); return response; } @@ -477,28 +455,28 @@ public virtual Response CancelJob(string id, CancelJobRequest cancelJobRequest = /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// Id of the job. + /// Id of the job. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task CancelJobAsync(string id, RequestContent content, RequestContext context = null) + public virtual async Task CancelJobAsync(string jobId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CancelJob"); scope.Start(); try { - using HttpMessage message = CreateCancelJobRequest(id, content, context); + using HttpMessage message = CreateCancelJobRequest(jobId, content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -519,28 +497,28 @@ public virtual async Task CancelJobAsync(string id, RequestContent con /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// Id of the job. + /// Id of the job. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response CancelJob(string id, RequestContent content, RequestContext context = null) + public virtual Response CancelJob(string jobId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CancelJob"); scope.Start(); try { - using HttpMessage message = CreateCancelJobRequest(id, content, context); + using HttpMessage message = CreateCancelJobRequest(jobId, content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -551,38 +529,38 @@ public virtual Response CancelJob(string id, RequestContent content, RequestCont } /// Completes an assigned job. - /// Id of the job. - /// Request model for completing job. + /// Id of the job. + /// Request model for completing job. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task CompleteJobAsync(string id, CompleteJobRequest completeJobRequest, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CompleteJobAsync(string jobId, CompleteJobOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(completeJobRequest, nameof(completeJobRequest)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = completeJobRequest.ToRequestContent(); - Response response = await CompleteJobAsync(id, content, context).ConfigureAwait(false); + using RequestContent content = options.ToRequestContent(); + Response response = await CompleteJobAsync(jobId, content, context).ConfigureAwait(false); return response; } /// Completes an assigned job. - /// Id of the job. - /// Request model for completing job. + /// Id of the job. + /// Request model for completing job. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response CompleteJob(string id, CompleteJobRequest completeJobRequest, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CompleteJob(string jobId, CompleteJobOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(completeJobRequest, nameof(completeJobRequest)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = completeJobRequest.ToRequestContent(); - Response response = CompleteJob(id, content, context); + using RequestContent content = options.ToRequestContent(); + Response response = CompleteJob(jobId, content, context); return response; } @@ -596,29 +574,29 @@ public virtual Response CompleteJob(string id, CompleteJobRequest completeJobReq /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// Id of the job. + /// Id of the job. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task CompleteJobAsync(string id, RequestContent content, RequestContext context = null) + public virtual async Task CompleteJobAsync(string jobId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); Argument.AssertNotNull(content, nameof(content)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CompleteJob"); scope.Start(); try { - using HttpMessage message = CreateCompleteJobRequest(id, content, context); + using HttpMessage message = CreateCompleteJobRequest(jobId, content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -638,29 +616,29 @@ public virtual async Task CompleteJobAsync(string id, RequestContent c /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// Id of the job. + /// Id of the job. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response CompleteJob(string id, RequestContent content, RequestContext context = null) + public virtual Response CompleteJob(string jobId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); Argument.AssertNotNull(content, nameof(content)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CompleteJob"); scope.Start(); try { - using HttpMessage message = CreateCompleteJobRequest(id, content, context); + using HttpMessage message = CreateCompleteJobRequest(jobId, content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -671,38 +649,38 @@ public virtual Response CompleteJob(string id, RequestContent content, RequestCo } /// Closes a completed job. - /// Id of the job. - /// Request model for closing job. + /// Id of the job. + /// Request model for closing job. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task CloseJobAsync(string id, CloseJobRequest closeJobRequest, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CloseJobAsync(string jobId, CloseJobOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(closeJobRequest, nameof(closeJobRequest)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = closeJobRequest.ToRequestContent(); - Response response = await CloseJobAsync(id, content, context).ConfigureAwait(false); + using RequestContent content = options.ToRequestContent(); + Response response = await CloseJobAsync(jobId, content, context).ConfigureAwait(false); return response; } /// Closes a completed job. - /// Id of the job. - /// Request model for closing job. + /// Id of the job. + /// Request model for closing job. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response CloseJob(string id, CloseJobRequest closeJobRequest, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CloseJob(string jobId, CloseJobOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(closeJobRequest, nameof(closeJobRequest)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNull(options, nameof(options)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = closeJobRequest.ToRequestContent(); - Response response = CloseJob(id, content, context); + using RequestContent content = options.ToRequestContent(); + Response response = CloseJob(jobId, content, context); return response; } @@ -716,29 +694,29 @@ public virtual Response CloseJob(string id, CloseJobRequest closeJobRequest, Can /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// Id of the job. + /// Id of the job. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task CloseJobAsync(string id, RequestContent content, RequestContext context = null) + public virtual async Task CloseJobAsync(string jobId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); Argument.AssertNotNull(content, nameof(content)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CloseJob"); scope.Start(); try { - using HttpMessage message = CreateCloseJobRequest(id, content, context); + using HttpMessage message = CreateCloseJobRequest(jobId, content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -758,29 +736,29 @@ public virtual async Task CloseJobAsync(string id, RequestContent cont /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// Id of the job. + /// Id of the job. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response CloseJob(string id, RequestContent content, RequestContext context = null) + public virtual Response CloseJob(string jobId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); Argument.AssertNotNull(content, nameof(content)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CloseJob"); scope.Start(); try { - using HttpMessage message = CreateCloseJobRequest(id, content, context); + using HttpMessage message = CreateCloseJobRequest(jobId, content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -791,32 +769,32 @@ public virtual Response CloseJob(string id, RequestContent content, RequestConte } /// Gets a job's position details. - /// Id of the job. + /// Id of the job. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual async Task> GetQueuePositionAsync(string id, CancellationToken cancellationToken = default) + public virtual async Task> GetQueuePositionAsync(string jobId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetQueuePositionAsync(id, context).ConfigureAwait(false); + Response response = await GetQueuePositionAsync(jobId, context).ConfigureAwait(false); return Response.FromValue(RouterJobPositionDetails.FromResponse(response), response); } /// Gets a job's position details. - /// Id of the job. + /// Id of the job. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual Response GetQueuePosition(string id, CancellationToken cancellationToken = default) + public virtual Response GetQueuePosition(string jobId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetQueuePosition(id, context); + Response response = GetQueuePosition(jobId, context); return Response.FromValue(RouterJobPositionDetails.FromResponse(response), response); } @@ -835,22 +813,22 @@ public virtual Response GetQueuePosition(string id, Ca /// /// /// - /// Id of the job. + /// Id of the job. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetQueuePositionAsync(string id, RequestContext context) + public virtual async Task GetQueuePositionAsync(string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetQueuePosition"); scope.Start(); try { - using HttpMessage message = CreateGetQueuePositionRequest(id, context); + using HttpMessage message = CreateGetQueuePositionRequest(jobId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -875,22 +853,22 @@ public virtual async Task GetQueuePositionAsync(string id, RequestCont /// /// /// - /// Id of the job. + /// Id of the job. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response GetQueuePosition(string id, RequestContext context) + public virtual Response GetQueuePosition(string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetQueuePosition"); scope.Start(); try { - using HttpMessage message = CreateGetQueuePositionRequest(id, context); + using HttpMessage message = CreateGetQueuePositionRequest(jobId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -900,6 +878,44 @@ public virtual Response GetQueuePosition(string id, RequestContext context) } } + /// Un-assign a job. + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// Request body for unassign route. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> UnassignJobAsync(string jobId, string assignmentId, UnassignJobOptions options = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = options?.ToRequestContent(); + Response response = await UnassignJobAsync(jobId, assignmentId, content, context).ConfigureAwait(false); + return Response.FromValue(UnassignJobResult.FromResponse(response), response); + } + + /// Un-assign a job. + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// Request body for unassign route. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response UnassignJob(string jobId, string assignmentId, UnassignJobOptions options = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = options?.ToRequestContent(); + Response response = UnassignJob(jobId, assignmentId, content, context); + return Response.FromValue(UnassignJobResult.FromResponse(response), response); + } + /// /// [Protocol Method] Un-assign a job. /// @@ -910,30 +926,30 @@ public virtual Response GetQueuePosition(string id, RequestContext context) /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// Id of the job to un-assign. + /// Id of the job to un-assign. /// Id of the assignment to un-assign. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task UnassignJobAsync(string id, string assignmentId, RequestContent content, RequestContext context = null) + public virtual async Task UnassignJobAsync(string jobId, string assignmentId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.UnassignJob"); scope.Start(); try { - using HttpMessage message = CreateUnassignJobRequest(id, assignmentId, content, context); + using HttpMessage message = CreateUnassignJobRequest(jobId, assignmentId, content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -953,30 +969,30 @@ public virtual async Task UnassignJobAsync(string id, string assignmen /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// Id of the job to un-assign. + /// Id of the job to un-assign. /// Id of the assignment to un-assign. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response UnassignJob(string id, string assignmentId, RequestContent content, RequestContext context = null) + public virtual Response UnassignJob(string jobId, string assignmentId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.UnassignJob"); scope.Start(); try { - using HttpMessage message = CreateUnassignJobRequest(id, assignmentId, content, context); + using HttpMessage message = CreateUnassignJobRequest(jobId, assignmentId, content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1115,18 +1131,18 @@ public virtual Response AcceptJobOffer(string workerId, string offerId, RequestC /// Declines an offer to work on a job. /// Id of the worker. /// Id of the offer. - /// Request model for declining offer. + /// Request model for declining offer. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. - /// - public virtual async Task DeclineJobOfferAsync(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest = null, CancellationToken cancellationToken = default) + /// + public virtual async Task DeclineJobOfferAsync(string workerId, string offerId, DeclineJobOfferOptions options = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = declineJobOfferRequest?.ToRequestContent(); + using RequestContent content = options?.ToRequestContent(); Response response = await DeclineJobOfferAsync(workerId, offerId, content, context).ConfigureAwait(false); return response; } @@ -1134,18 +1150,18 @@ public virtual async Task DeclineJobOfferAsync(string workerId, string /// Declines an offer to work on a job. /// Id of the worker. /// Id of the offer. - /// Request model for declining offer. + /// Request model for declining offer. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. - /// - public virtual Response DeclineJobOffer(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest = null, CancellationToken cancellationToken = default) + /// + public virtual Response DeclineJobOffer(string workerId, string offerId, DeclineJobOfferOptions options = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = declineJobOfferRequest?.ToRequestContent(); + using RequestContent content = options?.ToRequestContent(); Response response = DeclineJobOffer(workerId, offerId, content, context); return response; } @@ -1160,7 +1176,7 @@ public virtual Response DeclineJobOffer(string workerId, string offerId, Decline /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -1203,7 +1219,7 @@ public virtual async Task DeclineJobOfferAsync(string workerId, string /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -1237,32 +1253,32 @@ public virtual Response DeclineJobOffer(string workerId, string offerId, Request } /// Retrieves a queue's statistics. - /// Id of the queue to retrieve statistics. + /// Id of the queue to retrieve statistics. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual async Task> GetQueueStatisticsAsync(string id, CancellationToken cancellationToken = default) + public virtual async Task> GetQueueStatisticsAsync(string queueId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetQueueStatisticsAsync(id, context).ConfigureAwait(false); + Response response = await GetQueueStatisticsAsync(queueId, context).ConfigureAwait(false); return Response.FromValue(RouterQueueStatistics.FromResponse(response), response); } /// Retrieves a queue's statistics. - /// Id of the queue to retrieve statistics. + /// Id of the queue to retrieve statistics. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// - public virtual Response GetQueueStatistics(string id, CancellationToken cancellationToken = default) + public virtual Response GetQueueStatistics(string queueId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetQueueStatistics(id, context); + Response response = GetQueueStatistics(queueId, context); return Response.FromValue(RouterQueueStatistics.FromResponse(response), response); } @@ -1281,22 +1297,22 @@ public virtual Response GetQueueStatistics(string id, Can /// /// /// - /// Id of the queue to retrieve statistics. + /// Id of the queue to retrieve statistics. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetQueueStatisticsAsync(string id, RequestContext context) + public virtual async Task GetQueueStatisticsAsync(string queueId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetQueueStatistics"); scope.Start(); try { - using HttpMessage message = CreateGetQueueStatisticsRequest(id, context); + using HttpMessage message = CreateGetQueueStatisticsRequest(queueId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1321,22 +1337,22 @@ public virtual async Task GetQueueStatisticsAsync(string id, RequestCo /// /// /// - /// Id of the queue to retrieve statistics. + /// Id of the queue to retrieve statistics. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response GetQueueStatistics(string id, RequestContext context) + public virtual Response GetQueueStatistics(string queueId, RequestContext context) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetQueueStatistics"); scope.Start(); try { - using HttpMessage message = CreateGetQueueStatisticsRequest(id, context); + using HttpMessage message = CreateGetQueueStatisticsRequest(queueId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1624,12 +1640,12 @@ public virtual Response DeleteWorker(string workerId, RequestContext context = n /// /// The cancellation token to use. /// - public virtual AsyncPageable GetJobsAsync(int? maxpagesize = null, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetJobsAsync(int? maxpagesize = null, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(maxpagesize, status?.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, maxpagesize, status?.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterJobItem.DeserializeRouterJobItem, ClientDiagnostics, _pipeline, "JobRouterClient.GetJobs", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterJob.DeserializeRouterJob, ClientDiagnostics, _pipeline, "JobRouterClient.GetJobs", "value", "nextLink", context); } /// Retrieves list of jobs based on filter parameters. @@ -1648,12 +1664,12 @@ public virtual AsyncPageable GetJobsAsync(int? maxpagesize = null /// /// The cancellation token to use. /// - public virtual Pageable GetJobs(int? maxpagesize = null, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, CancellationToken cancellationToken = default) + public virtual Pageable GetJobs(int? maxpagesize = null, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(maxpagesize, status?.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, maxpagesize, status?.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterJobItem.DeserializeRouterJobItem, ClientDiagnostics, _pipeline, "JobRouterClient.GetJobs", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterJob.DeserializeRouterJob, ClientDiagnostics, _pipeline, "JobRouterClient.GetJobs", "value", "nextLink", context); } /// @@ -1747,12 +1763,12 @@ public virtual Pageable GetJobs(int? maxpagesize, string status, str /// /// The cancellation token to use. /// - public virtual AsyncPageable GetWorkersAsync(int? maxpagesize = null, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetWorkersAsync(int? maxpagesize = null, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(maxpagesize, state?.ToString(), channelId, queueId, hasCapacity, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, maxpagesize, state?.ToString(), channelId, queueId, hasCapacity, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterWorkerItem.DeserializeRouterWorkerItem, ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterWorker.DeserializeRouterWorker, ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); } /// Retrieves existing workers. @@ -1768,12 +1784,12 @@ public virtual AsyncPageable GetWorkersAsync(int? maxpagesize /// /// The cancellation token to use. /// - public virtual Pageable GetWorkers(int? maxpagesize = null, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, CancellationToken cancellationToken = default) + public virtual Pageable GetWorkers(int? maxpagesize = null, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(maxpagesize, state?.ToString(), channelId, queueId, hasCapacity, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, maxpagesize, state?.ToString(), channelId, queueId, hasCapacity, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterWorkerItem.DeserializeRouterWorkerItem, ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterWorker.DeserializeRouterWorker, ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); } /// @@ -1848,7 +1864,7 @@ public virtual Pageable GetWorkers(int? maxpagesize, string state, s return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); } - internal HttpMessage CreateUpsertJobRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context) + internal HttpMessage CreateUpsertJobRequest(string jobId, RequestContent content, RequestConditions requestConditions, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; @@ -1856,7 +1872,7 @@ internal HttpMessage CreateUpsertJobRequest(string id, RequestContent content, R var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1869,7 +1885,7 @@ internal HttpMessage CreateUpsertJobRequest(string id, RequestContent content, R return message; } - internal HttpMessage CreateGetJobRequest(string id, RequestContext context) + internal HttpMessage CreateGetJobRequest(string jobId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1877,14 +1893,14 @@ internal HttpMessage CreateGetJobRequest(string id, RequestContext context) var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateDeleteJobRequest(string id, RequestContext context) + internal HttpMessage CreateDeleteJobRequest(string jobId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; @@ -1892,14 +1908,14 @@ internal HttpMessage CreateDeleteJobRequest(string id, RequestContext context) var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateReclassifyJobRequest(string id, RequestContent content, RequestContext context) + internal HttpMessage CreateReclassifyJobRequest(string jobId, RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1907,7 +1923,7 @@ internal HttpMessage CreateReclassifyJobRequest(string id, RequestContent conten var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendPath(":reclassify", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -1917,7 +1933,7 @@ internal HttpMessage CreateReclassifyJobRequest(string id, RequestContent conten return message; } - internal HttpMessage CreateCancelJobRequest(string id, RequestContent content, RequestContext context) + internal HttpMessage CreateCancelJobRequest(string jobId, RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1925,7 +1941,7 @@ internal HttpMessage CreateCancelJobRequest(string id, RequestContent content, R var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendPath(":cancel", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -1935,7 +1951,7 @@ internal HttpMessage CreateCancelJobRequest(string id, RequestContent content, R return message; } - internal HttpMessage CreateCompleteJobRequest(string id, RequestContent content, RequestContext context) + internal HttpMessage CreateCompleteJobRequest(string jobId, RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1943,7 +1959,7 @@ internal HttpMessage CreateCompleteJobRequest(string id, RequestContent content, var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendPath(":complete", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -1953,7 +1969,7 @@ internal HttpMessage CreateCompleteJobRequest(string id, RequestContent content, return message; } - internal HttpMessage CreateCloseJobRequest(string id, RequestContent content, RequestContext context) + internal HttpMessage CreateCloseJobRequest(string jobId, RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200202); var request = message.Request; @@ -1961,7 +1977,7 @@ internal HttpMessage CreateCloseJobRequest(string id, RequestContent content, Re var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendPath(":close", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -2013,7 +2029,7 @@ internal HttpMessage CreateGetJobsRequest(int? maxpagesize, string status, strin return message; } - internal HttpMessage CreateGetQueuePositionRequest(string id, RequestContext context) + internal HttpMessage CreateGetQueuePositionRequest(string jobId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -2021,7 +2037,7 @@ internal HttpMessage CreateGetQueuePositionRequest(string id, RequestContext con var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendPath("/position", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -2029,7 +2045,7 @@ internal HttpMessage CreateGetQueuePositionRequest(string id, RequestContext con return message; } - internal HttpMessage CreateUnassignJobRequest(string id, string assignmentId, RequestContent content, RequestContext context) + internal HttpMessage CreateUnassignJobRequest(string jobId, string assignmentId, RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -2037,7 +2053,7 @@ internal HttpMessage CreateUnassignJobRequest(string id, string assignmentId, Re var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/jobs/", false); - uri.AppendPath(id, true); + uri.AppendPath(jobId, true); uri.AppendPath("/assignments/", false); uri.AppendPath(assignmentId, true); uri.AppendPath(":unassign", false); @@ -2087,7 +2103,7 @@ internal HttpMessage CreateDeclineJobOfferRequest(string workerId, string offerI return message; } - internal HttpMessage CreateGetQueueStatisticsRequest(string id, RequestContext context) + internal HttpMessage CreateGetQueueStatisticsRequest(string queueId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -2095,7 +2111,7 @@ internal HttpMessage CreateGetQueueStatisticsRequest(string id, RequestContext c var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/routing/queues/", false); - uri.AppendPath(id, true); + uri.AppendPath(queueId, true); uri.AppendPath("/statistics", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClientBuilderExtensions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClientBuilderExtensions.cs new file mode 100644 index 0000000000000..094d75bac525d --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClientBuilderExtensions.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core.Extensions; + +namespace Azure.Communication.JobRouter +{ + /// Extension methods to add , to client builder. + internal static partial class JobRouterClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// The Uri to use. + public static IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new JobRouterAdministrationClient(endpoint, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The Uri to use. + public static IAzureClientBuilder AddJobRouterClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new JobRouterClient(endpoint, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddJobRouterClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterModelFactory.cs new file mode 100644 index 0000000000000..d85c91dc5da76 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterModelFactory.cs @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Communication.JobRouter +{ + /// Model factory for models. + public static partial class JobRouterModelFactory + { + /// Initializes a new instance of ExpressionRouterRule. + /// The expression language to compile to and execute. + /// + /// The string containing the expression to evaluate. Should contain return + /// statement with calculated values. + /// + /// A new instance for mocking. + public static ExpressionRouterRule ExpressionRouterRule(string language = null, string expression = null) + { + return new ExpressionRouterRule("expression-rule", language, expression); + } + + /// Initializes a new instance of FunctionRouterRule. + /// URL for Azure Function. + /// Credentials used to access Azure function rule. + /// A new instance for mocking. + public static FunctionRouterRule FunctionRouterRule(Uri functionUri = null, FunctionRouterRuleCredential credential = null) + { + return new FunctionRouterRule("azure-function-rule", functionUri, credential); + } + + /// Initializes a new instance of WebhookRouterRule. + /// Uri for Authorization Server. + /// + /// OAuth2.0 Credentials used to Contoso's Authorization server. + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// + /// Uri for Contoso's Web Server. + /// A new instance for mocking. + public static WebhookRouterRule WebhookRouterRule(Uri authorizationServerUri = null, OAuth2WebhookClientCredential clientCredential = null, Uri webhookUri = null) + { + return new WebhookRouterRule("webhook-rule", authorizationServerUri, clientCredential, webhookUri); + } + + /// Initializes a new instance of ConditionalQueueSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The queue selectors to attach. + /// A new instance for mocking. + public static ConditionalQueueSelectorAttachment ConditionalQueueSelectorAttachment(RouterRule condition = null, IEnumerable queueSelectors = null) + { + queueSelectors ??= new List(); + + return new ConditionalQueueSelectorAttachment("conditional", condition, queueSelectors?.ToList()); + } + + /// Initializes a new instance of PassThroughQueueSelectorAttachment. + /// The label key to query against. + /// Describes how the value of the label is compared to the value pass through. + /// A new instance for mocking. + public static PassThroughQueueSelectorAttachment PassThroughQueueSelectorAttachment(string key = null, LabelOperator labelOperator = default) + { + return new PassThroughQueueSelectorAttachment("pass-through", key, labelOperator); + } + + /// Initializes a new instance of RuleEngineQueueSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// A new instance for mocking. + public static RuleEngineQueueSelectorAttachment RuleEngineQueueSelectorAttachment(RouterRule rule = null) + { + return new RuleEngineQueueSelectorAttachment("rule-engine", rule); + } + + /// Initializes a new instance of StaticQueueSelectorAttachment. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// + /// A new instance for mocking. + public static StaticQueueSelectorAttachment StaticQueueSelectorAttachment(RouterQueueSelector queueSelector = null) + { + return new StaticQueueSelectorAttachment("static", queueSelector); + } + + /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. + /// A collection of percentage based weighted allocations. + /// A new instance for mocking. + public static WeightedAllocationQueueSelectorAttachment WeightedAllocationQueueSelectorAttachment(IEnumerable allocations = null) + { + allocations ??= new List(); + + return new WeightedAllocationQueueSelectorAttachment("weighted-allocation-queue-selector", allocations?.ToList()); + } + + /// Initializes a new instance of QueueWeightedAllocation. + /// The percentage of this weight, expressed as a fraction of 1. + /// + /// A collection of queue selectors that will be applied if this allocation is + /// selected. + /// + /// A new instance for mocking. + public static QueueWeightedAllocation QueueWeightedAllocation(double weight = default, IEnumerable queueSelectors = null) + { + queueSelectors ??= new List(); + + return new QueueWeightedAllocation(weight, queueSelectors?.ToList()); + } + + /// Initializes a new instance of ConditionalWorkerSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// The worker selectors to attach. + /// A new instance for mocking. + public static ConditionalWorkerSelectorAttachment ConditionalWorkerSelectorAttachment(RouterRule condition = null, IEnumerable workerSelectors = null) + { + workerSelectors ??= new List(); + + return new ConditionalWorkerSelectorAttachment("conditional", condition, workerSelectors?.ToList()); + } + + /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// A new instance for mocking. + public static RuleEngineWorkerSelectorAttachment RuleEngineWorkerSelectorAttachment(RouterRule rule = null) + { + return new RuleEngineWorkerSelectorAttachment("rule-engine", rule); + } + + /// Initializes a new instance of StaticWorkerSelectorAttachment. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// + /// A new instance for mocking. + public static StaticWorkerSelectorAttachment StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector = null) + { + return new StaticWorkerSelectorAttachment("static", workerSelector); + } + + /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. + /// A collection of percentage based weighted allocations. + /// A new instance for mocking. + public static WeightedAllocationWorkerSelectorAttachment WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations = null) + { + allocations ??= new List(); + + return new WeightedAllocationWorkerSelectorAttachment("weighted-allocation-worker-selector", allocations?.ToList()); + } + + /// Initializes a new instance of WorkerWeightedAllocation. + /// The percentage of this weight, expressed as a fraction of 1. + /// + /// A collection of worker selectors that will be applied if this allocation is + /// selected. + /// + /// A new instance for mocking. + public static WorkerWeightedAllocation WorkerWeightedAllocation(double weight = default, IEnumerable workerSelectors = null) + { + workerSelectors ??= new List(); + + return new WorkerWeightedAllocation(weight, workerSelectors?.ToList()); + } + + /// Initializes a new instance of ExceptionRule. + /// Id of the exception rule. + /// The trigger for this exception rule. + /// A collection of actions to perform once the exception is triggered. + /// A new instance for mocking. + public static ExceptionRule ExceptionRule(string id = null, ExceptionTrigger trigger = null, IEnumerable actions = null) + { + actions ??= new List(); + + return new ExceptionRule(id, trigger, actions?.ToList()); + } + + /// Initializes a new instance of QueueLengthExceptionTrigger. + /// Threshold of number of jobs ahead in the queue to for this trigger to fire. + /// A new instance for mocking. + public static QueueLengthExceptionTrigger QueueLengthExceptionTrigger(int threshold = default) + { + return new QueueLengthExceptionTrigger("queue-length", threshold); + } + + /// Initializes a new instance of ExceptionAction. + /// Unique Id of the exception action. + /// The type discriminator describing a sub-type of ExceptionAction. + /// A new instance for mocking. + public static ExceptionAction ExceptionAction(string id = null, string kind = null) + { + return new UnknownExceptionAction(id, kind); + } + + /// Initializes a new instance of CancelExceptionAction. + /// Unique Id of the exception action. + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + /// + /// (Optional) Indicates the outcome of the job, populate this field with your own + /// custom values. + /// + /// A new instance for mocking. + public static CancelExceptionAction CancelExceptionAction(string id = null, string note = null, string dispositionCode = null) + { + return new CancelExceptionAction(id, "cancel", note, dispositionCode); + } + + /// Initializes a new instance of ManualReclassifyExceptionAction. + /// Unique Id of the exception action. + /// Updated QueueId. + /// Updated Priority. + /// Updated WorkerSelectors. + /// A new instance for mocking. + public static ManualReclassifyExceptionAction ManualReclassifyExceptionAction(string id = null, string queueId = null, int? priority = null, IEnumerable workerSelectors = null) + { + workerSelectors ??= new List(); + + return new ManualReclassifyExceptionAction(id, "manual-reclassify", queueId, priority, workerSelectors?.ToList()); + } + + /// Initializes a new instance of RouterJobAssignment. + /// The Id of the job assignment. + /// The Id of the Worker assigned to the job. + /// The assignment time of the job in UTC. + /// The time the job was marked as completed after being assigned in UTC. + /// The time the job was marked as closed after being completed in UTC. + /// A new instance for mocking. + public static RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, DateTimeOffset assignedAt = default, DateTimeOffset? completedAt = null, DateTimeOffset? closedAt = null) + { + return new RouterJobAssignment(assignmentId, workerId, assignedAt, completedAt, closedAt); + } + + /// Initializes a new instance of RouterJobNote. + /// The message contained in the note. + /// The time at which the note was added in UTC. If not provided, will default to the current time. + /// A new instance for mocking. + public static RouterJobNote RouterJobNote(string message = null, DateTimeOffset? addedAt = null) + { + return new RouterJobNote(message, addedAt); + } + + /// Initializes a new instance of ScheduleAndSuspendMode. + /// Scheduled time. + /// A new instance for mocking. + public static ScheduleAndSuspendMode ScheduleAndSuspendMode(DateTimeOffset scheduleAt = default) + { + return new ScheduleAndSuspendMode("schedule-and-suspend", scheduleAt); + } + + /// Initializes a new instance of UnassignJobResult. + /// The Id of the job unassigned. + /// The number of times a job is unassigned. At a maximum 3. + /// is null. + /// A new instance for mocking. + public static UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = default) + { + if (jobId == null) + { + throw new ArgumentNullException(nameof(jobId)); + } + + return new UnassignJobResult(jobId, unassignmentCount); + } + + /// Initializes a new instance of AcceptJobOfferResult. + /// The assignment Id that assigns a worker that has accepted an offer to a job. + /// The Id of the job assigned. + /// The Id of the worker that has been assigned this job. + /// , or is null. + /// A new instance for mocking. + public static AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) + { + if (assignmentId == null) + { + throw new ArgumentNullException(nameof(assignmentId)); + } + if (jobId == null) + { + throw new ArgumentNullException(nameof(jobId)); + } + if (workerId == null) + { + throw new ArgumentNullException(nameof(workerId)); + } + + return new AcceptJobOfferResult(assignmentId, jobId, workerId); + } + + /// Initializes a new instance of RouterChannel. + /// Id of the channel. + /// + /// The amount of capacity that an instance of a job of this channel will consume + /// of the total worker capacity. + /// + /// The maximum number of jobs that can be supported concurrently for this channel. + /// A new instance for mocking. + public static RouterChannel RouterChannel(string channelId = null, int capacityCostPerJob = default, int? maxNumberOfJobs = null) + { + return new RouterChannel(channelId, capacityCostPerJob, maxNumberOfJobs); + } + + /// Initializes a new instance of RouterJobOffer. + /// The Id of the offer. + /// The Id of the job. + /// The capacity cost consumed by the job offer. + /// The time the offer was created in UTC. + /// The time that the offer will expire in UTC. + /// A new instance for mocking. + public static RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = default, DateTimeOffset? offeredAt = null, DateTimeOffset? expiresAt = null) + { + return new RouterJobOffer(offerId, jobId, capacityCost, offeredAt, expiresAt); + } + + /// Initializes a new instance of RouterWorkerAssignment. + /// The Id of the assignment. + /// The Id of the Job assigned. + /// The amount of capacity this assignment has consumed on the worker. + /// The assignment time of the job in UTC. + /// or is null. + /// A new instance for mocking. + public static RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = default, DateTimeOffset assignedAt = default) + { + if (assignmentId == null) + { + throw new ArgumentNullException(nameof(assignmentId)); + } + if (jobId == null) + { + throw new ArgumentNullException(nameof(jobId)); + } + + return new RouterWorkerAssignment(assignmentId, jobId, capacityCost, assignedAt); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs index 37821aec00066..a71a7b0057c78 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs @@ -25,9 +25,9 @@ public LabelOperator(string value) private const string EqualValue = "equal"; private const string NotEqualValue = "notEqual"; private const string LessThanValue = "lessThan"; - private const string LessThanEqualValue = "lessThanEqual"; + private const string LessThanOrEqualValue = "lessThanOrEqual"; private const string GreaterThanValue = "greaterThan"; - private const string GreaterThanEqualValue = "greaterThanEqual"; + private const string GreaterThanOrEqualValue = "greaterThanOrEqual"; /// Equal. public static LabelOperator Equal { get; } = new LabelOperator(EqualValue); @@ -36,11 +36,11 @@ public LabelOperator(string value) /// Less than. public static LabelOperator LessThan { get; } = new LabelOperator(LessThanValue); /// Less than or equal. - public static LabelOperator LessThanEqual { get; } = new LabelOperator(LessThanEqualValue); + public static LabelOperator LessThanOrEqual { get; } = new LabelOperator(LessThanOrEqualValue); /// Greater than. public static LabelOperator GreaterThan { get; } = new LabelOperator(GreaterThanValue); /// Greater than or equal. - public static LabelOperator GreaterThanEqual { get; } = new LabelOperator(GreaterThanEqualValue); + public static LabelOperator GreaterThanOrEqual { get; } = new LabelOperator(GreaterThanOrEqualValue); /// Determines if two values are the same. public static bool operator ==(LabelOperator left, LabelOperator right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs index bbf151268ae42..239f392212812 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs @@ -19,17 +19,12 @@ internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element) { return null; } - string kind = default; Optional minConcurrentOffers = default; Optional maxConcurrentOffers = default; Optional bypassSelectors = default; + string kind = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); - continue; - } if (property.NameEquals("minConcurrentOffers"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -57,8 +52,13 @@ internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element) bypassSelectors = property.Value.GetBoolean(); continue; } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } } - return new LongestIdleMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); + return new LongestIdleMode(minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), kind); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs index 3ec5c0b8ae0cf..d520ee05d77b8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs @@ -11,7 +11,6 @@ namespace Azure.Communication.JobRouter public partial class LongestIdleMode : DistributionMode { /// Initializes a new instance of LongestIdleMode. - /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// @@ -24,7 +23,8 @@ public partial class LongestIdleMode : DistributionMode /// This flag is intended more for temporary usage. /// By default, set to false. /// - internal LongestIdleMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + /// The type discriminator describing a sub-type of DistributionMode. + internal LongestIdleMode(int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, string kind) : base(minConcurrentOffers, maxConcurrentOffers, bypassSelectors, kind) { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs index 7565c4c96130c..224808f2c231c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs @@ -22,7 +22,8 @@ internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExcep } Optional queueId = default; Optional priority = default; - Optional> workerSelectors = default; + Optional> workerSelectors = default; + Optional id = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -54,13 +55,18 @@ internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExcep workerSelectors = array; continue; } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("kind"u8)) { kind = property.Value.GetString(); continue; } } - return new ManualReclassifyExceptionAction(kind, queueId.Value, Optional.ToNullable(priority), Optional.ToList(workerSelectors)); + return new ManualReclassifyExceptionAction(id.Value, kind, queueId.Value, Optional.ToNullable(priority), Optional.ToList(workerSelectors)); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs index c6a6a5b911d67..4428e5526dabe 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs @@ -17,15 +17,16 @@ namespace Azure.Communication.JobRouter public partial class ManualReclassifyExceptionAction : ExceptionAction { /// Initializes a new instance of ManualReclassifyExceptionAction. - /// Discriminator. + /// Unique Id of the exception action. + /// The type discriminator describing a sub-type of ExceptionAction. /// Updated QueueId. /// Updated Priority. /// Updated WorkerSelectors. - internal ManualReclassifyExceptionAction(string kind, string queueId, int? priority, IReadOnlyList workerSelectors) : base(kind) + internal ManualReclassifyExceptionAction(string id, string kind, string queueId, int? priority, IList workerSelectors) : base(id, kind) { QueueId = queueId; Priority = priority; - _workerSelectors = workerSelectors; + WorkerSelectors = workerSelectors; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/OAuth2WebhookClientCredential.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/OAuth2WebhookClientCredential.Serialization.cs new file mode 100644 index 0000000000000..543f53332505e --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/OAuth2WebhookClientCredential.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class OAuth2WebhookClientCredential + { + internal static OAuth2WebhookClientCredential DeserializeOAuth2WebhookClientCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clientId = default; + Optional clientSecret = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientSecret"u8)) + { + clientSecret = property.Value.GetString(); + continue; + } + } + return new OAuth2WebhookClientCredential(clientId.Value, clientSecret.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OAuth2WebhookClientCredential FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOAuth2WebhookClientCredential(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/OAuth2WebhookClientCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/OAuth2WebhookClientCredential.cs new file mode 100644 index 0000000000000..fabc8ff182714 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/OAuth2WebhookClientCredential.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// + /// OAuth2.0 Credentials used to Contoso's Authorization server. + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// + public partial class OAuth2WebhookClientCredential + { + /// Initializes a new instance of OAuth2WebhookClientCredential. + internal OAuth2WebhookClientCredential() + { + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs deleted file mode 100644 index dd0c64fee6a3b..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - public partial class Oauth2ClientCredential - { - internal static Oauth2ClientCredential DeserializeOauth2ClientCredential(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional clientId = default; - Optional clientSecret = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("clientId"u8)) - { - clientId = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientSecret"u8)) - { - clientSecret = property.Value.GetString(); - continue; - } - } - return new Oauth2ClientCredential(clientId.Value, clientSecret.Value); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static Oauth2ClientCredential FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeOauth2ClientCredential(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs deleted file mode 100644 index 6f5dac058549e..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// - /// OAuth2.0 Credentials used to Contoso's Authorization server. - /// Reference: - /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ - /// - public partial class Oauth2ClientCredential - { - /// Initializes a new instance of Oauth2ClientCredential. - internal Oauth2ClientCredential() - { - } - - /// Initializes a new instance of Oauth2ClientCredential. - /// ClientId for Contoso Authorization server. - /// Client secret for Contoso Authorization server. - internal Oauth2ClientCredential(string clientId, string clientSecret) - { - ClientId = clientId; - ClientSecret = clientSecret; - } - - /// ClientId for Contoso Authorization server. - public string ClientId { get; } - /// Client secret for Contoso Authorization server. - public string ClientSecret { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs index 9bfa2074a6087..0764c22d71a8b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs @@ -17,7 +17,7 @@ namespace Azure.Communication.JobRouter public partial class PassThroughQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of PassThroughQueueSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of QueueSelectorAttachment. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. internal PassThroughQueueSelectorAttachment(string kind, string key, LabelOperator labelOperator) : base(kind) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs index 1119e4a585a99..35b034cc3b4ed 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs @@ -30,7 +30,7 @@ internal PassThroughWorkerSelectorAttachment(string key, LabelOperator labelOper } /// Initializes a new instance of PassThroughWorkerSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of WorkerSelectorAttachment. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// Describes how long the attached label selector is valid in seconds. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.cs index 8068c75ce685d..0f813a6306c34 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.cs @@ -11,7 +11,7 @@ namespace Azure.Communication.JobRouter public partial class QueueAndMatchMode : JobMatchingMode { /// Initializes a new instance of QueueAndMatchMode. - /// Discriminator. + /// The type discriminator describing a sub-type of JobMatchingMode. internal QueueAndMatchMode(string kind) : base(kind) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs index 65c2a215a7fab..0001f46af2b53 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs @@ -11,7 +11,7 @@ namespace Azure.Communication.JobRouter public partial class QueueLengthExceptionTrigger : ExceptionTrigger { /// Initializes a new instance of QueueLengthExceptionTrigger. - /// Discriminator. + /// The type discriminator describing a sub-type of ExceptionTrigger. /// Threshold of number of jobs ahead in the queue to for this trigger to fire. internal QueueLengthExceptionTrigger(string kind, int threshold) : base(kind) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs index 7e90dfcddcdab..88523652ffd4c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs @@ -21,13 +21,10 @@ protected QueueSelectorAttachment() } /// Initializes a new instance of QueueSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of QueueSelectorAttachment. internal QueueSelectorAttachment(string kind) { Kind = kind; } - - /// Discriminator. - internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs index eef8faa92f875..78ede147c104d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs @@ -18,21 +18,6 @@ namespace Azure.Communication.JobRouter /// public partial class QueueWeightedAllocation { - /// Initializes a new instance of QueueWeightedAllocation. - /// The percentage of this weight, expressed as a fraction of 1. - /// - /// A collection of queue selectors that will be applied if this allocation is - /// selected. - /// - /// is null. - internal QueueWeightedAllocation(double weight, IEnumerable queueSelectors) - { - Argument.AssertNotNull(queueSelectors, nameof(queueSelectors)); - - Weight = weight; - QueueSelectors = queueSelectors.ToList(); - } - /// Initializes a new instance of QueueWeightedAllocation. /// The percentage of this weight, expressed as a fraction of 1. /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs index 346af55b8c088..be8afc91d74c4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure; @@ -21,7 +22,8 @@ internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(J return null; } Optional classificationPolicyId = default; - Optional> labelsToUpsert = default; + Optional> labelsToUpsert = default; + Optional id = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -36,7 +38,7 @@ internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(J { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -45,19 +47,24 @@ internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(J } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } labelsToUpsert = dictionary; continue; } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("kind"u8)) { kind = property.Value.GetString(); continue; } } - return new ReclassifyExceptionAction(kind, classificationPolicyId.Value, Optional.ToDictionary(labelsToUpsert)); + return new ReclassifyExceptionAction(id.Value, kind, classificationPolicyId.Value, Optional.ToDictionary(labelsToUpsert)); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs index ac97bdb8a8a1c..2859455a3d629 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -14,7 +15,8 @@ namespace Azure.Communication.JobRouter public partial class ReclassifyExceptionAction : ExceptionAction { /// Initializes a new instance of ReclassifyExceptionAction. - /// Discriminator. + /// Unique Id of the exception action. + /// The type discriminator describing a sub-type of ExceptionAction. /// /// (optional) The new classification policy that will determine queue, priority /// and worker selectors. @@ -23,16 +25,10 @@ public partial class ReclassifyExceptionAction : ExceptionAction /// (optional) Dictionary containing the labels to update (or add if not existing) /// in key-value pairs /// - internal ReclassifyExceptionAction(string kind, string classificationPolicyId, IDictionary labelsToUpsert) : base(kind) + internal ReclassifyExceptionAction(string id, string kind, string classificationPolicyId, IDictionary labelsToUpsert) : base(id, kind) { ClassificationPolicyId = classificationPolicyId; _labelsToUpsert = labelsToUpsert; } - - /// - /// (optional) The new classification policy that will determine queue, priority - /// and worker selectors. - /// - public string ClassificationPolicyId { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs index cc520870d602e..c4743480c8b76 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs @@ -19,17 +19,12 @@ internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element) { return null; } - string kind = default; Optional minConcurrentOffers = default; Optional maxConcurrentOffers = default; Optional bypassSelectors = default; + string kind = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); - continue; - } if (property.NameEquals("minConcurrentOffers"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -57,8 +52,13 @@ internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element) bypassSelectors = property.Value.GetBoolean(); continue; } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } } - return new RoundRobinMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); + return new RoundRobinMode(minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), kind); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs index d0d4ecbb85e4c..27cfc1d296f21 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs @@ -14,7 +14,6 @@ namespace Azure.Communication.JobRouter public partial class RoundRobinMode : DistributionMode { /// Initializes a new instance of RoundRobinMode. - /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// @@ -27,7 +26,8 @@ public partial class RoundRobinMode : DistributionMode /// This flag is intended more for temporary usage. /// By default, set to false. /// - internal RoundRobinMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + /// The type discriminator describing a sub-type of DistributionMode. + internal RoundRobinMode(int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, string kind) : base(minConcurrentOffers, maxConcurrentOffers, bypassSelectors, kind) { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterChannel.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterChannel.Serialization.cs new file mode 100644 index 0000000000000..ac23d64762ead --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterChannel.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class RouterChannel + { + internal static RouterChannel DeserializeRouterChannel(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string channelId = default; + int capacityCostPerJob = default; + Optional maxNumberOfJobs = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("channelId"u8)) + { + channelId = property.Value.GetString(); + continue; + } + if (property.NameEquals("capacityCostPerJob"u8)) + { + capacityCostPerJob = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxNumberOfJobs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxNumberOfJobs = property.Value.GetInt32(); + continue; + } + } + return new RouterChannel(channelId, capacityCostPerJob, Optional.ToNullable(maxNumberOfJobs)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterChannel FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterChannel(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterChannel.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterChannel.cs new file mode 100644 index 0000000000000..7f8c48ff11cb4 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterChannel.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Represents the capacity a job in this channel will consume from a worker. + public partial class RouterChannel + { + /// Initializes a new instance of RouterChannel. + /// Id of the channel. + /// + /// The amount of capacity that an instance of a job of this channel will consume + /// of the total worker capacity. + /// + /// The maximum number of jobs that can be supported concurrently for this channel. + internal RouterChannel(string channelId, int capacityCostPerJob, int? maxNumberOfJobs) + { + ChannelId = channelId; + CapacityCostPerJob = capacityCostPerJob; + MaxNumberOfJobs = maxNumberOfJobs; + } + + /// Id of the channel. + public string ChannelId { get; } + /// + /// The amount of capacity that an instance of a job of this channel will consume + /// of the total worker capacity. + /// + public int CapacityCostPerJob { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs index 0c0e020728ae5..cef127322c2f4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs @@ -21,6 +21,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) { return null; } + string etag = default; string id = default; Optional channelReference = default; Optional status = default; @@ -35,11 +36,16 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) Optional> labels = default; Optional> assignments = default; Optional> tags = default; - Optional> notes = default; + Optional> notes = default; Optional scheduledAt = default; Optional matchingMode = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("etag"u8)) + { + etag = property.Value.GetString(); + continue; + } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -187,12 +193,12 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + array.Add(RouterJobNote.DeserializeRouterJobNote(item)); } - notes = dictionary; + notes = array; continue; } if (property.NameEquals("scheduledAt"u8)) @@ -214,7 +220,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) continue; } } - return new RouterJob(id, channelReference.Value, Optional.ToNullable(status), Optional.ToNullable(enqueuedAt), channelId.Value, classificationPolicyId.Value, queueId.Value, Optional.ToNullable(priority), dispositionCode.Value, Optional.ToList(requestedWorkerSelectors), Optional.ToList(attachedWorkerSelectors), Optional.ToDictionary(labels), Optional.ToDictionary(assignments), Optional.ToDictionary(tags), Optional.ToDictionary(notes), Optional.ToNullable(scheduledAt), matchingMode.Value); + return new RouterJob(etag, id, channelReference.Value, Optional.ToNullable(status), Optional.ToNullable(enqueuedAt), channelId.Value, classificationPolicyId.Value, queueId.Value, Optional.ToNullable(priority), dispositionCode.Value, Optional.ToList(requestedWorkerSelectors), Optional.ToList(attachedWorkerSelectors), Optional.ToDictionary(labels), Optional.ToDictionary(assignments), Optional.ToDictionary(tags), Optional.ToList(notes), Optional.ToNullable(scheduledAt), matchingMode.Value); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs index 0edb0ccbc8a5d..ef472a42079f6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs @@ -17,15 +17,16 @@ public partial class RouterJob /// Initializes a new instance of RouterJob. internal RouterJob() { - _requestedWorkerSelectors = new ChangeTrackingList(); + RequestedWorkerSelectors = new ChangeTrackingList(); AttachedWorkerSelectors = new ChangeTrackingList(); _labels = new ChangeTrackingDictionary(); Assignments = new ChangeTrackingDictionary(); _tags = new ChangeTrackingDictionary(); - _notes = new ChangeTrackingDictionary(); + Notes = new ChangeTrackingList(); } /// Initializes a new instance of RouterJob. + /// Concurrency Token. /// The id of the job. /// Reference to an external parent context, eg. call ID. /// The status of the Job. @@ -68,8 +69,9 @@ internal RouterJob() /// SuspendMode: Used when matching workers /// to a job needs to be suspended. /// - internal RouterJob(string id, string channelReference, RouterJobStatus? status, DateTimeOffset? enqueuedAt, string channelId, string classificationPolicyId, string queueId, int? priority, string dispositionCode, IList requestedWorkerSelectors, IReadOnlyList attachedWorkerSelectors, IDictionary labels, IReadOnlyDictionary assignments, IDictionary tags, IDictionary notes, DateTimeOffset? scheduledAt, JobMatchingMode matchingMode) + internal RouterJob(string etag, string id, string channelReference, RouterJobStatus? status, DateTimeOffset? enqueuedAt, string channelId, string classificationPolicyId, string queueId, int? priority, string dispositionCode, IList requestedWorkerSelectors, IReadOnlyList attachedWorkerSelectors, IDictionary labels, IReadOnlyDictionary assignments, IDictionary tags, IList notes, DateTimeOffset? scheduledAt, JobMatchingMode matchingMode) { + _etag = etag; Id = id; ChannelReference = channelReference; Status = status; @@ -79,16 +81,15 @@ internal RouterJob(string id, string channelReference, RouterJobStatus? status, QueueId = queueId; Priority = priority; DispositionCode = dispositionCode; - _requestedWorkerSelectors = requestedWorkerSelectors; + RequestedWorkerSelectors = requestedWorkerSelectors; AttachedWorkerSelectors = attachedWorkerSelectors; _labels = labels; Assignments = assignments; _tags = tags; - _notes = notes; + Notes = notes; ScheduledAt = scheduledAt; MatchingMode = matchingMode; } - /// The id of the job. public string Id { get; } /// The status of the Job. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs deleted file mode 100644 index 41d159d99d3f4..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; - -namespace Azure.Communication.JobRouter -{ - public partial class RouterJobItem - { - internal static RouterJobItem DeserializeRouterJobItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RouterJob job = default; - string etag = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("job"u8)) - { - job = RouterJob.DeserializeRouterJob(property.Value); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - } - return new RouterJobItem(job, etag); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RouterJobItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRouterJobItem(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs deleted file mode 100644 index 9dd31bb31a5ee..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Paged instance of RouterJob. - public partial class RouterJobItem - { - /// Initializes a new instance of RouterJobItem. - /// A unit of work to be routed. - /// (Optional) The Concurrency Token. - /// or is null. - internal RouterJobItem(RouterJob job, string etag) - { - Argument.AssertNotNull(job, nameof(job)); - Argument.AssertNotNull(etag, nameof(etag)); - - Job = job; - _etag = etag; - } - - /// A unit of work to be routed. - public RouterJob Job { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobNote.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobNote.Serialization.cs new file mode 100644 index 0000000000000..e6a8095eab094 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobNote.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class RouterJobNote + { + internal static RouterJobNote DeserializeRouterJobNote(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string message = default; + Optional addedAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("addedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + addedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new RouterJobNote(message, Optional.ToNullable(addedAt)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobNote FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobNote(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobNote.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobNote.cs new file mode 100644 index 0000000000000..6170eea253c21 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobNote.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// A note attached to a job. + public partial class RouterJobNote + { + /// Initializes a new instance of RouterJobNote. + /// The message contained in the note. + /// The time at which the note was added in UTC. If not provided, will default to the current time. + internal RouterJobNote(string message, DateTimeOffset? addedAt) + { + Message = message; + AddedAt = addedAt; + } + + /// The message contained in the note. + public string Message { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs index c5d1590c2eee4..7d0a85375763e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs @@ -20,6 +20,7 @@ internal static RouterQueue DeserializeRouterQueue(JsonElement element) { return null; } + string etag = default; string id = default; Optional name = default; Optional distributionPolicyId = default; @@ -27,6 +28,11 @@ internal static RouterQueue DeserializeRouterQueue(JsonElement element) Optional exceptionPolicyId = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("etag"u8)) + { + etag = property.Value.GetString(); + continue; + } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -69,7 +75,7 @@ internal static RouterQueue DeserializeRouterQueue(JsonElement element) continue; } } - return new RouterQueue(id, name.Value, distributionPolicyId.Value, Optional.ToDictionary(labels), exceptionPolicyId.Value); + return new RouterQueue(etag, id, name.Value, distributionPolicyId.Value, Optional.ToDictionary(labels), exceptionPolicyId.Value); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs index 2fa297be9673a..9c0507b50ecd9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs @@ -14,6 +14,7 @@ namespace Azure.Communication.JobRouter public partial class RouterQueue { /// Initializes a new instance of RouterQueue. + /// Concurrency Token. /// The Id of this queue. /// The name of this queue. /// @@ -28,15 +29,15 @@ public partial class RouterQueue /// (Optional) The ID of the exception policy that determines various job /// escalation rules. /// - internal RouterQueue(string id, string name, string distributionPolicyId, IDictionary labels, string exceptionPolicyId) + internal RouterQueue(string etag, string id, string name, string distributionPolicyId, IDictionary labels, string exceptionPolicyId) { + _etag = etag; Id = id; Name = name; DistributionPolicyId = distributionPolicyId; _labels = labels; ExceptionPolicyId = exceptionPolicyId; } - /// The Id of this queue. public string Id { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.Serialization.cs deleted file mode 100644 index a39e27fbe7a86..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; - -namespace Azure.Communication.JobRouter -{ - public partial class RouterQueueAssignment - { - internal static RouterQueueAssignment DeserializeRouterQueueAssignment(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - foreach (var property in element.EnumerateObject()) - { - } - return new RouterQueueAssignment(); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RouterQueueAssignment FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRouterQueueAssignment(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.cs deleted file mode 100644 index 57c8a315d25c6..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// An assignment of a worker to a queue. - public partial class RouterQueueAssignment - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs deleted file mode 100644 index 32b9f9f745757..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; - -namespace Azure.Communication.JobRouter -{ - public partial class RouterQueueItem - { - internal static RouterQueueItem DeserializeRouterQueueItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RouterQueue queue = default; - string etag = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("queue"u8)) - { - queue = RouterQueue.DeserializeRouterQueue(property.Value); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - } - return new RouterQueueItem(queue, etag); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RouterQueueItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRouterQueueItem(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs deleted file mode 100644 index d828055c04bfa..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Paged instance of RouterQueue. - public partial class RouterQueueItem - { - /// Initializes a new instance of RouterQueueItem. - /// A queue that can contain jobs to be routed. - /// (Optional) The Concurrency Token. - /// or is null. - internal RouterQueueItem(RouterQueue queue, string etag) - { - Argument.AssertNotNull(queue, nameof(queue)); - Argument.AssertNotNull(etag, nameof(etag)); - - Queue = queue; - _etag = etag; - } - - /// A queue that can contain jobs to be routed. - public RouterQueue Queue { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs index 5845fa71a7cc2..069f416d24ef8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs @@ -16,6 +16,21 @@ namespace Azure.Communication.JobRouter /// public partial class RouterQueueSelector { + /// Initializes a new instance of RouterQueueSelector. + /// The label key to query against. + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// + /// is null. + internal RouterQueueSelector(string key, LabelOperator labelOperator) + { + Argument.AssertNotNull(key, nameof(key)); + + Key = key; + LabelOperator = labelOperator; + } + /// Initializes a new instance of RouterQueueSelector. /// The label key to query against. /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs index 16b6ffd33481e..7c7e79616b8b7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs @@ -22,7 +22,7 @@ internal static RouterQueueStatistics DeserializeRouterQueueStatistics(JsonEleme } string queueId = default; int length = default; - Optional> estimatedWaitTimeMinutes = default; + Optional> estimatedWaitTimeMinutes = default; Optional longestJobWaitTimeMinutes = default; foreach (var property in element.EnumerateObject()) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs index bc62aaf791bfc..37c39bb2d822c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs @@ -24,7 +24,7 @@ internal RouterQueueStatistics(string queueId, int length) QueueId = queueId; Length = length; - EstimatedWaitTimeMinutes = new ChangeTrackingDictionary(); + _estimatedWaitTimeMinutes = new ChangeTrackingDictionary(); } /// Initializes a new instance of RouterQueueStatistics. @@ -35,11 +35,11 @@ internal RouterQueueStatistics(string queueId, int length) /// by job priority /// /// The wait time of the job that has been enqueued in this queue for the longest. - internal RouterQueueStatistics(string queueId, int length, IReadOnlyDictionary estimatedWaitTimeMinutes, double? longestJobWaitTimeMinutes) + internal RouterQueueStatistics(string queueId, int length, IDictionary estimatedWaitTimeMinutes, double? longestJobWaitTimeMinutes) { QueueId = queueId; Length = length; - EstimatedWaitTimeMinutes = estimatedWaitTimeMinutes; + _estimatedWaitTimeMinutes = estimatedWaitTimeMinutes; LongestJobWaitTimeMinutes = longestJobWaitTimeMinutes; } @@ -47,11 +47,6 @@ internal RouterQueueStatistics(string queueId, int length, IReadOnlyDictionary Length of the queue: total number of enqueued jobs. public int Length { get; } - /// - /// The estimated wait time of this queue rounded up to the nearest minute, grouped - /// by job priority - /// - public IReadOnlyDictionary EstimatedWaitTimeMinutes { get; } /// The wait time of the job that has been enqueued in this queue for the longest. public double? LongestJobWaitTimeMinutes { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs index 4aeb6381642bf..0e02e57dac226 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs @@ -27,13 +27,15 @@ namespace Azure.Communication.JobRouter public abstract partial class RouterRule { /// Initializes a new instance of RouterRule. - /// Discriminator. + protected RouterRule() + { + } + + /// Initializes a new instance of RouterRule. + /// The type discriminator describing a sub-type of RouterRule. internal RouterRule(string kind) { Kind = kind; } - - /// Discriminator. - internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs index 9a99cab4598e9..2e9877d92a415 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs @@ -21,19 +21,25 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) { return null; } + string etag = default; string id = default; Optional state = default; - Optional> queueAssignments = default; - Optional totalCapacity = default; + Optional> queues = default; + Optional capacity = default; Optional> labels = default; Optional> tags = default; - Optional> channelConfigurations = default; + Optional> channels = default; Optional> offers = default; Optional> assignedJobs = default; Optional loadRatio = default; Optional availableForOffers = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("etag"u8)) + { + etag = property.Value.GetString(); + continue; + } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -48,27 +54,27 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) state = new RouterWorkerState(property.Value.GetString()); continue; } - if (property.NameEquals("queueAssignments"u8)) + if (property.NameEquals("queues"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) { - dictionary.Add(property0.Name, RouterQueueAssignment.DeserializeRouterQueueAssignment(property0.Value)); + array.Add(item.GetString()); } - queueAssignments = dictionary; + queues = array; continue; } - if (property.NameEquals("totalCapacity"u8)) + if (property.NameEquals("capacity"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - totalCapacity = property.Value.GetInt32(); + capacity = property.Value.GetInt32(); continue; } if (property.NameEquals("labels"u8)) @@ -113,18 +119,18 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("channelConfigurations"u8)) + if (property.NameEquals("channels"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) { - dictionary.Add(property0.Name, ChannelConfiguration.DeserializeChannelConfiguration(property0.Value)); + array.Add(RouterChannel.DeserializeRouterChannel(item)); } - channelConfigurations = dictionary; + channels = array; continue; } if (property.NameEquals("offers"u8)) @@ -174,7 +180,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) continue; } } - return new RouterWorker(id, Optional.ToNullable(state), Optional.ToDictionary(queueAssignments), Optional.ToNullable(totalCapacity), Optional.ToDictionary(labels), Optional.ToDictionary(tags), Optional.ToDictionary(channelConfigurations), Optional.ToList(offers), Optional.ToList(assignedJobs), Optional.ToNullable(loadRatio), Optional.ToNullable(availableForOffers)); + return new RouterWorker(etag, id, Optional.ToNullable(state), Optional.ToList(queues), Optional.ToNullable(capacity), Optional.ToDictionary(labels), Optional.ToDictionary(tags), Optional.ToList(channels), Optional.ToList(offers), Optional.ToList(assignedJobs), Optional.ToNullable(loadRatio), Optional.ToNullable(availableForOffers)); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs index 8705ccd21428f..5d0a83186f233 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs @@ -17,25 +17,26 @@ public partial class RouterWorker /// Initializes a new instance of RouterWorker. internal RouterWorker() { - _queueAssignments = new ChangeTrackingDictionary(); + Queues = new ChangeTrackingList(); _labels = new ChangeTrackingDictionary(); _tags = new ChangeTrackingDictionary(); - _channelConfigurations = new ChangeTrackingDictionary(); + Channels = new ChangeTrackingList(); Offers = new ChangeTrackingList(); AssignedJobs = new ChangeTrackingList(); } /// Initializes a new instance of RouterWorker. + /// Concurrency Token. /// Id of the worker. /// The current state of the worker. - /// The queue(s) that this worker can receive work from. - /// The total capacity score this worker has to manage multiple concurrent jobs. + /// The queue(s) that this worker can receive work from. + /// The total capacity score this worker has to manage multiple concurrent jobs. /// /// A set of key/value pairs that are identifying attributes used by the rules /// engines to make decisions. /// /// A set of non-identifying attributes attached to this worker. - /// The channel(s) this worker can handle and their impact on the workers capacity. + /// The channel(s) this worker can handle and their impact on the workers capacity. /// A list of active offers issued to this worker. /// A list of assigned jobs attached to this worker. /// @@ -43,21 +44,21 @@ internal RouterWorker() /// consumed. A value of '0' means no capacity is currently consumed. /// /// A flag indicating this worker is open to receive offers or not. - internal RouterWorker(string id, RouterWorkerState? state, IReadOnlyDictionary queueAssignments, int? totalCapacity, IDictionary labels, IDictionary tags, IDictionary channelConfigurations, IReadOnlyList offers, IReadOnlyList assignedJobs, double? loadRatio, bool? availableForOffers) + internal RouterWorker(string etag, string id, RouterWorkerState? state, IList queues, int? capacity, IDictionary labels, IDictionary tags, IList channels, IReadOnlyList offers, IReadOnlyList assignedJobs, double? loadRatio, bool? availableForOffers) { + _etag = etag; Id = id; State = state; - _queueAssignments = queueAssignments; - TotalCapacity = totalCapacity; + Queues = queues; + Capacity = capacity; _labels = labels; _tags = tags; - _channelConfigurations = channelConfigurations; + Channels = channels; Offers = offers; AssignedJobs = assignedJobs; LoadRatio = loadRatio; AvailableForOffers = availableForOffers; } - /// Id of the worker. public string Id { get; } /// The current state of the worker. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs deleted file mode 100644 index 3b959c106672b..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; - -namespace Azure.Communication.JobRouter -{ - public partial class RouterWorkerItem - { - internal static RouterWorkerItem DeserializeRouterWorkerItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RouterWorker worker = default; - string etag = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("worker"u8)) - { - worker = RouterWorker.DeserializeRouterWorker(property.Value); - continue; - } - if (property.NameEquals("etag"u8)) - { - etag = property.Value.GetString(); - continue; - } - } - return new RouterWorkerItem(worker, etag); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RouterWorkerItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeRouterWorkerItem(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs deleted file mode 100644 index 616b79fd04fc5..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Paged instance of RouterWorker. - public partial class RouterWorkerItem - { - /// Initializes a new instance of RouterWorkerItem. - /// An entity for jobs to be routed to. - /// (Optional) The Concurrency Token. - /// or is null. - internal RouterWorkerItem(RouterWorker worker, string etag) - { - Argument.AssertNotNull(worker, nameof(worker)); - Argument.AssertNotNull(etag, nameof(etag)); - - Worker = worker; - _etag = etag; - } - - /// An entity for jobs to be routed to. - public RouterWorker Worker { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs index 5991497680290..9a352db0ee9f8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs @@ -16,6 +16,21 @@ namespace Azure.Communication.JobRouter /// public partial class RouterWorkerSelector { + /// Initializes a new instance of RouterWorkerSelector. + /// The label key to query against. + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// + /// is null. + internal RouterWorkerSelector(string key, LabelOperator labelOperator) + { + Argument.AssertNotNull(key, nameof(key)); + + Key = key; + LabelOperator = labelOperator; + } + /// Initializes a new instance of RouterWorkerSelector. /// The label key to query against. /// @@ -45,8 +60,6 @@ internal RouterWorkerSelector(string key, LabelOperator labelOperator, BinaryDat /// label selector /// public LabelOperator LabelOperator { get; } - /// Pushes the job to the front of the queue as long as this selector is active. - public bool? Expedite { get; } /// The status of the worker selector. public RouterWorkerSelectorStatus? Status { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs index cb56981ecf8ae..f781482ada3b7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs @@ -14,32 +14,7 @@ namespace Azure.Communication.JobRouter public partial class RuleEngineQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of RuleEngineQueueSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule - /// providing static rules that always return the same result, regardless of - /// input. - /// DirectMapRule: A rule that return the same labels as the input - /// labels. - /// ExpressionRule: A rule providing inline expression - /// rules. - /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure - /// Function. - /// WebhookRule: A rule providing a binding to a webserver following - /// OAuth2.0 authentication protocol. - /// - /// is null. - internal RuleEngineQueueSelectorAttachment(RouterRule rule) - { - Argument.AssertNotNull(rule, nameof(rule)); - - Kind = "rule-engine"; - Rule = rule; - } - - /// Initializes a new instance of RuleEngineQueueSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of QueueSelectorAttachment. /// /// A rule of one of the following types: /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs index ad23a454d56b4..61ab18e5f7395 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs @@ -14,32 +14,7 @@ namespace Azure.Communication.JobRouter public partial class RuleEngineWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule - /// providing static rules that always return the same result, regardless of - /// input. - /// DirectMapRule: A rule that return the same labels as the input - /// labels. - /// ExpressionRule: A rule providing inline expression - /// rules. - /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure - /// Function. - /// WebhookRule: A rule providing a binding to a webserver following - /// OAuth2.0 authentication protocol. - /// - /// is null. - internal RuleEngineWorkerSelectorAttachment(RouterRule rule) - { - Argument.AssertNotNull(rule, nameof(rule)); - - Kind = "rule-engine"; - Rule = rule; - } - - /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of WorkerSelectorAttachment. /// /// A rule of one of the following types: /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs index fa76bd05a83b5..6bd67c6cf0a1c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs @@ -18,7 +18,7 @@ namespace Azure.Communication.JobRouter public partial class ScheduleAndSuspendMode : JobMatchingMode { /// Initializes a new instance of ScheduleAndSuspendMode. - /// Discriminator. + /// The type discriminator describing a sub-type of JobMatchingMode. /// Scheduled time. internal ScheduleAndSuspendMode(string kind, DateTimeOffset scheduleAt) : base(kind) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs index 6a4746579c67b..2e8a720b4f7f3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs @@ -22,7 +22,7 @@ internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement ele } Optional batchSize = default; Optional> scoringParameters = default; - Optional allowScoringBatchOfWorkers = default; + Optional isBatchScoringEnabled = default; Optional descendingOrder = default; foreach (var property in element.EnumerateObject()) { @@ -49,13 +49,13 @@ internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement ele scoringParameters = array; continue; } - if (property.NameEquals("allowScoringBatchOfWorkers"u8)) + if (property.NameEquals("isBatchScoringEnabled"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - allowScoringBatchOfWorkers = property.Value.GetBoolean(); + isBatchScoringEnabled = property.Value.GetBoolean(); continue; } if (property.NameEquals("descendingOrder"u8)) @@ -68,7 +68,7 @@ internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement ele continue; } } - return new ScoringRuleOptions(Optional.ToNullable(batchSize), Optional.ToList(scoringParameters), Optional.ToNullable(allowScoringBatchOfWorkers), Optional.ToNullable(descendingOrder)); + return new ScoringRuleOptions(Optional.ToNullable(batchSize), Optional.ToList(scoringParameters), Optional.ToNullable(isBatchScoringEnabled), Optional.ToNullable(descendingOrder)); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs index c787062c2c684..0e251b73a4866 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs @@ -37,7 +37,7 @@ internal ScoringRuleOptions() /// Note: /// Worker labels are always sent with scoring payload. /// - /// + /// /// (Optional) /// If set to true, will score workers in batches, and the parameter /// name of the worker labels will be sent as `workers`. @@ -51,34 +51,12 @@ internal ScoringRuleOptions() /// If false, will sort scores by ascending order. By default, set to /// true. /// - internal ScoringRuleOptions(int? batchSize, IList scoringParameters, bool? allowScoringBatchOfWorkers, bool? descendingOrder) + internal ScoringRuleOptions(int? batchSize, IList scoringParameters, bool? isBatchScoringEnabled, bool? descendingOrder) { BatchSize = batchSize; ScoringParameters = scoringParameters; - AllowScoringBatchOfWorkers = allowScoringBatchOfWorkers; + IsBatchScoringEnabled = isBatchScoringEnabled; DescendingOrder = descendingOrder; } - - /// - /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. - /// Defaults to 20 if not configured. - /// - public int? BatchSize { get; } - /// - /// (Optional) - /// If set to true, will score workers in batches, and the parameter - /// name of the worker labels will be sent as `workers`. - /// By default, set to false - /// and the parameter name for the worker labels will be sent as `worker`. - /// Note: If - /// enabled, use BatchSize to set batch size. - /// - public bool? AllowScoringBatchOfWorkers { get; } - /// - /// (Optional) - /// If false, will sort scores by ascending order. By default, set to - /// true. - /// - public bool? DescendingOrder { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs index 491eb4335cdec..0608fadfd1888 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs @@ -14,21 +14,7 @@ namespace Azure.Communication.JobRouter public partial class StaticQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of StaticQueueSelectorAttachment. - /// - /// Describes a condition that must be met against a set of labels for queue - /// selection - /// - /// is null. - internal StaticQueueSelectorAttachment(RouterQueueSelector queueSelector) - { - Argument.AssertNotNull(queueSelector, nameof(queueSelector)); - - Kind = "static"; - QueueSelector = queueSelector; - } - - /// Initializes a new instance of StaticQueueSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of QueueSelectorAttachment. /// /// Describes a condition that must be met against a set of labels for queue /// selection diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs index 5357c58403f6e..01b2481826f71 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs @@ -16,7 +16,13 @@ namespace Azure.Communication.JobRouter public partial class StaticRouterRule : RouterRule { /// Initializes a new instance of StaticRouterRule. - /// Discriminator. + internal StaticRouterRule() + { + Kind = "static-rule"; + } + + /// Initializes a new instance of StaticRouterRule. + /// The type discriminator describing a sub-type of RouterRule. /// The static value this rule always returns. internal StaticRouterRule(string kind, BinaryData value) : base(kind) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs index 31d1a60e47a12..a9a9ee62bb098 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs @@ -14,21 +14,7 @@ namespace Azure.Communication.JobRouter public partial class StaticWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of StaticWorkerSelectorAttachment. - /// - /// Describes a condition that must be met against a set of labels for worker - /// selection - /// - /// is null. - internal StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector) - { - Argument.AssertNotNull(workerSelector, nameof(workerSelector)); - - Kind = "static"; - WorkerSelector = workerSelector; - } - - /// Initializes a new instance of StaticWorkerSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of WorkerSelectorAttachment. /// /// Describes a condition that must be met against a set of labels for worker /// selection diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.cs index 816ab39273535..5cbaa71364c6c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.cs @@ -11,7 +11,7 @@ namespace Azure.Communication.JobRouter public partial class SuspendMode : JobMatchingMode { /// Initializes a new instance of SuspendMode. - /// Discriminator. + /// The type discriminator describing a sub-type of JobMatchingMode. internal SuspendMode(string kind) : base(kind) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobOptions.Serialization.cs new file mode 100644 index 0000000000000..3cc411dadc64e --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobOptions.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class UnassignJobOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SuspendMatching)) + { + writer.WritePropertyName("suspendMatching"u8); + writer.WriteBooleanValue(SuspendMatching.Value); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobOptions.cs new file mode 100644 index 0000000000000..39877594e1e7f --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobOptions.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Request payload for unassigning a job. + public partial class UnassignJobOptions + { + /// Initializes a new instance of UnassignJobOptions. + public UnassignJobOptions() + { + } + + /// Initializes a new instance of UnassignJobOptions. + /// + /// If SuspendMatching is true, then the job is not queued for re-matching with a + /// worker. + /// + internal UnassignJobOptions(bool? suspendMatching) + { + SuspendMatching = suspendMatching; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs deleted file mode 100644 index 4c14246a8a3d3..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - internal partial class UnassignJobRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(SuspendMatching)) - { - writer.WritePropertyName("suspendMatching"u8); - writer.WriteBooleanValue(SuspendMatching.Value); - } - writer.WriteEndObject(); - } - - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.cs deleted file mode 100644 index 5ae1aa9119f3a..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// Request payload for unassigning a job. - internal partial class UnassignJobRequest - { - /// Initializes a new instance of UnassignJobRequest. - public UnassignJobRequest() - { - } - - /// Initializes a new instance of UnassignJobRequest. - /// - /// If SuspendMatching is true, then the job is not queued for re-matching with a - /// worker. - /// - internal UnassignJobRequest(bool? suspendMatching) - { - SuspendMatching = suspendMatching; - } - - /// - /// If SuspendMatching is true, then the job is not queued for re-matching with a - /// worker. - /// - public bool? SuspendMatching { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs index 1092d82b05771..5c745897d9071 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs @@ -19,17 +19,12 @@ internal static UnknownDistributionMode DeserializeUnknownDistributionMode(JsonE { return null; } - string kind = "Unknown"; Optional minConcurrentOffers = default; Optional maxConcurrentOffers = default; Optional bypassSelectors = default; + string kind = "Unknown"; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); - continue; - } if (property.NameEquals("minConcurrentOffers"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -57,8 +52,13 @@ internal static UnknownDistributionMode DeserializeUnknownDistributionMode(JsonE bypassSelectors = property.Value.GetBoolean(); continue; } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } } - return new UnknownDistributionMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); + return new UnknownDistributionMode(minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), kind); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs index ae426ad8ff339..9e7efcf15950a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs @@ -16,7 +16,6 @@ internal UnknownDistributionMode() } /// Initializes a new instance of UnknownDistributionMode. - /// Discriminator. /// Governs the minimum desired number of active concurrent offers a job can have. /// Governs the maximum number of active concurrent offers a job can have. /// @@ -29,7 +28,8 @@ internal UnknownDistributionMode() /// This flag is intended more for temporary usage. /// By default, set to false. /// - internal UnknownDistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + /// The type discriminator describing a sub-type of DistributionMode. + internal UnknownDistributionMode(int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, string kind) : base(minConcurrentOffers, maxConcurrentOffers, bypassSelectors, kind) { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs index 6a148641e730d..44b284973c6a1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure; +using Azure.Core; namespace Azure.Communication.JobRouter { @@ -18,16 +19,22 @@ internal static UnknownExceptionAction DeserializeUnknownExceptionAction(JsonEle { return null; } + Optional id = default; string kind = "Unknown"; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("kind"u8)) { kind = property.Value.GetString(); continue; } } - return new UnknownExceptionAction(kind); + return new UnknownExceptionAction(id.Value, kind); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs index a336aa38e90f9..ae34bf748b7da 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs @@ -16,8 +16,9 @@ internal UnknownExceptionAction() } /// Initializes a new instance of UnknownExceptionAction. - /// Discriminator. - internal UnknownExceptionAction(string kind) : base(kind) + /// Unique Id of the exception action. + /// The type discriminator describing a sub-type of ExceptionAction. + internal UnknownExceptionAction(string id, string kind) : base(id, kind) { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs index 18efc690d3606..6a3a0afbfdde2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs @@ -16,7 +16,7 @@ internal UnknownExceptionTrigger() } /// Initializes a new instance of UnknownExceptionTrigger. - /// Discriminator. + /// The type discriminator describing a sub-type of ExceptionTrigger. internal UnknownExceptionTrigger(string kind) : base(kind) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.cs index 63b8e665d6e60..f38d890fe2267 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.cs @@ -11,7 +11,12 @@ namespace Azure.Communication.JobRouter internal partial class UnknownJobMatchingMode : JobMatchingMode { /// Initializes a new instance of UnknownJobMatchingMode. - /// Discriminator. + internal UnknownJobMatchingMode() + { + } + + /// Initializes a new instance of UnknownJobMatchingMode. + /// The type discriminator describing a sub-type of JobMatchingMode. internal UnknownJobMatchingMode(string kind) : base(kind) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs index 8fba081e56f7d..2ffab9b997e33 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs @@ -16,7 +16,7 @@ internal UnknownQueueSelectorAttachment() } /// Initializes a new instance of UnknownQueueSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of QueueSelectorAttachment. internal UnknownQueueSelectorAttachment(string kind) : base(kind) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs index 22c6e23ad602d..4f8e6e61c2b4b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs @@ -11,7 +11,12 @@ namespace Azure.Communication.JobRouter internal partial class UnknownRouterRule : RouterRule { /// Initializes a new instance of UnknownRouterRule. - /// Discriminator. + internal UnknownRouterRule() + { + } + + /// Initializes a new instance of UnknownRouterRule. + /// The type discriminator describing a sub-type of RouterRule. internal UnknownRouterRule(string kind) : base(kind) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs index 7c1d37def27c2..17763d342c929 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs @@ -16,7 +16,7 @@ internal UnknownWorkerSelectorAttachment() } /// Initializes a new instance of UnknownWorkerSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of WorkerSelectorAttachment. internal UnknownWorkerSelectorAttachment(string kind) : base(kind) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs index dd5cc19ce2d2b..356318d232b84 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs @@ -11,7 +11,15 @@ namespace Azure.Communication.JobRouter public partial class WaitTimeExceptionTrigger : ExceptionTrigger { /// Initializes a new instance of WaitTimeExceptionTrigger. - /// Discriminator. + /// Threshold for wait time for this trigger. + internal WaitTimeExceptionTrigger(double thresholdSeconds) + { + Kind = "wait-time"; + _thresholdSeconds = thresholdSeconds; + } + + /// Initializes a new instance of WaitTimeExceptionTrigger. + /// The type discriminator describing a sub-type of ExceptionTrigger. /// Threshold for wait time for this trigger. internal WaitTimeExceptionTrigger(string kind, double thresholdSeconds) : base(kind) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs index f1fa3ddc265d2..7b71362d07ed6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs @@ -21,7 +21,7 @@ internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement eleme return null; } Optional authorizationServerUri = default; - Optional clientCredential = default; + Optional clientCredential = default; Optional webhookUri = default; string kind = default; foreach (var property in element.EnumerateObject()) @@ -41,7 +41,7 @@ internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement eleme { continue; } - clientCredential = Oauth2ClientCredential.DeserializeOauth2ClientCredential(property.Value); + clientCredential = OAuth2WebhookClientCredential.DeserializeOAuth2WebhookClientCredential(property.Value); continue; } if (property.NameEquals("webhookUri"u8)) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs index 161a7c1b9545e..0c839f6b7a500 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs @@ -13,7 +13,13 @@ namespace Azure.Communication.JobRouter public partial class WebhookRouterRule : RouterRule { /// Initializes a new instance of WebhookRouterRule. - /// Discriminator. + internal WebhookRouterRule() + { + Kind = "webhook-rule"; + } + + /// Initializes a new instance of WebhookRouterRule. + /// The type discriminator describing a sub-type of RouterRule. /// Uri for Authorization Server. /// /// OAuth2.0 Credentials used to Contoso's Authorization server. @@ -21,7 +27,7 @@ public partial class WebhookRouterRule : RouterRule /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// /// Uri for Contoso's Web Server. - internal WebhookRouterRule(string kind, Uri authorizationServerUri, Oauth2ClientCredential clientCredential, Uri webhookUri) : base(kind) + internal WebhookRouterRule(string kind, Uri authorizationServerUri, OAuth2WebhookClientCredential clientCredential, Uri webhookUri) : base(kind) { AuthorizationServerUri = authorizationServerUri; ClientCredential = clientCredential; @@ -35,7 +41,7 @@ internal WebhookRouterRule(string kind, Uri authorizationServerUri, Oauth2Client /// Reference: /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// - public Oauth2ClientCredential ClientCredential { get; } + public OAuth2WebhookClientCredential ClientCredential { get; } /// Uri for Contoso's Web Server. public Uri WebhookUri { get; } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs index 078afe0b3ce59..13a5981f95bdc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs @@ -19,18 +19,7 @@ namespace Azure.Communication.JobRouter public partial class WeightedAllocationQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. - /// A collection of percentage based weighted allocations. - /// is null. - internal WeightedAllocationQueueSelectorAttachment(IEnumerable allocations) - { - Argument.AssertNotNull(allocations, nameof(allocations)); - - Kind = "weighted-allocation-queue-selector"; - Allocations = allocations.ToList(); - } - - /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of QueueSelectorAttachment. /// A collection of percentage based weighted allocations. internal WeightedAllocationQueueSelectorAttachment(string kind, IReadOnlyList allocations) : base(kind) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs index bc1aa5d2f7b3a..e66cc942c743c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs @@ -19,18 +19,7 @@ namespace Azure.Communication.JobRouter public partial class WeightedAllocationWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. - /// A collection of percentage based weighted allocations. - /// is null. - internal WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations) - { - Argument.AssertNotNull(allocations, nameof(allocations)); - - Kind = "weighted-allocation-worker-selector"; - Allocations = allocations.ToList(); - } - - /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of WorkerSelectorAttachment. /// A collection of percentage based weighted allocations. internal WeightedAllocationWorkerSelectorAttachment(string kind, IReadOnlyList allocations) : base(kind) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs index ef1125b80b267..7950c7a781a66 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs @@ -20,13 +20,10 @@ protected WorkerSelectorAttachment() } /// Initializes a new instance of WorkerSelectorAttachment. - /// Discriminator. + /// The type discriminator describing a sub-type of WorkerSelectorAttachment. internal WorkerSelectorAttachment(string kind) { Kind = kind; } - - /// Discriminator. - internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs index 5ef90941d0495..6b958e924a5db 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs @@ -18,21 +18,6 @@ namespace Azure.Communication.JobRouter /// public partial class WorkerWeightedAllocation { - /// Initializes a new instance of WorkerWeightedAllocation. - /// The percentage of this weight, expressed as a fraction of 1. - /// - /// A collection of worker selectors that will be applied if this allocation is - /// selected. - /// - /// is null. - internal WorkerWeightedAllocation(double weight, IEnumerable workerSelectors) - { - Argument.AssertNotNull(workerSelectors, nameof(workerSelectors)); - - Weight = weight; - WorkerSelectors = workerSelectors.ToList(); - } - /// Initializes a new instance of WorkerWeightedAllocation. /// The percentage of this weight, expressed as a fraction of 1. /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json b/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json index 60933b237b21c..e63b9380735b8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json @@ -75,8 +75,8 @@ }, { "$id": "11", - "Name": "lessThanEqual", - "Value": "lessThanEqual", + "Name": "lessThanOrEqual", + "Value": "lessThanOrEqual", "Description": "Less than or equal" }, { @@ -87,8 +87,8 @@ }, { "$id": "13", - "Name": "greaterThanEqual", - "Value": "greaterThanEqual", + "Name": "greaterThanOrEqual", + "Value": "greaterThanOrEqual", "Description": "Greater than or equal" } ], @@ -402,11 +402,25 @@ "Properties": [ { "$id": "57", + "Name": "etag", + "SerializedName": "etag", + "Description": "Concurrency Token.", + "Type": { + "$id": "58", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "59", "Name": "id", "SerializedName": "id", "Description": "The unique identifier of the policy.", "Type": { - "$id": "58", + "$id": "60", "Name": "string", "Kind": "String", "IsNullable": false @@ -415,12 +429,12 @@ "IsReadOnly": true }, { - "$id": "59", + "$id": "61", "Name": "name", "SerializedName": "name", "Description": "The human readable name of the policy.", "Type": { - "$id": "60", + "$id": "62", "Name": "string", "Kind": "String", "IsNullable": false @@ -429,12 +443,12 @@ "IsReadOnly": false }, { - "$id": "61", + "$id": "63", "Name": "offerExpiresAfterSeconds", "SerializedName": "offerExpiresAfterSeconds", "Description": "The number of seconds after which any offers created under this policy will be\nexpired.", "Type": { - "$id": "62", + "$id": "64", "Name": "float64", "Kind": "Float64", "IsNullable": false @@ -443,12 +457,12 @@ "IsReadOnly": false }, { - "$id": "63", + "$id": "65", "Name": "mode", "SerializedName": "mode", "Description": "Abstract base class for defining a distribution mode", "Type": { - "$id": "64", + "$id": "66", "Name": "DistributionMode", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -457,22 +471,6 @@ "DiscriminatorPropertyName": "kind", "Usage": "Output", "Properties": [ - { - "$id": "65", - "Name": "kind", - "SerializedName": "kind", - "Description": "Discriminator", - "IsRequired": true, - "IsReadOnly": false, - "IsNullable": false, - "Type": { - "$id": "66", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsDiscriminator": true - }, { "$id": "67", "Name": "minConcurrentOffers", @@ -514,11 +512,26 @@ }, "IsRequired": false, "IsReadOnly": false + }, + { + "$id": "73", + "Name": "kind", + "SerializedName": "kind", + "Description": "The type discriminator describing a sub-type of DistributionMode", + "Type": { + "$id": "74", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false, + "IsDiscriminator": true } ], "DerivedModels": [ { - "$id": "73", + "$id": "75", "Name": "BestWorkerMode", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -526,17 +539,17 @@ "IsNullable": false, "DiscriminatorValue": "best-worker", "BaseModel": { - "$ref": "64" + "$ref": "66" }, "Usage": "Output", "Properties": [ { - "$id": "74", + "$id": "76", "Name": "scoringRule", "SerializedName": "scoringRule", "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", "Type": { - "$id": "75", + "$id": "77", "Name": "RouterRule", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -546,25 +559,24 @@ "Usage": "Output", "Properties": [ { - "$id": "76", + "$id": "78", "Name": "kind", "SerializedName": "kind", - "Description": "Discriminator", - "IsRequired": true, - "IsReadOnly": false, - "IsNullable": false, + "Description": "The type discriminator describing a sub-type of RouterRule", "Type": { - "$id": "77", + "$id": "79", "Name": "string", "Kind": "String", "IsNullable": false }, + "IsRequired": true, + "IsReadOnly": false, "IsDiscriminator": true } ], "DerivedModels": [ { - "$id": "78", + "$id": "80", "Name": "DirectMapRouterRule", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -572,13 +584,13 @@ "IsNullable": false, "DiscriminatorValue": "direct-map-rule", "BaseModel": { - "$ref": "75" + "$ref": "77" }, "Usage": "Output", "Properties": [] }, { - "$id": "79", + "$id": "81", "Name": "ExpressionRouterRule", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -586,12 +598,12 @@ "IsNullable": false, "DiscriminatorValue": "expression-rule", "BaseModel": { - "$ref": "75" + "$ref": "77" }, "Usage": "Output", "Properties": [ { - "$id": "80", + "$id": "82", "Name": "language", "SerializedName": "language", "Description": "The expression language to compile to and execute", @@ -602,12 +614,12 @@ "IsReadOnly": false }, { - "$id": "81", + "$id": "83", "Name": "expression", "SerializedName": "expression", "Description": "The string containing the expression to evaluate. Should contain return\nstatement with calculated values.", "Type": { - "$id": "82", + "$id": "84", "Name": "string", "Kind": "String", "IsNullable": false @@ -618,7 +630,7 @@ ] }, { - "$id": "83", + "$id": "85", "Name": "FunctionRouterRule", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -626,17 +638,17 @@ "IsNullable": false, "DiscriminatorValue": "azure-function-rule", "BaseModel": { - "$ref": "75" + "$ref": "77" }, "Usage": "Output", "Properties": [ { - "$id": "84", + "$id": "86", "Name": "functionUri", "SerializedName": "functionUri", "Description": "URL for Azure Function", "Type": { - "$id": "85", + "$id": "87", "Name": "url", "Kind": "Uri", "IsNullable": false @@ -645,12 +657,12 @@ "IsReadOnly": false }, { - "$id": "86", + "$id": "88", "Name": "credential", "SerializedName": "credential", "Description": "Credentials used to access Azure function rule", "Type": { - "$id": "87", + "$id": "89", "Name": "FunctionRouterRuleCredential", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -659,12 +671,12 @@ "Usage": "Output", "Properties": [ { - "$id": "88", + "$id": "90", "Name": "functionKey", "SerializedName": "functionKey", "Description": "(Optional) Access key scoped to a particular function", "Type": { - "$id": "89", + "$id": "91", "Name": "string", "Kind": "String", "IsNullable": false @@ -673,12 +685,12 @@ "IsReadOnly": false }, { - "$id": "90", + "$id": "92", "Name": "appKey", "SerializedName": "appKey", "Description": "(Optional) Access key scoped to a Azure Function app.\nThis key grants access to\nall functions under the app.", "Type": { - "$id": "91", + "$id": "93", "Name": "string", "Kind": "String", "IsNullable": false @@ -687,12 +699,12 @@ "IsReadOnly": false }, { - "$id": "92", + "$id": "94", "Name": "clientId", "SerializedName": "clientId", "Description": "(Optional) Client id, when AppKey is provided\nIn context of Azure function,\nthis is usually the name of the key", "Type": { - "$id": "93", + "$id": "95", "Name": "string", "Kind": "String", "IsNullable": false @@ -708,7 +720,7 @@ ] }, { - "$id": "94", + "$id": "96", "Name": "StaticRouterRule", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -716,17 +728,17 @@ "IsNullable": false, "DiscriminatorValue": "static-rule", "BaseModel": { - "$ref": "75" + "$ref": "77" }, "Usage": "Output", "Properties": [ { - "$id": "95", + "$id": "97", "Name": "value", "SerializedName": "value", "Description": "The static value this rule always returns.", "Type": { - "$id": "96", + "$id": "98", "Name": "Intrinsic", "Kind": "unknown", "IsNullable": false @@ -737,7 +749,7 @@ ] }, { - "$id": "97", + "$id": "99", "Name": "WebhookRouterRule", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -745,17 +757,17 @@ "IsNullable": false, "DiscriminatorValue": "webhook-rule", "BaseModel": { - "$ref": "75" + "$ref": "77" }, "Usage": "Output", "Properties": [ { - "$id": "98", + "$id": "100", "Name": "authorizationServerUri", "SerializedName": "authorizationServerUri", "Description": "Uri for Authorization Server.", "Type": { - "$id": "99", + "$id": "101", "Name": "url", "Kind": "Uri", "IsNullable": false @@ -764,13 +776,13 @@ "IsReadOnly": false }, { - "$id": "100", + "$id": "102", "Name": "clientCredential", "SerializedName": "clientCredential", "Description": "OAuth2.0 Credentials used to Contoso's Authorization server.\nReference:\nhttps://www.oauth.com/oauth2-servers/access-tokens/client-credentials/", "Type": { - "$id": "101", - "Name": "Oauth2ClientCredential", + "$id": "103", + "Name": "OAuth2WebhookClientCredential", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", "Description": "OAuth2.0 Credentials used to Contoso's Authorization server.\nReference:\nhttps://www.oauth.com/oauth2-servers/access-tokens/client-credentials/", @@ -778,12 +790,12 @@ "Usage": "Output", "Properties": [ { - "$id": "102", + "$id": "104", "Name": "clientId", "SerializedName": "clientId", "Description": "ClientId for Contoso Authorization server.", "Type": { - "$id": "103", + "$id": "105", "Name": "string", "Kind": "String", "IsNullable": false @@ -792,12 +804,12 @@ "IsReadOnly": false }, { - "$id": "104", + "$id": "106", "Name": "clientSecret", "SerializedName": "clientSecret", "Description": "Client secret for Contoso Authorization server.", "Type": { - "$id": "105", + "$id": "107", "Name": "string", "Kind": "String", "IsNullable": false @@ -811,12 +823,12 @@ "IsReadOnly": false }, { - "$id": "106", + "$id": "108", "Name": "webhookUri", "SerializedName": "webhookUri", "Description": "Uri for Contoso's Web Server.", "Type": { - "$id": "107", + "$id": "109", "Name": "url", "Kind": "Uri", "IsNullable": false @@ -832,12 +844,12 @@ "IsReadOnly": false }, { - "$id": "108", + "$id": "110", "Name": "scoringRuleOptions", "SerializedName": "scoringRuleOptions", "Description": "Encapsulates all options that can be passed as parameters for scoring rule with\nBestWorkerMode", "Type": { - "$id": "109", + "$id": "111", "Name": "ScoringRuleOptions", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -846,12 +858,12 @@ "Usage": "Output", "Properties": [ { - "$id": "110", + "$id": "112", "Name": "batchSize", "SerializedName": "batchSize", "Description": "(Optional) Set batch size when AllowScoringBatchOfWorkers is set to true.\nDefaults to 20 if not configured.", "Type": { - "$id": "111", + "$id": "113", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -860,12 +872,12 @@ "IsReadOnly": false }, { - "$id": "112", + "$id": "114", "Name": "scoringParameters", "SerializedName": "scoringParameters", "Description": "(Optional) List of extra parameters from the job that will be sent as part of\nthe payload to scoring rule.\nIf not set, the job's labels (sent in the payload\nas `job`) and the job's worker selectors (sent in the payload as\n`selectors`)\nare added to the payload of the scoring rule by default.\nNote:\nWorker labels are always sent with scoring payload.", "Type": { - "$id": "113", + "$id": "115", "Name": "Array", "ElementType": { "$ref": "4" @@ -876,12 +888,12 @@ "IsReadOnly": false }, { - "$id": "114", - "Name": "allowScoringBatchOfWorkers", - "SerializedName": "allowScoringBatchOfWorkers", + "$id": "116", + "Name": "isBatchScoringEnabled", + "SerializedName": "isBatchScoringEnabled", "Description": "(Optional)\nIf set to true, will score workers in batches, and the parameter\nname of the worker labels will be sent as `workers`.\nBy default, set to false\nand the parameter name for the worker labels will be sent as `worker`.\nNote: If\nenabled, use BatchSize to set batch size.", "Type": { - "$id": "115", + "$id": "117", "Name": "boolean", "Kind": "Boolean", "IsNullable": false @@ -890,12 +902,12 @@ "IsReadOnly": false }, { - "$id": "116", + "$id": "118", "Name": "descendingOrder", "SerializedName": "descendingOrder", "Description": "(Optional)\nIf false, will sort scores by ascending order. By default, set to\ntrue.", "Type": { - "$id": "117", + "$id": "119", "Name": "boolean", "Kind": "Boolean", "IsNullable": false @@ -911,7 +923,7 @@ ] }, { - "$id": "118", + "$id": "120", "Name": "LongestIdleMode", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -919,13 +931,13 @@ "IsNullable": false, "DiscriminatorValue": "longest-idle", "BaseModel": { - "$ref": "64" + "$ref": "66" }, "Usage": "Output", "Properties": [] }, { - "$id": "119", + "$id": "121", "Name": "RoundRobinMode", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -933,7 +945,7 @@ "IsNullable": false, "DiscriminatorValue": "round-robin", "BaseModel": { - "$ref": "64" + "$ref": "66" }, "Usage": "Output", "Properties": [] @@ -946,94 +958,62 @@ ] }, { - "$ref": "64" + "$ref": "66" }, { - "$ref": "73" + "$ref": "75" }, { - "$ref": "75" + "$ref": "77" }, { - "$ref": "78" + "$ref": "80" }, { - "$ref": "79" + "$ref": "81" }, { - "$ref": "83" + "$ref": "85" }, { - "$ref": "87" + "$ref": "89" }, { - "$ref": "94" + "$ref": "96" }, { - "$ref": "97" + "$ref": "99" }, { - "$ref": "101" + "$ref": "103" }, { - "$ref": "109" + "$ref": "111" }, { - "$ref": "118" + "$ref": "120" }, { - "$ref": "119" + "$ref": "121" }, { - "$id": "120", - "Name": "PagedDistributionPolicyItem", + "$id": "122", + "Name": "PagedDistributionPolicy", "Namespace": "AzureCommunicationRoutingService", "Description": "A paged collection of distribution policies.", "IsNullable": false, "Usage": "Output", "Properties": [ { - "$id": "121", + "$id": "123", "Name": "value", "SerializedName": "value", - "Description": "The DistributionPolicyItem items on this page", + "Description": "The DistributionPolicy items on this page", "Type": { - "$id": "122", + "$id": "124", "Name": "Array", "ElementType": { - "$id": "123", - "Name": "DistributionPolicyItem", - "Namespace": "AzureCommunicationRoutingService", - "Description": "Paged instance of DistributionPolicy", - "IsNullable": false, - "Usage": "Output", - "Properties": [ - { - "$id": "124", - "Name": "distributionPolicy", - "SerializedName": "distributionPolicy", - "Description": "Policy governing how jobs are distributed to workers", - "Type": { - "$ref": "56" - }, - "IsRequired": true, - "IsReadOnly": false - }, - { - "$id": "125", - "Name": "etag", - "SerializedName": "etag", - "Description": "(Optional) The Concurrency Token.", - "Type": { - "$id": "126", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - } - ] + "$ref": "56" }, "IsNullable": false }, @@ -1041,12 +1021,12 @@ "IsReadOnly": false }, { - "$id": "127", + "$id": "125", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "128", + "$id": "126", "Name": "string", "Kind": "String", "IsNullable": false @@ -1057,16 +1037,27 @@ ] }, { - "$ref": "123" - }, - { - "$id": "129", + "$id": "127", "Name": "ClassificationPolicy", "Namespace": "AzureCommunicationRoutingService", "Description": "A container for the rules that govern how jobs are classified.", "IsNullable": false, "Usage": "Output", "Properties": [ + { + "$id": "128", + "Name": "etag", + "SerializedName": "etag", + "Description": "Concurrency Token.", + "Type": { + "$id": "129", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, { "$id": "130", "Name": "id", @@ -1111,9 +1102,9 @@ }, { "$id": "136", - "Name": "queueSelectors", - "SerializedName": "queueSelectors", - "Description": "The queue selectors to resolve a queue for a given job.", + "Name": "queueSelectorAttachments", + "SerializedName": "queueSelectorAttachments", + "Description": "The queue selector attachments used to resolve a queue for a given job.", "Type": { "$id": "137", "Name": "Array", @@ -1131,16 +1122,15 @@ "$id": "139", "Name": "kind", "SerializedName": "kind", - "Description": "Discriminator", - "IsRequired": true, - "IsReadOnly": false, - "IsNullable": false, + "Description": "The type discriminator describing a sub-type of QueueSelectorAttachment", "Type": { "$id": "140", "Name": "string", "Kind": "String", "IsNullable": false }, + "IsRequired": true, + "IsReadOnly": false, "IsDiscriminator": true } ], @@ -1164,7 +1154,7 @@ "SerializedName": "condition", "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", "Type": { - "$ref": "75" + "$ref": "77" }, "IsRequired": true, "IsReadOnly": false @@ -1293,7 +1283,7 @@ "SerializedName": "rule", "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", "Type": { - "$ref": "75" + "$ref": "77" }, "IsRequired": true, "IsReadOnly": false @@ -1408,16 +1398,16 @@ "SerializedName": "prioritizationRule", "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", "Type": { - "$ref": "75" + "$ref": "77" }, "IsRequired": false, "IsReadOnly": false }, { "$id": "168", - "Name": "workerSelectors", - "SerializedName": "workerSelectors", - "Description": "The worker label selectors to attach to a given job.", + "Name": "workerSelectorAttachments", + "SerializedName": "workerSelectorAttachments", + "Description": "The worker selector attachments used to attach worker selectors to a given job.", "Type": { "$id": "169", "Name": "Array", @@ -1435,16 +1425,15 @@ "$id": "171", "Name": "kind", "SerializedName": "kind", - "Description": "Discriminator", - "IsRequired": true, - "IsReadOnly": false, - "IsNullable": false, + "Description": "The type discriminator describing a sub-type of WorkerSelectorAttachment", "Type": { "$id": "172", "Name": "string", "Kind": "String", "IsNullable": false }, + "IsRequired": true, + "IsReadOnly": false, "IsDiscriminator": true } ], @@ -1468,7 +1457,7 @@ "SerializedName": "condition", "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", "Type": { - "$ref": "75" + "$ref": "77" }, "IsRequired": true, "IsReadOnly": false @@ -1664,7 +1653,7 @@ "SerializedName": "rule", "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", "Type": { - "$ref": "75" + "$ref": "77" }, "IsRequired": true, "IsReadOnly": false @@ -1825,7 +1814,7 @@ }, { "$id": "208", - "Name": "PagedClassificationPolicyItem", + "Name": "PagedClassificationPolicy", "Namespace": "AzureCommunicationRoutingService", "Description": "A paged collection of classification policies.", "IsNullable": false, @@ -1835,44 +1824,12 @@ "$id": "209", "Name": "value", "SerializedName": "value", - "Description": "The ClassificationPolicyItem items on this page", + "Description": "The ClassificationPolicy items on this page", "Type": { "$id": "210", "Name": "Array", "ElementType": { - "$id": "211", - "Name": "ClassificationPolicyItem", - "Namespace": "AzureCommunicationRoutingService", - "Description": "Paged instance of ClassificationPolicy", - "IsNullable": false, - "Usage": "Output", - "Properties": [ - { - "$id": "212", - "Name": "classificationPolicy", - "SerializedName": "classificationPolicy", - "Description": "A container for the rules that govern how jobs are classified.", - "Type": { - "$ref": "129" - }, - "IsRequired": true, - "IsReadOnly": false - }, - { - "$id": "213", - "Name": "etag", - "SerializedName": "etag", - "Description": "(Optional) The Concurrency Token.", - "Type": { - "$id": "214", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - } - ] + "$ref": "127" }, "IsNullable": false }, @@ -1880,12 +1837,12 @@ "IsReadOnly": false }, { - "$id": "215", + "$id": "211", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "216", + "$id": "212", "Name": "string", "Kind": "String", "IsNullable": false @@ -1896,10 +1853,7 @@ ] }, { - "$ref": "211" - }, - { - "$id": "217", + "$id": "213", "Name": "ExceptionPolicy", "Namespace": "AzureCommunicationRoutingService", "Description": "A policy that defines actions to execute when exception are triggered.", @@ -1907,12 +1861,26 @@ "Usage": "Output", "Properties": [ { - "$id": "218", + "$id": "214", + "Name": "etag", + "SerializedName": "etag", + "Description": "Concurrency Token.", + "Type": { + "$id": "215", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "216", "Name": "id", "SerializedName": "id", "Description": "The Id of the exception policy", "Type": { - "$id": "219", + "$id": "217", "Name": "string", "Kind": "String", "IsNullable": false @@ -1921,12 +1889,12 @@ "IsReadOnly": true }, { - "$id": "220", + "$id": "218", "Name": "name", "SerializedName": "name", "Description": "(Optional) The name of the exception policy.", "Type": { - "$id": "221", + "$id": "219", "Name": "string", "Kind": "String", "IsNullable": false @@ -1935,21 +1903,15 @@ "IsReadOnly": false }, { - "$id": "222", + "$id": "220", "Name": "exceptionRules", "SerializedName": "exceptionRules", - "Description": "(Optional) A dictionary collection of exception rules on the exception policy.\nKey is the Id of each exception rule.", + "Description": "(Optional) A collection of exception rules on the exception policy.", "Type": { - "$id": "223", - "Name": "Dictionary", - "KeyType": { - "$id": "224", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "ValueType": { - "$id": "225", + "$id": "221", + "Name": "Array", + "ElementType": { + "$id": "222", "Name": "ExceptionRule", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -1958,12 +1920,26 @@ "Usage": "Output", "Properties": [ { - "$id": "226", + "$id": "223", + "Name": "id", + "SerializedName": "id", + "Description": "Id of the exception rule.", + "Type": { + "$id": "224", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "225", "Name": "trigger", "SerializedName": "trigger", "Description": "The trigger for this exception rule", "Type": { - "$id": "227", + "$id": "226", "Name": "ExceptionTrigger", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -1973,25 +1949,24 @@ "Usage": "Output", "Properties": [ { - "$id": "228", + "$id": "227", "Name": "kind", "SerializedName": "kind", - "Description": "Discriminator", - "IsRequired": true, - "IsReadOnly": false, - "IsNullable": false, + "Description": "The type discriminator describing a sub-type of ExceptionTrigger", "Type": { - "$id": "229", + "$id": "228", "Name": "string", "Kind": "String", "IsNullable": false }, + "IsRequired": true, + "IsReadOnly": false, "IsDiscriminator": true } ], "DerivedModels": [ { - "$id": "230", + "$id": "229", "Name": "QueueLengthExceptionTrigger", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -1999,17 +1974,17 @@ "IsNullable": false, "DiscriminatorValue": "queue-length", "BaseModel": { - "$ref": "227" + "$ref": "226" }, "Usage": "Output", "Properties": [ { - "$id": "231", + "$id": "230", "Name": "threshold", "SerializedName": "threshold", "Description": "Threshold of number of jobs ahead in the queue to for this trigger to fire.", "Type": { - "$id": "232", + "$id": "231", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -2020,7 +1995,7 @@ ] }, { - "$id": "233", + "$id": "232", "Name": "WaitTimeExceptionTrigger", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -2028,17 +2003,17 @@ "IsNullable": false, "DiscriminatorValue": "wait-time", "BaseModel": { - "$ref": "227" + "$ref": "226" }, "Usage": "Output", "Properties": [ { - "$id": "234", + "$id": "233", "Name": "thresholdSeconds", "SerializedName": "thresholdSeconds", "Description": "Threshold for wait time for this trigger.", "Type": { - "$id": "235", + "$id": "234", "Name": "float64", "Kind": "Float64", "IsNullable": false @@ -2054,21 +2029,15 @@ "IsReadOnly": false }, { - "$id": "236", + "$id": "235", "Name": "actions", "SerializedName": "actions", - "Description": "A dictionary collection of actions to perform once the exception is triggered.\nKey is the Id of each exception action.", + "Description": "A collection of actions to perform once the exception is triggered.", "Type": { - "$id": "237", - "Name": "Dictionary", - "KeyType": { - "$id": "238", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "ValueType": { - "$id": "239", + "$id": "236", + "Name": "Array", + "ElementType": { + "$id": "237", "Name": "ExceptionAction", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -2077,20 +2046,33 @@ "DiscriminatorPropertyName": "kind", "Usage": "Output", "Properties": [ + { + "$id": "238", + "Name": "id", + "SerializedName": "id", + "Description": "Unique Id of the exception action", + "Type": { + "$id": "239", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, { "$id": "240", "Name": "kind", "SerializedName": "kind", - "Description": "Discriminator", - "IsRequired": true, - "IsReadOnly": false, - "IsNullable": false, + "Description": "The type discriminator describing a sub-type of ExceptionAction", "Type": { "$id": "241", "Name": "string", "Kind": "String", "IsNullable": false }, + "IsRequired": true, + "IsReadOnly": false, "IsDiscriminator": true } ], @@ -2104,7 +2086,7 @@ "IsNullable": false, "DiscriminatorValue": "cancel", "BaseModel": { - "$ref": "239" + "$ref": "237" }, "Usage": "Output", "Properties": [ @@ -2147,7 +2129,7 @@ "IsNullable": false, "DiscriminatorValue": "manual-reclassify", "BaseModel": { - "$ref": "239" + "$ref": "237" }, "Usage": "Output", "Properties": [ @@ -2206,7 +2188,7 @@ "IsNullable": false, "DiscriminatorValue": "reclassify", "BaseModel": { - "$ref": "239" + "$ref": "237" }, "Usage": "Output", "Properties": [ @@ -2268,19 +2250,19 @@ ] }, { - "$ref": "225" + "$ref": "222" }, { - "$ref": "227" + "$ref": "226" }, { - "$ref": "230" + "$ref": "229" }, { - "$ref": "233" + "$ref": "232" }, { - "$ref": "239" + "$ref": "237" }, { "$ref": "242" @@ -2293,7 +2275,7 @@ }, { "$id": "261", - "Name": "PagedExceptionPolicyItem", + "Name": "PagedExceptionPolicy", "Namespace": "AzureCommunicationRoutingService", "Description": "A paged collection of exception policies.", "IsNullable": false, @@ -2303,44 +2285,12 @@ "$id": "262", "Name": "value", "SerializedName": "value", - "Description": "The ExceptionPolicyItem items on this page", + "Description": "The ExceptionPolicy items on this page", "Type": { "$id": "263", "Name": "Array", "ElementType": { - "$id": "264", - "Name": "ExceptionPolicyItem", - "Namespace": "AzureCommunicationRoutingService", - "Description": "Paged instance of ExceptionPolicy", - "IsNullable": false, - "Usage": "Output", - "Properties": [ - { - "$id": "265", - "Name": "exceptionPolicy", - "SerializedName": "exceptionPolicy", - "Description": "A policy that defines actions to execute when exception are triggered.", - "Type": { - "$ref": "217" - }, - "IsRequired": true, - "IsReadOnly": false - }, - { - "$id": "266", - "Name": "etag", - "SerializedName": "etag", - "Description": "(Optional) The Concurrency Token.", - "Type": { - "$id": "267", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - } - ] + "$ref": "213" }, "IsNullable": false }, @@ -2348,12 +2298,12 @@ "IsReadOnly": false }, { - "$id": "268", + "$id": "264", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "269", + "$id": "265", "Name": "string", "Kind": "String", "IsNullable": false @@ -2364,10 +2314,7 @@ ] }, { - "$ref": "264" - }, - { - "$id": "270", + "$id": "266", "Name": "RouterQueue", "Namespace": "AzureCommunicationRoutingService", "Description": "A queue that can contain jobs to be routed.", @@ -2375,12 +2322,26 @@ "Usage": "Output", "Properties": [ { - "$id": "271", + "$id": "267", + "Name": "etag", + "SerializedName": "etag", + "Description": "Concurrency Token.", + "Type": { + "$id": "268", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "269", "Name": "id", "SerializedName": "id", "Description": "The Id of this queue", "Type": { - "$id": "272", + "$id": "270", "Name": "string", "Kind": "String", "IsNullable": false @@ -2389,12 +2350,12 @@ "IsReadOnly": true }, { - "$id": "273", + "$id": "271", "Name": "name", "SerializedName": "name", "Description": "The name of this queue.", "Type": { - "$id": "274", + "$id": "272", "Name": "string", "Kind": "String", "IsNullable": false @@ -2403,12 +2364,12 @@ "IsReadOnly": false }, { - "$id": "275", + "$id": "273", "Name": "distributionPolicyId", "SerializedName": "distributionPolicyId", "Description": "The ID of the distribution policy that will determine how a job is distributed\nto workers.", "Type": { - "$id": "276", + "$id": "274", "Name": "string", "Kind": "String", "IsNullable": false @@ -2417,21 +2378,21 @@ "IsReadOnly": false }, { - "$id": "277", + "$id": "275", "Name": "labels", "SerializedName": "labels", "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", "Type": { - "$id": "278", + "$id": "276", "Name": "Dictionary", "KeyType": { - "$id": "279", + "$id": "277", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "280", + "$id": "278", "Name": "Intrinsic", "Kind": "unknown", "IsNullable": false @@ -2442,12 +2403,12 @@ "IsReadOnly": false }, { - "$id": "281", + "$id": "279", "Name": "exceptionPolicyId", "SerializedName": "exceptionPolicyId", "Description": "(Optional) The ID of the exception policy that determines various job\nescalation rules.", "Type": { - "$id": "282", + "$id": "280", "Name": "string", "Kind": "String", "IsNullable": false @@ -2458,55 +2419,23 @@ ] }, { - "$id": "283", - "Name": "PagedRouterQueueItem", + "$id": "281", + "Name": "PagedRouterQueue", "Namespace": "AzureCommunicationRoutingService", "Description": "A paged collection of queues.", "IsNullable": false, "Usage": "Output", "Properties": [ { - "$id": "284", + "$id": "282", "Name": "value", "SerializedName": "value", - "Description": "The RouterQueueItem items on this page", + "Description": "The RouterQueue items on this page", "Type": { - "$id": "285", + "$id": "283", "Name": "Array", "ElementType": { - "$id": "286", - "Name": "RouterQueueItem", - "Namespace": "AzureCommunicationRoutingService", - "Description": "Paged instance of RouterQueue", - "IsNullable": false, - "Usage": "Output", - "Properties": [ - { - "$id": "287", - "Name": "queue", - "SerializedName": "queue", - "Description": "A queue that can contain jobs to be routed.", - "Type": { - "$ref": "270" - }, - "IsRequired": true, - "IsReadOnly": false - }, - { - "$id": "288", - "Name": "etag", - "SerializedName": "etag", - "Description": "(Optional) The Concurrency Token.", - "Type": { - "$id": "289", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - } - ] + "$ref": "266" }, "IsNullable": false }, @@ -2514,12 +2443,12 @@ "IsReadOnly": false }, { - "$id": "290", + "$id": "284", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "291", + "$id": "285", "Name": "string", "Kind": "String", "IsNullable": false @@ -2530,10 +2459,7 @@ ] }, { - "$ref": "286" - }, - { - "$id": "292", + "$id": "286", "Name": "RouterJob", "Namespace": "AzureCommunicationRoutingService", "Description": "A unit of work to be routed", @@ -2541,12 +2467,26 @@ "Usage": "Output", "Properties": [ { - "$id": "293", + "$id": "287", + "Name": "etag", + "SerializedName": "etag", + "Description": "Concurrency Token.", + "Type": { + "$id": "288", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "289", "Name": "id", "SerializedName": "id", "Description": "The id of the job.", "Type": { - "$id": "294", + "$id": "290", "Name": "string", "Kind": "String", "IsNullable": false @@ -2555,12 +2495,12 @@ "IsReadOnly": true }, { - "$id": "295", + "$id": "291", "Name": "channelReference", "SerializedName": "channelReference", "Description": "Reference to an external parent context, eg. call ID.", "Type": { - "$id": "296", + "$id": "292", "Name": "string", "Kind": "String", "IsNullable": false @@ -2569,7 +2509,7 @@ "IsReadOnly": false }, { - "$id": "297", + "$id": "293", "Name": "status", "SerializedName": "status", "Description": "The status of the Job.", @@ -2580,12 +2520,12 @@ "IsReadOnly": true }, { - "$id": "298", + "$id": "294", "Name": "enqueuedAt", "SerializedName": "enqueuedAt", "Description": "The time a job was queued in UTC.", "Type": { - "$id": "299", + "$id": "295", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -2594,12 +2534,12 @@ "IsReadOnly": true }, { - "$id": "300", + "$id": "296", "Name": "channelId", "SerializedName": "channelId", "Description": "The channel identifier. eg. voice, chat, etc.", "Type": { - "$id": "301", + "$id": "297", "Name": "string", "Kind": "String", "IsNullable": false @@ -2608,12 +2548,12 @@ "IsReadOnly": false }, { - "$id": "302", + "$id": "298", "Name": "classificationPolicyId", "SerializedName": "classificationPolicyId", "Description": "The Id of the Classification policy used for classifying a job.", "Type": { - "$id": "303", + "$id": "299", "Name": "string", "Kind": "String", "IsNullable": false @@ -2622,12 +2562,12 @@ "IsReadOnly": false }, { - "$id": "304", + "$id": "300", "Name": "queueId", "SerializedName": "queueId", "Description": "The Id of the Queue that this job is queued to.", "Type": { - "$id": "305", + "$id": "301", "Name": "string", "Kind": "String", "IsNullable": false @@ -2636,12 +2576,12 @@ "IsReadOnly": false }, { - "$id": "306", + "$id": "302", "Name": "priority", "SerializedName": "priority", "Description": "The priority of this job.", "Type": { - "$id": "307", + "$id": "303", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -2650,12 +2590,12 @@ "IsReadOnly": false }, { - "$id": "308", + "$id": "304", "Name": "dispositionCode", "SerializedName": "dispositionCode", "Description": "Reason code for cancelled or closed jobs.", "Type": { - "$id": "309", + "$id": "305", "Name": "string", "Kind": "String", "IsNullable": false @@ -2664,12 +2604,12 @@ "IsReadOnly": false }, { - "$id": "310", + "$id": "306", "Name": "requestedWorkerSelectors", "SerializedName": "requestedWorkerSelectors", "Description": "A collection of manually specified label selectors, which a worker must satisfy\nin order to process this job.", "Type": { - "$id": "311", + "$id": "307", "Name": "Array", "ElementType": { "$ref": "177" @@ -2680,12 +2620,12 @@ "IsReadOnly": false }, { - "$id": "312", + "$id": "308", "Name": "attachedWorkerSelectors", "SerializedName": "attachedWorkerSelectors", "Description": "A collection of label selectors attached by a classification policy, which a\nworker must satisfy in order to process this job.", "Type": { - "$id": "313", + "$id": "309", "Name": "Array", "ElementType": { "$ref": "177" @@ -2696,21 +2636,21 @@ "IsReadOnly": true }, { - "$id": "314", + "$id": "310", "Name": "labels", "SerializedName": "labels", "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", "Type": { - "$id": "315", + "$id": "311", "Name": "Dictionary", "KeyType": { - "$id": "316", + "$id": "312", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "317", + "$id": "313", "Name": "Intrinsic", "Kind": "unknown", "IsNullable": false @@ -2721,21 +2661,21 @@ "IsReadOnly": false }, { - "$id": "318", + "$id": "314", "Name": "assignments", "SerializedName": "assignments", "Description": "A collection of the assignments of the job.\nKey is AssignmentId.", "Type": { - "$id": "319", + "$id": "315", "Name": "Dictionary", "KeyType": { - "$id": "320", + "$id": "316", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "321", + "$id": "317", "Name": "RouterJobAssignment", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -2744,12 +2684,12 @@ "Usage": "Output", "Properties": [ { - "$id": "322", + "$id": "318", "Name": "assignmentId", "SerializedName": "assignmentId", "Description": "The Id of the job assignment.", "Type": { - "$id": "323", + "$id": "319", "Name": "string", "Kind": "String", "IsNullable": false @@ -2758,12 +2698,12 @@ "IsReadOnly": false }, { - "$id": "324", + "$id": "320", "Name": "workerId", "SerializedName": "workerId", "Description": "The Id of the Worker assigned to the job.", "Type": { - "$id": "325", + "$id": "321", "Name": "string", "Kind": "String", "IsNullable": false @@ -2772,12 +2712,12 @@ "IsReadOnly": false }, { - "$id": "326", + "$id": "322", "Name": "assignedAt", "SerializedName": "assignedAt", "Description": "The assignment time of the job in UTC.", "Type": { - "$id": "327", + "$id": "323", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -2786,12 +2726,12 @@ "IsReadOnly": false }, { - "$id": "328", + "$id": "324", "Name": "completedAt", "SerializedName": "completedAt", "Description": "The time the job was marked as completed after being assigned in UTC.", "Type": { - "$id": "329", + "$id": "325", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -2800,12 +2740,12 @@ "IsReadOnly": false }, { - "$id": "330", + "$id": "326", "Name": "closedAt", "SerializedName": "closedAt", "Description": "The time the job was marked as closed after being completed in UTC.", "Type": { - "$id": "331", + "$id": "327", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -2821,21 +2761,21 @@ "IsReadOnly": true }, { - "$id": "332", + "$id": "328", "Name": "tags", "SerializedName": "tags", "Description": "A set of non-identifying attributes attached to this job", "Type": { - "$id": "333", + "$id": "329", "Name": "Dictionary", "KeyType": { - "$id": "334", + "$id": "330", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "335", + "$id": "331", "Name": "Intrinsic", "Kind": "unknown", "IsNullable": false @@ -2846,24 +2786,51 @@ "IsReadOnly": false }, { - "$id": "336", + "$id": "332", "Name": "notes", "SerializedName": "notes", "Description": "Notes attached to a job, sorted by timestamp", "Type": { - "$id": "337", - "Name": "Dictionary", - "KeyType": { - "$id": "338", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "ValueType": { - "$id": "339", - "Name": "string", - "Kind": "String", - "IsNullable": false + "$id": "333", + "Name": "Array", + "ElementType": { + "$id": "334", + "Name": "RouterJobNote", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "A note attached to a job.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "335", + "Name": "message", + "SerializedName": "message", + "Description": "The message contained in the note.", + "Type": { + "$id": "336", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "337", + "Name": "addedAt", + "SerializedName": "addedAt", + "Description": "The time at which the note was added in UTC. If not provided, will default to the current time.", + "Type": { + "$id": "338", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] }, "IsNullable": false }, @@ -2871,12 +2838,12 @@ "IsReadOnly": false }, { - "$id": "340", + "$id": "339", "Name": "scheduledAt", "SerializedName": "scheduledAt", "Description": "If set, job will be scheduled to be enqueued at a given time", "Type": { - "$id": "341", + "$id": "340", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -2885,12 +2852,12 @@ "IsReadOnly": true }, { - "$id": "342", + "$id": "341", "Name": "matchingMode", "SerializedName": "matchingMode", "Description": "The matching mode to be applied to this job.\n \nSupported types:\n \n \nQueueAndMatchMode: Used when matching worker to a job is required to be\ndone right after job is queued.\nScheduleAndSuspendMode: Used for scheduling\njobs to be queued at a future time. At specified time, matching of a worker to\nthe job will not start automatically.\nSuspendMode: Used when matching workers\nto a job needs to be suspended.", "Type": { - "$id": "343", + "$id": "342", "Name": "JobMatchingMode", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -2900,25 +2867,24 @@ "Usage": "Output", "Properties": [ { - "$id": "344", + "$id": "343", "Name": "kind", "SerializedName": "kind", - "Description": "Discriminator", - "IsRequired": true, - "IsReadOnly": false, - "IsNullable": false, + "Description": "The type discriminator describing a sub-type of JobMatchingMode", "Type": { - "$id": "345", + "$id": "344", "Name": "string", "Kind": "String", "IsNullable": false }, + "IsRequired": true, + "IsReadOnly": false, "IsDiscriminator": true } ], "DerivedModels": [ { - "$id": "346", + "$id": "345", "Name": "ScheduleAndSuspendMode", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -2926,17 +2892,17 @@ "IsNullable": false, "DiscriminatorValue": "schedule-and-suspend", "BaseModel": { - "$ref": "343" + "$ref": "342" }, "Usage": "Output", "Properties": [ { - "$id": "347", + "$id": "346", "Name": "scheduleAt", "SerializedName": "scheduleAt", "Description": "Scheduled time.", "Type": { - "$id": "348", + "$id": "347", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -2947,7 +2913,7 @@ ] }, { - "$id": "349", + "$id": "348", "Name": "QueueAndMatchMode", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -2955,13 +2921,13 @@ "IsNullable": false, "DiscriminatorValue": "queue-and-match", "BaseModel": { - "$ref": "343" + "$ref": "342" }, "Usage": "Output", "Properties": [] }, { - "$id": "350", + "$id": "349", "Name": "SuspendMode", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -2969,7 +2935,7 @@ "IsNullable": false, "DiscriminatorValue": "suspend", "BaseModel": { - "$ref": "343" + "$ref": "342" }, "Usage": "Output", "Properties": [] @@ -2982,35 +2948,38 @@ ] }, { - "$ref": "321" + "$ref": "317" }, { - "$ref": "343" + "$ref": "334" }, { - "$ref": "346" + "$ref": "342" }, { - "$ref": "349" + "$ref": "345" }, { - "$ref": "350" + "$ref": "348" }, { - "$id": "351", - "Name": "CancelJobRequest", + "$ref": "349" + }, + { + "$id": "350", + "Name": "CancelJobOptions", "Namespace": "AzureCommunicationRoutingService", "Description": "Request payload for deleting a job", "IsNullable": false, "Usage": "Input", "Properties": [ { - "$id": "352", + "$id": "351", "Name": "note", "SerializedName": "note", "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", "Type": { - "$id": "353", + "$id": "352", "Name": "string", "Kind": "String", "IsNullable": false @@ -3019,12 +2988,12 @@ "IsReadOnly": false }, { - "$id": "354", + "$id": "353", "Name": "dispositionCode", "SerializedName": "dispositionCode", "Description": "Indicates the outcome of the job, populate this field with your own custom\nvalues.\nIf not provided, default value of \"Cancelled\" is set.", "Type": { - "$id": "355", + "$id": "354", "Name": "string", "Kind": "String", "IsNullable": false @@ -3035,20 +3004,20 @@ ] }, { - "$id": "356", - "Name": "CompleteJobRequest", + "$id": "355", + "Name": "CompleteJobOptions", "Namespace": "AzureCommunicationRoutingService", "Description": "Request payload for completing jobs", "IsNullable": false, "Usage": "Input", "Properties": [ { - "$id": "357", + "$id": "356", "Name": "assignmentId", "SerializedName": "assignmentId", "Description": "The assignment within the job to complete.", "Type": { - "$id": "358", + "$id": "357", "Name": "string", "Kind": "String", "IsNullable": false @@ -3057,12 +3026,12 @@ "IsReadOnly": false }, { - "$id": "359", + "$id": "358", "Name": "note", "SerializedName": "note", "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", "Type": { - "$id": "360", + "$id": "359", "Name": "string", "Kind": "String", "IsNullable": false @@ -3073,20 +3042,20 @@ ] }, { - "$id": "361", - "Name": "CloseJobRequest", + "$id": "360", + "Name": "CloseJobOptions", "Namespace": "AzureCommunicationRoutingService", "Description": "Request payload for closing jobs", "IsNullable": false, "Usage": "Input", "Properties": [ { - "$id": "362", + "$id": "361", "Name": "assignmentId", "SerializedName": "assignmentId", "Description": "The assignment within which the job is to be closed.", "Type": { - "$id": "363", + "$id": "362", "Name": "string", "Kind": "String", "IsNullable": false @@ -3095,12 +3064,12 @@ "IsReadOnly": false }, { - "$id": "364", + "$id": "363", "Name": "dispositionCode", "SerializedName": "dispositionCode", "Description": "Indicates the outcome of the job, populate this field with your own custom\nvalues.", "Type": { - "$id": "365", + "$id": "364", "Name": "string", "Kind": "String", "IsNullable": false @@ -3109,12 +3078,12 @@ "IsReadOnly": false }, { - "$id": "366", + "$id": "365", "Name": "closeAt", "SerializedName": "closeAt", "Description": "If not provided, worker capacity is released immediately along with a\nJobClosedEvent notification.\nIf provided, worker capacity is released along\nwith a JobClosedEvent notification at a future time in UTC.", "Type": { - "$id": "367", + "$id": "366", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -3123,12 +3092,12 @@ "IsReadOnly": false }, { - "$id": "368", + "$id": "367", "Name": "note", "SerializedName": "note", "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", "Type": { - "$id": "369", + "$id": "368", "Name": "string", "Kind": "String", "IsNullable": false @@ -3139,55 +3108,23 @@ ] }, { - "$id": "370", - "Name": "PagedRouterJobItem", + "$id": "369", + "Name": "PagedRouterJob", "Namespace": "AzureCommunicationRoutingService", "Description": "A paged collection of jobs.", "IsNullable": false, "Usage": "Output", "Properties": [ { - "$id": "371", + "$id": "370", "Name": "value", "SerializedName": "value", - "Description": "The RouterJobItem items on this page", + "Description": "The RouterJob items on this page", "Type": { - "$id": "372", + "$id": "371", "Name": "Array", "ElementType": { - "$id": "373", - "Name": "RouterJobItem", - "Namespace": "AzureCommunicationRoutingService", - "Description": "Paged instance of RouterJob", - "IsNullable": false, - "Usage": "Output", - "Properties": [ - { - "$id": "374", - "Name": "job", - "SerializedName": "job", - "Description": "A unit of work to be routed", - "Type": { - "$ref": "292" - }, - "IsRequired": true, - "IsReadOnly": false - }, - { - "$id": "375", - "Name": "etag", - "SerializedName": "etag", - "Description": "(Optional) The Concurrency Token.", - "Type": { - "$id": "376", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - } - ] + "$ref": "286" }, "IsNullable": false }, @@ -3195,12 +3132,12 @@ "IsReadOnly": false }, { - "$id": "377", + "$id": "372", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "378", + "$id": "373", "Name": "string", "Kind": "String", "IsNullable": false @@ -3211,10 +3148,7 @@ ] }, { - "$ref": "373" - }, - { - "$id": "379", + "$id": "374", "Name": "RouterJobPositionDetails", "Namespace": "AzureCommunicationRoutingService", "Description": "Position and estimated wait time for a job.", @@ -3222,12 +3156,12 @@ "Usage": "Output", "Properties": [ { - "$id": "380", + "$id": "375", "Name": "jobId", "SerializedName": "jobId", "Description": "Id of the job these details are about.", "Type": { - "$id": "381", + "$id": "376", "Name": "string", "Kind": "String", "IsNullable": false @@ -3236,12 +3170,12 @@ "IsReadOnly": false }, { - "$id": "382", + "$id": "377", "Name": "position", "SerializedName": "position", "Description": "Position of the job in question within that queue.", "Type": { - "$id": "383", + "$id": "378", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3250,12 +3184,12 @@ "IsReadOnly": false }, { - "$id": "384", + "$id": "379", "Name": "queueId", "SerializedName": "queueId", "Description": "Id of the queue this job is enqueued in.", "Type": { - "$id": "385", + "$id": "380", "Name": "string", "Kind": "String", "IsNullable": false @@ -3264,12 +3198,12 @@ "IsReadOnly": false }, { - "$id": "386", + "$id": "381", "Name": "queueLength", "SerializedName": "queueLength", "Description": "Length of the queue: total number of enqueued jobs.", "Type": { - "$id": "387", + "$id": "382", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3278,12 +3212,12 @@ "IsReadOnly": false }, { - "$id": "388", + "$id": "383", "Name": "estimatedWaitTimeMinutes", "SerializedName": "estimatedWaitTimeMinutes", "Description": "Estimated wait time of the job rounded up to the nearest minute", "Type": { - "$id": "389", + "$id": "384", "Name": "float64", "Kind": "Float64", "IsNullable": false @@ -3294,20 +3228,20 @@ ] }, { - "$id": "390", - "Name": "UnassignJobRequest", + "$id": "385", + "Name": "UnassignJobOptions", "Namespace": "AzureCommunicationRoutingService", "Description": "Request payload for unassigning a job.", "IsNullable": false, "Usage": "Input", "Properties": [ { - "$id": "391", + "$id": "386", "Name": "suspendMatching", "SerializedName": "suspendMatching", "Description": "If SuspendMatching is true, then the job is not queued for re-matching with a\nworker.", "Type": { - "$id": "392", + "$id": "387", "Name": "boolean", "Kind": "Boolean", "IsNullable": false @@ -3318,7 +3252,7 @@ ] }, { - "$id": "393", + "$id": "388", "Name": "UnassignJobResult", "Namespace": "AzureCommunicationRoutingService", "Description": "Response payload after a job has been successfully unassigned.", @@ -3326,12 +3260,12 @@ "Usage": "Output", "Properties": [ { - "$id": "394", + "$id": "389", "Name": "jobId", "SerializedName": "jobId", "Description": "The Id of the job unassigned.", "Type": { - "$id": "395", + "$id": "390", "Name": "string", "Kind": "String", "IsNullable": false @@ -3340,12 +3274,12 @@ "IsReadOnly": false }, { - "$id": "396", + "$id": "391", "Name": "unassignmentCount", "SerializedName": "unassignmentCount", "Description": "The number of times a job is unassigned. At a maximum 3.", "Type": { - "$id": "397", + "$id": "392", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3356,7 +3290,7 @@ ] }, { - "$id": "398", + "$id": "393", "Name": "AcceptJobOfferResult", "Namespace": "AzureCommunicationRoutingService", "Description": "Response containing Id's for the worker, job, and assignment from an accepted\noffer", @@ -3364,12 +3298,12 @@ "Usage": "Output", "Properties": [ { - "$id": "399", + "$id": "394", "Name": "assignmentId", "SerializedName": "assignmentId", "Description": "The assignment Id that assigns a worker that has accepted an offer to a job.", "Type": { - "$id": "400", + "$id": "395", "Name": "string", "Kind": "String", "IsNullable": false @@ -3378,12 +3312,12 @@ "IsReadOnly": false }, { - "$id": "401", + "$id": "396", "Name": "jobId", "SerializedName": "jobId", "Description": "The Id of the job assigned.", "Type": { - "$id": "402", + "$id": "397", "Name": "string", "Kind": "String", "IsNullable": false @@ -3392,12 +3326,12 @@ "IsReadOnly": false }, { - "$id": "403", + "$id": "398", "Name": "workerId", "SerializedName": "workerId", "Description": "The Id of the worker that has been assigned this job.", "Type": { - "$id": "404", + "$id": "399", "Name": "string", "Kind": "String", "IsNullable": false @@ -3408,20 +3342,20 @@ ] }, { - "$id": "405", - "Name": "DeclineJobOfferRequest", + "$id": "400", + "Name": "DeclineJobOfferOptions", "Namespace": "AzureCommunicationRoutingService", "Description": "Request payload for declining offers", "IsNullable": false, "Usage": "Input", "Properties": [ { - "$id": "406", + "$id": "401", "Name": "retryOfferAt", "SerializedName": "retryOfferAt", "Description": "If the RetryOfferAt is not provided, then this job will not be offered again to\nthe worker who declined this job unless\nthe worker is de-registered and\nre-registered. If a RetryOfferAt time is provided, then the job will be\nre-matched to\neligible workers at the retry time in UTC. The worker that\ndeclined the job will also be eligible for the job at that time.", "Type": { - "$id": "407", + "$id": "402", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -3432,7 +3366,7 @@ ] }, { - "$id": "408", + "$id": "403", "Name": "RouterQueueStatistics", "Namespace": "AzureCommunicationRoutingService", "Description": "Statistics for the queue", @@ -3440,12 +3374,12 @@ "Usage": "Output", "Properties": [ { - "$id": "409", + "$id": "404", "Name": "queueId", "SerializedName": "queueId", "Description": "Id of the queue these details are about.", "Type": { - "$id": "410", + "$id": "405", "Name": "string", "Kind": "String", "IsNullable": false @@ -3454,12 +3388,12 @@ "IsReadOnly": false }, { - "$id": "411", + "$id": "406", "Name": "length", "SerializedName": "length", "Description": "Length of the queue: total number of enqueued jobs.", "Type": { - "$id": "412", + "$id": "407", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3468,21 +3402,21 @@ "IsReadOnly": false }, { - "$id": "413", + "$id": "408", "Name": "estimatedWaitTimeMinutes", "SerializedName": "estimatedWaitTimeMinutes", "Description": "The estimated wait time of this queue rounded up to the nearest minute, grouped\nby job priority", "Type": { - "$id": "414", + "$id": "409", "Name": "Dictionary", "KeyType": { - "$id": "415", + "$id": "410", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "416", + "$id": "411", "Name": "float64", "Kind": "Float64", "IsNullable": false @@ -3493,12 +3427,12 @@ "IsReadOnly": false }, { - "$id": "417", + "$id": "412", "Name": "longestJobWaitTimeMinutes", "SerializedName": "longestJobWaitTimeMinutes", "Description": "The wait time of the job that has been enqueued in this queue for the longest.", "Type": { - "$id": "418", + "$id": "413", "Name": "float64", "Kind": "Float64", "IsNullable": false @@ -3509,7 +3443,7 @@ ] }, { - "$id": "419", + "$id": "414", "Name": "RouterWorker", "Namespace": "AzureCommunicationRoutingService", "Description": "An entity for jobs to be routed to", @@ -3517,12 +3451,26 @@ "Usage": "Output", "Properties": [ { - "$id": "420", + "$id": "415", + "Name": "etag", + "SerializedName": "etag", + "Description": "Concurrency Token.", + "Type": { + "$id": "416", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "417", "Name": "id", "SerializedName": "id", "Description": "Id of the worker.", "Type": { - "$id": "421", + "$id": "418", "Name": "string", "Kind": "String", "IsNullable": false @@ -3531,7 +3479,7 @@ "IsReadOnly": true }, { - "$id": "422", + "$id": "419", "Name": "state", "SerializedName": "state", "Description": "The current state of the worker.", @@ -3542,41 +3490,31 @@ "IsReadOnly": true }, { - "$id": "423", - "Name": "queueAssignments", - "SerializedName": "queueAssignments", + "$id": "420", + "Name": "queues", + "SerializedName": "queues", "Description": "The queue(s) that this worker can receive work from.", "Type": { - "$id": "424", - "Name": "Dictionary", - "KeyType": { - "$id": "425", + "$id": "421", + "Name": "Array", + "ElementType": { + "$id": "422", "Name": "string", "Kind": "String", "IsNullable": false }, - "ValueType": { - "$id": "426", - "Name": "RouterQueueAssignment", - "Namespace": "AzureCommunicationRoutingService", - "Accessibility": "internal", - "Description": "An assignment of a worker to a queue", - "IsNullable": false, - "Usage": "Output", - "Properties": [] - }, "IsNullable": false }, "IsRequired": false, "IsReadOnly": false }, { - "$id": "427", - "Name": "totalCapacity", - "SerializedName": "totalCapacity", + "$id": "423", + "Name": "capacity", + "SerializedName": "capacity", "Description": "The total capacity score this worker has to manage multiple concurrent jobs.", "Type": { - "$id": "428", + "$id": "424", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3585,21 +3523,21 @@ "IsReadOnly": false }, { - "$id": "429", + "$id": "425", "Name": "labels", "SerializedName": "labels", "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", "Type": { - "$id": "430", + "$id": "426", "Name": "Dictionary", "KeyType": { - "$id": "431", + "$id": "427", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "432", + "$id": "428", "Name": "Intrinsic", "Kind": "unknown", "IsNullable": false @@ -3610,21 +3548,21 @@ "IsReadOnly": false }, { - "$id": "433", + "$id": "429", "Name": "tags", "SerializedName": "tags", "Description": "A set of non-identifying attributes attached to this worker.", "Type": { - "$id": "434", + "$id": "430", "Name": "Dictionary", "KeyType": { - "$id": "435", + "$id": "431", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "436", + "$id": "432", "Name": "Intrinsic", "Kind": "unknown", "IsNullable": false @@ -3635,22 +3573,16 @@ "IsReadOnly": false }, { - "$id": "437", - "Name": "channelConfigurations", - "SerializedName": "channelConfigurations", + "$id": "433", + "Name": "channels", + "SerializedName": "channels", "Description": "The channel(s) this worker can handle and their impact on the workers capacity.", "Type": { - "$id": "438", - "Name": "Dictionary", - "KeyType": { - "$id": "439", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "ValueType": { - "$id": "440", - "Name": "ChannelConfiguration", + "$id": "434", + "Name": "Array", + "ElementType": { + "$id": "435", + "Name": "RouterChannel", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", "Description": "Represents the capacity a job in this channel will consume from a worker", @@ -3658,12 +3590,26 @@ "Usage": "Output", "Properties": [ { - "$id": "441", + "$id": "436", + "Name": "channelId", + "SerializedName": "channelId", + "Description": "Id of the channel.", + "Type": { + "$id": "437", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "438", "Name": "capacityCostPerJob", "SerializedName": "capacityCostPerJob", "Description": "The amount of capacity that an instance of a job of this channel will consume\nof the total worker capacity.", "Type": { - "$id": "442", + "$id": "439", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3672,12 +3618,12 @@ "IsReadOnly": false }, { - "$id": "443", + "$id": "440", "Name": "maxNumberOfJobs", "SerializedName": "maxNumberOfJobs", "Description": "The maximum number of jobs that can be supported concurrently for this channel.", "Type": { - "$id": "444", + "$id": "441", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3693,15 +3639,15 @@ "IsReadOnly": false }, { - "$id": "445", + "$id": "442", "Name": "offers", "SerializedName": "offers", "Description": "A list of active offers issued to this worker.", "Type": { - "$id": "446", + "$id": "443", "Name": "Array", "ElementType": { - "$id": "447", + "$id": "444", "Name": "RouterJobOffer", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -3710,12 +3656,12 @@ "Usage": "Output", "Properties": [ { - "$id": "448", + "$id": "445", "Name": "offerId", "SerializedName": "offerId", "Description": "The Id of the offer.", "Type": { - "$id": "449", + "$id": "446", "Name": "string", "Kind": "String", "IsNullable": false @@ -3724,12 +3670,12 @@ "IsReadOnly": false }, { - "$id": "450", + "$id": "447", "Name": "jobId", "SerializedName": "jobId", "Description": "The Id of the job.", "Type": { - "$id": "451", + "$id": "448", "Name": "string", "Kind": "String", "IsNullable": false @@ -3738,12 +3684,12 @@ "IsReadOnly": false }, { - "$id": "452", + "$id": "449", "Name": "capacityCost", "SerializedName": "capacityCost", "Description": "The capacity cost consumed by the job offer.", "Type": { - "$id": "453", + "$id": "450", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3752,12 +3698,12 @@ "IsReadOnly": false }, { - "$id": "454", + "$id": "451", "Name": "offeredAt", "SerializedName": "offeredAt", "Description": "The time the offer was created in UTC.", "Type": { - "$id": "455", + "$id": "452", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -3766,12 +3712,12 @@ "IsReadOnly": false }, { - "$id": "456", + "$id": "453", "Name": "expiresAt", "SerializedName": "expiresAt", "Description": "The time that the offer will expire in UTC.", "Type": { - "$id": "457", + "$id": "454", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -3787,15 +3733,15 @@ "IsReadOnly": true }, { - "$id": "458", + "$id": "455", "Name": "assignedJobs", "SerializedName": "assignedJobs", "Description": "A list of assigned jobs attached to this worker.", "Type": { - "$id": "459", + "$id": "456", "Name": "Array", "ElementType": { - "$id": "460", + "$id": "457", "Name": "RouterWorkerAssignment", "Namespace": "AzureCommunicationRoutingService", "Accessibility": "internal", @@ -3804,12 +3750,12 @@ "Usage": "Output", "Properties": [ { - "$id": "461", + "$id": "458", "Name": "assignmentId", "SerializedName": "assignmentId", "Description": "The Id of the assignment.", "Type": { - "$id": "462", + "$id": "459", "Name": "string", "Kind": "String", "IsNullable": false @@ -3818,12 +3764,12 @@ "IsReadOnly": false }, { - "$id": "463", + "$id": "460", "Name": "jobId", "SerializedName": "jobId", "Description": "The Id of the Job assigned.", "Type": { - "$id": "464", + "$id": "461", "Name": "string", "Kind": "String", "IsNullable": false @@ -3832,12 +3778,12 @@ "IsReadOnly": false }, { - "$id": "465", + "$id": "462", "Name": "capacityCost", "SerializedName": "capacityCost", "Description": "The amount of capacity this assignment has consumed on the worker.", "Type": { - "$id": "466", + "$id": "463", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -3846,12 +3792,12 @@ "IsReadOnly": false }, { - "$id": "467", + "$id": "464", "Name": "assignedAt", "SerializedName": "assignedAt", "Description": "The assignment time of the job in UTC.", "Type": { - "$id": "468", + "$id": "465", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -3867,12 +3813,12 @@ "IsReadOnly": true }, { - "$id": "469", + "$id": "466", "Name": "loadRatio", "SerializedName": "loadRatio", "Description": "A value indicating the workers capacity. A value of '1' means all capacity is\nconsumed. A value of '0' means no capacity is currently consumed.", "Type": { - "$id": "470", + "$id": "467", "Name": "float64", "Kind": "Float64", "IsNullable": false @@ -3881,12 +3827,12 @@ "IsReadOnly": true }, { - "$id": "471", + "$id": "468", "Name": "availableForOffers", "SerializedName": "availableForOffers", "Description": "A flag indicating this worker is open to receive offers or not.", "Type": { - "$id": "472", + "$id": "469", "Name": "boolean", "Kind": "Boolean", "IsNullable": false @@ -3897,67 +3843,32 @@ ] }, { - "$ref": "426" + "$ref": "435" }, { - "$ref": "440" + "$ref": "444" }, { - "$ref": "447" + "$ref": "457" }, { - "$ref": "460" - }, - { - "$id": "473", - "Name": "PagedRouterWorkerItem", + "$id": "470", + "Name": "PagedRouterWorker", "Namespace": "AzureCommunicationRoutingService", "Description": "A paged collection of workers.", "IsNullable": false, "Usage": "Output", "Properties": [ { - "$id": "474", + "$id": "471", "Name": "value", "SerializedName": "value", - "Description": "The RouterWorkerItem items on this page", + "Description": "The RouterWorker items on this page", "Type": { - "$id": "475", + "$id": "472", "Name": "Array", "ElementType": { - "$id": "476", - "Name": "RouterWorkerItem", - "Namespace": "AzureCommunicationRoutingService", - "Description": "Paged instance of RouterWorker", - "IsNullable": false, - "Usage": "Output", - "Properties": [ - { - "$id": "477", - "Name": "worker", - "SerializedName": "worker", - "Description": "An entity for jobs to be routed to", - "Type": { - "$ref": "419" - }, - "IsRequired": true, - "IsReadOnly": false - }, - { - "$id": "478", - "Name": "etag", - "SerializedName": "etag", - "Description": "(Optional) The Concurrency Token.", - "Type": { - "$id": "479", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - } - ] + "$ref": "414" }, "IsNullable": false }, @@ -3965,12 +3876,12 @@ "IsReadOnly": false }, { - "$id": "480", + "$id": "473", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "481", + "$id": "474", "Name": "string", "Kind": "String", "IsNullable": false @@ -3981,10 +3892,7 @@ ] }, { - "$ref": "476" - }, - { - "$id": "482", + "$id": "475", "Name": "RouterConditionalRequestHeaders", "Namespace": "AzureCommunicationRoutingService", "Description": "Provides the 'If-*' headers to enable conditional (cached) responses for JobRouter.", @@ -3993,7 +3901,7 @@ "Properties": [] }, { - "$id": "483", + "$id": "476", "Name": "LastModifiedResponseEnvelope", "Namespace": "AzureCommunicationRoutingService", "Description": "Provides the 'Last-Modified' header to enable conditional (cached) requests", @@ -4002,7 +3910,31 @@ "Properties": [] }, { - "$id": "484", + "$id": "477", + "Name": "RouterPageableEntity", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Base class for all pageable entities", + "IsNullable": false, + "Usage": "None", + "Properties": [ + { + "$id": "478", + "Name": "etag", + "SerializedName": "etag", + "Description": "Concurrency Token.", + "Type": { + "$id": "479", + "Name": "eTag", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + } + ] + }, + { + "$id": "480", "Name": "ListClassificationPoliciesQueryParams", "Namespace": "AzureCommunicationRoutingService", "IsNullable": false, @@ -4010,7 +3942,7 @@ "Properties": [] }, { - "$id": "485", + "$id": "481", "Name": "ListDistributionPoliciesQueryParams", "Namespace": "AzureCommunicationRoutingService", "IsNullable": false, @@ -4018,7 +3950,7 @@ "Properties": [] }, { - "$id": "486", + "$id": "482", "Name": "ListExceptionPoliciesQueryParams", "Namespace": "AzureCommunicationRoutingService", "IsNullable": false, @@ -4026,7 +3958,7 @@ "Properties": [] }, { - "$id": "487", + "$id": "483", "Name": "ListQueuesQueryParams", "Namespace": "AzureCommunicationRoutingService", "IsNullable": false, @@ -4034,7 +3966,7 @@ "Properties": [] }, { - "$id": "488", + "$id": "484", "Name": "ReclassifyJobResult", "Namespace": "AzureCommunicationRoutingService", "Description": "Response payload from reclassifying a job", @@ -4043,7 +3975,7 @@ "Properties": [] }, { - "$id": "489", + "$id": "485", "Name": "CancelJobResult", "Namespace": "AzureCommunicationRoutingService", "Description": "Response payload from cancelling a job", @@ -4052,7 +3984,7 @@ "Properties": [] }, { - "$id": "490", + "$id": "486", "Name": "CompleteJobResult", "Namespace": "AzureCommunicationRoutingService", "Description": "Response payload from completing a job", @@ -4061,7 +3993,7 @@ "Properties": [] }, { - "$id": "491", + "$id": "487", "Name": "CloseJobResult", "Namespace": "AzureCommunicationRoutingService", "Description": "Response payload from closing a job", @@ -4070,7 +4002,7 @@ "Properties": [] }, { - "$id": "492", + "$id": "488", "Name": "ListJobQueryParams", "Namespace": "AzureCommunicationRoutingService", "IsNullable": false, @@ -4078,7 +4010,7 @@ "Properties": [] }, { - "$id": "493", + "$id": "489", "Name": "DeclineJobOfferResult", "Namespace": "AzureCommunicationRoutingService", "Description": "Response payload from declining a job", @@ -4087,7 +4019,7 @@ "Properties": [] }, { - "$id": "494", + "$id": "490", "Name": "ListWorkerQueryParams", "Namespace": "AzureCommunicationRoutingService", "IsNullable": false, @@ -4097,12 +4029,12 @@ ], "Clients": [ { - "$id": "495", + "$id": "491", "Name": "JobRouterAdministrationClient", "Description": "", "Operations": [ { - "$id": "496", + "$id": "492", "Name": "upsertDistributionPolicy", "ResourceName": "DistributionPolicy", "Summary": "Creates or updates a distribution policy.", @@ -4110,11 +4042,11 @@ "Accessibility": "internal", "Parameters": [ { - "$id": "497", + "$id": "493", "Name": "endpoint", "NameInRequest": "endpoint", "Type": { - "$id": "498", + "$id": "494", "Name": "Uri", "Kind": "Uri", "IsNullable": false @@ -4130,12 +4062,12 @@ "Kind": "Client" }, { - "$id": "499", + "$id": "495", "Name": "apiVersion", "NameInRequest": "api-version", "Description": "", "Type": { - "$id": "500", + "$id": "496", "Name": "String", "Kind": "String", "IsNullable": false @@ -4150,9 +4082,9 @@ "Explode": false, "Kind": "Client", "DefaultValue": { - "$id": "501", + "$id": "497", "Type": { - "$id": "502", + "$id": "498", "Name": "String", "Kind": "String", "IsNullable": false @@ -4161,12 +4093,12 @@ } }, { - "$id": "503", - "Name": "id", - "NameInRequest": "id", + "$id": "499", + "Name": "distributionPolicyId", + "NameInRequest": "distributionPolicyId", "Description": "The unique identifier of the policy.", "Type": { - "$id": "504", + "$id": "500", "Name": "string", "Kind": "String", "IsNullable": false @@ -4182,15 +4114,15 @@ "Kind": "Method" }, { - "$id": "505", + "$id": "501", "Name": "contentType", "NameInRequest": "Content-Type", "Description": "This request has a JSON Merge Patch body.", "Type": { - "$id": "506", + "$id": "502", "Name": "Literal", "LiteralValueType": { - "$id": "507", + "$id": "503", "Name": "String", "Kind": "String", "IsNullable": false @@ -4200,9 +4132,9 @@ }, "Location": "Header", "DefaultValue": { - "$id": "508", + "$id": "504", "Type": { - "$ref": "506" + "$ref": "502" }, "Value": "application/merge-patch+json" }, @@ -4216,12 +4148,12 @@ "Kind": "Constant" }, { - "$id": "509", + "$id": "505", "Name": "ifMatch", "NameInRequest": "If-Match", "Description": "The request should only proceed if an entity matches this string.", "Type": { - "$id": "510", + "$id": "506", "Name": "string", "Kind": "String", "IsNullable": false @@ -4237,12 +4169,12 @@ "Kind": "Method" }, { - "$id": "511", + "$id": "507", "Name": "ifUnmodifiedSince", "NameInRequest": "If-Unmodified-Since", "Description": "The request should only proceed if the entity was not modified after this time.", "Type": { - "$id": "512", + "$id": "508", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -4258,7 +4190,7 @@ "Kind": "Method" }, { - "$id": "513", + "$id": "509", "Name": "resource", "NameInRequest": "resource", "Description": "The resource instance.", @@ -4276,11 +4208,11 @@ "Kind": "Method" }, { - "$id": "514", + "$id": "510", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "515", + "$id": "511", "Name": "String", "Kind": "String", "IsNullable": false @@ -4295,9 +4227,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "516", + "$id": "512", "Type": { - "$ref": "515" + "$ref": "511" }, "Value": "application/json" } @@ -4305,7 +4237,7 @@ ], "Responses": [ { - "$id": "517", + "$id": "513", "StatusCodes": [ 201 ], @@ -4315,24 +4247,24 @@ "BodyMediaType": "Json", "Headers": [ { - "$id": "518", + "$id": "514", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "519", + "$id": "515", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "520", + "$id": "516", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "521", + "$id": "517", "Name": "string", "Kind": "String", "IsNullable": false @@ -4342,7 +4274,7 @@ "IsErrorResponse": false }, { - "$id": "522", + "$id": "518", "StatusCodes": [ 200 ], @@ -4352,24 +4284,24 @@ "BodyMediaType": "Json", "Headers": [ { - "$id": "523", + "$id": "519", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "524", + "$id": "520", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "525", + "$id": "521", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "526", + "$id": "522", "Name": "string", "Kind": "String", "IsNullable": false @@ -4382,7 +4314,7 @@ "HttpMethod": "PATCH", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/distributionPolicies/{id}", + "Path": "/routing/distributionPolicies/{distributionPolicyId}", "RequestMediaTypes": [ "application/merge-patch+json" ], @@ -4391,25 +4323,25 @@ "GenerateConvenienceMethod": false }, { - "$id": "527", + "$id": "523", "Name": "getDistributionPolicy", "ResourceName": "DistributionPolicy", "Summary": "Retrieves an existing distribution policy by Id.", "Description": "Retrieves an existing distribution policy by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "528", - "Name": "id", - "NameInRequest": "id", + "$id": "524", + "Name": "distributionPolicyId", + "NameInRequest": "distributionPolicyId", "Description": "The unique identifier of the policy.", "Type": { - "$id": "529", + "$id": "525", "Name": "string", "Kind": "String", "IsNullable": false @@ -4425,11 +4357,11 @@ "Kind": "Method" }, { - "$id": "530", + "$id": "526", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "531", + "$id": "527", "Name": "String", "Kind": "String", "IsNullable": false @@ -4444,9 +4376,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "532", + "$id": "528", "Type": { - "$ref": "531" + "$ref": "527" }, "Value": "application/json" } @@ -4454,7 +4386,7 @@ ], "Responses": [ { - "$id": "533", + "$id": "529", "StatusCodes": [ 200 ], @@ -4464,24 +4396,24 @@ "BodyMediaType": "Json", "Headers": [ { - "$id": "534", + "$id": "530", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "535", + "$id": "531", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "536", + "$id": "532", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "537", + "$id": "533", "Name": "string", "Kind": "String", "IsNullable": false @@ -4494,31 +4426,31 @@ "HttpMethod": "GET", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/distributionPolicies/{id}", + "Path": "/routing/distributionPolicies/{distributionPolicyId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "538", + "$id": "534", "Name": "listDistributionPolicies", "ResourceName": "JobRouterAdministrationRestClient", "Summary": "Retrieves existing distribution policies.", "Description": "Retrieves existing distribution policies.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "539", + "$id": "535", "Name": "maxpagesize", "NameInRequest": "maxpagesize", "Description": "Number of objects to return per page.", "Type": { - "$id": "540", + "$id": "536", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -4534,11 +4466,11 @@ "Kind": "Method" }, { - "$id": "541", + "$id": "537", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "542", + "$id": "538", "Name": "String", "Kind": "String", "IsNullable": false @@ -4553,9 +4485,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "543", + "$id": "539", "Type": { - "$ref": "542" + "$ref": "538" }, "Value": "application/json" } @@ -4563,12 +4495,12 @@ ], "Responses": [ { - "$id": "544", + "$id": "540", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "120" + "$ref": "122" }, "BodyMediaType": "Json", "Headers": [], @@ -4581,7 +4513,7 @@ "Path": "/routing/distributionPolicies", "BufferResponse": true, "Paging": { - "$id": "545", + "$id": "541", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -4589,25 +4521,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "546", + "$id": "542", "Name": "deleteDistributionPolicy", "ResourceName": "DistributionPolicy", "Summary": "Delete a distribution policy by Id.", "Description": "Delete a distribution policy by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "547", - "Name": "id", - "NameInRequest": "id", + "$id": "543", + "Name": "distributionPolicyId", + "NameInRequest": "distributionPolicyId", "Description": "The unique identifier of the policy.", "Type": { - "$id": "548", + "$id": "544", "Name": "string", "Kind": "String", "IsNullable": false @@ -4623,11 +4555,11 @@ "Kind": "Method" }, { - "$id": "549", + "$id": "545", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "550", + "$id": "546", "Name": "String", "Kind": "String", "IsNullable": false @@ -4642,9 +4574,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "551", + "$id": "547", "Type": { - "$ref": "550" + "$ref": "546" }, "Value": "application/json" } @@ -4652,7 +4584,7 @@ ], "Responses": [ { - "$id": "552", + "$id": "548", "StatusCodes": [ 204 ], @@ -4664,13 +4596,13 @@ "HttpMethod": "DELETE", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/distributionPolicies/{id}", + "Path": "/routing/distributionPolicies/{distributionPolicyId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "553", + "$id": "549", "Name": "upsertClassificationPolicy", "ResourceName": "ClassificationPolicy", "Summary": "Creates or updates a classification policy.", @@ -4678,18 +4610,18 @@ "Accessibility": "internal", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "554", - "Name": "id", - "NameInRequest": "id", + "$id": "550", + "Name": "classificationPolicyId", + "NameInRequest": "classificationPolicyId", "Description": "Unique identifier of this policy.", "Type": { - "$id": "555", + "$id": "551", "Name": "string", "Kind": "String", "IsNullable": false @@ -4705,15 +4637,15 @@ "Kind": "Method" }, { - "$id": "556", + "$id": "552", "Name": "contentType", "NameInRequest": "Content-Type", "Description": "This request has a JSON Merge Patch body.", "Type": { - "$id": "557", + "$id": "553", "Name": "Literal", "LiteralValueType": { - "$id": "558", + "$id": "554", "Name": "String", "Kind": "String", "IsNullable": false @@ -4723,9 +4655,9 @@ }, "Location": "Header", "DefaultValue": { - "$id": "559", + "$id": "555", "Type": { - "$ref": "557" + "$ref": "553" }, "Value": "application/merge-patch+json" }, @@ -4739,12 +4671,12 @@ "Kind": "Constant" }, { - "$id": "560", + "$id": "556", "Name": "ifMatch", "NameInRequest": "If-Match", "Description": "The request should only proceed if an entity matches this string.", "Type": { - "$id": "561", + "$id": "557", "Name": "string", "Kind": "String", "IsNullable": false @@ -4760,12 +4692,12 @@ "Kind": "Method" }, { - "$id": "562", + "$id": "558", "Name": "ifUnmodifiedSince", "NameInRequest": "If-Unmodified-Since", "Description": "The request should only proceed if the entity was not modified after this time.", "Type": { - "$id": "563", + "$id": "559", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -4781,12 +4713,12 @@ "Kind": "Method" }, { - "$id": "564", + "$id": "560", "Name": "resource", "NameInRequest": "resource", "Description": "The resource instance.", "Type": { - "$ref": "129" + "$ref": "127" }, "Location": "Body", "IsRequired": true, @@ -4799,11 +4731,11 @@ "Kind": "Method" }, { - "$id": "565", + "$id": "561", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "566", + "$id": "562", "Name": "String", "Kind": "String", "IsNullable": false @@ -4818,9 +4750,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "567", + "$id": "563", "Type": { - "$ref": "566" + "$ref": "562" }, "Value": "application/json" } @@ -4828,34 +4760,34 @@ ], "Responses": [ { - "$id": "568", + "$id": "564", "StatusCodes": [ 201 ], "BodyType": { - "$ref": "129" + "$ref": "127" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "569", + "$id": "565", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "570", + "$id": "566", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "571", + "$id": "567", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "572", + "$id": "568", "Name": "string", "Kind": "String", "IsNullable": false @@ -4865,34 +4797,34 @@ "IsErrorResponse": false }, { - "$id": "573", + "$id": "569", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "129" + "$ref": "127" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "574", + "$id": "570", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "575", + "$id": "571", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "576", + "$id": "572", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "577", + "$id": "573", "Name": "string", "Kind": "String", "IsNullable": false @@ -4905,7 +4837,7 @@ "HttpMethod": "PATCH", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/classificationPolicies/{id}", + "Path": "/routing/classificationPolicies/{classificationPolicyId}", "RequestMediaTypes": [ "application/merge-patch+json" ], @@ -4914,25 +4846,25 @@ "GenerateConvenienceMethod": false }, { - "$id": "578", + "$id": "574", "Name": "getClassificationPolicy", "ResourceName": "ClassificationPolicy", "Summary": "Retrieves an existing classification policy by Id.", "Description": "Retrieves an existing classification policy by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "579", - "Name": "id", - "NameInRequest": "id", + "$id": "575", + "Name": "classificationPolicyId", + "NameInRequest": "classificationPolicyId", "Description": "Unique identifier of this policy.", "Type": { - "$id": "580", + "$id": "576", "Name": "string", "Kind": "String", "IsNullable": false @@ -4948,11 +4880,11 @@ "Kind": "Method" }, { - "$id": "581", + "$id": "577", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "582", + "$id": "578", "Name": "String", "Kind": "String", "IsNullable": false @@ -4967,9 +4899,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "583", + "$id": "579", "Type": { - "$ref": "582" + "$ref": "578" }, "Value": "application/json" } @@ -4977,34 +4909,34 @@ ], "Responses": [ { - "$id": "584", + "$id": "580", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "129" + "$ref": "127" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "585", + "$id": "581", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "586", + "$id": "582", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "587", + "$id": "583", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "588", + "$id": "584", "Name": "string", "Kind": "String", "IsNullable": false @@ -5017,31 +4949,31 @@ "HttpMethod": "GET", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/classificationPolicies/{id}", + "Path": "/routing/classificationPolicies/{classificationPolicyId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "589", + "$id": "585", "Name": "listClassificationPolicies", "ResourceName": "JobRouterAdministrationRestClient", "Summary": "Retrieves existing classification policies.", "Description": "Retrieves existing classification policies.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "590", + "$id": "586", "Name": "maxpagesize", "NameInRequest": "maxpagesize", "Description": "Number of objects to return per page.", "Type": { - "$id": "591", + "$id": "587", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -5057,11 +4989,11 @@ "Kind": "Method" }, { - "$id": "592", + "$id": "588", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "593", + "$id": "589", "Name": "String", "Kind": "String", "IsNullable": false @@ -5076,9 +5008,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "594", + "$id": "590", "Type": { - "$ref": "593" + "$ref": "589" }, "Value": "application/json" } @@ -5086,7 +5018,7 @@ ], "Responses": [ { - "$id": "595", + "$id": "591", "StatusCodes": [ 200 ], @@ -5104,7 +5036,7 @@ "Path": "/routing/classificationPolicies", "BufferResponse": true, "Paging": { - "$id": "596", + "$id": "592", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -5112,25 +5044,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "597", + "$id": "593", "Name": "deleteClassificationPolicy", "ResourceName": "ClassificationPolicy", "Summary": "Delete a classification policy by Id.", "Description": "Delete a classification policy by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "598", - "Name": "id", - "NameInRequest": "id", + "$id": "594", + "Name": "classificationPolicyId", + "NameInRequest": "classificationPolicyId", "Description": "Unique identifier of this policy.", "Type": { - "$id": "599", + "$id": "595", "Name": "string", "Kind": "String", "IsNullable": false @@ -5146,11 +5078,11 @@ "Kind": "Method" }, { - "$id": "600", + "$id": "596", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "601", + "$id": "597", "Name": "String", "Kind": "String", "IsNullable": false @@ -5165,9 +5097,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "602", + "$id": "598", "Type": { - "$ref": "601" + "$ref": "597" }, "Value": "application/json" } @@ -5175,7 +5107,7 @@ ], "Responses": [ { - "$id": "603", + "$id": "599", "StatusCodes": [ 204 ], @@ -5187,13 +5119,13 @@ "HttpMethod": "DELETE", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/classificationPolicies/{id}", + "Path": "/routing/classificationPolicies/{classificationPolicyId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "604", + "$id": "600", "Name": "upsertExceptionPolicy", "ResourceName": "ExceptionPolicy", "Summary": "Creates or updates a exception policy.", @@ -5201,18 +5133,18 @@ "Accessibility": "internal", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "605", - "Name": "id", - "NameInRequest": "id", + "$id": "601", + "Name": "exceptionPolicyId", + "NameInRequest": "exceptionPolicyId", "Description": "The Id of the exception policy", "Type": { - "$id": "606", + "$id": "602", "Name": "string", "Kind": "String", "IsNullable": false @@ -5228,15 +5160,15 @@ "Kind": "Method" }, { - "$id": "607", + "$id": "603", "Name": "contentType", "NameInRequest": "Content-Type", "Description": "This request has a JSON Merge Patch body.", "Type": { - "$id": "608", + "$id": "604", "Name": "Literal", "LiteralValueType": { - "$id": "609", + "$id": "605", "Name": "String", "Kind": "String", "IsNullable": false @@ -5246,9 +5178,9 @@ }, "Location": "Header", "DefaultValue": { - "$id": "610", + "$id": "606", "Type": { - "$ref": "608" + "$ref": "604" }, "Value": "application/merge-patch+json" }, @@ -5262,12 +5194,12 @@ "Kind": "Constant" }, { - "$id": "611", + "$id": "607", "Name": "ifMatch", "NameInRequest": "If-Match", "Description": "The request should only proceed if an entity matches this string.", "Type": { - "$id": "612", + "$id": "608", "Name": "string", "Kind": "String", "IsNullable": false @@ -5283,12 +5215,12 @@ "Kind": "Method" }, { - "$id": "613", + "$id": "609", "Name": "ifUnmodifiedSince", "NameInRequest": "If-Unmodified-Since", "Description": "The request should only proceed if the entity was not modified after this time.", "Type": { - "$id": "614", + "$id": "610", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -5304,12 +5236,12 @@ "Kind": "Method" }, { - "$id": "615", + "$id": "611", "Name": "resource", "NameInRequest": "resource", "Description": "The resource instance.", "Type": { - "$ref": "217" + "$ref": "213" }, "Location": "Body", "IsRequired": true, @@ -5322,11 +5254,11 @@ "Kind": "Method" }, { - "$id": "616", + "$id": "612", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "617", + "$id": "613", "Name": "String", "Kind": "String", "IsNullable": false @@ -5341,9 +5273,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "618", + "$id": "614", "Type": { - "$ref": "617" + "$ref": "613" }, "Value": "application/json" } @@ -5351,34 +5283,34 @@ ], "Responses": [ { - "$id": "619", + "$id": "615", "StatusCodes": [ 201 ], "BodyType": { - "$ref": "217" + "$ref": "213" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "620", + "$id": "616", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "621", + "$id": "617", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "622", + "$id": "618", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "623", + "$id": "619", "Name": "string", "Kind": "String", "IsNullable": false @@ -5388,34 +5320,34 @@ "IsErrorResponse": false }, { - "$id": "624", + "$id": "620", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "217" + "$ref": "213" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "625", + "$id": "621", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "626", + "$id": "622", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "627", + "$id": "623", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "628", + "$id": "624", "Name": "string", "Kind": "String", "IsNullable": false @@ -5428,7 +5360,7 @@ "HttpMethod": "PATCH", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/exceptionPolicies/{id}", + "Path": "/routing/exceptionPolicies/{exceptionPolicyId}", "RequestMediaTypes": [ "application/merge-patch+json" ], @@ -5437,25 +5369,25 @@ "GenerateConvenienceMethod": false }, { - "$id": "629", + "$id": "625", "Name": "getExceptionPolicy", "ResourceName": "ExceptionPolicy", "Summary": "Retrieves an existing exception policy by Id.", "Description": "Retrieves an existing exception policy by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "630", - "Name": "id", - "NameInRequest": "id", + "$id": "626", + "Name": "exceptionPolicyId", + "NameInRequest": "exceptionPolicyId", "Description": "The Id of the exception policy", "Type": { - "$id": "631", + "$id": "627", "Name": "string", "Kind": "String", "IsNullable": false @@ -5471,11 +5403,11 @@ "Kind": "Method" }, { - "$id": "632", + "$id": "628", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "633", + "$id": "629", "Name": "String", "Kind": "String", "IsNullable": false @@ -5490,9 +5422,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "634", + "$id": "630", "Type": { - "$ref": "633" + "$ref": "629" }, "Value": "application/json" } @@ -5500,34 +5432,34 @@ ], "Responses": [ { - "$id": "635", + "$id": "631", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "217" + "$ref": "213" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "636", + "$id": "632", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "637", + "$id": "633", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "638", + "$id": "634", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "639", + "$id": "635", "Name": "string", "Kind": "String", "IsNullable": false @@ -5540,31 +5472,31 @@ "HttpMethod": "GET", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/exceptionPolicies/{id}", + "Path": "/routing/exceptionPolicies/{exceptionPolicyId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "640", + "$id": "636", "Name": "listExceptionPolicies", "ResourceName": "JobRouterAdministrationRestClient", "Summary": "Retrieves existing exception policies.", "Description": "Retrieves existing exception policies.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "641", + "$id": "637", "Name": "maxpagesize", "NameInRequest": "maxpagesize", "Description": "Number of objects to return per page.", "Type": { - "$id": "642", + "$id": "638", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -5580,11 +5512,11 @@ "Kind": "Method" }, { - "$id": "643", + "$id": "639", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "644", + "$id": "640", "Name": "String", "Kind": "String", "IsNullable": false @@ -5599,9 +5531,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "645", + "$id": "641", "Type": { - "$ref": "644" + "$ref": "640" }, "Value": "application/json" } @@ -5609,7 +5541,7 @@ ], "Responses": [ { - "$id": "646", + "$id": "642", "StatusCodes": [ 200 ], @@ -5627,7 +5559,7 @@ "Path": "/routing/exceptionPolicies", "BufferResponse": true, "Paging": { - "$id": "647", + "$id": "643", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -5635,25 +5567,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "648", + "$id": "644", "Name": "deleteExceptionPolicy", "ResourceName": "ExceptionPolicy", "Summary": "Deletes a exception policy by Id.", "Description": "Deletes a exception policy by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "649", - "Name": "id", - "NameInRequest": "id", + "$id": "645", + "Name": "exceptionPolicyId", + "NameInRequest": "exceptionPolicyId", "Description": "The Id of the exception policy", "Type": { - "$id": "650", + "$id": "646", "Name": "string", "Kind": "String", "IsNullable": false @@ -5669,11 +5601,11 @@ "Kind": "Method" }, { - "$id": "651", + "$id": "647", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "652", + "$id": "648", "Name": "String", "Kind": "String", "IsNullable": false @@ -5688,9 +5620,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "653", + "$id": "649", "Type": { - "$ref": "652" + "$ref": "648" }, "Value": "application/json" } @@ -5698,7 +5630,7 @@ ], "Responses": [ { - "$id": "654", + "$id": "650", "StatusCodes": [ 204 ], @@ -5710,13 +5642,13 @@ "HttpMethod": "DELETE", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/exceptionPolicies/{id}", + "Path": "/routing/exceptionPolicies/{exceptionPolicyId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "655", + "$id": "651", "Name": "upsertQueue", "ResourceName": "RouterQueue", "Summary": "Creates or updates a queue.", @@ -5724,18 +5656,18 @@ "Accessibility": "internal", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "656", - "Name": "id", - "NameInRequest": "id", + "$id": "652", + "Name": "queueId", + "NameInRequest": "queueId", "Description": "The Id of this queue", "Type": { - "$id": "657", + "$id": "653", "Name": "string", "Kind": "String", "IsNullable": false @@ -5751,15 +5683,15 @@ "Kind": "Method" }, { - "$id": "658", + "$id": "654", "Name": "contentType", "NameInRequest": "Content-Type", "Description": "This request has a JSON Merge Patch body.", "Type": { - "$id": "659", + "$id": "655", "Name": "Literal", "LiteralValueType": { - "$id": "660", + "$id": "656", "Name": "String", "Kind": "String", "IsNullable": false @@ -5769,9 +5701,9 @@ }, "Location": "Header", "DefaultValue": { - "$id": "661", + "$id": "657", "Type": { - "$ref": "659" + "$ref": "655" }, "Value": "application/merge-patch+json" }, @@ -5785,12 +5717,12 @@ "Kind": "Constant" }, { - "$id": "662", + "$id": "658", "Name": "ifMatch", "NameInRequest": "If-Match", "Description": "The request should only proceed if an entity matches this string.", "Type": { - "$id": "663", + "$id": "659", "Name": "string", "Kind": "String", "IsNullable": false @@ -5806,12 +5738,12 @@ "Kind": "Method" }, { - "$id": "664", + "$id": "660", "Name": "ifUnmodifiedSince", "NameInRequest": "If-Unmodified-Since", "Description": "The request should only proceed if the entity was not modified after this time.", "Type": { - "$id": "665", + "$id": "661", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -5827,12 +5759,12 @@ "Kind": "Method" }, { - "$id": "666", + "$id": "662", "Name": "resource", "NameInRequest": "resource", "Description": "The resource instance.", "Type": { - "$ref": "270" + "$ref": "266" }, "Location": "Body", "IsRequired": true, @@ -5845,11 +5777,11 @@ "Kind": "Method" }, { - "$id": "667", + "$id": "663", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "668", + "$id": "664", "Name": "String", "Kind": "String", "IsNullable": false @@ -5864,9 +5796,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "669", + "$id": "665", "Type": { - "$ref": "668" + "$ref": "664" }, "Value": "application/json" } @@ -5874,34 +5806,34 @@ ], "Responses": [ { - "$id": "670", + "$id": "666", "StatusCodes": [ 201 ], "BodyType": { - "$ref": "270" + "$ref": "266" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "671", + "$id": "667", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "672", + "$id": "668", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "673", + "$id": "669", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "674", + "$id": "670", "Name": "string", "Kind": "String", "IsNullable": false @@ -5911,34 +5843,34 @@ "IsErrorResponse": false }, { - "$id": "675", + "$id": "671", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "270" + "$ref": "266" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "676", + "$id": "672", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "677", + "$id": "673", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "678", + "$id": "674", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "679", + "$id": "675", "Name": "string", "Kind": "String", "IsNullable": false @@ -5951,7 +5883,7 @@ "HttpMethod": "PATCH", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/queues/{id}", + "Path": "/routing/queues/{queueId}", "RequestMediaTypes": [ "application/merge-patch+json" ], @@ -5960,25 +5892,25 @@ "GenerateConvenienceMethod": false }, { - "$id": "680", + "$id": "676", "Name": "getQueue", "ResourceName": "RouterQueue", "Summary": "Retrieves an existing queue by Id.", "Description": "Retrieves an existing queue by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "681", - "Name": "id", - "NameInRequest": "id", + "$id": "677", + "Name": "queueId", + "NameInRequest": "queueId", "Description": "The Id of this queue", "Type": { - "$id": "682", + "$id": "678", "Name": "string", "Kind": "String", "IsNullable": false @@ -5994,11 +5926,11 @@ "Kind": "Method" }, { - "$id": "683", + "$id": "679", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "684", + "$id": "680", "Name": "String", "Kind": "String", "IsNullable": false @@ -6013,9 +5945,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "685", + "$id": "681", "Type": { - "$ref": "684" + "$ref": "680" }, "Value": "application/json" } @@ -6023,34 +5955,34 @@ ], "Responses": [ { - "$id": "686", + "$id": "682", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "270" + "$ref": "266" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "687", + "$id": "683", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "688", + "$id": "684", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "689", + "$id": "685", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "690", + "$id": "686", "Name": "string", "Kind": "String", "IsNullable": false @@ -6063,31 +5995,31 @@ "HttpMethod": "GET", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/queues/{id}", + "Path": "/routing/queues/{queueId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "691", + "$id": "687", "Name": "listQueues", "ResourceName": "JobRouterAdministrationRestClient", "Summary": "Retrieves existing queues.", "Description": "Retrieves existing queues.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "692", + "$id": "688", "Name": "maxpagesize", "NameInRequest": "maxpagesize", "Description": "Number of objects to return per page.", "Type": { - "$id": "693", + "$id": "689", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -6103,11 +6035,11 @@ "Kind": "Method" }, { - "$id": "694", + "$id": "690", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "695", + "$id": "691", "Name": "String", "Kind": "String", "IsNullable": false @@ -6122,9 +6054,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "696", + "$id": "692", "Type": { - "$ref": "695" + "$ref": "691" }, "Value": "application/json" } @@ -6132,12 +6064,12 @@ ], "Responses": [ { - "$id": "697", + "$id": "693", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "283" + "$ref": "281" }, "BodyMediaType": "Json", "Headers": [], @@ -6150,7 +6082,7 @@ "Path": "/routing/queues", "BufferResponse": true, "Paging": { - "$id": "698", + "$id": "694", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -6158,25 +6090,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "699", + "$id": "695", "Name": "deleteQueue", "ResourceName": "RouterQueue", "Summary": "Deletes a queue by Id.", "Description": "Deletes a queue by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "700", - "Name": "id", - "NameInRequest": "id", + "$id": "696", + "Name": "queueId", + "NameInRequest": "queueId", "Description": "The Id of this queue", "Type": { - "$id": "701", + "$id": "697", "Name": "string", "Kind": "String", "IsNullable": false @@ -6192,11 +6124,11 @@ "Kind": "Method" }, { - "$id": "702", + "$id": "698", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "703", + "$id": "699", "Name": "String", "Kind": "String", "IsNullable": false @@ -6211,9 +6143,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "704", + "$id": "700", "Type": { - "$ref": "703" + "$ref": "699" }, "Value": "application/json" } @@ -6221,7 +6153,7 @@ ], "Responses": [ { - "$id": "705", + "$id": "701", "StatusCodes": [ 204 ], @@ -6233,24 +6165,24 @@ "HttpMethod": "DELETE", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/queues/{id}", + "Path": "/routing/queues/{queueId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true } ], "Protocol": { - "$id": "706" + "$id": "702" }, "Creatable": true }, { - "$id": "707", + "$id": "703", "Name": "JobRouterClient", "Description": "", "Operations": [ { - "$id": "708", + "$id": "704", "Name": "upsertJob", "ResourceName": "RouterJob", "Summary": "Creates or updates a router job.", @@ -6258,18 +6190,18 @@ "Accessibility": "internal", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "709", - "Name": "id", - "NameInRequest": "id", + "$id": "705", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "The id of the job.", "Type": { - "$id": "710", + "$id": "706", "Name": "string", "Kind": "String", "IsNullable": false @@ -6285,15 +6217,15 @@ "Kind": "Method" }, { - "$id": "711", + "$id": "707", "Name": "contentType", "NameInRequest": "Content-Type", "Description": "This request has a JSON Merge Patch body.", "Type": { - "$id": "712", + "$id": "708", "Name": "Literal", "LiteralValueType": { - "$id": "713", + "$id": "709", "Name": "String", "Kind": "String", "IsNullable": false @@ -6303,9 +6235,9 @@ }, "Location": "Header", "DefaultValue": { - "$id": "714", + "$id": "710", "Type": { - "$ref": "712" + "$ref": "708" }, "Value": "application/merge-patch+json" }, @@ -6319,12 +6251,12 @@ "Kind": "Constant" }, { - "$id": "715", + "$id": "711", "Name": "ifMatch", "NameInRequest": "If-Match", "Description": "The request should only proceed if an entity matches this string.", "Type": { - "$id": "716", + "$id": "712", "Name": "string", "Kind": "String", "IsNullable": false @@ -6340,12 +6272,12 @@ "Kind": "Method" }, { - "$id": "717", + "$id": "713", "Name": "ifUnmodifiedSince", "NameInRequest": "If-Unmodified-Since", "Description": "The request should only proceed if the entity was not modified after this time.", "Type": { - "$id": "718", + "$id": "714", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -6361,12 +6293,12 @@ "Kind": "Method" }, { - "$id": "719", + "$id": "715", "Name": "resource", "NameInRequest": "resource", "Description": "The resource instance.", "Type": { - "$ref": "292" + "$ref": "286" }, "Location": "Body", "IsRequired": true, @@ -6379,11 +6311,11 @@ "Kind": "Method" }, { - "$id": "720", + "$id": "716", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "721", + "$id": "717", "Name": "String", "Kind": "String", "IsNullable": false @@ -6398,9 +6330,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "722", + "$id": "718", "Type": { - "$ref": "721" + "$ref": "717" }, "Value": "application/json" } @@ -6408,34 +6340,34 @@ ], "Responses": [ { - "$id": "723", + "$id": "719", "StatusCodes": [ 201 ], "BodyType": { - "$ref": "292" + "$ref": "286" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "724", + "$id": "720", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "725", + "$id": "721", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "726", + "$id": "722", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "727", + "$id": "723", "Name": "string", "Kind": "String", "IsNullable": false @@ -6445,34 +6377,34 @@ "IsErrorResponse": false }, { - "$id": "728", + "$id": "724", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "292" + "$ref": "286" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "729", + "$id": "725", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "730", + "$id": "726", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "731", + "$id": "727", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "732", + "$id": "728", "Name": "string", "Kind": "String", "IsNullable": false @@ -6485,7 +6417,7 @@ "HttpMethod": "PATCH", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}", + "Path": "/routing/jobs/{jobId}", "RequestMediaTypes": [ "application/merge-patch+json" ], @@ -6494,25 +6426,25 @@ "GenerateConvenienceMethod": false }, { - "$id": "733", + "$id": "729", "Name": "getJob", "ResourceName": "RouterJob", "Summary": "Retrieves an existing job by Id.", "Description": "Retrieves an existing job by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "734", - "Name": "id", - "NameInRequest": "id", + "$id": "730", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "The id of the job.", "Type": { - "$id": "735", + "$id": "731", "Name": "string", "Kind": "String", "IsNullable": false @@ -6528,11 +6460,11 @@ "Kind": "Method" }, { - "$id": "736", + "$id": "732", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "737", + "$id": "733", "Name": "String", "Kind": "String", "IsNullable": false @@ -6547,9 +6479,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "738", + "$id": "734", "Type": { - "$ref": "737" + "$ref": "733" }, "Value": "application/json" } @@ -6557,34 +6489,34 @@ ], "Responses": [ { - "$id": "739", + "$id": "735", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "292" + "$ref": "286" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "740", + "$id": "736", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "741", + "$id": "737", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "742", + "$id": "738", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "743", + "$id": "739", "Name": "string", "Kind": "String", "IsNullable": false @@ -6597,31 +6529,31 @@ "HttpMethod": "GET", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}", + "Path": "/routing/jobs/{jobId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "744", + "$id": "740", "Name": "deleteJob", "ResourceName": "RouterJob", "Summary": "Deletes a job and all of its traces.", "Description": "Deletes a job and all of its traces.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "745", - "Name": "id", - "NameInRequest": "id", + "$id": "741", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "The id of the job.", "Type": { - "$id": "746", + "$id": "742", "Name": "string", "Kind": "String", "IsNullable": false @@ -6637,11 +6569,11 @@ "Kind": "Method" }, { - "$id": "747", + "$id": "743", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "748", + "$id": "744", "Name": "String", "Kind": "String", "IsNullable": false @@ -6656,9 +6588,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "749", + "$id": "745", "Type": { - "$ref": "748" + "$ref": "744" }, "Value": "application/json" } @@ -6666,7 +6598,7 @@ ], "Responses": [ { - "$id": "750", + "$id": "746", "StatusCodes": [ 204 ], @@ -6678,13 +6610,13 @@ "HttpMethod": "DELETE", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}", + "Path": "/routing/jobs/{jobId}", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "751", + "$id": "747", "Name": "reclassifyJob", "ResourceName": "JobRouterRestClient", "Summary": "Reclassify a job.", @@ -6692,18 +6624,18 @@ "Accessibility": "internal", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "752", - "Name": "id", - "NameInRequest": "id", + "$id": "748", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "Id of the job.", "Type": { - "$id": "753", + "$id": "749", "Name": "string", "Kind": "String", "IsNullable": false @@ -6719,21 +6651,21 @@ "Kind": "Method" }, { - "$id": "754", - "Name": "reclassifyJobRequest", - "NameInRequest": "reclassifyJobRequest", + "$id": "750", + "Name": "options", + "NameInRequest": "options", "Description": "Request object for reclassifying a job.", "Type": { - "$id": "755", + "$id": "751", "Name": "Dictionary", "KeyType": { - "$id": "756", + "$id": "752", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "757", + "$id": "753", "Name": "string", "Kind": "String", "IsNullable": false @@ -6751,11 +6683,11 @@ "Kind": "Method" }, { - "$id": "758", + "$id": "754", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "759", + "$id": "755", "Name": "String", "Kind": "String", "IsNullable": false @@ -6770,19 +6702,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "760", + "$id": "756", "Type": { - "$ref": "759" + "$ref": "755" }, "Value": "application/json" } }, { - "$id": "761", + "$id": "757", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "762", + "$id": "758", "Name": "String", "Kind": "String", "IsNullable": false @@ -6797,9 +6729,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "763", + "$id": "759", "Type": { - "$ref": "762" + "$ref": "758" }, "Value": "application/json" } @@ -6807,7 +6739,7 @@ ], "Responses": [ { - "$id": "764", + "$id": "760", "StatusCodes": [ 200 ], @@ -6819,7 +6751,7 @@ "HttpMethod": "POST", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}:reclassify", + "Path": "/routing/jobs/{jobId}:reclassify", "RequestMediaTypes": [ "application/json" ], @@ -6828,25 +6760,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "765", + "$id": "761", "Name": "cancelJob", "ResourceName": "JobRouterRestClient", "Summary": "Submits request to cancel an existing job by Id while supplying free-form\ncancellation reason.", "Description": "Submits request to cancel an existing job by Id while supplying free-form\ncancellation reason.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "766", - "Name": "id", - "NameInRequest": "id", + "$id": "762", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "Id of the job.", "Type": { - "$id": "767", + "$id": "763", "Name": "string", "Kind": "String", "IsNullable": false @@ -6862,12 +6794,12 @@ "Kind": "Method" }, { - "$id": "768", - "Name": "cancelJobRequest", - "NameInRequest": "cancelJobRequest", + "$id": "764", + "Name": "options", + "NameInRequest": "options", "Description": "Request model for cancelling job.", "Type": { - "$ref": "351" + "$ref": "350" }, "Location": "Body", "IsRequired": false, @@ -6880,11 +6812,11 @@ "Kind": "Method" }, { - "$id": "769", + "$id": "765", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "770", + "$id": "766", "Name": "String", "Kind": "String", "IsNullable": false @@ -6899,19 +6831,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "771", + "$id": "767", "Type": { - "$ref": "770" + "$ref": "766" }, "Value": "application/json" } }, { - "$id": "772", + "$id": "768", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "773", + "$id": "769", "Name": "String", "Kind": "String", "IsNullable": false @@ -6926,9 +6858,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "774", + "$id": "770", "Type": { - "$ref": "773" + "$ref": "769" }, "Value": "application/json" } @@ -6936,7 +6868,7 @@ ], "Responses": [ { - "$id": "775", + "$id": "771", "StatusCodes": [ 200 ], @@ -6948,7 +6880,7 @@ "HttpMethod": "POST", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}:cancel", + "Path": "/routing/jobs/{jobId}:cancel", "RequestMediaTypes": [ "application/json" ], @@ -6957,25 +6889,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "776", + "$id": "772", "Name": "completeJob", "ResourceName": "JobRouterRestClient", "Summary": "Completes an assigned job.", "Description": "Completes an assigned job.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "777", - "Name": "id", - "NameInRequest": "id", + "$id": "773", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "Id of the job.", "Type": { - "$id": "778", + "$id": "774", "Name": "string", "Kind": "String", "IsNullable": false @@ -6991,12 +6923,12 @@ "Kind": "Method" }, { - "$id": "779", - "Name": "completeJobRequest", - "NameInRequest": "completeJobRequest", + "$id": "775", + "Name": "options", + "NameInRequest": "options", "Description": "Request model for completing job.", "Type": { - "$ref": "356" + "$ref": "355" }, "Location": "Body", "IsRequired": true, @@ -7009,11 +6941,11 @@ "Kind": "Method" }, { - "$id": "780", + "$id": "776", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "781", + "$id": "777", "Name": "String", "Kind": "String", "IsNullable": false @@ -7028,19 +6960,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "782", + "$id": "778", "Type": { - "$ref": "781" + "$ref": "777" }, "Value": "application/json" } }, { - "$id": "783", + "$id": "779", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "784", + "$id": "780", "Name": "String", "Kind": "String", "IsNullable": false @@ -7055,9 +6987,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "785", + "$id": "781", "Type": { - "$ref": "784" + "$ref": "780" }, "Value": "application/json" } @@ -7065,7 +6997,7 @@ ], "Responses": [ { - "$id": "786", + "$id": "782", "StatusCodes": [ 200 ], @@ -7077,7 +7009,7 @@ "HttpMethod": "POST", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}:complete", + "Path": "/routing/jobs/{jobId}:complete", "RequestMediaTypes": [ "application/json" ], @@ -7086,25 +7018,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "787", + "$id": "783", "Name": "closeJob", "ResourceName": "JobRouterRestClient", "Summary": "Closes a completed job.", "Description": "Closes a completed job.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "788", - "Name": "id", - "NameInRequest": "id", + "$id": "784", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "Id of the job.", "Type": { - "$id": "789", + "$id": "785", "Name": "string", "Kind": "String", "IsNullable": false @@ -7120,12 +7052,12 @@ "Kind": "Method" }, { - "$id": "790", - "Name": "closeJobRequest", - "NameInRequest": "closeJobRequest", + "$id": "786", + "Name": "options", + "NameInRequest": "options", "Description": "Request model for closing job.", "Type": { - "$ref": "361" + "$ref": "360" }, "Location": "Body", "IsRequired": true, @@ -7138,11 +7070,11 @@ "Kind": "Method" }, { - "$id": "791", + "$id": "787", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "792", + "$id": "788", "Name": "String", "Kind": "String", "IsNullable": false @@ -7157,19 +7089,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "793", + "$id": "789", "Type": { - "$ref": "792" + "$ref": "788" }, "Value": "application/json" } }, { - "$id": "794", + "$id": "790", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "795", + "$id": "791", "Name": "String", "Kind": "String", "IsNullable": false @@ -7184,9 +7116,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "796", + "$id": "792", "Type": { - "$ref": "795" + "$ref": "791" }, "Value": "application/json" } @@ -7194,7 +7126,7 @@ ], "Responses": [ { - "$id": "797", + "$id": "793", "StatusCodes": [ 200 ], @@ -7203,7 +7135,7 @@ "IsErrorResponse": false }, { - "$id": "798", + "$id": "794", "StatusCodes": [ 202 ], @@ -7215,7 +7147,7 @@ "HttpMethod": "POST", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}:close", + "Path": "/routing/jobs/{jobId}:close", "RequestMediaTypes": [ "application/json" ], @@ -7224,25 +7156,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "799", + "$id": "795", "Name": "listJobs", "ResourceName": "JobRouterRestClient", "Summary": "Retrieves list of jobs based on filter parameters.", "Description": "Retrieves list of jobs based on filter parameters.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "800", + "$id": "796", "Name": "maxpagesize", "NameInRequest": "maxpagesize", "Description": "Number of objects to return per page.", "Type": { - "$id": "801", + "$id": "797", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -7258,7 +7190,7 @@ "Kind": "Method" }, { - "$id": "802", + "$id": "798", "Name": "status", "NameInRequest": "status", "Description": "If specified, filter jobs by status.", @@ -7276,12 +7208,12 @@ "Kind": "Method" }, { - "$id": "803", + "$id": "799", "Name": "queueId", "NameInRequest": "queueId", "Description": "If specified, filter jobs by queue.", "Type": { - "$id": "804", + "$id": "800", "Name": "string", "Kind": "String", "IsNullable": false @@ -7297,12 +7229,12 @@ "Kind": "Method" }, { - "$id": "805", + "$id": "801", "Name": "channelId", "NameInRequest": "channelId", "Description": "If specified, filter jobs by channel.", "Type": { - "$id": "806", + "$id": "802", "Name": "string", "Kind": "String", "IsNullable": false @@ -7318,12 +7250,12 @@ "Kind": "Method" }, { - "$id": "807", + "$id": "803", "Name": "classificationPolicyId", "NameInRequest": "classificationPolicyId", "Description": "If specified, filter jobs by classificationPolicy.", "Type": { - "$id": "808", + "$id": "804", "Name": "string", "Kind": "String", "IsNullable": false @@ -7339,12 +7271,12 @@ "Kind": "Method" }, { - "$id": "809", + "$id": "805", "Name": "scheduledBefore", "NameInRequest": "scheduledBefore", "Description": "If specified, filter on jobs that was scheduled before or at given timestamp.\nRange: (-Inf, scheduledBefore].", "Type": { - "$id": "810", + "$id": "806", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -7360,12 +7292,12 @@ "Kind": "Method" }, { - "$id": "811", + "$id": "807", "Name": "scheduledAfter", "NameInRequest": "scheduledAfter", "Description": "If specified, filter on jobs that was scheduled at or after given value. Range:\n[scheduledAfter, +Inf).", "Type": { - "$id": "812", + "$id": "808", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -7381,11 +7313,11 @@ "Kind": "Method" }, { - "$id": "813", + "$id": "809", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "814", + "$id": "810", "Name": "String", "Kind": "String", "IsNullable": false @@ -7400,9 +7332,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "815", + "$id": "811", "Type": { - "$ref": "814" + "$ref": "810" }, "Value": "application/json" } @@ -7410,12 +7342,12 @@ ], "Responses": [ { - "$id": "816", + "$id": "812", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "370" + "$ref": "369" }, "BodyMediaType": "Json", "Headers": [], @@ -7428,7 +7360,7 @@ "Path": "/routing/jobs", "BufferResponse": true, "Paging": { - "$id": "817", + "$id": "813", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -7436,25 +7368,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "818", + "$id": "814", "Name": "getQueuePosition", "ResourceName": "JobRouterRestClient", "Summary": "Gets a job's position details.", "Description": "Gets a job's position details.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "819", - "Name": "id", - "NameInRequest": "id", + "$id": "815", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "Id of the job.", "Type": { - "$id": "820", + "$id": "816", "Name": "string", "Kind": "String", "IsNullable": false @@ -7470,11 +7402,11 @@ "Kind": "Method" }, { - "$id": "821", + "$id": "817", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "822", + "$id": "818", "Name": "String", "Kind": "String", "IsNullable": false @@ -7489,9 +7421,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "823", + "$id": "819", "Type": { - "$ref": "822" + "$ref": "818" }, "Value": "application/json" } @@ -7499,12 +7431,12 @@ ], "Responses": [ { - "$id": "824", + "$id": "820", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "379" + "$ref": "374" }, "BodyMediaType": "Json", "Headers": [], @@ -7514,31 +7446,31 @@ "HttpMethod": "GET", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}/position", + "Path": "/routing/jobs/{jobId}/position", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "825", + "$id": "821", "Name": "unassignJob", "ResourceName": "JobRouterRestClient", "Summary": "Un-assign a job.", "Description": "Un-assign a job.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "826", - "Name": "id", - "NameInRequest": "id", + "$id": "822", + "Name": "jobId", + "NameInRequest": "jobId", "Description": "Id of the job to un-assign.", "Type": { - "$id": "827", + "$id": "823", "Name": "string", "Kind": "String", "IsNullable": false @@ -7554,12 +7486,12 @@ "Kind": "Method" }, { - "$id": "828", + "$id": "824", "Name": "assignmentId", "NameInRequest": "assignmentId", "Description": "Id of the assignment to un-assign.", "Type": { - "$id": "829", + "$id": "825", "Name": "string", "Kind": "String", "IsNullable": false @@ -7575,12 +7507,12 @@ "Kind": "Method" }, { - "$id": "830", - "Name": "unassignJobRequest", - "NameInRequest": "unassignJobRequest", + "$id": "826", + "Name": "options", + "NameInRequest": "options", "Description": "Request body for unassign route.", "Type": { - "$ref": "390" + "$ref": "385" }, "Location": "Body", "IsRequired": false, @@ -7593,11 +7525,11 @@ "Kind": "Method" }, { - "$id": "831", + "$id": "827", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "832", + "$id": "828", "Name": "String", "Kind": "String", "IsNullable": false @@ -7612,19 +7544,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "833", + "$id": "829", "Type": { - "$ref": "832" + "$ref": "828" }, "Value": "application/json" } }, { - "$id": "834", + "$id": "830", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "835", + "$id": "831", "Name": "String", "Kind": "String", "IsNullable": false @@ -7639,9 +7571,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "836", + "$id": "832", "Type": { - "$ref": "835" + "$ref": "831" }, "Value": "application/json" } @@ -7649,12 +7581,12 @@ ], "Responses": [ { - "$id": "837", + "$id": "833", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "393" + "$ref": "388" }, "BodyMediaType": "Json", "Headers": [], @@ -7664,7 +7596,7 @@ "HttpMethod": "POST", "RequestBodyMediaType": "Json", "Uri": "{endpoint}", - "Path": "/routing/jobs/{id}/assignments/{assignmentId}:unassign", + "Path": "/routing/jobs/{jobId}/assignments/{assignmentId}:unassign", "RequestMediaTypes": [ "application/json" ], @@ -7673,25 +7605,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "838", + "$id": "834", "Name": "acceptJobOffer", "ResourceName": "JobRouterRestClient", "Summary": "Accepts an offer to work on a job and returns a 409/Conflict if another agent\naccepted the job already.", "Description": "Accepts an offer to work on a job and returns a 409/Conflict if another agent\naccepted the job already.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "839", + "$id": "835", "Name": "workerId", "NameInRequest": "workerId", "Description": "Id of the worker.", "Type": { - "$id": "840", + "$id": "836", "Name": "string", "Kind": "String", "IsNullable": false @@ -7707,12 +7639,12 @@ "Kind": "Method" }, { - "$id": "841", + "$id": "837", "Name": "offerId", "NameInRequest": "offerId", "Description": "Id of the offer.", "Type": { - "$id": "842", + "$id": "838", "Name": "string", "Kind": "String", "IsNullable": false @@ -7728,11 +7660,11 @@ "Kind": "Method" }, { - "$id": "843", + "$id": "839", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "844", + "$id": "840", "Name": "String", "Kind": "String", "IsNullable": false @@ -7747,9 +7679,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "845", + "$id": "841", "Type": { - "$ref": "844" + "$ref": "840" }, "Value": "application/json" } @@ -7757,12 +7689,12 @@ ], "Responses": [ { - "$id": "846", + "$id": "842", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "398" + "$ref": "393" }, "BodyMediaType": "Json", "Headers": [], @@ -7778,25 +7710,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "847", + "$id": "843", "Name": "declineJobOffer", "ResourceName": "JobRouterRestClient", "Summary": "Declines an offer to work on a job.", "Description": "Declines an offer to work on a job.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "848", + "$id": "844", "Name": "workerId", "NameInRequest": "workerId", "Description": "Id of the worker.", "Type": { - "$id": "849", + "$id": "845", "Name": "string", "Kind": "String", "IsNullable": false @@ -7812,12 +7744,12 @@ "Kind": "Method" }, { - "$id": "850", + "$id": "846", "Name": "offerId", "NameInRequest": "offerId", "Description": "Id of the offer.", "Type": { - "$id": "851", + "$id": "847", "Name": "string", "Kind": "String", "IsNullable": false @@ -7833,12 +7765,12 @@ "Kind": "Method" }, { - "$id": "852", - "Name": "declineJobOfferRequest", - "NameInRequest": "declineJobOfferRequest", + "$id": "848", + "Name": "options", + "NameInRequest": "options", "Description": "Request model for declining offer.", "Type": { - "$ref": "405" + "$ref": "400" }, "Location": "Body", "IsRequired": false, @@ -7851,11 +7783,11 @@ "Kind": "Method" }, { - "$id": "853", + "$id": "849", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "854", + "$id": "850", "Name": "String", "Kind": "String", "IsNullable": false @@ -7870,19 +7802,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "855", + "$id": "851", "Type": { - "$ref": "854" + "$ref": "850" }, "Value": "application/json" } }, { - "$id": "856", + "$id": "852", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "857", + "$id": "853", "Name": "String", "Kind": "String", "IsNullable": false @@ -7897,9 +7829,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "858", + "$id": "854", "Type": { - "$ref": "857" + "$ref": "853" }, "Value": "application/json" } @@ -7907,7 +7839,7 @@ ], "Responses": [ { - "$id": "859", + "$id": "855", "StatusCodes": [ 200 ], @@ -7928,25 +7860,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "860", + "$id": "856", "Name": "getQueueStatistics", "ResourceName": "JobRouterRestClient", "Summary": "Retrieves a queue's statistics.", "Description": "Retrieves a queue's statistics.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "861", - "Name": "id", - "NameInRequest": "id", + "$id": "857", + "Name": "queueId", + "NameInRequest": "queueId", "Description": "Id of the queue to retrieve statistics.", "Type": { - "$id": "862", + "$id": "858", "Name": "string", "Kind": "String", "IsNullable": false @@ -7962,11 +7894,11 @@ "Kind": "Method" }, { - "$id": "863", + "$id": "859", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "864", + "$id": "860", "Name": "String", "Kind": "String", "IsNullable": false @@ -7981,9 +7913,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "865", + "$id": "861", "Type": { - "$ref": "864" + "$ref": "860" }, "Value": "application/json" } @@ -7991,12 +7923,12 @@ ], "Responses": [ { - "$id": "866", + "$id": "862", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "408" + "$ref": "403" }, "BodyMediaType": "Json", "Headers": [], @@ -8006,13 +7938,13 @@ "HttpMethod": "GET", "RequestBodyMediaType": "None", "Uri": "{endpoint}", - "Path": "/routing/queues/{id}/statistics", + "Path": "/routing/queues/{queueId}/statistics", "BufferResponse": true, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": true }, { - "$id": "867", + "$id": "863", "Name": "upsertWorker", "ResourceName": "RouterWorker", "Summary": "Creates or updates a worker.", @@ -8020,18 +7952,18 @@ "Accessibility": "internal", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "868", + "$id": "864", "Name": "workerId", "NameInRequest": "workerId", "Description": "Id of the worker.", "Type": { - "$id": "869", + "$id": "865", "Name": "string", "Kind": "String", "IsNullable": false @@ -8047,15 +7979,15 @@ "Kind": "Method" }, { - "$id": "870", + "$id": "866", "Name": "contentType", "NameInRequest": "Content-Type", "Description": "This request has a JSON Merge Patch body.", "Type": { - "$id": "871", + "$id": "867", "Name": "Literal", "LiteralValueType": { - "$id": "872", + "$id": "868", "Name": "String", "Kind": "String", "IsNullable": false @@ -8065,9 +7997,9 @@ }, "Location": "Header", "DefaultValue": { - "$id": "873", + "$id": "869", "Type": { - "$ref": "871" + "$ref": "867" }, "Value": "application/merge-patch+json" }, @@ -8081,12 +8013,12 @@ "Kind": "Constant" }, { - "$id": "874", + "$id": "870", "Name": "ifMatch", "NameInRequest": "If-Match", "Description": "The request should only proceed if an entity matches this string.", "Type": { - "$id": "875", + "$id": "871", "Name": "string", "Kind": "String", "IsNullable": false @@ -8102,12 +8034,12 @@ "Kind": "Method" }, { - "$id": "876", + "$id": "872", "Name": "ifUnmodifiedSince", "NameInRequest": "If-Unmodified-Since", "Description": "The request should only proceed if the entity was not modified after this time.", "Type": { - "$id": "877", + "$id": "873", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -8123,12 +8055,12 @@ "Kind": "Method" }, { - "$id": "878", + "$id": "874", "Name": "resource", "NameInRequest": "resource", "Description": "The resource instance.", "Type": { - "$ref": "419" + "$ref": "414" }, "Location": "Body", "IsRequired": true, @@ -8141,11 +8073,11 @@ "Kind": "Method" }, { - "$id": "879", + "$id": "875", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "880", + "$id": "876", "Name": "String", "Kind": "String", "IsNullable": false @@ -8160,9 +8092,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "881", + "$id": "877", "Type": { - "$ref": "880" + "$ref": "876" }, "Value": "application/json" } @@ -8170,34 +8102,34 @@ ], "Responses": [ { - "$id": "882", + "$id": "878", "StatusCodes": [ 201 ], "BodyType": { - "$ref": "419" + "$ref": "414" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "883", + "$id": "879", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "884", + "$id": "880", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "885", + "$id": "881", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "886", + "$id": "882", "Name": "string", "Kind": "String", "IsNullable": false @@ -8207,34 +8139,34 @@ "IsErrorResponse": false }, { - "$id": "887", + "$id": "883", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "419" + "$ref": "414" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "888", + "$id": "884", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "889", + "$id": "885", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "890", + "$id": "886", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "891", + "$id": "887", "Name": "string", "Kind": "String", "IsNullable": false @@ -8256,25 +8188,25 @@ "GenerateConvenienceMethod": false }, { - "$id": "892", + "$id": "888", "Name": "getWorker", "ResourceName": "RouterWorker", "Summary": "Retrieves an existing worker by Id.", "Description": "Retrieves an existing worker by Id.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "893", + "$id": "889", "Name": "workerId", "NameInRequest": "workerId", "Description": "Id of the worker.", "Type": { - "$id": "894", + "$id": "890", "Name": "string", "Kind": "String", "IsNullable": false @@ -8290,11 +8222,11 @@ "Kind": "Method" }, { - "$id": "895", + "$id": "891", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "896", + "$id": "892", "Name": "String", "Kind": "String", "IsNullable": false @@ -8309,9 +8241,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "897", + "$id": "893", "Type": { - "$ref": "896" + "$ref": "892" }, "Value": "application/json" } @@ -8319,34 +8251,34 @@ ], "Responses": [ { - "$id": "898", + "$id": "894", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "419" + "$ref": "414" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "899", + "$id": "895", "Name": "ETag", "NameInResponse": "etagHeader", "Description": "The entity tag for the response.", "Type": { - "$id": "900", + "$id": "896", "Name": "string", "Kind": "String", "IsNullable": false } }, { - "$id": "901", + "$id": "897", "Name": "Last-Modified", "NameInResponse": "lastModifiedTimestamp", "Description": "The last modified timestamp.", "Type": { - "$id": "902", + "$id": "898", "Name": "string", "Kind": "String", "IsNullable": false @@ -8365,25 +8297,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "903", + "$id": "899", "Name": "deleteWorker", "ResourceName": "RouterWorker", "Summary": "Deletes a worker and all of its traces.", "Description": "Deletes a worker and all of its traces.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "904", + "$id": "900", "Name": "workerId", "NameInRequest": "workerId", "Description": "Id of the worker.", "Type": { - "$id": "905", + "$id": "901", "Name": "string", "Kind": "String", "IsNullable": false @@ -8399,11 +8331,11 @@ "Kind": "Method" }, { - "$id": "906", + "$id": "902", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "907", + "$id": "903", "Name": "String", "Kind": "String", "IsNullable": false @@ -8418,9 +8350,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "908", + "$id": "904", "Type": { - "$ref": "907" + "$ref": "903" }, "Value": "application/json" } @@ -8428,7 +8360,7 @@ ], "Responses": [ { - "$id": "909", + "$id": "905", "StatusCodes": [ 204 ], @@ -8446,25 +8378,25 @@ "GenerateConvenienceMethod": true }, { - "$id": "910", + "$id": "906", "Name": "listWorkers", "ResourceName": "JobRouterRestClient", "Summary": "Retrieves existing workers.", "Description": "Retrieves existing workers.", "Parameters": [ { - "$ref": "497" + "$ref": "493" }, { - "$ref": "499" + "$ref": "495" }, { - "$id": "911", + "$id": "907", "Name": "maxpagesize", "NameInRequest": "maxpagesize", "Description": "Number of objects to return per page.", "Type": { - "$id": "912", + "$id": "908", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -8480,7 +8412,7 @@ "Kind": "Method" }, { - "$id": "913", + "$id": "909", "Name": "state", "NameInRequest": "state", "Description": "If specified, select workers by worker state.", @@ -8498,12 +8430,12 @@ "Kind": "Method" }, { - "$id": "914", + "$id": "910", "Name": "channelId", "NameInRequest": "channelId", "Description": "If specified, select workers who have a channel configuration with this channel.", "Type": { - "$id": "915", + "$id": "911", "Name": "string", "Kind": "String", "IsNullable": false @@ -8519,12 +8451,12 @@ "Kind": "Method" }, { - "$id": "916", + "$id": "912", "Name": "queueId", "NameInRequest": "queueId", "Description": "If specified, select workers who are assigned to this queue.", "Type": { - "$id": "917", + "$id": "913", "Name": "string", "Kind": "String", "IsNullable": false @@ -8540,12 +8472,12 @@ "Kind": "Method" }, { - "$id": "918", + "$id": "914", "Name": "hasCapacity", "NameInRequest": "hasCapacity", "Description": "If set to true, select only workers who have capacity for the channel specified\nby `channelId` or for any channel if `channelId` not specified. If set to\nfalse, then will return all workers including workers without any capacity for\njobs. Defaults to false.", "Type": { - "$id": "919", + "$id": "915", "Name": "boolean", "Kind": "Boolean", "IsNullable": false @@ -8561,11 +8493,11 @@ "Kind": "Method" }, { - "$id": "920", + "$id": "916", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "921", + "$id": "917", "Name": "String", "Kind": "String", "IsNullable": false @@ -8580,9 +8512,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "922", + "$id": "918", "Type": { - "$ref": "921" + "$ref": "917" }, "Value": "application/json" } @@ -8590,12 +8522,12 @@ ], "Responses": [ { - "$id": "923", + "$id": "919", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "473" + "$ref": "470" }, "BodyMediaType": "Json", "Headers": [], @@ -8608,7 +8540,7 @@ "Path": "/routing/workers", "BufferResponse": true, "Paging": { - "$id": "924", + "$id": "920", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -8617,7 +8549,7 @@ } ], "Protocol": { - "$id": "925" + "$id": "921" }, "Creatable": true } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/AcceptJobOfferResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/AcceptJobOfferResult.cs deleted file mode 100644 index b11f995ded876..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/AcceptJobOfferResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("AcceptJobOfferResult")] - public partial class AcceptJobOfferResult - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/BestWorkerMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/BestWorkerMode.cs index 40353e0d3efc0..4ffe9568329e8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/BestWorkerMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/BestWorkerMode.cs @@ -2,14 +2,12 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { /// Jobs are distributed to the worker with the strongest abilities available. - [CodeGenModel("BestWorkerMode")] public partial class BestWorkerMode : IUtf8JsonSerializable { #region Default scoring rule @@ -18,54 +16,37 @@ public partial class BestWorkerMode : IUtf8JsonSerializable /// Default scoring formula that uses the number of job labels that the worker labels match, as well as the number of label selectors the worker labels match and/or exceed /// using a logistic function (https://en.wikipedia.org/wiki/Logistic_function). /// - public BestWorkerMode() : this(null) + public BestWorkerMode() { + Kind = "best-worker"; } #endregion /// - /// Initializes a new instance of BestWorkerModePolicy with user-specified scoring rule. + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// 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 . /// - /// Defines a scoring rule to use, when calculating a score to determine the best worker. - /// (Optional) List of that will be sent as part of the payload to scoring rule. - /// (Optional) If true, will try to obtain scores for a batch of workers. By default, set to false. - /// (Optional) Set batch size when 'allowScoringBatchOfWorkers' is set to true to control batch size of workers. Defaults to 20 if not set. - /// (Optional) If false, will sort scores by ascending order. By default, set to true. - /// If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for the job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. -#pragma warning disable CS0051 // parameter type 'IList' is less accessible than method - public BestWorkerMode(RouterRule scoringRule = default, - IList scoringParameterSelectors = default, - bool allowScoringBatchOfWorkers = false, - int? batchSize = default, - bool descendingOrder = true, - bool bypassSelectors = false) - : this(null) -#pragma warning restore CS0051 // parameter type 'IList' is less accessible than method - { - if (batchSize is <= 0) - { - throw new ArgumentException("Value of batchSize has to be an integer greater than zero"); - } - - ScoringRule = scoringRule; - ScoringRuleOptions = new ScoringRuleOptions(batchSize,new ChangeTrackingList(), allowScoringBatchOfWorkers, descendingOrder); - - if (scoringParameterSelectors is not null) - { - foreach (var scoringParameterSelector in scoringParameterSelectors) - { - ScoringRuleOptions.ScoringParameters.Add(scoringParameterSelector); - } - } + public RouterRule ScoringRule { get; set; } - BypassSelectors = bypassSelectors; - } - - internal BestWorkerMode(string kind) - { - Kind = kind ?? "best-worker"; - } + /// + /// Encapsulates all options that can be passed as parameters for scoring rule with + /// BestWorkerMode + /// + public ScoringRuleOptions ScoringRuleOptions { get; set; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelExceptionAction.cs index 86ea0390153f2..01660c2aae4c9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelExceptionAction.cs @@ -1,19 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("CancelExceptionAction")] public partial class CancelExceptionAction: IUtf8JsonSerializable { /// Initializes a new instance of CancelExceptionAction. - /// (Optional) Customer supplied note, e.g., cancellation reason. - /// (Optional) Customer supplied disposition code for specifying any short label. - public CancelExceptionAction(string note = default, string dispositionCode = default) : this("cancel", note, dispositionCode) + public CancelExceptionAction() { + Kind = "cancel"; } /// @@ -21,6 +20,7 @@ public CancelExceptionAction(string note = default, string dispositionCode = def /// current timestamp. /// public string Note { get; set; } + /// /// (Optional) Indicates the outcome of the job, populate this field with your own /// custom values. @@ -30,6 +30,11 @@ public CancelExceptionAction(string note = default, string dispositionCode = def void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Note)) { writer.WritePropertyName("note"u8); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobOptions.cs index 10ee900ea591a..a5f1943f1e21b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobOptions.cs @@ -9,25 +9,8 @@ namespace Azure.Communication.JobRouter /// /// Options for cancelling a job. /// - public class CancelJobOptions + public partial class CancelJobOptions { - /// - /// Public constructor. - /// - /// Id of the job. - /// is null. - public CancelJobOptions(string jobId) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - JobId = jobId; - } - - /// - /// Id of the job. - /// - public string JobId { get; } - /// Reason code for cancelled or closed jobs. public string DispositionCode { get; set; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ChannelConfiguration.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ChannelConfiguration.cs deleted file mode 100644 index 99d3113525caf..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ChannelConfiguration.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("ChannelConfiguration")] - public partial class ChannelConfiguration: IUtf8JsonSerializable - { - /// The maximum number of jobs that can be supported concurrently for this channel. - public int? MaxNumberOfJobs { get; set; } - - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("capacityCostPerJob"u8); - writer.WriteNumberValue(CapacityCostPerJob); - if (Optional.IsDefined(MaxNumberOfJobs)) - { - writer.WritePropertyName("maxNumberOfJobs"u8); - writer.WriteNumberValue(MaxNumberOfJobs.Value); - } - writer.WriteEndObject(); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs index 00b9ee9fb5785..ca6e6157e1a1f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Linq; using System.Text.Json; @@ -8,58 +9,30 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("ClassificationPolicy")] - [CodeGenSuppress("ClassificationPolicy")] public partial class ClassificationPolicy: IUtf8JsonSerializable { /// Initializes a new instance of ClassificationPolicy. - internal ClassificationPolicy() + /// Id of the policy. + /// is null. + public ClassificationPolicy(string classificationPolicyId) { - _queueSelectors = new ChangeTrackingList(); - _workerSelectors = new ChangeTrackingList(); - } + Argument.AssertNotNullOrWhiteSpace(classificationPolicyId, nameof(classificationPolicyId)); - [CodeGenMember("QueueSelectors")] - internal IList _queueSelectors - { - get - { - return QueueSelectors != null && QueueSelectors.Any() - ? QueueSelectors.ToList() - : new ChangeTrackingList(); - } - set - { - QueueSelectors.AddRange(value); - } - } - - [CodeGenMember("WorkerSelectors")] - internal IList _workerSelectors - { - get - { - return WorkerSelectors != null && WorkerSelectors.Any() - ? WorkerSelectors.ToList() - : new ChangeTrackingList(); - } - set - { - WorkerSelectors.AddRange(value); - } + Id = classificationPolicyId; } - /// The queue selectors to resolve a queue for a given job. - public List QueueSelectors { get; } = new List(); + /// The queue selector attachments used to resolve a queue for a given job. + public IList QueueSelectorAttachments { get; } = new List(); - /// The worker label selectors to attach to a given job. - public List WorkerSelectors { get; } = new List(); + /// The worker selector attachments used to attach worker selectors to a given job. + public IList WorkerSelectorAttachments { get; } = new List(); /// (Optional) The name of the classification policy. - public string Name { get; internal set; } + public string Name { get; set; } + + /// The fallback queue to select if the queue selector attachments fail to resolve a queue for a given job. + public string FallbackQueueId { get; set; } - /// The fallback queue to select if the queue selector doesn't find a match. - public string FallbackQueueId { get; internal set; } /// /// A rule of one of the following types: /// @@ -71,7 +44,23 @@ internal IList _workerSelectors /// 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 RouterRule PrioritizationRule { get; internal set; } + public RouterRule PrioritizationRule { get; set; } + + [CodeGenMember("Etag")] + internal string _etag + { + get + { + return ETag.ToString(); + } + set + { + ETag = new ETag(value); + } + } + + /// Concurrency Token. + public ETag ETag { get; internal set; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -86,11 +75,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("fallbackQueueId"u8); writer.WriteStringValue(FallbackQueueId); } - if (Optional.IsCollectionDefined(_queueSelectors)) + if (Optional.IsCollectionDefined(QueueSelectorAttachments)) { - writer.WritePropertyName("queueSelectors"u8); + writer.WritePropertyName("queueSelectorAttachments"u8); writer.WriteStartArray(); - foreach (var item in _queueSelectors) + foreach (var item in QueueSelectorAttachments) { writer.WriteObjectValue(item); } @@ -101,16 +90,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("prioritizationRule"u8); writer.WriteObjectValue(PrioritizationRule); } - if (Optional.IsCollectionDefined(_workerSelectors)) + if (Optional.IsCollectionDefined(WorkerSelectorAttachments)) { - writer.WritePropertyName("workerSelectors"u8); + writer.WritePropertyName("workerSelectorAttachments"u8); writer.WriteStartArray(); - foreach (var item in _workerSelectors) + foreach (var item in WorkerSelectorAttachments) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.ToString()); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyItem.cs deleted file mode 100644 index 1eb5e3a2f0ae3..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyItem.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("ClassificationPolicyItem")] - public partial class ClassificationPolicyItem - { - [CodeGenMember("Etag")] - internal string _etag - { - get - { - return ETag.ToString(); - } - set - { - ETag = new ETag(value); - } - } - - /// (Optional) The Concurrency Token. - public ETag ETag { get; internal set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobOptions.cs index d1c8b27e11948..1afc7458b5dcf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobOptions.cs @@ -9,34 +9,8 @@ namespace Azure.Communication.JobRouter /// /// Options for closing a job. /// - public class CloseJobOptions + public partial class CloseJobOptions { - /// - /// Public constructor. - /// - /// Id of the job. - /// The id used to assign the job to a worker. - /// is null. - /// is null. - public CloseJobOptions(string jobId, string assignmentId) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - Argument.AssertNotNullOrWhiteSpace(assignmentId, nameof(assignmentId)); - - JobId = jobId; - AssignmentId = assignmentId; - } - - /// - /// Id of the job. - /// - public string JobId { get; } - - /// - /// The id used to assign the job to a worker. - /// - public string AssignmentId { get; } - /// Reason code for cancelled or closed jobs. public string DispositionCode { get; set; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobOptions.cs index c3bf9b9947791..d368d021f6a4b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobOptions.cs @@ -9,34 +9,8 @@ namespace Azure.Communication.JobRouter /// /// Options for completing a job. /// - public class CompleteJobOptions + public partial class CompleteJobOptions { - /// - /// Public constructor. - /// - /// Id of the job. - /// The id used to assign the job to a worker. - /// is null. - /// is null. - public CompleteJobOptions(string jobId, string assignmentId) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - Argument.AssertNotNullOrWhiteSpace(assignmentId, nameof(assignmentId)); - - JobId = jobId; - AssignmentId = assignmentId; - } - - /// - /// Id of the job. - /// - public string JobId { get; } - - /// - /// The id used to assign the job to a worker. - /// - public string AssignmentId { get; } - /// /// Custom supplied note. /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalQueueSelectorAttachment.cs index f5030d32ffcbb..d80f7f8397fb1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalQueueSelectorAttachment.cs @@ -1,14 +1,40 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Collections.Generic; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("ConditionalQueueSelectorAttachment")] public partial class ConditionalQueueSelectorAttachment : IUtf8JsonSerializable { + /// Initializes a new instance of ConditionalQueueSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + public ConditionalQueueSelectorAttachment(RouterRule condition) + { + Argument.AssertNotNull(condition, nameof(condition)); + + Condition = condition; + } + + /// The queue selectors to attach. + public IList QueueSelectors { get; } = new List(); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalWorkerSelectorAttachment.cs index 6542706b531d1..ab9acc9c6a9d9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalWorkerSelectorAttachment.cs @@ -1,14 +1,40 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Collections.Generic; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("ConditionalWorkerSelectorAttachment")] public partial class ConditionalWorkerSelectorAttachment : IUtf8JsonSerializable { + /// Initializes a new instance of ConditionalWorkerSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + public ConditionalWorkerSelectorAttachment(RouterRule condition) + { + Argument.AssertNotNull(condition, nameof(condition)); + + Condition = condition; + } + + /// The queue selectors to attach. + public IList WorkerSelectors { get; } = new List(); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateClassificationPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateClassificationPolicyOptions.cs index 181361eb9c49a..969ee1df47b95 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateClassificationPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateClassificationPolicyOptions.cs @@ -31,7 +31,8 @@ public CreateClassificationPolicyOptions(string classificationPolicyId) /// Friendly name of this policy. public string Name { get; set; } - /// The fallback queue to select if the queue selector does not find a match. + + /// The fallback queue to select if the queue selector attachments fail to resolve a queue for a given job. public string FallbackQueueId { get; set; } /// @@ -44,11 +45,11 @@ public CreateClassificationPolicyOptions(string classificationPolicyId) /// public RouterRule PrioritizationRule { get; set; } - /// The queue selectors to resolve a queue for a given job. - public List QueueSelectors { get; } = new List(); + /// The queue selector attachments used to resolve a queue for a given job. + public IList QueueSelectorAttachments { get; } = new List(); - /// The worker label selectors to attach to a given job. - public List WorkerSelectors { get; } = new List(); + /// The worker selector attachments used to attach worker selectors to a given job. + public IList WorkerSelectorAttachments { get; } = new List(); /// /// The content to send as the request conditions of the request. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateExceptionPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateExceptionPolicyOptions.cs index 39e93b80abb11..3f55cf1f2c9ce 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateExceptionPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateExceptionPolicyOptions.cs @@ -16,16 +16,16 @@ public class CreateExceptionPolicyOptions /// Public constructor. /// /// Id of the policy. - /// A dictionary collection of exception rules on the exception policy. Key is the Id of each exception rule. + /// A collection of exception rules on the exception policy. Key is the Id of each exception rule. /// is null. /// is null. - public CreateExceptionPolicyOptions(string exceptionPolicyId, IDictionary exceptionRules) + public CreateExceptionPolicyOptions(string exceptionPolicyId, IList exceptionRules) { Argument.AssertNotNullOrWhiteSpace(exceptionPolicyId, nameof(exceptionPolicyId)); Argument.AssertNotNullOrEmpty(exceptionRules, nameof(exceptionRules)); ExceptionPolicyId = exceptionPolicyId; - ExceptionRules = exceptionRules; + ExceptionRules.AddRange(exceptionRules); } /// @@ -34,9 +34,9 @@ public CreateExceptionPolicyOptions(string exceptionPolicyId, IDictionary - /// A dictionary collection of exception rules on the exception policy. Key is the Id of each exception rule. + /// A collection of exception rules on the exception policy. Key is the Id of each exception rule. /// - public IDictionary ExceptionRules { get; } + public IList ExceptionRules { get; } = new List(); /// (Optional) The name of the exception policy. public string Name { get; set; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobOptions.cs index 724a56752f811..303334910c98a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobOptions.cs @@ -54,18 +54,18 @@ public CreateJobOptions(string jobId, string channelId, string queueId) public int? Priority { get; set; } /// A collection of manually specified label selectors, which a worker must satisfy in order to process this job. - public List RequestedWorkerSelectors { get; } = new List(); + public IList RequestedWorkerSelectors { get; } = new List(); /// Notes attached to a job, sorted by timestamp. - public List Notes { get; } = new List(); + public IList Notes { get; } = new List(); /// A set of non-identifying attributes attached to this job. - public IDictionary Tags { get; } = new Dictionary(); + public IDictionary Tags { get; } = new Dictionary(); /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// - public IDictionary Labels { get; } = new Dictionary(); + public IDictionary Labels { get; } = new Dictionary(); /// /// If provided, will determine how job matching will be carried out. Default mode: QueueAndMatchMode. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobWithClassificationPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobWithClassificationPolicyOptions.cs index 42fa110571f86..205627876dcd2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobWithClassificationPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobWithClassificationPolicyOptions.cs @@ -57,18 +57,18 @@ public CreateJobWithClassificationPolicyOptions(string jobId, string channelId, public int? Priority { get; set; } /// A collection of manually specified label selectors, which a worker must satisfy in order to process this job. - public List RequestedWorkerSelectors { get; } = new List(); + public IList RequestedWorkerSelectors { get; } = new List(); /// Notes attached to a job, sorted by timestamp. - public List Notes { get; } = new List(); + public IList Notes { get; } = new List(); /// A set of non-identifying attributes attached to this job. - public IDictionary Tags { get; } = new Dictionary(); + public IDictionary Tags { get; } = new Dictionary(); /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// - public IDictionary Labels { get; } = new Dictionary(); + public IDictionary Labels { get; } = new Dictionary(); /// /// If provided, will determine how job matching will be carried out. Default mode: QueueAndMatchMode. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateQueueOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateQueueOptions.cs index 8567e1eaa41eb..49aafd7d4058c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateQueueOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateQueueOptions.cs @@ -46,7 +46,7 @@ public CreateQueueOptions(string queueId, string distributionPolicyId) /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// - public IDictionary Labels { get; } = new Dictionary(); + public IDictionary Labels { get; } = new Dictionary(); /// /// The content to send as the request conditions of the request. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateWorkerOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateWorkerOptions.cs index 0ec2cdd45116a..2ecf252198ee2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateWorkerOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateWorkerOptions.cs @@ -16,15 +16,15 @@ public class CreateWorkerOptions /// Public constructor. /// /// Id of the job. - /// The total capacity score this worker has to manage multiple concurrent jobs. + /// The total capacity score this worker has to manage multiple concurrent jobs. /// is null. - public CreateWorkerOptions(string workerId, int totalCapacity) + public CreateWorkerOptions(string workerId, int capacity) { Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - Argument.AssertNotNull(totalCapacity, nameof(totalCapacity)); + Argument.AssertNotNull(capacity, nameof(capacity)); WorkerId = workerId; - TotalCapacity = totalCapacity; + Capacity = capacity; } /// @@ -35,7 +35,7 @@ public CreateWorkerOptions(string workerId, int totalCapacity) /// /// The total capacity score this worker has to manage multiple concurrent jobs. /// - public int TotalCapacity { get; } + public int Capacity { get; } /// A flag indicating this worker is open to receive offers or not. public bool AvailableForOffers { get; set; } @@ -43,18 +43,18 @@ public CreateWorkerOptions(string workerId, int totalCapacity) /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// - public IDictionary Labels { get; } = new Dictionary(); + public IDictionary Labels { get; } = new Dictionary(); /// /// A set of non-identifying attributes attached to this worker. /// - public IDictionary Tags { get; } = new Dictionary(); + public IDictionary Tags { get; } = new Dictionary(); /// The channel(s) this worker can handle and their impact on the workers capacity. - public IDictionary ChannelConfigurations { get; } = new Dictionary(); + public IList Channels { get; } = new List(); /// The queue(s) that this worker can receive work from. - public IDictionary QueueAssignments { get; } = new Dictionary(); + public IList Queues { get; } = new List(); /// /// The content to send as the request conditions of the request. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferOptions.cs index e443d9ae7269a..4b83bdc358161 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferOptions.cs @@ -9,34 +9,8 @@ namespace Azure.Communication.JobRouter /// /// Options for declining an offer. /// - public class DeclineJobOfferOptions + public partial class DeclineJobOfferOptions { - /// - /// Public constructor. - /// - /// The Id of the Worker. - /// The Id of the Job offer. - /// is null. - /// is null. - public DeclineJobOfferOptions(string workerId, string offerId) - { - Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - Argument.AssertNotNullOrWhiteSpace(offerId, nameof(offerId)); - - WorkerId = workerId; - OfferId = offerId; - } - - /// - /// Id of the worker. - /// - public string WorkerId { get; } - - /// - /// Id of the offer. - /// - public string OfferId { get; } - /// /// If the RetryOfferAt is not provided, then this job will not be offered again to the worker who declined this job unless /// the worker is de-registered and re-registered. If a RetryOfferAt time is provided, then the job will be re-matched to diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DirectMapRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DirectMapRouterRule.cs index 3cee7a8c4a0e4..2c232cc32ddaf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DirectMapRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DirectMapRouterRule.cs @@ -6,13 +6,12 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("DirectMapRouterRule")] - [CodeGenSuppress("DirectMapRouterRule")] public partial class DirectMapRouterRule : IUtf8JsonSerializable { /// Initializes a new instance of DirectMapRouterRule. - public DirectMapRouterRule(): this("direct-map-rule") + public DirectMapRouterRule() { + Kind = "direct-map-rule"; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionMode.cs index 4c2bb385a7512..2d408b4f814fa 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionMode.cs @@ -7,14 +7,11 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("DistributionMode")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class DistributionMode : IUtf8JsonSerializable { - internal DistributionMode(string kind) - { - Kind = kind; - } + /// The type discriminator describing a sub-type of DistributionMode. + public string Kind { get; protected set; } /// /// (Optional) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicy.cs index c4b7dc229a09c..39507268bf92b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicy.cs @@ -7,13 +7,16 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("DistributionPolicy")] - [CodeGenSuppress("DistributionPolicy")] public partial class DistributionPolicy : IUtf8JsonSerializable { /// Initializes a new instance of DistributionPolicy. - internal DistributionPolicy() + /// Id of the policy. + /// is null. + public DistributionPolicy(string distributionPolicyId) { + Argument.AssertNotNullOrWhiteSpace(distributionPolicyId, nameof(distributionPolicyId)); + + Id = distributionPolicyId; } /// Initializes a new instance of DistributionPolicy. @@ -42,14 +45,30 @@ internal double? _offerExpiresAfterSeconds } /// (Optional) The name of the distribution policy. - public string Name { get; internal set; } + public string Name { get; set; } /// /// Abstract base class for defining a distribution mode /// 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 DistributionMode Mode { get; internal set; } + public DistributionMode Mode { get; set; } + + [CodeGenMember("Etag")] + internal string _etag + { + get + { + return ETag.ToString(); + } + set + { + ETag = new ETag(value); + } + } + + /// Concurrency Token. + public ETag ETag { get; internal set; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -69,6 +88,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("mode"u8); writer.WriteObjectValue(Mode); } + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.ToString()); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyItem.cs deleted file mode 100644 index 9bc08660d3143..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyItem.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("DistributionPolicyItem")] - public partial class DistributionPolicyItem - { - [CodeGenMember("Etag")] - internal string _etag - { - get - { - return ETag.ToString(); - } - set - { - ETag = new ETag(value); - } - } - - /// (Optional) The Concurrency Token. - public ETag ETag { get; internal set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs index 736e0ad441706..08a3ee3ed0758 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs @@ -7,15 +7,23 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("ExceptionAction")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class ExceptionAction : IUtf8JsonSerializable { + /// The type discriminator describing a sub-type of ExceptionAction. + public string Kind { get; protected set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind); + writer.WriteStringValue(Kind); writer.WriteEndObject(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicy.cs index 446b3fa7bff52..a7068c6633671 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicy.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Linq; using System.Text.Json; @@ -8,39 +9,39 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("ExceptionPolicy")] - [CodeGenSuppress("ExceptionPolicy")] public partial class ExceptionPolicy : IUtf8JsonSerializable { /// Initializes a new instance of ExceptionPolicy. - internal ExceptionPolicy() + /// Id of the policy. + /// is null. + public ExceptionPolicy(string exceptionPolicyId) { - _exceptionRules = new ChangeTrackingDictionary(); + Argument.AssertNotNullOrWhiteSpace(exceptionPolicyId, nameof(exceptionPolicyId)); + + Id = exceptionPolicyId; } - [CodeGenMember("ExceptionRules")] - internal IDictionary _exceptionRules + /// (Optional) A collection of exception rules on the exception policy. Key is the Id of each exception rule. + public IList ExceptionRules { get; } = new List(); + + /// (Optional) The name of the exception policy. + public string Name { get; set; } + + [CodeGenMember("Etag")] + internal string _etag { get { - return ExceptionRules != null && ExceptionRules.Count != 0 - ? ExceptionRules?.ToDictionary(x => x.Key, x => x.Value) - : new ChangeTrackingDictionary(); + return ETag.ToString(); } set { - if (value != null && value.Any()) - { - ExceptionRules.Append(value); - } + ETag = new ETag(value); } } - /// (Optional) A dictionary collection of exception rules on the exception policy. Key is the Id of each exception rule. - public IDictionary ExceptionRules { get; } = new Dictionary(); - - /// (Optional) The name of the exception policy. - public string Name { get; internal set; } + /// Concurrency Token. + public ETag ETag { get; internal set; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -50,16 +51,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } - if (Optional.IsCollectionDefined(_exceptionRules)) + if (Optional.IsCollectionDefined(ExceptionRules)) { writer.WritePropertyName("exceptionRules"u8); - writer.WriteStartObject(); - foreach (var item in _exceptionRules) + writer.WriteStartArray(); + foreach (var item in ExceptionRules) { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + writer.WriteObjectValue(item); } - writer.WriteEndObject(); + writer.WriteEndArray(); + } + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.ToString()); } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyItem.cs deleted file mode 100644 index 4135300b86203..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyItem.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("ExceptionPolicyItem")] - public partial class ExceptionPolicyItem - { - [CodeGenMember("Etag")] - internal string _etag - { - get - { - return ETag.ToString(); - } - set - { - ETag = new ETag(value); - } - } - - /// (Optional) The Concurrency Token. - public ETag ETag { get; internal set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionRule.cs index 533d1aba48003..ea5d1b8d8a391 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionRule.cs @@ -9,37 +9,35 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("ExceptionRule")] public partial class ExceptionRule : IUtf8JsonSerializable { /// Initializes a new instance of ExceptionRule. + /// Id of the exception rule. /// The trigger for this exception rule. - /// A dictionary collection of actions to perform once the exception is triggered. Key is the Id of each exception action. - /// or is null. - public ExceptionRule(ExceptionTrigger trigger, IDictionary actions) + /// . + public ExceptionRule(string id, ExceptionTrigger trigger) { + Id = id ?? throw new ArgumentNullException(nameof(id)); Trigger = trigger ?? throw new ArgumentNullException(nameof(trigger)); - Actions = actions ?? throw new ArgumentNullException(nameof(actions)); } /// A dictionary collection of actions to perform once the exception is triggered. Key is the Id of each exception action. - public IDictionary Actions { get; } + public IList Actions { get; } = new List(); void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); writer.WritePropertyName("trigger"u8); writer.WriteObjectValue(Trigger); writer.WritePropertyName("actions"u8); - writer.WriteStartObject(); + writer.WriteStartArray(); foreach (var item in Actions) { - writer.WritePropertyName(item.Key); -#pragma warning disable CS8604 // Null requires to be sent as payload as well - writer.WriteObjectValue(item.Value); -#pragma warning restore CS8604 + writer.WriteObjectValue(item); } - writer.WriteEndObject(); + writer.WriteEndArray(); writer.WriteEndObject(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs index 29f0f0a2e0e3a..19679feaf1372 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs @@ -7,11 +7,12 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("JobExceptionTrigger")] - [CodeGenSuppress("JobExceptionTrigger")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class ExceptionTrigger : IUtf8JsonSerializable { + /// The type discriminator describing a sub-type of ExceptionTrigger. + public string Kind { get; protected set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExpressionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExpressionRouterRule.cs index 2793ab06c4335..58ada46c259bb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExpressionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExpressionRouterRule.cs @@ -7,8 +7,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("ExpressionRouterRule")] - [CodeGenSuppress("ExpressionRouterRule", typeof(string), typeof(string))] public partial class ExpressionRouterRule : IUtf8JsonSerializable { /// The available expression languages that can be configured. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRule.cs index 5eac194c1e837..77887891f4528 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRule.cs @@ -7,8 +7,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("FunctionRouterRule")] - [CodeGenSuppress("FunctionRouterRule")] public partial class FunctionRouterRule : IUtf8JsonSerializable { /// Initializes a new instance of AzureFunctionRule. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRuleCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRuleCredential.cs index 0d58d58c7653b..8ecba2a888582 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRuleCredential.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRuleCredential.cs @@ -7,8 +7,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("FunctionRouterRuleCredential")] - [CodeGenSuppress("FunctionRouterRuleCredential")] public partial class FunctionRouterRuleCredential : IUtf8JsonSerializable { /// Initializes a new instance of AzureFunctionRuleCredential. @@ -42,19 +40,19 @@ public FunctionRouterRuleCredential(string appKey, string clientId) } /// (Optional) Access key scoped to a particular function. - public string FunctionKey { get; internal set; } + internal string FunctionKey { get; } /// /// (Optional) Access key scoped to a Azure Function app. /// This key grants access to all functions under the app. /// - public string AppKey { get; internal set; } + internal string AppKey { get; } /// /// (Optional) Client id, when AppKey is provided /// In context of Azure function, this is usually the name of the key /// - public string ClientId { get; internal set; } + internal string ClientId { get; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs index 6101c97ab4698..3cb9588bb7297 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Collections.Generic; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("JobMatchingMode")] - [CodeGenSuppress("JobMatchingMode")] - public partial class JobMatchingMode : IUtf8JsonSerializable + public abstract partial class JobMatchingMode : IUtf8JsonSerializable { + /// The type discriminator describing a sub-type of JobMatchingMode. + public string Kind { get; protected set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationClient.cs index 046ef742d4a80..2ca8fa7eec905 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationClient.cs @@ -10,6 +10,8 @@ namespace Azure.Communication.JobRouter { + [CodeGenSuppress("JobRouterAdministrationClient", typeof(Uri))] + [CodeGenSuppress("JobRouterAdministrationClient", typeof(Uri), typeof(JobRouterClientOptions))] [CodeGenSuppress("CreateGetExceptionPoliciesNextPageRequest", typeof(string), typeof(int?), typeof(RequestContext))] [CodeGenSuppress("CreateGetClassificationPoliciesNextPageRequest", typeof(string), typeof(int?), typeof(RequestContext))] [CodeGenSuppress("CreateGetQueuesNextPageRequest", typeof(string), typeof(int?), typeof(RequestContext))] @@ -63,6 +65,32 @@ public JobRouterAdministrationClient(Uri endpoint, TokenCredential credential, J #endregion public constructors + #region internal constructors + + /// Initializes a new instance of JobRouterClient. + /// The Uri to use. + /// is null. + internal JobRouterAdministrationClient(Uri endpoint) : this(endpoint, new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of JobRouterClient. + /// The Uri to use. + /// The options for configuring the client. + /// is null. + internal JobRouterAdministrationClient(Uri endpoint, JobRouterClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new JobRouterClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + #endregion + #region private constructors private JobRouterAdministrationClient(ConnectionString connectionString, JobRouterClientOptions options) @@ -109,13 +137,13 @@ public virtual async Task> CreateClassificationPo PrioritizationRule = options.PrioritizationRule, }; - request.QueueSelectors.AddRange(options.QueueSelectors); - request.WorkerSelectors.AddRange(options.WorkerSelectors); + request.QueueSelectorAttachments.AddRange(options.QueueSelectorAttachments); + request.WorkerSelectorAttachments.AddRange(options.WorkerSelectorAttachments); var result = await UpsertClassificationPolicyAsync( - id: options.ClassificationPolicyId, + classificationPolicyId: options.ClassificationPolicyId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -147,13 +175,13 @@ public virtual Response CreateClassificationPolicy( PrioritizationRule = options.PrioritizationRule, }; - request.QueueSelectors.AddRange(options.QueueSelectors); - request.WorkerSelectors.AddRange(options.WorkerSelectors); + request.QueueSelectorAttachments.AddRange(options.QueueSelectorAttachments); + request.WorkerSelectorAttachments.AddRange(options.WorkerSelectorAttachments); var result = UpsertClassificationPolicy( - id: options.ClassificationPolicyId, + classificationPolicyId: options.ClassificationPolicyId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(ClassificationPolicy.FromResponse(result), result); @@ -165,32 +193,23 @@ public virtual Response CreateClassificationPolicy( } } - /// Creates or updates classification policy. - /// (Optional) Options for updating classification policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Updates classification policy. + /// Classification policy to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual async Task> UpdateClassificationPolicyAsync( - UpdateClassificationPolicyOptions options, + ClassificationPolicy classificationPolicy, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); scope.Start(); try { - var request = new ClassificationPolicy() - { - Name = options.Name, - FallbackQueueId = options.FallbackQueueId, - PrioritizationRule = options.PrioritizationRule - }; - - request.QueueSelectors.AddRange(options.QueueSelectors); - request.WorkerSelectors.AddRange(options.WorkerSelectors); - var response = await UpsertClassificationPolicyAsync( - id: options.ClassificationPolicyId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + classificationPolicyId: classificationPolicy.Id, + content: classificationPolicy.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -203,32 +222,23 @@ public virtual async Task> UpdateClassificationPo } } - /// Creates or updates a classification policy. - /// (Optional) Options for updating classification policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Updates classification policy. + /// Classification policy to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual Response UpdateClassificationPolicy( - UpdateClassificationPolicyOptions options, + ClassificationPolicy classificationPolicy, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); scope.Start(); try { - var request = new ClassificationPolicy() - { - Name = options.Name, - FallbackQueueId = options.FallbackQueueId, - PrioritizationRule = options.PrioritizationRule - }; - - request.QueueSelectors.AddRange(options.QueueSelectors); - request.WorkerSelectors.AddRange(options.WorkerSelectors); - var response = UpsertClassificationPolicy( - id: options.ClassificationPolicyId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + classificationPolicyId: classificationPolicy.Id, + content: classificationPolicy.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(ClassificationPolicy.FromResponse(response), response); @@ -240,6 +250,86 @@ public virtual Response UpdateClassificationPolicy( } } + /// + /// [Protocol Method] Updates a classification policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier of this policy. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task UpdateClassificationPolicyAsync(string classificationPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertClassificationPolicyRequest(classificationPolicyId, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Updates a classification policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Unique identifier of this policy. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual Response UpdateClassificationPolicy(string classificationPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertClassificationPolicyRequest(classificationPolicyId, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + #endregion ClassificationPolicy #region DistributionPolicy @@ -262,9 +352,9 @@ public virtual async Task> CreateDistributionPolicy }; var response = await UpsertDistributionPolicyAsync( - id: options.DistributionPolicyId, + distributionPolicyId: options.DistributionPolicyId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -295,9 +385,9 @@ public virtual Response CreateDistributionPolicy( }; var response = UpsertDistributionPolicy( - id: options.DistributionPolicyId, + distributionPolicyId: options.DistributionPolicyId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(DistributionPolicy.FromResponse(response), response); @@ -310,28 +400,22 @@ public virtual Response CreateDistributionPolicy( } /// Updates a distribution policy. - /// (Optional) Options for the distribution policy. + /// The distribution policy to update. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual async Task> UpdateDistributionPolicyAsync( - UpdateDistributionPolicyOptions options, + DistributionPolicy distributionPolicy, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); scope.Start(); try { - var request = new DistributionPolicy() - { - Name = options.Name, - OfferExpiresAfter = options.OfferExpiresAfter, - Mode = options.Mode, - }; - var response = await UpsertDistributionPolicyAsync( - id: options.DistributionPolicyId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + distributionPolicyId: distributionPolicy.Id, + content: distributionPolicy.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -345,28 +429,22 @@ public virtual async Task> UpdateDistributionPolicy } /// Updates a distribution policy. - /// (Optional) Options for the distribution policy. + /// The distribution policy to update. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual Response UpdateDistributionPolicy( - UpdateDistributionPolicyOptions options, + DistributionPolicy distributionPolicy, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); scope.Start(); try { - var request = new DistributionPolicy() - { - Name = options.Name, - OfferExpiresAfter = options.OfferExpiresAfter, - Mode = options.Mode, - }; - var response = UpsertDistributionPolicy( - id: options.DistributionPolicyId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + distributionPolicyId: distributionPolicy.Id, + content: distributionPolicy.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(DistributionPolicy.FromResponse(response), response); @@ -378,6 +456,86 @@ public virtual Response UpdateDistributionPolicy( } } + /// + /// [Protocol Method] Updates a distribution policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The unique identifier of the policy. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task UpdateDistributionPolicyAsync(string distributionPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertDistributionPolicyRequest(distributionPolicyId, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Updates a distribution policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The unique identifier of the policy. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual Response UpdateDistributionPolicy(string distributionPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertDistributionPolicyRequest(distributionPolicyId, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + #endregion DistributionPolicy #region ExceptionPolicy @@ -399,15 +557,12 @@ public virtual async Task> CreateExceptionPolicyAsync( Name = options.Name }; - foreach (var rule in options.ExceptionRules) - { - request.ExceptionRules[rule.Key] = rule.Value; - } + request.ExceptionRules.AddRange(options.ExceptionRules); var response = await UpsertExceptionPolicyAsync( - id: options.ExceptionPolicyId, + exceptionPolicyId: options.ExceptionPolicyId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -437,15 +592,12 @@ public virtual Response CreateExceptionPolicy( Name = options.Name }; - foreach (var rule in options.ExceptionRules) - { - request.ExceptionRules[rule.Key] = rule.Value; - } + request.ExceptionRules.AddRange(options.ExceptionRules); var response = UpsertExceptionPolicy( - id: options.ExceptionPolicyId, + exceptionPolicyId: options.ExceptionPolicyId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(ExceptionPolicy.FromResponse(response), response); @@ -458,31 +610,22 @@ public virtual Response CreateExceptionPolicy( } /// Creates a new exception policy. - /// Options for updating exception policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Exception policy to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual async Task> UpdateExceptionPolicyAsync( - UpdateExceptionPolicyOptions options, + ExceptionPolicy exceptionPolicy, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); scope.Start(); try { - var request = new ExceptionPolicy() - { - Name = options.Name - }; - - foreach (var rule in options.ExceptionRules) - { - request.ExceptionRules[rule.Key] = rule.Value; - } - var response = await UpsertExceptionPolicyAsync( - id: options.ExceptionPolicyId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + exceptionPolicyId: exceptionPolicy.Id, + content: exceptionPolicy.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -495,32 +638,23 @@ public virtual async Task> UpdateExceptionPolicyAsync( } } - /// Creates or updates a exception policy. - /// Options for updating exception policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Creates a new exception policy. + /// Exception policy to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual Response UpdateExceptionPolicy( - UpdateExceptionPolicyOptions options, + ExceptionPolicy exceptionPolicy, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); scope.Start(); try { - var request = new ExceptionPolicy() - { - Name = options.Name - }; - - foreach (var rule in options.ExceptionRules) - { - request.ExceptionRules[rule.Key] = rule.Value; - } - var response = UpsertExceptionPolicy( - id: options.ExceptionPolicyId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + exceptionPolicyId: exceptionPolicy.Id, + content: exceptionPolicy.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(ExceptionPolicy.FromResponse(response), response); @@ -532,11 +666,91 @@ public virtual Response UpdateExceptionPolicy( } } + /// + /// [Protocol Method] Updates a exception policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Id of the exception policy. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual async Task UpdateExceptionPolicyAsync(string exceptionPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertExceptionPolicyRequest(exceptionPolicyId, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Updates a exception policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Id of the exception policy. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response UpdateExceptionPolicy(string exceptionPolicyId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertExceptionPolicyRequest(exceptionPolicyId, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + #endregion ExceptionPolicy #region Queue - /// Creates or updates a queue. + /// Creates a queue. /// Options for creating a job queue. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. @@ -561,9 +775,9 @@ public virtual async Task> CreateQueueAsync( } var response = await UpsertQueueAsync( - id: options.QueueId, + queueId: options.QueueId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -576,7 +790,7 @@ public virtual async Task> CreateQueueAsync( } } - /// Creates or updates a queue. + /// Creates a queue. /// Options for creating a job queue. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. @@ -601,9 +815,9 @@ public virtual Response CreateQueue( } var response = UpsertQueue( - id: options.QueueId, + queueId: options.QueueId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(RouterQueue.FromResponse(response), response); @@ -615,35 +829,24 @@ public virtual Response CreateQueue( } } - /// Creates or updates a queue. - /// Options for updating a job queue. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Updates a queue. + /// Queue to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. - /// is null. + /// is null. /// The server returned an error. See for details returned from the server. public virtual async Task> UpdateQueueAsync( - UpdateQueueOptions options, + RouterQueue queue, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); scope.Start(); try { - var request = new RouterQueue() - { - DistributionPolicyId = options.DistributionPolicyId, - Name = options.Name, - ExceptionPolicyId = options.ExceptionPolicyId, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - var response = await UpsertQueueAsync( - id: options.QueueId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + queueId: queue.Id, + content: queue.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -656,35 +859,23 @@ public virtual async Task> UpdateQueueAsync( } } - /// Creates or updates a queue. - /// Options for updating a queue. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Updates a queue. + /// Queue to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. + /// is null. /// The server returned an error. See for details returned from the server. public virtual Response UpdateQueue( - UpdateQueueOptions options, + RouterQueue queue, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); scope.Start(); try { - var request = new RouterQueue() - { - DistributionPolicyId = options.DistributionPolicyId, - Name = options.Name, - ExceptionPolicyId = options.ExceptionPolicyId, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - var response = UpsertQueue( - id: options.QueueId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + queueId: queue.Id, + content: queue.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(RouterQueue.FromResponse(response), response); @@ -696,6 +887,86 @@ public virtual Response UpdateQueue( } } + /// + /// [Protocol Method] Updates a queue. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Id of this queue. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task UpdateQueueAsync(string queueId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertQueueRequest(queueId, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Updates a queue. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Id of this queue. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + internal virtual Response UpdateQueue(string queueId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertQueueRequest(queueId, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + #endregion Queue /// Initializes a new instance of JobRouterAdministrationRestClient. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClient.cs index 4fcd48c34d177..ea59d5ca84dad 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClient.cs @@ -11,6 +11,8 @@ namespace Azure.Communication.JobRouter { + [CodeGenSuppress("JobRouterClient", typeof(Uri))] + [CodeGenSuppress("JobRouterClient", typeof(Uri), typeof(JobRouterClientOptions))] [CodeGenSuppress("CreateGetJobsNextPageRequest", typeof(string), typeof(int?), typeof(string), typeof(string), typeof(string), typeof(string), typeof(DateTimeOffset), typeof(DateTimeOffset), typeof(RequestContext))] [CodeGenSuppress("CreateGetWorkersNextPageRequest", typeof(string), typeof(int?), typeof(string), typeof(string), typeof(string), typeof(bool), typeof(RequestContext))] public partial class JobRouterClient @@ -62,6 +64,32 @@ public JobRouterClient(Uri endpoint, TokenCredential credential, JobRouterClient #endregion + #region internal constructors + + /// Initializes a new instance of JobRouterClient. + /// The Uri to use. + /// is null. + internal JobRouterClient(Uri endpoint) : this(endpoint, new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of JobRouterClient. + /// The Uri to use. + /// The options for configuring the client. + /// is null. + internal JobRouterClient(Uri endpoint, JobRouterClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new JobRouterClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + #endregion + #region private constructors private JobRouterClient(ConnectionString connectionString, JobRouterClientOptions options) @@ -150,9 +178,9 @@ public virtual async Task> CreateJobWithClassificationPolicy } var response = await UpsertJobAsync( - id: options.JobId, + jobId: options.JobId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -208,9 +236,9 @@ public virtual Response CreateJobWithClassificationPolicy( } var response = UpsertJob( - id: options.JobId, + jobId: options.JobId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(RouterJob.FromResponse(response), response); @@ -268,9 +296,9 @@ public virtual async Task> CreateJobAsync( } var response = await UpsertJobAsync( - id: options.JobId, + jobId: options.JobId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -325,9 +353,9 @@ public virtual Response CreateJob( } var response = UpsertJob( - id: options.JobId, + jobId: options.JobId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(RouterJob.FromResponse(response), response); @@ -342,52 +370,22 @@ public virtual Response CreateJob( #endregion Create job with direct queue assignment /// Update an existing job. - /// Options for updating a job. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Job to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual async Task> UpdateJobAsync( - UpdateJobOptions options, + RouterJob job, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); scope.Start(); try { - var request = new RouterJob - { - ChannelId = options.ChannelId, - ClassificationPolicyId = options.ClassificationPolicyId, - ChannelReference = options.ChannelReference, - QueueId = options.QueueId, - Priority = options.Priority, - DispositionCode = options.DispositionCode, - MatchingMode = options.MatchingMode, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var workerSelector in options.RequestedWorkerSelectors) - { - request.RequestedWorkerSelectors.Add(workerSelector); - } - - foreach (var note in options.Notes) - { - request.Notes.Add(note); - } - var response = await UpsertJobAsync( - id: options.JobId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + jobId: job.Id, + content: job.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -401,52 +399,22 @@ public virtual async Task> UpdateJobAsync( } /// Update an existing job. - /// Options for updating a job. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Job to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual Response UpdateJob( - UpdateJobOptions options, + RouterJob job, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); scope.Start(); try { - var request = new RouterJob - { - ChannelId = options.ChannelId, - ClassificationPolicyId = options.ClassificationPolicyId, - ChannelReference = options.ChannelReference, - QueueId = options.QueueId, - Priority = options.Priority, - DispositionCode = options.DispositionCode, - MatchingMode = options.MatchingMode, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var workerSelector in options.RequestedWorkerSelectors) - { - request.RequestedWorkerSelectors.Add(workerSelector); - } - - foreach (var note in options.Notes) - { - request.Notes.Add(note); - } - var response = UpsertJob( - id: options.JobId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + jobId: job.Id, + content: job.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(RouterJob.FromResponse(response), response); @@ -458,124 +426,101 @@ public virtual Response UpdateJob( } } - /// Reclassify a job. + /// + /// [Protocol Method] Updates a router job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// /// The id of the job. - /// (Optional) The cancellation token to use. - /// - ///The server returned an error. See for details returned from the server. - public virtual async Task ReclassifyJobAsync( - string jobId, - CancellationToken cancellationToken = default) + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task UpdateJobAsync(string jobId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNull(content, nameof(content)); - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(ReclassifyJob)}"); + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); scope.Start(); try { - return await ReclassifyJobAsync( - id: jobId, - reclassifyJobRequest: new Dictionary(), - cancellationToken: cancellationToken).ConfigureAwait(false); + using HttpMessage message = CreateUpsertJobRequest(jobId, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - catch (Exception ex) + catch (Exception e) { - scope.Failed(ex); + scope.Failed(e); throw; } } - /// Reclassify a job. + /// + /// [Protocol Method] Updates a router job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// /// The id of the job. - /// (Optional) The cancellation token to use. - /// - ///The server returned an error. See for details returned from the server. - public virtual Response ReclassifyJob( - string jobId, - CancellationToken cancellationToken = default) + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual Response UpdateJob(string jobId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNull(content, nameof(content)); - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(ReclassifyJob)}"); - scope.Start(); - try - { - return ReclassifyJob( - id: jobId, - reclassifyJobRequest: new Dictionary(), - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); - /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. - /// Options for cancelling a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task CancelJobAsync( - CancelJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CancelJob)}"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); scope.Start(); try { - return await CancelJobAsync( - id: options.JobId, - cancelJobRequest: new CancelJobRequest(options.Note, options.DispositionCode), - cancellationToken: cancellationToken) - .ConfigureAwait(false); + using HttpMessage message = CreateUpsertJobRequest(jobId, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); } - catch (Exception ex) + catch (Exception e) { - scope.Failed(ex); + scope.Failed(e); throw; } } - /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. - /// Options for cancelling a job. + /// Reclassify a job. + /// The id of the job. /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CancelJob( - CancelJobOptions options, - CancellationToken cancellationToken = default) + /// + ///The server returned an error. See for details returned from the server. + public virtual async Task ReclassifyJobAsync(string jobId, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CancelJob)}"); - scope.Start(); - try - { - return CancelJob( - id: options.JobId, - cancelJobRequest: new CancelJobRequest(options.Note, options.DispositionCode), - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } + Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - /// Completes an assigned job. - /// Options for completing a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task CompleteJobAsync( - CompleteJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CompleteJob)}"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(ReclassifyJob)}"); scope.Start(); try { - return await CompleteJobAsync( - id: options.JobId, - completeJobRequest: new CompleteJobRequest(options.AssignmentId, options.Note), + return await ReclassifyJobAsync(jobId: jobId, + options: new Dictionary(), cancellationToken: cancellationToken) .ConfigureAwait(false); } @@ -586,70 +531,22 @@ public virtual async Task CompleteJobAsync( } } - /// Completes an assigned job. - /// Options for completing a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CompleteJob( - CompleteJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CompleteJob)}"); - scope.Start(); - try - { - return CompleteJob( - id: options.JobId, - completeJobRequest: new CompleteJobRequest(options.AssignmentId, options.Note), - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Closes a completed job. - /// Options for closing a job. + /// Reclassify a job. + /// The id of the job. /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task CloseJobAsync( - CloseJobOptions options, - CancellationToken cancellationToken = default) + /// + ///The server returned an error. See for details returned from the server. + public virtual Response ReclassifyJob(string jobId, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CloseJob)}"); - scope.Start(); - try - { - return await CloseJobAsync( - id: options.JobId, - closeJobRequest: new CloseJobRequest(options.AssignmentId, options.DispositionCode, options.CloseAt, options.Note), - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } + Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - /// Closes a completed job. - /// Options for closing a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CloseJob( - CloseJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CloseJob)}"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(ReclassifyJob)}"); scope.Start(); try { - return CloseJob( - id: options.JobId, - closeJobRequest: new CloseJobRequest(options.AssignmentId, options.DispositionCode, options.CloseAt, options.Note), + return ReclassifyJob( + jobId: jobId, + options: new Dictionary(), cancellationToken: cancellationToken); } catch (Exception ex) @@ -661,57 +558,6 @@ public virtual Response CloseJob( #endregion Job - #region Offer - - /// Declines an offer to work on a job. - /// The options for declining a job offer. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task DeclineJobOfferAsync(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeclineJobOffer)}"); - scope.Start(); - try - { - return await DeclineJobOfferAsync( - workerId: options.WorkerId, - offerId: options.OfferId, - declineJobOfferRequest: new DeclineJobOfferRequest { RetryOfferAt = options.RetryOfferAt }, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Declines an offer to work on a job. - /// The options for declining a job offer. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response DeclineJobOffer(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeclineJobOffer)}"); - scope.Start(); - try - { - return DeclineJobOffer( - workerId: options.WorkerId, - offerId: options.OfferId, - declineJobOfferRequest: new DeclineJobOfferRequest { RetryOfferAt = options.RetryOfferAt }, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion Offer - #region Worker /// Create or update a worker to process jobs. @@ -726,16 +572,14 @@ public virtual async Task> CreateWorkerAsync( scope.Start(); try { - var request = new RouterWorker() + var request = new RouterWorker { - TotalCapacity = options.TotalCapacity, + Capacity = options.Capacity, AvailableForOffers = options?.AvailableForOffers }; - foreach (var queueAssignment in options.QueueAssignments) - { - request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; - } + request.Queues.AddRange(options.Queues); + request.Channels.AddRange(options.Channels); foreach (var label in options.Labels) { @@ -747,15 +591,10 @@ public virtual async Task> CreateWorkerAsync( request.Tags[tag.Key] = tag.Value; } - foreach (var channel in options.ChannelConfigurations) - { - request.ChannelConfigurations[channel.Key] = channel.Value; - } - var response = await UpsertWorkerAsync( workerId: options.WorkerId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -780,16 +619,14 @@ public virtual Response CreateWorker( scope.Start(); try { - var request = new RouterWorker() + var request = new RouterWorker { - TotalCapacity = options.TotalCapacity, + Capacity = options.Capacity, AvailableForOffers = options?.AvailableForOffers }; - foreach (var queueAssignment in options.QueueAssignments) - { - request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; - } + request.Queues.AddRange(options.Queues); + request.Channels.AddRange(options.Channels); foreach (var label in options.Labels) { @@ -801,15 +638,10 @@ public virtual Response CreateWorker( request.Tags[tag.Key] = tag.Value; } - foreach (var channel in options.ChannelConfigurations) - { - request.ChannelConfigurations[channel.Key] = channel.Value; - } - var response = UpsertWorker( workerId: options.WorkerId, content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + requestConditions: options.RequestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(RouterWorker.FromResponse(response), response); @@ -821,48 +653,23 @@ public virtual Response CreateWorker( } } - /// Create or update a worker to process jobs. - /// Options for updating a router worker. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Update a worker to process jobs. + /// Worker to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual async Task> UpdateWorkerAsync( - UpdateWorkerOptions options, + RouterWorker worker, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); scope.Start(); try { - var request = new RouterWorker() - { - TotalCapacity = options?.TotalCapacity, - AvailableForOffers = options?.AvailableForOffers - }; - - foreach (var queueAssignment in options.QueueAssignments) - { - request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; - } - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var channel in options.ChannelConfigurations) - { - request.ChannelConfigurations[channel.Key] = channel.Value; - } - var response = await UpsertWorkerAsync( - workerId: options.WorkerId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + workerId: worker.Id, + content: worker.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)) .ConfigureAwait(false); @@ -875,48 +682,23 @@ public virtual async Task> UpdateWorkerAsync( } } - /// Create or update a worker to process jobs. - /// Options for updating a router worker. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// Update a worker to process jobs. + /// Worker to update. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The content to send as the request conditions of the request. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. public virtual Response UpdateWorker( - UpdateWorkerOptions options, + RouterWorker worker, RequestConditions requestConditions = default, CancellationToken cancellationToken = default) { using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); scope.Start(); try { - var request = new RouterWorker() - { - TotalCapacity = options.TotalCapacity, - AvailableForOffers = options?.AvailableForOffers - }; - - foreach (var queueAssignment in options.QueueAssignments) - { - request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; - } - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var channel in options.ChannelConfigurations) - { - request.ChannelConfigurations[channel.Key] = channel.Value; - } - var response = UpsertWorker( - workerId: options.WorkerId, - content: request.ToRequestContent(), - requestConditions: options.RequestConditions, + workerId: worker.Id, + content: worker.ToRequestContent(), + requestConditions: requestConditions ?? new RequestConditions(), context: FromCancellationToken(cancellationToken)); return Response.FromValue(RouterWorker.FromResponse(response), response); @@ -928,53 +710,82 @@ public virtual Response UpdateWorker( } } - /// Unassign a job from a worker. - /// Options for unassigning a job from a worker. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> UnassignJobAsync(UnassignJobOptions options, CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UnassignJobAsync)}"); + /// + /// [Protocol Method] Updates a worker. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task UpdateWorkerAsync(string workerId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); scope.Start(); try { - var response = await UnassignJobAsync( - id: options.JobId, - assignmentId: options.AssignmentId, - unassignJobRequest: new UnassignJobRequest(options.SuspendMatching), - cancellationToken: cancellationToken) - .ConfigureAwait(false); - - return Response.FromValue(response.Value, response.GetRawResponse()); + using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } - catch (Exception ex) + catch (Exception e) { - scope.Failed(ex); + scope.Failed(e); throw; } } - /// Unassign a job from a worker. - /// Options for unassigning a job from a worker. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response UnassignJob(UnassignJobOptions options, CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UnassignJob)}"); + /// + /// [Protocol Method] Updates a worker. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// The content to send as the body of the request. + /// The content to send as the request conditions of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual Response UpdateWorker(string workerId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNull(content, nameof(content)); + + Argument.AssertNull(requestConditions?.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation."); + Argument.AssertNull(requestConditions?.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation."); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); scope.Start(); try { - var response = UnassignJob( - id: options.JobId, - assignmentId: options.AssignmentId, - unassignJobRequest: new UnassignJobRequest(options.SuspendMatching), - cancellationToken: cancellationToken); - - return Response.FromValue(response.Value, response.GetRawResponse()); + using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); } - catch (Exception ex) + catch (Exception e) { - scope.Failed(ex); + scope.Failed(e); throw; } } @@ -1015,40 +826,40 @@ internal HttpMessage CreateGetWorkersNextPageRequest(string nextLink, int? maxpa return message; } - /// Un-assign a job. - /// Id of the job to un-assign. - /// Id of the assignment to un-assign. - /// Request body for unassign route. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// - internal virtual async Task> UnassignJobAsync(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await UnassignJobAsync(id, assignmentId, unassignJobRequest?.ToRequestContent(), context).ConfigureAwait(false); - return Response.FromValue(UnassignJobResult.FromResponse(response), response); - } - - /// Un-assign a job. - /// Id of the job to un-assign. - /// Id of the assignment to un-assign. - /// Request body for unassign route. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// - internal virtual Response UnassignJob(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = UnassignJob(id, assignmentId, unassignJobRequest?.ToRequestContent(), context); - return Response.FromValue(UnassignJobResult.FromResponse(response), response); - } + // /// Un-assign a job. + // /// Id of the job to un-assign. + // /// Id of the assignment to un-assign. + // /// Request body for unassign route. + // /// The cancellation token to use. + // /// or is null. + // /// or is an empty string, and was expected to be non-empty. + // /// + // internal virtual async Task> UnassignJobAsync(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) + // { + // Argument.AssertNotNullOrEmpty(id, nameof(id)); + // Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + // + // RequestContext context = FromCancellationToken(cancellationToken); + // Response response = await UnassignJobAsync(id, assignmentId, unassignJobRequest?.ToRequestContent(), context).ConfigureAwait(false); + // return Response.FromValue(UnassignJobResult.FromResponse(response), response); + // } + // + // /// Un-assign a job. + // /// Id of the job to un-assign. + // /// Id of the assignment to un-assign. + // /// Request body for unassign route. + // /// The cancellation token to use. + // /// or is null. + // /// or is an empty string, and was expected to be non-empty. + // /// + // internal virtual Response UnassignJob(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) + // { + // Argument.AssertNotNullOrEmpty(id, nameof(id)); + // Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + // + // RequestContext context = FromCancellationToken(cancellationToken); + // Response response = UnassignJob(id, assignmentId, unassignJobRequest?.ToRequestContent(), context); + // return Response.FromValue(UnassignJobResult.FromResponse(response), response); + // } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClientBuilderExtensions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClientBuilderExtensions.cs new file mode 100644 index 0000000000000..e018d2bc1176f --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClientBuilderExtensions.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Runtime.CompilerServices; +using Azure.Core; +using Azure.Core.Extensions; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("CommunicationJobRouterClientBuilderExtensions")] + internal static partial class JobRouterClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// Connection string acquired from the Azure Communication Services resource. + public static IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, string connectionString) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new JobRouterAdministrationClient(connectionString, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// Connection string acquired from the Azure Communication Services resource. + public static IAzureClientBuilder AddJobRouterClient(this TBuilder builder, string connectionString) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new JobRouterClient(connectionString, options)); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterModelFactory.cs new file mode 100644 index 0000000000000..8cd089eebd072 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterModelFactory.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("CommunicationJobRouterModelFactory")] + public static partial class JobRouterModelFactory + { + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelValue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelValue.cs deleted file mode 100644 index f68dc448a69ca..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelValue.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.ComponentModel; - -namespace Azure.Communication.JobRouter -{ - /// - /// Generic value wrapper. - /// - public class LabelValue : IEquatable - { - /// - /// Primitive value. - /// - public object Value { get; } - - /// - /// Set value of type. - /// - /// - public LabelValue(int value) - { - Value = value; - } - - /// - /// Set value of type. - /// - /// - public LabelValue(long value) - { - Value = value; - } - - /// - /// Set value of type. - /// - /// - public LabelValue(float value) - { - Value = value; - } - - /// - /// Set value of type. - /// - /// - public LabelValue(double value) - { - Value = value; - } - - /// - /// Set value of type. - /// - /// - public LabelValue(string value) - { - Value = value; - } - - /// - /// Set value of type. - /// - /// - public LabelValue(decimal value) - { - Value = value; - } - - /// - /// Set value of type. - /// - /// - public LabelValue(bool value) - { - Value = value; - } - - internal LabelValue(object value) - { - Value = value; - } - - /// - public bool Equals(LabelValue other) - { - if (Value == null) - { - return other.Value == null; - } - - var response = Value.Equals(other.Value); - return response; - } - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is LabelValue other && Equals(other); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => Value?.GetHashCode() ?? 0; - - /// - public override string ToString() - { - return Value.ToString(); - } - - /// Determines if two values are the same. - public static bool operator ==(LabelValue left, LabelValue right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(LabelValue left, LabelValue right) => !left.Equals(right); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/LongestIdleMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/LongestIdleMode.cs index 30a423f49f435..b17d6f8e3392a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/LongestIdleMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/LongestIdleMode.cs @@ -9,17 +9,12 @@ namespace Azure.Communication.JobRouter { /// Jobs are directed to the worker who has been idle longest. - [CodeGenSuppress("LongestIdleMode", typeof(int), typeof(int))] public partial class LongestIdleMode : IUtf8JsonSerializable { /// Initializes a new instance of LongestIdleModePolicy. - public LongestIdleMode() : this(null) + public LongestIdleMode() { - } - - internal LongestIdleMode(string kind) - { - Kind = kind ?? "longest-idle"; + Kind = "longest-idle"; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ManualReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ManualReclassifyExceptionAction.cs index 7954f1beca25c..2cb49d0149efe 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ManualReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ManualReclassifyExceptionAction.cs @@ -9,44 +9,31 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("ManualReclassifyExceptionAction")] - [CodeGenSuppress("ManualReclassifyExceptionAction")] - [CodeGenSuppress("ManualReclassifyExceptionAction", typeof(string))] public partial class ManualReclassifyExceptionAction : IUtf8JsonSerializable { /// Initializes a new instance of ManualReclassifyExceptionAction. - public ManualReclassifyExceptionAction() : this("manual-reclassify", null, null, Array.Empty().ToList()) + public ManualReclassifyExceptionAction() { + Kind = "manual-reclassify"; } /// Updated QueueId. public string QueueId { get; set; } + /// Updated Priority. public int? Priority { get; set; } /// Updated WorkerSelectors. public IList WorkerSelectors { get; } = new List(); - [CodeGenMember("WorkerSelectors")] - internal IReadOnlyList _workerSelectors - { - get - { - return WorkerSelectors.Count != 0 - ? WorkerSelectors.ToList() : new ChangeTrackingList(); - } - set - { - foreach (var routerWorkerSelector in value) - { - WorkerSelectors.Add(routerWorkerSelector); - } - } - } - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(QueueId)) { writer.WritePropertyName("queueId"u8); @@ -57,11 +44,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("priority"u8); writer.WriteNumberValue(Priority.Value); } - if (Optional.IsCollectionDefined(_workerSelectors)) + if (Optional.IsCollectionDefined(WorkerSelectors)) { writer.WritePropertyName("workerSelectors"u8); writer.WriteStartArray(); - foreach (var item in _workerSelectors) + foreach (var item in WorkerSelectors) { writer.WriteObjectValue(item); } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/OAuth2WebhookClientCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/OAuth2WebhookClientCredential.cs new file mode 100644 index 0000000000000..0ef7f7698440e --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/OAuth2WebhookClientCredential.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class OAuth2WebhookClientCredential : IUtf8JsonSerializable + { + /// Initializes a new instance of OAuth2WebhookClientCredential. + /// ClientId for Contoso Authorization server. + /// Client secret for Contoso Authorization server. + public OAuth2WebhookClientCredential(string clientId, string clientSecret) + { + Argument.AssertNotNullOrWhiteSpace(clientId, nameof(clientId)); + Argument.AssertNotNullOrWhiteSpace(clientSecret, nameof(clientSecret)); + + ClientId = clientId; + ClientSecret = clientSecret; + } + + /// ClientId for Contoso Authorization server. + internal string ClientId { get; } + + /// Client secret for Contoso Authorization server. + internal string ClientSecret { get; } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ClientId)) + { + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + } + if (Optional.IsDefined(ClientSecret)) + { + writer.WritePropertyName("clientSecret"u8); + writer.WriteStringValue(ClientSecret); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/Oauth2ClientCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/Oauth2ClientCredential.cs deleted file mode 100644 index 53efd1c7d79b7..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/Oauth2ClientCredential.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - public partial class Oauth2ClientCredential : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ClientId)) - { - writer.WritePropertyName("clientId"u8); - writer.WriteStringValue(ClientId); - } - if (Optional.IsDefined(ClientSecret)) - { - writer.WritePropertyName("clientSecret"u8); - writer.WriteStringValue(ClientSecret); - } - writer.WriteEndObject(); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughQueueSelectorAttachment.cs index 0e716b627b99d..27561095bd2e3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughQueueSelectorAttachment.cs @@ -7,7 +7,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("PassThroughQueueSelectorAttachment")] public partial class PassThroughQueueSelectorAttachment : IUtf8JsonSerializable { /// Describes how the value of the label is compared to the value pass through. @@ -19,7 +18,8 @@ public partial class PassThroughQueueSelectorAttachment : IUtf8JsonSerializable /// is null. public PassThroughQueueSelectorAttachment(string key, LabelOperator labelOperator): this("pass-through", key, labelOperator) { - Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNullOrWhiteSpace(key, nameof(key)); + Argument.AssertNotNull(labelOperator, nameof(labelOperator)); } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughWorkerSelectorAttachment.cs index d0b78f78e6573..9fec5e40e108b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughWorkerSelectorAttachment.cs @@ -7,7 +7,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("PassThroughWorkerSelectorAttachment")] public partial class PassThroughWorkerSelectorAttachment : IUtf8JsonSerializable { /// Describes how the value of the label is compared to the value pass through. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueAndMatchMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueAndMatchMode.cs index cf06763f562a2..8c80606627f9b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueAndMatchMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueAndMatchMode.cs @@ -9,7 +9,6 @@ namespace Azure.Communication.JobRouter /// /// Used to specify default behavior of greedy matching of jobs and worker. /// - [CodeGenModel("QueueAndMatchMode")] public partial class QueueAndMatchMode : IUtf8JsonSerializable { /// diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueLengthExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueLengthExceptionTrigger.cs index 404f6237690ed..8ddc5f987f85d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueLengthExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueLengthExceptionTrigger.cs @@ -7,7 +7,6 @@ namespace Azure.Communication.JobRouter { /// Trigger for an exception action on exceeding queue length. - [CodeGenModel("QueueLengthExceptionTrigger")] public partial class QueueLengthExceptionTrigger : IUtf8JsonSerializable { /// Initializes a new instance of QueueLengthExceptionTrigger. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs index 13ea271c4a7c3..f0aba9c3d6536 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs @@ -7,10 +7,12 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("QueueSelectorAttachment")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class QueueSelectorAttachment : IUtf8JsonSerializable { + /// The type discriminator describing a sub-type of QueueSelectorAttachment. + public string Kind { get; protected set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueWeightedAllocation.cs index d30e43220e8f2..4ea4dc07f4036 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueWeightedAllocation.cs @@ -1,14 +1,31 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Collections.Generic; +using System; +using System.Linq; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("QueueWeightedAllocation")] public partial class QueueWeightedAllocation : IUtf8JsonSerializable { + /// Initializes a new instance of QueueWeightedAllocation. + /// The percentage of this weight, expressed as a fraction of 1. + /// + /// A collection of queue selectors that will be applied if this allocation is + /// selected. + /// + /// is null. + public QueueWeightedAllocation(double weight, IEnumerable queueSelectors) + { + Argument.AssertNotNull(queueSelectors, nameof(queueSelectors)); + + Weight = weight; + QueueSelectors = queueSelectors.ToList(); + } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyExceptionAction.cs index c0d61e11c0cf4..a5e5bc327c392 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyExceptionAction.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Linq; using System.Text.Json; @@ -8,48 +9,55 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("ReclassifyExceptionAction")] - [CodeGenSuppress("ReclassifyExceptionAction")] public partial class ReclassifyExceptionAction : IUtf8JsonSerializable { + /// Initializes a new instance of CancelExceptionAction. + public ReclassifyExceptionAction() + { + Kind = "reclassify"; + _labelsToUpsert = new ChangeTrackingDictionary(); + } + [CodeGenMember("LabelsToUpsert")] - internal IDictionary _labelsToUpsert + internal IDictionary _labelsToUpsert { get { return LabelsToUpsert != null && LabelsToUpsert.Count != 0 - ? LabelsToUpsert?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? LabelsToUpsert?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { - LabelsToUpsert = value != null && value.Count != 0 - ? value.ToDictionary(x => x.Key, x => new LabelValue(x.Value)) - : new Dictionary(); + if (value != null && value.Count != 0) + { + foreach (var label in value) + { + LabelsToUpsert[label.Key] = new RouterValue(label.Value.ToObjectFromJson()); + } + } } } /// /// (optional) Dictionary containing the labels to update (or add if not existing) in key-value pairs /// -#pragma warning disable CA2227 // Collection properties should be read only - public IDictionary LabelsToUpsert { get; set; } -#pragma warning restore CA2227 // Collection properties should be read only + public IDictionary LabelsToUpsert { get; } = new Dictionary(); - /// Initializes a new instance of ReclassifyExceptionAction. - /// (optional) The new classification policy that will determine queue, priority and worker selectors. - /// (optional) Dictionary containing the labels to update (or add if not existing) in key-value pairs. - public ReclassifyExceptionAction(string classificationPolicyId, IDictionary labelsToUpsert = default) - : this("reclassify", classificationPolicyId, null) - { - Argument.AssertNotNullOrWhiteSpace(classificationPolicyId, nameof(classificationPolicyId)); - - LabelsToUpsert = labelsToUpsert; - } + /// + /// (optional) The new classification policy that will determine queue, priority + /// and worker selectors. + /// + public string ClassificationPolicyId { get; set; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(ClassificationPolicyId)) { writer.WritePropertyName("classificationPolicyId"u8); @@ -67,7 +75,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNullValue(); continue; } - writer.WriteObjectValue(item.Value); + writer.WriteObjectValue(item.Value.ToObjectFromJson()); } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RoundRobinMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RoundRobinMode.cs index 12c6491932a53..981d585c3a232 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RoundRobinMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RoundRobinMode.cs @@ -9,18 +9,12 @@ namespace Azure.Communication.JobRouter { /// Jobs are distributed in order to workers, starting with the worker that is after the last worker to receive a job. - [CodeGenModel("RoundRobinMode")] - [CodeGenSuppress("RoundRobinMode", typeof(int), typeof(int))] public partial class RoundRobinMode : IUtf8JsonSerializable { /// Initializes a new instance of RoundRobinModePolicy. - public RoundRobinMode() : this(null) + public RoundRobinMode() { - } - - internal RoundRobinMode(string kind) - { - Kind = kind ?? "round-robin"; + Kind = "round-robin"; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterChannel.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterChannel.cs new file mode 100644 index 0000000000000..4060ca64a3f1a --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterChannel.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class RouterChannel : IUtf8JsonSerializable + { + /// + /// Represents the capacity a job in this channel will consume from a worker. + /// + /// Id of the channel. + /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity. + public RouterChannel(string channelId, int capacityCostPerJob) + { + Argument.AssertNotNullOrWhiteSpace(channelId, nameof(channelId)); + Argument.AssertInRange(capacityCostPerJob, 0, int.MaxValue, nameof(capacityCostPerJob)); + + ChannelId = channelId; + CapacityCostPerJob = capacityCostPerJob; + } + + /// The maximum number of jobs that can be supported concurrently for this channel. + public int? MaxNumberOfJobs { get; set; } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("channelId"u8); + writer.WriteStringValue(ChannelId); + writer.WritePropertyName("capacityCostPerJob"u8); + writer.WriteNumberValue(CapacityCostPerJob); + + if (Optional.IsDefined(MaxNumberOfJobs)) + { + writer.WritePropertyName("maxNumberOfJobs"u8); + writer.WriteNumberValue(MaxNumberOfJobs.Value); + } + + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs index f37971b6ff356..10c663f8f636a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs @@ -3,61 +3,60 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterJob")] public partial class RouterJob : IUtf8JsonSerializable { - /*/// Initializes a new instance of RouterJob. - internal RouterJob() + /// Initializes a new instance of RouterJob. + /// Id of the policy. + /// is null. + public RouterJob(string jobId) { - AttachedWorkerSelectors = new ChangeTrackingList(); - Assignments = new ChangeTrackingDictionary(); - _requestedWorkerSelectors = new ChangeTrackingList(); + Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); + Id = jobId; + _labels = new ChangeTrackingDictionary(); _tags = new ChangeTrackingDictionary(); - _notes = new ChangeTrackingDictionary(); - }*/ + } /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// - public Dictionary Labels { get; } = new Dictionary(); + public IDictionary Labels { get; } = new Dictionary(); /// A set of non-identifying attributes attached to this job. - public Dictionary Tags { get; } = new Dictionary(); + public IDictionary Tags { get; } = new Dictionary(); /// A collection of manually specified label selectors, which a worker must satisfy in order to process this job. - public List RequestedWorkerSelectors { get; } = new List(); + public IList RequestedWorkerSelectors { get; } = new List(); /// A collection of notes attached to a job. - public List Notes { get; } = new List(); + public IList Notes { get; } = new List(); /// Reference to an external parent context, eg. call ID. - public string ChannelReference { get; internal set; } + public string ChannelReference { get; set; } /// The channel identifier. eg. voice, chat, etc. - public string ChannelId { get; internal set; } + public string ChannelId { get; set; } /// The Id of the Classification policy used for classifying a job. - public string ClassificationPolicyId { get; internal set; } + public string ClassificationPolicyId { get; set; } /// The Id of the Queue that this job is queued to. - public string QueueId { get; internal set; } + public string QueueId { get; set; } /// The priority of this job. - public int? Priority { get; internal set; } + public int? Priority { get; set; } /// Reason code for cancelled or closed jobs. - public string DispositionCode { get; internal set; } + public string DispositionCode { get; set; } /// Gets or sets the matching mode. - public JobMatchingMode MatchingMode { get; internal set; } + public JobMatchingMode MatchingMode { get; set; } [CodeGenMember("Labels")] internal IDictionary _labels @@ -74,7 +73,7 @@ internal IDictionary _labels { foreach (var label in value) { - Labels[label.Key] = new LabelValue(label.Value.ToObjectFromJson()); + Labels[label.Key] = new RouterValue(label.Value.ToObjectFromJson()); } } } @@ -95,49 +94,27 @@ internal IDictionary _tags { foreach (var tag in value) { - Tags[tag.Key] = new LabelValue(tag.Value.ToObjectFromJson()); + Tags[tag.Key] = new RouterValue(tag.Value.ToObjectFromJson()); } } } } - [CodeGenMember("Notes")] - internal IDictionary _notes + [CodeGenMember("Etag")] + internal string _etag { get { - return Notes != null && Notes.Count != 0 - ? Notes?.ToDictionary(x => (x.AddedAt ?? DateTimeOffset.UtcNow) - .ToUniversalTime().ToString("O", CultureInfo.InvariantCulture), x => x.Message) - : new ChangeTrackingDictionary(); + return ETag.ToString(); } set { - foreach (var note in value.ToList()) - { - Notes.Add(new RouterJobNote - { - AddedAt = DateTimeOffsetParser.ParseAndGetDateTimeOffset(note.Key), - Message = note.Value - }); - } + ETag = new ETag(value); } } - [CodeGenMember("RequestedWorkerSelectors")] - internal IList _requestedWorkerSelectors - { - get - { - return RequestedWorkerSelectors != null && RequestedWorkerSelectors.Any() - ? RequestedWorkerSelectors.ToList() - : new ChangeTrackingList(); - } - set - { - RequestedWorkerSelectors.AddRange(value); - } - } + /// Concurrency Token. + public ETag ETag { get; internal set; } void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -172,11 +149,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dispositionCode"u8); writer.WriteStringValue(DispositionCode); } - if (Optional.IsCollectionDefined(_requestedWorkerSelectors)) + if (Optional.IsCollectionDefined(RequestedWorkerSelectors)) { writer.WritePropertyName("requestedWorkerSelectors"u8); writer.WriteStartArray(); - foreach (var item in _requestedWorkerSelectors) + foreach (var item in RequestedWorkerSelectors) { writer.WriteObjectValue(item); } @@ -214,22 +191,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - if (Optional.IsCollectionDefined(_notes)) + if (Optional.IsCollectionDefined(Notes)) { writer.WritePropertyName("notes"u8); - writer.WriteStartObject(); - foreach (var item in _notes) + writer.WriteStartArray(); + foreach (var item in Notes) { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); + writer.WriteObjectValue(item); } - writer.WriteEndObject(); + writer.WriteEndArray(); } if (Optional.IsDefined(MatchingMode)) { writer.WritePropertyName("matchingMode"u8); writer.WriteObjectValue(MatchingMode); } + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.ToString()); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs index c0358a38e9c8d..c1f7d0fdfd224 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs @@ -5,7 +5,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterJobAssignment")] public partial class RouterJobAssignment { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobItem.cs deleted file mode 100644 index 4011765f17aba..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobItem.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("RouterJobItem")] - public partial class RouterJobItem - { - [CodeGenMember("Etag")] - internal string _etag - { - get - { - return ETag.ToString(); - } - set - { - ETag = new ETag(value); - } - } - - /// (Optional) The Concurrency Token. - public ETag ETag { get; internal set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobNote.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobNote.cs index 1436420525649..37ca39c8ad993 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobNote.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobNote.cs @@ -2,22 +2,42 @@ // Licensed under the MIT License. using System; +using System.Text.Json; +using Azure.Core; namespace Azure.Communication.JobRouter { /// /// A note attached to a job /// - public class RouterJobNote + public partial class RouterJobNote : IUtf8JsonSerializable { - /// - /// The message contained in the note. - /// - public string Message { get; set; } + /// Initializes a new instance of RouterJobNote. + /// The message contained in the note. + /// is null. + public RouterJobNote(string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Message = message; + } /// /// The time at which the note was added in UTC. If not provided, will default to the current time. /// public DateTimeOffset? AddedAt { get; set; } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (Optional.IsDefined(AddedAt)) + { + writer.WritePropertyName("addedAt"u8); + writer.WriteStringValue(AddedAt.Value, "O"); + } + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobOffer.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobOffer.cs index 3a37b8c060c3e..72bb9309b0035 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobOffer.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobOffer.cs @@ -5,7 +5,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterJobOffer")] public partial class RouterJobOffer { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobPositionDetails.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobPositionDetails.cs index b6be14403966f..69381222a0320 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobPositionDetails.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobPositionDetails.cs @@ -6,7 +6,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterJobPositionDetails")] public partial class RouterJobPositionDetails { [CodeGenMember("EstimatedWaitTimeMinutes")] diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobStatus.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobStatus.cs index ba636b0484621..25ebff302aa82 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobStatus.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobStatus.cs @@ -5,7 +5,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterJobStatus")] public readonly partial struct RouterJobStatus { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueue.cs index 012af7659bd61..6e5450b6928ce 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueue.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueue.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Linq; using System.Text.Json; @@ -7,9 +8,18 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterQueue")] public partial class RouterQueue : IUtf8JsonSerializable { + /// Initializes a new instance of RouterQueue. + /// Id of the policy. + /// is null. + public RouterQueue(string queueId) + { + Argument.AssertNotNullOrWhiteSpace(queueId, nameof(queueId)); + + Id = queueId; + } + [CodeGenMember("Labels")] internal IDictionary _labels { @@ -25,7 +35,7 @@ internal IDictionary _labels { foreach (var label in value) { - Labels[label.Key] = new LabelValue(label.Value); + Labels[label.Key] = new RouterValue(label.Value); } } } @@ -34,16 +44,32 @@ internal IDictionary _labels /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// - public IDictionary Labels { get; } = new Dictionary(); + public IDictionary Labels { get; } = new Dictionary(); /// The name of this queue. - public string Name { get; internal set; } + public string Name { get; set; } /// The ID of the distribution policy that will determine how a job is distributed to workers. - public string DistributionPolicyId { get; internal set; } + public string DistributionPolicyId { get; set; } /// (Optional) The ID of the exception policy that determines various job escalation rules. - public string ExceptionPolicyId { get; internal set; } + public string ExceptionPolicyId { get; set; } + + [CodeGenMember("Etag")] + internal string _etag + { + get + { + return ETag.ToString(); + } + set + { + ETag = new ETag(value); + } + } + + /// Concurrency Token. + public ETag ETag { get; internal set; } /// Initializes a new instance of JobQueue. internal RouterQueue() @@ -85,6 +111,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("exceptionPolicyId"u8); writer.WriteStringValue(ExceptionPolicyId); } + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.ToString()); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueAssignment.cs deleted file mode 100644 index adb0bc4669c40..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueAssignment.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// An assignment of a worker to a queue. - /// - public partial class RouterQueueAssignment : IUtf8JsonSerializable - { - /// - /// Public constructor. - /// - public RouterQueueAssignment() - { - } - - /// - /// Write empty object. - /// - /// - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs deleted file mode 100644 index 2ac7edf270616..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("RouterQueueItem")] - public partial class RouterQueueItem - { - [CodeGenMember("Etag")] - internal string _etag - { - get - { - return ETag.ToString(); - } - set - { - ETag = new ETag(value); - } - } - - /// (Optional) The Concurrency Token. - public ETag ETag { get; internal set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs index 418b03713df13..0405931ff0be2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs @@ -8,8 +8,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterQueueSelector")] - [CodeGenSuppress("RouterQueueSelector", typeof(string), typeof(LabelOperator))] public partial class RouterQueueSelector : IUtf8JsonSerializable { [CodeGenMember("Value")] @@ -21,18 +19,18 @@ private BinaryData _value } set { - Value = new LabelValue(value.ToObjectFromJson()); + Value = new RouterValue(value.ToObjectFromJson()); } } /// The value to compare against the actual label value with the given operator. - public LabelValue Value { get; internal set; } + public RouterValue Value { get; internal set; } /// Initializes a new instance of QueueSelector. /// The label key to query against. /// Describes how the value of the label is compared to the value defined on the label selector. /// The value to compare against the actual label value with the given operator. - public RouterQueueSelector(string key, LabelOperator labelOperator, LabelValue value) + public RouterQueueSelector(string key, LabelOperator labelOperator, RouterValue value) { Key = key; LabelOperator = labelOperator; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueStatistics.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueStatistics.cs index 695de66b11526..4d8050b398b0e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueStatistics.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueStatistics.cs @@ -1,12 +1,40 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Collections.Generic; +using System.Linq; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterQueueStatistics")] public partial class RouterQueueStatistics { + [CodeGenMember("EstimatedWaitTimeMinutes")] + internal IDictionary _estimatedWaitTimeMinutes + { + get + { + return EstimatedWaitTimes != null && EstimatedWaitTimes.Count != 0 + ? EstimatedWaitTimes.ToDictionary(x => x.Key.ToString(), x => x.Value.TotalMinutes) + : new ChangeTrackingDictionary(); + } + set + { + if (value != null && value.Count != 0) + { + foreach (var estimatedWaitTime in value) + { + EstimatedWaitTimes[int.Parse(estimatedWaitTime.Key)] = TimeSpan.FromMinutes(estimatedWaitTime.Value); + } + } + } + } + + /// + /// The estimated wait time of this queue rounded up to the nearest minute, grouped + /// by job priority + /// + public IDictionary EstimatedWaitTimes { get; } = new Dictionary(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs index 231e771e1e12f..e37c1261e6172 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs @@ -7,11 +7,12 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterRule")] - [CodeGenSuppress("RouterRule")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class RouterRule : IUtf8JsonSerializable { + /// The type discriminator describing a sub-type of RouterRule. + public string Kind { get; protected set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterValue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterValue.cs new file mode 100644 index 0000000000000..be574a0204031 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterValue.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; + +namespace Azure.Communication.JobRouter +{ + /// + /// Generic value wrapper. + /// + public class RouterValue : IEquatable + { + /// + /// Primitive value. + /// + public object Value { get; } + + /// + /// Set value of type. + /// + /// + public RouterValue(int value) + { + Value = value; + } + + /// + /// Set value of type. + /// + /// + public RouterValue(long value) + { + Value = value; + } + + /// + /// Set value of type. + /// + /// + public RouterValue(float value) + { + Value = value; + } + + /// + /// Set value of type. + /// + /// + public RouterValue(double value) + { + Value = value; + } + + /// + /// Set value of type. + /// + /// + public RouterValue(string value) + { + Value = value; + } + + /// + /// Set value of type. + /// + /// + public RouterValue(decimal value) + { + Value = value; + } + + /// + /// Set value of type. + /// + /// + public RouterValue(bool value) + { + Value = value; + } + + internal RouterValue(object value) + { + Value = value; + } + + /// + public bool Equals(RouterValue other) + { + if (Value == null) + { + return other.Value == null; + } + + var response = Value.Equals(other.Value); + return response; + } + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RouterValue other && Equals(other); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => Value?.GetHashCode() ?? 0; + + /// + public override string ToString() + { + return Value.ToString(); + } + + /// Determines if two values are the same. + public static bool operator ==(RouterValue left, RouterValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RouterValue left, RouterValue right) => !left.Equals(right); + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs index 915177b0e610b..725b2adb96573 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs @@ -9,30 +9,42 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterWorker")] public partial class RouterWorker : IUtf8JsonSerializable { + /// Initializes a new instance of RouterWorker. + /// Id of the policy. + /// is null. + public RouterWorker(string workerId) + { + Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); + + Id = workerId; + + _labels = new ChangeTrackingDictionary(); + _tags = new ChangeTrackingDictionary(); + } + /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// - public IDictionary Labels { get; } = new Dictionary(); + public IDictionary Labels { get; } = new Dictionary(); /// /// A set of non-identifying attributes attached to this worker. /// - public IDictionary Tags { get; } = new Dictionary(); + public IDictionary Tags { get; } = new Dictionary(); /// The channel(s) this worker can handle and their impact on the workers capacity. - public IDictionary ChannelConfigurations { get; } = new Dictionary(); + public IList Channels { get; } = new List(); /// The queue(s) that this worker can receive work from. - public IDictionary QueueAssignments { get; } = new Dictionary(); + public IList Queues { get; } = new List(); /// The total capacity score this worker has to manage multiple concurrent jobs. - public int? TotalCapacity { get; internal set; } + public int? Capacity { get; set; } /// A flag indicating this worker is open to receive offers or not. - public bool? AvailableForOffers { get; internal set; } + public bool? AvailableForOffers { get; set; } [CodeGenMember("Labels")] internal IDictionary _labels @@ -49,7 +61,7 @@ internal IDictionary _labels { foreach (var label in value) { - Labels[label.Key] = new LabelValue(label.Value.ToObjectFromJson()); + Labels[label.Key] = new RouterValue(label.Value.ToObjectFromJson()); } } } @@ -70,68 +82,45 @@ internal IDictionary _tags { foreach (var tag in value) { - Tags[tag.Key] = new LabelValue(tag.Value.ToObjectFromJson()); + Tags[tag.Key] = new RouterValue(tag.Value.ToObjectFromJson()); } } } } - [CodeGenMember("ChannelConfigurations")] - internal IDictionary _channelConfigurations { - get - { - return ChannelConfigurations ?? new ChangeTrackingDictionary(); - } - set - { - foreach (var channelConfiguration in value) - { - ChannelConfigurations[channelConfiguration.Key] = new ChannelConfiguration(channelConfiguration.Value.CapacityCostPerJob, channelConfiguration.Value.MaxNumberOfJobs); - } - } - } - - [CodeGenMember("QueueAssignments")] - internal IReadOnlyDictionary _queueAssignments + [CodeGenMember("Etag")] + internal string _etag { get { - return QueueAssignments != null - ? QueueAssignments.ToDictionary(x => x.Key, x => x.Value) - : new ChangeTrackingDictionary(); + return ETag.ToString(); } set { - foreach (var queueAssignment in value) - { - QueueAssignments[queueAssignment.Key] = new RouterQueueAssignment(); - } + ETag = new ETag(value); } } + /// Concurrency Token. + public ETag ETag { get; internal set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsCollectionDefined(_queueAssignments)) + if (Optional.IsCollectionDefined(Queues)) { - writer.WritePropertyName("queueAssignments"u8); - writer.WriteStartObject(); - foreach (var item in _queueAssignments) + writer.WritePropertyName("queues"u8); + writer.WriteStartArray(); + foreach (var item in Queues) { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); + writer.WriteStringValue(item); } - writer.WriteEndObject(); + writer.WriteEndArray(); } - if (Optional.IsDefined(TotalCapacity)) + if (Optional.IsDefined(Capacity)) { - writer.WritePropertyName("totalCapacity"u8); - writer.WriteNumberValue(TotalCapacity.Value); + writer.WritePropertyName("capacity"u8); + writer.WriteNumberValue(Capacity.Value); } if (Optional.IsCollectionDefined(_labels)) { @@ -165,22 +154,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - if (Optional.IsCollectionDefined(_channelConfigurations)) + if (Optional.IsCollectionDefined(Channels)) { - writer.WritePropertyName("channelConfigurations"u8); - writer.WriteStartObject(); - foreach (var item in _channelConfigurations) + writer.WritePropertyName("channels"u8); + writer.WriteStartArray(); + foreach (var item in Channels) { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); + writer.WriteObjectValue(item); } - writer.WriteEndObject(); + writer.WriteEndArray(); } if (Optional.IsDefined(AvailableForOffers)) { writer.WritePropertyName("availableForOffers"u8); writer.WriteBooleanValue(AvailableForOffers.Value); } + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.ToString()); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerAssignment.cs index cbc171524279e..6d1fd3430ca97 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerAssignment.cs @@ -5,7 +5,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterWorkerAssignment")] public partial class RouterWorkerAssignment { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerItem.cs deleted file mode 100644 index bc7ddebe06e25..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerItem.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("RouterWorkerItem")] - public partial class RouterWorkerItem - { - [CodeGenMember("Etag")] - internal string _etag - { - get - { - return ETag.ToString(); - } - set - { - ETag = new ETag(value); - } - } - - /// (Optional) The Concurrency Token. - public ETag ETag { get; internal set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs index 4b46b2bbe9e53..e2419bcb94cdf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs @@ -7,8 +7,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterWorkerSelector")] - [CodeGenSuppress("RouterWorkerSelector", typeof(string), typeof(LabelOperator))] public partial class RouterWorkerSelector : IUtf8JsonSerializable { /// Describes how long this label selector is valid for. @@ -35,21 +33,24 @@ private BinaryData _value } set { - Value = new LabelValue(value.ToObjectFromJson()); + Value = new RouterValue(value.ToObjectFromJson()); } } /// The value to compare against the actual label value with the given operator. - public LabelValue Value { get; set; } + public RouterValue Value { get; set; } /// The time at which this worker selector expires in UTC. public DateTimeOffset? ExpiresAt { get; set; } + /// Pushes the job to the front of the queue as long as this selector is active. + public bool? Expedite { get; set; } + /// Initializes a new instance of WorkerSelector. /// The label key to query against. /// Describes how the value of the label is compared to the value defined on the label selector. /// The value to compare against the actual label value with the given operator. - public RouterWorkerSelector(string key, LabelOperator labelOperator, LabelValue value) + public RouterWorkerSelector(string key, LabelOperator labelOperator, RouterValue value) { Key = key; LabelOperator = labelOperator; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineQueueSelectorAttachment.cs index 3a319a584c8cb..001bc4ca6660b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineQueueSelectorAttachment.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Text.Json; using Azure.Core; @@ -8,6 +9,31 @@ namespace Azure.Communication.JobRouter { public partial class RuleEngineQueueSelectorAttachment : IUtf8JsonSerializable { + /// Initializes a new instance of RuleEngineQueueSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// is null. + public RuleEngineQueueSelectorAttachment(RouterRule rule) + { + Argument.AssertNotNull(rule, nameof(rule)); + + Kind = "rule-engine"; + Rule = rule; + } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineWorkerSelectorAttachment.cs index 4c8c49dc7087d..5aa62716fabe4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineWorkerSelectorAttachment.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Text.Json; using Azure.Core; @@ -8,6 +9,31 @@ namespace Azure.Communication.JobRouter { public partial class RuleEngineWorkerSelectorAttachment : IUtf8JsonSerializable { + /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. + /// + /// A rule of one of the following types: + /// + /// StaticRule: A rule + /// providing static rules that always return the same result, regardless of + /// input. + /// DirectMapRule: A rule that return the same labels as the input + /// labels. + /// ExpressionRule: A rule providing inline expression + /// rules. + /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure + /// Function. + /// WebhookRule: A rule providing a binding to a webserver following + /// OAuth2.0 authentication protocol. + /// + /// is null. + public RuleEngineWorkerSelectorAttachment(RouterRule rule) + { + Argument.AssertNotNull(rule, nameof(rule)); + + Kind = "rule-engine"; + Rule = rule; + } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs index 88fa3784bb9d9..9953d75b9efcb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs @@ -7,8 +7,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenSuppress("ScheduleAndSuspendMode")] - [CodeGenSuppress("ScheduleAndSuspendMode", typeof(DateTimeOffset?))] public partial class ScheduleAndSuspendMode : IUtf8JsonSerializable { /// Initializes a new instance of ScheduleAndSuspendMode. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleOptions.cs index dcd2b103cefeb..fa7ef531b0039 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleOptions.cs @@ -7,7 +7,6 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("ScoringRuleOptions")] public partial class ScoringRuleOptions : IUtf8JsonSerializable { /// @@ -18,6 +17,29 @@ public partial class ScoringRuleOptions : IUtf8JsonSerializable /// public IList ScoringParameters { get; } = new List(); + /// + /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. + /// Defaults to 20 if not configured. + /// + public int? BatchSize { get; set; } + + /// + /// (Optional) + /// If set to true, will score workers in batches, and the parameter + /// name of the worker labels will be sent as `workers`. + /// By default, set to false + /// and the parameter name for the worker labels will be sent as `worker`. + /// Note: If enabled, use BatchSize to set batch size. + /// + public bool? IsBatchScoringEnabled { get; set; } + + /// + /// (Optional) + /// If false, will sort scores by ascending order. By default, set to + /// true. + /// + public bool? DescendingOrder { get; set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); @@ -36,10 +58,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (Optional.IsDefined(AllowScoringBatchOfWorkers)) + if (Optional.IsDefined(IsBatchScoringEnabled)) { - writer.WritePropertyName("allowScoringBatchOfWorkers"u8); - writer.WriteBooleanValue(AllowScoringBatchOfWorkers.Value); + writer.WritePropertyName("isBatchScoringEnabled"u8); + writer.WriteBooleanValue(IsBatchScoringEnabled.Value); } if (Optional.IsDefined(DescendingOrder)) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticQueueSelectorAttachment.cs index e45aa3c12cbc0..224dc4af71e4f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticQueueSelectorAttachment.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Text.Json; using Azure.Core; @@ -8,6 +9,20 @@ namespace Azure.Communication.JobRouter { public partial class StaticQueueSelectorAttachment : IUtf8JsonSerializable { + /// Initializes a new instance of StaticQueueSelectorAttachment. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// + /// is null. + public StaticQueueSelectorAttachment(RouterQueueSelector queueSelector) + { + Argument.AssertNotNull(queueSelector, nameof(queueSelector)); + + Kind = "static"; + QueueSelector = queueSelector; + } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs index 51a3d8aad6d41..b9b4b1222909a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs @@ -7,12 +7,10 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("StaticRouterRule")] - [CodeGenSuppress("StaticRouterRule")] public partial class StaticRouterRule : IUtf8JsonSerializable { /// The static value this rule always returns. - public LabelValue Value { get; set; } + public RouterValue Value { get; set; } [CodeGenMember("Value")] internal BinaryData _value { @@ -22,13 +20,13 @@ internal BinaryData _value { } set { - Value = new LabelValue(value.ToObjectFromJson()); + Value = new RouterValue(value.ToObjectFromJson()); } } /// Initializes a new instance of StaticRule. /// The static value this rule always returns. - public StaticRouterRule(LabelValue value) : this("static-rule", BinaryData.FromObjectAsJson(value.Value)) + public StaticRouterRule(RouterValue value) : this("static-rule", BinaryData.FromObjectAsJson(value.Value)) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticWorkerSelectorAttachment.cs index ce2315b7ccb1d..f0179f45a5106 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticWorkerSelectorAttachment.cs @@ -1,14 +1,28 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("StaticWorkerSelectorAttachment")] public partial class StaticWorkerSelectorAttachment : IUtf8JsonSerializable { + /// Initializes a new instance of StaticWorkerSelectorAttachment. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// + /// is null. + public StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector) + { + Argument.AssertNotNull(workerSelector, nameof(workerSelector)); + + Kind = "static"; + WorkerSelector = workerSelector; + } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobOptions.cs index c6c5ee9c0bd3b..8611074c03ab5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobOptions.cs @@ -10,34 +10,8 @@ namespace Azure.Communication.JobRouter /// /// Options for unassigning a job. /// - public class UnassignJobOptions + public partial class UnassignJobOptions { - /// - /// Public constructor. - /// - /// Id of the job. - /// Id of the assignment. - /// is null. - /// is null. - public UnassignJobOptions(string jobId, string assignmentId) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - Argument.AssertNotNullOrWhiteSpace(assignmentId, nameof(assignmentId)); - - JobId = jobId; - AssignmentId = assignmentId; - } - - /// - /// Unique key that identifies this job. - /// - public string JobId { get; } - - /// - /// Unique key that identifies this job assignment. - /// - public string AssignmentId { get; } - /// /// If SuspendMatching is true, then the job is not queued for re-matching with a /// worker. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobRequest.cs deleted file mode 100644 index 67beed57e006a..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobRequest.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("UnassignJobRequest")] - internal partial class UnassignJobRequest - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobResult.cs deleted file mode 100644 index e5ed4860a4e44..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenModel("UnassignJobResult")] - public partial class UnassignJobResult - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownJobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownJobMatchingMode.cs deleted file mode 100644 index c90b82d3d3968..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownJobMatchingMode.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Text; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenSuppress("UnknownJobMatchingMode")] - internal partial class UnknownJobMatchingMode - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownRouterRule.cs deleted file mode 100644 index fb0de604375b3..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownRouterRule.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Text; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenSuppress("UnknownRouterRule")] - internal partial class UnknownRouterRule - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateClassificationPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateClassificationPolicyOptions.cs deleted file mode 100644 index fbfa9eb6daf86..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateClassificationPolicyOptions.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// Options for updating classification policy. - /// - public class UpdateClassificationPolicyOptions - { - /// - /// Public constructor. - /// - /// The id of this policy. - /// is null. - public UpdateClassificationPolicyOptions(string classificationPolicyId) - { - Argument.AssertNotNullOrWhiteSpace(classificationPolicyId, nameof(classificationPolicyId)); - - ClassificationPolicyId = classificationPolicyId; - } - - /// - /// Unique key that identifies this policy. - /// - public string ClassificationPolicyId { get; } - - /// Friendly name of this policy. - public string Name { get; set; } - - /// The fallback queue to select if the queue selector does not find a match. - public string FallbackQueueId { get; set; } - - /// - /// A rule of one of the following types: - /// - /// StaticRule: A rule providing static rules that always return the same result, regardless of input. - /// DirectMapRule: A rule that return the same labels as the input labels. - /// ExpressionRule: A rule providing inline expression rules. - /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function. - /// - public RouterRule PrioritizationRule { get; set; } - - /// The queue selectors to resolve a queue for a given job. - public List QueueSelectors { get; } = new List(); - - /// The worker label selectors to attach to a given job. - public List WorkerSelectors { get; } = new List(); - - /// - /// The content to send as the request conditions of the request. - /// - public RequestConditions RequestConditions { get; set; } = new(); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateDistributionPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateDistributionPolicyOptions.cs deleted file mode 100644 index f24185e3e6ba4..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateDistributionPolicyOptions.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// Options for updating distribution policy. - /// - public class UpdateDistributionPolicyOptions - { - /// - /// Public constructor. - /// - /// Id of the policy. - /// is null. - public UpdateDistributionPolicyOptions(string distributionPolicyId) - { - Argument.AssertNotNullOrWhiteSpace(distributionPolicyId, nameof(distributionPolicyId)); - - DistributionPolicyId = distributionPolicyId; - } - - /// - /// The Id of this policy. - /// - public string DistributionPolicyId { get; } - - /// The human readable name of the policy. - public string Name { get; set; } - - /// - /// The amount of time before an offer expires. - /// - public TimeSpan OfferExpiresAfter { get; set; } - - /// Abstract base class for defining a distribution mode. - public DistributionMode Mode { get; set; } - - /// - /// The content to send as the request conditions of the request. - /// - public RequestConditions RequestConditions { get; set; } = new(); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateExceptionPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateExceptionPolicyOptions.cs deleted file mode 100644 index 5d46bbf653a90..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateExceptionPolicyOptions.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable enable -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// Options for updating exception policy. - /// - public class UpdateExceptionPolicyOptions - { - /// - /// Public constructor. - /// - /// Id of the policy. - /// is null. - public UpdateExceptionPolicyOptions(string exceptionPolicyId) - { - Argument.AssertNotNullOrWhiteSpace(exceptionPolicyId, nameof(exceptionPolicyId)); - - ExceptionPolicyId = exceptionPolicyId; - } - - /// - /// The Id of this policy. - /// - public string ExceptionPolicyId { get; } - - /// (Optional) The name of the exception policy. - public string Name { get; set; } = default!; - - /// (Optional) A dictionary collection of exception rules on the exception policy. Key is the Id of each exception rule. - public IDictionary ExceptionRules { get; } = new Dictionary(); - - /// - /// The content to send as the request conditions of the request. - /// - public RequestConditions RequestConditions { get; set; } = new(); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateJobOptions.cs deleted file mode 100644 index fbf7dab325742..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateJobOptions.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable enable -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// Options for updating a job. - /// - public class UpdateJobOptions - { - /// - /// Public constructor. - /// - /// Id of the job. - /// is null. - public UpdateJobOptions(string jobId) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - JobId = jobId; - } - - /// - /// Id of the job. - /// - public string JobId { get; } - - /// - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. - /// - public IDictionary Labels { get; } = new Dictionary(); - - /// Reference to an external parent context, eg. call ID. - public string? ChannelReference { get; set; } - - /// The Id of the Queue that this job is queued to. - public string? QueueId { get; set; } - - /// The Id of the Classification policy used for classifying a job. - public string? ClassificationPolicyId { get; set; } - - /// The channel identifier. eg. voice, chat, etc. - public string? ChannelId { get; set; } - - /// The priority of this job (range from -100 to 100). - public int? Priority { get; set; } - - /// Reason code for cancelled or closed jobs. - public string? DispositionCode { get; set; } - - /// A collection of manually specified label selectors, which a worker must satisfy in order to process this job. - public List RequestedWorkerSelectors { get; } = new List(); - - /// Notes attached to a job, sorted by timestamp. - public List Notes { get; } = new List(); - - /// A set of non-identifying attributes attached to this job. - public IDictionary Tags { get; } = new Dictionary(); - - /// - /// If provided, will determine how job matching will be carried out. - /// - public JobMatchingMode? MatchingMode { get; set; } - - /// - /// The content to send as the request conditions of the request. - /// - public RequestConditions RequestConditions { get; set; } = new(); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateQueueOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateQueueOptions.cs deleted file mode 100644 index 94c98c8a0ed91..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateQueueOptions.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable enable -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// Options for updating a job queue. - /// - public class UpdateQueueOptions - { - /// - /// Public constructor. - /// - /// The id of this queue. - /// is null. - public UpdateQueueOptions(string queueId) - { - Argument.AssertNotNullOrWhiteSpace(queueId, nameof(queueId)); - - QueueId = queueId; - } - - /// - /// Unique key that identifies this queue. - /// - public string QueueId { get; } - - /// The ID of the distribution policy that will determine how a job is distributed to workers. - public string? DistributionPolicyId { get; set; } - - /// The name of this queue. - public string? Name { get; set; } - - /// (Optional) The ID of the exception policy that determines various job escalation rules. - public string? ExceptionPolicyId { get; set; } - - /// - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. - /// - public IDictionary Labels { get; } = new Dictionary(); - - /// - /// The content to send as the request conditions of the request. - /// - public RequestConditions RequestConditions { get; set; } = new(); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateWorkerOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateWorkerOptions.cs deleted file mode 100644 index 8df7f86a16e75..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateWorkerOptions.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable enable -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// Options for updating a router worker. - /// - public class UpdateWorkerOptions - { - /// - /// Public constructor. - /// - /// Id of the job. - /// is null. - public UpdateWorkerOptions(string workerId) - { - Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - - WorkerId = workerId; - } - - /// - /// Unique key that identifies this worker. - /// - public string WorkerId { get; } - - /// The total capacity score this worker has to manage multiple concurrent jobs. - public int? TotalCapacity { get; set; } - - /// A flag indicating this worker is open to receive offers or not. - public bool? AvailableForOffers { get; set; } - - /// - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. - /// - public IDictionary Labels { get; } = new Dictionary(); - - /// - /// A set of non-identifying attributes attached to this worker. - /// - public IDictionary Tags { get; } = new Dictionary(); - - /// The channel(s) this worker can handle and their impact on the workers capacity. - public IDictionary ChannelConfigurations { get; } = new Dictionary(); - - /// The queue(s) that this worker can receive work from. - public IDictionary QueueAssignments { get; } = new Dictionary(); - - /// - /// The content to send as the request conditions of the request. - /// - public RequestConditions RequestConditions { get; set; } = new(); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WaitTimeExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WaitTimeExceptionTrigger.cs index 37fd07996cf7e..42c057de20bfe 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WaitTimeExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WaitTimeExceptionTrigger.cs @@ -12,8 +12,6 @@ namespace Azure.Communication.JobRouter { /// Trigger for an exception action on exceeding wait time. - [CodeGenModel("WaitTimeExceptionTrigger")] - [CodeGenSuppress("WaitTimeExceptionTrigger", typeof(double))] public partial class WaitTimeExceptionTrigger : IUtf8JsonSerializable { /// Initializes a new instance of WaitTimeExceptionTrigger. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WebhookRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WebhookRouterRule.cs index 2154be87b0a27..3519a19f22e89 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WebhookRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WebhookRouterRule.cs @@ -7,12 +7,10 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("WebhookRouterRule")] - [CodeGenSuppress("WebhookRouterRule")] public partial class WebhookRouterRule : IUtf8JsonSerializable { /// Initializes a new instance of WebhookRouterRule. - public WebhookRouterRule(Uri authorizationServerUri, Oauth2ClientCredential clientCredential, Uri webhookUri) + public WebhookRouterRule(Uri authorizationServerUri, OAuth2WebhookClientCredential clientCredential, Uri webhookUri) : this("webhook-rule", authorizationServerUri, clientCredential, webhookUri) { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationQueueSelectorAttachment.cs index 6d01d067396be..7c293fb0d4d47 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationQueueSelectorAttachment.cs @@ -2,13 +2,26 @@ // Licensed under the MIT License. using Azure.Core; +using System.Collections.Generic; +using System; +using System.Linq; using System.Text.Json; namespace Azure.Communication.JobRouter { - [CodeGenModel("WeightedAllocationQueueSelectorAttachment")] public partial class WeightedAllocationQueueSelectorAttachment : IUtf8JsonSerializable { + /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. + /// A collection of percentage based weighted allocations. + /// is null. + public WeightedAllocationQueueSelectorAttachment(IEnumerable allocations) + { + Argument.AssertNotNull(allocations, nameof(allocations)); + + Kind = "weighted-allocation-queue-selector"; + Allocations = allocations.ToList(); + } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationWorkerSelectorAttachment.cs index d10e97c2ccb18..c336c801e526e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationWorkerSelectorAttachment.cs @@ -2,13 +2,26 @@ // Licensed under the MIT License. using Azure.Core; +using System.Collections.Generic; +using System; +using System.Linq; using System.Text.Json; namespace Azure.Communication.JobRouter { - [CodeGenModel("WeightedAllocationWorkerSelectorAttachment")] public partial class WeightedAllocationWorkerSelectorAttachment : IUtf8JsonSerializable { + /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. + /// A collection of percentage based weighted allocations. + /// is null. + public WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations) + { + Argument.AssertNotNull(allocations, nameof(allocations)); + + Kind = "weighted-allocation-worker-selector"; + Allocations = allocations.ToList(); + } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs index ff650eccaf9a0..ac366171ce953 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs @@ -7,10 +7,12 @@ namespace Azure.Communication.JobRouter { - [CodeGenModel("WorkerSelectorAttachment")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] public abstract partial class WorkerSelectorAttachment : IUtf8JsonSerializable { + /// The type discriminator describing a sub-type of WorkerSelectorAttachment. + public string Kind { get; protected set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerWeightedAllocation.cs index 4d0c866e3ae73..71552872347f4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerWeightedAllocation.cs @@ -1,14 +1,31 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Collections.Generic; +using System; +using System.Linq; using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { - [CodeGenModel("WorkerWeightedAllocation")] public partial class WorkerWeightedAllocation : IUtf8JsonSerializable { + /// Initializes a new instance of WorkerWeightedAllocation. + /// The percentage of this weight, expressed as a fraction of 1. + /// + /// A collection of worker selectors that will be applied if this allocation is + /// selected. + /// + /// is null. + public WorkerWeightedAllocation(double weight, IEnumerable workerSelectors) + { + Argument.AssertNotNull(workerSelectors, nameof(workerSelectors)); + + Weight = weight; + WorkerSelectors = workerSelectors.ToList(); + } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationClient.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationClient.cs index d84debe113917..c0d640186ea86 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationClient.cs @@ -21,12 +21,12 @@ public partial class Samples_JobRouterAdministrationClient [Ignore("Only validating compilation of examples")] public void Example_GetDistributionPolicy_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetDistributionPolicy("", null); + Response response = client.GetDistributionPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -34,12 +34,12 @@ public void Example_GetDistributionPolicy_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetDistributionPolicy_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetDistributionPolicyAsync("", null); + Response response = await client.GetDistributionPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -47,88 +47,83 @@ public async Task Example_GetDistributionPolicy_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetDistributionPolicy_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetDistributionPolicy(""); + Response response = client.GetDistributionPolicy(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetDistributionPolicy_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetDistributionPolicyAsync(""); + Response response = await client.GetDistributionPolicyAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetDistributionPolicy_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetDistributionPolicy("", null); + Response response = client.GetDistributionPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetDistributionPolicy_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetDistributionPolicyAsync("", null); + Response response = await client.GetDistributionPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetDistributionPolicy_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetDistributionPolicy(""); + Response response = client.GetDistributionPolicy(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetDistributionPolicy_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetDistributionPolicyAsync(""); + Response response = await client.GetDistributionPolicyAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DeleteDistributionPolicy_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.DeleteDistributionPolicy(""); + Response response = client.DeleteDistributionPolicy(""); Console.WriteLine(response.Status); } @@ -137,10 +132,9 @@ public void Example_DeleteDistributionPolicy_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteDistributionPolicy_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.DeleteDistributionPolicyAsync(""); + Response response = await client.DeleteDistributionPolicyAsync(""); Console.WriteLine(response.Status); } @@ -149,10 +143,9 @@ public async Task Example_DeleteDistributionPolicy_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteDistributionPolicy_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.DeleteDistributionPolicy(""); + Response response = client.DeleteDistributionPolicy(""); Console.WriteLine(response.Status); } @@ -161,10 +154,9 @@ public void Example_DeleteDistributionPolicy_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteDistributionPolicy_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.DeleteDistributionPolicyAsync(""); + Response response = await client.DeleteDistributionPolicyAsync(""); Console.WriteLine(response.Status); } @@ -173,12 +165,12 @@ public async Task Example_DeleteDistributionPolicy_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetClassificationPolicy_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetClassificationPolicy("", null); + Response response = client.GetClassificationPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -186,12 +178,12 @@ public void Example_GetClassificationPolicy_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetClassificationPolicy_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetClassificationPolicyAsync("", null); + Response response = await client.GetClassificationPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -199,86 +191,81 @@ public async Task Example_GetClassificationPolicy_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetClassificationPolicy_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetClassificationPolicy(""); + Response response = client.GetClassificationPolicy(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetClassificationPolicy_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetClassificationPolicyAsync(""); + Response response = await client.GetClassificationPolicyAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetClassificationPolicy_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetClassificationPolicy("", null); + Response response = client.GetClassificationPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); - Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("queueSelectorAttachments")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectorAttachments")[0].GetProperty("kind").ToString()); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetClassificationPolicy_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetClassificationPolicyAsync("", null); + Response response = await client.GetClassificationPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); - Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("queueSelectorAttachments")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectorAttachments")[0].GetProperty("kind").ToString()); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetClassificationPolicy_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetClassificationPolicy(""); + Response response = client.GetClassificationPolicy(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetClassificationPolicy_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetClassificationPolicyAsync(""); + Response response = await client.GetClassificationPolicyAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DeleteClassificationPolicy_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.DeleteClassificationPolicy(""); + Response response = client.DeleteClassificationPolicy(""); Console.WriteLine(response.Status); } @@ -287,10 +274,9 @@ public void Example_DeleteClassificationPolicy_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteClassificationPolicy_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.DeleteClassificationPolicyAsync(""); + Response response = await client.DeleteClassificationPolicyAsync(""); Console.WriteLine(response.Status); } @@ -299,10 +285,9 @@ public async Task Example_DeleteClassificationPolicy_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteClassificationPolicy_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.DeleteClassificationPolicy(""); + Response response = client.DeleteClassificationPolicy(""); Console.WriteLine(response.Status); } @@ -311,10 +296,9 @@ public void Example_DeleteClassificationPolicy_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteClassificationPolicy_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.DeleteClassificationPolicyAsync(""); + Response response = await client.DeleteClassificationPolicyAsync(""); Console.WriteLine(response.Status); } @@ -323,12 +307,12 @@ public async Task Example_DeleteClassificationPolicy_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetExceptionPolicy_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetExceptionPolicy("", null); + Response response = client.GetExceptionPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -336,12 +320,12 @@ public void Example_GetExceptionPolicy_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetExceptionPolicy_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetExceptionPolicyAsync("", null); + Response response = await client.GetExceptionPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -349,82 +333,81 @@ public async Task Example_GetExceptionPolicy_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetExceptionPolicy_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetExceptionPolicy(""); + Response response = client.GetExceptionPolicy(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetExceptionPolicy_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetExceptionPolicyAsync(""); + Response response = await client.GetExceptionPolicyAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetExceptionPolicy_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetExceptionPolicy("", null); + Response response = client.GetExceptionPolicy("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("kind").ToString()); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetExceptionPolicy_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetExceptionPolicyAsync("", null); + Response response = await client.GetExceptionPolicyAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("kind").ToString()); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetExceptionPolicy_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetExceptionPolicy(""); + Response response = client.GetExceptionPolicy(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetExceptionPolicy_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetExceptionPolicyAsync(""); + Response response = await client.GetExceptionPolicyAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DeleteExceptionPolicy_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.DeleteExceptionPolicy(""); + Response response = client.DeleteExceptionPolicy(""); Console.WriteLine(response.Status); } @@ -433,10 +416,9 @@ public void Example_DeleteExceptionPolicy_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteExceptionPolicy_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.DeleteExceptionPolicyAsync(""); + Response response = await client.DeleteExceptionPolicyAsync(""); Console.WriteLine(response.Status); } @@ -445,10 +427,9 @@ public async Task Example_DeleteExceptionPolicy_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteExceptionPolicy_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.DeleteExceptionPolicy(""); + Response response = client.DeleteExceptionPolicy(""); Console.WriteLine(response.Status); } @@ -457,10 +438,9 @@ public void Example_DeleteExceptionPolicy_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteExceptionPolicy_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.DeleteExceptionPolicyAsync(""); + Response response = await client.DeleteExceptionPolicyAsync(""); Console.WriteLine(response.Status); } @@ -469,12 +449,12 @@ public async Task Example_DeleteExceptionPolicy_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueue_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetQueue("", null); + Response response = client.GetQueue("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -482,12 +462,12 @@ public void Example_GetQueue_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueue_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetQueueAsync("", null); + Response response = await client.GetQueueAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -495,32 +475,30 @@ public async Task Example_GetQueue_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueue_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetQueue(""); + Response response = client.GetQueue(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetQueue_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetQueueAsync(""); + Response response = await client.GetQueueAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetQueue_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetQueue("", null); + Response response = client.GetQueue("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); @@ -532,12 +510,12 @@ public void Example_GetQueue_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueue_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetQueueAsync("", null); + Response response = await client.GetQueueAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); @@ -549,30 +527,27 @@ public async Task Example_GetQueue_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueue_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.GetQueue(""); + Response response = client.GetQueue(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetQueue_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.GetQueueAsync(""); + Response response = await client.GetQueueAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DeleteQueue_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.DeleteQueue(""); + Response response = client.DeleteQueue(""); Console.WriteLine(response.Status); } @@ -581,10 +556,9 @@ public void Example_DeleteQueue_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteQueue_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.DeleteQueueAsync(""); + Response response = await client.DeleteQueueAsync(""); Console.WriteLine(response.Status); } @@ -593,10 +567,9 @@ public async Task Example_DeleteQueue_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteQueue_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = client.DeleteQueue(""); + Response response = client.DeleteQueue(""); Console.WriteLine(response.Status); } @@ -605,10 +578,9 @@ public void Example_DeleteQueue_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteQueue_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - Response response = await client.DeleteQueueAsync(""); + Response response = await client.DeleteQueueAsync(""); Console.WriteLine(response.Status); } @@ -617,14 +589,13 @@ public async Task Example_DeleteQueue_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetDistributionPolicies_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetDistributionPolicies(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -632,14 +603,13 @@ public void Example_GetDistributionPolicies_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetDistributionPolicies_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetDistributionPoliciesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -647,10 +617,9 @@ public async Task Example_GetDistributionPolicies_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetDistributionPolicies_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - foreach (DistributionPolicyItem item in client.GetDistributionPolicies()) + foreach (DistributionPolicy item in client.GetDistributionPolicies()) { } } @@ -659,10 +628,9 @@ public void Example_GetDistributionPolicies_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetDistributionPolicies_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsync()) + await foreach (DistributionPolicy item in client.GetDistributionPoliciesAsync()) { } } @@ -671,20 +639,19 @@ public async Task Example_GetDistributionPolicies_ShortVersion_Convenience_Async [Ignore("Only validating compilation of examples")] public void Example_GetDistributionPolicies_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetDistributionPolicies(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); } } @@ -692,20 +659,19 @@ public void Example_GetDistributionPolicies_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetDistributionPolicies_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetDistributionPoliciesAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); - Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString()); + Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString()); } } @@ -713,10 +679,9 @@ public async Task Example_GetDistributionPolicies_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetDistributionPolicies_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - foreach (DistributionPolicyItem item in client.GetDistributionPolicies(maxpagesize: 1234)) + foreach (DistributionPolicy item in client.GetDistributionPolicies(maxpagesize: 1234)) { } } @@ -725,10 +690,9 @@ public void Example_GetDistributionPolicies_AllParameters_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetDistributionPolicies_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsync(maxpagesize: 1234)) + await foreach (DistributionPolicy item in client.GetDistributionPoliciesAsync(maxpagesize: 1234)) { } } @@ -737,14 +701,13 @@ public async Task Example_GetDistributionPolicies_AllParameters_Convenience_Asyn [Ignore("Only validating compilation of examples")] public void Example_GetClassificationPolicies_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetClassificationPolicies(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -752,14 +715,13 @@ public void Example_GetClassificationPolicies_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetClassificationPolicies_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetClassificationPoliciesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -767,10 +729,9 @@ public async Task Example_GetClassificationPolicies_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetClassificationPolicies_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - foreach (ClassificationPolicyItem item in client.GetClassificationPolicies()) + foreach (ClassificationPolicy item in client.GetClassificationPolicies()) { } } @@ -779,10 +740,9 @@ public void Example_GetClassificationPolicies_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetClassificationPolicies_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - await foreach (ClassificationPolicyItem item in client.GetClassificationPoliciesAsync()) + await foreach (ClassificationPolicy item in client.GetClassificationPoliciesAsync()) { } } @@ -791,19 +751,18 @@ public async Task Example_GetClassificationPolicies_ShortVersion_Convenience_Asy [Ignore("Only validating compilation of examples")] public void Example_GetClassificationPolicies_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetClassificationPolicies(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("queueSelectorAttachments")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectorAttachments")[0].GetProperty("kind").ToString()); } } @@ -811,19 +770,18 @@ public void Example_GetClassificationPolicies_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetClassificationPolicies_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetClassificationPoliciesAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("fallbackQueueId").ToString()); + Console.WriteLine(result.GetProperty("queueSelectorAttachments")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("workerSelectorAttachments")[0].GetProperty("kind").ToString()); } } @@ -831,10 +789,9 @@ public async Task Example_GetClassificationPolicies_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetClassificationPolicies_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - foreach (ClassificationPolicyItem item in client.GetClassificationPolicies(maxpagesize: 1234)) + foreach (ClassificationPolicy item in client.GetClassificationPolicies(maxpagesize: 1234)) { } } @@ -843,10 +800,9 @@ public void Example_GetClassificationPolicies_AllParameters_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetClassificationPolicies_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - await foreach (ClassificationPolicyItem item in client.GetClassificationPoliciesAsync(maxpagesize: 1234)) + await foreach (ClassificationPolicy item in client.GetClassificationPoliciesAsync(maxpagesize: 1234)) { } } @@ -855,14 +811,13 @@ public async Task Example_GetClassificationPolicies_AllParameters_Convenience_As [Ignore("Only validating compilation of examples")] public void Example_GetExceptionPolicies_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetExceptionPolicies(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -870,14 +825,13 @@ public void Example_GetExceptionPolicies_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetExceptionPolicies_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetExceptionPoliciesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -885,10 +839,9 @@ public async Task Example_GetExceptionPolicies_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetExceptionPolicies_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - foreach (ExceptionPolicyItem item in client.GetExceptionPolicies()) + foreach (ExceptionPolicy item in client.GetExceptionPolicies()) { } } @@ -897,10 +850,9 @@ public void Example_GetExceptionPolicies_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetExceptionPolicies_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync()) + await foreach (ExceptionPolicy item in client.GetExceptionPoliciesAsync()) { } } @@ -909,17 +861,18 @@ public async Task Example_GetExceptionPolicies_ShortVersion_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_GetExceptionPolicies_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetExceptionPolicies(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("kind").ToString()); } } @@ -927,17 +880,18 @@ public void Example_GetExceptionPolicies_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetExceptionPolicies_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetExceptionPoliciesAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("trigger").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("exceptionRules")[0].GetProperty("actions")[0].GetProperty("kind").ToString()); } } @@ -945,10 +899,9 @@ public async Task Example_GetExceptionPolicies_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetExceptionPolicies_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - foreach (ExceptionPolicyItem item in client.GetExceptionPolicies(maxpagesize: 1234)) + foreach (ExceptionPolicy item in client.GetExceptionPolicies(maxpagesize: 1234)) { } } @@ -957,10 +910,9 @@ public void Example_GetExceptionPolicies_AllParameters_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetExceptionPolicies_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync(maxpagesize: 1234)) + await foreach (ExceptionPolicy item in client.GetExceptionPoliciesAsync(maxpagesize: 1234)) { } } @@ -969,14 +921,13 @@ public async Task Example_GetExceptionPolicies_AllParameters_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueues_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetQueues(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -984,14 +935,13 @@ public void Example_GetQueues_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueues_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetQueuesAsync(null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -999,10 +949,9 @@ public async Task Example_GetQueues_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueues_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - foreach (RouterQueueItem item in client.GetQueues()) + foreach (RouterQueue item in client.GetQueues()) { } } @@ -1011,10 +960,9 @@ public void Example_GetQueues_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueues_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - await foreach (RouterQueueItem item in client.GetQueuesAsync()) + await foreach (RouterQueue item in client.GetQueuesAsync()) { } } @@ -1023,18 +971,17 @@ public async Task Example_GetQueues_ShortVersion_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueues_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); foreach (BinaryData item in client.GetQueues(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); } } @@ -1042,18 +989,17 @@ public void Example_GetQueues_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueues_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); await foreach (BinaryData item in client.GetQueuesAsync(1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("distributionPolicyId").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString()); } } @@ -1061,10 +1007,9 @@ public async Task Example_GetQueues_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueues_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - foreach (RouterQueueItem item in client.GetQueues(maxpagesize: 1234)) + foreach (RouterQueue item in client.GetQueues(maxpagesize: 1234)) { } } @@ -1073,10 +1018,9 @@ public void Example_GetQueues_AllParameters_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueues_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + JobRouterAdministrationClient client = new JobRouterAdministrationClient((string)null); - await foreach (RouterQueueItem item in client.GetQueuesAsync(maxpagesize: 1234)) + await foreach (RouterQueue item in client.GetQueuesAsync(maxpagesize: 1234)) { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterClient.cs index 1949ba0c256a3..77c6a70efa14d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterClient.cs @@ -22,12 +22,12 @@ public partial class Samples_JobRouterClient [Ignore("Only validating compilation of examples")] public void Example_GetJob_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetJob("", null); + Response response = client.GetJob("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -35,12 +35,12 @@ public void Example_GetJob_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetJob_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetJobAsync("", null); + Response response = await client.GetJobAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -48,32 +48,30 @@ public async Task Example_GetJob_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetJob_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetJob(""); + Response response = client.GetJob(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetJob_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetJobAsync(""); + Response response = await client.GetJobAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetJob_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetJob("", null); + Response response = client.GetJob("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("channelReference").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); @@ -104,7 +102,8 @@ public void Example_GetJob_AllParameters() Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("addedAt").ToString()); Console.WriteLine(result.GetProperty("scheduledAt").ToString()); Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToString()); } @@ -113,12 +112,12 @@ public void Example_GetJob_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetJob_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetJobAsync("", null); + Response response = await client.GetJobAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("channelReference").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); @@ -149,7 +148,8 @@ public async Task Example_GetJob_AllParameters_Async() Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("addedAt").ToString()); Console.WriteLine(result.GetProperty("scheduledAt").ToString()); Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToString()); } @@ -158,30 +158,27 @@ public async Task Example_GetJob_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetJob_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetJob(""); + Response response = client.GetJob(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetJob_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetJobAsync(""); + Response response = await client.GetJobAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_DeleteJob_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.DeleteJob(""); + Response response = client.DeleteJob(""); Console.WriteLine(response.Status); } @@ -190,10 +187,9 @@ public void Example_DeleteJob_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteJob_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.DeleteJobAsync(""); + Response response = await client.DeleteJobAsync(""); Console.WriteLine(response.Status); } @@ -202,10 +198,9 @@ public async Task Example_DeleteJob_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteJob_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.DeleteJob(""); + Response response = client.DeleteJob(""); Console.WriteLine(response.Status); } @@ -214,10 +209,9 @@ public void Example_DeleteJob_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteJob_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.DeleteJobAsync(""); + Response response = await client.DeleteJobAsync(""); Console.WriteLine(response.Status); } @@ -226,11 +220,10 @@ public async Task Example_DeleteJob_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CancelJob_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; - Response response = client.CancelJob("", content); + Response response = client.CancelJob("", content); Console.WriteLine(response.Status); } @@ -239,11 +232,10 @@ public void Example_CancelJob_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_CancelJob_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; - Response response = await client.CancelJobAsync("", content); + Response response = await client.CancelJobAsync("", content); Console.WriteLine(response.Status); } @@ -252,35 +244,32 @@ public async Task Example_CancelJob_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_CancelJob_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.CancelJob(""); + Response response = client.CancelJob(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_CancelJob_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.CancelJobAsync(""); + Response response = await client.CancelJobAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_CancelJob_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { note = "", dispositionCode = "", }); - Response response = client.CancelJob("", content); + Response response = client.CancelJob("", content); Console.WriteLine(response.Status); } @@ -289,15 +278,14 @@ public void Example_CancelJob_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CancelJob_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { note = "", dispositionCode = "", }); - Response response = await client.CancelJobAsync("", content); + Response response = await client.CancelJobAsync("", content); Console.WriteLine(response.Status); } @@ -306,44 +294,41 @@ public async Task Example_CancelJob_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CancelJob_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CancelJobRequest cancelJobRequest = new CancelJobRequest + CancelJobOptions options = new CancelJobOptions { Note = "", DispositionCode = "", }; - Response response = client.CancelJob("", cancelJobRequest: cancelJobRequest); + Response response = client.CancelJob("", options: options); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_CancelJob_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CancelJobRequest cancelJobRequest = new CancelJobRequest + CancelJobOptions options = new CancelJobOptions { Note = "", DispositionCode = "", }; - Response response = await client.CancelJobAsync("", cancelJobRequest: cancelJobRequest); + Response response = await client.CancelJobAsync("", options: options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_CompleteJob_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", }); - Response response = client.CompleteJob("", content); + Response response = client.CompleteJob("", content); Console.WriteLine(response.Status); } @@ -352,14 +337,13 @@ public void Example_CompleteJob_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_CompleteJob_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", }); - Response response = await client.CompleteJobAsync("", content); + Response response = await client.CompleteJobAsync("", content); Console.WriteLine(response.Status); } @@ -368,37 +352,34 @@ public async Task Example_CompleteJob_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_CompleteJob_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CompleteJobRequest completeJobRequest = new CompleteJobRequest(""); - Response response = client.CompleteJob("", completeJobRequest); + CompleteJobOptions options = new CompleteJobOptions(""); + Response response = client.CompleteJob("", options); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_CompleteJob_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CompleteJobRequest completeJobRequest = new CompleteJobRequest(""); - Response response = await client.CompleteJobAsync("", completeJobRequest); + CompleteJobOptions options = new CompleteJobOptions(""); + Response response = await client.CompleteJobAsync("", options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_CompleteJob_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", note = "", }); - Response response = client.CompleteJob("", content); + Response response = client.CompleteJob("", content); Console.WriteLine(response.Status); } @@ -407,15 +388,14 @@ public void Example_CompleteJob_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CompleteJob_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", note = "", }); - Response response = await client.CompleteJobAsync("", content); + Response response = await client.CompleteJobAsync("", content); Console.WriteLine(response.Status); } @@ -424,42 +404,39 @@ public async Task Example_CompleteJob_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CompleteJob_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CompleteJobRequest completeJobRequest = new CompleteJobRequest("") + CompleteJobOptions options = new CompleteJobOptions("") { Note = "", }; - Response response = client.CompleteJob("", completeJobRequest); + Response response = client.CompleteJob("", options); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_CompleteJob_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CompleteJobRequest completeJobRequest = new CompleteJobRequest("") + CompleteJobOptions options = new CompleteJobOptions("") { Note = "", }; - Response response = await client.CompleteJobAsync("", completeJobRequest); + Response response = await client.CompleteJobAsync("", options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_CloseJob_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", }); - Response response = client.CloseJob("", content); + Response response = client.CloseJob("", content); Console.WriteLine(response.Status); } @@ -468,14 +445,13 @@ public void Example_CloseJob_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_CloseJob_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { assignmentId = "", }); - Response response = await client.CloseJobAsync("", content); + Response response = await client.CloseJobAsync("", content); Console.WriteLine(response.Status); } @@ -484,30 +460,27 @@ public async Task Example_CloseJob_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_CloseJob_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CloseJobRequest closeJobRequest = new CloseJobRequest(""); - Response response = client.CloseJob("", closeJobRequest); + CloseJobOptions options = new CloseJobOptions(""); + Response response = client.CloseJob("", options); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_CloseJob_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CloseJobRequest closeJobRequest = new CloseJobRequest(""); - Response response = await client.CloseJobAsync("", closeJobRequest); + CloseJobOptions options = new CloseJobOptions(""); + Response response = await client.CloseJobAsync("", options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_CloseJob_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { @@ -516,7 +489,7 @@ public void Example_CloseJob_AllParameters() closeAt = "2022-05-10T14:57:31.2311892-04:00", note = "", }); - Response response = client.CloseJob("", content); + Response response = client.CloseJob("", content); Console.WriteLine(response.Status); } @@ -525,8 +498,7 @@ public void Example_CloseJob_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_CloseJob_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { @@ -535,7 +507,7 @@ public async Task Example_CloseJob_AllParameters_Async() closeAt = "2022-05-10T14:57:31.2311892-04:00", note = "", }); - Response response = await client.CloseJobAsync("", content); + Response response = await client.CloseJobAsync("", content); Console.WriteLine(response.Status); } @@ -544,42 +516,39 @@ public async Task Example_CloseJob_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_CloseJob_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CloseJobRequest closeJobRequest = new CloseJobRequest("") + CloseJobOptions options = new CloseJobOptions("") { DispositionCode = "", CloseAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), Note = "", }; - Response response = client.CloseJob("", closeJobRequest); + Response response = client.CloseJob("", options); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_CloseJob_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - CloseJobRequest closeJobRequest = new CloseJobRequest("") + CloseJobOptions options = new CloseJobOptions("") { DispositionCode = "", CloseAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), Note = "", }; - Response response = await client.CloseJobAsync("", closeJobRequest); + Response response = await client.CloseJobAsync("", options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetQueuePosition_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetQueuePosition("", null); + Response response = client.GetQueuePosition("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -593,10 +562,9 @@ public void Example_GetQueuePosition_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueuePosition_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetQueuePositionAsync("", null); + Response response = await client.GetQueuePositionAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -610,30 +578,27 @@ public async Task Example_GetQueuePosition_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueuePosition_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetQueuePosition(""); + Response response = client.GetQueuePosition(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetQueuePosition_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetQueuePositionAsync(""); + Response response = await client.GetQueuePositionAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetQueuePosition_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetQueuePosition("", null); + Response response = client.GetQueuePosition("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -647,10 +612,9 @@ public void Example_GetQueuePosition_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueuePosition_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetQueuePositionAsync("", null); + Response response = await client.GetQueuePositionAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -664,31 +628,28 @@ public async Task Example_GetQueuePosition_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueuePosition_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetQueuePosition(""); + Response response = client.GetQueuePosition(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetQueuePosition_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetQueuePositionAsync(""); + Response response = await client.GetQueuePositionAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_UnassignJob_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; - Response response = client.UnassignJob("", "", content); + Response response = client.UnassignJob("", "", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -699,11 +660,10 @@ public void Example_UnassignJob_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_UnassignJob_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; - Response response = await client.UnassignJobAsync("", "", content); + Response response = await client.UnassignJobAsync("", "", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -714,34 +674,31 @@ public async Task Example_UnassignJob_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_UnassignJob_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.UnassignJob("", ""); + Response response = client.UnassignJob("", ""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_UnassignJob_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.UnassignJobAsync("", ""); + Response response = await client.UnassignJobAsync("", ""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_UnassignJob_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { suspendMatching = true, }); - Response response = client.UnassignJob("", "", content); + Response response = client.UnassignJob("", "", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -752,14 +709,13 @@ public void Example_UnassignJob_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_UnassignJob_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { suspendMatching = true, }); - Response response = await client.UnassignJobAsync("", "", content); + Response response = await client.UnassignJobAsync("", "", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("jobId").ToString()); @@ -770,36 +726,33 @@ public async Task Example_UnassignJob_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_UnassignJob_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - UnassignJobRequest unassignJobRequest = new UnassignJobRequest + UnassignJobOptions options = new UnassignJobOptions { SuspendMatching = true, }; - Response response = client.UnassignJob("", "", unassignJobRequest: unassignJobRequest); + Response response = client.UnassignJob("", "", options: options); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_UnassignJob_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - UnassignJobRequest unassignJobRequest = new UnassignJobRequest + UnassignJobOptions options = new UnassignJobOptions { SuspendMatching = true, }; - Response response = await client.UnassignJobAsync("", "", unassignJobRequest: unassignJobRequest); + Response response = await client.UnassignJobAsync("", "", options: options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_AcceptJobOffer_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.AcceptJobOffer("", "", null); @@ -813,8 +766,7 @@ public void Example_AcceptJobOffer_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_AcceptJobOffer_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.AcceptJobOfferAsync("", "", null); @@ -828,8 +780,7 @@ public async Task Example_AcceptJobOffer_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_AcceptJobOffer_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.AcceptJobOffer("", ""); } @@ -838,8 +789,7 @@ public void Example_AcceptJobOffer_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_AcceptJobOffer_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.AcceptJobOfferAsync("", ""); } @@ -848,8 +798,7 @@ public async Task Example_AcceptJobOffer_ShortVersion_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_AcceptJobOffer_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.AcceptJobOffer("", "", null); @@ -863,8 +812,7 @@ public void Example_AcceptJobOffer_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_AcceptJobOffer_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.AcceptJobOfferAsync("", "", null); @@ -878,8 +826,7 @@ public async Task Example_AcceptJobOffer_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_AcceptJobOffer_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.AcceptJobOffer("", ""); } @@ -888,8 +835,7 @@ public void Example_AcceptJobOffer_AllParameters_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_AcceptJobOffer_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.AcceptJobOfferAsync("", ""); } @@ -898,8 +844,7 @@ public async Task Example_AcceptJobOffer_AllParameters_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_DeclineJobOffer_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; Response response = client.DeclineJobOffer("", "", content); @@ -911,8 +856,7 @@ public void Example_DeclineJobOffer_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_DeclineJobOffer_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = null; Response response = await client.DeclineJobOfferAsync("", "", content); @@ -924,8 +868,7 @@ public async Task Example_DeclineJobOffer_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_DeclineJobOffer_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.DeclineJobOffer("", ""); } @@ -934,8 +877,7 @@ public void Example_DeclineJobOffer_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_DeclineJobOffer_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.DeclineJobOfferAsync("", ""); } @@ -944,8 +886,7 @@ public async Task Example_DeclineJobOffer_ShortVersion_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_DeclineJobOffer_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { @@ -960,8 +901,7 @@ public void Example_DeclineJobOffer_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeclineJobOffer_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); using RequestContent content = RequestContent.Create(new { @@ -976,38 +916,35 @@ public async Task Example_DeclineJobOffer_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_DeclineJobOffer_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - DeclineJobOfferRequest declineJobOfferRequest = new DeclineJobOfferRequest + DeclineJobOfferOptions options = new DeclineJobOfferOptions { RetryOfferAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), }; - Response response = client.DeclineJobOffer("", "", declineJobOfferRequest: declineJobOfferRequest); + Response response = client.DeclineJobOffer("", "", options: options); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_DeclineJobOffer_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - DeclineJobOfferRequest declineJobOfferRequest = new DeclineJobOfferRequest + DeclineJobOfferOptions options = new DeclineJobOfferOptions { RetryOfferAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), }; - Response response = await client.DeclineJobOfferAsync("", "", declineJobOfferRequest: declineJobOfferRequest); + Response response = await client.DeclineJobOfferAsync("", "", options: options); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetQueueStatistics_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetQueueStatistics("", null); + Response response = client.GetQueueStatistics("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("queueId").ToString()); @@ -1018,10 +955,9 @@ public void Example_GetQueueStatistics_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueueStatistics_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetQueueStatisticsAsync("", null); + Response response = await client.GetQueueStatisticsAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("queueId").ToString()); @@ -1032,30 +968,27 @@ public async Task Example_GetQueueStatistics_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueueStatistics_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetQueueStatistics(""); + Response response = client.GetQueueStatistics(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetQueueStatistics_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetQueueStatisticsAsync(""); + Response response = await client.GetQueueStatisticsAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetQueueStatistics_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetQueueStatistics("", null); + Response response = client.GetQueueStatistics("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("queueId").ToString()); @@ -1068,10 +1001,9 @@ public void Example_GetQueueStatistics_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetQueueStatistics_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetQueueStatisticsAsync("", null); + Response response = await client.GetQueueStatisticsAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("queueId").ToString()); @@ -1084,32 +1016,30 @@ public async Task Example_GetQueueStatistics_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetQueueStatistics_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = client.GetQueueStatistics(""); + Response response = client.GetQueueStatistics(""); } [Test] [Ignore("Only validating compilation of examples")] public async Task Example_GetQueueStatistics_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - Response response = await client.GetQueueStatisticsAsync(""); + Response response = await client.GetQueueStatisticsAsync(""); } [Test] [Ignore("Only validating compilation of examples")] public void Example_GetWorker_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.GetWorker("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -1117,12 +1047,12 @@ public void Example_GetWorker_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetWorker_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.GetWorkerAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); } @@ -1130,8 +1060,7 @@ public async Task Example_GetWorker_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetWorker_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.GetWorker(""); } @@ -1140,8 +1069,7 @@ public void Example_GetWorker_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetWorker_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.GetWorkerAsync(""); } @@ -1150,20 +1078,21 @@ public async Task Example_GetWorker_ShortVersion_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_GetWorker_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.GetWorker("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("state").ToString()); - Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("queues")[0].ToString()); + Console.WriteLine(result.GetProperty("capacity").ToString()); Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); - Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("maxNumberOfJobs").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); @@ -1181,20 +1110,21 @@ public void Example_GetWorker_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetWorker_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.GetWorkerAsync("", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("state").ToString()); - Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("totalCapacity").ToString()); + Console.WriteLine(result.GetProperty("queues")[0].ToString()); + Console.WriteLine(result.GetProperty("capacity").ToString()); Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); - Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("maxNumberOfJobs").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); @@ -1212,8 +1142,7 @@ public async Task Example_GetWorker_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetWorker_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.GetWorker(""); } @@ -1222,8 +1151,7 @@ public void Example_GetWorker_AllParameters_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetWorker_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.GetWorkerAsync(""); } @@ -1232,8 +1160,7 @@ public async Task Example_GetWorker_AllParameters_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteWorker_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.DeleteWorker(""); @@ -1244,8 +1171,7 @@ public void Example_DeleteWorker_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteWorker_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.DeleteWorkerAsync(""); @@ -1256,8 +1182,7 @@ public async Task Example_DeleteWorker_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_DeleteWorker_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = client.DeleteWorker(""); @@ -1268,8 +1193,7 @@ public void Example_DeleteWorker_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_DeleteWorker_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); Response response = await client.DeleteWorkerAsync(""); @@ -1280,14 +1204,13 @@ public async Task Example_DeleteWorker_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetJobs_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); foreach (BinaryData item in client.GetJobs(null, null, null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -1295,14 +1218,13 @@ public void Example_GetJobs_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetJobs_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); await foreach (BinaryData item in client.GetJobsAsync(null, null, null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -1310,10 +1232,9 @@ public async Task Example_GetJobs_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetJobs_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - foreach (RouterJobItem item in client.GetJobs()) + foreach (RouterJob item in client.GetJobs()) { } } @@ -1322,10 +1243,9 @@ public void Example_GetJobs_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetJobs_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - await foreach (RouterJobItem item in client.GetJobsAsync()) + await foreach (RouterJob item in client.GetJobsAsync()) { } } @@ -1334,46 +1254,46 @@ public async Task Example_GetJobs_ShortVersion_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_GetJobs_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); foreach (BinaryData item in client.GetJobs(1234, "all", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("addedAt").ToString()); + Console.WriteLine(result.GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToString()); } } @@ -1381,46 +1301,46 @@ public void Example_GetJobs_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetJobs_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); await foreach (BinaryData item in client.GetJobsAsync(1234, "all", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString()); - Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("channelReference").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("enqueuedAt").ToString()); + Console.WriteLine(result.GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("classificationPolicyId").ToString()); + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("dispositionCode").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("notes")[0].GetProperty("addedAt").ToString()); + Console.WriteLine(result.GetProperty("scheduledAt").ToString()); + Console.WriteLine(result.GetProperty("matchingMode").GetProperty("kind").ToString()); } } @@ -1428,10 +1348,9 @@ public async Task Example_GetJobs_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetJobs_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - foreach (RouterJobItem item in client.GetJobs(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) + foreach (RouterJob item in client.GetJobs(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) { } } @@ -1440,10 +1359,9 @@ public void Example_GetJobs_AllParameters_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetJobs_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - await foreach (RouterJobItem item in client.GetJobsAsync(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) + await foreach (RouterJob item in client.GetJobsAsync(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) { } } @@ -1452,14 +1370,13 @@ public async Task Example_GetJobs_AllParameters_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_GetWorkers_ShortVersion() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); foreach (BinaryData item in client.GetWorkers(null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -1467,14 +1384,13 @@ public void Example_GetWorkers_ShortVersion() [Ignore("Only validating compilation of examples")] public async Task Example_GetWorkers_ShortVersion_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); await foreach (BinaryData item in client.GetWorkersAsync(null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } } @@ -1482,10 +1398,9 @@ public async Task Example_GetWorkers_ShortVersion_Async() [Ignore("Only validating compilation of examples")] public void Example_GetWorkers_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - foreach (RouterWorkerItem item in client.GetWorkers()) + foreach (RouterWorker item in client.GetWorkers()) { } } @@ -1494,10 +1409,9 @@ public void Example_GetWorkers_ShortVersion_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetWorkers_ShortVersion_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - await foreach (RouterWorkerItem item in client.GetWorkersAsync()) + await foreach (RouterWorker item in client.GetWorkersAsync()) { } } @@ -1506,32 +1420,32 @@ public async Task Example_GetWorkers_ShortVersion_Convenience_Async() [Ignore("Only validating compilation of examples")] public void Example_GetWorkers_AllParameters() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); foreach (BinaryData item in client.GetWorkers(1234, "active", "", "", true, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("queues")[0].ToString()); + Console.WriteLine(result.GetProperty("capacity").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("availableForOffers").ToString()); } } @@ -1539,32 +1453,32 @@ public void Example_GetWorkers_AllParameters() [Ignore("Only validating compilation of examples")] public async Task Example_GetWorkers_AllParameters_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); await foreach (BinaryData item in client.GetWorkersAsync(1234, "active", "", "", true, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString()); - Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString()); Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("queues")[0].ToString()); + Console.WriteLine(result.GetProperty("capacity").ToString()); + Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("channelId").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("capacityCostPerJob").ToString()); + Console.WriteLine(result.GetProperty("channels")[0].GetProperty("maxNumberOfJobs").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString()); + Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString()); + Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString()); + Console.WriteLine(result.GetProperty("loadRatio").ToString()); + Console.WriteLine(result.GetProperty("availableForOffers").ToString()); } } @@ -1572,10 +1486,9 @@ public async Task Example_GetWorkers_AllParameters_Async() [Ignore("Only validating compilation of examples")] public void Example_GetWorkers_AllParameters_Convenience() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - foreach (RouterWorkerItem item in client.GetWorkers(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) + foreach (RouterWorker item in client.GetWorkers(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) { } } @@ -1584,10 +1497,9 @@ public void Example_GetWorkers_AllParameters_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_GetWorkers_AllParameters_Convenience_Async() { - Uri endpoint = new Uri(""); - JobRouterClient client = new JobRouterClient(endpoint); + JobRouterClient client = new JobRouterClient((string)null); - await foreach (RouterWorkerItem item in client.GetWorkersAsync(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) + await foreach (RouterWorker item in client.GetWorkersAsync(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Infrastructure/RouterLiveTestBase.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Infrastructure/RouterLiveTestBase.cs index 1c30cdf30224d..28587e2c0e33d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Infrastructure/RouterLiveTestBase.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Infrastructure/RouterLiveTestBase.cs @@ -43,6 +43,8 @@ public async Task CleanUp() var mode = TestEnvironment.Mode ?? Mode; if (mode != RecordedTestMode.Playback) { + await Task.Delay(TimeSpan.FromSeconds(3)); + var testName = TestContext.CurrentContext.Test.FullName; var popTestResources = _testCleanupTasks.TryRemove(testName, out var cleanupTasks); @@ -52,8 +54,19 @@ public async Task CleanUp() { while (cleanupTasks.Count > 0) { + await Task.Delay(TimeSpan.FromSeconds(1)); + var executableTask = cleanupTasks.Pop(); - await Task.Run(() => executableTask.Start()); + try + { + await Task.Run(() => executableTask.Start()); + } + catch (Exception) + { + // Retry after delay + await Task.Delay(TimeSpan.FromSeconds(3)); + await Task.Run(() => executableTask.Start()); + } } } } @@ -108,9 +121,9 @@ protected async Task> CreateQueueSelectionCPAsync { Name = classificationPolicyName, FallbackQueueId = createQueueResponse.Value.Id, - QueueSelectors = + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(createQueueResponse.Value.Id))) + new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(createQueueResponse.Value.Id))) } }); AddForCleanup(new Task(async () => await routerClient.DeleteClassificationPolicyAsync(createClassificationPolicyResponse.Value.Id))); @@ -124,12 +137,12 @@ protected async Task> CreateQueueAsync(string? uniqueIdent var createDistributionPolicyResponse = await CreateDistributionPolicy(uniqueIdentifier); var queueId = GenerateUniqueId($"{IdPrefix}-{uniqueIdentifier}"); var queueName = "DefaultQueue-Sdk-Test" + queueId; - var queueLabels = new Dictionary { ["Label_1"] = new("Value_1") }; + var queueLabels = new Dictionary { ["Label_1"] = new("Value_1") }; var createQueueResponse = await routerClient.CreateQueueAsync( new CreateQueueOptions(queueId, createDistributionPolicyResponse.Value.Id) { Name = queueName, - Labels = { ["Label_1"] = new LabelValue("Value_1") } + Labels = { ["Label_1"] = new RouterValue("Value_1") } }); AssertQueueResponseIsEqual(createQueueResponse, queueId, createDistributionPolicyResponse.Value.Id, queueName, queueLabels); @@ -160,7 +173,7 @@ protected async Task> CreateDistributionPolicy(stri #region Support assertions - protected void AssertQueueResponseIsEqual(Response upsertQueueResponse, string queueId, string distributionPolicyId, string? queueName = default, IDictionary? queueLabels = default, string? exceptionPolicyId = default) + protected void AssertQueueResponseIsEqual(Response upsertQueueResponse, string queueId, string distributionPolicyId, string? queueName = default, IDictionary? queueLabels = default, string? exceptionPolicyId = default) { var response = upsertQueueResponse.Value; @@ -173,7 +186,7 @@ protected void AssertQueueResponseIsEqual(Response upsertQueueRespo if (!labelsWithID.ContainsKey("Id")) { - labelsWithID.Add("Id", new LabelValue(queueId)); + labelsWithID.Add("Id", new RouterValue(queueId)); } Assert.AreEqual(labelsWithID.ToDictionary(x => x.Key, x => x.Value?.Value), response.Labels.ToDictionary(x => x.Key, x => x.Value?.Value)); @@ -186,21 +199,21 @@ protected void AssertQueueResponseIsEqual(Response upsertQueueRespo } protected void AssertRegisteredWorkerIsValid(Response routerWorkerResponse, string workerId, - IDictionary queueAssignments, int? totalCapacity, - IDictionary? workerLabels = default, - IDictionary? channelConfigList = default, - IDictionary? workerTags = default) + IList queues, int? capacity, + IDictionary? workerLabels = default, + IList? channelsList = default, + IDictionary? workerTags = default) { var response = routerWorkerResponse.Value; Assert.AreEqual(workerId, response.Id); - Assert.AreEqual(queueAssignments.Count(), response.QueueAssignments.Count); - Assert.AreEqual(totalCapacity, response.TotalCapacity); + Assert.AreEqual(queues.Count(), response.Queues.Count); + Assert.AreEqual(capacity, response.Capacity); if (workerLabels != default) { var labelsWithID = workerLabels.ToDictionary(k => k.Key, k => k.Value); - labelsWithID.Add("Id", new LabelValue(workerId)); + labelsWithID.Add("Id", new RouterValue(workerId)); Assert.AreEqual(labelsWithID, response.Labels); } @@ -210,9 +223,9 @@ protected void AssertRegisteredWorkerIsValid(Response routerWorker Assert.AreEqual(tags, response.Tags); } - if (channelConfigList != default) + if (channelsList != default) { - Assert.AreEqual(channelConfigList.Count, response.ChannelConfigurations.Count); + Assert.AreEqual(channelsList.Count, response.Channels.Count); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ClassificationPolicyLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ClassificationPolicyLiveTests.cs index e4dea0a935294..e5f974beb0780 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ClassificationPolicyLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ClassificationPolicyLiveTests.cs @@ -23,13 +23,13 @@ public async Task CreateClassificationPolicyTest() var createQueueResponse = await CreateQueueAsync(nameof(CreateClassificationPolicyTest)); var classificationPolicyId = GenerateUniqueId($"{IdPrefix}{nameof(CreateClassificationPolicyTest)}"); - var prioritizationRule = new StaticRouterRule(new LabelValue(1)); + var prioritizationRule = new StaticRouterRule(new RouterValue(1)); var createClassificationPolicyResponse = await routerClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(classificationPolicyId) { - QueueSelectors = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(createQueueResponse.Value.Id))) }, - WorkerSelectors = { new StaticWorkerSelectorAttachment(new RouterWorkerSelector("key", LabelOperator.Equal, new LabelValue("value"))) }, + QueueSelectorAttachments = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(createQueueResponse.Value.Id))) }, + WorkerSelectorAttachments = { new StaticWorkerSelectorAttachment(new RouterWorkerSelector("key", LabelOperator.Equal, new RouterValue("value"))) }, PrioritizationRule = prioritizationRule }); @@ -39,7 +39,7 @@ public async Task CreateClassificationPolicyTest() var createClassificationPolicy = createClassificationPolicyResponse.Value; Assert.DoesNotThrow(() => { - var queueSelectors = createClassificationPolicy.QueueSelectors; + var queueSelectors = createClassificationPolicy.QueueSelectorAttachments; Assert.AreEqual(queueSelectors.Count, 1); var qs = queueSelectors.First(); Assert.IsTrue(qs.GetType() == typeof(StaticQueueSelectorAttachment)); @@ -48,10 +48,10 @@ public async Task CreateClassificationPolicyTest() Assert.AreEqual(staticQSelector.QueueSelector.LabelOperator, LabelOperator.Equal); Assert.AreEqual(staticQSelector.QueueSelector.Value.Value, createQueueResponse.Value.Id); }); - Assert.AreEqual(1, createClassificationPolicy.WorkerSelectors.Count); + Assert.AreEqual(1, createClassificationPolicy.WorkerSelectorAttachments.Count); Assert.DoesNotThrow(() => { - var workerSelectors = createClassificationPolicy.WorkerSelectors; + var workerSelectors = createClassificationPolicy.WorkerSelectorAttachments; Assert.AreEqual(workerSelectors.Count, 1); var ws = workerSelectors.First(); Assert.IsTrue(ws.GetType() == typeof(StaticWorkerSelectorAttachment)); @@ -67,11 +67,11 @@ public async Task CreateClassificationPolicyTest() var classificationPolicyName = $"{classificationPolicyId}-Name"; var updateClassificationPolicyResponse = await routerClient.UpdateClassificationPolicyAsync( - new UpdateClassificationPolicyOptions(classificationPolicyId) + new ClassificationPolicy(classificationPolicyId) { FallbackQueueId = createQueueResponse.Value.Id, - QueueSelectors = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(createQueueResponse.Value.Id))) }, - WorkerSelectors = { new StaticWorkerSelectorAttachment(new RouterWorkerSelector("key", LabelOperator.Equal, new LabelValue("value"))) }, + QueueSelectorAttachments = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(createQueueResponse.Value.Id))) }, + WorkerSelectorAttachments = { new StaticWorkerSelectorAttachment(new RouterWorkerSelector("key", LabelOperator.Equal, new RouterValue("value"))) }, PrioritizationRule = prioritizationRule, Name = classificationPolicyName, }); @@ -81,7 +81,7 @@ public async Task CreateClassificationPolicyTest() createClassificationPolicy = updateClassificationPolicyResponse.Value; Assert.DoesNotThrow(() => { - var queueSelectors = createClassificationPolicy.QueueSelectors; + var queueSelectors = createClassificationPolicy.QueueSelectorAttachments; Assert.AreEqual(queueSelectors.Count, 1); var qs = queueSelectors.First(); Assert.IsTrue(qs.GetType() == typeof(StaticQueueSelectorAttachment)); @@ -90,10 +90,10 @@ public async Task CreateClassificationPolicyTest() Assert.AreEqual(staticQSelector.QueueSelector.LabelOperator, LabelOperator.Equal); Assert.AreEqual(staticQSelector.QueueSelector.Value.Value, createQueueResponse.Value.Id); }); - Assert.AreEqual(1, createClassificationPolicy.WorkerSelectors.Count); + Assert.AreEqual(1, createClassificationPolicy.WorkerSelectorAttachments.Count); Assert.DoesNotThrow(() => { - var workerSelectors = createClassificationPolicy.WorkerSelectors; + var workerSelectors = createClassificationPolicy.WorkerSelectorAttachments; Assert.AreEqual(workerSelectors.Count, 1); var ws = workerSelectors.First(); Assert.IsTrue(ws.GetType() == typeof(StaticWorkerSelectorAttachment)); @@ -106,17 +106,18 @@ public async Task CreateClassificationPolicyTest() Assert.IsTrue(!string.IsNullOrWhiteSpace(createClassificationPolicy.FallbackQueueId) && createClassificationPolicy.FallbackQueueId == createQueueResponse.Value.Id); Assert.IsFalse(string.IsNullOrWhiteSpace(createClassificationPolicy.Name)); + updateClassificationPolicyResponse.Value.FallbackQueueId = null; + updateClassificationPolicyResponse.Value.PrioritizationRule = null; + updateClassificationPolicyResponse.Value.QueueSelectorAttachments.Clear(); + updateClassificationPolicyResponse.Value.WorkerSelectorAttachments.Clear(); + updateClassificationPolicyResponse.Value.Name = $"{classificationPolicyName}-updated"; + updateClassificationPolicyResponse = await routerClient.UpdateClassificationPolicyAsync( - new UpdateClassificationPolicyOptions(classificationPolicyId) - { - FallbackQueueId = null, - PrioritizationRule = null, - Name = $"{classificationPolicyName}-updated", - }); + updateClassificationPolicyResponse.Value); var updateClassificationPolicy = updateClassificationPolicyResponse.Value; - Assert.IsTrue(updateClassificationPolicy.QueueSelectors.Any()); - Assert.IsTrue(updateClassificationPolicy.WorkerSelectors.Any()); + Assert.IsFalse(updateClassificationPolicy.QueueSelectorAttachments.Any()); + Assert.IsFalse(updateClassificationPolicy.WorkerSelectorAttachments.Any()); Assert.AreEqual(updateClassificationPolicy.Name, $"{classificationPolicyName}-updated"); } @@ -133,9 +134,9 @@ public async Task CreateEmptyClassificationPolicyTest() Assert.Null(getClassificationPolicyResponse.Value.FallbackQueueId); Assert.Null(getClassificationPolicyResponse.Value.Name); - Assert.IsEmpty(getClassificationPolicyResponse.Value.QueueSelectors); + Assert.IsEmpty(getClassificationPolicyResponse.Value.QueueSelectorAttachments); Assert.Null(getClassificationPolicyResponse.Value.PrioritizationRule); - Assert.IsEmpty(getClassificationPolicyResponse.Value.WorkerSelectors); + Assert.IsEmpty(getClassificationPolicyResponse.Value.WorkerSelectorAttachments); AddForCleanup(new Task(async () => await routerClient.DeleteClassificationPolicyAsync(classificationPolicyId))); } @@ -147,7 +148,7 @@ public async Task CreatePrioritizationClassificationPolicyTest() var classificationPolicyId = $"{IdPrefix}-CPPri"; var classificationPolicyName = $"Priority-ClassificationPolicy"; - var priorityRule = new StaticRouterRule(new LabelValue(10)); + var priorityRule = new StaticRouterRule(new RouterValue(10)); var createClassificationPolicyResponse = await routerClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(classificationPolicyId) { @@ -161,9 +162,9 @@ public async Task CreatePrioritizationClassificationPolicyTest() Assert.Null(getClassificationPolicyResponse.Value.FallbackQueueId); Assert.AreEqual(classificationPolicyName, getClassificationPolicyResponse.Value.Name); - Assert.IsEmpty(getClassificationPolicyResponse.Value.QueueSelectors); + Assert.IsEmpty(getClassificationPolicyResponse.Value.QueueSelectorAttachments); Assert.IsTrue(getClassificationPolicyResponse.Value.PrioritizationRule.GetType() == typeof(StaticRouterRule)); - Assert.IsEmpty(getClassificationPolicyResponse.Value.WorkerSelectors); + Assert.IsEmpty(getClassificationPolicyResponse.Value.WorkerSelectorAttachments); } [Test] @@ -179,21 +180,23 @@ public async Task CreateQueueSelectionClassificationPolicyTest() new CreateClassificationPolicyOptions(classificationPolicyId) { Name = classificationPolicyName, - QueueSelectors = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(createQueueResponse.Value.Id))) } + QueueSelectorAttachments = + { + new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, + new RouterValue(createQueueResponse.Value.Id))) + } }); AddForCleanup(new Task(async () => await routerClient.DeleteClassificationPolicyAsync(classificationPolicyId))); - var getClassificationPolicyResponse = - await routerClient.GetClassificationPolicyAsync(classificationPolicyId); - + var getClassificationPolicyResponse = await routerClient.GetClassificationPolicyAsync(classificationPolicyId); Assert.Null(getClassificationPolicyResponse.Value.FallbackQueueId); Assert.AreEqual(classificationPolicyName, getClassificationPolicyResponse.Value.Name); - Assert.AreEqual(1, getClassificationPolicyResponse.Value.QueueSelectors.Count); - var staticQSelector = (StaticQueueSelectorAttachment)getClassificationPolicyResponse.Value.QueueSelectors.First(); + Assert.AreEqual(1, getClassificationPolicyResponse.Value.QueueSelectorAttachments.Count); + var staticQSelector = (StaticQueueSelectorAttachment)getClassificationPolicyResponse.Value.QueueSelectorAttachments.First(); Assert.NotNull(staticQSelector); Assert.Null(getClassificationPolicyResponse.Value.PrioritizationRule); - Assert.AreEqual(0, getClassificationPolicyResponse.Value.WorkerSelectors.Count); + Assert.AreEqual(0, getClassificationPolicyResponse.Value.WorkerSelectorAttachments.Count); } [Test] @@ -207,7 +210,7 @@ public async Task CreateWorkerRequirementsClassificationPolicyTest() new CreateClassificationPolicyOptions(classificationPolicyId) { Name = classificationPolicyName, - WorkerSelectors = { new StaticWorkerSelectorAttachment(new RouterWorkerSelector("department", LabelOperator.Equal, new LabelValue("sales"))) } + WorkerSelectorAttachments = { new StaticWorkerSelectorAttachment(new RouterWorkerSelector("department", LabelOperator.Equal, new RouterValue("sales"))) } }); AddForCleanup(new Task(async () => await routerClient.DeleteClassificationPolicyAsync(classificationPolicyId))); @@ -218,8 +221,8 @@ public async Task CreateWorkerRequirementsClassificationPolicyTest() Assert.Null(getClassificationPolicyResponse.Value.FallbackQueueId); Assert.AreEqual(classificationPolicyName, getClassificationPolicyResponse.Value.Name); Assert.Null(getClassificationPolicyResponse.Value.PrioritizationRule); - Assert.IsEmpty(getClassificationPolicyResponse.Value.QueueSelectors); - Assert.AreEqual(1, getClassificationPolicyResponse.Value.WorkerSelectors.Count); + Assert.IsEmpty(getClassificationPolicyResponse.Value.QueueSelectorAttachments); + Assert.AreEqual(1, getClassificationPolicyResponse.Value.WorkerSelectorAttachments.Count); } #endregion Classification Policy Tests diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DistributionPolicyLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DistributionPolicyLiveTests.cs index f763f2d8f4446..7b4187ec6bb10 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DistributionPolicyLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DistributionPolicyLiveTests.cs @@ -45,10 +45,14 @@ public async Task CreateDistributionPolicyTest_BestWorker_DefaultScoringRule() Assert.IsFalse(bestWorkerModeDistributionPolicy.Mode.BypassSelectors); bestWorkerModeDistributionPolicyResponse = await routerClient.UpdateDistributionPolicyAsync( - new UpdateDistributionPolicyOptions(bestWorkerModeDistributionPolicyId) + new DistributionPolicy(bestWorkerModeDistributionPolicyId) { OfferExpiresAfter = TimeSpan.FromSeconds(60), - Mode = new BestWorkerMode(descendingOrder: false, bypassSelectors: true), + Mode = new BestWorkerMode + { + ScoringRuleOptions = new ScoringRuleOptions { DescendingOrder = false }, + BypassSelectors = true + }, Name = bestWorkerModeDistributionPolicyName }); @@ -60,7 +64,7 @@ public async Task CreateDistributionPolicyTest_BestWorker_DefaultScoringRule() Assert.IsTrue(bestWorkerModeDistributionPolicy.Mode.BypassSelectors); bestWorkerModeDistributionPolicyResponse = await routerClient.UpdateDistributionPolicyAsync( - new UpdateDistributionPolicyOptions(bestWorkerModeDistributionPolicyId) + new DistributionPolicy(bestWorkerModeDistributionPolicyId) { Mode = new BestWorkerMode { @@ -88,15 +92,20 @@ public async Task CreateDistributionPolicyTest_BestWorker_AzureRuleFunctions() var bestWorkerModeDistributionPolicyResponse = await routerClient.CreateDistributionPolicyAsync( new CreateDistributionPolicyOptions(bestWorkerModeDistributionPolicyId, TimeSpan.FromSeconds(1), - new BestWorkerMode( - new FunctionRouterRule(new Uri("https://my.function.app/api/myfunction?code=Kg==")) + new BestWorkerMode + { + ScoringRule = new FunctionRouterRule(new Uri("https://my.function.app/api/myfunction?code=Kg==")) { Credential = new FunctionRouterRuleCredential("MyAppKey", "MyClientId") }, - new List { ScoringRuleParameterSelector.WorkerSelectors }) - { - MinConcurrentOffers = 1, MaxConcurrentOffers = 2 - }) { Name = bestWorkerModeDistributionPolicyName, }); + ScoringRuleOptions = new ScoringRuleOptions + { + ScoringParameters = { ScoringRuleParameterSelector.WorkerSelectors } + }, + MinConcurrentOffers = 1, + MaxConcurrentOffers = 2 + } + ) { Name = bestWorkerModeDistributionPolicyName }); AddForCleanup(new Task(async () => await routerClient.DeleteDistributionPolicyAsync(bestWorkerModeDistributionPolicyId))); Assert.NotNull(bestWorkerModeDistributionPolicyResponse.Value); @@ -127,16 +136,20 @@ public async Task CreateDistributionPolicyTest_BestWorker_AzureRuleFunctions() Assert.AreEqual("MyClientId", azureFuncScoringRule.Credential.ClientId); bestWorkerModeDistributionPolicyResponse = await routerClient.UpdateDistributionPolicyAsync( - new UpdateDistributionPolicyOptions(bestWorkerModeDistributionPolicyId) + new DistributionPolicy(bestWorkerModeDistributionPolicyId) { - Mode = new BestWorkerMode( - new FunctionRouterRule(new Uri("https://my.function.app/api/myfunction?code=Kg==")) + Mode = new BestWorkerMode + { + ScoringRule = new FunctionRouterRule(new Uri("https://my.function.app/api/myfunction?code=Kg==")) { Credential = new FunctionRouterRuleCredential("MyKey") }, - new List { ScoringRuleParameterSelector.WorkerSelectors }) - { - MinConcurrentOffers = 1, MaxConcurrentOffers = 2 + ScoringRuleOptions = new ScoringRuleOptions + { + ScoringParameters = { ScoringRuleParameterSelector.WorkerSelectors } + }, + MinConcurrentOffers = 1, + MaxConcurrentOffers = 2 } }); @@ -192,7 +205,7 @@ public async Task CreateDistributionPolicyTest_LongestIdle() // specifying min and max concurrent offers longestIdleModeDistributionPolicyResponse = await routerClient.UpdateDistributionPolicyAsync( - new UpdateDistributionPolicyOptions(longestIdleModeDistributionPolicyId) + new DistributionPolicy(longestIdleModeDistributionPolicyId) { Mode = new LongestIdleMode { @@ -239,7 +252,7 @@ public async Task CreateDistributionPolicyTest_RoundRobin() // specifying min and max concurrent offers roundRobinModeDistributionPolicyResponse = await routerClient.UpdateDistributionPolicyAsync( - new UpdateDistributionPolicyOptions(roundRobinModeDistributionPolicyId) + new DistributionPolicy(roundRobinModeDistributionPolicyId) { Mode = new LongestIdleMode { diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ExceptionPolicyLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ExceptionPolicyLiveTests.cs index a96bba0863408..8226753d18c1f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ExceptionPolicyLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ExceptionPolicyLiveTests.cs @@ -27,13 +27,12 @@ public async Task CreateExceptionPolicyTest_QueueLength_Cancel() // exception rules var exceptionRuleId = GenerateUniqueId($"{IdPrefix}-ExceptionRule"); - var cancelActionId = GenerateUniqueId($"{IdPrefix}-CancellationExceptionAction"); - var rules = new Dictionary() + var rules = new List() { - [exceptionRuleId] = new ExceptionRule(new QueueLengthExceptionTrigger(1), - new Dictionary() + new ExceptionRule(id: exceptionRuleId,new QueueLengthExceptionTrigger(1), + new List { - [cancelActionId] = new CancelExceptionAction() + new CancelExceptionAction { DispositionCode = "CancelledDueToMaxQueueLengthReached" } @@ -54,24 +53,23 @@ public async Task CreateExceptionPolicyTest_QueueLength_Cancel() { var exceptionRule = exceptionPolicy.ExceptionRules.First(); - Assert.AreEqual(exceptionRuleId, exceptionRule.Key); - Assert.IsTrue(exceptionRule.Value.Trigger.GetType() == typeof(QueueLengthExceptionTrigger)); - var trigger = exceptionRule.Value.Trigger as QueueLengthExceptionTrigger; + Assert.AreEqual(exceptionRuleId, exceptionRule.Id); + Assert.IsTrue(exceptionRule.Trigger.GetType() == typeof(QueueLengthExceptionTrigger)); + var trigger = exceptionRule.Trigger as QueueLengthExceptionTrigger; Assert.NotNull(trigger); Assert.AreEqual(1, trigger!.Threshold); - var actions = exceptionRule.Value.Actions; + var actions = exceptionRule.Actions; Assert.AreEqual(1, actions.Count); - var cancelAction = actions.FirstOrDefault().Value as CancelExceptionAction; + var cancelAction = actions.FirstOrDefault() as CancelExceptionAction; Assert.NotNull(cancelAction); - Assert.AreEqual(cancelActionId, actions.FirstOrDefault().Key); Assert.AreEqual($"CancelledDueToMaxQueueLengthReached", cancelAction!.DispositionCode); }); // with name var exceptionPolicyName = $"{exceptionPolicyId}-ExceptionPolicyName"; createExceptionPolicyResponse = await routerClient.UpdateExceptionPolicyAsync( - new UpdateExceptionPolicyOptions(exceptionPolicyId) + new ExceptionPolicy(exceptionPolicyId) { Name = exceptionPolicyName }); @@ -93,34 +91,34 @@ public async Task CreateExceptionPolicyTest_WaitTime() var queueId = GenerateUniqueId(IdPrefix, nameof(CreateExceptionPolicyTest_WaitTime)); var createQueueResponse = await routerClient.CreateQueueAsync(new CreateQueueOptions(queueId, createDistributionPolicyResponse.Value.Id)); + AddForCleanup(new Task(async () => await routerClient.DeleteQueueAsync(queueId))); var classificationPolicyId = GenerateUniqueId($"{IdPrefix}{nameof(CreateExceptionPolicyTest_WaitTime)}"); var createClassificationPolicyResponse = await routerClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(classificationPolicyId) { - PrioritizationRule = new StaticRouterRule(new LabelValue(1)) + PrioritizationRule = new StaticRouterRule(new RouterValue(1)) }); var exceptionPolicyId = GenerateUniqueId($"{IdPrefix}{nameof(CreateExceptionPolicyTest_WaitTime)}"); - var labelsToUpsert = new Dictionary() { ["Label_1"] = new LabelValue("Value_1") }; + var labelsToUpsert = new Dictionary() { ["Label_1"] = new RouterValue("Value_1") }; // exception rules var exceptionRuleId = GenerateUniqueId($"{IdPrefix}-ExceptionRule"); - var reclassifyActionId = GenerateUniqueId($"{IdPrefix}-ReclassifyExceptionAction"); - var manualReclassifyActionId = GenerateUniqueId($"{IdPrefix}-ManualReclassifyAction"); - var rules = new Dictionary() + var rules = new List() { - [exceptionRuleId] = new ExceptionRule(new QueueLengthExceptionTrigger(1), - new Dictionary() + new(id: exceptionRuleId, new QueueLengthExceptionTrigger(1), + new List { - [reclassifyActionId] = new ReclassifyExceptionAction(classificationPolicyId) + new ReclassifyExceptionAction { - LabelsToUpsert = labelsToUpsert + ClassificationPolicyId = classificationPolicyId, + LabelsToUpsert = { ["Label_1"] = new RouterValue("Value_1") } }, - [manualReclassifyActionId] = new ManualReclassifyExceptionAction + new ManualReclassifyExceptionAction { QueueId = createQueueResponse.Value.Id, Priority = 1, - WorkerSelectors = { new RouterWorkerSelector("abc", LabelOperator.Equal, new LabelValue(1)) } + WorkerSelectors = { new RouterWorkerSelector("abc", LabelOperator.Equal, new RouterValue(1)) } } } ) @@ -133,29 +131,26 @@ public async Task CreateExceptionPolicyTest_WaitTime() var exceptionPolicy = createExceptionPolicyResponse.Value; - Assert.AreEqual(exceptionPolicyId, exceptionPolicy.Id); Assert.AreEqual(exceptionPolicyId, exceptionPolicy.Id); Assert.DoesNotThrow(() => { var exceptionRule = exceptionPolicy.ExceptionRules.First(); - Assert.AreEqual(exceptionRuleId, exceptionRule.Key); - Assert.IsTrue(exceptionRule.Value.Trigger.GetType() == typeof(QueueLengthExceptionTrigger)); - var trigger = exceptionRule.Value.Trigger as QueueLengthExceptionTrigger; + Assert.AreEqual(exceptionRuleId, exceptionRule.Id); + Assert.IsTrue(exceptionRule.Trigger.GetType() == typeof(QueueLengthExceptionTrigger)); + var trigger = exceptionRule.Trigger as QueueLengthExceptionTrigger; Assert.NotNull(trigger); Assert.AreEqual(1, trigger!.Threshold); - var actions = exceptionRule.Value.Actions; + var actions = exceptionRule.Actions; Assert.AreEqual(2, actions.Count); - var reclassifyExceptionAction = actions.FirstOrDefault().Value as ReclassifyExceptionAction; + var reclassifyExceptionAction = actions.FirstOrDefault() as ReclassifyExceptionAction; Assert.NotNull(reclassifyExceptionAction); - Assert.AreEqual(reclassifyActionId, actions.FirstOrDefault().Key); Assert.AreEqual(classificationPolicyId, reclassifyExceptionAction?.ClassificationPolicyId); Assert.AreEqual(labelsToUpsert.FirstOrDefault().Key, reclassifyExceptionAction?.LabelsToUpsert.FirstOrDefault().Key); Assert.AreEqual(labelsToUpsert.FirstOrDefault().Value.Value as string, reclassifyExceptionAction?.LabelsToUpsert.FirstOrDefault().Value.Value as string); - var manualReclassifyExceptionAction = actions.LastOrDefault().Value as ManualReclassifyExceptionAction; + var manualReclassifyExceptionAction = actions.LastOrDefault() as ManualReclassifyExceptionAction; Assert.NotNull(manualReclassifyExceptionAction); - Assert.AreEqual(manualReclassifyActionId, actions.LastOrDefault().Key); Assert.AreEqual(queueId, manualReclassifyExceptionAction?.QueueId); Assert.AreEqual(1, manualReclassifyExceptionAction?.Priority); }); @@ -163,7 +158,7 @@ public async Task CreateExceptionPolicyTest_WaitTime() // with name var exceptionPolicyName = $"{exceptionPolicyId}-ExceptionPolicyName"; createExceptionPolicyResponse = await routerClient.UpdateExceptionPolicyAsync( - new UpdateExceptionPolicyOptions(exceptionPolicyId) + new ExceptionPolicy(exceptionPolicyId) { Name = exceptionPolicyName }); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/JobQueueLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/JobQueueLiveTests.cs index 0126e2dd0c1c1..837f3176ed1b4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/JobQueueLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/JobQueueLiveTests.cs @@ -24,13 +24,13 @@ public async Task CreateQueueTest() var createDistributionPolicyResponse = await CreateDistributionPolicy(nameof(CreateQueueTest)); var queueId = GenerateUniqueId(IdPrefix, nameof(CreateQueueTest)); var queueName = "DefaultQueueWithLabels" + queueId; - var queueLabels = new Dictionary() { ["Label_1"] = new LabelValue("Value_1") }; + var queueLabels = new Dictionary() { ["Label_1"] = new RouterValue("Value_1") }; var createQueueResponse = await routerClient.CreateQueueAsync( new CreateQueueOptions(queueId, createDistributionPolicyResponse.Value.Id) { Name = queueName, - Labels = { ["Label_1"] = new LabelValue("Value_1") } + Labels = { ["Label_1"] = new RouterValue("Value_1") } }); AddForCleanup(new Task(async () => await routerClient.DeleteQueueAsync(createQueueResponse.Value.Id))); @@ -44,11 +44,11 @@ public async Task UpdateQueueTest() var createDistributionPolicyResponse = await CreateDistributionPolicy(nameof(CreateQueueTest)); var queueId = GenerateUniqueId(IdPrefix, nameof(CreateQueueTest)); var queueName = "DefaultQueueWithLabels" + queueId; - var queueLabels = new Dictionary + var queueLabels = new Dictionary { - ["Label_1"] = new LabelValue("Value_1"), - ["Label_2"] = new LabelValue(2), - ["Label_3"] = new LabelValue(true) + ["Label_1"] = new RouterValue("Value_1"), + ["Label_2"] = new RouterValue(2), + ["Label_3"] = new RouterValue(true) }; var createQueueResponse = await routerClient.CreateQueueAsync( new CreateQueueOptions(queueId, @@ -57,31 +57,25 @@ public async Task UpdateQueueTest() Name = queueName, Labels = { - ["Label_1"] = new LabelValue("Value_1"), - ["Label_2"] = new LabelValue(2), - ["Label_3"] = new LabelValue(true) + ["Label_1"] = new RouterValue("Value_1"), + ["Label_2"] = new RouterValue(2), + ["Label_3"] = new RouterValue(true) } }); AddForCleanup(new Task(async () => await routerClient.DeleteQueueAsync(createQueueResponse.Value.Id))); AssertQueueResponseIsEqual(createQueueResponse, queueId, createDistributionPolicyResponse.Value.Id, queueName, queueLabels); - var updatedLabels = new Dictionary(createQueueResponse.Value.Labels.ToDictionary(x => x.Key, x => (LabelValue?)x.Value)) - { - ["Label_1"] = null, - ["Label_2"] = new LabelValue(null), - ["Label_3"] = new LabelValue("Value_Updated_3"), - ["Label_4"] = new LabelValue("Value_4") - }; - - var updateOptions = new UpdateQueueOptions(queueId); - updateOptions.Labels.Append(updatedLabels); + createQueueResponse.Value.Labels["Label_1"] = null; + createQueueResponse.Value.Labels["Label_2"] = new RouterValue(null); + createQueueResponse.Value.Labels["Label_3"] = new RouterValue("Value_Updated_3"); + createQueueResponse.Value.Labels["Label_4"] = new RouterValue("Value_4"); - var updatedQueueResponse = await routerClient.UpdateQueueAsync(updateOptions); + var updatedQueueResponse = await routerClient.UpdateQueueAsync(createQueueResponse.Value); - AssertQueueResponseIsEqual(updatedQueueResponse, queueId, createDistributionPolicyResponse.Value.Id, queueName, new Dictionary + AssertQueueResponseIsEqual(updatedQueueResponse, queueId, createDistributionPolicyResponse.Value.Id, queueName, new Dictionary { - ["Label_3"] = new LabelValue("Value_Updated_3"), - ["Label_4"] = new LabelValue("Value_4") + ["Label_3"] = new RouterValue("Value_Updated_3"), + ["Label_4"] = new RouterValue("Value_4") }); } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/LabelValueTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/LabelValueTests.cs index 8d1306de9e098..49ec84699497b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/LabelValueTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/LabelValueTests.cs @@ -10,11 +10,11 @@ public class LabelValueTests [Test] public void LabelValueAcceptsNull() { - var labelValue = new LabelValue(null); + var labelValue = new RouterValue(null); Assert.IsNotNull(labelValue); - var testValue1 = new LabelValue(null); + var testValue1 = new RouterValue(null); Assert.AreEqual(labelValue, testValue1); - var testValue2 = new LabelValue(null); + var testValue2 = new RouterValue(null); Assert.AreEqual(labelValue, testValue2); } @@ -22,9 +22,9 @@ public void LabelValueAcceptsNull() public void LabelValueAcceptsInt16() { short input = 1; - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.IsNotNull(labelValue); - var testValue = new LabelValue(input); + var testValue = new RouterValue(input); Assert.AreEqual(labelValue, testValue); } @@ -32,9 +32,9 @@ public void LabelValueAcceptsInt16() public void LabelValueAcceptsInt32() { int input = 1; - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.IsNotNull(labelValue); - var testValue = new LabelValue(input); + var testValue = new RouterValue(input); Assert.AreEqual(labelValue, testValue); } @@ -42,9 +42,9 @@ public void LabelValueAcceptsInt32() public void LabelValueAcceptsInt64() { long input = 1; - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.IsNotNull(labelValue); - var testValue = new LabelValue(input); + var testValue = new RouterValue(input); Assert.AreEqual(labelValue, testValue); } @@ -52,9 +52,9 @@ public void LabelValueAcceptsInt64() public void LabelValueAcceptsFloat() { float input = 1; - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.IsNotNull(labelValue); - var testValue = new LabelValue(input); + var testValue = new RouterValue(input); Assert.AreEqual(labelValue, testValue); } @@ -62,9 +62,9 @@ public void LabelValueAcceptsFloat() public void LabelValueAcceptsDouble() { double input = 1; - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.IsNotNull(labelValue); - var testValue = new LabelValue(input); + var testValue = new RouterValue(input); Assert.AreEqual(labelValue, testValue); } @@ -72,9 +72,9 @@ public void LabelValueAcceptsDouble() public void LabelValueAcceptsDecimal() { decimal input = 1; - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.IsNotNull(labelValue); - var testValue = new LabelValue(input); + var testValue = new RouterValue(input); Assert.AreEqual(labelValue, testValue); } @@ -82,9 +82,9 @@ public void LabelValueAcceptsDecimal() public void LabelValueAcceptsString() { string input = "1"; - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.IsNotNull(labelValue); - var testValue = new LabelValue(input); + var testValue = new RouterValue(input); Assert.AreEqual(labelValue, testValue); } @@ -93,9 +93,9 @@ public void LabelValueAcceptsString() [TestCase(false)] public void LabelValueAcceptsBoolean(bool input) { - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.IsNotNull(labelValue); - var testValue = new LabelValue(input); + var testValue = new RouterValue(input); Assert.AreEqual(labelValue, testValue); } @@ -103,7 +103,7 @@ public void LabelValueAcceptsBoolean(bool input) public void LabelValueOverrideToString() { string input = "1"; - var labelValue = new LabelValue(input); + var labelValue = new RouterValue(input); Assert.AreEqual(labelValue.ToString(), labelValue.Value.ToString()); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterClientCrudTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterClientCrudTests.cs index f6fa571fcba03..9588ef6354d49 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterClientCrudTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterClientCrudTests.cs @@ -226,7 +226,7 @@ public void NullOrEmptyIdThrowsError_SetExceptionPolicy(string input, Type excep var client = CreateMockRouterAdministrationClient(200); try { - var response = client.CreateExceptionPolicy(new CreateExceptionPolicyOptions(input, new Dictionary())); + var response = client.CreateExceptionPolicy(new CreateExceptionPolicyOptions(input, new List())); } catch (Exception e) { @@ -243,7 +243,7 @@ public async Task NullOrEmptyIdThrowsError_SetExceptionAsync(string input, Type var client = CreateMockRouterAdministrationClient(200); try { - var response = await client.CreateExceptionPolicyAsync(new CreateExceptionPolicyOptions(input, new Dictionary())); + var response = await client.CreateExceptionPolicyAsync(new CreateExceptionPolicyOptions(input, new List())); } catch (Exception e) { diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterJobLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterJobLiveTests.cs index ae80b59bc58b9..80d6b82803807 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterJobLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterJobLiveTests.cs @@ -46,27 +46,34 @@ public async Task UpdateJobWithNotesWorksCorrectly() try { - updatedJob1Response = await routerClient.UpdateJobAsync(new UpdateJobOptions(jobId1) + updatedJob1Response = await routerClient.UpdateJobAsync(new RouterJob(jobId1) { Notes = { - new RouterJobNote { AddedAt = updateNoteTimeStamp, Message = "Fake notes attached to job with update" } + new RouterJobNote("Fake notes attached to job with update") { AddedAt = updateNoteTimeStamp } } }); } catch (Exception) { - updatedJob1Response = await routerClient.UpdateJobAsync(new UpdateJobOptions(jobId1) + updatedJob1Response = await routerClient.UpdateJobAsync(new RouterJob(jobId1) { Notes = { - new RouterJobNote { AddedAt = updateNoteTimeStamp, Message = "Fake notes attached to job with update" } + new RouterJobNote("Fake notes attached to job with update") { AddedAt = updateNoteTimeStamp } } }); } Assert.IsNotEmpty(updatedJob1Response.Notes); Assert.IsTrue(updatedJob1Response.Notes.Count == 1); + + // in-test cleanup + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(3)); + } + await routerClient.CancelJobAsync(jobId1); // other wise queue deletion will throw error } [Test] @@ -88,7 +95,6 @@ public async Task GetJobsTest() Priority = 1, }); - AddForCleanup(new Task(async () => await routerClient.CancelJobAsync(new CancelJobOptions(jobId1)))); AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(jobId1))); var createJob1 = createJob1Response.Value; @@ -100,7 +106,7 @@ public async Task GetJobsTest() Assert.AreEqual(RouterJobStatus.Queued, job1Result.Value.Status); // cancel job 1 - var cancelJob1Response = await routerClient.CancelJobAsync(new CancelJobOptions(createJob1.Id)); + var cancelJob1Response = await routerClient.CancelJobAsync(createJob1.Id); // Create job 2 var jobId2 = GenerateUniqueId($"{IdPrefix}{nameof(GetJobsTest)}2"); @@ -109,7 +115,6 @@ public async Task GetJobsTest() { Priority = 1 }); - AddForCleanup(new Task(async () => await routerClient.CancelJobAsync(new CancelJobOptions(jobId2)))); AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(jobId2))); var createJob2 = createJob2Response.Value; @@ -127,12 +132,16 @@ public async Task GetJobsTest() { foreach (var job in jobPage.Values) { - allJobs.Add(job.Job.Id); + allJobs.Add(job.Id); } } Assert.IsTrue(allJobs.Contains(createJob1.Id)); Assert.IsTrue(allJobs.Contains(createJob2.Id)); + + // in-test cleanup + await routerClient.CancelJobAsync(jobId1); // other wise queue deletion will throw error + await routerClient.CancelJobAsync(jobId2); // other wise queue deletion will throw error } [Test] @@ -156,7 +165,6 @@ public async Task GetJobsWithSchedulingFiltersTest() MatchingMode = new ScheduleAndSuspendMode(timeToEnqueueJob), }); - AddForCleanup(new Task(async () => await routerClient.CancelJobAsync(new CancelJobOptions(jobId1)))); AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(jobId1))); var createJob1 = createJob1Response.Value; // test get jobs @@ -167,11 +175,18 @@ public async Task GetJobsWithSchedulingFiltersTest() { foreach (var job in jobPage.Values) { - allJobs.Add(job.Job.Id); + allJobs.Add(job.Id); } } Assert.IsTrue(allJobs.Contains(createJob1.Id)); + + // in-test cleanup + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(3)); + } + await routerClient.CancelJobAsync(jobId1); // other wise queue deletion will throw error } [Test] @@ -190,7 +205,7 @@ public async Task CreateJobWithClassificationPolicy_w_StaticPriority() // Setup Classification Policies var classificationPolicyId = GenerateUniqueId($"{IdPrefix}-{nameof(CreateJobWithClassificationPolicy_w_StaticPriority)}-CP_StaticPriority"); var classificationPolicyName = $"StaticPriority-ClassificationPolicy"; - var priorityRule = new StaticRouterRule(new LabelValue(10)); + var priorityRule = new StaticRouterRule(new RouterValue(10)); var createClassificationPolicyResponse = await routerAdministrationClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(classificationPolicyId) { @@ -215,7 +230,6 @@ public async Task CreateJobWithClassificationPolicy_w_StaticPriority() }); var createJob = createJobResponse.Value; - AddForCleanup(new Task(async () => await routerClient.CancelJobAsync(new CancelJobOptions(jobId)))); AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(jobId))); var queuedJob = await Poll(async () => await routerClient.GetJobAsync(createJob.Id), @@ -225,6 +239,14 @@ public async Task CreateJobWithClassificationPolicy_w_StaticPriority() Assert.AreEqual(createJob.Id, queuedJob.Value.Id); Assert.AreEqual(10, queuedJob.Value.Priority); // from classification policy Assert.AreEqual(createQueue.Id, queuedJob.Value.QueueId); // from direct queue assignment + + // in-test cleanup + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(5)); + } + await routerClient.CancelJobAsync(createJob.Id); // other wise queue deletion will throw error + await routerAdministrationClient.DeleteClassificationPolicyAsync(classificationPolicyId); // other wise default queue deletion will throw error } [Test] @@ -246,7 +268,7 @@ public async Task CreateJobWithClassificationPolicy_w_StaticQueueSelector() new CreateClassificationPolicyOptions(classificationPolicyId) { Name = classificationPolicyName, - QueueSelectors = { new StaticQueueSelectorAttachment(new RouterQueueSelector(key: "Id", LabelOperator.Equal, value: new LabelValue(createQueue2.Id))) } + QueueSelectorAttachments = { new StaticQueueSelectorAttachment(new RouterQueueSelector(key: "Id", LabelOperator.Equal, value: new RouterValue(createQueue2.Id))) } }); AddForCleanup(new Task(async () => await routerAdministrationClient.DeleteClassificationPolicyAsync(classificationPolicyId))); var createClassificationPolicy = createClassificationPolicyResponse.Value; @@ -260,7 +282,6 @@ public async Task CreateJobWithClassificationPolicy_w_StaticQueueSelector() { ChannelReference = "123" }); - AddForCleanup(new Task(async () => await routerClient.CancelJobAsync(new CancelJobOptions(jobId)))); AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(jobId))); var createJob = createJobResponse.Value; @@ -273,7 +294,11 @@ public async Task CreateJobWithClassificationPolicy_w_StaticQueueSelector() Assert.AreEqual(createQueue2.Id, queuedJob.Value.QueueId); // from queue selector in classification policy // in-test cleanup - await routerClient.CancelJobAsync(new CancelJobOptions(createJob.Id)); // other wise queue deletion will throw error + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(5)); + } + await routerClient.CancelJobAsync(createJob.Id); // other wise queue deletion will throw error await routerAdministrationClient.DeleteClassificationPolicyAsync(classificationPolicyId); // other wise default queue deletion will throw error } @@ -311,7 +336,6 @@ public async Task CreateJobWithClassificationPolicy_w_FallbackQueue() ChannelReference = "123", QueueId = null }); - AddForCleanup(new Task(async () => await routerClient.CancelJobAsync(new CancelJobOptions(jobId)))); AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(jobId))); var createJob = createJobResponse.Value; @@ -321,6 +345,10 @@ public async Task CreateJobWithClassificationPolicy_w_FallbackQueue() Assert.AreEqual(RouterJobStatus.Queued, queuedJob.Value.Status); Assert.AreEqual(1, queuedJob.Value.Priority); // default priority value Assert.AreEqual(createQueue2.Id, queuedJob.Value.QueueId); // from fallback queue of classification policy + + // in-test cleanup + await routerClient.CancelJobAsync(createJob.Id); // other wise queue deletion will throw error + await routerAdministrationClient.DeleteClassificationPolicyAsync(classificationPolicyId); // other wise default queue deletion will throw error } [Test] @@ -357,7 +385,6 @@ public async Task CreateJobWithQueue_And_ClassificationPolicy_w_FallbackQueue() QueueId = createQueue1.Id, }); var createJob = createJobResponse.Value; - AddForCleanup( new Task(async () => await routerClient.CancelJobAsync(new CancelJobOptions(createJob.Id)))); AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob.Id))); var queuedJob = await Poll(async () => await routerClient.GetJobAsync(createJob.Id), @@ -367,6 +394,10 @@ public async Task CreateJobWithQueue_And_ClassificationPolicy_w_FallbackQueue() Assert.AreEqual(createJob.Id, queuedJob.Value.Id); Assert.AreEqual(1, queuedJob.Value.Priority); // default value Assert.AreEqual(createQueue1.Id, queuedJob.Value.QueueId); // from queue selector in classification policy + + // in-test cleanup + await routerClient.CancelJobAsync(createJob.Id); // other wise queue deletion will throw error + await routerAdministrationClient.DeleteClassificationPolicyAsync(classificationPolicyId); // other wise default queue deletion will throw error } [Test] @@ -392,6 +423,16 @@ public async Task CreateJobWithQueueAndMatchMode() AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob1.Id))); Assert.IsTrue(createJob1.MatchingMode.GetType() == typeof(QueueAndMatchMode)); + + var queuedJob = await Poll(async () => await routerClient.GetJobAsync(createJob1.Id), + job => job.Value.Status == RouterJobStatus.Queued, TimeSpan.FromSeconds(10)); + + // in-test cleanup + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(3)); + } + await routerClient.CancelJobAsync(createJob1.Id); // other wise queue deletion will throw error } [Test] @@ -417,6 +458,13 @@ public async Task CreateJobWithSuspendMode() AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob1.Id))); Assert.IsTrue(createJob1.MatchingMode.GetType() == typeof(SuspendMode)); + + // in-test cleanup + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(3)); + } + await routerClient.CancelJobAsync(createJob1.Id); // other wise queue deletion will throw error } [Test] @@ -431,7 +479,7 @@ public async Task CreateJobWithScheduleAndSuspendMode() // Create 1 job var jobId1 = GenerateUniqueId($"{IdPrefix}{nameof(CreateJobWithScheduleAndSuspendMode)}1"); - var timeToEnqueueJob = GetOrSetScheduledTimeUtc(DateTimeOffset.UtcNow.AddSeconds(7)); + var timeToEnqueueJob = GetOrSetScheduledTimeUtc(new DateTimeOffset(2100, 1, 1, 1, 1, 1, TimeSpan.Zero)); var createJob1Response = await routerClient.CreateJobAsync( new CreateJobOptions(jobId1, channelId, createQueue.Id) { @@ -443,6 +491,12 @@ public async Task CreateJobWithScheduleAndSuspendMode() AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob1.Id))); Assert.IsTrue(createJob1.MatchingMode.GetType() == typeof(ScheduleAndSuspendMode)); + + var queuedJob = await Poll(async () => await routerClient.GetJobAsync(createJob1.Id), + job => job.Value.Status == RouterJobStatus.Scheduled, TimeSpan.FromSeconds(10)); + + // in-test cleanup + await routerClient.CancelJobAsync(createJob1.Id); // other wise queue deletion will throw error } [Test] @@ -457,17 +511,17 @@ public async Task UpdateJobTest() // Create 1 job var jobId1 = GenerateUniqueId($"{IdPrefix}{nameof(UpdateJobTest)}1"); - var labels = new Dictionary + var labels = new Dictionary { - ["Label_1"] = new LabelValue("Value_1"), - ["Label_2"] = new LabelValue(2), - ["Label_3"] = new LabelValue(true) + ["Label_1"] = new RouterValue("Value_1"), + ["Label_2"] = new RouterValue(2), + ["Label_3"] = new RouterValue(true) }; - var tags = new Dictionary + var tags = new Dictionary { - ["Tag_1"] = new LabelValue("Value_1"), - ["Tag_2"] = new LabelValue(2), - ["Tag_3"] = new LabelValue(true) + ["Tag_1"] = new RouterValue("Value_1"), + ["Tag_2"] = new RouterValue(2), + ["Tag_3"] = new RouterValue(true) }; var createJobOptions = new CreateJobOptions(jobId1, channelId, createQueue.Id); @@ -475,39 +529,46 @@ public async Task UpdateJobTest() createJobOptions.Tags.Append(tags); var createJobResponse = await routerClient.CreateJobAsync(createJobOptions); - AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJobResponse.Value.Id))); - var updatedLabels = new Dictionary + var updatedLabels = new Dictionary { ["Label_1"] = null, - ["Label_2"] = new LabelValue(null), - ["Label_3"] = new LabelValue("Value_Updated_3"), - ["Label_4"] = new LabelValue("Value_4") + ["Label_2"] = new RouterValue(null), + ["Label_3"] = new RouterValue("Value_Updated_3"), + ["Label_4"] = new RouterValue("Value_4") }; - var updatedTags = new Dictionary + var updatedTags = new Dictionary { ["Tag_1"] = null, - ["Tag_2"] = new LabelValue(null), - ["Tag_3"] = new LabelValue("Value_Updated_3"), - ["Tag_4"] = new LabelValue("Value_4") + ["Tag_2"] = new RouterValue(null), + ["Tag_3"] = new RouterValue("Value_Updated_3"), + ["Tag_4"] = new RouterValue("Value_4") }; - var updateOptions = new UpdateJobOptions(jobId1); + var updateOptions = new RouterJob(jobId1); updateOptions.Labels.Append(updatedLabels); updateOptions.Tags.Append(updatedTags); var updateJobResponse = await routerClient.UpdateJobAsync(updateOptions); - Assert.AreEqual(updateJobResponse.Value.Labels, new Dictionary + Assert.AreEqual(updateJobResponse.Value.Labels, new Dictionary { - ["Label_3"] = new LabelValue("Value_Updated_3"), - ["Label_4"] = new LabelValue("Value_4") + ["Label_3"] = new RouterValue("Value_Updated_3"), + ["Label_4"] = new RouterValue("Value_4") }); - Assert.AreEqual(updateJobResponse.Value.Tags, new Dictionary + Assert.AreEqual(updateJobResponse.Value.Tags, new Dictionary { - ["Tag_3"] = new LabelValue("Value_Updated_3"), - ["Tag_4"] = new LabelValue("Value_4") + ["Tag_3"] = new RouterValue("Value_Updated_3"), + ["Tag_4"] = new RouterValue("Value_4") }); + + // in-test cleanup + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(5)); + } + await routerClient.CancelJobAsync(jobId1); // other wise queue deletion will throw error + await routerClient.DeleteJobAsync(jobId1); // other wise queue deletion will throw error } [Test] @@ -524,7 +585,7 @@ public async Task ReclassifyJob() var classificationPolicy = await routerAdminClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(GenerateUniqueId($"{IdPrefix}{nameof(ReclassifyJob)}-policy")) { - PrioritizationRule = new StaticRouterRule(new LabelValue(1)) + PrioritizationRule = new StaticRouterRule(new RouterValue(1)) }); AddForCleanup(new Task(async () => await routerAdminClient.DeleteClassificationPolicyAsync(classificationPolicy.Value.Id))); @@ -546,6 +607,13 @@ public async Task ReclassifyJob() await routerClient.ReclassifyJobAsync(jobId1, CancellationToken.None); Assert.AreEqual(createJob1.QueueId, createQueue.Id); + + // in-test cleanup + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(3)); + } + await routerClient.CancelJobAsync(jobId1); // other wise queue deletion will throw error } #endregion Job Tests diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterWorkerLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterWorkerLiveTests.cs index efed9dfde0c75..ea879854e9ddb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterWorkerLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterWorkerLiveTests.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading.Tasks; using Azure.Communication.JobRouter.Tests.Infrastructure; +using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.RouterClients @@ -27,38 +28,41 @@ public async Task CreateWorkerTest() // Register worker var workerId = GenerateUniqueId($"{IdPrefix}{nameof(CreateWorkerTest)}"); - var totalCapacity = 100; + var capacity = 100; - var channelConfig1 = new ChannelConfiguration(20) { MaxNumberOfJobs = 5 }; + var channel1 = new RouterChannel("ACS_Chat_Channel", 20) { MaxNumberOfJobs = 5 }; - var channelConfigList = new Dictionary() - { - ["ACS_Chat_Channel"] = channelConfig1 - }; - var workerLabels = new Dictionary() + var channels = new List { channel1 }; + + var workerLabels = new Dictionary() { - ["test_label_1"] = new LabelValue("testLabel"), - ["test_label_2"] = new LabelValue(12), + ["test_label_1"] = new RouterValue("testLabel"), + ["test_label_2"] = new RouterValue(12), }; - var queueAssignments = new Dictionary {{ createQueueResponse.Value.Id, new RouterQueueAssignment() }}; + var queues = new List { createQueueResponse.Value.Id }; var routerWorkerResponse = await routerClient.CreateWorkerAsync( - new CreateWorkerOptions(workerId, totalCapacity) + new CreateWorkerOptions(workerId, capacity) { - QueueAssignments = { { createQueueResponse.Value.Id, new RouterQueueAssignment() } }, + Queues = { createQueueResponse.Value.Id }, Labels = { - ["test_label_1"] = new LabelValue("testLabel"), - ["test_label_2"] = new LabelValue(12), + ["test_label_1"] = new RouterValue("testLabel"), + ["test_label_2"] = new RouterValue(12), }, - ChannelConfigurations = { ["ACS_Chat_Channel"] = channelConfig1 } + Channels = { channel1 } }); AddForCleanup(new Task(async () => await routerClient.DeleteWorkerAsync(workerId))); Assert.NotNull(routerWorkerResponse.Value); - AssertRegisteredWorkerIsValid(routerWorkerResponse, workerId, queueAssignments, - totalCapacity, workerLabels, channelConfigList); + AssertRegisteredWorkerIsValid(routerWorkerResponse, workerId, queues, + capacity, workerLabels, channels); + + routerWorkerResponse.Value.AvailableForOffers = false; + routerWorkerResponse.Value.Queues.RemoveAt(0); + + await routerClient.UpdateWorkerAsync(routerWorkerResponse); } [Test] @@ -69,11 +73,14 @@ public async Task RegisterWorkerShouldNotThrowArgumentNullExceptionTest() // Register worker with only id and total capacity var workerId = $"{IdPrefix}-WorkerIDRegisterWorker"; - var totalCapacity = 100; - var routerWorkerResponse = await routerClient.CreateWorkerAsync(new CreateWorkerOptions(workerId, totalCapacity) {AvailableForOffers = true}); + var capacity = 100; + var routerWorkerResponse = await routerClient.CreateWorkerAsync(new CreateWorkerOptions(workerId, capacity) {AvailableForOffers = true}); AddForCleanup(new Task(async () => await routerClient.DeleteWorkerAsync(workerId))); Assert.NotNull(routerWorkerResponse.Value); + + routerWorkerResponse.Value.AvailableForOffers = false; + await routerClient.UpdateWorkerAsync(routerWorkerResponse); } /*[Test] @@ -100,58 +107,58 @@ public async Task GetWorkersTest() var registerWorker1Response = await routerClient.CreateWorkerAsync( new CreateWorkerOptions(workerId1, 10) { - QueueAssignments = { [createQueue1.Id] = new RouterQueueAssignment() }, - ChannelConfigurations = + Queues = { createQueue1.Id, }, + Channels = { - ["WebChat"] = new ChannelConfiguration(1), - ["Voip"] = new ChannelConfiguration(10) + new RouterChannel("WebChat", 1), + ["Voip"] = new RouterChannel(10) }, AvailableForOffers = true }); var registerWorker1 = registerWorker1Response.Value; - AddForCleanup(new Task(async () => await routerClient.UpdateWorkerAsync(new UpdateWorkerOptions(workerId1) { AvailableForOffers = false}))); + AddForCleanup(new Task(async () => await routerClient.UpdateWorkerAsync(new RouterWorker(workerId1) { AvailableForOffers = false}))); var registerWorker2Response = await routerClient.CreateWorkerAsync( new CreateWorkerOptions(workerId2, 10) { - QueueAssignments = { [createQueue2.Id] = new RouterQueueAssignment() }, - ChannelConfigurations = + Queues = { createQueue2.Id, }, + Channels = { - ["WebChat"] = new ChannelConfiguration(5) { MaxNumberOfJobs = 1 }, - ["Voip"] = new ChannelConfiguration(10) { MaxNumberOfJobs = 1 } + ["WebChat"] = new RouterChannel(5) { MaxNumberOfJobs = 1 }, + ["Voip"] = new RouterChannel(10) { MaxNumberOfJobs = 1 } }, AvailableForOffers = true, }); var registerWorker2 = registerWorker2Response.Value; - AddForCleanup(new Task(async () => await routerClient.UpdateWorkerAsync(new UpdateWorkerOptions(workerId2) { AvailableForOffers = false }))); + AddForCleanup(new Task(async () => await routerClient.UpdateWorkerAsync(new RouterWorker(workerId2) { AvailableForOffers = false }))); var registerWorker3Response = await routerClient.CreateWorkerAsync( new CreateWorkerOptions(workerId3, 12) { - QueueAssignments = + Queues = { - [createQueue1.Id] = new RouterQueueAssignment(), - [createQueue2.Id] = new RouterQueueAssignment() + createQueue1.Id,, + createQueue2.Id, }, - ChannelConfigurations = + Channels = { - ["WebChat"] = new ChannelConfiguration(1) { MaxNumberOfJobs = 12 }, - ["Voip"] = new ChannelConfiguration(10) + ["WebChat"] = new RouterChannel(1) { MaxNumberOfJobs = 12 }, + ["Voip"] = new RouterChannel(10) }, AvailableForOffers = true, }); var registerWorker3 = registerWorker3Response.Value; - AddForCleanup(new Task(async () => await routerClient.UpdateWorkerAsync(new UpdateWorkerOptions(workerId3) { AvailableForOffers = false }))); + AddForCleanup(new Task(async () => await routerClient.UpdateWorkerAsync(new RouterWorker(workerId3) { AvailableForOffers = false }))); var registerWorker4Response = await routerClient.CreateWorkerAsync( new CreateWorkerOptions(workerId4, 10) { - QueueAssignments = { [createQueue1.Id] = new RouterQueueAssignment() }, - ChannelConfigurations = { ["WebChat"] = new ChannelConfiguration(1) }, + Queues = { createQueue1.Id, }, + Channels = { ["WebChat"] = new RouterChannel(1) }, AvailableForOffers = true, }); var registerWorker4 = registerWorker4Response.Value; - AddForCleanup(new Task(async () => await routerClient.UpdateWorkerAsync( new UpdateWorkerOptions(workerId4) { AvailableForOffers = false }))); + AddForCleanup(new Task(async () => await routerClient.UpdateWorkerAsync( new RouterWorker(workerId4) { AvailableForOffers = false }))); // Query all workers with channel filter var channel2Workers = new HashSet() { workerId1, workerId2, workerId3 }; @@ -161,9 +168,9 @@ public async Task GetWorkersTest() Assert.AreEqual(1, workerPage.Values.Count); foreach (var worker in workerPage.Values) { - if (channel2Workers.Contains(worker.Worker.Id)) + if (channel2Workers.Contains(worker.Id)) { - channel2Workers.Remove(worker.Worker.Id); + channel2Workers.Remove(worker.Id); } } } @@ -177,9 +184,9 @@ public async Task GetWorkersTest() Assert.AreEqual(1, workerPage.Values.Count); foreach (var worker in workerPage.Values) { - if (queue2Workers.Contains(worker.Worker.Id)) + if (queue2Workers.Contains(worker.Id)) { - queue2Workers.Remove(worker.Worker.Id); + queue2Workers.Remove(worker.Id); } } } @@ -193,16 +200,16 @@ public async Task GetWorkersTest() Assert.AreEqual(1, workerPage.Values.Count); foreach (var worker in workerPage.Values) { - if (channel1Workers.Contains(worker.Worker.Id)) + if (channel1Workers.Contains(worker.Id)) { - channel1Workers.Remove(worker.Worker.Id); + channel1Workers.Remove(worker.Id); } } } Assert.IsEmpty(channel1Workers); // Deregister worker1 - await routerClient.UpdateWorkerAsync(new UpdateWorkerOptions(workerId1) { AvailableForOffers = false}); + await routerClient.UpdateWorkerAsync(new RouterWorker(workerId1) { AvailableForOffers = false}); var checkWorker1Status = await Poll(async () => await routerClient.GetWorkerAsync(workerId1), w => w.Value.State == RouterWorkerState.Inactive, TimeSpan.FromSeconds(10)); @@ -217,7 +224,7 @@ public async Task GetWorkersTest() Assert.AreEqual(1, workerPage.Values.Count); foreach (var worker in workerPage.Values) { - activeWorkers.Add(worker.Worker.Id); + activeWorkers.Add(worker.Id); } } @@ -233,7 +240,7 @@ public async Task GetWorkersTest() Assert.AreEqual(1, workerPage.Values.Count); foreach (var worker in workerPage.Values) { - inactiveWorkers.Add(worker.Worker.Id); + inactiveWorkers.Add(worker.Id); } } Assert.IsTrue(inactiveWorkers.Contains(workerId1)); @@ -255,64 +262,60 @@ public async Task UpdateWorkerTest() // Register worker var workerId = GenerateUniqueId($"{IdPrefix}{nameof(UpdateWorkerTest)}"); - var totalCapacity = 100; - var channelConfigList = new Dictionary() + var capacity = 100; + var channels = new List() { - ["ACS_Chat_Channel"] = new(20) { MaxNumberOfJobs = 5 }, - ["ACS_Voice_Channel"] = new(10) { MaxNumberOfJobs = 3} + new("ACS_Chat_Channel", 20) { MaxNumberOfJobs = 5 }, + new("ACS_Voice_Channel", 10) { MaxNumberOfJobs = 3 } }; - var workerLabels = new Dictionary() + var workerLabels = new Dictionary() { ["test_label_1"] = new("testLabel"), ["test_label_2"] = new(12), }; - var workerTags = new Dictionary() + var workerTags = new Dictionary() { ["test_tag_1"] = new("tag"), ["test_tag_2"] = new(12), }; - var queueAssignments = new Dictionary {{ createQueueResponse.Value.Id, new RouterQueueAssignment() }}; + var queues = new List { createQueueResponse.Value.Id }; - var createWorkerOptions = new CreateWorkerOptions(workerId, totalCapacity) + var createWorkerOptions = new CreateWorkerOptions(workerId, capacity) { AvailableForOffers = true }; createWorkerOptions.Labels.Append(workerLabels); - createWorkerOptions.ChannelConfigurations.Append(channelConfigList); - createWorkerOptions.QueueAssignments.Append(queueAssignments); + createWorkerOptions.Channels.AddRange(channels); + createWorkerOptions.Queues.AddRange(queues); createWorkerOptions.Tags.Append(workerTags); var routerWorkerResponse = await routerClient.CreateWorkerAsync(createWorkerOptions); AddForCleanup(new Task(async () => await routerClient.DeleteWorkerAsync(workerId))); Assert.NotNull(routerWorkerResponse.Value); - AssertRegisteredWorkerIsValid(routerWorkerResponse, workerId, queueAssignments, - totalCapacity, workerLabels, channelConfigList, workerTags); + AssertRegisteredWorkerIsValid(routerWorkerResponse, workerId, queues, + capacity, workerLabels, channels, workerTags); - // Remove queue assignment, channel configuration and label - queueAssignments[createQueueResponse.Value.Id] = null; - channelConfigList[channelConfigList.First().Key] = null; - workerLabels[workerLabels.First().Key] = null; - workerTags[workerTags.First().Key] = null; + var updatedWorker = routerWorkerResponse.Value; + updatedWorker.Labels[workerLabels.First().Key] = null; + updatedWorker.Tags[workerTags.First().Key] = null; + updatedWorker.Queues.Remove(createQueueResponse.Value.Id); + updatedWorker.Channels.RemoveAt(0); - var updateWorkerOptions = new UpdateWorkerOptions(workerId) - { - AvailableForOffers = false - }; - updateWorkerOptions.Labels.Append(workerLabels); - updateWorkerOptions.ChannelConfigurations.Append(channelConfigList); - updateWorkerOptions.QueueAssignments.Append(queueAssignments); - updateWorkerOptions.Tags.Append(workerTags); + var updateWorkerResponse = await routerClient.UpdateWorkerAsync(updatedWorker); + + updatedWorker.Labels.Remove("Id"); + updatedWorker.Labels.Remove(workerLabels.First().Key); + updatedWorker.Tags.Remove(workerTags.First().Key); - var updateWorkerResponse = await routerClient.UpdateWorkerAsync(updateWorkerOptions); + AssertRegisteredWorkerIsValid(updateWorkerResponse, workerId, new List(), + capacity, updatedWorker.Labels, updatedWorker.Channels, updatedWorker.Tags); - updateWorkerOptions.ChannelConfigurations.Remove(channelConfigList.First().Key); - updateWorkerOptions.Labels.Remove(workerLabels.First().Key); - updateWorkerOptions.Tags.Remove(workerTags.First().Key); + // in-test cleanup + updatedWorker.AvailableForOffers = false; - AssertRegisteredWorkerIsValid(updateWorkerResponse, workerId, new Dictionary(), - totalCapacity, updateWorkerOptions.Labels, updateWorkerOptions.ChannelConfigurations, updateWorkerOptions.Tags); + await routerClient.UpdateWorkerAsync(updatedWorker); } #endregion Worker Tests diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/StaticRuleTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/StaticRuleTests.cs index 717034487b884..17438175b60aa 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/StaticRuleTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/StaticRuleTests.cs @@ -18,7 +18,7 @@ public void RouterRuleAcceptsValueInConstructor(object input) { Assert.DoesNotThrow(() => { - var rule = new StaticRouterRule(new LabelValue(input)); + var rule = new StaticRouterRule(new RouterValue(input)); Assert.AreEqual(input, rule.Value.Value); }); } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOps.cs index 9ab84d2bc7a8c..ba5560160f7fa 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOps.cs @@ -26,32 +26,32 @@ public void ClassificationPolicyCrud() options: new CreateClassificationPolicyOptions(classificationPolicyId) { Name = "Sample classification policy", - PrioritizationRule = new StaticRouterRule(new LabelValue(10)), - QueueSelectors = + PrioritizationRule = new StaticRouterRule(new RouterValue(10)), + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new LabelValue("NA"))), + new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new RouterValue("NA"))), new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("Product", LabelOperator.Equal, new LabelValue("O365")), - new RouterQueueSelector("QGroup", LabelOperator.Equal, new LabelValue("NA_O365")) + new RouterQueueSelector("Product", LabelOperator.Equal, new RouterValue("O365")), + new RouterQueueSelector("QGroup", LabelOperator.Equal, new RouterValue("NA_O365")) }), }, - WorkerSelectors = + WorkerSelectorAttachments = { new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new LabelValue(true)), - new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(1)) + new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new RouterValue(true)), + new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(1)) }), new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.HighPriority = \"true\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(10)) + new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(10)) }) } }); @@ -71,7 +71,7 @@ public void ClassificationPolicyCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicy Response updatedClassificationPolicy = routerAdministrationClient.UpdateClassificationPolicy( - new UpdateClassificationPolicyOptions(classificationPolicyId) + new ClassificationPolicy(classificationPolicyId) { PrioritizationRule = new ExpressionRouterRule("If(job.HighPriority = \"true\", 50, 10)") }); @@ -82,12 +82,12 @@ public void ClassificationPolicyCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetClassificationPolicies - Pageable classificationPolicies = routerAdministrationClient.GetClassificationPolicies(); - foreach (Page asPage in classificationPolicies.AsPages(pageSizeHint: 10)) + Pageable classificationPolicies = routerAdministrationClient.GetClassificationPolicies(); + foreach (Page asPage in classificationPolicies.AsPages(pageSizeHint: 10)) { - foreach (ClassificationPolicyItem? policy in asPage.Values) + foreach (ClassificationPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing classification policy with id: {policy.ClassificationPolicy.Id}"); + Console.WriteLine($"Listing classification policy with id: {policy.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOpsAsync.cs index e46a1d61dc7ed..95ecf66a8997a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOpsAsync.cs @@ -27,32 +27,32 @@ public async Task ClassificationPolicyCrud() options: new CreateClassificationPolicyOptions(classificationPolicyId) { Name = "Sample classification policy", - PrioritizationRule = new StaticRouterRule(new LabelValue(10)), - QueueSelectors = + PrioritizationRule = new StaticRouterRule(new RouterValue(10)), + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new LabelValue("NA"))), + new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new RouterValue("NA"))), new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("Product", LabelOperator.Equal, new LabelValue("O365")), - new RouterQueueSelector("QGroup", LabelOperator.Equal, new LabelValue("NA_O365")) + new RouterQueueSelector("Product", LabelOperator.Equal, new RouterValue("O365")), + new RouterQueueSelector("QGroup", LabelOperator.Equal, new RouterValue("NA_O365")) }), }, - WorkerSelectors = + WorkerSelectorAttachments = { new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new LabelValue(true)), - new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(1)) + new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new RouterValue(true)), + new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(1)) }), new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.HighPriority = \"true\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(10)) + new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(10)) }) } }); @@ -72,7 +72,7 @@ public async Task ClassificationPolicyCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicy_Async Response updatedClassificationPolicy = await routerAdministrationClient.UpdateClassificationPolicyAsync( - new UpdateClassificationPolicyOptions(classificationPolicyId) + new ClassificationPolicy(classificationPolicyId) { PrioritizationRule = new ExpressionRouterRule("If(job.HighPriority = \"true\", 50, 10)") }); @@ -83,12 +83,12 @@ public async Task ClassificationPolicyCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetClassificationPolicies_Async - AsyncPageable classificationPolicies = routerAdministrationClient.GetClassificationPoliciesAsync(); - await foreach (Page asPage in classificationPolicies.AsPages(pageSizeHint: 10)) + AsyncPageable classificationPolicies = routerAdministrationClient.GetClassificationPoliciesAsync(); + await foreach (Page asPage in classificationPolicies.AsPages(pageSizeHint: 10)) { - foreach (ClassificationPolicyItem? policy in asPage.Values) + foreach (ClassificationPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing classification policy with id: {policy.ClassificationPolicy.Id}"); + Console.WriteLine($"Listing classification policy with id: {policy.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOps.cs index ff07251e9c91a..a3f7e90cb1a0f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOps.cs @@ -46,7 +46,7 @@ public void DistributionPolicyCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicy Response updatedDistributionPolicy = routerAdministrationClient.UpdateDistributionPolicy( - new UpdateDistributionPolicyOptions(distributionPolicyId) + new DistributionPolicy(distributionPolicyId) { // you can update one or more properties of distribution policy Mode = new RoundRobinMode(), @@ -58,12 +58,12 @@ public void DistributionPolicyCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetDistributionPolicies - Pageable distributionPolicies = routerAdministrationClient.GetDistributionPolicies(); - foreach (Page asPage in distributionPolicies.AsPages(pageSizeHint: 10)) + Pageable distributionPolicies = routerAdministrationClient.GetDistributionPolicies(); + foreach (Page asPage in distributionPolicies.AsPages(pageSizeHint: 10)) { - foreach (DistributionPolicyItem? policy in asPage.Values) + foreach (DistributionPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing distribution policy with id: {policy.DistributionPolicy.Id}"); + Console.WriteLine($"Listing distribution policy with id: {policy.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOpsAsync.cs index f2f2c6ee3a993..5a41e99fa5eb5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOpsAsync.cs @@ -47,7 +47,7 @@ public async Task DistributionPolicyCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicy_Async Response updatedDistributionPolicy = await routerAdministrationClient.UpdateDistributionPolicyAsync( - new UpdateDistributionPolicyOptions(distributionPolicyId) + new DistributionPolicy(distributionPolicyId) { // you can update one or more properties of distribution policy Mode = new RoundRobinMode(), @@ -59,12 +59,12 @@ public async Task DistributionPolicyCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetDistributionPolicies_Async - AsyncPageable distributionPolicies = routerAdministrationClient.GetDistributionPoliciesAsync(); - await foreach (Page asPage in distributionPolicies.AsPages(pageSizeHint: 10)) + AsyncPageable distributionPolicies = routerAdministrationClient.GetDistributionPoliciesAsync(); + await foreach (Page asPage in distributionPolicies.AsPages(pageSizeHint: 10)) { - foreach (DistributionPolicyItem? policy in asPage.Values) + foreach (DistributionPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing distribution policy with id: {policy.DistributionPolicy.Id}"); + Console.WriteLine($"Listing distribution policy with id: {policy.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOps.cs index 1b835291daf3c..e4060e2f05b6c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOps.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -29,45 +30,43 @@ public void DistributionPolicyCrud() // then reclassifies job adding additional labels on the job // define exception trigger for queue over flow - QueueLengthExceptionTrigger queueLengthExceptionTrigger = new QueueLengthExceptionTrigger(10); + var queueLengthExceptionTrigger = new QueueLengthExceptionTrigger(10); // define exception actions that needs to be executed when trigger condition is satisfied - ReclassifyExceptionAction escalateJobOnQueueOverFlow = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-q-over-flow", - labelsToUpsert: new Dictionary() + var escalateJobOnQueueOverFlow = new ReclassifyExceptionAction + { + ClassificationPolicyId = "escalation-on-q-over-flow", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("QueueOverFlow") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("QueueOverFlow") + } + }; // define second exception trigger for wait time WaitTimeExceptionTrigger waitTimeExceptionTrigger = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(10)); // define exception actions that needs to be executed when trigger condition is satisfied - ReclassifyExceptionAction escalateJobOnWaitTimeExceeded = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-wait-time-exceeded", - labelsToUpsert: new Dictionary() + ReclassifyExceptionAction escalateJobOnWaitTimeExceeded = new() + { + ClassificationPolicyId = "escalation-on-wait-time-exceeded", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded") + } + }; // define exception rule - Dictionary exceptionRule = new Dictionary() + var exceptionRule = new List { - ["EscalateJobOnQueueOverFlowTrigger"] = new ExceptionRule( + new(id: "EscalateJobOnQueueOverFlowTrigger", trigger: queueLengthExceptionTrigger, - actions: new Dictionary() - { - ["EscalationJobActionOnQueueOverFlow"] = escalateJobOnQueueOverFlow - }), - ["EscalateJobOnWaitTimeExceededTrigger"] = new ExceptionRule( + actions: new List { escalateJobOnQueueOverFlow }), + new(id: "EscalateJobOnWaitTimeExceededTrigger", trigger: waitTimeExceptionTrigger, - actions: new Dictionary() - { - ["EscalationJobActionOnWaitTimeExceed"] = escalateJobOnWaitTimeExceeded - }) + actions: new List { escalateJobOnWaitTimeExceeded }) }; Response exceptionPolicy = routerClient.CreateExceptionPolicy( @@ -104,55 +103,49 @@ public void DistributionPolicyCrud() WaitTimeExceptionTrigger escalateJobOnWaitTimeExceed2 = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(2)); // define exception action - ReclassifyExceptionAction escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-wait-time-exceeded", - labelsToUpsert: new Dictionary() + var escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction + { + ClassificationPolicyId = "escalation-on-wait-time-exceeded", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded2Min") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded2Min") + } + }; Response updateExceptionPolicy = routerClient.UpdateExceptionPolicy( - new UpdateExceptionPolicyOptions(exceptionPolicyId) + new ExceptionPolicy(exceptionPolicyId) { // you can update one or more properties of exception policy - here we are adding one additional exception rule Name = "My updated exception policy", ExceptionRules = { // adding new rule - ["EscalateJobOnWaitTimeExceededTrigger2Min"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnWaitTimeExceededTrigger2Min", trigger: escalateJobOnWaitTimeExceed2, - actions: new Dictionary() - { - ["EscalationJobActionOnWaitTimeExceed"] = escalateJobOnWaitTimeExceeded2 - }), + actions: new List { escalateJobOnWaitTimeExceeded2 }), // modifying existing rule - ["EscalateJobOnQueueOverFlowTrigger"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnQueueOverFlowTrigger", trigger: new QueueLengthExceptionTrigger(100), - actions: new Dictionary() - { - ["EscalationJobActionOnQueueOverFlow"] = escalateJobOnQueueOverFlow - }), - // deleting existing rule - ["EscalateJobOnWaitTimeExceededTrigger"] = null + actions: new List { escalateJobOnQueueOverFlow }) } }); Console.WriteLine($"Exception policy successfully updated with id: {updateExceptionPolicy.Value.Id}"); Console.WriteLine($"Exception policy now has 2 exception rules: {updateExceptionPolicy.Value.ExceptionRules.Count}"); - Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been successfully deleted: {!updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger")}"); - Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger2Min")}"); + Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been successfully deleted: {updateExceptionPolicy.Value.ExceptionRules.All(r => r.Id != "EscalateJobOnWaitTimeExceededTrigger")}"); + Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.Any(r => r.Id == "EscalateJobOnWaitTimeExceededTrigger2Min")}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicy #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetExceptionPolicies - Pageable exceptionPolicies = routerClient.GetExceptionPolicies(); - foreach (Page asPage in exceptionPolicies.AsPages(pageSizeHint: 10)) + Pageable exceptionPolicies = routerClient.GetExceptionPolicies(); + foreach (Page asPage in exceptionPolicies.AsPages(pageSizeHint: 10)) { - foreach (ExceptionPolicyItem? policy in asPage.Values) + foreach (ExceptionPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {policy.ExceptionPolicy.Id}"); + Console.WriteLine($"Listing exception policy with id: {policy.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOpsAsync.cs index ed1004a410066..f0e3495961fff 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOpsAsync.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; @@ -30,45 +31,43 @@ public async Task DistributionPolicyCrud() // then reclassifies job adding additional labels on the job // define exception trigger for queue over flow - QueueLengthExceptionTrigger queueLengthExceptionTrigger = new QueueLengthExceptionTrigger(10); + var queueLengthExceptionTrigger = new QueueLengthExceptionTrigger(10); // define exception actions that needs to be executed when trigger condition is satisfied - ReclassifyExceptionAction escalateJobOnQueueOverFlow = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-q-over-flow", - labelsToUpsert: new Dictionary() + ReclassifyExceptionAction escalateJobOnQueueOverFlow = new ReclassifyExceptionAction + { + ClassificationPolicyId = "escalation-on-q-over-flow", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("QueueOverFlow") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("QueueOverFlow") + } + }; // define second exception trigger for wait time WaitTimeExceptionTrigger waitTimeExceptionTrigger = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(10)); // define exception actions that needs to be executed when trigger condition is satisfied - ReclassifyExceptionAction escalateJobOnWaitTimeExceeded = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-wait-time-exceeded", - labelsToUpsert: new Dictionary() + var escalateJobOnWaitTimeExceeded = new ReclassifyExceptionAction + { + ClassificationPolicyId = "escalation-on-wait-time-exceeded", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded") + } + }; // define exception rule - Dictionary exceptionRule = new Dictionary() + List exceptionRule = new() { - ["EscalateJobOnQueueOverFlowTrigger"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnQueueOverFlowTrigger", trigger: queueLengthExceptionTrigger, - actions: new Dictionary() - { - ["EscalationJobActionOnQueueOverFlow"] = escalateJobOnQueueOverFlow - }), - ["EscalateJobOnWaitTimeExceededTrigger"] = new ExceptionRule( + actions: new List { escalateJobOnQueueOverFlow }), + new ExceptionRule(id: "EscalateJobOnWaitTimeExceededTrigger", trigger: waitTimeExceptionTrigger, - actions: new Dictionary() - { - ["EscalationJobActionOnWaitTimeExceed"] = escalateJobOnWaitTimeExceeded - }) + actions: new List { escalateJobOnWaitTimeExceeded }) }; Response exceptionPolicy = await routerClient.CreateExceptionPolicyAsync( @@ -102,58 +101,52 @@ public async Task DistributionPolicyCrud() // let's define the new rule to be added // define exception trigger - WaitTimeExceptionTrigger escalateJobOnWaitTimeExceed2 = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(2)); + var escalateJobOnWaitTimeExceed2 = new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(2)); // define exception action - ReclassifyExceptionAction escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction( - classificationPolicyId: "escalation-on-wait-time-exceeded", - labelsToUpsert: new Dictionary() + var escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction + { + ClassificationPolicyId = "escalation-on-wait-time-exceeded", + LabelsToUpsert = { - ["EscalateJob"] = new LabelValue(true), - ["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded2Min") - }); + ["EscalateJob"] = new RouterValue(true), + ["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded2Min") + } + }; Response updateExceptionPolicy = await routerClient.UpdateExceptionPolicyAsync( - new UpdateExceptionPolicyOptions(exceptionPolicyId) + new ExceptionPolicy(exceptionPolicyId) { // you can update one or more properties of exception policy - here we are adding one additional exception rule Name = "My updated exception policy", ExceptionRules = { // adding new rule - ["EscalateJobOnWaitTimeExceededTrigger2Min"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnWaitTimeExceededTrigger2Min", trigger: escalateJobOnWaitTimeExceed2, - actions: new Dictionary() - { - ["EscalationJobActionOnWaitTimeExceed"] = escalateJobOnWaitTimeExceeded2 - }), + actions: new List { escalateJobOnWaitTimeExceeded2 }), // modifying existing rule - ["EscalateJobOnQueueOverFlowTrigger"] = new ExceptionRule( + new ExceptionRule(id: "EscalateJobOnQueueOverFlowTrigger", trigger: new QueueLengthExceptionTrigger(100), - actions: new Dictionary() - { - ["EscalationJobActionOnQueueOverFlow"] = escalateJobOnQueueOverFlow - }), - // deleting existing rule - ["EscalateJobOnWaitTimeExceededTrigger"] = null + actions: new List { escalateJobOnQueueOverFlow }) } }); Console.WriteLine($"Exception policy successfully updated with id: {updateExceptionPolicy.Value.Id}"); Console.WriteLine($"Exception policy now has 2 exception rules: {updateExceptionPolicy.Value.ExceptionRules.Count}"); - Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been successfully deleted: {!updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger")}"); - Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger2Min")}"); + Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been successfully deleted: {updateExceptionPolicy.Value.ExceptionRules.All(r => r.Id == "EscalateJobOnWaitTimeExceededTrigger")}"); + Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.Any(r => r.Id == "EscalateJobOnWaitTimeExceededTrigger2Min")}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicy_Async #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetExceptionPolicies_Async - AsyncPageable exceptionPolicies = routerClient.GetExceptionPoliciesAsync(); - await foreach (Page asPage in exceptionPolicies.AsPages(pageSizeHint: 10)) + AsyncPageable exceptionPolicies = routerClient.GetExceptionPoliciesAsync(); + await foreach (Page asPage in exceptionPolicies.AsPages(pageSizeHint: 10)) { - foreach (ExceptionPolicyItem? policy in asPage.Values) + foreach (ExceptionPolicy? policy in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {policy.ExceptionPolicy.Id}"); + Console.WriteLine($"Listing exception policy with id: {policy.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOps.cs index b543514af2d76..2f432c1cde7db 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOps.cs @@ -56,22 +56,21 @@ public void JobQueueCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue - Response updatedJobQueue = routerAdministrationClient.UpdateQueue( - options: new UpdateQueueOptions(jobQueueId) - { - Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") } - }); + Response updatedJobQueue = routerAdministrationClient.UpdateQueue(new RouterQueue(jobQueueId) + { + Labels = { ["Additional-Queue-Label"] = new RouterValue("ChatQueue") } + }); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueues - Pageable jobQueues = routerAdministrationClient.GetQueues(); - foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) + Pageable jobQueues = routerAdministrationClient.GetQueues(); + foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) { - foreach (RouterQueueItem? policy in asPage.Values) + foreach (RouterQueue? policy in asPage.Values) { - Console.WriteLine($"Listing job queue with id: {policy.Queue.Id}"); + Console.WriteLine($"Listing job queue with id: {policy.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOpsAsync.cs index 64c14d3af05c0..3f6d5473c3f71 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOpsAsync.cs @@ -58,21 +58,21 @@ public async Task JobQueueCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue_Async Response updatedJobQueue = await routerAdministrationClient.UpdateQueueAsync( - options: new UpdateQueueOptions(jobQueueId) + new RouterQueue(jobQueueId) { - Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") } + Labels = { ["Additional-Queue-Label"] = new RouterValue("ChatQueue") } }); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue_Async #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueues_Async - AsyncPageable jobQueues = routerAdministrationClient.GetQueuesAsync(); - await foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) + AsyncPageable jobQueues = routerAdministrationClient.GetQueuesAsync(); + await foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) { - foreach (RouterQueueItem? policy in asPage.Values) + foreach (RouterQueue? policy in asPage.Values) { - Console.WriteLine($"Listing job queue with id: {policy.Queue.Id}"); + Console.WriteLine($"Listing job queue with id: {policy.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs index 1bffb07e10078..a9de02072ea88 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs @@ -48,12 +48,12 @@ public void RouterCrudOps() Response classificationPolicy = routerAdministrationClient.CreateClassificationPolicy( new CreateClassificationPolicyOptions("classification-policy-id") { - QueueSelectors = + QueueSelectorAttachments = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, - new LabelValue(jobQueue.Value.Id))), + new RouterValue(jobQueue.Value.Id))), }, - PrioritizationRule = new StaticRouterRule(new LabelValue(10)) + PrioritizationRule = new StaticRouterRule(new RouterValue(10)) }); string jobWithCpId = "job-with-cp-id"; @@ -89,8 +89,7 @@ public void RouterCrudOps() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateRouterJob - Response updatedJob = routerClient.UpdateJob( - options: new UpdateJobOptions(jobId: jobId) + Response updatedJob = routerClient.UpdateJob(new RouterJob(jobId) { // one or more job properties can be updated ChannelReference = "45678", @@ -110,11 +109,11 @@ public void RouterCrudOps() // in order for the jobs to be router to a worker, we would need to create a worker with the appropriate queue and channel association Response worker = routerClient.CreateWorker( - options: new CreateWorkerOptions(workerId: "router-worker-id", totalCapacity: 100) + options: new CreateWorkerOptions(workerId: "router-worker-id", capacity: 100) { AvailableForOffers = true, // if a worker is not registered, no offer will be issued - ChannelConfigurations = { ["general"] = new ChannelConfiguration(100), }, - QueueAssignments = { [jobQueue.Value.Id] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 100) }, + Queues = { jobQueue.Value.Id } }); // now that we have a registered worker, we can expect offer to be sent to the worker @@ -148,7 +147,7 @@ public void RouterCrudOps() // A worker can also choose to decline an offer - Response declineOffer = routerClient.DeclineJobOffer(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); + Response declineOffer = routerClient.DeclineJobOffer(worker.Value.Id, issuedOffer.OfferId); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeclineJobOffer @@ -156,7 +155,7 @@ public void RouterCrudOps() // Once a worker completes the job, it needs to mark the job as completed - Response completedJobResult = routerClient.CompleteJob(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); + Response completedJobResult = routerClient.CompleteJob(jobId, new CompleteJobOptions(acceptedJobOffer.Value.AssignmentId)); queriedJob = routerClient.GetJob(jobId); Console.WriteLine($"Job has been successfully completed. Current status: {queriedJob.Value.Status}"); // "Completed" @@ -165,7 +164,7 @@ public void RouterCrudOps() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CloseRouterJob - Response closeJobResult = routerClient.CloseJob(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); + Response closeJobResult = routerClient.CloseJob(jobId, new CloseJobOptions(acceptedJobOffer.Value.AssignmentId)); queriedJob = routerClient.GetJob(jobId); Console.WriteLine($"Job has been successfully closed. Current status: {queriedJob.Value.Status}"); // "Closed" @@ -174,12 +173,12 @@ public void RouterCrudOps() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobs - Pageable routerJobs = routerClient.GetJobs(); - foreach (Page asPage in routerJobs.AsPages(pageSizeHint: 10)) + Pageable routerJobs = routerClient.GetJobs(); + foreach (Page asPage in routerJobs.AsPages(pageSizeHint: 10)) { - foreach (RouterJobItem? _job in asPage.Values) + foreach (RouterJob? _job in asPage.Values) { - Console.WriteLine($"Listing router job with id: {_job.Job.Id}"); + Console.WriteLine($"Listing router job with id: {_job.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs index c2c77c60c8d5c..cdb072cbbaa2d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs @@ -49,12 +49,12 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib Response classificationPolicy = await routerAdministrationClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions("classification-policy-id") { - QueueSelectors = + QueueSelectorAttachments = { new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, - new LabelValue(jobQueue.Value.Id))), + new RouterValue(jobQueue.Value.Id))), }, - PrioritizationRule = new StaticRouterRule(new LabelValue(10)) + PrioritizationRule = new StaticRouterRule(new RouterValue(10)) }); string jobWithCpId = "job-with-cp-id"; @@ -90,8 +90,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateRouterJob_Async - Response updatedJob = await routerClient.UpdateJobAsync( - options: new UpdateJobOptions(jobId: jobId) + Response updatedJob = await routerClient.UpdateJobAsync(new RouterJob(jobId) { // one or more job properties can be updated ChannelReference = "45678", @@ -111,11 +110,11 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib // in order for the jobs to be router to a worker, we would need to create a worker with the appropriate queue and channel association Response worker = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: "router-worker-id", totalCapacity: 100) + options: new CreateWorkerOptions(workerId: "router-worker-id", capacity: 100) { AvailableForOffers = true, // if a worker is not registered, no offer will be issued - ChannelConfigurations = { ["general"] = new ChannelConfiguration(100), }, - QueueAssignments = { [jobQueue.Value.Id] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 100) }, + Queues = { jobQueue.Value.Id } }); // now that we have a registered worker, we can expect offer to be sent to the worker @@ -149,7 +148,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib // A worker can also choose to decline an offer - Response declineOffer = await routerClient.DeclineJobOfferAsync(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); + Response declineOffer = await routerClient.DeclineJobOfferAsync(worker.Value.Id, issuedOffer.OfferId); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeclineJobOffer_Async @@ -157,7 +156,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib // Once a worker completes the job, it needs to mark the job as completed - Response completedJobResult = await routerClient.CompleteJobAsync(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); + Response completedJobResult = await routerClient.CompleteJobAsync(jobId, new CompleteJobOptions(acceptedJobOffer.Value.AssignmentId)); queriedJob = await routerClient.GetJobAsync(jobId); Console.WriteLine($"Job has been successfully completed. Current status: {queriedJob.Value.Status}"); // "Completed" @@ -166,7 +165,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CloseRouterJob_Async - Response closeJobResult = await routerClient.CloseJobAsync(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); + Response closeJobResult = await routerClient.CloseJobAsync(jobId, new CloseJobOptions(acceptedJobOffer.Value.AssignmentId)); queriedJob = await routerClient.GetJobAsync(jobId); Console.WriteLine($"Job has been successfully closed. Current status: {queriedJob.Value.Status}"); // "Closed" @@ -175,12 +174,12 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobs_Async - AsyncPageable routerJobs = routerClient.GetJobsAsync(); - await foreach (Page asPage in routerJobs.AsPages(pageSizeHint: 10)) + AsyncPageable routerJobs = routerClient.GetJobsAsync(); + await foreach (Page asPage in routerJobs.AsPages(pageSizeHint: 10)) { - foreach (RouterJobItem? _job in asPage.Values) + foreach (RouterJob? _job in asPage.Values) { - Console.WriteLine($"Listing router job with id: {_job.Job.Id}"); + Console.WriteLine($"Listing router job with id: {_job.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOps.cs index f91b112ce29ff..dfea204c9a015 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOps.cs @@ -22,30 +22,26 @@ public void RouterWorkerCrud() string routerWorkerId = "my-router-worker"; Response worker = routerClient.CreateWorker( - new CreateWorkerOptions(workerId: routerWorkerId, totalCapacity: 100) + new CreateWorkerOptions(workerId: routerWorkerId, capacity: 100) { - QueueAssignments = + Queues = { "worker-q-1", "worker-q-2" }, + Channels = { - ["worker-q-1"] = new RouterQueueAssignment(), - ["worker-q-2"] = new RouterQueueAssignment() - }, - ChannelConfigurations = - { - ["WebChat"] = new ChannelConfiguration(1), - ["WebChatEscalated"] = new ChannelConfiguration(20), - ["Voip"] = new ChannelConfiguration(100) + new RouterChannel("WebChat", 1), + new RouterChannel("WebChatEscalated", 20), + new RouterChannel("Voip", 100) }, Labels = { - ["Location"] = new LabelValue("NA"), - ["English"] = new LabelValue(7), - ["O365"] = new LabelValue(true), - ["Xbox_Support"] = new LabelValue(false) + ["Location"] = new RouterValue("NA"), + ["English"] = new RouterValue(7), + ["O365"] = new RouterValue(true), + ["Xbox_Support"] = new RouterValue(false) }, Tags = { - ["Name"] = new LabelValue("John Doe"), - ["Department"] = new LabelValue("IT_HelpDesk") + ["Name"] = new RouterValue("John Doe"), + ["Department"] = new RouterValue("IT_HelpDesk") } } ); @@ -59,7 +55,7 @@ public void RouterWorkerCrud() Response queriedWorker = routerClient.GetWorker(routerWorkerId); Console.WriteLine($"Successfully fetched worker with id: {queriedWorker.Value.Id}"); - Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.QueueAssignments.Values.ToList()}"); + Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.Queues}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterWorker @@ -73,27 +69,26 @@ public void RouterWorkerCrud() // 5. Increase capacityCostPerJob for channel `WebChatEscalated` to 50 Response updateWorker = routerClient.UpdateWorker( - new UpdateWorkerOptions(routerWorkerId) + new RouterWorker(routerWorkerId) { - QueueAssignments = { ["worker-q-3"] = new RouterQueueAssignment() }, - ChannelConfigurations = { ["WebChatEscalated"] = new ChannelConfiguration(50), }, + Queues = { "worker-q-3", }, + Channels = { new RouterChannel("WebChatEscalated", 50), }, Labels = { - ["O365"] = new LabelValue("Supported"), - ["Xbox_Support"] = new LabelValue(null), - ["Xbox_Support_EN"] = new LabelValue(true), + ["O365"] = new RouterValue("Supported"), + ["Xbox_Support"] = new RouterValue(null), + ["Xbox_Support_EN"] = new RouterValue(true), } }); Console.WriteLine($"Worker successfully updated with id: {updateWorker.Value.Id}"); - Console.Write($"Worker now associated with {updateWorker.Value.QueueAssignments.Count} queues"); // 3 queues + Console.Write($"Worker now associated with {updateWorker.Value.Queues.Count} queues"); // 3 queues #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateRouterWorker #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_RegisterRouterWorker - updateWorker = routerClient.UpdateWorker( - options: new UpdateWorkerOptions(workerId: routerWorkerId) { AvailableForOffers = true, }); + updateWorker = routerClient.UpdateWorker(new RouterWorker(routerWorkerId) { AvailableForOffers = true, }); Console.WriteLine($"Worker successfully registered with status set to: {updateWorker.Value.State}"); @@ -101,8 +96,7 @@ public void RouterWorkerCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeregisterRouterWorker - updateWorker = routerClient.UpdateWorker( - options: new UpdateWorkerOptions(workerId: routerWorkerId) { AvailableForOffers = false, }); + updateWorker = routerClient.UpdateWorker(new RouterWorker(routerWorkerId) { AvailableForOffers = false, }); Console.WriteLine($"Worker successfully de-registered with status set to: {updateWorker.Value.State}"); @@ -110,23 +104,23 @@ public void RouterWorkerCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterWorkers - Pageable workers = routerClient.GetWorkers(); - foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) + Pageable workers = routerClient.GetWorkers(); + foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { - foreach (RouterWorkerItem? workerPaged in asPage.Values) + foreach (RouterWorker? workerPaged in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {workerPaged.Worker.Id}"); + Console.WriteLine($"Listing exception policy with id: {workerPaged.Id}"); } } // Additionally workers can be queried with several filters like queueId, capacity, state etc. workers = routerClient.GetWorkers(channelId: "Voip", state: RouterWorkerStateSelector.All); - foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) + foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { - foreach (RouterWorkerItem? workerPaged in asPage.Values) + foreach (RouterWorker? workerPaged in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {workerPaged.Worker.Id}"); + Console.WriteLine($"Listing exception policy with id: {workerPaged.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOpsAsync.cs index cd72aa50715b6..8653889f5519f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOpsAsync.cs @@ -25,30 +25,26 @@ public async Task RouterWorkerCrud() Response worker = await routerClient.CreateWorkerAsync( new CreateWorkerOptions( workerId: routerWorkerId, - totalCapacity: 100) + capacity: 100) { - QueueAssignments = + Queues = { "worker-q-1", "worker-q-2" }, + Channels = { - ["worker-q-1"] = new RouterQueueAssignment(), - ["worker-q-2"] = new RouterQueueAssignment() - }, - ChannelConfigurations = - { - ["WebChat"] = new ChannelConfiguration(1), - ["WebChatEscalated"] = new ChannelConfiguration(20), - ["Voip"] = new ChannelConfiguration(100) + new RouterChannel("WebChat", 1), + new RouterChannel("WebChatEscalated", 20), + new RouterChannel("Voip",100) }, Labels = { - ["Location"] = new LabelValue("NA"), - ["English"] = new LabelValue(7), - ["O365"] = new LabelValue(true), - ["Xbox_Support"] = new LabelValue(false) + ["Location"] = new RouterValue("NA"), + ["English"] = new RouterValue(7), + ["O365"] = new RouterValue(true), + ["Xbox_Support"] = new RouterValue(false) }, Tags = { - ["Name"] = new LabelValue("John Doe"), - ["Department"] = new LabelValue("IT_HelpDesk") + ["Name"] = new RouterValue("John Doe"), + ["Department"] = new RouterValue("IT_HelpDesk") } } ); @@ -62,7 +58,7 @@ public async Task RouterWorkerCrud() Response queriedWorker = await routerClient.GetWorkerAsync(routerWorkerId); Console.WriteLine($"Successfully fetched worker with id: {queriedWorker.Value.Id}"); - Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.QueueAssignments.Values.ToList()}"); + Console.WriteLine($"Worker associated with queues: {queriedWorker.Value.Queues}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterWorker_Async @@ -76,27 +72,26 @@ public async Task RouterWorkerCrud() // 5. Increase capacityCostPerJob for channel `WebChatEscalated` to 50 Response updateWorker = await routerClient.UpdateWorkerAsync( - new UpdateWorkerOptions(routerWorkerId) + new RouterWorker(routerWorkerId) { - QueueAssignments = { ["worker-q-3"] = new RouterQueueAssignment() }, - ChannelConfigurations = { ["WebChatEscalated"] = new ChannelConfiguration(50), }, + Queues = { "worker-q-3", }, + Channels = { new RouterChannel("WebChatEscalated", 50), }, Labels = { - ["O365"] = new LabelValue("Supported"), - ["Xbox_Support"] = new LabelValue(null), - ["Xbox_Support_EN"] = new LabelValue(true), + ["O365"] = new RouterValue("Supported"), + ["Xbox_Support"] = new RouterValue(null), + ["Xbox_Support_EN"] = new RouterValue(true), } }); Console.WriteLine($"Worker successfully updated with id: {updateWorker.Value.Id}"); - Console.Write($"Worker now associated with {updateWorker.Value.QueueAssignments.Count} queues"); // 3 queues + Console.Write($"Worker now associated with {updateWorker.Value.Queues.Count} queues"); // 3 queues #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateRouterWorker_Async #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_RegisterRouterWorker_Async - updateWorker = await routerClient.UpdateWorkerAsync( - options: new UpdateWorkerOptions(workerId: routerWorkerId) { AvailableForOffers = true, }); + updateWorker = await routerClient.UpdateWorkerAsync(new RouterWorker(routerWorkerId) { AvailableForOffers = true, }); Console.WriteLine($"Worker successfully registered with status set to: {updateWorker.Value.State}"); @@ -104,8 +99,7 @@ public async Task RouterWorkerCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeregisterRouterWorker_Async - updateWorker = await routerClient.UpdateWorkerAsync( - options: new UpdateWorkerOptions(workerId: routerWorkerId) { AvailableForOffers = false, }); + updateWorker = await routerClient.UpdateWorkerAsync(new RouterWorker(routerWorkerId) { AvailableForOffers = false, }); Console.WriteLine($"Worker successfully de-registered with status set to: {updateWorker.Value.State}"); @@ -113,23 +107,23 @@ public async Task RouterWorkerCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterWorkers_Async - AsyncPageable workers = routerClient.GetWorkersAsync(); - await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) + AsyncPageable workers = routerClient.GetWorkersAsync(); + await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { - foreach (RouterWorkerItem? workerPaged in asPage.Values) + foreach (RouterWorker? workerPaged in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {workerPaged.Worker.Id}"); + Console.WriteLine($"Listing exception policy with id: {workerPaged.Id}"); } } // Additionally workers can be queried with several filters like queueId, capacity, state etc. workers = routerClient.GetWorkersAsync(channelId: "Voip", state: RouterWorkerStateSelector.All); - await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) + await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { - foreach (RouterWorkerItem? workerPaged in asPage.Values) + foreach (RouterWorker? workerPaged in asPage.Values) { - Console.WriteLine($"Listing exception policy with id: {workerPaged.Worker.Id}"); + Console.WriteLine($"Listing exception policy with id: {workerPaged.Id}"); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs index defda1a96f300..6fa03978a8921 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs @@ -54,7 +54,7 @@ public void BasicScenario() Priority = 1, RequestedWorkerSelectors = { - new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new LabelValue(10)) + new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new RouterValue(10)) }, }); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateJobDirectQAssign @@ -62,11 +62,11 @@ public void BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_RegisterWorker Response worker = routerClient.CreateWorker( - new CreateWorkerOptions(workerId: "worker-1", totalCapacity: 1) + new CreateWorkerOptions(workerId: "worker-1", capacity: 1) { - QueueAssignments = { [queue.Value.Id] = new RouterQueueAssignment() }, - Labels = { ["Some-Skill"] = new LabelValue(11) }, - ChannelConfigurations = { ["my-channel"] = new ChannelConfiguration(1) }, + Queues = { queue.Value.Id }, + Labels = { ["Some-Skill"] = new RouterValue(11) }, + Channels = { new RouterChannel("my-channel", 1) }, AvailableForOffers = true, } ); @@ -102,9 +102,7 @@ public void BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob Response completeJob = routerClient.CompleteJob( - options: new CompleteJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CompleteJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -116,9 +114,7 @@ public void BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob Response closeJob = routerClient.CloseJob( - options: new CloseJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -133,7 +129,7 @@ public void BasicScenario() // Optionally, a job can also be set up to be marked as closed in the future. var closeJobInFuture = routerClient.CloseJob( - options: new CloseJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs index a4d667b982d71..967f153ffc7af 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs @@ -54,7 +54,7 @@ public async Task BasicScenario() Priority = 1, RequestedWorkerSelectors = { - new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new LabelValue(10)) + new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new RouterValue(10)) } }); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateJobDirectQAssign_Async @@ -62,11 +62,11 @@ public async Task BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_RegisterWorker_Async Response worker = await routerClient.CreateWorkerAsync( - new CreateWorkerOptions(workerId: "worker-1", totalCapacity: 1) + new CreateWorkerOptions(workerId: "worker-1", capacity: 1) { - QueueAssignments = { [queue.Value.Id] = new RouterQueueAssignment() }, - Labels = { ["Some-Skill"] = new LabelValue(11) }, - ChannelConfigurations = { ["my-channel"] = new ChannelConfiguration(1) }, + Queues = { queue.Value.Id }, + Labels = { ["Some-Skill"] = new RouterValue(11) }, + Channels = { new RouterChannel("my-channel", 1) }, AvailableForOffers = true, } ); @@ -102,9 +102,7 @@ public async Task BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob_Async Response completeJob = await routerClient.CompleteJobAsync( - options: new CompleteJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CompleteJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -116,9 +114,7 @@ public async Task BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob_Async Response closeJob = await routerClient.CloseJobAsync( - options: new CloseJobOptions( - jobId: job.Value.Id, - assignmentId: acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); @@ -132,7 +128,7 @@ public async Task BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJobInFuture_Async // Optionally, a job can also be set up to be marked as closed in the future. var closeJobInFuture = await routerClient.CloseJobAsync( - options: new CloseJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId) + jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId) { CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithPriorityRuleAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithPriorityRuleAsync.cs index 6238008cae497..8220e09f56f33 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithPriorityRuleAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithPriorityRuleAsync.cs @@ -28,7 +28,7 @@ public async Task Scenario1() Response classificationPolicy = await routerAdministration.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(classificationPolicyId: classificationPolicyId) { - PrioritizationRule = new StaticRouterRule(new LabelValue(10)) + PrioritizationRule = new StaticRouterRule(new RouterValue(10)) }); Console.WriteLine($"Classification policy successfully created with id: {classificationPolicy.Value.Id} and priority rule of type: {classificationPolicy.Value.PrioritizationRule.Kind}"); @@ -141,7 +141,7 @@ public async Task Scenario2() QueueId = jobQueueId, Labels = { - ["Escalated"] = new LabelValue(false) + ["Escalated"] = new RouterValue(false) } }); @@ -156,7 +156,7 @@ public async Task Scenario2() QueueId = jobQueueId, Labels = { - ["Escalated"] = new LabelValue(true) + ["Escalated"] = new RouterValue(true) } }); @@ -245,7 +245,7 @@ public async Task Scenario3() QueueId = jobQueueId, Labels = { - ["Escalated"] = new LabelValue(false) + ["Escalated"] = new RouterValue(false) } }); @@ -260,7 +260,7 @@ public async Task Scenario3() QueueId = jobQueueId, Labels = { - ["Escalated"] = new LabelValue(true) + ["Escalated"] = new RouterValue(true) } }); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithQueueSelectorAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithQueueSelectorAsync.cs index c7529a60eb5eb..076a875ea3653 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithQueueSelectorAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithQueueSelectorAsync.cs @@ -20,7 +20,7 @@ public async Task QueueSelection_ById() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_QueueSelectionById // In this scenario we are going to use a classification policy while submitting a job. - // We are going to utilize the 'QueueSelectors' attribute on the classification policy to determine + // We are going to utilize the 'QueueSelectorAttachments' attribute on the classification policy to determine // which queue a job should be enqueued in. For this scenario, we are going to demonstrate // StaticLabelSelector to select a queue directly by its unique ID through the classification policy // Steps @@ -55,9 +55,9 @@ public async Task QueueSelection_ById() new CreateClassificationPolicyOptions(classificationPolicyId: "classification-policy-o365") { Name = "Classification_Policy_O365", - QueueSelectors = + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(queue1.Value.Id))) + new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(queue1.Value.Id))) }, }); @@ -65,9 +65,9 @@ public async Task QueueSelection_ById() new CreateClassificationPolicyOptions(classificationPolicyId: "classification-policy-xbox") { Name = "Classification_Policy_XBox", - QueueSelectors = + QueueSelectorAttachments = { - new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(queue2.Value.Id))) + new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(queue2.Value.Id))) } }); @@ -121,7 +121,7 @@ public async Task QueueSelection_ByCondition() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_QueueSelectionByConditionalLabelAttachments // In this scenario we are going to use a classification policy while submitting a job. - // We are going to utilize the 'QueueSelectors' attribute on the classification policy to determine + // We are going to utilize the 'QueueSelectorAttachments' attribute on the classification policy to determine // which queue a job should be enqueued in. For this scenario, we are going to demonstrate // ConditionalLabelSelector to select a queue based on labels associated with a queue // Steps @@ -157,7 +157,7 @@ public async Task QueueSelection_ByCondition() Name = "Queue_365", Labels = { - ["ProductDetail"] = new LabelValue("Office_Support") + ["ProductDetail"] = new RouterValue("Office_Support") } }); @@ -169,7 +169,7 @@ public async Task QueueSelection_ByCondition() Name = "Queue_XBox", Labels = { - ["ProductDetail"] = new LabelValue("XBox_Support") + ["ProductDetail"] = new RouterValue("XBox_Support") } }); @@ -177,18 +177,18 @@ public async Task QueueSelection_ByCondition() new CreateClassificationPolicyOptions(classificationPolicyId: "classification-policy") { Name = "Classification_Policy_O365_And_XBox", - QueueSelectors = { + QueueSelectorAttachments = { new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("ProductDetail", LabelOperator.Equal, new LabelValue("Office_Support")) + new RouterQueueSelector("ProductDetail", LabelOperator.Equal, new RouterValue("Office_Support")) }), new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"XBx\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("ProductDetail", LabelOperator.Equal, new LabelValue("XBox_Support")) + new RouterQueueSelector("ProductDetail", LabelOperator.Equal, new RouterValue("XBox_Support")) }) } }); @@ -202,9 +202,9 @@ public async Task QueueSelection_ByCondition() ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("en"), - ["Product"] = new LabelValue("O365"), - ["Geo"] = new LabelValue("North America"), + ["Language"] = new RouterValue("en"), + ["Product"] = new RouterValue("O365"), + ["Geo"] = new RouterValue("North America"), }, }); @@ -217,9 +217,9 @@ public async Task QueueSelection_ByCondition() ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("en"), - ["Product"] = new LabelValue("XBx"), - ["Geo"] = new LabelValue("North America"), + ["Language"] = new RouterValue("en"), + ["Product"] = new RouterValue("XBx"), + ["Geo"] = new RouterValue("North America"), }, }); @@ -255,7 +255,7 @@ public async Task QueueSelection_ByPassThroughValues() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_QueueSelectionByPassThroughLabelAttachments // cSpell:ignore EMEA, Emea // In this scenario we are going to use a classification policy while submitting a job. - // We are going to utilize the 'QueueSelectors' attribute on the classification policy to determine + // We are going to utilize the 'QueueSelectorAttachments' attribute on the classification policy to determine // which queue a job should be enqueued in. For this scenario, we are going to demonstrate // PassThroughLabelSelector to select a queue based on labels associated with a queue and the incoming job // Steps @@ -293,9 +293,9 @@ public async Task QueueSelection_ByPassThroughValues() Name = "Queue_365_EN_EMEA", Labels = { - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Language"] = new LabelValue("en"), - ["Region"] = new LabelValue("EMEA"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Language"] = new RouterValue("en"), + ["Region"] = new RouterValue("EMEA"), }, }); @@ -307,9 +307,9 @@ public async Task QueueSelection_ByPassThroughValues() Name = "Queue_365_FR_EMEA", Labels = { - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Language"] = new LabelValue("fr"), - ["Region"] = new LabelValue("EMEA"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Language"] = new RouterValue("fr"), + ["Region"] = new RouterValue("EMEA"), }, }); @@ -321,9 +321,9 @@ public async Task QueueSelection_ByPassThroughValues() Name = "Queue_365_EN_NA", Labels = { - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Language"] = new LabelValue("en"), - ["Region"] = new LabelValue("NA"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Language"] = new RouterValue("en"), + ["Region"] = new RouterValue("NA"), }, }); @@ -331,7 +331,7 @@ public async Task QueueSelection_ByPassThroughValues() new CreateClassificationPolicyOptions(classificationPolicyId: "classification-policy") { Name = "Classification_Policy_O365_EMEA_NA", - QueueSelectors = { + QueueSelectorAttachments = { new PassThroughQueueSelectorAttachment("ProductDetail", LabelOperator.Equal), new PassThroughQueueSelectorAttachment("Language", LabelOperator.Equal), new PassThroughQueueSelectorAttachment("Region", LabelOperator.Equal), @@ -347,11 +347,11 @@ public async Task QueueSelection_ByPassThroughValues() ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("en"), - ["Product"] = new LabelValue("O365"), - ["Geo"] = new LabelValue("Europe, Middle East, Africa"), - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Region"] = new LabelValue("EMEA"), + ["Language"] = new RouterValue("en"), + ["Product"] = new RouterValue("O365"), + ["Geo"] = new RouterValue("Europe, Middle East, Africa"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Region"] = new RouterValue("EMEA"), }, }); @@ -364,11 +364,11 @@ public async Task QueueSelection_ByPassThroughValues() ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("fr"), - ["Product"] = new LabelValue("O365"), - ["Geo"] = new LabelValue("Europe, Middle East, Africa"), - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Region"] = new LabelValue("EMEA"), + ["Language"] = new RouterValue("fr"), + ["Product"] = new RouterValue("O365"), + ["Geo"] = new RouterValue("Europe, Middle East, Africa"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Region"] = new RouterValue("EMEA"), }, }); @@ -381,11 +381,11 @@ public async Task QueueSelection_ByPassThroughValues() ChannelReference = "12345", Labels = { - ["Language"] = new LabelValue("en"), - ["Product"] = new LabelValue("O365"), - ["Geo"] = new LabelValue("North America"), - ["ProductDetail"] = new LabelValue("Office_Support"), - ["Region"] = new LabelValue("NA"), + ["Language"] = new RouterValue("en"), + ["Product"] = new RouterValue("O365"), + ["Geo"] = new RouterValue("North America"), + ["ProductDetail"] = new RouterValue("Office_Support"), + ["Region"] = new RouterValue("NA"), }, }); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithWorkerSelectorAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithWorkerSelectorAsync.cs index 51ba594a05244..98e1fcf6f7e80 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithWorkerSelectorAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithWorkerSelectorAsync.cs @@ -21,7 +21,7 @@ public async Task WorkerSelection_StaticSelectors() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_StaticWorkerSelectors // In this scenario we are going to use a classification policy while submitting a job. - // We are going to utilize the 'WorkerSelectors' attribute on the classification policy to attach + // We are going to utilize the 'WorkerSelectorAttachments' attribute on the classification policy to attach // custom worker selectors to the job. For this scenario, we are going to demonstrate // StaticWorkerSelector to filter workers on static values. // We would like to filter workers on the following criteria:- @@ -37,7 +37,7 @@ public async Task WorkerSelection_StaticSelectors() // 1. Incoming job will have the aforementioned worker selectors attached to it. // 2. Offer will be sent only to the worker who satisfies all three criteria // - // NOTE: All jobs with referencing the classification policy will have the WorkerSelectors attached to them + // NOTE: All jobs with referencing the classification policy will have the WorkerSelectorAttachments attached to them // Set up queue string distributionPolicyId = "distribution-policy-id-2"; @@ -64,11 +64,11 @@ public async Task WorkerSelection_StaticSelectors() new CreateClassificationPolicyOptions(classificationPolicyId: cpId) { Name = "Classification_Policy_O365", - WorkerSelectors = + WorkerSelectorAttachments = { - new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Location", LabelOperator.Equal, new LabelValue("United States"))), - new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Language", LabelOperator.Equal, new LabelValue("en-us"))), - new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Geo", LabelOperator.Equal, new LabelValue("NA"))) + new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Location", LabelOperator.Equal, new RouterValue("United States"))), + new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Language", LabelOperator.Equal, new RouterValue("en-us"))), + new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Geo", LabelOperator.Equal, new RouterValue("NA"))) } }); @@ -77,8 +77,8 @@ public async Task WorkerSelection_StaticSelectors() new CreateJobWithClassificationPolicyOptions(jobId: "jobO365", channelId: "general", classificationPolicyId: cp1.Value.Id) { ChannelReference = "12345", - QueueId = queueId, // We only want to attach WorkerSelectors with classification policy this time, so we will specify queueId - Priority = 10, // We only want to attach WorkerSelectors with classification policy this time, so we will specify priority + QueueId = queueId, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify queueId + Priority = 10, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify priority }); #if !SNIPPET @@ -101,29 +101,29 @@ public async Task WorkerSelection_StaticSelectors() string workerId1 = "worker-id-1"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId1, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId1, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel("general", 10), }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Geo"] = new LabelValue("NA"), - ["Skill_English_Lvl"] = new LabelValue(7), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Geo"] = new RouterValue("NA"), + ["Skill_English_Lvl"] = new RouterValue(7), }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); string workerId2 = "worker-id-2"; Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId2, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId2, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - Labels = { ["Skill_English_Lvl"] = new LabelValue(7) }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Channels = { new RouterChannel("general", 10), }, + Labels = { ["Skill_English_Lvl"] = new RouterValue(7) }, // attaching labels associated with worker + Queues = { queueId } }); #if !SNIPPET @@ -158,7 +158,7 @@ public async Task WorkerSelection_ByCondition() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_CondtitionalWorkerSelectors // In this scenario we are going to use a classification policy while submitting a job. - // We are going to utilize the 'WorkerSelectors' attribute on the classification policy to attach + // We are going to utilize the 'WorkerSelectorAttachments' attribute on the classification policy to attach // custom worker selectors to the job. For this scenario, we are going to demonstrate // ConditionalWorkerSelector to filter workers based on a condition. // We would like to filter workers on the following criteria:- @@ -207,23 +207,23 @@ public async Task WorkerSelection_ByCondition() new CreateClassificationPolicyOptions(classificationPolicyId: cpId) { Name = "Classification_Policy_O365", - WorkerSelectors = + WorkerSelectorAttachments = { new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.Location = \"United States\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Language", LabelOperator.Equal, new LabelValue("en-us")), - new RouterWorkerSelector("Geo", LabelOperator.Equal, new LabelValue("NA")), - new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(5)) + new RouterWorkerSelector("Language", LabelOperator.Equal, new RouterValue("en-us")), + new RouterWorkerSelector("Geo", LabelOperator.Equal, new RouterValue("NA")), + new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(5)) }), new ConditionalWorkerSelectorAttachment( condition: new ExpressionRouterRule("If(job.Location = \"Canada\", true, false)"), workerSelectors: new List() { - new RouterWorkerSelector("Language", LabelOperator.Equal, new LabelValue("en-ca")), - new RouterWorkerSelector("Geo", LabelOperator.Equal, new LabelValue("NA")), - new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(5)) + new RouterWorkerSelector("Language", LabelOperator.Equal, new RouterValue("en-ca")), + new RouterWorkerSelector("Geo", LabelOperator.Equal, new RouterValue("NA")), + new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(5)) }), } }); @@ -233,11 +233,11 @@ public async Task WorkerSelection_ByCondition() new CreateJobWithClassificationPolicyOptions(jobId: "jobO365", channelId: "general", classificationPolicyId: cp1.Value.Id) { ChannelReference = "12345", - QueueId = queueId, // We only want to attach WorkerSelectors with classification policy this time, so we will specify queueId - Priority = 10, // We only want to attach WorkerSelectors with classification policy this time, so we will specify priority + QueueId = queueId, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify queueId + Priority = 10, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify priority Labels = // we will attach a label to the job which will affects its classification { - ["Location"] = new LabelValue("United States"), + ["Location"] = new RouterValue("United States"), } }); @@ -261,32 +261,32 @@ public async Task WorkerSelection_ByCondition() // Set up two workers string workerId1 = "worker-id-1"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId1, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId1, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel("general", 10), }, Labels = { - ["Language"] = new LabelValue("en-us"), - ["Geo"] = new LabelValue("NA"), - ["Skill_English_Lvl"] = new LabelValue(7) + ["Language"] = new RouterValue("en-us"), + ["Geo"] = new RouterValue("NA"), + ["Skill_English_Lvl"] = new RouterValue(7) }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); string workerId2 = "worker-id-2"; Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId2, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId2, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10) }, + Channels = { new RouterChannel("general", 10) }, Labels = { - ["Language"] = new LabelValue("en-ca"), - ["Geo"] = new LabelValue("NA"), - ["Skill_English_Lvl"] = new LabelValue(7) + ["Language"] = new RouterValue("en-ca"), + ["Geo"] = new RouterValue("NA"), + ["Skill_English_Lvl"] = new RouterValue(7) }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); #if !SNIPPET @@ -321,7 +321,7 @@ public async Task WorkerSelection_ByPassThroughValues() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Classification_PassThroughWorkerSelectors // cSpell:ignore XBOX, Xbox // In this scenario we are going to use a classification policy while submitting a job. - // We are going to utilize the 'WorkerSelectors' attribute on the classification policy to attach + // We are going to utilize the 'WorkerSelectorAttachments' attribute on the classification policy to attach // custom worker selectors to the job. For this scenario, we are going to demonstrate // PassThroughWorkerSelectors to filter workers based on a conditions already attached to job. // We would like to filter workers on the following criteria already attached to job:- @@ -364,13 +364,13 @@ public async Task WorkerSelection_ByPassThroughValues() new CreateClassificationPolicyOptions(classificationPolicyId: cpId) { Name = "Classification_Policy_O365_XBOX", - WorkerSelectors = + WorkerSelectorAttachments = { new PassThroughWorkerSelectorAttachment("Location", LabelOperator.Equal), new PassThroughWorkerSelectorAttachment("Geo", LabelOperator.Equal), new PassThroughWorkerSelectorAttachment("Language", LabelOperator.Equal), new PassThroughWorkerSelectorAttachment("Dept", LabelOperator.Equal), - new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(5))), + new StaticWorkerSelectorAttachment(new RouterWorkerSelector("Skill_English_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(5))), } }); @@ -379,14 +379,14 @@ public async Task WorkerSelection_ByPassThroughValues() new CreateJobWithClassificationPolicyOptions(jobId: "jobO365", channelId: "general", classificationPolicyId: cp1.Value.Id) { ChannelReference = "12345", - QueueId = queueId, // We only want to attach WorkerSelectors with classification policy this time, so we will specify queueId - Priority = 10, // We only want to attach WorkerSelectors with classification policy this time, so we will specify priority + QueueId = queueId, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify queueId + Priority = 10, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify priority Labels = // we will attach a label to the job which will affects its classification { - ["Location"] = new LabelValue("United States"), - ["Geo"] = new LabelValue("NA"), - ["Language"] = new LabelValue("en-us"), - ["Dept"] = new LabelValue("O365") + ["Location"] = new RouterValue("United States"), + ["Geo"] = new RouterValue("NA"), + ["Language"] = new RouterValue("en-us"), + ["Dept"] = new RouterValue("O365") } }); @@ -394,14 +394,14 @@ public async Task WorkerSelection_ByPassThroughValues() new CreateJobWithClassificationPolicyOptions(jobId: "jobXbox", channelId: "general", classificationPolicyId: cp1.Value.Id) { ChannelReference = "12345", - QueueId = queueId, // We only want to attach WorkerSelectors with classification policy this time, so we will specify queueId - Priority = 10, // We only want to attach WorkerSelectors with classification policy this time, so we will specify priority + QueueId = queueId, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify queueId + Priority = 10, // We only want to attach WorkerSelectorAttachments with classification policy this time, so we will specify priority Labels = // we will attach a label to the job which will affects its classification { - ["Location"] = new LabelValue("United States"), - ["Geo"] = new LabelValue("NA"), - ["Language"] = new LabelValue("en-us"), - ["Dept"] = new LabelValue("Xbox") + ["Location"] = new RouterValue("United States"), + ["Geo"] = new RouterValue("NA"), + ["Language"] = new RouterValue("en-us"), + ["Dept"] = new RouterValue("Xbox") } }); @@ -431,37 +431,37 @@ public async Task WorkerSelection_ByPassThroughValues() // Set up two workers string workerId1 = "worker-id-1"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId1, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId1, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel("general", 10), }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Geo"] = new LabelValue("NA"), - ["Language"] = new LabelValue("en-us"), - ["Dept"] = new LabelValue("O365"), - ["Skill_English_Lvl"] = new LabelValue(10), + ["Location"] = new RouterValue("United States"), + ["Geo"] = new RouterValue("NA"), + ["Language"] = new RouterValue("en-us"), + ["Dept"] = new RouterValue("O365"), + ["Skill_English_Lvl"] = new RouterValue(10), }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); string workerId2 = "worker-id-2"; Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId2, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId2, capacity: 100) { AvailableForOffers = true, // registering worker at the time of creation - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel("general", 10), }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Geo"] = new LabelValue("NA"), - ["Language"] = new LabelValue("en-us"), - ["Dept"] = new LabelValue("Xbox"), - ["Skill_English_Lvl"] = new LabelValue(10), + ["Location"] = new RouterValue("United States"), + ["Geo"] = new RouterValue("NA"), + ["Language"] = new RouterValue("en-us"), + ["Dept"] = new RouterValue("Xbox"), + ["Skill_English_Lvl"] = new RouterValue(10), }, // attaching labels associated with worker - QueueAssignments = { [queueId] = new RouterQueueAssignment() } + Queues = { queueId } }); #if !SNIPPET diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_AdvancedDistributionAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_AdvancedDistributionAsync.cs index bdf24e98ffd56..53489bf751031 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_AdvancedDistributionAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_AdvancedDistributionAsync.cs @@ -25,11 +25,14 @@ public async Task BestWorkerDistribution_Advanced_ExpressionRouterRule() // Create distribution policy string distributionPolicyId = "best-worker-dp-2"; - Response distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync( + var distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync( new CreateDistributionPolicyOptions( distributionPolicyId: distributionPolicyId, offerExpiresAfter: TimeSpan.FromMinutes(5), - mode: new BestWorkerMode(scoringRule: new ExpressionRouterRule("If(worker.HandleEscalation = true, 100, 1)")))); + mode: new BestWorkerMode + { + ScoringRule = new ExpressionRouterRule("If(worker.HandleEscalation = true, 100, 1)") + })); // Create job queue string jobQueueId = "job-queue-id-2"; @@ -44,26 +47,26 @@ public async Task BestWorkerDistribution_Advanced_ExpressionRouterRule() string worker2Id = "worker-Id-2"; // Worker 1 can handle escalation - Dictionary worker1Labels = new Dictionary() + Dictionary worker1Labels = new Dictionary() ; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { AvailableForOffers = true, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, - Labels = { ["HandleEscalation"] = new LabelValue(true), ["IT_Support"] = new LabelValue(true) }, - QueueAssignments = { [jobQueueId] = new RouterQueueAssignment(), } + Channels = { new RouterChannel(channelId, 10), }, + Labels = { ["HandleEscalation"] = new RouterValue(true), ["IT_Support"] = new RouterValue(true) }, + Queues = { jobQueueId } }); // Worker 2 cannot handle escalation Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { AvailableForOffers = true, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, - Labels = { ["IT_Support"] = new LabelValue(true), }, - QueueAssignments = { [jobQueueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel(channelId, 10), }, + Labels = { ["IT_Support"] = new RouterValue(true), }, + Queues = { jobQueueId }, }); // Create job @@ -71,7 +74,7 @@ public async Task BestWorkerDistribution_Advanced_ExpressionRouterRule() Response job = await routerClient.CreateJobAsync( options: new CreateJobOptions(jobId: jobId, channelId: channelId, queueId: jobQueueId) { - RequestedWorkerSelectors = { new RouterWorkerSelector("IT_Support", LabelOperator.Equal, new LabelValue(true))}, + RequestedWorkerSelectors = { new RouterWorkerSelector("IT_Support", LabelOperator.Equal, new RouterValue(true))}, Priority = 100, }); @@ -106,11 +109,14 @@ public async Task BestWorkerDistribution_Advanced_AzureFunctionRouterRule() // Create distribution policy string distributionPolicyId = "best-worker-dp-1"; - Response distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync( + var distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync( new CreateDistributionPolicyOptions( distributionPolicyId: distributionPolicyId, offerExpiresAfter: TimeSpan.FromMinutes(5), - mode: new BestWorkerMode(scoringRule: new FunctionRouterRule(new Uri(""))))); + mode: new BestWorkerMode + { + ScoringRule = new FunctionRouterRule(new Uri("")) + })); // Create job queue string queueId = "job-queue-id-1"; @@ -124,60 +130,60 @@ public async Task BestWorkerDistribution_Advanced_AzureFunctionRouterRule() string workerId1 = "worker-Id-1"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId1, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId1, capacity: 100) { - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Queues = { queueId }, Labels = { - ["HighPrioritySupport"] = new LabelValue(true), - ["HardwareSupport"] = new LabelValue(true), - ["Support_XBOX_SERIES_X"] = new LabelValue(true), - ["English"] = new LabelValue(10), - ["ChatSupport"] = new LabelValue(true), - ["XboxSupport"] = new LabelValue(true) + ["HighPrioritySupport"] = new RouterValue(true), + ["HardwareSupport"] = new RouterValue(true), + ["Support_XBOX_SERIES_X"] = new RouterValue(true), + ["English"] = new RouterValue(10), + ["ChatSupport"] = new RouterValue(true), + ["XboxSupport"] = new RouterValue(true) }, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel(channelId, 10), }, AvailableForOffers = true, }); string workerId2 = "worker-Id-2"; Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId2, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId2, capacity: 100) { - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Queues = { queueId }, Labels = { - ["HighPrioritySupport"] = new LabelValue(true), - ["HardwareSupport"] = new LabelValue(true), - ["Support_XBOX_SERIES_X"] = new LabelValue(true), - ["Support_XBOX_SERIES_S"] = new LabelValue(true), - ["English"] = new LabelValue(8), - ["ChatSupport"] = new LabelValue(true), - ["XboxSupport"] = new LabelValue(true) + ["HighPrioritySupport"] = new RouterValue(true), + ["HardwareSupport"] = new RouterValue(true), + ["Support_XBOX_SERIES_X"] = new RouterValue(true), + ["Support_XBOX_SERIES_S"] = new RouterValue(true), + ["English"] = new RouterValue(8), + ["ChatSupport"] = new RouterValue(true), + ["XboxSupport"] = new RouterValue(true) }, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel(channelId, 10), }, AvailableForOffers = true, }); string workerId3 = "worker-Id-3"; - Dictionary worker3Labels = new Dictionary() + Dictionary worker3Labels = new Dictionary() ; Response worker3 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: workerId3, totalCapacity: 100) + options: new CreateWorkerOptions(workerId: workerId3, capacity: 100) { - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Queues = { queueId }, Labels = { - ["HighPrioritySupport"] = new LabelValue(false), - ["HardwareSupport"] = new LabelValue(true), - ["Support_XBOX"] = new LabelValue(true), - ["English"] = new LabelValue(7), - ["ChatSupport"] = new LabelValue(true), - ["XboxSupport"] = new LabelValue(true), + ["HighPrioritySupport"] = new RouterValue(false), + ["HardwareSupport"] = new RouterValue(true), + ["Support_XBOX"] = new RouterValue(true), + ["English"] = new RouterValue(7), + ["ChatSupport"] = new RouterValue(true), + ["XboxSupport"] = new RouterValue(true), }, - ChannelConfigurations = { [channelId] = new ChannelConfiguration(10), }, + Channels = { new RouterChannel(channelId, 10), }, AvailableForOffers = true, }); @@ -190,18 +196,18 @@ public async Task BestWorkerDistribution_Advanced_AzureFunctionRouterRule() queueId: queueId) { Labels = { - ["CommunicationType"] = new LabelValue("Chat"), - ["IssueType"] = new LabelValue("XboxSupport"), - ["Language"] = new LabelValue("en"), - ["HighPriority"] = new LabelValue(true), - ["SubIssueType"] = new LabelValue("ConsoleMalfunction"), - ["ConsoleType"] = new LabelValue("XBOX_SERIES_X"), - ["Model"] = new LabelValue("XBOX_SERIES_X_1TB") + ["CommunicationType"] = new RouterValue("Chat"), + ["IssueType"] = new RouterValue("XboxSupport"), + ["Language"] = new RouterValue("en"), + ["HighPriority"] = new RouterValue(true), + ["SubIssueType"] = new RouterValue("ConsoleMalfunction"), + ["ConsoleType"] = new RouterValue("XBOX_SERIES_X"), + ["Model"] = new RouterValue("XBOX_SERIES_X_1TB") }, RequestedWorkerSelectors = { - new RouterWorkerSelector("English", LabelOperator.GreaterThanEqual, new LabelValue(7)), - new RouterWorkerSelector("ChatSupport", LabelOperator.Equal, new LabelValue(true)), - new RouterWorkerSelector("XboxSupport", LabelOperator.Equal, new LabelValue(true)) + new RouterWorkerSelector("English", LabelOperator.GreaterThanOrEqual, new RouterValue(7)), + new RouterWorkerSelector("ChatSupport", LabelOperator.Equal, new RouterValue(true)), + new RouterWorkerSelector("XboxSupport", LabelOperator.Equal, new RouterValue(true)) }, Priority = 100, }); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_SimpleDistributionAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_SimpleDistributionAsync.cs index bca5834e83548..21b82780ba2b2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_SimpleDistributionAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_SimpleDistributionAsync.cs @@ -47,27 +47,27 @@ public async Task SimpleDistribution_LongestIdle() string worker2Id = "worker-id-2"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId }, }); Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId }, }); // Register worker1 - worker1 = await routerClient.UpdateWorkerAsync(new UpdateWorkerOptions(worker1Id) { AvailableForOffers = true }); + worker1 = await routerClient.UpdateWorkerAsync(new RouterWorker(worker1Id) { AvailableForOffers = true }); // wait for 5 seconds to simulate worker 1 has been idle longer await Task.Delay(TimeSpan.FromSeconds(5)); // Register worker2 - worker2 = await routerClient.UpdateWorkerAsync(new UpdateWorkerOptions(worker2Id) { AvailableForOffers = true }); + worker2 = await routerClient.UpdateWorkerAsync(new RouterWorker(worker2Id) { AvailableForOffers = true }); // Create a job string jobId = "job-id-1"; @@ -132,18 +132,18 @@ public async Task SimpleDistribution_RoundRobin() string worker2Id = "worker-id-2"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(5), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 5), }, + Queues = { queueId }, AvailableForOffers = true }); Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(5), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general",5), }, + Queues = { queueId }, AvailableForOffers = true, // register worker upon creation }); @@ -227,50 +227,50 @@ public async Task SimpleDistribution_DefaultBestWorker() string worker3Id = "worker-id-3"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general",10), }, + Queues = { queueId }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Region"] = new LabelValue("NA"), - ["Hardware_Support"] = new LabelValue(true), - ["Hardware_Support_SurfaceLaptop"] = new LabelValue(true), - ["Language_Skill_Level_EN_US"] = new LabelValue(10), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Region"] = new RouterValue("NA"), + ["Hardware_Support"] = new RouterValue(true), + ["Hardware_Support_SurfaceLaptop"] = new RouterValue(true), + ["Language_Skill_Level_EN_US"] = new RouterValue(10), } }); Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general",10), }, + Queues = { queueId }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Region"] = new LabelValue("NA"), - ["Hardware_Support"] = new LabelValue(true), - ["Hardware_Support_SurfaceLaptop"] = new LabelValue(true), - ["Language_Skill_Level_EN_US"] = new LabelValue(20), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Region"] = new RouterValue("NA"), + ["Hardware_Support"] = new RouterValue(true), + ["Hardware_Support_SurfaceLaptop"] = new RouterValue(true), + ["Language_Skill_Level_EN_US"] = new RouterValue(20), } }); Response worker3 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker3Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker3Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId }, Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Region"] = new LabelValue("NA"), - ["Hardware_Support"] = new LabelValue(true), - ["Hardware_Support_SurfaceLaptop"] = new LabelValue(false), - ["Language_Skill_Level_EN_US"] = new LabelValue(1), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Region"] = new RouterValue("NA"), + ["Hardware_Support"] = new RouterValue(true), + ["Hardware_Support_SurfaceLaptop"] = new RouterValue(false), + ["Language_Skill_Level_EN_US"] = new RouterValue(1), } }); @@ -280,15 +280,15 @@ public async Task SimpleDistribution_DefaultBestWorker() { Labels = { - ["Location"] = new LabelValue("United States"), - ["Language"] = new LabelValue("en-us"), - ["Region"] = new LabelValue("NA"), - ["Hardware_Support"] = new LabelValue(true), - ["Hardware_Support_SurfaceLaptop"] = new LabelValue(true), + ["Location"] = new RouterValue("United States"), + ["Language"] = new RouterValue("en-us"), + ["Region"] = new RouterValue("NA"), + ["Hardware_Support"] = new RouterValue(true), + ["Hardware_Support_SurfaceLaptop"] = new RouterValue(true), }, RequestedWorkerSelectors = { - new RouterWorkerSelector("Language_Skill_Level_EN_US", LabelOperator.GreaterThanEqual, new LabelValue(0)), + new RouterWorkerSelector("Language_Skill_Level_EN_US", LabelOperator.GreaterThanOrEqual, new RouterValue(0)), } }); @@ -358,18 +358,18 @@ await routerAdministrationClient.CreateDistributionPolicyAsync( string worker2Id = "worker-id-2"; Response worker1 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker1Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker1Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId, }, AvailableForOffers = true, }); Response worker2 = await routerClient.CreateWorkerAsync( - options: new CreateWorkerOptions(workerId: worker2Id, totalCapacity: 10) + options: new CreateWorkerOptions(workerId: worker2Id, capacity: 10) { - ChannelConfigurations = { ["general"] = new ChannelConfiguration(10), }, - QueueAssignments = { [queueId] = new RouterQueueAssignment(), }, + Channels = { new RouterChannel("general", 10), }, + Queues = { queueId, }, AvailableForOffers = true, }); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_QueueLengthExceptionTriggerAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_QueueLengthExceptionTriggerAsync.cs index 3116545f2dbc5..955b252ab8b4e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_QueueLengthExceptionTriggerAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_QueueLengthExceptionTriggerAsync.cs @@ -61,20 +61,17 @@ public async Task QueueLengthTriggerException_SampleScenario() Priority = 10, WorkerSelectors = { - new RouterWorkerSelector("ExceptionTriggered", LabelOperator.Equal, new LabelValue(true)) + new RouterWorkerSelector("ExceptionTriggered", LabelOperator.Equal, new RouterValue(true)) } }; Response exceptionPolicy = await routerAdministrationClient.CreateExceptionPolicyAsync(new CreateExceptionPolicyOptions( exceptionPolicyId: exceptionPolicyId, - exceptionRules: new Dictionary() + exceptionRules: new List() { - ["QueueLengthExceptionTrigger"] = new ExceptionRule( + new ExceptionRule(id: "QueueLengthExceptionTrigger", trigger: trigger, - actions: new Dictionary() - { - ["ManualReclassifyExceptionAction"] = action, - }) + actions: new List { action }) })); // create primary queue diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_WaitTimeExceptionAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_WaitTimeExceptionAsync.cs index 639885bb185fe..df5c8b3bf8fff 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_WaitTimeExceptionAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_WaitTimeExceptionAsync.cs @@ -53,20 +53,17 @@ public async Task WaitTimeTriggerException_SampleScenario() { QueueId = fallbackQueueId, Priority = 100, - WorkerSelectors = { new RouterWorkerSelector("HandleEscalation", LabelOperator.Equal, new LabelValue(true)) } + WorkerSelectors = { new RouterWorkerSelector("HandleEscalation", LabelOperator.Equal, new RouterValue(true)) } }; string exceptionPolicyId = "execption-policy-id"; Response exceptionPolicy = await routerAdministrationClient.CreateExceptionPolicyAsync(new CreateExceptionPolicyOptions( exceptionPolicyId: exceptionPolicyId, - exceptionRules: new Dictionary() + exceptionRules: new List() { - ["WaitTimeTriggerExceptionRule"] = new ExceptionRule( + new ExceptionRule(id: "WaitTimeTriggerExceptionRule", trigger: trigger, - actions: new Dictionary() - { - ["EscalateJobToFallbackQueueAction"] = action, - }) + actions: new List { action }) })); // Create initial queue diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs index f3fb41e65ec0d..5e7a6b6ff1395 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading.Tasks; using Azure.Communication.JobRouter.Tests.Infrastructure; +using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.Scenarios @@ -41,13 +42,13 @@ public async Task Scenario() var workerId1 = GenerateUniqueId($"{IdPrefix}-w1"); var registerWorker = await client.CreateWorkerAsync( - new CreateWorkerOptions(workerId: workerId1, totalCapacity: 1) + new CreateWorkerOptions(workerId: workerId1, capacity: 1) { - QueueAssignments = { [queueResponse.Value.Id] = new RouterQueueAssignment() }, - ChannelConfigurations = { [channelResponse] = new ChannelConfiguration(1) }, + Queues = { queueResponse.Value.Id, }, + Channels = { new RouterChannel(channelResponse, 1) }, AvailableForOffers = true, }); - AddForCleanup(new Task(async () => await client.UpdateWorkerAsync(new UpdateWorkerOptions(workerId1) { AvailableForOffers = false }))); + AddForCleanup(new Task(async () => await client.UpdateWorkerAsync(new RouterWorker(workerId1) { AvailableForOffers = false }))); var jobId = GenerateUniqueId($"{IdPrefix}-JobId-{nameof(AssignmentScenario)}"); var createJob = await client.CreateJobAsync( @@ -73,15 +74,15 @@ public async Task Scenario() Assert.AreEqual(worker.Value.Id, accept.Value.WorkerId); Assert.ThrowsAsync(async () => await client.DeclineJobOfferAsync( - new DeclineJobOfferOptions(worker.Value.Id, offer.OfferId) { RetryOfferAt = DateTimeOffset.MinValue })); + worker.Value.Id, offer.OfferId, new DeclineJobOfferOptions { RetryOfferAt = DateTimeOffset.MinValue })); - var complete = await client.CompleteJobAsync(new CompleteJobOptions(createJob.Value.Id, accept.Value.AssignmentId) + var complete = await client.CompleteJobAsync(createJob.Value.Id, new CompleteJobOptions(accept.Value.AssignmentId) { Note = $"Job completed by {workerId1}" }); Assert.AreEqual(200, complete.Status); - var close = await client.CloseJobAsync(new CloseJobOptions(createJob.Value.Id, accept.Value.AssignmentId) + var close = await client.CloseJobAsync(createJob.Value.Id, new CloseJobOptions(accept.Value.AssignmentId) { Note = $"Job closed by {workerId1}" }); @@ -94,6 +95,14 @@ public async Task Scenario() Assert.IsNotNull(finalJobState.Value.Assignments[accept.Value.AssignmentId].ClosedAt); Assert.IsNotEmpty(finalJobState.Value.Notes); Assert.IsTrue(finalJobState.Value.Notes.Count == 2); + + // in-test cleanup + worker.Value.AvailableForOffers = false; + await client.UpdateWorkerAsync(worker); + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(5)); + } } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/CancellationScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/CancellationScenario.cs index a565cbc19d968..1fbc90826cb0b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/CancellationScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/CancellationScenario.cs @@ -36,6 +36,7 @@ public async Task Scenario() { Name = "test", }); + AddForCleanup(new Task(async () => await administrationClient.DeleteQueueAsync(queueResponse.Value.Id))); var jobId = $"JobId-{IdPrefix}-{nameof(CancellationScenario)}"; var createJob = await client.CreateJobAsync( @@ -46,7 +47,6 @@ public async Task Scenario() { Priority = 1, }); - AddForCleanup(new Task(async () => await client.CancelJobAsync(new CancelJobOptions(jobId)))); AddForCleanup(new Task(async () => await client.DeleteJobAsync(jobId))); var job = await Poll(async () => await client.GetJobAsync(createJob.Value.Id), @@ -54,7 +54,7 @@ public async Task Scenario() TimeSpan.FromSeconds(10)); Assert.AreEqual(RouterJobStatus.Queued, job.Value.Status); - await client.CancelJobAsync(new CancelJobOptions(job.Value.Id) + await client.CancelJobAsync(job.Value.Id, new CancelJobOptions { DispositionCode = dispositionCode, }); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/QueueScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/QueueScenario.cs index cc14feb9aa75e..de4375d160df6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/QueueScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/QueueScenario.cs @@ -67,8 +67,8 @@ public async Task QueueingWithClassificationPolicyWithStaticLabelSelector() var classificationPolicyResponse = await administrationClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(GenerateUniqueId($"Cp-StaticLabels-{IdPrefix}")) { - QueueSelectors = { - new StaticQueueSelectorAttachment(new RouterQueueSelector(key: "Id", LabelOperator.Equal, new LabelValue(queueResponse.Value.Id))) + QueueSelectorAttachments = { + new StaticQueueSelectorAttachment(new RouterQueueSelector(key: "Id", LabelOperator.Equal, new RouterValue(queueResponse.Value.Id))) } }); @@ -103,8 +103,8 @@ public async Task QueueingWithClassificationPolicyWithFallbackQueue() var classificationPolicyResponse = await administrationClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(GenerateUniqueId($"Cp-default_Q-{IdPrefix}")) { - QueueSelectors = { - new StaticQueueSelectorAttachment(new RouterQueueSelector(key: "Id", LabelOperator.Equal, new LabelValue("QueueIdDoesNotExist"))) + QueueSelectorAttachments = { + new StaticQueueSelectorAttachment(new RouterQueueSelector(key: "Id", LabelOperator.Equal, new RouterValue("QueueIdDoesNotExist"))) }, FallbackQueueId = fallbackQueueResponse.Value.Id, }); @@ -145,12 +145,12 @@ public async Task QueueingWithClassificationPolicyWithConditionalLabelSelector() var classificationPolicyResponse = await administrationClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(GenerateUniqueId($"{IdPrefix}-cp-conditional")) { - QueueSelectors = { + QueueSelectorAttachments = { new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(queueResponse.Value.Id)) + new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(queueResponse.Value.Id)) }) }, FallbackQueueId = fallbackQueueResponse.Value.Id, @@ -159,12 +159,13 @@ public async Task QueueingWithClassificationPolicyWithConditionalLabelSelector() var createJob = await client.CreateJobWithClassificationPolicyAsync( new CreateJobWithClassificationPolicyOptions(GenerateUniqueId($"{IdPrefix}-{ScenarioPrefix}"), channelResponse, classificationPolicyResponse.Value.Id) { - Labels = { ["Product"] = new LabelValue("O365") }, + Labels = { ["Product"] = new RouterValue("O365") }, }); var job = await Poll(async () => await client.GetJobAsync(createJob.Value.Id), x => x.Value.Status == RouterJobStatus.Queued, TimeSpan.FromSeconds(10)); + Assert.AreEqual(RouterJobStatus.Queued, job.Value.Status); Assert.AreEqual(job.Value.QueueId, queueResponse.Value.Id); } @@ -188,9 +189,9 @@ public async Task QueueingWithClassificationPolicyWithPassThroughLabelSelector() { Name = "test", Labels = { - ["Region"] = new LabelValue($"{uniquePrefix}NA"), - ["Language"] = new LabelValue($"{uniquePrefix}EN"), - ["Product"] = new LabelValue($"{uniquePrefix}O365") + ["Region"] = new RouterValue($"{uniquePrefix}NA"), + ["Language"] = new RouterValue($"{uniquePrefix}EN"), + ["Product"] = new RouterValue($"{uniquePrefix}O365") } }); var fallbackQueueResponse = await administrationClient.CreateQueueAsync( @@ -203,11 +204,11 @@ public async Task QueueingWithClassificationPolicyWithPassThroughLabelSelector() var classificationPolicyResponse = await administrationClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(GenerateUniqueId($"{IdPrefix}-cp-pass-through-selector")) { - QueueSelectors = { + QueueSelectorAttachments = { new PassThroughQueueSelectorAttachment("Region", LabelOperator.Equal), new PassThroughQueueSelectorAttachment("Language", LabelOperator.Equal), new PassThroughQueueSelectorAttachment("Product", LabelOperator.Equal), - new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new LabelValue(uniquePrefix))), + new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal, new RouterValue(uniquePrefix))), }, FallbackQueueId = fallbackQueueResponse.Value.Id, }); @@ -219,9 +220,9 @@ public async Task QueueingWithClassificationPolicyWithPassThroughLabelSelector() classificationPolicyResponse.Value.Id) { Labels = { - ["Product"] = new LabelValue($"{uniquePrefix}O365"), - ["Region"] = new LabelValue($"{uniquePrefix}NA"), - ["Language"] = new LabelValue($"{uniquePrefix}EN") + ["Product"] = new RouterValue($"{uniquePrefix}O365"), + ["Region"] = new RouterValue($"{uniquePrefix}NA"), + ["Language"] = new RouterValue($"{uniquePrefix}EN") }, }); @@ -251,10 +252,10 @@ public async Task QueueingWithClassificationPolicyWithCombiningLabelSelectors() { Name = "test", Labels = { - ["Region"] = new LabelValue($"{uniquePrefix}NA"), - ["Language"] = new LabelValue($"{uniquePrefix}en"), - ["Product"] = new LabelValue($"{uniquePrefix}O365"), - ["UniquePrefix"] = new LabelValue(uniquePrefix), + ["Region"] = new RouterValue($"{uniquePrefix}NA"), + ["Language"] = new RouterValue($"{uniquePrefix}en"), + ["Product"] = new RouterValue($"{uniquePrefix}O365"), + ["UniquePrefix"] = new RouterValue(uniquePrefix), }, }); @@ -263,10 +264,10 @@ public async Task QueueingWithClassificationPolicyWithCombiningLabelSelectors() { Name = "test", Labels = { - ["Region"] = new LabelValue($"{uniquePrefix}NA"), - ["Language"] = new LabelValue($"{uniquePrefix}fr"), - ["Product"] = new LabelValue($"{uniquePrefix}O365"), - ["UniquePrefix"] = new LabelValue(uniquePrefix), + ["Region"] = new RouterValue($"{uniquePrefix}NA"), + ["Language"] = new RouterValue($"{uniquePrefix}fr"), + ["Product"] = new RouterValue($"{uniquePrefix}O365"), + ["UniquePrefix"] = new RouterValue(uniquePrefix), }, }); @@ -279,22 +280,22 @@ public async Task QueueingWithClassificationPolicyWithCombiningLabelSelectors() var classificationPolicyResponse = await administrationClient.CreateClassificationPolicyAsync( new CreateClassificationPolicyOptions(GenerateUniqueId($"{IdPrefix}-combination")) { - QueueSelectors = { + QueueSelectorAttachments = { new PassThroughQueueSelectorAttachment("Region", LabelOperator.Equal), new PassThroughQueueSelectorAttachment("Product", LabelOperator.Equal), new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule($"If(job.Lang = \"{uniquePrefix}EN\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("Language", LabelOperator.Equal, new LabelValue($"{uniquePrefix}en")) + new RouterQueueSelector("Language", LabelOperator.Equal, new RouterValue($"{uniquePrefix}en")) }), new ConditionalQueueSelectorAttachment( condition: new ExpressionRouterRule($"If(job.Lang = \"{uniquePrefix}FR\", true, false)"), queueSelectors: new List() { - new RouterQueueSelector("Language", LabelOperator.Equal, new LabelValue($"{uniquePrefix}fr")) + new RouterQueueSelector("Language", LabelOperator.Equal, new RouterValue($"{uniquePrefix}fr")) }), - new StaticQueueSelectorAttachment(new RouterQueueSelector("UniquePrefix", LabelOperator.Equal, new LabelValue(uniquePrefix))) + new StaticQueueSelectorAttachment(new RouterQueueSelector("UniquePrefix", LabelOperator.Equal, new RouterValue(uniquePrefix))) }, FallbackQueueId = fallbackQueueResponse.Value.Id, }); @@ -306,9 +307,9 @@ public async Task QueueingWithClassificationPolicyWithCombiningLabelSelectors() classificationPolicyResponse.Value.Id) { Labels = { - ["Product"] = new LabelValue($"{uniquePrefix}O365"), - ["Region"] = new LabelValue($"{uniquePrefix}NA"), - ["Lang"] = new LabelValue($"{uniquePrefix}EN") + ["Product"] = new RouterValue($"{uniquePrefix}O365"), + ["Region"] = new RouterValue($"{uniquePrefix}NA"), + ["Lang"] = new RouterValue($"{uniquePrefix}EN") } }); @@ -316,7 +317,7 @@ public async Task QueueingWithClassificationPolicyWithCombiningLabelSelectors() x => x.Value.Status == RouterJobStatus.Queued, TimeSpan.FromSeconds(10)); - var job2Labels = new Dictionary() + var job2Labels = new Dictionary() ; var createJob2 = await client.CreateJobWithClassificationPolicyAsync( new CreateJobWithClassificationPolicyOptions( @@ -325,9 +326,9 @@ public async Task QueueingWithClassificationPolicyWithCombiningLabelSelectors() classificationPolicyResponse.Value.Id) { Labels = { - ["Product"] = new LabelValue($"{uniquePrefix}O365"), - ["Region"] = new LabelValue($"{uniquePrefix}NA"), - ["Lang"] = new LabelValue($"{uniquePrefix}FR") + ["Product"] = new RouterValue($"{uniquePrefix}O365"), + ["Region"] = new RouterValue($"{uniquePrefix}NA"), + ["Lang"] = new RouterValue($"{uniquePrefix}FR") } }); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs index d2cd12458283c..28b6ceb964ae5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs @@ -29,25 +29,26 @@ public async Task SimpleSchedulingScenario() new CreateDistributionPolicyOptions(GenerateUniqueId($"{IdPrefix}-{ScenarioPrefix}"), TimeSpan.FromMinutes(10), new LongestIdleMode()) { Name = "Simple-Queue-Distribution" }); + AddForCleanup(new Task(async () => await administrationClient.DeleteDistributionPolicyAsync(distributionPolicyResponse.Value.Id))); var queueResponse = await administrationClient.CreateQueueAsync( new CreateQueueOptions(GenerateUniqueId($"{IdPrefix}-{ScenarioPrefix}"), distributionPolicyResponse.Value.Id) { Name = "test", }); + AddForCleanup(new Task(async () => await administrationClient.DeleteQueueAsync(queueResponse.Value.Id))); var workerId1 = GenerateUniqueId($"{IdPrefix}-w1"); var registerWorker = await client.CreateWorkerAsync( - new CreateWorkerOptions(workerId: workerId1, totalCapacity: 1) + new CreateWorkerOptions(workerId: workerId1, capacity: 1) { - QueueAssignments = { [queueResponse.Value.Id] = new RouterQueueAssignment() }, - ChannelConfigurations = { [channelResponse] = new ChannelConfiguration(1) }, + Queues = { queueResponse.Value.Id, }, + Channels = { new RouterChannel(channelResponse, 1) }, AvailableForOffers = true, }); - AddForCleanup(new Task(async () => await client.UpdateWorkerAsync(new UpdateWorkerOptions(workerId1) { AvailableForOffers = false }))); AddForCleanup(new Task(async () => await client.DeleteWorkerAsync(workerId1))); - var jobId = GenerateUniqueId($"JobId-SQ-{ScenarioPrefix}"); + var jobId = GenerateUniqueId($"{IdPrefix}-JobId-SQ-{ScenarioPrefix}"); var timeToEnqueueJob = GetOrSetScheduledTimeUtc(DateTimeOffset.UtcNow.AddSeconds(10)); var createJob = await client.CreateJobAsync( @@ -66,7 +67,7 @@ public async Task SimpleSchedulingScenario() Assert.That(job.Value.ScheduledAt, Is.EqualTo(timeToEnqueueJob).Within(30).Seconds); var updateJobToStartMatching = - await client.UpdateJobAsync(new UpdateJobOptions(jobId) + await client.UpdateJobAsync(new RouterJob(jobId) { MatchingMode = new QueueAndMatchMode() }); @@ -90,15 +91,15 @@ await client.UpdateJobAsync(new UpdateJobOptions(jobId) Assert.AreEqual(worker.Value.Id, accept.Value.WorkerId); Assert.ThrowsAsync(async () => await client.DeclineJobOfferAsync( - new DeclineJobOfferOptions(worker.Value.Id, offer.OfferId) { RetryOfferAt = DateTimeOffset.MinValue })); + worker.Value.Id, offer.OfferId, new DeclineJobOfferOptions { RetryOfferAt = DateTimeOffset.MinValue })); - var complete = await client.CompleteJobAsync(new CompleteJobOptions(createJob.Value.Id, accept.Value.AssignmentId) + var complete = await client.CompleteJobAsync(createJob.Value.Id, new CompleteJobOptions(accept.Value.AssignmentId) { Note = $"Job completed by {workerId1}" }); Assert.AreEqual(200, complete.Status); - var close = await client.CloseJobAsync(new CloseJobOptions(createJob.Value.Id, accept.Value.AssignmentId) + var close = await client.CloseJobAsync(createJob.Value.Id, new CloseJobOptions(accept.Value.AssignmentId) { Note = $"Job closed by {workerId1}" }); @@ -114,6 +115,7 @@ await client.UpdateJobAsync(new UpdateJobOptions(jobId) Assert.NotNull(finalJobState.Value.ScheduledAt); // delete worker for straggling offers if any + await client.UpdateWorkerAsync(new RouterWorker(workerId1) { AvailableForOffers = false }); await client.DeleteWorkerAsync(workerId1); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml b/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml index c5a4e75bd59d7..401c96221c3b9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml +++ b/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml @@ -1,4 +1,4 @@ -commit: 0ed5668035ed54064596d28bc1c7c8f045d5a463 +commit: 945182fa26820398d6471f7e84d6057c289f5b4b directory: specification/communication/Communication.JobRouter additionalDirectories: [] repo: sarkar-rajarshi/azure-rest-api-specs diff --git a/sdk/communication/Azure.Communication.Messages/README.md b/sdk/communication/Azure.Communication.Messages/README.md index 090d7029c8099..27a69aae724dc 100644 --- a/sdk/communication/Azure.Communication.Messages/README.md +++ b/sdk/communication/Azure.Communication.Messages/README.md @@ -97,4 +97,18 @@ This project welcomes contributions and suggestions. Most contributions require 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 [opencode@microsoft.com][coc_contact] with any additional questions or comments. - + +[source]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/communication/Azure.Communication.Messages/src +[package]: https://www.nuget.org/packages/Azure.Communication.Messages +[product_docs]: https://docs.microsoft.com/azure/communication-services/overview +[nuget]: https://www.nuget.org. +[azure_sub]: https://azure.microsoft.com/free/dotnet/ +[communication_resource_docs]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp +[communication_resource_create_portal]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp +[communication_resource_create_power_shell]: https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice +[communication_resource_create_net]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-net +[azure_portal]: https://portal.azure.com. +[cla]: https://cla.microsoft.com +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ +[coc_contact]: mailto:opencode@microsoft.com diff --git a/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs b/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs index 842955f3ff23b..4828facc882ce 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs @@ -46,7 +46,7 @@ protected CommunicationDomainResourceCollection() { } } public partial class CommunicationDomainResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public CommunicationDomainResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CommunicationDomainResourceData(Azure.Core.AzureLocation location) { } public string DataLocation { get { throw null; } } public Azure.ResourceManager.Communication.Models.DomainManagement? DomainManagement { get { throw null; } set { } } public string FromSenderDomain { get { throw null; } } @@ -122,7 +122,7 @@ protected CommunicationServiceResourceCollection() { } } public partial class CommunicationServiceResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public CommunicationServiceResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CommunicationServiceResourceData(Azure.Core.AzureLocation location) { } public string DataLocation { get { throw null; } set { } } public string HostName { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } @@ -174,7 +174,7 @@ protected EmailServiceResourceCollection() { } } public partial class EmailServiceResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public EmailServiceResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EmailServiceResourceData(Azure.Core.AzureLocation location) { } public string DataLocation { get { throw null; } set { } } public Azure.ResourceManager.Communication.Models.EmailServicesProvisioningState? ProvisioningState { get { throw null; } } } @@ -218,6 +218,39 @@ public SenderUsernameResourceData() { } public string Username { get { throw null; } set { } } } } +namespace Azure.ResourceManager.Communication.Mocking +{ + public partial class MockableCommunicationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableCommunicationArmClient() { } + public virtual Azure.ResourceManager.Communication.CommunicationDomainResource GetCommunicationDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Communication.CommunicationServiceResource GetCommunicationServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Communication.EmailServiceResource GetEmailServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Communication.SenderUsernameResource GetSenderUsernameResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableCommunicationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableCommunicationResourceGroupResource() { } + public virtual Azure.Response GetCommunicationServiceResource(string communicationServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCommunicationServiceResourceAsync(string communicationServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Communication.CommunicationServiceResourceCollection GetCommunicationServiceResources() { throw null; } + public virtual Azure.Response GetEmailServiceResource(string emailServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEmailServiceResourceAsync(string emailServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Communication.EmailServiceResourceCollection GetEmailServiceResources() { throw null; } + } + public partial class MockableCommunicationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableCommunicationSubscriptionResource() { } + public virtual Azure.Response CheckCommunicationNameAvailability(Azure.ResourceManager.Communication.Models.CommunicationServiceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckCommunicationNameAvailabilityAsync(Azure.ResourceManager.Communication.Models.CommunicationServiceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCommunicationServiceResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCommunicationServiceResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEmailServiceResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEmailServiceResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVerifiedExchangeOnlineDomainsEmailServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVerifiedExchangeOnlineDomainsEmailServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Communication.Models { public static partial class ArmCommunicationModelFactory diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs index d48bd4688e1b8..39a5a7b656f5b 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Communication public partial class CommunicationDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The emailServiceName. + /// The domainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SenderUsernameResources and their operations over a SenderUsernameResource. public virtual SenderUsernameResourceCollection GetSenderUsernameResources() { - return GetCachedClient(Client => new SenderUsernameResourceCollection(Client, Id)); + return GetCachedClient(client => new SenderUsernameResourceCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual SenderUsernameResourceCollection GetSenderUsernameResources() /// /// The valid sender Username. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSenderUsernameResourceAsync(string senderUsername, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetSenderUsernameRes /// /// The valid sender Username. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSenderUsernameResource(string senderUsername, CancellationToken cancellationToken = default) { diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResource.cs index caab3d323b3ce..23f6b05179eb0 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Communication public partial class CommunicationServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The communicationServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string communicationServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}"; diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResource.cs index e15729698fd56..f75cc15133fb4 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Communication public partial class EmailServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The emailServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string emailServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CommunicationDomainResources and their operations over a CommunicationDomainResource. public virtual CommunicationDomainResourceCollection GetCommunicationDomainResources() { - return GetCachedClient(Client => new CommunicationDomainResourceCollection(Client, Id)); + return GetCachedClient(client => new CommunicationDomainResourceCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual CommunicationDomainResourceCollection GetCommunicationDomainResou /// /// The name of the Domains resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCommunicationDomainResourceAsync(string domainName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetCommunicatio /// /// The name of the Domains resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCommunicationDomainResource(string domainName, CancellationToken cancellationToken = default) { diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/CommunicationExtensions.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/CommunicationExtensions.cs index 5d35a0e2ef533..7d8b92d467773 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/CommunicationExtensions.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/CommunicationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Communication.Mocking; using Azure.ResourceManager.Communication.Models; using Azure.ResourceManager.Resources; @@ -19,119 +20,97 @@ namespace Azure.ResourceManager.Communication /// A class to add extension methods to Azure.ResourceManager.Communication. public static partial class CommunicationExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableCommunicationArmClient GetMockableCommunicationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableCommunicationArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCommunicationResourceGroupResource GetMockableCommunicationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCommunicationResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableCommunicationSubscriptionResource GetMockableCommunicationSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableCommunicationSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region CommunicationServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CommunicationServiceResource GetCommunicationServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CommunicationServiceResource.ValidateResourceId(id); - return new CommunicationServiceResource(client, id); - } - ); + return GetMockableCommunicationArmClient(client).GetCommunicationServiceResource(id); } - #endregion - #region CommunicationDomainResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CommunicationDomainResource GetCommunicationDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CommunicationDomainResource.ValidateResourceId(id); - return new CommunicationDomainResource(client, id); - } - ); + return GetMockableCommunicationArmClient(client).GetCommunicationDomainResource(id); } - #endregion - #region EmailServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EmailServiceResource GetEmailServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EmailServiceResource.ValidateResourceId(id); - return new EmailServiceResource(client, id); - } - ); + return GetMockableCommunicationArmClient(client).GetEmailServiceResource(id); } - #endregion - #region SenderUsernameResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SenderUsernameResource GetSenderUsernameResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SenderUsernameResource.ValidateResourceId(id); - return new SenderUsernameResource(client, id); - } - ); + return GetMockableCommunicationArmClient(client).GetSenderUsernameResource(id); } - #endregion - /// Gets a collection of CommunicationServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of CommunicationServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CommunicationServiceResources and their operations over a CommunicationServiceResource. public static CommunicationServiceResourceCollection GetCommunicationServiceResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCommunicationServiceResources(); + return GetMockableCommunicationResourceGroupResource(resourceGroupResource).GetCommunicationServiceResources(); } /// @@ -146,16 +125,20 @@ public static CommunicationServiceResourceCollection GetCommunicationServiceReso /// CommunicationServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the CommunicationService resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCommunicationServiceResourceAsync(this ResourceGroupResource resourceGroupResource, string communicationServiceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCommunicationServiceResources().GetAsync(communicationServiceName, cancellationToken).ConfigureAwait(false); + return await GetMockableCommunicationResourceGroupResource(resourceGroupResource).GetCommunicationServiceResourceAsync(communicationServiceName, cancellationToken).ConfigureAwait(false); } /// @@ -170,24 +153,34 @@ public static async Task> GetCommunicatio /// CommunicationServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the CommunicationService resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCommunicationServiceResource(this ResourceGroupResource resourceGroupResource, string communicationServiceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCommunicationServiceResources().Get(communicationServiceName, cancellationToken); + return GetMockableCommunicationResourceGroupResource(resourceGroupResource).GetCommunicationServiceResource(communicationServiceName, cancellationToken); } - /// Gets a collection of EmailServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of EmailServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EmailServiceResources and their operations over a EmailServiceResource. public static EmailServiceResourceCollection GetEmailServiceResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEmailServiceResources(); + return GetMockableCommunicationResourceGroupResource(resourceGroupResource).GetEmailServiceResources(); } /// @@ -202,16 +195,20 @@ public static EmailServiceResourceCollection GetEmailServiceResources(this Resou /// EmailServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the EmailService resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEmailServiceResourceAsync(this ResourceGroupResource resourceGroupResource, string emailServiceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEmailServiceResources().GetAsync(emailServiceName, cancellationToken).ConfigureAwait(false); + return await GetMockableCommunicationResourceGroupResource(resourceGroupResource).GetEmailServiceResourceAsync(emailServiceName, cancellationToken).ConfigureAwait(false); } /// @@ -226,16 +223,20 @@ public static async Task> GetEmailServiceResource /// EmailServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the EmailService resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEmailServiceResource(this ResourceGroupResource resourceGroupResource, string emailServiceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEmailServiceResources().Get(emailServiceName, cancellationToken); + return GetMockableCommunicationResourceGroupResource(resourceGroupResource).GetEmailServiceResource(emailServiceName, cancellationToken); } /// @@ -250,6 +251,10 @@ public static Response GetEmailServiceResource(this Resour /// CommunicationServices_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters supplied to the operation. @@ -257,9 +262,7 @@ public static Response GetEmailServiceResource(this Resour /// is null. public static async Task> CheckCommunicationNameAvailabilityAsync(this SubscriptionResource subscriptionResource, CommunicationServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckCommunicationNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCommunicationSubscriptionResource(subscriptionResource).CheckCommunicationNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -274,6 +277,10 @@ public static async Task> CheckCom /// CommunicationServices_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters supplied to the operation. @@ -281,9 +288,7 @@ public static async Task> CheckCom /// is null. public static Response CheckCommunicationNameAvailability(this SubscriptionResource subscriptionResource, CommunicationServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckCommunicationNameAvailability(content, cancellationToken); + return GetMockableCommunicationSubscriptionResource(subscriptionResource).CheckCommunicationNameAvailability(content, cancellationToken); } /// @@ -298,13 +303,17 @@ public static Response CheckCommunicationNa /// CommunicationServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCommunicationServiceResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCommunicationServiceResourcesAsync(cancellationToken); + return GetMockableCommunicationSubscriptionResource(subscriptionResource).GetCommunicationServiceResourcesAsync(cancellationToken); } /// @@ -319,13 +328,17 @@ public static AsyncPageable GetCommunicationServic /// CommunicationServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCommunicationServiceResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCommunicationServiceResources(cancellationToken); + return GetMockableCommunicationSubscriptionResource(subscriptionResource).GetCommunicationServiceResources(cancellationToken); } /// @@ -340,13 +353,17 @@ public static Pageable GetCommunicationServiceReso /// EmailServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEmailServiceResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEmailServiceResourcesAsync(cancellationToken); + return GetMockableCommunicationSubscriptionResource(subscriptionResource).GetEmailServiceResourcesAsync(cancellationToken); } /// @@ -361,13 +378,17 @@ public static AsyncPageable GetEmailServiceResourcesAsync( /// EmailServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEmailServiceResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEmailServiceResources(cancellationToken); + return GetMockableCommunicationSubscriptionResource(subscriptionResource).GetEmailServiceResources(cancellationToken); } /// @@ -382,13 +403,17 @@ public static Pageable GetEmailServiceResources(this Subsc /// EmailServices_ListVerifiedExchangeOnlineDomains /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVerifiedExchangeOnlineDomainsEmailServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVerifiedExchangeOnlineDomainsEmailServicesAsync(cancellationToken); + return GetMockableCommunicationSubscriptionResource(subscriptionResource).GetVerifiedExchangeOnlineDomainsEmailServicesAsync(cancellationToken); } /// @@ -403,13 +428,17 @@ public static AsyncPageable GetVerifiedExchangeOnlineDomainsEmailService /// EmailServices_ListVerifiedExchangeOnlineDomains /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVerifiedExchangeOnlineDomainsEmailServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVerifiedExchangeOnlineDomainsEmailServices(cancellationToken); + return GetMockableCommunicationSubscriptionResource(subscriptionResource).GetVerifiedExchangeOnlineDomainsEmailServices(cancellationToken); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationArmClient.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationArmClient.cs new file mode 100644 index 0000000000000..6a199223e3f2e --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableCommunicationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCommunicationArmClient() + { + } + + /// 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 MockableCommunicationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableCommunicationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CommunicationServiceResource GetCommunicationServiceResource(ResourceIdentifier id) + { + CommunicationServiceResource.ValidateResourceId(id); + return new CommunicationServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CommunicationDomainResource GetCommunicationDomainResource(ResourceIdentifier id) + { + CommunicationDomainResource.ValidateResourceId(id); + return new CommunicationDomainResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EmailServiceResource GetEmailServiceResource(ResourceIdentifier id) + { + EmailServiceResource.ValidateResourceId(id); + return new EmailServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SenderUsernameResource GetSenderUsernameResource(ResourceIdentifier id) + { + SenderUsernameResource.ValidateResourceId(id); + return new SenderUsernameResource(Client, id); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationResourceGroupResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationResourceGroupResource.cs new file mode 100644 index 0000000000000..74e94da7aefa8 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.Communication; + +namespace Azure.ResourceManager.Communication.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableCommunicationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCommunicationResourceGroupResource() + { + } + + /// 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 MockableCommunicationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CommunicationServiceResources in the ResourceGroupResource. + /// An object representing collection of CommunicationServiceResources and their operations over a CommunicationServiceResource. + public virtual CommunicationServiceResourceCollection GetCommunicationServiceResources() + { + return GetCachedClient(client => new CommunicationServiceResourceCollection(client, Id)); + } + + /// + /// Get the CommunicationService and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName} + /// + /// + /// Operation Id + /// CommunicationServices_Get + /// + /// + /// + /// The name of the CommunicationService resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCommunicationServiceResourceAsync(string communicationServiceName, CancellationToken cancellationToken = default) + { + return await GetCommunicationServiceResources().GetAsync(communicationServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the CommunicationService and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName} + /// + /// + /// Operation Id + /// CommunicationServices_Get + /// + /// + /// + /// The name of the CommunicationService resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCommunicationServiceResource(string communicationServiceName, CancellationToken cancellationToken = default) + { + return GetCommunicationServiceResources().Get(communicationServiceName, cancellationToken); + } + + /// Gets a collection of EmailServiceResources in the ResourceGroupResource. + /// An object representing collection of EmailServiceResources and their operations over a EmailServiceResource. + public virtual EmailServiceResourceCollection GetEmailServiceResources() + { + return GetCachedClient(client => new EmailServiceResourceCollection(client, Id)); + } + + /// + /// Get the EmailService and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName} + /// + /// + /// Operation Id + /// EmailServices_Get + /// + /// + /// + /// The name of the EmailService resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEmailServiceResourceAsync(string emailServiceName, CancellationToken cancellationToken = default) + { + return await GetEmailServiceResources().GetAsync(emailServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the EmailService and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName} + /// + /// + /// Operation Id + /// EmailServices_Get + /// + /// + /// + /// The name of the EmailService resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEmailServiceResource(string emailServiceName, CancellationToken cancellationToken = default) + { + return GetEmailServiceResources().Get(emailServiceName, cancellationToken); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationSubscriptionResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationSubscriptionResource.cs new file mode 100644 index 0000000000000..36ff6f48856ac --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationSubscriptionResource.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Communication; +using Azure.ResourceManager.Communication.Models; + +namespace Azure.ResourceManager.Communication.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableCommunicationSubscriptionResource : ArmResource + { + private ClientDiagnostics _communicationServiceResourceCommunicationServicesClientDiagnostics; + private CommunicationServicesRestOperations _communicationServiceResourceCommunicationServicesRestClient; + private ClientDiagnostics _emailServiceResourceEmailServicesClientDiagnostics; + private EmailServicesRestOperations _emailServiceResourceEmailServicesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCommunicationSubscriptionResource() + { + } + + /// 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 MockableCommunicationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CommunicationServiceResourceCommunicationServicesClientDiagnostics => _communicationServiceResourceCommunicationServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Communication", CommunicationServiceResource.ResourceType.Namespace, Diagnostics); + private CommunicationServicesRestOperations CommunicationServiceResourceCommunicationServicesRestClient => _communicationServiceResourceCommunicationServicesRestClient ??= new CommunicationServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CommunicationServiceResource.ResourceType)); + private ClientDiagnostics EmailServiceResourceEmailServicesClientDiagnostics => _emailServiceResourceEmailServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Communication", EmailServiceResource.ResourceType.Namespace, Diagnostics); + private EmailServicesRestOperations EmailServiceResourceEmailServicesRestClient => _emailServiceResourceEmailServicesRestClient ??= new EmailServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EmailServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks that the CommunicationService name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability + /// + /// + /// Operation Id + /// CommunicationServices_CheckNameAvailability + /// + /// + /// + /// Parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckCommunicationNameAvailabilityAsync(CommunicationServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CommunicationServiceResourceCommunicationServicesClientDiagnostics.CreateScope("MockableCommunicationSubscriptionResource.CheckCommunicationNameAvailability"); + scope.Start(); + try + { + var response = await CommunicationServiceResourceCommunicationServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the CommunicationService name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability + /// + /// + /// Operation Id + /// CommunicationServices_CheckNameAvailability + /// + /// + /// + /// Parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual Response CheckCommunicationNameAvailability(CommunicationServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CommunicationServiceResourceCommunicationServicesClientDiagnostics.CreateScope("MockableCommunicationSubscriptionResource.CheckCommunicationNameAvailability"); + scope.Start(); + try + { + var response = CommunicationServiceResourceCommunicationServicesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices + /// + /// + /// Operation Id + /// CommunicationServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCommunicationServiceResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), CommunicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "MockableCommunicationSubscriptionResource.GetCommunicationServiceResources", "value", "nextLink", cancellationToken); + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices + /// + /// + /// Operation Id + /// CommunicationServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCommunicationServiceResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), CommunicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "MockableCommunicationSubscriptionResource.GetCommunicationServiceResources", "value", "nextLink", cancellationToken); + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/emailServices + /// + /// + /// Operation Id + /// EmailServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEmailServiceResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "MockableCommunicationSubscriptionResource.GetEmailServiceResources", "value", "nextLink", cancellationToken); + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/emailServices + /// + /// + /// Operation Id + /// EmailServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEmailServiceResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "MockableCommunicationSubscriptionResource.GetEmailServiceResources", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of domains that are fully verified in Exchange Online. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/listVerifiedExchangeOnlineDomains + /// + /// + /// Operation Id + /// EmailServices_ListVerifiedExchangeOnlineDomains + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVerifiedExchangeOnlineDomainsEmailServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListVerifiedExchangeOnlineDomainsRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "MockableCommunicationSubscriptionResource.GetVerifiedExchangeOnlineDomainsEmailServices", "", null, cancellationToken); + } + + /// + /// Get a list of domains that are fully verified in Exchange Online. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/listVerifiedExchangeOnlineDomains + /// + /// + /// Operation Id + /// EmailServices_ListVerifiedExchangeOnlineDomains + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVerifiedExchangeOnlineDomainsEmailServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListVerifiedExchangeOnlineDomainsRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "MockableCommunicationSubscriptionResource.GetVerifiedExchangeOnlineDomainsEmailServices", "", null, cancellationToken); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 868a4b8209e55..0000000000000 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Communication -{ - /// 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 CommunicationServiceResources in the ResourceGroupResource. - /// An object representing collection of CommunicationServiceResources and their operations over a CommunicationServiceResource. - public virtual CommunicationServiceResourceCollection GetCommunicationServiceResources() - { - return GetCachedClient(Client => new CommunicationServiceResourceCollection(Client, Id)); - } - - /// Gets a collection of EmailServiceResources in the ResourceGroupResource. - /// An object representing collection of EmailServiceResources and their operations over a EmailServiceResource. - public virtual EmailServiceResourceCollection GetEmailServiceResources() - { - return GetCachedClient(Client => new EmailServiceResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 00e0cd5492fc5..0000000000000 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Communication.Models; - -namespace Azure.ResourceManager.Communication -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _communicationServiceResourceCommunicationServicesClientDiagnostics; - private CommunicationServicesRestOperations _communicationServiceResourceCommunicationServicesRestClient; - private ClientDiagnostics _emailServiceResourceEmailServicesClientDiagnostics; - private EmailServicesRestOperations _emailServiceResourceEmailServicesRestClient; - - /// 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 CommunicationServiceResourceCommunicationServicesClientDiagnostics => _communicationServiceResourceCommunicationServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Communication", CommunicationServiceResource.ResourceType.Namespace, Diagnostics); - private CommunicationServicesRestOperations CommunicationServiceResourceCommunicationServicesRestClient => _communicationServiceResourceCommunicationServicesRestClient ??= new CommunicationServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CommunicationServiceResource.ResourceType)); - private ClientDiagnostics EmailServiceResourceEmailServicesClientDiagnostics => _emailServiceResourceEmailServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Communication", EmailServiceResource.ResourceType.Namespace, Diagnostics); - private EmailServicesRestOperations EmailServiceResourceEmailServicesRestClient => _emailServiceResourceEmailServicesRestClient ??= new EmailServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EmailServiceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks that the CommunicationService name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability - /// - /// - /// Operation Id - /// CommunicationServices_CheckNameAvailability - /// - /// - /// - /// Parameters supplied to the operation. - /// The cancellation token to use. - public virtual async Task> CheckCommunicationNameAvailabilityAsync(CommunicationServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CommunicationServiceResourceCommunicationServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckCommunicationNameAvailability"); - scope.Start(); - try - { - var response = await CommunicationServiceResourceCommunicationServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the CommunicationService name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability - /// - /// - /// Operation Id - /// CommunicationServices_CheckNameAvailability - /// - /// - /// - /// Parameters supplied to the operation. - /// The cancellation token to use. - public virtual Response CheckCommunicationNameAvailability(CommunicationServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CommunicationServiceResourceCommunicationServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckCommunicationNameAvailability"); - scope.Start(); - try - { - var response = CommunicationServiceResourceCommunicationServicesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices - /// - /// - /// Operation Id - /// CommunicationServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCommunicationServiceResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), CommunicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCommunicationServiceResources", "value", "nextLink", cancellationToken); - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices - /// - /// - /// Operation Id - /// CommunicationServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCommunicationServiceResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CommunicationServiceResourceCommunicationServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CommunicationServiceResource(Client, CommunicationServiceResourceData.DeserializeCommunicationServiceResourceData(e)), CommunicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCommunicationServiceResources", "value", "nextLink", cancellationToken); - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/emailServices - /// - /// - /// Operation Id - /// EmailServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEmailServiceResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEmailServiceResources", "value", "nextLink", cancellationToken); - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/emailServices - /// - /// - /// Operation Id - /// EmailServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEmailServiceResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EmailServiceResourceEmailServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EmailServiceResource(Client, EmailServiceResourceData.DeserializeEmailServiceResourceData(e)), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEmailServiceResources", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of domains that are fully verified in Exchange Online. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/listVerifiedExchangeOnlineDomains - /// - /// - /// Operation Id - /// EmailServices_ListVerifiedExchangeOnlineDomains - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVerifiedExchangeOnlineDomainsEmailServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListVerifiedExchangeOnlineDomainsRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVerifiedExchangeOnlineDomainsEmailServices", "", null, cancellationToken); - } - - /// - /// Get a list of domains that are fully verified in Exchange Online. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Communication/listVerifiedExchangeOnlineDomains - /// - /// - /// Operation Id - /// EmailServices_ListVerifiedExchangeOnlineDomains - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVerifiedExchangeOnlineDomainsEmailServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EmailServiceResourceEmailServicesRestClient.CreateListVerifiedExchangeOnlineDomainsRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), EmailServiceResourceEmailServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVerifiedExchangeOnlineDomainsEmailServices", "", null, cancellationToken); - } - } -} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResource.cs index 075a57b02af8e..e85ae7be0479a 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SenderUsernameResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Communication public partial class SenderUsernameResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The emailServiceName. + /// The domainName. + /// The senderUsername. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string senderUsername) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/CHANGELOG.md b/sdk/compute/Azure.ResourceManager.Compute/CHANGELOG.md index a33c9607550d3..4b936af495bb0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/CHANGELOG.md +++ b/sdk/compute/Azure.ResourceManager.Compute/CHANGELOG.md @@ -19,6 +19,12 @@ - Added new parameter `TimeCreated` to VMSS VM properties. - Added new parameters `AuxiliaryMode` and `AuxiliarySku` to VM and VMSS Network Configuration Properties. +## 1.2.0-beta.3 (2023-08-14) + +### Features Added + +- Make `ComputeArmClientMockingExtension`, `ComputeResourceGroupMockingExtension`, `ComputeSubscriptionMockingExtension` public for mocking the extension methods. + ## 1.2.0-beta.2 (2023-07-28) ### Features Added diff --git a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs index 5686a36d980d2..4f85cabd99a98 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs @@ -19,7 +19,7 @@ protected AvailabilitySetCollection() { } } public partial class AvailabilitySetData : Azure.ResourceManager.Models.TrackedResourceData { - public AvailabilitySetData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AvailabilitySetData(Azure.Core.AzureLocation location) { } public int? PlatformFaultDomainCount { get { throw null; } set { } } public int? PlatformUpdateDomainCount { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ProximityPlacementGroupId { get { throw null; } set { } } @@ -68,7 +68,7 @@ protected CapacityReservationCollection() { } } public partial class CapacityReservationData : Azure.ResourceManager.Models.TrackedResourceData { - public CapacityReservationData(Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.ComputeSku sku) : base (default(Azure.Core.AzureLocation)) { } + public CapacityReservationData(Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.ComputeSku sku) { } public Azure.ResourceManager.Compute.Models.CapacityReservationInstanceView InstanceView { get { throw null; } } public int? PlatformFaultDomainCount { get { throw null; } } public System.DateTimeOffset? ProvisioningOn { get { throw null; } } @@ -98,7 +98,7 @@ protected CapacityReservationGroupCollection() { } } public partial class CapacityReservationGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public CapacityReservationGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CapacityReservationGroupData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList CapacityReservations { get { throw null; } } public System.Collections.Generic.IReadOnlyList InstanceViewCapacityReservations { get { throw null; } } public System.Collections.Generic.IReadOnlyList VirtualMachinesAssociated { get { throw null; } } @@ -166,7 +166,7 @@ protected CloudServiceCollection() { } } public partial class CloudServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public CloudServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CloudServiceData(Azure.Core.AzureLocation location) { } public bool? AllowModelOverride { get { throw null; } set { } } public string Configuration { get { throw null; } set { } } public System.Uri ConfigurationUri { get { throw null; } set { } } @@ -746,7 +746,7 @@ protected DedicatedHostCollection() { } } public partial class DedicatedHostData : Azure.ResourceManager.Models.TrackedResourceData { - public DedicatedHostData(Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.ComputeSku sku) : base (default(Azure.Core.AzureLocation)) { } + public DedicatedHostData(Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.ComputeSku sku) { } public bool? AutoReplaceOnFailure { get { throw null; } set { } } public string HostId { get { throw null; } } public Azure.ResourceManager.Compute.Models.DedicatedHostInstanceView InstanceView { get { throw null; } } @@ -777,7 +777,7 @@ protected DedicatedHostGroupCollection() { } } public partial class DedicatedHostGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public DedicatedHostGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DedicatedHostGroupData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList DedicatedHosts { get { throw null; } } public System.Collections.Generic.IReadOnlyList InstanceViewHosts { get { throw null; } } public int? PlatformFaultDomainCount { get { throw null; } set { } } @@ -851,7 +851,7 @@ protected DiskAccessCollection() { } } public partial class DiskAccessData : Azure.ResourceManager.Models.TrackedResourceData { - public DiskAccessData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DiskAccessData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public string ProvisioningState { get { throw null; } } @@ -901,7 +901,7 @@ protected DiskEncryptionSetCollection() { } } public partial class DiskEncryptionSetData : Azure.ResourceManager.Models.TrackedResourceData { - public DiskEncryptionSetData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DiskEncryptionSetData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Compute.Models.KeyForDiskEncryptionSet ActiveKey { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ComputeApiError AutoKeyRotationError { get { throw null; } } public Azure.ResourceManager.Compute.Models.DiskEncryptionSetType? EncryptionType { get { throw null; } set { } } @@ -953,7 +953,7 @@ protected DiskImageCollection() { } } public partial class DiskImageData : Azure.ResourceManager.Models.TrackedResourceData { - public DiskImageData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DiskImageData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.HyperVGeneration? HyperVGeneration { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } @@ -1049,7 +1049,7 @@ protected GalleryApplicationCollection() { } } public partial class GalleryApplicationData : Azure.ResourceManager.Models.TrackedResourceData { - public GalleryApplicationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GalleryApplicationData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList CustomActions { get { throw null; } } public string Description { get { throw null; } set { } } public System.DateTimeOffset? EndOfLifeOn { get { throw null; } set { } } @@ -1100,7 +1100,7 @@ protected GalleryApplicationVersionCollection() { } } public partial class GalleryApplicationVersionData : Azure.ResourceManager.Models.TrackedResourceData { - public GalleryApplicationVersionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GalleryApplicationVersionData(Azure.Core.AzureLocation location) { } public bool? AllowDeletionOfReplicatedLocations { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.GalleryProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Compute.Models.GalleryApplicationVersionPublishingProfile PublishingProfile { get { throw null; } set { } } @@ -1145,7 +1145,7 @@ protected GalleryCollection() { } } public partial class GalleryData : Azure.ResourceManager.Models.TrackedResourceData { - public GalleryData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GalleryData(Azure.Core.AzureLocation location) { } public string Description { get { throw null; } set { } } public string IdentifierUniqueName { get { throw null; } } public bool? IsSoftDeleteEnabled { get { throw null; } set { } } @@ -1172,7 +1172,7 @@ protected GalleryImageCollection() { } } public partial class GalleryImageData : Azure.ResourceManager.Models.TrackedResourceData { - public GalleryImageData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GalleryImageData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Compute.Models.ArchitectureType? Architecture { get { throw null; } set { } } public string Description { get { throw null; } set { } } public System.Collections.Generic.IList DisallowedDiskTypes { get { throw null; } } @@ -1231,7 +1231,7 @@ protected GalleryImageVersionCollection() { } } public partial class GalleryImageVersionData : Azure.ResourceManager.Models.TrackedResourceData { - public GalleryImageVersionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GalleryImageVersionData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Compute.Models.GalleryProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Compute.Models.GalleryImageVersionPublishingProfile PublishingProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ReplicationStatus ReplicationStatus { get { throw null; } } @@ -1305,7 +1305,7 @@ protected ManagedDiskCollection() { } } public partial class ManagedDiskData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedDiskData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedDiskData(Azure.Core.AzureLocation location) { } public bool? BurstingEnabled { get { throw null; } set { } } public System.DateTimeOffset? BurstingEnabledOn { get { throw null; } } public float? CompletionPercent { get { throw null; } set { } } @@ -1387,7 +1387,7 @@ protected ProximityPlacementGroupCollection() { } } public partial class ProximityPlacementGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public ProximityPlacementGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ProximityPlacementGroupData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList AvailabilitySets { get { throw null; } } public Azure.ResourceManager.Compute.Models.InstanceViewStatus ColocationStatus { get { throw null; } set { } } public System.Collections.Generic.IList IntentVmSizes { get { throw null; } } @@ -1458,7 +1458,7 @@ protected RestorePointGroupCollection() { } } public partial class RestorePointGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public RestorePointGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public RestorePointGroupData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public string RestorePointGroupId { get { throw null; } } public System.Collections.Generic.IReadOnlyList RestorePoints { get { throw null; } } @@ -1637,7 +1637,7 @@ protected SnapshotCollection() { } } public partial class SnapshotData : Azure.ResourceManager.Models.TrackedResourceData { - public SnapshotData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SnapshotData(Azure.Core.AzureLocation location) { } public float? CompletionPercent { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.CopyCompletionError CopyCompletionError { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.DiskCreationData CreationData { get { throw null; } set { } } @@ -1708,7 +1708,7 @@ protected SshPublicKeyCollection() { } } public partial class SshPublicKeyData : Azure.ResourceManager.Models.TrackedResourceData { - public SshPublicKeyData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SshPublicKeyData(Azure.Core.AzureLocation location) { } public string PublicKey { get { throw null; } set { } } } public partial class SshPublicKeyResource : Azure.ResourceManager.ArmResource @@ -1756,7 +1756,7 @@ protected VirtualMachineCollection() { } } public partial class VirtualMachineData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Compute.Models.AdditionalCapabilities AdditionalCapabilities { get { throw null; } set { } } public Azure.Core.ResourceIdentifier AvailabilitySetId { get { throw null; } set { } } public double? BillingMaxPrice { get { throw null; } set { } } @@ -1810,7 +1810,7 @@ protected VirtualMachineExtensionCollection() { } } public partial class VirtualMachineExtensionData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineExtensionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineExtensionData(Azure.Core.AzureLocation location) { } public bool? AutoUpgradeMinorVersion { get { throw null; } set { } } public bool? EnableAutomaticUpgrade { get { throw null; } set { } } public string ExtensionType { get { throw null; } set { } } @@ -1846,7 +1846,7 @@ protected VirtualMachineExtensionImageCollection() { } } public partial class VirtualMachineExtensionImageData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineExtensionImageData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineExtensionImageData(Azure.Core.AzureLocation location) { } public string ComputeRole { get { throw null; } set { } } public string HandlerSchema { get { throw null; } set { } } public string OperatingSystem { get { throw null; } set { } } @@ -1982,7 +1982,7 @@ protected VirtualMachineRunCommandCollection() { } } public partial class VirtualMachineRunCommandData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineRunCommandData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineRunCommandData(Azure.Core.AzureLocation location) { } public bool? AsyncExecution { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.RunCommandManagedIdentity ErrorBlobManagedIdentity { get { throw null; } set { } } public System.Uri ErrorBlobUri { get { throw null; } set { } } @@ -2037,7 +2037,7 @@ protected VirtualMachineScaleSetCollection() { } } public partial class VirtualMachineScaleSetData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineScaleSetData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineScaleSetData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Compute.Models.AdditionalCapabilities AdditionalCapabilities { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.AutomaticRepairsPolicy AutomaticRepairsPolicy { get { throw null; } set { } } public bool? DoNotRunExtensionsOnOverprovisionedVms { get { throw null; } set { } } @@ -2186,7 +2186,7 @@ protected VirtualMachineScaleSetResource() { } } public partial class VirtualMachineScaleSetRollingUpgradeData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineScaleSetRollingUpgradeData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineScaleSetRollingUpgradeData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Compute.Models.ComputeApiError Error { get { throw null; } } public Azure.ResourceManager.Compute.Models.RollingUpgradePolicy Policy { get { throw null; } } public Azure.ResourceManager.Compute.Models.RollingUpgradeProgressInfo Progress { get { throw null; } } @@ -2239,7 +2239,7 @@ protected VirtualMachineScaleSetVmCollection() { } } public partial class VirtualMachineScaleSetVmData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineScaleSetVmData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineScaleSetVmData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Compute.Models.AdditionalCapabilities AdditionalCapabilities { get { throw null; } set { } } public Azure.Core.ResourceIdentifier AvailabilitySetId { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.BootDiagnostics BootDiagnostics { get { throw null; } set { } } @@ -2404,6 +2404,203 @@ protected VirtualMachineScaleSetVmRunCommandResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Compute.Models.VirtualMachineRunCommandUpdate runCommand, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Compute.Mocking +{ + public partial class MockableComputeArmClient : Azure.ResourceManager.ArmResource + { + protected MockableComputeArmClient() { } + public virtual Azure.ResourceManager.Compute.AvailabilitySetResource GetAvailabilitySetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CapacityReservationGroupResource GetCapacityReservationGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CapacityReservationResource GetCapacityReservationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CloudServiceOSFamilyResource GetCloudServiceOSFamilyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CloudServiceOSVersionResource GetCloudServiceOSVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CloudServiceResource GetCloudServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CloudServiceRoleInstanceResource GetCloudServiceRoleInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CloudServiceRoleResource GetCloudServiceRoleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CommunityGalleryImageResource GetCommunityGalleryImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CommunityGalleryImageVersionResource GetCommunityGalleryImageVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.CommunityGalleryResource GetCommunityGalleryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.ComputePrivateEndpointConnectionResource GetComputePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.DedicatedHostGroupResource GetDedicatedHostGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.DedicatedHostResource GetDedicatedHostResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.DiskAccessResource GetDiskAccessResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.DiskEncryptionSetResource GetDiskEncryptionSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.DiskImageResource GetDiskImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.DiskRestorePointResource GetDiskRestorePointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.GalleryApplicationResource GetGalleryApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.GalleryApplicationVersionResource GetGalleryApplicationVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.GalleryImageResource GetGalleryImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.GalleryImageVersionResource GetGalleryImageVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.GalleryResource GetGalleryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.ManagedDiskResource GetManagedDiskResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.ProximityPlacementGroupResource GetProximityPlacementGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.RestorePointGroupResource GetRestorePointGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.RestorePointResource GetRestorePointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.SharedGalleryImageResource GetSharedGalleryImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.SharedGalleryImageVersionResource GetSharedGalleryImageVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.SharedGalleryResource GetSharedGalleryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.SnapshotResource GetSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.SshPublicKeyResource GetSshPublicKeyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineExtensionImageResource GetVirtualMachineExtensionImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineExtensionResource GetVirtualMachineExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineResource GetVirtualMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineRunCommandResource GetVirtualMachineRunCommandResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionResource GetVirtualMachineScaleSetExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineScaleSetResource GetVirtualMachineScaleSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineScaleSetRollingUpgradeResource GetVirtualMachineScaleSetRollingUpgradeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineScaleSetVmExtensionResource GetVirtualMachineScaleSetVmExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineScaleSetVmResource GetVirtualMachineScaleSetVmResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineScaleSetVmRunCommandResource GetVirtualMachineScaleSetVmRunCommandResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableComputeResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableComputeResourceGroupResource() { } + public virtual Azure.Response GetAvailabilitySet(string availabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailabilitySetAsync(string availabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.AvailabilitySetCollection GetAvailabilitySets() { throw null; } + public virtual Azure.Response GetCapacityReservationGroup(string capacityReservationGroupName, Azure.ResourceManager.Compute.Models.CapacityReservationGroupInstanceViewType? expand = default(Azure.ResourceManager.Compute.Models.CapacityReservationGroupInstanceViewType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCapacityReservationGroupAsync(string capacityReservationGroupName, Azure.ResourceManager.Compute.Models.CapacityReservationGroupInstanceViewType? expand = default(Azure.ResourceManager.Compute.Models.CapacityReservationGroupInstanceViewType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.CapacityReservationGroupCollection GetCapacityReservationGroups() { throw null; } + public virtual Azure.Response GetCloudService(string cloudServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCloudServiceAsync(string cloudServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.CloudServiceCollection GetCloudServices() { throw null; } + public virtual Azure.Response GetDedicatedHostGroup(string hostGroupName, Azure.ResourceManager.Compute.Models.InstanceViewType? expand = default(Azure.ResourceManager.Compute.Models.InstanceViewType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDedicatedHostGroupAsync(string hostGroupName, Azure.ResourceManager.Compute.Models.InstanceViewType? expand = default(Azure.ResourceManager.Compute.Models.InstanceViewType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.DedicatedHostGroupCollection GetDedicatedHostGroups() { throw null; } + public virtual Azure.Response GetDiskAccess(string diskAccessName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiskAccessAsync(string diskAccessName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.DiskAccessCollection GetDiskAccesses() { throw null; } + public virtual Azure.Response GetDiskEncryptionSet(string diskEncryptionSetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiskEncryptionSetAsync(string diskEncryptionSetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.DiskEncryptionSetCollection GetDiskEncryptionSets() { throw null; } + public virtual Azure.Response GetDiskImage(string imageName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiskImageAsync(string imageName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.DiskImageCollection GetDiskImages() { throw null; } + public virtual Azure.ResourceManager.Compute.GalleryCollection GetGalleries() { throw null; } + public virtual Azure.Response GetGallery(string galleryName, Azure.ResourceManager.Compute.Models.SelectPermission? select = default(Azure.ResourceManager.Compute.Models.SelectPermission?), Azure.ResourceManager.Compute.Models.GalleryExpand? expand = default(Azure.ResourceManager.Compute.Models.GalleryExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGalleryAsync(string galleryName, Azure.ResourceManager.Compute.Models.SelectPermission? select = default(Azure.ResourceManager.Compute.Models.SelectPermission?), Azure.ResourceManager.Compute.Models.GalleryExpand? expand = default(Azure.ResourceManager.Compute.Models.GalleryExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetManagedDisk(string diskName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedDiskAsync(string diskName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.ManagedDiskCollection GetManagedDisks() { throw null; } + public virtual Azure.Response GetProximityPlacementGroup(string proximityPlacementGroupName, string includeColocationStatus = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetProximityPlacementGroupAsync(string proximityPlacementGroupName, string includeColocationStatus = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.ProximityPlacementGroupCollection GetProximityPlacementGroups() { throw null; } + public virtual Azure.Response GetRestorePointGroup(string restorePointGroupName, Azure.ResourceManager.Compute.Models.RestorePointGroupExpand? expand = default(Azure.ResourceManager.Compute.Models.RestorePointGroupExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRestorePointGroupAsync(string restorePointGroupName, Azure.ResourceManager.Compute.Models.RestorePointGroupExpand? expand = default(Azure.ResourceManager.Compute.Models.RestorePointGroupExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.RestorePointGroupCollection GetRestorePointGroups() { throw null; } + public virtual Azure.Response GetSnapshot(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSnapshotAsync(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.SnapshotCollection GetSnapshots() { throw null; } + public virtual Azure.Response GetSshPublicKey(string sshPublicKeyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSshPublicKeyAsync(string sshPublicKeyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.SshPublicKeyCollection GetSshPublicKeys() { throw null; } + public virtual Azure.Response GetVirtualMachine(string vmName, Azure.ResourceManager.Compute.Models.InstanceViewType? expand = default(Azure.ResourceManager.Compute.Models.InstanceViewType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineAsync(string vmName, Azure.ResourceManager.Compute.Models.InstanceViewType? expand = default(Azure.ResourceManager.Compute.Models.InstanceViewType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineCollection GetVirtualMachines() { throw null; } + public virtual Azure.Response GetVirtualMachineScaleSet(string virtualMachineScaleSetName, Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetGetExpand? expand = default(Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetGetExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineScaleSetAsync(string virtualMachineScaleSetName, Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetGetExpand? expand = default(Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetGetExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineScaleSetCollection GetVirtualMachineScaleSets() { throw null; } + } + public partial class MockableComputeSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableComputeSubscriptionResource() { } + public virtual Azure.ResourceManager.ArmOperation ExportLogAnalyticsRequestRateByInterval(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.RequestRateByIntervalContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportLogAnalyticsRequestRateByIntervalAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.RequestRateByIntervalContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation ExportLogAnalyticsThrottledRequests(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.ThrottledRequestsContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportLogAnalyticsThrottledRequestsAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Compute.Models.ThrottledRequestsContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailabilitySets(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailabilitySetsAsync(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCapacityReservationGroups(Azure.ResourceManager.Compute.Models.CapacityReservationGroupGetExpand? expand = default(Azure.ResourceManager.Compute.Models.CapacityReservationGroupGetExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCapacityReservationGroupsAsync(Azure.ResourceManager.Compute.Models.CapacityReservationGroupGetExpand? expand = default(Azure.ResourceManager.Compute.Models.CapacityReservationGroupGetExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.CloudServiceOSFamilyCollection GetCloudServiceOSFamilies(Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response GetCloudServiceOSFamily(Azure.Core.AzureLocation location, string osFamilyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCloudServiceOSFamilyAsync(Azure.Core.AzureLocation location, string osFamilyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCloudServiceOSVersion(Azure.Core.AzureLocation location, string osVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCloudServiceOSVersionAsync(Azure.Core.AzureLocation location, string osVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.CloudServiceOSVersionCollection GetCloudServiceOSVersions(Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Pageable GetCloudServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCloudServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.CommunityGalleryCollection GetCommunityGalleries() { throw null; } + public virtual Azure.Response GetCommunityGallery(Azure.Core.AzureLocation location, string publicGalleryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCommunityGalleryAsync(Azure.Core.AzureLocation location, string publicGalleryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetComputeResourceSkus(string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetComputeResourceSkusAsync(string filter = null, string includeExtendedLocations = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDedicatedHostGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDedicatedHostGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDiskAccesses(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDiskAccessesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDiskEncryptionSets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDiskEncryptionSetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDiskImages(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDiskImagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetGalleries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGalleriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedDisks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedDisksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetOffersVirtualMachineImagesEdgeZones(Azure.Core.AzureLocation location, string edgeZone, string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOffersVirtualMachineImagesEdgeZonesAsync(Azure.Core.AzureLocation location, string edgeZone, string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProximityPlacementGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProximityPlacementGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPublishersVirtualMachineImagesEdgeZones(Azure.Core.AzureLocation location, string edgeZone, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPublishersVirtualMachineImagesEdgeZonesAsync(Azure.Core.AzureLocation location, string edgeZone, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRestorePointGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRestorePointGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.SharedGalleryCollection GetSharedGalleries(Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response GetSharedGallery(Azure.Core.AzureLocation location, string galleryUniqueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSharedGalleryAsync(Azure.Core.AzureLocation location, string galleryUniqueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSnapshots(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSnapshotsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSshPublicKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSshPublicKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsages(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetVirtualMachineExtensionImage(Azure.Core.AzureLocation location, string publisherName, string type, string version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineExtensionImageAsync(Azure.Core.AzureLocation location, string publisherName, string type, string version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Compute.VirtualMachineExtensionImageCollection GetVirtualMachineExtensionImages(Azure.Core.AzureLocation location, string publisherName) { throw null; } + public virtual Azure.Response GetVirtualMachineImage(Azure.Core.AzureLocation location, string publisherName, string offer, string skus, string version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineImageAsync(Azure.Core.AzureLocation location, string publisherName, string offer, string skus, string version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImageEdgeZoneSkus(Azure.Core.AzureLocation location, string edgeZone, string publisherName, string offer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImageEdgeZoneSkusAsync(Azure.Core.AzureLocation location, string edgeZone, string publisherName, string offer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImageOffers(Azure.Core.AzureLocation location, string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImageOffersAsync(Azure.Core.AzureLocation location, string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImagePublishers(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImagePublishersAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImages(Azure.Core.AzureLocation location, string publisherName, string offer, string skus, string expand = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImages(Azure.ResourceManager.Compute.Models.SubscriptionResourceGetVirtualMachineImagesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImagesAsync(Azure.Core.AzureLocation location, string publisherName, string offer, string skus, string expand = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImagesAsync(Azure.ResourceManager.Compute.Models.SubscriptionResourceGetVirtualMachineImagesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImagesByEdgeZone(Azure.Core.AzureLocation location, string edgeZone, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImagesByEdgeZoneAsync(Azure.Core.AzureLocation location, string edgeZone, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetVirtualMachineImagesEdgeZone(Azure.Core.AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetVirtualMachineImagesEdgeZone(Azure.ResourceManager.Compute.Models.SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineImagesEdgeZoneAsync(Azure.Core.AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineImagesEdgeZoneAsync(Azure.ResourceManager.Compute.Models.SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImagesEdgeZones(Azure.Core.AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string expand = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImagesEdgeZones(Azure.ResourceManager.Compute.Models.SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImagesEdgeZonesAsync(Azure.Core.AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string expand = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImagesEdgeZonesAsync(Azure.ResourceManager.Compute.Models.SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineImageSkus(Azure.Core.AzureLocation location, string publisherName, string offer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineImageSkusAsync(Azure.Core.AzureLocation location, string publisherName, string offer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetVirtualMachineRunCommand(Azure.Core.AzureLocation location, string commandId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineRunCommandAsync(Azure.Core.AzureLocation location, string commandId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineRunCommands(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineRunCommandsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachines(string statusOnly = null, string filter = null, Azure.ResourceManager.Compute.Models.ExpandTypesForListVm? expand = default(Azure.ResourceManager.Compute.Models.ExpandTypesForListVm?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetVirtualMachines(string statusOnly = null, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachinesAsync(string statusOnly = null, string filter = null, Azure.ResourceManager.Compute.Models.ExpandTypesForListVm? expand = default(Azure.ResourceManager.Compute.Models.ExpandTypesForListVm?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetVirtualMachinesAsync(string statusOnly = null, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachinesByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachinesByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineScaleSets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineScaleSetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineScaleSetsByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineScaleSetsByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineSizes(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineSizesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Compute.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Customize/Extensions/ComputeExtensions.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Customize/Extensions/ComputeExtensions.cs index ec8b32a30f3a4..5deea23f07714 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Customize/Extensions/ComputeExtensions.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Customize/Extensions/ComputeExtensions.cs @@ -2,14 +2,12 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; using Azure.Core; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Resources; -using System.Threading; -using System.Threading.Tasks; -using System.ComponentModel; namespace Azure.ResourceManager.Compute { @@ -19,14 +17,14 @@ public static partial class ComputeExtensions [EditorBrowsable(EditorBrowsableState.Never)] public static AsyncPageable GetVirtualMachinesAsync(this SubscriptionResource subscriptionResource, string statusOnly, string filter, CancellationToken cancellationToken) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachinesAsync(statusOnly, filter, null, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachinesAsync(statusOnly, filter, cancellationToken); } /// Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. [EditorBrowsable(EditorBrowsableState.Never)] public static Pageable GetVirtualMachines(this SubscriptionResource subscriptionResource, string statusOnly, string filter, CancellationToken cancellationToken) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachines(statusOnly, filter, null, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachines(statusOnly, filter, cancellationToken); } /// @@ -56,16 +54,7 @@ public static Pageable GetVirtualMachines(this Subscript /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, string offer, string skus, string expand = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - Argument.AssertNotNullOrEmpty(skus, nameof(skus)); - - SubscriptionResourceGetVirtualMachineImagesOptions options = new SubscriptionResourceGetVirtualMachineImagesOptions(location, publisherName, offer, skus); - options.Expand = expand; - options.Top = top; - options.Orderby = orderby; - - return subscriptionResource.GetVirtualMachineImagesAsync(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesAsync(location, publisherName, offer, skus, expand, top, orderby, cancellationToken); } /// @@ -95,16 +84,7 @@ public static AsyncPageable GetVirtualMachineImagesAsyn /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImages(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, string offer, string skus, string expand = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - Argument.AssertNotNullOrEmpty(skus, nameof(skus)); - - SubscriptionResourceGetVirtualMachineImagesOptions options = new SubscriptionResourceGetVirtualMachineImagesOptions(location, publisherName, offer, skus); - options.Expand = expand; - options.Top = top; - options.Orderby = orderby; - - return subscriptionResource.GetVirtualMachineImages(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImages(location, publisherName, offer, skus, expand, top, orderby, cancellationToken); } /// @@ -132,15 +112,7 @@ public static Pageable GetVirtualMachineImages(this Sub /// , , , or is null. public static async Task> GetVirtualMachineImagesEdgeZoneAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - Argument.AssertNotNullOrEmpty(skus, nameof(skus)); - Argument.AssertNotNullOrEmpty(version, nameof(version)); - - SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options = new SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions(location, edgeZone, publisherName, offer, skus, version); - - return await subscriptionResource.GetVirtualMachineImagesEdgeZoneAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesEdgeZoneAsync(location, edgeZone, publisherName, offer, skus, version, cancellationToken).ConfigureAwait(false); } /// @@ -168,15 +140,7 @@ public static async Task> GetVirtualMachineImagesE /// , , , or is null. public static Response GetVirtualMachineImagesEdgeZone(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - Argument.AssertNotNullOrEmpty(skus, nameof(skus)); - Argument.AssertNotNullOrEmpty(version, nameof(version)); - - SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options = new SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions(location, edgeZone, publisherName, offer, skus, version); - - return subscriptionResource.GetVirtualMachineImagesEdgeZone(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesEdgeZone(location, edgeZone, publisherName, offer, skus, version, cancellationToken); } /// @@ -207,17 +171,7 @@ public static Response GetVirtualMachineImagesEdgeZone(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImagesEdgeZonesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string expand = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - Argument.AssertNotNullOrEmpty(skus, nameof(skus)); - - SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options = new SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions(location, edgeZone, publisherName, offer, skus); - options.Expand = expand; - options.Top = top; - options.Orderby = orderby; - - return subscriptionResource.GetVirtualMachineImagesEdgeZonesAsync(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesEdgeZonesAsync(location, edgeZone, publisherName, offer, skus, expand, top, orderby, cancellationToken); } /// @@ -248,17 +202,7 @@ public static AsyncPageable GetVirtualMachineImagesEdge /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImagesEdgeZones(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string expand = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - Argument.AssertNotNullOrEmpty(skus, nameof(skus)); - - SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options = new SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions(location, edgeZone, publisherName, offer, skus); - options.Expand = expand; - options.Top = top; - options.Orderby = orderby; - - return subscriptionResource.GetVirtualMachineImagesEdgeZones(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesEdgeZones(location, edgeZone, publisherName, offer, skus, expand, top, orderby, cancellationToken); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Customize/Extensions/ComputeSubscriptionMockingExtension.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Customize/Extensions/ComputeSubscriptionMockingExtension.cs new file mode 100644 index 0000000000000..ffdb9d110a86e --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Customize/Extensions/ComputeSubscriptionMockingExtension.cs @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Compute.Models; + +namespace Azure.ResourceManager.Compute.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableComputeSubscriptionResource : ArmResource + { + /// + /// Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListAll + /// + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + /// The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetVirtualMachinesAsync(string statusOnly = null, string filter = null, CancellationToken cancellationToken = default) + { + return GetVirtualMachinesAsync(statusOnly, filter, null, cancellationToken); + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListAll + /// + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + /// The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetVirtualMachines(string statusOnly = null, string filter = null, CancellationToken cancellationToken = default) + { + return GetVirtualMachines(statusOnly, filter, null, cancellationToken); + } + + /// + /// Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions + /// + /// + /// Operation Id + /// VirtualMachineImages_List + /// + /// + /// + /// The name of a supported Azure region. + /// A valid image publisher. + /// A valid image publisher offer. + /// A valid image SKU. + /// The expand expression to apply on the operation. + /// The Integer to use. + /// The String to use. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImagesAsync(AzureLocation location, string publisherName, string offer, string skus, string expand = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + Argument.AssertNotNullOrEmpty(skus, nameof(skus)); + + SubscriptionResourceGetVirtualMachineImagesOptions options = new SubscriptionResourceGetVirtualMachineImagesOptions(location, publisherName, offer, skus); + options.Expand = expand; + options.Top = top; + options.Orderby = orderby; + + return GetVirtualMachineImagesAsync(options, cancellationToken); + } + + /// + /// Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions + /// + /// + /// Operation Id + /// VirtualMachineImages_List + /// + /// + /// + /// The name of a supported Azure region. + /// A valid image publisher. + /// A valid image publisher offer. + /// A valid image SKU. + /// The expand expression to apply on the operation. + /// The Integer to use. + /// The String to use. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImages(AzureLocation location, string publisherName, string offer, string skus, string expand = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + Argument.AssertNotNullOrEmpty(skus, nameof(skus)); + + SubscriptionResourceGetVirtualMachineImagesOptions options = new SubscriptionResourceGetVirtualMachineImagesOptions(location, publisherName, offer, skus); + options.Expand = expand; + options.Top = top; + options.Orderby = orderby; + + return GetVirtualMachineImages(options, cancellationToken); + } + + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_Get + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// A valid image publisher. + /// A valid image publisher offer. + /// A valid image SKU. + /// A valid image SKU version. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual async Task> GetVirtualMachineImagesEdgeZoneAsync(AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + Argument.AssertNotNullOrEmpty(skus, nameof(skus)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options = new SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions(location, edgeZone, publisherName, offer, skus, version); + + return await GetVirtualMachineImagesEdgeZoneAsync(options, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_Get + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// A valid image publisher. + /// A valid image publisher offer. + /// A valid image SKU. + /// A valid image SKU version. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual Response GetVirtualMachineImagesEdgeZone(AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + Argument.AssertNotNullOrEmpty(skus, nameof(skus)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options = new SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions(location, edgeZone, publisherName, offer, skus, version); + + return GetVirtualMachineImagesEdgeZone(options, cancellationToken); + } + + /// + /// Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_List + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// A valid image publisher. + /// A valid image publisher offer. + /// A valid image SKU. + /// The expand expression to apply on the operation. + /// An integer value specifying the number of images to return that matches supplied values. + /// Specifies the order of the results returned. Formatted as an OData query. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImagesEdgeZonesAsync(AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string expand = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + Argument.AssertNotNullOrEmpty(skus, nameof(skus)); + + SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options = new SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions(location, edgeZone, publisherName, offer, skus); + options.Expand = expand; + options.Top = top; + options.Orderby = orderby; + + return GetVirtualMachineImagesEdgeZonesAsync(options, cancellationToken); + } + + /// + /// Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_List + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// A valid image publisher. + /// A valid image publisher offer. + /// A valid image SKU. + /// The expand expression to apply on the operation. + /// An integer value specifying the number of images to return that matches supplied values. + /// Specifies the order of the results returned. Formatted as an OData query. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImagesEdgeZones(AzureLocation location, string edgeZone, string publisherName, string offer, string skus, string expand = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + Argument.AssertNotNullOrEmpty(skus, nameof(skus)); + + SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options = new SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions(location, edgeZone, publisherName, offer, skus); + options.Expand = expand; + options.Top = top; + options.Orderby = orderby; + + return GetVirtualMachineImagesEdgeZones(options, cancellationToken); + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetResource.cs index 50767235e87fb..2ee303b3955e6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Compute public partial class AvailabilitySetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The availabilitySetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string availabilitySetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupResource.cs index b7dc984517186..db6dc49faf2a9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class CapacityReservationGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The capacityReservationGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string capacityReservationGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CapacityReservationResources and their operations over a CapacityReservationResource. public virtual CapacityReservationCollection GetCapacityReservations() { - return GetCachedClient(Client => new CapacityReservationCollection(Client, Id)); + return GetCachedClient(client => new CapacityReservationCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual CapacityReservationCollection GetCapacityReservations() /// The name of the capacity reservation. /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCapacityReservationAsync(string capacityReservationName, CapacityReservationInstanceViewType? expand = null, CancellationToken cancellationToken = default) { @@ -136,8 +139,8 @@ public virtual async Task> GetCapacityRese /// The name of the capacity reservation. /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCapacityReservation(string capacityReservationName, CapacityReservationInstanceViewType? expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationResource.cs index 5f5e41523a6f2..fa04795625f8c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Compute public partial class CapacityReservationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The capacityReservationGroupName. + /// The capacityReservationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string capacityReservationGroupName, string capacityReservationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyResource.cs index edd055f509424..803d59f5e8c00 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSFamilyResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Compute public partial class CloudServiceOSFamilyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The osFamilyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string osFamilyName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionResource.cs index 6994540494186..c2e948b63a53a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceOSVersionResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Compute public partial class CloudServiceOSVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The osVersionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string osVersionName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceResource.cs index eadfaa08a8814..17b60c67e69fb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Compute public partial class CloudServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cloudServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cloudServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CloudServiceRoleInstanceResources and their operations over a CloudServiceRoleInstanceResource. public virtual CloudServiceRoleInstanceCollection GetCloudServiceRoleInstances() { - return GetCachedClient(Client => new CloudServiceRoleInstanceCollection(Client, Id)); + return GetCachedClient(client => new CloudServiceRoleInstanceCollection(client, Id)); } /// @@ -117,8 +120,8 @@ public virtual CloudServiceRoleInstanceCollection GetCloudServiceRoleInstances() /// Name of the role instance. /// The expand expression to apply to the operation. 'UserData' is not supported for cloud services. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCloudServiceRoleInstanceAsync(string roleInstanceName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { @@ -141,8 +144,8 @@ public virtual async Task> GetCloudSe /// Name of the role instance. /// The expand expression to apply to the operation. 'UserData' is not supported for cloud services. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCloudServiceRoleInstance(string roleInstanceName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { @@ -153,7 +156,7 @@ public virtual Response GetCloudServiceRoleIns /// An object representing collection of CloudServiceRoleResources and their operations over a CloudServiceRoleResource. public virtual CloudServiceRoleCollection GetCloudServiceRoles() { - return GetCachedClient(Client => new CloudServiceRoleCollection(Client, Id)); + return GetCachedClient(client => new CloudServiceRoleCollection(client, Id)); } /// @@ -171,8 +174,8 @@ public virtual CloudServiceRoleCollection GetCloudServiceRoles() /// /// Name of the role. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCloudServiceRoleAsync(string roleName, CancellationToken cancellationToken = default) { @@ -194,8 +197,8 @@ public virtual async Task> GetCloudServiceRol /// /// Name of the role. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCloudServiceRole(string roleName, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceResource.cs index 56032e72268a3..c05f47682ec5c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleInstanceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Compute public partial class CloudServiceRoleInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cloudServiceName. + /// The roleInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cloudServiceName, string roleInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleResource.cs index 7c7737e867015..140ca8d22f5ee 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceRoleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Compute public partial class CloudServiceRoleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cloudServiceName. + /// The roleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cloudServiceName, string roleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageResource.cs index 2a4412fefbb36..1fc0f2cc7bf4f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Compute public partial class CommunityGalleryImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The publicGalleryName. + /// The galleryImageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string publicGalleryName, string galleryImageName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CommunityGalleryImageVersionResources and their operations over a CommunityGalleryImageVersionResource. public virtual CommunityGalleryImageVersionCollection GetCommunityGalleryImageVersions() { - return GetCachedClient(Client => new CommunityGalleryImageVersionCollection(Client, Id)); + return GetCachedClient(client => new CommunityGalleryImageVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual CommunityGalleryImageVersionCollection GetCommunityGalleryImageVe /// /// The name of the community gallery image version. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCommunityGalleryImageVersionAsync(string galleryImageVersionName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetCom /// /// The name of the community gallery image version. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCommunityGalleryImageVersion(string galleryImageVersionName, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionResource.cs index c6795b63be634..6a3b7277dc45e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageVersionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Compute public partial class CommunityGalleryImageVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The publicGalleryName. + /// The galleryImageName. + /// The galleryImageVersionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string publicGalleryName, string galleryImageName, string galleryImageVersionName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryResource.cs index 503e48fae1606..0375e997a8ec4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Compute public partial class CommunityGalleryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The publicGalleryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string publicGalleryName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}"; @@ -91,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CommunityGalleryImageResources and their operations over a CommunityGalleryImageResource. public virtual CommunityGalleryImageCollection GetCommunityGalleryImages() { - return GetCachedClient(Client => new CommunityGalleryImageCollection(Client, Id)); + return GetCachedClient(client => new CommunityGalleryImageCollection(client, Id)); } /// @@ -109,8 +112,8 @@ public virtual CommunityGalleryImageCollection GetCommunityGalleryImages() /// /// The name of the community gallery image definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCommunityGalleryImageAsync(string galleryImageName, CancellationToken cancellationToken = default) { @@ -132,8 +135,8 @@ public virtual async Task> GetCommunityG /// /// The name of the community gallery image definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCommunityGalleryImage(string galleryImageName, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionResource.cs index e5e3defb73ce5..ef4c0e3634d48 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ComputePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Compute public partial class ComputePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The diskAccessName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string diskAccessName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupResource.cs index d84d6bc3bc50d..403dc6b455277 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class DedicatedHostGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DedicatedHostResources and their operations over a DedicatedHostResource. public virtual DedicatedHostCollection GetDedicatedHosts() { - return GetCachedClient(Client => new DedicatedHostCollection(Client, Id)); + return GetCachedClient(client => new DedicatedHostCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual DedicatedHostCollection GetDedicatedHosts() /// The name of the dedicated host. /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated host. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDedicatedHostAsync(string hostName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { @@ -136,8 +139,8 @@ public virtual async Task> GetDedicatedHostAsync /// The name of the dedicated host. /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated host. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDedicatedHost(string hostName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostResource.cs index bd8b1f8535bd3..6cdde95eebce1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Compute public partial class DedicatedHostResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostGroupName. + /// The hostName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostGroupName, string hostName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessResource.cs index 780ccbd4f9925..be1a73475a428 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Compute public partial class DiskAccessResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The diskAccessName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string diskAccessName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ComputePrivateEndpointConnectionResources and their operations over a ComputePrivateEndpointConnectionResource. public virtual ComputePrivateEndpointConnectionCollection GetComputePrivateEndpointConnections() { - return GetCachedClient(Client => new ComputePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ComputePrivateEndpointConnectionCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual ComputePrivateEndpointConnectionCollection GetComputePrivateEndpo /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetComputePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> Ge /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetComputePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetResource.cs index 2dc14cd3ab92d..a592eb294c828 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskEncryptionSetResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Compute public partial class DiskEncryptionSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The diskEncryptionSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string diskEncryptionSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageResource.cs index c05971eb10e5e..8ff0114bb381f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskImageResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class DiskImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The imageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string imageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointResource.cs index 98e55ec1b6bbf..34a43a5592303 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskRestorePointResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Compute public partial class DiskRestorePointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The restorePointGroupName. + /// The vmRestorePointName. + /// The diskRestorePointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string restorePointGroupName, string vmRestorePointName, string diskRestorePointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointGroupName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs index 17853a10e7c14..1d7fa8b0976da 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Compute.Mocking; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Resources; @@ -19,841 +20,705 @@ namespace Azure.ResourceManager.Compute /// A class to add extension methods to Azure.ResourceManager.Compute. public static partial class ComputeExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableComputeArmClient GetMockableComputeArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableComputeArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableComputeResourceGroupResource GetMockableComputeResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableComputeResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableComputeSubscriptionResource GetMockableComputeSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableComputeSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region VirtualMachineScaleSetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineScaleSetResource GetVirtualMachineScaleSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineScaleSetResource.ValidateResourceId(id); - return new VirtualMachineScaleSetResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineScaleSetResource(id); } - #endregion - #region VirtualMachineScaleSetExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineScaleSetExtensionResource GetVirtualMachineScaleSetExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineScaleSetExtensionResource.ValidateResourceId(id); - return new VirtualMachineScaleSetExtensionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineScaleSetExtensionResource(id); } - #endregion - #region VirtualMachineScaleSetRollingUpgradeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineScaleSetRollingUpgradeResource GetVirtualMachineScaleSetRollingUpgradeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineScaleSetRollingUpgradeResource.ValidateResourceId(id); - return new VirtualMachineScaleSetRollingUpgradeResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineScaleSetRollingUpgradeResource(id); } - #endregion - #region VirtualMachineScaleSetVmExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineScaleSetVmExtensionResource GetVirtualMachineScaleSetVmExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineScaleSetVmExtensionResource.ValidateResourceId(id); - return new VirtualMachineScaleSetVmExtensionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineScaleSetVmExtensionResource(id); } - #endregion - #region VirtualMachineScaleSetVmResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineScaleSetVmResource GetVirtualMachineScaleSetVmResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineScaleSetVmResource.ValidateResourceId(id); - return new VirtualMachineScaleSetVmResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineScaleSetVmResource(id); } - #endregion - #region VirtualMachineExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineExtensionResource GetVirtualMachineExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineExtensionResource.ValidateResourceId(id); - return new VirtualMachineExtensionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineExtensionResource(id); } - #endregion - #region VirtualMachineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineResource GetVirtualMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineResource.ValidateResourceId(id); - return new VirtualMachineResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineResource(id); } - #endregion - #region VirtualMachineExtensionImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineExtensionImageResource GetVirtualMachineExtensionImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineExtensionImageResource.ValidateResourceId(id); - return new VirtualMachineExtensionImageResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineExtensionImageResource(id); } - #endregion - #region AvailabilitySetResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvailabilitySetResource GetAvailabilitySetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvailabilitySetResource.ValidateResourceId(id); - return new AvailabilitySetResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetAvailabilitySetResource(id); } - #endregion - #region ProximityPlacementGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProximityPlacementGroupResource GetProximityPlacementGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProximityPlacementGroupResource.ValidateResourceId(id); - return new ProximityPlacementGroupResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetProximityPlacementGroupResource(id); } - #endregion - #region DedicatedHostGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DedicatedHostGroupResource GetDedicatedHostGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DedicatedHostGroupResource.ValidateResourceId(id); - return new DedicatedHostGroupResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetDedicatedHostGroupResource(id); } - #endregion - #region DedicatedHostResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DedicatedHostResource GetDedicatedHostResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DedicatedHostResource.ValidateResourceId(id); - return new DedicatedHostResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetDedicatedHostResource(id); } - #endregion - #region SshPublicKeyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SshPublicKeyResource GetSshPublicKeyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SshPublicKeyResource.ValidateResourceId(id); - return new SshPublicKeyResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetSshPublicKeyResource(id); } - #endregion - #region DiskImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DiskImageResource GetDiskImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DiskImageResource.ValidateResourceId(id); - return new DiskImageResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetDiskImageResource(id); } - #endregion - #region RestorePointGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RestorePointGroupResource GetRestorePointGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RestorePointGroupResource.ValidateResourceId(id); - return new RestorePointGroupResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetRestorePointGroupResource(id); } - #endregion - #region RestorePointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RestorePointResource GetRestorePointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RestorePointResource.ValidateResourceId(id); - return new RestorePointResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetRestorePointResource(id); } - #endregion - #region CapacityReservationGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CapacityReservationGroupResource GetCapacityReservationGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CapacityReservationGroupResource.ValidateResourceId(id); - return new CapacityReservationGroupResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCapacityReservationGroupResource(id); } - #endregion - #region CapacityReservationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CapacityReservationResource GetCapacityReservationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CapacityReservationResource.ValidateResourceId(id); - return new CapacityReservationResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCapacityReservationResource(id); } - #endregion - #region VirtualMachineRunCommandResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineRunCommandResource GetVirtualMachineRunCommandResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineRunCommandResource.ValidateResourceId(id); - return new VirtualMachineRunCommandResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineRunCommandResource(id); } - #endregion - #region VirtualMachineScaleSetVmRunCommandResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineScaleSetVmRunCommandResource GetVirtualMachineScaleSetVmRunCommandResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineScaleSetVmRunCommandResource.ValidateResourceId(id); - return new VirtualMachineScaleSetVmRunCommandResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetVirtualMachineScaleSetVmRunCommandResource(id); } - #endregion - #region ManagedDiskResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDiskResource GetManagedDiskResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDiskResource.ValidateResourceId(id); - return new ManagedDiskResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetManagedDiskResource(id); } - #endregion - #region DiskAccessResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DiskAccessResource GetDiskAccessResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DiskAccessResource.ValidateResourceId(id); - return new DiskAccessResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetDiskAccessResource(id); } - #endregion - #region ComputePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ComputePrivateEndpointConnectionResource GetComputePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ComputePrivateEndpointConnectionResource.ValidateResourceId(id); - return new ComputePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetComputePrivateEndpointConnectionResource(id); } - #endregion - #region DiskEncryptionSetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DiskEncryptionSetResource GetDiskEncryptionSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DiskEncryptionSetResource.ValidateResourceId(id); - return new DiskEncryptionSetResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetDiskEncryptionSetResource(id); } - #endregion - #region DiskRestorePointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DiskRestorePointResource GetDiskRestorePointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DiskRestorePointResource.ValidateResourceId(id); - return new DiskRestorePointResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetDiskRestorePointResource(id); } - #endregion - #region SnapshotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SnapshotResource GetSnapshotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SnapshotResource.ValidateResourceId(id); - return new SnapshotResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetSnapshotResource(id); } - #endregion - #region GalleryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GalleryResource GetGalleryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GalleryResource.ValidateResourceId(id); - return new GalleryResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetGalleryResource(id); } - #endregion - #region GalleryImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GalleryImageResource GetGalleryImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GalleryImageResource.ValidateResourceId(id); - return new GalleryImageResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetGalleryImageResource(id); } - #endregion - #region GalleryImageVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GalleryImageVersionResource GetGalleryImageVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GalleryImageVersionResource.ValidateResourceId(id); - return new GalleryImageVersionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetGalleryImageVersionResource(id); } - #endregion - #region GalleryApplicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GalleryApplicationResource GetGalleryApplicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GalleryApplicationResource.ValidateResourceId(id); - return new GalleryApplicationResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetGalleryApplicationResource(id); } - #endregion - #region GalleryApplicationVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GalleryApplicationVersionResource GetGalleryApplicationVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GalleryApplicationVersionResource.ValidateResourceId(id); - return new GalleryApplicationVersionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetGalleryApplicationVersionResource(id); } - #endregion - #region SharedGalleryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SharedGalleryResource GetSharedGalleryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SharedGalleryResource.ValidateResourceId(id); - return new SharedGalleryResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetSharedGalleryResource(id); } - #endregion - #region SharedGalleryImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SharedGalleryImageResource GetSharedGalleryImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SharedGalleryImageResource.ValidateResourceId(id); - return new SharedGalleryImageResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetSharedGalleryImageResource(id); } - #endregion - #region SharedGalleryImageVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SharedGalleryImageVersionResource GetSharedGalleryImageVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SharedGalleryImageVersionResource.ValidateResourceId(id); - return new SharedGalleryImageVersionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetSharedGalleryImageVersionResource(id); } - #endregion - #region CommunityGalleryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CommunityGalleryResource GetCommunityGalleryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CommunityGalleryResource.ValidateResourceId(id); - return new CommunityGalleryResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCommunityGalleryResource(id); } - #endregion - #region CommunityGalleryImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CommunityGalleryImageResource GetCommunityGalleryImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CommunityGalleryImageResource.ValidateResourceId(id); - return new CommunityGalleryImageResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCommunityGalleryImageResource(id); } - #endregion - #region CommunityGalleryImageVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CommunityGalleryImageVersionResource GetCommunityGalleryImageVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CommunityGalleryImageVersionResource.ValidateResourceId(id); - return new CommunityGalleryImageVersionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCommunityGalleryImageVersionResource(id); } - #endregion - #region CloudServiceRoleInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CloudServiceRoleInstanceResource GetCloudServiceRoleInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CloudServiceRoleInstanceResource.ValidateResourceId(id); - return new CloudServiceRoleInstanceResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCloudServiceRoleInstanceResource(id); } - #endregion - #region CloudServiceRoleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CloudServiceRoleResource GetCloudServiceRoleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CloudServiceRoleResource.ValidateResourceId(id); - return new CloudServiceRoleResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCloudServiceRoleResource(id); } - #endregion - #region CloudServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CloudServiceResource GetCloudServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CloudServiceResource.ValidateResourceId(id); - return new CloudServiceResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCloudServiceResource(id); } - #endregion - #region CloudServiceOSVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CloudServiceOSVersionResource GetCloudServiceOSVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CloudServiceOSVersionResource.ValidateResourceId(id); - return new CloudServiceOSVersionResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCloudServiceOSVersionResource(id); } - #endregion - #region CloudServiceOSFamilyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CloudServiceOSFamilyResource GetCloudServiceOSFamilyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CloudServiceOSFamilyResource.ValidateResourceId(id); - return new CloudServiceOSFamilyResource(client, id); - } - ); + return GetMockableComputeArmClient(client).GetCloudServiceOSFamilyResource(id); } - #endregion - /// Gets a collection of VirtualMachineScaleSetResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualMachineScaleSetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualMachineScaleSetResources and their operations over a VirtualMachineScaleSetResource. public static VirtualMachineScaleSetCollection GetVirtualMachineScaleSets(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualMachineScaleSets(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetVirtualMachineScaleSets(); } /// @@ -868,17 +733,21 @@ public static VirtualMachineScaleSetCollection GetVirtualMachineScaleSets(this R /// VirtualMachineScaleSets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VM scale set. /// The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set Create/Update operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualMachineScaleSetAsync(this ResourceGroupResource resourceGroupResource, string virtualMachineScaleSetName, VirtualMachineScaleSetGetExpand? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualMachineScaleSets().GetAsync(virtualMachineScaleSetName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetVirtualMachineScaleSetAsync(virtualMachineScaleSetName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -893,25 +762,35 @@ public static async Task> GetVirtualMac /// VirtualMachineScaleSets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VM scale set. /// The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set Create/Update operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualMachineScaleSet(this ResourceGroupResource resourceGroupResource, string virtualMachineScaleSetName, VirtualMachineScaleSetGetExpand? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualMachineScaleSets().Get(virtualMachineScaleSetName, expand, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetVirtualMachineScaleSet(virtualMachineScaleSetName, expand, cancellationToken); } - /// Gets a collection of VirtualMachineResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualMachineResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualMachineResources and their operations over a VirtualMachineResource. public static VirtualMachineCollection GetVirtualMachines(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualMachines(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetVirtualMachines(); } /// @@ -926,17 +805,21 @@ public static VirtualMachineCollection GetVirtualMachines(this ResourceGroupReso /// VirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual machine. /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualMachineAsync(this ResourceGroupResource resourceGroupResource, string vmName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualMachines().GetAsync(vmName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetVirtualMachineAsync(vmName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -951,25 +834,35 @@ public static async Task> GetVirtualMachineAsyn /// VirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual machine. /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualMachine(this ResourceGroupResource resourceGroupResource, string vmName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualMachines().Get(vmName, expand, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetVirtualMachine(vmName, expand, cancellationToken); } - /// Gets a collection of AvailabilitySetResources in the ResourceGroupResource. + /// + /// Gets a collection of AvailabilitySetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AvailabilitySetResources and their operations over a AvailabilitySetResource. public static AvailabilitySetCollection GetAvailabilitySets(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailabilitySets(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetAvailabilitySets(); } /// @@ -984,16 +877,20 @@ public static AvailabilitySetCollection GetAvailabilitySets(this ResourceGroupRe /// AvailabilitySets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the availability set. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAvailabilitySetAsync(this ResourceGroupResource resourceGroupResource, string availabilitySetName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAvailabilitySets().GetAsync(availabilitySetName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetAvailabilitySetAsync(availabilitySetName, cancellationToken).ConfigureAwait(false); } /// @@ -1008,24 +905,34 @@ public static async Task> GetAvailabilitySetAs /// AvailabilitySets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the availability set. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAvailabilitySet(this ResourceGroupResource resourceGroupResource, string availabilitySetName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAvailabilitySets().Get(availabilitySetName, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetAvailabilitySet(availabilitySetName, cancellationToken); } - /// Gets a collection of ProximityPlacementGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of ProximityPlacementGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ProximityPlacementGroupResources and their operations over a ProximityPlacementGroupResource. public static ProximityPlacementGroupCollection GetProximityPlacementGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetProximityPlacementGroups(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetProximityPlacementGroups(); } /// @@ -1040,17 +947,21 @@ public static ProximityPlacementGroupCollection GetProximityPlacementGroups(this /// ProximityPlacementGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the proximity placement group. /// includeColocationStatus=true enables fetching the colocation status of all the resources in the proximity placement group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetProximityPlacementGroupAsync(this ResourceGroupResource resourceGroupResource, string proximityPlacementGroupName, string includeColocationStatus = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetProximityPlacementGroups().GetAsync(proximityPlacementGroupName, includeColocationStatus, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetProximityPlacementGroupAsync(proximityPlacementGroupName, includeColocationStatus, cancellationToken).ConfigureAwait(false); } /// @@ -1065,25 +976,35 @@ public static async Task> GetProximity /// ProximityPlacementGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the proximity placement group. /// includeColocationStatus=true enables fetching the colocation status of all the resources in the proximity placement group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetProximityPlacementGroup(this ResourceGroupResource resourceGroupResource, string proximityPlacementGroupName, string includeColocationStatus = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetProximityPlacementGroups().Get(proximityPlacementGroupName, includeColocationStatus, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetProximityPlacementGroup(proximityPlacementGroupName, includeColocationStatus, cancellationToken); } - /// Gets a collection of DedicatedHostGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of DedicatedHostGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DedicatedHostGroupResources and their operations over a DedicatedHostGroupResource. public static DedicatedHostGroupCollection GetDedicatedHostGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDedicatedHostGroups(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetDedicatedHostGroups(); } /// @@ -1098,17 +1019,21 @@ public static DedicatedHostGroupCollection GetDedicatedHostGroups(this ResourceG /// DedicatedHostGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the dedicated host group. /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDedicatedHostGroupAsync(this ResourceGroupResource resourceGroupResource, string hostGroupName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDedicatedHostGroups().GetAsync(hostGroupName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetDedicatedHostGroupAsync(hostGroupName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -1123,25 +1048,35 @@ public static async Task> GetDedicatedHostG /// DedicatedHostGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the dedicated host group. /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDedicatedHostGroup(this ResourceGroupResource resourceGroupResource, string hostGroupName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDedicatedHostGroups().Get(hostGroupName, expand, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetDedicatedHostGroup(hostGroupName, expand, cancellationToken); } - /// Gets a collection of SshPublicKeyResources in the ResourceGroupResource. + /// + /// Gets a collection of SshPublicKeyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SshPublicKeyResources and their operations over a SshPublicKeyResource. public static SshPublicKeyCollection GetSshPublicKeys(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSshPublicKeys(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetSshPublicKeys(); } /// @@ -1156,16 +1091,20 @@ public static SshPublicKeyCollection GetSshPublicKeys(this ResourceGroupResource /// SshPublicKeys_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the SSH public key. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSshPublicKeyAsync(this ResourceGroupResource resourceGroupResource, string sshPublicKeyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSshPublicKeys().GetAsync(sshPublicKeyName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetSshPublicKeyAsync(sshPublicKeyName, cancellationToken).ConfigureAwait(false); } /// @@ -1180,24 +1119,34 @@ public static async Task> GetSshPublicKeyAsync(th /// SshPublicKeys_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the SSH public key. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSshPublicKey(this ResourceGroupResource resourceGroupResource, string sshPublicKeyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSshPublicKeys().Get(sshPublicKeyName, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetSshPublicKey(sshPublicKeyName, cancellationToken); } - /// Gets a collection of DiskImageResources in the ResourceGroupResource. + /// + /// Gets a collection of DiskImageResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DiskImageResources and their operations over a DiskImageResource. public static DiskImageCollection GetDiskImages(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDiskImages(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskImages(); } /// @@ -1212,17 +1161,21 @@ public static DiskImageCollection GetDiskImages(this ResourceGroupResource resou /// Images_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the image. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDiskImageAsync(this ResourceGroupResource resourceGroupResource, string imageName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDiskImages().GetAsync(imageName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskImageAsync(imageName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -1237,25 +1190,35 @@ public static async Task> GetDiskImageAsync(this Res /// Images_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the image. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDiskImage(this ResourceGroupResource resourceGroupResource, string imageName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDiskImages().Get(imageName, expand, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskImage(imageName, expand, cancellationToken); } - /// Gets a collection of RestorePointGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of RestorePointGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RestorePointGroupResources and their operations over a RestorePointGroupResource. public static RestorePointGroupCollection GetRestorePointGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRestorePointGroups(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetRestorePointGroups(); } /// @@ -1270,17 +1233,21 @@ public static RestorePointGroupCollection GetRestorePointGroups(this ResourceGro /// RestorePointCollections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the restore point collection. /// The expand expression to apply on the operation. If expand=restorePoints, server will return all contained restore points in the restorePointCollection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRestorePointGroupAsync(this ResourceGroupResource resourceGroupResource, string restorePointGroupName, RestorePointGroupExpand? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetRestorePointGroups().GetAsync(restorePointGroupName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetRestorePointGroupAsync(restorePointGroupName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -1295,25 +1262,35 @@ public static async Task> GetRestorePointGro /// RestorePointCollections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the restore point collection. /// The expand expression to apply on the operation. If expand=restorePoints, server will return all contained restore points in the restorePointCollection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRestorePointGroup(this ResourceGroupResource resourceGroupResource, string restorePointGroupName, RestorePointGroupExpand? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetRestorePointGroups().Get(restorePointGroupName, expand, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetRestorePointGroup(restorePointGroupName, expand, cancellationToken); } - /// Gets a collection of CapacityReservationGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of CapacityReservationGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CapacityReservationGroupResources and their operations over a CapacityReservationGroupResource. public static CapacityReservationGroupCollection GetCapacityReservationGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCapacityReservationGroups(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetCapacityReservationGroups(); } /// @@ -1328,17 +1305,21 @@ public static CapacityReservationGroupCollection GetCapacityReservationGroups(th /// CapacityReservationGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the capacity reservation group. /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCapacityReservationGroupAsync(this ResourceGroupResource resourceGroupResource, string capacityReservationGroupName, CapacityReservationGroupInstanceViewType? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCapacityReservationGroups().GetAsync(capacityReservationGroupName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetCapacityReservationGroupAsync(capacityReservationGroupName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -1353,25 +1334,35 @@ public static async Task> GetCapacity /// CapacityReservationGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the capacity reservation group. /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCapacityReservationGroup(this ResourceGroupResource resourceGroupResource, string capacityReservationGroupName, CapacityReservationGroupInstanceViewType? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCapacityReservationGroups().Get(capacityReservationGroupName, expand, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetCapacityReservationGroup(capacityReservationGroupName, expand, cancellationToken); } - /// Gets a collection of ManagedDiskResources in the ResourceGroupResource. + /// + /// Gets a collection of ManagedDiskResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ManagedDiskResources and their operations over a ManagedDiskResource. public static ManagedDiskCollection GetManagedDisks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetManagedDisks(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetManagedDisks(); } /// @@ -1386,16 +1377,20 @@ public static ManagedDiskCollection GetManagedDisks(this ResourceGroupResource r /// Disks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedDiskAsync(this ResourceGroupResource resourceGroupResource, string diskName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetManagedDisks().GetAsync(diskName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetManagedDiskAsync(diskName, cancellationToken).ConfigureAwait(false); } /// @@ -1410,24 +1405,34 @@ public static async Task> GetManagedDiskAsync(this /// Disks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedDisk(this ResourceGroupResource resourceGroupResource, string diskName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetManagedDisks().Get(diskName, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetManagedDisk(diskName, cancellationToken); } - /// Gets a collection of DiskAccessResources in the ResourceGroupResource. + /// + /// Gets a collection of DiskAccessResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DiskAccessResources and their operations over a DiskAccessResource. public static DiskAccessCollection GetDiskAccesses(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDiskAccesses(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskAccesses(); } /// @@ -1442,16 +1447,20 @@ public static DiskAccessCollection GetDiskAccesses(this ResourceGroupResource re /// DiskAccesses_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDiskAccessAsync(this ResourceGroupResource resourceGroupResource, string diskAccessName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDiskAccesses().GetAsync(diskAccessName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskAccessAsync(diskAccessName, cancellationToken).ConfigureAwait(false); } /// @@ -1466,24 +1475,34 @@ public static async Task> GetDiskAccessAsync(this R /// DiskAccesses_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDiskAccess(this ResourceGroupResource resourceGroupResource, string diskAccessName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDiskAccesses().Get(diskAccessName, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskAccess(diskAccessName, cancellationToken); } - /// Gets a collection of DiskEncryptionSetResources in the ResourceGroupResource. + /// + /// Gets a collection of DiskEncryptionSetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DiskEncryptionSetResources and their operations over a DiskEncryptionSetResource. public static DiskEncryptionSetCollection GetDiskEncryptionSets(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDiskEncryptionSets(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskEncryptionSets(); } /// @@ -1498,16 +1517,20 @@ public static DiskEncryptionSetCollection GetDiskEncryptionSets(this ResourceGro /// DiskEncryptionSets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDiskEncryptionSetAsync(this ResourceGroupResource resourceGroupResource, string diskEncryptionSetName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDiskEncryptionSets().GetAsync(diskEncryptionSetName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskEncryptionSetAsync(diskEncryptionSetName, cancellationToken).ConfigureAwait(false); } /// @@ -1522,24 +1545,34 @@ public static async Task> GetDiskEncryptionS /// DiskEncryptionSets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDiskEncryptionSet(this ResourceGroupResource resourceGroupResource, string diskEncryptionSetName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDiskEncryptionSets().Get(diskEncryptionSetName, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetDiskEncryptionSet(diskEncryptionSetName, cancellationToken); } - /// Gets a collection of SnapshotResources in the ResourceGroupResource. + /// + /// Gets a collection of SnapshotResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SnapshotResources and their operations over a SnapshotResource. public static SnapshotCollection GetSnapshots(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSnapshots(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetSnapshots(); } /// @@ -1554,16 +1587,20 @@ public static SnapshotCollection GetSnapshots(this ResourceGroupResource resourc /// Snapshots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSnapshotAsync(this ResourceGroupResource resourceGroupResource, string snapshotName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSnapshots().GetAsync(snapshotName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetSnapshotAsync(snapshotName, cancellationToken).ConfigureAwait(false); } /// @@ -1578,24 +1615,34 @@ public static async Task> GetSnapshotAsync(this Resou /// Snapshots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSnapshot(this ResourceGroupResource resourceGroupResource, string snapshotName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSnapshots().Get(snapshotName, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetSnapshot(snapshotName, cancellationToken); } - /// Gets a collection of GalleryResources in the ResourceGroupResource. + /// + /// Gets a collection of GalleryResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of GalleryResources and their operations over a GalleryResource. public static GalleryCollection GetGalleries(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetGalleries(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetGalleries(); } /// @@ -1610,18 +1657,22 @@ public static GalleryCollection GetGalleries(this ResourceGroupResource resource /// Galleries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Shared Image Gallery. /// The select expression to apply on the operation. /// The expand query option to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetGalleryAsync(this ResourceGroupResource resourceGroupResource, string galleryName, SelectPermission? select = null, GalleryExpand? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetGalleries().GetAsync(galleryName, select, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetGalleryAsync(galleryName, select, expand, cancellationToken).ConfigureAwait(false); } /// @@ -1636,26 +1687,36 @@ public static async Task> GetGalleryAsync(this Resourc /// Galleries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Shared Image Gallery. /// The select expression to apply on the operation. /// The expand query option to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetGallery(this ResourceGroupResource resourceGroupResource, string galleryName, SelectPermission? select = null, GalleryExpand? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetGalleries().Get(galleryName, select, expand, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetGallery(galleryName, select, expand, cancellationToken); } - /// Gets a collection of CloudServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of CloudServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CloudServiceResources and their operations over a CloudServiceResource. public static CloudServiceCollection GetCloudServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCloudServices(); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetCloudServices(); } /// @@ -1670,16 +1731,20 @@ public static CloudServiceCollection GetCloudServices(this ResourceGroupResource /// CloudServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the cloud service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCloudServiceAsync(this ResourceGroupResource resourceGroupResource, string cloudServiceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCloudServices().GetAsync(cloudServiceName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeResourceGroupResource(resourceGroupResource).GetCloudServiceAsync(cloudServiceName, cancellationToken).ConfigureAwait(false); } /// @@ -1694,30 +1759,38 @@ public static async Task> GetCloudServiceAsync(th /// CloudServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the cloud service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCloudService(this ResourceGroupResource resourceGroupResource, string cloudServiceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCloudServices().Get(cloudServiceName, cancellationToken); + return GetMockableComputeResourceGroupResource(resourceGroupResource).GetCloudService(cloudServiceName, cancellationToken); } - /// Gets a collection of VirtualMachineExtensionImageResources in the SubscriptionResource. + /// + /// Gets a collection of VirtualMachineExtensionImageResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of a supported Azure region. /// The String to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of VirtualMachineExtensionImageResources and their operations over a VirtualMachineExtensionImageResource. public static VirtualMachineExtensionImageCollection GetVirtualMachineExtensionImages(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineExtensionImages(location, publisherName); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineExtensionImages(location, publisherName); } /// @@ -1732,6 +1805,10 @@ public static VirtualMachineExtensionImageCollection GetVirtualMachineExtensionI /// VirtualMachineExtensionImages_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -1739,12 +1816,12 @@ public static VirtualMachineExtensionImageCollection GetVirtualMachineExtensionI /// The String to use. /// The String to use. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualMachineExtensionImageAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, string type, string version, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetVirtualMachineExtensionImages(location, publisherName).GetAsync(type, version, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineExtensionImageAsync(location, publisherName, type, version, cancellationToken).ConfigureAwait(false); } /// @@ -1759,6 +1836,10 @@ public static async Task> GetVirt /// VirtualMachineExtensionImages_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -1766,21 +1847,27 @@ public static async Task> GetVirt /// The String to use. /// The String to use. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualMachineExtensionImage(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, string type, string version, CancellationToken cancellationToken = default) { - return subscriptionResource.GetVirtualMachineExtensionImages(location, publisherName).Get(type, version, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineExtensionImage(location, publisherName, type, version, cancellationToken); } - /// Gets a collection of SharedGalleryResources in the SubscriptionResource. + /// + /// Gets a collection of SharedGalleryResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Resource location. /// An object representing collection of SharedGalleryResources and their operations over a SharedGalleryResource. public static SharedGalleryCollection GetSharedGalleries(this SubscriptionResource subscriptionResource, AzureLocation location) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSharedGalleries(location); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetSharedGalleries(location); } /// @@ -1795,17 +1882,21 @@ public static SharedGalleryCollection GetSharedGalleries(this SubscriptionResour /// SharedGalleries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. /// The unique name of the Shared Gallery. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSharedGalleryAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string galleryUniqueName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSharedGalleries(location).GetAsync(galleryUniqueName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetSharedGalleryAsync(location, galleryUniqueName, cancellationToken).ConfigureAwait(false); } /// @@ -1820,25 +1911,35 @@ public static async Task> GetSharedGalleryAsync( /// SharedGalleries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. /// The unique name of the Shared Gallery. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSharedGallery(this SubscriptionResource subscriptionResource, AzureLocation location, string galleryUniqueName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSharedGalleries(location).Get(galleryUniqueName, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetSharedGallery(location, galleryUniqueName, cancellationToken); } - /// Gets a collection of CommunityGalleryResources in the SubscriptionResource. + /// + /// Gets a collection of CommunityGalleryResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CommunityGalleryResources and their operations over a CommunityGalleryResource. public static CommunityGalleryCollection GetCommunityGalleries(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCommunityGalleries(); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCommunityGalleries(); } /// @@ -1853,17 +1954,21 @@ public static CommunityGalleryCollection GetCommunityGalleries(this Subscription /// CommunityGalleries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. /// The public name of the community gallery. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCommunityGalleryAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string publicGalleryName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetCommunityGalleries().GetAsync(location, publicGalleryName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetCommunityGalleryAsync(location, publicGalleryName, cancellationToken).ConfigureAwait(false); } /// @@ -1878,26 +1983,36 @@ public static async Task> GetCommunityGallery /// CommunityGalleries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource location. /// The public name of the community gallery. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCommunityGallery(this SubscriptionResource subscriptionResource, AzureLocation location, string publicGalleryName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetCommunityGalleries().Get(location, publicGalleryName, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCommunityGallery(location, publicGalleryName, cancellationToken); } - /// Gets a collection of CloudServiceOSVersionResources in the SubscriptionResource. + /// + /// Gets a collection of CloudServiceOSVersionResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Name of the location that the OS versions pertain to. /// An object representing collection of CloudServiceOSVersionResources and their operations over a CloudServiceOSVersionResource. public static CloudServiceOSVersionCollection GetCloudServiceOSVersions(this SubscriptionResource subscriptionResource, AzureLocation location) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCloudServiceOSVersions(location); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCloudServiceOSVersions(location); } /// @@ -1912,17 +2027,21 @@ public static CloudServiceOSVersionCollection GetCloudServiceOSVersions(this Sub /// CloudServiceOperatingSystems_GetOSVersion /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the location that the OS versions pertain to. /// Name of the OS version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCloudServiceOSVersionAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string osVersionName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetCloudServiceOSVersions(location).GetAsync(osVersionName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetCloudServiceOSVersionAsync(location, osVersionName, cancellationToken).ConfigureAwait(false); } /// @@ -1937,26 +2056,36 @@ public static async Task> GetCloudServic /// CloudServiceOperatingSystems_GetOSVersion /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the location that the OS versions pertain to. /// Name of the OS version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCloudServiceOSVersion(this SubscriptionResource subscriptionResource, AzureLocation location, string osVersionName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetCloudServiceOSVersions(location).Get(osVersionName, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCloudServiceOSVersion(location, osVersionName, cancellationToken); } - /// Gets a collection of CloudServiceOSFamilyResources in the SubscriptionResource. + /// + /// Gets a collection of CloudServiceOSFamilyResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Name of the location that the OS families pertain to. /// An object representing collection of CloudServiceOSFamilyResources and their operations over a CloudServiceOSFamilyResource. public static CloudServiceOSFamilyCollection GetCloudServiceOSFamilies(this SubscriptionResource subscriptionResource, AzureLocation location) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCloudServiceOSFamilies(location); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCloudServiceOSFamilies(location); } /// @@ -1971,17 +2100,21 @@ public static CloudServiceOSFamilyCollection GetCloudServiceOSFamilies(this Subs /// CloudServiceOperatingSystems_GetOSFamily /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the location that the OS families pertain to. /// Name of the OS family. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCloudServiceOSFamilyAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string osFamilyName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetCloudServiceOSFamilies(location).GetAsync(osFamilyName, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetCloudServiceOSFamilyAsync(location, osFamilyName, cancellationToken).ConfigureAwait(false); } /// @@ -1996,17 +2129,21 @@ public static async Task> GetCloudService /// CloudServiceOperatingSystems_GetOSFamily /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the location that the OS families pertain to. /// Name of the OS family. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCloudServiceOSFamily(this SubscriptionResource subscriptionResource, AzureLocation location, string osFamilyName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetCloudServiceOSFamilies(location).Get(osFamilyName, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCloudServiceOSFamily(location, osFamilyName, cancellationToken); } /// @@ -2021,6 +2158,10 @@ public static Response GetCloudServiceOSFamily(thi /// Usage_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which resource usage is queried. @@ -2028,7 +2169,7 @@ public static Response GetCloudServiceOSFamily(thi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesAsync(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetUsagesAsync(location, cancellationToken); } /// @@ -2043,6 +2184,10 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionResour /// Usage_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which resource usage is queried. @@ -2050,7 +2195,7 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionResour /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsages(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetUsages(location, cancellationToken); } /// @@ -2065,6 +2210,10 @@ public static Pageable GetUsages(this SubscriptionResource subscri /// VirtualMachineSizes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location upon which virtual-machine-sizes is queried. @@ -2072,7 +2221,7 @@ public static Pageable GetUsages(this SubscriptionResource subscri /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineSizesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineSizesAsync(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineSizesAsync(location, cancellationToken); } /// @@ -2087,6 +2236,10 @@ public static AsyncPageable GetVirtualMachineSizesAsync(this /// VirtualMachineSizes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location upon which virtual-machine-sizes is queried. @@ -2094,7 +2247,7 @@ public static AsyncPageable GetVirtualMachineSizesAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineSizes(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineSizes(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineSizes(location, cancellationToken); } /// @@ -2109,6 +2262,10 @@ public static Pageable GetVirtualMachineSizes(this Subscript /// VirtualMachineScaleSets_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which VM scale sets under the subscription are queried. @@ -2116,7 +2273,7 @@ public static Pageable GetVirtualMachineSizes(this Subscript /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineScaleSetsByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineScaleSetsByLocationAsync(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineScaleSetsByLocationAsync(location, cancellationToken); } /// @@ -2131,6 +2288,10 @@ public static AsyncPageable GetVirtualMachineSca /// VirtualMachineScaleSets_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which VM scale sets under the subscription are queried. @@ -2138,7 +2299,7 @@ public static AsyncPageable GetVirtualMachineSca /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineScaleSetsByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineScaleSetsByLocation(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineScaleSetsByLocation(location, cancellationToken); } /// @@ -2153,13 +2314,17 @@ public static Pageable GetVirtualMachineScaleSet /// VirtualMachineScaleSets_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualMachineScaleSetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineScaleSetsAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineScaleSetsAsync(cancellationToken); } /// @@ -2174,13 +2339,17 @@ public static AsyncPageable GetVirtualMachineSca /// VirtualMachineScaleSets_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualMachineScaleSets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineScaleSets(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineScaleSets(cancellationToken); } /// @@ -2195,6 +2364,10 @@ public static Pageable GetVirtualMachineScaleSet /// VirtualMachines_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which virtual machines under the subscription are queried. @@ -2202,7 +2375,7 @@ public static Pageable GetVirtualMachineScaleSet /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachinesByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachinesByLocationAsync(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachinesByLocationAsync(location, cancellationToken); } /// @@ -2217,6 +2390,10 @@ public static AsyncPageable GetVirtualMachinesByLocation /// VirtualMachines_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which virtual machines under the subscription are queried. @@ -2224,7 +2401,7 @@ public static AsyncPageable GetVirtualMachinesByLocation /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachinesByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachinesByLocation(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachinesByLocation(location, cancellationToken); } /// @@ -2239,6 +2416,10 @@ public static Pageable GetVirtualMachinesByLocation(this /// VirtualMachines_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. @@ -2248,7 +2429,7 @@ public static Pageable GetVirtualMachinesByLocation(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachinesAsync(this SubscriptionResource subscriptionResource, string statusOnly = null, string filter = null, ExpandTypesForListVm? expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachinesAsync(statusOnly, filter, expand, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachinesAsync(statusOnly, filter, expand, cancellationToken); } /// @@ -2263,6 +2444,10 @@ public static AsyncPageable GetVirtualMachinesAsync(this /// VirtualMachines_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. @@ -2272,7 +2457,7 @@ public static AsyncPageable GetVirtualMachinesAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachines(this SubscriptionResource subscriptionResource, string statusOnly = null, string filter = null, ExpandTypesForListVm? expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachines(statusOnly, filter, expand, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachines(statusOnly, filter, expand, cancellationToken); } /// @@ -2287,6 +2472,10 @@ public static Pageable GetVirtualMachines(this Subscript /// VirtualMachineImages_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2299,12 +2488,7 @@ public static Pageable GetVirtualMachines(this Subscript /// , , or is null. public static async Task> GetVirtualMachineImageAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - Argument.AssertNotNullOrEmpty(skus, nameof(skus)); - Argument.AssertNotNullOrEmpty(version, nameof(version)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImageAsync(location, publisherName, offer, skus, version, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImageAsync(location, publisherName, offer, skus, version, cancellationToken).ConfigureAwait(false); } /// @@ -2319,6 +2503,10 @@ public static async Task> GetVirtualMachineImageAs /// VirtualMachineImages_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2331,12 +2519,7 @@ public static async Task> GetVirtualMachineImageAs /// , , or is null. public static Response GetVirtualMachineImage(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - Argument.AssertNotNullOrEmpty(skus, nameof(skus)); - Argument.AssertNotNullOrEmpty(version, nameof(version)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImage(location, publisherName, offer, skus, version, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImage(location, publisherName, offer, skus, version, cancellationToken); } /// @@ -2351,6 +2534,10 @@ public static Response GetVirtualMachineImage(this Subscrip /// VirtualMachineImages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -2359,9 +2546,7 @@ public static Response GetVirtualMachineImage(this Subscrip /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImagesAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetVirtualMachineImagesOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagesAsync(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesAsync(options, cancellationToken); } /// @@ -2376,6 +2561,10 @@ public static AsyncPageable GetVirtualMachineImagesAsyn /// VirtualMachineImages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -2384,9 +2573,7 @@ public static AsyncPageable GetVirtualMachineImagesAsyn /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImages(this SubscriptionResource subscriptionResource, SubscriptionResourceGetVirtualMachineImagesOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImages(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImages(options, cancellationToken); } /// @@ -2401,6 +2588,10 @@ public static Pageable GetVirtualMachineImages(this Sub /// VirtualMachineImages_ListOffers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2411,9 +2602,7 @@ public static Pageable GetVirtualMachineImages(this Sub /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImageOffersAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImageOffersAsync(location, publisherName, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImageOffersAsync(location, publisherName, cancellationToken); } /// @@ -2428,6 +2617,10 @@ public static AsyncPageable GetVirtualMachineImageOffer /// VirtualMachineImages_ListOffers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2438,9 +2631,7 @@ public static AsyncPageable GetVirtualMachineImageOffer /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImageOffers(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImageOffers(location, publisherName, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImageOffers(location, publisherName, cancellationToken); } /// @@ -2455,6 +2646,10 @@ public static Pageable GetVirtualMachineImageOffers(thi /// VirtualMachineImages_ListPublishers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2462,7 +2657,7 @@ public static Pageable GetVirtualMachineImageOffers(thi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImagePublishersAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagePublishersAsync(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagePublishersAsync(location, cancellationToken); } /// @@ -2477,6 +2672,10 @@ public static AsyncPageable GetVirtualMachineImagePubli /// VirtualMachineImages_ListPublishers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2484,7 +2683,7 @@ public static AsyncPageable GetVirtualMachineImagePubli /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImagePublishers(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagePublishers(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagePublishers(location, cancellationToken); } /// @@ -2499,6 +2698,10 @@ public static Pageable GetVirtualMachineImagePublishers /// VirtualMachineImages_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2510,10 +2713,7 @@ public static Pageable GetVirtualMachineImagePublishers /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImageSkusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, string offer, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImageSkusAsync(location, publisherName, offer, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImageSkusAsync(location, publisherName, offer, cancellationToken); } /// @@ -2528,6 +2728,10 @@ public static AsyncPageable GetVirtualMachineImageSkusA /// VirtualMachineImages_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2539,10 +2743,7 @@ public static AsyncPageable GetVirtualMachineImageSkusA /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImageSkus(this SubscriptionResource subscriptionResource, AzureLocation location, string publisherName, string offer, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImageSkus(location, publisherName, offer, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImageSkus(location, publisherName, offer, cancellationToken); } /// @@ -2557,6 +2758,10 @@ public static Pageable GetVirtualMachineImageSkus(this /// VirtualMachineImages_ListByEdgeZone /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2567,9 +2772,7 @@ public static Pageable GetVirtualMachineImageSkus(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImagesByEdgeZoneAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagesByEdgeZoneAsync(location, edgeZone, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesByEdgeZoneAsync(location, edgeZone, cancellationToken); } /// @@ -2584,6 +2787,10 @@ public static AsyncPageable GetVirtualMachineImagesByEd /// VirtualMachineImages_ListByEdgeZone /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2594,9 +2801,7 @@ public static AsyncPageable GetVirtualMachineImagesByEd /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImagesByEdgeZone(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagesByEdgeZone(location, edgeZone, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesByEdgeZone(location, edgeZone, cancellationToken); } /// @@ -2611,6 +2816,10 @@ public static Pageable GetVirtualMachineImagesByEdgeZon /// VirtualMachineImagesEdgeZone_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -2618,9 +2827,7 @@ public static Pageable GetVirtualMachineImagesByEdgeZon /// is null. public static async Task> GetVirtualMachineImagesEdgeZoneAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagesEdgeZoneAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesEdgeZoneAsync(options, cancellationToken).ConfigureAwait(false); } /// @@ -2635,6 +2842,10 @@ public static async Task> GetVirtualMachineImagesE /// VirtualMachineImagesEdgeZone_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -2642,9 +2853,7 @@ public static async Task> GetVirtualMachineImagesE /// is null. public static Response GetVirtualMachineImagesEdgeZone(this SubscriptionResource subscriptionResource, SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagesEdgeZone(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesEdgeZone(options, cancellationToken); } /// @@ -2659,6 +2868,10 @@ public static Response GetVirtualMachineImagesEdgeZone(this /// VirtualMachineImagesEdgeZone_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -2667,9 +2880,7 @@ public static Response GetVirtualMachineImagesEdgeZone(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImagesEdgeZonesAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagesEdgeZonesAsync(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesEdgeZonesAsync(options, cancellationToken); } /// @@ -2684,6 +2895,10 @@ public static AsyncPageable GetVirtualMachineImagesEdge /// VirtualMachineImagesEdgeZone_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -2692,9 +2907,7 @@ public static AsyncPageable GetVirtualMachineImagesEdge /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImagesEdgeZones(this SubscriptionResource subscriptionResource, SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImagesEdgeZones(options, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImagesEdgeZones(options, cancellationToken); } /// @@ -2709,6 +2922,10 @@ public static Pageable GetVirtualMachineImagesEdgeZones /// VirtualMachineImagesEdgeZone_ListOffers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2720,10 +2937,7 @@ public static Pageable GetVirtualMachineImagesEdgeZones /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetOffersVirtualMachineImagesEdgeZonesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, string publisherName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOffersVirtualMachineImagesEdgeZonesAsync(location, edgeZone, publisherName, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetOffersVirtualMachineImagesEdgeZonesAsync(location, edgeZone, publisherName, cancellationToken); } /// @@ -2738,6 +2952,10 @@ public static AsyncPageable GetOffersVirtualMachineImag /// VirtualMachineImagesEdgeZone_ListOffers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2749,10 +2967,7 @@ public static AsyncPageable GetOffersVirtualMachineImag /// A collection of that may take multiple service requests to iterate over. public static Pageable GetOffersVirtualMachineImagesEdgeZones(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, string publisherName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOffersVirtualMachineImagesEdgeZones(location, edgeZone, publisherName, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetOffersVirtualMachineImagesEdgeZones(location, edgeZone, publisherName, cancellationToken); } /// @@ -2767,6 +2982,10 @@ public static Pageable GetOffersVirtualMachineImagesEdg /// VirtualMachineImagesEdgeZone_ListPublishers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2777,9 +2996,7 @@ public static Pageable GetOffersVirtualMachineImagesEdg /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPublishersVirtualMachineImagesEdgeZonesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPublishersVirtualMachineImagesEdgeZonesAsync(location, edgeZone, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetPublishersVirtualMachineImagesEdgeZonesAsync(location, edgeZone, cancellationToken); } /// @@ -2794,6 +3011,10 @@ public static AsyncPageable GetPublishersVirtualMachine /// VirtualMachineImagesEdgeZone_ListPublishers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2804,9 +3025,7 @@ public static AsyncPageable GetPublishersVirtualMachine /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPublishersVirtualMachineImagesEdgeZones(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPublishersVirtualMachineImagesEdgeZones(location, edgeZone, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetPublishersVirtualMachineImagesEdgeZones(location, edgeZone, cancellationToken); } /// @@ -2821,6 +3040,10 @@ public static Pageable GetPublishersVirtualMachineImage /// VirtualMachineImagesEdgeZone_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2833,11 +3056,7 @@ public static Pageable GetPublishersVirtualMachineImage /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineImageEdgeZoneSkusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImageEdgeZoneSkusAsync(location, edgeZone, publisherName, offer, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImageEdgeZoneSkusAsync(location, edgeZone, publisherName, offer, cancellationToken); } /// @@ -2852,6 +3071,10 @@ public static AsyncPageable GetVirtualMachineImageEdgeZ /// VirtualMachineImagesEdgeZone_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of a supported Azure region. @@ -2864,11 +3087,7 @@ public static AsyncPageable GetVirtualMachineImageEdgeZ /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineImageEdgeZoneSkus(this SubscriptionResource subscriptionResource, AzureLocation location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); - Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); - Argument.AssertNotNullOrEmpty(offer, nameof(offer)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineImageEdgeZoneSkus(location, edgeZone, publisherName, offer, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineImageEdgeZoneSkus(location, edgeZone, publisherName, offer, cancellationToken); } /// @@ -2883,6 +3102,10 @@ public static Pageable GetVirtualMachineImageEdgeZoneSk /// AvailabilitySets_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The expand expression to apply to the operation. Allowed values are 'instanceView'. @@ -2890,7 +3113,7 @@ public static Pageable GetVirtualMachineImageEdgeZoneSk /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailabilitySetsAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailabilitySetsAsync(expand, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetAvailabilitySetsAsync(expand, cancellationToken); } /// @@ -2905,6 +3128,10 @@ public static AsyncPageable GetAvailabilitySetsAsync(th /// AvailabilitySets_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The expand expression to apply to the operation. Allowed values are 'instanceView'. @@ -2912,7 +3139,7 @@ public static AsyncPageable GetAvailabilitySetsAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailabilitySets(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailabilitySets(expand, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetAvailabilitySets(expand, cancellationToken); } /// @@ -2927,13 +3154,17 @@ public static Pageable GetAvailabilitySets(this Subscri /// ProximityPlacementGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetProximityPlacementGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProximityPlacementGroupsAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetProximityPlacementGroupsAsync(cancellationToken); } /// @@ -2948,13 +3179,17 @@ public static AsyncPageable GetProximityPlaceme /// ProximityPlacementGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetProximityPlacementGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProximityPlacementGroups(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetProximityPlacementGroups(cancellationToken); } /// @@ -2969,13 +3204,17 @@ public static Pageable GetProximityPlacementGro /// DedicatedHostGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDedicatedHostGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDedicatedHostGroupsAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetDedicatedHostGroupsAsync(cancellationToken); } /// @@ -2990,13 +3229,17 @@ public static AsyncPageable GetDedicatedHostGroupsAs /// DedicatedHostGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDedicatedHostGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDedicatedHostGroups(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetDedicatedHostGroups(cancellationToken); } /// @@ -3011,13 +3254,17 @@ public static Pageable GetDedicatedHostGroups(this S /// SshPublicKeys_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSshPublicKeysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSshPublicKeysAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetSshPublicKeysAsync(cancellationToken); } /// @@ -3032,13 +3279,17 @@ public static AsyncPageable GetSshPublicKeysAsync(this Sub /// SshPublicKeys_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSshPublicKeys(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSshPublicKeys(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetSshPublicKeys(cancellationToken); } /// @@ -3053,13 +3304,17 @@ public static Pageable GetSshPublicKeys(this SubscriptionR /// Images_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiskImagesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskImagesAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetDiskImagesAsync(cancellationToken); } /// @@ -3074,13 +3329,17 @@ public static AsyncPageable GetDiskImagesAsync(this Subscript /// Images_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiskImages(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskImages(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetDiskImages(cancellationToken); } /// @@ -3095,13 +3354,17 @@ public static Pageable GetDiskImages(this SubscriptionResourc /// RestorePointCollections_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRestorePointGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRestorePointGroupsAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetRestorePointGroupsAsync(cancellationToken); } /// @@ -3116,13 +3379,17 @@ public static AsyncPageable GetRestorePointGroupsAsyn /// RestorePointCollections_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRestorePointGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRestorePointGroups(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetRestorePointGroups(cancellationToken); } /// @@ -3137,6 +3404,10 @@ public static Pageable GetRestorePointGroups(this Sub /// CapacityReservationGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. @@ -3144,7 +3415,7 @@ public static Pageable GetRestorePointGroups(this Sub /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCapacityReservationGroupsAsync(this SubscriptionResource subscriptionResource, CapacityReservationGroupGetExpand? expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapacityReservationGroupsAsync(expand, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCapacityReservationGroupsAsync(expand, cancellationToken); } /// @@ -3159,6 +3430,10 @@ public static AsyncPageable GetCapacityReserva /// CapacityReservationGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. @@ -3166,7 +3441,7 @@ public static AsyncPageable GetCapacityReserva /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCapacityReservationGroups(this SubscriptionResource subscriptionResource, CapacityReservationGroupGetExpand? expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapacityReservationGroups(expand, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCapacityReservationGroups(expand, cancellationToken); } /// @@ -3181,6 +3456,10 @@ public static Pageable GetCapacityReservationG /// LogAnalytics_ExportRequestRateByInterval /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -3190,9 +3469,7 @@ public static Pageable GetCapacityReservationG /// is null. public static async Task> ExportLogAnalyticsRequestRateByIntervalAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, RequestRateByIntervalContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ExportLogAnalyticsRequestRateByIntervalAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).ExportLogAnalyticsRequestRateByIntervalAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); } /// @@ -3207,6 +3484,10 @@ public static async Task> ExportLogAnalyticsRequestRa /// LogAnalytics_ExportRequestRateByInterval /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -3216,9 +3497,7 @@ public static async Task> ExportLogAnalyticsRequestRa /// is null. public static ArmOperation ExportLogAnalyticsRequestRateByInterval(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, RequestRateByIntervalContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ExportLogAnalyticsRequestRateByInterval(waitUntil, location, content, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).ExportLogAnalyticsRequestRateByInterval(waitUntil, location, content, cancellationToken); } /// @@ -3233,6 +3512,10 @@ public static ArmOperation ExportLogAnalyticsRequestRateByInterval /// LogAnalytics_ExportThrottledRequests /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -3242,9 +3525,7 @@ public static ArmOperation ExportLogAnalyticsRequestRateByInterval /// is null. public static async Task> ExportLogAnalyticsThrottledRequestsAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, ThrottledRequestsContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ExportLogAnalyticsThrottledRequestsAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).ExportLogAnalyticsThrottledRequestsAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); } /// @@ -3259,6 +3540,10 @@ public static async Task> ExportLogAnalyticsThrottled /// LogAnalytics_ExportThrottledRequests /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -3268,9 +3553,7 @@ public static async Task> ExportLogAnalyticsThrottled /// is null. public static ArmOperation ExportLogAnalyticsThrottledRequests(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, ThrottledRequestsContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ExportLogAnalyticsThrottledRequests(waitUntil, location, content, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).ExportLogAnalyticsThrottledRequests(waitUntil, location, content, cancellationToken); } /// @@ -3285,6 +3568,10 @@ public static ArmOperation ExportLogAnalyticsThrottledRequests(thi /// VirtualMachineRunCommands_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location upon which run commands is queried. @@ -3292,7 +3579,7 @@ public static ArmOperation ExportLogAnalyticsThrottledRequests(thi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualMachineRunCommandsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineRunCommandsAsync(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineRunCommandsAsync(location, cancellationToken); } /// @@ -3307,6 +3594,10 @@ public static AsyncPageable GetVirtualMachineRunCommands /// VirtualMachineRunCommands_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location upon which run commands is queried. @@ -3314,7 +3605,7 @@ public static AsyncPageable GetVirtualMachineRunCommands /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualMachineRunCommands(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineRunCommands(location, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineRunCommands(location, cancellationToken); } /// @@ -3329,6 +3620,10 @@ public static Pageable GetVirtualMachineRunCommands(this /// VirtualMachineRunCommands_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location upon which run commands is queried. @@ -3338,9 +3633,7 @@ public static Pageable GetVirtualMachineRunCommands(this /// is null. public static async Task> GetVirtualMachineRunCommandAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string commandId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(commandId, nameof(commandId)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineRunCommandAsync(location, commandId, cancellationToken).ConfigureAwait(false); + return await GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineRunCommandAsync(location, commandId, cancellationToken).ConfigureAwait(false); } /// @@ -3355,6 +3648,10 @@ public static async Task> GetVirtualMachineRunComma /// VirtualMachineRunCommands_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location upon which run commands is queried. @@ -3364,9 +3661,7 @@ public static async Task> GetVirtualMachineRunComma /// is null. public static Response GetVirtualMachineRunCommand(this SubscriptionResource subscriptionResource, AzureLocation location, string commandId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(commandId, nameof(commandId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineRunCommand(location, commandId, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetVirtualMachineRunCommand(location, commandId, cancellationToken); } /// @@ -3381,13 +3676,17 @@ public static Response GetVirtualMachineRunCommand(this Subs /// Disks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedDisksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedDisksAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetManagedDisksAsync(cancellationToken); } /// @@ -3402,13 +3701,17 @@ public static AsyncPageable GetManagedDisksAsync(this Subsc /// Disks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedDisks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedDisks(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetManagedDisks(cancellationToken); } /// @@ -3423,13 +3726,17 @@ public static Pageable GetManagedDisks(this SubscriptionRes /// DiskAccesses_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiskAccessesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskAccessesAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetDiskAccessesAsync(cancellationToken); } /// @@ -3444,13 +3751,17 @@ public static AsyncPageable GetDiskAccessesAsync(this Subscr /// DiskAccesses_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiskAccesses(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskAccesses(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetDiskAccesses(cancellationToken); } /// @@ -3465,13 +3776,17 @@ public static Pageable GetDiskAccesses(this SubscriptionReso /// DiskEncryptionSets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiskEncryptionSetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskEncryptionSetsAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetDiskEncryptionSetsAsync(cancellationToken); } /// @@ -3486,13 +3801,17 @@ public static AsyncPageable GetDiskEncryptionSetsAsyn /// DiskEncryptionSets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiskEncryptionSets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskEncryptionSets(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetDiskEncryptionSets(cancellationToken); } /// @@ -3507,13 +3826,17 @@ public static Pageable GetDiskEncryptionSets(this Sub /// Snapshots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSnapshotsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSnapshotsAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetSnapshotsAsync(cancellationToken); } /// @@ -3528,13 +3851,17 @@ public static AsyncPageable GetSnapshotsAsync(this Subscriptio /// Snapshots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSnapshots(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSnapshots(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetSnapshots(cancellationToken); } /// @@ -3549,6 +3876,10 @@ public static Pageable GetSnapshots(this SubscriptionResource /// ResourceSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the operation. Only **location** filter is supported currently. @@ -3557,7 +3888,7 @@ public static Pageable GetSnapshots(this SubscriptionResource /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetComputeResourceSkusAsync(this SubscriptionResource subscriptionResource, string filter = null, string includeExtendedLocations = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetComputeResourceSkusAsync(filter, includeExtendedLocations, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetComputeResourceSkusAsync(filter, includeExtendedLocations, cancellationToken); } /// @@ -3572,6 +3903,10 @@ public static AsyncPageable GetComputeResourceSkusAsync(this /// ResourceSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the operation. Only **location** filter is supported currently. @@ -3580,7 +3915,7 @@ public static AsyncPageable GetComputeResourceSkusAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetComputeResourceSkus(this SubscriptionResource subscriptionResource, string filter = null, string includeExtendedLocations = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetComputeResourceSkus(filter, includeExtendedLocations, cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetComputeResourceSkus(filter, includeExtendedLocations, cancellationToken); } /// @@ -3595,13 +3930,17 @@ public static Pageable GetComputeResourceSkus(this Subscript /// Galleries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetGalleriesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGalleriesAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetGalleriesAsync(cancellationToken); } /// @@ -3616,13 +3955,17 @@ public static AsyncPageable GetGalleriesAsync(this Subscription /// Galleries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetGalleries(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGalleries(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetGalleries(cancellationToken); } /// @@ -3637,13 +3980,17 @@ public static Pageable GetGalleries(this SubscriptionResource s /// CloudServices_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCloudServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCloudServicesAsync(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCloudServicesAsync(cancellationToken); } /// @@ -3658,13 +4005,17 @@ public static AsyncPageable GetCloudServicesAsync(this Sub /// CloudServices_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCloudServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCloudServices(cancellationToken); + return GetMockableComputeSubscriptionResource(subscriptionResource).GetCloudServices(cancellationToken); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeArmClient.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeArmClient.cs new file mode 100644 index 0000000000000..662f38f1e8297 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeArmClient.cs @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Compute; + +namespace Azure.ResourceManager.Compute.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableComputeArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableComputeArmClient() + { + } + + /// 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 MockableComputeArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableComputeArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineScaleSetResource GetVirtualMachineScaleSetResource(ResourceIdentifier id) + { + VirtualMachineScaleSetResource.ValidateResourceId(id); + return new VirtualMachineScaleSetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineScaleSetExtensionResource GetVirtualMachineScaleSetExtensionResource(ResourceIdentifier id) + { + VirtualMachineScaleSetExtensionResource.ValidateResourceId(id); + return new VirtualMachineScaleSetExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineScaleSetRollingUpgradeResource GetVirtualMachineScaleSetRollingUpgradeResource(ResourceIdentifier id) + { + VirtualMachineScaleSetRollingUpgradeResource.ValidateResourceId(id); + return new VirtualMachineScaleSetRollingUpgradeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineScaleSetVmExtensionResource GetVirtualMachineScaleSetVmExtensionResource(ResourceIdentifier id) + { + VirtualMachineScaleSetVmExtensionResource.ValidateResourceId(id); + return new VirtualMachineScaleSetVmExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineScaleSetVmResource GetVirtualMachineScaleSetVmResource(ResourceIdentifier id) + { + VirtualMachineScaleSetVmResource.ValidateResourceId(id); + return new VirtualMachineScaleSetVmResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineExtensionResource GetVirtualMachineExtensionResource(ResourceIdentifier id) + { + VirtualMachineExtensionResource.ValidateResourceId(id); + return new VirtualMachineExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineResource GetVirtualMachineResource(ResourceIdentifier id) + { + VirtualMachineResource.ValidateResourceId(id); + return new VirtualMachineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineExtensionImageResource GetVirtualMachineExtensionImageResource(ResourceIdentifier id) + { + VirtualMachineExtensionImageResource.ValidateResourceId(id); + return new VirtualMachineExtensionImageResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvailabilitySetResource GetAvailabilitySetResource(ResourceIdentifier id) + { + AvailabilitySetResource.ValidateResourceId(id); + return new AvailabilitySetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProximityPlacementGroupResource GetProximityPlacementGroupResource(ResourceIdentifier id) + { + ProximityPlacementGroupResource.ValidateResourceId(id); + return new ProximityPlacementGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DedicatedHostGroupResource GetDedicatedHostGroupResource(ResourceIdentifier id) + { + DedicatedHostGroupResource.ValidateResourceId(id); + return new DedicatedHostGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DedicatedHostResource GetDedicatedHostResource(ResourceIdentifier id) + { + DedicatedHostResource.ValidateResourceId(id); + return new DedicatedHostResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SshPublicKeyResource GetSshPublicKeyResource(ResourceIdentifier id) + { + SshPublicKeyResource.ValidateResourceId(id); + return new SshPublicKeyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiskImageResource GetDiskImageResource(ResourceIdentifier id) + { + DiskImageResource.ValidateResourceId(id); + return new DiskImageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RestorePointGroupResource GetRestorePointGroupResource(ResourceIdentifier id) + { + RestorePointGroupResource.ValidateResourceId(id); + return new RestorePointGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RestorePointResource GetRestorePointResource(ResourceIdentifier id) + { + RestorePointResource.ValidateResourceId(id); + return new RestorePointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CapacityReservationGroupResource GetCapacityReservationGroupResource(ResourceIdentifier id) + { + CapacityReservationGroupResource.ValidateResourceId(id); + return new CapacityReservationGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CapacityReservationResource GetCapacityReservationResource(ResourceIdentifier id) + { + CapacityReservationResource.ValidateResourceId(id); + return new CapacityReservationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineRunCommandResource GetVirtualMachineRunCommandResource(ResourceIdentifier id) + { + VirtualMachineRunCommandResource.ValidateResourceId(id); + return new VirtualMachineRunCommandResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineScaleSetVmRunCommandResource GetVirtualMachineScaleSetVmRunCommandResource(ResourceIdentifier id) + { + VirtualMachineScaleSetVmRunCommandResource.ValidateResourceId(id); + return new VirtualMachineScaleSetVmRunCommandResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDiskResource GetManagedDiskResource(ResourceIdentifier id) + { + ManagedDiskResource.ValidateResourceId(id); + return new ManagedDiskResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiskAccessResource GetDiskAccessResource(ResourceIdentifier id) + { + DiskAccessResource.ValidateResourceId(id); + return new DiskAccessResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ComputePrivateEndpointConnectionResource GetComputePrivateEndpointConnectionResource(ResourceIdentifier id) + { + ComputePrivateEndpointConnectionResource.ValidateResourceId(id); + return new ComputePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiskEncryptionSetResource GetDiskEncryptionSetResource(ResourceIdentifier id) + { + DiskEncryptionSetResource.ValidateResourceId(id); + return new DiskEncryptionSetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiskRestorePointResource GetDiskRestorePointResource(ResourceIdentifier id) + { + DiskRestorePointResource.ValidateResourceId(id); + return new DiskRestorePointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SnapshotResource GetSnapshotResource(ResourceIdentifier id) + { + SnapshotResource.ValidateResourceId(id); + return new SnapshotResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GalleryResource GetGalleryResource(ResourceIdentifier id) + { + GalleryResource.ValidateResourceId(id); + return new GalleryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GalleryImageResource GetGalleryImageResource(ResourceIdentifier id) + { + GalleryImageResource.ValidateResourceId(id); + return new GalleryImageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GalleryImageVersionResource GetGalleryImageVersionResource(ResourceIdentifier id) + { + GalleryImageVersionResource.ValidateResourceId(id); + return new GalleryImageVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GalleryApplicationResource GetGalleryApplicationResource(ResourceIdentifier id) + { + GalleryApplicationResource.ValidateResourceId(id); + return new GalleryApplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GalleryApplicationVersionResource GetGalleryApplicationVersionResource(ResourceIdentifier id) + { + GalleryApplicationVersionResource.ValidateResourceId(id); + return new GalleryApplicationVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SharedGalleryResource GetSharedGalleryResource(ResourceIdentifier id) + { + SharedGalleryResource.ValidateResourceId(id); + return new SharedGalleryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SharedGalleryImageResource GetSharedGalleryImageResource(ResourceIdentifier id) + { + SharedGalleryImageResource.ValidateResourceId(id); + return new SharedGalleryImageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SharedGalleryImageVersionResource GetSharedGalleryImageVersionResource(ResourceIdentifier id) + { + SharedGalleryImageVersionResource.ValidateResourceId(id); + return new SharedGalleryImageVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CommunityGalleryResource GetCommunityGalleryResource(ResourceIdentifier id) + { + CommunityGalleryResource.ValidateResourceId(id); + return new CommunityGalleryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CommunityGalleryImageResource GetCommunityGalleryImageResource(ResourceIdentifier id) + { + CommunityGalleryImageResource.ValidateResourceId(id); + return new CommunityGalleryImageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CommunityGalleryImageVersionResource GetCommunityGalleryImageVersionResource(ResourceIdentifier id) + { + CommunityGalleryImageVersionResource.ValidateResourceId(id); + return new CommunityGalleryImageVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CloudServiceRoleInstanceResource GetCloudServiceRoleInstanceResource(ResourceIdentifier id) + { + CloudServiceRoleInstanceResource.ValidateResourceId(id); + return new CloudServiceRoleInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CloudServiceRoleResource GetCloudServiceRoleResource(ResourceIdentifier id) + { + CloudServiceRoleResource.ValidateResourceId(id); + return new CloudServiceRoleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CloudServiceResource GetCloudServiceResource(ResourceIdentifier id) + { + CloudServiceResource.ValidateResourceId(id); + return new CloudServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CloudServiceOSVersionResource GetCloudServiceOSVersionResource(ResourceIdentifier id) + { + CloudServiceOSVersionResource.ValidateResourceId(id); + return new CloudServiceOSVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CloudServiceOSFamilyResource GetCloudServiceOSFamilyResource(ResourceIdentifier id) + { + CloudServiceOSFamilyResource.ValidateResourceId(id); + return new CloudServiceOSFamilyResource(Client, id); + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeResourceGroupResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeResourceGroupResource.cs new file mode 100644 index 0000000000000..f7d0743b519dd --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeResourceGroupResource.cs @@ -0,0 +1,853 @@ +// 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.Compute; +using Azure.ResourceManager.Compute.Models; + +namespace Azure.ResourceManager.Compute.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableComputeResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableComputeResourceGroupResource() + { + } + + /// 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 MockableComputeResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of VirtualMachineScaleSetResources in the ResourceGroupResource. + /// An object representing collection of VirtualMachineScaleSetResources and their operations over a VirtualMachineScaleSetResource. + public virtual VirtualMachineScaleSetCollection GetVirtualMachineScaleSets() + { + return GetCachedClient(client => new VirtualMachineScaleSetCollection(client, Id)); + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSets_Get + /// + /// + /// + /// The name of the VM scale set. + /// The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set Create/Update operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualMachineScaleSetAsync(string virtualMachineScaleSetName, VirtualMachineScaleSetGetExpand? expand = null, CancellationToken cancellationToken = default) + { + return await GetVirtualMachineScaleSets().GetAsync(virtualMachineScaleSetName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Display information about a virtual machine scale set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName} + /// + /// + /// Operation Id + /// VirtualMachineScaleSets_Get + /// + /// + /// + /// The name of the VM scale set. + /// The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the VM scale set that was provided by the user during the VM scale set Create/Update operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualMachineScaleSet(string virtualMachineScaleSetName, VirtualMachineScaleSetGetExpand? expand = null, CancellationToken cancellationToken = default) + { + return GetVirtualMachineScaleSets().Get(virtualMachineScaleSetName, expand, cancellationToken); + } + + /// Gets a collection of VirtualMachineResources in the ResourceGroupResource. + /// An object representing collection of VirtualMachineResources and their operations over a VirtualMachineResource. + public virtual VirtualMachineCollection GetVirtualMachines() + { + return GetCachedClient(client => new VirtualMachineCollection(client, Id)); + } + + /// + /// Retrieves information about the model view or the instance view of a virtual machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualMachineAsync(string vmName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + return await GetVirtualMachines().GetAsync(vmName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about the model view or the instance view of a virtual machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the virtual machine that is managed by the platform and can change outside of control plane operations. 'UserData' retrieves the UserData property as part of the VM model view that was provided by the user during the VM Create/Update operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualMachine(string vmName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + return GetVirtualMachines().Get(vmName, expand, cancellationToken); + } + + /// Gets a collection of AvailabilitySetResources in the ResourceGroupResource. + /// An object representing collection of AvailabilitySetResources and their operations over a AvailabilitySetResource. + public virtual AvailabilitySetCollection GetAvailabilitySets() + { + return GetCachedClient(client => new AvailabilitySetCollection(client, Id)); + } + + /// + /// Retrieves information about an availability set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName} + /// + /// + /// Operation Id + /// AvailabilitySets_Get + /// + /// + /// + /// The name of the availability set. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAvailabilitySetAsync(string availabilitySetName, CancellationToken cancellationToken = default) + { + return await GetAvailabilitySets().GetAsync(availabilitySetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about an availability set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName} + /// + /// + /// Operation Id + /// AvailabilitySets_Get + /// + /// + /// + /// The name of the availability set. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAvailabilitySet(string availabilitySetName, CancellationToken cancellationToken = default) + { + return GetAvailabilitySets().Get(availabilitySetName, cancellationToken); + } + + /// Gets a collection of ProximityPlacementGroupResources in the ResourceGroupResource. + /// An object representing collection of ProximityPlacementGroupResources and their operations over a ProximityPlacementGroupResource. + public virtual ProximityPlacementGroupCollection GetProximityPlacementGroups() + { + return GetCachedClient(client => new ProximityPlacementGroupCollection(client, Id)); + } + + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName} + /// + /// + /// Operation Id + /// ProximityPlacementGroups_Get + /// + /// + /// + /// The name of the proximity placement group. + /// includeColocationStatus=true enables fetching the colocation status of all the resources in the proximity placement group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetProximityPlacementGroupAsync(string proximityPlacementGroupName, string includeColocationStatus = null, CancellationToken cancellationToken = default) + { + return await GetProximityPlacementGroups().GetAsync(proximityPlacementGroupName, includeColocationStatus, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a proximity placement group . + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName} + /// + /// + /// Operation Id + /// ProximityPlacementGroups_Get + /// + /// + /// + /// The name of the proximity placement group. + /// includeColocationStatus=true enables fetching the colocation status of all the resources in the proximity placement group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetProximityPlacementGroup(string proximityPlacementGroupName, string includeColocationStatus = null, CancellationToken cancellationToken = default) + { + return GetProximityPlacementGroups().Get(proximityPlacementGroupName, includeColocationStatus, cancellationToken); + } + + /// Gets a collection of DedicatedHostGroupResources in the ResourceGroupResource. + /// An object representing collection of DedicatedHostGroupResources and their operations over a DedicatedHostGroupResource. + public virtual DedicatedHostGroupCollection GetDedicatedHostGroups() + { + return GetCachedClient(client => new DedicatedHostGroupCollection(client, Id)); + } + + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName} + /// + /// + /// Operation Id + /// DedicatedHostGroups_Get + /// + /// + /// + /// The name of the dedicated host group. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDedicatedHostGroupAsync(string hostGroupName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + return await GetDedicatedHostGroups().GetAsync(hostGroupName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a dedicated host group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName} + /// + /// + /// Operation Id + /// DedicatedHostGroups_Get + /// + /// + /// + /// The name of the dedicated host group. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated hosts under the dedicated host group. 'UserData' is not supported for dedicated host group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDedicatedHostGroup(string hostGroupName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + return GetDedicatedHostGroups().Get(hostGroupName, expand, cancellationToken); + } + + /// Gets a collection of SshPublicKeyResources in the ResourceGroupResource. + /// An object representing collection of SshPublicKeyResources and their operations over a SshPublicKeyResource. + public virtual SshPublicKeyCollection GetSshPublicKeys() + { + return GetCachedClient(client => new SshPublicKeyCollection(client, Id)); + } + + /// + /// Retrieves information about an SSH public key. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName} + /// + /// + /// Operation Id + /// SshPublicKeys_Get + /// + /// + /// + /// The name of the SSH public key. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSshPublicKeyAsync(string sshPublicKeyName, CancellationToken cancellationToken = default) + { + return await GetSshPublicKeys().GetAsync(sshPublicKeyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about an SSH public key. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName} + /// + /// + /// Operation Id + /// SshPublicKeys_Get + /// + /// + /// + /// The name of the SSH public key. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSshPublicKey(string sshPublicKeyName, CancellationToken cancellationToken = default) + { + return GetSshPublicKeys().Get(sshPublicKeyName, cancellationToken); + } + + /// Gets a collection of DiskImageResources in the ResourceGroupResource. + /// An object representing collection of DiskImageResources and their operations over a DiskImageResource. + public virtual DiskImageCollection GetDiskImages() + { + return GetCachedClient(client => new DiskImageCollection(client, Id)); + } + + /// + /// Gets an image. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// The name of the image. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDiskImageAsync(string imageName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetDiskImages().GetAsync(imageName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an image. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /// + /// + /// Operation Id + /// Images_Get + /// + /// + /// + /// The name of the image. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDiskImage(string imageName, string expand = null, CancellationToken cancellationToken = default) + { + return GetDiskImages().Get(imageName, expand, cancellationToken); + } + + /// Gets a collection of RestorePointGroupResources in the ResourceGroupResource. + /// An object representing collection of RestorePointGroupResources and their operations over a RestorePointGroupResource. + public virtual RestorePointGroupCollection GetRestorePointGroups() + { + return GetCachedClient(client => new RestorePointGroupCollection(client, Id)); + } + + /// + /// The operation to get the restore point collection. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName} + /// + /// + /// Operation Id + /// RestorePointCollections_Get + /// + /// + /// + /// The name of the restore point collection. + /// The expand expression to apply on the operation. If expand=restorePoints, server will return all contained restore points in the restorePointCollection. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRestorePointGroupAsync(string restorePointGroupName, RestorePointGroupExpand? expand = null, CancellationToken cancellationToken = default) + { + return await GetRestorePointGroups().GetAsync(restorePointGroupName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the restore point collection. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName} + /// + /// + /// Operation Id + /// RestorePointCollections_Get + /// + /// + /// + /// The name of the restore point collection. + /// The expand expression to apply on the operation. If expand=restorePoints, server will return all contained restore points in the restorePointCollection. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRestorePointGroup(string restorePointGroupName, RestorePointGroupExpand? expand = null, CancellationToken cancellationToken = default) + { + return GetRestorePointGroups().Get(restorePointGroupName, expand, cancellationToken); + } + + /// Gets a collection of CapacityReservationGroupResources in the ResourceGroupResource. + /// An object representing collection of CapacityReservationGroupResources and their operations over a CapacityReservationGroupResource. + public virtual CapacityReservationGroupCollection GetCapacityReservationGroups() + { + return GetCachedClient(client => new CapacityReservationGroupCollection(client, Id)); + } + + /// + /// The operation that retrieves information about a capacity reservation group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName} + /// + /// + /// Operation Id + /// CapacityReservationGroups_Get + /// + /// + /// + /// The name of the capacity reservation group. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCapacityReservationGroupAsync(string capacityReservationGroupName, CapacityReservationGroupInstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + return await GetCapacityReservationGroups().GetAsync(capacityReservationGroupName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation that retrieves information about a capacity reservation group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName} + /// + /// + /// Operation Id + /// CapacityReservationGroups_Get + /// + /// + /// + /// The name of the capacity reservation group. + /// The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCapacityReservationGroup(string capacityReservationGroupName, CapacityReservationGroupInstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + return GetCapacityReservationGroups().Get(capacityReservationGroupName, expand, cancellationToken); + } + + /// Gets a collection of ManagedDiskResources in the ResourceGroupResource. + /// An object representing collection of ManagedDiskResources and their operations over a ManagedDiskResource. + public virtual ManagedDiskCollection GetManagedDisks() + { + return GetCachedClient(client => new ManagedDiskCollection(client, Id)); + } + + /// + /// Gets information about a disk. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName} + /// + /// + /// Operation Id + /// Disks_Get + /// + /// + /// + /// The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedDiskAsync(string diskName, CancellationToken cancellationToken = default) + { + return await GetManagedDisks().GetAsync(diskName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName} + /// + /// + /// Operation Id + /// Disks_Get + /// + /// + /// + /// The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedDisk(string diskName, CancellationToken cancellationToken = default) + { + return GetManagedDisks().Get(diskName, cancellationToken); + } + + /// Gets a collection of DiskAccessResources in the ResourceGroupResource. + /// An object representing collection of DiskAccessResources and their operations over a DiskAccessResource. + public virtual DiskAccessCollection GetDiskAccesses() + { + return GetCachedClient(client => new DiskAccessCollection(client, Id)); + } + + /// + /// Gets information about a disk access resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName} + /// + /// + /// Operation Id + /// DiskAccesses_Get + /// + /// + /// + /// The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDiskAccessAsync(string diskAccessName, CancellationToken cancellationToken = default) + { + return await GetDiskAccesses().GetAsync(diskAccessName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk access resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName} + /// + /// + /// Operation Id + /// DiskAccesses_Get + /// + /// + /// + /// The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDiskAccess(string diskAccessName, CancellationToken cancellationToken = default) + { + return GetDiskAccesses().Get(diskAccessName, cancellationToken); + } + + /// Gets a collection of DiskEncryptionSetResources in the ResourceGroupResource. + /// An object representing collection of DiskEncryptionSetResources and their operations over a DiskEncryptionSetResource. + public virtual DiskEncryptionSetCollection GetDiskEncryptionSets() + { + return GetCachedClient(client => new DiskEncryptionSetCollection(client, Id)); + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName} + /// + /// + /// Operation Id + /// DiskEncryptionSets_Get + /// + /// + /// + /// The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDiskEncryptionSetAsync(string diskEncryptionSetName, CancellationToken cancellationToken = default) + { + return await GetDiskEncryptionSets().GetAsync(diskEncryptionSetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a disk encryption set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName} + /// + /// + /// Operation Id + /// DiskEncryptionSets_Get + /// + /// + /// + /// The name of the disk encryption set that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDiskEncryptionSet(string diskEncryptionSetName, CancellationToken cancellationToken = default) + { + return GetDiskEncryptionSets().Get(diskEncryptionSetName, cancellationToken); + } + + /// Gets a collection of SnapshotResources in the ResourceGroupResource. + /// An object representing collection of SnapshotResources and their operations over a SnapshotResource. + public virtual SnapshotCollection GetSnapshots() + { + return GetCachedClient(client => new SnapshotCollection(client, Id)); + } + + /// + /// Gets information about a snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) + { + return await GetSnapshots().GetAsync(snapshotName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSnapshot(string snapshotName, CancellationToken cancellationToken = default) + { + return GetSnapshots().Get(snapshotName, cancellationToken); + } + + /// Gets a collection of GalleryResources in the ResourceGroupResource. + /// An object representing collection of GalleryResources and their operations over a GalleryResource. + public virtual GalleryCollection GetGalleries() + { + return GetCachedClient(client => new GalleryCollection(client, Id)); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName} + /// + /// + /// Operation Id + /// Galleries_Get + /// + /// + /// + /// The name of the Shared Image Gallery. + /// The select expression to apply on the operation. + /// The expand query option to apply on the operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGalleryAsync(string galleryName, SelectPermission? select = null, GalleryExpand? expand = null, CancellationToken cancellationToken = default) + { + return await GetGalleries().GetAsync(galleryName, select, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about a Shared Image Gallery. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName} + /// + /// + /// Operation Id + /// Galleries_Get + /// + /// + /// + /// The name of the Shared Image Gallery. + /// The select expression to apply on the operation. + /// The expand query option to apply on the operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGallery(string galleryName, SelectPermission? select = null, GalleryExpand? expand = null, CancellationToken cancellationToken = default) + { + return GetGalleries().Get(galleryName, select, expand, cancellationToken); + } + + /// Gets a collection of CloudServiceResources in the ResourceGroupResource. + /// An object representing collection of CloudServiceResources and their operations over a CloudServiceResource. + public virtual CloudServiceCollection GetCloudServices() + { + return GetCachedClient(client => new CloudServiceCollection(client, Id)); + } + + /// + /// Display information about a cloud service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName} + /// + /// + /// Operation Id + /// CloudServices_Get + /// + /// + /// + /// Name of the cloud service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCloudServiceAsync(string cloudServiceName, CancellationToken cancellationToken = default) + { + return await GetCloudServices().GetAsync(cloudServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Display information about a cloud service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName} + /// + /// + /// Operation Id + /// CloudServices_Get + /// + /// + /// + /// Name of the cloud service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCloudService(string cloudServiceName, CancellationToken cancellationToken = default) + { + return GetCloudServices().Get(cloudServiceName, cancellationToken); + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeSubscriptionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeSubscriptionResource.cs new file mode 100644 index 0000000000000..0d8899125cec4 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/MockableComputeSubscriptionResource.cs @@ -0,0 +1,2228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Compute; +using Azure.ResourceManager.Compute.Models; + +namespace Azure.ResourceManager.Compute.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableComputeSubscriptionResource : ArmResource + { + private ClientDiagnostics _usageClientDiagnostics; + private UsageRestOperations _usageRestClient; + private ClientDiagnostics _virtualMachineSizesClientDiagnostics; + private VirtualMachineSizesRestOperations _virtualMachineSizesRestClient; + private ClientDiagnostics _virtualMachineScaleSetClientDiagnostics; + private VirtualMachineScaleSetsRestOperations _virtualMachineScaleSetRestClient; + private ClientDiagnostics _virtualMachineClientDiagnostics; + private VirtualMachinesRestOperations _virtualMachineRestClient; + private ClientDiagnostics _virtualMachineImagesClientDiagnostics; + private VirtualMachineImagesRestOperations _virtualMachineImagesRestClient; + private ClientDiagnostics _virtualMachineImagesEdgeZoneClientDiagnostics; + private VirtualMachineImagesEdgeZoneRestOperations _virtualMachineImagesEdgeZoneRestClient; + private ClientDiagnostics _availabilitySetClientDiagnostics; + private AvailabilitySetsRestOperations _availabilitySetRestClient; + private ClientDiagnostics _proximityPlacementGroupClientDiagnostics; + private ProximityPlacementGroupsRestOperations _proximityPlacementGroupRestClient; + private ClientDiagnostics _dedicatedHostGroupClientDiagnostics; + private DedicatedHostGroupsRestOperations _dedicatedHostGroupRestClient; + private ClientDiagnostics _sshPublicKeyClientDiagnostics; + private SshPublicKeysRestOperations _sshPublicKeyRestClient; + private ClientDiagnostics _diskImageImagesClientDiagnostics; + private ImagesRestOperations _diskImageImagesRestClient; + private ClientDiagnostics _restorePointGroupRestorePointCollectionsClientDiagnostics; + private RestorePointCollectionsRestOperations _restorePointGroupRestorePointCollectionsRestClient; + private ClientDiagnostics _capacityReservationGroupClientDiagnostics; + private CapacityReservationGroupsRestOperations _capacityReservationGroupRestClient; + private ClientDiagnostics _logAnalyticsClientDiagnostics; + private LogAnalyticsRestOperations _logAnalyticsRestClient; + private ClientDiagnostics _virtualMachineRunCommandClientDiagnostics; + private VirtualMachineRunCommandsRestOperations _virtualMachineRunCommandRestClient; + private ClientDiagnostics _managedDiskDisksClientDiagnostics; + private DisksRestOperations _managedDiskDisksRestClient; + private ClientDiagnostics _diskAccessClientDiagnostics; + private DiskAccessesRestOperations _diskAccessRestClient; + private ClientDiagnostics _diskEncryptionSetClientDiagnostics; + private DiskEncryptionSetsRestOperations _diskEncryptionSetRestClient; + private ClientDiagnostics _snapshotClientDiagnostics; + private SnapshotsRestOperations _snapshotRestClient; + private ClientDiagnostics _resourceSkusClientDiagnostics; + private ResourceSkusRestOperations _resourceSkusRestClient; + private ClientDiagnostics _galleryClientDiagnostics; + private GalleriesRestOperations _galleryRestClient; + private ClientDiagnostics _cloudServiceClientDiagnostics; + private CloudServicesRestOperations _cloudServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableComputeSubscriptionResource() + { + } + + /// 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 MockableComputeSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics UsageClientDiagnostics => _usageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsageRestOperations UsageRestClient => _usageRestClient ??= new UsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics VirtualMachineSizesClientDiagnostics => _virtualMachineSizesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private VirtualMachineSizesRestOperations VirtualMachineSizesRestClient => _virtualMachineSizesRestClient ??= new VirtualMachineSizesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics VirtualMachineScaleSetClientDiagnostics => _virtualMachineScaleSetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", VirtualMachineScaleSetResource.ResourceType.Namespace, Diagnostics); + private VirtualMachineScaleSetsRestOperations VirtualMachineScaleSetRestClient => _virtualMachineScaleSetRestClient ??= new VirtualMachineScaleSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineScaleSetResource.ResourceType)); + private ClientDiagnostics VirtualMachineClientDiagnostics => _virtualMachineClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", VirtualMachineResource.ResourceType.Namespace, Diagnostics); + private VirtualMachinesRestOperations VirtualMachineRestClient => _virtualMachineRestClient ??= new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineResource.ResourceType)); + private ClientDiagnostics VirtualMachineImagesClientDiagnostics => _virtualMachineImagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private VirtualMachineImagesRestOperations VirtualMachineImagesRestClient => _virtualMachineImagesRestClient ??= new VirtualMachineImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics VirtualMachineImagesEdgeZoneClientDiagnostics => _virtualMachineImagesEdgeZoneClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private VirtualMachineImagesEdgeZoneRestOperations VirtualMachineImagesEdgeZoneRestClient => _virtualMachineImagesEdgeZoneRestClient ??= new VirtualMachineImagesEdgeZoneRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AvailabilitySetClientDiagnostics => _availabilitySetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", AvailabilitySetResource.ResourceType.Namespace, Diagnostics); + private AvailabilitySetsRestOperations AvailabilitySetRestClient => _availabilitySetRestClient ??= new AvailabilitySetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AvailabilitySetResource.ResourceType)); + private ClientDiagnostics ProximityPlacementGroupClientDiagnostics => _proximityPlacementGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProximityPlacementGroupResource.ResourceType.Namespace, Diagnostics); + private ProximityPlacementGroupsRestOperations ProximityPlacementGroupRestClient => _proximityPlacementGroupRestClient ??= new ProximityPlacementGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ProximityPlacementGroupResource.ResourceType)); + private ClientDiagnostics DedicatedHostGroupClientDiagnostics => _dedicatedHostGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", DedicatedHostGroupResource.ResourceType.Namespace, Diagnostics); + private DedicatedHostGroupsRestOperations DedicatedHostGroupRestClient => _dedicatedHostGroupRestClient ??= new DedicatedHostGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DedicatedHostGroupResource.ResourceType)); + private ClientDiagnostics SshPublicKeyClientDiagnostics => _sshPublicKeyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", SshPublicKeyResource.ResourceType.Namespace, Diagnostics); + private SshPublicKeysRestOperations SshPublicKeyRestClient => _sshPublicKeyRestClient ??= new SshPublicKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SshPublicKeyResource.ResourceType)); + private ClientDiagnostics DiskImageImagesClientDiagnostics => _diskImageImagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", DiskImageResource.ResourceType.Namespace, Diagnostics); + private ImagesRestOperations DiskImageImagesRestClient => _diskImageImagesRestClient ??= new ImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DiskImageResource.ResourceType)); + private ClientDiagnostics RestorePointGroupRestorePointCollectionsClientDiagnostics => _restorePointGroupRestorePointCollectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", RestorePointGroupResource.ResourceType.Namespace, Diagnostics); + private RestorePointCollectionsRestOperations RestorePointGroupRestorePointCollectionsRestClient => _restorePointGroupRestorePointCollectionsRestClient ??= new RestorePointCollectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RestorePointGroupResource.ResourceType)); + private ClientDiagnostics CapacityReservationGroupClientDiagnostics => _capacityReservationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", CapacityReservationGroupResource.ResourceType.Namespace, Diagnostics); + private CapacityReservationGroupsRestOperations CapacityReservationGroupRestClient => _capacityReservationGroupRestClient ??= new CapacityReservationGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CapacityReservationGroupResource.ResourceType)); + private ClientDiagnostics LogAnalyticsClientDiagnostics => _logAnalyticsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LogAnalyticsRestOperations LogAnalyticsRestClient => _logAnalyticsRestClient ??= new LogAnalyticsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics VirtualMachineRunCommandClientDiagnostics => _virtualMachineRunCommandClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", VirtualMachineRunCommandResource.ResourceType.Namespace, Diagnostics); + private VirtualMachineRunCommandsRestOperations VirtualMachineRunCommandRestClient => _virtualMachineRunCommandRestClient ??= new VirtualMachineRunCommandsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineRunCommandResource.ResourceType)); + private ClientDiagnostics ManagedDiskDisksClientDiagnostics => _managedDiskDisksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ManagedDiskResource.ResourceType.Namespace, Diagnostics); + private DisksRestOperations ManagedDiskDisksRestClient => _managedDiskDisksRestClient ??= new DisksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedDiskResource.ResourceType)); + private ClientDiagnostics DiskAccessClientDiagnostics => _diskAccessClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", DiskAccessResource.ResourceType.Namespace, Diagnostics); + private DiskAccessesRestOperations DiskAccessRestClient => _diskAccessRestClient ??= new DiskAccessesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DiskAccessResource.ResourceType)); + private ClientDiagnostics DiskEncryptionSetClientDiagnostics => _diskEncryptionSetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", DiskEncryptionSetResource.ResourceType.Namespace, Diagnostics); + private DiskEncryptionSetsRestOperations DiskEncryptionSetRestClient => _diskEncryptionSetRestClient ??= new DiskEncryptionSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DiskEncryptionSetResource.ResourceType)); + private ClientDiagnostics SnapshotClientDiagnostics => _snapshotClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", SnapshotResource.ResourceType.Namespace, Diagnostics); + private SnapshotsRestOperations SnapshotRestClient => _snapshotRestClient ??= new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SnapshotResource.ResourceType)); + private ClientDiagnostics ResourceSkusClientDiagnostics => _resourceSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceSkusRestOperations ResourceSkusRestClient => _resourceSkusRestClient ??= new ResourceSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics GalleryClientDiagnostics => _galleryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", GalleryResource.ResourceType.Namespace, Diagnostics); + private GalleriesRestOperations GalleryRestClient => _galleryRestClient ??= new GalleriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GalleryResource.ResourceType)); + private ClientDiagnostics CloudServiceClientDiagnostics => _cloudServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", CloudServiceResource.ResourceType.Namespace, Diagnostics); + private CloudServicesRestOperations CloudServiceRestClient => _cloudServiceRestClient ??= new CloudServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CloudServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of VirtualMachineExtensionImageResources in the SubscriptionResource. + /// The name of a supported Azure region. + /// The String to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of VirtualMachineExtensionImageResources and their operations over a VirtualMachineExtensionImageResource. + public virtual VirtualMachineExtensionImageCollection GetVirtualMachineExtensionImages(AzureLocation location, string publisherName) + { + return new VirtualMachineExtensionImageCollection(Client, Id, location, publisherName); + } + + /// + /// Gets a virtual machine extension image. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineExtensionImages_Get + /// + /// + /// + /// The name of a supported Azure region. + /// The String to use. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualMachineExtensionImageAsync(AzureLocation location, string publisherName, string type, string version, CancellationToken cancellationToken = default) + { + return await GetVirtualMachineExtensionImages(location, publisherName).GetAsync(type, version, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a virtual machine extension image. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineExtensionImages_Get + /// + /// + /// + /// The name of a supported Azure region. + /// The String to use. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualMachineExtensionImage(AzureLocation location, string publisherName, string type, string version, CancellationToken cancellationToken = default) + { + return GetVirtualMachineExtensionImages(location, publisherName).Get(type, version, cancellationToken); + } + + /// Gets a collection of SharedGalleryResources in the SubscriptionResource. + /// Resource location. + /// An object representing collection of SharedGalleryResources and their operations over a SharedGalleryResource. + public virtual SharedGalleryCollection GetSharedGalleries(AzureLocation location) + { + return new SharedGalleryCollection(Client, Id, location); + } + + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName} + /// + /// + /// Operation Id + /// SharedGalleries_Get + /// + /// + /// + /// Resource location. + /// The unique name of the Shared Gallery. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSharedGalleryAsync(AzureLocation location, string galleryUniqueName, CancellationToken cancellationToken = default) + { + return await GetSharedGalleries(location).GetAsync(galleryUniqueName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a shared gallery by subscription id or tenant id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName} + /// + /// + /// Operation Id + /// SharedGalleries_Get + /// + /// + /// + /// Resource location. + /// The unique name of the Shared Gallery. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSharedGallery(AzureLocation location, string galleryUniqueName, CancellationToken cancellationToken = default) + { + return GetSharedGalleries(location).Get(galleryUniqueName, cancellationToken); + } + + /// Gets a collection of CommunityGalleryResources in the SubscriptionResource. + /// An object representing collection of CommunityGalleryResources and their operations over a CommunityGalleryResource. + public virtual CommunityGalleryCollection GetCommunityGalleries() + { + return GetCachedClient(client => new CommunityGalleryCollection(client, Id)); + } + + /// + /// Get a community gallery by gallery public name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName} + /// + /// + /// Operation Id + /// CommunityGalleries_Get + /// + /// + /// + /// Resource location. + /// The public name of the community gallery. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCommunityGalleryAsync(AzureLocation location, string publicGalleryName, CancellationToken cancellationToken = default) + { + return await GetCommunityGalleries().GetAsync(location, publicGalleryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a community gallery by gallery public name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName} + /// + /// + /// Operation Id + /// CommunityGalleries_Get + /// + /// + /// + /// Resource location. + /// The public name of the community gallery. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCommunityGallery(AzureLocation location, string publicGalleryName, CancellationToken cancellationToken = default) + { + return GetCommunityGalleries().Get(location, publicGalleryName, cancellationToken); + } + + /// Gets a collection of CloudServiceOSVersionResources in the SubscriptionResource. + /// Name of the location that the OS versions pertain to. + /// An object representing collection of CloudServiceOSVersionResources and their operations over a CloudServiceOSVersionResource. + public virtual CloudServiceOSVersionCollection GetCloudServiceOSVersions(AzureLocation location) + { + return new CloudServiceOSVersionCollection(Client, Id, location); + } + + /// + /// Gets properties of a guest operating system version that can be specified in the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName} + /// + /// + /// Operation Id + /// CloudServiceOperatingSystems_GetOSVersion + /// + /// + /// + /// Name of the location that the OS versions pertain to. + /// Name of the OS version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCloudServiceOSVersionAsync(AzureLocation location, string osVersionName, CancellationToken cancellationToken = default) + { + return await GetCloudServiceOSVersions(location).GetAsync(osVersionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a guest operating system version that can be specified in the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName} + /// + /// + /// Operation Id + /// CloudServiceOperatingSystems_GetOSVersion + /// + /// + /// + /// Name of the location that the OS versions pertain to. + /// Name of the OS version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCloudServiceOSVersion(AzureLocation location, string osVersionName, CancellationToken cancellationToken = default) + { + return GetCloudServiceOSVersions(location).Get(osVersionName, cancellationToken); + } + + /// Gets a collection of CloudServiceOSFamilyResources in the SubscriptionResource. + /// Name of the location that the OS families pertain to. + /// An object representing collection of CloudServiceOSFamilyResources and their operations over a CloudServiceOSFamilyResource. + public virtual CloudServiceOSFamilyCollection GetCloudServiceOSFamilies(AzureLocation location) + { + return new CloudServiceOSFamilyCollection(Client, Id, location); + } + + /// + /// Gets properties of a guest operating system family that can be specified in the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName} + /// + /// + /// Operation Id + /// CloudServiceOperatingSystems_GetOSFamily + /// + /// + /// + /// Name of the location that the OS families pertain to. + /// Name of the OS family. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCloudServiceOSFamilyAsync(AzureLocation location, string osFamilyName, CancellationToken cancellationToken = default) + { + return await GetCloudServiceOSFamilies(location).GetAsync(osFamilyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a guest operating system family that can be specified in the XML service configuration (.cscfg) for a cloud service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName} + /// + /// + /// Operation Id + /// CloudServiceOperatingSystems_GetOSFamily + /// + /// + /// + /// Name of the location that the OS families pertain to. + /// Name of the OS family. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCloudServiceOSFamily(AzureLocation location, string osFamilyName, CancellationToken cancellationToken = default) + { + return GetCloudServiceOSFamilies(location).Get(osFamilyName, cancellationToken); + } + + /// + /// Gets, for the specified location, the current compute resource usage information as well as the limits for compute resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages + /// + /// + /// Operation Id + /// Usage_List + /// + /// + /// + /// The location for which resource usage is queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsageRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ComputeUsage.DeserializeComputeUsage, UsageClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Gets, for the specified location, the current compute resource usage information as well as the limits for compute resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages + /// + /// + /// Operation Id + /// Usage_List + /// + /// + /// + /// The location for which resource usage is queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsageRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ComputeUsage.DeserializeComputeUsage, UsageClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list) + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes + /// + /// + /// Operation Id + /// VirtualMachineSizes_List + /// + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineSizesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineSizesRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineSize.DeserializeVirtualMachineSize, VirtualMachineSizesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineSizes", "value", null, cancellationToken); + } + + /// + /// This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list) + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes + /// + /// + /// Operation Id + /// VirtualMachineSizes_List + /// + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineSizes(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineSizesRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineSize.DeserializeVirtualMachineSize, VirtualMachineSizesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineSizes", "value", null, cancellationToken); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets + /// + /// + /// Operation Id + /// VirtualMachineScaleSets_ListByLocation + /// + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineScaleSetsByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineScaleSetsByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the VM scale sets under the specified subscription for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets + /// + /// + /// Operation Id + /// VirtualMachineScaleSets_ListByLocation + /// + /// + /// + /// The location for which VM scale sets under the subscription are queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineScaleSetsByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineScaleSetsByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM Scale Sets. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets + /// + /// + /// Operation Id + /// VirtualMachineScaleSets_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineScaleSetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineScaleSets", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM Scale Sets. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets + /// + /// + /// Operation Id + /// VirtualMachineScaleSets_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineScaleSets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineScaleSets", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the virtual machines under the specified subscription for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListByLocation + /// + /// + /// + /// The location for which virtual machines under the subscription are queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachinesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachinesByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the virtual machines under the specified subscription for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListByLocation + /// + /// + /// + /// The location for which virtual machines under the subscription are queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachinesByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachinesByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListAll + /// + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + /// The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + /// The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this can only be specified if a valid $filter option is specified. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachinesAsync(string statusOnly = null, string filter = null, ExpandTypesForListVm? expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListAllRequest(Id.SubscriptionId, statusOnly, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, statusOnly, filter, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachines", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListAll + /// + /// + /// + /// statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. + /// The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + /// The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this can only be specified if a valid $filter option is specified. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachines(string statusOnly = null, string filter = null, ExpandTypesForListVm? expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListAllRequest(Id.SubscriptionId, statusOnly, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, statusOnly, filter, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachines", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a virtual machine image. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineImages_Get + /// + /// + /// + /// The name of a supported Azure region. + /// A valid image publisher. + /// A valid image publisher offer. + /// A valid image SKU. + /// A valid image SKU version. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual async Task> GetVirtualMachineImageAsync(AzureLocation location, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + Argument.AssertNotNullOrEmpty(skus, nameof(skus)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = VirtualMachineImagesClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.GetVirtualMachineImage"); + scope.Start(); + try + { + var response = await VirtualMachineImagesRestClient.GetAsync(Id.SubscriptionId, location, publisherName, offer, skus, version, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a virtual machine image. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineImages_Get + /// + /// + /// + /// The name of a supported Azure region. + /// A valid image publisher. + /// A valid image publisher offer. + /// A valid image SKU. + /// A valid image SKU version. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual Response GetVirtualMachineImage(AzureLocation location, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + Argument.AssertNotNullOrEmpty(skus, nameof(skus)); + Argument.AssertNotNullOrEmpty(version, nameof(version)); + + using var scope = VirtualMachineImagesClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.GetVirtualMachineImage"); + scope.Start(); + try + { + var response = VirtualMachineImagesRestClient.Get(Id.SubscriptionId, location, publisherName, offer, skus, version, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions + /// + /// + /// Operation Id + /// VirtualMachineImages_List + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImagesAsync(SubscriptionResourceGetVirtualMachineImagesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListRequest(Id.SubscriptionId, options.Location, options.PublisherName, options.Offer, options.Skus, options.Expand, options.Top, options.Orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImages", "", null, cancellationToken); + } + + /// + /// Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions + /// + /// + /// Operation Id + /// VirtualMachineImages_List + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImages(SubscriptionResourceGetVirtualMachineImagesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListRequest(Id.SubscriptionId, options.Location, options.PublisherName, options.Offer, options.Skus, options.Expand, options.Top, options.Orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImages", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image offers for the specified location and publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers + /// + /// + /// Operation Id + /// VirtualMachineImages_ListOffers + /// + /// + /// + /// The name of a supported Azure region. + /// A valid image publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImageOffersAsync(AzureLocation location, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListOffersRequest(Id.SubscriptionId, location, publisherName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImageOffers", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image offers for the specified location and publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers + /// + /// + /// Operation Id + /// VirtualMachineImages_ListOffers + /// + /// + /// + /// The name of a supported Azure region. + /// A valid image publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImageOffers(AzureLocation location, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListOffersRequest(Id.SubscriptionId, location, publisherName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImageOffers", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers + /// + /// + /// Operation Id + /// VirtualMachineImages_ListPublishers + /// + /// + /// + /// The name of a supported Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImagePublishersAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListPublishersRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImagePublishers", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers + /// + /// + /// Operation Id + /// VirtualMachineImages_ListPublishers + /// + /// + /// + /// The name of a supported Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImagePublishers(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListPublishersRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImagePublishers", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus + /// + /// + /// Operation Id + /// VirtualMachineImages_ListSkus + /// + /// + /// + /// The name of a supported Azure region. + /// A valid image publisher. + /// A valid image publisher offer. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImageSkusAsync(AzureLocation location, string publisherName, string offer, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListSkusRequest(Id.SubscriptionId, location, publisherName, offer); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImageSkus", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus + /// + /// + /// Operation Id + /// VirtualMachineImages_ListSkus + /// + /// + /// + /// The name of a supported Azure region. + /// A valid image publisher. + /// A valid image publisher offer. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImageSkus(AzureLocation location, string publisherName, string offer, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListSkusRequest(Id.SubscriptionId, location, publisherName, offer); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImageSkus", "", null, cancellationToken); + } + + /// + /// Gets a list of all virtual machine image versions for the specified edge zone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages + /// + /// + /// Operation Id + /// VirtualMachineImages_ListByEdgeZone + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImagesByEdgeZoneAsync(AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListByEdgeZoneRequest(Id.SubscriptionId, location, edgeZone); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImagesByEdgeZone", "value", null, cancellationToken); + } + + /// + /// Gets a list of all virtual machine image versions for the specified edge zone + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages + /// + /// + /// Operation Id + /// VirtualMachineImages_ListByEdgeZone + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImagesByEdgeZone(AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListByEdgeZoneRequest(Id.SubscriptionId, location, edgeZone); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImagesByEdgeZone", "value", null, cancellationToken); + } + + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_Get + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetVirtualMachineImagesEdgeZoneAsync(SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = VirtualMachineImagesEdgeZoneClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.GetVirtualMachineImagesEdgeZone"); + scope.Start(); + try + { + var response = await VirtualMachineImagesEdgeZoneRestClient.GetAsync(Id.SubscriptionId, options.Location, options.EdgeZone, options.PublisherName, options.Offer, options.Skus, options.Version, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a virtual machine image in an edge zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_Get + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual Response GetVirtualMachineImagesEdgeZone(SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = VirtualMachineImagesEdgeZoneClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.GetVirtualMachineImagesEdgeZone"); + scope.Start(); + try + { + var response = VirtualMachineImagesEdgeZoneRestClient.Get(Id.SubscriptionId, options.Location, options.EdgeZone, options.PublisherName, options.Offer, options.Skus, options.Version, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_List + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImagesEdgeZonesAsync(SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListRequest(Id.SubscriptionId, options.Location, options.EdgeZone, options.PublisherName, options.Offer, options.Skus, options.Expand, options.Top, options.Orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImagesEdgeZones", "", null, cancellationToken); + } + + /// + /// Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_List + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImagesEdgeZones(SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListRequest(Id.SubscriptionId, options.Location, options.EdgeZone, options.PublisherName, options.Offer, options.Skus, options.Expand, options.Top, options.Orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImagesEdgeZones", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_ListOffers + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// A valid image publisher. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOffersVirtualMachineImagesEdgeZonesAsync(AzureLocation location, string edgeZone, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListOffersRequest(Id.SubscriptionId, location, edgeZone, publisherName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetOffersVirtualMachineImagesEdgeZones", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image offers for the specified location, edge zone and publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_ListOffers + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// A valid image publisher. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOffersVirtualMachineImagesEdgeZones(AzureLocation location, string edgeZone, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListOffersRequest(Id.SubscriptionId, location, edgeZone, publisherName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetOffersVirtualMachineImagesEdgeZones", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_ListPublishers + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPublishersVirtualMachineImagesEdgeZonesAsync(AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListPublishersRequest(Id.SubscriptionId, location, edgeZone); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetPublishersVirtualMachineImagesEdgeZones", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_ListPublishers + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPublishersVirtualMachineImagesEdgeZones(AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListPublishersRequest(Id.SubscriptionId, location, edgeZone); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetPublishersVirtualMachineImagesEdgeZones", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_ListSkus + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// A valid image publisher. + /// A valid image publisher offer. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineImageEdgeZoneSkusAsync(AzureLocation location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListSkusRequest(Id.SubscriptionId, location, edgeZone, publisherName, offer); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImageEdgeZoneSkus", "", null, cancellationToken); + } + + /// + /// Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus + /// + /// + /// Operation Id + /// VirtualMachineImagesEdgeZone_ListSkus + /// + /// + /// + /// The name of a supported Azure region. + /// The name of the edge zone. + /// A valid image publisher. + /// A valid image publisher offer. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineImageEdgeZoneSkus(AzureLocation location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(edgeZone, nameof(edgeZone)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(offer, nameof(offer)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListSkusRequest(Id.SubscriptionId, location, edgeZone, publisherName, offer); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineImageEdgeZoneSkus", "", null, cancellationToken); + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets + /// + /// + /// Operation Id + /// AvailabilitySets_ListBySubscription + /// + /// + /// + /// The expand expression to apply to the operation. Allowed values are 'instanceView'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailabilitySetsAsync(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilitySetRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilitySetRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), AvailabilitySetClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetAvailabilitySets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all availability sets in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets + /// + /// + /// Operation Id + /// AvailabilitySets_ListBySubscription + /// + /// + /// + /// The expand expression to apply to the operation. Allowed values are 'instanceView'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailabilitySets(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilitySetRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilitySetRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), AvailabilitySetClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetAvailabilitySets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups + /// + /// + /// Operation Id + /// ProximityPlacementGroups_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProximityPlacementGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProximityPlacementGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProximityPlacementGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), ProximityPlacementGroupClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetProximityPlacementGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all proximity placement groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups + /// + /// + /// Operation Id + /// ProximityPlacementGroups_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProximityPlacementGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProximityPlacementGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProximityPlacementGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), ProximityPlacementGroupClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetProximityPlacementGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups + /// + /// + /// Operation Id + /// DedicatedHostGroups_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDedicatedHostGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHostGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHostGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), DedicatedHostGroupClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetDedicatedHostGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups + /// + /// + /// Operation Id + /// DedicatedHostGroups_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDedicatedHostGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHostGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHostGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), DedicatedHostGroupClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetDedicatedHostGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys + /// + /// + /// Operation Id + /// SshPublicKeys_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSshPublicKeysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SshPublicKeyRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SshPublicKeyRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), SshPublicKeyClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetSshPublicKeys", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next page of SSH public keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys + /// + /// + /// Operation Id + /// SshPublicKeys_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSshPublicKeys(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SshPublicKeyRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SshPublicKeyRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), SshPublicKeyClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetSshPublicKeys", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/images + /// + /// + /// Operation Id + /// Images_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDiskImagesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskImageImagesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskImageImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), DiskImageImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetDiskImages", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/images + /// + /// + /// Operation Id + /// Images_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDiskImages(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskImageImagesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskImageImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), DiskImageImagesClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetDiskImages", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the next page of restore point collections. Do this till nextLink is not null to fetch all the restore point collections. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections + /// + /// + /// Operation Id + /// RestorePointCollections_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRestorePointGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), RestorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetRestorePointGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the next page of restore point collections. Do this till nextLink is not null to fetch all the restore point collections. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections + /// + /// + /// Operation Id + /// RestorePointCollections_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRestorePointGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), RestorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetRestorePointGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to get the next page of capacity reservation groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups + /// + /// + /// Operation Id + /// CapacityReservationGroups_ListBySubscription + /// + /// + /// + /// The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCapacityReservationGroupsAsync(CapacityReservationGroupGetExpand? expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CapacityReservationGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CapacityReservationGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), CapacityReservationGroupClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetCapacityReservationGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to get the next page of capacity reservation groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups + /// + /// + /// Operation Id + /// CapacityReservationGroups_ListBySubscription + /// + /// + /// + /// The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCapacityReservationGroups(CapacityReservationGroupGetExpand? expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CapacityReservationGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CapacityReservationGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), CapacityReservationGroupClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetCapacityReservationGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Export logs that show Api requests made by this subscription in the given time window to show throttling activities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval + /// + /// + /// Operation Id + /// LogAnalytics_ExportRequestRateByInterval + /// + /// + /// + /// 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 location upon which virtual-machine-sizes is queried. + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExportLogAnalyticsRequestRateByIntervalAsync(WaitUntil waitUntil, AzureLocation location, RequestRateByIntervalContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LogAnalyticsClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.ExportLogAnalyticsRequestRateByInterval"); + scope.Start(); + try + { + var response = await LogAnalyticsRestClient.ExportRequestRateByIntervalAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + var operation = new ComputeArmOperation(new LogAnalyticsOperationSource(), LogAnalyticsClientDiagnostics, Pipeline, LogAnalyticsRestClient.CreateExportRequestRateByIntervalRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Export logs that show Api requests made by this subscription in the given time window to show throttling activities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval + /// + /// + /// Operation Id + /// LogAnalytics_ExportRequestRateByInterval + /// + /// + /// + /// 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 location upon which virtual-machine-sizes is queried. + /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ExportLogAnalyticsRequestRateByInterval(WaitUntil waitUntil, AzureLocation location, RequestRateByIntervalContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LogAnalyticsClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.ExportLogAnalyticsRequestRateByInterval"); + scope.Start(); + try + { + var response = LogAnalyticsRestClient.ExportRequestRateByInterval(Id.SubscriptionId, location, content, cancellationToken); + var operation = new ComputeArmOperation(new LogAnalyticsOperationSource(), LogAnalyticsClientDiagnostics, Pipeline, LogAnalyticsRestClient.CreateExportRequestRateByIntervalRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Export logs that show total throttled Api requests for this subscription in the given time window. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests + /// + /// + /// Operation Id + /// LogAnalytics_ExportThrottledRequests + /// + /// + /// + /// 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 location upon which virtual-machine-sizes is queried. + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExportLogAnalyticsThrottledRequestsAsync(WaitUntil waitUntil, AzureLocation location, ThrottledRequestsContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LogAnalyticsClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.ExportLogAnalyticsThrottledRequests"); + scope.Start(); + try + { + var response = await LogAnalyticsRestClient.ExportThrottledRequestsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + var operation = new ComputeArmOperation(new LogAnalyticsOperationSource(), LogAnalyticsClientDiagnostics, Pipeline, LogAnalyticsRestClient.CreateExportThrottledRequestsRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Export logs that show total throttled Api requests for this subscription in the given time window. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests + /// + /// + /// Operation Id + /// LogAnalytics_ExportThrottledRequests + /// + /// + /// + /// 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 location upon which virtual-machine-sizes is queried. + /// Parameters supplied to the LogAnalytics getThrottledRequests Api. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ExportLogAnalyticsThrottledRequests(WaitUntil waitUntil, AzureLocation location, ThrottledRequestsContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LogAnalyticsClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.ExportLogAnalyticsThrottledRequests"); + scope.Start(); + try + { + var response = LogAnalyticsRestClient.ExportThrottledRequests(Id.SubscriptionId, location, content, cancellationToken); + var operation = new ComputeArmOperation(new LogAnalyticsOperationSource(), LogAnalyticsClientDiagnostics, Pipeline, LogAnalyticsRestClient.CreateExportThrottledRequestsRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands + /// + /// + /// Operation Id + /// VirtualMachineRunCommands_List + /// + /// + /// + /// The location upon which run commands is queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineRunCommandsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRunCommandRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRunCommandRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RunCommandDocumentBase.DeserializeRunCommandDocumentBase, VirtualMachineRunCommandClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineRunCommands", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all available run commands for a subscription in a location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands + /// + /// + /// Operation Id + /// VirtualMachineRunCommands_List + /// + /// + /// + /// The location upon which run commands is queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineRunCommands(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRunCommandRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRunCommandRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RunCommandDocumentBase.DeserializeRunCommandDocumentBase, VirtualMachineRunCommandClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetVirtualMachineRunCommands", "value", "nextLink", cancellationToken); + } + + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId} + /// + /// + /// Operation Id + /// VirtualMachineRunCommands_Get + /// + /// + /// + /// The location upon which run commands is queried. + /// The command id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetVirtualMachineRunCommandAsync(AzureLocation location, string commandId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commandId, nameof(commandId)); + + using var scope = VirtualMachineRunCommandClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.GetVirtualMachineRunCommand"); + scope.Start(); + try + { + var response = await VirtualMachineRunCommandRestClient.GetAsync(Id.SubscriptionId, location, commandId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets specific run command for a subscription in a location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId} + /// + /// + /// Operation Id + /// VirtualMachineRunCommands_Get + /// + /// + /// + /// The location upon which run commands is queried. + /// The command id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetVirtualMachineRunCommand(AzureLocation location, string commandId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(commandId, nameof(commandId)); + + using var scope = VirtualMachineRunCommandClientDiagnostics.CreateScope("MockableComputeSubscriptionResource.GetVirtualMachineRunCommand"); + scope.Start(); + try + { + var response = VirtualMachineRunCommandRestClient.Get(Id.SubscriptionId, location, commandId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks + /// + /// + /// Operation Id + /// Disks_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedDisksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedDiskDisksRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedDiskDisksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), ManagedDiskDisksClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetManagedDisks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the disks under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks + /// + /// + /// Operation Id + /// Disks_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedDisks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedDiskDisksRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedDiskDisksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), ManagedDiskDisksClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetManagedDisks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses + /// + /// + /// Operation Id + /// DiskAccesses_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDiskAccessesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskAccessRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskAccessRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), DiskAccessClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetDiskAccesses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the disk access resources under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses + /// + /// + /// Operation Id + /// DiskAccesses_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDiskAccesses(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskAccessRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskAccessRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), DiskAccessClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetDiskAccesses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets + /// + /// + /// Operation Id + /// DiskEncryptionSets_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDiskEncryptionSetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskEncryptionSetRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskEncryptionSetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), DiskEncryptionSetClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetDiskEncryptionSets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the disk encryption sets under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets + /// + /// + /// Operation Id + /// DiskEncryptionSets_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDiskEncryptionSets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskEncryptionSetRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskEncryptionSetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), DiskEncryptionSetClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetDiskEncryptionSets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots + /// + /// + /// Operation Id + /// Snapshots_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSnapshotsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SnapshotRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), SnapshotClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetSnapshots", "value", "nextLink", cancellationToken); + } + + /// + /// Lists snapshots under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots + /// + /// + /// Operation Id + /// Snapshots_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSnapshots(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SnapshotRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), SnapshotClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetSnapshots", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus + /// + /// + /// Operation Id + /// ResourceSkus_List + /// + /// + /// + /// The filter to apply on the operation. Only **location** filter is supported currently. + /// To Include Extended Locations information or not in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetComputeResourceSkusAsync(string filter = null, string includeExtendedLocations = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId, filter, includeExtendedLocations); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, includeExtendedLocations); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ComputeResourceSku.DeserializeComputeResourceSku, ResourceSkusClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetComputeResourceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Microsoft.Compute SKUs available for your Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus + /// + /// + /// Operation Id + /// ResourceSkus_List + /// + /// + /// + /// The filter to apply on the operation. Only **location** filter is supported currently. + /// To Include Extended Locations information or not in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetComputeResourceSkus(string filter = null, string includeExtendedLocations = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId, filter, includeExtendedLocations); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, includeExtendedLocations); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ComputeResourceSku.DeserializeComputeResourceSku, ResourceSkusClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetComputeResourceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// List galleries under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries + /// + /// + /// Operation Id + /// Galleries_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGalleriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GalleryRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GalleryRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), GalleryClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetGalleries", "value", "nextLink", cancellationToken); + } + + /// + /// List galleries under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries + /// + /// + /// Operation Id + /// Galleries_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGalleries(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GalleryRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GalleryRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), GalleryClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetGalleries", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices + /// + /// + /// Operation Id + /// CloudServices_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCloudServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CloudServiceRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudServiceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), CloudServiceClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetCloudServices", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices + /// + /// + /// Operation Id + /// CloudServices_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCloudServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CloudServiceRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudServiceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), CloudServiceClientDiagnostics, Pipeline, "MockableComputeSubscriptionResource.GetCloudServices", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 6b96a81aa94e6..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Compute -{ - /// 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 VirtualMachineScaleSetResources in the ResourceGroupResource. - /// An object representing collection of VirtualMachineScaleSetResources and their operations over a VirtualMachineScaleSetResource. - public virtual VirtualMachineScaleSetCollection GetVirtualMachineScaleSets() - { - return GetCachedClient(Client => new VirtualMachineScaleSetCollection(Client, Id)); - } - - /// Gets a collection of VirtualMachineResources in the ResourceGroupResource. - /// An object representing collection of VirtualMachineResources and their operations over a VirtualMachineResource. - public virtual VirtualMachineCollection GetVirtualMachines() - { - return GetCachedClient(Client => new VirtualMachineCollection(Client, Id)); - } - - /// Gets a collection of AvailabilitySetResources in the ResourceGroupResource. - /// An object representing collection of AvailabilitySetResources and their operations over a AvailabilitySetResource. - public virtual AvailabilitySetCollection GetAvailabilitySets() - { - return GetCachedClient(Client => new AvailabilitySetCollection(Client, Id)); - } - - /// Gets a collection of ProximityPlacementGroupResources in the ResourceGroupResource. - /// An object representing collection of ProximityPlacementGroupResources and their operations over a ProximityPlacementGroupResource. - public virtual ProximityPlacementGroupCollection GetProximityPlacementGroups() - { - return GetCachedClient(Client => new ProximityPlacementGroupCollection(Client, Id)); - } - - /// Gets a collection of DedicatedHostGroupResources in the ResourceGroupResource. - /// An object representing collection of DedicatedHostGroupResources and their operations over a DedicatedHostGroupResource. - public virtual DedicatedHostGroupCollection GetDedicatedHostGroups() - { - return GetCachedClient(Client => new DedicatedHostGroupCollection(Client, Id)); - } - - /// Gets a collection of SshPublicKeyResources in the ResourceGroupResource. - /// An object representing collection of SshPublicKeyResources and their operations over a SshPublicKeyResource. - public virtual SshPublicKeyCollection GetSshPublicKeys() - { - return GetCachedClient(Client => new SshPublicKeyCollection(Client, Id)); - } - - /// Gets a collection of DiskImageResources in the ResourceGroupResource. - /// An object representing collection of DiskImageResources and their operations over a DiskImageResource. - public virtual DiskImageCollection GetDiskImages() - { - return GetCachedClient(Client => new DiskImageCollection(Client, Id)); - } - - /// Gets a collection of RestorePointGroupResources in the ResourceGroupResource. - /// An object representing collection of RestorePointGroupResources and their operations over a RestorePointGroupResource. - public virtual RestorePointGroupCollection GetRestorePointGroups() - { - return GetCachedClient(Client => new RestorePointGroupCollection(Client, Id)); - } - - /// Gets a collection of CapacityReservationGroupResources in the ResourceGroupResource. - /// An object representing collection of CapacityReservationGroupResources and their operations over a CapacityReservationGroupResource. - public virtual CapacityReservationGroupCollection GetCapacityReservationGroups() - { - return GetCachedClient(Client => new CapacityReservationGroupCollection(Client, Id)); - } - - /// Gets a collection of ManagedDiskResources in the ResourceGroupResource. - /// An object representing collection of ManagedDiskResources and their operations over a ManagedDiskResource. - public virtual ManagedDiskCollection GetManagedDisks() - { - return GetCachedClient(Client => new ManagedDiskCollection(Client, Id)); - } - - /// Gets a collection of DiskAccessResources in the ResourceGroupResource. - /// An object representing collection of DiskAccessResources and their operations over a DiskAccessResource. - public virtual DiskAccessCollection GetDiskAccesses() - { - return GetCachedClient(Client => new DiskAccessCollection(Client, Id)); - } - - /// Gets a collection of DiskEncryptionSetResources in the ResourceGroupResource. - /// An object representing collection of DiskEncryptionSetResources and their operations over a DiskEncryptionSetResource. - public virtual DiskEncryptionSetCollection GetDiskEncryptionSets() - { - return GetCachedClient(Client => new DiskEncryptionSetCollection(Client, Id)); - } - - /// Gets a collection of SnapshotResources in the ResourceGroupResource. - /// An object representing collection of SnapshotResources and their operations over a SnapshotResource. - public virtual SnapshotCollection GetSnapshots() - { - return GetCachedClient(Client => new SnapshotCollection(Client, Id)); - } - - /// Gets a collection of GalleryResources in the ResourceGroupResource. - /// An object representing collection of GalleryResources and their operations over a GalleryResource. - public virtual GalleryCollection GetGalleries() - { - return GetCachedClient(Client => new GalleryCollection(Client, Id)); - } - - /// Gets a collection of CloudServiceResources in the ResourceGroupResource. - /// An object representing collection of CloudServiceResources and their operations over a CloudServiceResource. - public virtual CloudServiceCollection GetCloudServices() - { - return GetCachedClient(Client => new CloudServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index e4547c00bc688..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,1873 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Compute.Models; - -namespace Azure.ResourceManager.Compute -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _usageClientDiagnostics; - private UsageRestOperations _usageRestClient; - private ClientDiagnostics _virtualMachineSizesClientDiagnostics; - private VirtualMachineSizesRestOperations _virtualMachineSizesRestClient; - private ClientDiagnostics _virtualMachineScaleSetClientDiagnostics; - private VirtualMachineScaleSetsRestOperations _virtualMachineScaleSetRestClient; - private ClientDiagnostics _virtualMachineClientDiagnostics; - private VirtualMachinesRestOperations _virtualMachineRestClient; - private ClientDiagnostics _virtualMachineImagesClientDiagnostics; - private VirtualMachineImagesRestOperations _virtualMachineImagesRestClient; - private ClientDiagnostics _virtualMachineImagesEdgeZoneClientDiagnostics; - private VirtualMachineImagesEdgeZoneRestOperations _virtualMachineImagesEdgeZoneRestClient; - private ClientDiagnostics _availabilitySetClientDiagnostics; - private AvailabilitySetsRestOperations _availabilitySetRestClient; - private ClientDiagnostics _proximityPlacementGroupClientDiagnostics; - private ProximityPlacementGroupsRestOperations _proximityPlacementGroupRestClient; - private ClientDiagnostics _dedicatedHostGroupClientDiagnostics; - private DedicatedHostGroupsRestOperations _dedicatedHostGroupRestClient; - private ClientDiagnostics _sshPublicKeyClientDiagnostics; - private SshPublicKeysRestOperations _sshPublicKeyRestClient; - private ClientDiagnostics _diskImageImagesClientDiagnostics; - private ImagesRestOperations _diskImageImagesRestClient; - private ClientDiagnostics _restorePointGroupRestorePointCollectionsClientDiagnostics; - private RestorePointCollectionsRestOperations _restorePointGroupRestorePointCollectionsRestClient; - private ClientDiagnostics _capacityReservationGroupClientDiagnostics; - private CapacityReservationGroupsRestOperations _capacityReservationGroupRestClient; - private ClientDiagnostics _logAnalyticsClientDiagnostics; - private LogAnalyticsRestOperations _logAnalyticsRestClient; - private ClientDiagnostics _virtualMachineRunCommandClientDiagnostics; - private VirtualMachineRunCommandsRestOperations _virtualMachineRunCommandRestClient; - private ClientDiagnostics _managedDiskDisksClientDiagnostics; - private DisksRestOperations _managedDiskDisksRestClient; - private ClientDiagnostics _diskAccessClientDiagnostics; - private DiskAccessesRestOperations _diskAccessRestClient; - private ClientDiagnostics _diskEncryptionSetClientDiagnostics; - private DiskEncryptionSetsRestOperations _diskEncryptionSetRestClient; - private ClientDiagnostics _snapshotClientDiagnostics; - private SnapshotsRestOperations _snapshotRestClient; - private ClientDiagnostics _resourceSkusClientDiagnostics; - private ResourceSkusRestOperations _resourceSkusRestClient; - private ClientDiagnostics _galleryClientDiagnostics; - private GalleriesRestOperations _galleryRestClient; - private ClientDiagnostics _cloudServiceClientDiagnostics; - private CloudServicesRestOperations _cloudServiceRestClient; - - /// 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 UsageClientDiagnostics => _usageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsageRestOperations UsageRestClient => _usageRestClient ??= new UsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics VirtualMachineSizesClientDiagnostics => _virtualMachineSizesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private VirtualMachineSizesRestOperations VirtualMachineSizesRestClient => _virtualMachineSizesRestClient ??= new VirtualMachineSizesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics VirtualMachineScaleSetClientDiagnostics => _virtualMachineScaleSetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", VirtualMachineScaleSetResource.ResourceType.Namespace, Diagnostics); - private VirtualMachineScaleSetsRestOperations VirtualMachineScaleSetRestClient => _virtualMachineScaleSetRestClient ??= new VirtualMachineScaleSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineScaleSetResource.ResourceType)); - private ClientDiagnostics VirtualMachineClientDiagnostics => _virtualMachineClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", VirtualMachineResource.ResourceType.Namespace, Diagnostics); - private VirtualMachinesRestOperations VirtualMachineRestClient => _virtualMachineRestClient ??= new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineResource.ResourceType)); - private ClientDiagnostics VirtualMachineImagesClientDiagnostics => _virtualMachineImagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private VirtualMachineImagesRestOperations VirtualMachineImagesRestClient => _virtualMachineImagesRestClient ??= new VirtualMachineImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics VirtualMachineImagesEdgeZoneClientDiagnostics => _virtualMachineImagesEdgeZoneClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private VirtualMachineImagesEdgeZoneRestOperations VirtualMachineImagesEdgeZoneRestClient => _virtualMachineImagesEdgeZoneRestClient ??= new VirtualMachineImagesEdgeZoneRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AvailabilitySetClientDiagnostics => _availabilitySetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", AvailabilitySetResource.ResourceType.Namespace, Diagnostics); - private AvailabilitySetsRestOperations AvailabilitySetRestClient => _availabilitySetRestClient ??= new AvailabilitySetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AvailabilitySetResource.ResourceType)); - private ClientDiagnostics ProximityPlacementGroupClientDiagnostics => _proximityPlacementGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProximityPlacementGroupResource.ResourceType.Namespace, Diagnostics); - private ProximityPlacementGroupsRestOperations ProximityPlacementGroupRestClient => _proximityPlacementGroupRestClient ??= new ProximityPlacementGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ProximityPlacementGroupResource.ResourceType)); - private ClientDiagnostics DedicatedHostGroupClientDiagnostics => _dedicatedHostGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", DedicatedHostGroupResource.ResourceType.Namespace, Diagnostics); - private DedicatedHostGroupsRestOperations DedicatedHostGroupRestClient => _dedicatedHostGroupRestClient ??= new DedicatedHostGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DedicatedHostGroupResource.ResourceType)); - private ClientDiagnostics SshPublicKeyClientDiagnostics => _sshPublicKeyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", SshPublicKeyResource.ResourceType.Namespace, Diagnostics); - private SshPublicKeysRestOperations SshPublicKeyRestClient => _sshPublicKeyRestClient ??= new SshPublicKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SshPublicKeyResource.ResourceType)); - private ClientDiagnostics DiskImageImagesClientDiagnostics => _diskImageImagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", DiskImageResource.ResourceType.Namespace, Diagnostics); - private ImagesRestOperations DiskImageImagesRestClient => _diskImageImagesRestClient ??= new ImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DiskImageResource.ResourceType)); - private ClientDiagnostics RestorePointGroupRestorePointCollectionsClientDiagnostics => _restorePointGroupRestorePointCollectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", RestorePointGroupResource.ResourceType.Namespace, Diagnostics); - private RestorePointCollectionsRestOperations RestorePointGroupRestorePointCollectionsRestClient => _restorePointGroupRestorePointCollectionsRestClient ??= new RestorePointCollectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RestorePointGroupResource.ResourceType)); - private ClientDiagnostics CapacityReservationGroupClientDiagnostics => _capacityReservationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", CapacityReservationGroupResource.ResourceType.Namespace, Diagnostics); - private CapacityReservationGroupsRestOperations CapacityReservationGroupRestClient => _capacityReservationGroupRestClient ??= new CapacityReservationGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CapacityReservationGroupResource.ResourceType)); - private ClientDiagnostics LogAnalyticsClientDiagnostics => _logAnalyticsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LogAnalyticsRestOperations LogAnalyticsRestClient => _logAnalyticsRestClient ??= new LogAnalyticsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics VirtualMachineRunCommandClientDiagnostics => _virtualMachineRunCommandClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", VirtualMachineRunCommandResource.ResourceType.Namespace, Diagnostics); - private VirtualMachineRunCommandsRestOperations VirtualMachineRunCommandRestClient => _virtualMachineRunCommandRestClient ??= new VirtualMachineRunCommandsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineRunCommandResource.ResourceType)); - private ClientDiagnostics ManagedDiskDisksClientDiagnostics => _managedDiskDisksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ManagedDiskResource.ResourceType.Namespace, Diagnostics); - private DisksRestOperations ManagedDiskDisksRestClient => _managedDiskDisksRestClient ??= new DisksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedDiskResource.ResourceType)); - private ClientDiagnostics DiskAccessClientDiagnostics => _diskAccessClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", DiskAccessResource.ResourceType.Namespace, Diagnostics); - private DiskAccessesRestOperations DiskAccessRestClient => _diskAccessRestClient ??= new DiskAccessesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DiskAccessResource.ResourceType)); - private ClientDiagnostics DiskEncryptionSetClientDiagnostics => _diskEncryptionSetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", DiskEncryptionSetResource.ResourceType.Namespace, Diagnostics); - private DiskEncryptionSetsRestOperations DiskEncryptionSetRestClient => _diskEncryptionSetRestClient ??= new DiskEncryptionSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DiskEncryptionSetResource.ResourceType)); - private ClientDiagnostics SnapshotClientDiagnostics => _snapshotClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", SnapshotResource.ResourceType.Namespace, Diagnostics); - private SnapshotsRestOperations SnapshotRestClient => _snapshotRestClient ??= new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SnapshotResource.ResourceType)); - private ClientDiagnostics ResourceSkusClientDiagnostics => _resourceSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceSkusRestOperations ResourceSkusRestClient => _resourceSkusRestClient ??= new ResourceSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics GalleryClientDiagnostics => _galleryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", GalleryResource.ResourceType.Namespace, Diagnostics); - private GalleriesRestOperations GalleryRestClient => _galleryRestClient ??= new GalleriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GalleryResource.ResourceType)); - private ClientDiagnostics CloudServiceClientDiagnostics => _cloudServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Compute", CloudServiceResource.ResourceType.Namespace, Diagnostics); - private CloudServicesRestOperations CloudServiceRestClient => _cloudServiceRestClient ??= new CloudServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CloudServiceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of VirtualMachineExtensionImageResources in the SubscriptionResource. - /// The name of a supported Azure region. - /// The String to use. - /// An object representing collection of VirtualMachineExtensionImageResources and their operations over a VirtualMachineExtensionImageResource. - public virtual VirtualMachineExtensionImageCollection GetVirtualMachineExtensionImages(AzureLocation location, string publisherName) - { - return new VirtualMachineExtensionImageCollection(Client, Id, location, publisherName); - } - - /// Gets a collection of SharedGalleryResources in the SubscriptionResource. - /// Resource location. - /// An object representing collection of SharedGalleryResources and their operations over a SharedGalleryResource. - public virtual SharedGalleryCollection GetSharedGalleries(AzureLocation location) - { - return new SharedGalleryCollection(Client, Id, location); - } - - /// Gets a collection of CommunityGalleryResources in the SubscriptionResource. - /// An object representing collection of CommunityGalleryResources and their operations over a CommunityGalleryResource. - public virtual CommunityGalleryCollection GetCommunityGalleries() - { - return GetCachedClient(Client => new CommunityGalleryCollection(Client, Id)); - } - - /// Gets a collection of CloudServiceOSVersionResources in the SubscriptionResource. - /// Name of the location that the OS versions pertain to. - /// An object representing collection of CloudServiceOSVersionResources and their operations over a CloudServiceOSVersionResource. - public virtual CloudServiceOSVersionCollection GetCloudServiceOSVersions(AzureLocation location) - { - return new CloudServiceOSVersionCollection(Client, Id, location); - } - - /// Gets a collection of CloudServiceOSFamilyResources in the SubscriptionResource. - /// Name of the location that the OS families pertain to. - /// An object representing collection of CloudServiceOSFamilyResources and their operations over a CloudServiceOSFamilyResource. - public virtual CloudServiceOSFamilyCollection GetCloudServiceOSFamilies(AzureLocation location) - { - return new CloudServiceOSFamilyCollection(Client, Id, location); - } - - /// - /// Gets, for the specified location, the current compute resource usage information as well as the limits for compute resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages - /// - /// - /// Operation Id - /// Usage_List - /// - /// - /// - /// The location for which resource usage is queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsageRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ComputeUsage.DeserializeComputeUsage, UsageClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Gets, for the specified location, the current compute resource usage information as well as the limits for compute resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages - /// - /// - /// Operation Id - /// Usage_List - /// - /// - /// - /// The location for which resource usage is queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsageRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ComputeUsage.DeserializeComputeUsage, UsageClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list) - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes - /// - /// - /// Operation Id - /// VirtualMachineSizes_List - /// - /// - /// - /// The location upon which virtual-machine-sizes is queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineSizesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineSizesRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineSize.DeserializeVirtualMachineSize, VirtualMachineSizesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineSizes", "value", null, cancellationToken); - } - - /// - /// This API is deprecated. Use [Resources Skus](https://docs.microsoft.com/rest/api/compute/resourceskus/list) - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes - /// - /// - /// Operation Id - /// VirtualMachineSizes_List - /// - /// - /// - /// The location upon which virtual-machine-sizes is queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineSizes(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineSizesRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineSize.DeserializeVirtualMachineSize, VirtualMachineSizesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineSizes", "value", null, cancellationToken); - } - - /// - /// Gets all the VM scale sets under the specified subscription for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets - /// - /// - /// Operation Id - /// VirtualMachineScaleSets_ListByLocation - /// - /// - /// - /// The location for which VM scale sets under the subscription are queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineScaleSetsByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSetsByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the VM scale sets under the specified subscription for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets - /// - /// - /// Operation Id - /// VirtualMachineScaleSets_ListByLocation - /// - /// - /// - /// The location for which VM scale sets under the subscription are queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineScaleSetsByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSetsByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM Scale Sets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets - /// - /// - /// Operation Id - /// VirtualMachineScaleSets_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineScaleSetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSets", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM Scale Sets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets - /// - /// - /// Operation Id - /// VirtualMachineScaleSets_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineScaleSets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineScaleSetRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineScaleSetRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineScaleSetResource(Client, VirtualMachineScaleSetData.DeserializeVirtualMachineScaleSetData(e)), VirtualMachineScaleSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineScaleSets", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the virtual machines under the specified subscription for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_ListByLocation - /// - /// - /// - /// The location for which virtual machines under the subscription are queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachinesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachinesByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the virtual machines under the specified subscription for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_ListByLocation - /// - /// - /// - /// The location for which virtual machines under the subscription are queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachinesByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachinesByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_ListAll - /// - /// - /// - /// statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. - /// The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. - /// The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this can only be specified if a valid $filter option is specified. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachinesAsync(string statusOnly = null, string filter = null, ExpandTypesForListVm? expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListAllRequest(Id.SubscriptionId, statusOnly, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, statusOnly, filter, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_ListAll - /// - /// - /// - /// statusOnly=true enables fetching run time status of all Virtual Machines in the subscription. - /// The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. - /// The expand expression to apply on operation. 'instanceView' enables fetching run time status of all Virtual Machines, this can only be specified if a valid $filter option is specified. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachines(string statusOnly = null, string filter = null, ExpandTypesForListVm? expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListAllRequest(Id.SubscriptionId, statusOnly, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId, statusOnly, filter, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a virtual machine image. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} - /// - /// - /// Operation Id - /// VirtualMachineImages_Get - /// - /// - /// - /// The name of a supported Azure region. - /// A valid image publisher. - /// A valid image publisher offer. - /// A valid image SKU. - /// A valid image SKU version. - /// The cancellation token to use. - public virtual async Task> GetVirtualMachineImageAsync(AzureLocation location, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) - { - using var scope = VirtualMachineImagesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualMachineImage"); - scope.Start(); - try - { - var response = await VirtualMachineImagesRestClient.GetAsync(Id.SubscriptionId, location, publisherName, offer, skus, version, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a virtual machine image. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} - /// - /// - /// Operation Id - /// VirtualMachineImages_Get - /// - /// - /// - /// The name of a supported Azure region. - /// A valid image publisher. - /// A valid image publisher offer. - /// A valid image SKU. - /// A valid image SKU version. - /// The cancellation token to use. - public virtual Response GetVirtualMachineImage(AzureLocation location, string publisherName, string offer, string skus, string version, CancellationToken cancellationToken = default) - { - using var scope = VirtualMachineImagesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualMachineImage"); - scope.Start(); - try - { - var response = VirtualMachineImagesRestClient.Get(Id.SubscriptionId, location, publisherName, offer, skus, version, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions - /// - /// - /// Operation Id - /// VirtualMachineImages_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineImagesAsync(SubscriptionResourceGetVirtualMachineImagesOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListRequest(Id.SubscriptionId, options.Location, options.PublisherName, options.Offer, options.Skus, options.Expand, options.Top, options.Orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImages", "", null, cancellationToken); - } - - /// - /// Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions - /// - /// - /// Operation Id - /// VirtualMachineImages_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineImages(SubscriptionResourceGetVirtualMachineImagesOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListRequest(Id.SubscriptionId, options.Location, options.PublisherName, options.Offer, options.Skus, options.Expand, options.Top, options.Orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImages", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image offers for the specified location and publisher. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers - /// - /// - /// Operation Id - /// VirtualMachineImages_ListOffers - /// - /// - /// - /// The name of a supported Azure region. - /// A valid image publisher. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineImageOffersAsync(AzureLocation location, string publisherName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListOffersRequest(Id.SubscriptionId, location, publisherName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImageOffers", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image offers for the specified location and publisher. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers - /// - /// - /// Operation Id - /// VirtualMachineImages_ListOffers - /// - /// - /// - /// The name of a supported Azure region. - /// A valid image publisher. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineImageOffers(AzureLocation location, string publisherName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListOffersRequest(Id.SubscriptionId, location, publisherName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImageOffers", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image publishers for the specified Azure location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers - /// - /// - /// Operation Id - /// VirtualMachineImages_ListPublishers - /// - /// - /// - /// The name of a supported Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineImagePublishersAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListPublishersRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImagePublishers", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image publishers for the specified Azure location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers - /// - /// - /// Operation Id - /// VirtualMachineImages_ListPublishers - /// - /// - /// - /// The name of a supported Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineImagePublishers(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListPublishersRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImagePublishers", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus - /// - /// - /// Operation Id - /// VirtualMachineImages_ListSkus - /// - /// - /// - /// The name of a supported Azure region. - /// A valid image publisher. - /// A valid image publisher offer. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineImageSkusAsync(AzureLocation location, string publisherName, string offer, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListSkusRequest(Id.SubscriptionId, location, publisherName, offer); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImageSkus", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus - /// - /// - /// Operation Id - /// VirtualMachineImages_ListSkus - /// - /// - /// - /// The name of a supported Azure region. - /// A valid image publisher. - /// A valid image publisher offer. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineImageSkus(AzureLocation location, string publisherName, string offer, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListSkusRequest(Id.SubscriptionId, location, publisherName, offer); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImageSkus", "", null, cancellationToken); - } - - /// - /// Gets a list of all virtual machine image versions for the specified edge zone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages - /// - /// - /// Operation Id - /// VirtualMachineImages_ListByEdgeZone - /// - /// - /// - /// The name of a supported Azure region. - /// The name of the edge zone. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineImagesByEdgeZoneAsync(AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListByEdgeZoneRequest(Id.SubscriptionId, location, edgeZone); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImagesByEdgeZone", "value", null, cancellationToken); - } - - /// - /// Gets a list of all virtual machine image versions for the specified edge zone - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/vmimages - /// - /// - /// Operation Id - /// VirtualMachineImages_ListByEdgeZone - /// - /// - /// - /// The name of a supported Azure region. - /// The name of the edge zone. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineImagesByEdgeZone(AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesRestClient.CreateListByEdgeZoneRequest(Id.SubscriptionId, location, edgeZone); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImagesByEdgeZone", "value", null, cancellationToken); - } - - /// - /// Gets a virtual machine image in an edge zone. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_Get - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual async Task> GetVirtualMachineImagesEdgeZoneAsync(SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options, CancellationToken cancellationToken = default) - { - using var scope = VirtualMachineImagesEdgeZoneClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualMachineImagesEdgeZone"); - scope.Start(); - try - { - var response = await VirtualMachineImagesEdgeZoneRestClient.GetAsync(Id.SubscriptionId, options.Location, options.EdgeZone, options.PublisherName, options.Offer, options.Skus, options.Version, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a virtual machine image in an edge zone. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version} - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_Get - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual Response GetVirtualMachineImagesEdgeZone(SubscriptionResourceGetVirtualMachineImagesEdgeZoneOptions options, CancellationToken cancellationToken = default) - { - using var scope = VirtualMachineImagesEdgeZoneClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualMachineImagesEdgeZone"); - scope.Start(); - try - { - var response = VirtualMachineImagesEdgeZoneRestClient.Get(Id.SubscriptionId, options.Location, options.EdgeZone, options.PublisherName, options.Offer, options.Skus, options.Version, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineImagesEdgeZonesAsync(SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListRequest(Id.SubscriptionId, options.Location, options.EdgeZone, options.PublisherName, options.Offer, options.Skus, options.Expand, options.Top, options.Orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImagesEdgeZones", "", null, cancellationToken); - } - - /// - /// Gets a list of all virtual machine image versions for the specified location, edge zone, publisher, offer, and SKU. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineImagesEdgeZones(SubscriptionResourceGetVirtualMachineImagesEdgeZonesOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListRequest(Id.SubscriptionId, options.Location, options.EdgeZone, options.PublisherName, options.Offer, options.Skus, options.Expand, options.Top, options.Orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImagesEdgeZones", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image offers for the specified location, edge zone and publisher. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_ListOffers - /// - /// - /// - /// The name of a supported Azure region. - /// The name of the edge zone. - /// A valid image publisher. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOffersVirtualMachineImagesEdgeZonesAsync(AzureLocation location, string edgeZone, string publisherName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListOffersRequest(Id.SubscriptionId, location, edgeZone, publisherName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOffersVirtualMachineImagesEdgeZones", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image offers for the specified location, edge zone and publisher. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_ListOffers - /// - /// - /// - /// The name of a supported Azure region. - /// The name of the edge zone. - /// A valid image publisher. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOffersVirtualMachineImagesEdgeZones(AzureLocation location, string edgeZone, string publisherName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListOffersRequest(Id.SubscriptionId, location, edgeZone, publisherName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOffersVirtualMachineImagesEdgeZones", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image publishers for the specified Azure location and edge zone. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_ListPublishers - /// - /// - /// - /// The name of a supported Azure region. - /// The name of the edge zone. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPublishersVirtualMachineImagesEdgeZonesAsync(AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListPublishersRequest(Id.SubscriptionId, location, edgeZone); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPublishersVirtualMachineImagesEdgeZones", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image publishers for the specified Azure location and edge zone. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_ListPublishers - /// - /// - /// - /// The name of a supported Azure region. - /// The name of the edge zone. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPublishersVirtualMachineImagesEdgeZones(AzureLocation location, string edgeZone, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListPublishersRequest(Id.SubscriptionId, location, edgeZone); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPublishersVirtualMachineImagesEdgeZones", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_ListSkus - /// - /// - /// - /// The name of a supported Azure region. - /// The name of the edge zone. - /// A valid image publisher. - /// A valid image publisher offer. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineImageEdgeZoneSkusAsync(AzureLocation location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListSkusRequest(Id.SubscriptionId, location, edgeZone, publisherName, offer); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImageEdgeZoneSkus", "", null, cancellationToken); - } - - /// - /// Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus - /// - /// - /// Operation Id - /// VirtualMachineImagesEdgeZone_ListSkus - /// - /// - /// - /// The name of a supported Azure region. - /// The name of the edge zone. - /// A valid image publisher. - /// A valid image publisher offer. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineImageEdgeZoneSkus(AzureLocation location, string edgeZone, string publisherName, string offer, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineImagesEdgeZoneRestClient.CreateListSkusRequest(Id.SubscriptionId, location, edgeZone, publisherName, offer); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, VirtualMachineImageBase.DeserializeVirtualMachineImageBase, VirtualMachineImagesEdgeZoneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineImageEdgeZoneSkus", "", null, cancellationToken); - } - - /// - /// Lists all availability sets in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets - /// - /// - /// Operation Id - /// AvailabilitySets_ListBySubscription - /// - /// - /// - /// The expand expression to apply to the operation. Allowed values are 'instanceView'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailabilitySetsAsync(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilitySetRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilitySetRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), AvailabilitySetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailabilitySets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all availability sets in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets - /// - /// - /// Operation Id - /// AvailabilitySets_ListBySubscription - /// - /// - /// - /// The expand expression to apply to the operation. Allowed values are 'instanceView'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailabilitySets(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilitySetRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilitySetRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AvailabilitySetResource(Client, AvailabilitySetData.DeserializeAvailabilitySetData(e)), AvailabilitySetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailabilitySets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all proximity placement groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups - /// - /// - /// Operation Id - /// ProximityPlacementGroups_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProximityPlacementGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProximityPlacementGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProximityPlacementGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), ProximityPlacementGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProximityPlacementGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all proximity placement groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups - /// - /// - /// Operation Id - /// ProximityPlacementGroups_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProximityPlacementGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProximityPlacementGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProximityPlacementGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProximityPlacementGroupResource(Client, ProximityPlacementGroupData.DeserializeProximityPlacementGroupData(e)), ProximityPlacementGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProximityPlacementGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups - /// - /// - /// Operation Id - /// DedicatedHostGroups_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDedicatedHostGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHostGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHostGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), DedicatedHostGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedHostGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the dedicated host groups in the subscription. Use the nextLink property in the response to get the next page of dedicated host groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups - /// - /// - /// Operation Id - /// DedicatedHostGroups_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDedicatedHostGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHostGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHostGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHostGroupResource(Client, DedicatedHostGroupData.DeserializeDedicatedHostGroupData(e)), DedicatedHostGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedHostGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next page of SSH public keys. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys - /// - /// - /// Operation Id - /// SshPublicKeys_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSshPublicKeysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SshPublicKeyRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SshPublicKeyRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), SshPublicKeyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSshPublicKeys", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next page of SSH public keys. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys - /// - /// - /// Operation Id - /// SshPublicKeys_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSshPublicKeys(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SshPublicKeyRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SshPublicKeyRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SshPublicKeyResource(Client, SshPublicKeyData.DeserializeSshPublicKeyData(e)), SshPublicKeyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSshPublicKeys", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/images - /// - /// - /// Operation Id - /// Images_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDiskImagesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskImageImagesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskImageImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), DiskImageImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskImages", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Images in the subscription. Use nextLink property in the response to get the next page of Images. Do this till nextLink is null to fetch all the Images. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/images - /// - /// - /// Operation Id - /// Images_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDiskImages(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskImageImagesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskImageImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskImageResource(Client, DiskImageData.DeserializeDiskImageData(e)), DiskImageImagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskImages", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the next page of restore point collections. Do this till nextLink is not null to fetch all the restore point collections. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections - /// - /// - /// Operation Id - /// RestorePointCollections_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRestorePointGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), RestorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorePointGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the next page of restore point collections. Do this till nextLink is not null to fetch all the restore point collections. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections - /// - /// - /// Operation Id - /// RestorePointCollections_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRestorePointGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestorePointGroupRestorePointCollectionsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RestorePointGroupResource(Client, RestorePointGroupData.DeserializeRestorePointGroupData(e)), RestorePointGroupRestorePointCollectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorePointGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to get the next page of capacity reservation groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups - /// - /// - /// Operation Id - /// CapacityReservationGroups_ListBySubscription - /// - /// - /// - /// The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCapacityReservationGroupsAsync(CapacityReservationGroupGetExpand? expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CapacityReservationGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CapacityReservationGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), CapacityReservationGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCapacityReservationGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the capacity reservation groups in the subscription. Use the nextLink property in the response to get the next page of capacity reservation groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups - /// - /// - /// Operation Id - /// CapacityReservationGroups_ListBySubscription - /// - /// - /// - /// The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCapacityReservationGroups(CapacityReservationGroupGetExpand? expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CapacityReservationGroupRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CapacityReservationGroupRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CapacityReservationGroupResource(Client, CapacityReservationGroupData.DeserializeCapacityReservationGroupData(e)), CapacityReservationGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCapacityReservationGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Export logs that show Api requests made by this subscription in the given time window to show throttling activities. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval - /// - /// - /// Operation Id - /// LogAnalytics_ExportRequestRateByInterval - /// - /// - /// - /// 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 location upon which virtual-machine-sizes is queried. - /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. - /// The cancellation token to use. - public virtual async Task> ExportLogAnalyticsRequestRateByIntervalAsync(WaitUntil waitUntil, AzureLocation location, RequestRateByIntervalContent content, CancellationToken cancellationToken = default) - { - using var scope = LogAnalyticsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExportLogAnalyticsRequestRateByInterval"); - scope.Start(); - try - { - var response = await LogAnalyticsRestClient.ExportRequestRateByIntervalAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - var operation = new ComputeArmOperation(new LogAnalyticsOperationSource(), LogAnalyticsClientDiagnostics, Pipeline, LogAnalyticsRestClient.CreateExportRequestRateByIntervalRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Export logs that show Api requests made by this subscription in the given time window to show throttling activities. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval - /// - /// - /// Operation Id - /// LogAnalytics_ExportRequestRateByInterval - /// - /// - /// - /// 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 location upon which virtual-machine-sizes is queried. - /// Parameters supplied to the LogAnalytics getRequestRateByInterval Api. - /// The cancellation token to use. - public virtual ArmOperation ExportLogAnalyticsRequestRateByInterval(WaitUntil waitUntil, AzureLocation location, RequestRateByIntervalContent content, CancellationToken cancellationToken = default) - { - using var scope = LogAnalyticsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExportLogAnalyticsRequestRateByInterval"); - scope.Start(); - try - { - var response = LogAnalyticsRestClient.ExportRequestRateByInterval(Id.SubscriptionId, location, content, cancellationToken); - var operation = new ComputeArmOperation(new LogAnalyticsOperationSource(), LogAnalyticsClientDiagnostics, Pipeline, LogAnalyticsRestClient.CreateExportRequestRateByIntervalRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Export logs that show total throttled Api requests for this subscription in the given time window. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests - /// - /// - /// Operation Id - /// LogAnalytics_ExportThrottledRequests - /// - /// - /// - /// 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 location upon which virtual-machine-sizes is queried. - /// Parameters supplied to the LogAnalytics getThrottledRequests Api. - /// The cancellation token to use. - public virtual async Task> ExportLogAnalyticsThrottledRequestsAsync(WaitUntil waitUntil, AzureLocation location, ThrottledRequestsContent content, CancellationToken cancellationToken = default) - { - using var scope = LogAnalyticsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExportLogAnalyticsThrottledRequests"); - scope.Start(); - try - { - var response = await LogAnalyticsRestClient.ExportThrottledRequestsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - var operation = new ComputeArmOperation(new LogAnalyticsOperationSource(), LogAnalyticsClientDiagnostics, Pipeline, LogAnalyticsRestClient.CreateExportThrottledRequestsRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Export logs that show total throttled Api requests for this subscription in the given time window. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests - /// - /// - /// Operation Id - /// LogAnalytics_ExportThrottledRequests - /// - /// - /// - /// 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 location upon which virtual-machine-sizes is queried. - /// Parameters supplied to the LogAnalytics getThrottledRequests Api. - /// The cancellation token to use. - public virtual ArmOperation ExportLogAnalyticsThrottledRequests(WaitUntil waitUntil, AzureLocation location, ThrottledRequestsContent content, CancellationToken cancellationToken = default) - { - using var scope = LogAnalyticsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExportLogAnalyticsThrottledRequests"); - scope.Start(); - try - { - var response = LogAnalyticsRestClient.ExportThrottledRequests(Id.SubscriptionId, location, content, cancellationToken); - var operation = new ComputeArmOperation(new LogAnalyticsOperationSource(), LogAnalyticsClientDiagnostics, Pipeline, LogAnalyticsRestClient.CreateExportThrottledRequestsRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all available run commands for a subscription in a location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands - /// - /// - /// Operation Id - /// VirtualMachineRunCommands_List - /// - /// - /// - /// The location upon which run commands is queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineRunCommandsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRunCommandRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRunCommandRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RunCommandDocumentBase.DeserializeRunCommandDocumentBase, VirtualMachineRunCommandClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineRunCommands", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all available run commands for a subscription in a location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands - /// - /// - /// Operation Id - /// VirtualMachineRunCommands_List - /// - /// - /// - /// The location upon which run commands is queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineRunCommands(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRunCommandRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRunCommandRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RunCommandDocumentBase.DeserializeRunCommandDocumentBase, VirtualMachineRunCommandClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineRunCommands", "value", "nextLink", cancellationToken); - } - - /// - /// Gets specific run command for a subscription in a location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId} - /// - /// - /// Operation Id - /// VirtualMachineRunCommands_Get - /// - /// - /// - /// The location upon which run commands is queried. - /// The command id. - /// The cancellation token to use. - public virtual async Task> GetVirtualMachineRunCommandAsync(AzureLocation location, string commandId, CancellationToken cancellationToken = default) - { - using var scope = VirtualMachineRunCommandClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualMachineRunCommand"); - scope.Start(); - try - { - var response = await VirtualMachineRunCommandRestClient.GetAsync(Id.SubscriptionId, location, commandId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets specific run command for a subscription in a location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId} - /// - /// - /// Operation Id - /// VirtualMachineRunCommands_Get - /// - /// - /// - /// The location upon which run commands is queried. - /// The command id. - /// The cancellation token to use. - public virtual Response GetVirtualMachineRunCommand(AzureLocation location, string commandId, CancellationToken cancellationToken = default) - { - using var scope = VirtualMachineRunCommandClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetVirtualMachineRunCommand"); - scope.Start(); - try - { - var response = VirtualMachineRunCommandRestClient.Get(Id.SubscriptionId, location, commandId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all the disks under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks - /// - /// - /// Operation Id - /// Disks_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedDisksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedDiskDisksRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedDiskDisksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), ManagedDiskDisksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedDisks", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the disks under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks - /// - /// - /// Operation Id - /// Disks_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedDisks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedDiskDisksRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedDiskDisksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedDiskResource(Client, ManagedDiskData.DeserializeManagedDiskData(e)), ManagedDiskDisksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedDisks", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the disk access resources under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses - /// - /// - /// Operation Id - /// DiskAccesses_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDiskAccessesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskAccessRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskAccessRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), DiskAccessClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskAccesses", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the disk access resources under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses - /// - /// - /// Operation Id - /// DiskAccesses_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDiskAccesses(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskAccessRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskAccessRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskAccessResource(Client, DiskAccessData.DeserializeDiskAccessData(e)), DiskAccessClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskAccesses", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the disk encryption sets under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets - /// - /// - /// Operation Id - /// DiskEncryptionSets_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDiskEncryptionSetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskEncryptionSetRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskEncryptionSetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), DiskEncryptionSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskEncryptionSets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the disk encryption sets under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets - /// - /// - /// Operation Id - /// DiskEncryptionSets_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDiskEncryptionSets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskEncryptionSetRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskEncryptionSetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskEncryptionSetResource(Client, DiskEncryptionSetData.DeserializeDiskEncryptionSetData(e)), DiskEncryptionSetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskEncryptionSets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists snapshots under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSnapshotsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SnapshotRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), SnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSnapshots", "value", "nextLink", cancellationToken); - } - - /// - /// Lists snapshots under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSnapshots(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SnapshotRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), SnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSnapshots", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Microsoft.Compute SKUs available for your Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus - /// - /// - /// Operation Id - /// ResourceSkus_List - /// - /// - /// - /// The filter to apply on the operation. Only **location** filter is supported currently. - /// To Include Extended Locations information or not in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetComputeResourceSkusAsync(string filter = null, string includeExtendedLocations = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId, filter, includeExtendedLocations); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, includeExtendedLocations); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ComputeResourceSku.DeserializeComputeResourceSku, ResourceSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetComputeResourceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Microsoft.Compute SKUs available for your Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus - /// - /// - /// Operation Id - /// ResourceSkus_List - /// - /// - /// - /// The filter to apply on the operation. Only **location** filter is supported currently. - /// To Include Extended Locations information or not in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetComputeResourceSkus(string filter = null, string includeExtendedLocations = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId, filter, includeExtendedLocations); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, includeExtendedLocations); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ComputeResourceSku.DeserializeComputeResourceSku, ResourceSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetComputeResourceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// List galleries under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries - /// - /// - /// Operation Id - /// Galleries_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetGalleriesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => GalleryRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GalleryRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), GalleryClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGalleries", "value", "nextLink", cancellationToken); - } - - /// - /// List galleries under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries - /// - /// - /// Operation Id - /// Galleries_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetGalleries(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => GalleryRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GalleryRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GalleryResource(Client, GalleryData.DeserializeGalleryData(e)), GalleryClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGalleries", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices - /// - /// - /// Operation Id - /// CloudServices_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCloudServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CloudServiceRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudServiceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), CloudServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCloudServices", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices - /// - /// - /// Operation Id - /// CloudServices_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCloudServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CloudServiceRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudServiceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudServiceResource(Client, CloudServiceData.DeserializeCloudServiceData(e)), CloudServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCloudServices", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationResource.cs index 2cf0bf47d7106..80f4dc5a037ae 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Compute public partial class GalleryApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The galleryName. + /// The galleryApplicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string galleryName, string galleryApplicationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GalleryApplicationVersionResources and their operations over a GalleryApplicationVersionResource. public virtual GalleryApplicationVersionCollection GetGalleryApplicationVersions() { - return GetCachedClient(Client => new GalleryApplicationVersionCollection(Client, Id)); + return GetCachedClient(client => new GalleryApplicationVersionCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual GalleryApplicationVersionCollection GetGalleryApplicationVersions /// The name of the gallery Application Version to be retrieved. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGalleryApplicationVersionAsync(string galleryApplicationVersionName, ReplicationStatusType? expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +139,8 @@ public virtual async Task> GetGaller /// The name of the gallery Application Version to be retrieved. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGalleryApplicationVersion(string galleryApplicationVersionName, ReplicationStatusType? expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionResource.cs index 20c8dcadc35c6..94f7d4af7558a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationVersionResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.Compute public partial class GalleryApplicationVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The galleryName. + /// The galleryApplicationName. + /// The galleryApplicationVersionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageResource.cs index 05e09bca64dd5..06e60a9c1a4cb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Compute public partial class GalleryImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The galleryName. + /// The galleryImageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string galleryName, string galleryImageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GalleryImageVersionResources and their operations over a GalleryImageVersionResource. public virtual GalleryImageVersionCollection GetGalleryImageVersions() { - return GetCachedClient(Client => new GalleryImageVersionCollection(Client, Id)); + return GetCachedClient(client => new GalleryImageVersionCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual GalleryImageVersionCollection GetGalleryImageVersions() /// The name of the gallery image version to be retrieved. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGalleryImageVersionAsync(string galleryImageVersionName, ReplicationStatusType? expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +139,8 @@ public virtual async Task> GetGalleryImage /// The name of the gallery image version to be retrieved. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGalleryImageVersion(string galleryImageVersionName, ReplicationStatusType? expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionResource.cs index 55da10aa90b01..dc45ff885f488 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageVersionResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.Compute public partial class GalleryImageVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The galleryName. + /// The galleryImageName. + /// The galleryImageVersionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string galleryName, string galleryImageName, string galleryImageVersionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryResource.cs index fb762f4e58731..d628a8037dd09 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class GalleryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The galleryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string galleryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"; @@ -97,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GalleryImageResources and their operations over a GalleryImageResource. public virtual GalleryImageCollection GetGalleryImages() { - return GetCachedClient(Client => new GalleryImageCollection(Client, Id)); + return GetCachedClient(client => new GalleryImageCollection(client, Id)); } /// @@ -115,8 +118,8 @@ public virtual GalleryImageCollection GetGalleryImages() /// /// The name of the gallery image definition to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGalleryImageAsync(string galleryImageName, CancellationToken cancellationToken = default) { @@ -138,8 +141,8 @@ public virtual async Task> GetGalleryImageAsync(s /// /// The name of the gallery image definition to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGalleryImage(string galleryImageName, CancellationToken cancellationToken = default) { @@ -150,7 +153,7 @@ public virtual Response GetGalleryImage(string galleryImag /// An object representing collection of GalleryApplicationResources and their operations over a GalleryApplicationResource. public virtual GalleryApplicationCollection GetGalleryApplications() { - return GetCachedClient(Client => new GalleryApplicationCollection(Client, Id)); + return GetCachedClient(client => new GalleryApplicationCollection(client, Id)); } /// @@ -168,8 +171,8 @@ public virtual GalleryApplicationCollection GetGalleryApplications() /// /// The name of the gallery Application Definition to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGalleryApplicationAsync(string galleryApplicationName, CancellationToken cancellationToken = default) { @@ -191,8 +194,8 @@ public virtual async Task> GetGalleryApplic /// /// The name of the gallery Application Definition to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGalleryApplication(string galleryApplicationName, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskResource.cs index aeec8d7613890..5967d269da2ec 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ManagedDiskResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class ManagedDiskResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The diskName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string diskName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupResource.cs index 5afbf20cc8d5a..a7a8f48736829 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ProximityPlacementGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class ProximityPlacementGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The proximityPlacementGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string proximityPlacementGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupResource.cs index 1de5f376d5298..e876283415f49 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class RestorePointGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The restorePointGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string restorePointGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointGroupName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RestorePointResources and their operations over a RestorePointResource. public virtual RestorePointCollection GetRestorePoints() { - return GetCachedClient(Client => new RestorePointCollection(Client, Id)); + return GetCachedClient(client => new RestorePointCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual RestorePointCollection GetRestorePoints() /// The name of the restore point. /// The expand expression to apply on the operation. 'InstanceView' retrieves information about the run-time state of a restore point. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRestorePointAsync(string restorePointName, RestorePointExpand? expand = null, CancellationToken cancellationToken = default) { @@ -136,8 +139,8 @@ public virtual async Task> GetRestorePointAsync(s /// The name of the restore point. /// The expand expression to apply on the operation. 'InstanceView' retrieves information about the run-time state of a restore point. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRestorePoint(string restorePointName, RestorePointExpand? expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointResource.cs index 508dbb47f6931..bb9ae93642098 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Compute public partial class RestorePointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The restorePointGroupName. + /// The restorePointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string restorePointGroupName, string restorePointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointGroupName}/restorePoints/{restorePointName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DiskRestorePointResources and their operations over a DiskRestorePointResource. public virtual DiskRestorePointCollection GetDiskRestorePoints() { - return GetCachedClient(Client => new DiskRestorePointCollection(Client, Id)); + return GetCachedClient(client => new DiskRestorePointCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual DiskRestorePointCollection GetDiskRestorePoints() /// /// The name of the disk restore point created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDiskRestorePointAsync(string diskRestorePointName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetDiskRestorePoin /// /// The name of the disk restore point created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDiskRestorePoint(string diskRestorePointName, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageResource.cs index fe8a1321ad66b..c9bf2e3725e79 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Compute public partial class SharedGalleryImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The galleryUniqueName. + /// The galleryImageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string galleryUniqueName, string galleryImageName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SharedGalleryImageVersionResources and their operations over a SharedGalleryImageVersionResource. public virtual SharedGalleryImageVersionCollection GetSharedGalleryImageVersions() { - return GetCachedClient(Client => new SharedGalleryImageVersionCollection(Client, Id)); + return GetCachedClient(client => new SharedGalleryImageVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual SharedGalleryImageVersionCollection GetSharedGalleryImageVersions /// /// The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSharedGalleryImageVersionAsync(string galleryImageVersionName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetShared /// /// The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSharedGalleryImageVersion(string galleryImageVersionName, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionResource.cs index 213dbaf6bdcb0..e078c25f2e70f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageVersionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Compute public partial class SharedGalleryImageVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The galleryUniqueName. + /// The galleryImageName. + /// The galleryImageVersionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string galleryUniqueName, string galleryImageName, string galleryImageVersionName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryResource.cs index d8b916ec9cfe2..88901e4a2aed8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Compute public partial class SharedGalleryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The galleryUniqueName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string galleryUniqueName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}"; @@ -91,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SharedGalleryImageResources and their operations over a SharedGalleryImageResource. public virtual SharedGalleryImageCollection GetSharedGalleryImages() { - return GetCachedClient(Client => new SharedGalleryImageCollection(Client, Id)); + return GetCachedClient(client => new SharedGalleryImageCollection(client, Id)); } /// @@ -109,8 +112,8 @@ public virtual SharedGalleryImageCollection GetSharedGalleryImages() /// /// The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSharedGalleryImageAsync(string galleryImageName, CancellationToken cancellationToken = default) { @@ -132,8 +135,8 @@ public virtual async Task> GetSharedGallery /// /// The name of the Shared Gallery Image Definition from which the Image Versions are to be listed. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSharedGalleryImage(string galleryImageName, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotResource.cs index f0c09a5498968..9a14c3c8ed1d5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SnapshotResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class SnapshotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The snapshotName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string snapshotName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyResource.cs index b4e1d9475df93..4ccc4243503dd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SshPublicKeyResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Compute public partial class SshPublicKeyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sshPublicKeyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sshPublicKeyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageResource.cs index b1ce9d8cc6ed8..36d78e9f34a8c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionImageResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineExtensionImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The publisherName. + /// The type. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string publisherName, string type, string version) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionResource.cs index af0ba0133732a..5bc5047731b26 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineExtensionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmName. + /// The vmExtensionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmName, string vmExtensionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs index 9dbd74a2499b3..c84eddb0227b9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VirtualMachineExtensionResources and their operations over a VirtualMachineExtensionResource. public virtual VirtualMachineExtensionCollection GetVirtualMachineExtensions() { - return GetCachedClient(Client => new VirtualMachineExtensionCollection(Client, Id)); + return GetCachedClient(client => new VirtualMachineExtensionCollection(client, Id)); } /// @@ -113,8 +116,8 @@ public virtual VirtualMachineExtensionCollection GetVirtualMachineExtensions() /// The name of the virtual machine extension. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualMachineExtensionAsync(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) { @@ -137,8 +140,8 @@ public virtual async Task> GetVirtualM /// The name of the virtual machine extension. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualMachineExtension(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) { @@ -149,7 +152,7 @@ public virtual Response GetVirtualMachineExtens /// An object representing collection of VirtualMachineRunCommandResources and their operations over a VirtualMachineRunCommandResource. public virtual VirtualMachineRunCommandCollection GetVirtualMachineRunCommands() { - return GetCachedClient(Client => new VirtualMachineRunCommandCollection(Client, Id)); + return GetCachedClient(client => new VirtualMachineRunCommandCollection(client, Id)); } /// @@ -168,8 +171,8 @@ public virtual VirtualMachineRunCommandCollection GetVirtualMachineRunCommands() /// The name of the virtual machine run command. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualMachineRunCommandAsync(string runCommandName, string expand = null, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> GetVirtual /// The name of the virtual machine run command. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualMachineRunCommand(string runCommandName, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandResource.cs index 78852e152958f..7bdaf625c7f8c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineRunCommandResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineRunCommandResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmName. + /// The runCommandName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmName, string runCommandName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionResource.cs index 99f825f38a03a..f2c8aedfc3d3b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineScaleSetExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineScaleSetName. + /// The vmssExtensionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineScaleSetName, string vmssExtensionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/extensions/{vmssExtensionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetResource.cs index eb9c1861fb8e9..302301b6584ff 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineScaleSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineScaleSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineScaleSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"; @@ -99,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VirtualMachineScaleSetExtensionResources and their operations over a VirtualMachineScaleSetExtensionResource. public virtual VirtualMachineScaleSetExtensionCollection GetVirtualMachineScaleSetExtensions() { - return GetCachedClient(Client => new VirtualMachineScaleSetExtensionCollection(Client, Id)); + return GetCachedClient(client => new VirtualMachineScaleSetExtensionCollection(client, Id)); } /// @@ -118,8 +121,8 @@ public virtual VirtualMachineScaleSetExtensionCollection GetVirtualMachineScaleS /// The name of the VM scale set extension. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualMachineScaleSetExtensionAsync(string vmssExtensionName, string expand = null, CancellationToken cancellationToken = default) { @@ -142,8 +145,8 @@ public virtual async Task> Get /// The name of the VM scale set extension. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualMachineScaleSetExtension(string vmssExtensionName, string expand = null, CancellationToken cancellationToken = default) { @@ -161,7 +164,7 @@ public virtual VirtualMachineScaleSetRollingUpgradeResource GetVirtualMachineSca /// An object representing collection of VirtualMachineScaleSetVmResources and their operations over a VirtualMachineScaleSetVmResource. public virtual VirtualMachineScaleSetVmCollection GetVirtualMachineScaleSetVms() { - return GetCachedClient(Client => new VirtualMachineScaleSetVmCollection(Client, Id)); + return GetCachedClient(client => new VirtualMachineScaleSetVmCollection(client, Id)); } /// @@ -180,8 +183,8 @@ public virtual VirtualMachineScaleSetVmCollection GetVirtualMachineScaleSetVms() /// The instance ID of the virtual machine. /// The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualMachineScaleSetVmAsync(string instanceId, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { @@ -204,8 +207,8 @@ public virtual async Task> GetVirtual /// The instance ID of the virtual machine. /// The expand expression to apply on the operation. 'InstanceView' will retrieve the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualMachineScaleSetVm(string instanceId, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradeResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradeResource.cs index 988af161d5d0e..cf7645945a15e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradeResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetRollingUpgradeResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineScaleSetRollingUpgradeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineScaleSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineScaleSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/rollingUpgrades/latest"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionResource.cs index 0d15515449ad8..f7633cbd2f31e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmExtensionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineScaleSetVmExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineScaleSetName. + /// The instanceId. + /// The vmExtensionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineScaleSetName, string instanceId, string vmExtensionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmResource.cs index 58bdecf9c0547..2dce4625636f6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineScaleSetVmResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineScaleSetName. + /// The instanceId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineScaleSetName, string instanceId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{instanceId}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VirtualMachineScaleSetVmExtensionResources and their operations over a VirtualMachineScaleSetVmExtensionResource. public virtual VirtualMachineScaleSetVmExtensionCollection GetVirtualMachineScaleSetVmExtensions() { - return GetCachedClient(Client => new VirtualMachineScaleSetVmExtensionCollection(Client, Id)); + return GetCachedClient(client => new VirtualMachineScaleSetVmExtensionCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual VirtualMachineScaleSetVmExtensionCollection GetVirtualMachineScal /// The name of the virtual machine extension. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualMachineScaleSetVmExtensionAsync(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +139,8 @@ public virtual async Task> G /// The name of the virtual machine extension. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualMachineScaleSetVmExtension(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) { @@ -147,7 +151,7 @@ public virtual Response GetVirtualMac /// An object representing collection of VirtualMachineScaleSetVmRunCommandResources and their operations over a VirtualMachineScaleSetVmRunCommandResource. public virtual VirtualMachineScaleSetVmRunCommandCollection GetVirtualMachineScaleSetVmRunCommands() { - return GetCachedClient(Client => new VirtualMachineScaleSetVmRunCommandCollection(Client, Id)); + return GetCachedClient(client => new VirtualMachineScaleSetVmRunCommandCollection(client, Id)); } /// @@ -166,8 +170,8 @@ public virtual VirtualMachineScaleSetVmRunCommandCollection GetVirtualMachineSca /// The name of the virtual machine run command. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualMachineScaleSetVmRunCommandAsync(string runCommandName, string expand = null, CancellationToken cancellationToken = default) { @@ -190,8 +194,8 @@ public virtual async Task> /// The name of the virtual machine run command. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualMachineScaleSetVmRunCommand(string runCommandName, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandResource.cs index 25b3257e2c0e0..dd1ce1dc8ec72 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmRunCommandResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.Compute public partial class VirtualMachineScaleSetVmRunCommandResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineScaleSetName. + /// The instanceId. + /// The runCommandName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineScaleSetName, string instanceId, string runCommandName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"; diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/Mock/MockingTests.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/Mock/MockingTests.cs new file mode 100644 index 0000000000000..89b99ff66b7f0 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/tests/Mock/MockingTests.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.ResourceManager.Compute.Mocking; +using Azure.ResourceManager.Compute.Models; +using Azure.ResourceManager.Resources; +using Moq; +using NUnit.Framework; + +namespace Azure.ResourceManager.Compute.Tests.Mock +{ + public class MockingTests + { + [Test] + public void Mocking_GetResourcesById() + { + #region mocking data + var subscriptionId = Guid.NewGuid().ToString(); + var resourceGroupName = "myRg"; + var vmId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, "myVm"); + var availablitySetId = AvailabilitySetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, "mySet"); + #endregion + + #region mocking setup + var clientMock = new Mock(); + var clientExtensionMock = new Mock(); + var vmMock = new Mock(); + var setMock = new Mock(); + // setup some data in the result + vmMock.Setup(vm => vm.Id).Returns(vmId); + setMock.Setup(set => set.Id).Returns(availablitySetId); + // first mock: mock the same method in mocking extension class + clientExtensionMock.Setup(e => e.GetVirtualMachineResource(vmId)).Returns(vmMock.Object); + clientExtensionMock.Setup(e => e.GetAvailabilitySetResource(availablitySetId)).Returns(setMock.Object); + // second mock: mock the GetCachedClient method on the "extendee" + clientMock.Setup(c => c.GetCachedClient(It.IsAny>())).Returns(clientExtensionMock.Object); + #endregion + + // the mocking test + var client = clientMock.Object; + var vm = client.GetVirtualMachineResource(vmId); + var set = client.GetAvailabilitySetResource(availablitySetId); + + Assert.AreEqual(vmId, vm.Id); + Assert.AreEqual(availablitySetId, set.Id); + } + + [Test] + public async Task Mocking_GetCollectionAndCreate() + { + #region mocking data + var subscriptionId = Guid.NewGuid().ToString(); + var resourceGroupName = "myRg"; + var setName = "mySet"; + var vmName = "myVm"; + var setId = AvailabilitySetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, setName); + var setData = ArmComputeModelFactory.AvailabilitySetData(setId, setName, platformFaultDomainCount: 10); + var vmId = VirtualMachineResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName); + var vmData = ArmComputeModelFactory.VirtualMachineData(vmId, vmName, availabilitySetId: setId); + #endregion + + #region mocking setup + var rgMock = new Mock(); + var rgExtensionMock = new Mock(); + // for availability set + var setCollectionMock = new Mock(); + var setMock = new Mock(); + var setLroMock = new Mock>(); + // for virtual machine + var vmCollectionMock = new Mock(); + var vmMock = new Mock(); + var vmLroMock = new Mock>(); + // setup some data in the result + setMock.Setup(set => set.Id).Returns(setId); + setMock.Setup(set => set.Data).Returns(setData); + vmMock.Setup(vm => vm.Id).Returns(vmId); + vmMock.Setup(vm => vm.Data).Returns(vmData); + // first mock: mock the same method in mocking extension class + rgExtensionMock.Setup(e => e.GetAvailabilitySets()).Returns(setCollectionMock.Object); + rgExtensionMock.Setup(e => e.GetVirtualMachines()).Returns(vmCollectionMock.Object); + // second mock: mock the GetCachedClient method on the "extendee" + rgMock.Setup(rg => rg.GetCachedClient(It.IsAny>())).Returns(rgExtensionMock.Object); + // setup the mock on the collection for CreateOrUpdate method + setCollectionMock.Setup(c => c.CreateOrUpdateAsync(WaitUntil.Completed, setName, setData, default)).ReturnsAsync(setLroMock.Object); + setLroMock.Setup(lro => lro.Value).Returns(setMock.Object); + vmCollectionMock.Setup(c => c.CreateOrUpdateAsync(WaitUntil.Completed, vmName, vmData, default)).ReturnsAsync(vmLroMock.Object); + vmLroMock.Setup(lro => lro.Value).Returns(vmMock.Object); + #endregion + + // the mocking test + var rg = rgMock.Object; + var setCollection = rg.GetAvailabilitySets(); + var setLro = await setCollection.CreateOrUpdateAsync(WaitUntil.Completed, setName, setData); + var setResource = setLro.Value; + var vmCollection = rg.GetVirtualMachines(); + var vmLro = await vmCollection.CreateOrUpdateAsync(WaitUntil.Completed, vmName, vmData); + var vmResource = vmLro.Value; + + Assert.AreEqual(setId, setResource.Id); + Assert.AreEqual(setData, setResource.Data); + Assert.AreEqual(vmId, vmResource.Id); + Assert.AreEqual(vmData, vmResource.Data); + } + + [Test] + public async Task Mocking_GetResourceByName() + { + #region mocking data + var subscriptionId = Guid.NewGuid().ToString(); + var resourceGroupName = "myRg"; + var setName = "mySet"; + var setId = AvailabilitySetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, setName); + var setData = ArmComputeModelFactory.AvailabilitySetData(setId, setName, platformFaultDomainCount: 10); + #endregion + + #region mocking setup + var rgMock = new Mock(); + var rgExtensionMock = new Mock(); + var setMock = new Mock(); + // setup some data in the result + setMock.Setup(set => set.Id).Returns(setId); + setMock.Setup(set => set.Data).Returns(setData); + // first mock: mock the same method in mocking extension class + rgExtensionMock.Setup(e => e.GetAvailabilitySetAsync(setName, default)).ReturnsAsync(Response.FromValue(setMock.Object, null)); + // second mock: mock the GetCachedClient method on the "extendee" + rgMock.Setup(rg => rg.GetCachedClient(It.IsAny>())).Returns(rgExtensionMock.Object); + #endregion + + var rg = rgMock.Object; + AvailabilitySetResource setResource = await rg.GetAvailabilitySetAsync(setName); + + Assert.AreEqual(setId, setResource.Id); + Assert.AreEqual(setData, setResource.Data); + } + + [Test] + public async Task Mocking_PageableResultOnCollection() + { + #region mocking data + var subscriptionId = Guid.NewGuid().ToString(); + var resourceGroupName = "myRg"; + var setName1 = "mySet1"; + var setName2 = "mySet2"; + var setId1 = AvailabilitySetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, setName1); + var setId2 = AvailabilitySetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, setName2); + var setData1 = ArmComputeModelFactory.AvailabilitySetData(setId1, setName1, platformFaultDomainCount: 10); + var setData2 = ArmComputeModelFactory.AvailabilitySetData(setId2, setName2, platformUpdateDomainCount: 20); + #endregion + + #region mocking setup + var rgMock = new Mock(); + var rgExtensionMock = new Mock(); + var setMock1 = new Mock(); + var setMock2 = new Mock(); + var setCollectionMock = new Mock(); + // setup some data in the result + setMock1.Setup(set => set.Id).Returns(setId1); + setMock1.Setup(set => set.Data).Returns(setData1); + setMock2.Setup(set => set.Id).Returns(setId2); + setMock2.Setup(set => set.Data).Returns(setData2); + // first mock: mock the same method in mocking extension class + rgExtensionMock.Setup(e => e.GetAvailabilitySets()).Returns(setCollectionMock.Object); + // second mock: mock the GetCachedClient method on the "extendee" + rgMock.Setup(rg => rg.GetCachedClient(It.IsAny>())).Returns(rgExtensionMock.Object); + // setup the collection + var setPageableResult = AsyncPageable.FromPages(new[] { Page.FromValues(new[] { setMock1.Object, setMock2.Object }, null, null) }); + setCollectionMock.Setup(c => c.GetAllAsync(default)).Returns(setPageableResult); + #endregion + + var rg = rgMock.Object; + var setCollection = rg.GetAvailabilitySets(); + var count = 0; + await foreach (var set in setCollection.GetAllAsync()) + { + switch (count) + { + case 0: + Assert.AreEqual(setId1, set.Id); + Assert.AreEqual(setData1, set.Data); + break; + case 1: + Assert.AreEqual(setId2, set.Id); + Assert.AreEqual(setData2, set.Data); + break; + default: + Assert.Fail("We should only contain 2 items in the result"); + break; + } + count++; + } + } + + [Test] + public async Task Mocking_PageableResultOnExtension() + { + #region mocking data + var subscriptionId = Guid.NewGuid().ToString(); + var setName1 = "mySet1"; + var setName2 = "mySet2"; + var setId1 = AvailabilitySetResource.CreateResourceIdentifier(subscriptionId, "myRg1", setName1); + var setId2 = AvailabilitySetResource.CreateResourceIdentifier(subscriptionId, "myRg2", setName2); + var setData1 = ArmComputeModelFactory.AvailabilitySetData(setId1, setName1, platformFaultDomainCount: 10); + var setData2 = ArmComputeModelFactory.AvailabilitySetData(setId2, setName2, platformUpdateDomainCount: 20); + #endregion + + #region mocking setup + var subsMock = new Mock(); + var subsExtensionMock = new Mock(); + var setMock1 = new Mock(); + var setMock2 = new Mock(); + // setup some data in the result + setMock1.Setup(set => set.Id).Returns(setId1); + setMock1.Setup(set => set.Data).Returns(setData1); + setMock2.Setup(set => set.Id).Returns(setId2); + setMock2.Setup(set => set.Data).Returns(setData2); + // first mock: mock the same method in mocking extension class + var setPageableResult = AsyncPageable.FromPages(new[] { Page.FromValues(new[] { setMock1.Object, setMock2.Object }, null, null) }); + subsExtensionMock.Setup(e => e.GetAvailabilitySetsAsync(null, default)).Returns(setPageableResult); + // second mock: mock the GetCachedClient method on the "extendee" + subsMock.Setup(rg => rg.GetCachedClient(It.IsAny>())).Returns(subsExtensionMock.Object); + #endregion + + var subscription = subsMock.Object; + var count = 0; + await foreach (var set in subscription.GetAvailabilitySetsAsync()) + { + switch (count) + { + case 0: + Assert.AreEqual(setId1, set.Id); + Assert.AreEqual(setData1, set.Data); + break; + case 1: + Assert.AreEqual(setId2, set.Id); + Assert.AreEqual(setData2, set.Data); + break; + default: + Assert.Fail("We should only contain 2 items in the result"); + break; + } + count++; + } + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/api/Azure.ResourceManager.ConfidentialLedger.netstandard2.0.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/api/Azure.ResourceManager.ConfidentialLedger.netstandard2.0.cs index a55f43ae4b841..5a05e6a1e9e0e 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/api/Azure.ResourceManager.ConfidentialLedger.netstandard2.0.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/api/Azure.ResourceManager.ConfidentialLedger.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ConfidentialLedgerCollection() { } } public partial class ConfidentialLedgerData : Azure.ResourceManager.Models.TrackedResourceData { - public ConfidentialLedgerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ConfidentialLedgerData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ConfidentialLedger.Models.ConfidentialLedgerProperties Properties { get { throw null; } set { } } } public static partial class ConfidentialLedgerExtensions @@ -78,7 +78,7 @@ protected ManagedCcfCollection() { } } public partial class ManagedCcfData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedCcfData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedCcfData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ConfidentialLedger.Models.ManagedCcfProperties Properties { get { throw null; } set { } } } public partial class ManagedCcfResource : Azure.ResourceManager.ArmResource @@ -102,6 +102,35 @@ protected ManagedCcfResource() { } public virtual System.Threading.Tasks.Task UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ConfidentialLedger.ManagedCcfData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ConfidentialLedger.Mocking +{ + public partial class MockableConfidentialLedgerArmClient : Azure.ResourceManager.ArmResource + { + protected MockableConfidentialLedgerArmClient() { } + public virtual Azure.ResourceManager.ConfidentialLedger.ConfidentialLedgerResource GetConfidentialLedgerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConfidentialLedger.ManagedCcfResource GetManagedCcfResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableConfidentialLedgerResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableConfidentialLedgerResourceGroupResource() { } + public virtual Azure.Response GetConfidentialLedger(string ledgerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfidentialLedgerAsync(string ledgerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConfidentialLedger.ConfidentialLedgerCollection GetConfidentialLedgers() { throw null; } + public virtual Azure.Response GetManagedCcf(string appName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedCcfAsync(string appName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConfidentialLedger.ManagedCcfCollection GetManagedCcfs() { throw null; } + } + public partial class MockableConfidentialLedgerSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableConfidentialLedgerSubscriptionResource() { } + public virtual Azure.Response CheckConfidentialLedgerNameAvailability(Azure.ResourceManager.ConfidentialLedger.Models.ConfidentialLedgerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckConfidentialLedgerNameAvailabilityAsync(Azure.ResourceManager.ConfidentialLedger.Models.ConfidentialLedgerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConfidentialLedgers(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfidentialLedgersAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedCcfs(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedCcfsAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ConfidentialLedger.Models { public partial class AadBasedSecurityPrincipal diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerResource.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerResource.cs index 8130bc4444276..0a16de4f0449e 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerResource.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.ConfidentialLedger public partial class ConfidentialLedgerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ledgerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ledgerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}"; diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs index acff73bfcdcd7..f2a07bcbc5a44 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ConfidentialLedger.Mocking; using Azure.ResourceManager.ConfidentialLedger.Models; using Azure.ResourceManager.Resources; @@ -19,81 +20,65 @@ namespace Azure.ResourceManager.ConfidentialLedger /// A class to add extension methods to Azure.ResourceManager.ConfidentialLedger. public static partial class ConfidentialLedgerExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableConfidentialLedgerArmClient GetMockableConfidentialLedgerArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableConfidentialLedgerArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableConfidentialLedgerResourceGroupResource GetMockableConfidentialLedgerResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableConfidentialLedgerResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableConfidentialLedgerSubscriptionResource GetMockableConfidentialLedgerSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableConfidentialLedgerSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ConfidentialLedgerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ConfidentialLedgerResource GetConfidentialLedgerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ConfidentialLedgerResource.ValidateResourceId(id); - return new ConfidentialLedgerResource(client, id); - } - ); + return GetMockableConfidentialLedgerArmClient(client).GetConfidentialLedgerResource(id); } - #endregion - #region ManagedCcfResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedCcfResource GetManagedCcfResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedCcfResource.ValidateResourceId(id); - return new ManagedCcfResource(client, id); - } - ); + return GetMockableConfidentialLedgerArmClient(client).GetManagedCcfResource(id); } - #endregion - /// Gets a collection of ConfidentialLedgerResources in the ResourceGroupResource. + /// + /// Gets a collection of ConfidentialLedgerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ConfidentialLedgerResources and their operations over a ConfidentialLedgerResource. public static ConfidentialLedgerCollection GetConfidentialLedgers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfidentialLedgers(); + return GetMockableConfidentialLedgerResourceGroupResource(resourceGroupResource).GetConfidentialLedgers(); } /// @@ -108,16 +93,20 @@ public static ConfidentialLedgerCollection GetConfidentialLedgers(this ResourceG /// Ledger_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Confidential Ledger. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetConfidentialLedgerAsync(this ResourceGroupResource resourceGroupResource, string ledgerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetConfidentialLedgers().GetAsync(ledgerName, cancellationToken).ConfigureAwait(false); + return await GetMockableConfidentialLedgerResourceGroupResource(resourceGroupResource).GetConfidentialLedgerAsync(ledgerName, cancellationToken).ConfigureAwait(false); } /// @@ -132,24 +121,34 @@ public static async Task> GetConfidentialLe /// Ledger_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Confidential Ledger. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetConfidentialLedger(this ResourceGroupResource resourceGroupResource, string ledgerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetConfidentialLedgers().Get(ledgerName, cancellationToken); + return GetMockableConfidentialLedgerResourceGroupResource(resourceGroupResource).GetConfidentialLedger(ledgerName, cancellationToken); } - /// Gets a collection of ManagedCcfResources in the ResourceGroupResource. + /// + /// Gets a collection of ManagedCcfResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ManagedCcfResources and their operations over a ManagedCcfResource. public static ManagedCcfCollection GetManagedCcfs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetManagedCcfs(); + return GetMockableConfidentialLedgerResourceGroupResource(resourceGroupResource).GetManagedCcfs(); } /// @@ -164,16 +163,20 @@ public static ManagedCcfCollection GetManagedCcfs(this ResourceGroupResource res /// ManagedCCF_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Managed CCF. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedCcfAsync(this ResourceGroupResource resourceGroupResource, string appName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetManagedCcfs().GetAsync(appName, cancellationToken).ConfigureAwait(false); + return await GetMockableConfidentialLedgerResourceGroupResource(resourceGroupResource).GetManagedCcfAsync(appName, cancellationToken).ConfigureAwait(false); } /// @@ -188,16 +191,20 @@ public static async Task> GetManagedCcfAsync(this R /// ManagedCCF_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Managed CCF. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedCcf(this ResourceGroupResource resourceGroupResource, string appName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetManagedCcfs().Get(appName, cancellationToken); + return GetMockableConfidentialLedgerResourceGroupResource(resourceGroupResource).GetManagedCcf(appName, cancellationToken); } /// @@ -212,6 +219,10 @@ public static Response GetManagedCcf(this ResourceGroupResou /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name availability request payload. @@ -219,9 +230,7 @@ public static Response GetManagedCcf(this ResourceGroupResou /// is null. public static async Task> CheckConfidentialLedgerNameAvailabilityAsync(this SubscriptionResource subscriptionResource, ConfidentialLedgerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckConfidentialLedgerNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableConfidentialLedgerSubscriptionResource(subscriptionResource).CheckConfidentialLedgerNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -236,6 +245,10 @@ public static async Task> Che /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name availability request payload. @@ -243,9 +256,7 @@ public static async Task> Che /// is null. public static Response CheckConfidentialLedgerNameAvailability(this SubscriptionResource subscriptionResource, ConfidentialLedgerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckConfidentialLedgerNameAvailability(content, cancellationToken); + return GetMockableConfidentialLedgerSubscriptionResource(subscriptionResource).CheckConfidentialLedgerNameAvailability(content, cancellationToken); } /// @@ -260,6 +271,10 @@ public static Response CheckConfidenti /// Ledger_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. @@ -267,7 +282,7 @@ public static Response CheckConfidenti /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetConfidentialLedgersAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfidentialLedgersAsync(filter, cancellationToken); + return GetMockableConfidentialLedgerSubscriptionResource(subscriptionResource).GetConfidentialLedgersAsync(filter, cancellationToken); } /// @@ -282,6 +297,10 @@ public static AsyncPageable GetConfidentialLedgersAs /// Ledger_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. @@ -289,7 +308,7 @@ public static AsyncPageable GetConfidentialLedgersAs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetConfidentialLedgers(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfidentialLedgers(filter, cancellationToken); + return GetMockableConfidentialLedgerSubscriptionResource(subscriptionResource).GetConfidentialLedgers(filter, cancellationToken); } /// @@ -304,6 +323,10 @@ public static Pageable GetConfidentialLedgers(this S /// ManagedCCF_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. @@ -311,7 +334,7 @@ public static Pageable GetConfidentialLedgers(this S /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetManagedCcfsAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedCcfsAsync(filter, cancellationToken); + return GetMockableConfidentialLedgerSubscriptionResource(subscriptionResource).GetManagedCcfsAsync(filter, cancellationToken); } /// @@ -326,6 +349,10 @@ public static AsyncPageable GetManagedCcfsAsync(this Subscri /// ManagedCCF_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. @@ -333,7 +360,7 @@ public static AsyncPageable GetManagedCcfsAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetManagedCcfs(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedCcfs(filter, cancellationToken); + return GetMockableConfidentialLedgerSubscriptionResource(subscriptionResource).GetManagedCcfs(filter, cancellationToken); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerArmClient.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerArmClient.cs new file mode 100644 index 0000000000000..ce85364c15ed0 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ConfidentialLedger; + +namespace Azure.ResourceManager.ConfidentialLedger.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableConfidentialLedgerArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableConfidentialLedgerArmClient() + { + } + + /// 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 MockableConfidentialLedgerArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableConfidentialLedgerArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConfidentialLedgerResource GetConfidentialLedgerResource(ResourceIdentifier id) + { + ConfidentialLedgerResource.ValidateResourceId(id); + return new ConfidentialLedgerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedCcfResource GetManagedCcfResource(ResourceIdentifier id) + { + ManagedCcfResource.ValidateResourceId(id); + return new ManagedCcfResource(Client, id); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerResourceGroupResource.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerResourceGroupResource.cs new file mode 100644 index 0000000000000..e383685fca48b --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.ConfidentialLedger; + +namespace Azure.ResourceManager.ConfidentialLedger.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableConfidentialLedgerResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableConfidentialLedgerResourceGroupResource() + { + } + + /// 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 MockableConfidentialLedgerResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ConfidentialLedgerResources in the ResourceGroupResource. + /// An object representing collection of ConfidentialLedgerResources and their operations over a ConfidentialLedgerResource. + public virtual ConfidentialLedgerCollection GetConfidentialLedgers() + { + return GetCachedClient(client => new ConfidentialLedgerCollection(client, Id)); + } + + /// + /// Retrieves the properties of a Confidential Ledger. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName} + /// + /// + /// Operation Id + /// Ledger_Get + /// + /// + /// + /// Name of the Confidential Ledger. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetConfidentialLedgerAsync(string ledgerName, CancellationToken cancellationToken = default) + { + return await GetConfidentialLedgers().GetAsync(ledgerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the properties of a Confidential Ledger. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName} + /// + /// + /// Operation Id + /// Ledger_Get + /// + /// + /// + /// Name of the Confidential Ledger. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetConfidentialLedger(string ledgerName, CancellationToken cancellationToken = default) + { + return GetConfidentialLedgers().Get(ledgerName, cancellationToken); + } + + /// Gets a collection of ManagedCcfResources in the ResourceGroupResource. + /// An object representing collection of ManagedCcfResources and their operations over a ManagedCcfResource. + public virtual ManagedCcfCollection GetManagedCcfs() + { + return GetCachedClient(client => new ManagedCcfCollection(client, Id)); + } + + /// + /// Retrieves the properties of a Managed CCF app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedCcfAsync(string appName, CancellationToken cancellationToken = default) + { + return await GetManagedCcfs().GetAsync(appName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the properties of a Managed CCF app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedCcf(string appName, CancellationToken cancellationToken = default) + { + return GetManagedCcfs().Get(appName, cancellationToken); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerSubscriptionResource.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerSubscriptionResource.cs new file mode 100644 index 0000000000000..d8625191863de --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/MockableConfidentialLedgerSubscriptionResource.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ConfidentialLedger; +using Azure.ResourceManager.ConfidentialLedger.Models; + +namespace Azure.ResourceManager.ConfidentialLedger.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableConfidentialLedgerSubscriptionResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private ConfidentialLedgerRestOperations _defaultRestClient; + private ClientDiagnostics _confidentialLedgerLedgerClientDiagnostics; + private LedgerRestOperations _confidentialLedgerLedgerRestClient; + private ClientDiagnostics _managedCcfManagedCcfClientDiagnostics; + private ManagedCCFRestOperations _managedCcfManagedCcfRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableConfidentialLedgerSubscriptionResource() + { + } + + /// 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 MockableConfidentialLedgerSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfidentialLedgerRestOperations DefaultRestClient => _defaultRestClient ??= new ConfidentialLedgerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ConfidentialLedgerLedgerClientDiagnostics => _confidentialLedgerLedgerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ConfidentialLedgerResource.ResourceType.Namespace, Diagnostics); + private LedgerRestOperations ConfidentialLedgerLedgerRestClient => _confidentialLedgerLedgerRestClient ??= new LedgerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConfidentialLedgerResource.ResourceType)); + private ClientDiagnostics ManagedCcfManagedCCFClientDiagnostics => _managedCcfManagedCcfClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ManagedCcfResource.ResourceType.Namespace, Diagnostics); + private ManagedCCFRestOperations ManagedCcfManagedCCFRestClient => _managedCcfManagedCcfRestClient ??= new ManagedCCFRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedCcfResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// To check whether a resource name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// Name availability request payload. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckConfidentialLedgerNameAvailabilityAsync(ConfidentialLedgerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableConfidentialLedgerSubscriptionResource.CheckConfidentialLedgerNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// To check whether a resource name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// Name availability request payload. + /// The cancellation token to use. + /// is null. + public virtual Response CheckConfidentialLedgerNameAvailability(ConfidentialLedgerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableConfidentialLedgerSubscriptionResource.CheckConfidentialLedgerNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieves the properties of all Confidential Ledgers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/ledgers + /// + /// + /// Operation Id + /// Ledger_ListBySubscription + /// + /// + /// + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfidentialLedgersAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "MockableConfidentialLedgerSubscriptionResource.GetConfidentialLedgers", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves the properties of all Confidential Ledgers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/ledgers + /// + /// + /// Operation Id + /// Ledger_ListBySubscription + /// + /// + /// + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfidentialLedgers(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "MockableConfidentialLedgerSubscriptionResource.GetConfidentialLedgers", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves the properties of all Managed CCF. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/managedCCFs + /// + /// + /// Operation Id + /// ManagedCCF_ListBySubscription + /// + /// + /// + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedCcfsAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), ManagedCcfManagedCCFClientDiagnostics, Pipeline, "MockableConfidentialLedgerSubscriptionResource.GetManagedCcfs", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves the properties of all Managed CCF. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/managedCCFs + /// + /// + /// Operation Id + /// ManagedCCF_ListBySubscription + /// + /// + /// + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedCcfs(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), ManagedCcfManagedCCFClientDiagnostics, Pipeline, "MockableConfidentialLedgerSubscriptionResource.GetManagedCcfs", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 09ae729cb59b9..0000000000000 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ConfidentialLedger -{ - /// 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 ConfidentialLedgerResources in the ResourceGroupResource. - /// An object representing collection of ConfidentialLedgerResources and their operations over a ConfidentialLedgerResource. - public virtual ConfidentialLedgerCollection GetConfidentialLedgers() - { - return GetCachedClient(Client => new ConfidentialLedgerCollection(Client, Id)); - } - - /// Gets a collection of ManagedCcfResources in the ResourceGroupResource. - /// An object representing collection of ManagedCcfResources and their operations over a ManagedCcfResource. - public virtual ManagedCcfCollection GetManagedCcfs() - { - return GetCachedClient(Client => new ManagedCcfCollection(Client, Id)); - } - } -} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d0c451dbd52c8..0000000000000 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ConfidentialLedger.Models; - -namespace Azure.ResourceManager.ConfidentialLedger -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private ConfidentialLedgerRestOperations _defaultRestClient; - private ClientDiagnostics _confidentialLedgerLedgerClientDiagnostics; - private LedgerRestOperations _confidentialLedgerLedgerRestClient; - private ClientDiagnostics _managedCcfManagedCcfClientDiagnostics; - private ManagedCCFRestOperations _managedCcfManagedCcfRestClient; - - /// 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 DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ConfidentialLedgerRestOperations DefaultRestClient => _defaultRestClient ??= new ConfidentialLedgerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ConfidentialLedgerLedgerClientDiagnostics => _confidentialLedgerLedgerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ConfidentialLedgerResource.ResourceType.Namespace, Diagnostics); - private LedgerRestOperations ConfidentialLedgerLedgerRestClient => _confidentialLedgerLedgerRestClient ??= new LedgerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConfidentialLedgerResource.ResourceType)); - private ClientDiagnostics ManagedCcfManagedCCFClientDiagnostics => _managedCcfManagedCcfClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ManagedCcfResource.ResourceType.Namespace, Diagnostics); - private ManagedCCFRestOperations ManagedCcfManagedCCFRestClient => _managedCcfManagedCcfRestClient ??= new ManagedCCFRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedCcfResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// To check whether a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// Name availability request payload. - /// The cancellation token to use. - public virtual async Task> CheckConfidentialLedgerNameAvailabilityAsync(ConfidentialLedgerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckConfidentialLedgerNameAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// To check whether a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// Name availability request payload. - /// The cancellation token to use. - public virtual Response CheckConfidentialLedgerNameAvailability(ConfidentialLedgerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckConfidentialLedgerNameAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Retrieves the properties of all Confidential Ledgers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/ledgers - /// - /// - /// Operation Id - /// Ledger_ListBySubscription - /// - /// - /// - /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfidentialLedgersAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfidentialLedgers", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieves the properties of all Confidential Ledgers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/ledgers - /// - /// - /// Operation Id - /// Ledger_ListBySubscription - /// - /// - /// - /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfidentialLedgers(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfidentialLedgers", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieves the properties of all Managed CCF. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/managedCCFs - /// - /// - /// Operation Id - /// ManagedCCF_ListBySubscription - /// - /// - /// - /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedCcfsAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), ManagedCcfManagedCCFClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedCcfs", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieves the properties of all Managed CCF. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/managedCCFs - /// - /// - /// Operation Id - /// ManagedCCF_ListBySubscription - /// - /// - /// - /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedCcfs(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedCcfManagedCCFRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedCcfResource(Client, ManagedCcfData.DeserializeManagedCcfData(e)), ManagedCcfManagedCCFClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedCcfs", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfResource.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfResource.cs index 6aeedf1bb4bee..ac5f2f966c473 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfResource.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCcfResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.ConfidentialLedger public partial class ManagedCcfResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The appName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string appName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName}"; diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/Azure.ResourceManager.Confluent.sln b/sdk/confluent/Azure.ResourceManager.Confluent/Azure.ResourceManager.Confluent.sln index db6212db41c9c..1fd0bb466dccf 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/Azure.ResourceManager.Confluent.sln +++ b/sdk/confluent/Azure.ResourceManager.Confluent/Azure.ResourceManager.Confluent.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F6672391-5856-4802-8735-03F714F354B6}") = "Azure.ResourceManager.Confluent", "src\Azure.ResourceManager.Confluent.csproj", "{4ED4B575-8567-4965-B9A4-BCA5D04F1A6D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Confluent", "src\Azure.ResourceManager.Confluent.csproj", "{4ED4B575-8567-4965-B9A4-BCA5D04F1A6D}" EndProject -Project("{F6672391-5856-4802-8735-03F714F354B6}") = "Azure.ResourceManager.Confluent.Tests", "tests\Azure.ResourceManager.Confluent.Tests.csproj", "{8835039D-1A98-4F8E-82E8-2E84B60140BE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Confluent.Tests", "tests\Azure.ResourceManager.Confluent.Tests.csproj", "{8835039D-1A98-4F8E-82E8-2E84B60140BE}" EndProject -Project("{F6672391-5856-4802-8735-03F714F354B6}") = "Azure.ResourceManager.Confluent.Samples", "samples\Azure.ResourceManager.Confluent.Samples.csproj", "{13544639-8C92-441F-9C13-10807F59F409}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Confluent.Samples", "samples\Azure.ResourceManager.Confluent.Samples.csproj", "{13544639-8C92-441F-9C13-10807F59F409}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {03BACE7F-D570-485D-9819-08F83DF91B49} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {8835039D-1A98-4F8E-82E8-2E84B60140BE}.Release|x64.Build.0 = Release|Any CPU {8835039D-1A98-4F8E-82E8-2E84B60140BE}.Release|x86.ActiveCfg = Release|Any CPU {8835039D-1A98-4F8E-82E8-2E84B60140BE}.Release|x86.Build.0 = Release|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Debug|x64.ActiveCfg = Debug|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Debug|x64.Build.0 = Debug|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Debug|x86.ActiveCfg = Debug|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Debug|x86.Build.0 = Debug|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Release|Any CPU.ActiveCfg = Release|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Release|Any CPU.Build.0 = Release|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Release|x64.ActiveCfg = Release|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Release|x64.Build.0 = Release|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Release|x86.ActiveCfg = Release|Any CPU + {13544639-8C92-441F-9C13-10807F59F409}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {03BACE7F-D570-485D-9819-08F83DF91B49} EndGlobalSection EndGlobal diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/api/Azure.ResourceManager.Confluent.netstandard2.0.cs b/sdk/confluent/Azure.ResourceManager.Confluent/api/Azure.ResourceManager.Confluent.netstandard2.0.cs index 81f3c80ed1e34..f45fb06cb5675 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/api/Azure.ResourceManager.Confluent.netstandard2.0.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/api/Azure.ResourceManager.Confluent.netstandard2.0.cs @@ -34,7 +34,7 @@ protected ConfluentOrganizationCollection() { } } public partial class ConfluentOrganizationData : Azure.ResourceManager.Models.TrackedResourceData { - public ConfluentOrganizationData(Azure.Core.AzureLocation location, Azure.ResourceManager.Confluent.Models.ConfluentOfferDetail offerDetail, Azure.ResourceManager.Confluent.Models.ConfluentUserDetail userDetail) : base (default(Azure.Core.AzureLocation)) { } + public ConfluentOrganizationData(Azure.Core.AzureLocation location, Azure.ResourceManager.Confluent.Models.ConfluentOfferDetail offerDetail, Azure.ResourceManager.Confluent.Models.ConfluentUserDetail userDetail) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.Confluent.Models.ConfluentOfferDetail OfferDetail { get { throw null; } set { } } public System.Guid? OrganizationId { get { throw null; } } @@ -63,6 +63,33 @@ protected ConfluentOrganizationResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Confluent.Models.ConfluentOrganizationPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Confluent.Mocking +{ + public partial class MockableConfluentArmClient : Azure.ResourceManager.ArmResource + { + protected MockableConfluentArmClient() { } + public virtual Azure.ResourceManager.Confluent.ConfluentOrganizationResource GetConfluentOrganizationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableConfluentResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableConfluentResourceGroupResource() { } + public virtual Azure.Response GetConfluentOrganization(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfluentOrganizationAsync(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Confluent.ConfluentOrganizationCollection GetConfluentOrganizations() { throw null; } + public virtual Azure.Response ValidateOrganization(string organizationName, Azure.ResourceManager.Confluent.ConfluentOrganizationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateOrganizationAsync(string organizationName, Azure.ResourceManager.Confluent.ConfluentOrganizationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableConfluentSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableConfluentSubscriptionResource() { } + public virtual Azure.Response CreateMarketplaceAgreement(Azure.ResourceManager.Confluent.Models.ConfluentAgreement body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateMarketplaceAgreementAsync(Azure.ResourceManager.Confluent.Models.ConfluentAgreement body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConfluentOrganizations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfluentOrganizationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMarketplaceAgreements(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMarketplaceAgreementsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Confluent.Models { public static partial class ArmConfluentModelFactory diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationResource.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationResource.cs index ae7cbb0df06b3..8b9d80271d6fc 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationResource.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/ConfluentOrganizationResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Confluent public partial class ConfluentOrganizationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The organizationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string organizationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}"; diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ConfluentExtensions.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ConfluentExtensions.cs index 4c9f0b3974b7b..66fd1713ed041 100644 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ConfluentExtensions.cs +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ConfluentExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Confluent.Mocking; using Azure.ResourceManager.Confluent.Models; using Azure.ResourceManager.Resources; @@ -19,62 +20,49 @@ namespace Azure.ResourceManager.Confluent /// A class to add extension methods to Azure.ResourceManager.Confluent. public static partial class ConfluentExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableConfluentArmClient GetMockableConfluentArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableConfluentArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableConfluentResourceGroupResource GetMockableConfluentResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableConfluentResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableConfluentSubscriptionResource GetMockableConfluentSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableConfluentSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ConfluentOrganizationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ConfluentOrganizationResource GetConfluentOrganizationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ConfluentOrganizationResource.ValidateResourceId(id); - return new ConfluentOrganizationResource(client, id); - } - ); + return GetMockableConfluentArmClient(client).GetConfluentOrganizationResource(id); } - #endregion - /// Gets a collection of ConfluentOrganizationResources in the ResourceGroupResource. + /// + /// Gets a collection of ConfluentOrganizationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ConfluentOrganizationResources and their operations over a ConfluentOrganizationResource. public static ConfluentOrganizationCollection GetConfluentOrganizations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfluentOrganizations(); + return GetMockableConfluentResourceGroupResource(resourceGroupResource).GetConfluentOrganizations(); } /// @@ -89,16 +77,20 @@ public static ConfluentOrganizationCollection GetConfluentOrganizations(this Res /// Organization_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Organization resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetConfluentOrganizationAsync(this ResourceGroupResource resourceGroupResource, string organizationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetConfluentOrganizations().GetAsync(organizationName, cancellationToken).ConfigureAwait(false); + return await GetMockableConfluentResourceGroupResource(resourceGroupResource).GetConfluentOrganizationAsync(organizationName, cancellationToken).ConfigureAwait(false); } /// @@ -113,16 +105,20 @@ public static async Task> GetConfluentOr /// Organization_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Organization resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetConfluentOrganization(this ResourceGroupResource resourceGroupResource, string organizationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetConfluentOrganizations().Get(organizationName, cancellationToken); + return GetMockableConfluentResourceGroupResource(resourceGroupResource).GetConfluentOrganization(organizationName, cancellationToken); } /// @@ -137,6 +133,10 @@ public static Response GetConfluentOrganization(t /// Validations_ValidateOrganization /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Organization resource name. @@ -146,10 +146,7 @@ public static Response GetConfluentOrganization(t /// or is null. public static async Task> ValidateOrganizationAsync(this ResourceGroupResource resourceGroupResource, string organizationName, ConfluentOrganizationData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - Argument.AssertNotNull(data, nameof(data)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).ValidateOrganizationAsync(organizationName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableConfluentResourceGroupResource(resourceGroupResource).ValidateOrganizationAsync(organizationName, data, cancellationToken).ConfigureAwait(false); } /// @@ -164,6 +161,10 @@ public static async Task> ValidateOrgani /// Validations_ValidateOrganization /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Organization resource name. @@ -173,10 +174,7 @@ public static async Task> ValidateOrgani /// or is null. public static Response ValidateOrganization(this ResourceGroupResource resourceGroupResource, string organizationName, ConfluentOrganizationData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - Argument.AssertNotNull(data, nameof(data)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).ValidateOrganization(organizationName, data, cancellationToken); + return GetMockableConfluentResourceGroupResource(resourceGroupResource).ValidateOrganization(organizationName, data, cancellationToken); } /// @@ -191,13 +189,17 @@ public static Response ValidateOrganization(this /// MarketplaceAgreements_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMarketplaceAgreementsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMarketplaceAgreementsAsync(cancellationToken); + return GetMockableConfluentSubscriptionResource(subscriptionResource).GetMarketplaceAgreementsAsync(cancellationToken); } /// @@ -212,13 +214,17 @@ public static AsyncPageable GetMarketplaceAgreementsAsync(th /// MarketplaceAgreements_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMarketplaceAgreements(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMarketplaceAgreements(cancellationToken); + return GetMockableConfluentSubscriptionResource(subscriptionResource).GetMarketplaceAgreements(cancellationToken); } /// @@ -233,13 +239,17 @@ public static Pageable GetMarketplaceAgreements(this Subscri /// MarketplaceAgreements_Create /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Confluent Marketplace Agreement resource. /// The cancellation token to use. public static async Task> CreateMarketplaceAgreementAsync(this SubscriptionResource subscriptionResource, ConfluentAgreement body = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CreateMarketplaceAgreementAsync(body, cancellationToken).ConfigureAwait(false); + return await GetMockableConfluentSubscriptionResource(subscriptionResource).CreateMarketplaceAgreementAsync(body, cancellationToken).ConfigureAwait(false); } /// @@ -254,13 +264,17 @@ public static async Task> CreateMarketplaceAgreemen /// MarketplaceAgreements_Create /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Confluent Marketplace Agreement resource. /// The cancellation token to use. public static Response CreateMarketplaceAgreement(this SubscriptionResource subscriptionResource, ConfluentAgreement body = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).CreateMarketplaceAgreement(body, cancellationToken); + return GetMockableConfluentSubscriptionResource(subscriptionResource).CreateMarketplaceAgreement(body, cancellationToken); } /// @@ -275,13 +289,17 @@ public static Response CreateMarketplaceAgreement(this Subsc /// Organization_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConfluentOrganizationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfluentOrganizationsAsync(cancellationToken); + return GetMockableConfluentSubscriptionResource(subscriptionResource).GetConfluentOrganizationsAsync(cancellationToken); } /// @@ -296,13 +314,17 @@ public static AsyncPageable GetConfluentOrganizat /// Organization_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConfluentOrganizations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfluentOrganizations(cancellationToken); + return GetMockableConfluentSubscriptionResource(subscriptionResource).GetConfluentOrganizations(cancellationToken); } } } diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentArmClient.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentArmClient.cs new file mode 100644 index 0000000000000..98a5b8f68a8fa --- /dev/null +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Confluent; + +namespace Azure.ResourceManager.Confluent.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableConfluentArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableConfluentArmClient() + { + } + + /// 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 MockableConfluentArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableConfluentArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConfluentOrganizationResource GetConfluentOrganizationResource(ResourceIdentifier id) + { + ConfluentOrganizationResource.ValidateResourceId(id); + return new ConfluentOrganizationResource(Client, id); + } + } +} diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentResourceGroupResource.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentResourceGroupResource.cs new file mode 100644 index 0000000000000..4405701c7f468 --- /dev/null +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentResourceGroupResource.cs @@ -0,0 +1,173 @@ +// 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; +using Azure.ResourceManager.Confluent; + +namespace Azure.ResourceManager.Confluent.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableConfluentResourceGroupResource : ArmResource + { + private ClientDiagnostics _validationsClientDiagnostics; + private ValidationsRestOperations _validationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableConfluentResourceGroupResource() + { + } + + /// 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 MockableConfluentResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ValidationsClientDiagnostics => _validationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Confluent", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ValidationsRestOperations ValidationsRestClient => _validationsRestClient ??= new ValidationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ConfluentOrganizationResources in the ResourceGroupResource. + /// An object representing collection of ConfluentOrganizationResources and their operations over a ConfluentOrganizationResource. + public virtual ConfluentOrganizationCollection GetConfluentOrganizations() + { + return GetCachedClient(client => new ConfluentOrganizationCollection(client, Id)); + } + + /// + /// Get the properties of a specific Organization resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName} + /// + /// + /// Operation Id + /// Organization_Get + /// + /// + /// + /// Organization resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetConfluentOrganizationAsync(string organizationName, CancellationToken cancellationToken = default) + { + return await GetConfluentOrganizations().GetAsync(organizationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a specific Organization resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName} + /// + /// + /// Operation Id + /// Organization_Get + /// + /// + /// + /// Organization resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetConfluentOrganization(string organizationName, CancellationToken cancellationToken = default) + { + return GetConfluentOrganizations().Get(organizationName, cancellationToken); + } + + /// + /// Organization Validate proxy resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate + /// + /// + /// Operation Id + /// Validations_ValidateOrganization + /// + /// + /// + /// Organization resource name. + /// Organization resource model. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> ValidateOrganizationAsync(string organizationName, ConfluentOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ValidationsClientDiagnostics.CreateScope("MockableConfluentResourceGroupResource.ValidateOrganization"); + scope.Start(); + try + { + var response = await ValidationsRestClient.ValidateOrganizationAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfluentOrganizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Organization Validate proxy resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate + /// + /// + /// Operation Id + /// Validations_ValidateOrganization + /// + /// + /// + /// Organization resource name. + /// Organization resource model. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response ValidateOrganization(string organizationName, ConfluentOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ValidationsClientDiagnostics.CreateScope("MockableConfluentResourceGroupResource.ValidateOrganization"); + scope.Start(); + try + { + var response = ValidationsRestClient.ValidateOrganization(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data, cancellationToken); + return Response.FromValue(new ConfluentOrganizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentSubscriptionResource.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentSubscriptionResource.cs new file mode 100644 index 0000000000000..e5733b168ea26 --- /dev/null +++ b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/MockableConfluentSubscriptionResource.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Confluent; +using Azure.ResourceManager.Confluent.Models; + +namespace Azure.ResourceManager.Confluent.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableConfluentSubscriptionResource : ArmResource + { + private ClientDiagnostics _marketplaceAgreementsClientDiagnostics; + private MarketplaceAgreementsRestOperations _marketplaceAgreementsRestClient; + private ClientDiagnostics _confluentOrganizationOrganizationClientDiagnostics; + private OrganizationRestOperations _confluentOrganizationOrganizationRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableConfluentSubscriptionResource() + { + } + + /// 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 MockableConfluentSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MarketplaceAgreementsClientDiagnostics => _marketplaceAgreementsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Confluent", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MarketplaceAgreementsRestOperations MarketplaceAgreementsRestClient => _marketplaceAgreementsRestClient ??= new MarketplaceAgreementsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ConfluentOrganizationOrganizationClientDiagnostics => _confluentOrganizationOrganizationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Confluent", ConfluentOrganizationResource.ResourceType.Namespace, Diagnostics); + private OrganizationRestOperations ConfluentOrganizationOrganizationRestClient => _confluentOrganizationOrganizationRestClient ??= new OrganizationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConfluentOrganizationResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Confluent marketplace agreements in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements + /// + /// + /// Operation Id + /// MarketplaceAgreements_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMarketplaceAgreementsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplaceAgreementsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplaceAgreementsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConfluentAgreement.DeserializeConfluentAgreement, MarketplaceAgreementsClientDiagnostics, Pipeline, "MockableConfluentSubscriptionResource.GetMarketplaceAgreements", "value", "nextLink", cancellationToken); + } + + /// + /// List Confluent marketplace agreements in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements + /// + /// + /// Operation Id + /// MarketplaceAgreements_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMarketplaceAgreements(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplaceAgreementsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplaceAgreementsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConfluentAgreement.DeserializeConfluentAgreement, MarketplaceAgreementsClientDiagnostics, Pipeline, "MockableConfluentSubscriptionResource.GetMarketplaceAgreements", "value", "nextLink", cancellationToken); + } + + /// + /// Create Confluent Marketplace agreement in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default + /// + /// + /// Operation Id + /// MarketplaceAgreements_Create + /// + /// + /// + /// Confluent Marketplace Agreement resource. + /// The cancellation token to use. + public virtual async Task> CreateMarketplaceAgreementAsync(ConfluentAgreement body = null, CancellationToken cancellationToken = default) + { + using var scope = MarketplaceAgreementsClientDiagnostics.CreateScope("MockableConfluentSubscriptionResource.CreateMarketplaceAgreement"); + scope.Start(); + try + { + var response = await MarketplaceAgreementsRestClient.CreateAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create Confluent Marketplace agreement in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default + /// + /// + /// Operation Id + /// MarketplaceAgreements_Create + /// + /// + /// + /// Confluent Marketplace Agreement resource. + /// The cancellation token to use. + public virtual Response CreateMarketplaceAgreement(ConfluentAgreement body = null, CancellationToken cancellationToken = default) + { + using var scope = MarketplaceAgreementsClientDiagnostics.CreateScope("MockableConfluentSubscriptionResource.CreateMarketplaceAgreement"); + scope.Start(); + try + { + var response = MarketplaceAgreementsRestClient.Create(Id.SubscriptionId, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all organizations under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations + /// + /// + /// Operation Id + /// Organization_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfluentOrganizationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), ConfluentOrganizationOrganizationClientDiagnostics, Pipeline, "MockableConfluentSubscriptionResource.GetConfluentOrganizations", "value", "nextLink", cancellationToken); + } + + /// + /// List all organizations under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations + /// + /// + /// Operation Id + /// Organization_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfluentOrganizations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), ConfluentOrganizationOrganizationClientDiagnostics, Pipeline, "MockableConfluentSubscriptionResource.GetConfluentOrganizations", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index cfbed6988078b..0000000000000 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,116 +0,0 @@ -// 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.Confluent -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _validationsClientDiagnostics; - private ValidationsRestOperations _validationsRestClient; - - /// 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 ClientDiagnostics ValidationsClientDiagnostics => _validationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Confluent", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ValidationsRestOperations ValidationsRestClient => _validationsRestClient ??= new ValidationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ConfluentOrganizationResources in the ResourceGroupResource. - /// An object representing collection of ConfluentOrganizationResources and their operations over a ConfluentOrganizationResource. - public virtual ConfluentOrganizationCollection GetConfluentOrganizations() - { - return GetCachedClient(Client => new ConfluentOrganizationCollection(Client, Id)); - } - - /// - /// Organization Validate proxy resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate - /// - /// - /// Operation Id - /// Validations_ValidateOrganization - /// - /// - /// - /// Organization resource name. - /// Organization resource model. - /// The cancellation token to use. - public virtual async Task> ValidateOrganizationAsync(string organizationName, ConfluentOrganizationData data, CancellationToken cancellationToken = default) - { - using var scope = ValidationsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.ValidateOrganization"); - scope.Start(); - try - { - var response = await ValidationsRestClient.ValidateOrganizationAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ConfluentOrganizationResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Organization Validate proxy resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate - /// - /// - /// Operation Id - /// Validations_ValidateOrganization - /// - /// - /// - /// Organization resource name. - /// Organization resource model. - /// The cancellation token to use. - public virtual Response ValidateOrganization(string organizationName, ConfluentOrganizationData data, CancellationToken cancellationToken = default) - { - using var scope = ValidationsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.ValidateOrganization"); - scope.Start(); - try - { - var response = ValidationsRestClient.ValidateOrganization(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data, cancellationToken); - return Response.FromValue(new ConfluentOrganizationResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d4cb9560bd9c5..0000000000000 --- a/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Confluent.Models; - -namespace Azure.ResourceManager.Confluent -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _marketplaceAgreementsClientDiagnostics; - private MarketplaceAgreementsRestOperations _marketplaceAgreementsRestClient; - private ClientDiagnostics _confluentOrganizationOrganizationClientDiagnostics; - private OrganizationRestOperations _confluentOrganizationOrganizationRestClient; - - /// 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 MarketplaceAgreementsClientDiagnostics => _marketplaceAgreementsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Confluent", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MarketplaceAgreementsRestOperations MarketplaceAgreementsRestClient => _marketplaceAgreementsRestClient ??= new MarketplaceAgreementsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ConfluentOrganizationOrganizationClientDiagnostics => _confluentOrganizationOrganizationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Confluent", ConfluentOrganizationResource.ResourceType.Namespace, Diagnostics); - private OrganizationRestOperations ConfluentOrganizationOrganizationRestClient => _confluentOrganizationOrganizationRestClient ??= new OrganizationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConfluentOrganizationResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List Confluent marketplace agreements in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements - /// - /// - /// Operation Id - /// MarketplaceAgreements_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMarketplaceAgreementsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplaceAgreementsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplaceAgreementsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConfluentAgreement.DeserializeConfluentAgreement, MarketplaceAgreementsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMarketplaceAgreements", "value", "nextLink", cancellationToken); - } - - /// - /// List Confluent marketplace agreements in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements - /// - /// - /// Operation Id - /// MarketplaceAgreements_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMarketplaceAgreements(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplaceAgreementsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplaceAgreementsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConfluentAgreement.DeserializeConfluentAgreement, MarketplaceAgreementsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMarketplaceAgreements", "value", "nextLink", cancellationToken); - } - - /// - /// Create Confluent Marketplace agreement in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default - /// - /// - /// Operation Id - /// MarketplaceAgreements_Create - /// - /// - /// - /// Confluent Marketplace Agreement resource. - /// The cancellation token to use. - public virtual async Task> CreateMarketplaceAgreementAsync(ConfluentAgreement body = null, CancellationToken cancellationToken = default) - { - using var scope = MarketplaceAgreementsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateMarketplaceAgreement"); - scope.Start(); - try - { - var response = await MarketplaceAgreementsRestClient.CreateAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create Confluent Marketplace agreement in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default - /// - /// - /// Operation Id - /// MarketplaceAgreements_Create - /// - /// - /// - /// Confluent Marketplace Agreement resource. - /// The cancellation token to use. - public virtual Response CreateMarketplaceAgreement(ConfluentAgreement body = null, CancellationToken cancellationToken = default) - { - using var scope = MarketplaceAgreementsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateMarketplaceAgreement"); - scope.Start(); - try - { - var response = MarketplaceAgreementsRestClient.Create(Id.SubscriptionId, body, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all organizations under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations - /// - /// - /// Operation Id - /// Organization_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfluentOrganizationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), ConfluentOrganizationOrganizationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfluentOrganizations", "value", "nextLink", cancellationToken); - } - - /// - /// List all organizations under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations - /// - /// - /// Operation Id - /// Organization_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfluentOrganizations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfluentOrganizationOrganizationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfluentOrganizationResource(Client, ConfluentOrganizationData.DeserializeConfluentOrganizationData(e)), ConfluentOrganizationOrganizationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfluentOrganizations", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/Azure.ResourceManager.ConnectedVMwarevSphere.sln b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/Azure.ResourceManager.ConnectedVMwarevSphere.sln index 908fdc4dd7d24..fbc48a8a43380 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/Azure.ResourceManager.ConnectedVMwarevSphere.sln +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/Azure.ResourceManager.ConnectedVMwarevSphere.sln @@ -57,6 +57,18 @@ Global {51D25B44-823D-48F1-BA65-5C87FC39D906}.Release|x64.Build.0 = Release|Any CPU {51D25B44-823D-48F1-BA65-5C87FC39D906}.Release|x86.ActiveCfg = Release|Any CPU {51D25B44-823D-48F1-BA65-5C87FC39D906}.Release|x86.Build.0 = Release|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Debug|x64.ActiveCfg = Debug|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Debug|x64.Build.0 = Debug|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Debug|x86.ActiveCfg = Debug|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Debug|x86.Build.0 = Debug|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Release|Any CPU.Build.0 = Release|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Release|x64.ActiveCfg = Release|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Release|x64.Build.0 = Release|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Release|x86.ActiveCfg = Release|Any CPU + {19156E33-7DE0-4F78-AD01-ACAD63CC4B86}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/api/Azure.ResourceManager.ConnectedVMwarevSphere.netstandard2.0.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/api/Azure.ResourceManager.ConnectedVMwarevSphere.netstandard2.0.cs index 4002179c7b234..71f00c2afc4d9 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/api/Azure.ResourceManager.ConnectedVMwarevSphere.netstandard2.0.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/api/Azure.ResourceManager.ConnectedVMwarevSphere.netstandard2.0.cs @@ -196,7 +196,7 @@ protected MachineExtensionCollection() { } } public partial class MachineExtensionData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineExtensionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MachineExtensionData(Azure.Core.AzureLocation location) { } public bool? AutoUpgradeMinorVersion { get { throw null; } set { } } public string ForceUpdateTag { get { throw null; } set { } } public Azure.ResourceManager.ConnectedVMwarevSphere.Models.MachineExtensionPropertiesInstanceView InstanceView { get { throw null; } set { } } @@ -246,7 +246,7 @@ protected ResourcePoolCollection() { } } public partial class ResourcePoolData : Azure.ResourceManager.Models.TrackedResourceData { - public ResourcePoolData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ResourcePoolData(Azure.Core.AzureLocation location) { } public long? CpuLimitMHz { get { throw null; } } public long? CpuReservationMHz { get { throw null; } } public string CpuSharesLevel { get { throw null; } } @@ -303,7 +303,7 @@ protected VCenterCollection() { } } public partial class VCenterData : Azure.ResourceManager.Models.TrackedResourceData { - public VCenterData(Azure.Core.AzureLocation location, string fqdn) : base (default(Azure.Core.AzureLocation)) { } + public VCenterData(Azure.Core.AzureLocation location, string fqdn) { } public string ConnectionStatus { get { throw null; } } public Azure.ResourceManager.ConnectedVMwarevSphere.Models.VICredential Credentials { get { throw null; } set { } } public string CustomResourceName { get { throw null; } } @@ -359,7 +359,7 @@ protected VirtualMachineCollection() { } } public partial class VirtualMachineData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineData(Azure.Core.AzureLocation location) { } public string CustomResourceName { get { throw null; } } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public Azure.ResourceManager.ConnectedVMwarevSphere.Models.FirmwareType? FirmwareType { get { throw null; } set { } } @@ -440,7 +440,7 @@ protected VirtualMachineTemplateCollection() { } } public partial class VirtualMachineTemplateData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualMachineTemplateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualMachineTemplateData(Azure.Core.AzureLocation location) { } public string CustomResourceName { get { throw null; } } public System.Collections.Generic.IReadOnlyList Disks { get { throw null; } } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } @@ -502,7 +502,7 @@ protected VirtualNetworkCollection() { } } public partial class VirtualNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualNetworkData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualNetworkData(Azure.Core.AzureLocation location) { } public string CustomResourceName { get { throw null; } } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public string InventoryItemId { get { throw null; } set { } } @@ -553,7 +553,7 @@ protected VMwareClusterCollection() { } } public partial class VMwareClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public VMwareClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VMwareClusterData(Azure.Core.AzureLocation location) { } public string CustomResourceName { get { throw null; } } public System.Collections.Generic.IReadOnlyList DatastoreIds { get { throw null; } } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } @@ -606,7 +606,7 @@ protected VMwareDatastoreCollection() { } } public partial class VMwareDatastoreData : Azure.ResourceManager.Models.TrackedResourceData { - public VMwareDatastoreData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VMwareDatastoreData(Azure.Core.AzureLocation location) { } public string CustomResourceName { get { throw null; } } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public string InventoryItemId { get { throw null; } set { } } @@ -657,7 +657,7 @@ protected VMwareHostCollection() { } } public partial class VMwareHostData : Azure.ResourceManager.Models.TrackedResourceData { - public VMwareHostData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VMwareHostData(Azure.Core.AzureLocation location) { } public string CustomResourceName { get { throw null; } } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public string InventoryItemId { get { throw null; } set { } } @@ -690,6 +690,73 @@ protected VMwareHostResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.ConnectedVMwarevSphere.Models.ResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ConnectedVMwarevSphere.Mocking +{ + public partial class MockableConnectedVMwarevSphereArmClient : Azure.ResourceManager.ArmResource + { + protected MockableConnectedVMwarevSphereArmClient() { } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.GuestAgentResource GetGuestAgentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.HybridIdentityMetadataResource GetHybridIdentityMetadataResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.InventoryItemResource GetInventoryItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.MachineExtensionResource GetMachineExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.ResourcePoolResource GetResourcePoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VCenterResource GetVCenterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VirtualMachineResource GetVirtualMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VirtualMachineTemplateResource GetVirtualMachineTemplateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VirtualNetworkResource GetVirtualNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VMwareClusterResource GetVMwareClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VMwareDatastoreResource GetVMwareDatastoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VMwareHostResource GetVMwareHostResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableConnectedVMwarevSphereResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableConnectedVMwarevSphereResourceGroupResource() { } + public virtual Azure.Response GetResourcePool(string resourcePoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourcePoolAsync(string resourcePoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.ResourcePoolCollection GetResourcePools() { throw null; } + public virtual Azure.Response GetVCenter(string vcenterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVCenterAsync(string vcenterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VCenterCollection GetVCenters() { throw null; } + public virtual Azure.Response GetVirtualMachine(string virtualMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineAsync(string virtualMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VirtualMachineCollection GetVirtualMachines() { throw null; } + public virtual Azure.Response GetVirtualMachineTemplate(string virtualMachineTemplateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualMachineTemplateAsync(string virtualMachineTemplateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VirtualMachineTemplateCollection GetVirtualMachineTemplates() { throw null; } + public virtual Azure.Response GetVirtualNetwork(string virtualNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualNetworkAsync(string virtualNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VirtualNetworkCollection GetVirtualNetworks() { throw null; } + public virtual Azure.Response GetVMwareCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVMwareClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VMwareClusterCollection GetVMwareClusters() { throw null; } + public virtual Azure.Response GetVMwareDatastore(string datastoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVMwareDatastoreAsync(string datastoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VMwareDatastoreCollection GetVMwareDatastores() { throw null; } + public virtual Azure.Response GetVMwareHost(string hostName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVMwareHostAsync(string hostName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ConnectedVMwarevSphere.VMwareHostCollection GetVMwareHosts() { throw null; } + } + public partial class MockableConnectedVMwarevSphereSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableConnectedVMwarevSphereSubscriptionResource() { } + public virtual Azure.Pageable GetResourcePools(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetResourcePoolsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVCenters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVCentersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachines(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachinesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualMachineTemplates(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualMachineTemplatesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualNetworks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualNetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVMwareClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVMwareClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVMwareDatastores(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVMwareDatastoresAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVMwareHosts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVMwareHostsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ConnectedVMwarevSphere.Models { public static partial class ArmConnectedVMwarevSphereModelFactory diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/ConnectedVMwarevSphereExtensions.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/ConnectedVMwarevSphereExtensions.cs index a8e1c605b81d1..2813677f0ee53 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/ConnectedVMwarevSphereExtensions.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/ConnectedVMwarevSphereExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ConnectedVMwarevSphere.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ConnectedVMwarevSphere @@ -18,271 +19,225 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere /// A class to add extension methods to Azure.ResourceManager.ConnectedVMwarevSphere. public static partial class ConnectedVMwarevSphereExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableConnectedVMwarevSphereArmClient GetMockableConnectedVMwarevSphereArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableConnectedVMwarevSphereArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableConnectedVMwarevSphereResourceGroupResource GetMockableConnectedVMwarevSphereResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableConnectedVMwarevSphereResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableConnectedVMwarevSphereSubscriptionResource GetMockableConnectedVMwarevSphereSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableConnectedVMwarevSphereSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ResourcePoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourcePoolResource GetResourcePoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourcePoolResource.ValidateResourceId(id); - return new ResourcePoolResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetResourcePoolResource(id); } - #endregion - #region VMwareClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VMwareClusterResource GetVMwareClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VMwareClusterResource.ValidateResourceId(id); - return new VMwareClusterResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetVMwareClusterResource(id); } - #endregion - #region VMwareHostResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VMwareHostResource GetVMwareHostResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VMwareHostResource.ValidateResourceId(id); - return new VMwareHostResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetVMwareHostResource(id); } - #endregion - #region VMwareDatastoreResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VMwareDatastoreResource GetVMwareDatastoreResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VMwareDatastoreResource.ValidateResourceId(id); - return new VMwareDatastoreResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetVMwareDatastoreResource(id); } - #endregion - #region VCenterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VCenterResource GetVCenterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VCenterResource.ValidateResourceId(id); - return new VCenterResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetVCenterResource(id); } - #endregion - #region VirtualMachineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineResource GetVirtualMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineResource.ValidateResourceId(id); - return new VirtualMachineResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetVirtualMachineResource(id); } - #endregion - #region VirtualMachineTemplateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineTemplateResource GetVirtualMachineTemplateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineTemplateResource.ValidateResourceId(id); - return new VirtualMachineTemplateResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetVirtualMachineTemplateResource(id); } - #endregion - #region VirtualNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkResource GetVirtualNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkResource.ValidateResourceId(id); - return new VirtualNetworkResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetVirtualNetworkResource(id); } - #endregion - #region InventoryItemResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static InventoryItemResource GetInventoryItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - InventoryItemResource.ValidateResourceId(id); - return new InventoryItemResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetInventoryItemResource(id); } - #endregion - #region HybridIdentityMetadataResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridIdentityMetadataResource GetHybridIdentityMetadataResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridIdentityMetadataResource.ValidateResourceId(id); - return new HybridIdentityMetadataResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetHybridIdentityMetadataResource(id); } - #endregion - #region MachineExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineExtensionResource GetMachineExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineExtensionResource.ValidateResourceId(id); - return new MachineExtensionResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetMachineExtensionResource(id); } - #endregion - #region GuestAgentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GuestAgentResource GetGuestAgentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GuestAgentResource.ValidateResourceId(id); - return new GuestAgentResource(client, id); - } - ); + return GetMockableConnectedVMwarevSphereArmClient(client).GetGuestAgentResource(id); } - #endregion - /// Gets a collection of ResourcePoolResources in the ResourceGroupResource. + /// + /// Gets a collection of ResourcePoolResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ResourcePoolResources and their operations over a ResourcePoolResource. public static ResourcePoolCollection GetResourcePools(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetResourcePools(); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetResourcePools(); } /// @@ -297,16 +252,20 @@ public static ResourcePoolCollection GetResourcePools(this ResourceGroupResource /// ResourcePools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the resourcePool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourcePoolAsync(this ResourceGroupResource resourceGroupResource, string resourcePoolName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetResourcePools().GetAsync(resourcePoolName, cancellationToken).ConfigureAwait(false); + return await GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetResourcePoolAsync(resourcePoolName, cancellationToken).ConfigureAwait(false); } /// @@ -321,24 +280,34 @@ public static async Task> GetResourcePoolAsync(th /// ResourcePools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the resourcePool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourcePool(this ResourceGroupResource resourceGroupResource, string resourcePoolName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetResourcePools().Get(resourcePoolName, cancellationToken); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetResourcePool(resourcePoolName, cancellationToken); } - /// Gets a collection of VMwareClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of VMwareClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VMwareClusterResources and their operations over a VMwareClusterResource. public static VMwareClusterCollection GetVMwareClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVMwareClusters(); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareClusters(); } /// @@ -353,16 +322,20 @@ public static VMwareClusterCollection GetVMwareClusters(this ResourceGroupResour /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVMwareClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVMwareClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -377,24 +350,34 @@ public static async Task> GetVMwareClusterAsync( /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVMwareCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVMwareClusters().Get(clusterName, cancellationToken); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareCluster(clusterName, cancellationToken); } - /// Gets a collection of VMwareHostResources in the ResourceGroupResource. + /// + /// Gets a collection of VMwareHostResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VMwareHostResources and their operations over a VMwareHostResource. public static VMwareHostCollection GetVMwareHosts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVMwareHosts(); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareHosts(); } /// @@ -409,16 +392,20 @@ public static VMwareHostCollection GetVMwareHosts(this ResourceGroupResource res /// Hosts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the host. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVMwareHostAsync(this ResourceGroupResource resourceGroupResource, string hostName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVMwareHosts().GetAsync(hostName, cancellationToken).ConfigureAwait(false); + return await GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareHostAsync(hostName, cancellationToken).ConfigureAwait(false); } /// @@ -433,24 +420,34 @@ public static async Task> GetVMwareHostAsync(this R /// Hosts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the host. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVMwareHost(this ResourceGroupResource resourceGroupResource, string hostName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVMwareHosts().Get(hostName, cancellationToken); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareHost(hostName, cancellationToken); } - /// Gets a collection of VMwareDatastoreResources in the ResourceGroupResource. + /// + /// Gets a collection of VMwareDatastoreResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VMwareDatastoreResources and their operations over a VMwareDatastoreResource. public static VMwareDatastoreCollection GetVMwareDatastores(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVMwareDatastores(); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareDatastores(); } /// @@ -465,16 +462,20 @@ public static VMwareDatastoreCollection GetVMwareDatastores(this ResourceGroupRe /// Datastores_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the datastore. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVMwareDatastoreAsync(this ResourceGroupResource resourceGroupResource, string datastoreName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVMwareDatastores().GetAsync(datastoreName, cancellationToken).ConfigureAwait(false); + return await GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareDatastoreAsync(datastoreName, cancellationToken).ConfigureAwait(false); } /// @@ -489,24 +490,34 @@ public static async Task> GetVMwareDatastoreAs /// Datastores_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the datastore. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVMwareDatastore(this ResourceGroupResource resourceGroupResource, string datastoreName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVMwareDatastores().Get(datastoreName, cancellationToken); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVMwareDatastore(datastoreName, cancellationToken); } - /// Gets a collection of VCenterResources in the ResourceGroupResource. + /// + /// Gets a collection of VCenterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VCenterResources and their operations over a VCenterResource. public static VCenterCollection GetVCenters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVCenters(); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVCenters(); } /// @@ -521,16 +532,20 @@ public static VCenterCollection GetVCenters(this ResourceGroupResource resourceG /// VCenters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the vCenter. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVCenterAsync(this ResourceGroupResource resourceGroupResource, string vcenterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVCenters().GetAsync(vcenterName, cancellationToken).ConfigureAwait(false); + return await GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVCenterAsync(vcenterName, cancellationToken).ConfigureAwait(false); } /// @@ -545,24 +560,34 @@ public static async Task> GetVCenterAsync(this Resourc /// VCenters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the vCenter. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVCenter(this ResourceGroupResource resourceGroupResource, string vcenterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVCenters().Get(vcenterName, cancellationToken); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVCenter(vcenterName, cancellationToken); } - /// Gets a collection of VirtualMachineResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualMachineResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualMachineResources and their operations over a VirtualMachineResource. public static VirtualMachineCollection GetVirtualMachines(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualMachines(); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualMachines(); } /// @@ -577,16 +602,20 @@ public static VirtualMachineCollection GetVirtualMachines(this ResourceGroupReso /// VirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the virtual machine resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualMachineAsync(this ResourceGroupResource resourceGroupResource, string virtualMachineName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualMachines().GetAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); + return await GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualMachineAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); } /// @@ -601,24 +630,34 @@ public static async Task> GetVirtualMachineAsyn /// VirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the virtual machine resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualMachine(this ResourceGroupResource resourceGroupResource, string virtualMachineName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualMachines().Get(virtualMachineName, cancellationToken); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualMachine(virtualMachineName, cancellationToken); } - /// Gets a collection of VirtualMachineTemplateResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualMachineTemplateResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualMachineTemplateResources and their operations over a VirtualMachineTemplateResource. public static VirtualMachineTemplateCollection GetVirtualMachineTemplates(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualMachineTemplates(); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualMachineTemplates(); } /// @@ -633,16 +672,20 @@ public static VirtualMachineTemplateCollection GetVirtualMachineTemplates(this R /// VirtualMachineTemplates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the virtual machine template resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualMachineTemplateAsync(this ResourceGroupResource resourceGroupResource, string virtualMachineTemplateName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualMachineTemplates().GetAsync(virtualMachineTemplateName, cancellationToken).ConfigureAwait(false); + return await GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualMachineTemplateAsync(virtualMachineTemplateName, cancellationToken).ConfigureAwait(false); } /// @@ -657,24 +700,34 @@ public static async Task> GetVirtualMac /// VirtualMachineTemplates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the virtual machine template resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualMachineTemplate(this ResourceGroupResource resourceGroupResource, string virtualMachineTemplateName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualMachineTemplates().Get(virtualMachineTemplateName, cancellationToken); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualMachineTemplate(virtualMachineTemplateName, cancellationToken); } - /// Gets a collection of VirtualNetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualNetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualNetworkResources and their operations over a VirtualNetworkResource. public static VirtualNetworkCollection GetVirtualNetworks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualNetworks(); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualNetworks(); } /// @@ -689,16 +742,20 @@ public static VirtualNetworkCollection GetVirtualNetworks(this ResourceGroupReso /// VirtualNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the virtual network resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualNetworkAsync(this ResourceGroupResource resourceGroupResource, string virtualNetworkName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualNetworks().GetAsync(virtualNetworkName, cancellationToken).ConfigureAwait(false); + return await GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualNetworkAsync(virtualNetworkName, cancellationToken).ConfigureAwait(false); } /// @@ -713,16 +770,20 @@ public static async Task> GetVirtualNetworkAsyn /// VirtualNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the virtual network resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualNetwork(this ResourceGroupResource resourceGroupResource, string virtualNetworkName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualNetworks().Get(virtualNetworkName, cancellationToken); + return GetMockableConnectedVMwarevSphereResourceGroupResource(resourceGroupResource).GetVirtualNetwork(virtualNetworkName, cancellationToken); } /// @@ -737,13 +798,17 @@ public static Response GetVirtualNetwork(this ResourceGr /// ResourcePools_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourcePoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourcePoolsAsync(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetResourcePoolsAsync(cancellationToken); } /// @@ -758,13 +823,17 @@ public static AsyncPageable GetResourcePoolsAsync(this Sub /// ResourcePools_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourcePools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourcePools(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetResourcePools(cancellationToken); } /// @@ -779,13 +848,17 @@ public static Pageable GetResourcePools(this SubscriptionR /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVMwareClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVMwareClustersAsync(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVMwareClustersAsync(cancellationToken); } /// @@ -800,13 +873,17 @@ public static AsyncPageable GetVMwareClustersAsync(this S /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVMwareClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVMwareClusters(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVMwareClusters(cancellationToken); } /// @@ -821,13 +898,17 @@ public static Pageable GetVMwareClusters(this Subscriptio /// Hosts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVMwareHostsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVMwareHostsAsync(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVMwareHostsAsync(cancellationToken); } /// @@ -842,13 +923,17 @@ public static AsyncPageable GetVMwareHostsAsync(this Subscri /// Hosts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVMwareHosts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVMwareHosts(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVMwareHosts(cancellationToken); } /// @@ -863,13 +948,17 @@ public static Pageable GetVMwareHosts(this SubscriptionResou /// Datastores_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVMwareDatastoresAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVMwareDatastoresAsync(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVMwareDatastoresAsync(cancellationToken); } /// @@ -884,13 +973,17 @@ public static AsyncPageable GetVMwareDatastoresAsync(th /// Datastores_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVMwareDatastores(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVMwareDatastores(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVMwareDatastores(cancellationToken); } /// @@ -905,13 +998,17 @@ public static Pageable GetVMwareDatastores(this Subscri /// VCenters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVCentersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVCentersAsync(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVCentersAsync(cancellationToken); } /// @@ -926,13 +1023,17 @@ public static AsyncPageable GetVCentersAsync(this SubscriptionR /// VCenters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVCenters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVCenters(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVCenters(cancellationToken); } /// @@ -947,13 +1048,17 @@ public static Pageable GetVCenters(this SubscriptionResource su /// VirtualMachines_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualMachinesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachinesAsync(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVirtualMachinesAsync(cancellationToken); } /// @@ -968,13 +1073,17 @@ public static AsyncPageable GetVirtualMachinesAsync(this /// VirtualMachines_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualMachines(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachines(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVirtualMachines(cancellationToken); } /// @@ -989,13 +1098,17 @@ public static Pageable GetVirtualMachines(this Subscript /// VirtualMachineTemplates_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualMachineTemplatesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineTemplatesAsync(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVirtualMachineTemplatesAsync(cancellationToken); } /// @@ -1010,13 +1123,17 @@ public static AsyncPageable GetVirtualMachineTem /// VirtualMachineTemplates_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualMachineTemplates(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualMachineTemplates(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVirtualMachineTemplates(cancellationToken); } /// @@ -1031,13 +1148,17 @@ public static Pageable GetVirtualMachineTemplate /// VirtualNetworks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualNetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualNetworksAsync(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVirtualNetworksAsync(cancellationToken); } /// @@ -1052,13 +1173,17 @@ public static AsyncPageable GetVirtualNetworksAsync(this /// VirtualNetworks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualNetworks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualNetworks(cancellationToken); + return GetMockableConnectedVMwarevSphereSubscriptionResource(subscriptionResource).GetVirtualNetworks(cancellationToken); } } } diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereArmClient.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereArmClient.cs new file mode 100644 index 0000000000000..b74b9851334f4 --- /dev/null +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereArmClient.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ConnectedVMwarevSphere; + +namespace Azure.ResourceManager.ConnectedVMwarevSphere.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableConnectedVMwarevSphereArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableConnectedVMwarevSphereArmClient() + { + } + + /// 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 MockableConnectedVMwarevSphereArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableConnectedVMwarevSphereArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourcePoolResource GetResourcePoolResource(ResourceIdentifier id) + { + ResourcePoolResource.ValidateResourceId(id); + return new ResourcePoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VMwareClusterResource GetVMwareClusterResource(ResourceIdentifier id) + { + VMwareClusterResource.ValidateResourceId(id); + return new VMwareClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VMwareHostResource GetVMwareHostResource(ResourceIdentifier id) + { + VMwareHostResource.ValidateResourceId(id); + return new VMwareHostResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VMwareDatastoreResource GetVMwareDatastoreResource(ResourceIdentifier id) + { + VMwareDatastoreResource.ValidateResourceId(id); + return new VMwareDatastoreResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VCenterResource GetVCenterResource(ResourceIdentifier id) + { + VCenterResource.ValidateResourceId(id); + return new VCenterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineResource GetVirtualMachineResource(ResourceIdentifier id) + { + VirtualMachineResource.ValidateResourceId(id); + return new VirtualMachineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineTemplateResource GetVirtualMachineTemplateResource(ResourceIdentifier id) + { + VirtualMachineTemplateResource.ValidateResourceId(id); + return new VirtualMachineTemplateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkResource GetVirtualNetworkResource(ResourceIdentifier id) + { + VirtualNetworkResource.ValidateResourceId(id); + return new VirtualNetworkResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual InventoryItemResource GetInventoryItemResource(ResourceIdentifier id) + { + InventoryItemResource.ValidateResourceId(id); + return new InventoryItemResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridIdentityMetadataResource GetHybridIdentityMetadataResource(ResourceIdentifier id) + { + HybridIdentityMetadataResource.ValidateResourceId(id); + return new HybridIdentityMetadataResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineExtensionResource GetMachineExtensionResource(ResourceIdentifier id) + { + MachineExtensionResource.ValidateResourceId(id); + return new MachineExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GuestAgentResource GetGuestAgentResource(ResourceIdentifier id) + { + GuestAgentResource.ValidateResourceId(id); + return new GuestAgentResource(Client, id); + } + } +} diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereResourceGroupResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereResourceGroupResource.cs new file mode 100644 index 0000000000000..a826cb5115f84 --- /dev/null +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereResourceGroupResource.cs @@ -0,0 +1,463 @@ +// 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.ConnectedVMwarevSphere; + +namespace Azure.ResourceManager.ConnectedVMwarevSphere.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableConnectedVMwarevSphereResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableConnectedVMwarevSphereResourceGroupResource() + { + } + + /// 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 MockableConnectedVMwarevSphereResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ResourcePoolResources in the ResourceGroupResource. + /// An object representing collection of ResourcePoolResources and their operations over a ResourcePoolResource. + public virtual ResourcePoolCollection GetResourcePools() + { + return GetCachedClient(client => new ResourcePoolCollection(client, Id)); + } + + /// + /// Implements resourcePool GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName} + /// + /// + /// Operation Id + /// ResourcePools_Get + /// + /// + /// + /// Name of the resourcePool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourcePoolAsync(string resourcePoolName, CancellationToken cancellationToken = default) + { + return await GetResourcePools().GetAsync(resourcePoolName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements resourcePool GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName} + /// + /// + /// Operation Id + /// ResourcePools_Get + /// + /// + /// + /// Name of the resourcePool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourcePool(string resourcePoolName, CancellationToken cancellationToken = default) + { + return GetResourcePools().Get(resourcePoolName, cancellationToken); + } + + /// Gets a collection of VMwareClusterResources in the ResourceGroupResource. + /// An object representing collection of VMwareClusterResources and their operations over a VMwareClusterResource. + public virtual VMwareClusterCollection GetVMwareClusters() + { + return GetCachedClient(client => new VMwareClusterCollection(client, Id)); + } + + /// + /// Implements cluster GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVMwareClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetVMwareClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements cluster GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVMwareCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetVMwareClusters().Get(clusterName, cancellationToken); + } + + /// Gets a collection of VMwareHostResources in the ResourceGroupResource. + /// An object representing collection of VMwareHostResources and their operations over a VMwareHostResource. + public virtual VMwareHostCollection GetVMwareHosts() + { + return GetCachedClient(client => new VMwareHostCollection(client, Id)); + } + + /// + /// Implements host GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/hosts/{hostName} + /// + /// + /// Operation Id + /// Hosts_Get + /// + /// + /// + /// Name of the host. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVMwareHostAsync(string hostName, CancellationToken cancellationToken = default) + { + return await GetVMwareHosts().GetAsync(hostName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements host GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/hosts/{hostName} + /// + /// + /// Operation Id + /// Hosts_Get + /// + /// + /// + /// Name of the host. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVMwareHost(string hostName, CancellationToken cancellationToken = default) + { + return GetVMwareHosts().Get(hostName, cancellationToken); + } + + /// Gets a collection of VMwareDatastoreResources in the ResourceGroupResource. + /// An object representing collection of VMwareDatastoreResources and their operations over a VMwareDatastoreResource. + public virtual VMwareDatastoreCollection GetVMwareDatastores() + { + return GetCachedClient(client => new VMwareDatastoreCollection(client, Id)); + } + + /// + /// Implements datastore GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName} + /// + /// + /// Operation Id + /// Datastores_Get + /// + /// + /// + /// Name of the datastore. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVMwareDatastoreAsync(string datastoreName, CancellationToken cancellationToken = default) + { + return await GetVMwareDatastores().GetAsync(datastoreName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements datastore GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName} + /// + /// + /// Operation Id + /// Datastores_Get + /// + /// + /// + /// Name of the datastore. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVMwareDatastore(string datastoreName, CancellationToken cancellationToken = default) + { + return GetVMwareDatastores().Get(datastoreName, cancellationToken); + } + + /// Gets a collection of VCenterResources in the ResourceGroupResource. + /// An object representing collection of VCenterResources and their operations over a VCenterResource. + public virtual VCenterCollection GetVCenters() + { + return GetCachedClient(client => new VCenterCollection(client, Id)); + } + + /// + /// Implements vCenter GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName} + /// + /// + /// Operation Id + /// VCenters_Get + /// + /// + /// + /// Name of the vCenter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVCenterAsync(string vcenterName, CancellationToken cancellationToken = default) + { + return await GetVCenters().GetAsync(vcenterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements vCenter GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName} + /// + /// + /// Operation Id + /// VCenters_Get + /// + /// + /// + /// Name of the vCenter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVCenter(string vcenterName, CancellationToken cancellationToken = default) + { + return GetVCenters().Get(vcenterName, cancellationToken); + } + + /// Gets a collection of VirtualMachineResources in the ResourceGroupResource. + /// An object representing collection of VirtualMachineResources and their operations over a VirtualMachineResource. + public virtual VirtualMachineCollection GetVirtualMachines() + { + return GetCachedClient(client => new VirtualMachineCollection(client, Id)); + } + + /// + /// Implements virtual machine GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Name of the virtual machine resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualMachineAsync(string virtualMachineName, CancellationToken cancellationToken = default) + { + return await GetVirtualMachines().GetAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements virtual machine GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// Name of the virtual machine resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualMachine(string virtualMachineName, CancellationToken cancellationToken = default) + { + return GetVirtualMachines().Get(virtualMachineName, cancellationToken); + } + + /// Gets a collection of VirtualMachineTemplateResources in the ResourceGroupResource. + /// An object representing collection of VirtualMachineTemplateResources and their operations over a VirtualMachineTemplateResource. + public virtual VirtualMachineTemplateCollection GetVirtualMachineTemplates() + { + return GetCachedClient(client => new VirtualMachineTemplateCollection(client, Id)); + } + + /// + /// Implements virtual machine template GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName} + /// + /// + /// Operation Id + /// VirtualMachineTemplates_Get + /// + /// + /// + /// Name of the virtual machine template resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualMachineTemplateAsync(string virtualMachineTemplateName, CancellationToken cancellationToken = default) + { + return await GetVirtualMachineTemplates().GetAsync(virtualMachineTemplateName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements virtual machine template GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName} + /// + /// + /// Operation Id + /// VirtualMachineTemplates_Get + /// + /// + /// + /// Name of the virtual machine template resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualMachineTemplate(string virtualMachineTemplateName, CancellationToken cancellationToken = default) + { + return GetVirtualMachineTemplates().Get(virtualMachineTemplateName, cancellationToken); + } + + /// Gets a collection of VirtualNetworkResources in the ResourceGroupResource. + /// An object representing collection of VirtualNetworkResources and their operations over a VirtualNetworkResource. + public virtual VirtualNetworkCollection GetVirtualNetworks() + { + return GetCachedClient(client => new VirtualNetworkCollection(client, Id)); + } + + /// + /// Implements virtual network GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// Name of the virtual network resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualNetworkAsync(string virtualNetworkName, CancellationToken cancellationToken = default) + { + return await GetVirtualNetworks().GetAsync(virtualNetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements virtual network GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// Name of the virtual network resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualNetwork(string virtualNetworkName, CancellationToken cancellationToken = default) + { + return GetVirtualNetworks().Get(virtualNetworkName, cancellationToken); + } + } +} diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereSubscriptionResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereSubscriptionResource.cs new file mode 100644 index 0000000000000..17ce47a83aa3b --- /dev/null +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/MockableConnectedVMwarevSphereSubscriptionResource.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ConnectedVMwarevSphere; + +namespace Azure.ResourceManager.ConnectedVMwarevSphere.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableConnectedVMwarevSphereSubscriptionResource : ArmResource + { + private ClientDiagnostics _resourcePoolClientDiagnostics; + private ResourcePoolsRestOperations _resourcePoolRestClient; + private ClientDiagnostics _vMwareClusterClustersClientDiagnostics; + private ClustersRestOperations _vMwareClusterClustersRestClient; + private ClientDiagnostics _vMwareHostHostsClientDiagnostics; + private HostsRestOperations _vMwareHostHostsRestClient; + private ClientDiagnostics _vMwareDatastoreDatastoresClientDiagnostics; + private DatastoresRestOperations _vMwareDatastoreDatastoresRestClient; + private ClientDiagnostics _vCenterClientDiagnostics; + private VCentersRestOperations _vCenterRestClient; + private ClientDiagnostics _virtualMachineClientDiagnostics; + private VirtualMachinesRestOperations _virtualMachineRestClient; + private ClientDiagnostics _virtualMachineTemplateClientDiagnostics; + private VirtualMachineTemplatesRestOperations _virtualMachineTemplateRestClient; + private ClientDiagnostics _virtualNetworkClientDiagnostics; + private VirtualNetworksRestOperations _virtualNetworkRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableConnectedVMwarevSphereSubscriptionResource() + { + } + + /// 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 MockableConnectedVMwarevSphereSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ResourcePoolClientDiagnostics => _resourcePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", ResourcePoolResource.ResourceType.Namespace, Diagnostics); + private ResourcePoolsRestOperations ResourcePoolRestClient => _resourcePoolRestClient ??= new ResourcePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ResourcePoolResource.ResourceType)); + private ClientDiagnostics VMwareClusterClustersClientDiagnostics => _vMwareClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VMwareClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations VMwareClusterClustersRestClient => _vMwareClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VMwareClusterResource.ResourceType)); + private ClientDiagnostics VMwareHostHostsClientDiagnostics => _vMwareHostHostsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VMwareHostResource.ResourceType.Namespace, Diagnostics); + private HostsRestOperations VMwareHostHostsRestClient => _vMwareHostHostsRestClient ??= new HostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VMwareHostResource.ResourceType)); + private ClientDiagnostics VMwareDatastoreDatastoresClientDiagnostics => _vMwareDatastoreDatastoresClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VMwareDatastoreResource.ResourceType.Namespace, Diagnostics); + private DatastoresRestOperations VMwareDatastoreDatastoresRestClient => _vMwareDatastoreDatastoresRestClient ??= new DatastoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VMwareDatastoreResource.ResourceType)); + private ClientDiagnostics VCenterClientDiagnostics => _vCenterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VCenterResource.ResourceType.Namespace, Diagnostics); + private VCentersRestOperations VCenterRestClient => _vCenterRestClient ??= new VCentersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VCenterResource.ResourceType)); + private ClientDiagnostics VirtualMachineClientDiagnostics => _virtualMachineClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VirtualMachineResource.ResourceType.Namespace, Diagnostics); + private VirtualMachinesRestOperations VirtualMachineRestClient => _virtualMachineRestClient ??= new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineResource.ResourceType)); + private ClientDiagnostics VirtualMachineTemplateClientDiagnostics => _virtualMachineTemplateClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VirtualMachineTemplateResource.ResourceType.Namespace, Diagnostics); + private VirtualMachineTemplatesRestOperations VirtualMachineTemplateRestClient => _virtualMachineTemplateRestClient ??= new VirtualMachineTemplatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineTemplateResource.ResourceType)); + private ClientDiagnostics VirtualNetworkClientDiagnostics => _virtualNetworkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VirtualNetworkResource.ResourceType.Namespace, Diagnostics); + private VirtualNetworksRestOperations VirtualNetworkRestClient => _virtualNetworkRestClient ??= new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualNetworkResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List of resourcePools in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools + /// + /// + /// Operation Id + /// ResourcePools_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetResourcePoolsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourcePoolRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourcePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), ResourcePoolClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetResourcePools", "value", "nextLink", cancellationToken); + } + + /// + /// List of resourcePools in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools + /// + /// + /// Operation Id + /// ResourcePools_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetResourcePools(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourcePoolRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourcePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), ResourcePoolClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetResourcePools", "value", "nextLink", cancellationToken); + } + + /// + /// List of clusters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVMwareClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), VMwareClusterClustersClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVMwareClusters", "value", "nextLink", cancellationToken); + } + + /// + /// List of clusters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVMwareClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), VMwareClusterClustersClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVMwareClusters", "value", "nextLink", cancellationToken); + } + + /// + /// List of hosts in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/hosts + /// + /// + /// Operation Id + /// Hosts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVMwareHostsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareHostHostsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareHostHostsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), VMwareHostHostsClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVMwareHosts", "value", "nextLink", cancellationToken); + } + + /// + /// List of hosts in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/hosts + /// + /// + /// Operation Id + /// Hosts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVMwareHosts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareHostHostsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareHostHostsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), VMwareHostHostsClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVMwareHosts", "value", "nextLink", cancellationToken); + } + + /// + /// List of datastores in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/datastores + /// + /// + /// Operation Id + /// Datastores_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVMwareDatastoresAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), VMwareDatastoreDatastoresClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVMwareDatastores", "value", "nextLink", cancellationToken); + } + + /// + /// List of datastores in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/datastores + /// + /// + /// Operation Id + /// Datastores_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVMwareDatastores(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), VMwareDatastoreDatastoresClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVMwareDatastores", "value", "nextLink", cancellationToken); + } + + /// + /// List of vCenters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/vcenters + /// + /// + /// Operation Id + /// VCenters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVCentersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VCenterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VCenterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), VCenterClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVCenters", "value", "nextLink", cancellationToken); + } + + /// + /// List of vCenters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/vcenters + /// + /// + /// Operation Id + /// VCenters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVCenters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VCenterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VCenterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), VCenterClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVCenters", "value", "nextLink", cancellationToken); + } + + /// + /// List of virtualMachines in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachinesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVirtualMachines", "value", "nextLink", cancellationToken); + } + + /// + /// List of virtualMachines in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachines(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVirtualMachines", "value", "nextLink", cancellationToken); + } + + /// + /// List of virtualMachineTemplates in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates + /// + /// + /// Operation Id + /// VirtualMachineTemplates_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachineTemplatesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineTemplateRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineTemplateRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), VirtualMachineTemplateClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVirtualMachineTemplates", "value", "nextLink", cancellationToken); + } + + /// + /// List of virtualMachineTemplates in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates + /// + /// + /// Operation Id + /// VirtualMachineTemplates_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachineTemplates(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineTemplateRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineTemplateRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), VirtualMachineTemplateClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVirtualMachineTemplates", "value", "nextLink", cancellationToken); + } + + /// + /// List of virtualNetworks in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks + /// + /// + /// Operation Id + /// VirtualNetworks_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualNetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVirtualNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// List of virtualNetworks in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks + /// + /// + /// Operation Id + /// VirtualNetworks_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualNetworks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "MockableConnectedVMwarevSphereSubscriptionResource.GetVirtualNetworks", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3083e6dd87cf8..0000000000000 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ConnectedVMwarevSphere -{ - /// 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 ResourcePoolResources in the ResourceGroupResource. - /// An object representing collection of ResourcePoolResources and their operations over a ResourcePoolResource. - public virtual ResourcePoolCollection GetResourcePools() - { - return GetCachedClient(Client => new ResourcePoolCollection(Client, Id)); - } - - /// Gets a collection of VMwareClusterResources in the ResourceGroupResource. - /// An object representing collection of VMwareClusterResources and their operations over a VMwareClusterResource. - public virtual VMwareClusterCollection GetVMwareClusters() - { - return GetCachedClient(Client => new VMwareClusterCollection(Client, Id)); - } - - /// Gets a collection of VMwareHostResources in the ResourceGroupResource. - /// An object representing collection of VMwareHostResources and their operations over a VMwareHostResource. - public virtual VMwareHostCollection GetVMwareHosts() - { - return GetCachedClient(Client => new VMwareHostCollection(Client, Id)); - } - - /// Gets a collection of VMwareDatastoreResources in the ResourceGroupResource. - /// An object representing collection of VMwareDatastoreResources and their operations over a VMwareDatastoreResource. - public virtual VMwareDatastoreCollection GetVMwareDatastores() - { - return GetCachedClient(Client => new VMwareDatastoreCollection(Client, Id)); - } - - /// Gets a collection of VCenterResources in the ResourceGroupResource. - /// An object representing collection of VCenterResources and their operations over a VCenterResource. - public virtual VCenterCollection GetVCenters() - { - return GetCachedClient(Client => new VCenterCollection(Client, Id)); - } - - /// Gets a collection of VirtualMachineResources in the ResourceGroupResource. - /// An object representing collection of VirtualMachineResources and their operations over a VirtualMachineResource. - public virtual VirtualMachineCollection GetVirtualMachines() - { - return GetCachedClient(Client => new VirtualMachineCollection(Client, Id)); - } - - /// Gets a collection of VirtualMachineTemplateResources in the ResourceGroupResource. - /// An object representing collection of VirtualMachineTemplateResources and their operations over a VirtualMachineTemplateResource. - public virtual VirtualMachineTemplateCollection GetVirtualMachineTemplates() - { - return GetCachedClient(Client => new VirtualMachineTemplateCollection(Client, Id)); - } - - /// Gets a collection of VirtualNetworkResources in the ResourceGroupResource. - /// An object representing collection of VirtualNetworkResources and their operations over a VirtualNetworkResource. - public virtual VirtualNetworkCollection GetVirtualNetworks() - { - return GetCachedClient(Client => new VirtualNetworkCollection(Client, Id)); - } - } -} diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d530956dd13c3..0000000000000 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,424 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ConnectedVMwarevSphere -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _resourcePoolClientDiagnostics; - private ResourcePoolsRestOperations _resourcePoolRestClient; - private ClientDiagnostics _vMwareClusterClustersClientDiagnostics; - private ClustersRestOperations _vMwareClusterClustersRestClient; - private ClientDiagnostics _vMwareHostHostsClientDiagnostics; - private HostsRestOperations _vMwareHostHostsRestClient; - private ClientDiagnostics _vMwareDatastoreDatastoresClientDiagnostics; - private DatastoresRestOperations _vMwareDatastoreDatastoresRestClient; - private ClientDiagnostics _vCenterClientDiagnostics; - private VCentersRestOperations _vCenterRestClient; - private ClientDiagnostics _virtualMachineClientDiagnostics; - private VirtualMachinesRestOperations _virtualMachineRestClient; - private ClientDiagnostics _virtualMachineTemplateClientDiagnostics; - private VirtualMachineTemplatesRestOperations _virtualMachineTemplateRestClient; - private ClientDiagnostics _virtualNetworkClientDiagnostics; - private VirtualNetworksRestOperations _virtualNetworkRestClient; - - /// 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 ResourcePoolClientDiagnostics => _resourcePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", ResourcePoolResource.ResourceType.Namespace, Diagnostics); - private ResourcePoolsRestOperations ResourcePoolRestClient => _resourcePoolRestClient ??= new ResourcePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ResourcePoolResource.ResourceType)); - private ClientDiagnostics VMwareClusterClustersClientDiagnostics => _vMwareClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VMwareClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations VMwareClusterClustersRestClient => _vMwareClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VMwareClusterResource.ResourceType)); - private ClientDiagnostics VMwareHostHostsClientDiagnostics => _vMwareHostHostsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VMwareHostResource.ResourceType.Namespace, Diagnostics); - private HostsRestOperations VMwareHostHostsRestClient => _vMwareHostHostsRestClient ??= new HostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VMwareHostResource.ResourceType)); - private ClientDiagnostics VMwareDatastoreDatastoresClientDiagnostics => _vMwareDatastoreDatastoresClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VMwareDatastoreResource.ResourceType.Namespace, Diagnostics); - private DatastoresRestOperations VMwareDatastoreDatastoresRestClient => _vMwareDatastoreDatastoresRestClient ??= new DatastoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VMwareDatastoreResource.ResourceType)); - private ClientDiagnostics VCenterClientDiagnostics => _vCenterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VCenterResource.ResourceType.Namespace, Diagnostics); - private VCentersRestOperations VCenterRestClient => _vCenterRestClient ??= new VCentersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VCenterResource.ResourceType)); - private ClientDiagnostics VirtualMachineClientDiagnostics => _virtualMachineClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VirtualMachineResource.ResourceType.Namespace, Diagnostics); - private VirtualMachinesRestOperations VirtualMachineRestClient => _virtualMachineRestClient ??= new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineResource.ResourceType)); - private ClientDiagnostics VirtualMachineTemplateClientDiagnostics => _virtualMachineTemplateClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VirtualMachineTemplateResource.ResourceType.Namespace, Diagnostics); - private VirtualMachineTemplatesRestOperations VirtualMachineTemplateRestClient => _virtualMachineTemplateRestClient ??= new VirtualMachineTemplatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualMachineTemplateResource.ResourceType)); - private ClientDiagnostics VirtualNetworkClientDiagnostics => _virtualNetworkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConnectedVMwarevSphere", VirtualNetworkResource.ResourceType.Namespace, Diagnostics); - private VirtualNetworksRestOperations VirtualNetworkRestClient => _virtualNetworkRestClient ??= new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualNetworkResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List of resourcePools in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools - /// - /// - /// Operation Id - /// ResourcePools_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetResourcePoolsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourcePoolRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourcePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), ResourcePoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourcePools", "value", "nextLink", cancellationToken); - } - - /// - /// List of resourcePools in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools - /// - /// - /// Operation Id - /// ResourcePools_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetResourcePools(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourcePoolRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourcePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourcePoolResource(Client, ResourcePoolData.DeserializeResourcePoolData(e)), ResourcePoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourcePools", "value", "nextLink", cancellationToken); - } - - /// - /// List of clusters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVMwareClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), VMwareClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareClusters", "value", "nextLink", cancellationToken); - } - - /// - /// List of clusters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVMwareClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareClusterResource(Client, VMwareClusterData.DeserializeVMwareClusterData(e)), VMwareClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareClusters", "value", "nextLink", cancellationToken); - } - - /// - /// List of hosts in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/hosts - /// - /// - /// Operation Id - /// Hosts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVMwareHostsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareHostHostsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareHostHostsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), VMwareHostHostsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareHosts", "value", "nextLink", cancellationToken); - } - - /// - /// List of hosts in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/hosts - /// - /// - /// Operation Id - /// Hosts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVMwareHosts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareHostHostsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareHostHostsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareHostResource(Client, VMwareHostData.DeserializeVMwareHostData(e)), VMwareHostHostsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareHosts", "value", "nextLink", cancellationToken); - } - - /// - /// List of datastores in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/datastores - /// - /// - /// Operation Id - /// Datastores_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVMwareDatastoresAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), VMwareDatastoreDatastoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareDatastores", "value", "nextLink", cancellationToken); - } - - /// - /// List of datastores in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/datastores - /// - /// - /// Operation Id - /// Datastores_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVMwareDatastores(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VMwareDatastoreDatastoresRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VMwareDatastoreDatastoresRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VMwareDatastoreResource(Client, VMwareDatastoreData.DeserializeVMwareDatastoreData(e)), VMwareDatastoreDatastoresClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVMwareDatastores", "value", "nextLink", cancellationToken); - } - - /// - /// List of vCenters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/vcenters - /// - /// - /// Operation Id - /// VCenters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVCentersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VCenterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VCenterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), VCenterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVCenters", "value", "nextLink", cancellationToken); - } - - /// - /// List of vCenters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/vcenters - /// - /// - /// Operation Id - /// VCenters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVCenters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VCenterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VCenterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VCenterResource(Client, VCenterData.DeserializeVCenterData(e)), VCenterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVCenters", "value", "nextLink", cancellationToken); - } - - /// - /// List of virtualMachines in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachinesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); - } - - /// - /// List of virtualMachines in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachines(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineResource(Client, VirtualMachineData.DeserializeVirtualMachineData(e)), VirtualMachineClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachines", "value", "nextLink", cancellationToken); - } - - /// - /// List of virtualMachineTemplates in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates - /// - /// - /// Operation Id - /// VirtualMachineTemplates_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachineTemplatesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineTemplateRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineTemplateRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), VirtualMachineTemplateClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineTemplates", "value", "nextLink", cancellationToken); - } - - /// - /// List of virtualMachineTemplates in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates - /// - /// - /// Operation Id - /// VirtualMachineTemplates_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachineTemplates(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineTemplateRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualMachineTemplateRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualMachineTemplateResource(Client, VirtualMachineTemplateData.DeserializeVirtualMachineTemplateData(e)), VirtualMachineTemplateClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualMachineTemplates", "value", "nextLink", cancellationToken); - } - - /// - /// List of virtualNetworks in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks - /// - /// - /// Operation Id - /// VirtualNetworks_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualNetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// List of virtualNetworks in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks - /// - /// - /// Operation Id - /// VirtualNetworks_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualNetworks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworks", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentResource.cs index c73efe00737ff..50c6452757328 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/GuestAgentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class GuestAgentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataResource.cs index 62d4e61d1ec1e..9ef3d12d538f9 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/HybridIdentityMetadataResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class HybridIdentityMetadataResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineName. + /// The metadataName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineName, string metadataName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemResource.cs index 2aecdf77bc1a9..c589c12330c50 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/InventoryItemResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class InventoryItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vcenterName. + /// The inventoryItemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vcenterName, string inventoryItemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}/inventoryItems/{inventoryItemName}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionResource.cs index 1081238612fde..9fd204ef43208 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/MachineExtensionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class MachineExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The extensionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string extensionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolResource.cs index 1c124915ec328..79cf27e84a955 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/ResourcePoolResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class ResourcePoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourcePoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourcePoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterResource.cs index 1fb819a4f4e2c..10168930a8ab1 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class VCenterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vcenterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vcenterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of InventoryItemResources and their operations over a InventoryItemResource. public virtual InventoryItemCollection GetInventoryItems() { - return GetCachedClient(Client => new InventoryItemCollection(Client, Id)); + return GetCachedClient(client => new InventoryItemCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual InventoryItemCollection GetInventoryItems() /// /// Name of the inventoryItem. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetInventoryItemAsync(string inventoryItemName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetInventoryItemAsync /// /// Name of the inventoryItem. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetInventoryItem(string inventoryItemName, CancellationToken cancellationToken = default) { diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterResource.cs index 26c2c3b964d54..40230cf2d186e 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class VMwareClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreResource.cs index aff231db695d2..cacd3856189a9 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareDatastoreResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class VMwareDatastoreResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The datastoreName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string datastoreName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostResource.cs index 25e8cd6b57357..65666b3319aee 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VMwareHostResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class VMwareHostResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/hosts/{hostName}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineResource.cs index a872fc6c67437..740e4265843bc 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class VirtualMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HybridIdentityMetadataResources and their operations over a HybridIdentityMetadataResource. public virtual HybridIdentityMetadataCollection GetAllHybridIdentityMetadata() { - return GetCachedClient(Client => new HybridIdentityMetadataCollection(Client, Id)); + return GetCachedClient(client => new HybridIdentityMetadataCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual HybridIdentityMetadataCollection GetAllHybridIdentityMetadata() /// /// Name of the HybridIdentityMetadata. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHybridIdentityMetadataAsync(string metadataName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetHybridIde /// /// Name of the HybridIdentityMetadata. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHybridIdentityMetadata(string metadataName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetHybridIdentityMetadat /// An object representing collection of MachineExtensionResources and their operations over a MachineExtensionResource. public virtual MachineExtensionCollection GetMachineExtensions() { - return GetCachedClient(Client => new MachineExtensionCollection(Client, Id)); + return GetCachedClient(client => new MachineExtensionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual MachineExtensionCollection GetMachineExtensions() /// /// The name of the machine extension. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineExtensionAsync(string extensionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetMachineExtensio /// /// The name of the machine extension. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineExtension(string extensionName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetMachineExtension(string ext /// An object representing collection of GuestAgentResources and their operations over a GuestAgentResource. public virtual GuestAgentCollection GetGuestAgents() { - return GetCachedClient(Client => new GuestAgentCollection(Client, Id)); + return GetCachedClient(client => new GuestAgentCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual GuestAgentCollection GetGuestAgents() /// /// Name of the GuestAgent. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGuestAgentAsync(string name, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetGuestAgentAsync(strin /// /// Name of the GuestAgent. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGuestAgent(string name, CancellationToken cancellationToken = default) { diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateResource.cs index 2f53904704beb..21c77660fe2e5 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineTemplateResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class VirtualMachineTemplateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineTemplateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineTemplateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName}"; diff --git a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkResource.cs index 2c4bb8466acf7..cb411bf83b0a1 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualNetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ConnectedVMwarevSphere public partial class VirtualNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/api/Azure.ResourceManager.Consumption.netstandard2.0.cs b/sdk/consumption/Azure.ResourceManager.Consumption/api/Azure.ResourceManager.Consumption.netstandard2.0.cs index fb685b55ca8a7..b6d928576e3e2 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/api/Azure.ResourceManager.Consumption.netstandard2.0.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/api/Azure.ResourceManager.Consumption.netstandard2.0.cs @@ -152,6 +152,57 @@ protected TenantBillingPeriodConsumptionResource() { } public virtual System.Threading.Tasks.Task> GetBalanceAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Consumption.Mocking +{ + public partial class MockableConsumptionArmClient : Azure.ResourceManager.ArmResource + { + protected MockableConsumptionArmClient() { } + public virtual Azure.ResourceManager.Consumption.BillingAccountConsumptionResource GetBillingAccountConsumptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Consumption.BillingCustomerConsumptionResource GetBillingCustomerConsumptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Consumption.BillingProfileConsumptionResource GetBillingProfileConsumptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetConsumptionBudget(Azure.Core.ResourceIdentifier scope, string budgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConsumptionBudgetAsync(Azure.Core.ResourceIdentifier scope, string budgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Consumption.ConsumptionBudgetResource GetConsumptionBudgetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Consumption.ConsumptionBudgetCollection GetConsumptionBudgets(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetConsumptionCharges(Azure.Core.ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string apply = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConsumptionChargesAsync(Azure.Core.ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string apply = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConsumptionMarketPlaces(Azure.Core.ResourceIdentifier scope, string filter = null, int? top = default(int?), string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConsumptionMarketPlacesAsync(Azure.Core.ResourceIdentifier scope, string filter = null, int? top = default(int?), string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetConsumptionReservationRecommendationDetails(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.Consumption.Models.ConsumptionReservationRecommendationScope reservationScope, string region, Azure.ResourceManager.Consumption.Models.ConsumptionReservationRecommendationTerm term, Azure.ResourceManager.Consumption.Models.ConsumptionReservationRecommendationLookBackPeriod lookBackPeriod, string product, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConsumptionReservationRecommendationDetailsAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.Consumption.Models.ConsumptionReservationRecommendationScope reservationScope, string region, Azure.ResourceManager.Consumption.Models.ConsumptionReservationRecommendationTerm term, Azure.ResourceManager.Consumption.Models.ConsumptionReservationRecommendationLookBackPeriod lookBackPeriod, string product, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConsumptionReservationRecommendations(Azure.Core.ResourceIdentifier scope, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConsumptionReservationRecommendationsAsync(Azure.Core.ResourceIdentifier scope, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConsumptionReservationsDetails(Azure.Core.ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string reservationId = null, string reservationOrderId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConsumptionReservationsDetailsAsync(Azure.Core.ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string reservationId = null, string reservationOrderId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConsumptionReservationsSummaries(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.Consumption.Models.ArmResourceGetConsumptionReservationsSummariesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConsumptionReservationsSummariesAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.Consumption.Models.ArmResourceGetConsumptionReservationsSummariesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetConsumptionTags(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConsumptionTagsAsync(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConsumptionUsageDetails(Azure.Core.ResourceIdentifier scope, string expand = null, string filter = null, string skipToken = null, int? top = default(int?), Azure.ResourceManager.Consumption.Models.ConsumptionMetricType? metric = default(Azure.ResourceManager.Consumption.Models.ConsumptionMetricType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConsumptionUsageDetailsAsync(Azure.Core.ResourceIdentifier scope, string expand = null, string filter = null, string skipToken = null, int? top = default(int?), Azure.ResourceManager.Consumption.Models.ConsumptionMetricType? metric = default(Azure.ResourceManager.Consumption.Models.ConsumptionMetricType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Consumption.ManagementGroupBillingPeriodConsumptionResource GetManagementGroupBillingPeriodConsumptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Consumption.ReservationConsumptionResource GetReservationConsumptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Consumption.ReservationOrderConsumptionResource GetReservationOrderConsumptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Consumption.SubscriptionBillingPeriodConsumptionResource GetSubscriptionBillingPeriodConsumptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Consumption.TenantBillingPeriodConsumptionResource GetTenantBillingPeriodConsumptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableConsumptionManagementGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableConsumptionManagementGroupResource() { } + public virtual Azure.Response GetAggregatedCost(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAggregatedCostAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableConsumptionSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableConsumptionSubscriptionResource() { } + public virtual Azure.Response GetPriceSheet(string expand = null, string skipToken = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPriceSheetAsync(string expand = null, string skipToken = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableConsumptionTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableConsumptionTenantResource() { } + } +} namespace Azure.ResourceManager.Consumption.Models { public static partial class ArmConsumptionModelFactory diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingAccountConsumptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingAccountConsumptionResource.cs index b6ddb7db8aa74..18264977ca131 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingAccountConsumptionResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingAccountConsumptionResource.cs @@ -25,6 +25,7 @@ namespace Azure.ResourceManager.Consumption public partial class BillingAccountConsumptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountId. internal static ResourceIdentifier CreateResourceIdentifier(string billingAccountId) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingCustomerConsumptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingCustomerConsumptionResource.cs index a304f43951aeb..bf6f280b62699 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingCustomerConsumptionResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingCustomerConsumptionResource.cs @@ -24,6 +24,8 @@ namespace Azure.ResourceManager.Consumption public partial class BillingCustomerConsumptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountId. + /// The customerId. internal static ResourceIdentifier CreateResourceIdentifier(string billingAccountId, string customerId) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingProfileConsumptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingProfileConsumptionResource.cs index d574b2dbc8d0d..4e41490519d24 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingProfileConsumptionResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/BillingProfileConsumptionResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Consumption public partial class BillingProfileConsumptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountId. + /// The billingProfileId. internal static ResourceIdentifier CreateResourceIdentifier(string billingAccountId, string billingProfileId) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetResource.cs index f1e1b583b54de..e5a776a229763 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ConsumptionBudgetResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Consumption public partial class ConsumptionBudgetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The budgetName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string budgetName) { var resourceId = $"{scope}/providers/Microsoft.Consumption/budgets/{budgetName}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 1c9784822ec25..0000000000000 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,512 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Consumption.Models; - -namespace Azure.ResourceManager.Consumption -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _usageDetailsClientDiagnostics; - private UsageDetailsRestOperations _usageDetailsRestClient; - private ClientDiagnostics _marketplacesClientDiagnostics; - private MarketplacesRestOperations _marketplacesRestClient; - private ClientDiagnostics _tagsClientDiagnostics; - private TagsRestOperations _tagsRestClient; - private ClientDiagnostics _chargesClientDiagnostics; - private ChargesRestOperations _chargesRestClient; - private ClientDiagnostics _reservationsSummariesClientDiagnostics; - private ReservationsSummariesRestOperations _reservationsSummariesRestClient; - private ClientDiagnostics _reservationsDetailsClientDiagnostics; - private ReservationsDetailsRestOperations _reservationsDetailsRestClient; - private ClientDiagnostics _reservationRecommendationsClientDiagnostics; - private ReservationRecommendationsRestOperations _reservationRecommendationsRestClient; - private ClientDiagnostics _reservationRecommendationDetailsClientDiagnostics; - private ReservationRecommendationDetailsRestOperations _reservationRecommendationDetailsRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics UsageDetailsClientDiagnostics => _usageDetailsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsageDetailsRestOperations UsageDetailsRestClient => _usageDetailsRestClient ??= new UsageDetailsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics MarketplacesClientDiagnostics => _marketplacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MarketplacesRestOperations MarketplacesRestClient => _marketplacesRestClient ??= new MarketplacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics TagsClientDiagnostics => _tagsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private TagsRestOperations TagsRestClient => _tagsRestClient ??= new TagsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ChargesClientDiagnostics => _chargesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ChargesRestOperations ChargesRestClient => _chargesRestClient ??= new ChargesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReservationsSummariesClientDiagnostics => _reservationsSummariesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReservationsSummariesRestOperations ReservationsSummariesRestClient => _reservationsSummariesRestClient ??= new ReservationsSummariesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReservationsDetailsClientDiagnostics => _reservationsDetailsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReservationsDetailsRestOperations ReservationsDetailsRestClient => _reservationsDetailsRestClient ??= new ReservationsDetailsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReservationRecommendationsClientDiagnostics => _reservationRecommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReservationRecommendationsRestOperations ReservationRecommendationsRestClient => _reservationRecommendationsRestClient ??= new ReservationRecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReservationRecommendationDetailsClientDiagnostics => _reservationRecommendationDetailsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReservationRecommendationDetailsRestOperations ReservationRecommendationDetailsRestClient => _reservationRecommendationDetailsRestClient ??= new ReservationRecommendationDetailsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ConsumptionBudgetResources in the ArmResource. - /// An object representing collection of ConsumptionBudgetResources and their operations over a ConsumptionBudgetResource. - public virtual ConsumptionBudgetCollection GetConsumptionBudgets() - { - return GetCachedClient(Client => new ConsumptionBudgetCollection(Client, Id)); - } - - /// - /// Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Consumption/usageDetails - /// - /// - /// Operation Id - /// UsageDetails_List - /// - /// - /// - /// May be used to expand the properties/additionalInfo or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. - /// May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N usageDetails. - /// Allows to select different type of cost/usage records. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConsumptionUsageDetailsAsync(string expand = null, string filter = null, string skipToken = null, int? top = null, ConsumptionMetricType? metric = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsageDetailsRestClient.CreateListRequest(Id, expand, filter, skipToken, top, metric); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageDetailsRestClient.CreateListNextPageRequest(nextLink, Id, expand, filter, skipToken, top, metric); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionUsageDetail.DeserializeConsumptionUsageDetail, UsageDetailsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionUsageDetails", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Consumption/usageDetails - /// - /// - /// Operation Id - /// UsageDetails_List - /// - /// - /// - /// May be used to expand the properties/additionalInfo or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. - /// May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N usageDetails. - /// Allows to select different type of cost/usage records. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConsumptionUsageDetails(string expand = null, string filter = null, string skipToken = null, int? top = null, ConsumptionMetricType? metric = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsageDetailsRestClient.CreateListRequest(Id, expand, filter, skipToken, top, metric); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageDetailsRestClient.CreateListNextPageRequest(nextLink, Id, expand, filter, skipToken, top, metric); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionUsageDetail.DeserializeConsumptionUsageDetail, UsageDetailsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionUsageDetails", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Consumption/marketplaces - /// - /// - /// Operation Id - /// Marketplaces_List - /// - /// - /// - /// May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// May be used to limit the number of results to the most recent N marketplaces. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConsumptionMarketPlacesAsync(string filter = null, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplacesRestClient.CreateListRequest(Id, filter, top, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplacesRestClient.CreateListNextPageRequest(nextLink, Id, filter, top, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionMarketplace.DeserializeConsumptionMarketplace, MarketplacesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionMarketPlaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Consumption/marketplaces - /// - /// - /// Operation Id - /// Marketplaces_List - /// - /// - /// - /// May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// May be used to limit the number of results to the most recent N marketplaces. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConsumptionMarketPlaces(string filter = null, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplacesRestClient.CreateListRequest(Id, filter, top, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplacesRestClient.CreateListNextPageRequest(nextLink, Id, filter, top, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionMarketplace.DeserializeConsumptionMarketplace, MarketplacesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionMarketPlaces", "value", "nextLink", cancellationToken); - } - - /// - /// Get all available tag keys for the defined scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Consumption/tags - /// - /// - /// Operation Id - /// Tags_Get - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetConsumptionTagsAsync(CancellationToken cancellationToken = default) - { - using var scope = TagsClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetConsumptionTags"); - scope.Start(); - try - { - var response = await TagsRestClient.GetAsync(Id, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get all available tag keys for the defined scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Consumption/tags - /// - /// - /// Operation Id - /// Tags_Get - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetConsumptionTags(CancellationToken cancellationToken = default) - { - using var scope = TagsClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetConsumptionTags"); - scope.Start(); - try - { - var response = TagsRestClient.Get(Id, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the charges based for the defined scope. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Consumption/charges - /// - /// - /// Operation Id - /// Charges_List - /// - /// - /// - /// Start date. - /// End date. - /// May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). - /// May be used to group charges for billingAccount scope by properties/billingProfileId, properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by properties/invoiceSectionId. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConsumptionChargesAsync(string startDate = null, string endDate = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChargesRestClient.CreateListRequest(Id, startDate, endDate, filter, apply); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ConsumptionChargeSummary.DeserializeConsumptionChargeSummary, ChargesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionCharges", "value", null, cancellationToken); - } - - /// - /// Lists the charges based for the defined scope. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Consumption/charges - /// - /// - /// Operation Id - /// Charges_List - /// - /// - /// - /// Start date. - /// End date. - /// May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). - /// May be used to group charges for billingAccount scope by properties/billingProfileId, properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by properties/invoiceSectionId. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConsumptionCharges(string startDate = null, string endDate = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChargesRestClient.CreateListRequest(Id, startDate, endDate, filter, apply); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ConsumptionChargeSummary.DeserializeConsumptionChargeSummary, ChargesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionCharges", "value", null, cancellationToken); - } - - /// - /// Lists the reservations summaries for the defined scope daily or monthly grain. - /// - /// - /// Request Path - /// /{resourceScope}/providers/Microsoft.Consumption/reservationSummaries - /// - /// - /// Operation Id - /// ReservationsSummaries_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConsumptionReservationsSummariesAsync(ArmResourceGetConsumptionReservationsSummariesOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationsSummariesRestClient.CreateListRequest(Id, options.Grain, options.StartDate, options.EndDate, options.Filter, options.ReservationId, options.ReservationOrderId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationsSummariesRestClient.CreateListNextPageRequest(nextLink, Id, options.Grain, options.StartDate, options.EndDate, options.Filter, options.ReservationId, options.ReservationOrderId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionReservationSummary.DeserializeConsumptionReservationSummary, ReservationsSummariesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionReservationsSummaries", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the reservations summaries for the defined scope daily or monthly grain. - /// - /// - /// Request Path - /// /{resourceScope}/providers/Microsoft.Consumption/reservationSummaries - /// - /// - /// Operation Id - /// ReservationsSummaries_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConsumptionReservationsSummaries(ArmResourceGetConsumptionReservationsSummariesOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationsSummariesRestClient.CreateListRequest(Id, options.Grain, options.StartDate, options.EndDate, options.Filter, options.ReservationId, options.ReservationOrderId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationsSummariesRestClient.CreateListNextPageRequest(nextLink, Id, options.Grain, options.StartDate, options.EndDate, options.Filter, options.ReservationId, options.ReservationOrderId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionReservationSummary.DeserializeConsumptionReservationSummary, ReservationsSummariesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionReservationsSummaries", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the reservations details for the defined scope and provided date range. Note: ARM has a payload size limit of 12MB, so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges. - /// - /// - /// Request Path - /// /{resourceScope}/providers/Microsoft.Consumption/reservationDetails - /// - /// - /// Operation Id - /// ReservationsDetails_List - /// - /// - /// - /// Start date. Only applicable when querying with billing profile. - /// End date. Only applicable when querying with billing profile. - /// Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'. Not applicable when querying with billing profile. - /// Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation. - /// Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConsumptionReservationsDetailsAsync(string startDate = null, string endDate = null, string filter = null, string reservationId = null, string reservationOrderId = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationsDetailsRestClient.CreateListRequest(Id, startDate, endDate, filter, reservationId, reservationOrderId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationsDetailsRestClient.CreateListNextPageRequest(nextLink, Id, startDate, endDate, filter, reservationId, reservationOrderId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionReservationDetail.DeserializeConsumptionReservationDetail, ReservationsDetailsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionReservationsDetails", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the reservations details for the defined scope and provided date range. Note: ARM has a payload size limit of 12MB, so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges. - /// - /// - /// Request Path - /// /{resourceScope}/providers/Microsoft.Consumption/reservationDetails - /// - /// - /// Operation Id - /// ReservationsDetails_List - /// - /// - /// - /// Start date. Only applicable when querying with billing profile. - /// End date. Only applicable when querying with billing profile. - /// Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'. Not applicable when querying with billing profile. - /// Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation. - /// Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConsumptionReservationsDetails(string startDate = null, string endDate = null, string filter = null, string reservationId = null, string reservationOrderId = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationsDetailsRestClient.CreateListRequest(Id, startDate, endDate, filter, reservationId, reservationOrderId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationsDetailsRestClient.CreateListNextPageRequest(nextLink, Id, startDate, endDate, filter, reservationId, reservationOrderId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionReservationDetail.DeserializeConsumptionReservationDetail, ReservationsDetailsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionReservationsDetails", "value", "nextLink", cancellationToken); - } - - /// - /// List of recommendations for purchasing reserved instances. - /// - /// - /// Request Path - /// /{resourceScope}/providers/Microsoft.Consumption/reservationRecommendations - /// - /// - /// Operation Id - /// ReservationRecommendations_List - /// - /// - /// - /// May be used to filter reservationRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConsumptionReservationRecommendationsAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationRecommendationsRestClient.CreateListRequest(Id, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationRecommendationsRestClient.CreateListNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionReservationRecommendation.DeserializeConsumptionReservationRecommendation, ReservationRecommendationsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionReservationRecommendations", "value", "nextLink", cancellationToken); - } - - /// - /// List of recommendations for purchasing reserved instances. - /// - /// - /// Request Path - /// /{resourceScope}/providers/Microsoft.Consumption/reservationRecommendations - /// - /// - /// Operation Id - /// ReservationRecommendations_List - /// - /// - /// - /// May be used to filter reservationRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConsumptionReservationRecommendations(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationRecommendationsRestClient.CreateListRequest(Id, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationRecommendationsRestClient.CreateListNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionReservationRecommendation.DeserializeConsumptionReservationRecommendation, ReservationRecommendationsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetConsumptionReservationRecommendations", "value", "nextLink", cancellationToken); - } - - /// - /// Details of a reservation recommendation for what-if analysis of reserved instances. - /// - /// - /// Request Path - /// /{resourceScope}/providers/Microsoft.Consumption/reservationRecommendationDetails - /// - /// - /// Operation Id - /// ReservationRecommendationDetails_Get - /// - /// - /// - /// Scope of the reservation. - /// Used to select the region the recommendation should be generated for. - /// Specify length of reservation recommendation term. - /// Filter the time period on which reservation recommendation results are based. - /// Filter the products for which reservation recommendation results are generated. Examples: Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). - /// The cancellation token to use. - public virtual async Task> GetConsumptionReservationRecommendationDetailsAsync(ConsumptionReservationRecommendationScope reservationScope, string region, ConsumptionReservationRecommendationTerm term, ConsumptionReservationRecommendationLookBackPeriod lookBackPeriod, string product, CancellationToken cancellationToken = default) - { - using var scope = ReservationRecommendationDetailsClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetConsumptionReservationRecommendationDetails"); - scope.Start(); - try - { - var response = await ReservationRecommendationDetailsRestClient.GetAsync(Id, reservationScope, region, term, lookBackPeriod, product, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Details of a reservation recommendation for what-if analysis of reserved instances. - /// - /// - /// Request Path - /// /{resourceScope}/providers/Microsoft.Consumption/reservationRecommendationDetails - /// - /// - /// Operation Id - /// ReservationRecommendationDetails_Get - /// - /// - /// - /// Scope of the reservation. - /// Used to select the region the recommendation should be generated for. - /// Specify length of reservation recommendation term. - /// Filter the time period on which reservation recommendation results are based. - /// Filter the products for which reservation recommendation results are generated. Examples: Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). - /// The cancellation token to use. - public virtual Response GetConsumptionReservationRecommendationDetails(ConsumptionReservationRecommendationScope reservationScope, string region, ConsumptionReservationRecommendationTerm term, ConsumptionReservationRecommendationLookBackPeriod lookBackPeriod, string product, CancellationToken cancellationToken = default) - { - using var scope = ReservationRecommendationDetailsClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetConsumptionReservationRecommendationDetails"); - scope.Start(); - try - { - var response = ReservationRecommendationDetailsRestClient.Get(Id, reservationScope, region, term, lookBackPeriod, product, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ConsumptionExtensions.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ConsumptionExtensions.cs index bcda22d401c45..41ecf06c33971 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ConsumptionExtensions.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ConsumptionExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Consumption.Mocking; using Azure.ResourceManager.Consumption.Models; using Azure.ResourceManager.ManagementGroups; using Azure.ResourceManager.Resources; @@ -20,247 +21,39 @@ namespace Azure.ResourceManager.Consumption /// A class to add extension methods to Azure.ResourceManager.Consumption. public static partial class ConsumptionExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableConsumptionArmClient GetMockableConsumptionArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableConsumptionArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableConsumptionManagementGroupResource GetMockableConsumptionManagementGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableConsumptionManagementGroupResource(client, resource.Id)); } - private static ManagementGroupResourceExtensionClient GetManagementGroupResourceExtensionClient(ArmResource resource) + private static MockableConsumptionSubscriptionResource GetMockableConsumptionSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ManagementGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableConsumptionSubscriptionResource(client, resource.Id)); } - private static ManagementGroupResourceExtensionClient GetManagementGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableConsumptionTenantResource GetMockableConsumptionTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ManagementGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableConsumptionTenantResource(client, resource.Id)); } - 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); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region ConsumptionBudgetResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ConsumptionBudgetResource GetConsumptionBudgetResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ConsumptionBudgetResource.ValidateResourceId(id); - return new ConsumptionBudgetResource(client, id); - } - ); - } - #endregion - - #region BillingAccountConsumptionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static BillingAccountConsumptionResource GetBillingAccountConsumptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - BillingAccountConsumptionResource.ValidateResourceId(id); - return new BillingAccountConsumptionResource(client, id); - } - ); - } - #endregion - - #region BillingProfileConsumptionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static BillingProfileConsumptionResource GetBillingProfileConsumptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - BillingProfileConsumptionResource.ValidateResourceId(id); - return new BillingProfileConsumptionResource(client, id); - } - ); - } - #endregion - - #region TenantBillingPeriodConsumptionResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static TenantBillingPeriodConsumptionResource GetTenantBillingPeriodConsumptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - TenantBillingPeriodConsumptionResource.ValidateResourceId(id); - return new TenantBillingPeriodConsumptionResource(client, id); - } - ); - } - #endregion - - #region SubscriptionBillingPeriodConsumptionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionBillingPeriodConsumptionResource GetSubscriptionBillingPeriodConsumptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - SubscriptionBillingPeriodConsumptionResource.ValidateResourceId(id); - return new SubscriptionBillingPeriodConsumptionResource(client, id); - } - ); - } - #endregion - - #region ManagementGroupBillingPeriodConsumptionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagementGroupBillingPeriodConsumptionResource GetManagementGroupBillingPeriodConsumptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagementGroupBillingPeriodConsumptionResource.ValidateResourceId(id); - return new ManagementGroupBillingPeriodConsumptionResource(client, id); - } - ); - } - #endregion - - #region BillingCustomerConsumptionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static BillingCustomerConsumptionResource GetBillingCustomerConsumptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - BillingCustomerConsumptionResource.ValidateResourceId(id); - return new BillingCustomerConsumptionResource(client, id); - } - ); - } - #endregion - - #region ReservationConsumptionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ReservationConsumptionResource GetReservationConsumptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ReservationConsumptionResource.ValidateResourceId(id); - return new ReservationConsumptionResource(client, id); - } - ); - } - #endregion - - #region ReservationOrderConsumptionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of ConsumptionBudgetResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ReservationOrderConsumptionResource GetReservationOrderConsumptionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ReservationOrderConsumptionResource.ValidateResourceId(id); - return new ReservationOrderConsumptionResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of ConsumptionBudgetResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of ConsumptionBudgetResources and their operations over a ConsumptionBudgetResource. public static ConsumptionBudgetCollection GetConsumptionBudgets(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionBudgets(); + return GetMockableConsumptionArmClient(client).GetConsumptionBudgets(scope); } /// @@ -275,17 +68,21 @@ public static ConsumptionBudgetCollection GetConsumptionBudgets(this ArmClient c /// Budgets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Budget Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetConsumptionBudgetAsync(this ArmClient client, ResourceIdentifier scope, string budgetName, CancellationToken cancellationToken = default) { - return await client.GetConsumptionBudgets(scope).GetAsync(budgetName, cancellationToken).ConfigureAwait(false); + return await GetMockableConsumptionArmClient(client).GetConsumptionBudgetAsync(scope, budgetName, cancellationToken).ConfigureAwait(false); } /// @@ -300,17 +97,21 @@ public static async Task> GetConsumptionBudg /// Budgets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Budget Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetConsumptionBudget(this ArmClient client, ResourceIdentifier scope, string budgetName, CancellationToken cancellationToken = default) { - return client.GetConsumptionBudgets(scope).Get(budgetName, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionBudget(scope, budgetName, cancellationToken); } /// @@ -325,6 +126,10 @@ public static Response GetConsumptionBudget(this ArmC /// UsageDetails_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -336,7 +141,7 @@ public static Response GetConsumptionBudget(this ArmC /// The cancellation token to use. public static AsyncPageable GetConsumptionUsageDetailsAsync(this ArmClient client, ResourceIdentifier scope, string expand = null, string filter = null, string skipToken = null, int? top = null, ConsumptionMetricType? metric = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionUsageDetailsAsync(expand, filter, skipToken, top, metric, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionUsageDetailsAsync(scope, expand, filter, skipToken, top, metric, cancellationToken); } /// @@ -351,6 +156,10 @@ public static AsyncPageable GetConsumptionUsageDetailsAs /// UsageDetails_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -362,7 +171,7 @@ public static AsyncPageable GetConsumptionUsageDetailsAs /// The cancellation token to use. public static Pageable GetConsumptionUsageDetails(this ArmClient client, ResourceIdentifier scope, string expand = null, string filter = null, string skipToken = null, int? top = null, ConsumptionMetricType? metric = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionUsageDetails(expand, filter, skipToken, top, metric, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionUsageDetails(scope, expand, filter, skipToken, top, metric, cancellationToken); } /// @@ -377,6 +186,10 @@ public static Pageable GetConsumptionUsageDetails(this A /// Marketplaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -386,7 +199,7 @@ public static Pageable GetConsumptionUsageDetails(this A /// The cancellation token to use. public static AsyncPageable GetConsumptionMarketPlacesAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionMarketPlacesAsync(filter, top, skipToken, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionMarketPlacesAsync(scope, filter, top, skipToken, cancellationToken); } /// @@ -401,6 +214,10 @@ public static AsyncPageable GetConsumptionMarketPlacesAs /// Marketplaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -410,7 +227,7 @@ public static AsyncPageable GetConsumptionMarketPlacesAs /// The cancellation token to use. public static Pageable GetConsumptionMarketPlaces(this ArmClient client, ResourceIdentifier scope, string filter = null, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionMarketPlaces(filter, top, skipToken, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionMarketPlaces(scope, filter, top, skipToken, cancellationToken); } /// @@ -425,13 +242,17 @@ public static Pageable GetConsumptionMarketPlaces(this A /// Tags_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The cancellation token to use. public static async Task> GetConsumptionTagsAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return await GetArmResourceExtensionClient(client, scope).GetConsumptionTagsAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableConsumptionArmClient(client).GetConsumptionTagsAsync(scope, cancellationToken).ConfigureAwait(false); } /// @@ -446,13 +267,17 @@ public static async Task> GetConsumptionTagsAsyn /// Tags_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The cancellation token to use. public static Response GetConsumptionTags(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionTags(cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionTags(scope, cancellationToken); } /// @@ -467,6 +292,10 @@ public static Response GetConsumptionTags(this ArmClient /// Charges_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -477,7 +306,7 @@ public static Response GetConsumptionTags(this ArmClient /// The cancellation token to use. public static AsyncPageable GetConsumptionChargesAsync(this ArmClient client, ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionChargesAsync(startDate, endDate, filter, apply, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionChargesAsync(scope, startDate, endDate, filter, apply, cancellationToken); } /// @@ -492,6 +321,10 @@ public static AsyncPageable GetConsumptionChargesAsync /// Charges_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -502,7 +335,7 @@ public static AsyncPageable GetConsumptionChargesAsync /// The cancellation token to use. public static Pageable GetConsumptionCharges(this ArmClient client, ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionCharges(startDate, endDate, filter, apply, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionCharges(scope, startDate, endDate, filter, apply, cancellationToken); } /// @@ -517,6 +350,10 @@ public static Pageable GetConsumptionCharges(this ArmC /// ReservationsSummaries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -525,9 +362,7 @@ public static Pageable GetConsumptionCharges(this ArmC /// is null. public static AsyncPageable GetConsumptionReservationsSummariesAsync(this ArmClient client, ResourceIdentifier scope, ArmResourceGetConsumptionReservationsSummariesOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetArmResourceExtensionClient(client, scope).GetConsumptionReservationsSummariesAsync(options, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionReservationsSummariesAsync(scope, options, cancellationToken); } /// @@ -542,6 +377,10 @@ public static AsyncPageable GetConsumptionReserva /// ReservationsSummaries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -550,9 +389,7 @@ public static AsyncPageable GetConsumptionReserva /// is null. public static Pageable GetConsumptionReservationsSummaries(this ArmClient client, ResourceIdentifier scope, ArmResourceGetConsumptionReservationsSummariesOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetArmResourceExtensionClient(client, scope).GetConsumptionReservationsSummaries(options, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionReservationsSummaries(scope, options, cancellationToken); } /// @@ -567,6 +404,10 @@ public static Pageable GetConsumptionReservations /// ReservationsDetails_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -578,7 +419,7 @@ public static Pageable GetConsumptionReservations /// The cancellation token to use. public static AsyncPageable GetConsumptionReservationsDetailsAsync(this ArmClient client, ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string reservationId = null, string reservationOrderId = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionReservationsDetailsAsync(startDate, endDate, filter, reservationId, reservationOrderId, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionReservationsDetailsAsync(scope, startDate, endDate, filter, reservationId, reservationOrderId, cancellationToken); } /// @@ -593,6 +434,10 @@ public static AsyncPageable GetConsumptionReservat /// ReservationsDetails_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -604,7 +449,7 @@ public static AsyncPageable GetConsumptionReservat /// The cancellation token to use. public static Pageable GetConsumptionReservationsDetails(this ArmClient client, ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string reservationId = null, string reservationOrderId = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionReservationsDetails(startDate, endDate, filter, reservationId, reservationOrderId, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionReservationsDetails(scope, startDate, endDate, filter, reservationId, reservationOrderId, cancellationToken); } /// @@ -619,6 +464,10 @@ public static Pageable GetConsumptionReservationsD /// ReservationRecommendations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -626,7 +475,7 @@ public static Pageable GetConsumptionReservationsD /// The cancellation token to use. public static AsyncPageable GetConsumptionReservationRecommendationsAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionReservationRecommendationsAsync(filter, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionReservationRecommendationsAsync(scope, filter, cancellationToken); } /// @@ -641,6 +490,10 @@ public static AsyncPageable GetConsumption /// ReservationRecommendations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -648,7 +501,7 @@ public static AsyncPageable GetConsumption /// The cancellation token to use. public static Pageable GetConsumptionReservationRecommendations(this ArmClient client, ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetConsumptionReservationRecommendations(filter, cancellationToken); + return GetMockableConsumptionArmClient(client).GetConsumptionReservationRecommendations(scope, filter, cancellationToken); } /// @@ -663,6 +516,10 @@ public static Pageable GetConsumptionReser /// ReservationRecommendationDetails_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -675,10 +532,7 @@ public static Pageable GetConsumptionReser /// or is null. public static async Task> GetConsumptionReservationRecommendationDetailsAsync(this ArmClient client, ResourceIdentifier scope, ConsumptionReservationRecommendationScope reservationScope, string region, ConsumptionReservationRecommendationTerm term, ConsumptionReservationRecommendationLookBackPeriod lookBackPeriod, string product, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(region, nameof(region)); - Argument.AssertNotNull(product, nameof(product)); - - return await GetArmResourceExtensionClient(client, scope).GetConsumptionReservationRecommendationDetailsAsync(reservationScope, region, term, lookBackPeriod, product, cancellationToken).ConfigureAwait(false); + return await GetMockableConsumptionArmClient(client).GetConsumptionReservationRecommendationDetailsAsync(scope, reservationScope, region, term, lookBackPeriod, product, cancellationToken).ConfigureAwait(false); } /// @@ -693,6 +547,10 @@ public static async Task> /// ReservationRecommendationDetails_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -705,10 +563,151 @@ public static async Task> /// or is null. public static Response GetConsumptionReservationRecommendationDetails(this ArmClient client, ResourceIdentifier scope, ConsumptionReservationRecommendationScope reservationScope, string region, ConsumptionReservationRecommendationTerm term, ConsumptionReservationRecommendationLookBackPeriod lookBackPeriod, string product, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(region, nameof(region)); - Argument.AssertNotNull(product, nameof(product)); + return GetMockableConsumptionArmClient(client).GetConsumptionReservationRecommendationDetails(scope, reservationScope, region, term, lookBackPeriod, product, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ConsumptionBudgetResource GetConsumptionBudgetResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetConsumptionBudgetResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static BillingAccountConsumptionResource GetBillingAccountConsumptionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetBillingAccountConsumptionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static BillingProfileConsumptionResource GetBillingProfileConsumptionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetBillingProfileConsumptionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static TenantBillingPeriodConsumptionResource GetTenantBillingPeriodConsumptionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetTenantBillingPeriodConsumptionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionBillingPeriodConsumptionResource GetSubscriptionBillingPeriodConsumptionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetSubscriptionBillingPeriodConsumptionResource(id); + } - return GetArmResourceExtensionClient(client, scope).GetConsumptionReservationRecommendationDetails(reservationScope, region, term, lookBackPeriod, product, cancellationToken); + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagementGroupBillingPeriodConsumptionResource GetManagementGroupBillingPeriodConsumptionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetManagementGroupBillingPeriodConsumptionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static BillingCustomerConsumptionResource GetBillingCustomerConsumptionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetBillingCustomerConsumptionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ReservationConsumptionResource GetReservationConsumptionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetReservationConsumptionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ReservationOrderConsumptionResource GetReservationOrderConsumptionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableConsumptionArmClient(client).GetReservationOrderConsumptionResource(id); } /// @@ -723,13 +722,17 @@ public static Response GetConsumpti /// AggregatedCost_GetByManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). /// The cancellation token to use. public static async Task> GetAggregatedCostAsync(this ManagementGroupResource managementGroupResource, string filter = null, CancellationToken cancellationToken = default) { - return await GetManagementGroupResourceExtensionClient(managementGroupResource).GetAggregatedCostAsync(filter, cancellationToken).ConfigureAwait(false); + return await GetMockableConsumptionManagementGroupResource(managementGroupResource).GetAggregatedCostAsync(filter, cancellationToken).ConfigureAwait(false); } /// @@ -744,13 +747,17 @@ public static async Task> GetAggregate /// AggregatedCost_GetByManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). /// The cancellation token to use. public static Response GetAggregatedCost(this ManagementGroupResource managementGroupResource, string filter = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetAggregatedCost(filter, cancellationToken); + return GetMockableConsumptionManagementGroupResource(managementGroupResource).GetAggregatedCost(filter, cancellationToken); } /// @@ -765,6 +772,10 @@ public static Response GetAggregatedCost(this M /// PriceSheet_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. @@ -773,7 +784,7 @@ public static Response GetAggregatedCost(this M /// The cancellation token to use. public static async Task> GetPriceSheetAsync(this SubscriptionResource subscriptionResource, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetPriceSheetAsync(expand, skipToken, top, cancellationToken).ConfigureAwait(false); + return await GetMockableConsumptionSubscriptionResource(subscriptionResource).GetPriceSheetAsync(expand, skipToken, top, cancellationToken).ConfigureAwait(false); } /// @@ -788,6 +799,10 @@ public static async Task> GetPriceSheetAsync(this Sub /// PriceSheet_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. @@ -796,7 +811,7 @@ public static async Task> GetPriceSheetAsync(this Sub /// The cancellation token to use. public static Response GetPriceSheet(this SubscriptionResource subscriptionResource, string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPriceSheet(expand, skipToken, top, cancellationToken); + return GetMockableConsumptionSubscriptionResource(subscriptionResource).GetPriceSheet(expand, skipToken, top, cancellationToken); } } } diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs deleted file mode 100644 index 4edc6c3a5dbc3..0000000000000 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs +++ /dev/null @@ -1,108 +0,0 @@ -// 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; -using Azure.ResourceManager.Consumption.Models; - -namespace Azure.ResourceManager.Consumption -{ - /// A class to add extension methods to ManagementGroupResource. - internal partial class ManagementGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _aggregatedCostClientDiagnostics; - private AggregatedCostRestOperations _aggregatedCostRestClient; - - /// Initializes a new instance of the class for mocking. - protected ManagementGroupResourceExtensionClient() - { - } - - /// 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 ManagementGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics AggregatedCostClientDiagnostics => _aggregatedCostClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AggregatedCostRestOperations AggregatedCostRestClient => _aggregatedCostRestClient ??= new AggregatedCostRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Provides the aggregate cost of a management group and all child management groups by current billing period. - /// - /// - /// Request Path - /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost - /// - /// - /// Operation Id - /// AggregatedCost_GetByManagementGroup - /// - /// - /// - /// May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). - /// The cancellation token to use. - public virtual async Task> GetAggregatedCostAsync(string filter = null, CancellationToken cancellationToken = default) - { - using var scope = AggregatedCostClientDiagnostics.CreateScope("ManagementGroupResourceExtensionClient.GetAggregatedCost"); - scope.Start(); - try - { - var response = await AggregatedCostRestClient.GetByManagementGroupAsync(Id.Name, filter, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Provides the aggregate cost of a management group and all child management groups by current billing period. - /// - /// - /// Request Path - /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost - /// - /// - /// Operation Id - /// AggregatedCost_GetByManagementGroup - /// - /// - /// - /// May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). - /// The cancellation token to use. - public virtual Response GetAggregatedCost(string filter = null, CancellationToken cancellationToken = default) - { - using var scope = AggregatedCostClientDiagnostics.CreateScope("ManagementGroupResourceExtensionClient.GetAggregatedCost"); - scope.Start(); - try - { - var response = AggregatedCostRestClient.GetByManagementGroup(Id.Name, filter, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionArmClient.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionArmClient.cs new file mode 100644 index 0000000000000..100744245390c --- /dev/null +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionArmClient.cs @@ -0,0 +1,703 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Consumption; +using Azure.ResourceManager.Consumption.Models; + +namespace Azure.ResourceManager.Consumption.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableConsumptionArmClient : ArmResource + { + private ClientDiagnostics _usageDetailsClientDiagnostics; + private UsageDetailsRestOperations _usageDetailsRestClient; + private ClientDiagnostics _marketplacesClientDiagnostics; + private MarketplacesRestOperations _marketplacesRestClient; + private ClientDiagnostics _tagsClientDiagnostics; + private TagsRestOperations _tagsRestClient; + private ClientDiagnostics _chargesClientDiagnostics; + private ChargesRestOperations _chargesRestClient; + private ClientDiagnostics _reservationsSummariesClientDiagnostics; + private ReservationsSummariesRestOperations _reservationsSummariesRestClient; + private ClientDiagnostics _reservationsDetailsClientDiagnostics; + private ReservationsDetailsRestOperations _reservationsDetailsRestClient; + private ClientDiagnostics _reservationRecommendationsClientDiagnostics; + private ReservationRecommendationsRestOperations _reservationRecommendationsRestClient; + private ClientDiagnostics _reservationRecommendationDetailsClientDiagnostics; + private ReservationRecommendationDetailsRestOperations _reservationRecommendationDetailsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableConsumptionArmClient() + { + } + + /// 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 MockableConsumptionArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableConsumptionArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics UsageDetailsClientDiagnostics => _usageDetailsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsageDetailsRestOperations UsageDetailsRestClient => _usageDetailsRestClient ??= new UsageDetailsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics MarketplacesClientDiagnostics => _marketplacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MarketplacesRestOperations MarketplacesRestClient => _marketplacesRestClient ??= new MarketplacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics TagsClientDiagnostics => _tagsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private TagsRestOperations TagsRestClient => _tagsRestClient ??= new TagsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ChargesClientDiagnostics => _chargesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ChargesRestOperations ChargesRestClient => _chargesRestClient ??= new ChargesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ReservationsSummariesClientDiagnostics => _reservationsSummariesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ReservationsSummariesRestOperations ReservationsSummariesRestClient => _reservationsSummariesRestClient ??= new ReservationsSummariesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ReservationsDetailsClientDiagnostics => _reservationsDetailsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ReservationsDetailsRestOperations ReservationsDetailsRestClient => _reservationsDetailsRestClient ??= new ReservationsDetailsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ReservationRecommendationsClientDiagnostics => _reservationRecommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ReservationRecommendationsRestOperations ReservationRecommendationsRestClient => _reservationRecommendationsRestClient ??= new ReservationRecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ReservationRecommendationDetailsClientDiagnostics => _reservationRecommendationDetailsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ReservationRecommendationDetailsRestOperations ReservationRecommendationDetailsRestClient => _reservationRecommendationDetailsRestClient ??= new ReservationRecommendationDetailsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ConsumptionBudgetResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of ConsumptionBudgetResources and their operations over a ConsumptionBudgetResource. + public virtual ConsumptionBudgetCollection GetConsumptionBudgets(ResourceIdentifier scope) + { + return new ConsumptionBudgetCollection(Client, scope); + } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Budget Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetConsumptionBudgetAsync(ResourceIdentifier scope, string budgetName, CancellationToken cancellationToken = default) + { + return await GetConsumptionBudgets(scope).GetAsync(budgetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Budget Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetConsumptionBudget(ResourceIdentifier scope, string budgetName, CancellationToken cancellationToken = default) + { + return GetConsumptionBudgets(scope).Get(budgetName, cancellationToken); + } + + /// + /// Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/usageDetails + /// + /// + /// Operation Id + /// UsageDetails_List + /// + /// + /// + /// The scope to use. + /// May be used to expand the properties/additionalInfo or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + /// May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// May be used to limit the number of results to the most recent N usageDetails. + /// Allows to select different type of cost/usage records. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConsumptionUsageDetailsAsync(ResourceIdentifier scope, string expand = null, string filter = null, string skipToken = null, int? top = null, ConsumptionMetricType? metric = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsageDetailsRestClient.CreateListRequest(scope, expand, filter, skipToken, top, metric); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageDetailsRestClient.CreateListNextPageRequest(nextLink, scope, expand, filter, skipToken, top, metric); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionUsageDetail.DeserializeConsumptionUsageDetail, UsageDetailsClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionUsageDetails", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/usageDetails + /// + /// + /// Operation Id + /// UsageDetails_List + /// + /// + /// + /// The scope to use. + /// May be used to expand the properties/additionalInfo or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + /// May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, properties/resourceId, properties/chargeType, properties/reservationId, properties/publisherType or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). PublisherType Filter accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// May be used to limit the number of results to the most recent N usageDetails. + /// Allows to select different type of cost/usage records. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConsumptionUsageDetails(ResourceIdentifier scope, string expand = null, string filter = null, string skipToken = null, int? top = null, ConsumptionMetricType? metric = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsageDetailsRestClient.CreateListRequest(scope, expand, filter, skipToken, top, metric); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageDetailsRestClient.CreateListNextPageRequest(nextLink, scope, expand, filter, skipToken, top, metric); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionUsageDetail.DeserializeConsumptionUsageDetail, UsageDetailsClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionUsageDetails", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/marketplaces + /// + /// + /// Operation Id + /// Marketplaces_List + /// + /// + /// + /// The scope to use. + /// May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// May be used to limit the number of results to the most recent N marketplaces. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConsumptionMarketPlacesAsync(ResourceIdentifier scope, string filter = null, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplacesRestClient.CreateListRequest(scope, filter, top, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplacesRestClient.CreateListNextPageRequest(nextLink, scope, filter, top, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionMarketplace.DeserializeConsumptionMarketplace, MarketplacesClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionMarketPlaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/marketplaces + /// + /// + /// Operation Id + /// Marketplaces_List + /// + /// + /// + /// The scope to use. + /// May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// May be used to limit the number of results to the most recent N marketplaces. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConsumptionMarketPlaces(ResourceIdentifier scope, string filter = null, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplacesRestClient.CreateListRequest(scope, filter, top, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplacesRestClient.CreateListNextPageRequest(nextLink, scope, filter, top, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionMarketplace.DeserializeConsumptionMarketplace, MarketplacesClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionMarketPlaces", "value", "nextLink", cancellationToken); + } + + /// + /// Get all available tag keys for the defined scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/tags + /// + /// + /// Operation Id + /// Tags_Get + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + public virtual async Task> GetConsumptionTagsAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + using var scope0 = TagsClientDiagnostics.CreateScope("MockableConsumptionArmClient.GetConsumptionTags"); + scope0.Start(); + try + { + var response = await TagsRestClient.GetAsync(scope, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Get all available tag keys for the defined scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/tags + /// + /// + /// Operation Id + /// Tags_Get + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + public virtual Response GetConsumptionTags(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + using var scope0 = TagsClientDiagnostics.CreateScope("MockableConsumptionArmClient.GetConsumptionTags"); + scope0.Start(); + try + { + var response = TagsRestClient.Get(scope, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists the charges based for the defined scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/charges + /// + /// + /// Operation Id + /// Charges_List + /// + /// + /// + /// The scope to use. + /// Start date. + /// End date. + /// May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + /// May be used to group charges for billingAccount scope by properties/billingProfileId, properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by properties/invoiceSectionId. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConsumptionChargesAsync(ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChargesRestClient.CreateListRequest(scope, startDate, endDate, filter, apply); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ConsumptionChargeSummary.DeserializeConsumptionChargeSummary, ChargesClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionCharges", "value", null, cancellationToken); + } + + /// + /// Lists the charges based for the defined scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Consumption/charges + /// + /// + /// Operation Id + /// Charges_List + /// + /// + /// + /// The scope to use. + /// Start date. + /// End date. + /// May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + /// May be used to group charges for billingAccount scope by properties/billingProfileId, properties/invoiceSectionId, properties/customerId (specific for Partner Led), or for billingProfile scope by properties/invoiceSectionId. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConsumptionCharges(ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string apply = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChargesRestClient.CreateListRequest(scope, startDate, endDate, filter, apply); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ConsumptionChargeSummary.DeserializeConsumptionChargeSummary, ChargesClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionCharges", "value", null, cancellationToken); + } + + /// + /// Lists the reservations summaries for the defined scope daily or monthly grain. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Consumption/reservationSummaries + /// + /// + /// Operation Id + /// ReservationsSummaries_List + /// + /// + /// + /// The scope to use. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConsumptionReservationsSummariesAsync(ResourceIdentifier scope, ArmResourceGetConsumptionReservationsSummariesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationsSummariesRestClient.CreateListRequest(scope, options.Grain, options.StartDate, options.EndDate, options.Filter, options.ReservationId, options.ReservationOrderId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationsSummariesRestClient.CreateListNextPageRequest(nextLink, scope, options.Grain, options.StartDate, options.EndDate, options.Filter, options.ReservationId, options.ReservationOrderId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionReservationSummary.DeserializeConsumptionReservationSummary, ReservationsSummariesClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionReservationsSummaries", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the reservations summaries for the defined scope daily or monthly grain. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Consumption/reservationSummaries + /// + /// + /// Operation Id + /// ReservationsSummaries_List + /// + /// + /// + /// The scope to use. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConsumptionReservationsSummaries(ResourceIdentifier scope, ArmResourceGetConsumptionReservationsSummariesOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationsSummariesRestClient.CreateListRequest(scope, options.Grain, options.StartDate, options.EndDate, options.Filter, options.ReservationId, options.ReservationOrderId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationsSummariesRestClient.CreateListNextPageRequest(nextLink, scope, options.Grain, options.StartDate, options.EndDate, options.Filter, options.ReservationId, options.ReservationOrderId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionReservationSummary.DeserializeConsumptionReservationSummary, ReservationsSummariesClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionReservationsSummaries", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the reservations details for the defined scope and provided date range. Note: ARM has a payload size limit of 12MB, so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Consumption/reservationDetails + /// + /// + /// Operation Id + /// ReservationsDetails_List + /// + /// + /// + /// The scope to use. + /// Start date. Only applicable when querying with billing profile. + /// End date. Only applicable when querying with billing profile. + /// Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + /// Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation. + /// Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConsumptionReservationsDetailsAsync(ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string reservationId = null, string reservationOrderId = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationsDetailsRestClient.CreateListRequest(scope, startDate, endDate, filter, reservationId, reservationOrderId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationsDetailsRestClient.CreateListNextPageRequest(nextLink, scope, startDate, endDate, filter, reservationId, reservationOrderId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionReservationDetail.DeserializeConsumptionReservationDetail, ReservationsDetailsClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionReservationsDetails", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the reservations details for the defined scope and provided date range. Note: ARM has a payload size limit of 12MB, so currently callers get 502 when the response size exceeds the ARM limit. In such cases, API call should be made with smaller date ranges. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Consumption/reservationDetails + /// + /// + /// Operation Id + /// ReservationsDetails_List + /// + /// + /// + /// The scope to use. + /// Start date. Only applicable when querying with billing profile. + /// End date. Only applicable when querying with billing profile. + /// Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'. Not applicable when querying with billing profile. + /// Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation. + /// Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConsumptionReservationsDetails(ResourceIdentifier scope, string startDate = null, string endDate = null, string filter = null, string reservationId = null, string reservationOrderId = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationsDetailsRestClient.CreateListRequest(scope, startDate, endDate, filter, reservationId, reservationOrderId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationsDetailsRestClient.CreateListNextPageRequest(nextLink, scope, startDate, endDate, filter, reservationId, reservationOrderId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionReservationDetail.DeserializeConsumptionReservationDetail, ReservationsDetailsClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionReservationsDetails", "value", "nextLink", cancellationToken); + } + + /// + /// List of recommendations for purchasing reserved instances. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Consumption/reservationRecommendations + /// + /// + /// Operation Id + /// ReservationRecommendations_List + /// + /// + /// + /// The scope to use. + /// May be used to filter reservationRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConsumptionReservationRecommendationsAsync(ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationRecommendationsRestClient.CreateListRequest(scope, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationRecommendationsRestClient.CreateListNextPageRequest(nextLink, scope, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConsumptionReservationRecommendation.DeserializeConsumptionReservationRecommendation, ReservationRecommendationsClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionReservationRecommendations", "value", "nextLink", cancellationToken); + } + + /// + /// List of recommendations for purchasing reserved instances. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Consumption/reservationRecommendations + /// + /// + /// Operation Id + /// ReservationRecommendations_List + /// + /// + /// + /// The scope to use. + /// May be used to filter reservationRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Single'; properties/resourceType with allowed values ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConsumptionReservationRecommendations(ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationRecommendationsRestClient.CreateListRequest(scope, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationRecommendationsRestClient.CreateListNextPageRequest(nextLink, scope, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConsumptionReservationRecommendation.DeserializeConsumptionReservationRecommendation, ReservationRecommendationsClientDiagnostics, Pipeline, "MockableConsumptionArmClient.GetConsumptionReservationRecommendations", "value", "nextLink", cancellationToken); + } + + /// + /// Details of a reservation recommendation for what-if analysis of reserved instances. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Consumption/reservationRecommendationDetails + /// + /// + /// Operation Id + /// ReservationRecommendationDetails_Get + /// + /// + /// + /// The scope to use. + /// Scope of the reservation. + /// Used to select the region the recommendation should be generated for. + /// Specify length of reservation recommendation term. + /// Filter the time period on which reservation recommendation results are based. + /// Filter the products for which reservation recommendation results are generated. Examples: Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + /// The cancellation token to use. + /// or is null. + public virtual async Task> GetConsumptionReservationRecommendationDetailsAsync(ResourceIdentifier scope, ConsumptionReservationRecommendationScope reservationScope, string region, ConsumptionReservationRecommendationTerm term, ConsumptionReservationRecommendationLookBackPeriod lookBackPeriod, string product, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(region, nameof(region)); + Argument.AssertNotNull(product, nameof(product)); + + using var scope0 = ReservationRecommendationDetailsClientDiagnostics.CreateScope("MockableConsumptionArmClient.GetConsumptionReservationRecommendationDetails"); + scope0.Start(); + try + { + var response = await ReservationRecommendationDetailsRestClient.GetAsync(scope, reservationScope, region, term, lookBackPeriod, product, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Details of a reservation recommendation for what-if analysis of reserved instances. + /// + /// + /// Request Path + /// /{resourceScope}/providers/Microsoft.Consumption/reservationRecommendationDetails + /// + /// + /// Operation Id + /// ReservationRecommendationDetails_Get + /// + /// + /// + /// The scope to use. + /// Scope of the reservation. + /// Used to select the region the recommendation should be generated for. + /// Specify length of reservation recommendation term. + /// Filter the time period on which reservation recommendation results are based. + /// Filter the products for which reservation recommendation results are generated. Examples: Standard_DS1_v2 (for VM), Premium_SSD_Managed_Disks_P30 (for Managed Disks). + /// The cancellation token to use. + /// or is null. + public virtual Response GetConsumptionReservationRecommendationDetails(ResourceIdentifier scope, ConsumptionReservationRecommendationScope reservationScope, string region, ConsumptionReservationRecommendationTerm term, ConsumptionReservationRecommendationLookBackPeriod lookBackPeriod, string product, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(region, nameof(region)); + Argument.AssertNotNull(product, nameof(product)); + + using var scope0 = ReservationRecommendationDetailsClientDiagnostics.CreateScope("MockableConsumptionArmClient.GetConsumptionReservationRecommendationDetails"); + scope0.Start(); + try + { + var response = ReservationRecommendationDetailsRestClient.Get(scope, reservationScope, region, term, lookBackPeriod, product, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConsumptionBudgetResource GetConsumptionBudgetResource(ResourceIdentifier id) + { + ConsumptionBudgetResource.ValidateResourceId(id); + return new ConsumptionBudgetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingAccountConsumptionResource GetBillingAccountConsumptionResource(ResourceIdentifier id) + { + BillingAccountConsumptionResource.ValidateResourceId(id); + return new BillingAccountConsumptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingProfileConsumptionResource GetBillingProfileConsumptionResource(ResourceIdentifier id) + { + BillingProfileConsumptionResource.ValidateResourceId(id); + return new BillingProfileConsumptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantBillingPeriodConsumptionResource GetTenantBillingPeriodConsumptionResource(ResourceIdentifier id) + { + TenantBillingPeriodConsumptionResource.ValidateResourceId(id); + return new TenantBillingPeriodConsumptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionBillingPeriodConsumptionResource GetSubscriptionBillingPeriodConsumptionResource(ResourceIdentifier id) + { + SubscriptionBillingPeriodConsumptionResource.ValidateResourceId(id); + return new SubscriptionBillingPeriodConsumptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagementGroupBillingPeriodConsumptionResource GetManagementGroupBillingPeriodConsumptionResource(ResourceIdentifier id) + { + ManagementGroupBillingPeriodConsumptionResource.ValidateResourceId(id); + return new ManagementGroupBillingPeriodConsumptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingCustomerConsumptionResource GetBillingCustomerConsumptionResource(ResourceIdentifier id) + { + BillingCustomerConsumptionResource.ValidateResourceId(id); + return new BillingCustomerConsumptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReservationConsumptionResource GetReservationConsumptionResource(ResourceIdentifier id) + { + ReservationConsumptionResource.ValidateResourceId(id); + return new ReservationConsumptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReservationOrderConsumptionResource GetReservationOrderConsumptionResource(ResourceIdentifier id) + { + ReservationOrderConsumptionResource.ValidateResourceId(id); + return new ReservationOrderConsumptionResource(Client, id); + } + } +} diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionManagementGroupResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionManagementGroupResource.cs new file mode 100644 index 0000000000000..563b94a8b3c15 --- /dev/null +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionManagementGroupResource.cs @@ -0,0 +1,109 @@ +// 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; +using Azure.ResourceManager.Consumption; +using Azure.ResourceManager.Consumption.Models; + +namespace Azure.ResourceManager.Consumption.Mocking +{ + /// A class to add extension methods to ManagementGroupResource. + public partial class MockableConsumptionManagementGroupResource : ArmResource + { + private ClientDiagnostics _aggregatedCostClientDiagnostics; + private AggregatedCostRestOperations _aggregatedCostRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableConsumptionManagementGroupResource() + { + } + + /// 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 MockableConsumptionManagementGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AggregatedCostClientDiagnostics => _aggregatedCostClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AggregatedCostRestOperations AggregatedCostRestClient => _aggregatedCostRestClient ??= new AggregatedCostRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Provides the aggregate cost of a management group and all child management groups by current billing period. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost + /// + /// + /// Operation Id + /// AggregatedCost_GetByManagementGroup + /// + /// + /// + /// May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + /// The cancellation token to use. + public virtual async Task> GetAggregatedCostAsync(string filter = null, CancellationToken cancellationToken = default) + { + using var scope = AggregatedCostClientDiagnostics.CreateScope("MockableConsumptionManagementGroupResource.GetAggregatedCost"); + scope.Start(); + try + { + var response = await AggregatedCostRestClient.GetByManagementGroupAsync(Id.Name, filter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Provides the aggregate cost of a management group and all child management groups by current billing period. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost + /// + /// + /// Operation Id + /// AggregatedCost_GetByManagementGroup + /// + /// + /// + /// May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + /// The cancellation token to use. + public virtual Response GetAggregatedCost(string filter = null, CancellationToken cancellationToken = default) + { + using var scope = AggregatedCostClientDiagnostics.CreateScope("MockableConsumptionManagementGroupResource.GetAggregatedCost"); + scope.Start(); + try + { + var response = AggregatedCostRestClient.GetByManagementGroup(Id.Name, filter, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionSubscriptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionSubscriptionResource.cs new file mode 100644 index 0000000000000..7f06e2d908fd4 --- /dev/null +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionSubscriptionResource.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Consumption; +using Azure.ResourceManager.Consumption.Models; + +namespace Azure.ResourceManager.Consumption.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableConsumptionSubscriptionResource : ArmResource + { + private ClientDiagnostics _priceSheetClientDiagnostics; + private PriceSheetRestOperations _priceSheetRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableConsumptionSubscriptionResource() + { + } + + /// 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 MockableConsumptionSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PriceSheetClientDiagnostics => _priceSheetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PriceSheetRestOperations PriceSheetRestClient => _priceSheetRestClient ??= new PriceSheetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default + /// + /// + /// Operation Id + /// PriceSheet_Get + /// + /// + /// + /// May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// May be used to limit the number of results to the top N results. + /// The cancellation token to use. + public virtual async Task> GetPriceSheetAsync(string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableConsumptionSubscriptionResource.GetPriceSheet"); + scope.Start(); + try + { + var response = await PriceSheetRestClient.GetAsync(Id.SubscriptionId, expand, skipToken, top, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default + /// + /// + /// Operation Id + /// PriceSheet_Get + /// + /// + /// + /// May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// May be used to limit the number of results to the top N results. + /// The cancellation token to use. + public virtual Response GetPriceSheet(string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) + { + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableConsumptionSubscriptionResource.GetPriceSheet"); + scope.Start(); + try + { + var response = PriceSheetRestClient.Get(Id.SubscriptionId, expand, skipToken, top, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionTenantResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionTenantResource.cs new file mode 100644 index 0000000000000..be5f28c68b060 --- /dev/null +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/MockableConsumptionTenantResource.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Consumption.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableConsumptionTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableConsumptionTenantResource() + { + } + + /// 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 MockableConsumptionTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + } +} diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 5a5d7630ac7e1..0000000000000 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,112 +0,0 @@ -// 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; -using Azure.ResourceManager.Consumption.Models; - -namespace Azure.ResourceManager.Consumption -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _priceSheetClientDiagnostics; - private PriceSheetRestOperations _priceSheetRestClient; - - /// 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 PriceSheetClientDiagnostics => _priceSheetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Consumption", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PriceSheetRestOperations PriceSheetRestClient => _priceSheetRestClient ??= new PriceSheetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default - /// - /// - /// Operation Id - /// PriceSheet_Get - /// - /// - /// - /// May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the top N results. - /// The cancellation token to use. - public virtual async Task> GetPriceSheetAsync(string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) - { - using var scope = PriceSheetClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetPriceSheet"); - scope.Start(); - try - { - var response = await PriceSheetRestClient.GetAsync(Id.SubscriptionId, expand, skipToken, top, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default - /// - /// - /// Operation Id - /// PriceSheet_Get - /// - /// - /// - /// May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the top N results. - /// The cancellation token to use. - public virtual Response GetPriceSheet(string expand = null, string skipToken = null, int? top = null, CancellationToken cancellationToken = default) - { - using var scope = PriceSheetClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetPriceSheet"); - scope.Start(); - try - { - var response = PriceSheetRestClient.Get(Id.SubscriptionId, expand, skipToken, top, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 6cad8c23f0abc..0000000000000 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Consumption -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - } -} diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ManagementGroupBillingPeriodConsumptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ManagementGroupBillingPeriodConsumptionResource.cs index 1bf01f05606b3..05d0ac0a7e300 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ManagementGroupBillingPeriodConsumptionResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ManagementGroupBillingPeriodConsumptionResource.cs @@ -24,6 +24,8 @@ namespace Azure.ResourceManager.Consumption public partial class ManagementGroupBillingPeriodConsumptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The billingPeriodName. internal static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string billingPeriodName) { var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ReservationConsumptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ReservationConsumptionResource.cs index 6cdeccb67297f..b919c2a8fca9f 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ReservationConsumptionResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ReservationConsumptionResource.cs @@ -24,6 +24,8 @@ namespace Azure.ResourceManager.Consumption public partial class ReservationConsumptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The reservationOrderId. + /// The reservationId. internal static ResourceIdentifier CreateResourceIdentifier(string reservationOrderId, string reservationId) { var resourceId = $"/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ReservationOrderConsumptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ReservationOrderConsumptionResource.cs index ae073306df5a0..99ebea750e717 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ReservationOrderConsumptionResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/ReservationOrderConsumptionResource.cs @@ -24,6 +24,7 @@ namespace Azure.ResourceManager.Consumption public partial class ReservationOrderConsumptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The reservationOrderId. internal static ResourceIdentifier CreateResourceIdentifier(string reservationOrderId) { var resourceId = $"/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/SubscriptionBillingPeriodConsumptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/SubscriptionBillingPeriodConsumptionResource.cs index f803738410f72..0922d95c32351 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/SubscriptionBillingPeriodConsumptionResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/SubscriptionBillingPeriodConsumptionResource.cs @@ -24,6 +24,8 @@ namespace Azure.ResourceManager.Consumption public partial class SubscriptionBillingPeriodConsumptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The billingPeriodName. internal static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string billingPeriodName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}"; diff --git a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/TenantBillingPeriodConsumptionResource.cs b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/TenantBillingPeriodConsumptionResource.cs index 0ecf0a4f3f384..8e3f9555df81a 100644 --- a/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/TenantBillingPeriodConsumptionResource.cs +++ b/sdk/consumption/Azure.ResourceManager.Consumption/src/Generated/TenantBillingPeriodConsumptionResource.cs @@ -24,6 +24,8 @@ namespace Azure.ResourceManager.Consumption public partial class TenantBillingPeriodConsumptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountId. + /// The billingPeriodName. internal static ResourceIdentifier CreateResourceIdentifier(string billingAccountId, string billingPeriodName) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/api/Azure.ResourceManager.AppContainers.netstandard2.0.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/api/Azure.ResourceManager.AppContainers.netstandard2.0.cs index bf5f80123f39e..569befb596b44 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/api/Azure.ResourceManager.AppContainers.netstandard2.0.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/api/Azure.ResourceManager.AppContainers.netstandard2.0.cs @@ -90,7 +90,7 @@ protected ContainerAppAuthConfigResource() { } } public partial class ContainerAppCertificateData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerAppCertificateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerAppCertificateData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.AppContainers.Models.ContainerAppCertificateProperties Properties { get { throw null; } set { } } } public partial class ContainerAppCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable @@ -199,7 +199,7 @@ protected ContainerAppConnectedEnvironmentDaprComponentResource() { } } public partial class ContainerAppConnectedEnvironmentData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerAppConnectedEnvironmentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerAppConnectedEnvironmentData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.AppContainers.Models.ContainerAppCustomDomainConfiguration CustomDomainConfiguration { get { throw null; } set { } } public string DaprAIConnectionString { get { throw null; } set { } } public string DefaultDomain { get { throw null; } } @@ -283,7 +283,7 @@ public ContainerAppDaprComponentData() { } } public partial class ContainerAppData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerAppData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerAppData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.AppContainers.Models.ContainerAppConfiguration Configuration { get { throw null; } set { } } public string CustomDomainVerificationId { get { throw null; } } public Azure.Core.ResourceIdentifier EnvironmentId { get { throw null; } set { } } @@ -389,7 +389,7 @@ protected ContainerAppJobCollection() { } } public partial class ContainerAppJobData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerAppJobData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerAppJobData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.AppContainers.Models.ContainerAppJobConfiguration Configuration { get { throw null; } set { } } public string EnvironmentId { get { throw null; } set { } } public string EventStreamEndpoint { get { throw null; } } @@ -482,7 +482,7 @@ protected ContainerAppManagedCertificateCollection() { } } public partial class ContainerAppManagedCertificateData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerAppManagedCertificateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerAppManagedCertificateData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.AppContainers.Models.ManagedCertificateProperties Properties { get { throw null; } set { } } } public partial class ContainerAppManagedCertificateResource : Azure.ResourceManager.ArmResource @@ -594,7 +594,7 @@ protected ContainerAppManagedEnvironmentDaprComponentResource() { } } public partial class ContainerAppManagedEnvironmentData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerAppManagedEnvironmentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerAppManagedEnvironmentData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.AppContainers.Models.ContainerAppLogsConfiguration AppLogsConfiguration { get { throw null; } set { } } public Azure.ResourceManager.AppContainers.Models.ContainerAppCustomDomainConfiguration CustomDomainConfiguration { get { throw null; } set { } } public string DaprAIConnectionString { get { throw null; } set { } } @@ -897,6 +897,66 @@ protected ContainerAppSourceControlResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.AppContainers.ContainerAppSourceControlData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.AppContainers.Mocking +{ + public partial class MockableAppContainersArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAppContainersArmClient() { } + public virtual Azure.ResourceManager.AppContainers.ContainerAppAuthConfigResource GetContainerAppAuthConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppConnectedEnvironmentCertificateResource GetContainerAppConnectedEnvironmentCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppConnectedEnvironmentDaprComponentResource GetContainerAppConnectedEnvironmentDaprComponentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppConnectedEnvironmentResource GetContainerAppConnectedEnvironmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppConnectedEnvironmentStorageResource GetContainerAppConnectedEnvironmentStorageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppDetectorPropertyResource GetContainerAppDetectorPropertyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppDetectorPropertyRevisionResource GetContainerAppDetectorPropertyRevisionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppDetectorResource GetContainerAppDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppJobExecutionResource GetContainerAppJobExecutionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppJobResource GetContainerAppJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppManagedCertificateResource GetContainerAppManagedCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppManagedEnvironmentCertificateResource GetContainerAppManagedEnvironmentCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppManagedEnvironmentDaprComponentResource GetContainerAppManagedEnvironmentDaprComponentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppManagedEnvironmentDetectorResource GetContainerAppManagedEnvironmentDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppManagedEnvironmentDetectorResourcePropertyResource GetContainerAppManagedEnvironmentDetectorResourcePropertyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppManagedEnvironmentResource GetContainerAppManagedEnvironmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppManagedEnvironmentStorageResource GetContainerAppManagedEnvironmentStorageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppReplicaResource GetContainerAppReplicaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppResource GetContainerAppResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppRevisionResource GetContainerAppRevisionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppSourceControlResource GetContainerAppSourceControlResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAppContainersResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAppContainersResourceGroupResource() { } + public virtual Azure.Response GetContainerApp(string containerAppName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerAppAsync(string containerAppName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetContainerAppConnectedEnvironment(string connectedEnvironmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerAppConnectedEnvironmentAsync(string connectedEnvironmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppConnectedEnvironmentCollection GetContainerAppConnectedEnvironments() { throw null; } + public virtual Azure.Response GetContainerAppJob(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerAppJobAsync(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppJobCollection GetContainerAppJobs() { throw null; } + public virtual Azure.Response GetContainerAppManagedEnvironment(string environmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerAppManagedEnvironmentAsync(string environmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppManagedEnvironmentCollection GetContainerAppManagedEnvironments() { throw null; } + public virtual Azure.ResourceManager.AppContainers.ContainerAppCollection GetContainerApps() { throw null; } + } + public partial class MockableAppContainersSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAppContainersSubscriptionResource() { } + public virtual Azure.Pageable GetAvailableWorkloadProfiles(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableWorkloadProfilesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBillingMeters(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBillingMetersAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetContainerAppConnectedEnvironments(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerAppConnectedEnvironmentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetContainerAppJobs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerAppJobsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetContainerAppManagedEnvironments(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerAppManagedEnvironmentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetContainerApps(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerAppsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.AppContainers.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -1043,7 +1103,7 @@ public ContainerAppAuthPlatform() { } } public partial class ContainerAppAuthToken : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerAppAuthToken(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerAppAuthToken(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? ExpireOn { get { throw null; } } public string Token { get { throw null; } } } @@ -1521,7 +1581,7 @@ public enum ContainerAppDnsVerificationTestResult } public partial class ContainerAppEnvironmentAuthToken : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerAppEnvironmentAuthToken(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerAppEnvironmentAuthToken(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? ExpireOn { get { throw null; } } public string Token { get { throw null; } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigResource.cs index 0a81ab00a5ef7..19c70abd3ea97 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppAuthConfigResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppAuthConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerAppName. + /// The authConfigName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerAppName, string authConfigName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateResource.cs index 3a9d178a1d12f..bb38b6490a387 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentCertificateResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppConnectedEnvironmentCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The connectedEnvironmentName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string connectedEnvironmentName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentResource.cs index 555bd989971ff..b70e99bde1b5a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentDaprComponentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppConnectedEnvironmentDaprComponentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The connectedEnvironmentName. + /// The componentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string connectedEnvironmentName, string componentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentResource.cs index f839095b13ad1..f168f4dcc4d4a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppConnectedEnvironmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The connectedEnvironmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string connectedEnvironmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ContainerAppConnectedEnvironmentCertificateResources and their operations over a ContainerAppConnectedEnvironmentCertificateResource. public virtual ContainerAppConnectedEnvironmentCertificateCollection GetContainerAppConnectedEnvironmentCertificates() { - return GetCachedClient(Client => new ContainerAppConnectedEnvironmentCertificateCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppConnectedEnvironmentCertificateCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual ContainerAppConnectedEnvironmentCertificateCollection GetContaine /// /// Name of the Certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppConnectedEnvironmentCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task /// Name of the Certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppConnectedEnvironmentCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -145,7 +148,7 @@ public virtual Response Get /// An object representing collection of ContainerAppConnectedEnvironmentDaprComponentResources and their operations over a ContainerAppConnectedEnvironmentDaprComponentResource. public virtual ContainerAppConnectedEnvironmentDaprComponentCollection GetContainerAppConnectedEnvironmentDaprComponents() { - return GetCachedClient(Client => new ContainerAppConnectedEnvironmentDaprComponentCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppConnectedEnvironmentDaprComponentCollection(client, Id)); } /// @@ -163,8 +166,8 @@ public virtual ContainerAppConnectedEnvironmentDaprComponentCollection GetContai /// /// Name of the Dapr Component. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppConnectedEnvironmentDaprComponentAsync(string componentName, CancellationToken cancellationToken = default) { @@ -186,8 +189,8 @@ public virtual async Task /// Name of the Dapr Component. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppConnectedEnvironmentDaprComponent(string componentName, CancellationToken cancellationToken = default) { @@ -198,7 +201,7 @@ public virtual Response G /// An object representing collection of ContainerAppConnectedEnvironmentStorageResources and their operations over a ContainerAppConnectedEnvironmentStorageResource. public virtual ContainerAppConnectedEnvironmentStorageCollection GetContainerAppConnectedEnvironmentStorages() { - return GetCachedClient(Client => new ContainerAppConnectedEnvironmentStorageCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppConnectedEnvironmentStorageCollection(client, Id)); } /// @@ -216,8 +219,8 @@ public virtual ContainerAppConnectedEnvironmentStorageCollection GetContainerApp /// /// Name of the storage. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppConnectedEnvironmentStorageAsync(string storageName, CancellationToken cancellationToken = default) { @@ -239,8 +242,8 @@ public virtual async Task /// Name of the storage. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppConnectedEnvironmentStorage(string storageName, CancellationToken cancellationToken = default) { diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageResource.cs index 27eab2f80d5cf..c608e61c9db1a 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentStorageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppConnectedEnvironmentStorageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The connectedEnvironmentName. + /// The storageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string connectedEnvironmentName, string storageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyResource.cs index 877dd5df51fa8..42afd1092ac8c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppDetectorPropertyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerAppName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerAppName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionResource.cs index 8fc1d3c90743a..a596695406e53 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorPropertyRevisionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppDetectorPropertyRevisionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerAppName. + /// The revisionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerAppName, string revisionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorResource.cs index feb95c3ca2d61..2eb06980a1567 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppDetectorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerAppName. + /// The detectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerAppName, string detectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionResource.cs index ed2c28069deaa..4c6993db5214c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobExecutionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppJobExecutionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jobName. + /// The jobExecutionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jobName, string jobExecutionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobResource.cs index 72b75d9170bcc..be07343cdb18b 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ContainerAppJobExecutionResources and their operations over a ContainerAppJobExecutionResource. public virtual ContainerAppJobExecutionCollection GetContainerAppJobExecutions() { - return GetCachedClient(Client => new ContainerAppJobExecutionCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppJobExecutionCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual ContainerAppJobExecutionCollection GetContainerAppJobExecutions() /// /// Job execution name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppJobExecutionAsync(string jobExecutionName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetContain /// /// Job execution name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppJobExecution(string jobExecutionName, CancellationToken cancellationToken = default) { diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateResource.cs index 246be44039982..047aa0e4aa678 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedCertificateResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppManagedCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The environmentName. + /// The managedCertificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string environmentName, string managedCertificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateResource.cs index 43b8f148557d2..b47a9326292b3 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentCertificateResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppManagedEnvironmentCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The environmentName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string environmentName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentResource.cs index efe450d7a4b19..ce531697885fb 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDaprComponentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppManagedEnvironmentDaprComponentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The environmentName. + /// The componentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string environmentName, string componentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorResource.cs index d233e28839208..f8d7c67242499 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppManagedEnvironmentDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The environmentName. + /// The detectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string environmentName, string detectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorResourcePropertyResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorResourcePropertyResource.cs index 4ab1bc5c57e5c..fbf93f6b150ed 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorResourcePropertyResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentDetectorResourcePropertyResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppManagedEnvironmentDetectorResourcePropertyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The environmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string environmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentResource.cs index 69508e54c3730..54b9d5d697f15 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppManagedEnvironmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The environmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string environmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ContainerAppManagedEnvironmentCertificateResources and their operations over a ContainerAppManagedEnvironmentCertificateResource. public virtual ContainerAppManagedEnvironmentCertificateCollection GetContainerAppManagedEnvironmentCertificates() { - return GetCachedClient(Client => new ContainerAppManagedEnvironmentCertificateCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppManagedEnvironmentCertificateCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual ContainerAppManagedEnvironmentCertificateCollection GetContainerA /// /// Name of the Certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppManagedEnvironmentCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task /// Name of the Certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppManagedEnvironmentCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetCo /// An object representing collection of ContainerAppManagedEnvironmentDaprComponentResources and their operations over a ContainerAppManagedEnvironmentDaprComponentResource. public virtual ContainerAppManagedEnvironmentDaprComponentCollection GetContainerAppManagedEnvironmentDaprComponents() { - return GetCachedClient(Client => new ContainerAppManagedEnvironmentDaprComponentCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppManagedEnvironmentDaprComponentCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual ContainerAppManagedEnvironmentDaprComponentCollection GetContaine /// /// Name of the Dapr Component. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppManagedEnvironmentDaprComponentAsync(string componentName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task /// Name of the Dapr Component. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppManagedEnvironmentDaprComponent(string componentName, CancellationToken cancellationToken = default) { @@ -204,7 +207,7 @@ public virtual Response Get /// An object representing collection of ContainerAppManagedEnvironmentDetectorResources and their operations over a ContainerAppManagedEnvironmentDetectorResource. public virtual ContainerAppManagedEnvironmentDetectorCollection GetContainerAppManagedEnvironmentDetectors() { - return GetCachedClient(Client => new ContainerAppManagedEnvironmentDetectorCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppManagedEnvironmentDetectorCollection(client, Id)); } /// @@ -222,8 +225,8 @@ public virtual ContainerAppManagedEnvironmentDetectorCollection GetContainerAppM /// /// Name of the Managed Environment detector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppManagedEnvironmentDetectorAsync(string detectorName, CancellationToken cancellationToken = default) { @@ -245,8 +248,8 @@ public virtual async Task /// Name of the Managed Environment detector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppManagedEnvironmentDetector(string detectorName, CancellationToken cancellationToken = default) { @@ -264,7 +267,7 @@ public virtual ContainerAppManagedEnvironmentDetectorResourcePropertyResource Ge /// An object representing collection of ContainerAppManagedCertificateResources and their operations over a ContainerAppManagedCertificateResource. public virtual ContainerAppManagedCertificateCollection GetContainerAppManagedCertificates() { - return GetCachedClient(Client => new ContainerAppManagedCertificateCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppManagedCertificateCollection(client, Id)); } /// @@ -282,8 +285,8 @@ public virtual ContainerAppManagedCertificateCollection GetContainerAppManagedCe /// /// Name of the Managed Certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppManagedCertificateAsync(string managedCertificateName, CancellationToken cancellationToken = default) { @@ -305,8 +308,8 @@ public virtual async Task> GetC /// /// Name of the Managed Certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppManagedCertificate(string managedCertificateName, CancellationToken cancellationToken = default) { @@ -317,7 +320,7 @@ public virtual Response GetContainerAppM /// An object representing collection of ContainerAppManagedEnvironmentStorageResources and their operations over a ContainerAppManagedEnvironmentStorageResource. public virtual ContainerAppManagedEnvironmentStorageCollection GetContainerAppManagedEnvironmentStorages() { - return GetCachedClient(Client => new ContainerAppManagedEnvironmentStorageCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppManagedEnvironmentStorageCollection(client, Id)); } /// @@ -335,8 +338,8 @@ public virtual ContainerAppManagedEnvironmentStorageCollection GetContainerAppMa /// /// Name of the storage. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppManagedEnvironmentStorageAsync(string storageName, CancellationToken cancellationToken = default) { @@ -358,8 +361,8 @@ public virtual async Task /// Name of the storage. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppManagedEnvironmentStorage(string storageName, CancellationToken cancellationToken = default) { diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageResource.cs index e64834f8f37f3..65b4ed3711e16 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentStorageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppManagedEnvironmentStorageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The environmentName. + /// The storageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string environmentName, string storageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaResource.cs index c8e027bf2e0f1..cbd3ce2cbcd06 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppReplicaResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppReplicaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerAppName. + /// The revisionName. + /// The replicaName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerAppName, string revisionName, string replicaName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppResource.cs index b26a11bf61b71..dc92a66c36ef4 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerAppName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerAppName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ContainerAppAuthConfigResources and their operations over a ContainerAppAuthConfigResource. public virtual ContainerAppAuthConfigCollection GetContainerAppAuthConfigs() { - return GetCachedClient(Client => new ContainerAppAuthConfigCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppAuthConfigCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual ContainerAppAuthConfigCollection GetContainerAppAuthConfigs() /// /// Name of the Container App AuthConfig. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppAuthConfigAsync(string authConfigName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetContainer /// /// Name of the Container App AuthConfig. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppAuthConfig(string authConfigName, CancellationToken cancellationToken = default) { @@ -154,7 +157,7 @@ public virtual ContainerAppDetectorPropertyResource GetContainerAppDetectorPrope /// An object representing collection of ContainerAppRevisionResources and their operations over a ContainerAppRevisionResource. public virtual ContainerAppRevisionCollection GetContainerAppRevisions() { - return GetCachedClient(Client => new ContainerAppRevisionCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppRevisionCollection(client, Id)); } /// @@ -172,8 +175,8 @@ public virtual ContainerAppRevisionCollection GetContainerAppRevisions() /// /// Name of the Container App Revision. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppRevisionAsync(string revisionName, CancellationToken cancellationToken = default) { @@ -195,8 +198,8 @@ public virtual async Task> GetContainerAp /// /// Name of the Container App Revision. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppRevision(string revisionName, CancellationToken cancellationToken = default) { @@ -207,7 +210,7 @@ public virtual Response GetContainerAppRevision(st /// An object representing collection of ContainerAppDetectorPropertyRevisionResources and their operations over a ContainerAppDetectorPropertyRevisionResource. public virtual ContainerAppDetectorPropertyRevisionCollection GetContainerAppDetectorPropertyRevisions() { - return GetCachedClient(Client => new ContainerAppDetectorPropertyRevisionCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppDetectorPropertyRevisionCollection(client, Id)); } /// @@ -225,8 +228,8 @@ public virtual ContainerAppDetectorPropertyRevisionCollection GetContainerAppDet /// /// Name of the Container App Revision. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppDetectorPropertyRevisionAsync(string revisionName, CancellationToken cancellationToken = default) { @@ -248,8 +251,8 @@ public virtual async Task /// /// Name of the Container App Revision. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppDetectorPropertyRevision(string revisionName, CancellationToken cancellationToken = default) { @@ -260,7 +263,7 @@ public virtual Response GetContain /// An object representing collection of ContainerAppDetectorResources and their operations over a ContainerAppDetectorResource. public virtual ContainerAppDetectorCollection GetContainerAppDetectors() { - return GetCachedClient(Client => new ContainerAppDetectorCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppDetectorCollection(client, Id)); } /// @@ -278,8 +281,8 @@ public virtual ContainerAppDetectorCollection GetContainerAppDetectors() /// /// Name of the Container App Detector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppDetectorAsync(string detectorName, CancellationToken cancellationToken = default) { @@ -301,8 +304,8 @@ public virtual async Task> GetContainerAp /// /// Name of the Container App Detector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppDetector(string detectorName, CancellationToken cancellationToken = default) { @@ -313,7 +316,7 @@ public virtual Response GetContainerAppDetector(st /// An object representing collection of ContainerAppSourceControlResources and their operations over a ContainerAppSourceControlResource. public virtual ContainerAppSourceControlCollection GetContainerAppSourceControls() { - return GetCachedClient(Client => new ContainerAppSourceControlCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppSourceControlCollection(client, Id)); } /// @@ -331,8 +334,8 @@ public virtual ContainerAppSourceControlCollection GetContainerAppSourceControls /// /// Name of the Container App SourceControl. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppSourceControlAsync(string sourceControlName, CancellationToken cancellationToken = default) { @@ -354,8 +357,8 @@ public virtual async Task> GetContai /// /// Name of the Container App SourceControl. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppSourceControl(string sourceControlName, CancellationToken cancellationToken = default) { diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionResource.cs index 315e5b9287fb9..8cdb43094b899 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppRevisionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerAppName. + /// The revisionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerAppName, string revisionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ContainerAppReplicaResources and their operations over a ContainerAppReplicaResource. public virtual ContainerAppReplicaCollection GetContainerAppReplicas() { - return GetCachedClient(Client => new ContainerAppReplicaCollection(Client, Id)); + return GetCachedClient(client => new ContainerAppReplicaCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual ContainerAppReplicaCollection GetContainerAppReplicas() /// /// Name of the Container App Revision Replica. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerAppReplicaAsync(string replicaName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetContainerApp /// /// Name of the Container App Revision Replica. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerAppReplica(string replicaName, CancellationToken cancellationToken = default) { diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlResource.cs index 29bb69a64fda4..9531113ad74a3 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppSourceControlResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppContainers public partial class ContainerAppSourceControlResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerAppName. + /// The sourceControlName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerAppName, string sourceControlName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}"; diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/AppContainersExtensions.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/AppContainersExtensions.cs index d13aae243be11..ea44671a45b58 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/AppContainersExtensions.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/AppContainersExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.AppContainers.Mocking; using Azure.ResourceManager.AppContainers.Models; using Azure.ResourceManager.Resources; @@ -19,442 +20,369 @@ namespace Azure.ResourceManager.AppContainers /// A class to add extension methods to Azure.ResourceManager.AppContainers. public static partial class AppContainersExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAppContainersArmClient GetMockableAppContainersArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAppContainersArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAppContainersResourceGroupResource GetMockableAppContainersResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAppContainersResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAppContainersSubscriptionResource GetMockableAppContainersSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAppContainersSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ContainerAppAuthConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppAuthConfigResource GetContainerAppAuthConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppAuthConfigResource.ValidateResourceId(id); - return new ContainerAppAuthConfigResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppAuthConfigResource(id); } - #endregion - #region ContainerAppConnectedEnvironmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppConnectedEnvironmentResource GetContainerAppConnectedEnvironmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppConnectedEnvironmentResource.ValidateResourceId(id); - return new ContainerAppConnectedEnvironmentResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppConnectedEnvironmentResource(id); } - #endregion - #region ContainerAppConnectedEnvironmentCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppConnectedEnvironmentCertificateResource GetContainerAppConnectedEnvironmentCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppConnectedEnvironmentCertificateResource.ValidateResourceId(id); - return new ContainerAppConnectedEnvironmentCertificateResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppConnectedEnvironmentCertificateResource(id); } - #endregion - #region ContainerAppManagedEnvironmentCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppManagedEnvironmentCertificateResource GetContainerAppManagedEnvironmentCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppManagedEnvironmentCertificateResource.ValidateResourceId(id); - return new ContainerAppManagedEnvironmentCertificateResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppManagedEnvironmentCertificateResource(id); } - #endregion - #region ContainerAppConnectedEnvironmentDaprComponentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppConnectedEnvironmentDaprComponentResource GetContainerAppConnectedEnvironmentDaprComponentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppConnectedEnvironmentDaprComponentResource.ValidateResourceId(id); - return new ContainerAppConnectedEnvironmentDaprComponentResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppConnectedEnvironmentDaprComponentResource(id); } - #endregion - #region ContainerAppManagedEnvironmentDaprComponentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppManagedEnvironmentDaprComponentResource GetContainerAppManagedEnvironmentDaprComponentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppManagedEnvironmentDaprComponentResource.ValidateResourceId(id); - return new ContainerAppManagedEnvironmentDaprComponentResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppManagedEnvironmentDaprComponentResource(id); } - #endregion - #region ContainerAppConnectedEnvironmentStorageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppConnectedEnvironmentStorageResource GetContainerAppConnectedEnvironmentStorageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppConnectedEnvironmentStorageResource.ValidateResourceId(id); - return new ContainerAppConnectedEnvironmentStorageResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppConnectedEnvironmentStorageResource(id); } - #endregion - #region ContainerAppResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppResource GetContainerAppResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppResource.ValidateResourceId(id); - return new ContainerAppResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppResource(id); } - #endregion - #region ContainerAppDetectorPropertyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppDetectorPropertyResource GetContainerAppDetectorPropertyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppDetectorPropertyResource.ValidateResourceId(id); - return new ContainerAppDetectorPropertyResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppDetectorPropertyResource(id); } - #endregion - #region ContainerAppRevisionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppRevisionResource GetContainerAppRevisionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppRevisionResource.ValidateResourceId(id); - return new ContainerAppRevisionResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppRevisionResource(id); } - #endregion - #region ContainerAppDetectorPropertyRevisionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppDetectorPropertyRevisionResource GetContainerAppDetectorPropertyRevisionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppDetectorPropertyRevisionResource.ValidateResourceId(id); - return new ContainerAppDetectorPropertyRevisionResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppDetectorPropertyRevisionResource(id); } - #endregion - #region ContainerAppReplicaResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppReplicaResource GetContainerAppReplicaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppReplicaResource.ValidateResourceId(id); - return new ContainerAppReplicaResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppReplicaResource(id); } - #endregion - #region ContainerAppDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppDetectorResource GetContainerAppDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppDetectorResource.ValidateResourceId(id); - return new ContainerAppDetectorResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppDetectorResource(id); } - #endregion - #region ContainerAppManagedEnvironmentDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppManagedEnvironmentDetectorResource GetContainerAppManagedEnvironmentDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppManagedEnvironmentDetectorResource.ValidateResourceId(id); - return new ContainerAppManagedEnvironmentDetectorResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppManagedEnvironmentDetectorResource(id); } - #endregion - #region ContainerAppManagedEnvironmentDetectorResourcePropertyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppManagedEnvironmentDetectorResourcePropertyResource GetContainerAppManagedEnvironmentDetectorResourcePropertyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppManagedEnvironmentDetectorResourcePropertyResource.ValidateResourceId(id); - return new ContainerAppManagedEnvironmentDetectorResourcePropertyResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppManagedEnvironmentDetectorResourcePropertyResource(id); } - #endregion - #region ContainerAppManagedEnvironmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppManagedEnvironmentResource GetContainerAppManagedEnvironmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppManagedEnvironmentResource.ValidateResourceId(id); - return new ContainerAppManagedEnvironmentResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppManagedEnvironmentResource(id); } - #endregion - #region ContainerAppJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppJobResource GetContainerAppJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppJobResource.ValidateResourceId(id); - return new ContainerAppJobResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppJobResource(id); } - #endregion - #region ContainerAppJobExecutionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppJobExecutionResource GetContainerAppJobExecutionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppJobExecutionResource.ValidateResourceId(id); - return new ContainerAppJobExecutionResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppJobExecutionResource(id); } - #endregion - #region ContainerAppManagedCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppManagedCertificateResource GetContainerAppManagedCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppManagedCertificateResource.ValidateResourceId(id); - return new ContainerAppManagedCertificateResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppManagedCertificateResource(id); } - #endregion - #region ContainerAppManagedEnvironmentStorageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppManagedEnvironmentStorageResource GetContainerAppManagedEnvironmentStorageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppManagedEnvironmentStorageResource.ValidateResourceId(id); - return new ContainerAppManagedEnvironmentStorageResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppManagedEnvironmentStorageResource(id); } - #endregion - #region ContainerAppSourceControlResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerAppSourceControlResource GetContainerAppSourceControlResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerAppSourceControlResource.ValidateResourceId(id); - return new ContainerAppSourceControlResource(client, id); - } - ); + return GetMockableAppContainersArmClient(client).GetContainerAppSourceControlResource(id); } - #endregion - /// Gets a collection of ContainerAppConnectedEnvironmentResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerAppConnectedEnvironmentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerAppConnectedEnvironmentResources and their operations over a ContainerAppConnectedEnvironmentResource. public static ContainerAppConnectedEnvironmentCollection GetContainerAppConnectedEnvironments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerAppConnectedEnvironments(); + return GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppConnectedEnvironments(); } /// @@ -469,16 +397,20 @@ public static ContainerAppConnectedEnvironmentCollection GetContainerAppConnecte /// ConnectedEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the connectedEnvironment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerAppConnectedEnvironmentAsync(this ResourceGroupResource resourceGroupResource, string connectedEnvironmentName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerAppConnectedEnvironments().GetAsync(connectedEnvironmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppConnectedEnvironmentAsync(connectedEnvironmentName, cancellationToken).ConfigureAwait(false); } /// @@ -493,24 +425,34 @@ public static async Task> Get /// ConnectedEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the connectedEnvironment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerAppConnectedEnvironment(this ResourceGroupResource resourceGroupResource, string connectedEnvironmentName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerAppConnectedEnvironments().Get(connectedEnvironmentName, cancellationToken); + return GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppConnectedEnvironment(connectedEnvironmentName, cancellationToken); } - /// Gets a collection of ContainerAppResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerAppResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerAppResources and their operations over a ContainerAppResource. public static ContainerAppCollection GetContainerApps(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerApps(); + return GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerApps(); } /// @@ -525,16 +467,20 @@ public static ContainerAppCollection GetContainerApps(this ResourceGroupResource /// ContainerApps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Container App. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerAppAsync(this ResourceGroupResource resourceGroupResource, string containerAppName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerApps().GetAsync(containerAppName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppAsync(containerAppName, cancellationToken).ConfigureAwait(false); } /// @@ -549,24 +495,34 @@ public static async Task> GetContainerAppAsync(th /// ContainerApps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Container App. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerApp(this ResourceGroupResource resourceGroupResource, string containerAppName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerApps().Get(containerAppName, cancellationToken); + return GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerApp(containerAppName, cancellationToken); } - /// Gets a collection of ContainerAppManagedEnvironmentResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerAppManagedEnvironmentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerAppManagedEnvironmentResources and their operations over a ContainerAppManagedEnvironmentResource. public static ContainerAppManagedEnvironmentCollection GetContainerAppManagedEnvironments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerAppManagedEnvironments(); + return GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppManagedEnvironments(); } /// @@ -581,16 +537,20 @@ public static ContainerAppManagedEnvironmentCollection GetContainerAppManagedEnv /// ManagedEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Environment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerAppManagedEnvironmentAsync(this ResourceGroupResource resourceGroupResource, string environmentName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerAppManagedEnvironments().GetAsync(environmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppManagedEnvironmentAsync(environmentName, cancellationToken).ConfigureAwait(false); } /// @@ -605,24 +565,34 @@ public static async Task> GetCo /// ManagedEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Environment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerAppManagedEnvironment(this ResourceGroupResource resourceGroupResource, string environmentName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerAppManagedEnvironments().Get(environmentName, cancellationToken); + return GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppManagedEnvironment(environmentName, cancellationToken); } - /// Gets a collection of ContainerAppJobResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerAppJobResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerAppJobResources and their operations over a ContainerAppJobResource. public static ContainerAppJobCollection GetContainerAppJobs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerAppJobs(); + return GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppJobs(); } /// @@ -637,16 +607,20 @@ public static ContainerAppJobCollection GetContainerAppJobs(this ResourceGroupRe /// Jobs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Job Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerAppJobAsync(this ResourceGroupResource resourceGroupResource, string jobName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerAppJobs().GetAsync(jobName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppJobAsync(jobName, cancellationToken).ConfigureAwait(false); } /// @@ -661,16 +635,20 @@ public static async Task> GetContainerAppJobAs /// Jobs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Job Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerAppJob(this ResourceGroupResource resourceGroupResource, string jobName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerAppJobs().Get(jobName, cancellationToken); + return GetMockableAppContainersResourceGroupResource(resourceGroupResource).GetContainerAppJob(jobName, cancellationToken); } /// @@ -685,6 +663,10 @@ public static Response GetContainerAppJob(this Resource /// AvailableWorkloadProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -692,7 +674,7 @@ public static Response GetContainerAppJob(this Resource /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableWorkloadProfilesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableWorkloadProfilesAsync(location, cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetAvailableWorkloadProfilesAsync(location, cancellationToken); } /// @@ -707,6 +689,10 @@ public static AsyncPageable GetAvailableWo /// AvailableWorkloadProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -714,7 +700,7 @@ public static AsyncPageable GetAvailableWo /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableWorkloadProfiles(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableWorkloadProfiles(location, cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetAvailableWorkloadProfiles(location, cancellationToken); } /// @@ -729,6 +715,10 @@ public static Pageable GetAvailableWorkloa /// BillingMeters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -736,7 +726,7 @@ public static Pageable GetAvailableWorkloa /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBillingMetersAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBillingMetersAsync(location, cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetBillingMetersAsync(location, cancellationToken); } /// @@ -751,6 +741,10 @@ public static AsyncPageable GetBillingMetersAsync(this /// BillingMeters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -758,7 +752,7 @@ public static AsyncPageable GetBillingMetersAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBillingMeters(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBillingMeters(location, cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetBillingMeters(location, cancellationToken); } /// @@ -773,13 +767,17 @@ public static Pageable GetBillingMeters(this Subscript /// ConnectedEnvironments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerAppConnectedEnvironmentsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerAppConnectedEnvironmentsAsync(cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetContainerAppConnectedEnvironmentsAsync(cancellationToken); } /// @@ -794,13 +792,17 @@ public static AsyncPageable GetContain /// ConnectedEnvironments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerAppConnectedEnvironments(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerAppConnectedEnvironments(cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetContainerAppConnectedEnvironments(cancellationToken); } /// @@ -815,13 +817,17 @@ public static Pageable GetContainerApp /// ContainerApps_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerAppsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerAppsAsync(cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetContainerAppsAsync(cancellationToken); } /// @@ -836,13 +842,17 @@ public static AsyncPageable GetContainerAppsAsync(this Sub /// ContainerApps_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerApps(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerApps(cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetContainerApps(cancellationToken); } /// @@ -857,13 +867,17 @@ public static Pageable GetContainerApps(this SubscriptionR /// Jobs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerAppJobsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerAppJobsAsync(cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetContainerAppJobsAsync(cancellationToken); } /// @@ -878,13 +892,17 @@ public static AsyncPageable GetContainerAppJobsAsync(th /// Jobs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerAppJobs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerAppJobs(cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetContainerAppJobs(cancellationToken); } /// @@ -899,13 +917,17 @@ public static Pageable GetContainerAppJobs(this Subscri /// ManagedEnvironments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerAppManagedEnvironmentsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerAppManagedEnvironmentsAsync(cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetContainerAppManagedEnvironmentsAsync(cancellationToken); } /// @@ -920,13 +942,17 @@ public static AsyncPageable GetContainer /// ManagedEnvironments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerAppManagedEnvironments(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerAppManagedEnvironments(cancellationToken); + return GetMockableAppContainersSubscriptionResource(subscriptionResource).GetContainerAppManagedEnvironments(cancellationToken); } } } diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersArmClient.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersArmClient.cs new file mode 100644 index 0000000000000..dde637225ad71 --- /dev/null +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersArmClient.cs @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.AppContainers; + +namespace Azure.ResourceManager.AppContainers.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAppContainersArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppContainersArmClient() + { + } + + /// 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 MockableAppContainersArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAppContainersArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppAuthConfigResource GetContainerAppAuthConfigResource(ResourceIdentifier id) + { + ContainerAppAuthConfigResource.ValidateResourceId(id); + return new ContainerAppAuthConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppConnectedEnvironmentResource GetContainerAppConnectedEnvironmentResource(ResourceIdentifier id) + { + ContainerAppConnectedEnvironmentResource.ValidateResourceId(id); + return new ContainerAppConnectedEnvironmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppConnectedEnvironmentCertificateResource GetContainerAppConnectedEnvironmentCertificateResource(ResourceIdentifier id) + { + ContainerAppConnectedEnvironmentCertificateResource.ValidateResourceId(id); + return new ContainerAppConnectedEnvironmentCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppManagedEnvironmentCertificateResource GetContainerAppManagedEnvironmentCertificateResource(ResourceIdentifier id) + { + ContainerAppManagedEnvironmentCertificateResource.ValidateResourceId(id); + return new ContainerAppManagedEnvironmentCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppConnectedEnvironmentDaprComponentResource GetContainerAppConnectedEnvironmentDaprComponentResource(ResourceIdentifier id) + { + ContainerAppConnectedEnvironmentDaprComponentResource.ValidateResourceId(id); + return new ContainerAppConnectedEnvironmentDaprComponentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppManagedEnvironmentDaprComponentResource GetContainerAppManagedEnvironmentDaprComponentResource(ResourceIdentifier id) + { + ContainerAppManagedEnvironmentDaprComponentResource.ValidateResourceId(id); + return new ContainerAppManagedEnvironmentDaprComponentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppConnectedEnvironmentStorageResource GetContainerAppConnectedEnvironmentStorageResource(ResourceIdentifier id) + { + ContainerAppConnectedEnvironmentStorageResource.ValidateResourceId(id); + return new ContainerAppConnectedEnvironmentStorageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppResource GetContainerAppResource(ResourceIdentifier id) + { + ContainerAppResource.ValidateResourceId(id); + return new ContainerAppResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppDetectorPropertyResource GetContainerAppDetectorPropertyResource(ResourceIdentifier id) + { + ContainerAppDetectorPropertyResource.ValidateResourceId(id); + return new ContainerAppDetectorPropertyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppRevisionResource GetContainerAppRevisionResource(ResourceIdentifier id) + { + ContainerAppRevisionResource.ValidateResourceId(id); + return new ContainerAppRevisionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppDetectorPropertyRevisionResource GetContainerAppDetectorPropertyRevisionResource(ResourceIdentifier id) + { + ContainerAppDetectorPropertyRevisionResource.ValidateResourceId(id); + return new ContainerAppDetectorPropertyRevisionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppReplicaResource GetContainerAppReplicaResource(ResourceIdentifier id) + { + ContainerAppReplicaResource.ValidateResourceId(id); + return new ContainerAppReplicaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppDetectorResource GetContainerAppDetectorResource(ResourceIdentifier id) + { + ContainerAppDetectorResource.ValidateResourceId(id); + return new ContainerAppDetectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppManagedEnvironmentDetectorResource GetContainerAppManagedEnvironmentDetectorResource(ResourceIdentifier id) + { + ContainerAppManagedEnvironmentDetectorResource.ValidateResourceId(id); + return new ContainerAppManagedEnvironmentDetectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppManagedEnvironmentDetectorResourcePropertyResource GetContainerAppManagedEnvironmentDetectorResourcePropertyResource(ResourceIdentifier id) + { + ContainerAppManagedEnvironmentDetectorResourcePropertyResource.ValidateResourceId(id); + return new ContainerAppManagedEnvironmentDetectorResourcePropertyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppManagedEnvironmentResource GetContainerAppManagedEnvironmentResource(ResourceIdentifier id) + { + ContainerAppManagedEnvironmentResource.ValidateResourceId(id); + return new ContainerAppManagedEnvironmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppJobResource GetContainerAppJobResource(ResourceIdentifier id) + { + ContainerAppJobResource.ValidateResourceId(id); + return new ContainerAppJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppJobExecutionResource GetContainerAppJobExecutionResource(ResourceIdentifier id) + { + ContainerAppJobExecutionResource.ValidateResourceId(id); + return new ContainerAppJobExecutionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppManagedCertificateResource GetContainerAppManagedCertificateResource(ResourceIdentifier id) + { + ContainerAppManagedCertificateResource.ValidateResourceId(id); + return new ContainerAppManagedCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppManagedEnvironmentStorageResource GetContainerAppManagedEnvironmentStorageResource(ResourceIdentifier id) + { + ContainerAppManagedEnvironmentStorageResource.ValidateResourceId(id); + return new ContainerAppManagedEnvironmentStorageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppSourceControlResource GetContainerAppSourceControlResource(ResourceIdentifier id) + { + ContainerAppSourceControlResource.ValidateResourceId(id); + return new ContainerAppSourceControlResource(Client, id); + } + } +} diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersResourceGroupResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersResourceGroupResource.cs new file mode 100644 index 0000000000000..070e4ff7f75d6 --- /dev/null +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersResourceGroupResource.cs @@ -0,0 +1,251 @@ +// 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.AppContainers; + +namespace Azure.ResourceManager.AppContainers.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAppContainersResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppContainersResourceGroupResource() + { + } + + /// 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 MockableAppContainersResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ContainerAppConnectedEnvironmentResources in the ResourceGroupResource. + /// An object representing collection of ContainerAppConnectedEnvironmentResources and their operations over a ContainerAppConnectedEnvironmentResource. + public virtual ContainerAppConnectedEnvironmentCollection GetContainerAppConnectedEnvironments() + { + return GetCachedClient(client => new ContainerAppConnectedEnvironmentCollection(client, Id)); + } + + /// + /// Get the properties of an connectedEnvironment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName} + /// + /// + /// Operation Id + /// ConnectedEnvironments_Get + /// + /// + /// + /// Name of the connectedEnvironment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerAppConnectedEnvironmentAsync(string connectedEnvironmentName, CancellationToken cancellationToken = default) + { + return await GetContainerAppConnectedEnvironments().GetAsync(connectedEnvironmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of an connectedEnvironment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName} + /// + /// + /// Operation Id + /// ConnectedEnvironments_Get + /// + /// + /// + /// Name of the connectedEnvironment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerAppConnectedEnvironment(string connectedEnvironmentName, CancellationToken cancellationToken = default) + { + return GetContainerAppConnectedEnvironments().Get(connectedEnvironmentName, cancellationToken); + } + + /// Gets a collection of ContainerAppResources in the ResourceGroupResource. + /// An object representing collection of ContainerAppResources and their operations over a ContainerAppResource. + public virtual ContainerAppCollection GetContainerApps() + { + return GetCachedClient(client => new ContainerAppCollection(client, Id)); + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerAppAsync(string containerAppName, CancellationToken cancellationToken = default) + { + return await GetContainerApps().GetAsync(containerAppName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerApp(string containerAppName, CancellationToken cancellationToken = default) + { + return GetContainerApps().Get(containerAppName, cancellationToken); + } + + /// Gets a collection of ContainerAppManagedEnvironmentResources in the ResourceGroupResource. + /// An object representing collection of ContainerAppManagedEnvironmentResources and their operations over a ContainerAppManagedEnvironmentResource. + public virtual ContainerAppManagedEnvironmentCollection GetContainerAppManagedEnvironments() + { + return GetCachedClient(client => new ContainerAppManagedEnvironmentCollection(client, Id)); + } + + /// + /// Get the properties of a Managed Environment used to host container apps. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName} + /// + /// + /// Operation Id + /// ManagedEnvironments_Get + /// + /// + /// + /// Name of the Environment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerAppManagedEnvironmentAsync(string environmentName, CancellationToken cancellationToken = default) + { + return await GetContainerAppManagedEnvironments().GetAsync(environmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a Managed Environment used to host container apps. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName} + /// + /// + /// Operation Id + /// ManagedEnvironments_Get + /// + /// + /// + /// Name of the Environment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerAppManagedEnvironment(string environmentName, CancellationToken cancellationToken = default) + { + return GetContainerAppManagedEnvironments().Get(environmentName, cancellationToken); + } + + /// Gets a collection of ContainerAppJobResources in the ResourceGroupResource. + /// An object representing collection of ContainerAppJobResources and their operations over a ContainerAppJobResource. + public virtual ContainerAppJobCollection GetContainerAppJobs() + { + return GetCachedClient(client => new ContainerAppJobCollection(client, Id)); + } + + /// + /// Get the properties of a Container Apps Job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// Job Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerAppJobAsync(string jobName, CancellationToken cancellationToken = default) + { + return await GetContainerAppJobs().GetAsync(jobName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a Container Apps Job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// Job Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerAppJob(string jobName, CancellationToken cancellationToken = default) + { + return GetContainerAppJobs().Get(jobName, cancellationToken); + } + } +} diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersSubscriptionResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersSubscriptionResource.cs new file mode 100644 index 0000000000000..9f31ec31a12a7 --- /dev/null +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/MockableAppContainersSubscriptionResource.cs @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppContainers; +using Azure.ResourceManager.AppContainers.Models; + +namespace Azure.ResourceManager.AppContainers.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAppContainersSubscriptionResource : ArmResource + { + private ClientDiagnostics _availableWorkloadProfilesClientDiagnostics; + private AvailableWorkloadProfilesRestOperations _availableWorkloadProfilesRestClient; + private ClientDiagnostics _billingMetersClientDiagnostics; + private BillingMetersRestOperations _billingMetersRestClient; + private ClientDiagnostics _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics; + private ConnectedEnvironmentsRestOperations _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient; + private ClientDiagnostics _containerAppClientDiagnostics; + private ContainerAppsRestOperations _containerAppRestClient; + private ClientDiagnostics _containerAppJobJobsClientDiagnostics; + private JobsRestOperations _containerAppJobJobsRestClient; + private ClientDiagnostics _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics; + private ManagedEnvironmentsRestOperations _containerAppManagedEnvironmentManagedEnvironmentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAppContainersSubscriptionResource() + { + } + + /// 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 MockableAppContainersSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AvailableWorkloadProfilesClientDiagnostics => _availableWorkloadProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableWorkloadProfilesRestOperations AvailableWorkloadProfilesRestClient => _availableWorkloadProfilesRestClient ??= new AvailableWorkloadProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BillingMetersClientDiagnostics => _billingMetersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BillingMetersRestOperations BillingMetersRestClient => _billingMetersRestClient ??= new BillingMetersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics => _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ContainerAppConnectedEnvironmentResource.ResourceType.Namespace, Diagnostics); + private ConnectedEnvironmentsRestOperations ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient => _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient ??= new ConnectedEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppConnectedEnvironmentResource.ResourceType)); + private ClientDiagnostics ContainerAppClientDiagnostics => _containerAppClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ContainerAppResource.ResourceType.Namespace, Diagnostics); + private ContainerAppsRestOperations ContainerAppRestClient => _containerAppRestClient ??= new ContainerAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppResource.ResourceType)); + private ClientDiagnostics ContainerAppJobJobsClientDiagnostics => _containerAppJobJobsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ContainerAppJobResource.ResourceType.Namespace, Diagnostics); + private JobsRestOperations ContainerAppJobJobsRestClient => _containerAppJobJobsRestClient ??= new JobsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppJobResource.ResourceType)); + private ClientDiagnostics ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics => _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ContainerAppManagedEnvironmentResource.ResourceType.Namespace, Diagnostics); + private ManagedEnvironmentsRestOperations ContainerAppManagedEnvironmentManagedEnvironmentsRestClient => _containerAppManagedEnvironmentManagedEnvironmentsRestClient ??= new ManagedEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppManagedEnvironmentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get all available workload profiles for a location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes + /// + /// + /// Operation Id + /// AvailableWorkloadProfiles_Get + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableWorkloadProfilesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableWorkloadProfilesRestClient.CreateGetRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableWorkloadProfilesRestClient.CreateGetNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ContainerAppAvailableWorkloadProfile.DeserializeContainerAppAvailableWorkloadProfile, AvailableWorkloadProfilesClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetAvailableWorkloadProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Get all available workload profiles for a location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes + /// + /// + /// Operation Id + /// AvailableWorkloadProfiles_Get + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableWorkloadProfiles(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableWorkloadProfilesRestClient.CreateGetRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableWorkloadProfilesRestClient.CreateGetNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ContainerAppAvailableWorkloadProfile.DeserializeContainerAppAvailableWorkloadProfile, AvailableWorkloadProfilesClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetAvailableWorkloadProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Get all billingMeters for a location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters + /// + /// + /// Operation Id + /// BillingMeters_Get + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBillingMetersAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BillingMetersRestClient.CreateGetRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ContainerAppBillingMeter.DeserializeContainerAppBillingMeter, BillingMetersClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetBillingMeters", "value", null, cancellationToken); + } + + /// + /// Get all billingMeters for a location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters + /// + /// + /// Operation Id + /// BillingMeters_Get + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBillingMeters(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BillingMetersRestClient.CreateGetRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ContainerAppBillingMeter.DeserializeContainerAppBillingMeter, BillingMetersClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetBillingMeters", "value", null, cancellationToken); + } + + /// + /// Get all connectedEnvironments for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments + /// + /// + /// Operation Id + /// ConnectedEnvironments_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerAppConnectedEnvironmentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetContainerAppConnectedEnvironments", "value", "nextLink", cancellationToken); + } + + /// + /// Get all connectedEnvironments for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments + /// + /// + /// Operation Id + /// ConnectedEnvironments_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerAppConnectedEnvironments(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetContainerAppConnectedEnvironments", "value", "nextLink", cancellationToken); + } + + /// + /// Get the Container Apps in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps + /// + /// + /// Operation Id + /// ContainerApps_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerAppsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetContainerApps", "value", "nextLink", cancellationToken); + } + + /// + /// Get the Container Apps in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps + /// + /// + /// Operation Id + /// ContainerApps_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerApps(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetContainerApps", "value", "nextLink", cancellationToken); + } + + /// + /// Get the Container Apps Jobs in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/jobs + /// + /// + /// Operation Id + /// Jobs_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerAppJobsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppJobJobsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppJobJobsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), ContainerAppJobJobsClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetContainerAppJobs", "value", "nextLink", cancellationToken); + } + + /// + /// Get the Container Apps Jobs in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/jobs + /// + /// + /// Operation Id + /// Jobs_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerAppJobs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppJobJobsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppJobJobsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), ContainerAppJobJobsClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetContainerAppJobs", "value", "nextLink", cancellationToken); + } + + /// + /// Get all Managed Environments for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments + /// + /// + /// Operation Id + /// ManagedEnvironments_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerAppManagedEnvironmentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetContainerAppManagedEnvironments", "value", "nextLink", cancellationToken); + } + + /// + /// Get all Managed Environments for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments + /// + /// + /// Operation Id + /// ManagedEnvironments_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerAppManagedEnvironments(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "MockableAppContainersSubscriptionResource.GetContainerAppManagedEnvironments", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 58a4ecb3e499e..0000000000000 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.AppContainers -{ - /// 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 ContainerAppConnectedEnvironmentResources in the ResourceGroupResource. - /// An object representing collection of ContainerAppConnectedEnvironmentResources and their operations over a ContainerAppConnectedEnvironmentResource. - public virtual ContainerAppConnectedEnvironmentCollection GetContainerAppConnectedEnvironments() - { - return GetCachedClient(Client => new ContainerAppConnectedEnvironmentCollection(Client, Id)); - } - - /// Gets a collection of ContainerAppResources in the ResourceGroupResource. - /// An object representing collection of ContainerAppResources and their operations over a ContainerAppResource. - public virtual ContainerAppCollection GetContainerApps() - { - return GetCachedClient(Client => new ContainerAppCollection(Client, Id)); - } - - /// Gets a collection of ContainerAppManagedEnvironmentResources in the ResourceGroupResource. - /// An object representing collection of ContainerAppManagedEnvironmentResources and their operations over a ContainerAppManagedEnvironmentResource. - public virtual ContainerAppManagedEnvironmentCollection GetContainerAppManagedEnvironments() - { - return GetCachedClient(Client => new ContainerAppManagedEnvironmentCollection(Client, Id)); - } - - /// Gets a collection of ContainerAppJobResources in the ResourceGroupResource. - /// An object representing collection of ContainerAppJobResources and their operations over a ContainerAppJobResource. - public virtual ContainerAppJobCollection GetContainerAppJobs() - { - return GetCachedClient(Client => new ContainerAppJobCollection(Client, Id)); - } - } -} diff --git a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index e81ae64ffb418..0000000000000 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppContainers.Models; - -namespace Azure.ResourceManager.AppContainers -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _availableWorkloadProfilesClientDiagnostics; - private AvailableWorkloadProfilesRestOperations _availableWorkloadProfilesRestClient; - private ClientDiagnostics _billingMetersClientDiagnostics; - private BillingMetersRestOperations _billingMetersRestClient; - private ClientDiagnostics _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics; - private ConnectedEnvironmentsRestOperations _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient; - private ClientDiagnostics _containerAppClientDiagnostics; - private ContainerAppsRestOperations _containerAppRestClient; - private ClientDiagnostics _containerAppJobJobsClientDiagnostics; - private JobsRestOperations _containerAppJobJobsRestClient; - private ClientDiagnostics _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics; - private ManagedEnvironmentsRestOperations _containerAppManagedEnvironmentManagedEnvironmentsRestClient; - - /// 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 AvailableWorkloadProfilesClientDiagnostics => _availableWorkloadProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableWorkloadProfilesRestOperations AvailableWorkloadProfilesRestClient => _availableWorkloadProfilesRestClient ??= new AvailableWorkloadProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BillingMetersClientDiagnostics => _billingMetersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BillingMetersRestOperations BillingMetersRestClient => _billingMetersRestClient ??= new BillingMetersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics => _containerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ContainerAppConnectedEnvironmentResource.ResourceType.Namespace, Diagnostics); - private ConnectedEnvironmentsRestOperations ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient => _containerAppConnectedEnvironmentConnectedEnvironmentsRestClient ??= new ConnectedEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppConnectedEnvironmentResource.ResourceType)); - private ClientDiagnostics ContainerAppClientDiagnostics => _containerAppClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ContainerAppResource.ResourceType.Namespace, Diagnostics); - private ContainerAppsRestOperations ContainerAppRestClient => _containerAppRestClient ??= new ContainerAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppResource.ResourceType)); - private ClientDiagnostics ContainerAppJobJobsClientDiagnostics => _containerAppJobJobsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ContainerAppJobResource.ResourceType.Namespace, Diagnostics); - private JobsRestOperations ContainerAppJobJobsRestClient => _containerAppJobJobsRestClient ??= new JobsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppJobResource.ResourceType)); - private ClientDiagnostics ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics => _containerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppContainers", ContainerAppManagedEnvironmentResource.ResourceType.Namespace, Diagnostics); - private ManagedEnvironmentsRestOperations ContainerAppManagedEnvironmentManagedEnvironmentsRestClient => _containerAppManagedEnvironmentManagedEnvironmentsRestClient ??= new ManagedEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppManagedEnvironmentResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get all available workload profiles for a location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes - /// - /// - /// Operation Id - /// AvailableWorkloadProfiles_Get - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableWorkloadProfilesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableWorkloadProfilesRestClient.CreateGetRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableWorkloadProfilesRestClient.CreateGetNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ContainerAppAvailableWorkloadProfile.DeserializeContainerAppAvailableWorkloadProfile, AvailableWorkloadProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableWorkloadProfiles", "value", "nextLink", cancellationToken); - } - - /// - /// Get all available workload profiles for a location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes - /// - /// - /// Operation Id - /// AvailableWorkloadProfiles_Get - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableWorkloadProfiles(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableWorkloadProfilesRestClient.CreateGetRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableWorkloadProfilesRestClient.CreateGetNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ContainerAppAvailableWorkloadProfile.DeserializeContainerAppAvailableWorkloadProfile, AvailableWorkloadProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableWorkloadProfiles", "value", "nextLink", cancellationToken); - } - - /// - /// Get all billingMeters for a location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters - /// - /// - /// Operation Id - /// BillingMeters_Get - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBillingMetersAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BillingMetersRestClient.CreateGetRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ContainerAppBillingMeter.DeserializeContainerAppBillingMeter, BillingMetersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBillingMeters", "value", null, cancellationToken); - } - - /// - /// Get all billingMeters for a location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters - /// - /// - /// Operation Id - /// BillingMeters_Get - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBillingMeters(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BillingMetersRestClient.CreateGetRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ContainerAppBillingMeter.DeserializeContainerAppBillingMeter, BillingMetersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBillingMeters", "value", null, cancellationToken); - } - - /// - /// Get all connectedEnvironments for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments - /// - /// - /// Operation Id - /// ConnectedEnvironments_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerAppConnectedEnvironmentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppConnectedEnvironments", "value", "nextLink", cancellationToken); - } - - /// - /// Get all connectedEnvironments for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments - /// - /// - /// Operation Id - /// ConnectedEnvironments_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerAppConnectedEnvironments(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppConnectedEnvironmentConnectedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppConnectedEnvironmentResource(Client, ContainerAppConnectedEnvironmentData.DeserializeContainerAppConnectedEnvironmentData(e)), ContainerAppConnectedEnvironmentConnectedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppConnectedEnvironments", "value", "nextLink", cancellationToken); - } - - /// - /// Get the Container Apps in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps - /// - /// - /// Operation Id - /// ContainerApps_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerAppsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerApps", "value", "nextLink", cancellationToken); - } - - /// - /// Get the Container Apps in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps - /// - /// - /// Operation Id - /// ContainerApps_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerApps(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerApps", "value", "nextLink", cancellationToken); - } - - /// - /// Get the Container Apps Jobs in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/jobs - /// - /// - /// Operation Id - /// Jobs_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerAppJobsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppJobJobsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppJobJobsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), ContainerAppJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppJobs", "value", "nextLink", cancellationToken); - } - - /// - /// Get the Container Apps Jobs in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/jobs - /// - /// - /// Operation Id - /// Jobs_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerAppJobs(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppJobJobsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppJobJobsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppJobResource(Client, ContainerAppJobData.DeserializeContainerAppJobData(e)), ContainerAppJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppJobs", "value", "nextLink", cancellationToken); - } - - /// - /// Get all Managed Environments for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments - /// - /// - /// Operation Id - /// ManagedEnvironments_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerAppManagedEnvironmentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppManagedEnvironments", "value", "nextLink", cancellationToken); - } - - /// - /// Get all Managed Environments for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments - /// - /// - /// Operation Id - /// ManagedEnvironments_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerAppManagedEnvironments(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppManagedEnvironmentManagedEnvironmentsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppManagedEnvironmentResource(Client, ContainerAppManagedEnvironmentData.DeserializeContainerAppManagedEnvironmentData(e)), ContainerAppManagedEnvironmentManagedEnvironmentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerAppManagedEnvironments", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/api/Azure.ResourceManager.ContainerInstance.netstandard2.0.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/api/Azure.ResourceManager.ContainerInstance.netstandard2.0.cs index 5351aa14912a0..7d00ebec2e4e2 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/api/Azure.ResourceManager.ContainerInstance.netstandard2.0.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/api/Azure.ResourceManager.ContainerInstance.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ContainerGroupCollection() { } } public partial class ContainerGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerGroupData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable containers, Azure.ResourceManager.ContainerInstance.Models.ContainerInstanceOperatingSystemType osType) : base (default(Azure.Core.AzureLocation)) { } + public ContainerGroupData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable containers, Azure.ResourceManager.ContainerInstance.Models.ContainerInstanceOperatingSystemType osType) { } public string ConfidentialComputeCcePolicy { get { throw null; } set { } } public System.Collections.Generic.IList Containers { get { throw null; } } public Azure.ResourceManager.ContainerInstance.Models.ContainerGroupLogAnalytics DiagnosticsLogAnalytics { get { throw null; } set { } } @@ -92,6 +92,35 @@ public static partial class ContainerInstanceExtensions public static Azure.AsyncPageable GetUsagesWithLocationAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ContainerInstance.Mocking +{ + public partial class MockableContainerInstanceArmClient : Azure.ResourceManager.ArmResource + { + protected MockableContainerInstanceArmClient() { } + public virtual Azure.ResourceManager.ContainerInstance.ContainerGroupResource GetContainerGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableContainerInstanceResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableContainerInstanceResourceGroupResource() { } + public virtual Azure.ResourceManager.ArmOperation DeleteSubnetServiceAssociationLink(Azure.WaitUntil waitUntil, string virtualNetworkName, string subnetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteSubnetServiceAssociationLinkAsync(Azure.WaitUntil waitUntil, string virtualNetworkName, string subnetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetContainerGroup(string containerGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerGroupAsync(string containerGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ContainerInstance.ContainerGroupCollection GetContainerGroups() { throw null; } + } + public partial class MockableContainerInstanceSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableContainerInstanceSubscriptionResource() { } + public virtual Azure.Pageable GetCachedImagesWithLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCachedImagesWithLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCapabilitiesWithLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCapabilitiesWithLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetContainerGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsagesWithLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesWithLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ContainerInstance.Models { public static partial class ArmContainerInstanceModelFactory @@ -329,7 +358,7 @@ public ContainerGroupLogAnalytics(string workspaceId, string workspaceKey) { } } public partial class ContainerGroupPatch : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerGroupPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerGroupPatch(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList Zones { get { throw null; } } } public partial class ContainerGroupPort diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupResource.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupResource.cs index 62d140d64286b..d10bf1a695ae8 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupResource.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ContainerInstance public partial class ContainerGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The containerGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string containerGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}"; diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs index d7f98c32b2539..ff1d19941f74b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ContainerInstance.Mocking; using Azure.ResourceManager.ContainerInstance.Models; using Azure.ResourceManager.Resources; @@ -19,62 +20,49 @@ namespace Azure.ResourceManager.ContainerInstance /// A class to add extension methods to Azure.ResourceManager.ContainerInstance. public static partial class ContainerInstanceExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableContainerInstanceArmClient GetMockableContainerInstanceArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableContainerInstanceArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableContainerInstanceResourceGroupResource GetMockableContainerInstanceResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableContainerInstanceResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableContainerInstanceSubscriptionResource GetMockableContainerInstanceSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableContainerInstanceSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ContainerGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerGroupResource GetContainerGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerGroupResource.ValidateResourceId(id); - return new ContainerGroupResource(client, id); - } - ); + return GetMockableContainerInstanceArmClient(client).GetContainerGroupResource(id); } - #endregion - /// Gets a collection of ContainerGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerGroupResources and their operations over a ContainerGroupResource. public static ContainerGroupCollection GetContainerGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerGroups(); + return GetMockableContainerInstanceResourceGroupResource(resourceGroupResource).GetContainerGroups(); } /// @@ -89,16 +77,20 @@ public static ContainerGroupCollection GetContainerGroups(this ResourceGroupReso /// ContainerGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the container group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerGroupAsync(this ResourceGroupResource resourceGroupResource, string containerGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerGroups().GetAsync(containerGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerInstanceResourceGroupResource(resourceGroupResource).GetContainerGroupAsync(containerGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -113,16 +105,20 @@ public static async Task> GetContainerGroupAsyn /// ContainerGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the container group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerGroup(this ResourceGroupResource resourceGroupResource, string containerGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerGroups().Get(containerGroupName, cancellationToken); + return GetMockableContainerInstanceResourceGroupResource(resourceGroupResource).GetContainerGroup(containerGroupName, cancellationToken); } /// @@ -137,6 +133,10 @@ public static Response GetContainerGroup(this ResourceGr /// SubnetServiceAssociationLink_Delete /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -147,10 +147,7 @@ public static Response GetContainerGroup(this ResourceGr /// or is null. public static async Task DeleteSubnetServiceAssociationLinkAsync(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); - Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteSubnetServiceAssociationLinkAsync(waitUntil, virtualNetworkName, subnetName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerInstanceResourceGroupResource(resourceGroupResource).DeleteSubnetServiceAssociationLinkAsync(waitUntil, virtualNetworkName, subnetName, cancellationToken).ConfigureAwait(false); } /// @@ -165,6 +162,10 @@ public static async Task DeleteSubnetServiceAssociationLinkAsync(t /// SubnetServiceAssociationLink_Delete /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -175,10 +176,7 @@ public static async Task DeleteSubnetServiceAssociationLinkAsync(t /// or is null. public static ArmOperation DeleteSubnetServiceAssociationLink(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); - Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteSubnetServiceAssociationLink(waitUntil, virtualNetworkName, subnetName, cancellationToken); + return GetMockableContainerInstanceResourceGroupResource(resourceGroupResource).DeleteSubnetServiceAssociationLink(waitUntil, virtualNetworkName, subnetName, cancellationToken); } /// @@ -193,13 +191,17 @@ public static ArmOperation DeleteSubnetServiceAssociationLink(this ResourceGroup /// ContainerGroups_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerGroupsAsync(cancellationToken); + return GetMockableContainerInstanceSubscriptionResource(subscriptionResource).GetContainerGroupsAsync(cancellationToken); } /// @@ -214,13 +216,17 @@ public static AsyncPageable GetContainerGroupsAsync(this /// ContainerGroups_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerGroups(cancellationToken); + return GetMockableContainerInstanceSubscriptionResource(subscriptionResource).GetContainerGroups(cancellationToken); } /// @@ -235,6 +241,10 @@ public static Pageable GetContainerGroups(this Subscript /// Location_ListUsage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The identifier for the physical azure location. @@ -242,7 +252,7 @@ public static Pageable GetContainerGroups(this Subscript /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesWithLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesWithLocationAsync(location, cancellationToken); + return GetMockableContainerInstanceSubscriptionResource(subscriptionResource).GetUsagesWithLocationAsync(location, cancellationToken); } /// @@ -257,6 +267,10 @@ public static AsyncPageable GetUsagesWithLocationAsync(t /// Location_ListUsage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The identifier for the physical azure location. @@ -264,7 +278,7 @@ public static AsyncPageable GetUsagesWithLocationAsync(t /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsagesWithLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesWithLocation(location, cancellationToken); + return GetMockableContainerInstanceSubscriptionResource(subscriptionResource).GetUsagesWithLocation(location, cancellationToken); } /// @@ -279,6 +293,10 @@ public static Pageable GetUsagesWithLocation(this Subscr /// Location_ListCachedImages /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The identifier for the physical azure location. @@ -286,7 +304,7 @@ public static Pageable GetUsagesWithLocation(this Subscr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCachedImagesWithLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCachedImagesWithLocationAsync(location, cancellationToken); + return GetMockableContainerInstanceSubscriptionResource(subscriptionResource).GetCachedImagesWithLocationAsync(location, cancellationToken); } /// @@ -301,6 +319,10 @@ public static AsyncPageable GetCachedImagesWithLocationAsync(this /// Location_ListCachedImages /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The identifier for the physical azure location. @@ -308,7 +330,7 @@ public static AsyncPageable GetCachedImagesWithLocationAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCachedImagesWithLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCachedImagesWithLocation(location, cancellationToken); + return GetMockableContainerInstanceSubscriptionResource(subscriptionResource).GetCachedImagesWithLocation(location, cancellationToken); } /// @@ -323,6 +345,10 @@ public static Pageable GetCachedImagesWithLocation(this Subscripti /// Location_ListCapabilities /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The identifier for the physical azure location. @@ -330,7 +356,7 @@ public static Pageable GetCachedImagesWithLocation(this Subscripti /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCapabilitiesWithLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapabilitiesWithLocationAsync(location, cancellationToken); + return GetMockableContainerInstanceSubscriptionResource(subscriptionResource).GetCapabilitiesWithLocationAsync(location, cancellationToken); } /// @@ -345,6 +371,10 @@ public static AsyncPageable GetCapabilitiesWithLocationAs /// Location_ListCapabilities /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The identifier for the physical azure location. @@ -352,7 +382,7 @@ public static AsyncPageable GetCapabilitiesWithLocationAs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCapabilitiesWithLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapabilitiesWithLocation(location, cancellationToken); + return GetMockableContainerInstanceSubscriptionResource(subscriptionResource).GetCapabilitiesWithLocation(location, cancellationToken); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceArmClient.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceArmClient.cs new file mode 100644 index 0000000000000..dfa2a837653cd --- /dev/null +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ContainerInstance; + +namespace Azure.ResourceManager.ContainerInstance.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableContainerInstanceArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContainerInstanceArmClient() + { + } + + /// 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 MockableContainerInstanceArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableContainerInstanceArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerGroupResource GetContainerGroupResource(ResourceIdentifier id) + { + ContainerGroupResource.ValidateResourceId(id); + return new ContainerGroupResource(Client, id); + } + } +} diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceResourceGroupResource.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceResourceGroupResource.cs new file mode 100644 index 0000000000000..cc22c55005eb2 --- /dev/null +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceResourceGroupResource.cs @@ -0,0 +1,181 @@ +// 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; +using Azure.ResourceManager.ContainerInstance; + +namespace Azure.ResourceManager.ContainerInstance.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableContainerInstanceResourceGroupResource : ArmResource + { + private ClientDiagnostics _subnetServiceAssociationLinkClientDiagnostics; + private SubnetServiceAssociationLinkRestOperations _subnetServiceAssociationLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableContainerInstanceResourceGroupResource() + { + } + + /// 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 MockableContainerInstanceResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SubnetServiceAssociationLinkClientDiagnostics => _subnetServiceAssociationLinkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerInstance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SubnetServiceAssociationLinkRestOperations SubnetServiceAssociationLinkRestClient => _subnetServiceAssociationLinkRestClient ??= new SubnetServiceAssociationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ContainerGroupResources in the ResourceGroupResource. + /// An object representing collection of ContainerGroupResources and their operations over a ContainerGroupResource. + public virtual ContainerGroupCollection GetContainerGroups() + { + return GetCachedClient(client => new ContainerGroupCollection(client, Id)); + } + + /// + /// Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName} + /// + /// + /// Operation Id + /// ContainerGroups_Get + /// + /// + /// + /// The name of the container group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerGroupAsync(string containerGroupName, CancellationToken cancellationToken = default) + { + return await GetContainerGroups().GetAsync(containerGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of the specified container group in the specified subscription and resource group. The operation returns the properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName} + /// + /// + /// Operation Id + /// ContainerGroups_Get + /// + /// + /// + /// The name of the container group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerGroup(string containerGroupName, CancellationToken cancellationToken = default) + { + return GetContainerGroups().Get(containerGroupName, cancellationToken); + } + + /// + /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default + /// + /// + /// Operation Id + /// SubnetServiceAssociationLink_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 name of the virtual network. + /// The name of the subnet. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task DeleteSubnetServiceAssociationLinkAsync(WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); + + using var scope = SubnetServiceAssociationLinkClientDiagnostics.CreateScope("MockableContainerInstanceResourceGroupResource.DeleteSubnetServiceAssociationLink"); + scope.Start(); + try + { + var response = await SubnetServiceAssociationLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName, cancellationToken).ConfigureAwait(false); + var operation = new ContainerInstanceArmOperation(SubnetServiceAssociationLinkClientDiagnostics, Pipeline, SubnetServiceAssociationLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default + /// + /// + /// Operation Id + /// SubnetServiceAssociationLink_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 name of the virtual network. + /// The name of the subnet. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation DeleteSubnetServiceAssociationLink(WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); + + using var scope = SubnetServiceAssociationLinkClientDiagnostics.CreateScope("MockableContainerInstanceResourceGroupResource.DeleteSubnetServiceAssociationLink"); + scope.Start(); + try + { + var response = SubnetServiceAssociationLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName, cancellationToken); + var operation = new ContainerInstanceArmOperation(SubnetServiceAssociationLinkClientDiagnostics, Pipeline, SubnetServiceAssociationLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceSubscriptionResource.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceSubscriptionResource.cs new file mode 100644 index 0000000000000..190035cd946ac --- /dev/null +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/MockableContainerInstanceSubscriptionResource.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ContainerInstance; +using Azure.ResourceManager.ContainerInstance.Models; + +namespace Azure.ResourceManager.ContainerInstance.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableContainerInstanceSubscriptionResource : ArmResource + { + private ClientDiagnostics _containerGroupClientDiagnostics; + private ContainerGroupsRestOperations _containerGroupRestClient; + private ClientDiagnostics _locationClientDiagnostics; + private LocationRestOperations _locationRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableContainerInstanceSubscriptionResource() + { + } + + /// 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 MockableContainerInstanceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ContainerGroupClientDiagnostics => _containerGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerInstance", ContainerGroupResource.ResourceType.Namespace, Diagnostics); + private ContainerGroupsRestOperations ContainerGroupRestClient => _containerGroupRestClient ??= new ContainerGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerGroupResource.ResourceType)); + private ClientDiagnostics LocationClientDiagnostics => _locationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerInstance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationRestOperations LocationRestClient => _locationRestClient ??= new LocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups + /// + /// + /// Operation Id + /// ContainerGroups_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerGroupRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), ContainerGroupClientDiagnostics, Pipeline, "MockableContainerInstanceSubscriptionResource.GetContainerGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups + /// + /// + /// Operation Id + /// ContainerGroups_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerGroupRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), ContainerGroupClientDiagnostics, Pipeline, "MockableContainerInstanceSubscriptionResource.GetContainerGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Get the usage for a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages + /// + /// + /// Operation Id + /// Location_ListUsage + /// + /// + /// + /// The identifier for the physical azure location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesWithLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListUsageRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ContainerInstanceUsage.DeserializeContainerInstanceUsage, LocationClientDiagnostics, Pipeline, "MockableContainerInstanceSubscriptionResource.GetUsagesWithLocation", "value", null, cancellationToken); + } + + /// + /// Get the usage for a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages + /// + /// + /// Operation Id + /// Location_ListUsage + /// + /// + /// + /// The identifier for the physical azure location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsagesWithLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListUsageRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ContainerInstanceUsage.DeserializeContainerInstanceUsage, LocationClientDiagnostics, Pipeline, "MockableContainerInstanceSubscriptionResource.GetUsagesWithLocation", "value", null, cancellationToken); + } + + /// + /// Get the list of cached images on specific OS type for a subscription in a region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages + /// + /// + /// Operation Id + /// Location_ListCachedImages + /// + /// + /// + /// The identifier for the physical azure location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCachedImagesWithLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListCachedImagesRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListCachedImagesNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CachedImages.DeserializeCachedImages, LocationClientDiagnostics, Pipeline, "MockableContainerInstanceSubscriptionResource.GetCachedImagesWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of cached images on specific OS type for a subscription in a region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages + /// + /// + /// Operation Id + /// Location_ListCachedImages + /// + /// + /// + /// The identifier for the physical azure location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCachedImagesWithLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListCachedImagesRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListCachedImagesNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CachedImages.DeserializeCachedImages, LocationClientDiagnostics, Pipeline, "MockableContainerInstanceSubscriptionResource.GetCachedImagesWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of CPU/memory/GPU capabilities of a region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities + /// + /// + /// Operation Id + /// Location_ListCapabilities + /// + /// + /// + /// The identifier for the physical azure location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCapabilitiesWithLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListCapabilitiesRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListCapabilitiesNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ContainerCapabilities.DeserializeContainerCapabilities, LocationClientDiagnostics, Pipeline, "MockableContainerInstanceSubscriptionResource.GetCapabilitiesWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of CPU/memory/GPU capabilities of a region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities + /// + /// + /// Operation Id + /// Location_ListCapabilities + /// + /// + /// + /// The identifier for the physical azure location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCapabilitiesWithLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListCapabilitiesRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListCapabilitiesNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ContainerCapabilities.DeserializeContainerCapabilities, LocationClientDiagnostics, Pipeline, "MockableContainerInstanceSubscriptionResource.GetCapabilitiesWithLocation", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 84866a6449703..0000000000000 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,124 +0,0 @@ -// 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.ContainerInstance -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _subnetServiceAssociationLinkClientDiagnostics; - private SubnetServiceAssociationLinkRestOperations _subnetServiceAssociationLinkRestClient; - - /// 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 ClientDiagnostics SubnetServiceAssociationLinkClientDiagnostics => _subnetServiceAssociationLinkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerInstance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SubnetServiceAssociationLinkRestOperations SubnetServiceAssociationLinkRestClient => _subnetServiceAssociationLinkRestClient ??= new SubnetServiceAssociationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ContainerGroupResources in the ResourceGroupResource. - /// An object representing collection of ContainerGroupResources and their operations over a ContainerGroupResource. - public virtual ContainerGroupCollection GetContainerGroups() - { - return GetCachedClient(Client => new ContainerGroupCollection(Client, Id)); - } - - /// - /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default - /// - /// - /// Operation Id - /// SubnetServiceAssociationLink_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 name of the virtual network. - /// The name of the subnet. - /// The cancellation token to use. - public virtual async Task DeleteSubnetServiceAssociationLinkAsync(WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) - { - using var scope = SubnetServiceAssociationLinkClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteSubnetServiceAssociationLink"); - scope.Start(); - try - { - var response = await SubnetServiceAssociationLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName, cancellationToken).ConfigureAwait(false); - var operation = new ContainerInstanceArmOperation(SubnetServiceAssociationLinkClientDiagnostics, Pipeline, SubnetServiceAssociationLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default - /// - /// - /// Operation Id - /// SubnetServiceAssociationLink_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 name of the virtual network. - /// The name of the subnet. - /// The cancellation token to use. - public virtual ArmOperation DeleteSubnetServiceAssociationLink(WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) - { - using var scope = SubnetServiceAssociationLinkClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteSubnetServiceAssociationLink"); - scope.Start(); - try - { - var response = SubnetServiceAssociationLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName, cancellationToken); - var operation = new ContainerInstanceArmOperation(SubnetServiceAssociationLinkClientDiagnostics, Pipeline, SubnetServiceAssociationLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 7f606abe10190..0000000000000 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ContainerInstance.Models; - -namespace Azure.ResourceManager.ContainerInstance -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _containerGroupClientDiagnostics; - private ContainerGroupsRestOperations _containerGroupRestClient; - private ClientDiagnostics _locationClientDiagnostics; - private LocationRestOperations _locationRestClient; - - /// 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 ContainerGroupClientDiagnostics => _containerGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerInstance", ContainerGroupResource.ResourceType.Namespace, Diagnostics); - private ContainerGroupsRestOperations ContainerGroupRestClient => _containerGroupRestClient ??= new ContainerGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerGroupResource.ResourceType)); - private ClientDiagnostics LocationClientDiagnostics => _locationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerInstance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationRestOperations LocationRestClient => _locationRestClient ??= new LocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups - /// - /// - /// Operation Id - /// ContainerGroups_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerGroupRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), ContainerGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups - /// - /// - /// Operation Id - /// ContainerGroups_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerGroupRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerGroupRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerGroupResource(Client, ContainerGroupData.DeserializeContainerGroupData(e)), ContainerGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Get the usage for a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages - /// - /// - /// Operation Id - /// Location_ListUsage - /// - /// - /// - /// The identifier for the physical azure location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesWithLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListUsageRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ContainerInstanceUsage.DeserializeContainerInstanceUsage, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesWithLocation", "value", null, cancellationToken); - } - - /// - /// Get the usage for a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages - /// - /// - /// Operation Id - /// Location_ListUsage - /// - /// - /// - /// The identifier for the physical azure location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsagesWithLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListUsageRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ContainerInstanceUsage.DeserializeContainerInstanceUsage, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesWithLocation", "value", null, cancellationToken); - } - - /// - /// Get the list of cached images on specific OS type for a subscription in a region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages - /// - /// - /// Operation Id - /// Location_ListCachedImages - /// - /// - /// - /// The identifier for the physical azure location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCachedImagesWithLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListCachedImagesRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListCachedImagesNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CachedImages.DeserializeCachedImages, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCachedImagesWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Get the list of cached images on specific OS type for a subscription in a region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages - /// - /// - /// Operation Id - /// Location_ListCachedImages - /// - /// - /// - /// The identifier for the physical azure location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCachedImagesWithLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListCachedImagesRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListCachedImagesNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CachedImages.DeserializeCachedImages, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCachedImagesWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Get the list of CPU/memory/GPU capabilities of a region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities - /// - /// - /// Operation Id - /// Location_ListCapabilities - /// - /// - /// - /// The identifier for the physical azure location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCapabilitiesWithLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListCapabilitiesRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListCapabilitiesNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ContainerCapabilities.DeserializeContainerCapabilities, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCapabilitiesWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Get the list of CPU/memory/GPU capabilities of a region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities - /// - /// - /// Operation Id - /// Location_ListCapabilities - /// - /// - /// - /// The identifier for the physical azure location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCapabilitiesWithLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationRestClient.CreateListCapabilitiesRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationRestClient.CreateListCapabilitiesNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ContainerCapabilities.DeserializeContainerCapabilities, LocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCapabilitiesWithLocation", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/api/Azure.ResourceManager.ContainerRegistry.netstandard2.0.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/api/Azure.ResourceManager.ContainerRegistry.netstandard2.0.cs index 33a9782ffc21a..64529e2127972 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/api/Azure.ResourceManager.ContainerRegistry.netstandard2.0.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/api/Azure.ResourceManager.ContainerRegistry.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ContainerRegistryAgentPoolCollection() { } } public partial class ContainerRegistryAgentPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerRegistryAgentPoolData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerRegistryAgentPoolData(Azure.Core.AzureLocation location) { } public int? Count { get { throw null; } set { } } public Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistryOS? OS { get { throw null; } set { } } public Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistryProvisioningState? ProvisioningState { get { throw null; } } @@ -67,7 +67,7 @@ protected ContainerRegistryCollection() { } } public partial class ContainerRegistryData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerRegistryData(Azure.Core.AzureLocation location, Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistrySku sku) : base (default(Azure.Core.AzureLocation)) { } + public ContainerRegistryData(Azure.Core.AzureLocation location, Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistrySku sku) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public System.Collections.Generic.IReadOnlyList DataEndpointHostNames { get { throw null; } } public Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistryEncryption Encryption { get { throw null; } set { } } @@ -195,7 +195,7 @@ protected ContainerRegistryReplicationCollection() { } } public partial class ContainerRegistryReplicationData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerRegistryReplicationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerRegistryReplicationData(Azure.Core.AzureLocation location) { } public bool? IsRegionEndpointEnabled { get { throw null; } set { } } public Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistryProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistryResourceStatus Status { get { throw null; } } @@ -361,7 +361,7 @@ protected ContainerRegistryTaskCollection() { } } public partial class ContainerRegistryTaskData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerRegistryTaskData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerRegistryTaskData(Azure.Core.AzureLocation location) { } public int? AgentCpu { get { throw null; } set { } } public string AgentPoolName { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } @@ -500,7 +500,7 @@ protected ContainerRegistryWebhookCollection() { } } public partial class ContainerRegistryWebhookData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerRegistryWebhookData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerRegistryWebhookData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList Actions { get { throw null; } } public Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistryProvisioningState? ProvisioningState { get { throw null; } } public string Scope { get { throw null; } set { } } @@ -573,6 +573,39 @@ protected ScopeMapResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ContainerRegistry.Models.ScopeMapPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ContainerRegistry.Mocking +{ + public partial class MockableContainerRegistryArmClient : Azure.ResourceManager.ArmResource + { + protected MockableContainerRegistryArmClient() { } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryAgentPoolResource GetContainerRegistryAgentPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryPrivateEndpointConnectionResource GetContainerRegistryPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryPrivateLinkResource GetContainerRegistryPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryReplicationResource GetContainerRegistryReplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryResource GetContainerRegistryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryRunResource GetContainerRegistryRunResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryTaskResource GetContainerRegistryTaskResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryTaskRunResource GetContainerRegistryTaskRunResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryTokenResource GetContainerRegistryTokenResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryWebhookResource GetContainerRegistryWebhookResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerRegistry.ScopeMapResource GetScopeMapResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableContainerRegistryResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableContainerRegistryResourceGroupResource() { } + public virtual Azure.ResourceManager.ContainerRegistry.ContainerRegistryCollection GetContainerRegistries() { throw null; } + public virtual Azure.Response GetContainerRegistry(string registryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerRegistryAsync(string registryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableContainerRegistrySubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableContainerRegistrySubscriptionResource() { } + public virtual Azure.Response CheckContainerRegistryNameAvailability(Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistryNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckContainerRegistryNameAvailabilityAsync(Azure.ResourceManager.ContainerRegistry.Models.ContainerRegistryNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetContainerRegistries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerRegistriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ContainerRegistry.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolResource.cs index dfea0855878dc..9b11486b993ec 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryAgentPoolResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryAgentPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The agentPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string agentPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionResource.cs index 987053f8aef56..c47785697e880 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResource.cs index 569941fde8c41..bc461c18d7ec0 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/privateLinkResources/{groupName}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationResource.cs index 4ba5cb4e8633a..e091c709e3256 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryReplicationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryReplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The replicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string replicationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/replications/{replicationName}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryResource.cs index 0e90367aab1b2..7a8c56e53e6fd 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}"; @@ -102,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ContainerRegistryPrivateLinkResources and their operations over a ContainerRegistryPrivateLinkResource. public virtual ContainerRegistryPrivateLinkResourceCollection GetContainerRegistryPrivateLinkResources() { - return GetCachedClient(Client => new ContainerRegistryPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryPrivateLinkResourceCollection(client, Id)); } /// @@ -120,8 +123,8 @@ public virtual ContainerRegistryPrivateLinkResourceCollection GetContainerRegist /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryPrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -143,8 +146,8 @@ public virtual async Task> GetCon /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryPrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -155,7 +158,7 @@ public virtual Response GetContainerRegist /// An object representing collection of ContainerRegistryPrivateEndpointConnectionResources and their operations over a ContainerRegistryPrivateEndpointConnectionResource. public virtual ContainerRegistryPrivateEndpointConnectionCollection GetContainerRegistryPrivateEndpointConnections() { - return GetCachedClient(Client => new ContainerRegistryPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryPrivateEndpointConnectionCollection(client, Id)); } /// @@ -173,8 +176,8 @@ public virtual ContainerRegistryPrivateEndpointConnectionCollection GetContainer /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -196,8 +199,8 @@ public virtual async Task /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -208,7 +211,7 @@ public virtual Response GetC /// An object representing collection of ContainerRegistryReplicationResources and their operations over a ContainerRegistryReplicationResource. public virtual ContainerRegistryReplicationCollection GetContainerRegistryReplications() { - return GetCachedClient(Client => new ContainerRegistryReplicationCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryReplicationCollection(client, Id)); } /// @@ -226,8 +229,8 @@ public virtual ContainerRegistryReplicationCollection GetContainerRegistryReplic /// /// The name of the replication. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryReplicationAsync(string replicationName, CancellationToken cancellationToken = default) { @@ -249,8 +252,8 @@ public virtual async Task> GetCon /// /// The name of the replication. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryReplication(string replicationName, CancellationToken cancellationToken = default) { @@ -261,7 +264,7 @@ public virtual Response GetContainerRegist /// An object representing collection of ScopeMapResources and their operations over a ScopeMapResource. public virtual ScopeMapCollection GetScopeMaps() { - return GetCachedClient(Client => new ScopeMapCollection(Client, Id)); + return GetCachedClient(client => new ScopeMapCollection(client, Id)); } /// @@ -279,8 +282,8 @@ public virtual ScopeMapCollection GetScopeMaps() /// /// The name of the scope map. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetScopeMapAsync(string scopeMapName, CancellationToken cancellationToken = default) { @@ -302,8 +305,8 @@ public virtual async Task> GetScopeMapAsync(string sc /// /// The name of the scope map. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetScopeMap(string scopeMapName, CancellationToken cancellationToken = default) { @@ -314,7 +317,7 @@ public virtual Response GetScopeMap(string scopeMapName, Cance /// An object representing collection of ContainerRegistryTokenResources and their operations over a ContainerRegistryTokenResource. public virtual ContainerRegistryTokenCollection GetContainerRegistryTokens() { - return GetCachedClient(Client => new ContainerRegistryTokenCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryTokenCollection(client, Id)); } /// @@ -332,8 +335,8 @@ public virtual ContainerRegistryTokenCollection GetContainerRegistryTokens() /// /// The name of the token. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryTokenAsync(string tokenName, CancellationToken cancellationToken = default) { @@ -355,8 +358,8 @@ public virtual async Task> GetContainer /// /// The name of the token. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryToken(string tokenName, CancellationToken cancellationToken = default) { @@ -367,7 +370,7 @@ public virtual Response GetContainerRegistryToke /// An object representing collection of ContainerRegistryWebhookResources and their operations over a ContainerRegistryWebhookResource. public virtual ContainerRegistryWebhookCollection GetContainerRegistryWebhooks() { - return GetCachedClient(Client => new ContainerRegistryWebhookCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryWebhookCollection(client, Id)); } /// @@ -385,8 +388,8 @@ public virtual ContainerRegistryWebhookCollection GetContainerRegistryWebhooks() /// /// The name of the webhook. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryWebhookAsync(string webhookName, CancellationToken cancellationToken = default) { @@ -408,8 +411,8 @@ public virtual async Task> GetContain /// /// The name of the webhook. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryWebhook(string webhookName, CancellationToken cancellationToken = default) { @@ -420,7 +423,7 @@ public virtual Response GetContainerRegistryWe /// An object representing collection of ContainerRegistryAgentPoolResources and their operations over a ContainerRegistryAgentPoolResource. public virtual ContainerRegistryAgentPoolCollection GetContainerRegistryAgentPools() { - return GetCachedClient(Client => new ContainerRegistryAgentPoolCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryAgentPoolCollection(client, Id)); } /// @@ -438,8 +441,8 @@ public virtual ContainerRegistryAgentPoolCollection GetContainerRegistryAgentPoo /// /// The name of the agent pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryAgentPoolAsync(string agentPoolName, CancellationToken cancellationToken = default) { @@ -461,8 +464,8 @@ public virtual async Task> GetConta /// /// The name of the agent pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryAgentPool(string agentPoolName, CancellationToken cancellationToken = default) { @@ -473,7 +476,7 @@ public virtual Response GetContainerRegistry /// An object representing collection of ContainerRegistryRunResources and their operations over a ContainerRegistryRunResource. public virtual ContainerRegistryRunCollection GetContainerRegistryRuns() { - return GetCachedClient(Client => new ContainerRegistryRunCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryRunCollection(client, Id)); } /// @@ -491,8 +494,8 @@ public virtual ContainerRegistryRunCollection GetContainerRegistryRuns() /// /// The run ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryRunAsync(string runId, CancellationToken cancellationToken = default) { @@ -514,8 +517,8 @@ public virtual async Task> GetContainerRe /// /// The run ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryRun(string runId, CancellationToken cancellationToken = default) { @@ -526,7 +529,7 @@ public virtual Response GetContainerRegistryRun(st /// An object representing collection of ContainerRegistryTaskRunResources and their operations over a ContainerRegistryTaskRunResource. public virtual ContainerRegistryTaskRunCollection GetContainerRegistryTaskRuns() { - return GetCachedClient(Client => new ContainerRegistryTaskRunCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryTaskRunCollection(client, Id)); } /// @@ -544,8 +547,8 @@ public virtual ContainerRegistryTaskRunCollection GetContainerRegistryTaskRuns() /// /// The name of the task run. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryTaskRunAsync(string taskRunName, CancellationToken cancellationToken = default) { @@ -567,8 +570,8 @@ public virtual async Task> GetContain /// /// The name of the task run. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryTaskRun(string taskRunName, CancellationToken cancellationToken = default) { @@ -579,7 +582,7 @@ public virtual Response GetContainerRegistryTa /// An object representing collection of ContainerRegistryTaskResources and their operations over a ContainerRegistryTaskResource. public virtual ContainerRegistryTaskCollection GetContainerRegistryTasks() { - return GetCachedClient(Client => new ContainerRegistryTaskCollection(Client, Id)); + return GetCachedClient(client => new ContainerRegistryTaskCollection(client, Id)); } /// @@ -597,8 +600,8 @@ public virtual ContainerRegistryTaskCollection GetContainerRegistryTasks() /// /// The name of the container registry task. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerRegistryTaskAsync(string taskName, CancellationToken cancellationToken = default) { @@ -620,8 +623,8 @@ public virtual async Task> GetContainerR /// /// The name of the container registry task. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerRegistryTask(string taskName, CancellationToken cancellationToken = default) { diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunResource.cs index 2e4b016071b35..e32086a254b6a 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryRunResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryRunResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The runId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string runId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskResource.cs index fdda590edb826..d22d2da860205 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryTaskResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The taskName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string taskName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunResource.cs index f6f95f9d7047a..01454c52dad68 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTaskRunResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryTaskRunResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The taskRunName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string taskRunName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenResource.cs index 7bf2adde45152..1627f9efeed5f 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryTokenResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryTokenResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The tokenName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string tokenName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookResource.cs index 873d432101c02..3c0193f1e19ec 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryWebhookResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ContainerRegistryWebhookResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The webhookName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string webhookName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}"; diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/ContainerRegistryExtensions.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/ContainerRegistryExtensions.cs index ffdba75144ee6..196974fc56d34 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/ContainerRegistryExtensions.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/ContainerRegistryExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ContainerRegistry.Mocking; using Azure.ResourceManager.ContainerRegistry.Models; using Azure.ResourceManager.Resources; @@ -19,252 +20,209 @@ namespace Azure.ResourceManager.ContainerRegistry /// A class to add extension methods to Azure.ResourceManager.ContainerRegistry. public static partial class ContainerRegistryExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableContainerRegistryArmClient GetMockableContainerRegistryArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableContainerRegistryArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableContainerRegistryResourceGroupResource GetMockableContainerRegistryResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableContainerRegistryResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableContainerRegistrySubscriptionResource GetMockableContainerRegistrySubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableContainerRegistrySubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ContainerRegistryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryResource GetContainerRegistryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryResource.ValidateResourceId(id); - return new ContainerRegistryResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryResource(id); } - #endregion - #region ContainerRegistryPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryPrivateLinkResource GetContainerRegistryPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryPrivateLinkResource.ValidateResourceId(id); - return new ContainerRegistryPrivateLinkResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryPrivateLinkResource(id); } - #endregion - #region ContainerRegistryPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryPrivateEndpointConnectionResource GetContainerRegistryPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryPrivateEndpointConnectionResource.ValidateResourceId(id); - return new ContainerRegistryPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryPrivateEndpointConnectionResource(id); } - #endregion - #region ContainerRegistryReplicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryReplicationResource GetContainerRegistryReplicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryReplicationResource.ValidateResourceId(id); - return new ContainerRegistryReplicationResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryReplicationResource(id); } - #endregion - #region ScopeMapResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScopeMapResource GetScopeMapResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScopeMapResource.ValidateResourceId(id); - return new ScopeMapResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetScopeMapResource(id); } - #endregion - #region ContainerRegistryTokenResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryTokenResource GetContainerRegistryTokenResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryTokenResource.ValidateResourceId(id); - return new ContainerRegistryTokenResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryTokenResource(id); } - #endregion - #region ContainerRegistryWebhookResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryWebhookResource GetContainerRegistryWebhookResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryWebhookResource.ValidateResourceId(id); - return new ContainerRegistryWebhookResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryWebhookResource(id); } - #endregion - #region ContainerRegistryAgentPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryAgentPoolResource GetContainerRegistryAgentPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryAgentPoolResource.ValidateResourceId(id); - return new ContainerRegistryAgentPoolResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryAgentPoolResource(id); } - #endregion - #region ContainerRegistryRunResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryRunResource GetContainerRegistryRunResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryRunResource.ValidateResourceId(id); - return new ContainerRegistryRunResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryRunResource(id); } - #endregion - #region ContainerRegistryTaskRunResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryTaskRunResource GetContainerRegistryTaskRunResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryTaskRunResource.ValidateResourceId(id); - return new ContainerRegistryTaskRunResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryTaskRunResource(id); } - #endregion - #region ContainerRegistryTaskResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerRegistryTaskResource GetContainerRegistryTaskResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerRegistryTaskResource.ValidateResourceId(id); - return new ContainerRegistryTaskResource(client, id); - } - ); + return GetMockableContainerRegistryArmClient(client).GetContainerRegistryTaskResource(id); } - #endregion - /// Gets a collection of ContainerRegistryResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerRegistryResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerRegistryResources and their operations over a ContainerRegistryResource. public static ContainerRegistryCollection GetContainerRegistries(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerRegistries(); + return GetMockableContainerRegistryResourceGroupResource(resourceGroupResource).GetContainerRegistries(); } /// @@ -279,16 +237,20 @@ public static ContainerRegistryCollection GetContainerRegistries(this ResourceGr /// Registries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the container registry. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerRegistryAsync(this ResourceGroupResource resourceGroupResource, string registryName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerRegistries().GetAsync(registryName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerRegistryResourceGroupResource(resourceGroupResource).GetContainerRegistryAsync(registryName, cancellationToken).ConfigureAwait(false); } /// @@ -303,16 +265,20 @@ public static async Task> GetContainerRegist /// Registries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the container registry. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerRegistry(this ResourceGroupResource resourceGroupResource, string registryName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerRegistries().Get(registryName, cancellationToken); + return GetMockableContainerRegistryResourceGroupResource(resourceGroupResource).GetContainerRegistry(registryName, cancellationToken); } /// @@ -327,6 +293,10 @@ public static Response GetContainerRegistry(this Reso /// Registries_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The object containing information for the availability request. @@ -334,9 +304,7 @@ public static Response GetContainerRegistry(this Reso /// is null. public static async Task> CheckContainerRegistryNameAvailabilityAsync(this SubscriptionResource subscriptionResource, ContainerRegistryNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckContainerRegistryNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerRegistrySubscriptionResource(subscriptionResource).CheckContainerRegistryNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -351,6 +319,10 @@ public static async Task> CheckCo /// Registries_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The object containing information for the availability request. @@ -358,9 +330,7 @@ public static async Task> CheckCo /// is null. public static Response CheckContainerRegistryNameAvailability(this SubscriptionResource subscriptionResource, ContainerRegistryNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckContainerRegistryNameAvailability(content, cancellationToken); + return GetMockableContainerRegistrySubscriptionResource(subscriptionResource).CheckContainerRegistryNameAvailability(content, cancellationToken); } /// @@ -375,13 +345,17 @@ public static Response CheckContainerRegis /// Registries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerRegistriesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerRegistriesAsync(cancellationToken); + return GetMockableContainerRegistrySubscriptionResource(subscriptionResource).GetContainerRegistriesAsync(cancellationToken); } /// @@ -396,13 +370,17 @@ public static AsyncPageable GetContainerRegistriesAsy /// Registries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerRegistries(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerRegistries(cancellationToken); + return GetMockableContainerRegistrySubscriptionResource(subscriptionResource).GetContainerRegistries(cancellationToken); } } } diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistryArmClient.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistryArmClient.cs new file mode 100644 index 0000000000000..0feaf29515cdd --- /dev/null +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistryArmClient.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ContainerRegistry; + +namespace Azure.ResourceManager.ContainerRegistry.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableContainerRegistryArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContainerRegistryArmClient() + { + } + + /// 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 MockableContainerRegistryArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableContainerRegistryArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryResource GetContainerRegistryResource(ResourceIdentifier id) + { + ContainerRegistryResource.ValidateResourceId(id); + return new ContainerRegistryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryPrivateLinkResource GetContainerRegistryPrivateLinkResource(ResourceIdentifier id) + { + ContainerRegistryPrivateLinkResource.ValidateResourceId(id); + return new ContainerRegistryPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryPrivateEndpointConnectionResource GetContainerRegistryPrivateEndpointConnectionResource(ResourceIdentifier id) + { + ContainerRegistryPrivateEndpointConnectionResource.ValidateResourceId(id); + return new ContainerRegistryPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryReplicationResource GetContainerRegistryReplicationResource(ResourceIdentifier id) + { + ContainerRegistryReplicationResource.ValidateResourceId(id); + return new ContainerRegistryReplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScopeMapResource GetScopeMapResource(ResourceIdentifier id) + { + ScopeMapResource.ValidateResourceId(id); + return new ScopeMapResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryTokenResource GetContainerRegistryTokenResource(ResourceIdentifier id) + { + ContainerRegistryTokenResource.ValidateResourceId(id); + return new ContainerRegistryTokenResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryWebhookResource GetContainerRegistryWebhookResource(ResourceIdentifier id) + { + ContainerRegistryWebhookResource.ValidateResourceId(id); + return new ContainerRegistryWebhookResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryAgentPoolResource GetContainerRegistryAgentPoolResource(ResourceIdentifier id) + { + ContainerRegistryAgentPoolResource.ValidateResourceId(id); + return new ContainerRegistryAgentPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryRunResource GetContainerRegistryRunResource(ResourceIdentifier id) + { + ContainerRegistryRunResource.ValidateResourceId(id); + return new ContainerRegistryRunResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryTaskRunResource GetContainerRegistryTaskRunResource(ResourceIdentifier id) + { + ContainerRegistryTaskRunResource.ValidateResourceId(id); + return new ContainerRegistryTaskRunResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerRegistryTaskResource GetContainerRegistryTaskResource(ResourceIdentifier id) + { + ContainerRegistryTaskResource.ValidateResourceId(id); + return new ContainerRegistryTaskResource(Client, id); + } + } +} diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistryResourceGroupResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistryResourceGroupResource.cs new file mode 100644 index 0000000000000..630c64028d229 --- /dev/null +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistryResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ContainerRegistry; + +namespace Azure.ResourceManager.ContainerRegistry.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableContainerRegistryResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContainerRegistryResourceGroupResource() + { + } + + /// 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 MockableContainerRegistryResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ContainerRegistryResources in the ResourceGroupResource. + /// An object representing collection of ContainerRegistryResources and their operations over a ContainerRegistryResource. + public virtual ContainerRegistryCollection GetContainerRegistries() + { + return GetCachedClient(client => new ContainerRegistryCollection(client, Id)); + } + + /// + /// Gets the properties of the specified container registry. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName} + /// + /// + /// Operation Id + /// Registries_Get + /// + /// + /// + /// The name of the container registry. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerRegistryAsync(string registryName, CancellationToken cancellationToken = default) + { + return await GetContainerRegistries().GetAsync(registryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of the specified container registry. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName} + /// + /// + /// Operation Id + /// Registries_Get + /// + /// + /// + /// The name of the container registry. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerRegistry(string registryName, CancellationToken cancellationToken = default) + { + return GetContainerRegistries().Get(registryName, cancellationToken); + } + } +} diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistrySubscriptionResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistrySubscriptionResource.cs new file mode 100644 index 0000000000000..85c327d5c62df --- /dev/null +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/MockableContainerRegistrySubscriptionResource.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ContainerRegistry; +using Azure.ResourceManager.ContainerRegistry.Models; + +namespace Azure.ResourceManager.ContainerRegistry.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableContainerRegistrySubscriptionResource : ArmResource + { + private ClientDiagnostics _containerRegistryRegistriesClientDiagnostics; + private RegistriesRestOperations _containerRegistryRegistriesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableContainerRegistrySubscriptionResource() + { + } + + /// 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 MockableContainerRegistrySubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ContainerRegistryRegistriesClientDiagnostics => _containerRegistryRegistriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerRegistry", ContainerRegistryResource.ResourceType.Namespace, Diagnostics); + private RegistriesRestOperations ContainerRegistryRegistriesRestClient => _containerRegistryRegistriesRestClient ??= new RegistriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerRegistryResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability + /// + /// + /// Operation Id + /// Registries_CheckNameAvailability + /// + /// + /// + /// The object containing information for the availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckContainerRegistryNameAvailabilityAsync(ContainerRegistryNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ContainerRegistryRegistriesClientDiagnostics.CreateScope("MockableContainerRegistrySubscriptionResource.CheckContainerRegistryNameAvailability"); + scope.Start(); + try + { + var response = await ContainerRegistryRegistriesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability + /// + /// + /// Operation Id + /// Registries_CheckNameAvailability + /// + /// + /// + /// The object containing information for the availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckContainerRegistryNameAvailability(ContainerRegistryNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ContainerRegistryRegistriesClientDiagnostics.CreateScope("MockableContainerRegistrySubscriptionResource.CheckContainerRegistryNameAvailability"); + scope.Start(); + try + { + var response = ContainerRegistryRegistriesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the container registries under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries + /// + /// + /// Operation Id + /// Registries_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerRegistriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerRegistryRegistriesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerRegistryRegistriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), ContainerRegistryRegistriesClientDiagnostics, Pipeline, "MockableContainerRegistrySubscriptionResource.GetContainerRegistries", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the container registries under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries + /// + /// + /// Operation Id + /// Registries_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerRegistries(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerRegistryRegistriesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerRegistryRegistriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), ContainerRegistryRegistriesClientDiagnostics, Pipeline, "MockableContainerRegistrySubscriptionResource.GetContainerRegistries", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d33b5d4a11eed..0000000000000 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ContainerRegistry -{ - /// 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 ContainerRegistryResources in the ResourceGroupResource. - /// An object representing collection of ContainerRegistryResources and their operations over a ContainerRegistryResource. - public virtual ContainerRegistryCollection GetContainerRegistries() - { - return GetCachedClient(Client => new ContainerRegistryCollection(Client, Id)); - } - } -} diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 027fb12f1d783..0000000000000 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ContainerRegistry.Models; - -namespace Azure.ResourceManager.ContainerRegistry -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _containerRegistryRegistriesClientDiagnostics; - private RegistriesRestOperations _containerRegistryRegistriesRestClient; - - /// 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 ContainerRegistryRegistriesClientDiagnostics => _containerRegistryRegistriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerRegistry", ContainerRegistryResource.ResourceType.Namespace, Diagnostics); - private RegistriesRestOperations ContainerRegistryRegistriesRestClient => _containerRegistryRegistriesRestClient ??= new RegistriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerRegistryResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability - /// - /// - /// Operation Id - /// Registries_CheckNameAvailability - /// - /// - /// - /// The object containing information for the availability request. - /// The cancellation token to use. - public virtual async Task> CheckContainerRegistryNameAvailabilityAsync(ContainerRegistryNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ContainerRegistryRegistriesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckContainerRegistryNameAvailability"); - scope.Start(); - try - { - var response = await ContainerRegistryRegistriesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 50 characters in length. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability - /// - /// - /// Operation Id - /// Registries_CheckNameAvailability - /// - /// - /// - /// The object containing information for the availability request. - /// The cancellation token to use. - public virtual Response CheckContainerRegistryNameAvailability(ContainerRegistryNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ContainerRegistryRegistriesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckContainerRegistryNameAvailability"); - scope.Start(); - try - { - var response = ContainerRegistryRegistriesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all the container registries under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries - /// - /// - /// Operation Id - /// Registries_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerRegistriesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerRegistryRegistriesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerRegistryRegistriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), ContainerRegistryRegistriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerRegistries", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the container registries under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries - /// - /// - /// Operation Id - /// Registries_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerRegistries(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerRegistryRegistriesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerRegistryRegistriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerRegistryResource(Client, ContainerRegistryData.DeserializeContainerRegistryData(e)), ContainerRegistryRegistriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerRegistries", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapResource.cs index cc5c7147e4691..fb679679b43eb 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ScopeMapResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ContainerRegistry public partial class ScopeMapResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The scopeMapName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string scopeMapName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/api/Azure.ResourceManager.ContainerService.netstandard2.0.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/api/Azure.ResourceManager.ContainerService.netstandard2.0.cs index f0fd562420ab5..9e6ae56d00dbe 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/api/Azure.ResourceManager.ContainerService.netstandard2.0.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/api/Azure.ResourceManager.ContainerService.netstandard2.0.cs @@ -19,7 +19,7 @@ protected AgentPoolSnapshotCollection() { } } public partial class AgentPoolSnapshotData : Azure.ResourceManager.Models.TrackedResourceData { - public AgentPoolSnapshotData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AgentPoolSnapshotData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier CreationDataSourceResourceId { get { throw null; } set { } } public bool? EnableFips { get { throw null; } } public string KubernetesVersion { get { throw null; } } @@ -222,7 +222,7 @@ protected ContainerServiceFleetCollection() { } } public partial class ContainerServiceFleetData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerServiceFleetData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerServiceFleetData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.ContainerService.Models.ContainerServiceFleetHubProfile HubProfile { get { throw null; } set { } } public Azure.ResourceManager.ContainerService.Models.ContainerServiceFleetProvisioningState? ProvisioningState { get { throw null; } } @@ -347,7 +347,7 @@ protected ContainerServiceManagedClusterCollection() { } } public partial class ContainerServiceManagedClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerServiceManagedClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerServiceManagedClusterData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ContainerService.Models.ManagedClusterAadProfile AadProfile { get { throw null; } set { } } public System.Collections.Generic.IDictionary AddonProfiles { get { throw null; } } public System.Collections.Generic.IList AgentPoolProfiles { get { throw null; } } @@ -566,7 +566,7 @@ protected ManagedClusterSnapshotCollection() { } } public partial class ManagedClusterSnapshotData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedClusterSnapshotData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedClusterSnapshotData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier CreationDataSourceResourceId { get { throw null; } set { } } public Azure.ResourceManager.ContainerService.Models.ManagedClusterPropertiesForSnapshot ManagedClusterPropertiesReadOnly { get { throw null; } } public Azure.ResourceManager.ContainerService.Models.SnapshotType? SnapshotType { get { throw null; } set { } } @@ -623,6 +623,56 @@ protected OSOptionProfileResource() { } public virtual System.Threading.Tasks.Task> GetAsync(Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ContainerService.Mocking +{ + public partial class MockableContainerServiceArmClient : Azure.ResourceManager.ArmResource + { + protected MockableContainerServiceArmClient() { } + public virtual Azure.ResourceManager.ContainerService.AgentPoolSnapshotResource GetAgentPoolSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServiceAgentPoolResource GetContainerServiceAgentPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServiceFleetMemberResource GetContainerServiceFleetMemberResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServiceFleetResource GetContainerServiceFleetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServiceMaintenanceConfigurationResource GetContainerServiceMaintenanceConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServiceManagedClusterResource GetContainerServiceManagedClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServicePrivateEndpointConnectionResource GetContainerServicePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServiceTrustedAccessRoleBindingResource GetContainerServiceTrustedAccessRoleBindingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ManagedClusterSnapshotResource GetManagedClusterSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ManagedClusterUpgradeProfileResource GetManagedClusterUpgradeProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerService.OSOptionProfileResource GetOSOptionProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableContainerServiceResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableContainerServiceResourceGroupResource() { } + public virtual Azure.Response GetAgentPoolSnapshot(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAgentPoolSnapshotAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ContainerService.AgentPoolSnapshotCollection GetAgentPoolSnapshots() { throw null; } + public virtual Azure.Response GetContainerServiceFleet(string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerServiceFleetAsync(string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServiceFleetCollection GetContainerServiceFleets() { throw null; } + public virtual Azure.Response GetContainerServiceManagedCluster(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerServiceManagedClusterAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ContainerServiceManagedClusterCollection GetContainerServiceManagedClusters() { throw null; } + public virtual Azure.Response GetManagedClusterSnapshot(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedClusterSnapshotAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ContainerService.ManagedClusterSnapshotCollection GetManagedClusterSnapshots() { throw null; } + } + public partial class MockableContainerServiceSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableContainerServiceSubscriptionResource() { } + public virtual Azure.Pageable GetAgentPoolSnapshots(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAgentPoolSnapshotsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetContainerServiceFleets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerServiceFleetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetContainerServiceManagedClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerServiceManagedClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedClusterSnapshots(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedClusterSnapshotsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ContainerService.OSOptionProfileResource GetOSOptionProfile(Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Pageable GetTrustedAccessRoles(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTrustedAccessRolesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ContainerService.Models { public partial class AgentPoolAvailableVersion @@ -1507,7 +1557,7 @@ public ManagedClusterAadProfile() { } } public partial class ManagedClusterAccessProfile : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedClusterAccessProfile(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedClusterAccessProfile(Azure.Core.AzureLocation location) { } public byte[] KubeConfig { get { throw null; } set { } } } public partial class ManagedClusterAddonProfile diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/ContainerServiceExtensions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/ContainerServiceExtensions.cs index 56d6166f67a11..bd1d2b11c3a95 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/ContainerServiceExtensions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/ContainerServiceExtensions.cs @@ -18,7 +18,7 @@ public static partial class ContainerServiceExtensions /// Returns a object. public static OSOptionProfileResource GetOSOptionProfile(this SubscriptionResource subscriptionResource, AzureLocation location) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOSOptionProfile(location); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetOSOptionProfile(location); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/ContainerServiceSubscriptionMockingExtension.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/ContainerServiceSubscriptionMockingExtension.cs new file mode 100644 index 0000000000000..fc853321cba8f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/ContainerServiceSubscriptionMockingExtension.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + [CodeGenSuppress("GetOSOptionProfile")] + public partial class MockableContainerServiceSubscriptionResource : ArmResource + { + /// Gets an object representing a OSOptionProfileResource along with the instance operations that can be performed on it in the SubscriptionResource. + /// The name of Azure region. + /// Returns a object. + public virtual OSOptionProfileResource GetOSOptionProfile(AzureLocation location) + { + return new OSOptionProfileResource(Client, Id.AppendChildResource("locations", location).AppendChildResource("osOptions", "default")); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 8a5143aec7b4d..0000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Custom/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ContainerService -{ - /// A class to add extension methods to SubscriptionResource. - [CodeGenSuppress("GetOSOptionProfile")] - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - /// Gets an object representing a OSOptionProfileResource along with the instance operations that can be performed on it in the SubscriptionResource. - /// The name of Azure region. - /// Returns a object. - public virtual OSOptionProfileResource GetOSOptionProfile(AzureLocation location) - { - return new OSOptionProfileResource(Client, new ResourceIdentifier($"{Id.ToString()}/locations/{location}/osOptions/default")); - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs index 24f0654492c7b..b222cf076ba50 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ContainerService public partial class AgentPoolSnapshotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs index 5c27f2bdd31bd..27058fd3fe029 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerService public partial class AgentPoolUpgradeProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The agentPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs index 0027d25e5ce21..f564bb7ca5728 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ContainerService public partial class ContainerServiceAgentPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The agentPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberResource.cs index afa1037905bcd..cb3af35f608d9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetMemberResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerService public partial class ContainerServiceFleetMemberResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fleetName. + /// The fleetMemberName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetResource.cs index 64b183413ec1f..d607498c9decb 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ContainerService public partial class ContainerServiceFleetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fleetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ContainerServiceFleetMemberResources and their operations over a ContainerServiceFleetMemberResource. public virtual ContainerServiceFleetMemberCollection GetContainerServiceFleetMembers() { - return GetCachedClient(Client => new ContainerServiceFleetMemberCollection(Client, Id)); + return GetCachedClient(client => new ContainerServiceFleetMemberCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ContainerServiceFleetMemberCollection GetContainerServiceFleetMem /// /// The name of the Fleet member resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerServiceFleetMemberAsync(string fleetMemberName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetCont /// /// The name of the Fleet member resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerServiceFleetMember(string fleetMemberName, CancellationToken cancellationToken = default) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs index c8d0692a170ce..cec4bde7f518a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerService public partial class ContainerServiceMaintenanceConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The configName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string configName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs index 14d1ee5b623c6..f4bba23565c6c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ContainerService public partial class ContainerServiceManagedClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"; @@ -113,7 +116,7 @@ public virtual ManagedClusterUpgradeProfileResource GetManagedClusterUpgradeProf /// An object representing collection of ContainerServiceMaintenanceConfigurationResources and their operations over a ContainerServiceMaintenanceConfigurationResource. public virtual ContainerServiceMaintenanceConfigurationCollection GetContainerServiceMaintenanceConfigurations() { - return GetCachedClient(Client => new ContainerServiceMaintenanceConfigurationCollection(Client, Id)); + return GetCachedClient(client => new ContainerServiceMaintenanceConfigurationCollection(client, Id)); } /// @@ -131,8 +134,8 @@ public virtual ContainerServiceMaintenanceConfigurationCollection GetContainerSe /// /// The name of the maintenance configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerServiceMaintenanceConfigurationAsync(string configName, CancellationToken cancellationToken = default) { @@ -154,8 +157,8 @@ public virtual async Task /// The name of the maintenance configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerServiceMaintenanceConfiguration(string configName, CancellationToken cancellationToken = default) { @@ -166,7 +169,7 @@ public virtual Response GetCon /// An object representing collection of ContainerServiceAgentPoolResources and their operations over a ContainerServiceAgentPoolResource. public virtual ContainerServiceAgentPoolCollection GetContainerServiceAgentPools() { - return GetCachedClient(Client => new ContainerServiceAgentPoolCollection(Client, Id)); + return GetCachedClient(client => new ContainerServiceAgentPoolCollection(client, Id)); } /// @@ -184,8 +187,8 @@ public virtual ContainerServiceAgentPoolCollection GetContainerServiceAgentPools /// /// The name of the agent pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerServiceAgentPoolAsync(string agentPoolName, CancellationToken cancellationToken = default) { @@ -207,8 +210,8 @@ public virtual async Task> GetContai /// /// The name of the agent pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerServiceAgentPool(string agentPoolName, CancellationToken cancellationToken = default) { @@ -219,7 +222,7 @@ public virtual Response GetContainerServiceAg /// An object representing collection of ContainerServicePrivateEndpointConnectionResources and their operations over a ContainerServicePrivateEndpointConnectionResource. public virtual ContainerServicePrivateEndpointConnectionCollection GetContainerServicePrivateEndpointConnections() { - return GetCachedClient(Client => new ContainerServicePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ContainerServicePrivateEndpointConnectionCollection(client, Id)); } /// @@ -237,8 +240,8 @@ public virtual ContainerServicePrivateEndpointConnectionCollection GetContainerS /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerServicePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -260,8 +263,8 @@ public virtual async Task /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerServicePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -272,7 +275,7 @@ public virtual Response GetCo /// An object representing collection of ContainerServiceTrustedAccessRoleBindingResources and their operations over a ContainerServiceTrustedAccessRoleBindingResource. public virtual ContainerServiceTrustedAccessRoleBindingCollection GetContainerServiceTrustedAccessRoleBindings() { - return GetCachedClient(Client => new ContainerServiceTrustedAccessRoleBindingCollection(Client, Id)); + return GetCachedClient(client => new ContainerServiceTrustedAccessRoleBindingCollection(client, Id)); } /// @@ -290,8 +293,8 @@ public virtual ContainerServiceTrustedAccessRoleBindingCollection GetContainerSe /// /// The name of trusted access role binding. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerServiceTrustedAccessRoleBindingAsync(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) { @@ -313,8 +316,8 @@ public virtual async Task /// The name of trusted access role binding. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerServiceTrustedAccessRoleBinding(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) { diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs index aca255db1bc27..add06c6d3f7b9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerService public partial class ContainerServicePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs index a9fa6b4e63562..7a1ef9cbd3be9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerService public partial class ContainerServiceTrustedAccessRoleBindingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The trustedAccessRoleBindingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs index 134eff41d3c61..26d47abd7e16f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ContainerService.Mocking; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Resources; @@ -19,271 +20,225 @@ namespace Azure.ResourceManager.ContainerService /// A class to add extension methods to Azure.ResourceManager.ContainerService. public static partial class ContainerServiceExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableContainerServiceArmClient GetMockableContainerServiceArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableContainerServiceArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableContainerServiceResourceGroupResource GetMockableContainerServiceResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableContainerServiceResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableContainerServiceSubscriptionResource GetMockableContainerServiceSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableContainerServiceSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region OSOptionProfileResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OSOptionProfileResource GetOSOptionProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OSOptionProfileResource.ValidateResourceId(id); - return new OSOptionProfileResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetOSOptionProfileResource(id); } - #endregion - #region ManagedClusterUpgradeProfileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedClusterUpgradeProfileResource GetManagedClusterUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedClusterUpgradeProfileResource.ValidateResourceId(id); - return new ManagedClusterUpgradeProfileResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetManagedClusterUpgradeProfileResource(id); } - #endregion - #region ContainerServiceManagedClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceManagedClusterResource GetContainerServiceManagedClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceManagedClusterResource.ValidateResourceId(id); - return new ContainerServiceManagedClusterResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetContainerServiceManagedClusterResource(id); } - #endregion - #region ContainerServiceMaintenanceConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceMaintenanceConfigurationResource GetContainerServiceMaintenanceConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceMaintenanceConfigurationResource.ValidateResourceId(id); - return new ContainerServiceMaintenanceConfigurationResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetContainerServiceMaintenanceConfigurationResource(id); } - #endregion - #region ContainerServiceAgentPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceAgentPoolResource GetContainerServiceAgentPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceAgentPoolResource.ValidateResourceId(id); - return new ContainerServiceAgentPoolResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetContainerServiceAgentPoolResource(id); } - #endregion - #region AgentPoolUpgradeProfileResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AgentPoolUpgradeProfileResource.ValidateResourceId(id); - return new AgentPoolUpgradeProfileResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetAgentPoolUpgradeProfileResource(id); } - #endregion - #region ContainerServicePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServicePrivateEndpointConnectionResource GetContainerServicePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServicePrivateEndpointConnectionResource.ValidateResourceId(id); - return new ContainerServicePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetContainerServicePrivateEndpointConnectionResource(id); } - #endregion - #region AgentPoolSnapshotResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AgentPoolSnapshotResource GetAgentPoolSnapshotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AgentPoolSnapshotResource.ValidateResourceId(id); - return new AgentPoolSnapshotResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetAgentPoolSnapshotResource(id); } - #endregion - #region ManagedClusterSnapshotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedClusterSnapshotResource GetManagedClusterSnapshotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedClusterSnapshotResource.ValidateResourceId(id); - return new ManagedClusterSnapshotResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetManagedClusterSnapshotResource(id); } - #endregion - #region ContainerServiceTrustedAccessRoleBindingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceTrustedAccessRoleBindingResource GetContainerServiceTrustedAccessRoleBindingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceTrustedAccessRoleBindingResource.ValidateResourceId(id); - return new ContainerServiceTrustedAccessRoleBindingResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetContainerServiceTrustedAccessRoleBindingResource(id); } - #endregion - #region ContainerServiceFleetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceFleetResource GetContainerServiceFleetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceFleetResource.ValidateResourceId(id); - return new ContainerServiceFleetResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetContainerServiceFleetResource(id); } - #endregion - #region ContainerServiceFleetMemberResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceFleetMemberResource GetContainerServiceFleetMemberResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceFleetMemberResource.ValidateResourceId(id); - return new ContainerServiceFleetMemberResource(client, id); - } - ); + return GetMockableContainerServiceArmClient(client).GetContainerServiceFleetMemberResource(id); } - #endregion - /// Gets a collection of ContainerServiceManagedClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerServiceManagedClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerServiceManagedClusterResources and their operations over a ContainerServiceManagedClusterResource. public static ContainerServiceManagedClusterCollection GetContainerServiceManagedClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerServiceManagedClusters(); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceManagedClusters(); } /// @@ -298,16 +253,20 @@ public static ContainerServiceManagedClusterCollection GetContainerServiceManage /// ManagedClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerServiceManagedClusterAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerServiceManagedClusters().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceManagedClusterAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -322,24 +281,34 @@ public static async Task> GetCo /// ManagedClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerServiceManagedCluster(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerServiceManagedClusters().Get(resourceName, cancellationToken); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceManagedCluster(resourceName, cancellationToken); } - /// Gets a collection of AgentPoolSnapshotResources in the ResourceGroupResource. + /// + /// Gets a collection of AgentPoolSnapshotResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AgentPoolSnapshotResources and their operations over a AgentPoolSnapshotResource. public static AgentPoolSnapshotCollection GetAgentPoolSnapshots(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAgentPoolSnapshots(); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetAgentPoolSnapshots(); } /// @@ -354,16 +323,20 @@ public static AgentPoolSnapshotCollection GetAgentPoolSnapshots(this ResourceGro /// Snapshots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAgentPoolSnapshotAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAgentPoolSnapshots().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetAgentPoolSnapshotAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -378,24 +351,34 @@ public static async Task> GetAgentPoolSnapsh /// Snapshots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAgentPoolSnapshot(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAgentPoolSnapshots().Get(resourceName, cancellationToken); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetAgentPoolSnapshot(resourceName, cancellationToken); } - /// Gets a collection of ManagedClusterSnapshotResources in the ResourceGroupResource. + /// + /// Gets a collection of ManagedClusterSnapshotResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ManagedClusterSnapshotResources and their operations over a ManagedClusterSnapshotResource. public static ManagedClusterSnapshotCollection GetManagedClusterSnapshots(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetManagedClusterSnapshots(); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetManagedClusterSnapshots(); } /// @@ -410,16 +393,20 @@ public static ManagedClusterSnapshotCollection GetManagedClusterSnapshots(this R /// ManagedClusterSnapshots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedClusterSnapshotAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetManagedClusterSnapshots().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetManagedClusterSnapshotAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -434,24 +421,34 @@ public static async Task> GetManagedClu /// ManagedClusterSnapshots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedClusterSnapshot(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetManagedClusterSnapshots().Get(resourceName, cancellationToken); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetManagedClusterSnapshot(resourceName, cancellationToken); } - /// Gets a collection of ContainerServiceFleetResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerServiceFleetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerServiceFleetResources and their operations over a ContainerServiceFleetResource. public static ContainerServiceFleetCollection GetContainerServiceFleets(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerServiceFleets(); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceFleets(); } /// @@ -466,16 +463,20 @@ public static ContainerServiceFleetCollection GetContainerServiceFleets(this Res /// Fleets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Fleet resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerServiceFleetAsync(this ResourceGroupResource resourceGroupResource, string fleetName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerServiceFleets().GetAsync(fleetName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceFleetAsync(fleetName, cancellationToken).ConfigureAwait(false); } /// @@ -490,16 +491,20 @@ public static async Task> GetContainerSe /// Fleets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Fleet resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerServiceFleet(this ResourceGroupResource resourceGroupResource, string fleetName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerServiceFleets().Get(fleetName, cancellationToken); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceFleet(fleetName, cancellationToken); } /// @@ -514,13 +519,17 @@ public static Response GetContainerServiceFleet(t /// ManagedClusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerServiceManagedClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerServiceManagedClustersAsync(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetContainerServiceManagedClustersAsync(cancellationToken); } /// @@ -535,13 +544,17 @@ public static AsyncPageable GetContainer /// ManagedClusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerServiceManagedClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerServiceManagedClusters(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetContainerServiceManagedClusters(cancellationToken); } /// @@ -556,13 +569,17 @@ public static Pageable GetContainerServi /// Snapshots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAgentPoolSnapshotsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAgentPoolSnapshotsAsync(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetAgentPoolSnapshotsAsync(cancellationToken); } /// @@ -577,13 +594,17 @@ public static AsyncPageable GetAgentPoolSnapshotsAsyn /// Snapshots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAgentPoolSnapshots(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAgentPoolSnapshots(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetAgentPoolSnapshots(cancellationToken); } /// @@ -598,13 +619,17 @@ public static Pageable GetAgentPoolSnapshots(this Sub /// ManagedClusterSnapshots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedClusterSnapshotsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterSnapshotsAsync(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetManagedClusterSnapshotsAsync(cancellationToken); } /// @@ -619,13 +644,17 @@ public static AsyncPageable GetManagedClusterSna /// ManagedClusterSnapshots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedClusterSnapshots(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterSnapshots(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetManagedClusterSnapshots(cancellationToken); } /// @@ -640,6 +669,10 @@ public static Pageable GetManagedClusterSnapshot /// TrustedAccessRoles_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -647,7 +680,7 @@ public static Pageable GetManagedClusterSnapshot /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetTrustedAccessRolesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTrustedAccessRolesAsync(location, cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetTrustedAccessRolesAsync(location, cancellationToken); } /// @@ -662,6 +695,10 @@ public static AsyncPageable GetTrustedAccessR /// TrustedAccessRoles_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -669,7 +706,7 @@ public static AsyncPageable GetTrustedAccessR /// A collection of that may take multiple service requests to iterate over. public static Pageable GetTrustedAccessRoles(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTrustedAccessRoles(location, cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetTrustedAccessRoles(location, cancellationToken); } /// @@ -684,13 +721,17 @@ public static Pageable GetTrustedAccessRoles( /// Fleets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerServiceFleetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerServiceFleetsAsync(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetContainerServiceFleetsAsync(cancellationToken); } /// @@ -705,13 +746,17 @@ public static AsyncPageable GetContainerServiceFl /// Fleets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerServiceFleets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerServiceFleets(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetContainerServiceFleets(cancellationToken); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs new file mode 100644 index 0000000000000..c32dc1efc3f87 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ContainerService; + +namespace Azure.ResourceManager.ContainerService.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableContainerServiceArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContainerServiceArmClient() + { + } + + /// 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 MockableContainerServiceArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableContainerServiceArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OSOptionProfileResource GetOSOptionProfileResource(ResourceIdentifier id) + { + OSOptionProfileResource.ValidateResourceId(id); + return new OSOptionProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedClusterUpgradeProfileResource GetManagedClusterUpgradeProfileResource(ResourceIdentifier id) + { + ManagedClusterUpgradeProfileResource.ValidateResourceId(id); + return new ManagedClusterUpgradeProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceManagedClusterResource GetContainerServiceManagedClusterResource(ResourceIdentifier id) + { + ContainerServiceManagedClusterResource.ValidateResourceId(id); + return new ContainerServiceManagedClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceMaintenanceConfigurationResource GetContainerServiceMaintenanceConfigurationResource(ResourceIdentifier id) + { + ContainerServiceMaintenanceConfigurationResource.ValidateResourceId(id); + return new ContainerServiceMaintenanceConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceAgentPoolResource GetContainerServiceAgentPoolResource(ResourceIdentifier id) + { + ContainerServiceAgentPoolResource.ValidateResourceId(id); + return new ContainerServiceAgentPoolResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfileResource(ResourceIdentifier id) + { + AgentPoolUpgradeProfileResource.ValidateResourceId(id); + return new AgentPoolUpgradeProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServicePrivateEndpointConnectionResource GetContainerServicePrivateEndpointConnectionResource(ResourceIdentifier id) + { + ContainerServicePrivateEndpointConnectionResource.ValidateResourceId(id); + return new ContainerServicePrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AgentPoolSnapshotResource GetAgentPoolSnapshotResource(ResourceIdentifier id) + { + AgentPoolSnapshotResource.ValidateResourceId(id); + return new AgentPoolSnapshotResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedClusterSnapshotResource GetManagedClusterSnapshotResource(ResourceIdentifier id) + { + ManagedClusterSnapshotResource.ValidateResourceId(id); + return new ManagedClusterSnapshotResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceTrustedAccessRoleBindingResource GetContainerServiceTrustedAccessRoleBindingResource(ResourceIdentifier id) + { + ContainerServiceTrustedAccessRoleBindingResource.ValidateResourceId(id); + return new ContainerServiceTrustedAccessRoleBindingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceFleetResource GetContainerServiceFleetResource(ResourceIdentifier id) + { + ContainerServiceFleetResource.ValidateResourceId(id); + return new ContainerServiceFleetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceFleetMemberResource GetContainerServiceFleetMemberResource(ResourceIdentifier id) + { + ContainerServiceFleetMemberResource.ValidateResourceId(id); + return new ContainerServiceFleetMemberResource(Client, id); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs new file mode 100644 index 0000000000000..11b8e5ca495eb --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs @@ -0,0 +1,251 @@ +// 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.ContainerService; + +namespace Azure.ResourceManager.ContainerService.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableContainerServiceResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContainerServiceResourceGroupResource() + { + } + + /// 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 MockableContainerServiceResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ContainerServiceManagedClusterResources in the ResourceGroupResource. + /// An object representing collection of ContainerServiceManagedClusterResources and their operations over a ContainerServiceManagedClusterResource. + public virtual ContainerServiceManagedClusterCollection GetContainerServiceManagedClusters() + { + return GetCachedClient(client => new ContainerServiceManagedClusterCollection(client, Id)); + } + + /// + /// Gets a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusters_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerServiceManagedClusterAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetContainerServiceManagedClusters().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusters_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerServiceManagedCluster(string resourceName, CancellationToken cancellationToken = default) + { + return GetContainerServiceManagedClusters().Get(resourceName, cancellationToken); + } + + /// Gets a collection of AgentPoolSnapshotResources in the ResourceGroupResource. + /// An object representing collection of AgentPoolSnapshotResources and their operations over a AgentPoolSnapshotResource. + public virtual AgentPoolSnapshotCollection GetAgentPoolSnapshots() + { + return GetCachedClient(client => new AgentPoolSnapshotCollection(client, Id)); + } + + /// + /// Gets a snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAgentPoolSnapshotAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetAgentPoolSnapshots().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} + /// + /// + /// Operation Id + /// Snapshots_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAgentPoolSnapshot(string resourceName, CancellationToken cancellationToken = default) + { + return GetAgentPoolSnapshots().Get(resourceName, cancellationToken); + } + + /// Gets a collection of ManagedClusterSnapshotResources in the ResourceGroupResource. + /// An object representing collection of ManagedClusterSnapshotResources and their operations over a ManagedClusterSnapshotResource. + public virtual ManagedClusterSnapshotCollection GetManagedClusterSnapshots() + { + return GetCachedClient(client => new ManagedClusterSnapshotCollection(client, Id)); + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedClusterSnapshotAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetManagedClusterSnapshots().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName} + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_Get + /// + /// + /// + /// The name of the managed cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedClusterSnapshot(string resourceName, CancellationToken cancellationToken = default) + { + return GetManagedClusterSnapshots().Get(resourceName, cancellationToken); + } + + /// Gets a collection of ContainerServiceFleetResources in the ResourceGroupResource. + /// An object representing collection of ContainerServiceFleetResources and their operations over a ContainerServiceFleetResource. + public virtual ContainerServiceFleetCollection GetContainerServiceFleets() + { + return GetCachedClient(client => new ContainerServiceFleetCollection(client, Id)); + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerServiceFleetAsync(string fleetName, CancellationToken cancellationToken = default) + { + return await GetContainerServiceFleets().GetAsync(fleetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerServiceFleet(string fleetName, CancellationToken cancellationToken = default) + { + return GetContainerServiceFleets().Get(fleetName, cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs new file mode 100644 index 0000000000000..e1bd1d0df5624 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ContainerService; +using Azure.ResourceManager.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableContainerServiceSubscriptionResource : ArmResource + { + private ClientDiagnostics _containerServiceManagedClusterManagedClustersClientDiagnostics; + private ManagedClustersRestOperations _containerServiceManagedClusterManagedClustersRestClient; + private ClientDiagnostics _agentPoolSnapshotSnapshotsClientDiagnostics; + private SnapshotsRestOperations _agentPoolSnapshotSnapshotsRestClient; + private ClientDiagnostics _managedClusterSnapshotClientDiagnostics; + private ManagedClusterSnapshotsRestOperations _managedClusterSnapshotRestClient; + private ClientDiagnostics _trustedAccessRolesClientDiagnostics; + private TrustedAccessRolesRestOperations _trustedAccessRolesRestClient; + private ClientDiagnostics _containerServiceFleetFleetsClientDiagnostics; + private FleetsRestOperations _containerServiceFleetFleetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableContainerServiceSubscriptionResource() + { + } + + /// 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 MockableContainerServiceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ContainerServiceManagedClusterManagedClustersClientDiagnostics => _containerServiceManagedClusterManagedClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceManagedClusterResource.ResourceType.Namespace, Diagnostics); + private ManagedClustersRestOperations ContainerServiceManagedClusterManagedClustersRestClient => _containerServiceManagedClusterManagedClustersRestClient ??= new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerServiceManagedClusterResource.ResourceType)); + private ClientDiagnostics AgentPoolSnapshotSnapshotsClientDiagnostics => _agentPoolSnapshotSnapshotsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", AgentPoolSnapshotResource.ResourceType.Namespace, Diagnostics); + private SnapshotsRestOperations AgentPoolSnapshotSnapshotsRestClient => _agentPoolSnapshotSnapshotsRestClient ??= new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AgentPoolSnapshotResource.ResourceType)); + private ClientDiagnostics ManagedClusterSnapshotClientDiagnostics => _managedClusterSnapshotClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ManagedClusterSnapshotResource.ResourceType.Namespace, Diagnostics); + private ManagedClusterSnapshotsRestOperations ManagedClusterSnapshotRestClient => _managedClusterSnapshotRestClient ??= new ManagedClusterSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedClusterSnapshotResource.ResourceType)); + private ClientDiagnostics TrustedAccessRolesClientDiagnostics => _trustedAccessRolesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private TrustedAccessRolesRestOperations TrustedAccessRolesRestClient => _trustedAccessRolesRestClient ??= new TrustedAccessRolesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ContainerServiceFleetFleetsClientDiagnostics => _containerServiceFleetFleetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceFleetResource.ResourceType.Namespace, Diagnostics); + private FleetsRestOperations ContainerServiceFleetFleetsRestClient => _containerServiceFleetFleetsRestClient ??= new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerServiceFleetResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets a list of managed clusters in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters + /// + /// + /// Operation Id + /// ManagedClusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerServiceManagedClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of managed clusters in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters + /// + /// + /// Operation Id + /// ManagedClusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerServiceManagedClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots + /// + /// + /// Operation Id + /// Snapshots_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAgentPoolSnapshotsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AgentPoolSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgentPoolSnapshotSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots + /// + /// + /// Operation Id + /// Snapshots_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAgentPoolSnapshots(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AgentPoolSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgentPoolSnapshotSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedClusterSnapshotsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterSnapshotRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedClusterSnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots + /// + /// + /// Operation Id + /// ManagedClusterSnapshots_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedClusterSnapshots(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterSnapshotRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedClusterSnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); + } + + /// + /// List supported trusted access roles. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles + /// + /// + /// Operation Id + /// TrustedAccessRoles_List + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetTrustedAccessRolesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TrustedAccessRolesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrustedAccessRolesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ContainerServiceTrustedAccessRole.DeserializeContainerServiceTrustedAccessRole, TrustedAccessRolesClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetTrustedAccessRoles", "value", "nextLink", cancellationToken); + } + + /// + /// List supported trusted access roles. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles + /// + /// + /// Operation Id + /// TrustedAccessRoles_List + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetTrustedAccessRoles(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TrustedAccessRolesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrustedAccessRolesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ContainerServiceTrustedAccessRole.DeserializeContainerServiceTrustedAccessRole, TrustedAccessRolesClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetTrustedAccessRoles", "value", "nextLink", cancellationToken); + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerServiceFleetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetContainerServiceFleets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerServiceFleets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetContainerServiceFleets", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 8ac7a7df2f7dc..0000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ContainerService -{ - /// 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 ContainerServiceManagedClusterResources in the ResourceGroupResource. - /// An object representing collection of ContainerServiceManagedClusterResources and their operations over a ContainerServiceManagedClusterResource. - public virtual ContainerServiceManagedClusterCollection GetContainerServiceManagedClusters() - { - return GetCachedClient(Client => new ContainerServiceManagedClusterCollection(Client, Id)); - } - - /// Gets a collection of AgentPoolSnapshotResources in the ResourceGroupResource. - /// An object representing collection of AgentPoolSnapshotResources and their operations over a AgentPoolSnapshotResource. - public virtual AgentPoolSnapshotCollection GetAgentPoolSnapshots() - { - return GetCachedClient(Client => new AgentPoolSnapshotCollection(Client, Id)); - } - - /// Gets a collection of ManagedClusterSnapshotResources in the ResourceGroupResource. - /// An object representing collection of ManagedClusterSnapshotResources and their operations over a ManagedClusterSnapshotResource. - public virtual ManagedClusterSnapshotCollection GetManagedClusterSnapshots() - { - return GetCachedClient(Client => new ManagedClusterSnapshotCollection(Client, Id)); - } - - /// Gets a collection of ContainerServiceFleetResources in the ResourceGroupResource. - /// An object representing collection of ContainerServiceFleetResources and their operations over a ContainerServiceFleetResource. - public virtual ContainerServiceFleetCollection GetContainerServiceFleets() - { - return GetCachedClient(Client => new ContainerServiceFleetCollection(Client, Id)); - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 00ff449ba0c86..0000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ContainerService.Models; - -namespace Azure.ResourceManager.ContainerService -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _containerServiceManagedClusterManagedClustersClientDiagnostics; - private ManagedClustersRestOperations _containerServiceManagedClusterManagedClustersRestClient; - private ClientDiagnostics _agentPoolSnapshotSnapshotsClientDiagnostics; - private SnapshotsRestOperations _agentPoolSnapshotSnapshotsRestClient; - private ClientDiagnostics _managedClusterSnapshotClientDiagnostics; - private ManagedClusterSnapshotsRestOperations _managedClusterSnapshotRestClient; - private ClientDiagnostics _trustedAccessRolesClientDiagnostics; - private TrustedAccessRolesRestOperations _trustedAccessRolesRestClient; - private ClientDiagnostics _containerServiceFleetFleetsClientDiagnostics; - private FleetsRestOperations _containerServiceFleetFleetsRestClient; - - /// 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 ContainerServiceManagedClusterManagedClustersClientDiagnostics => _containerServiceManagedClusterManagedClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceManagedClusterResource.ResourceType.Namespace, Diagnostics); - private ManagedClustersRestOperations ContainerServiceManagedClusterManagedClustersRestClient => _containerServiceManagedClusterManagedClustersRestClient ??= new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerServiceManagedClusterResource.ResourceType)); - private ClientDiagnostics AgentPoolSnapshotSnapshotsClientDiagnostics => _agentPoolSnapshotSnapshotsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", AgentPoolSnapshotResource.ResourceType.Namespace, Diagnostics); - private SnapshotsRestOperations AgentPoolSnapshotSnapshotsRestClient => _agentPoolSnapshotSnapshotsRestClient ??= new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AgentPoolSnapshotResource.ResourceType)); - private ClientDiagnostics ManagedClusterSnapshotClientDiagnostics => _managedClusterSnapshotClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ManagedClusterSnapshotResource.ResourceType.Namespace, Diagnostics); - private ManagedClusterSnapshotsRestOperations ManagedClusterSnapshotRestClient => _managedClusterSnapshotRestClient ??= new ManagedClusterSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedClusterSnapshotResource.ResourceType)); - private ClientDiagnostics TrustedAccessRolesClientDiagnostics => _trustedAccessRolesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private TrustedAccessRolesRestOperations TrustedAccessRolesRestClient => _trustedAccessRolesRestClient ??= new TrustedAccessRolesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ContainerServiceFleetFleetsClientDiagnostics => _containerServiceFleetFleetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceFleetResource.ResourceType.Namespace, Diagnostics); - private FleetsRestOperations ContainerServiceFleetFleetsRestClient => _containerServiceFleetFleetsRestClient ??= new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerServiceFleetResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets a list of managed clusters in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters - /// - /// - /// Operation Id - /// ManagedClusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerServiceManagedClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of managed clusters in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters - /// - /// - /// Operation Id - /// ManagedClusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerServiceManagedClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of snapshots in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAgentPoolSnapshotsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AgentPoolSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgentPoolSnapshotSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of snapshots in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAgentPoolSnapshots(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AgentPoolSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgentPoolSnapshotSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of managed cluster snapshots in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots - /// - /// - /// Operation Id - /// ManagedClusterSnapshots_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedClusterSnapshotsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterSnapshotRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedClusterSnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of managed cluster snapshots in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots - /// - /// - /// Operation Id - /// ManagedClusterSnapshots_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedClusterSnapshots(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterSnapshotRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedClusterSnapshotRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedClusterSnapshotResource(Client, ManagedClusterSnapshotData.DeserializeManagedClusterSnapshotData(e)), ManagedClusterSnapshotClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterSnapshots", "value", "nextLink", cancellationToken); - } - - /// - /// List supported trusted access roles. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles - /// - /// - /// Operation Id - /// TrustedAccessRoles_List - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetTrustedAccessRolesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TrustedAccessRolesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrustedAccessRolesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ContainerServiceTrustedAccessRole.DeserializeContainerServiceTrustedAccessRole, TrustedAccessRolesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTrustedAccessRoles", "value", "nextLink", cancellationToken); - } - - /// - /// List supported trusted access roles. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles - /// - /// - /// Operation Id - /// TrustedAccessRoles_List - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetTrustedAccessRoles(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TrustedAccessRolesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrustedAccessRolesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ContainerServiceTrustedAccessRole.DeserializeContainerServiceTrustedAccessRole, TrustedAccessRolesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTrustedAccessRoles", "value", "nextLink", cancellationToken); - } - - /// - /// Lists fleets in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets - /// - /// - /// Operation Id - /// Fleets_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerServiceFleetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceFleets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists fleets in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets - /// - /// - /// Operation Id - /// Fleets_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerServiceFleets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceFleets", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.cs index 82effdd11c064..bd9bb0072126c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterSnapshotResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ContainerService public partial class ManagedClusterSnapshotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs index e6df1ec8c03b8..fee9f9009e817 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ContainerService public partial class ManagedClusterUpgradeProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs index 5f681700d5df3..991898ca9e89c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.ContainerService public partial class OSOptionProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"; diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/CHANGELOG.md b/sdk/core/Azure.Core.Expressions.DataFactory/CHANGELOG.md index 856fa25dbd73d..24da6b66149e1 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/CHANGELOG.md +++ b/sdk/core/Azure.Core.Expressions.DataFactory/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 1.0.0-beta.6 (Unreleased) - -### Features Added - -### Breaking Changes +## 1.0.0-beta.6 (2023-11-02) ### Bugs Fixed -### Other Changes +- Fixed deserialization of `DataFactoryElement` properties where the underlying data + is not a JSON object. ## 1.0.0-beta.5 (2023-08-15) diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryElementJsonConverter.cs b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryElementJsonConverter.cs index b2a332c6aac26..5fcfd6919a9df 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryElementJsonConverter.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/src/DataFactoryElementJsonConverter.cs @@ -330,7 +330,7 @@ private static void SerializeExpression(Utf8JsonWriter writer, string value) return new DataFactoryElement((T)(object)new Uri(json.GetString()!)); } - if (typeof(T) == typeof(BinaryData) && json.ValueKind == JsonValueKind.Object) + if (typeof(T) == typeof(BinaryData)) { return new DataFactoryElement((T)(object)BinaryData.FromString(json.GetRawText()!)); } diff --git a/sdk/core/Azure.Core.Expressions.DataFactory/tests/DataFactoryElementTests.cs b/sdk/core/Azure.Core.Expressions.DataFactory/tests/DataFactoryElementTests.cs index 9422ffc720b95..8fa7a04bef2a8 100644 --- a/sdk/core/Azure.Core.Expressions.DataFactory/tests/DataFactoryElementTests.cs +++ b/sdk/core/Azure.Core.Expressions.DataFactory/tests/DataFactoryElementTests.cs @@ -491,6 +491,22 @@ public void SerializationOfBinaryDataValue() Assert.AreEqual(BinaryDataValue.ToString(), actual); } + [Test] + public void BinaryDataCanHandleNonObjectsValues() + { + var docString = JsonDocument.Parse(StringJson); + var dfeString = DataFactoryElementJsonConverter.Deserialize(docString.RootElement)!; + Assert.AreEqual(StringJson, JsonSerializer.Serialize(dfeString)); + + var docBool = JsonDocument.Parse(BoolJson); + var dfeBool = DataFactoryElementJsonConverter.Deserialize(docBool.RootElement)!; + Assert.AreEqual(BoolJson, JsonSerializer.Serialize(dfeBool)); + + var docInt = JsonDocument.Parse(IntJson); + var dfeInt = DataFactoryElementJsonConverter.Deserialize(docInt.RootElement)!; + Assert.AreEqual(IntJson, JsonSerializer.Serialize(dfeInt)); + } + [Test] public void SerializationOfListOfT() { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln index 9ae1f8ab8d554..a9fe917991c9d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/Azure.ResourceManager.CosmosDB.sln @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Cosmo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.CosmosDB.Tests", "tests\Azure.ResourceManager.CosmosDB.Tests.csproj", "{3EC07824-4ECC-4909-8F2A-4796B3B157C6}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.CosmosDB.Samples", "samples\Azure.ResourceManager.CosmosDB.Samples.csproj", "{049D538F-4379-460C-B178-1946BE1AD737}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -19,18 +21,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x64.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x64.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x86.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x86.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.Build.0 = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x64.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x64.Build.0 = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x86.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x86.Build.0 = Release|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -67,6 +57,18 @@ Global {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x64.Build.0 = Release|Any CPU {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x86.ActiveCfg = Release|Any CPU {3EC07824-4ECC-4909-8F2A-4796B3B157C6}.Release|x86.Build.0 = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|Any CPU.Build.0 = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|x64.ActiveCfg = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|x64.Build.0 = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|x86.ActiveCfg = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Debug|x86.Build.0 = Debug|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|Any CPU.ActiveCfg = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|Any CPU.Build.0 = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|x64.ActiveCfg = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|x64.Build.0 = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|x86.ActiveCfg = Release|Any CPU + {049D538F-4379-460C-B178-1946BE1AD737}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md index 7028584ddeae8..a3d1caa5ce877 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.4.0-beta.4 (Unreleased) +## 1.4.0-beta.5 (Unreleased) ### Features Added @@ -10,12 +10,24 @@ ### Other Changes +## 1.4.0-beta.4 (2023-10-30) + +### Features Added + +- Upgraded api-version tag from 'package-preview-2023-03-15' to 'package-preview-2023-09'. Tag detail available at https://github.com/Azure/azure-rest-api-specs/blob/35215554aef59a30fa709e4b058931101a5ef26b/specification/cosmos-db/resource-manager/readme.md + +### Other Changes + +- Upgraded Azure.Core from 1.34.0 to 1.35.0 + ## 1.4.0-beta.3 (2023-07-31) ### Features Added + - Updated Microsoft.DocumentDB RP API version to `2023-03-15-preview` - Adds support for Database partition merge operation. - Adds support for Materialized view in Collections. + ## 1.4.0-beta.2 (2023-05-29) ### Features Added @@ -32,6 +44,7 @@ - Upgraded dependent Azure.ResourceManager to 1.6.0. ## 1.4.0-beta.1 (2023-04-28) + ### Features Added - Updated Microsoft.DocumentDB RP API version to `2022-11-15-preview` @@ -183,7 +196,3 @@ This package follows the [new Azure SDK guidelines](https://azure.github.io/azur 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). - - - - diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs index b6e60b8e55f4c..17d98dd09df3c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs @@ -1,35 +1,5 @@ namespace Azure.ResourceManager.CosmosDB { - public partial class CassandraClusterBackupResource : Azure.ResourceManager.ArmResource - { - public static readonly Azure.Core.ResourceType ResourceType; - protected CassandraClusterBackupResource() { } - public virtual Azure.ResourceManager.CosmosDB.CassandraClusterBackupResourceData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string backupId) { 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 partial class CassandraClusterBackupResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected CassandraClusterBackupResourceCollection() { } - public virtual Azure.Response Exists(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string backupId, 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 backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string backupId, 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 CassandraClusterBackupResourceData : Azure.ResourceManager.Models.ResourceData - { - public CassandraClusterBackupResourceData() { } - public System.DateTimeOffset? BackupResourceTimestamp { get { throw null; } set { } } - } public partial class CassandraClusterCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected CassandraClusterCollection() { } @@ -49,7 +19,7 @@ protected CassandraClusterCollection() { } } public partial class CassandraClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public CassandraClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CassandraClusterData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CassandraClusterProperties Properties { get { throw null; } set { } } } @@ -62,15 +32,20 @@ protected CassandraClusterResource() { } 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 clusterName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Deallocate(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeallocateAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Deallocate(Azure.WaitUntil waitUntil, bool? xMsForceDeallocate = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.ResourceManager.ArmOperation Deallocate(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual System.Threading.Tasks.Task DeallocateAsync(Azure.WaitUntil waitUntil, bool? xMsForceDeallocate = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual System.Threading.Tasks.Task DeallocateAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken) { 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 GetCassandraClusterBackupResource(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetCassandraClusterBackupResourceAsync(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.CosmosDB.CassandraClusterBackupResourceCollection GetCassandraClusterBackupResources() { throw null; } + public virtual Azure.Response GetBackup(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupAsync(string backupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBackups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBackupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetCassandraDataCenter(string dataCenterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetCassandraDataCenterAsync(string dataCenterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.CosmosDB.CassandraDataCenterCollection GetCassandraDataCenters() { throw null; } @@ -142,7 +117,7 @@ protected CassandraKeyspaceCollection() { } } public partial class CassandraKeyspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public CassandraKeyspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CassandraKeyspaceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CassandraKeyspacePropertiesConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedCassandraKeyspaceResourceInfo Resource { get { throw null; } set { } } @@ -215,7 +190,7 @@ protected CassandraTableCollection() { } } public partial class CassandraTableData : Azure.ResourceManager.Models.TrackedResourceData { - public CassandraTableData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CassandraTableData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CassandraTablePropertiesConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedCassandraTableResourceInfo Resource { get { throw null; } set { } } @@ -282,7 +257,7 @@ protected CassandraViewGetResultCollection() { } } public partial class CassandraViewGetResultData : Azure.ResourceManager.Models.TrackedResourceData { - public CassandraViewGetResultData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CassandraViewGetResultData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CassandraViewGetPropertiesOptions Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CassandraViewGetPropertiesResource Resource { get { throw null; } set { } } @@ -349,7 +324,7 @@ protected CosmosDBAccountCollection() { } } public partial class CosmosDBAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBAccountData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? AnalyticalStorageSchemaType { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? ApiServerVersion { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy BackupPolicy { get { throw null; } set { } } @@ -359,8 +334,10 @@ public CosmosDBAccountData(Azure.Core.AzureLocation location) : base (default(Az public Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy ConsistencyPolicy { get { throw null; } set { } } public System.Collections.Generic.IList Cors { get { throw null; } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? CreateMode { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? CustomerManagedKeyStatus { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType? DatabaseAccountOfferType { get { throw null; } } public string DefaultIdentity { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? DefaultPriorityLevel { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? DiagnosticLogEnableFullTextQuery { get { throw null; } set { } } public bool? DisableKeyBasedMetadataWriteAccess { get { throw null; } set { } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -371,6 +348,7 @@ public CosmosDBAccountData(Azure.Core.AzureLocation location) : base (default(Az public bool? EnableMaterializedViews { get { throw null; } set { } } public bool? EnableMultipleWriteLocations { get { throw null; } set { } } public bool? EnablePartitionMerge { get { throw null; } set { } } + public bool? EnablePriorityBasedExecution { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList FailoverPolicies { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Guid? InstanceId { get { throw null; } } @@ -513,7 +491,6 @@ public static partial class CosmosDBExtensions public static System.Threading.Tasks.Task> CheckNameExistsDatabaseAccountAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetCassandraCluster(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetCassandraClusterAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.ResourceManager.CosmosDB.CassandraClusterBackupResource GetCassandraClusterBackupResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.CosmosDB.CassandraClusterResource GetCassandraClusterResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.CosmosDB.CassandraClusterCollection GetCassandraClusters(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetCassandraClusters(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -806,7 +783,7 @@ protected CosmosDBSqlContainerCollection() { } } public partial class CosmosDBSqlContainerData : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlContainerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlContainerData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlContainerPropertiesConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedCosmosDBSqlContainerResourceInfo Resource { get { throw null; } set { } } @@ -890,7 +867,7 @@ protected CosmosDBSqlDatabaseCollection() { } } public partial class CosmosDBSqlDatabaseData : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlDatabaseData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlDatabaseData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlDatabasePropertiesConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedCosmosDBSqlDatabaseResourceInfo Resource { get { throw null; } set { } } @@ -1046,7 +1023,7 @@ protected CosmosDBSqlStoredProcedureCollection() { } } public partial class CosmosDBSqlStoredProcedureData : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlStoredProcedureData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlStoredProcedureData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedCosmosDBSqlStoredProcedureResourceInfo Resource { get { throw null; } set { } } } @@ -1089,7 +1066,7 @@ protected CosmosDBSqlTriggerCollection() { } } public partial class CosmosDBSqlTriggerData : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlTriggerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlTriggerData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedCosmosDBSqlTriggerResourceInfo Resource { get { throw null; } set { } } } @@ -1132,7 +1109,7 @@ protected CosmosDBSqlUserDefinedFunctionCollection() { } } public partial class CosmosDBSqlUserDefinedFunctionData : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlUserDefinedFunctionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlUserDefinedFunctionData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo Resource { get { throw null; } set { } } } @@ -1175,7 +1152,7 @@ protected CosmosDBTableCollection() { } } public partial class CosmosDBTableData : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBTableData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBTableData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBTablePropertiesOptions Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBTablePropertiesResource Resource { get { throw null; } set { } } @@ -1292,7 +1269,7 @@ protected GraphResourceGetResultCollection() { } } public partial class GraphResourceGetResultData : Azure.ResourceManager.Models.TrackedResourceData { - public GraphResourceGetResultData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GraphResourceGetResultData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.GraphResourceGetPropertiesOptions Options { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } set { } } @@ -1336,7 +1313,7 @@ protected GremlinDatabaseCollection() { } } public partial class GremlinDatabaseData : Azure.ResourceManager.Models.TrackedResourceData { - public GremlinDatabaseData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GremlinDatabaseData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.GremlinDatabasePropertiesConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedGremlinDatabaseResourceInfo Resource { get { throw null; } set { } } @@ -1406,7 +1383,7 @@ protected GremlinGraphCollection() { } } public partial class GremlinGraphData : Azure.ResourceManager.Models.TrackedResourceData { - public GremlinGraphData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GremlinGraphData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.GremlinGraphPropertiesConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedGremlinGraphResourceInfo Resource { get { throw null; } set { } } @@ -1475,7 +1452,7 @@ protected MongoClusterCollection() { } } public partial class MongoClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public MongoClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MongoClusterData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.MongoClusterStatus? ClusterStatus { get { throw null; } } @@ -1531,7 +1508,7 @@ protected MongoDBCollectionCollection() { } } public partial class MongoDBCollectionData : Azure.ResourceManager.Models.TrackedResourceData { - public MongoDBCollectionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MongoDBCollectionData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.MongoDBCollectionPropertiesConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedMongoDBCollectionResourceInfo Resource { get { throw null; } set { } } @@ -1606,7 +1583,7 @@ protected MongoDBDatabaseCollection() { } } public partial class MongoDBDatabaseData : Azure.ResourceManager.Models.TrackedResourceData { - public MongoDBDatabaseData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MongoDBDatabaseData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.MongoDBDatabasePropertiesConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedMongoDBDatabaseResourceInfo Resource { get { throw null; } set { } } @@ -1818,11 +1795,92 @@ protected RestorableCosmosDBAccountResource() { } } public partial class ThroughputSettingData : Azure.ResourceManager.Models.TrackedResourceData { - public ThroughputSettingData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ThroughputSettingData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ExtendedThroughputSettingsResourceInfo Resource { get { throw null; } set { } } } } +namespace Azure.ResourceManager.CosmosDB.Mocking +{ + public partial class MockableCosmosDBArmClient : Azure.ResourceManager.ArmResource + { + protected MockableCosmosDBArmClient() { } + public virtual Azure.ResourceManager.CosmosDB.CassandraClusterResource GetCassandraClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CassandraDataCenterResource GetCassandraDataCenterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CassandraKeyspaceResource GetCassandraKeyspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CassandraKeyspaceThroughputSettingResource GetCassandraKeyspaceThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CassandraTableResource GetCassandraTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CassandraTableThroughputSettingResource GetCassandraTableThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CassandraViewGetResultResource GetCassandraViewGetResultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CassandraViewThroughputSettingResource GetCassandraViewThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBAccountResource GetCosmosDBAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBFirewallRuleResource GetCosmosDBFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBLocationResource GetCosmosDBLocationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBPrivateEndpointConnectionResource GetCosmosDBPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBPrivateLinkResource GetCosmosDBPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBServiceResource GetCosmosDBServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlClientEncryptionKeyResource GetCosmosDBSqlClientEncryptionKeyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlContainerResource GetCosmosDBSqlContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlContainerThroughputSettingResource GetCosmosDBSqlContainerThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlDatabaseResource GetCosmosDBSqlDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlDatabaseThroughputSettingResource GetCosmosDBSqlDatabaseThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlRoleAssignmentResource GetCosmosDBSqlRoleAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlRoleDefinitionResource GetCosmosDBSqlRoleDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlStoredProcedureResource GetCosmosDBSqlStoredProcedureResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlTriggerResource GetCosmosDBSqlTriggerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBSqlUserDefinedFunctionResource GetCosmosDBSqlUserDefinedFunctionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBTableResource GetCosmosDBTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosTableThroughputSettingResource GetCosmosTableThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.DataTransferJobGetResultResource GetDataTransferJobGetResultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.GraphResourceGetResultResource GetGraphResourceGetResultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.GremlinDatabaseResource GetGremlinDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.GremlinDatabaseThroughputSettingResource GetGremlinDatabaseThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.GremlinGraphResource GetGremlinGraphResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.GremlinGraphThroughputSettingResource GetGremlinGraphThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.MongoClusterResource GetMongoClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.MongoDBCollectionResource GetMongoDBCollectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.MongoDBCollectionThroughputSettingResource GetMongoDBCollectionThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.MongoDBDatabaseResource GetMongoDBDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.MongoDBDatabaseThroughputSettingResource GetMongoDBDatabaseThroughputSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.MongoDBRoleDefinitionResource GetMongoDBRoleDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.MongoDBUserDefinitionResource GetMongoDBUserDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.RestorableCosmosDBAccountResource GetRestorableCosmosDBAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableCosmosDBResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableCosmosDBResourceGroupResource() { } + public virtual Azure.Response GetCassandraCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCassandraClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CassandraClusterCollection GetCassandraClusters() { throw null; } + public virtual Azure.Response GetCosmosDBAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCosmosDBAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBAccountCollection GetCosmosDBAccounts() { throw null; } + public virtual Azure.Response GetMongoCluster(string mongoClusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMongoClusterAsync(string mongoClusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.MongoClusterCollection GetMongoClusters() { throw null; } + } + public partial class MockableCosmosDBSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableCosmosDBSubscriptionResource() { } + public virtual Azure.Pageable GetCassandraClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCassandraClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCosmosDBAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCosmosDBAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCosmosDBLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCosmosDBLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CosmosDB.CosmosDBLocationCollection GetCosmosDBLocations() { throw null; } + public virtual Azure.Pageable GetMongoClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMongoClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRestorableCosmosDBAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRestorableCosmosDBAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableCosmosDBTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableCosmosDBTenantResource() { } + public virtual Azure.Response CheckNameExistsDatabaseAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameExistsDatabaseAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.CosmosDB.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -1846,10 +1904,10 @@ namespace Azure.ResourceManager.CosmosDB.Models public static partial class ArmCosmosDBModelFactory { public static Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo AutoscaleSettingsResourceInfo(int maxThroughput = 0, Azure.ResourceManager.CosmosDB.Models.ThroughputPolicyResourceInfo autoUpgradeThroughputPolicy = null, int? targetMaxThroughput = default(int?)) { throw null; } - public static Azure.ResourceManager.CosmosDB.CassandraClusterBackupResourceData CassandraClusterBackupResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.DateTimeOffset? backupResourceTimestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupResourceInfo CassandraClusterBackupResourceInfo(string backupId = null, Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState? backupState = default(Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState?), System.DateTimeOffset? backupStartTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? backupStopTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? backupExpiryTimestamp = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.CosmosDB.CassandraClusterData CassandraClusterData(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.CosmosDB.Models.CassandraClusterProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeItem(string address = null, Azure.ResourceManager.CosmosDB.Models.CassandraNodeState? state = default(Azure.ResourceManager.CosmosDB.Models.CassandraNodeState?), string status = null, string cassandraProcessStatus = null, string load = null, System.Collections.Generic.IEnumerable tokens = null, int? size = default(int?), System.Guid? hostId = default(System.Guid?), string rack = null, string timestamp = null, long? diskUsedKB = default(long?), long? diskFreeKB = default(long?), long? memoryUsedKB = default(long?), long? memoryBuffersAndCachedKB = default(long?), long? memoryFreeKB = default(long?), long? memoryTotalKB = default(long?), double? cpuUsage = default(double?)) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterProperties CassandraClusterProperties(Azure.ResourceManager.CosmosDB.Models.CassandraProvisioningState? provisioningState = default(Azure.ResourceManager.CosmosDB.Models.CassandraProvisioningState?), string restoreFromBackupId = null, Azure.Core.ResourceIdentifier delegatedManagementSubnetId = null, string cassandraVersion = null, string clusterNameOverride = null, Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod? authenticationMethod = default(Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod?), string initialCassandraAdminPassword = null, string prometheusEndpointIPAddress = null, bool? isRepairEnabled = default(bool?), System.Collections.Generic.IEnumerable clientCertificates = null, System.Collections.Generic.IEnumerable externalGossipCertificates = null, System.Collections.Generic.IEnumerable gossipCertificates = null, System.Collections.Generic.IEnumerable externalSeedNodes = null, System.Collections.Generic.IEnumerable seedNodes = null, int? hoursBetweenBackups = default(int?), bool? isDeallocated = default(bool?), bool? isCassandraAuditLoggingEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CassandraError provisionError = null) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeItem(string address = null, Azure.ResourceManager.CosmosDB.Models.CassandraNodeState? state = default(Azure.ResourceManager.CosmosDB.Models.CassandraNodeState?), string status = null, string cassandraProcessStatus = null, string load = null, System.Collections.Generic.IEnumerable tokens = null, int? size = default(int?), System.Guid? hostId = default(System.Guid?), string rack = null, string timestamp = null, long? diskUsedKB = default(long?), long? diskFreeKB = default(long?), long? memoryUsedKB = default(long?), long? memoryBuffersAndCachedKB = default(long?), long? memoryFreeKB = default(long?), long? memoryTotalKB = default(long?), double? cpuUsage = default(double?), bool? isLatestModel = default(bool?)) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterProperties CassandraClusterProperties(Azure.ResourceManager.CosmosDB.Models.CassandraProvisioningState? provisioningState = default(Azure.ResourceManager.CosmosDB.Models.CassandraProvisioningState?), string restoreFromBackupId = null, Azure.Core.ResourceIdentifier delegatedManagementSubnetId = null, string cassandraVersion = null, string clusterNameOverride = null, Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod? authenticationMethod = default(Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod?), string initialCassandraAdminPassword = null, string prometheusEndpointIPAddress = null, bool? isRepairEnabled = default(bool?), System.Collections.Generic.IEnumerable clientCertificates = null, System.Collections.Generic.IEnumerable externalGossipCertificates = null, System.Collections.Generic.IEnumerable gossipCertificates = null, System.Collections.Generic.IEnumerable externalSeedNodes = null, System.Collections.Generic.IEnumerable seedNodes = null, int? hoursBetweenBackups = default(int?), bool? isDeallocated = default(bool?), bool? isCassandraAuditLoggingEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CassandraClusterType? clusterType = default(Azure.ResourceManager.CosmosDB.Models.CassandraClusterType?), Azure.ResourceManager.CosmosDB.Models.CassandraError provisionError = null, System.Collections.Generic.IEnumerable extensions = null, System.Collections.Generic.IEnumerable backupSchedules = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterPublicStatus CassandraClusterPublicStatus(Azure.ETag? etag = default(Azure.ETag?), Azure.ResourceManager.CosmosDB.Models.CassandraReaperStatus reaperStatus = null, System.Collections.Generic.IEnumerable connectionErrors = null, System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IEnumerable dataCenters = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterPublicStatusDataCentersItem CassandraClusterPublicStatusDataCentersItem(string name = null, System.Collections.Generic.IEnumerable seedNodes = null, System.Collections.Generic.IEnumerable nodes = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CassandraCommandOutput CassandraCommandOutput(string commandOutput = null) { throw null; } @@ -1866,8 +1924,8 @@ public static partial class ArmCosmosDBModelFactory public static Azure.ResourceManager.CosmosDB.CassandraViewGetResultData CassandraViewGetResultData(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.CosmosDB.Models.CassandraViewGetPropertiesResource resource = null, Azure.ResourceManager.CosmosDB.Models.CassandraViewGetPropertiesOptions options = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CheckCosmosDBNameAvailabilityResponse CheckCosmosDBNameAvailabilityResponse(bool? nameAvailable = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBNameUnavailableReason? reason = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBNameUnavailableReason?), string message = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountConnectionString CosmosDBAccountConnectionString(string connectionString = null, string description = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBKind? keyKind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBKind?), Azure.ResourceManager.CosmosDB.Models.CosmosDBType? keyType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBType?)) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdateContent(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.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy consistencyPolicy = null, System.Collections.Generic.IEnumerable locations = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType databaseAccountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType), System.Collections.Generic.IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = default(bool?), bool? enableAutomaticFailover = default(bool?), System.Collections.Generic.IEnumerable capabilities = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = default(bool?), bool? enableCassandraConnector = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? connectorOffer = default(Azure.ResourceManager.CosmosDB.Models.ConnectorOffer?), bool? disableKeyBasedMetadataWriteAccess = default(bool?), System.Uri keyVaultKeyUri = null, string defaultIdentity = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess?), bool? isFreeTierEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? apiServerVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion?), bool? isAnalyticalStorageEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? analyticalStorageSchemaType = default(Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? createMode = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy backupPolicy = null, System.Collections.Generic.IEnumerable cors = null, Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass? networkAclBypass = default(Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass?), System.Collections.Generic.IEnumerable networkAclBypassResourceIds = null, Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? diagnosticLogEnableFullTextQuery = default(Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery?), bool? disableLocalAuth = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountRestoreParameters restoreParameters = null, int? capacityTotalThroughputLimit = default(int?), bool? enableMaterializedViews = default(bool?), Azure.ResourceManager.CosmosDB.Models.DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = default(bool?), bool? enableBurstCapacity = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion? minimalTlsVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } - public static Azure.ResourceManager.CosmosDB.CosmosDBAccountData CosmosDBAccountData(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.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), string provisioningState = null, string documentEndpoint = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType? databaseAccountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType?), System.Collections.Generic.IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = default(bool?), bool? enableAutomaticFailover = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy consistencyPolicy = null, System.Collections.Generic.IEnumerable capabilities = null, System.Collections.Generic.IEnumerable writeLocations = null, System.Collections.Generic.IEnumerable readLocations = null, System.Collections.Generic.IEnumerable locations = null, System.Collections.Generic.IEnumerable failoverPolicies = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, bool? enableMultipleWriteLocations = default(bool?), bool? enableCassandraConnector = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? connectorOffer = default(Azure.ResourceManager.CosmosDB.Models.ConnectorOffer?), bool? disableKeyBasedMetadataWriteAccess = default(bool?), System.Uri keyVaultKeyUri = null, string defaultIdentity = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess?), bool? isFreeTierEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? apiServerVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion?), bool? isAnalyticalStorageEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? analyticalStorageSchemaType = default(Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType?), System.Guid? instanceId = default(System.Guid?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? createMode = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountRestoreParameters restoreParameters = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy backupPolicy = null, System.Collections.Generic.IEnumerable cors = null, Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass? networkAclBypass = default(Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass?), System.Collections.Generic.IEnumerable networkAclBypassResourceIds = null, Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? diagnosticLogEnableFullTextQuery = default(Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery?), bool? disableLocalAuth = default(bool?), int? capacityTotalThroughputLimit = default(int?), bool? enableMaterializedViews = default(bool?), Azure.ResourceManager.CosmosDB.Models.DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = default(bool?), bool? enableBurstCapacity = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion? minimalTlsVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdateContent(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.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy consistencyPolicy = null, System.Collections.Generic.IEnumerable locations = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType databaseAccountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType), System.Collections.Generic.IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = default(bool?), bool? enableAutomaticFailover = default(bool?), System.Collections.Generic.IEnumerable capabilities = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = default(bool?), bool? enableCassandraConnector = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? connectorOffer = default(Azure.ResourceManager.CosmosDB.Models.ConnectorOffer?), bool? disableKeyBasedMetadataWriteAccess = default(bool?), System.Uri keyVaultKeyUri = null, string defaultIdentity = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess?), bool? isFreeTierEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? apiServerVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion?), bool? isAnalyticalStorageEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? analyticalStorageSchemaType = default(Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? createMode = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy backupPolicy = null, System.Collections.Generic.IEnumerable cors = null, Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass? networkAclBypass = default(Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass?), System.Collections.Generic.IEnumerable networkAclBypassResourceIds = null, Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? diagnosticLogEnableFullTextQuery = default(Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery?), bool? disableLocalAuth = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountRestoreParameters restoreParameters = null, int? capacityTotalThroughputLimit = default(int?), bool? enableMaterializedViews = default(bool?), Azure.ResourceManager.CosmosDB.Models.DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = default(bool?), bool? enableBurstCapacity = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion? minimalTlsVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion?), Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? customerManagedKeyStatus = default(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus?), bool? enablePriorityBasedExecution = default(bool?), Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? defaultPriorityLevel = default(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.CosmosDB.CosmosDBAccountData CosmosDBAccountData(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.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), string provisioningState = null, string documentEndpoint = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType? databaseAccountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType?), System.Collections.Generic.IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = default(bool?), bool? enableAutomaticFailover = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy consistencyPolicy = null, System.Collections.Generic.IEnumerable capabilities = null, System.Collections.Generic.IEnumerable writeLocations = null, System.Collections.Generic.IEnumerable readLocations = null, System.Collections.Generic.IEnumerable locations = null, System.Collections.Generic.IEnumerable failoverPolicies = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, bool? enableMultipleWriteLocations = default(bool?), bool? enableCassandraConnector = default(bool?), Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? connectorOffer = default(Azure.ResourceManager.CosmosDB.Models.ConnectorOffer?), bool? disableKeyBasedMetadataWriteAccess = default(bool?), System.Uri keyVaultKeyUri = null, string defaultIdentity = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess?), bool? isFreeTierEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? apiServerVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion?), bool? isAnalyticalStorageEnabled = default(bool?), Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? analyticalStorageSchemaType = default(Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType?), System.Guid? instanceId = default(System.Guid?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? createMode = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode?), Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountRestoreParameters restoreParameters = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy backupPolicy = null, System.Collections.Generic.IEnumerable cors = null, Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass? networkAclBypass = default(Azure.ResourceManager.CosmosDB.Models.NetworkAclBypass?), System.Collections.Generic.IEnumerable networkAclBypassResourceIds = null, Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? diagnosticLogEnableFullTextQuery = default(Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery?), bool? disableLocalAuth = default(bool?), int? capacityTotalThroughputLimit = default(int?), bool? enableMaterializedViews = default(bool?), Azure.ResourceManager.CosmosDB.Models.DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = default(bool?), bool? enableBurstCapacity = default(bool?), Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion? minimalTlsVersion = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBMinimalTlsVersion?), Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? customerManagedKeyStatus = default(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus?), bool? enablePriorityBasedExecution = default(bool?), Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? defaultPriorityLevel = default(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKeyList CosmosDBAccountKeyList(string primaryReadonlyMasterKey = null, string secondaryReadonlyMasterKey = null, string primaryMasterKey = null, string secondaryMasterKey = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountLocation CosmosDBAccountLocation(string id = null, Azure.Core.AzureLocation? locationName = default(Azure.Core.AzureLocation?), string documentEndpoint = null, string provisioningState = null, int? failoverPriority = default(int?), bool? isZoneRedundant = default(bool?)) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountReadOnlyKeyList CosmosDBAccountReadOnlyKeyList(string primaryReadonlyMasterKey = null, string secondaryReadonlyMasterKey = null) { throw null; } @@ -1933,7 +1991,7 @@ public static partial class ArmCosmosDBModelFactory public static Azure.ResourceManager.CosmosDB.Models.ExtendedRestorableSqlContainerResourceInfo ExtendedRestorableSqlContainerResourceInfo(string rid = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType? operationType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType?), string eventTimestamp = null, string containerName = null, string containerId = null, Azure.ResourceManager.CosmosDB.Models.RestorableSqlContainerPropertiesResourceContainer container = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.ExtendedRestorableSqlDatabaseResourceInfo ExtendedRestorableSqlDatabaseResourceInfo(string rid = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType? operationType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType?), string eventTimestamp = null, string databaseName = null, string databaseId = null, Azure.ResourceManager.CosmosDB.Models.RestorableSqlDatabasePropertiesResourceDatabase database = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.ExtendedRestorableTableResourceInfo ExtendedRestorableTableResourceInfo(string rid = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType? operationType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBOperationType?), string eventTimestamp = null, string tableName = null, string tableId = null) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = default(int?), Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string rid = null, float? timestamp = default(float?), Azure.ETag? etag = default(Azure.ETag?)) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = default(int?), Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string instantMaximumThroughput = null, string softAllowedMaximumThroughput = null, string rid = null, float? timestamp = default(float?), Azure.ETag? etag = default(Azure.ETag?)) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.GraphApiComputeRegionalService GraphApiComputeRegionalService(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus? status = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus?), string graphApiComputeEndpoint = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.GraphApiComputeServiceProperties GraphApiComputeServiceProperties(System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceSize? instanceSize = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceSize?), int? instanceCount = default(int?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus? status = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus?), System.Collections.Generic.IDictionary additionalProperties = null, string graphApiComputeEndpoint = null, System.Collections.Generic.IEnumerable locations = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.GraphResourceGetResultCreateOrUpdateContent GraphResourceGetResultCreateOrUpdateContent(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.Core.ResourceIdentifier resourceId = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig options = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } @@ -1979,7 +2037,7 @@ public static partial class ArmCosmosDBModelFactory public static Azure.ResourceManager.CosmosDB.Models.SqlDedicatedGatewayRegionalService SqlDedicatedGatewayRegionalService(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus? status = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus?), string sqlDedicatedGatewayEndpoint = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.SqlDedicatedGatewayServiceProperties SqlDedicatedGatewayServiceProperties(System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceSize? instanceSize = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceSize?), int? instanceCount = default(int?), Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus? status = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBServiceStatus?), System.Collections.Generic.IDictionary additionalProperties = null, string sqlDedicatedGatewayEndpoint = null, System.Collections.Generic.IEnumerable locations = null) { throw null; } public static Azure.ResourceManager.CosmosDB.ThroughputSettingData ThroughputSettingData(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.CosmosDB.Models.ExtendedThroughputSettingsResourceInfo resource = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } - public static Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = default(int?), Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = default(int?), Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string instantMaximumThroughput = null, string softAllowedMaximumThroughput = null) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsUpdateData ThroughputSettingsUpdateData(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.CosmosDB.Models.ThroughputSettingsResourceInfo resource = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } } public partial class AuthenticationMethodLdapProperties @@ -2076,6 +2134,42 @@ public partial class CassandraCertificate public CassandraCertificate() { } public string Pem { get { throw null; } set { } } } + public partial class CassandraClusterBackupResourceInfo + { + internal CassandraClusterBackupResourceInfo() { } + public System.DateTimeOffset? BackupExpiryTimestamp { get { throw null; } } + public string BackupId { get { throw null; } } + public System.DateTimeOffset? BackupStartTimestamp { get { throw null; } } + public Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState? BackupState { get { throw null; } } + public System.DateTimeOffset? BackupStopTimestamp { get { throw null; } } + } + public partial class CassandraClusterBackupSchedule + { + public CassandraClusterBackupSchedule() { } + public string CronExpression { get { throw null; } set { } } + public int? RetentionInHours { get { throw null; } set { } } + public string ScheduleName { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CassandraClusterBackupState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CassandraClusterBackupState(string value) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState Failed { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState Initiated { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState InProgress { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState 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.CosmosDB.Models.CassandraClusterBackupState left, Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState right) { throw null; } + public static implicit operator Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState left, Azure.ResourceManager.CosmosDB.Models.CassandraClusterBackupState right) { throw null; } + public override string ToString() { throw null; } + } public partial class CassandraClusterDataCenterNodeItem { internal CassandraClusterDataCenterNodeItem() { } @@ -2085,6 +2179,7 @@ internal CassandraClusterDataCenterNodeItem() { } public long? DiskFreeKB { get { throw null; } } public long? DiskUsedKB { get { throw null; } } public System.Guid? HostId { get { throw null; } } + public bool? IsLatestModel { get { throw null; } } public string Load { get { throw null; } } public long? MemoryBuffersAndCachedKB { get { throw null; } } public long? MemoryFreeKB { get { throw null; } } @@ -2107,10 +2202,13 @@ public partial class CassandraClusterProperties { public CassandraClusterProperties() { } public Azure.ResourceManager.CosmosDB.Models.CassandraAuthenticationMethod? AuthenticationMethod { get { throw null; } set { } } + public System.Collections.Generic.IList BackupSchedules { get { throw null; } } public string CassandraVersion { get { throw null; } set { } } public System.Collections.Generic.IList ClientCertificates { get { throw null; } } public string ClusterNameOverride { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.CassandraClusterType? ClusterType { get { throw null; } set { } } public Azure.Core.ResourceIdentifier DelegatedManagementSubnetId { get { throw null; } set { } } + public System.Collections.Generic.IList Extensions { get { throw null; } } public System.Collections.Generic.IList ExternalGossipCertificates { get { throw null; } } public System.Collections.Generic.IList ExternalSeedNodes { get { throw null; } } public System.Collections.Generic.IReadOnlyList GossipCertificates { get { throw null; } } @@ -2141,6 +2239,24 @@ internal CassandraClusterPublicStatusDataCentersItem() { } public System.Collections.Generic.IReadOnlyList Nodes { get { throw null; } } public System.Collections.Generic.IReadOnlyList SeedNodes { get { throw null; } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CassandraClusterType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CassandraClusterType(string value) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterType NonProduction { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CassandraClusterType Production { get { throw null; } } + public bool Equals(Azure.ResourceManager.CosmosDB.Models.CassandraClusterType 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.CosmosDB.Models.CassandraClusterType left, Azure.ResourceManager.CosmosDB.Models.CassandraClusterType right) { throw null; } + public static implicit operator Azure.ResourceManager.CosmosDB.Models.CassandraClusterType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CosmosDB.Models.CassandraClusterType left, Azure.ResourceManager.CosmosDB.Models.CassandraClusterType right) { throw null; } + public override string ToString() { throw null; } + } public partial class CassandraColumn { public CassandraColumn() { } @@ -2226,7 +2342,7 @@ public CassandraError() { } } public partial class CassandraKeyspaceCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CassandraKeyspaceCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CassandraKeyspaceResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public CassandraKeyspaceCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CassandraKeyspaceResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public string ResourceKeyspaceName { get { throw null; } set { } } @@ -2304,7 +2420,7 @@ public CassandraSchema() { } } public partial class CassandraTableCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CassandraTableCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CassandraTableResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public CassandraTableCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CassandraTableResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CassandraTableResourceInfo Resource { get { throw null; } set { } } @@ -2334,7 +2450,7 @@ public partial class CassandraViewGetPropertiesResource : Azure.ResourceManager. } public partial class CassandraViewGetResultCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CassandraViewGetResultCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CassandraViewResource resource) : base (default(Azure.Core.AzureLocation)) { } + public CassandraViewGetResultCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CassandraViewResource resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CassandraViewResource Resource { get { throw null; } set { } } @@ -2457,6 +2573,7 @@ public partial class CosmosCassandraDataTransferDataSourceSink : Azure.ResourceM { public CosmosCassandraDataTransferDataSourceSink(string keyspaceName, string tableName) { } public string KeyspaceName { get { throw null; } set { } } + public string RemoteAccountName { get { throw null; } set { } } public string TableName { get { throw null; } set { } } } public abstract partial class CosmosDBAccountBackupPolicy @@ -2507,7 +2624,7 @@ public CosmosDBAccountCorsPolicy(string allowedOrigins) { } } public partial class CosmosDBAccountCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBAccountCreateOrUpdateContent(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable locations) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBAccountCreateOrUpdateContent(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable locations) { } public Azure.ResourceManager.CosmosDB.Models.AnalyticalStorageSchemaType? AnalyticalStorageSchemaType { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBServerVersion? ApiServerVersion { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountBackupPolicy BackupPolicy { get { throw null; } set { } } @@ -2517,8 +2634,10 @@ public CosmosDBAccountCreateOrUpdateContent(Azure.Core.AzureLocation location, S public Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy ConsistencyPolicy { get { throw null; } set { } } public System.Collections.Generic.IList Cors { get { throw null; } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountCreateMode? CreateMode { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? CustomerManagedKeyStatus { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType DatabaseAccountOfferType { get { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] set { } } public string DefaultIdentity { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? DefaultPriorityLevel { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? DiagnosticLogEnableFullTextQuery { get { throw null; } set { } } public bool? DisableKeyBasedMetadataWriteAccess { get { throw null; } set { } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -2528,6 +2647,7 @@ public CosmosDBAccountCreateOrUpdateContent(Azure.Core.AzureLocation location, S public bool? EnableMaterializedViews { get { throw null; } set { } } public bool? EnableMultipleWriteLocations { get { throw null; } set { } } public bool? EnablePartitionMerge { get { throw null; } set { } } + public bool? EnablePriorityBasedExecution { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList IPRules { get { throw null; } } public bool? IsAnalyticalStorageEnabled { get { throw null; } set { } } @@ -2627,7 +2747,9 @@ public CosmosDBAccountPatch() { } public Azure.ResourceManager.CosmosDB.Models.ConnectorOffer? ConnectorOffer { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy ConsistencyPolicy { get { throw null; } set { } } public System.Collections.Generic.IList Cors { get { throw null; } } + public Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus? CustomerManagedKeyStatus { get { throw null; } set { } } public string DefaultIdentity { get { throw null; } set { } } + public Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel? DefaultPriorityLevel { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.EnableFullTextQuery? DiagnosticLogEnableFullTextQuery { get { throw null; } set { } } public bool? DisableKeyBasedMetadataWriteAccess { get { throw null; } set { } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -2637,6 +2759,7 @@ public CosmosDBAccountPatch() { } public bool? EnableMaterializedViews { get { throw null; } set { } } public bool? EnableMultipleWriteLocations { get { throw null; } set { } } public bool? EnablePartitionMerge { get { throw null; } set { } } + public bool? EnablePriorityBasedExecution { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList IPRules { get { throw null; } } public bool? IsAnalyticalStorageEnabled { get { throw null; } set { } } @@ -3144,6 +3267,7 @@ public CosmosDBPrivateLinkServiceConnectionStateProperty() { } public CosmosDBPublicNetworkAccess(string value) { throw null; } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess Disabled { get { throw null; } } public static Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess Enabled { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess SecuredByPerimeter { get { throw null; } } public bool Equals(Azure.ResourceManager.CosmosDB.Models.CosmosDBPublicNetworkAccess other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } @@ -3300,7 +3424,7 @@ public CosmosDBSqlClientEncryptionKeyResourceInfo() { } } public partial class CosmosDBSqlContainerCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlContainerCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlContainerResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlContainerCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlContainerResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlContainerResourceInfo Resource { get { throw null; } set { } } @@ -3326,7 +3450,7 @@ public CosmosDBSqlContainerResourceInfo(string containerName) { } } public partial class CosmosDBSqlDatabaseCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlDatabaseCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlDatabaseResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlDatabaseCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlDatabaseResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlDatabaseResourceInfo Resource { get { throw null; } set { } } @@ -3371,7 +3495,7 @@ public CosmosDBSqlRolePermission() { } } public partial class CosmosDBSqlStoredProcedureCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlStoredProcedureCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlStoredProcedureResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlStoredProcedureCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlStoredProcedureResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlStoredProcedureResourceInfo Resource { get { throw null; } set { } } @@ -3384,7 +3508,7 @@ public CosmosDBSqlStoredProcedureResourceInfo(string storedProcedureName) { } } public partial class CosmosDBSqlTriggerCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlTriggerCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlTriggerResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlTriggerCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlTriggerResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlTriggerResourceInfo Resource { get { throw null; } set { } } @@ -3438,7 +3562,7 @@ public CosmosDBSqlTriggerResourceInfo(string triggerName) { } } public partial class CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlUserDefinedFunctionResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlUserDefinedFunctionResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlUserDefinedFunctionResourceInfo Resource { get { throw null; } set { } } @@ -3472,7 +3596,7 @@ public CosmosDBSqlUserDefinedFunctionResourceInfo(string functionName) { } } public partial class CosmosDBTableCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBTableCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBTableResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBTableCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.CosmosDBTableResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBTableResourceInfo Resource { get { throw null; } set { } } @@ -3537,12 +3661,41 @@ public partial class CosmosMongoDataTransferDataSourceSink : Azure.ResourceManag public CosmosMongoDataTransferDataSourceSink(string databaseName, string collectionName) { } public string CollectionName { get { throw null; } set { } } public string DatabaseName { get { throw null; } set { } } + public string RemoteAccountName { get { throw null; } set { } } } public partial class CosmosSqlDataTransferDataSourceSink : Azure.ResourceManager.CosmosDB.Models.DataTransferDataSourceSink { public CosmosSqlDataTransferDataSourceSink(string databaseName, string containerName) { } public string ContainerName { get { throw null; } set { } } public string DatabaseName { get { throw null; } set { } } + public string RemoteAccountName { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CustomerManagedKeyStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CustomerManagedKeyStatus(string value) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToTheConfiguredCustomerManagedKeyConfirmed { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide4016 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInvalidAzureCosmosDBDefaultIdentity4015 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyUriDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultUriProperty4006 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInternalUnwrappingProcedureError4005 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDnsNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002 { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide { get { throw null; } } + public bool Equals(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus 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.CosmosDB.Models.CustomerManagedKeyStatus left, Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus left, Azure.ResourceManager.CosmosDB.Models.CustomerManagedKeyStatus right) { throw null; } + public override string ToString() { throw null; } } public partial class DatabaseAccountKeysMetadata { @@ -3597,6 +3750,24 @@ public enum DefaultConsistencyLevel Strong = 3, ConsistentPrefix = 4, } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DefaultPriorityLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DefaultPriorityLevel(string value) { throw null; } + public static Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel High { get { throw null; } } + public static Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel Low { get { throw null; } } + public bool Equals(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel 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.CosmosDB.Models.DefaultPriorityLevel left, Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel left, Azure.ResourceManager.CosmosDB.Models.DefaultPriorityLevel right) { throw null; } + public override string ToString() { throw null; } + } public enum EnableFullTextQuery { None = 0, @@ -3777,14 +3948,14 @@ public GraphResourceGetPropertiesOptions() { } } public partial class GraphResourceGetResultCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public GraphResourceGetResultCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.WritableSubResource resource) : base (default(Azure.Core.AzureLocation)) { } + public GraphResourceGetResultCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.WritableSubResource resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } set { } } } public partial class GremlinDatabaseCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public GremlinDatabaseCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.GremlinDatabaseResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public GremlinDatabaseCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.GremlinDatabaseResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.GremlinDatabaseResourceInfo Resource { get { throw null; } set { } } @@ -3809,7 +3980,7 @@ public GremlinDatabaseRestoreResourceInfo() { } } public partial class GremlinGraphCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public GremlinGraphCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.GremlinGraphResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public GremlinGraphCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.GremlinGraphResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.GremlinGraphResourceInfo Resource { get { throw null; } set { } } @@ -3903,7 +4074,7 @@ public MongoClusterRestoreParameters() { } } public partial class MongoDBCollectionCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public MongoDBCollectionCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.MongoDBCollectionResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public MongoDBCollectionCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.MongoDBCollectionResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.MongoDBCollectionResourceInfo Resource { get { throw null; } set { } } @@ -3924,7 +4095,7 @@ public MongoDBCollectionResourceInfo(string collectionName) { } } public partial class MongoDBDatabaseCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public MongoDBDatabaseCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.MongoDBDatabaseResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public MongoDBDatabaseCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.MongoDBDatabaseResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.CosmosDBCreateUpdateConfig Options { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.MongoDBDatabaseResourceInfo Resource { get { throw null; } set { } } @@ -4084,13 +4255,13 @@ public PhysicalPartitionThroughputInfoResource(string id) { } } public partial class PhysicalPartitionThroughputInfoResult : Azure.ResourceManager.Models.TrackedResourceData { - public PhysicalPartitionThroughputInfoResult(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PhysicalPartitionThroughputInfoResult(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList ResourcePhysicalPartitionThroughputInfo { get { throw null; } } } public partial class RedistributeThroughputParameters : Azure.ResourceManager.Models.TrackedResourceData { - public RedistributeThroughputParameters(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.RedistributeThroughputPropertiesResource resource) : base (default(Azure.Core.AzureLocation)) { } + public RedistributeThroughputParameters(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.RedistributeThroughputPropertiesResource resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.RedistributeThroughputPropertiesResource Resource { get { throw null; } set { } } } @@ -4204,7 +4375,7 @@ public RestoreParametersBase() { } } public partial class RetrieveThroughputParameters : Azure.ResourceManager.Models.TrackedResourceData { - public RetrieveThroughputParameters(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.RetrieveThroughputPropertiesResource resource) : base (default(Azure.Core.AzureLocation)) { } + public RetrieveThroughputParameters(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.RetrieveThroughputPropertiesResource resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList ResourcePhysicalPartitionIds { get { throw null; } set { } } } @@ -4259,13 +4430,15 @@ public partial class ThroughputSettingsResourceInfo { public ThroughputSettingsResourceInfo() { } public Azure.ResourceManager.CosmosDB.Models.AutoscaleSettingsResourceInfo AutoscaleSettings { get { throw null; } set { } } + public string InstantMaximumThroughput { get { throw null; } } public string MinimumThroughput { get { throw null; } } public string OfferReplacePending { get { throw null; } } + public string SoftAllowedMaximumThroughput { get { throw null; } } public int? Throughput { get { throw null; } set { } } } public partial class ThroughputSettingsUpdateData : Azure.ResourceManager.Models.TrackedResourceData { - public ThroughputSettingsUpdateData(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsResourceInfo resource) : base (default(Azure.Core.AzureLocation)) { } + public ThroughputSettingsUpdateData(Azure.Core.AzureLocation location, Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsResourceInfo resource) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.CosmosDB.Models.ThroughputSettingsResourceInfo Resource { get { throw null; } set { } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/assets.json b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/assets.json index 89099a3ac05bf..15c32c0cab960 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/assets.json +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/cosmosdb/Azure.ResourceManager.CosmosDB", - "Tag": "net/cosmosdb/Azure.ResourceManager.CosmosDB_136ec94563" + "Tag": "net/cosmosdb/Azure.ResourceManager.CosmosDB_7872c0dcb8" } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Azure.ResourceManager.CosmosDB.Samples.csproj b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Azure.ResourceManager.CosmosDB.Samples.csproj new file mode 100644 index 0000000000000..3910747143189 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Azure.ResourceManager.CosmosDB.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterCollection.cs new file mode 100644 index 0000000000000..a94b83f83a5d6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterCollection.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraClusterCollection + { + // CosmosDBManagedCassandraClusterListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBManagedCassandraClusterListByResourceGroup() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json + // this example is just showing the usage of "CassandraClusters_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation and iterate over the result + await foreach (CassandraClusterResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBManagedCassandraClusterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterGet.json + // this example is just showing the usage of "CassandraClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation + string clusterName = "cassandra-prod"; + CassandraClusterResource result = await collection.GetAsync(clusterName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBManagedCassandraClusterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterGet.json + // this example is just showing the usage of "CassandraClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation + string clusterName = "cassandra-prod"; + bool result = await collection.ExistsAsync(clusterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBManagedCassandraClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBManagedCassandraClusterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterGet.json + // this example is just showing the usage of "CassandraClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation + string clusterName = "cassandra-prod"; + NullableResponse response = await collection.GetIfExistsAsync(clusterName); + CassandraClusterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBManagedCassandraClusterCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBManagedCassandraClusterCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterCreate.json + // this example is just showing the usage of "CassandraClusters_CreateUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CassandraClusterResource + CassandraClusterCollection collection = resourceGroupResource.GetCassandraClusters(); + + // invoke the operation + string clusterName = "cassandra-prod"; + CassandraClusterData data = new CassandraClusterData(new AzureLocation("West US")) + { + Properties = new CassandraClusterProperties() + { + DelegatedManagementSubnetId = new ResourceIdentifier("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management"), + CassandraVersion = "3.11", + ClusterNameOverride = "ClusterNameIllegalForAzureResource", + AuthenticationMethod = CassandraAuthenticationMethod.Cassandra, + InitialCassandraAdminPassword = "mypassword", + ClientCertificates = +{ +new CassandraCertificate() +{ +Pem = "-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----", +} +}, + ExternalGossipCertificates = +{ +new CassandraCertificate() +{ +Pem = "-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----", +} +}, + ExternalSeedNodes = +{ +new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.2", +},new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.3", +},new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.4", +} +}, + HoursBetweenBackups = 24, + }, + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, data); + CassandraClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterResource.cs new file mode 100644 index 0000000000000..2163d3ab672ca --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraClusterResource.cs @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraClusterResource + { + // CosmosDBManagedCassandraClusterListBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCassandraClusters_CosmosDBManagedCassandraClusterListBySubscription() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterListBySubscription.json + // this example is just showing the usage of "CassandraClusters_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (CassandraClusterResource item in subscriptionResource.GetCassandraClustersAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraClusterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBManagedCassandraClusterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterGet.json + // this example is just showing the usage of "CassandraClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + CassandraClusterResource result = await cassandraCluster.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraClusterDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBManagedCassandraClusterDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterDelete.json + // this example is just showing the usage of "CassandraClusters_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + await cassandraCluster.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraClusterPatch + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBManagedCassandraClusterPatch() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterPatch.json + // this example is just showing the usage of "CassandraClusters_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + CassandraClusterData data = new CassandraClusterData(new AzureLocation("placeholder")) + { + Properties = new CassandraClusterProperties() + { + AuthenticationMethod = CassandraAuthenticationMethod.None, + ExternalGossipCertificates = +{ +new CassandraCertificate() +{ +Pem = "-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----", +} +}, + ExternalSeedNodes = +{ +new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.2", +},new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.3", +},new CassandraDataCenterSeedNode() +{ +IPAddress = "10.52.221.4", +} +}, + HoursBetweenBackups = 12, + }, + Tags = +{ +["owner"] = "mike", +}, + }; + ArmOperation lro = await cassandraCluster.UpdateAsync(WaitUntil.Completed, data); + CassandraClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraCommand + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task InvokeCommand_CosmosDBManagedCassandraCommand() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraCommand.json + // this example is just showing the usage of "CassandraClusters_InvokeCommand" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + CassandraCommandPostBody body = new CassandraCommandPostBody("nodetool", "10.0.1.12") + { + Arguments = +{ +["status"] = "", +}, + }; + ArmOperation lro = await cassandraCluster.InvokeCommandAsync(WaitUntil.Completed, body); + CassandraCommandOutput result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBManagedCassandraBackupsList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBackups_CosmosDBManagedCassandraBackupsList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraBackupsList.json + // this example is just showing the usage of "CassandraClusters_ListBackups" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation and iterate over the result + await foreach (CassandraClusterBackupResourceInfo item in cassandraCluster.GetBackupsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraBackup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBackup_CosmosDBManagedCassandraBackup() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraBackup.json + // this example is just showing the usage of "CassandraClusters_GetBackup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + string backupId = "1611250348"; + CassandraClusterBackupResourceInfo result = await cassandraCluster.GetBackupAsync(backupId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBManagedCassandraClusterDeallocate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Deallocate_CosmosDBManagedCassandraClusterDeallocate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterDeallocate.json + // this example is just showing the usage of "CassandraClusters_Deallocate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + await cassandraCluster.DeallocateAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraClusterStart + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Start_CosmosDBManagedCassandraClusterStart() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraClusterStart.json + // this example is just showing the usage of "CassandraClusters_Start" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + await cassandraCluster.StartAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraStatus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Status_CosmosDBManagedCassandraStatus() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraStatus.json + // this example is just showing the usage of "CassandraClusters_Status" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // invoke the operation + CassandraClusterPublicStatus result = await cassandraCluster.StatusAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterCollection.cs new file mode 100644 index 0000000000000..9ed13ce8003a5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterCollection.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraDataCenterCollection + { + // CosmosDBManagedCassandraDataCenterList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBManagedCassandraDataCenterList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterList.json + // this example is just showing the usage of "CassandraDataCenters_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation and iterate over the result + await foreach (CassandraDataCenterResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraDataCenterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBManagedCassandraDataCenterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + // this example is just showing the usage of "CassandraDataCenters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation + string dataCenterName = "dc1"; + CassandraDataCenterResource result = await collection.GetAsync(dataCenterName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraDataCenterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBManagedCassandraDataCenterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + // this example is just showing the usage of "CassandraDataCenters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation + string dataCenterName = "dc1"; + bool result = await collection.ExistsAsync(dataCenterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBManagedCassandraDataCenterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBManagedCassandraDataCenterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + // this example is just showing the usage of "CassandraDataCenters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation + string dataCenterName = "dc1"; + NullableResponse response = await collection.GetIfExistsAsync(dataCenterName); + CassandraDataCenterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBManagedCassandraDataCenterCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBManagedCassandraDataCenterCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterCreate.json + // this example is just showing the usage of "CassandraDataCenters_CreateUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraClusterResource created on azure + // for more information of creating CassandraClusterResource, please refer to the document of CassandraClusterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + ResourceIdentifier cassandraClusterResourceId = CassandraClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); + CassandraClusterResource cassandraCluster = client.GetCassandraClusterResource(cassandraClusterResourceId); + + // get the collection of this CassandraDataCenterResource + CassandraDataCenterCollection collection = cassandraCluster.GetCassandraDataCenters(); + + // invoke the operation + string dataCenterName = "dc1"; + CassandraDataCenterData data = new CassandraDataCenterData() + { + Properties = new CassandraDataCenterProperties() + { + DataCenterLocation = new AzureLocation("West US 2"), + DelegatedSubnetId = new ResourceIdentifier("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet"), + NodeCount = 9, + Base64EncodedCassandraYamlFragment = "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataCenterName, data); + CassandraDataCenterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterResource.cs new file mode 100644 index 0000000000000..bb18fd5eef376 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraDataCenterResource.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraDataCenterResource + { + // CosmosDBManagedCassandraDataCenterGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBManagedCassandraDataCenterGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterGet.json + // this example is just showing the usage of "CassandraDataCenters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraDataCenterResource created on azure + // for more information of creating CassandraDataCenterResource, please refer to the document of CassandraDataCenterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + string dataCenterName = "dc1"; + ResourceIdentifier cassandraDataCenterResourceId = CassandraDataCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, dataCenterName); + CassandraDataCenterResource cassandraDataCenter = client.GetCassandraDataCenterResource(cassandraDataCenterResourceId); + + // invoke the operation + CassandraDataCenterResource result = await cassandraDataCenter.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBManagedCassandraDataCenterDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBManagedCassandraDataCenterDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterDelete.json + // this example is just showing the usage of "CassandraDataCenters_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraDataCenterResource created on azure + // for more information of creating CassandraDataCenterResource, please refer to the document of CassandraDataCenterResource + string subscriptionId = "subid"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + string dataCenterName = "dc1"; + ResourceIdentifier cassandraDataCenterResourceId = CassandraDataCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, dataCenterName); + CassandraDataCenterResource cassandraDataCenter = client.GetCassandraDataCenterResource(cassandraDataCenterResourceId); + + // invoke the operation + await cassandraDataCenter.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBManagedCassandraDataCenterUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBManagedCassandraDataCenterUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBManagedCassandraDataCenterPatch.json + // this example is just showing the usage of "CassandraDataCenters_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraDataCenterResource created on azure + // for more information of creating CassandraDataCenterResource, please refer to the document of CassandraDataCenterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "cassandra-prod-rg"; + string clusterName = "cassandra-prod"; + string dataCenterName = "dc1"; + ResourceIdentifier cassandraDataCenterResourceId = CassandraDataCenterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName, dataCenterName); + CassandraDataCenterResource cassandraDataCenter = client.GetCassandraDataCenterResource(cassandraDataCenterResourceId); + + // invoke the operation + CassandraDataCenterData data = new CassandraDataCenterData() + { + Properties = new CassandraDataCenterProperties() + { + DataCenterLocation = new AzureLocation("West US 2"), + DelegatedSubnetId = new ResourceIdentifier("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet"), + NodeCount = 9, + Base64EncodedCassandraYamlFragment = "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=", + }, + }; + ArmOperation lro = await cassandraDataCenter.UpdateAsync(WaitUntil.Completed, data); + CassandraDataCenterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraDataCenterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceCollection.cs new file mode 100644 index 0000000000000..34b0be10df015 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceCollection.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraKeyspaceCollection + { + // CosmosDBCassandraKeyspaceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBCassandraKeyspaceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceList.json + // this example is just showing the usage of "CassandraResources_ListCassandraKeyspaces" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation and iterate over the result + await foreach (CassandraKeyspaceResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCassandraKeyspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraKeyspaceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation + string keyspaceName = "keyspaceName"; + CassandraKeyspaceResource result = await collection.GetAsync(keyspaceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBCassandraKeyspaceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation + string keyspaceName = "keyspaceName"; + bool result = await collection.ExistsAsync(keyspaceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBCassandraKeyspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBCassandraKeyspaceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation + string keyspaceName = "keyspaceName"; + NullableResponse response = await collection.GetIfExistsAsync(keyspaceName); + CassandraKeyspaceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBCassandraKeyspaceCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraKeyspaceCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CassandraKeyspaceResource + CassandraKeyspaceCollection collection = cosmosDBAccount.GetCassandraKeyspaces(); + + // invoke the operation + string keyspaceName = "keyspaceName"; + CassandraKeyspaceCreateOrUpdateContent content = new CassandraKeyspaceCreateOrUpdateContent(new AzureLocation("West US"), new CassandraKeyspaceResourceInfo("keyspaceName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, keyspaceName, content); + CassandraKeyspaceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceResource.cs new file mode 100644 index 0000000000000..2efe3ed9802bb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraKeyspaceResource + { + // CosmosDBCassandraKeyspaceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraKeyspaceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // invoke the operation + CassandraKeyspaceResource result = await cassandraKeyspace.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBCassandraKeyspaceCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // invoke the operation + CassandraKeyspaceCreateOrUpdateContent content = new CassandraKeyspaceCreateOrUpdateContent(new AzureLocation("West US"), new CassandraKeyspaceResourceInfo("keyspaceName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cassandraKeyspace.UpdateAsync(WaitUntil.Completed, content); + CassandraKeyspaceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraKeyspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBCassandraKeyspaceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceDelete.json + // this example is just showing the usage of "CassandraResources_DeleteCassandraKeyspace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // invoke the operation + await cassandraKeyspace.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceThroughputSettingResource.cs new file mode 100644 index 0000000000000..eb749dd0880eb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraKeyspaceThroughputSettingResource.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraKeyspaceThroughputSettingResource + { + // CosmosDBCassandraKeyspaceThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraKeyspaceThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceThroughputGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraKeyspaceThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceThroughputSettingResource created on azure + // for more information of creating CassandraKeyspaceThroughputSettingResource, please refer to the document of CassandraKeyspaceThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceThroughputSettingResourceId = CassandraKeyspaceThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceThroughputSettingResource cassandraKeyspaceThroughputSetting = client.GetCassandraKeyspaceThroughputSettingResource(cassandraKeyspaceThroughputSettingResourceId); + + // invoke the operation + CassandraKeyspaceThroughputSettingResource result = await cassandraKeyspaceThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraKeyspaceThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json + // this example is just showing the usage of "CassandraResources_UpdateCassandraKeyspaceThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceThroughputSettingResource created on azure + // for more information of creating CassandraKeyspaceThroughputSettingResource, please refer to the document of CassandraKeyspaceThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceThroughputSettingResourceId = CassandraKeyspaceThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceThroughputSettingResource cassandraKeyspaceThroughputSetting = client.GetCassandraKeyspaceThroughputSettingResource(cassandraKeyspaceThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cassandraKeyspaceThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CassandraKeyspaceThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraKeyspaceToAutoscale_CosmosDBCassandraKeyspaceMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraKeyspaceToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceThroughputSettingResource created on azure + // for more information of creating CassandraKeyspaceThroughputSettingResource, please refer to the document of CassandraKeyspaceThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceThroughputSettingResourceId = CassandraKeyspaceThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceThroughputSettingResource cassandraKeyspaceThroughputSetting = client.GetCassandraKeyspaceThroughputSettingResource(cassandraKeyspaceThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraKeyspaceThroughputSetting.MigrateCassandraKeyspaceToAutoscaleAsync(WaitUntil.Completed); + CassandraKeyspaceThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraKeyspaceMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraKeyspaceToManualThroughput_CosmosDBCassandraKeyspaceMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraKeyspaceToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceThroughputSettingResource created on azure + // for more information of creating CassandraKeyspaceThroughputSettingResource, please refer to the document of CassandraKeyspaceThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceThroughputSettingResourceId = CassandraKeyspaceThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceThroughputSettingResource cassandraKeyspaceThroughputSetting = client.GetCassandraKeyspaceThroughputSettingResource(cassandraKeyspaceThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraKeyspaceThroughputSetting.MigrateCassandraKeyspaceToManualThroughputAsync(WaitUntil.Completed); + CassandraKeyspaceThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableCollection.cs new file mode 100644 index 0000000000000..c2398a43c25ef --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableCollection.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraTableCollection + { + // CosmosDBCassandraTableList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBCassandraTableList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableList.json + // this example is just showing the usage of "CassandraResources_ListCassandraTables" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation and iterate over the result + await foreach (CassandraTableResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCassandraTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation + string tableName = "tableName"; + CassandraTableResource result = await collection.GetAsync(tableName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBCassandraTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation + string tableName = "tableName"; + bool result = await collection.ExistsAsync(tableName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBCassandraTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBCassandraTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation + string tableName = "tableName"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + CassandraTableResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBCassandraTableCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraTableCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraTableResource + CassandraTableCollection collection = cassandraKeyspace.GetCassandraTables(); + + // invoke the operation + string tableName = "tableName"; + CassandraTableCreateOrUpdateContent content = new CassandraTableCreateOrUpdateContent(new AzureLocation("West US"), new CassandraTableResourceInfo("tableName") + { + DefaultTtl = 100, + Schema = new CassandraSchema() + { + Columns = +{ +new CassandraColumn() +{ +Name = "columnA", +CassandraColumnType = "Ascii", +} +}, + PartitionKeys = +{ +new CassandraPartitionKey() +{ +Name = "columnA", +} +}, + ClusterKeys = +{ +new CassandraClusterKey() +{ +Name = "columnA", +OrderBy = "Asc", +} +}, + }, + AnalyticalStorageTtl = 500, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, tableName, content); + CassandraTableResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableResource.cs new file mode 100644 index 0000000000000..ff6d5b5b245b9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableResource.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraTableResource + { + // CosmosDBCassandraTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableResource created on azure + // for more information of creating CassandraTableResource, please refer to the document of CassandraTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableResourceId = CassandraTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableResource cassandraTable = client.GetCassandraTableResource(cassandraTableResourceId); + + // invoke the operation + CassandraTableResource result = await cassandraTable.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBCassandraTableCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableResource created on azure + // for more information of creating CassandraTableResource, please refer to the document of CassandraTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableResourceId = CassandraTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableResource cassandraTable = client.GetCassandraTableResource(cassandraTableResourceId); + + // invoke the operation + CassandraTableCreateOrUpdateContent content = new CassandraTableCreateOrUpdateContent(new AzureLocation("West US"), new CassandraTableResourceInfo("tableName") + { + DefaultTtl = 100, + Schema = new CassandraSchema() + { + Columns = +{ +new CassandraColumn() +{ +Name = "columnA", +CassandraColumnType = "Ascii", +} +}, + PartitionKeys = +{ +new CassandraPartitionKey() +{ +Name = "columnA", +} +}, + ClusterKeys = +{ +new CassandraClusterKey() +{ +Name = "columnA", +OrderBy = "Asc", +} +}, + }, + AnalyticalStorageTtl = 500, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cassandraTable.UpdateAsync(WaitUntil.Completed, content); + CassandraTableResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBCassandraTableDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableDelete.json + // this example is just showing the usage of "CassandraResources_DeleteCassandraTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableResource created on azure + // for more information of creating CassandraTableResource, please refer to the document of CassandraTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableResourceId = CassandraTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableResource cassandraTable = client.GetCassandraTableResource(cassandraTableResourceId); + + // invoke the operation + await cassandraTable.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableThroughputSettingResource.cs new file mode 100644 index 0000000000000..842bb0fc3c552 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraTableThroughputSettingResource.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraTableThroughputSettingResource + { + // CosmosDBCassandraTableThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraTableThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableThroughputGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraTableThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableThroughputSettingResource created on azure + // for more information of creating CassandraTableThroughputSettingResource, please refer to the document of CassandraTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableThroughputSettingResourceId = CassandraTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableThroughputSettingResource cassandraTableThroughputSetting = client.GetCassandraTableThroughputSettingResource(cassandraTableThroughputSettingResourceId); + + // invoke the operation + CassandraTableThroughputSettingResource result = await cassandraTableThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraTableThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableThroughputUpdate.json + // this example is just showing the usage of "CassandraResources_UpdateCassandraTableThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableThroughputSettingResource created on azure + // for more information of creating CassandraTableThroughputSettingResource, please refer to the document of CassandraTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableThroughputSettingResourceId = CassandraTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableThroughputSettingResource cassandraTableThroughputSetting = client.GetCassandraTableThroughputSettingResource(cassandraTableThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cassandraTableThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CassandraTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraTableToAutoscale_CosmosDBCassandraTableMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableMigrateToAutoscale.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraTableToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableThroughputSettingResource created on azure + // for more information of creating CassandraTableThroughputSettingResource, please refer to the document of CassandraTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableThroughputSettingResourceId = CassandraTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableThroughputSettingResource cassandraTableThroughputSetting = client.GetCassandraTableThroughputSettingResource(cassandraTableThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraTableThroughputSetting.MigrateCassandraTableToAutoscaleAsync(WaitUntil.Completed); + CassandraTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraTableMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraTableToManualThroughput_CosmosDBCassandraTableMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraTableMigrateToManualThroughput.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraTableToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraTableThroughputSettingResource created on azure + // for more information of creating CassandraTableThroughputSettingResource, please refer to the document of CassandraTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspaceName"; + string tableName = "tableName"; + ResourceIdentifier cassandraTableThroughputSettingResourceId = CassandraTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, tableName); + CassandraTableThroughputSettingResource cassandraTableThroughputSetting = client.GetCassandraTableThroughputSettingResource(cassandraTableThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraTableThroughputSetting.MigrateCassandraTableToManualThroughputAsync(WaitUntil.Completed); + CassandraTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultCollection.cs new file mode 100644 index 0000000000000..c3b5a5f84f239 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultCollection.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraViewGetResultCollection + { + // CosmosDBCassandraViewList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBCassandraViewList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewList.json + // this example is just showing the usage of "CassandraResources_ListCassandraViews" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation and iterate over the result + await foreach (CassandraViewGetResultResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCassandraViewGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraViewGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation + string viewName = "viewname"; + CassandraViewGetResultResource result = await collection.GetAsync(viewName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBCassandraViewGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation + string viewName = "viewname"; + bool result = await collection.ExistsAsync(viewName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBCassandraViewGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBCassandraViewGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation + string viewName = "viewname"; + NullableResponse response = await collection.GetIfExistsAsync(viewName); + CassandraViewGetResultResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBCassandraViewCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraViewCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraKeyspaceResource created on azure + // for more information of creating CassandraKeyspaceResource, please refer to the document of CassandraKeyspaceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + ResourceIdentifier cassandraKeyspaceResourceId = CassandraKeyspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName); + CassandraKeyspaceResource cassandraKeyspace = client.GetCassandraKeyspaceResource(cassandraKeyspaceResourceId); + + // get the collection of this CassandraViewGetResultResource + CassandraViewGetResultCollection collection = cassandraKeyspace.GetCassandraViewGetResults(); + + // invoke the operation + string viewName = "viewname"; + CassandraViewGetResultCreateOrUpdateContent content = new CassandraViewGetResultCreateOrUpdateContent(new AzureLocation("placeholder"), new CassandraViewResource("viewname", "SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY (columnc, columna)")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, viewName, content); + CassandraViewGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultResource.cs new file mode 100644 index 0000000000000..6224c277baa90 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewGetResultResource.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraViewGetResultResource + { + // CosmosDBCassandraViewGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraViewGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewGetResultResource created on azure + // for more information of creating CassandraViewGetResultResource, please refer to the document of CassandraViewGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewGetResultResourceId = CassandraViewGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewGetResultResource cassandraViewGetResult = client.GetCassandraViewGetResultResource(cassandraViewGetResultResourceId); + + // invoke the operation + CassandraViewGetResultResource result = await cassandraViewGetResult.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBCassandraViewCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewCreateUpdate.json + // this example is just showing the usage of "CassandraResources_CreateUpdateCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewGetResultResource created on azure + // for more information of creating CassandraViewGetResultResource, please refer to the document of CassandraViewGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewGetResultResourceId = CassandraViewGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewGetResultResource cassandraViewGetResult = client.GetCassandraViewGetResultResource(cassandraViewGetResultResourceId); + + // invoke the operation + CassandraViewGetResultCreateOrUpdateContent content = new CassandraViewGetResultCreateOrUpdateContent(new AzureLocation("placeholder"), new CassandraViewResource("viewname", "SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY (columnc, columna)")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cassandraViewGetResult.UpdateAsync(WaitUntil.Completed, content); + CassandraViewGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CassandraViewGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBCassandraViewDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewDelete.json + // this example is just showing the usage of "CassandraResources_DeleteCassandraView" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewGetResultResource created on azure + // for more information of creating CassandraViewGetResultResource, please refer to the document of CassandraViewGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewGetResultResourceId = CassandraViewGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewGetResultResource cassandraViewGetResult = client.GetCassandraViewGetResultResource(cassandraViewGetResultResourceId); + + // invoke the operation + await cassandraViewGetResult.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewThroughputSettingResource.cs new file mode 100644 index 0000000000000..08c3ffb974e2d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CassandraViewThroughputSettingResource.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CassandraViewThroughputSettingResource + { + // CosmosDBCassandraViewThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBCassandraViewThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewThroughputGet.json + // this example is just showing the usage of "CassandraResources_GetCassandraViewThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewThroughputSettingResource created on azure + // for more information of creating CassandraViewThroughputSettingResource, please refer to the document of CassandraViewThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewThroughputSettingResourceId = CassandraViewThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewThroughputSettingResource cassandraViewThroughputSetting = client.GetCassandraViewThroughputSettingResource(cassandraViewThroughputSettingResourceId); + + // invoke the operation + CassandraViewThroughputSettingResource result = await cassandraViewThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBCassandraViewThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewThroughputUpdate.json + // this example is just showing the usage of "CassandraResources_UpdateCassandraViewThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewThroughputSettingResource created on azure + // for more information of creating CassandraViewThroughputSettingResource, please refer to the document of CassandraViewThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewThroughputSettingResourceId = CassandraViewThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewThroughputSettingResource cassandraViewThroughputSetting = client.GetCassandraViewThroughputSettingResource(cassandraViewThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("placeholder"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cassandraViewThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CassandraViewThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraViewToAutoscale_CosmosDBCassandraViewMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewMigrateToAutoscale.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraViewToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewThroughputSettingResource created on azure + // for more information of creating CassandraViewThroughputSettingResource, please refer to the document of CassandraViewThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewThroughputSettingResourceId = CassandraViewThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewThroughputSettingResource cassandraViewThroughputSetting = client.GetCassandraViewThroughputSettingResource(cassandraViewThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraViewThroughputSetting.MigrateCassandraViewToAutoscaleAsync(WaitUntil.Completed); + CassandraViewThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBCassandraViewMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateCassandraViewToManualThroughput_CosmosDBCassandraViewMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCassandraViewMigrateToManualThroughput.json + // this example is just showing the usage of "CassandraResources_MigrateCassandraViewToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CassandraViewThroughputSettingResource created on azure + // for more information of creating CassandraViewThroughputSettingResource, please refer to the document of CassandraViewThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string keyspaceName = "keyspacename"; + string viewName = "viewname"; + ResourceIdentifier cassandraViewThroughputSettingResourceId = CassandraViewThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, keyspaceName, viewName); + CassandraViewThroughputSettingResource cassandraViewThroughputSetting = client.GetCassandraViewThroughputSettingResource(cassandraViewThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cassandraViewThroughputSetting.MigrateCassandraViewToManualThroughputAsync(WaitUntil.Completed); + CassandraViewThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountCollection.cs new file mode 100644 index 0000000000000..beccbac8616f5 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountCollection.cs @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBAccountCollection + { + // CosmosDBDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGet.json + // this example is just showing the usage of "DatabaseAccounts_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + CosmosDBAccountResource result = await collection.GetAsync(accountName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGet.json + // this example is just showing the usage of "DatabaseAccounts_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + bool result = await collection.ExistsAsync(accountName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGet.json + // this example is just showing the usage of "DatabaseAccounts_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + NullableResponse response = await collection.GetIfExistsAsync(accountName); + CosmosDBAccountResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBDatabaseAccountCreateMax + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBDatabaseAccountCreateMax() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountCreateMax.json + // this example is just showing the usage of "DatabaseAccounts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + CosmosDBAccountCreateOrUpdateContent content = new CosmosDBAccountCreateOrUpdateContent(new AzureLocation("westus"), new CosmosDBAccountLocation[] + { +new CosmosDBAccountLocation() +{ +LocationName = new AzureLocation("southcentralus"), +FailoverPriority = 0, +IsZoneRedundant = false, +},new CosmosDBAccountLocation() +{ +LocationName = new AzureLocation("eastus"), +FailoverPriority = 1, +IsZoneRedundant = false, +} + }) + { + Kind = CosmosDBAccountKind.MongoDB, + ConsistencyPolicy = new ConsistencyPolicy(DefaultConsistencyLevel.BoundedStaleness) + { + MaxStalenessPrefix = 200, + MaxIntervalInSeconds = 10, + }, + IPRules = +{ +new CosmosDBIPAddressOrRange() +{ +IPAddressOrRange = "23.43.230.120", +},new CosmosDBIPAddressOrRange() +{ +IPAddressOrRange = "110.12.240.0/12", +} +}, + IsVirtualNetworkFilterEnabled = true, + VirtualNetworkRules = +{ +new CosmosDBVirtualNetworkRule() +{ +Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), +IgnoreMissingVnetServiceEndpoint = false, +} +}, + KeyVaultKeyUri = new Uri("https://myKeyVault.vault.azure.net"), + DefaultIdentity = "FirstPartyIdentity", + PublicNetworkAccess = CosmosDBPublicNetworkAccess.Enabled, + IsFreeTierEnabled = false, + ApiServerVersion = CosmosDBServerVersion.V3_2, + IsAnalyticalStorageEnabled = true, + AnalyticalStorageSchemaType = AnalyticalStorageSchemaType.WellDefined, + CreateMode = CosmosDBAccountCreateMode.Default, + BackupPolicy = new PeriodicModeBackupPolicy() + { + PeriodicModeProperties = new PeriodicModeProperties() + { + BackupIntervalInMinutes = 240, + BackupRetentionIntervalInHours = 8, + BackupStorageRedundancy = CosmosDBBackupStorageRedundancy.Geo, + }, + }, + Cors = +{ +new CosmosDBAccountCorsPolicy("https://test") +}, + NetworkAclBypass = NetworkAclBypass.AzureServices, + NetworkAclBypassResourceIds = +{ +new ResourceIdentifier("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName") +}, + CapacityTotalThroughputLimit = 2000, + EnableMaterializedViews = false, + EnableBurstCapacity = true, + MinimalTlsVersion = CosmosDBMinimalTlsVersion.Tls12, + EnablePriorityBasedExecution = true, + DefaultPriorityLevel = DefaultPriorityLevel.Low, + Identity = new ManagedServiceIdentity("SystemAssigned,UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +}, + }, + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content); + CosmosDBAccountResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountCreateMin + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBDatabaseAccountCreateMin() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountCreateMin.json + // this example is just showing the usage of "DatabaseAccounts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + CosmosDBAccountCreateOrUpdateContent content = new CosmosDBAccountCreateOrUpdateContent(new AzureLocation("westus"), new CosmosDBAccountLocation[] + { +new CosmosDBAccountLocation() +{ +LocationName = new AzureLocation("southcentralus"), +FailoverPriority = 0, +IsZoneRedundant = false, +} + }) + { + CreateMode = CosmosDBAccountCreateMode.Default, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content); + CosmosDBAccountResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBRestoreDatabaseAccountCreateUpdate.json + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBRestoreDatabaseAccountCreateUpdateJson() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json + // this example is just showing the usage of "DatabaseAccounts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation + string accountName = "ddb1"; + CosmosDBAccountCreateOrUpdateContent content = new CosmosDBAccountCreateOrUpdateContent(new AzureLocation("westus"), new CosmosDBAccountLocation[] + { +new CosmosDBAccountLocation() +{ +LocationName = new AzureLocation("southcentralus"), +FailoverPriority = 0, +IsZoneRedundant = false, +} + }) + { + Kind = CosmosDBAccountKind.GlobalDocumentDB, + ConsistencyPolicy = new ConsistencyPolicy(DefaultConsistencyLevel.BoundedStaleness) + { + MaxStalenessPrefix = 200, + MaxIntervalInSeconds = 10, + }, + KeyVaultKeyUri = new Uri("https://myKeyVault.vault.azure.net"), + IsFreeTierEnabled = false, + ApiServerVersion = CosmosDBServerVersion.V3_2, + IsAnalyticalStorageEnabled = true, + CreateMode = CosmosDBAccountCreateMode.Restore, + BackupPolicy = new ContinuousModeBackupPolicy() + { + ContinuousModeTier = ContinuousTier.Continuous30Days, + }, + RestoreParameters = new CosmosDBAccountRestoreParameters() + { + RestoreMode = CosmosDBAccountRestoreMode.PointInTime, + DatabasesToRestore = +{ +new DatabaseRestoreResourceInfo() +{ +DatabaseName = "db1", +CollectionNames = +{ +"collection1","collection2" +}, +},new DatabaseRestoreResourceInfo() +{ +DatabaseName = "db2", +CollectionNames = +{ +"collection3","collection4" +}, +} +}, + SourceBackupLocation = "westus", + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc", + RestoreTimestampInUtc = DateTimeOffset.Parse("2021-03-11T22:05:09Z"), + }, + EnableMaterializedViews = false, + MinimalTlsVersion = CosmosDBMinimalTlsVersion.Tls, + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content); + CosmosDBAccountResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBDatabaseAccountListByResourceGroup() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListByResourceGroup.json + // this example is just showing the usage of "DatabaseAccounts_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CosmosDBAccountResource + CosmosDBAccountCollection collection = resourceGroupResource.GetCosmosDBAccounts(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBAccountResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountResource.cs new file mode 100644 index 0000000000000..9f9625ce6e8b6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBAccountResource.cs @@ -0,0 +1,1086 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBAccountResource + { + // CosmosDBDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGet.json + // this example is just showing the usage of "DatabaseAccounts_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountResource result = await cosmosDBAccount.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountPatch + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBDatabaseAccountPatch() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountPatch.json + // this example is just showing the usage of "DatabaseAccounts_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountPatch patch = new CosmosDBAccountPatch() + { + Tags = +{ +["dept"] = "finance", +}, + Location = new AzureLocation("westus"), + Identity = new ManagedServiceIdentity("SystemAssigned,UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +}, + }, + ConsistencyPolicy = new ConsistencyPolicy(DefaultConsistencyLevel.BoundedStaleness) + { + MaxStalenessPrefix = 200, + MaxIntervalInSeconds = 10, + }, + IPRules = +{ +new CosmosDBIPAddressOrRange() +{ +IPAddressOrRange = "23.43.230.120", +},new CosmosDBIPAddressOrRange() +{ +IPAddressOrRange = "110.12.240.0/12", +} +}, + IsVirtualNetworkFilterEnabled = true, + VirtualNetworkRules = +{ +new CosmosDBVirtualNetworkRule() +{ +Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), +IgnoreMissingVnetServiceEndpoint = false, +} +}, + DefaultIdentity = "FirstPartyIdentity", + IsFreeTierEnabled = false, + IsAnalyticalStorageEnabled = true, + AnalyticalStorageSchemaType = AnalyticalStorageSchemaType.WellDefined, + BackupPolicy = new PeriodicModeBackupPolicy() + { + PeriodicModeProperties = new PeriodicModeProperties() + { + BackupIntervalInMinutes = 240, + BackupRetentionIntervalInHours = 720, + BackupStorageRedundancy = CosmosDBBackupStorageRedundancy.Geo, + }, + }, + NetworkAclBypass = NetworkAclBypass.AzureServices, + NetworkAclBypassResourceIds = +{ +new ResourceIdentifier("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName") +}, + DiagnosticLogEnableFullTextQuery = EnableFullTextQuery.True, + CapacityTotalThroughputLimit = 2000, + EnablePartitionMerge = true, + EnableBurstCapacity = true, + MinimalTlsVersion = CosmosDBMinimalTlsVersion.Tls, + EnablePriorityBasedExecution = true, + DefaultPriorityLevel = DefaultPriorityLevel.Low, + }; + ArmOperation lro = await cosmosDBAccount.UpdateAsync(WaitUntil.Completed, patch); + CosmosDBAccountResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDatabaseAccountDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBDatabaseAccountDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountDelete.json + // this example is just showing the usage of "DatabaseAccounts_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + await cosmosDBAccount.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountFailoverPriorityChange + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task FailoverPriorityChange_CosmosDBDatabaseAccountFailoverPriorityChange() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json + // this example is just showing the usage of "DatabaseAccounts_FailoverPriorityChange" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1-failover"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBFailoverPolicies failoverParameters = new CosmosDBFailoverPolicies(new CosmosDBFailoverPolicy[] + { +new CosmosDBFailoverPolicy() +{ +LocationName = new AzureLocation("eastus"), +FailoverPriority = 0, +},new CosmosDBFailoverPolicy() +{ +LocationName = new AzureLocation("westus"), +FailoverPriority = 1, +} + }); + await cosmosDBAccount.FailoverPriorityChangeAsync(WaitUntil.Completed, failoverParameters); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCosmosDBAccounts_CosmosDBDatabaseAccountList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountList.json + // this example is just showing the usage of "DatabaseAccounts_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (CosmosDBAccountResource item in subscriptionResource.GetCosmosDBAccountsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBAccountData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountListKeys + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetKeys_CosmosDBDatabaseAccountListKeys() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListKeys.json + // this example is just showing the usage of "DatabaseAccounts_ListKeys" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountKeyList result = await cosmosDBAccount.GetKeysAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDatabaseAccountListConnectionStrings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConnectionStrings_CosmosDBDatabaseAccountListConnectionStrings() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListConnectionStrings.json + // this example is just showing the usage of "DatabaseAccounts_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (CosmosDBAccountConnectionString item in cosmosDBAccount.GetConnectionStringsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountListConnectionStringsMongo + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConnectionStrings_CosmosDBDatabaseAccountListConnectionStringsMongo() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json + // this example is just showing the usage of "DatabaseAccounts_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "mongo-ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (CosmosDBAccountConnectionString item in cosmosDBAccount.GetConnectionStringsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountOfflineRegion + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task OfflineRegion_CosmosDBDatabaseAccountOfflineRegion() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountOfflineRegion.json + // this example is just showing the usage of "DatabaseAccounts_OfflineRegion" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + RegionForOnlineOffline regionParameterForOffline = new RegionForOnlineOffline("North Europe"); + await cosmosDBAccount.OfflineRegionAsync(WaitUntil.Completed, regionParameterForOffline); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountOnlineRegion + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task OnlineRegion_CosmosDBDatabaseAccountOnlineRegion() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountOnlineRegion.json + // this example is just showing the usage of "DatabaseAccounts_OnlineRegion" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + RegionForOnlineOffline regionParameterForOnline = new RegionForOnlineOffline("North Europe"); + await cosmosDBAccount.OnlineRegionAsync(WaitUntil.Completed, regionParameterForOnline); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountListReadOnlyKeys + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetReadOnlyKeys_CosmosDBDatabaseAccountListReadOnlyKeys() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json + // this example is just showing the usage of "DatabaseAccounts_ListReadOnlyKeys" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountReadOnlyKeyList result = await cosmosDBAccount.GetReadOnlyKeysAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDatabaseAccountRegenerateKey + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RegenerateKey_CosmosDBDatabaseAccountRegenerateKey() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountRegenerateKey.json + // this example is just showing the usage of "DatabaseAccounts_RegenerateKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation + CosmosDBAccountRegenerateKeyContent content = new CosmosDBAccountRegenerateKeyContent(CosmosDBAccountKeyKind.Primary); + await cosmosDBAccount.RegenerateKeyAsync(WaitUntil.Completed, content); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountCheckNameExists + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckNameExistsDatabaseAccount_CosmosDBDatabaseAccountCheckNameExists() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountCheckNameExists.json + // this example is just showing the usage of "DatabaseAccounts_CheckNameExists" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + string accountName = "ddb1"; + bool result = await tenantResource.CheckNameExistsDatabaseAccountAsync(accountName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDatabaseAccountGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetrics_CosmosDBDatabaseAccountGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGetMetrics.json + // this example is just showing the usage of "DatabaseAccounts_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsAsync(filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountGetUsages + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsages_CosmosDBDatabaseAccountGetUsages() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGetUsages.json + // this example is just showing the usage of "DatabaseAccounts_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string filter = "$filter=name.value eq 'Storage'"; + await foreach (CosmosDBBaseUsage item in cosmosDBAccount.GetUsagesAsync(filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountGetMetricDefinitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricDefinitions_CosmosDBDatabaseAccountGetMetricDefinitions() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json + // this example is just showing the usage of "DatabaseAccounts_ListMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (CosmosDBMetricDefinition item in cosmosDBAccount.GetMetricDefinitionsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsDatabases_CosmosDBDatabaseGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseGetMetrics.json + // this example is just showing the usage of "Database_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "rid"; + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsDatabasesAsync(databaseRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseGetUsages + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsagesDatabases_CosmosDBDatabaseGetUsages() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseGetUsages.json + // this example is just showing the usage of "Database_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string filter = "$filter=name.value eq 'Storage'"; + await foreach (CosmosDBBaseUsage item in cosmosDBAccount.GetUsagesDatabasesAsync(databaseRid, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseGetMetricDefinitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricDefinitionsDatabases_CosmosDBDatabaseGetMetricDefinitions() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseGetMetricDefinitions.json + // this example is just showing the usage of "Database_ListMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + await foreach (CosmosDBMetricDefinition item in cosmosDBAccount.GetMetricDefinitionsDatabasesAsync(databaseRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCollectionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsCollections_CosmosDBCollectionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionGetMetrics.json + // this example is just showing the usage of "Collection_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsCollectionsAsync(databaseRid, collectionRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCollectionGetUsages + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsagesCollections_CosmosDBCollectionGetUsages() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionGetUsages.json + // this example is just showing the usage of "Collection_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=name.value eq 'Storage'"; + await foreach (CosmosDBBaseUsage item in cosmosDBAccount.GetUsagesCollectionsAsync(databaseRid, collectionRid, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCollectionGetMetricDefinitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricDefinitionsCollections_CosmosDBCollectionGetMetricDefinitions() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionGetMetricDefinitions.json + // this example is just showing the usage of "Collection_ListMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + await foreach (CosmosDBMetricDefinition item in cosmosDBAccount.GetMetricDefinitionsCollectionsAsync(databaseRid, collectionRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRegionCollectionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsCollectionRegions_CosmosDBRegionCollectionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRegionCollectionGetMetrics.json + // this example is just showing the usage of "CollectionRegion_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string region = "North Europe"; + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsCollectionRegionsAsync(region, databaseRid, collectionRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsDatabaseAccountRegions_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDatabaseAccountRegionGetMetrics.json + // this example is just showing the usage of "DatabaseAccountRegion_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string region = "North Europe"; + string filter = "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBBaseMetric item in cosmosDBAccount.GetMetricsDatabaseAccountRegionsAsync(region, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPercentileSourceTargets_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPercentileSourceTargetGetMetrics.json + // this example is just showing the usage of "PercentileSourceTarget_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string sourceRegion = "West Central US"; + string targetRegion = "East US"; + string filter = "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBPercentileMetric item in cosmosDBAccount.GetMetricsPercentileSourceTargetsAsync(sourceRegion, targetRegion, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPercentileTargets_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPercentileTargetGetMetrics.json + // this example is just showing the usage of "PercentileTarget_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string targetRegion = "East US"; + string filter = "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBPercentileMetric item in cosmosDBAccount.GetMetricsPercentileTargetsAsync(targetRegion, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPercentiles_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPercentileGetMetrics.json + // this example is just showing the usage of "Percentile_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string filter = "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z"; + await foreach (CosmosDBPercentileMetric item in cosmosDBAccount.GetMetricsPercentilesAsync(filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsCollectionPartitionRegions_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionPartitionRegionGetMetrics.json + // this example is just showing the usage of "CollectionPartitionRegion_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string region = "North Europe"; + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z"; + await foreach (PartitionMetric item in cosmosDBAccount.GetMetricsCollectionPartitionRegionsAsync(region, databaseRid, collectionRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsCollectionPartitions_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionPartitionGetMetrics.json + // this example is just showing the usage of "CollectionPartition_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z"; + await foreach (PartitionMetric item in cosmosDBAccount.GetMetricsCollectionPartitionsAsync(databaseRid, collectionRid, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBCollectionGetUsages + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsagesCollectionPartitions_CosmosDBCollectionGetUsages() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBCollectionPartitionGetUsages.json + // this example is just showing the usage of "CollectionPartition_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string filter = "$filter=name.value eq 'Partition Storage'"; + await foreach (PartitionUsage item in cosmosDBAccount.GetUsagesCollectionPartitionsAsync(databaseRid, collectionRid, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPartitionKeyRangeIds_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPKeyRangeIdGetMetrics.json + // this example is just showing the usage of "PartitionKeyRangeId_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string partitionKeyRangeId = "0"; + string filter = "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z"; + await foreach (PartitionMetric item in cosmosDBAccount.GetMetricsPartitionKeyRangeIdsAsync(databaseRid, collectionRid, partitionKeyRangeId, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBDatabaseAccountRegionGetMetrics + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMetricsPartitionKeyRangeIdRegions_CosmosDBDatabaseAccountRegionGetMetrics() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json + // this example is just showing the usage of "PartitionKeyRangeIdRegion_ListMetrics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string region = "West US"; + string databaseRid = "databaseRid"; + string collectionRid = "collectionRid"; + string partitionKeyRangeId = "0"; + string filter = "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z"; + await foreach (PartitionMetric item in cosmosDBAccount.GetMetricsPartitionKeyRangeIdRegionsAsync(region, databaseRid, collectionRid, partitionKeyRangeId, filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleCollection.cs new file mode 100644 index 0000000000000..f21fa72c1c5e1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBFirewallRuleCollection + { + // Create a firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateAFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleCreate.json + // this example is just showing the usage of "MongoClusters_CreateOrUpdateFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + CosmosDBFirewallRuleData data = new CosmosDBFirewallRuleData("0.0.0.0", "255.255.255.255"); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, firewallRuleName, data); + CosmosDBFirewallRuleResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json + // this example is just showing the usage of "MongoClusters_GetFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + CosmosDBFirewallRuleResource result = await collection.GetAsync(firewallRuleName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json + // this example is just showing the usage of "MongoClusters_GetFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + bool result = await collection.ExistsAsync(firewallRuleName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json + // this example is just showing the usage of "MongoClusters_GetFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation + string firewallRuleName = "rule1"; + NullableResponse response = await collection.GetIfExistsAsync(firewallRuleName); + CosmosDBFirewallRuleResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // List firewall rules of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListFirewallRulesOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleList.json + // this example is just showing the usage of "MongoClusters_ListFirewallRules" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this CosmosDBFirewallRuleResource + CosmosDBFirewallRuleCollection collection = mongoCluster.GetCosmosDBFirewallRules(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBFirewallRuleResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleResource.cs new file mode 100644 index 0000000000000..a09baa2bf96d7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBFirewallRuleResource.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBFirewallRuleResource + { + // Create a firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateAFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleCreate.json + // this example is just showing the usage of "MongoClusters_CreateOrUpdateFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBFirewallRuleResource created on azure + // for more information of creating CosmosDBFirewallRuleResource, please refer to the document of CosmosDBFirewallRuleResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string firewallRuleName = "rule1"; + ResourceIdentifier cosmosDBFirewallRuleResourceId = CosmosDBFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, firewallRuleName); + CosmosDBFirewallRuleResource cosmosDBFirewallRule = client.GetCosmosDBFirewallRuleResource(cosmosDBFirewallRuleResourceId); + + // invoke the operation + CosmosDBFirewallRuleData data = new CosmosDBFirewallRuleData("0.0.0.0", "255.255.255.255"); + ArmOperation lro = await cosmosDBFirewallRule.UpdateAsync(WaitUntil.Completed, data); + CosmosDBFirewallRuleResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleDelete.json + // this example is just showing the usage of "MongoClusters_DeleteFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBFirewallRuleResource created on azure + // for more information of creating CosmosDBFirewallRuleResource, please refer to the document of CosmosDBFirewallRuleResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string firewallRuleName = "rule1"; + ResourceIdentifier cosmosDBFirewallRuleResourceId = CosmosDBFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, firewallRuleName); + CosmosDBFirewallRuleResource cosmosDBFirewallRule = client.GetCosmosDBFirewallRuleResource(cosmosDBFirewallRuleResourceId); + + // invoke the operation + await cosmosDBFirewallRule.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get the firewall rule of the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetTheFirewallRuleOfTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json + // this example is just showing the usage of "MongoClusters_GetFirewallRule" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBFirewallRuleResource created on azure + // for more information of creating CosmosDBFirewallRuleResource, please refer to the document of CosmosDBFirewallRuleResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string firewallRuleName = "rule1"; + ResourceIdentifier cosmosDBFirewallRuleResourceId = CosmosDBFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, firewallRuleName); + CosmosDBFirewallRuleResource cosmosDBFirewallRule = client.GetCosmosDBFirewallRuleResource(cosmosDBFirewallRuleResourceId); + + // invoke the operation + CosmosDBFirewallRuleResource result = await cosmosDBFirewallRule.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBFirewallRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationCollection.cs new file mode 100644 index 0000000000000..4e89317e31329 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationCollection.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBLocationCollection + { + // CosmosDBLocationList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBLocationList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationList.json + // this example is just showing the usage of "Locations_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CosmosDBLocationResource + CosmosDBLocationCollection collection = subscriptionResource.GetCosmosDBLocations(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBLocationResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBLocationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBLocationGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationGet.json + // this example is just showing the usage of "Locations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CosmosDBLocationResource + CosmosDBLocationCollection collection = subscriptionResource.GetCosmosDBLocations(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + CosmosDBLocationResource result = await collection.GetAsync(location); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBLocationGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationGet.json + // this example is just showing the usage of "Locations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CosmosDBLocationResource + CosmosDBLocationCollection collection = subscriptionResource.GetCosmosDBLocations(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + bool result = await collection.ExistsAsync(location); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBLocationGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationGet.json + // this example is just showing the usage of "Locations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this CosmosDBLocationResource + CosmosDBLocationCollection collection = subscriptionResource.GetCosmosDBLocations(); + + // invoke the operation + AzureLocation location = new AzureLocation("westus"); + NullableResponse response = await collection.GetIfExistsAsync(location); + CosmosDBLocationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationResource.cs new file mode 100644 index 0000000000000..eceb23a4ff237 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBLocationResource.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBLocationResource + { + // CosmosDBLocationGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBLocationGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBLocationGet.json + // this example is just showing the usage of "Locations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + AzureLocation location = new AzureLocation("westus"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // invoke the operation + CosmosDBLocationResource result = await cosmosDBLocation.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBLocationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Check name availability + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckMongoClusterNameAailability_CheckNameAvailability() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterNameAvailability.json + // this example is just showing the usage of "MongoClusters_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + AzureLocation location = new AzureLocation("westus2"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // invoke the operation + CheckCosmosDBNameAvailabilityContent content = new CheckCosmosDBNameAvailabilityContent() + { + Name = "newmongocluster", + ResourceType = "Microsoft.DocumentDB/mongoClusters", + }; + CheckCosmosDBNameAvailabilityResponse result = await cosmosDBLocation.CheckMongoClusterNameAailabilityAsync(content); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Check name availability already exists result + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckMongoClusterNameAailability_CheckNameAvailabilityAlreadyExistsResult() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterNameAvailability_AlreadyExists.json + // this example is just showing the usage of "MongoClusters_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + AzureLocation location = new AzureLocation("westus2"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // invoke the operation + CheckCosmosDBNameAvailabilityContent content = new CheckCosmosDBNameAvailabilityContent() + { + Name = "existingmongocluster", + ResourceType = "Microsoft.DocumentDB/mongoClusters", + }; + CheckCosmosDBNameAvailabilityResponse result = await cosmosDBLocation.CheckMongoClusterNameAailabilityAsync(content); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionCollection.cs new file mode 100644 index 0000000000000..fa540c5c80cd1 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBPrivateEndpointConnectionCollection + { + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionListGet.json + // this example is just showing the usage of "PrivateEndpointConnections_ListByDatabaseAccount" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBPrivateEndpointConnectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + CosmosDBPrivateEndpointConnectionResource result = await collection.GetAsync(privateEndpointConnectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + bool result = await collection.ExistsAsync(privateEndpointConnectionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + CosmosDBPrivateEndpointConnectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Approve or reject a private endpoint connection with a given name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApproveOrRejectAPrivateEndpointConnectionWithAGivenName() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionUpdate.json + // this example is just showing the usage of "PrivateEndpointConnections_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateEndpointConnectionResource + CosmosDBPrivateEndpointConnectionCollection collection = cosmosDBAccount.GetCosmosDBPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "privateEndpointConnectionName"; + CosmosDBPrivateEndpointConnectionData data = new CosmosDBPrivateEndpointConnectionData() + { + ConnectionState = new CosmosDBPrivateLinkServiceConnectionStateProperty() + { + Status = "Approved", + Description = "Approved by johndoe@contoso.com", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); + CosmosDBPrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionResource.cs new file mode 100644 index 0000000000000..abc0c41eabaa6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateEndpointConnectionResource.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBPrivateEndpointConnectionResource + { + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionGet.json + // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBPrivateEndpointConnectionResource created on azure + // for more information of creating CosmosDBPrivateEndpointConnectionResource, please refer to the document of CosmosDBPrivateEndpointConnectionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string privateEndpointConnectionName = "privateEndpointConnectionName"; + ResourceIdentifier cosmosDBPrivateEndpointConnectionResourceId = CosmosDBPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, privateEndpointConnectionName); + CosmosDBPrivateEndpointConnectionResource cosmosDBPrivateEndpointConnection = client.GetCosmosDBPrivateEndpointConnectionResource(cosmosDBPrivateEndpointConnectionResourceId); + + // invoke the operation + CosmosDBPrivateEndpointConnectionResource result = await cosmosDBPrivateEndpointConnection.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Approve or reject a private endpoint connection with a given name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApproveOrRejectAPrivateEndpointConnectionWithAGivenName() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionUpdate.json + // this example is just showing the usage of "PrivateEndpointConnections_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBPrivateEndpointConnectionResource created on azure + // for more information of creating CosmosDBPrivateEndpointConnectionResource, please refer to the document of CosmosDBPrivateEndpointConnectionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string privateEndpointConnectionName = "privateEndpointConnectionName"; + ResourceIdentifier cosmosDBPrivateEndpointConnectionResourceId = CosmosDBPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, privateEndpointConnectionName); + CosmosDBPrivateEndpointConnectionResource cosmosDBPrivateEndpointConnection = client.GetCosmosDBPrivateEndpointConnectionResource(cosmosDBPrivateEndpointConnectionResourceId); + + // invoke the operation + CosmosDBPrivateEndpointConnectionData data = new CosmosDBPrivateEndpointConnectionData() + { + ConnectionState = new CosmosDBPrivateLinkServiceConnectionStateProperty() + { + Status = "Approved", + Description = "Approved by johndoe@contoso.com", + }, + }; + ArmOperation lro = await cosmosDBPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); + CosmosDBPrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Deletes a private endpoint connection with a given name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeletesAPrivateEndpointConnectionWithAGivenName() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateEndpointConnectionDelete.json + // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBPrivateEndpointConnectionResource created on azure + // for more information of creating CosmosDBPrivateEndpointConnectionResource, please refer to the document of CosmosDBPrivateEndpointConnectionResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string privateEndpointConnectionName = "privateEndpointConnectionName"; + ResourceIdentifier cosmosDBPrivateEndpointConnectionResourceId = CosmosDBPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, privateEndpointConnectionName); + CosmosDBPrivateEndpointConnectionResource cosmosDBPrivateEndpointConnection = client.GetCosmosDBPrivateEndpointConnectionResource(cosmosDBPrivateEndpointConnectionResourceId); + + // invoke the operation + await cosmosDBPrivateEndpointConnection.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResource.cs new file mode 100644 index 0000000000000..5ab289ca9532a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBPrivateLinkResource + { + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBPrivateLinkResource created on azure + // for more information of creating CosmosDBPrivateLinkResource, please refer to the document of CosmosDBPrivateLinkResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string groupName = "sql"; + ResourceIdentifier cosmosDBPrivateLinkResourceId = CosmosDBPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, groupName); + CosmosDBPrivateLinkResource cosmosDBPrivateLinkResource = client.GetCosmosDBPrivateLinkResource(cosmosDBPrivateLinkResourceId); + + // invoke the operation + CosmosDBPrivateLinkResource result = await cosmosDBPrivateLinkResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResourceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResourceCollection.cs new file mode 100644 index 0000000000000..19e31ec43400c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBPrivateLinkResourceCollection.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBPrivateLinkResourceCollection + { + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceListGet.json + // this example is just showing the usage of "PrivateLinkResources_ListByDatabaseAccount" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateLinkResource + CosmosDBPrivateLinkResourceCollection collection = cosmosDBAccount.GetCosmosDBPrivateLinkResources(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBPrivateLinkResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateLinkResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateLinkResource + CosmosDBPrivateLinkResourceCollection collection = cosmosDBAccount.GetCosmosDBPrivateLinkResources(); + + // invoke the operation + string groupName = "sql"; + CosmosDBPrivateLinkResource result = await collection.GetAsync(groupName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateLinkResource + CosmosDBPrivateLinkResourceCollection collection = cosmosDBAccount.GetCosmosDBPrivateLinkResources(); + + // invoke the operation + string groupName = "sql"; + bool result = await collection.ExistsAsync(groupName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsPrivateEndpointConnection() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBPrivateLinkResourceGet.json + // this example is just showing the usage of "PrivateLinkResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBPrivateLinkResource + CosmosDBPrivateLinkResourceCollection collection = cosmosDBAccount.GetCosmosDBPrivateLinkResources(); + + // invoke the operation + string groupName = "sql"; + NullableResponse response = await collection.GetIfExistsAsync(groupName); + CosmosDBPrivateLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceCollection.cs new file mode 100644 index 0000000000000..d78a9cefed309 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceCollection.cs @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBServiceCollection + { + // CosmosDBServicesList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBServicesList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBServicesList.json + // this example is just showing the usage of "Service_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBServiceResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // DataTransferServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_DataTransferServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "DataTransfer"; + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.DataTransfer, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GraphAPIComputeServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GraphAPIComputeServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "GraphAPICompute"; + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.GraphApiCompute, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // MaterializedViewsBuilderServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_MaterializedViewsBuilderServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "MaterializedViewsBuilder"; + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.MaterializedViewsBuilder, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SqlDedicatedGatewayServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_SqlDedicatedGatewayServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "SqlDedicatedGateway"; + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.SqlDedicatedGateway, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serviceName, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DataTransferServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_DataTransferServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "DataTransfer"; + CosmosDBServiceResource result = await collection.GetAsync(serviceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DataTransferServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_DataTransferServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "DataTransfer"; + bool result = await collection.ExistsAsync(serviceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // DataTransferServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_DataTransferServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "DataTransfer"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + CosmosDBServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // GraphAPIComputeServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GraphAPIComputeServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "GraphAPICompute"; + CosmosDBServiceResource result = await collection.GetAsync(serviceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GraphAPIComputeServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GraphAPIComputeServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "GraphAPICompute"; + bool result = await collection.ExistsAsync(serviceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GraphAPIComputeServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GraphAPIComputeServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "GraphAPICompute"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + CosmosDBServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // MaterializedViewsBuilderServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_MaterializedViewsBuilderServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "MaterializedViewsBuilder"; + CosmosDBServiceResource result = await collection.GetAsync(serviceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // MaterializedViewsBuilderServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_MaterializedViewsBuilderServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "MaterializedViewsBuilder"; + bool result = await collection.ExistsAsync(serviceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // MaterializedViewsBuilderServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_MaterializedViewsBuilderServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "MaterializedViewsBuilder"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + CosmosDBServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // SqlDedicatedGatewayServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SqlDedicatedGatewayServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "SqlDedicatedGateway"; + CosmosDBServiceResource result = await collection.GetAsync(serviceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SqlDedicatedGatewayServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_SqlDedicatedGatewayServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "SqlDedicatedGateway"; + bool result = await collection.ExistsAsync(serviceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // SqlDedicatedGatewayServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SqlDedicatedGatewayServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBServiceResource + CosmosDBServiceCollection collection = cosmosDBAccount.GetCosmosDBServices(); + + // invoke the operation + string serviceName = "SqlDedicatedGateway"; + NullableResponse response = await collection.GetIfExistsAsync(serviceName); + CosmosDBServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceResource.cs new file mode 100644 index 0000000000000..ce661b72b8247 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBServiceResource.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBServiceResource + { + // DataTransferServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_DataTransferServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "DataTransfer"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.DataTransfer, + }; + ArmOperation lro = await cosmosDBService.UpdateAsync(WaitUntil.Completed, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GraphAPIComputeServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GraphAPIComputeServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "GraphAPICompute"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.GraphApiCompute, + }; + ArmOperation lro = await cosmosDBService.UpdateAsync(WaitUntil.Completed, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // MaterializedViewsBuilderServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_MaterializedViewsBuilderServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "MaterializedViewsBuilder"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.MaterializedViewsBuilder, + }; + ArmOperation lro = await cosmosDBService.UpdateAsync(WaitUntil.Completed, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SqlDedicatedGatewayServiceCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_SqlDedicatedGatewayServiceCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceCreate.json + // this example is just showing the usage of "Service_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "SqlDedicatedGateway"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceCreateOrUpdateContent content = new CosmosDBServiceCreateOrUpdateContent() + { + InstanceSize = CosmosDBServiceSize.CosmosD4S, + InstanceCount = 1, + ServiceType = CosmosDBServiceType.SqlDedicatedGateway, + }; + ArmOperation lro = await cosmosDBService.UpdateAsync(WaitUntil.Completed, content); + CosmosDBServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DataTransferServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_DataTransferServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "DataTransfer"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceResource result = await cosmosDBService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GraphAPIComputeServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GraphAPIComputeServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "GraphAPICompute"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceResource result = await cosmosDBService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // MaterializedViewsBuilderServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_MaterializedViewsBuilderServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "MaterializedViewsBuilder"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceResource result = await cosmosDBService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SqlDedicatedGatewayServiceGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SqlDedicatedGatewayServiceGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceGet.json + // this example is just showing the usage of "Service_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "SqlDedicatedGateway"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + CosmosDBServiceResource result = await cosmosDBService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DataTransferServiceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DataTransferServiceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBDataTransferServiceDelete.json + // this example is just showing the usage of "Service_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "DataTransfer"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + await cosmosDBService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // GraphAPIComputeServiceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_GraphAPIComputeServiceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphAPIComputeServiceDelete.json + // this example is just showing the usage of "Service_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "GraphAPICompute"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + await cosmosDBService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // MaterializedViewsBuilderServiceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_MaterializedViewsBuilderServiceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMaterializedViewsBuilderServiceDelete.json + // this example is just showing the usage of "Service_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "MaterializedViewsBuilder"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + await cosmosDBService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // SqlDedicatedGatewayServiceDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_SqlDedicatedGatewayServiceDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDedicatedGatewayServiceDelete.json + // this example is just showing the usage of "Service_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBServiceResource created on azure + // for more information of creating CosmosDBServiceResource, please refer to the document of CosmosDBServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string serviceName = "SqlDedicatedGateway"; + ResourceIdentifier cosmosDBServiceResourceId = CosmosDBServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, serviceName); + CosmosDBServiceResource cosmosDBService = client.GetCosmosDBServiceResource(cosmosDBServiceResourceId); + + // invoke the operation + await cosmosDBService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyCollection.cs new file mode 100644 index 0000000000000..90a72ef2de574 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyCollection.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlClientEncryptionKeyCollection + { + // CosmosDBClientEncryptionKeysList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBClientEncryptionKeysList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeysList.json + // this example is just showing the usage of "SqlResources_ListClientEncryptionKeys" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlClientEncryptionKeyResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBClientEncryptionKeyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBClientEncryptionKeyGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json + // this example is just showing the usage of "SqlResources_GetClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation + string clientEncryptionKeyName = "cekName"; + CosmosDBSqlClientEncryptionKeyResource result = await collection.GetAsync(clientEncryptionKeyName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBClientEncryptionKeyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBClientEncryptionKeyGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json + // this example is just showing the usage of "SqlResources_GetClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation + string clientEncryptionKeyName = "cekName"; + bool result = await collection.ExistsAsync(clientEncryptionKeyName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBClientEncryptionKeyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBClientEncryptionKeyGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json + // this example is just showing the usage of "SqlResources_GetClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation + string clientEncryptionKeyName = "cekName"; + NullableResponse response = await collection.GetIfExistsAsync(clientEncryptionKeyName); + CosmosDBSqlClientEncryptionKeyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBClientEncryptionKeyCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBClientEncryptionKeyCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlClientEncryptionKeyResource + CosmosDBSqlClientEncryptionKeyCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlClientEncryptionKeys(); + + // invoke the operation + string clientEncryptionKeyName = "cekName"; + CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent content = new CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(new CosmosDBSqlClientEncryptionKeyResourceInfo() + { + Id = "cekName", + EncryptionAlgorithm = "AEAD_AES_256_CBC_HMAC_SHA256", + WrappedDataEncryptionKey = Convert.FromBase64String("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), + KeyWrapMetadata = new CosmosDBKeyWrapMetadata() + { + Name = "customerManagedKey", + CosmosDBKeyWrapMetadataType = "AzureKeyVault", + Value = "AzureKeyVault Key URL", + Algorithm = "RSA-OAEP", + }, + }); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clientEncryptionKeyName, content); + CosmosDBSqlClientEncryptionKeyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyResource.cs new file mode 100644 index 0000000000000..a7db2ffeaab9d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlClientEncryptionKeyResource.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlClientEncryptionKeyResource + { + // CosmosDBClientEncryptionKeyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBClientEncryptionKeyGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json + // this example is just showing the usage of "SqlResources_GetClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlClientEncryptionKeyResource created on azure + // for more information of creating CosmosDBSqlClientEncryptionKeyResource, please refer to the document of CosmosDBSqlClientEncryptionKeyResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + string clientEncryptionKeyName = "cekName"; + ResourceIdentifier cosmosDBSqlClientEncryptionKeyResourceId = CosmosDBSqlClientEncryptionKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, clientEncryptionKeyName); + CosmosDBSqlClientEncryptionKeyResource cosmosDBSqlClientEncryptionKey = client.GetCosmosDBSqlClientEncryptionKeyResource(cosmosDBSqlClientEncryptionKeyResourceId); + + // invoke the operation + CosmosDBSqlClientEncryptionKeyResource result = await cosmosDBSqlClientEncryptionKey.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBClientEncryptionKeyCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBClientEncryptionKeyCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateClientEncryptionKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlClientEncryptionKeyResource created on azure + // for more information of creating CosmosDBSqlClientEncryptionKeyResource, please refer to the document of CosmosDBSqlClientEncryptionKeyResource + string subscriptionId = "subId"; + string resourceGroupName = "rgName"; + string accountName = "accountName"; + string databaseName = "databaseName"; + string clientEncryptionKeyName = "cekName"; + ResourceIdentifier cosmosDBSqlClientEncryptionKeyResourceId = CosmosDBSqlClientEncryptionKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, clientEncryptionKeyName); + CosmosDBSqlClientEncryptionKeyResource cosmosDBSqlClientEncryptionKey = client.GetCosmosDBSqlClientEncryptionKeyResource(cosmosDBSqlClientEncryptionKeyResourceId); + + // invoke the operation + CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent content = new CosmosDBSqlClientEncryptionKeyCreateOrUpdateContent(new CosmosDBSqlClientEncryptionKeyResourceInfo() + { + Id = "cekName", + EncryptionAlgorithm = "AEAD_AES_256_CBC_HMAC_SHA256", + WrappedDataEncryptionKey = Convert.FromBase64String("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), + KeyWrapMetadata = new CosmosDBKeyWrapMetadata() + { + Name = "customerManagedKey", + CosmosDBKeyWrapMetadataType = "AzureKeyVault", + Value = "AzureKeyVault Key URL", + Algorithm = "RSA-OAEP", + }, + }); + ArmOperation lro = await cosmosDBSqlClientEncryptionKey.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlClientEncryptionKeyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlClientEncryptionKeyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerCollection.cs new file mode 100644 index 0000000000000..fb60bcabc5d47 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerCollection.cs @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlContainerCollection + { + // CosmosDBSqlContainerList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlContainerList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerList.json + // this example is just showing the usage of "SqlResources_ListSqlContainers" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlContainerResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlContainerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + CosmosDBSqlContainerResource result = await collection.GetAsync(containerName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlContainerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + bool result = await collection.ExistsAsync(containerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlContainerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + NullableResponse response = await collection.GetIfExistsAsync(containerName); + CosmosDBSqlContainerResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlContainerCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlContainerCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("containerName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/AccountNumber" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + DefaultTtl = 100, + UniqueKeys = +{ +new CosmosDBUniqueKey() +{ +Paths = +{ +"/testPath" +}, +} +}, + ConflictResolutionPolicy = new ConflictResolutionPolicy() + { + Mode = ConflictResolutionMode.LastWriterWins, + ConflictResolutionPath = "/path", + }, + ClientEncryptionPolicy = new CosmosDBClientEncryptionPolicy(new CosmosDBClientEncryptionIncludedPath[] + { +new CosmosDBClientEncryptionIncludedPath("/path","keyId","Deterministic","AEAD_AES_256_CBC_HMAC_SHA256") + }, 2), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerName, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlContainerRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerRestore.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "containerName"; + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("containerName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerName, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlMaterializedViewCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlMaterializedViewCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlMaterializedViewCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // get the collection of this CosmosDBSqlContainerResource + CosmosDBSqlContainerCollection collection = cosmosDBSqlDatabase.GetCosmosDBSqlContainers(); + + // invoke the operation + string containerName = "mvContainerName"; + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("mvContainerName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/mvpk" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + MaterializedViewDefinition = new MaterializedViewDefinition("sourceContainerName", "select * from ROOT"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, containerName, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerResource.cs new file mode 100644 index 0000000000000..3138bd98fd1d8 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerResource.cs @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlContainerResource + { + // CosmosDBSqlContainerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlContainerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + CosmosDBSqlContainerResource result = await cosmosDBSqlContainer.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlContainerCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("containerName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/AccountNumber" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + DefaultTtl = 100, + UniqueKeys = +{ +new CosmosDBUniqueKey() +{ +Paths = +{ +"/testPath" +}, +} +}, + ConflictResolutionPolicy = new ConflictResolutionPolicy() + { + Mode = ConflictResolutionMode.LastWriterWins, + ConflictResolutionPath = "/path", + }, + ClientEncryptionPolicy = new CosmosDBClientEncryptionPolicy(new CosmosDBClientEncryptionIncludedPath[] + { +new CosmosDBClientEncryptionIncludedPath("/path","keyId","Deterministic","AEAD_AES_256_CBC_HMAC_SHA256") + }, 2), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlContainer.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlContainerRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerRestore.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("containerName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlContainer.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlMaterializedViewCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlMaterializedViewCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlMaterializedViewCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "mvContainerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + CosmosDBSqlContainerCreateOrUpdateContent content = new CosmosDBSqlContainerCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlContainerResourceInfo("mvContainerName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/mvpk" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + MaterializedViewDefinition = new MaterializedViewDefinition("sourceContainerName", "select * from ROOT"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlContainer.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlContainerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlContainerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlContainerDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlContainer" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + await cosmosDBSqlContainer.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlContainerPartitionMerge + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSqlContainerPartitionMerge_CosmosDBSqlContainerPartitionMerge() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerPartitionMerge.json + // this example is just showing the usage of "SqlResources_ListSqlContainerPartitionMerge" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + MergeParameters mergeParameters = new MergeParameters() + { + IsDryRun = false, + }; + ArmOperation lro = await cosmosDBSqlContainer.GetSqlContainerPartitionMergeAsync(WaitUntil.Completed, mergeParameters); + PhysicalPartitionStorageInfoCollection result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlContainerBackupInformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveContinuousBackupInformation_CosmosDBSqlContainerBackupInformation() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerBackupInformation.json + // this example is just showing the usage of "SqlResources_RetrieveContinuousBackupInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // invoke the operation + ContinuousBackupRestoreLocation location = new ContinuousBackupRestoreLocation() + { + Location = new AzureLocation("North Europe"), + }; + ArmOperation lro = await cosmosDBSqlContainer.RetrieveContinuousBackupInformationAsync(WaitUntil.Completed, location); + CosmosDBBackupInformation result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerThroughputSettingResource.cs new file mode 100644 index 0000000000000..35dde54f1ac6b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlContainerThroughputSettingResource.cs @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlContainerThroughputSettingResource + { + // CosmosDBSqlContainerThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlContainerThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerThroughputGet.json + // this example is just showing the usage of "SqlResources_GetSqlContainerThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + CosmosDBSqlContainerThroughputSettingResource result = await cosmosDBSqlContainerThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlContainerThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerThroughputUpdate.json + // this example is just showing the usage of "SqlResources_UpdateSqlContainerThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CosmosDBSqlContainerThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateSqlContainerToAutoscale_CosmosDBSqlContainerMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerMigrateToAutoscale.json + // this example is just showing the usage of "SqlResources_MigrateSqlContainerToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.MigrateSqlContainerToAutoscaleAsync(WaitUntil.Completed); + CosmosDBSqlContainerThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateSqlContainerToManualThroughput_CosmosDBSqlContainerMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerMigrateToManualThroughput.json + // this example is just showing the usage of "SqlResources_MigrateSqlContainerToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.MigrateSqlContainerToManualThroughputAsync(WaitUntil.Completed); + CosmosDBSqlContainerThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlContainerRetrieveThroughputDistribution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlContainerRetrieveThroughputDistribution_CosmosDBSqlContainerRetrieveThroughputDistribution() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerRetrieveThroughputDistribution.json + // this example is just showing the usage of "SqlResources_SqlContainerRetrieveThroughputDistribution" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + RetrieveThroughputParameters retrieveThroughputParameters = new RetrieveThroughputParameters(new AzureLocation("placeholder"), new RetrieveThroughputPropertiesResource(new WritableSubResource[] + { +new WritableSubResource() +{ +Id = new ResourceIdentifier("0"), +},new WritableSubResource() +{ +Id = new ResourceIdentifier("1"), +} + })); + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.SqlContainerRetrieveThroughputDistributionAsync(WaitUntil.Completed, retrieveThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlContainerRedistributeThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlContainerRedistributeThroughput_CosmosDBSqlContainerRedistributeThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlContainerRedistributeThroughput.json + // this example is just showing the usage of "SqlResources_SqlContainerRedistributeThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlContainerThroughputSettingResource, please refer to the document of CosmosDBSqlContainerThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerThroughputSettingResourceId = CosmosDBSqlContainerThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerThroughputSettingResource cosmosDBSqlContainerThroughputSetting = client.GetCosmosDBSqlContainerThroughputSettingResource(cosmosDBSqlContainerThroughputSettingResourceId); + + // invoke the operation + RedistributeThroughputParameters redistributeThroughputParameters = new RedistributeThroughputParameters(new AzureLocation("placeholder"), new RedistributeThroughputPropertiesResource(ThroughputPolicyType.Custom, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("0") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("1") +{ +Throughput = 5000, +} + }, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("2") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("3") + })); + ArmOperation lro = await cosmosDBSqlContainerThroughputSetting.SqlContainerRedistributeThroughputAsync(WaitUntil.Completed, redistributeThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseCollection.cs new file mode 100644 index 0000000000000..938655847819e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseCollection.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlDatabaseCollection + { + // CosmosDBSqlDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseList.json + // this example is just showing the usage of "SqlResources_ListSqlDatabases" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlDatabaseResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + CosmosDBSqlDatabaseResource result = await collection.GetAsync(databaseName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + bool result = await collection.ExistsAsync(databaseName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + CosmosDBSqlDatabaseResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + CosmosDBSqlDatabaseCreateOrUpdateContent content = new CosmosDBSqlDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + CosmosDBSqlDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlDatabaseRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseRestore.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlDatabaseResource + CosmosDBSqlDatabaseCollection collection = cosmosDBAccount.GetCosmosDBSqlDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + CosmosDBSqlDatabaseCreateOrUpdateContent content = new CosmosDBSqlDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlDatabaseResourceInfo("databaseName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + CosmosDBSqlDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseResource.cs new file mode 100644 index 0000000000000..d4e06876e1ef9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseResource.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlDatabaseResource + { + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + CosmosDBSqlDatabaseResource result = await cosmosDBSqlDatabase.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + CosmosDBSqlDatabaseCreateOrUpdateContent content = new CosmosDBSqlDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlDatabase.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlDatabaseRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseRestore.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + CosmosDBSqlDatabaseCreateOrUpdateContent content = new CosmosDBSqlDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBSqlDatabaseResourceInfo("databaseName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlDatabase.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlDatabaseDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + await cosmosDBSqlDatabase.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlDatabasePartitionMerge + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlDatabasePartitionMerge_CosmosDBSqlDatabasePartitionMerge() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabasePartitionMerge.json + // this example is just showing the usage of "SqlResources_SqlDatabasePartitionMerge" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseResource created on azure + // for more information of creating CosmosDBSqlDatabaseResource, please refer to the document of CosmosDBSqlDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseResourceId = CosmosDBSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseResource cosmosDBSqlDatabase = client.GetCosmosDBSqlDatabaseResource(cosmosDBSqlDatabaseResourceId); + + // invoke the operation + MergeParameters mergeParameters = new MergeParameters() + { + IsDryRun = false, + }; + ArmOperation lro = await cosmosDBSqlDatabase.SqlDatabasePartitionMergeAsync(WaitUntil.Completed, mergeParameters); + PhysicalPartitionStorageInfoCollection result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseThroughputSettingResource.cs new file mode 100644 index 0000000000000..95855dda78990 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlDatabaseThroughputSettingResource.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlDatabaseThroughputSettingResource + { + // CosmosDBSqlDatabaseThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseThroughputGet.json + // this example is just showing the usage of "SqlResources_GetSqlDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + CosmosDBSqlDatabaseThroughputSettingResource result = await cosmosDBSqlDatabaseThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlDatabaseThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseThroughputUpdate.json + // this example is just showing the usage of "SqlResources_UpdateSqlDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CosmosDBSqlDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateSqlDatabaseToAutoscale_CosmosDBSqlDatabaseMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json + // this example is just showing the usage of "SqlResources_MigrateSqlDatabaseToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.MigrateSqlDatabaseToAutoscaleAsync(WaitUntil.Completed); + CosmosDBSqlDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateSqlDatabaseToManualThroughput_CosmosDBSqlDatabaseMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json + // this example is just showing the usage of "SqlResources_MigrateSqlDatabaseToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.MigrateSqlDatabaseToManualThroughputAsync(WaitUntil.Completed); + CosmosDBSqlDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseRetrieveThroughputDistribution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlDatabaseRetrieveThroughputDistribution_CosmosDBSqlDatabaseRetrieveThroughputDistribution() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseRetrieveThroughputDistribution.json + // this example is just showing the usage of "SqlResources_SqlDatabaseRetrieveThroughputDistribution" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + RetrieveThroughputParameters retrieveThroughputParameters = new RetrieveThroughputParameters(new AzureLocation("placeholder"), new RetrieveThroughputPropertiesResource(new WritableSubResource[] + { +new WritableSubResource() +{ +Id = new ResourceIdentifier("0"), +},new WritableSubResource() +{ +Id = new ResourceIdentifier("1"), +} + })); + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.SqlDatabaseRetrieveThroughputDistributionAsync(WaitUntil.Completed, retrieveThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlDatabaseRedistributeThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SqlDatabaseRedistributeThroughput_CosmosDBSqlDatabaseRedistributeThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlDatabaseRedistributeThroughput.json + // this example is just showing the usage of "SqlResources_SqlDatabaseRedistributeThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlDatabaseThroughputSettingResource created on azure + // for more information of creating CosmosDBSqlDatabaseThroughputSettingResource, please refer to the document of CosmosDBSqlDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier cosmosDBSqlDatabaseThroughputSettingResourceId = CosmosDBSqlDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + CosmosDBSqlDatabaseThroughputSettingResource cosmosDBSqlDatabaseThroughputSetting = client.GetCosmosDBSqlDatabaseThroughputSettingResource(cosmosDBSqlDatabaseThroughputSettingResourceId); + + // invoke the operation + RedistributeThroughputParameters redistributeThroughputParameters = new RedistributeThroughputParameters(new AzureLocation("placeholder"), new RedistributeThroughputPropertiesResource(ThroughputPolicyType.Custom, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("0") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("1") +{ +Throughput = 5000, +} + }, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("2") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("3") + })); + ArmOperation lro = await cosmosDBSqlDatabaseThroughputSetting.SqlDatabaseRedistributeThroughputAsync(WaitUntil.Completed, redistributeThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentCollection.cs new file mode 100644 index 0000000000000..6a32c38f664b7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentCollection.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlRoleAssignmentCollection + { + // CosmosDBSqlRoleAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlRoleAssignmentGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation + string roleAssignmentId = "myRoleAssignmentId"; + CosmosDBSqlRoleAssignmentResource result = await collection.GetAsync(roleAssignmentId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlRoleAssignmentGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation + string roleAssignmentId = "myRoleAssignmentId"; + bool result = await collection.ExistsAsync(roleAssignmentId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlRoleAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlRoleAssignmentGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation + string roleAssignmentId = "myRoleAssignmentId"; + NullableResponse response = await collection.GetIfExistsAsync(roleAssignmentId); + CosmosDBSqlRoleAssignmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlRoleAssignmentCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlRoleAssignmentCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation + string roleAssignmentId = "myRoleAssignmentId"; + CosmosDBSqlRoleAssignmentCreateOrUpdateContent content = new CosmosDBSqlRoleAssignmentCreateOrUpdateContent() + { + RoleDefinitionId = new ResourceIdentifier("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), + Scope = "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases", + PrincipalId = Guid.Parse("myPrincipalId"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, roleAssignmentId, content); + CosmosDBSqlRoleAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleAssignmentList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlRoleAssignmentList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentList.json + // this example is just showing the usage of "SqlResources_ListSqlRoleAssignments" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleAssignmentResource + CosmosDBSqlRoleAssignmentCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleAssignments(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlRoleAssignmentResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentResource.cs new file mode 100644 index 0000000000000..ae77f210f748e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleAssignmentResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlRoleAssignmentResource + { + // CosmosDBSqlRoleAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlRoleAssignmentGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleAssignmentResource created on azure + // for more information of creating CosmosDBSqlRoleAssignmentResource, please refer to the document of CosmosDBSqlRoleAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleAssignmentId = "myRoleAssignmentId"; + ResourceIdentifier cosmosDBSqlRoleAssignmentResourceId = CosmosDBSqlRoleAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleAssignmentId); + CosmosDBSqlRoleAssignmentResource cosmosDBSqlRoleAssignment = client.GetCosmosDBSqlRoleAssignmentResource(cosmosDBSqlRoleAssignmentResourceId); + + // invoke the operation + CosmosDBSqlRoleAssignmentResource result = await cosmosDBSqlRoleAssignment.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleAssignmentCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlRoleAssignmentCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleAssignmentResource created on azure + // for more information of creating CosmosDBSqlRoleAssignmentResource, please refer to the document of CosmosDBSqlRoleAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleAssignmentId = "myRoleAssignmentId"; + ResourceIdentifier cosmosDBSqlRoleAssignmentResourceId = CosmosDBSqlRoleAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleAssignmentId); + CosmosDBSqlRoleAssignmentResource cosmosDBSqlRoleAssignment = client.GetCosmosDBSqlRoleAssignmentResource(cosmosDBSqlRoleAssignmentResourceId); + + // invoke the operation + CosmosDBSqlRoleAssignmentCreateOrUpdateContent content = new CosmosDBSqlRoleAssignmentCreateOrUpdateContent() + { + RoleDefinitionId = new ResourceIdentifier("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), + Scope = "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases", + PrincipalId = Guid.Parse("myPrincipalId"), + }; + ArmOperation lro = await cosmosDBSqlRoleAssignment.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlRoleAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleAssignmentDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlRoleAssignmentDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleAssignmentDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlRoleAssignment" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleAssignmentResource created on azure + // for more information of creating CosmosDBSqlRoleAssignmentResource, please refer to the document of CosmosDBSqlRoleAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleAssignmentId = "myRoleAssignmentId"; + ResourceIdentifier cosmosDBSqlRoleAssignmentResourceId = CosmosDBSqlRoleAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleAssignmentId); + CosmosDBSqlRoleAssignmentResource cosmosDBSqlRoleAssignment = client.GetCosmosDBSqlRoleAssignmentResource(cosmosDBSqlRoleAssignmentResourceId); + + // invoke the operation + await cosmosDBSqlRoleAssignment.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionCollection.cs new file mode 100644 index 0000000000000..79e6ba81a3123 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionCollection.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlRoleDefinitionCollection + { + // CosmosDBSqlRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation + string roleDefinitionId = "myRoleDefinitionId"; + CosmosDBSqlRoleDefinitionResource result = await collection.GetAsync(roleDefinitionId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation + string roleDefinitionId = "myRoleDefinitionId"; + bool result = await collection.ExistsAsync(roleDefinitionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation + string roleDefinitionId = "myRoleDefinitionId"; + NullableResponse response = await collection.GetIfExistsAsync(roleDefinitionId); + CosmosDBSqlRoleDefinitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlRoleDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlRoleDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation + string roleDefinitionId = "myRoleDefinitionId"; + CosmosDBSqlRoleDefinitionCreateOrUpdateContent content = new CosmosDBSqlRoleDefinitionCreateOrUpdateContent() + { + RoleName = "myRoleName", + RoleDefinitionType = CosmosDBSqlRoleDefinitionType.CustomRole, + AssignableScopes = +{ +"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales","/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases" +}, + Permissions = +{ +new CosmosDBSqlRolePermission() +{ +DataActions = +{ +"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create","Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read" +}, +NotDataActions = +{ +}, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, roleDefinitionId, content); + CosmosDBSqlRoleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleDefinitionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlRoleDefinitionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionList.json + // this example is just showing the usage of "SqlResources_ListSqlRoleDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBSqlRoleDefinitionResource + CosmosDBSqlRoleDefinitionCollection collection = cosmosDBAccount.GetCosmosDBSqlRoleDefinitions(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlRoleDefinitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionResource.cs new file mode 100644 index 0000000000000..6d539b53bac2a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlRoleDefinitionResource.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlRoleDefinitionResource + { + // CosmosDBSqlRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionGet.json + // this example is just showing the usage of "SqlResources_GetSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleDefinitionResource created on azure + // for more information of creating CosmosDBSqlRoleDefinitionResource, please refer to the document of CosmosDBSqlRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleDefinitionId = "myRoleDefinitionId"; + ResourceIdentifier cosmosDBSqlRoleDefinitionResourceId = CosmosDBSqlRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleDefinitionId); + CosmosDBSqlRoleDefinitionResource cosmosDBSqlRoleDefinition = client.GetCosmosDBSqlRoleDefinitionResource(cosmosDBSqlRoleDefinitionResourceId); + + // invoke the operation + CosmosDBSqlRoleDefinitionResource result = await cosmosDBSqlRoleDefinition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlRoleDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleDefinitionResource created on azure + // for more information of creating CosmosDBSqlRoleDefinitionResource, please refer to the document of CosmosDBSqlRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleDefinitionId = "myRoleDefinitionId"; + ResourceIdentifier cosmosDBSqlRoleDefinitionResourceId = CosmosDBSqlRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleDefinitionId); + CosmosDBSqlRoleDefinitionResource cosmosDBSqlRoleDefinition = client.GetCosmosDBSqlRoleDefinitionResource(cosmosDBSqlRoleDefinitionResourceId); + + // invoke the operation + CosmosDBSqlRoleDefinitionCreateOrUpdateContent content = new CosmosDBSqlRoleDefinitionCreateOrUpdateContent() + { + RoleName = "myRoleName", + RoleDefinitionType = CosmosDBSqlRoleDefinitionType.CustomRole, + AssignableScopes = +{ +"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales","/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases" +}, + Permissions = +{ +new CosmosDBSqlRolePermission() +{ +DataActions = +{ +"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create","Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read" +}, +NotDataActions = +{ +}, +} +}, + }; + ArmOperation lro = await cosmosDBSqlRoleDefinition.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlRoleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlRoleDefinitionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlRoleDefinitionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlRoleDefinitionDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlRoleDefinitionResource created on azure + // for more information of creating CosmosDBSqlRoleDefinitionResource, please refer to the document of CosmosDBSqlRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string roleDefinitionId = "myRoleDefinitionId"; + ResourceIdentifier cosmosDBSqlRoleDefinitionResourceId = CosmosDBSqlRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, roleDefinitionId); + CosmosDBSqlRoleDefinitionResource cosmosDBSqlRoleDefinition = client.GetCosmosDBSqlRoleDefinitionResource(cosmosDBSqlRoleDefinitionResourceId); + + // invoke the operation + await cosmosDBSqlRoleDefinition.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureCollection.cs new file mode 100644 index 0000000000000..11f99aa3abe8d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureCollection.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlStoredProcedureCollection + { + // CosmosDBSqlStoredProcedureList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlStoredProcedureList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureList.json + // this example is just showing the usage of "SqlResources_ListSqlStoredProcedures" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlStoredProcedureResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlStoredProcedureGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlStoredProcedureGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureGet.json + // this example is just showing the usage of "SqlResources_GetSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation + string storedProcedureName = "storedProcedureName"; + CosmosDBSqlStoredProcedureResource result = await collection.GetAsync(storedProcedureName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlStoredProcedureGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlStoredProcedureGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureGet.json + // this example is just showing the usage of "SqlResources_GetSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation + string storedProcedureName = "storedProcedureName"; + bool result = await collection.ExistsAsync(storedProcedureName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlStoredProcedureGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlStoredProcedureGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureGet.json + // this example is just showing the usage of "SqlResources_GetSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation + string storedProcedureName = "storedProcedureName"; + NullableResponse response = await collection.GetIfExistsAsync(storedProcedureName); + CosmosDBSqlStoredProcedureResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlStoredProcedureCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlStoredProcedureCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlStoredProcedureResource + CosmosDBSqlStoredProcedureCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlStoredProcedures(); + + // invoke the operation + string storedProcedureName = "storedProcedureName"; + CosmosDBSqlStoredProcedureCreateOrUpdateContent content = new CosmosDBSqlStoredProcedureCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlStoredProcedureResourceInfo("storedProcedureName") + { + Body = "body", + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, storedProcedureName, content); + CosmosDBSqlStoredProcedureResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureResource.cs new file mode 100644 index 0000000000000..6b398ae6dbf54 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlStoredProcedureResource.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlStoredProcedureResource + { + // CosmosDBSqlStoredProcedureGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlStoredProcedureGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureGet.json + // this example is just showing the usage of "SqlResources_GetSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlStoredProcedureResource created on azure + // for more information of creating CosmosDBSqlStoredProcedureResource, please refer to the document of CosmosDBSqlStoredProcedureResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string storedProcedureName = "storedProcedureName"; + ResourceIdentifier cosmosDBSqlStoredProcedureResourceId = CosmosDBSqlStoredProcedureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + CosmosDBSqlStoredProcedureResource cosmosDBSqlStoredProcedure = client.GetCosmosDBSqlStoredProcedureResource(cosmosDBSqlStoredProcedureResourceId); + + // invoke the operation + CosmosDBSqlStoredProcedureResource result = await cosmosDBSqlStoredProcedure.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlStoredProcedureCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlStoredProcedureCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlStoredProcedureResource created on azure + // for more information of creating CosmosDBSqlStoredProcedureResource, please refer to the document of CosmosDBSqlStoredProcedureResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string storedProcedureName = "storedProcedureName"; + ResourceIdentifier cosmosDBSqlStoredProcedureResourceId = CosmosDBSqlStoredProcedureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + CosmosDBSqlStoredProcedureResource cosmosDBSqlStoredProcedure = client.GetCosmosDBSqlStoredProcedureResource(cosmosDBSqlStoredProcedureResourceId); + + // invoke the operation + CosmosDBSqlStoredProcedureCreateOrUpdateContent content = new CosmosDBSqlStoredProcedureCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlStoredProcedureResourceInfo("storedProcedureName") + { + Body = "body", + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await cosmosDBSqlStoredProcedure.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlStoredProcedureResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlStoredProcedureData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlStoredProcedureDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlStoredProcedureDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlStoredProcedureDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlStoredProcedure" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlStoredProcedureResource created on azure + // for more information of creating CosmosDBSqlStoredProcedureResource, please refer to the document of CosmosDBSqlStoredProcedureResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string storedProcedureName = "storedProcedureName"; + ResourceIdentifier cosmosDBSqlStoredProcedureResourceId = CosmosDBSqlStoredProcedureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + CosmosDBSqlStoredProcedureResource cosmosDBSqlStoredProcedure = client.GetCosmosDBSqlStoredProcedureResource(cosmosDBSqlStoredProcedureResourceId); + + // invoke the operation + await cosmosDBSqlStoredProcedure.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerCollection.cs new file mode 100644 index 0000000000000..f5d386f62c2a4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerCollection.cs @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlTriggerCollection + { + // CosmosDBSqlTriggerList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlTriggerList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerList.json + // this example is just showing the usage of "SqlResources_ListSqlTriggers" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlTriggerResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlTriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlTriggerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerGet.json + // this example is just showing the usage of "SqlResources_GetSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation + string triggerName = "triggerName"; + CosmosDBSqlTriggerResource result = await collection.GetAsync(triggerName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlTriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlTriggerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerGet.json + // this example is just showing the usage of "SqlResources_GetSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation + string triggerName = "triggerName"; + bool result = await collection.ExistsAsync(triggerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlTriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlTriggerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerGet.json + // this example is just showing the usage of "SqlResources_GetSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation + string triggerName = "triggerName"; + NullableResponse response = await collection.GetIfExistsAsync(triggerName); + CosmosDBSqlTriggerResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlTriggerCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlTriggerCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlTriggerResource + CosmosDBSqlTriggerCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlTriggers(); + + // invoke the operation + string triggerName = "triggerName"; + CosmosDBSqlTriggerCreateOrUpdateContent content = new CosmosDBSqlTriggerCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlTriggerResourceInfo("triggerName") + { + Body = "body", + TriggerType = new CosmosDBSqlTriggerType("triggerType"), + TriggerOperation = new CosmosDBSqlTriggerOperation("triggerOperation"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, triggerName, content); + CosmosDBSqlTriggerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerResource.cs new file mode 100644 index 0000000000000..6819bcde3d7c2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlTriggerResource.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlTriggerResource + { + // CosmosDBSqlTriggerGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlTriggerGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerGet.json + // this example is just showing the usage of "SqlResources_GetSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlTriggerResource created on azure + // for more information of creating CosmosDBSqlTriggerResource, please refer to the document of CosmosDBSqlTriggerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string triggerName = "triggerName"; + ResourceIdentifier cosmosDBSqlTriggerResourceId = CosmosDBSqlTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, triggerName); + CosmosDBSqlTriggerResource cosmosDBSqlTrigger = client.GetCosmosDBSqlTriggerResource(cosmosDBSqlTriggerResourceId); + + // invoke the operation + CosmosDBSqlTriggerResource result = await cosmosDBSqlTrigger.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlTriggerCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlTriggerCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlTriggerResource created on azure + // for more information of creating CosmosDBSqlTriggerResource, please refer to the document of CosmosDBSqlTriggerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string triggerName = "triggerName"; + ResourceIdentifier cosmosDBSqlTriggerResourceId = CosmosDBSqlTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, triggerName); + CosmosDBSqlTriggerResource cosmosDBSqlTrigger = client.GetCosmosDBSqlTriggerResource(cosmosDBSqlTriggerResourceId); + + // invoke the operation + CosmosDBSqlTriggerCreateOrUpdateContent content = new CosmosDBSqlTriggerCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlTriggerResourceInfo("triggerName") + { + Body = "body", + TriggerType = new CosmosDBSqlTriggerType("triggerType"), + TriggerOperation = new CosmosDBSqlTriggerOperation("triggerOperation"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await cosmosDBSqlTrigger.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlTriggerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlTriggerDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlTriggerDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlTriggerDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlTrigger" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlTriggerResource created on azure + // for more information of creating CosmosDBSqlTriggerResource, please refer to the document of CosmosDBSqlTriggerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string triggerName = "triggerName"; + ResourceIdentifier cosmosDBSqlTriggerResourceId = CosmosDBSqlTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, triggerName); + CosmosDBSqlTriggerResource cosmosDBSqlTrigger = client.GetCosmosDBSqlTriggerResource(cosmosDBSqlTriggerResourceId); + + // invoke the operation + await cosmosDBSqlTrigger.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionCollection.cs new file mode 100644 index 0000000000000..9491d2193bb07 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionCollection.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlUserDefinedFunctionCollection + { + // CosmosDBSqlUserDefinedFunctionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlUserDefinedFunctionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionList.json + // this example is just showing the usage of "SqlResources_ListSqlUserDefinedFunctions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBSqlUserDefinedFunctionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlUserDefinedFunctionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlUserDefinedFunctionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + // this example is just showing the usage of "SqlResources_GetSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation + string userDefinedFunctionName = "userDefinedFunctionName"; + CosmosDBSqlUserDefinedFunctionResource result = await collection.GetAsync(userDefinedFunctionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlUserDefinedFunctionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlUserDefinedFunctionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + // this example is just showing the usage of "SqlResources_GetSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation + string userDefinedFunctionName = "userDefinedFunctionName"; + bool result = await collection.ExistsAsync(userDefinedFunctionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlUserDefinedFunctionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlUserDefinedFunctionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + // this example is just showing the usage of "SqlResources_GetSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation + string userDefinedFunctionName = "userDefinedFunctionName"; + NullableResponse response = await collection.GetIfExistsAsync(userDefinedFunctionName); + CosmosDBSqlUserDefinedFunctionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBSqlUserDefinedFunctionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBSqlUserDefinedFunctionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlContainerResource created on azure + // for more information of creating CosmosDBSqlContainerResource, please refer to the document of CosmosDBSqlContainerResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + ResourceIdentifier cosmosDBSqlContainerResourceId = CosmosDBSqlContainerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName); + CosmosDBSqlContainerResource cosmosDBSqlContainer = client.GetCosmosDBSqlContainerResource(cosmosDBSqlContainerResourceId); + + // get the collection of this CosmosDBSqlUserDefinedFunctionResource + CosmosDBSqlUserDefinedFunctionCollection collection = cosmosDBSqlContainer.GetCosmosDBSqlUserDefinedFunctions(); + + // invoke the operation + string userDefinedFunctionName = "userDefinedFunctionName"; + CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent content = new CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlUserDefinedFunctionResourceInfo("userDefinedFunctionName") + { + Body = "body", + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, userDefinedFunctionName, content); + CosmosDBSqlUserDefinedFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionResource.cs new file mode 100644 index 0000000000000..f183d0fc9d267 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBSqlUserDefinedFunctionResource.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBSqlUserDefinedFunctionResource + { + // CosmosDBSqlUserDefinedFunctionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlUserDefinedFunctionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json + // this example is just showing the usage of "SqlResources_GetSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlUserDefinedFunctionResource created on azure + // for more information of creating CosmosDBSqlUserDefinedFunctionResource, please refer to the document of CosmosDBSqlUserDefinedFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string userDefinedFunctionName = "userDefinedFunctionName"; + ResourceIdentifier cosmosDBSqlUserDefinedFunctionResourceId = CosmosDBSqlUserDefinedFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + CosmosDBSqlUserDefinedFunctionResource cosmosDBSqlUserDefinedFunction = client.GetCosmosDBSqlUserDefinedFunctionResource(cosmosDBSqlUserDefinedFunctionResourceId); + + // invoke the operation + CosmosDBSqlUserDefinedFunctionResource result = await cosmosDBSqlUserDefinedFunction.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlUserDefinedFunctionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBSqlUserDefinedFunctionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json + // this example is just showing the usage of "SqlResources_CreateUpdateSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlUserDefinedFunctionResource created on azure + // for more information of creating CosmosDBSqlUserDefinedFunctionResource, please refer to the document of CosmosDBSqlUserDefinedFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string userDefinedFunctionName = "userDefinedFunctionName"; + ResourceIdentifier cosmosDBSqlUserDefinedFunctionResourceId = CosmosDBSqlUserDefinedFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + CosmosDBSqlUserDefinedFunctionResource cosmosDBSqlUserDefinedFunction = client.GetCosmosDBSqlUserDefinedFunctionResource(cosmosDBSqlUserDefinedFunctionResourceId); + + // invoke the operation + CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent content = new CosmosDBSqlUserDefinedFunctionCreateOrUpdateContent(new AzureLocation("placeholder"), new CosmosDBSqlUserDefinedFunctionResourceInfo("userDefinedFunctionName") + { + Body = "body", + }) + { + Options = new CosmosDBCreateUpdateConfig(), + }; + ArmOperation lro = await cosmosDBSqlUserDefinedFunction.UpdateAsync(WaitUntil.Completed, content); + CosmosDBSqlUserDefinedFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBSqlUserDefinedFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlUserDefinedFunctionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlUserDefinedFunctionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBSqlUserDefinedFunctionDelete.json + // this example is just showing the usage of "SqlResources_DeleteSqlUserDefinedFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBSqlUserDefinedFunctionResource created on azure + // for more information of creating CosmosDBSqlUserDefinedFunctionResource, please refer to the document of CosmosDBSqlUserDefinedFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string containerName = "containerName"; + string userDefinedFunctionName = "userDefinedFunctionName"; + ResourceIdentifier cosmosDBSqlUserDefinedFunctionResourceId = CosmosDBSqlUserDefinedFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + CosmosDBSqlUserDefinedFunctionResource cosmosDBSqlUserDefinedFunction = client.GetCosmosDBSqlUserDefinedFunctionResource(cosmosDBSqlUserDefinedFunctionResourceId); + + // invoke the operation + await cosmosDBSqlUserDefinedFunction.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableCollection.cs new file mode 100644 index 0000000000000..c483a7857d339 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableCollection.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBTableCollection + { + // CosmosDBTableList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBTableList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableList.json + // this example is just showing the usage of "TableResources_ListTables" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation and iterate over the result + await foreach (CosmosDBTableResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableGet.json + // this example is just showing the usage of "TableResources_GetTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation + string tableName = "tableName"; + CosmosDBTableResource result = await collection.GetAsync(tableName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableGet.json + // this example is just showing the usage of "TableResources_GetTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation + string tableName = "tableName"; + bool result = await collection.ExistsAsync(tableName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableGet.json + // this example is just showing the usage of "TableResources_GetTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation + string tableName = "tableName"; + NullableResponse response = await collection.GetIfExistsAsync(tableName); + CosmosDBTableResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBTableReplace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBTableReplace() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableCreateUpdate.json + // this example is just showing the usage of "TableResources_CreateUpdateTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this CosmosDBTableResource + CosmosDBTableCollection collection = cosmosDBAccount.GetCosmosDBTables(); + + // invoke the operation + string tableName = "tableName"; + CosmosDBTableCreateOrUpdateContent content = new CosmosDBTableCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBTableResourceInfo("tableName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, tableName, content); + CosmosDBTableResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableResource.cs new file mode 100644 index 0000000000000..42cab74d969da --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosDBTableResource.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosDBTableResource + { + // CosmosDBTableGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBTableGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableGet.json + // this example is just showing the usage of "TableResources_GetTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBTableResource created on azure + // for more information of creating CosmosDBTableResource, please refer to the document of CosmosDBTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosDBTableResourceId = CosmosDBTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosDBTableResource cosmosDBTable = client.GetCosmosDBTableResource(cosmosDBTableResourceId); + + // invoke the operation + CosmosDBTableResource result = await cosmosDBTable.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableReplace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBTableReplace() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableCreateUpdate.json + // this example is just showing the usage of "TableResources_CreateUpdateTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBTableResource created on azure + // for more information of creating CosmosDBTableResource, please refer to the document of CosmosDBTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosDBTableResourceId = CosmosDBTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosDBTableResource cosmosDBTable = client.GetCosmosDBTableResource(cosmosDBTableResourceId); + + // invoke the operation + CosmosDBTableCreateOrUpdateContent content = new CosmosDBTableCreateOrUpdateContent(new AzureLocation("West US"), new CosmosDBTableResourceInfo("tableName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await cosmosDBTable.UpdateAsync(WaitUntil.Completed, content); + CosmosDBTableResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CosmosDBTableData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBTableDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableDelete.json + // this example is just showing the usage of "TableResources_DeleteTable" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBTableResource created on azure + // for more information of creating CosmosDBTableResource, please refer to the document of CosmosDBTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosDBTableResourceId = CosmosDBTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosDBTableResource cosmosDBTable = client.GetCosmosDBTableResource(cosmosDBTableResourceId); + + // invoke the operation + await cosmosDBTable.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBTableCollectionBackupInformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveContinuousBackupInformation_CosmosDBTableCollectionBackupInformation() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableBackupInformation.json + // this example is just showing the usage of "TableResources_RetrieveContinuousBackupInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBTableResource created on azure + // for more information of creating CosmosDBTableResource, please refer to the document of CosmosDBTableResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string tableName = "tableName1"; + ResourceIdentifier cosmosDBTableResourceId = CosmosDBTableResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosDBTableResource cosmosDBTable = client.GetCosmosDBTableResource(cosmosDBTableResourceId); + + // invoke the operation + ContinuousBackupRestoreLocation location = new ContinuousBackupRestoreLocation() + { + Location = new AzureLocation("North Europe"), + }; + ArmOperation lro = await cosmosDBTable.RetrieveContinuousBackupInformationAsync(WaitUntil.Completed, location); + CosmosDBBackupInformation result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosTableThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosTableThroughputSettingResource.cs new file mode 100644 index 0000000000000..e787736174251 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_CosmosTableThroughputSettingResource.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_CosmosTableThroughputSettingResource + { + // CosmosDBTableThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBTableThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableThroughputGet.json + // this example is just showing the usage of "TableResources_GetTableThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosTableThroughputSettingResource created on azure + // for more information of creating CosmosTableThroughputSettingResource, please refer to the document of CosmosTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosTableThroughputSettingResourceId = CosmosTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosTableThroughputSettingResource cosmosTableThroughputSetting = client.GetCosmosTableThroughputSettingResource(cosmosTableThroughputSettingResourceId); + + // invoke the operation + CosmosTableThroughputSettingResource result = await cosmosTableThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBTableThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableThroughputUpdate.json + // this example is just showing the usage of "TableResources_UpdateTableThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosTableThroughputSettingResource created on azure + // for more information of creating CosmosTableThroughputSettingResource, please refer to the document of CosmosTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosTableThroughputSettingResourceId = CosmosTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosTableThroughputSettingResource cosmosTableThroughputSetting = client.GetCosmosTableThroughputSettingResource(cosmosTableThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await cosmosTableThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + CosmosTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateTableToAutoscale_CosmosDBTableMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableMigrateToAutoscale.json + // this example is just showing the usage of "TableResources_MigrateTableToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosTableThroughputSettingResource created on azure + // for more information of creating CosmosTableThroughputSettingResource, please refer to the document of CosmosTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosTableThroughputSettingResourceId = CosmosTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosTableThroughputSettingResource cosmosTableThroughputSetting = client.GetCosmosTableThroughputSettingResource(cosmosTableThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosTableThroughputSetting.MigrateTableToAutoscaleAsync(WaitUntil.Completed); + CosmosTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBTableMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateTableToManualThroughput_CosmosDBTableMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBTableMigrateToManualThroughput.json + // this example is just showing the usage of "TableResources_MigrateTableToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosTableThroughputSettingResource created on azure + // for more information of creating CosmosTableThroughputSettingResource, please refer to the document of CosmosTableThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string tableName = "tableName"; + ResourceIdentifier cosmosTableThroughputSettingResourceId = CosmosTableThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, tableName); + CosmosTableThroughputSettingResource cosmosTableThroughputSetting = client.GetCosmosTableThroughputSettingResource(cosmosTableThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await cosmosTableThroughputSetting.MigrateTableToManualThroughputAsync(WaitUntil.Completed); + CosmosTableThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultCollection.cs new file mode 100644 index 0000000000000..19227b1996e60 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultCollection.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_DataTransferJobGetResultCollection + { + // CosmosDBDataTransferJobCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBDataTransferJobCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCreate.json + // this example is just showing the usage of "DataTransferJobs_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation + string jobName = "j1"; + DataTransferJobGetResultCreateOrUpdateContent content = new DataTransferJobGetResultCreateOrUpdateContent(new DataTransferJobProperties(new CosmosCassandraDataTransferDataSourceSink("keyspace", "table"), new AzureBlobDataTransferDataSourceSink("blob_container") + { + EndpointUri = new Uri("https://blob.windows.net"), + })); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, jobName, content); + DataTransferJobGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBDataTransferJobGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json + // this example is just showing the usage of "DataTransferJobs_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation + string jobName = "j1"; + DataTransferJobGetResultResource result = await collection.GetAsync(jobName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBDataTransferJobGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json + // this example is just showing the usage of "DataTransferJobs_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation + string jobName = "j1"; + bool result = await collection.ExistsAsync(jobName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBDataTransferJobGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBDataTransferJobGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json + // this example is just showing the usage of "DataTransferJobs_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation + string jobName = "j1"; + NullableResponse response = await collection.GetIfExistsAsync(jobName); + DataTransferJobGetResultResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBDataTransferJobFeed + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBDataTransferJobFeed() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobFeed.json + // this example is just showing the usage of "DataTransferJobs_ListByDatabaseAccount" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this DataTransferJobGetResultResource + DataTransferJobGetResultCollection collection = cosmosDBAccount.GetDataTransferJobGetResults(); + + // invoke the operation and iterate over the result + await foreach (DataTransferJobGetResultResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultResource.cs new file mode 100644 index 0000000000000..5469278f351ad --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_DataTransferJobGetResultResource.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_DataTransferJobGetResultResource + { + // CosmosDBDataTransferJobCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBDataTransferJobCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCreate.json + // this example is just showing the usage of "DataTransferJobs_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultCreateOrUpdateContent content = new DataTransferJobGetResultCreateOrUpdateContent(new DataTransferJobProperties(new CosmosCassandraDataTransferDataSourceSink("keyspace", "table"), new AzureBlobDataTransferDataSourceSink("blob_container") + { + EndpointUri = new Uri("https://blob.windows.net"), + })); + ArmOperation lro = await dataTransferJobGetResult.UpdateAsync(WaitUntil.Completed, content); + DataTransferJobGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBDataTransferJobGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json + // this example is just showing the usage of "DataTransferJobs_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultResource result = await dataTransferJobGetResult.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobPause + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Pause_CosmosDBDataTransferJobPause() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobPause.json + // this example is just showing the usage of "DataTransferJobs_Pause" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultResource result = await dataTransferJobGetResult.PauseAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Resume_CosmosDBDataTransferJobCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobResume.json + // this example is just showing the usage of "DataTransferJobs_Resume" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultResource result = await dataTransferJobGetResult.ResumeAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBDataTransferJobCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Cancel_CosmosDBDataTransferJobCreate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCancel.json + // this example is just showing the usage of "DataTransferJobs_Cancel" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataTransferJobGetResultResource created on azure + // for more information of creating DataTransferJobGetResultResource, please refer to the document of DataTransferJobGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string jobName = "j1"; + ResourceIdentifier dataTransferJobGetResultResourceId = DataTransferJobGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, jobName); + DataTransferJobGetResultResource dataTransferJobGetResult = client.GetDataTransferJobGetResultResource(dataTransferJobGetResultResourceId); + + // invoke the operation + DataTransferJobGetResultResource result = await dataTransferJobGetResult.CancelAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DataTransferJobGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultCollection.cs new file mode 100644 index 0000000000000..6dff44330db69 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultCollection.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GraphResourceGetResultCollection + { + // CosmosDBSqlDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBSqlDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceList.json + // this example is just showing the usage of "GraphResources_ListGraphs" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation and iterate over the result + await foreach (GraphResourceGetResultResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceGet.json + // this example is just showing the usage of "GraphResources_GetGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation + string graphName = "graphName"; + GraphResourceGetResultResource result = await collection.GetAsync(graphName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceGet.json + // this example is just showing the usage of "GraphResources_GetGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation + string graphName = "graphName"; + bool result = await collection.ExistsAsync(graphName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceGet.json + // this example is just showing the usage of "GraphResources_GetGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation + string graphName = "graphName"; + NullableResponse response = await collection.GetIfExistsAsync(graphName); + GraphResourceGetResultResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBGraphCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGraphCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceCreateUpdate.json + // this example is just showing the usage of "GraphResources_CreateUpdateGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GraphResourceGetResultResource + GraphResourceGetResultCollection collection = cosmosDBAccount.GetGraphResourceGetResults(); + + // invoke the operation + string graphName = "graphName"; + GraphResourceGetResultCreateOrUpdateContent content = new GraphResourceGetResultCreateOrUpdateContent(new AzureLocation("West US"), new WritableSubResource() + { + Id = new ResourceIdentifier("graphName"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, graphName, content); + GraphResourceGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultResource.cs new file mode 100644 index 0000000000000..558547d126c1e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GraphResourceGetResultResource.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GraphResourceGetResultResource + { + // CosmosDBSqlDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBSqlDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceGet.json + // this example is just showing the usage of "GraphResources_GetGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GraphResourceGetResultResource created on azure + // for more information of creating GraphResourceGetResultResource, please refer to the document of GraphResourceGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string graphName = "graphName"; + ResourceIdentifier graphResourceGetResultResourceId = GraphResourceGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, graphName); + GraphResourceGetResultResource graphResourceGetResult = client.GetGraphResourceGetResultResource(graphResourceGetResultResourceId); + + // invoke the operation + GraphResourceGetResultResource result = await graphResourceGetResult.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGraphCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBGraphCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceCreateUpdate.json + // this example is just showing the usage of "GraphResources_CreateUpdateGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GraphResourceGetResultResource created on azure + // for more information of creating GraphResourceGetResultResource, please refer to the document of GraphResourceGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string graphName = "graphName"; + ResourceIdentifier graphResourceGetResultResourceId = GraphResourceGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, graphName); + GraphResourceGetResultResource graphResourceGetResult = client.GetGraphResourceGetResultResource(graphResourceGetResultResourceId); + + // invoke the operation + GraphResourceGetResultCreateOrUpdateContent content = new GraphResourceGetResultCreateOrUpdateContent(new AzureLocation("West US"), new WritableSubResource() + { + Id = new ResourceIdentifier("graphName"), + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await graphResourceGetResult.UpdateAsync(WaitUntil.Completed, content); + GraphResourceGetResultResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GraphResourceGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBSqlDatabaseDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBSqlDatabaseDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGraphResourceDelete.json + // this example is just showing the usage of "GraphResources_DeleteGraphResource" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GraphResourceGetResultResource created on azure + // for more information of creating GraphResourceGetResultResource, please refer to the document of GraphResourceGetResultResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string graphName = "graphName"; + ResourceIdentifier graphResourceGetResultResourceId = GraphResourceGetResultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, graphName); + GraphResourceGetResultResource graphResourceGetResult = client.GetGraphResourceGetResultResource(graphResourceGetResultResourceId); + + // invoke the operation + await graphResourceGetResult.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseCollection.cs new file mode 100644 index 0000000000000..6ae9c896bdf9a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseCollection.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinDatabaseCollection + { + // CosmosDBGremlinDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBGremlinDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseList.json + // this example is just showing the usage of "GremlinResources_ListGremlinDatabases" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation and iterate over the result + await foreach (GremlinDatabaseResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBGremlinDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + GremlinDatabaseResource result = await collection.GetAsync(databaseName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBGremlinDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + bool result = await collection.ExistsAsync(databaseName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBGremlinDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBGremlinDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + GremlinDatabaseResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBGremlinDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGremlinDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseCreateUpdate.json + // this example is just showing the usage of "GremlinResources_CreateUpdateGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this GremlinDatabaseResource + GremlinDatabaseCollection collection = cosmosDBAccount.GetGremlinDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + GremlinDatabaseCreateOrUpdateContent content = new GremlinDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new GremlinDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + GremlinDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseResource.cs new file mode 100644 index 0000000000000..59aae237814c6 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinDatabaseResource + { + // CosmosDBGremlinDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // invoke the operation + GremlinDatabaseResource result = await gremlinDatabase.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBGremlinDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseCreateUpdate.json + // this example is just showing the usage of "GremlinResources_CreateUpdateGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // invoke the operation + GremlinDatabaseCreateOrUpdateContent content = new GremlinDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new GremlinDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await gremlinDatabase.UpdateAsync(WaitUntil.Completed, content); + GremlinDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBGremlinDatabaseDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseDelete.json + // this example is just showing the usage of "GremlinResources_DeleteGremlinDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // invoke the operation + await gremlinDatabase.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseThroughputSettingResource.cs new file mode 100644 index 0000000000000..bc18a43c6bb6d --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinDatabaseThroughputSettingResource.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinDatabaseThroughputSettingResource + { + // CosmosDBGremlinDatabaseThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinDatabaseThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseThroughputGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseThroughputSettingResource created on azure + // for more information of creating GremlinDatabaseThroughputSettingResource, please refer to the document of GremlinDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseThroughputSettingResourceId = GremlinDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseThroughputSettingResource gremlinDatabaseThroughputSetting = client.GetGremlinDatabaseThroughputSettingResource(gremlinDatabaseThroughputSettingResourceId); + + // invoke the operation + GremlinDatabaseThroughputSettingResource result = await gremlinDatabaseThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGremlinDatabaseThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseThroughputUpdate.json + // this example is just showing the usage of "GremlinResources_UpdateGremlinDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseThroughputSettingResource created on azure + // for more information of creating GremlinDatabaseThroughputSettingResource, please refer to the document of GremlinDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseThroughputSettingResourceId = GremlinDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseThroughputSettingResource gremlinDatabaseThroughputSetting = client.GetGremlinDatabaseThroughputSettingResource(gremlinDatabaseThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await gremlinDatabaseThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + GremlinDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateGremlinDatabaseToAutoscale_CosmosDBGremlinDatabaseMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json + // this example is just showing the usage of "GremlinResources_MigrateGremlinDatabaseToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseThroughputSettingResource created on azure + // for more information of creating GremlinDatabaseThroughputSettingResource, please refer to the document of GremlinDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseThroughputSettingResourceId = GremlinDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseThroughputSettingResource gremlinDatabaseThroughputSetting = client.GetGremlinDatabaseThroughputSettingResource(gremlinDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await gremlinDatabaseThroughputSetting.MigrateGremlinDatabaseToAutoscaleAsync(WaitUntil.Completed); + GremlinDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinDatabaseMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateGremlinDatabaseToManualThroughput_CosmosDBGremlinDatabaseMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json + // this example is just showing the usage of "GremlinResources_MigrateGremlinDatabaseToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseThroughputSettingResource created on azure + // for more information of creating GremlinDatabaseThroughputSettingResource, please refer to the document of GremlinDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseThroughputSettingResourceId = GremlinDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseThroughputSettingResource gremlinDatabaseThroughputSetting = client.GetGremlinDatabaseThroughputSettingResource(gremlinDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await gremlinDatabaseThroughputSetting.MigrateGremlinDatabaseToManualThroughputAsync(WaitUntil.Completed); + GremlinDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphCollection.cs new file mode 100644 index 0000000000000..4ba1d2ad7ab43 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphCollection.cs @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinGraphCollection + { + // CosmosDBGremlinGraphList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBGremlinGraphList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphList.json + // this example is just showing the usage of "GremlinResources_ListGremlinGraphs" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation and iterate over the result + await foreach (GremlinGraphResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBGremlinGraphGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinGraphGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation + string graphName = "graphName"; + GremlinGraphResource result = await collection.GetAsync(graphName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBGremlinGraphGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation + string graphName = "graphName"; + bool result = await collection.ExistsAsync(graphName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBGremlinGraphGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBGremlinGraphGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation + string graphName = "graphName"; + NullableResponse response = await collection.GetIfExistsAsync(graphName); + GremlinGraphResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBGremlinGraphCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGremlinGraphCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphCreateUpdate.json + // this example is just showing the usage of "GremlinResources_CreateUpdateGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinDatabaseResource created on azure + // for more information of creating GremlinDatabaseResource, please refer to the document of GremlinDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier gremlinDatabaseResourceId = GremlinDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + GremlinDatabaseResource gremlinDatabase = client.GetGremlinDatabaseResource(gremlinDatabaseResourceId); + + // get the collection of this GremlinGraphResource + GremlinGraphCollection collection = gremlinDatabase.GetGremlinGraphs(); + + // invoke the operation + string graphName = "graphName"; + GremlinGraphCreateOrUpdateContent content = new GremlinGraphCreateOrUpdateContent(new AzureLocation("West US"), new GremlinGraphResourceInfo("graphName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/AccountNumber" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + DefaultTtl = 100, + UniqueKeys = +{ +new CosmosDBUniqueKey() +{ +Paths = +{ +"/testPath" +}, +} +}, + ConflictResolutionPolicy = new ConflictResolutionPolicy() + { + Mode = ConflictResolutionMode.LastWriterWins, + ConflictResolutionPath = "/path", + }, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, graphName, content); + GremlinGraphResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphResource.cs new file mode 100644 index 0000000000000..115044f71cf11 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphResource.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinGraphResource + { + // CosmosDBGremlinGraphGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinGraphGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphResource created on azure + // for more information of creating GremlinGraphResource, please refer to the document of GremlinGraphResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphResourceId = GremlinGraphResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphResource gremlinGraph = client.GetGremlinGraphResource(gremlinGraphResourceId); + + // invoke the operation + GremlinGraphResource result = await gremlinGraph.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBGremlinGraphCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphCreateUpdate.json + // this example is just showing the usage of "GremlinResources_CreateUpdateGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphResource created on azure + // for more information of creating GremlinGraphResource, please refer to the document of GremlinGraphResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphResourceId = GremlinGraphResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphResource gremlinGraph = client.GetGremlinGraphResource(gremlinGraphResourceId); + + // invoke the operation + GremlinGraphCreateOrUpdateContent content = new GremlinGraphCreateOrUpdateContent(new AzureLocation("West US"), new GremlinGraphResourceInfo("graphName") + { + IndexingPolicy = new CosmosDBIndexingPolicy() + { + IsAutomatic = true, + IndexingMode = CosmosDBIndexingMode.Consistent, + IncludedPaths = +{ +new CosmosDBIncludedPath() +{ +Path = "/*", +Indexes = +{ +new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.String, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +},new CosmosDBPathIndexes() +{ +DataType = CosmosDBDataType.Number, +Precision = -1, +Kind = CosmosDBIndexKind.Range, +} +}, +} +}, + ExcludedPaths = +{ +}, + }, + PartitionKey = new CosmosDBContainerPartitionKey() + { + Paths = +{ +"/AccountNumber" +}, + Kind = CosmosDBPartitionKind.Hash, + }, + DefaultTtl = 100, + UniqueKeys = +{ +new CosmosDBUniqueKey() +{ +Paths = +{ +"/testPath" +}, +} +}, + ConflictResolutionPolicy = new ConflictResolutionPolicy() + { + Mode = ConflictResolutionMode.LastWriterWins, + ConflictResolutionPath = "/path", + }, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await gremlinGraph.UpdateAsync(WaitUntil.Completed, content); + GremlinGraphResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GremlinGraphData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBGremlinGraphDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphDelete.json + // this example is just showing the usage of "GremlinResources_DeleteGremlinGraph" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphResource created on azure + // for more information of creating GremlinGraphResource, please refer to the document of GremlinGraphResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphResourceId = GremlinGraphResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphResource gremlinGraph = client.GetGremlinGraphResource(gremlinGraphResourceId); + + // invoke the operation + await gremlinGraph.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBGremlinGraphBackupInformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveContinuousBackupInformation_CosmosDBGremlinGraphBackupInformation() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphBackupInformation.json + // this example is just showing the usage of "GremlinResources_RetrieveContinuousBackupInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphResource created on azure + // for more information of creating GremlinGraphResource, please refer to the document of GremlinGraphResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphResourceId = GremlinGraphResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphResource gremlinGraph = client.GetGremlinGraphResource(gremlinGraphResourceId); + + // invoke the operation + ContinuousBackupRestoreLocation location = new ContinuousBackupRestoreLocation() + { + Location = new AzureLocation("North Europe"), + }; + ArmOperation lro = await gremlinGraph.RetrieveContinuousBackupInformationAsync(WaitUntil.Completed, location); + CosmosDBBackupInformation result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphThroughputSettingResource.cs new file mode 100644 index 0000000000000..e7626c835fa0c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_GremlinGraphThroughputSettingResource.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_GremlinGraphThroughputSettingResource + { + // CosmosDBGremlinGraphThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBGremlinGraphThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphThroughputGet.json + // this example is just showing the usage of "GremlinResources_GetGremlinGraphThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphThroughputSettingResource created on azure + // for more information of creating GremlinGraphThroughputSettingResource, please refer to the document of GremlinGraphThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphThroughputSettingResourceId = GremlinGraphThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphThroughputSettingResource gremlinGraphThroughputSetting = client.GetGremlinGraphThroughputSettingResource(gremlinGraphThroughputSettingResourceId); + + // invoke the operation + GremlinGraphThroughputSettingResource result = await gremlinGraphThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBGremlinGraphThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphThroughputUpdate.json + // this example is just showing the usage of "GremlinResources_UpdateGremlinGraphThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphThroughputSettingResource created on azure + // for more information of creating GremlinGraphThroughputSettingResource, please refer to the document of GremlinGraphThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphThroughputSettingResourceId = GremlinGraphThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphThroughputSettingResource gremlinGraphThroughputSetting = client.GetGremlinGraphThroughputSettingResource(gremlinGraphThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await gremlinGraphThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + GremlinGraphThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateGremlinGraphToAutoscale_CosmosDBGremlinGraphMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphMigrateToAutoscale.json + // this example is just showing the usage of "GremlinResources_MigrateGremlinGraphToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphThroughputSettingResource created on azure + // for more information of creating GremlinGraphThroughputSettingResource, please refer to the document of GremlinGraphThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphThroughputSettingResourceId = GremlinGraphThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphThroughputSettingResource gremlinGraphThroughputSetting = client.GetGremlinGraphThroughputSettingResource(gremlinGraphThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await gremlinGraphThroughputSetting.MigrateGremlinGraphToAutoscaleAsync(WaitUntil.Completed); + GremlinGraphThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBGremlinGraphMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateGremlinGraphToManualThroughput_CosmosDBGremlinGraphMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json + // this example is just showing the usage of "GremlinResources_MigrateGremlinGraphToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GremlinGraphThroughputSettingResource created on azure + // for more information of creating GremlinGraphThroughputSettingResource, please refer to the document of GremlinGraphThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string graphName = "graphName"; + ResourceIdentifier gremlinGraphThroughputSettingResourceId = GremlinGraphThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, graphName); + GremlinGraphThroughputSettingResource gremlinGraphThroughputSetting = client.GetGremlinGraphThroughputSettingResource(gremlinGraphThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await gremlinGraphThroughputSetting.MigrateGremlinGraphToManualThroughputAsync(WaitUntil.Completed); + GremlinGraphThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterCollection.cs new file mode 100644 index 0000000000000..3f55ffc7f1307 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterCollection.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoClusterCollection + { + // List the mongo clusters by resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListTheMongoClustersByResourceGroup() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterListByResourceGroup.json + // this example is just showing the usage of "MongoClusters_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation and iterate over the result + await foreach (MongoClusterResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create a new mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateANewMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterCreate.json + // this example is just showing the usage of "MongoClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + MongoClusterData data = new MongoClusterData(new AzureLocation("westus2")) + { + AdministratorLogin = "mongoAdmin", + AdministratorLoginPassword = "password", + ServerVersion = "5.0", + NodeGroupSpecs = +{ +new NodeGroupSpec() +{ +Kind = NodeKind.Shard, +NodeCount = 3, +Sku = "M30", +DiskSizeInGB = 128, +EnableHa = true, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mongoClusterName, data); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create a new mongo cluster with point in time restore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateANewMongoClusterWithPointInTimeRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterCreatePITR.json + // this example is just showing the usage of "MongoClusters_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + MongoClusterData data = new MongoClusterData(new AzureLocation("westus2")) + { + CreateMode = CosmosDBAccountCreateMode.PointInTimeRestore, + RestoreParameters = new MongoClusterRestoreParameters() + { + PointInTimeUTC = DateTimeOffset.Parse("2023-01-13T20:07:35Z"), + SourceResourceId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mongoClusterName, data); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json + // this example is just showing the usage of "MongoClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + MongoClusterResource result = await collection.GetAsync(mongoClusterName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json + // this example is just showing the usage of "MongoClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + bool result = await collection.ExistsAsync(mongoClusterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json + // this example is just showing the usage of "MongoClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MongoClusterResource + MongoClusterCollection collection = resourceGroupResource.GetMongoClusters(); + + // invoke the operation + string mongoClusterName = "myMongoCluster"; + NullableResponse response = await collection.GetIfExistsAsync(mongoClusterName); + MongoClusterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterResource.cs new file mode 100644 index 0000000000000..50ebe03ff724c --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoClusterResource.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoClusterResource + { + // List all the mongo clusters + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMongoClusters_ListAllTheMongoClusters() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterList.json + // this example is just showing the usage of "MongoClusters_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (MongoClusterResource item in subscriptionResource.GetMongoClustersAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json + // this example is just showing the usage of "MongoClusters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + MongoClusterResource result = await mongoCluster.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterDelete.json + // this example is just showing the usage of "MongoClusters_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + await mongoCluster.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Add new shard nodes + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_AddNewShardNodes() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterAddNode.json + // this example is just showing the usage of "MongoClusters_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + MongoClusterPatch patch = new MongoClusterPatch() + { + NodeGroupSpecs = +{ +new NodeGroupSpec() +{ +Kind = NodeKind.Shard, +NodeCount = 4, +} +}, + }; + ArmOperation lro = await mongoCluster.UpdateAsync(WaitUntil.Completed, patch); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update the mongo cluster + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTheMongoCluster() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterUpdate.json + // this example is just showing the usage of "MongoClusters_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + MongoClusterPatch patch = new MongoClusterPatch() + { + AdministratorLogin = "mongoAdmin", + AdministratorLoginPassword = "password", + ServerVersion = "5.0", + NodeGroupSpecs = +{ +new NodeGroupSpec() +{ +Kind = NodeKind.Shard, +NodeCount = 4, +Sku = "M50", +DiskSizeInGB = 256, +EnableHa = true, +} +}, + }; + ArmOperation lro = await mongoCluster.UpdateAsync(WaitUntil.Completed, patch); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get connection string + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConnectionStrings_GetConnectionString() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/mongo-cluster/CosmosDBMongoClusterListConnectionStrings.json + // this example is just showing the usage of "MongoClusters_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + ListConnectionStringsResult result = await mongoCluster.GetConnectionStringsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionCollection.cs new file mode 100644 index 0000000000000..b51b5ac83ed26 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionCollection.cs @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBCollectionCollection + { + // CosmosDBMongoDBCollectionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBMongoDBCollectionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionList.json + // this example is just showing the usage of "MongoDBResources_ListMongoDBCollections" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation and iterate over the result + await foreach (MongoDBCollectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBMongoDBCollectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBCollectionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + MongoDBCollectionResource result = await collection.GetAsync(collectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBMongoDBCollectionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + bool result = await collection.ExistsAsync(collectionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBCollectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBMongoDBCollectionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + NullableResponse response = await collection.GetIfExistsAsync(collectionName); + MongoDBCollectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBMongoDBCollectionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBCollectionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + MongoDBCollectionCreateOrUpdateContent content = new MongoDBCollectionCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBCollectionResourceInfo("collectionName") + { + ShardKey = +{ +["testKey"] = "Hash", +}, + Indexes = +{ +new MongoDBIndex() +{ +Keys = +{ +"_ts" +}, +Options = new MongoDBIndexConfig() +{ +ExpireAfterSeconds = 100, +IsUnique = true, +}, +},new MongoDBIndex() +{ +Keys = +{ +"_id" +}, +} +}, + AnalyticalStorageTtl = 500, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, collectionName, content); + MongoDBCollectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBCollectionRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionRestore.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // get the collection of this MongoDBCollectionResource + MongoDBCollectionCollection collection = mongoDBDatabase.GetMongoDBCollections(); + + // invoke the operation + string collectionName = "collectionName"; + MongoDBCollectionCreateOrUpdateContent content = new MongoDBCollectionCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBCollectionResourceInfo("collectionName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, collectionName, content); + MongoDBCollectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionResource.cs new file mode 100644 index 0000000000000..162fb065cb7f3 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionResource.cs @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBCollectionResource + { + // CosmosDBMongoDBCollectionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBCollectionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + MongoDBCollectionResource result = await mongoDBCollection.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBCollectionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + MongoDBCollectionCreateOrUpdateContent content = new MongoDBCollectionCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBCollectionResourceInfo("collectionName") + { + ShardKey = +{ +["testKey"] = "Hash", +}, + Indexes = +{ +new MongoDBIndex() +{ +Keys = +{ +"_ts" +}, +Options = new MongoDBIndexConfig() +{ +ExpireAfterSeconds = 100, +IsUnique = true, +}, +},new MongoDBIndex() +{ +Keys = +{ +"_id" +}, +} +}, + AnalyticalStorageTtl = 500, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBCollection.UpdateAsync(WaitUntil.Completed, content); + MongoDBCollectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBCollectionRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionRestore.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + MongoDBCollectionCreateOrUpdateContent content = new MongoDBCollectionCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBCollectionResourceInfo("collectionName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBCollection.UpdateAsync(WaitUntil.Completed, content); + MongoDBCollectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBCollectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBMongoDBCollectionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionDelete.json + // this example is just showing the usage of "MongoDBResources_DeleteMongoDBCollection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + await mongoDBCollection.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBMongoDBCollectionPartitionMerge + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMongoDBCollectionPartitionMerge_CosmosDBMongoDBCollectionPartitionMerge() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionPartitionMerge.json + // this example is just showing the usage of "MongoDBResources_ListMongoDBCollectionPartitionMerge" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + MergeParameters mergeParameters = new MergeParameters() + { + IsDryRun = false, + }; + ArmOperation lro = await mongoDBCollection.GetMongoDBCollectionPartitionMergeAsync(WaitUntil.Completed, mergeParameters); + PhysicalPartitionStorageInfoCollection result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBCollectionBackupInformation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveContinuousBackupInformation_CosmosDBMongoDBCollectionBackupInformation() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionBackupInformation.json + // this example is just showing the usage of "MongoDBResources_RetrieveContinuousBackupInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionResource created on azure + // for more information of creating MongoDBCollectionResource, please refer to the document of MongoDBCollectionResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionResourceId = MongoDBCollectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionResource mongoDBCollection = client.GetMongoDBCollectionResource(mongoDBCollectionResourceId); + + // invoke the operation + ContinuousBackupRestoreLocation location = new ContinuousBackupRestoreLocation() + { + Location = new AzureLocation("North Europe"), + }; + ArmOperation lro = await mongoDBCollection.RetrieveContinuousBackupInformationAsync(WaitUntil.Completed, location); + CosmosDBBackupInformation result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionThroughputSettingResource.cs new file mode 100644 index 0000000000000..a7112954dc775 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBCollectionThroughputSettingResource.cs @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBCollectionThroughputSettingResource + { + // CosmosDBMongoDBCollectionRetrieveThroughputDistribution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBContainerRetrieveThroughputDistribution_CosmosDBMongoDBCollectionRetrieveThroughputDistribution() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionRetrieveThroughputDistribution.json + // this example is just showing the usage of "MongoDBResources_MongoDBContainerRetrieveThroughputDistribution" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + RetrieveThroughputParameters retrieveThroughputParameters = new RetrieveThroughputParameters(new AzureLocation("placeholder"), new RetrieveThroughputPropertiesResource(new WritableSubResource[] + { +new WritableSubResource() +{ +Id = new ResourceIdentifier("0"), +},new WritableSubResource() +{ +Id = new ResourceIdentifier("1"), +} + })); + ArmOperation lro = await mongoDBCollectionThroughputSetting.MongoDBContainerRetrieveThroughputDistributionAsync(WaitUntil.Completed, retrieveThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBCollectionRedistributeThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBContainerRedistributeThroughput_CosmosDBMongoDBCollectionRedistributeThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionRedistributeThroughput.json + // this example is just showing the usage of "MongoDBResources_MongoDBContainerRedistributeThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + RedistributeThroughputParameters redistributeThroughputParameters = new RedistributeThroughputParameters(new AzureLocation("placeholder"), new RedistributeThroughputPropertiesResource(ThroughputPolicyType.Custom, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("0") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("1") +{ +Throughput = 5000, +} + }, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("2") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("3") + })); + ArmOperation lro = await mongoDBCollectionThroughputSetting.MongoDBContainerRedistributeThroughputAsync(WaitUntil.Completed, redistributeThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBCollectionThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBCollectionThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionThroughputGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBCollectionThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + MongoDBCollectionThroughputSettingResource result = await mongoDBCollectionThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBCollectionThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionThroughputUpdate.json + // this example is just showing the usage of "MongoDBResources_UpdateMongoDBCollectionThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBCollectionThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + MongoDBCollectionThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateMongoDBCollectionToAutoscale_CosmosDBMongoDBCollectionMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json + // this example is just showing the usage of "MongoDBResources_MigrateMongoDBCollectionToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await mongoDBCollectionThroughputSetting.MigrateMongoDBCollectionToAutoscaleAsync(WaitUntil.Completed); + MongoDBCollectionThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBCollectionMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateMongoDBCollectionToManualThroughput_CosmosDBMongoDBCollectionMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json + // this example is just showing the usage of "MongoDBResources_MigrateMongoDBCollectionToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBCollectionThroughputSettingResource created on azure + // for more information of creating MongoDBCollectionThroughputSettingResource, please refer to the document of MongoDBCollectionThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + string collectionName = "collectionName"; + ResourceIdentifier mongoDBCollectionThroughputSettingResourceId = MongoDBCollectionThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName, collectionName); + MongoDBCollectionThroughputSettingResource mongoDBCollectionThroughputSetting = client.GetMongoDBCollectionThroughputSettingResource(mongoDBCollectionThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await mongoDBCollectionThroughputSetting.MigrateMongoDBCollectionToManualThroughputAsync(WaitUntil.Completed); + MongoDBCollectionThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseCollection.cs new file mode 100644 index 0000000000000..163489d935599 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseCollection.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBDatabaseCollection + { + // CosmosDBMongoDBDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBMongoDBDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseList.json + // this example is just showing the usage of "MongoDBResources_ListMongoDBDatabases" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation and iterate over the result + await foreach (MongoDBDatabaseResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBMongoDBDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + MongoDBDatabaseResource result = await collection.GetAsync(databaseName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBMongoDBDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + bool result = await collection.ExistsAsync(databaseName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBMongoDBDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + NullableResponse response = await collection.GetIfExistsAsync(databaseName); + MongoDBDatabaseResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBMongoDBDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + MongoDBDatabaseCreateOrUpdateContent content = new MongoDBDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + MongoDBDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBDatabaseRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseRestore.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBDatabaseResource + MongoDBDatabaseCollection collection = cosmosDBAccount.GetMongoDBDatabases(); + + // invoke the operation + string databaseName = "databaseName"; + MongoDBDatabaseCreateOrUpdateContent content = new MongoDBDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBDatabaseResourceInfo("databaseName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, content); + MongoDBDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseResource.cs new file mode 100644 index 0000000000000..c8b77beeb9285 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseResource.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBDatabaseResource + { + // CosmosDBMongoDBDatabaseGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBDatabaseGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + MongoDBDatabaseResource result = await mongoDBDatabase.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBDatabaseCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + MongoDBDatabaseCreateOrUpdateContent content = new MongoDBDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBDatabaseResourceInfo("databaseName")) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBDatabase.UpdateAsync(WaitUntil.Completed, content); + MongoDBDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseRestore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBDatabaseRestore() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseRestore.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + MongoDBDatabaseCreateOrUpdateContent content = new MongoDBDatabaseCreateOrUpdateContent(new AzureLocation("West US"), new MongoDBDatabaseResourceInfo("databaseName") + { + RestoreParameters = new ResourceRestoreParameters() + { + RestoreSource = "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + RestoreTimestampInUtc = DateTimeOffset.Parse("2022-07-20T18:28:00Z"), + }, + CreateMode = CosmosDBAccountCreateMode.Restore, + }) + { + Options = new CosmosDBCreateUpdateConfig(), + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBDatabase.UpdateAsync(WaitUntil.Completed, content); + MongoDBDatabaseResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBDatabaseData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBMongoDBDatabaseDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseDelete.json + // this example is just showing the usage of "MongoDBResources_DeleteMongoDBDatabase" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + await mongoDBDatabase.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBMongoDBDatabasePartitionMerge + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBDatabasePartitionMerge_CosmosDBMongoDBDatabasePartitionMerge() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabasePartitionMerge.json + // this example is just showing the usage of "MongoDBResources_MongoDBDatabasePartitionMerge" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseResource created on azure + // for more information of creating MongoDBDatabaseResource, please refer to the document of MongoDBDatabaseResource + string subscriptionId = "subid"; + string resourceGroupName = "rgName"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseResourceId = MongoDBDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseResource mongoDBDatabase = client.GetMongoDBDatabaseResource(mongoDBDatabaseResourceId); + + // invoke the operation + MergeParameters mergeParameters = new MergeParameters() + { + IsDryRun = false, + }; + ArmOperation lro = await mongoDBDatabase.MongoDBDatabasePartitionMergeAsync(WaitUntil.Completed, mergeParameters); + PhysicalPartitionStorageInfoCollection result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseThroughputSettingResource.cs new file mode 100644 index 0000000000000..a5480cf2cced7 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBDatabaseThroughputSettingResource.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBDatabaseThroughputSettingResource + { + // CosmosDBMongoDBDatabaseThroughputGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBDatabaseThroughputGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseThroughputGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoDBDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + MongoDBDatabaseThroughputSettingResource result = await mongoDBDatabaseThroughputSetting.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseThroughputUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBDatabaseThroughputUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json + // this example is just showing the usage of "MongoDBResources_UpdateMongoDBDatabaseThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + ThroughputSettingsUpdateData data = new ThroughputSettingsUpdateData(new AzureLocation("West US"), new ThroughputSettingsResourceInfo() + { + Throughput = 400, + }) + { + Tags = +{ +}, + }; + ArmOperation lro = await mongoDBDatabaseThroughputSetting.CreateOrUpdateAsync(WaitUntil.Completed, data); + MongoDBDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseMigrateToAutoscale + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateMongoDBDatabaseToAutoscale_CosmosDBMongoDBDatabaseMigrateToAutoscale() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json + // this example is just showing the usage of "MongoDBResources_MigrateMongoDBDatabaseToAutoscale" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await mongoDBDatabaseThroughputSetting.MigrateMongoDBDatabaseToAutoscaleAsync(WaitUntil.Completed); + MongoDBDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseMigrateToManualThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MigrateMongoDBDatabaseToManualThroughput_CosmosDBMongoDBDatabaseMigrateToManualThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json + // this example is just showing the usage of "MongoDBResources_MigrateMongoDBDatabaseToManualThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + ArmOperation lro = await mongoDBDatabaseThroughputSetting.MigrateMongoDBDatabaseToManualThroughputAsync(WaitUntil.Completed); + MongoDBDatabaseThroughputSettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ThroughputSettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBDatabaseRetrieveThroughputDistribution + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBDatabaseRetrieveThroughputDistribution_CosmosDBMongoDBDatabaseRetrieveThroughputDistribution() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseRetrieveThroughputDistribution.json + // this example is just showing the usage of "MongoDBResources_MongoDBDatabaseRetrieveThroughputDistribution" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + RetrieveThroughputParameters retrieveThroughputParameters = new RetrieveThroughputParameters(new AzureLocation("placeholder"), new RetrieveThroughputPropertiesResource(new WritableSubResource[] + { +new WritableSubResource() +{ +Id = new ResourceIdentifier("0"), +},new WritableSubResource() +{ +Id = new ResourceIdentifier("1"), +} + })); + ArmOperation lro = await mongoDBDatabaseThroughputSetting.MongoDBDatabaseRetrieveThroughputDistributionAsync(WaitUntil.Completed, retrieveThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBDatabaseRedistributeThroughput + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task MongoDBDatabaseRedistributeThroughput_CosmosDBMongoDBDatabaseRedistributeThroughput() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBDatabaseRedistributeThroughput.json + // this example is just showing the usage of "MongoDBResources_MongoDBDatabaseRedistributeThroughput" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBDatabaseThroughputSettingResource created on azure + // for more information of creating MongoDBDatabaseThroughputSettingResource, please refer to the document of MongoDBDatabaseThroughputSettingResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string accountName = "ddb1"; + string databaseName = "databaseName"; + ResourceIdentifier mongoDBDatabaseThroughputSettingResourceId = MongoDBDatabaseThroughputSettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, databaseName); + MongoDBDatabaseThroughputSettingResource mongoDBDatabaseThroughputSetting = client.GetMongoDBDatabaseThroughputSettingResource(mongoDBDatabaseThroughputSettingResourceId); + + // invoke the operation + RedistributeThroughputParameters redistributeThroughputParameters = new RedistributeThroughputParameters(new AzureLocation("placeholder"), new RedistributeThroughputPropertiesResource(ThroughputPolicyType.Custom, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("0") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("1") +{ +Throughput = 5000, +} + }, new PhysicalPartitionThroughputInfoResource[] + { +new PhysicalPartitionThroughputInfoResource("2") +{ +Throughput = 5000, +},new PhysicalPartitionThroughputInfoResource("3") + })); + ArmOperation lro = await mongoDBDatabaseThroughputSetting.MongoDBDatabaseRedistributeThroughputAsync(WaitUntil.Completed, redistributeThroughputParameters); + PhysicalPartitionThroughputInfoResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionCollection.cs new file mode 100644 index 0000000000000..2242761487f6f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionCollection.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBRoleDefinitionCollection + { + // CosmosDBMongoRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + MongoDBRoleDefinitionResource result = await collection.GetAsync(mongoRoleDefinitionId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBMongoRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + bool result = await collection.ExistsAsync(mongoRoleDefinitionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBMongoRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + NullableResponse response = await collection.GetIfExistsAsync(mongoRoleDefinitionId); + MongoDBRoleDefinitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBMongoDBRoleDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBRoleDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + MongoDBRoleDefinitionCreateOrUpdateContent content = new MongoDBRoleDefinitionCreateOrUpdateContent() + { + RoleName = "myRoleName", + DatabaseName = "sales", + Privileges = +{ +new MongoDBPrivilege() +{ +Resource = new MongoDBPrivilegeResourceInfo() +{ +DBName = "sales", +Collection = "sales", +}, +Actions = +{ +"insert","find" +}, +} +}, + Roles = +{ +new MongoDBRole() +{ +DBName = "sales", +Role = "myInheritedRole", +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mongoRoleDefinitionId, content); + MongoDBRoleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBRoleDefinitionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBMongoDBRoleDefinitionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionList.json + // this example is just showing the usage of "MongoDBResources_ListMongoRoleDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBRoleDefinitionResource + MongoDBRoleDefinitionCollection collection = cosmosDBAccount.GetMongoDBRoleDefinitions(); + + // invoke the operation and iterate over the result + await foreach (MongoDBRoleDefinitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionResource.cs new file mode 100644 index 0000000000000..cec383811e36a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBRoleDefinitionResource.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBRoleDefinitionResource + { + // CosmosDBMongoRoleDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoRoleDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBRoleDefinitionResource created on azure + // for more information of creating MongoDBRoleDefinitionResource, please refer to the document of MongoDBRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + ResourceIdentifier mongoDBRoleDefinitionResourceId = MongoDBRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoRoleDefinitionId); + MongoDBRoleDefinitionResource mongoDBRoleDefinition = client.GetMongoDBRoleDefinitionResource(mongoDBRoleDefinitionResourceId); + + // invoke the operation + MongoDBRoleDefinitionResource result = await mongoDBRoleDefinition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBRoleDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBRoleDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBRoleDefinitionResource created on azure + // for more information of creating MongoDBRoleDefinitionResource, please refer to the document of MongoDBRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + ResourceIdentifier mongoDBRoleDefinitionResourceId = MongoDBRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoRoleDefinitionId); + MongoDBRoleDefinitionResource mongoDBRoleDefinition = client.GetMongoDBRoleDefinitionResource(mongoDBRoleDefinitionResourceId); + + // invoke the operation + MongoDBRoleDefinitionCreateOrUpdateContent content = new MongoDBRoleDefinitionCreateOrUpdateContent() + { + RoleName = "myRoleName", + DatabaseName = "sales", + Privileges = +{ +new MongoDBPrivilege() +{ +Resource = new MongoDBPrivilegeResourceInfo() +{ +DBName = "sales", +Collection = "sales", +}, +Actions = +{ +"insert","find" +}, +} +}, + Roles = +{ +new MongoDBRole() +{ +DBName = "sales", +Role = "myInheritedRole", +} +}, + }; + ArmOperation lro = await mongoDBRoleDefinition.UpdateAsync(WaitUntil.Completed, content); + MongoDBRoleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBRoleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBRoleDefinitionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBMongoDBRoleDefinitionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBRoleDefinitionDelete.json + // this example is just showing the usage of "MongoDBResources_DeleteMongoRoleDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBRoleDefinitionResource created on azure + // for more information of creating MongoDBRoleDefinitionResource, please refer to the document of MongoDBRoleDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoRoleDefinitionId = "myMongoRoleDefinitionId"; + ResourceIdentifier mongoDBRoleDefinitionResourceId = MongoDBRoleDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoRoleDefinitionId); + MongoDBRoleDefinitionResource mongoDBRoleDefinition = client.GetMongoDBRoleDefinitionResource(mongoDBRoleDefinitionResourceId); + + // invoke the operation + await mongoDBRoleDefinition.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionCollection.cs new file mode 100644 index 0000000000000..9fff97556e4d9 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionCollection.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBUserDefinitionCollection + { + // CosmosDBMongoDBUserDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBUserDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + MongoDBUserDefinitionResource result = await collection.GetAsync(mongoUserDefinitionId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBUserDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBMongoDBUserDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + bool result = await collection.ExistsAsync(mongoUserDefinitionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBMongoDBUserDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBMongoDBUserDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + NullableResponse response = await collection.GetIfExistsAsync(mongoUserDefinitionId); + MongoDBUserDefinitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CosmosDBMongoDBUserDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CosmosDBMongoDBUserDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + MongoDBUserDefinitionCreateOrUpdateContent content = new MongoDBUserDefinitionCreateOrUpdateContent() + { + UserName = "myUserName", + Password = "myPassword", + DatabaseName = "sales", + CustomData = "My custom data", + Roles = +{ +new MongoDBRole() +{ +DBName = "sales", +Role = "myReadRole", +} +}, + Mechanisms = "SCRAM-SHA-256", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, mongoUserDefinitionId, content); + MongoDBUserDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBUserDefinitionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBMongoDBUserDefinitionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionList.json + // this example is just showing the usage of "MongoDBResources_ListMongoUserDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBAccountResource created on azure + // for more information of creating CosmosDBAccountResource, please refer to the document of CosmosDBAccountResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + ResourceIdentifier cosmosDBAccountResourceId = CosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CosmosDBAccountResource cosmosDBAccount = client.GetCosmosDBAccountResource(cosmosDBAccountResourceId); + + // get the collection of this MongoDBUserDefinitionResource + MongoDBUserDefinitionCollection collection = cosmosDBAccount.GetMongoDBUserDefinitions(); + + // invoke the operation and iterate over the result + await foreach (MongoDBUserDefinitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionResource.cs new file mode 100644 index 0000000000000..c08d54acb8986 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_MongoDBUserDefinitionResource.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_MongoDBUserDefinitionResource + { + // CosmosDBMongoDBUserDefinitionGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBMongoDBUserDefinitionGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionGet.json + // this example is just showing the usage of "MongoDBResources_GetMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBUserDefinitionResource created on azure + // for more information of creating MongoDBUserDefinitionResource, please refer to the document of MongoDBUserDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + ResourceIdentifier mongoDBUserDefinitionResourceId = MongoDBUserDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoUserDefinitionId); + MongoDBUserDefinitionResource mongoDBUserDefinition = client.GetMongoDBUserDefinitionResource(mongoDBUserDefinitionResourceId); + + // invoke the operation + MongoDBUserDefinitionResource result = await mongoDBUserDefinition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBUserDefinitionCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CosmosDBMongoDBUserDefinitionCreateUpdate() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json + // this example is just showing the usage of "MongoDBResources_CreateUpdateMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBUserDefinitionResource created on azure + // for more information of creating MongoDBUserDefinitionResource, please refer to the document of MongoDBUserDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + ResourceIdentifier mongoDBUserDefinitionResourceId = MongoDBUserDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoUserDefinitionId); + MongoDBUserDefinitionResource mongoDBUserDefinition = client.GetMongoDBUserDefinitionResource(mongoDBUserDefinitionResourceId); + + // invoke the operation + MongoDBUserDefinitionCreateOrUpdateContent content = new MongoDBUserDefinitionCreateOrUpdateContent() + { + UserName = "myUserName", + Password = "myPassword", + DatabaseName = "sales", + CustomData = "My custom data", + Roles = +{ +new MongoDBRole() +{ +DBName = "sales", +Role = "myReadRole", +} +}, + Mechanisms = "SCRAM-SHA-256", + }; + ArmOperation lro = await mongoDBUserDefinition.UpdateAsync(WaitUntil.Completed, content); + MongoDBUserDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoDBUserDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBMongoDBUserDefinitionDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_CosmosDBMongoDBUserDefinitionDelete() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBMongoDBUserDefinitionDelete.json + // this example is just showing the usage of "MongoDBResources_DeleteMongoUserDefinition" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoDBUserDefinitionResource created on azure + // for more information of creating MongoDBUserDefinitionResource, please refer to the document of MongoDBUserDefinitionResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string accountName = "myAccountName"; + string mongoUserDefinitionId = "myMongoUserDefinitionId"; + ResourceIdentifier mongoDBUserDefinitionResourceId = MongoDBUserDefinitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, mongoUserDefinitionId); + MongoDBUserDefinitionResource mongoDBUserDefinition = client.GetMongoDBUserDefinitionResource(mongoDBUserDefinitionResourceId); + + // invoke the operation + await mongoDBUserDefinition.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountCollection.cs new file mode 100644 index 0000000000000..001e754460501 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountCollection.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_RestorableCosmosDBAccountCollection + { + // CosmosDBRestorableDatabaseAccountList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CosmosDBRestorableDatabaseAccountList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountList.json + // this example is just showing the usage of "RestorableDatabaseAccounts_ListByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // get the collection of this RestorableCosmosDBAccountResource + RestorableCosmosDBAccountCollection collection = cosmosDBLocation.GetRestorableCosmosDBAccounts(); + + // invoke the operation and iterate over the result + await foreach (RestorableCosmosDBAccountResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBRestorableDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + // this example is just showing the usage of "RestorableDatabaseAccounts_GetByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // get the collection of this RestorableCosmosDBAccountResource + RestorableCosmosDBAccountCollection collection = cosmosDBLocation.GetRestorableCosmosDBAccounts(); + + // invoke the operation + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + RestorableCosmosDBAccountResource result = await collection.GetAsync(instanceId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBRestorableDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CosmosDBRestorableDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + // this example is just showing the usage of "RestorableDatabaseAccounts_GetByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // get the collection of this RestorableCosmosDBAccountResource + RestorableCosmosDBAccountCollection collection = cosmosDBLocation.GetRestorableCosmosDBAccounts(); + + // invoke the operation + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + bool result = await collection.ExistsAsync(instanceId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CosmosDBRestorableDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CosmosDBRestorableDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + // this example is just showing the usage of "RestorableDatabaseAccounts_GetByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CosmosDBLocationResource created on azure + // for more information of creating CosmosDBLocationResource, please refer to the document of CosmosDBLocationResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + ResourceIdentifier cosmosDBLocationResourceId = CosmosDBLocationResource.CreateResourceIdentifier(subscriptionId, location); + CosmosDBLocationResource cosmosDBLocation = client.GetCosmosDBLocationResource(cosmosDBLocationResourceId); + + // get the collection of this RestorableCosmosDBAccountResource + RestorableCosmosDBAccountCollection collection = cosmosDBLocation.GetRestorableCosmosDBAccounts(); + + // invoke the operation + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + NullableResponse response = await collection.GetIfExistsAsync(instanceId); + RestorableCosmosDBAccountResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountResource.cs new file mode 100644 index 0000000000000..278e8a0f2328f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/samples/Generated/Samples/Sample_RestorableCosmosDBAccountResource.cs @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; +using Azure.ResourceManager.CosmosDB.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB.Samples +{ + public partial class Sample_RestorableCosmosDBAccountResource + { + // CosmosDBRestorableDatabaseAccountNoLocationList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableCosmosDBAccounts_CosmosDBRestorableDatabaseAccountNoLocationList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json + // this example is just showing the usage of "RestorableDatabaseAccounts_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableCosmosDBAccountResource item in subscriptionResource.GetRestorableCosmosDBAccountsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableDatabaseAccountGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CosmosDBRestorableDatabaseAccountGet() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableDatabaseAccountGet.json + // this example is just showing the usage of "RestorableDatabaseAccounts_GetByLocation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("West US"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation + RestorableCosmosDBAccountResource result = await restorableCosmosDBAccount.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RestorableCosmosDBAccountData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CosmosDBRestorableSqlDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableSqlDatabases_CosmosDBRestorableSqlDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableSqlDatabaseList.json + // this example is just showing the usage of "RestorableSqlDatabases_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableSqlDatabase item in restorableCosmosDBAccount.GetRestorableSqlDatabasesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableSqlContainerList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableSqlContainers_CosmosDBRestorableSqlContainerList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableSqlContainerList.json + // this example is just showing the usage of "RestorableSqlContainers_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("98a570f2-63db-4117-91f0-366327b7b353"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string restorableSqlDatabaseRid = "3fu-hg=="; + await foreach (RestorableSqlContainer item in restorableCosmosDBAccount.GetRestorableSqlContainersAsync(restorableSqlDatabaseRid: restorableSqlDatabaseRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableSqlResourceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAllRestorableSqlResourceData_CosmosDBRestorableSqlResourceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableSqlResourceList.json + // this example is just showing the usage of "RestorableSqlResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + AzureLocation? restoreLocation = new AzureLocation("WestUS"); + string restoreTimestampInUtc = "06/01/2022 4:56"; + await foreach (RestorableSqlResourceData item in restorableCosmosDBAccount.GetAllRestorableSqlResourceDataAsync(restoreLocation: restoreLocation, restoreTimestampInUtc: restoreTimestampInUtc)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableMongodbDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableMongoDBDatabases_CosmosDBRestorableMongodbDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableMongodbDatabaseList.json + // this example is just showing the usage of "RestorableMongodbDatabases_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableMongoDBDatabase item in restorableCosmosDBAccount.GetRestorableMongoDBDatabasesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableMongodbCollectionList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableMongoDBCollections_CosmosDBRestorableMongodbCollectionList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableMongodbCollectionList.json + // this example is just showing the usage of "RestorableMongodbCollections_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("98a570f2-63db-4117-91f0-366327b7b353"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string restorableMongoDBDatabaseRid = "PD5DALigDgw="; + await foreach (RestorableMongoDBCollection item in restorableCosmosDBAccount.GetRestorableMongoDBCollectionsAsync(restorableMongoDBDatabaseRid: restorableMongoDBDatabaseRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableMongodbResourceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAllRestorableMongoDBResourceData_CosmosDBRestorableMongodbResourceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableMongodbResourceList.json + // this example is just showing the usage of "RestorableMongodbResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + AzureLocation? restoreLocation = new AzureLocation("WestUS"); + string restoreTimestampInUtc = "06/01/2022 4:56"; + await foreach (RestorableMongoDBResourceData item in restorableCosmosDBAccount.GetAllRestorableMongoDBResourceDataAsync(restoreLocation: restoreLocation, restoreTimestampInUtc: restoreTimestampInUtc)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableGremlinDatabaseList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableGremlinDatabases_CosmosDBRestorableGremlinDatabaseList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableGremlinDatabaseList.json + // this example is just showing the usage of "RestorableGremlinDatabases_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableGremlinDatabase item in restorableCosmosDBAccount.GetRestorableGremlinDatabasesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableGremlinGraphList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableGremlinGraphs_CosmosDBRestorableGremlinGraphList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableGremlinGraphList.json + // this example is just showing the usage of "RestorableGremlinGraphs_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("98a570f2-63db-4117-91f0-366327b7b353"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + string restorableGremlinDatabaseRid = "PD5DALigDgw="; + await foreach (RestorableGremlinGraph item in restorableCosmosDBAccount.GetRestorableGremlinGraphsAsync(restorableGremlinDatabaseRid: restorableGremlinDatabaseRid)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableGremlinResourceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableGremlinResources_CosmosDBRestorableGremlinResourceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableGremlinResourceList.json + // this example is just showing the usage of "RestorableGremlinResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + AzureLocation? restoreLocation = new AzureLocation("WestUS"); + string restoreTimestampInUtc = "06/01/2022 4:56"; + await foreach (RestorableGremlinResourceData item in restorableCosmosDBAccount.GetRestorableGremlinResourcesAsync(restoreLocation: restoreLocation, restoreTimestampInUtc: restoreTimestampInUtc)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableTableList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableTables_CosmosDBRestorableTableList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableTableList.json + // this example is just showing the usage of "RestorableTables_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "subid"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("98a570f2-63db-4117-91f0-366327b7b353"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + await foreach (RestorableTable item in restorableCosmosDBAccount.GetRestorableTablesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CosmosDBRestorableTableResourceList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRestorableTableResources_CosmosDBRestorableTableResourceList() + { + // Generated from example definition: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-09-15-preview/examples/CosmosDBRestorableTableResourceList.json + // this example is just showing the usage of "RestorableTableResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RestorableCosmosDBAccountResource created on azure + // for more information of creating RestorableCosmosDBAccountResource, please refer to the document of RestorableCosmosDBAccountResource + string subscriptionId = "2296c272-5d55-40d9-bc05-4d56dc2d7588"; + AzureLocation location = new AzureLocation("WestUS"); + Guid instanceId = Guid.Parse("d9b26648-2f53-4541-b3d8-3044f4f9810d"); + ResourceIdentifier restorableCosmosDBAccountResourceId = RestorableCosmosDBAccountResource.CreateResourceIdentifier(subscriptionId, location, instanceId); + RestorableCosmosDBAccountResource restorableCosmosDBAccount = client.GetRestorableCosmosDBAccountResource(restorableCosmosDBAccountResourceId); + + // invoke the operation and iterate over the result + AzureLocation? restoreLocation = new AzureLocation("WestUS"); + string restoreTimestampInUtc = "06/01/2022 4:56"; + await foreach (RestorableTableResourceData item in restorableCosmosDBAccount.GetRestorableTableResourcesAsync(restoreLocation: restoreLocation, restoreTimestampInUtc: restoreTimestampInUtc)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Azure.ResourceManager.CosmosDB.csproj b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Azure.ResourceManager.CosmosDB.csproj index 3c45ce9c7ae89..7962e4d8b2b6c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Azure.ResourceManager.CosmosDB.csproj +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Azure.ResourceManager.CosmosDB.csproj @@ -1,7 +1,7 @@ - 1.4.0-beta.4 + 1.4.0-beta.5 1.3.0 Azure.ResourceManager.CosmosDB diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Custom/CassandraClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Custom/CassandraClusterResource.cs new file mode 100644 index 0000000000000..5cdc91ed66bfe --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Custom/CassandraClusterResource.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CosmosDB +{ + /// + /// A Class representing a CassandraCluster along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetCassandraClusterResource method. + /// Otherwise you can get one from its parent resource using the GetCassandraCluster method. + /// + public partial class CassandraClusterResource : ArmResource + { + /// + /// Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated cluster. Use Start to restart the cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate + /// + /// + /// Operation Id + /// CassandraClusters_Deallocate + /// + /// + /// + /// 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. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task DeallocateAsync(WaitUntil waitUntil, CancellationToken cancellationToken) + => await DeallocateAsync(waitUntil, null, cancellationToken).ConfigureAwait(false); + + /// + /// Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated cluster. Use Start to restart the cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate + /// + /// + /// Operation Id + /// CassandraClusters_Deallocate + /// + /// + /// + /// 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. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual ArmOperation Deallocate(WaitUntil waitUntil, CancellationToken cancellationToken) + => Deallocate(waitUntil, null, cancellationToken); + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs index bdd951bcd7c6f..c00ba194f5362 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/ArmCosmosDBModelFactory.cs @@ -71,9 +71,12 @@ public static partial class ArmCosmosDBModelFactory /// Flag to indicate enabling/disabling of Partition Merge feature on the account. /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + /// Enum to indicate default Priority Level of request for Priority Based Execution. /// Identity for the resource. /// A new instance for mocking. - public static CosmosDBAccountData CosmosDBAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CosmosDBAccountKind? kind = null, string provisioningState = null, string documentEndpoint = null, CosmosDBAccountOfferType? databaseAccountOfferType = null, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable capabilities = null, IEnumerable writeLocations = null, IEnumerable readLocations = null, IEnumerable locations = null, IEnumerable failoverPolicies = null, IEnumerable virtualNetworkRules = null, IEnumerable privateEndpointConnections = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, Guid? instanceId = null, CosmosDBAccountCreateMode? createMode = null, CosmosDBAccountRestoreParameters restoreParameters = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null, ManagedServiceIdentity identity = null) + public static CosmosDBAccountData CosmosDBAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CosmosDBAccountKind? kind = null, string provisioningState = null, string documentEndpoint = null, CosmosDBAccountOfferType? databaseAccountOfferType = null, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable capabilities = null, IEnumerable writeLocations = null, IEnumerable readLocations = null, IEnumerable locations = null, IEnumerable failoverPolicies = null, IEnumerable virtualNetworkRules = null, IEnumerable privateEndpointConnections = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, Guid? instanceId = null, CosmosDBAccountCreateMode? createMode = null, CosmosDBAccountRestoreParameters restoreParameters = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null, CustomerManagedKeyStatus? customerManagedKeyStatus = null, bool? enablePriorityBasedExecution = null, DefaultPriorityLevel? defaultPriorityLevel = null, ManagedServiceIdentity identity = null) { tags ??= new Dictionary(); ipRules ??= new List(); @@ -87,7 +90,7 @@ public static CosmosDBAccountData CosmosDBAccountData(ResourceIdentifier id = nu cors ??= new List(); networkAclBypassResourceIds ??= new List(); - return new CosmosDBAccountData(id, name, resourceType, systemData, tags, location, kind, provisioningState, documentEndpoint, databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, consistencyPolicy, capabilities?.ToList(), writeLocations?.ToList(), readLocations?.ToList(), locations?.ToList(), failoverPolicies?.ToList(), virtualNetworkRules?.ToList(), privateEndpointConnections?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, instanceId, createMode, restoreParameters, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, identity); + return new CosmosDBAccountData(id, name, resourceType, systemData, tags, location, kind, provisioningState, documentEndpoint, databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, consistencyPolicy, capabilities?.ToList(), writeLocations?.ToList(), readLocations?.ToList(), locations?.ToList(), failoverPolicies?.ToList(), virtualNetworkRules?.ToList(), privateEndpointConnections?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, instanceId, createMode, restoreParameters, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, customerManagedKeyStatus, enablePriorityBasedExecution, defaultPriorityLevel, identity); } /// Initializes a new instance of CosmosDBAccountLocation. @@ -194,9 +197,12 @@ public static DatabaseAccountKeysMetadata DatabaseAccountKeysMetadata(DateTimeOf /// Flag to indicate enabling/disabling of Partition Merge feature on the account. /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + /// Enum to indicate default Priority Level of request for Priority Based Execution. /// Identity for the resource. /// A new instance for mocking. - public static CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CosmosDBAccountKind? kind = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable locations = null, CosmosDBAccountOfferType databaseAccountOfferType = default, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, IEnumerable capabilities = null, IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, CosmosDBAccountCreateMode? createMode = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, CosmosDBAccountRestoreParameters restoreParameters = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null, ManagedServiceIdentity identity = null) + public static CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CosmosDBAccountKind? kind = null, ConsistencyPolicy consistencyPolicy = null, IEnumerable locations = null, CosmosDBAccountOfferType databaseAccountOfferType = default, IEnumerable ipRules = null, bool? isVirtualNetworkFilterEnabled = null, bool? enableAutomaticFailover = null, IEnumerable capabilities = null, IEnumerable virtualNetworkRules = null, bool? enableMultipleWriteLocations = null, bool? enableCassandraConnector = null, ConnectorOffer? connectorOffer = null, bool? disableKeyBasedMetadataWriteAccess = null, Uri keyVaultKeyUri = null, string defaultIdentity = null, CosmosDBPublicNetworkAccess? publicNetworkAccess = null, bool? isFreeTierEnabled = null, CosmosDBServerVersion? apiServerVersion = null, bool? isAnalyticalStorageEnabled = null, AnalyticalStorageSchemaType? analyticalStorageSchemaType = null, CosmosDBAccountCreateMode? createMode = null, CosmosDBAccountBackupPolicy backupPolicy = null, IEnumerable cors = null, NetworkAclBypass? networkAclBypass = null, IEnumerable networkAclBypassResourceIds = null, EnableFullTextQuery? diagnosticLogEnableFullTextQuery = null, bool? disableLocalAuth = null, CosmosDBAccountRestoreParameters restoreParameters = null, int? capacityTotalThroughputLimit = null, bool? enableMaterializedViews = null, DatabaseAccountKeysMetadata keysMetadata = null, bool? enablePartitionMerge = null, bool? enableBurstCapacity = null, CosmosDBMinimalTlsVersion? minimalTlsVersion = null, CustomerManagedKeyStatus? customerManagedKeyStatus = null, bool? enablePriorityBasedExecution = null, DefaultPriorityLevel? defaultPriorityLevel = null, ManagedServiceIdentity identity = null) { tags ??= new Dictionary(); locations ??= new List(); @@ -206,7 +212,7 @@ public static CosmosDBAccountCreateOrUpdateContent CosmosDBAccountCreateOrUpdate cors ??= new List(); networkAclBypassResourceIds ??= new List(); - return new CosmosDBAccountCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, kind, consistencyPolicy, locations?.ToList(), databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, capabilities?.ToList(), virtualNetworkRules?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, createMode, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, restoreParameters, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, identity); + return new CosmosDBAccountCreateOrUpdateContent(id, name, resourceType, systemData, tags, location, kind, consistencyPolicy, locations?.ToList(), databaseAccountOfferType, ipRules?.ToList(), isVirtualNetworkFilterEnabled, enableAutomaticFailover, capabilities?.ToList(), virtualNetworkRules?.ToList(), enableMultipleWriteLocations, enableCassandraConnector, connectorOffer, disableKeyBasedMetadataWriteAccess, keyVaultKeyUri, defaultIdentity, publicNetworkAccess, isFreeTierEnabled, apiServerVersion != null ? new ApiProperties(apiServerVersion) : null, isAnalyticalStorageEnabled, analyticalStorageSchemaType != null ? new AnalyticalStorageConfiguration(analyticalStorageSchemaType) : null, createMode, backupPolicy, cors?.ToList(), networkAclBypass, networkAclBypassResourceIds?.ToList(), diagnosticLogEnableFullTextQuery != null ? new DiagnosticLogSettings(diagnosticLogEnableFullTextQuery) : null, disableLocalAuth, restoreParameters, capacityTotalThroughputLimit != null ? new CosmosDBAccountCapacity(capacityTotalThroughputLimit) : null, enableMaterializedViews, keysMetadata, enablePartitionMerge, enableBurstCapacity, minimalTlsVersion, customerManagedKeyStatus, enablePriorityBasedExecution, defaultPriorityLevel, identity); } /// Initializes a new instance of CosmosDBAccountKeyList. @@ -496,13 +502,15 @@ public static ThroughputSettingData ThroughputSettingData(ResourceIdentifier id /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. + /// The offer throughput value to instantly scale up without triggering splits. + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. /// A new instance for mocking. - public static ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string rid = null, float? timestamp = null, ETag? etag = null) + public static ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string instantMaximumThroughput = null, string softAllowedMaximumThroughput = null, string rid = null, float? timestamp = null, ETag? etag = null) { - return new ExtendedThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, rid, timestamp, etag); + return new ExtendedThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, instantMaximumThroughput, softAllowedMaximumThroughput, rid, timestamp, etag); } /// Initializes a new instance of ThroughputSettingsResourceInfo. @@ -510,10 +518,12 @@ public static ExtendedThroughputSettingsResourceInfo ExtendedThroughputSettingsR /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. + /// The offer throughput value to instantly scale up without triggering splits. + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. /// A new instance for mocking. - public static ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null) + public static ThroughputSettingsResourceInfo ThroughputSettingsResourceInfo(int? throughput = null, AutoscaleSettingsResourceInfo autoscaleSettings = null, string minimumThroughput = null, string offerReplacePending = null, string instantMaximumThroughput = null, string softAllowedMaximumThroughput = null) { - return new ThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending); + return new ThroughputSettingsResourceInfo(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, instantMaximumThroughput, softAllowedMaximumThroughput); } /// Initializes a new instance of AutoscaleSettingsResourceInfo. @@ -1412,17 +1422,22 @@ public static CassandraClusterData CassandraClusterData(ResourceIdentifier id = /// (Deprecated) Number of hours to wait between taking a backup of the cluster. /// Whether the cluster and associated data centers has been deallocated. /// Whether Cassandra audit logging is enabled. + /// Type of the cluster. If set to Production, some operations might not be permitted on cluster. /// Error related to resource provisioning. + /// Extensions to be added or updated on cluster. + /// List of backup schedules that define when you want to back up your data. /// A new instance for mocking. - public static CassandraClusterProperties CassandraClusterProperties(CassandraProvisioningState? provisioningState = null, string restoreFromBackupId = null, ResourceIdentifier delegatedManagementSubnetId = null, string cassandraVersion = null, string clusterNameOverride = null, CassandraAuthenticationMethod? authenticationMethod = null, string initialCassandraAdminPassword = null, string prometheusEndpointIPAddress = null, bool? isRepairEnabled = null, IEnumerable clientCertificates = null, IEnumerable externalGossipCertificates = null, IEnumerable gossipCertificates = null, IEnumerable externalSeedNodes = null, IEnumerable seedNodes = null, int? hoursBetweenBackups = null, bool? isDeallocated = null, bool? isCassandraAuditLoggingEnabled = null, CassandraError provisionError = null) + public static CassandraClusterProperties CassandraClusterProperties(CassandraProvisioningState? provisioningState = null, string restoreFromBackupId = null, ResourceIdentifier delegatedManagementSubnetId = null, string cassandraVersion = null, string clusterNameOverride = null, CassandraAuthenticationMethod? authenticationMethod = null, string initialCassandraAdminPassword = null, string prometheusEndpointIPAddress = null, bool? isRepairEnabled = null, IEnumerable clientCertificates = null, IEnumerable externalGossipCertificates = null, IEnumerable gossipCertificates = null, IEnumerable externalSeedNodes = null, IEnumerable seedNodes = null, int? hoursBetweenBackups = null, bool? isDeallocated = null, bool? isCassandraAuditLoggingEnabled = null, CassandraClusterType? clusterType = null, CassandraError provisionError = null, IEnumerable extensions = null, IEnumerable backupSchedules = null) { clientCertificates ??= new List(); externalGossipCertificates ??= new List(); gossipCertificates ??= new List(); externalSeedNodes ??= new List(); seedNodes ??= new List(); + extensions ??= new List(); + backupSchedules ??= new List(); - return new CassandraClusterProperties(provisioningState, restoreFromBackupId, delegatedManagementSubnetId, cassandraVersion, clusterNameOverride, authenticationMethod, initialCassandraAdminPassword, prometheusEndpointIPAddress != null ? new CassandraDataCenterSeedNode(prometheusEndpointIPAddress) : null, isRepairEnabled, clientCertificates?.ToList(), externalGossipCertificates?.ToList(), gossipCertificates?.ToList(), externalSeedNodes?.ToList(), seedNodes?.ToList(), hoursBetweenBackups, isDeallocated, isCassandraAuditLoggingEnabled, provisionError); + return new CassandraClusterProperties(provisioningState, restoreFromBackupId, delegatedManagementSubnetId, cassandraVersion, clusterNameOverride, authenticationMethod, initialCassandraAdminPassword, prometheusEndpointIPAddress != null ? new CassandraDataCenterSeedNode(prometheusEndpointIPAddress) : null, isRepairEnabled, clientCertificates?.ToList(), externalGossipCertificates?.ToList(), gossipCertificates?.ToList(), externalSeedNodes?.ToList(), seedNodes?.ToList(), hoursBetweenBackups, isDeallocated, isCassandraAuditLoggingEnabled, clusterType, provisionError, extensions?.ToList(), backupSchedules?.ToList()); } /// Initializes a new instance of CassandraCommandOutput. @@ -1433,16 +1448,16 @@ public static CassandraCommandOutput CassandraCommandOutput(string commandOutput return new CassandraCommandOutput(commandOutput); } - /// Initializes a new instance of CassandraClusterBackupResourceData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// - /// A new instance for mocking. - public static CassandraClusterBackupResourceData CassandraClusterBackupResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? backupResourceTimestamp = null) + /// Initializes a new instance of CassandraClusterBackupResourceInfo. + /// The unique identifier of backup. + /// The current state of the backup. + /// The time at which the backup process begins. + /// The time at which the backup process ends. + /// The time at which the backup will expire. + /// A new instance for mocking. + public static CassandraClusterBackupResourceInfo CassandraClusterBackupResourceInfo(string backupId = null, CassandraClusterBackupState? backupState = null, DateTimeOffset? backupStartTimestamp = null, DateTimeOffset? backupStopTimestamp = null, DateTimeOffset? backupExpiryTimestamp = null) { - return new CassandraClusterBackupResourceData(id, name, resourceType, systemData, backupResourceTimestamp != null ? new BackupResourceProperties(backupResourceTimestamp) : null); + return new CassandraClusterBackupResourceInfo(backupId, backupState, backupStartTimestamp, backupStopTimestamp, backupExpiryTimestamp); } /// Initializes a new instance of CassandraDataCenterData. @@ -1553,12 +1568,13 @@ public static CassandraClusterPublicStatusDataCentersItem CassandraClusterPublic /// Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. /// Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. /// A float representing the current system-wide CPU utilization as a percentage. + /// If node has been updated to latest model. /// A new instance for mocking. - public static CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeItem(string address = null, CassandraNodeState? state = null, string status = null, string cassandraProcessStatus = null, string load = null, IEnumerable tokens = null, int? size = null, Guid? hostId = null, string rack = null, string timestamp = null, long? diskUsedKB = null, long? diskFreeKB = null, long? memoryUsedKB = null, long? memoryBuffersAndCachedKB = null, long? memoryFreeKB = null, long? memoryTotalKB = null, double? cpuUsage = null) + public static CassandraClusterDataCenterNodeItem CassandraClusterDataCenterNodeItem(string address = null, CassandraNodeState? state = null, string status = null, string cassandraProcessStatus = null, string load = null, IEnumerable tokens = null, int? size = null, Guid? hostId = null, string rack = null, string timestamp = null, long? diskUsedKB = null, long? diskFreeKB = null, long? memoryUsedKB = null, long? memoryBuffersAndCachedKB = null, long? memoryFreeKB = null, long? memoryTotalKB = null, double? cpuUsage = null, bool? isLatestModel = null) { tokens ??= new List(); - return new CassandraClusterDataCenterNodeItem(address, state, status, cassandraProcessStatus, load, tokens?.ToList(), size, hostId, rack, timestamp, diskUsedKB, diskFreeKB, memoryUsedKB, memoryBuffersAndCachedKB, memoryFreeKB, memoryTotalKB, cpuUsage); + return new CassandraClusterDataCenterNodeItem(address, state, status, cassandraProcessStatus, load, tokens?.ToList(), size, hostId, rack, timestamp, diskUsedKB, diskFreeKB, memoryUsedKB, memoryBuffersAndCachedKB, memoryFreeKB, memoryTotalKB, cpuUsage, isLatestModel); } /// Initializes a new instance of MongoClusterData. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResource.cs deleted file mode 100644 index 61e4c289ee160..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResource.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CosmosDB -{ - /// - /// A Class representing a CassandraClusterBackupResource along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetCassandraClusterBackupResource method. - /// Otherwise you can get one from its parent resource using the GetCassandraClusterBackupResource method. - /// - public partial class CassandraClusterBackupResource : ArmResource - { - /// Generate the resource identifier of a instance. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string backupId) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _cassandraClusterBackupResourceCassandraClustersClientDiagnostics; - private readonly CassandraClustersRestOperations _cassandraClusterBackupResourceCassandraClustersRestClient; - private readonly CassandraClusterBackupResourceData _data; - - /// Initializes a new instance of the class for mocking. - protected CassandraClusterBackupResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal CassandraClusterBackupResource(ArmClient client, CassandraClusterBackupResourceData 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 CassandraClusterBackupResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _cassandraClusterBackupResourceCassandraClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CosmosDB", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string cassandraClusterBackupResourceCassandraClustersApiVersion); - _cassandraClusterBackupResourceCassandraClustersRestClient = new CassandraClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, cassandraClusterBackupResourceCassandraClustersApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.DocumentDB/cassandraClusters/backups"; - - /// 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 CassandraClusterBackupResourceData 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 the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResource.Get"); - scope.Start(); - try - { - var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResource.Get"); - scope.Start(); - try - { - var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs deleted file mode 100644 index 0cfe82b9ba77d..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceCollection.cs +++ /dev/null @@ -1,331 +0,0 @@ -// 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 Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CosmosDB -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetCassandraClusterBackupResources method from an instance of . - /// - public partial class CassandraClusterBackupResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _cassandraClusterBackupResourceCassandraClustersClientDiagnostics; - private readonly CassandraClustersRestOperations _cassandraClusterBackupResourceCassandraClustersRestClient; - - /// Initializes a new instance of the class for mocking. - protected CassandraClusterBackupResourceCollection() - { - } - - /// 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 CassandraClusterBackupResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _cassandraClusterBackupResourceCassandraClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CosmosDB", CassandraClusterBackupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(CassandraClusterBackupResource.ResourceType, out string cassandraClusterBackupResourceCassandraClustersApiVersion); - _cassandraClusterBackupResourceCassandraClustersRestClient = new CassandraClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, cassandraClusterBackupResourceCassandraClustersApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != CassandraClusterResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, CassandraClusterResource.ResourceType), nameof(id)); - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.Get"); - scope.Start(); - try - { - var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.Get"); - scope.Start(); - try - { - var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List the backups of this cluster that are available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups - /// - /// - /// Operation Id - /// CassandraClusters_ListBackups - /// - /// - /// - /// 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) => _cassandraClusterBackupResourceCassandraClustersRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraClusterBackupResource(Client, CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(e)), _cassandraClusterBackupResourceCassandraClustersClientDiagnostics, Pipeline, "CassandraClusterBackupResourceCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// List the backups of this cluster that are available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups - /// - /// - /// Operation Id - /// CassandraClusters_ListBackups - /// - /// - /// - /// 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) => _cassandraClusterBackupResourceCassandraClustersRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraClusterBackupResource(Client, CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(e)), _cassandraClusterBackupResourceCassandraClustersClientDiagnostics, Pipeline, "CassandraClusterBackupResourceCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.Exists"); - scope.Start(); - try - { - var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, 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.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.Exists"); - scope.Start(); - try - { - var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string backupId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); - - using var scope = _cassandraClusterBackupResourceCassandraClustersClientDiagnostics.CreateScope("CassandraClusterBackupResourceCollection.GetIfExists"); - scope.Start(); - try - { - var response = _cassandraClusterBackupResourceCassandraClustersRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new CassandraClusterBackupResource(Client, response.Value), 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs deleted file mode 100644 index 34396aff9db21..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterBackupResourceData.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; -using Azure.ResourceManager.CosmosDB.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.CosmosDB -{ - /// - /// A class representing the CassandraClusterBackupResource data model. - /// A restorable backup of a Cassandra cluster. - /// - public partial class CassandraClusterBackupResourceData : ResourceData - { - /// Initializes a new instance of CassandraClusterBackupResourceData. - public CassandraClusterBackupResourceData() - { - } - - /// Initializes a new instance of CassandraClusterBackupResourceData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// - internal CassandraClusterBackupResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BackupResourceProperties properties) : base(id, name, resourceType, systemData) - { - Properties = properties; - } - - /// Gets or sets the properties. - internal BackupResourceProperties Properties { get; set; } - /// The time this backup was taken, formatted like 2021-01-21T17:35:21. - public DateTimeOffset? BackupResourceTimestamp - { - get => Properties is null ? default : Properties.Timestamp; - set - { - if (Properties is null) - Properties = new BackupResourceProperties(); - Properties.Timestamp = value; - } - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs index 3c08d622e83c8..001ec8abb2f66 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs @@ -10,6 +10,7 @@ using System.Globalization; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure; using Azure.Core; using Azure.Core.Pipeline; @@ -28,6 +29,9 @@ namespace Azure.ResourceManager.CosmosDB public partial class CassandraClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}"; @@ -89,64 +93,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of CassandraClusterBackupResources in the CassandraCluster. - /// An object representing collection of CassandraClusterBackupResources and their operations over a CassandraClusterBackupResource. - public virtual CassandraClusterBackupResourceCollection GetCassandraClusterBackupResources() - { - return GetCachedClient(Client => new CassandraClusterBackupResourceCollection(Client, Id)); - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public virtual async Task> GetCassandraClusterBackupResourceAsync(string backupId, CancellationToken cancellationToken = default) - { - return await GetCassandraClusterBackupResources().GetAsync(backupId, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the properties of an individual backup of this cluster that is available to restore. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} - /// - /// - /// Operation Id - /// CassandraClusters_GetBackup - /// - /// - /// - /// Id of a restorable backup of a Cassandra cluster. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public virtual Response GetCassandraClusterBackupResource(string backupId, CancellationToken cancellationToken = default) - { - return GetCassandraClusterBackupResources().Get(backupId, cancellationToken); - } - /// Gets a collection of CassandraDataCenterResources in the CassandraCluster. /// An object representing collection of CassandraDataCenterResources and their operations over a CassandraDataCenterResource. public virtual CassandraDataCenterCollection GetCassandraDataCenters() { - return GetCachedClient(Client => new CassandraDataCenterCollection(Client, Id)); + return GetCachedClient(client => new CassandraDataCenterCollection(client, Id)); } /// @@ -164,8 +115,8 @@ public virtual CassandraDataCenterCollection GetCassandraDataCenters() /// /// Data center name in a managed Cassandra cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCassandraDataCenterAsync(string dataCenterName, CancellationToken cancellationToken = default) { @@ -187,8 +138,8 @@ public virtual async Task> GetCassandraDat /// /// Data center name in a managed Cassandra cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCassandraDataCenter(string dataCenterName, CancellationToken cancellationToken = default) { @@ -479,6 +430,118 @@ public virtual ArmOperation InvokeCommand(WaitUntil wait } } + /// + /// List the backups of this cluster that are available to restore. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups + /// + /// + /// Operation Id + /// CassandraClusters_ListBackups + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBackupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo, _cassandraClusterClientDiagnostics, Pipeline, "CassandraClusterResource.GetBackups", "value", null, cancellationToken); + } + + /// + /// List the backups of this cluster that are available to restore. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups + /// + /// + /// Operation Id + /// CassandraClusters_ListBackups + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBackups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _cassandraClusterRestClient.CreateListBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo, _cassandraClusterClientDiagnostics, Pipeline, "CassandraClusterResource.GetBackups", "value", null, cancellationToken); + } + + /// + /// Get the properties of an individual backup of this cluster that is available to restore. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} + /// + /// + /// Operation Id + /// CassandraClusters_GetBackup + /// + /// + /// + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetBackupAsync(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterResource.GetBackup"); + scope.Start(); + try + { + var response = await _cassandraClusterRestClient.GetBackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the properties of an individual backup of this cluster that is available to restore. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId} + /// + /// + /// Operation Id + /// CassandraClusters_GetBackup + /// + /// + /// + /// Id of a restorable backup of a Cassandra cluster. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetBackup(string backupId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupId, nameof(backupId)); + + using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterResource.GetBackup"); + scope.Start(); + try + { + var response = _cassandraClusterRestClient.GetBackup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated cluster. Use Start to restart the cluster. /// @@ -493,15 +556,16 @@ public virtual ArmOperation InvokeCommand(WaitUntil wait /// /// /// 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. + /// Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might cause data loss. /// The cancellation token to use. - public virtual async Task DeallocateAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeallocateAsync(WaitUntil waitUntil, bool? xMsForceDeallocate = null, CancellationToken cancellationToken = default) { using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterResource.Deallocate"); scope.Start(); try { - var response = await _cassandraClusterRestClient.DeallocateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new CosmosDBArmOperation(_cassandraClusterClientDiagnostics, Pipeline, _cassandraClusterRestClient.CreateDeallocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _cassandraClusterRestClient.DeallocateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsForceDeallocate, cancellationToken).ConfigureAwait(false); + var operation = new CosmosDBArmOperation(_cassandraClusterClientDiagnostics, Pipeline, _cassandraClusterRestClient.CreateDeallocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsForceDeallocate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -527,15 +591,16 @@ public virtual async Task DeallocateAsync(WaitUntil waitUntil, Can /// /// /// 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. + /// Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might cause data loss. /// The cancellation token to use. - public virtual ArmOperation Deallocate(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Deallocate(WaitUntil waitUntil, bool? xMsForceDeallocate = null, CancellationToken cancellationToken = default) { using var scope = _cassandraClusterClientDiagnostics.CreateScope("CassandraClusterResource.Deallocate"); scope.Start(); try { - var response = _cassandraClusterRestClient.Deallocate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new CosmosDBArmOperation(_cassandraClusterClientDiagnostics, Pipeline, _cassandraClusterRestClient.CreateDeallocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _cassandraClusterRestClient.Deallocate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsForceDeallocate, cancellationToken); + var operation = new CosmosDBArmOperation(_cassandraClusterClientDiagnostics, Pipeline, _cassandraClusterRestClient.CreateDeallocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, xMsForceDeallocate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterResource.cs index 5ead3a6c7f68a..a7738ea34d370 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraDataCenterResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CassandraDataCenterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The dataCenterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string dataCenterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceResource.cs index c21c4e04cd1db..d22cb04fdf661 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CassandraKeyspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The keyspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string keyspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}"; @@ -99,7 +103,7 @@ public virtual CassandraKeyspaceThroughputSettingResource GetCassandraKeyspaceTh /// An object representing collection of CassandraTableResources and their operations over a CassandraTableResource. public virtual CassandraTableCollection GetCassandraTables() { - return GetCachedClient(Client => new CassandraTableCollection(Client, Id)); + return GetCachedClient(client => new CassandraTableCollection(client, Id)); } /// @@ -117,8 +121,8 @@ public virtual CassandraTableCollection GetCassandraTables() /// /// Cosmos DB table name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCassandraTableAsync(string tableName, CancellationToken cancellationToken = default) { @@ -140,8 +144,8 @@ public virtual async Task> GetCassandraTableAsy /// /// Cosmos DB table name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCassandraTable(string tableName, CancellationToken cancellationToken = default) { @@ -152,7 +156,7 @@ public virtual Response GetCassandraTable(string tableNa /// An object representing collection of CassandraViewGetResultResources and their operations over a CassandraViewGetResultResource. public virtual CassandraViewGetResultCollection GetCassandraViewGetResults() { - return GetCachedClient(Client => new CassandraViewGetResultCollection(Client, Id)); + return GetCachedClient(client => new CassandraViewGetResultCollection(client, Id)); } /// @@ -170,8 +174,8 @@ public virtual CassandraViewGetResultCollection GetCassandraViewGetResults() /// /// Cosmos DB view name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCassandraViewGetResultAsync(string viewName, CancellationToken cancellationToken = default) { @@ -193,8 +197,8 @@ public virtual async Task> GetCassandra /// /// Cosmos DB view name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCassandraViewGetResult(string viewName, CancellationToken cancellationToken = default) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceThroughputSettingResource.cs index 8eb63d0029a8c..e116a78aa1200 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceThroughputSettingResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CassandraKeyspaceThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The keyspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string keyspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableResource.cs index c2b5361071409..36e677086ec06 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class CassandraTableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The keyspaceName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string keyspaceName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableThroughputSettingResource.cs index 48996ecf4718f..41a40baa4c92f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraTableThroughputSettingResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class CassandraTableThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The keyspaceName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string keyspaceName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultResource.cs index 0ef04bef6d4cf..df3b452895328 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewGetResultResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class CassandraViewGetResultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The keyspaceName. + /// The viewName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string keyspaceName, string viewName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewThroughputSettingResource.cs index 2c76ac6c9b481..8ab7591680997 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraViewThroughputSettingResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class CassandraViewThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The keyspaceName. + /// The viewName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string keyspaceName, string viewName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs index 3172aa3a75dc9..80edae54484dd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs @@ -87,8 +87,11 @@ public CosmosDBAccountData(AzureLocation location) : base(location) /// Flag to indicate enabling/disabling of Partition Merge feature on the account. /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + /// Enum to indicate default Priority Level of request for Priority Based Execution. /// Identity for the resource. - internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, string provisioningState, string documentEndpoint, CosmosDBAccountOfferType? databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, Guid? instanceId, CosmosDBAccountCreateMode? createMode, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, string provisioningState, string documentEndpoint, CosmosDBAccountOfferType? databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, ConsistencyPolicy consistencyPolicy, IList capabilities, IReadOnlyList writeLocations, IReadOnlyList readLocations, IReadOnlyList locations, IReadOnlyList failoverPolicies, IList virtualNetworkRules, IReadOnlyList privateEndpointConnections, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, Guid? instanceId, CosmosDBAccountCreateMode? createMode, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, CustomerManagedKeyStatus? customerManagedKeyStatus, bool? enablePriorityBasedExecution, DefaultPriorityLevel? defaultPriorityLevel, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; ProvisioningState = provisioningState; @@ -131,6 +134,9 @@ internal CosmosDBAccountData(ResourceIdentifier id, string name, ResourceType re EnablePartitionMerge = enablePartitionMerge; EnableBurstCapacity = enableBurstCapacity; MinimalTlsVersion = minimalTlsVersion; + CustomerManagedKeyStatus = customerManagedKeyStatus; + EnablePriorityBasedExecution = enablePriorityBasedExecution; + DefaultPriorityLevel = defaultPriorityLevel; Identity = identity; } @@ -268,6 +274,12 @@ public int? CapacityTotalThroughputLimit public bool? EnableBurstCapacity { get; set; } /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. public CosmosDBMinimalTlsVersion? MinimalTlsVersion { get; set; } + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + public CustomerManagedKeyStatus? CustomerManagedKeyStatus { get; set; } + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + public bool? EnablePriorityBasedExecution { get; set; } + /// Enum to indicate default Priority Level of request for Priority Based Execution. + public DefaultPriorityLevel? DefaultPriorityLevel { get; set; } /// Identity for the resource. public ManagedServiceIdentity Identity { get; set; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs index 3a1688bc2bb53..f8c92f5dfbb37 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}"; @@ -138,7 +141,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GraphResourceGetResultResources and their operations over a GraphResourceGetResultResource. public virtual GraphResourceGetResultCollection GetGraphResourceGetResults() { - return GetCachedClient(Client => new GraphResourceGetResultCollection(Client, Id)); + return GetCachedClient(client => new GraphResourceGetResultCollection(client, Id)); } /// @@ -156,8 +159,8 @@ public virtual GraphResourceGetResultCollection GetGraphResourceGetResults() /// /// Cosmos DB graph resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGraphResourceGetResultAsync(string graphName, CancellationToken cancellationToken = default) { @@ -179,8 +182,8 @@ public virtual async Task> GetGraphReso /// /// Cosmos DB graph resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGraphResourceGetResult(string graphName, CancellationToken cancellationToken = default) { @@ -191,7 +194,7 @@ public virtual Response GetGraphResourceGetResul /// An object representing collection of CosmosDBSqlDatabaseResources and their operations over a CosmosDBSqlDatabaseResource. public virtual CosmosDBSqlDatabaseCollection GetCosmosDBSqlDatabases() { - return GetCachedClient(Client => new CosmosDBSqlDatabaseCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBSqlDatabaseCollection(client, Id)); } /// @@ -209,8 +212,8 @@ public virtual CosmosDBSqlDatabaseCollection GetCosmosDBSqlDatabases() /// /// Cosmos DB database name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBSqlDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -232,8 +235,8 @@ public virtual async Task> GetCosmosDBSqlD /// /// Cosmos DB database name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBSqlDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -244,7 +247,7 @@ public virtual Response GetCosmosDBSqlDatabase(stri /// An object representing collection of CosmosDBSqlRoleDefinitionResources and their operations over a CosmosDBSqlRoleDefinitionResource. public virtual CosmosDBSqlRoleDefinitionCollection GetCosmosDBSqlRoleDefinitions() { - return GetCachedClient(Client => new CosmosDBSqlRoleDefinitionCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBSqlRoleDefinitionCollection(client, Id)); } /// @@ -262,8 +265,8 @@ public virtual CosmosDBSqlRoleDefinitionCollection GetCosmosDBSqlRoleDefinitions /// /// The GUID for the Role Definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBSqlRoleDefinitionAsync(string roleDefinitionId, CancellationToken cancellationToken = default) { @@ -285,8 +288,8 @@ public virtual async Task> GetCosmos /// /// The GUID for the Role Definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBSqlRoleDefinition(string roleDefinitionId, CancellationToken cancellationToken = default) { @@ -297,7 +300,7 @@ public virtual Response GetCosmosDBSqlRoleDef /// An object representing collection of CosmosDBSqlRoleAssignmentResources and their operations over a CosmosDBSqlRoleAssignmentResource. public virtual CosmosDBSqlRoleAssignmentCollection GetCosmosDBSqlRoleAssignments() { - return GetCachedClient(Client => new CosmosDBSqlRoleAssignmentCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBSqlRoleAssignmentCollection(client, Id)); } /// @@ -315,8 +318,8 @@ public virtual CosmosDBSqlRoleAssignmentCollection GetCosmosDBSqlRoleAssignments /// /// The GUID for the Role Assignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBSqlRoleAssignmentAsync(string roleAssignmentId, CancellationToken cancellationToken = default) { @@ -338,8 +341,8 @@ public virtual async Task> GetCosmos /// /// The GUID for the Role Assignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBSqlRoleAssignment(string roleAssignmentId, CancellationToken cancellationToken = default) { @@ -350,7 +353,7 @@ public virtual Response GetCosmosDBSqlRoleAss /// An object representing collection of MongoDBDatabaseResources and their operations over a MongoDBDatabaseResource. public virtual MongoDBDatabaseCollection GetMongoDBDatabases() { - return GetCachedClient(Client => new MongoDBDatabaseCollection(Client, Id)); + return GetCachedClient(client => new MongoDBDatabaseCollection(client, Id)); } /// @@ -368,8 +371,8 @@ public virtual MongoDBDatabaseCollection GetMongoDBDatabases() /// /// Cosmos DB database name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMongoDBDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -391,8 +394,8 @@ public virtual async Task> GetMongoDBDatabaseA /// /// Cosmos DB database name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMongoDBDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -403,7 +406,7 @@ public virtual Response GetMongoDBDatabase(string datab /// An object representing collection of MongoDBRoleDefinitionResources and their operations over a MongoDBRoleDefinitionResource. public virtual MongoDBRoleDefinitionCollection GetMongoDBRoleDefinitions() { - return GetCachedClient(Client => new MongoDBRoleDefinitionCollection(Client, Id)); + return GetCachedClient(client => new MongoDBRoleDefinitionCollection(client, Id)); } /// @@ -421,8 +424,8 @@ public virtual MongoDBRoleDefinitionCollection GetMongoDBRoleDefinitions() /// /// The ID for the Role Definition {dbName.roleName}. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMongoDBRoleDefinitionAsync(string mongoRoleDefinitionId, CancellationToken cancellationToken = default) { @@ -444,8 +447,8 @@ public virtual async Task> GetMongoDBRol /// /// The ID for the Role Definition {dbName.roleName}. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMongoDBRoleDefinition(string mongoRoleDefinitionId, CancellationToken cancellationToken = default) { @@ -456,7 +459,7 @@ public virtual Response GetMongoDBRoleDefinition( /// An object representing collection of MongoDBUserDefinitionResources and their operations over a MongoDBUserDefinitionResource. public virtual MongoDBUserDefinitionCollection GetMongoDBUserDefinitions() { - return GetCachedClient(Client => new MongoDBUserDefinitionCollection(Client, Id)); + return GetCachedClient(client => new MongoDBUserDefinitionCollection(client, Id)); } /// @@ -474,8 +477,8 @@ public virtual MongoDBUserDefinitionCollection GetMongoDBUserDefinitions() /// /// The ID for the User Definition {dbName.userName}. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMongoDBUserDefinitionAsync(string mongoUserDefinitionId, CancellationToken cancellationToken = default) { @@ -497,8 +500,8 @@ public virtual async Task> GetMongoDBUse /// /// The ID for the User Definition {dbName.userName}. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMongoDBUserDefinition(string mongoUserDefinitionId, CancellationToken cancellationToken = default) { @@ -509,7 +512,7 @@ public virtual Response GetMongoDBUserDefinition( /// An object representing collection of CosmosDBTableResources and their operations over a CosmosDBTableResource. public virtual CosmosDBTableCollection GetCosmosDBTables() { - return GetCachedClient(Client => new CosmosDBTableCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBTableCollection(client, Id)); } /// @@ -527,8 +530,8 @@ public virtual CosmosDBTableCollection GetCosmosDBTables() /// /// Cosmos DB table name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBTableAsync(string tableName, CancellationToken cancellationToken = default) { @@ -550,8 +553,8 @@ public virtual async Task> GetCosmosDBTableAsync /// /// Cosmos DB table name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBTable(string tableName, CancellationToken cancellationToken = default) { @@ -562,7 +565,7 @@ public virtual Response GetCosmosDBTable(string tableName /// An object representing collection of CassandraKeyspaceResources and their operations over a CassandraKeyspaceResource. public virtual CassandraKeyspaceCollection GetCassandraKeyspaces() { - return GetCachedClient(Client => new CassandraKeyspaceCollection(Client, Id)); + return GetCachedClient(client => new CassandraKeyspaceCollection(client, Id)); } /// @@ -580,8 +583,8 @@ public virtual CassandraKeyspaceCollection GetCassandraKeyspaces() /// /// Cosmos DB keyspace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCassandraKeyspaceAsync(string keyspaceName, CancellationToken cancellationToken = default) { @@ -603,8 +606,8 @@ public virtual async Task> GetCassandraKeysp /// /// Cosmos DB keyspace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCassandraKeyspace(string keyspaceName, CancellationToken cancellationToken = default) { @@ -615,7 +618,7 @@ public virtual Response GetCassandraKeyspace(string k /// An object representing collection of GremlinDatabaseResources and their operations over a GremlinDatabaseResource. public virtual GremlinDatabaseCollection GetGremlinDatabases() { - return GetCachedClient(Client => new GremlinDatabaseCollection(Client, Id)); + return GetCachedClient(client => new GremlinDatabaseCollection(client, Id)); } /// @@ -633,8 +636,8 @@ public virtual GremlinDatabaseCollection GetGremlinDatabases() /// /// Cosmos DB database name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGremlinDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -656,8 +659,8 @@ public virtual async Task> GetGremlinDatabaseA /// /// Cosmos DB database name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGremlinDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -668,7 +671,7 @@ public virtual Response GetGremlinDatabase(string datab /// An object representing collection of DataTransferJobGetResultResources and their operations over a DataTransferJobGetResultResource. public virtual DataTransferJobGetResultCollection GetDataTransferJobGetResults() { - return GetCachedClient(Client => new DataTransferJobGetResultCollection(Client, Id)); + return GetCachedClient(client => new DataTransferJobGetResultCollection(client, Id)); } /// @@ -686,8 +689,8 @@ public virtual DataTransferJobGetResultCollection GetDataTransferJobGetResults() /// /// Name of the Data Transfer Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataTransferJobGetResultAsync(string jobName, CancellationToken cancellationToken = default) { @@ -709,8 +712,8 @@ public virtual async Task> GetDataTra /// /// Name of the Data Transfer Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataTransferJobGetResult(string jobName, CancellationToken cancellationToken = default) { @@ -721,7 +724,7 @@ public virtual Response GetDataTransferJobGetR /// An object representing collection of CosmosDBPrivateEndpointConnectionResources and their operations over a CosmosDBPrivateEndpointConnectionResource. public virtual CosmosDBPrivateEndpointConnectionCollection GetCosmosDBPrivateEndpointConnections() { - return GetCachedClient(Client => new CosmosDBPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBPrivateEndpointConnectionCollection(client, Id)); } /// @@ -739,8 +742,8 @@ public virtual CosmosDBPrivateEndpointConnectionCollection GetCosmosDBPrivateEnd /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -762,8 +765,8 @@ public virtual async Task> G /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -774,7 +777,7 @@ public virtual Response GetCosmosDBPr /// An object representing collection of CosmosDBPrivateLinkResources and their operations over a CosmosDBPrivateLinkResource. public virtual CosmosDBPrivateLinkResourceCollection GetCosmosDBPrivateLinkResources() { - return GetCachedClient(Client => new CosmosDBPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBPrivateLinkResourceCollection(client, Id)); } /// @@ -792,8 +795,8 @@ public virtual CosmosDBPrivateLinkResourceCollection GetCosmosDBPrivateLinkResou /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBPrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -815,8 +818,8 @@ public virtual async Task> GetCosmosDBPriv /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBPrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -827,7 +830,7 @@ public virtual Response GetCosmosDBPrivateLinkResou /// An object representing collection of CosmosDBServiceResources and their operations over a CosmosDBServiceResource. public virtual CosmosDBServiceCollection GetCosmosDBServices() { - return GetCachedClient(Client => new CosmosDBServiceCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBServiceCollection(client, Id)); } /// @@ -845,8 +848,8 @@ public virtual CosmosDBServiceCollection GetCosmosDBServices() /// /// Cosmos DB service name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBServiceAsync(string serviceName, CancellationToken cancellationToken = default) { @@ -868,8 +871,8 @@ public virtual async Task> GetCosmosDBServiceA /// /// Cosmos DB service name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBService(string serviceName, CancellationToken cancellationToken = default) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleResource.cs index 1066bd1d37b73..41dbcba229269 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mongoClusterName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mongoClusterName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationResource.cs index 7dd363e107a0a..e6672fa487e48 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBLocationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}"; @@ -96,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RestorableCosmosDBAccountResources and their operations over a RestorableCosmosDBAccountResource. public virtual RestorableCosmosDBAccountCollection GetRestorableCosmosDBAccounts() { - return GetCachedClient(Client => new RestorableCosmosDBAccountCollection(Client, Id)); + return GetCachedClient(client => new RestorableCosmosDBAccountCollection(client, Id)); } /// diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionResource.cs index 4c98b11d5f879..610e4632eeddc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResource.cs index 33835f1292bb0..9e43570cbdffc 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceResource.cs index 671e4319a7af2..1358b26046a5b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBServiceResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyResource.cs index 95fada6e4e33b..09bc774b55768 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlClientEncryptionKeyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlClientEncryptionKeyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The clientEncryptionKeyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string clientEncryptionKeyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerResource.cs index 9f0adfe240220..b1c07c2cf375b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The containerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string containerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}"; @@ -99,7 +104,7 @@ public virtual CosmosDBSqlContainerThroughputSettingResource GetCosmosDBSqlConta /// An object representing collection of CosmosDBSqlStoredProcedureResources and their operations over a CosmosDBSqlStoredProcedureResource. public virtual CosmosDBSqlStoredProcedureCollection GetCosmosDBSqlStoredProcedures() { - return GetCachedClient(Client => new CosmosDBSqlStoredProcedureCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBSqlStoredProcedureCollection(client, Id)); } /// @@ -117,8 +122,8 @@ public virtual CosmosDBSqlStoredProcedureCollection GetCosmosDBSqlStoredProcedur /// /// Cosmos DB storedProcedure name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBSqlStoredProcedureAsync(string storedProcedureName, CancellationToken cancellationToken = default) { @@ -140,8 +145,8 @@ public virtual async Task> GetCosmo /// /// Cosmos DB storedProcedure name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBSqlStoredProcedure(string storedProcedureName, CancellationToken cancellationToken = default) { @@ -152,7 +157,7 @@ public virtual Response GetCosmosDBSqlStored /// An object representing collection of CosmosDBSqlUserDefinedFunctionResources and their operations over a CosmosDBSqlUserDefinedFunctionResource. public virtual CosmosDBSqlUserDefinedFunctionCollection GetCosmosDBSqlUserDefinedFunctions() { - return GetCachedClient(Client => new CosmosDBSqlUserDefinedFunctionCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBSqlUserDefinedFunctionCollection(client, Id)); } /// @@ -170,8 +175,8 @@ public virtual CosmosDBSqlUserDefinedFunctionCollection GetCosmosDBSqlUserDefine /// /// Cosmos DB userDefinedFunction name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBSqlUserDefinedFunctionAsync(string userDefinedFunctionName, CancellationToken cancellationToken = default) { @@ -193,8 +198,8 @@ public virtual async Task> GetC /// /// Cosmos DB userDefinedFunction name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBSqlUserDefinedFunction(string userDefinedFunctionName, CancellationToken cancellationToken = default) { @@ -205,7 +210,7 @@ public virtual Response GetCosmosDBSqlUs /// An object representing collection of CosmosDBSqlTriggerResources and their operations over a CosmosDBSqlTriggerResource. public virtual CosmosDBSqlTriggerCollection GetCosmosDBSqlTriggers() { - return GetCachedClient(Client => new CosmosDBSqlTriggerCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBSqlTriggerCollection(client, Id)); } /// @@ -223,8 +228,8 @@ public virtual CosmosDBSqlTriggerCollection GetCosmosDBSqlTriggers() /// /// Cosmos DB trigger name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBSqlTriggerAsync(string triggerName, CancellationToken cancellationToken = default) { @@ -246,8 +251,8 @@ public virtual async Task> GetCosmosDBSqlTr /// /// Cosmos DB trigger name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBSqlTrigger(string triggerName, CancellationToken cancellationToken = default) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerThroughputSettingResource.cs index 20accb66a806b..729cdbc6ed08a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerThroughputSettingResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlContainerThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The containerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string containerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseResource.cs index 76c3613af7c8b..cefae18493912 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}"; @@ -99,7 +103,7 @@ public virtual CosmosDBSqlDatabaseThroughputSettingResource GetCosmosDBSqlDataba /// An object representing collection of CosmosDBSqlClientEncryptionKeyResources and their operations over a CosmosDBSqlClientEncryptionKeyResource. public virtual CosmosDBSqlClientEncryptionKeyCollection GetCosmosDBSqlClientEncryptionKeys() { - return GetCachedClient(Client => new CosmosDBSqlClientEncryptionKeyCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBSqlClientEncryptionKeyCollection(client, Id)); } /// @@ -117,8 +121,8 @@ public virtual CosmosDBSqlClientEncryptionKeyCollection GetCosmosDBSqlClientEncr /// /// Cosmos DB ClientEncryptionKey name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBSqlClientEncryptionKeyAsync(string clientEncryptionKeyName, CancellationToken cancellationToken = default) { @@ -140,8 +144,8 @@ public virtual async Task> GetC /// /// Cosmos DB ClientEncryptionKey name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBSqlClientEncryptionKey(string clientEncryptionKeyName, CancellationToken cancellationToken = default) { @@ -152,7 +156,7 @@ public virtual Response GetCosmosDBSqlCl /// An object representing collection of CosmosDBSqlContainerResources and their operations over a CosmosDBSqlContainerResource. public virtual CosmosDBSqlContainerCollection GetCosmosDBSqlContainers() { - return GetCachedClient(Client => new CosmosDBSqlContainerCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBSqlContainerCollection(client, Id)); } /// @@ -170,8 +174,8 @@ public virtual CosmosDBSqlContainerCollection GetCosmosDBSqlContainers() /// /// Cosmos DB container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBSqlContainerAsync(string containerName, CancellationToken cancellationToken = default) { @@ -193,8 +197,8 @@ public virtual async Task> GetCosmosDBSql /// /// Cosmos DB container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBSqlContainer(string containerName, CancellationToken cancellationToken = default) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseThroughputSettingResource.cs index 600673a0081fb..44c50d175c0b7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseThroughputSettingResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlDatabaseThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentResource.cs index 9e92724dee325..f8d080c6f238c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleAssignmentResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlRoleAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The roleAssignmentId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string roleAssignmentId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionResource.cs index 33a2b03657407..8a058f1156aa2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlRoleDefinitionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlRoleDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The roleDefinitionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string roleDefinitionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureResource.cs index 7d8b61cc9d5d1..8e03819f822d0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlStoredProcedureResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlStoredProcedureResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The containerName. + /// The storedProcedureName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string containerName, string storedProcedureName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerResource.cs index b6dd4ca186174..51ff7e7efee5d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlTriggerResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlTriggerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The containerName. + /// The triggerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string containerName, string triggerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionResource.cs index 7dc7a4e853226..0d49306c87ca1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlUserDefinedFunctionResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBSqlUserDefinedFunctionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The containerName. + /// The userDefinedFunctionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string containerName, string userDefinedFunctionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableResource.cs index 093ba9595e75f..418c1c7d26a4c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBTableResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosDBTableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosTableThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosTableThroughputSettingResource.cs index e025b6e5d9c26..35333c1a05084 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosTableThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosTableThroughputSettingResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class CosmosTableThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultResource.cs index 2a9b057da266e..0f9a3fe72561c 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/DataTransferJobGetResultResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class DataTransferJobGetResultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs index b1a35e4957e02..c045f8334a16f 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.CosmosDB @@ -18,838 +19,678 @@ namespace Azure.ResourceManager.CosmosDB /// A class to add extension methods to Azure.ResourceManager.CosmosDB. public static partial class CosmosDBExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableCosmosDBArmClient GetMockableCosmosDBArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableCosmosDBArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCosmosDBResourceGroupResource GetMockableCosmosDBResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCosmosDBResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableCosmosDBSubscriptionResource GetMockableCosmosDBSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableCosmosDBSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCosmosDBTenantResource GetMockableCosmosDBTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCosmosDBTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region CosmosDBAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBAccountResource GetCosmosDBAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBAccountResource.ValidateResourceId(id); - return new CosmosDBAccountResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBAccountResource(id); } - #endregion - #region GraphResourceGetResultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GraphResourceGetResultResource GetGraphResourceGetResultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GraphResourceGetResultResource.ValidateResourceId(id); - return new GraphResourceGetResultResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetGraphResourceGetResultResource(id); } - #endregion - #region CosmosDBSqlDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlDatabaseResource GetCosmosDBSqlDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlDatabaseResource.ValidateResourceId(id); - return new CosmosDBSqlDatabaseResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlDatabaseResource(id); } - #endregion - #region CosmosDBSqlDatabaseThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlDatabaseThroughputSettingResource GetCosmosDBSqlDatabaseThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlDatabaseThroughputSettingResource.ValidateResourceId(id); - return new CosmosDBSqlDatabaseThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlDatabaseThroughputSettingResource(id); } - #endregion - #region CosmosDBSqlContainerThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlContainerThroughputSettingResource GetCosmosDBSqlContainerThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlContainerThroughputSettingResource.ValidateResourceId(id); - return new CosmosDBSqlContainerThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlContainerThroughputSettingResource(id); } - #endregion - #region MongoDBDatabaseThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MongoDBDatabaseThroughputSettingResource GetMongoDBDatabaseThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MongoDBDatabaseThroughputSettingResource.ValidateResourceId(id); - return new MongoDBDatabaseThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetMongoDBDatabaseThroughputSettingResource(id); } - #endregion - #region MongoDBCollectionThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MongoDBCollectionThroughputSettingResource GetMongoDBCollectionThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MongoDBCollectionThroughputSettingResource.ValidateResourceId(id); - return new MongoDBCollectionThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetMongoDBCollectionThroughputSettingResource(id); } - #endregion - #region CosmosTableThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosTableThroughputSettingResource GetCosmosTableThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosTableThroughputSettingResource.ValidateResourceId(id); - return new CosmosTableThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosTableThroughputSettingResource(id); } - #endregion - #region CassandraKeyspaceThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CassandraKeyspaceThroughputSettingResource GetCassandraKeyspaceThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CassandraKeyspaceThroughputSettingResource.ValidateResourceId(id); - return new CassandraKeyspaceThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraKeyspaceThroughputSettingResource(id); } - #endregion - #region CassandraTableThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CassandraTableThroughputSettingResource GetCassandraTableThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CassandraTableThroughputSettingResource.ValidateResourceId(id); - return new CassandraTableThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraTableThroughputSettingResource(id); } - #endregion - #region CassandraViewThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CassandraViewThroughputSettingResource GetCassandraViewThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CassandraViewThroughputSettingResource.ValidateResourceId(id); - return new CassandraViewThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraViewThroughputSettingResource(id); } - #endregion - #region GremlinDatabaseThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GremlinDatabaseThroughputSettingResource GetGremlinDatabaseThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GremlinDatabaseThroughputSettingResource.ValidateResourceId(id); - return new GremlinDatabaseThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetGremlinDatabaseThroughputSettingResource(id); } - #endregion - #region GremlinGraphThroughputSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GremlinGraphThroughputSettingResource GetGremlinGraphThroughputSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GremlinGraphThroughputSettingResource.ValidateResourceId(id); - return new GremlinGraphThroughputSettingResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetGremlinGraphThroughputSettingResource(id); } - #endregion - #region CosmosDBSqlClientEncryptionKeyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlClientEncryptionKeyResource GetCosmosDBSqlClientEncryptionKeyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlClientEncryptionKeyResource.ValidateResourceId(id); - return new CosmosDBSqlClientEncryptionKeyResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlClientEncryptionKeyResource(id); } - #endregion - #region CosmosDBSqlContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlContainerResource GetCosmosDBSqlContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlContainerResource.ValidateResourceId(id); - return new CosmosDBSqlContainerResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlContainerResource(id); } - #endregion - #region CosmosDBSqlStoredProcedureResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlStoredProcedureResource GetCosmosDBSqlStoredProcedureResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlStoredProcedureResource.ValidateResourceId(id); - return new CosmosDBSqlStoredProcedureResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlStoredProcedureResource(id); } - #endregion - #region CosmosDBSqlUserDefinedFunctionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlUserDefinedFunctionResource GetCosmosDBSqlUserDefinedFunctionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlUserDefinedFunctionResource.ValidateResourceId(id); - return new CosmosDBSqlUserDefinedFunctionResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlUserDefinedFunctionResource(id); } - #endregion - #region CosmosDBSqlTriggerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlTriggerResource GetCosmosDBSqlTriggerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlTriggerResource.ValidateResourceId(id); - return new CosmosDBSqlTriggerResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlTriggerResource(id); } - #endregion - #region CosmosDBSqlRoleDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlRoleDefinitionResource GetCosmosDBSqlRoleDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlRoleDefinitionResource.ValidateResourceId(id); - return new CosmosDBSqlRoleDefinitionResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlRoleDefinitionResource(id); } - #endregion - #region CosmosDBSqlRoleAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBSqlRoleAssignmentResource GetCosmosDBSqlRoleAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBSqlRoleAssignmentResource.ValidateResourceId(id); - return new CosmosDBSqlRoleAssignmentResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBSqlRoleAssignmentResource(id); } - #endregion - #region MongoDBDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MongoDBDatabaseResource GetMongoDBDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MongoDBDatabaseResource.ValidateResourceId(id); - return new MongoDBDatabaseResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetMongoDBDatabaseResource(id); } - #endregion - #region MongoDBCollectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MongoDBCollectionResource GetMongoDBCollectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MongoDBCollectionResource.ValidateResourceId(id); - return new MongoDBCollectionResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetMongoDBCollectionResource(id); } - #endregion - #region MongoDBRoleDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MongoDBRoleDefinitionResource GetMongoDBRoleDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MongoDBRoleDefinitionResource.ValidateResourceId(id); - return new MongoDBRoleDefinitionResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetMongoDBRoleDefinitionResource(id); } - #endregion - #region MongoDBUserDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MongoDBUserDefinitionResource GetMongoDBUserDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MongoDBUserDefinitionResource.ValidateResourceId(id); - return new MongoDBUserDefinitionResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetMongoDBUserDefinitionResource(id); } - #endregion - #region CosmosDBTableResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBTableResource GetCosmosDBTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBTableResource.ValidateResourceId(id); - return new CosmosDBTableResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBTableResource(id); } - #endregion - #region CassandraKeyspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CassandraKeyspaceResource GetCassandraKeyspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CassandraKeyspaceResource.ValidateResourceId(id); - return new CassandraKeyspaceResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraKeyspaceResource(id); } - #endregion - #region CassandraTableResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CassandraTableResource GetCassandraTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CassandraTableResource.ValidateResourceId(id); - return new CassandraTableResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraTableResource(id); } - #endregion - #region CassandraViewGetResultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CassandraViewGetResultResource GetCassandraViewGetResultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CassandraViewGetResultResource.ValidateResourceId(id); - return new CassandraViewGetResultResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraViewGetResultResource(id); } - #endregion - #region GremlinDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GremlinDatabaseResource GetGremlinDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GremlinDatabaseResource.ValidateResourceId(id); - return new GremlinDatabaseResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetGremlinDatabaseResource(id); } - #endregion - #region GremlinGraphResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GremlinGraphResource GetGremlinGraphResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GremlinGraphResource.ValidateResourceId(id); - return new GremlinGraphResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetGremlinGraphResource(id); } - #endregion - #region CosmosDBLocationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBLocationResource GetCosmosDBLocationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBLocationResource.ValidateResourceId(id); - return new CosmosDBLocationResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBLocationResource(id); } - #endregion - #region DataTransferJobGetResultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataTransferJobGetResultResource GetDataTransferJobGetResultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataTransferJobGetResultResource.ValidateResourceId(id); - return new DataTransferJobGetResultResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetDataTransferJobGetResultResource(id); } - #endregion - #region CassandraClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CassandraClusterResource GetCassandraClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CassandraClusterResource.ValidateResourceId(id); - return new CassandraClusterResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraClusterResource(id); } - #endregion - #region CassandraClusterBackupResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CassandraClusterBackupResource GetCassandraClusterBackupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - CassandraClusterBackupResource.ValidateResourceId(id); - return new CassandraClusterBackupResource(client, id); - } - ); - } - #endregion - - #region CassandraDataCenterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CassandraDataCenterResource GetCassandraDataCenterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CassandraDataCenterResource.ValidateResourceId(id); - return new CassandraDataCenterResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraDataCenterResource(id); } - #endregion - #region MongoClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MongoClusterResource GetMongoClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MongoClusterResource.ValidateResourceId(id); - return new MongoClusterResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetMongoClusterResource(id); } - #endregion - #region CosmosDBFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBFirewallRuleResource GetCosmosDBFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBFirewallRuleResource.ValidateResourceId(id); - return new CosmosDBFirewallRuleResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBFirewallRuleResource(id); } - #endregion - #region CosmosDBPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBPrivateEndpointConnectionResource GetCosmosDBPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBPrivateEndpointConnectionResource.ValidateResourceId(id); - return new CosmosDBPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBPrivateEndpointConnectionResource(id); } - #endregion - #region CosmosDBPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBPrivateLinkResource GetCosmosDBPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBPrivateLinkResource.ValidateResourceId(id); - return new CosmosDBPrivateLinkResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBPrivateLinkResource(id); } - #endregion - #region RestorableCosmosDBAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RestorableCosmosDBAccountResource GetRestorableCosmosDBAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RestorableCosmosDBAccountResource.ValidateResourceId(id); - return new RestorableCosmosDBAccountResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetRestorableCosmosDBAccountResource(id); } - #endregion - #region CosmosDBServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBServiceResource GetCosmosDBServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBServiceResource.ValidateResourceId(id); - return new CosmosDBServiceResource(client, id); - } - ); + return GetMockableCosmosDBArmClient(client).GetCosmosDBServiceResource(id); } - #endregion - /// Gets a collection of CosmosDBAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of CosmosDBAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CosmosDBAccountResources and their operations over a CosmosDBAccountResource. public static CosmosDBAccountCollection GetCosmosDBAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCosmosDBAccounts(); + return GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetCosmosDBAccounts(); } /// @@ -864,16 +705,20 @@ public static CosmosDBAccountCollection GetCosmosDBAccounts(this ResourceGroupRe /// DatabaseAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Cosmos DB database account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCosmosDBAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCosmosDBAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetCosmosDBAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -888,24 +733,34 @@ public static async Task> GetCosmosDBAccountAs /// DatabaseAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Cosmos DB database account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCosmosDBAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCosmosDBAccounts().Get(accountName, cancellationToken); + return GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetCosmosDBAccount(accountName, cancellationToken); } - /// Gets a collection of CassandraClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of CassandraClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CassandraClusterResources and their operations over a CassandraClusterResource. public static CassandraClusterCollection GetCassandraClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCassandraClusters(); + return GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetCassandraClusters(); } /// @@ -920,16 +775,20 @@ public static CassandraClusterCollection GetCassandraClusters(this ResourceGroup /// CassandraClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Managed Cassandra cluster name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCassandraClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCassandraClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetCassandraClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -944,24 +803,34 @@ public static async Task> GetCassandraCluster /// CassandraClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Managed Cassandra cluster name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCassandraCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCassandraClusters().Get(clusterName, cancellationToken); + return GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetCassandraCluster(clusterName, cancellationToken); } - /// Gets a collection of MongoClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of MongoClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MongoClusterResources and their operations over a MongoClusterResource. public static MongoClusterCollection GetMongoClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMongoClusters(); + return GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetMongoClusters(); } /// @@ -976,16 +845,20 @@ public static MongoClusterCollection GetMongoClusters(this ResourceGroupResource /// MongoClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the mongo cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMongoClusterAsync(this ResourceGroupResource resourceGroupResource, string mongoClusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMongoClusters().GetAsync(mongoClusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetMongoClusterAsync(mongoClusterName, cancellationToken).ConfigureAwait(false); } /// @@ -1000,24 +873,34 @@ public static async Task> GetMongoClusterAsync(th /// MongoClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the mongo cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMongoCluster(this ResourceGroupResource resourceGroupResource, string mongoClusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMongoClusters().Get(mongoClusterName, cancellationToken); + return GetMockableCosmosDBResourceGroupResource(resourceGroupResource).GetMongoCluster(mongoClusterName, cancellationToken); } - /// Gets a collection of CosmosDBLocationResources in the SubscriptionResource. + /// + /// Gets a collection of CosmosDBLocationResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CosmosDBLocationResources and their operations over a CosmosDBLocationResource. public static CosmosDBLocationCollection GetCosmosDBLocations(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCosmosDBLocations(); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetCosmosDBLocations(); } /// @@ -1032,6 +915,10 @@ public static CosmosDBLocationCollection GetCosmosDBLocations(this SubscriptionR /// Locations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Cosmos DB region, with spaces between words and each word capitalized. @@ -1039,7 +926,7 @@ public static CosmosDBLocationCollection GetCosmosDBLocations(this SubscriptionR [ForwardsClientCalls] public static async Task> GetCosmosDBLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetCosmosDBLocations().GetAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetCosmosDBLocationAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -1054,6 +941,10 @@ public static async Task> GetCosmosDBLocation /// Locations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Cosmos DB region, with spaces between words and each word capitalized. @@ -1061,7 +952,7 @@ public static async Task> GetCosmosDBLocation [ForwardsClientCalls] public static Response GetCosmosDBLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return subscriptionResource.GetCosmosDBLocations().Get(location, cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetCosmosDBLocation(location, cancellationToken); } /// @@ -1076,13 +967,17 @@ public static Response GetCosmosDBLocation(this Subscr /// DatabaseAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCosmosDBAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCosmosDBAccountsAsync(cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetCosmosDBAccountsAsync(cancellationToken); } /// @@ -1097,13 +992,17 @@ public static AsyncPageable GetCosmosDBAccountsAsync(th /// DatabaseAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCosmosDBAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCosmosDBAccounts(cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetCosmosDBAccounts(cancellationToken); } /// @@ -1118,13 +1017,17 @@ public static Pageable GetCosmosDBAccounts(this Subscri /// CassandraClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCassandraClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCassandraClustersAsync(cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetCassandraClustersAsync(cancellationToken); } /// @@ -1139,13 +1042,17 @@ public static AsyncPageable GetCassandraClustersAsync( /// CassandraClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCassandraClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCassandraClusters(cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetCassandraClusters(cancellationToken); } /// @@ -1160,13 +1067,17 @@ public static Pageable GetCassandraClusters(this Subsc /// MongoClusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMongoClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMongoClustersAsync(cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetMongoClustersAsync(cancellationToken); } /// @@ -1181,13 +1092,17 @@ public static AsyncPageable GetMongoClustersAsync(this Sub /// MongoClusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMongoClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMongoClusters(cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetMongoClusters(cancellationToken); } /// @@ -1202,13 +1117,17 @@ public static Pageable GetMongoClusters(this SubscriptionR /// RestorableDatabaseAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRestorableCosmosDBAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRestorableCosmosDBAccountsAsync(cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetRestorableCosmosDBAccountsAsync(cancellationToken); } /// @@ -1223,13 +1142,17 @@ public static AsyncPageable GetRestorableCosm /// RestorableDatabaseAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRestorableCosmosDBAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRestorableCosmosDBAccounts(cancellationToken); + return GetMockableCosmosDBSubscriptionResource(subscriptionResource).GetRestorableCosmosDBAccounts(cancellationToken); } /// @@ -1244,6 +1167,10 @@ public static Pageable GetRestorableCosmosDBA /// DatabaseAccounts_CheckNameExists /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Cosmos DB database account name. @@ -1252,9 +1179,7 @@ public static Pageable GetRestorableCosmosDBA /// is null. public static async Task> CheckNameExistsDatabaseAccountAsync(this TenantResource tenantResource, string accountName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - return await GetTenantResourceExtensionClient(tenantResource).CheckNameExistsDatabaseAccountAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableCosmosDBTenantResource(tenantResource).CheckNameExistsDatabaseAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -1269,6 +1194,10 @@ public static async Task> CheckNameExistsDatabaseAccountAsync(thi /// DatabaseAccounts_CheckNameExists /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Cosmos DB database account name. @@ -1277,9 +1206,7 @@ public static async Task> CheckNameExistsDatabaseAccountAsync(thi /// is null. public static Response CheckNameExistsDatabaseAccount(this TenantResource tenantResource, string accountName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - return GetTenantResourceExtensionClient(tenantResource).CheckNameExistsDatabaseAccount(accountName, cancellationToken); + return GetMockableCosmosDBTenantResource(tenantResource).CheckNameExistsDatabaseAccount(accountName, cancellationToken); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBArmClient.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBArmClient.cs new file mode 100644 index 0000000000000..4ea16a64aa685 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBArmClient.cs @@ -0,0 +1,519 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableCosmosDBArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCosmosDBArmClient() + { + } + + /// 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 MockableCosmosDBArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableCosmosDBArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBAccountResource GetCosmosDBAccountResource(ResourceIdentifier id) + { + CosmosDBAccountResource.ValidateResourceId(id); + return new CosmosDBAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GraphResourceGetResultResource GetGraphResourceGetResultResource(ResourceIdentifier id) + { + GraphResourceGetResultResource.ValidateResourceId(id); + return new GraphResourceGetResultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlDatabaseResource GetCosmosDBSqlDatabaseResource(ResourceIdentifier id) + { + CosmosDBSqlDatabaseResource.ValidateResourceId(id); + return new CosmosDBSqlDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlDatabaseThroughputSettingResource GetCosmosDBSqlDatabaseThroughputSettingResource(ResourceIdentifier id) + { + CosmosDBSqlDatabaseThroughputSettingResource.ValidateResourceId(id); + return new CosmosDBSqlDatabaseThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlContainerThroughputSettingResource GetCosmosDBSqlContainerThroughputSettingResource(ResourceIdentifier id) + { + CosmosDBSqlContainerThroughputSettingResource.ValidateResourceId(id); + return new CosmosDBSqlContainerThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MongoDBDatabaseThroughputSettingResource GetMongoDBDatabaseThroughputSettingResource(ResourceIdentifier id) + { + MongoDBDatabaseThroughputSettingResource.ValidateResourceId(id); + return new MongoDBDatabaseThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MongoDBCollectionThroughputSettingResource GetMongoDBCollectionThroughputSettingResource(ResourceIdentifier id) + { + MongoDBCollectionThroughputSettingResource.ValidateResourceId(id); + return new MongoDBCollectionThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosTableThroughputSettingResource GetCosmosTableThroughputSettingResource(ResourceIdentifier id) + { + CosmosTableThroughputSettingResource.ValidateResourceId(id); + return new CosmosTableThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CassandraKeyspaceThroughputSettingResource GetCassandraKeyspaceThroughputSettingResource(ResourceIdentifier id) + { + CassandraKeyspaceThroughputSettingResource.ValidateResourceId(id); + return new CassandraKeyspaceThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CassandraTableThroughputSettingResource GetCassandraTableThroughputSettingResource(ResourceIdentifier id) + { + CassandraTableThroughputSettingResource.ValidateResourceId(id); + return new CassandraTableThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CassandraViewThroughputSettingResource GetCassandraViewThroughputSettingResource(ResourceIdentifier id) + { + CassandraViewThroughputSettingResource.ValidateResourceId(id); + return new CassandraViewThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GremlinDatabaseThroughputSettingResource GetGremlinDatabaseThroughputSettingResource(ResourceIdentifier id) + { + GremlinDatabaseThroughputSettingResource.ValidateResourceId(id); + return new GremlinDatabaseThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GremlinGraphThroughputSettingResource GetGremlinGraphThroughputSettingResource(ResourceIdentifier id) + { + GremlinGraphThroughputSettingResource.ValidateResourceId(id); + return new GremlinGraphThroughputSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlClientEncryptionKeyResource GetCosmosDBSqlClientEncryptionKeyResource(ResourceIdentifier id) + { + CosmosDBSqlClientEncryptionKeyResource.ValidateResourceId(id); + return new CosmosDBSqlClientEncryptionKeyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlContainerResource GetCosmosDBSqlContainerResource(ResourceIdentifier id) + { + CosmosDBSqlContainerResource.ValidateResourceId(id); + return new CosmosDBSqlContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlStoredProcedureResource GetCosmosDBSqlStoredProcedureResource(ResourceIdentifier id) + { + CosmosDBSqlStoredProcedureResource.ValidateResourceId(id); + return new CosmosDBSqlStoredProcedureResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlUserDefinedFunctionResource GetCosmosDBSqlUserDefinedFunctionResource(ResourceIdentifier id) + { + CosmosDBSqlUserDefinedFunctionResource.ValidateResourceId(id); + return new CosmosDBSqlUserDefinedFunctionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlTriggerResource GetCosmosDBSqlTriggerResource(ResourceIdentifier id) + { + CosmosDBSqlTriggerResource.ValidateResourceId(id); + return new CosmosDBSqlTriggerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlRoleDefinitionResource GetCosmosDBSqlRoleDefinitionResource(ResourceIdentifier id) + { + CosmosDBSqlRoleDefinitionResource.ValidateResourceId(id); + return new CosmosDBSqlRoleDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBSqlRoleAssignmentResource GetCosmosDBSqlRoleAssignmentResource(ResourceIdentifier id) + { + CosmosDBSqlRoleAssignmentResource.ValidateResourceId(id); + return new CosmosDBSqlRoleAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MongoDBDatabaseResource GetMongoDBDatabaseResource(ResourceIdentifier id) + { + MongoDBDatabaseResource.ValidateResourceId(id); + return new MongoDBDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MongoDBCollectionResource GetMongoDBCollectionResource(ResourceIdentifier id) + { + MongoDBCollectionResource.ValidateResourceId(id); + return new MongoDBCollectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MongoDBRoleDefinitionResource GetMongoDBRoleDefinitionResource(ResourceIdentifier id) + { + MongoDBRoleDefinitionResource.ValidateResourceId(id); + return new MongoDBRoleDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MongoDBUserDefinitionResource GetMongoDBUserDefinitionResource(ResourceIdentifier id) + { + MongoDBUserDefinitionResource.ValidateResourceId(id); + return new MongoDBUserDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBTableResource GetCosmosDBTableResource(ResourceIdentifier id) + { + CosmosDBTableResource.ValidateResourceId(id); + return new CosmosDBTableResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CassandraKeyspaceResource GetCassandraKeyspaceResource(ResourceIdentifier id) + { + CassandraKeyspaceResource.ValidateResourceId(id); + return new CassandraKeyspaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CassandraTableResource GetCassandraTableResource(ResourceIdentifier id) + { + CassandraTableResource.ValidateResourceId(id); + return new CassandraTableResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CassandraViewGetResultResource GetCassandraViewGetResultResource(ResourceIdentifier id) + { + CassandraViewGetResultResource.ValidateResourceId(id); + return new CassandraViewGetResultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GremlinDatabaseResource GetGremlinDatabaseResource(ResourceIdentifier id) + { + GremlinDatabaseResource.ValidateResourceId(id); + return new GremlinDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GremlinGraphResource GetGremlinGraphResource(ResourceIdentifier id) + { + GremlinGraphResource.ValidateResourceId(id); + return new GremlinGraphResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBLocationResource GetCosmosDBLocationResource(ResourceIdentifier id) + { + CosmosDBLocationResource.ValidateResourceId(id); + return new CosmosDBLocationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataTransferJobGetResultResource GetDataTransferJobGetResultResource(ResourceIdentifier id) + { + DataTransferJobGetResultResource.ValidateResourceId(id); + return new DataTransferJobGetResultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CassandraClusterResource GetCassandraClusterResource(ResourceIdentifier id) + { + CassandraClusterResource.ValidateResourceId(id); + return new CassandraClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CassandraDataCenterResource GetCassandraDataCenterResource(ResourceIdentifier id) + { + CassandraDataCenterResource.ValidateResourceId(id); + return new CassandraDataCenterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MongoClusterResource GetMongoClusterResource(ResourceIdentifier id) + { + MongoClusterResource.ValidateResourceId(id); + return new MongoClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBFirewallRuleResource GetCosmosDBFirewallRuleResource(ResourceIdentifier id) + { + CosmosDBFirewallRuleResource.ValidateResourceId(id); + return new CosmosDBFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBPrivateEndpointConnectionResource GetCosmosDBPrivateEndpointConnectionResource(ResourceIdentifier id) + { + CosmosDBPrivateEndpointConnectionResource.ValidateResourceId(id); + return new CosmosDBPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBPrivateLinkResource GetCosmosDBPrivateLinkResource(ResourceIdentifier id) + { + CosmosDBPrivateLinkResource.ValidateResourceId(id); + return new CosmosDBPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RestorableCosmosDBAccountResource GetRestorableCosmosDBAccountResource(ResourceIdentifier id) + { + RestorableCosmosDBAccountResource.ValidateResourceId(id); + return new RestorableCosmosDBAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBServiceResource GetCosmosDBServiceResource(ResourceIdentifier id) + { + CosmosDBServiceResource.ValidateResourceId(id); + return new CosmosDBServiceResource(Client, id); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBResourceGroupResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBResourceGroupResource.cs new file mode 100644 index 0000000000000..255d57b83264e --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBResourceGroupResource.cs @@ -0,0 +1,198 @@ +// 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.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableCosmosDBResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCosmosDBResourceGroupResource() + { + } + + /// 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 MockableCosmosDBResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CosmosDBAccountResources in the ResourceGroupResource. + /// An object representing collection of CosmosDBAccountResources and their operations over a CosmosDBAccountResource. + public virtual CosmosDBAccountCollection GetCosmosDBAccounts() + { + return GetCachedClient(client => new CosmosDBAccountCollection(client, Id)); + } + + /// + /// Retrieves the properties of an existing Azure Cosmos DB database account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName} + /// + /// + /// Operation Id + /// DatabaseAccounts_Get + /// + /// + /// + /// Cosmos DB database account name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCosmosDBAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetCosmosDBAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the properties of an existing Azure Cosmos DB database account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName} + /// + /// + /// Operation Id + /// DatabaseAccounts_Get + /// + /// + /// + /// Cosmos DB database account name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCosmosDBAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetCosmosDBAccounts().Get(accountName, cancellationToken); + } + + /// Gets a collection of CassandraClusterResources in the ResourceGroupResource. + /// An object representing collection of CassandraClusterResources and their operations over a CassandraClusterResource. + public virtual CassandraClusterCollection GetCassandraClusters() + { + return GetCachedClient(client => new CassandraClusterCollection(client, Id)); + } + + /// + /// Get the properties of a managed Cassandra cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName} + /// + /// + /// Operation Id + /// CassandraClusters_Get + /// + /// + /// + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCassandraClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetCassandraClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a managed Cassandra cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName} + /// + /// + /// Operation Id + /// CassandraClusters_Get + /// + /// + /// + /// Managed Cassandra cluster name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCassandraCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetCassandraClusters().Get(clusterName, cancellationToken); + } + + /// Gets a collection of MongoClusterResources in the ResourceGroupResource. + /// An object representing collection of MongoClusterResources and their operations over a MongoClusterResource. + public virtual MongoClusterCollection GetMongoClusters() + { + return GetCachedClient(client => new MongoClusterCollection(client, Id)); + } + + /// + /// Gets information about a mongo cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName} + /// + /// + /// Operation Id + /// MongoClusters_Get + /// + /// + /// + /// The name of the mongo cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMongoClusterAsync(string mongoClusterName, CancellationToken cancellationToken = default) + { + return await GetMongoClusters().GetAsync(mongoClusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a mongo cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName} + /// + /// + /// Operation Id + /// MongoClusters_Get + /// + /// + /// + /// The name of the mongo cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMongoCluster(string mongoClusterName, CancellationToken cancellationToken = default) + { + return GetMongoClusters().Get(mongoClusterName, cancellationToken); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBSubscriptionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBSubscriptionResource.cs new file mode 100644 index 0000000000000..13fa9adfee27f --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBSubscriptionResource.cs @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableCosmosDBSubscriptionResource : ArmResource + { + private ClientDiagnostics _cosmosDBAccountDatabaseAccountsClientDiagnostics; + private DatabaseAccountsRestOperations _cosmosDBAccountDatabaseAccountsRestClient; + private ClientDiagnostics _cassandraClusterClientDiagnostics; + private CassandraClustersRestOperations _cassandraClusterRestClient; + private ClientDiagnostics _mongoClusterClientDiagnostics; + private MongoClustersRestOperations _mongoClusterRestClient; + private ClientDiagnostics _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics; + private RestorableDatabaseAccountsRestOperations _restorableCosmosDBAccountRestorableDatabaseAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCosmosDBSubscriptionResource() + { + } + + /// 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 MockableCosmosDBSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CosmosDBAccountDatabaseAccountsClientDiagnostics => _cosmosDBAccountDatabaseAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", CosmosDBAccountResource.ResourceType.Namespace, Diagnostics); + private DatabaseAccountsRestOperations CosmosDBAccountDatabaseAccountsRestClient => _cosmosDBAccountDatabaseAccountsRestClient ??= new DatabaseAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CosmosDBAccountResource.ResourceType)); + private ClientDiagnostics CassandraClusterClientDiagnostics => _cassandraClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", CassandraClusterResource.ResourceType.Namespace, Diagnostics); + private CassandraClustersRestOperations CassandraClusterRestClient => _cassandraClusterRestClient ??= new CassandraClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CassandraClusterResource.ResourceType)); + private ClientDiagnostics MongoClusterClientDiagnostics => _mongoClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", MongoClusterResource.ResourceType.Namespace, Diagnostics); + private MongoClustersRestOperations MongoClusterRestClient => _mongoClusterRestClient ??= new MongoClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MongoClusterResource.ResourceType)); + private ClientDiagnostics RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics => _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", RestorableCosmosDBAccountResource.ResourceType.Namespace, Diagnostics); + private RestorableDatabaseAccountsRestOperations RestorableCosmosDBAccountRestorableDatabaseAccountsRestClient => _restorableCosmosDBAccountRestorableDatabaseAccountsRestClient ??= new RestorableDatabaseAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RestorableCosmosDBAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CosmosDBLocationResources in the SubscriptionResource. + /// An object representing collection of CosmosDBLocationResources and their operations over a CosmosDBLocationResource. + public virtual CosmosDBLocationCollection GetCosmosDBLocations() + { + return GetCachedClient(client => new CosmosDBLocationCollection(client, Id)); + } + + /// + /// Get the properties of an existing Cosmos DB location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location} + /// + /// + /// Operation Id + /// Locations_Get + /// + /// + /// + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetCosmosDBLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + return await GetCosmosDBLocations().GetAsync(location, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of an existing Cosmos DB location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location} + /// + /// + /// Operation Id + /// Locations_Get + /// + /// + /// + /// Cosmos DB region, with spaces between words and each word capitalized. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetCosmosDBLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + return GetCosmosDBLocations().Get(location, cancellationToken); + } + + /// + /// Lists all the Azure Cosmos DB database accounts available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts + /// + /// + /// Operation Id + /// DatabaseAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCosmosDBAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBAccountDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), CosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "MockableCosmosDBSubscriptionResource.GetCosmosDBAccounts", "value", null, cancellationToken); + } + + /// + /// Lists all the Azure Cosmos DB database accounts available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts + /// + /// + /// Operation Id + /// DatabaseAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCosmosDBAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBAccountDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), CosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "MockableCosmosDBSubscriptionResource.GetCosmosDBAccounts", "value", null, cancellationToken); + } + + /// + /// List all managed Cassandra clusters in this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters + /// + /// + /// Operation Id + /// CassandraClusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCassandraClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CassandraClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), CassandraClusterClientDiagnostics, Pipeline, "MockableCosmosDBSubscriptionResource.GetCassandraClusters", "value", null, cancellationToken); + } + + /// + /// List all managed Cassandra clusters in this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters + /// + /// + /// Operation Id + /// CassandraClusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCassandraClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CassandraClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), CassandraClusterClientDiagnostics, Pipeline, "MockableCosmosDBSubscriptionResource.GetCassandraClusters", "value", null, cancellationToken); + } + + /// + /// List all the mongo clusters in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters + /// + /// + /// Operation Id + /// MongoClusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMongoClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MongoClusterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MongoClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), MongoClusterClientDiagnostics, Pipeline, "MockableCosmosDBSubscriptionResource.GetMongoClusters", "value", "nextLink", cancellationToken); + } + + /// + /// List all the mongo clusters in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters + /// + /// + /// Operation Id + /// MongoClusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMongoClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MongoClusterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MongoClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), MongoClusterClientDiagnostics, Pipeline, "MockableCosmosDBSubscriptionResource.GetMongoClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts + /// + /// + /// Operation Id + /// RestorableDatabaseAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRestorableCosmosDBAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RestorableCosmosDBAccountRestorableDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "MockableCosmosDBSubscriptionResource.GetRestorableCosmosDBAccounts", "value", null, cancellationToken); + } + + /// + /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts + /// + /// + /// Operation Id + /// RestorableDatabaseAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRestorableCosmosDBAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RestorableCosmosDBAccountRestorableDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "MockableCosmosDBSubscriptionResource.GetRestorableCosmosDBAccounts", "value", null, cancellationToken); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBTenantResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBTenantResource.cs new file mode 100644 index 0000000000000..25db51aefc2c4 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBTenantResource.cs @@ -0,0 +1,116 @@ +// 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; +using Azure.ResourceManager.CosmosDB; + +namespace Azure.ResourceManager.CosmosDB.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableCosmosDBTenantResource : ArmResource + { + private ClientDiagnostics _cosmosDBAccountDatabaseAccountsClientDiagnostics; + private DatabaseAccountsRestOperations _cosmosDBAccountDatabaseAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCosmosDBTenantResource() + { + } + + /// 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 MockableCosmosDBTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CosmosDBAccountDatabaseAccountsClientDiagnostics => _cosmosDBAccountDatabaseAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", CosmosDBAccountResource.ResourceType.Namespace, Diagnostics); + private DatabaseAccountsRestOperations CosmosDBAccountDatabaseAccountsRestClient => _cosmosDBAccountDatabaseAccountsRestClient ??= new DatabaseAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CosmosDBAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + /// + /// + /// Request Path + /// /providers/Microsoft.DocumentDB/databaseAccountNames/{accountName} + /// + /// + /// Operation Id + /// DatabaseAccounts_CheckNameExists + /// + /// + /// + /// Cosmos DB database account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> CheckNameExistsDatabaseAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = CosmosDBAccountDatabaseAccountsClientDiagnostics.CreateScope("MockableCosmosDBTenantResource.CheckNameExistsDatabaseAccount"); + scope.Start(); + try + { + var response = await CosmosDBAccountDatabaseAccountsRestClient.CheckNameExistsAsync(accountName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + /// + /// + /// Request Path + /// /providers/Microsoft.DocumentDB/databaseAccountNames/{accountName} + /// + /// + /// Operation Id + /// DatabaseAccounts_CheckNameExists + /// + /// + /// + /// Cosmos DB database account name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response CheckNameExistsDatabaseAccount(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var scope = CosmosDBAccountDatabaseAccountsClientDiagnostics.CreateScope("MockableCosmosDBTenantResource.CheckNameExistsDatabaseAccount"); + scope.Start(); + try + { + var response = CosmosDBAccountDatabaseAccountsRestClient.CheckNameExists(accountName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 16288351d9588..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CosmosDB -{ - /// 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 CosmosDBAccountResources in the ResourceGroupResource. - /// An object representing collection of CosmosDBAccountResources and their operations over a CosmosDBAccountResource. - public virtual CosmosDBAccountCollection GetCosmosDBAccounts() - { - return GetCachedClient(Client => new CosmosDBAccountCollection(Client, Id)); - } - - /// Gets a collection of CassandraClusterResources in the ResourceGroupResource. - /// An object representing collection of CassandraClusterResources and their operations over a CassandraClusterResource. - public virtual CassandraClusterCollection GetCassandraClusters() - { - return GetCachedClient(Client => new CassandraClusterCollection(Client, Id)); - } - - /// Gets a collection of MongoClusterResources in the ResourceGroupResource. - /// An object representing collection of MongoClusterResources and their operations over a MongoClusterResource. - public virtual MongoClusterCollection GetMongoClusters() - { - return GetCachedClient(Client => new MongoClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 045361201fde8..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CosmosDB -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _cosmosDBAccountDatabaseAccountsClientDiagnostics; - private DatabaseAccountsRestOperations _cosmosDBAccountDatabaseAccountsRestClient; - private ClientDiagnostics _cassandraClusterClientDiagnostics; - private CassandraClustersRestOperations _cassandraClusterRestClient; - private ClientDiagnostics _mongoClusterClientDiagnostics; - private MongoClustersRestOperations _mongoClusterRestClient; - private ClientDiagnostics _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics; - private RestorableDatabaseAccountsRestOperations _restorableCosmosDBAccountRestorableDatabaseAccountsRestClient; - - /// 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 CosmosDBAccountDatabaseAccountsClientDiagnostics => _cosmosDBAccountDatabaseAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", CosmosDBAccountResource.ResourceType.Namespace, Diagnostics); - private DatabaseAccountsRestOperations CosmosDBAccountDatabaseAccountsRestClient => _cosmosDBAccountDatabaseAccountsRestClient ??= new DatabaseAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CosmosDBAccountResource.ResourceType)); - private ClientDiagnostics CassandraClusterClientDiagnostics => _cassandraClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", CassandraClusterResource.ResourceType.Namespace, Diagnostics); - private CassandraClustersRestOperations CassandraClusterRestClient => _cassandraClusterRestClient ??= new CassandraClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CassandraClusterResource.ResourceType)); - private ClientDiagnostics MongoClusterClientDiagnostics => _mongoClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", MongoClusterResource.ResourceType.Namespace, Diagnostics); - private MongoClustersRestOperations MongoClusterRestClient => _mongoClusterRestClient ??= new MongoClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MongoClusterResource.ResourceType)); - private ClientDiagnostics RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics => _restorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", RestorableCosmosDBAccountResource.ResourceType.Namespace, Diagnostics); - private RestorableDatabaseAccountsRestOperations RestorableCosmosDBAccountRestorableDatabaseAccountsRestClient => _restorableCosmosDBAccountRestorableDatabaseAccountsRestClient ??= new RestorableDatabaseAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RestorableCosmosDBAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of CosmosDBLocationResources in the SubscriptionResource. - /// An object representing collection of CosmosDBLocationResources and their operations over a CosmosDBLocationResource. - public virtual CosmosDBLocationCollection GetCosmosDBLocations() - { - return GetCachedClient(Client => new CosmosDBLocationCollection(Client, Id)); - } - - /// - /// Lists all the Azure Cosmos DB database accounts available under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts - /// - /// - /// Operation Id - /// DatabaseAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCosmosDBAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBAccountDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), CosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBAccounts", "value", null, cancellationToken); - } - - /// - /// Lists all the Azure Cosmos DB database accounts available under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts - /// - /// - /// Operation Id - /// DatabaseAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCosmosDBAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBAccountDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CosmosDBAccountResource(Client, CosmosDBAccountData.DeserializeCosmosDBAccountData(e)), CosmosDBAccountDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBAccounts", "value", null, cancellationToken); - } - - /// - /// List all managed Cassandra clusters in this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters - /// - /// - /// Operation Id - /// CassandraClusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCassandraClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CassandraClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), CassandraClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCassandraClusters", "value", null, cancellationToken); - } - - /// - /// List all managed Cassandra clusters in this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters - /// - /// - /// Operation Id - /// CassandraClusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCassandraClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CassandraClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CassandraClusterResource(Client, CassandraClusterData.DeserializeCassandraClusterData(e)), CassandraClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCassandraClusters", "value", null, cancellationToken); - } - - /// - /// List all the mongo clusters in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters - /// - /// - /// Operation Id - /// MongoClusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMongoClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MongoClusterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MongoClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), MongoClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMongoClusters", "value", "nextLink", cancellationToken); - } - - /// - /// List all the mongo clusters in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/mongoClusters - /// - /// - /// Operation Id - /// MongoClusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMongoClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MongoClusterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MongoClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MongoClusterResource(Client, MongoClusterData.DeserializeMongoClusterData(e)), MongoClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMongoClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts - /// - /// - /// Operation Id - /// RestorableDatabaseAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRestorableCosmosDBAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RestorableCosmosDBAccountRestorableDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorableCosmosDBAccounts", "value", null, cancellationToken); - } - - /// - /// Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts - /// - /// - /// Operation Id - /// RestorableDatabaseAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRestorableCosmosDBAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RestorableCosmosDBAccountRestorableDatabaseAccountsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new RestorableCosmosDBAccountResource(Client, RestorableCosmosDBAccountData.DeserializeRestorableCosmosDBAccountData(e)), RestorableCosmosDBAccountRestorableDatabaseAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRestorableCosmosDBAccounts", "value", null, cancellationToken); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 30e33cc48028f..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,107 +0,0 @@ -// 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.CosmosDB -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _cosmosDBAccountDatabaseAccountsClientDiagnostics; - private DatabaseAccountsRestOperations _cosmosDBAccountDatabaseAccountsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics CosmosDBAccountDatabaseAccountsClientDiagnostics => _cosmosDBAccountDatabaseAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDB", CosmosDBAccountResource.ResourceType.Namespace, Diagnostics); - private DatabaseAccountsRestOperations CosmosDBAccountDatabaseAccountsRestClient => _cosmosDBAccountDatabaseAccountsRestClient ??= new DatabaseAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CosmosDBAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. - /// - /// - /// Request Path - /// /providers/Microsoft.DocumentDB/databaseAccountNames/{accountName} - /// - /// - /// Operation Id - /// DatabaseAccounts_CheckNameExists - /// - /// - /// - /// Cosmos DB database account name. - /// The cancellation token to use. - public virtual async Task> CheckNameExistsDatabaseAccountAsync(string accountName, CancellationToken cancellationToken = default) - { - using var scope = CosmosDBAccountDatabaseAccountsClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckNameExistsDatabaseAccount"); - scope.Start(); - try - { - var response = await CosmosDBAccountDatabaseAccountsRestClient.CheckNameExistsAsync(accountName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. - /// - /// - /// Request Path - /// /providers/Microsoft.DocumentDB/databaseAccountNames/{accountName} - /// - /// - /// Operation Id - /// DatabaseAccounts_CheckNameExists - /// - /// - /// - /// Cosmos DB database account name. - /// The cancellation token to use. - public virtual Response CheckNameExistsDatabaseAccount(string accountName, CancellationToken cancellationToken = default) - { - using var scope = CosmosDBAccountDatabaseAccountsClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckNameExistsDatabaseAccount"); - scope.Start(); - try - { - var response = CosmosDBAccountDatabaseAccountsRestClient.CheckNameExists(accountName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultResource.cs index 1b4e5c80018d8..b0be2ad6b6b16 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GraphResourceGetResultResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class GraphResourceGetResultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The graphName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string graphName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseResource.cs index 2bdd4c627dc8b..bc62bd5cb7ad6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class GremlinDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}"; @@ -99,7 +103,7 @@ public virtual GremlinDatabaseThroughputSettingResource GetGremlinDatabaseThroug /// An object representing collection of GremlinGraphResources and their operations over a GremlinGraphResource. public virtual GremlinGraphCollection GetGremlinGraphs() { - return GetCachedClient(Client => new GremlinGraphCollection(Client, Id)); + return GetCachedClient(client => new GremlinGraphCollection(client, Id)); } /// @@ -117,8 +121,8 @@ public virtual GremlinGraphCollection GetGremlinGraphs() /// /// Cosmos DB graph name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGremlinGraphAsync(string graphName, CancellationToken cancellationToken = default) { @@ -140,8 +144,8 @@ public virtual async Task> GetGremlinGraphAsync(s /// /// Cosmos DB graph name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGremlinGraph(string graphName, CancellationToken cancellationToken = default) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseThroughputSettingResource.cs index 1b327cdc885d4..727a36fee7ed8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseThroughputSettingResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class GremlinDatabaseThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphResource.cs index ae8c928485af2..cf13a297225c9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class GremlinGraphResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The graphName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string graphName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphThroughputSettingResource.cs index 903c98d29d163..8d0dfc9d33bf7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinGraphThroughputSettingResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class GremlinGraphThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The graphName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string graphName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs deleted file mode 100644 index c3eefe00ba272..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.Serialization.cs +++ /dev/null @@ -1,49 +0,0 @@ -// 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.CosmosDB.Models -{ - internal partial class BackupResourceProperties : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Timestamp)) - { - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp.Value, "O"); - } - writer.WriteEndObject(); - } - - internal static BackupResourceProperties DeserializeBackupResourceProperties(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional timestamp = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - } - return new BackupResourceProperties(Optional.ToNullable(timestamp)); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs deleted file mode 100644 index 4ebac73a40b33..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/BackupResourceProperties.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.CosmosDB.Models -{ - /// The BackupResourceProperties. - internal partial class BackupResourceProperties - { - /// Initializes a new instance of BackupResourceProperties. - public BackupResourceProperties() - { - } - - /// Initializes a new instance of BackupResourceProperties. - /// The time this backup was taken, formatted like 2021-01-21T17:35:21. - internal BackupResourceProperties(DateTimeOffset? timestamp) - { - Timestamp = timestamp; - } - - /// The time this backup was taken, formatted like 2021-01-21T17:35:21. - public DateTimeOffset? Timestamp { get; set; } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs deleted file mode 100644 index 6f2b4ee52dd72..0000000000000 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceData.Serialization.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.CosmosDB.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.CosmosDB -{ - public partial class CassandraClusterBackupResourceData : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Properties)) - { - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties); - } - writer.WriteEndObject(); - } - - internal static CassandraClusterBackupResourceData DeserializeCassandraClusterBackupResourceData(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional properties = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - Optional systemData = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - properties = BackupResourceProperties.DeserializeBackupResourceProperties(property.Value); - 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; - } - } - return new CassandraClusterBackupResourceData(id, name, type, systemData.Value, properties.Value); - } - } -} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.Serialization.cs new file mode 100644 index 0000000000000..e31e3bc49d4bb --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.Serialization.cs @@ -0,0 +1,74 @@ +// 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.CosmosDB.Models +{ + public partial class CassandraClusterBackupResourceInfo + { + internal static CassandraClusterBackupResourceInfo DeserializeCassandraClusterBackupResourceInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional backupId = default; + Optional backupState = default; + Optional backupStartTimestamp = default; + Optional backupStopTimestamp = default; + Optional backupExpiryTimestamp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("backupId"u8)) + { + backupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("backupState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupState = new CassandraClusterBackupState(property.Value.GetString()); + continue; + } + if (property.NameEquals("backupStartTimestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupStartTimestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("backupStopTimestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupStopTimestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("backupExpiryTimestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupExpiryTimestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new CassandraClusterBackupResourceInfo(backupId.Value, Optional.ToNullable(backupState), Optional.ToNullable(backupStartTimestamp), Optional.ToNullable(backupStopTimestamp), Optional.ToNullable(backupExpiryTimestamp)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.cs new file mode 100644 index 0000000000000..6b4e43864661a --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupResourceInfo.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// A restorable backup of a Cassandra cluster. + public partial class CassandraClusterBackupResourceInfo + { + /// Initializes a new instance of CassandraClusterBackupResourceInfo. + internal CassandraClusterBackupResourceInfo() + { + } + + /// Initializes a new instance of CassandraClusterBackupResourceInfo. + /// The unique identifier of backup. + /// The current state of the backup. + /// The time at which the backup process begins. + /// The time at which the backup process ends. + /// The time at which the backup will expire. + internal CassandraClusterBackupResourceInfo(string backupId, CassandraClusterBackupState? backupState, DateTimeOffset? backupStartTimestamp, DateTimeOffset? backupStopTimestamp, DateTimeOffset? backupExpiryTimestamp) + { + BackupId = backupId; + BackupState = backupState; + BackupStartTimestamp = backupStartTimestamp; + BackupStopTimestamp = backupStopTimestamp; + BackupExpiryTimestamp = backupExpiryTimestamp; + } + + /// The unique identifier of backup. + public string BackupId { get; } + /// The current state of the backup. + public CassandraClusterBackupState? BackupState { get; } + /// The time at which the backup process begins. + public DateTimeOffset? BackupStartTimestamp { get; } + /// The time at which the backup process ends. + public DateTimeOffset? BackupStopTimestamp { get; } + /// The time at which the backup will expire. + public DateTimeOffset? BackupExpiryTimestamp { get; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.Serialization.cs new file mode 100644 index 0000000000000..a2fc2dc843896 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + public partial class CassandraClusterBackupSchedule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ScheduleName)) + { + writer.WritePropertyName("scheduleName"u8); + writer.WriteStringValue(ScheduleName); + } + if (Optional.IsDefined(CronExpression)) + { + writer.WritePropertyName("cronExpression"u8); + writer.WriteStringValue(CronExpression); + } + if (Optional.IsDefined(RetentionInHours)) + { + writer.WritePropertyName("retentionInHours"u8); + writer.WriteNumberValue(RetentionInHours.Value); + } + writer.WriteEndObject(); + } + + internal static CassandraClusterBackupSchedule DeserializeCassandraClusterBackupSchedule(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional scheduleName = default; + Optional cronExpression = default; + Optional retentionInHours = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scheduleName"u8)) + { + scheduleName = property.Value.GetString(); + continue; + } + if (property.NameEquals("cronExpression"u8)) + { + cronExpression = property.Value.GetString(); + continue; + } + if (property.NameEquals("retentionInHours"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + retentionInHours = property.Value.GetInt32(); + continue; + } + } + return new CassandraClusterBackupSchedule(scheduleName.Value, cronExpression.Value, Optional.ToNullable(retentionInHours)); + } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.cs new file mode 100644 index 0000000000000..7276bb060849b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupSchedule.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The CassandraClusterBackupSchedule. + public partial class CassandraClusterBackupSchedule + { + /// Initializes a new instance of CassandraClusterBackupSchedule. + public CassandraClusterBackupSchedule() + { + } + + /// Initializes a new instance of CassandraClusterBackupSchedule. + /// The unique identifier of backup schedule. + /// The cron expression that defines when you want to back up your data. + /// The retention period (hours) of the backups. If you want to retain data forever, set retention to 0. + internal CassandraClusterBackupSchedule(string scheduleName, string cronExpression, int? retentionInHours) + { + ScheduleName = scheduleName; + CronExpression = cronExpression; + RetentionInHours = retentionInHours; + } + + /// The unique identifier of backup schedule. + public string ScheduleName { get; set; } + /// The cron expression that defines when you want to back up your data. + public string CronExpression { get; set; } + /// The retention period (hours) of the backups. If you want to retain data forever, set retention to 0. + public int? RetentionInHours { get; set; } + } +} diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupState.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupState.cs new file mode 100644 index 0000000000000..ba4188c7a3012 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterBackupState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// The current state of the backup. + public readonly partial struct CassandraClusterBackupState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CassandraClusterBackupState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InitiatedValue = "Initiated"; + private const string InProgressValue = "InProgress"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + + /// Initiated. + public static CassandraClusterBackupState Initiated { get; } = new CassandraClusterBackupState(InitiatedValue); + /// InProgress. + public static CassandraClusterBackupState InProgress { get; } = new CassandraClusterBackupState(InProgressValue); + /// Succeeded. + public static CassandraClusterBackupState Succeeded { get; } = new CassandraClusterBackupState(SucceededValue); + /// Failed. + public static CassandraClusterBackupState Failed { get; } = new CassandraClusterBackupState(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(CassandraClusterBackupState left, CassandraClusterBackupState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CassandraClusterBackupState left, CassandraClusterBackupState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CassandraClusterBackupState(string value) => new CassandraClusterBackupState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CassandraClusterBackupState other && Equals(other); + /// + public bool Equals(CassandraClusterBackupState 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs index 4559539d64a1a..317b2da083f01 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.Serialization.cs @@ -37,6 +37,7 @@ internal static CassandraClusterDataCenterNodeItem DeserializeCassandraClusterDa Optional memoryFreeKB = default; Optional memoryTotalKB = default; Optional cpuUsage = default; + Optional isLatestModel = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("address"u8)) @@ -173,8 +174,17 @@ internal static CassandraClusterDataCenterNodeItem DeserializeCassandraClusterDa cpuUsage = property.Value.GetDouble(); continue; } + if (property.NameEquals("isLatestModel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isLatestModel = property.Value.GetBoolean(); + continue; + } } - return new CassandraClusterDataCenterNodeItem(address.Value, Optional.ToNullable(state), status.Value, cassandraProcessStatus.Value, load.Value, Optional.ToList(tokens), Optional.ToNullable(size), Optional.ToNullable(hostId), rack.Value, timestamp.Value, Optional.ToNullable(diskUsedKB), Optional.ToNullable(diskFreeKB), Optional.ToNullable(memoryUsedKB), Optional.ToNullable(memoryBuffersAndCachedKB), Optional.ToNullable(memoryFreeKB), Optional.ToNullable(memoryTotalKB), Optional.ToNullable(cpuUsage)); + return new CassandraClusterDataCenterNodeItem(address.Value, Optional.ToNullable(state), status.Value, cassandraProcessStatus.Value, load.Value, Optional.ToList(tokens), Optional.ToNullable(size), Optional.ToNullable(hostId), rack.Value, timestamp.Value, Optional.ToNullable(diskUsedKB), Optional.ToNullable(diskFreeKB), Optional.ToNullable(memoryUsedKB), Optional.ToNullable(memoryBuffersAndCachedKB), Optional.ToNullable(memoryFreeKB), Optional.ToNullable(memoryTotalKB), Optional.ToNullable(cpuUsage), Optional.ToNullable(isLatestModel)); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs index a1ee7125f2ccc..2263897d088d6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterDataCenterNodeItem.cs @@ -38,7 +38,8 @@ internal CassandraClusterDataCenterNodeItem() /// Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. /// Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. /// A float representing the current system-wide CPU utilization as a percentage. - internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? state, string status, string cassandraProcessStatus, string load, IReadOnlyList tokens, int? size, Guid? hostId, string rack, string timestamp, long? diskUsedKB, long? diskFreeKB, long? memoryUsedKB, long? memoryBuffersAndCachedKB, long? memoryFreeKB, long? memoryTotalKB, double? cpuUsage) + /// If node has been updated to latest model. + internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? state, string status, string cassandraProcessStatus, string load, IReadOnlyList tokens, int? size, Guid? hostId, string rack, string timestamp, long? diskUsedKB, long? diskFreeKB, long? memoryUsedKB, long? memoryBuffersAndCachedKB, long? memoryFreeKB, long? memoryTotalKB, double? cpuUsage, bool? isLatestModel) { Address = address; State = state; @@ -57,6 +58,7 @@ internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? MemoryFreeKB = memoryFreeKB; MemoryTotalKB = memoryTotalKB; CpuUsage = cpuUsage; + IsLatestModel = isLatestModel; } /// The node's IP address. @@ -93,5 +95,7 @@ internal CassandraClusterDataCenterNodeItem(string address, CassandraNodeState? public long? MemoryTotalKB { get; } /// A float representing the current system-wide CPU utilization as a percentage. public double? CpuUsage { get; } + /// If node has been updated to latest model. + public bool? IsLatestModel { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs index e388325d8e83f..8cbe86ba80390 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.Serialization.cs @@ -106,11 +106,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("cassandraAuditLoggingEnabled"u8); writer.WriteBooleanValue(IsCassandraAuditLoggingEnabled.Value); } + if (Optional.IsDefined(ClusterType)) + { + writer.WritePropertyName("clusterType"u8); + writer.WriteStringValue(ClusterType.Value.ToString()); + } if (Optional.IsDefined(ProvisionError)) { writer.WritePropertyName("provisionError"u8); writer.WriteObjectValue(ProvisionError); } + if (Optional.IsCollectionDefined(Extensions)) + { + writer.WritePropertyName("extensions"u8); + writer.WriteStartArray(); + foreach (var item in Extensions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(BackupSchedules)) + { + writer.WritePropertyName("backupSchedules"u8); + writer.WriteStartArray(); + foreach (var item in BackupSchedules) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } writer.WriteEndObject(); } @@ -137,7 +162,10 @@ internal static CassandraClusterProperties DeserializeCassandraClusterProperties Optional hoursBetweenBackups = default; Optional deallocated = default; Optional cassandraAuditLoggingEnabled = default; + Optional clusterType = default; Optional provisionError = default; + Optional> extensions = default; + Optional> backupSchedules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -302,6 +330,15 @@ internal static CassandraClusterProperties DeserializeCassandraClusterProperties cassandraAuditLoggingEnabled = property.Value.GetBoolean(); continue; } + if (property.NameEquals("clusterType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterType = new CassandraClusterType(property.Value.GetString()); + continue; + } if (property.NameEquals("provisionError"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -311,8 +348,36 @@ internal static CassandraClusterProperties DeserializeCassandraClusterProperties provisionError = CassandraError.DeserializeCassandraError(property.Value); continue; } + if (property.NameEquals("extensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + extensions = array; + continue; + } + if (property.NameEquals("backupSchedules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CassandraClusterBackupSchedule.DeserializeCassandraClusterBackupSchedule(item)); + } + backupSchedules = array; + continue; + } } - return new CassandraClusterProperties(Optional.ToNullable(provisioningState), restoreFromBackupId.Value, delegatedManagementSubnetId.Value, cassandraVersion.Value, clusterNameOverride.Value, Optional.ToNullable(authenticationMethod), initialCassandraAdminPassword.Value, prometheusEndpoint.Value, Optional.ToNullable(repairEnabled), Optional.ToList(clientCertificates), Optional.ToList(externalGossipCertificates), Optional.ToList(gossipCertificates), Optional.ToList(externalSeedNodes), Optional.ToList(seedNodes), Optional.ToNullable(hoursBetweenBackups), Optional.ToNullable(deallocated), Optional.ToNullable(cassandraAuditLoggingEnabled), provisionError.Value); + return new CassandraClusterProperties(Optional.ToNullable(provisioningState), restoreFromBackupId.Value, delegatedManagementSubnetId.Value, cassandraVersion.Value, clusterNameOverride.Value, Optional.ToNullable(authenticationMethod), initialCassandraAdminPassword.Value, prometheusEndpoint.Value, Optional.ToNullable(repairEnabled), Optional.ToList(clientCertificates), Optional.ToList(externalGossipCertificates), Optional.ToList(gossipCertificates), Optional.ToList(externalSeedNodes), Optional.ToList(seedNodes), Optional.ToNullable(hoursBetweenBackups), Optional.ToNullable(deallocated), Optional.ToNullable(cassandraAuditLoggingEnabled), Optional.ToNullable(clusterType), provisionError.Value, Optional.ToList(extensions), Optional.ToList(backupSchedules)); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs index eb9ad28e5a7c8..e3a8fb2bfe174 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterProperties.cs @@ -21,6 +21,8 @@ public CassandraClusterProperties() GossipCertificates = new ChangeTrackingList(); ExternalSeedNodes = new ChangeTrackingList(); SeedNodes = new ChangeTrackingList(); + Extensions = new ChangeTrackingList(); + BackupSchedules = new ChangeTrackingList(); } /// Initializes a new instance of CassandraClusterProperties. @@ -41,8 +43,11 @@ public CassandraClusterProperties() /// (Deprecated) Number of hours to wait between taking a backup of the cluster. /// Whether the cluster and associated data centers has been deallocated. /// Whether Cassandra audit logging is enabled. + /// Type of the cluster. If set to Production, some operations might not be permitted on cluster. /// Error related to resource provisioning. - internal CassandraClusterProperties(CassandraProvisioningState? provisioningState, string restoreFromBackupId, ResourceIdentifier delegatedManagementSubnetId, string cassandraVersion, string clusterNameOverride, CassandraAuthenticationMethod? authenticationMethod, string initialCassandraAdminPassword, CassandraDataCenterSeedNode prometheusEndpoint, bool? isRepairEnabled, IList clientCertificates, IList externalGossipCertificates, IReadOnlyList gossipCertificates, IList externalSeedNodes, IReadOnlyList seedNodes, int? hoursBetweenBackups, bool? isDeallocated, bool? isCassandraAuditLoggingEnabled, CassandraError provisionError) + /// Extensions to be added or updated on cluster. + /// List of backup schedules that define when you want to back up your data. + internal CassandraClusterProperties(CassandraProvisioningState? provisioningState, string restoreFromBackupId, ResourceIdentifier delegatedManagementSubnetId, string cassandraVersion, string clusterNameOverride, CassandraAuthenticationMethod? authenticationMethod, string initialCassandraAdminPassword, CassandraDataCenterSeedNode prometheusEndpoint, bool? isRepairEnabled, IList clientCertificates, IList externalGossipCertificates, IReadOnlyList gossipCertificates, IList externalSeedNodes, IReadOnlyList seedNodes, int? hoursBetweenBackups, bool? isDeallocated, bool? isCassandraAuditLoggingEnabled, CassandraClusterType? clusterType, CassandraError provisionError, IList extensions, IList backupSchedules) { ProvisioningState = provisioningState; RestoreFromBackupId = restoreFromBackupId; @@ -61,7 +66,10 @@ internal CassandraClusterProperties(CassandraProvisioningState? provisioningStat HoursBetweenBackups = hoursBetweenBackups; IsDeallocated = isDeallocated; IsCassandraAuditLoggingEnabled = isCassandraAuditLoggingEnabled; + ClusterType = clusterType; ProvisionError = provisionError; + Extensions = extensions; + BackupSchedules = backupSchedules; } /// The status of the resource at the time the operation was called. @@ -110,7 +118,13 @@ public string PrometheusEndpointIPAddress public bool? IsDeallocated { get; set; } /// Whether Cassandra audit logging is enabled. public bool? IsCassandraAuditLoggingEnabled { get; set; } + /// Type of the cluster. If set to Production, some operations might not be permitted on cluster. + public CassandraClusterType? ClusterType { get; set; } /// Error related to resource provisioning. public CassandraError ProvisionError { get; set; } + /// Extensions to be added or updated on cluster. + public IList Extensions { get; } + /// List of backup schedules that define when you want to back up your data. + public IList BackupSchedules { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterType.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterType.cs new file mode 100644 index 0000000000000..350b95552df03 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CassandraClusterType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Type of the cluster. If set to Production, some operations might not be permitted on cluster. + public readonly partial struct CassandraClusterType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CassandraClusterType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ProductionValue = "Production"; + private const string NonProductionValue = "NonProduction"; + + /// Production. + public static CassandraClusterType Production { get; } = new CassandraClusterType(ProductionValue); + /// NonProduction. + public static CassandraClusterType NonProduction { get; } = new CassandraClusterType(NonProductionValue); + /// Determines if two values are the same. + public static bool operator ==(CassandraClusterType left, CassandraClusterType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CassandraClusterType left, CassandraClusterType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CassandraClusterType(string value) => new CassandraClusterType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CassandraClusterType other && Equals(other); + /// + public bool Equals(CassandraClusterType 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs index bbcb69a41a876..5d93d78bf5fa8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.Serialization.cs @@ -19,6 +19,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(KeyspaceName); writer.WritePropertyName("tableName"u8); writer.WriteStringValue(TableName); + if (Optional.IsDefined(RemoteAccountName)) + { + writer.WritePropertyName("remoteAccountName"u8); + writer.WriteStringValue(RemoteAccountName); + } writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); writer.WriteEndObject(); @@ -32,6 +37,7 @@ internal static CosmosCassandraDataTransferDataSourceSink DeserializeCosmosCassa } string keyspaceName = default; string tableName = default; + Optional remoteAccountName = default; DataTransferComponent component = default; foreach (var property in element.EnumerateObject()) { @@ -45,13 +51,18 @@ internal static CosmosCassandraDataTransferDataSourceSink DeserializeCosmosCassa tableName = property.Value.GetString(); continue; } + if (property.NameEquals("remoteAccountName"u8)) + { + remoteAccountName = property.Value.GetString(); + continue; + } if (property.NameEquals("component"u8)) { component = new DataTransferComponent(property.Value.GetString()); continue; } } - return new CosmosCassandraDataTransferDataSourceSink(component, keyspaceName, tableName); + return new CosmosCassandraDataTransferDataSourceSink(component, keyspaceName, tableName, remoteAccountName.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs index d9eec6cc215b0..e2723b4a369e8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosCassandraDataTransferDataSourceSink.cs @@ -31,10 +31,12 @@ public CosmosCassandraDataTransferDataSourceSink(string keyspaceName, string tab /// /// /// - internal CosmosCassandraDataTransferDataSourceSink(DataTransferComponent component, string keyspaceName, string tableName) : base(component) + /// + internal CosmosCassandraDataTransferDataSourceSink(DataTransferComponent component, string keyspaceName, string tableName, string remoteAccountName) : base(component) { KeyspaceName = keyspaceName; TableName = tableName; + RemoteAccountName = remoteAccountName; Component = component; } @@ -42,5 +44,7 @@ internal CosmosCassandraDataTransferDataSourceSink(DataTransferComponent compone public string KeyspaceName { get; set; } /// Gets or sets the table name. public string TableName { get; set; } + /// Gets or sets the remote account name. + public string RemoteAccountName { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs index 952ffdab53a71..0f50156197e95 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.Serialization.cs @@ -233,6 +233,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"u8); writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } + if (Optional.IsDefined(CustomerManagedKeyStatus)) + { + writer.WritePropertyName("customerManagedKeyStatus"u8); + writer.WriteStringValue(CustomerManagedKeyStatus.Value.ToString()); + } + if (Optional.IsDefined(EnablePriorityBasedExecution)) + { + writer.WritePropertyName("enablePriorityBasedExecution"u8); + writer.WriteBooleanValue(EnablePriorityBasedExecution.Value); + } + if (Optional.IsDefined(DefaultPriorityLevel)) + { + writer.WritePropertyName("defaultPriorityLevel"u8); + writer.WriteStringValue(DefaultPriorityLevel.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -284,6 +299,9 @@ internal static CosmosDBAccountCreateOrUpdateContent DeserializeCosmosDBAccountC Optional enablePartitionMerge = default; Optional enableBurstCapacity = default; Optional minimalTlsVersion = default; + Optional customerManagedKeyStatus = default; + Optional enablePriorityBasedExecution = default; + Optional defaultPriorityLevel = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -679,11 +697,38 @@ internal static CosmosDBAccountCreateOrUpdateContent DeserializeCosmosDBAccountC minimalTlsVersion = new CosmosDBMinimalTlsVersion(property0.Value.GetString()); continue; } + if (property0.NameEquals("customerManagedKeyStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customerManagedKeyStatus = new CustomerManagedKeyStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enablePriorityBasedExecution"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enablePriorityBasedExecution = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("defaultPriorityLevel"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultPriorityLevel = new DefaultPriorityLevel(property0.Value.GetString()); + continue; + } } continue; } } - return new CosmosDBAccountCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(createMode), backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), restoreParameters.Value, capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), identity); + return new CosmosDBAccountCreateOrUpdateContent(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), consistencyPolicy.Value, locations, databaseAccountOfferType, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), Optional.ToList(capabilities), Optional.ToList(virtualNetworkRules), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(createMode), backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), restoreParameters.Value, capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), Optional.ToNullable(customerManagedKeyStatus), Optional.ToNullable(enablePriorityBasedExecution), Optional.ToNullable(defaultPriorityLevel), identity); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs index cbd4b75abefb8..a7d1263e93154 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountCreateOrUpdateContent.cs @@ -78,8 +78,11 @@ public CosmosDBAccountCreateOrUpdateContent(AzureLocation location, IEnumerable< /// Flag to indicate enabling/disabling of Partition Merge feature on the account. /// Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + /// Enum to indicate default Priority Level of request for Priority Based Execution. /// Identity for the resource. - internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, CosmosDBAccountOfferType databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, CosmosDBAccountCreateMode? createMode, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CosmosDBAccountKind? kind, ConsistencyPolicy consistencyPolicy, IList locations, CosmosDBAccountOfferType databaseAccountOfferType, IList ipRules, bool? isVirtualNetworkFilterEnabled, bool? enableAutomaticFailover, IList capabilities, IList virtualNetworkRules, bool? enableMultipleWriteLocations, bool? enableCassandraConnector, ConnectorOffer? connectorOffer, bool? disableKeyBasedMetadataWriteAccess, Uri keyVaultKeyUri, string defaultIdentity, CosmosDBPublicNetworkAccess? publicNetworkAccess, bool? isFreeTierEnabled, ApiProperties apiProperties, bool? isAnalyticalStorageEnabled, AnalyticalStorageConfiguration analyticalStorageConfiguration, CosmosDBAccountCreateMode? createMode, CosmosDBAccountBackupPolicy backupPolicy, IList cors, NetworkAclBypass? networkAclBypass, IList networkAclBypassResourceIds, DiagnosticLogSettings diagnosticLogSettings, bool? disableLocalAuth, CosmosDBAccountRestoreParameters restoreParameters, CosmosDBAccountCapacity capacity, bool? enableMaterializedViews, DatabaseAccountKeysMetadata keysMetadata, bool? enablePartitionMerge, bool? enableBurstCapacity, CosmosDBMinimalTlsVersion? minimalTlsVersion, CustomerManagedKeyStatus? customerManagedKeyStatus, bool? enablePriorityBasedExecution, DefaultPriorityLevel? defaultPriorityLevel, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) { Kind = kind; ConsistencyPolicy = consistencyPolicy; @@ -115,6 +118,9 @@ internal CosmosDBAccountCreateOrUpdateContent(ResourceIdentifier id, string name EnablePartitionMerge = enablePartitionMerge; EnableBurstCapacity = enableBurstCapacity; MinimalTlsVersion = minimalTlsVersion; + CustomerManagedKeyStatus = customerManagedKeyStatus; + EnablePriorityBasedExecution = enablePriorityBasedExecution; + DefaultPriorityLevel = defaultPriorityLevel; Identity = identity; } @@ -236,6 +242,12 @@ public int? CapacityTotalThroughputLimit public bool? EnableBurstCapacity { get; set; } /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. public CosmosDBMinimalTlsVersion? MinimalTlsVersion { get; set; } + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + public CustomerManagedKeyStatus? CustomerManagedKeyStatus { get; set; } + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + public bool? EnablePriorityBasedExecution { get; set; } + /// Enum to indicate default Priority Level of request for Priority Based Execution. + public DefaultPriorityLevel? DefaultPriorityLevel { get; set; } /// Identity for the resource. public ManagedServiceIdentity Identity { get; set; } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs index f47aaff16686d..dfa460d24d77b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountData.Serialization.cs @@ -225,6 +225,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"u8); writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } + if (Optional.IsDefined(CustomerManagedKeyStatus)) + { + writer.WritePropertyName("customerManagedKeyStatus"u8); + writer.WriteStringValue(CustomerManagedKeyStatus.Value.ToString()); + } + if (Optional.IsDefined(EnablePriorityBasedExecution)) + { + writer.WritePropertyName("enablePriorityBasedExecution"u8); + writer.WriteBooleanValue(EnablePriorityBasedExecution.Value); + } + if (Optional.IsDefined(DefaultPriorityLevel)) + { + writer.WritePropertyName("defaultPriorityLevel"u8); + writer.WriteStringValue(DefaultPriorityLevel.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -283,6 +298,9 @@ internal static CosmosDBAccountData DeserializeCosmosDBAccountData(JsonElement e Optional enablePartitionMerge = default; Optional enableBurstCapacity = default; Optional minimalTlsVersion = default; + Optional customerManagedKeyStatus = default; + Optional enablePriorityBasedExecution = default; + Optional defaultPriorityLevel = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind"u8)) @@ -761,11 +779,38 @@ internal static CosmosDBAccountData DeserializeCosmosDBAccountData(JsonElement e minimalTlsVersion = new CosmosDBMinimalTlsVersion(property0.Value.GetString()); continue; } + if (property0.NameEquals("customerManagedKeyStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customerManagedKeyStatus = new CustomerManagedKeyStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("enablePriorityBasedExecution"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enablePriorityBasedExecution = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("defaultPriorityLevel"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultPriorityLevel = new DefaultPriorityLevel(property0.Value.GetString()); + continue; + } } continue; } } - return new CosmosDBAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, Optional.ToNullable(databaseAccountOfferType), Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(instanceId), Optional.ToNullable(createMode), restoreParameters.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), identity); + return new CosmosDBAccountData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), provisioningState.Value, documentEndpoint.Value, Optional.ToNullable(databaseAccountOfferType), Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, Optional.ToNullable(instanceId), Optional.ToNullable(createMode), restoreParameters.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), diagnosticLogSettings.Value, Optional.ToNullable(disableLocalAuth), capacity.Value, Optional.ToNullable(enableMaterializedViews), keysMetadata.Value, Optional.ToNullable(enablePartitionMerge), Optional.ToNullable(enableBurstCapacity), Optional.ToNullable(minimalTlsVersion), Optional.ToNullable(customerManagedKeyStatus), Optional.ToNullable(enablePriorityBasedExecution), Optional.ToNullable(defaultPriorityLevel), identity); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs index d138e308f1fe9..963d220e1d555 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.Serialization.cs @@ -220,6 +220,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"u8); writer.WriteStringValue(MinimalTlsVersion.Value.ToString()); } + if (Optional.IsDefined(CustomerManagedKeyStatus)) + { + writer.WritePropertyName("customerManagedKeyStatus"u8); + writer.WriteStringValue(CustomerManagedKeyStatus.Value.ToString()); + } + if (Optional.IsDefined(EnablePriorityBasedExecution)) + { + writer.WritePropertyName("enablePriorityBasedExecution"u8); + writer.WriteBooleanValue(EnablePriorityBasedExecution.Value); + } + if (Optional.IsDefined(DefaultPriorityLevel)) + { + writer.WritePropertyName("defaultPriorityLevel"u8); + writer.WriteStringValue(DefaultPriorityLevel.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs index 1f7fb92e08083..67c99f490208b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBAccountPatch.cs @@ -145,5 +145,11 @@ public int? CapacityTotalThroughputLimit public bool? EnableBurstCapacity { get; set; } /// Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. public CosmosDBMinimalTlsVersion? MinimalTlsVersion { get; set; } + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + public CustomerManagedKeyStatus? CustomerManagedKeyStatus { get; set; } + /// Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. + public bool? EnablePriorityBasedExecution { get; set; } + /// Enum to indicate default Priority Level of request for Priority Based Execution. + public DefaultPriorityLevel? DefaultPriorityLevel { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs index 5889e9c32a66b..8befbd2e4b59b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBCreateUpdateConfig.cs @@ -17,7 +17,7 @@ public CosmosDBCreateUpdateConfig() /// Initializes a new instance of CosmosDBCreateUpdateConfig. /// Request Units per second. For example, "throughput": 10000. - /// Specifies the Autoscale settings. + /// Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but not both. internal CosmosDBCreateUpdateConfig(int? throughput, AutoscaleSettings autoscaleSettings) { Throughput = throughput; @@ -26,7 +26,7 @@ internal CosmosDBCreateUpdateConfig(int? throughput, AutoscaleSettings autoscale /// Request Units per second. For example, "throughput": 10000. public int? Throughput { get; set; } - /// Specifies the Autoscale settings. + /// Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but not both. internal AutoscaleSettings AutoscaleSettings { get; set; } /// Represents maximum throughput, the resource can scale up to. public int? AutoscaleMaxThroughput diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPublicNetworkAccess.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPublicNetworkAccess.cs index 3346e43901f65..9343a56a4f7bf 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPublicNetworkAccess.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosDBPublicNetworkAccess.cs @@ -24,11 +24,14 @@ public CosmosDBPublicNetworkAccess(string value) private const string EnabledValue = "Enabled"; private const string DisabledValue = "Disabled"; + private const string SecuredByPerimeterValue = "SecuredByPerimeter"; /// Enabled. public static CosmosDBPublicNetworkAccess Enabled { get; } = new CosmosDBPublicNetworkAccess(EnabledValue); /// Disabled. public static CosmosDBPublicNetworkAccess Disabled { get; } = new CosmosDBPublicNetworkAccess(DisabledValue); + /// SecuredByPerimeter. + public static CosmosDBPublicNetworkAccess SecuredByPerimeter { get; } = new CosmosDBPublicNetworkAccess(SecuredByPerimeterValue); /// Determines if two values are the same. public static bool operator ==(CosmosDBPublicNetworkAccess left, CosmosDBPublicNetworkAccess right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs index 77100d389fd98..3d71e14fae9f8 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.Serialization.cs @@ -19,6 +19,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DatabaseName); writer.WritePropertyName("collectionName"u8); writer.WriteStringValue(CollectionName); + if (Optional.IsDefined(RemoteAccountName)) + { + writer.WritePropertyName("remoteAccountName"u8); + writer.WriteStringValue(RemoteAccountName); + } writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); writer.WriteEndObject(); @@ -32,6 +37,7 @@ internal static CosmosMongoDataTransferDataSourceSink DeserializeCosmosMongoData } string databaseName = default; string collectionName = default; + Optional remoteAccountName = default; DataTransferComponent component = default; foreach (var property in element.EnumerateObject()) { @@ -45,13 +51,18 @@ internal static CosmosMongoDataTransferDataSourceSink DeserializeCosmosMongoData collectionName = property.Value.GetString(); continue; } + if (property.NameEquals("remoteAccountName"u8)) + { + remoteAccountName = property.Value.GetString(); + continue; + } if (property.NameEquals("component"u8)) { component = new DataTransferComponent(property.Value.GetString()); continue; } } - return new CosmosMongoDataTransferDataSourceSink(component, databaseName, collectionName); + return new CosmosMongoDataTransferDataSourceSink(component, databaseName, collectionName, remoteAccountName.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs index e6277f0c865c9..e0658195003a9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosMongoDataTransferDataSourceSink.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CosmosDB.Models { - /// A CosmosDB Cassandra API data source/sink. + /// A CosmosDB Mongo API data source/sink. public partial class CosmosMongoDataTransferDataSourceSink : DataTransferDataSourceSink { /// Initializes a new instance of CosmosMongoDataTransferDataSourceSink. @@ -31,10 +31,12 @@ public CosmosMongoDataTransferDataSourceSink(string databaseName, string collect /// /// /// - internal CosmosMongoDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string collectionName) : base(component) + /// + internal CosmosMongoDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string collectionName, string remoteAccountName) : base(component) { DatabaseName = databaseName; CollectionName = collectionName; + RemoteAccountName = remoteAccountName; Component = component; } @@ -42,5 +44,7 @@ internal CosmosMongoDataTransferDataSourceSink(DataTransferComponent component, public string DatabaseName { get; set; } /// Gets or sets the collection name. public string CollectionName { get; set; } + /// Gets or sets the remote account name. + public string RemoteAccountName { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs index 8b29a34e28eb1..0698f8cde79a9 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.Serialization.cs @@ -19,6 +19,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(DatabaseName); writer.WritePropertyName("containerName"u8); writer.WriteStringValue(ContainerName); + if (Optional.IsDefined(RemoteAccountName)) + { + writer.WritePropertyName("remoteAccountName"u8); + writer.WriteStringValue(RemoteAccountName); + } writer.WritePropertyName("component"u8); writer.WriteStringValue(Component.ToString()); writer.WriteEndObject(); @@ -32,6 +37,7 @@ internal static CosmosSqlDataTransferDataSourceSink DeserializeCosmosSqlDataTran } string databaseName = default; string containerName = default; + Optional remoteAccountName = default; DataTransferComponent component = default; foreach (var property in element.EnumerateObject()) { @@ -45,13 +51,18 @@ internal static CosmosSqlDataTransferDataSourceSink DeserializeCosmosSqlDataTran containerName = property.Value.GetString(); continue; } + if (property.NameEquals("remoteAccountName"u8)) + { + remoteAccountName = property.Value.GetString(); + continue; + } if (property.NameEquals("component"u8)) { component = new DataTransferComponent(property.Value.GetString()); continue; } } - return new CosmosSqlDataTransferDataSourceSink(component, databaseName, containerName); + return new CosmosSqlDataTransferDataSourceSink(component, databaseName, containerName, remoteAccountName.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs index a7fb15827cfcc..609372f99aadb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CosmosSqlDataTransferDataSourceSink.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CosmosDB.Models { - /// A CosmosDB Cassandra API data source/sink. + /// A CosmosDB No Sql API data source/sink. public partial class CosmosSqlDataTransferDataSourceSink : DataTransferDataSourceSink { /// Initializes a new instance of CosmosSqlDataTransferDataSourceSink. @@ -31,10 +31,12 @@ public CosmosSqlDataTransferDataSourceSink(string databaseName, string container /// /// /// - internal CosmosSqlDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string containerName) : base(component) + /// + internal CosmosSqlDataTransferDataSourceSink(DataTransferComponent component, string databaseName, string containerName, string remoteAccountName) : base(component) { DatabaseName = databaseName; ContainerName = containerName; + RemoteAccountName = remoteAccountName; Component = component; } @@ -42,5 +44,7 @@ internal CosmosSqlDataTransferDataSourceSink(DataTransferComponent component, st public string DatabaseName { get; set; } /// Gets or sets the container name. public string ContainerName { get; set; } + /// Gets or sets the remote account name. + public string RemoteAccountName { get; set; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CustomerManagedKeyStatus.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CustomerManagedKeyStatus.cs new file mode 100644 index 0000000000000..f2a97df6afe80 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/CustomerManagedKeyStatus.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. + public readonly partial struct CustomerManagedKeyStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CustomerManagedKeyStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000Value = "Access to your account is currently revoked because the Azure Cosmos DB service is unable to obtain the AAD authentication token for the account's default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-active-directory-token-acquisition-error (4000)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyUriDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultUriProperty4006Value = "Access to your account is currently revoked because the Azure Cosmos DB account's key vault key URI does not follow the expected format; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#improper-syntax-detected-on-the-key-vault-uri-property (4006)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002Value = "Access to your account is currently revoked because the current default identity no longer has permission to the associated Key Vault key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#default-identity-is-unauthorized-to-access-the-azure-key-vault-key (4002)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDnsNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009Value = "Access to your account is currently revoked because the Azure Key Vault DNS name specified by the account's keyvaultkeyuri property could not be resolved; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#unable-to-resolve-the-key-vaults-dns (4009)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003Value = "Access to your account is currently revoked because the correspondent key is not found on the specified Key Vault; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4003)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInternalUnwrappingProcedureError4005Value = "Access to your account is currently revoked because the Azure Cosmos DB service is unable to wrap or unwrap the key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#internal-unwrapping-procedure-error (4005)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInvalidAzureCosmosDBDefaultIdentity4015Value = "Access to your account is currently revoked because the Azure Cosmos DB account has an undefined default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#invalid-azure-cosmos-db-default-identity (4015)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide4016Value = "Access to your account is currently revoked because the access rules are blocking outbound requests to the Azure Key Vault service; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide (4016)."; + private const string AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017Value = "Access to your account is currently revoked because the correspondent Azure Key Vault was not found; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4017)."; + private const string AccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideValue = "Access to your account is currently revoked; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide"; + private const string AccessToTheConfiguredCustomerManagedKeyConfirmedValue = "Access to the configured customer managed key confirmed."; + + /// Access to your account is currently revoked because the Azure Cosmos DB service is unable to obtain the AAD authentication token for the account's default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-active-directory-token-acquisition-error (4000). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000Value); + /// Access to your account is currently revoked because the Azure Cosmos DB account's key vault key URI does not follow the expected format; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#improper-syntax-detected-on-the-key-vault-uri-property (4006). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyUriDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultUriProperty4006 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyUriDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultUriProperty4006Value); + /// Access to your account is currently revoked because the current default identity no longer has permission to the associated Key Vault key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#default-identity-is-unauthorized-to-access-the-azure-key-vault-key (4002). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002Value); + /// Access to your account is currently revoked because the Azure Key Vault DNS name specified by the account's keyvaultkeyuri property could not be resolved; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#unable-to-resolve-the-key-vaults-dns (4009). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDnsNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDnsNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009Value); + /// Access to your account is currently revoked because the correspondent key is not found on the specified Key Vault; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4003). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003Value); + /// Access to your account is currently revoked because the Azure Cosmos DB service is unable to wrap or unwrap the key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#internal-unwrapping-procedure-error (4005). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInternalUnwrappingProcedureError4005 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInternalUnwrappingProcedureError4005Value); + /// Access to your account is currently revoked because the Azure Cosmos DB account has an undefined default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#invalid-azure-cosmos-db-default-identity (4015). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInvalidAzureCosmosDBDefaultIdentity4015 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideInvalidAzureCosmosDBDefaultIdentity4015Value); + /// Access to your account is currently revoked because the access rules are blocking outbound requests to the Azure Key Vault service; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide (4016). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide4016 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide4016Value); + /// Access to your account is currently revoked because the correspondent Azure Key Vault was not found; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4017). + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017 { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017Value); + /// Access to your account is currently revoked; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide. + public static CustomerManagedKeyStatus AccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuide { get; } = new CustomerManagedKeyStatus(AccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHttpsLearnMicrosoftComEnUsAzureCosmosDBCmkTroubleshootingGuideValue); + /// Access to the configured customer managed key confirmed. + public static CustomerManagedKeyStatus AccessToTheConfiguredCustomerManagedKeyConfirmed { get; } = new CustomerManagedKeyStatus(AccessToTheConfiguredCustomerManagedKeyConfirmedValue); + /// Determines if two values are the same. + public static bool operator ==(CustomerManagedKeyStatus left, CustomerManagedKeyStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CustomerManagedKeyStatus left, CustomerManagedKeyStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CustomerManagedKeyStatus(string value) => new CustomerManagedKeyStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CustomerManagedKeyStatus other && Equals(other); + /// + public bool Equals(CustomerManagedKeyStatus 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultPriorityLevel.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultPriorityLevel.cs new file mode 100644 index 0000000000000..a01616b697b9b --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/DefaultPriorityLevel.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CosmosDB.Models +{ + /// Enum to indicate default priorityLevel of requests. + public readonly partial struct DefaultPriorityLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DefaultPriorityLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HighValue = "High"; + private const string LowValue = "Low"; + + /// High. + public static DefaultPriorityLevel High { get; } = new DefaultPriorityLevel(HighValue); + /// Low. + public static DefaultPriorityLevel Low { get; } = new DefaultPriorityLevel(LowValue); + /// Determines if two values are the same. + public static bool operator ==(DefaultPriorityLevel left, DefaultPriorityLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DefaultPriorityLevel left, DefaultPriorityLevel right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DefaultPriorityLevel(string value) => new DefaultPriorityLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DefaultPriorityLevel other && Equals(other); + /// + public bool Equals(DefaultPriorityLevel 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs index 281833e226674..3d5ab3eb49ff0 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.Serialization.cs @@ -42,6 +42,8 @@ internal static ExtendedThroughputSettingsResourceInfo DeserializeExtendedThroug Optional autoscaleSettings = default; Optional minimumThroughput = default; Optional offerReplacePending = default; + Optional instantMaximumThroughput = default; + Optional softAllowedMaximumThroughput = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("_rid"u8)) @@ -95,8 +97,18 @@ internal static ExtendedThroughputSettingsResourceInfo DeserializeExtendedThroug offerReplacePending = property.Value.GetString(); continue; } + if (property.NameEquals("instantMaximumThroughput"u8)) + { + instantMaximumThroughput = property.Value.GetString(); + continue; + } + if (property.NameEquals("softAllowedMaximumThroughput"u8)) + { + softAllowedMaximumThroughput = property.Value.GetString(); + continue; + } } - return new ExtendedThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); + return new ExtendedThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, instantMaximumThroughput.Value, softAllowedMaximumThroughput.Value, rid.Value, Optional.ToNullable(ts), Optional.ToNullable(etag)); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs index f19bfd8672e31..64a3bb91d0596 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ExtendedThroughputSettingsResourceInfo.cs @@ -22,10 +22,12 @@ public ExtendedThroughputSettingsResourceInfo() /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. + /// The offer throughput value to instantly scale up without triggering splits. + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. /// A system generated property. A unique identifier. /// A system generated property that denotes the last updated timestamp of the resource. /// A system generated property representing the resource etag required for optimistic concurrency control. - internal ExtendedThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, string rid, float? timestamp, ETag? etag) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending) + internal ExtendedThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, string instantMaximumThroughput, string softAllowedMaximumThroughput, string rid, float? timestamp, ETag? etag) : base(throughput, autoscaleSettings, minimumThroughput, offerReplacePending, instantMaximumThroughput, softAllowedMaximumThroughput) { Rid = rid; Timestamp = timestamp; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs index 90fdc8cc1b07c..a209c7f06ecde 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { @@ -20,7 +19,7 @@ internal static ListBackups DeserializeListBackups(JsonElement element) { return null; } - Optional> value = default; + Optional> value = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) @@ -29,10 +28,10 @@ internal static ListBackups DeserializeListBackups(JsonElement element) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(item)); + array.Add(CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo(item)); } value = array; continue; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs index bb47d5d85409a..984fb6dc1f076 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ListBackups.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.CosmosDB; namespace Azure.ResourceManager.CosmosDB.Models { @@ -17,17 +16,17 @@ internal partial class ListBackups /// Initializes a new instance of ListBackups. internal ListBackups() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of ListBackups. /// Container for array of backups. - internal ListBackups(IReadOnlyList value) + internal ListBackups(IReadOnlyList value) { Value = value; } /// Container for array of backups. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs index 4af5cc1457259..17594bc787086 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.Serialization.cs @@ -38,6 +38,8 @@ internal static ThroughputSettingsResourceInfo DeserializeThroughputSettingsReso Optional autoscaleSettings = default; Optional minimumThroughput = default; Optional offerReplacePending = default; + Optional instantMaximumThroughput = default; + Optional softAllowedMaximumThroughput = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("throughput"u8)) @@ -68,8 +70,18 @@ internal static ThroughputSettingsResourceInfo DeserializeThroughputSettingsReso offerReplacePending = property.Value.GetString(); continue; } + if (property.NameEquals("instantMaximumThroughput"u8)) + { + instantMaximumThroughput = property.Value.GetString(); + continue; + } + if (property.NameEquals("softAllowedMaximumThroughput"u8)) + { + softAllowedMaximumThroughput = property.Value.GetString(); + continue; + } } - return new ThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value); + return new ThroughputSettingsResourceInfo(Optional.ToNullable(throughput), autoscaleSettings.Value, minimumThroughput.Value, offerReplacePending.Value, instantMaximumThroughput.Value, softAllowedMaximumThroughput.Value); } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs index 142119bf39c96..d4d9026de95a6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Models/ThroughputSettingsResourceInfo.cs @@ -20,12 +20,16 @@ public ThroughputSettingsResourceInfo() /// Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. /// The minimum throughput of the resource. /// The throughput replace is pending. - internal ThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending) + /// The offer throughput value to instantly scale up without triggering splits. + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. + internal ThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResourceInfo autoscaleSettings, string minimumThroughput, string offerReplacePending, string instantMaximumThroughput, string softAllowedMaximumThroughput) { Throughput = throughput; AutoscaleSettings = autoscaleSettings; MinimumThroughput = minimumThroughput; OfferReplacePending = offerReplacePending; + InstantMaximumThroughput = instantMaximumThroughput; + SoftAllowedMaximumThroughput = softAllowedMaximumThroughput; } /// Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. @@ -36,5 +40,9 @@ internal ThroughputSettingsResourceInfo(int? throughput, AutoscaleSettingsResour public string MinimumThroughput { get; } /// The throughput replace is pending. public string OfferReplacePending { get; } + /// The offer throughput value to instantly scale up without triggering splits. + public string InstantMaximumThroughput { get; } + /// The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. + public string SoftAllowedMaximumThroughput { get; } } } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterResource.cs index 7bf5d3b850b64..1f21969166577 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.CosmosDB public partial class MongoClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mongoClusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mongoClusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CosmosDBFirewallRuleResources and their operations over a CosmosDBFirewallRuleResource. public virtual CosmosDBFirewallRuleCollection GetCosmosDBFirewallRules() { - return GetCachedClient(Client => new CosmosDBFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBFirewallRuleCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual CosmosDBFirewallRuleCollection GetCosmosDBFirewallRules() /// /// The name of the mongo cluster firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetCosmosDBFir /// /// The name of the mongo cluster firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionResource.cs index f0478dc17e7f1..f3360e1cb36a5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class MongoDBCollectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The collectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string collectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionThroughputSettingResource.cs index 36ef0584ce989..79954d4bedffd 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBCollectionThroughputSettingResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.CosmosDB public partial class MongoDBCollectionThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. + /// The collectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName, string collectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseResource.cs index adefa62d6d684..eabe818f5ba00 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class MongoDBDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}"; @@ -99,7 +103,7 @@ public virtual MongoDBDatabaseThroughputSettingResource GetMongoDBDatabaseThroug /// An object representing collection of MongoDBCollectionResources and their operations over a MongoDBCollectionResource. public virtual MongoDBCollectionCollection GetMongoDBCollections() { - return GetCachedClient(Client => new MongoDBCollectionCollection(Client, Id)); + return GetCachedClient(client => new MongoDBCollectionCollection(client, Id)); } /// @@ -117,8 +121,8 @@ public virtual MongoDBCollectionCollection GetMongoDBCollections() /// /// Cosmos DB collection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMongoDBCollectionAsync(string collectionName, CancellationToken cancellationToken = default) { @@ -140,8 +144,8 @@ public virtual async Task> GetMongoDBCollect /// /// Cosmos DB collection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMongoDBCollection(string collectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseThroughputSettingResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseThroughputSettingResource.cs index 37fc90ddc6bdb..959841aef1ec6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseThroughputSettingResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseThroughputSettingResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class MongoDBDatabaseThroughputSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionResource.cs index dd6d546bab1bc..9010703e3bb84 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBRoleDefinitionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class MongoDBRoleDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The mongoRoleDefinitionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string mongoRoleDefinitionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionResource.cs index 5852497fe83d0..fe09838e4b5c3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBUserDefinitionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CosmosDB public partial class MongoDBUserDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The mongoUserDefinitionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string mongoUserDefinitionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs index 05e8566a997a4..9c65a7fd0ed5e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraClustersRestOperations.cs @@ -33,7 +33,7 @@ public CassandraClustersRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -671,7 +671,7 @@ internal HttpMessage CreateGetBackupRequest(string subscriptionId, string resour /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetBackupAsync(string subscriptionId, string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) + public async Task> GetBackupAsync(string subscriptionId, string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -684,13 +684,11 @@ public async Task> GetBackupAsync(s { case 200: { - CassandraClusterBackupResourceData value = default; + CassandraClusterBackupResourceInfo value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(document.RootElement); + value = CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((CassandraClusterBackupResourceData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -704,7 +702,7 @@ public async Task> GetBackupAsync(s /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response GetBackup(string subscriptionId, string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) + public Response GetBackup(string subscriptionId, string resourceGroupName, string clusterName, string backupId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -717,19 +715,17 @@ public Response GetBackup(string subscriptio { case 200: { - CassandraClusterBackupResourceData value = default; + CassandraClusterBackupResourceInfo value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CassandraClusterBackupResourceData.DeserializeCassandraClusterBackupResourceData(document.RootElement); + value = CassandraClusterBackupResourceInfo.DeserializeCassandraClusterBackupResourceInfo(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((CassandraClusterBackupResourceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resourceGroupName, string clusterName) + internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resourceGroupName, string clusterName, bool? xMsForceDeallocate) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -745,6 +741,10 @@ internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resou uri.AppendPath("/deallocate", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (xMsForceDeallocate != null) + { + request.Headers.Add("x-ms-force-deallocate", xMsForceDeallocate.Value); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; @@ -754,16 +754,17 @@ internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resou /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Managed Cassandra cluster name. + /// Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might cause data loss. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeallocateAsync(string subscriptionId, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + public async Task DeallocateAsync(string subscriptionId, string resourceGroupName, string clusterName, bool? xMsForceDeallocate = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var message = CreateDeallocateRequest(subscriptionId, resourceGroupName, clusterName); + using var message = CreateDeallocateRequest(subscriptionId, resourceGroupName, clusterName, xMsForceDeallocate); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -778,16 +779,17 @@ public async Task DeallocateAsync(string subscriptionId, string resour /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Managed Cassandra cluster name. + /// Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might cause data loss. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Deallocate(string subscriptionId, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default) + public Response Deallocate(string subscriptionId, string resourceGroupName, string clusterName, bool? xMsForceDeallocate = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var message = CreateDeallocateRequest(subscriptionId, resourceGroupName, clusterName); + using var message = CreateDeallocateRequest(subscriptionId, resourceGroupName, clusterName, xMsForceDeallocate); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs index 0b8a82792cd9b..77e075133fb62 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraDataCentersRestOperations.cs @@ -33,7 +33,7 @@ public CassandraDataCentersRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs index c492127ad13d0..088005408e593 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CassandraResourcesRestOperations.cs @@ -33,7 +33,7 @@ public CassandraResourcesRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRegionRestOperations.cs index 44c1e724b120f..25c848a549ee4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRegionRestOperations.cs @@ -33,7 +33,7 @@ public CollectionPartitionRegionRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRestOperations.cs index c086be9ed93a8..47e2065fc59d2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionPartitionRestOperations.cs @@ -33,7 +33,7 @@ public CollectionPartitionRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRegionRestOperations.cs index dd41cc236c309..8fcac73dcbb71 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRegionRestOperations.cs @@ -33,7 +33,7 @@ public CollectionRegionRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRestOperations.cs index e63342ab46c2b..71c1b67c29b28 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/CollectionRestOperations.cs @@ -33,7 +33,7 @@ public CollectionRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs index e27575c882d1b..0578a000fe9f4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DataTransferJobsRestOperations.cs @@ -33,7 +33,7 @@ public DataTransferJobsRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountRegionRestOperations.cs index ea7fb426d81c5..03f45c2a6ac03 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountRegionRestOperations.cs @@ -33,7 +33,7 @@ public DatabaseAccountRegionRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs index 7d304c5f67ad7..3f05b92627f36 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseAccountsRestOperations.cs @@ -33,7 +33,7 @@ public DatabaseAccountsRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseRestOperations.cs index 6b92f7b7d6a1b..42aeaa1d4a1b1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/DatabaseRestOperations.cs @@ -33,7 +33,7 @@ public DatabaseRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs index f4a6ef9134467..40d9398be6070 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GraphResourcesRestOperations.cs @@ -33,7 +33,7 @@ public GraphResourcesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs index aaca2a15404f7..b94f1d97bd9a3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/GremlinResourcesRestOperations.cs @@ -33,7 +33,7 @@ public GremlinResourcesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/LocationsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/LocationsRestOperations.cs index 69ddc872c0a58..3f9b721fcef86 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/LocationsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/LocationsRestOperations.cs @@ -33,7 +33,7 @@ public LocationsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs index 345a7a3340aaf..b257cb393b525 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoClustersRestOperations.cs @@ -33,7 +33,7 @@ public MongoClustersRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs index 69a75d483635d..859568a24ebb7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/MongoDBResourcesRestOperations.cs @@ -33,7 +33,7 @@ public MongoDBResourcesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRegionRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRegionRestOperations.cs index 1607261b398fe..98f592ca3faa4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRegionRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRegionRestOperations.cs @@ -33,7 +33,7 @@ public PartitionKeyRangeIdRegionRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRestOperations.cs index 177d359f1c60b..bb414a3bf1c7d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PartitionKeyRangeIdRestOperations.cs @@ -33,7 +33,7 @@ public PartitionKeyRangeIdRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileRestOperations.cs index fe8c0295e1a53..c00ed68549f43 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileRestOperations.cs @@ -33,7 +33,7 @@ public PercentileRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileSourceTargetRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileSourceTargetRestOperations.cs index 5d02a7093ad55..6727853c379f3 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileSourceTargetRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileSourceTargetRestOperations.cs @@ -33,7 +33,7 @@ public PercentileSourceTargetRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileTargetRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileTargetRestOperations.cs index 029de11d05542..411518a32a4af 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileTargetRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PercentileTargetRestOperations.cs @@ -33,7 +33,7 @@ public PercentileTargetRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index c8a01377f74fb..17f8875986da1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index 24bbecd7632e6..6731ff4478a19 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -33,7 +33,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableDatabaseAccountsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableDatabaseAccountsRestOperations.cs index 293020c2d546e..e7d84be8c37a2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableDatabaseAccountsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableDatabaseAccountsRestOperations.cs @@ -33,7 +33,7 @@ public RestorableDatabaseAccountsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinDatabasesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinDatabasesRestOperations.cs index b166e21aaf661..a684664a98dcb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinDatabasesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableGremlinDatabasesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinGraphsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinGraphsRestOperations.cs index b7261e1edf3f3..562d5938c36ed 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinGraphsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinGraphsRestOperations.cs @@ -33,7 +33,7 @@ public RestorableGremlinGraphsRestOperations(HttpPipeline pipeline, string appli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinResourcesRestOperations.cs index 491e0a52c006d..cdf9cc26c8256 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableGremlinResourcesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableGremlinResourcesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbCollectionsRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbCollectionsRestOperations.cs index 5c3591f4fd5d2..941d903e23433 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbCollectionsRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbCollectionsRestOperations.cs @@ -33,7 +33,7 @@ public RestorableMongodbCollectionsRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbDatabasesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbDatabasesRestOperations.cs index d95a8e3e45bb0..82b9c7f4e92f4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbDatabasesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableMongodbDatabasesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbResourcesRestOperations.cs index a928d5461714d..5e1d6185743a7 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableMongodbResourcesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableMongodbResourcesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlContainersRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlContainersRestOperations.cs index efc9633c797f5..dce44737a2bf6 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlContainersRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlContainersRestOperations.cs @@ -33,7 +33,7 @@ public RestorableSqlContainersRestOperations(HttpPipeline pipeline, string appli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlDatabasesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlDatabasesRestOperations.cs index 789a9361823a5..afae919ede283 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlDatabasesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlDatabasesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableSqlDatabasesRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlResourcesRestOperations.cs index 3ff217dd2a69e..89a71d6fd329b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableSqlResourcesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableSqlResourcesRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTableResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTableResourcesRestOperations.cs index b53887e11b4ef..cfbfa20b3fad4 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTableResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTableResourcesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableTableResourcesRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTablesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTablesRestOperations.cs index e925ee574e565..0e15399115750 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTablesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/RestorableTablesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableTablesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs index 80ed56e4796ce..e57261f307d9d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/ServiceRestOperations.cs @@ -33,7 +33,7 @@ public ServiceRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs index f8bea3d172d40..1e4130ce83207 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/SqlResourcesRestOperations.cs @@ -33,7 +33,7 @@ public SqlResourcesRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs index 0ace58f3fc9ec..555b3290ccf7b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestOperations/TableResourcesRestOperations.cs @@ -33,7 +33,7 @@ public TableResourcesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-15-preview"; + _apiVersion = apiVersion ?? "2023-09-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountResource.cs index 8316ce47695fb..934c45bd7d865 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/RestorableCosmosDBAccountResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.CosmosDB public partial class RestorableCosmosDBAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The instanceId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, Guid instanceId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}"; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md index 9703f1ce489b4..7fe0fe87ac8ea 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/autorest.md @@ -9,13 +9,18 @@ azure-arm: true csharp: true library-name: CosmosDB namespace: Azure.ResourceManager.CosmosDB -require: https://github.com/Azure/azure-rest-api-specs/blob/44e83346defd3d4ca99efade8b1ee90c67d9f249/specification/cosmos-db/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/fa285f544fa37cd839c4befe1109db3547b016ab/specification/cosmos-db/resource-manager/readme.md +#tag: package-preview-2023-09 output-folder: $(this-folder)/Generated clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../samples/Generated + clear-output-folder: true skip-csproj: true modelerfour: flatten-payloads: false lenient-model-deduplication: true + # mgmt-debug: # show-serialized-names: true @@ -129,13 +134,10 @@ rename-mapping: Role: MongoDBRole Role.db: DBName MongoRoleDefinitionGetResults.properties.type: RoleDefinitionType - PrivilegeResourceInfo: PrivilegeResourceInfoResource MongoRoleDefinitionListResult: MongoDBRoleDefinitionListResult MongoUserDefinitionListResult: MongoDBUserDefinitionListResult - SqlRoleDefinitionResource: CosmosDBSqlRoleDefinitionResourceInfo CassandraKeyspacePropertiesOptions: CassandraKeyspacePropertiesConfig CassandraTablePropertiesOptions: CassandraTablePropertiesConfig - CosmosTablePropertiesOptions: CosmosDBTablePropertiesConfig CreateUpdateOptions: CosmosDBCreateUpdateConfig GremlinDatabasePropertiesOptions: GremlinDatabasePropertiesConfig GremlinGraphPropertiesOptions: GremlinGraphPropertiesConfig @@ -149,7 +151,6 @@ rename-mapping: CassandraKeyspaceResource: CassandraKeyspaceResourceInfo CassandraTablePropertiesResource: ExtendedCassandraTableResourceInfo CassandraTableResource: CassandraTableResourceInfo - CosmosTablePropertiesResource: ExtendedCosmosTableResourceInfo ClientEncryptionKeyGetPropertiesResource: CosmosDBSqlClientEncryptionKeyProperties ClientEncryptionKeyResource: CosmosDBSqlClientEncryptionKeyResourceInfo ClientEncryptionPolicy: CosmosDBClientEncryptionPolicy @@ -177,11 +178,9 @@ rename-mapping: CosmosDBSqlContainerPropertiesResource: ExtendedCosmosDBSqlContainerResourceInfo SqlContainerResource: CosmosDBSqlContainerResourceInfo SqlDatabaseResource: CosmosDBSqlDatabaseResourceInfo - SqlStoredProcedurePropertiesResource: ExtendedCosmosDBSqlStoredProcedureResourceInfo SqlStoredProcedureResource: CosmosDBSqlStoredProcedureResourceInfo SqlTriggerResource: CosmosDBSqlTriggerResourceInfo CosmosDBSqlTriggerPropertiesResource: ExtendedCosmosDBSqlTriggerResourceInfo - SqlUserDefinedFunctionPropertiesResource: ExtendedCosmosDBSqlUserDefinedFunctionResourceInfo SqlUserDefinedFunctionResource: CosmosDBSqlUserDefinedFunctionResourceInfo TableResource: CosmosDBTableResourceInfo ThroughputPolicyResource: ThroughputPolicyResourceInfo @@ -201,6 +200,7 @@ rename-mapping: ClusterResource: CassandraCluster ClusterKey: CassandraClusterKey ClusterResourceProperties: CassandraClusterProperties + ClusterType: CassandraClusterType DataCenterResource: CassandraDataCenter DataCenterResourceProperties: CassandraDataCenterProperties ListDataCenters: CassandraDataCenterListResult @@ -300,7 +300,9 @@ rename-mapping: PrivilegeResource: MongoDBPrivilegeResourceInfo PrivilegeResource.db: DBName MinimalTlsVersion: CosmosDBMinimalTlsVersion - BackupResource: CassandraClusterBackupResource + BackupResource: CassandraClusterBackupResourceInfo + BackupSchedule: CassandraClusterBackupSchedule + BackupState: CassandraClusterBackupState CheckNameAvailabilityRequest: CheckCosmosDBNameAvailabilityContent CheckNameAvailabilityResponse: CheckCosmosDBNameAvailabilityResponse CheckNameAvailabilityReason: CosmosDBNameUnavailableReason @@ -332,7 +334,6 @@ prepend-rp-prefix: - FailoverPolicies - FailoverPolicy - BackupInformation -- ContainerPartitionKey - CompositePath - PartitionKind - PercentileMetric diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraKeyspaceTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraKeyspaceTests.cs index 3568fb545f046..8b9353e950336 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraKeyspaceTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraKeyspaceTests.cs @@ -118,7 +118,7 @@ public async Task CassandraKeyspaceThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CassandraKeyspaceThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraTableTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraTableTests.cs index 1e66488b406dc..cca003cc75683 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraTableTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CassandraTableTests.cs @@ -119,7 +119,7 @@ public async Task CassandraTableThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CassandraTableThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableOperationTests.cs index c6130b896a401..e1c8caa596e36 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableOperationTests.cs @@ -118,13 +118,13 @@ public async Task TableRestoreTest() var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); var restorableDatabaseAccount = restorableAccounts.SingleOrDefault(account => account.Data.AccountName == _databaseAccount.Data.Name); DateTimeOffset timestampInUtc = DateTimeOffset.FromUnixTimeSeconds((int)table.Data.Resource.Timestamp.Value); - AddDelayInSeconds(60); + AddDelayInSeconds(180); String restoreSource = restorableDatabaseAccount.Id; ResourceRestoreParameters RestoreParameters = new ResourceRestoreParameters { RestoreSource = restoreSource, - RestoreTimestampInUtc = timestampInUtc.AddSeconds(60) + RestoreTimestampInUtc = timestampInUtc.AddSeconds(100) }; await table.DeleteAsync(WaitUntil.Completed); @@ -177,7 +177,7 @@ public async Task TableThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CosmosTableThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableTests.cs index 45639174059a4..2b67eb4472709 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/CosmosTableTests.cs @@ -119,7 +119,7 @@ public async Task TableThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CosmosTableThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountOperationsTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountOperationsTests.cs index 850590dcc16e1..2ae192cdbbde5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountOperationsTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountOperationsTests.cs @@ -233,6 +233,7 @@ private void VerifyCosmosDBAccount(CosmosDBAccountResource expectedValue, Cosmos Assert.AreEqual(expectedValue.ConnectorOffer, actualValue.ConnectorOffer); Assert.AreEqual(expectedValue.DisableKeyBasedMetadataWriteAccess, actualValue.DisableKeyBasedMetadataWriteAccess); Assert.AreEqual(expectedValue.KeyVaultKeyUri, actualValue.KeyVaultKeyUri); + Assert.AreEqual(expectedValue.CustomerManagedKeyStatus, actualValue.CustomerManagedKeyStatus); Assert.AreEqual(expectedValue.PublicNetworkAccess, actualValue.PublicNetworkAccess); Assert.AreEqual(expectedValue.EnableFreeTier, actualValue.EnableFreeTier); Assert.AreEqual(expectedValue.ApiProperties.ServerVersion.ToString(), actualValue.ApiProperties.ServerVersion.ToString()); diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountTests.cs index 9eff3f9ab3b40..2892e83acf90d 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/DatabaseAccountTests.cs @@ -61,6 +61,8 @@ public async Task DatabaseAccountCreateAndUpdateTest() EnableAutomaticFailover = true, DisableKeyBasedMetadataWriteAccess = true, EnableBurstCapacity = true, + EnablePriorityBasedExecution = true, + DefaultPriorityLevel = DefaultPriorityLevel.Low, }; updateOptions.Tags.Add("key3", "value3"); updateOptions.Tags.Add("key4", "value4"); @@ -227,12 +229,15 @@ private void VerifyCosmosDBAccount(CosmosDBAccountResource expectedValue, Cosmos Assert.AreEqual(expectedData.ConnectorOffer, actualData.ConnectorOffer); Assert.AreEqual(expectedData.DisableKeyBasedMetadataWriteAccess, actualData.DisableKeyBasedMetadataWriteAccess); Assert.AreEqual(expectedData.KeyVaultKeyUri, actualData.KeyVaultKeyUri); + Assert.AreEqual(expectedData.CustomerManagedKeyStatus, actualData.CustomerManagedKeyStatus); Assert.AreEqual(expectedData.PublicNetworkAccess, actualData.PublicNetworkAccess); Assert.AreEqual(expectedData.IsFreeTierEnabled, actualData.IsFreeTierEnabled); Assert.AreEqual(expectedData.ApiProperties.ServerVersion.ToString(), actualData.ApiProperties.ServerVersion.ToString()); Assert.AreEqual(expectedData.IsAnalyticalStorageEnabled, actualData.IsAnalyticalStorageEnabled); Assert.AreEqual(expectedData.Cors.Count, actualData.Cors.Count); Assert.AreEqual(expectedData.EnableBurstCapacity, actualData.EnableBurstCapacity); + Assert.AreEqual(expectedData.EnablePriorityBasedExecution, actualData.EnablePriorityBasedExecution); + Assert.AreEqual(expectedData.DefaultPriorityLevel, actualData.DefaultPriorityLevel); } private void VerifyCosmosDBAccount(CosmosDBAccountResource databaseAccount, CosmosDBAccountPatch parameters) @@ -242,6 +247,8 @@ private void VerifyCosmosDBAccount(CosmosDBAccountResource databaseAccount, Cosm Assert.AreEqual(databaseAccount.Data.EnableAutomaticFailover, parameters.EnableAutomaticFailover); Assert.AreEqual(databaseAccount.Data.DisableKeyBasedMetadataWriteAccess, parameters.DisableKeyBasedMetadataWriteAccess); Assert.AreEqual(databaseAccount.Data.EnableBurstCapacity, parameters.EnableBurstCapacity); + Assert.AreEqual(databaseAccount.Data.EnablePriorityBasedExecution, parameters.EnablePriorityBasedExecution); + Assert.AreEqual(databaseAccount.Data.DefaultPriorityLevel, parameters.DefaultPriorityLevel); } private void VerifyLocations(IReadOnlyList expectedData, IReadOnlyList actualData) diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseOperationTests.cs index fd8b616937520..cd86545a3d086 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseOperationTests.cs @@ -112,13 +112,13 @@ public async Task GremlinDatabaseRestoreTest() var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); var restorableDatabaseAccount = restorableAccounts.SingleOrDefault(account => account.Data.AccountName == _databaseAccount.Data.Name); DateTimeOffset timestampInUtc = DateTimeOffset.FromUnixTimeSeconds((int)database.Data.Resource.Timestamp.Value); - AddDelayInSeconds(60); + AddDelayInSeconds(180); String restoreSource = restorableDatabaseAccount.Id; ResourceRestoreParameters RestoreParameters = new ResourceRestoreParameters { RestoreSource = restoreSource, - RestoreTimestampInUtc = timestampInUtc.AddSeconds(60) + RestoreTimestampInUtc = timestampInUtc.AddSeconds(100) }; await database.DeleteAsync(WaitUntil.Completed); @@ -169,7 +169,7 @@ public async Task GremlinDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); GremlinDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseTests.cs index 9671596826562..d999b30fe57d2 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinDatabaseTests.cs @@ -115,7 +115,7 @@ public async Task GremlinDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); GremlinDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphOperationTests.cs index 2885b6996cf38..b36965c66d8b1 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphOperationTests.cs @@ -121,13 +121,13 @@ public async Task GremlinGraphRestoreTest() var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); var restorableDatabaseAccount = restorableAccounts.SingleOrDefault(account => account.Data.AccountName == _databaseAccount.Data.Name); DateTimeOffset timestampInUtc = DateTimeOffset.FromUnixTimeSeconds((int)graph.Data.Resource.Timestamp.Value); - AddDelayInSeconds(60); + AddDelayInSeconds(180); String restoreSource = restorableDatabaseAccount.Id; ResourceRestoreParameters RestoreParameters = new ResourceRestoreParameters { RestoreSource = restoreSource, - RestoreTimestampInUtc = timestampInUtc.AddSeconds(60) + RestoreTimestampInUtc = timestampInUtc.AddSeconds(100) }; await graph.DeleteAsync(WaitUntil.Completed); @@ -173,7 +173,7 @@ public async Task GremlinGraphThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); GremlinGraphThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphTests.cs index edc704e0438fe..57994c207a2a5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/GremlinGraphTests.cs @@ -119,7 +119,7 @@ public async Task GremlinGraphThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); GremlinGraphThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionOperationTests.cs index 4ce8cd6a32698..60d1353083f16 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionOperationTests.cs @@ -171,7 +171,7 @@ public async Task MongoDBCollectionThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); MongoDBCollectionThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionTests.cs index 178f3d9413c2b..8b9f3aec962f5 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBCollectionTests.cs @@ -113,7 +113,7 @@ public async Task MongoDBCollectionThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); MongoDBCollectionThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseOperationTests.cs index a700cfdd6440c..7aaf269135a10 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseOperationTests.cs @@ -174,7 +174,7 @@ public async Task MongoDBDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); MongoDBDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseTests.cs index 8bca0bd132f5e..ac307da576f63 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/MongoDBDatabaseTests.cs @@ -113,7 +113,7 @@ public async Task MongoDBDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); MongoDBDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/RestorableDatabaseAccountTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/RestorableDatabaseAccountTests.cs index f902be09a9728..cdbe0c050198e 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/RestorableDatabaseAccountTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/RestorableDatabaseAccountTests.cs @@ -59,8 +59,23 @@ public async Task TearDown() public async Task RestorableDatabaseAccountList() { _restorableDatabaseAccount = await CreateRestorableDatabaseAccount(Recording.GenerateAssetName("r-database-account-"), CosmosDBAccountKind.GlobalDocumentDB, AzureLocation.WestUS); - var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); - Assert.That(restorableAccounts.Any(account => account.Data.AccountName == _restorableDatabaseAccount.Data.Name)); + await VerifyRestorableDatabaseAccount(_restorableDatabaseAccount.Data.Name); + } + + [Test] + [RecordedTest] + public async Task RestorableDatabaseAccountListWithContinuous7Account() + { + _restorableDatabaseAccount = await CreateRestorableDatabaseAccount(Recording.GenerateAssetName("r-database-account-"), CosmosDBAccountKind.GlobalDocumentDB, AzureLocation.WestUS, continuousTier: ContinuousTier.Continuous7Days); + await VerifyRestorableDatabaseAccount(_restorableDatabaseAccount.Data.Name); + } + + [Test] + [RecordedTest] + public async Task RestorableDatabaseAccountListWithContinuous30Account() + { + _restorableDatabaseAccount = await CreateRestorableDatabaseAccount(Recording.GenerateAssetName("r-database-account-"), CosmosDBAccountKind.GlobalDocumentDB, AzureLocation.WestUS, continuousTier: ContinuousTier.Continuous30Days); + await VerifyRestorableDatabaseAccount(_restorableDatabaseAccount.Data.Name); } [Test] @@ -104,13 +119,31 @@ public async Task RestoreSqlDatabaseAccount() } // TODO: more tests after fixing the code generation issue - protected async Task CreateRestorableDatabaseAccount(string name, CosmosDBAccountKind kind, AzureLocation location, bool isFreeTierEnabled = false, List capabilities = null, string apiVersion = null) + protected async Task CreateRestorableDatabaseAccount(string name, CosmosDBAccountKind kind, AzureLocation location, bool isFreeTierEnabled = false, List capabilities = null, string apiVersion = null, ContinuousTier? continuousTier = null) { var locations = new List() { new CosmosDBAccountLocation(id: null, locationName: location, documentEndpoint: null, provisioningState: null, failoverPriority: 0, isZoneRedundant: false) }; + CosmosDBAccountBackupPolicy backupPolicy; + ContinuousTier inputContinuousTier; + + if (continuousTier.HasValue) + { + inputContinuousTier = continuousTier.Value; + + backupPolicy = new ContinuousModeBackupPolicy + { + ContinuousModeProperties = new ContinuousModeProperties { Tier = continuousTier.Value } + }; + } + else + { + inputContinuousTier = ContinuousTier.Continuous30Days; // if ContinuousTier is not provided, then it defaults to Continuous30Days + backupPolicy = new ContinuousModeBackupPolicy(); + } + var createOptions = new CosmosDBAccountCreateOrUpdateContent(location, locations) { Kind = kind, @@ -120,7 +153,7 @@ protected async Task CreateRestorableDatabaseAccount(st EnableAutomaticFailover = false, ConnectorOffer = ConnectorOffer.Small, DisableKeyBasedMetadataWriteAccess = false, - BackupPolicy = new ContinuousModeBackupPolicy(), + BackupPolicy = backupPolicy, IsFreeTierEnabled = isFreeTierEnabled, }; @@ -136,9 +169,24 @@ protected async Task CreateRestorableDatabaseAccount(st _databaseAccountName = name; var accountLro = await DatabaseAccountCollection.CreateOrUpdateAsync(WaitUntil.Completed, _databaseAccountName, createOptions); + + Assert.AreEqual(inputContinuousTier, ((ContinuousModeBackupPolicy)accountLro.Value.Data.BackupPolicy).ContinuousModeTier, "Unexpected ContinuousTier"); + return accountLro.Value; } + private async Task VerifyRestorableDatabaseAccount(string expectedRestorableDatabaseAccountName) + { + var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); + + RestorableCosmosDBAccountResource restorableDBA = restorableAccounts.Where(account => account.Data.AccountName == expectedRestorableDatabaseAccountName).Single(); + Assert.AreEqual(restorableDBA.Data.ApiType, CosmosDBApiType.Sql); + Assert.IsNotNull(restorableDBA.Data.CreatedOn); + Assert.IsNull(restorableDBA.Data.DeletedOn, $"Actual DeletedOn: {restorableDBA.Data.DeletedOn}"); + Assert.IsNotNull(restorableDBA.Data.OldestRestorableOn); + Assert.IsNotNull(restorableDBA.Data.RestorableLocations); + } + private async Task RestoreAndVerifyRestoredAccount(AccountType accountType, RestorableCosmosDBAccountResource restorableAccount, CosmosDBAccountRestoreParameters restoreParameters, AzureLocation location, AzureLocation armLocation, bool IsFreeTierEnabled = false) { CosmosDBAccountKind kind = CosmosDBAccountKind.GlobalDocumentDB; diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseOperationTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseOperationTests.cs index 4de3eeb1c7d1f..1c196dbed5c68 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseOperationTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseOperationTests.cs @@ -107,7 +107,7 @@ public async Task SqlDatabaseRestoreTest() Assert.That(databases, Has.Count.EqualTo(1)); Assert.AreEqual(database.Data.Name, databases[0].Data.Name); DateTimeOffset timestampInUtc = DateTimeOffset.FromUnixTimeSeconds((int)database.Data.Resource.Timestamp.Value); - AddDelayInSeconds(60); + AddDelayInSeconds(180); var restorableAccounts = await (await ArmClient.GetDefaultSubscriptionAsync()).GetRestorableCosmosDBAccountsAsync().ToEnumerableAsync(); var restorableDatabaseAccount = restorableAccounts.SingleOrDefault(account => account.Data.AccountName == _databaseAccount.Data.Name); @@ -120,7 +120,7 @@ public async Task SqlDatabaseRestoreTest() ResourceRestoreParameters RestoreParameters = new ResourceRestoreParameters { RestoreSource = restoreSource, - RestoreTimestampInUtc = timestampInUtc.AddSeconds(60) + RestoreTimestampInUtc = timestampInUtc.AddSeconds(100) }; CosmosDBSqlDatabaseResourceInfo resource = new CosmosDBSqlDatabaseResourceInfo(_databaseName, RestoreParameters, CosmosDBAccountCreateMode.Restore); @@ -165,7 +165,7 @@ public async Task SqlDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CosmosDBSqlDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseTests.cs index 034732a638300..f55d31f0e9bff 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlDatabaseTests.cs @@ -112,7 +112,7 @@ public async Task SqlDatabaseThroughput() Assert.AreEqual(TestThroughput1, throughput.Data.Resource.Throughput); CosmosDBSqlDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(TestThroughput2, null, null, null, null, null)))).Value; Assert.AreEqual(TestThroughput2, throughput2.Data.Resource.Throughput); } diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlPartitionMergeTests.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlPartitionMergeTests.cs index be66996c303d6..0d1addf0d965b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlPartitionMergeTests.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/ScenarioTests/SqlPartitionMergeTests.cs @@ -77,7 +77,7 @@ public async Task SqlDatabasePartitionMerge() ThroughputSettingData throughputData = (await throughput.MigrateSqlDatabaseToManualThroughputAsync(WaitUntil.Completed)).Value.Data; throughput = await database.GetCosmosDBSqlDatabaseThroughputSetting().GetAsync(); CosmosDBSqlDatabaseThroughputSettingResource throughput2 = (await throughput.CreateOrUpdateAsync(WaitUntil.Completed, new ThroughputSettingsUpdateData(AzureLocation.WestUS, - new ThroughputSettingsResourceInfo(1000, null, null, null)))).Value; + new ThroughputSettingsResourceInfo(1000, null, null, null, null, null)))).Value; MergeParameters mergeParameters = new MergeParameters() { IsDryRun = true }; try diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/api/Azure.ResourceManager.CosmosDBForPostgreSql.netstandard2.0.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/api/Azure.ResourceManager.CosmosDBForPostgreSql.netstandard2.0.cs index 20da186ff0a46..686593c33bf9c 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/api/Azure.ResourceManager.CosmosDBForPostgreSql.netstandard2.0.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/api/Azure.ResourceManager.CosmosDBForPostgreSql.netstandard2.0.cs @@ -19,7 +19,7 @@ protected CosmosDBForPostgreSqlClusterCollection() { } } public partial class CosmosDBForPostgreSqlClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public CosmosDBForPostgreSqlClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CosmosDBForPostgreSqlClusterData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } } public string AdministratorLoginPassword { get { throw null; } set { } } public string CitusVersion { get { throw null; } set { } } @@ -405,6 +405,37 @@ public CosmosDBForPostgreSqlServerConfigurationData() { } public string Value { get { throw null; } set { } } } } +namespace Azure.ResourceManager.CosmosDBForPostgreSql.Mocking +{ + public partial class MockableCosmosDBForPostgreSqlArmClient : Azure.ResourceManager.ArmResource + { + protected MockableCosmosDBForPostgreSqlArmClient() { } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlClusterResource GetCosmosDBForPostgreSqlClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlClusterServerResource GetCosmosDBForPostgreSqlClusterServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlConfigurationResource GetCosmosDBForPostgreSqlConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlCoordinatorConfigurationResource GetCosmosDBForPostgreSqlCoordinatorConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlFirewallRuleResource GetCosmosDBForPostgreSqlFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlNodeConfigurationResource GetCosmosDBForPostgreSqlNodeConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlPrivateEndpointConnectionResource GetCosmosDBForPostgreSqlPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlPrivateLinkResource GetCosmosDBForPostgreSqlPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlRoleResource GetCosmosDBForPostgreSqlRoleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableCosmosDBForPostgreSqlResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableCosmosDBForPostgreSqlResourceGroupResource() { } + public virtual Azure.Response GetCosmosDBForPostgreSqlCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCosmosDBForPostgreSqlClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CosmosDBForPostgreSql.CosmosDBForPostgreSqlClusterCollection GetCosmosDBForPostgreSqlClusters() { throw null; } + } + public partial class MockableCosmosDBForPostgreSqlSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableCosmosDBForPostgreSqlSubscriptionResource() { } + public virtual Azure.Response CheckCosmosDBForPostgreSqlClusterNameAvailability(Azure.ResourceManager.CosmosDBForPostgreSql.Models.CosmosDBForPostgreSqlClusterNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckCosmosDBForPostgreSqlClusterNameAvailabilityAsync(Azure.ResourceManager.CosmosDBForPostgreSql.Models.CosmosDBForPostgreSqlClusterNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCosmosDBForPostgreSqlClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCosmosDBForPostgreSqlClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.CosmosDBForPostgreSql.Models { public static partial class ArmCosmosDBForPostgreSqlModelFactory diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterResource.cs index 6463b494de51e..784de10eea997 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CosmosDBForPostgreSqlClusterServerResources and their operations over a CosmosDBForPostgreSqlClusterServerResource. public virtual CosmosDBForPostgreSqlClusterServerCollection GetCosmosDBForPostgreSqlClusterServers() { - return GetCachedClient(Client => new CosmosDBForPostgreSqlClusterServerCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBForPostgreSqlClusterServerCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual CosmosDBForPostgreSqlClusterServerCollection GetCosmosDBForPostgr /// /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBForPostgreSqlClusterServerAsync(string serverName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> /// /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBForPostgreSqlClusterServer(string serverName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetCosmosDBF /// An object representing collection of CosmosDBForPostgreSqlConfigurationResources and their operations over a CosmosDBForPostgreSqlConfigurationResource. public virtual CosmosDBForPostgreSqlConfigurationCollection GetCosmosDBForPostgreSqlConfigurations() { - return GetCachedClient(Client => new CosmosDBForPostgreSqlConfigurationCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBForPostgreSqlConfigurationCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual CosmosDBForPostgreSqlConfigurationCollection GetCosmosDBForPostgr /// /// The name of the cluster configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBForPostgreSqlConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> /// /// The name of the cluster configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBForPostgreSqlConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetCosmosDBF /// An object representing collection of CosmosDBForPostgreSqlCoordinatorConfigurationResources and their operations over a CosmosDBForPostgreSqlCoordinatorConfigurationResource. public virtual CosmosDBForPostgreSqlCoordinatorConfigurationCollection GetCosmosDBForPostgreSqlCoordinatorConfigurations() { - return GetCachedClient(Client => new CosmosDBForPostgreSqlCoordinatorConfigurationCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBForPostgreSqlCoordinatorConfigurationCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual CosmosDBForPostgreSqlCoordinatorConfigurationCollection GetCosmos /// /// The name of the cluster configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBForPostgreSqlCoordinatorConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task /// The name of the cluster configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBForPostgreSqlCoordinatorConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response G /// An object representing collection of CosmosDBForPostgreSqlNodeConfigurationResources and their operations over a CosmosDBForPostgreSqlNodeConfigurationResource. public virtual CosmosDBForPostgreSqlNodeConfigurationCollection GetCosmosDBForPostgreSqlNodeConfigurations() { - return GetCachedClient(Client => new CosmosDBForPostgreSqlNodeConfigurationCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBForPostgreSqlNodeConfigurationCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual CosmosDBForPostgreSqlNodeConfigurationCollection GetCosmosDBForPo /// /// The name of the cluster configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBForPostgreSqlNodeConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task /// The name of the cluster configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBForPostgreSqlNodeConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetCosmo /// An object representing collection of CosmosDBForPostgreSqlFirewallRuleResources and their operations over a CosmosDBForPostgreSqlFirewallRuleResource. public virtual CosmosDBForPostgreSqlFirewallRuleCollection GetCosmosDBForPostgreSqlFirewallRules() { - return GetCachedClient(Client => new CosmosDBForPostgreSqlFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBForPostgreSqlFirewallRuleCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual CosmosDBForPostgreSqlFirewallRuleCollection GetCosmosDBForPostgre /// /// The name of the cluster firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBForPostgreSqlFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task> G /// /// The name of the cluster firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBForPostgreSqlFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -358,7 +361,7 @@ public virtual Response GetCosmosDBFo /// An object representing collection of CosmosDBForPostgreSqlRoleResources and their operations over a CosmosDBForPostgreSqlRoleResource. public virtual CosmosDBForPostgreSqlRoleCollection GetCosmosDBForPostgreSqlRoles() { - return GetCachedClient(Client => new CosmosDBForPostgreSqlRoleCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBForPostgreSqlRoleCollection(client, Id)); } /// @@ -376,8 +379,8 @@ public virtual CosmosDBForPostgreSqlRoleCollection GetCosmosDBForPostgreSqlRoles /// /// The name of the cluster role. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBForPostgreSqlRoleAsync(string roleName, CancellationToken cancellationToken = default) { @@ -399,8 +402,8 @@ public virtual async Task> GetCosmos /// /// The name of the cluster role. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBForPostgreSqlRole(string roleName, CancellationToken cancellationToken = default) { @@ -411,7 +414,7 @@ public virtual Response GetCosmosDBForPostgre /// An object representing collection of CosmosDBForPostgreSqlPrivateEndpointConnectionResources and their operations over a CosmosDBForPostgreSqlPrivateEndpointConnectionResource. public virtual CosmosDBForPostgreSqlPrivateEndpointConnectionCollection GetCosmosDBForPostgreSqlPrivateEndpointConnections() { - return GetCachedClient(Client => new CosmosDBForPostgreSqlPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBForPostgreSqlPrivateEndpointConnectionCollection(client, Id)); } /// @@ -429,8 +432,8 @@ public virtual CosmosDBForPostgreSqlPrivateEndpointConnectionCollection GetCosmo /// /// The name of the private endpoint connection associated with the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBForPostgreSqlPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -452,8 +455,8 @@ public virtual async Task /// The name of the private endpoint connection associated with the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBForPostgreSqlPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -464,7 +467,7 @@ public virtual Response /// An object representing collection of CosmosDBForPostgreSqlPrivateLinkResources and their operations over a CosmosDBForPostgreSqlPrivateLinkResource. public virtual CosmosDBForPostgreSqlPrivateLinkResourceCollection GetCosmosDBForPostgreSqlPrivateLinkResources() { - return GetCachedClient(Client => new CosmosDBForPostgreSqlPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new CosmosDBForPostgreSqlPrivateLinkResourceCollection(client, Id)); } /// @@ -482,8 +485,8 @@ public virtual CosmosDBForPostgreSqlPrivateLinkResourceCollection GetCosmosDBFor /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCosmosDBForPostgreSqlPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -505,8 +508,8 @@ public virtual async Task> Ge /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCosmosDBForPostgreSqlPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerResource.cs index 8f5662c5fe973..0f2fd2bf1a769 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterServerResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlClusterServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/servers/{serverName}"; diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationResource.cs index efb2b00e64af7..14cca5affe60a 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/configurations/{configurationName}"; diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlCoordinatorConfigurationResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlCoordinatorConfigurationResource.cs index d909f9526518b..ed285770103a3 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlCoordinatorConfigurationResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlCoordinatorConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlCoordinatorConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/coordinatorConfigurations/{configurationName}"; diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleResource.cs index 6a7da2162f761..aceff60d59da2 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlNodeConfigurationResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlNodeConfigurationResource.cs index fc513265581d8..8130d00a583ea 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlNodeConfigurationResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlNodeConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlNodeConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/nodeConfigurations/{configurationName}"; diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionResource.cs index a35e3e6afb628..5f4d52a5e90a0 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResource.cs index 48ad338229b7e..23f20b5da3c92 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleResource.cs index 6972495114f10..2dd759903b3cb 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlRoleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql public partial class CosmosDBForPostgreSqlRoleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The roleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string roleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/roles/{roleName}"; diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/CosmosDBForPostgreSqlExtensions.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/CosmosDBForPostgreSqlExtensions.cs index 4b3c0e12c5f1b..f34b1938e4590 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/CosmosDBForPostgreSqlExtensions.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/CosmosDBForPostgreSqlExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDBForPostgreSql.Mocking; using Azure.ResourceManager.CosmosDBForPostgreSql.Models; using Azure.ResourceManager.Resources; @@ -19,214 +20,177 @@ namespace Azure.ResourceManager.CosmosDBForPostgreSql /// A class to add extension methods to Azure.ResourceManager.CosmosDBForPostgreSql. public static partial class CosmosDBForPostgreSqlExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableCosmosDBForPostgreSqlArmClient GetMockableCosmosDBForPostgreSqlArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableCosmosDBForPostgreSqlArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCosmosDBForPostgreSqlResourceGroupResource GetMockableCosmosDBForPostgreSqlResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCosmosDBForPostgreSqlResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableCosmosDBForPostgreSqlSubscriptionResource GetMockableCosmosDBForPostgreSqlSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableCosmosDBForPostgreSqlSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region CosmosDBForPostgreSqlClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlClusterResource GetCosmosDBForPostgreSqlClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlClusterResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlClusterResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlClusterResource(id); } - #endregion - #region CosmosDBForPostgreSqlClusterServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlClusterServerResource GetCosmosDBForPostgreSqlClusterServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlClusterServerResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlClusterServerResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlClusterServerResource(id); } - #endregion - #region CosmosDBForPostgreSqlConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlConfigurationResource GetCosmosDBForPostgreSqlConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlConfigurationResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlConfigurationResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlConfigurationResource(id); } - #endregion - #region CosmosDBForPostgreSqlCoordinatorConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlCoordinatorConfigurationResource GetCosmosDBForPostgreSqlCoordinatorConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlCoordinatorConfigurationResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlCoordinatorConfigurationResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlCoordinatorConfigurationResource(id); } - #endregion - #region CosmosDBForPostgreSqlNodeConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlNodeConfigurationResource GetCosmosDBForPostgreSqlNodeConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlNodeConfigurationResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlNodeConfigurationResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlNodeConfigurationResource(id); } - #endregion - #region CosmosDBForPostgreSqlFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlFirewallRuleResource GetCosmosDBForPostgreSqlFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlFirewallRuleResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlFirewallRuleResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlFirewallRuleResource(id); } - #endregion - #region CosmosDBForPostgreSqlRoleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlRoleResource GetCosmosDBForPostgreSqlRoleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlRoleResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlRoleResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlRoleResource(id); } - #endregion - #region CosmosDBForPostgreSqlPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlPrivateEndpointConnectionResource GetCosmosDBForPostgreSqlPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlPrivateEndpointConnectionResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlPrivateEndpointConnectionResource(id); } - #endregion - #region CosmosDBForPostgreSqlPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CosmosDBForPostgreSqlPrivateLinkResource GetCosmosDBForPostgreSqlPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CosmosDBForPostgreSqlPrivateLinkResource.ValidateResourceId(id); - return new CosmosDBForPostgreSqlPrivateLinkResource(client, id); - } - ); + return GetMockableCosmosDBForPostgreSqlArmClient(client).GetCosmosDBForPostgreSqlPrivateLinkResource(id); } - #endregion - /// Gets a collection of CosmosDBForPostgreSqlClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of CosmosDBForPostgreSqlClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CosmosDBForPostgreSqlClusterResources and their operations over a CosmosDBForPostgreSqlClusterResource. public static CosmosDBForPostgreSqlClusterCollection GetCosmosDBForPostgreSqlClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCosmosDBForPostgreSqlClusters(); + return GetMockableCosmosDBForPostgreSqlResourceGroupResource(resourceGroupResource).GetCosmosDBForPostgreSqlClusters(); } /// @@ -241,16 +205,20 @@ public static CosmosDBForPostgreSqlClusterCollection GetCosmosDBForPostgreSqlClu /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCosmosDBForPostgreSqlClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCosmosDBForPostgreSqlClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableCosmosDBForPostgreSqlResourceGroupResource(resourceGroupResource).GetCosmosDBForPostgreSqlClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -265,16 +233,20 @@ public static async Task> GetCosm /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCosmosDBForPostgreSqlCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCosmosDBForPostgreSqlClusters().Get(clusterName, cancellationToken); + return GetMockableCosmosDBForPostgreSqlResourceGroupResource(resourceGroupResource).GetCosmosDBForPostgreSqlCluster(clusterName, cancellationToken); } /// @@ -289,13 +261,17 @@ public static Response GetCosmosDBForPostg /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCosmosDBForPostgreSqlClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCosmosDBForPostgreSqlClustersAsync(cancellationToken); + return GetMockableCosmosDBForPostgreSqlSubscriptionResource(subscriptionResource).GetCosmosDBForPostgreSqlClustersAsync(cancellationToken); } /// @@ -310,13 +286,17 @@ public static AsyncPageable GetCosmosDBFor /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCosmosDBForPostgreSqlClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCosmosDBForPostgreSqlClusters(cancellationToken); + return GetMockableCosmosDBForPostgreSqlSubscriptionResource(subscriptionResource).GetCosmosDBForPostgreSqlClusters(cancellationToken); } /// @@ -331,6 +311,10 @@ public static Pageable GetCosmosDBForPostg /// Clusters_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if cluster name is available. @@ -338,9 +322,7 @@ public static Pageable GetCosmosDBForPostg /// is null. public static async Task> CheckCosmosDBForPostgreSqlClusterNameAvailabilityAsync(this SubscriptionResource subscriptionResource, CosmosDBForPostgreSqlClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckCosmosDBForPostgreSqlClusterNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCosmosDBForPostgreSqlSubscriptionResource(subscriptionResource).CheckCosmosDBForPostgreSqlClusterNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -355,6 +337,10 @@ public static async TaskClusters_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if cluster name is available. @@ -362,9 +348,7 @@ public static async Task is null. public static Response CheckCosmosDBForPostgreSqlClusterNameAvailability(this SubscriptionResource subscriptionResource, CosmosDBForPostgreSqlClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckCosmosDBForPostgreSqlClusterNameAvailability(content, cancellationToken); + return GetMockableCosmosDBForPostgreSqlSubscriptionResource(subscriptionResource).CheckCosmosDBForPostgreSqlClusterNameAvailability(content, cancellationToken); } } } diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlArmClient.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlArmClient.cs new file mode 100644 index 0000000000000..1db6c5efcbca1 --- /dev/null +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlArmClient.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDBForPostgreSql; + +namespace Azure.ResourceManager.CosmosDBForPostgreSql.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableCosmosDBForPostgreSqlArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCosmosDBForPostgreSqlArmClient() + { + } + + /// 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 MockableCosmosDBForPostgreSqlArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableCosmosDBForPostgreSqlArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlClusterResource GetCosmosDBForPostgreSqlClusterResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlClusterResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlClusterServerResource GetCosmosDBForPostgreSqlClusterServerResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlClusterServerResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlClusterServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlConfigurationResource GetCosmosDBForPostgreSqlConfigurationResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlConfigurationResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlCoordinatorConfigurationResource GetCosmosDBForPostgreSqlCoordinatorConfigurationResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlCoordinatorConfigurationResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlCoordinatorConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlNodeConfigurationResource GetCosmosDBForPostgreSqlNodeConfigurationResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlNodeConfigurationResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlNodeConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlFirewallRuleResource GetCosmosDBForPostgreSqlFirewallRuleResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlFirewallRuleResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlRoleResource GetCosmosDBForPostgreSqlRoleResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlRoleResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlRoleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlPrivateEndpointConnectionResource GetCosmosDBForPostgreSqlPrivateEndpointConnectionResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlPrivateEndpointConnectionResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CosmosDBForPostgreSqlPrivateLinkResource GetCosmosDBForPostgreSqlPrivateLinkResource(ResourceIdentifier id) + { + CosmosDBForPostgreSqlPrivateLinkResource.ValidateResourceId(id); + return new CosmosDBForPostgreSqlPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlResourceGroupResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlResourceGroupResource.cs new file mode 100644 index 0000000000000..55e4a9dfb7782 --- /dev/null +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.CosmosDBForPostgreSql; + +namespace Azure.ResourceManager.CosmosDBForPostgreSql.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableCosmosDBForPostgreSqlResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCosmosDBForPostgreSqlResourceGroupResource() + { + } + + /// 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 MockableCosmosDBForPostgreSqlResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CosmosDBForPostgreSqlClusterResources in the ResourceGroupResource. + /// An object representing collection of CosmosDBForPostgreSqlClusterResources and their operations over a CosmosDBForPostgreSqlClusterResource. + public virtual CosmosDBForPostgreSqlClusterCollection GetCosmosDBForPostgreSqlClusters() + { + return GetCachedClient(client => new CosmosDBForPostgreSqlClusterCollection(client, Id)); + } + + /// + /// Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCosmosDBForPostgreSqlClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetCosmosDBForPostgreSqlClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a cluster such as compute and storage configuration and cluster lifecycle metadata such as cluster creation date and time. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCosmosDBForPostgreSqlCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetCosmosDBForPostgreSqlClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlSubscriptionResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlSubscriptionResource.cs new file mode 100644 index 0000000000000..c0ab65b02f7b9 --- /dev/null +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/MockableCosmosDBForPostgreSqlSubscriptionResource.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.CosmosDBForPostgreSql; +using Azure.ResourceManager.CosmosDBForPostgreSql.Models; + +namespace Azure.ResourceManager.CosmosDBForPostgreSql.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableCosmosDBForPostgreSqlSubscriptionResource : ArmResource + { + private ClientDiagnostics _cosmosDBForPostgreSqlClusterClustersClientDiagnostics; + private ClustersRestOperations _cosmosDBForPostgreSqlClusterClustersRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCosmosDBForPostgreSqlSubscriptionResource() + { + } + + /// 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 MockableCosmosDBForPostgreSqlSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CosmosDBForPostgreSqlClusterClustersClientDiagnostics => _cosmosDBForPostgreSqlClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDBForPostgreSql", CosmosDBForPostgreSqlClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations CosmosDBForPostgreSqlClusterClustersRestClient => _cosmosDBForPostgreSqlClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CosmosDBForPostgreSqlClusterResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all clusters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2 + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCosmosDBForPostgreSqlClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), CosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "MockableCosmosDBForPostgreSqlSubscriptionResource.GetCosmosDBForPostgreSqlClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all clusters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2 + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCosmosDBForPostgreSqlClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), CosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "MockableCosmosDBForPostgreSqlSubscriptionResource.GetCosmosDBForPostgreSqlClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability + /// + /// + /// Operation Id + /// Clusters_CheckNameAvailability + /// + /// + /// + /// The required parameters for checking if cluster name is available. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckCosmosDBForPostgreSqlClusterNameAvailabilityAsync(CosmosDBForPostgreSqlClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CosmosDBForPostgreSqlClusterClustersClientDiagnostics.CreateScope("MockableCosmosDBForPostgreSqlSubscriptionResource.CheckCosmosDBForPostgreSqlClusterNameAvailability"); + scope.Start(); + try + { + var response = await CosmosDBForPostgreSqlClusterClustersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability + /// + /// + /// Operation Id + /// Clusters_CheckNameAvailability + /// + /// + /// + /// The required parameters for checking if cluster name is available. + /// The cancellation token to use. + /// is null. + public virtual Response CheckCosmosDBForPostgreSqlClusterNameAvailability(CosmosDBForPostgreSqlClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CosmosDBForPostgreSqlClusterClustersClientDiagnostics.CreateScope("MockableCosmosDBForPostgreSqlSubscriptionResource.CheckCosmosDBForPostgreSqlClusterNameAvailability"); + scope.Start(); + try + { + var response = CosmosDBForPostgreSqlClusterClustersRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index b253817e3d4b3..0000000000000 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CosmosDBForPostgreSql -{ - /// 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 CosmosDBForPostgreSqlClusterResources in the ResourceGroupResource. - /// An object representing collection of CosmosDBForPostgreSqlClusterResources and their operations over a CosmosDBForPostgreSqlClusterResource. - public virtual CosmosDBForPostgreSqlClusterCollection GetCosmosDBForPostgreSqlClusters() - { - return GetCachedClient(Client => new CosmosDBForPostgreSqlClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 3f97299bef200..0000000000000 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.CosmosDBForPostgreSql.Models; - -namespace Azure.ResourceManager.CosmosDBForPostgreSql -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _cosmosDBForPostgreSqlClusterClustersClientDiagnostics; - private ClustersRestOperations _cosmosDBForPostgreSqlClusterClustersRestClient; - - /// 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 CosmosDBForPostgreSqlClusterClustersClientDiagnostics => _cosmosDBForPostgreSqlClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CosmosDBForPostgreSql", CosmosDBForPostgreSqlClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations CosmosDBForPostgreSqlClusterClustersRestClient => _cosmosDBForPostgreSqlClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CosmosDBForPostgreSqlClusterResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all clusters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2 - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCosmosDBForPostgreSqlClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), CosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBForPostgreSqlClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all clusters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2 - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCosmosDBForPostgreSqlClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CosmosDBForPostgreSqlClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CosmosDBForPostgreSqlClusterResource(Client, CosmosDBForPostgreSqlClusterData.DeserializeCosmosDBForPostgreSqlClusterData(e)), CosmosDBForPostgreSqlClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCosmosDBForPostgreSqlClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability - /// - /// - /// Operation Id - /// Clusters_CheckNameAvailability - /// - /// - /// - /// The required parameters for checking if cluster name is available. - /// The cancellation token to use. - public virtual async Task> CheckCosmosDBForPostgreSqlClusterNameAvailabilityAsync(CosmosDBForPostgreSqlClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CosmosDBForPostgreSqlClusterClustersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckCosmosDBForPostgreSqlClusterNameAvailability"); - scope.Start(); - try - { - var response = await CosmosDBForPostgreSqlClusterClustersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks availability of a cluster name. Cluster names should be globally unique; at least 3 characters and at most 40 characters long; they must only contain lowercase letters, numbers, and hyphens; and must not start or end with a hyphen. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability - /// - /// - /// Operation Id - /// Clusters_CheckNameAvailability - /// - /// - /// - /// The required parameters for checking if cluster name is available. - /// The cancellation token to use. - public virtual Response CheckCosmosDBForPostgreSqlClusterNameAvailability(CosmosDBForPostgreSqlClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CosmosDBForPostgreSqlClusterClustersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckCosmosDBForPostgreSqlClusterNameAvailability"); - scope.Start(); - try - { - var response = CosmosDBForPostgreSqlClusterClustersRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/api/Azure.ResourceManager.CostManagement.netstandard2.0.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/api/Azure.ResourceManager.CostManagement.netstandard2.0.cs index 70a8d288eae83..7d32023f81fa7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/api/Azure.ResourceManager.CostManagement.netstandard2.0.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/api/Azure.ResourceManager.CostManagement.netstandard2.0.cs @@ -319,6 +319,89 @@ protected TenantsCostManagementViewsResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CostManagement.CostManagementViewData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.CostManagement.Mocking +{ + public partial class MockableCostManagementArmClient : Azure.ResourceManager.ArmResource + { + protected MockableCostManagementArmClient() { } + public virtual Azure.Response CheckCostManagementNameAvailabilityByScopeScheduledAction(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.CostManagement.Models.CostManagementNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckCostManagementNameAvailabilityByScopeScheduledActionAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.CostManagement.Models.CostManagementNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CostManagement.CostManagementViewsCollection GetAllCostManagementViews(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetBenefitRecommendations(Azure.Core.ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBenefitRecommendationsAsync(Azure.Core.ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCostManagementAlert(Azure.Core.ResourceIdentifier scope, string alertId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCostManagementAlertAsync(Azure.Core.ResourceIdentifier scope, string alertId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CostManagement.CostManagementAlertResource GetCostManagementAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CostManagement.CostManagementAlertCollection GetCostManagementAlerts(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetCostManagementExport(Azure.Core.ResourceIdentifier scope, string exportName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCostManagementExportAsync(Azure.Core.ResourceIdentifier scope, string exportName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CostManagement.CostManagementExportResource GetCostManagementExportResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CostManagement.CostManagementExportCollection GetCostManagementExports(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetCostManagementViews(Azure.Core.ResourceIdentifier scope, string viewName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCostManagementViewsAsync(Azure.Core.ResourceIdentifier scope, string viewName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CostManagement.CostManagementViewsResource GetCostManagementViewsResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Pageable GetDimensions(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDimensionsAsync(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetScheduledAction(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScheduledActionAsync(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CostManagement.ScheduledActionResource GetScheduledActionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CostManagement.ScheduledActionCollection GetScheduledActions(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.CostManagement.TenantScheduledActionResource GetTenantScheduledActionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CostManagement.TenantsCostManagementViewsResource GetTenantsCostManagementViewsResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response UsageForecast(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.CostManagement.Models.ForecastDefinition forecastDefinition, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UsageForecastAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.CostManagement.Models.ForecastDefinition forecastDefinition, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UsageQuery(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.CostManagement.Models.QueryDefinition queryDefinition, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UsageQueryAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.CostManagement.Models.QueryDefinition queryDefinition, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableCostManagementTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableCostManagementTenantResource() { } + public virtual Azure.ResourceManager.ArmOperation ByBillingAccountIdGenerateReservationDetailsReport(Azure.WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ByBillingAccountIdGenerateReservationDetailsReportAsync(Azure.WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation ByBillingProfileIdGenerateReservationDetailsReport(Azure.WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ByBillingProfileIdGenerateReservationDetailsReportAsync(Azure.WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ByExternalCloudProviderTypeDimensions(Azure.ResourceManager.CostManagement.Models.TenantResourceByExternalCloudProviderTypeDimensionsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ByExternalCloudProviderTypeDimensionsAsync(Azure.ResourceManager.CostManagement.Models.TenantResourceByExternalCloudProviderTypeDimensionsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckCostManagementNameAvailabilityByScheduledAction(Azure.ResourceManager.CostManagement.Models.CostManagementNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckCostManagementNameAvailabilityByScheduledActionAsync(Azure.ResourceManager.CostManagement.Models.CostManagementNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation DownloadByBillingProfilePriceSheet(Azure.WaitUntil waitUntil, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DownloadByBillingProfilePriceSheetAsync(Azure.WaitUntil waitUntil, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation DownloadPriceSheet(Azure.WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DownloadPriceSheetAsync(Azure.WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExternalCloudProviderUsageForecast(Azure.ResourceManager.CostManagement.Models.ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, Azure.ResourceManager.CostManagement.Models.ForecastDefinition forecastDefinition, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExternalCloudProviderUsageForecastAsync(Azure.ResourceManager.CostManagement.Models.ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, Azure.ResourceManager.CostManagement.Models.ForecastDefinition forecastDefinition, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(Azure.WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(Azure.WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation GenerateBenefitUtilizationSummariesReportBillingAccountScope(Azure.WaitUntil waitUntil, string billingAccountId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(Azure.WaitUntil waitUntil, string billingAccountId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation GenerateBenefitUtilizationSummariesReportBillingProfileScope(Azure.WaitUntil waitUntil, string billingAccountId, string billingProfileId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(Azure.WaitUntil waitUntil, string billingAccountId, string billingProfileId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation GenerateBenefitUtilizationSummariesReportReservationOrderScope(Azure.WaitUntil waitUntil, string reservationOrderId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(Azure.WaitUntil waitUntil, string reservationOrderId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation GenerateBenefitUtilizationSummariesReportReservationScope(Azure.WaitUntil waitUntil, string reservationOrderId, string reservationId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateBenefitUtilizationSummariesReportReservationScopeAsync(Azure.WaitUntil waitUntil, string reservationOrderId, string reservationId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(Azure.WaitUntil waitUntil, string savingsPlanOrderId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(Azure.WaitUntil waitUntil, string savingsPlanOrderId, Azure.ResourceManager.CostManagement.Models.BenefitUtilizationSummariesContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CostManagement.TenantsCostManagementViewsCollection GetAllTenantsCostManagementViews() { throw null; } + public virtual Azure.Pageable GetBenefitUtilizationSummariesByBillingAccountId(string billingAccountId, Azure.ResourceManager.CostManagement.Models.GrainContent? grainParameter = default(Azure.ResourceManager.CostManagement.Models.GrainContent?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBenefitUtilizationSummariesByBillingAccountIdAsync(string billingAccountId, Azure.ResourceManager.CostManagement.Models.GrainContent? grainParameter = default(Azure.ResourceManager.CostManagement.Models.GrainContent?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBenefitUtilizationSummariesByBillingProfileId(string billingAccountId, string billingProfileId, Azure.ResourceManager.CostManagement.Models.GrainContent? grainParameter = default(Azure.ResourceManager.CostManagement.Models.GrainContent?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBenefitUtilizationSummariesByBillingProfileIdAsync(string billingAccountId, string billingProfileId, Azure.ResourceManager.CostManagement.Models.GrainContent? grainParameter = default(Azure.ResourceManager.CostManagement.Models.GrainContent?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBenefitUtilizationSummariesBySavingsPlanId(string savingsPlanOrderId, string savingsPlanId, string filter = null, Azure.ResourceManager.CostManagement.Models.GrainContent? grainParameter = default(Azure.ResourceManager.CostManagement.Models.GrainContent?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanIdAsync(string savingsPlanOrderId, string savingsPlanId, string filter = null, Azure.ResourceManager.CostManagement.Models.GrainContent? grainParameter = default(Azure.ResourceManager.CostManagement.Models.GrainContent?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBenefitUtilizationSummariesBySavingsPlanOrder(string savingsPlanOrderId, string filter = null, Azure.ResourceManager.CostManagement.Models.GrainContent? grainParameter = default(Azure.ResourceManager.CostManagement.Models.GrainContent?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(string savingsPlanOrderId, string filter = null, Azure.ResourceManager.CostManagement.Models.GrainContent? grainParameter = default(Azure.ResourceManager.CostManagement.Models.GrainContent?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCostManagementAlerts(Azure.ResourceManager.CostManagement.Models.ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCostManagementAlertsAsync(Azure.ResourceManager.CostManagement.Models.ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTenantScheduledAction(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTenantScheduledActionAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CostManagement.TenantScheduledActionCollection GetTenantScheduledActions() { throw null; } + public virtual Azure.Response GetTenantsCostManagementViews(string viewName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTenantsCostManagementViewsAsync(string viewName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UsageByExternalCloudProviderTypeQuery(Azure.ResourceManager.CostManagement.Models.ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, Azure.ResourceManager.CostManagement.Models.QueryDefinition queryDefinition, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UsageByExternalCloudProviderTypeQueryAsync(Azure.ResourceManager.CostManagement.Models.ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, Azure.ResourceManager.CostManagement.Models.QueryDefinition queryDefinition, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.CostManagement.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertResource.cs index bc4c38a45f099..8ad267a7cebe6 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.CostManagement public partial class CostManagementAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The alertId. public static ResourceIdentifier CreateResourceIdentifier(string scope, string alertId) { var resourceId = $"{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportResource.cs index 360a328a48067..35fba4807b179 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.CostManagement public partial class CostManagementExportResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The exportName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string exportName) { var resourceId = $"{scope}/providers/Microsoft.CostManagement/exports/{exportName}"; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsResource.cs index 4d5fd1c628b18..f22a81c686fb8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.CostManagement public partial class CostManagementViewsResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The viewName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string viewName) { var resourceId = $"{scope}/providers/Microsoft.CostManagement/views/{viewName}"; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 95011d0e1e1cd..0000000000000 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.CostManagement.Models; - -namespace Azure.ResourceManager.CostManagement -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _benefitRecommendationsClientDiagnostics; - private BenefitRecommendationsRestOperations _benefitRecommendationsRestClient; - private ClientDiagnostics _forecastClientDiagnostics; - private ForecastRestOperations _forecastRestClient; - private ClientDiagnostics _dimensionsClientDiagnostics; - private DimensionsRestOperations _dimensionsRestClient; - private ClientDiagnostics _queryClientDiagnostics; - private QueryRestOperations _queryRestClient; - private ClientDiagnostics _scheduledActionsClientDiagnostics; - private ScheduledActionsRestOperations _scheduledActionsRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics BenefitRecommendationsClientDiagnostics => _benefitRecommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BenefitRecommendationsRestOperations BenefitRecommendationsRestClient => _benefitRecommendationsRestClient ??= new BenefitRecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ForecastClientDiagnostics => _forecastClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ForecastRestOperations ForecastRestClient => _forecastRestClient ??= new ForecastRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DimensionsClientDiagnostics => _dimensionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DimensionsRestOperations DimensionsRestClient => _dimensionsRestClient ??= new DimensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics QueryClientDiagnostics => _queryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private QueryRestOperations QueryRestClient => _queryRestClient ??= new QueryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ScheduledActionsClientDiagnostics => _scheduledActionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ScheduledActionsRestOperations ScheduledActionsRestClient => _scheduledActionsRestClient ??= new ScheduledActionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of CostManagementExportResources in the ArmResource. - /// An object representing collection of CostManagementExportResources and their operations over a CostManagementExportResource. - public virtual CostManagementExportCollection GetCostManagementExports() - { - return GetCachedClient(Client => new CostManagementExportCollection(Client, Id)); - } - - /// Gets a collection of CostManagementViewsResources in the ArmResource. - /// An object representing collection of CostManagementViewsResources and their operations over a CostManagementViewsResource. - public virtual CostManagementViewsCollection GetAllCostManagementViews() - { - return GetCachedClient(Client => new CostManagementViewsCollection(Client, Id)); - } - - /// Gets a collection of CostManagementAlertResources in the ArmResource. - /// An object representing collection of CostManagementAlertResources and their operations over a CostManagementAlertResource. - public virtual CostManagementAlertCollection GetCostManagementAlerts() - { - return GetCachedClient(Client => new CostManagementAlertCollection(Client, Id)); - } - - /// Gets a collection of ScheduledActionResources in the ArmResource. - /// An object representing collection of ScheduledActionResources and their operations over a ScheduledActionResource. - public virtual ScheduledActionCollection GetScheduledActions() - { - return GetCachedClient(Client => new ScheduledActionCollection(Client, Id)); - } - - /// - /// List of recommendations for purchasing savings plan. - /// - /// - /// Request Path - /// /{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations - /// - /// - /// Operation Id - /// BenefitRecommendations_List - /// - /// - /// - /// Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup. - /// May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. - /// May be used to expand the properties by: properties/usage, properties/allRecommendationDetails. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitRecommendationsAsync(string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitRecommendationsRestClient.CreateListRequest(Id, filter, orderby, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitRecommendationsRestClient.CreateListNextPageRequest(nextLink, Id, filter, orderby, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitRecommendationModel.DeserializeBenefitRecommendationModel, BenefitRecommendationsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetBenefitRecommendations", "value", "nextLink", cancellationToken); - } - - /// - /// List of recommendations for purchasing savings plan. - /// - /// - /// Request Path - /// /{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations - /// - /// - /// Operation Id - /// BenefitRecommendations_List - /// - /// - /// - /// Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup. - /// May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. - /// May be used to expand the properties by: properties/usage, properties/allRecommendationDetails. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitRecommendations(string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitRecommendationsRestClient.CreateListRequest(Id, filter, orderby, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitRecommendationsRestClient.CreateListNextPageRequest(nextLink, Id, filter, orderby, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitRecommendationModel.DeserializeBenefitRecommendationModel, BenefitRecommendationsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetBenefitRecommendations", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the forecast charges for scope defined. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/forecast - /// - /// - /// Operation Id - /// Forecast_Usage - /// - /// - /// - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// The cancellation token to use. - public virtual async Task> UsageForecastAsync(ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) - { - using var scope = ForecastClientDiagnostics.CreateScope("ArmResourceExtensionClient.UsageForecast"); - scope.Start(); - try - { - var response = await ForecastRestClient.UsageAsync(Id, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the forecast charges for scope defined. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/forecast - /// - /// - /// Operation Id - /// Forecast_Usage - /// - /// - /// - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// The cancellation token to use. - public virtual Response UsageForecast(ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) - { - using var scope = ForecastClientDiagnostics.CreateScope("ArmResourceExtensionClient.UsageForecast"); - scope.Start(); - try - { - var response = ForecastRestClient.Usage(Id, forecastDefinition, filter, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the dimensions by the defined scope. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/dimensions - /// - /// - /// Operation Id - /// Dimensions_List - /// - /// - /// - /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. - /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N dimension data. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDimensionsAsync(string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateListRequest(Id, filter, expand, skiptoken, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CostManagementDimension.DeserializeCostManagementDimension, DimensionsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetDimensions", "value", null, cancellationToken); - } - - /// - /// Lists the dimensions by the defined scope. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/dimensions - /// - /// - /// Operation Id - /// Dimensions_List - /// - /// - /// - /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. - /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// May be used to limit the number of results to the most recent N dimension data. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDimensions(string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateListRequest(Id, filter, expand, skiptoken, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CostManagementDimension.DeserializeCostManagementDimension, DimensionsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetDimensions", "value", null, cancellationToken); - } - - /// - /// Query the usage data for scope defined. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/query - /// - /// - /// Operation Id - /// Query_Usage - /// - /// - /// - /// Parameters supplied to the CreateOrUpdate Query Config operation. - /// The cancellation token to use. - public virtual async Task> UsageQueryAsync(QueryDefinition queryDefinition, CancellationToken cancellationToken = default) - { - using var scope = QueryClientDiagnostics.CreateScope("ArmResourceExtensionClient.UsageQuery"); - scope.Start(); - try - { - var response = await QueryRestClient.UsageAsync(Id, queryDefinition, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Query the usage data for scope defined. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/query - /// - /// - /// Operation Id - /// Query_Usage - /// - /// - /// - /// Parameters supplied to the CreateOrUpdate Query Config operation. - /// The cancellation token to use. - public virtual Response UsageQuery(QueryDefinition queryDefinition, CancellationToken cancellationToken = default) - { - using var scope = QueryClientDiagnostics.CreateScope("ArmResourceExtensionClient.UsageQuery"); - scope.Start(); - try - { - var response = QueryRestClient.Usage(Id, queryDefinition, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks availability and correctness of the name for a scheduled action within the given scope. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/checkNameAvailability - /// - /// - /// Operation Id - /// ScheduledActions_CheckNameAvailabilityByScope - /// - /// - /// - /// Scheduled action to be created or updated. - /// The cancellation token to use. - public virtual async Task> CheckCostManagementNameAvailabilityByScopeScheduledActionAsync(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ScheduledActionsClientDiagnostics.CreateScope("ArmResourceExtensionClient.CheckCostManagementNameAvailabilityByScopeScheduledAction"); - scope.Start(); - try - { - var response = await ScheduledActionsRestClient.CheckNameAvailabilityByScopeAsync(Id, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks availability and correctness of the name for a scheduled action within the given scope. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/checkNameAvailability - /// - /// - /// Operation Id - /// ScheduledActions_CheckNameAvailabilityByScope - /// - /// - /// - /// Scheduled action to be created or updated. - /// The cancellation token to use. - public virtual Response CheckCostManagementNameAvailabilityByScopeScheduledAction(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ScheduledActionsClientDiagnostics.CreateScope("ArmResourceExtensionClient.CheckCostManagementNameAvailabilityByScopeScheduledAction"); - scope.Start(); - try - { - var response = ScheduledActionsRestClient.CheckNameAvailabilityByScope(Id, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/CostManagementExtensions.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/CostManagementExtensions.cs index ba58d05238a84..85803ab52f8bb 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/CostManagementExtensions.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/CostManagementExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.CostManagement.Mocking; using Azure.ResourceManager.CostManagement.Models; using Azure.ResourceManager.Resources; @@ -19,158 +20,29 @@ namespace Azure.ResourceManager.CostManagement /// A class to add extension methods to Azure.ResourceManager.CostManagement. public static partial class CostManagementExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableCostManagementArmClient GetMockableCostManagementArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableCostManagementArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCostManagementTenantResource GetMockableCostManagementTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCostManagementTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region CostManagementExportResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CostManagementExportResource GetCostManagementExportResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - CostManagementExportResource.ValidateResourceId(id); - return new CostManagementExportResource(client, id); - } - ); - } - #endregion - - #region TenantsCostManagementViewsResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static TenantsCostManagementViewsResource GetTenantsCostManagementViewsResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - TenantsCostManagementViewsResource.ValidateResourceId(id); - return new TenantsCostManagementViewsResource(client, id); - } - ); - } - #endregion - - #region CostManagementViewsResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CostManagementViewsResource GetCostManagementViewsResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - CostManagementViewsResource.ValidateResourceId(id); - return new CostManagementViewsResource(client, id); - } - ); - } - #endregion - - #region CostManagementAlertResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CostManagementAlertResource GetCostManagementAlertResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - CostManagementAlertResource.ValidateResourceId(id); - return new CostManagementAlertResource(client, id); - } - ); - } - #endregion - - #region TenantScheduledActionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static TenantScheduledActionResource GetTenantScheduledActionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - TenantScheduledActionResource.ValidateResourceId(id); - return new TenantScheduledActionResource(client, id); - } - ); - } - #endregion - - #region ScheduledActionResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of CostManagementExportResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ScheduledActionResource GetScheduledActionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ScheduledActionResource.ValidateResourceId(id); - return new ScheduledActionResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of CostManagementExportResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of CostManagementExportResources and their operations over a CostManagementExportResource. public static CostManagementExportCollection GetCostManagementExports(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetCostManagementExports(); + return GetMockableCostManagementArmClient(client).GetCostManagementExports(scope); } /// @@ -185,18 +57,22 @@ public static CostManagementExportCollection GetCostManagementExports(this ArmCl /// Exports_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Export Name. /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCostManagementExportAsync(this ArmClient client, ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) { - return await client.GetCostManagementExports(scope).GetAsync(exportName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).GetCostManagementExportAsync(scope, exportName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -211,27 +87,37 @@ public static async Task> GetCostManageme /// Exports_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Export Name. /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCostManagementExport(this ArmClient client, ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) { - return client.GetCostManagementExports(scope).Get(exportName, expand, cancellationToken); + return GetMockableCostManagementArmClient(client).GetCostManagementExport(scope, exportName, expand, cancellationToken); } - /// Gets a collection of CostManagementViewsResources in the ArmResource. + /// + /// Gets a collection of CostManagementViewsResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of CostManagementViewsResources and their operations over a CostManagementViewsResource. public static CostManagementViewsCollection GetAllCostManagementViews(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetAllCostManagementViews(); + return GetMockableCostManagementArmClient(client).GetAllCostManagementViews(scope); } /// @@ -246,17 +132,21 @@ public static CostManagementViewsCollection GetAllCostManagementViews(this ArmCl /// Views_GetByScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// View name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCostManagementViewsAsync(this ArmClient client, ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) { - return await client.GetAllCostManagementViews(scope).GetAsync(viewName, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).GetCostManagementViewsAsync(scope, viewName, cancellationToken).ConfigureAwait(false); } /// @@ -271,26 +161,36 @@ public static async Task> GetCostManagemen /// Views_GetByScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// View name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCostManagementViews(this ArmClient client, ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) { - return client.GetAllCostManagementViews(scope).Get(viewName, cancellationToken); + return GetMockableCostManagementArmClient(client).GetCostManagementViews(scope, viewName, cancellationToken); } - /// Gets a collection of CostManagementAlertResources in the ArmResource. + /// + /// Gets a collection of CostManagementAlertResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of CostManagementAlertResources and their operations over a CostManagementAlertResource. public static CostManagementAlertCollection GetCostManagementAlerts(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetCostManagementAlerts(); + return GetMockableCostManagementArmClient(client).GetCostManagementAlerts(scope); } /// @@ -305,6 +205,10 @@ public static CostManagementAlertCollection GetCostManagementAlerts(this ArmClie /// Alerts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -314,7 +218,7 @@ public static CostManagementAlertCollection GetCostManagementAlerts(this ArmClie [ForwardsClientCalls] public static async Task> GetCostManagementAlertAsync(this ArmClient client, ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) { - return await client.GetCostManagementAlerts(scope).GetAsync(alertId, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).GetCostManagementAlertAsync(scope, alertId, cancellationToken).ConfigureAwait(false); } /// @@ -329,6 +233,10 @@ public static async Task> GetCostManagemen /// Alerts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -338,16 +246,22 @@ public static async Task> GetCostManagemen [ForwardsClientCalls] public static Response GetCostManagementAlert(this ArmClient client, ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) { - return client.GetCostManagementAlerts(scope).Get(alertId, cancellationToken); + return GetMockableCostManagementArmClient(client).GetCostManagementAlert(scope, alertId, cancellationToken); } - /// Gets a collection of ScheduledActionResources in the ArmResource. + /// + /// Gets a collection of ScheduledActionResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of ScheduledActionResources and their operations over a ScheduledActionResource. public static ScheduledActionCollection GetScheduledActions(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetScheduledActions(); + return GetMockableCostManagementArmClient(client).GetScheduledActions(scope); } /// @@ -362,17 +276,21 @@ public static ScheduledActionCollection GetScheduledActions(this ArmClient clien /// ScheduledActions_GetByScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Scheduled action name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScheduledActionAsync(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - return await client.GetScheduledActions(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).GetScheduledActionAsync(scope, name, cancellationToken).ConfigureAwait(false); } /// @@ -387,17 +305,21 @@ public static async Task> GetScheduledActionAs /// ScheduledActions_GetByScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Scheduled action name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScheduledAction(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - return client.GetScheduledActions(scope).Get(name, cancellationToken); + return GetMockableCostManagementArmClient(client).GetScheduledAction(scope, name, cancellationToken); } /// @@ -412,6 +334,10 @@ public static Response GetScheduledAction(this ArmClien /// BenefitRecommendations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -421,7 +347,7 @@ public static Response GetScheduledAction(this ArmClien /// The cancellation token to use. public static AsyncPageable GetBenefitRecommendationsAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetBenefitRecommendationsAsync(filter, orderby, expand, cancellationToken); + return GetMockableCostManagementArmClient(client).GetBenefitRecommendationsAsync(scope, filter, orderby, expand, cancellationToken); } /// @@ -436,6 +362,10 @@ public static AsyncPageable GetBenefitRecommendation /// BenefitRecommendations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -445,7 +375,7 @@ public static AsyncPageable GetBenefitRecommendation /// The cancellation token to use. public static Pageable GetBenefitRecommendations(this ArmClient client, ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetBenefitRecommendations(filter, orderby, expand, cancellationToken); + return GetMockableCostManagementArmClient(client).GetBenefitRecommendations(scope, filter, orderby, expand, cancellationToken); } /// @@ -460,6 +390,10 @@ public static Pageable GetBenefitRecommendations(thi /// Forecast_Usage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -469,9 +403,7 @@ public static Pageable GetBenefitRecommendations(thi /// is null. public static async Task> UsageForecastAsync(this ArmClient client, ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); - - return await GetArmResourceExtensionClient(client, scope).UsageForecastAsync(forecastDefinition, filter, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).UsageForecastAsync(scope, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); } /// @@ -486,6 +418,10 @@ public static async Task> UsageForecastAsync(this ArmCl /// Forecast_Usage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -495,9 +431,7 @@ public static async Task> UsageForecastAsync(this ArmCl /// is null. public static Response UsageForecast(this ArmClient client, ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); - - return GetArmResourceExtensionClient(client, scope).UsageForecast(forecastDefinition, filter, cancellationToken); + return GetMockableCostManagementArmClient(client).UsageForecast(scope, forecastDefinition, filter, cancellationToken); } /// @@ -512,6 +446,10 @@ public static Response UsageForecast(this ArmClient client, Reso /// Dimensions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -522,7 +460,7 @@ public static Response UsageForecast(this ArmClient client, Reso /// The cancellation token to use. public static AsyncPageable GetDimensionsAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetDimensionsAsync(filter, expand, skiptoken, top, cancellationToken); + return GetMockableCostManagementArmClient(client).GetDimensionsAsync(scope, filter, expand, skiptoken, top, cancellationToken); } /// @@ -537,6 +475,10 @@ public static AsyncPageable GetDimensionsAsync(this Arm /// Dimensions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -547,7 +489,7 @@ public static AsyncPageable GetDimensionsAsync(this Arm /// The cancellation token to use. public static Pageable GetDimensions(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetDimensions(filter, expand, skiptoken, top, cancellationToken); + return GetMockableCostManagementArmClient(client).GetDimensions(scope, filter, expand, skiptoken, top, cancellationToken); } /// @@ -562,6 +504,10 @@ public static Pageable GetDimensions(this ArmClient cli /// Query_Usage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -570,9 +516,7 @@ public static Pageable GetDimensions(this ArmClient cli /// is null. public static async Task> UsageQueryAsync(this ArmClient client, ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); - - return await GetArmResourceExtensionClient(client, scope).UsageQueryAsync(queryDefinition, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).UsageQueryAsync(scope, queryDefinition, cancellationToken).ConfigureAwait(false); } /// @@ -587,6 +531,10 @@ public static async Task> UsageQueryAsync(this ArmClient c /// Query_Usage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -595,9 +543,7 @@ public static async Task> UsageQueryAsync(this ArmClient c /// is null. public static Response UsageQuery(this ArmClient client, ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); - - return GetArmResourceExtensionClient(client, scope).UsageQuery(queryDefinition, cancellationToken); + return GetMockableCostManagementArmClient(client).UsageQuery(scope, queryDefinition, cancellationToken); } /// @@ -612,6 +558,10 @@ public static Response UsageQuery(this ArmClient client, ResourceId /// ScheduledActions_CheckNameAvailabilityByScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -620,9 +570,7 @@ public static Response UsageQuery(this ArmClient client, ResourceId /// is null. public static async Task> CheckCostManagementNameAvailabilityByScopeScheduledActionAsync(this ArmClient client, ResourceIdentifier scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetArmResourceExtensionClient(client, scope).CheckCostManagementNameAvailabilityByScopeScheduledActionAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).CheckCostManagementNameAvailabilityByScopeScheduledActionAsync(scope, content, cancellationToken).ConfigureAwait(false); } /// @@ -637,6 +585,10 @@ public static async Task> CheckCo /// ScheduledActions_CheckNameAvailabilityByScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -645,17 +597,117 @@ public static async Task> CheckCo /// is null. public static Response CheckCostManagementNameAvailabilityByScopeScheduledAction(this ArmClient client, ResourceIdentifier scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + return GetMockableCostManagementArmClient(client).CheckCostManagementNameAvailabilityByScopeScheduledAction(scope, content, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static CostManagementExportResource GetCostManagementExportResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableCostManagementArmClient(client).GetCostManagementExportResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static TenantsCostManagementViewsResource GetTenantsCostManagementViewsResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableCostManagementArmClient(client).GetTenantsCostManagementViewsResource(id); + } - return GetArmResourceExtensionClient(client, scope).CheckCostManagementNameAvailabilityByScopeScheduledAction(content, cancellationToken); + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static CostManagementViewsResource GetCostManagementViewsResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableCostManagementArmClient(client).GetCostManagementViewsResource(id); } - /// Gets a collection of TenantsCostManagementViewsResources in the TenantResource. + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static CostManagementAlertResource GetCostManagementAlertResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableCostManagementArmClient(client).GetCostManagementAlertResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static TenantScheduledActionResource GetTenantScheduledActionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableCostManagementArmClient(client).GetTenantScheduledActionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ScheduledActionResource GetScheduledActionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableCostManagementArmClient(client).GetScheduledActionResource(id); + } + + /// + /// Gets a collection of TenantsCostManagementViewsResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TenantsCostManagementViewsResources and their operations over a TenantsCostManagementViewsResource. public static TenantsCostManagementViewsCollection GetAllTenantsCostManagementViews(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetAllTenantsCostManagementViews(); + return GetMockableCostManagementTenantResource(tenantResource).GetAllTenantsCostManagementViews(); } /// @@ -670,16 +722,20 @@ public static TenantsCostManagementViewsCollection GetAllTenantsCostManagementVi /// Views_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// View name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTenantsCostManagementViewsAsync(this TenantResource tenantResource, string viewName, CancellationToken cancellationToken = default) { - return await tenantResource.GetAllTenantsCostManagementViews().GetAsync(viewName, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GetTenantsCostManagementViewsAsync(viewName, cancellationToken).ConfigureAwait(false); } /// @@ -694,24 +750,34 @@ public static async Task> GetTenant /// Views_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// View name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTenantsCostManagementViews(this TenantResource tenantResource, string viewName, CancellationToken cancellationToken = default) { - return tenantResource.GetAllTenantsCostManagementViews().Get(viewName, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetTenantsCostManagementViews(viewName, cancellationToken); } - /// Gets a collection of TenantScheduledActionResources in the TenantResource. + /// + /// Gets a collection of TenantScheduledActionResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TenantScheduledActionResources and their operations over a TenantScheduledActionResource. public static TenantScheduledActionCollection GetTenantScheduledActions(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetTenantScheduledActions(); + return GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledActions(); } /// @@ -726,16 +792,20 @@ public static TenantScheduledActionCollection GetTenantScheduledActions(this Ten /// ScheduledActions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Scheduled action name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTenantScheduledActionAsync(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) { - return await tenantResource.GetTenantScheduledActions().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledActionAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -750,16 +820,20 @@ public static async Task> GetTenantSched /// ScheduledActions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Scheduled action name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTenantScheduledAction(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) { - return tenantResource.GetTenantScheduledActions().Get(name, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledAction(name, cancellationToken); } /// @@ -774,6 +848,10 @@ public static Response GetTenantScheduledAction(t /// BenefitUtilizationSummaries_ListByBillingAccountId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Billing account ID. @@ -785,9 +863,7 @@ public static Response GetTenantScheduledAction(t /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBenefitUtilizationSummariesByBillingAccountIdAsync(this TenantResource tenantResource, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - - return GetTenantResourceExtensionClient(tenantResource).GetBenefitUtilizationSummariesByBillingAccountIdAsync(billingAccountId, grainParameter, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingAccountIdAsync(billingAccountId, grainParameter, filter, cancellationToken); } /// @@ -802,6 +878,10 @@ public static AsyncPageable GetBenefitUtilizationSumm /// BenefitUtilizationSummaries_ListByBillingAccountId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Billing account ID. @@ -813,9 +893,7 @@ public static AsyncPageable GetBenefitUtilizationSumm /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBenefitUtilizationSummariesByBillingAccountId(this TenantResource tenantResource, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - - return GetTenantResourceExtensionClient(tenantResource).GetBenefitUtilizationSummariesByBillingAccountId(billingAccountId, grainParameter, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingAccountId(billingAccountId, grainParameter, filter, cancellationToken); } /// @@ -830,6 +908,10 @@ public static Pageable GetBenefitUtilizationSummaries /// BenefitUtilizationSummaries_ListByBillingProfileId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Billing account ID. @@ -842,10 +924,7 @@ public static Pageable GetBenefitUtilizationSummaries /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBenefitUtilizationSummariesByBillingProfileIdAsync(this TenantResource tenantResource, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - - return GetTenantResourceExtensionClient(tenantResource).GetBenefitUtilizationSummariesByBillingProfileIdAsync(billingAccountId, billingProfileId, grainParameter, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingProfileIdAsync(billingAccountId, billingProfileId, grainParameter, filter, cancellationToken); } /// @@ -860,6 +939,10 @@ public static AsyncPageable GetBenefitUtilizationSumm /// BenefitUtilizationSummaries_ListByBillingProfileId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Billing account ID. @@ -872,10 +955,7 @@ public static AsyncPageable GetBenefitUtilizationSumm /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBenefitUtilizationSummariesByBillingProfileId(this TenantResource tenantResource, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - - return GetTenantResourceExtensionClient(tenantResource).GetBenefitUtilizationSummariesByBillingProfileId(billingAccountId, billingProfileId, grainParameter, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingProfileId(billingAccountId, billingProfileId, grainParameter, filter, cancellationToken); } /// @@ -890,6 +970,10 @@ public static Pageable GetBenefitUtilizationSummaries /// BenefitUtilizationSummaries_ListBySavingsPlanOrder /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Savings plan order ID. @@ -901,9 +985,7 @@ public static Pageable GetBenefitUtilizationSummaries /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(this TenantResource tenantResource, string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - - return GetTenantResourceExtensionClient(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(savingsPlanOrderId, filter, grainParameter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(savingsPlanOrderId, filter, grainParameter, cancellationToken); } /// @@ -918,6 +1000,10 @@ public static AsyncPageable GetBenefitUtilizationSumm /// BenefitUtilizationSummaries_ListBySavingsPlanOrder /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Savings plan order ID. @@ -929,9 +1015,7 @@ public static AsyncPageable GetBenefitUtilizationSumm /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBenefitUtilizationSummariesBySavingsPlanOrder(this TenantResource tenantResource, string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - - return GetTenantResourceExtensionClient(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanOrder(savingsPlanOrderId, filter, grainParameter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanOrder(savingsPlanOrderId, filter, grainParameter, cancellationToken); } /// @@ -946,6 +1030,10 @@ public static Pageable GetBenefitUtilizationSummaries /// BenefitUtilizationSummaries_ListBySavingsPlanId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Savings plan order ID. @@ -958,10 +1046,7 @@ public static Pageable GetBenefitUtilizationSummaries /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanIdAsync(this TenantResource tenantResource, string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); - - return GetTenantResourceExtensionClient(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanIdAsync(savingsPlanOrderId, savingsPlanId, filter, grainParameter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanIdAsync(savingsPlanOrderId, savingsPlanId, filter, grainParameter, cancellationToken); } /// @@ -976,6 +1061,10 @@ public static AsyncPageable GetBenefitUtilizationSumm /// BenefitUtilizationSummaries_ListBySavingsPlanId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Savings plan order ID. @@ -988,10 +1077,7 @@ public static AsyncPageable GetBenefitUtilizationSumm /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBenefitUtilizationSummariesBySavingsPlanId(this TenantResource tenantResource, string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); - - return GetTenantResourceExtensionClient(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanId(savingsPlanOrderId, savingsPlanId, filter, grainParameter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanId(savingsPlanOrderId, savingsPlanId, filter, grainParameter, cancellationToken); } /// @@ -1006,6 +1092,10 @@ public static Pageable GetBenefitUtilizationSummaries /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1016,10 +1106,7 @@ public static Pageable GetBenefitUtilizationSummaries /// or is null. public static async Task> GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(waitUntil, billingAccountId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(waitUntil, billingAccountId, content, cancellationToken).ConfigureAwait(false); } /// @@ -1034,6 +1121,10 @@ public static async TaskBillingAccountScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1044,10 +1135,7 @@ public static async Task or is null. public static ArmOperation GenerateBenefitUtilizationSummariesReportBillingAccountScope(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportBillingAccountScope(waitUntil, billingAccountId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingAccountScope(waitUntil, billingAccountId, content, cancellationToken); } /// @@ -1062,6 +1150,10 @@ public static ArmOperation GenerateB /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1073,11 +1165,7 @@ public static ArmOperation GenerateB /// , or is null. public static async Task> GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(waitUntil, billingAccountId, billingProfileId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(waitUntil, billingAccountId, billingProfileId, content, cancellationToken).ConfigureAwait(false); } /// @@ -1092,6 +1180,10 @@ public static async TaskBillingProfileScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1103,11 +1195,7 @@ public static async Task , or is null. public static ArmOperation GenerateBenefitUtilizationSummariesReportBillingProfileScope(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportBillingProfileScope(waitUntil, billingAccountId, billingProfileId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingProfileScope(waitUntil, billingAccountId, billingProfileId, content, cancellationToken); } /// @@ -1122,6 +1210,10 @@ public static ArmOperation GenerateB /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1132,10 +1224,7 @@ public static ArmOperation GenerateB /// or is null. public static async Task> GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(waitUntil, reservationOrderId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(waitUntil, reservationOrderId, content, cancellationToken).ConfigureAwait(false); } /// @@ -1150,6 +1239,10 @@ public static async TaskReservationOrderScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1160,10 +1253,7 @@ public static async Task or is null. public static ArmOperation GenerateBenefitUtilizationSummariesReportReservationOrderScope(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportReservationOrderScope(waitUntil, reservationOrderId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationOrderScope(waitUntil, reservationOrderId, content, cancellationToken); } /// @@ -1178,6 +1268,10 @@ public static ArmOperation GenerateB /// ReservationScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1189,11 +1283,7 @@ public static ArmOperation GenerateB /// , or is null. public static async Task> GenerateBenefitUtilizationSummariesReportReservationScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportReservationScopeAsync(waitUntil, reservationOrderId, reservationId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationScopeAsync(waitUntil, reservationOrderId, reservationId, content, cancellationToken).ConfigureAwait(false); } /// @@ -1208,6 +1298,10 @@ public static async TaskReservationScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1219,11 +1313,7 @@ public static async Task , or is null. public static ArmOperation GenerateBenefitUtilizationSummariesReportReservationScope(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportReservationScope(waitUntil, reservationOrderId, reservationId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationScope(waitUntil, reservationOrderId, reservationId, content, cancellationToken); } /// @@ -1238,6 +1328,10 @@ public static ArmOperation GenerateB /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1248,10 +1342,7 @@ public static ArmOperation GenerateB /// or is null. public static async Task> GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(waitUntil, savingsPlanOrderId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(waitUntil, savingsPlanOrderId, content, cancellationToken).ConfigureAwait(false); } /// @@ -1266,6 +1357,10 @@ public static async TaskSavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1276,10 +1371,7 @@ public static async Task or is null. public static ArmOperation GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(waitUntil, savingsPlanOrderId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(waitUntil, savingsPlanOrderId, content, cancellationToken); } /// @@ -1294,6 +1386,10 @@ public static ArmOperation GenerateB /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1305,11 +1401,7 @@ public static ArmOperation GenerateB /// , or is null. public static async Task> GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(waitUntil, savingsPlanOrderId, savingsPlanId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(waitUntil, savingsPlanOrderId, savingsPlanId, content, cancellationToken).ConfigureAwait(false); } /// @@ -1324,6 +1416,10 @@ public static async TaskSavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1335,11 +1431,7 @@ public static async Task , or is null. public static ArmOperation GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(waitUntil, savingsPlanOrderId, savingsPlanId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(waitUntil, savingsPlanOrderId, savingsPlanId, content, cancellationToken); } /// @@ -1354,6 +1446,10 @@ public static ArmOperation GenerateB /// Alerts_ListExternal /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. @@ -1364,9 +1460,7 @@ public static ArmOperation GenerateB /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCostManagementAlertsAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - - return GetTenantResourceExtensionClient(tenantResource).GetCostManagementAlertsAsync(externalCloudProviderType, externalCloudProviderId, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetCostManagementAlertsAsync(externalCloudProviderType, externalCloudProviderId, cancellationToken); } /// @@ -1381,6 +1475,10 @@ public static AsyncPageable GetCostManagementAlerts /// Alerts_ListExternal /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. @@ -1391,9 +1489,7 @@ public static AsyncPageable GetCostManagementAlerts /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCostManagementAlerts(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - - return GetTenantResourceExtensionClient(tenantResource).GetCostManagementAlerts(externalCloudProviderType, externalCloudProviderId, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetCostManagementAlerts(externalCloudProviderType, externalCloudProviderId, cancellationToken); } /// @@ -1408,6 +1504,10 @@ public static Pageable GetCostManagementAlerts(this /// Forecast_ExternalCloudProviderUsage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. @@ -1419,10 +1519,7 @@ public static Pageable GetCostManagementAlerts(this /// or is null. public static async Task> ExternalCloudProviderUsageForecastAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); - - return await GetTenantResourceExtensionClient(tenantResource).ExternalCloudProviderUsageForecastAsync(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).ExternalCloudProviderUsageForecastAsync(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); } /// @@ -1437,6 +1534,10 @@ public static async Task> ExternalCloudProviderUsageFor /// Forecast_ExternalCloudProviderUsage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. @@ -1448,10 +1549,7 @@ public static async Task> ExternalCloudProviderUsageFor /// or is null. public static Response ExternalCloudProviderUsageForecast(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); - - return GetTenantResourceExtensionClient(tenantResource).ExternalCloudProviderUsageForecast(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ExternalCloudProviderUsageForecast(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken); } /// @@ -1466,6 +1564,10 @@ public static Response ExternalCloudProviderUsageForecast(this T /// Dimensions_ByExternalCloudProviderType /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -1474,9 +1576,7 @@ public static Response ExternalCloudProviderUsageForecast(this T /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable ByExternalCloudProviderTypeDimensionsAsync(this TenantResource tenantResource, TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetTenantResourceExtensionClient(tenantResource).ByExternalCloudProviderTypeDimensionsAsync(options, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ByExternalCloudProviderTypeDimensionsAsync(options, cancellationToken); } /// @@ -1491,6 +1591,10 @@ public static AsyncPageable ByExternalCloudProviderType /// Dimensions_ByExternalCloudProviderType /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -1499,9 +1603,7 @@ public static AsyncPageable ByExternalCloudProviderType /// A collection of that may take multiple service requests to iterate over. public static Pageable ByExternalCloudProviderTypeDimensions(this TenantResource tenantResource, TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetTenantResourceExtensionClient(tenantResource).ByExternalCloudProviderTypeDimensions(options, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ByExternalCloudProviderTypeDimensions(options, cancellationToken); } /// @@ -1516,6 +1618,10 @@ public static Pageable ByExternalCloudProviderTypeDimen /// Query_UsageByExternalCloudProviderType /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. @@ -1526,10 +1632,7 @@ public static Pageable ByExternalCloudProviderTypeDimen /// or is null. public static async Task> UsageByExternalCloudProviderTypeQueryAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); - - return await GetTenantResourceExtensionClient(tenantResource).UsageByExternalCloudProviderTypeQueryAsync(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).UsageByExternalCloudProviderTypeQueryAsync(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken).ConfigureAwait(false); } /// @@ -1544,6 +1647,10 @@ public static async Task> UsageByExternalCloudProviderType /// Query_UsageByExternalCloudProviderType /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. @@ -1554,10 +1661,7 @@ public static async Task> UsageByExternalCloudProviderType /// or is null. public static Response UsageByExternalCloudProviderTypeQuery(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); - - return GetTenantResourceExtensionClient(tenantResource).UsageByExternalCloudProviderTypeQuery(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).UsageByExternalCloudProviderTypeQuery(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken); } /// @@ -1572,6 +1676,10 @@ public static Response UsageByExternalCloudProviderTypeQuery(this T /// GenerateReservationDetailsReport_ByBillingAccountId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1583,11 +1691,7 @@ public static Response UsageByExternalCloudProviderTypeQuery(this T /// , or is null. public static async Task> ByBillingAccountIdGenerateReservationDetailsReportAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(startDate, nameof(startDate)); - Argument.AssertNotNull(endDate, nameof(endDate)); - - return await GetTenantResourceExtensionClient(tenantResource).ByBillingAccountIdGenerateReservationDetailsReportAsync(waitUntil, billingAccountId, startDate, endDate, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).ByBillingAccountIdGenerateReservationDetailsReportAsync(waitUntil, billingAccountId, startDate, endDate, cancellationToken).ConfigureAwait(false); } /// @@ -1602,6 +1706,10 @@ public static async Task> ByBillingAccountIdGenera /// GenerateReservationDetailsReport_ByBillingAccountId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1613,11 +1721,7 @@ public static async Task> ByBillingAccountIdGenera /// , or is null. public static ArmOperation ByBillingAccountIdGenerateReservationDetailsReport(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(startDate, nameof(startDate)); - Argument.AssertNotNull(endDate, nameof(endDate)); - - return GetTenantResourceExtensionClient(tenantResource).ByBillingAccountIdGenerateReservationDetailsReport(waitUntil, billingAccountId, startDate, endDate, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ByBillingAccountIdGenerateReservationDetailsReport(waitUntil, billingAccountId, startDate, endDate, cancellationToken); } /// @@ -1632,6 +1736,10 @@ public static ArmOperation ByBillingAccountIdGenerateReservatio /// GenerateReservationDetailsReport_ByBillingProfileId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1644,12 +1752,7 @@ public static ArmOperation ByBillingAccountIdGenerateReservatio /// , , or is null. public static async Task> ByBillingProfileIdGenerateReservationDetailsReportAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(startDate, nameof(startDate)); - Argument.AssertNotNull(endDate, nameof(endDate)); - - return await GetTenantResourceExtensionClient(tenantResource).ByBillingProfileIdGenerateReservationDetailsReportAsync(waitUntil, billingAccountId, billingProfileId, startDate, endDate, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).ByBillingProfileIdGenerateReservationDetailsReportAsync(waitUntil, billingAccountId, billingProfileId, startDate, endDate, cancellationToken).ConfigureAwait(false); } /// @@ -1664,6 +1767,10 @@ public static async Task> ByBillingProfileIdGenera /// GenerateReservationDetailsReport_ByBillingProfileId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1676,12 +1783,7 @@ public static async Task> ByBillingProfileIdGenera /// , , or is null. public static ArmOperation ByBillingProfileIdGenerateReservationDetailsReport(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(startDate, nameof(startDate)); - Argument.AssertNotNull(endDate, nameof(endDate)); - - return GetTenantResourceExtensionClient(tenantResource).ByBillingProfileIdGenerateReservationDetailsReport(waitUntil, billingAccountId, billingProfileId, startDate, endDate, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ByBillingProfileIdGenerateReservationDetailsReport(waitUntil, billingAccountId, billingProfileId, startDate, endDate, cancellationToken); } /// @@ -1696,6 +1798,10 @@ public static ArmOperation ByBillingProfileIdGenerateReservatio /// PriceSheet_Download /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1707,11 +1813,7 @@ public static ArmOperation ByBillingProfileIdGenerateReservatio /// , or is null. public static async Task> DownloadPriceSheetAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); - - return await GetTenantResourceExtensionClient(tenantResource).DownloadPriceSheetAsync(waitUntil, billingAccountName, billingProfileName, invoiceName, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).DownloadPriceSheetAsync(waitUntil, billingAccountName, billingProfileName, invoiceName, cancellationToken).ConfigureAwait(false); } /// @@ -1726,6 +1828,10 @@ public static async Task> DownloadPriceSheetAsync(this /// PriceSheet_Download /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1737,11 +1843,7 @@ public static async Task> DownloadPriceSheetAsync(this /// , or is null. public static ArmOperation DownloadPriceSheet(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); - - return GetTenantResourceExtensionClient(tenantResource).DownloadPriceSheet(waitUntil, billingAccountName, billingProfileName, invoiceName, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).DownloadPriceSheet(waitUntil, billingAccountName, billingProfileName, invoiceName, cancellationToken); } /// @@ -1756,6 +1858,10 @@ public static ArmOperation DownloadPriceSheet(this TenantResource t /// PriceSheet_DownloadByBillingProfile /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1766,10 +1872,7 @@ public static ArmOperation DownloadPriceSheet(this TenantResource t /// or is null. public static async Task> DownloadByBillingProfilePriceSheetAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - - return await GetTenantResourceExtensionClient(tenantResource).DownloadByBillingProfilePriceSheetAsync(waitUntil, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).DownloadByBillingProfilePriceSheetAsync(waitUntil, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); } /// @@ -1784,6 +1887,10 @@ public static async Task> DownloadByBillingProfilePric /// PriceSheet_DownloadByBillingProfile /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1794,10 +1901,7 @@ public static async Task> DownloadByBillingProfilePric /// or is null. public static ArmOperation DownloadByBillingProfilePriceSheet(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - - return GetTenantResourceExtensionClient(tenantResource).DownloadByBillingProfilePriceSheet(waitUntil, billingAccountName, billingProfileName, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).DownloadByBillingProfilePriceSheet(waitUntil, billingAccountName, billingProfileName, cancellationToken); } /// @@ -1812,6 +1916,10 @@ public static ArmOperation DownloadByBillingProfilePriceSheet(this /// ScheduledActions_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Scheduled action to be created or updated. @@ -1819,9 +1927,7 @@ public static ArmOperation DownloadByBillingProfilePriceSheet(this /// is null. public static async Task> CheckCostManagementNameAvailabilityByScheduledActionAsync(this TenantResource tenantResource, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).CheckCostManagementNameAvailabilityByScheduledActionAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).CheckCostManagementNameAvailabilityByScheduledActionAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -1836,6 +1942,10 @@ public static async Task> CheckCo /// ScheduledActions_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Scheduled action to be created or updated. @@ -1843,9 +1953,7 @@ public static async Task> CheckCo /// is null. public static Response CheckCostManagementNameAvailabilityByScheduledAction(this TenantResource tenantResource, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).CheckCostManagementNameAvailabilityByScheduledAction(content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).CheckCostManagementNameAvailabilityByScheduledAction(content, cancellationToken); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementArmClient.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementArmClient.cs new file mode 100644 index 0000000000000..5bc77bc448b81 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementArmClient.cs @@ -0,0 +1,679 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.CostManagement; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableCostManagementArmClient : ArmResource + { + private ClientDiagnostics _benefitRecommendationsClientDiagnostics; + private BenefitRecommendationsRestOperations _benefitRecommendationsRestClient; + private ClientDiagnostics _forecastClientDiagnostics; + private ForecastRestOperations _forecastRestClient; + private ClientDiagnostics _dimensionsClientDiagnostics; + private DimensionsRestOperations _dimensionsRestClient; + private ClientDiagnostics _queryClientDiagnostics; + private QueryRestOperations _queryRestClient; + private ClientDiagnostics _scheduledActionsClientDiagnostics; + private ScheduledActionsRestOperations _scheduledActionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCostManagementArmClient() + { + } + + /// 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 MockableCostManagementArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableCostManagementArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics BenefitRecommendationsClientDiagnostics => _benefitRecommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BenefitRecommendationsRestOperations BenefitRecommendationsRestClient => _benefitRecommendationsRestClient ??= new BenefitRecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ForecastClientDiagnostics => _forecastClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ForecastRestOperations ForecastRestClient => _forecastRestClient ??= new ForecastRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DimensionsClientDiagnostics => _dimensionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DimensionsRestOperations DimensionsRestClient => _dimensionsRestClient ??= new DimensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics QueryClientDiagnostics => _queryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private QueryRestOperations QueryRestClient => _queryRestClient ??= new QueryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ScheduledActionsClientDiagnostics => _scheduledActionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ScheduledActionsRestOperations ScheduledActionsRestClient => _scheduledActionsRestClient ??= new ScheduledActionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CostManagementExportResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of CostManagementExportResources and their operations over a CostManagementExportResource. + public virtual CostManagementExportCollection GetCostManagementExports(ResourceIdentifier scope) + { + return new CostManagementExportCollection(Client, scope); + } + + /// + /// The operation to get the export for the defined scope by export name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} + /// + /// + /// Operation Id + /// Exports_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Export Name. + /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCostManagementExportAsync(ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetCostManagementExports(scope).GetAsync(exportName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the export for the defined scope by export name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} + /// + /// + /// Operation Id + /// Exports_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Export Name. + /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCostManagementExport(ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) + { + return GetCostManagementExports(scope).Get(exportName, expand, cancellationToken); + } + + /// Gets a collection of CostManagementViewsResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of CostManagementViewsResources and their operations over a CostManagementViewsResource. + public virtual CostManagementViewsCollection GetAllCostManagementViews(ResourceIdentifier scope) + { + return new CostManagementViewsCollection(Client, scope); + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_GetByScope + /// + /// + /// + /// The scope that the resource will apply against. + /// View name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCostManagementViewsAsync(ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) + { + return await GetAllCostManagementViews(scope).GetAsync(viewName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_GetByScope + /// + /// + /// + /// The scope that the resource will apply against. + /// View name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCostManagementViews(ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) + { + return GetAllCostManagementViews(scope).Get(viewName, cancellationToken); + } + + /// Gets a collection of CostManagementAlertResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of CostManagementAlertResources and their operations over a CostManagementAlertResource. + public virtual CostManagementAlertCollection GetCostManagementAlerts(ResourceIdentifier scope) + { + return new CostManagementAlertCollection(Client, scope); + } + + /// + /// Gets the alert for the scope by alert ID. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} + /// + /// + /// Operation Id + /// Alerts_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Alert ID. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetCostManagementAlertAsync(ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) + { + return await GetCostManagementAlerts(scope).GetAsync(alertId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the alert for the scope by alert ID. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} + /// + /// + /// Operation Id + /// Alerts_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Alert ID. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetCostManagementAlert(ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) + { + return GetCostManagementAlerts(scope).Get(alertId, cancellationToken); + } + + /// Gets a collection of ScheduledActionResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of ScheduledActionResources and their operations over a ScheduledActionResource. + public virtual ScheduledActionCollection GetScheduledActions(ResourceIdentifier scope) + { + return new ScheduledActionCollection(Client, scope); + } + + /// + /// Get the shared scheduled action from the given scope by name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_GetByScope + /// + /// + /// + /// The scope that the resource will apply against. + /// Scheduled action name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScheduledActionAsync(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + { + return await GetScheduledActions(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the shared scheduled action from the given scope by name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_GetByScope + /// + /// + /// + /// The scope that the resource will apply against. + /// Scheduled action name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScheduledAction(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + { + return GetScheduledActions(scope).Get(name, cancellationToken); + } + + /// + /// List of recommendations for purchasing savings plan. + /// + /// + /// Request Path + /// /{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations + /// + /// + /// Operation Id + /// BenefitRecommendations_List + /// + /// + /// + /// The scope to use. + /// Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup. + /// May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. + /// May be used to expand the properties by: properties/usage, properties/allRecommendationDetails. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitRecommendationsAsync(ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitRecommendationsRestClient.CreateListRequest(scope, filter, orderby, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitRecommendationsRestClient.CreateListNextPageRequest(nextLink, scope, filter, orderby, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitRecommendationModel.DeserializeBenefitRecommendationModel, BenefitRecommendationsClientDiagnostics, Pipeline, "MockableCostManagementArmClient.GetBenefitRecommendations", "value", "nextLink", cancellationToken); + } + + /// + /// List of recommendations for purchasing savings plan. + /// + /// + /// Request Path + /// /{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations + /// + /// + /// Operation Id + /// BenefitRecommendations_List + /// + /// + /// + /// The scope to use. + /// Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup. + /// May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. + /// May be used to expand the properties by: properties/usage, properties/allRecommendationDetails. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitRecommendations(ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitRecommendationsRestClient.CreateListRequest(scope, filter, orderby, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitRecommendationsRestClient.CreateListNextPageRequest(nextLink, scope, filter, orderby, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitRecommendationModel.DeserializeBenefitRecommendationModel, BenefitRecommendationsClientDiagnostics, Pipeline, "MockableCostManagementArmClient.GetBenefitRecommendations", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the forecast charges for scope defined. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/forecast + /// + /// + /// Operation Id + /// Forecast_Usage + /// + /// + /// + /// The scope to use. + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// The cancellation token to use. + /// is null. + public virtual async Task> UsageForecastAsync(ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); + + using var scope0 = ForecastClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageForecast"); + scope0.Start(); + try + { + var response = await ForecastRestClient.UsageAsync(scope, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists the forecast charges for scope defined. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/forecast + /// + /// + /// Operation Id + /// Forecast_Usage + /// + /// + /// + /// The scope to use. + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// The cancellation token to use. + /// is null. + public virtual Response UsageForecast(ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); + + using var scope0 = ForecastClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageForecast"); + scope0.Start(); + try + { + var response = ForecastRestClient.Usage(scope, forecastDefinition, filter, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists the dimensions by the defined scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/dimensions + /// + /// + /// Operation Id + /// Dimensions_List + /// + /// + /// + /// The scope to use. + /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// May be used to limit the number of results to the most recent N dimension data. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDimensionsAsync(ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateListRequest(scope, filter, expand, skiptoken, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CostManagementDimension.DeserializeCostManagementDimension, DimensionsClientDiagnostics, Pipeline, "MockableCostManagementArmClient.GetDimensions", "value", null, cancellationToken); + } + + /// + /// Lists the dimensions by the defined scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/dimensions + /// + /// + /// Operation Id + /// Dimensions_List + /// + /// + /// + /// The scope to use. + /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// May be used to limit the number of results to the most recent N dimension data. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDimensions(ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateListRequest(scope, filter, expand, skiptoken, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CostManagementDimension.DeserializeCostManagementDimension, DimensionsClientDiagnostics, Pipeline, "MockableCostManagementArmClient.GetDimensions", "value", null, cancellationToken); + } + + /// + /// Query the usage data for scope defined. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/query + /// + /// + /// Operation Id + /// Query_Usage + /// + /// + /// + /// The scope to use. + /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UsageQueryAsync(ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); + + using var scope0 = QueryClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageQuery"); + scope0.Start(); + try + { + var response = await QueryRestClient.UsageAsync(scope, queryDefinition, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Query the usage data for scope defined. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/query + /// + /// + /// Operation Id + /// Query_Usage + /// + /// + /// + /// The scope to use. + /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// The cancellation token to use. + /// is null. + public virtual Response UsageQuery(ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); + + using var scope0 = QueryClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageQuery"); + scope0.Start(); + try + { + var response = QueryRestClient.Usage(scope, queryDefinition, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Checks availability and correctness of the name for a scheduled action within the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/checkNameAvailability + /// + /// + /// Operation Id + /// ScheduledActions_CheckNameAvailabilityByScope + /// + /// + /// + /// The scope to use. + /// Scheduled action to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckCostManagementNameAvailabilityByScopeScheduledActionAsync(ResourceIdentifier scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope0 = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementArmClient.CheckCostManagementNameAvailabilityByScopeScheduledAction"); + scope0.Start(); + try + { + var response = await ScheduledActionsRestClient.CheckNameAvailabilityByScopeAsync(scope, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Checks availability and correctness of the name for a scheduled action within the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/checkNameAvailability + /// + /// + /// Operation Id + /// ScheduledActions_CheckNameAvailabilityByScope + /// + /// + /// + /// The scope to use. + /// Scheduled action to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual Response CheckCostManagementNameAvailabilityByScopeScheduledAction(ResourceIdentifier scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope0 = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementArmClient.CheckCostManagementNameAvailabilityByScopeScheduledAction"); + scope0.Start(); + try + { + var response = ScheduledActionsRestClient.CheckNameAvailabilityByScope(scope, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CostManagementExportResource GetCostManagementExportResource(ResourceIdentifier id) + { + CostManagementExportResource.ValidateResourceId(id); + return new CostManagementExportResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantsCostManagementViewsResource GetTenantsCostManagementViewsResource(ResourceIdentifier id) + { + TenantsCostManagementViewsResource.ValidateResourceId(id); + return new TenantsCostManagementViewsResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CostManagementViewsResource GetCostManagementViewsResource(ResourceIdentifier id) + { + CostManagementViewsResource.ValidateResourceId(id); + return new CostManagementViewsResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CostManagementAlertResource GetCostManagementAlertResource(ResourceIdentifier id) + { + CostManagementAlertResource.ValidateResourceId(id); + return new CostManagementAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantScheduledActionResource GetTenantScheduledActionResource(ResourceIdentifier id) + { + TenantScheduledActionResource.ValidateResourceId(id); + return new TenantScheduledActionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScheduledActionResource GetScheduledActionResource(ResourceIdentifier id) + { + ScheduledActionResource.ValidateResourceId(id); + return new ScheduledActionResource(Client, id); + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementTenantResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementTenantResource.cs new file mode 100644 index 0000000000000..a1f885cc2125d --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementTenantResource.cs @@ -0,0 +1,1620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.CostManagement; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableCostManagementTenantResource : ArmResource + { + private ClientDiagnostics _benefitUtilizationSummariesClientDiagnostics; + private BenefitUtilizationSummariesRestOperations _benefitUtilizationSummariesRestClient; + private ClientDiagnostics _billingAccountScopeClientDiagnostics; + private BillingAccountScopeRestOperations _billingAccountScopeRestClient; + private ClientDiagnostics _billingProfileScopeClientDiagnostics; + private BillingProfileScopeRestOperations _billingProfileScopeRestClient; + private ClientDiagnostics _reservationOrderScopeClientDiagnostics; + private ReservationOrderScopeRestOperations _reservationOrderScopeRestClient; + private ClientDiagnostics _reservationScopeClientDiagnostics; + private ReservationScopeRestOperations _reservationScopeRestClient; + private ClientDiagnostics _savingsPlanOrderScopeClientDiagnostics; + private SavingsPlanOrderScopeRestOperations _savingsPlanOrderScopeRestClient; + private ClientDiagnostics _savingsPlanScopeClientDiagnostics; + private SavingsPlanScopeRestOperations _savingsPlanScopeRestClient; + private ClientDiagnostics _costManagementAlertAlertsClientDiagnostics; + private AlertsRestOperations _costManagementAlertAlertsRestClient; + private ClientDiagnostics _forecastClientDiagnostics; + private ForecastRestOperations _forecastRestClient; + private ClientDiagnostics _dimensionsClientDiagnostics; + private DimensionsRestOperations _dimensionsRestClient; + private ClientDiagnostics _queryClientDiagnostics; + private QueryRestOperations _queryRestClient; + private ClientDiagnostics _generateReservationDetailsReportClientDiagnostics; + private GenerateReservationDetailsReportRestOperations _generateReservationDetailsReportRestClient; + private ClientDiagnostics _priceSheetClientDiagnostics; + private PriceSheetRestOperations _priceSheetRestClient; + private ClientDiagnostics _scheduledActionsClientDiagnostics; + private ScheduledActionsRestOperations _scheduledActionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCostManagementTenantResource() + { + } + + /// 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 MockableCostManagementTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics BenefitUtilizationSummariesClientDiagnostics => _benefitUtilizationSummariesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BenefitUtilizationSummariesRestOperations BenefitUtilizationSummariesRestClient => _benefitUtilizationSummariesRestClient ??= new BenefitUtilizationSummariesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BillingAccountScopeClientDiagnostics => _billingAccountScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BillingAccountScopeRestOperations BillingAccountScopeRestClient => _billingAccountScopeRestClient ??= new BillingAccountScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BillingProfileScopeClientDiagnostics => _billingProfileScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BillingProfileScopeRestOperations BillingProfileScopeRestClient => _billingProfileScopeRestClient ??= new BillingProfileScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ReservationOrderScopeClientDiagnostics => _reservationOrderScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ReservationOrderScopeRestOperations ReservationOrderScopeRestClient => _reservationOrderScopeRestClient ??= new ReservationOrderScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ReservationScopeClientDiagnostics => _reservationScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ReservationScopeRestOperations ReservationScopeRestClient => _reservationScopeRestClient ??= new ReservationScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SavingsPlanOrderScopeClientDiagnostics => _savingsPlanOrderScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SavingsPlanOrderScopeRestOperations SavingsPlanOrderScopeRestClient => _savingsPlanOrderScopeRestClient ??= new SavingsPlanOrderScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SavingsPlanScopeClientDiagnostics => _savingsPlanScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SavingsPlanScopeRestOperations SavingsPlanScopeRestClient => _savingsPlanScopeRestClient ??= new SavingsPlanScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CostManagementAlertAlertsClientDiagnostics => _costManagementAlertAlertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", CostManagementAlertResource.ResourceType.Namespace, Diagnostics); + private AlertsRestOperations CostManagementAlertAlertsRestClient => _costManagementAlertAlertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CostManagementAlertResource.ResourceType)); + private ClientDiagnostics ForecastClientDiagnostics => _forecastClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ForecastRestOperations ForecastRestClient => _forecastRestClient ??= new ForecastRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DimensionsClientDiagnostics => _dimensionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DimensionsRestOperations DimensionsRestClient => _dimensionsRestClient ??= new DimensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics QueryClientDiagnostics => _queryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private QueryRestOperations QueryRestClient => _queryRestClient ??= new QueryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics GenerateReservationDetailsReportClientDiagnostics => _generateReservationDetailsReportClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private GenerateReservationDetailsReportRestOperations GenerateReservationDetailsReportRestClient => _generateReservationDetailsReportRestClient ??= new GenerateReservationDetailsReportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PriceSheetClientDiagnostics => _priceSheetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PriceSheetRestOperations PriceSheetRestClient => _priceSheetRestClient ??= new PriceSheetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ScheduledActionsClientDiagnostics => _scheduledActionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ScheduledActionsRestOperations ScheduledActionsRestClient => _scheduledActionsRestClient ??= new ScheduledActionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of TenantsCostManagementViewsResources in the TenantResource. + /// An object representing collection of TenantsCostManagementViewsResources and their operations over a TenantsCostManagementViewsResource. + public virtual TenantsCostManagementViewsCollection GetAllTenantsCostManagementViews() + { + return GetCachedClient(client => new TenantsCostManagementViewsCollection(client, Id)); + } + + /// + /// Gets the view by view name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_Get + /// + /// + /// + /// View name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTenantsCostManagementViewsAsync(string viewName, CancellationToken cancellationToken = default) + { + return await GetAllTenantsCostManagementViews().GetAsync(viewName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the view by view name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_Get + /// + /// + /// + /// View name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTenantsCostManagementViews(string viewName, CancellationToken cancellationToken = default) + { + return GetAllTenantsCostManagementViews().Get(viewName, cancellationToken); + } + + /// Gets a collection of TenantScheduledActionResources in the TenantResource. + /// An object representing collection of TenantScheduledActionResources and their operations over a TenantScheduledActionResource. + public virtual TenantScheduledActionCollection GetTenantScheduledActions() + { + return GetCachedClient(client => new TenantScheduledActionCollection(client, Id)); + } + + /// + /// Get the private scheduled action by name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_Get + /// + /// + /// + /// Scheduled action name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTenantScheduledActionAsync(string name, CancellationToken cancellationToken = default) + { + return await GetTenantScheduledActions().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the private scheduled action by name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_Get + /// + /// + /// + /// Scheduled action name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTenantScheduledAction(string name, CancellationToken cancellationToken = default) + { + return GetTenantScheduledActions().Get(name, cancellationToken); + } + + /// + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListByBillingAccountId + /// + /// + /// + /// Billing account ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitUtilizationSummariesByBillingAccountIdAsync(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingAccountId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListByBillingAccountId + /// + /// + /// + /// Billing account ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitUtilizationSummariesByBillingAccountId(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingAccountId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListByBillingProfileId + /// + /// + /// + /// Billing account ID. + /// Billing profile ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitUtilizationSummariesByBillingProfileIdAsync(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingProfileId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListByBillingProfileId + /// + /// + /// + /// Billing account ID. + /// Billing profile ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitUtilizationSummariesByBillingProfileId(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingProfileId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the savings plan utilization summaries for daily or monthly grain. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListBySavingsPlanOrder + /// + /// + /// + /// Savings plan order ID. + /// Supports filtering by properties/usageDate. + /// Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderRequest(savingsPlanOrderId, filter, grainParameter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderNextPageRequest(nextLink, savingsPlanOrderId, filter, grainParameter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanOrder", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the savings plan utilization summaries for daily or monthly grain. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListBySavingsPlanOrder + /// + /// + /// + /// Savings plan order ID. + /// Supports filtering by properties/usageDate. + /// Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitUtilizationSummariesBySavingsPlanOrder(string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderRequest(savingsPlanOrderId, filter, grainParameter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderNextPageRequest(nextLink, savingsPlanOrderId, filter, grainParameter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanOrder", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the savings plan utilization summaries for daily or monthly grain. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListBySavingsPlanId + /// + /// + /// + /// Savings plan order ID. + /// Savings plan ID. + /// Supports filtering by properties/usageDate. + /// Grain. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanIdAsync(string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, filter, grainParameter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdNextPageRequest(nextLink, savingsPlanOrderId, savingsPlanId, filter, grainParameter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the savings plan utilization summaries for daily or monthly grain. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListBySavingsPlanId + /// + /// + /// + /// Savings plan order ID. + /// Savings plan ID. + /// Supports filtering by properties/usageDate. + /// Grain. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitUtilizationSummariesBySavingsPlanId(string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, filter, grainParameter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdNextPageRequest(nextLink, savingsPlanOrderId, savingsPlanId, filter, grainParameter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanId", "value", "nextLink", cancellationToken); + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Billing account ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BillingAccountScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingAccountScope"); + scope.Start(); + try + { + var response = await BillingAccountScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(billingAccountId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingAccountScopeClientDiagnostics, Pipeline, BillingAccountScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Billing account ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportBillingAccountScope(WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BillingAccountScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingAccountScope"); + scope.Start(); + try + { + var response = BillingAccountScopeRestClient.GenerateBenefitUtilizationSummariesReport(billingAccountId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingAccountScopeClientDiagnostics, Pipeline, BillingAccountScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Billing account ID. + /// Billing profile ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BillingProfileScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingProfileScope"); + scope.Start(); + try + { + var response = await BillingProfileScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(billingAccountId, billingProfileId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingProfileScopeClientDiagnostics, Pipeline, BillingProfileScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, billingProfileId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Billing account ID. + /// Billing profile ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportBillingProfileScope(WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BillingProfileScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingProfileScope"); + scope.Start(); + try + { + var response = BillingProfileScopeRestClient.GenerateBenefitUtilizationSummariesReport(billingAccountId, billingProfileId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingProfileScopeClientDiagnostics, Pipeline, BillingProfileScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, billingProfileId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided reservation order. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Reservation Order ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ReservationOrderScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationOrderScope"); + scope.Start(); + try + { + var response = await ReservationOrderScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(reservationOrderId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationOrderScopeClientDiagnostics, Pipeline, ReservationOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided reservation order. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Reservation Order ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportReservationOrderScope(WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ReservationOrderScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationOrderScope"); + scope.Start(); + try + { + var response = ReservationOrderScopeRestClient.GenerateBenefitUtilizationSummariesReport(reservationOrderId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationOrderScopeClientDiagnostics, Pipeline, ReservationOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided reservation. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// ReservationScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Reservation Order ID. + /// Reservation ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportReservationScopeAsync(WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ReservationScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationScope"); + scope.Start(); + try + { + var response = await ReservationScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(reservationOrderId, reservationId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationScopeClientDiagnostics, Pipeline, ReservationScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, reservationId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided reservation. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// ReservationScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Reservation Order ID. + /// Reservation ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportReservationScope(WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ReservationScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationScope"); + scope.Start(); + try + { + var response = ReservationScopeRestClient.GenerateBenefitUtilizationSummariesReport(reservationOrderId, reservationId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationScopeClientDiagnostics, Pipeline, ReservationScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, reservationId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Savings plan order ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SavingsPlanOrderScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope"); + scope.Start(); + try + { + var response = await SavingsPlanOrderScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(savingsPlanOrderId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanOrderScopeClientDiagnostics, Pipeline, SavingsPlanOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(savingsPlanOrderId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport + /// + /// + /// + /// 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. + /// Savings plan order ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SavingsPlanOrderScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope"); + scope.Start(); + try + { + var response = SavingsPlanOrderScopeRestClient.GenerateBenefitUtilizationSummariesReport(savingsPlanOrderId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanOrderScopeClientDiagnostics, Pipeline, SavingsPlanOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(savingsPlanOrderId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided savings plan. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync + /// + /// + /// + /// 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. + /// Savings plan order ID. + /// Savings plan ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SavingsPlanScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope"); + scope.Start(); + try + { + var response = await SavingsPlanScopeRestClient.GenerateBenefitUtilizationSummariesReportAsyncAsync(savingsPlanOrderId, savingsPlanId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanScopeClientDiagnostics, Pipeline, SavingsPlanScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(savingsPlanOrderId, savingsPlanId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers generation of a benefit utilization summaries report for the provided savings plan. + /// + /// + /// Request Path + /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// + /// + /// Operation Id + /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync + /// + /// + /// + /// 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. + /// Savings plan order ID. + /// Savings plan ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SavingsPlanScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope"); + scope.Start(); + try + { + var response = SavingsPlanScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(savingsPlanOrderId, savingsPlanId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanScopeClientDiagnostics, Pipeline, SavingsPlanScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(savingsPlanOrderId, savingsPlanId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the Alerts for external cloud provider type defined. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts + /// + /// + /// Operation Id + /// Alerts_ListExternal + /// + /// + /// + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCostManagementAlertsAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetCostManagementAlerts", "value", null, cancellationToken); + } + + /// + /// Lists the Alerts for external cloud provider type defined. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts + /// + /// + /// Operation Id + /// Alerts_ListExternal + /// + /// + /// + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCostManagementAlerts(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetCostManagementAlerts", "value", null, cancellationToken); + } + + /// + /// Lists the forecast charges for external cloud provider type defined. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast + /// + /// + /// Operation Id + /// Forecast_ExternalCloudProviderUsage + /// + /// + /// + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> ExternalCloudProviderUsageForecastAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); + + using var scope = ForecastClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ExternalCloudProviderUsageForecast"); + scope.Start(); + try + { + var response = await ForecastRestClient.ExternalCloudProviderUsageAsync(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the forecast charges for external cloud provider type defined. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast + /// + /// + /// Operation Id + /// Forecast_ExternalCloudProviderUsage + /// + /// + /// + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response ExternalCloudProviderUsageForecast(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); + + using var scope = ForecastClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ExternalCloudProviderUsageForecast"); + scope.Start(); + try + { + var response = ForecastRestClient.ExternalCloudProviderUsage(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the dimensions by the external cloud provider type. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions + /// + /// + /// Operation Id + /// Dimensions_ByExternalCloudProviderType + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ByExternalCloudProviderTypeDimensionsAsync(TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateByExternalCloudProviderTypeRequest(options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CostManagementDimension.DeserializeCostManagementDimension, DimensionsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.ByExternalCloudProviderTypeDimensions", "value", null, cancellationToken); + } + + /// + /// Lists the dimensions by the external cloud provider type. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions + /// + /// + /// Operation Id + /// Dimensions_ByExternalCloudProviderType + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ByExternalCloudProviderTypeDimensions(TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateByExternalCloudProviderTypeRequest(options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CostManagementDimension.DeserializeCostManagementDimension, DimensionsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.ByExternalCloudProviderTypeDimensions", "value", null, cancellationToken); + } + + /// + /// Query the usage data for external cloud provider type defined. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query + /// + /// + /// Operation Id + /// Query_UsageByExternalCloudProviderType + /// + /// + /// + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UsageByExternalCloudProviderTypeQueryAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); + + using var scope = QueryClientDiagnostics.CreateScope("MockableCostManagementTenantResource.UsageByExternalCloudProviderTypeQuery"); + scope.Start(); + try + { + var response = await QueryRestClient.UsageByExternalCloudProviderTypeAsync(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Query the usage data for external cloud provider type defined. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query + /// + /// + /// Operation Id + /// Query_UsageByExternalCloudProviderType + /// + /// + /// + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response UsageByExternalCloudProviderTypeQuery(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); + + using var scope = QueryClientDiagnostics.CreateScope("MockableCostManagementTenantResource.UsageByExternalCloudProviderTypeQuery"); + scope.Start(); + try + { + var response = QueryRestClient.UsageByExternalCloudProviderType(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// + /// + /// Operation Id + /// GenerateReservationDetailsReport_ByBillingAccountId + /// + /// + /// + /// 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. + /// Enrollment ID (Legacy BillingAccount ID). + /// Start Date. + /// End Date. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> ByBillingAccountIdGenerateReservationDetailsReportAsync(WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(startDate, nameof(startDate)); + Argument.AssertNotNull(endDate, nameof(endDate)); + + using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingAccountIdGenerateReservationDetailsReport"); + scope.Start(); + try + { + var response = await GenerateReservationDetailsReportRestClient.ByBillingAccountIdAsync(billingAccountId, startDate, endDate, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// + /// + /// Operation Id + /// GenerateReservationDetailsReport_ByBillingAccountId + /// + /// + /// + /// 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. + /// Enrollment ID (Legacy BillingAccount ID). + /// Start Date. + /// End Date. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation ByBillingAccountIdGenerateReservationDetailsReport(WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(startDate, nameof(startDate)); + Argument.AssertNotNull(endDate, nameof(endDate)); + + using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingAccountIdGenerateReservationDetailsReport"); + scope.Start(); + try + { + var response = GenerateReservationDetailsReportRestClient.ByBillingAccountId(billingAccountId, startDate, endDate, cancellationToken); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// + /// + /// Operation Id + /// GenerateReservationDetailsReport_ByBillingProfileId + /// + /// + /// + /// 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. + /// Billing account ID. + /// Billing profile ID. + /// Start Date. + /// End Date. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual async Task> ByBillingProfileIdGenerateReservationDetailsReportAsync(WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(startDate, nameof(startDate)); + Argument.AssertNotNull(endDate, nameof(endDate)); + + using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingProfileIdGenerateReservationDetailsReport"); + scope.Start(); + try + { + var response = await GenerateReservationDetailsReportRestClient.ByBillingProfileIdAsync(billingAccountId, billingProfileId, startDate, endDate, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// + /// + /// Operation Id + /// GenerateReservationDetailsReport_ByBillingProfileId + /// + /// + /// + /// 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. + /// Billing account ID. + /// Billing profile ID. + /// Start Date. + /// End Date. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual ArmOperation ByBillingProfileIdGenerateReservationDetailsReport(WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(startDate, nameof(startDate)); + Argument.AssertNotNull(endDate, nameof(endDate)); + + using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingProfileIdGenerateReservationDetailsReport"); + scope.Start(); + try + { + var response = GenerateReservationDetailsReportRestClient.ByBillingProfileId(billingAccountId, billingProfileId, startDate, endDate, cancellationToken); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// + /// + /// Operation Id + /// PriceSheet_Download + /// + /// + /// + /// 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 ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// The ID that uniquely identifies an invoice. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> DownloadPriceSheetAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); + + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadPriceSheet"); + scope.Start(); + try + { + var response = await PriceSheetRestClient.DownloadAsync(billingAccountName, billingProfileName, invoiceName, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadRequest(billingAccountName, billingProfileName, invoiceName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// + /// + /// Operation Id + /// PriceSheet_Download + /// + /// + /// + /// 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 ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// The ID that uniquely identifies an invoice. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation DownloadPriceSheet(WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); + + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadPriceSheet"); + scope.Start(); + try + { + var response = PriceSheetRestClient.Download(billingAccountName, billingProfileName, invoiceName, cancellationToken); + var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadRequest(billingAccountName, billingProfileName, invoiceName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// + /// + /// Operation Id + /// PriceSheet_DownloadByBillingProfile + /// + /// + /// + /// 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 ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> DownloadByBillingProfilePriceSheetAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadByBillingProfilePriceSheet"); + scope.Start(); + try + { + var response = await PriceSheetRestClient.DownloadByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// + /// + /// Operation Id + /// PriceSheet_DownloadByBillingProfile + /// + /// + /// + /// 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 ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation DownloadByBillingProfilePriceSheet(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadByBillingProfilePriceSheet"); + scope.Start(); + try + { + var response = PriceSheetRestClient.DownloadByBillingProfile(billingAccountName, billingProfileName, cancellationToken); + var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks availability and correctness of the name for a scheduled action. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/checkNameAvailability + /// + /// + /// Operation Id + /// ScheduledActions_CheckNameAvailability + /// + /// + /// + /// Scheduled action to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckCostManagementNameAvailabilityByScheduledActionAsync(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementTenantResource.CheckCostManagementNameAvailabilityByScheduledAction"); + scope.Start(); + try + { + var response = await ScheduledActionsRestClient.CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks availability and correctness of the name for a scheduled action. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/checkNameAvailability + /// + /// + /// Operation Id + /// ScheduledActions_CheckNameAvailability + /// + /// + /// + /// Scheduled action to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual Response CheckCostManagementNameAvailabilityByScheduledAction(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementTenantResource.CheckCostManagementNameAvailabilityByScheduledAction"); + scope.Start(); + try + { + var response = ScheduledActionsRestClient.CheckNameAvailability(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 19274737033d0..0000000000000 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,1337 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.CostManagement.Models; - -namespace Azure.ResourceManager.CostManagement -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _benefitUtilizationSummariesClientDiagnostics; - private BenefitUtilizationSummariesRestOperations _benefitUtilizationSummariesRestClient; - private ClientDiagnostics _billingAccountScopeClientDiagnostics; - private BillingAccountScopeRestOperations _billingAccountScopeRestClient; - private ClientDiagnostics _billingProfileScopeClientDiagnostics; - private BillingProfileScopeRestOperations _billingProfileScopeRestClient; - private ClientDiagnostics _reservationOrderScopeClientDiagnostics; - private ReservationOrderScopeRestOperations _reservationOrderScopeRestClient; - private ClientDiagnostics _reservationScopeClientDiagnostics; - private ReservationScopeRestOperations _reservationScopeRestClient; - private ClientDiagnostics _savingsPlanOrderScopeClientDiagnostics; - private SavingsPlanOrderScopeRestOperations _savingsPlanOrderScopeRestClient; - private ClientDiagnostics _savingsPlanScopeClientDiagnostics; - private SavingsPlanScopeRestOperations _savingsPlanScopeRestClient; - private ClientDiagnostics _costManagementAlertAlertsClientDiagnostics; - private AlertsRestOperations _costManagementAlertAlertsRestClient; - private ClientDiagnostics _forecastClientDiagnostics; - private ForecastRestOperations _forecastRestClient; - private ClientDiagnostics _dimensionsClientDiagnostics; - private DimensionsRestOperations _dimensionsRestClient; - private ClientDiagnostics _queryClientDiagnostics; - private QueryRestOperations _queryRestClient; - private ClientDiagnostics _generateReservationDetailsReportClientDiagnostics; - private GenerateReservationDetailsReportRestOperations _generateReservationDetailsReportRestClient; - private ClientDiagnostics _priceSheetClientDiagnostics; - private PriceSheetRestOperations _priceSheetRestClient; - private ClientDiagnostics _scheduledActionsClientDiagnostics; - private ScheduledActionsRestOperations _scheduledActionsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics BenefitUtilizationSummariesClientDiagnostics => _benefitUtilizationSummariesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BenefitUtilizationSummariesRestOperations BenefitUtilizationSummariesRestClient => _benefitUtilizationSummariesRestClient ??= new BenefitUtilizationSummariesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BillingAccountScopeClientDiagnostics => _billingAccountScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BillingAccountScopeRestOperations BillingAccountScopeRestClient => _billingAccountScopeRestClient ??= new BillingAccountScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BillingProfileScopeClientDiagnostics => _billingProfileScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BillingProfileScopeRestOperations BillingProfileScopeRestClient => _billingProfileScopeRestClient ??= new BillingProfileScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReservationOrderScopeClientDiagnostics => _reservationOrderScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReservationOrderScopeRestOperations ReservationOrderScopeRestClient => _reservationOrderScopeRestClient ??= new ReservationOrderScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReservationScopeClientDiagnostics => _reservationScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReservationScopeRestOperations ReservationScopeRestClient => _reservationScopeRestClient ??= new ReservationScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SavingsPlanOrderScopeClientDiagnostics => _savingsPlanOrderScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SavingsPlanOrderScopeRestOperations SavingsPlanOrderScopeRestClient => _savingsPlanOrderScopeRestClient ??= new SavingsPlanOrderScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SavingsPlanScopeClientDiagnostics => _savingsPlanScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SavingsPlanScopeRestOperations SavingsPlanScopeRestClient => _savingsPlanScopeRestClient ??= new SavingsPlanScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CostManagementAlertAlertsClientDiagnostics => _costManagementAlertAlertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", CostManagementAlertResource.ResourceType.Namespace, Diagnostics); - private AlertsRestOperations CostManagementAlertAlertsRestClient => _costManagementAlertAlertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CostManagementAlertResource.ResourceType)); - private ClientDiagnostics ForecastClientDiagnostics => _forecastClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ForecastRestOperations ForecastRestClient => _forecastRestClient ??= new ForecastRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DimensionsClientDiagnostics => _dimensionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DimensionsRestOperations DimensionsRestClient => _dimensionsRestClient ??= new DimensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics QueryClientDiagnostics => _queryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private QueryRestOperations QueryRestClient => _queryRestClient ??= new QueryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics GenerateReservationDetailsReportClientDiagnostics => _generateReservationDetailsReportClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private GenerateReservationDetailsReportRestOperations GenerateReservationDetailsReportRestClient => _generateReservationDetailsReportRestClient ??= new GenerateReservationDetailsReportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PriceSheetClientDiagnostics => _priceSheetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PriceSheetRestOperations PriceSheetRestClient => _priceSheetRestClient ??= new PriceSheetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ScheduledActionsClientDiagnostics => _scheduledActionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ScheduledActionsRestOperations ScheduledActionsRestClient => _scheduledActionsRestClient ??= new ScheduledActionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of TenantsCostManagementViewsResources in the TenantResource. - /// An object representing collection of TenantsCostManagementViewsResources and their operations over a TenantsCostManagementViewsResource. - public virtual TenantsCostManagementViewsCollection GetAllTenantsCostManagementViews() - { - return GetCachedClient(Client => new TenantsCostManagementViewsCollection(Client, Id)); - } - - /// Gets a collection of TenantScheduledActionResources in the TenantResource. - /// An object representing collection of TenantScheduledActionResources and their operations over a TenantScheduledActionResource. - public virtual TenantScheduledActionCollection GetTenantScheduledActions() - { - return GetCachedClient(Client => new TenantScheduledActionCollection(Client, Id)); - } - - /// - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries - /// - /// - /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingAccountId - /// - /// - /// - /// Billing account ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitUtilizationSummariesByBillingAccountIdAsync(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBenefitUtilizationSummariesByBillingAccountId", "value", "nextLink", cancellationToken); - } - - /// - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries - /// - /// - /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingAccountId - /// - /// - /// - /// Billing account ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitUtilizationSummariesByBillingAccountId(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBenefitUtilizationSummariesByBillingAccountId", "value", "nextLink", cancellationToken); - } - - /// - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries - /// - /// - /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingProfileId - /// - /// - /// - /// Billing account ID. - /// Billing profile ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitUtilizationSummariesByBillingProfileIdAsync(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBenefitUtilizationSummariesByBillingProfileId", "value", "nextLink", cancellationToken); - } - - /// - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries - /// - /// - /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingProfileId - /// - /// - /// - /// Billing account ID. - /// Billing profile ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitUtilizationSummariesByBillingProfileId(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBenefitUtilizationSummariesByBillingProfileId", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the savings plan utilization summaries for daily or monthly grain. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries - /// - /// - /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanOrder - /// - /// - /// - /// Savings plan order ID. - /// Supports filtering by properties/usageDate. - /// Grain. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderRequest(savingsPlanOrderId, filter, grainParameter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderNextPageRequest(nextLink, savingsPlanOrderId, filter, grainParameter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBenefitUtilizationSummariesBySavingsPlanOrder", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the savings plan utilization summaries for daily or monthly grain. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries - /// - /// - /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanOrder - /// - /// - /// - /// Savings plan order ID. - /// Supports filtering by properties/usageDate. - /// Grain. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitUtilizationSummariesBySavingsPlanOrder(string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderRequest(savingsPlanOrderId, filter, grainParameter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderNextPageRequest(nextLink, savingsPlanOrderId, filter, grainParameter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBenefitUtilizationSummariesBySavingsPlanOrder", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the savings plan utilization summaries for daily or monthly grain. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries - /// - /// - /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanId - /// - /// - /// - /// Savings plan order ID. - /// Savings plan ID. - /// Supports filtering by properties/usageDate. - /// Grain. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanIdAsync(string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, filter, grainParameter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdNextPageRequest(nextLink, savingsPlanOrderId, savingsPlanId, filter, grainParameter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBenefitUtilizationSummariesBySavingsPlanId", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the savings plan utilization summaries for daily or monthly grain. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries - /// - /// - /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanId - /// - /// - /// - /// Savings plan order ID. - /// Savings plan ID. - /// Supports filtering by properties/usageDate. - /// Grain. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitUtilizationSummariesBySavingsPlanId(string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, filter, grainParameter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdNextPageRequest(nextLink, savingsPlanOrderId, savingsPlanId, filter, grainParameter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary, BenefitUtilizationSummariesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetBenefitUtilizationSummariesBySavingsPlanId", "value", "nextLink", cancellationToken); - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Billing account ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual async Task> GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = BillingAccountScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportBillingAccountScope"); - scope.Start(); - try - { - var response = await BillingAccountScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(billingAccountId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingAccountScopeClientDiagnostics, Pipeline, BillingAccountScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Billing account ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportBillingAccountScope(WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = BillingAccountScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportBillingAccountScope"); - scope.Start(); - try - { - var response = BillingAccountScopeRestClient.GenerateBenefitUtilizationSummariesReport(billingAccountId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingAccountScopeClientDiagnostics, Pipeline, BillingAccountScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Billing account ID. - /// Billing profile ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual async Task> GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = BillingProfileScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportBillingProfileScope"); - scope.Start(); - try - { - var response = await BillingProfileScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(billingAccountId, billingProfileId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingProfileScopeClientDiagnostics, Pipeline, BillingProfileScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, billingProfileId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Billing account ID. - /// Billing profile ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportBillingProfileScope(WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = BillingProfileScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportBillingProfileScope"); - scope.Start(); - try - { - var response = BillingProfileScopeRestClient.GenerateBenefitUtilizationSummariesReport(billingAccountId, billingProfileId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingProfileScopeClientDiagnostics, Pipeline, BillingProfileScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, billingProfileId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation order. - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Reservation Order ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual async Task> GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = ReservationOrderScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportReservationOrderScope"); - scope.Start(); - try - { - var response = await ReservationOrderScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(reservationOrderId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationOrderScopeClientDiagnostics, Pipeline, ReservationOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation order. - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Reservation Order ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportReservationOrderScope(WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = ReservationOrderScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportReservationOrderScope"); - scope.Start(); - try - { - var response = ReservationOrderScopeRestClient.GenerateBenefitUtilizationSummariesReport(reservationOrderId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationOrderScopeClientDiagnostics, Pipeline, ReservationOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation. - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// ReservationScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Reservation Order ID. - /// Reservation ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual async Task> GenerateBenefitUtilizationSummariesReportReservationScopeAsync(WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = ReservationScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportReservationScope"); - scope.Start(); - try - { - var response = await ReservationScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(reservationOrderId, reservationId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationScopeClientDiagnostics, Pipeline, ReservationScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, reservationId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation. - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// ReservationScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Reservation Order ID. - /// Reservation ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportReservationScope(WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = ReservationScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportReservationScope"); - scope.Start(); - try - { - var response = ReservationScopeRestClient.GenerateBenefitUtilizationSummariesReport(reservationOrderId, reservationId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationScopeClientDiagnostics, Pipeline, ReservationScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, reservationId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Savings plan order ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual async Task> GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = SavingsPlanOrderScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope"); - scope.Start(); - try - { - var response = await SavingsPlanOrderScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(savingsPlanOrderId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanOrderScopeClientDiagnostics, Pipeline, SavingsPlanOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(savingsPlanOrderId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport - /// - /// - /// - /// 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. - /// Savings plan order ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = SavingsPlanOrderScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope"); - scope.Start(); - try - { - var response = SavingsPlanOrderScopeRestClient.GenerateBenefitUtilizationSummariesReport(savingsPlanOrderId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanOrderScopeClientDiagnostics, Pipeline, SavingsPlanOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(savingsPlanOrderId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync - /// - /// - /// - /// 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. - /// Savings plan order ID. - /// Savings plan ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual async Task> GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = SavingsPlanScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope"); - scope.Start(); - try - { - var response = await SavingsPlanScopeRestClient.GenerateBenefitUtilizationSummariesReportAsyncAsync(savingsPlanOrderId, savingsPlanId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanScopeClientDiagnostics, Pipeline, SavingsPlanScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(savingsPlanOrderId, savingsPlanId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan. - /// - /// - /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport - /// - /// - /// Operation Id - /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync - /// - /// - /// - /// 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. - /// Savings plan order ID. - /// Savings plan ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - using var scope = SavingsPlanScopeClientDiagnostics.CreateScope("TenantResourceExtensionClient.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope"); - scope.Start(); - try - { - var response = SavingsPlanScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(savingsPlanOrderId, savingsPlanId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanScopeClientDiagnostics, Pipeline, SavingsPlanScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(savingsPlanOrderId, savingsPlanId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the Alerts for external cloud provider type defined. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts - /// - /// - /// Operation Id - /// Alerts_ListExternal - /// - /// - /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCostManagementAlertsAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetCostManagementAlerts", "value", null, cancellationToken); - } - - /// - /// Lists the Alerts for external cloud provider type defined. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts - /// - /// - /// Operation Id - /// Alerts_ListExternal - /// - /// - /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCostManagementAlerts(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetCostManagementAlerts", "value", null, cancellationToken); - } - - /// - /// Lists the forecast charges for external cloud provider type defined. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast - /// - /// - /// Operation Id - /// Forecast_ExternalCloudProviderUsage - /// - /// - /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// The cancellation token to use. - public virtual async Task> ExternalCloudProviderUsageForecastAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) - { - using var scope = ForecastClientDiagnostics.CreateScope("TenantResourceExtensionClient.ExternalCloudProviderUsageForecast"); - scope.Start(); - try - { - var response = await ForecastRestClient.ExternalCloudProviderUsageAsync(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the forecast charges for external cloud provider type defined. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast - /// - /// - /// Operation Id - /// Forecast_ExternalCloudProviderUsage - /// - /// - /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// The cancellation token to use. - public virtual Response ExternalCloudProviderUsageForecast(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) - { - using var scope = ForecastClientDiagnostics.CreateScope("TenantResourceExtensionClient.ExternalCloudProviderUsageForecast"); - scope.Start(); - try - { - var response = ForecastRestClient.ExternalCloudProviderUsage(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the dimensions by the external cloud provider type. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions - /// - /// - /// Operation Id - /// Dimensions_ByExternalCloudProviderType - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable ByExternalCloudProviderTypeDimensionsAsync(TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateByExternalCloudProviderTypeRequest(options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CostManagementDimension.DeserializeCostManagementDimension, DimensionsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.ByExternalCloudProviderTypeDimensions", "value", null, cancellationToken); - } - - /// - /// Lists the dimensions by the external cloud provider type. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions - /// - /// - /// Operation Id - /// Dimensions_ByExternalCloudProviderType - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable ByExternalCloudProviderTypeDimensions(TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateByExternalCloudProviderTypeRequest(options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CostManagementDimension.DeserializeCostManagementDimension, DimensionsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.ByExternalCloudProviderTypeDimensions", "value", null, cancellationToken); - } - - /// - /// Query the usage data for external cloud provider type defined. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query - /// - /// - /// Operation Id - /// Query_UsageByExternalCloudProviderType - /// - /// - /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Query Config operation. - /// The cancellation token to use. - public virtual async Task> UsageByExternalCloudProviderTypeQueryAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) - { - using var scope = QueryClientDiagnostics.CreateScope("TenantResourceExtensionClient.UsageByExternalCloudProviderTypeQuery"); - scope.Start(); - try - { - var response = await QueryRestClient.UsageByExternalCloudProviderTypeAsync(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Query the usage data for external cloud provider type defined. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query - /// - /// - /// Operation Id - /// Query_UsageByExternalCloudProviderType - /// - /// - /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Query Config operation. - /// The cancellation token to use. - public virtual Response UsageByExternalCloudProviderTypeQuery(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) - { - using var scope = QueryClientDiagnostics.CreateScope("TenantResourceExtensionClient.UsageByExternalCloudProviderTypeQuery"); - scope.Start(); - try - { - var response = QueryRestClient.UsageByExternalCloudProviderType(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport - /// - /// - /// Operation Id - /// GenerateReservationDetailsReport_ByBillingAccountId - /// - /// - /// - /// 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. - /// Enrollment ID (Legacy BillingAccount ID). - /// Start Date. - /// End Date. - /// The cancellation token to use. - public virtual async Task> ByBillingAccountIdGenerateReservationDetailsReportAsync(WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) - { - using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("TenantResourceExtensionClient.ByBillingAccountIdGenerateReservationDetailsReport"); - scope.Start(); - try - { - var response = await GenerateReservationDetailsReportRestClient.ByBillingAccountIdAsync(billingAccountId, startDate, endDate, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport - /// - /// - /// Operation Id - /// GenerateReservationDetailsReport_ByBillingAccountId - /// - /// - /// - /// 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. - /// Enrollment ID (Legacy BillingAccount ID). - /// Start Date. - /// End Date. - /// The cancellation token to use. - public virtual ArmOperation ByBillingAccountIdGenerateReservationDetailsReport(WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) - { - using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("TenantResourceExtensionClient.ByBillingAccountIdGenerateReservationDetailsReport"); - scope.Start(); - try - { - var response = GenerateReservationDetailsReportRestClient.ByBillingAccountId(billingAccountId, startDate, endDate, cancellationToken); - var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport - /// - /// - /// Operation Id - /// GenerateReservationDetailsReport_ByBillingProfileId - /// - /// - /// - /// 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. - /// Billing account ID. - /// Billing profile ID. - /// Start Date. - /// End Date. - /// The cancellation token to use. - public virtual async Task> ByBillingProfileIdGenerateReservationDetailsReportAsync(WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) - { - using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("TenantResourceExtensionClient.ByBillingProfileIdGenerateReservationDetailsReport"); - scope.Start(); - try - { - var response = await GenerateReservationDetailsReportRestClient.ByBillingProfileIdAsync(billingAccountId, billingProfileId, startDate, endDate, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport - /// - /// - /// Operation Id - /// GenerateReservationDetailsReport_ByBillingProfileId - /// - /// - /// - /// 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. - /// Billing account ID. - /// Billing profile ID. - /// Start Date. - /// End Date. - /// The cancellation token to use. - public virtual ArmOperation ByBillingProfileIdGenerateReservationDetailsReport(WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) - { - using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("TenantResourceExtensionClient.ByBillingProfileIdGenerateReservationDetailsReport"); - scope.Start(); - try - { - var response = GenerateReservationDetailsReportRestClient.ByBillingProfileId(billingAccountId, billingProfileId, startDate, endDate, cancellationToken); - var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download - /// - /// - /// Operation Id - /// PriceSheet_Download - /// - /// - /// - /// 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 ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - public virtual async Task> DownloadPriceSheetAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) - { - using var scope = PriceSheetClientDiagnostics.CreateScope("TenantResourceExtensionClient.DownloadPriceSheet"); - scope.Start(); - try - { - var response = await PriceSheetRestClient.DownloadAsync(billingAccountName, billingProfileName, invoiceName, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadRequest(billingAccountName, billingProfileName, invoiceName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download - /// - /// - /// Operation Id - /// PriceSheet_Download - /// - /// - /// - /// 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 ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice. - /// The cancellation token to use. - public virtual ArmOperation DownloadPriceSheet(WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) - { - using var scope = PriceSheetClientDiagnostics.CreateScope("TenantResourceExtensionClient.DownloadPriceSheet"); - scope.Start(); - try - { - var response = PriceSheetRestClient.Download(billingAccountName, billingProfileName, invoiceName, cancellationToken); - var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadRequest(billingAccountName, billingProfileName, invoiceName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download - /// - /// - /// Operation Id - /// PriceSheet_DownloadByBillingProfile - /// - /// - /// - /// 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 ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - public virtual async Task> DownloadByBillingProfilePriceSheetAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - using var scope = PriceSheetClientDiagnostics.CreateScope("TenantResourceExtensionClient.DownloadByBillingProfilePriceSheet"); - scope.Start(); - try - { - var response = await PriceSheetRestClient.DownloadByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download - /// - /// - /// Operation Id - /// PriceSheet_DownloadByBillingProfile - /// - /// - /// - /// 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 ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The cancellation token to use. - public virtual ArmOperation DownloadByBillingProfilePriceSheet(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) - { - using var scope = PriceSheetClientDiagnostics.CreateScope("TenantResourceExtensionClient.DownloadByBillingProfilePriceSheet"); - scope.Start(); - try - { - var response = PriceSheetRestClient.DownloadByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks availability and correctness of the name for a scheduled action. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/checkNameAvailability - /// - /// - /// Operation Id - /// ScheduledActions_CheckNameAvailability - /// - /// - /// - /// Scheduled action to be created or updated. - /// The cancellation token to use. - public virtual async Task> CheckCostManagementNameAvailabilityByScheduledActionAsync(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ScheduledActionsClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckCostManagementNameAvailabilityByScheduledAction"); - scope.Start(); - try - { - var response = await ScheduledActionsRestClient.CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks availability and correctness of the name for a scheduled action. - /// - /// - /// Request Path - /// /providers/Microsoft.CostManagement/checkNameAvailability - /// - /// - /// Operation Id - /// ScheduledActions_CheckNameAvailability - /// - /// - /// - /// Scheduled action to be created or updated. - /// The cancellation token to use. - public virtual Response CheckCostManagementNameAvailabilityByScheduledAction(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ScheduledActionsClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckCostManagementNameAvailabilityByScheduledAction"); - scope.Start(); - try - { - var response = ScheduledActionsRestClient.CheckNameAvailability(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionResource.cs index ae475a10b6729..63be5313aa2b8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.CostManagement public partial class ScheduledActionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string scope, string name) { var resourceId = $"{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionResource.cs index e5dfe1a494b17..d7335785b4aa1 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.CostManagement public partial class TenantScheduledActionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string name) { var resourceId = $"/providers/Microsoft.CostManagement/scheduledActions/{name}"; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsResource.cs index a49a033664310..27d7d4255a1da 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.CostManagement public partial class TenantsCostManagementViewsResource : ArmResource { /// Generate the resource identifier of a instance. + /// The viewName. public static ResourceIdentifier CreateResourceIdentifier(string viewName) { var resourceId = $"/providers/Microsoft.CostManagement/views/{viewName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/Azure.ResourceManager.CustomerInsights.sln b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/Azure.ResourceManager.CustomerInsights.sln index 0e802b0b5939b..765dfb54a9317 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/Azure.ResourceManager.CustomerInsights.sln +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/Azure.ResourceManager.CustomerInsights.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{15CC84B5-4F56-49E3-8B30-BD27EB697CC0}") = "Azure.ResourceManager.CustomerInsights", "src\Azure.ResourceManager.CustomerInsights.csproj", "{C40F0E12-1BDE-4370-BA5A-DA3A904ABE85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.CustomerInsights", "src\Azure.ResourceManager.CustomerInsights.csproj", "{C40F0E12-1BDE-4370-BA5A-DA3A904ABE85}" EndProject -Project("{15CC84B5-4F56-49E3-8B30-BD27EB697CC0}") = "Azure.ResourceManager.CustomerInsights.Tests", "tests\Azure.ResourceManager.CustomerInsights.Tests.csproj", "{C964C04C-8722-49C1-8306-80F1F4D6435D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.CustomerInsights.Tests", "tests\Azure.ResourceManager.CustomerInsights.Tests.csproj", "{C964C04C-8722-49C1-8306-80F1F4D6435D}" EndProject -Project("{15CC84B5-4F56-49E3-8B30-BD27EB697CC0}") = "Azure.ResourceManager.CustomerInsights.Samples", "samples\Azure.ResourceManager.CustomerInsights.Samples.csproj", "{60C20286-714E-47A1-94FE-40634AEA47C6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.CustomerInsights.Samples", "samples\Azure.ResourceManager.CustomerInsights.Samples.csproj", "{60C20286-714E-47A1-94FE-40634AEA47C6}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {65CBFA42-2327-4163-9011-7394C9C594C5} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {C964C04C-8722-49C1-8306-80F1F4D6435D}.Release|x64.Build.0 = Release|Any CPU {C964C04C-8722-49C1-8306-80F1F4D6435D}.Release|x86.ActiveCfg = Release|Any CPU {C964C04C-8722-49C1-8306-80F1F4D6435D}.Release|x86.Build.0 = Release|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Debug|x64.ActiveCfg = Debug|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Debug|x64.Build.0 = Debug|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Debug|x86.ActiveCfg = Debug|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Debug|x86.Build.0 = Debug|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Release|Any CPU.Build.0 = Release|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Release|x64.ActiveCfg = Release|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Release|x64.Build.0 = Release|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Release|x86.ActiveCfg = Release|Any CPU + {60C20286-714E-47A1-94FE-40634AEA47C6}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {65CBFA42-2327-4163-9011-7394C9C594C5} EndGlobalSection EndGlobal diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/api/Azure.ResourceManager.CustomerInsights.netstandard2.0.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/api/Azure.ResourceManager.CustomerInsights.netstandard2.0.cs index bde3bfba3bb40..53611cdaa1c85 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/api/Azure.ResourceManager.CustomerInsights.netstandard2.0.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/api/Azure.ResourceManager.CustomerInsights.netstandard2.0.cs @@ -181,7 +181,7 @@ protected HubCollection() { } } public partial class HubData : Azure.ResourceManager.Models.TrackedResourceData { - public HubData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HubData(Azure.Core.AzureLocation location) { } public string ApiEndpoint { get { throw null; } } public Azure.ResourceManager.CustomerInsights.Models.HubBillingInfoFormat HubBillingInfo { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } @@ -755,6 +755,40 @@ protected WidgetTypeResourceFormatResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.CustomerInsights.Mocking +{ + public partial class MockableCustomerInsightsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableCustomerInsightsArmClient() { } + public virtual Azure.ResourceManager.CustomerInsights.AuthorizationPolicyResourceFormatResource GetAuthorizationPolicyResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.ConnectorMappingResourceFormatResource GetConnectorMappingResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.ConnectorResourceFormatResource GetConnectorResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.HubResource GetHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.InteractionResourceFormatResource GetInteractionResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.KpiResourceFormatResource GetKpiResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.LinkResourceFormatResource GetLinkResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.PredictionResourceFormatResource GetPredictionResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.ProfileResourceFormatResource GetProfileResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.RelationshipLinkResourceFormatResource GetRelationshipLinkResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.RelationshipResourceFormatResource GetRelationshipResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.RoleAssignmentResourceFormatResource GetRoleAssignmentResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.ViewResourceFormatResource GetViewResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.WidgetTypeResourceFormatResource GetWidgetTypeResourceFormatResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableCustomerInsightsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableCustomerInsightsResourceGroupResource() { } + public virtual Azure.Response GetHub(string hubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHubAsync(string hubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CustomerInsights.HubCollection GetHubs() { throw null; } + } + public partial class MockableCustomerInsightsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableCustomerInsightsSubscriptionResource() { } + public virtual Azure.Pageable GetHubs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHubsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.CustomerInsights.Models { public static partial class ArmCustomerInsightsModelFactory diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatResource.cs index 93400ae299b18..1c90afe0b9805 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/AuthorizationPolicyResourceFormatResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class AuthorizationPolicyResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The authorizationPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string authorizationPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatResource.cs index e6981b61fde47..a009d5abeda7c 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorMappingResourceFormatResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.CustomerInsights public partial class ConnectorMappingResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The connectorName. + /// The mappingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string connectorName, string mappingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatResource.cs index ee2355f1a90cf..41153004a21d7 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class ConnectorResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The connectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string connectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ConnectorMappingResourceFormatResources and their operations over a ConnectorMappingResourceFormatResource. public virtual ConnectorMappingResourceFormatCollection GetConnectorMappingResourceFormats() { - return GetCachedClient(Client => new ConnectorMappingResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new ConnectorMappingResourceFormatCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual ConnectorMappingResourceFormatCollection GetConnectorMappingResou /// /// The name of the connector mapping. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetConnectorMappingResourceFormatAsync(string mappingName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetC /// /// The name of the connector mapping. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetConnectorMappingResourceFormat(string mappingName, CancellationToken cancellationToken = default) { diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/CustomerInsightsExtensions.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/CustomerInsightsExtensions.cs index a500d3fc3bab0..2e34ebfcd6126 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/CustomerInsightsExtensions.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/CustomerInsightsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.CustomerInsights.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.CustomerInsights @@ -18,309 +19,257 @@ namespace Azure.ResourceManager.CustomerInsights /// A class to add extension methods to Azure.ResourceManager.CustomerInsights. public static partial class CustomerInsightsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableCustomerInsightsArmClient GetMockableCustomerInsightsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableCustomerInsightsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableCustomerInsightsResourceGroupResource GetMockableCustomerInsightsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableCustomerInsightsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableCustomerInsightsSubscriptionResource GetMockableCustomerInsightsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableCustomerInsightsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region HubResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HubResource GetHubResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HubResource.ValidateResourceId(id); - return new HubResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetHubResource(id); } - #endregion - #region ProfileResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProfileResourceFormatResource GetProfileResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProfileResourceFormatResource.ValidateResourceId(id); - return new ProfileResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetProfileResourceFormatResource(id); } - #endregion - #region InteractionResourceFormatResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static InteractionResourceFormatResource GetInteractionResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - InteractionResourceFormatResource.ValidateResourceId(id); - return new InteractionResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetInteractionResourceFormatResource(id); } - #endregion - #region RelationshipResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelationshipResourceFormatResource GetRelationshipResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelationshipResourceFormatResource.ValidateResourceId(id); - return new RelationshipResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetRelationshipResourceFormatResource(id); } - #endregion - #region RelationshipLinkResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelationshipLinkResourceFormatResource GetRelationshipLinkResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelationshipLinkResourceFormatResource.ValidateResourceId(id); - return new RelationshipLinkResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetRelationshipLinkResourceFormatResource(id); } - #endregion - #region AuthorizationPolicyResourceFormatResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AuthorizationPolicyResourceFormatResource GetAuthorizationPolicyResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AuthorizationPolicyResourceFormatResource.ValidateResourceId(id); - return new AuthorizationPolicyResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetAuthorizationPolicyResourceFormatResource(id); } - #endregion - #region ConnectorResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ConnectorResourceFormatResource GetConnectorResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ConnectorResourceFormatResource.ValidateResourceId(id); - return new ConnectorResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetConnectorResourceFormatResource(id); } - #endregion - #region ConnectorMappingResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ConnectorMappingResourceFormatResource GetConnectorMappingResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ConnectorMappingResourceFormatResource.ValidateResourceId(id); - return new ConnectorMappingResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetConnectorMappingResourceFormatResource(id); } - #endregion - #region KpiResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KpiResourceFormatResource GetKpiResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KpiResourceFormatResource.ValidateResourceId(id); - return new KpiResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetKpiResourceFormatResource(id); } - #endregion - #region WidgetTypeResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WidgetTypeResourceFormatResource GetWidgetTypeResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WidgetTypeResourceFormatResource.ValidateResourceId(id); - return new WidgetTypeResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetWidgetTypeResourceFormatResource(id); } - #endregion - #region ViewResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ViewResourceFormatResource GetViewResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ViewResourceFormatResource.ValidateResourceId(id); - return new ViewResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetViewResourceFormatResource(id); } - #endregion - #region LinkResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LinkResourceFormatResource GetLinkResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LinkResourceFormatResource.ValidateResourceId(id); - return new LinkResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetLinkResourceFormatResource(id); } - #endregion - #region RoleAssignmentResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoleAssignmentResourceFormatResource GetRoleAssignmentResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoleAssignmentResourceFormatResource.ValidateResourceId(id); - return new RoleAssignmentResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetRoleAssignmentResourceFormatResource(id); } - #endregion - #region PredictionResourceFormatResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PredictionResourceFormatResource GetPredictionResourceFormatResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PredictionResourceFormatResource.ValidateResourceId(id); - return new PredictionResourceFormatResource(client, id); - } - ); + return GetMockableCustomerInsightsArmClient(client).GetPredictionResourceFormatResource(id); } - #endregion - /// Gets a collection of HubResources in the ResourceGroupResource. + /// + /// Gets a collection of HubResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HubResources and their operations over a HubResource. public static HubCollection GetHubs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHubs(); + return GetMockableCustomerInsightsResourceGroupResource(resourceGroupResource).GetHubs(); } /// @@ -335,16 +284,20 @@ public static HubCollection GetHubs(this ResourceGroupResource resourceGroupReso /// Hubs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the hub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHubAsync(this ResourceGroupResource resourceGroupResource, string hubName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHubs().GetAsync(hubName, cancellationToken).ConfigureAwait(false); + return await GetMockableCustomerInsightsResourceGroupResource(resourceGroupResource).GetHubAsync(hubName, cancellationToken).ConfigureAwait(false); } /// @@ -359,16 +312,20 @@ public static async Task> GetHubAsync(this ResourceGroupRe /// Hubs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the hub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHub(this ResourceGroupResource resourceGroupResource, string hubName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHubs().Get(hubName, cancellationToken); + return GetMockableCustomerInsightsResourceGroupResource(resourceGroupResource).GetHub(hubName, cancellationToken); } /// @@ -383,13 +340,17 @@ public static Response GetHub(this ResourceGroupResource resourceGr /// Hubs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHubsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHubsAsync(cancellationToken); + return GetMockableCustomerInsightsSubscriptionResource(subscriptionResource).GetHubsAsync(cancellationToken); } /// @@ -404,13 +365,17 @@ public static AsyncPageable GetHubsAsync(this SubscriptionResource /// Hubs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHubs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHubs(cancellationToken); + return GetMockableCustomerInsightsSubscriptionResource(subscriptionResource).GetHubs(cancellationToken); } } } diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsArmClient.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsArmClient.cs new file mode 100644 index 0000000000000..e290845f7a068 --- /dev/null +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsArmClient.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.CustomerInsights; + +namespace Azure.ResourceManager.CustomerInsights.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableCustomerInsightsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCustomerInsightsArmClient() + { + } + + /// 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 MockableCustomerInsightsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableCustomerInsightsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HubResource GetHubResource(ResourceIdentifier id) + { + HubResource.ValidateResourceId(id); + return new HubResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProfileResourceFormatResource GetProfileResourceFormatResource(ResourceIdentifier id) + { + ProfileResourceFormatResource.ValidateResourceId(id); + return new ProfileResourceFormatResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual InteractionResourceFormatResource GetInteractionResourceFormatResource(ResourceIdentifier id) + { + InteractionResourceFormatResource.ValidateResourceId(id); + return new InteractionResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelationshipResourceFormatResource GetRelationshipResourceFormatResource(ResourceIdentifier id) + { + RelationshipResourceFormatResource.ValidateResourceId(id); + return new RelationshipResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelationshipLinkResourceFormatResource GetRelationshipLinkResourceFormatResource(ResourceIdentifier id) + { + RelationshipLinkResourceFormatResource.ValidateResourceId(id); + return new RelationshipLinkResourceFormatResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AuthorizationPolicyResourceFormatResource GetAuthorizationPolicyResourceFormatResource(ResourceIdentifier id) + { + AuthorizationPolicyResourceFormatResource.ValidateResourceId(id); + return new AuthorizationPolicyResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConnectorResourceFormatResource GetConnectorResourceFormatResource(ResourceIdentifier id) + { + ConnectorResourceFormatResource.ValidateResourceId(id); + return new ConnectorResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConnectorMappingResourceFormatResource GetConnectorMappingResourceFormatResource(ResourceIdentifier id) + { + ConnectorMappingResourceFormatResource.ValidateResourceId(id); + return new ConnectorMappingResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KpiResourceFormatResource GetKpiResourceFormatResource(ResourceIdentifier id) + { + KpiResourceFormatResource.ValidateResourceId(id); + return new KpiResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WidgetTypeResourceFormatResource GetWidgetTypeResourceFormatResource(ResourceIdentifier id) + { + WidgetTypeResourceFormatResource.ValidateResourceId(id); + return new WidgetTypeResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ViewResourceFormatResource GetViewResourceFormatResource(ResourceIdentifier id) + { + ViewResourceFormatResource.ValidateResourceId(id); + return new ViewResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LinkResourceFormatResource GetLinkResourceFormatResource(ResourceIdentifier id) + { + LinkResourceFormatResource.ValidateResourceId(id); + return new LinkResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoleAssignmentResourceFormatResource GetRoleAssignmentResourceFormatResource(ResourceIdentifier id) + { + RoleAssignmentResourceFormatResource.ValidateResourceId(id); + return new RoleAssignmentResourceFormatResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PredictionResourceFormatResource GetPredictionResourceFormatResource(ResourceIdentifier id) + { + PredictionResourceFormatResource.ValidateResourceId(id); + return new PredictionResourceFormatResource(Client, id); + } + } +} diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsResourceGroupResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsResourceGroupResource.cs new file mode 100644 index 0000000000000..b01f21d655785 --- /dev/null +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.CustomerInsights; + +namespace Azure.ResourceManager.CustomerInsights.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableCustomerInsightsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableCustomerInsightsResourceGroupResource() + { + } + + /// 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 MockableCustomerInsightsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of HubResources in the ResourceGroupResource. + /// An object representing collection of HubResources and their operations over a HubResource. + public virtual HubCollection GetHubs() + { + return GetCachedClient(client => new HubCollection(client, Id)); + } + + /// + /// Gets information about the specified hub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName} + /// + /// + /// Operation Id + /// Hubs_Get + /// + /// + /// + /// The name of the hub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHubAsync(string hubName, CancellationToken cancellationToken = default) + { + return await GetHubs().GetAsync(hubName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified hub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName} + /// + /// + /// Operation Id + /// Hubs_Get + /// + /// + /// + /// The name of the hub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHub(string hubName, CancellationToken cancellationToken = default) + { + return GetHubs().Get(hubName, cancellationToken); + } + } +} diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsSubscriptionResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsSubscriptionResource.cs new file mode 100644 index 0000000000000..3845eeca6f840 --- /dev/null +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/MockableCustomerInsightsSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.CustomerInsights; + +namespace Azure.ResourceManager.CustomerInsights.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableCustomerInsightsSubscriptionResource : ArmResource + { + private ClientDiagnostics _hubClientDiagnostics; + private HubsRestOperations _hubRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableCustomerInsightsSubscriptionResource() + { + } + + /// 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 MockableCustomerInsightsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics HubClientDiagnostics => _hubClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CustomerInsights", HubResource.ResourceType.Namespace, Diagnostics); + private HubsRestOperations HubRestClient => _hubRestClient ??= new HubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HubResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all hubs in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CustomerInsights/hubs + /// + /// + /// Operation Id + /// Hubs_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHubsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HubRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HubResource(Client, HubData.DeserializeHubData(e)), HubClientDiagnostics, Pipeline, "MockableCustomerInsightsSubscriptionResource.GetHubs", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all hubs in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CustomerInsights/hubs + /// + /// + /// Operation Id + /// Hubs_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHubs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HubRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HubResource(Client, HubData.DeserializeHubData(e)), HubClientDiagnostics, Pipeline, "MockableCustomerInsightsSubscriptionResource.GetHubs", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 4e2892bedf554..0000000000000 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CustomerInsights -{ - /// 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 HubResources in the ResourceGroupResource. - /// An object representing collection of HubResources and their operations over a HubResource. - public virtual HubCollection GetHubs() - { - return GetCachedClient(Client => new HubCollection(Client, Id)); - } - } -} diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 86b7a5a888b76..0000000000000 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.CustomerInsights -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _hubClientDiagnostics; - private HubsRestOperations _hubRestClient; - - /// 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 HubClientDiagnostics => _hubClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CustomerInsights", HubResource.ResourceType.Namespace, Diagnostics); - private HubsRestOperations HubRestClient => _hubRestClient ??= new HubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HubResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets all hubs in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CustomerInsights/hubs - /// - /// - /// Operation Id - /// Hubs_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHubsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HubRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HubResource(Client, HubData.DeserializeHubData(e)), HubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHubs", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all hubs in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CustomerInsights/hubs - /// - /// - /// Operation Id - /// Hubs_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHubs(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HubRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HubResource(Client, HubData.DeserializeHubData(e)), HubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHubs", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubResource.cs index 534422bf9cd4c..27503b26b82c3 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.CustomerInsights public partial class HubResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}"; @@ -102,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ProfileResourceFormatResources and their operations over a ProfileResourceFormatResource. public virtual ProfileResourceFormatCollection GetProfileResourceFormats() { - return GetCachedClient(Client => new ProfileResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new ProfileResourceFormatCollection(client, Id)); } /// @@ -121,8 +124,8 @@ public virtual ProfileResourceFormatCollection GetProfileResourceFormats() /// The name of the profile. /// Locale of profile to retrieve, default is en-us. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProfileResourceFormatAsync(string profileName, string localeCode = null, CancellationToken cancellationToken = default) { @@ -145,8 +148,8 @@ public virtual async Task> GetProfileRes /// The name of the profile. /// Locale of profile to retrieve, default is en-us. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProfileResourceFormat(string profileName, string localeCode = null, CancellationToken cancellationToken = default) { @@ -157,7 +160,7 @@ public virtual Response GetProfileResourceFormat( /// An object representing collection of InteractionResourceFormatResources and their operations over a InteractionResourceFormatResource. public virtual InteractionResourceFormatCollection GetInteractionResourceFormats() { - return GetCachedClient(Client => new InteractionResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new InteractionResourceFormatCollection(client, Id)); } /// @@ -176,8 +179,8 @@ public virtual InteractionResourceFormatCollection GetInteractionResourceFormats /// The name of the interaction. /// Locale of interaction to retrieve, default is en-us. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetInteractionResourceFormatAsync(string interactionName, string localeCode = null, CancellationToken cancellationToken = default) { @@ -200,8 +203,8 @@ public virtual async Task> GetIntera /// The name of the interaction. /// Locale of interaction to retrieve, default is en-us. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetInteractionResourceFormat(string interactionName, string localeCode = null, CancellationToken cancellationToken = default) { @@ -212,7 +215,7 @@ public virtual Response GetInteractionResourc /// An object representing collection of RelationshipResourceFormatResources and their operations over a RelationshipResourceFormatResource. public virtual RelationshipResourceFormatCollection GetRelationshipResourceFormats() { - return GetCachedClient(Client => new RelationshipResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new RelationshipResourceFormatCollection(client, Id)); } /// @@ -230,8 +233,8 @@ public virtual RelationshipResourceFormatCollection GetRelationshipResourceForma /// /// The name of the relationship. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRelationshipResourceFormatAsync(string relationshipName, CancellationToken cancellationToken = default) { @@ -253,8 +256,8 @@ public virtual async Task> GetRelat /// /// The name of the relationship. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRelationshipResourceFormat(string relationshipName, CancellationToken cancellationToken = default) { @@ -265,7 +268,7 @@ public virtual Response GetRelationshipResou /// An object representing collection of RelationshipLinkResourceFormatResources and their operations over a RelationshipLinkResourceFormatResource. public virtual RelationshipLinkResourceFormatCollection GetRelationshipLinkResourceFormats() { - return GetCachedClient(Client => new RelationshipLinkResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new RelationshipLinkResourceFormatCollection(client, Id)); } /// @@ -283,8 +286,8 @@ public virtual RelationshipLinkResourceFormatCollection GetRelationshipLinkResou /// /// The name of the relationship link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRelationshipLinkResourceFormatAsync(string relationshipLinkName, CancellationToken cancellationToken = default) { @@ -306,8 +309,8 @@ public virtual async Task> GetR /// /// The name of the relationship link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRelationshipLinkResourceFormat(string relationshipLinkName, CancellationToken cancellationToken = default) { @@ -318,7 +321,7 @@ public virtual Response GetRelationshipL /// An object representing collection of AuthorizationPolicyResourceFormatResources and their operations over a AuthorizationPolicyResourceFormatResource. public virtual AuthorizationPolicyResourceFormatCollection GetAuthorizationPolicyResourceFormats() { - return GetCachedClient(Client => new AuthorizationPolicyResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new AuthorizationPolicyResourceFormatCollection(client, Id)); } /// @@ -336,8 +339,8 @@ public virtual AuthorizationPolicyResourceFormatCollection GetAuthorizationPolic /// /// The name of the policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAuthorizationPolicyResourceFormatAsync(string authorizationPolicyName, CancellationToken cancellationToken = default) { @@ -359,8 +362,8 @@ public virtual async Task> G /// /// The name of the policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAuthorizationPolicyResourceFormat(string authorizationPolicyName, CancellationToken cancellationToken = default) { @@ -371,7 +374,7 @@ public virtual Response GetAuthorizat /// An object representing collection of ConnectorResourceFormatResources and their operations over a ConnectorResourceFormatResource. public virtual ConnectorResourceFormatCollection GetConnectorResourceFormats() { - return GetCachedClient(Client => new ConnectorResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new ConnectorResourceFormatCollection(client, Id)); } /// @@ -389,8 +392,8 @@ public virtual ConnectorResourceFormatCollection GetConnectorResourceFormats() /// /// The name of the connector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetConnectorResourceFormatAsync(string connectorName, CancellationToken cancellationToken = default) { @@ -412,8 +415,8 @@ public virtual async Task> GetConnecto /// /// The name of the connector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetConnectorResourceFormat(string connectorName, CancellationToken cancellationToken = default) { @@ -424,7 +427,7 @@ public virtual Response GetConnectorResourceFor /// An object representing collection of KpiResourceFormatResources and their operations over a KpiResourceFormatResource. public virtual KpiResourceFormatCollection GetKpiResourceFormats() { - return GetCachedClient(Client => new KpiResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new KpiResourceFormatCollection(client, Id)); } /// @@ -442,8 +445,8 @@ public virtual KpiResourceFormatCollection GetKpiResourceFormats() /// /// The name of the KPI. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKpiResourceFormatAsync(string kpiName, CancellationToken cancellationToken = default) { @@ -465,8 +468,8 @@ public virtual async Task> GetKpiResourceFor /// /// The name of the KPI. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKpiResourceFormat(string kpiName, CancellationToken cancellationToken = default) { @@ -477,7 +480,7 @@ public virtual Response GetKpiResourceFormat(string k /// An object representing collection of WidgetTypeResourceFormatResources and their operations over a WidgetTypeResourceFormatResource. public virtual WidgetTypeResourceFormatCollection GetWidgetTypeResourceFormats() { - return GetCachedClient(Client => new WidgetTypeResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new WidgetTypeResourceFormatCollection(client, Id)); } /// @@ -495,8 +498,8 @@ public virtual WidgetTypeResourceFormatCollection GetWidgetTypeResourceFormats() /// /// The name of the widget type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWidgetTypeResourceFormatAsync(string widgetTypeName, CancellationToken cancellationToken = default) { @@ -518,8 +521,8 @@ public virtual async Task> GetWidgetT /// /// The name of the widget type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWidgetTypeResourceFormat(string widgetTypeName, CancellationToken cancellationToken = default) { @@ -530,7 +533,7 @@ public virtual Response GetWidgetTypeResourceF /// An object representing collection of ViewResourceFormatResources and their operations over a ViewResourceFormatResource. public virtual ViewResourceFormatCollection GetViewResourceFormats() { - return GetCachedClient(Client => new ViewResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new ViewResourceFormatCollection(client, Id)); } /// @@ -549,8 +552,8 @@ public virtual ViewResourceFormatCollection GetViewResourceFormats() /// The name of the view. /// The user ID. Use * to retrieve hub level view. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetViewResourceFormatAsync(string viewName, string userId, CancellationToken cancellationToken = default) { @@ -573,8 +576,8 @@ public virtual async Task> GetViewResourceF /// The name of the view. /// The user ID. Use * to retrieve hub level view. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetViewResourceFormat(string viewName, string userId, CancellationToken cancellationToken = default) { @@ -585,7 +588,7 @@ public virtual Response GetViewResourceFormat(string /// An object representing collection of LinkResourceFormatResources and their operations over a LinkResourceFormatResource. public virtual LinkResourceFormatCollection GetLinkResourceFormats() { - return GetCachedClient(Client => new LinkResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new LinkResourceFormatCollection(client, Id)); } /// @@ -603,8 +606,8 @@ public virtual LinkResourceFormatCollection GetLinkResourceFormats() /// /// The name of the link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLinkResourceFormatAsync(string linkName, CancellationToken cancellationToken = default) { @@ -626,8 +629,8 @@ public virtual async Task> GetLinkResourceF /// /// The name of the link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLinkResourceFormat(string linkName, CancellationToken cancellationToken = default) { @@ -638,7 +641,7 @@ public virtual Response GetLinkResourceFormat(string /// An object representing collection of RoleAssignmentResourceFormatResources and their operations over a RoleAssignmentResourceFormatResource. public virtual RoleAssignmentResourceFormatCollection GetRoleAssignmentResourceFormats() { - return GetCachedClient(Client => new RoleAssignmentResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new RoleAssignmentResourceFormatCollection(client, Id)); } /// @@ -656,8 +659,8 @@ public virtual RoleAssignmentResourceFormatCollection GetRoleAssignmentResourceF /// /// The name of the role assignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRoleAssignmentResourceFormatAsync(string assignmentName, CancellationToken cancellationToken = default) { @@ -679,8 +682,8 @@ public virtual async Task> GetRol /// /// The name of the role assignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRoleAssignmentResourceFormat(string assignmentName, CancellationToken cancellationToken = default) { @@ -691,7 +694,7 @@ public virtual Response GetRoleAssignmentR /// An object representing collection of PredictionResourceFormatResources and their operations over a PredictionResourceFormatResource. public virtual PredictionResourceFormatCollection GetPredictionResourceFormats() { - return GetCachedClient(Client => new PredictionResourceFormatCollection(Client, Id)); + return GetCachedClient(client => new PredictionResourceFormatCollection(client, Id)); } /// @@ -709,8 +712,8 @@ public virtual PredictionResourceFormatCollection GetPredictionResourceFormats() /// /// The name of the Prediction. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPredictionResourceFormatAsync(string predictionName, CancellationToken cancellationToken = default) { @@ -732,8 +735,8 @@ public virtual async Task> GetPredict /// /// The name of the Prediction. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPredictionResourceFormat(string predictionName, CancellationToken cancellationToken = default) { diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatResource.cs index 847541dd52483..406ed3964a39d 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/InteractionResourceFormatResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class InteractionResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The interactionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string interactionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/interactions/{interactionName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatResource.cs index a9c4fa5a0f4d1..60065e30aa840 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/KpiResourceFormatResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class KpiResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The kpiName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string kpiName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/kpi/{kpiName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatResource.cs index 3e579e104f751..55e0e5f9f5d8d 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/LinkResourceFormatResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class LinkResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The linkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string linkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/links/{linkName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatResource.cs index 951427ee4b106..b4dd5e454adba 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/PredictionResourceFormatResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class PredictionResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The predictionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string predictionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/predictions/{predictionName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatResource.cs index 7449a88f0118f..e2f01073013f9 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ProfileResourceFormatResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class ProfileResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The profileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string profileName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/profiles/{profileName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatResource.cs index ad613d5dffbda..eb9682bca5010 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipLinkResourceFormatResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class RelationshipLinkResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The relationshipLinkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string relationshipLinkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationshipLinks/{relationshipLinkName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatResource.cs index 613362cee9f20..c2553a6df7425 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RelationshipResourceFormatResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class RelationshipResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The relationshipName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string relationshipName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/relationships/{relationshipName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatResource.cs index b0f14e334e5fb..20320f8a02982 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/RoleAssignmentResourceFormatResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class RoleAssignmentResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The assignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string assignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/roleAssignments/{assignmentName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatResource.cs index 1d7dae395c33d..56c53ee3ed4f0 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ViewResourceFormatResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class ViewResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The viewName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string viewName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/views/{viewName}"; diff --git a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatResource.cs index 0a98117f3d836..788726f621f1e 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/WidgetTypeResourceFormatResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.CustomerInsights public partial class WidgetTypeResourceFormatResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hubName. + /// The widgetTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hubName, string widgetTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/widgetTypes/{widgetTypeName}"; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/api/Azure.ResourceManager.DataBox.netstandard2.0.cs b/sdk/databox/Azure.ResourceManager.DataBox/api/Azure.ResourceManager.DataBox.netstandard2.0.cs index 7584b4a9a2917..ba1f59c33977b 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/api/Azure.ResourceManager.DataBox.netstandard2.0.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/api/Azure.ResourceManager.DataBox.netstandard2.0.cs @@ -40,7 +40,7 @@ protected DataBoxJobCollection() { } } public partial class DataBoxJobData : Azure.ResourceManager.Models.TrackedResourceData { - public DataBoxJobData(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.DataBoxJobTransferType transferType, Azure.ResourceManager.DataBox.Models.DataBoxSku sku) : base (default(Azure.Core.AzureLocation)) { } + public DataBoxJobData(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.DataBoxJobTransferType transferType, Azure.ResourceManager.DataBox.Models.DataBoxSku sku) { } public string CancellationReason { get { throw null; } } public System.DateTimeOffset? DeliveryInfoScheduledOn { get { throw null; } set { } } public Azure.ResourceManager.DataBox.Models.JobDeliveryType? DeliveryType { get { throw null; } set { } } @@ -90,6 +90,39 @@ protected DataBoxJobResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DataBox.Models.DataBoxJobPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DataBox.Mocking +{ + public partial class MockableDataBoxArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDataBoxArmClient() { } + public virtual Azure.ResourceManager.DataBox.DataBoxJobResource GetDataBoxJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDataBoxResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDataBoxResourceGroupResource() { } + public virtual Azure.Pageable GetAvailableSkus(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.AvailableSkusContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableSkusAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.AvailableSkusContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDataBoxJob(string jobName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataBoxJobAsync(string jobName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataBox.DataBoxJobCollection GetDataBoxJobs() { throw null; } + public virtual Azure.Response GetRegionConfiguration(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.RegionConfigurationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRegionConfigurationAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.RegionConfigurationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ValidateInputs(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.DataBoxValidationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateInputsAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.DataBoxValidationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableDataBoxSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDataBoxSubscriptionResource() { } + public virtual Azure.Pageable GetDataBoxJobs(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataBoxJobsAsync(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRegionConfiguration(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.RegionConfigurationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRegionConfigurationAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.RegionConfigurationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ValidateAddress(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.DataBoxValidateAddressContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateAddressAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.DataBoxValidateAddressContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ValidateInputs(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.DataBoxValidationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateInputsAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataBox.Models.DataBoxValidationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DataBox.Models { public partial class AddressValidationOutput diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobResource.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobResource.cs index ce681d46d7371..a3a6d5ac98728 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobResource.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/DataBoxJobResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DataBox public partial class DataBoxJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}"; diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/DataBoxExtensions.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/DataBoxExtensions.cs index e14c3f81fb13f..56fbcbdb0da73 100644 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/DataBoxExtensions.cs +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/DataBoxExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DataBox.Mocking; using Azure.ResourceManager.DataBox.Models; using Azure.ResourceManager.Resources; @@ -19,62 +20,49 @@ namespace Azure.ResourceManager.DataBox /// A class to add extension methods to Azure.ResourceManager.DataBox. public static partial class DataBoxExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDataBoxArmClient GetMockableDataBoxArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDataBoxArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataBoxResourceGroupResource GetMockableDataBoxResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataBoxResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDataBoxSubscriptionResource GetMockableDataBoxSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDataBoxSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataBoxJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxJobResource GetDataBoxJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxJobResource.ValidateResourceId(id); - return new DataBoxJobResource(client, id); - } - ); + return GetMockableDataBoxArmClient(client).GetDataBoxJobResource(id); } - #endregion - /// Gets a collection of DataBoxJobResources in the ResourceGroupResource. + /// + /// Gets a collection of DataBoxJobResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataBoxJobResources and their operations over a DataBoxJobResource. public static DataBoxJobCollection GetDataBoxJobs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataBoxJobs(); + return GetMockableDataBoxResourceGroupResource(resourceGroupResource).GetDataBoxJobs(); } /// @@ -89,17 +77,21 @@ public static DataBoxJobCollection GetDataBoxJobs(this ResourceGroupResource res /// Jobs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. /// $expand is supported on details parameter for job, which provides details on the job stages. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataBoxJobAsync(this ResourceGroupResource resourceGroupResource, string jobName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataBoxJobs().GetAsync(jobName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableDataBoxResourceGroupResource(resourceGroupResource).GetDataBoxJobAsync(jobName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -114,17 +106,21 @@ public static async Task> GetDataBoxJobAsync(this R /// Jobs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. /// $expand is supported on details parameter for job, which provides details on the job stages. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataBoxJob(this ResourceGroupResource resourceGroupResource, string jobName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataBoxJobs().Get(jobName, expand, cancellationToken); + return GetMockableDataBoxResourceGroupResource(resourceGroupResource).GetDataBoxJob(jobName, expand, cancellationToken); } /// @@ -139,6 +135,10 @@ public static Response GetDataBoxJob(this ResourceGroupResou /// Service_ListAvailableSkusByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -148,9 +148,7 @@ public static Response GetDataBoxJob(this ResourceGroupResou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableSkusAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, AvailableSkusContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailableSkusAsync(location, content, cancellationToken); + return GetMockableDataBoxResourceGroupResource(resourceGroupResource).GetAvailableSkusAsync(location, content, cancellationToken); } /// @@ -165,6 +163,10 @@ public static AsyncPageable GetAvailableSkusAsync(this Re /// Service_ListAvailableSkusByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -174,9 +176,7 @@ public static AsyncPageable GetAvailableSkusAsync(this Re /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableSkus(this ResourceGroupResource resourceGroupResource, AzureLocation location, AvailableSkusContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailableSkus(location, content, cancellationToken); + return GetMockableDataBoxResourceGroupResource(resourceGroupResource).GetAvailableSkus(location, content, cancellationToken); } /// @@ -191,6 +191,10 @@ public static Pageable GetAvailableSkus(this ResourceGrou /// Service_ValidateInputsByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -199,9 +203,7 @@ public static Pageable GetAvailableSkus(this ResourceGrou /// is null. public static async Task> ValidateInputsAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).ValidateInputsAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataBoxResourceGroupResource(resourceGroupResource).ValidateInputsAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -216,6 +218,10 @@ public static async Task> ValidateInputsAsync( /// Service_ValidateInputsByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -224,9 +230,7 @@ public static async Task> ValidateInputsAsync( /// is null. public static Response ValidateInputs(this ResourceGroupResource resourceGroupResource, AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).ValidateInputs(location, content, cancellationToken); + return GetMockableDataBoxResourceGroupResource(resourceGroupResource).ValidateInputs(location, content, cancellationToken); } /// @@ -241,6 +245,10 @@ public static Response ValidateInputs(this ResourceGrou /// Service_RegionConfigurationByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -249,9 +257,7 @@ public static Response ValidateInputs(this ResourceGrou /// is null. public static async Task> GetRegionConfigurationAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRegionConfigurationAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataBoxResourceGroupResource(resourceGroupResource).GetRegionConfigurationAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -266,6 +272,10 @@ public static async Task> GetRegionConfigura /// Service_RegionConfigurationByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -274,9 +284,7 @@ public static async Task> GetRegionConfigura /// is null. public static Response GetRegionConfiguration(this ResourceGroupResource resourceGroupResource, AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRegionConfiguration(location, content, cancellationToken); + return GetMockableDataBoxResourceGroupResource(resourceGroupResource).GetRegionConfiguration(location, content, cancellationToken); } /// @@ -291,6 +299,10 @@ public static Response GetRegionConfiguration(this Re /// Jobs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @@ -298,7 +310,7 @@ public static Response GetRegionConfiguration(this Re /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDataBoxJobsAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataBoxJobsAsync(skipToken, cancellationToken); + return GetMockableDataBoxSubscriptionResource(subscriptionResource).GetDataBoxJobsAsync(skipToken, cancellationToken); } /// @@ -313,6 +325,10 @@ public static AsyncPageable GetDataBoxJobsAsync(this Subscri /// Jobs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. @@ -320,7 +336,7 @@ public static AsyncPageable GetDataBoxJobsAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDataBoxJobs(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataBoxJobs(skipToken, cancellationToken); + return GetMockableDataBoxSubscriptionResource(subscriptionResource).GetDataBoxJobs(skipToken, cancellationToken); } /// @@ -335,6 +351,10 @@ public static Pageable GetDataBoxJobs(this SubscriptionResou /// Service_ValidateAddress /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -343,9 +363,7 @@ public static Pageable GetDataBoxJobs(this SubscriptionResou /// is null. public static async Task> ValidateAddressAsync(this SubscriptionResource subscriptionResource, AzureLocation location, DataBoxValidateAddressContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateAddressAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataBoxSubscriptionResource(subscriptionResource).ValidateAddressAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -360,6 +378,10 @@ public static async Task> ValidateAddressAsync /// Service_ValidateAddress /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -368,9 +390,7 @@ public static async Task> ValidateAddressAsync /// is null. public static Response ValidateAddress(this SubscriptionResource subscriptionResource, AzureLocation location, DataBoxValidateAddressContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateAddress(location, content, cancellationToken); + return GetMockableDataBoxSubscriptionResource(subscriptionResource).ValidateAddress(location, content, cancellationToken); } /// @@ -385,6 +405,10 @@ public static Response ValidateAddress(this Subscriptio /// Service_ValidateInputs /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -393,9 +417,7 @@ public static Response ValidateAddress(this Subscriptio /// is null. public static async Task> ValidateInputsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateInputsAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataBoxSubscriptionResource(subscriptionResource).ValidateInputsAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -410,6 +432,10 @@ public static async Task> ValidateInputsAsync( /// Service_ValidateInputs /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -418,9 +444,7 @@ public static async Task> ValidateInputsAsync( /// is null. public static Response ValidateInputs(this SubscriptionResource subscriptionResource, AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateInputs(location, content, cancellationToken); + return GetMockableDataBoxSubscriptionResource(subscriptionResource).ValidateInputs(location, content, cancellationToken); } /// @@ -435,6 +459,10 @@ public static Response ValidateInputs(this Subscription /// Service_RegionConfiguration /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -443,9 +471,7 @@ public static Response ValidateInputs(this Subscription /// is null. public static async Task> GetRegionConfigurationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionConfigurationAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataBoxSubscriptionResource(subscriptionResource).GetRegionConfigurationAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -460,6 +486,10 @@ public static async Task> GetRegionConfigura /// Service_RegionConfiguration /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -468,9 +498,7 @@ public static async Task> GetRegionConfigura /// is null. public static Response GetRegionConfiguration(this SubscriptionResource subscriptionResource, AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionConfiguration(location, content, cancellationToken); + return GetMockableDataBoxSubscriptionResource(subscriptionResource).GetRegionConfiguration(location, content, cancellationToken); } } } diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxArmClient.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxArmClient.cs new file mode 100644 index 0000000000000..d9a79b51687a2 --- /dev/null +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DataBox; + +namespace Azure.ResourceManager.DataBox.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDataBoxArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataBoxArmClient() + { + } + + /// 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 MockableDataBoxArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDataBoxArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxJobResource GetDataBoxJobResource(ResourceIdentifier id) + { + DataBoxJobResource.ValidateResourceId(id); + return new DataBoxJobResource(Client, id); + } + } +} diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxResourceGroupResource.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxResourceGroupResource.cs new file mode 100644 index 0000000000000..bed02e356c5ed --- /dev/null +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxResourceGroupResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataBox; +using Azure.ResourceManager.DataBox.Models; + +namespace Azure.ResourceManager.DataBox.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDataBoxResourceGroupResource : ArmResource + { + private ClientDiagnostics _serviceClientDiagnostics; + private ServiceRestOperations _serviceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataBoxResourceGroupResource() + { + } + + /// 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 MockableDataBoxResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ServiceClientDiagnostics => _serviceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBox", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ServiceRestOperations ServiceRestClient => _serviceRestClient ??= new ServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataBoxJobResources in the ResourceGroupResource. + /// An object representing collection of DataBoxJobResources and their operations over a DataBoxJobResource. + public virtual DataBoxJobCollection GetDataBoxJobs() + { + return GetCachedClient(client => new DataBoxJobCollection(client, Id)); + } + + /// + /// Gets information about the specified job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataBoxJobAsync(string jobName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetDataBoxJobs().GetAsync(jobName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName} + /// + /// + /// Operation Id + /// Jobs_Get + /// + /// + /// + /// The name of the job Resource within the specified resource group. job names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// $expand is supported on details parameter for job, which provides details on the job stages. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataBoxJob(string jobName, string expand = null, CancellationToken cancellationToken = default) + { + return GetDataBoxJobs().Get(jobName, expand, cancellationToken); + } + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus + /// + /// + /// Operation Id + /// Service_ListAvailableSkusByResourceGroup + /// + /// + /// + /// The location of the resource. + /// Filters for showing the available skus. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableSkusAsync(AzureLocation location, AvailableSkusContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceRestClient.CreateListAvailableSkusByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, content); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceRestClient.CreateListAvailableSkusByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, content); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DataBoxSkuInformation.DeserializeDataBoxSkuInformation, ServiceClientDiagnostics, Pipeline, "MockableDataBoxResourceGroupResource.GetAvailableSkus", "value", "nextLink", cancellationToken); + } + + /// + /// This method provides the list of available skus for the given subscription, resource group and location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus + /// + /// + /// Operation Id + /// Service_ListAvailableSkusByResourceGroup + /// + /// + /// + /// The location of the resource. + /// Filters for showing the available skus. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableSkus(AzureLocation location, AvailableSkusContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceRestClient.CreateListAvailableSkusByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, content); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceRestClient.CreateListAvailableSkusByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, content); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DataBoxSkuInformation.DeserializeDataBoxSkuInformation, ServiceClientDiagnostics, Pipeline, "MockableDataBoxResourceGroupResource.GetAvailableSkus", "value", "nextLink", cancellationToken); + } + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs + /// + /// + /// Operation Id + /// Service_ValidateInputsByResourceGroup + /// + /// + /// + /// The location of the resource. + /// Inputs of the customer. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateInputsAsync(AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxResourceGroupResource.ValidateInputs"); + scope.Start(); + try + { + var response = await ServiceRestClient.ValidateInputsByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This method does all necessary pre-job creation validation under resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs + /// + /// + /// Operation Id + /// Service_ValidateInputsByResourceGroup + /// + /// + /// + /// The location of the resource. + /// Inputs of the customer. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateInputs(AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxResourceGroupResource.ValidateInputs"); + scope.Start(); + try + { + var response = ServiceRestClient.ValidateInputsByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration + /// + /// + /// Operation Id + /// Service_RegionConfigurationByResourceGroup + /// + /// + /// + /// The location of the resource. + /// Request body to get the configuration for the region at resource group level. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetRegionConfigurationAsync(AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxResourceGroupResource.GetRegionConfiguration"); + scope.Start(); + try + { + var response = await ServiceRestClient.RegionConfigurationByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This API provides configuration details specific to given region/location at Resource group level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration + /// + /// + /// Operation Id + /// Service_RegionConfigurationByResourceGroup + /// + /// + /// + /// The location of the resource. + /// Request body to get the configuration for the region at resource group level. + /// The cancellation token to use. + /// is null. + public virtual Response GetRegionConfiguration(AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxResourceGroupResource.GetRegionConfiguration"); + scope.Start(); + try + { + var response = ServiceRestClient.RegionConfigurationByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxSubscriptionResource.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxSubscriptionResource.cs new file mode 100644 index 0000000000000..7d1abe4611932 --- /dev/null +++ b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/MockableDataBoxSubscriptionResource.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataBox; +using Azure.ResourceManager.DataBox.Models; + +namespace Azure.ResourceManager.DataBox.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDataBoxSubscriptionResource : ArmResource + { + private ClientDiagnostics _dataBoxJobJobsClientDiagnostics; + private JobsRestOperations _dataBoxJobJobsRestClient; + private ClientDiagnostics _serviceClientDiagnostics; + private ServiceRestOperations _serviceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataBoxSubscriptionResource() + { + } + + /// 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 MockableDataBoxSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataBoxJobJobsClientDiagnostics => _dataBoxJobJobsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBox", DataBoxJobResource.ResourceType.Namespace, Diagnostics); + private JobsRestOperations DataBoxJobJobsRestClient => _dataBoxJobJobsRestClient ??= new JobsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataBoxJobResource.ResourceType)); + private ClientDiagnostics ServiceClientDiagnostics => _serviceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBox", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ServiceRestOperations ServiceRestClient => _serviceRestClient ??= new ServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all the jobs available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs + /// + /// + /// Operation Id + /// Jobs_List + /// + /// + /// + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataBoxJobsAsync(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxJobJobsRestClient.CreateListRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxJobJobsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), DataBoxJobJobsClientDiagnostics, Pipeline, "MockableDataBoxSubscriptionResource.GetDataBoxJobs", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the jobs available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs + /// + /// + /// Operation Id + /// Jobs_List + /// + /// + /// + /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataBoxJobs(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxJobJobsRestClient.CreateListRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxJobJobsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), DataBoxJobJobsClientDiagnostics, Pipeline, "MockableDataBoxSubscriptionResource.GetDataBoxJobs", "value", "nextLink", cancellationToken); + } + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress + /// + /// + /// Operation Id + /// Service_ValidateAddress + /// + /// + /// + /// The location of the resource. + /// Shipping address of the customer. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateAddressAsync(AzureLocation location, DataBoxValidateAddressContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxSubscriptionResource.ValidateAddress"); + scope.Start(); + try + { + var response = await ServiceRestClient.ValidateAddressAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress + /// + /// + /// Operation Id + /// Service_ValidateAddress + /// + /// + /// + /// The location of the resource. + /// Shipping address of the customer. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateAddress(AzureLocation location, DataBoxValidateAddressContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxSubscriptionResource.ValidateAddress"); + scope.Start(); + try + { + var response = ServiceRestClient.ValidateAddress(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This method does all necessary pre-job creation validation under subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs + /// + /// + /// Operation Id + /// Service_ValidateInputs + /// + /// + /// + /// The location of the resource. + /// Inputs of the customer. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateInputsAsync(AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxSubscriptionResource.ValidateInputs"); + scope.Start(); + try + { + var response = await ServiceRestClient.ValidateInputsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This method does all necessary pre-job creation validation under subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs + /// + /// + /// Operation Id + /// Service_ValidateInputs + /// + /// + /// + /// The location of the resource. + /// Inputs of the customer. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateInputs(AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxSubscriptionResource.ValidateInputs"); + scope.Start(); + try + { + var response = ServiceRestClient.ValidateInputs(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration + /// + /// + /// Operation Id + /// Service_RegionConfiguration + /// + /// + /// + /// The location of the resource. + /// Request body to get the configuration for the region. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetRegionConfigurationAsync(AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxSubscriptionResource.GetRegionConfiguration"); + scope.Start(); + try + { + var response = await ServiceRestClient.RegionConfigurationAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This API provides configuration details specific to given region/location at Subscription level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration + /// + /// + /// Operation Id + /// Service_RegionConfiguration + /// + /// + /// + /// The location of the resource. + /// Request body to get the configuration for the region. + /// The cancellation token to use. + /// is null. + public virtual Response GetRegionConfiguration(AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceClientDiagnostics.CreateScope("MockableDataBoxSubscriptionResource.GetRegionConfiguration"); + scope.Start(); + try + { + var response = ServiceRestClient.RegionConfiguration(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index b3bb2577ac182..0000000000000 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DataBox.Models; - -namespace Azure.ResourceManager.DataBox -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _serviceClientDiagnostics; - private ServiceRestOperations _serviceRestClient; - - /// 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 ClientDiagnostics ServiceClientDiagnostics => _serviceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBox", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ServiceRestOperations ServiceRestClient => _serviceRestClient ??= new ServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DataBoxJobResources in the ResourceGroupResource. - /// An object representing collection of DataBoxJobResources and their operations over a DataBoxJobResource. - public virtual DataBoxJobCollection GetDataBoxJobs() - { - return GetCachedClient(Client => new DataBoxJobCollection(Client, Id)); - } - - /// - /// This method provides the list of available skus for the given subscription, resource group and location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus - /// - /// - /// Operation Id - /// Service_ListAvailableSkusByResourceGroup - /// - /// - /// - /// The location of the resource. - /// Filters for showing the available skus. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableSkusAsync(AzureLocation location, AvailableSkusContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceRestClient.CreateListAvailableSkusByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, content); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceRestClient.CreateListAvailableSkusByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, content); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DataBoxSkuInformation.DeserializeDataBoxSkuInformation, ServiceClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailableSkus", "value", "nextLink", cancellationToken); - } - - /// - /// This method provides the list of available skus for the given subscription, resource group and location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus - /// - /// - /// Operation Id - /// Service_ListAvailableSkusByResourceGroup - /// - /// - /// - /// The location of the resource. - /// Filters for showing the available skus. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableSkus(AzureLocation location, AvailableSkusContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceRestClient.CreateListAvailableSkusByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, content); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceRestClient.CreateListAvailableSkusByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, content); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DataBoxSkuInformation.DeserializeDataBoxSkuInformation, ServiceClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailableSkus", "value", "nextLink", cancellationToken); - } - - /// - /// This method does all necessary pre-job creation validation under resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs - /// - /// - /// Operation Id - /// Service_ValidateInputsByResourceGroup - /// - /// - /// - /// The location of the resource. - /// Inputs of the customer. - /// The cancellation token to use. - public virtual async Task> ValidateInputsAsync(AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.ValidateInputs"); - scope.Start(); - try - { - var response = await ServiceRestClient.ValidateInputsByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This method does all necessary pre-job creation validation under resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs - /// - /// - /// Operation Id - /// Service_ValidateInputsByResourceGroup - /// - /// - /// - /// The location of the resource. - /// Inputs of the customer. - /// The cancellation token to use. - public virtual Response ValidateInputs(AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.ValidateInputs"); - scope.Start(); - try - { - var response = ServiceRestClient.ValidateInputsByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This API provides configuration details specific to given region/location at Resource group level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration - /// - /// - /// Operation Id - /// Service_RegionConfigurationByResourceGroup - /// - /// - /// - /// The location of the resource. - /// Request body to get the configuration for the region at resource group level. - /// The cancellation token to use. - public virtual async Task> GetRegionConfigurationAsync(AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionConfiguration"); - scope.Start(); - try - { - var response = await ServiceRestClient.RegionConfigurationByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This API provides configuration details specific to given region/location at Resource group level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration - /// - /// - /// Operation Id - /// Service_RegionConfigurationByResourceGroup - /// - /// - /// - /// The location of the resource. - /// Request body to get the configuration for the region at resource group level. - /// The cancellation token to use. - public virtual Response GetRegionConfiguration(AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionConfiguration"); - scope.Start(); - try - { - var response = ServiceRestClient.RegionConfigurationByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index a0a972d784676..0000000000000 --- a/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DataBox.Models; - -namespace Azure.ResourceManager.DataBox -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataBoxJobJobsClientDiagnostics; - private JobsRestOperations _dataBoxJobJobsRestClient; - private ClientDiagnostics _serviceClientDiagnostics; - private ServiceRestOperations _serviceRestClient; - - /// 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 DataBoxJobJobsClientDiagnostics => _dataBoxJobJobsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBox", DataBoxJobResource.ResourceType.Namespace, Diagnostics); - private JobsRestOperations DataBoxJobJobsRestClient => _dataBoxJobJobsRestClient ??= new JobsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataBoxJobResource.ResourceType)); - private ClientDiagnostics ServiceClientDiagnostics => _serviceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBox", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ServiceRestOperations ServiceRestClient => _serviceRestClient ??= new ServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all the jobs available under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs - /// - /// - /// Operation Id - /// Jobs_List - /// - /// - /// - /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataBoxJobsAsync(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxJobJobsRestClient.CreateListRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxJobJobsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), DataBoxJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxJobs", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the jobs available under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs - /// - /// - /// Operation Id - /// Jobs_List - /// - /// - /// - /// $skipToken is supported on Get list of jobs, which provides the next page in the list of jobs. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataBoxJobs(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxJobJobsRestClient.CreateListRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxJobJobsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxJobResource(Client, DataBoxJobData.DeserializeDataBoxJobData(e)), DataBoxJobJobsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxJobs", "value", "nextLink", cancellationToken); - } - - /// - /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress - /// - /// - /// Operation Id - /// Service_ValidateAddress - /// - /// - /// - /// The location of the resource. - /// Shipping address of the customer. - /// The cancellation token to use. - public virtual async Task> ValidateAddressAsync(AzureLocation location, DataBoxValidateAddressContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateAddress"); - scope.Start(); - try - { - var response = await ServiceRestClient.ValidateAddressAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and provide alternate addresses if any. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress - /// - /// - /// Operation Id - /// Service_ValidateAddress - /// - /// - /// - /// The location of the resource. - /// Shipping address of the customer. - /// The cancellation token to use. - public virtual Response ValidateAddress(AzureLocation location, DataBoxValidateAddressContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateAddress"); - scope.Start(); - try - { - var response = ServiceRestClient.ValidateAddress(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This method does all necessary pre-job creation validation under subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs - /// - /// - /// Operation Id - /// Service_ValidateInputs - /// - /// - /// - /// The location of the resource. - /// Inputs of the customer. - /// The cancellation token to use. - public virtual async Task> ValidateInputsAsync(AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateInputs"); - scope.Start(); - try - { - var response = await ServiceRestClient.ValidateInputsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This method does all necessary pre-job creation validation under subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs - /// - /// - /// Operation Id - /// Service_ValidateInputs - /// - /// - /// - /// The location of the resource. - /// Inputs of the customer. - /// The cancellation token to use. - public virtual Response ValidateInputs(AzureLocation location, DataBoxValidationContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateInputs"); - scope.Start(); - try - { - var response = ServiceRestClient.ValidateInputs(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This API provides configuration details specific to given region/location at Subscription level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration - /// - /// - /// Operation Id - /// Service_RegionConfiguration - /// - /// - /// - /// The location of the resource. - /// Request body to get the configuration for the region. - /// The cancellation token to use. - public virtual async Task> GetRegionConfigurationAsync(AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionConfiguration"); - scope.Start(); - try - { - var response = await ServiceRestClient.RegionConfigurationAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This API provides configuration details specific to given region/location at Subscription level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration - /// - /// - /// Operation Id - /// Service_RegionConfiguration - /// - /// - /// - /// The location of the resource. - /// Request body to get the configuration for the region. - /// The cancellation token to use. - public virtual Response GetRegionConfiguration(AzureLocation location, RegionConfigurationContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionConfiguration"); - scope.Start(); - try - { - var response = ServiceRestClient.RegionConfiguration(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/Azure.ResourceManager.DataBoxEdge.sln b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/Azure.ResourceManager.DataBoxEdge.sln index 6e931ebf1ef95..564a13bb91d16 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/Azure.ResourceManager.DataBoxEdge.sln +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/Azure.ResourceManager.DataBoxEdge.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F1183898-4592-42CE-97A0-80F56969220A}") = "Azure.ResourceManager.DataBoxEdge", "src\Azure.ResourceManager.DataBoxEdge.csproj", "{8E412457-410B-4D9E-A18F-FA7583AE5198}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DataBoxEdge", "src\Azure.ResourceManager.DataBoxEdge.csproj", "{8E412457-410B-4D9E-A18F-FA7583AE5198}" EndProject -Project("{F1183898-4592-42CE-97A0-80F56969220A}") = "Azure.ResourceManager.DataBoxEdge.Tests", "tests\Azure.ResourceManager.DataBoxEdge.Tests.csproj", "{0418C4D9-4F17-40B7-B0C8-DD060BF8333D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DataBoxEdge.Tests", "tests\Azure.ResourceManager.DataBoxEdge.Tests.csproj", "{0418C4D9-4F17-40B7-B0C8-DD060BF8333D}" EndProject -Project("{F1183898-4592-42CE-97A0-80F56969220A}") = "Azure.ResourceManager.DataBoxEdge.Samples", "samples\Azure.ResourceManager.DataBoxEdge.Samples.csproj", "{7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DataBoxEdge.Samples", "samples\Azure.ResourceManager.DataBoxEdge.Samples.csproj", "{7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {12E77E77-94B6-4094-80D5-C5DAEE3515D0} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {0418C4D9-4F17-40B7-B0C8-DD060BF8333D}.Release|x64.Build.0 = Release|Any CPU {0418C4D9-4F17-40B7-B0C8-DD060BF8333D}.Release|x86.ActiveCfg = Release|Any CPU {0418C4D9-4F17-40B7-B0C8-DD060BF8333D}.Release|x86.Build.0 = Release|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Debug|x64.ActiveCfg = Debug|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Debug|x64.Build.0 = Debug|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Debug|x86.ActiveCfg = Debug|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Debug|x86.Build.0 = Debug|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Release|Any CPU.Build.0 = Release|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Release|x64.ActiveCfg = Release|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Release|x64.Build.0 = Release|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Release|x86.ActiveCfg = Release|Any CPU + {7E7FC47D-3BBE-42D2-9DAD-6EF8193E030C}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {12E77E77-94B6-4094-80D5-C5DAEE3515D0} EndGlobalSection EndGlobal diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/api/Azure.ResourceManager.DataBoxEdge.netstandard2.0.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/api/Azure.ResourceManager.DataBoxEdge.netstandard2.0.cs index f906a27332aa5..a27dd338a65df 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/api/Azure.ResourceManager.DataBoxEdge.netstandard2.0.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/api/Azure.ResourceManager.DataBoxEdge.netstandard2.0.cs @@ -94,7 +94,7 @@ protected DataBoxEdgeDeviceCollection() { } } public partial class DataBoxEdgeDeviceData : Azure.ResourceManager.Models.TrackedResourceData { - public DataBoxEdgeDeviceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DataBoxEdgeDeviceData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList ConfiguredRoleTypes { get { throw null; } } public string Culture { get { throw null; } } public Azure.ResourceManager.DataBoxEdge.Models.DataBoxEdgeDeviceStatus? DataBoxEdgeDeviceStatus { get { throw null; } } @@ -664,6 +664,44 @@ protected MonitoringMetricConfigurationResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DataBoxEdge.Mocking +{ + public partial class MockableDataBoxEdgeArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDataBoxEdgeArmClient() { } + public virtual Azure.ResourceManager.DataBoxEdge.BandwidthScheduleResource GetBandwidthScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeAlertResource GetDataBoxEdgeAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeDeviceResource GetDataBoxEdgeDeviceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeJobResource GetDataBoxEdgeJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeOrderResource GetDataBoxEdgeOrderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeRoleAddonResource GetDataBoxEdgeRoleAddonResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeRoleResource GetDataBoxEdgeRoleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeShareResource GetDataBoxEdgeShareResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeStorageAccountCredentialResource GetDataBoxEdgeStorageAccountCredentialResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeStorageAccountResource GetDataBoxEdgeStorageAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeStorageContainerResource GetDataBoxEdgeStorageContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeTriggerResource GetDataBoxEdgeTriggerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeUserResource GetDataBoxEdgeUserResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DiagnosticProactiveLogCollectionSettingResource GetDiagnosticProactiveLogCollectionSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DiagnosticRemoteSupportSettingResource GetDiagnosticRemoteSupportSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.MonitoringMetricConfigurationResource GetMonitoringMetricConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDataBoxEdgeResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDataBoxEdgeResourceGroupResource() { } + public virtual Azure.Response GetDataBoxEdgeDevice(string deviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataBoxEdgeDeviceAsync(string deviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataBoxEdge.DataBoxEdgeDeviceCollection GetDataBoxEdgeDevices() { throw null; } + } + public partial class MockableDataBoxEdgeSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDataBoxEdgeSubscriptionResource() { } + public virtual Azure.Pageable GetAvailableSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataBoxEdgeDevices(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataBoxEdgeDevicesAsync(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DataBoxEdge.Models { public static partial class ArmDataBoxEdgeModelFactory diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleResource.cs index c8e62156ad0d6..c6672686f8c75 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/BandwidthScheduleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class BandwidthScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertResource.cs index ae1e40d2f4654..e73e5e342e2cb 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeAlertResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceResource.cs index 1f2d3a8089926..7ba0f1dce2382 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeDeviceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}"; @@ -110,7 +113,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataBoxEdgeAlertResources and their operations over a DataBoxEdgeAlertResource. public virtual DataBoxEdgeAlertCollection GetDataBoxEdgeAlerts() { - return GetCachedClient(Client => new DataBoxEdgeAlertCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeAlertCollection(client, Id)); } /// @@ -128,8 +131,8 @@ public virtual DataBoxEdgeAlertCollection GetDataBoxEdgeAlerts() /// /// The alert name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeAlertAsync(string name, CancellationToken cancellationToken = default) { @@ -151,8 +154,8 @@ public virtual async Task> GetDataBoxEdgeAler /// /// The alert name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeAlert(string name, CancellationToken cancellationToken = default) { @@ -163,7 +166,7 @@ public virtual Response GetDataBoxEdgeAlert(string nam /// An object representing collection of BandwidthScheduleResources and their operations over a BandwidthScheduleResource. public virtual BandwidthScheduleCollection GetBandwidthSchedules() { - return GetCachedClient(Client => new BandwidthScheduleCollection(Client, Id)); + return GetCachedClient(client => new BandwidthScheduleCollection(client, Id)); } /// @@ -181,8 +184,8 @@ public virtual BandwidthScheduleCollection GetBandwidthSchedules() /// /// The bandwidth schedule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBandwidthScheduleAsync(string name, CancellationToken cancellationToken = default) { @@ -204,8 +207,8 @@ public virtual async Task> GetBandwidthSched /// /// The bandwidth schedule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBandwidthSchedule(string name, CancellationToken cancellationToken = default) { @@ -230,7 +233,7 @@ public virtual DiagnosticRemoteSupportSettingResource GetDiagnosticRemoteSupport /// An object representing collection of DataBoxEdgeJobResources and their operations over a DataBoxEdgeJobResource. public virtual DataBoxEdgeJobCollection GetDataBoxEdgeJobs() { - return GetCachedClient(Client => new DataBoxEdgeJobCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeJobCollection(client, Id)); } /// @@ -248,8 +251,8 @@ public virtual DataBoxEdgeJobCollection GetDataBoxEdgeJobs() /// /// The job name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeJobAsync(string name, CancellationToken cancellationToken = default) { @@ -271,8 +274,8 @@ public virtual async Task> GetDataBoxEdgeJobAsy /// /// The job name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeJob(string name, CancellationToken cancellationToken = default) { @@ -290,7 +293,7 @@ public virtual DataBoxEdgeOrderResource GetDataBoxEdgeOrder() /// An object representing collection of DataBoxEdgeRoleResources and their operations over a DataBoxEdgeRoleResource. public virtual DataBoxEdgeRoleCollection GetDataBoxEdgeRoles() { - return GetCachedClient(Client => new DataBoxEdgeRoleCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeRoleCollection(client, Id)); } /// @@ -308,8 +311,8 @@ public virtual DataBoxEdgeRoleCollection GetDataBoxEdgeRoles() /// /// The role name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeRoleAsync(string name, CancellationToken cancellationToken = default) { @@ -331,8 +334,8 @@ public virtual async Task> GetDataBoxEdgeRoleA /// /// The role name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeRole(string name, CancellationToken cancellationToken = default) { @@ -343,7 +346,7 @@ public virtual Response GetDataBoxEdgeRole(string name, /// An object representing collection of DataBoxEdgeShareResources and their operations over a DataBoxEdgeShareResource. public virtual DataBoxEdgeShareCollection GetDataBoxEdgeShares() { - return GetCachedClient(Client => new DataBoxEdgeShareCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeShareCollection(client, Id)); } /// @@ -361,8 +364,8 @@ public virtual DataBoxEdgeShareCollection GetDataBoxEdgeShares() /// /// The share name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeShareAsync(string name, CancellationToken cancellationToken = default) { @@ -384,8 +387,8 @@ public virtual async Task> GetDataBoxEdgeShar /// /// The share name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeShare(string name, CancellationToken cancellationToken = default) { @@ -396,7 +399,7 @@ public virtual Response GetDataBoxEdgeShare(string nam /// An object representing collection of DataBoxEdgeStorageAccountCredentialResources and their operations over a DataBoxEdgeStorageAccountCredentialResource. public virtual DataBoxEdgeStorageAccountCredentialCollection GetDataBoxEdgeStorageAccountCredentials() { - return GetCachedClient(Client => new DataBoxEdgeStorageAccountCredentialCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeStorageAccountCredentialCollection(client, Id)); } /// @@ -414,8 +417,8 @@ public virtual DataBoxEdgeStorageAccountCredentialCollection GetDataBoxEdgeStora /// /// The storage account credential name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeStorageAccountCredentialAsync(string name, CancellationToken cancellationToken = default) { @@ -437,8 +440,8 @@ public virtual async Task> /// /// The storage account credential name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeStorageAccountCredential(string name, CancellationToken cancellationToken = default) { @@ -449,7 +452,7 @@ public virtual Response GetDataBoxE /// An object representing collection of DataBoxEdgeStorageAccountResources and their operations over a DataBoxEdgeStorageAccountResource. public virtual DataBoxEdgeStorageAccountCollection GetDataBoxEdgeStorageAccounts() { - return GetCachedClient(Client => new DataBoxEdgeStorageAccountCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeStorageAccountCollection(client, Id)); } /// @@ -467,8 +470,8 @@ public virtual DataBoxEdgeStorageAccountCollection GetDataBoxEdgeStorageAccounts /// /// The storage account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeStorageAccountAsync(string storageAccountName, CancellationToken cancellationToken = default) { @@ -490,8 +493,8 @@ public virtual async Task> GetDataBo /// /// The storage account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeStorageAccount(string storageAccountName, CancellationToken cancellationToken = default) { @@ -502,7 +505,7 @@ public virtual Response GetDataBoxEdgeStorage /// An object representing collection of DataBoxEdgeTriggerResources and their operations over a DataBoxEdgeTriggerResource. public virtual DataBoxEdgeTriggerCollection GetDataBoxEdgeTriggers() { - return GetCachedClient(Client => new DataBoxEdgeTriggerCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeTriggerCollection(client, Id)); } /// @@ -520,8 +523,8 @@ public virtual DataBoxEdgeTriggerCollection GetDataBoxEdgeTriggers() /// /// The trigger name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeTriggerAsync(string name, CancellationToken cancellationToken = default) { @@ -543,8 +546,8 @@ public virtual async Task> GetDataBoxEdgeTr /// /// The trigger name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeTrigger(string name, CancellationToken cancellationToken = default) { @@ -555,7 +558,7 @@ public virtual Response GetDataBoxEdgeTrigger(string /// An object representing collection of DataBoxEdgeUserResources and their operations over a DataBoxEdgeUserResource. public virtual DataBoxEdgeUserCollection GetDataBoxEdgeUsers() { - return GetCachedClient(Client => new DataBoxEdgeUserCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeUserCollection(client, Id)); } /// @@ -573,8 +576,8 @@ public virtual DataBoxEdgeUserCollection GetDataBoxEdgeUsers() /// /// The user name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeUserAsync(string name, CancellationToken cancellationToken = default) { @@ -596,8 +599,8 @@ public virtual async Task> GetDataBoxEdgeUserA /// /// The user name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeUser(string name, CancellationToken cancellationToken = default) { diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobResource.cs index 3c9b600c75210..239395a95f2bf 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeJobResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeOrderResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeOrderResource.cs index 5ef6d62a75fc7..7eb3680c0e183 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeOrderResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeOrderResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeOrderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonResource.cs index 7e1af74ac5747..5918b83b9ddad 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleAddonResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeRoleAddonResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The roleName. + /// The addonName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string roleName, string addonName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleResource.cs index 7b69e6271bbdf..6c4bfb86188e2 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeRoleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataBoxEdgeRoleAddonResources and their operations over a DataBoxEdgeRoleAddonResource. public virtual DataBoxEdgeRoleAddonCollection GetDataBoxEdgeRoleAddons() { - return GetCachedClient(Client => new DataBoxEdgeRoleAddonCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeRoleAddonCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual DataBoxEdgeRoleAddonCollection GetDataBoxEdgeRoleAddons() /// /// The addon name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeRoleAddonAsync(string addonName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetDataBoxEdge /// /// The addon name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeRoleAddon(string addonName, CancellationToken cancellationToken = default) { diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareResource.cs index 3d6358c5ab0b1..f1217cb77e59b 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeShareResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeShareResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialResource.cs index 9e6338e04eebd..4440e7e25d8c5 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountCredentialResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeStorageAccountCredentialResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountResource.cs index a32f56794a5aa..2a8414f986b0f 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeStorageAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The storageAccountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string storageAccountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataBoxEdgeStorageContainerResources and their operations over a DataBoxEdgeStorageContainerResource. public virtual DataBoxEdgeStorageContainerCollection GetDataBoxEdgeStorageContainers() { - return GetCachedClient(Client => new DataBoxEdgeStorageContainerCollection(Client, Id)); + return GetCachedClient(client => new DataBoxEdgeStorageContainerCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual DataBoxEdgeStorageContainerCollection GetDataBoxEdgeStorageContai /// /// The container Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataBoxEdgeStorageContainerAsync(string containerName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetData /// /// The container Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataBoxEdgeStorageContainer(string containerName, CancellationToken cancellationToken = default) { diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerResource.cs index 479a7307c992f..aa804bdf5b735 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageContainerResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeStorageContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The storageAccountName. + /// The containerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string storageAccountName, string containerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerResource.cs index f9777fe0a7357..dd7bbb76b794a 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeTriggerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeTriggerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserResource.cs index 124d93da81c5f..12a03f0173875 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeUserResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DataBoxEdgeUserResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticProactiveLogCollectionSettingResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticProactiveLogCollectionSettingResource.cs index e82cd2057acc9..9c22b12d7202d 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticProactiveLogCollectionSettingResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticProactiveLogCollectionSettingResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DiagnosticProactiveLogCollectionSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticProactiveLogCollectionSettings/default"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticRemoteSupportSettingResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticRemoteSupportSettingResource.cs index f82d236cc6e58..ba5b94db200e4 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticRemoteSupportSettingResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DiagnosticRemoteSupportSettingResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class DiagnosticRemoteSupportSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/diagnosticRemoteSupportSettings/default"; diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/DataBoxEdgeExtensions.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/DataBoxEdgeExtensions.cs index 6a56a0b9553f6..6d4aefebeec7c 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/DataBoxEdgeExtensions.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/DataBoxEdgeExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DataBoxEdge.Mocking; using Azure.ResourceManager.DataBoxEdge.Models; using Azure.ResourceManager.Resources; @@ -19,347 +20,289 @@ namespace Azure.ResourceManager.DataBoxEdge /// A class to add extension methods to Azure.ResourceManager.DataBoxEdge. public static partial class DataBoxEdgeExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDataBoxEdgeArmClient GetMockableDataBoxEdgeArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDataBoxEdgeArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataBoxEdgeResourceGroupResource GetMockableDataBoxEdgeResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataBoxEdgeResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDataBoxEdgeSubscriptionResource GetMockableDataBoxEdgeSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDataBoxEdgeSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataBoxEdgeDeviceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeDeviceResource GetDataBoxEdgeDeviceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeDeviceResource.ValidateResourceId(id); - return new DataBoxEdgeDeviceResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeDeviceResource(id); } - #endregion - #region DataBoxEdgeAlertResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeAlertResource GetDataBoxEdgeAlertResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeAlertResource.ValidateResourceId(id); - return new DataBoxEdgeAlertResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeAlertResource(id); } - #endregion - #region BandwidthScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BandwidthScheduleResource GetBandwidthScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BandwidthScheduleResource.ValidateResourceId(id); - return new BandwidthScheduleResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetBandwidthScheduleResource(id); } - #endregion - #region DiagnosticProactiveLogCollectionSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DiagnosticProactiveLogCollectionSettingResource GetDiagnosticProactiveLogCollectionSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DiagnosticProactiveLogCollectionSettingResource.ValidateResourceId(id); - return new DiagnosticProactiveLogCollectionSettingResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDiagnosticProactiveLogCollectionSettingResource(id); } - #endregion - #region DiagnosticRemoteSupportSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DiagnosticRemoteSupportSettingResource GetDiagnosticRemoteSupportSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DiagnosticRemoteSupportSettingResource.ValidateResourceId(id); - return new DiagnosticRemoteSupportSettingResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDiagnosticRemoteSupportSettingResource(id); } - #endregion - #region DataBoxEdgeJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeJobResource GetDataBoxEdgeJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeJobResource.ValidateResourceId(id); - return new DataBoxEdgeJobResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeJobResource(id); } - #endregion - #region DataBoxEdgeOrderResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeOrderResource GetDataBoxEdgeOrderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeOrderResource.ValidateResourceId(id); - return new DataBoxEdgeOrderResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeOrderResource(id); } - #endregion - #region DataBoxEdgeRoleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeRoleResource GetDataBoxEdgeRoleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeRoleResource.ValidateResourceId(id); - return new DataBoxEdgeRoleResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeRoleResource(id); } - #endregion - #region DataBoxEdgeRoleAddonResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeRoleAddonResource GetDataBoxEdgeRoleAddonResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeRoleAddonResource.ValidateResourceId(id); - return new DataBoxEdgeRoleAddonResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeRoleAddonResource(id); } - #endregion - #region MonitoringMetricConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MonitoringMetricConfigurationResource GetMonitoringMetricConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MonitoringMetricConfigurationResource.ValidateResourceId(id); - return new MonitoringMetricConfigurationResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetMonitoringMetricConfigurationResource(id); } - #endregion - #region DataBoxEdgeShareResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeShareResource GetDataBoxEdgeShareResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeShareResource.ValidateResourceId(id); - return new DataBoxEdgeShareResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeShareResource(id); } - #endregion - #region DataBoxEdgeStorageAccountCredentialResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeStorageAccountCredentialResource GetDataBoxEdgeStorageAccountCredentialResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeStorageAccountCredentialResource.ValidateResourceId(id); - return new DataBoxEdgeStorageAccountCredentialResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeStorageAccountCredentialResource(id); } - #endregion - #region DataBoxEdgeStorageAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeStorageAccountResource GetDataBoxEdgeStorageAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeStorageAccountResource.ValidateResourceId(id); - return new DataBoxEdgeStorageAccountResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeStorageAccountResource(id); } - #endregion - #region DataBoxEdgeStorageContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeStorageContainerResource GetDataBoxEdgeStorageContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeStorageContainerResource.ValidateResourceId(id); - return new DataBoxEdgeStorageContainerResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeStorageContainerResource(id); } - #endregion - #region DataBoxEdgeTriggerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeTriggerResource GetDataBoxEdgeTriggerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeTriggerResource.ValidateResourceId(id); - return new DataBoxEdgeTriggerResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeTriggerResource(id); } - #endregion - #region DataBoxEdgeUserResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataBoxEdgeUserResource GetDataBoxEdgeUserResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataBoxEdgeUserResource.ValidateResourceId(id); - return new DataBoxEdgeUserResource(client, id); - } - ); + return GetMockableDataBoxEdgeArmClient(client).GetDataBoxEdgeUserResource(id); } - #endregion - /// Gets a collection of DataBoxEdgeDeviceResources in the ResourceGroupResource. + /// + /// Gets a collection of DataBoxEdgeDeviceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataBoxEdgeDeviceResources and their operations over a DataBoxEdgeDeviceResource. public static DataBoxEdgeDeviceCollection GetDataBoxEdgeDevices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataBoxEdgeDevices(); + return GetMockableDataBoxEdgeResourceGroupResource(resourceGroupResource).GetDataBoxEdgeDevices(); } /// @@ -374,16 +317,20 @@ public static DataBoxEdgeDeviceCollection GetDataBoxEdgeDevices(this ResourceGro /// Devices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The device name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataBoxEdgeDeviceAsync(this ResourceGroupResource resourceGroupResource, string deviceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataBoxEdgeDevices().GetAsync(deviceName, cancellationToken).ConfigureAwait(false); + return await GetMockableDataBoxEdgeResourceGroupResource(resourceGroupResource).GetDataBoxEdgeDeviceAsync(deviceName, cancellationToken).ConfigureAwait(false); } /// @@ -398,16 +345,20 @@ public static async Task> GetDataBoxEdgeDevi /// Devices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The device name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataBoxEdgeDevice(this ResourceGroupResource resourceGroupResource, string deviceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataBoxEdgeDevices().Get(deviceName, cancellationToken); + return GetMockableDataBoxEdgeResourceGroupResource(resourceGroupResource).GetDataBoxEdgeDevice(deviceName, cancellationToken); } /// @@ -422,13 +373,17 @@ public static Response GetDataBoxEdgeDevice(this Reso /// AvailableSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableSkusAsync(cancellationToken); + return GetMockableDataBoxEdgeSubscriptionResource(subscriptionResource).GetAvailableSkusAsync(cancellationToken); } /// @@ -443,13 +398,17 @@ public static AsyncPageable GetAvailableSkusAsync(this /// AvailableSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableSkus(cancellationToken); + return GetMockableDataBoxEdgeSubscriptionResource(subscriptionResource).GetAvailableSkus(cancellationToken); } /// @@ -464,6 +423,10 @@ public static Pageable GetAvailableSkus(this Subscripti /// Devices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=<token> to populate the next page in the list. @@ -471,7 +434,7 @@ public static Pageable GetAvailableSkus(this Subscripti /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDataBoxEdgeDevicesAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataBoxEdgeDevicesAsync(expand, cancellationToken); + return GetMockableDataBoxEdgeSubscriptionResource(subscriptionResource).GetDataBoxEdgeDevicesAsync(expand, cancellationToken); } /// @@ -486,6 +449,10 @@ public static AsyncPageable GetDataBoxEdgeDevicesAsyn /// Devices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=<token> to populate the next page in the list. @@ -493,7 +460,7 @@ public static AsyncPageable GetDataBoxEdgeDevicesAsyn /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDataBoxEdgeDevices(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataBoxEdgeDevices(expand, cancellationToken); + return GetMockableDataBoxEdgeSubscriptionResource(subscriptionResource).GetDataBoxEdgeDevices(expand, cancellationToken); } } } diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeArmClient.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeArmClient.cs new file mode 100644 index 0000000000000..aca910437d190 --- /dev/null +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeArmClient.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DataBoxEdge; + +namespace Azure.ResourceManager.DataBoxEdge.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDataBoxEdgeArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataBoxEdgeArmClient() + { + } + + /// 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 MockableDataBoxEdgeArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDataBoxEdgeArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeDeviceResource GetDataBoxEdgeDeviceResource(ResourceIdentifier id) + { + DataBoxEdgeDeviceResource.ValidateResourceId(id); + return new DataBoxEdgeDeviceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeAlertResource GetDataBoxEdgeAlertResource(ResourceIdentifier id) + { + DataBoxEdgeAlertResource.ValidateResourceId(id); + return new DataBoxEdgeAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BandwidthScheduleResource GetBandwidthScheduleResource(ResourceIdentifier id) + { + BandwidthScheduleResource.ValidateResourceId(id); + return new BandwidthScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiagnosticProactiveLogCollectionSettingResource GetDiagnosticProactiveLogCollectionSettingResource(ResourceIdentifier id) + { + DiagnosticProactiveLogCollectionSettingResource.ValidateResourceId(id); + return new DiagnosticProactiveLogCollectionSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiagnosticRemoteSupportSettingResource GetDiagnosticRemoteSupportSettingResource(ResourceIdentifier id) + { + DiagnosticRemoteSupportSettingResource.ValidateResourceId(id); + return new DiagnosticRemoteSupportSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeJobResource GetDataBoxEdgeJobResource(ResourceIdentifier id) + { + DataBoxEdgeJobResource.ValidateResourceId(id); + return new DataBoxEdgeJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeOrderResource GetDataBoxEdgeOrderResource(ResourceIdentifier id) + { + DataBoxEdgeOrderResource.ValidateResourceId(id); + return new DataBoxEdgeOrderResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeRoleResource GetDataBoxEdgeRoleResource(ResourceIdentifier id) + { + DataBoxEdgeRoleResource.ValidateResourceId(id); + return new DataBoxEdgeRoleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeRoleAddonResource GetDataBoxEdgeRoleAddonResource(ResourceIdentifier id) + { + DataBoxEdgeRoleAddonResource.ValidateResourceId(id); + return new DataBoxEdgeRoleAddonResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitoringMetricConfigurationResource GetMonitoringMetricConfigurationResource(ResourceIdentifier id) + { + MonitoringMetricConfigurationResource.ValidateResourceId(id); + return new MonitoringMetricConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeShareResource GetDataBoxEdgeShareResource(ResourceIdentifier id) + { + DataBoxEdgeShareResource.ValidateResourceId(id); + return new DataBoxEdgeShareResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeStorageAccountCredentialResource GetDataBoxEdgeStorageAccountCredentialResource(ResourceIdentifier id) + { + DataBoxEdgeStorageAccountCredentialResource.ValidateResourceId(id); + return new DataBoxEdgeStorageAccountCredentialResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeStorageAccountResource GetDataBoxEdgeStorageAccountResource(ResourceIdentifier id) + { + DataBoxEdgeStorageAccountResource.ValidateResourceId(id); + return new DataBoxEdgeStorageAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeStorageContainerResource GetDataBoxEdgeStorageContainerResource(ResourceIdentifier id) + { + DataBoxEdgeStorageContainerResource.ValidateResourceId(id); + return new DataBoxEdgeStorageContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeTriggerResource GetDataBoxEdgeTriggerResource(ResourceIdentifier id) + { + DataBoxEdgeTriggerResource.ValidateResourceId(id); + return new DataBoxEdgeTriggerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataBoxEdgeUserResource GetDataBoxEdgeUserResource(ResourceIdentifier id) + { + DataBoxEdgeUserResource.ValidateResourceId(id); + return new DataBoxEdgeUserResource(Client, id); + } + } +} diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeResourceGroupResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeResourceGroupResource.cs new file mode 100644 index 0000000000000..4dd52f8aaed76 --- /dev/null +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.DataBoxEdge; + +namespace Azure.ResourceManager.DataBoxEdge.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDataBoxEdgeResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataBoxEdgeResourceGroupResource() + { + } + + /// 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 MockableDataBoxEdgeResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataBoxEdgeDeviceResources in the ResourceGroupResource. + /// An object representing collection of DataBoxEdgeDeviceResources and their operations over a DataBoxEdgeDeviceResource. + public virtual DataBoxEdgeDeviceCollection GetDataBoxEdgeDevices() + { + return GetCachedClient(client => new DataBoxEdgeDeviceCollection(client, Id)); + } + + /// + /// Gets the properties of the Data Box Edge/Data Box Gateway device. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName} + /// + /// + /// Operation Id + /// Devices_Get + /// + /// + /// + /// The device name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataBoxEdgeDeviceAsync(string deviceName, CancellationToken cancellationToken = default) + { + return await GetDataBoxEdgeDevices().GetAsync(deviceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of the Data Box Edge/Data Box Gateway device. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName} + /// + /// + /// Operation Id + /// Devices_Get + /// + /// + /// + /// The device name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataBoxEdgeDevice(string deviceName, CancellationToken cancellationToken = default) + { + return GetDataBoxEdgeDevices().Get(deviceName, cancellationToken); + } + } +} diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeSubscriptionResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeSubscriptionResource.cs new file mode 100644 index 0000000000000..3abcfa025e135 --- /dev/null +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/MockableDataBoxEdgeSubscriptionResource.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataBoxEdge; +using Azure.ResourceManager.DataBoxEdge.Models; + +namespace Azure.ResourceManager.DataBoxEdge.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDataBoxEdgeSubscriptionResource : ArmResource + { + private ClientDiagnostics _availableSkusClientDiagnostics; + private AvailableSkusRestOperations _availableSkusRestClient; + private ClientDiagnostics _dataBoxEdgeDeviceDevicesClientDiagnostics; + private DevicesRestOperations _dataBoxEdgeDeviceDevicesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataBoxEdgeSubscriptionResource() + { + } + + /// 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 MockableDataBoxEdgeSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AvailableSkusClientDiagnostics => _availableSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBoxEdge", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableSkusRestOperations AvailableSkusRestClient => _availableSkusRestClient ??= new AvailableSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DataBoxEdgeDeviceDevicesClientDiagnostics => _dataBoxEdgeDeviceDevicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBoxEdge", DataBoxEdgeDeviceResource.ResourceType.Namespace, Diagnostics); + private DevicesRestOperations DataBoxEdgeDeviceDevicesRestClient => _dataBoxEdgeDeviceDevicesRestClient ??= new DevicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataBoxEdgeDeviceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all the available Skus and information related to them. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus + /// + /// + /// Operation Id + /// AvailableSkus_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableSkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableDataBoxEdgeSku.DeserializeAvailableDataBoxEdgeSku, AvailableSkusClientDiagnostics, Pipeline, "MockableDataBoxEdgeSubscriptionResource.GetAvailableSkus", "value", "nextLink", cancellationToken); + } + + /// + /// List all the available Skus and information related to them. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus + /// + /// + /// Operation Id + /// AvailableSkus_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableSkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableDataBoxEdgeSku.DeserializeAvailableDataBoxEdgeSku, AvailableSkusClientDiagnostics, Pipeline, "MockableDataBoxEdgeSubscriptionResource.GetAvailableSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Data Box Edge/Data Box Gateway devices in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices + /// + /// + /// Operation Id + /// Devices_ListBySubscription + /// + /// + /// + /// Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=<token> to populate the next page in the list. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataBoxEdgeDevicesAsync(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), DataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "MockableDataBoxEdgeSubscriptionResource.GetDataBoxEdgeDevices", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Data Box Edge/Data Box Gateway devices in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices + /// + /// + /// Operation Id + /// Devices_ListBySubscription + /// + /// + /// + /// Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=<token> to populate the next page in the list. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataBoxEdgeDevices(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), DataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "MockableDataBoxEdgeSubscriptionResource.GetDataBoxEdgeDevices", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 339de49f050ee..0000000000000 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DataBoxEdge -{ - /// 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 DataBoxEdgeDeviceResources in the ResourceGroupResource. - /// An object representing collection of DataBoxEdgeDeviceResources and their operations over a DataBoxEdgeDeviceResource. - public virtual DataBoxEdgeDeviceCollection GetDataBoxEdgeDevices() - { - return GetCachedClient(Client => new DataBoxEdgeDeviceCollection(Client, Id)); - } - } -} diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 46c4ea7a5d1a8..0000000000000 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DataBoxEdge.Models; - -namespace Azure.ResourceManager.DataBoxEdge -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _availableSkusClientDiagnostics; - private AvailableSkusRestOperations _availableSkusRestClient; - private ClientDiagnostics _dataBoxEdgeDeviceDevicesClientDiagnostics; - private DevicesRestOperations _dataBoxEdgeDeviceDevicesRestClient; - - /// 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 AvailableSkusClientDiagnostics => _availableSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBoxEdge", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableSkusRestOperations AvailableSkusRestClient => _availableSkusRestClient ??= new AvailableSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DataBoxEdgeDeviceDevicesClientDiagnostics => _dataBoxEdgeDeviceDevicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataBoxEdge", DataBoxEdgeDeviceResource.ResourceType.Namespace, Diagnostics); - private DevicesRestOperations DataBoxEdgeDeviceDevicesRestClient => _dataBoxEdgeDeviceDevicesRestClient ??= new DevicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataBoxEdgeDeviceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the available Skus and information related to them. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus - /// - /// - /// Operation Id - /// AvailableSkus_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableSkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableDataBoxEdgeSku.DeserializeAvailableDataBoxEdgeSku, AvailableSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableSkus", "value", "nextLink", cancellationToken); - } - - /// - /// List all the available Skus and information related to them. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus - /// - /// - /// Operation Id - /// AvailableSkus_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableSkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableDataBoxEdgeSku.DeserializeAvailableDataBoxEdgeSku, AvailableSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Data Box Edge/Data Box Gateway devices in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices - /// - /// - /// Operation Id - /// Devices_ListBySubscription - /// - /// - /// - /// Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=<token> to populate the next page in the list. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataBoxEdgeDevicesAsync(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), DataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxEdgeDevices", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Data Box Edge/Data Box Gateway devices in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices - /// - /// - /// Operation Id - /// Devices_ListBySubscription - /// - /// - /// - /// Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=<token> to populate the next page in the list. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataBoxEdgeDevices(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataBoxEdgeDeviceDevicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataBoxEdgeDeviceResource(Client, DataBoxEdgeDeviceData.DeserializeDataBoxEdgeDeviceData(e)), DataBoxEdgeDeviceDevicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataBoxEdgeDevices", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/MonitoringMetricConfigurationResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/MonitoringMetricConfigurationResource.cs index 5fb9b85de13fc..cffa9285cb037 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/MonitoringMetricConfigurationResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/MonitoringMetricConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataBoxEdge public partial class MonitoringMetricConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deviceName. + /// The roleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deviceName, string roleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default"; diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/Azure.ResourceManager.Datadog.sln b/sdk/datadog/Azure.ResourceManager.Datadog/Azure.ResourceManager.Datadog.sln index 59d50c6937884..629dcf142cfb9 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/Azure.ResourceManager.Datadog.sln +++ b/sdk/datadog/Azure.ResourceManager.Datadog/Azure.ResourceManager.Datadog.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{006774D1-C0AB-4497-BD2F-226BFFFCC67E}") = "Azure.ResourceManager.Datadog", "src\Azure.ResourceManager.Datadog.csproj", "{8A8AAF7C-2097-4D5F-BAC4-EE6D0177F567}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Datadog", "src\Azure.ResourceManager.Datadog.csproj", "{8A8AAF7C-2097-4D5F-BAC4-EE6D0177F567}" EndProject -Project("{006774D1-C0AB-4497-BD2F-226BFFFCC67E}") = "Azure.ResourceManager.Datadog.Tests", "tests\Azure.ResourceManager.Datadog.Tests.csproj", "{0D125F06-29CC-44A9-9429-596B49FFF3AD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Datadog.Tests", "tests\Azure.ResourceManager.Datadog.Tests.csproj", "{0D125F06-29CC-44A9-9429-596B49FFF3AD}" EndProject -Project("{006774D1-C0AB-4497-BD2F-226BFFFCC67E}") = "Azure.ResourceManager.Datadog.Samples", "samples\Azure.ResourceManager.Datadog.Samples.csproj", "{B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Datadog.Samples", "samples\Azure.ResourceManager.Datadog.Samples.csproj", "{B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {74A60FA6-D6E8-4765-ADFC-86B2E297F977} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {0D125F06-29CC-44A9-9429-596B49FFF3AD}.Release|x64.Build.0 = Release|Any CPU {0D125F06-29CC-44A9-9429-596B49FFF3AD}.Release|x86.ActiveCfg = Release|Any CPU {0D125F06-29CC-44A9-9429-596B49FFF3AD}.Release|x86.Build.0 = Release|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Debug|x64.ActiveCfg = Debug|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Debug|x64.Build.0 = Debug|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Debug|x86.ActiveCfg = Debug|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Debug|x86.Build.0 = Debug|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Release|Any CPU.Build.0 = Release|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Release|x64.ActiveCfg = Release|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Release|x64.Build.0 = Release|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Release|x86.ActiveCfg = Release|Any CPU + {B6C38073-2EAB-42D7-AB8F-CD015F4DD81A}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {74A60FA6-D6E8-4765-ADFC-86B2E297F977} EndGlobalSection EndGlobal diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/api/Azure.ResourceManager.Datadog.netstandard2.0.cs b/sdk/datadog/Azure.ResourceManager.Datadog/api/Azure.ResourceManager.Datadog.netstandard2.0.cs index 722f1b13e9d40..aae593494d61f 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/api/Azure.ResourceManager.Datadog.netstandard2.0.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/api/Azure.ResourceManager.Datadog.netstandard2.0.cs @@ -74,7 +74,7 @@ protected DatadogMonitorResourceCollection() { } } public partial class DatadogMonitorResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public DatadogMonitorResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DatadogMonitorResourceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Datadog.Models.MonitorProperties Properties { get { throw null; } set { } } public string SkuName { get { throw null; } set { } } @@ -148,6 +148,33 @@ protected MonitoringTagRuleResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Datadog.MonitoringTagRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Datadog.Mocking +{ + public partial class MockableDatadogArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDatadogArmClient() { } + public virtual Azure.ResourceManager.Datadog.DatadogMonitorResource GetDatadogMonitorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Datadog.DatadogSingleSignOnResource GetDatadogSingleSignOnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Datadog.MonitoringTagRuleResource GetMonitoringTagRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDatadogResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDatadogResourceGroupResource() { } + public virtual Azure.Response GetDatadogMonitorResource(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatadogMonitorResourceAsync(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Datadog.DatadogMonitorResourceCollection GetDatadogMonitorResources() { throw null; } + } + public partial class MockableDatadogSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDatadogSubscriptionResource() { } + public virtual Azure.Response CreateOrUpdateMarketplaceAgreement(Azure.ResourceManager.Datadog.Models.DatadogAgreementResourceProperties body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateMarketplaceAgreementAsync(Azure.ResourceManager.Datadog.Models.DatadogAgreementResourceProperties body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDatadogMonitorResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDatadogMonitorResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMarketplaceAgreements(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMarketplaceAgreementsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Datadog.Models { public static partial class ArmDatadogModelFactory diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs index af5992f12a297..a5e752b788756 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs @@ -31,6 +31,9 @@ namespace Azure.ResourceManager.Datadog public partial class DatadogMonitorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}"; @@ -96,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MonitoringTagRuleResources and their operations over a MonitoringTagRuleResource. public virtual MonitoringTagRuleCollection GetMonitoringTagRules() { - return GetCachedClient(Client => new MonitoringTagRuleCollection(Client, Id)); + return GetCachedClient(client => new MonitoringTagRuleCollection(client, Id)); } /// @@ -114,8 +117,8 @@ public virtual MonitoringTagRuleCollection GetMonitoringTagRules() /// /// Rule set name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMonitoringTagRuleAsync(string ruleSetName, CancellationToken cancellationToken = default) { @@ -137,8 +140,8 @@ public virtual async Task> GetMonitoringTagR /// /// Rule set name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMonitoringTagRule(string ruleSetName, CancellationToken cancellationToken = default) { @@ -149,7 +152,7 @@ public virtual Response GetMonitoringTagRule(string r /// An object representing collection of DatadogSingleSignOnResources and their operations over a DatadogSingleSignOnResource. public virtual DatadogSingleSignOnResourceCollection GetDatadogSingleSignOnResources() { - return GetCachedClient(Client => new DatadogSingleSignOnResourceCollection(Client, Id)); + return GetCachedClient(client => new DatadogSingleSignOnResourceCollection(client, Id)); } /// @@ -167,8 +170,8 @@ public virtual DatadogSingleSignOnResourceCollection GetDatadogSingleSignOnResou /// /// Configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDatadogSingleSignOnResourceAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -190,8 +193,8 @@ public virtual async Task> GetDatadogSingl /// /// Configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDatadogSingleSignOnResource(string configurationName, CancellationToken cancellationToken = default) { diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResource.cs index 65439390dfd94..56843b74760a9 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResource.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogSingleSignOnResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Datadog public partial class DatadogSingleSignOnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"; diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/DatadogExtensions.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/DatadogExtensions.cs index e82e409d33851..491b24f857686 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/DatadogExtensions.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/DatadogExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Datadog.Mocking; using Azure.ResourceManager.Datadog.Models; using Azure.ResourceManager.Resources; @@ -19,100 +20,81 @@ namespace Azure.ResourceManager.Datadog /// A class to add extension methods to Azure.ResourceManager.Datadog. public static partial class DatadogExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDatadogArmClient GetMockableDatadogArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDatadogArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDatadogResourceGroupResource GetMockableDatadogResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDatadogResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDatadogSubscriptionResource GetMockableDatadogSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDatadogSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DatadogMonitorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DatadogMonitorResource GetDatadogMonitorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DatadogMonitorResource.ValidateResourceId(id); - return new DatadogMonitorResource(client, id); - } - ); + return GetMockableDatadogArmClient(client).GetDatadogMonitorResource(id); } - #endregion - #region MonitoringTagRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MonitoringTagRuleResource GetMonitoringTagRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MonitoringTagRuleResource.ValidateResourceId(id); - return new MonitoringTagRuleResource(client, id); - } - ); + return GetMockableDatadogArmClient(client).GetMonitoringTagRuleResource(id); } - #endregion - #region DatadogSingleSignOnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DatadogSingleSignOnResource GetDatadogSingleSignOnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DatadogSingleSignOnResource.ValidateResourceId(id); - return new DatadogSingleSignOnResource(client, id); - } - ); + return GetMockableDatadogArmClient(client).GetDatadogSingleSignOnResource(id); } - #endregion - /// Gets a collection of DatadogMonitorResources in the ResourceGroupResource. + /// + /// Gets a collection of DatadogMonitorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DatadogMonitorResources and their operations over a DatadogMonitorResource. public static DatadogMonitorResourceCollection GetDatadogMonitorResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDatadogMonitorResources(); + return GetMockableDatadogResourceGroupResource(resourceGroupResource).GetDatadogMonitorResources(); } /// @@ -127,16 +109,20 @@ public static DatadogMonitorResourceCollection GetDatadogMonitorResources(this R /// Monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Monitor resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDatadogMonitorResourceAsync(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDatadogMonitorResources().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + return await GetMockableDatadogResourceGroupResource(resourceGroupResource).GetDatadogMonitorResourceAsync(monitorName, cancellationToken).ConfigureAwait(false); } /// @@ -151,16 +137,20 @@ public static async Task> GetDatadogMonitorReso /// Monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Monitor resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDatadogMonitorResource(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDatadogMonitorResources().Get(monitorName, cancellationToken); + return GetMockableDatadogResourceGroupResource(resourceGroupResource).GetDatadogMonitorResource(monitorName, cancellationToken); } /// @@ -175,13 +165,17 @@ public static Response GetDatadogMonitorResource(this Re /// MarketplaceAgreements_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMarketplaceAgreementsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMarketplaceAgreementsAsync(cancellationToken); + return GetMockableDatadogSubscriptionResource(subscriptionResource).GetMarketplaceAgreementsAsync(cancellationToken); } /// @@ -196,13 +190,17 @@ public static AsyncPageable GetMarketplaceAg /// MarketplaceAgreements_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMarketplaceAgreements(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMarketplaceAgreements(cancellationToken); + return GetMockableDatadogSubscriptionResource(subscriptionResource).GetMarketplaceAgreements(cancellationToken); } /// @@ -217,13 +215,17 @@ public static Pageable GetMarketplaceAgreeme /// MarketplaceAgreements_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The DatadogAgreementResourceProperties to use. /// The cancellation token to use. public static async Task> CreateOrUpdateMarketplaceAgreementAsync(this SubscriptionResource subscriptionResource, DatadogAgreementResourceProperties body = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CreateOrUpdateMarketplaceAgreementAsync(body, cancellationToken).ConfigureAwait(false); + return await GetMockableDatadogSubscriptionResource(subscriptionResource).CreateOrUpdateMarketplaceAgreementAsync(body, cancellationToken).ConfigureAwait(false); } /// @@ -238,13 +240,17 @@ public static async Task> CreateOrU /// MarketplaceAgreements_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The DatadogAgreementResourceProperties to use. /// The cancellation token to use. public static Response CreateOrUpdateMarketplaceAgreement(this SubscriptionResource subscriptionResource, DatadogAgreementResourceProperties body = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).CreateOrUpdateMarketplaceAgreement(body, cancellationToken); + return GetMockableDatadogSubscriptionResource(subscriptionResource).CreateOrUpdateMarketplaceAgreement(body, cancellationToken); } /// @@ -259,13 +265,17 @@ public static Response CreateOrUpdateMarketp /// Monitors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDatadogMonitorResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDatadogMonitorResourcesAsync(cancellationToken); + return GetMockableDatadogSubscriptionResource(subscriptionResource).GetDatadogMonitorResourcesAsync(cancellationToken); } /// @@ -280,13 +290,17 @@ public static AsyncPageable GetDatadogMonitorResourcesAs /// Monitors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDatadogMonitorResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDatadogMonitorResources(cancellationToken); + return GetMockableDatadogSubscriptionResource(subscriptionResource).GetDatadogMonitorResources(cancellationToken); } } } diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogArmClient.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogArmClient.cs new file mode 100644 index 0000000000000..3fb105a910f63 --- /dev/null +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Datadog; + +namespace Azure.ResourceManager.Datadog.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDatadogArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDatadogArmClient() + { + } + + /// 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 MockableDatadogArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDatadogArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DatadogMonitorResource GetDatadogMonitorResource(ResourceIdentifier id) + { + DatadogMonitorResource.ValidateResourceId(id); + return new DatadogMonitorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitoringTagRuleResource GetMonitoringTagRuleResource(ResourceIdentifier id) + { + MonitoringTagRuleResource.ValidateResourceId(id); + return new MonitoringTagRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DatadogSingleSignOnResource GetDatadogSingleSignOnResource(ResourceIdentifier id) + { + DatadogSingleSignOnResource.ValidateResourceId(id); + return new DatadogSingleSignOnResource(Client, id); + } + } +} diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogResourceGroupResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogResourceGroupResource.cs new file mode 100644 index 0000000000000..4b85cb6617978 --- /dev/null +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Datadog; + +namespace Azure.ResourceManager.Datadog.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDatadogResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDatadogResourceGroupResource() + { + } + + /// 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 MockableDatadogResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DatadogMonitorResources in the ResourceGroupResource. + /// An object representing collection of DatadogMonitorResources and their operations over a DatadogMonitorResource. + public virtual DatadogMonitorResourceCollection GetDatadogMonitorResources() + { + return GetCachedClient(client => new DatadogMonitorResourceCollection(client, Id)); + } + + /// + /// Get the properties of a specific monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatadogMonitorResourceAsync(string monitorName, CancellationToken cancellationToken = default) + { + return await GetDatadogMonitorResources().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a specific monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatadogMonitorResource(string monitorName, CancellationToken cancellationToken = default) + { + return GetDatadogMonitorResources().Get(monitorName, cancellationToken); + } + } +} diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogSubscriptionResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogSubscriptionResource.cs new file mode 100644 index 0000000000000..33af002a1e5e5 --- /dev/null +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/MockableDatadogSubscriptionResource.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Datadog; +using Azure.ResourceManager.Datadog.Models; + +namespace Azure.ResourceManager.Datadog.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDatadogSubscriptionResource : ArmResource + { + private ClientDiagnostics _marketplaceAgreementsClientDiagnostics; + private MarketplaceAgreementsRestOperations _marketplaceAgreementsRestClient; + private ClientDiagnostics _datadogMonitorResourceMonitorsClientDiagnostics; + private MonitorsRestOperations _datadogMonitorResourceMonitorsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDatadogSubscriptionResource() + { + } + + /// 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 MockableDatadogSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MarketplaceAgreementsClientDiagnostics => _marketplaceAgreementsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Datadog", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MarketplaceAgreementsRestOperations MarketplaceAgreementsRestClient => _marketplaceAgreementsRestClient ??= new MarketplaceAgreementsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DatadogMonitorResourceMonitorsClientDiagnostics => _datadogMonitorResourceMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Datadog", DatadogMonitorResource.ResourceType.Namespace, Diagnostics); + private MonitorsRestOperations DatadogMonitorResourceMonitorsRestClient => _datadogMonitorResourceMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DatadogMonitorResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Datadog marketplace agreements in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements + /// + /// + /// Operation Id + /// MarketplaceAgreements_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMarketplaceAgreementsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplaceAgreementsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplaceAgreementsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DatadogAgreementResourceProperties.DeserializeDatadogAgreementResourceProperties, MarketplaceAgreementsClientDiagnostics, Pipeline, "MockableDatadogSubscriptionResource.GetMarketplaceAgreements", "value", "nextLink", cancellationToken); + } + + /// + /// List Datadog marketplace agreements in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements + /// + /// + /// Operation Id + /// MarketplaceAgreements_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMarketplaceAgreements(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplaceAgreementsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplaceAgreementsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DatadogAgreementResourceProperties.DeserializeDatadogAgreementResourceProperties, MarketplaceAgreementsClientDiagnostics, Pipeline, "MockableDatadogSubscriptionResource.GetMarketplaceAgreements", "value", "nextLink", cancellationToken); + } + + /// + /// Create Datadog marketplace agreement in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default + /// + /// + /// Operation Id + /// MarketplaceAgreements_CreateOrUpdate + /// + /// + /// + /// The DatadogAgreementResourceProperties to use. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateMarketplaceAgreementAsync(DatadogAgreementResourceProperties body = null, CancellationToken cancellationToken = default) + { + using var scope = MarketplaceAgreementsClientDiagnostics.CreateScope("MockableDatadogSubscriptionResource.CreateOrUpdateMarketplaceAgreement"); + scope.Start(); + try + { + var response = await MarketplaceAgreementsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create Datadog marketplace agreement in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default + /// + /// + /// Operation Id + /// MarketplaceAgreements_CreateOrUpdate + /// + /// + /// + /// The DatadogAgreementResourceProperties to use. + /// The cancellation token to use. + public virtual Response CreateOrUpdateMarketplaceAgreement(DatadogAgreementResourceProperties body = null, CancellationToken cancellationToken = default) + { + using var scope = MarketplaceAgreementsClientDiagnostics.CreateScope("MockableDatadogSubscriptionResource.CreateOrUpdateMarketplaceAgreement"); + scope.Start(); + try + { + var response = MarketplaceAgreementsRestClient.CreateOrUpdate(Id.SubscriptionId, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all monitors under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors + /// + /// + /// Operation Id + /// Monitors_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatadogMonitorResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DatadogMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatadogMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), DatadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "MockableDatadogSubscriptionResource.GetDatadogMonitorResources", "value", "nextLink", cancellationToken); + } + + /// + /// List all monitors under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors + /// + /// + /// Operation Id + /// Monitors_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatadogMonitorResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DatadogMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatadogMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), DatadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "MockableDatadogSubscriptionResource.GetDatadogMonitorResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index a928814494d52..0000000000000 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Datadog -{ - /// 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 DatadogMonitorResources in the ResourceGroupResource. - /// An object representing collection of DatadogMonitorResources and their operations over a DatadogMonitorResource. - public virtual DatadogMonitorResourceCollection GetDatadogMonitorResources() - { - return GetCachedClient(Client => new DatadogMonitorResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index f9440815f165d..0000000000000 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Datadog.Models; - -namespace Azure.ResourceManager.Datadog -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _marketplaceAgreementsClientDiagnostics; - private MarketplaceAgreementsRestOperations _marketplaceAgreementsRestClient; - private ClientDiagnostics _datadogMonitorResourceMonitorsClientDiagnostics; - private MonitorsRestOperations _datadogMonitorResourceMonitorsRestClient; - - /// 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 MarketplaceAgreementsClientDiagnostics => _marketplaceAgreementsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Datadog", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MarketplaceAgreementsRestOperations MarketplaceAgreementsRestClient => _marketplaceAgreementsRestClient ??= new MarketplaceAgreementsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DatadogMonitorResourceMonitorsClientDiagnostics => _datadogMonitorResourceMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Datadog", DatadogMonitorResource.ResourceType.Namespace, Diagnostics); - private MonitorsRestOperations DatadogMonitorResourceMonitorsRestClient => _datadogMonitorResourceMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DatadogMonitorResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List Datadog marketplace agreements in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements - /// - /// - /// Operation Id - /// MarketplaceAgreements_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMarketplaceAgreementsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplaceAgreementsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplaceAgreementsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DatadogAgreementResourceProperties.DeserializeDatadogAgreementResourceProperties, MarketplaceAgreementsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMarketplaceAgreements", "value", "nextLink", cancellationToken); - } - - /// - /// List Datadog marketplace agreements in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements - /// - /// - /// Operation Id - /// MarketplaceAgreements_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMarketplaceAgreements(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MarketplaceAgreementsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MarketplaceAgreementsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DatadogAgreementResourceProperties.DeserializeDatadogAgreementResourceProperties, MarketplaceAgreementsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMarketplaceAgreements", "value", "nextLink", cancellationToken); - } - - /// - /// Create Datadog marketplace agreement in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default - /// - /// - /// Operation Id - /// MarketplaceAgreements_CreateOrUpdate - /// - /// - /// - /// The DatadogAgreementResourceProperties to use. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateMarketplaceAgreementAsync(DatadogAgreementResourceProperties body = null, CancellationToken cancellationToken = default) - { - using var scope = MarketplaceAgreementsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateOrUpdateMarketplaceAgreement"); - scope.Start(); - try - { - var response = await MarketplaceAgreementsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create Datadog marketplace agreement in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default - /// - /// - /// Operation Id - /// MarketplaceAgreements_CreateOrUpdate - /// - /// - /// - /// The DatadogAgreementResourceProperties to use. - /// The cancellation token to use. - public virtual Response CreateOrUpdateMarketplaceAgreement(DatadogAgreementResourceProperties body = null, CancellationToken cancellationToken = default) - { - using var scope = MarketplaceAgreementsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateOrUpdateMarketplaceAgreement"); - scope.Start(); - try - { - var response = MarketplaceAgreementsRestClient.CreateOrUpdate(Id.SubscriptionId, body, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all monitors under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors - /// - /// - /// Operation Id - /// Monitors_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDatadogMonitorResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DatadogMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatadogMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), DatadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDatadogMonitorResources", "value", "nextLink", cancellationToken); - } - - /// - /// List all monitors under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors - /// - /// - /// Operation Id - /// Monitors_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDatadogMonitorResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DatadogMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatadogMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatadogMonitorResource(Client, DatadogMonitorResourceData.DeserializeDatadogMonitorResourceData(e)), DatadogMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDatadogMonitorResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleResource.cs index 91eba2bfa9096..b54179abf61ec 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleResource.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/MonitoringTagRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Datadog public partial class MonitoringTagRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. + /// The ruleSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/api/Azure.ResourceManager.DataFactory.netstandard2.0.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/api/Azure.ResourceManager.DataFactory.netstandard2.0.cs index d57c90b45d607..2aaa00445ead5 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/api/Azure.ResourceManager.DataFactory.netstandard2.0.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/api/Azure.ResourceManager.DataFactory.netstandard2.0.cs @@ -69,7 +69,7 @@ protected DataFactoryCollection() { } } public partial class DataFactoryData : Azure.ResourceManager.Models.TrackedResourceData { - public DataFactoryData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DataFactoryData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IDictionary AdditionalProperties { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.DataFactory.Models.DataFactoryEncryptionConfiguration Encryption { get { throw null; } set { } } @@ -662,6 +662,43 @@ protected DataFactoryTriggerResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DataFactory.DataFactoryTriggerData data, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DataFactory.Mocking +{ + public partial class MockableDataFactoryArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDataFactoryArmClient() { } + public virtual Azure.ResourceManager.DataFactory.DataFactoryChangeDataCaptureResource GetDataFactoryChangeDataCaptureResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryDataFlowResource GetDataFactoryDataFlowResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryDatasetResource GetDataFactoryDatasetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryGlobalParameterResource GetDataFactoryGlobalParameterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryIntegrationRuntimeResource GetDataFactoryIntegrationRuntimeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryLinkedServiceResource GetDataFactoryLinkedServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryManagedIdentityCredentialResource GetDataFactoryManagedIdentityCredentialResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryManagedVirtualNetworkResource GetDataFactoryManagedVirtualNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryPipelineResource GetDataFactoryPipelineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryPrivateEndpointConnectionResource GetDataFactoryPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryPrivateEndpointResource GetDataFactoryPrivateEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryResource GetDataFactoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataFactory.DataFactoryTriggerResource GetDataFactoryTriggerResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDataFactoryResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDataFactoryResourceGroupResource() { } + public virtual Azure.ResourceManager.DataFactory.DataFactoryCollection GetDataFactories() { throw null; } + public virtual Azure.Response GetDataFactory(string factoryName, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataFactoryAsync(string factoryName, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableDataFactorySubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDataFactorySubscriptionResource() { } + public virtual Azure.Response ConfigureFactoryRepoInformation(Azure.Core.AzureLocation locationId, Azure.ResourceManager.DataFactory.Models.FactoryRepoContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ConfigureFactoryRepoInformationAsync(Azure.Core.AzureLocation locationId, Azure.ResourceManager.DataFactory.Models.FactoryRepoContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataFactories(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataFactoriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetFeatureValueExposureControl(Azure.Core.AzureLocation locationId, Azure.ResourceManager.DataFactory.Models.ExposureControlContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFeatureValueExposureControlAsync(Azure.Core.AzureLocation locationId, Azure.ResourceManager.DataFactory.Models.ExposureControlContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DataFactory.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/assets.json b/sdk/datafactory/Azure.ResourceManager.DataFactory/assets.json index cf0ae51bf6076..77afac9658265 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/assets.json +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/datafactory/Azure.ResourceManager.DataFactory", - "Tag": "net/datafactory/Azure.ResourceManager.DataFactory_29e4fb3644" + "Tag": "net/datafactory/Azure.ResourceManager.DataFactory_2ffeead585" } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureResource.cs index 14e6140cd7dd9..a31398227ba03 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryChangeDataCaptureResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryChangeDataCaptureResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The changeDataCaptureName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string changeDataCaptureName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowResource.cs index 58178a2062911..919c240020534 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDataFlowResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryDataFlowResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The dataFlowName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string dataFlowName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/dataflows/{dataFlowName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetResource.cs index 2083a2576c692..c8f7e4d8711ce 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryDatasetResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryDatasetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The datasetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string datasetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterResource.cs index 95fed7ef7bc64..492fab2d846aa 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryGlobalParameterResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryGlobalParameterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The globalParameterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string globalParameterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/globalParameters/{globalParameterName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeResource.cs index fc2e3bee8b14c..7da7af98ae3bf 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryIntegrationRuntimeResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryIntegrationRuntimeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The integrationRuntimeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string integrationRuntimeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceResource.cs index 7973e8631c591..81919b487b2d7 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryLinkedServiceResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryLinkedServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The linkedServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string linkedServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialResource.cs index 06827e3804665..ff012225adbfd 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedIdentityCredentialResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryManagedIdentityCredentialResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The credentialName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string credentialName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/credentials/{credentialName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkResource.cs index b901315d94b09..555a43566aa35 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryManagedVirtualNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The managedVirtualNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string managedVirtualNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataFactoryPrivateEndpointResources and their operations over a DataFactoryPrivateEndpointResource. public virtual DataFactoryPrivateEndpointCollection GetDataFactoryPrivateEndpoints() { - return GetCachedClient(Client => new DataFactoryPrivateEndpointCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryPrivateEndpointCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual DataFactoryPrivateEndpointCollection GetDataFactoryPrivateEndpoin /// Managed private endpoint name. /// ETag of the managed private endpoint entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryPrivateEndpointAsync(string managedPrivateEndpointName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetDataF /// Managed private endpoint name. /// ETag of the managed private endpoint entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryPrivateEndpoint(string managedPrivateEndpointName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineResource.cs index 7579f4a12ccbe..b4b16b8d3c8e1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPipelineResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryPipelineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The pipelineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string pipelineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionResource.cs index 918da0bca6da9..1e029d0750261 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointResource.cs index 3d8a0bc7a4ee4..7c872a710ee89 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryPrivateEndpointResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryPrivateEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The managedVirtualNetworkName. + /// The managedPrivateEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string managedVirtualNetworkName, string managedPrivateEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs index 54a373e150cbb..01a0c12d9505b 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}"; @@ -123,7 +126,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataFactoryIntegrationRuntimeResources and their operations over a DataFactoryIntegrationRuntimeResource. public virtual DataFactoryIntegrationRuntimeCollection GetDataFactoryIntegrationRuntimes() { - return GetCachedClient(Client => new DataFactoryIntegrationRuntimeCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryIntegrationRuntimeCollection(client, Id)); } /// @@ -142,8 +145,8 @@ public virtual DataFactoryIntegrationRuntimeCollection GetDataFactoryIntegration /// The integration runtime name. /// ETag of the integration runtime entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryIntegrationRuntimeAsync(string integrationRuntimeName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -166,8 +169,8 @@ public virtual async Task> GetDa /// The integration runtime name. /// ETag of the integration runtime entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryIntegrationRuntime(string integrationRuntimeName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -178,7 +181,7 @@ public virtual Response GetDataFactoryInt /// An object representing collection of DataFactoryLinkedServiceResources and their operations over a DataFactoryLinkedServiceResource. public virtual DataFactoryLinkedServiceCollection GetDataFactoryLinkedServices() { - return GetCachedClient(Client => new DataFactoryLinkedServiceCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryLinkedServiceCollection(client, Id)); } /// @@ -197,8 +200,8 @@ public virtual DataFactoryLinkedServiceCollection GetDataFactoryLinkedServices() /// The linked service name. /// ETag of the linked service entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryLinkedServiceAsync(string linkedServiceName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -221,8 +224,8 @@ public virtual async Task> GetDataFac /// The linked service name. /// ETag of the linked service entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryLinkedService(string linkedServiceName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -233,7 +236,7 @@ public virtual Response GetDataFactoryLinkedSe /// An object representing collection of DataFactoryDatasetResources and their operations over a DataFactoryDatasetResource. public virtual DataFactoryDatasetCollection GetDataFactoryDatasets() { - return GetCachedClient(Client => new DataFactoryDatasetCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryDatasetCollection(client, Id)); } /// @@ -252,8 +255,8 @@ public virtual DataFactoryDatasetCollection GetDataFactoryDatasets() /// The dataset name. /// ETag of the dataset entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryDatasetAsync(string datasetName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -276,8 +279,8 @@ public virtual async Task> GetDataFactoryDa /// The dataset name. /// ETag of the dataset entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryDataset(string datasetName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -288,7 +291,7 @@ public virtual Response GetDataFactoryDataset(string /// An object representing collection of DataFactoryPipelineResources and their operations over a DataFactoryPipelineResource. public virtual DataFactoryPipelineCollection GetDataFactoryPipelines() { - return GetCachedClient(Client => new DataFactoryPipelineCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryPipelineCollection(client, Id)); } /// @@ -307,8 +310,8 @@ public virtual DataFactoryPipelineCollection GetDataFactoryPipelines() /// The pipeline name. /// ETag of the pipeline entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryPipelineAsync(string pipelineName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -331,8 +334,8 @@ public virtual async Task> GetDataFactoryP /// The pipeline name. /// ETag of the pipeline entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryPipeline(string pipelineName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -343,7 +346,7 @@ public virtual Response GetDataFactoryPipeline(stri /// An object representing collection of DataFactoryTriggerResources and their operations over a DataFactoryTriggerResource. public virtual DataFactoryTriggerCollection GetDataFactoryTriggers() { - return GetCachedClient(Client => new DataFactoryTriggerCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryTriggerCollection(client, Id)); } /// @@ -362,8 +365,8 @@ public virtual DataFactoryTriggerCollection GetDataFactoryTriggers() /// The trigger name. /// ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryTriggerAsync(string triggerName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -386,8 +389,8 @@ public virtual async Task> GetDataFactoryTr /// The trigger name. /// ETag of the trigger entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryTrigger(string triggerName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -398,7 +401,7 @@ public virtual Response GetDataFactoryTrigger(string /// An object representing collection of DataFactoryDataFlowResources and their operations over a DataFactoryDataFlowResource. public virtual DataFactoryDataFlowCollection GetDataFactoryDataFlows() { - return GetCachedClient(Client => new DataFactoryDataFlowCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryDataFlowCollection(client, Id)); } /// @@ -417,8 +420,8 @@ public virtual DataFactoryDataFlowCollection GetDataFactoryDataFlows() /// The data flow name. /// ETag of the data flow entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryDataFlowAsync(string dataFlowName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -441,8 +444,8 @@ public virtual async Task> GetDataFactoryD /// The data flow name. /// ETag of the data flow entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryDataFlow(string dataFlowName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -453,7 +456,7 @@ public virtual Response GetDataFactoryDataFlow(stri /// An object representing collection of DataFactoryManagedVirtualNetworkResources and their operations over a DataFactoryManagedVirtualNetworkResource. public virtual DataFactoryManagedVirtualNetworkCollection GetDataFactoryManagedVirtualNetworks() { - return GetCachedClient(Client => new DataFactoryManagedVirtualNetworkCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryManagedVirtualNetworkCollection(client, Id)); } /// @@ -472,8 +475,8 @@ public virtual DataFactoryManagedVirtualNetworkCollection GetDataFactoryManagedV /// Managed virtual network name. /// ETag of the managed Virtual Network entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryManagedVirtualNetworkAsync(string managedVirtualNetworkName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -496,8 +499,8 @@ public virtual async Task> Ge /// Managed virtual network name. /// ETag of the managed Virtual Network entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryManagedVirtualNetwork(string managedVirtualNetworkName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -508,7 +511,7 @@ public virtual Response GetDataFactory /// An object representing collection of DataFactoryManagedIdentityCredentialResources and their operations over a DataFactoryManagedIdentityCredentialResource. public virtual DataFactoryManagedIdentityCredentialCollection GetDataFactoryManagedIdentityCredentials() { - return GetCachedClient(Client => new DataFactoryManagedIdentityCredentialCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryManagedIdentityCredentialCollection(client, Id)); } /// @@ -527,8 +530,8 @@ public virtual DataFactoryManagedIdentityCredentialCollection GetDataFactoryMana /// Credential name. /// ETag of the credential entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryManagedIdentityCredentialAsync(string credentialName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -551,8 +554,8 @@ public virtual async Task /// Credential name. /// ETag of the credential entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryManagedIdentityCredential(string credentialName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -563,7 +566,7 @@ public virtual Response GetDataFac /// An object representing collection of DataFactoryPrivateEndpointConnectionResources and their operations over a DataFactoryPrivateEndpointConnectionResource. public virtual DataFactoryPrivateEndpointConnectionCollection GetDataFactoryPrivateEndpointConnections() { - return GetCachedClient(Client => new DataFactoryPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryPrivateEndpointConnectionCollection(client, Id)); } /// @@ -582,8 +585,8 @@ public virtual DataFactoryPrivateEndpointConnectionCollection GetDataFactoryPriv /// The private endpoint connection name. /// ETag of the private endpoint connection entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryPrivateEndpointConnectionAsync(string privateEndpointConnectionName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -606,8 +609,8 @@ public virtual async Task /// The private endpoint connection name. /// ETag of the private endpoint connection entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryPrivateEndpointConnection(string privateEndpointConnectionName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -618,7 +621,7 @@ public virtual Response GetDataFac /// An object representing collection of DataFactoryGlobalParameterResources and their operations over a DataFactoryGlobalParameterResource. public virtual DataFactoryGlobalParameterCollection GetDataFactoryGlobalParameters() { - return GetCachedClient(Client => new DataFactoryGlobalParameterCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryGlobalParameterCollection(client, Id)); } /// @@ -636,8 +639,8 @@ public virtual DataFactoryGlobalParameterCollection GetDataFactoryGlobalParamete /// /// The global parameter name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryGlobalParameterAsync(string globalParameterName, CancellationToken cancellationToken = default) { @@ -659,8 +662,8 @@ public virtual async Task> GetDataF /// /// The global parameter name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryGlobalParameter(string globalParameterName, CancellationToken cancellationToken = default) { @@ -671,7 +674,7 @@ public virtual Response GetDataFactoryGlobal /// An object representing collection of DataFactoryChangeDataCaptureResources and their operations over a DataFactoryChangeDataCaptureResource. public virtual DataFactoryChangeDataCaptureCollection GetDataFactoryChangeDataCaptures() { - return GetCachedClient(Client => new DataFactoryChangeDataCaptureCollection(Client, Id)); + return GetCachedClient(client => new DataFactoryChangeDataCaptureCollection(client, Id)); } /// @@ -690,8 +693,8 @@ public virtual DataFactoryChangeDataCaptureCollection GetDataFactoryChangeDataCa /// The change data capture name. /// ETag of the change data capture entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataFactoryChangeDataCaptureAsync(string changeDataCaptureName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -714,8 +717,8 @@ public virtual async Task> GetDat /// The change data capture name. /// ETag of the change data capture entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataFactoryChangeDataCapture(string changeDataCaptureName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerResource.cs index 8021927f7cd25..636d38025a277 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryTriggerResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataFactory public partial class DataFactoryTriggerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The factoryName. + /// The triggerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string factoryName, string triggerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}"; diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/DataFactoryExtensions.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/DataFactoryExtensions.cs index 40984d0ff8c93..fa093338c1548 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/DataFactoryExtensions.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/DataFactoryExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DataFactory.Mocking; using Azure.ResourceManager.DataFactory.Models; using Azure.ResourceManager.Resources; @@ -19,290 +20,241 @@ namespace Azure.ResourceManager.DataFactory /// A class to add extension methods to Azure.ResourceManager.DataFactory. public static partial class DataFactoryExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDataFactoryArmClient GetMockableDataFactoryArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDataFactoryArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataFactoryResourceGroupResource GetMockableDataFactoryResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataFactoryResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDataFactorySubscriptionResource GetMockableDataFactorySubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDataFactorySubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataFactoryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryResource GetDataFactoryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryResource.ValidateResourceId(id); - return new DataFactoryResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryResource(id); } - #endregion - #region DataFactoryIntegrationRuntimeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryIntegrationRuntimeResource GetDataFactoryIntegrationRuntimeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryIntegrationRuntimeResource.ValidateResourceId(id); - return new DataFactoryIntegrationRuntimeResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryIntegrationRuntimeResource(id); } - #endregion - #region DataFactoryLinkedServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryLinkedServiceResource GetDataFactoryLinkedServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryLinkedServiceResource.ValidateResourceId(id); - return new DataFactoryLinkedServiceResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryLinkedServiceResource(id); } - #endregion - #region DataFactoryDatasetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryDatasetResource GetDataFactoryDatasetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryDatasetResource.ValidateResourceId(id); - return new DataFactoryDatasetResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryDatasetResource(id); } - #endregion - #region DataFactoryPipelineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryPipelineResource GetDataFactoryPipelineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryPipelineResource.ValidateResourceId(id); - return new DataFactoryPipelineResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryPipelineResource(id); } - #endregion - #region DataFactoryTriggerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryTriggerResource GetDataFactoryTriggerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryTriggerResource.ValidateResourceId(id); - return new DataFactoryTriggerResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryTriggerResource(id); } - #endregion - #region DataFactoryDataFlowResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryDataFlowResource GetDataFactoryDataFlowResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryDataFlowResource.ValidateResourceId(id); - return new DataFactoryDataFlowResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryDataFlowResource(id); } - #endregion - #region DataFactoryManagedVirtualNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryManagedVirtualNetworkResource GetDataFactoryManagedVirtualNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryManagedVirtualNetworkResource.ValidateResourceId(id); - return new DataFactoryManagedVirtualNetworkResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryManagedVirtualNetworkResource(id); } - #endregion - #region DataFactoryPrivateEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryPrivateEndpointResource GetDataFactoryPrivateEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryPrivateEndpointResource.ValidateResourceId(id); - return new DataFactoryPrivateEndpointResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryPrivateEndpointResource(id); } - #endregion - #region DataFactoryManagedIdentityCredentialResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryManagedIdentityCredentialResource GetDataFactoryManagedIdentityCredentialResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryManagedIdentityCredentialResource.ValidateResourceId(id); - return new DataFactoryManagedIdentityCredentialResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryManagedIdentityCredentialResource(id); } - #endregion - #region DataFactoryPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryPrivateEndpointConnectionResource GetDataFactoryPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryPrivateEndpointConnectionResource.ValidateResourceId(id); - return new DataFactoryPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryPrivateEndpointConnectionResource(id); } - #endregion - #region DataFactoryGlobalParameterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryGlobalParameterResource GetDataFactoryGlobalParameterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryGlobalParameterResource.ValidateResourceId(id); - return new DataFactoryGlobalParameterResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryGlobalParameterResource(id); } - #endregion - #region DataFactoryChangeDataCaptureResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataFactoryChangeDataCaptureResource GetDataFactoryChangeDataCaptureResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataFactoryChangeDataCaptureResource.ValidateResourceId(id); - return new DataFactoryChangeDataCaptureResource(client, id); - } - ); + return GetMockableDataFactoryArmClient(client).GetDataFactoryChangeDataCaptureResource(id); } - #endregion - /// Gets a collection of DataFactoryResources in the ResourceGroupResource. + /// + /// Gets a collection of DataFactoryResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataFactoryResources and their operations over a DataFactoryResource. public static DataFactoryCollection GetDataFactories(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataFactories(); + return GetMockableDataFactoryResourceGroupResource(resourceGroupResource).GetDataFactories(); } /// @@ -317,17 +269,21 @@ public static DataFactoryCollection GetDataFactories(this ResourceGroupResource /// Factories_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The factory name. /// ETag of the factory entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataFactoryAsync(this ResourceGroupResource resourceGroupResource, string factoryName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataFactories().GetAsync(factoryName, ifNoneMatch, cancellationToken).ConfigureAwait(false); + return await GetMockableDataFactoryResourceGroupResource(resourceGroupResource).GetDataFactoryAsync(factoryName, ifNoneMatch, cancellationToken).ConfigureAwait(false); } /// @@ -342,17 +298,21 @@ public static async Task> GetDataFactoryAsync(this /// Factories_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The factory name. /// ETag of the factory entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataFactory(this ResourceGroupResource resourceGroupResource, string factoryName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataFactories().Get(factoryName, ifNoneMatch, cancellationToken); + return GetMockableDataFactoryResourceGroupResource(resourceGroupResource).GetDataFactory(factoryName, ifNoneMatch, cancellationToken); } /// @@ -367,13 +327,17 @@ public static Response GetDataFactory(this ResourceGroupRes /// Factories_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataFactoriesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataFactoriesAsync(cancellationToken); + return GetMockableDataFactorySubscriptionResource(subscriptionResource).GetDataFactoriesAsync(cancellationToken); } /// @@ -388,13 +352,17 @@ public static AsyncPageable GetDataFactoriesAsync(this Subs /// Factories_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataFactories(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataFactories(cancellationToken); + return GetMockableDataFactorySubscriptionResource(subscriptionResource).GetDataFactories(cancellationToken); } /// @@ -409,6 +377,10 @@ public static Pageable GetDataFactories(this SubscriptionRe /// Factories_ConfigureFactoryRepo /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location identifier. @@ -417,9 +389,7 @@ public static Pageable GetDataFactories(this SubscriptionRe /// is null. public static async Task> ConfigureFactoryRepoInformationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationId, FactoryRepoContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ConfigureFactoryRepoInformationAsync(locationId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataFactorySubscriptionResource(subscriptionResource).ConfigureFactoryRepoInformationAsync(locationId, content, cancellationToken).ConfigureAwait(false); } /// @@ -434,6 +404,10 @@ public static async Task> ConfigureFactoryRepoInfo /// Factories_ConfigureFactoryRepo /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location identifier. @@ -442,9 +416,7 @@ public static async Task> ConfigureFactoryRepoInfo /// is null. public static Response ConfigureFactoryRepoInformation(this SubscriptionResource subscriptionResource, AzureLocation locationId, FactoryRepoContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ConfigureFactoryRepoInformation(locationId, content, cancellationToken); + return GetMockableDataFactorySubscriptionResource(subscriptionResource).ConfigureFactoryRepoInformation(locationId, content, cancellationToken); } /// @@ -459,6 +431,10 @@ public static Response ConfigureFactoryRepoInformation(this /// ExposureControl_GetFeatureValue /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location identifier. @@ -467,9 +443,7 @@ public static Response ConfigureFactoryRepoInformation(this /// is null. public static async Task> GetFeatureValueExposureControlAsync(this SubscriptionResource subscriptionResource, AzureLocation locationId, ExposureControlContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetFeatureValueExposureControlAsync(locationId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataFactorySubscriptionResource(subscriptionResource).GetFeatureValueExposureControlAsync(locationId, content, cancellationToken).ConfigureAwait(false); } /// @@ -484,6 +458,10 @@ public static async Task> GetFeatureValueExposur /// ExposureControl_GetFeatureValue /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location identifier. @@ -492,9 +470,7 @@ public static async Task> GetFeatureValueExposur /// is null. public static Response GetFeatureValueExposureControl(this SubscriptionResource subscriptionResource, AzureLocation locationId, ExposureControlContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFeatureValueExposureControl(locationId, content, cancellationToken); + return GetMockableDataFactorySubscriptionResource(subscriptionResource).GetFeatureValueExposureControl(locationId, content, cancellationToken); } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactoryArmClient.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactoryArmClient.cs new file mode 100644 index 0000000000000..b01040efabbdb --- /dev/null +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactoryArmClient.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DataFactory; + +namespace Azure.ResourceManager.DataFactory.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDataFactoryArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataFactoryArmClient() + { + } + + /// 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 MockableDataFactoryArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDataFactoryArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryResource GetDataFactoryResource(ResourceIdentifier id) + { + DataFactoryResource.ValidateResourceId(id); + return new DataFactoryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryIntegrationRuntimeResource GetDataFactoryIntegrationRuntimeResource(ResourceIdentifier id) + { + DataFactoryIntegrationRuntimeResource.ValidateResourceId(id); + return new DataFactoryIntegrationRuntimeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryLinkedServiceResource GetDataFactoryLinkedServiceResource(ResourceIdentifier id) + { + DataFactoryLinkedServiceResource.ValidateResourceId(id); + return new DataFactoryLinkedServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryDatasetResource GetDataFactoryDatasetResource(ResourceIdentifier id) + { + DataFactoryDatasetResource.ValidateResourceId(id); + return new DataFactoryDatasetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryPipelineResource GetDataFactoryPipelineResource(ResourceIdentifier id) + { + DataFactoryPipelineResource.ValidateResourceId(id); + return new DataFactoryPipelineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryTriggerResource GetDataFactoryTriggerResource(ResourceIdentifier id) + { + DataFactoryTriggerResource.ValidateResourceId(id); + return new DataFactoryTriggerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryDataFlowResource GetDataFactoryDataFlowResource(ResourceIdentifier id) + { + DataFactoryDataFlowResource.ValidateResourceId(id); + return new DataFactoryDataFlowResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryManagedVirtualNetworkResource GetDataFactoryManagedVirtualNetworkResource(ResourceIdentifier id) + { + DataFactoryManagedVirtualNetworkResource.ValidateResourceId(id); + return new DataFactoryManagedVirtualNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryPrivateEndpointResource GetDataFactoryPrivateEndpointResource(ResourceIdentifier id) + { + DataFactoryPrivateEndpointResource.ValidateResourceId(id); + return new DataFactoryPrivateEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryManagedIdentityCredentialResource GetDataFactoryManagedIdentityCredentialResource(ResourceIdentifier id) + { + DataFactoryManagedIdentityCredentialResource.ValidateResourceId(id); + return new DataFactoryManagedIdentityCredentialResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryPrivateEndpointConnectionResource GetDataFactoryPrivateEndpointConnectionResource(ResourceIdentifier id) + { + DataFactoryPrivateEndpointConnectionResource.ValidateResourceId(id); + return new DataFactoryPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryGlobalParameterResource GetDataFactoryGlobalParameterResource(ResourceIdentifier id) + { + DataFactoryGlobalParameterResource.ValidateResourceId(id); + return new DataFactoryGlobalParameterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataFactoryChangeDataCaptureResource GetDataFactoryChangeDataCaptureResource(ResourceIdentifier id) + { + DataFactoryChangeDataCaptureResource.ValidateResourceId(id); + return new DataFactoryChangeDataCaptureResource(Client, id); + } + } +} diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactoryResourceGroupResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactoryResourceGroupResource.cs new file mode 100644 index 0000000000000..b7fedf8c8b7b3 --- /dev/null +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactoryResourceGroupResource.cs @@ -0,0 +1,94 @@ +// 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.DataFactory; + +namespace Azure.ResourceManager.DataFactory.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDataFactoryResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataFactoryResourceGroupResource() + { + } + + /// 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 MockableDataFactoryResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataFactoryResources in the ResourceGroupResource. + /// An object representing collection of DataFactoryResources and their operations over a DataFactoryResource. + public virtual DataFactoryCollection GetDataFactories() + { + return GetCachedClient(client => new DataFactoryCollection(client, Id)); + } + + /// + /// Gets a factory. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName} + /// + /// + /// Operation Id + /// Factories_Get + /// + /// + /// + /// The factory name. + /// ETag of the factory entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataFactoryAsync(string factoryName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + return await GetDataFactories().GetAsync(factoryName, ifNoneMatch, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a factory. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName} + /// + /// + /// Operation Id + /// Factories_Get + /// + /// + /// + /// The factory name. + /// ETag of the factory entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataFactory(string factoryName, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + return GetDataFactories().Get(factoryName, ifNoneMatch, cancellationToken); + } + } +} diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactorySubscriptionResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactorySubscriptionResource.cs new file mode 100644 index 0000000000000..78f3ca100a528 --- /dev/null +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/MockableDataFactorySubscriptionResource.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataFactory; +using Azure.ResourceManager.DataFactory.Models; + +namespace Azure.ResourceManager.DataFactory.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDataFactorySubscriptionResource : ArmResource + { + private ClientDiagnostics _dataFactoryFactoriesClientDiagnostics; + private FactoriesRestOperations _dataFactoryFactoriesRestClient; + private ClientDiagnostics _exposureControlClientDiagnostics; + private ExposureControlRestOperations _exposureControlRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataFactorySubscriptionResource() + { + } + + /// 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 MockableDataFactorySubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataFactoryFactoriesClientDiagnostics => _dataFactoryFactoriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataFactory", DataFactoryResource.ResourceType.Namespace, Diagnostics); + private FactoriesRestOperations DataFactoryFactoriesRestClient => _dataFactoryFactoriesRestClient ??= new FactoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataFactoryResource.ResourceType)); + private ClientDiagnostics ExposureControlClientDiagnostics => _exposureControlClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataFactory", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ExposureControlRestOperations ExposureControlRestClient => _exposureControlRestClient ??= new ExposureControlRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists factories under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/factories + /// + /// + /// Operation Id + /// Factories_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataFactoriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataFactoryFactoriesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataFactoryFactoriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), DataFactoryFactoriesClientDiagnostics, Pipeline, "MockableDataFactorySubscriptionResource.GetDataFactories", "value", "nextLink", cancellationToken); + } + + /// + /// Lists factories under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/factories + /// + /// + /// Operation Id + /// Factories_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataFactories(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataFactoryFactoriesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataFactoryFactoriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), DataFactoryFactoriesClientDiagnostics, Pipeline, "MockableDataFactorySubscriptionResource.GetDataFactories", "value", "nextLink", cancellationToken); + } + + /// + /// Updates a factory's repo information. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/configureFactoryRepo + /// + /// + /// Operation Id + /// Factories_ConfigureFactoryRepo + /// + /// + /// + /// The location identifier. + /// Update factory repo request definition. + /// The cancellation token to use. + /// is null. + public virtual async Task> ConfigureFactoryRepoInformationAsync(AzureLocation locationId, FactoryRepoContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataFactoryFactoriesClientDiagnostics.CreateScope("MockableDataFactorySubscriptionResource.ConfigureFactoryRepoInformation"); + scope.Start(); + try + { + var response = await DataFactoryFactoriesRestClient.ConfigureFactoryRepoAsync(Id.SubscriptionId, locationId, content, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DataFactoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a factory's repo information. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/configureFactoryRepo + /// + /// + /// Operation Id + /// Factories_ConfigureFactoryRepo + /// + /// + /// + /// The location identifier. + /// Update factory repo request definition. + /// The cancellation token to use. + /// is null. + public virtual Response ConfigureFactoryRepoInformation(AzureLocation locationId, FactoryRepoContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataFactoryFactoriesClientDiagnostics.CreateScope("MockableDataFactorySubscriptionResource.ConfigureFactoryRepoInformation"); + scope.Start(); + try + { + var response = DataFactoryFactoriesRestClient.ConfigureFactoryRepo(Id.SubscriptionId, locationId, content, cancellationToken); + return Response.FromValue(new DataFactoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get exposure control feature for specific location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/getFeatureValue + /// + /// + /// Operation Id + /// ExposureControl_GetFeatureValue + /// + /// + /// + /// The location identifier. + /// The exposure control request. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetFeatureValueExposureControlAsync(AzureLocation locationId, ExposureControlContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ExposureControlClientDiagnostics.CreateScope("MockableDataFactorySubscriptionResource.GetFeatureValueExposureControl"); + scope.Start(); + try + { + var response = await ExposureControlRestClient.GetFeatureValueAsync(Id.SubscriptionId, locationId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get exposure control feature for specific location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/getFeatureValue + /// + /// + /// Operation Id + /// ExposureControl_GetFeatureValue + /// + /// + /// + /// The location identifier. + /// The exposure control request. + /// The cancellation token to use. + /// is null. + public virtual Response GetFeatureValueExposureControl(AzureLocation locationId, ExposureControlContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ExposureControlClientDiagnostics.CreateScope("MockableDataFactorySubscriptionResource.GetFeatureValueExposureControl"); + scope.Start(); + try + { + var response = ExposureControlRestClient.GetFeatureValue(Id.SubscriptionId, locationId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d9090efdae840..0000000000000 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DataFactory -{ - /// 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 DataFactoryResources in the ResourceGroupResource. - /// An object representing collection of DataFactoryResources and their operations over a DataFactoryResource. - public virtual DataFactoryCollection GetDataFactories() - { - return GetCachedClient(Client => new DataFactoryCollection(Client, Id)); - } - } -} diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 5bc6c11b361e4..0000000000000 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DataFactory.Models; - -namespace Azure.ResourceManager.DataFactory -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataFactoryFactoriesClientDiagnostics; - private FactoriesRestOperations _dataFactoryFactoriesRestClient; - private ClientDiagnostics _exposureControlClientDiagnostics; - private ExposureControlRestOperations _exposureControlRestClient; - - /// 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 DataFactoryFactoriesClientDiagnostics => _dataFactoryFactoriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataFactory", DataFactoryResource.ResourceType.Namespace, Diagnostics); - private FactoriesRestOperations DataFactoryFactoriesRestClient => _dataFactoryFactoriesRestClient ??= new FactoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataFactoryResource.ResourceType)); - private ClientDiagnostics ExposureControlClientDiagnostics => _exposureControlClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataFactory", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ExposureControlRestOperations ExposureControlRestClient => _exposureControlRestClient ??= new ExposureControlRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists factories under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/factories - /// - /// - /// Operation Id - /// Factories_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataFactoriesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataFactoryFactoriesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataFactoryFactoriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), DataFactoryFactoriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataFactories", "value", "nextLink", cancellationToken); - } - - /// - /// Lists factories under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/factories - /// - /// - /// Operation Id - /// Factories_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataFactories(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataFactoryFactoriesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataFactoryFactoriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataFactoryResource(Client, DataFactoryData.DeserializeDataFactoryData(e)), DataFactoryFactoriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataFactories", "value", "nextLink", cancellationToken); - } - - /// - /// Updates a factory's repo information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/configureFactoryRepo - /// - /// - /// Operation Id - /// Factories_ConfigureFactoryRepo - /// - /// - /// - /// The location identifier. - /// Update factory repo request definition. - /// The cancellation token to use. - public virtual async Task> ConfigureFactoryRepoInformationAsync(AzureLocation locationId, FactoryRepoContent content, CancellationToken cancellationToken = default) - { - using var scope = DataFactoryFactoriesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ConfigureFactoryRepoInformation"); - scope.Start(); - try - { - var response = await DataFactoryFactoriesRestClient.ConfigureFactoryRepoAsync(Id.SubscriptionId, locationId, content, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DataFactoryResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Updates a factory's repo information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/configureFactoryRepo - /// - /// - /// Operation Id - /// Factories_ConfigureFactoryRepo - /// - /// - /// - /// The location identifier. - /// Update factory repo request definition. - /// The cancellation token to use. - public virtual Response ConfigureFactoryRepoInformation(AzureLocation locationId, FactoryRepoContent content, CancellationToken cancellationToken = default) - { - using var scope = DataFactoryFactoriesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ConfigureFactoryRepoInformation"); - scope.Start(); - try - { - var response = DataFactoryFactoriesRestClient.ConfigureFactoryRepo(Id.SubscriptionId, locationId, content, cancellationToken); - return Response.FromValue(new DataFactoryResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get exposure control feature for specific location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/getFeatureValue - /// - /// - /// Operation Id - /// ExposureControl_GetFeatureValue - /// - /// - /// - /// The location identifier. - /// The exposure control request. - /// The cancellation token to use. - public virtual async Task> GetFeatureValueExposureControlAsync(AzureLocation locationId, ExposureControlContent content, CancellationToken cancellationToken = default) - { - using var scope = ExposureControlClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetFeatureValueExposureControl"); - scope.Start(); - try - { - var response = await ExposureControlRestClient.GetFeatureValueAsync(Id.SubscriptionId, locationId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get exposure control feature for specific location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/getFeatureValue - /// - /// - /// Operation Id - /// ExposureControl_GetFeatureValue - /// - /// - /// - /// The location identifier. - /// The exposure control request. - /// The cancellation token to use. - public virtual Response GetFeatureValueExposureControl(AzureLocation locationId, ExposureControlContent content, CancellationToken cancellationToken = default) - { - using var scope = ExposureControlClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetFeatureValueExposureControl"); - scope.Start(); - try - { - var response = ExposureControlRestClient.GetFeatureValue(Id.SubscriptionId, locationId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/DataFactoryManagementTestBase.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/DataFactoryManagementTestBase.cs index bab2531efd9ba..d2c30b8e3db5a 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/DataFactoryManagementTestBase.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/DataFactoryManagementTestBase.cs @@ -2,6 +2,9 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; using System.Threading.Tasks; using Azure.Core; using Azure.Core.Expressions.DataFactory; @@ -73,5 +76,168 @@ protected async Task GetStorageAccountAccessKey(ResourceGroupResource re var key = await storage.Value.GetKeysAsync().FirstOrDefaultAsync(_ => true); return key.Value; } + + protected async Task CreateAzureDBLinkedService(DataFactoryResource dataFactory, string linkedServiceName, string connectionString) + { + DataFactoryLinkedServiceData data = new DataFactoryLinkedServiceData(new AzureSqlDatabaseLinkedService(DataFactoryElement.FromSecretString(connectionString))); + var linkedService = await dataFactory.GetDataFactoryLinkedServices().CreateOrUpdateAsync(WaitUntil.Completed, linkedServiceName, data); + return linkedService.Value; + } + + protected async Task CreateAzureDBDataSet(DataFactoryResource dataFactory, string dataSetName, string linkedServiceName, string tableName) + { + DataFactoryLinkedServiceReference dataFactoryLinkedServiceReference = new DataFactoryLinkedServiceReference(DataFactoryLinkedServiceReferenceType.LinkedServiceReference, linkedServiceName); + DataFactoryDatasetData dataFactoryDatasetData = new DataFactoryDatasetData(new AzureSqlTableDataset(dataFactoryLinkedServiceReference) + { + Table = tableName, + SchemaTypePropertiesSchema = DataFactoryElement.FromLiteral("dbo"), + Schema = new List() + { + new DatasetSchemaDataElement(){ SchemaColumnName = "SampleId",SchemaColumnType="int"}, + new DatasetSchemaDataElement(){ SchemaColumnName = "SampleDetail",SchemaColumnType="varchar"} + } + }); + + var dataSet = await dataFactory.GetDataFactoryDatasets().CreateOrUpdateAsync(WaitUntil.Completed, dataSetName, dataFactoryDatasetData); + return dataSet.Value; + } + + protected async Task CreateCopyDataPipeline(DataFactoryResource dataFactory, string pipelineName, string dataSetAzureSqlSource, string dataSetAzureSqlSink, string dataSetAzureStorageSource, string dataSetAzureStorageSink, string dataSetAzureGen2Source, string dataSetAzureGen2Sink) + { + DataFactoryPipelineData pipelineData = new DataFactoryPipelineData() + { + Activities = + { + new CopyActivity("TestAzureSQL",new CopyActivitySource(),new CopySink()) + { + State = PipelineActivityState.Active, + Source = new AzureSqlSource() + { + SourceRetryCount = 10, + QueryTimeout = "02:00:00" + }, + Sink = new AzureSqlSink() + { + }, + Inputs = + { + new DatasetReference(DatasetReferenceType.DatasetReference,dataSetAzureSqlSource) + }, + Outputs = + { + new DatasetReference(DatasetReferenceType.DatasetReference,dataSetAzureSqlSink) + } + }, + new CopyActivity("TestAzureBlob",new CopyActivitySource(),new CopySink()) + { + State = PipelineActivityState.Active, + Inputs = + { + new DatasetReference(DatasetReferenceType.DatasetReference,dataSetAzureStorageSource) + }, + Outputs = + { + new DatasetReference(DatasetReferenceType.DatasetReference,dataSetAzureStorageSink) + }, + Source = new DelimitedTextSource() + { + }, + Sink = new DelimitedTextSink() + { + } + }, + new CopyActivity("TestAzureGen2",new CopyActivitySource(),new CopySink()) + { + State = PipelineActivityState.Active, + Inputs = + { + new DatasetReference(DatasetReferenceType.DatasetReference,dataSetAzureGen2Source) + }, + Outputs = + { + new DatasetReference(DatasetReferenceType.DatasetReference,dataSetAzureGen2Sink) + }, + Source = new DelimitedTextSource() + { + }, + Sink = new DelimitedTextSink() + { + } + } + } + }; + var pipeline = await dataFactory.GetDataFactoryPipelines().CreateOrUpdateAsync(Azure.WaitUntil.Completed, pipelineName, pipelineData); + return pipeline.Value; + } + + protected async Task CreateAzureBlobStorageLinkedService(DataFactoryResource dataFactory, string linkedServiceName, string accessKey) + { + AzureBlobStorageLinkedService azureBlobStorageLinkedService = new AzureBlobStorageLinkedService() + { + ConnectionString = DataFactoryElement.FromSecretString(accessKey) + }; + DataFactoryLinkedServiceData data = new DataFactoryLinkedServiceData(azureBlobStorageLinkedService); + var linkedService = await dataFactory.GetDataFactoryLinkedServices().CreateOrUpdateAsync(WaitUntil.Completed, linkedServiceName, data); + return linkedService.Value; + } + + protected async Task CreateAzureDataLakeGen2LinkedService(DataFactoryResource dataFactory, string linkedServiceName, string accessKey) + { + AzureBlobFSLinkedService azureDataLakeGen2LinkedService = new AzureBlobFSLinkedService() + { + AccountKey = accessKey, + Uri = "https://testazuresdkstoragegen2.dfs.core.windows.net/" + }; + DataFactoryLinkedServiceData data = new DataFactoryLinkedServiceData(azureDataLakeGen2LinkedService); + var linkedService = await dataFactory.GetDataFactoryLinkedServices().CreateOrUpdateAsync(WaitUntil.Completed, linkedServiceName, data); + return linkedService.Value; + } + + protected async Task CreateAzureBlobStorageDataSet(DataFactoryResource dataFactory, string dataSetName, string linkedServiceName) + { + DataFactoryLinkedServiceReference dataFactoryLinkedServiceReference = new DataFactoryLinkedServiceReference(DataFactoryLinkedServiceReferenceType.LinkedServiceReference, linkedServiceName); + DataFactoryDatasetData dataFactoryDatasetData = new DataFactoryDatasetData(new DelimitedTextDataset(dataFactoryLinkedServiceReference) + { + Schema = new List() + { + new DatasetSchemaDataElement(){ SchemaColumnName = "Id",SchemaColumnType="String"}, + new DatasetSchemaDataElement(){ SchemaColumnName = "Content",SchemaColumnType="String"} + }, + DataLocation = new AzureBlobStorageLocation() + { + Container = "testcontainer", + FileName = "TestData.csv" + }, + ColumnDelimiter = ",", + FirstRowAsHeader = true + }); + + var dataSet = await dataFactory.GetDataFactoryDatasets().CreateOrUpdateAsync(WaitUntil.Completed, dataSetName, dataFactoryDatasetData); + return dataSet.Value; + } + + protected async Task CreateAzureDataLakeGen2DataSet(DataFactoryResource dataFactory, string dataSetName, string linkedServiceName) + { + DataFactoryLinkedServiceReference dataFactoryLinkedServiceReference = new DataFactoryLinkedServiceReference(DataFactoryLinkedServiceReferenceType.LinkedServiceReference, linkedServiceName); + DataFactoryDatasetData dataFactoryDatasetData = new DataFactoryDatasetData(new DelimitedTextDataset(dataFactoryLinkedServiceReference) + { + Schema = new List() + { + new DatasetSchemaDataElement(){ SchemaColumnName = "Id",SchemaColumnType="String"}, + new DatasetSchemaDataElement(){ SchemaColumnName = "Content",SchemaColumnType="String"} + }, + DataLocation = new AzureBlobStorageLocation() + { + Container = "testcontainer", + FileName = "TestData.csv", + FolderPath = "testfolder" + }, + ColumnDelimiter = ",", + FirstRowAsHeader = true + }); + + var dataSet = await dataFactory.GetDataFactoryDatasets().CreateOrUpdateAsync(WaitUntil.Completed, dataSetName, dataFactoryDatasetData); + return dataSet.Value; + } } } diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/Scenario/DataFactoryCopyDataTask.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/Scenario/DataFactoryCopyDataTask.cs new file mode 100644 index 0000000000000..c476a9b2d7b68 --- /dev/null +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/Scenario/DataFactoryCopyDataTask.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DataFactory.Tests.Scenario +{ + internal class DataFactoryCopyDataTask : DataFactoryManagementTestBase + { + private ResourceIdentifier _dataFactoryIdentifier; + private DataFactoryResource _dataFactory; + private string _connectionString; + private string _azureSqlDBLinkedServiceName; + private string _dataSetAzureSqlSourceName; + private string _dataSetAzureSqlSinkName; + private string _pipelineName; + private string _azureBlobStorageLinkedServiceName; + private string _azureBlobStorageSourceName; + private string _azureBlobStorageSinkName; + private string _accessBlobKey; + private string _accessGen2Key; + private string _azureDataLakeGen2LinkedServiceName; + private string _azureDataLakeGen2SourceName; + private string _azureDataLakeGen2SinkName; + + public DataFactoryCopyDataTask(bool isAsync) : base(isAsync) + { + JsonPathSanitizers.Add("$..value"); + JsonPathSanitizers.Add("$..encryptedCredential"); + JsonPathSanitizers.Add("$..url"); + JsonPathSanitizers.Add("$..accountKey"); + } + + [OneTimeSetUp] + public async Task GlobalSetUp() + { + string rgName = SessionRecording.GenerateAssetName("DataFactory-RG-"); + string dataFactoryName = SessionRecording.GenerateAssetName("DataFactory-"); + var rgLro = await GlobalClient.GetDefaultSubscriptionAsync().Result.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, new ResourceGroupData(AzureLocation.WestUS2)); + var dataFactoryLro = await CreateDataFactory(rgLro.Value, dataFactoryName); + _dataFactoryIdentifier = dataFactoryLro.Id; + _connectionString = SessionRecording.GenerateAssetName("DATAFACTORY_CONNECTIONSTRING"); + _accessBlobKey = SessionRecording.GenerateAssetName("DATAFACTORY_BLOBKEY"); + _accessGen2Key = SessionRecording.GenerateAssetName("DATAFACTORY_Gen2KEY"); + await StopSessionRecordingAsync(); + } + + [SetUp] + public async Task TestSetUp() + { + _dataFactory = await Client.GetDataFactoryResource(_dataFactoryIdentifier).GetAsync(); + } + + public async Task CreateLinkedService() + { + _azureSqlDBLinkedServiceName = Recording.GenerateAssetName("LinkedService"); + var azureSqlDBLinkedService = await CreateAzureDBLinkedService(_dataFactory, _azureSqlDBLinkedServiceName, _connectionString); + Assert.IsNotNull(azureSqlDBLinkedService); + Assert.AreEqual(_azureSqlDBLinkedServiceName, azureSqlDBLinkedService.Data.Name); + + _azureBlobStorageLinkedServiceName = Recording.GenerateAssetName("LinkedService"); + var azureBlobStorageLinkedService = await CreateAzureBlobStorageLinkedService(_dataFactory, _azureBlobStorageLinkedServiceName, _accessBlobKey); + Assert.IsNotNull(azureBlobStorageLinkedService); + Assert.AreEqual(_azureBlobStorageLinkedServiceName, azureBlobStorageLinkedService.Data.Name); + + _azureDataLakeGen2LinkedServiceName = Recording.GenerateAssetName("LinkedService"); + var azureDataLakeGen2LinkedService = await CreateAzureDataLakeGen2LinkedService(_dataFactory, _azureDataLakeGen2LinkedServiceName, _accessGen2Key); + Assert.IsNotNull(azureDataLakeGen2LinkedService); + Assert.AreEqual(_azureDataLakeGen2LinkedServiceName, azureDataLakeGen2LinkedService.Data.Name); + } + + public async Task CreateDataSet() + { + _dataSetAzureSqlSourceName = Recording.GenerateAssetName("DataSet"); + var dataSetAzureSqlSource = await CreateAzureDBDataSet(_dataFactory, _dataSetAzureSqlSourceName, _azureSqlDBLinkedServiceName, "SampleTable1"); + Assert.IsNotNull(dataSetAzureSqlSource); + Assert.AreEqual(_dataSetAzureSqlSourceName, dataSetAzureSqlSource.Data.Name); + + _dataSetAzureSqlSinkName = Recording.GenerateAssetName("DataSet"); + var dataSetAzureSqlSink = await CreateAzureDBDataSet(_dataFactory, _dataSetAzureSqlSinkName, _azureSqlDBLinkedServiceName, "SampleTable2"); + Assert.IsNotNull(dataSetAzureSqlSink); + Assert.AreEqual(_dataSetAzureSqlSinkName, dataSetAzureSqlSink.Data.Name); + + _azureBlobStorageSourceName = Recording.GenerateAssetName("DataSet"); + var dataSetAzureStorageSource = await CreateAzureBlobStorageDataSet(_dataFactory, _azureBlobStorageSourceName, _azureBlobStorageLinkedServiceName); + Assert.IsNotNull(dataSetAzureStorageSource); + Assert.AreEqual(_azureBlobStorageSourceName, dataSetAzureStorageSource.Data.Name); + + _azureBlobStorageSinkName = Recording.GenerateAssetName("DataSet"); + var dataSetAzureStorageSink = await CreateAzureBlobStorageDataSet(_dataFactory, _azureBlobStorageSinkName, _azureBlobStorageLinkedServiceName); + Assert.IsNotNull(dataSetAzureStorageSink); + Assert.AreEqual(_azureBlobStorageSinkName, dataSetAzureStorageSink.Data.Name); + + _azureDataLakeGen2SourceName = Recording.GenerateAssetName("DataSet"); + var dataSetAzureGen2Source = await CreateAzureDataLakeGen2DataSet(_dataFactory, _azureDataLakeGen2SourceName, _azureDataLakeGen2LinkedServiceName); + Assert.IsNotNull(dataSetAzureGen2Source); + Assert.AreEqual(_azureDataLakeGen2SourceName, dataSetAzureGen2Source.Data.Name); + + _azureDataLakeGen2SinkName = Recording.GenerateAssetName("DataSet"); + var dataSetAzureGen2Sink = await CreateAzureDataLakeGen2DataSet(_dataFactory, _azureDataLakeGen2SinkName, _azureDataLakeGen2LinkedServiceName); + Assert.IsNotNull(dataSetAzureGen2Sink); + Assert.AreEqual(_azureDataLakeGen2SinkName, dataSetAzureGen2Sink.Data.Name); + } + + public async Task CreatePipeline() + { + string pipelineName = Recording.GenerateAssetName("pipeline-"); + var pipeline = await CreateCopyDataPipeline(_dataFactory, pipelineName, _dataSetAzureSqlSourceName, _dataSetAzureSqlSinkName, _azureBlobStorageSourceName, _azureBlobStorageSinkName,_azureDataLakeGen2SourceName,_azureDataLakeGen2SinkName); + Assert.IsNotNull(pipeline); + Assert.AreEqual(pipelineName, pipeline.Data.Name); + _pipelineName = pipeline.Data.Name; + } + + public async Task ExecutePipelineAndVerify() + { + DataFactoryPipelineResource pipelineResource = await _dataFactory.GetDataFactoryPipelineAsync(_pipelineName); + var pipelineTrigger = await pipelineResource.CreateRunAsync(); + Assert.IsNotNull(pipelineTrigger); + var result = await _dataFactory.GetPipelineRunAsync(pipelineTrigger.Value.RunId.ToString()); + Assert.AreNotEqual("Failed", result.Value.Status); + } + + [Test] + [RecordedTest] + public async Task CreateCopyDataTask() + { + await CreateLinkedService(); + await CreateDataSet(); + await CreatePipeline(); + await ExecutePipelineAndVerify(); + } + } +} diff --git a/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/Scenario/ManagedIntegrationRuntimeResourceTests.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/Scenario/ManagedIntegrationRuntimeResourceTests.cs new file mode 100644 index 0000000000000..92ab8cff5f06d --- /dev/null +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/tests/Scenario/ManagedIntegrationRuntimeResourceTests.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.DataFactory.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DataFactory.Tests.Scenario +{ + internal class ManagedIntegrationRuntimeResourceTests : DataFactoryManagementTestBase + { + private ResourceIdentifier _dataFactoryIdentifier; + private DataFactoryResource _dataFactory; + public ManagedIntegrationRuntimeResourceTests(bool isAsync) : base(isAsync) + { + } + + [OneTimeSetUp] + public async Task GlobalSetUp() + { + string rgName = SessionRecording.GenerateAssetName("DataFactory-RG-"); + string dataFactoryName = SessionRecording.GenerateAssetName("DataFactory-"); + var rgLro = await GlobalClient.GetDefaultSubscriptionAsync().Result.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, new ResourceGroupData(AzureLocation.WestUS2)); + var dataFactoryLro = await CreateDataFactory(rgLro.Value, dataFactoryName); + _dataFactoryIdentifier = dataFactoryLro.Id; + await StopSessionRecordingAsync(); + } + + [SetUp] + public async Task TestSetUp() + { + _dataFactory = await Client.GetDataFactoryResource(_dataFactoryIdentifier).GetAsync(); + } + + private async Task CreateDefaultManagedIntegrationRuntime(string integrationRuntimeName) + { + ManagedIntegrationRuntime properties = new ManagedIntegrationRuntime() + { + ComputeProperties = new IntegrationRuntimeComputeProperties() + { + Location = "eastus2", + DataFlowProperties = new IntegrationRuntimeDataFlowProperties() + { + ComputeType = DataFlowComputeType.General, + CoreCount = 16, + TimeToLiveInMinutes = 10 + } + } + }; + DataFactoryIntegrationRuntimeData data = new DataFactoryIntegrationRuntimeData(properties); + var integrationRuntime = await _dataFactory.GetDataFactoryIntegrationRuntimes().CreateOrUpdateAsync(WaitUntil.Completed, integrationRuntimeName, data); + return integrationRuntime.Value; + } + + [Test] + [RecordedTest] + public async Task CreateOrUpdate() + { + string integrationRuntimeName = Recording.GenerateAssetName("intergration"); + var integrationRuntime = await CreateDefaultManagedIntegrationRuntime(integrationRuntimeName); + Assert.IsNotNull(integrationRuntime); + } + + [Test] + [RecordedTest] + public async Task Exist() + { + string integrationRuntimeName = Recording.GenerateAssetName("intergration"); + await CreateDefaultManagedIntegrationRuntime(integrationRuntimeName); + bool flag = await _dataFactory.GetDataFactoryIntegrationRuntimes().ExistsAsync(integrationRuntimeName); + Assert.IsTrue(flag); + } + + [Test] + [RecordedTest] + public async Task Get() + { + string integrationRuntimeName = Recording.GenerateAssetName("intergration"); + await CreateDefaultManagedIntegrationRuntime(integrationRuntimeName); + var integrationRuntime = await _dataFactory.GetDataFactoryIntegrationRuntimes().GetAsync(integrationRuntimeName); + Assert.IsNotNull(integrationRuntime); + } + + [Test] + [RecordedTest] + public async Task GetAll() + { + string integrationRuntimeName = Recording.GenerateAssetName("intergration"); + await CreateDefaultManagedIntegrationRuntime(integrationRuntimeName); + var list = await _dataFactory.GetDataFactoryIntegrationRuntimes().GetAllAsync().ToEnumerableAsync(); + Assert.IsNotNull(list); + } + + [Test] + [RecordedTest] + public async Task Delete() + { + string integrationRuntimeName = Recording.GenerateAssetName("intergration"); + var integrationRuntime = await CreateDefaultManagedIntegrationRuntime(integrationRuntimeName); + bool flag = await _dataFactory.GetDataFactoryIntegrationRuntimes().ExistsAsync(integrationRuntimeName); + Assert.IsTrue(flag); + + await integrationRuntime.DeleteAsync(WaitUntil.Completed); + flag = await _dataFactory.GetDataFactoryIntegrationRuntimes().ExistsAsync(integrationRuntimeName); + Assert.IsFalse(flag); + } + } +} diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/api/Azure.ResourceManager.DataLakeAnalytics.netstandard2.0.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/api/Azure.ResourceManager.DataLakeAnalytics.netstandard2.0.cs index d7c1f6431eb41..5e87c2c80f215 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/api/Azure.ResourceManager.DataLakeAnalytics.netstandard2.0.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/api/Azure.ResourceManager.DataLakeAnalytics.netstandard2.0.cs @@ -288,6 +288,38 @@ protected DataLakeStoreAccountInformationResource() { } public virtual System.Threading.Tasks.Task UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DataLakeAnalytics.Models.DataLakeStoreAccountInformationCreateOrUpdateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DataLakeAnalytics.Mocking +{ + public partial class MockableDataLakeAnalyticsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDataLakeAnalyticsArmClient() { } + public virtual Azure.ResourceManager.DataLakeAnalytics.DataLakeAnalyticsAccountResource GetDataLakeAnalyticsAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataLakeAnalytics.DataLakeAnalyticsComputePolicyResource GetDataLakeAnalyticsComputePolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataLakeAnalytics.DataLakeAnalyticsFirewallRuleResource GetDataLakeAnalyticsFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataLakeAnalytics.DataLakeAnalyticsStorageAccountInformationResource GetDataLakeAnalyticsStorageAccountInformationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataLakeAnalytics.DataLakeAnalyticsStorageContainerResource GetDataLakeAnalyticsStorageContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataLakeAnalytics.DataLakeStoreAccountInformationResource GetDataLakeStoreAccountInformationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDataLakeAnalyticsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDataLakeAnalyticsResourceGroupResource() { } + public virtual Azure.Response GetDataLakeAnalyticsAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataLakeAnalyticsAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataLakeAnalytics.DataLakeAnalyticsAccountCollection GetDataLakeAnalyticsAccounts() { throw null; } + } + public partial class MockableDataLakeAnalyticsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDataLakeAnalyticsSubscriptionResource() { } + public virtual Azure.Response CheckDataLakeAnalyticsAccountNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.DataLakeAnalytics.Models.DataLakeAnalyticsAccountNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDataLakeAnalyticsAccountNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataLakeAnalytics.Models.DataLakeAnalyticsAccountNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAccounts(Azure.ResourceManager.DataLakeAnalytics.Models.SubscriptionResourceGetAccountsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAccounts(string filter = null, int? top = default(int?), int? skip = default(int?), string select = null, string orderby = null, bool? count = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAccountsAsync(Azure.ResourceManager.DataLakeAnalytics.Models.SubscriptionResourceGetAccountsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAccountsAsync(string filter = null, int? top = default(int?), int? skip = default(int?), string select = null, string orderby = null, bool? count = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCapabilityLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCapabilityLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DataLakeAnalytics.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Custom/Extensions/DataLakeAnalyticsExtensions.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Custom/Extensions/DataLakeAnalyticsExtensions.cs index b5a83ec201cd7..7b485f9fa4abc 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Custom/Extensions/DataLakeAnalyticsExtensions.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Custom/Extensions/DataLakeAnalyticsExtensions.cs @@ -1,12 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Text; +using System.Threading; using Azure.ResourceManager.DataLakeAnalytics.Models; using Azure.ResourceManager.Resources; -using System.Threading; namespace Azure.ResourceManager.DataLakeAnalytics { @@ -36,15 +33,7 @@ public static partial class DataLakeAnalyticsExtensions /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAccountsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, int? skip = null, string select = null, string orderby = null, bool? count = null, CancellationToken cancellationToken = default) { - SubscriptionResourceGetAccountsOptions options = new SubscriptionResourceGetAccountsOptions(); - options.Filter = filter; - options.Top = top; - options.Skip = skip; - options.Select = select; - options.Orderby = orderby; - options.Count = count; - - return subscriptionResource.GetAccountsAsync(options, cancellationToken); + return GetMockableDataLakeAnalyticsSubscriptionResource(subscriptionResource).GetAccountsAsync(filter, top, skip, select, orderby, count, cancellationToken); } /// @@ -71,15 +60,7 @@ public static AsyncPageable GetAccountsAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAccounts(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, int? skip = null, string select = null, string orderby = null, bool? count = null, CancellationToken cancellationToken = default) { - SubscriptionResourceGetAccountsOptions options = new SubscriptionResourceGetAccountsOptions(); - options.Filter = filter; - options.Top = top; - options.Skip = skip; - options.Select = select; - options.Orderby = orderby; - options.Count = count; - - return subscriptionResource.GetAccounts(options, cancellationToken); + return GetMockableDataLakeAnalyticsSubscriptionResource(subscriptionResource).GetAccounts(filter, top, skip, select, orderby, count, cancellationToken); } } } diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Custom/Extensions/MockableDataLakeAnalyticsSubscriptionResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Custom/Extensions/MockableDataLakeAnalyticsSubscriptionResource.cs new file mode 100644 index 0000000000000..7d997f02a6040 --- /dev/null +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Custom/Extensions/MockableDataLakeAnalyticsSubscriptionResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Threading; +using Azure.ResourceManager.DataLakeAnalytics.Models; + +namespace Azure.ResourceManager.DataLakeAnalytics.Mocking +{ + public partial class MockableDataLakeAnalyticsSubscriptionResource : ArmResource + { + /// + /// Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// OData filter. Optional. + /// The number of items to return. Optional. + /// The number of items to skip over before returning elements. Optional. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. + /// OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. + /// The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAccountsAsync(string filter = null, int? top = null, int? skip = null, string select = null, string orderby = null, bool? count = null, CancellationToken cancellationToken = default) + { + SubscriptionResourceGetAccountsOptions options = new SubscriptionResourceGetAccountsOptions(); + options.Filter = filter; + options.Top = top; + options.Skip = skip; + options.Select = select; + options.Orderby = orderby; + options.Count = count; + + return GetAccountsAsync(options, cancellationToken); + } + + /// + /// Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// OData filter. Optional. + /// The number of items to return. Optional. + /// The number of items to skip over before returning elements. Optional. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. + /// OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. + /// The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAccounts(string filter = null, int? top = null, int? skip = null, string select = null, string orderby = null, bool? count = null, CancellationToken cancellationToken = default) + { + SubscriptionResourceGetAccountsOptions options = new SubscriptionResourceGetAccountsOptions(); + options.Filter = filter; + options.Top = top; + options.Skip = skip; + options.Select = select; + options.Orderby = orderby; + options.Count = count; + + return GetAccounts(options, cancellationToken); + } + } +} diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountResource.cs index aea955c5c60a7..5f18593ef8f55 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountResource.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.DataLakeAnalytics public partial class DataLakeAnalyticsAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataLakeStoreAccountInformationResources and their operations over a DataLakeStoreAccountInformationResource. public virtual DataLakeStoreAccountInformationCollection GetAllDataLakeStoreAccountInformation() { - return GetCachedClient(Client => new DataLakeStoreAccountInformationCollection(Client, Id)); + return GetCachedClient(client => new DataLakeStoreAccountInformationCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual DataLakeStoreAccountInformationCollection GetAllDataLakeStoreAcco /// /// The name of the Data Lake Store account to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataLakeStoreAccountInformationAsync(string dataLakeStoreAccountName, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> Get /// /// The name of the Data Lake Store account to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataLakeStoreAccountInformation(string dataLakeStoreAccountName, CancellationToken cancellationToken = default) { @@ -145,7 +148,7 @@ public virtual Response GetDataLakeStor /// An object representing collection of DataLakeAnalyticsStorageAccountInformationResources and their operations over a DataLakeAnalyticsStorageAccountInformationResource. public virtual DataLakeAnalyticsStorageAccountInformationCollection GetAllDataLakeAnalyticsStorageAccountInformation() { - return GetCachedClient(Client => new DataLakeAnalyticsStorageAccountInformationCollection(Client, Id)); + return GetCachedClient(client => new DataLakeAnalyticsStorageAccountInformationCollection(client, Id)); } /// @@ -163,8 +166,8 @@ public virtual DataLakeAnalyticsStorageAccountInformationCollection GetAllDataLa /// /// The name of the Azure Storage account for which to retrieve the details. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataLakeAnalyticsStorageAccountInformationAsync(string storageAccountName, CancellationToken cancellationToken = default) { @@ -186,8 +189,8 @@ public virtual async Task /// The name of the Azure Storage account for which to retrieve the details. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataLakeAnalyticsStorageAccountInformation(string storageAccountName, CancellationToken cancellationToken = default) { @@ -198,7 +201,7 @@ public virtual Response GetD /// An object representing collection of DataLakeAnalyticsComputePolicyResources and their operations over a DataLakeAnalyticsComputePolicyResource. public virtual DataLakeAnalyticsComputePolicyCollection GetDataLakeAnalyticsComputePolicies() { - return GetCachedClient(Client => new DataLakeAnalyticsComputePolicyCollection(Client, Id)); + return GetCachedClient(client => new DataLakeAnalyticsComputePolicyCollection(client, Id)); } /// @@ -216,8 +219,8 @@ public virtual DataLakeAnalyticsComputePolicyCollection GetDataLakeAnalyticsComp /// /// The name of the compute policy to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataLakeAnalyticsComputePolicyAsync(string computePolicyName, CancellationToken cancellationToken = default) { @@ -239,8 +242,8 @@ public virtual async Task> GetD /// /// The name of the compute policy to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataLakeAnalyticsComputePolicy(string computePolicyName, CancellationToken cancellationToken = default) { @@ -251,7 +254,7 @@ public virtual Response GetDataLakeAnaly /// An object representing collection of DataLakeAnalyticsFirewallRuleResources and their operations over a DataLakeAnalyticsFirewallRuleResource. public virtual DataLakeAnalyticsFirewallRuleCollection GetDataLakeAnalyticsFirewallRules() { - return GetCachedClient(Client => new DataLakeAnalyticsFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new DataLakeAnalyticsFirewallRuleCollection(client, Id)); } /// @@ -269,8 +272,8 @@ public virtual DataLakeAnalyticsFirewallRuleCollection GetDataLakeAnalyticsFirew /// /// The name of the firewall rule to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataLakeAnalyticsFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -292,8 +295,8 @@ public virtual async Task> GetDa /// /// The name of the firewall rule to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataLakeAnalyticsFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsComputePolicyResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsComputePolicyResource.cs index 778f4dfa23f54..0423cb15f7c13 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsComputePolicyResource.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsComputePolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataLakeAnalytics public partial class DataLakeAnalyticsComputePolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The computePolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string computePolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/computePolicies/{computePolicyName}"; diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsFirewallRuleResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsFirewallRuleResource.cs index 8c0adc4391bc1..9a4e1c7ced7b3 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsFirewallRuleResource.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsFirewallRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataLakeAnalytics public partial class DataLakeAnalyticsFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationResource.cs index 0125c0dd95a9c..ace7a993d1bf3 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationResource.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataLakeAnalytics public partial class DataLakeAnalyticsStorageAccountInformationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The storageAccountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string storageAccountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataLakeAnalyticsStorageContainerResources and their operations over a DataLakeAnalyticsStorageContainerResource. public virtual DataLakeAnalyticsStorageContainerCollection GetDataLakeAnalyticsStorageContainers() { - return GetCachedClient(Client => new DataLakeAnalyticsStorageContainerCollection(Client, Id)); + return GetCachedClient(client => new DataLakeAnalyticsStorageContainerCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual DataLakeAnalyticsStorageContainerCollection GetDataLakeAnalyticsS /// /// The name of the Azure storage container to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataLakeAnalyticsStorageContainerAsync(string containerName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> G /// /// The name of the Azure storage container to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataLakeAnalyticsStorageContainer(string containerName, CancellationToken cancellationToken = default) { diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageContainerResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageContainerResource.cs index 3aefd69b2295b..816c7f67223da 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageContainerResource.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageContainerResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.DataLakeAnalytics public partial class DataLakeAnalyticsStorageContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The storageAccountName. + /// The containerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string storageAccountName, string containerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/storageAccounts/{storageAccountName}/containers/{containerName}"; diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeStoreAccountInformationResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeStoreAccountInformationResource.cs index 11d34654123f0..2e3720f03d399 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeStoreAccountInformationResource.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeStoreAccountInformationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataLakeAnalytics public partial class DataLakeStoreAccountInformationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The dataLakeStoreAccountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string dataLakeStoreAccountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}/dataLakeStoreAccounts/{dataLakeStoreAccountName}"; diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/DataLakeAnalyticsExtensions.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/DataLakeAnalyticsExtensions.cs index 5c69bccdd82c4..bec8d38878097 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/DataLakeAnalyticsExtensions.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/DataLakeAnalyticsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DataLakeAnalytics.Mocking; using Azure.ResourceManager.DataLakeAnalytics.Models; using Azure.ResourceManager.Resources; @@ -19,157 +20,129 @@ namespace Azure.ResourceManager.DataLakeAnalytics /// A class to add extension methods to Azure.ResourceManager.DataLakeAnalytics. public static partial class DataLakeAnalyticsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDataLakeAnalyticsArmClient GetMockableDataLakeAnalyticsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDataLakeAnalyticsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataLakeAnalyticsResourceGroupResource GetMockableDataLakeAnalyticsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataLakeAnalyticsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDataLakeAnalyticsSubscriptionResource GetMockableDataLakeAnalyticsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDataLakeAnalyticsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataLakeAnalyticsAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeAnalyticsAccountResource GetDataLakeAnalyticsAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeAnalyticsAccountResource.ValidateResourceId(id); - return new DataLakeAnalyticsAccountResource(client, id); - } - ); + return GetMockableDataLakeAnalyticsArmClient(client).GetDataLakeAnalyticsAccountResource(id); } - #endregion - #region DataLakeStoreAccountInformationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeStoreAccountInformationResource GetDataLakeStoreAccountInformationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeStoreAccountInformationResource.ValidateResourceId(id); - return new DataLakeStoreAccountInformationResource(client, id); - } - ); + return GetMockableDataLakeAnalyticsArmClient(client).GetDataLakeStoreAccountInformationResource(id); } - #endregion - #region DataLakeAnalyticsStorageAccountInformationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeAnalyticsStorageAccountInformationResource GetDataLakeAnalyticsStorageAccountInformationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeAnalyticsStorageAccountInformationResource.ValidateResourceId(id); - return new DataLakeAnalyticsStorageAccountInformationResource(client, id); - } - ); + return GetMockableDataLakeAnalyticsArmClient(client).GetDataLakeAnalyticsStorageAccountInformationResource(id); } - #endregion - #region DataLakeAnalyticsStorageContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeAnalyticsStorageContainerResource GetDataLakeAnalyticsStorageContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeAnalyticsStorageContainerResource.ValidateResourceId(id); - return new DataLakeAnalyticsStorageContainerResource(client, id); - } - ); + return GetMockableDataLakeAnalyticsArmClient(client).GetDataLakeAnalyticsStorageContainerResource(id); } - #endregion - #region DataLakeAnalyticsComputePolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeAnalyticsComputePolicyResource GetDataLakeAnalyticsComputePolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeAnalyticsComputePolicyResource.ValidateResourceId(id); - return new DataLakeAnalyticsComputePolicyResource(client, id); - } - ); + return GetMockableDataLakeAnalyticsArmClient(client).GetDataLakeAnalyticsComputePolicyResource(id); } - #endregion - #region DataLakeAnalyticsFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeAnalyticsFirewallRuleResource GetDataLakeAnalyticsFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeAnalyticsFirewallRuleResource.ValidateResourceId(id); - return new DataLakeAnalyticsFirewallRuleResource(client, id); - } - ); + return GetMockableDataLakeAnalyticsArmClient(client).GetDataLakeAnalyticsFirewallRuleResource(id); } - #endregion - /// Gets a collection of DataLakeAnalyticsAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of DataLakeAnalyticsAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataLakeAnalyticsAccountResources and their operations over a DataLakeAnalyticsAccountResource. public static DataLakeAnalyticsAccountCollection GetDataLakeAnalyticsAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataLakeAnalyticsAccounts(); + return GetMockableDataLakeAnalyticsResourceGroupResource(resourceGroupResource).GetDataLakeAnalyticsAccounts(); } /// @@ -184,16 +157,20 @@ public static DataLakeAnalyticsAccountCollection GetDataLakeAnalyticsAccounts(th /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Data Lake Analytics account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataLakeAnalyticsAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataLakeAnalyticsAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableDataLakeAnalyticsResourceGroupResource(resourceGroupResource).GetDataLakeAnalyticsAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -208,16 +185,20 @@ public static async Task> GetDataLake /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Data Lake Analytics account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataLakeAnalyticsAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataLakeAnalyticsAccounts().Get(accountName, cancellationToken); + return GetMockableDataLakeAnalyticsResourceGroupResource(resourceGroupResource).GetDataLakeAnalyticsAccount(accountName, cancellationToken); } /// @@ -232,6 +213,10 @@ public static Response GetDataLakeAnalyticsAcc /// Accounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -239,9 +224,7 @@ public static Response GetDataLakeAnalyticsAcc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAccountsAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) { - options ??= new SubscriptionResourceGetAccountsOptions(); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAccountsAsync(options, cancellationToken); + return GetMockableDataLakeAnalyticsSubscriptionResource(subscriptionResource).GetAccountsAsync(options, cancellationToken); } /// @@ -256,6 +239,10 @@ public static AsyncPageable GetAccountsAsync(this /// Accounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -263,9 +250,7 @@ public static AsyncPageable GetAccountsAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAccounts(this SubscriptionResource subscriptionResource, SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) { - options ??= new SubscriptionResourceGetAccountsOptions(); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAccounts(options, cancellationToken); + return GetMockableDataLakeAnalyticsSubscriptionResource(subscriptionResource).GetAccounts(options, cancellationToken); } /// @@ -280,6 +265,10 @@ public static Pageable GetAccounts(this Subscript /// Accounts_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. @@ -288,9 +277,7 @@ public static Pageable GetAccounts(this Subscript /// is null. public static async Task> CheckDataLakeAnalyticsAccountNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, DataLakeAnalyticsAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataLakeAnalyticsAccountNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataLakeAnalyticsSubscriptionResource(subscriptionResource).CheckDataLakeAnalyticsAccountNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -305,6 +292,10 @@ public static async TaskAccounts_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. @@ -313,9 +304,7 @@ public static async Task is null. public static Response CheckDataLakeAnalyticsAccountNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, DataLakeAnalyticsAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataLakeAnalyticsAccountNameAvailability(location, content, cancellationToken); + return GetMockableDataLakeAnalyticsSubscriptionResource(subscriptionResource).CheckDataLakeAnalyticsAccountNameAvailability(location, content, cancellationToken); } /// @@ -330,13 +319,17 @@ public static Response CheckData /// Locations_GetCapability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. /// The cancellation token to use. public static async Task> GetCapabilityLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapabilityLocationAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableDataLakeAnalyticsSubscriptionResource(subscriptionResource).GetCapabilityLocationAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -351,13 +344,17 @@ public static async Task> GetCa /// Locations_GetCapability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. /// The cancellation token to use. public static Response GetCapabilityLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapabilityLocation(location, cancellationToken); + return GetMockableDataLakeAnalyticsSubscriptionResource(subscriptionResource).GetCapabilityLocation(location, cancellationToken); } } } diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsArmClient.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsArmClient.cs new file mode 100644 index 0000000000000..8c1b0e050d33d --- /dev/null +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsArmClient.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DataLakeAnalytics; + +namespace Azure.ResourceManager.DataLakeAnalytics.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDataLakeAnalyticsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataLakeAnalyticsArmClient() + { + } + + /// 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 MockableDataLakeAnalyticsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDataLakeAnalyticsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeAnalyticsAccountResource GetDataLakeAnalyticsAccountResource(ResourceIdentifier id) + { + DataLakeAnalyticsAccountResource.ValidateResourceId(id); + return new DataLakeAnalyticsAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeStoreAccountInformationResource GetDataLakeStoreAccountInformationResource(ResourceIdentifier id) + { + DataLakeStoreAccountInformationResource.ValidateResourceId(id); + return new DataLakeStoreAccountInformationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeAnalyticsStorageAccountInformationResource GetDataLakeAnalyticsStorageAccountInformationResource(ResourceIdentifier id) + { + DataLakeAnalyticsStorageAccountInformationResource.ValidateResourceId(id); + return new DataLakeAnalyticsStorageAccountInformationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeAnalyticsStorageContainerResource GetDataLakeAnalyticsStorageContainerResource(ResourceIdentifier id) + { + DataLakeAnalyticsStorageContainerResource.ValidateResourceId(id); + return new DataLakeAnalyticsStorageContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeAnalyticsComputePolicyResource GetDataLakeAnalyticsComputePolicyResource(ResourceIdentifier id) + { + DataLakeAnalyticsComputePolicyResource.ValidateResourceId(id); + return new DataLakeAnalyticsComputePolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeAnalyticsFirewallRuleResource GetDataLakeAnalyticsFirewallRuleResource(ResourceIdentifier id) + { + DataLakeAnalyticsFirewallRuleResource.ValidateResourceId(id); + return new DataLakeAnalyticsFirewallRuleResource(Client, id); + } + } +} diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsResourceGroupResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsResourceGroupResource.cs new file mode 100644 index 0000000000000..ae8f835052a00 --- /dev/null +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.DataLakeAnalytics; + +namespace Azure.ResourceManager.DataLakeAnalytics.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDataLakeAnalyticsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataLakeAnalyticsResourceGroupResource() + { + } + + /// 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 MockableDataLakeAnalyticsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataLakeAnalyticsAccountResources in the ResourceGroupResource. + /// An object representing collection of DataLakeAnalyticsAccountResources and their operations over a DataLakeAnalyticsAccountResource. + public virtual DataLakeAnalyticsAccountCollection GetDataLakeAnalyticsAccounts() + { + return GetCachedClient(client => new DataLakeAnalyticsAccountCollection(client, Id)); + } + + /// + /// Gets details of the specified Data Lake Analytics account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Data Lake Analytics account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataLakeAnalyticsAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetDataLakeAnalyticsAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details of the specified Data Lake Analytics account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Data Lake Analytics account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataLakeAnalyticsAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetDataLakeAnalyticsAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsSubscriptionResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsSubscriptionResource.cs new file mode 100644 index 0000000000000..6445d3743ed47 --- /dev/null +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/MockableDataLakeAnalyticsSubscriptionResource.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataLakeAnalytics; +using Azure.ResourceManager.DataLakeAnalytics.Models; + +namespace Azure.ResourceManager.DataLakeAnalytics.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDataLakeAnalyticsSubscriptionResource : ArmResource + { + private ClientDiagnostics _dataLakeAnalyticsAccountAccountsClientDiagnostics; + private AccountsRestOperations _dataLakeAnalyticsAccountAccountsRestClient; + private ClientDiagnostics _locationsClientDiagnostics; + private LocationsRestOperations _locationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataLakeAnalyticsSubscriptionResource() + { + } + + /// 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 MockableDataLakeAnalyticsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataLakeAnalyticsAccountAccountsClientDiagnostics => _dataLakeAnalyticsAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataLakeAnalytics", DataLakeAnalyticsAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations DataLakeAnalyticsAccountAccountsRestClient => _dataLakeAnalyticsAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataLakeAnalyticsAccountResource.ResourceType)); + private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataLakeAnalytics", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAccountsAsync(SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) + { + options ??= new SubscriptionResourceGetAccountsOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DataLakeAnalyticsAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.Orderby, options.Count); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataLakeAnalyticsAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.Orderby, options.Count); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DataLakeAnalyticsAccountBasic.DeserializeDataLakeAnalyticsAccountBasic, DataLakeAnalyticsAccountAccountsClientDiagnostics, Pipeline, "MockableDataLakeAnalyticsSubscriptionResource.GetAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAccounts(SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) + { + options ??= new SubscriptionResourceGetAccountsOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DataLakeAnalyticsAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.Orderby, options.Count); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataLakeAnalyticsAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.Orderby, options.Count); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DataLakeAnalyticsAccountBasic.DeserializeDataLakeAnalyticsAccountBasic, DataLakeAnalyticsAccountAccountsClientDiagnostics, Pipeline, "MockableDataLakeAnalyticsSubscriptionResource.GetAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether the specified account name is available or taken. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckNameAvailability + /// + /// + /// + /// The resource location without whitespace. + /// Parameters supplied to check the Data Lake Analytics account name availability. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDataLakeAnalyticsAccountNameAvailabilityAsync(AzureLocation location, DataLakeAnalyticsAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataLakeAnalyticsAccountAccountsClientDiagnostics.CreateScope("MockableDataLakeAnalyticsSubscriptionResource.CheckDataLakeAnalyticsAccountNameAvailability"); + scope.Start(); + try + { + var response = await DataLakeAnalyticsAccountAccountsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the specified account name is available or taken. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckNameAvailability + /// + /// + /// + /// The resource location without whitespace. + /// Parameters supplied to check the Data Lake Analytics account name availability. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDataLakeAnalyticsAccountNameAvailability(AzureLocation location, DataLakeAnalyticsAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataLakeAnalyticsAccountAccountsClientDiagnostics.CreateScope("MockableDataLakeAnalyticsSubscriptionResource.CheckDataLakeAnalyticsAccountNameAvailability"); + scope.Start(); + try + { + var response = DataLakeAnalyticsAccountAccountsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/capability + /// + /// + /// Operation Id + /// Locations_GetCapability + /// + /// + /// + /// The resource location without whitespace. + /// The cancellation token to use. + public virtual async Task> GetCapabilityLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableDataLakeAnalyticsSubscriptionResource.GetCapabilityLocation"); + scope.Start(); + try + { + var response = await LocationsRestClient.GetCapabilityAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/capability + /// + /// + /// Operation Id + /// Locations_GetCapability + /// + /// + /// + /// The resource location without whitespace. + /// The cancellation token to use. + public virtual Response GetCapabilityLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableDataLakeAnalyticsSubscriptionResource.GetCapabilityLocation"); + scope.Start(); + try + { + var response = LocationsRestClient.GetCapability(Id.SubscriptionId, location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 7e666d930b836..0000000000000 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DataLakeAnalytics -{ - /// 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 DataLakeAnalyticsAccountResources in the ResourceGroupResource. - /// An object representing collection of DataLakeAnalyticsAccountResources and their operations over a DataLakeAnalyticsAccountResource. - public virtual DataLakeAnalyticsAccountCollection GetDataLakeAnalyticsAccounts() - { - return GetCachedClient(Client => new DataLakeAnalyticsAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b69ade11f79f2..0000000000000 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DataLakeAnalytics.Models; - -namespace Azure.ResourceManager.DataLakeAnalytics -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataLakeAnalyticsAccountAccountsClientDiagnostics; - private AccountsRestOperations _dataLakeAnalyticsAccountAccountsRestClient; - private ClientDiagnostics _locationsClientDiagnostics; - private LocationsRestOperations _locationsRestClient; - - /// 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 DataLakeAnalyticsAccountAccountsClientDiagnostics => _dataLakeAnalyticsAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataLakeAnalytics", DataLakeAnalyticsAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations DataLakeAnalyticsAccountAccountsRestClient => _dataLakeAnalyticsAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataLakeAnalyticsAccountResource.ResourceType)); - private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataLakeAnalytics", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAccountsAsync(SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataLakeAnalyticsAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.Orderby, options.Count); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataLakeAnalyticsAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.Orderby, options.Count); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DataLakeAnalyticsAccountBasic.DeserializeDataLakeAnalyticsAccountBasic, DataLakeAnalyticsAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/accounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAccounts(SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataLakeAnalyticsAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.Orderby, options.Count); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataLakeAnalyticsAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.Orderby, options.Count); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DataLakeAnalyticsAccountBasic.DeserializeDataLakeAnalyticsAccountBasic, DataLakeAnalyticsAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Checks whether the specified account name is available or taken. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Accounts_CheckNameAvailability - /// - /// - /// - /// The resource location without whitespace. - /// Parameters supplied to check the Data Lake Analytics account name availability. - /// The cancellation token to use. - public virtual async Task> CheckDataLakeAnalyticsAccountNameAvailabilityAsync(AzureLocation location, DataLakeAnalyticsAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DataLakeAnalyticsAccountAccountsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataLakeAnalyticsAccountNameAvailability"); - scope.Start(); - try - { - var response = await DataLakeAnalyticsAccountAccountsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether the specified account name is available or taken. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Accounts_CheckNameAvailability - /// - /// - /// - /// The resource location without whitespace. - /// Parameters supplied to check the Data Lake Analytics account name availability. - /// The cancellation token to use. - public virtual Response CheckDataLakeAnalyticsAccountNameAvailability(AzureLocation location, DataLakeAnalyticsAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DataLakeAnalyticsAccountAccountsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataLakeAnalyticsAccountNameAvailability"); - scope.Start(); - try - { - var response = DataLakeAnalyticsAccountAccountsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/capability - /// - /// - /// Operation Id - /// Locations_GetCapability - /// - /// - /// - /// The resource location without whitespace. - /// The cancellation token to use. - public virtual async Task> GetCapabilityLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetCapabilityLocation"); - scope.Start(); - try - { - var response = await LocationsRestClient.GetCapabilityAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeAnalytics/locations/{location}/capability - /// - /// - /// Operation Id - /// Locations_GetCapability - /// - /// - /// - /// The resource location without whitespace. - /// The cancellation token to use. - public virtual Response GetCapabilityLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetCapabilityLocation"); - scope.Start(); - try - { - var response = LocationsRestClient.GetCapability(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/api/Azure.ResourceManager.DataLakeStore.netstandard2.0.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/api/Azure.ResourceManager.DataLakeStore.netstandard2.0.cs index a4f382cc28c89..afb3b744d306c 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/api/Azure.ResourceManager.DataLakeStore.netstandard2.0.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/api/Azure.ResourceManager.DataLakeStore.netstandard2.0.cs @@ -199,6 +199,38 @@ protected DataLakeStoreVirtualNetworkRuleResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.DataLakeStore.Models.DataLakeStoreVirtualNetworkRulePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DataLakeStore.Mocking +{ + public partial class MockableDataLakeStoreArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDataLakeStoreArmClient() { } + public virtual Azure.ResourceManager.DataLakeStore.DataLakeStoreAccountResource GetDataLakeStoreAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataLakeStore.DataLakeStoreFirewallRuleResource GetDataLakeStoreFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataLakeStore.DataLakeStoreTrustedIdProviderResource GetDataLakeStoreTrustedIdProviderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataLakeStore.DataLakeStoreVirtualNetworkRuleResource GetDataLakeStoreVirtualNetworkRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDataLakeStoreResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDataLakeStoreResourceGroupResource() { } + public virtual Azure.Response GetDataLakeStoreAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataLakeStoreAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataLakeStore.DataLakeStoreAccountCollection GetDataLakeStoreAccounts() { throw null; } + } + public partial class MockableDataLakeStoreSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDataLakeStoreSubscriptionResource() { } + public virtual Azure.Response CheckDataLakeStoreAccountNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.DataLakeStore.Models.DataLakeStoreAccountNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDataLakeStoreAccountNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataLakeStore.Models.DataLakeStoreAccountNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAccounts(Azure.ResourceManager.DataLakeStore.Models.SubscriptionResourceGetAccountsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAccounts(string filter = null, int? top = default(int?), int? skip = default(int?), string select = null, string orderBy = null, bool? count = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAccountsAsync(Azure.ResourceManager.DataLakeStore.Models.SubscriptionResourceGetAccountsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAccountsAsync(string filter = null, int? top = default(int?), int? skip = default(int?), string select = null, string orderBy = null, bool? count = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCapabilityByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCapabilityByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsagesByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DataLakeStore.Models { public static partial class ArmDataLakeStoreModelFactory diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Custom/Extensions/DataLakeStoreExtensions.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Custom/Extensions/DataLakeStoreExtensions.cs index f6468adf15ba5..32798fe6a2ad8 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Custom/Extensions/DataLakeStoreExtensions.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Custom/Extensions/DataLakeStoreExtensions.cs @@ -1,12 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Text; +using System.Threading; using Azure.ResourceManager.DataLakeStore.Models; using Azure.ResourceManager.Resources; -using System.Threading; namespace Azure.ResourceManager.DataLakeStore { @@ -36,15 +33,7 @@ public static partial class DataLakeStoreExtensions /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAccountsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, int? skip = null, string select = null, string orderBy = null, bool? count = null, CancellationToken cancellationToken = default) { - SubscriptionResourceGetAccountsOptions options = new SubscriptionResourceGetAccountsOptions(); - options.Filter = filter; - options.Top = top; - options.Skip = skip; - options.Select = select; - options.OrderBy = orderBy; - options.Count = count; - - return subscriptionResource.GetAccountsAsync(options, cancellationToken); + return GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).GetAccountsAsync(filter, top, skip, select, orderBy, count, cancellationToken); } /// @@ -71,15 +60,7 @@ public static AsyncPageable GetAccountsAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAccounts(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, int? skip = null, string select = null, string orderBy = null, bool? count = null, CancellationToken cancellationToken = default) { - SubscriptionResourceGetAccountsOptions options = new SubscriptionResourceGetAccountsOptions(); - options.Filter = filter; - options.Top = top; - options.Skip = skip; - options.Select = select; - options.OrderBy = orderBy; - options.Count = count; - - return subscriptionResource.GetAccounts(options, cancellationToken); + return GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).GetAccounts(filter, top, skip, select, orderBy, count, cancellationToken); } } } diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Custom/Extensions/MockableDataLakeStoreSubscriptionResource.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Custom/Extensions/MockableDataLakeStoreSubscriptionResource.cs new file mode 100644 index 0000000000000..b90331913e5d9 --- /dev/null +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Custom/Extensions/MockableDataLakeStoreSubscriptionResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Threading; +using Azure.ResourceManager.DataLakeStore.Models; + +namespace Azure.ResourceManager.DataLakeStore.Mocking +{ + public partial class MockableDataLakeStoreSubscriptionResource : ArmResource + { + /// + /// Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// OData filter. Optional. + /// The number of items to return. Optional. + /// The number of items to skip over before returning elements. Optional. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. + /// OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. + /// The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAccountsAsync(string filter = null, int? top = null, int? skip = null, string select = null, string orderBy = null, bool? count = null, CancellationToken cancellationToken = default) + { + SubscriptionResourceGetAccountsOptions options = new SubscriptionResourceGetAccountsOptions(); + options.Filter = filter; + options.Top = top; + options.Skip = skip; + options.Select = select; + options.OrderBy = orderBy; + options.Count = count; + + return GetAccountsAsync(options, cancellationToken); + } + + /// + /// Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// OData filter. Optional. + /// The number of items to return. Optional. + /// The number of items to skip over before returning elements. Optional. + /// OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional. + /// OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional. + /// The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAccounts(string filter = null, int? top = null, int? skip = null, string select = null, string orderBy = null, bool? count = null, CancellationToken cancellationToken = default) + { + SubscriptionResourceGetAccountsOptions options = new SubscriptionResourceGetAccountsOptions(); + options.Filter = filter; + options.Top = top; + options.Skip = skip; + options.Select = select; + options.OrderBy = orderBy; + options.Count = count; + + return GetAccounts(options, cancellationToken); + } + } +} diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountResource.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountResource.cs index 17590d25ce642..a4e255086fb2c 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountResource.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.DataLakeStore public partial class DataLakeStoreAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataLakeStoreFirewallRuleResources and their operations over a DataLakeStoreFirewallRuleResource. public virtual DataLakeStoreFirewallRuleCollection GetDataLakeStoreFirewallRules() { - return GetCachedClient(Client => new DataLakeStoreFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new DataLakeStoreFirewallRuleCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual DataLakeStoreFirewallRuleCollection GetDataLakeStoreFirewallRules /// /// The name of the firewall rule to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataLakeStoreFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetDataLa /// /// The name of the firewall rule to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataLakeStoreFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -145,7 +148,7 @@ public virtual Response GetDataLakeStoreFirew /// An object representing collection of DataLakeStoreVirtualNetworkRuleResources and their operations over a DataLakeStoreVirtualNetworkRuleResource. public virtual DataLakeStoreVirtualNetworkRuleCollection GetDataLakeStoreVirtualNetworkRules() { - return GetCachedClient(Client => new DataLakeStoreVirtualNetworkRuleCollection(Client, Id)); + return GetCachedClient(client => new DataLakeStoreVirtualNetworkRuleCollection(client, Id)); } /// @@ -163,8 +166,8 @@ public virtual DataLakeStoreVirtualNetworkRuleCollection GetDataLakeStoreVirtual /// /// The name of the virtual network rule to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataLakeStoreVirtualNetworkRuleAsync(string virtualNetworkRuleName, CancellationToken cancellationToken = default) { @@ -186,8 +189,8 @@ public virtual async Task> Get /// /// The name of the virtual network rule to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataLakeStoreVirtualNetworkRule(string virtualNetworkRuleName, CancellationToken cancellationToken = default) { @@ -198,7 +201,7 @@ public virtual Response GetDataLakeStor /// An object representing collection of DataLakeStoreTrustedIdProviderResources and their operations over a DataLakeStoreTrustedIdProviderResource. public virtual DataLakeStoreTrustedIdProviderCollection GetDataLakeStoreTrustedIdProviders() { - return GetCachedClient(Client => new DataLakeStoreTrustedIdProviderCollection(Client, Id)); + return GetCachedClient(client => new DataLakeStoreTrustedIdProviderCollection(client, Id)); } /// @@ -216,8 +219,8 @@ public virtual DataLakeStoreTrustedIdProviderCollection GetDataLakeStoreTrustedI /// /// The name of the trusted identity provider to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataLakeStoreTrustedIdProviderAsync(string trustedIdProviderName, CancellationToken cancellationToken = default) { @@ -239,8 +242,8 @@ public virtual async Task> GetD /// /// The name of the trusted identity provider to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataLakeStoreTrustedIdProvider(string trustedIdProviderName, CancellationToken cancellationToken = default) { diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreFirewallRuleResource.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreFirewallRuleResource.cs index b8015056adfbf..37602cdd80d54 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreFirewallRuleResource.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreFirewallRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataLakeStore public partial class DataLakeStoreFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreTrustedIdProviderResource.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreTrustedIdProviderResource.cs index 3086a93bbf3c1..1df5219fcb29a 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreTrustedIdProviderResource.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreTrustedIdProviderResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataLakeStore public partial class DataLakeStoreTrustedIdProviderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The trustedIdProviderName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string trustedIdProviderName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/trustedIdProviders/{trustedIdProviderName}"; diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreVirtualNetworkRuleResource.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreVirtualNetworkRuleResource.cs index 5f985e99c0089..a0eec079de2b7 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreVirtualNetworkRuleResource.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreVirtualNetworkRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataLakeStore public partial class DataLakeStoreVirtualNetworkRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The virtualNetworkRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string virtualNetworkRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName}/virtualNetworkRules/{virtualNetworkRuleName}"; diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/DataLakeStoreExtensions.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/DataLakeStoreExtensions.cs index fd3244939321a..3b4e024213f06 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/DataLakeStoreExtensions.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/DataLakeStoreExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DataLakeStore.Mocking; using Azure.ResourceManager.DataLakeStore.Models; using Azure.ResourceManager.Resources; @@ -19,119 +20,97 @@ namespace Azure.ResourceManager.DataLakeStore /// A class to add extension methods to Azure.ResourceManager.DataLakeStore. public static partial class DataLakeStoreExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDataLakeStoreArmClient GetMockableDataLakeStoreArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDataLakeStoreArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataLakeStoreResourceGroupResource GetMockableDataLakeStoreResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataLakeStoreResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDataLakeStoreSubscriptionResource GetMockableDataLakeStoreSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDataLakeStoreSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataLakeStoreAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeStoreAccountResource GetDataLakeStoreAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeStoreAccountResource.ValidateResourceId(id); - return new DataLakeStoreAccountResource(client, id); - } - ); + return GetMockableDataLakeStoreArmClient(client).GetDataLakeStoreAccountResource(id); } - #endregion - #region DataLakeStoreFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeStoreFirewallRuleResource GetDataLakeStoreFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeStoreFirewallRuleResource.ValidateResourceId(id); - return new DataLakeStoreFirewallRuleResource(client, id); - } - ); + return GetMockableDataLakeStoreArmClient(client).GetDataLakeStoreFirewallRuleResource(id); } - #endregion - #region DataLakeStoreVirtualNetworkRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeStoreVirtualNetworkRuleResource GetDataLakeStoreVirtualNetworkRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeStoreVirtualNetworkRuleResource.ValidateResourceId(id); - return new DataLakeStoreVirtualNetworkRuleResource(client, id); - } - ); + return GetMockableDataLakeStoreArmClient(client).GetDataLakeStoreVirtualNetworkRuleResource(id); } - #endregion - #region DataLakeStoreTrustedIdProviderResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataLakeStoreTrustedIdProviderResource GetDataLakeStoreTrustedIdProviderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataLakeStoreTrustedIdProviderResource.ValidateResourceId(id); - return new DataLakeStoreTrustedIdProviderResource(client, id); - } - ); + return GetMockableDataLakeStoreArmClient(client).GetDataLakeStoreTrustedIdProviderResource(id); } - #endregion - /// Gets a collection of DataLakeStoreAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of DataLakeStoreAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataLakeStoreAccountResources and their operations over a DataLakeStoreAccountResource. public static DataLakeStoreAccountCollection GetDataLakeStoreAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataLakeStoreAccounts(); + return GetMockableDataLakeStoreResourceGroupResource(resourceGroupResource).GetDataLakeStoreAccounts(); } /// @@ -146,16 +125,20 @@ public static DataLakeStoreAccountCollection GetDataLakeStoreAccounts(this Resou /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Data Lake Store account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataLakeStoreAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataLakeStoreAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableDataLakeStoreResourceGroupResource(resourceGroupResource).GetDataLakeStoreAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -170,16 +153,20 @@ public static async Task> GetDataLakeStor /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Data Lake Store account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataLakeStoreAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataLakeStoreAccounts().Get(accountName, cancellationToken); + return GetMockableDataLakeStoreResourceGroupResource(resourceGroupResource).GetDataLakeStoreAccount(accountName, cancellationToken); } /// @@ -194,6 +181,10 @@ public static Response GetDataLakeStoreAccount(thi /// Accounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -201,9 +192,7 @@ public static Response GetDataLakeStoreAccount(thi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAccountsAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) { - options ??= new SubscriptionResourceGetAccountsOptions(); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAccountsAsync(options, cancellationToken); + return GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).GetAccountsAsync(options, cancellationToken); } /// @@ -218,6 +207,10 @@ public static AsyncPageable GetAccountsAsync(this /// Accounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -225,9 +218,7 @@ public static AsyncPageable GetAccountsAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAccounts(this SubscriptionResource subscriptionResource, SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) { - options ??= new SubscriptionResourceGetAccountsOptions(); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAccounts(options, cancellationToken); + return GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).GetAccounts(options, cancellationToken); } /// @@ -242,6 +233,10 @@ public static Pageable GetAccounts(this Subscript /// Accounts_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. @@ -250,9 +245,7 @@ public static Pageable GetAccounts(this Subscript /// is null. public static async Task> CheckDataLakeStoreAccountNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, DataLakeStoreAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataLakeStoreAccountNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).CheckDataLakeStoreAccountNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -267,6 +260,10 @@ public static async Task> C /// Accounts_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. @@ -275,9 +272,7 @@ public static async Task> C /// is null. public static Response CheckDataLakeStoreAccountNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, DataLakeStoreAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataLakeStoreAccountNameAvailability(location, content, cancellationToken); + return GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).CheckDataLakeStoreAccountNameAvailability(location, content, cancellationToken); } /// @@ -292,13 +287,17 @@ public static Response CheckDataLake /// Locations_GetCapability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. /// The cancellation token to use. public static async Task> GetCapabilityByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapabilityByLocationAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).GetCapabilityByLocationAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -313,13 +312,17 @@ public static async Task> GetCapabi /// Locations_GetCapability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. /// The cancellation token to use. public static Response GetCapabilityByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapabilityByLocation(location, cancellationToken); + return GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).GetCapabilityByLocation(location, cancellationToken); } /// @@ -334,6 +337,10 @@ public static Response GetCapabilityByLocati /// Locations_GetUsage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. @@ -341,7 +348,7 @@ public static Response GetCapabilityByLocati /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesByLocationAsync(location, cancellationToken); + return GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).GetUsagesByLocationAsync(location, cancellationToken); } /// @@ -356,6 +363,10 @@ public static AsyncPageable GetUsagesByLocationAsync(this Su /// Locations_GetUsage /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource location without whitespace. @@ -363,7 +374,7 @@ public static AsyncPageable GetUsagesByLocationAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsagesByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesByLocation(location, cancellationToken); + return GetMockableDataLakeStoreSubscriptionResource(subscriptionResource).GetUsagesByLocation(location, cancellationToken); } } } diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreArmClient.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreArmClient.cs new file mode 100644 index 0000000000000..786a35b6dae07 --- /dev/null +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DataLakeStore; + +namespace Azure.ResourceManager.DataLakeStore.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDataLakeStoreArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataLakeStoreArmClient() + { + } + + /// 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 MockableDataLakeStoreArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDataLakeStoreArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeStoreAccountResource GetDataLakeStoreAccountResource(ResourceIdentifier id) + { + DataLakeStoreAccountResource.ValidateResourceId(id); + return new DataLakeStoreAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeStoreFirewallRuleResource GetDataLakeStoreFirewallRuleResource(ResourceIdentifier id) + { + DataLakeStoreFirewallRuleResource.ValidateResourceId(id); + return new DataLakeStoreFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeStoreVirtualNetworkRuleResource GetDataLakeStoreVirtualNetworkRuleResource(ResourceIdentifier id) + { + DataLakeStoreVirtualNetworkRuleResource.ValidateResourceId(id); + return new DataLakeStoreVirtualNetworkRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataLakeStoreTrustedIdProviderResource GetDataLakeStoreTrustedIdProviderResource(ResourceIdentifier id) + { + DataLakeStoreTrustedIdProviderResource.ValidateResourceId(id); + return new DataLakeStoreTrustedIdProviderResource(Client, id); + } + } +} diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreResourceGroupResource.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreResourceGroupResource.cs new file mode 100644 index 0000000000000..08d16930ebc1b --- /dev/null +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.DataLakeStore; + +namespace Azure.ResourceManager.DataLakeStore.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDataLakeStoreResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataLakeStoreResourceGroupResource() + { + } + + /// 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 MockableDataLakeStoreResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataLakeStoreAccountResources in the ResourceGroupResource. + /// An object representing collection of DataLakeStoreAccountResources and their operations over a DataLakeStoreAccountResource. + public virtual DataLakeStoreAccountCollection GetDataLakeStoreAccounts() + { + return GetCachedClient(client => new DataLakeStoreAccountCollection(client, Id)); + } + + /// + /// Gets the specified Data Lake Store account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Data Lake Store account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataLakeStoreAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetDataLakeStoreAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Data Lake Store account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Data Lake Store account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataLakeStoreAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetDataLakeStoreAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreSubscriptionResource.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreSubscriptionResource.cs new file mode 100644 index 0000000000000..35cde6ddcbd11 --- /dev/null +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/MockableDataLakeStoreSubscriptionResource.cs @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataLakeStore; +using Azure.ResourceManager.DataLakeStore.Models; + +namespace Azure.ResourceManager.DataLakeStore.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDataLakeStoreSubscriptionResource : ArmResource + { + private ClientDiagnostics _dataLakeStoreAccountAccountsClientDiagnostics; + private AccountsRestOperations _dataLakeStoreAccountAccountsRestClient; + private ClientDiagnostics _locationsClientDiagnostics; + private LocationsRestOperations _locationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataLakeStoreSubscriptionResource() + { + } + + /// 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 MockableDataLakeStoreSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataLakeStoreAccountAccountsClientDiagnostics => _dataLakeStoreAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataLakeStore", DataLakeStoreAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations DataLakeStoreAccountAccountsRestClient => _dataLakeStoreAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataLakeStoreAccountResource.ResourceType)); + private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataLakeStore", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAccountsAsync(SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) + { + options ??= new SubscriptionResourceGetAccountsOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DataLakeStoreAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.OrderBy, options.Count); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataLakeStoreAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.OrderBy, options.Count); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DataLakeStoreAccountBasicData.DeserializeDataLakeStoreAccountBasicData, DataLakeStoreAccountAccountsClientDiagnostics, Pipeline, "MockableDataLakeStoreSubscriptionResource.GetAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAccounts(SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) + { + options ??= new SubscriptionResourceGetAccountsOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DataLakeStoreAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.OrderBy, options.Count); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataLakeStoreAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.OrderBy, options.Count); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DataLakeStoreAccountBasicData.DeserializeDataLakeStoreAccountBasicData, DataLakeStoreAccountAccountsClientDiagnostics, Pipeline, "MockableDataLakeStoreSubscriptionResource.GetAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether the specified account name is available or taken. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckNameAvailability + /// + /// + /// + /// The resource location without whitespace. + /// Parameters supplied to check the Data Lake Store account name availability. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDataLakeStoreAccountNameAvailabilityAsync(AzureLocation location, DataLakeStoreAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataLakeStoreAccountAccountsClientDiagnostics.CreateScope("MockableDataLakeStoreSubscriptionResource.CheckDataLakeStoreAccountNameAvailability"); + scope.Start(); + try + { + var response = await DataLakeStoreAccountAccountsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the specified account name is available or taken. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckNameAvailability + /// + /// + /// + /// The resource location without whitespace. + /// Parameters supplied to check the Data Lake Store account name availability. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDataLakeStoreAccountNameAvailability(AzureLocation location, DataLakeStoreAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataLakeStoreAccountAccountsClientDiagnostics.CreateScope("MockableDataLakeStoreSubscriptionResource.CheckDataLakeStoreAccountNameAvailability"); + scope.Start(); + try + { + var response = DataLakeStoreAccountAccountsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets subscription-level properties and limits for Data Lake Store specified by resource location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability + /// + /// + /// Operation Id + /// Locations_GetCapability + /// + /// + /// + /// The resource location without whitespace. + /// The cancellation token to use. + public virtual async Task> GetCapabilityByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableDataLakeStoreSubscriptionResource.GetCapabilityByLocation"); + scope.Start(); + try + { + var response = await LocationsRestClient.GetCapabilityAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets subscription-level properties and limits for Data Lake Store specified by resource location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability + /// + /// + /// Operation Id + /// Locations_GetCapability + /// + /// + /// + /// The resource location without whitespace. + /// The cancellation token to use. + public virtual Response GetCapabilityByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableDataLakeStoreSubscriptionResource.GetCapabilityByLocation"); + scope.Start(); + try + { + var response = LocationsRestClient.GetCapability(Id.SubscriptionId, location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the current usage count and the limit for the resources of the location under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages + /// + /// + /// Operation Id + /// Locations_GetUsage + /// + /// + /// + /// The resource location without whitespace. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationsRestClient.CreateGetUsageRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DataLakeStoreUsage.DeserializeDataLakeStoreUsage, LocationsClientDiagnostics, Pipeline, "MockableDataLakeStoreSubscriptionResource.GetUsagesByLocation", "value", null, cancellationToken); + } + + /// + /// Gets the current usage count and the limit for the resources of the location under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages + /// + /// + /// Operation Id + /// Locations_GetUsage + /// + /// + /// + /// The resource location without whitespace. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsagesByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationsRestClient.CreateGetUsageRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, DataLakeStoreUsage.DeserializeDataLakeStoreUsage, LocationsClientDiagnostics, Pipeline, "MockableDataLakeStoreSubscriptionResource.GetUsagesByLocation", "value", null, cancellationToken); + } + } +} diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3690c2ade852a..0000000000000 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DataLakeStore -{ - /// 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 DataLakeStoreAccountResources in the ResourceGroupResource. - /// An object representing collection of DataLakeStoreAccountResources and their operations over a DataLakeStoreAccountResource. - public virtual DataLakeStoreAccountCollection GetDataLakeStoreAccounts() - { - return GetCachedClient(Client => new DataLakeStoreAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index bcb106d3a4fa0..0000000000000 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DataLakeStore.Models; - -namespace Azure.ResourceManager.DataLakeStore -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataLakeStoreAccountAccountsClientDiagnostics; - private AccountsRestOperations _dataLakeStoreAccountAccountsRestClient; - private ClientDiagnostics _locationsClientDiagnostics; - private LocationsRestOperations _locationsRestClient; - - /// 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 DataLakeStoreAccountAccountsClientDiagnostics => _dataLakeStoreAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataLakeStore", DataLakeStoreAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations DataLakeStoreAccountAccountsRestClient => _dataLakeStoreAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataLakeStoreAccountResource.ResourceType)); - private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataLakeStore", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAccountsAsync(SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataLakeStoreAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.OrderBy, options.Count); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataLakeStoreAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.OrderBy, options.Count); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DataLakeStoreAccountBasicData.DeserializeDataLakeStoreAccountBasicData, DataLakeStoreAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the Data Lake Store accounts within the subscription. The response includes a link to the next page of results, if any. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/accounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAccounts(SubscriptionResourceGetAccountsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataLakeStoreAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.OrderBy, options.Count); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataLakeStoreAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, options.Filter, options.Top, options.Skip, options.Select, options.OrderBy, options.Count); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DataLakeStoreAccountBasicData.DeserializeDataLakeStoreAccountBasicData, DataLakeStoreAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Checks whether the specified account name is available or taken. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Accounts_CheckNameAvailability - /// - /// - /// - /// The resource location without whitespace. - /// Parameters supplied to check the Data Lake Store account name availability. - /// The cancellation token to use. - public virtual async Task> CheckDataLakeStoreAccountNameAvailabilityAsync(AzureLocation location, DataLakeStoreAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DataLakeStoreAccountAccountsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataLakeStoreAccountNameAvailability"); - scope.Start(); - try - { - var response = await DataLakeStoreAccountAccountsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether the specified account name is available or taken. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Accounts_CheckNameAvailability - /// - /// - /// - /// The resource location without whitespace. - /// Parameters supplied to check the Data Lake Store account name availability. - /// The cancellation token to use. - public virtual Response CheckDataLakeStoreAccountNameAvailability(AzureLocation location, DataLakeStoreAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DataLakeStoreAccountAccountsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataLakeStoreAccountNameAvailability"); - scope.Start(); - try - { - var response = DataLakeStoreAccountAccountsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets subscription-level properties and limits for Data Lake Store specified by resource location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability - /// - /// - /// Operation Id - /// Locations_GetCapability - /// - /// - /// - /// The resource location without whitespace. - /// The cancellation token to use. - public virtual async Task> GetCapabilityByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetCapabilityByLocation"); - scope.Start(); - try - { - var response = await LocationsRestClient.GetCapabilityAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets subscription-level properties and limits for Data Lake Store specified by resource location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/capability - /// - /// - /// Operation Id - /// Locations_GetCapability - /// - /// - /// - /// The resource location without whitespace. - /// The cancellation token to use. - public virtual Response GetCapabilityByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetCapabilityByLocation"); - scope.Start(); - try - { - var response = LocationsRestClient.GetCapability(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the current usage count and the limit for the resources of the location under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages - /// - /// - /// Operation Id - /// Locations_GetUsage - /// - /// - /// - /// The resource location without whitespace. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationsRestClient.CreateGetUsageRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, DataLakeStoreUsage.DeserializeDataLakeStoreUsage, LocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesByLocation", "value", null, cancellationToken); - } - - /// - /// Gets the current usage count and the limit for the resources of the location under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataLakeStore/locations/{location}/usages - /// - /// - /// Operation Id - /// Locations_GetUsage - /// - /// - /// - /// The resource location without whitespace. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsagesByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationsRestClient.CreateGetUsageRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, DataLakeStoreUsage.DeserializeDataLakeStoreUsage, LocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesByLocation", "value", null, cancellationToken); - } - } -} diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/Azure.ResourceManager.DataMigration.sln b/sdk/datamigration/Azure.ResourceManager.DataMigration/Azure.ResourceManager.DataMigration.sln index ea4ba06f7683c..b302bb8bc8e48 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/Azure.ResourceManager.DataMigration.sln +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/Azure.ResourceManager.DataMigration.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{A11A9529-0A09-4ECB-9CE4-E7A6D6BA67DA}") = "Azure.ResourceManager.DataMigration", "src\Azure.ResourceManager.DataMigration.csproj", "{72E0B68A-F03E-4493-BE60-1DA3ADCE2CD1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DataMigration", "src\Azure.ResourceManager.DataMigration.csproj", "{72E0B68A-F03E-4493-BE60-1DA3ADCE2CD1}" EndProject -Project("{A11A9529-0A09-4ECB-9CE4-E7A6D6BA67DA}") = "Azure.ResourceManager.DataMigration.Tests", "tests\Azure.ResourceManager.DataMigration.Tests.csproj", "{5FE72E02-3B8F-47FF-A0A9-27F7239868D3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DataMigration.Tests", "tests\Azure.ResourceManager.DataMigration.Tests.csproj", "{5FE72E02-3B8F-47FF-A0A9-27F7239868D3}" EndProject -Project("{A11A9529-0A09-4ECB-9CE4-E7A6D6BA67DA}") = "Azure.ResourceManager.DataMigration.Samples", "samples\Azure.ResourceManager.DataMigration.Samples.csproj", "{FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DataMigration.Samples", "samples\Azure.ResourceManager.DataMigration.Samples.csproj", "{FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {FC6C8781-EBB4-4E67-85BC-34B574916093} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {5FE72E02-3B8F-47FF-A0A9-27F7239868D3}.Release|x64.Build.0 = Release|Any CPU {5FE72E02-3B8F-47FF-A0A9-27F7239868D3}.Release|x86.ActiveCfg = Release|Any CPU {5FE72E02-3B8F-47FF-A0A9-27F7239868D3}.Release|x86.Build.0 = Release|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Debug|x64.ActiveCfg = Debug|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Debug|x64.Build.0 = Debug|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Debug|x86.ActiveCfg = Debug|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Debug|x86.Build.0 = Debug|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Release|Any CPU.Build.0 = Release|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Release|x64.ActiveCfg = Release|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Release|x64.Build.0 = Release|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Release|x86.ActiveCfg = Release|Any CPU + {FF93ECC6-4D2C-4A94-85AB-A5F4251FB331}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FC6C8781-EBB4-4E67-85BC-34B574916093} EndGlobalSection EndGlobal diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/api/Azure.ResourceManager.DataMigration.netstandard2.0.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/api/Azure.ResourceManager.DataMigration.netstandard2.0.cs index cec3d8bda116d..9232d1245577b 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/api/Azure.ResourceManager.DataMigration.netstandard2.0.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/api/Azure.ResourceManager.DataMigration.netstandard2.0.cs @@ -155,7 +155,7 @@ protected DataMigrationServiceCollection() { } } public partial class DataMigrationServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public DataMigrationServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DataMigrationServiceData(Azure.Core.AzureLocation location) { } public string AutoStopDelay { get { throw null; } set { } } public bool? DeleteResourcesOnStop { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } @@ -221,7 +221,7 @@ protected ProjectCollection() { } } public partial class ProjectData : Azure.ResourceManager.Models.TrackedResourceData { - public ProjectData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ProjectData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DataMigration.Models.AzureActiveDirectoryApp AzureAuthenticationInfo { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public System.Collections.Generic.IList DatabasesInfo { get { throw null; } } @@ -392,7 +392,7 @@ protected SqlMigrationServiceCollection() { } } public partial class SqlMigrationServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public SqlMigrationServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SqlMigrationServiceData(Azure.Core.AzureLocation location) { } public string IntegrationRuntimeState { get { throw null; } } public string ProvisioningState { get { throw null; } } } @@ -427,6 +427,55 @@ protected SqlMigrationServiceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DataMigration.Models.SqlMigrationServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DataMigration.Mocking +{ + public partial class MockableDataMigrationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDataMigrationArmClient() { } + public virtual Azure.ResourceManager.DataMigration.DatabaseMigrationSqlDBResource GetDatabaseMigrationSqlDBResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataMigration.DatabaseMigrationSqlMIResource GetDatabaseMigrationSqlMIResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataMigration.DatabaseMigrationSqlVmResource GetDatabaseMigrationSqlVmResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataMigration.DataMigrationServiceResource GetDataMigrationServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataMigration.ProjectFileResource GetProjectFileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataMigration.ProjectResource GetProjectResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataMigration.ServiceProjectTaskResource GetServiceProjectTaskResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataMigration.ServiceServiceTaskResource GetServiceServiceTaskResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataMigration.SqlMigrationServiceResource GetSqlMigrationServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDataMigrationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDataMigrationResourceGroupResource() { } + public virtual Azure.Response GetDatabaseMigrationSqlDB(string sqlDBInstanceName, string targetDBName, System.Guid? migrationOperationId = default(System.Guid?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseMigrationSqlDBAsync(string sqlDBInstanceName, string targetDBName, System.Guid? migrationOperationId = default(System.Guid?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataMigration.DatabaseMigrationSqlDBCollection GetDatabaseMigrationSqlDBs() { throw null; } + public virtual Azure.Response GetDatabaseMigrationSqlMI(string managedInstanceName, string targetDBName, System.Guid? migrationOperationId = default(System.Guid?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseMigrationSqlMIAsync(string managedInstanceName, string targetDBName, System.Guid? migrationOperationId = default(System.Guid?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataMigration.DatabaseMigrationSqlMICollection GetDatabaseMigrationSqlMIs() { throw null; } + public virtual Azure.Response GetDatabaseMigrationSqlVm(string sqlVirtualMachineName, string targetDBName, System.Guid? migrationOperationId = default(System.Guid?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseMigrationSqlVmAsync(string sqlVirtualMachineName, string targetDBName, System.Guid? migrationOperationId = default(System.Guid?), string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataMigration.DatabaseMigrationSqlVmCollection GetDatabaseMigrationSqlVms() { throw null; } + public virtual Azure.Response GetDataMigrationService(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataMigrationServiceAsync(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataMigration.DataMigrationServiceCollection GetDataMigrationServices() { throw null; } + public virtual Azure.Response GetSqlMigrationService(string sqlMigrationServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSqlMigrationServiceAsync(string sqlMigrationServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataMigration.SqlMigrationServiceCollection GetSqlMigrationServices() { throw null; } + } + public partial class MockableDataMigrationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDataMigrationSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityService(Azure.Core.AzureLocation location, Azure.ResourceManager.DataMigration.Models.NameAvailabilityRequest nameAvailabilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityServiceAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataMigration.Models.NameAvailabilityRequest nameAvailabilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataMigrationServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataMigrationServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkusResourceSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusResourceSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSqlMigrationServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSqlMigrationServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsages(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DataMigration.Models { public static partial class ArmDataMigrationModelFactory diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceResource.cs index 3cf06e017eef0..a03358542d75b 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DataMigration public partial class DataMigrationServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The groupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string groupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceServiceTaskResources and their operations over a ServiceServiceTaskResource. public virtual ServiceServiceTaskCollection GetServiceServiceTasks() { - return GetCachedClient(Client => new ServiceServiceTaskCollection(Client, Id)); + return GetCachedClient(client => new ServiceServiceTaskCollection(client, Id)); } /// @@ -113,8 +116,8 @@ public virtual ServiceServiceTaskCollection GetServiceServiceTasks() /// Name of the Task. /// Expand the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceServiceTaskAsync(string taskName, string expand = null, CancellationToken cancellationToken = default) { @@ -137,8 +140,8 @@ public virtual async Task> GetServiceServic /// Name of the Task. /// Expand the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceServiceTask(string taskName, string expand = null, CancellationToken cancellationToken = default) { @@ -149,7 +152,7 @@ public virtual Response GetServiceServiceTask(string /// An object representing collection of ProjectResources and their operations over a ProjectResource. public virtual ProjectCollection GetProjects() { - return GetCachedClient(Client => new ProjectCollection(Client, Id)); + return GetCachedClient(client => new ProjectCollection(client, Id)); } /// @@ -167,8 +170,8 @@ public virtual ProjectCollection GetProjects() /// /// Name of the project. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProjectAsync(string projectName, CancellationToken cancellationToken = default) { @@ -190,8 +193,8 @@ public virtual async Task> GetProjectAsync(string proj /// /// Name of the project. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProject(string projectName, CancellationToken cancellationToken = default) { diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlDBResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlDBResource.cs index 60203239b2a92..02ed637ba5ddb 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlDBResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlDBResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DataMigration public partial class DatabaseMigrationSqlDBResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sqlDBInstanceName. + /// The targetDBName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sqlDBInstanceName, string targetDBName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDBInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDBName}"; diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlMIResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlMIResource.cs index dc06b5036db08..e985e15488374 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlMIResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlMIResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DataMigration public partial class DatabaseMigrationSqlMIResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The targetDBName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string targetDBName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDBName}"; diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlVmResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlVmResource.cs index 509faf034c4a7..3236886f4a5ab 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlVmResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DatabaseMigrationSqlVmResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DataMigration public partial class DatabaseMigrationSqlVmResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sqlVirtualMachineName. + /// The targetDBName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sqlVirtualMachineName, string targetDBName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDBName}"; diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/DataMigrationExtensions.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/DataMigrationExtensions.cs index d86dcd38a6afa..2a68380bc6572 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/DataMigrationExtensions.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/DataMigrationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DataMigration.Mocking; using Azure.ResourceManager.DataMigration.Models; using Azure.ResourceManager.Resources; @@ -19,214 +20,177 @@ namespace Azure.ResourceManager.DataMigration /// A class to add extension methods to Azure.ResourceManager.DataMigration. public static partial class DataMigrationExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDataMigrationArmClient GetMockableDataMigrationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDataMigrationArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataMigrationResourceGroupResource GetMockableDataMigrationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataMigrationResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDataMigrationSubscriptionResource GetMockableDataMigrationSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDataMigrationSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DatabaseMigrationSqlDBResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DatabaseMigrationSqlDBResource GetDatabaseMigrationSqlDBResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DatabaseMigrationSqlDBResource.ValidateResourceId(id); - return new DatabaseMigrationSqlDBResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetDatabaseMigrationSqlDBResource(id); } - #endregion - #region DatabaseMigrationSqlMIResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DatabaseMigrationSqlMIResource GetDatabaseMigrationSqlMIResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DatabaseMigrationSqlMIResource.ValidateResourceId(id); - return new DatabaseMigrationSqlMIResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetDatabaseMigrationSqlMIResource(id); } - #endregion - #region DatabaseMigrationSqlVmResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DatabaseMigrationSqlVmResource GetDatabaseMigrationSqlVmResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DatabaseMigrationSqlVmResource.ValidateResourceId(id); - return new DatabaseMigrationSqlVmResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetDatabaseMigrationSqlVmResource(id); } - #endregion - #region SqlMigrationServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlMigrationServiceResource GetSqlMigrationServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlMigrationServiceResource.ValidateResourceId(id); - return new SqlMigrationServiceResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetSqlMigrationServiceResource(id); } - #endregion - #region DataMigrationServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataMigrationServiceResource GetDataMigrationServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataMigrationServiceResource.ValidateResourceId(id); - return new DataMigrationServiceResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetDataMigrationServiceResource(id); } - #endregion - #region ServiceProjectTaskResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceProjectTaskResource GetServiceProjectTaskResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceProjectTaskResource.ValidateResourceId(id); - return new ServiceProjectTaskResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetServiceProjectTaskResource(id); } - #endregion - #region ServiceServiceTaskResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceServiceTaskResource GetServiceServiceTaskResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceServiceTaskResource.ValidateResourceId(id); - return new ServiceServiceTaskResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetServiceServiceTaskResource(id); } - #endregion - #region ProjectResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProjectResource GetProjectResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProjectResource.ValidateResourceId(id); - return new ProjectResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetProjectResource(id); } - #endregion - #region ProjectFileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProjectFileResource GetProjectFileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProjectFileResource.ValidateResourceId(id); - return new ProjectFileResource(client, id); - } - ); + return GetMockableDataMigrationArmClient(client).GetProjectFileResource(id); } - #endregion - /// Gets a collection of DatabaseMigrationSqlDBResources in the ResourceGroupResource. + /// + /// Gets a collection of DatabaseMigrationSqlDBResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DatabaseMigrationSqlDBResources and their operations over a DatabaseMigrationSqlDBResource. public static DatabaseMigrationSqlDBCollection GetDatabaseMigrationSqlDBs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDatabaseMigrationSqlDBs(); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlDBs(); } /// @@ -241,6 +205,10 @@ public static DatabaseMigrationSqlDBCollection GetDatabaseMigrationSqlDBs(this R /// DatabaseMigrationsSqlDb_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -248,12 +216,12 @@ public static DatabaseMigrationSqlDBCollection GetDatabaseMigrationSqlDBs(this R /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. /// Complete migration details be included in the response. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDatabaseMigrationSqlDBAsync(this ResourceGroupResource resourceGroupResource, string sqlDBInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDatabaseMigrationSqlDBs().GetAsync(sqlDBInstanceName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlDBAsync(sqlDBInstanceName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); } /// @@ -268,6 +236,10 @@ public static async Task> GetDatabaseMi /// DatabaseMigrationsSqlDb_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -275,20 +247,26 @@ public static async Task> GetDatabaseMi /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. /// Complete migration details be included in the response. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDatabaseMigrationSqlDB(this ResourceGroupResource resourceGroupResource, string sqlDBInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDatabaseMigrationSqlDBs().Get(sqlDBInstanceName, targetDBName, migrationOperationId, expand, cancellationToken); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlDB(sqlDBInstanceName, targetDBName, migrationOperationId, expand, cancellationToken); } - /// Gets a collection of DatabaseMigrationSqlMIResources in the ResourceGroupResource. + /// + /// Gets a collection of DatabaseMigrationSqlMIResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DatabaseMigrationSqlMIResources and their operations over a DatabaseMigrationSqlMIResource. public static DatabaseMigrationSqlMICollection GetDatabaseMigrationSqlMIs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDatabaseMigrationSqlMIs(); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlMIs(); } /// @@ -303,6 +281,10 @@ public static DatabaseMigrationSqlMICollection GetDatabaseMigrationSqlMIs(this R /// DatabaseMigrationsSqlMi_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -310,12 +292,12 @@ public static DatabaseMigrationSqlMICollection GetDatabaseMigrationSqlMIs(this R /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. /// Complete migration details be included in the response. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDatabaseMigrationSqlMIAsync(this ResourceGroupResource resourceGroupResource, string managedInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDatabaseMigrationSqlMIs().GetAsync(managedInstanceName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlMIAsync(managedInstanceName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); } /// @@ -330,6 +312,10 @@ public static async Task> GetDatabaseMi /// DatabaseMigrationsSqlMi_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -337,20 +323,26 @@ public static async Task> GetDatabaseMi /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. /// Complete migration details be included in the response. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDatabaseMigrationSqlMI(this ResourceGroupResource resourceGroupResource, string managedInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDatabaseMigrationSqlMIs().Get(managedInstanceName, targetDBName, migrationOperationId, expand, cancellationToken); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlMI(managedInstanceName, targetDBName, migrationOperationId, expand, cancellationToken); } - /// Gets a collection of DatabaseMigrationSqlVmResources in the ResourceGroupResource. + /// + /// Gets a collection of DatabaseMigrationSqlVmResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DatabaseMigrationSqlVmResources and their operations over a DatabaseMigrationSqlVmResource. public static DatabaseMigrationSqlVmCollection GetDatabaseMigrationSqlVms(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDatabaseMigrationSqlVms(); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlVms(); } /// @@ -365,6 +357,10 @@ public static DatabaseMigrationSqlVmCollection GetDatabaseMigrationSqlVms(this R /// DatabaseMigrationsSqlVm_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -372,12 +368,12 @@ public static DatabaseMigrationSqlVmCollection GetDatabaseMigrationSqlVms(this R /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. /// Complete migration details be included in the response. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDatabaseMigrationSqlVmAsync(this ResourceGroupResource resourceGroupResource, string sqlVirtualMachineName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDatabaseMigrationSqlVms().GetAsync(sqlVirtualMachineName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlVmAsync(sqlVirtualMachineName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); } /// @@ -392,6 +388,10 @@ public static async Task> GetDatabaseMi /// DatabaseMigrationsSqlVm_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -399,20 +399,26 @@ public static async Task> GetDatabaseMi /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. /// Complete migration details be included in the response. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDatabaseMigrationSqlVm(this ResourceGroupResource resourceGroupResource, string sqlVirtualMachineName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDatabaseMigrationSqlVms().Get(sqlVirtualMachineName, targetDBName, migrationOperationId, expand, cancellationToken); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDatabaseMigrationSqlVm(sqlVirtualMachineName, targetDBName, migrationOperationId, expand, cancellationToken); } - /// Gets a collection of SqlMigrationServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of SqlMigrationServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SqlMigrationServiceResources and their operations over a SqlMigrationServiceResource. public static SqlMigrationServiceCollection GetSqlMigrationServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSqlMigrationServices(); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetSqlMigrationServices(); } /// @@ -427,16 +433,20 @@ public static SqlMigrationServiceCollection GetSqlMigrationServices(this Resourc /// SqlMigrationServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the SQL Migration Service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSqlMigrationServiceAsync(this ResourceGroupResource resourceGroupResource, string sqlMigrationServiceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSqlMigrationServices().GetAsync(sqlMigrationServiceName, cancellationToken).ConfigureAwait(false); + return await GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetSqlMigrationServiceAsync(sqlMigrationServiceName, cancellationToken).ConfigureAwait(false); } /// @@ -451,24 +461,34 @@ public static async Task> GetSqlMigrationS /// SqlMigrationServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the SQL Migration Service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSqlMigrationService(this ResourceGroupResource resourceGroupResource, string sqlMigrationServiceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSqlMigrationServices().Get(sqlMigrationServiceName, cancellationToken); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetSqlMigrationService(sqlMigrationServiceName, cancellationToken); } - /// Gets a collection of DataMigrationServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of DataMigrationServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataMigrationServiceResources and their operations over a DataMigrationServiceResource. public static DataMigrationServiceCollection GetDataMigrationServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataMigrationServices(); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDataMigrationServices(); } /// @@ -483,16 +503,20 @@ public static DataMigrationServiceCollection GetDataMigrationServices(this Resou /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataMigrationServiceAsync(this ResourceGroupResource resourceGroupResource, string serviceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataMigrationServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + return await GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDataMigrationServiceAsync(serviceName, cancellationToken).ConfigureAwait(false); } /// @@ -507,16 +531,20 @@ public static async Task> GetDataMigratio /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataMigrationService(this ResourceGroupResource resourceGroupResource, string serviceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataMigrationServices().Get(serviceName, cancellationToken); + return GetMockableDataMigrationResourceGroupResource(resourceGroupResource).GetDataMigrationService(serviceName, cancellationToken); } /// @@ -531,13 +559,17 @@ public static Response GetDataMigrationService(thi /// SqlMigrationServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSqlMigrationServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlMigrationServicesAsync(cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).GetSqlMigrationServicesAsync(cancellationToken); } /// @@ -552,13 +584,17 @@ public static AsyncPageable GetSqlMigrationServices /// SqlMigrationServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSqlMigrationServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlMigrationServices(cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).GetSqlMigrationServices(cancellationToken); } /// @@ -573,13 +609,17 @@ public static Pageable GetSqlMigrationServices(this /// ResourceSkus_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkusResourceSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusResourceSkusAsync(cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).GetSkusResourceSkusAsync(cancellationToken); } /// @@ -594,13 +634,17 @@ public static AsyncPageable GetSkusResourceSkusAsync(this Subscript /// ResourceSkus_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkusResourceSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusResourceSkus(cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).GetSkusResourceSkus(cancellationToken); } /// @@ -615,13 +659,17 @@ public static Pageable GetSkusResourceSkus(this SubscriptionResourc /// Services_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataMigrationServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataMigrationServicesAsync(cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).GetDataMigrationServicesAsync(cancellationToken); } /// @@ -636,13 +684,17 @@ public static AsyncPageable GetDataMigrationServic /// Services_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataMigrationServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataMigrationServices(cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).GetDataMigrationServices(cancellationToken); } /// @@ -657,6 +709,10 @@ public static Pageable GetDataMigrationServices(th /// Services_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure region of the operation. @@ -665,9 +721,7 @@ public static Pageable GetDataMigrationServices(th /// is null. public static async Task> CheckNameAvailabilityServiceAsync(this SubscriptionResource subscriptionResource, AzureLocation location, NameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityServiceAsync(location, nameAvailabilityRequest, cancellationToken).ConfigureAwait(false); + return await GetMockableDataMigrationSubscriptionResource(subscriptionResource).CheckNameAvailabilityServiceAsync(location, nameAvailabilityRequest, cancellationToken).ConfigureAwait(false); } /// @@ -682,6 +736,10 @@ public static async Task> CheckNameAvailabili /// Services_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure region of the operation. @@ -690,9 +748,7 @@ public static async Task> CheckNameAvailabili /// is null. public static Response CheckNameAvailabilityService(this SubscriptionResource subscriptionResource, AzureLocation location, NameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityService(location, nameAvailabilityRequest, cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).CheckNameAvailabilityService(location, nameAvailabilityRequest, cancellationToken); } /// @@ -707,6 +763,10 @@ public static Response CheckNameAvailabilityService(th /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure region of the operation. @@ -714,7 +774,7 @@ public static Response CheckNameAvailabilityService(th /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesAsync(location, cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).GetUsagesAsync(location, cancellationToken); } /// @@ -729,6 +789,10 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionResource subs /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure region of the operation. @@ -736,7 +800,7 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionResource subs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsages(location, cancellationToken); + return GetMockableDataMigrationSubscriptionResource(subscriptionResource).GetUsages(location, cancellationToken); } } } diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationArmClient.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationArmClient.cs new file mode 100644 index 0000000000000..d594034801093 --- /dev/null +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationArmClient.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DataMigration; + +namespace Azure.ResourceManager.DataMigration.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDataMigrationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataMigrationArmClient() + { + } + + /// 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 MockableDataMigrationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDataMigrationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DatabaseMigrationSqlDBResource GetDatabaseMigrationSqlDBResource(ResourceIdentifier id) + { + DatabaseMigrationSqlDBResource.ValidateResourceId(id); + return new DatabaseMigrationSqlDBResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DatabaseMigrationSqlMIResource GetDatabaseMigrationSqlMIResource(ResourceIdentifier id) + { + DatabaseMigrationSqlMIResource.ValidateResourceId(id); + return new DatabaseMigrationSqlMIResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DatabaseMigrationSqlVmResource GetDatabaseMigrationSqlVmResource(ResourceIdentifier id) + { + DatabaseMigrationSqlVmResource.ValidateResourceId(id); + return new DatabaseMigrationSqlVmResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlMigrationServiceResource GetSqlMigrationServiceResource(ResourceIdentifier id) + { + SqlMigrationServiceResource.ValidateResourceId(id); + return new SqlMigrationServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataMigrationServiceResource GetDataMigrationServiceResource(ResourceIdentifier id) + { + DataMigrationServiceResource.ValidateResourceId(id); + return new DataMigrationServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceProjectTaskResource GetServiceProjectTaskResource(ResourceIdentifier id) + { + ServiceProjectTaskResource.ValidateResourceId(id); + return new ServiceProjectTaskResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceServiceTaskResource GetServiceServiceTaskResource(ResourceIdentifier id) + { + ServiceServiceTaskResource.ValidateResourceId(id); + return new ServiceServiceTaskResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProjectResource GetProjectResource(ResourceIdentifier id) + { + ProjectResource.ValidateResourceId(id); + return new ProjectResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProjectFileResource GetProjectFileResource(ResourceIdentifier id) + { + ProjectFileResource.ValidateResourceId(id); + return new ProjectFileResource(Client, id); + } + } +} diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationResourceGroupResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationResourceGroupResource.cs new file mode 100644 index 0000000000000..a0e2c63ff9227 --- /dev/null +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationResourceGroupResource.cs @@ -0,0 +1,322 @@ +// 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.DataMigration; + +namespace Azure.ResourceManager.DataMigration.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDataMigrationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataMigrationResourceGroupResource() + { + } + + /// 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 MockableDataMigrationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DatabaseMigrationSqlDBResources in the ResourceGroupResource. + /// An object representing collection of DatabaseMigrationSqlDBResources and their operations over a DatabaseMigrationSqlDBResource. + public virtual DatabaseMigrationSqlDBCollection GetDatabaseMigrationSqlDBs() + { + return GetCachedClient(client => new DatabaseMigrationSqlDBCollection(client, Id)); + } + + /// + /// Retrieve the Database Migration resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlDb_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseMigrationSqlDBAsync(string sqlDBInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + return await GetDatabaseMigrationSqlDBs().GetAsync(sqlDBInstanceName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve the Database Migration resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{sqlDbInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlDb_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatabaseMigrationSqlDB(string sqlDBInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + return GetDatabaseMigrationSqlDBs().Get(sqlDBInstanceName, targetDBName, migrationOperationId, expand, cancellationToken); + } + + /// Gets a collection of DatabaseMigrationSqlMIResources in the ResourceGroupResource. + /// An object representing collection of DatabaseMigrationSqlMIResources and their operations over a DatabaseMigrationSqlMIResource. + public virtual DatabaseMigrationSqlMICollection GetDatabaseMigrationSqlMIs() + { + return GetCachedClient(client => new DatabaseMigrationSqlMICollection(client, Id)); + } + + /// + /// Retrieve the specified database migration for a given SQL Managed Instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlMi_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseMigrationSqlMIAsync(string managedInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + return await GetDatabaseMigrationSqlMIs().GetAsync(managedInstanceName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve the specified database migration for a given SQL Managed Instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlMi_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatabaseMigrationSqlMI(string managedInstanceName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + return GetDatabaseMigrationSqlMIs().Get(managedInstanceName, targetDBName, migrationOperationId, expand, cancellationToken); + } + + /// Gets a collection of DatabaseMigrationSqlVmResources in the ResourceGroupResource. + /// An object representing collection of DatabaseMigrationSqlVmResources and their operations over a DatabaseMigrationSqlVmResource. + public virtual DatabaseMigrationSqlVmCollection GetDatabaseMigrationSqlVms() + { + return GetCachedClient(client => new DatabaseMigrationSqlVmCollection(client, Id)); + } + + /// + /// Retrieve the specified database migration for a given SQL VM. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlVm_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseMigrationSqlVmAsync(string sqlVirtualMachineName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + return await GetDatabaseMigrationSqlVms().GetAsync(sqlVirtualMachineName, targetDBName, migrationOperationId, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve the specified database migration for a given SQL VM. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName} + /// + /// + /// Operation Id + /// DatabaseMigrationsSqlVm_Get + /// + /// + /// + /// The String to use. + /// The name of the target database. + /// Optional migration operation ID. If this is provided, then details of migration operation for that ID are retrieved. If not provided (default), then details related to most recent or current operation are retrieved. + /// Complete migration details be included in the response. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatabaseMigrationSqlVm(string sqlVirtualMachineName, string targetDBName, Guid? migrationOperationId = null, string expand = null, CancellationToken cancellationToken = default) + { + return GetDatabaseMigrationSqlVms().Get(sqlVirtualMachineName, targetDBName, migrationOperationId, expand, cancellationToken); + } + + /// Gets a collection of SqlMigrationServiceResources in the ResourceGroupResource. + /// An object representing collection of SqlMigrationServiceResources and their operations over a SqlMigrationServiceResource. + public virtual SqlMigrationServiceCollection GetSqlMigrationServices() + { + return GetCachedClient(client => new SqlMigrationServiceCollection(client, Id)); + } + + /// + /// Retrieve the Database Migration Service + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices/{sqlMigrationServiceName} + /// + /// + /// Operation Id + /// SqlMigrationServices_Get + /// + /// + /// + /// Name of the SQL Migration Service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlMigrationServiceAsync(string sqlMigrationServiceName, CancellationToken cancellationToken = default) + { + return await GetSqlMigrationServices().GetAsync(sqlMigrationServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve the Database Migration Service + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices/{sqlMigrationServiceName} + /// + /// + /// Operation Id + /// SqlMigrationServices_Get + /// + /// + /// + /// Name of the SQL Migration Service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlMigrationService(string sqlMigrationServiceName, CancellationToken cancellationToken = default) + { + return GetSqlMigrationServices().Get(sqlMigrationServiceName, cancellationToken); + } + + /// Gets a collection of DataMigrationServiceResources in the ResourceGroupResource. + /// An object representing collection of DataMigrationServiceResources and their operations over a DataMigrationServiceResource. + public virtual DataMigrationServiceCollection GetDataMigrationServices() + { + return GetCachedClient(client => new DataMigrationServiceCollection(client, Id)); + } + + /// + /// The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Name of the service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataMigrationServiceAsync(string serviceName, CancellationToken cancellationToken = default) + { + return await GetDataMigrationServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// The services resource is the top-level resource that represents the Database Migration Service. The GET method retrieves information about a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Name of the service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataMigrationService(string serviceName, CancellationToken cancellationToken = default) + { + return GetDataMigrationServices().Get(serviceName, cancellationToken); + } + } +} diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationSubscriptionResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationSubscriptionResource.cs new file mode 100644 index 0000000000000..fbda8a267ac08 --- /dev/null +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/MockableDataMigrationSubscriptionResource.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataMigration; +using Azure.ResourceManager.DataMigration.Models; + +namespace Azure.ResourceManager.DataMigration.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDataMigrationSubscriptionResource : ArmResource + { + private ClientDiagnostics _sqlMigrationServiceClientDiagnostics; + private SqlMigrationServicesRestOperations _sqlMigrationServiceRestClient; + private ClientDiagnostics _resourceSkusClientDiagnostics; + private ResourceSkusRestOperations _resourceSkusRestClient; + private ClientDiagnostics _dataMigrationServiceServicesClientDiagnostics; + private ServicesRestOperations _dataMigrationServiceServicesRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataMigrationSubscriptionResource() + { + } + + /// 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 MockableDataMigrationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SqlMigrationServiceClientDiagnostics => _sqlMigrationServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataMigration", SqlMigrationServiceResource.ResourceType.Namespace, Diagnostics); + private SqlMigrationServicesRestOperations SqlMigrationServiceRestClient => _sqlMigrationServiceRestClient ??= new SqlMigrationServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlMigrationServiceResource.ResourceType)); + private ClientDiagnostics ResourceSkusClientDiagnostics => _resourceSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataMigration", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceSkusRestOperations ResourceSkusRestClient => _resourceSkusRestClient ??= new ResourceSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DataMigrationServiceServicesClientDiagnostics => _dataMigrationServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataMigration", DataMigrationServiceResource.ResourceType.Namespace, Diagnostics); + private ServicesRestOperations DataMigrationServiceServicesRestClient => _dataMigrationServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataMigrationServiceResource.ResourceType)); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataMigration", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(Core.ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/sqlMigrationServices + /// + /// + /// Operation Id + /// SqlMigrationServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSqlMigrationServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SqlMigrationServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlMigrationServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlMigrationServiceResource(Client, SqlMigrationServiceData.DeserializeSqlMigrationServiceData(e)), SqlMigrationServiceClientDiagnostics, Pipeline, "MockableDataMigrationSubscriptionResource.GetSqlMigrationServices", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/sqlMigrationServices + /// + /// + /// Operation Id + /// SqlMigrationServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSqlMigrationServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SqlMigrationServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlMigrationServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlMigrationServiceResource(Client, SqlMigrationServiceData.DeserializeSqlMigrationServiceData(e)), SqlMigrationServiceClientDiagnostics, Pipeline, "MockableDataMigrationSubscriptionResource.GetSqlMigrationServices", "value", "nextLink", cancellationToken); + } + + /// + /// The skus action returns the list of SKUs that DMS supports. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/skus + /// + /// + /// Operation Id + /// ResourceSkus_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusResourceSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListSkusRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListSkusNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceSku.DeserializeResourceSku, ResourceSkusClientDiagnostics, Pipeline, "MockableDataMigrationSubscriptionResource.GetSkusResourceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// The skus action returns the list of SKUs that DMS supports. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/skus + /// + /// + /// Operation Id + /// ResourceSkus_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkusResourceSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListSkusRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListSkusNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceSku.DeserializeResourceSku, ResourceSkusClientDiagnostics, Pipeline, "MockableDataMigrationSubscriptionResource.GetSkusResourceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/services + /// + /// + /// Operation Id + /// Services_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataMigrationServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataMigrationServiceServicesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataMigrationServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataMigrationServiceResource(Client, DataMigrationServiceData.DeserializeDataMigrationServiceData(e)), DataMigrationServiceServicesClientDiagnostics, Pipeline, "MockableDataMigrationSubscriptionResource.GetDataMigrationServices", "value", "nextLink", cancellationToken); + } + + /// + /// The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/services + /// + /// + /// Operation Id + /// Services_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataMigrationServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataMigrationServiceServicesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataMigrationServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataMigrationServiceResource(Client, DataMigrationServiceData.DeserializeDataMigrationServiceData(e)), DataMigrationServiceServicesClientDiagnostics, Pipeline, "MockableDataMigrationSubscriptionResource.GetDataMigrationServices", "value", "nextLink", cancellationToken); + } + + /// + /// This method checks whether a proposed top-level resource name is valid and available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Services_CheckNameAvailability + /// + /// + /// + /// The Azure region of the operation. + /// Requested name to validate. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNameAvailabilityServiceAsync(AzureLocation location, NameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); + + using var scope = DataMigrationServiceServicesClientDiagnostics.CreateScope("MockableDataMigrationSubscriptionResource.CheckNameAvailabilityService"); + scope.Start(); + try + { + var response = await DataMigrationServiceServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, nameAvailabilityRequest, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This method checks whether a proposed top-level resource name is valid and available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Services_CheckNameAvailability + /// + /// + /// + /// The Azure region of the operation. + /// Requested name to validate. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNameAvailabilityService(AzureLocation location, NameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nameAvailabilityRequest, nameof(nameAvailabilityRequest)); + + using var scope = DataMigrationServiceServicesClientDiagnostics.CreateScope("MockableDataMigrationSubscriptionResource.CheckNameAvailabilityService"); + scope.Start(); + try + { + var response = DataMigrationServiceServicesRestClient.CheckNameAvailability(Id.SubscriptionId, location, nameAvailabilityRequest, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This method returns region-specific quotas and resource usage information for the Database Migration Service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// The Azure region of the operation. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, Quota.DeserializeQuota, UsagesClientDiagnostics, Pipeline, "MockableDataMigrationSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// This method returns region-specific quotas and resource usage information for the Database Migration Service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// The Azure region of the operation. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, Quota.DeserializeQuota, UsagesClientDiagnostics, Pipeline, "MockableDataMigrationSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3c2da0686859d..0000000000000 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DataMigration -{ - /// 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 DatabaseMigrationSqlDBResources in the ResourceGroupResource. - /// An object representing collection of DatabaseMigrationSqlDBResources and their operations over a DatabaseMigrationSqlDBResource. - public virtual DatabaseMigrationSqlDBCollection GetDatabaseMigrationSqlDBs() - { - return GetCachedClient(Client => new DatabaseMigrationSqlDBCollection(Client, Id)); - } - - /// Gets a collection of DatabaseMigrationSqlMIResources in the ResourceGroupResource. - /// An object representing collection of DatabaseMigrationSqlMIResources and their operations over a DatabaseMigrationSqlMIResource. - public virtual DatabaseMigrationSqlMICollection GetDatabaseMigrationSqlMIs() - { - return GetCachedClient(Client => new DatabaseMigrationSqlMICollection(Client, Id)); - } - - /// Gets a collection of DatabaseMigrationSqlVmResources in the ResourceGroupResource. - /// An object representing collection of DatabaseMigrationSqlVmResources and their operations over a DatabaseMigrationSqlVmResource. - public virtual DatabaseMigrationSqlVmCollection GetDatabaseMigrationSqlVms() - { - return GetCachedClient(Client => new DatabaseMigrationSqlVmCollection(Client, Id)); - } - - /// Gets a collection of SqlMigrationServiceResources in the ResourceGroupResource. - /// An object representing collection of SqlMigrationServiceResources and their operations over a SqlMigrationServiceResource. - public virtual SqlMigrationServiceCollection GetSqlMigrationServices() - { - return GetCachedClient(Client => new SqlMigrationServiceCollection(Client, Id)); - } - - /// Gets a collection of DataMigrationServiceResources in the ResourceGroupResource. - /// An object representing collection of DataMigrationServiceResources and their operations over a DataMigrationServiceResource. - public virtual DataMigrationServiceCollection GetDataMigrationServices() - { - return GetCachedClient(Client => new DataMigrationServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index a017b0c3ea152..0000000000000 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DataMigration.Models; - -namespace Azure.ResourceManager.DataMigration -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _sqlMigrationServiceClientDiagnostics; - private SqlMigrationServicesRestOperations _sqlMigrationServiceRestClient; - private ClientDiagnostics _resourceSkusClientDiagnostics; - private ResourceSkusRestOperations _resourceSkusRestClient; - private ClientDiagnostics _dataMigrationServiceServicesClientDiagnostics; - private ServicesRestOperations _dataMigrationServiceServicesRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - - /// 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 SqlMigrationServiceClientDiagnostics => _sqlMigrationServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataMigration", SqlMigrationServiceResource.ResourceType.Namespace, Diagnostics); - private SqlMigrationServicesRestOperations SqlMigrationServiceRestClient => _sqlMigrationServiceRestClient ??= new SqlMigrationServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlMigrationServiceResource.ResourceType)); - private ClientDiagnostics ResourceSkusClientDiagnostics => _resourceSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataMigration", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceSkusRestOperations ResourceSkusRestClient => _resourceSkusRestClient ??= new ResourceSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DataMigrationServiceServicesClientDiagnostics => _dataMigrationServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataMigration", DataMigrationServiceResource.ResourceType.Namespace, Diagnostics); - private ServicesRestOperations DataMigrationServiceServicesRestClient => _dataMigrationServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataMigrationServiceResource.ResourceType)); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataMigration", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(Core.ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Retrieve all SQL migration services in the subscriptions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/sqlMigrationServices - /// - /// - /// Operation Id - /// SqlMigrationServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSqlMigrationServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SqlMigrationServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlMigrationServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlMigrationServiceResource(Client, SqlMigrationServiceData.DeserializeSqlMigrationServiceData(e)), SqlMigrationServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSqlMigrationServices", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieve all SQL migration services in the subscriptions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/sqlMigrationServices - /// - /// - /// Operation Id - /// SqlMigrationServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSqlMigrationServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SqlMigrationServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlMigrationServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlMigrationServiceResource(Client, SqlMigrationServiceData.DeserializeSqlMigrationServiceData(e)), SqlMigrationServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSqlMigrationServices", "value", "nextLink", cancellationToken); - } - - /// - /// The skus action returns the list of SKUs that DMS supports. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/skus - /// - /// - /// Operation Id - /// ResourceSkus_ListSkus - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusResourceSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListSkusRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListSkusNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceSku.DeserializeResourceSku, ResourceSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkusResourceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// The skus action returns the list of SKUs that DMS supports. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/skus - /// - /// - /// Operation Id - /// ResourceSkus_ListSkus - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkusResourceSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListSkusRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListSkusNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceSku.DeserializeResourceSku, ResourceSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkusResourceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/services - /// - /// - /// Operation Id - /// Services_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataMigrationServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataMigrationServiceServicesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataMigrationServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataMigrationServiceResource(Client, DataMigrationServiceData.DeserializeDataMigrationServiceData(e)), DataMigrationServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataMigrationServices", "value", "nextLink", cancellationToken); - } - - /// - /// The services resource is the top-level resource that represents the Database Migration Service. This method returns a list of service resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/services - /// - /// - /// Operation Id - /// Services_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataMigrationServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataMigrationServiceServicesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataMigrationServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataMigrationServiceResource(Client, DataMigrationServiceData.DeserializeDataMigrationServiceData(e)), DataMigrationServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataMigrationServices", "value", "nextLink", cancellationToken); - } - - /// - /// This method checks whether a proposed top-level resource name is valid and available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Services_CheckNameAvailability - /// - /// - /// - /// The Azure region of the operation. - /// Requested name to validate. - /// The cancellation token to use. - public virtual async Task> CheckNameAvailabilityServiceAsync(AzureLocation location, NameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) - { - using var scope = DataMigrationServiceServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityService"); - scope.Start(); - try - { - var response = await DataMigrationServiceServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, nameAvailabilityRequest, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This method checks whether a proposed top-level resource name is valid and available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Services_CheckNameAvailability - /// - /// - /// - /// The Azure region of the operation. - /// Requested name to validate. - /// The cancellation token to use. - public virtual Response CheckNameAvailabilityService(AzureLocation location, NameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default) - { - using var scope = DataMigrationServiceServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityService"); - scope.Start(); - try - { - var response = DataMigrationServiceServicesRestClient.CheckNameAvailability(Id.SubscriptionId, location, nameAvailabilityRequest, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This method returns region-specific quotas and resource usage information for the Database Migration Service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// The Azure region of the operation. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, Quota.DeserializeQuota, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// This method returns region-specific quotas and resource usage information for the Database Migration Service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// The Azure region of the operation. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, Quota.DeserializeQuota, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectFileResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectFileResource.cs index 3e80db93be10d..fd4673d8098ef 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectFileResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectFileResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.DataMigration public partial class ProjectFileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The groupName. + /// The serviceName. + /// The projectName. + /// The fileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string groupName, string serviceName, string projectName, string fileName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/files/{fileName}"; diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectResource.cs index 1ffe878c53d73..2de72184395f2 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataMigration public partial class ProjectResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The groupName. + /// The serviceName. + /// The projectName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string groupName, string serviceName, string projectName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceProjectTaskResources and their operations over a ServiceProjectTaskResource. public virtual ServiceProjectTaskCollection GetServiceProjectTasks() { - return GetCachedClient(Client => new ServiceProjectTaskCollection(Client, Id)); + return GetCachedClient(client => new ServiceProjectTaskCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual ServiceProjectTaskCollection GetServiceProjectTasks() /// Name of the Task. /// Expand the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceProjectTaskAsync(string taskName, string expand = null, CancellationToken cancellationToken = default) { @@ -134,8 +138,8 @@ public virtual async Task> GetServiceProjec /// Name of the Task. /// Expand the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceProjectTask(string taskName, string expand = null, CancellationToken cancellationToken = default) { @@ -146,7 +150,7 @@ public virtual Response GetServiceProjectTask(string /// An object representing collection of ProjectFileResources and their operations over a ProjectFileResource. public virtual ProjectFileCollection GetProjectFiles() { - return GetCachedClient(Client => new ProjectFileCollection(Client, Id)); + return GetCachedClient(client => new ProjectFileCollection(client, Id)); } /// @@ -164,8 +168,8 @@ public virtual ProjectFileCollection GetProjectFiles() /// /// Name of the File. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProjectFileAsync(string fileName, CancellationToken cancellationToken = default) { @@ -187,8 +191,8 @@ public virtual async Task> GetProjectFileAsync(str /// /// Name of the File. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProjectFile(string fileName, CancellationToken cancellationToken = default) { diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceProjectTaskResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceProjectTaskResource.cs index b3b1b42da71fb..30aae1913ee5d 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceProjectTaskResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceProjectTaskResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.DataMigration public partial class ServiceProjectTaskResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The groupName. + /// The serviceName. + /// The projectName. + /// The taskName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string groupName, string serviceName, string projectName, string taskName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}"; diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceServiceTaskResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceServiceTaskResource.cs index 7e63392cc1822..55b6767972634 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceServiceTaskResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ServiceServiceTaskResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataMigration public partial class ServiceServiceTaskResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The groupName. + /// The serviceName. + /// The taskName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string groupName, string serviceName, string taskName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/serviceTasks/{taskName}"; diff --git a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/SqlMigrationServiceResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/SqlMigrationServiceResource.cs index 084810ca2e6b9..e0046b1451415 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/SqlMigrationServiceResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/SqlMigrationServiceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DataMigration public partial class SqlMigrationServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sqlMigrationServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sqlMigrationServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}"; diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/api/Azure.ResourceManager.DataProtectionBackup.netstandard2.0.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/api/Azure.ResourceManager.DataProtectionBackup.netstandard2.0.cs index 28074fd1e61de..5d9eaaad61944 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/api/Azure.ResourceManager.DataProtectionBackup.netstandard2.0.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/api/Azure.ResourceManager.DataProtectionBackup.netstandard2.0.cs @@ -206,7 +206,7 @@ protected DataProtectionBackupVaultCollection() { } } public partial class DataProtectionBackupVaultData : Azure.ResourceManager.Models.TrackedResourceData { - public DataProtectionBackupVaultData(Azure.Core.AzureLocation location, Azure.ResourceManager.DataProtectionBackup.Models.DataProtectionBackupVaultProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public DataProtectionBackupVaultData(Azure.Core.AzureLocation location, Azure.ResourceManager.DataProtectionBackup.Models.DataProtectionBackupVaultProperties properties) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.DataProtectionBackup.Models.DataProtectionBackupVaultProperties Properties { get { throw null; } set { } } @@ -307,7 +307,7 @@ protected ResourceGuardCollection() { } } public partial class ResourceGuardData : Azure.ResourceManager.Models.TrackedResourceData { - public ResourceGuardData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ResourceGuardData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("This property is obsolete and will be removed in a future release. Please do not use it any longer.", false)] @@ -403,6 +403,43 @@ protected ResourceGuardResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.DataProtectionBackup.Models.ResourceGuardPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DataProtectionBackup.Mocking +{ + public partial class MockableDataProtectionBackupArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDataProtectionBackupArmClient() { } + public virtual Azure.ResourceManager.DataProtectionBackup.DataProtectionBackupInstanceResource GetDataProtectionBackupInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.DataProtectionBackupJobResource GetDataProtectionBackupJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.DataProtectionBackupPolicyResource GetDataProtectionBackupPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.DataProtectionBackupRecoveryPointResource GetDataProtectionBackupRecoveryPointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.DataProtectionBackupVaultResource GetDataProtectionBackupVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.DeletedDataProtectionBackupInstanceResource GetDeletedDataProtectionBackupInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.ResourceGuardProxyBaseResource GetResourceGuardProxyBaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.ResourceGuardResource GetResourceGuardResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDataProtectionBackupResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDataProtectionBackupResourceGroupResource() { } + public virtual Azure.Response CheckDataProtectionBackupVaultNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.DataProtectionBackup.Models.DataProtectionBackupNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDataProtectionBackupVaultNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataProtectionBackup.Models.DataProtectionBackupNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDataProtectionBackupVault(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataProtectionBackupVaultAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.DataProtectionBackupVaultCollection GetDataProtectionBackupVaults() { throw null; } + public virtual Azure.Response GetResourceGuard(string resourceGuardsName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceGuardAsync(string resourceGuardsName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.ResourceGuardCollection GetResourceGuards() { throw null; } + } + public partial class MockableDataProtectionBackupSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDataProtectionBackupSubscriptionResource() { } + public virtual Azure.Response CheckDataProtectionBackupFeatureSupport(Azure.Core.AzureLocation location, Azure.ResourceManager.DataProtectionBackup.Models.BackupFeatureValidationContentBase content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDataProtectionBackupFeatureSupportAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataProtectionBackup.Models.BackupFeatureValidationContentBase content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataProtectionBackupVaults(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataProtectionBackupVaultsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetResourceGuards(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetResourceGuardsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DataProtectionBackup.Models { public partial class AdhocBackupRules diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceResource.cs index 33c6a4d84c080..ab80b8ddc95a0 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DataProtectionBackup public partial class DataProtectionBackupInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The backupInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string backupInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"; @@ -96,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataProtectionBackupRecoveryPointResources and their operations over a DataProtectionBackupRecoveryPointResource. public virtual DataProtectionBackupRecoveryPointCollection GetDataProtectionBackupRecoveryPoints() { - return GetCachedClient(Client => new DataProtectionBackupRecoveryPointCollection(Client, Id)); + return GetCachedClient(client => new DataProtectionBackupRecoveryPointCollection(client, Id)); } /// @@ -114,8 +118,8 @@ public virtual DataProtectionBackupRecoveryPointCollection GetDataProtectionBack /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataProtectionBackupRecoveryPointAsync(string recoveryPointId, CancellationToken cancellationToken = default) { @@ -137,8 +141,8 @@ public virtual async Task> G /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataProtectionBackupRecoveryPoint(string recoveryPointId, CancellationToken cancellationToken = default) { diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupJobResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupJobResource.cs index 758fb4ed553eb..89c2fe175f808 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupJobResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupJobResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataProtectionBackup public partial class DataProtectionBackupJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The jobId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string jobId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}"; diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupPolicyResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupPolicyResource.cs index 34b3bc7297f12..9367a6efbf6d6 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupPolicyResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataProtectionBackup public partial class DataProtectionBackupPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The backupPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string backupPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"; diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupRecoveryPointResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupRecoveryPointResource.cs index 05aa87e43c3ca..7982a1febacc9 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupRecoveryPointResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupRecoveryPointResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DataProtectionBackup public partial class DataProtectionBackupRecoveryPointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The backupInstanceName. + /// The recoveryPointId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string backupInstanceName, string recoveryPointId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}"; diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs index 90deae40c8504..0bf6626119507 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DataProtectionBackup public partial class DataProtectionBackupVaultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"; @@ -102,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataProtectionBackupPolicyResources and their operations over a DataProtectionBackupPolicyResource. public virtual DataProtectionBackupPolicyCollection GetDataProtectionBackupPolicies() { - return GetCachedClient(Client => new DataProtectionBackupPolicyCollection(Client, Id)); + return GetCachedClient(client => new DataProtectionBackupPolicyCollection(client, Id)); } /// @@ -120,8 +123,8 @@ public virtual DataProtectionBackupPolicyCollection GetDataProtectionBackupPolic /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataProtectionBackupPolicyAsync(string backupPolicyName, CancellationToken cancellationToken = default) { @@ -143,8 +146,8 @@ public virtual async Task> GetDataP /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataProtectionBackupPolicy(string backupPolicyName, CancellationToken cancellationToken = default) { @@ -155,7 +158,7 @@ public virtual Response GetDataProtectionBac /// An object representing collection of DataProtectionBackupInstanceResources and their operations over a DataProtectionBackupInstanceResource. public virtual DataProtectionBackupInstanceCollection GetDataProtectionBackupInstances() { - return GetCachedClient(Client => new DataProtectionBackupInstanceCollection(Client, Id)); + return GetCachedClient(client => new DataProtectionBackupInstanceCollection(client, Id)); } /// @@ -173,8 +176,8 @@ public virtual DataProtectionBackupInstanceCollection GetDataProtectionBackupIns /// /// The name of the backup instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataProtectionBackupInstanceAsync(string backupInstanceName, CancellationToken cancellationToken = default) { @@ -196,8 +199,8 @@ public virtual async Task> GetDat /// /// The name of the backup instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataProtectionBackupInstance(string backupInstanceName, CancellationToken cancellationToken = default) { @@ -208,7 +211,7 @@ public virtual Response GetDataProtectionB /// An object representing collection of DataProtectionBackupJobResources and their operations over a DataProtectionBackupJobResource. public virtual DataProtectionBackupJobCollection GetDataProtectionBackupJobs() { - return GetCachedClient(Client => new DataProtectionBackupJobCollection(Client, Id)); + return GetCachedClient(client => new DataProtectionBackupJobCollection(client, Id)); } /// @@ -226,8 +229,8 @@ public virtual DataProtectionBackupJobCollection GetDataProtectionBackupJobs() /// /// The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataProtectionBackupJobAsync(string jobId, CancellationToken cancellationToken = default) { @@ -249,8 +252,8 @@ public virtual async Task> GetDataProt /// /// The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataProtectionBackupJob(string jobId, CancellationToken cancellationToken = default) { @@ -261,7 +264,7 @@ public virtual Response GetDataProtectionBackup /// An object representing collection of DeletedDataProtectionBackupInstanceResources and their operations over a DeletedDataProtectionBackupInstanceResource. public virtual DeletedDataProtectionBackupInstanceCollection GetDeletedDataProtectionBackupInstances() { - return GetCachedClient(Client => new DeletedDataProtectionBackupInstanceCollection(Client, Id)); + return GetCachedClient(client => new DeletedDataProtectionBackupInstanceCollection(client, Id)); } /// @@ -279,8 +282,8 @@ public virtual DeletedDataProtectionBackupInstanceCollection GetDeletedDataProte /// /// The name of the deleted backup instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDeletedDataProtectionBackupInstanceAsync(string backupInstanceName, CancellationToken cancellationToken = default) { @@ -302,8 +305,8 @@ public virtual async Task> /// /// The name of the deleted backup instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDeletedDataProtectionBackupInstance(string backupInstanceName, CancellationToken cancellationToken = default) { @@ -314,7 +317,7 @@ public virtual Response GetDeletedD /// An object representing collection of ResourceGuardProxyBaseResources and their operations over a ResourceGuardProxyBaseResource. public virtual ResourceGuardProxyBaseResourceCollection GetResourceGuardProxyBaseResources() { - return GetCachedClient(Client => new ResourceGuardProxyBaseResourceCollection(Client, Id)); + return GetCachedClient(client => new ResourceGuardProxyBaseResourceCollection(client, Id)); } /// @@ -332,8 +335,8 @@ public virtual ResourceGuardProxyBaseResourceCollection GetResourceGuardProxyBas /// /// name of the resource guard proxy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetResourceGuardProxyBaseResourceAsync(string resourceGuardProxyName, CancellationToken cancellationToken = default) { @@ -355,8 +358,8 @@ public virtual async Task> GetResourceG /// /// name of the resource guard proxy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetResourceGuardProxyBaseResource(string resourceGuardProxyName, CancellationToken cancellationToken = default) { diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DeletedDataProtectionBackupInstanceResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DeletedDataProtectionBackupInstanceResource.cs index edb5bbb4491e7..6684460a547f8 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DeletedDataProtectionBackupInstanceResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DeletedDataProtectionBackupInstanceResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DataProtectionBackup public partial class DeletedDataProtectionBackupInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The backupInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string backupInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}"; diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs index cc6d533895be7..fa67cbd82892c 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DataProtectionBackup.Mocking; using Azure.ResourceManager.DataProtectionBackup.Models; using Azure.ResourceManager.Resources; @@ -19,195 +20,161 @@ namespace Azure.ResourceManager.DataProtectionBackup /// A class to add extension methods to Azure.ResourceManager.DataProtectionBackup. public static partial class DataProtectionBackupExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDataProtectionBackupArmClient GetMockableDataProtectionBackupArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDataProtectionBackupArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataProtectionBackupResourceGroupResource GetMockableDataProtectionBackupResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataProtectionBackupResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDataProtectionBackupSubscriptionResource GetMockableDataProtectionBackupSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDataProtectionBackupSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataProtectionBackupVaultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataProtectionBackupVaultResource GetDataProtectionBackupVaultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataProtectionBackupVaultResource.ValidateResourceId(id); - return new DataProtectionBackupVaultResource(client, id); - } - ); + return GetMockableDataProtectionBackupArmClient(client).GetDataProtectionBackupVaultResource(id); } - #endregion - #region DataProtectionBackupPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataProtectionBackupPolicyResource GetDataProtectionBackupPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataProtectionBackupPolicyResource.ValidateResourceId(id); - return new DataProtectionBackupPolicyResource(client, id); - } - ); + return GetMockableDataProtectionBackupArmClient(client).GetDataProtectionBackupPolicyResource(id); } - #endregion - #region DataProtectionBackupInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataProtectionBackupInstanceResource GetDataProtectionBackupInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataProtectionBackupInstanceResource.ValidateResourceId(id); - return new DataProtectionBackupInstanceResource(client, id); - } - ); + return GetMockableDataProtectionBackupArmClient(client).GetDataProtectionBackupInstanceResource(id); } - #endregion - #region DataProtectionBackupRecoveryPointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataProtectionBackupRecoveryPointResource GetDataProtectionBackupRecoveryPointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataProtectionBackupRecoveryPointResource.ValidateResourceId(id); - return new DataProtectionBackupRecoveryPointResource(client, id); - } - ); + return GetMockableDataProtectionBackupArmClient(client).GetDataProtectionBackupRecoveryPointResource(id); } - #endregion - #region DataProtectionBackupJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataProtectionBackupJobResource GetDataProtectionBackupJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataProtectionBackupJobResource.ValidateResourceId(id); - return new DataProtectionBackupJobResource(client, id); - } - ); + return GetMockableDataProtectionBackupArmClient(client).GetDataProtectionBackupJobResource(id); } - #endregion - #region DeletedDataProtectionBackupInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeletedDataProtectionBackupInstanceResource GetDeletedDataProtectionBackupInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeletedDataProtectionBackupInstanceResource.ValidateResourceId(id); - return new DeletedDataProtectionBackupInstanceResource(client, id); - } - ); + return GetMockableDataProtectionBackupArmClient(client).GetDeletedDataProtectionBackupInstanceResource(id); } - #endregion - #region ResourceGuardResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourceGuardResource GetResourceGuardResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceGuardResource.ValidateResourceId(id); - return new ResourceGuardResource(client, id); - } - ); + return GetMockableDataProtectionBackupArmClient(client).GetResourceGuardResource(id); } - #endregion - #region ResourceGuardProxyBaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourceGuardProxyBaseResource GetResourceGuardProxyBaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceGuardProxyBaseResource.ValidateResourceId(id); - return new ResourceGuardProxyBaseResource(client, id); - } - ); + return GetMockableDataProtectionBackupArmClient(client).GetResourceGuardProxyBaseResource(id); } - #endregion - /// Gets a collection of DataProtectionBackupVaultResources in the ResourceGroupResource. + /// + /// Gets a collection of DataProtectionBackupVaultResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataProtectionBackupVaultResources and their operations over a DataProtectionBackupVaultResource. public static DataProtectionBackupVaultCollection GetDataProtectionBackupVaults(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataProtectionBackupVaults(); + return GetMockableDataProtectionBackupResourceGroupResource(resourceGroupResource).GetDataProtectionBackupVaults(); } /// @@ -222,16 +189,20 @@ public static DataProtectionBackupVaultCollection GetDataProtectionBackupVaults( /// BackupVaults_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the backup vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataProtectionBackupVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataProtectionBackupVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableDataProtectionBackupResourceGroupResource(resourceGroupResource).GetDataProtectionBackupVaultAsync(vaultName, cancellationToken).ConfigureAwait(false); } /// @@ -246,24 +217,34 @@ public static async Task> GetDataPro /// BackupVaults_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the backup vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataProtectionBackupVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataProtectionBackupVaults().Get(vaultName, cancellationToken); + return GetMockableDataProtectionBackupResourceGroupResource(resourceGroupResource).GetDataProtectionBackupVault(vaultName, cancellationToken); } - /// Gets a collection of ResourceGuardResources in the ResourceGroupResource. + /// + /// Gets a collection of ResourceGuardResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ResourceGuardResources and their operations over a ResourceGuardResource. public static ResourceGuardCollection GetResourceGuards(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetResourceGuards(); + return GetMockableDataProtectionBackupResourceGroupResource(resourceGroupResource).GetResourceGuards(); } /// @@ -278,16 +259,20 @@ public static ResourceGuardCollection GetResourceGuards(this ResourceGroupResour /// ResourceGuards_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of ResourceGuard. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceGuardAsync(this ResourceGroupResource resourceGroupResource, string resourceGuardsName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetResourceGuards().GetAsync(resourceGuardsName, cancellationToken).ConfigureAwait(false); + return await GetMockableDataProtectionBackupResourceGroupResource(resourceGroupResource).GetResourceGuardAsync(resourceGuardsName, cancellationToken).ConfigureAwait(false); } /// @@ -302,16 +287,20 @@ public static async Task> GetResourceGuardAsync( /// ResourceGuards_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of ResourceGuard. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceGuard(this ResourceGroupResource resourceGroupResource, string resourceGuardsName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetResourceGuards().Get(resourceGuardsName, cancellationToken); + return GetMockableDataProtectionBackupResourceGroupResource(resourceGroupResource).GetResourceGuard(resourceGuardsName, cancellationToken); } /// @@ -326,6 +315,10 @@ public static Response GetResourceGuard(this ResourceGrou /// BackupVaults_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location in which uniqueness will be verified. @@ -334,9 +327,7 @@ public static Response GetResourceGuard(this ResourceGrou /// is null. public static async Task> CheckDataProtectionBackupVaultNameAvailabilityAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, DataProtectionBackupNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckDataProtectionBackupVaultNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataProtectionBackupResourceGroupResource(resourceGroupResource).CheckDataProtectionBackupVaultNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -351,6 +342,10 @@ public static async Task> C /// BackupVaults_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location in which uniqueness will be verified. @@ -359,9 +354,7 @@ public static async Task> C /// is null. public static Response CheckDataProtectionBackupVaultNameAvailability(this ResourceGroupResource resourceGroupResource, AzureLocation location, DataProtectionBackupNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckDataProtectionBackupVaultNameAvailability(location, content, cancellationToken); + return GetMockableDataProtectionBackupResourceGroupResource(resourceGroupResource).CheckDataProtectionBackupVaultNameAvailability(location, content, cancellationToken); } /// @@ -376,13 +369,17 @@ public static Response CheckDataProt /// BackupVaults_GetInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataProtectionBackupVaultsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataProtectionBackupVaultsAsync(cancellationToken); + return GetMockableDataProtectionBackupSubscriptionResource(subscriptionResource).GetDataProtectionBackupVaultsAsync(cancellationToken); } /// @@ -397,13 +394,17 @@ public static AsyncPageable GetDataProtection /// BackupVaults_GetInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataProtectionBackupVaults(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataProtectionBackupVaults(cancellationToken); + return GetMockableDataProtectionBackupSubscriptionResource(subscriptionResource).GetDataProtectionBackupVaults(cancellationToken); } /// @@ -418,6 +419,10 @@ public static Pageable GetDataProtectionBacku /// DataProtection_CheckFeatureSupport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -426,9 +431,7 @@ public static Pageable GetDataProtectionBacku /// is null. public static async Task> CheckDataProtectionBackupFeatureSupportAsync(this SubscriptionResource subscriptionResource, AzureLocation location, BackupFeatureValidationContentBase content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataProtectionBackupFeatureSupportAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDataProtectionBackupSubscriptionResource(subscriptionResource).CheckDataProtectionBackupFeatureSupportAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -443,6 +446,10 @@ public static async Task> CheckDataP /// DataProtection_CheckFeatureSupport /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -451,9 +458,7 @@ public static async Task> CheckDataP /// is null. public static Response CheckDataProtectionBackupFeatureSupport(this SubscriptionResource subscriptionResource, AzureLocation location, BackupFeatureValidationContentBase content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataProtectionBackupFeatureSupport(location, content, cancellationToken); + return GetMockableDataProtectionBackupSubscriptionResource(subscriptionResource).CheckDataProtectionBackupFeatureSupport(location, content, cancellationToken); } /// @@ -468,13 +473,17 @@ public static Response CheckDataProtectionBac /// ResourceGuards_GetResourcesInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourceGuardsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceGuardsAsync(cancellationToken); + return GetMockableDataProtectionBackupSubscriptionResource(subscriptionResource).GetResourceGuardsAsync(cancellationToken); } /// @@ -489,13 +498,17 @@ public static AsyncPageable GetResourceGuardsAsync(this S /// ResourceGuards_GetResourcesInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourceGuards(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceGuards(cancellationToken); + return GetMockableDataProtectionBackupSubscriptionResource(subscriptionResource).GetResourceGuards(cancellationToken); } } } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupArmClient.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupArmClient.cs new file mode 100644 index 0000000000000..055b308f429b0 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupArmClient.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DataProtectionBackup; + +namespace Azure.ResourceManager.DataProtectionBackup.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDataProtectionBackupArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataProtectionBackupArmClient() + { + } + + /// 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 MockableDataProtectionBackupArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDataProtectionBackupArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataProtectionBackupVaultResource GetDataProtectionBackupVaultResource(ResourceIdentifier id) + { + DataProtectionBackupVaultResource.ValidateResourceId(id); + return new DataProtectionBackupVaultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataProtectionBackupPolicyResource GetDataProtectionBackupPolicyResource(ResourceIdentifier id) + { + DataProtectionBackupPolicyResource.ValidateResourceId(id); + return new DataProtectionBackupPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataProtectionBackupInstanceResource GetDataProtectionBackupInstanceResource(ResourceIdentifier id) + { + DataProtectionBackupInstanceResource.ValidateResourceId(id); + return new DataProtectionBackupInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataProtectionBackupRecoveryPointResource GetDataProtectionBackupRecoveryPointResource(ResourceIdentifier id) + { + DataProtectionBackupRecoveryPointResource.ValidateResourceId(id); + return new DataProtectionBackupRecoveryPointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataProtectionBackupJobResource GetDataProtectionBackupJobResource(ResourceIdentifier id) + { + DataProtectionBackupJobResource.ValidateResourceId(id); + return new DataProtectionBackupJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeletedDataProtectionBackupInstanceResource GetDeletedDataProtectionBackupInstanceResource(ResourceIdentifier id) + { + DeletedDataProtectionBackupInstanceResource.ValidateResourceId(id); + return new DeletedDataProtectionBackupInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceGuardResource GetResourceGuardResource(ResourceIdentifier id) + { + ResourceGuardResource.ValidateResourceId(id); + return new ResourceGuardResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceGuardProxyBaseResource GetResourceGuardProxyBaseResource(ResourceIdentifier id) + { + ResourceGuardProxyBaseResource.ValidateResourceId(id); + return new ResourceGuardProxyBaseResource(Client, id); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupResourceGroupResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupResourceGroupResource.cs new file mode 100644 index 0000000000000..9c12b4c97006f --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupResourceGroupResource.cs @@ -0,0 +1,223 @@ +// 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; +using Azure.ResourceManager.DataProtectionBackup; +using Azure.ResourceManager.DataProtectionBackup.Models; + +namespace Azure.ResourceManager.DataProtectionBackup.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDataProtectionBackupResourceGroupResource : ArmResource + { + private ClientDiagnostics _dataProtectionBackupVaultBackupVaultsClientDiagnostics; + private BackupVaultsRestOperations _dataProtectionBackupVaultBackupVaultsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataProtectionBackupResourceGroupResource() + { + } + + /// 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 MockableDataProtectionBackupResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataProtectionBackupVaultBackupVaultsClientDiagnostics => _dataProtectionBackupVaultBackupVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", DataProtectionBackupVaultResource.ResourceType.Namespace, Diagnostics); + private BackupVaultsRestOperations DataProtectionBackupVaultBackupVaultsRestClient => _dataProtectionBackupVaultBackupVaultsRestClient ??= new BackupVaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataProtectionBackupVaultResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataProtectionBackupVaultResources in the ResourceGroupResource. + /// An object representing collection of DataProtectionBackupVaultResources and their operations over a DataProtectionBackupVaultResource. + public virtual DataProtectionBackupVaultCollection GetDataProtectionBackupVaults() + { + return GetCachedClient(client => new DataProtectionBackupVaultCollection(client, Id)); + } + + /// + /// Returns a resource belonging to a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName} + /// + /// + /// Operation Id + /// BackupVaults_Get + /// + /// + /// + /// The name of the backup vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataProtectionBackupVaultAsync(string vaultName, CancellationToken cancellationToken = default) + { + return await GetDataProtectionBackupVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a resource belonging to a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName} + /// + /// + /// Operation Id + /// BackupVaults_Get + /// + /// + /// + /// The name of the backup vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataProtectionBackupVault(string vaultName, CancellationToken cancellationToken = default) + { + return GetDataProtectionBackupVaults().Get(vaultName, cancellationToken); + } + + /// Gets a collection of ResourceGuardResources in the ResourceGroupResource. + /// An object representing collection of ResourceGuardResources and their operations over a ResourceGuardResource. + public virtual ResourceGuardCollection GetResourceGuards() + { + return GetCachedClient(client => new ResourceGuardCollection(client, Id)); + } + + /// + /// Returns a ResourceGuard belonging to a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName} + /// + /// + /// Operation Id + /// ResourceGuards_Get + /// + /// + /// + /// The name of ResourceGuard. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceGuardAsync(string resourceGuardsName, CancellationToken cancellationToken = default) + { + return await GetResourceGuards().GetAsync(resourceGuardsName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a ResourceGuard belonging to a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName} + /// + /// + /// Operation Id + /// ResourceGuards_Get + /// + /// + /// + /// The name of ResourceGuard. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceGuard(string resourceGuardsName, CancellationToken cancellationToken = default) + { + return GetResourceGuards().Get(resourceGuardsName, cancellationToken); + } + + /// + /// API to check for resource name availability + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// BackupVaults_CheckNameAvailability + /// + /// + /// + /// The location in which uniqueness will be verified. + /// Check name availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDataProtectionBackupVaultNameAvailabilityAsync(AzureLocation location, DataProtectionBackupNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataProtectionBackupVaultBackupVaultsClientDiagnostics.CreateScope("MockableDataProtectionBackupResourceGroupResource.CheckDataProtectionBackupVaultNameAvailability"); + scope.Start(); + try + { + var response = await DataProtectionBackupVaultBackupVaultsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// API to check for resource name availability + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// BackupVaults_CheckNameAvailability + /// + /// + /// + /// The location in which uniqueness will be verified. + /// Check name availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDataProtectionBackupVaultNameAvailability(AzureLocation location, DataProtectionBackupNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataProtectionBackupVaultBackupVaultsClientDiagnostics.CreateScope("MockableDataProtectionBackupResourceGroupResource.CheckDataProtectionBackupVaultNameAvailability"); + scope.Start(); + try + { + var response = DataProtectionBackupVaultBackupVaultsRestClient.CheckNameAvailability(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupSubscriptionResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupSubscriptionResource.cs new file mode 100644 index 0000000000000..52145e6147af1 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/MockableDataProtectionBackupSubscriptionResource.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataProtectionBackup; +using Azure.ResourceManager.DataProtectionBackup.Models; + +namespace Azure.ResourceManager.DataProtectionBackup.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDataProtectionBackupSubscriptionResource : ArmResource + { + private ClientDiagnostics _dataProtectionBackupVaultBackupVaultsClientDiagnostics; + private BackupVaultsRestOperations _dataProtectionBackupVaultBackupVaultsRestClient; + private ClientDiagnostics _dataProtectionClientDiagnostics; + private DataProtectionRestOperations _dataProtectionRestClient; + private ClientDiagnostics _resourceGuardClientDiagnostics; + private ResourceGuardsRestOperations _resourceGuardRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataProtectionBackupSubscriptionResource() + { + } + + /// 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 MockableDataProtectionBackupSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataProtectionBackupVaultBackupVaultsClientDiagnostics => _dataProtectionBackupVaultBackupVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", DataProtectionBackupVaultResource.ResourceType.Namespace, Diagnostics); + private BackupVaultsRestOperations DataProtectionBackupVaultBackupVaultsRestClient => _dataProtectionBackupVaultBackupVaultsRestClient ??= new BackupVaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataProtectionBackupVaultResource.ResourceType)); + private ClientDiagnostics DataProtectionClientDiagnostics => _dataProtectionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DataProtectionRestOperations DataProtectionRestClient => _dataProtectionRestClient ??= new DataProtectionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ResourceGuardClientDiagnostics => _resourceGuardClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", ResourceGuardResource.ResourceType.Namespace, Diagnostics); + private ResourceGuardsRestOperations ResourceGuardRestClient => _resourceGuardRestClient ??= new ResourceGuardsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ResourceGuardResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns resource collection belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults + /// + /// + /// Operation Id + /// BackupVaults_GetInSubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataProtectionBackupVaultsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataProtectionBackupVaultBackupVaultsRestClient.CreateGetInSubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProtectionBackupVaultBackupVaultsRestClient.CreateGetInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataProtectionBackupVaultResource(Client, DataProtectionBackupVaultData.DeserializeDataProtectionBackupVaultData(e)), DataProtectionBackupVaultBackupVaultsClientDiagnostics, Pipeline, "MockableDataProtectionBackupSubscriptionResource.GetDataProtectionBackupVaults", "value", "nextLink", cancellationToken); + } + + /// + /// Returns resource collection belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults + /// + /// + /// Operation Id + /// BackupVaults_GetInSubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataProtectionBackupVaults(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataProtectionBackupVaultBackupVaultsRestClient.CreateGetInSubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProtectionBackupVaultBackupVaultsRestClient.CreateGetInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataProtectionBackupVaultResource(Client, DataProtectionBackupVaultData.DeserializeDataProtectionBackupVaultData(e)), DataProtectionBackupVaultBackupVaultsClientDiagnostics, Pipeline, "MockableDataProtectionBackupSubscriptionResource.GetDataProtectionBackupVaults", "value", "nextLink", cancellationToken); + } + + /// + /// Validates if a feature is supported + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport + /// + /// + /// Operation Id + /// DataProtection_CheckFeatureSupport + /// + /// + /// + /// The String to use. + /// Feature support request object. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDataProtectionBackupFeatureSupportAsync(AzureLocation location, BackupFeatureValidationContentBase content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataProtectionClientDiagnostics.CreateScope("MockableDataProtectionBackupSubscriptionResource.CheckDataProtectionBackupFeatureSupport"); + scope.Start(); + try + { + var response = await DataProtectionRestClient.CheckFeatureSupportAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validates if a feature is supported + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport + /// + /// + /// Operation Id + /// DataProtection_CheckFeatureSupport + /// + /// + /// + /// The String to use. + /// Feature support request object. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDataProtectionBackupFeatureSupport(AzureLocation location, BackupFeatureValidationContentBase content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DataProtectionClientDiagnostics.CreateScope("MockableDataProtectionBackupSubscriptionResource.CheckDataProtectionBackupFeatureSupport"); + scope.Start(); + try + { + var response = DataProtectionRestClient.CheckFeatureSupport(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns ResourceGuards collection belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards + /// + /// + /// Operation Id + /// ResourceGuards_GetResourcesInSubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetResourceGuardsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceGuardRestClient.CreateGetResourcesInSubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceGuardRestClient.CreateGetResourcesInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourceGuardResource(Client, ResourceGuardData.DeserializeResourceGuardData(e)), ResourceGuardClientDiagnostics, Pipeline, "MockableDataProtectionBackupSubscriptionResource.GetResourceGuards", "value", "nextLink", cancellationToken); + } + + /// + /// Returns ResourceGuards collection belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards + /// + /// + /// Operation Id + /// ResourceGuards_GetResourcesInSubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetResourceGuards(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceGuardRestClient.CreateGetResourcesInSubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceGuardRestClient.CreateGetResourcesInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourceGuardResource(Client, ResourceGuardData.DeserializeResourceGuardData(e)), ResourceGuardClientDiagnostics, Pipeline, "MockableDataProtectionBackupSubscriptionResource.GetResourceGuards", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index cfc7042c48592..0000000000000 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,124 +0,0 @@ -// 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; -using Azure.ResourceManager.DataProtectionBackup.Models; - -namespace Azure.ResourceManager.DataProtectionBackup -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataProtectionBackupVaultBackupVaultsClientDiagnostics; - private BackupVaultsRestOperations _dataProtectionBackupVaultBackupVaultsRestClient; - - /// 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 ClientDiagnostics DataProtectionBackupVaultBackupVaultsClientDiagnostics => _dataProtectionBackupVaultBackupVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", DataProtectionBackupVaultResource.ResourceType.Namespace, Diagnostics); - private BackupVaultsRestOperations DataProtectionBackupVaultBackupVaultsRestClient => _dataProtectionBackupVaultBackupVaultsRestClient ??= new BackupVaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataProtectionBackupVaultResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DataProtectionBackupVaultResources in the ResourceGroupResource. - /// An object representing collection of DataProtectionBackupVaultResources and their operations over a DataProtectionBackupVaultResource. - public virtual DataProtectionBackupVaultCollection GetDataProtectionBackupVaults() - { - return GetCachedClient(Client => new DataProtectionBackupVaultCollection(Client, Id)); - } - - /// Gets a collection of ResourceGuardResources in the ResourceGroupResource. - /// An object representing collection of ResourceGuardResources and their operations over a ResourceGuardResource. - public virtual ResourceGuardCollection GetResourceGuards() - { - return GetCachedClient(Client => new ResourceGuardCollection(Client, Id)); - } - - /// - /// API to check for resource name availability - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// BackupVaults_CheckNameAvailability - /// - /// - /// - /// The location in which uniqueness will be verified. - /// Check name availability request. - /// The cancellation token to use. - public virtual async Task> CheckDataProtectionBackupVaultNameAvailabilityAsync(AzureLocation location, DataProtectionBackupNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DataProtectionBackupVaultBackupVaultsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckDataProtectionBackupVaultNameAvailability"); - scope.Start(); - try - { - var response = await DataProtectionBackupVaultBackupVaultsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// API to check for resource name availability - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// BackupVaults_CheckNameAvailability - /// - /// - /// - /// The location in which uniqueness will be verified. - /// Check name availability request. - /// The cancellation token to use. - public virtual Response CheckDataProtectionBackupVaultNameAvailability(AzureLocation location, DataProtectionBackupNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DataProtectionBackupVaultBackupVaultsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckDataProtectionBackupVaultNameAvailability"); - scope.Start(); - try - { - var response = DataProtectionBackupVaultBackupVaultsRestClient.CheckNameAvailability(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 27ccc29ea03bb..0000000000000 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DataProtectionBackup.Models; - -namespace Azure.ResourceManager.DataProtectionBackup -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataProtectionBackupVaultBackupVaultsClientDiagnostics; - private BackupVaultsRestOperations _dataProtectionBackupVaultBackupVaultsRestClient; - private ClientDiagnostics _dataProtectionClientDiagnostics; - private DataProtectionRestOperations _dataProtectionRestClient; - private ClientDiagnostics _resourceGuardClientDiagnostics; - private ResourceGuardsRestOperations _resourceGuardRestClient; - - /// 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 DataProtectionBackupVaultBackupVaultsClientDiagnostics => _dataProtectionBackupVaultBackupVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", DataProtectionBackupVaultResource.ResourceType.Namespace, Diagnostics); - private BackupVaultsRestOperations DataProtectionBackupVaultBackupVaultsRestClient => _dataProtectionBackupVaultBackupVaultsRestClient ??= new BackupVaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataProtectionBackupVaultResource.ResourceType)); - private ClientDiagnostics DataProtectionClientDiagnostics => _dataProtectionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DataProtectionRestOperations DataProtectionRestClient => _dataProtectionRestClient ??= new DataProtectionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ResourceGuardClientDiagnostics => _resourceGuardClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", ResourceGuardResource.ResourceType.Namespace, Diagnostics); - private ResourceGuardsRestOperations ResourceGuardRestClient => _resourceGuardRestClient ??= new ResourceGuardsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ResourceGuardResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns resource collection belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults - /// - /// - /// Operation Id - /// BackupVaults_GetInSubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataProtectionBackupVaultsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataProtectionBackupVaultBackupVaultsRestClient.CreateGetInSubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProtectionBackupVaultBackupVaultsRestClient.CreateGetInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataProtectionBackupVaultResource(Client, DataProtectionBackupVaultData.DeserializeDataProtectionBackupVaultData(e)), DataProtectionBackupVaultBackupVaultsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataProtectionBackupVaults", "value", "nextLink", cancellationToken); - } - - /// - /// Returns resource collection belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults - /// - /// - /// Operation Id - /// BackupVaults_GetInSubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataProtectionBackupVaults(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataProtectionBackupVaultBackupVaultsRestClient.CreateGetInSubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProtectionBackupVaultBackupVaultsRestClient.CreateGetInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataProtectionBackupVaultResource(Client, DataProtectionBackupVaultData.DeserializeDataProtectionBackupVaultData(e)), DataProtectionBackupVaultBackupVaultsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataProtectionBackupVaults", "value", "nextLink", cancellationToken); - } - - /// - /// Validates if a feature is supported - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport - /// - /// - /// Operation Id - /// DataProtection_CheckFeatureSupport - /// - /// - /// - /// The String to use. - /// Feature support request object. - /// The cancellation token to use. - public virtual async Task> CheckDataProtectionBackupFeatureSupportAsync(AzureLocation location, BackupFeatureValidationContentBase content, CancellationToken cancellationToken = default) - { - using var scope = DataProtectionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataProtectionBackupFeatureSupport"); - scope.Start(); - try - { - var response = await DataProtectionRestClient.CheckFeatureSupportAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Validates if a feature is supported - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport - /// - /// - /// Operation Id - /// DataProtection_CheckFeatureSupport - /// - /// - /// - /// The String to use. - /// Feature support request object. - /// The cancellation token to use. - public virtual Response CheckDataProtectionBackupFeatureSupport(AzureLocation location, BackupFeatureValidationContentBase content, CancellationToken cancellationToken = default) - { - using var scope = DataProtectionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataProtectionBackupFeatureSupport"); - scope.Start(); - try - { - var response = DataProtectionRestClient.CheckFeatureSupport(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns ResourceGuards collection belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards - /// - /// - /// Operation Id - /// ResourceGuards_GetResourcesInSubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetResourceGuardsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceGuardRestClient.CreateGetResourcesInSubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceGuardRestClient.CreateGetResourcesInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourceGuardResource(Client, ResourceGuardData.DeserializeResourceGuardData(e)), ResourceGuardClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceGuards", "value", "nextLink", cancellationToken); - } - - /// - /// Returns ResourceGuards collection belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards - /// - /// - /// Operation Id - /// ResourceGuards_GetResourcesInSubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetResourceGuards(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceGuardRestClient.CreateGetResourcesInSubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceGuardRestClient.CreateGetResourcesInSubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourceGuardResource(Client, ResourceGuardData.DeserializeResourceGuardData(e)), ResourceGuardClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceGuards", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResource.cs index 198bbf2e2c927..7245aba47b4fc 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DataProtectionBackup public partial class ResourceGuardProxyBaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The resourceGuardProxyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"; diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardResource.cs index 2edf149537393..43e715a0c2a93 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DataProtectionBackup public partial class ResourceGuardResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceGuardsName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceGuardsName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"; diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/api/Azure.ResourceManager.DataShare.netstandard2.0.cs b/sdk/datashare/Azure.ResourceManager.DataShare/api/Azure.ResourceManager.DataShare.netstandard2.0.cs index 7f7b10d2ddae7..5c9411e11a4ab 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/api/Azure.ResourceManager.DataShare.netstandard2.0.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/api/Azure.ResourceManager.DataShare.netstandard2.0.cs @@ -19,7 +19,7 @@ protected DataShareAccountCollection() { } } public partial class DataShareAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public DataShareAccountData(Azure.Core.AzureLocation location, Azure.ResourceManager.Models.ManagedServiceIdentity identity) : base (default(Azure.Core.AzureLocation)) { } + public DataShareAccountData(Azure.Core.AzureLocation location, Azure.ResourceManager.Models.ManagedServiceIdentity identity) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.DataShare.Models.DataShareProvisioningState? ProvisioningState { get { throw null; } } @@ -480,6 +480,49 @@ protected ShareSubscriptionResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DataShare.ShareSubscriptionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DataShare.Mocking +{ + public partial class MockableDataShareArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDataShareArmClient() { } + public virtual Azure.ResourceManager.DataShare.DataShareAccountResource GetDataShareAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.DataShareConsumerInvitationResource GetDataShareConsumerInvitationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.DataShareInvitationResource GetDataShareInvitationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.DataShareResource GetDataShareResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.DataShareSynchronizationSettingResource GetDataShareSynchronizationSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.DataShareTriggerResource GetDataShareTriggerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.ProviderShareSubscriptionResource GetProviderShareSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.ShareDataSetMappingResource GetShareDataSetMappingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.ShareDataSetResource GetShareDataSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DataShare.ShareSubscriptionResource GetShareSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDataShareResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDataShareResourceGroupResource() { } + public virtual Azure.Response GetDataShareAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataShareAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataShare.DataShareAccountCollection GetDataShareAccounts() { throw null; } + } + public partial class MockableDataShareSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDataShareSubscriptionResource() { } + public virtual Azure.Pageable GetDataShareAccounts(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataShareAccountsAsync(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableDataShareTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableDataShareTenantResource() { } + public virtual Azure.Response ActivateEmail(Azure.Core.AzureLocation location, Azure.ResourceManager.DataShare.Models.DataShareEmailRegistration emailRegistration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ActivateEmailAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataShare.Models.DataShareEmailRegistration emailRegistration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDataShareConsumerInvitation(Azure.Core.AzureLocation location, System.Guid invitationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataShareConsumerInvitationAsync(Azure.Core.AzureLocation location, System.Guid invitationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataShare.DataShareConsumerInvitationCollection GetDataShareConsumerInvitations() { throw null; } + public virtual Azure.Response RegisterEmail(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RegisterEmailAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RejectConsumerInvitation(Azure.Core.AzureLocation location, Azure.ResourceManager.DataShare.DataShareConsumerInvitationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RejectConsumerInvitationAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DataShare.DataShareConsumerInvitationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DataShare.Models { public partial class AdlsGen1FileDataSet : Azure.ResourceManager.DataShare.ShareDataSetData diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountResource.cs index bea9a8a26a2ed..2f24d9ee92d13 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DataShare public partial class DataShareAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataShareResources and their operations over a DataShareResource. public virtual DataShareCollection GetDataShares() { - return GetCachedClient(Client => new DataShareCollection(Client, Id)); + return GetCachedClient(client => new DataShareCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual DataShareCollection GetDataShares() /// /// The name of the share to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataShareAsync(string shareName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetDataShareAsync(string /// /// The name of the share to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataShare(string shareName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetDataShare(string shareName, Cancel /// An object representing collection of ShareSubscriptionResources and their operations over a ShareSubscriptionResource. public virtual ShareSubscriptionCollection GetShareSubscriptions() { - return GetCachedClient(Client => new ShareSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new ShareSubscriptionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual ShareSubscriptionCollection GetShareSubscriptions() /// /// The name of the shareSubscription. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetShareSubscriptionAsync(string shareSubscriptionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetShareSubscript /// /// The name of the shareSubscription. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetShareSubscription(string shareSubscriptionName, CancellationToken cancellationToken = default) { diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareConsumerInvitationResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareConsumerInvitationResource.cs index 932c1f6375cf6..21263f1bd01b3 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareConsumerInvitationResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareConsumerInvitationResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.DataShare public partial class DataShareConsumerInvitationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The location. + /// The invitationId. public static ResourceIdentifier CreateResourceIdentifier(AzureLocation location, Guid invitationId) { var resourceId = $"/providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId}"; diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareInvitationResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareInvitationResource.cs index e57eb861e4581..19486be0b54e4 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareInvitationResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareInvitationResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DataShare public partial class DataShareInvitationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareName. + /// The invitationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareName, string invitationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/invitations/{invitationName}"; diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareResource.cs index c73cb2f8861ae..fcc6284ba7aa3 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DataShare public partial class DataShareResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ShareDataSetResources and their operations over a ShareDataSetResource. public virtual ShareDataSetCollection GetShareDataSets() { - return GetCachedClient(Client => new ShareDataSetCollection(Client, Id)); + return GetCachedClient(client => new ShareDataSetCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual ShareDataSetCollection GetShareDataSets() /// /// The name of the dataSet. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetShareDataSetAsync(string dataSetName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetShareDataSetAsync(s /// /// The name of the dataSet. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetShareDataSet(string dataSetName, CancellationToken cancellationToken = default) { @@ -145,7 +149,7 @@ public virtual Response GetShareDataSet(string dataSetName /// An object representing collection of DataShareInvitationResources and their operations over a DataShareInvitationResource. public virtual DataShareInvitationCollection GetDataShareInvitations() { - return GetCachedClient(Client => new DataShareInvitationCollection(Client, Id)); + return GetCachedClient(client => new DataShareInvitationCollection(client, Id)); } /// @@ -163,8 +167,8 @@ public virtual DataShareInvitationCollection GetDataShareInvitations() /// /// The name of the invitation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataShareInvitationAsync(string invitationName, CancellationToken cancellationToken = default) { @@ -186,8 +190,8 @@ public virtual async Task> GetDataShareInv /// /// The name of the invitation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataShareInvitation(string invitationName, CancellationToken cancellationToken = default) { @@ -198,7 +202,7 @@ public virtual Response GetDataShareInvitation(stri /// An object representing collection of ProviderShareSubscriptionResources and their operations over a ProviderShareSubscriptionResource. public virtual ProviderShareSubscriptionCollection GetProviderShareSubscriptions() { - return GetCachedClient(Client => new ProviderShareSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new ProviderShareSubscriptionCollection(client, Id)); } /// @@ -216,8 +220,8 @@ public virtual ProviderShareSubscriptionCollection GetProviderShareSubscriptions /// /// To locate shareSubscription. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProviderShareSubscriptionAsync(string providerShareSubscriptionId, CancellationToken cancellationToken = default) { @@ -239,8 +243,8 @@ public virtual async Task> GetProvid /// /// To locate shareSubscription. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProviderShareSubscription(string providerShareSubscriptionId, CancellationToken cancellationToken = default) { @@ -251,7 +255,7 @@ public virtual Response GetProviderShareSubsc /// An object representing collection of DataShareSynchronizationSettingResources and their operations over a DataShareSynchronizationSettingResource. public virtual DataShareSynchronizationSettingCollection GetDataShareSynchronizationSettings() { - return GetCachedClient(Client => new DataShareSynchronizationSettingCollection(Client, Id)); + return GetCachedClient(client => new DataShareSynchronizationSettingCollection(client, Id)); } /// @@ -269,8 +273,8 @@ public virtual DataShareSynchronizationSettingCollection GetDataShareSynchroniza /// /// The name of the synchronizationSetting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataShareSynchronizationSettingAsync(string synchronizationSettingName, CancellationToken cancellationToken = default) { @@ -292,8 +296,8 @@ public virtual async Task> Get /// /// The name of the synchronizationSetting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataShareSynchronizationSetting(string synchronizationSettingName, CancellationToken cancellationToken = default) { diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareSynchronizationSettingResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareSynchronizationSettingResource.cs index 413e966a8cfc9..59b9091fc7483 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareSynchronizationSettingResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareSynchronizationSettingResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.DataShare public partial class DataShareSynchronizationSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareName. + /// The synchronizationSettingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareName, string synchronizationSettingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/synchronizationSettings/{synchronizationSettingName}"; diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareTriggerResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareTriggerResource.cs index 5f1a31f32a9c2..fcc4287debb2e 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareTriggerResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareTriggerResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.DataShare public partial class DataShareTriggerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareSubscriptionName. + /// The triggerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareSubscriptionName, string triggerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/triggers/{triggerName}"; diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/DataShareExtensions.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/DataShareExtensions.cs index 4f17bdec8c0d5..68b0e13fc5346 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/DataShareExtensions.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/DataShareExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DataShare.Mocking; using Azure.ResourceManager.DataShare.Models; using Azure.ResourceManager.Resources; @@ -19,249 +20,198 @@ namespace Azure.ResourceManager.DataShare /// A class to add extension methods to Azure.ResourceManager.DataShare. public static partial class DataShareExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDataShareArmClient GetMockableDataShareArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDataShareArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataShareResourceGroupResource GetMockableDataShareResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataShareResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDataShareSubscriptionResource GetMockableDataShareSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDataShareSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDataShareTenantResource GetMockableDataShareTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDataShareTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region DataShareAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataShareAccountResource GetDataShareAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataShareAccountResource.ValidateResourceId(id); - return new DataShareAccountResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetDataShareAccountResource(id); } - #endregion - #region DataShareConsumerInvitationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataShareConsumerInvitationResource GetDataShareConsumerInvitationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataShareConsumerInvitationResource.ValidateResourceId(id); - return new DataShareConsumerInvitationResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetDataShareConsumerInvitationResource(id); } - #endregion - #region ShareDataSetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ShareDataSetResource GetShareDataSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ShareDataSetResource.ValidateResourceId(id); - return new ShareDataSetResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetShareDataSetResource(id); } - #endregion - #region ShareDataSetMappingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ShareDataSetMappingResource GetShareDataSetMappingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ShareDataSetMappingResource.ValidateResourceId(id); - return new ShareDataSetMappingResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetShareDataSetMappingResource(id); } - #endregion - #region DataShareInvitationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataShareInvitationResource GetDataShareInvitationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataShareInvitationResource.ValidateResourceId(id); - return new DataShareInvitationResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetDataShareInvitationResource(id); } - #endregion - #region DataShareResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataShareResource GetDataShareResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataShareResource.ValidateResourceId(id); - return new DataShareResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetDataShareResource(id); } - #endregion - #region ProviderShareSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProviderShareSubscriptionResource GetProviderShareSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProviderShareSubscriptionResource.ValidateResourceId(id); - return new ProviderShareSubscriptionResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetProviderShareSubscriptionResource(id); } - #endregion - #region ShareSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ShareSubscriptionResource GetShareSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ShareSubscriptionResource.ValidateResourceId(id); - return new ShareSubscriptionResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetShareSubscriptionResource(id); } - #endregion - #region DataShareSynchronizationSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataShareSynchronizationSettingResource GetDataShareSynchronizationSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataShareSynchronizationSettingResource.ValidateResourceId(id); - return new DataShareSynchronizationSettingResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetDataShareSynchronizationSettingResource(id); } - #endregion - #region DataShareTriggerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataShareTriggerResource GetDataShareTriggerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataShareTriggerResource.ValidateResourceId(id); - return new DataShareTriggerResource(client, id); - } - ); + return GetMockableDataShareArmClient(client).GetDataShareTriggerResource(id); } - #endregion - /// Gets a collection of DataShareAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of DataShareAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataShareAccountResources and their operations over a DataShareAccountResource. public static DataShareAccountCollection GetDataShareAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataShareAccounts(); + return GetMockableDataShareResourceGroupResource(resourceGroupResource).GetDataShareAccounts(); } /// @@ -276,16 +226,20 @@ public static DataShareAccountCollection GetDataShareAccounts(this ResourceGroup /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the share account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataShareAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataShareAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableDataShareResourceGroupResource(resourceGroupResource).GetDataShareAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -300,16 +254,20 @@ public static async Task> GetDataShareAccount /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the share account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataShareAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataShareAccounts().Get(accountName, cancellationToken); + return GetMockableDataShareResourceGroupResource(resourceGroupResource).GetDataShareAccount(accountName, cancellationToken); } /// @@ -324,6 +282,10 @@ public static Response GetDataShareAccount(this Resour /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token. @@ -331,7 +293,7 @@ public static Response GetDataShareAccount(this Resour /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDataShareAccountsAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataShareAccountsAsync(skipToken, cancellationToken); + return GetMockableDataShareSubscriptionResource(subscriptionResource).GetDataShareAccountsAsync(skipToken, cancellationToken); } /// @@ -346,6 +308,10 @@ public static AsyncPageable GetDataShareAccountsAsync( /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token. @@ -353,15 +319,21 @@ public static AsyncPageable GetDataShareAccountsAsync( /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDataShareAccounts(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataShareAccounts(skipToken, cancellationToken); + return GetMockableDataShareSubscriptionResource(subscriptionResource).GetDataShareAccounts(skipToken, cancellationToken); } - /// Gets a collection of DataShareConsumerInvitationResources in the TenantResource. + /// + /// Gets a collection of DataShareConsumerInvitationResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataShareConsumerInvitationResources and their operations over a DataShareConsumerInvitationResource. public static DataShareConsumerInvitationCollection GetDataShareConsumerInvitations(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetDataShareConsumerInvitations(); + return GetMockableDataShareTenantResource(tenantResource).GetDataShareConsumerInvitations(); } /// @@ -376,6 +348,10 @@ public static DataShareConsumerInvitationCollection GetDataShareConsumerInvitati /// ConsumerInvitations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the invitation. @@ -384,7 +360,7 @@ public static DataShareConsumerInvitationCollection GetDataShareConsumerInvitati [ForwardsClientCalls] public static async Task> GetDataShareConsumerInvitationAsync(this TenantResource tenantResource, AzureLocation location, Guid invitationId, CancellationToken cancellationToken = default) { - return await tenantResource.GetDataShareConsumerInvitations().GetAsync(location, invitationId, cancellationToken).ConfigureAwait(false); + return await GetMockableDataShareTenantResource(tenantResource).GetDataShareConsumerInvitationAsync(location, invitationId, cancellationToken).ConfigureAwait(false); } /// @@ -399,6 +375,10 @@ public static async Task> GetDataS /// ConsumerInvitations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the invitation. @@ -407,7 +387,7 @@ public static async Task> GetDataS [ForwardsClientCalls] public static Response GetDataShareConsumerInvitation(this TenantResource tenantResource, AzureLocation location, Guid invitationId, CancellationToken cancellationToken = default) { - return tenantResource.GetDataShareConsumerInvitations().Get(location, invitationId, cancellationToken); + return GetMockableDataShareTenantResource(tenantResource).GetDataShareConsumerInvitation(location, invitationId, cancellationToken); } /// @@ -422,6 +402,10 @@ public static Response GetDataShareConsumer /// ConsumerInvitations_RejectInvitation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the invitation. @@ -430,9 +414,7 @@ public static Response GetDataShareConsumer /// is null. public static async Task> RejectConsumerInvitationAsync(this TenantResource tenantResource, AzureLocation location, DataShareConsumerInvitationData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return await GetTenantResourceExtensionClient(tenantResource).RejectConsumerInvitationAsync(location, data, cancellationToken).ConfigureAwait(false); + return await GetMockableDataShareTenantResource(tenantResource).RejectConsumerInvitationAsync(location, data, cancellationToken).ConfigureAwait(false); } /// @@ -447,6 +429,10 @@ public static async Task> RejectCo /// ConsumerInvitations_RejectInvitation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the invitation. @@ -455,9 +441,7 @@ public static async Task> RejectCo /// is null. public static Response RejectConsumerInvitation(this TenantResource tenantResource, AzureLocation location, DataShareConsumerInvitationData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return GetTenantResourceExtensionClient(tenantResource).RejectConsumerInvitation(location, data, cancellationToken); + return GetMockableDataShareTenantResource(tenantResource).RejectConsumerInvitation(location, data, cancellationToken); } /// @@ -472,6 +456,10 @@ public static Response RejectConsumerInvita /// EmailRegistrations_ActivateEmail /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the activation. @@ -480,9 +468,7 @@ public static Response RejectConsumerInvita /// is null. public static async Task> ActivateEmailAsync(this TenantResource tenantResource, AzureLocation location, DataShareEmailRegistration emailRegistration, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(emailRegistration, nameof(emailRegistration)); - - return await GetTenantResourceExtensionClient(tenantResource).ActivateEmailAsync(location, emailRegistration, cancellationToken).ConfigureAwait(false); + return await GetMockableDataShareTenantResource(tenantResource).ActivateEmailAsync(location, emailRegistration, cancellationToken).ConfigureAwait(false); } /// @@ -497,6 +483,10 @@ public static async Task> ActivateEmailAsyn /// EmailRegistrations_ActivateEmail /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the activation. @@ -505,9 +495,7 @@ public static async Task> ActivateEmailAsyn /// is null. public static Response ActivateEmail(this TenantResource tenantResource, AzureLocation location, DataShareEmailRegistration emailRegistration, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(emailRegistration, nameof(emailRegistration)); - - return GetTenantResourceExtensionClient(tenantResource).ActivateEmail(location, emailRegistration, cancellationToken); + return GetMockableDataShareTenantResource(tenantResource).ActivateEmail(location, emailRegistration, cancellationToken); } /// @@ -522,13 +510,17 @@ public static Response ActivateEmail(this TenantReso /// EmailRegistrations_RegisterEmail /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the registration. /// The cancellation token to use. public static async Task> RegisterEmailAsync(this TenantResource tenantResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetTenantResourceExtensionClient(tenantResource).RegisterEmailAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableDataShareTenantResource(tenantResource).RegisterEmailAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -543,13 +535,17 @@ public static async Task> RegisterEmailAsyn /// EmailRegistrations_RegisterEmail /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the registration. /// The cancellation token to use. public static Response RegisterEmail(this TenantResource tenantResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).RegisterEmail(location, cancellationToken); + return GetMockableDataShareTenantResource(tenantResource).RegisterEmail(location, cancellationToken); } } } diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareArmClient.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareArmClient.cs new file mode 100644 index 0000000000000..8248b2b7dbe71 --- /dev/null +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareArmClient.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DataShare; + +namespace Azure.ResourceManager.DataShare.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDataShareArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataShareArmClient() + { + } + + /// 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 MockableDataShareArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDataShareArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataShareAccountResource GetDataShareAccountResource(ResourceIdentifier id) + { + DataShareAccountResource.ValidateResourceId(id); + return new DataShareAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataShareConsumerInvitationResource GetDataShareConsumerInvitationResource(ResourceIdentifier id) + { + DataShareConsumerInvitationResource.ValidateResourceId(id); + return new DataShareConsumerInvitationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ShareDataSetResource GetShareDataSetResource(ResourceIdentifier id) + { + ShareDataSetResource.ValidateResourceId(id); + return new ShareDataSetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ShareDataSetMappingResource GetShareDataSetMappingResource(ResourceIdentifier id) + { + ShareDataSetMappingResource.ValidateResourceId(id); + return new ShareDataSetMappingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataShareInvitationResource GetDataShareInvitationResource(ResourceIdentifier id) + { + DataShareInvitationResource.ValidateResourceId(id); + return new DataShareInvitationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataShareResource GetDataShareResource(ResourceIdentifier id) + { + DataShareResource.ValidateResourceId(id); + return new DataShareResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProviderShareSubscriptionResource GetProviderShareSubscriptionResource(ResourceIdentifier id) + { + ProviderShareSubscriptionResource.ValidateResourceId(id); + return new ProviderShareSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ShareSubscriptionResource GetShareSubscriptionResource(ResourceIdentifier id) + { + ShareSubscriptionResource.ValidateResourceId(id); + return new ShareSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataShareSynchronizationSettingResource GetDataShareSynchronizationSettingResource(ResourceIdentifier id) + { + DataShareSynchronizationSettingResource.ValidateResourceId(id); + return new DataShareSynchronizationSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataShareTriggerResource GetDataShareTriggerResource(ResourceIdentifier id) + { + DataShareTriggerResource.ValidateResourceId(id); + return new DataShareTriggerResource(Client, id); + } + } +} diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareResourceGroupResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareResourceGroupResource.cs new file mode 100644 index 0000000000000..7f2ff365664fc --- /dev/null +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.DataShare; + +namespace Azure.ResourceManager.DataShare.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDataShareResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDataShareResourceGroupResource() + { + } + + /// 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 MockableDataShareResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataShareAccountResources in the ResourceGroupResource. + /// An object representing collection of DataShareAccountResources and their operations over a DataShareAccountResource. + public virtual DataShareAccountCollection GetDataShareAccounts() + { + return GetCachedClient(client => new DataShareAccountCollection(client, Id)); + } + + /// + /// Get an account + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the share account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataShareAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetDataShareAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an account + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the share account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataShareAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetDataShareAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareSubscriptionResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareSubscriptionResource.cs new file mode 100644 index 0000000000000..5a3859f09d1b2 --- /dev/null +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareSubscriptionResource.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataShare; + +namespace Azure.ResourceManager.DataShare.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDataShareSubscriptionResource : ArmResource + { + private ClientDiagnostics _dataShareAccountAccountsClientDiagnostics; + private AccountsRestOperations _dataShareAccountAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataShareSubscriptionResource() + { + } + + /// 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 MockableDataShareSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataShareAccountAccountsClientDiagnostics => _dataShareAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataShare", DataShareAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations DataShareAccountAccountsRestClient => _dataShareAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataShareAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Accounts in Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// Continuation token. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataShareAccountsAsync(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataShareAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataShareAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataShareAccountResource(Client, DataShareAccountData.DeserializeDataShareAccountData(e)), DataShareAccountAccountsClientDiagnostics, Pipeline, "MockableDataShareSubscriptionResource.GetDataShareAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// List Accounts in Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// Continuation token. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataShareAccounts(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataShareAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataShareAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataShareAccountResource(Client, DataShareAccountData.DeserializeDataShareAccountData(e)), DataShareAccountAccountsClientDiagnostics, Pipeline, "MockableDataShareSubscriptionResource.GetDataShareAccounts", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareTenantResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareTenantResource.cs new file mode 100644 index 0000000000000..9c6346df01f33 --- /dev/null +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/MockableDataShareTenantResource.cs @@ -0,0 +1,304 @@ +// 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; +using Azure.ResourceManager.DataShare; +using Azure.ResourceManager.DataShare.Models; + +namespace Azure.ResourceManager.DataShare.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableDataShareTenantResource : ArmResource + { + private ClientDiagnostics _dataShareConsumerInvitationConsumerInvitationsClientDiagnostics; + private ConsumerInvitationsRestOperations _dataShareConsumerInvitationConsumerInvitationsRestClient; + private ClientDiagnostics _emailRegistrationsClientDiagnostics; + private EmailRegistrationsRestOperations _emailRegistrationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDataShareTenantResource() + { + } + + /// 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 MockableDataShareTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataShareConsumerInvitationConsumerInvitationsClientDiagnostics => _dataShareConsumerInvitationConsumerInvitationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataShare", DataShareConsumerInvitationResource.ResourceType.Namespace, Diagnostics); + private ConsumerInvitationsRestOperations DataShareConsumerInvitationConsumerInvitationsRestClient => _dataShareConsumerInvitationConsumerInvitationsRestClient ??= new ConsumerInvitationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataShareConsumerInvitationResource.ResourceType)); + private ClientDiagnostics EmailRegistrationsClientDiagnostics => _emailRegistrationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataShare", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private EmailRegistrationsRestOperations EmailRegistrationsRestClient => _emailRegistrationsRestClient ??= new EmailRegistrationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataShareConsumerInvitationResources in the TenantResource. + /// An object representing collection of DataShareConsumerInvitationResources and their operations over a DataShareConsumerInvitationResource. + public virtual DataShareConsumerInvitationCollection GetDataShareConsumerInvitations() + { + return GetCachedClient(client => new DataShareConsumerInvitationCollection(client, Id)); + } + + /// + /// Get an invitation + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId} + /// + /// + /// Operation Id + /// ConsumerInvitations_Get + /// + /// + /// + /// Location of the invitation. + /// An invitation id. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetDataShareConsumerInvitationAsync(AzureLocation location, Guid invitationId, CancellationToken cancellationToken = default) + { + return await GetDataShareConsumerInvitations().GetAsync(location, invitationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an invitation + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId} + /// + /// + /// Operation Id + /// ConsumerInvitations_Get + /// + /// + /// + /// Location of the invitation. + /// An invitation id. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetDataShareConsumerInvitation(AzureLocation location, Guid invitationId, CancellationToken cancellationToken = default) + { + return GetDataShareConsumerInvitations().Get(location, invitationId, cancellationToken); + } + + /// + /// Reject an invitation + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/rejectInvitation + /// + /// + /// Operation Id + /// ConsumerInvitations_RejectInvitation + /// + /// + /// + /// Location of the invitation. + /// An invitation payload. + /// The cancellation token to use. + /// is null. + public virtual async Task> RejectConsumerInvitationAsync(AzureLocation location, DataShareConsumerInvitationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = DataShareConsumerInvitationConsumerInvitationsClientDiagnostics.CreateScope("MockableDataShareTenantResource.RejectConsumerInvitation"); + scope.Start(); + try + { + var response = await DataShareConsumerInvitationConsumerInvitationsRestClient.RejectInvitationAsync(location, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DataShareConsumerInvitationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Reject an invitation + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/rejectInvitation + /// + /// + /// Operation Id + /// ConsumerInvitations_RejectInvitation + /// + /// + /// + /// Location of the invitation. + /// An invitation payload. + /// The cancellation token to use. + /// is null. + public virtual Response RejectConsumerInvitation(AzureLocation location, DataShareConsumerInvitationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = DataShareConsumerInvitationConsumerInvitationsClientDiagnostics.CreateScope("MockableDataShareTenantResource.RejectConsumerInvitation"); + scope.Start(); + try + { + var response = DataShareConsumerInvitationConsumerInvitationsRestClient.RejectInvitation(location, data, cancellationToken); + return Response.FromValue(new DataShareConsumerInvitationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Activate the email registration for the current tenant + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/activateEmail + /// + /// + /// Operation Id + /// EmailRegistrations_ActivateEmail + /// + /// + /// + /// Location of the activation. + /// The payload for tenant domain activation. + /// The cancellation token to use. + /// is null. + public virtual async Task> ActivateEmailAsync(AzureLocation location, DataShareEmailRegistration emailRegistration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(emailRegistration, nameof(emailRegistration)); + + using var scope = EmailRegistrationsClientDiagnostics.CreateScope("MockableDataShareTenantResource.ActivateEmail"); + scope.Start(); + try + { + var response = await EmailRegistrationsRestClient.ActivateEmailAsync(location, emailRegistration, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Activate the email registration for the current tenant + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/activateEmail + /// + /// + /// Operation Id + /// EmailRegistrations_ActivateEmail + /// + /// + /// + /// Location of the activation. + /// The payload for tenant domain activation. + /// The cancellation token to use. + /// is null. + public virtual Response ActivateEmail(AzureLocation location, DataShareEmailRegistration emailRegistration, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(emailRegistration, nameof(emailRegistration)); + + using var scope = EmailRegistrationsClientDiagnostics.CreateScope("MockableDataShareTenantResource.ActivateEmail"); + scope.Start(); + try + { + var response = EmailRegistrationsRestClient.ActivateEmail(location, emailRegistration, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register an email for the current tenant + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/registerEmail + /// + /// + /// Operation Id + /// EmailRegistrations_RegisterEmail + /// + /// + /// + /// Location of the registration. + /// The cancellation token to use. + public virtual async Task> RegisterEmailAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = EmailRegistrationsClientDiagnostics.CreateScope("MockableDataShareTenantResource.RegisterEmail"); + scope.Start(); + try + { + var response = await EmailRegistrationsRestClient.RegisterEmailAsync(location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register an email for the current tenant + /// + /// + /// Request Path + /// /providers/Microsoft.DataShare/locations/{location}/registerEmail + /// + /// + /// Operation Id + /// EmailRegistrations_RegisterEmail + /// + /// + /// + /// Location of the registration. + /// The cancellation token to use. + public virtual Response RegisterEmail(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = EmailRegistrationsClientDiagnostics.CreateScope("MockableDataShareTenantResource.RegisterEmail"); + scope.Start(); + try + { + var response = EmailRegistrationsRestClient.RegisterEmail(location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d1f59a01040ba..0000000000000 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DataShare -{ - /// 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 DataShareAccountResources in the ResourceGroupResource. - /// An object representing collection of DataShareAccountResources and their operations over a DataShareAccountResource. - public virtual DataShareAccountCollection GetDataShareAccounts() - { - return GetCachedClient(Client => new DataShareAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 657653087537b..0000000000000 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DataShare -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataShareAccountAccountsClientDiagnostics; - private AccountsRestOperations _dataShareAccountAccountsRestClient; - - /// 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 DataShareAccountAccountsClientDiagnostics => _dataShareAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataShare", DataShareAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations DataShareAccountAccountsRestClient => _dataShareAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataShareAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List Accounts in Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// Continuation token. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataShareAccountsAsync(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataShareAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataShareAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataShareAccountResource(Client, DataShareAccountData.DeserializeDataShareAccountData(e)), DataShareAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataShareAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List Accounts in Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// Continuation token. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataShareAccounts(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataShareAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataShareAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataShareAccountResource(Client, DataShareAccountData.DeserializeDataShareAccountData(e)), DataShareAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataShareAccounts", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 60b4a9c74b2b7..0000000000000 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,247 +0,0 @@ -// 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; -using Azure.ResourceManager.DataShare.Models; - -namespace Azure.ResourceManager.DataShare -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataShareConsumerInvitationConsumerInvitationsClientDiagnostics; - private ConsumerInvitationsRestOperations _dataShareConsumerInvitationConsumerInvitationsRestClient; - private ClientDiagnostics _emailRegistrationsClientDiagnostics; - private EmailRegistrationsRestOperations _emailRegistrationsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics DataShareConsumerInvitationConsumerInvitationsClientDiagnostics => _dataShareConsumerInvitationConsumerInvitationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataShare", DataShareConsumerInvitationResource.ResourceType.Namespace, Diagnostics); - private ConsumerInvitationsRestOperations DataShareConsumerInvitationConsumerInvitationsRestClient => _dataShareConsumerInvitationConsumerInvitationsRestClient ??= new ConsumerInvitationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataShareConsumerInvitationResource.ResourceType)); - private ClientDiagnostics EmailRegistrationsClientDiagnostics => _emailRegistrationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DataShare", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EmailRegistrationsRestOperations EmailRegistrationsRestClient => _emailRegistrationsRestClient ??= new EmailRegistrationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DataShareConsumerInvitationResources in the TenantResource. - /// An object representing collection of DataShareConsumerInvitationResources and their operations over a DataShareConsumerInvitationResource. - public virtual DataShareConsumerInvitationCollection GetDataShareConsumerInvitations() - { - return GetCachedClient(Client => new DataShareConsumerInvitationCollection(Client, Id)); - } - - /// - /// Reject an invitation - /// - /// - /// Request Path - /// /providers/Microsoft.DataShare/locations/{location}/rejectInvitation - /// - /// - /// Operation Id - /// ConsumerInvitations_RejectInvitation - /// - /// - /// - /// Location of the invitation. - /// An invitation payload. - /// The cancellation token to use. - public virtual async Task> RejectConsumerInvitationAsync(AzureLocation location, DataShareConsumerInvitationData data, CancellationToken cancellationToken = default) - { - using var scope = DataShareConsumerInvitationConsumerInvitationsClientDiagnostics.CreateScope("TenantResourceExtensionClient.RejectConsumerInvitation"); - scope.Start(); - try - { - var response = await DataShareConsumerInvitationConsumerInvitationsRestClient.RejectInvitationAsync(location, data, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DataShareConsumerInvitationResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Reject an invitation - /// - /// - /// Request Path - /// /providers/Microsoft.DataShare/locations/{location}/rejectInvitation - /// - /// - /// Operation Id - /// ConsumerInvitations_RejectInvitation - /// - /// - /// - /// Location of the invitation. - /// An invitation payload. - /// The cancellation token to use. - public virtual Response RejectConsumerInvitation(AzureLocation location, DataShareConsumerInvitationData data, CancellationToken cancellationToken = default) - { - using var scope = DataShareConsumerInvitationConsumerInvitationsClientDiagnostics.CreateScope("TenantResourceExtensionClient.RejectConsumerInvitation"); - scope.Start(); - try - { - var response = DataShareConsumerInvitationConsumerInvitationsRestClient.RejectInvitation(location, data, cancellationToken); - return Response.FromValue(new DataShareConsumerInvitationResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Activate the email registration for the current tenant - /// - /// - /// Request Path - /// /providers/Microsoft.DataShare/locations/{location}/activateEmail - /// - /// - /// Operation Id - /// EmailRegistrations_ActivateEmail - /// - /// - /// - /// Location of the activation. - /// The payload for tenant domain activation. - /// The cancellation token to use. - public virtual async Task> ActivateEmailAsync(AzureLocation location, DataShareEmailRegistration emailRegistration, CancellationToken cancellationToken = default) - { - using var scope = EmailRegistrationsClientDiagnostics.CreateScope("TenantResourceExtensionClient.ActivateEmail"); - scope.Start(); - try - { - var response = await EmailRegistrationsRestClient.ActivateEmailAsync(location, emailRegistration, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Activate the email registration for the current tenant - /// - /// - /// Request Path - /// /providers/Microsoft.DataShare/locations/{location}/activateEmail - /// - /// - /// Operation Id - /// EmailRegistrations_ActivateEmail - /// - /// - /// - /// Location of the activation. - /// The payload for tenant domain activation. - /// The cancellation token to use. - public virtual Response ActivateEmail(AzureLocation location, DataShareEmailRegistration emailRegistration, CancellationToken cancellationToken = default) - { - using var scope = EmailRegistrationsClientDiagnostics.CreateScope("TenantResourceExtensionClient.ActivateEmail"); - scope.Start(); - try - { - var response = EmailRegistrationsRestClient.ActivateEmail(location, emailRegistration, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register an email for the current tenant - /// - /// - /// Request Path - /// /providers/Microsoft.DataShare/locations/{location}/registerEmail - /// - /// - /// Operation Id - /// EmailRegistrations_RegisterEmail - /// - /// - /// - /// Location of the registration. - /// The cancellation token to use. - public virtual async Task> RegisterEmailAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = EmailRegistrationsClientDiagnostics.CreateScope("TenantResourceExtensionClient.RegisterEmail"); - scope.Start(); - try - { - var response = await EmailRegistrationsRestClient.RegisterEmailAsync(location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register an email for the current tenant - /// - /// - /// Request Path - /// /providers/Microsoft.DataShare/locations/{location}/registerEmail - /// - /// - /// Operation Id - /// EmailRegistrations_RegisterEmail - /// - /// - /// - /// Location of the registration. - /// The cancellation token to use. - public virtual Response RegisterEmail(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = EmailRegistrationsClientDiagnostics.CreateScope("TenantResourceExtensionClient.RegisterEmail"); - scope.Start(); - try - { - var response = EmailRegistrationsRestClient.RegisterEmail(location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ProviderShareSubscriptionResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ProviderShareSubscriptionResource.cs index b2ea002440f78..6ba3c78c0a177 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ProviderShareSubscriptionResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ProviderShareSubscriptionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DataShare public partial class ProviderShareSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareName. + /// The providerShareSubscriptionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareName, string providerShareSubscriptionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}"; diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetMappingResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetMappingResource.cs index 88263f8f1af46..f3fe7adbbabc7 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetMappingResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetMappingResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DataShare public partial class ShareDataSetMappingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareSubscriptionName. + /// The dataSetMappingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareSubscriptionName, string dataSetMappingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName}"; diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetResource.cs index 316be1b7dc669..dad423862117b 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareDataSetResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DataShare public partial class ShareDataSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareName. + /// The dataSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareName, string dataSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/dataSets/{dataSetName}"; diff --git a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionResource.cs index 53c1bc93b63ef..aad46cf04fa5f 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DataShare public partial class ShareSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareSubscriptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}"; @@ -96,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ShareDataSetMappingResources and their operations over a ShareDataSetMappingResource. public virtual ShareDataSetMappingCollection GetShareDataSetMappings() { - return GetCachedClient(Client => new ShareDataSetMappingCollection(Client, Id)); + return GetCachedClient(client => new ShareDataSetMappingCollection(client, Id)); } /// @@ -114,8 +118,8 @@ public virtual ShareDataSetMappingCollection GetShareDataSetMappings() /// /// The name of the dataSetMapping. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetShareDataSetMappingAsync(string dataSetMappingName, CancellationToken cancellationToken = default) { @@ -137,8 +141,8 @@ public virtual async Task> GetShareDataSet /// /// The name of the dataSetMapping. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetShareDataSetMapping(string dataSetMappingName, CancellationToken cancellationToken = default) { @@ -149,7 +153,7 @@ public virtual Response GetShareDataSetMapping(stri /// An object representing collection of DataShareTriggerResources and their operations over a DataShareTriggerResource. public virtual DataShareTriggerCollection GetDataShareTriggers() { - return GetCachedClient(Client => new DataShareTriggerCollection(Client, Id)); + return GetCachedClient(client => new DataShareTriggerCollection(client, Id)); } /// @@ -167,8 +171,8 @@ public virtual DataShareTriggerCollection GetDataShareTriggers() /// /// The name of the trigger. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataShareTriggerAsync(string triggerName, CancellationToken cancellationToken = default) { @@ -190,8 +194,8 @@ public virtual async Task> GetDataShareTrigge /// /// The name of the trigger. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataShareTrigger(string triggerName, CancellationToken cancellationToken = default) { diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/api/Azure.ResourceManager.DefenderEasm.netstandard2.0.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/api/Azure.ResourceManager.DefenderEasm.netstandard2.0.cs index 89e222575cacf..f9c40e358fd28 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/api/Azure.ResourceManager.DefenderEasm.netstandard2.0.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/api/Azure.ResourceManager.DefenderEasm.netstandard2.0.cs @@ -67,7 +67,7 @@ protected EasmWorkspaceCollection() { } } public partial class EasmWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public EasmWorkspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EasmWorkspaceData(Azure.Core.AzureLocation location) { } public string DataPlaneEndpoint { get { throw null; } } public Azure.ResourceManager.DefenderEasm.Models.EasmResourceProvisioningState? ProvisioningState { get { throw null; } } } @@ -97,6 +97,28 @@ protected EasmWorkspaceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.DefenderEasm.Models.EasmWorkspacePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DefenderEasm.Mocking +{ + public partial class MockableDefenderEasmArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDefenderEasmArmClient() { } + public virtual Azure.ResourceManager.DefenderEasm.EasmLabelResource GetEasmLabelResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DefenderEasm.EasmWorkspaceResource GetEasmWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDefenderEasmResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDefenderEasmResourceGroupResource() { } + public virtual Azure.Response GetEasmWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEasmWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DefenderEasm.EasmWorkspaceCollection GetEasmWorkspaces() { throw null; } + } + public partial class MockableDefenderEasmSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDefenderEasmSubscriptionResource() { } + public virtual Azure.Pageable GetEasmWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEasmWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DefenderEasm.Models { public static partial class ArmDefenderEasmModelFactory diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmLabelResource.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmLabelResource.cs index c5fcd4040c7aa..7a2f0c6782479 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmLabelResource.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmLabelResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DefenderEasm public partial class EasmLabelResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The labelName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string labelName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces/{workspaceName}/labels/{labelName}"; diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceResource.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceResource.cs index 46a0b1840f735..74dc37911ab5f 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceResource.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DefenderEasm public partial class EasmWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces/{workspaceName}"; @@ -97,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of EasmLabelResources and their operations over a EasmLabelResource. public virtual EasmLabelCollection GetEasmLabels() { - return GetCachedClient(Client => new EasmLabelCollection(Client, Id)); + return GetCachedClient(client => new EasmLabelCollection(client, Id)); } /// @@ -115,8 +118,8 @@ public virtual EasmLabelCollection GetEasmLabels() /// /// The name of the Label. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEasmLabelAsync(string labelName, CancellationToken cancellationToken = default) { @@ -138,8 +141,8 @@ public virtual async Task> GetEasmLabelAsync(string /// /// The name of the Label. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEasmLabel(string labelName, CancellationToken cancellationToken = default) { diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/DefenderEasmExtensions.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/DefenderEasmExtensions.cs index 2e26600dfdfed..adc1dbbbf2ae8 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/DefenderEasmExtensions.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/DefenderEasmExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DefenderEasm.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DefenderEasm @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.DefenderEasm /// A class to add extension methods to Azure.ResourceManager.DefenderEasm. public static partial class DefenderEasmExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDefenderEasmArmClient GetMockableDefenderEasmArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDefenderEasmArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDefenderEasmResourceGroupResource GetMockableDefenderEasmResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDefenderEasmResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDefenderEasmSubscriptionResource GetMockableDefenderEasmSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDefenderEasmSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region EasmWorkspaceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EasmWorkspaceResource GetEasmWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EasmWorkspaceResource.ValidateResourceId(id); - return new EasmWorkspaceResource(client, id); - } - ); + return GetMockableDefenderEasmArmClient(client).GetEasmWorkspaceResource(id); } - #endregion - #region EasmLabelResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EasmLabelResource GetEasmLabelResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EasmLabelResource.ValidateResourceId(id); - return new EasmLabelResource(client, id); - } - ); + return GetMockableDefenderEasmArmClient(client).GetEasmLabelResource(id); } - #endregion - /// Gets a collection of EasmWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of EasmWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EasmWorkspaceResources and their operations over a EasmWorkspaceResource. public static EasmWorkspaceCollection GetEasmWorkspaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEasmWorkspaces(); + return GetMockableDefenderEasmResourceGroupResource(resourceGroupResource).GetEasmWorkspaces(); } /// @@ -107,16 +92,20 @@ public static EasmWorkspaceCollection GetEasmWorkspaces(this ResourceGroupResour /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEasmWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEasmWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableDefenderEasmResourceGroupResource(resourceGroupResource).GetEasmWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -131,16 +120,20 @@ public static async Task> GetEasmWorkspaceAsync( /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEasmWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEasmWorkspaces().Get(workspaceName, cancellationToken); + return GetMockableDefenderEasmResourceGroupResource(resourceGroupResource).GetEasmWorkspace(workspaceName, cancellationToken); } /// @@ -155,13 +148,17 @@ public static Response GetEasmWorkspace(this ResourceGrou /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEasmWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEasmWorkspacesAsync(cancellationToken); + return GetMockableDefenderEasmSubscriptionResource(subscriptionResource).GetEasmWorkspacesAsync(cancellationToken); } /// @@ -176,13 +173,17 @@ public static AsyncPageable GetEasmWorkspacesAsync(this S /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEasmWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEasmWorkspaces(cancellationToken); + return GetMockableDefenderEasmSubscriptionResource(subscriptionResource).GetEasmWorkspaces(cancellationToken); } } } diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmArmClient.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmArmClient.cs new file mode 100644 index 0000000000000..fe12ab93867f9 --- /dev/null +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DefenderEasm; + +namespace Azure.ResourceManager.DefenderEasm.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDefenderEasmArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDefenderEasmArmClient() + { + } + + /// 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 MockableDefenderEasmArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDefenderEasmArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EasmWorkspaceResource GetEasmWorkspaceResource(ResourceIdentifier id) + { + EasmWorkspaceResource.ValidateResourceId(id); + return new EasmWorkspaceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EasmLabelResource GetEasmLabelResource(ResourceIdentifier id) + { + EasmLabelResource.ValidateResourceId(id); + return new EasmLabelResource(Client, id); + } + } +} diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmResourceGroupResource.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmResourceGroupResource.cs new file mode 100644 index 0000000000000..5fe0630af8f09 --- /dev/null +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.DefenderEasm; + +namespace Azure.ResourceManager.DefenderEasm.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDefenderEasmResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDefenderEasmResourceGroupResource() + { + } + + /// 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 MockableDefenderEasmResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of EasmWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of EasmWorkspaceResources and their operations over a EasmWorkspaceResource. + public virtual EasmWorkspaceCollection GetEasmWorkspaces() + { + return GetCachedClient(client => new EasmWorkspaceCollection(client, Id)); + } + + /// + /// Returns a workspace with the given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the Workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEasmWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetEasmWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a workspace with the given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the Workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEasmWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetEasmWorkspaces().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmSubscriptionResource.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmSubscriptionResource.cs new file mode 100644 index 0000000000000..b4bc5d78c5046 --- /dev/null +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/MockableDefenderEasmSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DefenderEasm; + +namespace Azure.ResourceManager.DefenderEasm.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDefenderEasmSubscriptionResource : ArmResource + { + private ClientDiagnostics _easmWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _easmWorkspaceWorkspacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDefenderEasmSubscriptionResource() + { + } + + /// 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 MockableDefenderEasmSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics EasmWorkspaceWorkspacesClientDiagnostics => _easmWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DefenderEasm", EasmWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations EasmWorkspaceWorkspacesRestClient => _easmWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EasmWorkspaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns a list of workspaces under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Easm/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEasmWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EasmWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EasmWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EasmWorkspaceResource(Client, EasmWorkspaceData.DeserializeEasmWorkspaceData(e)), EasmWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableDefenderEasmSubscriptionResource.GetEasmWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of workspaces under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Easm/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEasmWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EasmWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EasmWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EasmWorkspaceResource(Client, EasmWorkspaceData.DeserializeEasmWorkspaceData(e)), EasmWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableDefenderEasmSubscriptionResource.GetEasmWorkspaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index e172ba5fcb675..0000000000000 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DefenderEasm -{ - /// 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 EasmWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of EasmWorkspaceResources and their operations over a EasmWorkspaceResource. - public virtual EasmWorkspaceCollection GetEasmWorkspaces() - { - return GetCachedClient(Client => new EasmWorkspaceCollection(Client, Id)); - } - } -} diff --git a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b288af25e4c2d..0000000000000 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DefenderEasm -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _easmWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _easmWorkspaceWorkspacesRestClient; - - /// 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 EasmWorkspaceWorkspacesClientDiagnostics => _easmWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DefenderEasm", EasmWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations EasmWorkspaceWorkspacesRestClient => _easmWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EasmWorkspaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns a list of workspaces under the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Easm/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEasmWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EasmWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EasmWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EasmWorkspaceResource(Client, EasmWorkspaceData.DeserializeEasmWorkspaceData(e)), EasmWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEasmWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of workspaces under the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Easm/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEasmWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EasmWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EasmWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EasmWorkspaceResource(Client, EasmWorkspaceData.DeserializeEasmWorkspaceData(e)), EasmWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEasmWorkspaces", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/api/Azure.ResourceManager.DesktopVirtualization.netstandard2.0.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/api/Azure.ResourceManager.DesktopVirtualization.netstandard2.0.cs index dddc20061a8e7..6488c250aabef 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/api/Azure.ResourceManager.DesktopVirtualization.netstandard2.0.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/api/Azure.ResourceManager.DesktopVirtualization.netstandard2.0.cs @@ -74,7 +74,7 @@ protected HostPoolCollection() { } } public partial class HostPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public HostPoolData(Azure.Core.AzureLocation location, Azure.ResourceManager.DesktopVirtualization.Models.HostPoolType hostPoolType, Azure.ResourceManager.DesktopVirtualization.Models.HostPoolLoadBalancerType loadBalancerType, Azure.ResourceManager.DesktopVirtualization.Models.PreferredAppGroupType preferredAppGroupType) : base (default(Azure.Core.AzureLocation)) { } + public HostPoolData(Azure.Core.AzureLocation location, Azure.ResourceManager.DesktopVirtualization.Models.HostPoolType hostPoolType, Azure.ResourceManager.DesktopVirtualization.Models.HostPoolLoadBalancerType loadBalancerType, Azure.ResourceManager.DesktopVirtualization.Models.PreferredAppGroupType preferredAppGroupType) { } public Azure.ResourceManager.DesktopVirtualization.Models.SessionHostAgentUpdateProperties AgentUpdate { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList ApplicationGroupReferences { get { throw null; } } public string CustomRdpProperty { get { throw null; } set { } } @@ -258,8 +258,8 @@ protected ScalingPlanCollection() { } public partial class ScalingPlanData : Azure.ResourceManager.Models.TrackedResourceData { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public ScalingPlanData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } - public ScalingPlanData(Azure.Core.AzureLocation location, string timeZone) : base (default(Azure.Core.AzureLocation)) { } + public ScalingPlanData(Azure.Core.AzureLocation location) { } + public ScalingPlanData(Azure.Core.AzureLocation location, string timeZone) { } public string Description { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } public string ExclusionTag { get { throw null; } set { } } @@ -585,7 +585,7 @@ protected VirtualApplicationGroupCollection() { } } public partial class VirtualApplicationGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualApplicationGroupData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier hostPoolId, Azure.ResourceManager.DesktopVirtualization.Models.VirtualApplicationGroupType applicationGroupType) : base (default(Azure.Core.AzureLocation)) { } + public VirtualApplicationGroupData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier hostPoolId, Azure.ResourceManager.DesktopVirtualization.Models.VirtualApplicationGroupType applicationGroupType) { } public Azure.ResourceManager.DesktopVirtualization.Models.VirtualApplicationGroupType ApplicationGroupType { get { throw null; } set { } } public string Description { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } @@ -713,7 +713,7 @@ protected VirtualWorkspaceCollection() { } } public partial class VirtualWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualWorkspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualWorkspaceData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList ApplicationGroupReferences { get { throw null; } } public string Description { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } @@ -785,6 +785,62 @@ protected WorkspacePrivateEndpointConnectionResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DesktopVirtualization.Models.DesktopVirtualizationPrivateEndpointConnection connection, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DesktopVirtualization.Mocking +{ + public partial class MockableDesktopVirtualizationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDesktopVirtualizationArmClient() { } + public virtual Azure.ResourceManager.DesktopVirtualization.HostPoolPrivateEndpointConnectionResource GetHostPoolPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.HostPoolResource GetHostPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.MsixPackageResource GetMsixPackageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.ScalingPlanPersonalScheduleResource GetScalingPlanPersonalScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.ScalingPlanPooledScheduleResource GetScalingPlanPooledScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.ScalingPlanResource GetScalingPlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.SessionHostResource GetSessionHostResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.UserSessionResource GetUserSessionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.VirtualApplicationGroupResource GetVirtualApplicationGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.VirtualApplicationResource GetVirtualApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.VirtualDesktopResource GetVirtualDesktopResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.VirtualWorkspaceResource GetVirtualWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.WorkspacePrivateEndpointConnectionResource GetWorkspacePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDesktopVirtualizationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDesktopVirtualizationResourceGroupResource() { } + public virtual Azure.Response GetHostPool(string hostPoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHostPoolAsync(string hostPoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.HostPoolCollection GetHostPools() { throw null; } + public virtual Azure.Response GetScalingPlan(string scalingPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScalingPlanAsync(string scalingPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.ScalingPlanCollection GetScalingPlans() { throw null; } + public virtual Azure.Response GetVirtualApplicationGroup(string applicationGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualApplicationGroupAsync(string applicationGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.VirtualApplicationGroupCollection GetVirtualApplicationGroups() { throw null; } + public virtual Azure.Response GetVirtualWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DesktopVirtualization.VirtualWorkspaceCollection GetVirtualWorkspaces() { throw null; } + } + public partial class MockableDesktopVirtualizationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDesktopVirtualizationSubscriptionResource() { } + public virtual Azure.Pageable GetHostPools(int? pageSize = default(int?), bool? isDescending = default(bool?), int? initialSkip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetHostPools(System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual Azure.AsyncPageable GetHostPoolsAsync(int? pageSize = default(int?), bool? isDescending = default(bool?), int? initialSkip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetHostPoolsAsync(System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual Azure.Pageable GetScalingPlans(int? pageSize = default(int?), bool? isDescending = default(bool?), int? initialSkip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetScalingPlans(System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual Azure.AsyncPageable GetScalingPlansAsync(int? pageSize = default(int?), bool? isDescending = default(bool?), int? initialSkip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetScalingPlansAsync(System.Threading.CancellationToken cancellationToken) { throw null; } + public virtual Azure.Pageable GetVirtualApplicationGroups(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualApplicationGroupsAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DesktopVirtualization.Models { public static partial class ArmDesktopVirtualizationModelFactory diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Customize/Extensions/DesktopVirtualizationExtensions.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Customize/Extensions/DesktopVirtualizationExtensions.cs index 57be54eac8759..eb75365af1899 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Customize/Extensions/DesktopVirtualizationExtensions.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Customize/Extensions/DesktopVirtualizationExtensions.cs @@ -29,7 +29,10 @@ public static partial class DesktopVirtualizationExtensions /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. [EditorBrowsable(EditorBrowsableState.Never)] - public static AsyncPageable GetHostPoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken) => GetHostPoolsAsync(subscriptionResource, null, null, null, cancellationToken ); + public static AsyncPageable GetHostPoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken) + { + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetHostPoolsAsync(cancellationToken); + } /// /// List hostPools in subscription. @@ -48,7 +51,10 @@ public static partial class DesktopVirtualizationExtensions /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. [EditorBrowsable(EditorBrowsableState.Never)] - public static Pageable GetHostPools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken) => GetHostPools(subscriptionResource, null, null, null, cancellationToken); + public static Pageable GetHostPools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken) + { + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetHostPools(cancellationToken); + } /// /// List scaling plans in subscription. @@ -67,7 +73,10 @@ public static partial class DesktopVirtualizationExtensions /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. [EditorBrowsable(EditorBrowsableState.Never)] - public static AsyncPageable GetScalingPlansAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken ) => GetScalingPlansAsync(subscriptionResource, null, null, null, cancellationToken); + public static AsyncPageable GetScalingPlansAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken) + { + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetScalingPlansAsync(cancellationToken); + } /// /// List scaling plans in subscription. @@ -86,6 +95,9 @@ public static partial class DesktopVirtualizationExtensions /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. [EditorBrowsable(EditorBrowsableState.Never)] - public static Pageable GetScalingPlans(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken) => GetScalingPlans(subscriptionResource, null, null, null, cancellationToken); + public static Pageable GetScalingPlans(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken) + { + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetScalingPlans(cancellationToken); + } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Customize/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Customize/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs new file mode 100644 index 0000000000000..a55d90e2df089 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Customize/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.ComponentModel; +using System.Threading; + +namespace Azure.ResourceManager.DesktopVirtualization.Mocking +{ + public partial class MockableDesktopVirtualizationSubscriptionResource : ArmResource + { + /// + /// List hostPools in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools + /// + /// + /// Operation Id + /// HostPools_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetHostPoolsAsync(CancellationToken cancellationToken) => GetHostPoolsAsync(null, null, null, cancellationToken); + + /// + /// List hostPools in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools + /// + /// + /// Operation Id + /// HostPools_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetHostPools(CancellationToken cancellationToken) => GetHostPools(null, null, null, cancellationToken); + + /// + /// List scaling plans in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans + /// + /// + /// Operation Id + /// ScalingPlans_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetScalingPlansAsync(CancellationToken cancellationToken) => GetScalingPlansAsync(null, null, null, cancellationToken); + + /// + /// List scaling plans in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans + /// + /// + /// Operation Id + /// ScalingPlans_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetScalingPlans(CancellationToken cancellationToken) => GetScalingPlans(null, null, null, cancellationToken); + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs index 40b187319d9cc..e738fa349dffd 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DesktopVirtualization.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DesktopVirtualization @@ -18,290 +19,241 @@ namespace Azure.ResourceManager.DesktopVirtualization /// A class to add extension methods to Azure.ResourceManager.DesktopVirtualization. public static partial class DesktopVirtualizationExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDesktopVirtualizationArmClient GetMockableDesktopVirtualizationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDesktopVirtualizationArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDesktopVirtualizationResourceGroupResource GetMockableDesktopVirtualizationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDesktopVirtualizationResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDesktopVirtualizationSubscriptionResource GetMockableDesktopVirtualizationSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDesktopVirtualizationSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region VirtualWorkspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualWorkspaceResource GetVirtualWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualWorkspaceResource.ValidateResourceId(id); - return new VirtualWorkspaceResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetVirtualWorkspaceResource(id); } - #endregion - #region WorkspacePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkspacePrivateEndpointConnectionResource GetWorkspacePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkspacePrivateEndpointConnectionResource.ValidateResourceId(id); - return new WorkspacePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetWorkspacePrivateEndpointConnectionResource(id); } - #endregion - #region HostPoolPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HostPoolPrivateEndpointConnectionResource GetHostPoolPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HostPoolPrivateEndpointConnectionResource.ValidateResourceId(id); - return new HostPoolPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetHostPoolPrivateEndpointConnectionResource(id); } - #endregion - #region ScalingPlanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScalingPlanResource GetScalingPlanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScalingPlanResource.ValidateResourceId(id); - return new ScalingPlanResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetScalingPlanResource(id); } - #endregion - #region ScalingPlanPooledScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScalingPlanPooledScheduleResource GetScalingPlanPooledScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScalingPlanPooledScheduleResource.ValidateResourceId(id); - return new ScalingPlanPooledScheduleResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetScalingPlanPooledScheduleResource(id); } - #endregion - #region ScalingPlanPersonalScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScalingPlanPersonalScheduleResource GetScalingPlanPersonalScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScalingPlanPersonalScheduleResource.ValidateResourceId(id); - return new ScalingPlanPersonalScheduleResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetScalingPlanPersonalScheduleResource(id); } - #endregion - #region VirtualApplicationGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualApplicationGroupResource GetVirtualApplicationGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualApplicationGroupResource.ValidateResourceId(id); - return new VirtualApplicationGroupResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetVirtualApplicationGroupResource(id); } - #endregion - #region VirtualApplicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualApplicationResource GetVirtualApplicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualApplicationResource.ValidateResourceId(id); - return new VirtualApplicationResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetVirtualApplicationResource(id); } - #endregion - #region VirtualDesktopResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualDesktopResource GetVirtualDesktopResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualDesktopResource.ValidateResourceId(id); - return new VirtualDesktopResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetVirtualDesktopResource(id); } - #endregion - #region HostPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HostPoolResource GetHostPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HostPoolResource.ValidateResourceId(id); - return new HostPoolResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetHostPoolResource(id); } - #endregion - #region UserSessionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static UserSessionResource GetUserSessionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - UserSessionResource.ValidateResourceId(id); - return new UserSessionResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetUserSessionResource(id); } - #endregion - #region SessionHostResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SessionHostResource GetSessionHostResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SessionHostResource.ValidateResourceId(id); - return new SessionHostResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetSessionHostResource(id); } - #endregion - #region MsixPackageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MsixPackageResource GetMsixPackageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MsixPackageResource.ValidateResourceId(id); - return new MsixPackageResource(client, id); - } - ); + return GetMockableDesktopVirtualizationArmClient(client).GetMsixPackageResource(id); } - #endregion - /// Gets a collection of VirtualWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualWorkspaceResources and their operations over a VirtualWorkspaceResource. public static VirtualWorkspaceCollection GetVirtualWorkspaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualWorkspaces(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspaces(); } /// @@ -316,16 +268,20 @@ public static VirtualWorkspaceCollection GetVirtualWorkspaces(this ResourceGroup /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -340,24 +296,34 @@ public static async Task> GetVirtualWorkspace /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualWorkspaces().Get(workspaceName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspace(workspaceName, cancellationToken); } - /// Gets a collection of ScalingPlanResources in the ResourceGroupResource. + /// + /// Gets a collection of ScalingPlanResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ScalingPlanResources and their operations over a ScalingPlanResource. public static ScalingPlanCollection GetScalingPlans(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetScalingPlans(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlans(); } /// @@ -372,16 +338,20 @@ public static ScalingPlanCollection GetScalingPlans(this ResourceGroupResource r /// ScalingPlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the scaling plan. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScalingPlanAsync(this ResourceGroupResource resourceGroupResource, string scalingPlanName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetScalingPlans().GetAsync(scalingPlanName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlanAsync(scalingPlanName, cancellationToken).ConfigureAwait(false); } /// @@ -396,24 +366,34 @@ public static async Task> GetScalingPlanAsync(this /// ScalingPlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the scaling plan. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScalingPlan(this ResourceGroupResource resourceGroupResource, string scalingPlanName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetScalingPlans().Get(scalingPlanName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlan(scalingPlanName, cancellationToken); } - /// Gets a collection of VirtualApplicationGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualApplicationGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualApplicationGroupResources and their operations over a VirtualApplicationGroupResource. public static VirtualApplicationGroupCollection GetVirtualApplicationGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualApplicationGroups(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroups(); } /// @@ -428,16 +408,20 @@ public static VirtualApplicationGroupCollection GetVirtualApplicationGroups(this /// ApplicationGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the application group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualApplicationGroupAsync(this ResourceGroupResource resourceGroupResource, string applicationGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualApplicationGroups().GetAsync(applicationGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroupAsync(applicationGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -452,24 +436,34 @@ public static async Task> GetVirtualAp /// ApplicationGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the application group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualApplicationGroup(this ResourceGroupResource resourceGroupResource, string applicationGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualApplicationGroups().Get(applicationGroupName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroup(applicationGroupName, cancellationToken); } - /// Gets a collection of HostPoolResources in the ResourceGroupResource. + /// + /// Gets a collection of HostPoolResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HostPoolResources and their operations over a HostPoolResource. public static HostPoolCollection GetHostPools(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHostPools(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPools(); } /// @@ -484,16 +478,20 @@ public static HostPoolCollection GetHostPools(this ResourceGroupResource resourc /// HostPools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the host pool within the specified resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHostPoolAsync(this ResourceGroupResource resourceGroupResource, string hostPoolName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHostPools().GetAsync(hostPoolName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPoolAsync(hostPoolName, cancellationToken).ConfigureAwait(false); } /// @@ -508,16 +506,20 @@ public static async Task> GetHostPoolAsync(this Resou /// HostPools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the host pool within the specified resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHostPool(this ResourceGroupResource resourceGroupResource, string hostPoolName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHostPools().Get(hostPoolName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPool(hostPoolName, cancellationToken); } /// @@ -532,13 +534,17 @@ public static Response GetHostPool(this ResourceGroupResource /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualWorkspacesAsync(cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualWorkspacesAsync(cancellationToken); } /// @@ -553,13 +559,17 @@ public static AsyncPageable GetVirtualWorkspacesAsync( /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualWorkspaces(cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualWorkspaces(cancellationToken); } /// @@ -574,6 +584,10 @@ public static Pageable GetVirtualWorkspaces(this Subsc /// ScalingPlans_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Number of items per page. @@ -583,7 +597,7 @@ public static Pageable GetVirtualWorkspaces(this Subsc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetScalingPlansAsync(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScalingPlansAsync(pageSize, isDescending, initialSkip, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetScalingPlansAsync(pageSize, isDescending, initialSkip, cancellationToken); } /// @@ -598,6 +612,10 @@ public static AsyncPageable GetScalingPlansAsync(this Subsc /// ScalingPlans_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Number of items per page. @@ -607,7 +625,7 @@ public static AsyncPageable GetScalingPlansAsync(this Subsc /// A collection of that may take multiple service requests to iterate over. public static Pageable GetScalingPlans(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScalingPlans(pageSize, isDescending, initialSkip, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetScalingPlans(pageSize, isDescending, initialSkip, cancellationToken); } /// @@ -622,6 +640,10 @@ public static Pageable GetScalingPlans(this SubscriptionRes /// ApplicationGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// OData filter expression. Valid properties for filtering are applicationGroupType. @@ -629,7 +651,7 @@ public static Pageable GetScalingPlans(this SubscriptionRes /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetVirtualApplicationGroupsAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualApplicationGroupsAsync(filter, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualApplicationGroupsAsync(filter, cancellationToken); } /// @@ -644,6 +666,10 @@ public static AsyncPageable GetVirtualApplicati /// ApplicationGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// OData filter expression. Valid properties for filtering are applicationGroupType. @@ -651,7 +677,7 @@ public static AsyncPageable GetVirtualApplicati /// A collection of that may take multiple service requests to iterate over. public static Pageable GetVirtualApplicationGroups(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualApplicationGroups(filter, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualApplicationGroups(filter, cancellationToken); } /// @@ -666,6 +692,10 @@ public static Pageable GetVirtualApplicationGro /// HostPools_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Number of items per page. @@ -675,7 +705,7 @@ public static Pageable GetVirtualApplicationGro /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetHostPoolsAsync(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHostPoolsAsync(pageSize, isDescending, initialSkip, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetHostPoolsAsync(pageSize, isDescending, initialSkip, cancellationToken); } /// @@ -690,6 +720,10 @@ public static AsyncPageable GetHostPoolsAsync(this Subscriptio /// HostPools_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Number of items per page. @@ -699,7 +733,7 @@ public static AsyncPageable GetHostPoolsAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetHostPools(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHostPools(pageSize, isDescending, initialSkip, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetHostPools(pageSize, isDescending, initialSkip, cancellationToken); } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs new file mode 100644 index 0000000000000..0102836d9c2e3 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DesktopVirtualization; + +namespace Azure.ResourceManager.DesktopVirtualization.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDesktopVirtualizationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDesktopVirtualizationArmClient() + { + } + + /// 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 MockableDesktopVirtualizationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDesktopVirtualizationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualWorkspaceResource GetVirtualWorkspaceResource(ResourceIdentifier id) + { + VirtualWorkspaceResource.ValidateResourceId(id); + return new VirtualWorkspaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkspacePrivateEndpointConnectionResource GetWorkspacePrivateEndpointConnectionResource(ResourceIdentifier id) + { + WorkspacePrivateEndpointConnectionResource.ValidateResourceId(id); + return new WorkspacePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HostPoolPrivateEndpointConnectionResource GetHostPoolPrivateEndpointConnectionResource(ResourceIdentifier id) + { + HostPoolPrivateEndpointConnectionResource.ValidateResourceId(id); + return new HostPoolPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScalingPlanResource GetScalingPlanResource(ResourceIdentifier id) + { + ScalingPlanResource.ValidateResourceId(id); + return new ScalingPlanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScalingPlanPooledScheduleResource GetScalingPlanPooledScheduleResource(ResourceIdentifier id) + { + ScalingPlanPooledScheduleResource.ValidateResourceId(id); + return new ScalingPlanPooledScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScalingPlanPersonalScheduleResource GetScalingPlanPersonalScheduleResource(ResourceIdentifier id) + { + ScalingPlanPersonalScheduleResource.ValidateResourceId(id); + return new ScalingPlanPersonalScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualApplicationGroupResource GetVirtualApplicationGroupResource(ResourceIdentifier id) + { + VirtualApplicationGroupResource.ValidateResourceId(id); + return new VirtualApplicationGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualApplicationResource GetVirtualApplicationResource(ResourceIdentifier id) + { + VirtualApplicationResource.ValidateResourceId(id); + return new VirtualApplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualDesktopResource GetVirtualDesktopResource(ResourceIdentifier id) + { + VirtualDesktopResource.ValidateResourceId(id); + return new VirtualDesktopResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HostPoolResource GetHostPoolResource(ResourceIdentifier id) + { + HostPoolResource.ValidateResourceId(id); + return new HostPoolResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual UserSessionResource GetUserSessionResource(ResourceIdentifier id) + { + UserSessionResource.ValidateResourceId(id); + return new UserSessionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SessionHostResource GetSessionHostResource(ResourceIdentifier id) + { + SessionHostResource.ValidateResourceId(id); + return new SessionHostResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MsixPackageResource GetMsixPackageResource(ResourceIdentifier id) + { + MsixPackageResource.ValidateResourceId(id); + return new MsixPackageResource(Client, id); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs new file mode 100644 index 0000000000000..68385dc4e7127 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs @@ -0,0 +1,251 @@ +// 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.DesktopVirtualization; + +namespace Azure.ResourceManager.DesktopVirtualization.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDesktopVirtualizationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDesktopVirtualizationResourceGroupResource() + { + } + + /// 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 MockableDesktopVirtualizationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of VirtualWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of VirtualWorkspaceResources and their operations over a VirtualWorkspaceResource. + public virtual VirtualWorkspaceCollection GetVirtualWorkspaces() + { + return GetCachedClient(client => new VirtualWorkspaceCollection(client, Id)); + } + + /// + /// Get a workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetVirtualWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetVirtualWorkspaces().Get(workspaceName, cancellationToken); + } + + /// Gets a collection of ScalingPlanResources in the ResourceGroupResource. + /// An object representing collection of ScalingPlanResources and their operations over a ScalingPlanResource. + public virtual ScalingPlanCollection GetScalingPlans() + { + return GetCachedClient(client => new ScalingPlanCollection(client, Id)); + } + + /// + /// Get a scaling plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} + /// + /// + /// Operation Id + /// ScalingPlans_Get + /// + /// + /// + /// The name of the scaling plan. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScalingPlanAsync(string scalingPlanName, CancellationToken cancellationToken = default) + { + return await GetScalingPlans().GetAsync(scalingPlanName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a scaling plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} + /// + /// + /// Operation Id + /// ScalingPlans_Get + /// + /// + /// + /// The name of the scaling plan. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScalingPlan(string scalingPlanName, CancellationToken cancellationToken = default) + { + return GetScalingPlans().Get(scalingPlanName, cancellationToken); + } + + /// Gets a collection of VirtualApplicationGroupResources in the ResourceGroupResource. + /// An object representing collection of VirtualApplicationGroupResources and their operations over a VirtualApplicationGroupResource. + public virtual VirtualApplicationGroupCollection GetVirtualApplicationGroups() + { + return GetCachedClient(client => new VirtualApplicationGroupCollection(client, Id)); + } + + /// + /// Get an application group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} + /// + /// + /// Operation Id + /// ApplicationGroups_Get + /// + /// + /// + /// The name of the application group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualApplicationGroupAsync(string applicationGroupName, CancellationToken cancellationToken = default) + { + return await GetVirtualApplicationGroups().GetAsync(applicationGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an application group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} + /// + /// + /// Operation Id + /// ApplicationGroups_Get + /// + /// + /// + /// The name of the application group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualApplicationGroup(string applicationGroupName, CancellationToken cancellationToken = default) + { + return GetVirtualApplicationGroups().Get(applicationGroupName, cancellationToken); + } + + /// Gets a collection of HostPoolResources in the ResourceGroupResource. + /// An object representing collection of HostPoolResources and their operations over a HostPoolResource. + public virtual HostPoolCollection GetHostPools() + { + return GetCachedClient(client => new HostPoolCollection(client, Id)); + } + + /// + /// Get a host pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} + /// + /// + /// Operation Id + /// HostPools_Get + /// + /// + /// + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHostPoolAsync(string hostPoolName, CancellationToken cancellationToken = default) + { + return await GetHostPools().GetAsync(hostPoolName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a host pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} + /// + /// + /// Operation Id + /// HostPools_Get + /// + /// + /// + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHostPool(string hostPoolName, CancellationToken cancellationToken = default) + { + return GetHostPools().Get(hostPoolName, cancellationToken); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs new file mode 100644 index 0000000000000..3c7f7d5f9f3e0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DesktopVirtualization; + +namespace Azure.ResourceManager.DesktopVirtualization.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDesktopVirtualizationSubscriptionResource : ArmResource + { + private ClientDiagnostics _virtualWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _virtualWorkspaceWorkspacesRestClient; + private ClientDiagnostics _scalingPlanClientDiagnostics; + private ScalingPlansRestOperations _scalingPlanRestClient; + private ClientDiagnostics _virtualApplicationGroupApplicationGroupsClientDiagnostics; + private ApplicationGroupsRestOperations _virtualApplicationGroupApplicationGroupsRestClient; + private ClientDiagnostics _hostPoolClientDiagnostics; + private HostPoolsRestOperations _hostPoolRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDesktopVirtualizationSubscriptionResource() + { + } + + /// 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 MockableDesktopVirtualizationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics VirtualWorkspaceWorkspacesClientDiagnostics => _virtualWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", VirtualWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations VirtualWorkspaceWorkspacesRestClient => _virtualWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualWorkspaceResource.ResourceType)); + private ClientDiagnostics ScalingPlanClientDiagnostics => _scalingPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ScalingPlanResource.ResourceType.Namespace, Diagnostics); + private ScalingPlansRestOperations ScalingPlanRestClient => _scalingPlanRestClient ??= new ScalingPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScalingPlanResource.ResourceType)); + private ClientDiagnostics VirtualApplicationGroupApplicationGroupsClientDiagnostics => _virtualApplicationGroupApplicationGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", VirtualApplicationGroupResource.ResourceType.Namespace, Diagnostics); + private ApplicationGroupsRestOperations VirtualApplicationGroupApplicationGroupsRestClient => _virtualApplicationGroupApplicationGroupsRestClient ??= new ApplicationGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualApplicationGroupResource.ResourceType)); + private ClientDiagnostics HostPoolClientDiagnostics => _hostPoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", HostPoolResource.ResourceType.Namespace, Diagnostics); + private HostPoolsRestOperations HostPoolRestClient => _hostPoolRestClient ??= new HostPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HostPoolResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List workspaces in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualWorkspaceResource(Client, VirtualWorkspaceData.DeserializeVirtualWorkspaceData(e)), VirtualWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// List workspaces in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualWorkspaceResource(Client, VirtualWorkspaceData.DeserializeVirtualWorkspaceData(e)), VirtualWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// List scaling plans in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans + /// + /// + /// Operation Id + /// ScalingPlans_ListBySubscription + /// + /// + /// + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScalingPlansAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScalingPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScalingPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), ScalingPlanClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetScalingPlans", "value", "nextLink", cancellationToken); + } + + /// + /// List scaling plans in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans + /// + /// + /// Operation Id + /// ScalingPlans_ListBySubscription + /// + /// + /// + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScalingPlans(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScalingPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScalingPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), ScalingPlanClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetScalingPlans", "value", "nextLink", cancellationToken); + } + + /// + /// List applicationGroups in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups + /// + /// + /// Operation Id + /// ApplicationGroups_ListBySubscription + /// + /// + /// + /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualApplicationGroupsAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualApplicationGroupResource(Client, VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(e)), VirtualApplicationGroupApplicationGroupsClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualApplicationGroups", "value", "nextLink", cancellationToken); + } + + /// + /// List applicationGroups in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups + /// + /// + /// Operation Id + /// ApplicationGroups_ListBySubscription + /// + /// + /// + /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualApplicationGroups(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualApplicationGroupResource(Client, VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(e)), VirtualApplicationGroupApplicationGroupsClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualApplicationGroups", "value", "nextLink", cancellationToken); + } + + /// + /// List hostPools in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools + /// + /// + /// Operation Id + /// HostPools_List + /// + /// + /// + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHostPoolsAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HostPoolRestClient.CreateListRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HostPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HostPoolResource(Client, HostPoolData.DeserializeHostPoolData(e)), HostPoolClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetHostPools", "value", "nextLink", cancellationToken); + } + + /// + /// List hostPools in subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools + /// + /// + /// Operation Id + /// HostPools_List + /// + /// + /// + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHostPools(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HostPoolRestClient.CreateListRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HostPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HostPoolResource(Client, HostPoolData.DeserializeHostPoolData(e)), HostPoolClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetHostPools", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 4e2fd4f11d158..0000000000000 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DesktopVirtualization -{ - /// 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 VirtualWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of VirtualWorkspaceResources and their operations over a VirtualWorkspaceResource. - public virtual VirtualWorkspaceCollection GetVirtualWorkspaces() - { - return GetCachedClient(Client => new VirtualWorkspaceCollection(Client, Id)); - } - - /// Gets a collection of ScalingPlanResources in the ResourceGroupResource. - /// An object representing collection of ScalingPlanResources and their operations over a ScalingPlanResource. - public virtual ScalingPlanCollection GetScalingPlans() - { - return GetCachedClient(Client => new ScalingPlanCollection(Client, Id)); - } - - /// Gets a collection of VirtualApplicationGroupResources in the ResourceGroupResource. - /// An object representing collection of VirtualApplicationGroupResources and their operations over a VirtualApplicationGroupResource. - public virtual VirtualApplicationGroupCollection GetVirtualApplicationGroups() - { - return GetCachedClient(Client => new VirtualApplicationGroupCollection(Client, Id)); - } - - /// Gets a collection of HostPoolResources in the ResourceGroupResource. - /// An object representing collection of HostPoolResources and their operations over a HostPoolResource. - public virtual HostPoolCollection GetHostPools() - { - return GetCachedClient(Client => new HostPoolCollection(Client, Id)); - } - } -} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 33906259f0a37..0000000000000 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DesktopVirtualization -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _virtualWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _virtualWorkspaceWorkspacesRestClient; - private ClientDiagnostics _scalingPlanClientDiagnostics; - private ScalingPlansRestOperations _scalingPlanRestClient; - private ClientDiagnostics _virtualApplicationGroupApplicationGroupsClientDiagnostics; - private ApplicationGroupsRestOperations _virtualApplicationGroupApplicationGroupsRestClient; - private ClientDiagnostics _hostPoolClientDiagnostics; - private HostPoolsRestOperations _hostPoolRestClient; - - /// 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 VirtualWorkspaceWorkspacesClientDiagnostics => _virtualWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", VirtualWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations VirtualWorkspaceWorkspacesRestClient => _virtualWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualWorkspaceResource.ResourceType)); - private ClientDiagnostics ScalingPlanClientDiagnostics => _scalingPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ScalingPlanResource.ResourceType.Namespace, Diagnostics); - private ScalingPlansRestOperations ScalingPlanRestClient => _scalingPlanRestClient ??= new ScalingPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScalingPlanResource.ResourceType)); - private ClientDiagnostics VirtualApplicationGroupApplicationGroupsClientDiagnostics => _virtualApplicationGroupApplicationGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", VirtualApplicationGroupResource.ResourceType.Namespace, Diagnostics); - private ApplicationGroupsRestOperations VirtualApplicationGroupApplicationGroupsRestClient => _virtualApplicationGroupApplicationGroupsRestClient ??= new ApplicationGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualApplicationGroupResource.ResourceType)); - private ClientDiagnostics HostPoolClientDiagnostics => _hostPoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", HostPoolResource.ResourceType.Namespace, Diagnostics); - private HostPoolsRestOperations HostPoolRestClient => _hostPoolRestClient ??= new HostPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HostPoolResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List workspaces in subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualWorkspaceResource(Client, VirtualWorkspaceData.DeserializeVirtualWorkspaceData(e)), VirtualWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// List workspaces in subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualWorkspaceResource(Client, VirtualWorkspaceData.DeserializeVirtualWorkspaceData(e)), VirtualWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// List scaling plans in subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans - /// - /// - /// Operation Id - /// ScalingPlans_ListBySubscription - /// - /// - /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScalingPlansAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScalingPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScalingPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), ScalingPlanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScalingPlans", "value", "nextLink", cancellationToken); - } - - /// - /// List scaling plans in subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans - /// - /// - /// Operation Id - /// ScalingPlans_ListBySubscription - /// - /// - /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScalingPlans(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScalingPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScalingPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), ScalingPlanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScalingPlans", "value", "nextLink", cancellationToken); - } - - /// - /// List applicationGroups in subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups - /// - /// - /// Operation Id - /// ApplicationGroups_ListBySubscription - /// - /// - /// - /// OData filter expression. Valid properties for filtering are applicationGroupType. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualApplicationGroupsAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualApplicationGroupResource(Client, VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(e)), VirtualApplicationGroupApplicationGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualApplicationGroups", "value", "nextLink", cancellationToken); - } - - /// - /// List applicationGroups in subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups - /// - /// - /// Operation Id - /// ApplicationGroups_ListBySubscription - /// - /// - /// - /// OData filter expression. Valid properties for filtering are applicationGroupType. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualApplicationGroups(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualApplicationGroupResource(Client, VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(e)), VirtualApplicationGroupApplicationGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualApplicationGroups", "value", "nextLink", cancellationToken); - } - - /// - /// List hostPools in subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools - /// - /// - /// Operation Id - /// HostPools_List - /// - /// - /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHostPoolsAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HostPoolRestClient.CreateListRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HostPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HostPoolResource(Client, HostPoolData.DeserializeHostPoolData(e)), HostPoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHostPools", "value", "nextLink", cancellationToken); - } - - /// - /// List hostPools in subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools - /// - /// - /// Operation Id - /// HostPools_List - /// - /// - /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHostPools(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HostPoolRestClient.CreateListRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HostPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HostPoolResource(Client, HostPoolData.DeserializeHostPoolData(e)), HostPoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHostPools", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs index d6e047be29e08..8398ba5361d9a 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class HostPoolPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostPoolName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs index 1889257785d6d..bb221d8006f89 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class HostPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"; @@ -112,7 +115,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HostPoolPrivateEndpointConnectionResources and their operations over a HostPoolPrivateEndpointConnectionResource. public virtual HostPoolPrivateEndpointConnectionCollection GetHostPoolPrivateEndpointConnections() { - return GetCachedClient(Client => new HostPoolPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new HostPoolPrivateEndpointConnectionCollection(client, Id)); } /// @@ -130,8 +133,8 @@ public virtual HostPoolPrivateEndpointConnectionCollection GetHostPoolPrivateEnd /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHostPoolPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -153,8 +156,8 @@ public virtual async Task> G /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHostPoolPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -165,7 +168,7 @@ public virtual Response GetHostPoolPr /// An object representing collection of SessionHostResources and their operations over a SessionHostResource. public virtual SessionHostCollection GetSessionHosts() { - return GetCachedClient(Client => new SessionHostCollection(Client, Id)); + return GetCachedClient(client => new SessionHostCollection(client, Id)); } /// @@ -183,8 +186,8 @@ public virtual SessionHostCollection GetSessionHosts() /// /// The name of the session host within the specified host pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSessionHostAsync(string sessionHostName, CancellationToken cancellationToken = default) { @@ -206,8 +209,8 @@ public virtual async Task> GetSessionHostAsync(str /// /// The name of the session host within the specified host pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSessionHost(string sessionHostName, CancellationToken cancellationToken = default) { @@ -218,7 +221,7 @@ public virtual Response GetSessionHost(string sessionHostNa /// An object representing collection of MsixPackageResources and their operations over a MsixPackageResource. public virtual MsixPackageCollection GetMsixPackages() { - return GetCachedClient(Client => new MsixPackageCollection(Client, Id)); + return GetCachedClient(client => new MsixPackageCollection(client, Id)); } /// @@ -236,8 +239,8 @@ public virtual MsixPackageCollection GetMsixPackages() /// /// The version specific package full name of the MSIX package within specified hostpool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMsixPackageAsync(string msixPackageFullName, CancellationToken cancellationToken = default) { @@ -259,8 +262,8 @@ public virtual async Task> GetMsixPackageAsync(str /// /// The version specific package full name of the MSIX package within specified hostpool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMsixPackage(string msixPackageFullName, CancellationToken cancellationToken = default) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs index 1c69f4a42165d..40f4d396fa911 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class MsixPackageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostPoolName. + /// The msixPackageFullName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"; diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs index b7744b9c2addd..b6760907d3994 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class ScalingPlanPersonalScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scalingPlanName. + /// The scalingPlanScheduleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName}"; diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs index 5ce1b04bcf92a..1faaa7ba899bf 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class ScalingPlanPooledScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scalingPlanName. + /// The scalingPlanScheduleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName}"; diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs index de48d530e1552..531c57e5e4611 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class ScalingPlanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scalingPlanName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scalingPlanName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ScalingPlanPooledScheduleResources and their operations over a ScalingPlanPooledScheduleResource. public virtual ScalingPlanPooledScheduleCollection GetScalingPlanPooledSchedules() { - return GetCachedClient(Client => new ScalingPlanPooledScheduleCollection(Client, Id)); + return GetCachedClient(client => new ScalingPlanPooledScheduleCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ScalingPlanPooledScheduleCollection GetScalingPlanPooledSchedules /// /// The name of the ScalingPlanSchedule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetScalingPlanPooledScheduleAsync(string scalingPlanScheduleName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetScalin /// /// The name of the ScalingPlanSchedule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetScalingPlanPooledSchedule(string scalingPlanScheduleName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetScalingPlanPooledS /// An object representing collection of ScalingPlanPersonalScheduleResources and their operations over a ScalingPlanPersonalScheduleResource. public virtual ScalingPlanPersonalScheduleCollection GetScalingPlanPersonalSchedules() { - return GetCachedClient(Client => new ScalingPlanPersonalScheduleCollection(Client, Id)); + return GetCachedClient(client => new ScalingPlanPersonalScheduleCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual ScalingPlanPersonalScheduleCollection GetScalingPlanPersonalSched /// /// The name of the ScalingPlanSchedule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetScalingPlanPersonalScheduleAsync(string scalingPlanScheduleName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetScal /// /// The name of the ScalingPlanSchedule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetScalingPlanPersonalSchedule(string scalingPlanScheduleName, CancellationToken cancellationToken = default) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs index 89ae0e6a7d26d..a0a4078bf56c1 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class SessionHostResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostPoolName. + /// The sessionHostName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of UserSessionResources and their operations over a UserSessionResource. public virtual UserSessionCollection GetUserSessions() { - return GetCachedClient(Client => new UserSessionCollection(Client, Id)); + return GetCachedClient(client => new UserSessionCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual UserSessionCollection GetUserSessions() /// /// The name of the user session within the specified session host. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetUserSessionAsync(string userSessionId, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetUserSessionAsync(str /// /// The name of the user session within the specified session host. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetUserSession(string userSessionId, CancellationToken cancellationToken = default) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionResource.cs index 7a4462e7317c6..369e4b7f0676e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class UserSessionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostPoolName. + /// The sessionHostName. + /// The userSessionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}"; diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs index fb9cfe82a48f0..7c244a7d1967e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class VirtualApplicationGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The applicationGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string applicationGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VirtualApplicationResources and their operations over a VirtualApplicationResource. public virtual VirtualApplicationCollection GetVirtualApplications() { - return GetCachedClient(Client => new VirtualApplicationCollection(Client, Id)); + return GetCachedClient(client => new VirtualApplicationCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual VirtualApplicationCollection GetVirtualApplications() /// /// The name of the application within the specified application group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualApplicationAsync(string applicationName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetVirtualApplic /// /// The name of the application within the specified application group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualApplication(string applicationName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetVirtualApplication(string /// An object representing collection of VirtualDesktopResources and their operations over a VirtualDesktopResource. public virtual VirtualDesktopCollection GetVirtualDesktops() { - return GetCachedClient(Client => new VirtualDesktopCollection(Client, Id)); + return GetCachedClient(client => new VirtualDesktopCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual VirtualDesktopCollection GetVirtualDesktops() /// /// The name of the desktop within the specified desktop group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualDesktopAsync(string desktopName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> GetVirtualDesktopAsy /// /// The name of the desktop within the specified desktop group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualDesktop(string desktopName, CancellationToken cancellationToken = default) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationResource.cs index 802998489c766..10d46c5a5b32d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class VirtualApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The applicationGroupName. + /// The applicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"; diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopResource.cs index 0f6599004b175..0d62fbdb4f743 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class VirtualDesktopResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The applicationGroupName. + /// The desktopName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}"; diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs index f863fbb6279f5..78f62800f7e2c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class VirtualWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of WorkspacePrivateEndpointConnectionResources and their operations over a WorkspacePrivateEndpointConnectionResource. public virtual WorkspacePrivateEndpointConnectionCollection GetWorkspacePrivateEndpointConnections() { - return GetCachedClient(Client => new WorkspacePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new WorkspacePrivateEndpointConnectionCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual WorkspacePrivateEndpointConnectionCollection GetWorkspacePrivateE /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkspacePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkspacePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs index c7d4140703745..266ce77864cad 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DesktopVirtualization public partial class WorkspacePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md b/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md index cb8cb9c494180..d7ebb6e9a8b38 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md @@ -1,6 +1,16 @@ # Release History -## 1.0.0 (Unreleased) +## 1.0.0-beta.4 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 1.0.0-beta.3 (2023-10-31) This release updates the Azure DevCenter library to use the 2023-04-01 GA API. ### Breaking Changes diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Azure.Developer.DevCenter.csproj b/sdk/devcenter/Azure.Developer.DevCenter/src/Azure.Developer.DevCenter.csproj index 18894dc4a06c4..7fcd1dbca768e 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Azure.Developer.DevCenter.csproj +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Azure.Developer.DevCenter.csproj @@ -2,7 +2,7 @@ This is the DevCenter client library for developing .NET applications with rich experience. Azure SDK Code Generation DevCenter for Azure Data Plane - 1.0.0 + 1.0.0-beta.4 Azure DevCenter $(RequiredTargetFrameworks) true diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/api/Azure.ResourceManager.DevCenter.netstandard2.0.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/api/Azure.ResourceManager.DevCenter.netstandard2.0.cs index 7132b08459c35..b41f0a7c9d8e7 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/api/Azure.ResourceManager.DevCenter.netstandard2.0.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/api/Azure.ResourceManager.DevCenter.netstandard2.0.cs @@ -89,7 +89,7 @@ protected DevBoxDefinitionCollection() { } } public partial class DevBoxDefinitionData : Azure.ResourceManager.Models.TrackedResourceData { - public DevBoxDefinitionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevBoxDefinitionData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevCenter.Models.DevCenterImageReference ActiveImageReference { get { throw null; } } public Azure.ResourceManager.DevCenter.Models.DevCenterHibernateSupport? HibernateSupport { get { throw null; } set { } } public Azure.ResourceManager.DevCenter.Models.DevCenterImageReference ImageReference { get { throw null; } set { } } @@ -180,7 +180,7 @@ protected DevCenterCollection() { } } public partial class DevCenterData : Azure.ResourceManager.Models.TrackedResourceData { - public DevCenterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevCenterData(Azure.Core.AzureLocation location) { } public System.Uri DevCenterUri { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.DevCenter.Models.DevCenterProvisioningState? ProvisioningState { get { throw null; } } @@ -369,7 +369,7 @@ protected DevCenterNetworkConnectionCollection() { } } public partial class DevCenterNetworkConnectionData : Azure.ResourceManager.Models.TrackedResourceData { - public DevCenterNetworkConnectionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevCenterNetworkConnectionData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevCenter.Models.DomainJoinType? DomainJoinType { get { throw null; } set { } } public string DomainName { get { throw null; } set { } } public string DomainPassword { get { throw null; } set { } } @@ -424,7 +424,7 @@ protected DevCenterPoolCollection() { } } public partial class DevCenterPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public DevCenterPoolData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevCenterPoolData(Azure.Core.AzureLocation location) { } public string DevBoxDefinitionName { get { throw null; } set { } } public Azure.ResourceManager.DevCenter.Models.DevCenterHealthStatus? HealthStatus { get { throw null; } } public System.Collections.Generic.IReadOnlyList HealthStatusDetails { get { throw null; } } @@ -478,7 +478,7 @@ protected DevCenterProjectCollection() { } } public partial class DevCenterProjectData : Azure.ResourceManager.Models.TrackedResourceData { - public DevCenterProjectData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevCenterProjectData(Azure.Core.AzureLocation location) { } public string Description { get { throw null; } set { } } public Azure.Core.ResourceIdentifier DevCenterId { get { throw null; } set { } } public System.Uri DevCenterUri { get { throw null; } } @@ -504,7 +504,7 @@ protected DevCenterProjectEnvironmentCollection() { } } public partial class DevCenterProjectEnvironmentData : Azure.ResourceManager.Models.TrackedResourceData { - public DevCenterProjectEnvironmentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevCenterProjectEnvironmentData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier DeploymentTargetId { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.DevCenter.Models.DevCenterProvisioningState? ProvisioningState { get { throw null; } } @@ -747,6 +747,61 @@ protected ProjectDevBoxDefinitionResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DevCenter.Mocking +{ + public partial class MockableDevCenterArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDevCenterArmClient() { } + public virtual Azure.ResourceManager.DevCenter.AllowedEnvironmentTypeResource GetAllowedEnvironmentTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.AttachedNetworkConnectionResource GetAttachedNetworkConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevBoxDefinitionResource GetDevBoxDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterCatalogResource GetDevCenterCatalogResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterEnvironmentTypeResource GetDevCenterEnvironmentTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterGalleryResource GetDevCenterGalleryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterImageResource GetDevCenterImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterNetworkConnectionResource GetDevCenterNetworkConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterPoolResource GetDevCenterPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterProjectEnvironmentResource GetDevCenterProjectEnvironmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterProjectResource GetDevCenterProjectResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterResource GetDevCenterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterScheduleResource GetDevCenterScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.HealthCheckStatusDetailResource GetHealthCheckStatusDetailResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.ImageVersionResource GetImageVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.ProjectAttachedNetworkConnectionResource GetProjectAttachedNetworkConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevCenter.ProjectDevBoxDefinitionResource GetProjectDevBoxDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDevCenterResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDevCenterResourceGroupResource() { } + public virtual Azure.Response GetDevCenter(string devCenterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDevCenterAsync(string devCenterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDevCenterNetworkConnection(string networkConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDevCenterNetworkConnectionAsync(string networkConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterNetworkConnectionCollection GetDevCenterNetworkConnections() { throw null; } + public virtual Azure.Response GetDevCenterProject(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDevCenterProjectAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterProjectCollection GetDevCenterProjects() { throw null; } + public virtual Azure.ResourceManager.DevCenter.DevCenterCollection GetDevCenters() { throw null; } + } + public partial class MockableDevCenterSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDevCenterSubscriptionResource() { } + public virtual Azure.Response CheckDevCenterNameAvailability(Azure.ResourceManager.DevCenter.Models.DevCenterNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDevCenterNameAvailabilityAsync(Azure.ResourceManager.DevCenter.Models.DevCenterNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDevCenterNetworkConnections(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevCenterNetworkConnectionsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDevCenterOperationStatus(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDevCenterOperationStatusAsync(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDevCenterProjects(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevCenterProjectsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDevCenters(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevCentersAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDevCenterSkusBySubscription(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevCenterSkusBySubscriptionAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDevCenterUsagesByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevCenterUsagesByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DevCenter.Models { public static partial class ArmDevCenterModelFactory diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AllowedEnvironmentTypeResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AllowedEnvironmentTypeResource.cs index 50e520ebcae6e..3f4baf943a9df 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AllowedEnvironmentTypeResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AllowedEnvironmentTypeResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DevCenter public partial class AllowedEnvironmentTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The projectName. + /// The environmentTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string projectName, string environmentTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/allowedEnvironmentTypes/{environmentTypeName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AttachedNetworkConnectionResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AttachedNetworkConnectionResource.cs index b38af6c5fa2fd..5781152c74dbf 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AttachedNetworkConnectionResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/AttachedNetworkConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DevCenter public partial class AttachedNetworkConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The devCenterName. + /// The attachedNetworkConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string devCenterName, string attachedNetworkConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/attachednetworks/{attachedNetworkConnectionName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevBoxDefinitionResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevBoxDefinitionResource.cs index b0236fc57b0f0..489e85144849d 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevBoxDefinitionResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevBoxDefinitionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevCenter public partial class DevBoxDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The devCenterName. + /// The devBoxDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string devCenterName, string devBoxDefinitionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/devboxdefinitions/{devBoxDefinitionName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCatalogResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCatalogResource.cs index b367946110550..3eeab55fe8a56 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCatalogResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterCatalogResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterCatalogResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The devCenterName. + /// The catalogName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string devCenterName, string catalogName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/catalogs/{catalogName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterEnvironmentTypeResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterEnvironmentTypeResource.cs index c4f79bb3e129e..2a2fa398909e3 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterEnvironmentTypeResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterEnvironmentTypeResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterEnvironmentTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The devCenterName. + /// The environmentTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string devCenterName, string environmentTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/environmentTypes/{environmentTypeName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryResource.cs index 68c695e58b9ed..5963725ef9f40 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterGalleryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The devCenterName. + /// The galleryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string devCenterName, string galleryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/galleries/{galleryName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DevCenterImageResources and their operations over a DevCenterImageResource. public virtual DevCenterImageCollection GetDevCenterImages() { - return GetCachedClient(Client => new DevCenterImageCollection(Client, Id)); + return GetCachedClient(client => new DevCenterImageCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual DevCenterImageCollection GetDevCenterImages() /// /// The name of the image. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevCenterImageAsync(string imageName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetDevCenterImageAsy /// /// The name of the image. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevCenterImage(string imageName, CancellationToken cancellationToken = default) { diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageResource.cs index 6124349c5e12b..a489994f55677 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The devCenterName. + /// The galleryName. + /// The imageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string devCenterName, string galleryName, string imageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ImageVersionResources and their operations over a ImageVersionResource. public virtual ImageVersionCollection GetImageVersions() { - return GetCachedClient(Client => new ImageVersionCollection(Client, Id)); + return GetCachedClient(client => new ImageVersionCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual ImageVersionCollection GetImageVersions() /// /// The version of the image. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetImageVersionAsync(string versionName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetImageVersionAsync(s /// /// The version of the image. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetImageVersion(string versionName, CancellationToken cancellationToken = default) { diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterNetworkConnectionResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterNetworkConnectionResource.cs index 1810ba935213d..76b74bef6e123 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterNetworkConnectionResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterNetworkConnectionResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterNetworkConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/networkConnections/{networkConnectionName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolResource.cs index 4eeb08bea34ff..deccbc942fb60 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The projectName. + /// The poolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string projectName, string poolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/pools/{poolName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DevCenterScheduleResources and their operations over a DevCenterScheduleResource. public virtual DevCenterScheduleCollection GetDevCenterSchedules() { - return GetCachedClient(Client => new DevCenterScheduleCollection(Client, Id)); + return GetCachedClient(client => new DevCenterScheduleCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual DevCenterScheduleCollection GetDevCenterSchedules() /// The name of the schedule that uniquely identifies it. /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevCenterScheduleAsync(string scheduleName, int? top = null, CancellationToken cancellationToken = default) { @@ -135,8 +139,8 @@ public virtual async Task> GetDevCenterSched /// The name of the schedule that uniquely identifies it. /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevCenterSchedule(string scheduleName, int? top = null, CancellationToken cancellationToken = default) { diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectEnvironmentResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectEnvironmentResource.cs index f6edd2a18a9c6..82d15a8abde6b 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectEnvironmentResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectEnvironmentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterProjectEnvironmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The projectName. + /// The environmentTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string projectName, string environmentTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/environmentTypes/{environmentTypeName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectResource.cs index 44b0eada425df..5461d8ba2a3b9 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterProjectResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The projectName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string projectName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ProjectAttachedNetworkConnectionResources and their operations over a ProjectAttachedNetworkConnectionResource. public virtual ProjectAttachedNetworkConnectionCollection GetProjectAttachedNetworkConnections() { - return GetCachedClient(Client => new ProjectAttachedNetworkConnectionCollection(Client, Id)); + return GetCachedClient(client => new ProjectAttachedNetworkConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ProjectAttachedNetworkConnectionCollection GetProjectAttachedNetw /// /// The name of the attached NetworkConnection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProjectAttachedNetworkConnectionAsync(string attachedNetworkConnectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> Ge /// /// The name of the attached NetworkConnection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProjectAttachedNetworkConnection(string attachedNetworkConnectionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetProjectAtta /// An object representing collection of AllowedEnvironmentTypeResources and their operations over a AllowedEnvironmentTypeResource. public virtual AllowedEnvironmentTypeCollection GetAllowedEnvironmentTypes() { - return GetCachedClient(Client => new AllowedEnvironmentTypeCollection(Client, Id)); + return GetCachedClient(client => new AllowedEnvironmentTypeCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual AllowedEnvironmentTypeCollection GetAllowedEnvironmentTypes() /// /// The name of the environment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAllowedEnvironmentTypeAsync(string environmentTypeName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetAllowedEn /// /// The name of the environment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAllowedEnvironmentType(string environmentTypeName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetAllowedEnvironmentTyp /// An object representing collection of DevCenterProjectEnvironmentResources and their operations over a DevCenterProjectEnvironmentResource. public virtual DevCenterProjectEnvironmentCollection GetDevCenterProjectEnvironments() { - return GetCachedClient(Client => new DevCenterProjectEnvironmentCollection(Client, Id)); + return GetCachedClient(client => new DevCenterProjectEnvironmentCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual DevCenterProjectEnvironmentCollection GetDevCenterProjectEnvironm /// /// The name of the environment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevCenterProjectEnvironmentAsync(string environmentTypeName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetDevC /// /// The name of the environment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevCenterProjectEnvironment(string environmentTypeName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetDevCenterProject /// An object representing collection of ProjectDevBoxDefinitionResources and their operations over a ProjectDevBoxDefinitionResource. public virtual ProjectDevBoxDefinitionCollection GetProjectDevBoxDefinitions() { - return GetCachedClient(Client => new ProjectDevBoxDefinitionCollection(Client, Id)); + return GetCachedClient(client => new ProjectDevBoxDefinitionCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual ProjectDevBoxDefinitionCollection GetProjectDevBoxDefinitions() /// /// The name of the Dev Box definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProjectDevBoxDefinitionAsync(string devBoxDefinitionName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetProjectD /// /// The name of the Dev Box definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProjectDevBoxDefinition(string devBoxDefinitionName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetProjectDevBoxDefinit /// An object representing collection of DevCenterPoolResources and their operations over a DevCenterPoolResource. public virtual DevCenterPoolCollection GetDevCenterPools() { - return GetCachedClient(Client => new DevCenterPoolCollection(Client, Id)); + return GetCachedClient(client => new DevCenterPoolCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual DevCenterPoolCollection GetDevCenterPools() /// /// Name of the pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevCenterPoolAsync(string poolName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task> GetDevCenterPoolAsync /// /// Name of the pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevCenterPool(string poolName, CancellationToken cancellationToken = default) { diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterResource.cs index 5d9b793d3bc84..a314f5fa510f9 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The devCenterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string devCenterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}"; @@ -99,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AttachedNetworkConnectionResources and their operations over a AttachedNetworkConnectionResource. public virtual AttachedNetworkConnectionCollection GetAttachedNetworkConnections() { - return GetCachedClient(Client => new AttachedNetworkConnectionCollection(Client, Id)); + return GetCachedClient(client => new AttachedNetworkConnectionCollection(client, Id)); } /// @@ -117,8 +120,8 @@ public virtual AttachedNetworkConnectionCollection GetAttachedNetworkConnections /// /// The name of the attached NetworkConnection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAttachedNetworkConnectionAsync(string attachedNetworkConnectionName, CancellationToken cancellationToken = default) { @@ -140,8 +143,8 @@ public virtual async Task> GetAttach /// /// The name of the attached NetworkConnection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAttachedNetworkConnection(string attachedNetworkConnectionName, CancellationToken cancellationToken = default) { @@ -152,7 +155,7 @@ public virtual Response GetAttachedNetworkCon /// An object representing collection of DevCenterGalleryResources and their operations over a DevCenterGalleryResource. public virtual DevCenterGalleryCollection GetDevCenterGalleries() { - return GetCachedClient(Client => new DevCenterGalleryCollection(Client, Id)); + return GetCachedClient(client => new DevCenterGalleryCollection(client, Id)); } /// @@ -170,8 +173,8 @@ public virtual DevCenterGalleryCollection GetDevCenterGalleries() /// /// The name of the gallery. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevCenterGalleryAsync(string galleryName, CancellationToken cancellationToken = default) { @@ -193,8 +196,8 @@ public virtual async Task> GetDevCenterGaller /// /// The name of the gallery. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevCenterGallery(string galleryName, CancellationToken cancellationToken = default) { @@ -205,7 +208,7 @@ public virtual Response GetDevCenterGallery(string gal /// An object representing collection of DevCenterCatalogResources and their operations over a DevCenterCatalogResource. public virtual DevCenterCatalogCollection GetDevCenterCatalogs() { - return GetCachedClient(Client => new DevCenterCatalogCollection(Client, Id)); + return GetCachedClient(client => new DevCenterCatalogCollection(client, Id)); } /// @@ -223,8 +226,8 @@ public virtual DevCenterCatalogCollection GetDevCenterCatalogs() /// /// The name of the Catalog. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevCenterCatalogAsync(string catalogName, CancellationToken cancellationToken = default) { @@ -246,8 +249,8 @@ public virtual async Task> GetDevCenterCatalo /// /// The name of the Catalog. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevCenterCatalog(string catalogName, CancellationToken cancellationToken = default) { @@ -258,7 +261,7 @@ public virtual Response GetDevCenterCatalog(string cat /// An object representing collection of DevCenterEnvironmentTypeResources and their operations over a DevCenterEnvironmentTypeResource. public virtual DevCenterEnvironmentTypeCollection GetDevCenterEnvironmentTypes() { - return GetCachedClient(Client => new DevCenterEnvironmentTypeCollection(Client, Id)); + return GetCachedClient(client => new DevCenterEnvironmentTypeCollection(client, Id)); } /// @@ -276,8 +279,8 @@ public virtual DevCenterEnvironmentTypeCollection GetDevCenterEnvironmentTypes() /// /// The name of the environment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevCenterEnvironmentTypeAsync(string environmentTypeName, CancellationToken cancellationToken = default) { @@ -299,8 +302,8 @@ public virtual async Task> GetDevCent /// /// The name of the environment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevCenterEnvironmentType(string environmentTypeName, CancellationToken cancellationToken = default) { @@ -311,7 +314,7 @@ public virtual Response GetDevCenterEnvironmen /// An object representing collection of DevBoxDefinitionResources and their operations over a DevBoxDefinitionResource. public virtual DevBoxDefinitionCollection GetDevBoxDefinitions() { - return GetCachedClient(Client => new DevBoxDefinitionCollection(Client, Id)); + return GetCachedClient(client => new DevBoxDefinitionCollection(client, Id)); } /// @@ -329,8 +332,8 @@ public virtual DevBoxDefinitionCollection GetDevBoxDefinitions() /// /// The name of the Dev Box definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevBoxDefinitionAsync(string devBoxDefinitionName, CancellationToken cancellationToken = default) { @@ -352,8 +355,8 @@ public virtual async Task> GetDevBoxDefinitio /// /// The name of the Dev Box definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevBoxDefinition(string devBoxDefinitionName, CancellationToken cancellationToken = default) { diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterScheduleResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterScheduleResource.cs index 338a1fd77fc32..a116fc297dd70 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterScheduleResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterScheduleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.DevCenter public partial class DevCenterScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The projectName. + /// The poolName. + /// The scheduleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string projectName, string poolName, string scheduleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/pools/{poolName}/schedules/{scheduleName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/DevCenterExtensions.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/DevCenterExtensions.cs index d12b5fb449042..63d62ecb47e3b 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/DevCenterExtensions.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/DevCenterExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DevCenter.Mocking; using Azure.ResourceManager.DevCenter.Models; using Azure.ResourceManager.Resources; @@ -19,366 +20,305 @@ namespace Azure.ResourceManager.DevCenter /// A class to add extension methods to Azure.ResourceManager.DevCenter. public static partial class DevCenterExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDevCenterArmClient GetMockableDevCenterArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDevCenterArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDevCenterResourceGroupResource GetMockableDevCenterResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDevCenterResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDevCenterSubscriptionResource GetMockableDevCenterSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDevCenterSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DevCenterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterResource GetDevCenterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterResource.ValidateResourceId(id); - return new DevCenterResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterResource(id); } - #endregion - #region DevCenterProjectResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterProjectResource GetDevCenterProjectResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterProjectResource.ValidateResourceId(id); - return new DevCenterProjectResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterProjectResource(id); } - #endregion - #region ProjectAttachedNetworkConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProjectAttachedNetworkConnectionResource GetProjectAttachedNetworkConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProjectAttachedNetworkConnectionResource.ValidateResourceId(id); - return new ProjectAttachedNetworkConnectionResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetProjectAttachedNetworkConnectionResource(id); } - #endregion - #region AttachedNetworkConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AttachedNetworkConnectionResource GetAttachedNetworkConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AttachedNetworkConnectionResource.ValidateResourceId(id); - return new AttachedNetworkConnectionResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetAttachedNetworkConnectionResource(id); } - #endregion - #region DevCenterGalleryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterGalleryResource GetDevCenterGalleryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterGalleryResource.ValidateResourceId(id); - return new DevCenterGalleryResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterGalleryResource(id); } - #endregion - #region DevCenterImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterImageResource GetDevCenterImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterImageResource.ValidateResourceId(id); - return new DevCenterImageResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterImageResource(id); } - #endregion - #region ImageVersionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ImageVersionResource GetImageVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ImageVersionResource.ValidateResourceId(id); - return new ImageVersionResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetImageVersionResource(id); } - #endregion - #region DevCenterCatalogResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterCatalogResource GetDevCenterCatalogResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterCatalogResource.ValidateResourceId(id); - return new DevCenterCatalogResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterCatalogResource(id); } - #endregion - #region DevCenterEnvironmentTypeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterEnvironmentTypeResource GetDevCenterEnvironmentTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterEnvironmentTypeResource.ValidateResourceId(id); - return new DevCenterEnvironmentTypeResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterEnvironmentTypeResource(id); } - #endregion - #region AllowedEnvironmentTypeResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AllowedEnvironmentTypeResource GetAllowedEnvironmentTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AllowedEnvironmentTypeResource.ValidateResourceId(id); - return new AllowedEnvironmentTypeResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetAllowedEnvironmentTypeResource(id); } - #endregion - #region DevCenterProjectEnvironmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterProjectEnvironmentResource GetDevCenterProjectEnvironmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterProjectEnvironmentResource.ValidateResourceId(id); - return new DevCenterProjectEnvironmentResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterProjectEnvironmentResource(id); } - #endregion - #region DevBoxDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevBoxDefinitionResource GetDevBoxDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevBoxDefinitionResource.ValidateResourceId(id); - return new DevBoxDefinitionResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevBoxDefinitionResource(id); } - #endregion - #region ProjectDevBoxDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProjectDevBoxDefinitionResource GetProjectDevBoxDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProjectDevBoxDefinitionResource.ValidateResourceId(id); - return new ProjectDevBoxDefinitionResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetProjectDevBoxDefinitionResource(id); } - #endregion - #region DevCenterPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterPoolResource GetDevCenterPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterPoolResource.ValidateResourceId(id); - return new DevCenterPoolResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterPoolResource(id); } - #endregion - #region DevCenterScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterScheduleResource GetDevCenterScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterScheduleResource.ValidateResourceId(id); - return new DevCenterScheduleResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterScheduleResource(id); } - #endregion - #region DevCenterNetworkConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevCenterNetworkConnectionResource GetDevCenterNetworkConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevCenterNetworkConnectionResource.ValidateResourceId(id); - return new DevCenterNetworkConnectionResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetDevCenterNetworkConnectionResource(id); } - #endregion - #region HealthCheckStatusDetailResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthCheckStatusDetailResource GetHealthCheckStatusDetailResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthCheckStatusDetailResource.ValidateResourceId(id); - return new HealthCheckStatusDetailResource(client, id); - } - ); + return GetMockableDevCenterArmClient(client).GetHealthCheckStatusDetailResource(id); } - #endregion - /// Gets a collection of DevCenterResources in the ResourceGroupResource. + /// + /// Gets a collection of DevCenterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DevCenterResources and their operations over a DevCenterResource. public static DevCenterCollection GetDevCenters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDevCenters(); + return GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenters(); } /// @@ -393,16 +333,20 @@ public static DevCenterCollection GetDevCenters(this ResourceGroupResource resou /// DevCenters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the devcenter. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDevCenterAsync(this ResourceGroupResource resourceGroupResource, string devCenterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDevCenters().GetAsync(devCenterName, cancellationToken).ConfigureAwait(false); + return await GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenterAsync(devCenterName, cancellationToken).ConfigureAwait(false); } /// @@ -417,24 +361,34 @@ public static async Task> GetDevCenterAsync(this Res /// DevCenters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the devcenter. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDevCenter(this ResourceGroupResource resourceGroupResource, string devCenterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDevCenters().Get(devCenterName, cancellationToken); + return GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenter(devCenterName, cancellationToken); } - /// Gets a collection of DevCenterProjectResources in the ResourceGroupResource. + /// + /// Gets a collection of DevCenterProjectResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DevCenterProjectResources and their operations over a DevCenterProjectResource. public static DevCenterProjectCollection GetDevCenterProjects(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDevCenterProjects(); + return GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenterProjects(); } /// @@ -449,16 +403,20 @@ public static DevCenterProjectCollection GetDevCenterProjects(this ResourceGroup /// Projects_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the project. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDevCenterProjectAsync(this ResourceGroupResource resourceGroupResource, string projectName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDevCenterProjects().GetAsync(projectName, cancellationToken).ConfigureAwait(false); + return await GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenterProjectAsync(projectName, cancellationToken).ConfigureAwait(false); } /// @@ -473,24 +431,34 @@ public static async Task> GetDevCenterProject /// Projects_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the project. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDevCenterProject(this ResourceGroupResource resourceGroupResource, string projectName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDevCenterProjects().Get(projectName, cancellationToken); + return GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenterProject(projectName, cancellationToken); } - /// Gets a collection of DevCenterNetworkConnectionResources in the ResourceGroupResource. + /// + /// Gets a collection of DevCenterNetworkConnectionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DevCenterNetworkConnectionResources and their operations over a DevCenterNetworkConnectionResource. public static DevCenterNetworkConnectionCollection GetDevCenterNetworkConnections(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDevCenterNetworkConnections(); + return GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenterNetworkConnections(); } /// @@ -505,16 +473,20 @@ public static DevCenterNetworkConnectionCollection GetDevCenterNetworkConnection /// NetworkConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Connection that can be applied to a Pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDevCenterNetworkConnectionAsync(this ResourceGroupResource resourceGroupResource, string networkConnectionName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDevCenterNetworkConnections().GetAsync(networkConnectionName, cancellationToken).ConfigureAwait(false); + return await GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenterNetworkConnectionAsync(networkConnectionName, cancellationToken).ConfigureAwait(false); } /// @@ -529,16 +501,20 @@ public static async Task> GetDevCen /// NetworkConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Connection that can be applied to a Pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDevCenterNetworkConnection(this ResourceGroupResource resourceGroupResource, string networkConnectionName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDevCenterNetworkConnections().Get(networkConnectionName, cancellationToken); + return GetMockableDevCenterResourceGroupResource(resourceGroupResource).GetDevCenterNetworkConnection(networkConnectionName, cancellationToken); } /// @@ -553,6 +529,10 @@ public static Response GetDevCenterNetworkCo /// DevCenters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -560,7 +540,7 @@ public static Response GetDevCenterNetworkCo /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDevCentersAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCentersAsync(top, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCentersAsync(top, cancellationToken); } /// @@ -575,6 +555,10 @@ public static AsyncPageable GetDevCentersAsync(this Subscript /// DevCenters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -582,7 +566,7 @@ public static AsyncPageable GetDevCentersAsync(this Subscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDevCenters(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenters(top, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenters(top, cancellationToken); } /// @@ -597,6 +581,10 @@ public static Pageable GetDevCenters(this SubscriptionResourc /// Projects_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -604,7 +592,7 @@ public static Pageable GetDevCenters(this SubscriptionResourc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDevCenterProjectsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterProjectsAsync(top, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterProjectsAsync(top, cancellationToken); } /// @@ -619,6 +607,10 @@ public static AsyncPageable GetDevCenterProjectsAsync( /// Projects_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -626,7 +618,7 @@ public static AsyncPageable GetDevCenterProjectsAsync( /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDevCenterProjects(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterProjects(top, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterProjects(top, cancellationToken); } /// @@ -641,6 +633,10 @@ public static Pageable GetDevCenterProjects(this Subsc /// OperationStatuses_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure region. @@ -650,9 +646,7 @@ public static Pageable GetDevCenterProjects(this Subsc /// is null. public static async Task> GetDevCenterOperationStatusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterOperationStatusAsync(location, operationId, cancellationToken).ConfigureAwait(false); + return await GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterOperationStatusAsync(location, operationId, cancellationToken).ConfigureAwait(false); } /// @@ -667,6 +661,10 @@ public static async Task> GetDevCenterOperati /// OperationStatuses_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure region. @@ -676,9 +674,7 @@ public static async Task> GetDevCenterOperati /// is null. public static Response GetDevCenterOperationStatus(this SubscriptionResource subscriptionResource, AzureLocation location, string operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterOperationStatus(location, operationId, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterOperationStatus(location, operationId, cancellationToken); } /// @@ -693,6 +689,10 @@ public static Response GetDevCenterOperationStatus(thi /// Usages_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure region. @@ -700,7 +700,7 @@ public static Response GetDevCenterOperationStatus(thi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDevCenterUsagesByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterUsagesByLocationAsync(location, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterUsagesByLocationAsync(location, cancellationToken); } /// @@ -715,6 +715,10 @@ public static AsyncPageable GetDevCenterUsagesByLocationAsync(th /// Usages_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure region. @@ -722,7 +726,7 @@ public static AsyncPageable GetDevCenterUsagesByLocationAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDevCenterUsagesByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterUsagesByLocation(location, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterUsagesByLocation(location, cancellationToken); } /// @@ -737,6 +741,10 @@ public static Pageable GetDevCenterUsagesByLocation(this Subscri /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if resource name is available. @@ -744,9 +752,7 @@ public static Pageable GetDevCenterUsagesByLocation(this Subscri /// is null. public static async Task> CheckDevCenterNameAvailabilityAsync(this SubscriptionResource subscriptionResource, DevCenterNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDevCenterNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableDevCenterSubscriptionResource(subscriptionResource).CheckDevCenterNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -761,6 +767,10 @@ public static async Task> CheckDevCent /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if resource name is available. @@ -768,9 +778,7 @@ public static async Task> CheckDevCent /// is null. public static Response CheckDevCenterNameAvailability(this SubscriptionResource subscriptionResource, DevCenterNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDevCenterNameAvailability(content, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).CheckDevCenterNameAvailability(content, cancellationToken); } /// @@ -785,6 +793,10 @@ public static Response CheckDevCenterNameAvaila /// Skus_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -792,7 +804,7 @@ public static Response CheckDevCenterNameAvaila /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDevCenterSkusBySubscriptionAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterSkusBySubscriptionAsync(top, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterSkusBySubscriptionAsync(top, cancellationToken); } /// @@ -807,6 +819,10 @@ public static AsyncPageable GetDevCenterSkusBySubscriptionA /// Skus_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -814,7 +830,7 @@ public static AsyncPageable GetDevCenterSkusBySubscriptionA /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDevCenterSkusBySubscription(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterSkusBySubscription(top, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterSkusBySubscription(top, cancellationToken); } /// @@ -829,6 +845,10 @@ public static Pageable GetDevCenterSkusBySubscription(this /// NetworkConnections_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -836,7 +856,7 @@ public static Pageable GetDevCenterSkusBySubscription(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDevCenterNetworkConnectionsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterNetworkConnectionsAsync(top, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterNetworkConnectionsAsync(top, cancellationToken); } /// @@ -851,6 +871,10 @@ public static AsyncPageable GetDevCenterNetw /// NetworkConnections_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -858,7 +882,7 @@ public static AsyncPageable GetDevCenterNetw /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDevCenterNetworkConnections(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevCenterNetworkConnections(top, cancellationToken); + return GetMockableDevCenterSubscriptionResource(subscriptionResource).GetDevCenterNetworkConnections(top, cancellationToken); } } } diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterArmClient.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterArmClient.cs new file mode 100644 index 0000000000000..2efdaad1bd7ad --- /dev/null +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterArmClient.cs @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DevCenter; + +namespace Azure.ResourceManager.DevCenter.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDevCenterArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDevCenterArmClient() + { + } + + /// 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 MockableDevCenterArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDevCenterArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterResource GetDevCenterResource(ResourceIdentifier id) + { + DevCenterResource.ValidateResourceId(id); + return new DevCenterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterProjectResource GetDevCenterProjectResource(ResourceIdentifier id) + { + DevCenterProjectResource.ValidateResourceId(id); + return new DevCenterProjectResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProjectAttachedNetworkConnectionResource GetProjectAttachedNetworkConnectionResource(ResourceIdentifier id) + { + ProjectAttachedNetworkConnectionResource.ValidateResourceId(id); + return new ProjectAttachedNetworkConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AttachedNetworkConnectionResource GetAttachedNetworkConnectionResource(ResourceIdentifier id) + { + AttachedNetworkConnectionResource.ValidateResourceId(id); + return new AttachedNetworkConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterGalleryResource GetDevCenterGalleryResource(ResourceIdentifier id) + { + DevCenterGalleryResource.ValidateResourceId(id); + return new DevCenterGalleryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterImageResource GetDevCenterImageResource(ResourceIdentifier id) + { + DevCenterImageResource.ValidateResourceId(id); + return new DevCenterImageResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ImageVersionResource GetImageVersionResource(ResourceIdentifier id) + { + ImageVersionResource.ValidateResourceId(id); + return new ImageVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterCatalogResource GetDevCenterCatalogResource(ResourceIdentifier id) + { + DevCenterCatalogResource.ValidateResourceId(id); + return new DevCenterCatalogResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterEnvironmentTypeResource GetDevCenterEnvironmentTypeResource(ResourceIdentifier id) + { + DevCenterEnvironmentTypeResource.ValidateResourceId(id); + return new DevCenterEnvironmentTypeResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AllowedEnvironmentTypeResource GetAllowedEnvironmentTypeResource(ResourceIdentifier id) + { + AllowedEnvironmentTypeResource.ValidateResourceId(id); + return new AllowedEnvironmentTypeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterProjectEnvironmentResource GetDevCenterProjectEnvironmentResource(ResourceIdentifier id) + { + DevCenterProjectEnvironmentResource.ValidateResourceId(id); + return new DevCenterProjectEnvironmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevBoxDefinitionResource GetDevBoxDefinitionResource(ResourceIdentifier id) + { + DevBoxDefinitionResource.ValidateResourceId(id); + return new DevBoxDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProjectDevBoxDefinitionResource GetProjectDevBoxDefinitionResource(ResourceIdentifier id) + { + ProjectDevBoxDefinitionResource.ValidateResourceId(id); + return new ProjectDevBoxDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterPoolResource GetDevCenterPoolResource(ResourceIdentifier id) + { + DevCenterPoolResource.ValidateResourceId(id); + return new DevCenterPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterScheduleResource GetDevCenterScheduleResource(ResourceIdentifier id) + { + DevCenterScheduleResource.ValidateResourceId(id); + return new DevCenterScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevCenterNetworkConnectionResource GetDevCenterNetworkConnectionResource(ResourceIdentifier id) + { + DevCenterNetworkConnectionResource.ValidateResourceId(id); + return new DevCenterNetworkConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthCheckStatusDetailResource GetHealthCheckStatusDetailResource(ResourceIdentifier id) + { + HealthCheckStatusDetailResource.ValidateResourceId(id); + return new HealthCheckStatusDetailResource(Client, id); + } + } +} diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterResourceGroupResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterResourceGroupResource.cs new file mode 100644 index 0000000000000..3cec3c91e278e --- /dev/null +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterResourceGroupResource.cs @@ -0,0 +1,198 @@ +// 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.DevCenter; + +namespace Azure.ResourceManager.DevCenter.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDevCenterResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDevCenterResourceGroupResource() + { + } + + /// 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 MockableDevCenterResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DevCenterResources in the ResourceGroupResource. + /// An object representing collection of DevCenterResources and their operations over a DevCenterResource. + public virtual DevCenterCollection GetDevCenters() + { + return GetCachedClient(client => new DevCenterCollection(client, Id)); + } + + /// + /// Gets a devcenter. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName} + /// + /// + /// Operation Id + /// DevCenters_Get + /// + /// + /// + /// The name of the devcenter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevCenterAsync(string devCenterName, CancellationToken cancellationToken = default) + { + return await GetDevCenters().GetAsync(devCenterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a devcenter. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName} + /// + /// + /// Operation Id + /// DevCenters_Get + /// + /// + /// + /// The name of the devcenter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevCenter(string devCenterName, CancellationToken cancellationToken = default) + { + return GetDevCenters().Get(devCenterName, cancellationToken); + } + + /// Gets a collection of DevCenterProjectResources in the ResourceGroupResource. + /// An object representing collection of DevCenterProjectResources and their operations over a DevCenterProjectResource. + public virtual DevCenterProjectCollection GetDevCenterProjects() + { + return GetCachedClient(client => new DevCenterProjectCollection(client, Id)); + } + + /// + /// Gets a specific project. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName} + /// + /// + /// Operation Id + /// Projects_Get + /// + /// + /// + /// The name of the project. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevCenterProjectAsync(string projectName, CancellationToken cancellationToken = default) + { + return await GetDevCenterProjects().GetAsync(projectName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a specific project. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName} + /// + /// + /// Operation Id + /// Projects_Get + /// + /// + /// + /// The name of the project. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevCenterProject(string projectName, CancellationToken cancellationToken = default) + { + return GetDevCenterProjects().Get(projectName, cancellationToken); + } + + /// Gets a collection of DevCenterNetworkConnectionResources in the ResourceGroupResource. + /// An object representing collection of DevCenterNetworkConnectionResources and their operations over a DevCenterNetworkConnectionResource. + public virtual DevCenterNetworkConnectionCollection GetDevCenterNetworkConnections() + { + return GetCachedClient(client => new DevCenterNetworkConnectionCollection(client, Id)); + } + + /// + /// Gets a network connection resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/networkConnections/{networkConnectionName} + /// + /// + /// Operation Id + /// NetworkConnections_Get + /// + /// + /// + /// Name of the Network Connection that can be applied to a Pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevCenterNetworkConnectionAsync(string networkConnectionName, CancellationToken cancellationToken = default) + { + return await GetDevCenterNetworkConnections().GetAsync(networkConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a network connection resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/networkConnections/{networkConnectionName} + /// + /// + /// Operation Id + /// NetworkConnections_Get + /// + /// + /// + /// Name of the Network Connection that can be applied to a Pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevCenterNetworkConnection(string networkConnectionName, CancellationToken cancellationToken = default) + { + return GetDevCenterNetworkConnections().Get(networkConnectionName, cancellationToken); + } + } +} diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterSubscriptionResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterSubscriptionResource.cs new file mode 100644 index 0000000000000..98318e45cc83d --- /dev/null +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/MockableDevCenterSubscriptionResource.cs @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DevCenter; +using Azure.ResourceManager.DevCenter.Models; + +namespace Azure.ResourceManager.DevCenter.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDevCenterSubscriptionResource : ArmResource + { + private ClientDiagnostics _devCenterClientDiagnostics; + private DevCentersRestOperations _devCenterRestClient; + private ClientDiagnostics _devCenterProjectProjectsClientDiagnostics; + private ProjectsRestOperations _devCenterProjectProjectsRestClient; + private ClientDiagnostics _operationStatusesClientDiagnostics; + private OperationStatusesRestOperations _operationStatusesRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; + private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; + private ClientDiagnostics _devCenterNetworkConnectionNetworkConnectionsClientDiagnostics; + private NetworkConnectionsRestOperations _devCenterNetworkConnectionNetworkConnectionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDevCenterSubscriptionResource() + { + } + + /// 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 MockableDevCenterSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DevCenterClientDiagnostics => _devCenterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", DevCenterResource.ResourceType.Namespace, Diagnostics); + private DevCentersRestOperations DevCenterRestClient => _devCenterRestClient ??= new DevCentersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevCenterResource.ResourceType)); + private ClientDiagnostics DevCenterProjectProjectsClientDiagnostics => _devCenterProjectProjectsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", DevCenterProjectResource.ResourceType.Namespace, Diagnostics); + private ProjectsRestOperations DevCenterProjectProjectsRestClient => _devCenterProjectProjectsRestClient ??= new ProjectsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevCenterProjectResource.ResourceType)); + private ClientDiagnostics OperationStatusesClientDiagnostics => _operationStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OperationStatusesRestOperations OperationStatusesRestClient => _operationStatusesRestClient ??= new OperationStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DevCenterNetworkConnectionNetworkConnectionsClientDiagnostics => _devCenterNetworkConnectionNetworkConnectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", DevCenterNetworkConnectionResource.ResourceType.Namespace, Diagnostics); + private NetworkConnectionsRestOperations DevCenterNetworkConnectionNetworkConnectionsRestClient => _devCenterNetworkConnectionNetworkConnectionsRestClient ??= new NetworkConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevCenterNetworkConnectionResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all devcenters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/devcenters + /// + /// + /// Operation Id + /// DevCenters_ListBySubscription + /// + /// + /// + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevCentersAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevCenterResource(Client, DevCenterData.DeserializeDevCenterData(e)), DevCenterClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all devcenters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/devcenters + /// + /// + /// Operation Id + /// DevCenters_ListBySubscription + /// + /// + /// + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDevCenters(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevCenterResource(Client, DevCenterData.DeserializeDevCenterData(e)), DevCenterClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all projects in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/projects + /// + /// + /// Operation Id + /// Projects_ListBySubscription + /// + /// + /// + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevCenterProjectsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterProjectProjectsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterProjectProjectsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevCenterProjectResource(Client, DevCenterProjectData.DeserializeDevCenterProjectData(e)), DevCenterProjectProjectsClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenterProjects", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all projects in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/projects + /// + /// + /// Operation Id + /// Projects_ListBySubscription + /// + /// + /// + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDevCenterProjects(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterProjectProjectsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterProjectProjectsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevCenterProjectResource(Client, DevCenterProjectData.DeserializeDevCenterProjectData(e)), DevCenterProjectProjectsClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenterProjects", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the current status of an async operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/operationStatuses/{operationId} + /// + /// + /// Operation Id + /// OperationStatuses_Get + /// + /// + /// + /// The Azure region. + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetDevCenterOperationStatusAsync(AzureLocation location, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = OperationStatusesClientDiagnostics.CreateScope("MockableDevCenterSubscriptionResource.GetDevCenterOperationStatus"); + scope.Start(); + try + { + var response = await OperationStatusesRestClient.GetAsync(Id.SubscriptionId, location, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the current status of an async operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/operationStatuses/{operationId} + /// + /// + /// Operation Id + /// OperationStatuses_Get + /// + /// + /// + /// The Azure region. + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetDevCenterOperationStatus(AzureLocation location, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = OperationStatusesClientDiagnostics.CreateScope("MockableDevCenterSubscriptionResource.GetDevCenterOperationStatus"); + scope.Start(); + try + { + var response = OperationStatusesRestClient.Get(Id.SubscriptionId, location, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the current usages and limits in this location for the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListByLocation + /// + /// + /// + /// The Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevCenterUsagesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DevCenterUsage.DeserializeDevCenterUsage, UsagesClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenterUsagesByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the current usages and limits in this location for the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListByLocation + /// + /// + /// + /// The Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDevCenterUsagesByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DevCenterUsage.DeserializeDevCenterUsage, UsagesClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenterUsagesByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDevCenterNameAvailabilityAsync(DevCenterNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockableDevCenterSubscriptionResource.CheckDevCenterNameAvailability"); + scope.Start(); + try + { + var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDevCenterNameAvailability(DevCenterNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockableDevCenterSubscriptionResource.CheckDevCenterNameAvailability"); + scope.Start(); + try + { + var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the Microsoft.DevCenter SKUs available in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/skus + /// + /// + /// Operation Id + /// Skus_ListBySubscription + /// + /// + /// + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevCenterSkusBySubscriptionAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DevCenterSkuDetails.DeserializeDevCenterSkuDetails, SkusClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenterSkusBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the Microsoft.DevCenter SKUs available in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/skus + /// + /// + /// Operation Id + /// Skus_ListBySubscription + /// + /// + /// + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDevCenterSkusBySubscription(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DevCenterSkuDetails.DeserializeDevCenterSkuDetails, SkusClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenterSkusBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// Lists network connections in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/networkConnections + /// + /// + /// Operation Id + /// NetworkConnections_ListBySubscription + /// + /// + /// + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevCenterNetworkConnectionsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterNetworkConnectionNetworkConnectionsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterNetworkConnectionNetworkConnectionsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevCenterNetworkConnectionResource(Client, DevCenterNetworkConnectionData.DeserializeDevCenterNetworkConnectionData(e)), DevCenterNetworkConnectionNetworkConnectionsClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenterNetworkConnections", "value", "nextLink", cancellationToken); + } + + /// + /// Lists network connections in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/networkConnections + /// + /// + /// Operation Id + /// NetworkConnections_ListBySubscription + /// + /// + /// + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDevCenterNetworkConnections(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterNetworkConnectionNetworkConnectionsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterNetworkConnectionNetworkConnectionsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevCenterNetworkConnectionResource(Client, DevCenterNetworkConnectionData.DeserializeDevCenterNetworkConnectionData(e)), DevCenterNetworkConnectionNetworkConnectionsClientDiagnostics, Pipeline, "MockableDevCenterSubscriptionResource.GetDevCenterNetworkConnections", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 0bb4b529cc26f..0000000000000 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DevCenter -{ - /// 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 DevCenterResources in the ResourceGroupResource. - /// An object representing collection of DevCenterResources and their operations over a DevCenterResource. - public virtual DevCenterCollection GetDevCenters() - { - return GetCachedClient(Client => new DevCenterCollection(Client, Id)); - } - - /// Gets a collection of DevCenterProjectResources in the ResourceGroupResource. - /// An object representing collection of DevCenterProjectResources and their operations over a DevCenterProjectResource. - public virtual DevCenterProjectCollection GetDevCenterProjects() - { - return GetCachedClient(Client => new DevCenterProjectCollection(Client, Id)); - } - - /// Gets a collection of DevCenterNetworkConnectionResources in the ResourceGroupResource. - /// An object representing collection of DevCenterNetworkConnectionResources and their operations over a DevCenterNetworkConnectionResource. - public virtual DevCenterNetworkConnectionCollection GetDevCenterNetworkConnections() - { - return GetCachedClient(Client => new DevCenterNetworkConnectionCollection(Client, Id)); - } - } -} diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 817beb45dc0bb..0000000000000 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DevCenter.Models; - -namespace Azure.ResourceManager.DevCenter -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _devCenterClientDiagnostics; - private DevCentersRestOperations _devCenterRestClient; - private ClientDiagnostics _devCenterProjectProjectsClientDiagnostics; - private ProjectsRestOperations _devCenterProjectProjectsRestClient; - private ClientDiagnostics _operationStatusesClientDiagnostics; - private OperationStatusesRestOperations _operationStatusesRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; - private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; - private ClientDiagnostics _devCenterNetworkConnectionNetworkConnectionsClientDiagnostics; - private NetworkConnectionsRestOperations _devCenterNetworkConnectionNetworkConnectionsRestClient; - - /// 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 DevCenterClientDiagnostics => _devCenterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", DevCenterResource.ResourceType.Namespace, Diagnostics); - private DevCentersRestOperations DevCenterRestClient => _devCenterRestClient ??= new DevCentersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevCenterResource.ResourceType)); - private ClientDiagnostics DevCenterProjectProjectsClientDiagnostics => _devCenterProjectProjectsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", DevCenterProjectResource.ResourceType.Namespace, Diagnostics); - private ProjectsRestOperations DevCenterProjectProjectsRestClient => _devCenterProjectProjectsRestClient ??= new ProjectsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevCenterProjectResource.ResourceType)); - private ClientDiagnostics OperationStatusesClientDiagnostics => _operationStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OperationStatusesRestOperations OperationStatusesRestClient => _operationStatusesRestClient ??= new OperationStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DevCenterNetworkConnectionNetworkConnectionsClientDiagnostics => _devCenterNetworkConnectionNetworkConnectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevCenter", DevCenterNetworkConnectionResource.ResourceType.Namespace, Diagnostics); - private NetworkConnectionsRestOperations DevCenterNetworkConnectionNetworkConnectionsRestClient => _devCenterNetworkConnectionNetworkConnectionsRestClient ??= new NetworkConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevCenterNetworkConnectionResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all devcenters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/devcenters - /// - /// - /// Operation Id - /// DevCenters_ListBySubscription - /// - /// - /// - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevCentersAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevCenterResource(Client, DevCenterData.DeserializeDevCenterData(e)), DevCenterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all devcenters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/devcenters - /// - /// - /// Operation Id - /// DevCenters_ListBySubscription - /// - /// - /// - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevCenters(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevCenterResource(Client, DevCenterData.DeserializeDevCenterData(e)), DevCenterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all projects in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/projects - /// - /// - /// Operation Id - /// Projects_ListBySubscription - /// - /// - /// - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevCenterProjectsAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterProjectProjectsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterProjectProjectsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevCenterProjectResource(Client, DevCenterProjectData.DeserializeDevCenterProjectData(e)), DevCenterProjectProjectsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenterProjects", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all projects in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/projects - /// - /// - /// Operation Id - /// Projects_ListBySubscription - /// - /// - /// - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevCenterProjects(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterProjectProjectsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterProjectProjectsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevCenterProjectResource(Client, DevCenterProjectData.DeserializeDevCenterProjectData(e)), DevCenterProjectProjectsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenterProjects", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the current status of an async operation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/operationStatuses/{operationId} - /// - /// - /// Operation Id - /// OperationStatuses_Get - /// - /// - /// - /// The Azure region. - /// The ID of an ongoing async operation. - /// The cancellation token to use. - public virtual async Task> GetDevCenterOperationStatusAsync(AzureLocation location, string operationId, CancellationToken cancellationToken = default) - { - using var scope = OperationStatusesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetDevCenterOperationStatus"); - scope.Start(); - try - { - var response = await OperationStatusesRestClient.GetAsync(Id.SubscriptionId, location, operationId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the current status of an async operation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/operationStatuses/{operationId} - /// - /// - /// Operation Id - /// OperationStatuses_Get - /// - /// - /// - /// The Azure region. - /// The ID of an ongoing async operation. - /// The cancellation token to use. - public virtual Response GetDevCenterOperationStatus(AzureLocation location, string operationId, CancellationToken cancellationToken = default) - { - using var scope = OperationStatusesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetDevCenterOperationStatus"); - scope.Start(); - try - { - var response = OperationStatusesRestClient.Get(Id.SubscriptionId, location, operationId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the current usages and limits in this location for the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_ListByLocation - /// - /// - /// - /// The Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevCenterUsagesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DevCenterUsage.DeserializeDevCenterUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenterUsagesByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the current usages and limits in this location for the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_ListByLocation - /// - /// - /// - /// The Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevCenterUsagesByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DevCenterUsage.DeserializeDevCenterUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenterUsagesByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual async Task> CheckDevCenterNameAvailabilityAsync(DevCenterNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDevCenterNameAvailability"); - scope.Start(); - try - { - var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual Response CheckDevCenterNameAvailability(DevCenterNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDevCenterNameAvailability"); - scope.Start(); - try - { - var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the Microsoft.DevCenter SKUs available in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/skus - /// - /// - /// Operation Id - /// Skus_ListBySubscription - /// - /// - /// - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevCenterSkusBySubscriptionAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DevCenterSkuDetails.DeserializeDevCenterSkuDetails, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenterSkusBySubscription", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the Microsoft.DevCenter SKUs available in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/skus - /// - /// - /// Operation Id - /// Skus_ListBySubscription - /// - /// - /// - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevCenterSkusBySubscription(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DevCenterSkuDetails.DeserializeDevCenterSkuDetails, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenterSkusBySubscription", "value", "nextLink", cancellationToken); - } - - /// - /// Lists network connections in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/networkConnections - /// - /// - /// Operation Id - /// NetworkConnections_ListBySubscription - /// - /// - /// - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevCenterNetworkConnectionsAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterNetworkConnectionNetworkConnectionsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterNetworkConnectionNetworkConnectionsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevCenterNetworkConnectionResource(Client, DevCenterNetworkConnectionData.DeserializeDevCenterNetworkConnectionData(e)), DevCenterNetworkConnectionNetworkConnectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenterNetworkConnections", "value", "nextLink", cancellationToken); - } - - /// - /// Lists network connections in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/networkConnections - /// - /// - /// Operation Id - /// NetworkConnections_ListBySubscription - /// - /// - /// - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevCenterNetworkConnections(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevCenterNetworkConnectionNetworkConnectionsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevCenterNetworkConnectionNetworkConnectionsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevCenterNetworkConnectionResource(Client, DevCenterNetworkConnectionData.DeserializeDevCenterNetworkConnectionData(e)), DevCenterNetworkConnectionNetworkConnectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevCenterNetworkConnections", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/HealthCheckStatusDetailResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/HealthCheckStatusDetailResource.cs index 6f7658f5de980..c55a95146d0b2 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/HealthCheckStatusDetailResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/HealthCheckStatusDetailResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.DevCenter public partial class HealthCheckStatusDetailResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/networkConnections/{networkConnectionName}/healthChecks/latest"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ImageVersionResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ImageVersionResource.cs index 38ceff8b08f59..a4637bfa764cd 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ImageVersionResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ImageVersionResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.DevCenter public partial class ImageVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The devCenterName. + /// The galleryName. + /// The imageName. + /// The versionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string devCenterName, string galleryName, string imageName, string versionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/galleries/{galleryName}/images/{imageName}/versions/{versionName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectAttachedNetworkConnectionResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectAttachedNetworkConnectionResource.cs index 1e2fafcf80a85..9b6616501689b 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectAttachedNetworkConnectionResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectAttachedNetworkConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DevCenter public partial class ProjectAttachedNetworkConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The projectName. + /// The attachedNetworkConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string projectName, string attachedNetworkConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/attachednetworks/{attachedNetworkConnectionName}"; diff --git a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectDevBoxDefinitionResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectDevBoxDefinitionResource.cs index 3cd44d2dbbac5..430fd84785996 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectDevBoxDefinitionResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/ProjectDevBoxDefinitionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DevCenter public partial class ProjectDevBoxDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The projectName. + /// The devBoxDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string projectName, string devBoxDefinitionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/devboxdefinitions/{devBoxDefinitionName}"; diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/api/Azure.ResourceManager.DeviceProvisioningServices.netstandard2.0.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/api/Azure.ResourceManager.DeviceProvisioningServices.netstandard2.0.cs index 6499550db169b..fb1371d1a774b 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/api/Azure.ResourceManager.DeviceProvisioningServices.netstandard2.0.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/api/Azure.ResourceManager.DeviceProvisioningServices.netstandard2.0.cs @@ -19,7 +19,7 @@ protected DeviceProvisioningServiceCollection() { } } public partial class DeviceProvisioningServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public DeviceProvisioningServiceData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServiceProperties properties, Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServicesSkuInfo sku) : base (default(Azure.Core.AzureLocation)) { } + public DeviceProvisioningServiceData(Azure.Core.AzureLocation location, Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServiceProperties properties, Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServicesSkuInfo sku) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServiceProperties Properties { get { throw null; } set { } } public Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServicesSkuInfo Sku { get { throw null; } set { } } @@ -187,6 +187,32 @@ internal DeviceProvisioningServicesPrivateLinkResourceData() { } public Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServicesPrivateLinkResourceProperties Properties { get { throw null; } } } } +namespace Azure.ResourceManager.DeviceProvisioningServices.Mocking +{ + public partial class MockableDeviceProvisioningServicesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDeviceProvisioningServicesArmClient() { } + public virtual Azure.ResourceManager.DeviceProvisioningServices.DeviceProvisioningServiceResource GetDeviceProvisioningServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceProvisioningServices.DeviceProvisioningServicesCertificateResource GetDeviceProvisioningServicesCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceProvisioningServices.DeviceProvisioningServicesPrivateEndpointConnectionResource GetDeviceProvisioningServicesPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceProvisioningServices.DeviceProvisioningServicesPrivateLinkResource GetDeviceProvisioningServicesPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDeviceProvisioningServicesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDeviceProvisioningServicesResourceGroupResource() { } + public virtual Azure.Response GetDeviceProvisioningService(string provisioningServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceProvisioningServiceAsync(string provisioningServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceProvisioningServices.DeviceProvisioningServiceCollection GetDeviceProvisioningServices() { throw null; } + } + public partial class MockableDeviceProvisioningServicesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDeviceProvisioningServicesSubscriptionResource() { } + public virtual Azure.Response CheckDeviceProvisioningServicesNameAvailability(Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServicesNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDeviceProvisioningServicesNameAvailabilityAsync(Azure.ResourceManager.DeviceProvisioningServices.Models.DeviceProvisioningServicesNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeviceProvisioningServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeviceProvisioningServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DeviceProvisioningServices.Models { public static partial class ArmDeviceProvisioningServicesModelFactory diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceResource.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceResource.cs index 34fbfe6749025..22dd17a54e59a 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceResource.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.DeviceProvisioningServices public partial class DeviceProvisioningServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The provisioningServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string provisioningServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DeviceProvisioningServicesCertificateResources and their operations over a DeviceProvisioningServicesCertificateResource. public virtual DeviceProvisioningServicesCertificateCollection GetDeviceProvisioningServicesCertificates() { - return GetCachedClient(Client => new DeviceProvisioningServicesCertificateCollection(Client, Id)); + return GetCachedClient(client => new DeviceProvisioningServicesCertificateCollection(client, Id)); } /// @@ -113,8 +116,8 @@ public virtual DeviceProvisioningServicesCertificateCollection GetDeviceProvisio /// Name of the certificate to retrieve. /// ETag of the certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDeviceProvisioningServicesCertificateAsync(string certificateName, string ifMatch = null, CancellationToken cancellationToken = default) { @@ -137,8 +140,8 @@ public virtual async Task Name of the certificate to retrieve. /// ETag of the certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDeviceProvisioningServicesCertificate(string certificateName, string ifMatch = null, CancellationToken cancellationToken = default) { @@ -149,7 +152,7 @@ public virtual Response GetDevice /// An object representing collection of DeviceProvisioningServicesPrivateLinkResources and their operations over a DeviceProvisioningServicesPrivateLinkResource. public virtual DeviceProvisioningServicesPrivateLinkResourceCollection GetDeviceProvisioningServicesPrivateLinkResources() { - return GetCachedClient(Client => new DeviceProvisioningServicesPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new DeviceProvisioningServicesPrivateLinkResourceCollection(client, Id)); } /// @@ -167,8 +170,8 @@ public virtual DeviceProvisioningServicesPrivateLinkResourceCollection GetDevice /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDeviceProvisioningServicesPrivateLinkResourceAsync(string groupId, CancellationToken cancellationToken = default) { @@ -190,8 +193,8 @@ public virtual async Task /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDeviceProvisioningServicesPrivateLinkResource(string groupId, CancellationToken cancellationToken = default) { @@ -202,7 +205,7 @@ public virtual Response GetDevice /// An object representing collection of DeviceProvisioningServicesPrivateEndpointConnectionResources and their operations over a DeviceProvisioningServicesPrivateEndpointConnectionResource. public virtual DeviceProvisioningServicesPrivateEndpointConnectionCollection GetDeviceProvisioningServicesPrivateEndpointConnections() { - return GetCachedClient(Client => new DeviceProvisioningServicesPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new DeviceProvisioningServicesPrivateEndpointConnectionCollection(client, Id)); } /// @@ -220,8 +223,8 @@ public virtual DeviceProvisioningServicesPrivateEndpointConnectionCollection Get /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDeviceProvisioningServicesPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -243,8 +246,8 @@ public virtual async Task /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDeviceProvisioningServicesPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesCertificateResource.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesCertificateResource.cs index 3c13ff6aea066..fe8baa5dedd59 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesCertificateResource.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesCertificateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DeviceProvisioningServices public partial class DeviceProvisioningServicesCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The provisioningServiceName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string provisioningServiceName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}"; diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateEndpointConnectionResource.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateEndpointConnectionResource.cs index 389d9c852eba5..a544b5b635aba 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateEndpointConnectionResource.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DeviceProvisioningServices public partial class DeviceProvisioningServicesPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateLinkResource.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateLinkResource.cs index 68397fbd2b101..a6f9026fe64b8 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateLinkResource.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServicesPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DeviceProvisioningServices public partial class DeviceProvisioningServicesPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The groupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string groupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}"; diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/DeviceProvisioningServicesExtensions.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/DeviceProvisioningServicesExtensions.cs index 68c9a1fa75b4b..b42948a197fab 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/DeviceProvisioningServicesExtensions.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/DeviceProvisioningServicesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DeviceProvisioningServices.Mocking; using Azure.ResourceManager.DeviceProvisioningServices.Models; using Azure.ResourceManager.Resources; @@ -19,119 +20,97 @@ namespace Azure.ResourceManager.DeviceProvisioningServices /// A class to add extension methods to Azure.ResourceManager.DeviceProvisioningServices. public static partial class DeviceProvisioningServicesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDeviceProvisioningServicesArmClient GetMockableDeviceProvisioningServicesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDeviceProvisioningServicesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDeviceProvisioningServicesResourceGroupResource GetMockableDeviceProvisioningServicesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDeviceProvisioningServicesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDeviceProvisioningServicesSubscriptionResource GetMockableDeviceProvisioningServicesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDeviceProvisioningServicesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DeviceProvisioningServicesCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeviceProvisioningServicesCertificateResource GetDeviceProvisioningServicesCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeviceProvisioningServicesCertificateResource.ValidateResourceId(id); - return new DeviceProvisioningServicesCertificateResource(client, id); - } - ); + return GetMockableDeviceProvisioningServicesArmClient(client).GetDeviceProvisioningServicesCertificateResource(id); } - #endregion - #region DeviceProvisioningServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeviceProvisioningServiceResource GetDeviceProvisioningServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeviceProvisioningServiceResource.ValidateResourceId(id); - return new DeviceProvisioningServiceResource(client, id); - } - ); + return GetMockableDeviceProvisioningServicesArmClient(client).GetDeviceProvisioningServiceResource(id); } - #endregion - #region DeviceProvisioningServicesPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeviceProvisioningServicesPrivateLinkResource GetDeviceProvisioningServicesPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeviceProvisioningServicesPrivateLinkResource.ValidateResourceId(id); - return new DeviceProvisioningServicesPrivateLinkResource(client, id); - } - ); + return GetMockableDeviceProvisioningServicesArmClient(client).GetDeviceProvisioningServicesPrivateLinkResource(id); } - #endregion - #region DeviceProvisioningServicesPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeviceProvisioningServicesPrivateEndpointConnectionResource GetDeviceProvisioningServicesPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeviceProvisioningServicesPrivateEndpointConnectionResource.ValidateResourceId(id); - return new DeviceProvisioningServicesPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableDeviceProvisioningServicesArmClient(client).GetDeviceProvisioningServicesPrivateEndpointConnectionResource(id); } - #endregion - /// Gets a collection of DeviceProvisioningServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of DeviceProvisioningServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DeviceProvisioningServiceResources and their operations over a DeviceProvisioningServiceResource. public static DeviceProvisioningServiceCollection GetDeviceProvisioningServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDeviceProvisioningServices(); + return GetMockableDeviceProvisioningServicesResourceGroupResource(resourceGroupResource).GetDeviceProvisioningServices(); } /// @@ -146,16 +125,20 @@ public static DeviceProvisioningServiceCollection GetDeviceProvisioningServices( /// IotDpsResource_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the provisioning service to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDeviceProvisioningServiceAsync(this ResourceGroupResource resourceGroupResource, string provisioningServiceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDeviceProvisioningServices().GetAsync(provisioningServiceName, cancellationToken).ConfigureAwait(false); + return await GetMockableDeviceProvisioningServicesResourceGroupResource(resourceGroupResource).GetDeviceProvisioningServiceAsync(provisioningServiceName, cancellationToken).ConfigureAwait(false); } /// @@ -170,16 +153,20 @@ public static async Task> GetDeviceP /// IotDpsResource_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the provisioning service to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDeviceProvisioningService(this ResourceGroupResource resourceGroupResource, string provisioningServiceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDeviceProvisioningServices().Get(provisioningServiceName, cancellationToken); + return GetMockableDeviceProvisioningServicesResourceGroupResource(resourceGroupResource).GetDeviceProvisioningService(provisioningServiceName, cancellationToken); } /// @@ -194,13 +181,17 @@ public static Response GetDeviceProvisioningS /// IotDpsResource_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeviceProvisioningServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeviceProvisioningServicesAsync(cancellationToken); + return GetMockableDeviceProvisioningServicesSubscriptionResource(subscriptionResource).GetDeviceProvisioningServicesAsync(cancellationToken); } /// @@ -215,13 +206,17 @@ public static AsyncPageable GetDeviceProvisio /// IotDpsResource_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeviceProvisioningServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeviceProvisioningServices(cancellationToken); + return GetMockableDeviceProvisioningServicesSubscriptionResource(subscriptionResource).GetDeviceProvisioningServices(cancellationToken); } /// @@ -236,6 +231,10 @@ public static Pageable GetDeviceProvisioningS /// IotDpsResource_CheckProvisioningServiceNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the OperationInputs structure to the name of the provisioning service to check. @@ -243,9 +242,7 @@ public static Pageable GetDeviceProvisioningS /// is null. public static async Task> CheckDeviceProvisioningServicesNameAvailabilityAsync(this SubscriptionResource subscriptionResource, DeviceProvisioningServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDeviceProvisioningServicesNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableDeviceProvisioningServicesSubscriptionResource(subscriptionResource).CheckDeviceProvisioningServicesNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -260,6 +257,10 @@ public static async TaskIotDpsResource_CheckProvisioningServiceNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the OperationInputs structure to the name of the provisioning service to check. @@ -267,9 +268,7 @@ public static async Task is null. public static Response CheckDeviceProvisioningServicesNameAvailability(this SubscriptionResource subscriptionResource, DeviceProvisioningServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDeviceProvisioningServicesNameAvailability(content, cancellationToken); + return GetMockableDeviceProvisioningServicesSubscriptionResource(subscriptionResource).CheckDeviceProvisioningServicesNameAvailability(content, cancellationToken); } } } diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesArmClient.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesArmClient.cs new file mode 100644 index 0000000000000..c26fb463e200d --- /dev/null +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DeviceProvisioningServices; + +namespace Azure.ResourceManager.DeviceProvisioningServices.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDeviceProvisioningServicesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDeviceProvisioningServicesArmClient() + { + } + + /// 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 MockableDeviceProvisioningServicesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDeviceProvisioningServicesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceProvisioningServicesCertificateResource GetDeviceProvisioningServicesCertificateResource(ResourceIdentifier id) + { + DeviceProvisioningServicesCertificateResource.ValidateResourceId(id); + return new DeviceProvisioningServicesCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceProvisioningServiceResource GetDeviceProvisioningServiceResource(ResourceIdentifier id) + { + DeviceProvisioningServiceResource.ValidateResourceId(id); + return new DeviceProvisioningServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceProvisioningServicesPrivateLinkResource GetDeviceProvisioningServicesPrivateLinkResource(ResourceIdentifier id) + { + DeviceProvisioningServicesPrivateLinkResource.ValidateResourceId(id); + return new DeviceProvisioningServicesPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceProvisioningServicesPrivateEndpointConnectionResource GetDeviceProvisioningServicesPrivateEndpointConnectionResource(ResourceIdentifier id) + { + DeviceProvisioningServicesPrivateEndpointConnectionResource.ValidateResourceId(id); + return new DeviceProvisioningServicesPrivateEndpointConnectionResource(Client, id); + } + } +} diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesResourceGroupResource.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesResourceGroupResource.cs new file mode 100644 index 0000000000000..652117eb56ab4 --- /dev/null +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.DeviceProvisioningServices; + +namespace Azure.ResourceManager.DeviceProvisioningServices.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDeviceProvisioningServicesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDeviceProvisioningServicesResourceGroupResource() + { + } + + /// 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 MockableDeviceProvisioningServicesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DeviceProvisioningServiceResources in the ResourceGroupResource. + /// An object representing collection of DeviceProvisioningServiceResources and their operations over a DeviceProvisioningServiceResource. + public virtual DeviceProvisioningServiceCollection GetDeviceProvisioningServices() + { + return GetCachedClient(client => new DeviceProvisioningServiceCollection(client, Id)); + } + + /// + /// Get the metadata of the provisioning service without SAS keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName} + /// + /// + /// Operation Id + /// IotDpsResource_Get + /// + /// + /// + /// Name of the provisioning service to retrieve. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceProvisioningServiceAsync(string provisioningServiceName, CancellationToken cancellationToken = default) + { + return await GetDeviceProvisioningServices().GetAsync(provisioningServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the metadata of the provisioning service without SAS keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName} + /// + /// + /// Operation Id + /// IotDpsResource_Get + /// + /// + /// + /// Name of the provisioning service to retrieve. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceProvisioningService(string provisioningServiceName, CancellationToken cancellationToken = default) + { + return GetDeviceProvisioningServices().Get(provisioningServiceName, cancellationToken); + } + } +} diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesSubscriptionResource.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesSubscriptionResource.cs new file mode 100644 index 0000000000000..5925709c3a098 --- /dev/null +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/MockableDeviceProvisioningServicesSubscriptionResource.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DeviceProvisioningServices; +using Azure.ResourceManager.DeviceProvisioningServices.Models; + +namespace Azure.ResourceManager.DeviceProvisioningServices.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDeviceProvisioningServicesSubscriptionResource : ArmResource + { + private ClientDiagnostics _deviceProvisioningServiceIotDpsResourceClientDiagnostics; + private IotDpsResourceRestOperations _deviceProvisioningServiceIotDpsResourceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDeviceProvisioningServicesSubscriptionResource() + { + } + + /// 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 MockableDeviceProvisioningServicesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DeviceProvisioningServiceIotDpsResourceClientDiagnostics => _deviceProvisioningServiceIotDpsResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceProvisioningServices", DeviceProvisioningServiceResource.ResourceType.Namespace, Diagnostics); + private IotDpsResourceRestOperations DeviceProvisioningServiceIotDpsResourceRestClient => _deviceProvisioningServiceIotDpsResourceRestClient ??= new IotDpsResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceProvisioningServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices + /// + /// + /// Operation Id + /// IotDpsResource_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeviceProvisioningServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceProvisioningServiceIotDpsResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceProvisioningServiceIotDpsResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceProvisioningServiceResource(Client, DeviceProvisioningServiceData.DeserializeDeviceProvisioningServiceData(e)), DeviceProvisioningServiceIotDpsResourceClientDiagnostics, Pipeline, "MockableDeviceProvisioningServicesSubscriptionResource.GetDeviceProvisioningServices", "value", "nextLink", cancellationToken); + } + + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices + /// + /// + /// Operation Id + /// IotDpsResource_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeviceProvisioningServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceProvisioningServiceIotDpsResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceProvisioningServiceIotDpsResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceProvisioningServiceResource(Client, DeviceProvisioningServiceData.DeserializeDeviceProvisioningServiceData(e)), DeviceProvisioningServiceIotDpsResourceClientDiagnostics, Pipeline, "MockableDeviceProvisioningServicesSubscriptionResource.GetDeviceProvisioningServices", "value", "nextLink", cancellationToken); + } + + /// + /// Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability + /// + /// + /// Operation Id + /// IotDpsResource_CheckProvisioningServiceNameAvailability + /// + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the provisioning service to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDeviceProvisioningServicesNameAvailabilityAsync(DeviceProvisioningServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DeviceProvisioningServiceIotDpsResourceClientDiagnostics.CreateScope("MockableDeviceProvisioningServicesSubscriptionResource.CheckDeviceProvisioningServicesNameAvailability"); + scope.Start(); + try + { + var response = await DeviceProvisioningServiceIotDpsResourceRestClient.CheckProvisioningServiceNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability + /// + /// + /// Operation Id + /// IotDpsResource_CheckProvisioningServiceNameAvailability + /// + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the provisioning service to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDeviceProvisioningServicesNameAvailability(DeviceProvisioningServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DeviceProvisioningServiceIotDpsResourceClientDiagnostics.CreateScope("MockableDeviceProvisioningServicesSubscriptionResource.CheckDeviceProvisioningServicesNameAvailability"); + scope.Start(); + try + { + var response = DeviceProvisioningServiceIotDpsResourceRestClient.CheckProvisioningServiceNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 1edaa3a079013..0000000000000 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DeviceProvisioningServices -{ - /// 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 DeviceProvisioningServiceResources in the ResourceGroupResource. - /// An object representing collection of DeviceProvisioningServiceResources and their operations over a DeviceProvisioningServiceResource. - public virtual DeviceProvisioningServiceCollection GetDeviceProvisioningServices() - { - return GetCachedClient(Client => new DeviceProvisioningServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b4f5af9fcacf9..0000000000000 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DeviceProvisioningServices.Models; - -namespace Azure.ResourceManager.DeviceProvisioningServices -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _deviceProvisioningServiceIotDpsResourceClientDiagnostics; - private IotDpsResourceRestOperations _deviceProvisioningServiceIotDpsResourceRestClient; - - /// 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 DeviceProvisioningServiceIotDpsResourceClientDiagnostics => _deviceProvisioningServiceIotDpsResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceProvisioningServices", DeviceProvisioningServiceResource.ResourceType.Namespace, Diagnostics); - private IotDpsResourceRestOperations DeviceProvisioningServiceIotDpsResourceRestClient => _deviceProvisioningServiceIotDpsResourceRestClient ??= new IotDpsResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceProvisioningServiceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the provisioning services for a given subscription id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices - /// - /// - /// Operation Id - /// IotDpsResource_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeviceProvisioningServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceProvisioningServiceIotDpsResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceProvisioningServiceIotDpsResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceProvisioningServiceResource(Client, DeviceProvisioningServiceData.DeserializeDeviceProvisioningServiceData(e)), DeviceProvisioningServiceIotDpsResourceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeviceProvisioningServices", "value", "nextLink", cancellationToken); - } - - /// - /// List all the provisioning services for a given subscription id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices - /// - /// - /// Operation Id - /// IotDpsResource_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeviceProvisioningServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceProvisioningServiceIotDpsResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceProvisioningServiceIotDpsResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceProvisioningServiceResource(Client, DeviceProvisioningServiceData.DeserializeDeviceProvisioningServiceData(e)), DeviceProvisioningServiceIotDpsResourceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeviceProvisioningServices", "value", "nextLink", cancellationToken); - } - - /// - /// Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability - /// - /// - /// Operation Id - /// IotDpsResource_CheckProvisioningServiceNameAvailability - /// - /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the provisioning service to check. - /// The cancellation token to use. - public virtual async Task> CheckDeviceProvisioningServicesNameAvailabilityAsync(DeviceProvisioningServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DeviceProvisioningServiceIotDpsResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDeviceProvisioningServicesNameAvailability"); - scope.Start(); - try - { - var response = await DeviceProvisioningServiceIotDpsResourceRestClient.CheckProvisioningServiceNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if a provisioning service name is available. This will validate if the name is syntactically valid and if the name is usable - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability - /// - /// - /// Operation Id - /// IotDpsResource_CheckProvisioningServiceNameAvailability - /// - /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the provisioning service to check. - /// The cancellation token to use. - public virtual Response CheckDeviceProvisioningServicesNameAvailability(DeviceProvisioningServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DeviceProvisioningServiceIotDpsResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDeviceProvisioningServicesNameAvailability"); - scope.Start(); - try - { - var response = DeviceProvisioningServiceIotDpsResourceRestClient.CheckProvisioningServiceNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/Azure.ResourceManager.DeviceUpdate.sln b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/Azure.ResourceManager.DeviceUpdate.sln index 518238b9d6479..5494aa1c63be1 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/Azure.ResourceManager.DeviceUpdate.sln +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/Azure.ResourceManager.DeviceUpdate.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DeviceUpdate", "src\Azure.ResourceManager.DeviceUpdate.csproj", "{6A15F2E5-3E65-44F5-911D-E0BF49C6BAE9}" EndProject @@ -45,18 +45,6 @@ Global {06361970-B817-48D4-9803-48BE26523ED8}.Release|x64.Build.0 = Release|Any CPU {06361970-B817-48D4-9803-48BE26523ED8}.Release|x86.ActiveCfg = Release|Any CPU {06361970-B817-48D4-9803-48BE26523ED8}.Release|x86.Build.0 = Release|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Debug|x64.ActiveCfg = Debug|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Debug|x64.Build.0 = Debug|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Debug|x86.ActiveCfg = Debug|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Debug|x86.Build.0 = Debug|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Release|Any CPU.Build.0 = Release|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Release|x64.ActiveCfg = Release|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Release|x64.Build.0 = Release|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Release|x86.ActiveCfg = Release|Any CPU - {5F64CEC1-7D66-4855-A59D-FD41728DBF89}.Release|x86.Build.0 = Release|Any CPU {02452114-797D-4E64-B049-CAFE98594AAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {02452114-797D-4E64-B049-CAFE98594AAA}.Debug|Any CPU.Build.0 = Debug|Any CPU {02452114-797D-4E64-B049-CAFE98594AAA}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -69,6 +57,18 @@ Global {02452114-797D-4E64-B049-CAFE98594AAA}.Release|x64.Build.0 = Release|Any CPU {02452114-797D-4E64-B049-CAFE98594AAA}.Release|x86.ActiveCfg = Release|Any CPU {02452114-797D-4E64-B049-CAFE98594AAA}.Release|x86.Build.0 = Release|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Debug|x64.ActiveCfg = Debug|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Debug|x64.Build.0 = Debug|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Debug|x86.ActiveCfg = Debug|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Debug|x86.Build.0 = Debug|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Release|Any CPU.Build.0 = Release|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Release|x64.ActiveCfg = Release|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Release|x64.Build.0 = Release|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Release|x86.ActiveCfg = Release|Any CPU + {478A84E9-67B3-4ADD-9A7C-6AFF591F5DCA}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/api/Azure.ResourceManager.DeviceUpdate.netstandard2.0.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/api/Azure.ResourceManager.DeviceUpdate.netstandard2.0.cs index 4da15a8b7584e..e3e502185ee3e 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/api/Azure.ResourceManager.DeviceUpdate.netstandard2.0.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/api/Azure.ResourceManager.DeviceUpdate.netstandard2.0.cs @@ -19,7 +19,7 @@ protected DeviceUpdateAccountCollection() { } } public partial class DeviceUpdateAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public DeviceUpdateAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DeviceUpdateAccountData(Azure.Core.AzureLocation location) { } public string HostName { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList Locations { get { throw null; } } @@ -94,7 +94,7 @@ protected DeviceUpdateInstanceCollection() { } } public partial class DeviceUpdateInstanceData : Azure.ResourceManager.Models.TrackedResourceData { - public DeviceUpdateInstanceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DeviceUpdateInstanceData(Azure.Core.AzureLocation location) { } public string AccountName { get { throw null; } } public Azure.ResourceManager.DeviceUpdate.Models.DiagnosticStorageProperties DiagnosticStorageProperties { get { throw null; } set { } } public bool? EnableDiagnostics { get { throw null; } set { } } @@ -237,6 +237,33 @@ protected PrivateLinkResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DeviceUpdate.Mocking +{ + public partial class MockableDeviceUpdateArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDeviceUpdateArmClient() { } + public virtual Azure.ResourceManager.DeviceUpdate.DeviceUpdateAccountResource GetDeviceUpdateAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceUpdate.DeviceUpdateInstanceResource GetDeviceUpdateInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceUpdate.DeviceUpdatePrivateEndpointConnectionResource GetDeviceUpdatePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceUpdate.PrivateEndpointConnectionProxyResource GetPrivateEndpointConnectionProxyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DeviceUpdate.PrivateLinkResource GetPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDeviceUpdateResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDeviceUpdateResourceGroupResource() { } + public virtual Azure.Response GetDeviceUpdateAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceUpdateAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DeviceUpdate.DeviceUpdateAccountCollection GetDeviceUpdateAccounts() { throw null; } + } + public partial class MockableDeviceUpdateSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDeviceUpdateSubscriptionResource() { } + public virtual Azure.Response CheckDeviceUpdateNameAvailability(Azure.ResourceManager.DeviceUpdate.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDeviceUpdateNameAvailabilityAsync(Azure.ResourceManager.DeviceUpdate.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeviceUpdateAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeviceUpdateAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DeviceUpdate.Models { public static partial class ArmDeviceUpdateModelFactory diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountResource.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountResource.cs index 5a749c13bdd21..6635262456605 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountResource.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DeviceUpdate public partial class DeviceUpdateAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DeviceUpdateInstanceResources and their operations over a DeviceUpdateInstanceResource. public virtual DeviceUpdateInstanceCollection GetDeviceUpdateInstances() { - return GetCachedClient(Client => new DeviceUpdateInstanceCollection(Client, Id)); + return GetCachedClient(client => new DeviceUpdateInstanceCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual DeviceUpdateInstanceCollection GetDeviceUpdateInstances() /// /// Instance name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDeviceUpdateInstanceAsync(string instanceName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetDeviceUpdat /// /// Instance name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDeviceUpdateInstance(string instanceName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetDeviceUpdateInstance(st /// An object representing collection of DeviceUpdatePrivateEndpointConnectionResources and their operations over a DeviceUpdatePrivateEndpointConnectionResource. public virtual DeviceUpdatePrivateEndpointConnectionCollection GetDeviceUpdatePrivateEndpointConnections() { - return GetCachedClient(Client => new DeviceUpdatePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new DeviceUpdatePrivateEndpointConnectionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual DeviceUpdatePrivateEndpointConnectionCollection GetDeviceUpdatePr /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDeviceUpdatePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDeviceUpdatePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetDevice /// An object representing collection of PrivateLinkResources and their operations over a PrivateLinkResource. public virtual PrivateLinkCollection GetPrivateLinks() { - return GetCachedClient(Client => new PrivateLinkCollection(Client, Id)); + return GetCachedClient(client => new PrivateLinkCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual PrivateLinkCollection GetPrivateLinks() /// /// The group ID of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPrivateLinkAsync(string groupId, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetPrivateLinkAsync(str /// /// The group ID of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPrivateLink(string groupId, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetPrivateLink(string groupId, Canc /// An object representing collection of PrivateEndpointConnectionProxyResources and their operations over a PrivateEndpointConnectionProxyResource. public virtual PrivateEndpointConnectionProxyCollection GetPrivateEndpointConnectionProxies() { - return GetCachedClient(Client => new PrivateEndpointConnectionProxyCollection(Client, Id)); + return GetCachedClient(client => new PrivateEndpointConnectionProxyCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual PrivateEndpointConnectionProxyCollection GetPrivateEndpointConnec /// /// The ID of the private endpoint connection proxy object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPrivateEndpointConnectionProxyAsync(string privateEndpointConnectionProxyId, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetP /// /// The ID of the private endpoint connection proxy object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPrivateEndpointConnectionProxy(string privateEndpointConnectionProxyId, CancellationToken cancellationToken = default) { diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateInstanceResource.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateInstanceResource.cs index 3e7a119001aca..e0595ab76d1a2 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateInstanceResource.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateInstanceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DeviceUpdate public partial class DeviceUpdateInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The instanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string instanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/instances/{instanceName}"; diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdatePrivateEndpointConnectionResource.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdatePrivateEndpointConnectionResource.cs index f9a47789b2f30..ace7c591309d8 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdatePrivateEndpointConnectionResource.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdatePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DeviceUpdate public partial class DeviceUpdatePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/DeviceUpdateExtensions.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/DeviceUpdateExtensions.cs index 95187897d1877..84a25d074ba20 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/DeviceUpdateExtensions.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/DeviceUpdateExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DeviceUpdate.Mocking; using Azure.ResourceManager.DeviceUpdate.Models; using Azure.ResourceManager.Resources; @@ -19,138 +20,113 @@ namespace Azure.ResourceManager.DeviceUpdate /// A class to add extension methods to Azure.ResourceManager.DeviceUpdate. public static partial class DeviceUpdateExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDeviceUpdateArmClient GetMockableDeviceUpdateArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDeviceUpdateArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDeviceUpdateResourceGroupResource GetMockableDeviceUpdateResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDeviceUpdateResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDeviceUpdateSubscriptionResource GetMockableDeviceUpdateSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDeviceUpdateSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DeviceUpdateAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeviceUpdateAccountResource GetDeviceUpdateAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeviceUpdateAccountResource.ValidateResourceId(id); - return new DeviceUpdateAccountResource(client, id); - } - ); + return GetMockableDeviceUpdateArmClient(client).GetDeviceUpdateAccountResource(id); } - #endregion - #region DeviceUpdateInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeviceUpdateInstanceResource GetDeviceUpdateInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeviceUpdateInstanceResource.ValidateResourceId(id); - return new DeviceUpdateInstanceResource(client, id); - } - ); + return GetMockableDeviceUpdateArmClient(client).GetDeviceUpdateInstanceResource(id); } - #endregion - #region DeviceUpdatePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeviceUpdatePrivateEndpointConnectionResource GetDeviceUpdatePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeviceUpdatePrivateEndpointConnectionResource.ValidateResourceId(id); - return new DeviceUpdatePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableDeviceUpdateArmClient(client).GetDeviceUpdatePrivateEndpointConnectionResource(id); } - #endregion - #region PrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateLinkResource GetPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateLinkResource.ValidateResourceId(id); - return new PrivateLinkResource(client, id); - } - ); + return GetMockableDeviceUpdateArmClient(client).GetPrivateLinkResource(id); } - #endregion - #region PrivateEndpointConnectionProxyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateEndpointConnectionProxyResource GetPrivateEndpointConnectionProxyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateEndpointConnectionProxyResource.ValidateResourceId(id); - return new PrivateEndpointConnectionProxyResource(client, id); - } - ); + return GetMockableDeviceUpdateArmClient(client).GetPrivateEndpointConnectionProxyResource(id); } - #endregion - /// Gets a collection of DeviceUpdateAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of DeviceUpdateAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DeviceUpdateAccountResources and their operations over a DeviceUpdateAccountResource. public static DeviceUpdateAccountCollection GetDeviceUpdateAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDeviceUpdateAccounts(); + return GetMockableDeviceUpdateResourceGroupResource(resourceGroupResource).GetDeviceUpdateAccounts(); } /// @@ -165,16 +141,20 @@ public static DeviceUpdateAccountCollection GetDeviceUpdateAccounts(this Resourc /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDeviceUpdateAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDeviceUpdateAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableDeviceUpdateResourceGroupResource(resourceGroupResource).GetDeviceUpdateAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -189,16 +169,20 @@ public static async Task> GetDeviceUpdateA /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDeviceUpdateAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDeviceUpdateAccounts().Get(accountName, cancellationToken); + return GetMockableDeviceUpdateResourceGroupResource(resourceGroupResource).GetDeviceUpdateAccount(accountName, cancellationToken); } /// @@ -213,6 +197,10 @@ public static Response GetDeviceUpdateAccount(this /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Check Name Availability Request. @@ -220,9 +208,7 @@ public static Response GetDeviceUpdateAccount(this /// is null. public static async Task> CheckDeviceUpdateNameAvailabilityAsync(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDeviceUpdateNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableDeviceUpdateSubscriptionResource(subscriptionResource).CheckDeviceUpdateNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -237,6 +223,10 @@ public static async Task> CheckDeviceUpd /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Check Name Availability Request. @@ -244,9 +234,7 @@ public static async Task> CheckDeviceUpd /// is null. public static Response CheckDeviceUpdateNameAvailability(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDeviceUpdateNameAvailability(content, cancellationToken); + return GetMockableDeviceUpdateSubscriptionResource(subscriptionResource).CheckDeviceUpdateNameAvailability(content, cancellationToken); } /// @@ -261,13 +249,17 @@ public static Response CheckDeviceUpdateNameAvail /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeviceUpdateAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeviceUpdateAccountsAsync(cancellationToken); + return GetMockableDeviceUpdateSubscriptionResource(subscriptionResource).GetDeviceUpdateAccountsAsync(cancellationToken); } /// @@ -282,13 +274,17 @@ public static AsyncPageable GetDeviceUpdateAccounts /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeviceUpdateAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeviceUpdateAccounts(cancellationToken); + return GetMockableDeviceUpdateSubscriptionResource(subscriptionResource).GetDeviceUpdateAccounts(cancellationToken); } } } diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateArmClient.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateArmClient.cs new file mode 100644 index 0000000000000..d51d82fd12d28 --- /dev/null +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DeviceUpdate; + +namespace Azure.ResourceManager.DeviceUpdate.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDeviceUpdateArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDeviceUpdateArmClient() + { + } + + /// 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 MockableDeviceUpdateArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDeviceUpdateArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceUpdateAccountResource GetDeviceUpdateAccountResource(ResourceIdentifier id) + { + DeviceUpdateAccountResource.ValidateResourceId(id); + return new DeviceUpdateAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceUpdateInstanceResource GetDeviceUpdateInstanceResource(ResourceIdentifier id) + { + DeviceUpdateInstanceResource.ValidateResourceId(id); + return new DeviceUpdateInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceUpdatePrivateEndpointConnectionResource GetDeviceUpdatePrivateEndpointConnectionResource(ResourceIdentifier id) + { + DeviceUpdatePrivateEndpointConnectionResource.ValidateResourceId(id); + return new DeviceUpdatePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateLinkResource GetPrivateLinkResource(ResourceIdentifier id) + { + PrivateLinkResource.ValidateResourceId(id); + return new PrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateEndpointConnectionProxyResource GetPrivateEndpointConnectionProxyResource(ResourceIdentifier id) + { + PrivateEndpointConnectionProxyResource.ValidateResourceId(id); + return new PrivateEndpointConnectionProxyResource(Client, id); + } + } +} diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateResourceGroupResource.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateResourceGroupResource.cs new file mode 100644 index 0000000000000..19bdd2437a3ef --- /dev/null +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.DeviceUpdate; + +namespace Azure.ResourceManager.DeviceUpdate.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDeviceUpdateResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDeviceUpdateResourceGroupResource() + { + } + + /// 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 MockableDeviceUpdateResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DeviceUpdateAccountResources in the ResourceGroupResource. + /// An object representing collection of DeviceUpdateAccountResources and their operations over a DeviceUpdateAccountResource. + public virtual DeviceUpdateAccountCollection GetDeviceUpdateAccounts() + { + return GetCachedClient(client => new DeviceUpdateAccountCollection(client, Id)); + } + + /// + /// Returns account details for the given account name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// Account name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceUpdateAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetDeviceUpdateAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns account details for the given account name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// Account name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceUpdateAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetDeviceUpdateAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateSubscriptionResource.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateSubscriptionResource.cs new file mode 100644 index 0000000000000..9a064988379ad --- /dev/null +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/MockableDeviceUpdateSubscriptionResource.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DeviceUpdate; +using Azure.ResourceManager.DeviceUpdate.Models; + +namespace Azure.ResourceManager.DeviceUpdate.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDeviceUpdateSubscriptionResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private DeviceUpdateRestOperations _defaultRestClient; + private ClientDiagnostics _deviceUpdateAccountAccountsClientDiagnostics; + private AccountsRestOperations _deviceUpdateAccountAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDeviceUpdateSubscriptionResource() + { + } + + /// 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 MockableDeviceUpdateSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceUpdate", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DeviceUpdateRestOperations DefaultRestClient => _defaultRestClient ??= new DeviceUpdateRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DeviceUpdateAccountAccountsClientDiagnostics => _deviceUpdateAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceUpdate", DeviceUpdateAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations DeviceUpdateAccountAccountsRestClient => _deviceUpdateAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceUpdateAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks ADU resource name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/checknameavailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// Check Name Availability Request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDeviceUpdateNameAvailabilityAsync(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableDeviceUpdateSubscriptionResource.CheckDeviceUpdateNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks ADU resource name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/checknameavailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// Check Name Availability Request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDeviceUpdateNameAvailability(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableDeviceUpdateSubscriptionResource.CheckDeviceUpdateNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns list of Accounts. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeviceUpdateAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceUpdateAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceUpdateAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceUpdateAccountResource(Client, DeviceUpdateAccountData.DeserializeDeviceUpdateAccountData(e)), DeviceUpdateAccountAccountsClientDiagnostics, Pipeline, "MockableDeviceUpdateSubscriptionResource.GetDeviceUpdateAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Returns list of Accounts. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeviceUpdateAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceUpdateAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceUpdateAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceUpdateAccountResource(Client, DeviceUpdateAccountData.DeserializeDeviceUpdateAccountData(e)), DeviceUpdateAccountAccountsClientDiagnostics, Pipeline, "MockableDeviceUpdateSubscriptionResource.GetDeviceUpdateAccounts", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 366e738c273b4..0000000000000 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DeviceUpdate -{ - /// 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 DeviceUpdateAccountResources in the ResourceGroupResource. - /// An object representing collection of DeviceUpdateAccountResources and their operations over a DeviceUpdateAccountResource. - public virtual DeviceUpdateAccountCollection GetDeviceUpdateAccounts() - { - return GetCachedClient(Client => new DeviceUpdateAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index cbbd0011167cc..0000000000000 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DeviceUpdate.Models; - -namespace Azure.ResourceManager.DeviceUpdate -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private DeviceUpdateRestOperations _defaultRestClient; - private ClientDiagnostics _deviceUpdateAccountAccountsClientDiagnostics; - private AccountsRestOperations _deviceUpdateAccountAccountsRestClient; - - /// 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 DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceUpdate", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DeviceUpdateRestOperations DefaultRestClient => _defaultRestClient ??= new DeviceUpdateRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DeviceUpdateAccountAccountsClientDiagnostics => _deviceUpdateAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DeviceUpdate", DeviceUpdateAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations DeviceUpdateAccountAccountsRestClient => _deviceUpdateAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeviceUpdateAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks ADU resource name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/checknameavailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// Check Name Availability Request. - /// The cancellation token to use. - public virtual async Task> CheckDeviceUpdateNameAvailabilityAsync(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDeviceUpdateNameAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks ADU resource name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/checknameavailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// Check Name Availability Request. - /// The cancellation token to use. - public virtual Response CheckDeviceUpdateNameAvailability(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDeviceUpdateNameAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns list of Accounts. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeviceUpdateAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceUpdateAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceUpdateAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeviceUpdateAccountResource(Client, DeviceUpdateAccountData.DeserializeDeviceUpdateAccountData(e)), DeviceUpdateAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeviceUpdateAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Returns list of Accounts. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeviceUpdateAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeviceUpdateAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeviceUpdateAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeviceUpdateAccountResource(Client, DeviceUpdateAccountData.DeserializeDeviceUpdateAccountData(e)), DeviceUpdateAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeviceUpdateAccounts", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateEndpointConnectionProxyResource.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateEndpointConnectionProxyResource.cs index b24995d69e5b1..c5468d8b70ac9 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateEndpointConnectionProxyResource.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateEndpointConnectionProxyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DeviceUpdate public partial class PrivateEndpointConnectionProxyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The privateEndpointConnectionProxyId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string privateEndpointConnectionProxyId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId}"; diff --git a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateLinkResource.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateLinkResource.cs index a55c908634d41..147c176f9df6d 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateLinkResource.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/PrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DeviceUpdate public partial class PrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The groupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string groupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/privateLinkResources/{groupId}"; diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/Azure.ResourceManager.DevSpaces.sln b/sdk/devspaces/Azure.ResourceManager.DevSpaces/Azure.ResourceManager.DevSpaces.sln index 6b61c99bbdbe3..c9e7923d3fb21 100644 --- a/sdk/devspaces/Azure.ResourceManager.DevSpaces/Azure.ResourceManager.DevSpaces.sln +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/Azure.ResourceManager.DevSpaces.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2B7B5F99-FDAB-4EF6-8D37-885A1FEDBD3E}") = "Azure.ResourceManager.DevSpaces", "src\Azure.ResourceManager.DevSpaces.csproj", "{73013E76-76F8-4924-A4A8-758723310CBD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DevSpaces", "src\Azure.ResourceManager.DevSpaces.csproj", "{73013E76-76F8-4924-A4A8-758723310CBD}" EndProject -Project("{2B7B5F99-FDAB-4EF6-8D37-885A1FEDBD3E}") = "Azure.ResourceManager.DevSpaces.Tests", "tests\Azure.ResourceManager.DevSpaces.Tests.csproj", "{5E89810B-DC50-40E9-8626-474441D5193E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DevSpaces.Tests", "tests\Azure.ResourceManager.DevSpaces.Tests.csproj", "{5E89810B-DC50-40E9-8626-474441D5193E}" EndProject -Project("{2B7B5F99-FDAB-4EF6-8D37-885A1FEDBD3E}") = "Azure.ResourceManager.DevSpaces.Samples", "samples\Azure.ResourceManager.DevSpaces.Samples.csproj", "{4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.DevSpaces.Samples", "samples\Azure.ResourceManager.DevSpaces.Samples.csproj", "{4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {F2E9A046-99DD-4D19-8E1A-9540F84D59AD} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {5E89810B-DC50-40E9-8626-474441D5193E}.Release|x64.Build.0 = Release|Any CPU {5E89810B-DC50-40E9-8626-474441D5193E}.Release|x86.ActiveCfg = Release|Any CPU {5E89810B-DC50-40E9-8626-474441D5193E}.Release|x86.Build.0 = Release|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Debug|x64.ActiveCfg = Debug|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Debug|x64.Build.0 = Debug|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Debug|x86.ActiveCfg = Debug|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Debug|x86.Build.0 = Debug|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Release|Any CPU.Build.0 = Release|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Release|x64.ActiveCfg = Release|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Release|x64.Build.0 = Release|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Release|x86.ActiveCfg = Release|Any CPU + {4F65AAE7-903C-4B7D-A5E6-D4C26C4B73C5}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F2E9A046-99DD-4D19-8E1A-9540F84D59AD} EndGlobalSection EndGlobal diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/api/Azure.ResourceManager.DevSpaces.netstandard2.0.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/api/Azure.ResourceManager.DevSpaces.netstandard2.0.cs index 1ecef1f126396..408f45c89d505 100644 --- a/sdk/devspaces/Azure.ResourceManager.DevSpaces/api/Azure.ResourceManager.DevSpaces.netstandard2.0.cs +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/api/Azure.ResourceManager.DevSpaces.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ControllerCollection() { } } public partial class ControllerData : Azure.ResourceManager.Models.TrackedResourceData { - public ControllerData(Azure.Core.AzureLocation location, Azure.ResourceManager.DevSpaces.Models.DevSpacesSku sku, string targetContainerHostResourceId, string targetContainerHostCredentialsBase64) : base (default(Azure.Core.AzureLocation)) { } + public ControllerData(Azure.Core.AzureLocation location, Azure.ResourceManager.DevSpaces.Models.DevSpacesSku sku, string targetContainerHostResourceId, string targetContainerHostCredentialsBase64) { } public string DataPlaneFqdn { get { throw null; } } public string HostSuffix { get { throw null; } } public Azure.ResourceManager.DevSpaces.Models.ProvisioningState? ProvisioningState { get { throw null; } } @@ -62,6 +62,29 @@ public static partial class DevSpacesExtensions public static Azure.AsyncPageable GetControllersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DevSpaces.Mocking +{ + public partial class MockableDevSpacesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDevSpacesArmClient() { } + public virtual Azure.ResourceManager.DevSpaces.ControllerResource GetControllerResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDevSpacesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDevSpacesResourceGroupResource() { } + public virtual Azure.Response GetContainerHostMappingContainerHostMapping(Azure.Core.AzureLocation location, Azure.ResourceManager.DevSpaces.Models.ContainerHostMapping containerHostMapping, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerHostMappingContainerHostMappingAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DevSpaces.Models.ContainerHostMapping containerHostMapping, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetController(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetControllerAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DevSpaces.ControllerCollection GetControllers() { throw null; } + } + public partial class MockableDevSpacesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDevSpacesSubscriptionResource() { } + public virtual Azure.Pageable GetControllers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetControllersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DevSpaces.Models { public static partial class ArmDevSpacesModelFactory diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/ControllerResource.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/ControllerResource.cs index d66f68f086479..9f3295d9c1044 100644 --- a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/ControllerResource.cs +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/ControllerResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DevSpaces public partial class ControllerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name}"; diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/DevSpacesExtensions.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/DevSpacesExtensions.cs index 9ecbb68929875..7c2d33b7c977b 100644 --- a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/DevSpacesExtensions.cs +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/DevSpacesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DevSpaces.Mocking; using Azure.ResourceManager.DevSpaces.Models; using Azure.ResourceManager.Resources; @@ -19,62 +20,49 @@ namespace Azure.ResourceManager.DevSpaces /// A class to add extension methods to Azure.ResourceManager.DevSpaces. public static partial class DevSpacesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDevSpacesArmClient GetMockableDevSpacesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDevSpacesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDevSpacesResourceGroupResource GetMockableDevSpacesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDevSpacesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDevSpacesSubscriptionResource GetMockableDevSpacesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDevSpacesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ControllerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ControllerResource GetControllerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ControllerResource.ValidateResourceId(id); - return new ControllerResource(client, id); - } - ); + return GetMockableDevSpacesArmClient(client).GetControllerResource(id); } - #endregion - /// Gets a collection of ControllerResources in the ResourceGroupResource. + /// + /// Gets a collection of ControllerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ControllerResources and their operations over a ControllerResource. public static ControllerCollection GetControllers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetControllers(); + return GetMockableDevSpacesResourceGroupResource(resourceGroupResource).GetControllers(); } /// @@ -89,16 +77,20 @@ public static ControllerCollection GetControllers(this ResourceGroupResource res /// Controllers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetControllerAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetControllers().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableDevSpacesResourceGroupResource(resourceGroupResource).GetControllerAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -113,16 +105,20 @@ public static async Task> GetControllerAsync(this R /// Controllers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetController(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetControllers().Get(name, cancellationToken); + return GetMockableDevSpacesResourceGroupResource(resourceGroupResource).GetController(name, cancellationToken); } /// @@ -137,6 +133,10 @@ public static Response GetController(this ResourceGroupResou /// ContainerHostMappings_GetContainerHostMapping /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the container host. @@ -145,9 +145,7 @@ public static Response GetController(this ResourceGroupResou /// is null. public static async Task> GetContainerHostMappingContainerHostMappingAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, ContainerHostMapping containerHostMapping, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(containerHostMapping, nameof(containerHostMapping)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerHostMappingContainerHostMappingAsync(location, containerHostMapping, cancellationToken).ConfigureAwait(false); + return await GetMockableDevSpacesResourceGroupResource(resourceGroupResource).GetContainerHostMappingContainerHostMappingAsync(location, containerHostMapping, cancellationToken).ConfigureAwait(false); } /// @@ -162,6 +160,10 @@ public static async Task> GetContainerHostMapping /// ContainerHostMappings_GetContainerHostMapping /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the container host. @@ -170,9 +172,7 @@ public static async Task> GetContainerHostMapping /// is null. public static Response GetContainerHostMappingContainerHostMapping(this ResourceGroupResource resourceGroupResource, AzureLocation location, ContainerHostMapping containerHostMapping, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(containerHostMapping, nameof(containerHostMapping)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerHostMappingContainerHostMapping(location, containerHostMapping, cancellationToken); + return GetMockableDevSpacesResourceGroupResource(resourceGroupResource).GetContainerHostMappingContainerHostMapping(location, containerHostMapping, cancellationToken); } /// @@ -187,13 +187,17 @@ public static Response GetContainerHostMappingContainerHos /// Controllers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetControllersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetControllersAsync(cancellationToken); + return GetMockableDevSpacesSubscriptionResource(subscriptionResource).GetControllersAsync(cancellationToken); } /// @@ -208,13 +212,17 @@ public static AsyncPageable GetControllersAsync(this Subscri /// Controllers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetControllers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetControllers(cancellationToken); + return GetMockableDevSpacesSubscriptionResource(subscriptionResource).GetControllers(cancellationToken); } } } diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesArmClient.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesArmClient.cs new file mode 100644 index 0000000000000..fb51ab26bafa2 --- /dev/null +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DevSpaces; + +namespace Azure.ResourceManager.DevSpaces.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDevSpacesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDevSpacesArmClient() + { + } + + /// 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 MockableDevSpacesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDevSpacesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ControllerResource GetControllerResource(ResourceIdentifier id) + { + ControllerResource.ValidateResourceId(id); + return new ControllerResource(Client, id); + } + } +} diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesResourceGroupResource.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesResourceGroupResource.cs new file mode 100644 index 0000000000000..bb040fb870d73 --- /dev/null +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesResourceGroupResource.cs @@ -0,0 +1,170 @@ +// 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; +using Azure.ResourceManager.DevSpaces; +using Azure.ResourceManager.DevSpaces.Models; + +namespace Azure.ResourceManager.DevSpaces.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDevSpacesResourceGroupResource : ArmResource + { + private ClientDiagnostics _containerHostMappingsClientDiagnostics; + private ContainerHostMappingsRestOperations _containerHostMappingsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDevSpacesResourceGroupResource() + { + } + + /// 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 MockableDevSpacesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ContainerHostMappingsClientDiagnostics => _containerHostMappingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevSpaces", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ContainerHostMappingsRestOperations ContainerHostMappingsRestClient => _containerHostMappingsRestClient ??= new ContainerHostMappingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ControllerResources in the ResourceGroupResource. + /// An object representing collection of ControllerResources and their operations over a ControllerResource. + public virtual ControllerCollection GetControllers() + { + return GetCachedClient(client => new ControllerCollection(client, Id)); + } + + /// + /// Gets the properties for an Azure Dev Spaces Controller. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name} + /// + /// + /// Operation Id + /// Controllers_Get + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetControllerAsync(string name, CancellationToken cancellationToken = default) + { + return await GetControllers().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties for an Azure Dev Spaces Controller. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/controllers/{name} + /// + /// + /// Operation Id + /// Controllers_Get + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetController(string name, CancellationToken cancellationToken = default) + { + return GetControllers().Get(name, cancellationToken); + } + + /// + /// Returns container host mapping object for a container host resource ID if an associated controller exists. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/locations/{location}/checkContainerHostMapping + /// + /// + /// Operation Id + /// ContainerHostMappings_GetContainerHostMapping + /// + /// + /// + /// Location of the container host. + /// The ContainerHostMapping to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetContainerHostMappingContainerHostMappingAsync(AzureLocation location, ContainerHostMapping containerHostMapping, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(containerHostMapping, nameof(containerHostMapping)); + + using var scope = ContainerHostMappingsClientDiagnostics.CreateScope("MockableDevSpacesResourceGroupResource.GetContainerHostMappingContainerHostMapping"); + scope.Start(); + try + { + var response = await ContainerHostMappingsRestClient.GetContainerHostMappingAsync(Id.SubscriptionId, Id.ResourceGroupName, location, containerHostMapping, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns container host mapping object for a container host resource ID if an associated controller exists. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/locations/{location}/checkContainerHostMapping + /// + /// + /// Operation Id + /// ContainerHostMappings_GetContainerHostMapping + /// + /// + /// + /// Location of the container host. + /// The ContainerHostMapping to use. + /// The cancellation token to use. + /// is null. + public virtual Response GetContainerHostMappingContainerHostMapping(AzureLocation location, ContainerHostMapping containerHostMapping, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(containerHostMapping, nameof(containerHostMapping)); + + using var scope = ContainerHostMappingsClientDiagnostics.CreateScope("MockableDevSpacesResourceGroupResource.GetContainerHostMappingContainerHostMapping"); + scope.Start(); + try + { + var response = ContainerHostMappingsRestClient.GetContainerHostMapping(Id.SubscriptionId, Id.ResourceGroupName, location, containerHostMapping, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesSubscriptionResource.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesSubscriptionResource.cs new file mode 100644 index 0000000000000..d5d3d69d54667 --- /dev/null +++ b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/MockableDevSpacesSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DevSpaces; + +namespace Azure.ResourceManager.DevSpaces.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDevSpacesSubscriptionResource : ArmResource + { + private ClientDiagnostics _controllerClientDiagnostics; + private ControllersRestOperations _controllerRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDevSpacesSubscriptionResource() + { + } + + /// 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 MockableDevSpacesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ControllerClientDiagnostics => _controllerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevSpaces", ControllerResource.ResourceType.Namespace, Diagnostics); + private ControllersRestOperations ControllerRestClient => _controllerRestClient ??= new ControllersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ControllerResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all the Azure Dev Spaces Controllers with their properties in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevSpaces/controllers + /// + /// + /// Operation Id + /// Controllers_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetControllersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ControllerRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ControllerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ControllerResource(Client, ControllerData.DeserializeControllerData(e)), ControllerClientDiagnostics, Pipeline, "MockableDevSpacesSubscriptionResource.GetControllers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the Azure Dev Spaces Controllers with their properties in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevSpaces/controllers + /// + /// + /// Operation Id + /// Controllers_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetControllers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ControllerRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ControllerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ControllerResource(Client, ControllerData.DeserializeControllerData(e)), ControllerClientDiagnostics, Pipeline, "MockableDevSpacesSubscriptionResource.GetControllers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index cc1f48334525f..0000000000000 --- a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,117 +0,0 @@ -// 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; -using Azure.ResourceManager.DevSpaces.Models; - -namespace Azure.ResourceManager.DevSpaces -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _containerHostMappingsClientDiagnostics; - private ContainerHostMappingsRestOperations _containerHostMappingsRestClient; - - /// 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 ClientDiagnostics ContainerHostMappingsClientDiagnostics => _containerHostMappingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevSpaces", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ContainerHostMappingsRestOperations ContainerHostMappingsRestClient => _containerHostMappingsRestClient ??= new ContainerHostMappingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ControllerResources in the ResourceGroupResource. - /// An object representing collection of ControllerResources and their operations over a ControllerResource. - public virtual ControllerCollection GetControllers() - { - return GetCachedClient(Client => new ControllerCollection(Client, Id)); - } - - /// - /// Returns container host mapping object for a container host resource ID if an associated controller exists. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/locations/{location}/checkContainerHostMapping - /// - /// - /// Operation Id - /// ContainerHostMappings_GetContainerHostMapping - /// - /// - /// - /// Location of the container host. - /// The ContainerHostMapping to use. - /// The cancellation token to use. - public virtual async Task> GetContainerHostMappingContainerHostMappingAsync(AzureLocation location, ContainerHostMapping containerHostMapping, CancellationToken cancellationToken = default) - { - using var scope = ContainerHostMappingsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetContainerHostMappingContainerHostMapping"); - scope.Start(); - try - { - var response = await ContainerHostMappingsRestClient.GetContainerHostMappingAsync(Id.SubscriptionId, Id.ResourceGroupName, location, containerHostMapping, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns container host mapping object for a container host resource ID if an associated controller exists. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevSpaces/locations/{location}/checkContainerHostMapping - /// - /// - /// Operation Id - /// ContainerHostMappings_GetContainerHostMapping - /// - /// - /// - /// Location of the container host. - /// The ContainerHostMapping to use. - /// The cancellation token to use. - public virtual Response GetContainerHostMappingContainerHostMapping(AzureLocation location, ContainerHostMapping containerHostMapping, CancellationToken cancellationToken = default) - { - using var scope = ContainerHostMappingsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetContainerHostMappingContainerHostMapping"); - scope.Start(); - try - { - var response = ContainerHostMappingsRestClient.GetContainerHostMapping(Id.SubscriptionId, Id.ResourceGroupName, location, containerHostMapping, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 487d2aad736a3..0000000000000 --- a/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DevSpaces -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _controllerClientDiagnostics; - private ControllersRestOperations _controllerRestClient; - - /// 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 ControllerClientDiagnostics => _controllerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevSpaces", ControllerResource.ResourceType.Namespace, Diagnostics); - private ControllersRestOperations ControllerRestClient => _controllerRestClient ??= new ControllersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ControllerResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all the Azure Dev Spaces Controllers with their properties in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevSpaces/controllers - /// - /// - /// Operation Id - /// Controllers_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetControllersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ControllerRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ControllerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ControllerResource(Client, ControllerData.DeserializeControllerData(e)), ControllerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetControllers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the Azure Dev Spaces Controllers with their properties in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevSpaces/controllers - /// - /// - /// Operation Id - /// Controllers_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetControllers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ControllerRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ControllerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ControllerResource(Client, ControllerData.DeserializeControllerData(e)), ControllerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetControllers", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.netstandard2.0.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.netstandard2.0.cs index b8f7f58429ee3..861c91ebe7237 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.netstandard2.0.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.netstandard2.0.cs @@ -17,7 +17,7 @@ protected DevTestLabArmTemplateCollection() { } } public partial class DevTestLabArmTemplateData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabArmTemplateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabArmTemplateData(Azure.Core.AzureLocation location) { } public System.BinaryData Contents { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } } @@ -54,7 +54,7 @@ protected DevTestLabArtifactCollection() { } } public partial class DevTestLabArtifactData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabArtifactData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabArtifactData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } } public string FilePath { get { throw null; } } @@ -95,7 +95,7 @@ protected DevTestLabArtifactSourceCollection() { } } public partial class DevTestLabArtifactSourceData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabArtifactSourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabArtifactSourceData(Azure.Core.AzureLocation location) { } public string ArmTemplateFolderPath { get { throw null; } set { } } public string BranchRef { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } @@ -165,7 +165,7 @@ protected DevTestLabCostCollection() { } } public partial class DevTestLabCostData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabCostData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabCostData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } set { } } public string CurrencyCode { get { throw null; } set { } } public System.DateTimeOffset? EndOn { get { throw null; } set { } } @@ -214,7 +214,7 @@ protected DevTestLabCustomImageCollection() { } } public partial class DevTestLabCustomImageData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabCustomImageData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabCustomImageData(Azure.Core.AzureLocation location) { } public string Author { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan CustomImagePlan { get { throw null; } set { } } @@ -250,7 +250,7 @@ protected DevTestLabCustomImageResource() { } } public partial class DevTestLabData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement Announcement { get { throw null; } set { } } public string ArtifactsStorageAccount { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } @@ -291,7 +291,7 @@ protected DevTestLabDiskCollection() { } } public partial class DevTestLabDiskData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabDiskData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabDiskData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string DiskBlobName { get { throw null; } set { } } public int? DiskSizeGiB { get { throw null; } set { } } @@ -347,7 +347,7 @@ protected DevTestLabEnvironmentCollection() { } } public partial class DevTestLabEnvironmentData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabEnvironmentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabEnvironmentData(Azure.Core.AzureLocation location) { } public string ArmTemplateDisplayName { get { throw null; } set { } } public string CreatedByUser { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment DeploymentProperties { get { throw null; } set { } } @@ -394,7 +394,7 @@ protected DevTestLabFormulaCollection() { } } public partial class DevTestLabFormulaData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabFormulaData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabFormulaData(Azure.Core.AzureLocation location) { } public string Author { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } set { } } @@ -484,7 +484,7 @@ protected DevTestLabNotificationChannelCollection() { } } public partial class DevTestLabNotificationChannelData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabNotificationChannelData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabNotificationChannelData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } set { } } public string EmailRecipient { get { throw null; } set { } } @@ -535,7 +535,7 @@ protected DevTestLabPolicyCollection() { } } public partial class DevTestLabPolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabPolicyData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabPolicyData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType? EvaluatorType { get { throw null; } set { } } @@ -656,7 +656,7 @@ protected DevTestLabScheduleCollection() { } } public partial class DevTestLabScheduleData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabScheduleData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabScheduleData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string DailyRecurrenceTime { get { throw null; } set { } } public int? HourlyRecurrenceMinute { get { throw null; } set { } } @@ -710,7 +710,7 @@ protected DevTestLabSecretCollection() { } } public partial class DevTestLabSecretData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabSecretData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabSecretData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } public string Value { get { throw null; } set { } } @@ -754,7 +754,7 @@ protected DevTestLabServiceFabricCollection() { } } public partial class DevTestLabServiceFabricData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabServiceFabricData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabServiceFabricData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule ApplicableSchedule { get { throw null; } } public string EnvironmentId { get { throw null; } set { } } public string ExternalServiceFabricId { get { throw null; } set { } } @@ -843,7 +843,7 @@ protected DevTestLabServiceRunnerCollection() { } } public partial class DevTestLabServiceRunnerData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabServiceRunnerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabServiceRunnerData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity Identity { get { throw null; } set { } } } public partial class DevTestLabServiceRunnerResource : Azure.ResourceManager.ArmResource @@ -919,7 +919,7 @@ protected DevTestLabUserCollection() { } } public partial class DevTestLabUserData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabUserData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabUserData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity Identity { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } @@ -977,7 +977,7 @@ protected DevTestLabVirtualNetworkCollection() { } } public partial class DevTestLabVirtualNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabVirtualNetworkData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabVirtualNetworkData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AllowedSubnets { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } set { } } @@ -1026,7 +1026,7 @@ protected DevTestLabVmCollection() { } } public partial class DevTestLabVmData : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabVmData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabVmData(Azure.Core.AzureLocation location) { } public bool? AllowClaim { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule ApplicableSchedule { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus ArtifactDeploymentStatus { get { throw null; } } @@ -1152,6 +1152,52 @@ protected DevTestLabVmScheduleResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DevTestLabs.Mocking +{ + public partial class MockableDevTestLabsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDevTestLabsArmClient() { } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabArmTemplateResource GetDevTestLabArmTemplateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabArtifactResource GetDevTestLabArtifactResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceResource GetDevTestLabArtifactSourceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabCostResource GetDevTestLabCostResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageResource GetDevTestLabCustomImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabDiskResource GetDevTestLabDiskResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentResource GetDevTestLabEnvironmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabFormulaResource GetDevTestLabFormulaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabGlobalScheduleResource GetDevTestLabGlobalScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelResource GetDevTestLabNotificationChannelResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabPolicyResource GetDevTestLabPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabResource GetDevTestLabResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabScheduleResource GetDevTestLabScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabSecretResource GetDevTestLabSecretResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricResource GetDevTestLabServiceFabricResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricScheduleResource GetDevTestLabServiceFabricScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerResource GetDevTestLabServiceRunnerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabUserResource GetDevTestLabUserResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkResource GetDevTestLabVirtualNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVmResource GetDevTestLabVmResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVmScheduleResource GetDevTestLabVmScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDevTestLabsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDevTestLabsResourceGroupResource() { } + public virtual Azure.Response GetDevTestLab(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDevTestLabAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDevTestLabGlobalSchedule(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDevTestLabGlobalScheduleAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules() { throw null; } + public virtual Azure.ResourceManager.DevTestLabs.DevTestLabCollection GetDevTestLabs() { throw null; } + } + public partial class MockableDevTestLabsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDevTestLabsSubscriptionResource() { } + public virtual Azure.Pageable GetDevTestLabGlobalSchedules(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevTestLabGlobalSchedulesAsync(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDevTestLabs(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevTestLabsAsync(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DevTestLabs.Models { public static partial class ArmDevTestLabsModelFactory @@ -1239,7 +1285,7 @@ public DevTestLabAnnouncement() { } } public partial class DevTestLabApplicableSchedule : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabApplicableSchedule(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabApplicableSchedule(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData LabVmsShutdown { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData LabVmsStartup { get { throw null; } set { } } } @@ -1515,7 +1561,7 @@ public DevTestLabFormulaPatch() { } } public partial class DevTestLabGalleryImage : Azure.ResourceManager.Models.TrackedResourceData { - public DevTestLabGalleryImage(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DevTestLabGalleryImage(Azure.Core.AzureLocation location) { } public string Author { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string Description { get { throw null; } set { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.cs index a5ac7da3eab9a..c80baded4fd19 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabArmTemplateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The artifactSourceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.cs index 667e20fe50377..1a367efce0ee9 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabArtifactResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The artifactSourceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs index 4f9320fdb56b3..342f48d3c28a3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabArtifactSourceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DevTestLabArmTemplateResources and their operations over a DevTestLabArmTemplateResource. public virtual DevTestLabArmTemplateCollection GetDevTestLabArmTemplates() { - return GetCachedClient(Client => new DevTestLabArmTemplateCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabArmTemplateCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual DevTestLabArmTemplateCollection GetDevTestLabArmTemplates() /// The name of the azure resource manager template. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabArmTemplateAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +139,8 @@ public virtual async Task> GetDevTestLab /// The name of the azure resource manager template. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabArmTemplate(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -147,7 +151,7 @@ public virtual Response GetDevTestLabArmTemplate( /// An object representing collection of DevTestLabArtifactResources and their operations over a DevTestLabArtifactResource. public virtual DevTestLabArtifactCollection GetDevTestLabArtifacts() { - return GetCachedClient(Client => new DevTestLabArtifactCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabArtifactCollection(client, Id)); } /// @@ -166,8 +170,8 @@ public virtual DevTestLabArtifactCollection GetDevTestLabArtifacts() /// The name of the artifact. /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabArtifactAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -190,8 +194,8 @@ public virtual async Task> GetDevTestLabArt /// The name of the artifact. /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabArtifact(string name, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.cs index b52178a7d4a77..b8d42b3f77194 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabCostResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.cs index c08f2db651aa4..4c95087d4fb8d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabCustomImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.cs index 2a9352d7802f8..54a2f96670915 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabDiskResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The userName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.cs index b7c8942be12a7..1ac5abfeb3034 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabEnvironmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The userName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.cs index eaf9a1ef7fa5c..ae805029bdeac 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabFormulaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.cs index a9b65f7ab2fa6..c0a5a32fb105e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabGlobalScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.cs index dd4dc94d23d47..30b8e09ad84a2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabNotificationChannelResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.cs index c1aedb6dfb5b5..cff2ecbd82a65 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The policySetName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs index f24fee4f6b0c5..691fa38c27d49 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs @@ -31,6 +31,9 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"; @@ -104,7 +107,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DevTestLabScheduleResources and their operations over a DevTestLabScheduleResource. public virtual DevTestLabScheduleCollection GetDevTestLabSchedules() { - return GetCachedClient(Client => new DevTestLabScheduleCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabScheduleCollection(client, Id)); } /// @@ -123,8 +126,8 @@ public virtual DevTestLabScheduleCollection GetDevTestLabSchedules() /// The name of the schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabScheduleAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -147,8 +150,8 @@ public virtual async Task> GetDevTestLabSch /// The name of the schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabSchedule(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -159,7 +162,7 @@ public virtual Response GetDevTestLabSchedule(string /// An object representing collection of DevTestLabArtifactSourceResources and their operations over a DevTestLabArtifactSourceResource. public virtual DevTestLabArtifactSourceCollection GetDevTestLabArtifactSources() { - return GetCachedClient(Client => new DevTestLabArtifactSourceCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabArtifactSourceCollection(client, Id)); } /// @@ -178,8 +181,8 @@ public virtual DevTestLabArtifactSourceCollection GetDevTestLabArtifactSources() /// The name of the artifact source. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabArtifactSourceAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -202,8 +205,8 @@ public virtual async Task> GetDevTest /// The name of the artifact source. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabArtifactSource(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -214,7 +217,7 @@ public virtual Response GetDevTestLabArtifactS /// An object representing collection of DevTestLabCostResources and their operations over a DevTestLabCostResource. public virtual DevTestLabCostCollection GetDevTestLabCosts() { - return GetCachedClient(Client => new DevTestLabCostCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabCostCollection(client, Id)); } /// @@ -233,8 +236,8 @@ public virtual DevTestLabCostCollection GetDevTestLabCosts() /// The name of the cost. /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabCostAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -257,8 +260,8 @@ public virtual async Task> GetDevTestLabCostAsy /// The name of the cost. /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabCost(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -269,7 +272,7 @@ public virtual Response GetDevTestLabCost(string name, s /// An object representing collection of DevTestLabCustomImageResources and their operations over a DevTestLabCustomImageResource. public virtual DevTestLabCustomImageCollection GetDevTestLabCustomImages() { - return GetCachedClient(Client => new DevTestLabCustomImageCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabCustomImageCollection(client, Id)); } /// @@ -288,8 +291,8 @@ public virtual DevTestLabCustomImageCollection GetDevTestLabCustomImages() /// The name of the custom image. /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabCustomImageAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -312,8 +315,8 @@ public virtual async Task> GetDevTestLab /// The name of the custom image. /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabCustomImage(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -324,7 +327,7 @@ public virtual Response GetDevTestLabCustomImage( /// An object representing collection of DevTestLabFormulaResources and their operations over a DevTestLabFormulaResource. public virtual DevTestLabFormulaCollection GetDevTestLabFormulas() { - return GetCachedClient(Client => new DevTestLabFormulaCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabFormulaCollection(client, Id)); } /// @@ -343,8 +346,8 @@ public virtual DevTestLabFormulaCollection GetDevTestLabFormulas() /// The name of the formula. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabFormulaAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -367,8 +370,8 @@ public virtual async Task> GetDevTestLabForm /// The name of the formula. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabFormula(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -379,7 +382,7 @@ public virtual Response GetDevTestLabFormula(string n /// An object representing collection of DevTestLabNotificationChannelResources and their operations over a DevTestLabNotificationChannelResource. public virtual DevTestLabNotificationChannelCollection GetDevTestLabNotificationChannels() { - return GetCachedClient(Client => new DevTestLabNotificationChannelCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabNotificationChannelCollection(client, Id)); } /// @@ -398,8 +401,8 @@ public virtual DevTestLabNotificationChannelCollection GetDevTestLabNotification /// The name of the notification channel. /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabNotificationChannelAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -422,8 +425,8 @@ public virtual async Task> GetDe /// The name of the notification channel. /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabNotificationChannel(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -432,13 +435,11 @@ public virtual Response GetDevTestLabNoti /// Gets a collection of DevTestLabPolicyResources in the DevTestLab. /// The name of the policy set. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of DevTestLabPolicyResources and their operations over a DevTestLabPolicyResource. public virtual DevTestLabPolicyCollection GetDevTestLabPolicies(string policySetName) { - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - return new DevTestLabPolicyCollection(Client, Id, policySetName); } @@ -459,8 +460,8 @@ public virtual DevTestLabPolicyCollection GetDevTestLabPolicies(string policySet /// The name of the policy. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabPolicyAsync(string policySetName, string name, string expand = null, CancellationToken cancellationToken = default) { @@ -484,8 +485,8 @@ public virtual async Task> GetDevTestLabPolic /// The name of the policy. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabPolicy(string policySetName, string name, string expand = null, CancellationToken cancellationToken = default) { @@ -496,7 +497,7 @@ public virtual Response GetDevTestLabPolicy(string pol /// An object representing collection of DevTestLabServiceRunnerResources and their operations over a DevTestLabServiceRunnerResource. public virtual DevTestLabServiceRunnerCollection GetDevTestLabServiceRunners() { - return GetCachedClient(Client => new DevTestLabServiceRunnerCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabServiceRunnerCollection(client, Id)); } /// @@ -514,8 +515,8 @@ public virtual DevTestLabServiceRunnerCollection GetDevTestLabServiceRunners() /// /// The name of the service runner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabServiceRunnerAsync(string name, CancellationToken cancellationToken = default) { @@ -537,8 +538,8 @@ public virtual async Task> GetDevTestL /// /// The name of the service runner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabServiceRunner(string name, CancellationToken cancellationToken = default) { @@ -549,7 +550,7 @@ public virtual Response GetDevTestLabServiceRun /// An object representing collection of DevTestLabUserResources and their operations over a DevTestLabUserResource. public virtual DevTestLabUserCollection GetDevTestLabUsers() { - return GetCachedClient(Client => new DevTestLabUserCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabUserCollection(client, Id)); } /// @@ -568,8 +569,8 @@ public virtual DevTestLabUserCollection GetDevTestLabUsers() /// The name of the user profile. /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabUserAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -592,8 +593,8 @@ public virtual async Task> GetDevTestLabUserAsy /// The name of the user profile. /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabUser(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -604,7 +605,7 @@ public virtual Response GetDevTestLabUser(string name, s /// An object representing collection of DevTestLabVmResources and their operations over a DevTestLabVmResource. public virtual DevTestLabVmCollection GetDevTestLabVms() { - return GetCachedClient(Client => new DevTestLabVmCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabVmCollection(client, Id)); } /// @@ -623,8 +624,8 @@ public virtual DevTestLabVmCollection GetDevTestLabVms() /// The name of the virtual machine. /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabVmAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -647,8 +648,8 @@ public virtual async Task> GetDevTestLabVmAsync(s /// The name of the virtual machine. /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabVm(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -659,7 +660,7 @@ public virtual Response GetDevTestLabVm(string name, strin /// An object representing collection of DevTestLabVirtualNetworkResources and their operations over a DevTestLabVirtualNetworkResource. public virtual DevTestLabVirtualNetworkCollection GetDevTestLabVirtualNetworks() { - return GetCachedClient(Client => new DevTestLabVirtualNetworkCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabVirtualNetworkCollection(client, Id)); } /// @@ -678,8 +679,8 @@ public virtual DevTestLabVirtualNetworkCollection GetDevTestLabVirtualNetworks() /// The name of the virtual network. /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabVirtualNetworkAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -702,8 +703,8 @@ public virtual async Task> GetDevTest /// The name of the virtual network. /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabVirtualNetwork(string name, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.cs index 6133e105c3ec3..90f2fcbe5c1ba 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.cs index 089cecbc0328e..c484c4adaab10 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabSecretResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The userName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs index 1a46550c5bb25..a0bf66b91f553 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabServiceFabricResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The userName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"; @@ -92,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DevTestLabServiceFabricScheduleResources and their operations over a DevTestLabServiceFabricScheduleResource. public virtual DevTestLabServiceFabricScheduleCollection GetDevTestLabServiceFabricSchedules() { - return GetCachedClient(Client => new DevTestLabServiceFabricScheduleCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabServiceFabricScheduleCollection(client, Id)); } /// @@ -111,8 +116,8 @@ public virtual DevTestLabServiceFabricScheduleCollection GetDevTestLabServiceFab /// The name of the schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabServiceFabricScheduleAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +140,8 @@ public virtual async Task> Get /// The name of the schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabServiceFabricSchedule(string name, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.cs index 1848ae34913ca..1ce82e3c7afac 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabServiceFabricScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The userName. + /// The serviceFabricName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.cs index 563fb3ace3b52..dec0de131f2d7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabServiceRunnerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs index ffa5fdffee212..442926644cd38 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabUserResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DevTestLabDiskResources and their operations over a DevTestLabDiskResource. public virtual DevTestLabDiskCollection GetDevTestLabDisks() { - return GetCachedClient(Client => new DevTestLabDiskCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabDiskCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual DevTestLabDiskCollection GetDevTestLabDisks() /// The name of the disk. /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabDiskAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +139,8 @@ public virtual async Task> GetDevTestLabDiskAsy /// The name of the disk. /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabDisk(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -147,7 +151,7 @@ public virtual Response GetDevTestLabDisk(string name, s /// An object representing collection of DevTestLabEnvironmentResources and their operations over a DevTestLabEnvironmentResource. public virtual DevTestLabEnvironmentCollection GetDevTestLabEnvironments() { - return GetCachedClient(Client => new DevTestLabEnvironmentCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabEnvironmentCollection(client, Id)); } /// @@ -166,8 +170,8 @@ public virtual DevTestLabEnvironmentCollection GetDevTestLabEnvironments() /// The name of the environment. /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabEnvironmentAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -190,8 +194,8 @@ public virtual async Task> GetDevTestLab /// The name of the environment. /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabEnvironment(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -202,7 +206,7 @@ public virtual Response GetDevTestLabEnvironment( /// An object representing collection of DevTestLabSecretResources and their operations over a DevTestLabSecretResource. public virtual DevTestLabSecretCollection GetDevTestLabSecrets() { - return GetCachedClient(Client => new DevTestLabSecretCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabSecretCollection(client, Id)); } /// @@ -221,8 +225,8 @@ public virtual DevTestLabSecretCollection GetDevTestLabSecrets() /// The name of the secret. /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabSecretAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -245,8 +249,8 @@ public virtual async Task> GetDevTestLabSecre /// The name of the secret. /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabSecret(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -257,7 +261,7 @@ public virtual Response GetDevTestLabSecret(string nam /// An object representing collection of DevTestLabServiceFabricResources and their operations over a DevTestLabServiceFabricResource. public virtual DevTestLabServiceFabricCollection GetDevTestLabServiceFabrics() { - return GetCachedClient(Client => new DevTestLabServiceFabricCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabServiceFabricCollection(client, Id)); } /// @@ -276,8 +280,8 @@ public virtual DevTestLabServiceFabricCollection GetDevTestLabServiceFabrics() /// The name of the service fabric. /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabServiceFabricAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -300,8 +304,8 @@ public virtual async Task> GetDevTestL /// The name of the service fabric. /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabServiceFabric(string name, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.cs index 7ce22193a81d8..7884b6342f256 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabVirtualNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs index 972b43eff03fb..0876b60116737 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabVmResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DevTestLabVmScheduleResources and their operations over a DevTestLabVmScheduleResource. public virtual DevTestLabVmScheduleCollection GetDevTestLabVmSchedules() { - return GetCachedClient(Client => new DevTestLabVmScheduleCollection(Client, Id)); + return GetCachedClient(client => new DevTestLabVmScheduleCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual DevTestLabVmScheduleCollection GetDevTestLabVmSchedules() /// The name of the schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDevTestLabVmScheduleAsync(string name, string expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +139,8 @@ public virtual async Task> GetDevTestLabV /// The name of the schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDevTestLabVmSchedule(string name, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.cs index b6aae7359a055..8d97e0e61ae3b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.DevTestLabs public partial class DevTestLabVmScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The vmName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string vmName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{vmName}/schedules/{name}"; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.cs index 8f3189b14004c..3da61568c9ea0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DevTestLabs.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs @@ -18,442 +19,369 @@ namespace Azure.ResourceManager.DevTestLabs /// A class to add extension methods to Azure.ResourceManager.DevTestLabs. public static partial class DevTestLabsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDevTestLabsArmClient GetMockableDevTestLabsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDevTestLabsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDevTestLabsResourceGroupResource GetMockableDevTestLabsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDevTestLabsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDevTestLabsSubscriptionResource GetMockableDevTestLabsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDevTestLabsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DevTestLabResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabResource GetDevTestLabResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabResource.ValidateResourceId(id); - return new DevTestLabResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabResource(id); } - #endregion - #region DevTestLabGlobalScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabGlobalScheduleResource GetDevTestLabGlobalScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabGlobalScheduleResource.ValidateResourceId(id); - return new DevTestLabGlobalScheduleResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabGlobalScheduleResource(id); } - #endregion - #region DevTestLabScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabScheduleResource GetDevTestLabScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabScheduleResource.ValidateResourceId(id); - return new DevTestLabScheduleResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabScheduleResource(id); } - #endregion - #region DevTestLabServiceFabricScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabServiceFabricScheduleResource GetDevTestLabServiceFabricScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabServiceFabricScheduleResource.ValidateResourceId(id); - return new DevTestLabServiceFabricScheduleResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabServiceFabricScheduleResource(id); } - #endregion - #region DevTestLabVmScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabVmScheduleResource GetDevTestLabVmScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabVmScheduleResource.ValidateResourceId(id); - return new DevTestLabVmScheduleResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabVmScheduleResource(id); } - #endregion - #region DevTestLabArtifactSourceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabArtifactSourceResource GetDevTestLabArtifactSourceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabArtifactSourceResource.ValidateResourceId(id); - return new DevTestLabArtifactSourceResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabArtifactSourceResource(id); } - #endregion - #region DevTestLabArmTemplateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabArmTemplateResource GetDevTestLabArmTemplateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabArmTemplateResource.ValidateResourceId(id); - return new DevTestLabArmTemplateResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabArmTemplateResource(id); } - #endregion - #region DevTestLabArtifactResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabArtifactResource GetDevTestLabArtifactResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabArtifactResource.ValidateResourceId(id); - return new DevTestLabArtifactResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabArtifactResource(id); } - #endregion - #region DevTestLabCostResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabCostResource GetDevTestLabCostResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabCostResource.ValidateResourceId(id); - return new DevTestLabCostResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabCostResource(id); } - #endregion - #region DevTestLabCustomImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabCustomImageResource GetDevTestLabCustomImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabCustomImageResource.ValidateResourceId(id); - return new DevTestLabCustomImageResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabCustomImageResource(id); } - #endregion - #region DevTestLabFormulaResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabFormulaResource GetDevTestLabFormulaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabFormulaResource.ValidateResourceId(id); - return new DevTestLabFormulaResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabFormulaResource(id); } - #endregion - #region DevTestLabNotificationChannelResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabNotificationChannelResource GetDevTestLabNotificationChannelResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabNotificationChannelResource.ValidateResourceId(id); - return new DevTestLabNotificationChannelResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabNotificationChannelResource(id); } - #endregion - #region DevTestLabPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabPolicyResource GetDevTestLabPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabPolicyResource.ValidateResourceId(id); - return new DevTestLabPolicyResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabPolicyResource(id); } - #endregion - #region DevTestLabServiceRunnerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabServiceRunnerResource GetDevTestLabServiceRunnerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabServiceRunnerResource.ValidateResourceId(id); - return new DevTestLabServiceRunnerResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabServiceRunnerResource(id); } - #endregion - #region DevTestLabUserResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabUserResource GetDevTestLabUserResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabUserResource.ValidateResourceId(id); - return new DevTestLabUserResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabUserResource(id); } - #endregion - #region DevTestLabDiskResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabDiskResource GetDevTestLabDiskResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabDiskResource.ValidateResourceId(id); - return new DevTestLabDiskResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabDiskResource(id); } - #endregion - #region DevTestLabEnvironmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabEnvironmentResource GetDevTestLabEnvironmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabEnvironmentResource.ValidateResourceId(id); - return new DevTestLabEnvironmentResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabEnvironmentResource(id); } - #endregion - #region DevTestLabSecretResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabSecretResource GetDevTestLabSecretResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabSecretResource.ValidateResourceId(id); - return new DevTestLabSecretResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabSecretResource(id); } - #endregion - #region DevTestLabServiceFabricResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabServiceFabricResource GetDevTestLabServiceFabricResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabServiceFabricResource.ValidateResourceId(id); - return new DevTestLabServiceFabricResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabServiceFabricResource(id); } - #endregion - #region DevTestLabVmResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabVmResource GetDevTestLabVmResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabVmResource.ValidateResourceId(id); - return new DevTestLabVmResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabVmResource(id); } - #endregion - #region DevTestLabVirtualNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DevTestLabVirtualNetworkResource GetDevTestLabVirtualNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DevTestLabVirtualNetworkResource.ValidateResourceId(id); - return new DevTestLabVirtualNetworkResource(client, id); - } - ); + return GetMockableDevTestLabsArmClient(client).GetDevTestLabVirtualNetworkResource(id); } - #endregion - /// Gets a collection of DevTestLabResources in the ResourceGroupResource. + /// + /// Gets a collection of DevTestLabResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DevTestLabResources and their operations over a DevTestLabResource. public static DevTestLabCollection GetDevTestLabs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDevTestLabs(); + return GetMockableDevTestLabsResourceGroupResource(resourceGroupResource).GetDevTestLabs(); } /// @@ -468,17 +396,21 @@ public static DevTestLabCollection GetDevTestLabs(this ResourceGroupResource res /// Labs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDevTestLabAsync(this ResourceGroupResource resourceGroupResource, string name, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDevTestLabs().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableDevTestLabsResourceGroupResource(resourceGroupResource).GetDevTestLabAsync(name, expand, cancellationToken).ConfigureAwait(false); } /// @@ -493,25 +425,35 @@ public static async Task> GetDevTestLabAsync(this R /// Labs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDevTestLab(this ResourceGroupResource resourceGroupResource, string name, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDevTestLabs().Get(name, expand, cancellationToken); + return GetMockableDevTestLabsResourceGroupResource(resourceGroupResource).GetDevTestLab(name, expand, cancellationToken); } - /// Gets a collection of DevTestLabGlobalScheduleResources in the ResourceGroupResource. + /// + /// Gets a collection of DevTestLabGlobalScheduleResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DevTestLabGlobalScheduleResources and their operations over a DevTestLabGlobalScheduleResource. public static DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDevTestLabGlobalSchedules(); + return GetMockableDevTestLabsResourceGroupResource(resourceGroupResource).GetDevTestLabGlobalSchedules(); } /// @@ -526,17 +468,21 @@ public static DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules(th /// GlobalSchedules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDevTestLabGlobalScheduleAsync(this ResourceGroupResource resourceGroupResource, string name, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDevTestLabGlobalSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableDevTestLabsResourceGroupResource(resourceGroupResource).GetDevTestLabGlobalScheduleAsync(name, expand, cancellationToken).ConfigureAwait(false); } /// @@ -551,17 +497,21 @@ public static async Task> GetDevTestL /// GlobalSchedules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDevTestLabGlobalSchedule(this ResourceGroupResource resourceGroupResource, string name, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDevTestLabGlobalSchedules().Get(name, expand, cancellationToken); + return GetMockableDevTestLabsResourceGroupResource(resourceGroupResource).GetDevTestLabGlobalSchedule(name, expand, cancellationToken); } /// @@ -576,6 +526,10 @@ public static Response GetDevTestLabGlobalSche /// Labs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. @@ -586,7 +540,7 @@ public static Response GetDevTestLabGlobalSche /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDevTestLabsAsync(this SubscriptionResource subscriptionResource, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevTestLabsAsync(expand, filter, top, orderby, cancellationToken); + return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabsAsync(expand, filter, top, orderby, cancellationToken); } /// @@ -601,6 +555,10 @@ public static AsyncPageable GetDevTestLabsAsync(this Subscri /// Labs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. @@ -611,7 +569,7 @@ public static AsyncPageable GetDevTestLabsAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDevTestLabs(this SubscriptionResource subscriptionResource, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevTestLabs(expand, filter, top, orderby, cancellationToken); + return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabs(expand, filter, top, orderby, cancellationToken); } /// @@ -626,6 +584,10 @@ public static Pageable GetDevTestLabs(this SubscriptionResou /// GlobalSchedules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify the $expand query. Example: 'properties($select=status)'. @@ -636,7 +598,7 @@ public static Pageable GetDevTestLabs(this SubscriptionResou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDevTestLabGlobalSchedulesAsync(this SubscriptionResource subscriptionResource, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevTestLabGlobalSchedulesAsync(expand, filter, top, orderby, cancellationToken); + return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabGlobalSchedulesAsync(expand, filter, top, orderby, cancellationToken); } /// @@ -651,6 +613,10 @@ public static AsyncPageable GetDevTestLabGloba /// GlobalSchedules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify the $expand query. Example: 'properties($select=status)'. @@ -661,7 +627,7 @@ public static AsyncPageable GetDevTestLabGloba /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDevTestLabGlobalSchedules(this SubscriptionResource subscriptionResource, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDevTestLabGlobalSchedules(expand, filter, top, orderby, cancellationToken); + return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabGlobalSchedules(expand, filter, top, orderby, cancellationToken); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsArmClient.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsArmClient.cs new file mode 100644 index 0000000000000..79d39f50b6873 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsArmClient.cs @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDevTestLabsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDevTestLabsArmClient() + { + } + + /// 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 MockableDevTestLabsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDevTestLabsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabResource GetDevTestLabResource(ResourceIdentifier id) + { + DevTestLabResource.ValidateResourceId(id); + return new DevTestLabResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabGlobalScheduleResource GetDevTestLabGlobalScheduleResource(ResourceIdentifier id) + { + DevTestLabGlobalScheduleResource.ValidateResourceId(id); + return new DevTestLabGlobalScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabScheduleResource GetDevTestLabScheduleResource(ResourceIdentifier id) + { + DevTestLabScheduleResource.ValidateResourceId(id); + return new DevTestLabScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabServiceFabricScheduleResource GetDevTestLabServiceFabricScheduleResource(ResourceIdentifier id) + { + DevTestLabServiceFabricScheduleResource.ValidateResourceId(id); + return new DevTestLabServiceFabricScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabVmScheduleResource GetDevTestLabVmScheduleResource(ResourceIdentifier id) + { + DevTestLabVmScheduleResource.ValidateResourceId(id); + return new DevTestLabVmScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabArtifactSourceResource GetDevTestLabArtifactSourceResource(ResourceIdentifier id) + { + DevTestLabArtifactSourceResource.ValidateResourceId(id); + return new DevTestLabArtifactSourceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabArmTemplateResource GetDevTestLabArmTemplateResource(ResourceIdentifier id) + { + DevTestLabArmTemplateResource.ValidateResourceId(id); + return new DevTestLabArmTemplateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabArtifactResource GetDevTestLabArtifactResource(ResourceIdentifier id) + { + DevTestLabArtifactResource.ValidateResourceId(id); + return new DevTestLabArtifactResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabCostResource GetDevTestLabCostResource(ResourceIdentifier id) + { + DevTestLabCostResource.ValidateResourceId(id); + return new DevTestLabCostResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabCustomImageResource GetDevTestLabCustomImageResource(ResourceIdentifier id) + { + DevTestLabCustomImageResource.ValidateResourceId(id); + return new DevTestLabCustomImageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabFormulaResource GetDevTestLabFormulaResource(ResourceIdentifier id) + { + DevTestLabFormulaResource.ValidateResourceId(id); + return new DevTestLabFormulaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabNotificationChannelResource GetDevTestLabNotificationChannelResource(ResourceIdentifier id) + { + DevTestLabNotificationChannelResource.ValidateResourceId(id); + return new DevTestLabNotificationChannelResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabPolicyResource GetDevTestLabPolicyResource(ResourceIdentifier id) + { + DevTestLabPolicyResource.ValidateResourceId(id); + return new DevTestLabPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabServiceRunnerResource GetDevTestLabServiceRunnerResource(ResourceIdentifier id) + { + DevTestLabServiceRunnerResource.ValidateResourceId(id); + return new DevTestLabServiceRunnerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabUserResource GetDevTestLabUserResource(ResourceIdentifier id) + { + DevTestLabUserResource.ValidateResourceId(id); + return new DevTestLabUserResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabDiskResource GetDevTestLabDiskResource(ResourceIdentifier id) + { + DevTestLabDiskResource.ValidateResourceId(id); + return new DevTestLabDiskResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabEnvironmentResource GetDevTestLabEnvironmentResource(ResourceIdentifier id) + { + DevTestLabEnvironmentResource.ValidateResourceId(id); + return new DevTestLabEnvironmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabSecretResource GetDevTestLabSecretResource(ResourceIdentifier id) + { + DevTestLabSecretResource.ValidateResourceId(id); + return new DevTestLabSecretResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabServiceFabricResource GetDevTestLabServiceFabricResource(ResourceIdentifier id) + { + DevTestLabServiceFabricResource.ValidateResourceId(id); + return new DevTestLabServiceFabricResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabVmResource GetDevTestLabVmResource(ResourceIdentifier id) + { + DevTestLabVmResource.ValidateResourceId(id); + return new DevTestLabVmResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DevTestLabVirtualNetworkResource GetDevTestLabVirtualNetworkResource(ResourceIdentifier id) + { + DevTestLabVirtualNetworkResource.ValidateResourceId(id); + return new DevTestLabVirtualNetworkResource(Client, id); + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsResourceGroupResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsResourceGroupResource.cs new file mode 100644 index 0000000000000..f508ac9a6d5a8 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsResourceGroupResource.cs @@ -0,0 +1,149 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDevTestLabsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDevTestLabsResourceGroupResource() + { + } + + /// 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 MockableDevTestLabsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DevTestLabResources in the ResourceGroupResource. + /// An object representing collection of DevTestLabResources and their operations over a DevTestLabResource. + public virtual DevTestLabCollection GetDevTestLabs() + { + return GetCachedClient(client => new DevTestLabCollection(client, Id)); + } + + /// + /// Get lab. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} + /// + /// + /// Operation Id + /// Labs_Get + /// + /// + /// + /// The name of the lab. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabAsync(string name, string expand = null, CancellationToken cancellationToken = default) + { + return await GetDevTestLabs().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get lab. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} + /// + /// + /// Operation Id + /// Labs_Get + /// + /// + /// + /// The name of the lab. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLab(string name, string expand = null, CancellationToken cancellationToken = default) + { + return GetDevTestLabs().Get(name, expand, cancellationToken); + } + + /// Gets a collection of DevTestLabGlobalScheduleResources in the ResourceGroupResource. + /// An object representing collection of DevTestLabGlobalScheduleResources and their operations over a DevTestLabGlobalScheduleResource. + public virtual DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules() + { + return GetCachedClient(client => new DevTestLabGlobalScheduleCollection(client, Id)); + } + + /// + /// Get schedule. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// + /// + /// Operation Id + /// GlobalSchedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabGlobalScheduleAsync(string name, string expand = null, CancellationToken cancellationToken = default) + { + return await GetDevTestLabGlobalSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get schedule. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// + /// + /// Operation Id + /// GlobalSchedules_Get + /// + /// + /// + /// The name of the schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabGlobalSchedule(string name, string expand = null, CancellationToken cancellationToken = default) + { + return GetDevTestLabGlobalSchedules().Get(name, expand, cancellationToken); + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsSubscriptionResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsSubscriptionResource.cs new file mode 100644 index 0000000000000..b6d3ea65643b5 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsSubscriptionResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDevTestLabsSubscriptionResource : ArmResource + { + private ClientDiagnostics _devTestLabLabsClientDiagnostics; + private LabsRestOperations _devTestLabLabsRestClient; + private ClientDiagnostics _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics; + private GlobalSchedulesRestOperations _devTestLabGlobalScheduleGlobalSchedulesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDevTestLabsSubscriptionResource() + { + } + + /// 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 MockableDevTestLabsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DevTestLabLabsClientDiagnostics => _devTestLabLabsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabResource.ResourceType.Namespace, Diagnostics); + private LabsRestOperations DevTestLabLabsRestClient => _devTestLabLabsRestClient ??= new LabsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevTestLabResource.ResourceType)); + private ClientDiagnostics DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics => _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabGlobalScheduleResource.ResourceType.Namespace, Diagnostics); + private GlobalSchedulesRestOperations DevTestLabGlobalScheduleGlobalSchedulesRestClient => _devTestLabGlobalScheduleGlobalSchedulesRestClient ??= new GlobalSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevTestLabGlobalScheduleResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List labs in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs + /// + /// + /// Operation Id + /// Labs_ListBySubscription + /// + /// + /// + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevTestLabsAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabLabsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabLabsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabResource(Client, DevTestLabData.DeserializeDevTestLabData(e)), DevTestLabLabsClientDiagnostics, Pipeline, "MockableDevTestLabsSubscriptionResource.GetDevTestLabs", "value", "nextLink", cancellationToken); + } + + /// + /// List labs in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs + /// + /// + /// Operation Id + /// Labs_ListBySubscription + /// + /// + /// + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDevTestLabs(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabLabsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabLabsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabResource(Client, DevTestLabData.DeserializeDevTestLabData(e)), DevTestLabLabsClientDiagnostics, Pipeline, "MockableDevTestLabsSubscriptionResource.GetDevTestLabs", "value", "nextLink", cancellationToken); + } + + /// + /// List schedules in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules + /// + /// + /// Operation Id + /// GlobalSchedules_ListBySubscription + /// + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevTestLabGlobalSchedulesAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabGlobalScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, "MockableDevTestLabsSubscriptionResource.GetDevTestLabGlobalSchedules", "value", "nextLink", cancellationToken); + } + + /// + /// List schedules in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules + /// + /// + /// Operation Id + /// GlobalSchedules_ListBySubscription + /// + /// + /// + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDevTestLabGlobalSchedules(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabGlobalScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, "MockableDevTestLabsSubscriptionResource.GetDevTestLabGlobalSchedules", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index c15281e9a3756..0000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DevTestLabs -{ - /// 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 DevTestLabResources in the ResourceGroupResource. - /// An object representing collection of DevTestLabResources and their operations over a DevTestLabResource. - public virtual DevTestLabCollection GetDevTestLabs() - { - return GetCachedClient(Client => new DevTestLabCollection(Client, Id)); - } - - /// Gets a collection of DevTestLabGlobalScheduleResources in the ResourceGroupResource. - /// An object representing collection of DevTestLabGlobalScheduleResources and their operations over a DevTestLabGlobalScheduleResource. - public virtual DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules() - { - return GetCachedClient(Client => new DevTestLabGlobalScheduleCollection(Client, Id)); - } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 1f37b3222ddd1..0000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DevTestLabs -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _devTestLabLabsClientDiagnostics; - private LabsRestOperations _devTestLabLabsRestClient; - private ClientDiagnostics _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics; - private GlobalSchedulesRestOperations _devTestLabGlobalScheduleGlobalSchedulesRestClient; - - /// 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 DevTestLabLabsClientDiagnostics => _devTestLabLabsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabResource.ResourceType.Namespace, Diagnostics); - private LabsRestOperations DevTestLabLabsRestClient => _devTestLabLabsRestClient ??= new LabsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevTestLabResource.ResourceType)); - private ClientDiagnostics DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics => _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabGlobalScheduleResource.ResourceType.Namespace, Diagnostics); - private GlobalSchedulesRestOperations DevTestLabGlobalScheduleGlobalSchedulesRestClient => _devTestLabGlobalScheduleGlobalSchedulesRestClient ??= new GlobalSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevTestLabGlobalScheduleResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List labs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs - /// - /// - /// Operation Id - /// Labs_ListBySubscription - /// - /// - /// - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevTestLabsAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabLabsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabLabsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabResource(Client, DevTestLabData.DeserializeDevTestLabData(e)), DevTestLabLabsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevTestLabs", "value", "nextLink", cancellationToken); - } - - /// - /// List labs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs - /// - /// - /// Operation Id - /// Labs_ListBySubscription - /// - /// - /// - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevTestLabs(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabLabsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabLabsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabResource(Client, DevTestLabData.DeserializeDevTestLabData(e)), DevTestLabLabsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevTestLabs", "value", "nextLink", cancellationToken); - } - - /// - /// List schedules in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules - /// - /// - /// Operation Id - /// GlobalSchedules_ListBySubscription - /// - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevTestLabGlobalSchedulesAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabGlobalScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevTestLabGlobalSchedules", "value", "nextLink", cancellationToken); - } - - /// - /// List schedules in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules - /// - /// - /// Operation Id - /// GlobalSchedules_ListBySubscription - /// - /// - /// - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevTestLabGlobalSchedules(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabGlobalScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDevTestLabGlobalSchedules", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/api/Azure.ResourceManager.DigitalTwins.netstandard2.0.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/api/Azure.ResourceManager.DigitalTwins.netstandard2.0.cs index 447260245cb6d..df086972cc845 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/api/Azure.ResourceManager.DigitalTwins.netstandard2.0.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/api/Azure.ResourceManager.DigitalTwins.netstandard2.0.cs @@ -19,7 +19,7 @@ protected DigitalTwinsDescriptionCollection() { } } public partial class DigitalTwinsDescriptionData : Azure.ResourceManager.Models.TrackedResourceData { - public DigitalTwinsDescriptionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DigitalTwinsDescriptionData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string HostName { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } @@ -216,6 +216,33 @@ protected TimeSeriesDatabaseConnectionResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DigitalTwins.TimeSeriesDatabaseConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DigitalTwins.Mocking +{ + public partial class MockableDigitalTwinsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDigitalTwinsArmClient() { } + public virtual Azure.ResourceManager.DigitalTwins.DigitalTwinsDescriptionResource GetDigitalTwinsDescriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DigitalTwins.DigitalTwinsEndpointResource GetDigitalTwinsEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DigitalTwins.DigitalTwinsPrivateEndpointConnectionResource GetDigitalTwinsPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DigitalTwins.DigitalTwinsPrivateLinkResource GetDigitalTwinsPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DigitalTwins.TimeSeriesDatabaseConnectionResource GetTimeSeriesDatabaseConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDigitalTwinsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDigitalTwinsResourceGroupResource() { } + public virtual Azure.Response GetDigitalTwinsDescription(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDigitalTwinsDescriptionAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DigitalTwins.DigitalTwinsDescriptionCollection GetDigitalTwinsDescriptions() { throw null; } + } + public partial class MockableDigitalTwinsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDigitalTwinsSubscriptionResource() { } + public virtual Azure.Response CheckDigitalTwinsNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.DigitalTwins.Models.DigitalTwinsNameContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDigitalTwinsNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.DigitalTwins.Models.DigitalTwinsNameContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDigitalTwinsDescriptions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDigitalTwinsDescriptionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DigitalTwins.Models { public static partial class ArmDigitalTwinsModelFactory diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionResource.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionResource.cs index 460f5785ffa6a..219b1bad87b30 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionResource.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DigitalTwins public partial class DigitalTwinsDescriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DigitalTwinsEndpointResources and their operations over a DigitalTwinsEndpointResource. public virtual DigitalTwinsEndpointResourceCollection GetDigitalTwinsEndpointResources() { - return GetCachedClient(Client => new DigitalTwinsEndpointResourceCollection(Client, Id)); + return GetCachedClient(client => new DigitalTwinsEndpointResourceCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual DigitalTwinsEndpointResourceCollection GetDigitalTwinsEndpointRes /// /// Name of Endpoint Resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDigitalTwinsEndpointResourceAsync(string endpointName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetDigitalTwin /// /// Name of Endpoint Resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDigitalTwinsEndpointResource(string endpointName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetDigitalTwinsEndpointRes /// An object representing collection of DigitalTwinsPrivateLinkResources and their operations over a DigitalTwinsPrivateLinkResource. public virtual DigitalTwinsPrivateLinkResourceCollection GetDigitalTwinsPrivateLinkResources() { - return GetCachedClient(Client => new DigitalTwinsPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new DigitalTwinsPrivateLinkResourceCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual DigitalTwinsPrivateLinkResourceCollection GetDigitalTwinsPrivateL /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDigitalTwinsPrivateLinkResourceAsync(string resourceId, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetDigitalT /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDigitalTwinsPrivateLinkResource(string resourceId, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetDigitalTwinsPrivateL /// An object representing collection of DigitalTwinsPrivateEndpointConnectionResources and their operations over a DigitalTwinsPrivateEndpointConnectionResource. public virtual DigitalTwinsPrivateEndpointConnectionCollection GetDigitalTwinsPrivateEndpointConnections() { - return GetCachedClient(Client => new DigitalTwinsPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new DigitalTwinsPrivateEndpointConnectionCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual DigitalTwinsPrivateEndpointConnectionCollection GetDigitalTwinsPr /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDigitalTwinsPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDigitalTwinsPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetDigita /// An object representing collection of TimeSeriesDatabaseConnectionResources and their operations over a TimeSeriesDatabaseConnectionResource. public virtual TimeSeriesDatabaseConnectionCollection GetTimeSeriesDatabaseConnections() { - return GetCachedClient(Client => new TimeSeriesDatabaseConnectionCollection(Client, Id)); + return GetCachedClient(client => new TimeSeriesDatabaseConnectionCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual TimeSeriesDatabaseConnectionCollection GetTimeSeriesDatabaseConne /// /// Name of time series database connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTimeSeriesDatabaseConnectionAsync(string timeSeriesDatabaseConnectionName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetTim /// /// Name of time series database connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTimeSeriesDatabaseConnection(string timeSeriesDatabaseConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsEndpointResource.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsEndpointResource.cs index 897237cc40319..2e9ed9bf51242 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsEndpointResource.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsEndpointResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DigitalTwins public partial class DigitalTwinsEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The endpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string endpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}"; diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateEndpointConnectionResource.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateEndpointConnectionResource.cs index 0a76f301ece69..c1897d9b0efa2 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateEndpointConnectionResource.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DigitalTwins public partial class DigitalTwinsPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateLinkResource.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateLinkResource.cs index de7237d90e79f..1729007bc46c9 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateLinkResource.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.DigitalTwins public partial class DigitalTwinsPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The resourceId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string resourceId) { var resourceId0 = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources/{resourceId}"; diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/DigitalTwinsExtensions.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/DigitalTwinsExtensions.cs index 6cdbd7f2d23d7..9c989defdb2c5 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/DigitalTwinsExtensions.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/DigitalTwinsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DigitalTwins.Mocking; using Azure.ResourceManager.DigitalTwins.Models; using Azure.ResourceManager.Resources; @@ -19,138 +20,113 @@ namespace Azure.ResourceManager.DigitalTwins /// A class to add extension methods to Azure.ResourceManager.DigitalTwins. public static partial class DigitalTwinsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDigitalTwinsArmClient GetMockableDigitalTwinsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDigitalTwinsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDigitalTwinsResourceGroupResource GetMockableDigitalTwinsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDigitalTwinsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDigitalTwinsSubscriptionResource GetMockableDigitalTwinsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDigitalTwinsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DigitalTwinsDescriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DigitalTwinsDescriptionResource GetDigitalTwinsDescriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DigitalTwinsDescriptionResource.ValidateResourceId(id); - return new DigitalTwinsDescriptionResource(client, id); - } - ); + return GetMockableDigitalTwinsArmClient(client).GetDigitalTwinsDescriptionResource(id); } - #endregion - #region DigitalTwinsEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DigitalTwinsEndpointResource GetDigitalTwinsEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DigitalTwinsEndpointResource.ValidateResourceId(id); - return new DigitalTwinsEndpointResource(client, id); - } - ); + return GetMockableDigitalTwinsArmClient(client).GetDigitalTwinsEndpointResource(id); } - #endregion - #region DigitalTwinsPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DigitalTwinsPrivateLinkResource GetDigitalTwinsPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DigitalTwinsPrivateLinkResource.ValidateResourceId(id); - return new DigitalTwinsPrivateLinkResource(client, id); - } - ); + return GetMockableDigitalTwinsArmClient(client).GetDigitalTwinsPrivateLinkResource(id); } - #endregion - #region DigitalTwinsPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DigitalTwinsPrivateEndpointConnectionResource GetDigitalTwinsPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DigitalTwinsPrivateEndpointConnectionResource.ValidateResourceId(id); - return new DigitalTwinsPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableDigitalTwinsArmClient(client).GetDigitalTwinsPrivateEndpointConnectionResource(id); } - #endregion - #region TimeSeriesDatabaseConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TimeSeriesDatabaseConnectionResource GetTimeSeriesDatabaseConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TimeSeriesDatabaseConnectionResource.ValidateResourceId(id); - return new TimeSeriesDatabaseConnectionResource(client, id); - } - ); + return GetMockableDigitalTwinsArmClient(client).GetTimeSeriesDatabaseConnectionResource(id); } - #endregion - /// Gets a collection of DigitalTwinsDescriptionResources in the ResourceGroupResource. + /// + /// Gets a collection of DigitalTwinsDescriptionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DigitalTwinsDescriptionResources and their operations over a DigitalTwinsDescriptionResource. public static DigitalTwinsDescriptionCollection GetDigitalTwinsDescriptions(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDigitalTwinsDescriptions(); + return GetMockableDigitalTwinsResourceGroupResource(resourceGroupResource).GetDigitalTwinsDescriptions(); } /// @@ -165,16 +141,20 @@ public static DigitalTwinsDescriptionCollection GetDigitalTwinsDescriptions(this /// DigitalTwins_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DigitalTwinsInstance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDigitalTwinsDescriptionAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDigitalTwinsDescriptions().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableDigitalTwinsResourceGroupResource(resourceGroupResource).GetDigitalTwinsDescriptionAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -189,16 +169,20 @@ public static async Task> GetDigitalTw /// DigitalTwins_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DigitalTwinsInstance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDigitalTwinsDescription(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDigitalTwinsDescriptions().Get(resourceName, cancellationToken); + return GetMockableDigitalTwinsResourceGroupResource(resourceGroupResource).GetDigitalTwinsDescription(resourceName, cancellationToken); } /// @@ -213,13 +197,17 @@ public static Response GetDigitalTwinsDescripti /// DigitalTwins_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDigitalTwinsDescriptionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDigitalTwinsDescriptionsAsync(cancellationToken); + return GetMockableDigitalTwinsSubscriptionResource(subscriptionResource).GetDigitalTwinsDescriptionsAsync(cancellationToken); } /// @@ -234,13 +222,17 @@ public static AsyncPageable GetDigitalTwinsDesc /// DigitalTwins_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDigitalTwinsDescriptions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDigitalTwinsDescriptions(cancellationToken); + return GetMockableDigitalTwinsSubscriptionResource(subscriptionResource).GetDigitalTwinsDescriptions(cancellationToken); } /// @@ -255,6 +247,10 @@ public static Pageable GetDigitalTwinsDescripti /// DigitalTwins_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of DigitalTwinsInstance. @@ -263,9 +259,7 @@ public static Pageable GetDigitalTwinsDescripti /// is null. public static async Task> CheckDigitalTwinsNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, DigitalTwinsNameContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDigitalTwinsNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableDigitalTwinsSubscriptionResource(subscriptionResource).CheckDigitalTwinsNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -280,6 +274,10 @@ public static async Task> CheckDigitalTwinsName /// DigitalTwins_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of DigitalTwinsInstance. @@ -288,9 +286,7 @@ public static async Task> CheckDigitalTwinsName /// is null. public static Response CheckDigitalTwinsNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, DigitalTwinsNameContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDigitalTwinsNameAvailability(location, content, cancellationToken); + return GetMockableDigitalTwinsSubscriptionResource(subscriptionResource).CheckDigitalTwinsNameAvailability(location, content, cancellationToken); } } } diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsArmClient.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsArmClient.cs new file mode 100644 index 0000000000000..aeff340a5e8ba --- /dev/null +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DigitalTwins; + +namespace Azure.ResourceManager.DigitalTwins.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDigitalTwinsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDigitalTwinsArmClient() + { + } + + /// 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 MockableDigitalTwinsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDigitalTwinsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DigitalTwinsDescriptionResource GetDigitalTwinsDescriptionResource(ResourceIdentifier id) + { + DigitalTwinsDescriptionResource.ValidateResourceId(id); + return new DigitalTwinsDescriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DigitalTwinsEndpointResource GetDigitalTwinsEndpointResource(ResourceIdentifier id) + { + DigitalTwinsEndpointResource.ValidateResourceId(id); + return new DigitalTwinsEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DigitalTwinsPrivateLinkResource GetDigitalTwinsPrivateLinkResource(ResourceIdentifier id) + { + DigitalTwinsPrivateLinkResource.ValidateResourceId(id); + return new DigitalTwinsPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DigitalTwinsPrivateEndpointConnectionResource GetDigitalTwinsPrivateEndpointConnectionResource(ResourceIdentifier id) + { + DigitalTwinsPrivateEndpointConnectionResource.ValidateResourceId(id); + return new DigitalTwinsPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TimeSeriesDatabaseConnectionResource GetTimeSeriesDatabaseConnectionResource(ResourceIdentifier id) + { + TimeSeriesDatabaseConnectionResource.ValidateResourceId(id); + return new TimeSeriesDatabaseConnectionResource(Client, id); + } + } +} diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsResourceGroupResource.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsResourceGroupResource.cs new file mode 100644 index 0000000000000..68964601a9fd8 --- /dev/null +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.DigitalTwins; + +namespace Azure.ResourceManager.DigitalTwins.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDigitalTwinsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDigitalTwinsResourceGroupResource() + { + } + + /// 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 MockableDigitalTwinsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DigitalTwinsDescriptionResources in the ResourceGroupResource. + /// An object representing collection of DigitalTwinsDescriptionResources and their operations over a DigitalTwinsDescriptionResource. + public virtual DigitalTwinsDescriptionCollection GetDigitalTwinsDescriptions() + { + return GetCachedClient(client => new DigitalTwinsDescriptionCollection(client, Id)); + } + + /// + /// Get DigitalTwinsInstances resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName} + /// + /// + /// Operation Id + /// DigitalTwins_Get + /// + /// + /// + /// The name of the DigitalTwinsInstance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDigitalTwinsDescriptionAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetDigitalTwinsDescriptions().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get DigitalTwinsInstances resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName} + /// + /// + /// Operation Id + /// DigitalTwins_Get + /// + /// + /// + /// The name of the DigitalTwinsInstance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDigitalTwinsDescription(string resourceName, CancellationToken cancellationToken = default) + { + return GetDigitalTwinsDescriptions().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsSubscriptionResource.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsSubscriptionResource.cs new file mode 100644 index 0000000000000..bf945c0678cf2 --- /dev/null +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/MockableDigitalTwinsSubscriptionResource.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DigitalTwins; +using Azure.ResourceManager.DigitalTwins.Models; + +namespace Azure.ResourceManager.DigitalTwins.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDigitalTwinsSubscriptionResource : ArmResource + { + private ClientDiagnostics _digitalTwinsDescriptionDigitalTwinsClientDiagnostics; + private DigitalTwinsRestOperations _digitalTwinsDescriptionDigitalTwinsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDigitalTwinsSubscriptionResource() + { + } + + /// 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 MockableDigitalTwinsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DigitalTwinsDescriptionDigitalTwinsClientDiagnostics => _digitalTwinsDescriptionDigitalTwinsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DigitalTwins", DigitalTwinsDescriptionResource.ResourceType.Namespace, Diagnostics); + private DigitalTwinsRestOperations DigitalTwinsDescriptionDigitalTwinsRestClient => _digitalTwinsDescriptionDigitalTwinsRestClient ??= new DigitalTwinsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DigitalTwinsDescriptionResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances + /// + /// + /// Operation Id + /// DigitalTwins_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDigitalTwinsDescriptionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DigitalTwinsDescriptionDigitalTwinsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DigitalTwinsDescriptionDigitalTwinsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DigitalTwinsDescriptionResource(Client, DigitalTwinsDescriptionData.DeserializeDigitalTwinsDescriptionData(e)), DigitalTwinsDescriptionDigitalTwinsClientDiagnostics, Pipeline, "MockableDigitalTwinsSubscriptionResource.GetDigitalTwinsDescriptions", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the DigitalTwinsInstances in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances + /// + /// + /// Operation Id + /// DigitalTwins_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDigitalTwinsDescriptions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DigitalTwinsDescriptionDigitalTwinsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DigitalTwinsDescriptionDigitalTwinsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DigitalTwinsDescriptionResource(Client, DigitalTwinsDescriptionData.DeserializeDigitalTwinsDescriptionData(e)), DigitalTwinsDescriptionDigitalTwinsClientDiagnostics, Pipeline, "MockableDigitalTwinsSubscriptionResource.GetDigitalTwinsDescriptions", "value", "nextLink", cancellationToken); + } + + /// + /// Check if a DigitalTwinsInstance name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// DigitalTwins_CheckNameAvailability + /// + /// + /// + /// Location of DigitalTwinsInstance. + /// Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDigitalTwinsNameAvailabilityAsync(AzureLocation location, DigitalTwinsNameContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DigitalTwinsDescriptionDigitalTwinsClientDiagnostics.CreateScope("MockableDigitalTwinsSubscriptionResource.CheckDigitalTwinsNameAvailability"); + scope.Start(); + try + { + var response = await DigitalTwinsDescriptionDigitalTwinsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a DigitalTwinsInstance name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// DigitalTwins_CheckNameAvailability + /// + /// + /// + /// Location of DigitalTwinsInstance. + /// Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDigitalTwinsNameAvailability(AzureLocation location, DigitalTwinsNameContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DigitalTwinsDescriptionDigitalTwinsClientDiagnostics.CreateScope("MockableDigitalTwinsSubscriptionResource.CheckDigitalTwinsNameAvailability"); + scope.Start(); + try + { + var response = DigitalTwinsDescriptionDigitalTwinsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d59779ea0d8d2..0000000000000 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DigitalTwins -{ - /// 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 DigitalTwinsDescriptionResources in the ResourceGroupResource. - /// An object representing collection of DigitalTwinsDescriptionResources and their operations over a DigitalTwinsDescriptionResource. - public virtual DigitalTwinsDescriptionCollection GetDigitalTwinsDescriptions() - { - return GetCachedClient(Client => new DigitalTwinsDescriptionCollection(Client, Id)); - } - } -} diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index ed8a7b0e1d7a7..0000000000000 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.DigitalTwins.Models; - -namespace Azure.ResourceManager.DigitalTwins -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _digitalTwinsDescriptionDigitalTwinsClientDiagnostics; - private DigitalTwinsRestOperations _digitalTwinsDescriptionDigitalTwinsRestClient; - - /// 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 DigitalTwinsDescriptionDigitalTwinsClientDiagnostics => _digitalTwinsDescriptionDigitalTwinsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DigitalTwins", DigitalTwinsDescriptionResource.ResourceType.Namespace, Diagnostics); - private DigitalTwinsRestOperations DigitalTwinsDescriptionDigitalTwinsRestClient => _digitalTwinsDescriptionDigitalTwinsRestClient ??= new DigitalTwinsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DigitalTwinsDescriptionResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get all the DigitalTwinsInstances in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances - /// - /// - /// Operation Id - /// DigitalTwins_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDigitalTwinsDescriptionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DigitalTwinsDescriptionDigitalTwinsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DigitalTwinsDescriptionDigitalTwinsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DigitalTwinsDescriptionResource(Client, DigitalTwinsDescriptionData.DeserializeDigitalTwinsDescriptionData(e)), DigitalTwinsDescriptionDigitalTwinsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDigitalTwinsDescriptions", "value", "nextLink", cancellationToken); - } - - /// - /// Get all the DigitalTwinsInstances in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances - /// - /// - /// Operation Id - /// DigitalTwins_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDigitalTwinsDescriptions(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DigitalTwinsDescriptionDigitalTwinsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DigitalTwinsDescriptionDigitalTwinsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DigitalTwinsDescriptionResource(Client, DigitalTwinsDescriptionData.DeserializeDigitalTwinsDescriptionData(e)), DigitalTwinsDescriptionDigitalTwinsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDigitalTwinsDescriptions", "value", "nextLink", cancellationToken); - } - - /// - /// Check if a DigitalTwinsInstance name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// DigitalTwins_CheckNameAvailability - /// - /// - /// - /// Location of DigitalTwinsInstance. - /// Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. - /// The cancellation token to use. - public virtual async Task> CheckDigitalTwinsNameAvailabilityAsync(AzureLocation location, DigitalTwinsNameContent content, CancellationToken cancellationToken = default) - { - using var scope = DigitalTwinsDescriptionDigitalTwinsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDigitalTwinsNameAvailability"); - scope.Start(); - try - { - var response = await DigitalTwinsDescriptionDigitalTwinsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if a DigitalTwinsInstance name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// DigitalTwins_CheckNameAvailability - /// - /// - /// - /// Location of DigitalTwinsInstance. - /// Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check. - /// The cancellation token to use. - public virtual Response CheckDigitalTwinsNameAvailability(AzureLocation location, DigitalTwinsNameContent content, CancellationToken cancellationToken = default) - { - using var scope = DigitalTwinsDescriptionDigitalTwinsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDigitalTwinsNameAvailability"); - scope.Start(); - try - { - var response = DigitalTwinsDescriptionDigitalTwinsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/TimeSeriesDatabaseConnectionResource.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/TimeSeriesDatabaseConnectionResource.cs index 32294eb1aeb08..932959edaf03d 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/TimeSeriesDatabaseConnectionResource.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/TimeSeriesDatabaseConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DigitalTwins public partial class TimeSeriesDatabaseConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The timeSeriesDatabaseConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string timeSeriesDatabaseConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName}"; diff --git a/sdk/dns/Azure.ResourceManager.Dns/Azure.ResourceManager.Dns.sln b/sdk/dns/Azure.ResourceManager.Dns/Azure.ResourceManager.Dns.sln index 41e0350145b33..e5afa45f922af 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/Azure.ResourceManager.Dns.sln +++ b/sdk/dns/Azure.ResourceManager.Dns/Azure.ResourceManager.Dns.sln @@ -57,30 +57,18 @@ Global {3550C5F7-862A-4EEB-8440-FB97D9FE4422}.Release|x64.Build.0 = Release|Any CPU {3550C5F7-862A-4EEB-8440-FB97D9FE4422}.Release|x86.ActiveCfg = Release|Any CPU {3550C5F7-862A-4EEB-8440-FB97D9FE4422}.Release|x86.Build.0 = Release|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Debug|x64.ActiveCfg = Debug|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Debug|x64.Build.0 = Debug|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Debug|x86.ActiveCfg = Debug|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Debug|x86.Build.0 = Debug|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Release|Any CPU.Build.0 = Release|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Release|x64.ActiveCfg = Release|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Release|x64.Build.0 = Release|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Release|x86.ActiveCfg = Release|Any CPU - {4D92156D-93E4-4111-886B-8CF28BC48D7B}.Release|x86.Build.0 = Release|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Debug|x64.ActiveCfg = Debug|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Debug|x64.Build.0 = Debug|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Debug|x86.ActiveCfg = Debug|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Debug|x86.Build.0 = Debug|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Release|Any CPU.Build.0 = Release|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Release|x64.ActiveCfg = Release|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Release|x64.Build.0 = Release|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Release|x86.ActiveCfg = Release|Any CPU - {B9C4E390-566C-490F-8210-34D47AB02078}.Release|x86.Build.0 = Release|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Debug|x64.ActiveCfg = Debug|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Debug|x64.Build.0 = Debug|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Debug|x86.ActiveCfg = Debug|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Debug|x86.Build.0 = Debug|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Release|Any CPU.Build.0 = Release|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Release|x64.ActiveCfg = Release|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Release|x64.Build.0 = Release|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Release|x86.ActiveCfg = Release|Any CPU + {E2F3891F-BE42-46FE-AAF6-5C220A823DF2}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/dns/Azure.ResourceManager.Dns/api/Azure.ResourceManager.Dns.netstandard2.0.cs b/sdk/dns/Azure.ResourceManager.Dns/api/Azure.ResourceManager.Dns.netstandard2.0.cs index ca75668186ca7..dc555e6a47940 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/api/Azure.ResourceManager.Dns.netstandard2.0.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/api/Azure.ResourceManager.Dns.netstandard2.0.cs @@ -402,7 +402,7 @@ protected DnsZoneCollection() { } } public partial class DnsZoneData : Azure.ResourceManager.Models.TrackedResourceData { - public DnsZoneData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DnsZoneData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public long? MaxNumberOfRecords { get { throw null; } } public long? MaxNumberOfRecordsPerRecord { get { throw null; } } @@ -465,6 +465,39 @@ protected DnsZoneResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Dns.Models.DnsZonePatch patch, Azure.ETag? ifMatch = default(Azure.ETag?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Dns.Mocking +{ + public partial class MockableDnsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDnsArmClient() { } + public virtual Azure.ResourceManager.Dns.DnsAaaaRecordResource GetDnsAaaaRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsARecordResource GetDnsARecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsCaaRecordResource GetDnsCaaRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsCnameRecordResource GetDnsCnameRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsMXRecordResource GetDnsMXRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsNSRecordResource GetDnsNSRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsPtrRecordResource GetDnsPtrRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsSoaRecordResource GetDnsSoaRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsSrvRecordResource GetDnsSrvRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsTxtRecordResource GetDnsTxtRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsZoneResource GetDnsZoneResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDnsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDnsResourceGroupResource() { } + public virtual Azure.Response GetDnsZone(string zoneName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDnsZoneAsync(string zoneName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Dns.DnsZoneCollection GetDnsZones() { throw null; } + } + public partial class MockableDnsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDnsSubscriptionResource() { } + public virtual Azure.Response GetDnsResourceReferencesByTargetResources(Azure.ResourceManager.Dns.Models.DnsResourceReferenceContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDnsResourceReferencesByTargetResourcesAsync(Azure.ResourceManager.Dns.Models.DnsResourceReferenceContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDnsZones(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDnsZonesAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Dns.Models { public static partial class ArmDnsModelFactory diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs index e4ad455c51ee0..59a8dd2d8de88 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Dns.Mocking; using Azure.ResourceManager.Dns.Models; using Azure.ResourceManager.Resources; @@ -19,252 +20,209 @@ namespace Azure.ResourceManager.Dns /// A class to add extension methods to Azure.ResourceManager.Dns. public static partial class DnsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDnsArmClient GetMockableDnsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDnsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDnsResourceGroupResource GetMockableDnsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDnsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDnsSubscriptionResource GetMockableDnsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDnsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DnsARecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsARecordResource GetDnsARecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsARecordResource.ValidateResourceId(id); - return new DnsARecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsARecordResource(id); } - #endregion - #region DnsAaaaRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsAaaaRecordResource GetDnsAaaaRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsAaaaRecordResource.ValidateResourceId(id); - return new DnsAaaaRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsAaaaRecordResource(id); } - #endregion - #region DnsCaaRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsCaaRecordResource GetDnsCaaRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsCaaRecordResource.ValidateResourceId(id); - return new DnsCaaRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsCaaRecordResource(id); } - #endregion - #region DnsCnameRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsCnameRecordResource GetDnsCnameRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsCnameRecordResource.ValidateResourceId(id); - return new DnsCnameRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsCnameRecordResource(id); } - #endregion - #region DnsMXRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsMXRecordResource GetDnsMXRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsMXRecordResource.ValidateResourceId(id); - return new DnsMXRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsMXRecordResource(id); } - #endregion - #region DnsNSRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsNSRecordResource GetDnsNSRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsNSRecordResource.ValidateResourceId(id); - return new DnsNSRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsNSRecordResource(id); } - #endregion - #region DnsPtrRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsPtrRecordResource GetDnsPtrRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsPtrRecordResource.ValidateResourceId(id); - return new DnsPtrRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsPtrRecordResource(id); } - #endregion - #region DnsSoaRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsSoaRecordResource GetDnsSoaRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsSoaRecordResource.ValidateResourceId(id); - return new DnsSoaRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsSoaRecordResource(id); } - #endregion - #region DnsSrvRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsSrvRecordResource GetDnsSrvRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsSrvRecordResource.ValidateResourceId(id); - return new DnsSrvRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsSrvRecordResource(id); } - #endregion - #region DnsTxtRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsTxtRecordResource GetDnsTxtRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsTxtRecordResource.ValidateResourceId(id); - return new DnsTxtRecordResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsTxtRecordResource(id); } - #endregion - #region DnsZoneResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsZoneResource GetDnsZoneResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsZoneResource.ValidateResourceId(id); - return new DnsZoneResource(client, id); - } - ); + return GetMockableDnsArmClient(client).GetDnsZoneResource(id); } - #endregion - /// Gets a collection of DnsZoneResources in the ResourceGroupResource. + /// + /// Gets a collection of DnsZoneResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DnsZoneResources and their operations over a DnsZoneResource. public static DnsZoneCollection GetDnsZones(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDnsZones(); + return GetMockableDnsResourceGroupResource(resourceGroupResource).GetDnsZones(); } /// @@ -279,16 +237,20 @@ public static DnsZoneCollection GetDnsZones(this ResourceGroupResource resourceG /// Zones_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DNS zone (without a terminating dot). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDnsZoneAsync(this ResourceGroupResource resourceGroupResource, string zoneName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDnsZones().GetAsync(zoneName, cancellationToken).ConfigureAwait(false); + return await GetMockableDnsResourceGroupResource(resourceGroupResource).GetDnsZoneAsync(zoneName, cancellationToken).ConfigureAwait(false); } /// @@ -303,16 +265,20 @@ public static async Task> GetDnsZoneAsync(this Resourc /// Zones_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DNS zone (without a terminating dot). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDnsZone(this ResourceGroupResource resourceGroupResource, string zoneName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDnsZones().Get(zoneName, cancellationToken); + return GetMockableDnsResourceGroupResource(resourceGroupResource).GetDnsZone(zoneName, cancellationToken); } /// @@ -327,6 +293,10 @@ public static Response GetDnsZone(this ResourceGroupResource re /// Zones_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. @@ -334,7 +304,7 @@ public static Response GetDnsZone(this ResourceGroupResource re /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDnsZonesAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDnsZonesAsync(top, cancellationToken); + return GetMockableDnsSubscriptionResource(subscriptionResource).GetDnsZonesAsync(top, cancellationToken); } /// @@ -349,6 +319,10 @@ public static AsyncPageable GetDnsZonesAsync(this SubscriptionR /// Zones_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. @@ -356,7 +330,7 @@ public static AsyncPageable GetDnsZonesAsync(this SubscriptionR /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDnsZones(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDnsZones(top, cancellationToken); + return GetMockableDnsSubscriptionResource(subscriptionResource).GetDnsZones(top, cancellationToken); } /// @@ -371,6 +345,10 @@ public static Pageable GetDnsZones(this SubscriptionResource su /// DnsResourceReference_GetByTargetResources /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Properties for dns resource reference request. @@ -378,9 +356,7 @@ public static Pageable GetDnsZones(this SubscriptionResource su /// is null. public static async Task> GetDnsResourceReferencesByTargetResourcesAsync(this SubscriptionResource subscriptionResource, DnsResourceReferenceContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetDnsResourceReferencesByTargetResourcesAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableDnsSubscriptionResource(subscriptionResource).GetDnsResourceReferencesByTargetResourcesAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -395,6 +371,10 @@ public static async Task> GetDnsResourceRef /// DnsResourceReference_GetByTargetResources /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Properties for dns resource reference request. @@ -402,9 +382,7 @@ public static async Task> GetDnsResourceRef /// is null. public static Response GetDnsResourceReferencesByTargetResources(this SubscriptionResource subscriptionResource, DnsResourceReferenceContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDnsResourceReferencesByTargetResources(content, cancellationToken); + return GetMockableDnsSubscriptionResource(subscriptionResource).GetDnsResourceReferencesByTargetResources(content, cancellationToken); } } } diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsArmClient.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsArmClient.cs new file mode 100644 index 0000000000000..33b8c0372428a --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsArmClient.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Dns; + +namespace Azure.ResourceManager.Dns.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDnsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDnsArmClient() + { + } + + /// 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 MockableDnsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDnsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsARecordResource GetDnsARecordResource(ResourceIdentifier id) + { + DnsARecordResource.ValidateResourceId(id); + return new DnsARecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsAaaaRecordResource GetDnsAaaaRecordResource(ResourceIdentifier id) + { + DnsAaaaRecordResource.ValidateResourceId(id); + return new DnsAaaaRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsCaaRecordResource GetDnsCaaRecordResource(ResourceIdentifier id) + { + DnsCaaRecordResource.ValidateResourceId(id); + return new DnsCaaRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsCnameRecordResource GetDnsCnameRecordResource(ResourceIdentifier id) + { + DnsCnameRecordResource.ValidateResourceId(id); + return new DnsCnameRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsMXRecordResource GetDnsMXRecordResource(ResourceIdentifier id) + { + DnsMXRecordResource.ValidateResourceId(id); + return new DnsMXRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsNSRecordResource GetDnsNSRecordResource(ResourceIdentifier id) + { + DnsNSRecordResource.ValidateResourceId(id); + return new DnsNSRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsPtrRecordResource GetDnsPtrRecordResource(ResourceIdentifier id) + { + DnsPtrRecordResource.ValidateResourceId(id); + return new DnsPtrRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsSoaRecordResource GetDnsSoaRecordResource(ResourceIdentifier id) + { + DnsSoaRecordResource.ValidateResourceId(id); + return new DnsSoaRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsSrvRecordResource GetDnsSrvRecordResource(ResourceIdentifier id) + { + DnsSrvRecordResource.ValidateResourceId(id); + return new DnsSrvRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsTxtRecordResource GetDnsTxtRecordResource(ResourceIdentifier id) + { + DnsTxtRecordResource.ValidateResourceId(id); + return new DnsTxtRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsZoneResource GetDnsZoneResource(ResourceIdentifier id) + { + DnsZoneResource.ValidateResourceId(id); + return new DnsZoneResource(Client, id); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsResourceGroupResource.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsResourceGroupResource.cs new file mode 100644 index 0000000000000..13ef12dfaf02e --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Dns; + +namespace Azure.ResourceManager.Dns.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDnsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDnsResourceGroupResource() + { + } + + /// 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 MockableDnsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DnsZoneResources in the ResourceGroupResource. + /// An object representing collection of DnsZoneResources and their operations over a DnsZoneResource. + public virtual DnsZoneCollection GetDnsZones() + { + return GetCachedClient(client => new DnsZoneCollection(client, Id)); + } + + /// + /// Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName} + /// + /// + /// Operation Id + /// Zones_Get + /// + /// + /// + /// The name of the DNS zone (without a terminating dot). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDnsZoneAsync(string zoneName, CancellationToken cancellationToken = default) + { + return await GetDnsZones().GetAsync(zoneName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName} + /// + /// + /// Operation Id + /// Zones_Get + /// + /// + /// + /// The name of the DNS zone (without a terminating dot). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDnsZone(string zoneName, CancellationToken cancellationToken = default) + { + return GetDnsZones().Get(zoneName, cancellationToken); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsSubscriptionResource.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsSubscriptionResource.cs new file mode 100644 index 0000000000000..c9d8aadefbdfc --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/MockableDnsSubscriptionResource.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dns; +using Azure.ResourceManager.Dns.Models; + +namespace Azure.ResourceManager.Dns.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDnsSubscriptionResource : ArmResource + { + private ClientDiagnostics _dnsZoneZonesClientDiagnostics; + private ZonesRestOperations _dnsZoneZonesRestClient; + private ClientDiagnostics _dnsResourceReferenceClientDiagnostics; + private DnsResourceReferenceRestOperations _dnsResourceReferenceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDnsSubscriptionResource() + { + } + + /// 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 MockableDnsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DnsZoneZonesClientDiagnostics => _dnsZoneZonesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Dns", DnsZoneResource.ResourceType.Namespace, Diagnostics); + private ZonesRestOperations DnsZoneZonesRestClient => _dnsZoneZonesRestClient ??= new ZonesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsZoneResource.ResourceType)); + private ClientDiagnostics DnsResourceReferenceClientDiagnostics => _dnsResourceReferenceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Dns", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DnsResourceReferenceRestOperations DnsResourceReferenceRestClient => _dnsResourceReferenceRestClient ??= new DnsResourceReferenceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the DNS zones in all resource groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones + /// + /// + /// Operation Id + /// Zones_List + /// + /// + /// + /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDnsZonesAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsZoneZonesRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsZoneZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsZoneResource(Client, DnsZoneData.DeserializeDnsZoneData(e)), DnsZoneZonesClientDiagnostics, Pipeline, "MockableDnsSubscriptionResource.GetDnsZones", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the DNS zones in all resource groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones + /// + /// + /// Operation Id + /// Zones_List + /// + /// + /// + /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDnsZones(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsZoneZonesRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsZoneZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsZoneResource(Client, DnsZoneData.DeserializeDnsZoneData(e)), DnsZoneZonesClientDiagnostics, Pipeline, "MockableDnsSubscriptionResource.GetDnsZones", "value", "nextLink", cancellationToken); + } + + /// + /// Returns the DNS records specified by the referencing targetResourceIds. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/getDnsResourceReference + /// + /// + /// Operation Id + /// DnsResourceReference_GetByTargetResources + /// + /// + /// + /// Properties for dns resource reference request. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetDnsResourceReferencesByTargetResourcesAsync(DnsResourceReferenceContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DnsResourceReferenceClientDiagnostics.CreateScope("MockableDnsSubscriptionResource.GetDnsResourceReferencesByTargetResources"); + scope.Start(); + try + { + var response = await DnsResourceReferenceRestClient.GetByTargetResourcesAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the DNS records specified by the referencing targetResourceIds. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/getDnsResourceReference + /// + /// + /// Operation Id + /// DnsResourceReference_GetByTargetResources + /// + /// + /// + /// Properties for dns resource reference request. + /// The cancellation token to use. + /// is null. + public virtual Response GetDnsResourceReferencesByTargetResources(DnsResourceReferenceContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DnsResourceReferenceClientDiagnostics.CreateScope("MockableDnsSubscriptionResource.GetDnsResourceReferencesByTargetResources"); + scope.Start(); + try + { + var response = DnsResourceReferenceRestClient.GetByTargetResources(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 0750fe1106076..0000000000000 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Dns -{ - /// 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 DnsZoneResources in the ResourceGroupResource. - /// An object representing collection of DnsZoneResources and their operations over a DnsZoneResource. - public virtual DnsZoneCollection GetDnsZones() - { - return GetCachedClient(Client => new DnsZoneCollection(Client, Id)); - } - } -} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d0dd4976fa5a3..0000000000000 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Dns.Models; - -namespace Azure.ResourceManager.Dns -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dnsZoneZonesClientDiagnostics; - private ZonesRestOperations _dnsZoneZonesRestClient; - private ClientDiagnostics _dnsResourceReferenceClientDiagnostics; - private DnsResourceReferenceRestOperations _dnsResourceReferenceRestClient; - - /// 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 DnsZoneZonesClientDiagnostics => _dnsZoneZonesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Dns", DnsZoneResource.ResourceType.Namespace, Diagnostics); - private ZonesRestOperations DnsZoneZonesRestClient => _dnsZoneZonesRestClient ??= new ZonesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsZoneResource.ResourceType)); - private ClientDiagnostics DnsResourceReferenceClientDiagnostics => _dnsResourceReferenceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Dns", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DnsResourceReferenceRestOperations DnsResourceReferenceRestClient => _dnsResourceReferenceRestClient ??= new DnsResourceReferenceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists the DNS zones in all resource groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones - /// - /// - /// Operation Id - /// Zones_List - /// - /// - /// - /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDnsZonesAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DnsZoneZonesRestClient.CreateListRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsZoneZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsZoneResource(Client, DnsZoneData.DeserializeDnsZoneData(e)), DnsZoneZonesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDnsZones", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the DNS zones in all resource groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones - /// - /// - /// Operation Id - /// Zones_List - /// - /// - /// - /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDnsZones(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DnsZoneZonesRestClient.CreateListRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsZoneZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsZoneResource(Client, DnsZoneData.DeserializeDnsZoneData(e)), DnsZoneZonesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDnsZones", "value", "nextLink", cancellationToken); - } - - /// - /// Returns the DNS records specified by the referencing targetResourceIds. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/getDnsResourceReference - /// - /// - /// Operation Id - /// DnsResourceReference_GetByTargetResources - /// - /// - /// - /// Properties for dns resource reference request. - /// The cancellation token to use. - public virtual async Task> GetDnsResourceReferencesByTargetResourcesAsync(DnsResourceReferenceContent content, CancellationToken cancellationToken = default) - { - using var scope = DnsResourceReferenceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetDnsResourceReferencesByTargetResources"); - scope.Start(); - try - { - var response = await DnsResourceReferenceRestClient.GetByTargetResourcesAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns the DNS records specified by the referencing targetResourceIds. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/getDnsResourceReference - /// - /// - /// Operation Id - /// DnsResourceReference_GetByTargetResources - /// - /// - /// - /// Properties for dns resource reference request. - /// The cancellation token to use. - public virtual Response GetDnsResourceReferencesByTargetResources(DnsResourceReferenceContent content, CancellationToken cancellationToken = default) - { - using var scope = DnsResourceReferenceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetDnsResourceReferencesByTargetResources"); - scope.Start(); - try - { - var response = DnsResourceReferenceRestClient.GetByTargetResources(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs index 41d9222faaf6b..203d3eb973b6f 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs @@ -60,7 +60,7 @@ protected DnsForwardingRulesetCollection() { } } public partial class DnsForwardingRulesetData : Azure.ResourceManager.Models.TrackedResourceData { - public DnsForwardingRulesetData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable dnsResolverOutboundEndpoints) : base (default(Azure.Core.AzureLocation)) { } + public DnsForwardingRulesetData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable dnsResolverOutboundEndpoints) { } public System.Collections.Generic.IList DnsResolverOutboundEndpoints { get { throw null; } } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } @@ -150,7 +150,7 @@ protected DnsResolverCollection() { } } public partial class DnsResolverData : Azure.ResourceManager.Models.TrackedResourceData { - public DnsResolverData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.WritableSubResource virtualNetwork) : base (default(Azure.Core.AzureLocation)) { } + public DnsResolverData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.WritableSubResource virtualNetwork) { } public Azure.ResourceManager.DnsResolver.Models.DnsResolverState? DnsResolverState { get { throw null; } } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } @@ -196,7 +196,7 @@ protected DnsResolverInboundEndpointCollection() { } } public partial class DnsResolverInboundEndpointData : Azure.ResourceManager.Models.TrackedResourceData { - public DnsResolverInboundEndpointData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable ipConfigurations) : base (default(Azure.Core.AzureLocation)) { } + public DnsResolverInboundEndpointData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable ipConfigurations) { } public Azure.ETag? ETag { get { throw null; } } public System.Collections.Generic.IList IPConfigurations { get { throw null; } } public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } @@ -241,7 +241,7 @@ protected DnsResolverOutboundEndpointCollection() { } } public partial class DnsResolverOutboundEndpointData : Azure.ResourceManager.Models.TrackedResourceData { - public DnsResolverOutboundEndpointData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.WritableSubResource subnet) : base (default(Azure.Core.AzureLocation)) { } + public DnsResolverOutboundEndpointData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.WritableSubResource subnet) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } public System.Guid? ResourceGuid { get { throw null; } } @@ -303,6 +303,38 @@ protected VirtualNetworkDnsResolverResource() { } public virtual Azure.AsyncPageable GetDnsResolversAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.DnsResolver.Mocking +{ + public partial class MockableDnsResolverArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDnsResolverArmClient() { } + public virtual Azure.ResourceManager.DnsResolver.DnsForwardingRuleResource GetDnsForwardingRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsForwardingRulesetResource GetDnsForwardingRulesetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsForwardingRulesetVirtualNetworkLinkResource GetDnsForwardingRulesetVirtualNetworkLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverInboundEndpointResource GetDnsResolverInboundEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverOutboundEndpointResource GetDnsResolverOutboundEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverResource GetDnsResolverResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.VirtualNetworkDnsResolverResource GetVirtualNetworkDnsResolverResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDnsResolverResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDnsResolverResourceGroupResource() { } + public virtual Azure.Response GetDnsForwardingRuleset(string rulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDnsForwardingRulesetAsync(string rulesetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsForwardingRulesetCollection GetDnsForwardingRulesets() { throw null; } + public virtual Azure.Response GetDnsResolver(string dnsResolverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDnsResolverAsync(string dnsResolverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverCollection GetDnsResolvers() { throw null; } + } + public partial class MockableDnsResolverSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDnsResolverSubscriptionResource() { } + public virtual Azure.Pageable GetDnsForwardingRulesets(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDnsForwardingRulesetsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDnsResolvers(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDnsResolversAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.DnsResolver.Models { public static partial class ArmDnsResolverModelFactory diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleResource.cs index 922d2e5e0fd46..6f41ee7b5df50 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DnsResolver public partial class DnsForwardingRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The rulesetName. + /// The forwardingRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string rulesetName, string forwardingRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{rulesetName}/forwardingRules/{forwardingRuleName}"; diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs index 7de343f461108..61350f64aee4d 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DnsResolver public partial class DnsForwardingRulesetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The rulesetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string rulesetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{rulesetName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DnsForwardingRuleResources and their operations over a DnsForwardingRuleResource. public virtual DnsForwardingRuleCollection GetDnsForwardingRules() { - return GetCachedClient(Client => new DnsForwardingRuleCollection(Client, Id)); + return GetCachedClient(client => new DnsForwardingRuleCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual DnsForwardingRuleCollection GetDnsForwardingRules() /// /// The name of the forwarding rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDnsForwardingRuleAsync(string forwardingRuleName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetDnsForwardingR /// /// The name of the forwarding rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDnsForwardingRule(string forwardingRuleName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetDnsForwardingRule(string f /// An object representing collection of DnsForwardingRulesetVirtualNetworkLinkResources and their operations over a DnsForwardingRulesetVirtualNetworkLinkResource. public virtual DnsForwardingRulesetVirtualNetworkLinkCollection GetDnsForwardingRulesetVirtualNetworkLinks() { - return GetCachedClient(Client => new DnsForwardingRulesetVirtualNetworkLinkCollection(Client, Id)); + return GetCachedClient(client => new DnsForwardingRulesetVirtualNetworkLinkCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual DnsForwardingRulesetVirtualNetworkLinkCollection GetDnsForwarding /// /// The name of the virtual network link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDnsForwardingRulesetVirtualNetworkLinkAsync(string virtualNetworkLinkName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task /// The name of the virtual network link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDnsForwardingRulesetVirtualNetworkLink(string virtualNetworkLinkName, CancellationToken cancellationToken = default) { diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkResource.cs index ca44d9392a72f..a684ea821fd3f 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.DnsResolver public partial class DnsForwardingRulesetVirtualNetworkLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The rulesetName. + /// The virtualNetworkLinkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string rulesetName, string virtualNetworkLinkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{rulesetName}/virtualNetworkLinks/{virtualNetworkLinkName}"; diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointResource.cs index f396433dde280..d35a2954d7ba2 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DnsResolver public partial class DnsResolverInboundEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dnsResolverName. + /// The inboundEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverName, string inboundEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}"; diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointResource.cs index 18a36c4a59981..720c4668af04b 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.DnsResolver public partial class DnsResolverOutboundEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dnsResolverName. + /// The outboundEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverName, string outboundEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/outboundEndpoints/{outboundEndpointName}"; diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs index fa4b7e1d1fb28..ab6e06503f1a2 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.DnsResolver public partial class DnsResolverResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dnsResolverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DnsResolverInboundEndpointResources and their operations over a DnsResolverInboundEndpointResource. public virtual DnsResolverInboundEndpointCollection GetDnsResolverInboundEndpoints() { - return GetCachedClient(Client => new DnsResolverInboundEndpointCollection(Client, Id)); + return GetCachedClient(client => new DnsResolverInboundEndpointCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual DnsResolverInboundEndpointCollection GetDnsResolverInboundEndpoin /// /// The name of the inbound endpoint for the DNS resolver. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDnsResolverInboundEndpointAsync(string inboundEndpointName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetDnsRe /// /// The name of the inbound endpoint for the DNS resolver. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDnsResolverInboundEndpoint(string inboundEndpointName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetDnsResolverInboun /// An object representing collection of DnsResolverOutboundEndpointResources and their operations over a DnsResolverOutboundEndpointResource. public virtual DnsResolverOutboundEndpointCollection GetDnsResolverOutboundEndpoints() { - return GetCachedClient(Client => new DnsResolverOutboundEndpointCollection(Client, Id)); + return GetCachedClient(client => new DnsResolverOutboundEndpointCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual DnsResolverOutboundEndpointCollection GetDnsResolverOutboundEndpo /// /// The name of the outbound endpoint for the DNS resolver. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDnsResolverOutboundEndpointAsync(string outboundEndpointName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetDnsR /// /// The name of the outbound endpoint for the DNS resolver. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDnsResolverOutboundEndpoint(string outboundEndpointName, CancellationToken cancellationToken = default) { diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/DnsResolverExtensions.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/DnsResolverExtensions.cs index 1a9ab38a65a2c..38d426d0ae43b 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/DnsResolverExtensions.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/DnsResolverExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.DnsResolver.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DnsResolver @@ -18,176 +19,145 @@ namespace Azure.ResourceManager.DnsResolver /// A class to add extension methods to Azure.ResourceManager.DnsResolver. public static partial class DnsResolverExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDnsResolverArmClient GetMockableDnsResolverArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDnsResolverArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDnsResolverResourceGroupResource GetMockableDnsResolverResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDnsResolverResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDnsResolverSubscriptionResource GetMockableDnsResolverSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDnsResolverSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DnsResolverResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsResolverResource GetDnsResolverResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsResolverResource.ValidateResourceId(id); - return new DnsResolverResource(client, id); - } - ); + return GetMockableDnsResolverArmClient(client).GetDnsResolverResource(id); } - #endregion - #region DnsResolverInboundEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsResolverInboundEndpointResource GetDnsResolverInboundEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsResolverInboundEndpointResource.ValidateResourceId(id); - return new DnsResolverInboundEndpointResource(client, id); - } - ); + return GetMockableDnsResolverArmClient(client).GetDnsResolverInboundEndpointResource(id); } - #endregion - #region DnsResolverOutboundEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsResolverOutboundEndpointResource GetDnsResolverOutboundEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsResolverOutboundEndpointResource.ValidateResourceId(id); - return new DnsResolverOutboundEndpointResource(client, id); - } - ); + return GetMockableDnsResolverArmClient(client).GetDnsResolverOutboundEndpointResource(id); } - #endregion - #region DnsForwardingRulesetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsForwardingRulesetResource GetDnsForwardingRulesetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsForwardingRulesetResource.ValidateResourceId(id); - return new DnsForwardingRulesetResource(client, id); - } - ); + return GetMockableDnsResolverArmClient(client).GetDnsForwardingRulesetResource(id); } - #endregion - #region DnsForwardingRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsForwardingRuleResource GetDnsForwardingRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsForwardingRuleResource.ValidateResourceId(id); - return new DnsForwardingRuleResource(client, id); - } - ); + return GetMockableDnsResolverArmClient(client).GetDnsForwardingRuleResource(id); } - #endregion - #region DnsForwardingRulesetVirtualNetworkLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DnsForwardingRulesetVirtualNetworkLinkResource GetDnsForwardingRulesetVirtualNetworkLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DnsForwardingRulesetVirtualNetworkLinkResource.ValidateResourceId(id); - return new DnsForwardingRulesetVirtualNetworkLinkResource(client, id); - } - ); + return GetMockableDnsResolverArmClient(client).GetDnsForwardingRulesetVirtualNetworkLinkResource(id); } - #endregion - #region VirtualNetworkDnsResolverResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkDnsResolverResource GetVirtualNetworkDnsResolverResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkDnsResolverResource.ValidateResourceId(id); - return new VirtualNetworkDnsResolverResource(client, id); - } - ); + return GetMockableDnsResolverArmClient(client).GetVirtualNetworkDnsResolverResource(id); } - #endregion - /// Gets a collection of DnsResolverResources in the ResourceGroupResource. + /// + /// Gets a collection of DnsResolverResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DnsResolverResources and their operations over a DnsResolverResource. public static DnsResolverCollection GetDnsResolvers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDnsResolvers(); + return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolvers(); } /// @@ -202,16 +172,20 @@ public static DnsResolverCollection GetDnsResolvers(this ResourceGroupResource r /// DnsResolvers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DNS resolver. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDnsResolverAsync(this ResourceGroupResource resourceGroupResource, string dnsResolverName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDnsResolvers().GetAsync(dnsResolverName, cancellationToken).ConfigureAwait(false); + return await GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolverAsync(dnsResolverName, cancellationToken).ConfigureAwait(false); } /// @@ -226,24 +200,34 @@ public static async Task> GetDnsResolverAsync(this /// DnsResolvers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DNS resolver. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDnsResolver(this ResourceGroupResource resourceGroupResource, string dnsResolverName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDnsResolvers().Get(dnsResolverName, cancellationToken); + return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolver(dnsResolverName, cancellationToken); } - /// Gets a collection of DnsForwardingRulesetResources in the ResourceGroupResource. + /// + /// Gets a collection of DnsForwardingRulesetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DnsForwardingRulesetResources and their operations over a DnsForwardingRulesetResource. public static DnsForwardingRulesetCollection GetDnsForwardingRulesets(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDnsForwardingRulesets(); + return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsForwardingRulesets(); } /// @@ -258,16 +242,20 @@ public static DnsForwardingRulesetCollection GetDnsForwardingRulesets(this Resou /// DnsForwardingRulesets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DNS forwarding ruleset. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDnsForwardingRulesetAsync(this ResourceGroupResource resourceGroupResource, string rulesetName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDnsForwardingRulesets().GetAsync(rulesetName, cancellationToken).ConfigureAwait(false); + return await GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsForwardingRulesetAsync(rulesetName, cancellationToken).ConfigureAwait(false); } /// @@ -282,16 +270,20 @@ public static async Task> GetDnsForwardin /// DnsForwardingRulesets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DNS forwarding ruleset. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDnsForwardingRuleset(this ResourceGroupResource resourceGroupResource, string rulesetName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDnsForwardingRulesets().Get(rulesetName, cancellationToken); + return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsForwardingRuleset(rulesetName, cancellationToken); } /// @@ -306,6 +298,10 @@ public static Response GetDnsForwardingRuleset(thi /// DnsResolvers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -313,7 +309,7 @@ public static Response GetDnsForwardingRuleset(thi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDnsResolversAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDnsResolversAsync(top, cancellationToken); + return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsResolversAsync(top, cancellationToken); } /// @@ -328,6 +324,10 @@ public static AsyncPageable GetDnsResolversAsync(this Subsc /// DnsResolvers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -335,7 +335,7 @@ public static AsyncPageable GetDnsResolversAsync(this Subsc /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDnsResolvers(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDnsResolvers(top, cancellationToken); + return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsResolvers(top, cancellationToken); } /// @@ -350,6 +350,10 @@ public static Pageable GetDnsResolvers(this SubscriptionRes /// DnsForwardingRulesets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -357,7 +361,7 @@ public static Pageable GetDnsResolvers(this SubscriptionRes /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDnsForwardingRulesetsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDnsForwardingRulesetsAsync(top, cancellationToken); + return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsForwardingRulesetsAsync(top, cancellationToken); } /// @@ -372,6 +376,10 @@ public static AsyncPageable GetDnsForwardingRulese /// DnsForwardingRulesets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -379,7 +387,7 @@ public static AsyncPageable GetDnsForwardingRulese /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDnsForwardingRulesets(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDnsForwardingRulesets(top, cancellationToken); + return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsForwardingRulesets(top, cancellationToken); } } } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverArmClient.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverArmClient.cs new file mode 100644 index 0000000000000..afd912c9b3f73 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DnsResolver; + +namespace Azure.ResourceManager.DnsResolver.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDnsResolverArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDnsResolverArmClient() + { + } + + /// 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 MockableDnsResolverArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDnsResolverArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsResolverResource GetDnsResolverResource(ResourceIdentifier id) + { + DnsResolverResource.ValidateResourceId(id); + return new DnsResolverResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsResolverInboundEndpointResource GetDnsResolverInboundEndpointResource(ResourceIdentifier id) + { + DnsResolverInboundEndpointResource.ValidateResourceId(id); + return new DnsResolverInboundEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsResolverOutboundEndpointResource GetDnsResolverOutboundEndpointResource(ResourceIdentifier id) + { + DnsResolverOutboundEndpointResource.ValidateResourceId(id); + return new DnsResolverOutboundEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsForwardingRulesetResource GetDnsForwardingRulesetResource(ResourceIdentifier id) + { + DnsForwardingRulesetResource.ValidateResourceId(id); + return new DnsForwardingRulesetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsForwardingRuleResource GetDnsForwardingRuleResource(ResourceIdentifier id) + { + DnsForwardingRuleResource.ValidateResourceId(id); + return new DnsForwardingRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsForwardingRulesetVirtualNetworkLinkResource GetDnsForwardingRulesetVirtualNetworkLinkResource(ResourceIdentifier id) + { + DnsForwardingRulesetVirtualNetworkLinkResource.ValidateResourceId(id); + return new DnsForwardingRulesetVirtualNetworkLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkDnsResolverResource GetVirtualNetworkDnsResolverResource(ResourceIdentifier id) + { + VirtualNetworkDnsResolverResource.ValidateResourceId(id); + return new VirtualNetworkDnsResolverResource(Client, id); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverResourceGroupResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverResourceGroupResource.cs new file mode 100644 index 0000000000000..c74d0f58e8083 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.DnsResolver; + +namespace Azure.ResourceManager.DnsResolver.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDnsResolverResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDnsResolverResourceGroupResource() + { + } + + /// 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 MockableDnsResolverResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DnsResolverResources in the ResourceGroupResource. + /// An object representing collection of DnsResolverResources and their operations over a DnsResolverResource. + public virtual DnsResolverCollection GetDnsResolvers() + { + return GetCachedClient(client => new DnsResolverCollection(client, Id)); + } + + /// + /// Gets properties of a DNS resolver. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName} + /// + /// + /// Operation Id + /// DnsResolvers_Get + /// + /// + /// + /// The name of the DNS resolver. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDnsResolverAsync(string dnsResolverName, CancellationToken cancellationToken = default) + { + return await GetDnsResolvers().GetAsync(dnsResolverName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a DNS resolver. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName} + /// + /// + /// Operation Id + /// DnsResolvers_Get + /// + /// + /// + /// The name of the DNS resolver. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDnsResolver(string dnsResolverName, CancellationToken cancellationToken = default) + { + return GetDnsResolvers().Get(dnsResolverName, cancellationToken); + } + + /// Gets a collection of DnsForwardingRulesetResources in the ResourceGroupResource. + /// An object representing collection of DnsForwardingRulesetResources and their operations over a DnsForwardingRulesetResource. + public virtual DnsForwardingRulesetCollection GetDnsForwardingRulesets() + { + return GetCachedClient(client => new DnsForwardingRulesetCollection(client, Id)); + } + + /// + /// Gets a DNS forwarding ruleset properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName} + /// + /// + /// Operation Id + /// DnsForwardingRulesets_Get + /// + /// + /// + /// The name of the DNS forwarding ruleset. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDnsForwardingRulesetAsync(string rulesetName, CancellationToken cancellationToken = default) + { + return await GetDnsForwardingRulesets().GetAsync(rulesetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a DNS forwarding ruleset properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName} + /// + /// + /// Operation Id + /// DnsForwardingRulesets_Get + /// + /// + /// + /// The name of the DNS forwarding ruleset. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDnsForwardingRuleset(string rulesetName, CancellationToken cancellationToken = default) + { + return GetDnsForwardingRulesets().Get(rulesetName, cancellationToken); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverSubscriptionResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverSubscriptionResource.cs new file mode 100644 index 0000000000000..d1339e0add3df --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverSubscriptionResource.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DnsResolver; + +namespace Azure.ResourceManager.DnsResolver.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDnsResolverSubscriptionResource : ArmResource + { + private ClientDiagnostics _dnsResolverClientDiagnostics; + private DnsResolversRestOperations _dnsResolverRestClient; + private ClientDiagnostics _dnsForwardingRulesetClientDiagnostics; + private DnsForwardingRulesetsRestOperations _dnsForwardingRulesetRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDnsResolverSubscriptionResource() + { + } + + /// 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 MockableDnsResolverSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DnsResolverClientDiagnostics => _dnsResolverClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsResolverResource.ResourceType.Namespace, Diagnostics); + private DnsResolversRestOperations DnsResolverRestClient => _dnsResolverRestClient ??= new DnsResolversRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsResolverResource.ResourceType)); + private ClientDiagnostics DnsForwardingRulesetClientDiagnostics => _dnsForwardingRulesetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsForwardingRulesetResource.ResourceType.Namespace, Diagnostics); + private DnsForwardingRulesetsRestOperations DnsForwardingRulesetRestClient => _dnsForwardingRulesetRestClient ??= new DnsForwardingRulesetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsForwardingRulesetResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists DNS resolvers in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers + /// + /// + /// Operation Id + /// DnsResolvers_List + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDnsResolversAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsResolverRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsResolverRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsResolverResource(Client, DnsResolverData.DeserializeDnsResolverData(e)), DnsResolverClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsResolvers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS resolvers in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers + /// + /// + /// Operation Id + /// DnsResolvers_List + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDnsResolvers(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsResolverRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsResolverRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsResolverResource(Client, DnsResolverData.DeserializeDnsResolverData(e)), DnsResolverClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsResolvers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS forwarding rulesets in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets + /// + /// + /// Operation Id + /// DnsForwardingRulesets_List + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDnsForwardingRulesetsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsForwardingRulesetRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsForwardingRulesetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsForwardingRulesetResource(Client, DnsForwardingRulesetData.DeserializeDnsForwardingRulesetData(e)), DnsForwardingRulesetClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsForwardingRulesets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS forwarding rulesets in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets + /// + /// + /// Operation Id + /// DnsForwardingRulesets_List + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDnsForwardingRulesets(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsForwardingRulesetRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsForwardingRulesetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsForwardingRulesetResource(Client, DnsForwardingRulesetData.DeserializeDnsForwardingRulesetData(e)), DnsForwardingRulesetClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsForwardingRulesets", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index e0ea8a2b99f38..0000000000000 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DnsResolver -{ - /// 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 DnsResolverResources in the ResourceGroupResource. - /// An object representing collection of DnsResolverResources and their operations over a DnsResolverResource. - public virtual DnsResolverCollection GetDnsResolvers() - { - return GetCachedClient(Client => new DnsResolverCollection(Client, Id)); - } - - /// Gets a collection of DnsForwardingRulesetResources in the ResourceGroupResource. - /// An object representing collection of DnsForwardingRulesetResources and their operations over a DnsForwardingRulesetResource. - public virtual DnsForwardingRulesetCollection GetDnsForwardingRulesets() - { - return GetCachedClient(Client => new DnsForwardingRulesetCollection(Client, Id)); - } - } -} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index e0bf4b74acbc2..0000000000000 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.DnsResolver -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dnsResolverClientDiagnostics; - private DnsResolversRestOperations _dnsResolverRestClient; - private ClientDiagnostics _dnsForwardingRulesetClientDiagnostics; - private DnsForwardingRulesetsRestOperations _dnsForwardingRulesetRestClient; - - /// 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 DnsResolverClientDiagnostics => _dnsResolverClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsResolverResource.ResourceType.Namespace, Diagnostics); - private DnsResolversRestOperations DnsResolverRestClient => _dnsResolverRestClient ??= new DnsResolversRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsResolverResource.ResourceType)); - private ClientDiagnostics DnsForwardingRulesetClientDiagnostics => _dnsForwardingRulesetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsForwardingRulesetResource.ResourceType.Namespace, Diagnostics); - private DnsForwardingRulesetsRestOperations DnsForwardingRulesetRestClient => _dnsForwardingRulesetRestClient ??= new DnsForwardingRulesetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsForwardingRulesetResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists DNS resolvers in all resource groups of a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers - /// - /// - /// Operation Id - /// DnsResolvers_List - /// - /// - /// - /// The maximum number of results to return. If not specified, returns up to 100 results. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDnsResolversAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DnsResolverRestClient.CreateListRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsResolverRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsResolverResource(Client, DnsResolverData.DeserializeDnsResolverData(e)), DnsResolverClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDnsResolvers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists DNS resolvers in all resource groups of a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers - /// - /// - /// Operation Id - /// DnsResolvers_List - /// - /// - /// - /// The maximum number of results to return. If not specified, returns up to 100 results. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDnsResolvers(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DnsResolverRestClient.CreateListRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsResolverRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsResolverResource(Client, DnsResolverData.DeserializeDnsResolverData(e)), DnsResolverClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDnsResolvers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists DNS forwarding rulesets in all resource groups of a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets - /// - /// - /// Operation Id - /// DnsForwardingRulesets_List - /// - /// - /// - /// The maximum number of results to return. If not specified, returns up to 100 results. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDnsForwardingRulesetsAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DnsForwardingRulesetRestClient.CreateListRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsForwardingRulesetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsForwardingRulesetResource(Client, DnsForwardingRulesetData.DeserializeDnsForwardingRulesetData(e)), DnsForwardingRulesetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDnsForwardingRulesets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists DNS forwarding rulesets in all resource groups of a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsForwardingRulesets - /// - /// - /// Operation Id - /// DnsForwardingRulesets_List - /// - /// - /// - /// The maximum number of results to return. If not specified, returns up to 100 results. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDnsForwardingRulesets(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DnsForwardingRulesetRestClient.CreateListRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsForwardingRulesetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsForwardingRulesetResource(Client, DnsForwardingRulesetData.DeserializeDnsForwardingRulesetData(e)), DnsForwardingRulesetClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDnsForwardingRulesets", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/VirtualNetworkDnsResolverResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/VirtualNetworkDnsResolverResource.cs index a7fc4d23f048d..ed7acd1d67282 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/VirtualNetworkDnsResolverResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/VirtualNetworkDnsResolverResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.DnsResolver public partial class VirtualNetworkDnsResolverResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkName. internal static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}"; diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/api/Azure.ResourceManager.Dynatrace.netstandard2.0.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/api/Azure.ResourceManager.Dynatrace.netstandard2.0.cs index d5a90d150b75f..341cc9006a67c 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/api/Azure.ResourceManager.Dynatrace.netstandard2.0.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/api/Azure.ResourceManager.Dynatrace.netstandard2.0.cs @@ -30,7 +30,7 @@ protected DynatraceMonitorCollection() { } } public partial class DynatraceMonitorData : Azure.ResourceManager.Models.TrackedResourceData { - public DynatraceMonitorData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DynatraceMonitorData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Dynatrace.Models.DynatraceEnvironmentProperties DynatraceEnvironmentProperties { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Dynatrace.Models.LiftrResourceCategory? LiftrResourceCategory { get { throw null; } } @@ -158,6 +158,29 @@ protected DynatraceTagRuleResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Dynatrace.Models.DynatraceTagRulePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Dynatrace.Mocking +{ + public partial class MockableDynatraceArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDynatraceArmClient() { } + public virtual Azure.ResourceManager.Dynatrace.DynatraceMonitorResource GetDynatraceMonitorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dynatrace.DynatraceSingleSignOnResource GetDynatraceSingleSignOnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Dynatrace.DynatraceTagRuleResource GetDynatraceTagRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDynatraceResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDynatraceResourceGroupResource() { } + public virtual Azure.Response GetDynatraceMonitor(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDynatraceMonitorAsync(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Dynatrace.DynatraceMonitorCollection GetDynatraceMonitors() { throw null; } + } + public partial class MockableDynatraceSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDynatraceSubscriptionResource() { } + public virtual Azure.Pageable GetDynatraceMonitors(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDynatraceMonitorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Dynatrace.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorResource.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorResource.cs index f381dfc109d4c..6b05b102325f5 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorResource.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Dynatrace public partial class DynatraceMonitorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DynatraceTagRuleResources and their operations over a DynatraceTagRuleResource. public virtual DynatraceTagRuleCollection GetDynatraceTagRules() { - return GetCachedClient(Client => new DynatraceTagRuleCollection(Client, Id)); + return GetCachedClient(client => new DynatraceTagRuleCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual DynatraceTagRuleCollection GetDynatraceTagRules() /// /// Monitor resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDynatraceTagRuleAsync(string ruleSetName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetDynatraceTagRul /// /// Monitor resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDynatraceTagRule(string ruleSetName, CancellationToken cancellationToken = default) { @@ -147,7 +150,7 @@ public virtual Response GetDynatraceTagRule(string rul /// An object representing collection of DynatraceSingleSignOnResources and their operations over a DynatraceSingleSignOnResource. public virtual DynatraceSingleSignOnCollection GetDynatraceSingleSignOns() { - return GetCachedClient(Client => new DynatraceSingleSignOnCollection(Client, Id)); + return GetCachedClient(client => new DynatraceSingleSignOnCollection(client, Id)); } /// @@ -165,8 +168,8 @@ public virtual DynatraceSingleSignOnCollection GetDynatraceSingleSignOns() /// /// Single Sign On Configuration Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDynatraceSingleSignOnAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -188,8 +191,8 @@ public virtual async Task> GetDynatraceS /// /// Single Sign On Configuration Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDynatraceSingleSignOn(string configurationName, CancellationToken cancellationToken = default) { diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceSingleSignOnResource.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceSingleSignOnResource.cs index 250f089ec0a02..b07845ccee50f 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceSingleSignOnResource.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceSingleSignOnResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Dynatrace public partial class DynatraceSingleSignOnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}"; diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceTagRuleResource.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceTagRuleResource.cs index 856772beac159..cdab7b8c8e5dc 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceTagRuleResource.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceTagRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Dynatrace public partial class DynatraceTagRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. + /// The ruleSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"; diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/DynatraceExtensions.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/DynatraceExtensions.cs index 99b1769090d9f..502d21599f04c 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/DynatraceExtensions.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/DynatraceExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Dynatrace.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Dynatrace @@ -18,100 +19,81 @@ namespace Azure.ResourceManager.Dynatrace /// A class to add extension methods to Azure.ResourceManager.Dynatrace. public static partial class DynatraceExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableDynatraceArmClient GetMockableDynatraceArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableDynatraceArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableDynatraceResourceGroupResource GetMockableDynatraceResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableDynatraceResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableDynatraceSubscriptionResource GetMockableDynatraceSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableDynatraceSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DynatraceMonitorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DynatraceMonitorResource GetDynatraceMonitorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DynatraceMonitorResource.ValidateResourceId(id); - return new DynatraceMonitorResource(client, id); - } - ); + return GetMockableDynatraceArmClient(client).GetDynatraceMonitorResource(id); } - #endregion - #region DynatraceTagRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DynatraceTagRuleResource GetDynatraceTagRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DynatraceTagRuleResource.ValidateResourceId(id); - return new DynatraceTagRuleResource(client, id); - } - ); + return GetMockableDynatraceArmClient(client).GetDynatraceTagRuleResource(id); } - #endregion - #region DynatraceSingleSignOnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DynatraceSingleSignOnResource GetDynatraceSingleSignOnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DynatraceSingleSignOnResource.ValidateResourceId(id); - return new DynatraceSingleSignOnResource(client, id); - } - ); + return GetMockableDynatraceArmClient(client).GetDynatraceSingleSignOnResource(id); } - #endregion - /// Gets a collection of DynatraceMonitorResources in the ResourceGroupResource. + /// + /// Gets a collection of DynatraceMonitorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DynatraceMonitorResources and their operations over a DynatraceMonitorResource. public static DynatraceMonitorCollection GetDynatraceMonitors(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDynatraceMonitors(); + return GetMockableDynatraceResourceGroupResource(resourceGroupResource).GetDynatraceMonitors(); } /// @@ -126,16 +108,20 @@ public static DynatraceMonitorCollection GetDynatraceMonitors(this ResourceGroup /// Monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Monitor resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDynatraceMonitorAsync(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDynatraceMonitors().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + return await GetMockableDynatraceResourceGroupResource(resourceGroupResource).GetDynatraceMonitorAsync(monitorName, cancellationToken).ConfigureAwait(false); } /// @@ -150,16 +136,20 @@ public static async Task> GetDynatraceMonitor /// Monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Monitor resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDynatraceMonitor(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDynatraceMonitors().Get(monitorName, cancellationToken); + return GetMockableDynatraceResourceGroupResource(resourceGroupResource).GetDynatraceMonitor(monitorName, cancellationToken); } /// @@ -174,13 +164,17 @@ public static Response GetDynatraceMonitor(this Resour /// Monitors_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDynatraceMonitorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDynatraceMonitorsAsync(cancellationToken); + return GetMockableDynatraceSubscriptionResource(subscriptionResource).GetDynatraceMonitorsAsync(cancellationToken); } /// @@ -195,13 +189,17 @@ public static AsyncPageable GetDynatraceMonitorsAsync( /// Monitors_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDynatraceMonitors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDynatraceMonitors(cancellationToken); + return GetMockableDynatraceSubscriptionResource(subscriptionResource).GetDynatraceMonitors(cancellationToken); } } } diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceArmClient.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceArmClient.cs new file mode 100644 index 0000000000000..71cb35574aff0 --- /dev/null +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Dynatrace; + +namespace Azure.ResourceManager.Dynatrace.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDynatraceArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDynatraceArmClient() + { + } + + /// 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 MockableDynatraceArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDynatraceArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DynatraceMonitorResource GetDynatraceMonitorResource(ResourceIdentifier id) + { + DynatraceMonitorResource.ValidateResourceId(id); + return new DynatraceMonitorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DynatraceTagRuleResource GetDynatraceTagRuleResource(ResourceIdentifier id) + { + DynatraceTagRuleResource.ValidateResourceId(id); + return new DynatraceTagRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DynatraceSingleSignOnResource GetDynatraceSingleSignOnResource(ResourceIdentifier id) + { + DynatraceSingleSignOnResource.ValidateResourceId(id); + return new DynatraceSingleSignOnResource(Client, id); + } + } +} diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceResourceGroupResource.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceResourceGroupResource.cs new file mode 100644 index 0000000000000..42f6131f98cf1 --- /dev/null +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Dynatrace; + +namespace Azure.ResourceManager.Dynatrace.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDynatraceResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDynatraceResourceGroupResource() + { + } + + /// 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 MockableDynatraceResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DynatraceMonitorResources in the ResourceGroupResource. + /// An object representing collection of DynatraceMonitorResources and their operations over a DynatraceMonitorResource. + public virtual DynatraceMonitorCollection GetDynatraceMonitors() + { + return GetCachedClient(client => new DynatraceMonitorCollection(client, Id)); + } + + /// + /// Get a MonitorResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDynatraceMonitorAsync(string monitorName, CancellationToken cancellationToken = default) + { + return await GetDynatraceMonitors().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a MonitorResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDynatraceMonitor(string monitorName, CancellationToken cancellationToken = default) + { + return GetDynatraceMonitors().Get(monitorName, cancellationToken); + } + } +} diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceSubscriptionResource.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceSubscriptionResource.cs new file mode 100644 index 0000000000000..56a5bc210884d --- /dev/null +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/MockableDynatraceSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dynatrace; + +namespace Azure.ResourceManager.Dynatrace.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDynatraceSubscriptionResource : ArmResource + { + private ClientDiagnostics _dynatraceMonitorMonitorsClientDiagnostics; + private MonitorsRestOperations _dynatraceMonitorMonitorsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDynatraceSubscriptionResource() + { + } + + /// 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 MockableDynatraceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DynatraceMonitorMonitorsClientDiagnostics => _dynatraceMonitorMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Dynatrace", DynatraceMonitorResource.ResourceType.Namespace, Diagnostics); + private MonitorsRestOperations DynatraceMonitorMonitorsRestClient => _dynatraceMonitorMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DynatraceMonitorResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all MonitorResource by subscriptionId + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors + /// + /// + /// Operation Id + /// Monitors_ListBySubscriptionId + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDynatraceMonitorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DynatraceMonitorMonitorsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DynatraceMonitorMonitorsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DynatraceMonitorResource(Client, DynatraceMonitorData.DeserializeDynatraceMonitorData(e)), DynatraceMonitorMonitorsClientDiagnostics, Pipeline, "MockableDynatraceSubscriptionResource.GetDynatraceMonitors", "value", "nextLink", cancellationToken); + } + + /// + /// List all MonitorResource by subscriptionId + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors + /// + /// + /// Operation Id + /// Monitors_ListBySubscriptionId + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDynatraceMonitors(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DynatraceMonitorMonitorsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DynatraceMonitorMonitorsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DynatraceMonitorResource(Client, DynatraceMonitorData.DeserializeDynatraceMonitorData(e)), DynatraceMonitorMonitorsClientDiagnostics, Pipeline, "MockableDynatraceSubscriptionResource.GetDynatraceMonitors", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 604a09c292bdb..0000000000000 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Dynatrace -{ - /// 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 DynatraceMonitorResources in the ResourceGroupResource. - /// An object representing collection of DynatraceMonitorResources and their operations over a DynatraceMonitorResource. - public virtual DynatraceMonitorCollection GetDynatraceMonitors() - { - return GetCachedClient(Client => new DynatraceMonitorCollection(Client, Id)); - } - } -} diff --git a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 217284f0d0c32..0000000000000 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Dynatrace -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dynatraceMonitorMonitorsClientDiagnostics; - private MonitorsRestOperations _dynatraceMonitorMonitorsRestClient; - - /// 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 DynatraceMonitorMonitorsClientDiagnostics => _dynatraceMonitorMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Dynatrace", DynatraceMonitorResource.ResourceType.Namespace, Diagnostics); - private MonitorsRestOperations DynatraceMonitorMonitorsRestClient => _dynatraceMonitorMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DynatraceMonitorResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all MonitorResource by subscriptionId - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors - /// - /// - /// Operation Id - /// Monitors_ListBySubscriptionId - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDynatraceMonitorsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DynatraceMonitorMonitorsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DynatraceMonitorMonitorsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DynatraceMonitorResource(Client, DynatraceMonitorData.DeserializeDynatraceMonitorData(e)), DynatraceMonitorMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDynatraceMonitors", "value", "nextLink", cancellationToken); - } - - /// - /// List all MonitorResource by subscriptionId - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors - /// - /// - /// Operation Id - /// Monitors_ListBySubscriptionId - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDynatraceMonitors(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DynatraceMonitorMonitorsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DynatraceMonitorMonitorsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DynatraceMonitorResource(Client, DynatraceMonitorData.DeserializeDynatraceMonitorData(e)), DynatraceMonitorMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDynatraceMonitors", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/Azure.ResourceManager.EdgeOrder.sln b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/Azure.ResourceManager.EdgeOrder.sln index a0b66fdc1d6a0..9f85cc2b7c230 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/Azure.ResourceManager.EdgeOrder.sln +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/Azure.ResourceManager.EdgeOrder.sln @@ -57,6 +57,18 @@ Global {8BAF18E1-C7C2-4D44-BA67-48301CA9914C}.Release|x64.Build.0 = Release|Any CPU {8BAF18E1-C7C2-4D44-BA67-48301CA9914C}.Release|x86.ActiveCfg = Release|Any CPU {8BAF18E1-C7C2-4D44-BA67-48301CA9914C}.Release|x86.Build.0 = Release|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Debug|x64.ActiveCfg = Debug|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Debug|x64.Build.0 = Debug|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Debug|x86.ActiveCfg = Debug|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Debug|x86.Build.0 = Debug|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Release|Any CPU.Build.0 = Release|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Release|x64.ActiveCfg = Release|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Release|x64.Build.0 = Release|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Release|x86.ActiveCfg = Release|Any CPU + {8EDFEDE2-CB48-4683-BAFE-55AAA38FA87C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/api/Azure.ResourceManager.EdgeOrder.netstandard2.0.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/api/Azure.ResourceManager.EdgeOrder.netstandard2.0.cs index c994f48522d2f..460323ff53609 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/api/Azure.ResourceManager.EdgeOrder.netstandard2.0.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/api/Azure.ResourceManager.EdgeOrder.netstandard2.0.cs @@ -19,7 +19,7 @@ protected EdgeOrderAddressCollection() { } } public partial class EdgeOrderAddressData : Azure.ResourceManager.Models.TrackedResourceData { - public EdgeOrderAddressData(Azure.Core.AzureLocation location, Azure.ResourceManager.EdgeOrder.Models.EdgeOrderAddressContactDetails contactDetails) : base (default(Azure.Core.AzureLocation)) { } + public EdgeOrderAddressData(Azure.Core.AzureLocation location, Azure.ResourceManager.EdgeOrder.Models.EdgeOrderAddressContactDetails contactDetails) { } public Azure.ResourceManager.EdgeOrder.Models.EdgeOrderAddressValidationStatus? AddressValidationStatus { get { throw null; } } public Azure.ResourceManager.EdgeOrder.Models.EdgeOrderAddressContactDetails ContactDetails { get { throw null; } set { } } public Azure.ResourceManager.EdgeOrder.Models.EdgeOrderShippingAddress ShippingAddress { get { throw null; } set { } } @@ -109,7 +109,7 @@ protected EdgeOrderItemCollection() { } } public partial class EdgeOrderItemData : Azure.ResourceManager.Models.TrackedResourceData { - public EdgeOrderItemData(Azure.Core.AzureLocation location, Azure.ResourceManager.EdgeOrder.Models.EdgeOrderItemDetails orderItemDetails, Azure.ResourceManager.EdgeOrder.Models.EdgeOrderItemAddressDetails addressDetails, Azure.Core.ResourceIdentifier orderId) : base (default(Azure.Core.AzureLocation)) { } + public EdgeOrderItemData(Azure.Core.AzureLocation location, Azure.ResourceManager.EdgeOrder.Models.EdgeOrderItemDetails orderItemDetails, Azure.ResourceManager.EdgeOrder.Models.EdgeOrderItemAddressDetails addressDetails, Azure.Core.ResourceIdentifier orderId) { } public Azure.ResourceManager.EdgeOrder.Models.EdgeOrderItemAddressDetails AddressDetails { get { throw null; } set { } } public Azure.Core.ResourceIdentifier OrderId { get { throw null; } set { } } public Azure.ResourceManager.EdgeOrder.Models.EdgeOrderItemDetails OrderItemDetails { get { throw null; } set { } } @@ -150,6 +150,47 @@ protected EdgeOrderResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.EdgeOrder.Mocking +{ + public partial class MockableEdgeOrderArmClient : Azure.ResourceManager.ArmResource + { + protected MockableEdgeOrderArmClient() { } + public virtual Azure.ResourceManager.EdgeOrder.EdgeOrderAddressResource GetEdgeOrderAddressResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EdgeOrder.EdgeOrderItemResource GetEdgeOrderItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EdgeOrder.EdgeOrderResource GetEdgeOrderResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableEdgeOrderResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableEdgeOrderResourceGroupResource() { } + public virtual Azure.Response GetEdgeOrder(Azure.Core.AzureLocation location, string orderName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetEdgeOrderAddress(string addressName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEdgeOrderAddressAsync(string addressName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EdgeOrder.EdgeOrderAddressCollection GetEdgeOrderAddresses() { throw null; } + public virtual System.Threading.Tasks.Task> GetEdgeOrderAsync(Azure.Core.AzureLocation location, string orderName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetEdgeOrderItem(string orderItemName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEdgeOrderItemAsync(string orderItemName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EdgeOrder.EdgeOrderItemCollection GetEdgeOrderItems() { throw null; } + public virtual Azure.ResourceManager.EdgeOrder.EdgeOrderCollection GetEdgeOrders() { throw null; } + public virtual Azure.Pageable GetEdgeOrders(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEdgeOrdersAsync(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableEdgeOrderSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableEdgeOrderSubscriptionResource() { } + public virtual Azure.Pageable GetConfigurations(Azure.ResourceManager.EdgeOrder.Models.ConfigurationsContent content, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfigurationsAsync(Azure.ResourceManager.EdgeOrder.Models.ConfigurationsContent content, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEdgeOrderAddresses(string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEdgeOrderAddressesAsync(string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEdgeOrderItems(string filter = null, string expand = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEdgeOrderItemsAsync(string filter = null, string expand = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEdgeOrders(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEdgeOrdersAsync(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProductFamilies(Azure.ResourceManager.EdgeOrder.Models.ProductFamiliesContent content, string expand = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProductFamiliesAsync(Azure.ResourceManager.EdgeOrder.Models.ProductFamiliesContent content, string expand = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProductFamiliesMetadata(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProductFamiliesMetadataAsync(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.EdgeOrder.Models { public static partial class ArmEdgeOrderModelFactory diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.cs index ba8927773624e..b9bb18a4f9fb8 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderAddressResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EdgeOrder public partial class EdgeOrderAddressResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The addressName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string addressName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName}"; diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.cs index ce0679372841b..e69b3f9e709db 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderItemResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EdgeOrder public partial class EdgeOrderItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The orderItemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string orderItemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName}"; diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.cs index 2c192697a6f7f..3e769a3c0e643 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/EdgeOrderResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EdgeOrder public partial class EdgeOrderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The location. + /// The orderName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation location, string orderName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName}"; diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs index 131b6cf1c107f..a0125f512ec07 100644 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.EdgeOrder.Mocking; using Azure.ResourceManager.EdgeOrder.Models; using Azure.ResourceManager.Resources; @@ -19,100 +20,81 @@ namespace Azure.ResourceManager.EdgeOrder /// A class to add extension methods to Azure.ResourceManager.EdgeOrder. public static partial class EdgeOrderExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableEdgeOrderArmClient GetMockableEdgeOrderArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableEdgeOrderArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableEdgeOrderResourceGroupResource GetMockableEdgeOrderResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableEdgeOrderResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableEdgeOrderSubscriptionResource GetMockableEdgeOrderSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableEdgeOrderSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region EdgeOrderAddressResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EdgeOrderAddressResource GetEdgeOrderAddressResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EdgeOrderAddressResource.ValidateResourceId(id); - return new EdgeOrderAddressResource(client, id); - } - ); + return GetMockableEdgeOrderArmClient(client).GetEdgeOrderAddressResource(id); } - #endregion - #region EdgeOrderResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EdgeOrderResource GetEdgeOrderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EdgeOrderResource.ValidateResourceId(id); - return new EdgeOrderResource(client, id); - } - ); + return GetMockableEdgeOrderArmClient(client).GetEdgeOrderResource(id); } - #endregion - #region EdgeOrderItemResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EdgeOrderItemResource GetEdgeOrderItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EdgeOrderItemResource.ValidateResourceId(id); - return new EdgeOrderItemResource(client, id); - } - ); + return GetMockableEdgeOrderArmClient(client).GetEdgeOrderItemResource(id); } - #endregion - /// Gets a collection of EdgeOrderAddressResources in the ResourceGroupResource. + /// + /// Gets a collection of EdgeOrderAddressResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EdgeOrderAddressResources and their operations over a EdgeOrderAddressResource. public static EdgeOrderAddressCollection GetEdgeOrderAddresses(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEdgeOrderAddresses(); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderAddresses(); } /// @@ -127,16 +109,20 @@ public static EdgeOrderAddressCollection GetEdgeOrderAddresses(this ResourceGrou /// GetAddressByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEdgeOrderAddressAsync(this ResourceGroupResource resourceGroupResource, string addressName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEdgeOrderAddresses().GetAsync(addressName, cancellationToken).ConfigureAwait(false); + return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderAddressAsync(addressName, cancellationToken).ConfigureAwait(false); } /// @@ -151,24 +137,34 @@ public static async Task> GetEdgeOrderAddress /// GetAddressByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEdgeOrderAddress(this ResourceGroupResource resourceGroupResource, string addressName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEdgeOrderAddresses().Get(addressName, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderAddress(addressName, cancellationToken); } - /// Gets a collection of EdgeOrderResources in the ResourceGroupResource. + /// + /// Gets a collection of EdgeOrderResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EdgeOrderResources and their operations over a EdgeOrderResource. public static EdgeOrderCollection GetEdgeOrders(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEdgeOrders(); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrders(); } /// @@ -183,17 +179,21 @@ public static EdgeOrderCollection GetEdgeOrders(this ResourceGroupResource resou /// GetOrderByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. /// The name of the order. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEdgeOrderAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string orderName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEdgeOrders().GetAsync(location, orderName, cancellationToken).ConfigureAwait(false); + return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderAsync(location, orderName, cancellationToken).ConfigureAwait(false); } /// @@ -208,25 +208,35 @@ public static async Task> GetEdgeOrderAsync(this Res /// GetOrderByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. /// The name of the order. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEdgeOrder(this ResourceGroupResource resourceGroupResource, AzureLocation location, string orderName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEdgeOrders().Get(location, orderName, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrder(location, orderName, cancellationToken); } - /// Gets a collection of EdgeOrderItemResources in the ResourceGroupResource. + /// + /// Gets a collection of EdgeOrderItemResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EdgeOrderItemResources and their operations over a EdgeOrderItemResource. public static EdgeOrderItemCollection GetEdgeOrderItems(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEdgeOrderItems(); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderItems(); } /// @@ -241,17 +251,21 @@ public static EdgeOrderItemCollection GetEdgeOrderItems(this ResourceGroupResour /// GetOrderItemByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the order item. /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEdgeOrderItemAsync(this ResourceGroupResource resourceGroupResource, string orderItemName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEdgeOrderItems().GetAsync(orderItemName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderItemAsync(orderItemName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -266,17 +280,21 @@ public static async Task> GetEdgeOrderItemAsync( /// GetOrderItemByName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the order item. /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEdgeOrderItem(this ResourceGroupResource resourceGroupResource, string orderItemName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEdgeOrderItems().Get(orderItemName, expand, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrderItem(orderItemName, expand, cancellationToken); } /// @@ -291,6 +309,10 @@ public static Response GetEdgeOrderItem(this ResourceGrou /// ListOrderAtResourceGroupLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $skipToken is supported on Get list of order, which provides the next page in the list of order. @@ -298,7 +320,7 @@ public static Response GetEdgeOrderItem(this ResourceGrou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetEdgeOrdersAsync(this ResourceGroupResource resourceGroupResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEdgeOrdersAsync(skipToken, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrdersAsync(skipToken, cancellationToken); } /// @@ -313,6 +335,10 @@ public static AsyncPageable GetEdgeOrdersAsync(this ResourceG /// ListOrderAtResourceGroupLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $skipToken is supported on Get list of order, which provides the next page in the list of order. @@ -320,7 +346,7 @@ public static AsyncPageable GetEdgeOrdersAsync(this ResourceG /// A collection of that may take multiple service requests to iterate over. public static Pageable GetEdgeOrders(this ResourceGroupResource resourceGroupResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEdgeOrders(skipToken, cancellationToken); + return GetMockableEdgeOrderResourceGroupResource(resourceGroupResource).GetEdgeOrders(skipToken, cancellationToken); } /// @@ -335,6 +361,10 @@ public static Pageable GetEdgeOrders(this ResourceGroupResour /// ListAddressesAtSubscriptionLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. @@ -343,7 +373,7 @@ public static Pageable GetEdgeOrders(this ResourceGroupResour /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetEdgeOrderAddressesAsync(this SubscriptionResource subscriptionResource, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEdgeOrderAddressesAsync(filter, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrderAddressesAsync(filter, skipToken, cancellationToken); } /// @@ -358,6 +388,10 @@ public static AsyncPageable GetEdgeOrderAddressesAsync /// ListAddressesAtSubscriptionLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. @@ -366,7 +400,7 @@ public static AsyncPageable GetEdgeOrderAddressesAsync /// A collection of that may take multiple service requests to iterate over. public static Pageable GetEdgeOrderAddresses(this SubscriptionResource subscriptionResource, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEdgeOrderAddresses(filter, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrderAddresses(filter, skipToken, cancellationToken); } /// @@ -381,6 +415,10 @@ public static Pageable GetEdgeOrderAddresses(this Subs /// ListProductFamilies /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Filters for showing the product families. @@ -391,9 +429,7 @@ public static Pageable GetEdgeOrderAddresses(this Subs /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetProductFamiliesAsync(this SubscriptionResource subscriptionResource, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProductFamiliesAsync(content, expand, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesAsync(content, expand, skipToken, cancellationToken); } /// @@ -408,6 +444,10 @@ public static AsyncPageable GetProductFamiliesAsync(this Subscrip /// ListProductFamilies /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Filters for showing the product families. @@ -418,9 +458,7 @@ public static AsyncPageable GetProductFamiliesAsync(this Subscrip /// A collection of that may take multiple service requests to iterate over. public static Pageable GetProductFamilies(this SubscriptionResource subscriptionResource, ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProductFamilies(content, expand, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamilies(content, expand, skipToken, cancellationToken); } /// @@ -435,6 +473,10 @@ public static Pageable GetProductFamilies(this SubscriptionResour /// ListConfigurations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Filters for showing the configurations. @@ -444,9 +486,7 @@ public static Pageable GetProductFamilies(this SubscriptionResour /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetConfigurationsAsync(this SubscriptionResource subscriptionResource, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurationsAsync(content, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetConfigurationsAsync(content, skipToken, cancellationToken); } /// @@ -461,6 +501,10 @@ public static AsyncPageable GetConfigurationsAsync(this Su /// ListConfigurations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Filters for showing the configurations. @@ -470,9 +514,7 @@ public static AsyncPageable GetConfigurationsAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetConfigurations(this SubscriptionResource subscriptionResource, ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurations(content, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetConfigurations(content, skipToken, cancellationToken); } /// @@ -487,6 +529,10 @@ public static Pageable GetConfigurations(this Subscription /// ListProductFamiliesMetadata /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. @@ -494,7 +540,7 @@ public static Pageable GetConfigurations(this Subscription /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetProductFamiliesMetadataAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProductFamiliesMetadataAsync(skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesMetadataAsync(skipToken, cancellationToken); } /// @@ -509,6 +555,10 @@ public static AsyncPageable GetProductFamiliesMetadataA /// ListProductFamiliesMetadata /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. @@ -516,7 +566,7 @@ public static AsyncPageable GetProductFamiliesMetadataA /// A collection of that may take multiple service requests to iterate over. public static Pageable GetProductFamiliesMetadata(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProductFamiliesMetadata(skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetProductFamiliesMetadata(skipToken, cancellationToken); } /// @@ -531,6 +581,10 @@ public static Pageable GetProductFamiliesMetadata(this /// ListOrderAtSubscriptionLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $skipToken is supported on Get list of order, which provides the next page in the list of order. @@ -538,7 +592,7 @@ public static Pageable GetProductFamiliesMetadata(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetEdgeOrdersAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEdgeOrdersAsync(skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrdersAsync(skipToken, cancellationToken); } /// @@ -553,6 +607,10 @@ public static AsyncPageable GetEdgeOrdersAsync(this Subscript /// ListOrderAtSubscriptionLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $skipToken is supported on Get list of order, which provides the next page in the list of order. @@ -560,7 +618,7 @@ public static AsyncPageable GetEdgeOrdersAsync(this Subscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetEdgeOrders(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEdgeOrders(skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrders(skipToken, cancellationToken); } /// @@ -575,6 +633,10 @@ public static Pageable GetEdgeOrders(this SubscriptionResourc /// ListOrderItemsAtSubscriptionLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $filter is supported to filter based on order id. Filter supports only equals operation. @@ -584,7 +646,7 @@ public static Pageable GetEdgeOrders(this SubscriptionResourc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetEdgeOrderItemsAsync(this SubscriptionResource subscriptionResource, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEdgeOrderItemsAsync(filter, expand, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrderItemsAsync(filter, expand, skipToken, cancellationToken); } /// @@ -599,6 +661,10 @@ public static AsyncPageable GetEdgeOrderItemsAsync(this S /// ListOrderItemsAtSubscriptionLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// $filter is supported to filter based on order id. Filter supports only equals operation. @@ -608,7 +674,7 @@ public static AsyncPageable GetEdgeOrderItemsAsync(this S /// A collection of that may take multiple service requests to iterate over. public static Pageable GetEdgeOrderItems(this SubscriptionResource subscriptionResource, string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEdgeOrderItems(filter, expand, skipToken, cancellationToken); + return GetMockableEdgeOrderSubscriptionResource(subscriptionResource).GetEdgeOrderItems(filter, expand, skipToken, cancellationToken); } } } diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderArmClient.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderArmClient.cs new file mode 100644 index 0000000000000..9052b1fb850f2 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.EdgeOrder; + +namespace Azure.ResourceManager.EdgeOrder.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableEdgeOrderArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableEdgeOrderArmClient() + { + } + + /// 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 MockableEdgeOrderArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableEdgeOrderArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EdgeOrderAddressResource GetEdgeOrderAddressResource(ResourceIdentifier id) + { + EdgeOrderAddressResource.ValidateResourceId(id); + return new EdgeOrderAddressResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EdgeOrderResource GetEdgeOrderResource(ResourceIdentifier id) + { + EdgeOrderResource.ValidateResourceId(id); + return new EdgeOrderResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EdgeOrderItemResource GetEdgeOrderItemResource(ResourceIdentifier id) + { + EdgeOrderItemResource.ValidateResourceId(id); + return new EdgeOrderItemResource(Client, id); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderResourceGroupResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderResourceGroupResource.cs new file mode 100644 index 0000000000000..95023e3702dca --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderResourceGroupResource.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.EdgeOrder; + +namespace Azure.ResourceManager.EdgeOrder.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableEdgeOrderResourceGroupResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private EdgeOrderManagementRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableEdgeOrderResourceGroupResource() + { + } + + /// 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 MockableEdgeOrderResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private EdgeOrderManagementRestOperations DefaultRestClient => _defaultRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of EdgeOrderAddressResources in the ResourceGroupResource. + /// An object representing collection of EdgeOrderAddressResources and their operations over a EdgeOrderAddressResource. + public virtual EdgeOrderAddressCollection GetEdgeOrderAddresses() + { + return GetCachedClient(client => new EdgeOrderAddressCollection(client, Id)); + } + + /// + /// Gets information about the specified address. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName} + /// + /// + /// Operation Id + /// GetAddressByName + /// + /// + /// + /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEdgeOrderAddressAsync(string addressName, CancellationToken cancellationToken = default) + { + return await GetEdgeOrderAddresses().GetAsync(addressName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified address. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/addresses/{addressName} + /// + /// + /// Operation Id + /// GetAddressByName + /// + /// + /// + /// The name of the address Resource within the specified resource group. address names must be between 3 and 24 characters in length and use any alphanumeric and underscore only. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEdgeOrderAddress(string addressName, CancellationToken cancellationToken = default) + { + return GetEdgeOrderAddresses().Get(addressName, cancellationToken); + } + + /// Gets a collection of EdgeOrderResources in the ResourceGroupResource. + /// An object representing collection of EdgeOrderResources and their operations over a EdgeOrderResource. + public virtual EdgeOrderCollection GetEdgeOrders() + { + return GetCachedClient(client => new EdgeOrderCollection(client, Id)); + } + + /// + /// Gets an order. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} + /// + /// + /// Operation Id + /// GetOrderByName + /// + /// + /// + /// The name of Azure region. + /// The name of the order. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEdgeOrderAsync(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + { + return await GetEdgeOrders().GetAsync(location, orderName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an order. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/locations/{location}/orders/{orderName} + /// + /// + /// Operation Id + /// GetOrderByName + /// + /// + /// + /// The name of Azure region. + /// The name of the order. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEdgeOrder(AzureLocation location, string orderName, CancellationToken cancellationToken = default) + { + return GetEdgeOrders().Get(location, orderName, cancellationToken); + } + + /// Gets a collection of EdgeOrderItemResources in the ResourceGroupResource. + /// An object representing collection of EdgeOrderItemResources and their operations over a EdgeOrderItemResource. + public virtual EdgeOrderItemCollection GetEdgeOrderItems() + { + return GetCachedClient(client => new EdgeOrderItemCollection(client, Id)); + } + + /// + /// Gets an order item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} + /// + /// + /// Operation Id + /// GetOrderItemByName + /// + /// + /// + /// The name of the order item. + /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEdgeOrderItemAsync(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetEdgeOrderItems().GetAsync(orderItemName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an order item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orderItems/{orderItemName} + /// + /// + /// Operation Id + /// GetOrderItemByName + /// + /// + /// + /// The name of the order item. + /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEdgeOrderItem(string orderItemName, string expand = null, CancellationToken cancellationToken = default) + { + return GetEdgeOrderItems().Get(orderItemName, expand, cancellationToken); + } + + /// + /// Lists order at resource group level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orders + /// + /// + /// Operation Id + /// ListOrderAtResourceGroupLevel + /// + /// + /// + /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEdgeOrdersAsync(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderResourceGroupResource.GetEdgeOrders", "value", "nextLink", cancellationToken); + } + + /// + /// Lists order at resource group level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orders + /// + /// + /// Operation Id + /// ListOrderAtResourceGroupLevel + /// + /// + /// + /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEdgeOrders(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderResourceGroupResource.GetEdgeOrders", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderSubscriptionResource.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderSubscriptionResource.cs new file mode 100644 index 0000000000000..9be2f86af7a09 --- /dev/null +++ b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/MockableEdgeOrderSubscriptionResource.cs @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.EdgeOrder; +using Azure.ResourceManager.EdgeOrder.Models; + +namespace Azure.ResourceManager.EdgeOrder.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableEdgeOrderSubscriptionResource : ArmResource + { + private ClientDiagnostics _edgeOrderAddressClientDiagnostics; + private EdgeOrderManagementRestOperations _edgeOrderAddressRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private EdgeOrderManagementRestOperations _defaultRestClient; + private ClientDiagnostics _edgeOrderItemClientDiagnostics; + private EdgeOrderManagementRestOperations _edgeOrderItemRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableEdgeOrderSubscriptionResource() + { + } + + /// 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 MockableEdgeOrderSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics EdgeOrderAddressClientDiagnostics => _edgeOrderAddressClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderAddressResource.ResourceType.Namespace, Diagnostics); + private EdgeOrderManagementRestOperations EdgeOrderAddressRestClient => _edgeOrderAddressRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EdgeOrderAddressResource.ResourceType)); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private EdgeOrderManagementRestOperations DefaultRestClient => _defaultRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics EdgeOrderItemClientDiagnostics => _edgeOrderItemClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderItemResource.ResourceType.Namespace, Diagnostics); + private EdgeOrderManagementRestOperations EdgeOrderItemRestClient => _edgeOrderItemRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EdgeOrderItemResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all the addresses available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/addresses + /// + /// + /// Operation Id + /// ListAddressesAtSubscriptionLevel + /// + /// + /// + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEdgeOrderAddressesAsync(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelRequest(Id.SubscriptionId, filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderAddressResource(Client, EdgeOrderAddressData.DeserializeEdgeOrderAddressData(e)), EdgeOrderAddressClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrderAddresses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the addresses available under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/addresses + /// + /// + /// Operation Id + /// ListAddressesAtSubscriptionLevel + /// + /// + /// + /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. + /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEdgeOrderAddresses(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelRequest(Id.SubscriptionId, filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderAddressResource(Client, EdgeOrderAddressData.DeserializeEdgeOrderAddressData(e)), EdgeOrderAddressClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrderAddresses", "value", "nextLink", cancellationToken); + } + + /// + /// This method provides the list of product families for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies + /// + /// + /// Operation Id + /// ListProductFamilies + /// + /// + /// + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProductFamiliesAsync(ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesRequest(Id.SubscriptionId, content, expand, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesNextPageRequest(nextLink, Id.SubscriptionId, content, expand, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductFamily.DeserializeProductFamily, DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamilies", "value", "nextLink", cancellationToken); + } + + /// + /// This method provides the list of product families for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies + /// + /// + /// Operation Id + /// ListProductFamilies + /// + /// + /// + /// Filters for showing the product families. + /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. + /// $skipToken is supported on list of product families, which provides the next page in the list of product families. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProductFamilies(ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesRequest(Id.SubscriptionId, content, expand, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesNextPageRequest(nextLink, Id.SubscriptionId, content, expand, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductFamily.DeserializeProductFamily, DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamilies", "value", "nextLink", cancellationToken); + } + + /// + /// This method provides the list of configurations for the given product family, product line and product under subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listConfigurations + /// + /// + /// Operation Id + /// ListConfigurations + /// + /// + /// + /// Filters for showing the configurations. + /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationsAsync(ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListConfigurationsRequest(Id.SubscriptionId, content, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListConfigurationsNextPageRequest(nextLink, Id.SubscriptionId, content, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductConfiguration.DeserializeProductConfiguration, DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// This method provides the list of configurations for the given product family, product line and product under subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listConfigurations + /// + /// + /// Operation Id + /// ListConfigurations + /// + /// + /// + /// Filters for showing the configurations. + /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurations(ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListConfigurationsRequest(Id.SubscriptionId, content, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListConfigurationsNextPageRequest(nextLink, Id.SubscriptionId, content, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductConfiguration.DeserializeProductConfiguration, DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// This method provides the list of product families metadata for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata + /// + /// + /// Operation Id + /// ListProductFamiliesMetadata + /// + /// + /// + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProductFamiliesMetadataAsync(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesMetadataRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesMetadataNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductFamiliesMetadata.DeserializeProductFamiliesMetadata, DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamiliesMetadata", "value", "nextLink", cancellationToken); + } + + /// + /// This method provides the list of product families metadata for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata + /// + /// + /// Operation Id + /// ListProductFamiliesMetadata + /// + /// + /// + /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProductFamiliesMetadata(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesMetadataRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesMetadataNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductFamiliesMetadata.DeserializeProductFamiliesMetadata, DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetProductFamiliesMetadata", "value", "nextLink", cancellationToken); + } + + /// + /// Lists order at subscription level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders + /// + /// + /// Operation Id + /// ListOrderAtSubscriptionLevel + /// + /// + /// + /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEdgeOrdersAsync(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtSubscriptionLevelRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrders", "value", "nextLink", cancellationToken); + } + + /// + /// Lists order at subscription level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders + /// + /// + /// Operation Id + /// ListOrderAtSubscriptionLevel + /// + /// + /// + /// $skipToken is supported on Get list of order, which provides the next page in the list of order. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEdgeOrders(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtSubscriptionLevelRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrders", "value", "nextLink", cancellationToken); + } + + /// + /// Lists order item at subscription level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems + /// + /// + /// Operation Id + /// ListOrderItemsAtSubscriptionLevel + /// + /// + /// + /// $filter is supported to filter based on order id. Filter supports only equals operation. + /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEdgeOrderItemsAsync(string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelRequest(Id.SubscriptionId, filter, expand, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, expand, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderItemResource(Client, EdgeOrderItemData.DeserializeEdgeOrderItemData(e)), EdgeOrderItemClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrderItems", "value", "nextLink", cancellationToken); + } + + /// + /// Lists order item at subscription level. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems + /// + /// + /// Operation Id + /// ListOrderItemsAtSubscriptionLevel + /// + /// + /// + /// $filter is supported to filter based on order id. Filter supports only equals operation. + /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. + /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEdgeOrderItems(string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelRequest(Id.SubscriptionId, filter, expand, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, expand, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderItemResource(Client, EdgeOrderItemData.DeserializeEdgeOrderItemData(e)), EdgeOrderItemClientDiagnostics, Pipeline, "MockableEdgeOrderSubscriptionResource.GetEdgeOrderItems", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 9373009ee72a1..0000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.EdgeOrder -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private EdgeOrderManagementRestOperations _defaultRestClient; - - /// 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 ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EdgeOrderManagementRestOperations DefaultRestClient => _defaultRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of EdgeOrderAddressResources in the ResourceGroupResource. - /// An object representing collection of EdgeOrderAddressResources and their operations over a EdgeOrderAddressResource. - public virtual EdgeOrderAddressCollection GetEdgeOrderAddresses() - { - return GetCachedClient(Client => new EdgeOrderAddressCollection(Client, Id)); - } - - /// Gets a collection of EdgeOrderResources in the ResourceGroupResource. - /// An object representing collection of EdgeOrderResources and their operations over a EdgeOrderResource. - public virtual EdgeOrderCollection GetEdgeOrders() - { - return GetCachedClient(Client => new EdgeOrderCollection(Client, Id)); - } - - /// Gets a collection of EdgeOrderItemResources in the ResourceGroupResource. - /// An object representing collection of EdgeOrderItemResources and their operations over a EdgeOrderItemResource. - public virtual EdgeOrderItemCollection GetEdgeOrderItems() - { - return GetCachedClient(Client => new EdgeOrderItemCollection(Client, Id)); - } - - /// - /// Lists order at resource group level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orders - /// - /// - /// Operation Id - /// ListOrderAtResourceGroupLevel - /// - /// - /// - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeOrdersAsync(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetEdgeOrders", "value", "nextLink", cancellationToken); - } - - /// - /// Lists order at resource group level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EdgeOrder/orders - /// - /// - /// Operation Id - /// ListOrderAtResourceGroupLevel - /// - /// - /// - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeOrders(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtResourceGroupLevelNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetEdgeOrders", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 5eb27a9b0c107..0000000000000 --- a/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.EdgeOrder.Models; - -namespace Azure.ResourceManager.EdgeOrder -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _edgeOrderAddressClientDiagnostics; - private EdgeOrderManagementRestOperations _edgeOrderAddressRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private EdgeOrderManagementRestOperations _defaultRestClient; - private ClientDiagnostics _edgeOrderItemClientDiagnostics; - private EdgeOrderManagementRestOperations _edgeOrderItemRestClient; - - /// 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 EdgeOrderAddressClientDiagnostics => _edgeOrderAddressClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderAddressResource.ResourceType.Namespace, Diagnostics); - private EdgeOrderManagementRestOperations EdgeOrderAddressRestClient => _edgeOrderAddressRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EdgeOrderAddressResource.ResourceType)); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EdgeOrderManagementRestOperations DefaultRestClient => _defaultRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics EdgeOrderItemClientDiagnostics => _edgeOrderItemClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EdgeOrder", EdgeOrderItemResource.ResourceType.Namespace, Diagnostics); - private EdgeOrderManagementRestOperations EdgeOrderItemRestClient => _edgeOrderItemRestClient ??= new EdgeOrderManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EdgeOrderItemResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all the addresses available under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/addresses - /// - /// - /// Operation Id - /// ListAddressesAtSubscriptionLevel - /// - /// - /// - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeOrderAddressesAsync(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelRequest(Id.SubscriptionId, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderAddressResource(Client, EdgeOrderAddressData.DeserializeEdgeOrderAddressData(e)), EdgeOrderAddressClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEdgeOrderAddresses", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the addresses available under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/addresses - /// - /// - /// Operation Id - /// ListAddressesAtSubscriptionLevel - /// - /// - /// - /// $filter is supported to filter based on shipping address properties. Filter supports only equals operation. - /// $skipToken is supported on Get list of addresses, which provides the next page in the list of addresses. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeOrderAddresses(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelRequest(Id.SubscriptionId, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderAddressRestClient.CreateListAddressesAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderAddressResource(Client, EdgeOrderAddressData.DeserializeEdgeOrderAddressData(e)), EdgeOrderAddressClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEdgeOrderAddresses", "value", "nextLink", cancellationToken); - } - - /// - /// This method provides the list of product families for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies - /// - /// - /// Operation Id - /// ListProductFamilies - /// - /// - /// - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProductFamiliesAsync(ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesRequest(Id.SubscriptionId, content, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesNextPageRequest(nextLink, Id.SubscriptionId, content, expand, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductFamily.DeserializeProductFamily, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProductFamilies", "value", "nextLink", cancellationToken); - } - - /// - /// This method provides the list of product families for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listProductFamilies - /// - /// - /// Operation Id - /// ListProductFamilies - /// - /// - /// - /// Filters for showing the product families. - /// $expand is supported on configurations parameter for product, which provides details on the configurations for the product. - /// $skipToken is supported on list of product families, which provides the next page in the list of product families. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProductFamilies(ProductFamiliesContent content, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesRequest(Id.SubscriptionId, content, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesNextPageRequest(nextLink, Id.SubscriptionId, content, expand, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductFamily.DeserializeProductFamily, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProductFamilies", "value", "nextLink", cancellationToken); - } - - /// - /// This method provides the list of configurations for the given product family, product line and product under subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listConfigurations - /// - /// - /// Operation Id - /// ListConfigurations - /// - /// - /// - /// Filters for showing the configurations. - /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationsAsync(ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListConfigurationsRequest(Id.SubscriptionId, content, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListConfigurationsNextPageRequest(nextLink, Id.SubscriptionId, content, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductConfiguration.DeserializeProductConfiguration, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// This method provides the list of configurations for the given product family, product line and product under subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/listConfigurations - /// - /// - /// Operation Id - /// ListConfigurations - /// - /// - /// - /// Filters for showing the configurations. - /// $skipToken is supported on list of configurations, which provides the next page in the list of configurations. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurations(ConfigurationsContent content, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListConfigurationsRequest(Id.SubscriptionId, content, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListConfigurationsNextPageRequest(nextLink, Id.SubscriptionId, content, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductConfiguration.DeserializeProductConfiguration, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// This method provides the list of product families metadata for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata - /// - /// - /// Operation Id - /// ListProductFamiliesMetadata - /// - /// - /// - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProductFamiliesMetadataAsync(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesMetadataRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesMetadataNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProductFamiliesMetadata.DeserializeProductFamiliesMetadata, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProductFamiliesMetadata", "value", "nextLink", cancellationToken); - } - - /// - /// This method provides the list of product families metadata for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/productFamiliesMetadata - /// - /// - /// Operation Id - /// ListProductFamiliesMetadata - /// - /// - /// - /// $skipToken is supported on list of product families metadata, which provides the next page in the list of product families metadata. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProductFamiliesMetadata(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListProductFamiliesMetadataRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListProductFamiliesMetadataNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProductFamiliesMetadata.DeserializeProductFamiliesMetadata, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProductFamiliesMetadata", "value", "nextLink", cancellationToken); - } - - /// - /// Lists order at subscription level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders - /// - /// - /// Operation Id - /// ListOrderAtSubscriptionLevel - /// - /// - /// - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeOrdersAsync(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtSubscriptionLevelRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEdgeOrders", "value", "nextLink", cancellationToken); - } - - /// - /// Lists order at subscription level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orders - /// - /// - /// Operation Id - /// ListOrderAtSubscriptionLevel - /// - /// - /// - /// $skipToken is supported on Get list of order, which provides the next page in the list of order. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeOrders(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListOrderAtSubscriptionLevelRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListOrderAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderResource(Client, EdgeOrderData.DeserializeEdgeOrderData(e)), DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEdgeOrders", "value", "nextLink", cancellationToken); - } - - /// - /// Lists order item at subscription level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems - /// - /// - /// Operation Id - /// ListOrderItemsAtSubscriptionLevel - /// - /// - /// - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEdgeOrderItemsAsync(string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelRequest(Id.SubscriptionId, filter, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, expand, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderItemResource(Client, EdgeOrderItemData.DeserializeEdgeOrderItemData(e)), EdgeOrderItemClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEdgeOrderItems", "value", "nextLink", cancellationToken); - } - - /// - /// Lists order item at subscription level. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EdgeOrder/orderItems - /// - /// - /// Operation Id - /// ListOrderItemsAtSubscriptionLevel - /// - /// - /// - /// $filter is supported to filter based on order id. Filter supports only equals operation. - /// $expand is supported on device details, forward shipping details and reverse shipping details parameters. Each of these can be provided as a comma separated list. Device Details for order item provides details on the devices of the product, Forward and Reverse Shipping details provide forward and reverse shipping details respectively. - /// $skipToken is supported on Get list of order items, which provides the next page in the list of order items. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEdgeOrderItems(string filter = null, string expand = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelRequest(Id.SubscriptionId, filter, expand, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EdgeOrderItemRestClient.CreateListOrderItemsAtSubscriptionLevelNextPageRequest(nextLink, Id.SubscriptionId, filter, expand, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EdgeOrderItemResource(Client, EdgeOrderItemData.DeserializeEdgeOrderItemData(e)), EdgeOrderItemClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEdgeOrderItems", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/Azure.ResourceManager.Elastic.sln b/sdk/elastic/Azure.ResourceManager.Elastic/Azure.ResourceManager.Elastic.sln index 1bff551553955..e6f652f8ecc48 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/Azure.ResourceManager.Elastic.sln +++ b/sdk/elastic/Azure.ResourceManager.Elastic/Azure.ResourceManager.Elastic.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{CF15992E-0B89-4C12-9866-84C16E81B1D9}") = "Azure.ResourceManager.Elastic", "src\Azure.ResourceManager.Elastic.csproj", "{7FFB8DE0-AA63-4F2D-A036-A6CF24BA851B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Elastic", "src\Azure.ResourceManager.Elastic.csproj", "{7FFB8DE0-AA63-4F2D-A036-A6CF24BA851B}" EndProject -Project("{CF15992E-0B89-4C12-9866-84C16E81B1D9}") = "Azure.ResourceManager.Elastic.Tests", "tests\Azure.ResourceManager.Elastic.Tests.csproj", "{03BA0CB5-79DE-4A8F-83F3-70DC902FBFCA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Elastic.Tests", "tests\Azure.ResourceManager.Elastic.Tests.csproj", "{03BA0CB5-79DE-4A8F-83F3-70DC902FBFCA}" EndProject -Project("{CF15992E-0B89-4C12-9866-84C16E81B1D9}") = "Azure.ResourceManager.Elastic.Samples", "samples\Azure.ResourceManager.Elastic.Samples.csproj", "{E65DD774-6C98-482A-8808-1EC19199225A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Elastic.Samples", "samples\Azure.ResourceManager.Elastic.Samples.csproj", "{E65DD774-6C98-482A-8808-1EC19199225A}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7D52573B-E3D6-402A-BB8E-A2753AA70BA1} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {03BA0CB5-79DE-4A8F-83F3-70DC902FBFCA}.Release|x64.Build.0 = Release|Any CPU {03BA0CB5-79DE-4A8F-83F3-70DC902FBFCA}.Release|x86.ActiveCfg = Release|Any CPU {03BA0CB5-79DE-4A8F-83F3-70DC902FBFCA}.Release|x86.Build.0 = Release|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Debug|x64.ActiveCfg = Debug|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Debug|x64.Build.0 = Debug|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Debug|x86.ActiveCfg = Debug|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Debug|x86.Build.0 = Debug|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Release|Any CPU.Build.0 = Release|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Release|x64.ActiveCfg = Release|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Release|x64.Build.0 = Release|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Release|x86.ActiveCfg = Release|Any CPU + {E65DD774-6C98-482A-8808-1EC19199225A}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7D52573B-E3D6-402A-BB8E-A2753AA70BA1} EndGlobalSection EndGlobal diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/api/Azure.ResourceManager.Elastic.netstandard2.0.cs b/sdk/elastic/Azure.ResourceManager.Elastic/api/Azure.ResourceManager.Elastic.netstandard2.0.cs index e6404b7f6ece5..61bae156b74af 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/api/Azure.ResourceManager.Elastic.netstandard2.0.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/api/Azure.ResourceManager.Elastic.netstandard2.0.cs @@ -62,7 +62,7 @@ protected ElasticMonitorResourceCollection() { } } public partial class ElasticMonitorResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public ElasticMonitorResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ElasticMonitorResourceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Elastic.Models.MonitorProperties Properties { get { throw null; } set { } } public string SkuName { get { throw null; } set { } } @@ -104,6 +104,28 @@ protected MonitoringTagRuleResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Elastic.MonitoringTagRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Elastic.Mocking +{ + public partial class MockableElasticArmClient : Azure.ResourceManager.ArmResource + { + protected MockableElasticArmClient() { } + public virtual Azure.ResourceManager.Elastic.ElasticMonitorResource GetElasticMonitorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Elastic.MonitoringTagRuleResource GetMonitoringTagRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableElasticResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableElasticResourceGroupResource() { } + public virtual Azure.Response GetElasticMonitorResource(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetElasticMonitorResourceAsync(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Elastic.ElasticMonitorResourceCollection GetElasticMonitorResources() { throw null; } + } + public partial class MockableElasticSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableElasticSubscriptionResource() { } + public virtual Azure.Pageable GetElasticMonitorResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetElasticMonitorResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Elastic.Models { public static partial class ArmElasticModelFactory diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs index 705816e3b2f4c..f60b6dae2d524 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Elastic public partial class ElasticMonitorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}"; @@ -114,7 +117,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MonitoringTagRuleResources and their operations over a MonitoringTagRuleResource. public virtual MonitoringTagRuleCollection GetMonitoringTagRules() { - return GetCachedClient(Client => new MonitoringTagRuleCollection(Client, Id)); + return GetCachedClient(client => new MonitoringTagRuleCollection(client, Id)); } /// @@ -132,8 +135,8 @@ public virtual MonitoringTagRuleCollection GetMonitoringTagRules() /// /// Tag Rule Set resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMonitoringTagRuleAsync(string ruleSetName, CancellationToken cancellationToken = default) { @@ -155,8 +158,8 @@ public virtual async Task> GetMonitoringTagR /// /// Tag Rule Set resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMonitoringTagRule(string ruleSetName, CancellationToken cancellationToken = default) { diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ElasticExtensions.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ElasticExtensions.cs index 23a67ac78a0f7..b059b98fd8ff0 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ElasticExtensions.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ElasticExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Elastic.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Elastic @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.Elastic /// A class to add extension methods to Azure.ResourceManager.Elastic. public static partial class ElasticExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableElasticArmClient GetMockableElasticArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableElasticArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableElasticResourceGroupResource GetMockableElasticResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableElasticResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableElasticSubscriptionResource GetMockableElasticSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableElasticSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ElasticMonitorResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ElasticMonitorResource GetElasticMonitorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ElasticMonitorResource.ValidateResourceId(id); - return new ElasticMonitorResource(client, id); - } - ); + return GetMockableElasticArmClient(client).GetElasticMonitorResource(id); } - #endregion - #region MonitoringTagRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MonitoringTagRuleResource GetMonitoringTagRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MonitoringTagRuleResource.ValidateResourceId(id); - return new MonitoringTagRuleResource(client, id); - } - ); + return GetMockableElasticArmClient(client).GetMonitoringTagRuleResource(id); } - #endregion - /// Gets a collection of ElasticMonitorResources in the ResourceGroupResource. + /// + /// Gets a collection of ElasticMonitorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ElasticMonitorResources and their operations over a ElasticMonitorResource. public static ElasticMonitorResourceCollection GetElasticMonitorResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetElasticMonitorResources(); + return GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitorResources(); } /// @@ -107,16 +92,20 @@ public static ElasticMonitorResourceCollection GetElasticMonitorResources(this R /// Monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Monitor resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetElasticMonitorResourceAsync(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetElasticMonitorResources().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + return await GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitorResourceAsync(monitorName, cancellationToken).ConfigureAwait(false); } /// @@ -131,16 +120,20 @@ public static async Task> GetElasticMonitorReso /// Monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Monitor resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetElasticMonitorResource(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetElasticMonitorResources().Get(monitorName, cancellationToken); + return GetMockableElasticResourceGroupResource(resourceGroupResource).GetElasticMonitorResource(monitorName, cancellationToken); } /// @@ -155,13 +148,17 @@ public static Response GetElasticMonitorResource(this Re /// Monitors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetElasticMonitorResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetElasticMonitorResourcesAsync(cancellationToken); + return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticMonitorResourcesAsync(cancellationToken); } /// @@ -176,13 +173,17 @@ public static AsyncPageable GetElasticMonitorResourcesAs /// Monitors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetElasticMonitorResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetElasticMonitorResources(cancellationToken); + return GetMockableElasticSubscriptionResource(subscriptionResource).GetElasticMonitorResources(cancellationToken); } } } diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticArmClient.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticArmClient.cs new file mode 100644 index 0000000000000..9d69924547d91 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Elastic; + +namespace Azure.ResourceManager.Elastic.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableElasticArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableElasticArmClient() + { + } + + /// 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 MockableElasticArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableElasticArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ElasticMonitorResource GetElasticMonitorResource(ResourceIdentifier id) + { + ElasticMonitorResource.ValidateResourceId(id); + return new ElasticMonitorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitoringTagRuleResource GetMonitoringTagRuleResource(ResourceIdentifier id) + { + MonitoringTagRuleResource.ValidateResourceId(id); + return new MonitoringTagRuleResource(Client, id); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticResourceGroupResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticResourceGroupResource.cs new file mode 100644 index 0000000000000..c93a2835dff84 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Elastic; + +namespace Azure.ResourceManager.Elastic.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableElasticResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableElasticResourceGroupResource() + { + } + + /// 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 MockableElasticResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ElasticMonitorResources in the ResourceGroupResource. + /// An object representing collection of ElasticMonitorResources and their operations over a ElasticMonitorResource. + public virtual ElasticMonitorResourceCollection GetElasticMonitorResources() + { + return GetCachedClient(client => new ElasticMonitorResourceCollection(client, Id)); + } + + /// + /// Get the properties of a specific monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticMonitorResourceAsync(string monitorName, CancellationToken cancellationToken = default) + { + return await GetElasticMonitorResources().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a specific monitor resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Monitor resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticMonitorResource(string monitorName, CancellationToken cancellationToken = default) + { + return GetElasticMonitorResources().Get(monitorName, cancellationToken); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticSubscriptionResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticSubscriptionResource.cs new file mode 100644 index 0000000000000..2454b4abb0656 --- /dev/null +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/MockableElasticSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Elastic; + +namespace Azure.ResourceManager.Elastic.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableElasticSubscriptionResource : ArmResource + { + private ClientDiagnostics _elasticMonitorResourceMonitorsClientDiagnostics; + private MonitorsRestOperations _elasticMonitorResourceMonitorsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableElasticSubscriptionResource() + { + } + + /// 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 MockableElasticSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ElasticMonitorResourceMonitorsClientDiagnostics => _elasticMonitorResourceMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ElasticMonitorResource.ResourceType.Namespace, Diagnostics); + private MonitorsRestOperations ElasticMonitorResourceMonitorsRestClient => _elasticMonitorResourceMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ElasticMonitorResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all monitors under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors + /// + /// + /// Operation Id + /// Monitors_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetElasticMonitorResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(e)), ElasticMonitorResourceMonitorsClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticMonitorResources", "value", "nextLink", cancellationToken); + } + + /// + /// List all monitors under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors + /// + /// + /// Operation Id + /// Monitors_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetElasticMonitorResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(e)), ElasticMonitorResourceMonitorsClientDiagnostics, Pipeline, "MockableElasticSubscriptionResource.GetElasticMonitorResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 8ce3859d9bb5d..0000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Elastic -{ - /// 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 ElasticMonitorResources in the ResourceGroupResource. - /// An object representing collection of ElasticMonitorResources and their operations over a ElasticMonitorResource. - public virtual ElasticMonitorResourceCollection GetElasticMonitorResources() - { - return GetCachedClient(Client => new ElasticMonitorResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 86cb1b3288243..0000000000000 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Elastic -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _elasticMonitorResourceMonitorsClientDiagnostics; - private MonitorsRestOperations _elasticMonitorResourceMonitorsRestClient; - - /// 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 ElasticMonitorResourceMonitorsClientDiagnostics => _elasticMonitorResourceMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Elastic", ElasticMonitorResource.ResourceType.Namespace, Diagnostics); - private MonitorsRestOperations ElasticMonitorResourceMonitorsRestClient => _elasticMonitorResourceMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ElasticMonitorResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all monitors under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors - /// - /// - /// Operation Id - /// Monitors_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetElasticMonitorResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(e)), ElasticMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetElasticMonitorResources", "value", "nextLink", cancellationToken); - } - - /// - /// List all monitors under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors - /// - /// - /// Operation Id - /// Monitors_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetElasticMonitorResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticMonitorResourceMonitorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticMonitorResourceMonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticMonitorResource(Client, ElasticMonitorResourceData.DeserializeElasticMonitorResourceData(e)), ElasticMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetElasticMonitorResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.cs index ddef040b1b7e4..987a3b7e28a28 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/MonitoringTagRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Elastic public partial class MonitoringTagRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. + /// The ruleSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}"; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/api/Azure.ResourceManager.ElasticSan.netstandard2.0.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/api/Azure.ResourceManager.ElasticSan.netstandard2.0.cs index 60c04175cd75a..51fd980e100a6 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/api/Azure.ResourceManager.ElasticSan.netstandard2.0.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/api/Azure.ResourceManager.ElasticSan.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ElasticSanCollection() { } } public partial class ElasticSanData : Azure.ResourceManager.Models.TrackedResourceData { - public ElasticSanData(Azure.Core.AzureLocation location, Azure.ResourceManager.ElasticSan.Models.ElasticSanSku sku, long baseSizeTiB, long extendedCapacitySizeTiB) : base (default(Azure.Core.AzureLocation)) { } + public ElasticSanData(Azure.Core.AzureLocation location, Azure.ResourceManager.ElasticSan.Models.ElasticSanSku sku, long baseSizeTiB, long extendedCapacitySizeTiB) { } public System.Collections.Generic.IList AvailabilityZones { get { throw null; } } public long BaseSizeTiB { get { throw null; } set { } } public long ExtendedCapacitySizeTiB { get { throw null; } set { } } @@ -244,6 +244,33 @@ protected ElasticSanVolumeResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ElasticSan.Mocking +{ + public partial class MockableElasticSanArmClient : Azure.ResourceManager.ArmResource + { + protected MockableElasticSanArmClient() { } + public virtual Azure.ResourceManager.ElasticSan.ElasticSanPrivateEndpointConnectionResource GetElasticSanPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ElasticSan.ElasticSanResource GetElasticSanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ElasticSan.ElasticSanSnapshotResource GetElasticSanSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ElasticSan.ElasticSanVolumeGroupResource GetElasticSanVolumeGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ElasticSan.ElasticSanVolumeResource GetElasticSanVolumeResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableElasticSanResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableElasticSanResourceGroupResource() { } + public virtual Azure.Response GetElasticSan(string elasticSanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetElasticSanAsync(string elasticSanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ElasticSan.ElasticSanCollection GetElasticSans() { throw null; } + } + public partial class MockableElasticSanSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableElasticSanSubscriptionResource() { } + public virtual Azure.Pageable GetElasticSans(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetElasticSansAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkus(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ElasticSan.Models { public static partial class ArmElasticSanModelFactory diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionResource.cs index 148cb8b91b6a1..3a2e72a489517 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ElasticSan public partial class ElasticSanPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The elasticSanName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string elasticSanName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs index 9ec016d99383c..3f9e5bbaf91f9 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ElasticSan public partial class ElasticSanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The elasticSanName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string elasticSanName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ElasticSanVolumeGroupResources and their operations over a ElasticSanVolumeGroupResource. public virtual ElasticSanVolumeGroupCollection GetElasticSanVolumeGroups() { - return GetCachedClient(Client => new ElasticSanVolumeGroupCollection(Client, Id)); + return GetCachedClient(client => new ElasticSanVolumeGroupCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual ElasticSanVolumeGroupCollection GetElasticSanVolumeGroups() /// /// The name of the VolumeGroup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetElasticSanVolumeGroupAsync(string volumeGroupName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetElasticSan /// /// The name of the VolumeGroup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetElasticSanVolumeGroup(string volumeGroupName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetElasticSanVolumeGroup( /// An object representing collection of ElasticSanPrivateEndpointConnectionResources and their operations over a ElasticSanPrivateEndpointConnectionResource. public virtual ElasticSanPrivateEndpointConnectionCollection GetElasticSanPrivateEndpointConnections() { - return GetCachedClient(Client => new ElasticSanPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ElasticSanPrivateEndpointConnectionCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual ElasticSanPrivateEndpointConnectionCollection GetElasticSanPrivat /// /// The name of the Private Endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetElasticSanPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> /// /// The name of the Private Endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetElasticSanPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs index c732b6f8cf03d..02b7534ab1858 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ElasticSan public partial class ElasticSanSnapshotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The elasticSanName. + /// The volumeGroupName. + /// The snapshotName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}"; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs index 1777fb05476c8..3fe215e2c1d85 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ElasticSan public partial class ElasticSanVolumeGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The elasticSanName. + /// The volumeGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ElasticSanVolumeResources and their operations over a ElasticSanVolumeResource. public virtual ElasticSanVolumeCollection GetElasticSanVolumes() { - return GetCachedClient(Client => new ElasticSanVolumeCollection(Client, Id)); + return GetCachedClient(client => new ElasticSanVolumeCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual ElasticSanVolumeCollection GetElasticSanVolumes() /// /// The name of the Volume. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetElasticSanVolumeAsync(string volumeName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetElasticSanVolum /// /// The name of the Volume. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetElasticSanVolume(string volumeName, CancellationToken cancellationToken = default) { @@ -144,7 +148,7 @@ public virtual Response GetElasticSanVolume(string vol /// An object representing collection of ElasticSanSnapshotResources and their operations over a ElasticSanSnapshotResource. public virtual ElasticSanSnapshotCollection GetElasticSanSnapshots() { - return GetCachedClient(Client => new ElasticSanSnapshotCollection(Client, Id)); + return GetCachedClient(client => new ElasticSanSnapshotCollection(client, Id)); } /// @@ -162,8 +166,8 @@ public virtual ElasticSanSnapshotCollection GetElasticSanSnapshots() /// /// The name of the volume snapshot within the given volume group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetElasticSanSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) { @@ -185,8 +189,8 @@ public virtual async Task> GetElasticSanSna /// /// The name of the volume snapshot within the given volume group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetElasticSanSnapshot(string snapshotName, CancellationToken cancellationToken = default) { diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs index 2c100aca71264..ffe3100938d84 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ElasticSan public partial class ElasticSanVolumeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The elasticSanName. + /// The volumeGroupName. + /// The volumeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs index 69b72688e23be..67d72a7ff6d6d 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ElasticSan.Mocking; using Azure.ResourceManager.ElasticSan.Models; using Azure.ResourceManager.Resources; @@ -19,138 +20,113 @@ namespace Azure.ResourceManager.ElasticSan /// A class to add extension methods to Azure.ResourceManager.ElasticSan. public static partial class ElasticSanExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableElasticSanArmClient GetMockableElasticSanArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableElasticSanArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableElasticSanResourceGroupResource GetMockableElasticSanResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableElasticSanResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableElasticSanSubscriptionResource GetMockableElasticSanSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableElasticSanSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ElasticSanResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ElasticSanResource GetElasticSanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ElasticSanResource.ValidateResourceId(id); - return new ElasticSanResource(client, id); - } - ); + return GetMockableElasticSanArmClient(client).GetElasticSanResource(id); } - #endregion - #region ElasticSanVolumeGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ElasticSanVolumeGroupResource GetElasticSanVolumeGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ElasticSanVolumeGroupResource.ValidateResourceId(id); - return new ElasticSanVolumeGroupResource(client, id); - } - ); + return GetMockableElasticSanArmClient(client).GetElasticSanVolumeGroupResource(id); } - #endregion - #region ElasticSanVolumeResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ElasticSanVolumeResource GetElasticSanVolumeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ElasticSanVolumeResource.ValidateResourceId(id); - return new ElasticSanVolumeResource(client, id); - } - ); + return GetMockableElasticSanArmClient(client).GetElasticSanVolumeResource(id); } - #endregion - #region ElasticSanPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ElasticSanPrivateEndpointConnectionResource GetElasticSanPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ElasticSanPrivateEndpointConnectionResource.ValidateResourceId(id); - return new ElasticSanPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableElasticSanArmClient(client).GetElasticSanPrivateEndpointConnectionResource(id); } - #endregion - #region ElasticSanSnapshotResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ElasticSanSnapshotResource GetElasticSanSnapshotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ElasticSanSnapshotResource.ValidateResourceId(id); - return new ElasticSanSnapshotResource(client, id); - } - ); + return GetMockableElasticSanArmClient(client).GetElasticSanSnapshotResource(id); } - #endregion - /// Gets a collection of ElasticSanResources in the ResourceGroupResource. + /// + /// Gets a collection of ElasticSanResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ElasticSanResources and their operations over a ElasticSanResource. public static ElasticSanCollection GetElasticSans(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetElasticSans(); + return GetMockableElasticSanResourceGroupResource(resourceGroupResource).GetElasticSans(); } /// @@ -165,16 +141,20 @@ public static ElasticSanCollection GetElasticSans(this ResourceGroupResource res /// ElasticSans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the ElasticSan. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetElasticSanAsync(this ResourceGroupResource resourceGroupResource, string elasticSanName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetElasticSans().GetAsync(elasticSanName, cancellationToken).ConfigureAwait(false); + return await GetMockableElasticSanResourceGroupResource(resourceGroupResource).GetElasticSanAsync(elasticSanName, cancellationToken).ConfigureAwait(false); } /// @@ -189,16 +169,20 @@ public static async Task> GetElasticSanAsync(this R /// ElasticSans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the ElasticSan. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetElasticSan(this ResourceGroupResource resourceGroupResource, string elasticSanName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetElasticSans().Get(elasticSanName, cancellationToken); + return GetMockableElasticSanResourceGroupResource(resourceGroupResource).GetElasticSan(elasticSanName, cancellationToken); } /// @@ -213,6 +197,10 @@ public static Response GetElasticSan(this ResourceGroupResou /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify $filter='location eq <location>' to filter on location. @@ -220,7 +208,7 @@ public static Response GetElasticSan(this ResourceGroupResou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSkusAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusAsync(filter, cancellationToken); + return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetSkusAsync(filter, cancellationToken); } /// @@ -235,6 +223,10 @@ public static AsyncPageable GetSkusAsync(this Subscrip /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify $filter='location eq <location>' to filter on location. @@ -242,7 +234,7 @@ public static AsyncPageable GetSkusAsync(this Subscrip /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSkus(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkus(filter, cancellationToken); + return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetSkus(filter, cancellationToken); } /// @@ -257,13 +249,17 @@ public static Pageable GetSkus(this SubscriptionResour /// ElasticSans_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetElasticSansAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetElasticSansAsync(cancellationToken); + return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetElasticSansAsync(cancellationToken); } /// @@ -278,13 +274,17 @@ public static AsyncPageable GetElasticSansAsync(this Subscri /// ElasticSans_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetElasticSans(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetElasticSans(cancellationToken); + return GetMockableElasticSanSubscriptionResource(subscriptionResource).GetElasticSans(cancellationToken); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanArmClient.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanArmClient.cs new file mode 100644 index 0000000000000..cb0dbfa1fab33 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ElasticSan; + +namespace Azure.ResourceManager.ElasticSan.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableElasticSanArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableElasticSanArmClient() + { + } + + /// 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 MockableElasticSanArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableElasticSanArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ElasticSanResource GetElasticSanResource(ResourceIdentifier id) + { + ElasticSanResource.ValidateResourceId(id); + return new ElasticSanResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ElasticSanVolumeGroupResource GetElasticSanVolumeGroupResource(ResourceIdentifier id) + { + ElasticSanVolumeGroupResource.ValidateResourceId(id); + return new ElasticSanVolumeGroupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ElasticSanVolumeResource GetElasticSanVolumeResource(ResourceIdentifier id) + { + ElasticSanVolumeResource.ValidateResourceId(id); + return new ElasticSanVolumeResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ElasticSanPrivateEndpointConnectionResource GetElasticSanPrivateEndpointConnectionResource(ResourceIdentifier id) + { + ElasticSanPrivateEndpointConnectionResource.ValidateResourceId(id); + return new ElasticSanPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ElasticSanSnapshotResource GetElasticSanSnapshotResource(ResourceIdentifier id) + { + ElasticSanSnapshotResource.ValidateResourceId(id); + return new ElasticSanSnapshotResource(Client, id); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanResourceGroupResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanResourceGroupResource.cs new file mode 100644 index 0000000000000..310a99f3df47e --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ElasticSan; + +namespace Azure.ResourceManager.ElasticSan.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableElasticSanResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableElasticSanResourceGroupResource() + { + } + + /// 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 MockableElasticSanResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ElasticSanResources in the ResourceGroupResource. + /// An object representing collection of ElasticSanResources and their operations over a ElasticSanResource. + public virtual ElasticSanCollection GetElasticSans() + { + return GetCachedClient(client => new ElasticSanCollection(client, Id)); + } + + /// + /// Get a ElasticSan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName} + /// + /// + /// Operation Id + /// ElasticSans_Get + /// + /// + /// + /// The name of the ElasticSan. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticSanAsync(string elasticSanName, CancellationToken cancellationToken = default) + { + return await GetElasticSans().GetAsync(elasticSanName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a ElasticSan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName} + /// + /// + /// Operation Id + /// ElasticSans_Get + /// + /// + /// + /// The name of the ElasticSan. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticSan(string elasticSanName, CancellationToken cancellationToken = default) + { + return GetElasticSans().Get(elasticSanName, cancellationToken); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanSubscriptionResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanSubscriptionResource.cs new file mode 100644 index 0000000000000..158c2f810ae72 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/MockableElasticSanSubscriptionResource.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ElasticSan; +using Azure.ResourceManager.ElasticSan.Models; + +namespace Azure.ResourceManager.ElasticSan.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableElasticSanSubscriptionResource : ArmResource + { + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; + private ClientDiagnostics _elasticSanClientDiagnostics; + private ElasticSansRestOperations _elasticSanRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableElasticSanSubscriptionResource() + { + } + + /// 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 MockableElasticSanSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ElasticSanClientDiagnostics => _elasticSanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ElasticSanResource.ResourceType.Namespace, Diagnostics); + private ElasticSansRestOperations ElasticSanRestClient => _elasticSanRestClient ??= new ElasticSansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ElasticSanResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all the available Skus in the region and information related to them + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// Specify $filter='location eq <location>' to filter on location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ElasticSanSkuInformation.DeserializeElasticSanSkuInformation, SkusClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetSkus", "value", null, cancellationToken); + } + + /// + /// List all the available Skus in the region and information related to them + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// Specify $filter='location eq <location>' to filter on location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkus(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ElasticSanSkuInformation.DeserializeElasticSanSkuInformation, SkusClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetSkus", "value", null, cancellationToken); + } + + /// + /// Gets a list of ElasticSans in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans + /// + /// + /// Operation Id + /// ElasticSans_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetElasticSansAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticSanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticSanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanResource(Client, ElasticSanData.DeserializeElasticSanData(e)), ElasticSanClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetElasticSans", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of ElasticSans in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans + /// + /// + /// Operation Id + /// ElasticSans_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetElasticSans(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticSanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticSanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanResource(Client, ElasticSanData.DeserializeElasticSanData(e)), ElasticSanClientDiagnostics, Pipeline, "MockableElasticSanSubscriptionResource.GetElasticSans", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 10400472451d7..0000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ElasticSan -{ - /// 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 ElasticSanResources in the ResourceGroupResource. - /// An object representing collection of ElasticSanResources and their operations over a ElasticSanResource. - public virtual ElasticSanCollection GetElasticSans() - { - return GetCachedClient(Client => new ElasticSanCollection(Client, Id)); - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 8e6e781a5fcdc..0000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ElasticSan.Models; - -namespace Azure.ResourceManager.ElasticSan -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; - private ClientDiagnostics _elasticSanClientDiagnostics; - private ElasticSansRestOperations _elasticSanRestClient; - - /// 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 SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ElasticSanClientDiagnostics => _elasticSanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ElasticSanResource.ResourceType.Namespace, Diagnostics); - private ElasticSansRestOperations ElasticSanRestClient => _elasticSanRestClient ??= new ElasticSansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ElasticSanResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the available Skus in the region and information related to them - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// Specify $filter='location eq <location>' to filter on location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ElasticSanSkuInformation.DeserializeElasticSanSkuInformation, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", null, cancellationToken); - } - - /// - /// List all the available Skus in the region and information related to them - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// Specify $filter='location eq <location>' to filter on location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkus(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ElasticSanSkuInformation.DeserializeElasticSanSkuInformation, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", null, cancellationToken); - } - - /// - /// Gets a list of ElasticSans in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans - /// - /// - /// Operation Id - /// ElasticSans_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetElasticSansAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticSanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticSanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanResource(Client, ElasticSanData.DeserializeElasticSanData(e)), ElasticSanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetElasticSans", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of ElasticSans in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans - /// - /// - /// Operation Id - /// ElasticSans_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetElasticSans(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ElasticSanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ElasticSanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanResource(Client, ElasticSanData.DeserializeElasticSanData(e)), ElasticSanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetElasticSans", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/api/Azure.ResourceManager.EventGrid.netstandard2.0.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/api/Azure.ResourceManager.EventGrid.netstandard2.0.cs index df04b12ad9bb9..63cecface43f2 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/api/Azure.ResourceManager.EventGrid.netstandard2.0.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/api/Azure.ResourceManager.EventGrid.netstandard2.0.cs @@ -168,7 +168,7 @@ protected EventGridDomainCollection() { } } public partial class EventGridDomainData : Azure.ResourceManager.Models.TrackedResourceData { - public EventGridDomainData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EventGridDomainData(Azure.Core.AzureLocation location) { } public bool? AutoCreateTopicWithFirstSubscription { get { throw null; } set { } } public bool? AutoDeleteTopicWithLastSubscription { get { throw null; } set { } } public Azure.ResourceManager.EventGrid.Models.DataResidencyBoundary? DataResidencyBoundary { get { throw null; } set { } } @@ -480,7 +480,7 @@ protected EventGridNamespaceCollection() { } } public partial class EventGridNamespaceData : Azure.ResourceManager.Models.TrackedResourceData { - public EventGridNamespaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EventGridNamespaceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList InboundIPRules { get { throw null; } } public bool? IsZoneRedundant { get { throw null; } set { } } @@ -655,7 +655,7 @@ protected EventGridTopicCollection() { } } public partial class EventGridTopicData : Azure.ResourceManager.Models.TrackedResourceData { - public EventGridTopicData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EventGridTopicData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.EventGrid.Models.DataResidencyBoundary? DataResidencyBoundary { get { throw null; } set { } } public System.Uri Endpoint { get { throw null; } } public Azure.ResourceManager.EventGrid.Models.PartnerTopicEventTypeInfo EventTypeInfo { get { throw null; } set { } } @@ -900,7 +900,7 @@ protected NamespaceTopicResource() { } } public partial class PartnerConfigurationData : Azure.ResourceManager.Models.TrackedResourceData { - public PartnerConfigurationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PartnerConfigurationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.EventGrid.Models.PartnerAuthorization PartnerAuthorization { get { throw null; } set { } } public Azure.ResourceManager.EventGrid.Models.PartnerConfigurationProvisioningState? ProvisioningState { get { throw null; } set { } } } @@ -949,7 +949,7 @@ protected PartnerDestinationCollection() { } } public partial class PartnerDestinationData : Azure.ResourceManager.Models.TrackedResourceData { - public PartnerDestinationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PartnerDestinationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.EventGrid.Models.PartnerDestinationActivationState? ActivationState { get { throw null; } set { } } public System.Uri EndpointBaseUri { get { throw null; } set { } } public string EndpointServiceContext { get { throw null; } set { } } @@ -1043,7 +1043,7 @@ protected PartnerNamespaceCollection() { } } public partial class PartnerNamespaceData : Azure.ResourceManager.Models.TrackedResourceData { - public PartnerNamespaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PartnerNamespaceData(Azure.Core.AzureLocation location) { } public System.Uri Endpoint { get { throw null; } } public System.Collections.Generic.IList InboundIPRules { get { throw null; } } public bool? IsLocalAuthDisabled { get { throw null; } set { } } @@ -1131,7 +1131,7 @@ protected PartnerRegistrationCollection() { } } public partial class PartnerRegistrationData : Azure.ResourceManager.Models.TrackedResourceData { - public PartnerRegistrationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PartnerRegistrationData(Azure.Core.AzureLocation location) { } public System.Guid? PartnerRegistrationImmutableId { get { throw null; } set { } } public Azure.ResourceManager.EventGrid.Models.PartnerRegistrationProvisioningState? ProvisioningState { get { throw null; } } } @@ -1174,7 +1174,7 @@ protected PartnerTopicCollection() { } } public partial class PartnerTopicData : Azure.ResourceManager.Models.TrackedResourceData { - public PartnerTopicData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PartnerTopicData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.EventGrid.Models.PartnerTopicActivationState? ActivationState { get { throw null; } set { } } public Azure.ResourceManager.EventGrid.Models.PartnerTopicEventTypeInfo EventTypeInfo { get { throw null; } set { } } public System.DateTimeOffset? ExpireOnIfNotActivated { get { throw null; } set { } } @@ -1266,7 +1266,7 @@ protected SystemTopicCollection() { } } public partial class SystemTopicData : Azure.ResourceManager.Models.TrackedResourceData { - public SystemTopicData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SystemTopicData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Guid? MetricResourceId { get { throw null; } } public Azure.ResourceManager.EventGrid.Models.EventGridResourceProvisioningState? ProvisioningState { get { throw null; } } @@ -1480,6 +1480,125 @@ protected VerifiedPartnerResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.EventGrid.Mocking +{ + public partial class MockableEventGridArmClient : Azure.ResourceManager.ArmResource + { + protected MockableEventGridArmClient() { } + public virtual Azure.ResourceManager.EventGrid.CaCertificateResource GetCaCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.DomainEventSubscriptionResource GetDomainEventSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.DomainTopicEventSubscriptionResource GetDomainTopicEventSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.DomainTopicResource GetDomainTopicResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridDomainPrivateEndpointConnectionResource GetEventGridDomainPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridDomainPrivateLinkResource GetEventGridDomainPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridDomainResource GetEventGridDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridNamespaceClientGroupResource GetEventGridNamespaceClientGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridNamespaceClientResource GetEventGridNamespaceClientResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridNamespacePermissionBindingResource GetEventGridNamespacePermissionBindingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridNamespaceResource GetEventGridNamespaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridPartnerNamespacePrivateEndpointConnectionResource GetEventGridPartnerNamespacePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridTopicPrivateEndpointConnectionResource GetEventGridTopicPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridTopicPrivateLinkResource GetEventGridTopicPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridTopicResource GetEventGridTopicResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetEventSubscription(Azure.Core.ResourceIdentifier scope, string eventSubscriptionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEventSubscriptionAsync(Azure.Core.ResourceIdentifier scope, string eventSubscriptionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventSubscriptionResource GetEventSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventSubscriptionCollection GetEventSubscriptions(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetEventTypes(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEventTypesAsync(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.ExtensionTopicResource GetExtensionTopic(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.EventGrid.ExtensionTopicResource GetExtensionTopicResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.NamespaceTopicEventSubscriptionResource GetNamespaceTopicEventSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.NamespaceTopicResource GetNamespaceTopicResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerConfigurationResource GetPartnerConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerDestinationResource GetPartnerDestinationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerNamespaceChannelResource GetPartnerNamespaceChannelResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerNamespacePrivateLinkResource GetPartnerNamespacePrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerNamespaceResource GetPartnerNamespaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerRegistrationResource GetPartnerRegistrationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerTopicEventSubscriptionResource GetPartnerTopicEventSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerTopicResource GetPartnerTopicResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.SystemTopicEventSubscriptionResource GetSystemTopicEventSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.SystemTopicResource GetSystemTopicResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.TopicEventSubscriptionResource GetTopicEventSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.TopicSpaceResource GetTopicSpaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.TopicTypeResource GetTopicTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventGrid.VerifiedPartnerResource GetVerifiedPartnerResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableEventGridResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableEventGridResourceGroupResource() { } + public virtual Azure.Response GetEventGridDomain(string domainName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEventGridDomainAsync(string domainName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridDomainCollection GetEventGridDomains() { throw null; } + public virtual Azure.Response GetEventGridNamespace(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEventGridNamespaceAsync(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridNamespaceCollection GetEventGridNamespaces() { throw null; } + public virtual Azure.Response GetEventGridTopic(string topicName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEventGridTopicAsync(string topicName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.EventGridTopicCollection GetEventGridTopics() { throw null; } + public virtual Azure.Pageable GetGlobalEventSubscriptionsDataForTopicType(string topicTypeName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(string topicTypeName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerConfigurationResource GetPartnerConfiguration() { throw null; } + public virtual Azure.Response GetPartnerDestination(string partnerDestinationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPartnerDestinationAsync(string partnerDestinationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerDestinationCollection GetPartnerDestinations() { throw null; } + public virtual Azure.Response GetPartnerNamespace(string partnerNamespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPartnerNamespaceAsync(string partnerNamespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerNamespaceCollection GetPartnerNamespaces() { throw null; } + public virtual Azure.Response GetPartnerRegistration(string partnerRegistrationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPartnerRegistrationAsync(string partnerRegistrationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerRegistrationCollection GetPartnerRegistrations() { throw null; } + public virtual Azure.Response GetPartnerTopic(string partnerTopicName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPartnerTopicAsync(string partnerTopicName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.PartnerTopicCollection GetPartnerTopics() { throw null; } + public virtual Azure.Pageable GetRegionalEventSubscriptionsData(Azure.Core.AzureLocation location, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRegionalEventSubscriptionsDataAsync(Azure.Core.AzureLocation location, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRegionalEventSubscriptionsDataForTopicType(Azure.Core.AzureLocation location, string topicTypeName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(Azure.Core.AzureLocation location, string topicTypeName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSystemTopic(string systemTopicName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSystemTopicAsync(string systemTopicName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.SystemTopicCollection GetSystemTopics() { throw null; } + } + public partial class MockableEventGridSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableEventGridSubscriptionResource() { } + public virtual Azure.Pageable GetEventGridDomains(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEventGridDomainsAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEventGridNamespaces(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEventGridNamespacesAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEventGridTopics(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEventGridTopicsAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetGlobalEventSubscriptionsDataForTopicType(string topicTypeName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(string topicTypeName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPartnerConfigurations(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPartnerConfigurationsAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPartnerDestinations(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPartnerDestinationsAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPartnerNamespaces(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPartnerNamespacesAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPartnerRegistrations(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPartnerRegistrationsAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPartnerTopics(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPartnerTopicsAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRegionalEventSubscriptionsData(Azure.Core.AzureLocation location, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRegionalEventSubscriptionsDataAsync(Azure.Core.AzureLocation location, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRegionalEventSubscriptionsDataForTopicType(Azure.Core.AzureLocation location, string topicTypeName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(Azure.Core.AzureLocation location, string topicTypeName, string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSystemTopics(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSystemTopicsAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableEventGridTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableEventGridTenantResource() { } + public virtual Azure.Response GetTopicType(string topicTypeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTopicTypeAsync(string topicTypeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.TopicTypeCollection GetTopicTypes() { throw null; } + public virtual Azure.Response GetVerifiedPartner(string verifiedPartnerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVerifiedPartnerAsync(string verifiedPartnerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventGrid.VerifiedPartnerCollection GetVerifiedPartners() { throw null; } + } +} namespace Azure.ResourceManager.EventGrid.Models { public abstract partial class AdvancedFilter diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/EventGridExtensions.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/EventGridExtensions.cs similarity index 89% rename from sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/EventGridExtensions.cs rename to sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/EventGridExtensions.cs index 9091fc2ffa3d3..37d7270e1e384 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/EventGridExtensions.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/EventGridExtensions.cs @@ -35,14 +35,7 @@ public static partial class EventGridExtensions /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetEventTypesAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(scope, nameof(scope)); - - var resourceGroupResource = client.GetResourceGroupResource(ResourceGroupResource.CreateResourceIdentifier(scope.SubscriptionId, scope.ResourceGroupName)); - - var parentPart = scope.Parent.SubstringAfterProviderNamespace(); - var resourceTypeName = (string.IsNullOrEmpty(parentPart) ? string.Empty : $"{parentPart}/") + scope.ResourceType.GetLastType(); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventTypesAsync(scope.ResourceType.Namespace, resourceTypeName, scope.Name, cancellationToken); + return GetMockableEventGridArmClient(client).GetEventTypesAsync(scope, cancellationToken); } /// @@ -65,14 +58,7 @@ public static AsyncPageable GetEventTypesAsync(this ArmClie /// An async collection of that may take multiple service requests to iterate over. public static Pageable GetEventTypes(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(scope, nameof(scope)); - - var resourceGroupResource = client.GetResourceGroupResource(ResourceGroupResource.CreateResourceIdentifier(scope.SubscriptionId, scope.ResourceGroupName)); - - var parentPart = scope.Parent.SubstringAfterProviderNamespace(); - var resourceTypeName = (string.IsNullOrEmpty(parentPart) ? string.Empty : $"{parentPart}/") + scope.ResourceType.GetLastType(); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventTypes(scope.ResourceType.Namespace, resourceTypeName, scope.Name, cancellationToken); + return GetMockableEventGridArmClient(client).GetEventTypes(scope, cancellationToken); } /// @@ -98,9 +84,7 @@ public static Pageable GetEventTypes(this ArmClient client, /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(this SubscriptionResource subscriptionResource, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGlobalEventSubscriptionsDataForTopicTypeAsync(topicTypeName, filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetGlobalEventSubscriptionsDataForTopicTypeAsync(topicTypeName, filter, top, cancellationToken); } /// @@ -126,9 +110,7 @@ public static AsyncPageable GetGlobalEventSubscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetGlobalEventSubscriptionsDataForTopicType(this SubscriptionResource subscriptionResource, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGlobalEventSubscriptionsDataForTopicType(topicTypeName, filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetGlobalEventSubscriptionsDataForTopicType(topicTypeName, filter, top, cancellationToken); } /// @@ -152,7 +134,7 @@ public static Pageable GetGlobalEventSubscriptionsDat /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetRegionalEventSubscriptionsDataAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionalEventSubscriptionsDataAsync(location, filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetRegionalEventSubscriptionsDataAsync(location, filter, top, cancellationToken); } /// @@ -176,7 +158,7 @@ public static AsyncPageable GetRegionalEventSubscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetRegionalEventSubscriptionsData(this SubscriptionResource subscriptionResource, AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionalEventSubscriptionsData(location, filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetRegionalEventSubscriptionsData(location, filter, top, cancellationToken); } /// @@ -203,9 +185,7 @@ public static Pageable GetRegionalEventSubscriptionsD /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionalEventSubscriptionsDataForTopicTypeAsync(location, topicTypeName, filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetRegionalEventSubscriptionsDataForTopicTypeAsync(location, topicTypeName, filter, top, cancellationToken); } /// @@ -232,9 +212,7 @@ public static AsyncPageable GetRegionalEventSubscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetRegionalEventSubscriptionsDataForTopicType(this SubscriptionResource subscriptionResource, AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegionalEventSubscriptionsDataForTopicType(location, topicTypeName, filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetRegionalEventSubscriptionsDataForTopicType(location, topicTypeName, filter, top, cancellationToken); } /// @@ -260,9 +238,7 @@ public static Pageable GetRegionalEventSubscriptionsD /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(this ResourceGroupResource resourceGroupResource, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetGlobalEventSubscriptionsDataForTopicTypeAsync(topicTypeName, filter, top, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetGlobalEventSubscriptionsDataForTopicTypeAsync(topicTypeName, filter, top, cancellationToken); } /// @@ -288,9 +264,7 @@ public static AsyncPageable GetGlobalEventSubscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetGlobalEventSubscriptionsDataForTopicType(this ResourceGroupResource resourceGroupResource, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetGlobalEventSubscriptionsDataForTopicType(topicTypeName, filter, top, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetGlobalEventSubscriptionsDataForTopicType(topicTypeName, filter, top, cancellationToken); } /// @@ -314,7 +288,7 @@ public static Pageable GetGlobalEventSubscriptionsDat /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetRegionalEventSubscriptionsDataAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRegionalEventSubscriptionsDataAsync(location, filter, top, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetRegionalEventSubscriptionsDataAsync(location, filter, top, cancellationToken); } /// @@ -338,7 +312,7 @@ public static AsyncPageable GetRegionalEventSubscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetRegionalEventSubscriptionsData(this ResourceGroupResource resourceGroupResource, AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRegionalEventSubscriptionsData(location, filter, top, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetRegionalEventSubscriptionsData(location, filter, top, cancellationToken); } /// @@ -365,9 +339,7 @@ public static Pageable GetRegionalEventSubscriptionsD /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRegionalEventSubscriptionsDataForTopicTypeAsync(location, topicTypeName, filter, top, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetRegionalEventSubscriptionsDataForTopicTypeAsync(location, topicTypeName, filter, top, cancellationToken); } /// @@ -394,9 +366,7 @@ public static AsyncPageable GetRegionalEventSubscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetRegionalEventSubscriptionsDataForTopicType(this ResourceGroupResource resourceGroupResource, AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRegionalEventSubscriptionsDataForTopicType(location, topicTypeName, filter, top, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetRegionalEventSubscriptionsDataForTopicType(location, topicTypeName, filter, top, cancellationToken); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridArmClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridArmClient.cs new file mode 100644 index 0000000000000..99001bcc406da --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridArmClient.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Threading; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.EventGrid.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.EventGrid.Mocking +{ + public partial class MockableEventGridArmClient : ArmResource + { + private ClientDiagnostics _eventGridTopicTopicsClientDiagnostics; + private TopicsRestOperations _eventGridTopicTopicsRestClient; + private ClientDiagnostics EventGridTopicTopicsClientDiagnostics => _eventGridTopicTopicsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridTopicResource.ResourceType.Namespace, Diagnostics); + private TopicsRestOperations EventGridTopicTopicsRestClient => _eventGridTopicTopicsRestClient ??= new TopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridTopicResource.ResourceType)); + + /// + /// List event types for a topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes + /// + /// + /// Operation Id + /// Topics_ListEventTypes + /// + /// + /// + /// The resource identifier that the event types will be listed on. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEventTypesAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scope, nameof(scope)); + + var parentPart = scope.Parent.SubstringAfterProviderNamespace(); + var resourceTypeName = (string.IsNullOrEmpty(parentPart) ? string.Empty : $"{parentPart}/") + scope.ResourceType.GetLastType(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListEventTypesRequest(Id.SubscriptionId, Id.ResourceGroupName, scope.ResourceType.Namespace, resourceTypeName, scope.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, EventTypeUnderTopic.DeserializeEventTypeUnderTopic, EventGridTopicTopicsClientDiagnostics, Pipeline, "EventGridResourceGroupMockingExtension.GetEventTypes", "value", null, cancellationToken); + } + + /// + /// List event types for a topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes + /// + /// + /// Operation Id + /// Topics_ListEventTypes + /// + /// + /// + /// The resource identifier that the event types will be listed on. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEventTypes(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(scope, nameof(scope)); + + var parentPart = scope.Parent.SubstringAfterProviderNamespace(); + var resourceTypeName = (string.IsNullOrEmpty(parentPart) ? string.Empty : $"{parentPart}/") + scope.ResourceType.GetLastType(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListEventTypesRequest(Id.SubscriptionId, Id.ResourceGroupName, scope.ResourceType.Namespace, resourceTypeName, scope.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, null, EventTypeUnderTopic.DeserializeEventTypeUnderTopic, EventGridTopicTopicsClientDiagnostics, Pipeline, "EventGridResourceGroupMockingExtension.GetEventTypes", "value", null, cancellationToken); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridResourceGroupResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridResourceGroupResource.cs new file mode 100644 index 0000000000000..1178da65002fd --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridResourceGroupResource.cs @@ -0,0 +1,297 @@ +// 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.Core; + +namespace Azure.ResourceManager.EventGrid.Mocking +{ + [CodeGenSuppress("GetEventTypesAsync", typeof(string), typeof(string), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("GetEventTypes", typeof(string), typeof(string), typeof(string), typeof(CancellationToken))] + public partial class MockableEventGridResourceGroupResource : ArmResource + { + /// + /// List all global event subscriptions under a resource group for a specific topic type. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListGlobalByResourceGroupForTopicType + /// + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListGlobalByResourceGroupForTopicTypeAsync(Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListGlobalByResourceGroupForTopicTypeNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all global event subscriptions under a resource group for a specific topic type. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListGlobalByResourceGroupForTopicType + /// + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGlobalEventSubscriptionsDataForTopicType(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListGlobalByResourceGroupForTopicType(Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListGlobalByResourceGroupForTopicTypeNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription and resource group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListRegionalByResourceGroup + /// + /// Name of the location. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRegionalEventSubscriptionsDataAsync(AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsData"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListRegionalByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, location, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsData"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListRegionalByResourceGroupNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription and resource group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListRegionalByResourceGroup + /// + /// Name of the location. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRegionalEventSubscriptionsData(AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsData"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListRegionalByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, location, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsData"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListRegionalByResourceGroupNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListRegionalByResourceGroupForTopicType + /// + /// Name of the location. + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListRegionalByResourceGroupForTopicTypeAsync(Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListRegionalByResourceGroupForTopicTypeNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListRegionalByResourceGroupForTopicType + /// + /// Name of the location. + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRegionalEventSubscriptionsDataForTopicType(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListRegionalByResourceGroupForTopicType(Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListRegionalByResourceGroupForTopicTypeNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridSubscriptionResource.cs new file mode 100644 index 0000000000000..6cdfcf3303185 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/Extensions/MockableEventGridSubscriptionResource.cs @@ -0,0 +1,295 @@ +// 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.Core; + +namespace Azure.ResourceManager.EventGrid.Mocking +{ + public partial class MockableEventGridSubscriptionResource : ArmResource + { + /// + /// List all global event subscriptions under an Azure subscription for a topic type. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListGlobalBySubscriptionForTopicType + /// + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListGlobalBySubscriptionForTopicTypeAsync(Id.SubscriptionId, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListGlobalBySubscriptionForTopicTypeNextPageAsync(nextLink, Id.SubscriptionId, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all global event subscriptions under an Azure subscription for a topic type. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListGlobalBySubscriptionForTopicType + /// + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGlobalEventSubscriptionsDataForTopicType(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListGlobalBySubscriptionForTopicType(Id.SubscriptionId, topicTypeName, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListGlobalBySubscriptionForTopicTypeNextPage(nextLink, Id.SubscriptionId, topicTypeName, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListRegionalBySubscription + /// + /// Name of the location. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRegionalEventSubscriptionsDataAsync(AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsData"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListRegionalBySubscriptionAsync(Id.SubscriptionId, location, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsData"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListRegionalBySubscriptionNextPageAsync(nextLink, Id.SubscriptionId, location, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListRegionalBySubscription + /// + /// Name of the location. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRegionalEventSubscriptionsData(AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsData"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListRegionalBySubscription(Id.SubscriptionId, location, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsData"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListRegionalBySubscriptionNextPage(nextLink, Id.SubscriptionId, location, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription and topic type. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListRegionalBySubscriptionForTopicType + /// + /// Name of the location. + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListRegionalBySubscriptionForTopicTypeAsync(Id.SubscriptionId, location, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = await EventSubscriptionRestClient.ListRegionalBySubscriptionForTopicTypeNextPageAsync(nextLink, Id.SubscriptionId, location, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// List all event subscriptions from the given location under a specific Azure subscription and topic type. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions + /// Operation Id: EventSubscriptions_ListRegionalBySubscriptionForTopicType + /// + /// Name of the location. + /// Name of the topic type. + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRegionalEventSubscriptionsDataForTopicType(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListRegionalBySubscriptionForTopicType(Id.SubscriptionId, location, topicTypeName, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); + scope.Start(); + try + { + var response = EventSubscriptionRestClient.ListRegionalBySubscriptionForTopicTypeNextPage(nextLink, Id.SubscriptionId, location, topicTypeName, filter, top, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/ResourceGroupResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 50ac3683ce129..0000000000000 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,287 +0,0 @@ -// 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.Core; - -namespace Azure.ResourceManager.EventGrid -{ - internal partial class ResourceGroupResourceExtensionClient - { - /// - /// List all global event subscriptions under a resource group for a specific topic type. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListGlobalByResourceGroupForTopicType - /// - /// Name of the topic type. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListGlobalByResourceGroupForTopicTypeAsync(Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListGlobalByResourceGroupForTopicTypeNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all global event subscriptions under a resource group for a specific topic type. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListGlobalByResourceGroupForTopicType - /// - /// Name of the topic type. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetGlobalEventSubscriptionsDataForTopicType(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListGlobalByResourceGroupForTopicType(Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListGlobalByResourceGroupForTopicTypeNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all event subscriptions from the given location under a specific Azure subscription and resource group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListRegionalByResourceGroup - /// - /// Name of the location. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRegionalEventSubscriptionsDataAsync(AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsData"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListRegionalByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, location, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsData"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListRegionalByResourceGroupNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all event subscriptions from the given location under a specific Azure subscription and resource group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListRegionalByResourceGroup - /// - /// Name of the location. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRegionalEventSubscriptionsData(AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsData"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListRegionalByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, location, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsData"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListRegionalByResourceGroupNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListRegionalByResourceGroupForTopicType - /// - /// Name of the location. - /// Name of the topic type. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListRegionalByResourceGroupForTopicTypeAsync(Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListRegionalByResourceGroupForTopicTypeNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListRegionalByResourceGroupForTopicType - /// - /// Name of the location. - /// Name of the topic type. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRegionalEventSubscriptionsDataForTopicType(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListRegionalByResourceGroupForTopicType(Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListRegionalByResourceGroupForTopicTypeNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/SubscriptionResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 1e8036289d8cb..0000000000000 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Customized/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,287 +0,0 @@ -// 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.Core; - -namespace Azure.ResourceManager.EventGrid -{ - internal partial class SubscriptionResourceExtensionClient - { - /// - /// List all global event subscriptions under an Azure subscription for a topic type. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListGlobalBySubscriptionForTopicType - /// - /// Name of the topic type. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetGlobalEventSubscriptionsDataForTopicTypeAsync(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListGlobalBySubscriptionForTopicTypeAsync(Id.SubscriptionId, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListGlobalBySubscriptionForTopicTypeNextPageAsync(nextLink, Id.SubscriptionId, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all global event subscriptions under an Azure subscription for a topic type. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListGlobalBySubscriptionForTopicType - /// - /// Name of the topic type. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetGlobalEventSubscriptionsDataForTopicType(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListGlobalBySubscriptionForTopicType(Id.SubscriptionId, topicTypeName, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGlobalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListGlobalBySubscriptionForTopicTypeNextPage(nextLink, Id.SubscriptionId, topicTypeName, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all event subscriptions from the given location under a specific Azure subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListRegionalBySubscription - /// - /// Name of the location. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRegionalEventSubscriptionsDataAsync(AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsData"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListRegionalBySubscriptionAsync(Id.SubscriptionId, location, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsData"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListRegionalBySubscriptionNextPageAsync(nextLink, Id.SubscriptionId, location, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all event subscriptions from the given location under a specific Azure subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListRegionalBySubscription - /// - /// Name of the location. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRegionalEventSubscriptionsData(AzureLocation location, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsData"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListRegionalBySubscription(Id.SubscriptionId, location, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsData"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListRegionalBySubscriptionNextPage(nextLink, Id.SubscriptionId, location, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all event subscriptions from the given location under a specific Azure subscription and topic type. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListRegionalBySubscriptionForTopicType - /// - /// Name of the location. - /// Name of the topic type. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRegionalEventSubscriptionsDataForTopicTypeAsync(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListRegionalBySubscriptionForTopicTypeAsync(Id.SubscriptionId, location, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = await EventSubscriptionRestClient.ListRegionalBySubscriptionForTopicTypeNextPageAsync(nextLink, Id.SubscriptionId, location, topicTypeName, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// List all event subscriptions from the given location under a specific Azure subscription and topic type. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions - /// Operation Id: EventSubscriptions_ListRegionalBySubscriptionForTopicType - /// - /// Name of the location. - /// Name of the topic type. - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRegionalEventSubscriptionsDataForTopicType(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListRegionalBySubscriptionForTopicType(Id.SubscriptionId, location, topicTypeName, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = EventSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRegionalEventSubscriptionsDataForTopicType"); - scope.Start(); - try - { - var response = EventSubscriptionRestClient.ListRegionalBySubscriptionForTopicTypeNextPage(nextLink, Id.SubscriptionId, location, topicTypeName, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateResource.cs index 963b5067f74bd..0835d68eccfc3 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/CaCertificateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventGrid public partial class CaCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The caCertificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string caCertificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/caCertificates/{caCertificateName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainEventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainEventSubscriptionResource.cs index 0764638e313b2..122169c3a92d3 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainEventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainEventSubscriptionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.EventGrid public partial class DomainEventSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The domainName. + /// The eventSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string domainName, string eventSubscriptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/eventSubscriptions/{eventSubscriptionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionResource.cs index b1a23f2cb6fc2..4f430710be549 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicEventSubscriptionResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.EventGrid public partial class DomainTopicEventSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The domainName. + /// The topicName. + /// The eventSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string domainName, string topicName, string eventSubscriptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicResource.cs index a11dd0bbc5fa4..0cd0062f27baf 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventGrid public partial class DomainTopicResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The domainName. + /// The domainTopicName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string domainName, string domainTopicName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DomainTopicEventSubscriptionResources and their operations over a DomainTopicEventSubscriptionResource. public virtual DomainTopicEventSubscriptionCollection GetDomainTopicEventSubscriptions() { - return GetCachedClient(Client => new DomainTopicEventSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new DomainTopicEventSubscriptionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual DomainTopicEventSubscriptionCollection GetDomainTopicEventSubscri /// /// Name of the event subscription. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDomainTopicEventSubscriptionAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetDom /// /// Name of the event subscription. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDomainTopicEventSubscription(string eventSubscriptionName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionResource.cs index 7d5b449713896..81a1e795f7fe3 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridDomainPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The parentName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string parentName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResource.cs index aba54fb0a55e0..8b5277af7460d 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainPrivateLinkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridDomainPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The parentName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string parentName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{parentName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs index 58992f129f9d8..00a9bb0909659 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The domainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string domainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DomainTopicResources and their operations over a DomainTopicResource. public virtual DomainTopicCollection GetDomainTopics() { - return GetCachedClient(Client => new DomainTopicCollection(Client, Id)); + return GetCachedClient(client => new DomainTopicCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual DomainTopicCollection GetDomainTopics() /// /// Name of the topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDomainTopicAsync(string domainTopicName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetDomainTopicAsync(str /// /// Name of the topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDomainTopic(string domainTopicName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetDomainTopic(string domainTopicNa /// An object representing collection of DomainEventSubscriptionResources and their operations over a DomainEventSubscriptionResource. public virtual DomainEventSubscriptionCollection GetDomainEventSubscriptions() { - return GetCachedClient(Client => new DomainEventSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new DomainEventSubscriptionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual DomainEventSubscriptionCollection GetDomainEventSubscriptions() /// /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDomainEventSubscriptionAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetDomainEv /// /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDomainEventSubscription(string eventSubscriptionName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetDomainEventSubscript /// An object representing collection of EventGridDomainPrivateEndpointConnectionResources and their operations over a EventGridDomainPrivateEndpointConnectionResource. public virtual EventGridDomainPrivateEndpointConnectionCollection GetEventGridDomainPrivateEndpointConnections() { - return GetCachedClient(Client => new EventGridDomainPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new EventGridDomainPrivateEndpointConnectionCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual EventGridDomainPrivateEndpointConnectionCollection GetEventGridDo /// /// The name of the private endpoint connection connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventGridDomainPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task /// The name of the private endpoint connection connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventGridDomainPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetEve /// An object representing collection of EventGridDomainPrivateLinkResources and their operations over a EventGridDomainPrivateLinkResource. public virtual EventGridDomainPrivateLinkResourceCollection GetEventGridDomainPrivateLinkResources() { - return GetCachedClient(Client => new EventGridDomainPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new EventGridDomainPrivateLinkResourceCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual EventGridDomainPrivateLinkResourceCollection GetEventGridDomainPr /// /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventGridDomainPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetEvent /// /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventGridDomainPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientGroupResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientGroupResource.cs index 46abcde3ec115..e0b4fde971144 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientGroupResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridNamespaceClientGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The clientGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string clientGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clientGroups/{clientGroupName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientResource.cs index f31db82ff31ed..dd4e76477307e 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceClientResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridNamespaceClientResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The clientName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string clientName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/clients/{clientName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespacePermissionBindingResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespacePermissionBindingResource.cs index 35c0863868581..5a199a300c041 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespacePermissionBindingResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespacePermissionBindingResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridNamespacePermissionBindingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The permissionBindingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string permissionBindingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/permissionBindings/{permissionBindingName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceResource.cs index 0638e189d5f4a..f395429c2e783 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridNamespaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CaCertificateResources and their operations over a CaCertificateResource. public virtual CaCertificateCollection GetCaCertificates() { - return GetCachedClient(Client => new CaCertificateCollection(Client, Id)); + return GetCachedClient(client => new CaCertificateCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual CaCertificateCollection GetCaCertificates() /// /// Name of the CA certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCaCertificateAsync(string caCertificateName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetCaCertificateAsync /// /// Name of the CA certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCaCertificate(string caCertificateName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetCaCertificate(string caCertifi /// An object representing collection of EventGridNamespaceClientGroupResources and their operations over a EventGridNamespaceClientGroupResource. public virtual EventGridNamespaceClientGroupCollection GetEventGridNamespaceClientGroups() { - return GetCachedClient(Client => new EventGridNamespaceClientGroupCollection(Client, Id)); + return GetCachedClient(client => new EventGridNamespaceClientGroupCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual EventGridNamespaceClientGroupCollection GetEventGridNamespaceClie /// /// Name of the client group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventGridNamespaceClientGroupAsync(string clientGroupName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetEv /// /// Name of the client group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventGridNamespaceClientGroup(string clientGroupName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetEventGridNames /// An object representing collection of EventGridNamespaceClientResources and their operations over a EventGridNamespaceClientResource. public virtual EventGridNamespaceClientCollection GetEventGridNamespaceClients() { - return GetCachedClient(Client => new EventGridNamespaceClientCollection(Client, Id)); + return GetCachedClient(client => new EventGridNamespaceClientCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual EventGridNamespaceClientCollection GetEventGridNamespaceClients() /// /// Name of the client. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventGridNamespaceClientAsync(string clientName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetEventGr /// /// Name of the client. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventGridNamespaceClient(string clientName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetEventGridNamespaceC /// An object representing collection of NamespaceTopicResources and their operations over a NamespaceTopicResource. public virtual NamespaceTopicCollection GetNamespaceTopics() { - return GetCachedClient(Client => new NamespaceTopicCollection(Client, Id)); + return GetCachedClient(client => new NamespaceTopicCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual NamespaceTopicCollection GetNamespaceTopics() /// /// Name of the namespace topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNamespaceTopicAsync(string topicName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetNamespaceTopicAsy /// /// Name of the namespace topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNamespaceTopic(string topicName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetNamespaceTopic(string topicNa /// An object representing collection of EventGridNamespacePermissionBindingResources and their operations over a EventGridNamespacePermissionBindingResource. public virtual EventGridNamespacePermissionBindingCollection GetEventGridNamespacePermissionBindings() { - return GetCachedClient(Client => new EventGridNamespacePermissionBindingCollection(Client, Id)); + return GetCachedClient(client => new EventGridNamespacePermissionBindingCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual EventGridNamespacePermissionBindingCollection GetEventGridNamespa /// /// Name of the permission binding. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventGridNamespacePermissionBindingAsync(string permissionBindingName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task> /// /// Name of the permission binding. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventGridNamespacePermissionBinding(string permissionBindingName, CancellationToken cancellationToken = default) { @@ -358,7 +361,7 @@ public virtual Response GetEventGri /// An object representing collection of TopicSpaceResources and their operations over a TopicSpaceResource. public virtual TopicSpaceCollection GetTopicSpaces() { - return GetCachedClient(Client => new TopicSpaceCollection(Client, Id)); + return GetCachedClient(client => new TopicSpaceCollection(client, Id)); } /// @@ -376,8 +379,8 @@ public virtual TopicSpaceCollection GetTopicSpaces() /// /// Name of the Topic space. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTopicSpaceAsync(string topicSpaceName, CancellationToken cancellationToken = default) { @@ -399,8 +402,8 @@ public virtual async Task> GetTopicSpaceAsync(strin /// /// Name of the Topic space. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTopicSpace(string topicSpaceName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionResource.cs index b8ba91893a21a..f93aa106cb3e7 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridPartnerNamespacePrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridPartnerNamespacePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The parentName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string parentName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionResource.cs index c5fd14011f3a1..7e44593db8243 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridTopicPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The parentName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string parentName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResource.cs index 33086aa013777..6cc66f12a841c 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicPrivateLinkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridTopicPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The parentName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string parentName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{parentName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs index 674b176eb7dc9..a95c2f02b68aa 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EventGrid public partial class EventGridTopicResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The topicName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string topicName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of TopicEventSubscriptionResources and their operations over a TopicEventSubscriptionResource. public virtual TopicEventSubscriptionCollection GetTopicEventSubscriptions() { - return GetCachedClient(Client => new TopicEventSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new TopicEventSubscriptionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual TopicEventSubscriptionCollection GetTopicEventSubscriptions() /// /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTopicEventSubscriptionAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetTopicEven /// /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTopicEventSubscription(string eventSubscriptionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetTopicEventSubscriptio /// An object representing collection of EventGridTopicPrivateEndpointConnectionResources and their operations over a EventGridTopicPrivateEndpointConnectionResource. public virtual EventGridTopicPrivateEndpointConnectionCollection GetEventGridTopicPrivateEndpointConnections() { - return GetCachedClient(Client => new EventGridTopicPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new EventGridTopicPrivateEndpointConnectionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual EventGridTopicPrivateEndpointConnectionCollection GetEventGridTop /// /// The name of the private endpoint connection connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventGridTopicPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task /// The name of the private endpoint connection connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventGridTopicPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetEven /// An object representing collection of EventGridTopicPrivateLinkResources and their operations over a EventGridTopicPrivateLinkResource. public virtual EventGridTopicPrivateLinkResourceCollection GetEventGridTopicPrivateLinkResources() { - return GetCachedClient(Client => new EventGridTopicPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new EventGridTopicPrivateLinkResourceCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual EventGridTopicPrivateLinkResourceCollection GetEventGridTopicPriv /// /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventGridTopicPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetEventG /// /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventGridTopicPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionResource.cs index 0075b1bd45268..59737f716b192 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventSubscriptionResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.EventGrid public partial class EventSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The eventSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string eventSubscriptionName) { var resourceId = $"{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ExtensionTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ExtensionTopicResource.cs index c2e1f68e53f5e..4a6c51dd869b8 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ExtensionTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/ExtensionTopicResource.cs @@ -25,6 +25,7 @@ namespace Azure.ResourceManager.EventGrid public partial class ExtensionTopicResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. public static ResourceIdentifier CreateResourceIdentifier(string scope) { var resourceId = $"{scope}/providers/Microsoft.EventGrid/extensionTopics/default"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index c8a1b5fefc0cd..0000000000000 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.EventGrid -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of EventSubscriptionResources in the ArmResource. - /// An object representing collection of EventSubscriptionResources and their operations over a EventSubscriptionResource. - public virtual EventSubscriptionCollection GetEventSubscriptions() - { - return GetCachedClient(Client => new EventSubscriptionCollection(Client, Id)); - } - - /// Gets an object representing a ExtensionTopicResource along with the instance operations that can be performed on it in the ArmResource. - /// Returns a object. - public virtual ExtensionTopicResource GetExtensionTopic() - { - return new ExtensionTopicResource(Client, Id.AppendProviderResource("Microsoft.EventGrid", "extensionTopics", "default")); - } - } -} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/EventGridExtensions.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/EventGridExtensions.cs index 80f463ceac094..ee55b8c50d083 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/EventGridExtensions.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/EventGridExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.EventGrid.Mocking; using Azure.ResourceManager.EventGrid.Models; using Azure.ResourceManager.Resources; @@ -19,770 +20,654 @@ namespace Azure.ResourceManager.EventGrid /// A class to add extension methods to Azure.ResourceManager.EventGrid. public static partial class EventGridExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableEventGridArmClient GetMockableEventGridArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableEventGridArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableEventGridResourceGroupResource GetMockableEventGridResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableEventGridResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableEventGridSubscriptionResource GetMockableEventGridSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableEventGridSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableEventGridTenantResource GetMockableEventGridTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableEventGridTenantResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + /// + /// Gets a collection of EventSubscriptionResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of EventSubscriptionResources and their operations over a EventSubscriptionResource. + public static EventSubscriptionCollection GetEventSubscriptions(this ArmClient client, ResourceIdentifier scope) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return GetMockableEventGridArmClient(client).GetEventSubscriptions(scope); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + /// + /// Get properties of an event subscription. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// EventSubscriptions_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Name of the event subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetEventSubscriptionAsync(this ArmClient client, ResourceIdentifier scope, string eventSubscriptionName, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return await GetMockableEventGridArmClient(client).GetEventSubscriptionAsync(scope, eventSubscriptionName, cancellationToken).ConfigureAwait(false); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + /// + /// Get properties of an event subscription. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// EventSubscriptions_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Name of the event subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetEventSubscription(this ArmClient client, ResourceIdentifier scope, string eventSubscriptionName, CancellationToken cancellationToken = default) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return GetMockableEventGridArmClient(client).GetEventSubscription(scope, eventSubscriptionName, cancellationToken); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + /// + /// Gets an object representing a ExtensionTopicResource along with the instance operations that can be performed on it in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Returns a object. + public static ExtensionTopicResource GetExtensionTopic(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); + return GetMockableEventGridArmClient(client).GetExtensionTopic(scope); } - #region CaCertificateResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CaCertificateResource GetCaCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CaCertificateResource.ValidateResourceId(id); - return new CaCertificateResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetCaCertificateResource(id); } - #endregion - #region PartnerNamespaceChannelResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerNamespaceChannelResource GetPartnerNamespaceChannelResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerNamespaceChannelResource.ValidateResourceId(id); - return new PartnerNamespaceChannelResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetPartnerNamespaceChannelResource(id); } - #endregion - #region EventGridNamespaceClientGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridNamespaceClientGroupResource GetEventGridNamespaceClientGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridNamespaceClientGroupResource.ValidateResourceId(id); - return new EventGridNamespaceClientGroupResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridNamespaceClientGroupResource(id); } - #endregion - #region EventGridNamespaceClientResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridNamespaceClientResource GetEventGridNamespaceClientResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridNamespaceClientResource.ValidateResourceId(id); - return new EventGridNamespaceClientResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridNamespaceClientResource(id); } - #endregion - #region EventGridDomainResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridDomainResource GetEventGridDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridDomainResource.ValidateResourceId(id); - return new EventGridDomainResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridDomainResource(id); } - #endregion - #region DomainTopicResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DomainTopicResource GetDomainTopicResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DomainTopicResource.ValidateResourceId(id); - return new DomainTopicResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetDomainTopicResource(id); } - #endregion - #region DomainTopicEventSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DomainTopicEventSubscriptionResource GetDomainTopicEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DomainTopicEventSubscriptionResource.ValidateResourceId(id); - return new DomainTopicEventSubscriptionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetDomainTopicEventSubscriptionResource(id); } - #endregion - #region TopicEventSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TopicEventSubscriptionResource GetTopicEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TopicEventSubscriptionResource.ValidateResourceId(id); - return new TopicEventSubscriptionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetTopicEventSubscriptionResource(id); } - #endregion - #region DomainEventSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DomainEventSubscriptionResource GetDomainEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DomainEventSubscriptionResource.ValidateResourceId(id); - return new DomainEventSubscriptionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetDomainEventSubscriptionResource(id); } - #endregion - #region EventSubscriptionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventSubscriptionResource GetEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventSubscriptionResource.ValidateResourceId(id); - return new EventSubscriptionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventSubscriptionResource(id); } - #endregion - #region SystemTopicEventSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SystemTopicEventSubscriptionResource GetSystemTopicEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SystemTopicEventSubscriptionResource.ValidateResourceId(id); - return new SystemTopicEventSubscriptionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetSystemTopicEventSubscriptionResource(id); } - #endregion - #region PartnerTopicEventSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerTopicEventSubscriptionResource GetPartnerTopicEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerTopicEventSubscriptionResource.ValidateResourceId(id); - return new PartnerTopicEventSubscriptionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetPartnerTopicEventSubscriptionResource(id); } - #endregion - #region NamespaceTopicEventSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NamespaceTopicEventSubscriptionResource GetNamespaceTopicEventSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NamespaceTopicEventSubscriptionResource.ValidateResourceId(id); - return new NamespaceTopicEventSubscriptionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetNamespaceTopicEventSubscriptionResource(id); } - #endregion - #region EventGridNamespaceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridNamespaceResource GetEventGridNamespaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridNamespaceResource.ValidateResourceId(id); - return new EventGridNamespaceResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridNamespaceResource(id); } - #endregion - #region NamespaceTopicResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NamespaceTopicResource GetNamespaceTopicResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NamespaceTopicResource.ValidateResourceId(id); - return new NamespaceTopicResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetNamespaceTopicResource(id); } - #endregion - #region PartnerConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerConfigurationResource GetPartnerConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerConfigurationResource.ValidateResourceId(id); - return new PartnerConfigurationResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetPartnerConfigurationResource(id); } - #endregion - #region PartnerDestinationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerDestinationResource GetPartnerDestinationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerDestinationResource.ValidateResourceId(id); - return new PartnerDestinationResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetPartnerDestinationResource(id); } - #endregion - #region PartnerNamespaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerNamespaceResource GetPartnerNamespaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerNamespaceResource.ValidateResourceId(id); - return new PartnerNamespaceResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetPartnerNamespaceResource(id); } - #endregion - #region PartnerRegistrationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerRegistrationResource GetPartnerRegistrationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerRegistrationResource.ValidateResourceId(id); - return new PartnerRegistrationResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetPartnerRegistrationResource(id); } - #endregion - #region PartnerTopicResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerTopicResource GetPartnerTopicResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerTopicResource.ValidateResourceId(id); - return new PartnerTopicResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetPartnerTopicResource(id); } - #endregion - #region EventGridNamespacePermissionBindingResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridNamespacePermissionBindingResource GetEventGridNamespacePermissionBindingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridNamespacePermissionBindingResource.ValidateResourceId(id); - return new EventGridNamespacePermissionBindingResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridNamespacePermissionBindingResource(id); } - #endregion - #region EventGridTopicPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridTopicPrivateEndpointConnectionResource GetEventGridTopicPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridTopicPrivateEndpointConnectionResource.ValidateResourceId(id); - return new EventGridTopicPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridTopicPrivateEndpointConnectionResource(id); } - #endregion - #region EventGridDomainPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridDomainPrivateEndpointConnectionResource GetEventGridDomainPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridDomainPrivateEndpointConnectionResource.ValidateResourceId(id); - return new EventGridDomainPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridDomainPrivateEndpointConnectionResource(id); } - #endregion - #region EventGridPartnerNamespacePrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridPartnerNamespacePrivateEndpointConnectionResource GetEventGridPartnerNamespacePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridPartnerNamespacePrivateEndpointConnectionResource.ValidateResourceId(id); - return new EventGridPartnerNamespacePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridPartnerNamespacePrivateEndpointConnectionResource(id); } - #endregion - #region EventGridTopicPrivateLinkResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridTopicPrivateLinkResource GetEventGridTopicPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridTopicPrivateLinkResource.ValidateResourceId(id); - return new EventGridTopicPrivateLinkResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridTopicPrivateLinkResource(id); } - #endregion - #region EventGridDomainPrivateLinkResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridDomainPrivateLinkResource GetEventGridDomainPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridDomainPrivateLinkResource.ValidateResourceId(id); - return new EventGridDomainPrivateLinkResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridDomainPrivateLinkResource(id); } - #endregion - #region PartnerNamespacePrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerNamespacePrivateLinkResource GetPartnerNamespacePrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerNamespacePrivateLinkResource.ValidateResourceId(id); - return new PartnerNamespacePrivateLinkResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetPartnerNamespacePrivateLinkResource(id); } - #endregion - #region SystemTopicResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SystemTopicResource GetSystemTopicResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SystemTopicResource.ValidateResourceId(id); - return new SystemTopicResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetSystemTopicResource(id); } - #endregion - #region EventGridTopicResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventGridTopicResource GetEventGridTopicResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventGridTopicResource.ValidateResourceId(id); - return new EventGridTopicResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetEventGridTopicResource(id); } - #endregion - #region ExtensionTopicResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExtensionTopicResource GetExtensionTopicResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExtensionTopicResource.ValidateResourceId(id); - return new ExtensionTopicResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetExtensionTopicResource(id); } - #endregion - #region TopicSpaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TopicSpaceResource GetTopicSpaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TopicSpaceResource.ValidateResourceId(id); - return new TopicSpaceResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetTopicSpaceResource(id); } - #endregion - #region TopicTypeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TopicTypeResource GetTopicTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TopicTypeResource.ValidateResourceId(id); - return new TopicTypeResource(client, id); - } - ); + return GetMockableEventGridArmClient(client).GetTopicTypeResource(id); } - #endregion - #region VerifiedPartnerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VerifiedPartnerResource GetVerifiedPartnerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VerifiedPartnerResource.ValidateResourceId(id); - return new VerifiedPartnerResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of EventSubscriptionResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of EventSubscriptionResources and their operations over a EventSubscriptionResource. - public static EventSubscriptionCollection GetEventSubscriptions(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetEventSubscriptions(); + return GetMockableEventGridArmClient(client).GetVerifiedPartnerResource(id); } /// - /// Get properties of an event subscription. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName} - /// + /// Gets a collection of EventGridDomainResources in the ResourceGroupResource. /// - /// Operation Id - /// EventSubscriptions_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// Name of the event subscription. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetEventSubscriptionAsync(this ArmClient client, ResourceIdentifier scope, string eventSubscriptionName, CancellationToken cancellationToken = default) - { - return await client.GetEventSubscriptions(scope).GetAsync(eventSubscriptionName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get properties of an event subscription. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName} - /// - /// - /// Operation Id - /// EventSubscriptions_Get - /// - /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// Name of the event subscription. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetEventSubscription(this ArmClient client, ResourceIdentifier scope, string eventSubscriptionName, CancellationToken cancellationToken = default) - { - return client.GetEventSubscriptions(scope).Get(eventSubscriptionName, cancellationToken); - } - - /// Gets an object representing a ExtensionTopicResource along with the instance operations that can be performed on it in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// Returns a object. - public static ExtensionTopicResource GetExtensionTopic(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetExtensionTopic(); - } - - /// Gets a collection of EventGridDomainResources in the ResourceGroupResource. /// The instance the method will execute against. /// An object representing collection of EventGridDomainResources and their operations over a EventGridDomainResource. public static EventGridDomainCollection GetEventGridDomains(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventGridDomains(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridDomains(); } /// @@ -797,16 +682,20 @@ public static EventGridDomainCollection GetEventGridDomains(this ResourceGroupRe /// Domains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEventGridDomainAsync(this ResourceGroupResource resourceGroupResource, string domainName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEventGridDomains().GetAsync(domainName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridDomainAsync(domainName, cancellationToken).ConfigureAwait(false); } /// @@ -821,24 +710,34 @@ public static async Task> GetEventGridDomainAs /// Domains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEventGridDomain(this ResourceGroupResource resourceGroupResource, string domainName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEventGridDomains().Get(domainName, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridDomain(domainName, cancellationToken); } - /// Gets a collection of EventGridNamespaceResources in the ResourceGroupResource. + /// + /// Gets a collection of EventGridNamespaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EventGridNamespaceResources and their operations over a EventGridNamespaceResource. public static EventGridNamespaceCollection GetEventGridNamespaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventGridNamespaces(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridNamespaces(); } /// @@ -853,16 +752,20 @@ public static EventGridNamespaceCollection GetEventGridNamespaces(this ResourceG /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEventGridNamespaceAsync(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEventGridNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridNamespaceAsync(namespaceName, cancellationToken).ConfigureAwait(false); } /// @@ -877,32 +780,48 @@ public static async Task> GetEventGridNames /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEventGridNamespace(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEventGridNamespaces().Get(namespaceName, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridNamespace(namespaceName, cancellationToken); } - /// Gets an object representing a PartnerConfigurationResource along with the instance operations that can be performed on it in the ResourceGroupResource. + /// + /// Gets an object representing a PartnerConfigurationResource along with the instance operations that can be performed on it in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Returns a object. public static PartnerConfigurationResource GetPartnerConfiguration(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPartnerConfiguration(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerConfiguration(); } - /// Gets a collection of PartnerDestinationResources in the ResourceGroupResource. + /// + /// Gets a collection of PartnerDestinationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PartnerDestinationResources and their operations over a PartnerDestinationResource. public static PartnerDestinationCollection GetPartnerDestinations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPartnerDestinations(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerDestinations(); } /// @@ -917,16 +836,20 @@ public static PartnerDestinationCollection GetPartnerDestinations(this ResourceG /// PartnerDestinations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the partner destination. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPartnerDestinationAsync(this ResourceGroupResource resourceGroupResource, string partnerDestinationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPartnerDestinations().GetAsync(partnerDestinationName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerDestinationAsync(partnerDestinationName, cancellationToken).ConfigureAwait(false); } /// @@ -941,24 +864,34 @@ public static async Task> GetPartnerDestina /// PartnerDestinations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the partner destination. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPartnerDestination(this ResourceGroupResource resourceGroupResource, string partnerDestinationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPartnerDestinations().Get(partnerDestinationName, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerDestination(partnerDestinationName, cancellationToken); } - /// Gets a collection of PartnerNamespaceResources in the ResourceGroupResource. + /// + /// Gets a collection of PartnerNamespaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PartnerNamespaceResources and their operations over a PartnerNamespaceResource. public static PartnerNamespaceCollection GetPartnerNamespaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPartnerNamespaces(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerNamespaces(); } /// @@ -973,16 +906,20 @@ public static PartnerNamespaceCollection GetPartnerNamespaces(this ResourceGroup /// PartnerNamespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the partner namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPartnerNamespaceAsync(this ResourceGroupResource resourceGroupResource, string partnerNamespaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPartnerNamespaces().GetAsync(partnerNamespaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerNamespaceAsync(partnerNamespaceName, cancellationToken).ConfigureAwait(false); } /// @@ -997,24 +934,34 @@ public static async Task> GetPartnerNamespace /// PartnerNamespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the partner namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPartnerNamespace(this ResourceGroupResource resourceGroupResource, string partnerNamespaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPartnerNamespaces().Get(partnerNamespaceName, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerNamespace(partnerNamespaceName, cancellationToken); } - /// Gets a collection of PartnerRegistrationResources in the ResourceGroupResource. + /// + /// Gets a collection of PartnerRegistrationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PartnerRegistrationResources and their operations over a PartnerRegistrationResource. public static PartnerRegistrationCollection GetPartnerRegistrations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPartnerRegistrations(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerRegistrations(); } /// @@ -1029,16 +976,20 @@ public static PartnerRegistrationCollection GetPartnerRegistrations(this Resourc /// PartnerRegistrations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the partner registration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPartnerRegistrationAsync(this ResourceGroupResource resourceGroupResource, string partnerRegistrationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPartnerRegistrations().GetAsync(partnerRegistrationName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerRegistrationAsync(partnerRegistrationName, cancellationToken).ConfigureAwait(false); } /// @@ -1053,24 +1004,34 @@ public static async Task> GetPartnerRegist /// PartnerRegistrations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the partner registration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPartnerRegistration(this ResourceGroupResource resourceGroupResource, string partnerRegistrationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPartnerRegistrations().Get(partnerRegistrationName, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerRegistration(partnerRegistrationName, cancellationToken); } - /// Gets a collection of PartnerTopicResources in the ResourceGroupResource. + /// + /// Gets a collection of PartnerTopicResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PartnerTopicResources and their operations over a PartnerTopicResource. public static PartnerTopicCollection GetPartnerTopics(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPartnerTopics(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerTopics(); } /// @@ -1085,16 +1046,20 @@ public static PartnerTopicCollection GetPartnerTopics(this ResourceGroupResource /// PartnerTopics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the partner topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPartnerTopicAsync(this ResourceGroupResource resourceGroupResource, string partnerTopicName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPartnerTopics().GetAsync(partnerTopicName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerTopicAsync(partnerTopicName, cancellationToken).ConfigureAwait(false); } /// @@ -1109,24 +1074,34 @@ public static async Task> GetPartnerTopicAsync(th /// PartnerTopics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the partner topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPartnerTopic(this ResourceGroupResource resourceGroupResource, string partnerTopicName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPartnerTopics().Get(partnerTopicName, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetPartnerTopic(partnerTopicName, cancellationToken); } - /// Gets a collection of SystemTopicResources in the ResourceGroupResource. + /// + /// Gets a collection of SystemTopicResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SystemTopicResources and their operations over a SystemTopicResource. public static SystemTopicCollection GetSystemTopics(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSystemTopics(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetSystemTopics(); } /// @@ -1141,16 +1116,20 @@ public static SystemTopicCollection GetSystemTopics(this ResourceGroupResource r /// SystemTopics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the system topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSystemTopicAsync(this ResourceGroupResource resourceGroupResource, string systemTopicName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSystemTopics().GetAsync(systemTopicName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridResourceGroupResource(resourceGroupResource).GetSystemTopicAsync(systemTopicName, cancellationToken).ConfigureAwait(false); } /// @@ -1165,24 +1144,34 @@ public static async Task> GetSystemTopicAsync(this /// SystemTopics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the system topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSystemTopic(this ResourceGroupResource resourceGroupResource, string systemTopicName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSystemTopics().Get(systemTopicName, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetSystemTopic(systemTopicName, cancellationToken); } - /// Gets a collection of EventGridTopicResources in the ResourceGroupResource. + /// + /// Gets a collection of EventGridTopicResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EventGridTopicResources and their operations over a EventGridTopicResource. public static EventGridTopicCollection GetEventGridTopics(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventGridTopics(); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridTopics(); } /// @@ -1197,16 +1186,20 @@ public static EventGridTopicCollection GetEventGridTopics(this ResourceGroupReso /// Topics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEventGridTopicAsync(this ResourceGroupResource resourceGroupResource, string topicName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEventGridTopics().GetAsync(topicName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridTopicAsync(topicName, cancellationToken).ConfigureAwait(false); } /// @@ -1221,16 +1214,20 @@ public static async Task> GetEventGridTopicAsyn /// Topics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the topic. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEventGridTopic(this ResourceGroupResource resourceGroupResource, string topicName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEventGridTopics().Get(topicName, cancellationToken); + return GetMockableEventGridResourceGroupResource(resourceGroupResource).GetEventGridTopic(topicName, cancellationToken); } /// @@ -1245,6 +1242,10 @@ public static Response GetEventGridTopic(this ResourceGr /// Domains_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1253,7 +1254,7 @@ public static Response GetEventGridTopic(this ResourceGr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetEventGridDomainsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridDomainsAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetEventGridDomainsAsync(filter, top, cancellationToken); } /// @@ -1268,6 +1269,10 @@ public static AsyncPageable GetEventGridDomainsAsync(th /// Domains_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1276,7 +1281,7 @@ public static AsyncPageable GetEventGridDomainsAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetEventGridDomains(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridDomains(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetEventGridDomains(filter, top, cancellationToken); } /// @@ -1291,6 +1296,10 @@ public static Pageable GetEventGridDomains(this Subscri /// Namespaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1299,7 +1308,7 @@ public static Pageable GetEventGridDomains(this Subscri /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetEventGridNamespacesAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridNamespacesAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetEventGridNamespacesAsync(filter, top, cancellationToken); } /// @@ -1314,6 +1323,10 @@ public static AsyncPageable GetEventGridNamespacesAs /// Namespaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1322,7 +1335,7 @@ public static AsyncPageable GetEventGridNamespacesAs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetEventGridNamespaces(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridNamespaces(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetEventGridNamespaces(filter, top, cancellationToken); } /// @@ -1337,6 +1350,10 @@ public static Pageable GetEventGridNamespaces(this S /// PartnerConfigurations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1345,7 +1362,7 @@ public static Pageable GetEventGridNamespaces(this S /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPartnerConfigurationsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerConfigurationsAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerConfigurationsAsync(filter, top, cancellationToken); } /// @@ -1360,6 +1377,10 @@ public static AsyncPageable GetPartnerConfiguratio /// PartnerConfigurations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1368,7 +1389,7 @@ public static AsyncPageable GetPartnerConfiguratio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPartnerConfigurations(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerConfigurations(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerConfigurations(filter, top, cancellationToken); } /// @@ -1383,6 +1404,10 @@ public static Pageable GetPartnerConfigurations(th /// PartnerDestinations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1391,7 +1416,7 @@ public static Pageable GetPartnerConfigurations(th /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPartnerDestinationsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerDestinationsAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerDestinationsAsync(filter, top, cancellationToken); } /// @@ -1406,6 +1431,10 @@ public static AsyncPageable GetPartnerDestinationsAs /// PartnerDestinations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1414,7 +1443,7 @@ public static AsyncPageable GetPartnerDestinationsAs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPartnerDestinations(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerDestinations(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerDestinations(filter, top, cancellationToken); } /// @@ -1429,6 +1458,10 @@ public static Pageable GetPartnerDestinations(this S /// PartnerNamespaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1437,7 +1470,7 @@ public static Pageable GetPartnerDestinations(this S /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPartnerNamespacesAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerNamespacesAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerNamespacesAsync(filter, top, cancellationToken); } /// @@ -1452,6 +1485,10 @@ public static AsyncPageable GetPartnerNamespacesAsync( /// PartnerNamespaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1460,7 +1497,7 @@ public static AsyncPageable GetPartnerNamespacesAsync( /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPartnerNamespaces(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerNamespaces(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerNamespaces(filter, top, cancellationToken); } /// @@ -1475,6 +1512,10 @@ public static Pageable GetPartnerNamespaces(this Subsc /// PartnerRegistrations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1483,7 +1524,7 @@ public static Pageable GetPartnerNamespaces(this Subsc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPartnerRegistrationsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerRegistrationsAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerRegistrationsAsync(filter, top, cancellationToken); } /// @@ -1498,6 +1539,10 @@ public static AsyncPageable GetPartnerRegistrations /// PartnerRegistrations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1506,7 +1551,7 @@ public static AsyncPageable GetPartnerRegistrations /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPartnerRegistrations(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerRegistrations(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerRegistrations(filter, top, cancellationToken); } /// @@ -1521,6 +1566,10 @@ public static Pageable GetPartnerRegistrations(this /// PartnerTopics_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1529,7 +1578,7 @@ public static Pageable GetPartnerRegistrations(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPartnerTopicsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerTopicsAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerTopicsAsync(filter, top, cancellationToken); } /// @@ -1544,6 +1593,10 @@ public static AsyncPageable GetPartnerTopicsAsync(this Sub /// PartnerTopics_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1552,7 +1605,7 @@ public static AsyncPageable GetPartnerTopicsAsync(this Sub /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPartnerTopics(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPartnerTopics(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetPartnerTopics(filter, top, cancellationToken); } /// @@ -1567,6 +1620,10 @@ public static Pageable GetPartnerTopics(this SubscriptionR /// SystemTopics_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1575,7 +1632,7 @@ public static Pageable GetPartnerTopics(this SubscriptionR /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSystemTopicsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSystemTopicsAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetSystemTopicsAsync(filter, top, cancellationToken); } /// @@ -1590,6 +1647,10 @@ public static AsyncPageable GetSystemTopicsAsync(this Subsc /// SystemTopics_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1598,7 +1659,7 @@ public static AsyncPageable GetSystemTopicsAsync(this Subsc /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSystemTopics(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSystemTopics(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetSystemTopics(filter, top, cancellationToken); } /// @@ -1613,6 +1674,10 @@ public static Pageable GetSystemTopics(this SubscriptionRes /// Topics_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1621,7 +1686,7 @@ public static Pageable GetSystemTopics(this SubscriptionRes /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetEventGridTopicsAsync(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridTopicsAsync(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetEventGridTopicsAsync(filter, top, cancellationToken); } /// @@ -1636,6 +1701,10 @@ public static AsyncPageable GetEventGridTopicsAsync(this /// Topics_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. @@ -1644,15 +1713,21 @@ public static AsyncPageable GetEventGridTopicsAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetEventGridTopics(this SubscriptionResource subscriptionResource, string filter = null, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventGridTopics(filter, top, cancellationToken); + return GetMockableEventGridSubscriptionResource(subscriptionResource).GetEventGridTopics(filter, top, cancellationToken); } - /// Gets a collection of TopicTypeResources in the TenantResource. + /// + /// Gets a collection of TopicTypeResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TopicTypeResources and their operations over a TopicTypeResource. public static TopicTypeCollection GetTopicTypes(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetTopicTypes(); + return GetMockableEventGridTenantResource(tenantResource).GetTopicTypes(); } /// @@ -1667,16 +1742,20 @@ public static TopicTypeCollection GetTopicTypes(this TenantResource tenantResour /// TopicTypes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the topic type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTopicTypeAsync(this TenantResource tenantResource, string topicTypeName, CancellationToken cancellationToken = default) { - return await tenantResource.GetTopicTypes().GetAsync(topicTypeName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridTenantResource(tenantResource).GetTopicTypeAsync(topicTypeName, cancellationToken).ConfigureAwait(false); } /// @@ -1691,24 +1770,34 @@ public static async Task> GetTopicTypeAsync(this Ten /// TopicTypes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the topic type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTopicType(this TenantResource tenantResource, string topicTypeName, CancellationToken cancellationToken = default) { - return tenantResource.GetTopicTypes().Get(topicTypeName, cancellationToken); + return GetMockableEventGridTenantResource(tenantResource).GetTopicType(topicTypeName, cancellationToken); } - /// Gets a collection of VerifiedPartnerResources in the TenantResource. + /// + /// Gets a collection of VerifiedPartnerResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VerifiedPartnerResources and their operations over a VerifiedPartnerResource. public static VerifiedPartnerCollection GetVerifiedPartners(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetVerifiedPartners(); + return GetMockableEventGridTenantResource(tenantResource).GetVerifiedPartners(); } /// @@ -1723,16 +1812,20 @@ public static VerifiedPartnerCollection GetVerifiedPartners(this TenantResource /// VerifiedPartners_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the verified partner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVerifiedPartnerAsync(this TenantResource tenantResource, string verifiedPartnerName, CancellationToken cancellationToken = default) { - return await tenantResource.GetVerifiedPartners().GetAsync(verifiedPartnerName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventGridTenantResource(tenantResource).GetVerifiedPartnerAsync(verifiedPartnerName, cancellationToken).ConfigureAwait(false); } /// @@ -1747,16 +1840,20 @@ public static async Task> GetVerifiedPartnerAs /// VerifiedPartners_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the verified partner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVerifiedPartner(this TenantResource tenantResource, string verifiedPartnerName, CancellationToken cancellationToken = default) { - return tenantResource.GetVerifiedPartners().Get(verifiedPartnerName, cancellationToken); + return GetMockableEventGridTenantResource(tenantResource).GetVerifiedPartner(verifiedPartnerName, cancellationToken); } } } diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridArmClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridArmClient.cs new file mode 100644 index 0000000000000..8c80fffef35be --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridArmClient.cs @@ -0,0 +1,503 @@ +// 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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableEventGridArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableEventGridArmClient() + { + } + + /// 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 MockableEventGridArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableEventGridArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of EventSubscriptionResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of EventSubscriptionResources and their operations over a EventSubscriptionResource. + public virtual EventSubscriptionCollection GetEventSubscriptions(ResourceIdentifier scope) + { + return new EventSubscriptionCollection(Client, scope); + } + + /// + /// Get properties of an event subscription. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// EventSubscriptions_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Name of the event subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEventSubscriptionAsync(ResourceIdentifier scope, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + return await GetEventSubscriptions(scope).GetAsync(eventSubscriptionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of an event subscription. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName} + /// + /// + /// Operation Id + /// EventSubscriptions_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Name of the event subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEventSubscription(ResourceIdentifier scope, string eventSubscriptionName, CancellationToken cancellationToken = default) + { + return GetEventSubscriptions(scope).Get(eventSubscriptionName, cancellationToken); + } + + /// Gets an object representing a ExtensionTopicResource along with the instance operations that can be performed on it in the ArmClient. + /// The scope that the resource will apply against. + /// Returns a object. + public virtual ExtensionTopicResource GetExtensionTopic(ResourceIdentifier scope) + { + return new ExtensionTopicResource(Client, scope.AppendProviderResource("Microsoft.EventGrid", "extensionTopics", "default")); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CaCertificateResource GetCaCertificateResource(ResourceIdentifier id) + { + CaCertificateResource.ValidateResourceId(id); + return new CaCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerNamespaceChannelResource GetPartnerNamespaceChannelResource(ResourceIdentifier id) + { + PartnerNamespaceChannelResource.ValidateResourceId(id); + return new PartnerNamespaceChannelResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridNamespaceClientGroupResource GetEventGridNamespaceClientGroupResource(ResourceIdentifier id) + { + EventGridNamespaceClientGroupResource.ValidateResourceId(id); + return new EventGridNamespaceClientGroupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridNamespaceClientResource GetEventGridNamespaceClientResource(ResourceIdentifier id) + { + EventGridNamespaceClientResource.ValidateResourceId(id); + return new EventGridNamespaceClientResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridDomainResource GetEventGridDomainResource(ResourceIdentifier id) + { + EventGridDomainResource.ValidateResourceId(id); + return new EventGridDomainResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DomainTopicResource GetDomainTopicResource(ResourceIdentifier id) + { + DomainTopicResource.ValidateResourceId(id); + return new DomainTopicResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DomainTopicEventSubscriptionResource GetDomainTopicEventSubscriptionResource(ResourceIdentifier id) + { + DomainTopicEventSubscriptionResource.ValidateResourceId(id); + return new DomainTopicEventSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TopicEventSubscriptionResource GetTopicEventSubscriptionResource(ResourceIdentifier id) + { + TopicEventSubscriptionResource.ValidateResourceId(id); + return new TopicEventSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DomainEventSubscriptionResource GetDomainEventSubscriptionResource(ResourceIdentifier id) + { + DomainEventSubscriptionResource.ValidateResourceId(id); + return new DomainEventSubscriptionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventSubscriptionResource GetEventSubscriptionResource(ResourceIdentifier id) + { + EventSubscriptionResource.ValidateResourceId(id); + return new EventSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SystemTopicEventSubscriptionResource GetSystemTopicEventSubscriptionResource(ResourceIdentifier id) + { + SystemTopicEventSubscriptionResource.ValidateResourceId(id); + return new SystemTopicEventSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerTopicEventSubscriptionResource GetPartnerTopicEventSubscriptionResource(ResourceIdentifier id) + { + PartnerTopicEventSubscriptionResource.ValidateResourceId(id); + return new PartnerTopicEventSubscriptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NamespaceTopicEventSubscriptionResource GetNamespaceTopicEventSubscriptionResource(ResourceIdentifier id) + { + NamespaceTopicEventSubscriptionResource.ValidateResourceId(id); + return new NamespaceTopicEventSubscriptionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridNamespaceResource GetEventGridNamespaceResource(ResourceIdentifier id) + { + EventGridNamespaceResource.ValidateResourceId(id); + return new EventGridNamespaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NamespaceTopicResource GetNamespaceTopicResource(ResourceIdentifier id) + { + NamespaceTopicResource.ValidateResourceId(id); + return new NamespaceTopicResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerConfigurationResource GetPartnerConfigurationResource(ResourceIdentifier id) + { + PartnerConfigurationResource.ValidateResourceId(id); + return new PartnerConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerDestinationResource GetPartnerDestinationResource(ResourceIdentifier id) + { + PartnerDestinationResource.ValidateResourceId(id); + return new PartnerDestinationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerNamespaceResource GetPartnerNamespaceResource(ResourceIdentifier id) + { + PartnerNamespaceResource.ValidateResourceId(id); + return new PartnerNamespaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerRegistrationResource GetPartnerRegistrationResource(ResourceIdentifier id) + { + PartnerRegistrationResource.ValidateResourceId(id); + return new PartnerRegistrationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerTopicResource GetPartnerTopicResource(ResourceIdentifier id) + { + PartnerTopicResource.ValidateResourceId(id); + return new PartnerTopicResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridNamespacePermissionBindingResource GetEventGridNamespacePermissionBindingResource(ResourceIdentifier id) + { + EventGridNamespacePermissionBindingResource.ValidateResourceId(id); + return new EventGridNamespacePermissionBindingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridTopicPrivateEndpointConnectionResource GetEventGridTopicPrivateEndpointConnectionResource(ResourceIdentifier id) + { + EventGridTopicPrivateEndpointConnectionResource.ValidateResourceId(id); + return new EventGridTopicPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridDomainPrivateEndpointConnectionResource GetEventGridDomainPrivateEndpointConnectionResource(ResourceIdentifier id) + { + EventGridDomainPrivateEndpointConnectionResource.ValidateResourceId(id); + return new EventGridDomainPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridPartnerNamespacePrivateEndpointConnectionResource GetEventGridPartnerNamespacePrivateEndpointConnectionResource(ResourceIdentifier id) + { + EventGridPartnerNamespacePrivateEndpointConnectionResource.ValidateResourceId(id); + return new EventGridPartnerNamespacePrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridTopicPrivateLinkResource GetEventGridTopicPrivateLinkResource(ResourceIdentifier id) + { + EventGridTopicPrivateLinkResource.ValidateResourceId(id); + return new EventGridTopicPrivateLinkResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridDomainPrivateLinkResource GetEventGridDomainPrivateLinkResource(ResourceIdentifier id) + { + EventGridDomainPrivateLinkResource.ValidateResourceId(id); + return new EventGridDomainPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerNamespacePrivateLinkResource GetPartnerNamespacePrivateLinkResource(ResourceIdentifier id) + { + PartnerNamespacePrivateLinkResource.ValidateResourceId(id); + return new PartnerNamespacePrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SystemTopicResource GetSystemTopicResource(ResourceIdentifier id) + { + SystemTopicResource.ValidateResourceId(id); + return new SystemTopicResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventGridTopicResource GetEventGridTopicResource(ResourceIdentifier id) + { + EventGridTopicResource.ValidateResourceId(id); + return new EventGridTopicResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExtensionTopicResource GetExtensionTopicResource(ResourceIdentifier id) + { + ExtensionTopicResource.ValidateResourceId(id); + return new ExtensionTopicResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TopicSpaceResource GetTopicSpaceResource(ResourceIdentifier id) + { + TopicSpaceResource.ValidateResourceId(id); + return new TopicSpaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TopicTypeResource GetTopicTypeResource(ResourceIdentifier id) + { + TopicTypeResource.ValidateResourceId(id); + return new TopicTypeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VerifiedPartnerResource GetVerifiedPartnerResource(ResourceIdentifier id) + { + VerifiedPartnerResource.ValidateResourceId(id); + return new VerifiedPartnerResource(Client, id); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridResourceGroupResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridResourceGroupResource.cs new file mode 100644 index 0000000000000..0c2f00561ca78 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridResourceGroupResource.cs @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.EventGrid; +using Azure.ResourceManager.EventGrid.Models; + +namespace Azure.ResourceManager.EventGrid.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableEventGridResourceGroupResource : ArmResource + { + private ClientDiagnostics _eventSubscriptionClientDiagnostics; + private EventSubscriptionsRestOperations _eventSubscriptionRestClient; + private ClientDiagnostics _eventGridTopicTopicsClientDiagnostics; + private TopicsRestOperations _eventGridTopicTopicsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableEventGridResourceGroupResource() + { + } + + /// 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 MockableEventGridResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics EventSubscriptionClientDiagnostics => _eventSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventSubscriptionResource.ResourceType.Namespace, Diagnostics); + private EventSubscriptionsRestOperations EventSubscriptionRestClient => _eventSubscriptionRestClient ??= new EventSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventSubscriptionResource.ResourceType)); + private ClientDiagnostics EventGridTopicTopicsClientDiagnostics => _eventGridTopicTopicsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridTopicResource.ResourceType.Namespace, Diagnostics); + private TopicsRestOperations EventGridTopicTopicsRestClient => _eventGridTopicTopicsRestClient ??= new TopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridTopicResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of EventGridDomainResources in the ResourceGroupResource. + /// An object representing collection of EventGridDomainResources and their operations over a EventGridDomainResource. + public virtual EventGridDomainCollection GetEventGridDomains() + { + return GetCachedClient(client => new EventGridDomainCollection(client, Id)); + } + + /// + /// Get properties of a domain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEventGridDomainAsync(string domainName, CancellationToken cancellationToken = default) + { + return await GetEventGridDomains().GetAsync(domainName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a domain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEventGridDomain(string domainName, CancellationToken cancellationToken = default) + { + return GetEventGridDomains().Get(domainName, cancellationToken); + } + + /// Gets a collection of EventGridNamespaceResources in the ResourceGroupResource. + /// An object representing collection of EventGridNamespaceResources and their operations over a EventGridNamespaceResource. + public virtual EventGridNamespaceCollection GetEventGridNamespaces() + { + return GetCachedClient(client => new EventGridNamespaceCollection(client, Id)); + } + + /// + /// Get properties of a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// Name of the namespace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEventGridNamespaceAsync(string namespaceName, CancellationToken cancellationToken = default) + { + return await GetEventGridNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// Name of the namespace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEventGridNamespace(string namespaceName, CancellationToken cancellationToken = default) + { + return GetEventGridNamespaces().Get(namespaceName, cancellationToken); + } + + /// Gets an object representing a PartnerConfigurationResource along with the instance operations that can be performed on it in the ResourceGroupResource. + /// Returns a object. + public virtual PartnerConfigurationResource GetPartnerConfiguration() + { + return new PartnerConfigurationResource(Client, Id.AppendProviderResource("Microsoft.EventGrid", "partnerConfigurations", "default")); + } + + /// Gets a collection of PartnerDestinationResources in the ResourceGroupResource. + /// An object representing collection of PartnerDestinationResources and their operations over a PartnerDestinationResource. + public virtual PartnerDestinationCollection GetPartnerDestinations() + { + return GetCachedClient(client => new PartnerDestinationCollection(client, Id)); + } + + /// + /// Get properties of a partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// Name of the partner destination. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPartnerDestinationAsync(string partnerDestinationName, CancellationToken cancellationToken = default) + { + return await GetPartnerDestinations().GetAsync(partnerDestinationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a partner destination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName} + /// + /// + /// Operation Id + /// PartnerDestinations_Get + /// + /// + /// + /// Name of the partner destination. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPartnerDestination(string partnerDestinationName, CancellationToken cancellationToken = default) + { + return GetPartnerDestinations().Get(partnerDestinationName, cancellationToken); + } + + /// Gets a collection of PartnerNamespaceResources in the ResourceGroupResource. + /// An object representing collection of PartnerNamespaceResources and their operations over a PartnerNamespaceResource. + public virtual PartnerNamespaceCollection GetPartnerNamespaces() + { + return GetCachedClient(client => new PartnerNamespaceCollection(client, Id)); + } + + /// + /// Get properties of a partner namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName} + /// + /// + /// Operation Id + /// PartnerNamespaces_Get + /// + /// + /// + /// Name of the partner namespace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPartnerNamespaceAsync(string partnerNamespaceName, CancellationToken cancellationToken = default) + { + return await GetPartnerNamespaces().GetAsync(partnerNamespaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a partner namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName} + /// + /// + /// Operation Id + /// PartnerNamespaces_Get + /// + /// + /// + /// Name of the partner namespace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPartnerNamespace(string partnerNamespaceName, CancellationToken cancellationToken = default) + { + return GetPartnerNamespaces().Get(partnerNamespaceName, cancellationToken); + } + + /// Gets a collection of PartnerRegistrationResources in the ResourceGroupResource. + /// An object representing collection of PartnerRegistrationResources and their operations over a PartnerRegistrationResource. + public virtual PartnerRegistrationCollection GetPartnerRegistrations() + { + return GetCachedClient(client => new PartnerRegistrationCollection(client, Id)); + } + + /// + /// Gets a partner registration with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName} + /// + /// + /// Operation Id + /// PartnerRegistrations_Get + /// + /// + /// + /// Name of the partner registration. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPartnerRegistrationAsync(string partnerRegistrationName, CancellationToken cancellationToken = default) + { + return await GetPartnerRegistrations().GetAsync(partnerRegistrationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a partner registration with the specified parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName} + /// + /// + /// Operation Id + /// PartnerRegistrations_Get + /// + /// + /// + /// Name of the partner registration. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPartnerRegistration(string partnerRegistrationName, CancellationToken cancellationToken = default) + { + return GetPartnerRegistrations().Get(partnerRegistrationName, cancellationToken); + } + + /// Gets a collection of PartnerTopicResources in the ResourceGroupResource. + /// An object representing collection of PartnerTopicResources and their operations over a PartnerTopicResource. + public virtual PartnerTopicCollection GetPartnerTopics() + { + return GetCachedClient(client => new PartnerTopicCollection(client, Id)); + } + + /// + /// Get properties of a partner topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName} + /// + /// + /// Operation Id + /// PartnerTopics_Get + /// + /// + /// + /// Name of the partner topic. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPartnerTopicAsync(string partnerTopicName, CancellationToken cancellationToken = default) + { + return await GetPartnerTopics().GetAsync(partnerTopicName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a partner topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName} + /// + /// + /// Operation Id + /// PartnerTopics_Get + /// + /// + /// + /// Name of the partner topic. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPartnerTopic(string partnerTopicName, CancellationToken cancellationToken = default) + { + return GetPartnerTopics().Get(partnerTopicName, cancellationToken); + } + + /// Gets a collection of SystemTopicResources in the ResourceGroupResource. + /// An object representing collection of SystemTopicResources and their operations over a SystemTopicResource. + public virtual SystemTopicCollection GetSystemTopics() + { + return GetCachedClient(client => new SystemTopicCollection(client, Id)); + } + + /// + /// Get properties of a system topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName} + /// + /// + /// Operation Id + /// SystemTopics_Get + /// + /// + /// + /// Name of the system topic. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSystemTopicAsync(string systemTopicName, CancellationToken cancellationToken = default) + { + return await GetSystemTopics().GetAsync(systemTopicName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a system topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName} + /// + /// + /// Operation Id + /// SystemTopics_Get + /// + /// + /// + /// Name of the system topic. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSystemTopic(string systemTopicName, CancellationToken cancellationToken = default) + { + return GetSystemTopics().Get(systemTopicName, cancellationToken); + } + + /// Gets a collection of EventGridTopicResources in the ResourceGroupResource. + /// An object representing collection of EventGridTopicResources and their operations over a EventGridTopicResource. + public virtual EventGridTopicCollection GetEventGridTopics() + { + return GetCachedClient(client => new EventGridTopicCollection(client, Id)); + } + + /// + /// Get properties of a topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName} + /// + /// + /// Operation Id + /// Topics_Get + /// + /// + /// + /// Name of the topic. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEventGridTopicAsync(string topicName, CancellationToken cancellationToken = default) + { + return await GetEventGridTopics().GetAsync(topicName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a topic. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName} + /// + /// + /// Operation Id + /// Topics_Get + /// + /// + /// + /// Name of the topic. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEventGridTopic(string topicName, CancellationToken cancellationToken = default) + { + return GetEventGridTopics().Get(topicName, cancellationToken); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridSubscriptionResource.cs new file mode 100644 index 0000000000000..544a46f9524b0 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridSubscriptionResource.cs @@ -0,0 +1,514 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableEventGridSubscriptionResource : ArmResource + { + private ClientDiagnostics _eventGridDomainDomainsClientDiagnostics; + private DomainsRestOperations _eventGridDomainDomainsRestClient; + private ClientDiagnostics _eventSubscriptionClientDiagnostics; + private EventSubscriptionsRestOperations _eventSubscriptionRestClient; + private ClientDiagnostics _eventGridNamespaceNamespacesClientDiagnostics; + private NamespacesRestOperations _eventGridNamespaceNamespacesRestClient; + private ClientDiagnostics _partnerConfigurationClientDiagnostics; + private PartnerConfigurationsRestOperations _partnerConfigurationRestClient; + private ClientDiagnostics _partnerDestinationClientDiagnostics; + private PartnerDestinationsRestOperations _partnerDestinationRestClient; + private ClientDiagnostics _partnerNamespaceClientDiagnostics; + private PartnerNamespacesRestOperations _partnerNamespaceRestClient; + private ClientDiagnostics _partnerRegistrationClientDiagnostics; + private PartnerRegistrationsRestOperations _partnerRegistrationRestClient; + private ClientDiagnostics _partnerTopicClientDiagnostics; + private PartnerTopicsRestOperations _partnerTopicRestClient; + private ClientDiagnostics _systemTopicClientDiagnostics; + private SystemTopicsRestOperations _systemTopicRestClient; + private ClientDiagnostics _eventGridTopicTopicsClientDiagnostics; + private TopicsRestOperations _eventGridTopicTopicsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableEventGridSubscriptionResource() + { + } + + /// 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 MockableEventGridSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics EventGridDomainDomainsClientDiagnostics => _eventGridDomainDomainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridDomainResource.ResourceType.Namespace, Diagnostics); + private DomainsRestOperations EventGridDomainDomainsRestClient => _eventGridDomainDomainsRestClient ??= new DomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridDomainResource.ResourceType)); + private ClientDiagnostics EventSubscriptionClientDiagnostics => _eventSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventSubscriptionResource.ResourceType.Namespace, Diagnostics); + private EventSubscriptionsRestOperations EventSubscriptionRestClient => _eventSubscriptionRestClient ??= new EventSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventSubscriptionResource.ResourceType)); + private ClientDiagnostics EventGridNamespaceNamespacesClientDiagnostics => _eventGridNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridNamespaceResource.ResourceType.Namespace, Diagnostics); + private NamespacesRestOperations EventGridNamespaceNamespacesRestClient => _eventGridNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridNamespaceResource.ResourceType)); + private ClientDiagnostics PartnerConfigurationClientDiagnostics => _partnerConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerConfigurationResource.ResourceType.Namespace, Diagnostics); + private PartnerConfigurationsRestOperations PartnerConfigurationRestClient => _partnerConfigurationRestClient ??= new PartnerConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerConfigurationResource.ResourceType)); + private ClientDiagnostics PartnerDestinationClientDiagnostics => _partnerDestinationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerDestinationResource.ResourceType.Namespace, Diagnostics); + private PartnerDestinationsRestOperations PartnerDestinationRestClient => _partnerDestinationRestClient ??= new PartnerDestinationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerDestinationResource.ResourceType)); + private ClientDiagnostics PartnerNamespaceClientDiagnostics => _partnerNamespaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerNamespaceResource.ResourceType.Namespace, Diagnostics); + private PartnerNamespacesRestOperations PartnerNamespaceRestClient => _partnerNamespaceRestClient ??= new PartnerNamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerNamespaceResource.ResourceType)); + private ClientDiagnostics PartnerRegistrationClientDiagnostics => _partnerRegistrationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerRegistrationResource.ResourceType.Namespace, Diagnostics); + private PartnerRegistrationsRestOperations PartnerRegistrationRestClient => _partnerRegistrationRestClient ??= new PartnerRegistrationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerRegistrationResource.ResourceType)); + private ClientDiagnostics PartnerTopicClientDiagnostics => _partnerTopicClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerTopicResource.ResourceType.Namespace, Diagnostics); + private PartnerTopicsRestOperations PartnerTopicRestClient => _partnerTopicRestClient ??= new PartnerTopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerTopicResource.ResourceType)); + private ClientDiagnostics SystemTopicClientDiagnostics => _systemTopicClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", SystemTopicResource.ResourceType.Namespace, Diagnostics); + private SystemTopicsRestOperations SystemTopicRestClient => _systemTopicRestClient ??= new SystemTopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SystemTopicResource.ResourceType)); + private ClientDiagnostics EventGridTopicTopicsClientDiagnostics => _eventGridTopicTopicsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridTopicResource.ResourceType.Namespace, Diagnostics); + private TopicsRestOperations EventGridTopicTopicsRestClient => _eventGridTopicTopicsRestClient ??= new TopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridTopicResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all the domains under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains + /// + /// + /// Operation Id + /// Domains_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEventGridDomainsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridDomainDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridDomainDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventGridDomainResource(Client, EventGridDomainData.DeserializeEventGridDomainData(e)), EventGridDomainDomainsClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetEventGridDomains", "value", "nextLink", cancellationToken); + } + + /// + /// List all the domains under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains + /// + /// + /// Operation Id + /// Domains_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEventGridDomains(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridDomainDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridDomainDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventGridDomainResource(Client, EventGridDomainData.DeserializeEventGridDomainData(e)), EventGridDomainDomainsClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetEventGridDomains", "value", "nextLink", cancellationToken); + } + + /// + /// List all the namespaces under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEventGridNamespacesAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridNamespaceNamespacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridNamespaceNamespacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventGridNamespaceResource(Client, EventGridNamespaceData.DeserializeEventGridNamespaceData(e)), EventGridNamespaceNamespacesClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetEventGridNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// List all the namespaces under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEventGridNamespaces(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridNamespaceNamespacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridNamespaceNamespacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventGridNamespaceResource(Client, EventGridNamespaceData.DeserializeEventGridNamespaceData(e)), EventGridNamespaceNamespacesClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetEventGridNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner configurations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerConfigurations + /// + /// + /// Operation Id + /// PartnerConfigurations_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPartnerConfigurationsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerConfigurationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerConfigurationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerConfigurationResource(Client, PartnerConfigurationData.DeserializePartnerConfigurationData(e)), PartnerConfigurationClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner configurations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerConfigurations + /// + /// + /// Operation Id + /// PartnerConfigurations_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPartnerConfigurations(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerConfigurationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerConfigurationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerConfigurationResource(Client, PartnerConfigurationData.DeserializePartnerConfigurationData(e)), PartnerConfigurationClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner destinations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations + /// + /// + /// Operation Id + /// PartnerDestinations_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPartnerDestinationsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerDestinationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerDestinationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerDestinationResource(Client, PartnerDestinationData.DeserializePartnerDestinationData(e)), PartnerDestinationClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerDestinations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner destinations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations + /// + /// + /// Operation Id + /// PartnerDestinations_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPartnerDestinations(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerDestinationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerDestinationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerDestinationResource(Client, PartnerDestinationData.DeserializePartnerDestinationData(e)), PartnerDestinationClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerDestinations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner namespaces under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces + /// + /// + /// Operation Id + /// PartnerNamespaces_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPartnerNamespacesAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerNamespaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerNamespaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerNamespaceResource(Client, PartnerNamespaceData.DeserializePartnerNamespaceData(e)), PartnerNamespaceClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner namespaces under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces + /// + /// + /// Operation Id + /// PartnerNamespaces_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPartnerNamespaces(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerNamespaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerNamespaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerNamespaceResource(Client, PartnerNamespaceData.DeserializePartnerNamespaceData(e)), PartnerNamespaceClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner registrations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations + /// + /// + /// Operation Id + /// PartnerRegistrations_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPartnerRegistrationsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerRegistrationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerRegistrationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerRegistrationResource(Client, PartnerRegistrationData.DeserializePartnerRegistrationData(e)), PartnerRegistrationClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerRegistrations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner registrations under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations + /// + /// + /// Operation Id + /// PartnerRegistrations_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPartnerRegistrations(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerRegistrationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerRegistrationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerRegistrationResource(Client, PartnerRegistrationData.DeserializePartnerRegistrationData(e)), PartnerRegistrationClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerRegistrations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics + /// + /// + /// Operation Id + /// PartnerTopics_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPartnerTopicsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerTopicRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerTopicResource(Client, PartnerTopicData.DeserializePartnerTopicData(e)), PartnerTopicClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerTopics", "value", "nextLink", cancellationToken); + } + + /// + /// List all the partner topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics + /// + /// + /// Operation Id + /// PartnerTopics_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPartnerTopics(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerTopicRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerTopicResource(Client, PartnerTopicData.DeserializePartnerTopicData(e)), PartnerTopicClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetPartnerTopics", "value", "nextLink", cancellationToken); + } + + /// + /// List all the system topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics + /// + /// + /// Operation Id + /// SystemTopics_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSystemTopicsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SystemTopicRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SystemTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SystemTopicResource(Client, SystemTopicData.DeserializeSystemTopicData(e)), SystemTopicClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetSystemTopics", "value", "nextLink", cancellationToken); + } + + /// + /// List all the system topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics + /// + /// + /// Operation Id + /// SystemTopics_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSystemTopics(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SystemTopicRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SystemTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SystemTopicResource(Client, SystemTopicData.DeserializeSystemTopicData(e)), SystemTopicClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetSystemTopics", "value", "nextLink", cancellationToken); + } + + /// + /// List all the topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// + /// + /// Operation Id + /// Topics_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEventGridTopicsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridTopicTopicsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventGridTopicResource(Client, EventGridTopicData.DeserializeEventGridTopicData(e)), EventGridTopicTopicsClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetEventGridTopics", "value", "nextLink", cancellationToken); + } + + /// + /// List all the topics under an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics + /// + /// + /// Operation Id + /// Topics_ListBySubscription + /// + /// + /// + /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. + /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEventGridTopics(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridTopicTopicsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventGridTopicResource(Client, EventGridTopicData.DeserializeEventGridTopicData(e)), EventGridTopicTopicsClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetEventGridTopics", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridTenantResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridTenantResource.cs new file mode 100644 index 0000000000000..412e236e9dfb8 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridTenantResource.cs @@ -0,0 +1,145 @@ +// 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.EventGrid; + +namespace Azure.ResourceManager.EventGrid.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableEventGridTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableEventGridTenantResource() + { + } + + /// 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 MockableEventGridTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of TopicTypeResources in the TenantResource. + /// An object representing collection of TopicTypeResources and their operations over a TopicTypeResource. + public virtual TopicTypeCollection GetTopicTypes() + { + return GetCachedClient(client => new TopicTypeCollection(client, Id)); + } + + /// + /// Get information about a topic type. + /// + /// + /// Request Path + /// /providers/Microsoft.EventGrid/topicTypes/{topicTypeName} + /// + /// + /// Operation Id + /// TopicTypes_Get + /// + /// + /// + /// Name of the topic type. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTopicTypeAsync(string topicTypeName, CancellationToken cancellationToken = default) + { + return await GetTopicTypes().GetAsync(topicTypeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a topic type. + /// + /// + /// Request Path + /// /providers/Microsoft.EventGrid/topicTypes/{topicTypeName} + /// + /// + /// Operation Id + /// TopicTypes_Get + /// + /// + /// + /// Name of the topic type. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTopicType(string topicTypeName, CancellationToken cancellationToken = default) + { + return GetTopicTypes().Get(topicTypeName, cancellationToken); + } + + /// Gets a collection of VerifiedPartnerResources in the TenantResource. + /// An object representing collection of VerifiedPartnerResources and their operations over a VerifiedPartnerResource. + public virtual VerifiedPartnerCollection GetVerifiedPartners() + { + return GetCachedClient(client => new VerifiedPartnerCollection(client, Id)); + } + + /// + /// Get properties of a verified partner. + /// + /// + /// Request Path + /// /providers/Microsoft.EventGrid/verifiedPartners/{verifiedPartnerName} + /// + /// + /// Operation Id + /// VerifiedPartners_Get + /// + /// + /// + /// Name of the verified partner. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVerifiedPartnerAsync(string verifiedPartnerName, CancellationToken cancellationToken = default) + { + return await GetVerifiedPartners().GetAsync(verifiedPartnerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of a verified partner. + /// + /// + /// Request Path + /// /providers/Microsoft.EventGrid/verifiedPartners/{verifiedPartnerName} + /// + /// + /// Operation Id + /// VerifiedPartners_Get + /// + /// + /// + /// Name of the verified partner. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVerifiedPartner(string verifiedPartnerName, CancellationToken cancellationToken = default) + { + return GetVerifiedPartners().Get(verifiedPartnerName, cancellationToken); + } + } +} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 6fd2b6076b4fe..0000000000000 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.EventGrid.Models; - -namespace Azure.ResourceManager.EventGrid -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _eventSubscriptionClientDiagnostics; - private EventSubscriptionsRestOperations _eventSubscriptionRestClient; - private ClientDiagnostics _eventGridTopicTopicsClientDiagnostics; - private TopicsRestOperations _eventGridTopicTopicsRestClient; - - /// 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 ClientDiagnostics EventSubscriptionClientDiagnostics => _eventSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventSubscriptionResource.ResourceType.Namespace, Diagnostics); - private EventSubscriptionsRestOperations EventSubscriptionRestClient => _eventSubscriptionRestClient ??= new EventSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventSubscriptionResource.ResourceType)); - private ClientDiagnostics EventGridTopicTopicsClientDiagnostics => _eventGridTopicTopicsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridTopicResource.ResourceType.Namespace, Diagnostics); - private TopicsRestOperations EventGridTopicTopicsRestClient => _eventGridTopicTopicsRestClient ??= new TopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridTopicResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of EventGridDomainResources in the ResourceGroupResource. - /// An object representing collection of EventGridDomainResources and their operations over a EventGridDomainResource. - public virtual EventGridDomainCollection GetEventGridDomains() - { - return GetCachedClient(Client => new EventGridDomainCollection(Client, Id)); - } - - /// Gets a collection of EventGridNamespaceResources in the ResourceGroupResource. - /// An object representing collection of EventGridNamespaceResources and their operations over a EventGridNamespaceResource. - public virtual EventGridNamespaceCollection GetEventGridNamespaces() - { - return GetCachedClient(Client => new EventGridNamespaceCollection(Client, Id)); - } - - /// Gets an object representing a PartnerConfigurationResource along with the instance operations that can be performed on it in the ResourceGroupResource. - /// Returns a object. - public virtual PartnerConfigurationResource GetPartnerConfiguration() - { - return new PartnerConfigurationResource(Client, Id.AppendProviderResource("Microsoft.EventGrid", "partnerConfigurations", "default")); - } - - /// Gets a collection of PartnerDestinationResources in the ResourceGroupResource. - /// An object representing collection of PartnerDestinationResources and their operations over a PartnerDestinationResource. - public virtual PartnerDestinationCollection GetPartnerDestinations() - { - return GetCachedClient(Client => new PartnerDestinationCollection(Client, Id)); - } - - /// Gets a collection of PartnerNamespaceResources in the ResourceGroupResource. - /// An object representing collection of PartnerNamespaceResources and their operations over a PartnerNamespaceResource. - public virtual PartnerNamespaceCollection GetPartnerNamespaces() - { - return GetCachedClient(Client => new PartnerNamespaceCollection(Client, Id)); - } - - /// Gets a collection of PartnerRegistrationResources in the ResourceGroupResource. - /// An object representing collection of PartnerRegistrationResources and their operations over a PartnerRegistrationResource. - public virtual PartnerRegistrationCollection GetPartnerRegistrations() - { - return GetCachedClient(Client => new PartnerRegistrationCollection(Client, Id)); - } - - /// Gets a collection of PartnerTopicResources in the ResourceGroupResource. - /// An object representing collection of PartnerTopicResources and their operations over a PartnerTopicResource. - public virtual PartnerTopicCollection GetPartnerTopics() - { - return GetCachedClient(Client => new PartnerTopicCollection(Client, Id)); - } - - /// Gets a collection of SystemTopicResources in the ResourceGroupResource. - /// An object representing collection of SystemTopicResources and their operations over a SystemTopicResource. - public virtual SystemTopicCollection GetSystemTopics() - { - return GetCachedClient(Client => new SystemTopicCollection(Client, Id)); - } - - /// Gets a collection of EventGridTopicResources in the ResourceGroupResource. - /// An object representing collection of EventGridTopicResources and their operations over a EventGridTopicResource. - public virtual EventGridTopicCollection GetEventGridTopics() - { - return GetCachedClient(Client => new EventGridTopicCollection(Client, Id)); - } - - /// - /// List event types for a topic. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes - /// - /// - /// Operation Id - /// Topics_ListEventTypes - /// - /// - /// - /// Namespace of the provider of the topic. - /// Name of the topic type. - /// Name of the topic. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEventTypesAsync(string providerNamespace, string resourceTypeName, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListEventTypesRequest(Id.SubscriptionId, Id.ResourceGroupName, providerNamespace, resourceTypeName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, EventTypeUnderTopic.DeserializeEventTypeUnderTopic, EventGridTopicTopicsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetEventTypes", "value", null, cancellationToken); - } - - /// - /// List event types for a topic. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes - /// - /// - /// Operation Id - /// Topics_ListEventTypes - /// - /// - /// - /// Namespace of the provider of the topic. - /// Name of the topic type. - /// Name of the topic. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEventTypes(string providerNamespace, string resourceTypeName, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListEventTypesRequest(Id.SubscriptionId, Id.ResourceGroupName, providerNamespace, resourceTypeName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, EventTypeUnderTopic.DeserializeEventTypeUnderTopic, EventGridTopicTopicsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetEventTypes", "value", null, cancellationToken); - } - } -} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 34a12c90d428b..0000000000000 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,512 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.EventGrid -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _eventGridDomainDomainsClientDiagnostics; - private DomainsRestOperations _eventGridDomainDomainsRestClient; - private ClientDiagnostics _eventSubscriptionClientDiagnostics; - private EventSubscriptionsRestOperations _eventSubscriptionRestClient; - private ClientDiagnostics _eventGridNamespaceNamespacesClientDiagnostics; - private NamespacesRestOperations _eventGridNamespaceNamespacesRestClient; - private ClientDiagnostics _partnerConfigurationClientDiagnostics; - private PartnerConfigurationsRestOperations _partnerConfigurationRestClient; - private ClientDiagnostics _partnerDestinationClientDiagnostics; - private PartnerDestinationsRestOperations _partnerDestinationRestClient; - private ClientDiagnostics _partnerNamespaceClientDiagnostics; - private PartnerNamespacesRestOperations _partnerNamespaceRestClient; - private ClientDiagnostics _partnerRegistrationClientDiagnostics; - private PartnerRegistrationsRestOperations _partnerRegistrationRestClient; - private ClientDiagnostics _partnerTopicClientDiagnostics; - private PartnerTopicsRestOperations _partnerTopicRestClient; - private ClientDiagnostics _systemTopicClientDiagnostics; - private SystemTopicsRestOperations _systemTopicRestClient; - private ClientDiagnostics _eventGridTopicTopicsClientDiagnostics; - private TopicsRestOperations _eventGridTopicTopicsRestClient; - - /// 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 EventGridDomainDomainsClientDiagnostics => _eventGridDomainDomainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridDomainResource.ResourceType.Namespace, Diagnostics); - private DomainsRestOperations EventGridDomainDomainsRestClient => _eventGridDomainDomainsRestClient ??= new DomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridDomainResource.ResourceType)); - private ClientDiagnostics EventSubscriptionClientDiagnostics => _eventSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventSubscriptionResource.ResourceType.Namespace, Diagnostics); - private EventSubscriptionsRestOperations EventSubscriptionRestClient => _eventSubscriptionRestClient ??= new EventSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventSubscriptionResource.ResourceType)); - private ClientDiagnostics EventGridNamespaceNamespacesClientDiagnostics => _eventGridNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridNamespaceResource.ResourceType.Namespace, Diagnostics); - private NamespacesRestOperations EventGridNamespaceNamespacesRestClient => _eventGridNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridNamespaceResource.ResourceType)); - private ClientDiagnostics PartnerConfigurationClientDiagnostics => _partnerConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerConfigurationResource.ResourceType.Namespace, Diagnostics); - private PartnerConfigurationsRestOperations PartnerConfigurationRestClient => _partnerConfigurationRestClient ??= new PartnerConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerConfigurationResource.ResourceType)); - private ClientDiagnostics PartnerDestinationClientDiagnostics => _partnerDestinationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerDestinationResource.ResourceType.Namespace, Diagnostics); - private PartnerDestinationsRestOperations PartnerDestinationRestClient => _partnerDestinationRestClient ??= new PartnerDestinationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerDestinationResource.ResourceType)); - private ClientDiagnostics PartnerNamespaceClientDiagnostics => _partnerNamespaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerNamespaceResource.ResourceType.Namespace, Diagnostics); - private PartnerNamespacesRestOperations PartnerNamespaceRestClient => _partnerNamespaceRestClient ??= new PartnerNamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerNamespaceResource.ResourceType)); - private ClientDiagnostics PartnerRegistrationClientDiagnostics => _partnerRegistrationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerRegistrationResource.ResourceType.Namespace, Diagnostics); - private PartnerRegistrationsRestOperations PartnerRegistrationRestClient => _partnerRegistrationRestClient ??= new PartnerRegistrationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerRegistrationResource.ResourceType)); - private ClientDiagnostics PartnerTopicClientDiagnostics => _partnerTopicClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", PartnerTopicResource.ResourceType.Namespace, Diagnostics); - private PartnerTopicsRestOperations PartnerTopicRestClient => _partnerTopicRestClient ??= new PartnerTopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PartnerTopicResource.ResourceType)); - private ClientDiagnostics SystemTopicClientDiagnostics => _systemTopicClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", SystemTopicResource.ResourceType.Namespace, Diagnostics); - private SystemTopicsRestOperations SystemTopicRestClient => _systemTopicRestClient ??= new SystemTopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SystemTopicResource.ResourceType)); - private ClientDiagnostics EventGridTopicTopicsClientDiagnostics => _eventGridTopicTopicsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventGrid", EventGridTopicResource.ResourceType.Namespace, Diagnostics); - private TopicsRestOperations EventGridTopicTopicsRestClient => _eventGridTopicTopicsRestClient ??= new TopicsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventGridTopicResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the domains under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains - /// - /// - /// Operation Id - /// Domains_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEventGridDomainsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridDomainDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridDomainDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventGridDomainResource(Client, EventGridDomainData.DeserializeEventGridDomainData(e)), EventGridDomainDomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridDomains", "value", "nextLink", cancellationToken); - } - - /// - /// List all the domains under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains - /// - /// - /// Operation Id - /// Domains_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEventGridDomains(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridDomainDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridDomainDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventGridDomainResource(Client, EventGridDomainData.DeserializeEventGridDomainData(e)), EventGridDomainDomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridDomains", "value", "nextLink", cancellationToken); - } - - /// - /// List all the namespaces under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces - /// - /// - /// Operation Id - /// Namespaces_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEventGridNamespacesAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridNamespaceNamespacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridNamespaceNamespacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventGridNamespaceResource(Client, EventGridNamespaceData.DeserializeEventGridNamespaceData(e)), EventGridNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// List all the namespaces under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/namespaces - /// - /// - /// Operation Id - /// Namespaces_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEventGridNamespaces(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridNamespaceNamespacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridNamespaceNamespacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventGridNamespaceResource(Client, EventGridNamespaceData.DeserializeEventGridNamespaceData(e)), EventGridNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner configurations under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerConfigurations - /// - /// - /// Operation Id - /// PartnerConfigurations_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPartnerConfigurationsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerConfigurationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerConfigurationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerConfigurationResource(Client, PartnerConfigurationData.DeserializePartnerConfigurationData(e)), PartnerConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner configurations under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerConfigurations - /// - /// - /// Operation Id - /// PartnerConfigurations_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPartnerConfigurations(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerConfigurationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerConfigurationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerConfigurationResource(Client, PartnerConfigurationData.DeserializePartnerConfigurationData(e)), PartnerConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner destinations under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations - /// - /// - /// Operation Id - /// PartnerDestinations_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPartnerDestinationsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerDestinationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerDestinationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerDestinationResource(Client, PartnerDestinationData.DeserializePartnerDestinationData(e)), PartnerDestinationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerDestinations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner destinations under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerDestinations - /// - /// - /// Operation Id - /// PartnerDestinations_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPartnerDestinations(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerDestinationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerDestinationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerDestinationResource(Client, PartnerDestinationData.DeserializePartnerDestinationData(e)), PartnerDestinationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerDestinations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner namespaces under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces - /// - /// - /// Operation Id - /// PartnerNamespaces_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPartnerNamespacesAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerNamespaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerNamespaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerNamespaceResource(Client, PartnerNamespaceData.DeserializePartnerNamespaceData(e)), PartnerNamespaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner namespaces under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces - /// - /// - /// Operation Id - /// PartnerNamespaces_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPartnerNamespaces(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerNamespaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerNamespaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerNamespaceResource(Client, PartnerNamespaceData.DeserializePartnerNamespaceData(e)), PartnerNamespaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner registrations under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations - /// - /// - /// Operation Id - /// PartnerRegistrations_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPartnerRegistrationsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerRegistrationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerRegistrationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerRegistrationResource(Client, PartnerRegistrationData.DeserializePartnerRegistrationData(e)), PartnerRegistrationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerRegistrations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner registrations under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations - /// - /// - /// Operation Id - /// PartnerRegistrations_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPartnerRegistrations(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerRegistrationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerRegistrationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerRegistrationResource(Client, PartnerRegistrationData.DeserializePartnerRegistrationData(e)), PartnerRegistrationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerRegistrations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner topics under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics - /// - /// - /// Operation Id - /// PartnerTopics_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPartnerTopicsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerTopicRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PartnerTopicResource(Client, PartnerTopicData.DeserializePartnerTopicData(e)), PartnerTopicClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerTopics", "value", "nextLink", cancellationToken); - } - - /// - /// List all the partner topics under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics - /// - /// - /// Operation Id - /// PartnerTopics_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPartnerTopics(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PartnerTopicRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PartnerTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PartnerTopicResource(Client, PartnerTopicData.DeserializePartnerTopicData(e)), PartnerTopicClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPartnerTopics", "value", "nextLink", cancellationToken); - } - - /// - /// List all the system topics under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics - /// - /// - /// Operation Id - /// SystemTopics_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSystemTopicsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SystemTopicRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SystemTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SystemTopicResource(Client, SystemTopicData.DeserializeSystemTopicData(e)), SystemTopicClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSystemTopics", "value", "nextLink", cancellationToken); - } - - /// - /// List all the system topics under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics - /// - /// - /// Operation Id - /// SystemTopics_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSystemTopics(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SystemTopicRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SystemTopicRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SystemTopicResource(Client, SystemTopicData.DeserializeSystemTopicData(e)), SystemTopicClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSystemTopics", "value", "nextLink", cancellationToken); - } - - /// - /// List all the topics under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics - /// - /// - /// Operation Id - /// Topics_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEventGridTopicsAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridTopicTopicsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventGridTopicResource(Client, EventGridTopicData.DeserializeEventGridTopicData(e)), EventGridTopicTopicsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridTopics", "value", "nextLink", cancellationToken); - } - - /// - /// List all the topics under an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics - /// - /// - /// Operation Id - /// Topics_ListBySubscription - /// - /// - /// - /// The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'. - /// The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEventGridTopics(string filter = null, int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventGridTopicTopicsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventGridTopicResource(Client, EventGridTopicData.DeserializeEventGridTopicData(e)), EventGridTopicTopicsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventGridTopics", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 0b72cd7670e0f..0000000000000 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.EventGrid -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of TopicTypeResources in the TenantResource. - /// An object representing collection of TopicTypeResources and their operations over a TopicTypeResource. - public virtual TopicTypeCollection GetTopicTypes() - { - return GetCachedClient(Client => new TopicTypeCollection(Client, Id)); - } - - /// Gets a collection of VerifiedPartnerResources in the TenantResource. - /// An object representing collection of VerifiedPartnerResources and their operations over a VerifiedPartnerResource. - public virtual VerifiedPartnerCollection GetVerifiedPartners() - { - return GetCachedClient(Client => new VerifiedPartnerCollection(Client, Id)); - } - } -} diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicEventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicEventSubscriptionResource.cs index fc6321aa3037a..79039e5ac7360 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicEventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicEventSubscriptionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.EventGrid public partial class NamespaceTopicEventSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The topicName. + /// The eventSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string eventSubscriptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs index 62016a7957815..10162ab685d7a 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventGrid public partial class NamespaceTopicResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The topicName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NamespaceTopicEventSubscriptionResources and their operations over a NamespaceTopicEventSubscriptionResource. public virtual NamespaceTopicEventSubscriptionCollection GetNamespaceTopicEventSubscriptions() { - return GetCachedClient(Client => new NamespaceTopicEventSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new NamespaceTopicEventSubscriptionCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual NamespaceTopicEventSubscriptionCollection GetNamespaceTopicEventS /// /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNamespaceTopicEventSubscriptionAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> Get /// /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNamespaceTopicEventSubscription(string eventSubscriptionName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerConfigurationResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerConfigurationResource.cs index 5a8ddd73ce0db..bd82975ddac7c 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerConfigurationResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerConfigurationResource.cs @@ -28,6 +28,8 @@ namespace Azure.ResourceManager.EventGrid public partial class PartnerConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerConfigurations/default"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationResource.cs index 7c1c4c5cb9941..8c14d6f0326b7 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerDestinationResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EventGrid public partial class PartnerDestinationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The partnerDestinationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string partnerDestinationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerDestinations/{partnerDestinationName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelResource.cs index 811bdecd03598..c21389adc9eeb 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceChannelResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventGrid public partial class PartnerNamespaceChannelResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The partnerNamespaceName. + /// The channelName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string partnerNamespaceName, string channelName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/channels/{channelName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResource.cs index db5d55da9ba41..67f6e114049ae 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespacePrivateLinkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventGrid public partial class PartnerNamespacePrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The parentName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string parentName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{parentName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs index eca2ad2a02e8f..ed1128768f452 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EventGrid public partial class PartnerNamespaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The partnerNamespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string partnerNamespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PartnerNamespaceChannelResources and their operations over a PartnerNamespaceChannelResource. public virtual PartnerNamespaceChannelCollection GetPartnerNamespaceChannels() { - return GetCachedClient(Client => new PartnerNamespaceChannelCollection(Client, Id)); + return GetCachedClient(client => new PartnerNamespaceChannelCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual PartnerNamespaceChannelCollection GetPartnerNamespaceChannels() /// /// Name of the channel. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPartnerNamespaceChannelAsync(string channelName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetPartnerN /// /// Name of the channel. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPartnerNamespaceChannel(string channelName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetPartnerNamespaceChan /// An object representing collection of EventGridPartnerNamespacePrivateEndpointConnectionResources and their operations over a EventGridPartnerNamespacePrivateEndpointConnectionResource. public virtual EventGridPartnerNamespacePrivateEndpointConnectionCollection GetEventGridPartnerNamespacePrivateEndpointConnections() { - return GetCachedClient(Client => new EventGridPartnerNamespacePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new EventGridPartnerNamespacePrivateEndpointConnectionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual EventGridPartnerNamespacePrivateEndpointConnectionCollection GetE /// /// The name of the private endpoint connection connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventGridPartnerNamespacePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task /// The name of the private endpoint connection connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventGridPartnerNamespacePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response An object representing collection of PartnerNamespacePrivateLinkResources and their operations over a PartnerNamespacePrivateLinkResource. public virtual PartnerNamespacePrivateLinkResourceCollection GetPartnerNamespacePrivateLinkResources() { - return GetCachedClient(Client => new PartnerNamespacePrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new PartnerNamespacePrivateLinkResourceCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual PartnerNamespacePrivateLinkResourceCollection GetPartnerNamespace /// /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPartnerNamespacePrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetPart /// /// The name of private link resource will be either topic, domain, partnerNamespace or namespace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPartnerNamespacePrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerRegistrationResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerRegistrationResource.cs index b2e71d6dbc80b..895abb81e13d1 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerRegistrationResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerRegistrationResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EventGrid public partial class PartnerRegistrationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The partnerRegistrationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string partnerRegistrationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicEventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicEventSubscriptionResource.cs index 6532457a0da83..d6edda23c0d4e 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicEventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicEventSubscriptionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.EventGrid public partial class PartnerTopicEventSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The partnerTopicName. + /// The eventSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string partnerTopicName, string eventSubscriptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicResource.cs index f3661bd96e896..4ce4fdbc98fd5 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EventGrid public partial class PartnerTopicResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The partnerTopicName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string partnerTopicName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PartnerTopicEventSubscriptionResources and their operations over a PartnerTopicEventSubscriptionResource. public virtual PartnerTopicEventSubscriptionCollection GetPartnerTopicEventSubscriptions() { - return GetCachedClient(Client => new PartnerTopicEventSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new PartnerTopicEventSubscriptionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual PartnerTopicEventSubscriptionCollection GetPartnerTopicEventSubsc /// /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPartnerTopicEventSubscriptionAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetPa /// /// Name of the event subscription to be found. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPartnerTopicEventSubscription(string eventSubscriptionName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionResource.cs index e7ec744464e12..83ffbfa086c93 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicEventSubscriptionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.EventGrid public partial class SystemTopicEventSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The systemTopicName. + /// The eventSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string systemTopicName, string eventSubscriptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicResource.cs index ec0771afe07b3..8ed272a9603a8 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EventGrid public partial class SystemTopicResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The systemTopicName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string systemTopicName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SystemTopicEventSubscriptionResources and their operations over a SystemTopicEventSubscriptionResource. public virtual SystemTopicEventSubscriptionCollection GetSystemTopicEventSubscriptions() { - return GetCachedClient(Client => new SystemTopicEventSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new SystemTopicEventSubscriptionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual SystemTopicEventSubscriptionCollection GetSystemTopicEventSubscri /// /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSystemTopicEventSubscriptionAsync(string eventSubscriptionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetSys /// /// Name of the event subscription to be created. Event subscription names must be between 3 and 100 characters in length and use alphanumeric letters only. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSystemTopicEventSubscription(string eventSubscriptionName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicEventSubscriptionResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicEventSubscriptionResource.cs index 7f22b4c119433..e6d25b5b8559e 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicEventSubscriptionResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicEventSubscriptionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.EventGrid public partial class TopicEventSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The topicName. + /// The eventSubscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string topicName, string eventSubscriptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceResource.cs index 6c044e34d8274..28c9124f1bcb0 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicSpaceResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventGrid public partial class TopicSpaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The topicSpaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicSpaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topicSpaces/{topicSpaceName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeResource.cs index c5a327ba4ecad..d97107156e801 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/TopicTypeResource.cs @@ -28,6 +28,7 @@ namespace Azure.ResourceManager.EventGrid public partial class TopicTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The topicTypeName. public static ResourceIdentifier CreateResourceIdentifier(string topicTypeName) { var resourceId = $"/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}"; diff --git a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerResource.cs index 35e776de54ea6..fd9adb84d065f 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/VerifiedPartnerResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.EventGrid public partial class VerifiedPartnerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The verifiedPartnerName. public static ResourceIdentifier CreateResourceIdentifier(string verifiedPartnerName) { var resourceId = $"/providers/Microsoft.EventGrid/verifiedPartners/{verifiedPartnerName}"; diff --git a/sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md b/sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md index 2e2506756e251..5aa69694ef1ad 100755 --- a/sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md +++ b/sdk/eventhub/Azure.Messaging.EventHubs.Processor/CHANGELOG.md @@ -8,8 +8,12 @@ ### Bugs Fixed +- Fixed a parameter type mismatch in ETW #7 (ReceiveComplete) which caused the duration argument of the operation to be interpreted as a Unicode string and fail to render properly in the formatted message. + ### Other Changes +- When an Event Hub is disabled, it will now be detected and result in a terminal `EventHubsException` with its reason set to `FailureReason.ResourceNotFound`. + ## 5.9.3 (2023-09-12) ### Other Changes diff --git a/sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/EventProcessorClient.cs b/sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/EventProcessorClient.cs index 384f09812294e..f9b04064f951f 100644 --- a/sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/EventProcessorClient.cs +++ b/sdk/eventhub/Azure.Messaging.EventHubs.Processor/src/EventProcessorClient.cs @@ -92,6 +92,8 @@ public class EventProcessorClient : EventProcessor /// implementations to avoid long-running operations, as they will delay processing for the associated partition. /// /// + /// + /// /// If an attempt is made to remove a handler that doesn't match the current handler registered. /// If an attempt is made to add or remove a handler while the processor is running. /// If an attempt is made to add a handler when one is currently registered. @@ -138,6 +140,8 @@ public event Func PartitionInitializingAsy /// and offers no guarantee that execution will complete before processing for the partition is restarted or migrates to a new host. /// /// + /// + /// /// If an attempt is made to remove a handler that doesn't match the current handler registered. /// If an attempt is made to add or remove a handler while the processor is running. /// If an attempt is made to add a handler when one is currently registered. @@ -171,7 +175,7 @@ public event Func PartitionClosingAsync } /// - /// Performs the tasks needed to process a batch of events for a given partition as they are read from the Event Hubs service. Implementation is mandatory. + /// Performs the tasks needed to process a batch of events for a given partition as they are read from the Event Hubs service. Implementation is mandatory. /// /// Should an exception occur within the code for this method, the event processor will allow it to propagate up the stack without attempting to handle it in any way. /// On most hosts, this will fault the task responsible for partition processing, causing it to be restarted from the last checkpoint. On some hosts, it may crash the process. @@ -189,6 +193,8 @@ public event Func PartitionClosingAsync /// event for the associated partition. It is safe for implementations to perform long-running operations, retries, delays, and dead-lettering activities. /// /// + /// + /// /// If an attempt is made to remove a handler that doesn't match the current handler registered. /// If an attempt is made to add or remove a handler while the processor is running. /// If an attempt is made to add a handler when one is currently registered. @@ -250,6 +256,7 @@ public event Func ProcessEventAsync /// If an attempt is made to add or remove a handler while the processor is running. /// If an attempt is made to add a handler when one is currently registered. /// + /// /// Troubleshoot Event Hubs issues /// [SuppressMessage("Usage", "AZC0003:DO make service methods virtual.", Justification = "This member follows the standard .NET event pattern; override via the associated On<> method.")] @@ -987,26 +994,30 @@ protected override Task> ClaimOwne /// /// The batch of events to be processed. /// The context of the partition from which the events were read. - /// A instance to signal the request to cancel the processing. This is most likely to occur when the processor is shutting down. + /// A instance to signal the request to cancel the processing. This is most likely to occur when the processor is shutting down. /// /// - /// The number of events in the batch may vary. The batch will contain a number of events between zero and batch size that was - /// requested when the processor was created, depending on the availability of events in the partition within the requested - /// interval. + /// The number of events in the batch may vary, with the batch containing between zero and maximum batch size that was specified when the processor was created. + /// The actual number of events in a batch depends on the number events available in the processor's prefetch queue at the time when a read takes place. /// - /// If there are enough events available in the Event Hub partition to fill a batch of the requested size, the processor will populate the batch and dispatch it to this method - /// immediately. If there were not a sufficient number of events available in the partition to populate a full batch, the event processor will continue reading from the partition - /// to reach the requested batch size until the has elapsed, at which point it will return a batch containing whatever events were - /// available by the end of that period. + /// When at least one event is available in the prefetch queue, they will be used to form the batch as close to the requested maximum batch size as possible without waiting for additional + /// events from the Event Hub partition to be read. When no events are available in prefetch the processor will wait until at least one event is available or the requested + /// has elapsed, after which the batch will be dispatched for processing. /// - /// If a was not requested, indicated by setting the option to null, the event processor will continue reading from the Event Hub - /// partition until a full batch of the requested size could be populated and will not dispatch any partial batches to this method. + /// If is null, the processor will continue trying to read from the Event Hub partition until a batch with at least one event could + /// be formed and will not dispatch any empty batches to this method. /// - /// Should an exception occur within the code for this method, the event processor will allow it to bubble and will not surface to the error handler or attempt to handle - /// it in any way. Developers are strongly encouraged to take exception scenarios into account and guard against them using try/catch blocks and other means as appropriate. + /// This method will be invoked concurrently, limited to one call per partition. The processor will await each invocation to ensure + /// that the events from the same partition are processed in the order that they were read from the partition. No time limit is + /// imposed on an invocation of this handler; the processor will wait indefinitely for execution to complete before dispatching another + /// event for the associated partition. It is safe for implementations to perform long-running operations, retries, delays, and dead-lettering activities. /// - /// It is not recommended that the state of the processor be managed directly from within this method; requesting to start or stop the processor may result in - /// a deadlock scenario, especially if using the synchronous form of the call. + /// Should an exception occur within the code for this method, the event processor will allow it to propagate up the stack without attempting to handle it in any way. + /// On most hosts, this will fault the task responsible for partition processing, causing it to be restarted from the last checkpoint. On some hosts, it may crash the process. + /// Developers are strongly encouraged to take all exception scenarios into account and guard against them using try/catch blocks and other means as appropriate. + /// + /// It is not recommended that the state of the processor be managed directly from within this method; requesting to start or stop the processor may result in + /// a deadlock scenario, especially if using the synchronous form of the call. /// /// protected override async Task OnProcessingEventBatchAsync(IEnumerable events, diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md b/sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md index dc0aab0396051..bed21a4e6000d 100755 --- a/sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md +++ b/sdk/eventhub/Azure.Messaging.EventHubs/CHANGELOG.md @@ -8,8 +8,12 @@ ### Bugs Fixed +- Fixed a parameter type mismatch in ETW #7 (ReceiveComplete) which caused the duration argument of the operation to be interpreted as a Unicode string and fail to render properly in the formatted message. + ### Other Changes +- When an Event Hub is disabled, it will now be detected and result in a terminal `EventHubsException` with its reason set to `FailureReason.ResourceNotFound`. + ## 5.9.3 (2023-09-12) ### Bugs Fixed diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/TROUBLESHOOTING.md b/sdk/eventhub/Azure.Messaging.EventHubs/TROUBLESHOOTING.md index 76e94f0f7016f..4f73cfa15eb4c 100644 --- a/sdk/eventhub/Azure.Messaging.EventHubs/TROUBLESHOOTING.md +++ b/sdk/eventhub/Azure.Messaging.EventHubs/TROUBLESHOOTING.md @@ -71,7 +71,7 @@ The exception includes some contextual information to assist in understanding th - **Consumer Disconnected** : A consumer client was disconnected by the Event Hub service from the Event Hub instance. This typically occurs when a consumer with a higher owner level asserts ownership over a partition and consumer group pairing. - - **Resource Not Found**: An Event Hubs resource, such as an Event Hub, consumer group, or partition, could not be found by the Event Hubs service. This may indicate that it has been deleted from the service or that there is an issue with the Event Hubs service itself. + - **Resource Not Found**: An Event Hubs resource, such as an Event Hub, consumer group, or partition, could not be found by the Event Hubs service. This may indicate that it has been disabled, is still in the process of being created, was deleted from the service, or that there is an issue with the Event Hubs service itself. Reacting to a specific failure reason for the [EventHubsException][EventHubsException] can be accomplished in several ways, the most common of which is by applying an exception filter clause as part of the `catch` block: diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpConsumer.cs b/sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpConsumer.cs index fbb851529f272..8a15704499795 100644 --- a/sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpConsumer.cs +++ b/sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpConsumer.cs @@ -396,9 +396,9 @@ public override async Task> ReceiveAsync(int maximumEve operationId, failedAttemptCount, receivedEventCount, + stopWatch.GetElapsedTime().TotalSeconds, firstReceivedEvent?.SequenceNumber.ToString(), - LastReceivedEvent?.SequenceNumber.ToString(), - stopWatch.GetElapsedTime().TotalSeconds); + LastReceivedEvent?.SequenceNumber.ToString()); } } diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpError.cs b/sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpError.cs index 3b686f4ad0b65..197ce100d923f 100644 --- a/sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpError.cs +++ b/sdk/eventhub/Azure.Messaging.EventHubs/src/Amqp/AmqpError.cs @@ -29,6 +29,12 @@ internal static class AmqpError /// public static AmqpSymbol TimeoutError { get; } = AmqpConstants.Vendor + ":timeout"; + /// + /// Indicates that an entity was disabled. + /// + /// + public static AmqpSymbol DisabledError { get; } = AmqpConstants.Vendor + ":entity-disabled"; + /// /// Indicates that the server was busy and could not allow the requested operation. /// @@ -171,6 +177,13 @@ private static Exception CreateException(string condition, return new EventHubsException(eventHubsResource, description, EventHubsException.FailureReason.ServiceTimeout, innerException); } + // The Event Hubs resource was disabled. + + if (string.Equals(condition, DisabledError.Value, StringComparison.InvariantCultureIgnoreCase)) + { + return new EventHubsException(eventHubsResource, description, EventHubsException.FailureReason.ResourceNotFound, innerException); + } + // The Event Hubs service was busy; this likely means that requests are being throttled. if (string.Equals(condition, ServerBusyError.Value, StringComparison.InvariantCultureIgnoreCase)) diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/src/Diagnostics/EventHubsEventSource.cs b/sdk/eventhub/Azure.Messaging.EventHubs/src/Diagnostics/EventHubsEventSource.cs index 7280cc2fa9296..b23be3fa1e938 100644 --- a/sdk/eventhub/Azure.Messaging.EventHubs/src/Diagnostics/EventHubsEventSource.cs +++ b/sdk/eventhub/Azure.Messaging.EventHubs/src/Diagnostics/EventHubsEventSource.cs @@ -106,7 +106,7 @@ public virtual void EventPublishStart(string eventHubName, /// The number of retries that were used for service communication. /// The total duration that the receive operation took to complete, in seconds. /// - [Event(4, Level = EventLevel.Informational, Message = "Completed publishing events for Event Hub: {0} (Partition Id/Key: '{1}'), Operation Id: '{2}'. Service Retry Count: {3}; Duration: '{4:0.00}' seconds")] + [Event(4, Level = EventLevel.Informational, Message = "Completed publishing events for Event Hub: {0} (Partition Id/Key: '{1}'), Operation Id: '{2}'. Service Retry Count: {3}; Duration: '{4:0.00}' seconds.")] public virtual void EventPublishComplete(string eventHubName, string partitionIdOrKey, string operationId, @@ -175,16 +175,16 @@ public virtual void EventReceiveStart(string eventHubName, /// The sequence number of the last event in the batch. /// The total duration that the receive operation took to complete, in seconds. /// - [Event(7, Level = EventLevel.Informational, Message = "Completed receiving events for Event Hub: {0} (Consumer Group: '{1}', Partition Id: '{2}'); Operation Id: '{3}'. Service Retry Count: {4}; Event Count: {5}; Starting sequence number: '{7}', Ending sequence number: '{8}'; Duration: '{6:0.00}' seconds")] + [Event(7, Level = EventLevel.Informational, Message = "Completed receiving events for Event Hub: {0} (Consumer Group: '{1}', Partition Id: '{2}'); Operation Id: '{3}'. Service Retry Count: {4}; Event Count: {5}; Duration: '{6:0.00}' seconds; Starting sequence number: '{7}', Ending sequence number: '{8}'.")] public virtual void EventReceiveComplete(string eventHubName, string consumerGroup, string partitionId, string operationId, int retryCount, int eventCount, + double durationSeconds, string startingSequenceNumber, - string endingSequenceNumber, - double durationSeconds) + string endingSequenceNumber) { if (IsEnabled()) { diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/src/Primitives/EventProcessor.cs b/sdk/eventhub/Azure.Messaging.EventHubs/src/Primitives/EventProcessor.cs index 5d0f40152aaf5..9ae23ad17224f 100644 --- a/sdk/eventhub/Azure.Messaging.EventHubs/src/Primitives/EventProcessor.cs +++ b/sdk/eventhub/Azure.Messaging.EventHubs/src/Primitives/EventProcessor.cs @@ -1112,16 +1112,15 @@ protected abstract Task> ClaimOwne /// A instance to signal the request to cancel the processing. This is most likely to occur when the processor is shutting down. /// /// - /// The number of events in the batch may vary. The batch will contain a number of events between zero and batch size that was - /// requested when the processor was created, depending on the availability of events in the partition within the requested - /// interval. + /// The number of events in the batch may vary, with the batch containing between zero and maximum batch size that was specified when the processor was created. + /// The actual number of events in a batch depends on the number events available in the processor's prefetch queue at the time when a read takes place. /// - /// When events are available in the prefetch queue, they will be used to form the batch as quickly as possible without waiting for additional events from the Event Hub partition - /// to be read. When no events are available in prefetch the processor will wait until at least one event is available or the requested - /// has elapsed. + /// When at least one event is available in the prefetch queue, they will be used to form the batch as close to the requested maximum batch size as possible without waiting for additional + /// events from the Event Hub partition to be read. When no events are available in prefetch the processor will wait until at least one event is available or the requested + /// has elapsed, after which the batch will be dispatched for processing. /// - /// If is null, the event processor will continue reading from the Event Hub - /// partition until a batch with at least one event could be formed and will not dispatch any empty batches to this method. + /// If is null, the processor will continue trying to read from the Event Hub partition until a batch with at least one event could + /// be formed and will not dispatch any empty batches to this method. /// /// This method will be invoked concurrently, limited to one call per partition. The processor will await each invocation to ensure /// that the events from the same partition are processed in the order that they were read from the partition. No time limit is diff --git a/sdk/eventhub/Azure.Messaging.EventHubs/tests/Amqp/AmqpErrorTests.cs b/sdk/eventhub/Azure.Messaging.EventHubs/tests/Amqp/AmqpErrorTests.cs index 8a3569f66bc7c..f87b02c24f3e4 100644 --- a/sdk/eventhub/Azure.Messaging.EventHubs/tests/Amqp/AmqpErrorTests.cs +++ b/sdk/eventhub/Azure.Messaging.EventHubs/tests/Amqp/AmqpErrorTests.cs @@ -30,6 +30,7 @@ public static IEnumerable SimpleConditionExceptionMatchTestCases() // Custom conditions. yield return new object[] { AmqpError.TimeoutError, typeof(EventHubsException), EventHubsException.FailureReason.ServiceTimeout }; + yield return new object[] { AmqpError.DisabledError, typeof(EventHubsException), EventHubsException.FailureReason.ResourceNotFound }; yield return new object[] { AmqpError.ServerBusyError, typeof(EventHubsException), EventHubsException.FailureReason.ServiceBusy }; yield return new object[] { AmqpError.ProducerStolenError, typeof(EventHubsException), EventHubsException.FailureReason.ProducerDisconnected }; yield return new object[] { AmqpError.SequenceOutOfOrderError, typeof(EventHubsException), EventHubsException.FailureReason.InvalidClientState }; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/api/Azure.ResourceManager.EventHubs.netstandard2.0.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/api/Azure.ResourceManager.EventHubs.netstandard2.0.cs index 6e3b86155f6d9..b8036227fbc8c 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/api/Azure.ResourceManager.EventHubs.netstandard2.0.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/api/Azure.ResourceManager.EventHubs.netstandard2.0.cs @@ -151,7 +151,7 @@ protected EventHubsClusterCollection() { } } public partial class EventHubsClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public EventHubsClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EventHubsClusterData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string MetricId { get { throw null; } } public Azure.ResourceManager.EventHubs.Models.EventHubsClusterSku Sku { get { throw null; } set { } } @@ -382,7 +382,7 @@ protected EventHubsNamespaceCollection() { } } public partial class EventHubsNamespaceData : Azure.ResourceManager.Models.TrackedResourceData { - public EventHubsNamespaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EventHubsNamespaceData(Azure.Core.AzureLocation location) { } public string AlternateName { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ClusterArmId { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } @@ -554,6 +554,47 @@ protected EventHubsSchemaGroupResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.EventHubs.EventHubsSchemaGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.EventHubs.Mocking +{ + public partial class MockableEventHubsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableEventHubsArmClient() { } + public virtual Azure.ResourceManager.EventHubs.EventHubAuthorizationRuleResource GetEventHubAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubResource GetEventHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsApplicationGroupResource GetEventHubsApplicationGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsClusterResource GetEventHubsClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsConsumerGroupResource GetEventHubsConsumerGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsDisasterRecoveryAuthorizationRuleResource GetEventHubsDisasterRecoveryAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsDisasterRecoveryResource GetEventHubsDisasterRecoveryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsNamespaceAuthorizationRuleResource GetEventHubsNamespaceAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsNamespaceResource GetEventHubsNamespaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsNetworkRuleSetResource GetEventHubsNetworkRuleSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsPrivateEndpointConnectionResource GetEventHubsPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsSchemaGroupResource GetEventHubsSchemaGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableEventHubsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableEventHubsResourceGroupResource() { } + public virtual Azure.Response GetEventHubsCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEventHubsClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsClusterCollection GetEventHubsClusters() { throw null; } + public virtual Azure.Response GetEventHubsNamespace(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEventHubsNamespaceAsync(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EventHubs.EventHubsNamespaceCollection GetEventHubsNamespaces() { throw null; } + } + public partial class MockableEventHubsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableEventHubsSubscriptionResource() { } + public virtual Azure.Response CheckEventHubsNamespaceNameAvailability(Azure.ResourceManager.EventHubs.Models.EventHubsNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckEventHubsNamespaceNameAvailabilityAsync(Azure.ResourceManager.EventHubs.Models.EventHubsNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableClusterRegionClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableClusterRegionClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEventHubsClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEventHubsClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEventHubsNamespaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEventHubsNamespacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.EventHubs.Models { public static partial class ArmEventHubsModelFactory @@ -864,7 +905,7 @@ internal EventHubsNetworkSecurityPerimeter() { } } public partial class EventHubsNetworkSecurityPerimeterConfiguration : Azure.ResourceManager.Models.TrackedResourceData { - public EventHubsNetworkSecurityPerimeterConfiguration(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EventHubsNetworkSecurityPerimeterConfiguration(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.EventHubs.Models.EventHubsNetworkSecurityPerimeter NetworkSecurityPerimeter { get { throw null; } } public Azure.ResourceManager.EventHubs.Models.EventHubsNetworkSecurityPerimeterConfigurationPropertiesProfile Profile { get { throw null; } } public System.Collections.Generic.IList ProvisioningIssues { get { throw null; } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubAuthorizationRuleResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubAuthorizationRuleResource.cs index bb2dce9c9e28f..a0e55bc91fe0d 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubAuthorizationRuleResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubAuthorizationRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The eventHubName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string eventHubName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubResource.cs index 752dc6729858c..e1a7f6208f616 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The eventHubName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string eventHubName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of EventHubAuthorizationRuleResources and their operations over a EventHubAuthorizationRuleResource. public virtual EventHubAuthorizationRuleCollection GetEventHubAuthorizationRules() { - return GetCachedClient(Client => new EventHubAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new EventHubAuthorizationRuleCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual EventHubAuthorizationRuleCollection GetEventHubAuthorizationRules /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetEventH /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -143,7 +147,7 @@ public virtual Response GetEventHubAuthorizat /// An object representing collection of EventHubsConsumerGroupResources and their operations over a EventHubsConsumerGroupResource. public virtual EventHubsConsumerGroupCollection GetEventHubsConsumerGroups() { - return GetCachedClient(Client => new EventHubsConsumerGroupCollection(Client, Id)); + return GetCachedClient(client => new EventHubsConsumerGroupCollection(client, Id)); } /// @@ -161,8 +165,8 @@ public virtual EventHubsConsumerGroupCollection GetEventHubsConsumerGroups() /// /// The consumer group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubsConsumerGroupAsync(string consumerGroupName, CancellationToken cancellationToken = default) { @@ -184,8 +188,8 @@ public virtual async Task> GetEventHubs /// /// The consumer group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubsConsumerGroup(string consumerGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsApplicationGroupResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsApplicationGroupResource.cs index c048929e48817..b9325ae7b7dee 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsApplicationGroupResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsApplicationGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsApplicationGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The applicationGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string applicationGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/applicationGroups/{applicationGroupName}"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsClusterResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsClusterResource.cs index 4aa4ac46770e8..11194dd6715e3 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsClusterResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsClusterResource.cs @@ -31,6 +31,9 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName}"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsConsumerGroupResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsConsumerGroupResource.cs index 2eb4253ed78b8..9b650ff626580 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsConsumerGroupResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsConsumerGroupResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsConsumerGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The eventHubName. + /// The consumerGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string eventHubName, string consumerGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}/consumergroups/{consumerGroupName}"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryAuthorizationRuleResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryAuthorizationRuleResource.cs index fcf2d1e8a5799..df076885adf03 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryAuthorizationRuleResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryAuthorizationRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsDisasterRecoveryAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The alias. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string @alias, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{@alias}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryResource.cs index 30b6f491b0d51..6e5031940ce40 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsDisasterRecoveryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The alias. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string @alias) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/disasterRecoveryConfigs/{@alias}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of EventHubsDisasterRecoveryAuthorizationRuleResources and their operations over a EventHubsDisasterRecoveryAuthorizationRuleResource. public virtual EventHubsDisasterRecoveryAuthorizationRuleCollection GetEventHubsDisasterRecoveryAuthorizationRules() { - return GetCachedClient(Client => new EventHubsDisasterRecoveryAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new EventHubsDisasterRecoveryAuthorizationRuleCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual EventHubsDisasterRecoveryAuthorizationRuleCollection GetEventHubs /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubsDisasterRecoveryAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubsDisasterRecoveryAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceAuthorizationRuleResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceAuthorizationRuleResource.cs index 90c1e4256493c..0c049fe53ae1b 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceAuthorizationRuleResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceAuthorizationRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsNamespaceAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceResource.cs index 6aa8088fb181c..53cca2f090b16 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsNamespaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}"; @@ -117,7 +120,7 @@ public virtual EventHubsNetworkRuleSetResource GetEventHubsNetworkRuleSet() /// An object representing collection of EventHubsNamespaceAuthorizationRuleResources and their operations over a EventHubsNamespaceAuthorizationRuleResource. public virtual EventHubsNamespaceAuthorizationRuleCollection GetEventHubsNamespaceAuthorizationRules() { - return GetCachedClient(Client => new EventHubsNamespaceAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new EventHubsNamespaceAuthorizationRuleCollection(client, Id)); } /// @@ -135,8 +138,8 @@ public virtual EventHubsNamespaceAuthorizationRuleCollection GetEventHubsNamespa /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubsNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -158,8 +161,8 @@ public virtual async Task> /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubsNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -170,7 +173,7 @@ public virtual Response GetEventHub /// An object representing collection of EventHubsPrivateEndpointConnectionResources and their operations over a EventHubsPrivateEndpointConnectionResource. public virtual EventHubsPrivateEndpointConnectionCollection GetEventHubsPrivateEndpointConnections() { - return GetCachedClient(Client => new EventHubsPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new EventHubsPrivateEndpointConnectionCollection(client, Id)); } /// @@ -188,8 +191,8 @@ public virtual EventHubsPrivateEndpointConnectionCollection GetEventHubsPrivateE /// /// The PrivateEndpointConnection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubsPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -211,8 +214,8 @@ public virtual async Task> /// /// The PrivateEndpointConnection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubsPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -223,7 +226,7 @@ public virtual Response GetEventHubs /// An object representing collection of EventHubsDisasterRecoveryResources and their operations over a EventHubsDisasterRecoveryResource. public virtual EventHubsDisasterRecoveryCollection GetEventHubsDisasterRecoveries() { - return GetCachedClient(Client => new EventHubsDisasterRecoveryCollection(Client, Id)); + return GetCachedClient(client => new EventHubsDisasterRecoveryCollection(client, Id)); } /// @@ -241,12 +244,12 @@ public virtual EventHubsDisasterRecoveryCollection GetEventHubsDisasterRecoverie /// /// The Disaster Recovery configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubsDisasterRecoveryAsync(string @alias, CancellationToken cancellationToken = default) { - return await GetEventHubsDisasterRecoveries().GetAsync(alias, cancellationToken).ConfigureAwait(false); + return await GetEventHubsDisasterRecoveries().GetAsync(@alias, cancellationToken).ConfigureAwait(false); } /// @@ -264,19 +267,19 @@ public virtual async Task> GetEventH /// /// The Disaster Recovery configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubsDisasterRecovery(string @alias, CancellationToken cancellationToken = default) { - return GetEventHubsDisasterRecoveries().Get(alias, cancellationToken); + return GetEventHubsDisasterRecoveries().Get(@alias, cancellationToken); } /// Gets a collection of EventHubResources in the EventHubsNamespace. /// An object representing collection of EventHubResources and their operations over a EventHubResource. public virtual EventHubCollection GetEventHubs() { - return GetCachedClient(Client => new EventHubCollection(Client, Id)); + return GetCachedClient(client => new EventHubCollection(client, Id)); } /// @@ -294,8 +297,8 @@ public virtual EventHubCollection GetEventHubs() /// /// The Event Hub name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubAsync(string eventHubName, CancellationToken cancellationToken = default) { @@ -317,8 +320,8 @@ public virtual async Task> GetEventHubAsync(string ev /// /// The Event Hub name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHub(string eventHubName, CancellationToken cancellationToken = default) { @@ -329,7 +332,7 @@ public virtual Response GetEventHub(string eventHubName, Cance /// An object representing collection of EventHubsSchemaGroupResources and their operations over a EventHubsSchemaGroupResource. public virtual EventHubsSchemaGroupCollection GetEventHubsSchemaGroups() { - return GetCachedClient(Client => new EventHubsSchemaGroupCollection(Client, Id)); + return GetCachedClient(client => new EventHubsSchemaGroupCollection(client, Id)); } /// @@ -346,8 +349,8 @@ public virtual EventHubsSchemaGroupCollection GetEventHubsSchemaGroups() /// /// The Schema Group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubsSchemaGroupAsync(string schemaGroupName, CancellationToken cancellationToken = default) { @@ -368,8 +371,8 @@ public virtual async Task> GetEventHubsSc /// /// The Schema Group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubsSchemaGroup(string schemaGroupName, CancellationToken cancellationToken = default) { @@ -380,7 +383,7 @@ public virtual Response GetEventHubsSchemaGroup(st /// An object representing collection of EventHubsApplicationGroupResources and their operations over a EventHubsApplicationGroupResource. public virtual EventHubsApplicationGroupCollection GetEventHubsApplicationGroups() { - return GetCachedClient(Client => new EventHubsApplicationGroupCollection(Client, Id)); + return GetCachedClient(client => new EventHubsApplicationGroupCollection(client, Id)); } /// @@ -398,8 +401,8 @@ public virtual EventHubsApplicationGroupCollection GetEventHubsApplicationGroups /// /// The Application Group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubsApplicationGroupAsync(string applicationGroupName, CancellationToken cancellationToken = default) { @@ -421,8 +424,8 @@ public virtual async Task> GetEventH /// /// The Application Group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubsApplicationGroup(string applicationGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNetworkRuleSetResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNetworkRuleSetResource.cs index 380bf0c2835be..2e2cb4327de22 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNetworkRuleSetResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNetworkRuleSetResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsNetworkRuleSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsPrivateEndpointConnectionResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsPrivateEndpointConnectionResource.cs index 301e5cd3c16e7..c58b588b0a11b 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsPrivateEndpointConnectionResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsSchemaGroupResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsSchemaGroupResource.cs index 88e1cdb401a05..28cc2618fe5a4 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsSchemaGroupResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsSchemaGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.EventHubs public partial class EventHubsSchemaGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The schemaGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string schemaGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}"; diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/EventHubsExtensions.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/EventHubsExtensions.cs index 66b92243844b9..31292edb00c51 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/EventHubsExtensions.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/EventHubsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.EventHubs.Mocking; using Azure.ResourceManager.EventHubs.Models; using Azure.ResourceManager.Resources; @@ -19,271 +20,225 @@ namespace Azure.ResourceManager.EventHubs /// A class to add extension methods to Azure.ResourceManager.EventHubs. public static partial class EventHubsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableEventHubsArmClient GetMockableEventHubsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableEventHubsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableEventHubsResourceGroupResource GetMockableEventHubsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableEventHubsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableEventHubsSubscriptionResource GetMockableEventHubsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableEventHubsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region EventHubsClusterResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsClusterResource GetEventHubsClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsClusterResource.ValidateResourceId(id); - return new EventHubsClusterResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsClusterResource(id); } - #endregion - #region EventHubsNamespaceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsNamespaceResource GetEventHubsNamespaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsNamespaceResource.ValidateResourceId(id); - return new EventHubsNamespaceResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsNamespaceResource(id); } - #endregion - #region EventHubsNetworkRuleSetResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsNetworkRuleSetResource GetEventHubsNetworkRuleSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsNetworkRuleSetResource.ValidateResourceId(id); - return new EventHubsNetworkRuleSetResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsNetworkRuleSetResource(id); } - #endregion - #region EventHubsNamespaceAuthorizationRuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsNamespaceAuthorizationRuleResource GetEventHubsNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsNamespaceAuthorizationRuleResource.ValidateResourceId(id); - return new EventHubsNamespaceAuthorizationRuleResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsNamespaceAuthorizationRuleResource(id); } - #endregion - #region EventHubsDisasterRecoveryAuthorizationRuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsDisasterRecoveryAuthorizationRuleResource GetEventHubsDisasterRecoveryAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsDisasterRecoveryAuthorizationRuleResource.ValidateResourceId(id); - return new EventHubsDisasterRecoveryAuthorizationRuleResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsDisasterRecoveryAuthorizationRuleResource(id); } - #endregion - #region EventHubAuthorizationRuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubAuthorizationRuleResource GetEventHubAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubAuthorizationRuleResource.ValidateResourceId(id); - return new EventHubAuthorizationRuleResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubAuthorizationRuleResource(id); } - #endregion - #region EventHubsPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsPrivateEndpointConnectionResource GetEventHubsPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsPrivateEndpointConnectionResource.ValidateResourceId(id); - return new EventHubsPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsPrivateEndpointConnectionResource(id); } - #endregion - #region EventHubsDisasterRecoveryResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsDisasterRecoveryResource GetEventHubsDisasterRecoveryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsDisasterRecoveryResource.ValidateResourceId(id); - return new EventHubsDisasterRecoveryResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsDisasterRecoveryResource(id); } - #endregion - #region EventHubResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubResource GetEventHubResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubResource.ValidateResourceId(id); - return new EventHubResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubResource(id); } - #endregion - #region EventHubsConsumerGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsConsumerGroupResource GetEventHubsConsumerGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsConsumerGroupResource.ValidateResourceId(id); - return new EventHubsConsumerGroupResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsConsumerGroupResource(id); } - #endregion - #region EventHubsSchemaGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsSchemaGroupResource GetEventHubsSchemaGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsSchemaGroupResource.ValidateResourceId(id); - return new EventHubsSchemaGroupResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsSchemaGroupResource(id); } - #endregion - #region EventHubsApplicationGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubsApplicationGroupResource GetEventHubsApplicationGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubsApplicationGroupResource.ValidateResourceId(id); - return new EventHubsApplicationGroupResource(client, id); - } - ); + return GetMockableEventHubsArmClient(client).GetEventHubsApplicationGroupResource(id); } - #endregion - /// Gets a collection of EventHubsClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of EventHubsClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EventHubsClusterResources and their operations over a EventHubsClusterResource. public static EventHubsClusterCollection GetEventHubsClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventHubsClusters(); + return GetMockableEventHubsResourceGroupResource(resourceGroupResource).GetEventHubsClusters(); } /// @@ -298,16 +253,20 @@ public static EventHubsClusterCollection GetEventHubsClusters(this ResourceGroup /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Event Hubs Cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEventHubsClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEventHubsClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventHubsResourceGroupResource(resourceGroupResource).GetEventHubsClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -322,24 +281,34 @@ public static async Task> GetEventHubsCluster /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Event Hubs Cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEventHubsCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEventHubsClusters().Get(clusterName, cancellationToken); + return GetMockableEventHubsResourceGroupResource(resourceGroupResource).GetEventHubsCluster(clusterName, cancellationToken); } - /// Gets a collection of EventHubsNamespaceResources in the ResourceGroupResource. + /// + /// Gets a collection of EventHubsNamespaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EventHubsNamespaceResources and their operations over a EventHubsNamespaceResource. public static EventHubsNamespaceCollection GetEventHubsNamespaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEventHubsNamespaces(); + return GetMockableEventHubsResourceGroupResource(resourceGroupResource).GetEventHubsNamespaces(); } /// @@ -354,16 +323,20 @@ public static EventHubsNamespaceCollection GetEventHubsNamespaces(this ResourceG /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Namespace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEventHubsNamespaceAsync(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEventHubsNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableEventHubsResourceGroupResource(resourceGroupResource).GetEventHubsNamespaceAsync(namespaceName, cancellationToken).ConfigureAwait(false); } /// @@ -378,16 +351,20 @@ public static async Task> GetEventHubsNames /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Namespace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEventHubsNamespace(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEventHubsNamespaces().Get(namespaceName, cancellationToken); + return GetMockableEventHubsResourceGroupResource(resourceGroupResource).GetEventHubsNamespace(namespaceName, cancellationToken); } /// @@ -402,13 +379,17 @@ public static Response GetEventHubsNamespace(this Re /// Clusters_ListAvailableClusterRegion /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableClusterRegionClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableClusterRegionClustersAsync(cancellationToken); + return GetMockableEventHubsSubscriptionResource(subscriptionResource).GetAvailableClusterRegionClustersAsync(cancellationToken); } /// @@ -423,13 +404,17 @@ public static AsyncPageable GetAvailableClusterRegionClustersA /// Clusters_ListAvailableClusterRegion /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableClusterRegionClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableClusterRegionClusters(cancellationToken); + return GetMockableEventHubsSubscriptionResource(subscriptionResource).GetAvailableClusterRegionClusters(cancellationToken); } /// @@ -444,13 +429,17 @@ public static Pageable GetAvailableClusterRegionClusters(this /// Clusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEventHubsClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventHubsClustersAsync(cancellationToken); + return GetMockableEventHubsSubscriptionResource(subscriptionResource).GetEventHubsClustersAsync(cancellationToken); } /// @@ -465,13 +454,17 @@ public static AsyncPageable GetEventHubsClustersAsync( /// Clusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEventHubsClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventHubsClusters(cancellationToken); + return GetMockableEventHubsSubscriptionResource(subscriptionResource).GetEventHubsClusters(cancellationToken); } /// @@ -486,13 +479,17 @@ public static Pageable GetEventHubsClusters(this Subsc /// Namespaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEventHubsNamespacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventHubsNamespacesAsync(cancellationToken); + return GetMockableEventHubsSubscriptionResource(subscriptionResource).GetEventHubsNamespacesAsync(cancellationToken); } /// @@ -507,13 +504,17 @@ public static AsyncPageable GetEventHubsNamespacesAs /// Namespaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEventHubsNamespaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEventHubsNamespaces(cancellationToken); + return GetMockableEventHubsSubscriptionResource(subscriptionResource).GetEventHubsNamespaces(cancellationToken); } /// @@ -528,6 +529,10 @@ public static Pageable GetEventHubsNamespaces(this S /// Namespaces_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters to check availability of the given Namespace name. @@ -535,9 +540,7 @@ public static Pageable GetEventHubsNamespaces(this S /// is null. public static async Task> CheckEventHubsNamespaceNameAvailabilityAsync(this SubscriptionResource subscriptionResource, EventHubsNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckEventHubsNamespaceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableEventHubsSubscriptionResource(subscriptionResource).CheckEventHubsNamespaceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -552,6 +555,10 @@ public static async Task> CheckEventHu /// Namespaces_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters to check availability of the given Namespace name. @@ -559,9 +566,7 @@ public static async Task> CheckEventHu /// is null. public static Response CheckEventHubsNamespaceNameAvailability(this SubscriptionResource subscriptionResource, EventHubsNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckEventHubsNamespaceNameAvailability(content, cancellationToken); + return GetMockableEventHubsSubscriptionResource(subscriptionResource).CheckEventHubsNamespaceNameAvailability(content, cancellationToken); } } } diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsArmClient.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsArmClient.cs new file mode 100644 index 0000000000000..6262b818c22be --- /dev/null +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsArmClient.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.EventHubs; + +namespace Azure.ResourceManager.EventHubs.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableEventHubsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableEventHubsArmClient() + { + } + + /// 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 MockableEventHubsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableEventHubsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsClusterResource GetEventHubsClusterResource(ResourceIdentifier id) + { + EventHubsClusterResource.ValidateResourceId(id); + return new EventHubsClusterResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsNamespaceResource GetEventHubsNamespaceResource(ResourceIdentifier id) + { + EventHubsNamespaceResource.ValidateResourceId(id); + return new EventHubsNamespaceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsNetworkRuleSetResource GetEventHubsNetworkRuleSetResource(ResourceIdentifier id) + { + EventHubsNetworkRuleSetResource.ValidateResourceId(id); + return new EventHubsNetworkRuleSetResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsNamespaceAuthorizationRuleResource GetEventHubsNamespaceAuthorizationRuleResource(ResourceIdentifier id) + { + EventHubsNamespaceAuthorizationRuleResource.ValidateResourceId(id); + return new EventHubsNamespaceAuthorizationRuleResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsDisasterRecoveryAuthorizationRuleResource GetEventHubsDisasterRecoveryAuthorizationRuleResource(ResourceIdentifier id) + { + EventHubsDisasterRecoveryAuthorizationRuleResource.ValidateResourceId(id); + return new EventHubsDisasterRecoveryAuthorizationRuleResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubAuthorizationRuleResource GetEventHubAuthorizationRuleResource(ResourceIdentifier id) + { + EventHubAuthorizationRuleResource.ValidateResourceId(id); + return new EventHubAuthorizationRuleResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsPrivateEndpointConnectionResource GetEventHubsPrivateEndpointConnectionResource(ResourceIdentifier id) + { + EventHubsPrivateEndpointConnectionResource.ValidateResourceId(id); + return new EventHubsPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsDisasterRecoveryResource GetEventHubsDisasterRecoveryResource(ResourceIdentifier id) + { + EventHubsDisasterRecoveryResource.ValidateResourceId(id); + return new EventHubsDisasterRecoveryResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubResource GetEventHubResource(ResourceIdentifier id) + { + EventHubResource.ValidateResourceId(id); + return new EventHubResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsConsumerGroupResource GetEventHubsConsumerGroupResource(ResourceIdentifier id) + { + EventHubsConsumerGroupResource.ValidateResourceId(id); + return new EventHubsConsumerGroupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsSchemaGroupResource GetEventHubsSchemaGroupResource(ResourceIdentifier id) + { + EventHubsSchemaGroupResource.ValidateResourceId(id); + return new EventHubsSchemaGroupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubsApplicationGroupResource GetEventHubsApplicationGroupResource(ResourceIdentifier id) + { + EventHubsApplicationGroupResource.ValidateResourceId(id); + return new EventHubsApplicationGroupResource(Client, id); + } + } +} diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsResourceGroupResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsResourceGroupResource.cs new file mode 100644 index 0000000000000..d597a6d5792cd --- /dev/null +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.EventHubs; + +namespace Azure.ResourceManager.EventHubs.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableEventHubsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableEventHubsResourceGroupResource() + { + } + + /// 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 MockableEventHubsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of EventHubsClusterResources in the ResourceGroupResource. + /// An object representing collection of EventHubsClusterResources and their operations over a EventHubsClusterResource. + public virtual EventHubsClusterCollection GetEventHubsClusters() + { + return GetCachedClient(client => new EventHubsClusterCollection(client, Id)); + } + + /// + /// Gets the resource description of the specified Event Hubs Cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the Event Hubs Cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEventHubsClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetEventHubsClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the resource description of the specified Event Hubs Cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the Event Hubs Cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEventHubsCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetEventHubsClusters().Get(clusterName, cancellationToken); + } + + /// Gets a collection of EventHubsNamespaceResources in the ResourceGroupResource. + /// An object representing collection of EventHubsNamespaceResources and their operations over a EventHubsNamespaceResource. + public virtual EventHubsNamespaceCollection GetEventHubsNamespaces() + { + return GetCachedClient(client => new EventHubsNamespaceCollection(client, Id)); + } + + /// + /// Gets the description of the specified namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The Namespace name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEventHubsNamespaceAsync(string namespaceName, CancellationToken cancellationToken = default) + { + return await GetEventHubsNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the description of the specified namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The Namespace name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEventHubsNamespace(string namespaceName, CancellationToken cancellationToken = default) + { + return GetEventHubsNamespaces().Get(namespaceName, cancellationToken); + } + } +} diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsSubscriptionResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsSubscriptionResource.cs new file mode 100644 index 0000000000000..3f91b7967cb4d --- /dev/null +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/MockableEventHubsSubscriptionResource.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.EventHubs; +using Azure.ResourceManager.EventHubs.Models; + +namespace Azure.ResourceManager.EventHubs.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableEventHubsSubscriptionResource : ArmResource + { + private ClientDiagnostics _eventHubsClusterClustersClientDiagnostics; + private ClustersRestOperations _eventHubsClusterClustersRestClient; + private ClientDiagnostics _eventHubsNamespaceNamespacesClientDiagnostics; + private NamespacesRestOperations _eventHubsNamespaceNamespacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableEventHubsSubscriptionResource() + { + } + + /// 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 MockableEventHubsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics EventHubsClusterClustersClientDiagnostics => _eventHubsClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventHubs", EventHubsClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations EventHubsClusterClustersRestClient => _eventHubsClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventHubsClusterResource.ResourceType)); + private ClientDiagnostics EventHubsNamespaceNamespacesClientDiagnostics => _eventHubsNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventHubs", EventHubsNamespaceResource.ResourceType.Namespace, Diagnostics); + private NamespacesRestOperations EventHubsNamespaceNamespacesRestClient => _eventHubsNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventHubsNamespaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/availableClusterRegions + /// + /// + /// Operation Id + /// Clusters_ListAvailableClusterRegion + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableClusterRegionClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsClusterClustersRestClient.CreateListAvailableClusterRegionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, AvailableCluster.DeserializeAvailableCluster, EventHubsClusterClustersClientDiagnostics, Pipeline, "MockableEventHubsSubscriptionResource.GetAvailableClusterRegionClusters", "value", null, cancellationToken); + } + + /// + /// List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/availableClusterRegions + /// + /// + /// Operation Id + /// Clusters_ListAvailableClusterRegion + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableClusterRegionClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsClusterClustersRestClient.CreateListAvailableClusterRegionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, AvailableCluster.DeserializeAvailableCluster, EventHubsClusterClustersClientDiagnostics, Pipeline, "MockableEventHubsSubscriptionResource.GetAvailableClusterRegionClusters", "value", null, cancellationToken); + } + + /// + /// Lists the available Event Hubs Clusters within an ARM resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/clusters + /// + /// + /// Operation Id + /// Clusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEventHubsClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventHubsClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventHubsClusterResource(Client, EventHubsClusterData.DeserializeEventHubsClusterData(e)), EventHubsClusterClustersClientDiagnostics, Pipeline, "MockableEventHubsSubscriptionResource.GetEventHubsClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the available Event Hubs Clusters within an ARM resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/clusters + /// + /// + /// Operation Id + /// Clusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEventHubsClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventHubsClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventHubsClusterResource(Client, EventHubsClusterData.DeserializeEventHubsClusterData(e)), EventHubsClusterClustersClientDiagnostics, Pipeline, "MockableEventHubsSubscriptionResource.GetEventHubsClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available Namespaces within a subscription, irrespective of the resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces + /// + /// + /// Operation Id + /// Namespaces_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEventHubsNamespacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventHubsNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventHubsNamespaceResource(Client, EventHubsNamespaceData.DeserializeEventHubsNamespaceData(e)), EventHubsNamespaceNamespacesClientDiagnostics, Pipeline, "MockableEventHubsSubscriptionResource.GetEventHubsNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available Namespaces within a subscription, irrespective of the resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces + /// + /// + /// Operation Id + /// Namespaces_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEventHubsNamespaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventHubsNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventHubsNamespaceResource(Client, EventHubsNamespaceData.DeserializeEventHubsNamespaceData(e)), EventHubsNamespaceNamespacesClientDiagnostics, Pipeline, "MockableEventHubsSubscriptionResource.GetEventHubsNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// Check the give Namespace name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/checkNameAvailability + /// + /// + /// Operation Id + /// Namespaces_CheckNameAvailability + /// + /// + /// + /// Parameters to check availability of the given Namespace name. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckEventHubsNamespaceNameAvailabilityAsync(EventHubsNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = EventHubsNamespaceNamespacesClientDiagnostics.CreateScope("MockableEventHubsSubscriptionResource.CheckEventHubsNamespaceNameAvailability"); + scope.Start(); + try + { + var response = await EventHubsNamespaceNamespacesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the give Namespace name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/checkNameAvailability + /// + /// + /// Operation Id + /// Namespaces_CheckNameAvailability + /// + /// + /// + /// Parameters to check availability of the given Namespace name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckEventHubsNamespaceNameAvailability(EventHubsNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = EventHubsNamespaceNamespacesClientDiagnostics.CreateScope("MockableEventHubsSubscriptionResource.CheckEventHubsNamespaceNameAvailability"); + scope.Start(); + try + { + var response = EventHubsNamespaceNamespacesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ca3dbc786f76a..0000000000000 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.EventHubs -{ - /// 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 EventHubsClusterResources in the ResourceGroupResource. - /// An object representing collection of EventHubsClusterResources and their operations over a EventHubsClusterResource. - public virtual EventHubsClusterCollection GetEventHubsClusters() - { - return GetCachedClient(Client => new EventHubsClusterCollection(Client, Id)); - } - - /// Gets a collection of EventHubsNamespaceResources in the ResourceGroupResource. - /// An object representing collection of EventHubsNamespaceResources and their operations over a EventHubsNamespaceResource. - public virtual EventHubsNamespaceCollection GetEventHubsNamespaces() - { - return GetCachedClient(Client => new EventHubsNamespaceCollection(Client, Id)); - } - } -} diff --git a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 0ba36a4962e6e..0000000000000 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.EventHubs.Models; - -namespace Azure.ResourceManager.EventHubs -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _eventHubsClusterClustersClientDiagnostics; - private ClustersRestOperations _eventHubsClusterClustersRestClient; - private ClientDiagnostics _eventHubsNamespaceNamespacesClientDiagnostics; - private NamespacesRestOperations _eventHubsNamespaceNamespacesRestClient; - - /// 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 EventHubsClusterClustersClientDiagnostics => _eventHubsClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventHubs", EventHubsClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations EventHubsClusterClustersRestClient => _eventHubsClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventHubsClusterResource.ResourceType)); - private ClientDiagnostics EventHubsNamespaceNamespacesClientDiagnostics => _eventHubsNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EventHubs", EventHubsNamespaceResource.ResourceType.Namespace, Diagnostics); - private NamespacesRestOperations EventHubsNamespaceNamespacesRestClient => _eventHubsNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EventHubsNamespaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/availableClusterRegions - /// - /// - /// Operation Id - /// Clusters_ListAvailableClusterRegion - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableClusterRegionClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsClusterClustersRestClient.CreateListAvailableClusterRegionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, AvailableCluster.DeserializeAvailableCluster, EventHubsClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableClusterRegionClusters", "value", null, cancellationToken); - } - - /// - /// List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/availableClusterRegions - /// - /// - /// Operation Id - /// Clusters_ListAvailableClusterRegion - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableClusterRegionClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsClusterClustersRestClient.CreateListAvailableClusterRegionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, AvailableCluster.DeserializeAvailableCluster, EventHubsClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableClusterRegionClusters", "value", null, cancellationToken); - } - - /// - /// Lists the available Event Hubs Clusters within an ARM resource group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/clusters - /// - /// - /// Operation Id - /// Clusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEventHubsClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventHubsClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventHubsClusterResource(Client, EventHubsClusterData.DeserializeEventHubsClusterData(e)), EventHubsClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventHubsClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the available Event Hubs Clusters within an ARM resource group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/clusters - /// - /// - /// Operation Id - /// Clusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEventHubsClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventHubsClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventHubsClusterResource(Client, EventHubsClusterData.DeserializeEventHubsClusterData(e)), EventHubsClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventHubsClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the available Namespaces within a subscription, irrespective of the resource groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces - /// - /// - /// Operation Id - /// Namespaces_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEventHubsNamespacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventHubsNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventHubsNamespaceResource(Client, EventHubsNamespaceData.DeserializeEventHubsNamespaceData(e)), EventHubsNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventHubsNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the available Namespaces within a subscription, irrespective of the resource groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces - /// - /// - /// Operation Id - /// Namespaces_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEventHubsNamespaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventHubsNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventHubsNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventHubsNamespaceResource(Client, EventHubsNamespaceData.DeserializeEventHubsNamespaceData(e)), EventHubsNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEventHubsNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// Check the give Namespace name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/checkNameAvailability - /// - /// - /// Operation Id - /// Namespaces_CheckNameAvailability - /// - /// - /// - /// Parameters to check availability of the given Namespace name. - /// The cancellation token to use. - public virtual async Task> CheckEventHubsNamespaceNameAvailabilityAsync(EventHubsNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = EventHubsNamespaceNamespacesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckEventHubsNamespaceNameAvailability"); - scope.Start(); - try - { - var response = await EventHubsNamespaceNamespacesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the give Namespace name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.EventHub/checkNameAvailability - /// - /// - /// Operation Id - /// Namespaces_CheckNameAvailability - /// - /// - /// - /// Parameters to check availability of the given Namespace name. - /// The cancellation token to use. - public virtual Response CheckEventHubsNamespaceNameAvailability(EventHubsNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = EventHubsNamespaceNamespacesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckEventHubsNamespaceNameAvailability"); - scope.Start(); - try - { - var response = EventHubsNamespaceNamespacesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/Azure.ResourceManager.ExtendedLocations.sln b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/Azure.ResourceManager.ExtendedLocations.sln index 696ad2840623d..863b1c9ebd432 100644 --- a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/Azure.ResourceManager.ExtendedLocations.sln +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/Azure.ResourceManager.ExtendedLocations.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{98E2A7CD-3812-4FD4-A7E7-9CFDC880F9ED}") = "Azure.ResourceManager.ExtendedLocations", "src\Azure.ResourceManager.ExtendedLocations.csproj", "{5B20505F-70A1-48A4-9B4A-9CCF7A80671D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ExtendedLocations", "src\Azure.ResourceManager.ExtendedLocations.csproj", "{5B20505F-70A1-48A4-9B4A-9CCF7A80671D}" EndProject -Project("{98E2A7CD-3812-4FD4-A7E7-9CFDC880F9ED}") = "Azure.ResourceManager.ExtendedLocations.Tests", "tests\Azure.ResourceManager.ExtendedLocations.Tests.csproj", "{2C0ADF65-B48E-419C-8D9A-6A2BCEEB4E6C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ExtendedLocations.Tests", "tests\Azure.ResourceManager.ExtendedLocations.Tests.csproj", "{2C0ADF65-B48E-419C-8D9A-6A2BCEEB4E6C}" EndProject -Project("{98E2A7CD-3812-4FD4-A7E7-9CFDC880F9ED}") = "Azure.ResourceManager.ExtendedLocations.Samples", "samples\Azure.ResourceManager.ExtendedLocations.Samples.csproj", "{483B7174-2DD3-44DB-B25A-6BA1AAD338CF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ExtendedLocations.Samples", "samples\Azure.ResourceManager.ExtendedLocations.Samples.csproj", "{483B7174-2DD3-44DB-B25A-6BA1AAD338CF}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {FC07FF99-971C-465C-83AA-029D0220A9CA} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {2C0ADF65-B48E-419C-8D9A-6A2BCEEB4E6C}.Release|x64.Build.0 = Release|Any CPU {2C0ADF65-B48E-419C-8D9A-6A2BCEEB4E6C}.Release|x86.ActiveCfg = Release|Any CPU {2C0ADF65-B48E-419C-8D9A-6A2BCEEB4E6C}.Release|x86.Build.0 = Release|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Debug|x64.ActiveCfg = Debug|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Debug|x64.Build.0 = Debug|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Debug|x86.ActiveCfg = Debug|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Debug|x86.Build.0 = Debug|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Release|Any CPU.Build.0 = Release|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Release|x64.ActiveCfg = Release|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Release|x64.Build.0 = Release|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Release|x86.ActiveCfg = Release|Any CPU + {483B7174-2DD3-44DB-B25A-6BA1AAD338CF}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FC07FF99-971C-465C-83AA-029D0220A9CA} EndGlobalSection EndGlobal diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/api/Azure.ResourceManager.ExtendedLocations.netstandard2.0.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/api/Azure.ResourceManager.ExtendedLocations.netstandard2.0.cs index f5ef30558e3fe..dcb69945a645d 100644 --- a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/api/Azure.ResourceManager.ExtendedLocations.netstandard2.0.cs +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/api/Azure.ResourceManager.ExtendedLocations.netstandard2.0.cs @@ -19,7 +19,7 @@ protected CustomLocationCollection() { } } public partial class CustomLocationData : Azure.ResourceManager.Models.TrackedResourceData { - public CustomLocationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CustomLocationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ExtendedLocations.Models.CustomLocationAuthentication Authentication { get { throw null; } set { } } public System.Collections.Generic.IList ClusterExtensionIds { get { throw null; } } public string DisplayName { get { throw null; } set { } } @@ -61,6 +61,27 @@ public static partial class ExtendedLocationsExtensions public static Azure.AsyncPageable GetCustomLocationsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ExtendedLocations.Mocking +{ + public partial class MockableExtendedLocationsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableExtendedLocationsArmClient() { } + public virtual Azure.ResourceManager.ExtendedLocations.CustomLocationResource GetCustomLocationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableExtendedLocationsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableExtendedLocationsResourceGroupResource() { } + public virtual Azure.Response GetCustomLocation(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCustomLocationAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ExtendedLocations.CustomLocationCollection GetCustomLocations() { throw null; } + } + public partial class MockableExtendedLocationsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableExtendedLocationsSubscriptionResource() { } + public virtual Azure.Pageable GetCustomLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCustomLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ExtendedLocations.Models { public static partial class ArmExtendedLocationsModelFactory diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/CustomLocationResource.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/CustomLocationResource.cs index 96f7a845ff844..957233f342e8f 100644 --- a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/CustomLocationResource.cs +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/CustomLocationResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ExtendedLocations public partial class CustomLocationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName}"; diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/ExtendedLocationsExtensions.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/ExtendedLocationsExtensions.cs index f0c7bb85ca4ea..1a1f38d5b44c0 100644 --- a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/ExtendedLocationsExtensions.cs +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/ExtendedLocationsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ExtendedLocations.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ExtendedLocations @@ -18,62 +19,49 @@ namespace Azure.ResourceManager.ExtendedLocations /// A class to add extension methods to Azure.ResourceManager.ExtendedLocations. public static partial class ExtendedLocationsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableExtendedLocationsArmClient GetMockableExtendedLocationsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableExtendedLocationsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableExtendedLocationsResourceGroupResource GetMockableExtendedLocationsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableExtendedLocationsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableExtendedLocationsSubscriptionResource GetMockableExtendedLocationsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableExtendedLocationsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region CustomLocationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CustomLocationResource GetCustomLocationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CustomLocationResource.ValidateResourceId(id); - return new CustomLocationResource(client, id); - } - ); + return GetMockableExtendedLocationsArmClient(client).GetCustomLocationResource(id); } - #endregion - /// Gets a collection of CustomLocationResources in the ResourceGroupResource. + /// + /// Gets a collection of CustomLocationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CustomLocationResources and their operations over a CustomLocationResource. public static CustomLocationCollection GetCustomLocations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCustomLocations(); + return GetMockableExtendedLocationsResourceGroupResource(resourceGroupResource).GetCustomLocations(); } /// @@ -88,16 +76,20 @@ public static CustomLocationCollection GetCustomLocations(this ResourceGroupReso /// CustomLocations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Custom Locations name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCustomLocationAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCustomLocations().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableExtendedLocationsResourceGroupResource(resourceGroupResource).GetCustomLocationAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -112,16 +104,20 @@ public static async Task> GetCustomLocationAsyn /// CustomLocations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Custom Locations name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCustomLocation(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCustomLocations().Get(resourceName, cancellationToken); + return GetMockableExtendedLocationsResourceGroupResource(resourceGroupResource).GetCustomLocation(resourceName, cancellationToken); } /// @@ -136,13 +132,17 @@ public static Response GetCustomLocation(this ResourceGr /// CustomLocations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCustomLocationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCustomLocationsAsync(cancellationToken); + return GetMockableExtendedLocationsSubscriptionResource(subscriptionResource).GetCustomLocationsAsync(cancellationToken); } /// @@ -157,13 +157,17 @@ public static AsyncPageable GetCustomLocationsAsync(this /// CustomLocations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCustomLocations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCustomLocations(cancellationToken); + return GetMockableExtendedLocationsSubscriptionResource(subscriptionResource).GetCustomLocations(cancellationToken); } } } diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsArmClient.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsArmClient.cs new file mode 100644 index 0000000000000..5421162e19d5b --- /dev/null +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ExtendedLocations; + +namespace Azure.ResourceManager.ExtendedLocations.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableExtendedLocationsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableExtendedLocationsArmClient() + { + } + + /// 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 MockableExtendedLocationsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableExtendedLocationsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CustomLocationResource GetCustomLocationResource(ResourceIdentifier id) + { + CustomLocationResource.ValidateResourceId(id); + return new CustomLocationResource(Client, id); + } + } +} diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsResourceGroupResource.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsResourceGroupResource.cs new file mode 100644 index 0000000000000..d27c87c39fc30 --- /dev/null +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ExtendedLocations; + +namespace Azure.ResourceManager.ExtendedLocations.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableExtendedLocationsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableExtendedLocationsResourceGroupResource() + { + } + + /// 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 MockableExtendedLocationsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CustomLocationResources in the ResourceGroupResource. + /// An object representing collection of CustomLocationResources and their operations over a CustomLocationResource. + public virtual CustomLocationCollection GetCustomLocations() + { + return GetCachedClient(client => new CustomLocationCollection(client, Id)); + } + + /// + /// Gets the details of the customLocation with a specified resource group and name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName} + /// + /// + /// Operation Id + /// CustomLocations_Get + /// + /// + /// + /// Custom Locations name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCustomLocationAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetCustomLocations().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the customLocation with a specified resource group and name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName} + /// + /// + /// Operation Id + /// CustomLocations_Get + /// + /// + /// + /// Custom Locations name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCustomLocation(string resourceName, CancellationToken cancellationToken = default) + { + return GetCustomLocations().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsSubscriptionResource.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsSubscriptionResource.cs new file mode 100644 index 0000000000000..614de920974a6 --- /dev/null +++ b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/MockableExtendedLocationsSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ExtendedLocations; + +namespace Azure.ResourceManager.ExtendedLocations.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableExtendedLocationsSubscriptionResource : ArmResource + { + private ClientDiagnostics _customLocationClientDiagnostics; + private CustomLocationsRestOperations _customLocationRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableExtendedLocationsSubscriptionResource() + { + } + + /// 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 MockableExtendedLocationsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CustomLocationClientDiagnostics => _customLocationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ExtendedLocations", CustomLocationResource.ResourceType.Namespace, Diagnostics); + private CustomLocationsRestOperations CustomLocationRestClient => _customLocationRestClient ??= new CustomLocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CustomLocationResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom Location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ExtendedLocation/customLocations + /// + /// + /// Operation Id + /// CustomLocations_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCustomLocationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CustomLocationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomLocationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CustomLocationResource(Client, CustomLocationData.DeserializeCustomLocationData(e)), CustomLocationClientDiagnostics, Pipeline, "MockableExtendedLocationsSubscriptionResource.GetCustomLocations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom Location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ExtendedLocation/customLocations + /// + /// + /// Operation Id + /// CustomLocations_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCustomLocations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CustomLocationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomLocationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CustomLocationResource(Client, CustomLocationData.DeserializeCustomLocationData(e)), CustomLocationClientDiagnostics, Pipeline, "MockableExtendedLocationsSubscriptionResource.GetCustomLocations", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 1dbf526f13077..0000000000000 --- a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ExtendedLocations -{ - /// 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 CustomLocationResources in the ResourceGroupResource. - /// An object representing collection of CustomLocationResources and their operations over a CustomLocationResource. - public virtual CustomLocationCollection GetCustomLocations() - { - return GetCachedClient(Client => new CustomLocationCollection(Client, Id)); - } - } -} diff --git a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 027f90c17868c..0000000000000 --- a/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ExtendedLocations -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _customLocationClientDiagnostics; - private CustomLocationsRestOperations _customLocationRestClient; - - /// 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 CustomLocationClientDiagnostics => _customLocationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ExtendedLocations", CustomLocationResource.ResourceType.Namespace, Diagnostics); - private CustomLocationsRestOperations CustomLocationRestClient => _customLocationRestClient ??= new CustomLocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CustomLocationResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom Location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ExtendedLocation/customLocations - /// - /// - /// Operation Id - /// CustomLocations_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCustomLocationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CustomLocationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomLocationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CustomLocationResource(Client, CustomLocationData.DeserializeCustomLocationData(e)), CustomLocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCustomLocations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of Custom Locations in the specified subscription. The operation returns properties of each Custom Location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ExtendedLocation/customLocations - /// - /// - /// Operation Id - /// CustomLocations_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCustomLocations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CustomLocationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomLocationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CustomLocationResource(Client, CustomLocationData.DeserializeCustomLocationData(e)), CustomLocationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCustomLocations", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/src/AzureKeyVaultConfigurationExtensions.cs b/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/src/AzureKeyVaultConfigurationExtensions.cs index 83c65cd804959..ce81d3f26836a 100644 --- a/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/src/AzureKeyVaultConfigurationExtensions.cs +++ b/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/src/AzureKeyVaultConfigurationExtensions.cs @@ -20,7 +20,7 @@ public static class AzureKeyVaultConfigurationExtensions /// /// The to add to. /// The Azure Key Vault uri. - /// The credential to to use for authentication. + /// The credential to use for authentication. /// The . public static IConfigurationBuilder AddAzureKeyVault( this IConfigurationBuilder configurationBuilder, @@ -35,7 +35,7 @@ public static IConfigurationBuilder AddAzureKeyVault( /// /// The to add to. /// Azure Key Vault uri. - /// The credential to to use for authentication. + /// The credential to use for authentication. /// The instance used to control secret loading. /// The . public static IConfigurationBuilder AddAzureKeyVault( @@ -73,7 +73,7 @@ public static IConfigurationBuilder AddAzureKeyVault( /// /// The to add to. /// Azure Key Vault uri. - /// The credential to to use for authentication. + /// The credential to use for authentication. /// The to use. /// The . public static IConfigurationBuilder AddAzureKeyVault( diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/api/Azure.ResourceManager.ContainerServiceFleet.netstandard2.0.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/api/Azure.ResourceManager.ContainerServiceFleet.netstandard2.0.cs index 5d3fbd69247c7..1129a1caa890f 100644 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/api/Azure.ResourceManager.ContainerServiceFleet.netstandard2.0.cs +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/api/Azure.ResourceManager.ContainerServiceFleet.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ContainerServiceFleetCollection() { } } public partial class ContainerServiceFleetData : Azure.ResourceManager.Models.TrackedResourceData { - public ContainerServiceFleetData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ContainerServiceFleetData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.ContainerServiceFleet.Models.FleetProvisioningState? ProvisioningState { get { throw null; } } @@ -190,6 +190,30 @@ protected FleetUpdateStrategyResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ContainerServiceFleet.FleetUpdateStrategyData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ContainerServiceFleet.Mocking +{ + public partial class MockableContainerServiceFleetArmClient : Azure.ResourceManager.ArmResource + { + protected MockableContainerServiceFleetArmClient() { } + public virtual Azure.ResourceManager.ContainerServiceFleet.ContainerServiceFleetMemberResource GetContainerServiceFleetMemberResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerServiceFleet.ContainerServiceFleetResource GetContainerServiceFleetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerServiceFleet.ContainerServiceFleetUpdateRunResource GetContainerServiceFleetUpdateRunResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ContainerServiceFleet.FleetUpdateStrategyResource GetFleetUpdateStrategyResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableContainerServiceFleetResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableContainerServiceFleetResourceGroupResource() { } + public virtual Azure.Response GetContainerServiceFleet(string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetContainerServiceFleetAsync(string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ContainerServiceFleet.ContainerServiceFleetCollection GetContainerServiceFleets() { throw null; } + } + public partial class MockableContainerServiceFleetSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableContainerServiceFleetSubscriptionResource() { } + public virtual Azure.Pageable GetContainerServiceFleets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetContainerServiceFleetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ContainerServiceFleet.Models { public static partial class ArmContainerServiceFleetModelFactory diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetMemberResource.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetMemberResource.cs index 79d73014025d0..3b0aced1ce3e4 100644 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetMemberResource.cs +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetMemberResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ContainerServiceFleet public partial class ContainerServiceFleetMemberResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fleetName. + /// The fleetMemberName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"; diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetResource.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetResource.cs index ceb62d0e77e16..c312a453bb4b3 100644 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetResource.cs +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ContainerServiceFleet public partial class ContainerServiceFleetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fleetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ContainerServiceFleetMemberResources and their operations over a ContainerServiceFleetMemberResource. public virtual ContainerServiceFleetMemberCollection GetContainerServiceFleetMembers() { - return GetCachedClient(Client => new ContainerServiceFleetMemberCollection(Client, Id)); + return GetCachedClient(client => new ContainerServiceFleetMemberCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ContainerServiceFleetMemberCollection GetContainerServiceFleetMem /// /// The name of the Fleet member resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerServiceFleetMemberAsync(string fleetMemberName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetCont /// /// The name of the Fleet member resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerServiceFleetMember(string fleetMemberName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetContainerService /// An object representing collection of ContainerServiceFleetUpdateRunResources and their operations over a ContainerServiceFleetUpdateRunResource. public virtual ContainerServiceFleetUpdateRunCollection GetContainerServiceFleetUpdateRuns() { - return GetCachedClient(Client => new ContainerServiceFleetUpdateRunCollection(Client, Id)); + return GetCachedClient(client => new ContainerServiceFleetUpdateRunCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual ContainerServiceFleetUpdateRunCollection GetContainerServiceFleet /// /// The name of the UpdateRun resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContainerServiceFleetUpdateRunAsync(string updateRunName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetC /// /// The name of the UpdateRun resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContainerServiceFleetUpdateRun(string updateRunName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetContainerServ /// An object representing collection of FleetUpdateStrategyResources and their operations over a FleetUpdateStrategyResource. public virtual FleetUpdateStrategyCollection GetFleetUpdateStrategies() { - return GetCachedClient(Client => new FleetUpdateStrategyCollection(Client, Id)); + return GetCachedClient(client => new FleetUpdateStrategyCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual FleetUpdateStrategyCollection GetFleetUpdateStrategies() /// /// The name of the UpdateStrategy resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFleetUpdateStrategyAsync(string updateStrategyName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetFleetUpdateS /// /// The name of the UpdateStrategy resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFleetUpdateStrategy(string updateStrategyName, CancellationToken cancellationToken = default) { diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetUpdateRunResource.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetUpdateRunResource.cs index 299fd11ae8b9e..426b7f0555145 100644 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetUpdateRunResource.cs +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetUpdateRunResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerServiceFleet public partial class ContainerServiceFleetUpdateRunResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fleetName. + /// The updateRunName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}"; diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/ContainerServiceFleetExtensions.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/ContainerServiceFleetExtensions.cs index 8646973c2d1d0..0d74b28ee8ae3 100644 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/ContainerServiceFleetExtensions.cs +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/ContainerServiceFleetExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ContainerServiceFleet.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ContainerServiceFleet @@ -18,119 +19,97 @@ namespace Azure.ResourceManager.ContainerServiceFleet /// A class to add extension methods to Azure.ResourceManager.ContainerServiceFleet. public static partial class ContainerServiceFleetExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableContainerServiceFleetArmClient GetMockableContainerServiceFleetArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableContainerServiceFleetArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableContainerServiceFleetResourceGroupResource GetMockableContainerServiceFleetResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableContainerServiceFleetResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableContainerServiceFleetSubscriptionResource GetMockableContainerServiceFleetSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableContainerServiceFleetSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ContainerServiceFleetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceFleetResource GetContainerServiceFleetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceFleetResource.ValidateResourceId(id); - return new ContainerServiceFleetResource(client, id); - } - ); + return GetMockableContainerServiceFleetArmClient(client).GetContainerServiceFleetResource(id); } - #endregion - #region ContainerServiceFleetMemberResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceFleetMemberResource GetContainerServiceFleetMemberResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceFleetMemberResource.ValidateResourceId(id); - return new ContainerServiceFleetMemberResource(client, id); - } - ); + return GetMockableContainerServiceFleetArmClient(client).GetContainerServiceFleetMemberResource(id); } - #endregion - #region ContainerServiceFleetUpdateRunResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContainerServiceFleetUpdateRunResource GetContainerServiceFleetUpdateRunResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContainerServiceFleetUpdateRunResource.ValidateResourceId(id); - return new ContainerServiceFleetUpdateRunResource(client, id); - } - ); + return GetMockableContainerServiceFleetArmClient(client).GetContainerServiceFleetUpdateRunResource(id); } - #endregion - #region FleetUpdateStrategyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FleetUpdateStrategyResource GetFleetUpdateStrategyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FleetUpdateStrategyResource.ValidateResourceId(id); - return new FleetUpdateStrategyResource(client, id); - } - ); + return GetMockableContainerServiceFleetArmClient(client).GetFleetUpdateStrategyResource(id); } - #endregion - /// Gets a collection of ContainerServiceFleetResources in the ResourceGroupResource. + /// + /// Gets a collection of ContainerServiceFleetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ContainerServiceFleetResources and their operations over a ContainerServiceFleetResource. public static ContainerServiceFleetCollection GetContainerServiceFleets(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetContainerServiceFleets(); + return GetMockableContainerServiceFleetResourceGroupResource(resourceGroupResource).GetContainerServiceFleets(); } /// @@ -145,16 +124,20 @@ public static ContainerServiceFleetCollection GetContainerServiceFleets(this Res /// Fleets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Fleet resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetContainerServiceFleetAsync(this ResourceGroupResource resourceGroupResource, string fleetName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetContainerServiceFleets().GetAsync(fleetName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerServiceFleetResourceGroupResource(resourceGroupResource).GetContainerServiceFleetAsync(fleetName, cancellationToken).ConfigureAwait(false); } /// @@ -169,16 +152,20 @@ public static async Task> GetContainerSe /// Fleets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Fleet resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetContainerServiceFleet(this ResourceGroupResource resourceGroupResource, string fleetName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetContainerServiceFleets().Get(fleetName, cancellationToken); + return GetMockableContainerServiceFleetResourceGroupResource(resourceGroupResource).GetContainerServiceFleet(fleetName, cancellationToken); } /// @@ -193,13 +180,17 @@ public static Response GetContainerServiceFleet(t /// Fleets_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerServiceFleetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerServiceFleetsAsync(cancellationToken); + return GetMockableContainerServiceFleetSubscriptionResource(subscriptionResource).GetContainerServiceFleetsAsync(cancellationToken); } /// @@ -214,13 +205,17 @@ public static AsyncPageable GetContainerServiceFl /// Fleets_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetContainerServiceFleets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetContainerServiceFleets(cancellationToken); + return GetMockableContainerServiceFleetSubscriptionResource(subscriptionResource).GetContainerServiceFleets(cancellationToken); } } } diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetArmClient.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetArmClient.cs new file mode 100644 index 0000000000000..47239dd45681f --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ContainerServiceFleet; + +namespace Azure.ResourceManager.ContainerServiceFleet.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableContainerServiceFleetArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContainerServiceFleetArmClient() + { + } + + /// 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 MockableContainerServiceFleetArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableContainerServiceFleetArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceFleetResource GetContainerServiceFleetResource(ResourceIdentifier id) + { + ContainerServiceFleetResource.ValidateResourceId(id); + return new ContainerServiceFleetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceFleetMemberResource GetContainerServiceFleetMemberResource(ResourceIdentifier id) + { + ContainerServiceFleetMemberResource.ValidateResourceId(id); + return new ContainerServiceFleetMemberResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerServiceFleetUpdateRunResource GetContainerServiceFleetUpdateRunResource(ResourceIdentifier id) + { + ContainerServiceFleetUpdateRunResource.ValidateResourceId(id); + return new ContainerServiceFleetUpdateRunResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FleetUpdateStrategyResource GetFleetUpdateStrategyResource(ResourceIdentifier id) + { + FleetUpdateStrategyResource.ValidateResourceId(id); + return new FleetUpdateStrategyResource(Client, id); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetResourceGroupResource.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetResourceGroupResource.cs new file mode 100644 index 0000000000000..82cf0a389bbb0 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ContainerServiceFleet; + +namespace Azure.ResourceManager.ContainerServiceFleet.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableContainerServiceFleetResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContainerServiceFleetResourceGroupResource() + { + } + + /// 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 MockableContainerServiceFleetResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ContainerServiceFleetResources in the ResourceGroupResource. + /// An object representing collection of ContainerServiceFleetResources and their operations over a ContainerServiceFleetResource. + public virtual ContainerServiceFleetCollection GetContainerServiceFleets() + { + return GetCachedClient(client => new ContainerServiceFleetCollection(client, Id)); + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerServiceFleetAsync(string fleetName, CancellationToken cancellationToken = default) + { + return await GetContainerServiceFleets().GetAsync(fleetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerServiceFleet(string fleetName, CancellationToken cancellationToken = default) + { + return GetContainerServiceFleets().Get(fleetName, cancellationToken); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetSubscriptionResource.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetSubscriptionResource.cs new file mode 100644 index 0000000000000..aa5e3047bc1c7 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/MockableContainerServiceFleetSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ContainerServiceFleet; + +namespace Azure.ResourceManager.ContainerServiceFleet.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableContainerServiceFleetSubscriptionResource : ArmResource + { + private ClientDiagnostics _containerServiceFleetFleetsClientDiagnostics; + private FleetsRestOperations _containerServiceFleetFleetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableContainerServiceFleetSubscriptionResource() + { + } + + /// 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 MockableContainerServiceFleetSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ContainerServiceFleetFleetsClientDiagnostics => _containerServiceFleetFleetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerServiceFleet", ContainerServiceFleetResource.ResourceType.Namespace, Diagnostics); + private FleetsRestOperations ContainerServiceFleetFleetsRestClient => _containerServiceFleetFleetsRestClient ??= new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerServiceFleetResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerServiceFleetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "MockableContainerServiceFleetSubscriptionResource.GetContainerServiceFleets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerServiceFleets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "MockableContainerServiceFleetSubscriptionResource.GetContainerServiceFleets", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 69e7e4226b64c..0000000000000 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ContainerServiceFleet -{ - /// 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 ContainerServiceFleetResources in the ResourceGroupResource. - /// An object representing collection of ContainerServiceFleetResources and their operations over a ContainerServiceFleetResource. - public virtual ContainerServiceFleetCollection GetContainerServiceFleets() - { - return GetCachedClient(Client => new ContainerServiceFleetCollection(Client, Id)); - } - } -} diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 895769b4d08d9..0000000000000 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ContainerServiceFleet -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _containerServiceFleetFleetsClientDiagnostics; - private FleetsRestOperations _containerServiceFleetFleetsRestClient; - - /// 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 ContainerServiceFleetFleetsClientDiagnostics => _containerServiceFleetFleetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerServiceFleet", ContainerServiceFleetResource.ResourceType.Namespace, Diagnostics); - private FleetsRestOperations ContainerServiceFleetFleetsRestClient => _containerServiceFleetFleetsRestClient ??= new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerServiceFleetResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists fleets in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets - /// - /// - /// Operation Id - /// Fleets_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerServiceFleetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceFleets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists fleets in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets - /// - /// - /// Operation Id - /// Fleets_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerServiceFleets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceFleetFleetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceFleetFleetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceFleetResource(Client, ContainerServiceFleetData.DeserializeContainerServiceFleetData(e)), ContainerServiceFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetContainerServiceFleets", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/FleetUpdateStrategyResource.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/FleetUpdateStrategyResource.cs index 5b1e83cad2050..6899ee33f925e 100644 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/FleetUpdateStrategyResource.cs +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/FleetUpdateStrategyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ContainerServiceFleet public partial class FleetUpdateStrategyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fleetName. + /// The updateStrategyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}"; diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/Azure.ResourceManager.FluidRelay.sln b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/Azure.ResourceManager.FluidRelay.sln index 76284ffb005ea..9b258c847cb28 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/Azure.ResourceManager.FluidRelay.sln +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/Azure.ResourceManager.FluidRelay.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{85FA8590-3324-4532-BE25-88460DFFDFB8}") = "Azure.ResourceManager.FluidRelay", "src\Azure.ResourceManager.FluidRelay.csproj", "{CE7EE737-729B-4A01-9F87-A193D8846026}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.FluidRelay", "src\Azure.ResourceManager.FluidRelay.csproj", "{CE7EE737-729B-4A01-9F87-A193D8846026}" EndProject -Project("{85FA8590-3324-4532-BE25-88460DFFDFB8}") = "Azure.ResourceManager.FluidRelay.Tests", "tests\Azure.ResourceManager.FluidRelay.Tests.csproj", "{6306EC66-056A-4E4D-AE8A-1AE66C6B456B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.FluidRelay.Tests", "tests\Azure.ResourceManager.FluidRelay.Tests.csproj", "{6306EC66-056A-4E4D-AE8A-1AE66C6B456B}" EndProject -Project("{85FA8590-3324-4532-BE25-88460DFFDFB8}") = "Azure.ResourceManager.FluidRelay.Samples", "samples\Azure.ResourceManager.FluidRelay.Samples.csproj", "{835B8B91-897B-4045-8561-48A732584A30}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.FluidRelay.Samples", "samples\Azure.ResourceManager.FluidRelay.Samples.csproj", "{835B8B91-897B-4045-8561-48A732584A30}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {DEA6BBF8-D97D-4480-94A0-ED1D3DCDED2C} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {6306EC66-056A-4E4D-AE8A-1AE66C6B456B}.Release|x64.Build.0 = Release|Any CPU {6306EC66-056A-4E4D-AE8A-1AE66C6B456B}.Release|x86.ActiveCfg = Release|Any CPU {6306EC66-056A-4E4D-AE8A-1AE66C6B456B}.Release|x86.Build.0 = Release|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Debug|x64.ActiveCfg = Debug|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Debug|x64.Build.0 = Debug|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Debug|x86.ActiveCfg = Debug|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Debug|x86.Build.0 = Debug|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Release|Any CPU.Build.0 = Release|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Release|x64.ActiveCfg = Release|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Release|x64.Build.0 = Release|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Release|x86.ActiveCfg = Release|Any CPU + {835B8B91-897B-4045-8561-48A732584A30}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DEA6BBF8-D97D-4480-94A0-ED1D3DCDED2C} EndGlobalSection EndGlobal diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/api/Azure.ResourceManager.FluidRelay.netstandard2.0.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/api/Azure.ResourceManager.FluidRelay.netstandard2.0.cs index 5f49364756e86..cf0fe91835157 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/api/Azure.ResourceManager.FluidRelay.netstandard2.0.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/api/Azure.ResourceManager.FluidRelay.netstandard2.0.cs @@ -65,7 +65,7 @@ protected FluidRelayServerCollection() { } } public partial class FluidRelayServerData : Azure.ResourceManager.Models.TrackedResourceData { - public FluidRelayServerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FluidRelayServerData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.FluidRelay.Models.CmkEncryptionProperties CustomerManagedKeyEncryption { get { throw null; } set { } } public Azure.ResourceManager.FluidRelay.Models.FluidRelayEndpoints FluidRelayEndpoints { get { throw null; } } public System.Guid? FrsTenantId { get { throw null; } } @@ -101,6 +101,28 @@ protected FluidRelayServerResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.FluidRelay.Models.FluidRelayServerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.FluidRelay.Mocking +{ + public partial class MockableFluidRelayArmClient : Azure.ResourceManager.ArmResource + { + protected MockableFluidRelayArmClient() { } + public virtual Azure.ResourceManager.FluidRelay.FluidRelayContainerResource GetFluidRelayContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.FluidRelay.FluidRelayServerResource GetFluidRelayServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableFluidRelayResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableFluidRelayResourceGroupResource() { } + public virtual Azure.Response GetFluidRelayServer(string fluidRelayServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFluidRelayServerAsync(string fluidRelayServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.FluidRelay.FluidRelayServerCollection GetFluidRelayServers() { throw null; } + } + public partial class MockableFluidRelaySubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableFluidRelaySubscriptionResource() { } + public virtual Azure.Pageable GetFluidRelayServers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFluidRelayServersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.FluidRelay.Models { public static partial class ArmFluidRelayModelFactory diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/FluidRelayExtensions.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/FluidRelayExtensions.cs index 343eff2ad9c37..18c67673581c1 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/FluidRelayExtensions.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/FluidRelayExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.FluidRelay.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.FluidRelay @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.FluidRelay /// A class to add extension methods to Azure.ResourceManager.FluidRelay. public static partial class FluidRelayExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableFluidRelayArmClient GetMockableFluidRelayArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableFluidRelayArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableFluidRelayResourceGroupResource GetMockableFluidRelayResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableFluidRelayResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableFluidRelaySubscriptionResource GetMockableFluidRelaySubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableFluidRelaySubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region FluidRelayServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FluidRelayServerResource GetFluidRelayServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FluidRelayServerResource.ValidateResourceId(id); - return new FluidRelayServerResource(client, id); - } - ); + return GetMockableFluidRelayArmClient(client).GetFluidRelayServerResource(id); } - #endregion - #region FluidRelayContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FluidRelayContainerResource GetFluidRelayContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FluidRelayContainerResource.ValidateResourceId(id); - return new FluidRelayContainerResource(client, id); - } - ); + return GetMockableFluidRelayArmClient(client).GetFluidRelayContainerResource(id); } - #endregion - /// Gets a collection of FluidRelayServerResources in the ResourceGroupResource. + /// + /// Gets a collection of FluidRelayServerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of FluidRelayServerResources and their operations over a FluidRelayServerResource. public static FluidRelayServerCollection GetFluidRelayServers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetFluidRelayServers(); + return GetMockableFluidRelayResourceGroupResource(resourceGroupResource).GetFluidRelayServers(); } /// @@ -107,16 +92,20 @@ public static FluidRelayServerCollection GetFluidRelayServers(this ResourceGroup /// FluidRelayServers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Fluid Relay server resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetFluidRelayServerAsync(this ResourceGroupResource resourceGroupResource, string fluidRelayServerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetFluidRelayServers().GetAsync(fluidRelayServerName, cancellationToken).ConfigureAwait(false); + return await GetMockableFluidRelayResourceGroupResource(resourceGroupResource).GetFluidRelayServerAsync(fluidRelayServerName, cancellationToken).ConfigureAwait(false); } /// @@ -131,16 +120,20 @@ public static async Task> GetFluidRelayServer /// FluidRelayServers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Fluid Relay server resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetFluidRelayServer(this ResourceGroupResource resourceGroupResource, string fluidRelayServerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetFluidRelayServers().Get(fluidRelayServerName, cancellationToken); + return GetMockableFluidRelayResourceGroupResource(resourceGroupResource).GetFluidRelayServer(fluidRelayServerName, cancellationToken); } /// @@ -155,13 +148,17 @@ public static Response GetFluidRelayServer(this Resour /// FluidRelayServers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFluidRelayServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFluidRelayServersAsync(cancellationToken); + return GetMockableFluidRelaySubscriptionResource(subscriptionResource).GetFluidRelayServersAsync(cancellationToken); } /// @@ -176,13 +173,17 @@ public static AsyncPageable GetFluidRelayServersAsync( /// FluidRelayServers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFluidRelayServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFluidRelayServers(cancellationToken); + return GetMockableFluidRelaySubscriptionResource(subscriptionResource).GetFluidRelayServers(cancellationToken); } } } diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelayArmClient.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelayArmClient.cs new file mode 100644 index 0000000000000..e7b2c2cef1a39 --- /dev/null +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelayArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.FluidRelay; + +namespace Azure.ResourceManager.FluidRelay.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableFluidRelayArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableFluidRelayArmClient() + { + } + + /// 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 MockableFluidRelayArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableFluidRelayArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FluidRelayServerResource GetFluidRelayServerResource(ResourceIdentifier id) + { + FluidRelayServerResource.ValidateResourceId(id); + return new FluidRelayServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FluidRelayContainerResource GetFluidRelayContainerResource(ResourceIdentifier id) + { + FluidRelayContainerResource.ValidateResourceId(id); + return new FluidRelayContainerResource(Client, id); + } + } +} diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelayResourceGroupResource.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelayResourceGroupResource.cs new file mode 100644 index 0000000000000..57190a55b03c0 --- /dev/null +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelayResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.FluidRelay; + +namespace Azure.ResourceManager.FluidRelay.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableFluidRelayResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableFluidRelayResourceGroupResource() + { + } + + /// 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 MockableFluidRelayResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of FluidRelayServerResources in the ResourceGroupResource. + /// An object representing collection of FluidRelayServerResources and their operations over a FluidRelayServerResource. + public virtual FluidRelayServerCollection GetFluidRelayServers() + { + return GetCachedClient(client => new FluidRelayServerCollection(client, Id)); + } + + /// + /// Get a Fluid Relay server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName} + /// + /// + /// Operation Id + /// FluidRelayServers_Get + /// + /// + /// + /// The Fluid Relay server resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFluidRelayServerAsync(string fluidRelayServerName, CancellationToken cancellationToken = default) + { + return await GetFluidRelayServers().GetAsync(fluidRelayServerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Fluid Relay server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName} + /// + /// + /// Operation Id + /// FluidRelayServers_Get + /// + /// + /// + /// The Fluid Relay server resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFluidRelayServer(string fluidRelayServerName, CancellationToken cancellationToken = default) + { + return GetFluidRelayServers().Get(fluidRelayServerName, cancellationToken); + } + } +} diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelaySubscriptionResource.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelaySubscriptionResource.cs new file mode 100644 index 0000000000000..c8ffb53c9bd1a --- /dev/null +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/MockableFluidRelaySubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.FluidRelay; + +namespace Azure.ResourceManager.FluidRelay.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableFluidRelaySubscriptionResource : ArmResource + { + private ClientDiagnostics _fluidRelayServerClientDiagnostics; + private FluidRelayServersRestOperations _fluidRelayServerRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableFluidRelaySubscriptionResource() + { + } + + /// 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 MockableFluidRelaySubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics FluidRelayServerClientDiagnostics => _fluidRelayServerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FluidRelay", FluidRelayServerResource.ResourceType.Namespace, Diagnostics); + private FluidRelayServersRestOperations FluidRelayServerRestClient => _fluidRelayServerRestClient ??= new FluidRelayServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FluidRelayServerResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all Fluid Relay servers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FluidRelay/fluidRelayServers + /// + /// + /// Operation Id + /// FluidRelayServers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFluidRelayServersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FluidRelayServerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FluidRelayServerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FluidRelayServerResource(Client, FluidRelayServerData.DeserializeFluidRelayServerData(e)), FluidRelayServerClientDiagnostics, Pipeline, "MockableFluidRelaySubscriptionResource.GetFluidRelayServers", "value", "nextLink", cancellationToken); + } + + /// + /// List all Fluid Relay servers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.FluidRelay/fluidRelayServers + /// + /// + /// Operation Id + /// FluidRelayServers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFluidRelayServers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FluidRelayServerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FluidRelayServerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FluidRelayServerResource(Client, FluidRelayServerData.DeserializeFluidRelayServerData(e)), FluidRelayServerClientDiagnostics, Pipeline, "MockableFluidRelaySubscriptionResource.GetFluidRelayServers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 20bea3de437bc..0000000000000 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.FluidRelay -{ - /// 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 FluidRelayServerResources in the ResourceGroupResource. - /// An object representing collection of FluidRelayServerResources and their operations over a FluidRelayServerResource. - public virtual FluidRelayServerCollection GetFluidRelayServers() - { - return GetCachedClient(Client => new FluidRelayServerCollection(Client, Id)); - } - } -} diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 815c8c1ec3321..0000000000000 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.FluidRelay -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _fluidRelayServerClientDiagnostics; - private FluidRelayServersRestOperations _fluidRelayServerRestClient; - - /// 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 FluidRelayServerClientDiagnostics => _fluidRelayServerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FluidRelay", FluidRelayServerResource.ResourceType.Namespace, Diagnostics); - private FluidRelayServersRestOperations FluidRelayServerRestClient => _fluidRelayServerRestClient ??= new FluidRelayServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FluidRelayServerResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all Fluid Relay servers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.FluidRelay/fluidRelayServers - /// - /// - /// Operation Id - /// FluidRelayServers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetFluidRelayServersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FluidRelayServerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FluidRelayServerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FluidRelayServerResource(Client, FluidRelayServerData.DeserializeFluidRelayServerData(e)), FluidRelayServerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFluidRelayServers", "value", "nextLink", cancellationToken); - } - - /// - /// List all Fluid Relay servers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.FluidRelay/fluidRelayServers - /// - /// - /// Operation Id - /// FluidRelayServers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetFluidRelayServers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FluidRelayServerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FluidRelayServerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FluidRelayServerResource(Client, FluidRelayServerData.DeserializeFluidRelayServerData(e)), FluidRelayServerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFluidRelayServers", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayContainerResource.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayContainerResource.cs index 1eed0dd1966c2..943a41aba7bd7 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayContainerResource.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.FluidRelay public partial class FluidRelayContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroup. + /// The fluidRelayServerName. + /// The fluidRelayContainerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroup, string fluidRelayServerName, string fluidRelayContainerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/fluidRelayContainers/{fluidRelayContainerName}"; diff --git a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerResource.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerResource.cs index 388c6d3408e27..e1bc516e402bc 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerResource.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.FluidRelay public partial class FluidRelayServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroup. + /// The fluidRelayServerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroup, string fluidRelayServerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FluidRelayContainerResources and their operations over a FluidRelayContainerResource. public virtual FluidRelayContainerCollection GetFluidRelayContainers() { - return GetCachedClient(Client => new FluidRelayContainerCollection(Client, Id)); + return GetCachedClient(client => new FluidRelayContainerCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual FluidRelayContainerCollection GetFluidRelayContainers() /// /// The Fluid Relay container resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFluidRelayContainerAsync(string fluidRelayContainerName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetFluidRelayCo /// /// The Fluid Relay container resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFluidRelayContainer(string fluidRelayContainerName, CancellationToken cancellationToken = default) { diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/api/Azure.ResourceManager.FrontDoor.netstandard2.0.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/api/Azure.ResourceManager.FrontDoor.netstandard2.0.cs index 00787cafa690a..14dcbb21923be 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/api/Azure.ResourceManager.FrontDoor.netstandard2.0.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/api/Azure.ResourceManager.FrontDoor.netstandard2.0.cs @@ -19,7 +19,7 @@ protected FrontDoorCollection() { } } public partial class FrontDoorData : Azure.ResourceManager.Models.TrackedResourceData { - public FrontDoorData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FrontDoorData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList BackendPools { get { throw null; } } public Azure.ResourceManager.FrontDoor.Models.BackendPoolsSettings BackendPoolsSettings { get { throw null; } set { } } public string Cname { get { throw null; } } @@ -54,7 +54,7 @@ protected FrontDoorExperimentCollection() { } } public partial class FrontDoorExperimentData : Azure.ResourceManager.Models.TrackedResourceData { - public FrontDoorExperimentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FrontDoorExperimentData(Azure.Core.AzureLocation location) { } public string Description { get { throw null; } set { } } public Azure.ResourceManager.FrontDoor.Models.FrontDoorExperimentState? EnabledState { get { throw null; } set { } } public Azure.ResourceManager.FrontDoor.Models.FrontDoorExperimentEndpointProperties ExperimentEndpointA { get { throw null; } set { } } @@ -136,7 +136,7 @@ protected FrontDoorNetworkExperimentProfileCollection() { } } public partial class FrontDoorNetworkExperimentProfileData : Azure.ResourceManager.Models.TrackedResourceData { - public FrontDoorNetworkExperimentProfileData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FrontDoorNetworkExperimentProfileData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.FrontDoor.Models.FrontDoorExperimentState? EnabledState { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.FrontDoor.Models.NetworkExperimentResourceState? ResourceState { get { throw null; } } @@ -252,7 +252,7 @@ protected FrontDoorWebApplicationFirewallPolicyCollection() { } } public partial class FrontDoorWebApplicationFirewallPolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public FrontDoorWebApplicationFirewallPolicyData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FrontDoorWebApplicationFirewallPolicyData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList FrontendEndpointLinks { get { throw null; } } public System.Collections.Generic.IList ManagedRuleSets { get { throw null; } } @@ -326,6 +326,50 @@ protected FrontendEndpointResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.FrontDoor.Mocking +{ + public partial class MockableFrontDoorArmClient : Azure.ResourceManager.ArmResource + { + protected MockableFrontDoorArmClient() { } + public virtual Azure.ResourceManager.FrontDoor.FrontDoorExperimentResource GetFrontDoorExperimentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.FrontDoor.FrontDoorNetworkExperimentProfileResource GetFrontDoorNetworkExperimentProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.FrontDoor.FrontDoorResource GetFrontDoorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.FrontDoor.FrontDoorRulesEngineResource GetFrontDoorRulesEngineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.FrontDoor.FrontDoorWebApplicationFirewallPolicyResource GetFrontDoorWebApplicationFirewallPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.FrontDoor.FrontendEndpointResource GetFrontendEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableFrontDoorResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableFrontDoorResourceGroupResource() { } + public virtual Azure.Response GetFrontDoor(string frontDoorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFrontDoorAsync(string frontDoorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetFrontDoorNetworkExperimentProfile(string profileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFrontDoorNetworkExperimentProfileAsync(string profileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.FrontDoor.FrontDoorNetworkExperimentProfileCollection GetFrontDoorNetworkExperimentProfiles() { throw null; } + public virtual Azure.ResourceManager.FrontDoor.FrontDoorCollection GetFrontDoors() { throw null; } + public virtual Azure.ResourceManager.FrontDoor.FrontDoorWebApplicationFirewallPolicyCollection GetFrontDoorWebApplicationFirewallPolicies() { throw null; } + public virtual Azure.Response GetFrontDoorWebApplicationFirewallPolicy(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFrontDoorWebApplicationFirewallPolicyAsync(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableFrontDoorSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableFrontDoorSubscriptionResource() { } + public virtual Azure.Response CheckFrontDoorNameAvailability(Azure.ResourceManager.FrontDoor.Models.FrontDoorNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckFrontDoorNameAvailabilityAsync(Azure.ResourceManager.FrontDoor.Models.FrontDoorNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetFrontDoorNetworkExperimentProfiles(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFrontDoorNetworkExperimentProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetFrontDoors(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFrontDoorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedRuleSets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedRuleSetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableFrontDoorTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableFrontDoorTenantResource() { } + public virtual Azure.Response CheckFrontDoorNameAvailability(Azure.ResourceManager.FrontDoor.Models.FrontDoorNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckFrontDoorNameAvailabilityAsync(Azure.ResourceManager.FrontDoor.Models.FrontDoorNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.FrontDoor.Models { public static partial class ArmFrontDoorModelFactory @@ -889,7 +933,7 @@ public FrontDoorTimeSeriesDataPoint() { } } public partial class FrontDoorTimeSeriesInfo : Azure.ResourceManager.Models.TrackedResourceData { - public FrontDoorTimeSeriesInfo(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FrontDoorTimeSeriesInfo(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.FrontDoor.Models.FrontDoorTimeSeriesInfoAggregationInterval? AggregationInterval { get { throw null; } set { } } public string Country { get { throw null; } set { } } public System.DateTimeOffset? EndOn { get { throw null; } set { } } @@ -1101,7 +1145,7 @@ public LatencyMetric() { } } public partial class LatencyScorecard : Azure.ResourceManager.Models.TrackedResourceData { - public LatencyScorecard(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LatencyScorecard(Azure.Core.AzureLocation location) { } public string Country { get { throw null; } } public string Description { get { throw null; } } public System.DateTimeOffset? EndOn { get { throw null; } } @@ -1258,7 +1302,7 @@ public ManagedRuleSet(string ruleSetType, string ruleSetVersion) { } } public partial class ManagedRuleSetDefinition : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedRuleSetDefinition(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedRuleSetDefinition(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Collections.Generic.IReadOnlyList RuleGroups { get { throw null; } } public string RuleSetId { get { throw null; } } @@ -1343,7 +1387,7 @@ public ManagedRuleSetDefinition(Azure.Core.AzureLocation location) : base (defau } public partial class PreconfiguredEndpoint : Azure.ResourceManager.Models.TrackedResourceData { - public PreconfiguredEndpoint(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PreconfiguredEndpoint(Azure.Core.AzureLocation location) { } public string Backend { get { throw null; } set { } } public string Description { get { throw null; } set { } } public string Endpoint { get { throw null; } set { } } diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/FrontDoorExtensions.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/FrontDoorExtensions.cs index 55a339a698f21..eb13b3a0aa7f3 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/FrontDoorExtensions.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/FrontDoorExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.FrontDoor.Mocking; using Azure.ResourceManager.FrontDoor.Models; using Azure.ResourceManager.Resources; @@ -19,173 +20,134 @@ namespace Azure.ResourceManager.FrontDoor /// A class to add extension methods to Azure.ResourceManager.FrontDoor. public static partial class FrontDoorExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableFrontDoorArmClient GetMockableFrontDoorArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableFrontDoorArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableFrontDoorResourceGroupResource GetMockableFrontDoorResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableFrontDoorResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableFrontDoorSubscriptionResource GetMockableFrontDoorSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableFrontDoorSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableFrontDoorTenantResource GetMockableFrontDoorTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableFrontDoorTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region FrontDoorWebApplicationFirewallPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorWebApplicationFirewallPolicyResource GetFrontDoorWebApplicationFirewallPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorWebApplicationFirewallPolicyResource.ValidateResourceId(id); - return new FrontDoorWebApplicationFirewallPolicyResource(client, id); - } - ); + return GetMockableFrontDoorArmClient(client).GetFrontDoorWebApplicationFirewallPolicyResource(id); } - #endregion - #region FrontDoorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorResource GetFrontDoorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorResource.ValidateResourceId(id); - return new FrontDoorResource(client, id); - } - ); + return GetMockableFrontDoorArmClient(client).GetFrontDoorResource(id); } - #endregion - #region FrontendEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontendEndpointResource GetFrontendEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontendEndpointResource.ValidateResourceId(id); - return new FrontendEndpointResource(client, id); - } - ); + return GetMockableFrontDoorArmClient(client).GetFrontendEndpointResource(id); } - #endregion - #region FrontDoorRulesEngineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorRulesEngineResource GetFrontDoorRulesEngineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorRulesEngineResource.ValidateResourceId(id); - return new FrontDoorRulesEngineResource(client, id); - } - ); + return GetMockableFrontDoorArmClient(client).GetFrontDoorRulesEngineResource(id); } - #endregion - #region FrontDoorNetworkExperimentProfileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorNetworkExperimentProfileResource GetFrontDoorNetworkExperimentProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorNetworkExperimentProfileResource.ValidateResourceId(id); - return new FrontDoorNetworkExperimentProfileResource(client, id); - } - ); + return GetMockableFrontDoorArmClient(client).GetFrontDoorNetworkExperimentProfileResource(id); } - #endregion - #region FrontDoorExperimentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontDoorExperimentResource GetFrontDoorExperimentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontDoorExperimentResource.ValidateResourceId(id); - return new FrontDoorExperimentResource(client, id); - } - ); + return GetMockableFrontDoorArmClient(client).GetFrontDoorExperimentResource(id); } - #endregion - /// Gets a collection of FrontDoorWebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of FrontDoorWebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of FrontDoorWebApplicationFirewallPolicyResources and their operations over a FrontDoorWebApplicationFirewallPolicyResource. public static FrontDoorWebApplicationFirewallPolicyCollection GetFrontDoorWebApplicationFirewallPolicies(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetFrontDoorWebApplicationFirewallPolicies(); + return GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoorWebApplicationFirewallPolicies(); } /// @@ -200,16 +162,20 @@ public static FrontDoorWebApplicationFirewallPolicyCollection GetFrontDoorWebApp /// Policies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Web Application Firewall Policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetFrontDoorWebApplicationFirewallPolicyAsync(this ResourceGroupResource resourceGroupResource, string policyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetFrontDoorWebApplicationFirewallPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); + return await GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoorWebApplicationFirewallPolicyAsync(policyName, cancellationToken).ConfigureAwait(false); } /// @@ -224,24 +190,34 @@ public static async Task /// Policies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Web Application Firewall Policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetFrontDoorWebApplicationFirewallPolicy(this ResourceGroupResource resourceGroupResource, string policyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetFrontDoorWebApplicationFirewallPolicies().Get(policyName, cancellationToken); + return GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoorWebApplicationFirewallPolicy(policyName, cancellationToken); } - /// Gets a collection of FrontDoorResources in the ResourceGroupResource. + /// + /// Gets a collection of FrontDoorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of FrontDoorResources and their operations over a FrontDoorResource. public static FrontDoorCollection GetFrontDoors(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetFrontDoors(); + return GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoors(); } /// @@ -256,16 +232,20 @@ public static FrontDoorCollection GetFrontDoors(this ResourceGroupResource resou /// FrontDoors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Front Door which is globally unique. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetFrontDoorAsync(this ResourceGroupResource resourceGroupResource, string frontDoorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetFrontDoors().GetAsync(frontDoorName, cancellationToken).ConfigureAwait(false); + return await GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoorAsync(frontDoorName, cancellationToken).ConfigureAwait(false); } /// @@ -280,24 +260,34 @@ public static async Task> GetFrontDoorAsync(this Res /// FrontDoors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Front Door which is globally unique. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetFrontDoor(this ResourceGroupResource resourceGroupResource, string frontDoorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetFrontDoors().Get(frontDoorName, cancellationToken); + return GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoor(frontDoorName, cancellationToken); } - /// Gets a collection of FrontDoorNetworkExperimentProfileResources in the ResourceGroupResource. + /// + /// Gets a collection of FrontDoorNetworkExperimentProfileResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of FrontDoorNetworkExperimentProfileResources and their operations over a FrontDoorNetworkExperimentProfileResource. public static FrontDoorNetworkExperimentProfileCollection GetFrontDoorNetworkExperimentProfiles(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetFrontDoorNetworkExperimentProfiles(); + return GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoorNetworkExperimentProfiles(); } /// @@ -312,16 +302,20 @@ public static FrontDoorNetworkExperimentProfileCollection GetFrontDoorNetworkExp /// NetworkExperimentProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Profile identifier associated with the Tenant and Partner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetFrontDoorNetworkExperimentProfileAsync(this ResourceGroupResource resourceGroupResource, string profileName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetFrontDoorNetworkExperimentProfiles().GetAsync(profileName, cancellationToken).ConfigureAwait(false); + return await GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoorNetworkExperimentProfileAsync(profileName, cancellationToken).ConfigureAwait(false); } /// @@ -336,16 +330,20 @@ public static async Task> Ge /// NetworkExperimentProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Profile identifier associated with the Tenant and Partner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetFrontDoorNetworkExperimentProfile(this ResourceGroupResource resourceGroupResource, string profileName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetFrontDoorNetworkExperimentProfiles().Get(profileName, cancellationToken); + return GetMockableFrontDoorResourceGroupResource(resourceGroupResource).GetFrontDoorNetworkExperimentProfile(profileName, cancellationToken); } /// @@ -360,13 +358,17 @@ public static Response GetFrontDoorNe /// ManagedRuleSets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedRuleSetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedRuleSetsAsync(cancellationToken); + return GetMockableFrontDoorSubscriptionResource(subscriptionResource).GetManagedRuleSetsAsync(cancellationToken); } /// @@ -381,13 +383,17 @@ public static AsyncPageable GetManagedRuleSetsAsync(th /// ManagedRuleSets_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedRuleSets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedRuleSets(cancellationToken); + return GetMockableFrontDoorSubscriptionResource(subscriptionResource).GetManagedRuleSets(cancellationToken); } /// @@ -402,6 +408,10 @@ public static Pageable GetManagedRuleSets(this Subscri /// FrontDoorNameAvailabilityWithSubscription_Check /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -409,9 +419,7 @@ public static Pageable GetManagedRuleSets(this Subscri /// is null. public static async Task> CheckFrontDoorNameAvailabilityAsync(this SubscriptionResource subscriptionResource, FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckFrontDoorNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableFrontDoorSubscriptionResource(subscriptionResource).CheckFrontDoorNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -426,6 +434,10 @@ public static async Task> CheckFrontDo /// FrontDoorNameAvailabilityWithSubscription_Check /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -433,9 +445,7 @@ public static async Task> CheckFrontDo /// is null. public static Response CheckFrontDoorNameAvailability(this SubscriptionResource subscriptionResource, FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckFrontDoorNameAvailability(content, cancellationToken); + return GetMockableFrontDoorSubscriptionResource(subscriptionResource).CheckFrontDoorNameAvailability(content, cancellationToken); } /// @@ -450,13 +460,17 @@ public static Response CheckFrontDoorNameAvaila /// FrontDoors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFrontDoorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFrontDoorsAsync(cancellationToken); + return GetMockableFrontDoorSubscriptionResource(subscriptionResource).GetFrontDoorsAsync(cancellationToken); } /// @@ -471,13 +485,17 @@ public static AsyncPageable GetFrontDoorsAsync(this Subscript /// FrontDoors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFrontDoors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFrontDoors(cancellationToken); + return GetMockableFrontDoorSubscriptionResource(subscriptionResource).GetFrontDoors(cancellationToken); } /// @@ -492,13 +510,17 @@ public static Pageable GetFrontDoors(this SubscriptionResourc /// NetworkExperimentProfiles_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFrontDoorNetworkExperimentProfilesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFrontDoorNetworkExperimentProfilesAsync(cancellationToken); + return GetMockableFrontDoorSubscriptionResource(subscriptionResource).GetFrontDoorNetworkExperimentProfilesAsync(cancellationToken); } /// @@ -513,13 +535,17 @@ public static AsyncPageable GetFrontD /// NetworkExperimentProfiles_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFrontDoorNetworkExperimentProfiles(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFrontDoorNetworkExperimentProfiles(cancellationToken); + return GetMockableFrontDoorSubscriptionResource(subscriptionResource).GetFrontDoorNetworkExperimentProfiles(cancellationToken); } /// @@ -534,6 +560,10 @@ public static Pageable GetFrontDoorNe /// FrontDoorNameAvailability_Check /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -541,9 +571,7 @@ public static Pageable GetFrontDoorNe /// is null. public static async Task> CheckFrontDoorNameAvailabilityAsync(this TenantResource tenantResource, FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).CheckFrontDoorNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableFrontDoorTenantResource(tenantResource).CheckFrontDoorNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -558,6 +586,10 @@ public static async Task> CheckFrontDo /// FrontDoorNameAvailability_Check /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -565,9 +597,7 @@ public static async Task> CheckFrontDo /// is null. public static Response CheckFrontDoorNameAvailability(this TenantResource tenantResource, FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).CheckFrontDoorNameAvailability(content, cancellationToken); + return GetMockableFrontDoorTenantResource(tenantResource).CheckFrontDoorNameAvailability(content, cancellationToken); } } } diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorArmClient.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorArmClient.cs new file mode 100644 index 0000000000000..e58971d4ed757 --- /dev/null +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorArmClient.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.FrontDoor; + +namespace Azure.ResourceManager.FrontDoor.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableFrontDoorArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableFrontDoorArmClient() + { + } + + /// 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 MockableFrontDoorArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableFrontDoorArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorWebApplicationFirewallPolicyResource GetFrontDoorWebApplicationFirewallPolicyResource(ResourceIdentifier id) + { + FrontDoorWebApplicationFirewallPolicyResource.ValidateResourceId(id); + return new FrontDoorWebApplicationFirewallPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorResource GetFrontDoorResource(ResourceIdentifier id) + { + FrontDoorResource.ValidateResourceId(id); + return new FrontDoorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontendEndpointResource GetFrontendEndpointResource(ResourceIdentifier id) + { + FrontendEndpointResource.ValidateResourceId(id); + return new FrontendEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorRulesEngineResource GetFrontDoorRulesEngineResource(ResourceIdentifier id) + { + FrontDoorRulesEngineResource.ValidateResourceId(id); + return new FrontDoorRulesEngineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorNetworkExperimentProfileResource GetFrontDoorNetworkExperimentProfileResource(ResourceIdentifier id) + { + FrontDoorNetworkExperimentProfileResource.ValidateResourceId(id); + return new FrontDoorNetworkExperimentProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontDoorExperimentResource GetFrontDoorExperimentResource(ResourceIdentifier id) + { + FrontDoorExperimentResource.ValidateResourceId(id); + return new FrontDoorExperimentResource(Client, id); + } + } +} diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorResourceGroupResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorResourceGroupResource.cs new file mode 100644 index 0000000000000..7da432f4f46a4 --- /dev/null +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorResourceGroupResource.cs @@ -0,0 +1,198 @@ +// 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.FrontDoor; + +namespace Azure.ResourceManager.FrontDoor.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableFrontDoorResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableFrontDoorResourceGroupResource() + { + } + + /// 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 MockableFrontDoorResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of FrontDoorWebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// An object representing collection of FrontDoorWebApplicationFirewallPolicyResources and their operations over a FrontDoorWebApplicationFirewallPolicyResource. + public virtual FrontDoorWebApplicationFirewallPolicyCollection GetFrontDoorWebApplicationFirewallPolicies() + { + return GetCachedClient(client => new FrontDoorWebApplicationFirewallPolicyCollection(client, Id)); + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the Web Application Firewall Policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFrontDoorWebApplicationFirewallPolicyAsync(string policyName, CancellationToken cancellationToken = default) + { + return await GetFrontDoorWebApplicationFirewallPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// Policies_Get + /// + /// + /// + /// The name of the Web Application Firewall Policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFrontDoorWebApplicationFirewallPolicy(string policyName, CancellationToken cancellationToken = default) + { + return GetFrontDoorWebApplicationFirewallPolicies().Get(policyName, cancellationToken); + } + + /// Gets a collection of FrontDoorResources in the ResourceGroupResource. + /// An object representing collection of FrontDoorResources and their operations over a FrontDoorResource. + public virtual FrontDoorCollection GetFrontDoors() + { + return GetCachedClient(client => new FrontDoorCollection(client, Id)); + } + + /// + /// Gets a Front Door with the specified Front Door name under the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName} + /// + /// + /// Operation Id + /// FrontDoors_Get + /// + /// + /// + /// Name of the Front Door which is globally unique. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFrontDoorAsync(string frontDoorName, CancellationToken cancellationToken = default) + { + return await GetFrontDoors().GetAsync(frontDoorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Front Door with the specified Front Door name under the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName} + /// + /// + /// Operation Id + /// FrontDoors_Get + /// + /// + /// + /// Name of the Front Door which is globally unique. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFrontDoor(string frontDoorName, CancellationToken cancellationToken = default) + { + return GetFrontDoors().Get(frontDoorName, cancellationToken); + } + + /// Gets a collection of FrontDoorNetworkExperimentProfileResources in the ResourceGroupResource. + /// An object representing collection of FrontDoorNetworkExperimentProfileResources and their operations over a FrontDoorNetworkExperimentProfileResource. + public virtual FrontDoorNetworkExperimentProfileCollection GetFrontDoorNetworkExperimentProfiles() + { + return GetCachedClient(client => new FrontDoorNetworkExperimentProfileCollection(client, Id)); + } + + /// + /// Gets an NetworkExperiment Profile by ProfileName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName} + /// + /// + /// Operation Id + /// NetworkExperimentProfiles_Get + /// + /// + /// + /// The Profile identifier associated with the Tenant and Partner. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFrontDoorNetworkExperimentProfileAsync(string profileName, CancellationToken cancellationToken = default) + { + return await GetFrontDoorNetworkExperimentProfiles().GetAsync(profileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an NetworkExperiment Profile by ProfileName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName} + /// + /// + /// Operation Id + /// NetworkExperimentProfiles_Get + /// + /// + /// + /// The Profile identifier associated with the Tenant and Partner. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFrontDoorNetworkExperimentProfile(string profileName, CancellationToken cancellationToken = default) + { + return GetFrontDoorNetworkExperimentProfiles().Get(profileName, cancellationToken); + } + } +} diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorSubscriptionResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorSubscriptionResource.cs new file mode 100644 index 0000000000000..02c8a89d95a45 --- /dev/null +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorSubscriptionResource.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.FrontDoor; +using Azure.ResourceManager.FrontDoor.Models; + +namespace Azure.ResourceManager.FrontDoor.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableFrontDoorSubscriptionResource : ArmResource + { + private ClientDiagnostics _managedRuleSetsClientDiagnostics; + private ManagedRuleSetsRestOperations _managedRuleSetsRestClient; + private ClientDiagnostics _frontDoorNameAvailabilityWithSubscriptionClientDiagnostics; + private FrontDoorNameAvailabilityWithSubscriptionRestOperations _frontDoorNameAvailabilityWithSubscriptionRestClient; + private ClientDiagnostics _frontDoorClientDiagnostics; + private FrontDoorsRestOperations _frontDoorRestClient; + private ClientDiagnostics _frontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics; + private NetworkExperimentProfilesRestOperations _frontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableFrontDoorSubscriptionResource() + { + } + + /// 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 MockableFrontDoorSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ManagedRuleSetsClientDiagnostics => _managedRuleSetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ManagedRuleSetsRestOperations ManagedRuleSetsRestClient => _managedRuleSetsRestClient ??= new ManagedRuleSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics FrontDoorNameAvailabilityWithSubscriptionClientDiagnostics => _frontDoorNameAvailabilityWithSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private FrontDoorNameAvailabilityWithSubscriptionRestOperations FrontDoorNameAvailabilityWithSubscriptionRestClient => _frontDoorNameAvailabilityWithSubscriptionRestClient ??= new FrontDoorNameAvailabilityWithSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics FrontDoorClientDiagnostics => _frontDoorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", FrontDoorResource.ResourceType.Namespace, Diagnostics); + private FrontDoorsRestOperations FrontDoorRestClient => _frontDoorRestClient ??= new FrontDoorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FrontDoorResource.ResourceType)); + private ClientDiagnostics FrontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics => _frontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", FrontDoorNetworkExperimentProfileResource.ResourceType.Namespace, Diagnostics); + private NetworkExperimentProfilesRestOperations FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient => _frontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient ??= new NetworkExperimentProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FrontDoorNetworkExperimentProfileResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all available managed rule sets. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallManagedRuleSets + /// + /// + /// Operation Id + /// ManagedRuleSets_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedRuleSetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedRuleSetsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedRuleSetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedRuleSetDefinition.DeserializeManagedRuleSetDefinition, ManagedRuleSetsClientDiagnostics, Pipeline, "MockableFrontDoorSubscriptionResource.GetManagedRuleSets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all available managed rule sets. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallManagedRuleSets + /// + /// + /// Operation Id + /// ManagedRuleSets_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedRuleSets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedRuleSetsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedRuleSetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedRuleSetDefinition.DeserializeManagedRuleSetDefinition, ManagedRuleSetsClientDiagnostics, Pipeline, "MockableFrontDoorSubscriptionResource.GetManagedRuleSets", "value", "nextLink", cancellationToken); + } + + /// + /// Check the availability of a Front Door subdomain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability + /// + /// + /// Operation Id + /// FrontDoorNameAvailabilityWithSubscription_Check + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckFrontDoorNameAvailabilityAsync(FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = FrontDoorNameAvailabilityWithSubscriptionClientDiagnostics.CreateScope("MockableFrontDoorSubscriptionResource.CheckFrontDoorNameAvailability"); + scope.Start(); + try + { + var response = await FrontDoorNameAvailabilityWithSubscriptionRestClient.CheckAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of a Front Door subdomain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability + /// + /// + /// Operation Id + /// FrontDoorNameAvailabilityWithSubscription_Check + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckFrontDoorNameAvailability(FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = FrontDoorNameAvailabilityWithSubscriptionClientDiagnostics.CreateScope("MockableFrontDoorSubscriptionResource.CheckFrontDoorNameAvailability"); + scope.Start(); + try + { + var response = FrontDoorNameAvailabilityWithSubscriptionRestClient.Check(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all of the Front Doors within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors + /// + /// + /// Operation Id + /// FrontDoors_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFrontDoorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FrontDoorRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FrontDoorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorResource(Client, FrontDoorData.DeserializeFrontDoorData(e)), FrontDoorClientDiagnostics, Pipeline, "MockableFrontDoorSubscriptionResource.GetFrontDoors", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the Front Doors within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors + /// + /// + /// Operation Id + /// FrontDoors_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFrontDoors(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FrontDoorRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FrontDoorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorResource(Client, FrontDoorData.DeserializeFrontDoorData(e)), FrontDoorClientDiagnostics, Pipeline, "MockableFrontDoorSubscriptionResource.GetFrontDoors", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of Network Experiment Profiles under a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles + /// + /// + /// Operation Id + /// NetworkExperimentProfiles_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFrontDoorNetworkExperimentProfilesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorNetworkExperimentProfileResource(Client, FrontDoorNetworkExperimentProfileData.DeserializeFrontDoorNetworkExperimentProfileData(e)), FrontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics, Pipeline, "MockableFrontDoorSubscriptionResource.GetFrontDoorNetworkExperimentProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of Network Experiment Profiles under a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles + /// + /// + /// Operation Id + /// NetworkExperimentProfiles_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFrontDoorNetworkExperimentProfiles(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorNetworkExperimentProfileResource(Client, FrontDoorNetworkExperimentProfileData.DeserializeFrontDoorNetworkExperimentProfileData(e)), FrontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics, Pipeline, "MockableFrontDoorSubscriptionResource.GetFrontDoorNetworkExperimentProfiles", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorTenantResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorTenantResource.cs new file mode 100644 index 0000000000000..5838d6fd45ac5 --- /dev/null +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/MockableFrontDoorTenantResource.cs @@ -0,0 +1,115 @@ +// 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; +using Azure.ResourceManager.FrontDoor; +using Azure.ResourceManager.FrontDoor.Models; + +namespace Azure.ResourceManager.FrontDoor.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableFrontDoorTenantResource : ArmResource + { + private ClientDiagnostics _frontDoorNameAvailabilityClientDiagnostics; + private FrontDoorNameAvailabilityRestOperations _frontDoorNameAvailabilityRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableFrontDoorTenantResource() + { + } + + /// 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 MockableFrontDoorTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics FrontDoorNameAvailabilityClientDiagnostics => _frontDoorNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private FrontDoorNameAvailabilityRestOperations FrontDoorNameAvailabilityRestClient => _frontDoorNameAvailabilityRestClient ??= new FrontDoorNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Check the availability of a Front Door resource name. + /// + /// + /// Request Path + /// /providers/Microsoft.Network/checkFrontDoorNameAvailability + /// + /// + /// Operation Id + /// FrontDoorNameAvailability_Check + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckFrontDoorNameAvailabilityAsync(FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = FrontDoorNameAvailabilityClientDiagnostics.CreateScope("MockableFrontDoorTenantResource.CheckFrontDoorNameAvailability"); + scope.Start(); + try + { + var response = await FrontDoorNameAvailabilityRestClient.CheckAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of a Front Door resource name. + /// + /// + /// Request Path + /// /providers/Microsoft.Network/checkFrontDoorNameAvailability + /// + /// + /// Operation Id + /// FrontDoorNameAvailability_Check + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckFrontDoorNameAvailability(FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = FrontDoorNameAvailabilityClientDiagnostics.CreateScope("MockableFrontDoorTenantResource.CheckFrontDoorNameAvailability"); + scope.Start(); + try + { + var response = FrontDoorNameAvailabilityRestClient.Check(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 85164d777de29..0000000000000 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.FrontDoor -{ - /// 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 FrontDoorWebApplicationFirewallPolicyResources in the ResourceGroupResource. - /// An object representing collection of FrontDoorWebApplicationFirewallPolicyResources and their operations over a FrontDoorWebApplicationFirewallPolicyResource. - public virtual FrontDoorWebApplicationFirewallPolicyCollection GetFrontDoorWebApplicationFirewallPolicies() - { - return GetCachedClient(Client => new FrontDoorWebApplicationFirewallPolicyCollection(Client, Id)); - } - - /// Gets a collection of FrontDoorResources in the ResourceGroupResource. - /// An object representing collection of FrontDoorResources and their operations over a FrontDoorResource. - public virtual FrontDoorCollection GetFrontDoors() - { - return GetCachedClient(Client => new FrontDoorCollection(Client, Id)); - } - - /// Gets a collection of FrontDoorNetworkExperimentProfileResources in the ResourceGroupResource. - /// An object representing collection of FrontDoorNetworkExperimentProfileResources and their operations over a FrontDoorNetworkExperimentProfileResource. - public virtual FrontDoorNetworkExperimentProfileCollection GetFrontDoorNetworkExperimentProfiles() - { - return GetCachedClient(Client => new FrontDoorNetworkExperimentProfileCollection(Client, Id)); - } - } -} diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index c23042d4004d1..0000000000000 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.FrontDoor.Models; - -namespace Azure.ResourceManager.FrontDoor -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _managedRuleSetsClientDiagnostics; - private ManagedRuleSetsRestOperations _managedRuleSetsRestClient; - private ClientDiagnostics _frontDoorNameAvailabilityWithSubscriptionClientDiagnostics; - private FrontDoorNameAvailabilityWithSubscriptionRestOperations _frontDoorNameAvailabilityWithSubscriptionRestClient; - private ClientDiagnostics _frontDoorClientDiagnostics; - private FrontDoorsRestOperations _frontDoorRestClient; - private ClientDiagnostics _frontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics; - private NetworkExperimentProfilesRestOperations _frontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient; - - /// 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 ManagedRuleSetsClientDiagnostics => _managedRuleSetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ManagedRuleSetsRestOperations ManagedRuleSetsRestClient => _managedRuleSetsRestClient ??= new ManagedRuleSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics FrontDoorNameAvailabilityWithSubscriptionClientDiagnostics => _frontDoorNameAvailabilityWithSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private FrontDoorNameAvailabilityWithSubscriptionRestOperations FrontDoorNameAvailabilityWithSubscriptionRestClient => _frontDoorNameAvailabilityWithSubscriptionRestClient ??= new FrontDoorNameAvailabilityWithSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics FrontDoorClientDiagnostics => _frontDoorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", FrontDoorResource.ResourceType.Namespace, Diagnostics); - private FrontDoorsRestOperations FrontDoorRestClient => _frontDoorRestClient ??= new FrontDoorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FrontDoorResource.ResourceType)); - private ClientDiagnostics FrontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics => _frontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", FrontDoorNetworkExperimentProfileResource.ResourceType.Namespace, Diagnostics); - private NetworkExperimentProfilesRestOperations FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient => _frontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient ??= new NetworkExperimentProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FrontDoorNetworkExperimentProfileResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all available managed rule sets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallManagedRuleSets - /// - /// - /// Operation Id - /// ManagedRuleSets_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedRuleSetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedRuleSetsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedRuleSetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedRuleSetDefinition.DeserializeManagedRuleSetDefinition, ManagedRuleSetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedRuleSets", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all available managed rule sets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallManagedRuleSets - /// - /// - /// Operation Id - /// ManagedRuleSets_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedRuleSets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedRuleSetsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedRuleSetsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedRuleSetDefinition.DeserializeManagedRuleSetDefinition, ManagedRuleSetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedRuleSets", "value", "nextLink", cancellationToken); - } - - /// - /// Check the availability of a Front Door subdomain. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability - /// - /// - /// Operation Id - /// FrontDoorNameAvailabilityWithSubscription_Check - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual async Task> CheckFrontDoorNameAvailabilityAsync(FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = FrontDoorNameAvailabilityWithSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckFrontDoorNameAvailability"); - scope.Start(); - try - { - var response = await FrontDoorNameAvailabilityWithSubscriptionRestClient.CheckAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of a Front Door subdomain. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/checkFrontDoorNameAvailability - /// - /// - /// Operation Id - /// FrontDoorNameAvailabilityWithSubscription_Check - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual Response CheckFrontDoorNameAvailability(FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = FrontDoorNameAvailabilityWithSubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckFrontDoorNameAvailability"); - scope.Start(); - try - { - var response = FrontDoorNameAvailabilityWithSubscriptionRestClient.Check(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all of the Front Doors within an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors - /// - /// - /// Operation Id - /// FrontDoors_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetFrontDoorsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FrontDoorRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FrontDoorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorResource(Client, FrontDoorData.DeserializeFrontDoorData(e)), FrontDoorClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFrontDoors", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the Front Doors within an Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/frontDoors - /// - /// - /// Operation Id - /// FrontDoors_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetFrontDoors(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FrontDoorRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FrontDoorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorResource(Client, FrontDoorData.DeserializeFrontDoorData(e)), FrontDoorClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFrontDoors", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of Network Experiment Profiles under a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles - /// - /// - /// Operation Id - /// NetworkExperimentProfiles_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetFrontDoorNetworkExperimentProfilesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FrontDoorNetworkExperimentProfileResource(Client, FrontDoorNetworkExperimentProfileData.DeserializeFrontDoorNetworkExperimentProfileData(e)), FrontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFrontDoorNetworkExperimentProfiles", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of Network Experiment Profiles under a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/NetworkExperimentProfiles - /// - /// - /// Operation Id - /// NetworkExperimentProfiles_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetFrontDoorNetworkExperimentProfiles(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FrontDoorNetworkExperimentProfileNetworkExperimentProfilesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FrontDoorNetworkExperimentProfileResource(Client, FrontDoorNetworkExperimentProfileData.DeserializeFrontDoorNetworkExperimentProfileData(e)), FrontDoorNetworkExperimentProfileNetworkExperimentProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFrontDoorNetworkExperimentProfiles", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 4d394d2830009..0000000000000 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,108 +0,0 @@ -// 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; -using Azure.ResourceManager.FrontDoor.Models; - -namespace Azure.ResourceManager.FrontDoor -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _frontDoorNameAvailabilityClientDiagnostics; - private FrontDoorNameAvailabilityRestOperations _frontDoorNameAvailabilityRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics FrontDoorNameAvailabilityClientDiagnostics => _frontDoorNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.FrontDoor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private FrontDoorNameAvailabilityRestOperations FrontDoorNameAvailabilityRestClient => _frontDoorNameAvailabilityRestClient ??= new FrontDoorNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Check the availability of a Front Door resource name. - /// - /// - /// Request Path - /// /providers/Microsoft.Network/checkFrontDoorNameAvailability - /// - /// - /// Operation Id - /// FrontDoorNameAvailability_Check - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual async Task> CheckFrontDoorNameAvailabilityAsync(FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = FrontDoorNameAvailabilityClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckFrontDoorNameAvailability"); - scope.Start(); - try - { - var response = await FrontDoorNameAvailabilityRestClient.CheckAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of a Front Door resource name. - /// - /// - /// Request Path - /// /providers/Microsoft.Network/checkFrontDoorNameAvailability - /// - /// - /// Operation Id - /// FrontDoorNameAvailability_Check - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual Response CheckFrontDoorNameAvailability(FrontDoorNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = FrontDoorNameAvailabilityClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckFrontDoorNameAvailability"); - scope.Start(); - try - { - var response = FrontDoorNameAvailabilityRestClient.Check(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorExperimentResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorExperimentResource.cs index 84e698c46d050..6f7f59f52b147 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorExperimentResource.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorExperimentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.FrontDoor public partial class FrontDoorExperimentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The experimentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string experimentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}/Experiments/{experimentName}"; diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileResource.cs index 533de717be63b..b88a3b6eaf452 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileResource.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.FrontDoor public partial class FrontDoorNetworkExperimentProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/NetworkExperimentProfiles/{profileName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FrontDoorExperimentResources and their operations over a FrontDoorExperimentResource. public virtual FrontDoorExperimentCollection GetFrontDoorExperiments() { - return GetCachedClient(Client => new FrontDoorExperimentCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorExperimentCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual FrontDoorExperimentCollection GetFrontDoorExperiments() /// /// The Experiment identifier associated with the Experiment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorExperimentAsync(string experimentName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetFrontDoorExp /// /// The Experiment identifier associated with the Experiment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorExperiment(string experimentName, CancellationToken cancellationToken = default) { diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorResource.cs index f7a96247f987e..f36bcffb28530 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorResource.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.FrontDoor public partial class FrontDoorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The frontDoorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string frontDoorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}"; @@ -97,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FrontendEndpointResources and their operations over a FrontendEndpointResource. public virtual FrontendEndpointCollection GetFrontendEndpoints() { - return GetCachedClient(Client => new FrontendEndpointCollection(Client, Id)); + return GetCachedClient(client => new FrontendEndpointCollection(client, Id)); } /// @@ -115,8 +118,8 @@ public virtual FrontendEndpointCollection GetFrontendEndpoints() /// /// Name of the Frontend endpoint which is unique within the Front Door. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontendEndpointAsync(string frontendEndpointName, CancellationToken cancellationToken = default) { @@ -138,8 +141,8 @@ public virtual async Task> GetFrontendEndpoin /// /// Name of the Frontend endpoint which is unique within the Front Door. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontendEndpoint(string frontendEndpointName, CancellationToken cancellationToken = default) { @@ -150,7 +153,7 @@ public virtual Response GetFrontendEndpoint(string fro /// An object representing collection of FrontDoorRulesEngineResources and their operations over a FrontDoorRulesEngineResource. public virtual FrontDoorRulesEngineCollection GetFrontDoorRulesEngines() { - return GetCachedClient(Client => new FrontDoorRulesEngineCollection(Client, Id)); + return GetCachedClient(client => new FrontDoorRulesEngineCollection(client, Id)); } /// @@ -168,8 +171,8 @@ public virtual FrontDoorRulesEngineCollection GetFrontDoorRulesEngines() /// /// Name of the Rules Engine which is unique within the Front Door. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontDoorRulesEngineAsync(string rulesEngineName, CancellationToken cancellationToken = default) { @@ -191,8 +194,8 @@ public virtual async Task> GetFrontDoorRu /// /// Name of the Rules Engine which is unique within the Front Door. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontDoorRulesEngine(string rulesEngineName, CancellationToken cancellationToken = default) { diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorRulesEngineResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorRulesEngineResource.cs index 0e9065e8294df..47c6a22b00898 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorRulesEngineResource.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorRulesEngineResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.FrontDoor public partial class FrontDoorRulesEngineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The frontDoorName. + /// The rulesEngineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string frontDoorName, string rulesEngineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/rulesEngines/{rulesEngineName}"; diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorWebApplicationFirewallPolicyResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorWebApplicationFirewallPolicyResource.cs index 9033decfd759d..47ab9903615c4 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorWebApplicationFirewallPolicyResource.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorWebApplicationFirewallPolicyResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.FrontDoor public partial class FrontDoorWebApplicationFirewallPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/{policyName}"; diff --git a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontendEndpointResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontendEndpointResource.cs index 98e9345576630..9706d345a59a6 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontendEndpointResource.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontendEndpointResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.FrontDoor public partial class FrontendEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The frontDoorName. + /// The frontendEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string frontDoorName, string frontendEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}"; diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/Azure.ResourceManager.Grafana.sln b/sdk/grafana/Azure.ResourceManager.Grafana/Azure.ResourceManager.Grafana.sln index 876ee2a1bb6b5..85824b79f4ba0 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/Azure.ResourceManager.Grafana.sln +++ b/sdk/grafana/Azure.ResourceManager.Grafana/Azure.ResourceManager.Grafana.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FE15514E-D88F-4989-BA4B-7E8650FAE0E3}") = "Azure.ResourceManager.Grafana", "src\Azure.ResourceManager.Grafana.csproj", "{FB8B9D7A-0574-48A7-ADB2-F4C97A554C26}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Grafana", "src\Azure.ResourceManager.Grafana.csproj", "{FB8B9D7A-0574-48A7-ADB2-F4C97A554C26}" EndProject -Project("{FE15514E-D88F-4989-BA4B-7E8650FAE0E3}") = "Azure.ResourceManager.Grafana.Tests", "tests\Azure.ResourceManager.Grafana.Tests.csproj", "{B930A63B-F1E7-4424-B295-F615A49C754C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Grafana.Tests", "tests\Azure.ResourceManager.Grafana.Tests.csproj", "{B930A63B-F1E7-4424-B295-F615A49C754C}" EndProject -Project("{FE15514E-D88F-4989-BA4B-7E8650FAE0E3}") = "Azure.ResourceManager.Grafana.Samples", "samples\Azure.ResourceManager.Grafana.Samples.csproj", "{e77ba930-4a0d-49b4-9b81-2e35fc19bcbb}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Grafana.Samples", "samples\Azure.ResourceManager.Grafana.Samples.csproj", "{E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B89FA2D4-0D27-4198-9A0A-DAD16B31621F} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {B930A63B-F1E7-4424-B295-F615A49C754C}.Release|x64.Build.0 = Release|Any CPU {B930A63B-F1E7-4424-B295-F615A49C754C}.Release|x86.ActiveCfg = Release|Any CPU {B930A63B-F1E7-4424-B295-F615A49C754C}.Release|x86.Build.0 = Release|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Debug|x64.ActiveCfg = Debug|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Debug|x64.Build.0 = Debug|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Debug|x86.ActiveCfg = Debug|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Debug|x86.Build.0 = Debug|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Release|Any CPU.Build.0 = Release|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Release|x64.ActiveCfg = Release|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Release|x64.Build.0 = Release|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Release|x86.ActiveCfg = Release|Any CPU + {E77BA930-4A0D-49B4-9B81-2E35FC19BCBB}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B89FA2D4-0D27-4198-9A0A-DAD16B31621F} EndGlobalSection EndGlobal diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/api/Azure.ResourceManager.Grafana.netstandard2.0.cs b/sdk/grafana/Azure.ResourceManager.Grafana/api/Azure.ResourceManager.Grafana.netstandard2.0.cs index cad659b2fbe99..ec33471f9cb8f 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/api/Azure.ResourceManager.Grafana.netstandard2.0.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/api/Azure.ResourceManager.Grafana.netstandard2.0.cs @@ -102,7 +102,7 @@ protected ManagedGrafanaCollection() { } } public partial class ManagedGrafanaData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedGrafanaData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedGrafanaData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Grafana.Models.ManagedGrafanaProperties Properties { get { throw null; } set { } } public string SkuName { get { throw null; } set { } } @@ -134,6 +134,29 @@ protected ManagedGrafanaResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Grafana.Models.ManagedGrafanaPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Grafana.Mocking +{ + public partial class MockableGrafanaArmClient : Azure.ResourceManager.ArmResource + { + protected MockableGrafanaArmClient() { } + public virtual Azure.ResourceManager.Grafana.GrafanaPrivateEndpointConnectionResource GetGrafanaPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Grafana.GrafanaPrivateLinkResource GetGrafanaPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Grafana.ManagedGrafanaResource GetManagedGrafanaResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableGrafanaResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableGrafanaResourceGroupResource() { } + public virtual Azure.Response GetManagedGrafana(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedGrafanaAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Grafana.ManagedGrafanaCollection GetManagedGrafanas() { throw null; } + } + public partial class MockableGrafanaSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableGrafanaSubscriptionResource() { } + public virtual Azure.Pageable GetManagedGrafanas(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedGrafanasAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Grafana.Models { public static partial class ArmGrafanaModelFactory diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/GrafanaExtensions.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/GrafanaExtensions.cs index 31bbc71412cff..08886ca0886d2 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/GrafanaExtensions.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/GrafanaExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Grafana.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Grafana @@ -18,100 +19,81 @@ namespace Azure.ResourceManager.Grafana /// A class to add extension methods to Azure.ResourceManager.Grafana. public static partial class GrafanaExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableGrafanaArmClient GetMockableGrafanaArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableGrafanaArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableGrafanaResourceGroupResource GetMockableGrafanaResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableGrafanaResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableGrafanaSubscriptionResource GetMockableGrafanaSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableGrafanaSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ManagedGrafanaResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedGrafanaResource GetManagedGrafanaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedGrafanaResource.ValidateResourceId(id); - return new ManagedGrafanaResource(client, id); - } - ); + return GetMockableGrafanaArmClient(client).GetManagedGrafanaResource(id); } - #endregion - #region GrafanaPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GrafanaPrivateEndpointConnectionResource GetGrafanaPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GrafanaPrivateEndpointConnectionResource.ValidateResourceId(id); - return new GrafanaPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableGrafanaArmClient(client).GetGrafanaPrivateEndpointConnectionResource(id); } - #endregion - #region GrafanaPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GrafanaPrivateLinkResource GetGrafanaPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GrafanaPrivateLinkResource.ValidateResourceId(id); - return new GrafanaPrivateLinkResource(client, id); - } - ); + return GetMockableGrafanaArmClient(client).GetGrafanaPrivateLinkResource(id); } - #endregion - /// Gets a collection of ManagedGrafanaResources in the ResourceGroupResource. + /// + /// Gets a collection of ManagedGrafanaResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ManagedGrafanaResources and their operations over a ManagedGrafanaResource. public static ManagedGrafanaCollection GetManagedGrafanas(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetManagedGrafanas(); + return GetMockableGrafanaResourceGroupResource(resourceGroupResource).GetManagedGrafanas(); } /// @@ -126,16 +108,20 @@ public static ManagedGrafanaCollection GetManagedGrafanas(this ResourceGroupReso /// Grafana_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The workspace name of Azure Managed Grafana. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedGrafanaAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetManagedGrafanas().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableGrafanaResourceGroupResource(resourceGroupResource).GetManagedGrafanaAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -150,16 +136,20 @@ public static async Task> GetManagedGrafanaAsyn /// Grafana_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The workspace name of Azure Managed Grafana. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedGrafana(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetManagedGrafanas().Get(workspaceName, cancellationToken); + return GetMockableGrafanaResourceGroupResource(resourceGroupResource).GetManagedGrafana(workspaceName, cancellationToken); } /// @@ -174,13 +164,17 @@ public static Response GetManagedGrafana(this ResourceGr /// Grafana_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedGrafanasAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedGrafanasAsync(cancellationToken); + return GetMockableGrafanaSubscriptionResource(subscriptionResource).GetManagedGrafanasAsync(cancellationToken); } /// @@ -195,13 +189,17 @@ public static AsyncPageable GetManagedGrafanasAsync(this /// Grafana_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetManagedGrafanas(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedGrafanas(cancellationToken); + return GetMockableGrafanaSubscriptionResource(subscriptionResource).GetManagedGrafanas(cancellationToken); } } } diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaArmClient.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaArmClient.cs new file mode 100644 index 0000000000000..0be27c34b2435 --- /dev/null +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Grafana; + +namespace Azure.ResourceManager.Grafana.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableGrafanaArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableGrafanaArmClient() + { + } + + /// 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 MockableGrafanaArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableGrafanaArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedGrafanaResource GetManagedGrafanaResource(ResourceIdentifier id) + { + ManagedGrafanaResource.ValidateResourceId(id); + return new ManagedGrafanaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GrafanaPrivateEndpointConnectionResource GetGrafanaPrivateEndpointConnectionResource(ResourceIdentifier id) + { + GrafanaPrivateEndpointConnectionResource.ValidateResourceId(id); + return new GrafanaPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GrafanaPrivateLinkResource GetGrafanaPrivateLinkResource(ResourceIdentifier id) + { + GrafanaPrivateLinkResource.ValidateResourceId(id); + return new GrafanaPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaResourceGroupResource.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaResourceGroupResource.cs new file mode 100644 index 0000000000000..3d3181db3b486 --- /dev/null +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Grafana; + +namespace Azure.ResourceManager.Grafana.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableGrafanaResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableGrafanaResourceGroupResource() + { + } + + /// 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 MockableGrafanaResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ManagedGrafanaResources in the ResourceGroupResource. + /// An object representing collection of ManagedGrafanaResources and their operations over a ManagedGrafanaResource. + public virtual ManagedGrafanaCollection GetManagedGrafanas() + { + return GetCachedClient(client => new ManagedGrafanaCollection(client, Id)); + } + + /// + /// Get the properties of a specific workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedGrafanaAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetManagedGrafanas().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a specific workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedGrafana(string workspaceName, CancellationToken cancellationToken = default) + { + return GetManagedGrafanas().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaSubscriptionResource.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaSubscriptionResource.cs new file mode 100644 index 0000000000000..dbc37d23f8881 --- /dev/null +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/MockableGrafanaSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Grafana; + +namespace Azure.ResourceManager.Grafana.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableGrafanaSubscriptionResource : ArmResource + { + private ClientDiagnostics _managedGrafanaGrafanaClientDiagnostics; + private GrafanaRestOperations _managedGrafanaGrafanaRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableGrafanaSubscriptionResource() + { + } + + /// 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 MockableGrafanaSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ManagedGrafanaGrafanaClientDiagnostics => _managedGrafanaGrafanaClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Grafana", ManagedGrafanaResource.ResourceType.Namespace, Diagnostics); + private GrafanaRestOperations ManagedGrafanaGrafanaRestClient => _managedGrafanaGrafanaRestClient ??= new GrafanaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedGrafanaResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all resources of workspaces for Grafana under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana + /// + /// + /// Operation Id + /// Grafana_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedGrafanasAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedGrafanaGrafanaRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedGrafanaGrafanaRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedGrafanaResource(Client, ManagedGrafanaData.DeserializeManagedGrafanaData(e)), ManagedGrafanaGrafanaClientDiagnostics, Pipeline, "MockableGrafanaSubscriptionResource.GetManagedGrafanas", "value", "nextLink", cancellationToken); + } + + /// + /// List all resources of workspaces for Grafana under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana + /// + /// + /// Operation Id + /// Grafana_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedGrafanas(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedGrafanaGrafanaRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedGrafanaGrafanaRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedGrafanaResource(Client, ManagedGrafanaData.DeserializeManagedGrafanaData(e)), ManagedGrafanaGrafanaClientDiagnostics, Pipeline, "MockableGrafanaSubscriptionResource.GetManagedGrafanas", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d0e52b5e481a5..0000000000000 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Grafana -{ - /// 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 ManagedGrafanaResources in the ResourceGroupResource. - /// An object representing collection of ManagedGrafanaResources and their operations over a ManagedGrafanaResource. - public virtual ManagedGrafanaCollection GetManagedGrafanas() - { - return GetCachedClient(Client => new ManagedGrafanaCollection(Client, Id)); - } - } -} diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index ae9f0d11d0fd4..0000000000000 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Grafana -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _managedGrafanaGrafanaClientDiagnostics; - private GrafanaRestOperations _managedGrafanaGrafanaRestClient; - - /// 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 ManagedGrafanaGrafanaClientDiagnostics => _managedGrafanaGrafanaClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Grafana", ManagedGrafanaResource.ResourceType.Namespace, Diagnostics); - private GrafanaRestOperations ManagedGrafanaGrafanaRestClient => _managedGrafanaGrafanaRestClient ??= new GrafanaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedGrafanaResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all resources of workspaces for Grafana under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana - /// - /// - /// Operation Id - /// Grafana_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedGrafanasAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedGrafanaGrafanaRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedGrafanaGrafanaRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedGrafanaResource(Client, ManagedGrafanaData.DeserializeManagedGrafanaData(e)), ManagedGrafanaGrafanaClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedGrafanas", "value", "nextLink", cancellationToken); - } - - /// - /// List all resources of workspaces for Grafana under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana - /// - /// - /// Operation Id - /// Grafana_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedGrafanas(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedGrafanaGrafanaRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedGrafanaGrafanaRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedGrafanaResource(Client, ManagedGrafanaData.DeserializeManagedGrafanaData(e)), ManagedGrafanaGrafanaClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedGrafanas", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateEndpointConnectionResource.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateEndpointConnectionResource.cs index 502ac76eff1fa..caa67941c0351 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateEndpointConnectionResource.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Grafana public partial class GrafanaPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateLinkResource.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateLinkResource.cs index 392717250d065..2659dd26dc1e7 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateLinkResource.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/GrafanaPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Grafana public partial class GrafanaPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaResource.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaResource.cs index 831be61daa7f7..e6fe94cc860fe 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaResource.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Grafana public partial class ManagedGrafanaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GrafanaPrivateEndpointConnectionResources and their operations over a GrafanaPrivateEndpointConnectionResource. public virtual GrafanaPrivateEndpointConnectionCollection GetGrafanaPrivateEndpointConnections() { - return GetCachedClient(Client => new GrafanaPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new GrafanaPrivateEndpointConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual GrafanaPrivateEndpointConnectionCollection GetGrafanaPrivateEndpo /// /// The private endpoint connection name of Azure Managed Grafana. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGrafanaPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> Ge /// /// The private endpoint connection name of Azure Managed Grafana. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGrafanaPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetGrafanaPriv /// An object representing collection of GrafanaPrivateLinkResources and their operations over a GrafanaPrivateLinkResource. public virtual GrafanaPrivateLinkResourceCollection GetGrafanaPrivateLinkResources() { - return GetCachedClient(Client => new GrafanaPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new GrafanaPrivateLinkResourceCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual GrafanaPrivateLinkResourceCollection GetGrafanaPrivateLinkResourc /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGrafanaPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetGrafanaPrivat /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGrafanaPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/api/Azure.ResourceManager.GraphServices.netstandard2.0.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/api/Azure.ResourceManager.GraphServices.netstandard2.0.cs index 2fc48fbcd2818..41dc5074ef6b9 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/api/Azure.ResourceManager.GraphServices.netstandard2.0.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/api/Azure.ResourceManager.GraphServices.netstandard2.0.cs @@ -39,7 +39,7 @@ protected GraphServicesAccountResourceCollection() { } } public partial class GraphServicesAccountResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public GraphServicesAccountResourceData(Azure.Core.AzureLocation location, Azure.ResourceManager.GraphServices.Models.GraphServicesAccountResourceProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public GraphServicesAccountResourceData(Azure.Core.AzureLocation location, Azure.ResourceManager.GraphServices.Models.GraphServicesAccountResourceProperties properties) { } public Azure.ResourceManager.GraphServices.Models.GraphServicesAccountResourceProperties Properties { get { throw null; } set { } } } public static partial class GraphServicesExtensions @@ -52,6 +52,27 @@ public static partial class GraphServicesExtensions public static Azure.AsyncPageable GetGraphServicesAccountResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.GraphServices.Mocking +{ + public partial class MockableGraphServicesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableGraphServicesArmClient() { } + public virtual Azure.ResourceManager.GraphServices.GraphServicesAccountResource GetGraphServicesAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableGraphServicesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableGraphServicesResourceGroupResource() { } + public virtual Azure.Response GetGraphServicesAccountResource(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGraphServicesAccountResourceAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.GraphServices.GraphServicesAccountResourceCollection GetGraphServicesAccountResources() { throw null; } + } + public partial class MockableGraphServicesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableGraphServicesSubscriptionResource() { } + public virtual Azure.Pageable GetGraphServicesAccountResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGraphServicesAccountResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.GraphServices.Models { public static partial class ArmGraphServicesModelFactory diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs index 818cbb6b532f1..725ffe57e5dc0 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.GraphServices.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.GraphServices @@ -18,62 +19,49 @@ namespace Azure.ResourceManager.GraphServices /// A class to add extension methods to Azure.ResourceManager.GraphServices. public static partial class GraphServicesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableGraphServicesArmClient GetMockableGraphServicesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableGraphServicesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableGraphServicesResourceGroupResource GetMockableGraphServicesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableGraphServicesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableGraphServicesSubscriptionResource GetMockableGraphServicesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableGraphServicesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region GraphServicesAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GraphServicesAccountResource GetGraphServicesAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GraphServicesAccountResource.ValidateResourceId(id); - return new GraphServicesAccountResource(client, id); - } - ); + return GetMockableGraphServicesArmClient(client).GetGraphServicesAccountResource(id); } - #endregion - /// Gets a collection of GraphServicesAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of GraphServicesAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of GraphServicesAccountResources and their operations over a GraphServicesAccountResource. public static GraphServicesAccountResourceCollection GetGraphServicesAccountResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetGraphServicesAccountResources(); + return GetMockableGraphServicesResourceGroupResource(resourceGroupResource).GetGraphServicesAccountResources(); } /// @@ -88,16 +76,20 @@ public static GraphServicesAccountResourceCollection GetGraphServicesAccountReso /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetGraphServicesAccountResourceAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetGraphServicesAccountResources().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableGraphServicesResourceGroupResource(resourceGroupResource).GetGraphServicesAccountResourceAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -112,16 +104,20 @@ public static async Task> GetGraphService /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetGraphServicesAccountResource(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetGraphServicesAccountResources().Get(resourceName, cancellationToken); + return GetMockableGraphServicesResourceGroupResource(resourceGroupResource).GetGraphServicesAccountResource(resourceName, cancellationToken); } /// @@ -136,13 +132,17 @@ public static Response GetGraphServicesAccountReso /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetGraphServicesAccountResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGraphServicesAccountResourcesAsync(cancellationToken); + return GetMockableGraphServicesSubscriptionResource(subscriptionResource).GetGraphServicesAccountResourcesAsync(cancellationToken); } /// @@ -157,13 +157,17 @@ public static AsyncPageable GetGraphServicesAccoun /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetGraphServicesAccountResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGraphServicesAccountResources(cancellationToken); + return GetMockableGraphServicesSubscriptionResource(subscriptionResource).GetGraphServicesAccountResources(cancellationToken); } } } diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesArmClient.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesArmClient.cs new file mode 100644 index 0000000000000..1f5635cb15cfd --- /dev/null +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.GraphServices; + +namespace Azure.ResourceManager.GraphServices.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableGraphServicesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableGraphServicesArmClient() + { + } + + /// 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 MockableGraphServicesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableGraphServicesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GraphServicesAccountResource GetGraphServicesAccountResource(ResourceIdentifier id) + { + GraphServicesAccountResource.ValidateResourceId(id); + return new GraphServicesAccountResource(Client, id); + } + } +} diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesResourceGroupResource.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesResourceGroupResource.cs new file mode 100644 index 0000000000000..5f98e3366e8ba --- /dev/null +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.GraphServices; + +namespace Azure.ResourceManager.GraphServices.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableGraphServicesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableGraphServicesResourceGroupResource() + { + } + + /// 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 MockableGraphServicesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of GraphServicesAccountResources in the ResourceGroupResource. + /// An object representing collection of GraphServicesAccountResources and their operations over a GraphServicesAccountResource. + public virtual GraphServicesAccountResourceCollection GetGraphServicesAccountResources() + { + return GetCachedClient(client => new GraphServicesAccountResourceCollection(client, Id)); + } + + /// + /// Returns account resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGraphServicesAccountResourceAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetGraphServicesAccountResources().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns account resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGraphServicesAccountResource(string resourceName, CancellationToken cancellationToken = default) + { + return GetGraphServicesAccountResources().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesSubscriptionResource.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesSubscriptionResource.cs new file mode 100644 index 0000000000000..2ef99eb340e3c --- /dev/null +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/MockableGraphServicesSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.GraphServices; + +namespace Azure.ResourceManager.GraphServices.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableGraphServicesSubscriptionResource : ArmResource + { + private ClientDiagnostics _graphServicesAccountResourceAccountsClientDiagnostics; + private AccountsRestOperations _graphServicesAccountResourceAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableGraphServicesSubscriptionResource() + { + } + + /// 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 MockableGraphServicesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics GraphServicesAccountResourceAccountsClientDiagnostics => _graphServicesAccountResourceAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.GraphServices", GraphServicesAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations GraphServicesAccountResourceAccountsRestClient => _graphServicesAccountResourceAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GraphServicesAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns list of accounts belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGraphServicesAccountResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GraphServicesAccountResourceAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GraphServicesAccountResourceAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GraphServicesAccountResource(Client, GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(e)), GraphServicesAccountResourceAccountsClientDiagnostics, Pipeline, "MockableGraphServicesSubscriptionResource.GetGraphServicesAccountResources", "value", "nextLink", cancellationToken); + } + + /// + /// Returns list of accounts belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGraphServicesAccountResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GraphServicesAccountResourceAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GraphServicesAccountResourceAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GraphServicesAccountResource(Client, GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(e)), GraphServicesAccountResourceAccountsClientDiagnostics, Pipeline, "MockableGraphServicesSubscriptionResource.GetGraphServicesAccountResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 617b85b306ff6..0000000000000 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.GraphServices -{ - /// 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 GraphServicesAccountResources in the ResourceGroupResource. - /// An object representing collection of GraphServicesAccountResources and their operations over a GraphServicesAccountResource. - public virtual GraphServicesAccountResourceCollection GetGraphServicesAccountResources() - { - return GetCachedClient(Client => new GraphServicesAccountResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index a7de91f50a1ba..0000000000000 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.GraphServices -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _graphServicesAccountResourceAccountsClientDiagnostics; - private AccountsRestOperations _graphServicesAccountResourceAccountsRestClient; - - /// 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 GraphServicesAccountResourceAccountsClientDiagnostics => _graphServicesAccountResourceAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.GraphServices", GraphServicesAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations GraphServicesAccountResourceAccountsRestClient => _graphServicesAccountResourceAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GraphServicesAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns list of accounts belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetGraphServicesAccountResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => GraphServicesAccountResourceAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GraphServicesAccountResourceAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GraphServicesAccountResource(Client, GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(e)), GraphServicesAccountResourceAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGraphServicesAccountResources", "value", "nextLink", cancellationToken); - } - - /// - /// Returns list of accounts belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetGraphServicesAccountResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => GraphServicesAccountResourceAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GraphServicesAccountResourceAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GraphServicesAccountResource(Client, GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(e)), GraphServicesAccountResourceAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGraphServicesAccountResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResource.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResource.cs index f2021b12e1701..5685c3a11fb5f 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResource.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.GraphServices public partial class GraphServicesAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}"; diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/api/Azure.ResourceManager.GuestConfiguration.netstandard2.0.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/api/Azure.ResourceManager.GuestConfiguration.netstandard2.0.cs index 2c27248462bdf..2d24fe3c1fa91 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/api/Azure.ResourceManager.GuestConfiguration.netstandard2.0.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/api/Azure.ResourceManager.GuestConfiguration.netstandard2.0.cs @@ -126,6 +126,37 @@ protected GuestConfigurationVmssAssignmentResource() { } public virtual Azure.AsyncPageable GetReportsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.GuestConfiguration.Mocking +{ + public partial class MockableGuestConfigurationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableGuestConfigurationArmClient() { } + public virtual Azure.Response GetGuestConfigurationHcrpAssignment(Azure.Core.ResourceIdentifier scope, string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGuestConfigurationHcrpAssignmentAsync(Azure.Core.ResourceIdentifier scope, string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationHcrpAssignmentResource GetGuestConfigurationHcrpAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationHcrpAssignmentCollection GetGuestConfigurationHcrpAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetGuestConfigurationVmAssignment(Azure.Core.ResourceIdentifier scope, string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGuestConfigurationVmAssignmentAsync(Azure.Core.ResourceIdentifier scope, string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationVmAssignmentResource GetGuestConfigurationVmAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationVmAssignmentCollection GetGuestConfigurationVmAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetGuestConfigurationVmssAssignment(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGuestConfigurationVmssAssignmentAsync(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationVmssAssignmentResource GetGuestConfigurationVmssAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationVmssAssignmentCollection GetGuestConfigurationVmssAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + } + public partial class MockableGuestConfigurationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableGuestConfigurationResourceGroupResource() { } + public virtual Azure.Pageable GetAllGuestConfigurationAssignmentData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllGuestConfigurationAssignmentDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableGuestConfigurationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableGuestConfigurationSubscriptionResource() { } + public virtual Azure.Pageable GetAllGuestConfigurationAssignmentData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllGuestConfigurationAssignmentDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.GuestConfiguration.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/GuestConfigurationExtensions.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/GuestConfigurationExtensions.cs index fee5dc041f538..ae4535bd799d7 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/GuestConfigurationExtensions.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/GuestConfigurationExtensions.cs @@ -34,7 +34,7 @@ public static partial class GuestConfigurationExtensions /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAllGuestConfigurationAssignmentDataAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllGuestConfigurationAssignmentDataAsync(cancellationToken); + return GetMockableGuestConfigurationSubscriptionResource(subscriptionResource).GetAllGuestConfigurationAssignmentDataAsync(cancellationToken); } /// @@ -55,7 +55,7 @@ public static AsyncPageable GetAllGuestConfigu /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAllGuestConfigurationAssignmentData(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllGuestConfigurationAssignmentData(cancellationToken); + return GetMockableGuestConfigurationSubscriptionResource(subscriptionResource).GetAllGuestConfigurationAssignmentData(cancellationToken); } /// @@ -76,7 +76,7 @@ public static Pageable GetAllGuestConfiguratio /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAllGuestConfigurationAssignmentDataAsync(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAllGuestConfigurationAssignmentDataAsync(cancellationToken); + return GetMockableGuestConfigurationResourceGroupResource(resourceGroupResource).GetAllGuestConfigurationAssignmentDataAsync(cancellationToken); } /// @@ -97,7 +97,7 @@ public static AsyncPageable GetAllGuestConfigu /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAllGuestConfigurationAssignmentData(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAllGuestConfigurationAssignmentData(cancellationToken); + return GetMockableGuestConfigurationResourceGroupResource(resourceGroupResource).GetAllGuestConfigurationAssignmentData(cancellationToken); } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/GuestConfigurationSubscriptionMockingExtension.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/GuestConfigurationSubscriptionMockingExtension.cs new file mode 100644 index 0000000000000..2ae1a2992f942 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/GuestConfigurationSubscriptionMockingExtension.cs @@ -0,0 +1,72 @@ +// 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.Core; + +namespace Azure.ResourceManager.GuestConfiguration.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + [CodeGenSuppress("GetGuestConfigurationAssignmentsAsync", typeof(CancellationToken))] + [CodeGenSuppress("GetGuestConfigurationAssignments", typeof(CancellationToken))] + public partial class MockableGuestConfigurationSubscriptionResource : ArmResource + { + /// + /// List all guest configuration assignments for a subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments + /// Operation Id: GuestConfigurationAssignments_SubscriptionList + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllGuestConfigurationAssignmentDataAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGuestConfigurationAssignmentQueryResults"); + scope.Start(); + try + { + var response = await GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.SubscriptionListAsync(Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// + /// List all guest configuration assignments for a subscription. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments + /// Operation Id: GuestConfigurationAssignments_SubscriptionList + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllGuestConfigurationAssignmentData(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGuestConfigurationAssignmentQueryResults"); + scope.Start(); + try + { + var response = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.SubscriptionList(Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/MockableGuestConfigurationResourceGroupResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/MockableGuestConfigurationResourceGroupResource.cs new file mode 100644 index 0000000000000..fd6644055582d --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/MockableGuestConfigurationResourceGroupResource.cs @@ -0,0 +1,75 @@ +// 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.Core; + +namespace Azure.ResourceManager.GuestConfiguration.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + [CodeGenSuppress("GetGuestConfigurationAssignmentsAsync", typeof(CancellationToken))] + [CodeGenSuppress("GetGuestConfigurationAssignments", typeof(CancellationToken))] + [CodeGenSuppress("GetGuestConfigurationVmAssignments", typeof(string))] + [CodeGenSuppress("GetGuestConfigurationHcrpAssignments", typeof(string))] + [CodeGenSuppress("GetGuestConfigurationVmssAssignments", typeof(string))] + public partial class MockableGuestConfigurationResourceGroupResource : ArmResource + { + /// + /// List all guest configuration assignments for a resource group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments + /// Operation Id: GuestConfigurationAssignments_RGList + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllGuestConfigurationAssignmentDataAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGuestConfigurationAssignmentQueryResults"); + scope.Start(); + try + { + var response = await GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.RGListAsync(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// + /// List all guest configuration assignments for a resource group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments + /// Operation Id: GuestConfigurationAssignments_RGList + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllGuestConfigurationAssignmentData(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGuestConfigurationAssignmentQueryResults"); + scope.Start(); + try + { + var response = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.RGList(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index c27358a9ac856..0000000000000 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,75 +0,0 @@ -// 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.Core; - -namespace Azure.ResourceManager.GuestConfiguration -{ - /// A class to add extension methods to ResourceGroupResource. - [CodeGenSuppress("GetGuestConfigurationAssignmentsAsync", typeof(CancellationToken))] - [CodeGenSuppress("GetGuestConfigurationAssignments", typeof(CancellationToken))] - [CodeGenSuppress("GetGuestConfigurationVmAssignments", typeof(string))] - [CodeGenSuppress("GetGuestConfigurationHcrpAssignments", typeof(string))] - [CodeGenSuppress("GetGuestConfigurationVmssAssignments", typeof(string))] - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - /// - /// List all guest configuration assignments for a resource group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments - /// Operation Id: GuestConfigurationAssignments_RGList - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllGuestConfigurationAssignmentDataAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGuestConfigurationAssignmentQueryResults"); - scope.Start(); - try - { - var response = await GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.RGListAsync(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); - } - - /// - /// List all guest configuration assignments for a resource group. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments - /// Operation Id: GuestConfigurationAssignments_RGList - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllGuestConfigurationAssignmentData(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetGuestConfigurationAssignmentQueryResults"); - scope.Start(); - try - { - var response = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.RGList(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); - } - } -} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index edfc27248a5b9..0000000000000 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,72 +0,0 @@ -// 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.Core; - -namespace Azure.ResourceManager.GuestConfiguration -{ - /// A class to add extension methods to SubscriptionResource. - [CodeGenSuppress("GetGuestConfigurationAssignmentsAsync", typeof(CancellationToken))] - [CodeGenSuppress("GetGuestConfigurationAssignments", typeof(CancellationToken))] - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - /// - /// List all guest configuration assignments for a subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments - /// Operation Id: GuestConfigurationAssignments_SubscriptionList - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllGuestConfigurationAssignmentDataAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGuestConfigurationAssignmentQueryResults"); - scope.Start(); - try - { - var response = await GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.SubscriptionListAsync(Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); - } - - /// - /// List all guest configuration assignments for a subscription. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments - /// Operation Id: GuestConfigurationAssignments_SubscriptionList - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllGuestConfigurationAssignmentData(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetGuestConfigurationAssignmentQueryResults"); - scope.Start(); - try - { - var response = GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.SubscriptionList(Id.SubscriptionId, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); - } - } -} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 4a1aacb3b9bcd..0000000000000 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.GuestConfiguration -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of GuestConfigurationVmAssignmentResources in the ArmResource. - /// An object representing collection of GuestConfigurationVmAssignmentResources and their operations over a GuestConfigurationVmAssignmentResource. - public virtual GuestConfigurationVmAssignmentCollection GetGuestConfigurationVmAssignments() - { - return GetCachedClient(Client => new GuestConfigurationVmAssignmentCollection(Client, Id)); - } - - /// Gets a collection of GuestConfigurationHcrpAssignmentResources in the ArmResource. - /// An object representing collection of GuestConfigurationHcrpAssignmentResources and their operations over a GuestConfigurationHcrpAssignmentResource. - public virtual GuestConfigurationHcrpAssignmentCollection GetGuestConfigurationHcrpAssignments() - { - return GetCachedClient(Client => new GuestConfigurationHcrpAssignmentCollection(Client, Id)); - } - - /// Gets a collection of GuestConfigurationVmssAssignmentResources in the ArmResource. - /// An object representing collection of GuestConfigurationVmssAssignmentResources and their operations over a GuestConfigurationVmssAssignmentResource. - public virtual GuestConfigurationVmssAssignmentCollection GetGuestConfigurationVmssAssignments() - { - return GetCachedClient(Client => new GuestConfigurationVmssAssignmentCollection(Client, Id)); - } - } -} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/GuestConfigurationExtensions.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/GuestConfigurationExtensions.cs index d0b3856bb4c24..fe1fc37394af1 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/GuestConfigurationExtensions.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/GuestConfigurationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.GuestConfiguration.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.GuestConfiguration @@ -18,121 +19,34 @@ namespace Azure.ResourceManager.GuestConfiguration /// A class to add extension methods to Azure.ResourceManager.GuestConfiguration. public static partial class GuestConfigurationExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableGuestConfigurationArmClient GetMockableGuestConfigurationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableGuestConfigurationArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableGuestConfigurationResourceGroupResource GetMockableGuestConfigurationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableGuestConfigurationResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableGuestConfigurationSubscriptionResource GetMockableGuestConfigurationSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableGuestConfigurationSubscriptionResource(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 GuestConfigurationVmAssignmentResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static GuestConfigurationVmAssignmentResource GetGuestConfigurationVmAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - GuestConfigurationVmAssignmentResource.ValidateResourceId(id); - return new GuestConfigurationVmAssignmentResource(client, id); - } - ); - } - #endregion - - #region GuestConfigurationHcrpAssignmentResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static GuestConfigurationHcrpAssignmentResource GetGuestConfigurationHcrpAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - GuestConfigurationHcrpAssignmentResource.ValidateResourceId(id); - return new GuestConfigurationHcrpAssignmentResource(client, id); - } - ); - } - #endregion - - #region GuestConfigurationVmssAssignmentResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of GuestConfigurationVmAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static GuestConfigurationVmssAssignmentResource GetGuestConfigurationVmssAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - GuestConfigurationVmssAssignmentResource.ValidateResourceId(id); - return new GuestConfigurationVmssAssignmentResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of GuestConfigurationVmAssignmentResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachines. /// An object representing collection of GuestConfigurationVmAssignmentResources and their operations over a GuestConfigurationVmAssignmentResource. public static GuestConfigurationVmAssignmentCollection GetGuestConfigurationVmAssignments(this ArmClient client, ResourceIdentifier scope) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachines", scope.ResourceType)); - } - return GetArmResourceExtensionClient(client, scope).GetGuestConfigurationVmAssignments(); + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmAssignments(scope); } /// @@ -147,21 +61,21 @@ public static GuestConfigurationVmAssignmentCollection GetGuestConfigurationVmAs /// GuestConfigurationAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachines. /// The guest configuration assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetGuestConfigurationVmAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachines", scope.ResourceType)); - } - return await client.GetGuestConfigurationVmAssignments(scope).GetAsync(guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmAssignmentAsync(scope, guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -176,34 +90,36 @@ public static async Task> GetGu /// GuestConfigurationAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachines. /// The guest configuration assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetGuestConfigurationVmAssignment(this ArmClient client, ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachines", scope.ResourceType)); - } - return client.GetGuestConfigurationVmAssignments(scope).Get(guestConfigurationAssignmentName, cancellationToken); + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmAssignment(scope, guestConfigurationAssignmentName, cancellationToken); } - /// Gets a collection of GuestConfigurationHcrpAssignmentResources in the ArmResource. + /// + /// Gets a collection of GuestConfigurationHcrpAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.HybridCompute/machines. /// An object representing collection of GuestConfigurationHcrpAssignmentResources and their operations over a GuestConfigurationHcrpAssignmentResource. public static GuestConfigurationHcrpAssignmentCollection GetGuestConfigurationHcrpAssignments(this ArmClient client, ResourceIdentifier scope) { - if (!scope.ResourceType.Equals("Microsoft.HybridCompute/machines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.HybridCompute/machines", scope.ResourceType)); - } - return GetArmResourceExtensionClient(client, scope).GetGuestConfigurationHcrpAssignments(); + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationHcrpAssignments(scope); } /// @@ -218,21 +134,21 @@ public static GuestConfigurationHcrpAssignmentCollection GetGuestConfigurationHc /// GuestConfigurationHCRPAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.HybridCompute/machines. /// The guest configuration assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetGuestConfigurationHcrpAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.HybridCompute/machines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.HybridCompute/machines", scope.ResourceType)); - } - return await client.GetGuestConfigurationHcrpAssignments(scope).GetAsync(guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationHcrpAssignmentAsync(scope, guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -247,34 +163,36 @@ public static async Task> Get /// GuestConfigurationHCRPAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.HybridCompute/machines. /// The guest configuration assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetGuestConfigurationHcrpAssignment(this ArmClient client, ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.HybridCompute/machines")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.HybridCompute/machines", scope.ResourceType)); - } - return client.GetGuestConfigurationHcrpAssignments(scope).Get(guestConfigurationAssignmentName, cancellationToken); + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationHcrpAssignment(scope, guestConfigurationAssignmentName, cancellationToken); } - /// Gets a collection of GuestConfigurationVmssAssignmentResources in the ArmResource. + /// + /// Gets a collection of GuestConfigurationVmssAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachineScaleSets. /// An object representing collection of GuestConfigurationVmssAssignmentResources and their operations over a GuestConfigurationVmssAssignmentResource. public static GuestConfigurationVmssAssignmentCollection GetGuestConfigurationVmssAssignments(this ArmClient client, ResourceIdentifier scope) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachineScaleSets")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachineScaleSets", scope.ResourceType)); - } - return GetArmResourceExtensionClient(client, scope).GetGuestConfigurationVmssAssignments(); + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmssAssignments(scope); } /// @@ -289,21 +207,21 @@ public static GuestConfigurationVmssAssignmentCollection GetGuestConfigurationVm /// GuestConfigurationAssignmentsVMSS_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachineScaleSets. /// The guest configuration assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetGuestConfigurationVmssAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachineScaleSets")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachineScaleSets", scope.ResourceType)); - } - return await client.GetGuestConfigurationVmssAssignments(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmssAssignmentAsync(scope, name, cancellationToken).ConfigureAwait(false); } /// @@ -318,21 +236,69 @@ public static async Task> Get /// GuestConfigurationAssignmentsVMSS_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.Compute/virtualMachineScaleSets. /// The guest configuration assignment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetGuestConfigurationVmssAssignment(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachineScaleSets")) - { - throw new ArgumentException(string.Format("Invalid resource type {0} expected Microsoft.Compute/virtualMachineScaleSets", scope.ResourceType)); - } - return client.GetGuestConfigurationVmssAssignments(scope).Get(name, cancellationToken); + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmssAssignment(scope, name, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static GuestConfigurationVmAssignmentResource GetGuestConfigurationVmAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmAssignmentResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static GuestConfigurationHcrpAssignmentResource GetGuestConfigurationHcrpAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationHcrpAssignmentResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static GuestConfigurationVmssAssignmentResource GetGuestConfigurationVmssAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmssAssignmentResource(id); } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationArmClient.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationArmClient.cs new file mode 100644 index 0000000000000..1908321666f42 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationArmClient.cs @@ -0,0 +1,259 @@ +// 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.GuestConfiguration; + +namespace Azure.ResourceManager.GuestConfiguration.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableGuestConfigurationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableGuestConfigurationArmClient() + { + } + + /// 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 MockableGuestConfigurationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableGuestConfigurationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of GuestConfigurationVmAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of GuestConfigurationVmAssignmentResources and their operations over a GuestConfigurationVmAssignmentResource. + public virtual GuestConfigurationVmAssignmentCollection GetGuestConfigurationVmAssignments(ResourceIdentifier scope) + { + if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachines")) + { + throw new ArgumentException(string.Format("Invalid resource type {0}, expected Microsoft.Compute/virtualMachines", scope.ResourceType)); + } + return new GuestConfigurationVmAssignmentCollection(Client, scope); + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGuestConfigurationVmAssignmentAsync(ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + return await GetGuestConfigurationVmAssignments(scope).GetAsync(guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGuestConfigurationVmAssignment(ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + return GetGuestConfigurationVmAssignments(scope).Get(guestConfigurationAssignmentName, cancellationToken); + } + + /// Gets a collection of GuestConfigurationHcrpAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of GuestConfigurationHcrpAssignmentResources and their operations over a GuestConfigurationHcrpAssignmentResource. + public virtual GuestConfigurationHcrpAssignmentCollection GetGuestConfigurationHcrpAssignments(ResourceIdentifier scope) + { + if (!scope.ResourceType.Equals("Microsoft.HybridCompute/machines")) + { + throw new ArgumentException(string.Format("Invalid resource type {0}, expected Microsoft.HybridCompute/machines", scope.ResourceType)); + } + return new GuestConfigurationHcrpAssignmentCollection(Client, scope); + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationHCRPAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGuestConfigurationHcrpAssignmentAsync(ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + return await GetGuestConfigurationHcrpAssignments(scope).GetAsync(guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationHCRPAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGuestConfigurationHcrpAssignment(ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + return GetGuestConfigurationHcrpAssignments(scope).Get(guestConfigurationAssignmentName, cancellationToken); + } + + /// Gets a collection of GuestConfigurationVmssAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of GuestConfigurationVmssAssignmentResources and their operations over a GuestConfigurationVmssAssignmentResource. + public virtual GuestConfigurationVmssAssignmentCollection GetGuestConfigurationVmssAssignments(ResourceIdentifier scope) + { + if (!scope.ResourceType.Equals("Microsoft.Compute/virtualMachineScaleSets")) + { + throw new ArgumentException(string.Format("Invalid resource type {0}, expected Microsoft.Compute/virtualMachineScaleSets", scope.ResourceType)); + } + return new GuestConfigurationVmssAssignmentCollection(Client, scope); + } + + /// + /// Get information about a guest configuration assignment for VMSS + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name} + /// + /// + /// Operation Id + /// GuestConfigurationAssignmentsVMSS_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGuestConfigurationVmssAssignmentAsync(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + { + return await GetGuestConfigurationVmssAssignments(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a guest configuration assignment for VMSS + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name} + /// + /// + /// Operation Id + /// GuestConfigurationAssignmentsVMSS_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGuestConfigurationVmssAssignment(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + { + return GetGuestConfigurationVmssAssignments(scope).Get(name, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GuestConfigurationVmAssignmentResource GetGuestConfigurationVmAssignmentResource(ResourceIdentifier id) + { + GuestConfigurationVmAssignmentResource.ValidateResourceId(id); + return new GuestConfigurationVmAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GuestConfigurationHcrpAssignmentResource GetGuestConfigurationHcrpAssignmentResource(ResourceIdentifier id) + { + GuestConfigurationHcrpAssignmentResource.ValidateResourceId(id); + return new GuestConfigurationHcrpAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GuestConfigurationVmssAssignmentResource GetGuestConfigurationVmssAssignmentResource(ResourceIdentifier id) + { + GuestConfigurationVmssAssignmentResource.ValidateResourceId(id); + return new GuestConfigurationVmssAssignmentResource(Client, id); + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationResourceGroupResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationResourceGroupResource.cs new file mode 100644 index 0000000000000..4de16ab00e6e9 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationResourceGroupResource.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.GuestConfiguration; + +namespace Azure.ResourceManager.GuestConfiguration.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableGuestConfigurationResourceGroupResource : ArmResource + { + private ClientDiagnostics _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics; + private GuestConfigurationAssignmentsRestOperations _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableGuestConfigurationResourceGroupResource() + { + } + + /// 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 MockableGuestConfigurationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics => _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.GuestConfiguration", GuestConfigurationVmAssignmentResource.ResourceType.Namespace, Diagnostics); + private GuestConfigurationAssignmentsRestOperations GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient => _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient ??= new GuestConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GuestConfigurationVmAssignmentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationSubscriptionResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationSubscriptionResource.cs new file mode 100644 index 0000000000000..6edf251180dd0 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationSubscriptionResource.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.GuestConfiguration; + +namespace Azure.ResourceManager.GuestConfiguration.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableGuestConfigurationSubscriptionResource : ArmResource + { + private ClientDiagnostics _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics; + private GuestConfigurationAssignmentsRestOperations _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableGuestConfigurationSubscriptionResource() + { + } + + /// 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 MockableGuestConfigurationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics => _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.GuestConfiguration", GuestConfigurationVmAssignmentResource.ResourceType.Namespace, Diagnostics); + private GuestConfigurationAssignmentsRestOperations GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient => _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient ??= new GuestConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GuestConfigurationVmAssignmentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 9a7afd053dc7c..0000000000000 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.GuestConfiguration -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics; - private GuestConfigurationAssignmentsRestOperations _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient; - - /// 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 ClientDiagnostics GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics => _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.GuestConfiguration", GuestConfigurationVmAssignmentResource.ResourceType.Namespace, Diagnostics); - private GuestConfigurationAssignmentsRestOperations GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient => _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient ??= new GuestConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GuestConfigurationVmAssignmentResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - } -} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 00789dcd9057e..0000000000000 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.GuestConfiguration -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics; - private GuestConfigurationAssignmentsRestOperations _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient; - - /// 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 GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics => _guestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.GuestConfiguration", GuestConfigurationVmAssignmentResource.ResourceType.Namespace, Diagnostics); - private GuestConfigurationAssignmentsRestOperations GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient => _guestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient ??= new GuestConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GuestConfigurationVmAssignmentResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - } -} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentResource.cs index a3afa46e60c36..e434ef7e835d4 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.GuestConfiguration public partial class GuestConfigurationHcrpAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The machineName. + /// The guestConfigurationAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string machineName, string guestConfigurationAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}"; diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentResource.cs index f405848aa3d9f..984ac13c2f0c6 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.GuestConfiguration public partial class GuestConfigurationVmAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmName. + /// The guestConfigurationAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}"; diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentResource.cs index b140516137553..bbe135191f89b 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.GuestConfiguration public partial class GuestConfigurationVmssAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmssName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmssName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}"; diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/CHANGELOG.md b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/CHANGELOG.md index 89079a2e7780e..5162d4cda1f9e 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/CHANGELOG.md +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.1 (2023-10-30) ### General New Features diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/api/Azure.ResourceManager.HardwareSecurityModules.netstandard2.0.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/api/Azure.ResourceManager.HardwareSecurityModules.netstandard2.0.cs index c618cbb2786f7..ca5e1cc4454fd 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/api/Azure.ResourceManager.HardwareSecurityModules.netstandard2.0.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/api/Azure.ResourceManager.HardwareSecurityModules.netstandard2.0.cs @@ -19,7 +19,7 @@ protected CloudHsmClusterCollection() { } } public partial class CloudHsmClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public CloudHsmClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CloudHsmClusterData(Azure.Core.AzureLocation location) { } public string AutoGeneratedDomainNameLabelScope { get { throw null; } set { } } public System.Collections.Generic.IList Hsms { get { throw null; } } public System.Collections.Generic.IList PrivateEndpointConnections { get { throw null; } } @@ -72,7 +72,7 @@ protected DedicatedHsmCollection() { } } public partial class DedicatedHsmData : Azure.ResourceManager.Models.TrackedResourceData { - public DedicatedHsmData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DedicatedHsmData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HardwareSecurityModules.Models.NetworkProfile ManagementNetworkProfile { get { throw null; } set { } } public Azure.ResourceManager.HardwareSecurityModules.Models.NetworkProfile NetworkProfile { get { throw null; } set { } } public Azure.ResourceManager.HardwareSecurityModules.Models.JsonWebKeyType? ProvisioningState { get { throw null; } } @@ -160,6 +160,34 @@ protected HardwareSecurityModulesPrivateEndpointConnectionResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HardwareSecurityModules.HardwareSecurityModulesPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.HardwareSecurityModules.Mocking +{ + public partial class MockableHardwareSecurityModulesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHardwareSecurityModulesArmClient() { } + public virtual Azure.ResourceManager.HardwareSecurityModules.CloudHsmClusterResource GetCloudHsmClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HardwareSecurityModules.DedicatedHsmResource GetDedicatedHsmResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HardwareSecurityModules.HardwareSecurityModulesPrivateEndpointConnectionResource GetHardwareSecurityModulesPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHardwareSecurityModulesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHardwareSecurityModulesResourceGroupResource() { } + public virtual Azure.Response GetCloudHsmCluster(string cloudHsmClusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCloudHsmClusterAsync(string cloudHsmClusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HardwareSecurityModules.CloudHsmClusterCollection GetCloudHsmClusters() { throw null; } + public virtual Azure.Response GetDedicatedHsm(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDedicatedHsmAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HardwareSecurityModules.DedicatedHsmCollection GetDedicatedHsms() { throw null; } + } + public partial class MockableHardwareSecurityModulesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHardwareSecurityModulesSubscriptionResource() { } + public virtual Azure.Pageable GetCloudHsmClusters(string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCloudHsmClustersAsync(string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDedicatedHsms(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDedicatedHsmsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.HardwareSecurityModules.Models { public static partial class ArmHardwareSecurityModulesModelFactory diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Azure.ResourceManager.HardwareSecurityModules.csproj b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Azure.ResourceManager.HardwareSecurityModules.csproj index fe3d910a6d96c..5247e6fc86b99 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Azure.ResourceManager.HardwareSecurityModules.csproj +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Azure.ResourceManager.HardwareSecurityModules.csproj @@ -1,6 +1,6 @@ - + - 1.0.0-beta.1 + 1.0.0-beta.2 Azure.ResourceManager.HardwareSecurityModules Azure Resource Manager client SDK for Azure resource provider HardwareSecurityModules. azure;management;arm;resource manager;hardwaresecuritymodules diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterResource.cs index d6f900d7e4b67..921b942611a58 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterResource.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.HardwareSecurityModules public partial class CloudHsmClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cloudHsmClusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cloudHsmClusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HardwareSecurityModulesPrivateEndpointConnectionResources and their operations over a HardwareSecurityModulesPrivateEndpointConnectionResource. public virtual HardwareSecurityModulesPrivateEndpointConnectionCollection GetHardwareSecurityModulesPrivateEndpointConnections() { - return GetCachedClient(Client => new HardwareSecurityModulesPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new HardwareSecurityModulesPrivateEndpointConnectionCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual HardwareSecurityModulesPrivateEndpointConnectionCollection GetHar /// /// Name of the private endpoint connection associated with the Cloud HSM Cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHardwareSecurityModulesPrivateEndpointConnectionAsync(string peConnectionName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task /// Name of the private endpoint connection associated with the Cloud HSM Cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHardwareSecurityModulesPrivateEndpointConnection(string peConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/DedicatedHsmResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/DedicatedHsmResource.cs index 098e6d7741486..47f1656b79cf9 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/DedicatedHsmResource.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/DedicatedHsmResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.HardwareSecurityModules public partial class DedicatedHsmResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}"; diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/HardwareSecurityModulesExtensions.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/HardwareSecurityModulesExtensions.cs index 83f70412d38db..d6a07cb977398 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/HardwareSecurityModulesExtensions.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/HardwareSecurityModulesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.HardwareSecurityModules.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.HardwareSecurityModules @@ -18,100 +19,81 @@ namespace Azure.ResourceManager.HardwareSecurityModules /// A class to add extension methods to Azure.ResourceManager.HardwareSecurityModules. public static partial class HardwareSecurityModulesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableHardwareSecurityModulesArmClient GetMockableHardwareSecurityModulesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHardwareSecurityModulesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableHardwareSecurityModulesResourceGroupResource GetMockableHardwareSecurityModulesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableHardwareSecurityModulesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableHardwareSecurityModulesSubscriptionResource GetMockableHardwareSecurityModulesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableHardwareSecurityModulesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region CloudHsmClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CloudHsmClusterResource GetCloudHsmClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CloudHsmClusterResource.ValidateResourceId(id); - return new CloudHsmClusterResource(client, id); - } - ); + return GetMockableHardwareSecurityModulesArmClient(client).GetCloudHsmClusterResource(id); } - #endregion - #region HardwareSecurityModulesPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HardwareSecurityModulesPrivateEndpointConnectionResource GetHardwareSecurityModulesPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HardwareSecurityModulesPrivateEndpointConnectionResource.ValidateResourceId(id); - return new HardwareSecurityModulesPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableHardwareSecurityModulesArmClient(client).GetHardwareSecurityModulesPrivateEndpointConnectionResource(id); } - #endregion - #region DedicatedHsmResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DedicatedHsmResource GetDedicatedHsmResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DedicatedHsmResource.ValidateResourceId(id); - return new DedicatedHsmResource(client, id); - } - ); + return GetMockableHardwareSecurityModulesArmClient(client).GetDedicatedHsmResource(id); } - #endregion - /// Gets a collection of CloudHsmClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of CloudHsmClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CloudHsmClusterResources and their operations over a CloudHsmClusterResource. public static CloudHsmClusterCollection GetCloudHsmClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCloudHsmClusters(); + return GetMockableHardwareSecurityModulesResourceGroupResource(resourceGroupResource).GetCloudHsmClusters(); } /// @@ -126,16 +108,20 @@ public static CloudHsmClusterCollection GetCloudHsmClusters(this ResourceGroupRe /// CloudHsmClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 24 characters in length. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCloudHsmClusterAsync(this ResourceGroupResource resourceGroupResource, string cloudHsmClusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCloudHsmClusters().GetAsync(cloudHsmClusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableHardwareSecurityModulesResourceGroupResource(resourceGroupResource).GetCloudHsmClusterAsync(cloudHsmClusterName, cancellationToken).ConfigureAwait(false); } /// @@ -150,24 +136,34 @@ public static async Task> GetCloudHsmClusterAs /// CloudHsmClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 24 characters in length. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCloudHsmCluster(this ResourceGroupResource resourceGroupResource, string cloudHsmClusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCloudHsmClusters().Get(cloudHsmClusterName, cancellationToken); + return GetMockableHardwareSecurityModulesResourceGroupResource(resourceGroupResource).GetCloudHsmCluster(cloudHsmClusterName, cancellationToken); } - /// Gets a collection of DedicatedHsmResources in the ResourceGroupResource. + /// + /// Gets a collection of DedicatedHsmResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DedicatedHsmResources and their operations over a DedicatedHsmResource. public static DedicatedHsmCollection GetDedicatedHsms(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDedicatedHsms(); + return GetMockableHardwareSecurityModulesResourceGroupResource(resourceGroupResource).GetDedicatedHsms(); } /// @@ -182,16 +178,20 @@ public static DedicatedHsmCollection GetDedicatedHsms(this ResourceGroupResource /// DedicatedHsm_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the dedicated HSM. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDedicatedHsmAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDedicatedHsms().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableHardwareSecurityModulesResourceGroupResource(resourceGroupResource).GetDedicatedHsmAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -206,16 +206,20 @@ public static async Task> GetDedicatedHsmAsync(th /// DedicatedHsm_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the dedicated HSM. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDedicatedHsm(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDedicatedHsms().Get(name, cancellationToken); + return GetMockableHardwareSecurityModulesResourceGroupResource(resourceGroupResource).GetDedicatedHsm(name, cancellationToken); } /// @@ -230,6 +234,10 @@ public static Response GetDedicatedHsm(this ResourceGroupR /// CloudHsmClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The page-continuation token to use with a paged version of this API. @@ -237,7 +245,7 @@ public static Response GetDedicatedHsm(this ResourceGroupR /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCloudHsmClustersAsync(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCloudHsmClustersAsync(skiptoken, cancellationToken); + return GetMockableHardwareSecurityModulesSubscriptionResource(subscriptionResource).GetCloudHsmClustersAsync(skiptoken, cancellationToken); } /// @@ -252,6 +260,10 @@ public static AsyncPageable GetCloudHsmClustersAsync(th /// CloudHsmClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The page-continuation token to use with a paged version of this API. @@ -259,7 +271,7 @@ public static AsyncPageable GetCloudHsmClustersAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCloudHsmClusters(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCloudHsmClusters(skiptoken, cancellationToken); + return GetMockableHardwareSecurityModulesSubscriptionResource(subscriptionResource).GetCloudHsmClusters(skiptoken, cancellationToken); } /// @@ -274,6 +286,10 @@ public static Pageable GetCloudHsmClusters(this Subscri /// DedicatedHsm_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maximum number of results to return. @@ -281,7 +297,7 @@ public static Pageable GetCloudHsmClusters(this Subscri /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDedicatedHsmsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDedicatedHsmsAsync(top, cancellationToken); + return GetMockableHardwareSecurityModulesSubscriptionResource(subscriptionResource).GetDedicatedHsmsAsync(top, cancellationToken); } /// @@ -296,6 +312,10 @@ public static AsyncPageable GetDedicatedHsmsAsync(this Sub /// DedicatedHsm_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maximum number of results to return. @@ -303,7 +323,7 @@ public static AsyncPageable GetDedicatedHsmsAsync(this Sub /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDedicatedHsms(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDedicatedHsms(top, cancellationToken); + return GetMockableHardwareSecurityModulesSubscriptionResource(subscriptionResource).GetDedicatedHsms(top, cancellationToken); } } } diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesArmClient.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesArmClient.cs new file mode 100644 index 0000000000000..75660e4656ec6 --- /dev/null +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.HardwareSecurityModules; + +namespace Azure.ResourceManager.HardwareSecurityModules.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHardwareSecurityModulesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHardwareSecurityModulesArmClient() + { + } + + /// 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 MockableHardwareSecurityModulesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHardwareSecurityModulesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CloudHsmClusterResource GetCloudHsmClusterResource(ResourceIdentifier id) + { + CloudHsmClusterResource.ValidateResourceId(id); + return new CloudHsmClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HardwareSecurityModulesPrivateEndpointConnectionResource GetHardwareSecurityModulesPrivateEndpointConnectionResource(ResourceIdentifier id) + { + HardwareSecurityModulesPrivateEndpointConnectionResource.ValidateResourceId(id); + return new HardwareSecurityModulesPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DedicatedHsmResource GetDedicatedHsmResource(ResourceIdentifier id) + { + DedicatedHsmResource.ValidateResourceId(id); + return new DedicatedHsmResource(Client, id); + } + } +} diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesResourceGroupResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesResourceGroupResource.cs new file mode 100644 index 0000000000000..a84162af9b29e --- /dev/null +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.HardwareSecurityModules; + +namespace Azure.ResourceManager.HardwareSecurityModules.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHardwareSecurityModulesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHardwareSecurityModulesResourceGroupResource() + { + } + + /// 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 MockableHardwareSecurityModulesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CloudHsmClusterResources in the ResourceGroupResource. + /// An object representing collection of CloudHsmClusterResources and their operations over a CloudHsmClusterResource. + public virtual CloudHsmClusterCollection GetCloudHsmClusters() + { + return GetCachedClient(client => new CloudHsmClusterCollection(client, Id)); + } + + /// + /// Gets the specified Cloud HSM Cluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName} + /// + /// + /// Operation Id + /// CloudHsmClusters_Get + /// + /// + /// + /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 24 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCloudHsmClusterAsync(string cloudHsmClusterName, CancellationToken cancellationToken = default) + { + return await GetCloudHsmClusters().GetAsync(cloudHsmClusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Cloud HSM Cluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName} + /// + /// + /// Operation Id + /// CloudHsmClusters_Get + /// + /// + /// + /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 24 characters in length. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCloudHsmCluster(string cloudHsmClusterName, CancellationToken cancellationToken = default) + { + return GetCloudHsmClusters().Get(cloudHsmClusterName, cancellationToken); + } + + /// Gets a collection of DedicatedHsmResources in the ResourceGroupResource. + /// An object representing collection of DedicatedHsmResources and their operations over a DedicatedHsmResource. + public virtual DedicatedHsmCollection GetDedicatedHsms() + { + return GetCachedClient(client => new DedicatedHsmCollection(client, Id)); + } + + /// + /// Gets the specified Azure dedicated HSM. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name} + /// + /// + /// Operation Id + /// DedicatedHsm_Get + /// + /// + /// + /// The name of the dedicated HSM. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDedicatedHsmAsync(string name, CancellationToken cancellationToken = default) + { + return await GetDedicatedHsms().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Azure dedicated HSM. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name} + /// + /// + /// Operation Id + /// DedicatedHsm_Get + /// + /// + /// + /// The name of the dedicated HSM. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDedicatedHsm(string name, CancellationToken cancellationToken = default) + { + return GetDedicatedHsms().Get(name, cancellationToken); + } + } +} diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesSubscriptionResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesSubscriptionResource.cs new file mode 100644 index 0000000000000..2db598d7619de --- /dev/null +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/MockableHardwareSecurityModulesSubscriptionResource.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HardwareSecurityModules; + +namespace Azure.ResourceManager.HardwareSecurityModules.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHardwareSecurityModulesSubscriptionResource : ArmResource + { + private ClientDiagnostics _cloudHsmClusterClientDiagnostics; + private CloudHsmClustersRestOperations _cloudHsmClusterRestClient; + private ClientDiagnostics _dedicatedHsmClientDiagnostics; + private DedicatedHsmRestOperations _dedicatedHsmRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHardwareSecurityModulesSubscriptionResource() + { + } + + /// 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 MockableHardwareSecurityModulesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CloudHsmClusterClientDiagnostics => _cloudHsmClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HardwareSecurityModules", CloudHsmClusterResource.ResourceType.Namespace, Diagnostics); + private CloudHsmClustersRestOperations CloudHsmClusterRestClient => _cloudHsmClusterRestClient ??= new CloudHsmClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CloudHsmClusterResource.ResourceType)); + private ClientDiagnostics DedicatedHsmClientDiagnostics => _dedicatedHsmClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HardwareSecurityModules", DedicatedHsmResource.ResourceType.Namespace, Diagnostics); + private DedicatedHsmRestOperations DedicatedHsmRestClient => _dedicatedHsmRestClient ??= new DedicatedHsmRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DedicatedHsmResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// The List operation gets information about the Cloud HSM Clusters associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters + /// + /// + /// Operation Id + /// CloudHsmClusters_ListBySubscription + /// + /// + /// + /// The page-continuation token to use with a paged version of this API. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCloudHsmClustersAsync(string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CloudHsmClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudHsmClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudHsmClusterResource(Client, CloudHsmClusterData.DeserializeCloudHsmClusterData(e)), CloudHsmClusterClientDiagnostics, Pipeline, "MockableHardwareSecurityModulesSubscriptionResource.GetCloudHsmClusters", "value", "nextLink", cancellationToken); + } + + /// + /// The List operation gets information about the Cloud HSM Clusters associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters + /// + /// + /// Operation Id + /// CloudHsmClusters_ListBySubscription + /// + /// + /// + /// The page-continuation token to use with a paged version of this API. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCloudHsmClusters(string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CloudHsmClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudHsmClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudHsmClusterResource(Client, CloudHsmClusterData.DeserializeCloudHsmClusterData(e)), CloudHsmClusterClientDiagnostics, Pipeline, "MockableHardwareSecurityModulesSubscriptionResource.GetCloudHsmClusters", "value", "nextLink", cancellationToken); + } + + /// + /// The List operation gets information about the dedicated HSMs associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs + /// + /// + /// Operation Id + /// DedicatedHsm_ListBySubscription + /// + /// + /// + /// Maximum number of results to return. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDedicatedHsmsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHsmResource(Client, DedicatedHsmData.DeserializeDedicatedHsmData(e)), DedicatedHsmClientDiagnostics, Pipeline, "MockableHardwareSecurityModulesSubscriptionResource.GetDedicatedHsms", "value", "nextLink", cancellationToken); + } + + /// + /// The List operation gets information about the dedicated HSMs associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs + /// + /// + /// Operation Id + /// DedicatedHsm_ListBySubscription + /// + /// + /// + /// Maximum number of results to return. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDedicatedHsms(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHsmResource(Client, DedicatedHsmData.DeserializeDedicatedHsmData(e)), DedicatedHsmClientDiagnostics, Pipeline, "MockableHardwareSecurityModulesSubscriptionResource.GetDedicatedHsms", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d0c2f2a63ad16..0000000000000 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HardwareSecurityModules -{ - /// 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 CloudHsmClusterResources in the ResourceGroupResource. - /// An object representing collection of CloudHsmClusterResources and their operations over a CloudHsmClusterResource. - public virtual CloudHsmClusterCollection GetCloudHsmClusters() - { - return GetCachedClient(Client => new CloudHsmClusterCollection(Client, Id)); - } - - /// Gets a collection of DedicatedHsmResources in the ResourceGroupResource. - /// An object representing collection of DedicatedHsmResources and their operations over a DedicatedHsmResource. - public virtual DedicatedHsmCollection GetDedicatedHsms() - { - return GetCachedClient(Client => new DedicatedHsmCollection(Client, Id)); - } - } -} diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 616ea4d5fbc2e..0000000000000 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HardwareSecurityModules -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _cloudHsmClusterClientDiagnostics; - private CloudHsmClustersRestOperations _cloudHsmClusterRestClient; - private ClientDiagnostics _dedicatedHsmClientDiagnostics; - private DedicatedHsmRestOperations _dedicatedHsmRestClient; - - /// 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 CloudHsmClusterClientDiagnostics => _cloudHsmClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HardwareSecurityModules", CloudHsmClusterResource.ResourceType.Namespace, Diagnostics); - private CloudHsmClustersRestOperations CloudHsmClusterRestClient => _cloudHsmClusterRestClient ??= new CloudHsmClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CloudHsmClusterResource.ResourceType)); - private ClientDiagnostics DedicatedHsmClientDiagnostics => _dedicatedHsmClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HardwareSecurityModules", DedicatedHsmResource.ResourceType.Namespace, Diagnostics); - private DedicatedHsmRestOperations DedicatedHsmRestClient => _dedicatedHsmRestClient ??= new DedicatedHsmRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DedicatedHsmResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// The List operation gets information about the Cloud HSM Clusters associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters - /// - /// - /// Operation Id - /// CloudHsmClusters_ListBySubscription - /// - /// - /// - /// The page-continuation token to use with a paged version of this API. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCloudHsmClustersAsync(string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CloudHsmClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudHsmClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudHsmClusterResource(Client, CloudHsmClusterData.DeserializeCloudHsmClusterData(e)), CloudHsmClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCloudHsmClusters", "value", "nextLink", cancellationToken); - } - - /// - /// The List operation gets information about the Cloud HSM Clusters associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters - /// - /// - /// Operation Id - /// CloudHsmClusters_ListBySubscription - /// - /// - /// - /// The page-continuation token to use with a paged version of this API. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCloudHsmClusters(string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CloudHsmClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudHsmClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudHsmClusterResource(Client, CloudHsmClusterData.DeserializeCloudHsmClusterData(e)), CloudHsmClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCloudHsmClusters", "value", "nextLink", cancellationToken); - } - - /// - /// The List operation gets information about the dedicated HSMs associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs - /// - /// - /// Operation Id - /// DedicatedHsm_ListBySubscription - /// - /// - /// - /// Maximum number of results to return. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDedicatedHsmsAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHsmResource(Client, DedicatedHsmData.DeserializeDedicatedHsmData(e)), DedicatedHsmClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedHsms", "value", "nextLink", cancellationToken); - } - - /// - /// The List operation gets information about the dedicated HSMs associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs - /// - /// - /// Operation Id - /// DedicatedHsm_ListBySubscription - /// - /// - /// - /// Maximum number of results to return. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDedicatedHsms(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHsmResource(Client, DedicatedHsmData.DeserializeDedicatedHsmData(e)), DedicatedHsmClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedHsms", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/HardwareSecurityModulesPrivateEndpointConnectionResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/HardwareSecurityModulesPrivateEndpointConnectionResource.cs index 7a8f6b7961510..35a7ff4b74729 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/HardwareSecurityModulesPrivateEndpointConnectionResource.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/HardwareSecurityModulesPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HardwareSecurityModules public partial class HardwareSecurityModulesPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cloudHsmClusterName. + /// The peConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cloudHsmClusterName, string peConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}"; diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/api/Azure.ResourceManager.HDInsight.Containers.netstandard2.0.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/api/Azure.ResourceManager.HDInsight.Containers.netstandard2.0.cs index 580abce4e55f0..c77ba5e0851bc 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/api/Azure.ResourceManager.HDInsight.Containers.netstandard2.0.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/api/Azure.ResourceManager.HDInsight.Containers.netstandard2.0.cs @@ -19,7 +19,7 @@ protected HDInsightClusterCollection() { } } public partial class HDInsightClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public HDInsightClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HDInsightClusterData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HDInsight.Containers.Models.ClusterProfile ClusterProfile { get { throw null; } set { } } public string ClusterType { get { throw null; } set { } } public System.Collections.Generic.IList ComputeNodes { get { throw null; } set { } } @@ -46,7 +46,7 @@ protected HDInsightClusterPoolCollection() { } } public partial class HDInsightClusterPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public HDInsightClusterPoolData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HDInsightClusterPoolData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HDInsight.Containers.Models.AksClusterProfile AksClusterProfile { get { throw null; } } public string AksManagedResourceGroupName { get { throw null; } } public string ClusterPoolVersion { get { throw null; } set { } } @@ -130,6 +130,34 @@ public static partial class HDInsightContainersExtensions public static Azure.ResourceManager.HDInsight.Containers.HDInsightClusterResource GetHDInsightClusterResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } } +namespace Azure.ResourceManager.HDInsight.Containers.Mocking +{ + public partial class MockableHDInsightContainersArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHDInsightContainersArmClient() { } + public virtual Azure.ResourceManager.HDInsight.Containers.HDInsightClusterPoolResource GetHDInsightClusterPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HDInsight.Containers.HDInsightClusterResource GetHDInsightClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHDInsightContainersResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHDInsightContainersResourceGroupResource() { } + public virtual Azure.Response GetHDInsightClusterPool(string clusterPoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHDInsightClusterPoolAsync(string clusterPoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HDInsight.Containers.HDInsightClusterPoolCollection GetHDInsightClusterPools() { throw null; } + } + public partial class MockableHDInsightContainersSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHDInsightContainersSubscriptionResource() { } + public virtual Azure.Response CheckHDInsightNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.HDInsight.Containers.Models.HDInsightNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckHDInsightNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.HDInsight.Containers.Models.HDInsightNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableClusterPoolVersionsByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableClusterPoolVersionsByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableClusterVersionsByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableClusterVersionsByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHDInsightClusterPools(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHDInsightClusterPoolsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.HDInsight.Containers.Models { public partial class AksClusterProfile @@ -335,7 +363,7 @@ public ClusterProfile(string clusterVersion, string ossVersion, Azure.ResourceMa } public partial class ClusterResizeContent : Azure.ResourceManager.Models.TrackedResourceData { - public ClusterResizeContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ClusterResizeContent(Azure.Core.AzureLocation location) { } public int? TargetWorkerNodeCount { get { throw null; } set { } } } public partial class ClusterSecretReference @@ -461,7 +489,7 @@ public FlinkStorageProfile(string storageUriString) { } } public partial class HDInsightClusterPatch : Azure.ResourceManager.Models.TrackedResourceData { - public HDInsightClusterPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HDInsightClusterPatch(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HDInsight.Containers.Models.UpdatableClusterProfile ClusterProfile { get { throw null; } set { } } } public partial class HDInsightClusterPoolPatch diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/HDInsightContainersExtensions.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/HDInsightContainersExtensions.cs index c4b7b4dcb7178..ae8f9e12094c8 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/HDInsightContainersExtensions.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/HDInsightContainersExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.HDInsight.Containers.Mocking; using Azure.ResourceManager.HDInsight.Containers.Models; using Azure.ResourceManager.Resources; @@ -19,81 +20,65 @@ namespace Azure.ResourceManager.HDInsight.Containers /// A class to add extension methods to Azure.ResourceManager.HDInsight.Containers. public static partial class HDInsightContainersExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableHDInsightContainersArmClient GetMockableHDInsightContainersArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHDInsightContainersArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableHDInsightContainersResourceGroupResource GetMockableHDInsightContainersResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableHDInsightContainersResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableHDInsightContainersSubscriptionResource GetMockableHDInsightContainersSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableHDInsightContainersSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region HDInsightClusterPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HDInsightClusterPoolResource GetHDInsightClusterPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HDInsightClusterPoolResource.ValidateResourceId(id); - return new HDInsightClusterPoolResource(client, id); - } - ); + return GetMockableHDInsightContainersArmClient(client).GetHDInsightClusterPoolResource(id); } - #endregion - #region HDInsightClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HDInsightClusterResource GetHDInsightClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HDInsightClusterResource.ValidateResourceId(id); - return new HDInsightClusterResource(client, id); - } - ); + return GetMockableHDInsightContainersArmClient(client).GetHDInsightClusterResource(id); } - #endregion - /// Gets a collection of HDInsightClusterPoolResources in the ResourceGroupResource. + /// + /// Gets a collection of HDInsightClusterPoolResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HDInsightClusterPoolResources and their operations over a HDInsightClusterPoolResource. public static HDInsightClusterPoolCollection GetHDInsightClusterPools(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHDInsightClusterPools(); + return GetMockableHDInsightContainersResourceGroupResource(resourceGroupResource).GetHDInsightClusterPools(); } /// @@ -108,16 +93,20 @@ public static HDInsightClusterPoolCollection GetHDInsightClusterPools(this Resou /// ClusterPools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHDInsightClusterPoolAsync(this ResourceGroupResource resourceGroupResource, string clusterPoolName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHDInsightClusterPools().GetAsync(clusterPoolName, cancellationToken).ConfigureAwait(false); + return await GetMockableHDInsightContainersResourceGroupResource(resourceGroupResource).GetHDInsightClusterPoolAsync(clusterPoolName, cancellationToken).ConfigureAwait(false); } /// @@ -132,16 +121,20 @@ public static async Task> GetHDInsightClu /// ClusterPools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHDInsightClusterPool(this ResourceGroupResource resourceGroupResource, string clusterPoolName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHDInsightClusterPools().Get(clusterPoolName, cancellationToken); + return GetMockableHDInsightContainersResourceGroupResource(resourceGroupResource).GetHDInsightClusterPool(clusterPoolName, cancellationToken); } /// @@ -156,13 +149,17 @@ public static Response GetHDInsightClusterPool(thi /// ClusterPools_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHDInsightClusterPoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightClusterPoolsAsync(cancellationToken); + return GetMockableHDInsightContainersSubscriptionResource(subscriptionResource).GetHDInsightClusterPoolsAsync(cancellationToken); } /// @@ -177,13 +174,17 @@ public static AsyncPageable GetHDInsightClusterPoo /// ClusterPools_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHDInsightClusterPools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightClusterPools(cancellationToken); + return GetMockableHDInsightContainersSubscriptionResource(subscriptionResource).GetHDInsightClusterPools(cancellationToken); } /// @@ -198,6 +199,10 @@ public static Pageable GetHDInsightClusterPools(th /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure region. @@ -206,9 +211,7 @@ public static Pageable GetHDInsightClusterPools(th /// is null. public static async Task> CheckHDInsightNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckHDInsightNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableHDInsightContainersSubscriptionResource(subscriptionResource).CheckHDInsightNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -223,6 +226,10 @@ public static async Task> CheckHDInsig /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure region. @@ -231,9 +238,7 @@ public static async Task> CheckHDInsig /// is null. public static Response CheckHDInsightNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckHDInsightNameAvailability(location, content, cancellationToken); + return GetMockableHDInsightContainersSubscriptionResource(subscriptionResource).CheckHDInsightNameAvailability(location, content, cancellationToken); } /// @@ -248,6 +253,10 @@ public static Response CheckHDInsightNameAvaila /// AvailableClusterPoolVersions_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure region. @@ -255,7 +264,7 @@ public static Response CheckHDInsightNameAvaila /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableClusterPoolVersionsByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableClusterPoolVersionsByLocationAsync(location, cancellationToken); + return GetMockableHDInsightContainersSubscriptionResource(subscriptionResource).GetAvailableClusterPoolVersionsByLocationAsync(location, cancellationToken); } /// @@ -270,6 +279,10 @@ public static AsyncPageable GetAvailableClusterPoolVersionsB /// AvailableClusterPoolVersions_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure region. @@ -277,7 +290,7 @@ public static AsyncPageable GetAvailableClusterPoolVersionsB /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableClusterPoolVersionsByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableClusterPoolVersionsByLocation(location, cancellationToken); + return GetMockableHDInsightContainersSubscriptionResource(subscriptionResource).GetAvailableClusterPoolVersionsByLocation(location, cancellationToken); } /// @@ -292,6 +305,10 @@ public static Pageable GetAvailableClusterPoolVersionsByLoca /// AvailableClusterVersions_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure region. @@ -299,7 +316,7 @@ public static Pageable GetAvailableClusterPoolVersionsByLoca /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableClusterVersionsByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableClusterVersionsByLocationAsync(location, cancellationToken); + return GetMockableHDInsightContainersSubscriptionResource(subscriptionResource).GetAvailableClusterVersionsByLocationAsync(location, cancellationToken); } /// @@ -314,6 +331,10 @@ public static AsyncPageable GetAvailableClusterVersions /// AvailableClusterVersions_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure region. @@ -321,7 +342,7 @@ public static AsyncPageable GetAvailableClusterVersions /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableClusterVersionsByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableClusterVersionsByLocation(location, cancellationToken); + return GetMockableHDInsightContainersSubscriptionResource(subscriptionResource).GetAvailableClusterVersionsByLocation(location, cancellationToken); } } } diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersArmClient.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersArmClient.cs new file mode 100644 index 0000000000000..8997785da8d69 --- /dev/null +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.HDInsight.Containers; + +namespace Azure.ResourceManager.HDInsight.Containers.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHDInsightContainersArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHDInsightContainersArmClient() + { + } + + /// 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 MockableHDInsightContainersArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHDInsightContainersArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HDInsightClusterPoolResource GetHDInsightClusterPoolResource(ResourceIdentifier id) + { + HDInsightClusterPoolResource.ValidateResourceId(id); + return new HDInsightClusterPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HDInsightClusterResource GetHDInsightClusterResource(ResourceIdentifier id) + { + HDInsightClusterResource.ValidateResourceId(id); + return new HDInsightClusterResource(Client, id); + } + } +} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersResourceGroupResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersResourceGroupResource.cs new file mode 100644 index 0000000000000..4b301bbcd2c69 --- /dev/null +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.HDInsight.Containers; + +namespace Azure.ResourceManager.HDInsight.Containers.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHDInsightContainersResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHDInsightContainersResourceGroupResource() + { + } + + /// 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 MockableHDInsightContainersResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of HDInsightClusterPoolResources in the ResourceGroupResource. + /// An object representing collection of HDInsightClusterPoolResources and their operations over a HDInsightClusterPoolResource. + public virtual HDInsightClusterPoolCollection GetHDInsightClusterPools() + { + return GetCachedClient(client => new HDInsightClusterPoolCollection(client, Id)); + } + + /// + /// Gets a cluster pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName} + /// + /// + /// Operation Id + /// ClusterPools_Get + /// + /// + /// + /// The name of the cluster pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHDInsightClusterPoolAsync(string clusterPoolName, CancellationToken cancellationToken = default) + { + return await GetHDInsightClusterPools().GetAsync(clusterPoolName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a cluster pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName} + /// + /// + /// Operation Id + /// ClusterPools_Get + /// + /// + /// + /// The name of the cluster pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHDInsightClusterPool(string clusterPoolName, CancellationToken cancellationToken = default) + { + return GetHDInsightClusterPools().Get(clusterPoolName, cancellationToken); + } + } +} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersSubscriptionResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersSubscriptionResource.cs new file mode 100644 index 0000000000000..5337cdc448c3e --- /dev/null +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/MockableHDInsightContainersSubscriptionResource.cs @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HDInsight.Containers; +using Azure.ResourceManager.HDInsight.Containers.Models; + +namespace Azure.ResourceManager.HDInsight.Containers.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHDInsightContainersSubscriptionResource : ArmResource + { + private ClientDiagnostics _hdInsightClusterPoolClusterPoolsClientDiagnostics; + private ClusterPoolsRestOperations _hdInsightClusterPoolClusterPoolsRestClient; + private ClientDiagnostics _locationsClientDiagnostics; + private LocationsRestOperations _locationsRestClient; + private ClientDiagnostics _availableClusterPoolVersionsClientDiagnostics; + private AvailableClusterPoolVersionsRestOperations _availableClusterPoolVersionsRestClient; + private ClientDiagnostics _availableClusterVersionsClientDiagnostics; + private AvailableClusterVersionsRestOperations _availableClusterVersionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHDInsightContainersSubscriptionResource() + { + } + + /// 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 MockableHDInsightContainersSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics HDInsightClusterPoolClusterPoolsClientDiagnostics => _hdInsightClusterPoolClusterPoolsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight.Containers", HDInsightClusterPoolResource.ResourceType.Namespace, Diagnostics); + private ClusterPoolsRestOperations HDInsightClusterPoolClusterPoolsRestClient => _hdInsightClusterPoolClusterPoolsRestClient ??= new ClusterPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HDInsightClusterPoolResource.ResourceType)); + private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight.Containers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AvailableClusterPoolVersionsClientDiagnostics => _availableClusterPoolVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight.Containers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableClusterPoolVersionsRestOperations AvailableClusterPoolVersionsRestClient => _availableClusterPoolVersionsRestClient ??= new AvailableClusterPoolVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AvailableClusterVersionsClientDiagnostics => _availableClusterVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight.Containers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableClusterVersionsRestOperations AvailableClusterVersionsRestClient => _availableClusterVersionsRestClient ??= new AvailableClusterVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the list of Cluster Pools within a Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusterpools + /// + /// + /// Operation Id + /// ClusterPools_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHDInsightClusterPoolsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HDInsightClusterPoolClusterPoolsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HDInsightClusterPoolClusterPoolsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HDInsightClusterPoolResource(Client, HDInsightClusterPoolData.DeserializeHDInsightClusterPoolData(e)), HDInsightClusterPoolClusterPoolsClientDiagnostics, Pipeline, "MockableHDInsightContainersSubscriptionResource.GetHDInsightClusterPools", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Cluster Pools within a Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusterpools + /// + /// + /// Operation Id + /// ClusterPools_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHDInsightClusterPools(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HDInsightClusterPoolClusterPoolsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HDInsightClusterPoolClusterPoolsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HDInsightClusterPoolResource(Client, HDInsightClusterPoolData.DeserializeHDInsightClusterPoolData(e)), HDInsightClusterPoolClusterPoolsClientDiagnostics, Pipeline, "MockableHDInsightContainersSubscriptionResource.GetHDInsightClusterPools", "value", "nextLink", cancellationToken); + } + + /// + /// Check the availability of the resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// The name of the Azure region. + /// The name and type of the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckHDInsightNameAvailabilityAsync(AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightContainersSubscriptionResource.CheckHDInsightNameAvailability"); + scope.Start(); + try + { + var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of the resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// The name of the Azure region. + /// The name and type of the resource. + /// The cancellation token to use. + /// is null. + public virtual Response CheckHDInsightNameAvailability(AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightContainersSubscriptionResource.CheckHDInsightNameAvailability"); + scope.Start(); + try + { + var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns a list of available cluster pool versions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterPoolVersions + /// + /// + /// Operation Id + /// AvailableClusterPoolVersions_ListByLocation + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableClusterPoolVersionsByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableClusterPoolVersionsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableClusterPoolVersionsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ClusterPoolVersion.DeserializeClusterPoolVersion, AvailableClusterPoolVersionsClientDiagnostics, Pipeline, "MockableHDInsightContainersSubscriptionResource.GetAvailableClusterPoolVersionsByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of available cluster pool versions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterPoolVersions + /// + /// + /// Operation Id + /// AvailableClusterPoolVersions_ListByLocation + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableClusterPoolVersionsByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableClusterPoolVersionsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableClusterPoolVersionsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ClusterPoolVersion.DeserializeClusterPoolVersion, AvailableClusterPoolVersionsClientDiagnostics, Pipeline, "MockableHDInsightContainersSubscriptionResource.GetAvailableClusterPoolVersionsByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of available cluster versions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterVersions + /// + /// + /// Operation Id + /// AvailableClusterVersions_ListByLocation + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableClusterVersionsByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableClusterVersionsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableClusterVersionsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, HDInsightClusterVersion.DeserializeHDInsightClusterVersion, AvailableClusterVersionsClientDiagnostics, Pipeline, "MockableHDInsightContainersSubscriptionResource.GetAvailableClusterVersionsByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of available cluster versions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterVersions + /// + /// + /// Operation Id + /// AvailableClusterVersions_ListByLocation + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableClusterVersionsByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableClusterVersionsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableClusterVersionsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, HDInsightClusterVersion.DeserializeHDInsightClusterVersion, AvailableClusterVersionsClientDiagnostics, Pipeline, "MockableHDInsightContainersSubscriptionResource.GetAvailableClusterVersionsByLocation", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3eeaf0da54ea5..0000000000000 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HDInsight.Containers -{ - /// 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 HDInsightClusterPoolResources in the ResourceGroupResource. - /// An object representing collection of HDInsightClusterPoolResources and their operations over a HDInsightClusterPoolResource. - public virtual HDInsightClusterPoolCollection GetHDInsightClusterPools() - { - return GetCachedClient(Client => new HDInsightClusterPoolCollection(Client, Id)); - } - } -} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 2ad106dbe68d6..0000000000000 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.HDInsight.Containers.Models; - -namespace Azure.ResourceManager.HDInsight.Containers -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _hdInsightClusterPoolClusterPoolsClientDiagnostics; - private ClusterPoolsRestOperations _hdInsightClusterPoolClusterPoolsRestClient; - private ClientDiagnostics _locationsClientDiagnostics; - private LocationsRestOperations _locationsRestClient; - private ClientDiagnostics _availableClusterPoolVersionsClientDiagnostics; - private AvailableClusterPoolVersionsRestOperations _availableClusterPoolVersionsRestClient; - private ClientDiagnostics _availableClusterVersionsClientDiagnostics; - private AvailableClusterVersionsRestOperations _availableClusterVersionsRestClient; - - /// 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 HDInsightClusterPoolClusterPoolsClientDiagnostics => _hdInsightClusterPoolClusterPoolsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight.Containers", HDInsightClusterPoolResource.ResourceType.Namespace, Diagnostics); - private ClusterPoolsRestOperations HDInsightClusterPoolClusterPoolsRestClient => _hdInsightClusterPoolClusterPoolsRestClient ??= new ClusterPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HDInsightClusterPoolResource.ResourceType)); - private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight.Containers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AvailableClusterPoolVersionsClientDiagnostics => _availableClusterPoolVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight.Containers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableClusterPoolVersionsRestOperations AvailableClusterPoolVersionsRestClient => _availableClusterPoolVersionsRestClient ??= new AvailableClusterPoolVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AvailableClusterVersionsClientDiagnostics => _availableClusterVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight.Containers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableClusterVersionsRestOperations AvailableClusterVersionsRestClient => _availableClusterVersionsRestClient ??= new AvailableClusterVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the list of Cluster Pools within a Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusterpools - /// - /// - /// Operation Id - /// ClusterPools_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHDInsightClusterPoolsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HDInsightClusterPoolClusterPoolsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HDInsightClusterPoolClusterPoolsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HDInsightClusterPoolResource(Client, HDInsightClusterPoolData.DeserializeHDInsightClusterPoolData(e)), HDInsightClusterPoolClusterPoolsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHDInsightClusterPools", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Cluster Pools within a Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusterpools - /// - /// - /// Operation Id - /// ClusterPools_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHDInsightClusterPools(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HDInsightClusterPoolClusterPoolsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HDInsightClusterPoolClusterPoolsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HDInsightClusterPoolResource(Client, HDInsightClusterPoolData.DeserializeHDInsightClusterPoolData(e)), HDInsightClusterPoolClusterPoolsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHDInsightClusterPools", "value", "nextLink", cancellationToken); - } - - /// - /// Check the availability of the resource name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// The name of the Azure region. - /// The name and type of the resource. - /// The cancellation token to use. - public virtual async Task> CheckHDInsightNameAvailabilityAsync(AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckHDInsightNameAvailability"); - scope.Start(); - try - { - var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of the resource name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// The name of the Azure region. - /// The name and type of the resource. - /// The cancellation token to use. - public virtual Response CheckHDInsightNameAvailability(AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckHDInsightNameAvailability"); - scope.Start(); - try - { - var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns a list of available cluster pool versions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterPoolVersions - /// - /// - /// Operation Id - /// AvailableClusterPoolVersions_ListByLocation - /// - /// - /// - /// The name of the Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableClusterPoolVersionsByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableClusterPoolVersionsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableClusterPoolVersionsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ClusterPoolVersion.DeserializeClusterPoolVersion, AvailableClusterPoolVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableClusterPoolVersionsByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of available cluster pool versions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterPoolVersions - /// - /// - /// Operation Id - /// AvailableClusterPoolVersions_ListByLocation - /// - /// - /// - /// The name of the Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableClusterPoolVersionsByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableClusterPoolVersionsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableClusterPoolVersionsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ClusterPoolVersion.DeserializeClusterPoolVersion, AvailableClusterPoolVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableClusterPoolVersionsByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of available cluster versions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterVersions - /// - /// - /// Operation Id - /// AvailableClusterVersions_ListByLocation - /// - /// - /// - /// The name of the Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableClusterVersionsByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableClusterVersionsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableClusterVersionsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, HDInsightClusterVersion.DeserializeHDInsightClusterVersion, AvailableClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableClusterVersionsByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of available cluster versions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/availableClusterVersions - /// - /// - /// Operation Id - /// AvailableClusterVersions_ListByLocation - /// - /// - /// - /// The name of the Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableClusterVersionsByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableClusterVersionsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableClusterVersionsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, HDInsightClusterVersion.DeserializeHDInsightClusterVersion, AvailableClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableClusterVersionsByLocation", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolResource.cs index fd1a76556a8e4..68fef87dca0e9 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolResource.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HDInsight.Containers public partial class HDInsightClusterPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HDInsightClusterResources and their operations over a HDInsightClusterResource. public virtual HDInsightClusterCollection GetHDInsightClusters() { - return GetCachedClient(Client => new HDInsightClusterCollection(Client, Id)); + return GetCachedClient(client => new HDInsightClusterCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual HDInsightClusterCollection GetHDInsightClusters() /// /// The name of the HDInsight cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHDInsightClusterAsync(string clusterName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetHDInsightCluste /// /// The name of the HDInsight cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHDInsightCluster(string clusterName, CancellationToken cancellationToken = default) { diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterResource.cs index c8592d4dd68f2..8e80e933aaeb1 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterResource.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.HDInsight.Containers public partial class HDInsightClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterPoolName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterPoolName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusterpools/{clusterPoolName}/clusters/{clusterName}"; diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/Azure.ResourceManager.HDInsight.sln b/sdk/hdinsight/Azure.ResourceManager.HDInsight/Azure.ResourceManager.HDInsight.sln index 02cc27ad89184..90ac513a09060 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/Azure.ResourceManager.HDInsight.sln +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/Azure.ResourceManager.HDInsight.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{CAFFAE84-F81C-40DA-A83C-A6C0D1E72ED7}") = "Azure.ResourceManager.HDInsight", "src\Azure.ResourceManager.HDInsight.csproj", "{50368825-D3CF-4A52-985F-509F81D018BC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HDInsight", "src\Azure.ResourceManager.HDInsight.csproj", "{50368825-D3CF-4A52-985F-509F81D018BC}" EndProject -Project("{CAFFAE84-F81C-40DA-A83C-A6C0D1E72ED7}") = "Azure.ResourceManager.HDInsight.Tests", "tests\Azure.ResourceManager.HDInsight.Tests.csproj", "{B73D1EEA-FEC2-4D30-B2ED-96E3AAA8475C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HDInsight.Tests", "tests\Azure.ResourceManager.HDInsight.Tests.csproj", "{B73D1EEA-FEC2-4D30-B2ED-96E3AAA8475C}" EndProject -Project("{CAFFAE84-F81C-40DA-A83C-A6C0D1E72ED7}") = "Azure.ResourceManager.HDInsight.Samples", "samples\Azure.ResourceManager.HDInsight.Samples.csproj", "{56b1958b-529b-4d6b-ba4f-395606f2ca61}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HDInsight.Samples", "samples\Azure.ResourceManager.HDInsight.Samples.csproj", "{56B1958B-529B-4D6B-BA4F-395606F2CA61}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A32A0E5C-5436-4BAC-BB88-36F9D5FE78D4} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {B73D1EEA-FEC2-4D30-B2ED-96E3AAA8475C}.Release|x64.Build.0 = Release|Any CPU {B73D1EEA-FEC2-4D30-B2ED-96E3AAA8475C}.Release|x86.ActiveCfg = Release|Any CPU {B73D1EEA-FEC2-4D30-B2ED-96E3AAA8475C}.Release|x86.Build.0 = Release|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Debug|Any CPU.Build.0 = Debug|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Debug|x64.ActiveCfg = Debug|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Debug|x64.Build.0 = Debug|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Debug|x86.ActiveCfg = Debug|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Debug|x86.Build.0 = Debug|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Release|Any CPU.Build.0 = Release|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Release|x64.ActiveCfg = Release|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Release|x64.Build.0 = Release|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Release|x86.ActiveCfg = Release|Any CPU + {56B1958B-529B-4D6B-BA4F-395606F2CA61}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A32A0E5C-5436-4BAC-BB88-36F9D5FE78D4} EndGlobalSection EndGlobal diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/api/Azure.ResourceManager.HDInsight.netstandard2.0.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/api/Azure.ResourceManager.HDInsight.netstandard2.0.cs index c4db5c3dd7207..57a4bd18190dd 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/api/Azure.ResourceManager.HDInsight.netstandard2.0.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/api/Azure.ResourceManager.HDInsight.netstandard2.0.cs @@ -65,7 +65,7 @@ protected HDInsightClusterCollection() { } } public partial class HDInsightClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public HDInsightClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HDInsightClusterData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.HDInsight.Models.HDInsightClusterProperties Properties { get { throw null; } set { } } @@ -254,6 +254,40 @@ public HDInsightPrivateLinkResourceData() { } public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } } } +namespace Azure.ResourceManager.HDInsight.Mocking +{ + public partial class MockableHDInsightArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHDInsightArmClient() { } + public virtual Azure.ResourceManager.HDInsight.HDInsightApplicationResource GetHDInsightApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HDInsight.HDInsightClusterResource GetHDInsightClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HDInsight.HDInsightPrivateEndpointConnectionResource GetHDInsightPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HDInsight.HDInsightPrivateLinkResource GetHDInsightPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHDInsightResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHDInsightResourceGroupResource() { } + public virtual Azure.Response GetHDInsightCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHDInsightClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HDInsight.HDInsightClusterCollection GetHDInsightClusters() { throw null; } + } + public partial class MockableHDInsightSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHDInsightSubscriptionResource() { } + public virtual Azure.Response CheckHDInsightNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.HDInsight.Models.HDInsightNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckHDInsightNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.HDInsight.Models.HDInsightNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetHDInsightBillingSpecs(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHDInsightBillingSpecsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetHDInsightCapabilities(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHDInsightCapabilitiesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHDInsightClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHDInsightClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHDInsightUsages(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHDInsightUsagesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ValidateHDInsightClusterCreation(Azure.Core.AzureLocation location, Azure.ResourceManager.HDInsight.Models.HDInsightClusterCreationValidateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateHDInsightClusterCreationAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.HDInsight.Models.HDInsightClusterCreationValidateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.HDInsight.Models { public static partial class ArmHDInsightModelFactory diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/HDInsightExtensions.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/HDInsightExtensions.cs index cd9ce4463aac9..fddd85aae961d 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/HDInsightExtensions.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/HDInsightExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.HDInsight.Mocking; using Azure.ResourceManager.HDInsight.Models; using Azure.ResourceManager.Resources; @@ -19,119 +20,97 @@ namespace Azure.ResourceManager.HDInsight /// A class to add extension methods to Azure.ResourceManager.HDInsight. public static partial class HDInsightExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableHDInsightArmClient GetMockableHDInsightArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHDInsightArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableHDInsightResourceGroupResource GetMockableHDInsightResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableHDInsightResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableHDInsightSubscriptionResource GetMockableHDInsightSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableHDInsightSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region HDInsightApplicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HDInsightApplicationResource GetHDInsightApplicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HDInsightApplicationResource.ValidateResourceId(id); - return new HDInsightApplicationResource(client, id); - } - ); + return GetMockableHDInsightArmClient(client).GetHDInsightApplicationResource(id); } - #endregion - #region HDInsightClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HDInsightClusterResource GetHDInsightClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HDInsightClusterResource.ValidateResourceId(id); - return new HDInsightClusterResource(client, id); - } - ); + return GetMockableHDInsightArmClient(client).GetHDInsightClusterResource(id); } - #endregion - #region HDInsightPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HDInsightPrivateEndpointConnectionResource GetHDInsightPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HDInsightPrivateEndpointConnectionResource.ValidateResourceId(id); - return new HDInsightPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableHDInsightArmClient(client).GetHDInsightPrivateEndpointConnectionResource(id); } - #endregion - #region HDInsightPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HDInsightPrivateLinkResource GetHDInsightPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HDInsightPrivateLinkResource.ValidateResourceId(id); - return new HDInsightPrivateLinkResource(client, id); - } - ); + return GetMockableHDInsightArmClient(client).GetHDInsightPrivateLinkResource(id); } - #endregion - /// Gets a collection of HDInsightClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of HDInsightClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HDInsightClusterResources and their operations over a HDInsightClusterResource. public static HDInsightClusterCollection GetHDInsightClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHDInsightClusters(); + return GetMockableHDInsightResourceGroupResource(resourceGroupResource).GetHDInsightClusters(); } /// @@ -146,16 +125,20 @@ public static HDInsightClusterCollection GetHDInsightClusters(this ResourceGroup /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHDInsightClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHDInsightClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableHDInsightResourceGroupResource(resourceGroupResource).GetHDInsightClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -170,16 +153,20 @@ public static async Task> GetHDInsightCluster /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHDInsightCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHDInsightClusters().Get(clusterName, cancellationToken); + return GetMockableHDInsightResourceGroupResource(resourceGroupResource).GetHDInsightCluster(clusterName, cancellationToken); } /// @@ -194,13 +181,17 @@ public static Response GetHDInsightCluster(this Resour /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHDInsightClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightClustersAsync(cancellationToken); + return GetMockableHDInsightSubscriptionResource(subscriptionResource).GetHDInsightClustersAsync(cancellationToken); } /// @@ -215,13 +206,17 @@ public static AsyncPageable GetHDInsightClustersAsync( /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHDInsightClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightClusters(cancellationToken); + return GetMockableHDInsightSubscriptionResource(subscriptionResource).GetHDInsightClusters(cancellationToken); } /// @@ -236,13 +231,17 @@ public static Pageable GetHDInsightClusters(this Subsc /// Locations_GetCapabilities /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. /// The cancellation token to use. public static async Task> GetHDInsightCapabilitiesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightCapabilitiesAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableHDInsightSubscriptionResource(subscriptionResource).GetHDInsightCapabilitiesAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -257,13 +256,17 @@ public static async Task> GetHDInsightCapa /// Locations_GetCapabilities /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. /// The cancellation token to use. public static Response GetHDInsightCapabilities(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightCapabilities(location, cancellationToken); + return GetMockableHDInsightSubscriptionResource(subscriptionResource).GetHDInsightCapabilities(location, cancellationToken); } /// @@ -278,6 +281,10 @@ public static Response GetHDInsightCapabilities(thi /// Locations_ListUsages /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. @@ -285,7 +292,7 @@ public static Response GetHDInsightCapabilities(thi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetHDInsightUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightUsagesAsync(location, cancellationToken); + return GetMockableHDInsightSubscriptionResource(subscriptionResource).GetHDInsightUsagesAsync(location, cancellationToken); } /// @@ -300,6 +307,10 @@ public static AsyncPageable GetHDInsightUsagesAsync(this Subscri /// Locations_ListUsages /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. @@ -307,7 +318,7 @@ public static AsyncPageable GetHDInsightUsagesAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetHDInsightUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightUsages(location, cancellationToken); + return GetMockableHDInsightSubscriptionResource(subscriptionResource).GetHDInsightUsages(location, cancellationToken); } /// @@ -322,13 +333,17 @@ public static Pageable GetHDInsightUsages(this SubscriptionResou /// Locations_ListBillingSpecs /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. /// The cancellation token to use. public static async Task> GetHDInsightBillingSpecsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightBillingSpecsAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableHDInsightSubscriptionResource(subscriptionResource).GetHDInsightBillingSpecsAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -343,13 +358,17 @@ public static async Task> GetHDInsight /// Locations_ListBillingSpecs /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. /// The cancellation token to use. public static Response GetHDInsightBillingSpecs(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHDInsightBillingSpecs(location, cancellationToken); + return GetMockableHDInsightSubscriptionResource(subscriptionResource).GetHDInsightBillingSpecs(location, cancellationToken); } /// @@ -364,6 +383,10 @@ public static Response GetHDInsightBillingSpecs /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. @@ -372,9 +395,7 @@ public static Response GetHDInsightBillingSpecs /// is null. public static async Task> CheckHDInsightNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckHDInsightNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableHDInsightSubscriptionResource(subscriptionResource).CheckHDInsightNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -389,6 +410,10 @@ public static async Task> CheckHDInsig /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. @@ -397,9 +422,7 @@ public static async Task> CheckHDInsig /// is null. public static Response CheckHDInsightNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckHDInsightNameAvailability(location, content, cancellationToken); + return GetMockableHDInsightSubscriptionResource(subscriptionResource).CheckHDInsightNameAvailability(location, content, cancellationToken); } /// @@ -414,6 +437,10 @@ public static Response CheckHDInsightNameAvaila /// Locations_ValidateClusterCreateRequest /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. @@ -422,9 +449,7 @@ public static Response CheckHDInsightNameAvaila /// is null. public static async Task> ValidateHDInsightClusterCreationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, HDInsightClusterCreationValidateContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateHDInsightClusterCreationAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableHDInsightSubscriptionResource(subscriptionResource).ValidateHDInsightClusterCreationAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -439,6 +464,10 @@ public static async Task> Valid /// Locations_ValidateClusterCreateRequest /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Azure location (region) for which to make the request. @@ -447,9 +476,7 @@ public static async Task> Valid /// is null. public static Response ValidateHDInsightClusterCreation(this SubscriptionResource subscriptionResource, AzureLocation location, HDInsightClusterCreationValidateContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateHDInsightClusterCreation(location, content, cancellationToken); + return GetMockableHDInsightSubscriptionResource(subscriptionResource).ValidateHDInsightClusterCreation(location, content, cancellationToken); } } } diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightArmClient.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightArmClient.cs new file mode 100644 index 0000000000000..32ab2daa2de8f --- /dev/null +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.HDInsight; + +namespace Azure.ResourceManager.HDInsight.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHDInsightArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHDInsightArmClient() + { + } + + /// 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 MockableHDInsightArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHDInsightArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HDInsightApplicationResource GetHDInsightApplicationResource(ResourceIdentifier id) + { + HDInsightApplicationResource.ValidateResourceId(id); + return new HDInsightApplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HDInsightClusterResource GetHDInsightClusterResource(ResourceIdentifier id) + { + HDInsightClusterResource.ValidateResourceId(id); + return new HDInsightClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HDInsightPrivateEndpointConnectionResource GetHDInsightPrivateEndpointConnectionResource(ResourceIdentifier id) + { + HDInsightPrivateEndpointConnectionResource.ValidateResourceId(id); + return new HDInsightPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HDInsightPrivateLinkResource GetHDInsightPrivateLinkResource(ResourceIdentifier id) + { + HDInsightPrivateLinkResource.ValidateResourceId(id); + return new HDInsightPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightResourceGroupResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightResourceGroupResource.cs new file mode 100644 index 0000000000000..0619240ef32f7 --- /dev/null +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.HDInsight; + +namespace Azure.ResourceManager.HDInsight.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHDInsightResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHDInsightResourceGroupResource() + { + } + + /// 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 MockableHDInsightResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of HDInsightClusterResources in the ResourceGroupResource. + /// An object representing collection of HDInsightClusterResources and their operations over a HDInsightClusterResource. + public virtual HDInsightClusterCollection GetHDInsightClusters() + { + return GetCachedClient(client => new HDInsightClusterCollection(client, Id)); + } + + /// + /// Gets the specified cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHDInsightClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetHDInsightClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHDInsightCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetHDInsightClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightSubscriptionResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightSubscriptionResource.cs new file mode 100644 index 0000000000000..565f6533b99d2 --- /dev/null +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/MockableHDInsightSubscriptionResource.cs @@ -0,0 +1,404 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HDInsight; +using Azure.ResourceManager.HDInsight.Models; + +namespace Azure.ResourceManager.HDInsight.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHDInsightSubscriptionResource : ArmResource + { + private ClientDiagnostics _hdInsightClusterClustersClientDiagnostics; + private ClustersRestOperations _hdInsightClusterClustersRestClient; + private ClientDiagnostics _locationsClientDiagnostics; + private LocationsRestOperations _locationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHDInsightSubscriptionResource() + { + } + + /// 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 MockableHDInsightSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics HDInsightClusterClustersClientDiagnostics => _hdInsightClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight", HDInsightClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations HDInsightClusterClustersRestClient => _hdInsightClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HDInsightClusterResource.ResourceType)); + private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all the HDInsight clusters under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHDInsightClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HDInsightClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HDInsightClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HDInsightClusterResource(Client, HDInsightClusterData.DeserializeHDInsightClusterData(e)), HDInsightClusterClustersClientDiagnostics, Pipeline, "MockableHDInsightSubscriptionResource.GetHDInsightClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the HDInsight clusters under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHDInsightClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HDInsightClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HDInsightClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HDInsightClusterResource(Client, HDInsightClusterData.DeserializeHDInsightClusterData(e)), HDInsightClusterClustersClientDiagnostics, Pipeline, "MockableHDInsightSubscriptionResource.GetHDInsightClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the capabilities for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities + /// + /// + /// Operation Id + /// Locations_GetCapabilities + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The cancellation token to use. + public virtual async Task> GetHDInsightCapabilitiesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightSubscriptionResource.GetHDInsightCapabilities"); + scope.Start(); + try + { + var response = await LocationsRestClient.GetCapabilitiesAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the capabilities for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities + /// + /// + /// Operation Id + /// Locations_GetCapabilities + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The cancellation token to use. + public virtual Response GetHDInsightCapabilities(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightSubscriptionResource.GetHDInsightCapabilities"); + scope.Start(); + try + { + var response = LocationsRestClient.GetCapabilities(Id.SubscriptionId, location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the usages for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages + /// + /// + /// Operation Id + /// Locations_ListUsages + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHDInsightUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationsRestClient.CreateListUsagesRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, HDInsightUsage.DeserializeHDInsightUsage, LocationsClientDiagnostics, Pipeline, "MockableHDInsightSubscriptionResource.GetHDInsightUsages", "value", null, cancellationToken); + } + + /// + /// Lists the usages for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages + /// + /// + /// Operation Id + /// Locations_ListUsages + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHDInsightUsages(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationsRestClient.CreateListUsagesRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, HDInsightUsage.DeserializeHDInsightUsage, LocationsClientDiagnostics, Pipeline, "MockableHDInsightSubscriptionResource.GetHDInsightUsages", "value", null, cancellationToken); + } + + /// + /// Lists the billingSpecs for the specified subscription and location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs + /// + /// + /// Operation Id + /// Locations_ListBillingSpecs + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The cancellation token to use. + public virtual async Task> GetHDInsightBillingSpecsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightSubscriptionResource.GetHDInsightBillingSpecs"); + scope.Start(); + try + { + var response = await LocationsRestClient.ListBillingSpecsAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the billingSpecs for the specified subscription and location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs + /// + /// + /// Operation Id + /// Locations_ListBillingSpecs + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The cancellation token to use. + public virtual Response GetHDInsightBillingSpecs(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightSubscriptionResource.GetHDInsightBillingSpecs"); + scope.Start(); + try + { + var response = LocationsRestClient.ListBillingSpecs(Id.SubscriptionId, location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the cluster name is available or not. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The HDInsightNameAvailabilityContent to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckHDInsightNameAvailabilityAsync(AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightSubscriptionResource.CheckHDInsightNameAvailability"); + scope.Start(); + try + { + var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the cluster name is available or not. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The HDInsightNameAvailabilityContent to use. + /// The cancellation token to use. + /// is null. + public virtual Response CheckHDInsightNameAvailability(AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightSubscriptionResource.CheckHDInsightNameAvailability"); + scope.Start(); + try + { + var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validate the cluster create request spec is valid or not. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest + /// + /// + /// Operation Id + /// Locations_ValidateClusterCreateRequest + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The HDInsightClusterCreationValidateContent to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateHDInsightClusterCreationAsync(AzureLocation location, HDInsightClusterCreationValidateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightSubscriptionResource.ValidateHDInsightClusterCreation"); + scope.Start(); + try + { + var response = await LocationsRestClient.ValidateClusterCreateRequestAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validate the cluster create request spec is valid or not. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest + /// + /// + /// Operation Id + /// Locations_ValidateClusterCreateRequest + /// + /// + /// + /// The Azure location (region) for which to make the request. + /// The HDInsightClusterCreationValidateContent to use. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateHDInsightClusterCreation(AzureLocation location, HDInsightClusterCreationValidateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableHDInsightSubscriptionResource.ValidateHDInsightClusterCreation"); + scope.Start(); + try + { + var response = LocationsRestClient.ValidateClusterCreateRequest(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 1155b189ff6c5..0000000000000 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HDInsight -{ - /// 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 HDInsightClusterResources in the ResourceGroupResource. - /// An object representing collection of HDInsightClusterResources and their operations over a HDInsightClusterResource. - public virtual HDInsightClusterCollection GetHDInsightClusters() - { - return GetCachedClient(Client => new HDInsightClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index a9fdaa7cfaa77..0000000000000 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,391 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.HDInsight.Models; - -namespace Azure.ResourceManager.HDInsight -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _hdInsightClusterClustersClientDiagnostics; - private ClustersRestOperations _hdInsightClusterClustersRestClient; - private ClientDiagnostics _locationsClientDiagnostics; - private LocationsRestOperations _locationsRestClient; - - /// 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 HDInsightClusterClustersClientDiagnostics => _hdInsightClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight", HDInsightClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations HDInsightClusterClustersRestClient => _hdInsightClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HDInsightClusterResource.ResourceType)); - private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HDInsight", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all the HDInsight clusters under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHDInsightClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HDInsightClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HDInsightClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HDInsightClusterResource(Client, HDInsightClusterData.DeserializeHDInsightClusterData(e)), HDInsightClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHDInsightClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the HDInsight clusters under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHDInsightClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HDInsightClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HDInsightClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HDInsightClusterResource(Client, HDInsightClusterData.DeserializeHDInsightClusterData(e)), HDInsightClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHDInsightClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the capabilities for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities - /// - /// - /// Operation Id - /// Locations_GetCapabilities - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The cancellation token to use. - public virtual async Task> GetHDInsightCapabilitiesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetHDInsightCapabilities"); - scope.Start(); - try - { - var response = await LocationsRestClient.GetCapabilitiesAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the capabilities for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities - /// - /// - /// Operation Id - /// Locations_GetCapabilities - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The cancellation token to use. - public virtual Response GetHDInsightCapabilities(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetHDInsightCapabilities"); - scope.Start(); - try - { - var response = LocationsRestClient.GetCapabilities(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the usages for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages - /// - /// - /// Operation Id - /// Locations_ListUsages - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHDInsightUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationsRestClient.CreateListUsagesRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, HDInsightUsage.DeserializeHDInsightUsage, LocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHDInsightUsages", "value", null, cancellationToken); - } - - /// - /// Lists the usages for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages - /// - /// - /// Operation Id - /// Locations_ListUsages - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHDInsightUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationsRestClient.CreateListUsagesRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, HDInsightUsage.DeserializeHDInsightUsage, LocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHDInsightUsages", "value", null, cancellationToken); - } - - /// - /// Lists the billingSpecs for the specified subscription and location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs - /// - /// - /// Operation Id - /// Locations_ListBillingSpecs - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The cancellation token to use. - public virtual async Task> GetHDInsightBillingSpecsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetHDInsightBillingSpecs"); - scope.Start(); - try - { - var response = await LocationsRestClient.ListBillingSpecsAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the billingSpecs for the specified subscription and location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs - /// - /// - /// Operation Id - /// Locations_ListBillingSpecs - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The cancellation token to use. - public virtual Response GetHDInsightBillingSpecs(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetHDInsightBillingSpecs"); - scope.Start(); - try - { - var response = LocationsRestClient.ListBillingSpecs(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the cluster name is available or not. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The HDInsightNameAvailabilityContent to use. - /// The cancellation token to use. - public virtual async Task> CheckHDInsightNameAvailabilityAsync(AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckHDInsightNameAvailability"); - scope.Start(); - try - { - var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the cluster name is available or not. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The HDInsightNameAvailabilityContent to use. - /// The cancellation token to use. - public virtual Response CheckHDInsightNameAvailability(AzureLocation location, HDInsightNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckHDInsightNameAvailability"); - scope.Start(); - try - { - var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Validate the cluster create request spec is valid or not. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest - /// - /// - /// Operation Id - /// Locations_ValidateClusterCreateRequest - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The HDInsightClusterCreationValidateContent to use. - /// The cancellation token to use. - public virtual async Task> ValidateHDInsightClusterCreationAsync(AzureLocation location, HDInsightClusterCreationValidateContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateHDInsightClusterCreation"); - scope.Start(); - try - { - var response = await LocationsRestClient.ValidateClusterCreateRequestAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Validate the cluster create request spec is valid or not. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest - /// - /// - /// Operation Id - /// Locations_ValidateClusterCreateRequest - /// - /// - /// - /// The Azure location (region) for which to make the request. - /// The HDInsightClusterCreationValidateContent to use. - /// The cancellation token to use. - public virtual Response ValidateHDInsightClusterCreation(AzureLocation location, HDInsightClusterCreationValidateContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateHDInsightClusterCreation"); - scope.Start(); - try - { - var response = LocationsRestClient.ValidateClusterCreateRequest(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightApplicationResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightApplicationResource.cs index 2ad884d0e6843..d7c14adb6040c 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightApplicationResource.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightApplicationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.HDInsight public partial class HDInsightApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"; diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterResource.cs index bcfffb23d6783..ed04d1f9e6735 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterResource.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.HDInsight public partial class HDInsightClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"; @@ -114,7 +117,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HDInsightApplicationResources and their operations over a HDInsightApplicationResource. public virtual HDInsightApplicationCollection GetHDInsightApplications() { - return GetCachedClient(Client => new HDInsightApplicationCollection(Client, Id)); + return GetCachedClient(client => new HDInsightApplicationCollection(client, Id)); } /// @@ -132,8 +135,8 @@ public virtual HDInsightApplicationCollection GetHDInsightApplications() /// /// The constant value for the application name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHDInsightApplicationAsync(string applicationName, CancellationToken cancellationToken = default) { @@ -155,8 +158,8 @@ public virtual async Task> GetHDInsightAp /// /// The constant value for the application name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHDInsightApplication(string applicationName, CancellationToken cancellationToken = default) { @@ -167,7 +170,7 @@ public virtual Response GetHDInsightApplication(st /// An object representing collection of HDInsightPrivateEndpointConnectionResources and their operations over a HDInsightPrivateEndpointConnectionResource. public virtual HDInsightPrivateEndpointConnectionCollection GetHDInsightPrivateEndpointConnections() { - return GetCachedClient(Client => new HDInsightPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new HDInsightPrivateEndpointConnectionCollection(client, Id)); } /// @@ -185,8 +188,8 @@ public virtual HDInsightPrivateEndpointConnectionCollection GetHDInsightPrivateE /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHDInsightPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -208,8 +211,8 @@ public virtual async Task> /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHDInsightPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -220,7 +223,7 @@ public virtual Response GetHDInsight /// An object representing collection of HDInsightPrivateLinkResources and their operations over a HDInsightPrivateLinkResource. public virtual HDInsightPrivateLinkResourceCollection GetHDInsightPrivateLinkResources() { - return GetCachedClient(Client => new HDInsightPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new HDInsightPrivateLinkResourceCollection(client, Id)); } /// @@ -238,8 +241,8 @@ public virtual HDInsightPrivateLinkResourceCollection GetHDInsightPrivateLinkRes /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHDInsightPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -261,8 +264,8 @@ public virtual async Task> GetHDInsightPr /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHDInsightPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateEndpointConnectionResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateEndpointConnectionResource.cs index 8a808dd5370e4..1c49f013d2224 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateEndpointConnectionResource.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HDInsight public partial class HDInsightPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateLinkResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateLinkResource.cs index cd5cf409e8eeb..f76b67925bdc5 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateLinkResource.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HDInsight public partial class HDInsightPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/api/Azure.ResourceManager.HealthBot.netstandard2.0.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/api/Azure.ResourceManager.HealthBot.netstandard2.0.cs index ffec54e43899d..96c58d0a5d5ad 100644 --- a/sdk/healthbot/Azure.ResourceManager.HealthBot/api/Azure.ResourceManager.HealthBot.netstandard2.0.cs +++ b/sdk/healthbot/Azure.ResourceManager.HealthBot/api/Azure.ResourceManager.HealthBot.netstandard2.0.cs @@ -19,7 +19,7 @@ protected HealthBotCollection() { } } public partial class HealthBotData : Azure.ResourceManager.Models.TrackedResourceData { - public HealthBotData(Azure.Core.AzureLocation location, Azure.ResourceManager.HealthBot.Models.HealthBotSku sku) : base (default(Azure.Core.AzureLocation)) { } + public HealthBotData(Azure.Core.AzureLocation location, Azure.ResourceManager.HealthBot.Models.HealthBotSku sku) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.HealthBot.Models.HealthBotProperties Properties { get { throw null; } set { } } public Azure.ResourceManager.HealthBot.Models.HealthBotSkuName? SkuName { get { throw null; } set { } } @@ -54,6 +54,27 @@ protected HealthBotResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HealthBot.Models.HealthBotPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.HealthBot.Mocking +{ + public partial class MockableHealthBotArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHealthBotArmClient() { } + public virtual Azure.ResourceManager.HealthBot.HealthBotResource GetHealthBotResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHealthBotResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHealthBotResourceGroupResource() { } + public virtual Azure.Response GetHealthBot(string botName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHealthBotAsync(string botName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HealthBot.HealthBotCollection GetHealthBots() { throw null; } + } + public partial class MockableHealthBotSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHealthBotSubscriptionResource() { } + public virtual Azure.Pageable GetHealthBots(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHealthBotsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.HealthBot.Models { public static partial class ArmHealthBotModelFactory diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/HealthBotExtensions.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/HealthBotExtensions.cs index e73640138de7c..62552b09be8fd 100644 --- a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/HealthBotExtensions.cs +++ b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/HealthBotExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.HealthBot.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.HealthBot @@ -18,62 +19,49 @@ namespace Azure.ResourceManager.HealthBot /// A class to add extension methods to Azure.ResourceManager.HealthBot. public static partial class HealthBotExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableHealthBotArmClient GetMockableHealthBotArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHealthBotArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableHealthBotResourceGroupResource GetMockableHealthBotResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableHealthBotResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableHealthBotSubscriptionResource GetMockableHealthBotSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableHealthBotSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region HealthBotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthBotResource GetHealthBotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthBotResource.ValidateResourceId(id); - return new HealthBotResource(client, id); - } - ); + return GetMockableHealthBotArmClient(client).GetHealthBotResource(id); } - #endregion - /// Gets a collection of HealthBotResources in the ResourceGroupResource. + /// + /// Gets a collection of HealthBotResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HealthBotResources and their operations over a HealthBotResource. public static HealthBotCollection GetHealthBots(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHealthBots(); + return GetMockableHealthBotResourceGroupResource(resourceGroupResource).GetHealthBots(); } /// @@ -88,16 +76,20 @@ public static HealthBotCollection GetHealthBots(this ResourceGroupResource resou /// Bots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Bot resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHealthBotAsync(this ResourceGroupResource resourceGroupResource, string botName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHealthBots().GetAsync(botName, cancellationToken).ConfigureAwait(false); + return await GetMockableHealthBotResourceGroupResource(resourceGroupResource).GetHealthBotAsync(botName, cancellationToken).ConfigureAwait(false); } /// @@ -112,16 +104,20 @@ public static async Task> GetHealthBotAsync(this Res /// Bots_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Bot resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHealthBot(this ResourceGroupResource resourceGroupResource, string botName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHealthBots().Get(botName, cancellationToken); + return GetMockableHealthBotResourceGroupResource(resourceGroupResource).GetHealthBot(botName, cancellationToken); } /// @@ -136,13 +132,17 @@ public static Response GetHealthBot(this ResourceGroupResourc /// Bots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHealthBotsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHealthBotsAsync(cancellationToken); + return GetMockableHealthBotSubscriptionResource(subscriptionResource).GetHealthBotsAsync(cancellationToken); } /// @@ -157,13 +157,17 @@ public static AsyncPageable GetHealthBotsAsync(this Subscript /// Bots_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHealthBots(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHealthBots(cancellationToken); + return GetMockableHealthBotSubscriptionResource(subscriptionResource).GetHealthBots(cancellationToken); } } } diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotArmClient.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotArmClient.cs new file mode 100644 index 0000000000000..6f284483509d1 --- /dev/null +++ b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.HealthBot; + +namespace Azure.ResourceManager.HealthBot.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHealthBotArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHealthBotArmClient() + { + } + + /// 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 MockableHealthBotArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHealthBotArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthBotResource GetHealthBotResource(ResourceIdentifier id) + { + HealthBotResource.ValidateResourceId(id); + return new HealthBotResource(Client, id); + } + } +} diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotResourceGroupResource.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotResourceGroupResource.cs new file mode 100644 index 0000000000000..25e9421a5ebc7 --- /dev/null +++ b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.HealthBot; + +namespace Azure.ResourceManager.HealthBot.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHealthBotResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHealthBotResourceGroupResource() + { + } + + /// 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 MockableHealthBotResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of HealthBotResources in the ResourceGroupResource. + /// An object representing collection of HealthBotResources and their operations over a HealthBotResource. + public virtual HealthBotCollection GetHealthBots() + { + return GetCachedClient(client => new HealthBotCollection(client, Id)); + } + + /// + /// Get a HealthBot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName} + /// + /// + /// Operation Id + /// Bots_Get + /// + /// + /// + /// The name of the Bot resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHealthBotAsync(string botName, CancellationToken cancellationToken = default) + { + return await GetHealthBots().GetAsync(botName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a HealthBot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName} + /// + /// + /// Operation Id + /// Bots_Get + /// + /// + /// + /// The name of the Bot resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHealthBot(string botName, CancellationToken cancellationToken = default) + { + return GetHealthBots().Get(botName, cancellationToken); + } + } +} diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotSubscriptionResource.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotSubscriptionResource.cs new file mode 100644 index 0000000000000..0c9b2518bdaae --- /dev/null +++ b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/MockableHealthBotSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HealthBot; + +namespace Azure.ResourceManager.HealthBot.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHealthBotSubscriptionResource : ArmResource + { + private ClientDiagnostics _healthBotBotsClientDiagnostics; + private BotsRestOperations _healthBotBotsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHealthBotSubscriptionResource() + { + } + + /// 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 MockableHealthBotSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics HealthBotBotsClientDiagnostics => _healthBotBotsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HealthBot", HealthBotResource.ResourceType.Namespace, Diagnostics); + private BotsRestOperations HealthBotBotsRestClient => _healthBotBotsRestClient ??= new BotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HealthBotResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots + /// + /// + /// Operation Id + /// Bots_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHealthBotsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HealthBotBotsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthBotBotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HealthBotResource(Client, HealthBotData.DeserializeHealthBotData(e)), HealthBotBotsClientDiagnostics, Pipeline, "MockableHealthBotSubscriptionResource.GetHealthBots", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all the resources of a particular type belonging to a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots + /// + /// + /// Operation Id + /// Bots_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHealthBots(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HealthBotBotsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthBotBotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HealthBotResource(Client, HealthBotData.DeserializeHealthBotData(e)), HealthBotBotsClientDiagnostics, Pipeline, "MockableHealthBotSubscriptionResource.GetHealthBots", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ac0fcbbffa600..0000000000000 --- a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HealthBot -{ - /// 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 HealthBotResources in the ResourceGroupResource. - /// An object representing collection of HealthBotResources and their operations over a HealthBotResource. - public virtual HealthBotCollection GetHealthBots() - { - return GetCachedClient(Client => new HealthBotCollection(Client, Id)); - } - } -} diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 08f6dc02f77f6..0000000000000 --- a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HealthBot -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _healthBotBotsClientDiagnostics; - private BotsRestOperations _healthBotBotsRestClient; - - /// 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 HealthBotBotsClientDiagnostics => _healthBotBotsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HealthBot", HealthBotResource.ResourceType.Namespace, Diagnostics); - private BotsRestOperations HealthBotBotsRestClient => _healthBotBotsRestClient ??= new BotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HealthBotResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots - /// - /// - /// Operation Id - /// Bots_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHealthBotsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HealthBotBotsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthBotBotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HealthBotResource(Client, HealthBotData.DeserializeHealthBotData(e)), HealthBotBotsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHealthBots", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all the resources of a particular type belonging to a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthBot/healthBots - /// - /// - /// Operation Id - /// Bots_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHealthBots(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HealthBotBotsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthBotBotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HealthBotResource(Client, HealthBotData.DeserializeHealthBotData(e)), HealthBotBotsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHealthBots", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/HealthBotResource.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/HealthBotResource.cs index 704498a28001f..002242a8a6896 100644 --- a/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/HealthBotResource.cs +++ b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/HealthBotResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HealthBot public partial class HealthBotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The botName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string botName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthBot/healthBots/{botName}"; diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/api/Azure.ResourceManager.HealthcareApis.netstandard2.0.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/api/Azure.ResourceManager.HealthcareApis.netstandard2.0.cs index e4fff7da201a8..f2784f8ce4ae5 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/api/Azure.ResourceManager.HealthcareApis.netstandard2.0.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/api/Azure.ResourceManager.HealthcareApis.netstandard2.0.cs @@ -19,7 +19,7 @@ protected DicomServiceCollection() { } } public partial class DicomServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public DicomServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DicomServiceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HealthcareApis.Models.DicomServiceAuthenticationConfiguration AuthenticationConfiguration { get { throw null; } set { } } public Azure.ResourceManager.HealthcareApis.Models.DicomServiceCorsConfiguration CorsConfiguration { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } @@ -68,7 +68,7 @@ protected FhirServiceCollection() { } } public partial class FhirServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public FhirServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FhirServiceData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AccessPolicies { get { throw null; } } public Azure.ResourceManager.HealthcareApis.Models.FhirServiceAcrConfiguration AcrConfiguration { get { throw null; } set { } } public Azure.ResourceManager.HealthcareApis.Models.FhirServiceAuthenticationConfiguration AuthenticationConfiguration { get { throw null; } set { } } @@ -148,7 +148,7 @@ protected HealthcareApisIotConnectorCollection() { } } public partial class HealthcareApisIotConnectorData : Azure.ResourceManager.Models.TrackedResourceData { - public HealthcareApisIotConnectorData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HealthcareApisIotConnectorData(Azure.Core.AzureLocation location) { } public System.BinaryData DeviceMappingContent { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } @@ -252,7 +252,7 @@ protected HealthcareApisServiceCollection() { } } public partial class HealthcareApisServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public HealthcareApisServiceData(Azure.Core.AzureLocation location, Azure.ResourceManager.HealthcareApis.Models.HealthcareApisKind kind) : base (default(Azure.Core.AzureLocation)) { } + public HealthcareApisServiceData(Azure.Core.AzureLocation location, Azure.ResourceManager.HealthcareApis.Models.HealthcareApisKind kind) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.HealthcareApis.Models.HealthcareApisKind Kind { get { throw null; } set { } } @@ -359,7 +359,7 @@ protected HealthcareApisWorkspaceCollection() { } } public partial class HealthcareApisWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public HealthcareApisWorkspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HealthcareApisWorkspaceData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.HealthcareApis.Models.HealthcareApisWorkspaceProperties Properties { get { throw null; } set { } } } @@ -455,6 +455,43 @@ protected HealthcareApisWorkspaceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HealthcareApis.Models.HealthcareApisWorkspacePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.HealthcareApis.Mocking +{ + public partial class MockableHealthcareApisArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHealthcareApisArmClient() { } + public virtual Azure.ResourceManager.HealthcareApis.DicomServiceResource GetDicomServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.FhirServiceResource GetFhirServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisIotConnectorResource GetHealthcareApisIotConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisIotFhirDestinationResource GetHealthcareApisIotFhirDestinationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisServicePrivateEndpointConnectionResource GetHealthcareApisServicePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisServicePrivateLinkResource GetHealthcareApisServicePrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisServiceResource GetHealthcareApisServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisWorkspacePrivateEndpointConnectionResource GetHealthcareApisWorkspacePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisWorkspacePrivateLinkResource GetHealthcareApisWorkspacePrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisWorkspaceResource GetHealthcareApisWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHealthcareApisResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHealthcareApisResourceGroupResource() { } + public virtual Azure.Response GetHealthcareApisService(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHealthcareApisServiceAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisServiceCollection GetHealthcareApisServices() { throw null; } + public virtual Azure.Response GetHealthcareApisWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHealthcareApisWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HealthcareApis.HealthcareApisWorkspaceCollection GetHealthcareApisWorkspaces() { throw null; } + } + public partial class MockableHealthcareApisSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHealthcareApisSubscriptionResource() { } + public virtual Azure.Response CheckHealthcareApisNameAvailability(Azure.ResourceManager.HealthcareApis.Models.HealthcareApisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckHealthcareApisNameAvailabilityAsync(Azure.ResourceManager.HealthcareApis.Models.HealthcareApisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHealthcareApisServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHealthcareApisServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHealthcareApisWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHealthcareApisWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.HealthcareApis.Models { public static partial class ArmHealthcareApisModelFactory diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/DicomServiceResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/DicomServiceResource.cs index c652287b8407c..4450cef6fb442 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/DicomServiceResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/DicomServiceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.HealthcareApis public partial class DicomServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The dicomServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string dicomServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}"; diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/HealthcareApisExtensions.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/HealthcareApisExtensions.cs index 00bcadee78fb2..b8234d1acc5a7 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/HealthcareApisExtensions.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/HealthcareApisExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.HealthcareApis.Mocking; using Azure.ResourceManager.HealthcareApis.Models; using Azure.ResourceManager.Resources; @@ -19,233 +20,193 @@ namespace Azure.ResourceManager.HealthcareApis /// A class to add extension methods to Azure.ResourceManager.HealthcareApis. public static partial class HealthcareApisExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableHealthcareApisArmClient GetMockableHealthcareApisArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHealthcareApisArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableHealthcareApisResourceGroupResource GetMockableHealthcareApisResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableHealthcareApisResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableHealthcareApisSubscriptionResource GetMockableHealthcareApisSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableHealthcareApisSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region HealthcareApisServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthcareApisServiceResource GetHealthcareApisServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthcareApisServiceResource.ValidateResourceId(id); - return new HealthcareApisServiceResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetHealthcareApisServiceResource(id); } - #endregion - #region HealthcareApisServicePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthcareApisServicePrivateEndpointConnectionResource GetHealthcareApisServicePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthcareApisServicePrivateEndpointConnectionResource.ValidateResourceId(id); - return new HealthcareApisServicePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetHealthcareApisServicePrivateEndpointConnectionResource(id); } - #endregion - #region HealthcareApisWorkspacePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthcareApisWorkspacePrivateEndpointConnectionResource GetHealthcareApisWorkspacePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthcareApisWorkspacePrivateEndpointConnectionResource.ValidateResourceId(id); - return new HealthcareApisWorkspacePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetHealthcareApisWorkspacePrivateEndpointConnectionResource(id); } - #endregion - #region HealthcareApisServicePrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthcareApisServicePrivateLinkResource GetHealthcareApisServicePrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthcareApisServicePrivateLinkResource.ValidateResourceId(id); - return new HealthcareApisServicePrivateLinkResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetHealthcareApisServicePrivateLinkResource(id); } - #endregion - #region HealthcareApisWorkspacePrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthcareApisWorkspacePrivateLinkResource GetHealthcareApisWorkspacePrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthcareApisWorkspacePrivateLinkResource.ValidateResourceId(id); - return new HealthcareApisWorkspacePrivateLinkResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetHealthcareApisWorkspacePrivateLinkResource(id); } - #endregion - #region HealthcareApisWorkspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthcareApisWorkspaceResource GetHealthcareApisWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthcareApisWorkspaceResource.ValidateResourceId(id); - return new HealthcareApisWorkspaceResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetHealthcareApisWorkspaceResource(id); } - #endregion - #region DicomServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DicomServiceResource GetDicomServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DicomServiceResource.ValidateResourceId(id); - return new DicomServiceResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetDicomServiceResource(id); } - #endregion - #region HealthcareApisIotConnectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthcareApisIotConnectorResource GetHealthcareApisIotConnectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthcareApisIotConnectorResource.ValidateResourceId(id); - return new HealthcareApisIotConnectorResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetHealthcareApisIotConnectorResource(id); } - #endregion - #region HealthcareApisIotFhirDestinationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthcareApisIotFhirDestinationResource GetHealthcareApisIotFhirDestinationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthcareApisIotFhirDestinationResource.ValidateResourceId(id); - return new HealthcareApisIotFhirDestinationResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetHealthcareApisIotFhirDestinationResource(id); } - #endregion - #region FhirServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FhirServiceResource GetFhirServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FhirServiceResource.ValidateResourceId(id); - return new FhirServiceResource(client, id); - } - ); + return GetMockableHealthcareApisArmClient(client).GetFhirServiceResource(id); } - #endregion - /// Gets a collection of HealthcareApisServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of HealthcareApisServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HealthcareApisServiceResources and their operations over a HealthcareApisServiceResource. public static HealthcareApisServiceCollection GetHealthcareApisServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHealthcareApisServices(); + return GetMockableHealthcareApisResourceGroupResource(resourceGroupResource).GetHealthcareApisServices(); } /// @@ -260,16 +221,20 @@ public static HealthcareApisServiceCollection GetHealthcareApisServices(this Res /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHealthcareApisServiceAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHealthcareApisServices().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableHealthcareApisResourceGroupResource(resourceGroupResource).GetHealthcareApisServiceAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -284,24 +249,34 @@ public static async Task> GetHealthcareA /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the service instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHealthcareApisService(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHealthcareApisServices().Get(resourceName, cancellationToken); + return GetMockableHealthcareApisResourceGroupResource(resourceGroupResource).GetHealthcareApisService(resourceName, cancellationToken); } - /// Gets a collection of HealthcareApisWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of HealthcareApisWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HealthcareApisWorkspaceResources and their operations over a HealthcareApisWorkspaceResource. public static HealthcareApisWorkspaceCollection GetHealthcareApisWorkspaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHealthcareApisWorkspaces(); + return GetMockableHealthcareApisResourceGroupResource(resourceGroupResource).GetHealthcareApisWorkspaces(); } /// @@ -316,16 +291,20 @@ public static HealthcareApisWorkspaceCollection GetHealthcareApisWorkspaces(this /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of workspace resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHealthcareApisWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHealthcareApisWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableHealthcareApisResourceGroupResource(resourceGroupResource).GetHealthcareApisWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -340,16 +319,20 @@ public static async Task> GetHealthcar /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of workspace resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHealthcareApisWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHealthcareApisWorkspaces().Get(workspaceName, cancellationToken); + return GetMockableHealthcareApisResourceGroupResource(resourceGroupResource).GetHealthcareApisWorkspace(workspaceName, cancellationToken); } /// @@ -364,13 +347,17 @@ public static Response GetHealthcareApisWorkspa /// Services_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHealthcareApisServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHealthcareApisServicesAsync(cancellationToken); + return GetMockableHealthcareApisSubscriptionResource(subscriptionResource).GetHealthcareApisServicesAsync(cancellationToken); } /// @@ -385,13 +372,17 @@ public static AsyncPageable GetHealthcareApisServ /// Services_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHealthcareApisServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHealthcareApisServices(cancellationToken); + return GetMockableHealthcareApisSubscriptionResource(subscriptionResource).GetHealthcareApisServices(cancellationToken); } /// @@ -406,6 +397,10 @@ public static Pageable GetHealthcareApisServices( /// Services_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. @@ -413,9 +408,7 @@ public static Pageable GetHealthcareApisServices( /// is null. public static async Task> CheckHealthcareApisNameAvailabilityAsync(this SubscriptionResource subscriptionResource, HealthcareApisNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckHealthcareApisNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableHealthcareApisSubscriptionResource(subscriptionResource).CheckHealthcareApisNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -430,6 +423,10 @@ public static async Task> CheckHe /// Services_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. @@ -437,9 +434,7 @@ public static async Task> CheckHe /// is null. public static Response CheckHealthcareApisNameAvailability(this SubscriptionResource subscriptionResource, HealthcareApisNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckHealthcareApisNameAvailability(content, cancellationToken); + return GetMockableHealthcareApisSubscriptionResource(subscriptionResource).CheckHealthcareApisNameAvailability(content, cancellationToken); } /// @@ -454,13 +449,17 @@ public static Response CheckHealthcareApis /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHealthcareApisWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHealthcareApisWorkspacesAsync(cancellationToken); + return GetMockableHealthcareApisSubscriptionResource(subscriptionResource).GetHealthcareApisWorkspacesAsync(cancellationToken); } /// @@ -475,13 +474,17 @@ public static AsyncPageable GetHealthcareApisWo /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHealthcareApisWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHealthcareApisWorkspaces(cancellationToken); + return GetMockableHealthcareApisSubscriptionResource(subscriptionResource).GetHealthcareApisWorkspaces(cancellationToken); } } } diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisArmClient.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisArmClient.cs new file mode 100644 index 0000000000000..0483c02efb9c3 --- /dev/null +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisArmClient.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.HealthcareApis; + +namespace Azure.ResourceManager.HealthcareApis.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHealthcareApisArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHealthcareApisArmClient() + { + } + + /// 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 MockableHealthcareApisArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHealthcareApisArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthcareApisServiceResource GetHealthcareApisServiceResource(ResourceIdentifier id) + { + HealthcareApisServiceResource.ValidateResourceId(id); + return new HealthcareApisServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthcareApisServicePrivateEndpointConnectionResource GetHealthcareApisServicePrivateEndpointConnectionResource(ResourceIdentifier id) + { + HealthcareApisServicePrivateEndpointConnectionResource.ValidateResourceId(id); + return new HealthcareApisServicePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthcareApisWorkspacePrivateEndpointConnectionResource GetHealthcareApisWorkspacePrivateEndpointConnectionResource(ResourceIdentifier id) + { + HealthcareApisWorkspacePrivateEndpointConnectionResource.ValidateResourceId(id); + return new HealthcareApisWorkspacePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthcareApisServicePrivateLinkResource GetHealthcareApisServicePrivateLinkResource(ResourceIdentifier id) + { + HealthcareApisServicePrivateLinkResource.ValidateResourceId(id); + return new HealthcareApisServicePrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthcareApisWorkspacePrivateLinkResource GetHealthcareApisWorkspacePrivateLinkResource(ResourceIdentifier id) + { + HealthcareApisWorkspacePrivateLinkResource.ValidateResourceId(id); + return new HealthcareApisWorkspacePrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthcareApisWorkspaceResource GetHealthcareApisWorkspaceResource(ResourceIdentifier id) + { + HealthcareApisWorkspaceResource.ValidateResourceId(id); + return new HealthcareApisWorkspaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DicomServiceResource GetDicomServiceResource(ResourceIdentifier id) + { + DicomServiceResource.ValidateResourceId(id); + return new DicomServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthcareApisIotConnectorResource GetHealthcareApisIotConnectorResource(ResourceIdentifier id) + { + HealthcareApisIotConnectorResource.ValidateResourceId(id); + return new HealthcareApisIotConnectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthcareApisIotFhirDestinationResource GetHealthcareApisIotFhirDestinationResource(ResourceIdentifier id) + { + HealthcareApisIotFhirDestinationResource.ValidateResourceId(id); + return new HealthcareApisIotFhirDestinationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FhirServiceResource GetFhirServiceResource(ResourceIdentifier id) + { + FhirServiceResource.ValidateResourceId(id); + return new FhirServiceResource(Client, id); + } + } +} diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisResourceGroupResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisResourceGroupResource.cs new file mode 100644 index 0000000000000..59807742af57f --- /dev/null +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.HealthcareApis; + +namespace Azure.ResourceManager.HealthcareApis.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHealthcareApisResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHealthcareApisResourceGroupResource() + { + } + + /// 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 MockableHealthcareApisResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of HealthcareApisServiceResources in the ResourceGroupResource. + /// An object representing collection of HealthcareApisServiceResources and their operations over a HealthcareApisServiceResource. + public virtual HealthcareApisServiceCollection GetHealthcareApisServices() + { + return GetCachedClient(client => new HealthcareApisServiceCollection(client, Id)); + } + + /// + /// Get the metadata of a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHealthcareApisServiceAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetHealthcareApisServices().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the metadata of a service instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the service instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHealthcareApisService(string resourceName, CancellationToken cancellationToken = default) + { + return GetHealthcareApisServices().Get(resourceName, cancellationToken); + } + + /// Gets a collection of HealthcareApisWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of HealthcareApisWorkspaceResources and their operations over a HealthcareApisWorkspaceResource. + public virtual HealthcareApisWorkspaceCollection GetHealthcareApisWorkspaces() + { + return GetCachedClient(client => new HealthcareApisWorkspaceCollection(client, Id)); + } + + /// + /// Gets the properties of the specified workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of workspace resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHealthcareApisWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetHealthcareApisWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of the specified workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of workspace resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHealthcareApisWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetHealthcareApisWorkspaces().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisSubscriptionResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisSubscriptionResource.cs new file mode 100644 index 0000000000000..aae30a00520c4 --- /dev/null +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/MockableHealthcareApisSubscriptionResource.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HealthcareApis; +using Azure.ResourceManager.HealthcareApis.Models; + +namespace Azure.ResourceManager.HealthcareApis.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHealthcareApisSubscriptionResource : ArmResource + { + private ClientDiagnostics _healthcareApisServiceServicesClientDiagnostics; + private ServicesRestOperations _healthcareApisServiceServicesRestClient; + private ClientDiagnostics _healthcareApisWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _healthcareApisWorkspaceWorkspacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHealthcareApisSubscriptionResource() + { + } + + /// 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 MockableHealthcareApisSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics HealthcareApisServiceServicesClientDiagnostics => _healthcareApisServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HealthcareApis", HealthcareApisServiceResource.ResourceType.Namespace, Diagnostics); + private ServicesRestOperations HealthcareApisServiceServicesRestClient => _healthcareApisServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HealthcareApisServiceResource.ResourceType)); + private ClientDiagnostics HealthcareApisWorkspaceWorkspacesClientDiagnostics => _healthcareApisWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HealthcareApis", HealthcareApisWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations HealthcareApisWorkspaceWorkspacesRestClient => _healthcareApisWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HealthcareApisWorkspaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get all the service instances in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services + /// + /// + /// Operation Id + /// Services_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHealthcareApisServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HealthcareApisServiceServicesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthcareApisServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HealthcareApisServiceResource(Client, HealthcareApisServiceData.DeserializeHealthcareApisServiceData(e)), HealthcareApisServiceServicesClientDiagnostics, Pipeline, "MockableHealthcareApisSubscriptionResource.GetHealthcareApisServices", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the service instances in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services + /// + /// + /// Operation Id + /// Services_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHealthcareApisServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HealthcareApisServiceServicesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthcareApisServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HealthcareApisServiceResource(Client, HealthcareApisServiceData.DeserializeHealthcareApisServiceData(e)), HealthcareApisServiceServicesClientDiagnostics, Pipeline, "MockableHealthcareApisSubscriptionResource.GetHealthcareApisServices", "value", "nextLink", cancellationToken); + } + + /// + /// Check if a service instance name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability + /// + /// + /// Operation Id + /// Services_CheckNameAvailability + /// + /// + /// + /// Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckHealthcareApisNameAvailabilityAsync(HealthcareApisNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = HealthcareApisServiceServicesClientDiagnostics.CreateScope("MockableHealthcareApisSubscriptionResource.CheckHealthcareApisNameAvailability"); + scope.Start(); + try + { + var response = await HealthcareApisServiceServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a service instance name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability + /// + /// + /// Operation Id + /// Services_CheckNameAvailability + /// + /// + /// + /// Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckHealthcareApisNameAvailability(HealthcareApisNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = HealthcareApisServiceServicesClientDiagnostics.CreateScope("MockableHealthcareApisSubscriptionResource.CheckHealthcareApisNameAvailability"); + scope.Start(); + try + { + var response = HealthcareApisServiceServicesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the available workspaces under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHealthcareApisWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HealthcareApisWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthcareApisWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HealthcareApisWorkspaceResource(Client, HealthcareApisWorkspaceData.DeserializeHealthcareApisWorkspaceData(e)), HealthcareApisWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableHealthcareApisSubscriptionResource.GetHealthcareApisWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available workspaces under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHealthcareApisWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HealthcareApisWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthcareApisWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HealthcareApisWorkspaceResource(Client, HealthcareApisWorkspaceData.DeserializeHealthcareApisWorkspaceData(e)), HealthcareApisWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableHealthcareApisSubscriptionResource.GetHealthcareApisWorkspaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 1316bd6469aaf..0000000000000 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HealthcareApis -{ - /// 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 HealthcareApisServiceResources in the ResourceGroupResource. - /// An object representing collection of HealthcareApisServiceResources and their operations over a HealthcareApisServiceResource. - public virtual HealthcareApisServiceCollection GetHealthcareApisServices() - { - return GetCachedClient(Client => new HealthcareApisServiceCollection(Client, Id)); - } - - /// Gets a collection of HealthcareApisWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of HealthcareApisWorkspaceResources and their operations over a HealthcareApisWorkspaceResource. - public virtual HealthcareApisWorkspaceCollection GetHealthcareApisWorkspaces() - { - return GetCachedClient(Client => new HealthcareApisWorkspaceCollection(Client, Id)); - } - } -} diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 4231692aa0cef..0000000000000 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.HealthcareApis.Models; - -namespace Azure.ResourceManager.HealthcareApis -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _healthcareApisServiceServicesClientDiagnostics; - private ServicesRestOperations _healthcareApisServiceServicesRestClient; - private ClientDiagnostics _healthcareApisWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _healthcareApisWorkspaceWorkspacesRestClient; - - /// 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 HealthcareApisServiceServicesClientDiagnostics => _healthcareApisServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HealthcareApis", HealthcareApisServiceResource.ResourceType.Namespace, Diagnostics); - private ServicesRestOperations HealthcareApisServiceServicesRestClient => _healthcareApisServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HealthcareApisServiceResource.ResourceType)); - private ClientDiagnostics HealthcareApisWorkspaceWorkspacesClientDiagnostics => _healthcareApisWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HealthcareApis", HealthcareApisWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations HealthcareApisWorkspaceWorkspacesRestClient => _healthcareApisWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HealthcareApisWorkspaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get all the service instances in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services - /// - /// - /// Operation Id - /// Services_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHealthcareApisServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HealthcareApisServiceServicesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthcareApisServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HealthcareApisServiceResource(Client, HealthcareApisServiceData.DeserializeHealthcareApisServiceData(e)), HealthcareApisServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHealthcareApisServices", "value", "nextLink", cancellationToken); - } - - /// - /// Get all the service instances in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services - /// - /// - /// Operation Id - /// Services_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHealthcareApisServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HealthcareApisServiceServicesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthcareApisServiceServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HealthcareApisServiceResource(Client, HealthcareApisServiceData.DeserializeHealthcareApisServiceData(e)), HealthcareApisServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHealthcareApisServices", "value", "nextLink", cancellationToken); - } - - /// - /// Check if a service instance name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability - /// - /// - /// Operation Id - /// Services_CheckNameAvailability - /// - /// - /// - /// Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. - /// The cancellation token to use. - public virtual async Task> CheckHealthcareApisNameAvailabilityAsync(HealthcareApisNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = HealthcareApisServiceServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckHealthcareApisNameAvailability"); - scope.Start(); - try - { - var response = await HealthcareApisServiceServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if a service instance name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability - /// - /// - /// Operation Id - /// Services_CheckNameAvailability - /// - /// - /// - /// Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. - /// The cancellation token to use. - public virtual Response CheckHealthcareApisNameAvailability(HealthcareApisNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = HealthcareApisServiceServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckHealthcareApisNameAvailability"); - scope.Start(); - try - { - var response = HealthcareApisServiceServicesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all the available workspaces under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHealthcareApisWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HealthcareApisWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthcareApisWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HealthcareApisWorkspaceResource(Client, HealthcareApisWorkspaceData.DeserializeHealthcareApisWorkspaceData(e)), HealthcareApisWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHealthcareApisWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the available workspaces under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHealthcareApisWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HealthcareApisWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HealthcareApisWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HealthcareApisWorkspaceResource(Client, HealthcareApisWorkspaceData.DeserializeHealthcareApisWorkspaceData(e)), HealthcareApisWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHealthcareApisWorkspaces", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/FhirServiceResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/FhirServiceResource.cs index 429653b293e05..dfa1b12be8d87 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/FhirServiceResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/FhirServiceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.HealthcareApis public partial class FhirServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The fhirServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string fhirServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}"; diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorResource.cs index 196ae7c0ed841..7c00c1f1608a4 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.HealthcareApis public partial class HealthcareApisIotConnectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The iotConnectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string iotConnectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HealthcareApisIotFhirDestinationResources and their operations over a HealthcareApisIotFhirDestinationResource. public virtual HealthcareApisIotFhirDestinationCollection GetHealthcareApisIotFhirDestinations() { - return GetCachedClient(Client => new HealthcareApisIotFhirDestinationCollection(Client, Id)); + return GetCachedClient(client => new HealthcareApisIotFhirDestinationCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual HealthcareApisIotFhirDestinationCollection GetHealthcareApisIotFh /// /// The name of IoT Connector FHIR destination resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHealthcareApisIotFhirDestinationAsync(string fhirDestinationName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> Ge /// /// The name of IoT Connector FHIR destination resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHealthcareApisIotFhirDestination(string fhirDestinationName, CancellationToken cancellationToken = default) { diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotFhirDestinationResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotFhirDestinationResource.cs index e056ae877aa6c..a5097d449be6f 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotFhirDestinationResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotFhirDestinationResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.HealthcareApis public partial class HealthcareApisIotFhirDestinationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The iotConnectorName. + /// The fhirDestinationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string iotConnectorName, string fhirDestinationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}"; diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateEndpointConnectionResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateEndpointConnectionResource.cs index 80cffed4f953f..79eb723e2a6c9 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateEndpointConnectionResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HealthcareApis public partial class HealthcareApisServicePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateLinkResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateLinkResource.cs index b56f7ca42fb4f..4b790ee2dbd01 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateLinkResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServicePrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HealthcareApis public partial class HealthcareApisServicePrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName}"; diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceResource.cs index 2b222327a46d3..4cbd5f8273152 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HealthcareApis public partial class HealthcareApisServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HealthcareApisServicePrivateEndpointConnectionResources and their operations over a HealthcareApisServicePrivateEndpointConnectionResource. public virtual HealthcareApisServicePrivateEndpointConnectionCollection GetHealthcareApisServicePrivateEndpointConnections() { - return GetCachedClient(Client => new HealthcareApisServicePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new HealthcareApisServicePrivateEndpointConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual HealthcareApisServicePrivateEndpointConnectionCollection GetHealt /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHealthcareApisServicePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHealthcareApisServicePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response /// An object representing collection of HealthcareApisServicePrivateLinkResources and their operations over a HealthcareApisServicePrivateLinkResource. public virtual HealthcareApisServicePrivateLinkResourceCollection GetHealthcareApisServicePrivateLinkResources() { - return GetCachedClient(Client => new HealthcareApisServicePrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new HealthcareApisServicePrivateLinkResourceCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual HealthcareApisServicePrivateLinkResourceCollection GetHealthcareA /// /// The name of the private link resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHealthcareApisServicePrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> Ge /// /// The name of the private link resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHealthcareApisServicePrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateEndpointConnectionResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateEndpointConnectionResource.cs index 23d5a033db80f..2047f8ef25a01 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateEndpointConnectionResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HealthcareApis public partial class HealthcareApisWorkspacePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateLinkResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateLinkResource.cs index c50774cd2e21f..9e80a47529227 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateLinkResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspacePrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HealthcareApis public partial class HealthcareApisWorkspacePrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/privateLinkResources/{groupName}"; diff --git a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceResource.cs index f50b3032369b7..c55fe45628748 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HealthcareApis public partial class HealthcareApisWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HealthcareApisWorkspacePrivateEndpointConnectionResources and their operations over a HealthcareApisWorkspacePrivateEndpointConnectionResource. public virtual HealthcareApisWorkspacePrivateEndpointConnectionCollection GetHealthcareApisWorkspacePrivateEndpointConnections() { - return GetCachedClient(Client => new HealthcareApisWorkspacePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new HealthcareApisWorkspacePrivateEndpointConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual HealthcareApisWorkspacePrivateEndpointConnectionCollection GetHea /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHealthcareApisWorkspacePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHealthcareApisWorkspacePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response An object representing collection of HealthcareApisWorkspacePrivateLinkResources and their operations over a HealthcareApisWorkspacePrivateLinkResource. public virtual HealthcareApisWorkspacePrivateLinkResourceCollection GetHealthcareApisWorkspacePrivateLinkResources() { - return GetCachedClient(Client => new HealthcareApisWorkspacePrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new HealthcareApisWorkspacePrivateLinkResourceCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual HealthcareApisWorkspacePrivateLinkResourceCollection GetHealthcar /// /// The name of the private link resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHealthcareApisWorkspacePrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> /// /// The name of the private link resource group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHealthcareApisWorkspacePrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetHealthcar /// An object representing collection of DicomServiceResources and their operations over a DicomServiceResource. public virtual DicomServiceCollection GetDicomServices() { - return GetCachedClient(Client => new DicomServiceCollection(Client, Id)); + return GetCachedClient(client => new DicomServiceCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual DicomServiceCollection GetDicomServices() /// /// The name of DICOM Service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDicomServiceAsync(string dicomServiceName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetDicomServiceAsync(s /// /// The name of DICOM Service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDicomService(string dicomServiceName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetDicomService(string dicomServic /// An object representing collection of HealthcareApisIotConnectorResources and their operations over a HealthcareApisIotConnectorResource. public virtual HealthcareApisIotConnectorCollection GetHealthcareApisIotConnectors() { - return GetCachedClient(Client => new HealthcareApisIotConnectorCollection(Client, Id)); + return GetCachedClient(client => new HealthcareApisIotConnectorCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual HealthcareApisIotConnectorCollection GetHealthcareApisIotConnecto /// /// The name of IoT Connector resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHealthcareApisIotConnectorAsync(string iotConnectorName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetHealt /// /// The name of IoT Connector resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHealthcareApisIotConnector(string iotConnectorName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetHealthcareApisIot /// An object representing collection of FhirServiceResources and their operations over a FhirServiceResource. public virtual FhirServiceCollection GetFhirServices() { - return GetCachedClient(Client => new FhirServiceCollection(Client, Id)); + return GetCachedClient(client => new FhirServiceCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual FhirServiceCollection GetFhirServices() /// /// The name of FHIR Service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFhirServiceAsync(string fhirServiceName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task> GetFhirServiceAsync(str /// /// The name of FHIR Service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFhirService(string fhirServiceName, CancellationToken cancellationToken = default) { diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/api/Azure.ResourceManager.HybridContainerService.netstandard2.0.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/api/Azure.ResourceManager.HybridContainerService.netstandard2.0.cs index a2cfe827bb24b..692b8d4af9052 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/api/Azure.ResourceManager.HybridContainerService.netstandard2.0.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/api/Azure.ResourceManager.HybridContainerService.netstandard2.0.cs @@ -19,7 +19,7 @@ protected HybridContainerServiceAgentPoolCollection() { } } public partial class HybridContainerServiceAgentPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public HybridContainerServiceAgentPoolData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HybridContainerServiceAgentPoolData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AvailabilityZones { get { throw null; } } public Azure.ResourceManager.HybridContainerService.Models.CloudProviderProfile CloudProviderProfile { get { throw null; } set { } } public int? Count { get { throw null; } set { } } @@ -103,7 +103,7 @@ protected HybridContainerServiceVirtualNetworkCollection() { } } public partial class HybridContainerServiceVirtualNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public HybridContainerServiceVirtualNetworkData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HybridContainerServiceVirtualNetworkData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HybridContainerService.Models.VirtualNetworksExtendedLocation ExtendedLocation { get { throw null; } set { } } public Azure.ResourceManager.HybridContainerService.Models.VirtualNetworksProperties Properties { get { throw null; } set { } } } @@ -185,7 +185,7 @@ protected ProvisionedClusterCollection() { } } public partial class ProvisionedClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public ProvisionedClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ProvisionedClusterData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HybridContainerService.Models.ProvisionedClustersResponseExtendedLocation ExtendedLocation { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.HybridContainerService.Models.ProvisionedClustersResponseProperties Properties { get { throw null; } set { } } @@ -255,7 +255,7 @@ protected StorageSpaceCollection() { } } public partial class StorageSpaceData : Azure.ResourceManager.Models.TrackedResourceData { - public StorageSpaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StorageSpaceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HybridContainerService.Models.StorageSpacesExtendedLocation ExtendedLocation { get { throw null; } set { } } public Azure.ResourceManager.HybridContainerService.Models.StorageSpacesProperties Properties { get { throw null; } set { } } } @@ -280,6 +280,46 @@ protected StorageSpaceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridContainerService.Models.StorageSpacePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.HybridContainerService.Mocking +{ + public partial class MockableHybridContainerServiceArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHybridContainerServiceArmClient() { } + public virtual Azure.ResourceManager.HybridContainerService.HybridContainerServiceAgentPoolResource GetHybridContainerServiceAgentPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridContainerService.HybridContainerServiceVirtualNetworkResource GetHybridContainerServiceVirtualNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridContainerService.HybridIdentityMetadataResource GetHybridIdentityMetadataResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetOrchestratorsHybridContainerService(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOrchestratorsHybridContainerServiceAsync(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridContainerService.ProvisionedClusterResource GetProvisionedClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridContainerService.ProvisionedClusterUpgradeProfileResource GetProvisionedClusterUpgradeProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridContainerService.StorageSpaceResource GetStorageSpaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetVmSkusHybridContainerService(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVmSkusHybridContainerServiceAsync(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableHybridContainerServiceResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHybridContainerServiceResourceGroupResource() { } + public virtual Azure.Response GetHybridContainerServiceVirtualNetwork(string virtualNetworksName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHybridContainerServiceVirtualNetworkAsync(string virtualNetworksName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridContainerService.HybridContainerServiceVirtualNetworkCollection GetHybridContainerServiceVirtualNetworks() { throw null; } + public virtual Azure.Response GetProvisionedCluster(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetProvisionedClusterAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridContainerService.ProvisionedClusterCollection GetProvisionedClusters() { throw null; } + public virtual Azure.Response GetStorageSpace(string storageSpacesName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetStorageSpaceAsync(string storageSpacesName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridContainerService.StorageSpaceCollection GetStorageSpaces() { throw null; } + } + public partial class MockableHybridContainerServiceSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHybridContainerServiceSubscriptionResource() { } + public virtual Azure.Pageable GetHybridContainerServiceVirtualNetworks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHybridContainerServiceVirtualNetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProvisionedClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProvisionedClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStorageSpaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageSpacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.HybridContainerService.Models { public partial class AADProfile : Azure.ResourceManager.HybridContainerService.Models.AADProfileSecret @@ -655,7 +695,7 @@ internal OrchestratorVersionProfileListResult() { } } public partial class ProvisionedClusterCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public ProvisionedClusterCreateOrUpdateContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ProvisionedClusterCreateOrUpdateContent(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HybridContainerService.Models.ProvisionedClustersExtendedLocation ExtendedLocation { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.HybridContainerService.Models.ProvisionedClustersAllProperties Properties { get { throw null; } set { } } diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index f2e3c0b130ca7..0000000000000 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,166 +0,0 @@ -// 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; -using Azure.ResourceManager.HybridContainerService.Models; - -namespace Azure.ResourceManager.HybridContainerService -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _hybridContainerServiceClientDiagnostics; - private HybridContainerServiceRestOperations _hybridContainerServiceRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics HybridContainerServiceClientDiagnostics => _hybridContainerServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private HybridContainerServiceRestOperations HybridContainerServiceRestClient => _hybridContainerServiceRestClient ??= new HybridContainerServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists the available orchestrators in a custom location for HybridAKS - /// - /// - /// Request Path - /// /{customLocationResourceUri}/providers/Microsoft.HybridContainerService/orchestrators - /// - /// - /// Operation Id - /// HybridContainerService_ListOrchestrators - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetOrchestratorsHybridContainerServiceAsync(CancellationToken cancellationToken = default) - { - using var scope = HybridContainerServiceClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetOrchestratorsHybridContainerService"); - scope.Start(); - try - { - var response = await HybridContainerServiceRestClient.ListOrchestratorsAsync(Id, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the available orchestrators in a custom location for HybridAKS - /// - /// - /// Request Path - /// /{customLocationResourceUri}/providers/Microsoft.HybridContainerService/orchestrators - /// - /// - /// Operation Id - /// HybridContainerService_ListOrchestrators - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetOrchestratorsHybridContainerService(CancellationToken cancellationToken = default) - { - using var scope = HybridContainerServiceClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetOrchestratorsHybridContainerService"); - scope.Start(); - try - { - var response = HybridContainerServiceRestClient.ListOrchestrators(Id, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the available VM SKUs in a custom location for HybridAKS - /// - /// - /// Request Path - /// /{customLocationResourceUri}/providers/Microsoft.HybridContainerService/vmSkus - /// - /// - /// Operation Id - /// HybridContainerService_ListVMSkus - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetVmSkusHybridContainerServiceAsync(CancellationToken cancellationToken = default) - { - using var scope = HybridContainerServiceClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetVmSkusHybridContainerService"); - scope.Start(); - try - { - var response = await HybridContainerServiceRestClient.ListVmSkusAsync(Id, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the available VM SKUs in a custom location for HybridAKS - /// - /// - /// Request Path - /// /{customLocationResourceUri}/providers/Microsoft.HybridContainerService/vmSkus - /// - /// - /// Operation Id - /// HybridContainerService_ListVMSkus - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetVmSkusHybridContainerService(CancellationToken cancellationToken = default) - { - using var scope = HybridContainerServiceClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetVmSkusHybridContainerService"); - scope.Start(); - try - { - var response = HybridContainerServiceRestClient.ListVmSkus(Id, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/HybridContainerServiceExtensions.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/HybridContainerServiceExtensions.cs index 08aa471361847..2a76eb4ee406c 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/HybridContainerServiceExtensions.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/HybridContainerServiceExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.HybridContainerService.Mocking; using Azure.ResourceManager.HybridContainerService.Models; using Azure.ResourceManager.Resources; @@ -19,167 +20,21 @@ namespace Azure.ResourceManager.HybridContainerService /// A class to add extension methods to Azure.ResourceManager.HybridContainerService. public static partial class HybridContainerServiceExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableHybridContainerServiceArmClient GetMockableHybridContainerServiceArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHybridContainerServiceArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableHybridContainerServiceResourceGroupResource GetMockableHybridContainerServiceResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableHybridContainerServiceResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableHybridContainerServiceSubscriptionResource GetMockableHybridContainerServiceSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableHybridContainerServiceSubscriptionResource(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 ProvisionedClusterResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ProvisionedClusterResource GetProvisionedClusterResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ProvisionedClusterResource.ValidateResourceId(id); - return new ProvisionedClusterResource(client, id); - } - ); - } - #endregion - - #region ProvisionedClusterUpgradeProfileResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ProvisionedClusterUpgradeProfileResource GetProvisionedClusterUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ProvisionedClusterUpgradeProfileResource.ValidateResourceId(id); - return new ProvisionedClusterUpgradeProfileResource(client, id); - } - ); - } - #endregion - - #region HybridIdentityMetadataResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static HybridIdentityMetadataResource GetHybridIdentityMetadataResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - HybridIdentityMetadataResource.ValidateResourceId(id); - return new HybridIdentityMetadataResource(client, id); - } - ); - } - #endregion - - #region HybridContainerServiceAgentPoolResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static HybridContainerServiceAgentPoolResource GetHybridContainerServiceAgentPoolResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - HybridContainerServiceAgentPoolResource.ValidateResourceId(id); - return new HybridContainerServiceAgentPoolResource(client, id); - } - ); - } - #endregion - - #region StorageSpaceResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static StorageSpaceResource GetStorageSpaceResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - StorageSpaceResource.ValidateResourceId(id); - return new StorageSpaceResource(client, id); - } - ); - } - #endregion - - #region HybridContainerServiceVirtualNetworkResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static HybridContainerServiceVirtualNetworkResource GetHybridContainerServiceVirtualNetworkResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - HybridContainerServiceVirtualNetworkResource.ValidateResourceId(id); - return new HybridContainerServiceVirtualNetworkResource(client, id); - } - ); - } - #endregion - /// /// Lists the available orchestrators in a custom location for HybridAKS /// @@ -192,13 +47,17 @@ public static HybridContainerServiceVirtualNetworkResource GetHybridContainerSer /// HybridContainerService_ListOrchestrators /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The cancellation token to use. public static async Task> GetOrchestratorsHybridContainerServiceAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return await GetArmResourceExtensionClient(client, scope).GetOrchestratorsHybridContainerServiceAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableHybridContainerServiceArmClient(client).GetOrchestratorsHybridContainerServiceAsync(scope, cancellationToken).ConfigureAwait(false); } /// @@ -213,13 +72,17 @@ public static async Task> GetOrch /// HybridContainerService_ListOrchestrators /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The cancellation token to use. public static Response GetOrchestratorsHybridContainerService(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetOrchestratorsHybridContainerService(cancellationToken); + return GetMockableHybridContainerServiceArmClient(client).GetOrchestratorsHybridContainerService(scope, cancellationToken); } /// @@ -234,13 +97,17 @@ public static Response GetOrchestratorsHyb /// HybridContainerService_ListVMSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The cancellation token to use. public static async Task> GetVmSkusHybridContainerServiceAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return await GetArmResourceExtensionClient(client, scope).GetVmSkusHybridContainerServiceAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableHybridContainerServiceArmClient(client).GetVmSkusHybridContainerServiceAsync(scope, cancellationToken).ConfigureAwait(false); } /// @@ -255,21 +122,127 @@ public static async Task> GetVmSkusHybridContainerServ /// HybridContainerService_ListVMSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The cancellation token to use. public static Response GetVmSkusHybridContainerService(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetVmSkusHybridContainerService(cancellationToken); + return GetMockableHybridContainerServiceArmClient(client).GetVmSkusHybridContainerService(scope, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ProvisionedClusterResource GetProvisionedClusterResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridContainerServiceArmClient(client).GetProvisionedClusterResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ProvisionedClusterUpgradeProfileResource GetProvisionedClusterUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridContainerServiceArmClient(client).GetProvisionedClusterUpgradeProfileResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static HybridIdentityMetadataResource GetHybridIdentityMetadataResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridContainerServiceArmClient(client).GetHybridIdentityMetadataResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static HybridContainerServiceAgentPoolResource GetHybridContainerServiceAgentPoolResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridContainerServiceArmClient(client).GetHybridContainerServiceAgentPoolResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static StorageSpaceResource GetStorageSpaceResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridContainerServiceArmClient(client).GetStorageSpaceResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static HybridContainerServiceVirtualNetworkResource GetHybridContainerServiceVirtualNetworkResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridContainerServiceArmClient(client).GetHybridContainerServiceVirtualNetworkResource(id); } - /// Gets a collection of ProvisionedClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of ProvisionedClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ProvisionedClusterResources and their operations over a ProvisionedClusterResource. public static ProvisionedClusterCollection GetProvisionedClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetProvisionedClusters(); + return GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetProvisionedClusters(); } /// @@ -284,16 +257,20 @@ public static ProvisionedClusterCollection GetProvisionedClusters(this ResourceG /// ProvisionedClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameter for the name of the provisioned cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetProvisionedClusterAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetProvisionedClusters().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetProvisionedClusterAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -308,24 +285,34 @@ public static async Task> GetProvisionedClu /// ProvisionedClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameter for the name of the provisioned cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetProvisionedCluster(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetProvisionedClusters().Get(resourceName, cancellationToken); + return GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetProvisionedCluster(resourceName, cancellationToken); } - /// Gets a collection of StorageSpaceResources in the ResourceGroupResource. + /// + /// Gets a collection of StorageSpaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of StorageSpaceResources and their operations over a StorageSpaceResource. public static StorageSpaceCollection GetStorageSpaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageSpaces(); + return GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetStorageSpaces(); } /// @@ -340,16 +327,20 @@ public static StorageSpaceCollection GetStorageSpaces(this ResourceGroupResource /// storageSpaces_Retrieve /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameter for the name of the storage object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetStorageSpaceAsync(this ResourceGroupResource resourceGroupResource, string storageSpacesName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetStorageSpaces().GetAsync(storageSpacesName, cancellationToken).ConfigureAwait(false); + return await GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetStorageSpaceAsync(storageSpacesName, cancellationToken).ConfigureAwait(false); } /// @@ -364,24 +355,34 @@ public static async Task> GetStorageSpaceAsync(th /// storageSpaces_Retrieve /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameter for the name of the storage object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetStorageSpace(this ResourceGroupResource resourceGroupResource, string storageSpacesName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetStorageSpaces().Get(storageSpacesName, cancellationToken); + return GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetStorageSpace(storageSpacesName, cancellationToken); } - /// Gets a collection of HybridContainerServiceVirtualNetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of HybridContainerServiceVirtualNetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HybridContainerServiceVirtualNetworkResources and their operations over a HybridContainerServiceVirtualNetworkResource. public static HybridContainerServiceVirtualNetworkCollection GetHybridContainerServiceVirtualNetworks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHybridContainerServiceVirtualNetworks(); + return GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetHybridContainerServiceVirtualNetworks(); } /// @@ -396,16 +397,20 @@ public static HybridContainerServiceVirtualNetworkCollection GetHybridContainerS /// virtualNetworks_Retrieve /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameter for the name of the virtual network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHybridContainerServiceVirtualNetworkAsync(this ResourceGroupResource resourceGroupResource, string virtualNetworksName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHybridContainerServiceVirtualNetworks().GetAsync(virtualNetworksName, cancellationToken).ConfigureAwait(false); + return await GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetHybridContainerServiceVirtualNetworkAsync(virtualNetworksName, cancellationToken).ConfigureAwait(false); } /// @@ -420,16 +425,20 @@ public static async Task> /// virtualNetworks_Retrieve /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameter for the name of the virtual network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHybridContainerServiceVirtualNetwork(this ResourceGroupResource resourceGroupResource, string virtualNetworksName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHybridContainerServiceVirtualNetworks().Get(virtualNetworksName, cancellationToken); + return GetMockableHybridContainerServiceResourceGroupResource(resourceGroupResource).GetHybridContainerServiceVirtualNetwork(virtualNetworksName, cancellationToken); } /// @@ -444,13 +453,17 @@ public static Response GetHybridCo /// ProvisionedClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetProvisionedClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProvisionedClustersAsync(cancellationToken); + return GetMockableHybridContainerServiceSubscriptionResource(subscriptionResource).GetProvisionedClustersAsync(cancellationToken); } /// @@ -465,13 +478,17 @@ public static AsyncPageable GetProvisionedClustersAs /// ProvisionedClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetProvisionedClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProvisionedClusters(cancellationToken); + return GetMockableHybridContainerServiceSubscriptionResource(subscriptionResource).GetProvisionedClusters(cancellationToken); } /// @@ -486,13 +503,17 @@ public static Pageable GetProvisionedClusters(this S /// storageSpaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageSpacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageSpacesAsync(cancellationToken); + return GetMockableHybridContainerServiceSubscriptionResource(subscriptionResource).GetStorageSpacesAsync(cancellationToken); } /// @@ -507,13 +528,17 @@ public static AsyncPageable GetStorageSpacesAsync(this Sub /// storageSpaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageSpaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageSpaces(cancellationToken); + return GetMockableHybridContainerServiceSubscriptionResource(subscriptionResource).GetStorageSpaces(cancellationToken); } /// @@ -528,13 +553,17 @@ public static Pageable GetStorageSpaces(this SubscriptionR /// virtualNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHybridContainerServiceVirtualNetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHybridContainerServiceVirtualNetworksAsync(cancellationToken); + return GetMockableHybridContainerServiceSubscriptionResource(subscriptionResource).GetHybridContainerServiceVirtualNetworksAsync(cancellationToken); } /// @@ -549,13 +578,17 @@ public static AsyncPageable GetHyb /// virtualNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHybridContainerServiceVirtualNetworks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHybridContainerServiceVirtualNetworks(cancellationToken); + return GetMockableHybridContainerServiceSubscriptionResource(subscriptionResource).GetHybridContainerServiceVirtualNetworks(cancellationToken); } } } diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceArmClient.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceArmClient.cs new file mode 100644 index 0000000000000..0b0472ac46cf1 --- /dev/null +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceArmClient.cs @@ -0,0 +1,246 @@ +// 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; +using Azure.ResourceManager.HybridContainerService; +using Azure.ResourceManager.HybridContainerService.Models; + +namespace Azure.ResourceManager.HybridContainerService.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHybridContainerServiceArmClient : ArmResource + { + private ClientDiagnostics _hybridContainerServiceClientDiagnostics; + private HybridContainerServiceRestOperations _hybridContainerServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHybridContainerServiceArmClient() + { + } + + /// 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 MockableHybridContainerServiceArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHybridContainerServiceArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics HybridContainerServiceClientDiagnostics => _hybridContainerServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private HybridContainerServiceRestOperations HybridContainerServiceRestClient => _hybridContainerServiceRestClient ??= new HybridContainerServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the available orchestrators in a custom location for HybridAKS + /// + /// + /// Request Path + /// /{customLocationResourceUri}/providers/Microsoft.HybridContainerService/orchestrators + /// + /// + /// Operation Id + /// HybridContainerService_ListOrchestrators + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + public virtual async Task> GetOrchestratorsHybridContainerServiceAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + using var scope0 = HybridContainerServiceClientDiagnostics.CreateScope("MockableHybridContainerServiceArmClient.GetOrchestratorsHybridContainerService"); + scope0.Start(); + try + { + var response = await HybridContainerServiceRestClient.ListOrchestratorsAsync(scope, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists the available orchestrators in a custom location for HybridAKS + /// + /// + /// Request Path + /// /{customLocationResourceUri}/providers/Microsoft.HybridContainerService/orchestrators + /// + /// + /// Operation Id + /// HybridContainerService_ListOrchestrators + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + public virtual Response GetOrchestratorsHybridContainerService(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + using var scope0 = HybridContainerServiceClientDiagnostics.CreateScope("MockableHybridContainerServiceArmClient.GetOrchestratorsHybridContainerService"); + scope0.Start(); + try + { + var response = HybridContainerServiceRestClient.ListOrchestrators(scope, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists the available VM SKUs in a custom location for HybridAKS + /// + /// + /// Request Path + /// /{customLocationResourceUri}/providers/Microsoft.HybridContainerService/vmSkus + /// + /// + /// Operation Id + /// HybridContainerService_ListVMSkus + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + public virtual async Task> GetVmSkusHybridContainerServiceAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + using var scope0 = HybridContainerServiceClientDiagnostics.CreateScope("MockableHybridContainerServiceArmClient.GetVmSkusHybridContainerService"); + scope0.Start(); + try + { + var response = await HybridContainerServiceRestClient.ListVmSkusAsync(scope, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists the available VM SKUs in a custom location for HybridAKS + /// + /// + /// Request Path + /// /{customLocationResourceUri}/providers/Microsoft.HybridContainerService/vmSkus + /// + /// + /// Operation Id + /// HybridContainerService_ListVMSkus + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + public virtual Response GetVmSkusHybridContainerService(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + using var scope0 = HybridContainerServiceClientDiagnostics.CreateScope("MockableHybridContainerServiceArmClient.GetVmSkusHybridContainerService"); + scope0.Start(); + try + { + var response = HybridContainerServiceRestClient.ListVmSkus(scope, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProvisionedClusterResource GetProvisionedClusterResource(ResourceIdentifier id) + { + ProvisionedClusterResource.ValidateResourceId(id); + return new ProvisionedClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProvisionedClusterUpgradeProfileResource GetProvisionedClusterUpgradeProfileResource(ResourceIdentifier id) + { + ProvisionedClusterUpgradeProfileResource.ValidateResourceId(id); + return new ProvisionedClusterUpgradeProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridIdentityMetadataResource GetHybridIdentityMetadataResource(ResourceIdentifier id) + { + HybridIdentityMetadataResource.ValidateResourceId(id); + return new HybridIdentityMetadataResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridContainerServiceAgentPoolResource GetHybridContainerServiceAgentPoolResource(ResourceIdentifier id) + { + HybridContainerServiceAgentPoolResource.ValidateResourceId(id); + return new HybridContainerServiceAgentPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageSpaceResource GetStorageSpaceResource(ResourceIdentifier id) + { + StorageSpaceResource.ValidateResourceId(id); + return new StorageSpaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridContainerServiceVirtualNetworkResource GetHybridContainerServiceVirtualNetworkResource(ResourceIdentifier id) + { + HybridContainerServiceVirtualNetworkResource.ValidateResourceId(id); + return new HybridContainerServiceVirtualNetworkResource(Client, id); + } + } +} diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceResourceGroupResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceResourceGroupResource.cs new file mode 100644 index 0000000000000..50565e96394bf --- /dev/null +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceResourceGroupResource.cs @@ -0,0 +1,198 @@ +// 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.HybridContainerService; + +namespace Azure.ResourceManager.HybridContainerService.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHybridContainerServiceResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHybridContainerServiceResourceGroupResource() + { + } + + /// 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 MockableHybridContainerServiceResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ProvisionedClusterResources in the ResourceGroupResource. + /// An object representing collection of ProvisionedClusterResources and their operations over a ProvisionedClusterResource. + public virtual ProvisionedClusterCollection GetProvisionedClusters() + { + return GetCachedClient(client => new ProvisionedClusterCollection(client, Id)); + } + + /// + /// Gets the Hybrid AKS provisioned cluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName} + /// + /// + /// Operation Id + /// ProvisionedClusters_Get + /// + /// + /// + /// Parameter for the name of the provisioned cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetProvisionedClusterAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetProvisionedClusters().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the Hybrid AKS provisioned cluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName} + /// + /// + /// Operation Id + /// ProvisionedClusters_Get + /// + /// + /// + /// Parameter for the name of the provisioned cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetProvisionedCluster(string resourceName, CancellationToken cancellationToken = default) + { + return GetProvisionedClusters().Get(resourceName, cancellationToken); + } + + /// Gets a collection of StorageSpaceResources in the ResourceGroupResource. + /// An object representing collection of StorageSpaceResources and their operations over a StorageSpaceResource. + public virtual StorageSpaceCollection GetStorageSpaces() + { + return GetCachedClient(client => new StorageSpaceCollection(client, Id)); + } + + /// + /// Gets the Hybrid AKS storage space object + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName} + /// + /// + /// Operation Id + /// storageSpaces_Retrieve + /// + /// + /// + /// Parameter for the name of the storage object. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStorageSpaceAsync(string storageSpacesName, CancellationToken cancellationToken = default) + { + return await GetStorageSpaces().GetAsync(storageSpacesName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the Hybrid AKS storage space object + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName} + /// + /// + /// Operation Id + /// storageSpaces_Retrieve + /// + /// + /// + /// Parameter for the name of the storage object. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStorageSpace(string storageSpacesName, CancellationToken cancellationToken = default) + { + return GetStorageSpaces().Get(storageSpacesName, cancellationToken); + } + + /// Gets a collection of HybridContainerServiceVirtualNetworkResources in the ResourceGroupResource. + /// An object representing collection of HybridContainerServiceVirtualNetworkResources and their operations over a HybridContainerServiceVirtualNetworkResource. + public virtual HybridContainerServiceVirtualNetworkCollection GetHybridContainerServiceVirtualNetworks() + { + return GetCachedClient(client => new HybridContainerServiceVirtualNetworkCollection(client, Id)); + } + + /// + /// Gets the Hybrid AKS virtual network + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName} + /// + /// + /// Operation Id + /// virtualNetworks_Retrieve + /// + /// + /// + /// Parameter for the name of the virtual network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHybridContainerServiceVirtualNetworkAsync(string virtualNetworksName, CancellationToken cancellationToken = default) + { + return await GetHybridContainerServiceVirtualNetworks().GetAsync(virtualNetworksName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the Hybrid AKS virtual network + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName} + /// + /// + /// Operation Id + /// virtualNetworks_Retrieve + /// + /// + /// + /// Parameter for the name of the virtual network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHybridContainerServiceVirtualNetwork(string virtualNetworksName, CancellationToken cancellationToken = default) + { + return GetHybridContainerServiceVirtualNetworks().Get(virtualNetworksName, cancellationToken); + } + } +} diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceSubscriptionResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceSubscriptionResource.cs new file mode 100644 index 0000000000000..15daf15b027f7 --- /dev/null +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/MockableHybridContainerServiceSubscriptionResource.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridContainerService; + +namespace Azure.ResourceManager.HybridContainerService.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHybridContainerServiceSubscriptionResource : ArmResource + { + private ClientDiagnostics _provisionedClusterClientDiagnostics; + private ProvisionedClustersRestOperations _provisionedClusterRestClient; + private ClientDiagnostics _storageSpacestorageSpacesClientDiagnostics; + private StorageSpacesRestOperations _storageSpacestorageSpacesRestClient; + private ClientDiagnostics _hybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics; + private VirtualNetworksRestOperations _hybridContainerServiceVirtualNetworkvirtualNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHybridContainerServiceSubscriptionResource() + { + } + + /// 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 MockableHybridContainerServiceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ProvisionedClusterClientDiagnostics => _provisionedClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridContainerService", ProvisionedClusterResource.ResourceType.Namespace, Diagnostics); + private ProvisionedClustersRestOperations ProvisionedClusterRestClient => _provisionedClusterRestClient ??= new ProvisionedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ProvisionedClusterResource.ResourceType)); + private ClientDiagnostics StorageSpacestorageSpacesClientDiagnostics => _storageSpacestorageSpacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridContainerService", StorageSpaceResource.ResourceType.Namespace, Diagnostics); + private StorageSpacesRestOperations StorageSpacestorageSpacesRestClient => _storageSpacestorageSpacesRestClient ??= new StorageSpacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageSpaceResource.ResourceType)); + private ClientDiagnostics HybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics => _hybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridContainerService", HybridContainerServiceVirtualNetworkResource.ResourceType.Namespace, Diagnostics); + private VirtualNetworksRestOperations HybridContainerServiceVirtualNetworkvirtualNetworksRestClient => _hybridContainerServiceVirtualNetworkvirtualNetworksRestClient ??= new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HybridContainerServiceVirtualNetworkResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the Hybrid AKS provisioned cluster in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/provisionedClusters + /// + /// + /// Operation Id + /// ProvisionedClusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProvisionedClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProvisionedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProvisionedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProvisionedClusterResource(Client, ProvisionedClusterData.DeserializeProvisionedClusterData(e)), ProvisionedClusterClientDiagnostics, Pipeline, "MockableHybridContainerServiceSubscriptionResource.GetProvisionedClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the Hybrid AKS provisioned cluster in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/provisionedClusters + /// + /// + /// Operation Id + /// ProvisionedClusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProvisionedClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProvisionedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProvisionedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProvisionedClusterResource(Client, ProvisionedClusterData.DeserializeProvisionedClusterData(e)), ProvisionedClusterClientDiagnostics, Pipeline, "MockableHybridContainerServiceSubscriptionResource.GetProvisionedClusters", "value", "nextLink", cancellationToken); + } + + /// + /// List the Hybrid AKS storage object by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/storageSpaces + /// + /// + /// Operation Id + /// storageSpaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageSpacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageSpacestorageSpacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageSpacestorageSpacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageSpaceResource(Client, StorageSpaceData.DeserializeStorageSpaceData(e)), StorageSpacestorageSpacesClientDiagnostics, Pipeline, "MockableHybridContainerServiceSubscriptionResource.GetStorageSpaces", "value", "nextLink", cancellationToken); + } + + /// + /// List the Hybrid AKS storage object by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/storageSpaces + /// + /// + /// Operation Id + /// storageSpaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageSpaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageSpacestorageSpacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageSpacestorageSpacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageSpaceResource(Client, StorageSpaceData.DeserializeStorageSpaceData(e)), StorageSpacestorageSpacesClientDiagnostics, Pipeline, "MockableHybridContainerServiceSubscriptionResource.GetStorageSpaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the Hybrid AKS virtual networks by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/virtualNetworks + /// + /// + /// Operation Id + /// virtualNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHybridContainerServiceVirtualNetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HybridContainerServiceVirtualNetworkvirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridContainerServiceVirtualNetworkvirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridContainerServiceVirtualNetworkResource(Client, HybridContainerServiceVirtualNetworkData.DeserializeHybridContainerServiceVirtualNetworkData(e)), HybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics, Pipeline, "MockableHybridContainerServiceSubscriptionResource.GetHybridContainerServiceVirtualNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the Hybrid AKS virtual networks by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/virtualNetworks + /// + /// + /// Operation Id + /// virtualNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHybridContainerServiceVirtualNetworks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HybridContainerServiceVirtualNetworkvirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridContainerServiceVirtualNetworkvirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridContainerServiceVirtualNetworkResource(Client, HybridContainerServiceVirtualNetworkData.DeserializeHybridContainerServiceVirtualNetworkData(e)), HybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics, Pipeline, "MockableHybridContainerServiceSubscriptionResource.GetHybridContainerServiceVirtualNetworks", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d1bde90daf968..0000000000000 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HybridContainerService -{ - /// 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 ProvisionedClusterResources in the ResourceGroupResource. - /// An object representing collection of ProvisionedClusterResources and their operations over a ProvisionedClusterResource. - public virtual ProvisionedClusterCollection GetProvisionedClusters() - { - return GetCachedClient(Client => new ProvisionedClusterCollection(Client, Id)); - } - - /// Gets a collection of StorageSpaceResources in the ResourceGroupResource. - /// An object representing collection of StorageSpaceResources and their operations over a StorageSpaceResource. - public virtual StorageSpaceCollection GetStorageSpaces() - { - return GetCachedClient(Client => new StorageSpaceCollection(Client, Id)); - } - - /// Gets a collection of HybridContainerServiceVirtualNetworkResources in the ResourceGroupResource. - /// An object representing collection of HybridContainerServiceVirtualNetworkResources and their operations over a HybridContainerServiceVirtualNetworkResource. - public virtual HybridContainerServiceVirtualNetworkCollection GetHybridContainerServiceVirtualNetworks() - { - return GetCachedClient(Client => new HybridContainerServiceVirtualNetworkCollection(Client, Id)); - } - } -} diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index bfb4d12886ab4..0000000000000 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HybridContainerService -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _provisionedClusterClientDiagnostics; - private ProvisionedClustersRestOperations _provisionedClusterRestClient; - private ClientDiagnostics _storageSpacestorageSpacesClientDiagnostics; - private StorageSpacesRestOperations _storageSpacestorageSpacesRestClient; - private ClientDiagnostics _hybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics; - private VirtualNetworksRestOperations _hybridContainerServiceVirtualNetworkvirtualNetworksRestClient; - - /// 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 ProvisionedClusterClientDiagnostics => _provisionedClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridContainerService", ProvisionedClusterResource.ResourceType.Namespace, Diagnostics); - private ProvisionedClustersRestOperations ProvisionedClusterRestClient => _provisionedClusterRestClient ??= new ProvisionedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ProvisionedClusterResource.ResourceType)); - private ClientDiagnostics StorageSpacestorageSpacesClientDiagnostics => _storageSpacestorageSpacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridContainerService", StorageSpaceResource.ResourceType.Namespace, Diagnostics); - private StorageSpacesRestOperations StorageSpacestorageSpacesRestClient => _storageSpacestorageSpacesRestClient ??= new StorageSpacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageSpaceResource.ResourceType)); - private ClientDiagnostics HybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics => _hybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridContainerService", HybridContainerServiceVirtualNetworkResource.ResourceType.Namespace, Diagnostics); - private VirtualNetworksRestOperations HybridContainerServiceVirtualNetworkvirtualNetworksRestClient => _hybridContainerServiceVirtualNetworkvirtualNetworksRestClient ??= new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HybridContainerServiceVirtualNetworkResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the Hybrid AKS provisioned cluster in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/provisionedClusters - /// - /// - /// Operation Id - /// ProvisionedClusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProvisionedClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProvisionedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProvisionedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProvisionedClusterResource(Client, ProvisionedClusterData.DeserializeProvisionedClusterData(e)), ProvisionedClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProvisionedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the Hybrid AKS provisioned cluster in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/provisionedClusters - /// - /// - /// Operation Id - /// ProvisionedClusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProvisionedClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProvisionedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProvisionedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProvisionedClusterResource(Client, ProvisionedClusterData.DeserializeProvisionedClusterData(e)), ProvisionedClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetProvisionedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// List the Hybrid AKS storage object by subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/storageSpaces - /// - /// - /// Operation Id - /// storageSpaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageSpacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageSpacestorageSpacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageSpacestorageSpacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageSpaceResource(Client, StorageSpaceData.DeserializeStorageSpaceData(e)), StorageSpacestorageSpacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageSpaces", "value", "nextLink", cancellationToken); - } - - /// - /// List the Hybrid AKS storage object by subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/storageSpaces - /// - /// - /// Operation Id - /// storageSpaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageSpaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageSpacestorageSpacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageSpacestorageSpacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageSpaceResource(Client, StorageSpaceData.DeserializeStorageSpaceData(e)), StorageSpacestorageSpacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageSpaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the Hybrid AKS virtual networks by subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/virtualNetworks - /// - /// - /// Operation Id - /// virtualNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHybridContainerServiceVirtualNetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HybridContainerServiceVirtualNetworkvirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridContainerServiceVirtualNetworkvirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridContainerServiceVirtualNetworkResource(Client, HybridContainerServiceVirtualNetworkData.DeserializeHybridContainerServiceVirtualNetworkData(e)), HybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHybridContainerServiceVirtualNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the Hybrid AKS virtual networks by subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridContainerService/virtualNetworks - /// - /// - /// Operation Id - /// virtualNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHybridContainerServiceVirtualNetworks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HybridContainerServiceVirtualNetworkvirtualNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridContainerServiceVirtualNetworkvirtualNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridContainerServiceVirtualNetworkResource(Client, HybridContainerServiceVirtualNetworkData.DeserializeHybridContainerServiceVirtualNetworkData(e)), HybridContainerServiceVirtualNetworkvirtualNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHybridContainerServiceVirtualNetworks", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceAgentPoolResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceAgentPoolResource.cs index abc157ea6f3c4..c42adc387ae71 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceAgentPoolResource.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceAgentPoolResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.HybridContainerService public partial class HybridContainerServiceAgentPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The agentPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/agentPools/{agentPoolName}"; diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceVirtualNetworkResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceVirtualNetworkResource.cs index 6a4fdf223c2c3..57ca89833b100 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceVirtualNetworkResource.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridContainerServiceVirtualNetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HybridContainerService public partial class HybridContainerServiceVirtualNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworksName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworksName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworksName}"; diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridIdentityMetadataResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridIdentityMetadataResource.cs index dbe0b283a54b8..6686eb1894821 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridIdentityMetadataResource.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/HybridIdentityMetadataResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HybridContainerService public partial class HybridIdentityMetadataResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The hybridIdentityMetadataResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string hybridIdentityMetadataResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/hybridIdentityMetadata/{hybridIdentityMetadataResourceName}"; diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterResource.cs index db1d0f2034d4c..195e933853ebf 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterResource.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HybridContainerService public partial class ProvisionedClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}"; @@ -100,7 +103,7 @@ public virtual ProvisionedClusterUpgradeProfileResource GetProvisionedClusterUpg /// An object representing collection of HybridIdentityMetadataResources and their operations over a HybridIdentityMetadataResource. public virtual HybridIdentityMetadataCollection GetAllHybridIdentityMetadata() { - return GetCachedClient(Client => new HybridIdentityMetadataCollection(Client, Id)); + return GetCachedClient(client => new HybridIdentityMetadataCollection(client, Id)); } /// @@ -118,8 +121,8 @@ public virtual HybridIdentityMetadataCollection GetAllHybridIdentityMetadata() /// /// Parameter for the name of the hybrid identity metadata resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHybridIdentityMetadataAsync(string hybridIdentityMetadataResourceName, CancellationToken cancellationToken = default) { @@ -141,8 +144,8 @@ public virtual async Task> GetHybridIde /// /// Parameter for the name of the hybrid identity metadata resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHybridIdentityMetadata(string hybridIdentityMetadataResourceName, CancellationToken cancellationToken = default) { @@ -153,7 +156,7 @@ public virtual Response GetHybridIdentityMetadat /// An object representing collection of HybridContainerServiceAgentPoolResources and their operations over a HybridContainerServiceAgentPoolResource. public virtual HybridContainerServiceAgentPoolCollection GetHybridContainerServiceAgentPools() { - return GetCachedClient(Client => new HybridContainerServiceAgentPoolCollection(Client, Id)); + return GetCachedClient(client => new HybridContainerServiceAgentPoolCollection(client, Id)); } /// @@ -171,8 +174,8 @@ public virtual HybridContainerServiceAgentPoolCollection GetHybridContainerServi /// /// Parameter for the name of the agent pool in the provisioned cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHybridContainerServiceAgentPoolAsync(string agentPoolName, CancellationToken cancellationToken = default) { @@ -194,8 +197,8 @@ public virtual async Task> Get /// /// Parameter for the name of the agent pool in the provisioned cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHybridContainerServiceAgentPool(string agentPoolName, CancellationToken cancellationToken = default) { diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterUpgradeProfileResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterUpgradeProfileResource.cs index b4452af7b962d..a1e314e074eb4 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterUpgradeProfileResource.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterUpgradeProfileResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.HybridContainerService public partial class ProvisionedClusterUpgradeProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/provisionedClusters/{resourceName}/upgradeProfiles/default"; diff --git a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/StorageSpaceResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/StorageSpaceResource.cs index fe9e8fbc3dd61..63fb339fb028b 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/StorageSpaceResource.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/StorageSpaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HybridContainerService public partial class StorageSpaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageSpacesName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageSpacesName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/storageSpaces/{storageSpacesName}"; diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/Azure.ResourceManager.HybridCompute.sln b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/Azure.ResourceManager.HybridCompute.sln index 34c2d8cd0696b..4c05b872a00b0 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/Azure.ResourceManager.HybridCompute.sln +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/Azure.ResourceManager.HybridCompute.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{D6E0CD10-D3BE-4D49-901E-2997F926FBBD}") = "Azure.ResourceManager.HybridCompute", "src\Azure.ResourceManager.HybridCompute.csproj", "{1AD719EF-54CF-450B-9578-B0C7F5CA10C3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridCompute", "src\Azure.ResourceManager.HybridCompute.csproj", "{1AD719EF-54CF-450B-9578-B0C7F5CA10C3}" EndProject -Project("{D6E0CD10-D3BE-4D49-901E-2997F926FBBD}") = "Azure.ResourceManager.HybridCompute.Tests", "tests\Azure.ResourceManager.HybridCompute.Tests.csproj", "{BB372D6E-BA1F-4AA2-AE1E-0C402F98D2BC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridCompute.Tests", "tests\Azure.ResourceManager.HybridCompute.Tests.csproj", "{BB372D6E-BA1F-4AA2-AE1E-0C402F98D2BC}" EndProject -Project("{D6E0CD10-D3BE-4D49-901E-2997F926FBBD}") = "Azure.ResourceManager.HybridCompute.Samples", "samples\Azure.ResourceManager.HybridCompute.Samples.csproj", "{66CB81E6-0932-4096-A3AD-3353D52EEC9F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridCompute.Samples", "samples\Azure.ResourceManager.HybridCompute.Samples.csproj", "{66CB81E6-0932-4096-A3AD-3353D52EEC9F}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {5E75EF05-784B-47D7-A1B9-B094F08EF097} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {BB372D6E-BA1F-4AA2-AE1E-0C402F98D2BC}.Release|x64.Build.0 = Release|Any CPU {BB372D6E-BA1F-4AA2-AE1E-0C402F98D2BC}.Release|x86.ActiveCfg = Release|Any CPU {BB372D6E-BA1F-4AA2-AE1E-0C402F98D2BC}.Release|x86.Build.0 = Release|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Debug|x64.ActiveCfg = Debug|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Debug|x64.Build.0 = Debug|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Debug|x86.ActiveCfg = Debug|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Debug|x86.Build.0 = Debug|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Release|Any CPU.Build.0 = Release|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Release|x64.ActiveCfg = Release|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Release|x64.Build.0 = Release|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Release|x86.ActiveCfg = Release|Any CPU + {66CB81E6-0932-4096-A3AD-3353D52EEC9F}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5E75EF05-784B-47D7-A1B9-B094F08EF097} EndGlobalSection EndGlobal diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/api/Azure.ResourceManager.HybridCompute.netstandard2.0.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/api/Azure.ResourceManager.HybridCompute.netstandard2.0.cs index e66738bbe4ac2..72f111201114b 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/api/Azure.ResourceManager.HybridCompute.netstandard2.0.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/api/Azure.ResourceManager.HybridCompute.netstandard2.0.cs @@ -75,7 +75,7 @@ protected HybridComputeMachineCollection() { } } public partial class HybridComputeMachineData : Azure.ResourceManager.Models.TrackedResourceData { - public HybridComputeMachineData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HybridComputeMachineData(Azure.Core.AzureLocation location) { } public string AdFqdn { get { throw null; } } public Azure.ResourceManager.HybridCompute.Models.AgentConfiguration AgentConfiguration { get { throw null; } } public Azure.ResourceManager.HybridCompute.Models.AgentUpgrade AgentUpgrade { get { throw null; } set { } } @@ -126,7 +126,7 @@ protected HybridComputeMachineExtensionCollection() { } } public partial class HybridComputeMachineExtensionData : Azure.ResourceManager.Models.TrackedResourceData { - public HybridComputeMachineExtensionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HybridComputeMachineExtensionData(Azure.Core.AzureLocation location) { } public bool? AutoUpgradeMinorVersion { get { throw null; } set { } } public bool? EnableAutomaticUpgrade { get { throw null; } set { } } public string ForceUpdateTag { get { throw null; } set { } } @@ -276,7 +276,7 @@ protected HybridComputePrivateLinkScopeCollection() { } } public partial class HybridComputePrivateLinkScopeData : Azure.ResourceManager.Models.TrackedResourceData { - public HybridComputePrivateLinkScopeData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public HybridComputePrivateLinkScopeData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.HybridCompute.Models.HybridComputePrivateLinkScopeProperties Properties { get { throw null; } set { } } } public partial class HybridComputePrivateLinkScopeResource : Azure.ResourceManager.ArmResource @@ -306,6 +306,42 @@ protected HybridComputePrivateLinkScopeResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridCompute.Models.HybridComputePrivateLinkScopePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.HybridCompute.Mocking +{ + public partial class MockableHybridComputeArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHybridComputeArmClient() { } + public virtual Azure.ResourceManager.HybridCompute.ExtensionValueResource GetExtensionValueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridCompute.HybridComputeMachineExtensionResource GetHybridComputeMachineExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridCompute.HybridComputeMachineResource GetHybridComputeMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridCompute.HybridComputePrivateEndpointConnectionResource GetHybridComputePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridCompute.HybridComputePrivateLinkResource GetHybridComputePrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridCompute.HybridComputePrivateLinkScopeResource GetHybridComputePrivateLinkScopeResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHybridComputeResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHybridComputeResourceGroupResource() { } + public virtual Azure.Response GetHybridComputeMachine(string machineName, Azure.ResourceManager.HybridCompute.Models.InstanceViewType? expand = default(Azure.ResourceManager.HybridCompute.Models.InstanceViewType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHybridComputeMachineAsync(string machineName, Azure.ResourceManager.HybridCompute.Models.InstanceViewType? expand = default(Azure.ResourceManager.HybridCompute.Models.InstanceViewType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridCompute.HybridComputeMachineCollection GetHybridComputeMachines() { throw null; } + public virtual Azure.Response GetHybridComputePrivateLinkScope(string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHybridComputePrivateLinkScopeAsync(string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridCompute.HybridComputePrivateLinkScopeCollection GetHybridComputePrivateLinkScopes() { throw null; } + } + public partial class MockableHybridComputeSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHybridComputeSubscriptionResource() { } + public virtual Azure.Response GetExtensionValue(Azure.Core.AzureLocation location, string publisher, string extensionType, string version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExtensionValueAsync(Azure.Core.AzureLocation location, string publisher, string extensionType, string version, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridCompute.ExtensionValueCollection GetExtensionValues(Azure.Core.AzureLocation location, string publisher, string extensionType) { throw null; } + public virtual Azure.Pageable GetHybridComputeMachines(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHybridComputeMachinesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHybridComputePrivateLinkScopes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHybridComputePrivateLinkScopesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetValidationDetailsPrivateLinkScope(Azure.Core.AzureLocation location, string privateLinkScopeId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetValidationDetailsPrivateLinkScopeAsync(Azure.Core.AzureLocation location, string privateLinkScopeId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.HybridCompute.Models { public partial class AgentConfiguration diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/ExtensionValueResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/ExtensionValueResource.cs index 9a7151c5e4995..d8ed4b8134aa1 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/ExtensionValueResource.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/ExtensionValueResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.HybridCompute public partial class ExtensionValueResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The publisher. + /// The extensionType. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string publisher, string extensionType, string version) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}"; diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/HybridComputeExtensions.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/HybridComputeExtensions.cs index 005ca6aae8ccf..c4a0d50023c5a 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/HybridComputeExtensions.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/HybridComputeExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.HybridCompute.Mocking; using Azure.ResourceManager.HybridCompute.Models; using Azure.ResourceManager.Resources; @@ -19,157 +20,129 @@ namespace Azure.ResourceManager.HybridCompute /// A class to add extension methods to Azure.ResourceManager.HybridCompute. public static partial class HybridComputeExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableHybridComputeArmClient GetMockableHybridComputeArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHybridComputeArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableHybridComputeResourceGroupResource GetMockableHybridComputeResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableHybridComputeResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableHybridComputeSubscriptionResource GetMockableHybridComputeSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableHybridComputeSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region HybridComputeMachineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridComputeMachineResource GetHybridComputeMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridComputeMachineResource.ValidateResourceId(id); - return new HybridComputeMachineResource(client, id); - } - ); + return GetMockableHybridComputeArmClient(client).GetHybridComputeMachineResource(id); } - #endregion - #region HybridComputeMachineExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridComputeMachineExtensionResource GetHybridComputeMachineExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridComputeMachineExtensionResource.ValidateResourceId(id); - return new HybridComputeMachineExtensionResource(client, id); - } - ); + return GetMockableHybridComputeArmClient(client).GetHybridComputeMachineExtensionResource(id); } - #endregion - #region ExtensionValueResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExtensionValueResource GetExtensionValueResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExtensionValueResource.ValidateResourceId(id); - return new ExtensionValueResource(client, id); - } - ); + return GetMockableHybridComputeArmClient(client).GetExtensionValueResource(id); } - #endregion - #region HybridComputePrivateLinkScopeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridComputePrivateLinkScopeResource GetHybridComputePrivateLinkScopeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridComputePrivateLinkScopeResource.ValidateResourceId(id); - return new HybridComputePrivateLinkScopeResource(client, id); - } - ); + return GetMockableHybridComputeArmClient(client).GetHybridComputePrivateLinkScopeResource(id); } - #endregion - #region HybridComputePrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridComputePrivateLinkResource GetHybridComputePrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridComputePrivateLinkResource.ValidateResourceId(id); - return new HybridComputePrivateLinkResource(client, id); - } - ); + return GetMockableHybridComputeArmClient(client).GetHybridComputePrivateLinkResource(id); } - #endregion - #region HybridComputePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridComputePrivateEndpointConnectionResource GetHybridComputePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridComputePrivateEndpointConnectionResource.ValidateResourceId(id); - return new HybridComputePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableHybridComputeArmClient(client).GetHybridComputePrivateEndpointConnectionResource(id); } - #endregion - /// Gets a collection of HybridComputeMachineResources in the ResourceGroupResource. + /// + /// Gets a collection of HybridComputeMachineResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HybridComputeMachineResources and their operations over a HybridComputeMachineResource. public static HybridComputeMachineCollection GetHybridComputeMachines(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHybridComputeMachines(); + return GetMockableHybridComputeResourceGroupResource(resourceGroupResource).GetHybridComputeMachines(); } /// @@ -184,17 +157,21 @@ public static HybridComputeMachineCollection GetHybridComputeMachines(this Resou /// Machines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the hybrid machine. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHybridComputeMachineAsync(this ResourceGroupResource resourceGroupResource, string machineName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHybridComputeMachines().GetAsync(machineName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableHybridComputeResourceGroupResource(resourceGroupResource).GetHybridComputeMachineAsync(machineName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -209,25 +186,35 @@ public static async Task> GetHybridComput /// Machines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the hybrid machine. /// The expand expression to apply on the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHybridComputeMachine(this ResourceGroupResource resourceGroupResource, string machineName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHybridComputeMachines().Get(machineName, expand, cancellationToken); + return GetMockableHybridComputeResourceGroupResource(resourceGroupResource).GetHybridComputeMachine(machineName, expand, cancellationToken); } - /// Gets a collection of HybridComputePrivateLinkScopeResources in the ResourceGroupResource. + /// + /// Gets a collection of HybridComputePrivateLinkScopeResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of HybridComputePrivateLinkScopeResources and their operations over a HybridComputePrivateLinkScopeResource. public static HybridComputePrivateLinkScopeCollection GetHybridComputePrivateLinkScopes(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHybridComputePrivateLinkScopes(); + return GetMockableHybridComputeResourceGroupResource(resourceGroupResource).GetHybridComputePrivateLinkScopes(); } /// @@ -242,16 +229,20 @@ public static HybridComputePrivateLinkScopeCollection GetHybridComputePrivateLin /// PrivateLinkScopes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Arc PrivateLinkScope resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHybridComputePrivateLinkScopeAsync(this ResourceGroupResource resourceGroupResource, string scopeName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHybridComputePrivateLinkScopes().GetAsync(scopeName, cancellationToken).ConfigureAwait(false); + return await GetMockableHybridComputeResourceGroupResource(resourceGroupResource).GetHybridComputePrivateLinkScopeAsync(scopeName, cancellationToken).ConfigureAwait(false); } /// @@ -266,32 +257,39 @@ public static async Task> GetHyb /// PrivateLinkScopes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Arc PrivateLinkScope resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHybridComputePrivateLinkScope(this ResourceGroupResource resourceGroupResource, string scopeName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHybridComputePrivateLinkScopes().Get(scopeName, cancellationToken); + return GetMockableHybridComputeResourceGroupResource(resourceGroupResource).GetHybridComputePrivateLinkScope(scopeName, cancellationToken); } - /// Gets a collection of ExtensionValueResources in the SubscriptionResource. + /// + /// Gets a collection of ExtensionValueResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The location of the Extension being received. /// The publisher of the Extension being received. /// The extensionType of the Extension being received. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. /// An object representing collection of ExtensionValueResources and their operations over a ExtensionValueResource. public static ExtensionValueCollection GetExtensionValues(this SubscriptionResource subscriptionResource, AzureLocation location, string publisher, string extensionType) { - Argument.AssertNotNullOrEmpty(publisher, nameof(publisher)); - Argument.AssertNotNullOrEmpty(extensionType, nameof(extensionType)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExtensionValues(location, publisher, extensionType); + return GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetExtensionValues(location, publisher, extensionType); } /// @@ -306,6 +304,10 @@ public static ExtensionValueCollection GetExtensionValues(this SubscriptionResou /// ExtensionMetadata_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the Extension being received. @@ -313,12 +315,12 @@ public static ExtensionValueCollection GetExtensionValues(this SubscriptionResou /// The extensionType of the Extension being received. /// The version of the Extension being received. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetExtensionValueAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string publisher, string extensionType, string version, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetExtensionValues(location, publisher, extensionType).GetAsync(version, cancellationToken).ConfigureAwait(false); + return await GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetExtensionValueAsync(location, publisher, extensionType, version, cancellationToken).ConfigureAwait(false); } /// @@ -333,6 +335,10 @@ public static async Task> GetExtensionValueAsyn /// ExtensionMetadata_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the Extension being received. @@ -340,12 +346,12 @@ public static async Task> GetExtensionValueAsyn /// The extensionType of the Extension being received. /// The version of the Extension being received. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetExtensionValue(this SubscriptionResource subscriptionResource, AzureLocation location, string publisher, string extensionType, string version, CancellationToken cancellationToken = default) { - return subscriptionResource.GetExtensionValues(location, publisher, extensionType).Get(version, cancellationToken); + return GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetExtensionValue(location, publisher, extensionType, version, cancellationToken); } /// @@ -360,13 +366,17 @@ public static Response GetExtensionValue(this Subscripti /// Machines_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHybridComputeMachinesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHybridComputeMachinesAsync(cancellationToken); + return GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetHybridComputeMachinesAsync(cancellationToken); } /// @@ -381,13 +391,17 @@ public static AsyncPageable GetHybridComputeMachin /// Machines_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHybridComputeMachines(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHybridComputeMachines(cancellationToken); + return GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetHybridComputeMachines(cancellationToken); } /// @@ -402,13 +416,17 @@ public static Pageable GetHybridComputeMachines(th /// PrivateLinkScopes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHybridComputePrivateLinkScopesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHybridComputePrivateLinkScopesAsync(cancellationToken); + return GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetHybridComputePrivateLinkScopesAsync(cancellationToken); } /// @@ -423,13 +441,17 @@ public static AsyncPageable GetHybridComp /// PrivateLinkScopes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetHybridComputePrivateLinkScopes(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetHybridComputePrivateLinkScopes(cancellationToken); + return GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetHybridComputePrivateLinkScopes(cancellationToken); } /// @@ -444,6 +466,10 @@ public static Pageable GetHybridComputePr /// PrivateLinkScopes_GetValidationDetails /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the target resource. @@ -453,9 +479,7 @@ public static Pageable GetHybridComputePr /// is null. public static async Task> GetValidationDetailsPrivateLinkScopeAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string privateLinkScopeId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(privateLinkScopeId, nameof(privateLinkScopeId)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetValidationDetailsPrivateLinkScopeAsync(location, privateLinkScopeId, cancellationToken).ConfigureAwait(false); + return await GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetValidationDetailsPrivateLinkScopeAsync(location, privateLinkScopeId, cancellationToken).ConfigureAwait(false); } /// @@ -470,6 +494,10 @@ public static async Task> GetValidat /// PrivateLinkScopes_GetValidationDetails /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the target resource. @@ -479,9 +507,7 @@ public static async Task> GetValidat /// is null. public static Response GetValidationDetailsPrivateLinkScope(this SubscriptionResource subscriptionResource, AzureLocation location, string privateLinkScopeId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(privateLinkScopeId, nameof(privateLinkScopeId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetValidationDetailsPrivateLinkScope(location, privateLinkScopeId, cancellationToken); + return GetMockableHybridComputeSubscriptionResource(subscriptionResource).GetValidationDetailsPrivateLinkScope(location, privateLinkScopeId, cancellationToken); } } } diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeArmClient.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeArmClient.cs new file mode 100644 index 0000000000000..3e13341cc661f --- /dev/null +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeArmClient.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridCompute; + +namespace Azure.ResourceManager.HybridCompute.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHybridComputeArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHybridComputeArmClient() + { + } + + /// 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 MockableHybridComputeArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHybridComputeArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridComputeMachineResource GetHybridComputeMachineResource(ResourceIdentifier id) + { + HybridComputeMachineResource.ValidateResourceId(id); + return new HybridComputeMachineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridComputeMachineExtensionResource GetHybridComputeMachineExtensionResource(ResourceIdentifier id) + { + HybridComputeMachineExtensionResource.ValidateResourceId(id); + return new HybridComputeMachineExtensionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExtensionValueResource GetExtensionValueResource(ResourceIdentifier id) + { + ExtensionValueResource.ValidateResourceId(id); + return new ExtensionValueResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridComputePrivateLinkScopeResource GetHybridComputePrivateLinkScopeResource(ResourceIdentifier id) + { + HybridComputePrivateLinkScopeResource.ValidateResourceId(id); + return new HybridComputePrivateLinkScopeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridComputePrivateLinkResource GetHybridComputePrivateLinkResource(ResourceIdentifier id) + { + HybridComputePrivateLinkResource.ValidateResourceId(id); + return new HybridComputePrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridComputePrivateEndpointConnectionResource GetHybridComputePrivateEndpointConnectionResource(ResourceIdentifier id) + { + HybridComputePrivateEndpointConnectionResource.ValidateResourceId(id); + return new HybridComputePrivateEndpointConnectionResource(Client, id); + } + } +} diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeResourceGroupResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeResourceGroupResource.cs new file mode 100644 index 0000000000000..ac8ada4cde3cb --- /dev/null +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeResourceGroupResource.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridCompute; +using Azure.ResourceManager.HybridCompute.Models; + +namespace Azure.ResourceManager.HybridCompute.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHybridComputeResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHybridComputeResourceGroupResource() + { + } + + /// 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 MockableHybridComputeResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of HybridComputeMachineResources in the ResourceGroupResource. + /// An object representing collection of HybridComputeMachineResources and their operations over a HybridComputeMachineResource. + public virtual HybridComputeMachineCollection GetHybridComputeMachines() + { + return GetCachedClient(client => new HybridComputeMachineCollection(client, Id)); + } + + /// + /// Retrieves information about the model view or the instance view of a hybrid machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// + /// The name of the hybrid machine. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHybridComputeMachineAsync(string machineName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + return await GetHybridComputeMachines().GetAsync(machineName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about the model view or the instance view of a hybrid machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName} + /// + /// + /// Operation Id + /// Machines_Get + /// + /// + /// + /// The name of the hybrid machine. + /// The expand expression to apply on the operation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHybridComputeMachine(string machineName, InstanceViewType? expand = null, CancellationToken cancellationToken = default) + { + return GetHybridComputeMachines().Get(machineName, expand, cancellationToken); + } + + /// Gets a collection of HybridComputePrivateLinkScopeResources in the ResourceGroupResource. + /// An object representing collection of HybridComputePrivateLinkScopeResources and their operations over a HybridComputePrivateLinkScopeResource. + public virtual HybridComputePrivateLinkScopeCollection GetHybridComputePrivateLinkScopes() + { + return GetCachedClient(client => new HybridComputePrivateLinkScopeCollection(client, Id)); + } + + /// + /// Returns a Azure Arc PrivateLinkScope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName} + /// + /// + /// Operation Id + /// PrivateLinkScopes_Get + /// + /// + /// + /// The name of the Azure Arc PrivateLinkScope resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHybridComputePrivateLinkScopeAsync(string scopeName, CancellationToken cancellationToken = default) + { + return await GetHybridComputePrivateLinkScopes().GetAsync(scopeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a Azure Arc PrivateLinkScope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName} + /// + /// + /// Operation Id + /// PrivateLinkScopes_Get + /// + /// + /// + /// The name of the Azure Arc PrivateLinkScope resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHybridComputePrivateLinkScope(string scopeName, CancellationToken cancellationToken = default) + { + return GetHybridComputePrivateLinkScopes().Get(scopeName, cancellationToken); + } + } +} diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeSubscriptionResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeSubscriptionResource.cs new file mode 100644 index 0000000000000..253027056a807 --- /dev/null +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/MockableHybridComputeSubscriptionResource.cs @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridCompute; +using Azure.ResourceManager.HybridCompute.Models; + +namespace Azure.ResourceManager.HybridCompute.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHybridComputeSubscriptionResource : ArmResource + { + private ClientDiagnostics _hybridComputeMachineMachinesClientDiagnostics; + private MachinesRestOperations _hybridComputeMachineMachinesRestClient; + private ClientDiagnostics _hybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics; + private PrivateLinkScopesRestOperations _hybridComputePrivateLinkScopePrivateLinkScopesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHybridComputeSubscriptionResource() + { + } + + /// 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 MockableHybridComputeSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics HybridComputeMachineMachinesClientDiagnostics => _hybridComputeMachineMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridCompute", HybridComputeMachineResource.ResourceType.Namespace, Diagnostics); + private MachinesRestOperations HybridComputeMachineMachinesRestClient => _hybridComputeMachineMachinesRestClient ??= new MachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HybridComputeMachineResource.ResourceType)); + private ClientDiagnostics HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics => _hybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridCompute", HybridComputePrivateLinkScopeResource.ResourceType.Namespace, Diagnostics); + private PrivateLinkScopesRestOperations HybridComputePrivateLinkScopePrivateLinkScopesRestClient => _hybridComputePrivateLinkScopePrivateLinkScopesRestClient ??= new PrivateLinkScopesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HybridComputePrivateLinkScopeResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ExtensionValueResources in the SubscriptionResource. + /// The location of the Extension being received. + /// The publisher of the Extension being received. + /// The extensionType of the Extension being received. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of ExtensionValueResources and their operations over a ExtensionValueResource. + public virtual ExtensionValueCollection GetExtensionValues(AzureLocation location, string publisher, string extensionType) + { + return new ExtensionValueCollection(Client, Id, location, publisher, extensionType); + } + + /// + /// Gets an Extension Metadata based on location, publisher, extensionType and version + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version} + /// + /// + /// Operation Id + /// ExtensionMetadata_Get + /// + /// + /// + /// The location of the Extension being received. + /// The publisher of the Extension being received. + /// The extensionType of the Extension being received. + /// The version of the Extension being received. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetExtensionValueAsync(AzureLocation location, string publisher, string extensionType, string version, CancellationToken cancellationToken = default) + { + return await GetExtensionValues(location, publisher, extensionType).GetAsync(version, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an Extension Metadata based on location, publisher, extensionType and version + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version} + /// + /// + /// Operation Id + /// ExtensionMetadata_Get + /// + /// + /// + /// The location of the Extension being received. + /// The publisher of the Extension being received. + /// The extensionType of the Extension being received. + /// The version of the Extension being received. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetExtensionValue(AzureLocation location, string publisher, string extensionType, string version, CancellationToken cancellationToken = default) + { + return GetExtensionValues(location, publisher, extensionType).Get(version, cancellationToken); + } + + /// + /// Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines + /// + /// + /// Operation Id + /// Machines_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHybridComputeMachinesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HybridComputeMachineMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridComputeMachineMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridComputeMachineResource(Client, HybridComputeMachineData.DeserializeHybridComputeMachineData(e)), HybridComputeMachineMachinesClientDiagnostics, Pipeline, "MockableHybridComputeSubscriptionResource.GetHybridComputeMachines", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines + /// + /// + /// Operation Id + /// Machines_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHybridComputeMachines(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HybridComputeMachineMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridComputeMachineMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridComputeMachineResource(Client, HybridComputeMachineData.DeserializeHybridComputeMachineData(e)), HybridComputeMachineMachinesClientDiagnostics, Pipeline, "MockableHybridComputeSubscriptionResource.GetHybridComputeMachines", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Azure Arc PrivateLinkScopes within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes + /// + /// + /// Operation Id + /// PrivateLinkScopes_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHybridComputePrivateLinkScopesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HybridComputePrivateLinkScopePrivateLinkScopesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridComputePrivateLinkScopePrivateLinkScopesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridComputePrivateLinkScopeResource(Client, HybridComputePrivateLinkScopeData.DeserializeHybridComputePrivateLinkScopeData(e)), HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics, Pipeline, "MockableHybridComputeSubscriptionResource.GetHybridComputePrivateLinkScopes", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Azure Arc PrivateLinkScopes within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes + /// + /// + /// Operation Id + /// PrivateLinkScopes_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHybridComputePrivateLinkScopes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => HybridComputePrivateLinkScopePrivateLinkScopesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridComputePrivateLinkScopePrivateLinkScopesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridComputePrivateLinkScopeResource(Client, HybridComputePrivateLinkScopeData.DeserializeHybridComputePrivateLinkScopeData(e)), HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics, Pipeline, "MockableHybridComputeSubscriptionResource.GetHybridComputePrivateLinkScopes", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a Azure Arc PrivateLinkScope's validation details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/privateLinkScopes/{privateLinkScopeId} + /// + /// + /// Operation Id + /// PrivateLinkScopes_GetValidationDetails + /// + /// + /// + /// The location of the target resource. + /// The id (Guid) of the Azure Arc PrivateLinkScope resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetValidationDetailsPrivateLinkScopeAsync(AzureLocation location, string privateLinkScopeId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkScopeId, nameof(privateLinkScopeId)); + + using var scope = HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics.CreateScope("MockableHybridComputeSubscriptionResource.GetValidationDetailsPrivateLinkScope"); + scope.Start(); + try + { + var response = await HybridComputePrivateLinkScopePrivateLinkScopesRestClient.GetValidationDetailsAsync(Id.SubscriptionId, location, privateLinkScopeId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns a Azure Arc PrivateLinkScope's validation details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/privateLinkScopes/{privateLinkScopeId} + /// + /// + /// Operation Id + /// PrivateLinkScopes_GetValidationDetails + /// + /// + /// + /// The location of the target resource. + /// The id (Guid) of the Azure Arc PrivateLinkScope resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetValidationDetailsPrivateLinkScope(AzureLocation location, string privateLinkScopeId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkScopeId, nameof(privateLinkScopeId)); + + using var scope = HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics.CreateScope("MockableHybridComputeSubscriptionResource.GetValidationDetailsPrivateLinkScope"); + scope.Start(); + try + { + var response = HybridComputePrivateLinkScopePrivateLinkScopesRestClient.GetValidationDetails(Id.SubscriptionId, location, privateLinkScopeId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index a4d98b11b08b1..0000000000000 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HybridCompute -{ - /// 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 HybridComputeMachineResources in the ResourceGroupResource. - /// An object representing collection of HybridComputeMachineResources and their operations over a HybridComputeMachineResource. - public virtual HybridComputeMachineCollection GetHybridComputeMachines() - { - return GetCachedClient(Client => new HybridComputeMachineCollection(Client, Id)); - } - - /// Gets a collection of HybridComputePrivateLinkScopeResources in the ResourceGroupResource. - /// An object representing collection of HybridComputePrivateLinkScopeResources and their operations over a HybridComputePrivateLinkScopeResource. - public virtual HybridComputePrivateLinkScopeCollection GetHybridComputePrivateLinkScopes() - { - return GetCachedClient(Client => new HybridComputePrivateLinkScopeCollection(Client, Id)); - } - } -} diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 12001559f25b6..0000000000000 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.HybridCompute.Models; - -namespace Azure.ResourceManager.HybridCompute -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _hybridComputeMachineMachinesClientDiagnostics; - private MachinesRestOperations _hybridComputeMachineMachinesRestClient; - private ClientDiagnostics _hybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics; - private PrivateLinkScopesRestOperations _hybridComputePrivateLinkScopePrivateLinkScopesRestClient; - - /// 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 HybridComputeMachineMachinesClientDiagnostics => _hybridComputeMachineMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridCompute", HybridComputeMachineResource.ResourceType.Namespace, Diagnostics); - private MachinesRestOperations HybridComputeMachineMachinesRestClient => _hybridComputeMachineMachinesRestClient ??= new MachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HybridComputeMachineResource.ResourceType)); - private ClientDiagnostics HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics => _hybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridCompute", HybridComputePrivateLinkScopeResource.ResourceType.Namespace, Diagnostics); - private PrivateLinkScopesRestOperations HybridComputePrivateLinkScopePrivateLinkScopesRestClient => _hybridComputePrivateLinkScopePrivateLinkScopesRestClient ??= new PrivateLinkScopesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HybridComputePrivateLinkScopeResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ExtensionValueResources in the SubscriptionResource. - /// The location of the Extension being received. - /// The publisher of the Extension being received. - /// The extensionType of the Extension being received. - /// An object representing collection of ExtensionValueResources and their operations over a ExtensionValueResource. - public virtual ExtensionValueCollection GetExtensionValues(AzureLocation location, string publisher, string extensionType) - { - return new ExtensionValueCollection(Client, Id, location, publisher, extensionType); - } - - /// - /// Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines - /// - /// - /// Operation Id - /// Machines_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHybridComputeMachinesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HybridComputeMachineMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridComputeMachineMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridComputeMachineResource(Client, HybridComputeMachineData.DeserializeHybridComputeMachineData(e)), HybridComputeMachineMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHybridComputeMachines", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines - /// - /// - /// Operation Id - /// Machines_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHybridComputeMachines(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HybridComputeMachineMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridComputeMachineMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridComputeMachineResource(Client, HybridComputeMachineData.DeserializeHybridComputeMachineData(e)), HybridComputeMachineMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHybridComputeMachines", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all Azure Arc PrivateLinkScopes within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes - /// - /// - /// Operation Id - /// PrivateLinkScopes_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHybridComputePrivateLinkScopesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HybridComputePrivateLinkScopePrivateLinkScopesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridComputePrivateLinkScopePrivateLinkScopesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HybridComputePrivateLinkScopeResource(Client, HybridComputePrivateLinkScopeData.DeserializeHybridComputePrivateLinkScopeData(e)), HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHybridComputePrivateLinkScopes", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all Azure Arc PrivateLinkScopes within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes - /// - /// - /// Operation Id - /// PrivateLinkScopes_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHybridComputePrivateLinkScopes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => HybridComputePrivateLinkScopePrivateLinkScopesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HybridComputePrivateLinkScopePrivateLinkScopesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HybridComputePrivateLinkScopeResource(Client, HybridComputePrivateLinkScopeData.DeserializeHybridComputePrivateLinkScopeData(e)), HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetHybridComputePrivateLinkScopes", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a Azure Arc PrivateLinkScope's validation details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/privateLinkScopes/{privateLinkScopeId} - /// - /// - /// Operation Id - /// PrivateLinkScopes_GetValidationDetails - /// - /// - /// - /// The location of the target resource. - /// The id (Guid) of the Azure Arc PrivateLinkScope resource. - /// The cancellation token to use. - public virtual async Task> GetValidationDetailsPrivateLinkScopeAsync(AzureLocation location, string privateLinkScopeId, CancellationToken cancellationToken = default) - { - using var scope = HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetValidationDetailsPrivateLinkScope"); - scope.Start(); - try - { - var response = await HybridComputePrivateLinkScopePrivateLinkScopesRestClient.GetValidationDetailsAsync(Id.SubscriptionId, location, privateLinkScopeId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns a Azure Arc PrivateLinkScope's validation details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/privateLinkScopes/{privateLinkScopeId} - /// - /// - /// Operation Id - /// PrivateLinkScopes_GetValidationDetails - /// - /// - /// - /// The location of the target resource. - /// The id (Guid) of the Azure Arc PrivateLinkScope resource. - /// The cancellation token to use. - public virtual Response GetValidationDetailsPrivateLinkScope(AzureLocation location, string privateLinkScopeId, CancellationToken cancellationToken = default) - { - using var scope = HybridComputePrivateLinkScopePrivateLinkScopesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetValidationDetailsPrivateLinkScope"); - scope.Start(); - try - { - var response = HybridComputePrivateLinkScopePrivateLinkScopesRestClient.GetValidationDetails(Id.SubscriptionId, location, privateLinkScopeId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineExtensionResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineExtensionResource.cs index 41691f2960daa..d3e182d1a0649 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineExtensionResource.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineExtensionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.HybridCompute public partial class HybridComputeMachineExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The machineName. + /// The extensionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string machineName, string extensionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}"; diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineResource.cs index 3c929770b020c..8bc926351cbdb 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineResource.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HybridCompute public partial class HybridComputeMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The machineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string machineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}"; @@ -106,7 +109,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HybridComputeMachineExtensionResources and their operations over a HybridComputeMachineExtensionResource. public virtual HybridComputeMachineExtensionCollection GetHybridComputeMachineExtensions() { - return GetCachedClient(Client => new HybridComputeMachineExtensionCollection(Client, Id)); + return GetCachedClient(client => new HybridComputeMachineExtensionCollection(client, Id)); } /// @@ -124,8 +127,8 @@ public virtual HybridComputeMachineExtensionCollection GetHybridComputeMachineEx /// /// The name of the machine extension. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHybridComputeMachineExtensionAsync(string extensionName, CancellationToken cancellationToken = default) { @@ -147,8 +150,8 @@ public virtual async Task> GetHy /// /// The name of the machine extension. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHybridComputeMachineExtension(string extensionName, CancellationToken cancellationToken = default) { diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateEndpointConnectionResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateEndpointConnectionResource.cs index 845eb24e75a1b..0015f94099375 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateEndpointConnectionResource.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HybridCompute public partial class HybridComputePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scopeName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scopeName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkResource.cs index 535856d6cb174..4e96ca635758d 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkResource.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.HybridCompute public partial class HybridComputePrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scopeName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scopeName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}"; diff --git a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeResource.cs index d3d6494c98f78..f8ec51e792d2f 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeResource.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.HybridCompute public partial class HybridComputePrivateLinkScopeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scopeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scopeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HybridComputePrivateLinkResources and their operations over a HybridComputePrivateLinkResource. public virtual HybridComputePrivateLinkResourceCollection GetHybridComputePrivateLinkResources() { - return GetCachedClient(Client => new HybridComputePrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new HybridComputePrivateLinkResourceCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual HybridComputePrivateLinkResourceCollection GetHybridComputePrivat /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHybridComputePrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetHybridC /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHybridComputePrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetHybridComputePrivat /// An object representing collection of HybridComputePrivateEndpointConnectionResources and their operations over a HybridComputePrivateEndpointConnectionResource. public virtual HybridComputePrivateEndpointConnectionCollection GetHybridComputePrivateEndpointConnections() { - return GetCachedClient(Client => new HybridComputePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new HybridComputePrivateEndpointConnectionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual HybridComputePrivateEndpointConnectionCollection GetHybridCompute /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHybridComputePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHybridComputePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/api/Azure.ResourceManager.HybridConnectivity.netstandard2.0.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/api/Azure.ResourceManager.HybridConnectivity.netstandard2.0.cs index 57e35b31c810d..af8339cf867fe 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/api/Azure.ResourceManager.HybridConnectivity.netstandard2.0.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/api/Azure.ResourceManager.HybridConnectivity.netstandard2.0.cs @@ -54,6 +54,17 @@ public static partial class HybridConnectivityExtensions public static Azure.ResourceManager.HybridConnectivity.EndpointResourceCollection GetEndpointResources(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } } } +namespace Azure.ResourceManager.HybridConnectivity.Mocking +{ + public partial class MockableHybridConnectivityArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHybridConnectivityArmClient() { } + public virtual Azure.ResourceManager.HybridConnectivity.EndpointResource GetEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetEndpointResource(Azure.Core.ResourceIdentifier scope, string endpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEndpointResourceAsync(Azure.Core.ResourceIdentifier scope, string endpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridConnectivity.EndpointResourceCollection GetEndpointResources(Azure.Core.ResourceIdentifier scope) { throw null; } + } +} namespace Azure.ResourceManager.HybridConnectivity.Models { public static partial class ArmHybridConnectivityModelFactory diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs index bbedccc985ba4..86318bd35505f 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/EndpointResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.HybridConnectivity public partial class EndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The endpointName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string endpointName) { var resourceId = $"{scope}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}"; diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index ef9c5efe10233..0000000000000 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.HybridConnectivity -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of EndpointResources in the ArmResource. - /// An object representing collection of EndpointResources and their operations over a EndpointResource. - public virtual EndpointResourceCollection GetEndpointResources() - { - return GetCachedClient(Client => new EndpointResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs index 130dd6baa23ed..847857bca9e7b 100644 --- a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/HybridConnectivityExtensions.cs @@ -11,53 +11,31 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.HybridConnectivity.Mocking; namespace Azure.ResourceManager.HybridConnectivity { /// A class to add extension methods to Azure.ResourceManager.HybridConnectivity. public static partial class HybridConnectivityExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableHybridConnectivityArmClient GetMockableHybridConnectivityArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableHybridConnectivityArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); - } - #region EndpointResource /// - /// 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. + /// Gets a collection of EndpointResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static EndpointResource GetEndpointResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - EndpointResource.ValidateResourceId(id); - return new EndpointResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of EndpointResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of EndpointResources and their operations over a EndpointResource. public static EndpointResourceCollection GetEndpointResources(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetEndpointResources(); + return GetMockableHybridConnectivityArmClient(client).GetEndpointResources(scope); } /// @@ -72,6 +50,10 @@ public static EndpointResourceCollection GetEndpointResources(this ArmClient cli /// Endpoints_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -81,7 +63,7 @@ public static EndpointResourceCollection GetEndpointResources(this ArmClient cli [ForwardsClientCalls] public static async Task> GetEndpointResourceAsync(this ArmClient client, ResourceIdentifier scope, string endpointName, CancellationToken cancellationToken = default) { - return await client.GetEndpointResources(scope).GetAsync(endpointName, cancellationToken).ConfigureAwait(false); + return await GetMockableHybridConnectivityArmClient(client).GetEndpointResourceAsync(scope, endpointName, cancellationToken).ConfigureAwait(false); } /// @@ -96,6 +78,10 @@ public static async Task> GetEndpointResourceAsync(th /// Endpoints_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -105,7 +91,23 @@ public static async Task> GetEndpointResourceAsync(th [ForwardsClientCalls] public static Response GetEndpointResource(this ArmClient client, ResourceIdentifier scope, string endpointName, CancellationToken cancellationToken = default) { - return client.GetEndpointResources(scope).Get(endpointName, cancellationToken); + return GetMockableHybridConnectivityArmClient(client).GetEndpointResource(scope, endpointName, cancellationToken); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static EndpointResource GetEndpointResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridConnectivityArmClient(client).GetEndpointResource(id); } } } diff --git a/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityArmClient.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityArmClient.cs new file mode 100644 index 0000000000000..cbf322c07d482 --- /dev/null +++ b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/MockableHybridConnectivityArmClient.cs @@ -0,0 +1,109 @@ +// 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.HybridConnectivity; + +namespace Azure.ResourceManager.HybridConnectivity.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHybridConnectivityArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHybridConnectivityArmClient() + { + } + + /// 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 MockableHybridConnectivityArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHybridConnectivityArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of EndpointResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of EndpointResources and their operations over a EndpointResource. + public virtual EndpointResourceCollection GetEndpointResources(ResourceIdentifier scope) + { + return new EndpointResourceCollection(Client, scope); + } + + /// + /// Gets the endpoint to the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName} + /// + /// + /// Operation Id + /// Endpoints_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The endpoint name. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetEndpointResourceAsync(ResourceIdentifier scope, string endpointName, CancellationToken cancellationToken = default) + { + return await GetEndpointResources(scope).GetAsync(endpointName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the endpoint to the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName} + /// + /// + /// Operation Id + /// Endpoints_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The endpoint name. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetEndpointResource(ResourceIdentifier scope, string endpointName, CancellationToken cancellationToken = default) + { + return GetEndpointResources(scope).Get(endpointName, cancellationToken); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EndpointResource GetEndpointResource(ResourceIdentifier id) + { + EndpointResource.ValidateResourceId(id); + return new EndpointResource(Client, id); + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/Azure.ResourceManager.Kubernetes.sln b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/Azure.ResourceManager.Kubernetes.sln index c39953fbb6890..91c9f74d1982e 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/Azure.ResourceManager.Kubernetes.sln +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/Azure.ResourceManager.Kubernetes.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{92EA219F-BEBA-4AC2-ABEB-1B22CA6700FF}") = "Azure.ResourceManager.Kubernetes", "src\Azure.ResourceManager.Kubernetes.csproj", "{02657BD8-C090-47D7-8BE3-5D3643BBD6EE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Kubernetes", "src\Azure.ResourceManager.Kubernetes.csproj", "{02657BD8-C090-47D7-8BE3-5D3643BBD6EE}" EndProject -Project("{92EA219F-BEBA-4AC2-ABEB-1B22CA6700FF}") = "Azure.ResourceManager.Kubernetes.Tests", "tests\Azure.ResourceManager.Kubernetes.Tests.csproj", "{5FB5C28D-45A0-4BEE-9CB5-C93BB1C1BC50}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Kubernetes.Tests", "tests\Azure.ResourceManager.Kubernetes.Tests.csproj", "{5FB5C28D-45A0-4BEE-9CB5-C93BB1C1BC50}" EndProject -Project("{92EA219F-BEBA-4AC2-ABEB-1B22CA6700FF}") = "Azure.ResourceManager.Kubernetes.Samples", "samples\Azure.ResourceManager.Kubernetes.Samples.csproj", "{81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Kubernetes.Samples", "samples\Azure.ResourceManager.Kubernetes.Samples.csproj", "{81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {970A3B6D-FE26-4262-8BA6-DB954CB64C4B} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {5FB5C28D-45A0-4BEE-9CB5-C93BB1C1BC50}.Release|x64.Build.0 = Release|Any CPU {5FB5C28D-45A0-4BEE-9CB5-C93BB1C1BC50}.Release|x86.ActiveCfg = Release|Any CPU {5FB5C28D-45A0-4BEE-9CB5-C93BB1C1BC50}.Release|x86.Build.0 = Release|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Debug|x64.ActiveCfg = Debug|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Debug|x64.Build.0 = Debug|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Debug|x86.ActiveCfg = Debug|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Debug|x86.Build.0 = Debug|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Release|Any CPU.Build.0 = Release|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Release|x64.ActiveCfg = Release|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Release|x64.Build.0 = Release|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Release|x86.ActiveCfg = Release|Any CPU + {81DFC0CB-EEC9-4694-B0E4-0FAD5862FF7B}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {970A3B6D-FE26-4262-8BA6-DB954CB64C4B} EndGlobalSection EndGlobal diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.netstandard2.0.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.netstandard2.0.cs index 036a2e87b86f6..1c63fc678391e 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.netstandard2.0.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ConnectedClusterCollection() { } } public partial class ConnectedClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public ConnectedClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.Models.ManagedServiceIdentity identity, string agentPublicKeyCertificate) : base (default(Azure.Core.AzureLocation)) { } + public ConnectedClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.Models.ManagedServiceIdentity identity, string agentPublicKeyCertificate) { } public string AgentPublicKeyCertificate { get { throw null; } set { } } public string AgentVersion { get { throw null; } } public Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? ConnectivityStatus { get { throw null; } } @@ -68,6 +68,27 @@ public static partial class KubernetesExtensions public static Azure.AsyncPageable GetConnectedClustersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Kubernetes.Mocking +{ + public partial class MockableKubernetesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableKubernetesArmClient() { } + public virtual Azure.ResourceManager.Kubernetes.ConnectedClusterResource GetConnectedClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableKubernetesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableKubernetesResourceGroupResource() { } + public virtual Azure.Response GetConnectedCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConnectedClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Kubernetes.ConnectedClusterCollection GetConnectedClusters() { throw null; } + } + public partial class MockableKubernetesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableKubernetesSubscriptionResource() { } + public virtual Azure.Pageable GetConnectedClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConnectedClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Kubernetes.Models { public static partial class ArmKubernetesModelFactory diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.cs index 7358197336273..6a34c074de888 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Kubernetes public partial class ConnectedClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"; diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs index 619b29908f2bb..801803c2402d5 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Kubernetes.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Kubernetes @@ -18,62 +19,49 @@ namespace Azure.ResourceManager.Kubernetes /// A class to add extension methods to Azure.ResourceManager.Kubernetes. public static partial class KubernetesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableKubernetesArmClient GetMockableKubernetesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableKubernetesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableKubernetesResourceGroupResource GetMockableKubernetesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableKubernetesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableKubernetesSubscriptionResource GetMockableKubernetesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableKubernetesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ConnectedClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ConnectedClusterResource GetConnectedClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ConnectedClusterResource.ValidateResourceId(id); - return new ConnectedClusterResource(client, id); - } - ); + return GetMockableKubernetesArmClient(client).GetConnectedClusterResource(id); } - #endregion - /// Gets a collection of ConnectedClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of ConnectedClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ConnectedClusterResources and their operations over a ConnectedClusterResource. public static ConnectedClusterCollection GetConnectedClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConnectedClusters(); + return GetMockableKubernetesResourceGroupResource(resourceGroupResource).GetConnectedClusters(); } /// @@ -88,16 +76,20 @@ public static ConnectedClusterCollection GetConnectedClusters(this ResourceGroup /// ConnectedCluster_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetConnectedClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetConnectedClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableKubernetesResourceGroupResource(resourceGroupResource).GetConnectedClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -112,16 +104,20 @@ public static async Task> GetConnectedCluster /// ConnectedCluster_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetConnectedCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetConnectedClusters().Get(clusterName, cancellationToken); + return GetMockableKubernetesResourceGroupResource(resourceGroupResource).GetConnectedCluster(clusterName, cancellationToken); } /// @@ -136,13 +132,17 @@ public static Response GetConnectedCluster(this Resour /// ConnectedCluster_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConnectedClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConnectedClustersAsync(cancellationToken); + return GetMockableKubernetesSubscriptionResource(subscriptionResource).GetConnectedClustersAsync(cancellationToken); } /// @@ -157,13 +157,17 @@ public static AsyncPageable GetConnectedClustersAsync( /// ConnectedCluster_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConnectedClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConnectedClusters(cancellationToken); + return GetMockableKubernetesSubscriptionResource(subscriptionResource).GetConnectedClusters(cancellationToken); } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesArmClient.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesArmClient.cs new file mode 100644 index 0000000000000..1a4d62764dedf --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableKubernetesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableKubernetesArmClient() + { + } + + /// 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 MockableKubernetesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableKubernetesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConnectedClusterResource GetConnectedClusterResource(ResourceIdentifier id) + { + ConnectedClusterResource.ValidateResourceId(id); + return new ConnectedClusterResource(Client, id); + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesResourceGroupResource.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesResourceGroupResource.cs new file mode 100644 index 0000000000000..bf8cff6615781 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableKubernetesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableKubernetesResourceGroupResource() + { + } + + /// 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 MockableKubernetesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ConnectedClusterResources in the ResourceGroupResource. + /// An object representing collection of ConnectedClusterResources and their operations over a ConnectedClusterResource. + public virtual ConnectedClusterCollection GetConnectedClusters() + { + return GetCachedClient(client => new ConnectedClusterCollection(client, Id)); + } + + /// + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} + /// + /// + /// Operation Id + /// ConnectedCluster_Get + /// + /// + /// + /// The name of the Kubernetes cluster on which get is called. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetConnectedClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetConnectedClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} + /// + /// + /// Operation Id + /// ConnectedCluster_Get + /// + /// + /// + /// The name of the Kubernetes cluster on which get is called. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetConnectedCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetConnectedClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesSubscriptionResource.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesSubscriptionResource.cs new file mode 100644 index 0000000000000..a370bec76edd9 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableKubernetesSubscriptionResource : ArmResource + { + private ClientDiagnostics _connectedClusterClientDiagnostics; + private ConnectedClusterRestOperations _connectedClusterRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableKubernetesSubscriptionResource() + { + } + + /// 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 MockableKubernetesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ConnectedClusterClientDiagnostics => _connectedClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Kubernetes", ConnectedClusterResource.ResourceType.Namespace, Diagnostics); + private ConnectedClusterRestOperations ConnectedClusterRestClient => _connectedClusterRestClient ??= new ConnectedClusterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConnectedClusterResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// API to enumerate registered connected K8s clusters under a Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters + /// + /// + /// Operation Id + /// ConnectedCluster_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConnectedClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConnectedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConnectedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConnectedClusterResource(Client, ConnectedClusterData.DeserializeConnectedClusterData(e)), ConnectedClusterClientDiagnostics, Pipeline, "MockableKubernetesSubscriptionResource.GetConnectedClusters", "value", "nextLink", cancellationToken); + } + + /// + /// API to enumerate registered connected K8s clusters under a Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters + /// + /// + /// Operation Id + /// ConnectedCluster_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConnectedClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConnectedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConnectedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConnectedClusterResource(Client, ConnectedClusterData.DeserializeConnectedClusterData(e)), ConnectedClusterClientDiagnostics, Pipeline, "MockableKubernetesSubscriptionResource.GetConnectedClusters", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 40b7f3983e159..0000000000000 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Kubernetes -{ - /// 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 ConnectedClusterResources in the ResourceGroupResource. - /// An object representing collection of ConnectedClusterResources and their operations over a ConnectedClusterResource. - public virtual ConnectedClusterCollection GetConnectedClusters() - { - return GetCachedClient(Client => new ConnectedClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 0924967d823a1..0000000000000 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Kubernetes -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _connectedClusterClientDiagnostics; - private ConnectedClusterRestOperations _connectedClusterRestClient; - - /// 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 ConnectedClusterClientDiagnostics => _connectedClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Kubernetes", ConnectedClusterResource.ResourceType.Namespace, Diagnostics); - private ConnectedClusterRestOperations ConnectedClusterRestClient => _connectedClusterRestClient ??= new ConnectedClusterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConnectedClusterResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// API to enumerate registered connected K8s clusters under a Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters - /// - /// - /// Operation Id - /// ConnectedCluster_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConnectedClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConnectedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConnectedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConnectedClusterResource(Client, ConnectedClusterData.DeserializeConnectedClusterData(e)), ConnectedClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConnectedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// API to enumerate registered connected K8s clusters under a Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters - /// - /// - /// Operation Id - /// ConnectedCluster_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConnectedClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConnectedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConnectedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConnectedClusterResource(Client, ConnectedClusterData.DeserializeConnectedClusterData(e)), ConnectedClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConnectedClusters", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Azure.ResourceManager.HybridNetwork.sln b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Azure.ResourceManager.HybridNetwork.sln new file mode 100644 index 0000000000000..4f167b8127c5d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Azure.ResourceManager.HybridNetwork.sln @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridNetwork", "src\Azure.ResourceManager.HybridNetwork.csproj", "{E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridNetwork.Tests", "tests\Azure.ResourceManager.HybridNetwork.Tests.csproj", "{0DA1D992-22DA-41D2-A677-0735E6FAB7B0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.HybridNetwork.Samples", "samples\Azure.ResourceManager.HybridNetwork.Samples.csproj", "{E47361C6-0DD0-49CC-9359-13955426D0F7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|x64.ActiveCfg = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|x64.Build.0 = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|x86.ActiveCfg = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Debug|x86.Build.0 = Debug|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|Any CPU.Build.0 = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|x64.ActiveCfg = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|x64.Build.0 = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|x86.ActiveCfg = Release|Any CPU + {E72C9DBA-B4E0-4CCE-9C67-0A86653E37B6}.Release|x86.Build.0 = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|x64.ActiveCfg = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|x64.Build.0 = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|x86.ActiveCfg = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Debug|x86.Build.0 = Debug|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|Any CPU.Build.0 = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|x64.ActiveCfg = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|x64.Build.0 = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|x86.ActiveCfg = Release|Any CPU + {0DA1D992-22DA-41D2-A677-0735E6FAB7B0}.Release|x86.Build.0 = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|x64.ActiveCfg = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|x64.Build.0 = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|x86.ActiveCfg = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Debug|x86.Build.0 = Debug|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|Any CPU.Build.0 = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|x64.ActiveCfg = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|x64.Build.0 = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|x86.ActiveCfg = Release|Any CPU + {E47361C6-0DD0-49CC-9359-13955426D0F7}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {53195F07-6A9F-44C3-B0D2-3380769A7E2C} + EndGlobalSection +EndGlobal diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/CHANGELOG.md b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/CHANGELOG.md new file mode 100644 index 0000000000000..03e9a9a19b451 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/CHANGELOG.md @@ -0,0 +1,17 @@ +# Release History + +## 1.0.0-beta.1 (2023-11-03) + +### 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). diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Directory.Build.props b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Directory.Build.props new file mode 100644 index 0000000000000..1a9611bd49242 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/README.md b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/README.md new file mode 100644 index 0000000000000..087ebd730e3c4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure HybridNetwork 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 HybridNetwork management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.HybridNetwork --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/hybridnetwork/Azure.ResourceManager.HybridNetwork/api/Azure.ResourceManager.HybridNetwork.netstandard2.0.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/api/Azure.ResourceManager.HybridNetwork.netstandard2.0.cs new file mode 100644 index 0000000000000..3c76732c89977 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/api/Azure.ResourceManager.HybridNetwork.netstandard2.0.cs @@ -0,0 +1,1677 @@ +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ArtifactManifestCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ArtifactManifestCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string artifactManifestName, Azure.ResourceManager.HybridNetwork.ArtifactManifestData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string artifactManifestName, Azure.ResourceManager.HybridNetwork.ArtifactManifestData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string artifactManifestName, 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 artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string artifactManifestName, 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 ArtifactManifestData : Azure.ResourceManager.Models.TrackedResourceData + { + public ArtifactManifestData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class ArtifactManifestResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ArtifactManifestResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactManifestData 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 publisherName, string artifactStoreName, string artifactManifestName) { 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 GetCredential(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCredentialAsync(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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateState(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestUpdateState artifactManifestUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestUpdateState artifactManifestUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ArtifactStoreCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ArtifactStoreCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string artifactStoreName, Azure.ResourceManager.HybridNetwork.ArtifactStoreData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string artifactStoreName, Azure.ResourceManager.HybridNetwork.ArtifactStoreData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string artifactStoreName, 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 artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string artifactStoreName, 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 ArtifactStoreData : Azure.ResourceManager.Models.TrackedResourceData + { + public ArtifactStoreData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactStorePropertiesFormat Properties { get { throw null; } set { } } + } + public partial class ArtifactStoreResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ArtifactStoreResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactStoreData 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 publisherName, string artifactStoreName) { 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 Azure.Response GetArtifactManifest(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArtifactManifestAsync(string artifactManifestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactManifestCollection GetArtifactManifests() { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProxyArtifacts(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProxyArtifacts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProxyArtifactsAsync(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProxyArtifactsAsync(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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateStateProxyArtifact(Azure.WaitUntil waitUntil, string artifactVersionName, string artifactName, Azure.ResourceManager.HybridNetwork.Models.ArtifactChangeState artifactChangeState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateProxyArtifactAsync(Azure.WaitUntil waitUntil, string artifactVersionName, string artifactName, Azure.ResourceManager.HybridNetwork.Models.ArtifactChangeState artifactChangeState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ComponentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ComponentCollection() { } + public virtual Azure.Response Exists(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string componentName, 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 componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string componentName, 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 ComponentData : Azure.ResourceManager.Models.ResourceData + { + public ComponentData() { } + public Azure.ResourceManager.HybridNetwork.Models.ComponentProperties Properties { get { throw null; } set { } } + } + public partial class ComponentResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ComponentResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ComponentData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFunctionName, string componentName) { 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 partial class ConfigurationGroupSchemaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ConfigurationGroupSchemaCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string configurationGroupSchemaName, Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string configurationGroupSchemaName, Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string configurationGroupSchemaName, 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 configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string configurationGroupSchemaName, 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 ConfigurationGroupSchemaData : Azure.ResourceManager.Models.TrackedResourceData + { + public ConfigurationGroupSchemaData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupSchemaPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class ConfigurationGroupSchemaResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ConfigurationGroupSchemaResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaData 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 publisherName, string configurationGroupSchemaName) { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateState(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ConfigurationGroupValueCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ConfigurationGroupValueCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string configurationGroupValueName, Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string configurationGroupValueName, Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string configurationGroupValueName, 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 configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string configurationGroupValueName, 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 ConfigurationGroupValueData : Azure.ResourceManager.Models.TrackedResourceData + { + public ConfigurationGroupValueData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat Properties { get { throw null; } set { } } + } + public partial class ConfigurationGroupValueResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ConfigurationGroupValueResource() { } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueData 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 configurationGroupValueName) { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class HybridNetworkExtensions + { + public static Azure.ResourceManager.HybridNetwork.ArtifactManifestResource GetArtifactManifestResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ArtifactStoreResource GetArtifactStoreResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ComponentResource GetComponentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaResource GetConfigurationGroupSchemaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetConfigurationGroupValue(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetConfigurationGroupValueAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueResource GetConfigurationGroupValueResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueCollection GetConfigurationGroupValues(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetConfigurationGroupValues(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetConfigurationGroupValuesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetNetworkFunction(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetNetworkFunctionAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupResource GetNetworkFunctionDefinitionGroupResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionResource GetNetworkFunctionDefinitionVersionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionResource GetNetworkFunctionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionCollection GetNetworkFunctions(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetNetworkFunctions(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetNetworkFunctionsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupResource GetNetworkServiceDesignGroupResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionResource GetNetworkServiceDesignVersionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetPublisher(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetPublisherAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.PublisherResource GetPublisherResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.PublisherCollection GetPublishers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetPublishers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetPublishersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetSite(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSiteAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetSiteNetworkService(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSiteNetworkServiceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteNetworkServiceResource GetSiteNetworkServiceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteNetworkServiceCollection GetSiteNetworkServices(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSiteNetworkServices(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSiteNetworkServicesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteResource GetSiteResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteCollection GetSites(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSites(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSitesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkFunctionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkFunctionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkFunctionName, Azure.ResourceManager.HybridNetwork.NetworkFunctionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkFunctionName, Azure.ResourceManager.HybridNetwork.NetworkFunctionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkFunctionName, 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 networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkFunctionName, 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 NetworkFunctionData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkFunctionData(Azure.Core.AzureLocation location) { } + public Azure.ETag? ETag { get { throw null; } set { } } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkFunctionDefinitionGroupCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkFunctionDefinitionGroupCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkFunctionDefinitionGroupName, Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkFunctionDefinitionGroupName, Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkFunctionDefinitionGroupName, 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 networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkFunctionDefinitionGroupName, 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 NetworkFunctionDefinitionGroupData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkFunctionDefinitionGroupData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionGroupPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkFunctionDefinitionGroupResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkFunctionDefinitionGroupResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupData 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 publisherName, string networkFunctionDefinitionGroupName) { 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 GetNetworkFunctionDefinitionVersion(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFunctionDefinitionVersionAsync(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionCollection GetNetworkFunctionDefinitionVersions() { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkFunctionDefinitionVersionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkFunctionDefinitionVersionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkFunctionDefinitionVersionName, Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkFunctionDefinitionVersionName, Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkFunctionDefinitionVersionName, 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 networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkFunctionDefinitionVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkFunctionDefinitionVersionName, 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 NetworkFunctionDefinitionVersionData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkFunctionDefinitionVersionData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkFunctionDefinitionVersionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkFunctionDefinitionVersionResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionData 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName) { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateState(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkFunctionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkFunctionResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionData 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 networkFunctionName) { 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.ResourceManager.ArmOperation ExecuteRequest(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ExecuteRequestContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ExecuteRequestAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.ExecuteRequestContent content, 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 GetComponent(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetComponentAsync(string componentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ComponentCollection GetComponents() { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkServiceDesignGroupCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkServiceDesignGroupCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkServiceDesignGroupName, Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkServiceDesignGroupName, Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkServiceDesignGroupName, 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 networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkServiceDesignGroupName, 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 NetworkServiceDesignGroupData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkServiceDesignGroupData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignGroupPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkServiceDesignGroupResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkServiceDesignGroupResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupData 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 publisherName, string networkServiceDesignGroupName) { 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 GetNetworkServiceDesignVersion(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkServiceDesignVersionAsync(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionCollection GetNetworkServiceDesignVersions() { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class NetworkServiceDesignVersionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NetworkServiceDesignVersionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string networkServiceDesignVersionName, Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string networkServiceDesignVersionName, Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string networkServiceDesignVersionName, 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 networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string networkServiceDesignVersionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string networkServiceDesignVersionName, 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 NetworkServiceDesignVersionData : Azure.ResourceManager.Models.TrackedResourceData + { + public NetworkServiceDesignVersionData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignVersionPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class NetworkServiceDesignVersionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NetworkServiceDesignVersionResource() { } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionData 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName) { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateState(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class PublisherCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected PublisherCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string publisherName, Azure.ResourceManager.HybridNetwork.PublisherData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string publisherName, Azure.ResourceManager.HybridNetwork.PublisherData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string publisherName, 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 publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string publisherName, 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 PublisherData : Azure.ResourceManager.Models.TrackedResourceData + { + public PublisherData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherPropertiesFormat Properties { get { throw null; } set { } } + } + public partial class PublisherResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected PublisherResource() { } + public virtual Azure.ResourceManager.HybridNetwork.PublisherData 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 publisherName) { 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 Azure.Response GetArtifactStore(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArtifactStoreAsync(string artifactStoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactStoreCollection GetArtifactStores() { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetConfigurationGroupSchema(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfigurationGroupSchemaAsync(string configurationGroupSchemaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaCollection GetConfigurationGroupSchemas() { throw null; } + public virtual Azure.Response GetNetworkFunctionDefinitionGroup(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFunctionDefinitionGroupAsync(string networkFunctionDefinitionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupCollection GetNetworkFunctionDefinitionGroups() { throw null; } + public virtual Azure.Response GetNetworkServiceDesignGroup(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkServiceDesignGroupAsync(string networkServiceDesignGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupCollection GetNetworkServiceDesignGroups() { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SiteCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SiteCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string siteName, Azure.ResourceManager.HybridNetwork.SiteData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string siteName, Azure.ResourceManager.HybridNetwork.SiteData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string siteName, 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 siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string siteName, 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 SiteData : Azure.ResourceManager.Models.TrackedResourceData + { + public SiteData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.HybridNetwork.Models.SitePropertiesFormat Properties { get { throw null; } set { } } + } + public partial class SiteNetworkServiceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SiteNetworkServiceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string siteNetworkServiceName, Azure.ResourceManager.HybridNetwork.SiteNetworkServiceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string siteNetworkServiceName, Azure.ResourceManager.HybridNetwork.SiteNetworkServiceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string siteNetworkServiceName, 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 siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string siteNetworkServiceName, 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 SiteNetworkServiceData : Azure.ResourceManager.Models.TrackedResourceData + { + public SiteNetworkServiceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.SiteNetworkServicePropertiesFormat Properties { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSku Sku { get { throw null; } set { } } + } + public partial class SiteNetworkServiceResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SiteNetworkServiceResource() { } + public virtual Azure.ResourceManager.HybridNetwork.SiteNetworkServiceData 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 siteNetworkServiceName) { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SiteResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SiteResource() { } + public virtual Azure.ResourceManager.HybridNetwork.SiteData 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 siteName) { 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.Response Update(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.HybridNetwork.Models.TagsObject tagsObject, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.HybridNetwork.Mocking +{ + public partial class MockableHybridNetworkArmClient : Azure.ResourceManager.ArmResource + { + protected MockableHybridNetworkArmClient() { } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactManifestResource GetArtifactManifestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ArtifactStoreResource GetArtifactStoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ComponentResource GetComponentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaResource GetConfigurationGroupSchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueResource GetConfigurationGroupValueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupResource GetNetworkFunctionDefinitionGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionResource GetNetworkFunctionDefinitionVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionResource GetNetworkFunctionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupResource GetNetworkServiceDesignGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionResource GetNetworkServiceDesignVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.PublisherResource GetPublisherResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.SiteNetworkServiceResource GetSiteNetworkServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.SiteResource GetSiteResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableHybridNetworkResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableHybridNetworkResourceGroupResource() { } + public virtual Azure.Response GetConfigurationGroupValue(string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfigurationGroupValueAsync(string configurationGroupValueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueCollection GetConfigurationGroupValues() { throw null; } + public virtual Azure.Response GetNetworkFunction(string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFunctionAsync(string networkFunctionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.NetworkFunctionCollection GetNetworkFunctions() { throw null; } + public virtual Azure.Response GetPublisher(string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPublisherAsync(string publisherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.PublisherCollection GetPublishers() { throw null; } + public virtual Azure.Response GetSite(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteAsync(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSiteNetworkService(string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteNetworkServiceAsync(string siteNetworkServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.SiteNetworkServiceCollection GetSiteNetworkServices() { throw null; } + public virtual Azure.ResourceManager.HybridNetwork.SiteCollection GetSites() { throw null; } + } + public partial class MockableHybridNetworkSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableHybridNetworkSubscriptionResource() { } + public virtual Azure.Pageable GetConfigurationGroupValues(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfigurationGroupValuesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFunctions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFunctionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPublishers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPublishersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSiteNetworkServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSiteNetworkServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSites(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSitesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.HybridNetwork.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ApplicationEnablement : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ApplicationEnablement(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement Disabled { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement Enabled { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement 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.HybridNetwork.Models.ApplicationEnablement left, Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement left, Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class ArmHybridNetworkModelFactory + { + public static Azure.ResourceManager.HybridNetwork.ArtifactManifestData ArtifactManifestData(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.HybridNetwork.Models.ArtifactManifestPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestPropertiesFormat ArtifactManifestPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState? artifactManifestState = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState?), System.Collections.Generic.IEnumerable artifacts = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ArtifactStoreData ArtifactStoreData(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.HybridNetwork.Models.ArtifactStorePropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactStorePropertiesFormat ArtifactStorePropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType? storeType = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType?), Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy? replicationStrategy = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy?), Azure.ResourceManager.HybridNetwork.Models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration managedResourceGroupConfiguration = null, Azure.Core.ResourceIdentifier storageResourceId = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.AzureContainerRegistryScopedTokenCredential AzureContainerRegistryScopedTokenCredential(string username = null, string acrToken = null, System.Uri acrServerUri = null, System.Collections.Generic.IEnumerable repositories = null, System.DateTimeOffset? expiry = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.AzureStorageAccountContainerCredential AzureStorageAccountContainerCredential(string containerName = null, System.Uri containerSasUri = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.AzureStorageAccountCredential AzureStorageAccountCredential(Azure.Core.ResourceIdentifier storageAccountId = null, System.Collections.Generic.IEnumerable containerCredentials = null, System.DateTimeOffset? expiry = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ComponentData ComponentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridNetwork.Models.ComponentProperties properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentKubernetesResources ComponentKubernetesResources(System.Collections.Generic.IEnumerable deployments = null, System.Collections.Generic.IEnumerable pods = null, System.Collections.Generic.IEnumerable replicaSets = null, System.Collections.Generic.IEnumerable statefulSets = null, System.Collections.Generic.IEnumerable daemonSets = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentProperties ComponentProperties(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string deploymentProfile = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentStatusProperties deploymentStatus = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupSchemaData ConfigurationGroupSchemaData(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.HybridNetwork.Models.ConfigurationGroupSchemaPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupSchemaPropertiesFormat ConfigurationGroupSchemaPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, string schemaDefinition = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.ConfigurationGroupValueData ConfigurationGroupValueData(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.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat ConfigurationGroupValuePropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string configurationType = "Unknown") { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ConfigurationValueWithoutSecrets ConfigurationValueWithoutSecrets(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string configurationValue = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ConfigurationValueWithSecrets ConfigurationValueWithSecrets(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string secretConfigurationValue = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ContainerizedNetworkFunctionDefinitionVersion ContainerizedNetworkFunctionDefinitionVersion(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, string deployParameters = null, Azure.ResourceManager.HybridNetwork.Models.ContainerizedNetworkFunctionTemplate networkFunctionTemplate = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.DeploymentStatusProperties DeploymentStatusProperties(Azure.ResourceManager.HybridNetwork.Models.ComponentStatus? status = default(Azure.ResourceManager.HybridNetwork.Models.ComponentStatus?), Azure.ResourceManager.HybridNetwork.Models.ComponentKubernetesResources resources = null, System.DateTimeOffset? nextExpectedUpdateOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSku HybridNetworkSku(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName name = default(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName), Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier? tier = default(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesDaemonSet KubernetesDaemonSet(string name = null, string @namespace = null, int? desiredNumberOfPods = default(int?), int? currentNumberOfPods = default(int?), int? readyNumberOfPods = default(int?), int? upToDateNumberOfPods = default(int?), int? availableNumberOfPods = default(int?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesDeployment KubernetesDeployment(string name = null, string @namespace = null, int? desiredNumberOfPods = default(int?), int? readyNumberOfPods = default(int?), int? upToDateNumberOfPods = default(int?), int? availableNumberOfPods = default(int?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesPod KubernetesPod(string name = null, string @namespace = null, int? desiredNumberOfContainers = default(int?), int? readyNumberOfContainers = default(int?), Azure.ResourceManager.HybridNetwork.Models.PodStatus? status = default(Azure.ResourceManager.HybridNetwork.Models.PodStatus?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable events = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesReplicaSet KubernetesReplicaSet(string name = null, string @namespace = null, int? desiredNumberOfPods = default(int?), int? readyNumberOfPods = default(int?), int? currentNumberOfPods = default(int?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.KubernetesStatefulSet KubernetesStatefulSet(string name = null, string @namespace = null, int? desiredNumberOfPods = default(int?), int? readyNumberOfPods = default(int?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionData NetworkFunctionData(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.HybridNetwork.Models.NetworkFunctionPropertiesFormat properties = null, Azure.ETag? etag = default(Azure.ETag?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionGroupData NetworkFunctionDefinitionGroupData(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.HybridNetwork.Models.NetworkFunctionDefinitionGroupPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionGroupPropertiesFormat NetworkFunctionDefinitionGroupPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string description = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkFunctionDefinitionVersionData NetworkFunctionDefinitionVersionData(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.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat NetworkFunctionDefinitionVersionPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, string deployParameters = null, string networkFunctionType = "Unknown") { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionPropertiesFormat NetworkFunctionPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, Azure.ResourceManager.HybridNetwork.Models.NfviType? nfviType = default(Azure.ResourceManager.HybridNetwork.Models.NfviType?), Azure.Core.ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = default(bool?), string configurationType = "Unknown", System.Collections.Generic.IEnumerable roleOverrideValues = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionValueWithoutSecrets NetworkFunctionValueWithoutSecrets(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, Azure.ResourceManager.HybridNetwork.Models.NfviType? nfviType = default(Azure.ResourceManager.HybridNetwork.Models.NfviType?), Azure.Core.ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = default(bool?), System.Collections.Generic.IEnumerable roleOverrideValues = null, string deploymentValues = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionValueWithSecrets NetworkFunctionValueWithSecrets(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, Azure.ResourceManager.HybridNetwork.Models.NfviType? nfviType = default(Azure.ResourceManager.HybridNetwork.Models.NfviType?), Azure.Core.ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = default(bool?), System.Collections.Generic.IEnumerable roleOverrideValues = null, string secretDeploymentValues = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkServiceDesignGroupData NetworkServiceDesignGroupData(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.HybridNetwork.Models.NetworkServiceDesignGroupPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignGroupPropertiesFormat NetworkServiceDesignGroupPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), string description = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.NetworkServiceDesignVersionData NetworkServiceDesignVersionData(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.HybridNetwork.Models.NetworkServiceDesignVersionPropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NetworkServiceDesignVersionPropertiesFormat NetworkServiceDesignVersionPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, System.Collections.Generic.IDictionary configurationGroupSchemaReferences = null, System.Collections.Generic.IDictionary nfvisFromSite = null, System.Collections.Generic.IEnumerable resourceElementTemplates = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PodEvent PodEvent(Azure.ResourceManager.HybridNetwork.Models.PodEventType? eventType = default(Azure.ResourceManager.HybridNetwork.Models.PodEventType?), string reason = null, string message = null, System.DateTimeOffset? lastSeenOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactListOverview ProxyArtifactListOverview(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactOverviewPropertiesValue ProxyArtifactOverviewPropertiesValue(Azure.ResourceManager.HybridNetwork.Models.ArtifactType? artifactType = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactType?), string artifactVersion = null, Azure.ResourceManager.HybridNetwork.Models.ArtifactState? artifactState = default(Azure.ResourceManager.HybridNetwork.Models.ArtifactState?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactVersionsListOverview ProxyArtifactVersionsListOverview(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactOverviewPropertiesValue properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.PublisherData PublisherData(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.HybridNetwork.Models.PublisherPropertiesFormat properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PublisherPropertiesFormat PublisherPropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.PublisherScope? scope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?)) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteData SiteData(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.HybridNetwork.Models.SitePropertiesFormat properties = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.SiteNetworkServiceData SiteNetworkServiceData(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.HybridNetwork.Models.SiteNetworkServicePropertiesFormat properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSku sku = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.SiteNetworkServicePropertiesFormat SiteNetworkServicePropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.ManagedResourceGroupConfiguration managedResourceGroupConfiguration = null, Azure.Core.ResourceIdentifier siteReferenceId = null, string publisherName = null, Azure.ResourceManager.HybridNetwork.Models.PublisherScope? publisherScope = default(Azure.ResourceManager.HybridNetwork.Models.PublisherScope?), string networkServiceDesignGroupName = null, string networkServiceDesignVersionName = null, string networkServiceDesignVersionOfferingLocation = null, Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference networkServiceDesignVersionResourceReference = null, System.Collections.Generic.IDictionary desiredStateConfigurationGroupValueReferences = null, string lastStateNetworkServiceDesignVersionName = null, System.Collections.Generic.IReadOnlyDictionary lastStateConfigurationGroupValueReferences = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.SitePropertiesFormat SitePropertiesFormat(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), System.Collections.Generic.IEnumerable nfvis = null, System.Collections.Generic.IEnumerable siteNetworkServiceReferences = null) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionDefinitionVersion VirtualNetworkFunctionDefinitionVersion(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState?), Azure.ResourceManager.HybridNetwork.Models.VersionState? versionState = default(Azure.ResourceManager.HybridNetwork.Models.VersionState?), string description = null, string deployParameters = null, Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionTemplate networkFunctionTemplate = null) { throw null; } + } + public partial class ArmResourceDefinitionResourceElementTemplate + { + public ArmResourceDefinitionResourceElementTemplate() { } + public Azure.ResourceManager.HybridNetwork.Models.NSDArtifactProfile ArtifactProfile { get { throw null; } set { } } + public string ParameterValues { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.TemplateType? TemplateType { get { throw null; } set { } } + } + public partial class ArmResourceDefinitionResourceElementTemplateDetails : Azure.ResourceManager.HybridNetwork.Models.ResourceElementTemplate + { + public ArmResourceDefinitionResourceElementTemplateDetails() { } + public Azure.ResourceManager.HybridNetwork.Models.ArmResourceDefinitionResourceElementTemplate Configuration { get { throw null; } set { } } + } + public partial class ArmTemplateArtifactProfile + { + public ArmTemplateArtifactProfile() { } + public string TemplateName { get { throw null; } set { } } + public string TemplateVersion { get { throw null; } set { } } + } + public abstract partial class ArtifactAccessCredential + { + protected ArtifactAccessCredential() { } + } + public partial class ArtifactChangeState + { + public ArtifactChangeState() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactState? ArtifactState { get { throw null; } set { } } + } + public partial class ArtifactManifestPropertiesFormat + { + public ArtifactManifestPropertiesFormat() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState? ArtifactManifestState { get { throw null; } } + public System.Collections.Generic.IList Artifacts { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactManifestState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactManifestState(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Succeeded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Unknown { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Uploaded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Uploading { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState Validating { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState ValidationFailed { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState 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.HybridNetwork.Models.ArtifactManifestState left, Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState left, Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ArtifactManifestUpdateState + { + public ArtifactManifestUpdateState() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactManifestState? ArtifactManifestState { get { throw null; } set { } } + } + public partial class ArtifactProfile + { + public ArtifactProfile() { } + public Azure.Core.ResourceIdentifier ArtifactStoreId { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactReplicationStrategy : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactReplicationStrategy(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy SingleReplication { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy 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.HybridNetwork.Models.ArtifactReplicationStrategy left, Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy left, Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactState(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactState Active { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactState Deprecated { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactState Preview { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactState Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactState 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.HybridNetwork.Models.ArtifactState left, Azure.ResourceManager.HybridNetwork.Models.ArtifactState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactState left, Azure.ResourceManager.HybridNetwork.Models.ArtifactState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ArtifactStorePropertiesFormat + { + public ArtifactStorePropertiesFormat() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactStorePropertiesFormatManagedResourceGroupConfiguration ManagedResourceGroupConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactReplicationStrategy? ReplicationStrategy { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier StorageResourceId { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType? StoreType { get { throw null; } set { } } + } + public partial class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + { + public ArtifactStorePropertiesFormatManagedResourceGroupConfiguration() { } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactStoreType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactStoreType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType AzureContainerRegistry { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType AzureStorageAccount { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType 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.HybridNetwork.Models.ArtifactStoreType left, Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType left, Azure.ResourceManager.HybridNetwork.Models.ArtifactStoreType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ArtifactType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ArtifactType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType ArmTemplate { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType ImageFile { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType OCIArtifact { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType Unknown { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ArtifactType VhdImageFile { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ArtifactType 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.HybridNetwork.Models.ArtifactType left, Azure.ResourceManager.HybridNetwork.Models.ArtifactType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ArtifactType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ArtifactType left, Azure.ResourceManager.HybridNetwork.Models.ArtifactType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AzureArcK8SClusterNfviDetails : Azure.ResourceManager.HybridNetwork.Models.NFVIs + { + public AzureArcK8SClusterNfviDetails() { } + public Azure.Core.ResourceIdentifier CustomLocationReferenceId { get { throw null; } set { } } + } + public partial class AzureArcKubernetesArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureArcKubernetesArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.HelmArtifactProfile HelmArtifactProfile { get { throw null; } set { } } + } + public partial class AzureArcKubernetesDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureArcKubernetesDeployMappingRuleProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.HelmMappingRuleProfile HelmMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureArcKubernetesHelmApplication : Azure.ResourceManager.HybridNetwork.Models.AzureArcKubernetesNetworkFunctionApplication + { + public AzureArcKubernetesHelmApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureArcKubernetesArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureArcKubernetesDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureArcKubernetesNetworkFunctionApplication : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionApplication + { + public AzureArcKubernetesNetworkFunctionApplication() { } + } + public partial class AzureArcKubernetesNetworkFunctionTemplate : Azure.ResourceManager.HybridNetwork.Models.ContainerizedNetworkFunctionTemplate + { + public AzureArcKubernetesNetworkFunctionTemplate() { } + public System.Collections.Generic.IList NetworkFunctionApplications { get { throw null; } } + } + public partial class AzureContainerRegistryScopedTokenCredential : Azure.ResourceManager.HybridNetwork.Models.ArtifactAccessCredential + { + internal AzureContainerRegistryScopedTokenCredential() { } + public System.Uri AcrServerUri { get { throw null; } } + public string AcrToken { get { throw null; } } + public System.DateTimeOffset? Expiry { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Repositories { get { throw null; } } + public string Username { get { throw null; } } + } + public partial class AzureCoreArmTemplateArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureCoreArmTemplateArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.ArmTemplateArtifactProfile TemplateArtifactProfile { get { throw null; } set { } } + } + public partial class AzureCoreArmTemplateDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureCoreArmTemplateDeployMappingRuleProfile() { } + public string TemplateParameters { get { throw null; } set { } } + } + public partial class AzureCoreNetworkFunctionApplication : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionApplication + { + public AzureCoreNetworkFunctionApplication() { } + } + public partial class AzureCoreNetworkFunctionArmTemplateApplication : Azure.ResourceManager.HybridNetwork.Models.AzureCoreNetworkFunctionApplication + { + public AzureCoreNetworkFunctionArmTemplateApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureCoreArmTemplateArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureCoreArmTemplateDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureCoreNetworkFunctionTemplate : Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionTemplate + { + public AzureCoreNetworkFunctionTemplate() { } + public System.Collections.Generic.IList NetworkFunctionApplications { get { throw null; } } + } + public partial class AzureCoreNetworkFunctionVhdApplication : Azure.ResourceManager.HybridNetwork.Models.AzureCoreNetworkFunctionApplication + { + public AzureCoreNetworkFunctionVhdApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureCoreVhdImageArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureCoreVhdImageDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureCoreNfviDetails : Azure.ResourceManager.HybridNetwork.Models.NFVIs + { + public AzureCoreNfviDetails() { } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + } + public partial class AzureCoreVhdImageArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureCoreVhdImageArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.VhdImageArtifactProfile VhdArtifactProfile { get { throw null; } set { } } + } + public partial class AzureCoreVhdImageDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureCoreVhdImageDeployMappingRuleProfile() { } + public string VhdImageMappingRuleUserConfiguration { get { throw null; } set { } } + } + public partial class AzureOperatorNexusArmTemplateArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureOperatorNexusArmTemplateArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.ArmTemplateArtifactProfile TemplateArtifactProfile { get { throw null; } set { } } + } + public partial class AzureOperatorNexusArmTemplateDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureOperatorNexusArmTemplateDeployMappingRuleProfile() { } + public string TemplateParameters { get { throw null; } set { } } + } + public partial class AzureOperatorNexusClusterNfviDetails : Azure.ResourceManager.HybridNetwork.Models.NFVIs + { + public AzureOperatorNexusClusterNfviDetails() { } + public Azure.Core.ResourceIdentifier CustomLocationReferenceId { get { throw null; } set { } } + } + public partial class AzureOperatorNexusImageArtifactProfile : Azure.ResourceManager.HybridNetwork.Models.ArtifactProfile + { + public AzureOperatorNexusImageArtifactProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.ImageArtifactProfile ImageArtifactProfile { get { throw null; } set { } } + } + public partial class AzureOperatorNexusImageDeployMappingRuleProfile : Azure.ResourceManager.HybridNetwork.Models.MappingRuleProfile + { + public AzureOperatorNexusImageDeployMappingRuleProfile() { } + public string ImageMappingRuleUserConfiguration { get { throw null; } set { } } + } + public partial class AzureOperatorNexusNetworkFunctionApplication : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionApplication + { + public AzureOperatorNexusNetworkFunctionApplication() { } + } + public partial class AzureOperatorNexusNetworkFunctionArmTemplateApplication : Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusNetworkFunctionApplication + { + public AzureOperatorNexusNetworkFunctionArmTemplateApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusArmTemplateArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusArmTemplateDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureOperatorNexusNetworkFunctionImageApplication : Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusNetworkFunctionApplication + { + public AzureOperatorNexusNetworkFunctionImageApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusImageArtifactProfile ArtifactProfile { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.AzureOperatorNexusImageDeployMappingRuleProfile DeployParametersMappingRuleProfile { get { throw null; } set { } } + } + public partial class AzureOperatorNexusNetworkFunctionTemplate : Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionTemplate + { + public AzureOperatorNexusNetworkFunctionTemplate() { } + public System.Collections.Generic.IList NetworkFunctionApplications { get { throw null; } } + } + public partial class AzureStorageAccountContainerCredential + { + internal AzureStorageAccountContainerCredential() { } + public string ContainerName { get { throw null; } } + public System.Uri ContainerSasUri { get { throw null; } } + } + public partial class AzureStorageAccountCredential : Azure.ResourceManager.HybridNetwork.Models.ArtifactAccessCredential + { + internal AzureStorageAccountCredential() { } + public System.Collections.Generic.IReadOnlyList ContainerCredentials { get { throw null; } } + public System.DateTimeOffset? Expiry { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageAccountId { get { throw null; } } + } + public partial class ComponentKubernetesResources + { + internal ComponentKubernetesResources() { } + public System.Collections.Generic.IReadOnlyList DaemonSets { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Deployments { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Pods { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ReplicaSets { get { throw null; } } + public System.Collections.Generic.IReadOnlyList StatefulSets { get { throw null; } } + } + public partial class ComponentProperties + { + public ComponentProperties() { } + public string DeploymentProfile { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.DeploymentStatusProperties DeploymentStatus { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ComponentStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ComponentStatus(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Deployed { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Downloading { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Failed { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Installing { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus PendingInstall { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus PendingRollback { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus PendingUpgrade { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Reinstalling { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Rollingback { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Superseded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Uninstalled { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Uninstalling { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Unknown { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ComponentStatus Upgrading { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.ComponentStatus 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.HybridNetwork.Models.ComponentStatus left, Azure.ResourceManager.HybridNetwork.Models.ComponentStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ComponentStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ComponentStatus left, Azure.ResourceManager.HybridNetwork.Models.ComponentStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ConfigurationGroupSchemaPropertiesFormat + { + public ConfigurationGroupSchemaPropertiesFormat() { } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string SchemaDefinition { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } } + } + public partial class ConfigurationGroupSchemaVersionUpdateState + { + public ConfigurationGroupSchemaVersionUpdateState() { } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } set { } } + } + public abstract partial class ConfigurationGroupValuePropertiesFormat + { + protected ConfigurationGroupValuePropertiesFormat() { } + public string ConfigurationGroupSchemaName { get { throw null; } } + public string ConfigurationGroupSchemaOfferingLocation { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference ConfigurationGroupSchemaResourceReference { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string PublisherName { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherScope? PublisherScope { get { throw null; } } + } + public partial class ConfigurationValueWithoutSecrets : Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat + { + public ConfigurationValueWithoutSecrets() { } + public string ConfigurationValue { get { throw null; } set { } } + } + public partial class ConfigurationValueWithSecrets : Azure.ResourceManager.HybridNetwork.Models.ConfigurationGroupValuePropertiesFormat + { + public ConfigurationValueWithSecrets() { } + public string SecretConfigurationValue { get { throw null; } set { } } + } + public partial class ContainerizedNetworkFunctionDefinitionVersion : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat + { + public ContainerizedNetworkFunctionDefinitionVersion() { } + public Azure.ResourceManager.HybridNetwork.Models.ContainerizedNetworkFunctionTemplate NetworkFunctionTemplate { get { throw null; } set { } } + } + public abstract partial class ContainerizedNetworkFunctionTemplate + { + protected ContainerizedNetworkFunctionTemplate() { } + } + public partial class DependsOnProfile + { + public DependsOnProfile() { } + public System.Collections.Generic.IList InstallDependsOn { get { throw null; } } + public System.Collections.Generic.IList UninstallDependsOn { get { throw null; } } + public System.Collections.Generic.IList UpdateDependsOn { get { throw null; } } + } + public abstract partial class DeploymentResourceIdReference + { + protected DeploymentResourceIdReference() { } + } + public partial class DeploymentStatusProperties + { + internal DeploymentStatusProperties() { } + public System.DateTimeOffset? NextExpectedUpdateOn { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ComponentKubernetesResources Resources { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ComponentStatus? Status { get { throw null; } } + } + public partial class ExecuteRequestContent + { + public ExecuteRequestContent(string serviceEndpoint, Azure.ResourceManager.HybridNetwork.Models.RequestMetadata requestMetadata) { } + public Azure.ResourceManager.HybridNetwork.Models.RequestMetadata RequestMetadata { get { throw null; } } + public string ServiceEndpoint { get { throw null; } } + } + public partial class HelmArtifactProfile + { + public HelmArtifactProfile() { } + public string HelmPackageName { get { throw null; } set { } } + public string HelmPackageVersionRange { get { throw null; } set { } } + public System.Collections.Generic.IList ImagePullSecretsValuesPaths { get { throw null; } } + public System.Collections.Generic.IList RegistryValuesPaths { get { throw null; } } + } + public partial class HelmInstallConfig + { + public HelmInstallConfig() { } + public string Atomic { get { throw null; } set { } } + public string Timeout { get { throw null; } set { } } + public string Wait { get { throw null; } set { } } + } + public partial class HelmMappingRuleProfile + { + public HelmMappingRuleProfile() { } + public string HelmPackageVersion { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HelmMappingRuleProfileConfig Options { get { throw null; } set { } } + public string ReleaseName { get { throw null; } set { } } + public string ReleaseNamespace { get { throw null; } set { } } + public string Values { get { throw null; } set { } } + } + public partial class HelmMappingRuleProfileConfig + { + public HelmMappingRuleProfileConfig() { } + public Azure.ResourceManager.HybridNetwork.Models.HelmInstallConfig InstallOptions { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HelmUpgradeConfig UpgradeOptions { get { throw null; } set { } } + } + public partial class HelmUpgradeConfig + { + public HelmUpgradeConfig() { } + public string Atomic { get { throw null; } set { } } + public string Timeout { get { throw null; } set { } } + public string Wait { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HttpMethod : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HttpMethod(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Delete { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Get { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Patch { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Post { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Put { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HttpMethod Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.HttpMethod 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.HybridNetwork.Models.HttpMethod left, Azure.ResourceManager.HybridNetwork.Models.HttpMethod right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.HttpMethod (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.HttpMethod left, Azure.ResourceManager.HybridNetwork.Models.HttpMethod right) { throw null; } + public override string ToString() { throw null; } + } + public partial class HybridNetworkSku + { + public HybridNetworkSku(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName name) { } + public Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName Name { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier? Tier { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HybridNetworkSkuName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HybridNetworkSkuName(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName Basic { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName 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.HybridNetwork.Models.HybridNetworkSkuName left, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName left, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuName right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HybridNetworkSkuTier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HybridNetworkSkuTier(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier Basic { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier 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.HybridNetwork.Models.HybridNetworkSkuTier left, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier left, Azure.ResourceManager.HybridNetwork.Models.HybridNetworkSkuTier right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ImageArtifactProfile + { + public ImageArtifactProfile() { } + public string ImageName { get { throw null; } set { } } + public string ImageVersion { get { throw null; } set { } } + } + public partial class KubernetesDaemonSet + { + internal KubernetesDaemonSet() { } + public int? AvailableNumberOfPods { get { throw null; } } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? CurrentNumberOfPods { get { throw null; } } + public int? DesiredNumberOfPods { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfPods { get { throw null; } } + public int? UpToDateNumberOfPods { get { throw null; } } + } + public partial class KubernetesDeployment + { + internal KubernetesDeployment() { } + public int? AvailableNumberOfPods { get { throw null; } } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? DesiredNumberOfPods { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfPods { get { throw null; } } + public int? UpToDateNumberOfPods { get { throw null; } } + } + public partial class KubernetesPod + { + internal KubernetesPod() { } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? DesiredNumberOfContainers { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Events { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfContainers { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PodStatus? Status { get { throw null; } } + } + public partial class KubernetesReplicaSet + { + internal KubernetesReplicaSet() { } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? CurrentNumberOfPods { get { throw null; } } + public int? DesiredNumberOfPods { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfPods { get { throw null; } } + } + public partial class KubernetesStatefulSet + { + internal KubernetesStatefulSet() { } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public int? DesiredNumberOfPods { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public int? ReadyNumberOfPods { get { throw null; } } + } + public partial class ManagedResourceGroupConfiguration + { + public ManagedResourceGroupConfiguration() { } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public partial class ManifestArtifactFormat + { + public ManifestArtifactFormat() { } + public string ArtifactName { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactType? ArtifactType { get { throw null; } set { } } + public string ArtifactVersion { get { throw null; } set { } } + } + public partial class MappingRuleProfile + { + public MappingRuleProfile() { } + public Azure.ResourceManager.HybridNetwork.Models.ApplicationEnablement? ApplicationEnablement { get { throw null; } set { } } + } + public partial class NetworkFunctionApplication + { + public NetworkFunctionApplication() { } + public Azure.ResourceManager.HybridNetwork.Models.DependsOnProfile DependsOnProfile { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public partial class NetworkFunctionDefinitionGroupPropertiesFormat + { + public NetworkFunctionDefinitionGroupPropertiesFormat() { } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class NetworkFunctionDefinitionResourceElementTemplateDetails : Azure.ResourceManager.HybridNetwork.Models.ResourceElementTemplate + { + public NetworkFunctionDefinitionResourceElementTemplateDetails() { } + public Azure.ResourceManager.HybridNetwork.Models.ArmResourceDefinitionResourceElementTemplate Configuration { get { throw null; } set { } } + } + public abstract partial class NetworkFunctionDefinitionVersionPropertiesFormat + { + protected NetworkFunctionDefinitionVersionPropertiesFormat() { } + public string DeployParameters { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } } + } + public partial class NetworkFunctionDefinitionVersionUpdateState + { + public NetworkFunctionDefinitionVersionUpdateState() { } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } set { } } + } + public abstract partial class NetworkFunctionPropertiesFormat + { + protected NetworkFunctionPropertiesFormat() { } + public bool? AllowSoftwareUpdate { get { throw null; } set { } } + public string NetworkFunctionDefinitionGroupName { get { throw null; } } + public string NetworkFunctionDefinitionOfferingLocation { get { throw null; } } + public string NetworkFunctionDefinitionVersion { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference NetworkFunctionDefinitionVersionResourceReference { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier NfviId { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.NfviType? NfviType { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string PublisherName { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherScope? PublisherScope { get { throw null; } } + public System.Collections.Generic.IList RoleOverrideValues { get { throw null; } } + } + public partial class NetworkFunctionValueWithoutSecrets : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionPropertiesFormat + { + public NetworkFunctionValueWithoutSecrets() { } + public string DeploymentValues { get { throw null; } set { } } + } + public partial class NetworkFunctionValueWithSecrets : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionPropertiesFormat + { + public NetworkFunctionValueWithSecrets() { } + public string SecretDeploymentValues { get { throw null; } set { } } + } + public partial class NetworkServiceDesignGroupPropertiesFormat + { + public NetworkServiceDesignGroupPropertiesFormat() { } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class NetworkServiceDesignVersionPropertiesFormat + { + public NetworkServiceDesignVersionPropertiesFormat() { } + public System.Collections.Generic.IDictionary ConfigurationGroupSchemaReferences { get { throw null; } } + public string Description { get { throw null; } set { } } + public System.Collections.Generic.IDictionary NfvisFromSite { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IList ResourceElementTemplates { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } } + } + public partial class NetworkServiceDesignVersionUpdateState + { + public NetworkServiceDesignVersionUpdateState() { } + public Azure.ResourceManager.HybridNetwork.Models.VersionState? VersionState { get { throw null; } set { } } + } + public partial class NfviDetails + { + public NfviDetails() { } + public string Name { get { throw null; } set { } } + public string NfviDetailsType { get { throw null; } set { } } + } + public abstract partial class NFVIs + { + protected NFVIs() { } + public string Name { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct NfviType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public NfviType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.NfviType AzureArcKubernetes { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.NfviType AzureCore { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.NfviType AzureOperatorNexus { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.NfviType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.NfviType 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.HybridNetwork.Models.NfviType left, Azure.ResourceManager.HybridNetwork.Models.NfviType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.NfviType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.NfviType left, Azure.ResourceManager.HybridNetwork.Models.NfviType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NSDArtifactProfile + { + public NSDArtifactProfile() { } + public string ArtifactName { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier ArtifactStoreReferenceId { get { throw null; } set { } } + public string ArtifactVersion { get { throw null; } set { } } + } + public partial class OpenDeploymentResourceReference : Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference + { + public OpenDeploymentResourceReference() { } + public Azure.Core.ResourceIdentifier Id { get { throw null; } set { } } + } + public partial class PodEvent + { + internal PodEvent() { } + public Azure.ResourceManager.HybridNetwork.Models.PodEventType? EventType { get { throw null; } } + public System.DateTimeOffset? LastSeenOn { get { throw null; } } + public string Message { get { throw null; } } + public string Reason { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PodEventType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PodEventType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PodEventType Normal { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodEventType Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.PodEventType 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.HybridNetwork.Models.PodEventType left, Azure.ResourceManager.HybridNetwork.Models.PodEventType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.PodEventType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.PodEventType left, Azure.ResourceManager.HybridNetwork.Models.PodEventType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PodStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PodStatus(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Failed { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus NotReady { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Pending { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Running { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Succeeded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Terminating { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PodStatus Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.PodStatus 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.HybridNetwork.Models.PodStatus left, Azure.ResourceManager.HybridNetwork.Models.PodStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.PodStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.PodStatus left, Azure.ResourceManager.HybridNetwork.Models.PodStatus right) { throw null; } + public override string ToString() { throw null; } + } + [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.HybridNetwork.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Converging { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Deleted { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.ProvisioningState Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.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.HybridNetwork.Models.ProvisioningState left, Azure.ResourceManager.HybridNetwork.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.ProvisioningState left, Azure.ResourceManager.HybridNetwork.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ProxyArtifactListOverview : Azure.ResourceManager.Models.ResourceData + { + public ProxyArtifactListOverview() { } + } + public partial class ProxyArtifactOverviewPropertiesValue + { + internal ProxyArtifactOverviewPropertiesValue() { } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactState? ArtifactState { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ArtifactType? ArtifactType { get { throw null; } } + public string ArtifactVersion { get { throw null; } } + } + public partial class ProxyArtifactVersionsListOverview : Azure.ResourceManager.Models.ResourceData + { + public ProxyArtifactVersionsListOverview() { } + public Azure.ResourceManager.HybridNetwork.Models.ProxyArtifactOverviewPropertiesValue Properties { get { throw null; } } + } + public partial class PublisherPropertiesFormat + { + public PublisherPropertiesFormat() { } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherScope? Scope { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PublisherScope : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PublisherScope(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.PublisherScope Private { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.PublisherScope Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.PublisherScope 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.HybridNetwork.Models.PublisherScope left, Azure.ResourceManager.HybridNetwork.Models.PublisherScope right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.PublisherScope (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.PublisherScope left, Azure.ResourceManager.HybridNetwork.Models.PublisherScope right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequestMetadata + { + public RequestMetadata(string relativePath, Azure.ResourceManager.HybridNetwork.Models.HttpMethod httpMethod, string serializedBody) { } + public string ApiVersion { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.HttpMethod HttpMethod { get { throw null; } } + public string RelativePath { get { throw null; } } + public string SerializedBody { get { throw null; } } + } + public abstract partial class ResourceElementTemplate + { + protected ResourceElementTemplate() { } + public Azure.ResourceManager.HybridNetwork.Models.DependsOnProfile DependsOnProfile { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public partial class SecretDeploymentResourceReference : Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference + { + public SecretDeploymentResourceReference() { } + public Azure.Core.ResourceIdentifier Id { get { throw null; } set { } } + } + public partial class SiteNetworkServicePropertiesFormat + { + public SiteNetworkServicePropertiesFormat() { } + public System.Collections.Generic.IDictionary DesiredStateConfigurationGroupValueReferences { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary LastStateConfigurationGroupValueReferences { get { throw null; } } + public string LastStateNetworkServiceDesignVersionName { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ManagedResourceGroupConfiguration ManagedResourceGroupConfiguration { get { throw null; } set { } } + public string NetworkServiceDesignGroupName { get { throw null; } } + public string NetworkServiceDesignVersionName { get { throw null; } } + public string NetworkServiceDesignVersionOfferingLocation { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.DeploymentResourceIdReference NetworkServiceDesignVersionResourceReference { get { throw null; } set { } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string PublisherName { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.PublisherScope? PublisherScope { get { throw null; } } + public Azure.Core.ResourceIdentifier SiteReferenceId { get { throw null; } set { } } + } + public partial class SitePropertiesFormat + { + public SitePropertiesFormat() { } + public System.Collections.Generic.IList Nfvis { get { throw null; } } + public Azure.ResourceManager.HybridNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SiteNetworkServiceReferences { get { throw null; } } + } + public partial class TagsObject + { + public TagsObject() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TemplateType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TemplateType(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.TemplateType ArmTemplate { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.TemplateType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.TemplateType 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.HybridNetwork.Models.TemplateType left, Azure.ResourceManager.HybridNetwork.Models.TemplateType right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.TemplateType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.TemplateType left, Azure.ResourceManager.HybridNetwork.Models.TemplateType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct VersionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public VersionState(string value) { throw null; } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Active { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Deprecated { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Preview { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Unknown { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState Validating { get { throw null; } } + public static Azure.ResourceManager.HybridNetwork.Models.VersionState ValidationFailed { get { throw null; } } + public bool Equals(Azure.ResourceManager.HybridNetwork.Models.VersionState 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.HybridNetwork.Models.VersionState left, Azure.ResourceManager.HybridNetwork.Models.VersionState right) { throw null; } + public static implicit operator Azure.ResourceManager.HybridNetwork.Models.VersionState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.HybridNetwork.Models.VersionState left, Azure.ResourceManager.HybridNetwork.Models.VersionState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class VhdImageArtifactProfile + { + public VhdImageArtifactProfile() { } + public string VhdName { get { throw null; } set { } } + public string VhdVersion { get { throw null; } set { } } + } + public partial class VirtualNetworkFunctionDefinitionVersion : Azure.ResourceManager.HybridNetwork.Models.NetworkFunctionDefinitionVersionPropertiesFormat + { + public VirtualNetworkFunctionDefinitionVersion() { } + public Azure.ResourceManager.HybridNetwork.Models.VirtualNetworkFunctionTemplate NetworkFunctionTemplate { get { throw null; } set { } } + } + public abstract partial class VirtualNetworkFunctionTemplate + { + protected VirtualNetworkFunctionTemplate() { } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/assets.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/assets.json new file mode 100644 index 0000000000000..7e0945cad72a4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/hybridnetwork/Azure.ResourceManager.HybridNetwork", + "Tag": "net/hybridnetwork/Azure.ResourceManager.HybridNetwork_0c12edd669" +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Azure.ResourceManager.HybridNetwork.Samples.csproj b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Azure.ResourceManager.HybridNetwork.Samples.csproj new file mode 100644 index 0000000000000..323462fa107e9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Azure.ResourceManager.HybridNetwork.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestCollection.cs new file mode 100644 index 0000000000000..f46c43d7d5df7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestCollection.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ArtifactManifestCollection + { + // Get artifact manifest list resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetArtifactManifestListResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestListByArtifactStore.json + // this example is just showing the usage of "ArtifactManifests_ListByArtifactStore" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation and iterate over the result + await foreach (ArtifactManifestResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactManifestData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update the artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateTheArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestCreate.json + // this example is just showing the usage of "ArtifactManifests_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation + string artifactManifestName = "TestManifest"; + ArtifactManifestData data = new ArtifactManifestData(new AzureLocation("eastus")) + { + Properties = new ArtifactManifestPropertiesFormat() + { + Artifacts = +{ +new ManifestArtifactFormat() +{ +ArtifactName = "fed-rbac", +ArtifactType = ArtifactType.OCIArtifact, +ArtifactVersion = "1.0.0", +},new ManifestArtifactFormat() +{ +ArtifactName = "nginx", +ArtifactType = ArtifactType.OCIArtifact, +ArtifactVersion = "v1", +} +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactManifestName, data); + ArtifactManifestResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json + // this example is just showing the usage of "ArtifactManifests_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation + string artifactManifestName = "TestManifest"; + ArtifactManifestResource result = await collection.GetAsync(artifactManifestName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json + // this example is just showing the usage of "ArtifactManifests_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation + string artifactManifestName = "TestManifest"; + bool result = await collection.ExistsAsync(artifactManifestName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json + // this example is just showing the usage of "ArtifactManifests_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // get the collection of this ArtifactManifestResource + ArtifactManifestCollection collection = artifactStore.GetArtifactManifests(); + + // invoke the operation + string artifactManifestName = "TestManifest"; + NullableResponse response = await collection.GetIfExistsAsync(artifactManifestName); + ArtifactManifestResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestResource.cs new file mode 100644 index 0000000000000..d7906b9d3819f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactManifestResource.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ArtifactManifestResource + { + // Delete a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestDelete.json + // this example is just showing the usage of "ArtifactManifests_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestManifest"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + await artifactManifest.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a artifact manifest resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAArtifactManifestResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestGet.json + // this example is just showing the usage of "ArtifactManifests_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestManifest"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + ArtifactManifestResource result = await artifactManifest.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update a artifact manifest resource tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateAArtifactManifestResourceTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestUpdateTags.json + // this example is just showing the usage of "ArtifactManifests_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestManifest"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ArtifactManifestResource result = await artifactManifest.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactManifestData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List a credential for artifact manifest + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCredential_ListACredentialForArtifactManifest() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestListCredential.json + // this example is just showing the usage of "ArtifactManifests_ListCredential" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestArtifactManifestName"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + ArtifactAccessCredential result = await artifactManifest.GetCredentialAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Update artifact manifest state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateState_UpdateArtifactManifestState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactManifestUpdateState.json + // this example is just showing the usage of "ArtifactManifests_UpdateState" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactManifestResource created on azure + // for more information of creating ArtifactManifestResource, please refer to the document of ArtifactManifestResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + string artifactManifestName = "TestArtifactManifestName"; + ResourceIdentifier artifactManifestResourceId = ArtifactManifestResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + ArtifactManifestResource artifactManifest = client.GetArtifactManifestResource(artifactManifestResourceId); + + // invoke the operation + ArtifactManifestUpdateState artifactManifestUpdateState = new ArtifactManifestUpdateState() + { + ArtifactManifestState = ArtifactManifestState.Uploaded, + }; + ArmOperation lro = await artifactManifest.UpdateStateAsync(WaitUntil.Completed, artifactManifestUpdateState); + ArtifactManifestUpdateState result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreCollection.cs new file mode 100644 index 0000000000000..7a794b5f47aeb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ArtifactStoreCollection + { + // Get application groups under a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetApplicationGroupsUnderAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoresListByPublisherName.json + // this example is just showing the usage of "ArtifactStores_ListByPublisher" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation and iterate over the result + await foreach (ArtifactStoreResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactStoreData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update an artifact store of publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateAnArtifactStoreOfPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreCreate.json + // this example is just showing the usage of "ArtifactStores_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation + string artifactStoreName = "TestArtifactStore"; + ArtifactStoreData data = new ArtifactStoreData(new AzureLocation("eastus")) + { + Properties = new ArtifactStorePropertiesFormat() + { + StoreType = ArtifactStoreType.AzureContainerRegistry, + ReplicationStrategy = ArtifactReplicationStrategy.SingleReplication, + ManagedResourceGroupConfiguration = new ArtifactStorePropertiesFormatManagedResourceGroupConfiguration() + { + Name = "testRg", + Location = new AzureLocation("eastus"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactStoreName, data); + ArtifactStoreResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a artifact store resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAArtifactStoreResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json + // this example is just showing the usage of "ArtifactStores_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation + string artifactStoreName = "TestArtifactStoreName"; + ArtifactStoreResource result = await collection.GetAsync(artifactStoreName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a artifact store resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAArtifactStoreResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json + // this example is just showing the usage of "ArtifactStores_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation + string artifactStoreName = "TestArtifactStoreName"; + bool result = await collection.ExistsAsync(artifactStoreName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a artifact store resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAArtifactStoreResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json + // this example is just showing the usage of "ArtifactStores_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ArtifactStoreResource + ArtifactStoreCollection collection = publisher.GetArtifactStores(); + + // invoke the operation + string artifactStoreName = "TestArtifactStoreName"; + NullableResponse response = await collection.GetIfExistsAsync(artifactStoreName); + ArtifactStoreResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreResource.cs new file mode 100644 index 0000000000000..e5db3180e7827 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ArtifactStoreResource.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ArtifactStoreResource + { + // Delete a artifact store of publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAArtifactStoreOfPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreDelete.json + // this example is just showing the usage of "ArtifactStores_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation + await artifactStore.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a artifact store resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAArtifactStoreResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreGet.json + // this example is just showing the usage of "ArtifactStores_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStoreName"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation + ArtifactStoreResource result = await artifactStore.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update artifact store resource tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateArtifactStoreResourceTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ArtifactStoreUpdateTags.json + // this example is just showing the usage of "ArtifactStores_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStore"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ArtifactStoreResource result = await artifactStore.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ArtifactStoreData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List artifacts under an artifact store + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetProxyArtifacts_ListArtifactsUnderAnArtifactStore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactList.json + // this example is just showing the usage of "ProxyArtifact_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "TestResourceGroup"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStoreName"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation and iterate over the result + await foreach (ProxyArtifactListOverview item in artifactStore.GetProxyArtifactsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get an artifact overview + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetProxyArtifacts_GetAnArtifactOverview() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactGet.json + // this example is just showing the usage of "ProxyArtifact_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "TestResourceGroup"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStoreName"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation and iterate over the result + string artifactName = "fedrbac"; + await foreach (ProxyArtifactVersionsListOverview item in artifactStore.GetProxyArtifactsAsync(artifactName)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Update an artifact state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateStateProxyArtifact_UpdateAnArtifactState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PureProxyArtifact/ArtifactChangeState.json + // this example is just showing the usage of "ProxyArtifact_UpdateState" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArtifactStoreResource created on azure + // for more information of creating ArtifactStoreResource, please refer to the document of ArtifactStoreResource + string subscriptionId = "subid"; + string resourceGroupName = "TestResourceGroup"; + string publisherName = "TestPublisher"; + string artifactStoreName = "TestArtifactStoreName"; + ResourceIdentifier artifactStoreResourceId = ArtifactStoreResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + ArtifactStoreResource artifactStore = client.GetArtifactStoreResource(artifactStoreResourceId); + + // invoke the operation + string artifactVersionName = "1.0.0"; + string artifactName = "fedrbac"; + ArtifactChangeState artifactChangeState = new ArtifactChangeState() + { + ArtifactState = ArtifactState.Deprecated, + }; + ArmOperation lro = await artifactStore.UpdateStateProxyArtifactAsync(WaitUntil.Completed, artifactVersionName, artifactName, artifactChangeState); + ProxyArtifactVersionsListOverview result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentCollection.cs new file mode 100644 index 0000000000000..ea73ea660fbb0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentCollection.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ComponentCollection + { + // Get component resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetComponentResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json + // this example is just showing the usage of "Components_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // get the collection of this ComponentResource + ComponentCollection collection = networkFunction.GetComponents(); + + // invoke the operation + string componentName = "testComponent"; + ComponentResource result = await collection.GetAsync(componentName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get component resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetComponentResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json + // this example is just showing the usage of "Components_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // get the collection of this ComponentResource + ComponentCollection collection = networkFunction.GetComponents(); + + // invoke the operation + string componentName = "testComponent"; + bool result = await collection.ExistsAsync(componentName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get component resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetComponentResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json + // this example is just showing the usage of "Components_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // get the collection of this ComponentResource + ComponentCollection collection = networkFunction.GetComponents(); + + // invoke the operation + string componentName = "testComponent"; + NullableResponse response = await collection.GetIfExistsAsync(componentName); + ComponentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // List components in network function + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListComponentsInNetworkFunction() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentListByNetworkFunction.json + // this example is just showing the usage of "Components_ListByNetworkFunction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // get the collection of this ComponentResource + ComponentCollection collection = networkFunction.GetComponents(); + + // invoke the operation and iterate over the result + await foreach (ComponentResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ComponentData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentResource.cs new file mode 100644 index 0000000000000..47bb5361ba582 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ComponentResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ComponentResource + { + // Get component resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetComponentResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ComponentGet.json + // this example is just showing the usage of "Components_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ComponentResource created on azure + // for more information of creating ComponentResource, please refer to the document of ComponentResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + string componentName = "testComponent"; + ResourceIdentifier componentResourceId = ComponentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName, componentName); + ComponentResource component = client.GetComponentResource(componentResourceId); + + // invoke the operation + ComponentResource result = await component.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ComponentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaCollection.cs new file mode 100644 index 0000000000000..81429c8ca7a2c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ConfigurationGroupSchemaCollection + { + // Get networkFunctionDefinition groups under publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetNetworkFunctionDefinitionGroupsUnderPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaListByPublisherName.json + // this example is just showing the usage of "ConfigurationGroupSchemas_ListByPublisher" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation and iterate over the result + await foreach (ConfigurationGroupSchemaResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupSchemaData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update the network function definition group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateTheNetworkFunctionDefinitionGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaCreate.json + // this example is just showing the usage of "ConfigurationGroupSchemas_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ConfigurationGroupSchemaData data = new ConfigurationGroupSchemaData(new AzureLocation("westUs2")) + { + Properties = new ConfigurationGroupSchemaPropertiesFormat() + { + Description = "Schema with no secrets", + SchemaDefinition = "{\"type\":\"object\",\"properties\":{\"interconnect-groups\":{\"type\":\"object\",\"properties\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"international-interconnects\":{\"type\":\"array\",\"item\":{\"type\":\"string\"}},\"domestic-interconnects\":{\"type\":\"array\",\"item\":{\"type\":\"string\"}}}}},\"interconnect-group-assignments\":{\"type\":\"object\",\"properties\":{\"type\":\"object\",\"properties\":{\"ssc\":{\"type\":\"string\"},\"interconnects-interconnects\":{\"type\":\"string\"}}}}},\"required\":[\"interconnect-groups\",\"interconnect-group-assignments\"]}", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationGroupSchemaName, data); + ConfigurationGroupSchemaResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json + // this example is just showing the usage of "ConfigurationGroupSchemas_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ConfigurationGroupSchemaResource result = await collection.GetAsync(configurationGroupSchemaName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json + // this example is just showing the usage of "ConfigurationGroupSchemas_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + bool result = await collection.ExistsAsync(configurationGroupSchemaName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json + // this example is just showing the usage of "ConfigurationGroupSchemas_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this ConfigurationGroupSchemaResource + ConfigurationGroupSchemaCollection collection = publisher.GetConfigurationGroupSchemas(); + + // invoke the operation + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + NullableResponse response = await collection.GetIfExistsAsync(configurationGroupSchemaName); + ConfigurationGroupSchemaResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaResource.cs new file mode 100644 index 0000000000000..144ca2c31a632 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupSchemaResource.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ConfigurationGroupSchemaResource + { + // Delete a network function group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaDelete.json + // this example is just showing the usage of "ConfigurationGroupSchemas_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ConfigurationGroupSchemaResource created on azure + // for more information of creating ConfigurationGroupSchemaResource, please refer to the document of ConfigurationGroupSchemaResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ResourceIdentifier configurationGroupSchemaResourceId = ConfigurationGroupSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + ConfigurationGroupSchemaResource configurationGroupSchema = client.GetConfigurationGroupSchemaResource(configurationGroupSchemaResourceId); + + // invoke the operation + await configurationGroupSchema.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaGet.json + // this example is just showing the usage of "ConfigurationGroupSchemas_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ConfigurationGroupSchemaResource created on azure + // for more information of creating ConfigurationGroupSchemaResource, please refer to the document of ConfigurationGroupSchemaResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ResourceIdentifier configurationGroupSchemaResourceId = ConfigurationGroupSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + ConfigurationGroupSchemaResource configurationGroupSchema = client.GetConfigurationGroupSchemaResource(configurationGroupSchemaResourceId); + + // invoke the operation + ConfigurationGroupSchemaResource result = await configurationGroupSchema.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update the configuration group schema resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateTheConfigurationGroupSchemaResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaUpdateTags.json + // this example is just showing the usage of "ConfigurationGroupSchemas_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ConfigurationGroupSchemaResource created on azure + // for more information of creating ConfigurationGroupSchemaResource, please refer to the document of ConfigurationGroupSchemaResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ResourceIdentifier configurationGroupSchemaResourceId = ConfigurationGroupSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + ConfigurationGroupSchemaResource configurationGroupSchema = client.GetConfigurationGroupSchemaResource(configurationGroupSchemaResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ConfigurationGroupSchemaResource result = await configurationGroupSchema.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupSchemaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network service design version state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateState_UpdateNetworkServiceDesignVersionState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupSchemaVersionUpdateState.json + // this example is just showing the usage of "ConfigurationGroupSchemas_updateState" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ConfigurationGroupSchemaResource created on azure + // for more information of creating ConfigurationGroupSchemaResource, please refer to the document of ConfigurationGroupSchemaResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string publisherName = "testPublisher"; + string configurationGroupSchemaName = "testConfigurationGroupSchema"; + ResourceIdentifier configurationGroupSchemaResourceId = ConfigurationGroupSchemaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + ConfigurationGroupSchemaResource configurationGroupSchema = client.GetConfigurationGroupSchemaResource(configurationGroupSchemaResourceId); + + // invoke the operation + ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState = new ConfigurationGroupSchemaVersionUpdateState() + { + VersionState = VersionState.Active, + }; + ArmOperation lro = await configurationGroupSchema.UpdateStateAsync(WaitUntil.Completed, configurationGroupSchemaVersionUpdateState); + ConfigurationGroupSchemaVersionUpdateState result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueCollection.cs new file mode 100644 index 0000000000000..bba04cdb30afd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueCollection.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ConfigurationGroupValueCollection + { + // Get hybrid configuration group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetHybridConfigurationGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json + // this example is just showing the usage of "ConfigurationGroupValues_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + ConfigurationGroupValueResource result = await collection.GetAsync(configurationGroupValueName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get hybrid configuration group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetHybridConfigurationGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json + // this example is just showing the usage of "ConfigurationGroupValues_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + bool result = await collection.ExistsAsync(configurationGroupValueName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get hybrid configuration group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetHybridConfigurationGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json + // this example is just showing the usage of "ConfigurationGroupValues_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + NullableResponse response = await collection.GetIfExistsAsync(configurationGroupValueName); + ConfigurationGroupValueResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create or update configuration group value + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateConfigurationGroupValue() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueCreate.json + // this example is just showing the usage of "ConfigurationGroupValues_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + ConfigurationGroupValueData data = new ConfigurationGroupValueData(new AzureLocation("eastus")) + { + Properties = new ConfigurationValueWithoutSecrets() + { + ConfigurationValue = "{\"interconnect-groups\":{\"stripe-one\":{\"name\":\"Stripe one\",\"international-interconnects\":[\"france\",\"germany\"],\"domestic-interconnects\":[\"birmingham\",\"edinburgh\"]},\"stripe-two\":{\"name\":\"Stripe two\",\"international-interconnects\":[\"germany\",\"italy\"],\"domestic-interconnects\":[\"edinburgh\",\"london\"]}},\"interconnect-group-assignments\":{\"ssc-one\":{\"ssc\":\"SSC 1\",\"interconnects\":\"stripe-one\"},\"ssc-two\":{\"ssc\":\"SSC 2\",\"interconnects\":\"stripe-two\"}}}", + ConfigurationGroupSchemaResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationGroupValueName, data); + ConfigurationGroupValueResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update configuration group value with secrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateConfigurationGroupValueWithSecrets() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueCreateSecret.json + // this example is just showing the usage of "ConfigurationGroupValues_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + ConfigurationGroupValueData data = new ConfigurationGroupValueData(new AzureLocation("eastus")) + { + Properties = new ConfigurationValueWithSecrets() + { + SecretConfigurationValue = "{\"interconnect-groups\":{\"stripe-one\":{\"name\":\"Stripe one\",\"international-interconnects\":[\"france\",\"germany\"],\"domestic-interconnects\":[\"birmingham\",\"edinburgh\"]},\"stripe-two\":{\"name\":\"Stripe two\",\"international-interconnects\":[\"germany\",\"italy\"],\"domestic-interconnects\":[\"edinburgh\",\"london\"]}},\"interconnect-group-assignments\":{\"ssc-one\":{\"ssc\":\"SSC 1\",\"interconnects\":\"stripe-one\"},\"ssc-two\":{\"ssc\":\"SSC 2\",\"interconnects\":\"stripe-two\"}}}", + ConfigurationGroupSchemaResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationGroupValueName, data); + ConfigurationGroupValueResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update first party configuration group value + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateFirstPartyConfigurationGroupValue() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueFirstPartyCreate.json + // this example is just showing the usage of "ConfigurationGroupValues_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation + string configurationGroupValueName = "testConfigurationGroupValue"; + ConfigurationGroupValueData data = new ConfigurationGroupValueData(new AzureLocation("eastus")) + { + Properties = new ConfigurationValueWithoutSecrets() + { + ConfigurationValue = "{\"interconnect-groups\":{\"stripe-one\":{\"name\":\"Stripe one\",\"international-interconnects\":[\"france\",\"germany\"],\"domestic-interconnects\":[\"birmingham\",\"edinburgh\"]},\"stripe-two\":{\"name\":\"Stripe two\",\"international-interconnects\":[\"germany\",\"italy\"],\"domestic-interconnects\":[\"edinburgh\",\"london\"]}},\"interconnect-group-assignments\":{\"ssc-one\":{\"ssc\":\"SSC 1\",\"interconnects\":\"stripe-one\"},\"ssc-two\":{\"ssc\":\"SSC 2\",\"interconnects\":\"stripe-two\"}}}", + ConfigurationGroupSchemaResourceReference = new SecretDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/testRG/providers/microsoft.hybridnetwork/publishers/testPublisher/configurationGroupSchemas/testConfigurationGroupSchemaName"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationGroupValueName, data); + ConfigurationGroupValueResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all hybrid network configurationGroupValues in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllHybridNetworkConfigurationGroupValuesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueListByResourceGroup.json + // this example is just showing the usage of "ConfigurationGroupValues_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ConfigurationGroupValueResource + ConfigurationGroupValueCollection collection = resourceGroupResource.GetConfigurationGroupValues(); + + // invoke the operation and iterate over the result + await foreach (ConfigurationGroupValueResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueResource.cs new file mode 100644 index 0000000000000..6e8535443a7a8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_ConfigurationGroupValueResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_ConfigurationGroupValueResource + { + // Delete hybrid configuration group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteHybridConfigurationGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueDelete.json + // this example is just showing the usage of "ConfigurationGroupValues_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ConfigurationGroupValueResource created on azure + // for more information of creating ConfigurationGroupValueResource, please refer to the document of ConfigurationGroupValueResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string configurationGroupValueName = "testConfigurationGroupValue"; + ResourceIdentifier configurationGroupValueResourceId = ConfigurationGroupValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configurationGroupValueName); + ConfigurationGroupValueResource configurationGroupValue = client.GetConfigurationGroupValueResource(configurationGroupValueResourceId); + + // invoke the operation + await configurationGroupValue.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get hybrid configuration group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetHybridConfigurationGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueGet.json + // this example is just showing the usage of "ConfigurationGroupValues_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ConfigurationGroupValueResource created on azure + // for more information of creating ConfigurationGroupValueResource, please refer to the document of ConfigurationGroupValueResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string configurationGroupValueName = "testConfigurationGroupValue"; + ResourceIdentifier configurationGroupValueResourceId = ConfigurationGroupValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configurationGroupValueName); + ConfigurationGroupValueResource configurationGroupValue = client.GetConfigurationGroupValueResource(configurationGroupValueResourceId); + + // invoke the operation + ConfigurationGroupValueResource result = await configurationGroupValue.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update hybrid configuration group tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateHybridConfigurationGroupTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueUpdateTags.json + // this example is just showing the usage of "ConfigurationGroupValues_UpdateTags" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ConfigurationGroupValueResource created on azure + // for more information of creating ConfigurationGroupValueResource, please refer to the document of ConfigurationGroupValueResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string configurationGroupValueName = "testConfigurationGroupValue"; + ResourceIdentifier configurationGroupValueResourceId = ConfigurationGroupValueResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, configurationGroupValueName); + ConfigurationGroupValueResource configurationGroupValue = client.GetConfigurationGroupValueResource(configurationGroupValueResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + ConfigurationGroupValueResource result = await configurationGroupValue.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all hybrid network sites in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConfigurationGroupValues_ListAllHybridNetworkSitesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/ConfigurationGroupValueListBySubscription.json + // this example is just showing the usage of "ConfigurationGroupValues_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (ConfigurationGroupValueResource item in subscriptionResource.GetConfigurationGroupValuesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConfigurationGroupValueData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionCollection.cs new file mode 100644 index 0000000000000..06d99308d92f3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionCollection.cs @@ -0,0 +1,633 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionCollection + { + // Get network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionResource result = await collection.GetAsync(networkFunctionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + bool result = await collection.ExistsAsync(networkFunctionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionName); + NetworkFunctionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionResource result = await collection.GetAsync(networkFunctionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + bool result = await collection.ExistsAsync(networkFunctionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionName); + NetworkFunctionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionResource result = await collection.GetAsync(networkFunctionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + bool result = await collection.ExistsAsync(networkFunctionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionName); + NetworkFunctionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create first party network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateFirstPartyNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionFirstPartyCreate.json + // this example is just showing the usage of "NetworkFunctions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithoutSecrets() + { + DeploymentValues = "{\"releaseName\":\"testReleaseName\",\"namespace\":\"testNamespace\"}", + NetworkFunctionDefinitionVersionResourceReference = new SecretDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureArcKubernetes, + NfviId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation"), + AllowSoftwareUpdate = false, + RoleOverrideValues = +{ +"{\"name\":\"testRoleOne\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"helmPackageVersion\":\"2.1.3\",\"values\":\"{\\\"roleOneParam\\\":\\\"roleOneOverrideValue\\\"}\"}}}","{\"name\":\"testRoleTwo\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"releaseName\":\"overrideReleaseName\",\"releaseNamespace\":\"overrideNamespace\",\"values\":\"{\\\"roleTwoParam\\\":\\\"roleTwoOverrideValue\\\"}\"}}}" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionCreate.json + // this example is just showing the usage of "NetworkFunctions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithoutSecrets() + { + DeploymentValues = "{\"releaseName\":\"testReleaseName\",\"namespace\":\"testNamespace\"}", + NetworkFunctionDefinitionVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureArcKubernetes, + NfviId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation"), + AllowSoftwareUpdate = false, + RoleOverrideValues = +{ +"{\"name\":\"testRoleOne\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"helmPackageVersion\":\"2.1.3\",\"values\":\"{\\\"roleOneParam\\\":\\\"roleOneOverrideValue\\\"}\"}}}","{\"name\":\"testRoleTwo\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"releaseName\":\"overrideReleaseName\",\"releaseNamespace\":\"overrideNamespace\",\"values\":\"{\\\"roleTwoParam\\\":\\\"roleTwoOverrideValue\\\"}\"}}}" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create network function resource with secrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateNetworkFunctionResourceWithSecrets() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionCreateSecret.json + // this example is just showing the usage of "NetworkFunctions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithSecrets() + { + SecretDeploymentValues = "{\"adminPassword\":\"password1\",\"userPassword\":\"password2\"}", + NetworkFunctionDefinitionVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureArcKubernetes, + NfviId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation"), + AllowSoftwareUpdate = false, + RoleOverrideValues = +{ +"{\"name\":\"testRoleOne\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"helmPackageVersion\":\"2.1.3\",\"values\":\"{\\\"roleOneParam\\\":\\\"roleOneOverrideValue\\\"}\"}}}","{\"name\":\"testRoleTwo\",\"deployParametersMappingRuleProfile\":{\"helmMappingRuleProfile\":{\"releaseName\":\"overrideReleaseName\",\"releaseNamespace\":\"overrideNamespace\",\"values\":\"{\\\"roleTwoParam\\\":\\\"roleTwoOverrideValue\\\"}\"}}}" +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionCreate.json + // this example is just showing the usage of "NetworkFunctions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithoutSecrets() + { + DeploymentValues = "{\"virtualMachineName\":\"test-VM\",\"cpuCores\":4,\"memorySizeGB\":8,\"cloudServicesNetworkAttachment\":{\"attachedNetworkId\":\"test-csnet\",\"ipAllocationMethod\":\"Dynamic\",\"networkAttachmentName\":\"test-cs-vlan\"},\"networkAttachments\":[{\"attachedNetworkId\":\"test-l3vlan\",\"defaultGateway\":\"True\",\"ipAllocationMethod\":\"Dynamic\",\"networkAttachmentName\":\"test-vlan\"}],\"sshPublicKeys\":[{\"keyData\":\"ssh-rsa CMIIIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0TqlveKKlc2MFvEmuXJiLGBsY1t4ML4uiRADGSZlnc+7Ugv3h+MCjkkwOKiOdsNo8k4KSBIG5GcQfKYOOd17AJvqCL6cGQbaLuqv0a64jeDm8oO8/xN/IM0oKw7rMr/2oAJOgIsfeXPkRxWWic9AVIS++H5Qi2r7bUFX+cqFsyUCAwEBBQ==\"}],\"storageProfile\":{\"osDisk\":{\"createOption\":\"Ephemeral\",\"deleteOption\":\"Delete\",\"diskSizeGB\":10}},\"userData\":\"testUserData\",\"adminUsername\":\"testUser\",\"virtioInterface\":\"Transitional\",\"isolateEmulatorThread\":\"False\",\"bootMethod\":\"BIOS\",\"placementHints\":[]}", + NetworkFunctionDefinitionVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureCore, + NfviId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/testResourceGroup"), + AllowSoftwareUpdate = false, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionCreate.json + // this example is just showing the usage of "NetworkFunctions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation + string networkFunctionName = "testNf"; + NetworkFunctionData data = new NetworkFunctionData(new AzureLocation("eastus")) + { + Properties = new NetworkFunctionValueWithoutSecrets() + { + DeploymentValues = "{\"virtualMachineName\":\"test-VM\",\"extendedLocationName\":\"test-cluster\",\"cpuCores\":4,\"memorySizeGB\":8,\"cloudServicesNetworkAttachment\":{\"attachedNetworkId\":\"test-csnet\",\"ipAllocationMethod\":\"Dynamic\",\"networkAttachmentName\":\"test-cs-vlan\"},\"networkAttachments\":[{\"attachedNetworkId\":\"test-l3vlan\",\"defaultGateway\":\"True\",\"ipAllocationMethod\":\"Dynamic\",\"networkAttachmentName\":\"test-vlan\"}],\"sshPublicKeys\":[{\"keyData\":\"ssh-rsa CMIIIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0TqlveKKlc2MFvEmuXJiLGBsY1t4ML4uiRADGSZlnc+7Ugv3h+MCjkkwOKiOdsNo8k4KSBIG5GcQfKYOOd17AJvqCL6cGQbaLuqv0a64jeDm8oO8/xN/IM0oKw7rMr/2oAJOgIsfeXPkRxWWic9AVIS++H5Qi2r7bUFX+cqFsyUCAwEBBQ==\"}],\"storageProfile\":{\"osDisk\":{\"createOption\":\"Ephemeral\",\"deleteOption\":\"Delete\",\"diskSizeGB\":10}},\"userData\":\"testUserData\",\"adminUsername\":\"testUser\",\"virtioInterface\":\"Transitional\",\"isolateEmulatorThread\":\"False\",\"bootMethod\":\"BIOS\",\"placementHints\":[]}", + NetworkFunctionDefinitionVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/testVendor/networkFunctionDefinitionGroups/testnetworkFunctionDefinitionGroupName/networkFunctionDefinitionVersions/1.0.1"), + }, + NfviType = NfviType.AzureOperatorNexus, + NfviId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation"), + AllowSoftwareUpdate = false, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionName, data); + NetworkFunctionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List network function in resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListNetworkFunctionInResourceGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionListByResourceGroup.json + // this example is just showing the usage of "NetworkFunctions_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this NetworkFunctionResource + NetworkFunctionCollection collection = resourceGroupResource.GetNetworkFunctions(); + + // invoke the operation and iterate over the result + await foreach (NetworkFunctionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupCollection.cs new file mode 100644 index 0000000000000..95a8238082b3a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionDefinitionGroupCollection + { + // Get networkFunctionDefinition groups under publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetNetworkFunctionDefinitionGroupsUnderPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupsListByPublisherName.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_ListByPublisher" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation and iterate over the result + await foreach (NetworkFunctionDefinitionGroupResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionGroupData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update the network function definition group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateTheNetworkFunctionDefinitionGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupCreate.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + NetworkFunctionDefinitionGroupData data = new NetworkFunctionDefinitionGroupData(new AzureLocation("eastus")); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionDefinitionGroupName, data); + NetworkFunctionDefinitionGroupResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + NetworkFunctionDefinitionGroupResource result = await collection.GetAsync(networkFunctionDefinitionGroupName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + bool result = await collection.ExistsAsync(networkFunctionDefinitionGroupName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkFunctionDefinitionGroupResource + NetworkFunctionDefinitionGroupCollection collection = publisher.GetNetworkFunctionDefinitionGroups(); + + // invoke the operation + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupResource.cs new file mode 100644 index 0000000000000..73ad1c4130c4c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionGroupResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionDefinitionGroupResource + { + // Delete a network function group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupDelete.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // invoke the operation + await networkFunctionDefinitionGroup.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a networkFunctionDefinition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // invoke the operation + NetworkFunctionDefinitionGroupResource result = await networkFunctionDefinitionGroup.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update the network function definition group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateTheNetworkFunctionDefinitionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionGroupUpdateTags.json + // this example is just showing the usage of "NetworkFunctionDefinitionGroups_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkFunctionDefinitionGroupResource result = await networkFunctionDefinitionGroup.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionCollection.cs new file mode 100644 index 0000000000000..61f56c4719163 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionCollection.cs @@ -0,0 +1,730 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionDefinitionVersionCollection + { + // Create or update a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionCreate.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionData data = new NetworkFunctionDefinitionVersionData(new AzureLocation("eastus")) + { + Properties = new ContainerizedNetworkFunctionDefinitionVersion() + { + NetworkFunctionTemplate = new AzureArcKubernetesNetworkFunctionTemplate() + { + NetworkFunctionApplications = +{ +new AzureArcKubernetesHelmApplication() +{ +ArtifactProfile = new AzureArcKubernetesArtifactProfile() +{ +HelmArtifactProfile = new HelmArtifactProfile() +{ +HelmPackageName = "fed-rbac", +HelmPackageVersionRange = "~2.1.3", +RegistryValuesPaths = +{ +"global.registry.docker.repoPath" +}, +ImagePullSecretsValuesPaths = +{ +"global.imagePullSecrets" +}, +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/testArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureArcKubernetesDeployMappingRuleProfile() +{ +HelmMappingRuleProfile = new HelmMappingRuleProfile() +{ +ReleaseNamespace = "{deployParameters.namesapce}", +ReleaseName = "{deployParameters.releaseName}", +HelmPackageVersion = "2.1.3", +Values = "", +Options = new HelmMappingRuleProfileConfig() +{ +InstallOptions = new HelmInstallConfig() +{ +Atomic = "true", +Wait = "waitValue", +Timeout = "30", +}, +UpgradeOptions = new HelmUpgradeConfig() +{ +Atomic = "true", +Wait = "waitValue", +Timeout = "30", +}, +}, +}, +ApplicationEnablement = ApplicationEnablement.Enabled, +}, +Name = "fedrbac", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +}, +UninstallDependsOn = +{ +}, +UpdateDependsOn = +{ +}, +}, +} +}, + }, + DeployParameters = "{\"type\":\"object\",\"properties\":{\"releaseName\":{\"type\":\"string\"},\"namespace\":{\"type\":\"string\"}}}", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionDefinitionVersionName, data); + NetworkFunctionDefinitionVersionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update a network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateANetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionCreate.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionData data = new NetworkFunctionDefinitionVersionData(new AzureLocation("eastus")) + { + Properties = new VirtualNetworkFunctionDefinitionVersion() + { + NetworkFunctionTemplate = new AzureCoreNetworkFunctionTemplate() + { + NetworkFunctionApplications = +{ +new AzureCoreNetworkFunctionVhdApplication() +{ +ArtifactProfile = new AzureCoreVhdImageArtifactProfile() +{ +VhdArtifactProfile = new VhdImageArtifactProfile() +{ +VhdName = "test-image", +VhdVersion = "1-0-0", +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureCoreVhdImageDeployMappingRuleProfile() +{ +VhdImageMappingRuleUserConfiguration = "", +ApplicationEnablement = ApplicationEnablement.Unknown, +}, +Name = "testImageRole", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +}, +UninstallDependsOn = +{ +}, +UpdateDependsOn = +{ +}, +}, +},new AzureCoreNetworkFunctionArmTemplateApplication() +{ +ArtifactProfile = new AzureCoreArmTemplateArtifactProfile() +{ +TemplateArtifactProfile = new ArmTemplateArtifactProfile() +{ +TemplateName = "test-template", +TemplateVersion = "1.0.0", +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureCoreArmTemplateDeployMappingRuleProfile() +{ +TemplateParameters = "{\"virtualMachineName\":\"{deployParameters.virtualMachineName}\",\"cpuCores\":\"{deployParameters.cpuCores}\",\"memorySizeGB\":\"{deployParameters.memorySizeGB}\",\"cloudServicesNetworkAttachment\":\"{deployParameters.cloudServicesNetworkAttachment}\",\"networkAttachments\":\"{deployParameters.networkAttachments}\",\"sshPublicKeys\":\"{deployParameters.sshPublicKeys}\",\"storageProfile\":\"{deployParameters.storageProfile}\",\"isolateEmulatorThread\":\"{deployParameters.isolateEmulatorThread}\",\"virtioInterface\":\"{deployParameters.virtioInterface}\",\"userData\":\"{deployParameters.userData}\",\"adminUsername\":\"{deployParameters.adminUsername}\",\"bootMethod\":\"{deployParameters.bootMethod}\",\"placementHints\":\"{deployParameters.placementHints}\"}", +ApplicationEnablement = ApplicationEnablement.Unknown, +}, +Name = "testTemplateRole", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +"testImageRole" +}, +UninstallDependsOn = +{ +"testImageRole" +}, +UpdateDependsOn = +{ +"testImageRole" +}, +}, +} +}, + }, + Description = "test NFDV for AzureCore", + DeployParameters = "{\"virtualMachineName\":{\"type\":\"string\"},\"cpuCores\":{\"type\":\"int\"},\"memorySizeGB\":{\"type\":\"int\"},\"cloudServicesNetworkAttachment\":{\"type\":\"object\",\"properties\":{\"networkAttachmentName\":{\"type\":\"string\"},\"attachedNetworkId\":{\"type\":\"string\"},\"ipAllocationMethod\":{\"type\":\"string\"},\"ipv4Address\":{\"type\":\"string\"},\"ipv6Address\":{\"type\":\"string\"},\"defaultGateway\":{\"type\":\"string\"}},\"required\":[\"attachedNetworkId\",\"ipAllocationMethod\"]},\"networkAttachments\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"networkAttachmentName\":{\"type\":\"string\"},\"attachedNetworkId\":{\"type\":\"string\"},\"ipAllocationMethod\":{\"type\":\"string\"},\"ipv4Address\":{\"type\":\"string\"},\"ipv6Address\":{\"type\":\"string\"},\"defaultGateway\":{\"type\":\"string\"}},\"required\":[\"attachedNetworkId\",\"ipAllocationMethod\"]}},\"storageProfile\":{\"type\":\"object\",\"properties\":{\"osDisk\":{\"type\":\"object\",\"properties\":{\"createOption\":{\"type\":\"string\"},\"deleteOption\":{\"type\":\"string\"},\"diskSizeGB\":{\"type\":\"integer\"}},\"required\":[\"diskSizeGB\"]}},\"required\":[\"osDisk\"]},\"sshPublicKeys\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"keyData\":{\"type\":\"string\"}},\"required\":[\"keyData\"]}},\"userData\":{\"type\":\"string\"},\"adminUsername\":{\"type\":\"string\"},\"bootMethod\":{\"type\":\"string\",\"default\":\"UEFI\",\"enum\":[\"UEFI\",\"BIOS\"]},\"isolateEmulatorThread\":{\"type\":\"string\"},\"virtioInterface\":{\"type\":\"string\"},\"placementHints\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"hintType\":{\"type\":\"string\",\"enum\":[\"Affinity\",\"AntiAffinity\"]},\"resourceId\":{\"type\":\"string\"},\"schedulingExecution\":{\"type\":\"string\",\"enum\":[\"Soft\",\"Hard\"]},\"scope\":{\"type\":\"string\"}},\"required\":[\"hintType\",\"schedulingExecution\",\"resourceId\",\"scope\"]}}}", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionDefinitionVersionName, data); + NetworkFunctionDefinitionVersionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update a network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateANetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionCreate.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionData data = new NetworkFunctionDefinitionVersionData(new AzureLocation("eastus")) + { + Properties = new VirtualNetworkFunctionDefinitionVersion() + { + NetworkFunctionTemplate = new AzureOperatorNexusNetworkFunctionTemplate() + { + NetworkFunctionApplications = +{ +new AzureOperatorNexusNetworkFunctionImageApplication() +{ +ArtifactProfile = new AzureOperatorNexusImageArtifactProfile() +{ +ImageArtifactProfile = new ImageArtifactProfile() +{ +ImageName = "test-image", +ImageVersion = "1.0.0", +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureOperatorNexusImageDeployMappingRuleProfile() +{ +ImageMappingRuleUserConfiguration = "", +ApplicationEnablement = ApplicationEnablement.Unknown, +}, +Name = "testImageRole", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +}, +UninstallDependsOn = +{ +}, +UpdateDependsOn = +{ +}, +}, +},new AzureOperatorNexusNetworkFunctionArmTemplateApplication() +{ +ArtifactProfile = new AzureOperatorNexusArmTemplateArtifactProfile() +{ +TemplateArtifactProfile = new ArmTemplateArtifactProfile() +{ +TemplateName = "test-template", +TemplateVersion = "1.0.0", +}, +ArtifactStoreId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg/providers/microsoft.hybridnetwork/publishers/TestPublisher/artifactStores/TestArtifactStore"), +}, +DeployParametersMappingRuleProfile = new AzureOperatorNexusArmTemplateDeployMappingRuleProfile() +{ +TemplateParameters = "{\"virtualMachineName\":\"{deployParameters.virtualMachineName}\",\"extendedLocationName\":\"{deployParameters.extendedLocationName}\",\"cpuCores\":\"{deployParameters.cpuCores}\",\"memorySizeGB\":\"{deployParameters.memorySizeGB}\",\"cloudServicesNetworkAttachment\":\"{deployParameters.cloudServicesNetworkAttachment}\",\"networkAttachments\":\"{deployParameters.networkAttachments}\",\"sshPublicKeys\":\"{deployParameters.sshPublicKeys}\",\"storageProfile\":\"{deployParameters.storageProfile}\",\"isolateEmulatorThread\":\"{deployParameters.isolateEmulatorThread}\",\"virtioInterface\":\"{deployParameters.virtioInterface}\",\"userData\":\"{deployParameters.userData}\",\"adminUsername\":\"{deployParameters.adminUsername}\",\"bootMethod\":\"{deployParameters.bootMethod}\",\"placementHints\":\"{deployParameters.placementHints}\"}", +ApplicationEnablement = ApplicationEnablement.Unknown, +}, +Name = "testTemplateRole", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +"testImageRole" +}, +UninstallDependsOn = +{ +"testImageRole" +}, +UpdateDependsOn = +{ +"testImageRole" +}, +}, +} +}, + }, + Description = "test NFDV for AzureOperatorNexus", + DeployParameters = "{\"virtualMachineName\":{\"type\":\"string\"},\"extendedLocationName\":{\"type\":\"string\"},\"cpuCores\":{\"type\":\"int\"},\"memorySizeGB\":{\"type\":\"int\"},\"cloudServicesNetworkAttachment\":{\"type\":\"object\",\"properties\":{\"networkAttachmentName\":{\"type\":\"string\"},\"attachedNetworkId\":{\"type\":\"string\"},\"ipAllocationMethod\":{\"type\":\"string\"},\"ipv4Address\":{\"type\":\"string\"},\"ipv6Address\":{\"type\":\"string\"},\"defaultGateway\":{\"type\":\"string\"}},\"required\":[\"attachedNetworkId\",\"ipAllocationMethod\"]},\"networkAttachments\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"networkAttachmentName\":{\"type\":\"string\"},\"attachedNetworkId\":{\"type\":\"string\"},\"ipAllocationMethod\":{\"type\":\"string\"},\"ipv4Address\":{\"type\":\"string\"},\"ipv6Address\":{\"type\":\"string\"},\"defaultGateway\":{\"type\":\"string\"}},\"required\":[\"attachedNetworkId\",\"ipAllocationMethod\"]}},\"storageProfile\":{\"type\":\"object\",\"properties\":{\"osDisk\":{\"type\":\"object\",\"properties\":{\"createOption\":{\"type\":\"string\"},\"deleteOption\":{\"type\":\"string\"},\"diskSizeGB\":{\"type\":\"integer\"}},\"required\":[\"diskSizeGB\"]}},\"required\":[\"osDisk\"]},\"sshPublicKeys\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"keyData\":{\"type\":\"string\"}},\"required\":[\"keyData\"]}},\"userData\":{\"type\":\"string\"},\"adminUsername\":{\"type\":\"string\"},\"bootMethod\":{\"type\":\"string\",\"default\":\"UEFI\",\"enum\":[\"UEFI\",\"BIOS\"]},\"isolateEmulatorThread\":{\"type\":\"string\"},\"virtioInterface\":{\"type\":\"string\"},\"placementHints\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"hintType\":{\"type\":\"string\",\"enum\":[\"Affinity\",\"AntiAffinity\"]},\"resourceId\":{\"type\":\"string\"},\"schedulingExecution\":{\"type\":\"string\",\"enum\":[\"Soft\",\"Hard\"]},\"scope\":{\"type\":\"string\"}},\"required\":[\"hintType\",\"schedulingExecution\",\"resourceId\",\"scope\"]}}}", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkFunctionDefinitionVersionName, data); + NetworkFunctionDefinitionVersionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionResource result = await collection.GetAsync(networkFunctionDefinitionVersionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + bool result = await collection.ExistsAsync(networkFunctionDefinitionVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionResource result = await collection.GetAsync(networkFunctionDefinitionVersionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + bool result = await collection.ExistsAsync(networkFunctionDefinitionVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NetworkFunctionDefinitionVersionResource result = await collection.GetAsync(networkFunctionDefinitionVersionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + bool result = await collection.ExistsAsync(networkFunctionDefinitionVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation + string networkFunctionDefinitionVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get Publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionListByNetworkFunctionDefinitionGroup.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_ListByNetworkFunctionDefinitionGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionGroupResource created on azure + // for more information of creating NetworkFunctionDefinitionGroupResource, please refer to the document of NetworkFunctionDefinitionGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupNameName"; + ResourceIdentifier networkFunctionDefinitionGroupResourceId = NetworkFunctionDefinitionGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + NetworkFunctionDefinitionGroupResource networkFunctionDefinitionGroup = client.GetNetworkFunctionDefinitionGroupResource(networkFunctionDefinitionGroupResourceId); + + // get the collection of this NetworkFunctionDefinitionVersionResource + NetworkFunctionDefinitionVersionCollection collection = networkFunctionDefinitionGroup.GetNetworkFunctionDefinitionVersions(); + + // invoke the operation and iterate over the result + await foreach (NetworkFunctionDefinitionVersionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionResource.cs new file mode 100644 index 0000000000000..af5f2bed20e49 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionDefinitionVersionResource.cs @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionDefinitionVersionResource + { + // Delete a network function definition version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionDefinitionVersion() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionDelete.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + await networkFunctionDefinitionVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Delete a network function definition version for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionDefinitionVersionForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionDelete.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + await networkFunctionDefinitionVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Delete a network function definition version for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionDefinitionVersionForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionDelete.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + await networkFunctionDefinitionVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a network function definition version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkFunctionDefinitionVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + NetworkFunctionDefinitionVersionResource result = await networkFunctionDefinitionVersion.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function definition version resource for AzureCore VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionDefinitionVersionResourceForAzureCoreVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + NetworkFunctionDefinitionVersionResource result = await networkFunctionDefinitionVersion.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network function definition version resource for AzureOperatorNexus VNF + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionDefinitionVersionResourceForAzureOperatorNexusVNF() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDefinitionVersionGet.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + NetworkFunctionDefinitionVersionResource result = await networkFunctionDefinitionVersion.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update the network function definition version tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTheNetworkFunctionDefinitionVersionTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionUpdateTags.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestNetworkFunctionDefinitionGroupName"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkFunctionDefinitionVersionResource result = await networkFunctionDefinitionVersion.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionDefinitionVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network function definition version state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateState_UpdateNetworkFunctionDefinitionVersionState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDefinitionVersionUpdateState.json + // this example is just showing the usage of "NetworkFunctionDefinitionVersions_updateState" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionDefinitionVersionResource created on azure + // for more information of creating NetworkFunctionDefinitionVersionResource, please refer to the document of NetworkFunctionDefinitionVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkFunctionDefinitionGroupName = "TestSkuGroup"; + string networkFunctionDefinitionVersionName = "1.0.0"; + ResourceIdentifier networkFunctionDefinitionVersionResourceId = NetworkFunctionDefinitionVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + NetworkFunctionDefinitionVersionResource networkFunctionDefinitionVersion = client.GetNetworkFunctionDefinitionVersionResource(networkFunctionDefinitionVersionResourceId); + + // invoke the operation + NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState = new NetworkFunctionDefinitionVersionUpdateState() + { + VersionState = VersionState.Active, + }; + ArmOperation lro = await networkFunctionDefinitionVersion.UpdateStateAsync(WaitUntil.Completed, networkFunctionDefinitionVersionUpdateState); + NetworkFunctionDefinitionVersionUpdateState result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionResource.cs new file mode 100644 index 0000000000000..89110f6edeb75 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkFunctionResource.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkFunctionResource + { + // Delete network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionDelete.json + // this example is just showing the usage of "NetworkFunctions_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + await networkFunction.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Delete virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionDelete.json + // this example is just showing the usage of "NetworkFunctions_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + await networkFunction.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Delete virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionDelete.json + // this example is just showing the usage of "NetworkFunctions_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + await networkFunction.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + NetworkFunctionResource result = await networkFunction.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get virtual network function resource on AzureCore + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetVirtualNetworkFunctionResourceOnAzureCore() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureCore/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + NetworkFunctionResource result = await networkFunction.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get virtual network function resource on AzureOperatorNexus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetVirtualNetworkFunctionResourceOnAzureOperatorNexus() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/AzureOperatorNexus/VirtualNetworkFunctionGet.json + // this example is just showing the usage of "NetworkFunctions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + NetworkFunctionResource result = await networkFunction.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update tags for network function resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTagsForNetworkFunctionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionUpdateTags.json + // this example is just showing the usage of "NetworkFunctions_UpdateTags" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNf"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkFunctionResource result = await networkFunction.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all network function resources in subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetNetworkFunctions_ListAllNetworkFunctionResourcesInSubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionListBySubscription.json + // this example is just showing the usage of "NetworkFunctions_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (NetworkFunctionResource item in subscriptionResource.GetNetworkFunctionsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkFunctionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Send request to network function services + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ExecuteRequest_SendRequestToNetworkFunctionServices() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkFunctionsExecuteRequest.json + // this example is just showing the usage of "NetworkFunctions_ExecuteRequest" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkFunctionResource created on azure + // for more information of creating NetworkFunctionResource, please refer to the document of NetworkFunctionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string networkFunctionName = "testNetworkfunction"; + ResourceIdentifier networkFunctionResourceId = NetworkFunctionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, networkFunctionName); + NetworkFunctionResource networkFunction = client.GetNetworkFunctionResource(networkFunctionResourceId); + + // invoke the operation + ExecuteRequestContent content = new ExecuteRequestContent("serviceEndpoint", new RequestMetadata("/simProfiles/testSimProfile", HttpMethod.Post, "{\"subscriptionProfile\":\"ChantestSubscription15\",\"permanentKey\":\"00112233445566778899AABBCCDDEEFF\",\"opcOperatorCode\":\"63bfa50ee6523365ff14c1f45f88737d\",\"staticIpAddresses\":{\"internet\":{\"ipv4Addr\":\"198.51.100.1\",\"ipv6Prefix\":\"2001:db8:abcd:12::0/64\"},\"another_network\":{\"ipv6Prefix\":\"2001:111:cdef:22::0/64\"}}}") + { + ApiVersion = "apiVersionQueryString", + }); + await networkFunction.ExecuteRequestAsync(WaitUntil.Completed, content); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupCollection.cs new file mode 100644 index 0000000000000..781284a4ffe05 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkServiceDesignGroupCollection + { + // Get networkServiceDesign groups under publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetNetworkServiceDesignGroupsUnderPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupsListByPublisherName.json + // this example is just showing the usage of "NetworkServiceDesignGroups_ListByPublisher" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation and iterate over the result + await foreach (NetworkServiceDesignGroupResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignGroupData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Create or update the network service design group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateTheNetworkServiceDesignGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupCreate.json + // this example is just showing the usage of "NetworkServiceDesignGroups_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + NetworkServiceDesignGroupData data = new NetworkServiceDesignGroupData(new AzureLocation("eastus")); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkServiceDesignGroupName, data); + NetworkServiceDesignGroupResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkServiceDesign group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json + // this example is just showing the usage of "NetworkServiceDesignGroups_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + NetworkServiceDesignGroupResource result = await collection.GetAsync(networkServiceDesignGroupName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a networkServiceDesign group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json + // this example is just showing the usage of "NetworkServiceDesignGroups_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + bool result = await collection.ExistsAsync(networkServiceDesignGroupName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a networkServiceDesign group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json + // this example is just showing the usage of "NetworkServiceDesignGroups_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // get the collection of this NetworkServiceDesignGroupResource + NetworkServiceDesignGroupCollection collection = publisher.GetNetworkServiceDesignGroups(); + + // invoke the operation + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + NullableResponse response = await collection.GetIfExistsAsync(networkServiceDesignGroupName); + NetworkServiceDesignGroupResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupResource.cs new file mode 100644 index 0000000000000..a606ae1b59657 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignGroupResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkServiceDesignGroupResource + { + // Delete a network function group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkFunctionGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupDelete.json + // this example is just showing the usage of "NetworkServiceDesignGroups_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // invoke the operation + await networkServiceDesignGroup.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a networkServiceDesign group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupGet.json + // this example is just showing the usage of "NetworkServiceDesignGroups_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // invoke the operation + NetworkServiceDesignGroupResource result = await networkServiceDesignGroup.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update the network service design group resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateTheNetworkServiceDesignGroupResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignGroupUpdateTags.json + // this example is just showing the usage of "NetworkServiceDesignGroups_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkServiceDesignGroupResource result = await networkServiceDesignGroup.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionCollection.cs new file mode 100644 index 0000000000000..05282cc09fe27 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionCollection.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkServiceDesignVersionCollection + { + // Create or update a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionCreate.json + // this example is just showing the usage of "NetworkServiceDesignVersions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation + string networkServiceDesignVersionName = "1.0.0"; + NetworkServiceDesignVersionData data = new NetworkServiceDesignVersionData(new AzureLocation("eastus")) + { + Properties = new NetworkServiceDesignVersionPropertiesFormat() + { + ConfigurationGroupSchemaReferences = +{ +["MyVM_Configuration"] = new WritableSubResource() +{ +Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/publishers/contosoGroup/networkServiceDesignGroups/NSD_contoso/configurationGroupSchemas/MyVM_Configuration_Schema"), +}, +}, + ResourceElementTemplates = +{ +new ArmResourceDefinitionResourceElementTemplateDetails() +{ +Configuration = new ArmResourceDefinitionResourceElementTemplate() +{ +TemplateType = TemplateType.ArmTemplate, +ParameterValues = "{\"publisherName\":\"{configurationparameters('MyVM_Configuration').publisherName}\",\"skuGroupName\":\"{configurationparameters('MyVM_Configuration').skuGroupName}\",\"skuVersion\":\"{configurationparameters('MyVM_Configuration').skuVersion}\",\"skuOfferingLocation\":\"{configurationparameters('MyVM_Configuration').skuOfferingLocation}\",\"nfviType\":\"{nfvis().nfvisFromSitePerNfviType.AzureCore.nfviAlias1.nfviType}\",\"nfviId\":\"{nfvis().nfvisFromSitePerNfviType.AzureCore.nfviAlias1.nfviId}\",\"allowSoftwareUpdates\":\"{configurationparameters('MyVM_Configuration').allowSoftwareUpdates}\",\"virtualNetworkName\":\"{configurationparameters('MyVM_Configuration').vnetName}\",\"subnetName\":\"{configurationparameters('MyVM_Configuration').subnetName}\",\"subnetAddressPrefix\":\"{configurationparameters('MyVM_Configuration').subnetAddressPrefix}\",\"managedResourceGroup\":\"{configurationparameters('SNSSelf').managedResourceGroupName}\",\"adminPassword\":\"{secretparameters('MyVM_Configuration').adminPassword}\"}", +ArtifactProfile = new NSDArtifactProfile() +{ +ArtifactStoreReferenceId = new ResourceIdentifier("/subscriptions/subid/providers/Microsoft.HybridNetwork/publishers/contosoGroup/artifactStoreReference/store1"), +ArtifactName = "MyVMArmTemplate", +ArtifactVersion = "1.0.0", +}, +}, +Name = "MyVM", +DependsOnProfile = new DependsOnProfile() +{ +InstallDependsOn = +{ +}, +}, +} +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, networkServiceDesignVersionName, data); + NetworkServiceDesignVersionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json + // this example is just showing the usage of "NetworkServiceDesignVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation + string networkServiceDesignVersionName = "1.0.0"; + NetworkServiceDesignVersionResource result = await collection.GetAsync(networkServiceDesignVersionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json + // this example is just showing the usage of "NetworkServiceDesignVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation + string networkServiceDesignVersionName = "1.0.0"; + bool result = await collection.ExistsAsync(networkServiceDesignVersionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json + // this example is just showing the usage of "NetworkServiceDesignVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation + string networkServiceDesignVersionName = "1.0.0"; + NullableResponse response = await collection.GetIfExistsAsync(networkServiceDesignVersionName); + NetworkServiceDesignVersionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get Publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionListByNetworkServiceDesignGroup.json + // this example is just showing the usage of "NetworkServiceDesignVersions_ListByNetworkServiceDesignGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignGroupResource created on azure + // for more information of creating NetworkServiceDesignGroupResource, please refer to the document of NetworkServiceDesignGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + ResourceIdentifier networkServiceDesignGroupResourceId = NetworkServiceDesignGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + NetworkServiceDesignGroupResource networkServiceDesignGroup = client.GetNetworkServiceDesignGroupResource(networkServiceDesignGroupResourceId); + + // get the collection of this NetworkServiceDesignVersionResource + NetworkServiceDesignVersionCollection collection = networkServiceDesignGroup.GetNetworkServiceDesignVersions(); + + // invoke the operation and iterate over the result + await foreach (NetworkServiceDesignVersionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionResource.cs new file mode 100644 index 0000000000000..b3b9d32e8c8cd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_NetworkServiceDesignVersionResource.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_NetworkServiceDesignVersionResource + { + // Delete a network service design version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteANetworkServiceDesignVersion() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionDelete.json + // this example is just showing the usage of "NetworkServiceDesignVersions_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignVersionResource created on azure + // for more information of creating NetworkServiceDesignVersionResource, please refer to the document of NetworkServiceDesignVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + string networkServiceDesignVersionName = "1.0.0"; + ResourceIdentifier networkServiceDesignVersionResourceId = NetworkServiceDesignVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + NetworkServiceDesignVersionResource networkServiceDesignVersion = client.GetNetworkServiceDesignVersionResource(networkServiceDesignVersionResourceId); + + // invoke the operation + await networkServiceDesignVersion.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a network service design version resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetANetworkServiceDesignVersionResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionGet.json + // this example is just showing the usage of "NetworkServiceDesignVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignVersionResource created on azure + // for more information of creating NetworkServiceDesignVersionResource, please refer to the document of NetworkServiceDesignVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + string networkServiceDesignVersionName = "1.0.0"; + ResourceIdentifier networkServiceDesignVersionResourceId = NetworkServiceDesignVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + NetworkServiceDesignVersionResource networkServiceDesignVersion = client.GetNetworkServiceDesignVersionResource(networkServiceDesignVersionResourceId); + + // invoke the operation + NetworkServiceDesignVersionResource result = await networkServiceDesignVersion.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update the network service design version tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateTheNetworkServiceDesignVersionTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionUpdateTags.json + // this example is just showing the usage of "NetworkServiceDesignVersions_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignVersionResource created on azure + // for more information of creating NetworkServiceDesignVersionResource, please refer to the document of NetworkServiceDesignVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + string networkServiceDesignVersionName = "1.0.0"; + ResourceIdentifier networkServiceDesignVersionResourceId = NetworkServiceDesignVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + NetworkServiceDesignVersionResource networkServiceDesignVersion = client.GetNetworkServiceDesignVersionResource(networkServiceDesignVersionResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + NetworkServiceDesignVersionResource result = await networkServiceDesignVersion.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + NetworkServiceDesignVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network service design version state + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateState_UpdateNetworkServiceDesignVersionState() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/NetworkServiceDesignVersionUpdateState.json + // this example is just showing the usage of "NetworkServiceDesignVersions_updateState" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this NetworkServiceDesignVersionResource created on azure + // for more information of creating NetworkServiceDesignVersionResource, please refer to the document of NetworkServiceDesignVersionResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + string networkServiceDesignGroupName = "TestNetworkServiceDesignGroupName"; + string networkServiceDesignVersionName = "1.0.0"; + ResourceIdentifier networkServiceDesignVersionResourceId = NetworkServiceDesignVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + NetworkServiceDesignVersionResource networkServiceDesignVersion = client.GetNetworkServiceDesignVersionResource(networkServiceDesignVersionResourceId); + + // invoke the operation + NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState = new NetworkServiceDesignVersionUpdateState() + { + VersionState = VersionState.Active, + }; + ArmOperation lro = await networkServiceDesignVersion.UpdateStateAsync(WaitUntil.Completed, networkServiceDesignVersionUpdateState); + NetworkServiceDesignVersionUpdateState result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherCollection.cs new file mode 100644 index 0000000000000..4721a586f2457 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_PublisherCollection + { + // List all publisher resources in a resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllPublisherResourcesInAResourceGroup() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherListByResourceGroup.json + // this example is just showing the usage of "Publishers_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation and iterate over the result + await foreach (PublisherResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublisherData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json + // this example is just showing the usage of "Publishers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation + string publisherName = "TestPublisher"; + PublisherResource result = await collection.GetAsync(publisherName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json + // this example is just showing the usage of "Publishers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation + string publisherName = "TestPublisher"; + bool result = await collection.ExistsAsync(publisherName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json + // this example is just showing the usage of "Publishers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation + string publisherName = "TestPublisher"; + NullableResponse response = await collection.GetIfExistsAsync(publisherName); + PublisherResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create or update a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherCreate.json + // this example is just showing the usage of "Publishers_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this PublisherResource + PublisherCollection collection = resourceGroupResource.GetPublishers(); + + // invoke the operation + string publisherName = "TestPublisher"; + PublisherData data = new PublisherData(new AzureLocation("eastus")) + { + Properties = new PublisherPropertiesFormat() + { + Scope = new PublisherScope("Public"), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, publisherName, data); + PublisherResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherResource.cs new file mode 100644 index 0000000000000..95f6934c6d45f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_PublisherResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_PublisherResource + { + // List all publisher resources in a subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetPublishers_ListAllPublisherResourcesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherListBySubscription.json + // this example is just showing the usage of "Publishers_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (PublisherResource item in subscriptionResource.GetPublishersAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublisherData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Delete a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherDelete.json + // this example is just showing the usage of "Publishers_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // invoke the operation + await publisher.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get a publisher resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAPublisherResource() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherGet.json + // this example is just showing the usage of "Publishers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // invoke the operation + PublisherResource result = await publisher.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update a publisher tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateAPublisherTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/PublisherUpdateTags.json + // this example is just showing the usage of "Publishers_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this PublisherResource created on azure + // for more information of creating PublisherResource, please refer to the document of PublisherResource + string subscriptionId = "subid"; + string resourceGroupName = "rg"; + string publisherName = "TestPublisher"; + ResourceIdentifier publisherResourceId = PublisherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, publisherName); + PublisherResource publisher = client.GetPublisherResource(publisherResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + PublisherResource result = await publisher.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + PublisherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteCollection.cs new file mode 100644 index 0000000000000..c57c4deac6046 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteCollection.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_SiteCollection + { + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json + // this example is just showing the usage of "Sites_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation + string siteName = "testSite"; + SiteResource result = await collection.GetAsync(siteName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json + // this example is just showing the usage of "Sites_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation + string siteName = "testSite"; + bool result = await collection.ExistsAsync(siteName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json + // this example is just showing the usage of "Sites_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation + string siteName = "testSite"; + NullableResponse response = await collection.GetIfExistsAsync(siteName); + SiteResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteCreate.json + // this example is just showing the usage of "Sites_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation + string siteName = "testSite"; + SiteData data = new SiteData(new AzureLocation("westUs2")) + { + Properties = new SitePropertiesFormat() + { + Nfvis = +{ +new AzureCoreNfviDetails() +{ +Location = new AzureLocation("westUs2"), +Name = "nfvi1", +},new AzureArcK8SClusterNfviDetails() +{ +CustomLocationReferenceId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation1"), +Name = "nfvi2", +},new AzureOperatorNexusClusterNfviDetails() +{ +CustomLocationReferenceId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/testResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/testCustomLocation2"), +Name = "nfvi3", +} +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, siteName, data); + SiteResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all network sites + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllNetworkSites() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteListByResourceGroup.json + // this example is just showing the usage of "Sites_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteResource + SiteCollection collection = resourceGroupResource.GetSites(); + + // invoke the operation and iterate over the result + await foreach (SiteResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceCollection.cs new file mode 100644 index 0000000000000..5b56a137f9c82 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceCollection.cs @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_SiteNetworkServiceCollection + { + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json + // this example is just showing the usage of "SiteNetworkServices_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + SiteNetworkServiceResource result = await collection.GetAsync(siteNetworkServiceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json + // this example is just showing the usage of "SiteNetworkServices_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + bool result = await collection.ExistsAsync(siteNetworkServiceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json + // this example is just showing the usage of "SiteNetworkServices_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + NullableResponse response = await collection.GetIfExistsAsync(siteNetworkServiceName); + SiteNetworkServiceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create first party site network service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateFirstPartySiteNetworkService() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceFirstPartyCreate.json + // this example is just showing the usage of "SiteNetworkServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + SiteNetworkServiceData data = new SiteNetworkServiceData(new AzureLocation("westUs2")) + { + Properties = new SiteNetworkServicePropertiesFormat() + { + SiteReferenceId = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/sites/testSite"), + NetworkServiceDesignVersionResourceReference = new SecretDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/TestPublisher/networkServiceDesignGroups/TestNetworkServiceDesignGroupName/networkServiceDesignVersions/1.0.0"), + }, + DesiredStateConfigurationGroupValueReferences = +{ +["MyVM_Configuration"] = new WritableSubResource() +{ +Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/configurationgroupvalues/MyVM_Configuration1"), +}, +}, + }, + Sku = new HybridNetworkSku(HybridNetworkSkuName.Standard), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, siteNetworkServiceName, data); + SiteNetworkServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create site network service + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateSiteNetworkService() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceCreate.json + // this example is just showing the usage of "SiteNetworkServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation + string siteNetworkServiceName = "testSiteNetworkServiceName"; + SiteNetworkServiceData data = new SiteNetworkServiceData(new AzureLocation("westUs2")) + { + Properties = new SiteNetworkServicePropertiesFormat() + { + SiteReferenceId = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/sites/testSite"), + NetworkServiceDesignVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/rg/providers/Microsoft.HybridNetwork/publishers/TestPublisher/networkServiceDesignGroups/TestNetworkServiceDesignGroupName/networkServiceDesignVersions/1.0.0"), + }, + DesiredStateConfigurationGroupValueReferences = +{ +["MyVM_Configuration"] = new WritableSubResource() +{ +Id = new ResourceIdentifier("/subscriptions/subid/resourcegroups/contosorg1/providers/microsoft.hybridnetwork/configurationgroupvalues/MyVM_Configuration1"), +}, +}, + }, + Sku = new HybridNetworkSku(HybridNetworkSkuName.Standard), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, siteNetworkServiceName, data); + SiteNetworkServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all network sites + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllNetworkSites() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceListByResourceGroup.json + // this example is just showing the usage of "SiteNetworkServices_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SiteNetworkServiceResource + SiteNetworkServiceCollection collection = resourceGroupResource.GetSiteNetworkServices(); + + // invoke the operation and iterate over the result + await foreach (SiteNetworkServiceResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteNetworkServiceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceResource.cs new file mode 100644 index 0000000000000..30aff3047669c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteNetworkServiceResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_SiteNetworkServiceResource + { + // Delete network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceDelete.json + // this example is just showing the usage of "SiteNetworkServices_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteNetworkServiceResource created on azure + // for more information of creating SiteNetworkServiceResource, please refer to the document of SiteNetworkServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteNetworkServiceName = "testSiteNetworkServiceName"; + ResourceIdentifier siteNetworkServiceResourceId = SiteNetworkServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteNetworkServiceName); + SiteNetworkServiceResource siteNetworkService = client.GetSiteNetworkServiceResource(siteNetworkServiceResourceId); + + // invoke the operation + await siteNetworkService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceGet.json + // this example is just showing the usage of "SiteNetworkServices_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteNetworkServiceResource created on azure + // for more information of creating SiteNetworkServiceResource, please refer to the document of SiteNetworkServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteNetworkServiceName = "testSiteNetworkServiceName"; + ResourceIdentifier siteNetworkServiceResourceId = SiteNetworkServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteNetworkServiceName); + SiteNetworkServiceResource siteNetworkService = client.GetSiteNetworkServiceResource(siteNetworkServiceResourceId); + + // invoke the operation + SiteNetworkServiceResource result = await siteNetworkService.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network site tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateNetworkSiteTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceUpdateTags.json + // this example is just showing the usage of "SiteNetworkServices_UpdateTags" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteNetworkServiceResource created on azure + // for more information of creating SiteNetworkServiceResource, please refer to the document of SiteNetworkServiceResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteNetworkServiceName = "testSiteNetworkServiceName"; + ResourceIdentifier siteNetworkServiceResourceId = SiteNetworkServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteNetworkServiceName); + SiteNetworkServiceResource siteNetworkService = client.GetSiteNetworkServiceResource(siteNetworkServiceResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + SiteNetworkServiceResource result = await siteNetworkService.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteNetworkServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all hybrid network sites in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSiteNetworkServices_ListAllHybridNetworkSitesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteNetworkServiceListBySubscription.json + // this example is just showing the usage of "SiteNetworkServices_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SiteNetworkServiceResource item in subscriptionResource.GetSiteNetworkServicesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteNetworkServiceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteResource.cs new file mode 100644 index 0000000000000..fcb3dad0bf71f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/samples/Generated/Samples/Sample_SiteResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork.Samples +{ + public partial class Sample_SiteResource + { + // Delete network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteDelete.json + // this example is just showing the usage of "Sites_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteResource created on azure + // for more information of creating SiteResource, please refer to the document of SiteResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteName = "testSite"; + ResourceIdentifier siteResourceId = SiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + SiteResource site = client.GetSiteResource(siteResourceId); + + // invoke the operation + await site.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get network site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSite() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteGet.json + // this example is just showing the usage of "Sites_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteResource created on azure + // for more information of creating SiteResource, please refer to the document of SiteResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteName = "testSite"; + ResourceIdentifier siteResourceId = SiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + SiteResource site = client.GetSiteResource(siteResourceId); + + // invoke the operation + SiteResource result = await site.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update network site tags + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateNetworkSiteTags() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteUpdateTags.json + // this example is just showing the usage of "Sites_UpdateTags" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteResource created on azure + // for more information of creating SiteResource, please refer to the document of SiteResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string siteName = "testSite"; + ResourceIdentifier siteResourceId = SiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, siteName); + SiteResource site = client.GetSiteResource(siteResourceId); + + // invoke the operation + TagsObject tagsObject = new TagsObject() + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2", +}, + }; + SiteResource result = await site.UpdateAsync(tagsObject); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List all hybrid network sites in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSites_ListAllHybridNetworkSitesInASubscription() + { + // Generated from example definition: specification/hybridnetwork/resource-manager/Microsoft.HybridNetwork/stable/2023-09-01/examples/SiteListBySubscription.json + // this example is just showing the usage of "Sites_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SiteResource item in subscriptionResource.GetSitesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Azure.ResourceManager.HybridNetwork.csproj b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Azure.ResourceManager.HybridNetwork.csproj new file mode 100644 index 0000000000000..f3383fe9225a8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Azure.ResourceManager.HybridNetwork.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.HybridNetwork + Azure Resource Manager client SDK for Azure resource provider HybridNetwork. + azure;management;arm;resource manager;hybridnetwork + + diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArmHybridNetworkModelFactory.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArmHybridNetworkModelFactory.cs new file mode 100644 index 0000000000000..f662c2d9caa3f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArmHybridNetworkModelFactory.cs @@ -0,0 +1,738 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Model factory for models. + public static partial class ArmHybridNetworkModelFactory + { + /// Initializes a new instance of ConfigurationGroupSchemaData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Configuration group schema properties. + /// A new instance for mocking. + public static ConfigurationGroupSchemaData ConfigurationGroupSchemaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ConfigurationGroupSchemaPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new ConfigurationGroupSchemaData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of ConfigurationGroupSchemaPropertiesFormat. + /// The provisioning state of the Configuration group schema resource. + /// The configuration group schema version state. + /// Description of what schema can contain. + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + /// A new instance for mocking. + public static ConfigurationGroupSchemaPropertiesFormat ConfigurationGroupSchemaPropertiesFormat(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, string schemaDefinition = null) + { + return new ConfigurationGroupSchemaPropertiesFormat(provisioningState, versionState, description, schemaDefinition); + } + + /// Initializes a new instance of ConfigurationGroupValueData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Hybrid configuration group value properties. + /// 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 . + /// + /// A new instance for mocking. + public static ConfigurationGroupValueData ConfigurationGroupValueData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ConfigurationGroupValuePropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new ConfigurationGroupValueData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of ConfigurationGroupValuePropertiesFormat. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// 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 . + /// + /// The value which indicates if configuration values are secrets. + /// A new instance for mocking. + public static ConfigurationGroupValuePropertiesFormat ConfigurationGroupValuePropertiesFormat(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string configurationType = "Unknown") + { + return new UnknownConfigurationGroupValuePropertiesFormat(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, configurationType); + } + + /// Initializes a new instance of NetworkFunctionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Network function properties. + /// 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 . + /// + /// A unique read-only string that changes whenever the resource is updated. + /// The managed identity of the network function. + /// A new instance for mocking. + public static NetworkFunctionData NetworkFunctionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkFunctionPropertiesFormat properties = null, ETag? etag = null, ManagedServiceIdentity identity = null) + { + tags ??= new Dictionary(); + + return new NetworkFunctionData(id, name, resourceType, systemData, tags, location, properties, etag, identity); + } + + /// Initializes a new instance of NetworkFunctionPropertiesFormat. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// 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 . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + /// A new instance for mocking. + public static NetworkFunctionPropertiesFormat NetworkFunctionPropertiesFormat(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, NfviType? nfviType = null, ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = null, string configurationType = "Unknown", IEnumerable roleOverrideValues = null) + { + roleOverrideValues ??= new List(); + + return new UnknownNetworkFunctionPropertiesFormat(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, configurationType, roleOverrideValues?.ToList()); + } + + /// Initializes a new instance of ComponentData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The component properties. + /// A new instance for mocking. + public static ComponentData ComponentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ComponentProperties properties = null) + { + return new ComponentData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of ComponentProperties. + /// The provisioning state of the component resource. + /// The JSON-serialized deployment profile of the component resource. + /// The deployment status of the component resource. + /// A new instance for mocking. + public static ComponentProperties ComponentProperties(ProvisioningState? provisioningState = null, string deploymentProfile = null, DeploymentStatusProperties deploymentStatus = null) + { + return new ComponentProperties(provisioningState, deploymentProfile, deploymentStatus); + } + + /// Initializes a new instance of DeploymentStatusProperties. + /// The status of the component resource. + /// The resource related to the component resource. + /// The next expected update of deployment status. + /// A new instance for mocking. + public static DeploymentStatusProperties DeploymentStatusProperties(ComponentStatus? status = null, ComponentKubernetesResources resources = null, DateTimeOffset? nextExpectedUpdateOn = null) + { + return new DeploymentStatusProperties(status, resources, nextExpectedUpdateOn); + } + + /// Initializes a new instance of ComponentKubernetesResources. + /// Deployments that are related to component resource. + /// Pods related to component resource. + /// Replica sets related to component resource. + /// Stateful sets related to component resource. + /// Daemonsets related to component resource. + /// A new instance for mocking. + public static ComponentKubernetesResources ComponentKubernetesResources(IEnumerable deployments = null, IEnumerable pods = null, IEnumerable replicaSets = null, IEnumerable statefulSets = null, IEnumerable daemonSets = null) + { + deployments ??= new List(); + pods ??= new List(); + replicaSets ??= new List(); + statefulSets ??= new List(); + daemonSets ??= new List(); + + return new ComponentKubernetesResources(deployments?.ToList(), pods?.ToList(), replicaSets?.ToList(), statefulSets?.ToList(), daemonSets?.ToList()); + } + + /// Initializes a new instance of KubernetesDeployment. + /// The name of the deployment. + /// The namespace of the deployment. + /// Desired number of pods. + /// Number of ready pods. + /// Number of upto date pods. + /// Number of available pods. + /// Creation Time of deployment. + /// A new instance for mocking. + public static KubernetesDeployment KubernetesDeployment(string name = null, string @namespace = null, int? desiredNumberOfPods = null, int? readyNumberOfPods = null, int? upToDateNumberOfPods = null, int? availableNumberOfPods = null, DateTimeOffset? createdOn = null) + { + return new KubernetesDeployment(name, @namespace, desiredNumberOfPods, readyNumberOfPods, upToDateNumberOfPods, availableNumberOfPods, createdOn); + } + + /// Initializes a new instance of KubernetesPod. + /// The name of the Pod. + /// The namespace of the Pod. + /// Desired number of containers. + /// Number of ready containers. + /// The status of a pod. + /// Creation Time of Pod. + /// Last 5 Pod events. + /// A new instance for mocking. + public static KubernetesPod KubernetesPod(string name = null, string @namespace = null, int? desiredNumberOfContainers = null, int? readyNumberOfContainers = null, PodStatus? status = null, DateTimeOffset? createdOn = null, IEnumerable events = null) + { + events ??= new List(); + + return new KubernetesPod(name, @namespace, desiredNumberOfContainers, readyNumberOfContainers, status, createdOn, events?.ToList()); + } + + /// Initializes a new instance of PodEvent. + /// The type of pod event. + /// Event reason. + /// Event message. + /// Event Last seen. + /// A new instance for mocking. + public static PodEvent PodEvent(PodEventType? eventType = null, string reason = null, string message = null, DateTimeOffset? lastSeenOn = null) + { + return new PodEvent(eventType, reason, message, lastSeenOn); + } + + /// Initializes a new instance of KubernetesReplicaSet. + /// The name of the replicaSet. + /// The namespace of the replicaSet. + /// Desired number of pods. + /// Number of ready pods. + /// Number of current pods. + /// Creation Time of replicaSet. + /// A new instance for mocking. + public static KubernetesReplicaSet KubernetesReplicaSet(string name = null, string @namespace = null, int? desiredNumberOfPods = null, int? readyNumberOfPods = null, int? currentNumberOfPods = null, DateTimeOffset? createdOn = null) + { + return new KubernetesReplicaSet(name, @namespace, desiredNumberOfPods, readyNumberOfPods, currentNumberOfPods, createdOn); + } + + /// Initializes a new instance of KubernetesStatefulSet. + /// The name of the statefulset. + /// The namespace of the statefulset. + /// Desired number of pods. + /// Number of ready pods. + /// Creation Time of statefulset. + /// A new instance for mocking. + public static KubernetesStatefulSet KubernetesStatefulSet(string name = null, string @namespace = null, int? desiredNumberOfPods = null, int? readyNumberOfPods = null, DateTimeOffset? createdOn = null) + { + return new KubernetesStatefulSet(name, @namespace, desiredNumberOfPods, readyNumberOfPods, createdOn); + } + + /// Initializes a new instance of KubernetesDaemonSet. + /// The name of the daemonSet. + /// The namespace of the daemonSet. + /// Desired number of pods. + /// Current number of pods. + /// Number of Ready pods. + /// Number of upto date pods. + /// Number of available pods. + /// Creation Time of daemonSet. + /// A new instance for mocking. + public static KubernetesDaemonSet KubernetesDaemonSet(string name = null, string @namespace = null, int? desiredNumberOfPods = null, int? currentNumberOfPods = null, int? readyNumberOfPods = null, int? upToDateNumberOfPods = null, int? availableNumberOfPods = null, DateTimeOffset? createdOn = null) + { + return new KubernetesDaemonSet(name, @namespace, desiredNumberOfPods, currentNumberOfPods, readyNumberOfPods, upToDateNumberOfPods, availableNumberOfPods, createdOn); + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Network function definition group properties. + /// A new instance for mocking. + public static NetworkFunctionDefinitionGroupData NetworkFunctionDefinitionGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkFunctionDefinitionGroupPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new NetworkFunctionDefinitionGroupData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupPropertiesFormat. + /// The provisioning state of the network function definition groups resource. + /// The network function definition group description. + /// A new instance for mocking. + public static NetworkFunctionDefinitionGroupPropertiesFormat NetworkFunctionDefinitionGroupPropertiesFormat(ProvisioningState? provisioningState = null, string description = null) + { + return new NetworkFunctionDefinitionGroupPropertiesFormat(provisioningState, description); + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Network function definition version properties. + /// 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 . + /// + /// A new instance for mocking. + public static NetworkFunctionDefinitionVersionData NetworkFunctionDefinitionVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkFunctionDefinitionVersionPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new NetworkFunctionDefinitionVersionData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionPropertiesFormat. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + /// A new instance for mocking. + public static NetworkFunctionDefinitionVersionPropertiesFormat NetworkFunctionDefinitionVersionPropertiesFormat(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, string deployParameters = null, string networkFunctionType = "Unknown") + { + return new UnknownNetworkFunctionDefinitionVersionPropertiesFormat(provisioningState, versionState, description, deployParameters, networkFunctionType); + } + + /// Initializes a new instance of NetworkServiceDesignGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// network service design group properties. + /// A new instance for mocking. + public static NetworkServiceDesignGroupData NetworkServiceDesignGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkServiceDesignGroupPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new NetworkServiceDesignGroupData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of NetworkServiceDesignGroupPropertiesFormat. + /// The provisioning state of the network service design groups resource. + /// The network service design group description. + /// A new instance for mocking. + public static NetworkServiceDesignGroupPropertiesFormat NetworkServiceDesignGroupPropertiesFormat(ProvisioningState? provisioningState = null, string description = null) + { + return new NetworkServiceDesignGroupPropertiesFormat(provisioningState, description); + } + + /// Initializes a new instance of NetworkServiceDesignVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// network service design version properties. + /// A new instance for mocking. + public static NetworkServiceDesignVersionData NetworkServiceDesignVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetworkServiceDesignVersionPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new NetworkServiceDesignVersionData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of NetworkServiceDesignVersionPropertiesFormat. + /// The provisioning state of the network service design version resource. + /// The network service design version state. + /// The network service design version description. + /// The configuration schemas to used to define the values. + /// The nfvis from the site. + /// + /// List of resource element template + /// 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 . + /// + /// A new instance for mocking. + public static NetworkServiceDesignVersionPropertiesFormat NetworkServiceDesignVersionPropertiesFormat(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, IDictionary configurationGroupSchemaReferences = null, IDictionary nfvisFromSite = null, IEnumerable resourceElementTemplates = null) + { + configurationGroupSchemaReferences ??= new Dictionary(); + nfvisFromSite ??= new Dictionary(); + resourceElementTemplates ??= new List(); + + return new NetworkServiceDesignVersionPropertiesFormat(provisioningState, versionState, description, configurationGroupSchemaReferences, nfvisFromSite, resourceElementTemplates?.ToList()); + } + + /// Initializes a new instance of PublisherData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Publisher properties. + /// The managed identity of the publisher, if configured. + /// A new instance for mocking. + public static PublisherData PublisherData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, PublisherPropertiesFormat properties = null, ManagedServiceIdentity identity = null) + { + tags ??= new Dictionary(); + + return new PublisherData(id, name, resourceType, systemData, tags, location, properties, identity); + } + + /// Initializes a new instance of PublisherPropertiesFormat. + /// The provisioning state of the publisher resource. + /// The publisher scope. + /// A new instance for mocking. + public static PublisherPropertiesFormat PublisherPropertiesFormat(ProvisioningState? provisioningState = null, PublisherScope? scope = null) + { + return new PublisherPropertiesFormat(provisioningState, scope); + } + + /// Initializes a new instance of ArtifactStoreData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ArtifactStores properties. + /// A new instance for mocking. + public static ArtifactStoreData ArtifactStoreData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ArtifactStorePropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new ArtifactStoreData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of ArtifactStorePropertiesFormat. + /// The provisioning state of the application groups resource. + /// The artifact store type. + /// The replication strategy. + /// + /// The created storage resource id. + /// A new instance for mocking. + public static ArtifactStorePropertiesFormat ArtifactStorePropertiesFormat(ProvisioningState? provisioningState = null, ArtifactStoreType? storeType = null, ArtifactReplicationStrategy? replicationStrategy = null, ArtifactStorePropertiesFormatManagedResourceGroupConfiguration managedResourceGroupConfiguration = null, ResourceIdentifier storageResourceId = null) + { + return new ArtifactStorePropertiesFormat(provisioningState, storeType, replicationStrategy, managedResourceGroupConfiguration, storageResourceId); + } + + /// Initializes a new instance of ArtifactManifestData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Artifact manifest properties. + /// A new instance for mocking. + public static ArtifactManifestData ArtifactManifestData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ArtifactManifestPropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new ArtifactManifestData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of ArtifactManifestPropertiesFormat. + /// The provisioning state of the ArtifactManifest resource. + /// The artifact manifest state. + /// The artifacts list. + /// A new instance for mocking. + public static ArtifactManifestPropertiesFormat ArtifactManifestPropertiesFormat(ProvisioningState? provisioningState = null, ArtifactManifestState? artifactManifestState = null, IEnumerable artifacts = null) + { + artifacts ??= new List(); + + return new ArtifactManifestPropertiesFormat(provisioningState, artifactManifestState, artifacts?.ToList()); + } + + /// Initializes a new instance of ProxyArtifactListOverview. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// A new instance for mocking. + public static ProxyArtifactListOverview ProxyArtifactListOverview(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null) + { + return new ProxyArtifactListOverview(id, name, resourceType, systemData); + } + + /// Initializes a new instance of ProxyArtifactVersionsListOverview. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Proxy Artifact overview properties. + /// A new instance for mocking. + public static ProxyArtifactVersionsListOverview ProxyArtifactVersionsListOverview(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProxyArtifactOverviewPropertiesValue properties = null) + { + return new ProxyArtifactVersionsListOverview(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of ProxyArtifactOverviewPropertiesValue. + /// The artifact type. + /// The artifact version. + /// The artifact state. + /// A new instance for mocking. + public static ProxyArtifactOverviewPropertiesValue ProxyArtifactOverviewPropertiesValue(ArtifactType? artifactType = null, string artifactVersion = null, ArtifactState? artifactState = null) + { + return new ProxyArtifactOverviewPropertiesValue(artifactType, artifactVersion, artifactState); + } + + /// Initializes a new instance of SiteData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Site properties. + /// A new instance for mocking. + public static SiteData SiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SitePropertiesFormat properties = null) + { + tags ??= new Dictionary(); + + return new SiteData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of SitePropertiesFormat. + /// The provisioning state of the site resource. **TODO**: Confirm if this is needed. + /// + /// List of NFVIs + /// 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 . + /// + /// The list of site network services on the site. + /// A new instance for mocking. + public static SitePropertiesFormat SitePropertiesFormat(ProvisioningState? provisioningState = null, IEnumerable nfvis = null, IEnumerable siteNetworkServiceReferences = null) + { + nfvis ??= new List(); + siteNetworkServiceReferences ??= new List(); + + return new SitePropertiesFormat(provisioningState, nfvis?.ToList(), siteNetworkServiceReferences?.ToList()); + } + + /// Initializes a new instance of SiteNetworkServiceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Site network service properties. + /// The managed identity of the Site network service, if configured. + /// Sku of the site network service. + /// A new instance for mocking. + public static SiteNetworkServiceData SiteNetworkServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SiteNetworkServicePropertiesFormat properties = null, ManagedServiceIdentity identity = null, HybridNetworkSku sku = null) + { + tags ??= new Dictionary(); + + return new SiteNetworkServiceData(id, name, resourceType, systemData, tags, location, properties, identity, sku); + } + + /// Initializes a new instance of SiteNetworkServicePropertiesFormat. + /// The provisioning state of the site network service resource. + /// Managed resource group configuration. + /// The site details. + /// The publisher name for the site network service. + /// The scope of the publisher. + /// The network service design group name for the site network service. + /// The network service design version for the site network service. + /// The location of the network service design offering. + /// + /// The network service design version resource reference. + /// 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 . + /// + /// The goal state of the site network service resource. This has references to the configuration group value objects that describe the desired state of the site network service. + /// The network service design version for the site network service. + /// The last state of the site network service resource. + /// A new instance for mocking. + public static SiteNetworkServicePropertiesFormat SiteNetworkServicePropertiesFormat(ProvisioningState? provisioningState = null, ManagedResourceGroupConfiguration managedResourceGroupConfiguration = null, ResourceIdentifier siteReferenceId = null, string publisherName = null, PublisherScope? publisherScope = null, string networkServiceDesignGroupName = null, string networkServiceDesignVersionName = null, string networkServiceDesignVersionOfferingLocation = null, DeploymentResourceIdReference networkServiceDesignVersionResourceReference = null, IDictionary desiredStateConfigurationGroupValueReferences = null, string lastStateNetworkServiceDesignVersionName = null, IReadOnlyDictionary lastStateConfigurationGroupValueReferences = null) + { + desiredStateConfigurationGroupValueReferences ??= new Dictionary(); + lastStateConfigurationGroupValueReferences ??= new Dictionary(); + + return new SiteNetworkServicePropertiesFormat(provisioningState, managedResourceGroupConfiguration, siteReferenceId != null ? ResourceManagerModelFactory.WritableSubResource(siteReferenceId) : null, publisherName, publisherScope, networkServiceDesignGroupName, networkServiceDesignVersionName, networkServiceDesignVersionOfferingLocation, networkServiceDesignVersionResourceReference, desiredStateConfigurationGroupValueReferences, lastStateNetworkServiceDesignVersionName, lastStateConfigurationGroupValueReferences); + } + + /// Initializes a new instance of HybridNetworkSku. + /// Name of this Sku. + /// The SKU tier based on the SKU name. + /// A new instance for mocking. + public static HybridNetworkSku HybridNetworkSku(HybridNetworkSkuName name = default, HybridNetworkSkuTier? tier = null) + { + return new HybridNetworkSku(name, tier); + } + + /// Initializes a new instance of AzureContainerRegistryScopedTokenCredential. + /// The username of the credential. + /// The credential value. + /// The Acr server url. + /// The repositories that could be accessed using the current credential. + /// The UTC time when credential will expire. + /// A new instance for mocking. + public static AzureContainerRegistryScopedTokenCredential AzureContainerRegistryScopedTokenCredential(string username = null, string acrToken = null, Uri acrServerUri = null, IEnumerable repositories = null, DateTimeOffset? expiry = null) + { + repositories ??= new List(); + + return new AzureContainerRegistryScopedTokenCredential(CredentialType.AzureContainerRegistryScopedToken, username, acrToken, acrServerUri, repositories?.ToList(), expiry); + } + + /// Initializes a new instance of AzureStorageAccountCredential. + /// The storage account Id. + /// The containers that could be accessed using the current credential. + /// The UTC time when credential will expire. + /// A new instance for mocking. + public static AzureStorageAccountCredential AzureStorageAccountCredential(ResourceIdentifier storageAccountId = null, IEnumerable containerCredentials = null, DateTimeOffset? expiry = null) + { + containerCredentials ??= new List(); + + return new AzureStorageAccountCredential(CredentialType.AzureStorageAccountToken, storageAccountId, containerCredentials?.ToList(), expiry); + } + + /// Initializes a new instance of AzureStorageAccountContainerCredential. + /// The storage account container name. + /// The storage account container sas uri. + /// A new instance for mocking. + public static AzureStorageAccountContainerCredential AzureStorageAccountContainerCredential(string containerName = null, Uri containerSasUri = null) + { + return new AzureStorageAccountContainerCredential(containerName, containerSasUri); + } + + /// Initializes a new instance of ConfigurationValueWithSecrets. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// 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 . + /// + /// Name and value pairs that define the configuration value secrets. It can be a well formed escaped JSON string. + /// A new instance for mocking. + public static ConfigurationValueWithSecrets ConfigurationValueWithSecrets(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string secretConfigurationValue = null) + { + return new ConfigurationValueWithSecrets(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType.Secret, secretConfigurationValue); + } + + /// Initializes a new instance of ConfigurationValueWithoutSecrets. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// 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 . + /// + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + /// A new instance for mocking. + public static ConfigurationValueWithoutSecrets ConfigurationValueWithoutSecrets(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string configurationGroupSchemaName = null, string configurationGroupSchemaOfferingLocation = null, DeploymentResourceIdReference configurationGroupSchemaResourceReference = null, string configurationValue = null) + { + return new ConfigurationValueWithoutSecrets(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType.Open, configurationValue); + } + + /// Initializes a new instance of NetworkFunctionValueWithSecrets. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// 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 . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The role configuration override values from the user. + /// The JSON-serialized secret deployment values from the user. This contains secrets like passwords,keys etc. + /// A new instance for mocking. + public static NetworkFunctionValueWithSecrets NetworkFunctionValueWithSecrets(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, NfviType? nfviType = null, ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = null, IEnumerable roleOverrideValues = null, string secretDeploymentValues = null) + { + roleOverrideValues ??= new List(); + + return new NetworkFunctionValueWithSecrets(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, NetworkFunctionConfigurationType.Secret, roleOverrideValues?.ToList(), secretDeploymentValues); + } + + /// Initializes a new instance of NetworkFunctionValueWithoutSecrets. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// 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 . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The role configuration override values from the user. + /// The JSON-serialized deployment values from the user. + /// A new instance for mocking. + public static NetworkFunctionValueWithoutSecrets NetworkFunctionValueWithoutSecrets(ProvisioningState? provisioningState = null, string publisherName = null, PublisherScope? publisherScope = null, string networkFunctionDefinitionGroupName = null, string networkFunctionDefinitionVersion = null, string networkFunctionDefinitionOfferingLocation = null, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference = null, NfviType? nfviType = null, ResourceIdentifier nfviId = null, bool? allowSoftwareUpdate = null, IEnumerable roleOverrideValues = null, string deploymentValues = null) + { + roleOverrideValues ??= new List(); + + return new NetworkFunctionValueWithoutSecrets(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, NetworkFunctionConfigurationType.Open, roleOverrideValues?.ToList(), deploymentValues); + } + + /// Initializes a new instance of ContainerizedNetworkFunctionDefinitionVersion. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// + /// Containerized network function template. + /// 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 . + /// + /// A new instance for mocking. + public static ContainerizedNetworkFunctionDefinitionVersion ContainerizedNetworkFunctionDefinitionVersion(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, string deployParameters = null, ContainerizedNetworkFunctionTemplate networkFunctionTemplate = null) + { + return new ContainerizedNetworkFunctionDefinitionVersion(provisioningState, versionState, description, deployParameters, NetworkFunctionType.ContainerizedNetworkFunction, networkFunctionTemplate); + } + + /// Initializes a new instance of VirtualNetworkFunctionDefinitionVersion. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// + /// Virtual network function template. + /// 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 . + /// + /// A new instance for mocking. + public static VirtualNetworkFunctionDefinitionVersion VirtualNetworkFunctionDefinitionVersion(ProvisioningState? provisioningState = null, VersionState? versionState = null, string description = null, string deployParameters = null, VirtualNetworkFunctionTemplate networkFunctionTemplate = null) + { + return new VirtualNetworkFunctionDefinitionVersion(provisioningState, versionState, description, deployParameters, NetworkFunctionType.VirtualNetworkFunction, networkFunctionTemplate); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestCollection.cs new file mode 100644 index 0000000000000..13472b043e87a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestCollection.cs @@ -0,0 +1,415 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetArtifactManifests method from an instance of . + /// + public partial class ArtifactManifestCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _artifactManifestClientDiagnostics; + private readonly ArtifactManifestsRestOperations _artifactManifestRestClient; + + /// Initializes a new instance of the class for mocking. + protected ArtifactManifestCollection() + { + } + + /// 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 ArtifactManifestCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _artifactManifestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ArtifactManifestResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ArtifactManifestResource.ResourceType, out string artifactManifestApiVersion); + _artifactManifestRestClient = new ArtifactManifestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, artifactManifestApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ArtifactStoreResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ArtifactStoreResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 artifactManifestName, ArtifactManifestData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ArtifactManifestOperationSource(Client), _artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 artifactManifestName, ArtifactManifestData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new ArtifactManifestOperationSource(Client), _artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.Get"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.Get"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests + /// + /// + /// Operation Id + /// ArtifactManifests_ListByArtifactStore + /// + /// + /// + /// 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) => _artifactManifestRestClient.CreateListByArtifactStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _artifactManifestRestClient.CreateListByArtifactStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArtifactManifestResource(Client, ArtifactManifestData.DeserializeArtifactManifestData(e)), _artifactManifestClientDiagnostics, Pipeline, "ArtifactManifestCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about the artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests + /// + /// + /// Operation Id + /// ArtifactManifests_ListByArtifactStore + /// + /// + /// + /// 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) => _artifactManifestRestClient.CreateListByArtifactStoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _artifactManifestRestClient.CreateListByArtifactStoreNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArtifactManifestResource(Client, ArtifactManifestData.DeserializeArtifactManifestData(e)), _artifactManifestClientDiagnostics, Pipeline, "ArtifactManifestCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.Exists"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.Exists"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestCollection.GetIfExists"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactManifestName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestData.cs new file mode 100644 index 0000000000000..3d2705977b09f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the ArtifactManifest data model. + /// Artifact manifest properties. + /// + public partial class ArtifactManifestData : TrackedResourceData + { + /// Initializes a new instance of ArtifactManifestData. + /// The location. + public ArtifactManifestData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ArtifactManifestData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Artifact manifest properties. + internal ArtifactManifestData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ArtifactManifestPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Artifact manifest properties. + public ArtifactManifestPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestResource.cs new file mode 100644 index 0000000000000..858640a6fe976 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactManifestResource.cs @@ -0,0 +1,742 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing an ArtifactManifest 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 GetArtifactManifestResource method. + /// Otherwise you can get one from its parent resource using the GetArtifactManifest method. + /// + public partial class ArtifactManifestResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publisherName. + /// The artifactStoreName. + /// The artifactManifestName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _artifactManifestClientDiagnostics; + private readonly ArtifactManifestsRestOperations _artifactManifestRestClient; + private readonly ArtifactManifestData _data; + + /// Initializes a new instance of the class for mocking. + protected ArtifactManifestResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ArtifactManifestResource(ArmClient client, ArtifactManifestData 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 ArtifactManifestResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _artifactManifestClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string artifactManifestApiVersion); + _artifactManifestRestClient = new ArtifactManifestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, artifactManifestApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/artifactStores/artifactManifests"; + + /// 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 ArtifactManifestData 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)); + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Get"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Get"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Delete"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, 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; + } + } + + /// + /// Deletes the specified artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Delete"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Update + /// + /// + /// + /// Parameters supplied to the create or update artifact manifest operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Update"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Update + /// + /// + /// + /// Parameters supplied to the create or update artifact manifest operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.Update"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new ArtifactManifestResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List credential for publishing artifacts defined in artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential + /// + /// + /// Operation Id + /// ArtifactManifests_ListCredential + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetCredentialAsync(CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.GetCredential"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.ListCredentialAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List credential for publishing artifacts defined in artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/listCredential + /// + /// + /// Operation Id + /// ArtifactManifests_ListCredential + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetCredential(CancellationToken cancellationToken = default) + { + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.GetCredential"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.ListCredential(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update state for artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState + /// + /// + /// Operation Id + /// ArtifactManifests_UpdateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateStateAsync(WaitUntil waitUntil, ArtifactManifestUpdateState artifactManifestUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(artifactManifestUpdateState, nameof(artifactManifestUpdateState)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.UpdateState"); + scope.Start(); + try + { + var response = await _artifactManifestRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, artifactManifestUpdateState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ArtifactManifestUpdateStateOperationSource(), _artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, artifactManifestUpdateState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update state for artifact manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName}/updateState + /// + /// + /// Operation Id + /// ArtifactManifests_UpdateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateState(WaitUntil waitUntil, ArtifactManifestUpdateState artifactManifestUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(artifactManifestUpdateState, nameof(artifactManifestUpdateState)); + + using var scope = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.UpdateState"); + scope.Start(); + try + { + var response = _artifactManifestRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, artifactManifestUpdateState, cancellationToken); + var operation = new HybridNetworkArmOperation(new ArtifactManifestUpdateStateOperationSource(), _artifactManifestClientDiagnostics, Pipeline, _artifactManifestRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, artifactManifestUpdateState).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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 _artifactManifestRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_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 = _artifactManifestClientDiagnostics.CreateScope("ArtifactManifestResource.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 = _artifactManifestRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactManifestResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreCollection.cs new file mode 100644 index 0000000000000..c400693ef64c2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreCollection.cs @@ -0,0 +1,415 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// 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 GetArtifactStores method from an instance of . + /// + public partial class ArtifactStoreCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _artifactStoreClientDiagnostics; + private readonly ArtifactStoresRestOperations _artifactStoreRestClient; + + /// Initializes a new instance of the class for mocking. + protected ArtifactStoreCollection() + { + } + + /// 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 ArtifactStoreCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _artifactStoreClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ArtifactStoreResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ArtifactStoreResource.ResourceType, out string artifactStoreApiVersion); + _artifactStoreRestClient = new ArtifactStoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, artifactStoreApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PublisherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PublisherResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 artifactStoreName, ArtifactStoreData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ArtifactStoreOperationSource(Client), _artifactStoreClientDiagnostics, Pipeline, _artifactStoreRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 artifactStoreName, ArtifactStoreData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new ArtifactStoreOperationSource(Client), _artifactStoreClientDiagnostics, Pipeline, _artifactStoreRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.Get"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.Get"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information of the ArtifactStores under publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores + /// + /// + /// Operation Id + /// ArtifactStores_ListByPublisher + /// + /// + /// + /// 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) => _artifactStoreRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _artifactStoreRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArtifactStoreResource(Client, ArtifactStoreData.DeserializeArtifactStoreData(e)), _artifactStoreClientDiagnostics, Pipeline, "ArtifactStoreCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information of the ArtifactStores under publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores + /// + /// + /// Operation Id + /// ArtifactStores_ListByPublisher + /// + /// + /// + /// 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) => _artifactStoreRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _artifactStoreRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArtifactStoreResource(Client, ArtifactStoreData.DeserializeArtifactStoreData(e)), _artifactStoreClientDiagnostics, Pipeline, "ArtifactStoreCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.Exists"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.Exists"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreCollection.GetIfExists"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, artifactStoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreData.cs new file mode 100644 index 0000000000000..faae13817e197 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the ArtifactStore data model. + /// Artifact store properties. + /// + public partial class ArtifactStoreData : TrackedResourceData + { + /// Initializes a new instance of ArtifactStoreData. + /// The location. + public ArtifactStoreData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ArtifactStoreData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ArtifactStores properties. + internal ArtifactStoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ArtifactStorePropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// ArtifactStores properties. + public ArtifactStorePropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreResource.cs new file mode 100644 index 0000000000000..b2c4744a9a93a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ArtifactStoreResource.cs @@ -0,0 +1,845 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing an ArtifactStore 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 GetArtifactStoreResource method. + /// Otherwise you can get one from its parent resource using the GetArtifactStore method. + /// + public partial class ArtifactStoreResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publisherName. + /// The artifactStoreName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _artifactStoreClientDiagnostics; + private readonly ArtifactStoresRestOperations _artifactStoreRestClient; + private readonly ClientDiagnostics _proxyArtifactClientDiagnostics; + private readonly ProxyArtifactRestOperations _proxyArtifactRestClient; + private readonly ArtifactStoreData _data; + + /// Initializes a new instance of the class for mocking. + protected ArtifactStoreResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ArtifactStoreResource(ArmClient client, ArtifactStoreData 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 ArtifactStoreResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _artifactStoreClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string artifactStoreApiVersion); + _artifactStoreRestClient = new ArtifactStoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, artifactStoreApiVersion); + _proxyArtifactClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _proxyArtifactRestClient = new ProxyArtifactRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/artifactStores"; + + /// 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 ArtifactStoreData 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)); + } + + /// Gets a collection of ArtifactManifestResources in the ArtifactStore. + /// An object representing collection of ArtifactManifestResources and their operations over a ArtifactManifestResource. + public virtual ArtifactManifestCollection GetArtifactManifests() + { + return GetCachedClient(client => new ArtifactManifestCollection(client, Id)); + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArtifactManifestAsync(string artifactManifestName, CancellationToken cancellationToken = default) + { + return await GetArtifactManifests().GetAsync(artifactManifestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a artifact manifest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactManifests/{artifactManifestName} + /// + /// + /// Operation Id + /// ArtifactManifests_Get + /// + /// + /// + /// The name of the artifact manifest. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArtifactManifest(string artifactManifestName, CancellationToken cancellationToken = default) + { + return GetArtifactManifests().Get(artifactManifestName, cancellationToken); + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Get"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Get"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Delete"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_artifactStoreClientDiagnostics, Pipeline, _artifactStoreRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, 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; + } + } + + /// + /// Deletes the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Delete"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_artifactStoreClientDiagnostics, Pipeline, _artifactStoreRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update artifact store resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Update + /// + /// + /// + /// Parameters supplied to the create or update application group operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Update"); + scope.Start(); + try + { + var response = await _artifactStoreRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update artifact store resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Update + /// + /// + /// + /// Parameters supplied to the create or update application group operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.Update"); + scope.Start(); + try + { + var response = _artifactStoreRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new ArtifactStoreResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the available artifacts in the parent Artifact Store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts + /// + /// + /// Operation Id + /// ProxyArtifact_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProxyArtifactsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _proxyArtifactRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proxyArtifactRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProxyArtifactListOverview.DeserializeProxyArtifactListOverview, _proxyArtifactClientDiagnostics, Pipeline, "ArtifactStoreResource.GetProxyArtifacts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available artifacts in the parent Artifact Store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifacts + /// + /// + /// Operation Id + /// ProxyArtifact_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProxyArtifacts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _proxyArtifactRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proxyArtifactRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProxyArtifactListOverview.DeserializeProxyArtifactListOverview, _proxyArtifactClientDiagnostics, Pipeline, "ArtifactStoreResource.GetProxyArtifacts", "value", "nextLink", cancellationToken); + } + + /// + /// Get a Artifact overview information. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions + /// + /// + /// Operation Id + /// ProxyArtifact_Get + /// + /// + /// + /// The name of the artifact. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProxyArtifactsAsync(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _proxyArtifactRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proxyArtifactRestClient.CreateGetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview, _proxyArtifactClientDiagnostics, Pipeline, "ArtifactStoreResource.GetProxyArtifacts", "value", "nextLink", cancellationToken); + } + + /// + /// Get a Artifact overview information. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions + /// + /// + /// Operation Id + /// ProxyArtifact_Get + /// + /// + /// + /// The name of the artifact. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProxyArtifacts(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _proxyArtifactRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _proxyArtifactRestClient.CreateGetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview, _proxyArtifactClientDiagnostics, Pipeline, "ArtifactStoreResource.GetProxyArtifacts", "value", "nextLink", cancellationToken); + } + + /// + /// Change artifact state defined in artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName} + /// + /// + /// Operation Id + /// ProxyArtifact_UpdateState + /// + /// + /// + /// 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 artifact version. + /// The name of the artifact. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> UpdateStateProxyArtifactAsync(WaitUntil waitUntil, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactVersionName, nameof(artifactVersionName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + Argument.AssertNotNull(artifactChangeState, nameof(artifactChangeState)); + + using var scope = _proxyArtifactClientDiagnostics.CreateScope("ArtifactStoreResource.UpdateStateProxyArtifact"); + scope.Start(); + try + { + var response = await _proxyArtifactRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactVersionName, artifactName, artifactChangeState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ProxyArtifactVersionsListOverviewOperationSource(), _proxyArtifactClientDiagnostics, Pipeline, _proxyArtifactRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactVersionName, artifactName, artifactChangeState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Change artifact state defined in artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName}/artifactVersions/{artifactVersionName} + /// + /// + /// Operation Id + /// ProxyArtifact_UpdateState + /// + /// + /// + /// 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 artifact version. + /// The name of the artifact. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation UpdateStateProxyArtifact(WaitUntil waitUntil, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactVersionName, nameof(artifactVersionName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + Argument.AssertNotNull(artifactChangeState, nameof(artifactChangeState)); + + using var scope = _proxyArtifactClientDiagnostics.CreateScope("ArtifactStoreResource.UpdateStateProxyArtifact"); + scope.Start(); + try + { + var response = _proxyArtifactRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactVersionName, artifactName, artifactChangeState, cancellationToken); + var operation = new HybridNetworkArmOperation(new ProxyArtifactVersionsListOverviewOperationSource(), _proxyArtifactClientDiagnostics, Pipeline, _proxyArtifactRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactVersionName, artifactName, artifactChangeState).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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 _artifactStoreRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_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 = _artifactStoreClientDiagnostics.CreateScope("ArtifactStoreResource.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 = _artifactStoreRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ArtifactStoreResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentCollection.cs new file mode 100644 index 0000000000000..412dfbcfc4838 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentCollection.cs @@ -0,0 +1,333 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetComponents method from an instance of . + /// + public partial class ComponentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _componentClientDiagnostics; + private readonly ComponentsRestOperations _componentRestClient; + + /// Initializes a new instance of the class for mocking. + protected ComponentCollection() + { + } + + /// 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 ComponentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _componentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ComponentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ComponentResource.ResourceType, out string componentApiVersion); + _componentRestClient = new ComponentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, componentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetworkFunctionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetworkFunctionResource.ResourceType), nameof(id)); + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.Get"); + scope.Start(); + try + { + var response = await _componentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.Get"); + scope.Start(); + try + { + var response = _componentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the component resources in a network function. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components + /// + /// + /// Operation Id + /// Components_ListByNetworkFunction + /// + /// + /// + /// 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) => _componentRestClient.CreateListByNetworkFunctionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _componentRestClient.CreateListByNetworkFunctionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ComponentResource(Client, ComponentData.DeserializeComponentData(e)), _componentClientDiagnostics, Pipeline, "ComponentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the component resources in a network function. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components + /// + /// + /// Operation Id + /// Components_ListByNetworkFunction + /// + /// + /// + /// 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) => _componentRestClient.CreateListByNetworkFunctionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _componentRestClient.CreateListByNetworkFunctionNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ComponentResource(Client, ComponentData.DeserializeComponentData(e)), _componentClientDiagnostics, Pipeline, "ComponentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.Exists"); + scope.Start(); + try + { + var response = await _componentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, 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.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.Exists"); + scope.Start(); + try + { + var response = _componentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _componentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var scope = _componentClientDiagnostics.CreateScope("ComponentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _componentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, componentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentData.cs new file mode 100644 index 0000000000000..1719f91ec4edb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the Component data model. + /// The component sub resource. + /// + public partial class ComponentData : ResourceData + { + /// Initializes a new instance of ComponentData. + public ComponentData() + { + } + + /// Initializes a new instance of ComponentData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The component properties. + internal ComponentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ComponentProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// The component properties. + public ComponentProperties Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentResource.cs new file mode 100644 index 0000000000000..296fd813980b5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ComponentResource.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a Component along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetComponentResource method. + /// Otherwise you can get one from its parent resource using the GetComponent method. + /// + public partial class ComponentResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkFunctionName. + /// The componentName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFunctionName, string componentName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _componentClientDiagnostics; + private readonly ComponentsRestOperations _componentRestClient; + private readonly ComponentData _data; + + /// Initializes a new instance of the class for mocking. + protected ComponentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ComponentResource(ArmClient client, ComponentData 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 ComponentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _componentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string componentApiVersion); + _componentRestClient = new ComponentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, componentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/networkFunctions/components"; + + /// 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 ComponentData 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)); + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _componentClientDiagnostics.CreateScope("ComponentResource.Get"); + scope.Start(); + try + { + var response = await _componentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _componentClientDiagnostics.CreateScope("ComponentResource.Get"); + scope.Start(); + try + { + var response = _componentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ComponentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaCollection.cs new file mode 100644 index 0000000000000..7be8aac019de6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaCollection.cs @@ -0,0 +1,415 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetConfigurationGroupSchemas method from an instance of . + /// + public partial class ConfigurationGroupSchemaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _configurationGroupSchemaClientDiagnostics; + private readonly ConfigurationGroupSchemasRestOperations _configurationGroupSchemaRestClient; + + /// Initializes a new instance of the class for mocking. + protected ConfigurationGroupSchemaCollection() + { + } + + /// 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 ConfigurationGroupSchemaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _configurationGroupSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ConfigurationGroupSchemaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ConfigurationGroupSchemaResource.ResourceType, out string configurationGroupSchemaApiVersion); + _configurationGroupSchemaRestClient = new ConfigurationGroupSchemasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, configurationGroupSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PublisherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PublisherResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 configuration group schema. + /// Parameters supplied to the create or update configuration group schema resource. + /// 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 configurationGroupSchemaName, ConfigurationGroupSchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupSchemaOperationSource(Client), _configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 configuration group schema. + /// Parameters supplied to the create or update configuration group schema resource. + /// 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 configurationGroupSchemaName, ConfigurationGroupSchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupSchemaOperationSource(Client), _configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.Get"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.Get"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information of the configuration group schemas under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_ListByPublisher + /// + /// + /// + /// 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) => _configurationGroupSchemaRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationGroupSchemaRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupSchemaResource(Client, ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(e)), _configurationGroupSchemaClientDiagnostics, Pipeline, "ConfigurationGroupSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information of the configuration group schemas under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_ListByPublisher + /// + /// + /// + /// 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) => _configurationGroupSchemaRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationGroupSchemaRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupSchemaResource(Client, ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(e)), _configurationGroupSchemaClientDiagnostics, Pipeline, "ConfigurationGroupSchemaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.Exists"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.Exists"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configurationGroupSchemaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaData.cs new file mode 100644 index 0000000000000..2e2315f0db4cb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the ConfigurationGroupSchema data model. + /// Configuration group schema resource. + /// + public partial class ConfigurationGroupSchemaData : TrackedResourceData + { + /// Initializes a new instance of ConfigurationGroupSchemaData. + /// The location. + public ConfigurationGroupSchemaData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ConfigurationGroupSchemaData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Configuration group schema properties. + internal ConfigurationGroupSchemaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfigurationGroupSchemaPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Configuration group schema properties. + public ConfigurationGroupSchemaPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaResource.cs new file mode 100644 index 0000000000000..6e3d489b6a1d2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupSchemaResource.cs @@ -0,0 +1,681 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a ConfigurationGroupSchema along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetConfigurationGroupSchemaResource method. + /// Otherwise you can get one from its parent resource using the GetConfigurationGroupSchema method. + /// + public partial class ConfigurationGroupSchemaResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publisherName. + /// The configurationGroupSchemaName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _configurationGroupSchemaClientDiagnostics; + private readonly ConfigurationGroupSchemasRestOperations _configurationGroupSchemaRestClient; + private readonly ConfigurationGroupSchemaData _data; + + /// Initializes a new instance of the class for mocking. + protected ConfigurationGroupSchemaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ConfigurationGroupSchemaResource(ArmClient client, ConfigurationGroupSchemaData 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 ConfigurationGroupSchemaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _configurationGroupSchemaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string configurationGroupSchemaApiVersion); + _configurationGroupSchemaRestClient = new ConfigurationGroupSchemasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, configurationGroupSchemaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/configurationGroupSchemas"; + + /// 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 ConfigurationGroupSchemaData 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)); + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Get"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Get"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Delete"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, 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; + } + } + + /// + /// Deletes a specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Delete"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a configuration group schema resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Update + /// + /// + /// + /// Parameters supplied to the create or update network service design version operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Update"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a configuration group schema resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Update + /// + /// + /// + /// Parameters supplied to the create or update network service design version operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.Update"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update configuration group schema state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of configuration group schema. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateStateAsync(WaitUntil waitUntil, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(configurationGroupSchemaVersionUpdateState, nameof(configurationGroupSchemaVersionUpdateState)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.UpdateState"); + scope.Start(); + try + { + var response = await _configurationGroupSchemaRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, configurationGroupSchemaVersionUpdateState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupSchemaVersionUpdateStateOperationSource(), _configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, configurationGroupSchemaVersionUpdateState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update configuration group schema state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName}/updateState + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of configuration group schema. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateState(WaitUntil waitUntil, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(configurationGroupSchemaVersionUpdateState, nameof(configurationGroupSchemaVersionUpdateState)); + + using var scope = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.UpdateState"); + scope.Start(); + try + { + var response = _configurationGroupSchemaRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, configurationGroupSchemaVersionUpdateState, cancellationToken); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupSchemaVersionUpdateStateOperationSource(), _configurationGroupSchemaClientDiagnostics, Pipeline, _configurationGroupSchemaRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, configurationGroupSchemaVersionUpdateState).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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 _configurationGroupSchemaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_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 = _configurationGroupSchemaClientDiagnostics.CreateScope("ConfigurationGroupSchemaResource.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 = _configurationGroupSchemaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupSchemaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueCollection.cs new file mode 100644 index 0000000000000..d26a73bbd4e90 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueCollection.cs @@ -0,0 +1,416 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetConfigurationGroupValues method from an instance of . + /// + public partial class ConfigurationGroupValueCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _configurationGroupValueClientDiagnostics; + private readonly ConfigurationGroupValuesRestOperations _configurationGroupValueRestClient; + + /// Initializes a new instance of the class for mocking. + protected ConfigurationGroupValueCollection() + { + } + + /// 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 ConfigurationGroupValueCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _configurationGroupValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ConfigurationGroupValueResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ConfigurationGroupValueResource.ResourceType, out string configurationGroupValueApiVersion); + _configurationGroupValueRestClient = new ConfigurationGroupValuesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, configurationGroupValueApiVersion); +#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)); + } + + /// + /// Creates or updates a hybrid configuration group value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 configuration group value. + /// Parameters supplied to the create or update configuration group value resource. + /// 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 configurationGroupValueName, ConfigurationGroupValueData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupValueOperationSource(Client), _configurationGroupValueClientDiagnostics, Pipeline, _configurationGroupValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a hybrid configuration group value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 configuration group value. + /// Parameters supplied to the create or update configuration group value resource. + /// 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 configurationGroupValueName, ConfigurationGroupValueData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new ConfigurationGroupValueOperationSource(Client), _configurationGroupValueClientDiagnostics, Pipeline, _configurationGroupValueRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.Get"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.Get"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the hybrid network configurationGroupValues in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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) => _configurationGroupValueRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationGroupValueRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupValueResource(Client, ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(e)), _configurationGroupValueClientDiagnostics, Pipeline, "ConfigurationGroupValueCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the hybrid network configurationGroupValues in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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) => _configurationGroupValueRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _configurationGroupValueRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupValueResource(Client, ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(e)), _configurationGroupValueClientDiagnostics, Pipeline, "ConfigurationGroupValueCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.Exists"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.Exists"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueCollection.GetIfExists"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationGroupValueName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueData.cs new file mode 100644 index 0000000000000..a3b804a43be98 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the ConfigurationGroupValue data model. + /// Hybrid configuration group value resource. + /// + public partial class ConfigurationGroupValueData : TrackedResourceData + { + /// Initializes a new instance of ConfigurationGroupValueData. + /// The location. + public ConfigurationGroupValueData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ConfigurationGroupValueData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Hybrid configuration group value properties. + /// 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 . + /// + internal ConfigurationGroupValueData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfigurationGroupValuePropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// + /// Hybrid configuration group value properties. + /// 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 ConfigurationGroupValuePropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueResource.cs new file mode 100644 index 0000000000000..19bad089cf930 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ConfigurationGroupValueResource.cs @@ -0,0 +1,605 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a ConfigurationGroupValue along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetConfigurationGroupValueResource method. + /// Otherwise you can get one from its parent resource using the GetConfigurationGroupValue method. + /// + public partial class ConfigurationGroupValueResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The configurationGroupValueName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configurationGroupValueName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _configurationGroupValueClientDiagnostics; + private readonly ConfigurationGroupValuesRestOperations _configurationGroupValueRestClient; + private readonly ConfigurationGroupValueData _data; + + /// Initializes a new instance of the class for mocking. + protected ConfigurationGroupValueResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ConfigurationGroupValueResource(ArmClient client, ConfigurationGroupValueData 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 ConfigurationGroupValueResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _configurationGroupValueClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string configurationGroupValueApiVersion); + _configurationGroupValueRestClient = new ConfigurationGroupValuesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, configurationGroupValueApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/configurationGroupValues"; + + /// 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 ConfigurationGroupValueData 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)); + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Get"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Get"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified hybrid configuration group value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Delete"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_configurationGroupValueClientDiagnostics, Pipeline, _configurationGroupValueRestClient.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; + } + } + + /// + /// Deletes the specified hybrid configuration group value. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Delete"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_configurationGroupValueClientDiagnostics, Pipeline, _configurationGroupValueRestClient.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; + } + } + + /// + /// Updates a hybrid configuration group tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_UpdateTags + /// + /// + /// + /// Parameters supplied to update configuration group values tags. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Update"); + scope.Start(); + try + { + var response = await _configurationGroupValueRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a hybrid configuration group tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_UpdateTags + /// + /// + /// + /// Parameters supplied to update configuration group values tags. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.Update"); + scope.Start(); + try + { + var response = _configurationGroupValueRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new ConfigurationGroupValueResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 _configurationGroupValueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_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 = _configurationGroupValueClientDiagnostics.CreateScope("ConfigurationGroupValueResource.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 = _configurationGroupValueRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ConfigurationGroupValueResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/HybridNetworkExtensions.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/HybridNetworkExtensions.cs new file mode 100644 index 0000000000000..865c4862c5379 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/HybridNetworkExtensions.cs @@ -0,0 +1,845 @@ +// 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.HybridNetwork.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// A class to add extension methods to Azure.ResourceManager.HybridNetwork. + public static partial class HybridNetworkExtensions + { + private static MockableHybridNetworkArmClient GetMockableHybridNetworkArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableHybridNetworkArmClient(client0)); + } + + private static MockableHybridNetworkResourceGroupResource GetMockableHybridNetworkResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableHybridNetworkResourceGroupResource(client, resource.Id)); + } + + private static MockableHybridNetworkSubscriptionResource GetMockableHybridNetworkSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableHybridNetworkSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ConfigurationGroupSchemaResource GetConfigurationGroupSchemaResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetConfigurationGroupSchemaResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ConfigurationGroupValueResource GetConfigurationGroupValueResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetConfigurationGroupValueResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkFunctionResource GetNetworkFunctionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetNetworkFunctionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ComponentResource GetComponentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetComponentResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkFunctionDefinitionGroupResource GetNetworkFunctionDefinitionGroupResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetNetworkFunctionDefinitionGroupResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkFunctionDefinitionVersionResource GetNetworkFunctionDefinitionVersionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetNetworkFunctionDefinitionVersionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkServiceDesignGroupResource GetNetworkServiceDesignGroupResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetNetworkServiceDesignGroupResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static NetworkServiceDesignVersionResource GetNetworkServiceDesignVersionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetNetworkServiceDesignVersionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PublisherResource GetPublisherResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetPublisherResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ArtifactStoreResource GetArtifactStoreResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetArtifactStoreResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ArtifactManifestResource GetArtifactManifestResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetArtifactManifestResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SiteResource GetSiteResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetSiteResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SiteNetworkServiceResource GetSiteNetworkServiceResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableHybridNetworkArmClient(client).GetSiteNetworkServiceResource(id); + } + + /// + /// Gets a collection of ConfigurationGroupValueResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// An object representing collection of ConfigurationGroupValueResources and their operations over a ConfigurationGroupValueResource. + public static ConfigurationGroupValueCollection GetConfigurationGroupValues(this ResourceGroupResource resourceGroupResource) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetConfigurationGroupValues(); + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the configuration group value. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetConfigurationGroupValueAsync(this ResourceGroupResource resourceGroupResource, string configurationGroupValueName, CancellationToken cancellationToken = default) + { + return await GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetConfigurationGroupValueAsync(configurationGroupValueName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the configuration group value. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetConfigurationGroupValue(this ResourceGroupResource resourceGroupResource, string configurationGroupValueName, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetConfigurationGroupValue(configurationGroupValueName, cancellationToken); + } + + /// + /// Gets a collection of NetworkFunctionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// An object representing collection of NetworkFunctionResources and their operations over a NetworkFunctionResource. + public static NetworkFunctionCollection GetNetworkFunctions(this ResourceGroupResource resourceGroupResource) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetNetworkFunctions(); + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the network function resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetNetworkFunctionAsync(this ResourceGroupResource resourceGroupResource, string networkFunctionName, CancellationToken cancellationToken = default) + { + return await GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetNetworkFunctionAsync(networkFunctionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the network function resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetNetworkFunction(this ResourceGroupResource resourceGroupResource, string networkFunctionName, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetNetworkFunction(networkFunctionName, cancellationToken); + } + + /// + /// Gets a collection of PublisherResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// An object representing collection of PublisherResources and their operations over a PublisherResource. + public static PublisherCollection GetPublishers(this ResourceGroupResource resourceGroupResource) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetPublishers(); + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the publisher. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetPublisherAsync(this ResourceGroupResource resourceGroupResource, string publisherName, CancellationToken cancellationToken = default) + { + return await GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetPublisherAsync(publisherName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the publisher. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetPublisher(this ResourceGroupResource resourceGroupResource, string publisherName, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetPublisher(publisherName, cancellationToken); + } + + /// + /// Gets a collection of SiteResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// An object representing collection of SiteResources and their operations over a SiteResource. + public static SiteCollection GetSites(this ResourceGroupResource resourceGroupResource) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetSites(); + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the network service site. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSiteAsync(this ResourceGroupResource resourceGroupResource, string siteName, CancellationToken cancellationToken = default) + { + return await GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetSiteAsync(siteName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the network service site. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSite(this ResourceGroupResource resourceGroupResource, string siteName, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetSite(siteName, cancellationToken); + } + + /// + /// Gets a collection of SiteNetworkServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// An object representing collection of SiteNetworkServiceResources and their operations over a SiteNetworkServiceResource. + public static SiteNetworkServiceCollection GetSiteNetworkServices(this ResourceGroupResource resourceGroupResource) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetSiteNetworkServices(); + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the site network service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSiteNetworkServiceAsync(this ResourceGroupResource resourceGroupResource, string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + return await GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetSiteNetworkServiceAsync(siteNetworkServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the site network service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSiteNetworkService(this ResourceGroupResource resourceGroupResource, string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkResourceGroupResource(resourceGroupResource).GetSiteNetworkService(siteNetworkServiceName, cancellationToken); + } + + /// + /// Lists all sites in the configuration group value in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetConfigurationGroupValuesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetConfigurationGroupValuesAsync(cancellationToken); + } + + /// + /// Lists all sites in the configuration group value in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetConfigurationGroupValues(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetConfigurationGroupValues(cancellationToken); + } + + /// + /// Lists all the network functions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetNetworkFunctionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetNetworkFunctionsAsync(cancellationToken); + } + + /// + /// Lists all the network functions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetNetworkFunctions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetNetworkFunctions(cancellationToken); + } + + /// + /// Lists all the publishers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetPublishersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetPublishersAsync(cancellationToken); + } + + /// + /// Lists all the publishers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetPublishers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetPublishers(cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetSitesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetSitesAsync(cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetSites(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetSites(cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetSiteNetworkServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetSiteNetworkServicesAsync(cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListBySubscription + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// 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 GetSiteNetworkServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableHybridNetworkSubscriptionResource(subscriptionResource).GetSiteNetworkServices(cancellationToken); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkArmClient.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkArmClient.cs new file mode 100644 index 0000000000000..bfc8ee99ffee3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkArmClient.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableHybridNetworkArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHybridNetworkArmClient() + { + } + + /// 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 MockableHybridNetworkArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableHybridNetworkArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConfigurationGroupSchemaResource GetConfigurationGroupSchemaResource(ResourceIdentifier id) + { + ConfigurationGroupSchemaResource.ValidateResourceId(id); + return new ConfigurationGroupSchemaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConfigurationGroupValueResource GetConfigurationGroupValueResource(ResourceIdentifier id) + { + ConfigurationGroupValueResource.ValidateResourceId(id); + return new ConfigurationGroupValueResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFunctionResource GetNetworkFunctionResource(ResourceIdentifier id) + { + NetworkFunctionResource.ValidateResourceId(id); + return new NetworkFunctionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ComponentResource GetComponentResource(ResourceIdentifier id) + { + ComponentResource.ValidateResourceId(id); + return new ComponentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFunctionDefinitionGroupResource GetNetworkFunctionDefinitionGroupResource(ResourceIdentifier id) + { + NetworkFunctionDefinitionGroupResource.ValidateResourceId(id); + return new NetworkFunctionDefinitionGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFunctionDefinitionVersionResource GetNetworkFunctionDefinitionVersionResource(ResourceIdentifier id) + { + NetworkFunctionDefinitionVersionResource.ValidateResourceId(id); + return new NetworkFunctionDefinitionVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkServiceDesignGroupResource GetNetworkServiceDesignGroupResource(ResourceIdentifier id) + { + NetworkServiceDesignGroupResource.ValidateResourceId(id); + return new NetworkServiceDesignGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkServiceDesignVersionResource GetNetworkServiceDesignVersionResource(ResourceIdentifier id) + { + NetworkServiceDesignVersionResource.ValidateResourceId(id); + return new NetworkServiceDesignVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PublisherResource GetPublisherResource(ResourceIdentifier id) + { + PublisherResource.ValidateResourceId(id); + return new PublisherResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ArtifactStoreResource GetArtifactStoreResource(ResourceIdentifier id) + { + ArtifactStoreResource.ValidateResourceId(id); + return new ArtifactStoreResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ArtifactManifestResource GetArtifactManifestResource(ResourceIdentifier id) + { + ArtifactManifestResource.ValidateResourceId(id); + return new ArtifactManifestResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteResource GetSiteResource(ResourceIdentifier id) + { + SiteResource.ValidateResourceId(id); + return new SiteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteNetworkServiceResource GetSiteNetworkServiceResource(ResourceIdentifier id) + { + SiteNetworkServiceResource.ValidateResourceId(id); + return new SiteNetworkServiceResource(Client, id); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkResourceGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkResourceGroupResource.cs new file mode 100644 index 0000000000000..f24776ea23e52 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkResourceGroupResource.cs @@ -0,0 +1,304 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableHybridNetworkResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableHybridNetworkResourceGroupResource() + { + } + + /// 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 MockableHybridNetworkResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ConfigurationGroupValueResources in the ResourceGroupResource. + /// An object representing collection of ConfigurationGroupValueResources and their operations over a ConfigurationGroupValueResource. + public virtual ConfigurationGroupValueCollection GetConfigurationGroupValues() + { + return GetCachedClient(client => new ConfigurationGroupValueCollection(client, Id)); + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetConfigurationGroupValueAsync(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + return await GetConfigurationGroupValues().GetAsync(configurationGroupValueName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified hybrid configuration group values. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/configurationGroupValues/{configurationGroupValueName} + /// + /// + /// Operation Id + /// ConfigurationGroupValues_Get + /// + /// + /// + /// The name of the configuration group value. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetConfigurationGroupValue(string configurationGroupValueName, CancellationToken cancellationToken = default) + { + return GetConfigurationGroupValues().Get(configurationGroupValueName, cancellationToken); + } + + /// Gets a collection of NetworkFunctionResources in the ResourceGroupResource. + /// An object representing collection of NetworkFunctionResources and their operations over a NetworkFunctionResource. + public virtual NetworkFunctionCollection GetNetworkFunctions() + { + return GetCachedClient(client => new NetworkFunctionCollection(client, Id)); + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFunctionAsync(string networkFunctionName, CancellationToken cancellationToken = default) + { + return await GetNetworkFunctions().GetAsync(networkFunctionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFunction(string networkFunctionName, CancellationToken cancellationToken = default) + { + return GetNetworkFunctions().Get(networkFunctionName, cancellationToken); + } + + /// Gets a collection of PublisherResources in the ResourceGroupResource. + /// An object representing collection of PublisherResources and their operations over a PublisherResource. + public virtual PublisherCollection GetPublishers() + { + return GetCachedClient(client => new PublisherCollection(client, Id)); + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPublisherAsync(string publisherName, CancellationToken cancellationToken = default) + { + return await GetPublishers().GetAsync(publisherName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPublisher(string publisherName, CancellationToken cancellationToken = default) + { + return GetPublishers().Get(publisherName, cancellationToken); + } + + /// Gets a collection of SiteResources in the ResourceGroupResource. + /// An object representing collection of SiteResources and their operations over a SiteResource. + public virtual SiteCollection GetSites() + { + return GetCachedClient(client => new SiteCollection(client, Id)); + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteAsync(string siteName, CancellationToken cancellationToken = default) + { + return await GetSites().GetAsync(siteName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSite(string siteName, CancellationToken cancellationToken = default) + { + return GetSites().Get(siteName, cancellationToken); + } + + /// Gets a collection of SiteNetworkServiceResources in the ResourceGroupResource. + /// An object representing collection of SiteNetworkServiceResources and their operations over a SiteNetworkServiceResource. + public virtual SiteNetworkServiceCollection GetSiteNetworkServices() + { + return GetCachedClient(client => new SiteNetworkServiceCollection(client, Id)); + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteNetworkServiceAsync(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + return await GetSiteNetworkServices().GetAsync(siteNetworkServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSiteNetworkService(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + return GetSiteNetworkServices().Get(siteNetworkServiceName, cancellationToken); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkSubscriptionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkSubscriptionResource.cs new file mode 100644 index 0000000000000..ebe15ad7e3dfb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Extensions/MockableHybridNetworkSubscriptionResource.cs @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableHybridNetworkSubscriptionResource : ArmResource + { + private ClientDiagnostics _configurationGroupValueClientDiagnostics; + private ConfigurationGroupValuesRestOperations _configurationGroupValueRestClient; + private ClientDiagnostics _networkFunctionClientDiagnostics; + private NetworkFunctionsRestOperations _networkFunctionRestClient; + private ClientDiagnostics _publisherClientDiagnostics; + private PublishersRestOperations _publisherRestClient; + private ClientDiagnostics _siteClientDiagnostics; + private SitesRestOperations _siteRestClient; + private ClientDiagnostics _siteNetworkServiceClientDiagnostics; + private SiteNetworkServicesRestOperations _siteNetworkServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableHybridNetworkSubscriptionResource() + { + } + + /// 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 MockableHybridNetworkSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ConfigurationGroupValueClientDiagnostics => _configurationGroupValueClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ConfigurationGroupValueResource.ResourceType.Namespace, Diagnostics); + private ConfigurationGroupValuesRestOperations ConfigurationGroupValueRestClient => _configurationGroupValueRestClient ??= new ConfigurationGroupValuesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConfigurationGroupValueResource.ResourceType)); + private ClientDiagnostics NetworkFunctionClientDiagnostics => _networkFunctionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkFunctionResource.ResourceType.Namespace, Diagnostics); + private NetworkFunctionsRestOperations NetworkFunctionRestClient => _networkFunctionRestClient ??= new NetworkFunctionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFunctionResource.ResourceType)); + private ClientDiagnostics PublisherClientDiagnostics => _publisherClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", PublisherResource.ResourceType.Namespace, Diagnostics); + private PublishersRestOperations PublisherRestClient => _publisherRestClient ??= new PublishersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PublisherResource.ResourceType)); + private ClientDiagnostics SiteClientDiagnostics => _siteClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", SiteResource.ResourceType.Namespace, Diagnostics); + private SitesRestOperations SiteRestClient => _siteRestClient ??= new SitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteResource.ResourceType)); + private ClientDiagnostics SiteNetworkServiceClientDiagnostics => _siteNetworkServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", SiteNetworkServiceResource.ResourceType.Namespace, Diagnostics); + private SiteNetworkServicesRestOperations SiteNetworkServiceRestClient => _siteNetworkServiceRestClient ??= new SiteNetworkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteNetworkServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all sites in the configuration group value in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationGroupValuesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationGroupValueRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationGroupValueRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupValueResource(Client, ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(e)), ConfigurationGroupValueClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetConfigurationGroupValues", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the configuration group value in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/configurationGroupValues + /// + /// + /// Operation Id + /// ConfigurationGroupValues_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurationGroupValues(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationGroupValueRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationGroupValueRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfigurationGroupValueResource(Client, ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(e)), ConfigurationGroupValueClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetConfigurationGroupValues", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the network functions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFunctionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFunctionRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFunctionRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionResource(Client, NetworkFunctionData.DeserializeNetworkFunctionData(e)), NetworkFunctionClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetNetworkFunctions", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the network functions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFunctions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFunctionRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFunctionRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionResource(Client, NetworkFunctionData.DeserializeNetworkFunctionData(e)), NetworkFunctionClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetNetworkFunctions", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the publishers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPublishersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublisherRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublisherRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), PublisherClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetPublishers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the publishers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPublishers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublisherRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublisherRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), PublisherClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetPublishers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSitesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteResource(Client, SiteData.DeserializeSiteData(e)), SiteClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetSites", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSites(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteResource(Client, SiteData.DeserializeSiteData(e)), SiteClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetSites", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSiteNetworkServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteNetworkServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteNetworkServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteNetworkServiceResource(Client, SiteNetworkServiceData.DeserializeSiteNetworkServiceData(e)), SiteNetworkServiceClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetSiteNetworkServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSiteNetworkServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteNetworkServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteNetworkServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteNetworkServiceResource(Client, SiteNetworkServiceData.DeserializeSiteNetworkServiceData(e)), SiteNetworkServiceClientDiagnostics, Pipeline, "MockableHybridNetworkSubscriptionResource.GetSiteNetworkServices", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestOperationSource.cs new file mode 100644 index 0000000000000..e64c6280660e6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestOperationSource.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.HybridNetwork +{ + internal class ArtifactManifestOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ArtifactManifestOperationSource(ArmClient client) + { + _client = client; + } + + ArtifactManifestResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return new ArtifactManifestResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return new ArtifactManifestResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestUpdateStateOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestUpdateStateOperationSource.cs new file mode 100644 index 0000000000000..f3d5c9d3e5468 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactManifestUpdateStateOperationSource.cs @@ -0,0 +1,31 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ArtifactManifestUpdateStateOperationSource : IOperationSource + { + ArtifactManifestUpdateState IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ArtifactManifestUpdateState.DeserializeArtifactManifestUpdateState(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ArtifactManifestUpdateState.DeserializeArtifactManifestUpdateState(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactStoreOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactStoreOperationSource.cs new file mode 100644 index 0000000000000..047992f4dbc3b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ArtifactStoreOperationSource.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.HybridNetwork +{ + internal class ArtifactStoreOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ArtifactStoreOperationSource(ArmClient client) + { + _client = client; + } + + ArtifactStoreResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return new ArtifactStoreResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return new ArtifactStoreResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaOperationSource.cs new file mode 100644 index 0000000000000..dbdfe706a43dd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaOperationSource.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.HybridNetwork +{ + internal class ConfigurationGroupSchemaOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ConfigurationGroupSchemaOperationSource(ArmClient client) + { + _client = client; + } + + ConfigurationGroupSchemaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return new ConfigurationGroupSchemaResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return new ConfigurationGroupSchemaResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaVersionUpdateStateOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaVersionUpdateStateOperationSource.cs new file mode 100644 index 0000000000000..ae88fd24df18d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupSchemaVersionUpdateStateOperationSource.cs @@ -0,0 +1,31 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ConfigurationGroupSchemaVersionUpdateStateOperationSource : IOperationSource + { + ConfigurationGroupSchemaVersionUpdateState IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ConfigurationGroupSchemaVersionUpdateState.DeserializeConfigurationGroupSchemaVersionUpdateState(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ConfigurationGroupSchemaVersionUpdateState.DeserializeConfigurationGroupSchemaVersionUpdateState(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupValueOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupValueOperationSource.cs new file mode 100644 index 0000000000000..eeeb1d7bf2df0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ConfigurationGroupValueOperationSource.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.HybridNetwork +{ + internal class ConfigurationGroupValueOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ConfigurationGroupValueOperationSource(ArmClient client) + { + _client = client; + } + + ConfigurationGroupValueResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return new ConfigurationGroupValueResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return new ConfigurationGroupValueResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperation.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperation.cs new file mode 100644 index 0000000000000..bfe340a9d6bad --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperation.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.HybridNetwork +{ +#pragma warning disable SA1649 // File name should match first type name + internal class HybridNetworkArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of HybridNetworkArmOperation for mocking. + protected HybridNetworkArmOperation() + { + } + + internal HybridNetworkArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response); + } + + internal HybridNetworkArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "HybridNetworkArmOperation", 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperationOfT.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperationOfT.cs new file mode 100644 index 0000000000000..cde1354b2a6ba --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/HybridNetworkArmOperationOfT.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.HybridNetwork +{ +#pragma warning disable SA1649 // File name should match first type name + internal class HybridNetworkArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of HybridNetworkArmOperation for mocking. + protected HybridNetworkArmOperation() + { + } + + internal HybridNetworkArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + } + + internal HybridNetworkArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "HybridNetworkArmOperation", 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionGroupOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionGroupOperationSource.cs new file mode 100644 index 0000000000000..90ef9146a9215 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionGroupOperationSource.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.HybridNetwork +{ + internal class NetworkFunctionDefinitionGroupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkFunctionDefinitionGroupOperationSource(ArmClient client) + { + _client = client; + } + + NetworkFunctionDefinitionGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return new NetworkFunctionDefinitionGroupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return new NetworkFunctionDefinitionGroupResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionOperationSource.cs new file mode 100644 index 0000000000000..08682e389ea53 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionOperationSource.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.HybridNetwork +{ + internal class NetworkFunctionDefinitionVersionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkFunctionDefinitionVersionOperationSource(ArmClient client) + { + _client = client; + } + + NetworkFunctionDefinitionVersionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return new NetworkFunctionDefinitionVersionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return new NetworkFunctionDefinitionVersionResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionUpdateStateOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionUpdateStateOperationSource.cs new file mode 100644 index 0000000000000..019dae6813d86 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionDefinitionVersionUpdateStateOperationSource.cs @@ -0,0 +1,31 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkFunctionDefinitionVersionUpdateStateOperationSource : IOperationSource + { + NetworkFunctionDefinitionVersionUpdateState IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return NetworkFunctionDefinitionVersionUpdateState.DeserializeNetworkFunctionDefinitionVersionUpdateState(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return NetworkFunctionDefinitionVersionUpdateState.DeserializeNetworkFunctionDefinitionVersionUpdateState(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionOperationSource.cs new file mode 100644 index 0000000000000..3c5c93a4f7045 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkFunctionOperationSource.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.HybridNetwork +{ + internal class NetworkFunctionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkFunctionOperationSource(ArmClient client) + { + _client = client; + } + + NetworkFunctionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return new NetworkFunctionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return new NetworkFunctionResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignGroupOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignGroupOperationSource.cs new file mode 100644 index 0000000000000..0c803a5502a16 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignGroupOperationSource.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.HybridNetwork +{ + internal class NetworkServiceDesignGroupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkServiceDesignGroupOperationSource(ArmClient client) + { + _client = client; + } + + NetworkServiceDesignGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return new NetworkServiceDesignGroupResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return new NetworkServiceDesignGroupResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionOperationSource.cs new file mode 100644 index 0000000000000..2e3245dcdcb57 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionOperationSource.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.HybridNetwork +{ + internal class NetworkServiceDesignVersionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkServiceDesignVersionOperationSource(ArmClient client) + { + _client = client; + } + + NetworkServiceDesignVersionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return new NetworkServiceDesignVersionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return new NetworkServiceDesignVersionResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionUpdateStateOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionUpdateStateOperationSource.cs new file mode 100644 index 0000000000000..fc88d9b8ce859 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/NetworkServiceDesignVersionUpdateStateOperationSource.cs @@ -0,0 +1,31 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class NetworkServiceDesignVersionUpdateStateOperationSource : IOperationSource + { + NetworkServiceDesignVersionUpdateState IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return NetworkServiceDesignVersionUpdateState.DeserializeNetworkServiceDesignVersionUpdateState(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return NetworkServiceDesignVersionUpdateState.DeserializeNetworkServiceDesignVersionUpdateState(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ProxyArtifactVersionsListOverviewOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ProxyArtifactVersionsListOverviewOperationSource.cs new file mode 100644 index 0000000000000..e88107bc7eda2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/ProxyArtifactVersionsListOverviewOperationSource.cs @@ -0,0 +1,31 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal class ProxyArtifactVersionsListOverviewOperationSource : IOperationSource + { + ProxyArtifactVersionsListOverview IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview(document.RootElement); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/PublisherOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/PublisherOperationSource.cs new file mode 100644 index 0000000000000..ff93e7b242eb8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/PublisherOperationSource.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.HybridNetwork +{ + internal class PublisherOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal PublisherOperationSource(ArmClient client) + { + _client = client; + } + + PublisherResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = PublisherData.DeserializePublisherData(document.RootElement); + return new PublisherResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = PublisherData.DeserializePublisherData(document.RootElement); + return new PublisherResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteNetworkServiceOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteNetworkServiceOperationSource.cs new file mode 100644 index 0000000000000..e81b9fa046179 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteNetworkServiceOperationSource.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.HybridNetwork +{ + internal class SiteNetworkServiceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SiteNetworkServiceOperationSource(ArmClient client) + { + _client = client; + } + + SiteNetworkServiceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return new SiteNetworkServiceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return new SiteNetworkServiceResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteOperationSource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteOperationSource.cs new file mode 100644 index 0000000000000..cb48cc1567642 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/LongRunningOperation/SiteOperationSource.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.HybridNetwork +{ + internal class SiteOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SiteOperationSource(ArmClient client) + { + _client = client; + } + + SiteResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SiteData.DeserializeSiteData(document.RootElement); + return new SiteResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SiteData.DeserializeSiteData(document.RootElement); + return new SiteResource(_client, data); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ApplicationEnablement.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ApplicationEnablement.cs new file mode 100644 index 0000000000000..f4af6d6f66383 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ApplicationEnablement.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The application enablement. + public readonly partial struct ApplicationEnablement : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ApplicationEnablement(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Unknown. + public static ApplicationEnablement Unknown { get; } = new ApplicationEnablement(UnknownValue); + /// Enabled. + public static ApplicationEnablement Enabled { get; } = new ApplicationEnablement(EnabledValue); + /// Disabled. + public static ApplicationEnablement Disabled { get; } = new ApplicationEnablement(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(ApplicationEnablement left, ApplicationEnablement right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ApplicationEnablement left, ApplicationEnablement right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ApplicationEnablement(string value) => new ApplicationEnablement(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ApplicationEnablement other && Equals(other); + /// + public bool Equals(ApplicationEnablement 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.Serialization.cs new file mode 100644 index 0000000000000..e0c848778c907 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArmResourceDefinitionResourceElementTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateType)) + { + writer.WritePropertyName("templateType"u8); + writer.WriteStringValue(TemplateType.Value.ToString()); + } + if (Optional.IsDefined(ParameterValues)) + { + writer.WritePropertyName("parameterValues"u8); + writer.WriteStringValue(ParameterValues); + } + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + writer.WriteEndObject(); + } + + internal static ArmResourceDefinitionResourceElementTemplate DeserializeArmResourceDefinitionResourceElementTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateType = default; + Optional parameterValues = default; + Optional artifactProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateType = new TemplateType(property.Value.GetString()); + continue; + } + if (property.NameEquals("parameterValues"u8)) + { + parameterValues = property.Value.GetString(); + continue; + } + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = NSDArtifactProfile.DeserializeNSDArtifactProfile(property.Value); + continue; + } + } + return new ArmResourceDefinitionResourceElementTemplate(Optional.ToNullable(templateType), parameterValues.Value, artifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.cs new file mode 100644 index 0000000000000..6599e1269f21b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplate.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The arm template RE. + public partial class ArmResourceDefinitionResourceElementTemplate + { + /// Initializes a new instance of ArmResourceDefinitionResourceElementTemplate. + public ArmResourceDefinitionResourceElementTemplate() + { + } + + /// Initializes a new instance of ArmResourceDefinitionResourceElementTemplate. + /// The template type. + /// Name and value pairs that define the parameter values. It can be a well formed escaped JSON string. + /// Artifact profile properties. + internal ArmResourceDefinitionResourceElementTemplate(TemplateType? templateType, string parameterValues, NSDArtifactProfile artifactProfile) + { + TemplateType = templateType; + ParameterValues = parameterValues; + ArtifactProfile = artifactProfile; + } + + /// The template type. + public TemplateType? TemplateType { get; set; } + /// Name and value pairs that define the parameter values. It can be a well formed escaped JSON string. + public string ParameterValues { get; set; } + /// Artifact profile properties. + public NSDArtifactProfile ArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.Serialization.cs new file mode 100644 index 0000000000000..eb5b5261b74ab --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArmResourceDefinitionResourceElementTemplateDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Configuration)) + { + writer.WritePropertyName("configuration"u8); + writer.WriteObjectValue(Configuration); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceElementType.ToString()); + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static ArmResourceDefinitionResourceElementTemplateDetails DeserializeArmResourceDefinitionResourceElementTemplateDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional configuration = default; + Optional name = default; + Type type = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = ArmResourceDefinitionResourceElementTemplate.DeserializeArmResourceDefinitionResourceElementTemplate(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new Type(property.Value.GetString()); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new ArmResourceDefinitionResourceElementTemplateDetails(name.Value, type, dependsOnProfile.Value, configuration.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.cs new file mode 100644 index 0000000000000..8b68707e5642b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmResourceDefinitionResourceElementTemplateDetails.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The arm resource definition resource element template details. + public partial class ArmResourceDefinitionResourceElementTemplateDetails : ResourceElementTemplate + { + /// Initializes a new instance of ArmResourceDefinitionResourceElementTemplateDetails. + public ArmResourceDefinitionResourceElementTemplateDetails() + { + ResourceElementType = Type.ArmResourceDefinition; + } + + /// Initializes a new instance of ArmResourceDefinitionResourceElementTemplateDetails. + /// Name of the resource element template. + /// The resource element template type. + /// The depends on profile. + /// The resource element template type. + internal ArmResourceDefinitionResourceElementTemplateDetails(string name, Type resourceElementType, DependsOnProfile dependsOnProfile, ArmResourceDefinitionResourceElementTemplate configuration) : base(name, resourceElementType, dependsOnProfile) + { + Configuration = configuration; + ResourceElementType = resourceElementType; + } + + /// The resource element template type. + public ArmResourceDefinitionResourceElementTemplate Configuration { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..1f0bf26b5a5e9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArmTemplateArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateName)) + { + writer.WritePropertyName("templateName"u8); + writer.WriteStringValue(TemplateName); + } + if (Optional.IsDefined(TemplateVersion)) + { + writer.WritePropertyName("templateVersion"u8); + writer.WriteStringValue(TemplateVersion); + } + writer.WriteEndObject(); + } + + internal static ArmTemplateArtifactProfile DeserializeArmTemplateArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateName = default; + Optional templateVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateName"u8)) + { + templateName = property.Value.GetString(); + continue; + } + if (property.NameEquals("templateVersion"u8)) + { + templateVersion = property.Value.GetString(); + continue; + } + } + return new ArmTemplateArtifactProfile(templateName.Value, templateVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.cs new file mode 100644 index 0000000000000..7cc65f2051bef --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateArtifactProfile.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Template artifact profile. + public partial class ArmTemplateArtifactProfile + { + /// Initializes a new instance of ArmTemplateArtifactProfile. + public ArmTemplateArtifactProfile() + { + } + + /// Initializes a new instance of ArmTemplateArtifactProfile. + /// Template name. + /// Template version. + internal ArmTemplateArtifactProfile(string templateName, string templateVersion) + { + TemplateName = templateName; + TemplateVersion = templateVersion; + } + + /// Template name. + public string TemplateName { get; set; } + /// Template version. + public string TemplateVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..d28e6e08e21cc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ArmTemplateMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateParameters)) + { + writer.WritePropertyName("templateParameters"u8); + writer.WriteStringValue(TemplateParameters); + } + writer.WriteEndObject(); + } + + internal static ArmTemplateMappingRuleProfile DeserializeArmTemplateMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateParameters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateParameters"u8)) + { + templateParameters = property.Value.GetString(); + continue; + } + } + return new ArmTemplateMappingRuleProfile(templateParameters.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.cs new file mode 100644 index 0000000000000..c92e8da2a0b8d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArmTemplateMappingRuleProfile.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Template mapping rule profile. + internal partial class ArmTemplateMappingRuleProfile + { + /// Initializes a new instance of ArmTemplateMappingRuleProfile. + public ArmTemplateMappingRuleProfile() + { + } + + /// Initializes a new instance of ArmTemplateMappingRuleProfile. + /// List of template parameters. + internal ArmTemplateMappingRuleProfile(string templateParameters) + { + TemplateParameters = templateParameters; + } + + /// List of template parameters. + public string TemplateParameters { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.Serialization.cs new file mode 100644 index 0000000000000..5397cca59afbf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactAccessCredential + { + internal static ArtifactAccessCredential DeserializeArtifactAccessCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("credentialType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureContainerRegistryScopedToken": return AzureContainerRegistryScopedTokenCredential.DeserializeAzureContainerRegistryScopedTokenCredential(element); + case "AzureStorageAccountToken": return AzureStorageAccountCredential.DeserializeAzureStorageAccountCredential(element); + } + } + return UnknownArtifactAccessCredential.DeserializeUnknownArtifactAccessCredential(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.cs new file mode 100644 index 0000000000000..826b9637e2cf5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactAccessCredential.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// The artifact manifest credential definition. + /// 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 ArtifactAccessCredential + { + /// Initializes a new instance of ArtifactAccessCredential. + protected ArtifactAccessCredential() + { + } + + /// Initializes a new instance of ArtifactAccessCredential. + /// The credential type. + internal ArtifactAccessCredential(CredentialType credentialType) + { + CredentialType = credentialType; + } + + /// The credential type. + internal CredentialType CredentialType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.Serialization.cs new file mode 100644 index 0000000000000..0c085bee928ad --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactChangeState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.cs new file mode 100644 index 0000000000000..dce6f7c045b97 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeState.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact updating request payload. + public partial class ArtifactChangeState + { + /// Initializes a new instance of ArtifactChangeState. + public ArtifactChangeState() + { + } + + /// Artifact update state properties. + internal ArtifactChangeStateProperties Properties { get; set; } + /// The artifact state. + public ArtifactState? ArtifactState + { + get => Properties is null ? default : Properties.ArtifactState; + set + { + if (Properties is null) + Properties = new ArtifactChangeStateProperties(); + Properties.ArtifactState = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.Serialization.cs new file mode 100644 index 0000000000000..fdb7786138440 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ArtifactChangeStateProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactState)) + { + writer.WritePropertyName("artifactState"u8); + writer.WriteStringValue(ArtifactState.Value.ToString()); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.cs new file mode 100644 index 0000000000000..8944da1804b75 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactChangeStateProperties.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact update state properties. + internal partial class ArtifactChangeStateProperties + { + /// Initializes a new instance of ArtifactChangeStateProperties. + public ArtifactChangeStateProperties() + { + } + + /// The artifact state. + public ArtifactState? ArtifactState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestData.Serialization.cs new file mode 100644 index 0000000000000..e0bc39084a9b3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ArtifactManifestData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static ArtifactManifestData DeserializeArtifactManifestData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ArtifactManifestPropertiesFormat.DeserializeArtifactManifestPropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new ArtifactManifestData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.Serialization.cs new file mode 100644 index 0000000000000..7dc541de7e092 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ArtifactManifestListResult + { + internal static ArtifactManifestListResult DeserializeArtifactManifestListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArtifactManifestData.DeserializeArtifactManifestData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ArtifactManifestListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.cs new file mode 100644 index 0000000000000..4898dda5a037a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of artifact manifests. + internal partial class ArtifactManifestListResult + { + /// Initializes a new instance of ArtifactManifestListResult. + internal ArtifactManifestListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ArtifactManifestListResult. + /// A list of artifact manifests. + /// The URI to get the next set of results. + internal ArtifactManifestListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of artifact manifests. + public IReadOnlyList Value { get; } + /// The URI to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..a60535112c183 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.Serialization.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactManifestPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Artifacts)) + { + writer.WritePropertyName("artifacts"u8); + writer.WriteStartArray(); + foreach (var item in Artifacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ArtifactManifestPropertiesFormat DeserializeArtifactManifestPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional artifactManifestState = default; + Optional> artifacts = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("artifactManifestState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactManifestState = new ArtifactManifestState(property.Value.GetString()); + continue; + } + if (property.NameEquals("artifacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManifestArtifactFormat.DeserializeManifestArtifactFormat(item)); + } + artifacts = array; + continue; + } + } + return new ArtifactManifestPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(artifactManifestState), Optional.ToList(artifacts)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.cs new file mode 100644 index 0000000000000..9896e761f62aa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestPropertiesFormat.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Artifact manifest properties. + public partial class ArtifactManifestPropertiesFormat + { + /// Initializes a new instance of ArtifactManifestPropertiesFormat. + public ArtifactManifestPropertiesFormat() + { + Artifacts = new ChangeTrackingList(); + } + + /// Initializes a new instance of ArtifactManifestPropertiesFormat. + /// The provisioning state of the ArtifactManifest resource. + /// The artifact manifest state. + /// The artifacts list. + internal ArtifactManifestPropertiesFormat(ProvisioningState? provisioningState, ArtifactManifestState? artifactManifestState, IList artifacts) + { + ProvisioningState = provisioningState; + ArtifactManifestState = artifactManifestState; + Artifacts = artifacts; + } + + /// The provisioning state of the ArtifactManifest resource. + public ProvisioningState? ProvisioningState { get; } + /// The artifact manifest state. + public ArtifactManifestState? ArtifactManifestState { get; } + /// The artifacts list. + public IList Artifacts { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestState.cs new file mode 100644 index 0000000000000..0e0caced327f1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestState.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.HybridNetwork.Models +{ + /// The artifact manifest state. + public readonly partial struct ArtifactManifestState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactManifestState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string UploadingValue = "Uploading"; + private const string UploadedValue = "Uploaded"; + private const string ValidatingValue = "Validating"; + private const string ValidationFailedValue = "ValidationFailed"; + private const string SucceededValue = "Succeeded"; + + /// Unknown. + public static ArtifactManifestState Unknown { get; } = new ArtifactManifestState(UnknownValue); + /// Uploading. + public static ArtifactManifestState Uploading { get; } = new ArtifactManifestState(UploadingValue); + /// Uploaded. + public static ArtifactManifestState Uploaded { get; } = new ArtifactManifestState(UploadedValue); + /// Validating. + public static ArtifactManifestState Validating { get; } = new ArtifactManifestState(ValidatingValue); + /// ValidationFailed. + public static ArtifactManifestState ValidationFailed { get; } = new ArtifactManifestState(ValidationFailedValue); + /// Succeeded. + public static ArtifactManifestState Succeeded { get; } = new ArtifactManifestState(SucceededValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactManifestState left, ArtifactManifestState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactManifestState left, ArtifactManifestState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactManifestState(string value) => new ArtifactManifestState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactManifestState other && Equals(other); + /// + public bool Equals(ArtifactManifestState 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.Serialization.cs new file mode 100644 index 0000000000000..5f42908415ad9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactManifestUpdateState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactManifestState)) + { + writer.WritePropertyName("artifactManifestState"u8); + writer.WriteStringValue(ArtifactManifestState.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ArtifactManifestUpdateState DeserializeArtifactManifestUpdateState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactManifestState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactManifestState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactManifestState = new ArtifactManifestState(property.Value.GetString()); + continue; + } + } + return new ArtifactManifestUpdateState(Optional.ToNullable(artifactManifestState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.cs new file mode 100644 index 0000000000000..e0418df9d0967 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactManifestUpdateState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact manifest updating request payload. Only the 'Uploaded' state is allowed for updates. Other states are used for internal state transitioning. + public partial class ArtifactManifestUpdateState + { + /// Initializes a new instance of ArtifactManifestUpdateState. + public ArtifactManifestUpdateState() + { + } + + /// Initializes a new instance of ArtifactManifestUpdateState. + /// The artifact manifest state. + internal ArtifactManifestUpdateState(ArtifactManifestState? artifactManifestState) + { + ArtifactManifestState = artifactManifestState; + } + + /// The artifact manifest state. + public ArtifactManifestState? ArtifactManifestState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..d9f77f8a55032 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static ArtifactProfile DeserializeArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ArtifactProfile(artifactStore); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.cs new file mode 100644 index 0000000000000..d5965975ae6a4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactProfile.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Artifact profile properties. + public partial class ArtifactProfile + { + /// Initializes a new instance of ArtifactProfile. + public ArtifactProfile() + { + } + + /// Initializes a new instance of ArtifactProfile. + /// The reference to artifact store. + internal ArtifactProfile(WritableSubResource artifactStore) + { + ArtifactStore = artifactStore; + } + + /// The reference to artifact store. + internal WritableSubResource ArtifactStore { get; set; } + /// Gets or sets Id. + public ResourceIdentifier ArtifactStoreId + { + get => ArtifactStore is null ? default : ArtifactStore.Id; + set + { + if (ArtifactStore is null) + ArtifactStore = new WritableSubResource(); + ArtifactStore.Id = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactReplicationStrategy.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactReplicationStrategy.cs new file mode 100644 index 0000000000000..445da137117a2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactReplicationStrategy.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The replication strategy. + public readonly partial struct ArtifactReplicationStrategy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactReplicationStrategy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SingleReplicationValue = "SingleReplication"; + + /// Unknown. + public static ArtifactReplicationStrategy Unknown { get; } = new ArtifactReplicationStrategy(UnknownValue); + /// SingleReplication. + public static ArtifactReplicationStrategy SingleReplication { get; } = new ArtifactReplicationStrategy(SingleReplicationValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactReplicationStrategy left, ArtifactReplicationStrategy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactReplicationStrategy left, ArtifactReplicationStrategy right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactReplicationStrategy(string value) => new ArtifactReplicationStrategy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactReplicationStrategy other && Equals(other); + /// + public bool Equals(ArtifactReplicationStrategy 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactState.cs new file mode 100644 index 0000000000000..ce7a784507a1b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact state. + public readonly partial struct ArtifactState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PreviewValue = "Preview"; + private const string ActiveValue = "Active"; + private const string DeprecatedValue = "Deprecated"; + + /// Unknown. + public static ArtifactState Unknown { get; } = new ArtifactState(UnknownValue); + /// Preview. + public static ArtifactState Preview { get; } = new ArtifactState(PreviewValue); + /// Active. + public static ArtifactState Active { get; } = new ArtifactState(ActiveValue); + /// Deprecated. + public static ArtifactState Deprecated { get; } = new ArtifactState(DeprecatedValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactState left, ArtifactState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactState left, ArtifactState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactState(string value) => new ArtifactState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactState other && Equals(other); + /// + public bool Equals(ArtifactState 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreData.Serialization.cs new file mode 100644 index 0000000000000..85e6c1b684d39 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ArtifactStoreData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static ArtifactStoreData DeserializeArtifactStoreData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ArtifactStorePropertiesFormat.DeserializeArtifactStorePropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new ArtifactStoreData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.Serialization.cs new file mode 100644 index 0000000000000..7c3b5ec300775 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ArtifactStoreListResult + { + internal static ArtifactStoreListResult DeserializeArtifactStoreListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArtifactStoreData.DeserializeArtifactStoreData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ArtifactStoreListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.cs new file mode 100644 index 0000000000000..82b5d897359a9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of artifact stores. + internal partial class ArtifactStoreListResult + { + /// Initializes a new instance of ArtifactStoreListResult. + internal ArtifactStoreListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ArtifactStoreListResult. + /// A list of artifact stores. + /// The URL to get the next set of results. + internal ArtifactStoreListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of artifact stores. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..4f8faed6941e3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactStorePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(StoreType)) + { + writer.WritePropertyName("storeType"u8); + writer.WriteStringValue(StoreType.Value.ToString()); + } + if (Optional.IsDefined(ReplicationStrategy)) + { + writer.WritePropertyName("replicationStrategy"u8); + writer.WriteStringValue(ReplicationStrategy.Value.ToString()); + } + if (Optional.IsDefined(ManagedResourceGroupConfiguration)) + { + writer.WritePropertyName("managedResourceGroupConfiguration"u8); + writer.WriteObjectValue(ManagedResourceGroupConfiguration); + } + writer.WriteEndObject(); + } + + internal static ArtifactStorePropertiesFormat DeserializeArtifactStorePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional storeType = default; + Optional replicationStrategy = default; + Optional managedResourceGroupConfiguration = default; + Optional storageResourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("storeType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storeType = new ArtifactStoreType(property.Value.GetString()); + continue; + } + if (property.NameEquals("replicationStrategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationStrategy = new ArtifactReplicationStrategy(property.Value.GetString()); + continue; + } + if (property.NameEquals("managedResourceGroupConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedResourceGroupConfiguration = ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.DeserializeArtifactStorePropertiesFormatManagedResourceGroupConfiguration(property.Value); + continue; + } + if (property.NameEquals("storageResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + } + return new ArtifactStorePropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(storeType), Optional.ToNullable(replicationStrategy), managedResourceGroupConfiguration.Value, storageResourceId.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.cs new file mode 100644 index 0000000000000..1d4e65507623c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormat.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Artifact store properties. + public partial class ArtifactStorePropertiesFormat + { + /// Initializes a new instance of ArtifactStorePropertiesFormat. + public ArtifactStorePropertiesFormat() + { + } + + /// Initializes a new instance of ArtifactStorePropertiesFormat. + /// The provisioning state of the application groups resource. + /// The artifact store type. + /// The replication strategy. + /// + /// The created storage resource id. + internal ArtifactStorePropertiesFormat(ProvisioningState? provisioningState, ArtifactStoreType? storeType, ArtifactReplicationStrategy? replicationStrategy, ArtifactStorePropertiesFormatManagedResourceGroupConfiguration managedResourceGroupConfiguration, ResourceIdentifier storageResourceId) + { + ProvisioningState = provisioningState; + StoreType = storeType; + ReplicationStrategy = replicationStrategy; + ManagedResourceGroupConfiguration = managedResourceGroupConfiguration; + StorageResourceId = storageResourceId; + } + + /// The provisioning state of the application groups resource. + public ProvisioningState? ProvisioningState { get; } + /// The artifact store type. + public ArtifactStoreType? StoreType { get; set; } + /// The replication strategy. + public ArtifactReplicationStrategy? ReplicationStrategy { get; set; } + /// Gets or sets the managed resource group configuration. + public ArtifactStorePropertiesFormatManagedResourceGroupConfiguration ManagedResourceGroupConfiguration { get; set; } + /// The created storage resource id. + public ResourceIdentifier StorageResourceId { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.Serialization.cs new file mode 100644 index 0000000000000..7506445ca8122 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + writer.WriteEndObject(); + } + + internal static ArtifactStorePropertiesFormatManagedResourceGroupConfiguration DeserializeArtifactStorePropertiesFormatManagedResourceGroupConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + } + return new ArtifactStorePropertiesFormatManagedResourceGroupConfiguration(name.Value, Optional.ToNullable(location)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.cs new file mode 100644 index 0000000000000..1e82587d0c802 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStorePropertiesFormatManagedResourceGroupConfiguration.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. + public partial class ArtifactStorePropertiesFormatManagedResourceGroupConfiguration + { + /// Initializes a new instance of ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. + public ArtifactStorePropertiesFormatManagedResourceGroupConfiguration() + { + } + + /// Initializes a new instance of ArtifactStorePropertiesFormatManagedResourceGroupConfiguration. + /// The managed resource group name. + /// The managed resource group location. + internal ArtifactStorePropertiesFormatManagedResourceGroupConfiguration(string name, AzureLocation? location) + { + Name = name; + Location = location; + } + + /// The managed resource group name. + public string Name { get; set; } + /// The managed resource group location. + public AzureLocation? Location { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreType.cs new file mode 100644 index 0000000000000..d900364f71138 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactStoreType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact store type. + public readonly partial struct ArtifactStoreType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactStoreType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureContainerRegistryValue = "AzureContainerRegistry"; + private const string AzureStorageAccountValue = "AzureStorageAccount"; + + /// Unknown. + public static ArtifactStoreType Unknown { get; } = new ArtifactStoreType(UnknownValue); + /// AzureContainerRegistry. + public static ArtifactStoreType AzureContainerRegistry { get; } = new ArtifactStoreType(AzureContainerRegistryValue); + /// AzureStorageAccount. + public static ArtifactStoreType AzureStorageAccount { get; } = new ArtifactStoreType(AzureStorageAccountValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactStoreType left, ArtifactStoreType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactStoreType left, ArtifactStoreType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactStoreType(string value) => new ArtifactStoreType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactStoreType other && Equals(other); + /// + public bool Equals(ArtifactStoreType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactType.cs new file mode 100644 index 0000000000000..653140511b8f4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ArtifactType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact type. + public readonly partial struct ArtifactType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ArtifactType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string OCIArtifactValue = "OCIArtifact"; + private const string VhdImageFileValue = "VhdImageFile"; + private const string ArmTemplateValue = "ArmTemplate"; + private const string ImageFileValue = "ImageFile"; + + /// Unknown. + public static ArtifactType Unknown { get; } = new ArtifactType(UnknownValue); + /// OCIArtifact. + public static ArtifactType OCIArtifact { get; } = new ArtifactType(OCIArtifactValue); + /// VhdImageFile. + public static ArtifactType VhdImageFile { get; } = new ArtifactType(VhdImageFileValue); + /// ArmTemplate. + public static ArtifactType ArmTemplate { get; } = new ArtifactType(ArmTemplateValue); + /// ImageFile. + public static ArtifactType ImageFile { get; } = new ArtifactType(ImageFileValue); + /// Determines if two values are the same. + public static bool operator ==(ArtifactType left, ArtifactType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ArtifactType left, ArtifactType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ArtifactType(string value) => new ArtifactType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ArtifactType other && Equals(other); + /// + public bool Equals(ArtifactType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.Serialization.cs new file mode 100644 index 0000000000000..b0c88f3bd36a5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcK8SClusterNfviDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CustomLocationReference)) + { + writer.WritePropertyName("customLocationReference"u8); + JsonSerializer.Serialize(writer, CustomLocationReference); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureArcK8SClusterNfviDetails DeserializeAzureArcK8SClusterNfviDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional customLocationReference = default; + Optional name = default; + NfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customLocationReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customLocationReference = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new NfviType(property.Value.GetString()); + continue; + } + } + return new AzureArcK8SClusterNfviDetails(name.Value, nfviType, customLocationReference); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.cs new file mode 100644 index 0000000000000..7f81e13c6a5d9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcK8SClusterNfviDetails.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The AzureArcK8sCluster NFVI detail. + public partial class AzureArcK8SClusterNfviDetails : NFVIs + { + /// Initializes a new instance of AzureArcK8SClusterNfviDetails. + public AzureArcK8SClusterNfviDetails() + { + NfviType = NfviType.AzureArcKubernetes; + } + + /// Initializes a new instance of AzureArcK8SClusterNfviDetails. + /// Name of the nfvi. + /// The NFVI type. + /// The reference to the custom location. + internal AzureArcK8SClusterNfviDetails(string name, NfviType nfviType, WritableSubResource customLocationReference) : base(name, nfviType) + { + CustomLocationReference = customLocationReference; + NfviType = nfviType; + } + + /// The reference to the custom location. + internal WritableSubResource CustomLocationReference { get; set; } + /// Gets or sets Id. + public ResourceIdentifier CustomLocationReferenceId + { + get => CustomLocationReference is null ? default : CustomLocationReference.Id; + set + { + if (CustomLocationReference is null) + CustomLocationReference = new WritableSubResource(); + CustomLocationReference.Id = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..2796133e9ea76 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(HelmArtifactProfile)) + { + writer.WritePropertyName("helmArtifactProfile"u8); + writer.WriteObjectValue(HelmArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesArtifactProfile DeserializeAzureArcKubernetesArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional helmArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("helmArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + helmArtifactProfile = HelmArtifactProfile.DeserializeHelmArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureArcKubernetesArtifactProfile(artifactStore, helmArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.cs new file mode 100644 index 0000000000000..711afe3cc8a98 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure arc kubernetes artifact profile properties. + public partial class AzureArcKubernetesArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureArcKubernetesArtifactProfile. + public AzureArcKubernetesArtifactProfile() + { + } + + /// Initializes a new instance of AzureArcKubernetesArtifactProfile. + /// The reference to artifact store. + /// Helm artifact profile. + internal AzureArcKubernetesArtifactProfile(WritableSubResource artifactStore, HelmArtifactProfile helmArtifactProfile) : base(artifactStore) + { + HelmArtifactProfile = helmArtifactProfile; + } + + /// Helm artifact profile. + public HelmArtifactProfile HelmArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactType.cs new file mode 100644 index 0000000000000..f7ae09b186abc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesArtifactType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact type. + internal readonly partial struct AzureArcKubernetesArtifactType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureArcKubernetesArtifactType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string HelmPackageValue = "HelmPackage"; + + /// Unknown. + public static AzureArcKubernetesArtifactType Unknown { get; } = new AzureArcKubernetesArtifactType(UnknownValue); + /// HelmPackage. + public static AzureArcKubernetesArtifactType HelmPackage { get; } = new AzureArcKubernetesArtifactType(HelmPackageValue); + /// Determines if two values are the same. + public static bool operator ==(AzureArcKubernetesArtifactType left, AzureArcKubernetesArtifactType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureArcKubernetesArtifactType left, AzureArcKubernetesArtifactType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AzureArcKubernetesArtifactType(string value) => new AzureArcKubernetesArtifactType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureArcKubernetesArtifactType other && Equals(other); + /// + public bool Equals(AzureArcKubernetesArtifactType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..e774309f91e80 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(HelmMappingRuleProfile)) + { + writer.WritePropertyName("helmMappingRuleProfile"u8); + writer.WriteObjectValue(HelmMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesDeployMappingRuleProfile DeserializeAzureArcKubernetesDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional helmMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("helmMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + helmMappingRuleProfile = HelmMappingRuleProfile.DeserializeHelmMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureArcKubernetesDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), helmMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.cs new file mode 100644 index 0000000000000..a53fea427ab20 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesDeployMappingRuleProfile.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure arc kubernetes deploy mapping rule profile. + public partial class AzureArcKubernetesDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureArcKubernetesDeployMappingRuleProfile. + public AzureArcKubernetesDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureArcKubernetesDeployMappingRuleProfile. + /// The application enablement. + /// The helm mapping rule profile. + internal AzureArcKubernetesDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, HelmMappingRuleProfile helmMappingRuleProfile) : base(applicationEnablement) + { + HelmMappingRuleProfile = helmMappingRuleProfile; + } + + /// The helm mapping rule profile. + public HelmMappingRuleProfile HelmMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.Serialization.cs new file mode 100644 index 0000000000000..0c3727f62c2a5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesHelmApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesHelmApplication DeserializeAzureArcKubernetesHelmApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureArcKubernetesArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureArcKubernetesArtifactProfile.DeserializeAzureArcKubernetesArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureArcKubernetesDeployMappingRuleProfile.DeserializeAzureArcKubernetesDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureArcKubernetesArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureArcKubernetesHelmApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.cs new file mode 100644 index 0000000000000..5c1aeff93b2a5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesHelmApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure arc kubernetes helm application configurations. + public partial class AzureArcKubernetesHelmApplication : AzureArcKubernetesNetworkFunctionApplication + { + /// Initializes a new instance of AzureArcKubernetesHelmApplication. + public AzureArcKubernetesHelmApplication() + { + ArtifactType = AzureArcKubernetesArtifactType.HelmPackage; + } + + /// Initializes a new instance of AzureArcKubernetesHelmApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure arc kubernetes artifact profile. + /// Deploy mapping rule profile. + internal AzureArcKubernetesHelmApplication(string name, DependsOnProfile dependsOnProfile, AzureArcKubernetesArtifactType artifactType, AzureArcKubernetesArtifactProfile artifactProfile, AzureArcKubernetesDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure arc kubernetes artifact profile. + public AzureArcKubernetesArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureArcKubernetesDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.Serialization.cs new file mode 100644 index 0000000000000..7d7703cc6ddca --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesNetworkFunctionApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesNetworkFunctionApplication DeserializeAzureArcKubernetesNetworkFunctionApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("artifactType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HelmPackage": return AzureArcKubernetesHelmApplication.DeserializeAzureArcKubernetesHelmApplication(element); + } + } + AzureArcKubernetesArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureArcKubernetesArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureArcKubernetesNetworkFunctionApplication(name.Value, dependsOnProfile.Value, artifactType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.cs new file mode 100644 index 0000000000000..54d326b0d6e00 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionApplication.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Azure arc kubernetes network function application definition. + /// 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 . + /// + public partial class AzureArcKubernetesNetworkFunctionApplication : NetworkFunctionApplication + { + /// Initializes a new instance of AzureArcKubernetesNetworkFunctionApplication. + public AzureArcKubernetesNetworkFunctionApplication() + { + } + + /// Initializes a new instance of AzureArcKubernetesNetworkFunctionApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + internal AzureArcKubernetesNetworkFunctionApplication(string name, DependsOnProfile dependsOnProfile, AzureArcKubernetesArtifactType artifactType) : base(name, dependsOnProfile) + { + ArtifactType = artifactType; + } + + /// The artifact type. + internal AzureArcKubernetesArtifactType ArtifactType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 0000000000000..c6dade8dc2348 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureArcKubernetesNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(NetworkFunctionApplications)) + { + writer.WritePropertyName("networkFunctionApplications"u8); + writer.WriteStartArray(); + foreach (var item in NetworkFunctionApplications) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureArcKubernetesNetworkFunctionTemplate DeserializeAzureArcKubernetesNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> networkFunctionApplications = default; + ContainerizedNetworkFunctionNfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionApplications"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureArcKubernetesNetworkFunctionApplication.DeserializeAzureArcKubernetesNetworkFunctionApplication(item)); + } + networkFunctionApplications = array; + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new ContainerizedNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new AzureArcKubernetesNetworkFunctionTemplate(nfviType, Optional.ToList(networkFunctionApplications)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.cs new file mode 100644 index 0000000000000..5cf5806d1a8e4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureArcKubernetesNetworkFunctionTemplate.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Arc kubernetes network function template. + public partial class AzureArcKubernetesNetworkFunctionTemplate : ContainerizedNetworkFunctionTemplate + { + /// Initializes a new instance of AzureArcKubernetesNetworkFunctionTemplate. + public AzureArcKubernetesNetworkFunctionTemplate() + { + NetworkFunctionApplications = new ChangeTrackingList(); + NfviType = ContainerizedNetworkFunctionNfviType.AzureArcKubernetes; + } + + /// Initializes a new instance of AzureArcKubernetesNetworkFunctionTemplate. + /// The network function type. + /// + /// Network function applications. + /// 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 . + /// + internal AzureArcKubernetesNetworkFunctionTemplate(ContainerizedNetworkFunctionNfviType nfviType, IList networkFunctionApplications) : base(nfviType) + { + NetworkFunctionApplications = networkFunctionApplications; + NfviType = nfviType; + } + + /// + /// Network function applications. + /// 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 . + /// + public IList NetworkFunctionApplications { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.Serialization.cs new file mode 100644 index 0000000000000..1784aad6e4cfc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.Serialization.cs @@ -0,0 +1,82 @@ +// 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; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureContainerRegistryScopedTokenCredential + { + internal static AzureContainerRegistryScopedTokenCredential DeserializeAzureContainerRegistryScopedTokenCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional username = default; + Optional acrToken = default; + Optional acrServerUrl = default; + Optional> repositories = default; + Optional expiry = default; + CredentialType credentialType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("username"u8)) + { + username = property.Value.GetString(); + continue; + } + if (property.NameEquals("acrToken"u8)) + { + acrToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("acrServerUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + acrServerUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("repositories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + repositories = array; + continue; + } + if (property.NameEquals("expiry"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiry = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("credentialType"u8)) + { + credentialType = new CredentialType(property.Value.GetString()); + continue; + } + } + return new AzureContainerRegistryScopedTokenCredential(credentialType, username.Value, acrToken.Value, acrServerUrl.Value, Optional.ToList(repositories), Optional.ToNullable(expiry)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.cs new file mode 100644 index 0000000000000..d3ef925712556 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureContainerRegistryScopedTokenCredential.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The azure container registry scoped token credential definition. + public partial class AzureContainerRegistryScopedTokenCredential : ArtifactAccessCredential + { + /// Initializes a new instance of AzureContainerRegistryScopedTokenCredential. + internal AzureContainerRegistryScopedTokenCredential() + { + Repositories = new ChangeTrackingList(); + CredentialType = CredentialType.AzureContainerRegistryScopedToken; + } + + /// Initializes a new instance of AzureContainerRegistryScopedTokenCredential. + /// The credential type. + /// The username of the credential. + /// The credential value. + /// The Acr server url. + /// The repositories that could be accessed using the current credential. + /// The UTC time when credential will expire. + internal AzureContainerRegistryScopedTokenCredential(CredentialType credentialType, string username, string acrToken, Uri acrServerUri, IReadOnlyList repositories, DateTimeOffset? expiry) : base(credentialType) + { + Username = username; + AcrToken = acrToken; + AcrServerUri = acrServerUri; + Repositories = repositories; + Expiry = expiry; + CredentialType = credentialType; + } + + /// The username of the credential. + public string Username { get; } + /// The credential value. + public string AcrToken { get; } + /// The Acr server url. + public Uri AcrServerUri { get; } + /// The repositories that could be accessed using the current credential. + public IReadOnlyList Repositories { get; } + /// The UTC time when credential will expire. + public DateTimeOffset? Expiry { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..8d5ca0d888af7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreArmTemplateArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateArtifactProfile)) + { + writer.WritePropertyName("templateArtifactProfile"u8); + writer.WriteObjectValue(TemplateArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureCoreArmTemplateArtifactProfile DeserializeAzureCoreArmTemplateArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateArtifactProfile = ArmTemplateArtifactProfile.DeserializeArmTemplateArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureCoreArmTemplateArtifactProfile(artifactStore, templateArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.cs new file mode 100644 index 0000000000000..29fe007bd3645 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure template artifact profile properties. + public partial class AzureCoreArmTemplateArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureCoreArmTemplateArtifactProfile. + public AzureCoreArmTemplateArtifactProfile() + { + } + + /// Initializes a new instance of AzureCoreArmTemplateArtifactProfile. + /// The reference to artifact store. + /// Template artifact profile. + internal AzureCoreArmTemplateArtifactProfile(WritableSubResource artifactStore, ArmTemplateArtifactProfile templateArtifactProfile) : base(artifactStore) + { + TemplateArtifactProfile = templateArtifactProfile; + } + + /// Template artifact profile. + public ArmTemplateArtifactProfile TemplateArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..5b58542e50643 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreArmTemplateDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateMappingRuleProfile)) + { + writer.WritePropertyName("templateMappingRuleProfile"u8); + writer.WriteObjectValue(TemplateMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureCoreArmTemplateDeployMappingRuleProfile DeserializeAzureCoreArmTemplateDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateMappingRuleProfile = ArmTemplateMappingRuleProfile.DeserializeArmTemplateMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureCoreArmTemplateDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), templateMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.cs new file mode 100644 index 0000000000000..039ed46e15b18 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArmTemplateDeployMappingRuleProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure template deploy mapping rule profile. + public partial class AzureCoreArmTemplateDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureCoreArmTemplateDeployMappingRuleProfile. + public AzureCoreArmTemplateDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureCoreArmTemplateDeployMappingRuleProfile. + /// The application enablement. + /// The template mapping rule profile. + internal AzureCoreArmTemplateDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, ArmTemplateMappingRuleProfile templateMappingRuleProfile) : base(applicationEnablement) + { + TemplateMappingRuleProfile = templateMappingRuleProfile; + } + + /// The template mapping rule profile. + internal ArmTemplateMappingRuleProfile TemplateMappingRuleProfile { get; set; } + /// List of template parameters. + public string TemplateParameters + { + get => TemplateMappingRuleProfile is null ? default : TemplateMappingRuleProfile.TemplateParameters; + set + { + if (TemplateMappingRuleProfile is null) + TemplateMappingRuleProfile = new ArmTemplateMappingRuleProfile(); + TemplateMappingRuleProfile.TemplateParameters = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArtifactType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArtifactType.cs new file mode 100644 index 0000000000000..374260833c743 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreArtifactType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact type. + internal readonly partial struct AzureCoreArtifactType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureCoreArtifactType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string VhdImageFileValue = "VhdImageFile"; + private const string ArmTemplateValue = "ArmTemplate"; + + /// Unknown. + public static AzureCoreArtifactType Unknown { get; } = new AzureCoreArtifactType(UnknownValue); + /// VhdImageFile. + public static AzureCoreArtifactType VhdImageFile { get; } = new AzureCoreArtifactType(VhdImageFileValue); + /// ArmTemplate. + public static AzureCoreArtifactType ArmTemplate { get; } = new AzureCoreArtifactType(ArmTemplateValue); + /// Determines if two values are the same. + public static bool operator ==(AzureCoreArtifactType left, AzureCoreArtifactType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureCoreArtifactType left, AzureCoreArtifactType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AzureCoreArtifactType(string value) => new AzureCoreArtifactType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureCoreArtifactType other && Equals(other); + /// + public bool Equals(AzureCoreArtifactType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.Serialization.cs new file mode 100644 index 0000000000000..621ea1c85d493 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNetworkFunctionApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureCoreNetworkFunctionApplication DeserializeAzureCoreNetworkFunctionApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("artifactType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ArmTemplate": return AzureCoreNetworkFunctionArmTemplateApplication.DeserializeAzureCoreNetworkFunctionArmTemplateApplication(element); + case "VhdImageFile": return AzureCoreNetworkFunctionVhdApplication.DeserializeAzureCoreNetworkFunctionVhdApplication(element); + } + } + AzureCoreArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureCoreArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureCoreNetworkFunctionApplication(name.Value, dependsOnProfile.Value, artifactType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.cs new file mode 100644 index 0000000000000..e3c4d9c3a0665 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionApplication.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Azure virtual network function application definition. + /// 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 partial class AzureCoreNetworkFunctionApplication : NetworkFunctionApplication + { + /// Initializes a new instance of AzureCoreNetworkFunctionApplication. + public AzureCoreNetworkFunctionApplication() + { + } + + /// Initializes a new instance of AzureCoreNetworkFunctionApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + internal AzureCoreNetworkFunctionApplication(string name, DependsOnProfile dependsOnProfile, AzureCoreArtifactType artifactType) : base(name, dependsOnProfile) + { + ArtifactType = artifactType; + } + + /// The artifact type. + internal AzureCoreArtifactType ArtifactType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.Serialization.cs new file mode 100644 index 0000000000000..f5641df49e77b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNetworkFunctionArmTemplateApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureCoreNetworkFunctionArmTemplateApplication DeserializeAzureCoreNetworkFunctionArmTemplateApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureCoreArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureCoreArmTemplateArtifactProfile.DeserializeAzureCoreArmTemplateArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureCoreArmTemplateDeployMappingRuleProfile.DeserializeAzureCoreArmTemplateDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureCoreArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureCoreNetworkFunctionArmTemplateApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.cs new file mode 100644 index 0000000000000..45ca56955c2d5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionArmTemplateApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure core network function Template application definition. + public partial class AzureCoreNetworkFunctionArmTemplateApplication : AzureCoreNetworkFunctionApplication + { + /// Initializes a new instance of AzureCoreNetworkFunctionArmTemplateApplication. + public AzureCoreNetworkFunctionArmTemplateApplication() + { + ArtifactType = AzureCoreArtifactType.ArmTemplate; + } + + /// Initializes a new instance of AzureCoreNetworkFunctionArmTemplateApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure template artifact profile. + /// Deploy mapping rule profile. + internal AzureCoreNetworkFunctionArmTemplateApplication(string name, DependsOnProfile dependsOnProfile, AzureCoreArtifactType artifactType, AzureCoreArmTemplateArtifactProfile artifactProfile, AzureCoreArmTemplateDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure template artifact profile. + public AzureCoreArmTemplateArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureCoreArmTemplateDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 0000000000000..aac0951e037f7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(NetworkFunctionApplications)) + { + writer.WritePropertyName("networkFunctionApplications"u8); + writer.WriteStartArray(); + foreach (var item in NetworkFunctionApplications) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureCoreNetworkFunctionTemplate DeserializeAzureCoreNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> networkFunctionApplications = default; + VirtualNetworkFunctionNfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionApplications"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureCoreNetworkFunctionApplication.DeserializeAzureCoreNetworkFunctionApplication(item)); + } + networkFunctionApplications = array; + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new VirtualNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new AzureCoreNetworkFunctionTemplate(nfviType, Optional.ToList(networkFunctionApplications)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.cs new file mode 100644 index 0000000000000..f6e76c9a646a7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionTemplate.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure virtual network function template. + public partial class AzureCoreNetworkFunctionTemplate : VirtualNetworkFunctionTemplate + { + /// Initializes a new instance of AzureCoreNetworkFunctionTemplate. + public AzureCoreNetworkFunctionTemplate() + { + NetworkFunctionApplications = new ChangeTrackingList(); + NfviType = VirtualNetworkFunctionNfviType.AzureCore; + } + + /// Initializes a new instance of AzureCoreNetworkFunctionTemplate. + /// The network function type. + /// + /// Network function applications. + /// 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 . + /// + internal AzureCoreNetworkFunctionTemplate(VirtualNetworkFunctionNfviType nfviType, IList networkFunctionApplications) : base(nfviType) + { + NetworkFunctionApplications = networkFunctionApplications; + NfviType = nfviType; + } + + /// + /// Network function applications. + /// 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 IList NetworkFunctionApplications { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.Serialization.cs new file mode 100644 index 0000000000000..49cabe58dbb37 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNetworkFunctionVhdApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureCoreNetworkFunctionVhdApplication DeserializeAzureCoreNetworkFunctionVhdApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureCoreArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureCoreVhdImageArtifactProfile.DeserializeAzureCoreVhdImageArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureCoreVhdImageDeployMappingRuleProfile.DeserializeAzureCoreVhdImageDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureCoreArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureCoreNetworkFunctionVhdApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.cs new file mode 100644 index 0000000000000..2e3bdf8b08bab --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNetworkFunctionVhdApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure core network function vhd application definition. + public partial class AzureCoreNetworkFunctionVhdApplication : AzureCoreNetworkFunctionApplication + { + /// Initializes a new instance of AzureCoreNetworkFunctionVhdApplication. + public AzureCoreNetworkFunctionVhdApplication() + { + ArtifactType = AzureCoreArtifactType.VhdImageFile; + } + + /// Initializes a new instance of AzureCoreNetworkFunctionVhdApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure vhd image artifact profile. + /// Deploy mapping rule profile. + internal AzureCoreNetworkFunctionVhdApplication(string name, DependsOnProfile dependsOnProfile, AzureCoreArtifactType artifactType, AzureCoreVhdImageArtifactProfile artifactProfile, AzureCoreVhdImageDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure vhd image artifact profile. + public AzureCoreVhdImageArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureCoreVhdImageDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.Serialization.cs new file mode 100644 index 0000000000000..fe9c3eca0be1a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreNfviDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureCoreNfviDetails DeserializeAzureCoreNfviDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional location = default; + Optional name = default; + NfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new NfviType(property.Value.GetString()); + continue; + } + } + return new AzureCoreNfviDetails(name.Value, nfviType, Optional.ToNullable(location)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.cs new file mode 100644 index 0000000000000..10cde9bf455b2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreNfviDetails.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The Azure Core NFVI detail. + public partial class AzureCoreNfviDetails : NFVIs + { + /// Initializes a new instance of AzureCoreNfviDetails. + public AzureCoreNfviDetails() + { + NfviType = NfviType.AzureCore; + } + + /// Initializes a new instance of AzureCoreNfviDetails. + /// Name of the nfvi. + /// The NFVI type. + /// Location of the Azure core. + internal AzureCoreNfviDetails(string name, NfviType nfviType, AzureLocation? location) : base(name, nfviType) + { + Location = location; + NfviType = nfviType; + } + + /// Location of the Azure core. + public AzureLocation? Location { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..a3f15b18146cc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreVhdImageArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VhdArtifactProfile)) + { + writer.WritePropertyName("vhdArtifactProfile"u8); + writer.WriteObjectValue(VhdArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureCoreVhdImageArtifactProfile DeserializeAzureCoreVhdImageArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional vhdArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vhdArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vhdArtifactProfile = VhdImageArtifactProfile.DeserializeVhdImageArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureCoreVhdImageArtifactProfile(artifactStore, vhdArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.cs new file mode 100644 index 0000000000000..66ec3471b5caa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure vhd artifact profile properties. + public partial class AzureCoreVhdImageArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureCoreVhdImageArtifactProfile. + public AzureCoreVhdImageArtifactProfile() + { + } + + /// Initializes a new instance of AzureCoreVhdImageArtifactProfile. + /// The reference to artifact store. + /// Vhd artifact profile. + internal AzureCoreVhdImageArtifactProfile(WritableSubResource artifactStore, VhdImageArtifactProfile vhdArtifactProfile) : base(artifactStore) + { + VhdArtifactProfile = vhdArtifactProfile; + } + + /// Vhd artifact profile. + public VhdImageArtifactProfile VhdArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..3771fd9adb3e3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureCoreVhdImageDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VhdImageMappingRuleProfile)) + { + writer.WritePropertyName("vhdImageMappingRuleProfile"u8); + writer.WriteObjectValue(VhdImageMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureCoreVhdImageDeployMappingRuleProfile DeserializeAzureCoreVhdImageDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional vhdImageMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vhdImageMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vhdImageMappingRuleProfile = VhdImageMappingRuleProfile.DeserializeVhdImageMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureCoreVhdImageDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), vhdImageMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.cs new file mode 100644 index 0000000000000..b395b712726d5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureCoreVhdImageDeployMappingRuleProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure vhd deploy mapping rule profile. + public partial class AzureCoreVhdImageDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureCoreVhdImageDeployMappingRuleProfile. + public AzureCoreVhdImageDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureCoreVhdImageDeployMappingRuleProfile. + /// The application enablement. + /// The vhd mapping rule profile. + internal AzureCoreVhdImageDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, VhdImageMappingRuleProfile vhdImageMappingRuleProfile) : base(applicationEnablement) + { + VhdImageMappingRuleProfile = vhdImageMappingRuleProfile; + } + + /// The vhd mapping rule profile. + internal VhdImageMappingRuleProfile VhdImageMappingRuleProfile { get; set; } + /// List of values. + public string VhdImageMappingRuleUserConfiguration + { + get => VhdImageMappingRuleProfile is null ? default : VhdImageMappingRuleProfile.UserConfiguration; + set + { + if (VhdImageMappingRuleProfile is null) + VhdImageMappingRuleProfile = new VhdImageMappingRuleProfile(); + VhdImageMappingRuleProfile.UserConfiguration = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..80d3f55788027 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusArmTemplateArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateArtifactProfile)) + { + writer.WritePropertyName("templateArtifactProfile"u8); + writer.WriteObjectValue(TemplateArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusArmTemplateArtifactProfile DeserializeAzureOperatorNexusArmTemplateArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateArtifactProfile = ArmTemplateArtifactProfile.DeserializeArmTemplateArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureOperatorNexusArmTemplateArtifactProfile(artifactStore, templateArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.cs new file mode 100644 index 0000000000000..1722736f09e07 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services vhd artifact profile properties. + public partial class AzureOperatorNexusArmTemplateArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureOperatorNexusArmTemplateArtifactProfile. + public AzureOperatorNexusArmTemplateArtifactProfile() + { + } + + /// Initializes a new instance of AzureOperatorNexusArmTemplateArtifactProfile. + /// The reference to artifact store. + /// Template artifact profile. + internal AzureOperatorNexusArmTemplateArtifactProfile(WritableSubResource artifactStore, ArmTemplateArtifactProfile templateArtifactProfile) : base(artifactStore) + { + TemplateArtifactProfile = templateArtifactProfile; + } + + /// Template artifact profile. + public ArmTemplateArtifactProfile TemplateArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..c2c9ede8f57b3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusArmTemplateDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TemplateMappingRuleProfile)) + { + writer.WritePropertyName("templateMappingRuleProfile"u8); + writer.WriteObjectValue(TemplateMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusArmTemplateDeployMappingRuleProfile DeserializeAzureOperatorNexusArmTemplateDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional templateMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("templateMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateMappingRuleProfile = ArmTemplateMappingRuleProfile.DeserializeArmTemplateMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureOperatorNexusArmTemplateDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), templateMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.cs new file mode 100644 index 0000000000000..144d22fab8704 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArmTemplateDeployMappingRuleProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services template deploy mapping rule profile. + public partial class AzureOperatorNexusArmTemplateDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureOperatorNexusArmTemplateDeployMappingRuleProfile. + public AzureOperatorNexusArmTemplateDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureOperatorNexusArmTemplateDeployMappingRuleProfile. + /// The application enablement. + /// The template mapping rule profile. + internal AzureOperatorNexusArmTemplateDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, ArmTemplateMappingRuleProfile templateMappingRuleProfile) : base(applicationEnablement) + { + TemplateMappingRuleProfile = templateMappingRuleProfile; + } + + /// The template mapping rule profile. + internal ArmTemplateMappingRuleProfile TemplateMappingRuleProfile { get; set; } + /// List of template parameters. + public string TemplateParameters + { + get => TemplateMappingRuleProfile is null ? default : TemplateMappingRuleProfile.TemplateParameters; + set + { + if (TemplateMappingRuleProfile is null) + TemplateMappingRuleProfile = new ArmTemplateMappingRuleProfile(); + TemplateMappingRuleProfile.TemplateParameters = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArtifactType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArtifactType.cs new file mode 100644 index 0000000000000..41729113c5918 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusArtifactType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The artifact type. + internal readonly partial struct AzureOperatorNexusArtifactType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureOperatorNexusArtifactType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string ImageFileValue = "ImageFile"; + private const string ArmTemplateValue = "ArmTemplate"; + + /// Unknown. + public static AzureOperatorNexusArtifactType Unknown { get; } = new AzureOperatorNexusArtifactType(UnknownValue); + /// ImageFile. + public static AzureOperatorNexusArtifactType ImageFile { get; } = new AzureOperatorNexusArtifactType(ImageFileValue); + /// ArmTemplate. + public static AzureOperatorNexusArtifactType ArmTemplate { get; } = new AzureOperatorNexusArtifactType(ArmTemplateValue); + /// Determines if two values are the same. + public static bool operator ==(AzureOperatorNexusArtifactType left, AzureOperatorNexusArtifactType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureOperatorNexusArtifactType left, AzureOperatorNexusArtifactType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AzureOperatorNexusArtifactType(string value) => new AzureOperatorNexusArtifactType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureOperatorNexusArtifactType other && Equals(other); + /// + public bool Equals(AzureOperatorNexusArtifactType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.Serialization.cs new file mode 100644 index 0000000000000..18dbd4360f967 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusClusterNfviDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CustomLocationReference)) + { + writer.WritePropertyName("customLocationReference"u8); + JsonSerializer.Serialize(writer, CustomLocationReference); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusClusterNfviDetails DeserializeAzureOperatorNexusClusterNfviDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional customLocationReference = default; + Optional name = default; + NfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customLocationReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customLocationReference = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new NfviType(property.Value.GetString()); + continue; + } + } + return new AzureOperatorNexusClusterNfviDetails(name.Value, nfviType, customLocationReference); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.cs new file mode 100644 index 0000000000000..0a90b22e4c648 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusClusterNfviDetails.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The AzureOperatorNexusCluster NFVI detail. + public partial class AzureOperatorNexusClusterNfviDetails : NFVIs + { + /// Initializes a new instance of AzureOperatorNexusClusterNfviDetails. + public AzureOperatorNexusClusterNfviDetails() + { + NfviType = NfviType.AzureOperatorNexus; + } + + /// Initializes a new instance of AzureOperatorNexusClusterNfviDetails. + /// Name of the nfvi. + /// The NFVI type. + /// The reference to the custom location. + internal AzureOperatorNexusClusterNfviDetails(string name, NfviType nfviType, WritableSubResource customLocationReference) : base(name, nfviType) + { + CustomLocationReference = customLocationReference; + NfviType = nfviType; + } + + /// The reference to the custom location. + internal WritableSubResource CustomLocationReference { get; set; } + /// Gets or sets Id. + public ResourceIdentifier CustomLocationReferenceId + { + get => CustomLocationReference is null ? default : CustomLocationReference.Id; + set + { + if (CustomLocationReference is null) + CustomLocationReference = new WritableSubResource(); + CustomLocationReference.Id = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..cfab74b1e847b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusImageArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ImageArtifactProfile)) + { + writer.WritePropertyName("imageArtifactProfile"u8); + writer.WriteObjectValue(ImageArtifactProfile); + } + if (Optional.IsDefined(ArtifactStore)) + { + writer.WritePropertyName("artifactStore"u8); + JsonSerializer.Serialize(writer, ArtifactStore); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusImageArtifactProfile DeserializeAzureOperatorNexusImageArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional imageArtifactProfile = default; + Optional artifactStore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("imageArtifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageArtifactProfile = ImageArtifactProfile.DeserializeImageArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("artifactStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStore = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AzureOperatorNexusImageArtifactProfile(artifactStore, imageArtifactProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.cs new file mode 100644 index 0000000000000..8c43438a7709c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageArtifactProfile.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services image artifact profile properties. + public partial class AzureOperatorNexusImageArtifactProfile : ArtifactProfile + { + /// Initializes a new instance of AzureOperatorNexusImageArtifactProfile. + public AzureOperatorNexusImageArtifactProfile() + { + } + + /// Initializes a new instance of AzureOperatorNexusImageArtifactProfile. + /// The reference to artifact store. + /// Image artifact profile. + internal AzureOperatorNexusImageArtifactProfile(WritableSubResource artifactStore, ImageArtifactProfile imageArtifactProfile) : base(artifactStore) + { + ImageArtifactProfile = imageArtifactProfile; + } + + /// Image artifact profile. + public ImageArtifactProfile ImageArtifactProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..e1f00b94548b7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusImageDeployMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ImageMappingRuleProfile)) + { + writer.WritePropertyName("imageMappingRuleProfile"u8); + writer.WriteObjectValue(ImageMappingRuleProfile); + } + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusImageDeployMappingRuleProfile DeserializeAzureOperatorNexusImageDeployMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional imageMappingRuleProfile = default; + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("imageMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageMappingRuleProfile = ImageMappingRuleProfile.DeserializeImageMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new AzureOperatorNexusImageDeployMappingRuleProfile(Optional.ToNullable(applicationEnablement), imageMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.cs new file mode 100644 index 0000000000000..f7db1aeb1d636 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusImageDeployMappingRuleProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services image deploy mapping rule profile. + public partial class AzureOperatorNexusImageDeployMappingRuleProfile : MappingRuleProfile + { + /// Initializes a new instance of AzureOperatorNexusImageDeployMappingRuleProfile. + public AzureOperatorNexusImageDeployMappingRuleProfile() + { + } + + /// Initializes a new instance of AzureOperatorNexusImageDeployMappingRuleProfile. + /// The application enablement. + /// The vhd mapping rule profile. + internal AzureOperatorNexusImageDeployMappingRuleProfile(ApplicationEnablement? applicationEnablement, ImageMappingRuleProfile imageMappingRuleProfile) : base(applicationEnablement) + { + ImageMappingRuleProfile = imageMappingRuleProfile; + } + + /// The vhd mapping rule profile. + internal ImageMappingRuleProfile ImageMappingRuleProfile { get; set; } + /// List of values. + public string ImageMappingRuleUserConfiguration + { + get => ImageMappingRuleProfile is null ? default : ImageMappingRuleProfile.UserConfiguration; + set + { + if (ImageMappingRuleProfile is null) + ImageMappingRuleProfile = new ImageMappingRuleProfile(); + ImageMappingRuleProfile.UserConfiguration = value; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.Serialization.cs new file mode 100644 index 0000000000000..c4edfc2a86d47 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusNetworkFunctionApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusNetworkFunctionApplication DeserializeAzureOperatorNexusNetworkFunctionApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("artifactType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ArmTemplate": return AzureOperatorNexusNetworkFunctionArmTemplateApplication.DeserializeAzureOperatorNexusNetworkFunctionArmTemplateApplication(element); + case "ImageFile": return AzureOperatorNexusNetworkFunctionImageApplication.DeserializeAzureOperatorNexusNetworkFunctionImageApplication(element); + } + } + AzureOperatorNexusArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureOperatorNexusArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureOperatorNexusNetworkFunctionApplication(name.Value, dependsOnProfile.Value, artifactType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.cs new file mode 100644 index 0000000000000..66dd32e6c141e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionApplication.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Azure Operator Distributed Services network function application definition. + /// 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 partial class AzureOperatorNexusNetworkFunctionApplication : NetworkFunctionApplication + { + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionApplication. + public AzureOperatorNexusNetworkFunctionApplication() + { + } + + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + internal AzureOperatorNexusNetworkFunctionApplication(string name, DependsOnProfile dependsOnProfile, AzureOperatorNexusArtifactType artifactType) : base(name, dependsOnProfile) + { + ArtifactType = artifactType; + } + + /// The artifact type. + internal AzureOperatorNexusArtifactType ArtifactType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.Serialization.cs new file mode 100644 index 0000000000000..93f428f922aab --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusNetworkFunctionArmTemplateApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusNetworkFunctionArmTemplateApplication DeserializeAzureOperatorNexusNetworkFunctionArmTemplateApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureOperatorNexusArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureOperatorNexusArmTemplateArtifactProfile.DeserializeAzureOperatorNexusArmTemplateArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureOperatorNexusArmTemplateDeployMappingRuleProfile.DeserializeAzureOperatorNexusArmTemplateDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureOperatorNexusArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureOperatorNexusNetworkFunctionArmTemplateApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.cs new file mode 100644 index 0000000000000..ae8d80efdae67 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionArmTemplateApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services network function Template application definition. + public partial class AzureOperatorNexusNetworkFunctionArmTemplateApplication : AzureOperatorNexusNetworkFunctionApplication + { + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionArmTemplateApplication. + public AzureOperatorNexusNetworkFunctionArmTemplateApplication() + { + ArtifactType = AzureOperatorNexusArtifactType.ArmTemplate; + } + + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionArmTemplateApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure Operator Distributed Services Template artifact profile. + /// Deploy mapping rule profile. + internal AzureOperatorNexusNetworkFunctionArmTemplateApplication(string name, DependsOnProfile dependsOnProfile, AzureOperatorNexusArtifactType artifactType, AzureOperatorNexusArmTemplateArtifactProfile artifactProfile, AzureOperatorNexusArmTemplateDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure Operator Distributed Services Template artifact profile. + public AzureOperatorNexusArmTemplateArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureOperatorNexusArmTemplateDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.Serialization.cs new file mode 100644 index 0000000000000..5453fed629a3a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusNetworkFunctionImageApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactProfile)) + { + writer.WritePropertyName("artifactProfile"u8); + writer.WriteObjectValue(ArtifactProfile); + } + if (Optional.IsDefined(DeployParametersMappingRuleProfile)) + { + writer.WritePropertyName("deployParametersMappingRuleProfile"u8); + writer.WriteObjectValue(DeployParametersMappingRuleProfile); + } + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusNetworkFunctionImageApplication DeserializeAzureOperatorNexusNetworkFunctionImageApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactProfile = default; + Optional deployParametersMappingRuleProfile = default; + AzureOperatorNexusArtifactType artifactType = default; + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactProfile = AzureOperatorNexusImageArtifactProfile.DeserializeAzureOperatorNexusImageArtifactProfile(property.Value); + continue; + } + if (property.NameEquals("deployParametersMappingRuleProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployParametersMappingRuleProfile = AzureOperatorNexusImageDeployMappingRuleProfile.DeserializeAzureOperatorNexusImageDeployMappingRuleProfile(property.Value); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + artifactType = new AzureOperatorNexusArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new AzureOperatorNexusNetworkFunctionImageApplication(name.Value, dependsOnProfile.Value, artifactType, artifactProfile.Value, deployParametersMappingRuleProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.cs new file mode 100644 index 0000000000000..5dc8e2c664a04 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionImageApplication.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services network function image application definition. + public partial class AzureOperatorNexusNetworkFunctionImageApplication : AzureOperatorNexusNetworkFunctionApplication + { + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionImageApplication. + public AzureOperatorNexusNetworkFunctionImageApplication() + { + ArtifactType = AzureOperatorNexusArtifactType.ImageFile; + } + + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionImageApplication. + /// The name of the network function application. + /// Depends on profile definition. + /// The artifact type. + /// Azure Operator Distributed Services image artifact profile. + /// Deploy mapping rule profile. + internal AzureOperatorNexusNetworkFunctionImageApplication(string name, DependsOnProfile dependsOnProfile, AzureOperatorNexusArtifactType artifactType, AzureOperatorNexusImageArtifactProfile artifactProfile, AzureOperatorNexusImageDeployMappingRuleProfile deployParametersMappingRuleProfile) : base(name, dependsOnProfile, artifactType) + { + ArtifactProfile = artifactProfile; + DeployParametersMappingRuleProfile = deployParametersMappingRuleProfile; + ArtifactType = artifactType; + } + + /// Azure Operator Distributed Services image artifact profile. + public AzureOperatorNexusImageArtifactProfile ArtifactProfile { get; set; } + /// Deploy mapping rule profile. + public AzureOperatorNexusImageDeployMappingRuleProfile DeployParametersMappingRuleProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 0000000000000..24717162b108b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureOperatorNexusNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(NetworkFunctionApplications)) + { + writer.WritePropertyName("networkFunctionApplications"u8); + writer.WriteStartArray(); + foreach (var item in NetworkFunctionApplications) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureOperatorNexusNetworkFunctionTemplate DeserializeAzureOperatorNexusNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> networkFunctionApplications = default; + VirtualNetworkFunctionNfviType nfviType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionApplications"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureOperatorNexusNetworkFunctionApplication.DeserializeAzureOperatorNexusNetworkFunctionApplication(item)); + } + networkFunctionApplications = array; + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new VirtualNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new AzureOperatorNexusNetworkFunctionTemplate(nfviType, Optional.ToList(networkFunctionApplications)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.cs new file mode 100644 index 0000000000000..dbb0c02b4eb6e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureOperatorNexusNetworkFunctionTemplate.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Azure Operator Distributed Services network function template. + public partial class AzureOperatorNexusNetworkFunctionTemplate : VirtualNetworkFunctionTemplate + { + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionTemplate. + public AzureOperatorNexusNetworkFunctionTemplate() + { + NetworkFunctionApplications = new ChangeTrackingList(); + NfviType = VirtualNetworkFunctionNfviType.AzureOperatorNexus; + } + + /// Initializes a new instance of AzureOperatorNexusNetworkFunctionTemplate. + /// The network function type. + /// + /// Network function applications. + /// 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 . + /// + internal AzureOperatorNexusNetworkFunctionTemplate(VirtualNetworkFunctionNfviType nfviType, IList networkFunctionApplications) : base(nfviType) + { + NetworkFunctionApplications = networkFunctionApplications; + NfviType = nfviType; + } + + /// + /// Network function applications. + /// 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 IList NetworkFunctionApplications { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.Serialization.cs new file mode 100644 index 0000000000000..5d8ae0bef2e26 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.Serialization.cs @@ -0,0 +1,44 @@ +// 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.HybridNetwork.Models +{ + public partial class AzureStorageAccountContainerCredential + { + internal static AzureStorageAccountContainerCredential DeserializeAzureStorageAccountContainerCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional containerName = default; + Optional containerSasUri = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("containerName"u8)) + { + containerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("containerSasUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerSasUri = new Uri(property.Value.GetString()); + continue; + } + } + return new AzureStorageAccountContainerCredential(containerName.Value, containerSasUri.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.cs new file mode 100644 index 0000000000000..179b57b896938 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountContainerCredential.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The azure storage account container credential definition. + public partial class AzureStorageAccountContainerCredential + { + /// Initializes a new instance of AzureStorageAccountContainerCredential. + internal AzureStorageAccountContainerCredential() + { + } + + /// Initializes a new instance of AzureStorageAccountContainerCredential. + /// The storage account container name. + /// The storage account container sas uri. + internal AzureStorageAccountContainerCredential(string containerName, Uri containerSasUri) + { + ContainerName = containerName; + ContainerSasUri = containerSasUri; + } + + /// The storage account container name. + public string ContainerName { get; } + /// The storage account container sas uri. + public Uri ContainerSasUri { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.Serialization.cs new file mode 100644 index 0000000000000..b7d839ad0c387 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.Serialization.cs @@ -0,0 +1,70 @@ +// 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; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class AzureStorageAccountCredential + { + internal static AzureStorageAccountCredential DeserializeAzureStorageAccountCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional storageAccountId = default; + Optional> containerCredentials = default; + Optional expiry = default; + CredentialType credentialType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageAccountId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("containerCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureStorageAccountContainerCredential.DeserializeAzureStorageAccountContainerCredential(item)); + } + containerCredentials = array; + continue; + } + if (property.NameEquals("expiry"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiry = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("credentialType"u8)) + { + credentialType = new CredentialType(property.Value.GetString()); + continue; + } + } + return new AzureStorageAccountCredential(credentialType, storageAccountId.Value, Optional.ToList(containerCredentials), Optional.ToNullable(expiry)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.cs new file mode 100644 index 0000000000000..93aeb8dfd886f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/AzureStorageAccountCredential.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The azure storage account credential definition. + public partial class AzureStorageAccountCredential : ArtifactAccessCredential + { + /// Initializes a new instance of AzureStorageAccountCredential. + internal AzureStorageAccountCredential() + { + ContainerCredentials = new ChangeTrackingList(); + CredentialType = CredentialType.AzureStorageAccountToken; + } + + /// Initializes a new instance of AzureStorageAccountCredential. + /// The credential type. + /// The storage account Id. + /// The containers that could be accessed using the current credential. + /// The UTC time when credential will expire. + internal AzureStorageAccountCredential(CredentialType credentialType, ResourceIdentifier storageAccountId, IReadOnlyList containerCredentials, DateTimeOffset? expiry) : base(credentialType) + { + StorageAccountId = storageAccountId; + ContainerCredentials = containerCredentials; + Expiry = expiry; + CredentialType = credentialType; + } + + /// The storage account Id. + public ResourceIdentifier StorageAccountId { get; } + /// The containers that could be accessed using the current credential. + public IReadOnlyList ContainerCredentials { get; } + /// The UTC time when credential will expire. + public DateTimeOffset? Expiry { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentData.Serialization.cs new file mode 100644 index 0000000000000..531ae16ff56ae --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentData.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ComponentData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static ComponentData DeserializeComponentData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ComponentProperties.DeserializeComponentProperties(property.Value); + 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; + } + } + return new ComponentData(id, name, type, systemData.Value, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.Serialization.cs new file mode 100644 index 0000000000000..8f9045f0fcc58 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.Serialization.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ComponentKubernetesResources + { + internal static ComponentKubernetesResources DeserializeComponentKubernetesResources(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> deployments = default; + Optional> pods = default; + Optional> replicaSets = default; + Optional> statefulSets = default; + Optional> daemonSets = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deployments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesDeployment.DeserializeKubernetesDeployment(item)); + } + deployments = array; + continue; + } + if (property.NameEquals("pods"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesPod.DeserializeKubernetesPod(item)); + } + pods = array; + continue; + } + if (property.NameEquals("replicaSets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesReplicaSet.DeserializeKubernetesReplicaSet(item)); + } + replicaSets = array; + continue; + } + if (property.NameEquals("statefulSets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesStatefulSet.DeserializeKubernetesStatefulSet(item)); + } + statefulSets = array; + continue; + } + if (property.NameEquals("daemonSets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesDaemonSet.DeserializeKubernetesDaemonSet(item)); + } + daemonSets = array; + continue; + } + } + return new ComponentKubernetesResources(Optional.ToList(deployments), Optional.ToList(pods), Optional.ToList(replicaSets), Optional.ToList(statefulSets), Optional.ToList(daemonSets)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.cs new file mode 100644 index 0000000000000..e9d3a0bf14ced --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentKubernetesResources.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The resources of the network function component. + public partial class ComponentKubernetesResources + { + /// Initializes a new instance of ComponentKubernetesResources. + internal ComponentKubernetesResources() + { + Deployments = new ChangeTrackingList(); + Pods = new ChangeTrackingList(); + ReplicaSets = new ChangeTrackingList(); + StatefulSets = new ChangeTrackingList(); + DaemonSets = new ChangeTrackingList(); + } + + /// Initializes a new instance of ComponentKubernetesResources. + /// Deployments that are related to component resource. + /// Pods related to component resource. + /// Replica sets related to component resource. + /// Stateful sets related to component resource. + /// Daemonsets related to component resource. + internal ComponentKubernetesResources(IReadOnlyList deployments, IReadOnlyList pods, IReadOnlyList replicaSets, IReadOnlyList statefulSets, IReadOnlyList daemonSets) + { + Deployments = deployments; + Pods = pods; + ReplicaSets = replicaSets; + StatefulSets = statefulSets; + DaemonSets = daemonSets; + } + + /// Deployments that are related to component resource. + public IReadOnlyList Deployments { get; } + /// Pods related to component resource. + public IReadOnlyList Pods { get; } + /// Replica sets related to component resource. + public IReadOnlyList ReplicaSets { get; } + /// Stateful sets related to component resource. + public IReadOnlyList StatefulSets { get; } + /// Daemonsets related to component resource. + public IReadOnlyList DaemonSets { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.Serialization.cs new file mode 100644 index 0000000000000..080700a8625aa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ComponentListResult + { + internal static ComponentListResult DeserializeComponentListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ComponentData.DeserializeComponentData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ComponentListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.cs new file mode 100644 index 0000000000000..5e0f5871cca00 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for list component API service call. + internal partial class ComponentListResult + { + /// Initializes a new instance of ComponentListResult. + internal ComponentListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ComponentListResult. + /// A list of component resources in a networkFunction. + /// The URL to get the next set of results. + internal ComponentListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of component resources in a networkFunction. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.Serialization.cs new file mode 100644 index 0000000000000..7dd639ad627eb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ComponentProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ComponentProperties DeserializeComponentProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional deploymentProfile = default; + Optional deploymentStatus = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("deploymentProfile"u8)) + { + deploymentProfile = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deploymentStatus = DeploymentStatusProperties.DeserializeDeploymentStatusProperties(property.Value); + continue; + } + } + return new ComponentProperties(Optional.ToNullable(provisioningState), deploymentProfile.Value, deploymentStatus.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.cs new file mode 100644 index 0000000000000..d81ef30e21c80 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The component properties of the network function. + public partial class ComponentProperties + { + /// Initializes a new instance of ComponentProperties. + public ComponentProperties() + { + } + + /// Initializes a new instance of ComponentProperties. + /// The provisioning state of the component resource. + /// The JSON-serialized deployment profile of the component resource. + /// The deployment status of the component resource. + internal ComponentProperties(ProvisioningState? provisioningState, string deploymentProfile, DeploymentStatusProperties deploymentStatus) + { + ProvisioningState = provisioningState; + DeploymentProfile = deploymentProfile; + DeploymentStatus = deploymentStatus; + } + + /// The provisioning state of the component resource. + public ProvisioningState? ProvisioningState { get; } + /// The JSON-serialized deployment profile of the component resource. + public string DeploymentProfile { get; } + /// The deployment status of the component resource. + public DeploymentStatusProperties DeploymentStatus { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentStatus.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentStatus.cs new file mode 100644 index 0000000000000..c64c9d52df11a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ComponentStatus.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The component resource deployment status. + public readonly partial struct ComponentStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ComponentStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string DeployedValue = "Deployed"; + private const string UninstalledValue = "Uninstalled"; + private const string SupersededValue = "Superseded"; + private const string FailedValue = "Failed"; + private const string UninstallingValue = "Uninstalling"; + private const string PendingInstallValue = "Pending-Install"; + private const string PendingUpgradeValue = "Pending-Upgrade"; + private const string PendingRollbackValue = "Pending-Rollback"; + private const string DownloadingValue = "Downloading"; + private const string InstallingValue = "Installing"; + private const string ReinstallingValue = "Reinstalling"; + private const string RollingbackValue = "Rollingback"; + private const string UpgradingValue = "Upgrading"; + + /// Unknown. + public static ComponentStatus Unknown { get; } = new ComponentStatus(UnknownValue); + /// Deployed. + public static ComponentStatus Deployed { get; } = new ComponentStatus(DeployedValue); + /// Uninstalled. + public static ComponentStatus Uninstalled { get; } = new ComponentStatus(UninstalledValue); + /// Superseded. + public static ComponentStatus Superseded { get; } = new ComponentStatus(SupersededValue); + /// Failed. + public static ComponentStatus Failed { get; } = new ComponentStatus(FailedValue); + /// Uninstalling. + public static ComponentStatus Uninstalling { get; } = new ComponentStatus(UninstallingValue); + /// Pending-Install. + public static ComponentStatus PendingInstall { get; } = new ComponentStatus(PendingInstallValue); + /// Pending-Upgrade. + public static ComponentStatus PendingUpgrade { get; } = new ComponentStatus(PendingUpgradeValue); + /// Pending-Rollback. + public static ComponentStatus PendingRollback { get; } = new ComponentStatus(PendingRollbackValue); + /// Downloading. + public static ComponentStatus Downloading { get; } = new ComponentStatus(DownloadingValue); + /// Installing. + public static ComponentStatus Installing { get; } = new ComponentStatus(InstallingValue); + /// Reinstalling. + public static ComponentStatus Reinstalling { get; } = new ComponentStatus(ReinstallingValue); + /// Rollingback. + public static ComponentStatus Rollingback { get; } = new ComponentStatus(RollingbackValue); + /// Upgrading. + public static ComponentStatus Upgrading { get; } = new ComponentStatus(UpgradingValue); + /// Determines if two values are the same. + public static bool operator ==(ComponentStatus left, ComponentStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ComponentStatus left, ComponentStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ComponentStatus(string value) => new ComponentStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ComponentStatus other && Equals(other); + /// + public bool Equals(ComponentStatus 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaData.Serialization.cs new file mode 100644 index 0000000000000..ecc80aa64b7cb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ConfigurationGroupSchemaData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static ConfigurationGroupSchemaData DeserializeConfigurationGroupSchemaData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ConfigurationGroupSchemaPropertiesFormat.DeserializeConfigurationGroupSchemaPropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new ConfigurationGroupSchemaData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.Serialization.cs new file mode 100644 index 0000000000000..729600d6cc9d3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ConfigurationGroupSchemaListResult + { + internal static ConfigurationGroupSchemaListResult DeserializeConfigurationGroupSchemaListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ConfigurationGroupSchemaListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.cs new file mode 100644 index 0000000000000..235872e24fa44 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of configuration group schema resources. + internal partial class ConfigurationGroupSchemaListResult + { + /// Initializes a new instance of ConfigurationGroupSchemaListResult. + internal ConfigurationGroupSchemaListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ConfigurationGroupSchemaListResult. + /// A list of configuration group schema. + /// The URL to get the next set of results. + internal ConfigurationGroupSchemaListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of configuration group schema. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..1d45906aeed69 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationGroupSchemaPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(SchemaDefinition)) + { + writer.WritePropertyName("schemaDefinition"u8); + writer.WriteStringValue(SchemaDefinition); + } + writer.WriteEndObject(); + } + + internal static ConfigurationGroupSchemaPropertiesFormat DeserializeConfigurationGroupSchemaPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional schemaDefinition = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("schemaDefinition"u8)) + { + schemaDefinition = property.Value.GetString(); + continue; + } + } + return new ConfigurationGroupSchemaPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, schemaDefinition.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.cs new file mode 100644 index 0000000000000..b4bed58f3146a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaPropertiesFormat.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Configuration group schema properties. + public partial class ConfigurationGroupSchemaPropertiesFormat + { + /// Initializes a new instance of ConfigurationGroupSchemaPropertiesFormat. + public ConfigurationGroupSchemaPropertiesFormat() + { + } + + /// Initializes a new instance of ConfigurationGroupSchemaPropertiesFormat. + /// The provisioning state of the Configuration group schema resource. + /// The configuration group schema version state. + /// Description of what schema can contain. + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + internal ConfigurationGroupSchemaPropertiesFormat(ProvisioningState? provisioningState, VersionState? versionState, string description, string schemaDefinition) + { + ProvisioningState = provisioningState; + VersionState = versionState; + Description = description; + SchemaDefinition = schemaDefinition; + } + + /// The provisioning state of the Configuration group schema resource. + public ProvisioningState? ProvisioningState { get; } + /// The configuration group schema version state. + public VersionState? VersionState { get; } + /// Description of what schema can contain. + public string Description { get; set; } + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + public string SchemaDefinition { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.Serialization.cs new file mode 100644 index 0000000000000..46f6a62f76fa5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationGroupSchemaVersionUpdateState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VersionState)) + { + writer.WritePropertyName("versionState"u8); + writer.WriteStringValue(VersionState.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ConfigurationGroupSchemaVersionUpdateState DeserializeConfigurationGroupSchemaVersionUpdateState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional versionState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + } + return new ConfigurationGroupSchemaVersionUpdateState(Optional.ToNullable(versionState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.cs new file mode 100644 index 0000000000000..7f5ba7f9f04a1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupSchemaVersionUpdateState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Publisher configuration group schema update request definition. + public partial class ConfigurationGroupSchemaVersionUpdateState + { + /// Initializes a new instance of ConfigurationGroupSchemaVersionUpdateState. + public ConfigurationGroupSchemaVersionUpdateState() + { + } + + /// Initializes a new instance of ConfigurationGroupSchemaVersionUpdateState. + /// The configuration group schema state. + internal ConfigurationGroupSchemaVersionUpdateState(VersionState? versionState) + { + VersionState = versionState; + } + + /// The configuration group schema state. + public VersionState? VersionState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueConfigurationType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueConfigurationType.cs new file mode 100644 index 0000000000000..c7ae4b71d0d7f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueConfigurationType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The secret type which indicates if secret or not. + internal readonly partial struct ConfigurationGroupValueConfigurationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConfigurationGroupValueConfigurationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SecretValue = "Secret"; + private const string OpenValue = "Open"; + + /// Unknown. + public static ConfigurationGroupValueConfigurationType Unknown { get; } = new ConfigurationGroupValueConfigurationType(UnknownValue); + /// Secret. + public static ConfigurationGroupValueConfigurationType Secret { get; } = new ConfigurationGroupValueConfigurationType(SecretValue); + /// Open. + public static ConfigurationGroupValueConfigurationType Open { get; } = new ConfigurationGroupValueConfigurationType(OpenValue); + /// Determines if two values are the same. + public static bool operator ==(ConfigurationGroupValueConfigurationType left, ConfigurationGroupValueConfigurationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConfigurationGroupValueConfigurationType left, ConfigurationGroupValueConfigurationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConfigurationGroupValueConfigurationType(string value) => new ConfigurationGroupValueConfigurationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConfigurationGroupValueConfigurationType other && Equals(other); + /// + public bool Equals(ConfigurationGroupValueConfigurationType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueData.Serialization.cs new file mode 100644 index 0000000000000..4ab1e101262ac --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class ConfigurationGroupValueData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static ConfigurationGroupValueData DeserializeConfigurationGroupValueData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ConfigurationGroupValuePropertiesFormat.DeserializeConfigurationGroupValuePropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new ConfigurationGroupValueData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.Serialization.cs new file mode 100644 index 0000000000000..efed310a886bc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ConfigurationGroupValueListResult + { + internal static ConfigurationGroupValueListResult DeserializeConfigurationGroupValueListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ConfigurationGroupValueListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.cs new file mode 100644 index 0000000000000..348ed688626a7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValueListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for hybrid configurationGroups API service call. + internal partial class ConfigurationGroupValueListResult + { + /// Initializes a new instance of ConfigurationGroupValueListResult. + internal ConfigurationGroupValueListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ConfigurationGroupValueListResult. + /// A list of hybrid configurationGroups. + /// The URL to get the next set of results. + internal ConfigurationGroupValueListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of hybrid configurationGroups. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..f504563dbdf4e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.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.HybridNetwork.Models +{ + public partial class ConfigurationGroupValuePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ConfigurationGroupSchemaResourceReference)) + { + writer.WritePropertyName("configurationGroupSchemaResourceReference"u8); + writer.WriteObjectValue(ConfigurationGroupSchemaResourceReference); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + writer.WriteEndObject(); + } + + internal static ConfigurationGroupValuePropertiesFormat DeserializeConfigurationGroupValuePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("configurationType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Open": return ConfigurationValueWithoutSecrets.DeserializeConfigurationValueWithoutSecrets(element); + case "Secret": return ConfigurationValueWithSecrets.DeserializeConfigurationValueWithSecrets(element); + } + } + return UnknownConfigurationGroupValuePropertiesFormat.DeserializeUnknownConfigurationGroupValuePropertiesFormat(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.cs new file mode 100644 index 0000000000000..d16f10164e72c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationGroupValuePropertiesFormat.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Hybrid configuration group value properties. + /// 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 ConfigurationGroupValuePropertiesFormat + { + /// Initializes a new instance of ConfigurationGroupValuePropertiesFormat. + protected ConfigurationGroupValuePropertiesFormat() + { + } + + /// Initializes a new instance of ConfigurationGroupValuePropertiesFormat. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// 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 . + /// + /// The value which indicates if configuration values are secrets. + internal ConfigurationGroupValuePropertiesFormat(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string configurationGroupSchemaName, string configurationGroupSchemaOfferingLocation, DeploymentResourceIdReference configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType configurationType) + { + ProvisioningState = provisioningState; + PublisherName = publisherName; + PublisherScope = publisherScope; + ConfigurationGroupSchemaName = configurationGroupSchemaName; + ConfigurationGroupSchemaOfferingLocation = configurationGroupSchemaOfferingLocation; + ConfigurationGroupSchemaResourceReference = configurationGroupSchemaResourceReference; + ConfigurationType = configurationType; + } + + /// The provisioning state of the site resource. + public ProvisioningState? ProvisioningState { get; } + /// The publisher name for the configuration group schema. + public string PublisherName { get; } + /// The scope of the publisher. + public PublisherScope? PublisherScope { get; } + /// The configuration group schema name. + public string ConfigurationGroupSchemaName { get; } + /// The location of the configuration group schema offering. + public string ConfigurationGroupSchemaOfferingLocation { get; } + /// + /// The configuration group schema resource reference. + /// 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 DeploymentResourceIdReference ConfigurationGroupSchemaResourceReference { get; set; } + /// The value which indicates if configuration values are secrets. + internal ConfigurationGroupValueConfigurationType ConfigurationType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.Serialization.cs new file mode 100644 index 0000000000000..e11e556de56d8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.Serialization.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationValueWithSecrets : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SecretConfigurationValue)) + { + writer.WritePropertyName("secretConfigurationValue"u8); + writer.WriteStringValue(SecretConfigurationValue); + } + if (Optional.IsDefined(ConfigurationGroupSchemaResourceReference)) + { + writer.WritePropertyName("configurationGroupSchemaResourceReference"u8); + writer.WriteObjectValue(ConfigurationGroupSchemaResourceReference); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + writer.WriteEndObject(); + } + + internal static ConfigurationValueWithSecrets DeserializeConfigurationValueWithSecrets(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional secretConfigurationValue = default; + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional configurationGroupSchemaName = default; + Optional configurationGroupSchemaOfferingLocation = default; + Optional configurationGroupSchemaResourceReference = default; + ConfigurationGroupValueConfigurationType configurationType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretConfigurationValue"u8)) + { + secretConfigurationValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurationGroupSchemaName"u8)) + { + configurationGroupSchemaName = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaOfferingLocation"u8)) + { + configurationGroupSchemaOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationGroupSchemaResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new ConfigurationGroupValueConfigurationType(property.Value.GetString()); + continue; + } + } + return new ConfigurationValueWithSecrets(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), configurationGroupSchemaName.Value, configurationGroupSchemaOfferingLocation.Value, configurationGroupSchemaResourceReference.Value, configurationType, secretConfigurationValue.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.cs new file mode 100644 index 0000000000000..1ea61092654bc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithSecrets.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The ConfigurationValue with secrets. + public partial class ConfigurationValueWithSecrets : ConfigurationGroupValuePropertiesFormat + { + /// Initializes a new instance of ConfigurationValueWithSecrets. + public ConfigurationValueWithSecrets() + { + ConfigurationType = ConfigurationGroupValueConfigurationType.Secret; + } + + /// Initializes a new instance of ConfigurationValueWithSecrets. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// 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 . + /// + /// The value which indicates if configuration values are secrets. + /// Name and value pairs that define the configuration value secrets. It can be a well formed escaped JSON string. + internal ConfigurationValueWithSecrets(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string configurationGroupSchemaName, string configurationGroupSchemaOfferingLocation, DeploymentResourceIdReference configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType configurationType, string secretConfigurationValue) : base(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, configurationType) + { + SecretConfigurationValue = secretConfigurationValue; + ConfigurationType = configurationType; + } + + /// Name and value pairs that define the configuration value secrets. It can be a well formed escaped JSON string. + public string SecretConfigurationValue { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.Serialization.cs new file mode 100644 index 0000000000000..d4143c149e923 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.Serialization.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ConfigurationValueWithoutSecrets : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ConfigurationValue)) + { + writer.WritePropertyName("configurationValue"u8); + writer.WriteStringValue(ConfigurationValue); + } + if (Optional.IsDefined(ConfigurationGroupSchemaResourceReference)) + { + writer.WritePropertyName("configurationGroupSchemaResourceReference"u8); + writer.WriteObjectValue(ConfigurationGroupSchemaResourceReference); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + writer.WriteEndObject(); + } + + internal static ConfigurationValueWithoutSecrets DeserializeConfigurationValueWithoutSecrets(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional configurationValue = default; + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional configurationGroupSchemaName = default; + Optional configurationGroupSchemaOfferingLocation = default; + Optional configurationGroupSchemaResourceReference = default; + ConfigurationGroupValueConfigurationType configurationType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configurationValue"u8)) + { + configurationValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurationGroupSchemaName"u8)) + { + configurationGroupSchemaName = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaOfferingLocation"u8)) + { + configurationGroupSchemaOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationGroupSchemaResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new ConfigurationGroupValueConfigurationType(property.Value.GetString()); + continue; + } + } + return new ConfigurationValueWithoutSecrets(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), configurationGroupSchemaName.Value, configurationGroupSchemaOfferingLocation.Value, configurationGroupSchemaResourceReference.Value, configurationType, configurationValue.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.cs new file mode 100644 index 0000000000000..189e8bce56fa0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ConfigurationValueWithoutSecrets.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The ConfigurationValue with no secrets. + public partial class ConfigurationValueWithoutSecrets : ConfigurationGroupValuePropertiesFormat + { + /// Initializes a new instance of ConfigurationValueWithoutSecrets. + public ConfigurationValueWithoutSecrets() + { + ConfigurationType = ConfigurationGroupValueConfigurationType.Open; + } + + /// Initializes a new instance of ConfigurationValueWithoutSecrets. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// 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 . + /// + /// The value which indicates if configuration values are secrets. + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + internal ConfigurationValueWithoutSecrets(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string configurationGroupSchemaName, string configurationGroupSchemaOfferingLocation, DeploymentResourceIdReference configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType configurationType, string configurationValue) : base(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, configurationType) + { + ConfigurationValue = configurationValue; + ConfigurationType = configurationType; + } + + /// Name and value pairs that define the configuration value. It can be a well formed escaped JSON string. + public string ConfigurationValue { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.Serialization.cs new file mode 100644 index 0000000000000..f22b65348fbfc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ContainerizedNetworkFunctionDefinitionVersion : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkFunctionTemplate)) + { + writer.WritePropertyName("networkFunctionTemplate"u8); + writer.WriteObjectValue(NetworkFunctionTemplate); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DeployParameters)) + { + writer.WritePropertyName("deployParameters"u8); + writer.WriteStringValue(DeployParameters); + } + writer.WritePropertyName("networkFunctionType"u8); + writer.WriteStringValue(NetworkFunctionType.ToString()); + writer.WriteEndObject(); + } + + internal static ContainerizedNetworkFunctionDefinitionVersion DeserializeContainerizedNetworkFunctionDefinitionVersion(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional networkFunctionTemplate = default; + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional deployParameters = default; + NetworkFunctionType networkFunctionType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionTemplate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionTemplate = ContainerizedNetworkFunctionTemplate.DeserializeContainerizedNetworkFunctionTemplate(property.Value); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("deployParameters"u8)) + { + deployParameters = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionType"u8)) + { + networkFunctionType = new NetworkFunctionType(property.Value.GetString()); + continue; + } + } + return new ContainerizedNetworkFunctionDefinitionVersion(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, deployParameters.Value, networkFunctionType, networkFunctionTemplate.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.cs new file mode 100644 index 0000000000000..6fec3cec65ece --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionDefinitionVersion.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Containerized network function network function definition version properties. + public partial class ContainerizedNetworkFunctionDefinitionVersion : NetworkFunctionDefinitionVersionPropertiesFormat + { + /// Initializes a new instance of ContainerizedNetworkFunctionDefinitionVersion. + public ContainerizedNetworkFunctionDefinitionVersion() + { + NetworkFunctionType = NetworkFunctionType.ContainerizedNetworkFunction; + } + + /// Initializes a new instance of ContainerizedNetworkFunctionDefinitionVersion. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + /// + /// Containerized network function template. + /// 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 . + /// + internal ContainerizedNetworkFunctionDefinitionVersion(ProvisioningState? provisioningState, VersionState? versionState, string description, string deployParameters, NetworkFunctionType networkFunctionType, ContainerizedNetworkFunctionTemplate networkFunctionTemplate) : base(provisioningState, versionState, description, deployParameters, networkFunctionType) + { + NetworkFunctionTemplate = networkFunctionTemplate; + NetworkFunctionType = networkFunctionType; + } + + /// + /// Containerized network function template. + /// 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 . + /// + public ContainerizedNetworkFunctionTemplate NetworkFunctionTemplate { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionNfviType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionNfviType.cs new file mode 100644 index 0000000000000..1694ceb9e68eb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionNfviType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The network function type. + internal readonly partial struct ContainerizedNetworkFunctionNfviType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ContainerizedNetworkFunctionNfviType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureArcKubernetesValue = "AzureArcKubernetes"; + + /// Unknown. + public static ContainerizedNetworkFunctionNfviType Unknown { get; } = new ContainerizedNetworkFunctionNfviType(UnknownValue); + /// AzureArcKubernetes. + public static ContainerizedNetworkFunctionNfviType AzureArcKubernetes { get; } = new ContainerizedNetworkFunctionNfviType(AzureArcKubernetesValue); + /// Determines if two values are the same. + public static bool operator ==(ContainerizedNetworkFunctionNfviType left, ContainerizedNetworkFunctionNfviType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ContainerizedNetworkFunctionNfviType left, ContainerizedNetworkFunctionNfviType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ContainerizedNetworkFunctionNfviType(string value) => new ContainerizedNetworkFunctionNfviType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ContainerizedNetworkFunctionNfviType other && Equals(other); + /// + public bool Equals(ContainerizedNetworkFunctionNfviType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 0000000000000..94ed73d63705b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ContainerizedNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static ContainerizedNetworkFunctionTemplate DeserializeContainerizedNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("nfviType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureArcKubernetes": return AzureArcKubernetesNetworkFunctionTemplate.DeserializeAzureArcKubernetesNetworkFunctionTemplate(element); + } + } + return UnknownContainerizedNetworkFunctionTemplate.DeserializeUnknownContainerizedNetworkFunctionTemplate(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.cs new file mode 100644 index 0000000000000..3b321acb7591c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ContainerizedNetworkFunctionTemplate.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Containerized network function template. + /// 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 . + /// + public abstract partial class ContainerizedNetworkFunctionTemplate + { + /// Initializes a new instance of ContainerizedNetworkFunctionTemplate. + protected ContainerizedNetworkFunctionTemplate() + { + } + + /// Initializes a new instance of ContainerizedNetworkFunctionTemplate. + /// The network function type. + internal ContainerizedNetworkFunctionTemplate(ContainerizedNetworkFunctionNfviType nfviType) + { + NfviType = nfviType; + } + + /// The network function type. + internal ContainerizedNetworkFunctionNfviType NfviType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/CredentialType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/CredentialType.cs new file mode 100644 index 0000000000000..125f2b2abb24e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/CredentialType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The credential type. + internal readonly partial struct CredentialType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CredentialType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureContainerRegistryScopedTokenValue = "AzureContainerRegistryScopedToken"; + private const string AzureStorageAccountTokenValue = "AzureStorageAccountToken"; + + /// Unknown. + public static CredentialType Unknown { get; } = new CredentialType(UnknownValue); + /// AzureContainerRegistryScopedToken. + public static CredentialType AzureContainerRegistryScopedToken { get; } = new CredentialType(AzureContainerRegistryScopedTokenValue); + /// AzureStorageAccountToken. + public static CredentialType AzureStorageAccountToken { get; } = new CredentialType(AzureStorageAccountTokenValue); + /// Determines if two values are the same. + public static bool operator ==(CredentialType left, CredentialType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CredentialType left, CredentialType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CredentialType(string value) => new CredentialType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CredentialType other && Equals(other); + /// + public bool Equals(CredentialType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.Serialization.cs new file mode 100644 index 0000000000000..76fd29485029b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.Serialization.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class DependsOnProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(InstallDependsOn)) + { + writer.WritePropertyName("installDependsOn"u8); + writer.WriteStartArray(); + foreach (var item in InstallDependsOn) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(UninstallDependsOn)) + { + writer.WritePropertyName("uninstallDependsOn"u8); + writer.WriteStartArray(); + foreach (var item in UninstallDependsOn) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(UpdateDependsOn)) + { + writer.WritePropertyName("updateDependsOn"u8); + writer.WriteStartArray(); + foreach (var item in UpdateDependsOn) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static DependsOnProfile DeserializeDependsOnProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> installDependsOn = default; + Optional> uninstallDependsOn = default; + Optional> updateDependsOn = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("installDependsOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + installDependsOn = array; + continue; + } + if (property.NameEquals("uninstallDependsOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + uninstallDependsOn = array; + continue; + } + if (property.NameEquals("updateDependsOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + updateDependsOn = array; + continue; + } + } + return new DependsOnProfile(Optional.ToList(installDependsOn), Optional.ToList(uninstallDependsOn), Optional.ToList(updateDependsOn)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.cs new file mode 100644 index 0000000000000..d838ee614d3a2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DependsOnProfile.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Depends on profile definition. + public partial class DependsOnProfile + { + /// Initializes a new instance of DependsOnProfile. + public DependsOnProfile() + { + InstallDependsOn = new ChangeTrackingList(); + UninstallDependsOn = new ChangeTrackingList(); + UpdateDependsOn = new ChangeTrackingList(); + } + + /// Initializes a new instance of DependsOnProfile. + /// Application installation operation dependency. + /// Application deletion operation dependency. + /// Application update operation dependency. + internal DependsOnProfile(IList installDependsOn, IList uninstallDependsOn, IList updateDependsOn) + { + InstallDependsOn = installDependsOn; + UninstallDependsOn = uninstallDependsOn; + UpdateDependsOn = updateDependsOn; + } + + /// Application installation operation dependency. + public IList InstallDependsOn { get; } + /// Application deletion operation dependency. + public IList UninstallDependsOn { get; } + /// Application update operation dependency. + public IList UpdateDependsOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.Serialization.cs new file mode 100644 index 0000000000000..b24c4fe9dfde4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.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.HybridNetwork.Models +{ + public partial class DeploymentResourceIdReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("idType"u8); + writer.WriteStringValue(IdType.ToString()); + writer.WriteEndObject(); + } + + internal static DeploymentResourceIdReference DeserializeDeploymentResourceIdReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("idType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Open": return OpenDeploymentResourceReference.DeserializeOpenDeploymentResourceReference(element); + case "Secret": return SecretDeploymentResourceReference.DeserializeSecretDeploymentResourceReference(element); + } + } + return UnknownDeploymentResourceIdReference.DeserializeUnknownDeploymentResourceIdReference(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.cs new file mode 100644 index 0000000000000..97514c2a17ab7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentResourceIdReference.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// The azure resource reference which is used for deployment. + /// 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 DeploymentResourceIdReference + { + /// Initializes a new instance of DeploymentResourceIdReference. + protected DeploymentResourceIdReference() + { + } + + /// Initializes a new instance of DeploymentResourceIdReference. + /// The resource reference arm id type. + internal DeploymentResourceIdReference(IdType idType) + { + IdType = idType; + } + + /// The resource reference arm id type. + internal IdType IdType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.Serialization.cs new file mode 100644 index 0000000000000..7ad1cc082728d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.Serialization.cs @@ -0,0 +1,58 @@ +// 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.HybridNetwork.Models +{ + public partial class DeploymentStatusProperties + { + internal static DeploymentStatusProperties DeserializeDeploymentStatusProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional resources = default; + Optional nextExpectedUpdateAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ComponentStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resources = ComponentKubernetesResources.DeserializeComponentKubernetesResources(property.Value); + continue; + } + if (property.NameEquals("nextExpectedUpdateAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextExpectedUpdateAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new DeploymentStatusProperties(Optional.ToNullable(status), resources.Value, Optional.ToNullable(nextExpectedUpdateAt)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.cs new file mode 100644 index 0000000000000..d0230b599b7f5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/DeploymentStatusProperties.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The deployment status properties of the network function component. + public partial class DeploymentStatusProperties + { + /// Initializes a new instance of DeploymentStatusProperties. + internal DeploymentStatusProperties() + { + } + + /// Initializes a new instance of DeploymentStatusProperties. + /// The status of the component resource. + /// The resource related to the component resource. + /// The next expected update of deployment status. + internal DeploymentStatusProperties(ComponentStatus? status, ComponentKubernetesResources resources, DateTimeOffset? nextExpectedUpdateOn) + { + Status = status; + Resources = resources; + NextExpectedUpdateOn = nextExpectedUpdateOn; + } + + /// The status of the component resource. + public ComponentStatus? Status { get; } + /// The resource related to the component resource. + public ComponentKubernetesResources Resources { get; } + /// The next expected update of deployment status. + public DateTimeOffset? NextExpectedUpdateOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.Serialization.cs new file mode 100644 index 0000000000000..a09a6fdd8de31 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.Serialization.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ExecuteRequestContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("serviceEndpoint"u8); + writer.WriteStringValue(ServiceEndpoint); + writer.WritePropertyName("requestMetadata"u8); + writer.WriteObjectValue(RequestMetadata); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.cs new file mode 100644 index 0000000000000..c0483b67c1df1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ExecuteRequestContent.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Payload for execute request post call. + public partial class ExecuteRequestContent + { + /// Initializes a new instance of ExecuteRequestContent. + /// The endpoint of service to call. + /// The request metadata. + /// or is null. + public ExecuteRequestContent(string serviceEndpoint, RequestMetadata requestMetadata) + { + Argument.AssertNotNull(serviceEndpoint, nameof(serviceEndpoint)); + Argument.AssertNotNull(requestMetadata, nameof(requestMetadata)); + + ServiceEndpoint = serviceEndpoint; + RequestMetadata = requestMetadata; + } + + /// The endpoint of service to call. + public string ServiceEndpoint { get; } + /// The request metadata. + public RequestMetadata RequestMetadata { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..0b0052f66b3fc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.Serialization.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(HelmPackageName)) + { + writer.WritePropertyName("helmPackageName"u8); + writer.WriteStringValue(HelmPackageName); + } + if (Optional.IsDefined(HelmPackageVersionRange)) + { + writer.WritePropertyName("helmPackageVersionRange"u8); + writer.WriteStringValue(HelmPackageVersionRange); + } + if (Optional.IsCollectionDefined(RegistryValuesPaths)) + { + writer.WritePropertyName("registryValuesPaths"u8); + writer.WriteStartArray(); + foreach (var item in RegistryValuesPaths) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ImagePullSecretsValuesPaths)) + { + writer.WritePropertyName("imagePullSecretsValuesPaths"u8); + writer.WriteStartArray(); + foreach (var item in ImagePullSecretsValuesPaths) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static HelmArtifactProfile DeserializeHelmArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional helmPackageName = default; + Optional helmPackageVersionRange = default; + Optional> registryValuesPaths = default; + Optional> imagePullSecretsValuesPaths = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("helmPackageName"u8)) + { + helmPackageName = property.Value.GetString(); + continue; + } + if (property.NameEquals("helmPackageVersionRange"u8)) + { + helmPackageVersionRange = property.Value.GetString(); + continue; + } + if (property.NameEquals("registryValuesPaths"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + registryValuesPaths = array; + continue; + } + if (property.NameEquals("imagePullSecretsValuesPaths"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + imagePullSecretsValuesPaths = array; + continue; + } + } + return new HelmArtifactProfile(helmPackageName.Value, helmPackageVersionRange.Value, Optional.ToList(registryValuesPaths), Optional.ToList(imagePullSecretsValuesPaths)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.cs new file mode 100644 index 0000000000000..7e6466ad5216a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmArtifactProfile.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm artifact profile. + public partial class HelmArtifactProfile + { + /// Initializes a new instance of HelmArtifactProfile. + public HelmArtifactProfile() + { + RegistryValuesPaths = new ChangeTrackingList(); + ImagePullSecretsValuesPaths = new ChangeTrackingList(); + } + + /// Initializes a new instance of HelmArtifactProfile. + /// Helm package name. + /// Helm package version range. + /// The registry values path list. + /// The image pull secrets values path list. + internal HelmArtifactProfile(string helmPackageName, string helmPackageVersionRange, IList registryValuesPaths, IList imagePullSecretsValuesPaths) + { + HelmPackageName = helmPackageName; + HelmPackageVersionRange = helmPackageVersionRange; + RegistryValuesPaths = registryValuesPaths; + ImagePullSecretsValuesPaths = imagePullSecretsValuesPaths; + } + + /// Helm package name. + public string HelmPackageName { get; set; } + /// Helm package version range. + public string HelmPackageVersionRange { get; set; } + /// The registry values path list. + public IList RegistryValuesPaths { get; } + /// The image pull secrets values path list. + public IList ImagePullSecretsValuesPaths { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.Serialization.cs new file mode 100644 index 0000000000000..1d5972d073e52 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmInstallConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Atomic)) + { + writer.WritePropertyName("atomic"u8); + writer.WriteStringValue(Atomic); + } + if (Optional.IsDefined(Wait)) + { + writer.WritePropertyName("wait"u8); + writer.WriteStringValue(Wait); + } + if (Optional.IsDefined(Timeout)) + { + writer.WritePropertyName("timeout"u8); + writer.WriteStringValue(Timeout); + } + writer.WriteEndObject(); + } + + internal static HelmInstallConfig DeserializeHelmInstallConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional atomic = default; + Optional wait = default; + Optional timeout = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("atomic"u8)) + { + atomic = property.Value.GetString(); + continue; + } + if (property.NameEquals("wait"u8)) + { + wait = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeout"u8)) + { + timeout = property.Value.GetString(); + continue; + } + } + return new HelmInstallConfig(atomic.Value, wait.Value, timeout.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.cs new file mode 100644 index 0000000000000..424097f4e324b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmInstallConfig.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The helm deployment install options. + public partial class HelmInstallConfig + { + /// Initializes a new instance of HelmInstallConfig. + public HelmInstallConfig() + { + } + + /// Initializes a new instance of HelmInstallConfig. + /// The helm deployment atomic options. + /// The helm deployment wait options. + /// The helm deployment timeout options. + internal HelmInstallConfig(string atomic, string wait, string timeout) + { + Atomic = atomic; + Wait = wait; + Timeout = timeout; + } + + /// The helm deployment atomic options. + public string Atomic { get; set; } + /// The helm deployment wait options. + public string Wait { get; set; } + /// The helm deployment timeout options. + public string Timeout { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..9ae20c6f4991f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ReleaseNamespace)) + { + writer.WritePropertyName("releaseNamespace"u8); + writer.WriteStringValue(ReleaseNamespace); + } + if (Optional.IsDefined(ReleaseName)) + { + writer.WritePropertyName("releaseName"u8); + writer.WriteStringValue(ReleaseName); + } + if (Optional.IsDefined(HelmPackageVersion)) + { + writer.WritePropertyName("helmPackageVersion"u8); + writer.WriteStringValue(HelmPackageVersion); + } + if (Optional.IsDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStringValue(Values); + } + if (Optional.IsDefined(Options)) + { + writer.WritePropertyName("options"u8); + writer.WriteObjectValue(Options); + } + writer.WriteEndObject(); + } + + internal static HelmMappingRuleProfile DeserializeHelmMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional releaseNamespace = default; + Optional releaseName = default; + Optional helmPackageVersion = default; + Optional values = default; + Optional options = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("releaseNamespace"u8)) + { + releaseNamespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("releaseName"u8)) + { + releaseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("helmPackageVersion"u8)) + { + helmPackageVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("values"u8)) + { + values = property.Value.GetString(); + continue; + } + if (property.NameEquals("options"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + options = HelmMappingRuleProfileConfig.DeserializeHelmMappingRuleProfileConfig(property.Value); + continue; + } + } + return new HelmMappingRuleProfile(releaseNamespace.Value, releaseName.Value, helmPackageVersion.Value, values.Value, options.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.cs new file mode 100644 index 0000000000000..5d23593686689 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfile.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm mapping rule profile. + public partial class HelmMappingRuleProfile + { + /// Initializes a new instance of HelmMappingRuleProfile. + public HelmMappingRuleProfile() + { + } + + /// Initializes a new instance of HelmMappingRuleProfile. + /// Helm release namespace. + /// Helm release name. + /// Helm package version. + /// Helm release values. + /// The helm deployment options. + internal HelmMappingRuleProfile(string releaseNamespace, string releaseName, string helmPackageVersion, string values, HelmMappingRuleProfileConfig options) + { + ReleaseNamespace = releaseNamespace; + ReleaseName = releaseName; + HelmPackageVersion = helmPackageVersion; + Values = values; + Options = options; + } + + /// Helm release namespace. + public string ReleaseNamespace { get; set; } + /// Helm release name. + public string ReleaseName { get; set; } + /// Helm package version. + public string HelmPackageVersion { get; set; } + /// Helm release values. + public string Values { get; set; } + /// The helm deployment options. + public HelmMappingRuleProfileConfig Options { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.Serialization.cs new file mode 100644 index 0000000000000..7e0e1e8e26a05 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmMappingRuleProfileConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(InstallOptions)) + { + writer.WritePropertyName("installOptions"u8); + writer.WriteObjectValue(InstallOptions); + } + if (Optional.IsDefined(UpgradeOptions)) + { + writer.WritePropertyName("upgradeOptions"u8); + writer.WriteObjectValue(UpgradeOptions); + } + writer.WriteEndObject(); + } + + internal static HelmMappingRuleProfileConfig DeserializeHelmMappingRuleProfileConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional installOptions = default; + Optional upgradeOptions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("installOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + installOptions = HelmInstallConfig.DeserializeHelmInstallConfig(property.Value); + continue; + } + if (property.NameEquals("upgradeOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradeOptions = HelmUpgradeConfig.DeserializeHelmUpgradeConfig(property.Value); + continue; + } + } + return new HelmMappingRuleProfileConfig(installOptions.Value, upgradeOptions.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.cs new file mode 100644 index 0000000000000..310bb760e0b9a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmMappingRuleProfileConfig.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The helm deployment options. + public partial class HelmMappingRuleProfileConfig + { + /// Initializes a new instance of HelmMappingRuleProfileConfig. + public HelmMappingRuleProfileConfig() + { + } + + /// Initializes a new instance of HelmMappingRuleProfileConfig. + /// The helm deployment install options. + /// The helm deployment upgrade options. + internal HelmMappingRuleProfileConfig(HelmInstallConfig installOptions, HelmUpgradeConfig upgradeOptions) + { + InstallOptions = installOptions; + UpgradeOptions = upgradeOptions; + } + + /// The helm deployment install options. + public HelmInstallConfig InstallOptions { get; set; } + /// The helm deployment upgrade options. + public HelmUpgradeConfig UpgradeOptions { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.Serialization.cs new file mode 100644 index 0000000000000..ab02d005e80bd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HelmUpgradeConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Atomic)) + { + writer.WritePropertyName("atomic"u8); + writer.WriteStringValue(Atomic); + } + if (Optional.IsDefined(Wait)) + { + writer.WritePropertyName("wait"u8); + writer.WriteStringValue(Wait); + } + if (Optional.IsDefined(Timeout)) + { + writer.WritePropertyName("timeout"u8); + writer.WriteStringValue(Timeout); + } + writer.WriteEndObject(); + } + + internal static HelmUpgradeConfig DeserializeHelmUpgradeConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional atomic = default; + Optional wait = default; + Optional timeout = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("atomic"u8)) + { + atomic = property.Value.GetString(); + continue; + } + if (property.NameEquals("wait"u8)) + { + wait = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeout"u8)) + { + timeout = property.Value.GetString(); + continue; + } + } + return new HelmUpgradeConfig(atomic.Value, wait.Value, timeout.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.cs new file mode 100644 index 0000000000000..8386119d09284 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HelmUpgradeConfig.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The helm deployment install options. + public partial class HelmUpgradeConfig + { + /// Initializes a new instance of HelmUpgradeConfig. + public HelmUpgradeConfig() + { + } + + /// Initializes a new instance of HelmUpgradeConfig. + /// The helm deployment atomic options. + /// The helm deployment wait options. + /// The helm deployment timeout options. + internal HelmUpgradeConfig(string atomic, string wait, string timeout) + { + Atomic = atomic; + Wait = wait; + Timeout = timeout; + } + + /// The helm deployment atomic options. + public string Atomic { get; set; } + /// The helm deployment wait options. + public string Wait { get; set; } + /// The helm deployment timeout options. + public string Timeout { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HttpMethod.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HttpMethod.cs new file mode 100644 index 0000000000000..69c294f7beaeb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HttpMethod.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.HybridNetwork.Models +{ + /// The http method of the request. + public readonly partial struct HttpMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HttpMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PostValue = "Post"; + private const string PutValue = "Put"; + private const string GetValue = "Get"; + private const string PatchValue = "Patch"; + private const string DeleteValue = "Delete"; + + /// Unknown. + public static HttpMethod Unknown { get; } = new HttpMethod(UnknownValue); + /// Post. + public static HttpMethod Post { get; } = new HttpMethod(PostValue); + /// Put. + public static HttpMethod Put { get; } = new HttpMethod(PutValue); + /// Get. + public static HttpMethod Get { get; } = new HttpMethod(GetValue); + /// Patch. + public static HttpMethod Patch { get; } = new HttpMethod(PatchValue); + /// Delete. + public static HttpMethod Delete { get; } = new HttpMethod(DeleteValue); + /// Determines if two values are the same. + public static bool operator ==(HttpMethod left, HttpMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HttpMethod left, HttpMethod right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HttpMethod(string value) => new HttpMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HttpMethod other && Equals(other); + /// + public bool Equals(HttpMethod 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.Serialization.cs new file mode 100644 index 0000000000000..aa01ed0631567 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class HybridNetworkSku : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.ToString()); + writer.WriteEndObject(); + } + + internal static HybridNetworkSku DeserializeHybridNetworkSku(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HybridNetworkSkuName name = default; + Optional tier = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = new HybridNetworkSkuName(property.Value.GetString()); + continue; + } + if (property.NameEquals("tier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = new HybridNetworkSkuTier(property.Value.GetString()); + continue; + } + } + return new HybridNetworkSku(name, Optional.ToNullable(tier)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.cs new file mode 100644 index 0000000000000..26e05b57abd7d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSku.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Sku, to be associated with a SiteNetworkService. + public partial class HybridNetworkSku + { + /// Initializes a new instance of HybridNetworkSku. + /// Name of this Sku. + public HybridNetworkSku(HybridNetworkSkuName name) + { + Name = name; + } + + /// Initializes a new instance of HybridNetworkSku. + /// Name of this Sku. + /// The SKU tier based on the SKU name. + internal HybridNetworkSku(HybridNetworkSkuName name, HybridNetworkSkuTier? tier) + { + Name = name; + Tier = tier; + } + + /// Name of this Sku. + public HybridNetworkSkuName Name { get; set; } + /// The SKU tier based on the SKU name. + public HybridNetworkSkuTier? Tier { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuName.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuName.cs new file mode 100644 index 0000000000000..db4f18a90a8f7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuName.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Name of this Sku. + public readonly partial struct HybridNetworkSkuName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HybridNetworkSkuName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BasicValue = "Basic"; + private const string StandardValue = "Standard"; + + /// Basic. + public static HybridNetworkSkuName Basic { get; } = new HybridNetworkSkuName(BasicValue); + /// Standard. + public static HybridNetworkSkuName Standard { get; } = new HybridNetworkSkuName(StandardValue); + /// Determines if two values are the same. + public static bool operator ==(HybridNetworkSkuName left, HybridNetworkSkuName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HybridNetworkSkuName left, HybridNetworkSkuName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HybridNetworkSkuName(string value) => new HybridNetworkSkuName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HybridNetworkSkuName other && Equals(other); + /// + public bool Equals(HybridNetworkSkuName 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuTier.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuTier.cs new file mode 100644 index 0000000000000..7dcb03ae6eccb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/HybridNetworkSkuTier.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The SKU tier based on the SKU name. + public readonly partial struct HybridNetworkSkuTier : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HybridNetworkSkuTier(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BasicValue = "Basic"; + private const string StandardValue = "Standard"; + + /// Basic. + public static HybridNetworkSkuTier Basic { get; } = new HybridNetworkSkuTier(BasicValue); + /// Standard. + public static HybridNetworkSkuTier Standard { get; } = new HybridNetworkSkuTier(StandardValue); + /// Determines if two values are the same. + public static bool operator ==(HybridNetworkSkuTier left, HybridNetworkSkuTier right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HybridNetworkSkuTier left, HybridNetworkSkuTier right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HybridNetworkSkuTier(string value) => new HybridNetworkSkuTier(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HybridNetworkSkuTier other && Equals(other); + /// + public bool Equals(HybridNetworkSkuTier 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/IdType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/IdType.cs new file mode 100644 index 0000000000000..ec050230ac4fc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/IdType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The resource reference arm id type. + internal readonly partial struct IdType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IdType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string OpenValue = "Open"; + private const string SecretValue = "Secret"; + + /// Unknown. + public static IdType Unknown { get; } = new IdType(UnknownValue); + /// Open. + public static IdType Open { get; } = new IdType(OpenValue); + /// Secret. + public static IdType Secret { get; } = new IdType(SecretValue); + /// Determines if two values are the same. + public static bool operator ==(IdType left, IdType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IdType left, IdType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator IdType(string value) => new IdType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IdType other && Equals(other); + /// + public bool Equals(IdType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..3dab8c70d494d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ImageArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ImageName)) + { + writer.WritePropertyName("imageName"u8); + writer.WriteStringValue(ImageName); + } + if (Optional.IsDefined(ImageVersion)) + { + writer.WritePropertyName("imageVersion"u8); + writer.WriteStringValue(ImageVersion); + } + writer.WriteEndObject(); + } + + internal static ImageArtifactProfile DeserializeImageArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional imageName = default; + Optional imageVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("imageName"u8)) + { + imageName = property.Value.GetString(); + continue; + } + if (property.NameEquals("imageVersion"u8)) + { + imageVersion = property.Value.GetString(); + continue; + } + } + return new ImageArtifactProfile(imageName.Value, imageVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.cs new file mode 100644 index 0000000000000..cc343ded631f6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageArtifactProfile.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Image artifact profile. + public partial class ImageArtifactProfile + { + /// Initializes a new instance of ImageArtifactProfile. + public ImageArtifactProfile() + { + } + + /// Initializes a new instance of ImageArtifactProfile. + /// Image name. + /// Image version. + internal ImageArtifactProfile(string imageName, string imageVersion) + { + ImageName = imageName; + ImageVersion = imageVersion; + } + + /// Image name. + public string ImageName { get; set; } + /// Image version. + public string ImageVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..323899bcbd498 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ImageMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(UserConfiguration)) + { + writer.WritePropertyName("userConfiguration"u8); + writer.WriteStringValue(UserConfiguration); + } + writer.WriteEndObject(); + } + + internal static ImageMappingRuleProfile DeserializeImageMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional userConfiguration = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("userConfiguration"u8)) + { + userConfiguration = property.Value.GetString(); + continue; + } + } + return new ImageMappingRuleProfile(userConfiguration.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.cs new file mode 100644 index 0000000000000..3332235f6b9bd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ImageMappingRuleProfile.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Image mapping rule profile. + internal partial class ImageMappingRuleProfile + { + /// Initializes a new instance of ImageMappingRuleProfile. + public ImageMappingRuleProfile() + { + } + + /// Initializes a new instance of ImageMappingRuleProfile. + /// List of values. + internal ImageMappingRuleProfile(string userConfiguration) + { + UserConfiguration = userConfiguration; + } + + /// List of values. + public string UserConfiguration { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.Serialization.cs new file mode 100644 index 0000000000000..5cc9afeac3276 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.Serialization.cs @@ -0,0 +1,100 @@ +// 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.HybridNetwork.Models +{ + public partial class KubernetesDaemonSet + { + internal static KubernetesDaemonSet DeserializeKubernetesDaemonSet(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional current = default; + Optional ready = default; + Optional upToDate = default; + Optional available = default; + Optional creationTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("current"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + current = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("upToDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upToDate = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("available"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + available = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KubernetesDaemonSet(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(current), Optional.ToNullable(ready), Optional.ToNullable(upToDate), Optional.ToNullable(available), Optional.ToNullable(creationTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.cs new file mode 100644 index 0000000000000..36d1ef89d6abc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDaemonSet.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm DaemonSet status properties. + public partial class KubernetesDaemonSet + { + /// Initializes a new instance of KubernetesDaemonSet. + internal KubernetesDaemonSet() + { + } + + /// Initializes a new instance of KubernetesDaemonSet. + /// The name of the daemonSet. + /// The namespace of the daemonSet. + /// Desired number of pods. + /// Current number of pods. + /// Number of Ready pods. + /// Number of upto date pods. + /// Number of available pods. + /// Creation Time of daemonSet. + internal KubernetesDaemonSet(string name, string @namespace, int? desiredNumberOfPods, int? currentNumberOfPods, int? readyNumberOfPods, int? upToDateNumberOfPods, int? availableNumberOfPods, DateTimeOffset? createdOn) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfPods = desiredNumberOfPods; + CurrentNumberOfPods = currentNumberOfPods; + ReadyNumberOfPods = readyNumberOfPods; + UpToDateNumberOfPods = upToDateNumberOfPods; + AvailableNumberOfPods = availableNumberOfPods; + CreatedOn = createdOn; + } + + /// The name of the daemonSet. + public string Name { get; } + /// The namespace of the daemonSet. + public string Namespace { get; } + /// Desired number of pods. + public int? DesiredNumberOfPods { get; } + /// Current number of pods. + public int? CurrentNumberOfPods { get; } + /// Number of Ready pods. + public int? ReadyNumberOfPods { get; } + /// Number of upto date pods. + public int? UpToDateNumberOfPods { get; } + /// Number of available pods. + public int? AvailableNumberOfPods { get; } + /// Creation Time of daemonSet. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.Serialization.cs new file mode 100644 index 0000000000000..f24f94f46d680 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.Serialization.cs @@ -0,0 +1,90 @@ +// 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.HybridNetwork.Models +{ + public partial class KubernetesDeployment + { + internal static KubernetesDeployment DeserializeKubernetesDeployment(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional ready = default; + Optional upToDate = default; + Optional available = default; + Optional creationTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("upToDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upToDate = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("available"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + available = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KubernetesDeployment(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(ready), Optional.ToNullable(upToDate), Optional.ToNullable(available), Optional.ToNullable(creationTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.cs new file mode 100644 index 0000000000000..a7fe2f9b6c408 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesDeployment.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm Deployment status properties. + public partial class KubernetesDeployment + { + /// Initializes a new instance of KubernetesDeployment. + internal KubernetesDeployment() + { + } + + /// Initializes a new instance of KubernetesDeployment. + /// The name of the deployment. + /// The namespace of the deployment. + /// Desired number of pods. + /// Number of ready pods. + /// Number of upto date pods. + /// Number of available pods. + /// Creation Time of deployment. + internal KubernetesDeployment(string name, string @namespace, int? desiredNumberOfPods, int? readyNumberOfPods, int? upToDateNumberOfPods, int? availableNumberOfPods, DateTimeOffset? createdOn) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfPods = desiredNumberOfPods; + ReadyNumberOfPods = readyNumberOfPods; + UpToDateNumberOfPods = upToDateNumberOfPods; + AvailableNumberOfPods = availableNumberOfPods; + CreatedOn = createdOn; + } + + /// The name of the deployment. + public string Name { get; } + /// The namespace of the deployment. + public string Namespace { get; } + /// Desired number of pods. + public int? DesiredNumberOfPods { get; } + /// Number of ready pods. + public int? ReadyNumberOfPods { get; } + /// Number of upto date pods. + public int? UpToDateNumberOfPods { get; } + /// Number of available pods. + public int? AvailableNumberOfPods { get; } + /// Creation Time of deployment. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.Serialization.cs new file mode 100644 index 0000000000000..03257a7bbb932 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.Serialization.cs @@ -0,0 +1,96 @@ +// 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; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class KubernetesPod + { + internal static KubernetesPod DeserializeKubernetesPod(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional ready = default; + Optional status = default; + Optional creationTime = default; + Optional> events = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new PodStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("events"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PodEvent.DeserializePodEvent(item)); + } + events = array; + continue; + } + } + return new KubernetesPod(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(ready), Optional.ToNullable(status), Optional.ToNullable(creationTime), Optional.ToList(events)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.cs new file mode 100644 index 0000000000000..a1fce6de7302b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesPod.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm Pod status properties. + public partial class KubernetesPod + { + /// Initializes a new instance of KubernetesPod. + internal KubernetesPod() + { + Events = new ChangeTrackingList(); + } + + /// Initializes a new instance of KubernetesPod. + /// The name of the Pod. + /// The namespace of the Pod. + /// Desired number of containers. + /// Number of ready containers. + /// The status of a pod. + /// Creation Time of Pod. + /// Last 5 Pod events. + internal KubernetesPod(string name, string @namespace, int? desiredNumberOfContainers, int? readyNumberOfContainers, PodStatus? status, DateTimeOffset? createdOn, IReadOnlyList events) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfContainers = desiredNumberOfContainers; + ReadyNumberOfContainers = readyNumberOfContainers; + Status = status; + CreatedOn = createdOn; + Events = events; + } + + /// The name of the Pod. + public string Name { get; } + /// The namespace of the Pod. + public string Namespace { get; } + /// Desired number of containers. + public int? DesiredNumberOfContainers { get; } + /// Number of ready containers. + public int? ReadyNumberOfContainers { get; } + /// The status of a pod. + public PodStatus? Status { get; } + /// Creation Time of Pod. + public DateTimeOffset? CreatedOn { get; } + /// Last 5 Pod events. + public IReadOnlyList Events { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.Serialization.cs new file mode 100644 index 0000000000000..b4c5375d30097 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.Serialization.cs @@ -0,0 +1,80 @@ +// 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.HybridNetwork.Models +{ + public partial class KubernetesReplicaSet + { + internal static KubernetesReplicaSet DeserializeKubernetesReplicaSet(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional ready = default; + Optional current = default; + Optional creationTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("current"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + current = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KubernetesReplicaSet(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(ready), Optional.ToNullable(current), Optional.ToNullable(creationTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.cs new file mode 100644 index 0000000000000..7e165e964605f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesReplicaSet.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm ReplicaSet status properties. + public partial class KubernetesReplicaSet + { + /// Initializes a new instance of KubernetesReplicaSet. + internal KubernetesReplicaSet() + { + } + + /// Initializes a new instance of KubernetesReplicaSet. + /// The name of the replicaSet. + /// The namespace of the replicaSet. + /// Desired number of pods. + /// Number of ready pods. + /// Number of current pods. + /// Creation Time of replicaSet. + internal KubernetesReplicaSet(string name, string @namespace, int? desiredNumberOfPods, int? readyNumberOfPods, int? currentNumberOfPods, DateTimeOffset? createdOn) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfPods = desiredNumberOfPods; + ReadyNumberOfPods = readyNumberOfPods; + CurrentNumberOfPods = currentNumberOfPods; + CreatedOn = createdOn; + } + + /// The name of the replicaSet. + public string Name { get; } + /// The namespace of the replicaSet. + public string Namespace { get; } + /// Desired number of pods. + public int? DesiredNumberOfPods { get; } + /// Number of ready pods. + public int? ReadyNumberOfPods { get; } + /// Number of current pods. + public int? CurrentNumberOfPods { get; } + /// Creation Time of replicaSet. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.Serialization.cs new file mode 100644 index 0000000000000..7e9db26ac7578 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.Serialization.cs @@ -0,0 +1,70 @@ +// 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.HybridNetwork.Models +{ + public partial class KubernetesStatefulSet + { + internal static KubernetesStatefulSet DeserializeKubernetesStatefulSet(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + Optional desired = default; + Optional ready = default; + Optional creationTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("desired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desired = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("ready"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ready = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KubernetesStatefulSet(name.Value, @namespace.Value, Optional.ToNullable(desired), Optional.ToNullable(ready), Optional.ToNullable(creationTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.cs new file mode 100644 index 0000000000000..49b1b3da637b6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/KubernetesStatefulSet.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Helm StatefulSet status properties. + public partial class KubernetesStatefulSet + { + /// Initializes a new instance of KubernetesStatefulSet. + internal KubernetesStatefulSet() + { + } + + /// Initializes a new instance of KubernetesStatefulSet. + /// The name of the statefulset. + /// The namespace of the statefulset. + /// Desired number of pods. + /// Number of ready pods. + /// Creation Time of statefulset. + internal KubernetesStatefulSet(string name, string @namespace, int? desiredNumberOfPods, int? readyNumberOfPods, DateTimeOffset? createdOn) + { + Name = name; + Namespace = @namespace; + DesiredNumberOfPods = desiredNumberOfPods; + ReadyNumberOfPods = readyNumberOfPods; + CreatedOn = createdOn; + } + + /// The name of the statefulset. + public string Name { get; } + /// The namespace of the statefulset. + public string Namespace { get; } + /// Desired number of pods. + public int? DesiredNumberOfPods { get; } + /// Number of ready pods. + public int? ReadyNumberOfPods { get; } + /// Creation Time of statefulset. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.Serialization.cs new file mode 100644 index 0000000000000..5dc87cb829d6d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ManagedResourceGroupConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + writer.WriteEndObject(); + } + + internal static ManagedResourceGroupConfiguration DeserializeManagedResourceGroupConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional location = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + } + return new ManagedResourceGroupConfiguration(name.Value, Optional.ToNullable(location)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.cs new file mode 100644 index 0000000000000..625bf5a1d452b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManagedResourceGroupConfiguration.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Managed resource group configuration. + public partial class ManagedResourceGroupConfiguration + { + /// Initializes a new instance of ManagedResourceGroupConfiguration. + public ManagedResourceGroupConfiguration() + { + } + + /// Initializes a new instance of ManagedResourceGroupConfiguration. + /// Managed resource group name. + /// Managed resource group location. + internal ManagedResourceGroupConfiguration(string name, AzureLocation? location) + { + Name = name; + Location = location; + } + + /// Managed resource group name. + public string Name { get; set; } + /// Managed resource group location. + public AzureLocation? Location { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.Serialization.cs new file mode 100644 index 0000000000000..80169399a63fd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ManifestArtifactFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactName)) + { + writer.WritePropertyName("artifactName"u8); + writer.WriteStringValue(ArtifactName); + } + if (Optional.IsDefined(ArtifactType)) + { + writer.WritePropertyName("artifactType"u8); + writer.WriteStringValue(ArtifactType.Value.ToString()); + } + if (Optional.IsDefined(ArtifactVersion)) + { + writer.WritePropertyName("artifactVersion"u8); + writer.WriteStringValue(ArtifactVersion); + } + writer.WriteEndObject(); + } + + internal static ManifestArtifactFormat DeserializeManifestArtifactFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactName = default; + Optional artifactType = default; + Optional artifactVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactName"u8)) + { + artifactName = property.Value.GetString(); + continue; + } + if (property.NameEquals("artifactType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactType = new ArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("artifactVersion"u8)) + { + artifactVersion = property.Value.GetString(); + continue; + } + } + return new ManifestArtifactFormat(artifactName.Value, Optional.ToNullable(artifactType), artifactVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.cs new file mode 100644 index 0000000000000..1660df45e27fe --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ManifestArtifactFormat.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Manifest artifact properties. + public partial class ManifestArtifactFormat + { + /// Initializes a new instance of ManifestArtifactFormat. + public ManifestArtifactFormat() + { + } + + /// Initializes a new instance of ManifestArtifactFormat. + /// The artifact name. + /// The artifact type. + /// The artifact version. + internal ManifestArtifactFormat(string artifactName, ArtifactType? artifactType, string artifactVersion) + { + ArtifactName = artifactName; + ArtifactType = artifactType; + ArtifactVersion = artifactVersion; + } + + /// The artifact name. + public string ArtifactName { get; set; } + /// The artifact type. + public ArtifactType? ArtifactType { get; set; } + /// The artifact version. + public string ArtifactVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..de095515aa7a2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class MappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ApplicationEnablement)) + { + writer.WritePropertyName("applicationEnablement"u8); + writer.WriteStringValue(ApplicationEnablement.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static MappingRuleProfile DeserializeMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional applicationEnablement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("applicationEnablement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationEnablement = new ApplicationEnablement(property.Value.GetString()); + continue; + } + } + return new MappingRuleProfile(Optional.ToNullable(applicationEnablement)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.cs new file mode 100644 index 0000000000000..0980994573284 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/MappingRuleProfile.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Mapping rule profile properties. + public partial class MappingRuleProfile + { + /// Initializes a new instance of MappingRuleProfile. + public MappingRuleProfile() + { + } + + /// Initializes a new instance of MappingRuleProfile. + /// The application enablement. + internal MappingRuleProfile(ApplicationEnablement? applicationEnablement) + { + ApplicationEnablement = applicationEnablement; + } + + /// The application enablement. + public ApplicationEnablement? ApplicationEnablement { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.Serialization.cs new file mode 100644 index 0000000000000..6fd40da433850 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NFVIs : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static NFVIs DeserializeNFVIs(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("nfviType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureArcKubernetes": return AzureArcK8SClusterNfviDetails.DeserializeAzureArcK8SClusterNfviDetails(element); + case "AzureCore": return AzureCoreNfviDetails.DeserializeAzureCoreNfviDetails(element); + case "AzureOperatorNexus": return AzureOperatorNexusClusterNfviDetails.DeserializeAzureOperatorNexusClusterNfviDetails(element); + } + } + return UnknownNFVIs.DeserializeUnknownNFVIs(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.cs new file mode 100644 index 0000000000000..e0198644dec0f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NFVIs.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// The NFVI object. + /// 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 NFVIs + { + /// Initializes a new instance of NFVIs. + protected NFVIs() + { + } + + /// Initializes a new instance of NFVIs. + /// Name of the nfvi. + /// The NFVI type. + internal NFVIs(string name, NfviType nfviType) + { + Name = name; + NfviType = nfviType; + } + + /// Name of the nfvi. + public string Name { get; set; } + /// The NFVI type. + internal NfviType NfviType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..e5c6e56173950 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NSDArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ArtifactStoreReference)) + { + writer.WritePropertyName("artifactStoreReference"u8); + JsonSerializer.Serialize(writer, ArtifactStoreReference); + } + if (Optional.IsDefined(ArtifactName)) + { + writer.WritePropertyName("artifactName"u8); + writer.WriteStringValue(ArtifactName); + } + if (Optional.IsDefined(ArtifactVersion)) + { + writer.WritePropertyName("artifactVersion"u8); + writer.WriteStringValue(ArtifactVersion); + } + writer.WriteEndObject(); + } + + internal static NSDArtifactProfile DeserializeNSDArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactStoreReference = default; + Optional artifactName = default; + Optional artifactVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactStoreReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactStoreReference = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("artifactName"u8)) + { + artifactName = property.Value.GetString(); + continue; + } + if (property.NameEquals("artifactVersion"u8)) + { + artifactVersion = property.Value.GetString(); + continue; + } + } + return new NSDArtifactProfile(artifactStoreReference, artifactName.Value, artifactVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.cs new file mode 100644 index 0000000000000..b58202c8ca1e0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NSDArtifactProfile.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Artifact profile properties. + public partial class NSDArtifactProfile + { + /// Initializes a new instance of NSDArtifactProfile. + public NSDArtifactProfile() + { + } + + /// Initializes a new instance of NSDArtifactProfile. + /// The artifact store resource id. + /// Artifact name. + /// Artifact version. + internal NSDArtifactProfile(WritableSubResource artifactStoreReference, string artifactName, string artifactVersion) + { + ArtifactStoreReference = artifactStoreReference; + ArtifactName = artifactName; + ArtifactVersion = artifactVersion; + } + + /// The artifact store resource id. + internal WritableSubResource ArtifactStoreReference { get; set; } + /// Gets or sets Id. + public ResourceIdentifier ArtifactStoreReferenceId + { + get => ArtifactStoreReference is null ? default : ArtifactStoreReference.Id; + set + { + if (ArtifactStoreReference is null) + ArtifactStoreReference = new WritableSubResource(); + ArtifactStoreReference.Id = value; + } + } + + /// Artifact name. + public string ArtifactName { get; set; } + /// Artifact version. + public string ArtifactVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.Serialization.cs new file mode 100644 index 0000000000000..31dd5fe608c14 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionApplication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionApplication DeserializeNetworkFunctionApplication(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new NetworkFunctionApplication(name.Value, dependsOnProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.cs new file mode 100644 index 0000000000000..160719e4b617e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionApplication.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Network function application definition. + public partial class NetworkFunctionApplication + { + /// Initializes a new instance of NetworkFunctionApplication. + public NetworkFunctionApplication() + { + } + + /// Initializes a new instance of NetworkFunctionApplication. + /// The name of the network function application. + /// Depends on profile definition. + internal NetworkFunctionApplication(string name, DependsOnProfile dependsOnProfile) + { + Name = name; + DependsOnProfile = dependsOnProfile; + } + + /// The name of the network function application. + public string Name { get; set; } + /// Depends on profile definition. + public DependsOnProfile DependsOnProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionConfigurationType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionConfigurationType.cs new file mode 100644 index 0000000000000..153f22f75b77d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionConfigurationType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The secret type which indicates if secret or not. + internal readonly partial struct NetworkFunctionConfigurationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NetworkFunctionConfigurationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SecretValue = "Secret"; + private const string OpenValue = "Open"; + + /// Unknown. + public static NetworkFunctionConfigurationType Unknown { get; } = new NetworkFunctionConfigurationType(UnknownValue); + /// Secret. + public static NetworkFunctionConfigurationType Secret { get; } = new NetworkFunctionConfigurationType(SecretValue); + /// Open. + public static NetworkFunctionConfigurationType Open { get; } = new NetworkFunctionConfigurationType(OpenValue); + /// Determines if two values are the same. + public static bool operator ==(NetworkFunctionConfigurationType left, NetworkFunctionConfigurationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NetworkFunctionConfigurationType left, NetworkFunctionConfigurationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NetworkFunctionConfigurationType(string value) => new NetworkFunctionConfigurationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NetworkFunctionConfigurationType other && Equals(other); + /// + public bool Equals(NetworkFunctionConfigurationType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionData.Serialization.cs new file mode 100644 index 0000000000000..f5eb0c7f9eadf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionData.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkFunctionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + 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.WriteEndObject(); + } + + internal static NetworkFunctionData DeserializeNetworkFunctionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional etag = default; + Optional identity = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkFunctionPropertiesFormat.DeserializeNetworkFunctionPropertiesFormat(property.Value); + continue; + } + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + 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; + } + } + return new NetworkFunctionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, Optional.ToNullable(etag), identity); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupData.Serialization.cs new file mode 100644 index 0000000000000..594115ab9e8c8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkFunctionDefinitionGroupData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionGroupData DeserializeNetworkFunctionDefinitionGroupData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkFunctionDefinitionGroupPropertiesFormat.DeserializeNetworkFunctionDefinitionGroupPropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new NetworkFunctionDefinitionGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.Serialization.cs new file mode 100644 index 0000000000000..419e09dc029fb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkFunctionDefinitionGroupListResult + { + internal static NetworkFunctionDefinitionGroupListResult DeserializeNetworkFunctionDefinitionGroupListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkFunctionDefinitionGroupListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.cs new file mode 100644 index 0000000000000..33a67d2605e1f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of network function definition group resources. + internal partial class NetworkFunctionDefinitionGroupListResult + { + /// Initializes a new instance of NetworkFunctionDefinitionGroupListResult. + internal NetworkFunctionDefinitionGroupListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupListResult. + /// A list of network function definition group. + /// The URL to get the next set of results. + internal NetworkFunctionDefinitionGroupListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network function definition group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..6bda3eb90d539 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionDefinitionGroupPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionGroupPropertiesFormat DeserializeNetworkFunctionDefinitionGroupPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new NetworkFunctionDefinitionGroupPropertiesFormat(Optional.ToNullable(provisioningState), description.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.cs new file mode 100644 index 0000000000000..74eb4756f021b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionGroupPropertiesFormat.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Network function definition group properties. + public partial class NetworkFunctionDefinitionGroupPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionDefinitionGroupPropertiesFormat. + public NetworkFunctionDefinitionGroupPropertiesFormat() + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupPropertiesFormat. + /// The provisioning state of the network function definition groups resource. + /// The network function definition group description. + internal NetworkFunctionDefinitionGroupPropertiesFormat(ProvisioningState? provisioningState, string description) + { + ProvisioningState = provisioningState; + Description = description; + } + + /// The provisioning state of the network function definition groups resource. + public ProvisioningState? ProvisioningState { get; } + /// The network function definition group description. + public string Description { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.Serialization.cs new file mode 100644 index 0000000000000..eaa5624b1532d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionDefinitionResourceElementTemplateDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Configuration)) + { + writer.WritePropertyName("configuration"u8); + writer.WriteObjectValue(Configuration); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceElementType.ToString()); + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionResourceElementTemplateDetails DeserializeNetworkFunctionDefinitionResourceElementTemplateDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional configuration = default; + Optional name = default; + Type type = default; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("configuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = ArmResourceDefinitionResourceElementTemplate.DeserializeArmResourceDefinitionResourceElementTemplate(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new Type(property.Value.GetString()); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new NetworkFunctionDefinitionResourceElementTemplateDetails(name.Value, type, dependsOnProfile.Value, configuration.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.cs new file mode 100644 index 0000000000000..a26a6d740fbcf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionResourceElementTemplateDetails.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The network function definition resource element template details. + public partial class NetworkFunctionDefinitionResourceElementTemplateDetails : ResourceElementTemplate + { + /// Initializes a new instance of NetworkFunctionDefinitionResourceElementTemplateDetails. + public NetworkFunctionDefinitionResourceElementTemplateDetails() + { + ResourceElementType = Type.NetworkFunctionDefinition; + } + + /// Initializes a new instance of NetworkFunctionDefinitionResourceElementTemplateDetails. + /// Name of the resource element template. + /// The resource element template type. + /// The depends on profile. + /// The resource element template type. + internal NetworkFunctionDefinitionResourceElementTemplateDetails(string name, Type resourceElementType, DependsOnProfile dependsOnProfile, ArmResourceDefinitionResourceElementTemplate configuration) : base(name, resourceElementType, dependsOnProfile) + { + Configuration = configuration; + ResourceElementType = resourceElementType; + } + + /// The resource element template type. + public ArmResourceDefinitionResourceElementTemplate Configuration { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionData.Serialization.cs new file mode 100644 index 0000000000000..9bb8c856d3765 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkFunctionDefinitionVersionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionVersionData DeserializeNetworkFunctionDefinitionVersionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkFunctionDefinitionVersionPropertiesFormat.DeserializeNetworkFunctionDefinitionVersionPropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new NetworkFunctionDefinitionVersionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.Serialization.cs new file mode 100644 index 0000000000000..8cc0f92ee8a73 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkFunctionDefinitionVersionListResult + { + internal static NetworkFunctionDefinitionVersionListResult DeserializeNetworkFunctionDefinitionVersionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkFunctionDefinitionVersionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.cs new file mode 100644 index 0000000000000..10679f87e7dc3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of network function definition versions. + internal partial class NetworkFunctionDefinitionVersionListResult + { + /// Initializes a new instance of NetworkFunctionDefinitionVersionListResult. + internal NetworkFunctionDefinitionVersionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionListResult. + /// A list of network function definition versions. + /// The URI to get the next set of results. + internal NetworkFunctionDefinitionVersionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network function definition versions. + public IReadOnlyList Value { get; } + /// The URI to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..8fe6e75e2a8d4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionDefinitionVersionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DeployParameters)) + { + writer.WritePropertyName("deployParameters"u8); + writer.WriteStringValue(DeployParameters); + } + writer.WritePropertyName("networkFunctionType"u8); + writer.WriteStringValue(NetworkFunctionType.ToString()); + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionVersionPropertiesFormat DeserializeNetworkFunctionDefinitionVersionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("networkFunctionType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ContainerizedNetworkFunction": return ContainerizedNetworkFunctionDefinitionVersion.DeserializeContainerizedNetworkFunctionDefinitionVersion(element); + case "VirtualNetworkFunction": return VirtualNetworkFunctionDefinitionVersion.DeserializeVirtualNetworkFunctionDefinitionVersion(element); + } + } + return UnknownNetworkFunctionDefinitionVersionPropertiesFormat.DeserializeUnknownNetworkFunctionDefinitionVersionPropertiesFormat(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.cs new file mode 100644 index 0000000000000..1c8faadbb141b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionPropertiesFormat.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Network function definition version properties. + /// 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 NetworkFunctionDefinitionVersionPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionDefinitionVersionPropertiesFormat. + protected NetworkFunctionDefinitionVersionPropertiesFormat() + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionPropertiesFormat. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + internal NetworkFunctionDefinitionVersionPropertiesFormat(ProvisioningState? provisioningState, VersionState? versionState, string description, string deployParameters, NetworkFunctionType networkFunctionType) + { + ProvisioningState = provisioningState; + VersionState = versionState; + Description = description; + DeployParameters = deployParameters; + NetworkFunctionType = networkFunctionType; + } + + /// The provisioning state of the network function definition version resource. + public ProvisioningState? ProvisioningState { get; } + /// The network function definition version state. + public VersionState? VersionState { get; } + /// The network function definition version description. + public string Description { get; set; } + /// The deployment parameters of the network function definition version. + public string DeployParameters { get; set; } + /// The network function type. + internal NetworkFunctionType NetworkFunctionType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.Serialization.cs new file mode 100644 index 0000000000000..f564748fa4410 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionDefinitionVersionUpdateState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VersionState)) + { + writer.WritePropertyName("versionState"u8); + writer.WriteStringValue(VersionState.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionDefinitionVersionUpdateState DeserializeNetworkFunctionDefinitionVersionUpdateState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional versionState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + } + return new NetworkFunctionDefinitionVersionUpdateState(Optional.ToNullable(versionState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.cs new file mode 100644 index 0000000000000..c57987d178eaa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionDefinitionVersionUpdateState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Publisher network function definition version update request definition. + public partial class NetworkFunctionDefinitionVersionUpdateState + { + /// Initializes a new instance of NetworkFunctionDefinitionVersionUpdateState. + public NetworkFunctionDefinitionVersionUpdateState() + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionUpdateState. + /// The network function definition version state. Only the 'Active' and 'Deprecated' states are allowed for updates. Other states are used for internal state transitioning. + internal NetworkFunctionDefinitionVersionUpdateState(VersionState? versionState) + { + VersionState = versionState; + } + + /// The network function definition version state. Only the 'Active' and 'Deprecated' states are allowed for updates. Other states are used for internal state transitioning. + public VersionState? VersionState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.Serialization.cs new file mode 100644 index 0000000000000..cd9a68e50fe25 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkFunctionListResult + { + internal static NetworkFunctionListResult DeserializeNetworkFunctionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkFunctionData.DeserializeNetworkFunctionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkFunctionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.cs new file mode 100644 index 0000000000000..454a35d893d76 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for network function API service call. + internal partial class NetworkFunctionListResult + { + /// Initializes a new instance of NetworkFunctionListResult. + internal NetworkFunctionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkFunctionListResult. + /// A list of network function resources in a subscription or resource group. + /// The URL to get the next set of results. + internal NetworkFunctionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network function resources in a subscription or resource group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..c1330298d410b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkFunctionDefinitionVersionResourceReference)) + { + writer.WritePropertyName("networkFunctionDefinitionVersionResourceReference"u8); + writer.WriteObjectValue(NetworkFunctionDefinitionVersionResourceReference); + } + if (Optional.IsDefined(NfviType)) + { + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.Value.ToString()); + } + if (Optional.IsDefined(NfviId)) + { + writer.WritePropertyName("nfviId"u8); + writer.WriteStringValue(NfviId); + } + if (Optional.IsDefined(AllowSoftwareUpdate)) + { + writer.WritePropertyName("allowSoftwareUpdate"u8); + writer.WriteBooleanValue(AllowSoftwareUpdate.Value); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + if (Optional.IsCollectionDefined(RoleOverrideValues)) + { + writer.WritePropertyName("roleOverrideValues"u8); + writer.WriteStartArray(); + foreach (var item in RoleOverrideValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionPropertiesFormat DeserializeNetworkFunctionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("configurationType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Open": return NetworkFunctionValueWithoutSecrets.DeserializeNetworkFunctionValueWithoutSecrets(element); + case "Secret": return NetworkFunctionValueWithSecrets.DeserializeNetworkFunctionValueWithSecrets(element); + } + } + return UnknownNetworkFunctionPropertiesFormat.DeserializeUnknownNetworkFunctionPropertiesFormat(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.cs new file mode 100644 index 0000000000000..9173e0acad67d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionPropertiesFormat.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Network function properties. + /// 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 NetworkFunctionPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionPropertiesFormat. + protected NetworkFunctionPropertiesFormat() + { + RoleOverrideValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkFunctionPropertiesFormat. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// 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 . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + internal NetworkFunctionPropertiesFormat(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersion, string networkFunctionDefinitionOfferingLocation, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference, NfviType? nfviType, ResourceIdentifier nfviId, bool? allowSoftwareUpdate, NetworkFunctionConfigurationType configurationType, IList roleOverrideValues) + { + ProvisioningState = provisioningState; + PublisherName = publisherName; + PublisherScope = publisherScope; + NetworkFunctionDefinitionGroupName = networkFunctionDefinitionGroupName; + NetworkFunctionDefinitionVersion = networkFunctionDefinitionVersion; + NetworkFunctionDefinitionOfferingLocation = networkFunctionDefinitionOfferingLocation; + NetworkFunctionDefinitionVersionResourceReference = networkFunctionDefinitionVersionResourceReference; + NfviType = nfviType; + NfviId = nfviId; + AllowSoftwareUpdate = allowSoftwareUpdate; + ConfigurationType = configurationType; + RoleOverrideValues = roleOverrideValues; + } + + /// The provisioning state of the network function resource. + public ProvisioningState? ProvisioningState { get; } + /// The publisher name for the network function. + public string PublisherName { get; } + /// The scope of the publisher. + public PublisherScope? PublisherScope { get; } + /// The network function definition group name for the network function. + public string NetworkFunctionDefinitionGroupName { get; } + /// The network function definition version for the network function. + public string NetworkFunctionDefinitionVersion { get; } + /// The location of the network function definition offering. + public string NetworkFunctionDefinitionOfferingLocation { get; } + /// + /// The network function definition version resource reference. + /// 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 DeploymentResourceIdReference NetworkFunctionDefinitionVersionResourceReference { get; set; } + /// The nfvi type for the network function. + public NfviType? NfviType { get; set; } + /// The nfviId for the network function. + public ResourceIdentifier NfviId { get; set; } + /// Indicates if software updates are allowed during deployment. + public bool? AllowSoftwareUpdate { get; set; } + /// The value which indicates if NF values are secrets. + internal NetworkFunctionConfigurationType ConfigurationType { get; set; } + /// The role configuration override values from the user. + public IList RoleOverrideValues { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionType.cs new file mode 100644 index 0000000000000..896585ee058e9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The network function type. + internal readonly partial struct NetworkFunctionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NetworkFunctionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string VirtualNetworkFunctionValue = "VirtualNetworkFunction"; + private const string ContainerizedNetworkFunctionValue = "ContainerizedNetworkFunction"; + + /// Unknown. + public static NetworkFunctionType Unknown { get; } = new NetworkFunctionType(UnknownValue); + /// VirtualNetworkFunction. + public static NetworkFunctionType VirtualNetworkFunction { get; } = new NetworkFunctionType(VirtualNetworkFunctionValue); + /// ContainerizedNetworkFunction. + public static NetworkFunctionType ContainerizedNetworkFunction { get; } = new NetworkFunctionType(ContainerizedNetworkFunctionValue); + /// Determines if two values are the same. + public static bool operator ==(NetworkFunctionType left, NetworkFunctionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NetworkFunctionType left, NetworkFunctionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NetworkFunctionType(string value) => new NetworkFunctionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NetworkFunctionType other && Equals(other); + /// + public bool Equals(NetworkFunctionType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.Serialization.cs new file mode 100644 index 0000000000000..ef969d1b9d5d0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionValueWithSecrets : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SecretDeploymentValues)) + { + writer.WritePropertyName("secretDeploymentValues"u8); + writer.WriteStringValue(SecretDeploymentValues); + } + if (Optional.IsDefined(NetworkFunctionDefinitionVersionResourceReference)) + { + writer.WritePropertyName("networkFunctionDefinitionVersionResourceReference"u8); + writer.WriteObjectValue(NetworkFunctionDefinitionVersionResourceReference); + } + if (Optional.IsDefined(NfviType)) + { + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.Value.ToString()); + } + if (Optional.IsDefined(NfviId)) + { + writer.WritePropertyName("nfviId"u8); + writer.WriteStringValue(NfviId); + } + if (Optional.IsDefined(AllowSoftwareUpdate)) + { + writer.WritePropertyName("allowSoftwareUpdate"u8); + writer.WriteBooleanValue(AllowSoftwareUpdate.Value); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + if (Optional.IsCollectionDefined(RoleOverrideValues)) + { + writer.WritePropertyName("roleOverrideValues"u8); + writer.WriteStartArray(); + foreach (var item in RoleOverrideValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionValueWithSecrets DeserializeNetworkFunctionValueWithSecrets(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional secretDeploymentValues = default; + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional networkFunctionDefinitionGroupName = default; + Optional networkFunctionDefinitionVersion = default; + Optional networkFunctionDefinitionOfferingLocation = default; + Optional networkFunctionDefinitionVersionResourceReference = default; + Optional nfviType = default; + Optional nfviId = default; + Optional allowSoftwareUpdate = default; + NetworkFunctionConfigurationType configurationType = default; + Optional> roleOverrideValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretDeploymentValues"u8)) + { + secretDeploymentValues = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkFunctionDefinitionGroupName"u8)) + { + networkFunctionDefinitionGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersion"u8)) + { + networkFunctionDefinitionVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionOfferingLocation"u8)) + { + networkFunctionDefinitionOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersionResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionDefinitionVersionResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviType = new NfviType(property.Value.GetString()); + continue; + } + if (property.NameEquals("nfviId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("allowSoftwareUpdate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowSoftwareUpdate = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new NetworkFunctionConfigurationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("roleOverrideValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roleOverrideValues = array; + continue; + } + } + return new NetworkFunctionValueWithSecrets(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), networkFunctionDefinitionGroupName.Value, networkFunctionDefinitionVersion.Value, networkFunctionDefinitionOfferingLocation.Value, networkFunctionDefinitionVersionResourceReference.Value, Optional.ToNullable(nfviType), nfviId.Value, Optional.ToNullable(allowSoftwareUpdate), configurationType, Optional.ToList(roleOverrideValues), secretDeploymentValues.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.cs new file mode 100644 index 0000000000000..be0d175ac9449 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithSecrets.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// NetworkFunction with secrets. + public partial class NetworkFunctionValueWithSecrets : NetworkFunctionPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionValueWithSecrets. + public NetworkFunctionValueWithSecrets() + { + ConfigurationType = NetworkFunctionConfigurationType.Secret; + } + + /// Initializes a new instance of NetworkFunctionValueWithSecrets. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// 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 . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + /// The JSON-serialized secret deployment values from the user. This contains secrets like passwords,keys etc. + internal NetworkFunctionValueWithSecrets(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersion, string networkFunctionDefinitionOfferingLocation, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference, NfviType? nfviType, ResourceIdentifier nfviId, bool? allowSoftwareUpdate, NetworkFunctionConfigurationType configurationType, IList roleOverrideValues, string secretDeploymentValues) : base(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, configurationType, roleOverrideValues) + { + SecretDeploymentValues = secretDeploymentValues; + ConfigurationType = configurationType; + } + + /// The JSON-serialized secret deployment values from the user. This contains secrets like passwords,keys etc. + public string SecretDeploymentValues { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.Serialization.cs new file mode 100644 index 0000000000000..e9802d70b20cb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkFunctionValueWithoutSecrets : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DeploymentValues)) + { + writer.WritePropertyName("deploymentValues"u8); + writer.WriteStringValue(DeploymentValues); + } + if (Optional.IsDefined(NetworkFunctionDefinitionVersionResourceReference)) + { + writer.WritePropertyName("networkFunctionDefinitionVersionResourceReference"u8); + writer.WriteObjectValue(NetworkFunctionDefinitionVersionResourceReference); + } + if (Optional.IsDefined(NfviType)) + { + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.Value.ToString()); + } + if (Optional.IsDefined(NfviId)) + { + writer.WritePropertyName("nfviId"u8); + writer.WriteStringValue(NfviId); + } + if (Optional.IsDefined(AllowSoftwareUpdate)) + { + writer.WritePropertyName("allowSoftwareUpdate"u8); + writer.WriteBooleanValue(AllowSoftwareUpdate.Value); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + if (Optional.IsCollectionDefined(RoleOverrideValues)) + { + writer.WritePropertyName("roleOverrideValues"u8); + writer.WriteStartArray(); + foreach (var item in RoleOverrideValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static NetworkFunctionValueWithoutSecrets DeserializeNetworkFunctionValueWithoutSecrets(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional deploymentValues = default; + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional networkFunctionDefinitionGroupName = default; + Optional networkFunctionDefinitionVersion = default; + Optional networkFunctionDefinitionOfferingLocation = default; + Optional networkFunctionDefinitionVersionResourceReference = default; + Optional nfviType = default; + Optional nfviId = default; + Optional allowSoftwareUpdate = default; + NetworkFunctionConfigurationType configurationType = default; + Optional> roleOverrideValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deploymentValues"u8)) + { + deploymentValues = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkFunctionDefinitionGroupName"u8)) + { + networkFunctionDefinitionGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersion"u8)) + { + networkFunctionDefinitionVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionOfferingLocation"u8)) + { + networkFunctionDefinitionOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersionResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionDefinitionVersionResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviType = new NfviType(property.Value.GetString()); + continue; + } + if (property.NameEquals("nfviId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("allowSoftwareUpdate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowSoftwareUpdate = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new NetworkFunctionConfigurationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("roleOverrideValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roleOverrideValues = array; + continue; + } + } + return new NetworkFunctionValueWithoutSecrets(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), networkFunctionDefinitionGroupName.Value, networkFunctionDefinitionVersion.Value, networkFunctionDefinitionOfferingLocation.Value, networkFunctionDefinitionVersionResourceReference.Value, Optional.ToNullable(nfviType), nfviId.Value, Optional.ToNullable(allowSoftwareUpdate), configurationType, Optional.ToList(roleOverrideValues), deploymentValues.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.cs new file mode 100644 index 0000000000000..e507614c18a2c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkFunctionValueWithoutSecrets.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// NetworkFunction with no secrets. + public partial class NetworkFunctionValueWithoutSecrets : NetworkFunctionPropertiesFormat + { + /// Initializes a new instance of NetworkFunctionValueWithoutSecrets. + public NetworkFunctionValueWithoutSecrets() + { + ConfigurationType = NetworkFunctionConfigurationType.Open; + } + + /// Initializes a new instance of NetworkFunctionValueWithoutSecrets. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// 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 . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + /// The JSON-serialized deployment values from the user. + internal NetworkFunctionValueWithoutSecrets(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersion, string networkFunctionDefinitionOfferingLocation, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference, NfviType? nfviType, ResourceIdentifier nfviId, bool? allowSoftwareUpdate, NetworkFunctionConfigurationType configurationType, IList roleOverrideValues, string deploymentValues) : base(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, configurationType, roleOverrideValues) + { + DeploymentValues = deploymentValues; + ConfigurationType = configurationType; + } + + /// The JSON-serialized deployment values from the user. + public string DeploymentValues { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupData.Serialization.cs new file mode 100644 index 0000000000000..3bfab6247a2f5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkServiceDesignGroupData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static NetworkServiceDesignGroupData DeserializeNetworkServiceDesignGroupData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkServiceDesignGroupPropertiesFormat.DeserializeNetworkServiceDesignGroupPropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new NetworkServiceDesignGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.Serialization.cs new file mode 100644 index 0000000000000..be91ce7b595da --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkServiceDesignGroupListResult + { + internal static NetworkServiceDesignGroupListResult DeserializeNetworkServiceDesignGroupListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkServiceDesignGroupListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.cs new file mode 100644 index 0000000000000..fd8d409c368ab --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of network service design group resources. + internal partial class NetworkServiceDesignGroupListResult + { + /// Initializes a new instance of NetworkServiceDesignGroupListResult. + internal NetworkServiceDesignGroupListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkServiceDesignGroupListResult. + /// A list of network service design group. + /// The URL to get the next set of results. + internal NetworkServiceDesignGroupListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network service design group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..b4f21212cdca2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkServiceDesignGroupPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static NetworkServiceDesignGroupPropertiesFormat DeserializeNetworkServiceDesignGroupPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new NetworkServiceDesignGroupPropertiesFormat(Optional.ToNullable(provisioningState), description.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.cs new file mode 100644 index 0000000000000..18e674c2aab3b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignGroupPropertiesFormat.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// network service design group properties. + public partial class NetworkServiceDesignGroupPropertiesFormat + { + /// Initializes a new instance of NetworkServiceDesignGroupPropertiesFormat. + public NetworkServiceDesignGroupPropertiesFormat() + { + } + + /// Initializes a new instance of NetworkServiceDesignGroupPropertiesFormat. + /// The provisioning state of the network service design groups resource. + /// The network service design group description. + internal NetworkServiceDesignGroupPropertiesFormat(ProvisioningState? provisioningState, string description) + { + ProvisioningState = provisioningState; + Description = description; + } + + /// The provisioning state of the network service design groups resource. + public ProvisioningState? ProvisioningState { get; } + /// The network service design group description. + public string Description { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionData.Serialization.cs new file mode 100644 index 0000000000000..8e18ff7399c52 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class NetworkServiceDesignVersionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static NetworkServiceDesignVersionData DeserializeNetworkServiceDesignVersionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkServiceDesignVersionPropertiesFormat.DeserializeNetworkServiceDesignVersionPropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new NetworkServiceDesignVersionData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.Serialization.cs new file mode 100644 index 0000000000000..864bbc04577f0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class NetworkServiceDesignVersionListResult + { + internal static NetworkServiceDesignVersionListResult DeserializeNetworkServiceDesignVersionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new NetworkServiceDesignVersionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.cs new file mode 100644 index 0000000000000..140faf5f8faa6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of network service design versions. + internal partial class NetworkServiceDesignVersionListResult + { + /// Initializes a new instance of NetworkServiceDesignVersionListResult. + internal NetworkServiceDesignVersionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkServiceDesignVersionListResult. + /// A list of network service design versions. + /// The URI to get the next set of results. + internal NetworkServiceDesignVersionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of network service design versions. + public IReadOnlyList Value { get; } + /// The URI to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..a360a7affbb7e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.Serialization.cs @@ -0,0 +1,143 @@ +// 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.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkServiceDesignVersionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(ConfigurationGroupSchemaReferences)) + { + writer.WritePropertyName("configurationGroupSchemaReferences"u8); + writer.WriteStartObject(); + foreach (var item in ConfigurationGroupSchemaReferences) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(NfvisFromSite)) + { + writer.WritePropertyName("nfvisFromSite"u8); + writer.WriteStartObject(); + foreach (var item in NfvisFromSite) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(ResourceElementTemplates)) + { + writer.WritePropertyName("resourceElementTemplates"u8); + writer.WriteStartArray(); + foreach (var item in ResourceElementTemplates) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static NetworkServiceDesignVersionPropertiesFormat DeserializeNetworkServiceDesignVersionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional> configurationGroupSchemaReferences = default; + Optional> nfvisFromSite = default; + Optional> resourceElementTemplates = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); + } + configurationGroupSchemaReferences = dictionary; + continue; + } + if (property.NameEquals("nfvisFromSite"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, NfviDetails.DeserializeNfviDetails(property0.Value)); + } + nfvisFromSite = dictionary; + continue; + } + if (property.NameEquals("resourceElementTemplates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceElementTemplate.DeserializeResourceElementTemplate(item)); + } + resourceElementTemplates = array; + continue; + } + } + return new NetworkServiceDesignVersionPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, Optional.ToDictionary(configurationGroupSchemaReferences), Optional.ToDictionary(nfvisFromSite), Optional.ToList(resourceElementTemplates)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.cs new file mode 100644 index 0000000000000..a59c693fdf249 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionPropertiesFormat.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// network service design version properties. + public partial class NetworkServiceDesignVersionPropertiesFormat + { + /// Initializes a new instance of NetworkServiceDesignVersionPropertiesFormat. + public NetworkServiceDesignVersionPropertiesFormat() + { + ConfigurationGroupSchemaReferences = new ChangeTrackingDictionary(); + NfvisFromSite = new ChangeTrackingDictionary(); + ResourceElementTemplates = new ChangeTrackingList(); + } + + /// Initializes a new instance of NetworkServiceDesignVersionPropertiesFormat. + /// The provisioning state of the network service design version resource. + /// The network service design version state. + /// The network service design version description. + /// The configuration schemas to used to define the values. + /// The nfvis from the site. + /// + /// List of resource element template + /// 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 . + /// + internal NetworkServiceDesignVersionPropertiesFormat(ProvisioningState? provisioningState, VersionState? versionState, string description, IDictionary configurationGroupSchemaReferences, IDictionary nfvisFromSite, IList resourceElementTemplates) + { + ProvisioningState = provisioningState; + VersionState = versionState; + Description = description; + ConfigurationGroupSchemaReferences = configurationGroupSchemaReferences; + NfvisFromSite = nfvisFromSite; + ResourceElementTemplates = resourceElementTemplates; + } + + /// The provisioning state of the network service design version resource. + public ProvisioningState? ProvisioningState { get; } + /// The network service design version state. + public VersionState? VersionState { get; } + /// The network service design version description. + public string Description { get; set; } + /// The configuration schemas to used to define the values. + public IDictionary ConfigurationGroupSchemaReferences { get; } + /// The nfvis from the site. + public IDictionary NfvisFromSite { get; } + /// + /// List of resource element template + /// 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 IList ResourceElementTemplates { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.Serialization.cs new file mode 100644 index 0000000000000..0740839c2460d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NetworkServiceDesignVersionUpdateState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VersionState)) + { + writer.WritePropertyName("versionState"u8); + writer.WriteStringValue(VersionState.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static NetworkServiceDesignVersionUpdateState DeserializeNetworkServiceDesignVersionUpdateState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional versionState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + } + return new NetworkServiceDesignVersionUpdateState(Optional.ToNullable(versionState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.cs new file mode 100644 index 0000000000000..3c6520e8e390b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NetworkServiceDesignVersionUpdateState.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Publisher network service design version update request definition. + public partial class NetworkServiceDesignVersionUpdateState + { + /// Initializes a new instance of NetworkServiceDesignVersionUpdateState. + public NetworkServiceDesignVersionUpdateState() + { + } + + /// Initializes a new instance of NetworkServiceDesignVersionUpdateState. + /// The network service design version state. + internal NetworkServiceDesignVersionUpdateState(VersionState? versionState) + { + VersionState = versionState; + } + + /// The network service design version state. + public VersionState? VersionState { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.Serialization.cs new file mode 100644 index 0000000000000..4178fc737f29f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class NfviDetails : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(NfviDetailsType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(NfviDetailsType); + } + writer.WriteEndObject(); + } + + internal static NfviDetails DeserializeNfviDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + } + return new NfviDetails(name.Value, type.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.cs new file mode 100644 index 0000000000000..1162b0bcdd73d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviDetails.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The nfvi details. + public partial class NfviDetails + { + /// Initializes a new instance of NfviDetails. + public NfviDetails() + { + } + + /// Initializes a new instance of NfviDetails. + /// The nfvi name. + /// The nfvi type. + internal NfviDetails(string name, string nfviDetailsType) + { + Name = name; + NfviDetailsType = nfviDetailsType; + } + + /// The nfvi name. + public string Name { get; set; } + /// The nfvi type. + public string NfviDetailsType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviType.cs new file mode 100644 index 0000000000000..fd8e7c0b0cf05 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/NfviType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The NFVI type. + public readonly partial struct NfviType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NfviType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureArcKubernetesValue = "AzureArcKubernetes"; + private const string AzureCoreValue = "AzureCore"; + private const string AzureOperatorNexusValue = "AzureOperatorNexus"; + + /// Unknown. + public static NfviType Unknown { get; } = new NfviType(UnknownValue); + /// AzureArcKubernetes. + public static NfviType AzureArcKubernetes { get; } = new NfviType(AzureArcKubernetesValue); + /// AzureCore. + public static NfviType AzureCore { get; } = new NfviType(AzureCoreValue); + /// AzureOperatorNexus. + public static NfviType AzureOperatorNexus { get; } = new NfviType(AzureOperatorNexusValue); + /// Determines if two values are the same. + public static bool operator ==(NfviType left, NfviType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NfviType left, NfviType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NfviType(string value) => new NfviType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NfviType other && Equals(other); + /// + public bool Equals(NfviType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.Serialization.cs new file mode 100644 index 0000000000000..528a6c571d65a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class OpenDeploymentResourceReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("idType"u8); + writer.WriteStringValue(IdType.ToString()); + writer.WriteEndObject(); + } + + internal static OpenDeploymentResourceReference DeserializeOpenDeploymentResourceReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + IdType idType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("idType"u8)) + { + idType = new IdType(property.Value.GetString()); + continue; + } + } + return new OpenDeploymentResourceReference(idType, id.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.cs new file mode 100644 index 0000000000000..26483943ed6b0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/OpenDeploymentResourceReference.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Non secret deployment resource id reference. + public partial class OpenDeploymentResourceReference : DeploymentResourceIdReference + { + /// Initializes a new instance of OpenDeploymentResourceReference. + public OpenDeploymentResourceReference() + { + IdType = IdType.Open; + } + + /// Initializes a new instance of OpenDeploymentResourceReference. + /// The resource reference arm id type. + /// Resource ID. + internal OpenDeploymentResourceReference(IdType idType, ResourceIdentifier id) : base(idType) + { + Id = id; + IdType = idType; + } + + /// Resource ID. + public ResourceIdentifier Id { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.Serialization.cs new file mode 100644 index 0000000000000..ed9a93b0657a3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.Serialization.cs @@ -0,0 +1,60 @@ +// 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.HybridNetwork.Models +{ + public partial class PodEvent + { + internal static PodEvent DeserializePodEvent(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional type = default; + Optional reason = default; + Optional message = default; + Optional lastSeenTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new PodEventType(property.Value.GetString()); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastSeenTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeenTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new PodEvent(Optional.ToNullable(type), reason.Value, message.Value, Optional.ToNullable(lastSeenTime)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.cs new file mode 100644 index 0000000000000..79aff77232a12 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEvent.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Pod Event properties. + public partial class PodEvent + { + /// Initializes a new instance of PodEvent. + internal PodEvent() + { + } + + /// Initializes a new instance of PodEvent. + /// The type of pod event. + /// Event reason. + /// Event message. + /// Event Last seen. + internal PodEvent(PodEventType? eventType, string reason, string message, DateTimeOffset? lastSeenOn) + { + EventType = eventType; + Reason = reason; + Message = message; + LastSeenOn = lastSeenOn; + } + + /// The type of pod event. + public PodEventType? EventType { get; } + /// Event reason. + public string Reason { get; } + /// Event message. + public string Message { get; } + /// Event Last seen. + public DateTimeOffset? LastSeenOn { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEventType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEventType.cs new file mode 100644 index 0000000000000..e1e6d39c4291b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodEventType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The type of pod event. + public readonly partial struct PodEventType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PodEventType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NormalValue = "Normal"; + private const string WarningValue = "Warning"; + + /// Normal. + public static PodEventType Normal { get; } = new PodEventType(NormalValue); + /// Warning. + public static PodEventType Warning { get; } = new PodEventType(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(PodEventType left, PodEventType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PodEventType left, PodEventType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PodEventType(string value) => new PodEventType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PodEventType other && Equals(other); + /// + public bool Equals(PodEventType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodStatus.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodStatus.cs new file mode 100644 index 0000000000000..8d4542e11257c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PodStatus.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The status of a Pod. + public readonly partial struct PodStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PodStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string RunningValue = "Running"; + private const string PendingValue = "Pending"; + private const string TerminatingValue = "Terminating"; + private const string NotReadyValue = "NotReady"; + + /// Unknown. + public static PodStatus Unknown { get; } = new PodStatus(UnknownValue); + /// Succeeded. + public static PodStatus Succeeded { get; } = new PodStatus(SucceededValue); + /// Failed. + public static PodStatus Failed { get; } = new PodStatus(FailedValue); + /// Running. + public static PodStatus Running { get; } = new PodStatus(RunningValue); + /// Pending. + public static PodStatus Pending { get; } = new PodStatus(PendingValue); + /// Terminating. + public static PodStatus Terminating { get; } = new PodStatus(TerminatingValue); + /// NotReady. + public static PodStatus NotReady { get; } = new PodStatus(NotReadyValue); + /// Determines if two values are the same. + public static bool operator ==(PodStatus left, PodStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PodStatus left, PodStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PodStatus(string value) => new PodStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PodStatus other && Equals(other); + /// + public bool Equals(PodStatus 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProvisioningState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..228b8c7d6c859 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The current provisioning state. + 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 UnknownValue = "Unknown"; + private const string SucceededValue = "Succeeded"; + private const string AcceptedValue = "Accepted"; + private const string DeletingValue = "Deleting"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string DeletedValue = "Deleted"; + private const string ConvergingValue = "Converging"; + + /// Unknown. + public static ProvisioningState Unknown { get; } = new ProvisioningState(UnknownValue); + /// Succeeded. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Deleting. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// Failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Deleted. + public static ProvisioningState Deleted { get; } = new ProvisioningState(DeletedValue); + /// Converging. + public static ProvisioningState Converging { get; } = new ProvisioningState(ConvergingValue); + /// 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.Serialization.cs new file mode 100644 index 0000000000000..dbfc56099470a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ProxyArtifactListOverview : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ProxyArtifactListOverview DeserializeProxyArtifactListOverview(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + 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; + } + } + return new ProxyArtifactListOverview(id, name, type, systemData.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.cs new file mode 100644 index 0000000000000..df28a00eaea78 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactListOverview.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The proxy artifact overview. + public partial class ProxyArtifactListOverview : ResourceData + { + /// Initializes a new instance of ProxyArtifactListOverview. + public ProxyArtifactListOverview() + { + } + + /// Initializes a new instance of ProxyArtifactListOverview. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + internal ProxyArtifactListOverview(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData) : base(id, name, resourceType, systemData) + { + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.Serialization.cs new file mode 100644 index 0000000000000..744774ea1e546 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ProxyArtifactOverviewListResult + { + internal static ProxyArtifactOverviewListResult DeserializeProxyArtifactOverviewListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProxyArtifactListOverview.DeserializeProxyArtifactListOverview(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ProxyArtifactOverviewListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.cs new file mode 100644 index 0000000000000..567b60bfcd848 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The proxy artifact list result. + internal partial class ProxyArtifactOverviewListResult + { + /// Initializes a new instance of ProxyArtifactOverviewListResult. + internal ProxyArtifactOverviewListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ProxyArtifactOverviewListResult. + /// A list of available proxy artifacts. + /// The URL to get the next set of results. + internal ProxyArtifactOverviewListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of available proxy artifacts. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.Serialization.cs new file mode 100644 index 0000000000000..c278acfbcce31 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ProxyArtifactOverviewPropertiesValue + { + internal static ProxyArtifactOverviewPropertiesValue DeserializeProxyArtifactOverviewPropertiesValue(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional artifactType = default; + Optional artifactVersion = default; + Optional artifactState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("artifactType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactType = new ArtifactType(property.Value.GetString()); + continue; + } + if (property.NameEquals("artifactVersion"u8)) + { + artifactVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("artifactState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactState = new ArtifactState(property.Value.GetString()); + continue; + } + } + return new ProxyArtifactOverviewPropertiesValue(Optional.ToNullable(artifactType), artifactVersion.Value, Optional.ToNullable(artifactState)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.cs new file mode 100644 index 0000000000000..a33efeda7e1e1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactOverviewPropertiesValue.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The ProxyArtifactOverviewPropertiesValue. + public partial class ProxyArtifactOverviewPropertiesValue + { + /// Initializes a new instance of ProxyArtifactOverviewPropertiesValue. + internal ProxyArtifactOverviewPropertiesValue() + { + } + + /// Initializes a new instance of ProxyArtifactOverviewPropertiesValue. + /// The artifact type. + /// The artifact version. + /// The artifact state. + internal ProxyArtifactOverviewPropertiesValue(ArtifactType? artifactType, string artifactVersion, ArtifactState? artifactState) + { + ArtifactType = artifactType; + ArtifactVersion = artifactVersion; + ArtifactState = artifactState; + } + + /// The artifact type. + public ArtifactType? ArtifactType { get; } + /// The artifact version. + public string ArtifactVersion { get; } + /// The artifact state. + public ArtifactState? ArtifactState { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.Serialization.cs new file mode 100644 index 0000000000000..12e44af16f5dd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.Serialization.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ProxyArtifactVersionsListOverview : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ProxyArtifactVersionsListOverview DeserializeProxyArtifactVersionsListOverview(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ProxyArtifactOverviewPropertiesValue.DeserializeProxyArtifactOverviewPropertiesValue(property.Value); + 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; + } + } + return new ProxyArtifactVersionsListOverview(id, name, type, systemData.Value, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.cs new file mode 100644 index 0000000000000..fa78a94931ab1 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsListOverview.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The proxy artifact overview. + public partial class ProxyArtifactVersionsListOverview : ResourceData + { + /// Initializes a new instance of ProxyArtifactVersionsListOverview. + public ProxyArtifactVersionsListOverview() + { + } + + /// Initializes a new instance of ProxyArtifactVersionsListOverview. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Proxy Artifact overview properties. + internal ProxyArtifactVersionsListOverview(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProxyArtifactOverviewPropertiesValue properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Proxy Artifact overview properties. + public ProxyArtifactOverviewPropertiesValue Properties { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.Serialization.cs new file mode 100644 index 0000000000000..db0b6c190c6a2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class ProxyArtifactVersionsOverviewListResult + { + internal static ProxyArtifactVersionsOverviewListResult DeserializeProxyArtifactVersionsOverviewListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProxyArtifactVersionsListOverview.DeserializeProxyArtifactVersionsListOverview(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ProxyArtifactVersionsOverviewListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.cs new file mode 100644 index 0000000000000..10bc8746295a4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ProxyArtifactVersionsOverviewListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The proxy artifact list result. + internal partial class ProxyArtifactVersionsOverviewListResult + { + /// Initializes a new instance of ProxyArtifactVersionsOverviewListResult. + internal ProxyArtifactVersionsOverviewListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ProxyArtifactVersionsOverviewListResult. + /// A list of available proxy artifacts. + /// The URL to get the next set of results. + internal ProxyArtifactVersionsOverviewListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of available proxy artifacts. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherData.Serialization.cs new file mode 100644 index 0000000000000..362d35897fd22 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherData.Serialization.cs @@ -0,0 +1,130 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class PublisherData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + 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.WriteEndObject(); + } + + internal static PublisherData DeserializePublisherData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional identity = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PublisherPropertiesFormat.DeserializePublisherPropertiesFormat(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + 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; + } + } + return new PublisherData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, identity); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.Serialization.cs new file mode 100644 index 0000000000000..923aa159d9f64 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class PublisherListResult + { + internal static PublisherListResult DeserializePublisherListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PublisherData.DeserializePublisherData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PublisherListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.cs new file mode 100644 index 0000000000000..d48ee5e0e6938 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// A list of publishers. + internal partial class PublisherListResult + { + /// Initializes a new instance of PublisherListResult. + internal PublisherListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PublisherListResult. + /// A list of publishers. + /// The URL to get the next set of results. + internal PublisherListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of publishers. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..8bed86003f49a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class PublisherPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static PublisherPropertiesFormat DeserializePublisherPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional scope = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("scope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scope = new PublisherScope(property.Value.GetString()); + continue; + } + } + return new PublisherPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(scope)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.cs new file mode 100644 index 0000000000000..b0a2191d879ad --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherPropertiesFormat.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// publisher properties. + public partial class PublisherPropertiesFormat + { + /// Initializes a new instance of PublisherPropertiesFormat. + public PublisherPropertiesFormat() + { + } + + /// Initializes a new instance of PublisherPropertiesFormat. + /// The provisioning state of the publisher resource. + /// The publisher scope. + internal PublisherPropertiesFormat(ProvisioningState? provisioningState, PublisherScope? scope) + { + ProvisioningState = provisioningState; + Scope = scope; + } + + /// The provisioning state of the publisher resource. + public ProvisioningState? ProvisioningState { get; } + /// The publisher scope. + public PublisherScope? Scope { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherScope.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherScope.cs new file mode 100644 index 0000000000000..2b1dc2a637f76 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/PublisherScope.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Publisher Scope. + public readonly partial struct PublisherScope : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PublisherScope(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PrivateValue = "Private"; + + /// Unknown. + public static PublisherScope Unknown { get; } = new PublisherScope(UnknownValue); + /// Private. + public static PublisherScope Private { get; } = new PublisherScope(PrivateValue); + /// Determines if two values are the same. + public static bool operator ==(PublisherScope left, PublisherScope right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublisherScope left, PublisherScope right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PublisherScope(string value) => new PublisherScope(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublisherScope other && Equals(other); + /// + public bool Equals(PublisherScope 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.Serialization.cs new file mode 100644 index 0000000000000..2031a5ce03407 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class RequestMetadata : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("relativePath"u8); + writer.WriteStringValue(RelativePath); + writer.WritePropertyName("httpMethod"u8); + writer.WriteStringValue(HttpMethod.ToString()); + writer.WritePropertyName("serializedBody"u8); + writer.WriteStringValue(SerializedBody); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.cs new file mode 100644 index 0000000000000..6a9b51f751e75 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/RequestMetadata.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Request metadata of execute request post call payload. + public partial class RequestMetadata + { + /// Initializes a new instance of RequestMetadata. + /// The relative path of the request. + /// The http method of the request. + /// The serialized body of the request. + /// or is null. + public RequestMetadata(string relativePath, HttpMethod httpMethod, string serializedBody) + { + Argument.AssertNotNull(relativePath, nameof(relativePath)); + Argument.AssertNotNull(serializedBody, nameof(serializedBody)); + + RelativePath = relativePath; + HttpMethod = httpMethod; + SerializedBody = serializedBody; + } + + /// The relative path of the request. + public string RelativePath { get; } + /// The http method of the request. + public HttpMethod HttpMethod { get; } + /// The serialized body of the request. + public string SerializedBody { get; } + /// The api version of the request. + public string ApiVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.Serialization.cs new file mode 100644 index 0000000000000..db00f56a915c7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class ResourceElementTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceElementType.ToString()); + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static ResourceElementTemplate DeserializeResourceElementTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "ArmResourceDefinition": return ArmResourceDefinitionResourceElementTemplateDetails.DeserializeArmResourceDefinitionResourceElementTemplateDetails(element); + case "NetworkFunctionDefinition": return NetworkFunctionDefinitionResourceElementTemplateDetails.DeserializeNetworkFunctionDefinitionResourceElementTemplateDetails(element); + } + } + return UnknownResourceElementTemplate.DeserializeUnknownResourceElementTemplate(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.cs new file mode 100644 index 0000000000000..a67ade822322c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/ResourceElementTemplate.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// The resource element template object. + /// 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 ResourceElementTemplate + { + /// Initializes a new instance of ResourceElementTemplate. + protected ResourceElementTemplate() + { + } + + /// Initializes a new instance of ResourceElementTemplate. + /// Name of the resource element template. + /// The resource element template type. + /// The depends on profile. + internal ResourceElementTemplate(string name, Type resourceElementType, DependsOnProfile dependsOnProfile) + { + Name = name; + ResourceElementType = resourceElementType; + DependsOnProfile = dependsOnProfile; + } + + /// Name of the resource element template. + public string Name { get; set; } + /// The resource element template type. + internal Type ResourceElementType { get; set; } + /// The depends on profile. + public DependsOnProfile DependsOnProfile { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.Serialization.cs new file mode 100644 index 0000000000000..94f7caf7b47e3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class SecretDeploymentResourceReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("idType"u8); + writer.WriteStringValue(IdType.ToString()); + writer.WriteEndObject(); + } + + internal static SecretDeploymentResourceReference DeserializeSecretDeploymentResourceReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + IdType idType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("idType"u8)) + { + idType = new IdType(property.Value.GetString()); + continue; + } + } + return new SecretDeploymentResourceReference(idType, id.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.cs new file mode 100644 index 0000000000000..776c869e724b9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SecretDeploymentResourceReference.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Secret deployment resource id reference. + public partial class SecretDeploymentResourceReference : DeploymentResourceIdReference + { + /// Initializes a new instance of SecretDeploymentResourceReference. + public SecretDeploymentResourceReference() + { + IdType = IdType.Secret; + } + + /// Initializes a new instance of SecretDeploymentResourceReference. + /// The resource reference arm id type. + /// Resource ID. + internal SecretDeploymentResourceReference(IdType idType, ResourceIdentifier id) : base(idType) + { + Id = id; + IdType = idType; + } + + /// Resource ID. + public ResourceIdentifier Id { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteData.Serialization.cs new file mode 100644 index 0000000000000..3f3d10044c559 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteData.Serialization.cs @@ -0,0 +1,113 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class SiteData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static SiteData DeserializeSiteData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SitePropertiesFormat.DeserializeSitePropertiesFormat(property.Value); + continue; + } + 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; + } + } + return new SiteData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.Serialization.cs new file mode 100644 index 0000000000000..b5e55b9370899 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class SiteListResult + { + internal static SiteListResult DeserializeSiteListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SiteData.DeserializeSiteData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SiteListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.cs new file mode 100644 index 0000000000000..573e1d3c21ff7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for sites API service call. + internal partial class SiteListResult + { + /// Initializes a new instance of SiteListResult. + internal SiteListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SiteListResult. + /// A list of sites in a resource group. + /// The URL to get the next set of results. + internal SiteListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of sites in a resource group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceData.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceData.Serialization.cs new file mode 100644 index 0000000000000..92e7de9d2decf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceData.Serialization.cs @@ -0,0 +1,145 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + public partial class SiteNetworkServiceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } + 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.WriteEndObject(); + } + + internal static SiteNetworkServiceData DeserializeSiteNetworkServiceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional identity = default; + Optional sku = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SiteNetworkServicePropertiesFormat.DeserializeSiteNetworkServicePropertiesFormat(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = HybridNetworkSku.DeserializeHybridNetworkSku(property.Value); + continue; + } + 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; + } + } + return new SiteNetworkServiceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value, identity, sku.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.Serialization.cs new file mode 100644 index 0000000000000..e938f28b0f5c2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class SiteNetworkServiceListResult + { + internal static SiteNetworkServiceListResult DeserializeSiteNetworkServiceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SiteNetworkServiceData.DeserializeSiteNetworkServiceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SiteNetworkServiceListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.cs new file mode 100644 index 0000000000000..dcb062cb68235 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServiceListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Response for site network services API service call. + internal partial class SiteNetworkServiceListResult + { + /// Initializes a new instance of SiteNetworkServiceListResult. + internal SiteNetworkServiceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SiteNetworkServiceListResult. + /// A list of site network services in a resource group. + /// The URL to get the next set of results. + internal SiteNetworkServiceListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of site network services in a resource group. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..89b64fa071b56 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.Serialization.cs @@ -0,0 +1,171 @@ +// 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.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class SiteNetworkServicePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ManagedResourceGroupConfiguration)) + { + writer.WritePropertyName("managedResourceGroupConfiguration"u8); + writer.WriteObjectValue(ManagedResourceGroupConfiguration); + } + if (Optional.IsDefined(SiteReference)) + { + writer.WritePropertyName("siteReference"u8); + JsonSerializer.Serialize(writer, SiteReference); + } + if (Optional.IsDefined(NetworkServiceDesignVersionResourceReference)) + { + writer.WritePropertyName("networkServiceDesignVersionResourceReference"u8); + writer.WriteObjectValue(NetworkServiceDesignVersionResourceReference); + } + if (Optional.IsCollectionDefined(DesiredStateConfigurationGroupValueReferences)) + { + writer.WritePropertyName("desiredStateConfigurationGroupValueReferences"u8); + writer.WriteStartObject(); + foreach (var item in DesiredStateConfigurationGroupValueReferences) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static SiteNetworkServicePropertiesFormat DeserializeSiteNetworkServicePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional managedResourceGroupConfiguration = default; + Optional siteReference = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional networkServiceDesignGroupName = default; + Optional networkServiceDesignVersionName = default; + Optional networkServiceDesignVersionOfferingLocation = default; + Optional networkServiceDesignVersionResourceReference = default; + Optional> desiredStateConfigurationGroupValueReferences = default; + Optional lastStateNetworkServiceDesignVersionName = default; + Optional> lastStateConfigurationGroupValueReferences = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("managedResourceGroupConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedResourceGroupConfiguration = ManagedResourceGroupConfiguration.DeserializeManagedResourceGroupConfiguration(property.Value); + continue; + } + if (property.NameEquals("siteReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + siteReference = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkServiceDesignGroupName"u8)) + { + networkServiceDesignGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkServiceDesignVersionName"u8)) + { + networkServiceDesignVersionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkServiceDesignVersionOfferingLocation"u8)) + { + networkServiceDesignVersionOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkServiceDesignVersionResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkServiceDesignVersionResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("desiredStateConfigurationGroupValueReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); + } + desiredStateConfigurationGroupValueReferences = dictionary; + continue; + } + if (property.NameEquals("lastStateNetworkServiceDesignVersionName"u8)) + { + lastStateNetworkServiceDesignVersionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastStateConfigurationGroupValueReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); + } + lastStateConfigurationGroupValueReferences = dictionary; + continue; + } + } + return new SiteNetworkServicePropertiesFormat(Optional.ToNullable(provisioningState), managedResourceGroupConfiguration.Value, siteReference, publisherName.Value, Optional.ToNullable(publisherScope), networkServiceDesignGroupName.Value, networkServiceDesignVersionName.Value, networkServiceDesignVersionOfferingLocation.Value, networkServiceDesignVersionResourceReference.Value, Optional.ToDictionary(desiredStateConfigurationGroupValueReferences), lastStateNetworkServiceDesignVersionName.Value, Optional.ToDictionary(lastStateConfigurationGroupValueReferences)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.cs new file mode 100644 index 0000000000000..ea2e08a527a9a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SiteNetworkServicePropertiesFormat.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Site network service properties. + public partial class SiteNetworkServicePropertiesFormat + { + /// Initializes a new instance of SiteNetworkServicePropertiesFormat. + public SiteNetworkServicePropertiesFormat() + { + DesiredStateConfigurationGroupValueReferences = new ChangeTrackingDictionary(); + LastStateConfigurationGroupValueReferences = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of SiteNetworkServicePropertiesFormat. + /// The provisioning state of the site network service resource. + /// Managed resource group configuration. + /// The site details. + /// The publisher name for the site network service. + /// The scope of the publisher. + /// The network service design group name for the site network service. + /// The network service design version for the site network service. + /// The location of the network service design offering. + /// + /// The network service design version resource reference. + /// 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 . + /// + /// The goal state of the site network service resource. This has references to the configuration group value objects that describe the desired state of the site network service. + /// The network service design version for the site network service. + /// The last state of the site network service resource. + internal SiteNetworkServicePropertiesFormat(ProvisioningState? provisioningState, ManagedResourceGroupConfiguration managedResourceGroupConfiguration, WritableSubResource siteReference, string publisherName, PublisherScope? publisherScope, string networkServiceDesignGroupName, string networkServiceDesignVersionName, string networkServiceDesignVersionOfferingLocation, DeploymentResourceIdReference networkServiceDesignVersionResourceReference, IDictionary desiredStateConfigurationGroupValueReferences, string lastStateNetworkServiceDesignVersionName, IReadOnlyDictionary lastStateConfigurationGroupValueReferences) + { + ProvisioningState = provisioningState; + ManagedResourceGroupConfiguration = managedResourceGroupConfiguration; + SiteReference = siteReference; + PublisherName = publisherName; + PublisherScope = publisherScope; + NetworkServiceDesignGroupName = networkServiceDesignGroupName; + NetworkServiceDesignVersionName = networkServiceDesignVersionName; + NetworkServiceDesignVersionOfferingLocation = networkServiceDesignVersionOfferingLocation; + NetworkServiceDesignVersionResourceReference = networkServiceDesignVersionResourceReference; + DesiredStateConfigurationGroupValueReferences = desiredStateConfigurationGroupValueReferences; + LastStateNetworkServiceDesignVersionName = lastStateNetworkServiceDesignVersionName; + LastStateConfigurationGroupValueReferences = lastStateConfigurationGroupValueReferences; + } + + /// The provisioning state of the site network service resource. + public ProvisioningState? ProvisioningState { get; } + /// Managed resource group configuration. + public ManagedResourceGroupConfiguration ManagedResourceGroupConfiguration { get; set; } + /// The site details. + internal WritableSubResource SiteReference { get; set; } + /// Gets or sets Id. + public ResourceIdentifier SiteReferenceId + { + get => SiteReference is null ? default : SiteReference.Id; + set + { + if (SiteReference is null) + SiteReference = new WritableSubResource(); + SiteReference.Id = value; + } + } + + /// The publisher name for the site network service. + public string PublisherName { get; } + /// The scope of the publisher. + public PublisherScope? PublisherScope { get; } + /// The network service design group name for the site network service. + public string NetworkServiceDesignGroupName { get; } + /// The network service design version for the site network service. + public string NetworkServiceDesignVersionName { get; } + /// The location of the network service design offering. + public string NetworkServiceDesignVersionOfferingLocation { get; } + /// + /// The network service design version resource reference. + /// 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 DeploymentResourceIdReference NetworkServiceDesignVersionResourceReference { get; set; } + /// The goal state of the site network service resource. This has references to the configuration group value objects that describe the desired state of the site network service. + public IDictionary DesiredStateConfigurationGroupValueReferences { get; } + /// The network service design version for the site network service. + public string LastStateNetworkServiceDesignVersionName { get; } + /// The last state of the site network service resource. + public IReadOnlyDictionary LastStateConfigurationGroupValueReferences { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..2ee914e7af631 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.Serialization.cs @@ -0,0 +1,85 @@ +// 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.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class SitePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Nfvis)) + { + writer.WritePropertyName("nfvis"u8); + writer.WriteStartArray(); + foreach (var item in Nfvis) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static SitePropertiesFormat DeserializeSitePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional> nfvis = default; + Optional> siteNetworkServiceReferences = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("nfvis"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NFVIs.DeserializeNFVIs(item)); + } + nfvis = array; + continue; + } + if (property.NameEquals("siteNetworkServiceReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + siteNetworkServiceReferences = array; + continue; + } + } + return new SitePropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToList(nfvis), Optional.ToList(siteNetworkServiceReferences)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.cs new file mode 100644 index 0000000000000..05d9b7705286a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/SitePropertiesFormat.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Site properties. + public partial class SitePropertiesFormat + { + /// Initializes a new instance of SitePropertiesFormat. + public SitePropertiesFormat() + { + Nfvis = new ChangeTrackingList(); + SiteNetworkServiceReferences = new ChangeTrackingList(); + } + + /// Initializes a new instance of SitePropertiesFormat. + /// The provisioning state of the site resource. **TODO**: Confirm if this is needed. + /// + /// List of NFVIs + /// 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 . + /// + /// The list of site network services on the site. + internal SitePropertiesFormat(ProvisioningState? provisioningState, IList nfvis, IReadOnlyList siteNetworkServiceReferences) + { + ProvisioningState = provisioningState; + Nfvis = nfvis; + SiteNetworkServiceReferences = siteNetworkServiceReferences; + } + + /// The provisioning state of the site resource. **TODO**: Confirm if this is needed. + public ProvisioningState? ProvisioningState { get; } + /// + /// List of NFVIs + /// 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 IList Nfvis { get; } + /// The list of site network services on the site. + public IReadOnlyList SiteNetworkServiceReferences { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.Serialization.cs new file mode 100644 index 0000000000000..1e9f0baf1fd51 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class TagsObject : 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.WriteEndObject(); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.cs new file mode 100644 index 0000000000000..30fb888be37f8 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TagsObject.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Tags object for patch operations. + public partial class TagsObject + { + /// Initializes a new instance of TagsObject. + public TagsObject() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Resource tags. + public IDictionary Tags { get; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TemplateType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TemplateType.cs new file mode 100644 index 0000000000000..994ad779f3a98 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/TemplateType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The template type. + public readonly partial struct TemplateType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TemplateType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string ArmTemplateValue = "ArmTemplate"; + + /// Unknown. + public static TemplateType Unknown { get; } = new TemplateType(UnknownValue); + /// ArmTemplate. + public static TemplateType ArmTemplate { get; } = new TemplateType(ArmTemplateValue); + /// Determines if two values are the same. + public static bool operator ==(TemplateType left, TemplateType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TemplateType left, TemplateType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TemplateType(string value) => new TemplateType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TemplateType other && Equals(other); + /// + public bool Equals(TemplateType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/Type.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/Type.cs new file mode 100644 index 0000000000000..8285ee1fb3fb2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/Type.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The resource element template type. + internal readonly partial struct Type : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Type(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string ArmResourceDefinitionValue = "ArmResourceDefinition"; + private const string NetworkFunctionDefinitionValue = "NetworkFunctionDefinition"; + + /// Unknown. + public static Type Unknown { get; } = new Type(UnknownValue); + /// ArmResourceDefinition. + public static Type ArmResourceDefinition { get; } = new Type(ArmResourceDefinitionValue); + /// NetworkFunctionDefinition. + public static Type NetworkFunctionDefinition { get; } = new Type(NetworkFunctionDefinitionValue); + /// Determines if two values are the same. + public static bool operator ==(Type left, Type right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Type left, Type right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator Type(string value) => new Type(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Type other && Equals(other); + /// + public bool Equals(Type 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.Serialization.cs new file mode 100644 index 0000000000000..ec764cb5e135c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownArtifactAccessCredential + { + internal static UnknownArtifactAccessCredential DeserializeUnknownArtifactAccessCredential(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CredentialType credentialType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("credentialType"u8)) + { + credentialType = new CredentialType(property.Value.GetString()); + continue; + } + } + return new UnknownArtifactAccessCredential(credentialType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.cs new file mode 100644 index 0000000000000..c4d9fda01e4ac --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownArtifactAccessCredential.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownArtifactAccessCredential. + internal partial class UnknownArtifactAccessCredential : ArtifactAccessCredential + { + /// Initializes a new instance of UnknownArtifactAccessCredential. + /// The credential type. + internal UnknownArtifactAccessCredential(CredentialType credentialType) : base(credentialType) + { + CredentialType = credentialType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..25486e750c0ae --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.Serialization.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownConfigurationGroupValuePropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ConfigurationGroupSchemaResourceReference)) + { + writer.WritePropertyName("configurationGroupSchemaResourceReference"u8); + writer.WriteObjectValue(ConfigurationGroupSchemaResourceReference); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownConfigurationGroupValuePropertiesFormat DeserializeUnknownConfigurationGroupValuePropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional configurationGroupSchemaName = default; + Optional configurationGroupSchemaOfferingLocation = default; + Optional configurationGroupSchemaResourceReference = default; + ConfigurationGroupValueConfigurationType configurationType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("configurationGroupSchemaName"u8)) + { + configurationGroupSchemaName = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaOfferingLocation"u8)) + { + configurationGroupSchemaOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationGroupSchemaResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configurationGroupSchemaResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new ConfigurationGroupValueConfigurationType(property.Value.GetString()); + continue; + } + } + return new UnknownConfigurationGroupValuePropertiesFormat(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), configurationGroupSchemaName.Value, configurationGroupSchemaOfferingLocation.Value, configurationGroupSchemaResourceReference.Value, configurationType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.cs new file mode 100644 index 0000000000000..bf4597da8bf89 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownConfigurationGroupValuePropertiesFormat.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownConfigurationGroupValuePropertiesFormat. + internal partial class UnknownConfigurationGroupValuePropertiesFormat : ConfigurationGroupValuePropertiesFormat + { + /// Initializes a new instance of UnknownConfigurationGroupValuePropertiesFormat. + /// The provisioning state of the site resource. + /// The publisher name for the configuration group schema. + /// The scope of the publisher. + /// The configuration group schema name. + /// The location of the configuration group schema offering. + /// + /// The configuration group schema resource reference. + /// 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 . + /// + /// The value which indicates if configuration values are secrets. + internal UnknownConfigurationGroupValuePropertiesFormat(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string configurationGroupSchemaName, string configurationGroupSchemaOfferingLocation, DeploymentResourceIdReference configurationGroupSchemaResourceReference, ConfigurationGroupValueConfigurationType configurationType) : base(provisioningState, publisherName, publisherScope, configurationGroupSchemaName, configurationGroupSchemaOfferingLocation, configurationGroupSchemaResourceReference, configurationType) + { + ConfigurationType = configurationType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 0000000000000..fec27e5335ebe --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.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.HybridNetwork.Models +{ + internal partial class UnknownContainerizedNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownContainerizedNetworkFunctionTemplate DeserializeUnknownContainerizedNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ContainerizedNetworkFunctionNfviType nfviType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nfviType"u8)) + { + nfviType = new ContainerizedNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new UnknownContainerizedNetworkFunctionTemplate(nfviType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.cs new file mode 100644 index 0000000000000..231f93837a074 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownContainerizedNetworkFunctionTemplate.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownContainerizedNetworkFunctionTemplate. + internal partial class UnknownContainerizedNetworkFunctionTemplate : ContainerizedNetworkFunctionTemplate + { + /// Initializes a new instance of UnknownContainerizedNetworkFunctionTemplate. + /// The network function type. + internal UnknownContainerizedNetworkFunctionTemplate(ContainerizedNetworkFunctionNfviType nfviType) : base(nfviType) + { + NfviType = nfviType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.Serialization.cs new file mode 100644 index 0000000000000..29f0115e6755a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.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.HybridNetwork.Models +{ + internal partial class UnknownDeploymentResourceIdReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("idType"u8); + writer.WriteStringValue(IdType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownDeploymentResourceIdReference DeserializeUnknownDeploymentResourceIdReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IdType idType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("idType"u8)) + { + idType = new IdType(property.Value.GetString()); + continue; + } + } + return new UnknownDeploymentResourceIdReference(idType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.cs new file mode 100644 index 0000000000000..8a66e2584d1cc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownDeploymentResourceIdReference.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownDeploymentResourceIdReference. + internal partial class UnknownDeploymentResourceIdReference : DeploymentResourceIdReference + { + /// Initializes a new instance of UnknownDeploymentResourceIdReference. + /// The resource reference arm id type. + internal UnknownDeploymentResourceIdReference(IdType idType) : base(idType) + { + IdType = idType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.Serialization.cs new file mode 100644 index 0000000000000..ad3520038bd58 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownNFVIs : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownNFVIs DeserializeUnknownNFVIs(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + NfviType nfviType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + nfviType = new NfviType(property.Value.GetString()); + continue; + } + } + return new UnknownNFVIs(name.Value, nfviType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.cs new file mode 100644 index 0000000000000..cc517de24a85c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNFVIs.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownNFVIs. + internal partial class UnknownNFVIs : NFVIs + { + /// Initializes a new instance of UnknownNFVIs. + /// Name of the nfvi. + /// The NFVI type. + internal UnknownNFVIs(string name, NfviType nfviType) : base(name, nfviType) + { + NfviType = nfviType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..3b00c73f6e77e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.Serialization.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownNetworkFunctionDefinitionVersionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DeployParameters)) + { + writer.WritePropertyName("deployParameters"u8); + writer.WriteStringValue(DeployParameters); + } + writer.WritePropertyName("networkFunctionType"u8); + writer.WriteStringValue(NetworkFunctionType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownNetworkFunctionDefinitionVersionPropertiesFormat DeserializeUnknownNetworkFunctionDefinitionVersionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional deployParameters = default; + NetworkFunctionType networkFunctionType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("deployParameters"u8)) + { + deployParameters = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionType"u8)) + { + networkFunctionType = new NetworkFunctionType(property.Value.GetString()); + continue; + } + } + return new UnknownNetworkFunctionDefinitionVersionPropertiesFormat(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, deployParameters.Value, networkFunctionType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.cs new file mode 100644 index 0000000000000..1ef0f57cf413a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionDefinitionVersionPropertiesFormat.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownNetworkFunctionDefinitionVersionPropertiesFormat. + internal partial class UnknownNetworkFunctionDefinitionVersionPropertiesFormat : NetworkFunctionDefinitionVersionPropertiesFormat + { + /// Initializes a new instance of UnknownNetworkFunctionDefinitionVersionPropertiesFormat. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + internal UnknownNetworkFunctionDefinitionVersionPropertiesFormat(ProvisioningState? provisioningState, VersionState? versionState, string description, string deployParameters, NetworkFunctionType networkFunctionType) : base(provisioningState, versionState, description, deployParameters, networkFunctionType) + { + NetworkFunctionType = networkFunctionType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.Serialization.cs new file mode 100644 index 0000000000000..0d72c42e216e0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownNetworkFunctionPropertiesFormat : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkFunctionDefinitionVersionResourceReference)) + { + writer.WritePropertyName("networkFunctionDefinitionVersionResourceReference"u8); + writer.WriteObjectValue(NetworkFunctionDefinitionVersionResourceReference); + } + if (Optional.IsDefined(NfviType)) + { + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.Value.ToString()); + } + if (Optional.IsDefined(NfviId)) + { + writer.WritePropertyName("nfviId"u8); + writer.WriteStringValue(NfviId); + } + if (Optional.IsDefined(AllowSoftwareUpdate)) + { + writer.WritePropertyName("allowSoftwareUpdate"u8); + writer.WriteBooleanValue(AllowSoftwareUpdate.Value); + } + writer.WritePropertyName("configurationType"u8); + writer.WriteStringValue(ConfigurationType.ToString()); + if (Optional.IsCollectionDefined(RoleOverrideValues)) + { + writer.WritePropertyName("roleOverrideValues"u8); + writer.WriteStartArray(); + foreach (var item in RoleOverrideValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static UnknownNetworkFunctionPropertiesFormat DeserializeUnknownNetworkFunctionPropertiesFormat(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional publisherName = default; + Optional publisherScope = default; + Optional networkFunctionDefinitionGroupName = default; + Optional networkFunctionDefinitionVersion = default; + Optional networkFunctionDefinitionOfferingLocation = default; + Optional networkFunctionDefinitionVersionResourceReference = default; + Optional nfviType = default; + Optional nfviId = default; + Optional allowSoftwareUpdate = default; + NetworkFunctionConfigurationType configurationType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + Optional> roleOverrideValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("publisherName"u8)) + { + publisherName = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publisherScope = new PublisherScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("networkFunctionDefinitionGroupName"u8)) + { + networkFunctionDefinitionGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersion"u8)) + { + networkFunctionDefinitionVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionOfferingLocation"u8)) + { + networkFunctionDefinitionOfferingLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionDefinitionVersionResourceReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionDefinitionVersionResourceReference = DeploymentResourceIdReference.DeserializeDeploymentResourceIdReference(property.Value); + continue; + } + if (property.NameEquals("nfviType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviType = new NfviType(property.Value.GetString()); + continue; + } + if (property.NameEquals("nfviId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfviId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("allowSoftwareUpdate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowSoftwareUpdate = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("configurationType"u8)) + { + configurationType = new NetworkFunctionConfigurationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("roleOverrideValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roleOverrideValues = array; + continue; + } + } + return new UnknownNetworkFunctionPropertiesFormat(Optional.ToNullable(provisioningState), publisherName.Value, Optional.ToNullable(publisherScope), networkFunctionDefinitionGroupName.Value, networkFunctionDefinitionVersion.Value, networkFunctionDefinitionOfferingLocation.Value, networkFunctionDefinitionVersionResourceReference.Value, Optional.ToNullable(nfviType), nfviId.Value, Optional.ToNullable(allowSoftwareUpdate), configurationType, Optional.ToList(roleOverrideValues)); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.cs new file mode 100644 index 0000000000000..a7277d6bc8c14 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownNetworkFunctionPropertiesFormat.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownNetworkFunctionPropertiesFormat. + internal partial class UnknownNetworkFunctionPropertiesFormat : NetworkFunctionPropertiesFormat + { + /// Initializes a new instance of UnknownNetworkFunctionPropertiesFormat. + /// The provisioning state of the network function resource. + /// The publisher name for the network function. + /// The scope of the publisher. + /// The network function definition group name for the network function. + /// The network function definition version for the network function. + /// The location of the network function definition offering. + /// + /// The network function definition version resource reference. + /// 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 . + /// + /// The nfvi type for the network function. + /// The nfviId for the network function. + /// Indicates if software updates are allowed during deployment. + /// The value which indicates if NF values are secrets. + /// The role configuration override values from the user. + internal UnknownNetworkFunctionPropertiesFormat(ProvisioningState? provisioningState, string publisherName, PublisherScope? publisherScope, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersion, string networkFunctionDefinitionOfferingLocation, DeploymentResourceIdReference networkFunctionDefinitionVersionResourceReference, NfviType? nfviType, ResourceIdentifier nfviId, bool? allowSoftwareUpdate, NetworkFunctionConfigurationType configurationType, IList roleOverrideValues) : base(provisioningState, publisherName, publisherScope, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersion, networkFunctionDefinitionOfferingLocation, networkFunctionDefinitionVersionResourceReference, nfviType, nfviId, allowSoftwareUpdate, configurationType, roleOverrideValues) + { + ConfigurationType = configurationType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.Serialization.cs new file mode 100644 index 0000000000000..df6caf9a7b0d7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class UnknownResourceElementTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceElementType.ToString()); + if (Optional.IsDefined(DependsOnProfile)) + { + writer.WritePropertyName("dependsOnProfile"u8); + writer.WriteObjectValue(DependsOnProfile); + } + writer.WriteEndObject(); + } + + internal static UnknownResourceElementTemplate DeserializeUnknownResourceElementTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Type type = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + Optional dependsOnProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new Type(property.Value.GetString()); + continue; + } + if (property.NameEquals("dependsOnProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dependsOnProfile = DependsOnProfile.DeserializeDependsOnProfile(property.Value); + continue; + } + } + return new UnknownResourceElementTemplate(name.Value, type, dependsOnProfile.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.cs new file mode 100644 index 0000000000000..e532a946be0de --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownResourceElementTemplate.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownResourceElementTemplate. + internal partial class UnknownResourceElementTemplate : ResourceElementTemplate + { + /// Initializes a new instance of UnknownResourceElementTemplate. + /// Name of the resource element template. + /// The resource element template type. + /// The depends on profile. + internal UnknownResourceElementTemplate(string name, Type resourceElementType, DependsOnProfile dependsOnProfile) : base(name, resourceElementType, dependsOnProfile) + { + ResourceElementType = resourceElementType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 0000000000000..4fe6b9ef886c3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.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.HybridNetwork.Models +{ + internal partial class UnknownVirtualNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownVirtualNetworkFunctionTemplate DeserializeUnknownVirtualNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VirtualNetworkFunctionNfviType nfviType = "AutoRest.CSharp.Output.Models.Types.EnumTypeValue"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nfviType"u8)) + { + nfviType = new VirtualNetworkFunctionNfviType(property.Value.GetString()); + continue; + } + } + return new UnknownVirtualNetworkFunctionTemplate(nfviType); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.cs new file mode 100644 index 0000000000000..3553e98bcafbd --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/UnknownVirtualNetworkFunctionTemplate.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The UnknownVirtualNetworkFunctionTemplate. + internal partial class UnknownVirtualNetworkFunctionTemplate : VirtualNetworkFunctionTemplate + { + /// Initializes a new instance of UnknownVirtualNetworkFunctionTemplate. + /// The network function type. + internal UnknownVirtualNetworkFunctionTemplate(VirtualNetworkFunctionNfviType nfviType) : base(nfviType) + { + NfviType = nfviType; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VersionState.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VersionState.cs new file mode 100644 index 0000000000000..9a7b88876eef5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VersionState.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.HybridNetwork.Models +{ + /// The configuration group schema state. + public readonly partial struct VersionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VersionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PreviewValue = "Preview"; + private const string ActiveValue = "Active"; + private const string DeprecatedValue = "Deprecated"; + private const string ValidatingValue = "Validating"; + private const string ValidationFailedValue = "ValidationFailed"; + + /// Unknown. + public static VersionState Unknown { get; } = new VersionState(UnknownValue); + /// Preview. + public static VersionState Preview { get; } = new VersionState(PreviewValue); + /// Active. + public static VersionState Active { get; } = new VersionState(ActiveValue); + /// Deprecated. + public static VersionState Deprecated { get; } = new VersionState(DeprecatedValue); + /// Validating. + public static VersionState Validating { get; } = new VersionState(ValidatingValue); + /// ValidationFailed. + public static VersionState ValidationFailed { get; } = new VersionState(ValidationFailedValue); + /// Determines if two values are the same. + public static bool operator ==(VersionState left, VersionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VersionState left, VersionState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VersionState(string value) => new VersionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VersionState other && Equals(other); + /// + public bool Equals(VersionState 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.Serialization.cs new file mode 100644 index 0000000000000..553438093dc1f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class VhdImageArtifactProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VhdName)) + { + writer.WritePropertyName("vhdName"u8); + writer.WriteStringValue(VhdName); + } + if (Optional.IsDefined(VhdVersion)) + { + writer.WritePropertyName("vhdVersion"u8); + writer.WriteStringValue(VhdVersion); + } + writer.WriteEndObject(); + } + + internal static VhdImageArtifactProfile DeserializeVhdImageArtifactProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional vhdName = default; + Optional vhdVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vhdName"u8)) + { + vhdName = property.Value.GetString(); + continue; + } + if (property.NameEquals("vhdVersion"u8)) + { + vhdVersion = property.Value.GetString(); + continue; + } + } + return new VhdImageArtifactProfile(vhdName.Value, vhdVersion.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.cs new file mode 100644 index 0000000000000..f5d9f369e8c74 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageArtifactProfile.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Vhd artifact profile. + public partial class VhdImageArtifactProfile + { + /// Initializes a new instance of VhdImageArtifactProfile. + public VhdImageArtifactProfile() + { + } + + /// Initializes a new instance of VhdImageArtifactProfile. + /// Vhd name. + /// Vhd version. + internal VhdImageArtifactProfile(string vhdName, string vhdVersion) + { + VhdName = vhdName; + VhdVersion = vhdVersion; + } + + /// Vhd name. + public string VhdName { get; set; } + /// Vhd version. + public string VhdVersion { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.Serialization.cs new file mode 100644 index 0000000000000..02685fdb4f0f3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + internal partial class VhdImageMappingRuleProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(UserConfiguration)) + { + writer.WritePropertyName("userConfiguration"u8); + writer.WriteStringValue(UserConfiguration); + } + writer.WriteEndObject(); + } + + internal static VhdImageMappingRuleProfile DeserializeVhdImageMappingRuleProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional userConfiguration = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("userConfiguration"u8)) + { + userConfiguration = property.Value.GetString(); + continue; + } + } + return new VhdImageMappingRuleProfile(userConfiguration.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.cs new file mode 100644 index 0000000000000..53e8f8e6a97e5 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VhdImageMappingRuleProfile.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Vhd mapping rule profile. + internal partial class VhdImageMappingRuleProfile + { + /// Initializes a new instance of VhdImageMappingRuleProfile. + public VhdImageMappingRuleProfile() + { + } + + /// Initializes a new instance of VhdImageMappingRuleProfile. + /// List of values. + internal VhdImageMappingRuleProfile(string userConfiguration) + { + UserConfiguration = userConfiguration; + } + + /// List of values. + public string UserConfiguration { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.Serialization.cs new file mode 100644 index 0000000000000..e9b600614f2fb --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + public partial class VirtualNetworkFunctionDefinitionVersion : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NetworkFunctionTemplate)) + { + writer.WritePropertyName("networkFunctionTemplate"u8); + writer.WriteObjectValue(NetworkFunctionTemplate); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DeployParameters)) + { + writer.WritePropertyName("deployParameters"u8); + writer.WriteStringValue(DeployParameters); + } + writer.WritePropertyName("networkFunctionType"u8); + writer.WriteStringValue(NetworkFunctionType.ToString()); + writer.WriteEndObject(); + } + + internal static VirtualNetworkFunctionDefinitionVersion DeserializeVirtualNetworkFunctionDefinitionVersion(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional networkFunctionTemplate = default; + Optional provisioningState = default; + Optional versionState = default; + Optional description = default; + Optional deployParameters = default; + NetworkFunctionType networkFunctionType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("networkFunctionTemplate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFunctionTemplate = VirtualNetworkFunctionTemplate.DeserializeVirtualNetworkFunctionTemplate(property.Value); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + versionState = new VersionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("deployParameters"u8)) + { + deployParameters = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkFunctionType"u8)) + { + networkFunctionType = new NetworkFunctionType(property.Value.GetString()); + continue; + } + } + return new VirtualNetworkFunctionDefinitionVersion(Optional.ToNullable(provisioningState), Optional.ToNullable(versionState), description.Value, deployParameters.Value, networkFunctionType, networkFunctionTemplate.Value); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.cs new file mode 100644 index 0000000000000..6f31f3bfc647f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionDefinitionVersion.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// Virtual network function network function definition version properties. + public partial class VirtualNetworkFunctionDefinitionVersion : NetworkFunctionDefinitionVersionPropertiesFormat + { + /// Initializes a new instance of VirtualNetworkFunctionDefinitionVersion. + public VirtualNetworkFunctionDefinitionVersion() + { + NetworkFunctionType = NetworkFunctionType.VirtualNetworkFunction; + } + + /// Initializes a new instance of VirtualNetworkFunctionDefinitionVersion. + /// The provisioning state of the network function definition version resource. + /// The network function definition version state. + /// The network function definition version description. + /// The deployment parameters of the network function definition version. + /// The network function type. + /// + /// Virtual network function template. + /// 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 . + /// + internal VirtualNetworkFunctionDefinitionVersion(ProvisioningState? provisioningState, VersionState? versionState, string description, string deployParameters, NetworkFunctionType networkFunctionType, VirtualNetworkFunctionTemplate networkFunctionTemplate) : base(provisioningState, versionState, description, deployParameters, networkFunctionType) + { + NetworkFunctionTemplate = networkFunctionTemplate; + NetworkFunctionType = networkFunctionType; + } + + /// + /// Virtual network function template. + /// 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 VirtualNetworkFunctionTemplate NetworkFunctionTemplate { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionNfviType.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionNfviType.cs new file mode 100644 index 0000000000000..ac2183a73c7aa --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionNfviType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// The network function type. + internal readonly partial struct VirtualNetworkFunctionNfviType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VirtualNetworkFunctionNfviType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AzureCoreValue = "AzureCore"; + private const string AzureOperatorNexusValue = "AzureOperatorNexus"; + + /// Unknown. + public static VirtualNetworkFunctionNfviType Unknown { get; } = new VirtualNetworkFunctionNfviType(UnknownValue); + /// AzureCore. + public static VirtualNetworkFunctionNfviType AzureCore { get; } = new VirtualNetworkFunctionNfviType(AzureCoreValue); + /// AzureOperatorNexus. + public static VirtualNetworkFunctionNfviType AzureOperatorNexus { get; } = new VirtualNetworkFunctionNfviType(AzureOperatorNexusValue); + /// Determines if two values are the same. + public static bool operator ==(VirtualNetworkFunctionNfviType left, VirtualNetworkFunctionNfviType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VirtualNetworkFunctionNfviType left, VirtualNetworkFunctionNfviType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VirtualNetworkFunctionNfviType(string value) => new VirtualNetworkFunctionNfviType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VirtualNetworkFunctionNfviType other && Equals(other); + /// + public bool Equals(VirtualNetworkFunctionNfviType 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.Serialization.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.Serialization.cs new file mode 100644 index 0000000000000..f9de401e736b7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.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.HybridNetwork.Models +{ + public partial class VirtualNetworkFunctionTemplate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nfviType"u8); + writer.WriteStringValue(NfviType.ToString()); + writer.WriteEndObject(); + } + + internal static VirtualNetworkFunctionTemplate DeserializeVirtualNetworkFunctionTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("nfviType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureCore": return AzureCoreNetworkFunctionTemplate.DeserializeAzureCoreNetworkFunctionTemplate(element); + case "AzureOperatorNexus": return AzureOperatorNexusNetworkFunctionTemplate.DeserializeAzureOperatorNexusNetworkFunctionTemplate(element); + } + } + return UnknownVirtualNetworkFunctionTemplate.DeserializeUnknownVirtualNetworkFunctionTemplate(element); + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.cs new file mode 100644 index 0000000000000..2169f448afb45 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/Models/VirtualNetworkFunctionTemplate.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.HybridNetwork.Models +{ + /// + /// Virtual network function template. + /// 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 VirtualNetworkFunctionTemplate + { + /// Initializes a new instance of VirtualNetworkFunctionTemplate. + protected VirtualNetworkFunctionTemplate() + { + } + + /// Initializes a new instance of VirtualNetworkFunctionTemplate. + /// The network function type. + internal VirtualNetworkFunctionTemplate(VirtualNetworkFunctionNfviType nfviType) + { + NfviType = nfviType; + } + + /// The network function type. + internal VirtualNetworkFunctionNfviType NfviType { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionCollection.cs new file mode 100644 index 0000000000000..3d86a609c20d2 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionCollection.cs @@ -0,0 +1,416 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNetworkFunctions method from an instance of . + /// + public partial class NetworkFunctionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkFunctionClientDiagnostics; + private readonly NetworkFunctionsRestOperations _networkFunctionRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionCollection() + { + } + + /// 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 NetworkFunctionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkFunctionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkFunctionResource.ResourceType, out string networkFunctionApiVersion); + _networkFunctionRestClient = new NetworkFunctionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionApiVersion); +#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)); + } + + /// + /// Creates or updates a network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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. + /// Resource name for the network function resource. + /// Parameters supplied in the body to the create or update network function operation. + /// 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 networkFunctionName, NetworkFunctionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkFunctionOperationSource(Client), _networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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. + /// Resource name for the network function resource. + /// Parameters supplied in the body to the create or update network function operation. + /// 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 networkFunctionName, NetworkFunctionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkFunctionOperationSource(Client), _networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.Get"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.Get"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the network function resources in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_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) => _networkFunctionRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionResource(Client, NetworkFunctionData.DeserializeNetworkFunctionData(e)), _networkFunctionClientDiagnostics, Pipeline, "NetworkFunctionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the network function resources in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions + /// + /// + /// Operation Id + /// NetworkFunctions_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) => _networkFunctionRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionResource(Client, NetworkFunctionData.DeserializeNetworkFunctionData(e)), _networkFunctionClientDiagnostics, Pipeline, "NetworkFunctionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.Exists"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, 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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.Exists"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The name of the network function resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, networkFunctionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionData.cs new file mode 100644 index 0000000000000..cd33fad0ca90a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionData.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkFunction data model. + /// Network function resource response. + /// + public partial class NetworkFunctionData : TrackedResourceData + { + /// Initializes a new instance of NetworkFunctionData. + /// The location. + public NetworkFunctionData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkFunctionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Network function properties. + /// 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 . + /// + /// A unique read-only string that changes whenever the resource is updated. + /// The managed identity of the network function. + internal NetworkFunctionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkFunctionPropertiesFormat properties, ETag? etag, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ETag = etag; + Identity = identity; + } + + /// + /// Network function properties. + /// 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 NetworkFunctionPropertiesFormat Properties { get; set; } + /// A unique read-only string that changes whenever the resource is updated. + public ETag? ETag { get; set; } + /// The managed identity of the network function. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupCollection.cs new file mode 100644 index 0000000000000..32568353dd213 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupCollection.cs @@ -0,0 +1,415 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNetworkFunctionDefinitionGroups method from an instance of . + /// + public partial class NetworkFunctionDefinitionGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkFunctionDefinitionGroupClientDiagnostics; + private readonly NetworkFunctionDefinitionGroupsRestOperations _networkFunctionDefinitionGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionDefinitionGroupCollection() + { + } + + /// 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 NetworkFunctionDefinitionGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionDefinitionGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkFunctionDefinitionGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkFunctionDefinitionGroupResource.ResourceType, out string networkFunctionDefinitionGroupApiVersion); + _networkFunctionDefinitionGroupRestClient = new NetworkFunctionDefinitionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionDefinitionGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PublisherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PublisherResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionGroupOperationSource(Client), _networkFunctionDefinitionGroupClientDiagnostics, Pipeline, _networkFunctionDefinitionGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionGroupOperationSource(Client), _networkFunctionDefinitionGroupClientDiagnostics, Pipeline, _networkFunctionDefinitionGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.Get"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.Get"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information of the network function definition groups under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_ListByPublisher + /// + /// + /// + /// 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) => _networkFunctionDefinitionGroupRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionDefinitionGroupRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionDefinitionGroupResource(Client, NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(e)), _networkFunctionDefinitionGroupClientDiagnostics, Pipeline, "NetworkFunctionDefinitionGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information of the network function definition groups under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_ListByPublisher + /// + /// + /// + /// 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) => _networkFunctionDefinitionGroupRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionDefinitionGroupRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionDefinitionGroupResource(Client, NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(e)), _networkFunctionDefinitionGroupClientDiagnostics, Pipeline, "NetworkFunctionDefinitionGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.Exists"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.Exists"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkFunctionDefinitionGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupData.cs new file mode 100644 index 0000000000000..2fc7b7ed0a4ba --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkFunctionDefinitionGroup data model. + /// Network function definition group resource. + /// + public partial class NetworkFunctionDefinitionGroupData : TrackedResourceData + { + /// Initializes a new instance of NetworkFunctionDefinitionGroupData. + /// The location. + public NetworkFunctionDefinitionGroupData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Network function definition group properties. + internal NetworkFunctionDefinitionGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkFunctionDefinitionGroupPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Network function definition group properties. + public NetworkFunctionDefinitionGroupPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupResource.cs new file mode 100644 index 0000000000000..9fbe44d00e5ff --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionGroupResource.cs @@ -0,0 +1,658 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkFunctionDefinitionGroup along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNetworkFunctionDefinitionGroupResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkFunctionDefinitionGroup method. + /// + public partial class NetworkFunctionDefinitionGroupResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publisherName. + /// The networkFunctionDefinitionGroupName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkFunctionDefinitionGroupClientDiagnostics; + private readonly NetworkFunctionDefinitionGroupsRestOperations _networkFunctionDefinitionGroupRestClient; + private readonly NetworkFunctionDefinitionGroupData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionDefinitionGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkFunctionDefinitionGroupResource(ArmClient client, NetworkFunctionDefinitionGroupData 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 NetworkFunctionDefinitionGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionDefinitionGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkFunctionDefinitionGroupApiVersion); + _networkFunctionDefinitionGroupRestClient = new NetworkFunctionDefinitionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionDefinitionGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/networkFunctionDefinitionGroups"; + + /// 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 NetworkFunctionDefinitionGroupData 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)); + } + + /// Gets a collection of NetworkFunctionDefinitionVersionResources in the NetworkFunctionDefinitionGroup. + /// An object representing collection of NetworkFunctionDefinitionVersionResources and their operations over a NetworkFunctionDefinitionVersionResource. + public virtual NetworkFunctionDefinitionVersionCollection GetNetworkFunctionDefinitionVersions() + { + return GetCachedClient(client => new NetworkFunctionDefinitionVersionCollection(client, Id)); + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFunctionDefinitionVersionAsync(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + return await GetNetworkFunctionDefinitionVersions().GetAsync(networkFunctionDefinitionVersionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFunctionDefinitionVersion(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + return GetNetworkFunctionDefinitionVersions().Get(networkFunctionDefinitionVersionName, cancellationToken); + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Get"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Get"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a specified network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Delete"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkFunctionDefinitionGroupClientDiagnostics, Pipeline, _networkFunctionDefinitionGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, 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; + } + } + + /// + /// Deletes a specified network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Delete"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkFunctionDefinitionGroupClientDiagnostics, Pipeline, _networkFunctionDefinitionGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network function definition group resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Update + /// + /// + /// + /// Parameters supplied to the create or update publisher network function definition group operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Update"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network function definition group resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Update + /// + /// + /// + /// Parameters supplied to the create or update publisher network function definition group operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.Update"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 _networkFunctionDefinitionGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_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 = _networkFunctionDefinitionGroupClientDiagnostics.CreateScope("NetworkFunctionDefinitionGroupResource.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 = _networkFunctionDefinitionGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionCollection.cs new file mode 100644 index 0000000000000..4f95fae581b30 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionCollection.cs @@ -0,0 +1,415 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNetworkFunctionDefinitionVersions method from an instance of . + /// + public partial class NetworkFunctionDefinitionVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkFunctionDefinitionVersionClientDiagnostics; + private readonly NetworkFunctionDefinitionVersionsRestOperations _networkFunctionDefinitionVersionRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionDefinitionVersionCollection() + { + } + + /// 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 NetworkFunctionDefinitionVersionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionDefinitionVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkFunctionDefinitionVersionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkFunctionDefinitionVersionResource.ResourceType, out string networkFunctionDefinitionVersionApiVersion); + _networkFunctionDefinitionVersionRestClient = new NetworkFunctionDefinitionVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionDefinitionVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetworkFunctionDefinitionGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetworkFunctionDefinitionGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionVersionOperationSource(Client), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionVersionOperationSource(Client), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.Get"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.Get"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a list of network function definition versions under a network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_ListByNetworkFunctionDefinitionGroup + /// + /// + /// + /// 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) => _networkFunctionDefinitionVersionRestClient.CreateListByNetworkFunctionDefinitionGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionDefinitionVersionRestClient.CreateListByNetworkFunctionDefinitionGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionDefinitionVersionResource(Client, NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(e)), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, "NetworkFunctionDefinitionVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about a list of network function definition versions under a network function definition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_ListByNetworkFunctionDefinitionGroup + /// + /// + /// + /// 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) => _networkFunctionDefinitionVersionRestClient.CreateListByNetworkFunctionDefinitionGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkFunctionDefinitionVersionRestClient.CreateListByNetworkFunctionDefinitionGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFunctionDefinitionVersionResource(Client, NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(e)), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, "NetworkFunctionDefinitionVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.Exists"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.Exists"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionData.cs new file mode 100644 index 0000000000000..b0f0ffbf57476 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkFunctionDefinitionVersion data model. + /// Network function definition version. + /// + public partial class NetworkFunctionDefinitionVersionData : TrackedResourceData + { + /// Initializes a new instance of NetworkFunctionDefinitionVersionData. + /// The location. + public NetworkFunctionDefinitionVersionData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkFunctionDefinitionVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Network function definition version properties. + /// 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 . + /// + internal NetworkFunctionDefinitionVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkFunctionDefinitionVersionPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// + /// Network function definition version properties. + /// 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 NetworkFunctionDefinitionVersionPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionResource.cs new file mode 100644 index 0000000000000..8fd19ace9d18d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionDefinitionVersionResource.cs @@ -0,0 +1,682 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkFunctionDefinitionVersion along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNetworkFunctionDefinitionVersionResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkFunctionDefinitionVersion method. + /// + public partial class NetworkFunctionDefinitionVersionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publisherName. + /// The networkFunctionDefinitionGroupName. + /// The networkFunctionDefinitionVersionName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkFunctionDefinitionVersionClientDiagnostics; + private readonly NetworkFunctionDefinitionVersionsRestOperations _networkFunctionDefinitionVersionRestClient; + private readonly NetworkFunctionDefinitionVersionData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionDefinitionVersionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkFunctionDefinitionVersionResource(ArmClient client, NetworkFunctionDefinitionVersionData 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 NetworkFunctionDefinitionVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionDefinitionVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkFunctionDefinitionVersionApiVersion); + _networkFunctionDefinitionVersionRestClient = new NetworkFunctionDefinitionVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionDefinitionVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/networkFunctionDefinitionGroups/networkFunctionDefinitionVersions"; + + /// 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 NetworkFunctionDefinitionVersionData 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)); + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Get"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Get"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Delete"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, 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; + } + } + + /// + /// Deletes the specified network function definition version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Delete"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network function definition version resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Update + /// + /// + /// + /// Parameters supplied to the create or update network function definition version operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Update"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network function definition version resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_Update + /// + /// + /// + /// Parameters supplied to the create or update network function definition version operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.Update"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update network function definition version state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of network function definition version. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateStateAsync(WaitUntil waitUntil, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(networkFunctionDefinitionVersionUpdateState, nameof(networkFunctionDefinitionVersionUpdateState)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.UpdateState"); + scope.Start(); + try + { + var response = await _networkFunctionDefinitionVersionRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionUpdateState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionVersionUpdateStateOperationSource(), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionUpdateState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update network function definition version state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName}/updateState + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of network function definition version. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateState(WaitUntil waitUntil, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(networkFunctionDefinitionVersionUpdateState, nameof(networkFunctionDefinitionVersionUpdateState)); + + using var scope = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.UpdateState"); + scope.Start(); + try + { + var response = _networkFunctionDefinitionVersionRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionUpdateState, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkFunctionDefinitionVersionUpdateStateOperationSource(), _networkFunctionDefinitionVersionClientDiagnostics, Pipeline, _networkFunctionDefinitionVersionRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkFunctionDefinitionVersionUpdateState).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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 _networkFunctionDefinitionVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName}/networkFunctionDefinitionVersions/{networkFunctionDefinitionVersionName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionVersions_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 = _networkFunctionDefinitionVersionClientDiagnostics.CreateScope("NetworkFunctionDefinitionVersionResource.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 = _networkFunctionDefinitionVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionDefinitionVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionResource.cs new file mode 100644 index 0000000000000..a8cd6b01370bf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkFunctionResource.cs @@ -0,0 +1,734 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkFunction along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNetworkFunctionResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkFunction method. + /// + public partial class NetworkFunctionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkFunctionName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFunctionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkFunctionClientDiagnostics; + private readonly NetworkFunctionsRestOperations _networkFunctionRestClient; + private readonly NetworkFunctionData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkFunctionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkFunctionResource(ArmClient client, NetworkFunctionData 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 NetworkFunctionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkFunctionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkFunctionApiVersion); + _networkFunctionRestClient = new NetworkFunctionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkFunctionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/networkFunctions"; + + /// 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 NetworkFunctionData 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)); + } + + /// Gets a collection of ComponentResources in the NetworkFunction. + /// An object representing collection of ComponentResources and their operations over a ComponentResource. + public virtual ComponentCollection GetComponents() + { + return GetCachedClient(client => new ComponentCollection(client, Id)); + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetComponentAsync(string componentName, CancellationToken cancellationToken = default) + { + return await GetComponents().GetAsync(componentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified application instance resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/components/{componentName} + /// + /// + /// Operation Id + /// Components_Get + /// + /// + /// + /// The name of the component. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetComponent(string componentName, CancellationToken cancellationToken = default) + { + return GetComponents().Get(componentName, cancellationToken); + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Get"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Get"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Delete"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.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; + } + } + + /// + /// Deletes the specified network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Delete"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.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; + } + } + + /// + /// Updates the tags for the network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_UpdateTags + /// + /// + /// + /// Parameters supplied to the update network function tags operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Update"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the tags for the network function resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_UpdateTags + /// + /// + /// + /// Parameters supplied to the update network function tags operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.Update"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkFunctionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Execute a request to services on a containerized network function. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest + /// + /// + /// Operation Id + /// NetworkFunctions_ExecuteRequest + /// + /// + /// + /// 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. + /// Payload for execute request post call. + /// The cancellation token to use. + /// is null. + public virtual async Task ExecuteRequestAsync(WaitUntil waitUntil, ExecuteRequestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.ExecuteRequest"); + scope.Start(); + try + { + var response = await _networkFunctionRestClient.ExecuteRequestAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.CreateExecuteRequestRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Execute a request to services on a containerized network function. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName}/executeRequest + /// + /// + /// Operation Id + /// NetworkFunctions_ExecuteRequest + /// + /// + /// + /// 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. + /// Payload for execute request post call. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ExecuteRequest(WaitUntil waitUntil, ExecuteRequestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.ExecuteRequest"); + scope.Start(); + try + { + var response = _networkFunctionRestClient.ExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkFunctionClientDiagnostics, Pipeline, _networkFunctionRestClient.CreateExecuteRequestRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 _networkFunctionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/networkFunctions/{networkFunctionName} + /// + /// + /// Operation Id + /// NetworkFunctions_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 = _networkFunctionClientDiagnostics.CreateScope("NetworkFunctionResource.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 = _networkFunctionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NetworkFunctionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupCollection.cs new file mode 100644 index 0000000000000..8c27cb5c1cec9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupCollection.cs @@ -0,0 +1,415 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNetworkServiceDesignGroups method from an instance of . + /// + public partial class NetworkServiceDesignGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkServiceDesignGroupClientDiagnostics; + private readonly NetworkServiceDesignGroupsRestOperations _networkServiceDesignGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkServiceDesignGroupCollection() + { + } + + /// 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 NetworkServiceDesignGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkServiceDesignGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkServiceDesignGroupResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkServiceDesignGroupResource.ResourceType, out string networkServiceDesignGroupApiVersion); + _networkServiceDesignGroupRestClient = new NetworkServiceDesignGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkServiceDesignGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PublisherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PublisherResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 networkServiceDesignGroupName, NetworkServiceDesignGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignGroupOperationSource(Client), _networkServiceDesignGroupClientDiagnostics, Pipeline, _networkServiceDesignGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 networkServiceDesignGroupName, NetworkServiceDesignGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignGroupOperationSource(Client), _networkServiceDesignGroupClientDiagnostics, Pipeline, _networkServiceDesignGroupRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.Get"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.Get"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information of the network service design groups under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_ListByPublisher + /// + /// + /// + /// 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) => _networkServiceDesignGroupRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkServiceDesignGroupRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkServiceDesignGroupResource(Client, NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(e)), _networkServiceDesignGroupClientDiagnostics, Pipeline, "NetworkServiceDesignGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information of the network service design groups under a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_ListByPublisher + /// + /// + /// + /// 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) => _networkServiceDesignGroupRestClient.CreateListByPublisherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkServiceDesignGroupRestClient.CreateListByPublisherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkServiceDesignGroupResource(Client, NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(e)), _networkServiceDesignGroupClientDiagnostics, Pipeline, "NetworkServiceDesignGroupCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.Exists"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.Exists"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, networkServiceDesignGroupName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupData.cs new file mode 100644 index 0000000000000..b42fb333333d9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkServiceDesignGroup data model. + /// network service design group resource. + /// + public partial class NetworkServiceDesignGroupData : TrackedResourceData + { + /// Initializes a new instance of NetworkServiceDesignGroupData. + /// The location. + public NetworkServiceDesignGroupData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkServiceDesignGroupData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// network service design group properties. + internal NetworkServiceDesignGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkServiceDesignGroupPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// network service design group properties. + public NetworkServiceDesignGroupPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupResource.cs new file mode 100644 index 0000000000000..877a30e84aef4 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignGroupResource.cs @@ -0,0 +1,658 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkServiceDesignGroup along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNetworkServiceDesignGroupResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkServiceDesignGroup method. + /// + public partial class NetworkServiceDesignGroupResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publisherName. + /// The networkServiceDesignGroupName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkServiceDesignGroupClientDiagnostics; + private readonly NetworkServiceDesignGroupsRestOperations _networkServiceDesignGroupRestClient; + private readonly NetworkServiceDesignGroupData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkServiceDesignGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkServiceDesignGroupResource(ArmClient client, NetworkServiceDesignGroupData 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 NetworkServiceDesignGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkServiceDesignGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkServiceDesignGroupApiVersion); + _networkServiceDesignGroupRestClient = new NetworkServiceDesignGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkServiceDesignGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/networkServiceDesignGroups"; + + /// 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 NetworkServiceDesignGroupData 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)); + } + + /// Gets a collection of NetworkServiceDesignVersionResources in the NetworkServiceDesignGroup. + /// An object representing collection of NetworkServiceDesignVersionResources and their operations over a NetworkServiceDesignVersionResource. + public virtual NetworkServiceDesignVersionCollection GetNetworkServiceDesignVersions() + { + return GetCachedClient(client => new NetworkServiceDesignVersionCollection(client, Id)); + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkServiceDesignVersionAsync(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + return await GetNetworkServiceDesignVersions().GetAsync(networkServiceDesignVersionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkServiceDesignVersion(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + return GetNetworkServiceDesignVersions().Get(networkServiceDesignVersionName, cancellationToken); + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Get"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Get"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a specified network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Delete"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkServiceDesignGroupClientDiagnostics, Pipeline, _networkServiceDesignGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, 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; + } + } + + /// + /// Deletes a specified network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Delete"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkServiceDesignGroupClientDiagnostics, Pipeline, _networkServiceDesignGroupRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network service design groups resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Update + /// + /// + /// + /// Parameters supplied to the create or update publisher network service design group operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Update"); + scope.Start(); + try + { + var response = await _networkServiceDesignGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network service design groups resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Update + /// + /// + /// + /// Parameters supplied to the create or update publisher network service design group operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.Update"); + scope.Start(); + try + { + var response = _networkServiceDesignGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 _networkServiceDesignGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_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 = _networkServiceDesignGroupClientDiagnostics.CreateScope("NetworkServiceDesignGroupResource.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 = _networkServiceDesignGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignGroupResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionCollection.cs new file mode 100644 index 0000000000000..085d42a6af745 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionCollection.cs @@ -0,0 +1,415 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetNetworkServiceDesignVersions method from an instance of . + /// + public partial class NetworkServiceDesignVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkServiceDesignVersionClientDiagnostics; + private readonly NetworkServiceDesignVersionsRestOperations _networkServiceDesignVersionRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkServiceDesignVersionCollection() + { + } + + /// 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 NetworkServiceDesignVersionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkServiceDesignVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", NetworkServiceDesignVersionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkServiceDesignVersionResource.ResourceType, out string networkServiceDesignVersionApiVersion); + _networkServiceDesignVersionRestClient = new NetworkServiceDesignVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkServiceDesignVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetworkServiceDesignGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetworkServiceDesignGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 networkServiceDesignVersionName, NetworkServiceDesignVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignVersionOperationSource(Client), _networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 networkServiceDesignVersionName, NetworkServiceDesignVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignVersionOperationSource(Client), _networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.Get"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.Get"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a list of network service design versions under a network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_ListByNetworkServiceDesignGroup + /// + /// + /// + /// 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) => _networkServiceDesignVersionRestClient.CreateListByNetworkServiceDesignGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkServiceDesignVersionRestClient.CreateListByNetworkServiceDesignGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkServiceDesignVersionResource(Client, NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(e)), _networkServiceDesignVersionClientDiagnostics, Pipeline, "NetworkServiceDesignVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about a list of network service design versions under a network service design group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_ListByNetworkServiceDesignGroup + /// + /// + /// + /// 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) => _networkServiceDesignVersionRestClient.CreateListByNetworkServiceDesignGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkServiceDesignVersionRestClient.CreateListByNetworkServiceDesignGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkServiceDesignVersionResource(Client, NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(e)), _networkServiceDesignVersionClientDiagnostics, Pipeline, "NetworkServiceDesignVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.Exists"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.Exists"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, networkServiceDesignVersionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionData.cs new file mode 100644 index 0000000000000..ace444421b904 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the NetworkServiceDesignVersion data model. + /// network service design version. + /// + public partial class NetworkServiceDesignVersionData : TrackedResourceData + { + /// Initializes a new instance of NetworkServiceDesignVersionData. + /// The location. + public NetworkServiceDesignVersionData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of NetworkServiceDesignVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// network service design version properties. + internal NetworkServiceDesignVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetworkServiceDesignVersionPropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// network service design version properties. + public NetworkServiceDesignVersionPropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionResource.cs new file mode 100644 index 0000000000000..6bd8d6df2c511 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/NetworkServiceDesignVersionResource.cs @@ -0,0 +1,682 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a NetworkServiceDesignVersion along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetNetworkServiceDesignVersionResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkServiceDesignVersion method. + /// + public partial class NetworkServiceDesignVersionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publisherName. + /// The networkServiceDesignGroupName. + /// The networkServiceDesignVersionName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkServiceDesignVersionClientDiagnostics; + private readonly NetworkServiceDesignVersionsRestOperations _networkServiceDesignVersionRestClient; + private readonly NetworkServiceDesignVersionData _data; + + /// Initializes a new instance of the class for mocking. + protected NetworkServiceDesignVersionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkServiceDesignVersionResource(ArmClient client, NetworkServiceDesignVersionData 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 NetworkServiceDesignVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkServiceDesignVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkServiceDesignVersionApiVersion); + _networkServiceDesignVersionRestClient = new NetworkServiceDesignVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkServiceDesignVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers/networkServiceDesignGroups/networkServiceDesignVersions"; + + /// 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 NetworkServiceDesignVersionData 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)); + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Get"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about a network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Get"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Delete"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, 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; + } + } + + /// + /// Deletes the specified network service design version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Delete"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network service design version resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Update + /// + /// + /// + /// Parameters supplied to the create or update network service design version operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Update"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a network service design version resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_Update + /// + /// + /// + /// Parameters supplied to the create or update network service design version operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.Update"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update network service design version state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of network service design version. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateStateAsync(WaitUntil waitUntil, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(networkServiceDesignVersionUpdateState, nameof(networkServiceDesignVersionUpdateState)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.UpdateState"); + scope.Start(); + try + { + var response = await _networkServiceDesignVersionRestClient.UpdateStateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkServiceDesignVersionUpdateState, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignVersionUpdateStateOperationSource(), _networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkServiceDesignVersionUpdateState).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update network service design version state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName}/updateState + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_updateState + /// + /// + /// + /// 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. + /// Parameters supplied to update the state of network service design version. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateState(WaitUntil waitUntil, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(networkServiceDesignVersionUpdateState, nameof(networkServiceDesignVersionUpdateState)); + + using var scope = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.UpdateState"); + scope.Start(); + try + { + var response = _networkServiceDesignVersionRestClient.UpdateState(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkServiceDesignVersionUpdateState, cancellationToken); + var operation = new HybridNetworkArmOperation(new NetworkServiceDesignVersionUpdateStateOperationSource(), _networkServiceDesignVersionClientDiagnostics, Pipeline, _networkServiceDesignVersionRestClient.CreateUpdateStateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, networkServiceDesignVersionUpdateState).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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 _networkServiceDesignVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName}/networkServiceDesignVersions/{networkServiceDesignVersionName} + /// + /// + /// Operation Id + /// NetworkServiceDesignVersions_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 = _networkServiceDesignVersionClientDiagnostics.CreateScope("NetworkServiceDesignVersionResource.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 = _networkServiceDesignVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new NetworkServiceDesignVersionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ProviderConstants.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/ProviderConstants.cs new file mode 100644 index 0000000000000..abc9b5a943504 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/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.HybridNetwork +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherCollection.cs new file mode 100644 index 0000000000000..0a774b33f3fe0 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherCollection.cs @@ -0,0 +1,416 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetPublishers method from an instance of . + /// + public partial class PublisherCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _publisherClientDiagnostics; + private readonly PublishersRestOperations _publisherRestClient; + + /// Initializes a new instance of the class for mocking. + protected PublisherCollection() + { + } + + /// 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 PublisherCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _publisherClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", PublisherResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PublisherResource.ResourceType, out string publisherApiVersion); + _publisherRestClient = new PublishersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, publisherApiVersion); +#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)); + } + + /// + /// Creates or updates a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, PublisherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _publisherRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, publisherName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new PublisherOperationSource(Client), _publisherClientDiagnostics, Pipeline, _publisherRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, publisherName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, PublisherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _publisherRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, publisherName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new PublisherOperationSource(Client), _publisherClientDiagnostics, Pipeline, _publisherRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, publisherName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.Get"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.Get"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the publishers in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_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) => _publisherRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publisherRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), _publisherClientDiagnostics, Pipeline, "PublisherCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the publishers in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers + /// + /// + /// Operation Id + /// Publishers_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) => _publisherRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _publisherRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublisherResource(Client, PublisherData.DeserializePublisherData(e)), _publisherClientDiagnostics, Pipeline, "PublisherCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.Exists"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publisherName, 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.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.Exists"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The name of the publisher. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherCollection.GetIfExists"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, publisherName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherData.cs new file mode 100644 index 0000000000000..5055d8f174686 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the Publisher data model. + /// publisher resource. + /// + public partial class PublisherData : TrackedResourceData + { + /// Initializes a new instance of PublisherData. + /// The location. + public PublisherData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of PublisherData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Publisher properties. + /// The managed identity of the publisher, if configured. + internal PublisherData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PublisherPropertiesFormat properties, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + } + + /// Publisher properties. + public PublisherPropertiesFormat Properties { get; set; } + /// The managed identity of the publisher, if configured. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherResource.cs new file mode 100644 index 0000000000000..f1d42eeb25e3c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/PublisherResource.cs @@ -0,0 +1,817 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a Publisher along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetPublisherResource method. + /// Otherwise you can get one from its parent resource using the GetPublisher method. + /// + public partial class PublisherResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publisherName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publisherName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _publisherClientDiagnostics; + private readonly PublishersRestOperations _publisherRestClient; + private readonly PublisherData _data; + + /// Initializes a new instance of the class for mocking. + protected PublisherResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PublisherResource(ArmClient client, PublisherData 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 PublisherResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _publisherClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string publisherApiVersion); + _publisherRestClient = new PublishersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, publisherApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/publishers"; + + /// 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 PublisherData 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)); + } + + /// Gets a collection of ConfigurationGroupSchemaResources in the Publisher. + /// An object representing collection of ConfigurationGroupSchemaResources and their operations over a ConfigurationGroupSchemaResource. + public virtual ConfigurationGroupSchemaCollection GetConfigurationGroupSchemas() + { + return GetCachedClient(client => new ConfigurationGroupSchemaCollection(client, Id)); + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetConfigurationGroupSchemaAsync(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + return await GetConfigurationGroupSchemas().GetAsync(configurationGroupSchemaName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified configuration group schema. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/configurationGroupSchemas/{configurationGroupSchemaName} + /// + /// + /// Operation Id + /// ConfigurationGroupSchemas_Get + /// + /// + /// + /// The name of the configuration group schema. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetConfigurationGroupSchema(string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + return GetConfigurationGroupSchemas().Get(configurationGroupSchemaName, cancellationToken); + } + + /// Gets a collection of NetworkFunctionDefinitionGroupResources in the Publisher. + /// An object representing collection of NetworkFunctionDefinitionGroupResources and their operations over a NetworkFunctionDefinitionGroupResource. + public virtual NetworkFunctionDefinitionGroupCollection GetNetworkFunctionDefinitionGroups() + { + return GetCachedClient(client => new NetworkFunctionDefinitionGroupCollection(client, Id)); + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFunctionDefinitionGroupAsync(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + return await GetNetworkFunctionDefinitionGroups().GetAsync(networkFunctionDefinitionGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified networkFunctionDefinition group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkFunctionDefinitionGroups/{networkFunctionDefinitionGroupName} + /// + /// + /// Operation Id + /// NetworkFunctionDefinitionGroups_Get + /// + /// + /// + /// The name of the network function definition group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFunctionDefinitionGroup(string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + return GetNetworkFunctionDefinitionGroups().Get(networkFunctionDefinitionGroupName, cancellationToken); + } + + /// Gets a collection of NetworkServiceDesignGroupResources in the Publisher. + /// An object representing collection of NetworkServiceDesignGroupResources and their operations over a NetworkServiceDesignGroupResource. + public virtual NetworkServiceDesignGroupCollection GetNetworkServiceDesignGroups() + { + return GetCachedClient(client => new NetworkServiceDesignGroupCollection(client, Id)); + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkServiceDesignGroupAsync(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + return await GetNetworkServiceDesignGroups().GetAsync(networkServiceDesignGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified networkServiceDesign group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/networkServiceDesignGroups/{networkServiceDesignGroupName} + /// + /// + /// Operation Id + /// NetworkServiceDesignGroups_Get + /// + /// + /// + /// The name of the network service design group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkServiceDesignGroup(string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + return GetNetworkServiceDesignGroups().Get(networkServiceDesignGroupName, cancellationToken); + } + + /// Gets a collection of ArtifactStoreResources in the Publisher. + /// An object representing collection of ArtifactStoreResources and their operations over a ArtifactStoreResource. + public virtual ArtifactStoreCollection GetArtifactStores() + { + return GetCachedClient(client => new ArtifactStoreCollection(client, Id)); + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArtifactStoreAsync(string artifactStoreName, CancellationToken cancellationToken = default) + { + return await GetArtifactStores().GetAsync(artifactStoreName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified artifact store. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName}/artifactStores/{artifactStoreName} + /// + /// + /// Operation Id + /// ArtifactStores_Get + /// + /// + /// + /// The name of the artifact store. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArtifactStore(string artifactStoreName, CancellationToken cancellationToken = default) + { + return GetArtifactStores().Get(artifactStoreName, cancellationToken); + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Get"); + scope.Start(); + try + { + var response = await _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Get"); + scope.Start(); + try + { + var response = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 = _publisherClientDiagnostics.CreateScope("PublisherResource.Delete"); + scope.Start(); + try + { + var response = await _publisherRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_publisherClientDiagnostics, Pipeline, _publisherRestClient.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; + } + } + + /// + /// Deletes the specified publisher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 = _publisherClientDiagnostics.CreateScope("PublisherResource.Delete"); + scope.Start(); + try + { + var response = _publisherRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_publisherClientDiagnostics, Pipeline, _publisherRestClient.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 publisher resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Update + /// + /// + /// + /// Parameters supplied to the create publisher operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Update"); + scope.Start(); + try + { + var response = await _publisherRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a publisher resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_Update + /// + /// + /// + /// Parameters supplied to the create publisher operation. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _publisherClientDiagnostics.CreateScope("PublisherResource.Update"); + scope.Start(); + try + { + var response = _publisherRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new PublisherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 _publisherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/publishers/{publisherName} + /// + /// + /// Operation Id + /// Publishers_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 = _publisherClientDiagnostics.CreateScope("PublisherResource.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 = _publisherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PublisherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactManifestsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactManifestsRestOperations.cs new file mode 100644 index 0000000000000..2dda76dd9641a --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactManifestsRestOperations.cs @@ -0,0 +1,751 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ArtifactManifestsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ArtifactManifestsRestOperations. + /// 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 ArtifactManifestsRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByArtifactStoreRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByArtifactStoreAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListByArtifactStoreRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactManifestListResult.DeserializeArtifactManifestListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByArtifactStore(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListByArtifactStoreRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactManifestListResult.DeserializeArtifactManifestListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, 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; + } + + /// Creates or updates a artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, 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); + } + } + + /// Creates or updates a artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a artifact manifest resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArtifactManifestData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a artifact manifest resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArtifactManifestData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a artifact manifest resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a artifact manifest resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to the create or update artifact manifest operation. + /// 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 publisherName, string artifactStoreName, string artifactManifestName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactManifestData.DeserializeArtifactManifestData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListCredentialRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendPath("/listCredential", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List credential for publishing artifacts defined in artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListCredentialAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateListCredentialRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactAccessCredential value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactAccessCredential.DeserializeArtifactAccessCredential(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List credential for publishing artifacts defined in artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListCredential(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + + using var message = CreateListCredentialRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactAccessCredential value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactAccessCredential.DeserializeArtifactAccessCredential(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestUpdateState artifactManifestUpdateState) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactManifests/", false); + uri.AppendPath(artifactManifestName, true); + uri.AppendPath("/updateState", false); + 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(artifactManifestUpdateState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update state for artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestUpdateState artifactManifestUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(artifactManifestUpdateState, nameof(artifactManifestUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, artifactManifestUpdateState); + 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 state for artifact manifest. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact manifest. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactManifestName, ArtifactManifestUpdateState artifactManifestUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactManifestName, nameof(artifactManifestName)); + Argument.AssertNotNull(artifactManifestUpdateState, nameof(artifactManifestUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactManifestName, artifactManifestUpdateState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByArtifactStoreNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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; + } + + /// Gets information about the artifact manifest. + /// 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 name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByArtifactStoreNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListByArtifactStoreNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactManifestListResult.DeserializeArtifactManifestListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the artifact manifest. + /// 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 name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByArtifactStoreNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListByArtifactStoreNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactManifestListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactManifestListResult.DeserializeArtifactManifestListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactStoresRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactStoresRestOperations.cs new file mode 100644 index 0000000000000..b2ff512d641d3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ArtifactStoresRestOperations.cs @@ -0,0 +1,535 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ArtifactStoresRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ArtifactStoresRestOperations. + /// 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 ArtifactStoresRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByPublisherRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information of the ArtifactStores under publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherAsync(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactStoreListResult.DeserializeArtifactStoreListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the ArtifactStores under publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisher(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactStoreListResult.DeserializeArtifactStoreListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// 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 publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// 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 publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, ArtifactStoreData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, 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; + } + + /// Creates or updates a artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 publisherName, string artifactStoreName, ArtifactStoreData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, 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); + } + } + + /// Creates or updates a artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 publisherName, string artifactStoreName, ArtifactStoreData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// 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 publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArtifactStoreData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// 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 publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArtifactStoreData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update artifact store resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 publisherName, string artifactStoreName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update artifact store resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// Parameters supplied to the create or update application group operation. + /// 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 publisherName, string artifactStoreName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactStoreData.DeserializeArtifactStoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByPublisherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName) + { + 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; + } + + /// Gets information of the ArtifactStores under publisher. + /// 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 name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ArtifactStoreListResult.DeserializeArtifactStoreListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the ArtifactStores under publisher. + /// 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 name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArtifactStoreListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ArtifactStoreListResult.DeserializeArtifactStoreListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ComponentsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ComponentsRestOperations.cs new file mode 100644 index 0000000000000..54943cb4e055e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ComponentsRestOperations.cs @@ -0,0 +1,283 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ComponentsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ComponentsRestOperations. + /// 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 ComponentsRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, string componentName) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendPath("/components/", false); + uri.AppendPath(componentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified application instance resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The name of the component. + /// 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 networkFunctionName, string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkFunctionName, componentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentData.DeserializeComponentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ComponentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified application instance resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The name of the component. + /// 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 networkFunctionName, string componentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNullOrEmpty(componentName, nameof(componentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkFunctionName, componentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentData.DeserializeComponentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ComponentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkFunctionRequest(string subscriptionId, string resourceGroupName, string networkFunctionName) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendPath("/components", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the component resources in a network function. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkFunctionAsync(string subscriptionId, string resourceGroupName, string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateListByNetworkFunctionRequest(subscriptionId, resourceGroupName, networkFunctionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentListResult.DeserializeComponentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the component resources in a network function. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkFunction(string subscriptionId, string resourceGroupName, string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateListByNetworkFunctionRequest(subscriptionId, resourceGroupName, networkFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentListResult.DeserializeComponentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkFunctionNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string networkFunctionName) + { + 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; + } + + /// Lists all the component resources in a network function. + /// 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 name of the network function. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkFunctionNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateListByNetworkFunctionNextPageRequest(nextLink, subscriptionId, resourceGroupName, networkFunctionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ComponentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ComponentListResult.DeserializeComponentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the component resources in a network function. + /// 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 name of the network function. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkFunctionNextPage(string nextLink, string subscriptionId, string resourceGroupName, string networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateListByNetworkFunctionNextPageRequest(nextLink, subscriptionId, resourceGroupName, networkFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ComponentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ComponentListResult.DeserializeComponentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupSchemasRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupSchemasRestOperations.cs new file mode 100644 index 0000000000000..528cbc63ecf67 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupSchemasRestOperations.cs @@ -0,0 +1,620 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ConfigurationGroupSchemasRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationGroupSchemasRestOperations. + /// 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 ConfigurationGroupSchemasRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByPublisherRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information of the configuration group schemas under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherAsync(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupSchemaListResult.DeserializeConfigurationGroupSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the configuration group schemas under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisher(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupSchemaListResult.DeserializeConfigurationGroupSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a specified configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// 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 publisherName, string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a specified configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// 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 publisherName, string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, 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; + } + + /// Creates or updates a configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to the create or update configuration group schema resource. + /// 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 publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, 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); + } + } + + /// Creates or updates a configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to the create or update configuration group schema resource. + /// 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 publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// 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 publisherName, string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConfigurationGroupSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified configuration group schema. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// 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 publisherName, string configurationGroupSchemaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConfigurationGroupSchemaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a configuration group schema resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string configurationGroupSchemaName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a configuration group schema resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string configurationGroupSchemaName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupSchemaData.DeserializeConfigurationGroupSchemaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/configurationGroupSchemas/", false); + uri.AppendPath(configurationGroupSchemaName, true); + uri.AppendPath("/updateState", false); + 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(configurationGroupSchemaVersionUpdateState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update configuration group schema state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to update the state of configuration group schema. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(configurationGroupSchemaVersionUpdateState, nameof(configurationGroupSchemaVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, configurationGroupSchemaVersionUpdateState); + 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 configuration group schema state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the configuration group schema. + /// Parameters supplied to update the state of configuration group schema. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string configurationGroupSchemaName, ConfigurationGroupSchemaVersionUpdateState configurationGroupSchemaVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(configurationGroupSchemaName, nameof(configurationGroupSchemaName)); + Argument.AssertNotNull(configurationGroupSchemaVersionUpdateState, nameof(configurationGroupSchemaVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, configurationGroupSchemaName, configurationGroupSchemaVersionUpdateState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByPublisherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName) + { + 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; + } + + /// Gets information of the configuration group schemas under a publisher. + /// 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 name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupSchemaListResult.DeserializeConfigurationGroupSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the configuration group schemas under a publisher. + /// 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 name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupSchemaListResult.DeserializeConfigurationGroupSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupValuesRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupValuesRestOperations.cs new file mode 100644 index 0000000000000..72330943abc0f --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ConfigurationGroupValuesRestOperations.cs @@ -0,0 +1,636 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ConfigurationGroupValuesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationGroupValuesRestOperations. + /// 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 ConfigurationGroupValuesRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string configurationGroupValueName) + { + 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.HybridNetwork/configurationGroupValues/", false); + uri.AppendPath(configurationGroupValueName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified hybrid configuration group value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// 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 configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, configurationGroupValueName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified hybrid configuration group value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// 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 configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, configurationGroupValueName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string configurationGroupValueName) + { + 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.HybridNetwork/configurationGroupValues/", false); + uri.AppendPath(configurationGroupValueName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified hybrid configuration group values. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// 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 configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, configurationGroupValueName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConfigurationGroupValueData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified hybrid configuration group values. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// 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 configurationGroupValueName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, configurationGroupValueName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConfigurationGroupValueData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string configurationGroupValueName, ConfigurationGroupValueData 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.HybridNetwork/configurationGroupValues/", false); + uri.AppendPath(configurationGroupValueName, 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; + } + + /// Creates or updates a hybrid configuration group value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// Parameters supplied to the create or update configuration group value resource. + /// 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 configurationGroupValueName, ConfigurationGroupValueData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, configurationGroupValueName, 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); + } + } + + /// Creates or updates a hybrid configuration group value. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// Parameters supplied to the create or update configuration group value resource. + /// 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 configurationGroupValueName, ConfigurationGroupValueData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, configurationGroupValueName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string configurationGroupValueName, TagsObject tagsObject) + { + 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.HybridNetwork/configurationGroupValues/", false); + uri.AppendPath(configurationGroupValueName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a hybrid configuration group tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// Parameters supplied to update configuration group values tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string configurationGroupValueName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, configurationGroupValueName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a hybrid configuration group tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the configuration group value. + /// Parameters supplied to update configuration group values tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string configurationGroupValueName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationGroupValueName, nameof(configurationGroupValueName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, configurationGroupValueName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationGroupValueData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueData.DeserializeConfigurationGroupValueData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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.HybridNetwork/configurationGroupValues", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all sites in the configuration group value in a subscription. + /// 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: + { + ConfigurationGroupValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the configuration group value in a subscription. + /// 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: + { + ConfigurationGroupValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(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.HybridNetwork/configurationGroupValues", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the hybrid network configurationGroupValues in a 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: + { + ConfigurationGroupValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the hybrid network configurationGroupValues in a 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: + { + ConfigurationGroupValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, 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; + } + + /// Lists all sites in the configuration group value in a subscription. + /// 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: + { + ConfigurationGroupValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the configuration group value in a subscription. + /// 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: + { + ConfigurationGroupValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(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; + } + + /// Lists all the hybrid network configurationGroupValues in a 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: + { + ConfigurationGroupValueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the hybrid network configurationGroupValues in a 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: + { + ConfigurationGroupValueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationGroupValueListResult.DeserializeConfigurationGroupValueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionGroupsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionGroupsRestOperations.cs new file mode 100644 index 0000000000000..2d22b832557b7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionGroupsRestOperations.cs @@ -0,0 +1,535 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkFunctionDefinitionGroupsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkFunctionDefinitionGroupsRestOperations. + /// 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 NetworkFunctionDefinitionGroupsRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByPublisherRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information of the network function definition groups under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherAsync(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionGroupListResult.DeserializeNetworkFunctionDefinitionGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the network function definition groups under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisher(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionGroupListResult.DeserializeNetworkFunctionDefinitionGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a specified network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// 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 publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a specified network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// 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 publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, 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; + } + + /// Creates or updates a network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, 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); + } + } + + /// Creates or updates a network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, NetworkFunctionDefinitionGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified networkFunctionDefinition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// 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 publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionDefinitionGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified networkFunctionDefinition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// 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 publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionDefinitionGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a network function definition group resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a network function definition group resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// Parameters supplied to the create or update publisher network function definition group operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionGroupData.DeserializeNetworkFunctionDefinitionGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByPublisherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName) + { + 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; + } + + /// Gets information of the network function definition groups under a publisher. + /// 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 name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionGroupListResult.DeserializeNetworkFunctionDefinitionGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the network function definition groups under a publisher. + /// 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 name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionGroupListResult.DeserializeNetworkFunctionDefinitionGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionVersionsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionVersionsRestOperations.cs new file mode 100644 index 0000000000000..ec9a998eb7d5b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionDefinitionVersionsRestOperations.cs @@ -0,0 +1,660 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkFunctionDefinitionVersionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkFunctionDefinitionVersionsRestOperations. + /// 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 NetworkFunctionDefinitionVersionsRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, 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; + } + + /// Creates or updates a network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, 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); + } + } + + /// Creates or updates a network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionDefinitionVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a network function definition version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionDefinitionVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a network function definition version resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a network function definition version resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network function definition version operation. + /// 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 publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionVersionData.DeserializeNetworkFunctionDefinitionVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkFunctionDefinitionGroupRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a list of network function definition versions under a network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkFunctionDefinitionGroupAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateListByNetworkFunctionDefinitionGroupRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionVersionListResult.DeserializeNetworkFunctionDefinitionVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a list of network function definition versions under a network function definition group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkFunctionDefinitionGroup(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateListByNetworkFunctionDefinitionGroupRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionVersionListResult.DeserializeNetworkFunctionDefinitionVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkFunctionDefinitionGroups/", false); + uri.AppendPath(networkFunctionDefinitionGroupName, true); + uri.AppendPath("/networkFunctionDefinitionVersions/", false); + uri.AppendPath(networkFunctionDefinitionVersionName, true); + uri.AppendPath("/updateState", false); + 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(networkFunctionDefinitionVersionUpdateState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update network function definition version state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to update the state of network function definition version. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(networkFunctionDefinitionVersionUpdateState, nameof(networkFunctionDefinitionVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, networkFunctionDefinitionVersionUpdateState); + 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 network function definition version state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network function definition group. + /// The name of the network function definition version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to update the state of network function definition version. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, string networkFunctionDefinitionVersionName, NetworkFunctionDefinitionVersionUpdateState networkFunctionDefinitionVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionVersionName, nameof(networkFunctionDefinitionVersionName)); + Argument.AssertNotNull(networkFunctionDefinitionVersionUpdateState, nameof(networkFunctionDefinitionVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName, networkFunctionDefinitionVersionName, networkFunctionDefinitionVersionUpdateState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkFunctionDefinitionGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName) + { + 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; + } + + /// Gets information about a list of network function definition versions under a network function definition 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 name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkFunctionDefinitionGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateListByNetworkFunctionDefinitionGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionDefinitionVersionListResult.DeserializeNetworkFunctionDefinitionVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a list of network function definition versions under a network function definition 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 name of the publisher. + /// The name of the network function definition group. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkFunctionDefinitionGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkFunctionDefinitionGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkFunctionDefinitionGroupName, nameof(networkFunctionDefinitionGroupName)); + + using var message = CreateListByNetworkFunctionDefinitionGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, networkFunctionDefinitionGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionDefinitionVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionDefinitionVersionListResult.DeserializeNetworkFunctionDefinitionVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionsRestOperations.cs new file mode 100644 index 0000000000000..dfe4c57e8ef1c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkFunctionsRestOperations.cs @@ -0,0 +1,717 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkFunctionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkFunctionsRestOperations. + /// 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 NetworkFunctionsRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string networkFunctionName) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, networkFunctionName); + 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); + } + } + + /// Deletes the specified network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, networkFunctionName); + _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 CreateGetRequest(string subscriptionId, string resourceGroupName, string networkFunctionName) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkFunctionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function 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 networkFunctionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkFunctionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkFunctionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, NetworkFunctionData 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, 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; + } + + /// Creates or updates a network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Resource name for the network function resource. + /// Parameters supplied in the body to the create or update network function operation. + /// 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 networkFunctionName, NetworkFunctionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, networkFunctionName, 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); + } + } + + /// Creates or updates a network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Resource name for the network function resource. + /// Parameters supplied in the body to the create or update network function operation. + /// 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 networkFunctionName, NetworkFunctionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, networkFunctionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, TagsObject tagsObject) + { + 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.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the tags for the network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Resource name for the network function resource. + /// Parameters supplied to the update network function tags operation. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string networkFunctionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, networkFunctionName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the tags for the network function resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Resource name for the network function resource. + /// Parameters supplied to the update network function tags operation. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string networkFunctionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, networkFunctionName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkFunctionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionData.DeserializeNetworkFunctionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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.HybridNetwork/networkFunctions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the network functions in a subscription. + /// 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: + { + NetworkFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the network functions in a subscription. + /// 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: + { + NetworkFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(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.HybridNetwork/networkFunctions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the network function resources in a 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: + { + NetworkFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the network function resources in a 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: + { + NetworkFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateExecuteRequestRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, ExecuteRequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/networkFunctions/", false); + uri.AppendPath(networkFunctionName, true); + uri.AppendPath("/executeRequest", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Execute a request to services on a containerized network function. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// Payload for execute request post call. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task ExecuteRequestAsync(string subscriptionId, string resourceGroupName, string networkFunctionName, ExecuteRequestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateExecuteRequestRequest(subscriptionId, resourceGroupName, networkFunctionName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Execute a request to services on a containerized network function. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network function. + /// Payload for execute request post call. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ExecuteRequest(string subscriptionId, string resourceGroupName, string networkFunctionName, ExecuteRequestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(networkFunctionName, nameof(networkFunctionName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateExecuteRequestRequest(subscriptionId, resourceGroupName, networkFunctionName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + 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; + } + + /// Lists all the network functions in a subscription. + /// 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: + { + NetworkFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the network functions in a subscription. + /// 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: + { + NetworkFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(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; + } + + /// Lists all the network function resources in a 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: + { + NetworkFunctionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the network function resources in a 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: + { + NetworkFunctionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkFunctionListResult.DeserializeNetworkFunctionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignGroupsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignGroupsRestOperations.cs new file mode 100644 index 0000000000000..0a8e620dd2e3b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignGroupsRestOperations.cs @@ -0,0 +1,535 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkServiceDesignGroupsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkServiceDesignGroupsRestOperations. + /// 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 NetworkServiceDesignGroupsRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByPublisherRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information of the network service design groups under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherAsync(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignGroupListResult.DeserializeNetworkServiceDesignGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the network service design groups under a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisher(string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignGroupListResult.DeserializeNetworkServiceDesignGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a specified network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// 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 publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a specified network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// 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 publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, NetworkServiceDesignGroupData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, 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; + } + + /// Creates or updates a network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 publisherName, string networkServiceDesignGroupName, NetworkServiceDesignGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, 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); + } + } + + /// Creates or updates a network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 publisherName, string networkServiceDesignGroupName, NetworkServiceDesignGroupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified networkServiceDesign group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// 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 publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkServiceDesignGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified networkServiceDesign group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// 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 publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkServiceDesignGroupData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a network service design groups resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 publisherName, string networkServiceDesignGroupName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a network service design groups resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// Parameters supplied to the create or update publisher network service design group operation. + /// 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 publisherName, string networkServiceDesignGroupName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignGroupData.DeserializeNetworkServiceDesignGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByPublisherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName) + { + 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; + } + + /// Gets information of the network service design groups under a publisher. + /// 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 name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByPublisherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignGroupListResult.DeserializeNetworkServiceDesignGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information of the network service design groups under a publisher. + /// 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 name of the publisher. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByPublisherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateListByPublisherNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignGroupListResult.DeserializeNetworkServiceDesignGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignVersionsRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignVersionsRestOperations.cs new file mode 100644 index 0000000000000..c046c6ccd4d36 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/NetworkServiceDesignVersionsRestOperations.cs @@ -0,0 +1,660 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class NetworkServiceDesignVersionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkServiceDesignVersionsRestOperations. + /// 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 NetworkServiceDesignVersionsRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, 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; + } + + /// Creates or updates a network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, 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); + } + } + + /// Creates or updates a network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkServiceDesignVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a network service design version. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkServiceDesignVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a network service design version resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a network service design version resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to the create or update network service design version operation. + /// 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 publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignVersionData.DeserializeNetworkServiceDesignVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkServiceDesignGroupRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about a list of network service design versions under a network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkServiceDesignGroupAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateListByNetworkServiceDesignGroupRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignVersionListResult.DeserializeNetworkServiceDesignVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a list of network service design versions under a network service design group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkServiceDesignGroup(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateListByNetworkServiceDesignGroupRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignVersionListResult.DeserializeNetworkServiceDesignVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/networkServiceDesignGroups/", false); + uri.AppendPath(networkServiceDesignGroupName, true); + uri.AppendPath("/networkServiceDesignVersions/", false); + uri.AppendPath(networkServiceDesignVersionName, true); + uri.AppendPath("/updateState", false); + 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(networkServiceDesignVersionUpdateState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update network service design version state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to update the state of network service design version. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(networkServiceDesignVersionUpdateState, nameof(networkServiceDesignVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, networkServiceDesignVersionUpdateState); + 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 network service design version state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the network service design group. + /// The name of the network service design version. The name should conform to the SemVer 2.0.0 specification: https://semver.org/spec/v2.0.0.html. + /// Parameters supplied to update the state of network service design version. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, string networkServiceDesignVersionName, NetworkServiceDesignVersionUpdateState networkServiceDesignVersionUpdateState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignVersionName, nameof(networkServiceDesignVersionName)); + Argument.AssertNotNull(networkServiceDesignVersionUpdateState, nameof(networkServiceDesignVersionUpdateState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName, networkServiceDesignVersionName, networkServiceDesignVersionUpdateState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByNetworkServiceDesignGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName) + { + 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; + } + + /// Gets information about a list of network service design versions under a network service design 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 name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByNetworkServiceDesignGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateListByNetworkServiceDesignGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkServiceDesignVersionListResult.DeserializeNetworkServiceDesignVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about a list of network service design versions under a network service design 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 name of the publisher. + /// The name of the network service design group. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByNetworkServiceDesignGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string networkServiceDesignGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(networkServiceDesignGroupName, nameof(networkServiceDesignGroupName)); + + using var message = CreateListByNetworkServiceDesignGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, networkServiceDesignGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkServiceDesignVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkServiceDesignVersionListResult.DeserializeNetworkServiceDesignVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ProxyArtifactRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ProxyArtifactRestOperations.cs new file mode 100644 index 0000000000000..139d3dd38c2a3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/ProxyArtifactRestOperations.cs @@ -0,0 +1,474 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class ProxyArtifactRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProxyArtifactRestOperations. + /// 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 ProxyArtifactRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifacts", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the available artifacts in the parent Artifact Store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactOverviewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProxyArtifactOverviewListResult.DeserializeProxyArtifactOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the available artifacts in the parent Artifact Store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactOverviewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProxyArtifactOverviewListResult.DeserializeProxyArtifactOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactVersions", false); + uri.AppendQuery("artifactName", artifactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Artifact overview information. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact. + /// 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 publisherName, string artifactStoreName, string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactVersionsOverviewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProxyArtifactVersionsOverviewListResult.DeserializeProxyArtifactVersionsOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Artifact overview information. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact. + /// 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 publisherName, string artifactStoreName, string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactVersionsOverviewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProxyArtifactVersionsOverviewListResult.DeserializeProxyArtifactVersionsOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateStateRequest(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendPath("/artifactStores/", false); + uri.AppendPath(artifactStoreName, true); + uri.AppendPath("/artifactVersions/", false); + uri.AppendPath(artifactVersionName, true); + uri.AppendQuery("artifactName", artifactName, 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(artifactChangeState); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Change artifact state defined in artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact version. + /// The name of the artifact. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task UpdateStateAsync(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactVersionName, nameof(artifactVersionName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + Argument.AssertNotNull(artifactChangeState, nameof(artifactChangeState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactVersionName, artifactName, artifactChangeState); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Change artifact state defined in artifact store. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// The name of the artifact store. + /// The name of the artifact version. + /// The name of the artifact. + /// Parameters supplied to update the state of artifact manifest. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response UpdateState(string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactVersionName, string artifactName, ArtifactChangeState artifactChangeState, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNullOrEmpty(artifactVersionName, nameof(artifactVersionName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + Argument.AssertNotNull(artifactChangeState, nameof(artifactChangeState)); + + using var message = CreateUpdateStateRequest(subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactVersionName, artifactName, artifactChangeState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName) + { + 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; + } + + /// Lists all the available artifacts in the parent Artifact Store. + /// 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 name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactOverviewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProxyArtifactOverviewListResult.DeserializeProxyArtifactOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the available artifacts in the parent Artifact Store. + /// 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 name of the publisher. + /// The name of the artifact store. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactOverviewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProxyArtifactOverviewListResult.DeserializeProxyArtifactOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactName) + { + 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; + } + + /// Get a Artifact overview information. + /// 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 name of the publisher. + /// The name of the artifact store. + /// The name of the artifact. + /// The cancellation token to use. + /// , , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + using var message = CreateGetNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactVersionsOverviewListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ProxyArtifactVersionsOverviewListResult.DeserializeProxyArtifactVersionsOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Artifact overview information. + /// 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 name of the publisher. + /// The name of the artifact store. + /// The name of the artifact. + /// The cancellation token to use. + /// , , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetNextPage(string nextLink, string subscriptionId, string resourceGroupName, string publisherName, string artifactStoreName, string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNullOrEmpty(artifactStoreName, nameof(artifactStoreName)); + Argument.AssertNotNull(artifactName, nameof(artifactName)); + + using var message = CreateGetNextPageRequest(nextLink, subscriptionId, resourceGroupName, publisherName, artifactStoreName, artifactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ProxyArtifactVersionsOverviewListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ProxyArtifactVersionsOverviewListResult.DeserializeProxyArtifactVersionsOverviewListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/PublishersRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/PublishersRestOperations.cs new file mode 100644 index 0000000000000..f64b44171432b --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/PublishersRestOperations.cs @@ -0,0 +1,636 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class PublishersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PublishersRestOperations. + /// 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 PublishersRestOperations(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-09-01"; + _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.HybridNetwork/publishers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the publishers in a subscription. + /// 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: + { + PublisherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the publishers in a subscription. + /// 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: + { + PublisherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherListResult.DeserializePublisherListResult(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.HybridNetwork/publishers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all the publishers in a 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: + { + PublisherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the publishers in a 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: + { + PublisherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// 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 publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// 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 publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string publisherName) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// 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 publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublisherData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherData.DeserializePublisherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PublisherData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// 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 publisherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, publisherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublisherData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherData.DeserializePublisherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PublisherData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string publisherName, PublisherData 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, 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; + } + + /// Creates or updates a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, PublisherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, 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); + } + } + + /// Creates or updates a publisher. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, PublisherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, publisherName, 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 publisherName, TagsObject tagsObject) + { + 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.HybridNetwork/publishers/", false); + uri.AppendPath(publisherName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a publisher resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PublisherData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherData.DeserializePublisherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a publisher resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the publisher. + /// Parameters supplied to the create publisher operation. + /// 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 publisherName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(publisherName, nameof(publisherName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, publisherName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PublisherData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherData.DeserializePublisherData(document.RootElement); + return Response.FromValue(value, 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; + } + + /// Lists all the publishers in a subscription. + /// 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: + { + PublisherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the publishers in a subscription. + /// 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: + { + PublisherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherListResult.DeserializePublisherListResult(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; + } + + /// Lists all the publishers in a 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: + { + PublisherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all the publishers in a 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: + { + PublisherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PublisherListResult.DeserializePublisherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SiteNetworkServicesRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SiteNetworkServicesRestOperations.cs new file mode 100644 index 0000000000000..68d76d178b58e --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SiteNetworkServicesRestOperations.cs @@ -0,0 +1,636 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class SiteNetworkServicesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SiteNetworkServicesRestOperations. + /// 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 SiteNetworkServicesRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string siteNetworkServiceName) + { + 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.HybridNetwork/siteNetworkServices/", false); + uri.AppendPath(siteNetworkServiceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified site network service. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// 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 siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, siteNetworkServiceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified site network service. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// 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 siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, siteNetworkServiceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string siteNetworkServiceName) + { + 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.HybridNetwork/siteNetworkServices/", false); + uri.AppendPath(siteNetworkServiceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified site network service. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// 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 siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, siteNetworkServiceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SiteNetworkServiceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified site network service. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// 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 siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, siteNetworkServiceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SiteNetworkServiceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string siteNetworkServiceName, SiteNetworkServiceData 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.HybridNetwork/siteNetworkServices/", false); + uri.AppendPath(siteNetworkServiceName, 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; + } + + /// Creates or updates a network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// Parameters supplied to the create or update site network service operation. + /// 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 siteNetworkServiceName, SiteNetworkServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, siteNetworkServiceName, 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); + } + } + + /// Creates or updates a network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// Parameters supplied to the create or update site network service operation. + /// 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 siteNetworkServiceName, SiteNetworkServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, siteNetworkServiceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string siteNetworkServiceName, TagsObject tagsObject) + { + 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.HybridNetwork/siteNetworkServices/", false); + uri.AppendPath(siteNetworkServiceName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a site update tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string siteNetworkServiceName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, siteNetworkServiceName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a site update tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the site network service. + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string siteNetworkServiceName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, siteNetworkServiceName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteNetworkServiceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceData.DeserializeSiteNetworkServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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.HybridNetwork/siteNetworkServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all sites in the network service in a subscription. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service in a subscription. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(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.HybridNetwork/siteNetworkServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all site network services. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all site network services. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, 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; + } + + /// Lists all sites in the network service in a subscription. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service in a subscription. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(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; + } + + /// Lists all site network services. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all site network services. + /// 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: + { + SiteNetworkServiceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteNetworkServiceListResult.DeserializeSiteNetworkServiceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SitesRestOperations.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SitesRestOperations.cs new file mode 100644 index 0000000000000..4d431ea381cbf --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/RestOperations/SitesRestOperations.cs @@ -0,0 +1,636 @@ +// 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.HybridNetwork.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + internal partial class SitesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SitesRestOperations. + /// 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 SitesRestOperations(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-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string siteName) + { + 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.HybridNetwork/sites/", false); + uri.AppendPath(siteName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// 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 siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, siteName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// 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 siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, siteName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string siteName) + { + 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.HybridNetwork/sites/", false); + uri.AppendPath(siteName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets information about the specified network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// 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 siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, siteName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteData.DeserializeSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SiteData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets information about the specified network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// 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 siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, siteName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteData.DeserializeSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SiteData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string siteName, SiteData 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.HybridNetwork/sites/", false); + uri.AppendPath(siteName, 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; + } + + /// Creates or updates a network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// Parameters supplied to the create or update network site operation. + /// 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 siteName, SiteData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, siteName, 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); + } + } + + /// Creates or updates a network site. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// Parameters supplied to the create or update network site operation. + /// 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 siteName, SiteData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, siteName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string siteName, TagsObject tagsObject) + { + 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.HybridNetwork/sites/", false); + uri.AppendPath(siteName, 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(tagsObject); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a site update tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateTagsAsync(string subscriptionId, string resourceGroupName, string siteName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, siteName, tagsObject); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SiteData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteData.DeserializeSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a site update tags. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the network service site. + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateTags(string subscriptionId, string resourceGroupName, string siteName, TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, siteName, tagsObject); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SiteData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteData.DeserializeSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + 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.HybridNetwork/sites", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all sites in the network service in a subscription. + /// 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: + { + SiteListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service in a subscription. + /// 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: + { + SiteListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteListResult.DeserializeSiteListResult(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.HybridNetwork/sites", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all sites in the network service. + /// 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: + { + SiteListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service. + /// 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: + { + SiteListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, 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; + } + + /// Lists all sites in the network service in a subscription. + /// 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: + { + SiteListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service in a subscription. + /// 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: + { + SiteListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteListResult.DeserializeSiteListResult(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; + } + + /// Lists all sites in the network service. + /// 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: + { + SiteListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all sites in the network service. + /// 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: + { + SiteListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SiteListResult.DeserializeSiteListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteCollection.cs new file mode 100644 index 0000000000000..6f7747026edec --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteCollection.cs @@ -0,0 +1,416 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSites method from an instance of . + /// + public partial class SiteCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _siteClientDiagnostics; + private readonly SitesRestOperations _siteRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteCollection() + { + } + + /// 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 SiteCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _siteClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", SiteResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SiteResource.ResourceType, out string siteApiVersion); + _siteRestClient = new SitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, siteApiVersion); +#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)); + } + + /// + /// Creates or updates a network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 network service site. + /// Parameters supplied to the create or update network site operation. + /// 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 siteName, SiteData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _siteRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, siteName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new SiteOperationSource(Client), _siteClientDiagnostics, Pipeline, _siteRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, siteName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 network service site. + /// Parameters supplied to the create or update network site operation. + /// 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 siteName, SiteData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _siteRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, siteName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new SiteOperationSource(Client), _siteClientDiagnostics, Pipeline, _siteRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, siteName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.Get"); + scope.Start(); + try + { + var response = await _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.Get"); + scope.Start(); + try + { + var response = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all sites in the network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_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) => _siteRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _siteRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteResource(Client, SiteData.DeserializeSiteData(e)), _siteClientDiagnostics, Pipeline, "SiteCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all sites in the network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites + /// + /// + /// Operation Id + /// Sites_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) => _siteRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _siteRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteResource(Client, SiteData.DeserializeSiteData(e)), _siteClientDiagnostics, Pipeline, "SiteCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.Exists"); + scope.Start(); + try + { + var response = await _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteName, 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.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.Exists"); + scope.Start(); + try + { + var response = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The name of the network service site. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string siteName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteData.cs new file mode 100644 index 0000000000000..4209cbd229fc9 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the Site data model. + /// Site resource. + /// + public partial class SiteData : TrackedResourceData + { + /// Initializes a new instance of SiteData. + /// The location. + public SiteData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of SiteData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Site properties. + internal SiteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SitePropertiesFormat properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Site properties. + public SitePropertiesFormat Properties { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceCollection.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceCollection.cs new file mode 100644 index 0000000000000..849638fa9ee4c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceCollection.cs @@ -0,0 +1,416 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSiteNetworkServices method from an instance of . + /// + public partial class SiteNetworkServiceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _siteNetworkServiceClientDiagnostics; + private readonly SiteNetworkServicesRestOperations _siteNetworkServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteNetworkServiceCollection() + { + } + + /// 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 SiteNetworkServiceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _siteNetworkServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", SiteNetworkServiceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SiteNetworkServiceResource.ResourceType, out string siteNetworkServiceApiVersion); + _siteNetworkServiceRestClient = new SiteNetworkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, siteNetworkServiceApiVersion); +#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)); + } + + /// + /// Creates or updates a network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 site network service. + /// Parameters supplied to the create or update site network service operation. + /// 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 siteNetworkServiceName, SiteNetworkServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, data, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(new SiteNetworkServiceOperationSource(Client), _siteNetworkServiceClientDiagnostics, Pipeline, _siteNetworkServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 site network service. + /// Parameters supplied to the create or update site network service operation. + /// 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 siteNetworkServiceName, SiteNetworkServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, data, cancellationToken); + var operation = new HybridNetworkArmOperation(new SiteNetworkServiceOperationSource(Client), _siteNetworkServiceClientDiagnostics, Pipeline, _siteNetworkServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.Get"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.Get"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all site network services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_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) => _siteNetworkServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _siteNetworkServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteNetworkServiceResource(Client, SiteNetworkServiceData.DeserializeSiteNetworkServiceData(e)), _siteNetworkServiceClientDiagnostics, Pipeline, "SiteNetworkServiceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all site network services. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices + /// + /// + /// Operation Id + /// SiteNetworkServices_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) => _siteNetworkServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _siteNetworkServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteNetworkServiceResource(Client, SiteNetworkServiceData.DeserializeSiteNetworkServiceData(e)), _siteNetworkServiceClientDiagnostics, Pipeline, "SiteNetworkServiceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.Exists"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, 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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.Exists"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The name of the site network service. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string siteNetworkServiceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(siteNetworkServiceName, nameof(siteNetworkServiceName)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, siteNetworkServiceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), 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/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceData.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceData.cs new file mode 100644 index 0000000000000..52b7473740a2d --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A class representing the SiteNetworkService data model. + /// Site network service resource. + /// + public partial class SiteNetworkServiceData : TrackedResourceData + { + /// Initializes a new instance of SiteNetworkServiceData. + /// The location. + public SiteNetworkServiceData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of SiteNetworkServiceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Site network service properties. + /// The managed identity of the Site network service, if configured. + /// Sku of the site network service. + internal SiteNetworkServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SiteNetworkServicePropertiesFormat properties, ManagedServiceIdentity identity, HybridNetworkSku sku) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + Sku = sku; + } + + /// Site network service properties. + public SiteNetworkServicePropertiesFormat Properties { get; set; } + /// The managed identity of the Site network service, if configured. + public ManagedServiceIdentity Identity { get; set; } + /// Sku of the site network service. + public HybridNetworkSku Sku { get; set; } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceResource.cs new file mode 100644 index 0000000000000..a70cda25067b3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteNetworkServiceResource.cs @@ -0,0 +1,605 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a SiteNetworkService along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSiteNetworkServiceResource method. + /// Otherwise you can get one from its parent resource using the GetSiteNetworkService method. + /// + public partial class SiteNetworkServiceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteNetworkServiceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteNetworkServiceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _siteNetworkServiceClientDiagnostics; + private readonly SiteNetworkServicesRestOperations _siteNetworkServiceRestClient; + private readonly SiteNetworkServiceData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteNetworkServiceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteNetworkServiceResource(ArmClient client, SiteNetworkServiceData 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 SiteNetworkServiceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _siteNetworkServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string siteNetworkServiceApiVersion); + _siteNetworkServiceRestClient = new SiteNetworkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, siteNetworkServiceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/siteNetworkServices"; + + /// 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 SiteNetworkServiceData 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)); + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Get"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Get"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Delete"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_siteNetworkServiceClientDiagnostics, Pipeline, _siteNetworkServiceRestClient.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; + } + } + + /// + /// Deletes the specified site network service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Delete"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_siteNetworkServiceClientDiagnostics, Pipeline, _siteNetworkServiceRestClient.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; + } + } + + /// + /// Updates a site update tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_UpdateTags + /// + /// + /// + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Update"); + scope.Start(); + try + { + var response = await _siteNetworkServiceRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a site update tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_UpdateTags + /// + /// + /// + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.Update"); + scope.Start(); + try + { + var response = _siteNetworkServiceRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new SiteNetworkServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 _siteNetworkServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/siteNetworkServices/{siteNetworkServiceName} + /// + /// + /// Operation Id + /// SiteNetworkServices_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 = _siteNetworkServiceClientDiagnostics.CreateScope("SiteNetworkServiceResource.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 = _siteNetworkServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteNetworkServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteResource.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteResource.cs new file mode 100644 index 0000000000000..1cb127300b684 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Generated/SiteResource.cs @@ -0,0 +1,605 @@ +// 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.HybridNetwork.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.HybridNetwork +{ + /// + /// A Class representing a Site along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSiteResource method. + /// Otherwise you can get one from its parent resource using the GetSite method. + /// + public partial class SiteResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _siteClientDiagnostics; + private readonly SitesRestOperations _siteRestClient; + private readonly SiteData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteResource(ArmClient client, SiteData 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 SiteResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _siteClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.HybridNetwork", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string siteApiVersion); + _siteRestClient = new SitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, siteApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.HybridNetwork/sites"; + + /// 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 SiteData 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)); + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Get"); + scope.Start(); + try + { + var response = await _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Get"); + scope.Start(); + try + { + var response = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 = _siteClientDiagnostics.CreateScope("SiteResource.Delete"); + scope.Start(); + try + { + var response = await _siteRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HybridNetworkArmOperation(_siteClientDiagnostics, Pipeline, _siteRestClient.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; + } + } + + /// + /// Deletes the specified network site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 = _siteClientDiagnostics.CreateScope("SiteResource.Delete"); + scope.Start(); + try + { + var response = _siteRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new HybridNetworkArmOperation(_siteClientDiagnostics, Pipeline, _siteRestClient.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; + } + } + + /// + /// Updates a site update tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_UpdateTags + /// + /// + /// + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Update"); + scope.Start(); + try + { + var response = await _siteRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a site update tags. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_UpdateTags + /// + /// + /// + /// Parameters supplied to update network site tags. + /// The cancellation token to use. + /// is null. + public virtual Response Update(TagsObject tagsObject, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tagsObject, nameof(tagsObject)); + + using var scope = _siteClientDiagnostics.CreateScope("SiteResource.Update"); + scope.Start(); + try + { + var response = _siteRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tagsObject, cancellationToken); + return Response.FromValue(new SiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 = _siteClientDiagnostics.CreateScope("SiteResource.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 _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 = _siteClientDiagnostics.CreateScope("SiteResource.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 = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 = _siteClientDiagnostics.CreateScope("SiteResource.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 _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 = _siteClientDiagnostics.CreateScope("SiteResource.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 = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 = _siteClientDiagnostics.CreateScope("SiteResource.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 _siteRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridNetwork/sites/{siteName} + /// + /// + /// Operation Id + /// Sites_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 = _siteClientDiagnostics.CreateScope("SiteResource.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 = _siteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SiteResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new TagsObject(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Properties/AssemblyInfo.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..4a2ad91cf3cc3 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/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("HybridNetwork")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.HybridNetwork.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/autorest.md b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/autorest.md new file mode 100644 index 0000000000000..f1af0f3e1c321 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/src/autorest.md @@ -0,0 +1,101 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +csharp: true +library-name: HybridNetwork +namespace: Azure.ResourceManager.HybridNetwork +require: https://github.com/Azure/azure-rest-api-specs/blob/eccca594dd50892ada8220fe7b1587c12cc5c871/specification/hybridnetwork/resource-manager/readme.md +output-folder: $(this-folder)/Generated +clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../samples/Generated + clear-output-folder: true +skip-csproj: true +modelerfour: + flatten-payloads: false + +#mgmt-debug: +# show-serialized-names: true + + + +format-by-name-rules: + 'tenantId': 'uuid' + 'ETag': 'etag' + 'location': 'azure-location' + '*Uri': 'Uri' + '*Uris': 'Uri' + +acronym-mapping: + 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 + +rename-mapping: + HelmInstallOptions: HelmInstallConfig + HelmUpgradeOptions: HelmUpgradeConfig + HelmMappingRuleProfileOptions: HelmMappingRuleProfileConfig + Resources: ComponentKubernetesResources + Status: ComponentStatus + DaemonSet: KubernetesDaemonSet + DaemonSet.desired: DesiredNumberOfPods + DaemonSet.ready: ReadyNumberOfPods + DaemonSet.current: CurrentNumberOfPods + DaemonSet.upToDate: UpToDateNumberOfPods + DaemonSet.available: AvailableNumberOfPods + Deployment: KubernetesDeployment + Deployment.desired: DesiredNumberOfPods + Deployment.ready: ReadyNumberOfPods + Deployment.current: CurrentNumberOfPods + Deployment.upToDate: UpToDateNumberOfPods + Deployment.available: AvailableNumberOfPods + Pod: KubernetesPod + Pod.desired: DesiredNumberOfContainers + Pod.ready: ReadyNumberOfContainers + ReplicaSet: KubernetesReplicaSet + ReplicaSet.desired: DesiredNumberOfPods + ReplicaSet.ready: ReadyNumberOfPods + ReplicaSet.current: CurrentNumberOfPods + StatefulSet: KubernetesStatefulSet + StatefulSet.desired: DesiredNumberOfPods + StatefulSet.ready: ReadyNumberOfPods + +directive: +- from: publisher.json + where: $.definitions.ArtifactStorePropertiesFormat.properties.storageResourceId + transform: $["x-ms-format"] = "arm-id"; +- from: common.json + where: $.definitions.AzureStorageAccountCredential.properties.storageAccountId + transform: $["x-ms-format"] = "arm-id"; +- from: common.json + where: $.definitions.SecretDeploymentResourceReference.properties.id + transform: $["x-ms-format"] = "arm-id"; +- from: common.json + where: $.definitions.OpenDeploymentResourceReference.properties.id + transform: $["x-ms-format"] = "arm-id"; +- from: networkFunction.json + where: $.definitions.NetworkFunctionPropertiesFormat.properties.nfviId + transform: $["x-ms-format"] = "arm-id"; + +``` diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Azure.ResourceManager.HybridNetwork.Tests.csproj b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Azure.ResourceManager.HybridNetwork.Tests.csproj new file mode 100644 index 0000000000000..4073905dd14bc --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Azure.ResourceManager.HybridNetwork.Tests.csproj @@ -0,0 +1,17 @@ + + + $(RequiredTargetFrameworks) + + + + + + + + + + + Always + + + diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestBase.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestBase.cs new file mode 100644 index 0000000000000..6a8cccd983920 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestBase.cs @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using Newtonsoft.Json.Linq; +using System.Diagnostics; +using System.Threading.Tasks; +using System.IO; + +namespace Azure.ResourceManager.HybridNetwork.Tests +{ + public class HybridNetworkManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + private readonly string TestAssetPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "Scenario", "TestAssets"); + protected readonly string VnetArmTemplateArtifactName = "vnet-arm-template"; + protected readonly string VnetArmTemplateFileName = "VnetArmTemplate.json"; + protected readonly string VnetArmTemplateMappingFileName = "VnetArmTemplateMappings.json"; + protected readonly string NfArmTemplateArtifactName = "nf-arm-template"; + protected readonly string NfArmTemplateFileName = "NfArmTemplate.json"; + protected readonly string NfArmTemplateMappingFileName = "NfArmTemplateMappings.json"; + protected readonly string DeployParametersFileName = "DeployParameters.json"; + protected readonly string DeployValuesFileName = "DeploymentValues.json"; + protected readonly string NfviName = "exampleNFVI"; + protected readonly string CGSchemaFileName = "CGSchema.json"; + + protected HybridNetworkManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + JsonPathSanitizers.Add("$..acrToken"); + } + + protected HybridNetworkManagementTestBase(bool isAsync) + : base(isAsync) + { + JsonPathSanitizers.Add("$..acrToken"); + } + + protected void UploadArmTemplate( + string fileName, + string artifactName, + string artifactVersion, + AzureContainerRegistryScopedTokenCredential creds) + { + string templateFilePath = Path.Combine(TestAssetPath, fileName); + string acrName = creds.AcrServerUri.ToString().Replace("https://", "").TrimEnd('/'); + + if (File.Exists(templateFilePath)) + { + // Create a process to run the oras commands + Process process = new Process(); + process.StartInfo.FileName = "oras"; + + // Run login command + process.StartInfo.Arguments = $"login {acrName} --username {creds.Username} --password {creds.AcrToken}"; + process.Start(); + process.WaitForExit(); + + // Run push command + process.StartInfo.Arguments = $"push {acrName}/{artifactName}:{artifactVersion} {templateFilePath}:application/vnd.microsoft.azure.resource+json --disable-path-validation"; + process.Start(); + process.WaitForExit(); + } + else + { + throw new FileNotFoundException(); + } + } + + protected JObject ReadJsonFile(string filePath) + { + var json = File.ReadAllText(Path.Combine(TestAssetPath, filePath)); + return JObject.Parse(json); + } + + protected async Task CreatePublisherResource( + ResourceGroupResource resourceGroup, + string publisherName, + AzureLocation location) + { + var publisherData = new PublisherData(location) + { + Properties = new PublisherPropertiesFormat() + { + Scope = PublisherScope.Private + } + }; + var lro = await resourceGroup + .GetPublishers() + .CreateOrUpdateAsync(WaitUntil.Completed, publisherName, publisherData); + + return lro.Value; + } + + protected async Task CreateConfigGroupSchemaResource( + PublisherResource publisher, + string cgSchemaName, + AzureLocation location) + { + var cgSchemaData = new ConfigurationGroupSchemaData(location) + { + Properties = new ConfigurationGroupSchemaPropertiesFormat() + { + SchemaDefinition = ReadJsonFile(CGSchemaFileName).ToString(Newtonsoft.Json.Formatting.None), + } + }; + var lro = await publisher + .GetConfigurationGroupSchemas() + .CreateOrUpdateAsync(WaitUntil.Completed, cgSchemaName, cgSchemaData); + + return lro.Value; + } + + protected async Task CreateArtifactStoreResource( + PublisherResource publisher, + string artifactStoreName, + AzureLocation location) + { + var artifactStoreData = new ArtifactStoreData(location) + { + Properties = new ArtifactStorePropertiesFormat() + { + StoreType = ArtifactStoreType.AzureContainerRegistry, + ReplicationStrategy = ArtifactReplicationStrategy.SingleReplication, + } + }; + var lro = await publisher + .GetArtifactStores() + .CreateOrUpdateAsync(WaitUntil.Completed, artifactStoreName, artifactStoreData); + + return lro.Value; + } + + protected async Task CreateNFDGResource( + PublisherResource publisher, + string nfdgName, + AzureLocation location) + { + var nfdgData = new NetworkFunctionDefinitionGroupData(location) + { + Properties = new NetworkFunctionDefinitionGroupPropertiesFormat() + { + Description = "NFD for .NET SDK UTs." + } + }; + var lro = await publisher + .GetNetworkFunctionDefinitionGroups() + .CreateOrUpdateAsync(WaitUntil.Completed, nfdgName, nfdgData); + + return lro.Value; + } + + protected async Task CreateNSDGResource( + PublisherResource publisher, + string nsdgName, + AzureLocation location) + { + var nsdgData = new NetworkServiceDesignGroupData(location) + { + Properties = new NetworkServiceDesignGroupPropertiesFormat() + { + Description = "NSD for .NET SDK UTs." + } + }; + var lro = await publisher + .GetNetworkServiceDesignGroups() + .CreateOrUpdateAsync(WaitUntil.Completed, nsdgName, nsdgData); + + return lro.Value; + } + + protected async Task CreateArtifactManifestResource( + ArtifactStoreResource artifactStore, + string artifactManifestName, + AzureLocation location) + { + var vnetArtifact = new ManifestArtifactFormat() + { + ArtifactName = VnetArmTemplateArtifactName, + ArtifactType = ArtifactType.OCIArtifact, + ArtifactVersion = "1.0.0", + }; + var nfArtifact = new ManifestArtifactFormat() + { + ArtifactName = NfArmTemplateArtifactName, + ArtifactType = ArtifactType.OCIArtifact, + ArtifactVersion = "1.0.0", + }; + var artifactManifestData = new ArtifactManifestData(location) + { + Properties = new ArtifactManifestPropertiesFormat(), + }; + + artifactManifestData.Properties.Artifacts.Add(vnetArtifact); + artifactManifestData.Properties.Artifacts.Add(nfArtifact); + var lro = await artifactStore + .GetArtifactManifests() + .CreateOrUpdateAsync(WaitUntil.Completed, artifactManifestName, artifactManifestData); + + return lro.Value; + } + + protected async Task CreateNFDVResource( + NetworkFunctionDefinitionGroupResource nfdg, + ArtifactStoreResource artifactStore, + string nfdvName, + AzureLocation location) + { + var vnetArmApp = new AzureCoreNetworkFunctionArmTemplateApplication() + { + Name = "vnetArmApp", + DeployParametersMappingRuleProfile = new AzureCoreArmTemplateDeployMappingRuleProfile() + { + ApplicationEnablement = ApplicationEnablement.Unknown, + TemplateParameters = ReadJsonFile(VnetArmTemplateMappingFileName).ToString(Newtonsoft.Json.Formatting.None) + }, + ArtifactProfile = new AzureCoreArmTemplateArtifactProfile() + { + ArtifactStoreId = artifactStore.Id, + TemplateArtifactProfile = new ArmTemplateArtifactProfile() + { + TemplateName = VnetArmTemplateArtifactName, + TemplateVersion = "1.0.0", + } + } + }; + + AzureCoreNetworkFunctionTemplate nfTemplate = new AzureCoreNetworkFunctionTemplate() + { + NfviType = VirtualNetworkFunctionNfviType.AzureCore, + }; + + nfTemplate.NetworkFunctionApplications.Add(vnetArmApp); + + VirtualNetworkFunctionDefinitionVersion vnfProps = new VirtualNetworkFunctionDefinitionVersion() + { + NetworkFunctionType = NetworkFunctionType.VirtualNetworkFunction, + NetworkFunctionTemplate = nfTemplate, + DeployParameters = ReadJsonFile(DeployParametersFileName).ToString(Newtonsoft.Json.Formatting.None) + }; + + var nfdvData = new NetworkFunctionDefinitionVersionData(location) + { + Properties = vnfProps + }; + + var lro = await nfdg + .GetNetworkFunctionDefinitionVersions() + .CreateOrUpdateAsync(WaitUntil.Completed, nfdvName, nfdvData); + + return lro.Value; + } + + protected async Task CreateNSDVResource( + NetworkServiceDesignGroupResource nsdg, + ConfigurationGroupSchemaResource cgs, + ArtifactStoreResource artifactStore, + string nsdvName, + AzureLocation location) + { + var nsdvData = new NetworkServiceDesignVersionData(location) + { + Properties = new NetworkServiceDesignVersionPropertiesFormat() + { + Description = "An SNS that defploys an NF that deploys a VNET." + } + }; + + nsdvData.Properties.NfvisFromSite.Add("nfvi1", new NfviDetails() + { + Name = NfviName, + NfviDetailsType = "AzureCore" + }); + + nsdvData.Properties.ConfigurationGroupSchemaReferences.Add("vnet_ConfigGroupSchema", new Resources.Models.WritableSubResource() { Id = cgs.Id }); + + var vnetResourceElementTemplate = new NetworkFunctionDefinitionResourceElementTemplateDetails() + { + Name = "VnetRET", + DependsOnProfile = new DependsOnProfile(), + Configuration = new ArmResourceDefinitionResourceElementTemplate() + { + ArtifactProfile = new NSDArtifactProfile() + { + ArtifactName = NfArmTemplateArtifactName, + ArtifactVersion = "1.0.0", + ArtifactStoreReferenceId = artifactStore.Id, + }, + ParameterValues = ReadJsonFile(NfArmTemplateMappingFileName).ToString(Newtonsoft.Json.Formatting.None), + TemplateType = TemplateType.ArmTemplate + } + }; + + nsdvData.Properties.ResourceElementTemplates.Add(vnetResourceElementTemplate); + + var lro = await nsdg + .GetNetworkServiceDesignVersions() + .CreateOrUpdateAsync(WaitUntil.Completed, nsdvName, nsdvData); + + return lro.Value; + } + + protected async Task CreateSiteResource( + ResourceGroupResource resourceGroup, + string siteName, + AzureLocation location) + { + var nfvi = new AzureCoreNfviDetails() { Name = NfviName, Location = location }; + + var siteData = new SiteData(location) + { + Properties = new SitePropertiesFormat() + }; + + siteData.Properties.Nfvis.Add(nfvi); + + var lro = await resourceGroup + .GetSites() + .CreateOrUpdateAsync(WaitUntil.Completed, siteName, siteData); + + return lro.Value; + } + + protected async Task CreateCGVResource( + ResourceGroupResource resourceGroup, + ConfigurationGroupSchemaResource cgs, + string cgvName, + ResourceIdentifier nfdvId, + AzureLocation location) + { + var deploymentValues = ReadJsonFile(DeployValuesFileName); + deploymentValues["nfdvId"] = nfdvId.ToString(); + + var cgvData = new ConfigurationGroupValueData(location) + { + Properties = new ConfigurationValueWithoutSecrets() + { + ConfigurationGroupSchemaResourceReference = new OpenDeploymentResourceReference() + { + Id = cgs.Id + }, + ConfigurationValue = deploymentValues.ToString(Newtonsoft.Json.Formatting.None) + } + }; + + var lro = await resourceGroup + .GetConfigurationGroupValues() + .CreateOrUpdateAsync(WaitUntil.Completed, cgvName, cgvData); + + return lro.Value; + } + + protected async Task CreateSNSResource( + ResourceGroupResource resourceGroup, + SiteResource site, + NetworkServiceDesignVersionResource nsdv, + ConfigurationGroupValueResource cgv, + string snsName, + AzureLocation location) + { + var snsData = new SiteNetworkServiceData(location) + { + Properties = new SiteNetworkServicePropertiesFormat() + { + SiteReferenceId = site.Id, + NetworkServiceDesignVersionResourceReference = new OpenDeploymentResourceReference() + { + Id = nsdv.Id + } + }, + Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned), + Sku = new HybridNetworkSku(HybridNetworkSkuName.Standard) + }; + + snsData.Properties.DesiredStateConfigurationGroupValueReferences.Add("vnet_ConfigGroupSchema", new Resources.Models.WritableSubResource() { Id = cgv.Id }); + + var lro = await resourceGroup + .GetSiteNetworkServices() + .CreateOrUpdateAsync(WaitUntil.Completed, snsName, snsData); + + return lro.Value; + } + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestEnvironment.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestEnvironment.cs new file mode 100644 index 0000000000000..cd2835805b4ec --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/HybridNetworkManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.HybridNetwork.Tests +{ + public class HybridNetworkManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/HybridNetworkTests.cs b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/HybridNetworkTests.cs new file mode 100644 index 0000000000000..007bfd454c767 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/HybridNetworkTests.cs @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.HybridNetwork.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.HybridNetwork.Tests.Scenario +{ + internal class HybridNetworkTests : HybridNetworkManagementTestBase + { + public HybridNetworkTests(bool isAsync) : base(isAsync) + { + } + + [OneTimeSetUp] + public async Task GlobalSetUp() + { + DefaultResourceGroupName = SessionRecording.GenerateAssetName("HybridNetworkUTRG"); + DefaultResourceLocation = new AzureLocation("eastus2euap"); + + ResourceGroupData rgData = new ResourceGroupData(DefaultResourceLocation); + var rgLro = await GlobalClient + .GetDefaultSubscriptionAsync().Result + .GetResourceGroups() + .CreateOrUpdateAsync(WaitUntil.Completed, DefaultResourceGroupName, rgData); + ResourceGroupResource rg = rgLro.Value; + ResourceGroupId = rg.Id; + + await StopSessionRecordingAsync(); + } + + [SetUp] + public async Task SetUp() + { + Client = GetArmClient(); + + ResourceGroup = await Client.GetResourceGroupResource(ResourceGroupId).GetAsync(); + } + + [OneTimeTearDown] + public void CleanUp() + { + CleanupResourceGroups(); + } + + [TestCase] + [Order(0)] + [RecordedTest] + public async Task CanCreateGetPublisher() + { + var publisherName = Recording.GenerateAssetName("publisher"); + + // Create Publisher + PublisherResource publisher = await CreatePublisherResource(ResourceGroup, publisherName, DefaultResourceLocation); + PublisherId = publisher.Id; + + // Get Publisher + Response getPublisherResponse = await publisher.GetAsync(); + PublisherResource publisherResourceRetrieved = getPublisherResponse.Value; + Assert.IsNotNull(publisherResourceRetrieved); + Assert.AreEqual(publisher.Data.Location, publisherResourceRetrieved.Data.Location); + Assert.AreEqual(PublisherScope.Private, publisherResourceRetrieved.Data.Properties.Scope); + } + + [TestCase] + [Order(0)] + [RecordedTest] + public async Task CanCreateGetSite() + { + var siteName = Recording.GenerateAssetName("site"); + + // Create Publisher + SiteResource site = await CreateSiteResource(ResourceGroup, siteName, DefaultResourceLocation); + SiteId = site.Id; + + // Get Publisher + Response getSiteResponse = await site.GetAsync(); + SiteResource siteResourceRetrieved = getSiteResponse.Value; + Assert.IsNotNull(siteResourceRetrieved); + Assert.AreEqual(site.Data.Location, siteResourceRetrieved.Data.Location); + Assert.AreEqual(NfviName, siteResourceRetrieved.Data.Properties.Nfvis[0].Name); + Assert.AreEqual(NfviType.AzureCore, siteResourceRetrieved.Data.Properties.Nfvis[0].NfviType); + } + + [TestCase] + [Order(1)] + [RecordedTest] + public async Task CanCreateGetConfigGroupSchema() + { + var cgSchemaName = Recording.GenerateAssetName("cgSchema"); + + // Create Artifact Store + PublisherResource publisher = Client.GetPublisherResource(PublisherId); + ConfigurationGroupSchemaResource cgSchema = await CreateConfigGroupSchemaResource(publisher, cgSchemaName, DefaultResourceLocation); + CGSchemaId = cgSchema.Id; + + // Get Artifact Store + Response getArtifactStoreResponse = await cgSchema.GetAsync(); + ConfigurationGroupSchemaResource cgSchemaResourceRetrieved = getArtifactStoreResponse.Value; + ConfigurationGroupSchemaData retrievedData = cgSchemaResourceRetrieved.Data; + Assert.IsNotNull(cgSchemaResourceRetrieved); + var schema = ReadJsonFile(CGSchemaFileName).ToString(Newtonsoft.Json.Formatting.None); + Assert.AreEqual(cgSchema.Data.Location, retrievedData.Location); + Assert.AreEqual(schema, retrievedData.Properties.SchemaDefinition); + } + + [TestCase] + [Order(1)] + [RecordedTest] + public async Task CanCreateGetArtifactStore() + { + var artifactStoreName = Recording.GenerateAssetName("artifactStore"); + + // Create Artifact Store + PublisherResource publisher = Client.GetPublisherResource(PublisherId); + ArtifactStoreResource artifactStore = await CreateArtifactStoreResource(publisher, artifactStoreName, DefaultResourceLocation); + ArtifactStoreId = artifactStore.Id; + + // Get Artifact Store + Response getArtifactStoreResponse = await artifactStore.GetAsync(); + ArtifactStoreResource artifactStoreResourceRetrieved = getArtifactStoreResponse.Value; + ArtifactStoreData retrievedData = artifactStoreResourceRetrieved.Data; + Assert.IsNotNull(artifactStoreResourceRetrieved); + Assert.AreEqual(artifactStore.Data.Location, retrievedData.Location); + Assert.AreEqual(ArtifactStoreType.AzureContainerRegistry, retrievedData.Properties.StoreType); + Assert.AreEqual(ArtifactReplicationStrategy.SingleReplication, retrievedData.Properties.ReplicationStrategy); + } + + [TestCase] + [Order(1)] + [RecordedTest] + public async Task CanCreateGetNFDG() + { + var nfdgName = Recording.GenerateAssetName("nfdg"); + + // Create NFDG + PublisherResource publisher = Client.GetPublisherResource(PublisherId); + NetworkFunctionDefinitionGroupResource nfdg = await CreateNFDGResource(publisher, nfdgName, DefaultResourceLocation); + NFDGId = nfdg.Id; + + // Get NFDG + Response getNfdgResponse = await nfdg.GetAsync(); + NetworkFunctionDefinitionGroupResource nfdgResourceRetrieved = getNfdgResponse.Value; + NetworkFunctionDefinitionGroupData retrievedData = nfdgResourceRetrieved.Data; + Assert.IsNotNull(nfdgResourceRetrieved); + Assert.AreEqual(nfdg.Data.Location, retrievedData.Location); + Assert.AreEqual("NFD for .NET SDK UTs.", retrievedData.Properties.Description); + } + + [TestCase] + [Order(1)] + [RecordedTest] + public async Task CanCreateGetNSDG() + { + var nsdgName = Recording.GenerateAssetName("nsdg"); + + // Create NSDG + PublisherResource publisher = Client.GetPublisherResource(PublisherId); + NetworkServiceDesignGroupResource nsdg = await CreateNSDGResource(publisher, nsdgName, DefaultResourceLocation); + NSDGId = nsdg.Id; + + // Get NSDG + Response getNsdgResponse = await nsdg.GetAsync(); + NetworkServiceDesignGroupResource nsdgResourceRetrieved = getNsdgResponse.Value; + NetworkServiceDesignGroupData retrievedData = nsdgResourceRetrieved.Data; + Assert.IsNotNull(nsdgResourceRetrieved); + Assert.AreEqual(nsdg.Data.Location, retrievedData.Location); + Assert.AreEqual("NSD for .NET SDK UTs.", retrievedData.Properties.Description); + } + + [TestCase] + [Order(2)] + [RecordedTest] + public async Task CanCreateGetArtifactManifest() + { + string artifactManifestName = Recording.GenerateAssetName("artifactManifest"); + + // Create Artifact Manifest + ArtifactStoreResource artifactStore = Client.GetArtifactStoreResource(ArtifactStoreId); + ArtifactManifestResource artifactManifest = await CreateArtifactManifestResource(artifactStore, artifactManifestName, DefaultResourceLocation); + + // Get credential and upload artifact if we are recording. + if (Mode == RecordedTestMode.Record) + { + AzureContainerRegistryScopedTokenCredential creds = (AzureContainerRegistryScopedTokenCredential)await artifactManifest.GetCredentialAsync(); + UploadArmTemplate(VnetArmTemplateFileName, VnetArmTemplateArtifactName, "1.0.0", creds); + UploadArmTemplate(NfArmTemplateFileName, NfArmTemplateArtifactName, "1.0.0", creds); + } + + // Get Artifact Manifest + Response getArtifactManifestResponse = await artifactManifest.GetAsync(); + ArtifactManifestResource artifactManifestResourceRetrieved = getArtifactManifestResponse.Value; + ArtifactManifestData retrievedData = artifactManifestResourceRetrieved.Data; + Assert.IsNotNull(artifactManifestResourceRetrieved); + Assert.AreEqual(artifactManifest.Data.Location, retrievedData.Location); + Assert.AreEqual(VnetArmTemplateArtifactName, retrievedData.Properties.Artifacts[0].ArtifactName); + Assert.AreEqual(ArtifactType.OCIArtifact, retrievedData.Properties.Artifacts[0].ArtifactType); + Assert.AreEqual("1.0.0", retrievedData.Properties.Artifacts[0].ArtifactVersion); + Assert.AreEqual(NfArmTemplateArtifactName, retrievedData.Properties.Artifacts[1].ArtifactName); + Assert.AreEqual(ArtifactType.OCIArtifact, retrievedData.Properties.Artifacts[1].ArtifactType); + Assert.AreEqual("1.0.0", retrievedData.Properties.Artifacts[1].ArtifactVersion); + } + + [TestCase] + [Order(3)] + [RecordedTest] + public async Task CanCreateGetNFDV() + { + string nfdvName = "1.0.0"; + + // Create NFDV + NetworkFunctionDefinitionGroupResource nfdg = Client.GetNetworkFunctionDefinitionGroupResource(NFDGId); + ArtifactStoreResource artifactStore = Client.GetArtifactStoreResource(ArtifactStoreId); + NetworkFunctionDefinitionVersionResource nfdv = await CreateNFDVResource(nfdg, artifactStore, nfdvName, DefaultResourceLocation); + NFDVId = nfdv.Id; + + // Get NFDV + Response getNfdvResponse = await nfdv.GetAsync(); + NetworkFunctionDefinitionVersionResource nfdvResourceRetrieved = getNfdvResponse.Value; + NetworkFunctionDefinitionVersionData retrievedData = nfdvResourceRetrieved.Data; + VirtualNetworkFunctionDefinitionVersion properties = (VirtualNetworkFunctionDefinitionVersion)retrievedData.Properties; + Assert.IsNotNull(nfdvResourceRetrieved); + Assert.AreEqual(nfdv.Data.Location, retrievedData.Location); + var deployParams = ReadJsonFile(DeployParametersFileName).ToString(Newtonsoft.Json.Formatting.None); + Assert.AreEqual(deployParams, properties.DeployParameters); + var nfTemplate = (AzureCoreNetworkFunctionTemplate)properties.NetworkFunctionTemplate; + var armAplication = (AzureCoreNetworkFunctionArmTemplateApplication)nfTemplate.NetworkFunctionApplications[0]; + Assert.AreEqual(ArtifactStoreId, armAplication.ArtifactProfile.ArtifactStoreId); + } + + [TestCase] + [Order(3)] + [RecordedTest] + public async Task CanCreateGetNSDV() + { + string nsdvName = "1.0.0"; + + // Create NSDV + var nsdg = Client.GetNetworkServiceDesignGroupResource(NSDGId); + var cgSchema = Client.GetConfigurationGroupSchemaResource(CGSchemaId); + var artifactStore = Client.GetArtifactStoreResource(ArtifactStoreId); + NetworkServiceDesignVersionResource nsdv = await CreateNSDVResource(nsdg, cgSchema, artifactStore, nsdvName, DefaultResourceLocation); + NSDVId = nsdv.Id; + + // Get NSDV + Response getNsdvResponse = await nsdv.GetAsync(); + NetworkServiceDesignVersionResource nsdvResourceRetrieved = getNsdvResponse.Value; + NetworkServiceDesignVersionData retrievedData = nsdvResourceRetrieved.Data; + Assert.IsNotNull(nsdvResourceRetrieved); + Assert.AreEqual(nsdv.Data.Location, retrievedData.Location); + Assert.AreEqual(CGSchemaId, retrievedData.Properties.ConfigurationGroupSchemaReferences["vnet_ConfigGroupSchema"].Id); + var ret = (NetworkFunctionDefinitionResourceElementTemplateDetails)retrievedData.Properties.ResourceElementTemplates[0]; + Assert.AreEqual(ArtifactStoreId, ret.Configuration.ArtifactProfile.ArtifactStoreReferenceId); + } + + [TestCase] + [Order(4)] + [RecordedTest] + public async Task CanCreateGetConfigGroupValues() + { + var cgvName = Recording.GenerateAssetName("cgValues"); + + // Create Artifact Manifest + var cgSchema = Client.GetConfigurationGroupSchemaResource(CGSchemaId); + ConfigurationGroupValueResource cgValues = await CreateCGVResource(ResourceGroup, cgSchema, cgvName, NFDVId, DefaultResourceLocation); + CGValueId = cgValues.Id; + + // Get Artifact Manifest + Response getCgvResponse = await cgValues.GetAsync(); + ConfigurationGroupValueResource cgvResourceRetrieved = getCgvResponse.Value; + ConfigurationGroupValueData retrievedData = cgvResourceRetrieved.Data; + ConfigurationValueWithoutSecrets properties = (ConfigurationValueWithoutSecrets)retrievedData.Properties; + Assert.IsNotNull(cgvResourceRetrieved); + Assert.AreEqual(cgValues.Data.Location, retrievedData.Location); + Assert.AreEqual(ConfigurationGroupValueConfigurationType.Open, properties.ConfigurationType); + var cgSchemaRef = (OpenDeploymentResourceReference)properties.ConfigurationGroupSchemaResourceReference; + Assert.AreEqual(CGSchemaId, cgSchemaRef.Id); + var values = ReadJsonFile(DeployValuesFileName); + values["nfdvId"] = NFDVId.ToString(); + Assert.AreEqual(properties.ConfigurationValue, values.ToString(Newtonsoft.Json.Formatting.None)); + } + + [TestCase] + [Order(5)] + [RecordedTest] + public async Task CanCreateGetSNS() + { + string snsName = Recording.GenerateAssetName("sns"); + + // Create Site Network Service. + var site = Client.GetSiteResource(SiteId); + var nsdv = Client.GetNetworkServiceDesignVersionResource(NSDVId); + var cgValue = Client.GetConfigurationGroupValueResource(CGValueId); + SiteNetworkServiceResource sns = await CreateSNSResource(ResourceGroup, site, nsdv, cgValue, snsName, DefaultResourceLocation); + + // Get Network Function + Response getSnsResponse = await sns.GetAsync(); + SiteNetworkServiceResource snsResourceRetrieved = getSnsResponse.Value; + SiteNetworkServiceData retrievedData = snsResourceRetrieved.Data; + Assert.IsNotNull(snsResourceRetrieved); + Assert.AreEqual(sns.Data.Location, retrievedData.Location); + Assert.AreEqual(SiteId, retrievedData.Properties.SiteReferenceId); + Assert.AreEqual(CGValueId, retrievedData.Properties.DesiredStateConfigurationGroupValueReferences["vnet_ConfigGroupSchema"].Id); + var nsdvRef = (OpenDeploymentResourceReference)retrievedData.Properties.NetworkServiceDesignVersionResourceReference; + Assert.AreEqual(NSDVId, nsdvRef.Id); + } + + private string DefaultResourceGroupName; + private ResourceIdentifier PublisherId; + private ResourceIdentifier SiteId; + private ResourceIdentifier ArtifactStoreId; + private ResourceIdentifier CGSchemaId; + private ResourceIdentifier CGValueId; + private ResourceIdentifier NFDGId; + private ResourceIdentifier NFDVId; + private ResourceIdentifier NSDGId; + private ResourceIdentifier NSDVId; + private ResourceIdentifier ResourceGroupId; + private AzureLocation DefaultResourceLocation; + private ResourceGroupResource ResourceGroup; + } +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/CGSchema.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/CGSchema.json new file mode 100644 index 0000000000000..c7fb53911a25c --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/CGSchema.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "vnet_ConfigGroupSchema", + "type": "object", + "properties": { + "nfdvId": { + "description": "The ID of the VNET NFDV resource.", + "type": "string" + }, + "vnetName": { + "description": "The name of the VNET you want to deploy", + "type": "string" + }, + "vnetAddressPrefixes": { + "description": "An array of VNET address prefixes, e.g. [\"10.0.0.0/16\",\"11.0.0.0/16\"]", + "type": "array" + }, + "subnets": { + "description": "Array of subnet objects to create under the vnet", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "Name for the subnet", + "type": "string" + }, + "addressPrefix": { + "description": "addressPrefix for the subnet, must exist within one of the VNET address prefixes.", + "type": "string" + } + }, + "required": [ "name", "addressPrefix" ] + } + } + }, + "required": [ "nfdvId", "vnetName", "vnetAddressPrefixes", "subnets" ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeployParameters.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeployParameters.json new file mode 100644 index 0000000000000..7b369acffa1c6 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeployParameters.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "vnet_deployParams", + "type": "object", + "properties": { + "vnetName": { + "description": "The name of the VNET you want to deploy", + "type": "string" + }, + "vnetAddressPrefixes": { + "description": "An array of VNET address prefixes, e.g. [\"10.0.0.0/16\",\"11.0.0.0/16\"]", + "type": "array" + }, + "subnets": { + "description": "Array of subnet objects to create under the vnet", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "Name for the subnet", + "type": "string" + }, + "addressPrefix": { + "description": "addressPrefix for the subnet, must exist within one of the VNET address prefixes.", + "type": "string" + } + }, + "required": [ "name", "addressPrefix" ] + } + } + }, + "required": [ "vnetName", "vnetAddressPrefixes", "subnets" ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeploymentValues.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeploymentValues.json new file mode 100644 index 0000000000000..2b6fab078be72 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/DeploymentValues.json @@ -0,0 +1,16 @@ +{ + "vnetName": "DotnetSDKUTVnet", + "vnetAddressPrefixes": [ + "10.0.0.0/16" + ], + "subnets": [ + { + "name": "subnet1", + "addressPrefix": "10.0.1.0/24" + }, + { + "name": "subnet2", + "addressPrefix": "10.0.2.0/24" + } + ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplate.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplate.json new file mode 100644 index 0000000000000..c33359f0bec37 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplate.json @@ -0,0 +1,59 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.22.6.54827", + "templateHash": "4204644297979192959" + } + }, + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]" + }, + "nfdvId": { + "type": "string" + }, + "vnetName": { + "type": "string" + }, + "vnetAddressPrefixes": { + "type": "array" + }, + "subnets": { + "type": "array" + } + }, + "variables": { + "nfName": "[format('nf-{0}', uniqueString(resourceGroup().id))]", + "values": { + "vnetName": "[parameters('vnetName')]", + "vnetAddressPrefixes": "[parameters('vnetAddressPrefixes')]", + "subnets": "[parameters('subnets')]" + } + }, + "resources": [ + { + "type": "Microsoft.HybridNetwork/networkFunctions", + "apiVersion": "2023-09-01", + "name": "[variables('nfName')]", + "location": "[parameters('location')]", + "identity": { + "type": "SystemAssigned" + }, + "properties": { + "networkFunctionDefinitionVersionResourceReference": { + "id": "[parameters('nfdvId')]", + "idType": "Open" + }, + "nfviType": "AzureCore", + "nfviId": "[resourceGroup().id]", + "allowSoftwareUpdate": true, + "configurationType": "Open", + "deploymentValues": "[string(variables('values'))]" + } + } + ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplateMappings.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplateMappings.json new file mode 100644 index 0000000000000..23b2124b67172 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/NfArmTemplateMappings.json @@ -0,0 +1,6 @@ +{ + "nfdvId": "{configurationparameters('vnet_ConfigGroupSchema').nfdvId}", + "vnetName": "{configurationparameters('vnet_ConfigGroupSchema').vnetName}", + "vnetAddressPrefixes": "{configurationparameters('vnet_ConfigGroupSchema').vnetAddressPrefixes}", + "subnets": "{configurationparameters('vnet_ConfigGroupSchema').subnets}" +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplate.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplate.json new file mode 100644 index 0000000000000..75c5c8b31b960 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplate.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.19.5.34762", + "templateHash": "9984318979316552194" + } + }, + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]" + }, + "vnetName": { + "type": "string" + }, + "vnetAddressPrefixes": { + "type": "array" + }, + "subnets": { + "type": "array" + } + }, + "variables": { + "copy": [ + { + "name": "formattedSubnets", + "count": "[length(parameters('subnets'))]", + "input": { + "name": "[parameters('subnets')[copyIndex('formattedSubnets')].name]", + "properties": { + "addressPrefix": "[parameters('subnets')[copyIndex('formattedSubnets')].addressPrefix]" + } + } + } + ] + }, + "resources": [ + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2019-11-01", + "name": "[parameters('vnetName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": "[parameters('vnetAddressPrefixes')]" + }, + "subnets": "[variables('formattedSubnets')]" + } + } + ] +} diff --git a/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplateMappings.json b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplateMappings.json new file mode 100644 index 0000000000000..aa60a26c649c7 --- /dev/null +++ b/sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/tests/Scenario/TestAssets/VnetArmTemplateMappings.json @@ -0,0 +1,5 @@ +{ + "vnetName": "{deployParameters.vnetName}", + "vnetAddressPrefixes": "{deployParameters.vnetAddressPrefixes}", + "subnets": "{deployParameters.subnets}" +} diff --git a/sdk/hybridnetwork/ci.mgmt.yml b/sdk/hybridnetwork/ci.mgmt.yml new file mode 100644 index 0000000000000..35f71f8ae8705 --- /dev/null +++ b/sdk/hybridnetwork/ci.mgmt.yml @@ -0,0 +1,23 @@ +# 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/hybridnetwork/ci.mgmt.yml + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: hybridnetwork + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.HybridNetwork + safeName: AzureResourceManagerHybridNetwork diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/Azure.ResourceManager.IntegrationSpaces.sln b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/Azure.ResourceManager.IntegrationSpaces.sln new file mode 100644 index 0000000000000..3b46302159fe9 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/Azure.ResourceManager.IntegrationSpaces.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("{40669917-019E-4A0C-8904-0B1551C3901B}") = "Azure.ResourceManager.IntegrationSpaces", "src\Azure.ResourceManager.IntegrationSpaces.csproj", "{18CB8BB4-DD88-44E3-9D01-D64D46B767A1}" +EndProject +Project("{40669917-019E-4A0C-8904-0B1551C3901B}") = "Azure.ResourceManager.IntegrationSpaces.Tests", "tests\Azure.ResourceManager.IntegrationSpaces.Tests.csproj", "{4F3796C6-A676-4F50-B7A3-CBD424A0B25F}" +EndProject +Project("{40669917-019E-4A0C-8904-0B1551C3901B}") = "Azure.ResourceManager.IntegrationSpaces.Samples", "samples\Azure.ResourceManager.IntegrationSpaces.Samples.csproj", "{B2AFD004-6529-41EB-A510-07FBE21EE84F}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {04E46D24-C42A-4217-85D1-DA64F019501B} + 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 + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Debug|x64.ActiveCfg = Debug|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Debug|x64.Build.0 = Debug|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Debug|x86.ActiveCfg = Debug|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Debug|x86.Build.0 = Debug|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Release|Any CPU.Build.0 = Release|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Release|x64.ActiveCfg = Release|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Release|x64.Build.0 = Release|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Release|x86.ActiveCfg = Release|Any CPU + {18CB8BB4-DD88-44E3-9D01-D64D46B767A1}.Release|x86.Build.0 = Release|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Debug|x64.ActiveCfg = Debug|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Debug|x64.Build.0 = Debug|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Debug|x86.ActiveCfg = Debug|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Debug|x86.Build.0 = Debug|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Release|Any CPU.Build.0 = Release|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Release|x64.ActiveCfg = Release|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Release|x64.Build.0 = Release|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Release|x86.ActiveCfg = Release|Any CPU + {4F3796C6-A676-4F50-B7A3-CBD424A0B25F}.Release|x86.Build.0 = Release|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Debug|x64.ActiveCfg = Debug|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Debug|x64.Build.0 = Debug|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Debug|x86.ActiveCfg = Debug|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Debug|x86.Build.0 = Debug|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Release|Any CPU.Build.0 = Release|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Release|x64.ActiveCfg = Release|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Release|x64.Build.0 = Release|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Release|x86.ActiveCfg = Release|Any CPU + {B2AFD004-6529-41EB-A510-07FBE21EE84F}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/CHANGELOG.md b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/CHANGELOG.md new file mode 100644 index 0000000000000..23f86d1e896ee --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/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/integrationspaces/Azure.ResourceManager.IntegrationSpaces/Directory.Build.props b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/Directory.Build.props new file mode 100644 index 0000000000000..1a9611bd49242 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/README.md b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/README.md new file mode 100644 index 0000000000000..2a748aed0f879 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure IntegrationSpaces 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 IntegrationSpaces management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.IntegrationSpaces --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/integrationspaces/Azure.ResourceManager.IntegrationSpaces/assets.json b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/assets.json new file mode 100644 index 0000000000000..13ddb1be27971 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net//Azure.ResourceManager.IntegrationSpaces", + "Tag": "" +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Azure.ResourceManager.IntegrationSpaces.Samples.csproj b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Azure.ResourceManager.IntegrationSpaces.Samples.csproj new file mode 100644 index 0000000000000..1d46b3e5ad5c3 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Azure.ResourceManager.IntegrationSpaces.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessCollection.cs new file mode 100644 index 0000000000000..9d09435d1fed3 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessCollection.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_BusinessProcessCollection + { + // ListBusinessProcessesByApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListBusinessProcessesByApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcesses_ListByApplication.json + // this example is just showing the usage of "BusinessProcesses_ListByApplication" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this BusinessProcessResource + BusinessProcessCollection collection = integrationSpaceApplication.GetBusinessProcesses(); + + // invoke the operation and iterate over the result + BusinessProcessCollectionGetAllOptions options = new BusinessProcessCollectionGetAllOptions() { }; + await foreach (BusinessProcessResource item in collection.GetAllAsync(options)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetBusinessProcess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetBusinessProcess() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcesses_Get.json + // this example is just showing the usage of "BusinessProcesses_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this BusinessProcessResource + BusinessProcessCollection collection = integrationSpaceApplication.GetBusinessProcesses(); + + // invoke the operation + string businessProcessName = "BusinessProcess1"; + BusinessProcessResource result = await collection.GetAsync(businessProcessName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetBusinessProcess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetBusinessProcess() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcesses_Get.json + // this example is just showing the usage of "BusinessProcesses_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this BusinessProcessResource + BusinessProcessCollection collection = integrationSpaceApplication.GetBusinessProcesses(); + + // invoke the operation + string businessProcessName = "BusinessProcess1"; + bool result = await collection.ExistsAsync(businessProcessName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetBusinessProcess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBusinessProcess() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcesses_Get.json + // this example is just showing the usage of "BusinessProcesses_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this BusinessProcessResource + BusinessProcessCollection collection = integrationSpaceApplication.GetBusinessProcesses(); + + // invoke the operation + string businessProcessName = "BusinessProcess1"; + NullableResponse response = await collection.GetIfExistsAsync(businessProcessName); + BusinessProcessResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CreateOrUpdateBusinessProcess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateBusinessProcess() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcesses_CreateOrUpdate.json + // this example is just showing the usage of "BusinessProcesses_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this BusinessProcessResource + BusinessProcessCollection collection = integrationSpaceApplication.GetBusinessProcesses(); + + // invoke the operation + string businessProcessName = "BusinessProcess1"; + BusinessProcessData data = new BusinessProcessData() + { + Description = "First Business Process", + TableName = "table1", + TrackingDataStoreReferenceName = "trackingDataStoreReferenceName1", + Identifier = new BusinessProcessIdentifier() + { + PropertyName = "businessIdentifier-1", + PropertyType = "String", + }, + BusinessProcessStages = +{ +["Completed"] = new BusinessProcessStage() +{ +Description = "Completed", +StagesBefore = +{ +"Shipped" +}, +}, +["Denied"] = new BusinessProcessStage() +{ +Description = "Denied", +StagesBefore = +{ +"Processing" +}, +}, +["Processing"] = new BusinessProcessStage() +{ +Description = "Processing", +Properties = +{ +["ApprovalState"] = "String", +["ApproverName"] = "String", +["POAmount"] = "Integer", +}, +StagesBefore = +{ +"Received" +}, +}, +["Received"] = new BusinessProcessStage() +{ +Description = "received", +Properties = +{ +["City"] = "String", +["Product"] = "String", +["Quantity"] = "Integer", +["State"] = "String", +}, +}, +["Shipped"] = new BusinessProcessStage() +{ +Description = "Shipped", +Properties = +{ +["ShipPriority"] = "Integer", +["TrackingID"] = "Integer", +}, +StagesBefore = +{ +"Denied" +}, +}, +}, + BusinessProcessMapping = +{ +["Completed"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "CompletedPO", +OperationType = "Action", +}, +["Denied"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "DeniedPO", +OperationType = "Action", +}, +["Processing"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "PurchaseOrder", +OperationName = "ApprovedPO", +OperationType = "Action", +}, +["Received"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "PurchaseOrder", +OperationName = "manual", +OperationType = "Trigger", +}, +["Shipped"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "ShippedPO", +OperationType = "Action", +}, +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, businessProcessName, data); + BusinessProcessResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessResource.cs new file mode 100644 index 0000000000000..34c26bb3a2fed --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_BusinessProcessResource + { + // GetBusinessProcess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetBusinessProcess() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcesses_Get.json + // this example is just showing the usage of "BusinessProcesses_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BusinessProcessResource created on azure + // for more information of creating BusinessProcessResource, please refer to the document of BusinessProcessResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string businessProcessName = "BusinessProcess1"; + ResourceIdentifier businessProcessResourceId = BusinessProcessResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + BusinessProcessResource businessProcess = client.GetBusinessProcessResource(businessProcessResourceId); + + // invoke the operation + BusinessProcessResource result = await businessProcess.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PatchBusinessProcess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchBusinessProcess() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcesses_Patch.json + // this example is just showing the usage of "BusinessProcesses_Patch" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BusinessProcessResource created on azure + // for more information of creating BusinessProcessResource, please refer to the document of BusinessProcessResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string businessProcessName = "BusinessProcess1"; + ResourceIdentifier businessProcessResourceId = BusinessProcessResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + BusinessProcessResource businessProcess = client.GetBusinessProcessResource(businessProcessResourceId); + + // invoke the operation + BusinessProcessPatch patch = new BusinessProcessPatch() + { + Description = "First updated business process.", + }; + BusinessProcessResource result = await businessProcess.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteBusinessProcess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteBusinessProcess() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcesses_Delete.json + // this example is just showing the usage of "BusinessProcesses_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BusinessProcessResource created on azure + // for more information of creating BusinessProcessResource, please refer to the document of BusinessProcessResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string businessProcessName = "BusinessProcess1"; + ResourceIdentifier businessProcessResourceId = BusinessProcessResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + BusinessProcessResource businessProcess = client.GetBusinessProcessResource(businessProcessResourceId); + + // invoke the operation + await businessProcess.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessVersionCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessVersionCollection.cs new file mode 100644 index 0000000000000..afe51d903a0b8 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessVersionCollection.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_BusinessProcessVersionCollection + { + // ListBusinessProcessVersionsByBusinessProcess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListBusinessProcessVersionsByBusinessProcess() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcessVersions_ListByBusinessProcess.json + // this example is just showing the usage of "BusinessProcessVersions_ListByBusinessProcess" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BusinessProcessResource created on azure + // for more information of creating BusinessProcessResource, please refer to the document of BusinessProcessResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string businessProcessName = "BusinessProcess1"; + ResourceIdentifier businessProcessResourceId = BusinessProcessResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + BusinessProcessResource businessProcess = client.GetBusinessProcessResource(businessProcessResourceId); + + // get the collection of this BusinessProcessVersionResource + BusinessProcessVersionCollection collection = businessProcess.GetBusinessProcessVersions(); + + // invoke the operation and iterate over the result + BusinessProcessVersionCollectionGetAllOptions options = new BusinessProcessVersionCollectionGetAllOptions() { }; + await foreach (BusinessProcessVersionResource item in collection.GetAllAsync(options)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetBusinessProcessVersion + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetBusinessProcessVersion() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcessVersions_Get.json + // this example is just showing the usage of "BusinessProcessVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BusinessProcessResource created on azure + // for more information of creating BusinessProcessResource, please refer to the document of BusinessProcessResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string businessProcessName = "BusinessProcess1"; + ResourceIdentifier businessProcessResourceId = BusinessProcessResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + BusinessProcessResource businessProcess = client.GetBusinessProcessResource(businessProcessResourceId); + + // get the collection of this BusinessProcessVersionResource + BusinessProcessVersionCollection collection = businessProcess.GetBusinessProcessVersions(); + + // invoke the operation + string businessProcessVersion = "08585074782265427079"; + BusinessProcessVersionResource result = await collection.GetAsync(businessProcessVersion); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetBusinessProcessVersion + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetBusinessProcessVersion() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcessVersions_Get.json + // this example is just showing the usage of "BusinessProcessVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BusinessProcessResource created on azure + // for more information of creating BusinessProcessResource, please refer to the document of BusinessProcessResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string businessProcessName = "BusinessProcess1"; + ResourceIdentifier businessProcessResourceId = BusinessProcessResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + BusinessProcessResource businessProcess = client.GetBusinessProcessResource(businessProcessResourceId); + + // get the collection of this BusinessProcessVersionResource + BusinessProcessVersionCollection collection = businessProcess.GetBusinessProcessVersions(); + + // invoke the operation + string businessProcessVersion = "08585074782265427079"; + bool result = await collection.ExistsAsync(businessProcessVersion); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetBusinessProcessVersion + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetBusinessProcessVersion() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcessVersions_Get.json + // this example is just showing the usage of "BusinessProcessVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BusinessProcessResource created on azure + // for more information of creating BusinessProcessResource, please refer to the document of BusinessProcessResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string businessProcessName = "BusinessProcess1"; + ResourceIdentifier businessProcessResourceId = BusinessProcessResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + BusinessProcessResource businessProcess = client.GetBusinessProcessResource(businessProcessResourceId); + + // get the collection of this BusinessProcessVersionResource + BusinessProcessVersionCollection collection = businessProcess.GetBusinessProcessVersions(); + + // invoke the operation + string businessProcessVersion = "08585074782265427079"; + NullableResponse response = await collection.GetIfExistsAsync(businessProcessVersion); + BusinessProcessVersionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessVersionResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessVersionResource.cs new file mode 100644 index 0000000000000..def7a72c39a2c --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_BusinessProcessVersionResource.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_BusinessProcessVersionResource + { + // GetBusinessProcessVersion + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetBusinessProcessVersion() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/BusinessProcessVersions_Get.json + // this example is just showing the usage of "BusinessProcessVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BusinessProcessVersionResource created on azure + // for more information of creating BusinessProcessVersionResource, please refer to the document of BusinessProcessVersionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string businessProcessName = "BusinessProcess1"; + string businessProcessVersion = "08585074782265427079"; + ResourceIdentifier businessProcessVersionResourceId = BusinessProcessVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, businessProcessVersion); + BusinessProcessVersionResource businessProcessVersion0 = client.GetBusinessProcessVersionResource(businessProcessVersionResourceId); + + // invoke the operation + BusinessProcessVersionResource result = await businessProcessVersion0.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BusinessProcessVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_InfrastructureResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_InfrastructureResource.cs new file mode 100644 index 0000000000000..a615f9af88be8 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_InfrastructureResource.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_InfrastructureResource + { + // GetInfrastructureResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetInfrastructureResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/InfrastructureResources_Get.json + // this example is just showing the usage of "InfrastructureResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this InfrastructureResource created on azure + // for more information of creating InfrastructureResource, please refer to the document of InfrastructureResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string infrastructureResourceName = "InfrastructureResource1"; + ResourceIdentifier infrastructureResourceId = InfrastructureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName); + InfrastructureResource infrastructureResource = client.GetInfrastructureResource(infrastructureResourceId); + + // invoke the operation + InfrastructureResource result = await infrastructureResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InfrastructureResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PatchInfrastructureResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchInfrastructureResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/InfrastructureResources_Patch.json + // this example is just showing the usage of "InfrastructureResources_Patch" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this InfrastructureResource created on azure + // for more information of creating InfrastructureResource, please refer to the document of InfrastructureResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string infrastructureResourceName = "InfrastructureResource1"; + ResourceIdentifier infrastructureResourceId = InfrastructureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName); + InfrastructureResource infrastructureResource = client.GetInfrastructureResource(infrastructureResourceId); + + // invoke the operation + InfrastructureResourcePatch patch = new InfrastructureResourcePatch() + { + ResourceType = "Microsoft.ApiManagement/service", + ResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.ApiManagement/service/APIM1", + }; + InfrastructureResource result = await infrastructureResource.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InfrastructureResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteInfrastructureResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteInfrastructureResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/InfrastructureResources_Delete.json + // this example is just showing the usage of "InfrastructureResources_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this InfrastructureResource created on azure + // for more information of creating InfrastructureResource, please refer to the document of InfrastructureResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string infrastructureResourceName = "InfrastructureResource1"; + ResourceIdentifier infrastructureResourceId = InfrastructureResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName); + InfrastructureResource infrastructureResource = client.GetInfrastructureResource(infrastructureResourceId); + + // invoke the operation + await infrastructureResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_InfrastructureResourceCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_InfrastructureResourceCollection.cs new file mode 100644 index 0000000000000..e79e1d6dc686f --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_InfrastructureResourceCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_InfrastructureResourceCollection + { + // ListInfrastructureResourcesBySpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListInfrastructureResourcesBySpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/InfrastructureResources_ListBySpace.json + // this example is just showing the usage of "InfrastructureResources_ListBySpace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this InfrastructureResource + InfrastructureResourceCollection collection = space.GetInfrastructureResources(); + + // invoke the operation and iterate over the result + InfrastructureResourceCollectionGetAllOptions options = new InfrastructureResourceCollectionGetAllOptions() { }; + await foreach (InfrastructureResource item in collection.GetAllAsync(options)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InfrastructureResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetInfrastructureResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetInfrastructureResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/InfrastructureResources_Get.json + // this example is just showing the usage of "InfrastructureResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this InfrastructureResource + InfrastructureResourceCollection collection = space.GetInfrastructureResources(); + + // invoke the operation + string infrastructureResourceName = "InfrastructureResource1"; + InfrastructureResource result = await collection.GetAsync(infrastructureResourceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InfrastructureResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetInfrastructureResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetInfrastructureResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/InfrastructureResources_Get.json + // this example is just showing the usage of "InfrastructureResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this InfrastructureResource + InfrastructureResourceCollection collection = space.GetInfrastructureResources(); + + // invoke the operation + string infrastructureResourceName = "InfrastructureResource1"; + bool result = await collection.ExistsAsync(infrastructureResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetInfrastructureResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetInfrastructureResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/InfrastructureResources_Get.json + // this example is just showing the usage of "InfrastructureResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this InfrastructureResource + InfrastructureResourceCollection collection = space.GetInfrastructureResources(); + + // invoke the operation + string infrastructureResourceName = "InfrastructureResource1"; + NullableResponse response = await collection.GetIfExistsAsync(infrastructureResourceName); + InfrastructureResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InfrastructureResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CreateOrUpdateInfrastructureResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateInfrastructureResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/InfrastructureResources_CreateOrUpdate.json + // this example is just showing the usage of "InfrastructureResources_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this InfrastructureResource + InfrastructureResourceCollection collection = space.GetInfrastructureResources(); + + // invoke the operation + string infrastructureResourceName = "InfrastructureResource1"; + InfrastructureResourceData data = new InfrastructureResourceData() + { + ResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.ApiManagement/service/APIM1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, infrastructureResourceName, data); + InfrastructureResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InfrastructureResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceApplicationCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceApplicationCollection.cs new file mode 100644 index 0000000000000..b83e884b20e6b --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceApplicationCollection.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_IntegrationSpaceApplicationCollection + { + // ListApplicationsBySpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListApplicationsBySpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_ListBySpace.json + // this example is just showing the usage of "Applications_ListBySpace" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this IntegrationSpaceApplicationResource + IntegrationSpaceApplicationCollection collection = space.GetIntegrationSpaceApplications(); + + // invoke the operation and iterate over the result + IntegrationSpaceApplicationCollectionGetAllOptions options = new IntegrationSpaceApplicationCollectionGetAllOptions() { }; + await foreach (IntegrationSpaceApplicationResource item in collection.GetAllAsync(options)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceApplicationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_Get.json + // this example is just showing the usage of "Applications_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this IntegrationSpaceApplicationResource + IntegrationSpaceApplicationCollection collection = space.GetIntegrationSpaceApplications(); + + // invoke the operation + string applicationName = "Application1"; + IntegrationSpaceApplicationResource result = await collection.GetAsync(applicationName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_Get.json + // this example is just showing the usage of "Applications_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this IntegrationSpaceApplicationResource + IntegrationSpaceApplicationCollection collection = space.GetIntegrationSpaceApplications(); + + // invoke the operation + string applicationName = "Application1"; + bool result = await collection.ExistsAsync(applicationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_Get.json + // this example is just showing the usage of "Applications_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this IntegrationSpaceApplicationResource + IntegrationSpaceApplicationCollection collection = space.GetIntegrationSpaceApplications(); + + // invoke the operation + string applicationName = "Application1"; + NullableResponse response = await collection.GetIfExistsAsync(applicationName); + IntegrationSpaceApplicationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CreateOrUpdateApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_CreateOrUpdate.json + // this example is just showing the usage of "Applications_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // get the collection of this IntegrationSpaceApplicationResource + IntegrationSpaceApplicationCollection collection = space.GetIntegrationSpaceApplications(); + + // invoke the operation + string applicationName = "Application1"; + IntegrationSpaceApplicationData data = new IntegrationSpaceApplicationData(new AzureLocation("CentralUS")) + { + Description = "This is the user provided description of the application.", + TrackingDataStores = +{ +["dataStoreName1"] = new TrackingDataStore("testDatabase1","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Kusto/Clusters/cluster1",new Uri("https://someClusterName.someRegionName.kusto.windows.net"),new Uri("https://ingest-someClusterName.someRegionName.kusto.windows.net")), +["dataStoreName2"] = new TrackingDataStore("testDatabase1","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Kusto/Clusters/cluster1",new Uri("https://someClusterName.someRegionName.kusto.windows.net"),new Uri("https://ingest-someClusterName.someRegionName.kusto.windows.net")), +}, + Tags = +{ +["key1"] = "Value1", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, applicationName, data); + IntegrationSpaceApplicationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceApplicationResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceApplicationResource.cs new file mode 100644 index 0000000000000..47f3d6a479aec --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceApplicationResource.cs @@ -0,0 +1,660 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_IntegrationSpaceApplicationResource + { + // GetApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_Get.json + // this example is just showing the usage of "Applications_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // invoke the operation + IntegrationSpaceApplicationResource result = await integrationSpaceApplication.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PatchApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_Patch.json + // this example is just showing the usage of "Applications_Patch" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // invoke the operation + IntegrationSpaceApplicationPatch patch = new IntegrationSpaceApplicationPatch() + { + Tags = +{ +["key1"] = "Value1", +}, + Description = "This is the user provided PATCHED description of the application.", + }; + IntegrationSpaceApplicationResource result = await integrationSpaceApplication.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceApplicationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_Delete.json + // this example is just showing the usage of "Applications_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // invoke the operation + await integrationSpaceApplication.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // DeleteBusinessProcessDevelopmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeleteBusinessProcessDevelopmentArtifact_DeleteBusinessProcessDevelopmentArtifact() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_DeleteBusinessProcessDevelopmentArtifact.json + // this example is just showing the usage of "Applications_DeleteBusinessProcessDevelopmentArtifact" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // invoke the operation + GetOrDeleteBusinessProcessDevelopmentArtifactRequest body = new GetOrDeleteBusinessProcessDevelopmentArtifactRequest("BusinessProcess1"); + await integrationSpaceApplication.DeleteBusinessProcessDevelopmentArtifactAsync(body); + + Console.WriteLine($"Succeeded"); + } + + // GetBusinessProcessDevelopmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBusinessProcessDevelopmentArtifact_GetBusinessProcessDevelopmentArtifact() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_GetBusinessProcessDevelopmentArtifact.json + // this example is just showing the usage of "Applications_GetBusinessProcessDevelopmentArtifact" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // invoke the operation + GetOrDeleteBusinessProcessDevelopmentArtifactRequest body = new GetOrDeleteBusinessProcessDevelopmentArtifactRequest("BusinessProcess1"); + BusinessProcessDevelopmentArtifactResult result = await integrationSpaceApplication.GetBusinessProcessDevelopmentArtifactAsync(body); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ListBusinessProcessDevelopmentArtifacts + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBusinessProcessDevelopmentArtifacts_ListBusinessProcessDevelopmentArtifacts() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_ListBusinessProcessDevelopmentArtifacts.json + // this example is just showing the usage of "Applications_ListBusinessProcessDevelopmentArtifacts" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // invoke the operation and iterate over the result + await foreach (BusinessProcessDevelopmentArtifactResult item in integrationSpaceApplication.GetBusinessProcessDevelopmentArtifactsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // SaveBusinessProcessDevelopmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task SaveBusinessProcessDevelopmentArtifact_SaveBusinessProcessDevelopmentArtifact() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_SaveBusinessProcessDevelopmentArtifact.json + // this example is just showing the usage of "Applications_SaveBusinessProcessDevelopmentArtifact" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // invoke the operation + SaveOrValidateBusinessProcessDevelopmentArtifactRequest body = new SaveOrValidateBusinessProcessDevelopmentArtifactRequest("BusinessProcess1") + { + Properties = new BusinessProcessDevelopmentArtifactProperties() + { + Description = "First Business Process", + Identifier = new BusinessProcessIdentifier() + { + PropertyName = "businessIdentifier-1", + PropertyType = "String", + }, + BusinessProcessStages = +{ +["Completed"] = new BusinessProcessStage() +{ +Description = "Completed", +StagesBefore = +{ +"Shipped" +}, +}, +["Denied"] = new BusinessProcessStage() +{ +Description = "Denied", +StagesBefore = +{ +"Processing" +}, +}, +["Processing"] = new BusinessProcessStage() +{ +Description = "Processing", +Properties = +{ +["ApprovalState"] = "String", +["ApproverName"] = "String", +["POAmount"] = "Integer", +}, +StagesBefore = +{ +"Received" +}, +}, +["Received"] = new BusinessProcessStage() +{ +Description = "received", +Properties = +{ +["City"] = "String", +["Product"] = "String", +["Quantity"] = "Integer", +["State"] = "String", +}, +}, +["Shipped"] = new BusinessProcessStage() +{ +Description = "Shipped", +Properties = +{ +["ShipPriority"] = "Integer", +["TrackingID"] = "Integer", +}, +StagesBefore = +{ +"Denied" +}, +}, +}, + BusinessProcessMapping = +{ +["Completed"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "CompletedPO", +OperationType = "Action", +}, +["Denied"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "DeniedPO", +OperationType = "Action", +}, +["Processing"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "PurchaseOrder", +OperationName = "ApprovedPO", +OperationType = "Action", +}, +["Received"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "PurchaseOrder", +OperationName = "manual", +OperationType = "Trigger", +}, +["Shipped"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "ShippedPO", +OperationType = "Action", +}, +}, + TrackingProfiles = +{ +["subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1"] = new TrackingProfile() +{ +Schema = "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2023-01-01/trackingdefinitionschema.json#", +BusinessProcess = new BusinessProcessReference() +{ +Name = "businessProcess1", +Version = "d52c9c91-6e10-4a90-9c1f-08ee5d01c656", +}, +TrackingDefinitions = +{ +["Fulfillment"] = new WorkflowTracking() +{ +CorrelationContext = new TrackingCorrelationContext() +{ +OperationType = "Trigger", +OperationName = "manual", +PropertyName = "OrderNumber", +Value = "@trigger().outputs.body.OrderNumber", +}, +Events = +{ +["Completed"] = new TrackingEvent() +{ +OperationType = "Action", +OperationName = "CompletedPO", +Properties = +{ +}, +}, +["Denied"] = new TrackingEvent() +{ +OperationType = "Action", +OperationName = "DeniedPO", +Properties = +{ +}, +}, +["Shipped"] = new TrackingEvent() +{ +OperationType = "Action", +OperationName = "ShippedPO", +Properties = +{ +["ShipPriority"] = BinaryData.FromString("@action().inputs.shipPriority"), +["TrackingID"] = BinaryData.FromString("@action().inputs.trackingID"), +}, +}, +}, +}, +["PurchaseOrder"] = new WorkflowTracking() +{ +CorrelationContext = new TrackingCorrelationContext() +{ +OperationType = "Trigger", +OperationName = "manual", +PropertyName = "OrderNumber", +Value = "@trigger().outputs.body.OrderNumber", +}, +Events = +{ +["Processing"] = new TrackingEvent() +{ +OperationType = "Action", +OperationName = "ApprovedPO", +Properties = +{ +["ApprovalStatus"] = BinaryData.FromString("@action().inputs.ApprovalStatus"), +["ApproverName"] = BinaryData.FromString("@action().inputs.ApproverName"), +["POAmount"] = BinaryData.FromString("@action().inputs.POamount"), +}, +}, +["Received"] = new TrackingEvent() +{ +OperationType = "Trigger", +OperationName = "manual", +Properties = +{ +["City"] = BinaryData.FromString("@trigger().outputs.body.Address.City"), +["Product"] = BinaryData.FromString("@trigger().outputs.body.Product"), +["Quantity"] = BinaryData.FromString("@trigger().outputs.body.Quantity"), +["State"] = BinaryData.FromString("@trigger().outputs.body.Address.State"), +}, +}, +}, +}, +}, +}, +}, + }, + }; + BusinessProcessDevelopmentArtifactResult result = await integrationSpaceApplication.SaveBusinessProcessDevelopmentArtifactAsync(body); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ValidateBusinessProcessDevelopmentArtifact + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ValidateBusinessProcessDevelopmentArtifact_ValidateBusinessProcessDevelopmentArtifact() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Applications_ValidateBusinessProcessDevelopmentArtifact.json + // this example is just showing the usage of "Applications_ValidateBusinessProcessDevelopmentArtifact" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // invoke the operation + SaveOrValidateBusinessProcessDevelopmentArtifactRequest body = new SaveOrValidateBusinessProcessDevelopmentArtifactRequest("BusinessProcess1") + { + Properties = new BusinessProcessDevelopmentArtifactProperties() + { + Description = "First Business Process", + Identifier = new BusinessProcessIdentifier() + { + PropertyName = "businessIdentifier-1", + PropertyType = "String", + }, + BusinessProcessStages = +{ +["Completed"] = new BusinessProcessStage() +{ +Description = "Completed", +StagesBefore = +{ +"Shipped" +}, +}, +["Denied"] = new BusinessProcessStage() +{ +Description = "Denied", +StagesBefore = +{ +"Processing" +}, +}, +["Processing"] = new BusinessProcessStage() +{ +Description = "Processing", +Properties = +{ +["ApprovalState"] = "String", +["ApproverName"] = "String", +["POAmount"] = "Integer", +}, +StagesBefore = +{ +"Received" +}, +}, +["Received@"] = new BusinessProcessStage() +{ +Description = "received", +Properties = +{ +["City"] = "String", +["Product"] = "String", +["Quantity"] = "Integer", +["State"] = "String", +}, +}, +["Shipped"] = new BusinessProcessStage() +{ +Description = "Shipped", +Properties = +{ +["ShipPriority"] = "Integer", +["TrackingID"] = "Integer", +}, +StagesBefore = +{ +"Denied" +}, +}, +}, + BusinessProcessMapping = +{ +["Completed"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "CompletedPO", +OperationType = "Action", +}, +["Denied"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "DeniedPO", +OperationType = "Action", +}, +["Processing"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "PurchaseOrder", +OperationName = "ApprovedPO", +OperationType = "Action", +}, +["Received"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "PurchaseOrder", +OperationName = "manual", +OperationType = "Trigger", +}, +["Shipped"] = new BusinessProcessMappingItem() +{ +LogicAppResourceId = "subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1", +WorkflowName = "Fulfillment", +OperationName = "ShippedPO", +OperationType = "Action", +}, +}, + TrackingProfiles = +{ +["subscriptions/sub1/resourcegroups/group1/providers/Microsoft.Web/sites/logicApp1"] = new TrackingProfile() +{ +Schema = "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2023-01-01/trackingdefinitionschema.json#", +BusinessProcess = new BusinessProcessReference() +{ +Name = "businessProcess1", +Version = "d52c9c91-6e10-4a90-9c1f-08ee5d01c656", +}, +TrackingDefinitions = +{ +["Fulfillment"] = new WorkflowTracking() +{ +CorrelationContext = new TrackingCorrelationContext() +{ +OperationType = "Trigger", +OperationName = "manual", +PropertyName = "OrderNumber", +Value = "@trigger().outputs.body.OrderNumber", +}, +Events = +{ +["Completed"] = new TrackingEvent() +{ +OperationType = "Action", +OperationName = "CompletedPO", +Properties = +{ +}, +}, +["Denied"] = new TrackingEvent() +{ +OperationType = "Action", +OperationName = "DeniedPO", +Properties = +{ +}, +}, +["Shipped"] = new TrackingEvent() +{ +OperationType = "Action", +OperationName = "ShippedPO", +Properties = +{ +["ShipPriority"] = BinaryData.FromString("@action().inputs.shipPriority"), +["TrackingID"] = BinaryData.FromString("@action().inputs.trackingID"), +}, +}, +}, +}, +["PurchaseOrder"] = new WorkflowTracking() +{ +CorrelationContext = new TrackingCorrelationContext() +{ +OperationType = "Trigger", +OperationName = "manual", +PropertyName = "OrderNumber", +Value = "@trigger().outputs.body.OrderNumber", +}, +Events = +{ +["Processing"] = new TrackingEvent() +{ +OperationType = "Action", +OperationName = "ApprovedPO", +Properties = +{ +["ApprovalStatus"] = BinaryData.FromString("@action().inputs.ApprovalStatus"), +["ApproverName"] = BinaryData.FromString("@action().inputs.ApproverName"), +["POAmount"] = BinaryData.FromString("@action().inputs.POamount"), +}, +}, +["Received"] = new TrackingEvent() +{ +OperationType = "Trigger", +OperationName = "manual", +Properties = +{ +["City"] = BinaryData.FromString("@trigger().outputs.body.Address.City"), +["Product"] = BinaryData.FromString("@trigger().outputs.body.Product"), +["Quantity"] = BinaryData.FromString("@trigger().outputs.body.Quantity"), +["State"] = BinaryData.FromString("@trigger().outputs.body.Address.State"), +}, +}, +}, +}, +}, +}, +}, + }, + }; + await integrationSpaceApplication.ValidateBusinessProcessDevelopmentArtifactAsync(body); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceResource.cs new file mode 100644 index 0000000000000..1a134eb5371c3 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceResource.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_IntegrationSpaceResource + { + // GetApplicationResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetApplicationResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/ApplicationResources_Get.json + // this example is just showing the usage of "ApplicationResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceResource created on azure + // for more information of creating IntegrationSpaceResource, please refer to the document of IntegrationSpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string resourceName = "Resource1"; + ResourceIdentifier integrationSpaceResourceId = IntegrationSpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName); + IntegrationSpaceResource integrationSpaceResource = client.GetIntegrationSpaceResource(integrationSpaceResourceId); + + // invoke the operation + IntegrationSpaceResource result = await integrationSpaceResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PatchApplicationResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchApplicationResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/ApplicationResources_Patch.json + // this example is just showing the usage of "ApplicationResources_Patch" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceResource created on azure + // for more information of creating IntegrationSpaceResource, please refer to the document of IntegrationSpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string resourceName = "Resource1"; + ResourceIdentifier integrationSpaceResourceId = IntegrationSpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName); + IntegrationSpaceResource integrationSpaceResource = client.GetIntegrationSpaceResource(integrationSpaceResourceId); + + // invoke the operation + IntegrationSpaceResourcePatch patch = new IntegrationSpaceResourcePatch() + { + ResourceType = "Microsoft.Web/sites", + ResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Web/sites/LogicApp1", + ResourceKind = "LogicApp", + }; + IntegrationSpaceResource result = await integrationSpaceResource.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteApplicationResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteApplicationResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/ApplicationResources_Delete.json + // this example is just showing the usage of "ApplicationResources_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceResource created on azure + // for more information of creating IntegrationSpaceResource, please refer to the document of IntegrationSpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + string resourceName = "Resource1"; + ResourceIdentifier integrationSpaceResourceId = IntegrationSpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName); + IntegrationSpaceResource integrationSpaceResource = client.GetIntegrationSpaceResource(integrationSpaceResourceId); + + // invoke the operation + await integrationSpaceResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceResourceCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceResourceCollection.cs new file mode 100644 index 0000000000000..93d772c56831f --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_IntegrationSpaceResourceCollection.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_IntegrationSpaceResourceCollection + { + // ListApplicationResourceByApplication + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListApplicationResourceByApplication() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/ApplicationResources_ListByApplication.json + // this example is just showing the usage of "ApplicationResources_ListByApplication" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this IntegrationSpaceResource + IntegrationSpaceResourceCollection collection = integrationSpaceApplication.GetIntegrationSpaceResources(); + + // invoke the operation and iterate over the result + IntegrationSpaceResourceCollectionGetAllOptions options = new IntegrationSpaceResourceCollectionGetAllOptions() { }; + await foreach (IntegrationSpaceResource item in collection.GetAllAsync(options)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetApplicationResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetApplicationResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/ApplicationResources_Get.json + // this example is just showing the usage of "ApplicationResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this IntegrationSpaceResource + IntegrationSpaceResourceCollection collection = integrationSpaceApplication.GetIntegrationSpaceResources(); + + // invoke the operation + string resourceName = "Resource1"; + IntegrationSpaceResource result = await collection.GetAsync(resourceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetApplicationResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetApplicationResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/ApplicationResources_Get.json + // this example is just showing the usage of "ApplicationResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this IntegrationSpaceResource + IntegrationSpaceResourceCollection collection = integrationSpaceApplication.GetIntegrationSpaceResources(); + + // invoke the operation + string resourceName = "Resource1"; + bool result = await collection.ExistsAsync(resourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetApplicationResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetApplicationResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/ApplicationResources_Get.json + // this example is just showing the usage of "ApplicationResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this IntegrationSpaceResource + IntegrationSpaceResourceCollection collection = integrationSpaceApplication.GetIntegrationSpaceResources(); + + // invoke the operation + string resourceName = "Resource1"; + NullableResponse response = await collection.GetIfExistsAsync(resourceName); + IntegrationSpaceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CreateOrUpdateApplicationResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateApplicationResource() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/ApplicationResources_CreateOrUpdate.json + // this example is just showing the usage of "ApplicationResources_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this IntegrationSpaceApplicationResource created on azure + // for more information of creating IntegrationSpaceApplicationResource, please refer to the document of IntegrationSpaceApplicationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + string applicationName = "Application1"; + ResourceIdentifier integrationSpaceApplicationResourceId = IntegrationSpaceApplicationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName, applicationName); + IntegrationSpaceApplicationResource integrationSpaceApplication = client.GetIntegrationSpaceApplicationResource(integrationSpaceApplicationResourceId); + + // get the collection of this IntegrationSpaceResource + IntegrationSpaceResourceCollection collection = integrationSpaceApplication.GetIntegrationSpaceResources(); + + // invoke the operation + string resourceName = "Resource1"; + IntegrationSpaceResourceData data = new IntegrationSpaceResourceData() + { + ResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.Web/sites/LogicApp1", + ResourceKind = "LogicApp", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + IntegrationSpaceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + IntegrationSpaceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_SpaceCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_SpaceCollection.cs new file mode 100644 index 0000000000000..f8898ba3165f7 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_SpaceCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_SpaceCollection + { + // ListSpacesByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListSpacesByResourceGroup() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_ListByResourceGroup.json + // this example is just showing the usage of "Spaces_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SpaceResource + SpaceCollection collection = resourceGroupResource.GetSpaces(); + + // invoke the operation and iterate over the result + SpaceCollectionGetAllOptions options = new SpaceCollectionGetAllOptions() { }; + await foreach (SpaceResource item in collection.GetAllAsync(options)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SpaceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetSpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetSpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_Get.json + // this example is just showing the usage of "Spaces_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SpaceResource + SpaceCollection collection = resourceGroupResource.GetSpaces(); + + // invoke the operation + string spaceName = "Space1"; + SpaceResource result = await collection.GetAsync(spaceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SpaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetSpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetSpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_Get.json + // this example is just showing the usage of "Spaces_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SpaceResource + SpaceCollection collection = resourceGroupResource.GetSpaces(); + + // invoke the operation + string spaceName = "Space1"; + bool result = await collection.ExistsAsync(spaceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetSpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetSpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_Get.json + // this example is just showing the usage of "Spaces_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SpaceResource + SpaceCollection collection = resourceGroupResource.GetSpaces(); + + // invoke the operation + string spaceName = "Space1"; + NullableResponse response = await collection.GetIfExistsAsync(spaceName); + SpaceResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SpaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CreateOrUpdateSpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateSpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_CreateOrUpdate.json + // this example is just showing the usage of "Spaces_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SpaceResource + SpaceCollection collection = resourceGroupResource.GetSpaces(); + + // invoke the operation + string spaceName = "Space1"; + SpaceData data = new SpaceData(new AzureLocation("CentralUS")) + { + Description = "This is the user provided description of the space resource.", + Tags = +{ +["key1"] = "Value1", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, spaceName, data); + SpaceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SpaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_SpaceResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_SpaceResource.cs new file mode 100644 index 0000000000000..62aeb1b70caa2 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/samples/Generated/Samples/Sample_SpaceResource.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.IntegrationSpaces.Samples +{ + public partial class Sample_SpaceResource + { + // ListSpacesBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSpaces_ListSpacesBySubscription() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_ListBySubscription.json + // this example is just showing the usage of "Spaces_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SpaceResource item in subscriptionResource.GetSpacesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SpaceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetSpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetSpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_Get.json + // this example is just showing the usage of "Spaces_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // invoke the operation + SpaceResource result = await space.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SpaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PatchSpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchSpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_Patch.json + // this example is just showing the usage of "Spaces_Patch" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // invoke the operation + SpacePatch patch = new SpacePatch() + { + Tags = +{ +["key1"] = "Value1", +}, + Description = "This is the user provided description of the space resource.", + }; + SpaceResource result = await space.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SpaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteSpace + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteSpace() + { + // Generated from example definition: specification/azureintegrationspaces/resource-manager/Microsoft.IntegrationSpaces/preview/2023-11-14-preview/examples/Spaces_Delete.json + // this example is just showing the usage of "Spaces_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SpaceResource created on azure + // for more information of creating SpaceResource, please refer to the document of SpaceResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "testrg"; + string spaceName = "Space1"; + ResourceIdentifier spaceResourceId = SpaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, spaceName); + SpaceResource space = client.GetSpaceResource(spaceResourceId); + + // invoke the operation + await space.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Azure.ResourceManager.IntegrationSpaces.csproj b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Azure.ResourceManager.IntegrationSpaces.csproj new file mode 100644 index 0000000000000..8d824ba296ef3 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Azure.ResourceManager.IntegrationSpaces.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.IntegrationSpaces + Azure Resource Manager client SDK for Azure resource provider IntegrationSpaces. + azure;management;arm;resource manager;integrationspaces + + diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/ArmIntegrationSpacesModelFactory.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/ArmIntegrationSpacesModelFactory.cs new file mode 100644 index 0000000000000..8ca158a62a45e --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/ArmIntegrationSpacesModelFactory.cs @@ -0,0 +1,137 @@ +// 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.IntegrationSpaces; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// Model factory for models. + public static partial class ArmIntegrationSpacesModelFactory + { + /// Initializes a new instance of SpaceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The status of the last operation. + /// The description of the resource. + /// A new instance for mocking. + public static SpaceData SpaceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ProvisioningState? provisioningState = null, string description = null) + { + tags ??= new Dictionary(); + + return new SpaceData(id, name, resourceType, systemData, tags, location, provisioningState, description); + } + + /// Initializes a new instance of IntegrationSpaceApplicationData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The status of the last operation. + /// The description of the resource. + /// The tracking data stores. + /// A new instance for mocking. + public static IntegrationSpaceApplicationData IntegrationSpaceApplicationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ProvisioningState? provisioningState = null, string description = null, IDictionary trackingDataStores = null) + { + tags ??= new Dictionary(); + trackingDataStores ??= new Dictionary(); + + return new IntegrationSpaceApplicationData(id, name, resourceType, systemData, tags, location, provisioningState, description, trackingDataStores); + } + + /// Initializes a new instance of BusinessProcessData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The status of the last operation. + /// The version of the business process. + /// The description of the business process. + /// The table name of the business process. + /// The tracking data store reference name. + /// The business process identifier. + /// The business process stages. + /// The business process mapping. + /// A new instance for mocking. + public static BusinessProcessData BusinessProcessData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisioningState? provisioningState = null, string version = null, string description = null, string tableName = null, string trackingDataStoreReferenceName = null, BusinessProcessIdentifier identifier = null, IDictionary businessProcessStages = null, IDictionary businessProcessMapping = null) + { + businessProcessStages ??= new Dictionary(); + businessProcessMapping ??= new Dictionary(); + + return new BusinessProcessData(id, name, resourceType, systemData, provisioningState, version, description, tableName, trackingDataStoreReferenceName, identifier, businessProcessStages, businessProcessMapping); + } + + /// Initializes a new instance of BusinessProcessVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The status of the last operation. + /// The version of the business process. + /// The description of the business process. + /// The table name of the business process. + /// The tracking data store reference name. + /// The business process identifier. + /// The business process stages. + /// The business process mapping. + /// A new instance for mocking. + public static BusinessProcessVersionData BusinessProcessVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisioningState? provisioningState = null, string version = null, string description = null, string tableName = null, string trackingDataStoreReferenceName = null, BusinessProcessIdentifier identifier = null, IDictionary businessProcessStages = null, IDictionary businessProcessMapping = null) + { + businessProcessStages ??= new Dictionary(); + businessProcessMapping ??= new Dictionary(); + + return new BusinessProcessVersionData(id, name, resourceType, systemData, provisioningState, version, description, tableName, trackingDataStoreReferenceName, identifier, businessProcessStages, businessProcessMapping); + } + + /// Initializes a new instance of BusinessProcessDevelopmentArtifactResult. + /// The name of the business process development artifact. + /// The system data of the business process development artifact. + /// The properties of the business process development artifact. + /// A new instance for mocking. + public static BusinessProcessDevelopmentArtifactResult BusinessProcessDevelopmentArtifactResult(string name = null, SystemData systemData = null, BusinessProcessDevelopmentArtifactProperties properties = null) + { + return new BusinessProcessDevelopmentArtifactResult(name, systemData, properties); + } + + /// Initializes a new instance of IntegrationSpaceResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The status of the last operation. + /// The Arm id of the application resource. + /// The kind of the application resource. + /// A new instance for mocking. + public static IntegrationSpaceResourceData IntegrationSpaceResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisioningState? provisioningState = null, string resourceId = null, string resourceKind = null) + { + return new IntegrationSpaceResourceData(id, name, resourceType, systemData, provisioningState, resourceId, resourceKind); + } + + /// Initializes a new instance of InfrastructureResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The status of the last operation. + /// The id of the infrastructure resource. + /// A new instance for mocking. + public static InfrastructureResourceData InfrastructureResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisioningState? provisioningState = null, string resourceId = null) + { + return new InfrastructureResourceData(id, name, resourceType, systemData, provisioningState, resourceId); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessCollection.cs new file mode 100644 index 0000000000000..692d9cb0b08c9 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessCollection.cs @@ -0,0 +1,422 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetBusinessProcesses method from an instance of . + /// + public partial class BusinessProcessCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _businessProcessClientDiagnostics; + private readonly BusinessProcessesRestOperations _businessProcessRestClient; + + /// Initializes a new instance of the class for mocking. + protected BusinessProcessCollection() + { + } + + /// 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 BusinessProcessCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _businessProcessClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", BusinessProcessResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(BusinessProcessResource.ResourceType, out string businessProcessApiVersion); + _businessProcessRestClient = new BusinessProcessesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, businessProcessApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != IntegrationSpaceApplicationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, IntegrationSpaceApplicationResource.ResourceType), nameof(id)); + } + + /// + /// Create a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_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 business process. + /// 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 businessProcessName, BusinessProcessData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _businessProcessRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, businessProcessName, data, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new BusinessProcessResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_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 business process. + /// 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 businessProcessName, BusinessProcessData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _businessProcessRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, businessProcessName, data, cancellationToken); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new BusinessProcessResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The name of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessCollection.Get"); + scope.Start(); + try + { + var response = await _businessProcessRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, businessProcessName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The name of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessCollection.Get"); + scope.Start(); + try + { + var response = _businessProcessRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, businessProcessName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List BusinessProcess resources by Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses + /// + /// + /// Operation Id + /// BusinessProcesses_ListByApplication + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(BusinessProcessCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new BusinessProcessCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _businessProcessRestClient.CreateListByApplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _businessProcessRestClient.CreateListByApplicationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BusinessProcessResource(Client, BusinessProcessData.DeserializeBusinessProcessData(e)), _businessProcessClientDiagnostics, Pipeline, "BusinessProcessCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List BusinessProcess resources by Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses + /// + /// + /// Operation Id + /// BusinessProcesses_ListByApplication + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(BusinessProcessCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new BusinessProcessCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _businessProcessRestClient.CreateListByApplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _businessProcessRestClient.CreateListByApplicationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BusinessProcessResource(Client, BusinessProcessData.DeserializeBusinessProcessData(e)), _businessProcessClientDiagnostics, Pipeline, "BusinessProcessCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The name of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessCollection.Exists"); + scope.Start(); + try + { + var response = await _businessProcessRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, businessProcessName, 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.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The name of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessCollection.Exists"); + scope.Start(); + try + { + var response = _businessProcessRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, businessProcessName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The name of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _businessProcessRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, businessProcessName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The name of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessCollection.GetIfExists"); + scope.Start(); + try + { + var response = _businessProcessRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, businessProcessName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(options: null, cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessData.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessData.cs new file mode 100644 index 0000000000000..c163a9e1383d0 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessData.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing the BusinessProcess data model. + /// A business process under application. + /// + public partial class BusinessProcessData : ResourceData + { + /// Initializes a new instance of BusinessProcessData. + public BusinessProcessData() + { + BusinessProcessStages = new ChangeTrackingDictionary(); + BusinessProcessMapping = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of BusinessProcessData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The status of the last operation. + /// The version of the business process. + /// The description of the business process. + /// The table name of the business process. + /// The tracking data store reference name. + /// The business process identifier. + /// The business process stages. + /// The business process mapping. + internal BusinessProcessData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, string version, string description, string tableName, string trackingDataStoreReferenceName, BusinessProcessIdentifier identifier, IDictionary businessProcessStages, IDictionary businessProcessMapping) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + Version = version; + Description = description; + TableName = tableName; + TrackingDataStoreReferenceName = trackingDataStoreReferenceName; + Identifier = identifier; + BusinessProcessStages = businessProcessStages; + BusinessProcessMapping = businessProcessMapping; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// The version of the business process. + public string Version { get; } + /// The description of the business process. + public string Description { get; set; } + /// The table name of the business process. + public string TableName { get; set; } + /// The tracking data store reference name. + public string TrackingDataStoreReferenceName { get; set; } + /// The business process identifier. + public BusinessProcessIdentifier Identifier { get; set; } + /// The business process stages. + public IDictionary BusinessProcessStages { get; } + /// The business process mapping. + public IDictionary BusinessProcessMapping { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessResource.cs new file mode 100644 index 0000000000000..38941ce755c7b --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessResource.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +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.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A Class representing a BusinessProcess along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetBusinessProcessResource method. + /// Otherwise you can get one from its parent resource using the GetBusinessProcess method. + /// + public partial class BusinessProcessResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _businessProcessClientDiagnostics; + private readonly BusinessProcessesRestOperations _businessProcessRestClient; + private readonly BusinessProcessData _data; + + /// Initializes a new instance of the class for mocking. + protected BusinessProcessResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BusinessProcessResource(ArmClient client, BusinessProcessData 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 BusinessProcessResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _businessProcessClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string businessProcessApiVersion); + _businessProcessRestClient = new BusinessProcessesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, businessProcessApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IntegrationSpaces/spaces/applications/businessProcesses"; + + /// 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 BusinessProcessData 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)); + } + + /// Gets a collection of BusinessProcessVersionResources in the BusinessProcess. + /// An object representing collection of BusinessProcessVersionResources and their operations over a BusinessProcessVersionResource. + public virtual BusinessProcessVersionCollection GetBusinessProcessVersions() + { + return GetCachedClient(Client => new BusinessProcessVersionCollection(Client, Id)); + } + + /// + /// Get a BusinessProcessVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The version of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetBusinessProcessVersionAsync(string businessProcessVersion, CancellationToken cancellationToken = default) + { + return await GetBusinessProcessVersions().GetAsync(businessProcessVersion, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a BusinessProcessVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The version of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetBusinessProcessVersion(string businessProcessVersion, CancellationToken cancellationToken = default) + { + return GetBusinessProcessVersions().Get(businessProcessVersion, cancellationToken); + } + + /// + /// Get a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessResource.Get"); + scope.Start(); + try + { + var response = await _businessProcessRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessResource.Get"); + scope.Start(); + try + { + var response = _businessProcessRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_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 = _businessProcessClientDiagnostics.CreateScope("BusinessProcessResource.Delete"); + scope.Start(); + try + { + var response = await _businessProcessRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_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 = _businessProcessClientDiagnostics.CreateScope("BusinessProcessResource.Delete"); + scope.Start(); + try + { + var response = _businessProcessRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(BusinessProcessPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessResource.Update"); + scope.Start(); + try + { + var response = await _businessProcessRestClient.PatchAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new BusinessProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(BusinessProcessPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _businessProcessClientDiagnostics.CreateScope("BusinessProcessResource.Update"); + scope.Start(); + try + { + var response = _businessProcessRestClient.Patch(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); + return Response.FromValue(new BusinessProcessResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionCollection.cs new file mode 100644 index 0000000000000..138064ddd6c47 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionCollection.cs @@ -0,0 +1,340 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetBusinessProcessVersions method from an instance of . + /// + public partial class BusinessProcessVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _businessProcessVersionClientDiagnostics; + private readonly BusinessProcessVersionsRestOperations _businessProcessVersionRestClient; + + /// Initializes a new instance of the class for mocking. + protected BusinessProcessVersionCollection() + { + } + + /// 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 BusinessProcessVersionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _businessProcessVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", BusinessProcessVersionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(BusinessProcessVersionResource.ResourceType, out string businessProcessVersionApiVersion); + _businessProcessVersionRestClient = new BusinessProcessVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, businessProcessVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != BusinessProcessResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, BusinessProcessResource.ResourceType), nameof(id)); + } + + /// + /// Get a BusinessProcessVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The version of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string businessProcessVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessVersion, nameof(businessProcessVersion)); + + using var scope = _businessProcessVersionClientDiagnostics.CreateScope("BusinessProcessVersionCollection.Get"); + scope.Start(); + try + { + var response = await _businessProcessVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, businessProcessVersion, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BusinessProcessVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The version of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string businessProcessVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessVersion, nameof(businessProcessVersion)); + + using var scope = _businessProcessVersionClientDiagnostics.CreateScope("BusinessProcessVersionCollection.Get"); + scope.Start(); + try + { + var response = _businessProcessVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, businessProcessVersion, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List BusinessProcessVersion resources by BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions + /// + /// + /// Operation Id + /// BusinessProcessVersions_ListByBusinessProcess + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(BusinessProcessVersionCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new BusinessProcessVersionCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _businessProcessVersionRestClient.CreateListByBusinessProcessRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _businessProcessVersionRestClient.CreateListByBusinessProcessNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BusinessProcessVersionResource(Client, BusinessProcessVersionData.DeserializeBusinessProcessVersionData(e)), _businessProcessVersionClientDiagnostics, Pipeline, "BusinessProcessVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List BusinessProcessVersion resources by BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions + /// + /// + /// Operation Id + /// BusinessProcessVersions_ListByBusinessProcess + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(BusinessProcessVersionCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new BusinessProcessVersionCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _businessProcessVersionRestClient.CreateListByBusinessProcessRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _businessProcessVersionRestClient.CreateListByBusinessProcessNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BusinessProcessVersionResource(Client, BusinessProcessVersionData.DeserializeBusinessProcessVersionData(e)), _businessProcessVersionClientDiagnostics, Pipeline, "BusinessProcessVersionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The version of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string businessProcessVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessVersion, nameof(businessProcessVersion)); + + using var scope = _businessProcessVersionClientDiagnostics.CreateScope("BusinessProcessVersionCollection.Exists"); + scope.Start(); + try + { + var response = await _businessProcessVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, businessProcessVersion, 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.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The version of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string businessProcessVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessVersion, nameof(businessProcessVersion)); + + using var scope = _businessProcessVersionClientDiagnostics.CreateScope("BusinessProcessVersionCollection.Exists"); + scope.Start(); + try + { + var response = _businessProcessVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, businessProcessVersion, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The version of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string businessProcessVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessVersion, nameof(businessProcessVersion)); + + using var scope = _businessProcessVersionClientDiagnostics.CreateScope("BusinessProcessVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _businessProcessVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, businessProcessVersion, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The version of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string businessProcessVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(businessProcessVersion, nameof(businessProcessVersion)); + + using var scope = _businessProcessVersionClientDiagnostics.CreateScope("BusinessProcessVersionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _businessProcessVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, businessProcessVersion, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(options: null, cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionData.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionData.cs new file mode 100644 index 0000000000000..c5db21557deb2 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionData.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing the BusinessProcessVersion data model. + /// A business process version. + /// + public partial class BusinessProcessVersionData : ResourceData + { + /// Initializes a new instance of BusinessProcessVersionData. + public BusinessProcessVersionData() + { + BusinessProcessStages = new ChangeTrackingDictionary(); + BusinessProcessMapping = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of BusinessProcessVersionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The status of the last operation. + /// The version of the business process. + /// The description of the business process. + /// The table name of the business process. + /// The tracking data store reference name. + /// The business process identifier. + /// The business process stages. + /// The business process mapping. + internal BusinessProcessVersionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, string version, string description, string tableName, string trackingDataStoreReferenceName, BusinessProcessIdentifier identifier, IDictionary businessProcessStages, IDictionary businessProcessMapping) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + Version = version; + Description = description; + TableName = tableName; + TrackingDataStoreReferenceName = trackingDataStoreReferenceName; + Identifier = identifier; + BusinessProcessStages = businessProcessStages; + BusinessProcessMapping = businessProcessMapping; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// The version of the business process. + public string Version { get; } + /// The description of the business process. + public string Description { get; set; } + /// The table name of the business process. + public string TableName { get; set; } + /// The tracking data store reference name. + public string TrackingDataStoreReferenceName { get; set; } + /// The business process identifier. + public BusinessProcessIdentifier Identifier { get; set; } + /// The business process stages. + public IDictionary BusinessProcessStages { get; } + /// The business process mapping. + public IDictionary BusinessProcessMapping { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionResource.cs new file mode 100644 index 0000000000000..2ff549bb51085 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/BusinessProcessVersionResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A Class representing a BusinessProcessVersion along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetBusinessProcessVersionResource method. + /// Otherwise you can get one from its parent resource using the GetBusinessProcessVersion method. + /// + public partial class BusinessProcessVersionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, string businessProcessVersion) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _businessProcessVersionClientDiagnostics; + private readonly BusinessProcessVersionsRestOperations _businessProcessVersionRestClient; + private readonly BusinessProcessVersionData _data; + + /// Initializes a new instance of the class for mocking. + protected BusinessProcessVersionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BusinessProcessVersionResource(ArmClient client, BusinessProcessVersionData 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 BusinessProcessVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _businessProcessVersionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string businessProcessVersionApiVersion); + _businessProcessVersionRestClient = new BusinessProcessVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, businessProcessVersionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IntegrationSpaces/spaces/applications/businessProcesses/versions"; + + /// 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 BusinessProcessVersionData 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 BusinessProcessVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _businessProcessVersionClientDiagnostics.CreateScope("BusinessProcessVersionResource.Get"); + scope.Start(); + try + { + var response = await _businessProcessVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BusinessProcessVersion + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion} + /// + /// + /// Operation Id + /// BusinessProcessVersions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _businessProcessVersionClientDiagnostics.CreateScope("BusinessProcessVersionResource.Get"); + scope.Start(); + try + { + var response = _businessProcessVersionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BusinessProcessVersionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Extensions/IntegrationSpacesExtensions.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Extensions/IntegrationSpacesExtensions.cs new file mode 100644 index 0000000000000..9d775697edda7 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Extensions/IntegrationSpacesExtensions.cs @@ -0,0 +1,264 @@ +// 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.IntegrationSpaces +{ + /// A class to add extension methods to Azure.ResourceManager.IntegrationSpaces. + public static partial class IntegrationSpacesExtensions + { + 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 SpaceResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SpaceResource GetSpaceResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SpaceResource.ValidateResourceId(id); + return new SpaceResource(client, id); + } + ); + } + #endregion + + #region IntegrationSpaceApplicationResource + /// + /// 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 IntegrationSpaceApplicationResource GetIntegrationSpaceApplicationResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + IntegrationSpaceApplicationResource.ValidateResourceId(id); + return new IntegrationSpaceApplicationResource(client, id); + } + ); + } + #endregion + + #region BusinessProcessResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static BusinessProcessResource GetBusinessProcessResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + BusinessProcessResource.ValidateResourceId(id); + return new BusinessProcessResource(client, id); + } + ); + } + #endregion + + #region BusinessProcessVersionResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static BusinessProcessVersionResource GetBusinessProcessVersionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + BusinessProcessVersionResource.ValidateResourceId(id); + return new BusinessProcessVersionResource(client, id); + } + ); + } + #endregion + + #region IntegrationSpaceResource + /// + /// 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 IntegrationSpaceResource GetIntegrationSpaceResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + IntegrationSpaceResource.ValidateResourceId(id); + return new IntegrationSpaceResource(client, id); + } + ); + } + #endregion + + #region InfrastructureResource + /// + /// 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 InfrastructureResource GetInfrastructureResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + InfrastructureResource.ValidateResourceId(id); + return new InfrastructureResource(client, id); + } + ); + } + #endregion + + /// Gets a collection of SpaceResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of SpaceResources and their operations over a SpaceResource. + public static SpaceCollection GetSpaces(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSpaces(); + } + + /// + /// Get a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetSpaceAsync(this ResourceGroupResource resourceGroupResource, string spaceName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetSpaces().GetAsync(spaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetSpace(this ResourceGroupResource resourceGroupResource, string spaceName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetSpaces().Get(spaceName, cancellationToken); + } + + /// + /// List Space resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IntegrationSpaces/spaces + /// + /// + /// Operation Id + /// Spaces_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 GetSpacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSpacesAsync(cancellationToken); + } + + /// + /// List Space resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IntegrationSpaces/spaces + /// + /// + /// Operation Id + /// Spaces_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 GetSpaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSpaces(cancellationToken); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs new file mode 100644 index 0000000000000..c8943ef055a57 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/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.IntegrationSpaces +{ + /// 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 SpaceResources in the ResourceGroupResource. + /// An object representing collection of SpaceResources and their operations over a SpaceResource. + public virtual SpaceCollection GetSpaces() + { + return GetCachedClient(Client => new SpaceCollection(Client, Id)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs new file mode 100644 index 0000000000000..d282f8dad151c --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// A class to add extension methods to SubscriptionResource. + internal partial class SubscriptionResourceExtensionClient : ArmResource + { + private ClientDiagnostics _spaceClientDiagnostics; + private SpacesRestOperations _spaceRestClient; + + /// 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 SpaceClientDiagnostics => _spaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", SpaceResource.ResourceType.Namespace, Diagnostics); + private SpacesRestOperations SpaceRestClient => _spaceRestClient ??= new SpacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SpaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Space resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IntegrationSpaces/spaces + /// + /// + /// Operation Id + /// Spaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSpacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SpaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SpaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SpaceResource(Client, SpaceData.DeserializeSpaceData(e)), SpaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSpaces", "value", "nextLink", cancellationToken); + } + + /// + /// List Space resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IntegrationSpaces/spaces + /// + /// + /// Operation Id + /// Spaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSpaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SpaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SpaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SpaceResource(Client, SpaceData.DeserializeSpaceData(e)), SpaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSpaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResource.cs new file mode 100644 index 0000000000000..1a1c8bbc99508 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResource.cs @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +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.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A Class representing an InfrastructureResource 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 GetInfrastructureResource method. + /// Otherwise you can get one from its parent resource using the GetInfrastructureResource method. + /// + public partial class InfrastructureResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string spaceName, string infrastructureResourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _infrastructureResourceClientDiagnostics; + private readonly InfrastructureResourcesRestOperations _infrastructureResourceRestClient; + private readonly InfrastructureResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected InfrastructureResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal InfrastructureResource(ArmClient client, InfrastructureResourceData 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 InfrastructureResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _infrastructureResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string infrastructureResourceApiVersion); + _infrastructureResourceRestClient = new InfrastructureResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, infrastructureResourceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IntegrationSpaces/spaces/infrastructureResources"; + + /// 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 InfrastructureResourceData 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 InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResource.Get"); + scope.Start(); + try + { + var response = await _infrastructureResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InfrastructureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResource.Get"); + scope.Start(); + try + { + var response = _infrastructureResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InfrastructureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_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 = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResource.Delete"); + scope.Start(); + try + { + var response = await _infrastructureResourceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_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 = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResource.Delete"); + scope.Start(); + try + { + var response = _infrastructureResourceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(InfrastructureResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResource.Update"); + scope.Start(); + try + { + var response = await _infrastructureResourceRestClient.PatchAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InfrastructureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(InfrastructureResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResource.Update"); + scope.Start(); + try + { + var response = _infrastructureResourceRestClient.Patch(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + return Response.FromValue(new InfrastructureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResourceCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResourceCollection.cs new file mode 100644 index 0000000000000..e4d16f39fad96 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResourceCollection.cs @@ -0,0 +1,422 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// 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 GetInfrastructureResources method from an instance of . + /// + public partial class InfrastructureResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _infrastructureResourceClientDiagnostics; + private readonly InfrastructureResourcesRestOperations _infrastructureResourceRestClient; + + /// Initializes a new instance of the class for mocking. + protected InfrastructureResourceCollection() + { + } + + /// 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 InfrastructureResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _infrastructureResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", InfrastructureResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(InfrastructureResource.ResourceType, out string infrastructureResourceApiVersion); + _infrastructureResourceRestClient = new InfrastructureResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, infrastructureResourceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SpaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SpaceResource.ResourceType), nameof(id)); + } + + /// + /// Create a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_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 infrastructure resource in the space. + /// 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 infrastructureResourceName, InfrastructureResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _infrastructureResourceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, infrastructureResourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new InfrastructureResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_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 infrastructure resource in the space. + /// 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 infrastructureResourceName, InfrastructureResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _infrastructureResourceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, infrastructureResourceName, data, cancellationToken); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new InfrastructureResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The name of the infrastructure resource in the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResourceCollection.Get"); + scope.Start(); + try + { + var response = await _infrastructureResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, infrastructureResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InfrastructureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The name of the infrastructure resource in the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResourceCollection.Get"); + scope.Start(); + try + { + var response = _infrastructureResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, infrastructureResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InfrastructureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List InfrastructureResource resources by Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources + /// + /// + /// Operation Id + /// InfrastructureResources_ListBySpace + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(InfrastructureResourceCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new InfrastructureResourceCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _infrastructureResourceRestClient.CreateListBySpaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _infrastructureResourceRestClient.CreateListBySpaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InfrastructureResource(Client, InfrastructureResourceData.DeserializeInfrastructureResourceData(e)), _infrastructureResourceClientDiagnostics, Pipeline, "InfrastructureResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List InfrastructureResource resources by Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources + /// + /// + /// Operation Id + /// InfrastructureResources_ListBySpace + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(InfrastructureResourceCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new InfrastructureResourceCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _infrastructureResourceRestClient.CreateListBySpaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _infrastructureResourceRestClient.CreateListBySpaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InfrastructureResource(Client, InfrastructureResourceData.DeserializeInfrastructureResourceData(e)), _infrastructureResourceClientDiagnostics, Pipeline, "InfrastructureResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The name of the infrastructure resource in the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _infrastructureResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, infrastructureResourceName, 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.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The name of the infrastructure resource in the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResourceCollection.Exists"); + scope.Start(); + try + { + var response = _infrastructureResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, infrastructureResourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The name of the infrastructure resource in the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _infrastructureResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, infrastructureResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InfrastructureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The name of the infrastructure resource in the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var scope = _infrastructureResourceClientDiagnostics.CreateScope("InfrastructureResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _infrastructureResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, infrastructureResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InfrastructureResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(options: null, cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResourceData.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResourceData.cs new file mode 100644 index 0000000000000..389026e46741b --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/InfrastructureResourceData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing the InfrastructureResource data model. + /// An infrastructure resource under Space. + /// + public partial class InfrastructureResourceData : ResourceData + { + /// Initializes a new instance of InfrastructureResourceData. + public InfrastructureResourceData() + { + } + + /// Initializes a new instance of InfrastructureResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The status of the last operation. + /// The id of the infrastructure resource. + internal InfrastructureResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, string resourceId) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + ResourceId = resourceId; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// The id of the infrastructure resource. + public string ResourceId { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationCollection.cs new file mode 100644 index 0000000000000..0ff2a9c4981b2 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationCollection.cs @@ -0,0 +1,422 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// 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 GetIntegrationSpaceApplications method from an instance of . + /// + public partial class IntegrationSpaceApplicationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _integrationSpaceApplicationApplicationsClientDiagnostics; + private readonly ApplicationsRestOperations _integrationSpaceApplicationApplicationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected IntegrationSpaceApplicationCollection() + { + } + + /// 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 IntegrationSpaceApplicationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _integrationSpaceApplicationApplicationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", IntegrationSpaceApplicationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(IntegrationSpaceApplicationResource.ResourceType, out string integrationSpaceApplicationApplicationsApiVersion); + _integrationSpaceApplicationApplicationsRestClient = new ApplicationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, integrationSpaceApplicationApplicationsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SpaceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SpaceResource.ResourceType), nameof(id)); + } + + /// + /// Create a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 Application. + /// 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 applicationName, IntegrationSpaceApplicationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, data, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new IntegrationSpaceApplicationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 Application. + /// 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 applicationName, IntegrationSpaceApplicationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, data, cancellationToken); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new IntegrationSpaceApplicationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the Application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationCollection.Get"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the Application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationCollection.Get"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Application resources by Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications + /// + /// + /// Operation Id + /// Applications_ListBySpace + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(IntegrationSpaceApplicationCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new IntegrationSpaceApplicationCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _integrationSpaceApplicationApplicationsRestClient.CreateListBySpaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _integrationSpaceApplicationApplicationsRestClient.CreateListBySpaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IntegrationSpaceApplicationResource(Client, IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(e)), _integrationSpaceApplicationApplicationsClientDiagnostics, Pipeline, "IntegrationSpaceApplicationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Application resources by Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications + /// + /// + /// Operation Id + /// Applications_ListBySpace + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(IntegrationSpaceApplicationCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new IntegrationSpaceApplicationCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _integrationSpaceApplicationApplicationsRestClient.CreateListBySpaceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _integrationSpaceApplicationApplicationsRestClient.CreateListBySpaceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IntegrationSpaceApplicationResource(Client, IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(e)), _integrationSpaceApplicationApplicationsClientDiagnostics, Pipeline, "IntegrationSpaceApplicationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the Application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationCollection.Exists"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, 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.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the Application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationCollection.Exists"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the Application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the Application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, applicationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(options: null, cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationData.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationData.cs new file mode 100644 index 0000000000000..13e11707abfe8 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationData.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing the IntegrationSpaceApplication data model. + /// An integration application under space. + /// + public partial class IntegrationSpaceApplicationData : TrackedResourceData + { + /// Initializes a new instance of IntegrationSpaceApplicationData. + /// The location. + public IntegrationSpaceApplicationData(AzureLocation location) : base(location) + { + TrackingDataStores = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of IntegrationSpaceApplicationData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The status of the last operation. + /// The description of the resource. + /// The tracking data stores. + internal IntegrationSpaceApplicationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ProvisioningState? provisioningState, string description, IDictionary trackingDataStores) : base(id, name, resourceType, systemData, tags, location) + { + ProvisioningState = provisioningState; + Description = description; + TrackingDataStores = trackingDataStores; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// The description of the resource. + public string Description { get; set; } + /// The tracking data stores. + public IDictionary TrackingDataStores { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationResource.cs new file mode 100644 index 0000000000000..20d47715d444d --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceApplicationResource.cs @@ -0,0 +1,1022 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A Class representing an IntegrationSpaceApplication 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 GetIntegrationSpaceApplicationResource method. + /// Otherwise you can get one from its parent resource using the GetIntegrationSpaceApplication method. + /// + public partial class IntegrationSpaceApplicationResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string spaceName, string applicationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _integrationSpaceApplicationApplicationsClientDiagnostics; + private readonly ApplicationsRestOperations _integrationSpaceApplicationApplicationsRestClient; + private readonly IntegrationSpaceApplicationData _data; + + /// Initializes a new instance of the class for mocking. + protected IntegrationSpaceApplicationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal IntegrationSpaceApplicationResource(ArmClient client, IntegrationSpaceApplicationData 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 IntegrationSpaceApplicationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _integrationSpaceApplicationApplicationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string integrationSpaceApplicationApplicationsApiVersion); + _integrationSpaceApplicationApplicationsRestClient = new ApplicationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, integrationSpaceApplicationApplicationsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IntegrationSpaces/spaces/applications"; + + /// 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 IntegrationSpaceApplicationData 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)); + } + + /// Gets a collection of BusinessProcessResources in the IntegrationSpaceApplication. + /// An object representing collection of BusinessProcessResources and their operations over a BusinessProcessResource. + public virtual BusinessProcessCollection GetBusinessProcesses() + { + return GetCachedClient(Client => new BusinessProcessCollection(Client, Id)); + } + + /// + /// Get a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The name of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetBusinessProcessAsync(string businessProcessName, CancellationToken cancellationToken = default) + { + return await GetBusinessProcesses().GetAsync(businessProcessName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a BusinessProcess + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName} + /// + /// + /// Operation Id + /// BusinessProcesses_Get + /// + /// + /// + /// The name of the business process. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetBusinessProcess(string businessProcessName, CancellationToken cancellationToken = default) + { + return GetBusinessProcesses().Get(businessProcessName, cancellationToken); + } + + /// Gets a collection of IntegrationSpaceResources in the IntegrationSpaceApplication. + /// An object representing collection of IntegrationSpaceResources and their operations over a IntegrationSpaceResource. + public virtual IntegrationSpaceResourceCollection GetIntegrationSpaceResources() + { + return GetCachedClient(Client => new IntegrationSpaceResourceCollection(Client, Id)); + } + + /// + /// Get a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The name of the application resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetIntegrationSpaceResourceAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetIntegrationSpaceResources().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The name of the application resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetIntegrationSpaceResource(string resourceName, CancellationToken cancellationToken = default) + { + return GetIntegrationSpaceResources().Get(resourceName, cancellationToken); + } + + /// + /// Get a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.Get"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.Get"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.Delete"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.Delete"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(IntegrationSpaceApplicationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.Update"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.PatchAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(IntegrationSpaceApplicationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.Update"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.Patch(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The delete business process development artifact action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/deleteBusinessProcessDevelopmentArtifact + /// + /// + /// Operation Id + /// Applications_DeleteBusinessProcessDevelopmentArtifact + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task DeleteBusinessProcessDevelopmentArtifactAsync(GetOrDeleteBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.DeleteBusinessProcessDevelopmentArtifact"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.DeleteBusinessProcessDevelopmentArtifactAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The delete business process development artifact action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/deleteBusinessProcessDevelopmentArtifact + /// + /// + /// Operation Id + /// Applications_DeleteBusinessProcessDevelopmentArtifact + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual Response DeleteBusinessProcessDevelopmentArtifact(GetOrDeleteBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.DeleteBusinessProcessDevelopmentArtifact"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.DeleteBusinessProcessDevelopmentArtifact(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The get business process development artifact action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/getBusinessProcessDevelopmentArtifact + /// + /// + /// Operation Id + /// Applications_GetBusinessProcessDevelopmentArtifact + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetBusinessProcessDevelopmentArtifactAsync(GetOrDeleteBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.GetBusinessProcessDevelopmentArtifact"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.GetBusinessProcessDevelopmentArtifactAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The get business process development artifact action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/getBusinessProcessDevelopmentArtifact + /// + /// + /// Operation Id + /// Applications_GetBusinessProcessDevelopmentArtifact + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual Response GetBusinessProcessDevelopmentArtifact(GetOrDeleteBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.GetBusinessProcessDevelopmentArtifact"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.GetBusinessProcessDevelopmentArtifact(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The list business process development artifacts action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/listBusinessProcessDevelopmentArtifacts + /// + /// + /// Operation Id + /// Applications_ListBusinessProcessDevelopmentArtifacts + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBusinessProcessDevelopmentArtifactsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _integrationSpaceApplicationApplicationsRestClient.CreateListBusinessProcessDevelopmentArtifactsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, BusinessProcessDevelopmentArtifactResult.DeserializeBusinessProcessDevelopmentArtifactResult, _integrationSpaceApplicationApplicationsClientDiagnostics, Pipeline, "IntegrationSpaceApplicationResource.GetBusinessProcessDevelopmentArtifacts", "value", null, cancellationToken); + } + + /// + /// The list business process development artifacts action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/listBusinessProcessDevelopmentArtifacts + /// + /// + /// Operation Id + /// Applications_ListBusinessProcessDevelopmentArtifacts + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBusinessProcessDevelopmentArtifacts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _integrationSpaceApplicationApplicationsRestClient.CreateListBusinessProcessDevelopmentArtifactsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, BusinessProcessDevelopmentArtifactResult.DeserializeBusinessProcessDevelopmentArtifactResult, _integrationSpaceApplicationApplicationsClientDiagnostics, Pipeline, "IntegrationSpaceApplicationResource.GetBusinessProcessDevelopmentArtifacts", "value", null, cancellationToken); + } + + /// + /// The save business process development artifact action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/saveBusinessProcessDevelopmentArtifact + /// + /// + /// Operation Id + /// Applications_SaveBusinessProcessDevelopmentArtifact + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task> SaveBusinessProcessDevelopmentArtifactAsync(SaveOrValidateBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.SaveBusinessProcessDevelopmentArtifact"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.SaveBusinessProcessDevelopmentArtifactAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The save business process development artifact action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/saveBusinessProcessDevelopmentArtifact + /// + /// + /// Operation Id + /// Applications_SaveBusinessProcessDevelopmentArtifact + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual Response SaveBusinessProcessDevelopmentArtifact(SaveOrValidateBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.SaveBusinessProcessDevelopmentArtifact"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.SaveBusinessProcessDevelopmentArtifact(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The validate business process development artifact action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/validateBusinessProcessDevelopmentArtifact + /// + /// + /// Operation Id + /// Applications_ValidateBusinessProcessDevelopmentArtifact + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task ValidateBusinessProcessDevelopmentArtifactAsync(SaveOrValidateBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.ValidateBusinessProcessDevelopmentArtifact"); + scope.Start(); + try + { + var response = await _integrationSpaceApplicationApplicationsRestClient.ValidateBusinessProcessDevelopmentArtifactAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The validate business process development artifact action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/validateBusinessProcessDevelopmentArtifact + /// + /// + /// Operation Id + /// Applications_ValidateBusinessProcessDevelopmentArtifact + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateBusinessProcessDevelopmentArtifact(SaveOrValidateBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.ValidateBusinessProcessDevelopmentArtifact"); + scope.Start(); + try + { + var response = _integrationSpaceApplicationApplicationsRestClient.ValidateBusinessProcessDevelopmentArtifact(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.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 _integrationSpaceApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new IntegrationSpaceApplicationPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.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 = _integrationSpaceApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new IntegrationSpaceApplicationPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.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 _integrationSpaceApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new IntegrationSpaceApplicationPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.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 = _integrationSpaceApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new IntegrationSpaceApplicationPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.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 _integrationSpaceApplicationApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new IntegrationSpaceApplicationPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_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 = _integrationSpaceApplicationApplicationsClientDiagnostics.CreateScope("IntegrationSpaceApplicationResource.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 = _integrationSpaceApplicationApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new IntegrationSpaceApplicationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new IntegrationSpaceApplicationPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResource.cs new file mode 100644 index 0000000000000..24a5c6a82f82a --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResource.cs @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +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.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A Class representing an IntegrationSpaceResource 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 GetIntegrationSpaceResource method. + /// Otherwise you can get one from its parent resource using the GetIntegrationSpaceResource method. + /// + public partial class IntegrationSpaceResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string resourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _integrationSpaceResourceApplicationResourcesClientDiagnostics; + private readonly ApplicationResourcesRestOperations _integrationSpaceResourceApplicationResourcesRestClient; + private readonly IntegrationSpaceResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected IntegrationSpaceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal IntegrationSpaceResource(ArmClient client, IntegrationSpaceResourceData 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 IntegrationSpaceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _integrationSpaceResourceApplicationResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string integrationSpaceResourceApplicationResourcesApiVersion); + _integrationSpaceResourceApplicationResourcesRestClient = new ApplicationResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, integrationSpaceResourceApplicationResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IntegrationSpaces/spaces/applications/resources"; + + /// 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 IntegrationSpaceResourceData 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 ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResource.Get"); + scope.Start(); + try + { + var response = await _integrationSpaceResourceApplicationResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResource.Get"); + scope.Start(); + try + { + var response = _integrationSpaceResourceApplicationResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_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 = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResource.Delete"); + scope.Start(); + try + { + var response = await _integrationSpaceResourceApplicationResourcesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_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 = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResource.Delete"); + scope.Start(); + try + { + var response = _integrationSpaceResourceApplicationResourcesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(IntegrationSpaceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResource.Update"); + scope.Start(); + try + { + var response = await _integrationSpaceResourceApplicationResourcesRestClient.PatchAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new IntegrationSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(IntegrationSpaceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResource.Update"); + scope.Start(); + try + { + var response = _integrationSpaceResourceApplicationResourcesRestClient.Patch(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); + return Response.FromValue(new IntegrationSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResourceCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResourceCollection.cs new file mode 100644 index 0000000000000..943e4389c6bfd --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResourceCollection.cs @@ -0,0 +1,422 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// 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 GetIntegrationSpaceResources method from an instance of . + /// + public partial class IntegrationSpaceResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _integrationSpaceResourceApplicationResourcesClientDiagnostics; + private readonly ApplicationResourcesRestOperations _integrationSpaceResourceApplicationResourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected IntegrationSpaceResourceCollection() + { + } + + /// 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 IntegrationSpaceResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _integrationSpaceResourceApplicationResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", IntegrationSpaceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(IntegrationSpaceResource.ResourceType, out string integrationSpaceResourceApplicationResourcesApiVersion); + _integrationSpaceResourceApplicationResourcesRestClient = new ApplicationResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, integrationSpaceResourceApplicationResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != IntegrationSpaceApplicationResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, IntegrationSpaceApplicationResource.ResourceType), nameof(id)); + } + + /// + /// Create a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_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 application 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 resourceName, IntegrationSpaceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _integrationSpaceResourceApplicationResourcesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new IntegrationSpaceResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_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 application 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 resourceName, IntegrationSpaceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _integrationSpaceResourceApplicationResourcesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resourceName, data, cancellationToken); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new IntegrationSpaceResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The name of the application 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResourceCollection.Get"); + scope.Start(); + try + { + var response = await _integrationSpaceResourceApplicationResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ApplicationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The name of the application resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResourceCollection.Get"); + scope.Start(); + try + { + var response = _integrationSpaceResourceApplicationResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List ApplicationResource resources by Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources + /// + /// + /// Operation Id + /// ApplicationResources_ListByApplication + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(IntegrationSpaceResourceCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new IntegrationSpaceResourceCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _integrationSpaceResourceApplicationResourcesRestClient.CreateListByApplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _integrationSpaceResourceApplicationResourcesRestClient.CreateListByApplicationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IntegrationSpaceResource(Client, IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(e)), _integrationSpaceResourceApplicationResourcesClientDiagnostics, Pipeline, "IntegrationSpaceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List ApplicationResource resources by Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources + /// + /// + /// Operation Id + /// ApplicationResources_ListByApplication + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(IntegrationSpaceResourceCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new IntegrationSpaceResourceCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _integrationSpaceResourceApplicationResourcesRestClient.CreateListByApplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _integrationSpaceResourceApplicationResourcesRestClient.CreateListByApplicationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IntegrationSpaceResource(Client, IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(e)), _integrationSpaceResourceApplicationResourcesClientDiagnostics, Pipeline, "IntegrationSpaceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The name of the application 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 resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _integrationSpaceResourceApplicationResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resourceName, 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.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The name of the application resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResourceCollection.Exists"); + scope.Start(); + try + { + var response = _integrationSpaceResourceApplicationResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The name of the application resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _integrationSpaceResourceApplicationResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName} + /// + /// + /// Operation Id + /// ApplicationResources_Get + /// + /// + /// + /// The name of the application resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = _integrationSpaceResourceApplicationResourcesClientDiagnostics.CreateScope("IntegrationSpaceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _integrationSpaceResourceApplicationResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, resourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new IntegrationSpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(options: null, cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResourceData.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResourceData.cs new file mode 100644 index 0000000000000..5bce5fe101b27 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/IntegrationSpaceResourceData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing the IntegrationSpaceResource data model. + /// A resource under application. + /// + public partial class IntegrationSpaceResourceData : ResourceData + { + /// Initializes a new instance of IntegrationSpaceResourceData. + public IntegrationSpaceResourceData() + { + } + + /// Initializes a new instance of IntegrationSpaceResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The status of the last operation. + /// The Arm id of the application resource. + /// The kind of the application resource. + internal IntegrationSpaceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, string resourceId, string resourceKind) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + ResourceId = resourceId; + ResourceKind = resourceKind; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// The Arm id of the application resource. + public string ResourceId { get; set; } + /// The kind of the application resource. + public string ResourceKind { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/LongRunningOperation/IntegrationSpacesArmOperation.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/LongRunningOperation/IntegrationSpacesArmOperation.cs new file mode 100644 index 0000000000000..685eb26c623de --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/LongRunningOperation/IntegrationSpacesArmOperation.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.IntegrationSpaces +{ +#pragma warning disable SA1649 // File name should match first type name + internal class IntegrationSpacesArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of IntegrationSpacesArmOperation for mocking. + protected IntegrationSpacesArmOperation() + { + } + + internal IntegrationSpacesArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response); + } + + internal IntegrationSpacesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "IntegrationSpacesArmOperation", 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/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/LongRunningOperation/IntegrationSpacesArmOperationOfT.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/LongRunningOperation/IntegrationSpacesArmOperationOfT.cs new file mode 100644 index 0000000000000..889e931fbb2f5 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/LongRunningOperation/IntegrationSpacesArmOperationOfT.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.IntegrationSpaces +{ +#pragma warning disable SA1649 // File name should match first type name + internal class IntegrationSpacesArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of IntegrationSpacesArmOperation for mocking. + protected IntegrationSpacesArmOperation() + { + } + + internal IntegrationSpacesArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + } + + internal IntegrationSpacesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "IntegrationSpacesArmOperation", 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/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationListResult.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationListResult.Serialization.cs new file mode 100644 index 0000000000000..6f8aef977fb48 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + internal partial class ApplicationListResult + { + internal static ApplicationListResult DeserializeApplicationListResult(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(IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(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 ApplicationListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationListResult.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationListResult.cs new file mode 100644 index 0000000000000..9f4e48047393e --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The response of a Application list operation. + internal partial class ApplicationListResult + { + /// Initializes a new instance of ApplicationListResult. + /// The Application items on this page. + /// is null. + internal ApplicationListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of ApplicationListResult. + /// The Application items on this page. + /// The link to the next page of items. + internal ApplicationListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The Application items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationResourceListResult.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationResourceListResult.Serialization.cs new file mode 100644 index 0000000000000..69a557fd7e10b --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationResourceListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + internal partial class ApplicationResourceListResult + { + internal static ApplicationResourceListResult DeserializeApplicationResourceListResult(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(IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(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 ApplicationResourceListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationResourceListResult.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationResourceListResult.cs new file mode 100644 index 0000000000000..f78c45c0ffd87 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ApplicationResourceListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The response of a ApplicationResource list operation. + internal partial class ApplicationResourceListResult + { + /// Initializes a new instance of ApplicationResourceListResult. + /// The ApplicationResource items on this page. + /// is null. + internal ApplicationResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of ApplicationResourceListResult. + /// The ApplicationResource items on this page. + /// The link to the next page of items. + internal ApplicationResourceListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The ApplicationResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessCollectionGetAllOptions.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessCollectionGetAllOptions.cs new file mode 100644 index 0000000000000..ea9d1ed328865 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessCollectionGetAllOptions.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The BusinessProcessCollectionGetAllOptions. + public partial class BusinessProcessCollectionGetAllOptions + { + /// Initializes a new instance of BusinessProcessCollectionGetAllOptions. + public BusinessProcessCollectionGetAllOptions() + { + Select = new ChangeTrackingList(); + Expand = new ChangeTrackingList(); + Orderby = new ChangeTrackingList(); + } + + /// The number of result items to return. + public int? Top { get; set; } + /// The number of result items to skip. + public int? Skip { get; set; } + /// The maximum number of result items per page. + public int? Maxpagesize { get; set; } + /// Filter the result list using the given expression. + public string Filter { get; set; } + /// Select the specified fields to be included in the response. + public IList Select { get; } + /// Expand the indicated resources into the response. + public IList Expand { get; } + /// Expressions that specify the order of returned results. + public IList Orderby { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessData.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessData.Serialization.cs new file mode 100644 index 0000000000000..42b09b6594f58 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessData.Serialization.cs @@ -0,0 +1,195 @@ +// 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.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + public partial class BusinessProcessData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(TableName)) + { + writer.WritePropertyName("tableName"u8); + writer.WriteStringValue(TableName); + } + if (Optional.IsDefined(TrackingDataStoreReferenceName)) + { + writer.WritePropertyName("trackingDataStoreReferenceName"u8); + writer.WriteStringValue(TrackingDataStoreReferenceName); + } + if (Optional.IsDefined(Identifier)) + { + writer.WritePropertyName("identifier"u8); + writer.WriteObjectValue(Identifier); + } + if (Optional.IsCollectionDefined(BusinessProcessStages)) + { + writer.WritePropertyName("businessProcessStages"u8); + writer.WriteStartObject(); + foreach (var item in BusinessProcessStages) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(BusinessProcessMapping)) + { + writer.WritePropertyName("businessProcessMapping"u8); + writer.WriteStartObject(); + foreach (var item in BusinessProcessMapping) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static BusinessProcessData DeserializeBusinessProcessData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional version = default; + Optional description = default; + Optional tableName = default; + Optional trackingDataStoreReferenceName = default; + Optional identifier = default; + Optional> businessProcessStages = default; + Optional> businessProcessMapping = default; + foreach (var property in element.EnumerateObject()) + { + 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("version"u8)) + { + version = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("tableName"u8)) + { + tableName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("trackingDataStoreReferenceName"u8)) + { + trackingDataStoreReferenceName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("identifier"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identifier = BusinessProcessIdentifier.DeserializeBusinessProcessIdentifier(property0.Value); + continue; + } + if (property0.NameEquals("businessProcessStages"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, BusinessProcessStage.DeserializeBusinessProcessStage(property1.Value)); + } + businessProcessStages = dictionary; + continue; + } + if (property0.NameEquals("businessProcessMapping"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, BusinessProcessMappingItem.DeserializeBusinessProcessMappingItem(property1.Value)); + } + businessProcessMapping = dictionary; + continue; + } + } + continue; + } + } + return new BusinessProcessData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), version.Value, description.Value, tableName.Value, trackingDataStoreReferenceName.Value, identifier.Value, Optional.ToDictionary(businessProcessStages), Optional.ToDictionary(businessProcessMapping)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactListResult.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactListResult.Serialization.cs new file mode 100644 index 0000000000000..9947c286b0785 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactListResult.Serialization.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + internal partial class BusinessProcessDevelopmentArtifactListResult + { + internal static BusinessProcessDevelopmentArtifactListResult DeserializeBusinessProcessDevelopmentArtifactListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = 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(BusinessProcessDevelopmentArtifactResult.DeserializeBusinessProcessDevelopmentArtifactResult(item)); + } + value = array; + continue; + } + } + return new BusinessProcessDevelopmentArtifactListResult(value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactListResult.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactListResult.cs new file mode 100644 index 0000000000000..df7df238740ec --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactListResult.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 System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The business process development artifact get collection response. + internal partial class BusinessProcessDevelopmentArtifactListResult + { + /// Initializes a new instance of BusinessProcessDevelopmentArtifactListResult. + /// The list of the business process development artifact. + /// is null. + internal BusinessProcessDevelopmentArtifactListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of BusinessProcessDevelopmentArtifactListResult. + /// The list of the business process development artifact. + internal BusinessProcessDevelopmentArtifactListResult(IReadOnlyList value) + { + Value = value; + } + + /// The list of the business process development artifact. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactProperties.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactProperties.Serialization.cs new file mode 100644 index 0000000000000..3e5112801eaba --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactProperties.Serialization.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class BusinessProcessDevelopmentArtifactProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Identifier)) + { + writer.WritePropertyName("identifier"u8); + writer.WriteObjectValue(Identifier); + } + if (Optional.IsCollectionDefined(BusinessProcessStages)) + { + writer.WritePropertyName("businessProcessStages"u8); + writer.WriteStartObject(); + foreach (var item in BusinessProcessStages) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(BusinessProcessMapping)) + { + writer.WritePropertyName("businessProcessMapping"u8); + writer.WriteStartObject(); + foreach (var item in BusinessProcessMapping) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(TrackingProfiles)) + { + writer.WritePropertyName("trackingProfiles"u8); + writer.WriteStartObject(); + foreach (var item in TrackingProfiles) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static BusinessProcessDevelopmentArtifactProperties DeserializeBusinessProcessDevelopmentArtifactProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional identifier = default; + Optional> businessProcessStages = default; + Optional> businessProcessMapping = default; + Optional> trackingProfiles = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("identifier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identifier = BusinessProcessIdentifier.DeserializeBusinessProcessIdentifier(property.Value); + continue; + } + if (property.NameEquals("businessProcessStages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, BusinessProcessStage.DeserializeBusinessProcessStage(property0.Value)); + } + businessProcessStages = dictionary; + continue; + } + if (property.NameEquals("businessProcessMapping"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, BusinessProcessMappingItem.DeserializeBusinessProcessMappingItem(property0.Value)); + } + businessProcessMapping = dictionary; + continue; + } + if (property.NameEquals("trackingProfiles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, TrackingProfile.DeserializeTrackingProfile(property0.Value)); + } + trackingProfiles = dictionary; + continue; + } + } + return new BusinessProcessDevelopmentArtifactProperties(description.Value, identifier.Value, Optional.ToDictionary(businessProcessStages), Optional.ToDictionary(businessProcessMapping), Optional.ToDictionary(trackingProfiles)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactProperties.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactProperties.cs new file mode 100644 index 0000000000000..6167b66359129 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactProperties.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The properties of business process development artifact. + public partial class BusinessProcessDevelopmentArtifactProperties + { + /// Initializes a new instance of BusinessProcessDevelopmentArtifactProperties. + public BusinessProcessDevelopmentArtifactProperties() + { + BusinessProcessStages = new ChangeTrackingDictionary(); + BusinessProcessMapping = new ChangeTrackingDictionary(); + TrackingProfiles = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of BusinessProcessDevelopmentArtifactProperties. + /// The description of the business process. + /// The business process identifier. + /// The business process stages. + /// The business process mapping. + /// The tracking profile for the business process. + internal BusinessProcessDevelopmentArtifactProperties(string description, BusinessProcessIdentifier identifier, IDictionary businessProcessStages, IDictionary businessProcessMapping, IDictionary trackingProfiles) + { + Description = description; + Identifier = identifier; + BusinessProcessStages = businessProcessStages; + BusinessProcessMapping = businessProcessMapping; + TrackingProfiles = trackingProfiles; + } + + /// The description of the business process. + public string Description { get; set; } + /// The business process identifier. + public BusinessProcessIdentifier Identifier { get; set; } + /// The business process stages. + public IDictionary BusinessProcessStages { get; } + /// The business process mapping. + public IDictionary BusinessProcessMapping { get; } + /// The tracking profile for the business process. + public IDictionary TrackingProfiles { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactResult.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactResult.Serialization.cs new file mode 100644 index 0000000000000..4cab8283ef482 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactResult.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class BusinessProcessDevelopmentArtifactResult + { + internal static BusinessProcessDevelopmentArtifactResult DeserializeBusinessProcessDevelopmentArtifactResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Optional systemData = default; + Optional properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = 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) + { + continue; + } + properties = BusinessProcessDevelopmentArtifactProperties.DeserializeBusinessProcessDevelopmentArtifactProperties(property.Value); + continue; + } + } + return new BusinessProcessDevelopmentArtifactResult(name, systemData, properties.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactResult.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactResult.cs new file mode 100644 index 0000000000000..5fb61ca039f9c --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessDevelopmentArtifactResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The business process development artifact save or get response. + public partial class BusinessProcessDevelopmentArtifactResult + { + /// Initializes a new instance of BusinessProcessDevelopmentArtifactResult. + /// The name of the business process development artifact. + /// is null. + internal BusinessProcessDevelopmentArtifactResult(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of BusinessProcessDevelopmentArtifactResult. + /// The name of the business process development artifact. + /// The system data of the business process development artifact. + /// The properties of the business process development artifact. + internal BusinessProcessDevelopmentArtifactResult(string name, SystemData systemData, BusinessProcessDevelopmentArtifactProperties properties) + { + Name = name; + SystemData = systemData; + Properties = properties; + } + + /// The name of the business process development artifact. + public string Name { get; } + /// The system data of the business process development artifact. + public SystemData SystemData { get; } + /// The properties of the business process development artifact. + public BusinessProcessDevelopmentArtifactProperties Properties { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessIdentifier.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessIdentifier.Serialization.cs new file mode 100644 index 0000000000000..327a315bc7b5d --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessIdentifier.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class BusinessProcessIdentifier : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PropertyName)) + { + writer.WritePropertyName("propertyName"u8); + writer.WriteStringValue(PropertyName); + } + if (Optional.IsDefined(PropertyType)) + { + writer.WritePropertyName("propertyType"u8); + writer.WriteStringValue(PropertyType); + } + writer.WriteEndObject(); + } + + internal static BusinessProcessIdentifier DeserializeBusinessProcessIdentifier(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional propertyName = default; + Optional propertyType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("propertyName"u8)) + { + propertyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("propertyType"u8)) + { + propertyType = property.Value.GetString(); + continue; + } + } + return new BusinessProcessIdentifier(propertyName.Value, propertyType.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessIdentifier.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessIdentifier.cs new file mode 100644 index 0000000000000..bd622ab1bcef4 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessIdentifier.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The properties of business process identifier. + public partial class BusinessProcessIdentifier + { + /// Initializes a new instance of BusinessProcessIdentifier. + public BusinessProcessIdentifier() + { + } + + /// Initializes a new instance of BusinessProcessIdentifier. + /// The property name of the business process identifier. + /// The property type of the business process identifier. + internal BusinessProcessIdentifier(string propertyName, string propertyType) + { + PropertyName = propertyName; + PropertyType = propertyType; + } + + /// The property name of the business process identifier. + public string PropertyName { get; set; } + /// The property type of the business process identifier. + public string PropertyType { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessListResult.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessListResult.Serialization.cs new file mode 100644 index 0000000000000..0409f28282610 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + internal partial class BusinessProcessListResult + { + internal static BusinessProcessListResult DeserializeBusinessProcessListResult(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(BusinessProcessData.DeserializeBusinessProcessData(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 BusinessProcessListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessListResult.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessListResult.cs new file mode 100644 index 0000000000000..6da0ebbb28966 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The response of a BusinessProcess list operation. + internal partial class BusinessProcessListResult + { + /// Initializes a new instance of BusinessProcessListResult. + /// The BusinessProcess items on this page. + /// is null. + internal BusinessProcessListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of BusinessProcessListResult. + /// The BusinessProcess items on this page. + /// The link to the next page of items. + internal BusinessProcessListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The BusinessProcess items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessMappingItem.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessMappingItem.Serialization.cs new file mode 100644 index 0000000000000..5878e3a4354d4 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessMappingItem.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class BusinessProcessMappingItem : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(LogicAppResourceId)) + { + writer.WritePropertyName("logicAppResourceId"u8); + writer.WriteStringValue(LogicAppResourceId); + } + if (Optional.IsDefined(WorkflowName)) + { + writer.WritePropertyName("workflowName"u8); + writer.WriteStringValue(WorkflowName); + } + if (Optional.IsDefined(OperationName)) + { + writer.WritePropertyName("operationName"u8); + writer.WriteStringValue(OperationName); + } + if (Optional.IsDefined(OperationType)) + { + writer.WritePropertyName("operationType"u8); + writer.WriteStringValue(OperationType); + } + writer.WriteEndObject(); + } + + internal static BusinessProcessMappingItem DeserializeBusinessProcessMappingItem(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional logicAppResourceId = default; + Optional workflowName = default; + Optional operationName = default; + Optional operationType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("logicAppResourceId"u8)) + { + logicAppResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("workflowName"u8)) + { + workflowName = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationName"u8)) + { + operationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationType"u8)) + { + operationType = property.Value.GetString(); + continue; + } + } + return new BusinessProcessMappingItem(logicAppResourceId.Value, workflowName.Value, operationName.Value, operationType.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessMappingItem.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessMappingItem.cs new file mode 100644 index 0000000000000..1068f866e8eed --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessMappingItem.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The properties of business process mapping. + public partial class BusinessProcessMappingItem + { + /// Initializes a new instance of BusinessProcessMappingItem. + public BusinessProcessMappingItem() + { + } + + /// Initializes a new instance of BusinessProcessMappingItem. + /// The logic app resource id. + /// The workflow name within the logic app. + /// The operation name. + /// The mapping item operation type of the business process. + internal BusinessProcessMappingItem(string logicAppResourceId, string workflowName, string operationName, string operationType) + { + LogicAppResourceId = logicAppResourceId; + WorkflowName = workflowName; + OperationName = operationName; + OperationType = operationType; + } + + /// The logic app resource id. + public string LogicAppResourceId { get; set; } + /// The workflow name within the logic app. + public string WorkflowName { get; set; } + /// The operation name. + public string OperationName { get; set; } + /// The mapping item operation type of the business process. + public string OperationType { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessPatch.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessPatch.Serialization.cs new file mode 100644 index 0000000000000..0f9a4f0ee90f8 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessPatch.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class BusinessProcessPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(TableName)) + { + writer.WritePropertyName("tableName"u8); + writer.WriteStringValue(TableName); + } + if (Optional.IsDefined(TrackingDataStoreReferenceName)) + { + writer.WritePropertyName("trackingDataStoreReferenceName"u8); + writer.WriteStringValue(TrackingDataStoreReferenceName); + } + if (Optional.IsDefined(Identifier)) + { + writer.WritePropertyName("identifier"u8); + writer.WriteObjectValue(Identifier); + } + if (Optional.IsCollectionDefined(BusinessProcessStages)) + { + writer.WritePropertyName("businessProcessStages"u8); + writer.WriteStartObject(); + foreach (var item in BusinessProcessStages) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(BusinessProcessMapping)) + { + writer.WritePropertyName("businessProcessMapping"u8); + writer.WriteStartObject(); + foreach (var item in BusinessProcessMapping) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessPatch.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessPatch.cs new file mode 100644 index 0000000000000..ca86cef9cedcf --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessPatch.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The type used for update operations of the BusinessProcess. + public partial class BusinessProcessPatch + { + /// Initializes a new instance of BusinessProcessPatch. + public BusinessProcessPatch() + { + BusinessProcessStages = new ChangeTrackingDictionary(); + BusinessProcessMapping = new ChangeTrackingDictionary(); + } + + /// The description of the business process. + public string Description { get; set; } + /// The table name of the business process. + public string TableName { get; set; } + /// The tracking data store reference name. + public string TrackingDataStoreReferenceName { get; set; } + /// The business process identifier. + public BusinessProcessIdentifier Identifier { get; set; } + /// The business process stages. + public IDictionary BusinessProcessStages { get; } + /// The business process mapping. + public IDictionary BusinessProcessMapping { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessReference.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessReference.Serialization.cs new file mode 100644 index 0000000000000..e687a34e319fc --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessReference.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class BusinessProcessReference : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + writer.WriteEndObject(); + } + + internal static BusinessProcessReference DeserializeBusinessProcessReference(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional version = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + } + return new BusinessProcessReference(name.Value, version.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessReference.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessReference.cs new file mode 100644 index 0000000000000..c9a3daa164c71 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessReference.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The business process reference. + public partial class BusinessProcessReference + { + /// Initializes a new instance of BusinessProcessReference. + public BusinessProcessReference() + { + } + + /// Initializes a new instance of BusinessProcessReference. + /// The business process name. + /// The business process version. + internal BusinessProcessReference(string name, string version) + { + Name = name; + Version = version; + } + + /// The business process name. + public string Name { get; set; } + /// The business process version. + public string Version { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessStage.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessStage.Serialization.cs new file mode 100644 index 0000000000000..27d7e9b5f726d --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessStage.Serialization.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class BusinessProcessStage : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + foreach (var item in Properties) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(StagesBefore)) + { + writer.WritePropertyName("stagesBefore"u8); + writer.WriteStartArray(); + foreach (var item in StagesBefore) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static BusinessProcessStage DeserializeBusinessProcessStage(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + Optional> properties = default; + Optional> stagesBefore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"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()); + } + properties = dictionary; + continue; + } + if (property.NameEquals("stagesBefore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + stagesBefore = array; + continue; + } + } + return new BusinessProcessStage(description.Value, Optional.ToDictionary(properties), Optional.ToList(stagesBefore)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessStage.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessStage.cs new file mode 100644 index 0000000000000..ed6f05871d06d --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessStage.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The properties of business process stage. + public partial class BusinessProcessStage + { + /// Initializes a new instance of BusinessProcessStage. + public BusinessProcessStage() + { + Properties = new ChangeTrackingDictionary(); + StagesBefore = new ChangeTrackingList(); + } + + /// Initializes a new instance of BusinessProcessStage. + /// The description of the business stage. + /// The properties within the properties of the business process stage. + /// The property to keep track of stages before current in the business process stage. + internal BusinessProcessStage(string description, IDictionary properties, IList stagesBefore) + { + Description = description; + Properties = properties; + StagesBefore = stagesBefore; + } + + /// The description of the business stage. + public string Description { get; set; } + /// The properties within the properties of the business process stage. + public IDictionary Properties { get; } + /// The property to keep track of stages before current in the business process stage. + public IList StagesBefore { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionCollectionGetAllOptions.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionCollectionGetAllOptions.cs new file mode 100644 index 0000000000000..f137ac15f31dc --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionCollectionGetAllOptions.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The BusinessProcessVersionCollectionGetAllOptions. + public partial class BusinessProcessVersionCollectionGetAllOptions + { + /// Initializes a new instance of BusinessProcessVersionCollectionGetAllOptions. + public BusinessProcessVersionCollectionGetAllOptions() + { + Select = new ChangeTrackingList(); + Expand = new ChangeTrackingList(); + Orderby = new ChangeTrackingList(); + } + + /// The number of result items to return. + public int? Top { get; set; } + /// The number of result items to skip. + public int? Skip { get; set; } + /// The maximum number of result items per page. + public int? Maxpagesize { get; set; } + /// Filter the result list using the given expression. + public string Filter { get; set; } + /// Select the specified fields to be included in the response. + public IList Select { get; } + /// Expand the indicated resources into the response. + public IList Expand { get; } + /// Expressions that specify the order of returned results. + public IList Orderby { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionData.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionData.Serialization.cs new file mode 100644 index 0000000000000..5f61ba9793b09 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionData.Serialization.cs @@ -0,0 +1,195 @@ +// 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.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + public partial class BusinessProcessVersionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(TableName)) + { + writer.WritePropertyName("tableName"u8); + writer.WriteStringValue(TableName); + } + if (Optional.IsDefined(TrackingDataStoreReferenceName)) + { + writer.WritePropertyName("trackingDataStoreReferenceName"u8); + writer.WriteStringValue(TrackingDataStoreReferenceName); + } + if (Optional.IsDefined(Identifier)) + { + writer.WritePropertyName("identifier"u8); + writer.WriteObjectValue(Identifier); + } + if (Optional.IsCollectionDefined(BusinessProcessStages)) + { + writer.WritePropertyName("businessProcessStages"u8); + writer.WriteStartObject(); + foreach (var item in BusinessProcessStages) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(BusinessProcessMapping)) + { + writer.WritePropertyName("businessProcessMapping"u8); + writer.WriteStartObject(); + foreach (var item in BusinessProcessMapping) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static BusinessProcessVersionData DeserializeBusinessProcessVersionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional version = default; + Optional description = default; + Optional tableName = default; + Optional trackingDataStoreReferenceName = default; + Optional identifier = default; + Optional> businessProcessStages = default; + Optional> businessProcessMapping = default; + foreach (var property in element.EnumerateObject()) + { + 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("version"u8)) + { + version = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("tableName"u8)) + { + tableName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("trackingDataStoreReferenceName"u8)) + { + trackingDataStoreReferenceName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("identifier"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identifier = BusinessProcessIdentifier.DeserializeBusinessProcessIdentifier(property0.Value); + continue; + } + if (property0.NameEquals("businessProcessStages"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, BusinessProcessStage.DeserializeBusinessProcessStage(property1.Value)); + } + businessProcessStages = dictionary; + continue; + } + if (property0.NameEquals("businessProcessMapping"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, BusinessProcessMappingItem.DeserializeBusinessProcessMappingItem(property1.Value)); + } + businessProcessMapping = dictionary; + continue; + } + } + continue; + } + } + return new BusinessProcessVersionData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), version.Value, description.Value, tableName.Value, trackingDataStoreReferenceName.Value, identifier.Value, Optional.ToDictionary(businessProcessStages), Optional.ToDictionary(businessProcessMapping)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionListResult.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionListResult.Serialization.cs new file mode 100644 index 0000000000000..ab6a8c219a495 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + internal partial class BusinessProcessVersionListResult + { + internal static BusinessProcessVersionListResult DeserializeBusinessProcessVersionListResult(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(BusinessProcessVersionData.DeserializeBusinessProcessVersionData(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 BusinessProcessVersionListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionListResult.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionListResult.cs new file mode 100644 index 0000000000000..24c2a113af3f1 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/BusinessProcessVersionListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The response of a BusinessProcessVersion list operation. + internal partial class BusinessProcessVersionListResult + { + /// Initializes a new instance of BusinessProcessVersionListResult. + /// The BusinessProcessVersion items on this page. + /// is null. + internal BusinessProcessVersionListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of BusinessProcessVersionListResult. + /// The BusinessProcessVersion items on this page. + /// The link to the next page of items. + internal BusinessProcessVersionListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The BusinessProcessVersion items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/GetOrDeleteBusinessProcessDevelopmentArtifactRequest.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/GetOrDeleteBusinessProcessDevelopmentArtifactRequest.Serialization.cs new file mode 100644 index 0000000000000..d597c82f6608b --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/GetOrDeleteBusinessProcessDevelopmentArtifactRequest.Serialization.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class GetOrDeleteBusinessProcessDevelopmentArtifactRequest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/GetOrDeleteBusinessProcessDevelopmentArtifactRequest.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/GetOrDeleteBusinessProcessDevelopmentArtifactRequest.cs new file mode 100644 index 0000000000000..f80f588dacd7a --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/GetOrDeleteBusinessProcessDevelopmentArtifactRequest.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The business process development artifact get or delete request. + public partial class GetOrDeleteBusinessProcessDevelopmentArtifactRequest + { + /// Initializes a new instance of GetOrDeleteBusinessProcessDevelopmentArtifactRequest. + /// The name of the business process development artifact. + /// is null. + public GetOrDeleteBusinessProcessDevelopmentArtifactRequest(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// The name of the business process development artifact. + public string Name { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceCollectionGetAllOptions.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceCollectionGetAllOptions.cs new file mode 100644 index 0000000000000..fde5da7d68d3e --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceCollectionGetAllOptions.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The InfrastructureResourceCollectionGetAllOptions. + public partial class InfrastructureResourceCollectionGetAllOptions + { + /// Initializes a new instance of InfrastructureResourceCollectionGetAllOptions. + public InfrastructureResourceCollectionGetAllOptions() + { + Select = new ChangeTrackingList(); + Expand = new ChangeTrackingList(); + Orderby = new ChangeTrackingList(); + } + + /// The number of result items to return. + public int? Top { get; set; } + /// The number of result items to skip. + public int? Skip { get; set; } + /// The maximum number of result items per page. + public int? Maxpagesize { get; set; } + /// Filter the result list using the given expression. + public string Filter { get; set; } + /// Select the specified fields to be included in the response. + public IList Select { get; } + /// Expand the indicated resources into the response. + public IList Expand { get; } + /// Expressions that specify the order of returned results. + public IList Orderby { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceData.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceData.Serialization.cs new file mode 100644 index 0000000000000..246a150067057 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceData.Serialization.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + public partial class InfrastructureResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static InfrastructureResourceData DeserializeInfrastructureResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional resourceId = default; + foreach (var property in element.EnumerateObject()) + { + 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("resourceId"u8)) + { + resourceId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new InfrastructureResourceData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), resourceId.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceListResult.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceListResult.Serialization.cs new file mode 100644 index 0000000000000..7293ed077f853 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + internal partial class InfrastructureResourceListResult + { + internal static InfrastructureResourceListResult DeserializeInfrastructureResourceListResult(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(InfrastructureResourceData.DeserializeInfrastructureResourceData(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 InfrastructureResourceListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceListResult.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceListResult.cs new file mode 100644 index 0000000000000..fc742a5d03f9a --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourceListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The response of a InfrastructureResource list operation. + internal partial class InfrastructureResourceListResult + { + /// Initializes a new instance of InfrastructureResourceListResult. + /// The InfrastructureResource items on this page. + /// is null. + internal InfrastructureResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of InfrastructureResourceListResult. + /// The InfrastructureResource items on this page. + /// The link to the next page of items. + internal InfrastructureResourceListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The InfrastructureResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourcePatch.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourcePatch.Serialization.cs new file mode 100644 index 0000000000000..15a2144cf910c --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourcePatch.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class InfrastructureResourcePatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + } + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourcePatch.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourcePatch.cs new file mode 100644 index 0000000000000..79f1226f8f548 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/InfrastructureResourcePatch.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The type used for update operations of the InfrastructureResource. + public partial class InfrastructureResourcePatch + { + /// Initializes a new instance of InfrastructureResourcePatch. + public InfrastructureResourcePatch() + { + } + + /// The type of the infrastructure resource. + public string ResourceType { get; set; } + /// The id of the infrastructure resource. + public string ResourceId { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationCollectionGetAllOptions.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationCollectionGetAllOptions.cs new file mode 100644 index 0000000000000..c74ef82f98c8e --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationCollectionGetAllOptions.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The IntegrationSpaceApplicationCollectionGetAllOptions. + public partial class IntegrationSpaceApplicationCollectionGetAllOptions + { + /// Initializes a new instance of IntegrationSpaceApplicationCollectionGetAllOptions. + public IntegrationSpaceApplicationCollectionGetAllOptions() + { + Select = new ChangeTrackingList(); + Expand = new ChangeTrackingList(); + Orderby = new ChangeTrackingList(); + } + + /// The number of result items to return. + public int? Top { get; set; } + /// The number of result items to skip. + public int? Skip { get; set; } + /// The maximum number of result items per page. + public int? Maxpagesize { get; set; } + /// Filter the result list using the given expression. + public string Filter { get; set; } + /// Select the specified fields to be included in the response. + public IList Select { get; } + /// Expand the indicated resources into the response. + public IList Expand { get; } + /// Expressions that specify the order of returned results. + public IList Orderby { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationData.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationData.Serialization.cs new file mode 100644 index 0000000000000..fa7fa33c3ec8e --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationData.Serialization.cs @@ -0,0 +1,160 @@ +// 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.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + public partial class IntegrationSpaceApplicationData : 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(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(TrackingDataStores)) + { + writer.WritePropertyName("trackingDataStores"u8); + writer.WriteStartObject(); + foreach (var item in TrackingDataStores) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static IntegrationSpaceApplicationData DeserializeIntegrationSpaceApplicationData(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 description = default; + Optional> trackingDataStores = 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("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("trackingDataStores"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, TrackingDataStore.DeserializeTrackingDataStore(property1.Value)); + } + trackingDataStores = dictionary; + continue; + } + } + continue; + } + } + return new IntegrationSpaceApplicationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), description.Value, Optional.ToDictionary(trackingDataStores)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationPatch.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationPatch.Serialization.cs new file mode 100644 index 0000000000000..b986d99f85fea --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationPatch.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class IntegrationSpaceApplicationPatch : 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(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(TrackingDataStores)) + { + writer.WritePropertyName("trackingDataStores"u8); + writer.WriteStartObject(); + foreach (var item in TrackingDataStores) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationPatch.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationPatch.cs new file mode 100644 index 0000000000000..d9877e929ac77 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceApplicationPatch.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The type used for update operations of the Application. + public partial class IntegrationSpaceApplicationPatch + { + /// Initializes a new instance of IntegrationSpaceApplicationPatch. + public IntegrationSpaceApplicationPatch() + { + Tags = new ChangeTrackingDictionary(); + TrackingDataStores = new ChangeTrackingDictionary(); + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The description of the resource. + public string Description { get; set; } + /// The tracking data stores. + public IDictionary TrackingDataStores { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourceCollectionGetAllOptions.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourceCollectionGetAllOptions.cs new file mode 100644 index 0000000000000..bdff731444571 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourceCollectionGetAllOptions.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The IntegrationSpaceResourceCollectionGetAllOptions. + public partial class IntegrationSpaceResourceCollectionGetAllOptions + { + /// Initializes a new instance of IntegrationSpaceResourceCollectionGetAllOptions. + public IntegrationSpaceResourceCollectionGetAllOptions() + { + Select = new ChangeTrackingList(); + Expand = new ChangeTrackingList(); + Orderby = new ChangeTrackingList(); + } + + /// The number of result items to return. + public int? Top { get; set; } + /// The number of result items to skip. + public int? Skip { get; set; } + /// The maximum number of result items per page. + public int? Maxpagesize { get; set; } + /// Filter the result list using the given expression. + public string Filter { get; set; } + /// Select the specified fields to be included in the response. + public IList Select { get; } + /// Expand the indicated resources into the response. + public IList Expand { get; } + /// Expressions that specify the order of returned results. + public IList Orderby { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourceData.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourceData.Serialization.cs new file mode 100644 index 0000000000000..b185bf2cfab08 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourceData.Serialization.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + public partial class IntegrationSpaceResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(ResourceKind)) + { + writer.WritePropertyName("resourceKind"u8); + writer.WriteStringValue(ResourceKind); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static IntegrationSpaceResourceData DeserializeIntegrationSpaceResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional resourceId = default; + Optional resourceKind = default; + foreach (var property in element.EnumerateObject()) + { + 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("resourceId"u8)) + { + resourceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("resourceKind"u8)) + { + resourceKind = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new IntegrationSpaceResourceData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), resourceId.Value, resourceKind.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourcePatch.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourcePatch.Serialization.cs new file mode 100644 index 0000000000000..45a942777b1b1 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourcePatch.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class IntegrationSpaceResourcePatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + } + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(ResourceKind)) + { + writer.WritePropertyName("resourceKind"u8); + writer.WriteStringValue(ResourceKind); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourcePatch.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourcePatch.cs new file mode 100644 index 0000000000000..4078cf886c69a --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/IntegrationSpaceResourcePatch.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The type used for update operations of the ApplicationResource. + public partial class IntegrationSpaceResourcePatch + { + /// Initializes a new instance of IntegrationSpaceResourcePatch. + public IntegrationSpaceResourcePatch() + { + } + + /// The type of the application resource. + public string ResourceType { get; set; } + /// The Arm id of the application resource. + public string ResourceId { get; set; } + /// The kind of the application resource. + public string ResourceKind { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ProvisioningState.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..b495e2ecf6760 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The status of the current operation. + 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 UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Provisioning. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// Updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// 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/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SaveOrValidateBusinessProcessDevelopmentArtifactRequest.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SaveOrValidateBusinessProcessDevelopmentArtifactRequest.Serialization.cs new file mode 100644 index 0000000000000..61a3abccba4e6 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SaveOrValidateBusinessProcessDevelopmentArtifactRequest.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class SaveOrValidateBusinessProcessDevelopmentArtifactRequest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SaveOrValidateBusinessProcessDevelopmentArtifactRequest.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SaveOrValidateBusinessProcessDevelopmentArtifactRequest.cs new file mode 100644 index 0000000000000..d09d61c4284a4 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SaveOrValidateBusinessProcessDevelopmentArtifactRequest.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The business process development artifact save or validate request. + public partial class SaveOrValidateBusinessProcessDevelopmentArtifactRequest + { + /// Initializes a new instance of SaveOrValidateBusinessProcessDevelopmentArtifactRequest. + /// The name of the business process development artifact. + /// is null. + public SaveOrValidateBusinessProcessDevelopmentArtifactRequest(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// The name of the business process development artifact. + public string Name { get; } + /// The properties of the business process development artifact. + public BusinessProcessDevelopmentArtifactProperties Properties { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceCollectionGetAllOptions.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceCollectionGetAllOptions.cs new file mode 100644 index 0000000000000..1e4f75fd3c367 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceCollectionGetAllOptions.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The SpaceCollectionGetAllOptions. + public partial class SpaceCollectionGetAllOptions + { + /// Initializes a new instance of SpaceCollectionGetAllOptions. + public SpaceCollectionGetAllOptions() + { + Select = new ChangeTrackingList(); + Expand = new ChangeTrackingList(); + Orderby = new ChangeTrackingList(); + } + + /// The number of result items to return. + public int? Top { get; set; } + /// The number of result items to skip. + public int? Skip { get; set; } + /// The maximum number of result items per page. + public int? Maxpagesize { get; set; } + /// Filter the result list using the given expression. + public string Filter { get; set; } + /// Select the specified fields to be included in the response. + public IList Select { get; } + /// Expand the indicated resources into the response. + public IList Expand { get; } + /// Expressions that specify the order of returned results. + public IList Orderby { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceData.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceData.Serialization.cs new file mode 100644 index 0000000000000..895689f8d231d --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceData.Serialization.cs @@ -0,0 +1,134 @@ +// 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.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + public partial class SpaceData : 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(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SpaceData DeserializeSpaceData(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 description = 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("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new SpaceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), description.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceListResult.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceListResult.Serialization.cs new file mode 100644 index 0000000000000..8bbef82a7b219 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + internal partial class SpaceListResult + { + internal static SpaceListResult DeserializeSpaceListResult(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(SpaceData.DeserializeSpaceData(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 SpaceListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceListResult.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceListResult.cs new file mode 100644 index 0000000000000..bfeb7b20d47b3 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpaceListResult.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.IntegrationSpaces; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The response of a Space list operation. + internal partial class SpaceListResult + { + /// Initializes a new instance of SpaceListResult. + /// The Space items on this page. + /// is null. + internal SpaceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of SpaceListResult. + /// The Space items on this page. + /// The link to the next page of items. + internal SpaceListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The Space items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpacePatch.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpacePatch.Serialization.cs new file mode 100644 index 0000000000000..89f5d8041a3b2 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpacePatch.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.IntegrationSpaces.Models +{ + public partial class SpacePatch : 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(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpacePatch.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpacePatch.cs new file mode 100644 index 0000000000000..b1e5036c52181 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/SpacePatch.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The type used for update operations of the Space. + public partial class SpacePatch + { + /// Initializes a new instance of SpacePatch. + public SpacePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The description of the resource. + public string Description { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingCorrelationContext.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingCorrelationContext.Serialization.cs new file mode 100644 index 0000000000000..495578d879354 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingCorrelationContext.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class TrackingCorrelationContext : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(OperationType)) + { + writer.WritePropertyName("operationType"u8); + writer.WriteStringValue(OperationType); + } + if (Optional.IsDefined(OperationName)) + { + writer.WritePropertyName("operationName"u8); + writer.WriteStringValue(OperationName); + } + if (Optional.IsDefined(PropertyName)) + { + writer.WritePropertyName("propertyName"u8); + writer.WriteStringValue(PropertyName); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WriteEndObject(); + } + + internal static TrackingCorrelationContext DeserializeTrackingCorrelationContext(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional operationType = default; + Optional operationName = default; + Optional propertyName = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operationType"u8)) + { + operationType = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationName"u8)) + { + operationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("propertyName"u8)) + { + propertyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + } + return new TrackingCorrelationContext(operationType.Value, operationName.Value, propertyName.Value, value.Value); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingCorrelationContext.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingCorrelationContext.cs new file mode 100644 index 0000000000000..ddd7ea837c071 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingCorrelationContext.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The tracking correlation context. + public partial class TrackingCorrelationContext + { + /// Initializes a new instance of TrackingCorrelationContext. + public TrackingCorrelationContext() + { + } + + /// Initializes a new instance of TrackingCorrelationContext. + /// The operation type for correlation context. + /// The operation name for correlation context. + /// The name of the correlation property. + /// The template expression for correlation context property value. + internal TrackingCorrelationContext(string operationType, string operationName, string propertyName, string value) + { + OperationType = operationType; + OperationName = operationName; + PropertyName = propertyName; + Value = value; + } + + /// The operation type for correlation context. + public string OperationType { get; set; } + /// The operation name for correlation context. + public string OperationName { get; set; } + /// The name of the correlation property. + public string PropertyName { get; set; } + /// The template expression for correlation context property value. + public string Value { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingDataStore.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingDataStore.Serialization.cs new file mode 100644 index 0000000000000..b8df812e2f54d --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingDataStore.Serialization.cs @@ -0,0 +1,66 @@ +// 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.IntegrationSpaces.Models +{ + public partial class TrackingDataStore : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("databaseName"u8); + writer.WriteStringValue(DatabaseName); + writer.WritePropertyName("dataStoreResourceId"u8); + writer.WriteStringValue(DataStoreResourceId); + writer.WritePropertyName("dataStoreUri"u8); + writer.WriteStringValue(DataStoreUri.AbsoluteUri); + writer.WritePropertyName("dataStoreIngestionUri"u8); + writer.WriteStringValue(DataStoreIngestionUri.AbsoluteUri); + writer.WriteEndObject(); + } + + internal static TrackingDataStore DeserializeTrackingDataStore(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string databaseName = default; + string dataStoreResourceId = default; + Uri dataStoreUri = default; + Uri dataStoreIngestionUri = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("databaseName"u8)) + { + databaseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataStoreResourceId"u8)) + { + dataStoreResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataStoreUri"u8)) + { + dataStoreUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataStoreIngestionUri"u8)) + { + dataStoreIngestionUri = new Uri(property.Value.GetString()); + continue; + } + } + return new TrackingDataStore(databaseName, dataStoreResourceId, dataStoreUri, dataStoreIngestionUri); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingDataStore.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingDataStore.cs new file mode 100644 index 0000000000000..b1c3459de772b --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingDataStore.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The properties of tracking data store. + public partial class TrackingDataStore + { + /// Initializes a new instance of TrackingDataStore. + /// The database name. + /// The data store resource id. + /// The data store URI. + /// The data store ingestion URI. + /// , , or is null. + public TrackingDataStore(string databaseName, string dataStoreResourceId, Uri dataStoreUri, Uri dataStoreIngestionUri) + { + Argument.AssertNotNull(databaseName, nameof(databaseName)); + Argument.AssertNotNull(dataStoreResourceId, nameof(dataStoreResourceId)); + Argument.AssertNotNull(dataStoreUri, nameof(dataStoreUri)); + Argument.AssertNotNull(dataStoreIngestionUri, nameof(dataStoreIngestionUri)); + + DatabaseName = databaseName; + DataStoreResourceId = dataStoreResourceId; + DataStoreUri = dataStoreUri; + DataStoreIngestionUri = dataStoreIngestionUri; + } + + /// The database name. + public string DatabaseName { get; set; } + /// The data store resource id. + public string DataStoreResourceId { get; set; } + /// The data store URI. + public Uri DataStoreUri { get; set; } + /// The data store ingestion URI. + public Uri DataStoreIngestionUri { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingEvent.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingEvent.Serialization.cs new file mode 100644 index 0000000000000..49206cf76e504 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingEvent.Serialization.cs @@ -0,0 +1,102 @@ +// 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; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class TrackingEvent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(OperationType)) + { + writer.WritePropertyName("operationType"u8); + writer.WriteStringValue(OperationType); + } + if (Optional.IsDefined(OperationName)) + { + writer.WritePropertyName("operationName"u8); + writer.WriteStringValue(OperationName); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + foreach (var item in Properties) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static TrackingEvent DeserializeTrackingEvent(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional operationType = default; + Optional operationName = default; + Optional> properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operationType"u8)) + { + operationType = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationName"u8)) + { + operationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + properties = dictionary; + continue; + } + } + return new TrackingEvent(operationType.Value, operationName.Value, Optional.ToDictionary(properties)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingEvent.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingEvent.cs new file mode 100644 index 0000000000000..4f6df22133c91 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingEvent.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The tracking event definition. + public partial class TrackingEvent + { + /// Initializes a new instance of TrackingEvent. + public TrackingEvent() + { + Properties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of TrackingEvent. + /// The operation type. + /// The operation name. + /// The properties to be collected for event. + internal TrackingEvent(string operationType, string operationName, IDictionary properties) + { + OperationType = operationType; + OperationName = operationName; + Properties = properties; + } + + /// The operation type. + public string OperationType { get; set; } + /// The operation name. + public string OperationName { get; set; } + /// + /// The properties to be collected for event. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IDictionary Properties { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingProfile.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingProfile.Serialization.cs new file mode 100644 index 0000000000000..4ca79764a2f4a --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingProfile.Serialization.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class TrackingProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Schema)) + { + writer.WritePropertyName("$schema"u8); + writer.WriteStringValue(Schema); + } + if (Optional.IsDefined(BusinessProcess)) + { + writer.WritePropertyName("businessProcess"u8); + writer.WriteObjectValue(BusinessProcess); + } + if (Optional.IsCollectionDefined(TrackingDefinitions)) + { + writer.WritePropertyName("trackingDefinitions"u8); + writer.WriteStartObject(); + foreach (var item in TrackingDefinitions) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static TrackingProfile DeserializeTrackingProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional schema = default; + Optional businessProcess = default; + Optional> trackingDefinitions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("$schema"u8)) + { + schema = property.Value.GetString(); + continue; + } + if (property.NameEquals("businessProcess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + businessProcess = BusinessProcessReference.DeserializeBusinessProcessReference(property.Value); + continue; + } + if (property.NameEquals("trackingDefinitions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, WorkflowTracking.DeserializeWorkflowTracking(property0.Value)); + } + trackingDefinitions = dictionary; + continue; + } + } + return new TrackingProfile(schema.Value, businessProcess.Value, Optional.ToDictionary(trackingDefinitions)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingProfile.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingProfile.cs new file mode 100644 index 0000000000000..b0a5070f43fb6 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/TrackingProfile.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The tracking profile for the business process. + public partial class TrackingProfile + { + /// Initializes a new instance of TrackingProfile. + public TrackingProfile() + { + TrackingDefinitions = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of TrackingProfile. + /// The tracking definition schema uri. + /// The business process reference. + /// The tracking definitions. + internal TrackingProfile(string schema, BusinessProcessReference businessProcess, IDictionary trackingDefinitions) + { + Schema = schema; + BusinessProcess = businessProcess; + TrackingDefinitions = trackingDefinitions; + } + + /// The tracking definition schema uri. + public string Schema { get; set; } + /// The business process reference. + public BusinessProcessReference BusinessProcess { get; set; } + /// The tracking definitions. + public IDictionary TrackingDefinitions { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/WorkflowTracking.Serialization.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/WorkflowTracking.Serialization.cs new file mode 100644 index 0000000000000..6685e73dd9007 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/WorkflowTracking.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + public partial class WorkflowTracking : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CorrelationContext)) + { + writer.WritePropertyName("correlationContext"u8); + writer.WriteObjectValue(CorrelationContext); + } + if (Optional.IsCollectionDefined(Events)) + { + writer.WritePropertyName("events"u8); + writer.WriteStartObject(); + foreach (var item in Events) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static WorkflowTracking DeserializeWorkflowTracking(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional correlationContext = default; + Optional> events = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("correlationContext"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + correlationContext = TrackingCorrelationContext.DeserializeTrackingCorrelationContext(property.Value); + continue; + } + if (property.NameEquals("events"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, TrackingEvent.DeserializeTrackingEvent(property0.Value)); + } + events = dictionary; + continue; + } + } + return new WorkflowTracking(correlationContext.Value, Optional.ToDictionary(events)); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/WorkflowTracking.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/WorkflowTracking.cs new file mode 100644 index 0000000000000..727b37001c7f7 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/Models/WorkflowTracking.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IntegrationSpaces.Models +{ + /// The workflow tracking definition. + public partial class WorkflowTracking + { + /// Initializes a new instance of WorkflowTracking. + public WorkflowTracking() + { + Events = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of WorkflowTracking. + /// The tracking correlation context. + /// The tracking events. + internal WorkflowTracking(TrackingCorrelationContext correlationContext, IDictionary events) + { + CorrelationContext = correlationContext; + Events = events; + } + + /// The tracking correlation context. + public TrackingCorrelationContext CorrelationContext { get; set; } + /// The tracking events. + public IDictionary Events { get; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/ProviderConstants.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/ProviderConstants.cs new file mode 100644 index 0000000000000..62a3d8dc53773 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/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.IntegrationSpaces +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/ApplicationResourcesRestOperations.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/ApplicationResourcesRestOperations.cs new file mode 100644 index 0000000000000..56b6f8a157b6f --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/ApplicationResourcesRestOperations.cs @@ -0,0 +1,645 @@ +// 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 System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + internal partial class ApplicationResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ApplicationResourcesRestOperations. + /// 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 ApplicationResourcesRestOperations(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-11-14-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApplicationRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/resources", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (select != null && Optional.IsCollectionDefined(select)) + { + foreach (var param in select) + { + uri.AppendQuery("select", param, true); + } + } + if (expand != null && Optional.IsCollectionDefined(expand)) + { + foreach (var param in expand) + { + uri.AppendQuery("expand", param, true); + } + } + if (orderby != null && Optional.IsCollectionDefined(orderby)) + { + foreach (var param in orderby) + { + uri.AppendQuery("orderby", param, true); + } + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List ApplicationResource resources by Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApplicationAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListByApplicationRequest(subscriptionId, resourceGroupName, spaceName, applicationName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApplicationResourceListResult.DeserializeApplicationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ApplicationResource resources by Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApplication(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListByApplicationRequest(subscriptionId, resourceGroupName, spaceName, applicationName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApplicationResourceListResult.DeserializeApplicationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string resourceName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/resources/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a ApplicationResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the application 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 spaceName, string applicationName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IntegrationSpaceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((IntegrationSpaceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a ApplicationResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the application 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 spaceName, string applicationName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IntegrationSpaceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((IntegrationSpaceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string resourceName, IntegrationSpaceResourceData 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/resources/", false); + uri.AppendPath(resourceName, 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 ApplicationResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the application 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 spaceName, string applicationName, string resourceName, IntegrationSpaceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + IntegrationSpaceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a ApplicationResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the application 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 spaceName, string applicationName, string resourceName, IntegrationSpaceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + IntegrationSpaceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string resourceName, IntegrationSpaceResourcePatch 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/resources/", false); + uri.AppendPath(resourceName, 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 ApplicationResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the application 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> PatchAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string resourceName, IntegrationSpaceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IntegrationSpaceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a ApplicationResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the application 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 Patch(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string resourceName, IntegrationSpaceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IntegrationSpaceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IntegrationSpaceResourceData.DeserializeIntegrationSpaceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string resourceName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/resources/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a ApplicationResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the application 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 spaceName, string applicationName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a ApplicationResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the application 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 spaceName, string applicationName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName, applicationName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApplicationNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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 ApplicationResource resources by Application. + /// 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 name of the space. + /// The name of the Application. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApplicationNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListByApplicationNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, applicationName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApplicationResourceListResult.DeserializeApplicationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ApplicationResource resources by Application. + /// 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 name of the space. + /// The name of the Application. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApplicationNextPage(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListByApplicationNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, applicationName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApplicationResourceListResult.DeserializeApplicationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/ApplicationsRestOperations.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/ApplicationsRestOperations.cs new file mode 100644 index 0000000000000..b3c8e66d9f4c0 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/ApplicationsRestOperations.cs @@ -0,0 +1,1048 @@ +// 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 System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + internal partial class ApplicationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ApplicationsRestOperations. + /// 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 ApplicationsRestOperations(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-11-14-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListBySpaceRequest(string subscriptionId, string resourceGroupName, string spaceName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (select != null && Optional.IsCollectionDefined(select)) + { + foreach (var param in select) + { + uri.AppendQuery("select", param, true); + } + } + if (expand != null && Optional.IsCollectionDefined(expand)) + { + foreach (var param in expand) + { + uri.AppendQuery("expand", param, true); + } + } + if (orderby != null && Optional.IsCollectionDefined(orderby)) + { + foreach (var param in orderby) + { + uri.AppendQuery("orderby", param, true); + } + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Application resources by Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySpaceAsync(string subscriptionId, string resourceGroupName, string spaceName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateListBySpaceRequest(subscriptionId, resourceGroupName, spaceName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Application resources by Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListBySpace(string subscriptionId, string resourceGroupName, string spaceName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateListBySpaceRequest(subscriptionId, resourceGroupName, spaceName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// 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 spaceName, string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, applicationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IntegrationSpaceApplicationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((IntegrationSpaceApplicationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// 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 spaceName, string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, applicationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IntegrationSpaceApplicationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((IntegrationSpaceApplicationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, IntegrationSpaceApplicationData 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, 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 Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// 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 spaceName, string applicationName, IntegrationSpaceApplicationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, applicationName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + IntegrationSpaceApplicationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// 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 spaceName, string applicationName, IntegrationSpaceApplicationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, applicationName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + IntegrationSpaceApplicationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, IntegrationSpaceApplicationPatch 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, 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 Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// 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> PatchAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, IntegrationSpaceApplicationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, applicationName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IntegrationSpaceApplicationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// 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 Patch(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, IntegrationSpaceApplicationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, applicationName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IntegrationSpaceApplicationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = IntegrationSpaceApplicationData.DeserializeIntegrationSpaceApplicationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// 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 spaceName, string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName, applicationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// 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 spaceName, string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName, applicationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteBusinessProcessDevelopmentArtifactRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, GetOrDeleteBusinessProcessDevelopmentArtifactRequest body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/deleteBusinessProcessDevelopmentArtifact", false); + 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(body); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// The delete business process development artifact action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The content of the action request. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteBusinessProcessDevelopmentArtifactAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, GetOrDeleteBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateDeleteBusinessProcessDevelopmentArtifactRequest(subscriptionId, resourceGroupName, spaceName, applicationName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// The delete business process development artifact action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The content of the action request. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DeleteBusinessProcessDevelopmentArtifact(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, GetOrDeleteBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateDeleteBusinessProcessDevelopmentArtifactRequest(subscriptionId, resourceGroupName, spaceName, applicationName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetBusinessProcessDevelopmentArtifactRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, GetOrDeleteBusinessProcessDevelopmentArtifactRequest body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/getBusinessProcessDevelopmentArtifact", false); + 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(body); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// The get business process development artifact action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The content of the action request. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetBusinessProcessDevelopmentArtifactAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, GetOrDeleteBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateGetBusinessProcessDevelopmentArtifactRequest(subscriptionId, resourceGroupName, spaceName, applicationName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessDevelopmentArtifactResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessDevelopmentArtifactResult.DeserializeBusinessProcessDevelopmentArtifactResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// The get business process development artifact action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The content of the action request. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetBusinessProcessDevelopmentArtifact(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, GetOrDeleteBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateGetBusinessProcessDevelopmentArtifactRequest(subscriptionId, resourceGroupName, spaceName, applicationName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessDevelopmentArtifactResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessDevelopmentArtifactResult.DeserializeBusinessProcessDevelopmentArtifactResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBusinessProcessDevelopmentArtifactsRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/listBusinessProcessDevelopmentArtifacts", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// The list business process development artifacts action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListBusinessProcessDevelopmentArtifactsAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListBusinessProcessDevelopmentArtifactsRequest(subscriptionId, resourceGroupName, spaceName, applicationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessDevelopmentArtifactListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessDevelopmentArtifactListResult.DeserializeBusinessProcessDevelopmentArtifactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// The list business process development artifacts action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListBusinessProcessDevelopmentArtifacts(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListBusinessProcessDevelopmentArtifactsRequest(subscriptionId, resourceGroupName, spaceName, applicationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessDevelopmentArtifactListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessDevelopmentArtifactListResult.DeserializeBusinessProcessDevelopmentArtifactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateSaveBusinessProcessDevelopmentArtifactRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, SaveOrValidateBusinessProcessDevelopmentArtifactRequest body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/saveBusinessProcessDevelopmentArtifact", false); + 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(body); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// The save business process development artifact action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The content of the action request. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> SaveBusinessProcessDevelopmentArtifactAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, SaveOrValidateBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateSaveBusinessProcessDevelopmentArtifactRequest(subscriptionId, resourceGroupName, spaceName, applicationName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessDevelopmentArtifactResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessDevelopmentArtifactResult.DeserializeBusinessProcessDevelopmentArtifactResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// The save business process development artifact action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The content of the action request. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response SaveBusinessProcessDevelopmentArtifact(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, SaveOrValidateBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateSaveBusinessProcessDevelopmentArtifactRequest(subscriptionId, resourceGroupName, spaceName, applicationName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessDevelopmentArtifactResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessDevelopmentArtifactResult.DeserializeBusinessProcessDevelopmentArtifactResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateValidateBusinessProcessDevelopmentArtifactRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, SaveOrValidateBusinessProcessDevelopmentArtifactRequest body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/validateBusinessProcessDevelopmentArtifact", false); + 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(body); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// The validate business process development artifact action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The content of the action request. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task ValidateBusinessProcessDevelopmentArtifactAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, SaveOrValidateBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateValidateBusinessProcessDevelopmentArtifactRequest(subscriptionId, resourceGroupName, spaceName, applicationName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// The validate business process development artifact action. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The content of the action request. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ValidateBusinessProcessDevelopmentArtifact(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, SaveOrValidateBusinessProcessDevelopmentArtifactRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateValidateBusinessProcessDevelopmentArtifactRequest(subscriptionId, resourceGroupName, spaceName, applicationName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySpaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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 Application resources by Space. + /// 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 name of the space. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySpaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateListBySpaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Application resources by Space. + /// 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 name of the space. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListBySpaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateListBySpaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ApplicationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/BusinessProcessVersionsRestOperations.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/BusinessProcessVersionsRestOperations.cs new file mode 100644 index 0000000000000..3513cb3cfdae5 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/BusinessProcessVersionsRestOperations.cs @@ -0,0 +1,381 @@ +// 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 System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + internal partial class BusinessProcessVersionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of BusinessProcessVersionsRestOperations. + /// 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 BusinessProcessVersionsRestOperations(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-11-14-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByBusinessProcessRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/businessProcesses/", false); + uri.AppendPath(businessProcessName, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (select != null && Optional.IsCollectionDefined(select)) + { + foreach (var param in select) + { + uri.AppendQuery("select", param, true); + } + } + if (expand != null && Optional.IsCollectionDefined(expand)) + { + foreach (var param in expand) + { + uri.AppendQuery("expand", param, true); + } + } + if (orderby != null && Optional.IsCollectionDefined(orderby)) + { + foreach (var param in orderby) + { + uri.AppendQuery("orderby", param, true); + } + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BusinessProcessVersion resources by BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByBusinessProcessAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var message = CreateListByBusinessProcessRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessVersionListResult.DeserializeBusinessProcessVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BusinessProcessVersion resources by BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByBusinessProcess(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var message = CreateListByBusinessProcessRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessVersionListResult.DeserializeBusinessProcessVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, string businessProcessVersion) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/businessProcesses/", false); + uri.AppendPath(businessProcessName, true); + uri.AppendPath("/versions/", false); + uri.AppendPath(businessProcessVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a BusinessProcessVersion. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// The version of the business process. + /// 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 spaceName, string applicationName, string businessProcessName, string businessProcessVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + Argument.AssertNotNullOrEmpty(businessProcessVersion, nameof(businessProcessVersion)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, businessProcessVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessVersionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessVersionData.DeserializeBusinessProcessVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BusinessProcessVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a BusinessProcessVersion. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// The version of the business process. + /// 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 spaceName, string applicationName, string businessProcessName, string businessProcessVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + Argument.AssertNotNullOrEmpty(businessProcessVersion, nameof(businessProcessVersion)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, businessProcessVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessVersionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessVersionData.DeserializeBusinessProcessVersionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BusinessProcessVersionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByBusinessProcessNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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 BusinessProcessVersion resources by BusinessProcess. + /// 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 name of the space. + /// The name of the Application. + /// The name of the business process. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> ListByBusinessProcessNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var message = CreateListByBusinessProcessNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessVersionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessVersionListResult.DeserializeBusinessProcessVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BusinessProcessVersion resources by BusinessProcess. + /// 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 name of the space. + /// The name of the Application. + /// The name of the business process. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response ListByBusinessProcessNextPage(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var message = CreateListByBusinessProcessNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessVersionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessVersionListResult.DeserializeBusinessProcessVersionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/BusinessProcessesRestOperations.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/BusinessProcessesRestOperations.cs new file mode 100644 index 0000000000000..19bd94cfda17d --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/BusinessProcessesRestOperations.cs @@ -0,0 +1,645 @@ +// 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 System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + internal partial class BusinessProcessesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of BusinessProcessesRestOperations. + /// 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 BusinessProcessesRestOperations(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-11-14-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByApplicationRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/businessProcesses", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (select != null && Optional.IsCollectionDefined(select)) + { + foreach (var param in select) + { + uri.AppendQuery("select", param, true); + } + } + if (expand != null && Optional.IsCollectionDefined(expand)) + { + foreach (var param in expand) + { + uri.AppendQuery("expand", param, true); + } + } + if (orderby != null && Optional.IsCollectionDefined(orderby)) + { + foreach (var param in orderby) + { + uri.AppendQuery("orderby", param, true); + } + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BusinessProcess resources by Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApplicationAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListByApplicationRequest(subscriptionId, resourceGroupName, spaceName, applicationName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessListResult.DeserializeBusinessProcessListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BusinessProcess resources by Application. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApplication(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListByApplicationRequest(subscriptionId, resourceGroupName, spaceName, applicationName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessListResult.DeserializeBusinessProcessListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/businessProcesses/", false); + uri.AppendPath(businessProcessName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// 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 spaceName, string applicationName, string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessData.DeserializeBusinessProcessData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BusinessProcessData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// 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 spaceName, string applicationName, string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessData.DeserializeBusinessProcessData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BusinessProcessData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, BusinessProcessData 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/businessProcesses/", false); + uri.AppendPath(businessProcessName, 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 BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// 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 spaceName, string applicationName, string businessProcessName, BusinessProcessData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + BusinessProcessData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessData.DeserializeBusinessProcessData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// 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 spaceName, string applicationName, string businessProcessName, BusinessProcessData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + BusinessProcessData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessData.DeserializeBusinessProcessData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, BusinessProcessPatch 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/businessProcesses/", false); + uri.AppendPath(businessProcessName, 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 BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// 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> PatchAsync(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, BusinessProcessPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessData.DeserializeBusinessProcessData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// 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 Patch(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName, BusinessProcessPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessData.DeserializeBusinessProcessData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string spaceName, string applicationName, string businessProcessName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); + uri.AppendPath("/businessProcesses/", false); + uri.AppendPath(businessProcessName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// 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 spaceName, string applicationName, string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a BusinessProcess. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the Application. + /// The name of the business process. + /// 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 spaceName, string applicationName, string businessProcessName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNullOrEmpty(businessProcessName, nameof(businessProcessName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName, applicationName, businessProcessName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByApplicationNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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 BusinessProcess resources by Application. + /// 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 name of the space. + /// The name of the Application. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByApplicationNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListByApplicationNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, applicationName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BusinessProcessListResult.DeserializeBusinessProcessListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BusinessProcess resources by Application. + /// 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 name of the space. + /// The name of the Application. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByApplicationNextPage(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, string applicationName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + + using var message = CreateListByApplicationNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, applicationName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BusinessProcessListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BusinessProcessListResult.DeserializeBusinessProcessListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/InfrastructureResourcesRestOperations.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/InfrastructureResourcesRestOperations.cs new file mode 100644 index 0000000000000..776be10031bbe --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/InfrastructureResourcesRestOperations.cs @@ -0,0 +1,611 @@ +// 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 System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + internal partial class InfrastructureResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of InfrastructureResourcesRestOperations. + /// 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 InfrastructureResourcesRestOperations(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-11-14-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListBySpaceRequest(string subscriptionId, string resourceGroupName, string spaceName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/infrastructureResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (select != null && Optional.IsCollectionDefined(select)) + { + foreach (var param in select) + { + uri.AppendQuery("select", param, true); + } + } + if (expand != null && Optional.IsCollectionDefined(expand)) + { + foreach (var param in expand) + { + uri.AppendQuery("expand", param, true); + } + } + if (orderby != null && Optional.IsCollectionDefined(orderby)) + { + foreach (var param in orderby) + { + uri.AppendQuery("orderby", param, true); + } + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List InfrastructureResource resources by Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySpaceAsync(string subscriptionId, string resourceGroupName, string spaceName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateListBySpaceRequest(subscriptionId, resourceGroupName, spaceName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InfrastructureResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InfrastructureResourceListResult.DeserializeInfrastructureResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InfrastructureResource resources by Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListBySpace(string subscriptionId, string resourceGroupName, string spaceName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateListBySpaceRequest(subscriptionId, resourceGroupName, spaceName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InfrastructureResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InfrastructureResourceListResult.DeserializeInfrastructureResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string spaceName, string infrastructureResourceName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/infrastructureResources/", false); + uri.AppendPath(infrastructureResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a InfrastructureResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the infrastructure resource in the space. + /// 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 spaceName, string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InfrastructureResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InfrastructureResourceData.DeserializeInfrastructureResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InfrastructureResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a InfrastructureResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the infrastructure resource in the space. + /// 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 spaceName, string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InfrastructureResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InfrastructureResourceData.DeserializeInfrastructureResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InfrastructureResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string spaceName, string infrastructureResourceName, InfrastructureResourceData 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/infrastructureResources/", false); + uri.AppendPath(infrastructureResourceName, 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 InfrastructureResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the infrastructure resource in the space. + /// 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 spaceName, string infrastructureResourceName, InfrastructureResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + InfrastructureResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InfrastructureResourceData.DeserializeInfrastructureResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a InfrastructureResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the infrastructure resource in the space. + /// 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 spaceName, string infrastructureResourceName, InfrastructureResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + InfrastructureResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InfrastructureResourceData.DeserializeInfrastructureResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGroupName, string spaceName, string infrastructureResourceName, InfrastructureResourcePatch 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/infrastructureResources/", false); + uri.AppendPath(infrastructureResourceName, 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 InfrastructureResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the infrastructure resource in the space. + /// 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> PatchAsync(string subscriptionId, string resourceGroupName, string spaceName, string infrastructureResourceName, InfrastructureResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InfrastructureResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InfrastructureResourceData.DeserializeInfrastructureResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a InfrastructureResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the infrastructure resource in the space. + /// 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 Patch(string subscriptionId, string resourceGroupName, string spaceName, string infrastructureResourceName, InfrastructureResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InfrastructureResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InfrastructureResourceData.DeserializeInfrastructureResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string spaceName, string infrastructureResourceName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendPath("/infrastructureResources/", false); + uri.AppendPath(infrastructureResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a InfrastructureResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the infrastructure resource in the space. + /// 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 spaceName, string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a InfrastructureResource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// The name of the infrastructure resource in the space. + /// 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 spaceName, string infrastructureResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNullOrEmpty(infrastructureResourceName, nameof(infrastructureResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName, infrastructureResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySpaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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 InfrastructureResource resources by Space. + /// 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 name of the space. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySpaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateListBySpaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InfrastructureResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InfrastructureResourceListResult.DeserializeInfrastructureResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InfrastructureResource resources by Space. + /// 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 name of the space. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListBySpaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string spaceName, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateListBySpaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, spaceName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InfrastructureResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InfrastructureResourceListResult.DeserializeInfrastructureResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/SpacesRestOperations.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/SpacesRestOperations.cs new file mode 100644 index 0000000000000..9319da6ac1dd2 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/RestOperations/SpacesRestOperations.cs @@ -0,0 +1,712 @@ +// 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 System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IntegrationSpaces.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + internal partial class SpacesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SpacesRestOperations. + /// 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 SpacesRestOperations(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-11-14-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.IntegrationSpaces/spaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Space 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: + { + SpaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SpaceListResult.DeserializeSpaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Space 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: + { + SpaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SpaceListResult.DeserializeSpaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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.IntegrationSpaces/spaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (select != null && Optional.IsCollectionDefined(select)) + { + foreach (var param in select) + { + uri.AppendQuery("select", param, true); + } + } + if (expand != null && Optional.IsCollectionDefined(expand)) + { + foreach (var param in expand) + { + uri.AppendQuery("expand", param, true); + } + } + if (orderby != null && Optional.IsCollectionDefined(orderby)) + { + foreach (var param in orderby) + { + uri.AppendQuery("orderby", param, true); + } + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Space resources by resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// 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, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SpaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SpaceListResult.DeserializeSpaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Space resources by resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// 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, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SpaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SpaceListResult.DeserializeSpaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string spaceName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// 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 spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SpaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SpaceData.DeserializeSpaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SpaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// 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 spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, spaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SpaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SpaceData.DeserializeSpaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SpaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string spaceName, SpaceData 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, 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 Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// 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 spaceName, SpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SpaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SpaceData.DeserializeSpaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// 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 spaceName, SpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, spaceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SpaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SpaceData.DeserializeSpaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreatePatchRequest(string subscriptionId, string resourceGroupName, string spaceName, SpacePatch 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, 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 Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// 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> PatchAsync(string subscriptionId, string resourceGroupName, string spaceName, SpacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SpaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SpaceData.DeserializeSpaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// 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 Patch(string subscriptionId, string resourceGroupName, string spaceName, SpacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreatePatchRequest(subscriptionId, resourceGroupName, spaceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SpaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SpaceData.DeserializeSpaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string spaceName) + { + 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.IntegrationSpaces/spaces/", false); + uri.AppendPath(spaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// 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 spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Space. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the space. + /// 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 spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, spaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + 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 Space 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: + { + SpaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SpaceListResult.DeserializeSpaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Space 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: + { + SpaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SpaceListResult.DeserializeSpaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? top, int? skip, int? maxpagesize, string filter, IEnumerable select, IEnumerable expand, IEnumerable orderby) + { + 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 Space 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 number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// 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, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, 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, top, skip, maxpagesize, filter, select, expand, orderby); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SpaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SpaceListResult.DeserializeSpaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Space 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 number of result items to return. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Filter the result list using the given expression. + /// Select the specified fields to be included in the response. + /// Expand the indicated resources into the response. + /// Expressions that specify the order of returned results. + /// 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, int? top = null, int? skip = null, int? maxpagesize = null, string filter = null, IEnumerable select = null, IEnumerable expand = null, IEnumerable orderby = null, 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, top, skip, maxpagesize, filter, select, expand, orderby); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SpaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SpaceListResult.DeserializeSpaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceCollection.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceCollection.cs new file mode 100644 index 0000000000000..734182af40d7e --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceCollection.cs @@ -0,0 +1,423 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSpaces method from an instance of . + /// + public partial class SpaceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _spaceClientDiagnostics; + private readonly SpacesRestOperations _spaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected SpaceCollection() + { + } + + /// 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 SpaceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _spaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", SpaceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SpaceResource.ResourceType, out string spaceApiVersion); + _spaceRestClient = new SpacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, spaceApiVersion); +#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 Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 space. + /// 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 spaceName, SpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _spaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, spaceName, data, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new SpaceResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 space. + /// 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 spaceName, SpaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _spaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, spaceName, data, cancellationToken); + var operation = new IntegrationSpacesArmOperation(Response.FromValue(new SpaceResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The name of the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceCollection.Get"); + scope.Start(); + try + { + var response = await _spaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, spaceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The name of the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceCollection.Get"); + scope.Start(); + try + { + var response = _spaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, spaceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Space resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces + /// + /// + /// Operation Id + /// Spaces_ListByResourceGroup + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(SpaceCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new SpaceCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _spaceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _spaceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SpaceResource(Client, SpaceData.DeserializeSpaceData(e)), _spaceClientDiagnostics, Pipeline, "SpaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Space resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces + /// + /// + /// Operation Id + /// Spaces_ListByResourceGroup + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(SpaceCollectionGetAllOptions options, CancellationToken cancellationToken = default) + { + options ??= new SpaceCollectionGetAllOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _spaceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _spaceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, options.Top, options.Skip, pageSizeHint, options.Filter, options.Select, options.Expand, options.Orderby); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SpaceResource(Client, SpaceData.DeserializeSpaceData(e)), _spaceClientDiagnostics, Pipeline, "SpaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The name of the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceCollection.Exists"); + scope.Start(); + try + { + var response = await _spaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, spaceName, 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.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The name of the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceCollection.Exists"); + scope.Start(); + try + { + var response = _spaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, spaceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The name of the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _spaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, spaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The name of the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string spaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(spaceName, nameof(spaceName)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _spaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, spaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll(options: null).GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(options: null, cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceData.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceData.cs new file mode 100644 index 0000000000000..b222600c7d865 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IntegrationSpaces.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A class representing the Space data model. + /// An integration space. + /// + public partial class SpaceData : TrackedResourceData + { + /// Initializes a new instance of SpaceData. + /// The location. + public SpaceData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of SpaceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The status of the last operation. + /// The description of the resource. + internal SpaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ProvisioningState? provisioningState, string description) : base(id, name, resourceType, systemData, tags, location) + { + ProvisioningState = provisioningState; + Description = description; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// The description of the resource. + public string Description { get; set; } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceResource.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceResource.cs new file mode 100644 index 0000000000000..0c15124e9a135 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Generated/SpaceResource.cs @@ -0,0 +1,708 @@ +// 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.IntegrationSpaces.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.IntegrationSpaces +{ + /// + /// A Class representing a Space along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSpaceResource method. + /// Otherwise you can get one from its parent resource using the GetSpace method. + /// + public partial class SpaceResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string spaceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _spaceClientDiagnostics; + private readonly SpacesRestOperations _spaceRestClient; + private readonly SpaceData _data; + + /// Initializes a new instance of the class for mocking. + protected SpaceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SpaceResource(ArmClient client, SpaceData 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 SpaceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _spaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IntegrationSpaces", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string spaceApiVersion); + _spaceRestClient = new SpacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, spaceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IntegrationSpaces/spaces"; + + /// 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 SpaceData 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)); + } + + /// Gets a collection of IntegrationSpaceApplicationResources in the Space. + /// An object representing collection of IntegrationSpaceApplicationResources and their operations over a IntegrationSpaceApplicationResource. + public virtual IntegrationSpaceApplicationCollection GetIntegrationSpaceApplications() + { + return GetCachedClient(Client => new IntegrationSpaceApplicationCollection(Client, Id)); + } + + /// + /// Get a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the Application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetIntegrationSpaceApplicationAsync(string applicationName, CancellationToken cancellationToken = default) + { + return await GetIntegrationSpaceApplications().GetAsync(applicationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Application + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the Application. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetIntegrationSpaceApplication(string applicationName, CancellationToken cancellationToken = default) + { + return GetIntegrationSpaceApplications().Get(applicationName, cancellationToken); + } + + /// Gets a collection of InfrastructureResources in the Space. + /// An object representing collection of InfrastructureResources and their operations over a InfrastructureResource. + public virtual InfrastructureResourceCollection GetInfrastructureResources() + { + return GetCachedClient(Client => new InfrastructureResourceCollection(Client, Id)); + } + + /// + /// Get a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The name of the infrastructure resource in the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetInfrastructureResourceAsync(string infrastructureResourceName, CancellationToken cancellationToken = default) + { + return await GetInfrastructureResources().GetAsync(infrastructureResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a InfrastructureResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName} + /// + /// + /// Operation Id + /// InfrastructureResources_Get + /// + /// + /// + /// The name of the infrastructure resource in the space. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetInfrastructureResource(string infrastructureResourceName, CancellationToken cancellationToken = default) + { + return GetInfrastructureResources().Get(infrastructureResourceName, cancellationToken); + } + + /// + /// Get a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _spaceClientDiagnostics.CreateScope("SpaceResource.Get"); + scope.Start(); + try + { + var response = await _spaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _spaceClientDiagnostics.CreateScope("SpaceResource.Get"); + scope.Start(); + try + { + var response = _spaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 = _spaceClientDiagnostics.CreateScope("SpaceResource.Delete"); + scope.Start(); + try + { + var response = await _spaceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 = _spaceClientDiagnostics.CreateScope("SpaceResource.Delete"); + scope.Start(); + try + { + var response = _spaceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new IntegrationSpacesArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(SpacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceResource.Update"); + scope.Start(); + try + { + var response = await _spaceRestClient.PatchAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Space + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_Patch + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(SpacePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _spaceClientDiagnostics.CreateScope("SpaceResource.Update"); + scope.Start(); + try + { + var response = _spaceRestClient.Patch(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + return Response.FromValue(new SpaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 = _spaceClientDiagnostics.CreateScope("SpaceResource.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 _spaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SpaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SpacePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 = _spaceClientDiagnostics.CreateScope("SpaceResource.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 = _spaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SpaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SpacePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 = _spaceClientDiagnostics.CreateScope("SpaceResource.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 _spaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SpaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SpacePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 = _spaceClientDiagnostics.CreateScope("SpaceResource.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 = _spaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SpaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SpacePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 = _spaceClientDiagnostics.CreateScope("SpaceResource.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 _spaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SpaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SpacePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName} + /// + /// + /// Operation Id + /// Spaces_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 = _spaceClientDiagnostics.CreateScope("SpaceResource.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 = _spaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SpaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SpacePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Properties/AssemblyInfo.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..50b8b858ee52f --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/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("IntegrationSpaces")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.IntegrationSpaces.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/autorest.md b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/autorest.md new file mode 100644 index 0000000000000..b47fb5a1a4137 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/src/autorest.md @@ -0,0 +1,63 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +csharp: true +library-name: IntegrationSpaces +namespace: Azure.ResourceManager.IntegrationSpaces +require: https://github.com/Azure/azure-rest-api-specs/blob/58e92dd03733bc175e6a9540f4bc53703b57fcc9/specification/azureintegrationspaces/resource-manager/readme.md +#tag: package-2023-11-14-preview +output-folder: $(this-folder)/Generated +clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../samples/Generated + clear-output-folder: true +skip-csproj: true +modelerfour: + flatten-payloads: false + +#mgmt-debug: +# show-serialized-names: true + +rename-mapping: + Application: IntegrationSpaceApplication + ApplicationResource: IntegrationSpaceResource + TrackingProfileDefinition: TrackingProfile + TrackingEventDefinition: TrackingEvent + FlowTrackingDefinition: WorkflowTracking + ListBusinessProcessDevelopmentArtifactsResponse: BusinessProcessDevelopmentArtifactListResult + SaveOrGetBusinessProcessDevelopmentArtifactResponse: BusinessProcessDevelopmentArtifactResult + +format-by-name-rules: + 'tenantId': 'uuid' + 'ETag': 'etag' + 'location': 'azure-location' + '*Uri': 'Uri' + '*Uris': 'Uri' + +acronym-mapping: + 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 + +``` \ No newline at end of file diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/Azure.ResourceManager.IntegrationSpaces.Tests.csproj b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/Azure.ResourceManager.IntegrationSpaces.Tests.csproj new file mode 100644 index 0000000000000..19a702022a901 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/Azure.ResourceManager.IntegrationSpaces.Tests.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/IntegrationSpacesManagementTestBase.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/IntegrationSpacesManagementTestBase.cs new file mode 100644 index 0000000000000..61684c561c257 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/IntegrationSpacesManagementTestBase.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.IntegrationSpaces.Tests +{ + public class IntegrationSpacesManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected IntegrationSpacesManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected IntegrationSpacesManagementTestBase(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/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/IntegrationSpacesManagementTestEnvironment.cs b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/IntegrationSpacesManagementTestEnvironment.cs new file mode 100644 index 0000000000000..5c3b5603899a4 --- /dev/null +++ b/sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/tests/IntegrationSpacesManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.IntegrationSpaces.Tests +{ + public class IntegrationSpacesManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/integrationspaces/ci.mgmt.yml b/sdk/integrationspaces/ci.mgmt.yml new file mode 100644 index 0000000000000..247ff2da89f4b --- /dev/null +++ b/sdk/integrationspaces/ci.mgmt.yml @@ -0,0 +1,23 @@ +# 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/integrationspaces/ci.mgmt.yml + - sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: integrationspaces + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.IntegrationSpaces + safeName: AzureResourceManagerIntegrationSpaces diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/api/Azure.ResourceManager.IotFirmwareDefense.netstandard2.0.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/api/Azure.ResourceManager.IotFirmwareDefense.netstandard2.0.cs index c623739446633..1073584ecb445 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/api/Azure.ResourceManager.IotFirmwareDefense.netstandard2.0.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/api/Azure.ResourceManager.IotFirmwareDefense.netstandard2.0.cs @@ -93,7 +93,7 @@ protected FirmwareWorkspaceCollection() { } } public partial class FirmwareWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public FirmwareWorkspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FirmwareWorkspaceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.IotFirmwareDefense.Models.ProvisioningState? ProvisioningState { get { throw null; } } } public partial class FirmwareWorkspaceResource : Azure.ResourceManager.ArmResource @@ -126,6 +126,28 @@ public static partial class IotFirmwareDefenseExtensions public static Azure.AsyncPageable GetFirmwareWorkspacesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.IotFirmwareDefense.Mocking +{ + public partial class MockableIotFirmwareDefenseArmClient : Azure.ResourceManager.ArmResource + { + protected MockableIotFirmwareDefenseArmClient() { } + public virtual Azure.ResourceManager.IotFirmwareDefense.FirmwareResource GetFirmwareResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.IotFirmwareDefense.FirmwareWorkspaceResource GetFirmwareWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableIotFirmwareDefenseResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableIotFirmwareDefenseResourceGroupResource() { } + public virtual Azure.Response GetFirmwareWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFirmwareWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.IotFirmwareDefense.FirmwareWorkspaceCollection GetFirmwareWorkspaces() { throw null; } + } + public partial class MockableIotFirmwareDefenseSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableIotFirmwareDefenseSubscriptionResource() { } + public virtual Azure.Pageable GetFirmwareWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFirmwareWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.IotFirmwareDefense.Models { public static partial class ArmIotFirmwareDefenseModelFactory diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/IotFirmwareDefenseExtensions.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/IotFirmwareDefenseExtensions.cs index cda528d5d45db..d02443c9ed1bb 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/IotFirmwareDefenseExtensions.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/IotFirmwareDefenseExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.IotFirmwareDefense.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.IotFirmwareDefense @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.IotFirmwareDefense /// A class to add extension methods to Azure.ResourceManager.IotFirmwareDefense. public static partial class IotFirmwareDefenseExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableIotFirmwareDefenseArmClient GetMockableIotFirmwareDefenseArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableIotFirmwareDefenseArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableIotFirmwareDefenseResourceGroupResource GetMockableIotFirmwareDefenseResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableIotFirmwareDefenseResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableIotFirmwareDefenseSubscriptionResource GetMockableIotFirmwareDefenseSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableIotFirmwareDefenseSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region FirmwareResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FirmwareResource GetFirmwareResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FirmwareResource.ValidateResourceId(id); - return new FirmwareResource(client, id); - } - ); + return GetMockableIotFirmwareDefenseArmClient(client).GetFirmwareResource(id); } - #endregion - #region FirmwareWorkspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FirmwareWorkspaceResource GetFirmwareWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FirmwareWorkspaceResource.ValidateResourceId(id); - return new FirmwareWorkspaceResource(client, id); - } - ); + return GetMockableIotFirmwareDefenseArmClient(client).GetFirmwareWorkspaceResource(id); } - #endregion - /// Gets a collection of FirmwareWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of FirmwareWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of FirmwareWorkspaceResources and their operations over a FirmwareWorkspaceResource. public static FirmwareWorkspaceCollection GetFirmwareWorkspaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetFirmwareWorkspaces(); + return GetMockableIotFirmwareDefenseResourceGroupResource(resourceGroupResource).GetFirmwareWorkspaces(); } /// @@ -107,16 +92,20 @@ public static FirmwareWorkspaceCollection GetFirmwareWorkspaces(this ResourceGro /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the firmware analysis workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetFirmwareWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetFirmwareWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableIotFirmwareDefenseResourceGroupResource(resourceGroupResource).GetFirmwareWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -131,16 +120,20 @@ public static async Task> GetFirmwareWorkspa /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the firmware analysis workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetFirmwareWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetFirmwareWorkspaces().Get(workspaceName, cancellationToken); + return GetMockableIotFirmwareDefenseResourceGroupResource(resourceGroupResource).GetFirmwareWorkspace(workspaceName, cancellationToken); } /// @@ -155,13 +148,17 @@ public static Response GetFirmwareWorkspace(this Reso /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFirmwareWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFirmwareWorkspacesAsync(cancellationToken); + return GetMockableIotFirmwareDefenseSubscriptionResource(subscriptionResource).GetFirmwareWorkspacesAsync(cancellationToken); } /// @@ -176,13 +173,17 @@ public static AsyncPageable GetFirmwareWorkspacesAsyn /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFirmwareWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFirmwareWorkspaces(cancellationToken); + return GetMockableIotFirmwareDefenseSubscriptionResource(subscriptionResource).GetFirmwareWorkspaces(cancellationToken); } } } diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseArmClient.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseArmClient.cs new file mode 100644 index 0000000000000..53c5f90ee7c18 --- /dev/null +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.IotFirmwareDefense; + +namespace Azure.ResourceManager.IotFirmwareDefense.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableIotFirmwareDefenseArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableIotFirmwareDefenseArmClient() + { + } + + /// 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 MockableIotFirmwareDefenseArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableIotFirmwareDefenseArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FirmwareResource GetFirmwareResource(ResourceIdentifier id) + { + FirmwareResource.ValidateResourceId(id); + return new FirmwareResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FirmwareWorkspaceResource GetFirmwareWorkspaceResource(ResourceIdentifier id) + { + FirmwareWorkspaceResource.ValidateResourceId(id); + return new FirmwareWorkspaceResource(Client, id); + } + } +} diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseResourceGroupResource.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseResourceGroupResource.cs new file mode 100644 index 0000000000000..7512c73424818 --- /dev/null +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.IotFirmwareDefense; + +namespace Azure.ResourceManager.IotFirmwareDefense.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableIotFirmwareDefenseResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableIotFirmwareDefenseResourceGroupResource() + { + } + + /// 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 MockableIotFirmwareDefenseResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of FirmwareWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of FirmwareWorkspaceResources and their operations over a FirmwareWorkspaceResource. + public virtual FirmwareWorkspaceCollection GetFirmwareWorkspaces() + { + return GetCachedClient(client => new FirmwareWorkspaceCollection(client, Id)); + } + + /// + /// Get firmware analysis workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the firmware analysis workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFirmwareWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetFirmwareWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get firmware analysis workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the firmware analysis workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFirmwareWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetFirmwareWorkspaces().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseSubscriptionResource.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseSubscriptionResource.cs new file mode 100644 index 0000000000000..af02a39eee7af --- /dev/null +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/MockableIotFirmwareDefenseSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IotFirmwareDefense; + +namespace Azure.ResourceManager.IotFirmwareDefense.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableIotFirmwareDefenseSubscriptionResource : ArmResource + { + private ClientDiagnostics _firmwareWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _firmwareWorkspaceWorkspacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableIotFirmwareDefenseSubscriptionResource() + { + } + + /// 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 MockableIotFirmwareDefenseSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics FirmwareWorkspaceWorkspacesClientDiagnostics => _firmwareWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IotFirmwareDefense", FirmwareWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations FirmwareWorkspaceWorkspacesRestClient => _firmwareWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FirmwareWorkspaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all of the firmware analysis workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTFirmwareDefense/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFirmwareWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FirmwareWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FirmwareWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FirmwareWorkspaceResource(Client, FirmwareWorkspaceData.DeserializeFirmwareWorkspaceData(e)), FirmwareWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableIotFirmwareDefenseSubscriptionResource.GetFirmwareWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the firmware analysis workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTFirmwareDefense/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFirmwareWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FirmwareWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FirmwareWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FirmwareWorkspaceResource(Client, FirmwareWorkspaceData.DeserializeFirmwareWorkspaceData(e)), FirmwareWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableIotFirmwareDefenseSubscriptionResource.GetFirmwareWorkspaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index cde6733cec16b..0000000000000 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.IotFirmwareDefense -{ - /// 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 FirmwareWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of FirmwareWorkspaceResources and their operations over a FirmwareWorkspaceResource. - public virtual FirmwareWorkspaceCollection GetFirmwareWorkspaces() - { - return GetCachedClient(Client => new FirmwareWorkspaceCollection(Client, Id)); - } - } -} diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 150b933658c3b..0000000000000 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.IotFirmwareDefense -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _firmwareWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _firmwareWorkspaceWorkspacesRestClient; - - /// 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 FirmwareWorkspaceWorkspacesClientDiagnostics => _firmwareWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IotFirmwareDefense", FirmwareWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations FirmwareWorkspaceWorkspacesRestClient => _firmwareWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FirmwareWorkspaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all of the firmware analysis workspaces in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTFirmwareDefense/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetFirmwareWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FirmwareWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FirmwareWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FirmwareWorkspaceResource(Client, FirmwareWorkspaceData.DeserializeFirmwareWorkspaceData(e)), FirmwareWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFirmwareWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the firmware analysis workspaces in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTFirmwareDefense/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetFirmwareWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FirmwareWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FirmwareWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FirmwareWorkspaceResource(Client, FirmwareWorkspaceData.DeserializeFirmwareWorkspaceData(e)), FirmwareWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFirmwareWorkspaces", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareResource.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareResource.cs index 9eb753f0dec76..fc9b19c621c29 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareResource.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.IotFirmwareDefense public partial class FirmwareResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The firmwareName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string firmwareName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}/firmwares/{firmwareName}"; diff --git a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceResource.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceResource.cs index b705a2b38d48b..9c99b85ca3c7b 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceResource.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.IotFirmwareDefense public partial class FirmwareWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTFirmwareDefense/workspaces/{workspaceName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FirmwareResources and their operations over a FirmwareResource. public virtual FirmwareCollection GetFirmwares() { - return GetCachedClient(Client => new FirmwareCollection(Client, Id)); + return GetCachedClient(client => new FirmwareCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual FirmwareCollection GetFirmwares() /// /// The id of the firmware. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFirmwareAsync(string firmwareName, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetFirmwareAsync(string fi /// /// The id of the firmware. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFirmware(string firmwareName, CancellationToken cancellationToken = default) { diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/Azure.ResourceManager.IotCentral.sln b/sdk/iotcentral/Azure.ResourceManager.IotCentral/Azure.ResourceManager.IotCentral.sln index 153e4681936e0..cf20b707a6c1f 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/Azure.ResourceManager.IotCentral.sln +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/Azure.ResourceManager.IotCentral.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{EC3B9387-973A-4914-B141-F86AB55D7168}") = "Azure.ResourceManager.IotCentral", "src\Azure.ResourceManager.IotCentral.csproj", "{2AF93910-EAE2-41C3-88B9-509FF922E0CC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.IotCentral", "src\Azure.ResourceManager.IotCentral.csproj", "{2AF93910-EAE2-41C3-88B9-509FF922E0CC}" EndProject -Project("{EC3B9387-973A-4914-B141-F86AB55D7168}") = "Azure.ResourceManager.IotCentral.Tests", "tests\Azure.ResourceManager.IotCentral.Tests.csproj", "{A4C2E27F-C5CA-4D3E-AF37-CE4F29D05951}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.IotCentral.Tests", "tests\Azure.ResourceManager.IotCentral.Tests.csproj", "{A4C2E27F-C5CA-4D3E-AF37-CE4F29D05951}" EndProject -Project("{EC3B9387-973A-4914-B141-F86AB55D7168}") = "Azure.ResourceManager.IotCentral.Samples", "samples\Azure.ResourceManager.IotCentral.Samples.csproj", "{90BFC2ED-E546-4497-8190-8E2971CCDDE3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.IotCentral.Samples", "samples\Azure.ResourceManager.IotCentral.Samples.csproj", "{90BFC2ED-E546-4497-8190-8E2971CCDDE3}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1969F116-D5D1-4F60-B45E-FC3C4D88FDDC} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {A4C2E27F-C5CA-4D3E-AF37-CE4F29D05951}.Release|x64.Build.0 = Release|Any CPU {A4C2E27F-C5CA-4D3E-AF37-CE4F29D05951}.Release|x86.ActiveCfg = Release|Any CPU {A4C2E27F-C5CA-4D3E-AF37-CE4F29D05951}.Release|x86.Build.0 = Release|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Debug|x64.ActiveCfg = Debug|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Debug|x64.Build.0 = Debug|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Debug|x86.ActiveCfg = Debug|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Debug|x86.Build.0 = Debug|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Release|Any CPU.Build.0 = Release|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Release|x64.ActiveCfg = Release|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Release|x64.Build.0 = Release|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Release|x86.ActiveCfg = Release|Any CPU + {90BFC2ED-E546-4497-8190-8E2971CCDDE3}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1969F116-D5D1-4F60-B45E-FC3C4D88FDDC} EndGlobalSection EndGlobal diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/api/Azure.ResourceManager.IotCentral.netstandard2.0.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/api/Azure.ResourceManager.IotCentral.netstandard2.0.cs index 5452023e38736..bf9a7fb5e3a63 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/api/Azure.ResourceManager.IotCentral.netstandard2.0.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/api/Azure.ResourceManager.IotCentral.netstandard2.0.cs @@ -19,7 +19,7 @@ protected IotCentralAppCollection() { } } public partial class IotCentralAppData : Azure.ResourceManager.Models.TrackedResourceData { - public IotCentralAppData(Azure.Core.AzureLocation location, Azure.ResourceManager.IotCentral.Models.IotCentralAppSkuInfo sku) : base (default(Azure.Core.AzureLocation)) { } + public IotCentralAppData(Azure.Core.AzureLocation location, Azure.ResourceManager.IotCentral.Models.IotCentralAppSkuInfo sku) { } public System.Guid? ApplicationId { get { throw null; } } public string DisplayName { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } @@ -147,6 +147,35 @@ public IotCentralPrivateLinkResourceData() { } public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } } } +namespace Azure.ResourceManager.IotCentral.Mocking +{ + public partial class MockableIotCentralArmClient : Azure.ResourceManager.ArmResource + { + protected MockableIotCentralArmClient() { } + public virtual Azure.ResourceManager.IotCentral.IotCentralAppResource GetIotCentralAppResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.IotCentral.IotCentralPrivateEndpointConnectionResource GetIotCentralPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.IotCentral.IotCentralPrivateLinkResource GetIotCentralPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableIotCentralResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableIotCentralResourceGroupResource() { } + public virtual Azure.Response GetIotCentralApp(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIotCentralAppAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.IotCentral.IotCentralAppCollection GetIotCentralApps() { throw null; } + } + public partial class MockableIotCentralSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableIotCentralSubscriptionResource() { } + public virtual Azure.Response CheckIotCentralAppNameAvailability(Azure.ResourceManager.IotCentral.Models.IotCentralAppNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckIotCentralAppNameAvailabilityAsync(Azure.ResourceManager.IotCentral.Models.IotCentralAppNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckIotCentralAppSubdomainAvailability(Azure.ResourceManager.IotCentral.Models.IotCentralAppNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckIotCentralAppSubdomainAvailabilityAsync(Azure.ResourceManager.IotCentral.Models.IotCentralAppNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetIotCentralApps(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetIotCentralAppsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetTemplatesApps(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTemplatesAppsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.IotCentral.Models { public static partial class ArmIotCentralModelFactory diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/IotCentralExtensions.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/IotCentralExtensions.cs index d6b9f0d66b864..0e2a58539ed26 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/IotCentralExtensions.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/IotCentralExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.IotCentral.Mocking; using Azure.ResourceManager.IotCentral.Models; using Azure.ResourceManager.Resources; @@ -19,100 +20,81 @@ namespace Azure.ResourceManager.IotCentral /// A class to add extension methods to Azure.ResourceManager.IotCentral. public static partial class IotCentralExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableIotCentralArmClient GetMockableIotCentralArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableIotCentralArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableIotCentralResourceGroupResource GetMockableIotCentralResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableIotCentralResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableIotCentralSubscriptionResource GetMockableIotCentralSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableIotCentralSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region IotCentralAppResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IotCentralAppResource GetIotCentralAppResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IotCentralAppResource.ValidateResourceId(id); - return new IotCentralAppResource(client, id); - } - ); + return GetMockableIotCentralArmClient(client).GetIotCentralAppResource(id); } - #endregion - #region IotCentralPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IotCentralPrivateEndpointConnectionResource GetIotCentralPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IotCentralPrivateEndpointConnectionResource.ValidateResourceId(id); - return new IotCentralPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableIotCentralArmClient(client).GetIotCentralPrivateEndpointConnectionResource(id); } - #endregion - #region IotCentralPrivateLinkResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IotCentralPrivateLinkResource GetIotCentralPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IotCentralPrivateLinkResource.ValidateResourceId(id); - return new IotCentralPrivateLinkResource(client, id); - } - ); + return GetMockableIotCentralArmClient(client).GetIotCentralPrivateLinkResource(id); } - #endregion - /// Gets a collection of IotCentralAppResources in the ResourceGroupResource. + /// + /// Gets a collection of IotCentralAppResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of IotCentralAppResources and their operations over a IotCentralAppResource. public static IotCentralAppCollection GetIotCentralApps(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetIotCentralApps(); + return GetMockableIotCentralResourceGroupResource(resourceGroupResource).GetIotCentralApps(); } /// @@ -127,16 +109,20 @@ public static IotCentralAppCollection GetIotCentralApps(this ResourceGroupResour /// Apps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ARM resource name of the IoT Central application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetIotCentralAppAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetIotCentralApps().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableIotCentralResourceGroupResource(resourceGroupResource).GetIotCentralAppAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -151,16 +137,20 @@ public static async Task> GetIotCentralAppAsync( /// Apps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ARM resource name of the IoT Central application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetIotCentralApp(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetIotCentralApps().Get(resourceName, cancellationToken); + return GetMockableIotCentralResourceGroupResource(resourceGroupResource).GetIotCentralApp(resourceName, cancellationToken); } /// @@ -175,13 +165,17 @@ public static Response GetIotCentralApp(this ResourceGrou /// Apps_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIotCentralAppsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIotCentralAppsAsync(cancellationToken); + return GetMockableIotCentralSubscriptionResource(subscriptionResource).GetIotCentralAppsAsync(cancellationToken); } /// @@ -196,13 +190,17 @@ public static AsyncPageable GetIotCentralAppsAsync(this S /// Apps_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIotCentralApps(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIotCentralApps(cancellationToken); + return GetMockableIotCentralSubscriptionResource(subscriptionResource).GetIotCentralApps(cancellationToken); } /// @@ -217,6 +215,10 @@ public static Pageable GetIotCentralApps(this Subscriptio /// Apps_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. @@ -224,9 +226,7 @@ public static Pageable GetIotCentralApps(this Subscriptio /// is null. public static async Task> CheckIotCentralAppNameAvailabilityAsync(this SubscriptionResource subscriptionResource, IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckIotCentralAppNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableIotCentralSubscriptionResource(subscriptionResource).CheckIotCentralAppNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -241,6 +241,10 @@ public static async Task> CheckI /// Apps_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. @@ -248,9 +252,7 @@ public static async Task> CheckI /// is null. public static Response CheckIotCentralAppNameAvailability(this SubscriptionResource subscriptionResource, IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckIotCentralAppNameAvailability(content, cancellationToken); + return GetMockableIotCentralSubscriptionResource(subscriptionResource).CheckIotCentralAppNameAvailability(content, cancellationToken); } /// @@ -265,6 +267,10 @@ public static Response CheckIotCentralApp /// Apps_CheckSubdomainAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. @@ -272,9 +278,7 @@ public static Response CheckIotCentralApp /// is null. public static async Task> CheckIotCentralAppSubdomainAvailabilityAsync(this SubscriptionResource subscriptionResource, IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckIotCentralAppSubdomainAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableIotCentralSubscriptionResource(subscriptionResource).CheckIotCentralAppSubdomainAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -289,6 +293,10 @@ public static async Task> CheckI /// Apps_CheckSubdomainAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. @@ -296,9 +304,7 @@ public static async Task> CheckI /// is null. public static Response CheckIotCentralAppSubdomainAvailability(this SubscriptionResource subscriptionResource, IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckIotCentralAppSubdomainAvailability(content, cancellationToken); + return GetMockableIotCentralSubscriptionResource(subscriptionResource).CheckIotCentralAppSubdomainAvailability(content, cancellationToken); } /// @@ -313,13 +319,17 @@ public static Response CheckIotCentralApp /// Apps_ListTemplates /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetTemplatesAppsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTemplatesAppsAsync(cancellationToken); + return GetMockableIotCentralSubscriptionResource(subscriptionResource).GetTemplatesAppsAsync(cancellationToken); } /// @@ -334,13 +344,17 @@ public static AsyncPageable GetTemplatesAppsAsync(this Su /// Apps_ListTemplates /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetTemplatesApps(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTemplatesApps(cancellationToken); + return GetMockableIotCentralSubscriptionResource(subscriptionResource).GetTemplatesApps(cancellationToken); } } } diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralArmClient.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralArmClient.cs new file mode 100644 index 0000000000000..4ddc3d4d3e21b --- /dev/null +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.IotCentral; + +namespace Azure.ResourceManager.IotCentral.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableIotCentralArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableIotCentralArmClient() + { + } + + /// 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 MockableIotCentralArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableIotCentralArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotCentralAppResource GetIotCentralAppResource(ResourceIdentifier id) + { + IotCentralAppResource.ValidateResourceId(id); + return new IotCentralAppResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotCentralPrivateEndpointConnectionResource GetIotCentralPrivateEndpointConnectionResource(ResourceIdentifier id) + { + IotCentralPrivateEndpointConnectionResource.ValidateResourceId(id); + return new IotCentralPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotCentralPrivateLinkResource GetIotCentralPrivateLinkResource(ResourceIdentifier id) + { + IotCentralPrivateLinkResource.ValidateResourceId(id); + return new IotCentralPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralResourceGroupResource.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralResourceGroupResource.cs new file mode 100644 index 0000000000000..1a9367978deb8 --- /dev/null +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.IotCentral; + +namespace Azure.ResourceManager.IotCentral.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableIotCentralResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableIotCentralResourceGroupResource() + { + } + + /// 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 MockableIotCentralResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of IotCentralAppResources in the ResourceGroupResource. + /// An object representing collection of IotCentralAppResources and their operations over a IotCentralAppResource. + public virtual IotCentralAppCollection GetIotCentralApps() + { + return GetCachedClient(client => new IotCentralAppCollection(client, Id)); + } + + /// + /// Get the metadata of an IoT Central application. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName} + /// + /// + /// Operation Id + /// Apps_Get + /// + /// + /// + /// The ARM resource name of the IoT Central application. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetIotCentralAppAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetIotCentralApps().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the metadata of an IoT Central application. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName} + /// + /// + /// Operation Id + /// Apps_Get + /// + /// + /// + /// The ARM resource name of the IoT Central application. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetIotCentralApp(string resourceName, CancellationToken cancellationToken = default) + { + return GetIotCentralApps().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralSubscriptionResource.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralSubscriptionResource.cs new file mode 100644 index 0000000000000..38b9590ac18a7 --- /dev/null +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/MockableIotCentralSubscriptionResource.cs @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IotCentral; +using Azure.ResourceManager.IotCentral.Models; + +namespace Azure.ResourceManager.IotCentral.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableIotCentralSubscriptionResource : ArmResource + { + private ClientDiagnostics _iotCentralAppAppsClientDiagnostics; + private AppsRestOperations _iotCentralAppAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableIotCentralSubscriptionResource() + { + } + + /// 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 MockableIotCentralSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics IotCentralAppAppsClientDiagnostics => _iotCentralAppAppsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IotCentral", IotCentralAppResource.ResourceType.Namespace, Diagnostics); + private AppsRestOperations IotCentralAppAppsRestClient => _iotCentralAppAppsRestClient ??= new AppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IotCentralAppResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get all IoT Central Applications in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotApps + /// + /// + /// Operation Id + /// Apps_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetIotCentralAppsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IotCentralAppAppsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotCentralAppAppsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IotCentralAppResource(Client, IotCentralAppData.DeserializeIotCentralAppData(e)), IotCentralAppAppsClientDiagnostics, Pipeline, "MockableIotCentralSubscriptionResource.GetIotCentralApps", "value", "nextLink", cancellationToken); + } + + /// + /// Get all IoT Central Applications in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotApps + /// + /// + /// Operation Id + /// Apps_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetIotCentralApps(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IotCentralAppAppsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotCentralAppAppsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IotCentralAppResource(Client, IotCentralAppData.DeserializeIotCentralAppData(e)), IotCentralAppAppsClientDiagnostics, Pipeline, "MockableIotCentralSubscriptionResource.GetIotCentralApps", "value", "nextLink", cancellationToken); + } + + /// + /// Check if an IoT Central application name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability + /// + /// + /// Operation Id + /// Apps_CheckNameAvailability + /// + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckIotCentralAppNameAvailabilityAsync(IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = IotCentralAppAppsClientDiagnostics.CreateScope("MockableIotCentralSubscriptionResource.CheckIotCentralAppNameAvailability"); + scope.Start(); + try + { + var response = await IotCentralAppAppsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if an IoT Central application name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability + /// + /// + /// Operation Id + /// Apps_CheckNameAvailability + /// + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIotCentralAppNameAvailability(IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = IotCentralAppAppsClientDiagnostics.CreateScope("MockableIotCentralSubscriptionResource.CheckIotCentralAppNameAvailability"); + scope.Start(); + try + { + var response = IotCentralAppAppsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if an IoT Central application subdomain is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability + /// + /// + /// Operation Id + /// Apps_CheckSubdomainAvailability + /// + /// + /// + /// Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckIotCentralAppSubdomainAvailabilityAsync(IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = IotCentralAppAppsClientDiagnostics.CreateScope("MockableIotCentralSubscriptionResource.CheckIotCentralAppSubdomainAvailability"); + scope.Start(); + try + { + var response = await IotCentralAppAppsRestClient.CheckSubdomainAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if an IoT Central application subdomain is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability + /// + /// + /// Operation Id + /// Apps_CheckSubdomainAvailability + /// + /// + /// + /// Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIotCentralAppSubdomainAvailability(IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = IotCentralAppAppsClientDiagnostics.CreateScope("MockableIotCentralSubscriptionResource.CheckIotCentralAppSubdomainAvailability"); + scope.Start(); + try + { + var response = IotCentralAppAppsRestClient.CheckSubdomainAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get all available application templates. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates + /// + /// + /// Operation Id + /// Apps_ListTemplates + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetTemplatesAppsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IotCentralAppAppsRestClient.CreateListTemplatesRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotCentralAppAppsRestClient.CreateListTemplatesNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, IotCentralAppTemplate.DeserializeIotCentralAppTemplate, IotCentralAppAppsClientDiagnostics, Pipeline, "MockableIotCentralSubscriptionResource.GetTemplatesApps", "value", "nextLink", cancellationToken); + } + + /// + /// Get all available application templates. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates + /// + /// + /// Operation Id + /// Apps_ListTemplates + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetTemplatesApps(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IotCentralAppAppsRestClient.CreateListTemplatesRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotCentralAppAppsRestClient.CreateListTemplatesNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, IotCentralAppTemplate.DeserializeIotCentralAppTemplate, IotCentralAppAppsClientDiagnostics, Pipeline, "MockableIotCentralSubscriptionResource.GetTemplatesApps", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 645774d459bc7..0000000000000 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.IotCentral -{ - /// 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 IotCentralAppResources in the ResourceGroupResource. - /// An object representing collection of IotCentralAppResources and their operations over a IotCentralAppResource. - public virtual IotCentralAppCollection GetIotCentralApps() - { - return GetCachedClient(Client => new IotCentralAppCollection(Client, Id)); - } - } -} diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b70af80d9fccf..0000000000000 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.IotCentral.Models; - -namespace Azure.ResourceManager.IotCentral -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _iotCentralAppAppsClientDiagnostics; - private AppsRestOperations _iotCentralAppAppsRestClient; - - /// 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 IotCentralAppAppsClientDiagnostics => _iotCentralAppAppsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IotCentral", IotCentralAppResource.ResourceType.Namespace, Diagnostics); - private AppsRestOperations IotCentralAppAppsRestClient => _iotCentralAppAppsRestClient ??= new AppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IotCentralAppResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get all IoT Central Applications in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotApps - /// - /// - /// Operation Id - /// Apps_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetIotCentralAppsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IotCentralAppAppsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotCentralAppAppsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IotCentralAppResource(Client, IotCentralAppData.DeserializeIotCentralAppData(e)), IotCentralAppAppsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIotCentralApps", "value", "nextLink", cancellationToken); - } - - /// - /// Get all IoT Central Applications in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotApps - /// - /// - /// Operation Id - /// Apps_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetIotCentralApps(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IotCentralAppAppsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotCentralAppAppsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IotCentralAppResource(Client, IotCentralAppData.DeserializeIotCentralAppData(e)), IotCentralAppAppsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIotCentralApps", "value", "nextLink", cancellationToken); - } - - /// - /// Check if an IoT Central application name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability - /// - /// - /// Operation Id - /// Apps_CheckNameAvailability - /// - /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. - /// The cancellation token to use. - public virtual async Task> CheckIotCentralAppNameAvailabilityAsync(IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = IotCentralAppAppsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckIotCentralAppNameAvailability"); - scope.Start(); - try - { - var response = await IotCentralAppAppsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if an IoT Central application name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability - /// - /// - /// Operation Id - /// Apps_CheckNameAvailability - /// - /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the IoT Central application to check. - /// The cancellation token to use. - public virtual Response CheckIotCentralAppNameAvailability(IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = IotCentralAppAppsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckIotCentralAppNameAvailability"); - scope.Start(); - try - { - var response = IotCentralAppAppsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if an IoT Central application subdomain is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability - /// - /// - /// Operation Id - /// Apps_CheckSubdomainAvailability - /// - /// - /// - /// Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. - /// The cancellation token to use. - public virtual async Task> CheckIotCentralAppSubdomainAvailabilityAsync(IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = IotCentralAppAppsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckIotCentralAppSubdomainAvailability"); - scope.Start(); - try - { - var response = await IotCentralAppAppsRestClient.CheckSubdomainAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if an IoT Central application subdomain is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability - /// - /// - /// Operation Id - /// Apps_CheckSubdomainAvailability - /// - /// - /// - /// Set the name parameter in the OperationInputs structure to the subdomain of the IoT Central application to check. - /// The cancellation token to use. - public virtual Response CheckIotCentralAppSubdomainAvailability(IotCentralAppNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = IotCentralAppAppsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckIotCentralAppSubdomainAvailability"); - scope.Start(); - try - { - var response = IotCentralAppAppsRestClient.CheckSubdomainAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get all available application templates. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates - /// - /// - /// Operation Id - /// Apps_ListTemplates - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetTemplatesAppsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IotCentralAppAppsRestClient.CreateListTemplatesRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotCentralAppAppsRestClient.CreateListTemplatesNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, IotCentralAppTemplate.DeserializeIotCentralAppTemplate, IotCentralAppAppsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTemplatesApps", "value", "nextLink", cancellationToken); - } - - /// - /// Get all available application templates. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates - /// - /// - /// Operation Id - /// Apps_ListTemplates - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetTemplatesApps(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IotCentralAppAppsRestClient.CreateListTemplatesRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotCentralAppAppsRestClient.CreateListTemplatesNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, IotCentralAppTemplate.DeserializeIotCentralAppTemplate, IotCentralAppAppsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTemplatesApps", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppResource.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppResource.cs index 9270510f06ac7..b0d776177c63d 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppResource.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.IotCentral public partial class IotCentralAppResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of IotCentralPrivateEndpointConnectionResources and their operations over a IotCentralPrivateEndpointConnectionResource. public virtual IotCentralPrivateEndpointConnectionCollection GetIotCentralPrivateEndpointConnections() { - return GetCachedClient(Client => new IotCentralPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new IotCentralPrivateEndpointConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual IotCentralPrivateEndpointConnectionCollection GetIotCentralPrivat /// /// The private endpoint connection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIotCentralPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> /// /// The private endpoint connection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIotCentralPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetIotCentr /// An object representing collection of IotCentralPrivateLinkResources and their operations over a IotCentralPrivateLinkResource. public virtual IotCentralPrivateLinkResourceCollection GetIotCentralPrivateLinkResources() { - return GetCachedClient(Client => new IotCentralPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new IotCentralPrivateLinkResourceCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual IotCentralPrivateLinkResourceCollection GetIotCentralPrivateLinkR /// /// The private link resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIotCentralPrivateLinkResourceAsync(string groupId, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetIotCentral /// /// The private link resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIotCentralPrivateLinkResource(string groupId, CancellationToken cancellationToken = default) { diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateEndpointConnectionResource.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateEndpointConnectionResource.cs index f5bb9f04fd765..d572be2a7e2f2 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateEndpointConnectionResource.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.IotCentral public partial class IotCentralPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateLinkResource.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateLinkResource.cs index 418946aa94cdd..30290839fa938 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateLinkResource.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.IotCentral public partial class IotCentralPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The groupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string groupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}/privateLinkResources/{groupId}"; diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/api/Azure.ResourceManager.IotHub.netstandard2.0.cs b/sdk/iothub/Azure.ResourceManager.IotHub/api/Azure.ResourceManager.IotHub.netstandard2.0.cs index 8c3aede8f43a2..5a6076c3ea910 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/api/Azure.ResourceManager.IotHub.netstandard2.0.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/api/Azure.ResourceManager.IotHub.netstandard2.0.cs @@ -97,7 +97,7 @@ protected IotHubDescriptionCollection() { } } public partial class IotHubDescriptionData : Azure.ResourceManager.Models.TrackedResourceData { - public IotHubDescriptionData(Azure.Core.AzureLocation location, Azure.ResourceManager.IotHub.Models.IotHubSkuInfo sku) : base (default(Azure.Core.AzureLocation)) { } + public IotHubDescriptionData(Azure.Core.AzureLocation location, Azure.ResourceManager.IotHub.Models.IotHubSkuInfo sku) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.IotHub.Models.IotHubProperties Properties { get { throw null; } set { } } @@ -245,6 +245,35 @@ protected IotHubPrivateEndpointGroupInformationResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.IotHub.Mocking +{ + public partial class MockableIotHubArmClient : Azure.ResourceManager.ArmResource + { + protected MockableIotHubArmClient() { } + public virtual Azure.ResourceManager.IotHub.EventHubConsumerGroupInfoResource GetEventHubConsumerGroupInfoResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.IotHub.IotHubCertificateDescriptionResource GetIotHubCertificateDescriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.IotHub.IotHubDescriptionResource GetIotHubDescriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.IotHub.IotHubPrivateEndpointConnectionResource GetIotHubPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.IotHub.IotHubPrivateEndpointGroupInformationResource GetIotHubPrivateEndpointGroupInformationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableIotHubResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableIotHubResourceGroupResource() { } + public virtual Azure.Response GetIotHubDescription(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIotHubDescriptionAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.IotHub.IotHubDescriptionCollection GetIotHubDescriptions() { throw null; } + } + public partial class MockableIotHubSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableIotHubSubscriptionResource() { } + public virtual Azure.Response CheckIotHubNameAvailability(Azure.ResourceManager.IotHub.Models.IotHubNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckIotHubNameAvailabilityAsync(Azure.ResourceManager.IotHub.Models.IotHubNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetIotHubDescriptions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetIotHubDescriptionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetIotHubUserSubscriptionQuota(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetIotHubUserSubscriptionQuotaAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.IotHub.Models { public static partial class ArmIotHubModelFactory diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/EventHubConsumerGroupInfoResource.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/EventHubConsumerGroupInfoResource.cs index 128bc53c55db8..bd1b7cef3d736 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/EventHubConsumerGroupInfoResource.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/EventHubConsumerGroupInfoResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.IotHub public partial class EventHubConsumerGroupInfoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The eventHubEndpointName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string eventHubEndpointName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}"; diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/IotHubExtensions.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/IotHubExtensions.cs index 9b461d1752e84..5e236b7d50459 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/IotHubExtensions.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/IotHubExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.IotHub.Mocking; using Azure.ResourceManager.IotHub.Models; using Azure.ResourceManager.Resources; @@ -19,138 +20,113 @@ namespace Azure.ResourceManager.IotHub /// A class to add extension methods to Azure.ResourceManager.IotHub. public static partial class IotHubExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableIotHubArmClient GetMockableIotHubArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableIotHubArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableIotHubResourceGroupResource GetMockableIotHubResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableIotHubResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableIotHubSubscriptionResource GetMockableIotHubSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableIotHubSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region IotHubDescriptionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IotHubDescriptionResource GetIotHubDescriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IotHubDescriptionResource.ValidateResourceId(id); - return new IotHubDescriptionResource(client, id); - } - ); + return GetMockableIotHubArmClient(client).GetIotHubDescriptionResource(id); } - #endregion - #region EventHubConsumerGroupInfoResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EventHubConsumerGroupInfoResource GetEventHubConsumerGroupInfoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EventHubConsumerGroupInfoResource.ValidateResourceId(id); - return new EventHubConsumerGroupInfoResource(client, id); - } - ); + return GetMockableIotHubArmClient(client).GetEventHubConsumerGroupInfoResource(id); } - #endregion - #region IotHubCertificateDescriptionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IotHubCertificateDescriptionResource GetIotHubCertificateDescriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IotHubCertificateDescriptionResource.ValidateResourceId(id); - return new IotHubCertificateDescriptionResource(client, id); - } - ); + return GetMockableIotHubArmClient(client).GetIotHubCertificateDescriptionResource(id); } - #endregion - #region IotHubPrivateEndpointGroupInformationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IotHubPrivateEndpointGroupInformationResource GetIotHubPrivateEndpointGroupInformationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IotHubPrivateEndpointGroupInformationResource.ValidateResourceId(id); - return new IotHubPrivateEndpointGroupInformationResource(client, id); - } - ); + return GetMockableIotHubArmClient(client).GetIotHubPrivateEndpointGroupInformationResource(id); } - #endregion - #region IotHubPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IotHubPrivateEndpointConnectionResource GetIotHubPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IotHubPrivateEndpointConnectionResource.ValidateResourceId(id); - return new IotHubPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableIotHubArmClient(client).GetIotHubPrivateEndpointConnectionResource(id); } - #endregion - /// Gets a collection of IotHubDescriptionResources in the ResourceGroupResource. + /// + /// Gets a collection of IotHubDescriptionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of IotHubDescriptionResources and their operations over a IotHubDescriptionResource. public static IotHubDescriptionCollection GetIotHubDescriptions(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetIotHubDescriptions(); + return GetMockableIotHubResourceGroupResource(resourceGroupResource).GetIotHubDescriptions(); } /// @@ -165,16 +141,20 @@ public static IotHubDescriptionCollection GetIotHubDescriptions(this ResourceGro /// IotHubResource_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the IoT hub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetIotHubDescriptionAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetIotHubDescriptions().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableIotHubResourceGroupResource(resourceGroupResource).GetIotHubDescriptionAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -189,16 +169,20 @@ public static async Task> GetIotHubDescripti /// IotHubResource_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the IoT hub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetIotHubDescription(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetIotHubDescriptions().Get(resourceName, cancellationToken); + return GetMockableIotHubResourceGroupResource(resourceGroupResource).GetIotHubDescription(resourceName, cancellationToken); } /// @@ -213,13 +197,17 @@ public static Response GetIotHubDescription(this Reso /// IotHubResource_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIotHubDescriptionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIotHubDescriptionsAsync(cancellationToken); + return GetMockableIotHubSubscriptionResource(subscriptionResource).GetIotHubDescriptionsAsync(cancellationToken); } /// @@ -234,13 +222,17 @@ public static AsyncPageable GetIotHubDescriptionsAsyn /// IotHubResource_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIotHubDescriptions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIotHubDescriptions(cancellationToken); + return GetMockableIotHubSubscriptionResource(subscriptionResource).GetIotHubDescriptions(cancellationToken); } /// @@ -255,6 +247,10 @@ public static Pageable GetIotHubDescriptions(this Sub /// IotHubResource_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. @@ -262,9 +258,7 @@ public static Pageable GetIotHubDescriptions(this Sub /// is null. public static async Task> CheckIotHubNameAvailabilityAsync(this SubscriptionResource subscriptionResource, IotHubNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckIotHubNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableIotHubSubscriptionResource(subscriptionResource).CheckIotHubNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -279,6 +273,10 @@ public static async Task> CheckIotHubNa /// IotHubResource_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. @@ -286,9 +284,7 @@ public static async Task> CheckIotHubNa /// is null. public static Response CheckIotHubNameAvailability(this SubscriptionResource subscriptionResource, IotHubNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckIotHubNameAvailability(content, cancellationToken); + return GetMockableIotHubSubscriptionResource(subscriptionResource).CheckIotHubNameAvailability(content, cancellationToken); } /// @@ -303,13 +299,17 @@ public static Response CheckIotHubNameAvailabili /// ResourceProviderCommon_GetSubscriptionQuota /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIotHubUserSubscriptionQuotaAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIotHubUserSubscriptionQuotaAsync(cancellationToken); + return GetMockableIotHubSubscriptionResource(subscriptionResource).GetIotHubUserSubscriptionQuotaAsync(cancellationToken); } /// @@ -324,13 +324,17 @@ public static AsyncPageable GetIotHubUserSubscripti /// ResourceProviderCommon_GetSubscriptionQuota /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIotHubUserSubscriptionQuota(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIotHubUserSubscriptionQuota(cancellationToken); + return GetMockableIotHubSubscriptionResource(subscriptionResource).GetIotHubUserSubscriptionQuota(cancellationToken); } } } diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubArmClient.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubArmClient.cs new file mode 100644 index 0000000000000..571cc7ba53529 --- /dev/null +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.IotHub; + +namespace Azure.ResourceManager.IotHub.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableIotHubArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableIotHubArmClient() + { + } + + /// 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 MockableIotHubArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableIotHubArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotHubDescriptionResource GetIotHubDescriptionResource(ResourceIdentifier id) + { + IotHubDescriptionResource.ValidateResourceId(id); + return new IotHubDescriptionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EventHubConsumerGroupInfoResource GetEventHubConsumerGroupInfoResource(ResourceIdentifier id) + { + EventHubConsumerGroupInfoResource.ValidateResourceId(id); + return new EventHubConsumerGroupInfoResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotHubCertificateDescriptionResource GetIotHubCertificateDescriptionResource(ResourceIdentifier id) + { + IotHubCertificateDescriptionResource.ValidateResourceId(id); + return new IotHubCertificateDescriptionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotHubPrivateEndpointGroupInformationResource GetIotHubPrivateEndpointGroupInformationResource(ResourceIdentifier id) + { + IotHubPrivateEndpointGroupInformationResource.ValidateResourceId(id); + return new IotHubPrivateEndpointGroupInformationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotHubPrivateEndpointConnectionResource GetIotHubPrivateEndpointConnectionResource(ResourceIdentifier id) + { + IotHubPrivateEndpointConnectionResource.ValidateResourceId(id); + return new IotHubPrivateEndpointConnectionResource(Client, id); + } + } +} diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubResourceGroupResource.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubResourceGroupResource.cs new file mode 100644 index 0000000000000..943d955577951 --- /dev/null +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.IotHub; + +namespace Azure.ResourceManager.IotHub.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableIotHubResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableIotHubResourceGroupResource() + { + } + + /// 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 MockableIotHubResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of IotHubDescriptionResources in the ResourceGroupResource. + /// An object representing collection of IotHubDescriptionResources and their operations over a IotHubDescriptionResource. + public virtual IotHubDescriptionCollection GetIotHubDescriptions() + { + return GetCachedClient(client => new IotHubDescriptionCollection(client, Id)); + } + + /// + /// Get the non-security related metadata of an IoT hub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName} + /// + /// + /// Operation Id + /// IotHubResource_Get + /// + /// + /// + /// The name of the IoT hub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetIotHubDescriptionAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetIotHubDescriptions().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the non-security related metadata of an IoT hub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName} + /// + /// + /// Operation Id + /// IotHubResource_Get + /// + /// + /// + /// The name of the IoT hub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetIotHubDescription(string resourceName, CancellationToken cancellationToken = default) + { + return GetIotHubDescriptions().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubSubscriptionResource.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubSubscriptionResource.cs new file mode 100644 index 0000000000000..396d7f8d8b670 --- /dev/null +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/MockableIotHubSubscriptionResource.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.IotHub; +using Azure.ResourceManager.IotHub.Models; + +namespace Azure.ResourceManager.IotHub.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableIotHubSubscriptionResource : ArmResource + { + private ClientDiagnostics _iotHubDescriptionIotHubResourceClientDiagnostics; + private IotHubResourceRestOperations _iotHubDescriptionIotHubResourceRestClient; + private ClientDiagnostics _resourceProviderCommonClientDiagnostics; + private ResourceProviderCommonRestOperations _resourceProviderCommonRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableIotHubSubscriptionResource() + { + } + + /// 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 MockableIotHubSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics IotHubDescriptionIotHubResourceClientDiagnostics => _iotHubDescriptionIotHubResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IotHub", IotHubDescriptionResource.ResourceType.Namespace, Diagnostics); + private IotHubResourceRestOperations IotHubDescriptionIotHubResourceRestClient => _iotHubDescriptionIotHubResourceRestClient ??= new IotHubResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IotHubDescriptionResource.ResourceType)); + private ClientDiagnostics ResourceProviderCommonClientDiagnostics => _resourceProviderCommonClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IotHub", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceProviderCommonRestOperations ResourceProviderCommonRestClient => _resourceProviderCommonRestClient ??= new ResourceProviderCommonRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get all the IoT hubs in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs + /// + /// + /// Operation Id + /// IotHubResource_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetIotHubDescriptionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IotHubDescriptionIotHubResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotHubDescriptionIotHubResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IotHubDescriptionResource(Client, IotHubDescriptionData.DeserializeIotHubDescriptionData(e)), IotHubDescriptionIotHubResourceClientDiagnostics, Pipeline, "MockableIotHubSubscriptionResource.GetIotHubDescriptions", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the IoT hubs in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs + /// + /// + /// Operation Id + /// IotHubResource_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetIotHubDescriptions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IotHubDescriptionIotHubResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotHubDescriptionIotHubResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IotHubDescriptionResource(Client, IotHubDescriptionData.DeserializeIotHubDescriptionData(e)), IotHubDescriptionIotHubResourceClientDiagnostics, Pipeline, "MockableIotHubSubscriptionResource.GetIotHubDescriptions", "value", "nextLink", cancellationToken); + } + + /// + /// Check if an IoT hub name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability + /// + /// + /// Operation Id + /// IotHubResource_CheckNameAvailability + /// + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckIotHubNameAvailabilityAsync(IotHubNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = IotHubDescriptionIotHubResourceClientDiagnostics.CreateScope("MockableIotHubSubscriptionResource.CheckIotHubNameAvailability"); + scope.Start(); + try + { + var response = await IotHubDescriptionIotHubResourceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if an IoT hub name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability + /// + /// + /// Operation Id + /// IotHubResource_CheckNameAvailability + /// + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIotHubNameAvailability(IotHubNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = IotHubDescriptionIotHubResourceClientDiagnostics.CreateScope("MockableIotHubSubscriptionResource.CheckIotHubNameAvailability"); + scope.Start(); + try + { + var response = IotHubDescriptionIotHubResourceRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the number of free and paid iot hubs in the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages + /// + /// + /// Operation Id + /// ResourceProviderCommon_GetSubscriptionQuota + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetIotHubUserSubscriptionQuotaAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceProviderCommonRestClient.CreateGetSubscriptionQuotaRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, IotHubUserSubscriptionQuota.DeserializeIotHubUserSubscriptionQuota, ResourceProviderCommonClientDiagnostics, Pipeline, "MockableIotHubSubscriptionResource.GetIotHubUserSubscriptionQuota", "value", null, cancellationToken); + } + + /// + /// Get the number of free and paid iot hubs in the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages + /// + /// + /// Operation Id + /// ResourceProviderCommon_GetSubscriptionQuota + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetIotHubUserSubscriptionQuota(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceProviderCommonRestClient.CreateGetSubscriptionQuotaRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, IotHubUserSubscriptionQuota.DeserializeIotHubUserSubscriptionQuota, ResourceProviderCommonClientDiagnostics, Pipeline, "MockableIotHubSubscriptionResource.GetIotHubUserSubscriptionQuota", "value", null, cancellationToken); + } + } +} diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 8b1914375b6d9..0000000000000 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.IotHub -{ - /// 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 IotHubDescriptionResources in the ResourceGroupResource. - /// An object representing collection of IotHubDescriptionResources and their operations over a IotHubDescriptionResource. - public virtual IotHubDescriptionCollection GetIotHubDescriptions() - { - return GetCachedClient(Client => new IotHubDescriptionCollection(Client, Id)); - } - } -} diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 5f556690caabc..0000000000000 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.IotHub.Models; - -namespace Azure.ResourceManager.IotHub -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _iotHubDescriptionIotHubResourceClientDiagnostics; - private IotHubResourceRestOperations _iotHubDescriptionIotHubResourceRestClient; - private ClientDiagnostics _resourceProviderCommonClientDiagnostics; - private ResourceProviderCommonRestOperations _resourceProviderCommonRestClient; - - /// 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 IotHubDescriptionIotHubResourceClientDiagnostics => _iotHubDescriptionIotHubResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IotHub", IotHubDescriptionResource.ResourceType.Namespace, Diagnostics); - private IotHubResourceRestOperations IotHubDescriptionIotHubResourceRestClient => _iotHubDescriptionIotHubResourceRestClient ??= new IotHubResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IotHubDescriptionResource.ResourceType)); - private ClientDiagnostics ResourceProviderCommonClientDiagnostics => _resourceProviderCommonClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IotHub", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceProviderCommonRestOperations ResourceProviderCommonRestClient => _resourceProviderCommonRestClient ??= new ResourceProviderCommonRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get all the IoT hubs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs - /// - /// - /// Operation Id - /// IotHubResource_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetIotHubDescriptionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IotHubDescriptionIotHubResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotHubDescriptionIotHubResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IotHubDescriptionResource(Client, IotHubDescriptionData.DeserializeIotHubDescriptionData(e)), IotHubDescriptionIotHubResourceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIotHubDescriptions", "value", "nextLink", cancellationToken); - } - - /// - /// Get all the IoT hubs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/IotHubs - /// - /// - /// Operation Id - /// IotHubResource_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetIotHubDescriptions(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IotHubDescriptionIotHubResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotHubDescriptionIotHubResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IotHubDescriptionResource(Client, IotHubDescriptionData.DeserializeIotHubDescriptionData(e)), IotHubDescriptionIotHubResourceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIotHubDescriptions", "value", "nextLink", cancellationToken); - } - - /// - /// Check if an IoT hub name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability - /// - /// - /// Operation Id - /// IotHubResource_CheckNameAvailability - /// - /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - /// The cancellation token to use. - public virtual async Task> CheckIotHubNameAvailabilityAsync(IotHubNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = IotHubDescriptionIotHubResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckIotHubNameAvailability"); - scope.Start(); - try - { - var response = await IotHubDescriptionIotHubResourceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if an IoT hub name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability - /// - /// - /// Operation Id - /// IotHubResource_CheckNameAvailability - /// - /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. - /// The cancellation token to use. - public virtual Response CheckIotHubNameAvailability(IotHubNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = IotHubDescriptionIotHubResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckIotHubNameAvailability"); - scope.Start(); - try - { - var response = IotHubDescriptionIotHubResourceRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the number of free and paid iot hubs in the subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages - /// - /// - /// Operation Id - /// ResourceProviderCommon_GetSubscriptionQuota - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetIotHubUserSubscriptionQuotaAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceProviderCommonRestClient.CreateGetSubscriptionQuotaRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, IotHubUserSubscriptionQuota.DeserializeIotHubUserSubscriptionQuota, ResourceProviderCommonClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIotHubUserSubscriptionQuota", "value", null, cancellationToken); - } - - /// - /// Get the number of free and paid iot hubs in the subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages - /// - /// - /// Operation Id - /// ResourceProviderCommon_GetSubscriptionQuota - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetIotHubUserSubscriptionQuota(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceProviderCommonRestClient.CreateGetSubscriptionQuotaRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, IotHubUserSubscriptionQuota.DeserializeIotHubUserSubscriptionQuota, ResourceProviderCommonClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIotHubUserSubscriptionQuota", "value", null, cancellationToken); - } - } -} diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubCertificateDescriptionResource.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubCertificateDescriptionResource.cs index ee199af931a52..14f7183ed70c9 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubCertificateDescriptionResource.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubCertificateDescriptionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.IotHub public partial class IotHubCertificateDescriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}"; diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionResource.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionResource.cs index 68056aaafc295..7a8273787de9c 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionResource.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.IotHub public partial class IotHubDescriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}"; @@ -96,13 +99,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Gets a collection of EventHubConsumerGroupInfoResources in the IotHubDescription. /// The name of the Event Hub-compatible endpoint. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of EventHubConsumerGroupInfoResources and their operations over a EventHubConsumerGroupInfoResource. public virtual EventHubConsumerGroupInfoCollection GetEventHubConsumerGroupInfos(string eventHubEndpointName) { - Argument.AssertNotNullOrEmpty(eventHubEndpointName, nameof(eventHubEndpointName)); - return new EventHubConsumerGroupInfoCollection(Client, Id, eventHubEndpointName); } @@ -122,8 +123,8 @@ public virtual EventHubConsumerGroupInfoCollection GetEventHubConsumerGroupInfos /// The name of the Event Hub-compatible endpoint. /// The name of the consumer group to retrieve. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEventHubConsumerGroupInfoAsync(string eventHubEndpointName, string name, CancellationToken cancellationToken = default) { @@ -146,8 +147,8 @@ public virtual async Task> GetEventH /// The name of the Event Hub-compatible endpoint. /// The name of the consumer group to retrieve. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEventHubConsumerGroupInfo(string eventHubEndpointName, string name, CancellationToken cancellationToken = default) { @@ -158,7 +159,7 @@ public virtual Response GetEventHubConsumerGr /// An object representing collection of IotHubCertificateDescriptionResources and their operations over a IotHubCertificateDescriptionResource. public virtual IotHubCertificateDescriptionCollection GetIotHubCertificateDescriptions() { - return GetCachedClient(Client => new IotHubCertificateDescriptionCollection(Client, Id)); + return GetCachedClient(client => new IotHubCertificateDescriptionCollection(client, Id)); } /// @@ -176,8 +177,8 @@ public virtual IotHubCertificateDescriptionCollection GetIotHubCertificateDescri /// /// The name of the certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIotHubCertificateDescriptionAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -199,8 +200,8 @@ public virtual async Task> GetIot /// /// The name of the certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIotHubCertificateDescription(string certificateName, CancellationToken cancellationToken = default) { @@ -211,7 +212,7 @@ public virtual Response GetIotHubCertifica /// An object representing collection of IotHubPrivateEndpointGroupInformationResources and their operations over a IotHubPrivateEndpointGroupInformationResource. public virtual IotHubPrivateEndpointGroupInformationCollection GetAllIotHubPrivateEndpointGroupInformation() { - return GetCachedClient(Client => new IotHubPrivateEndpointGroupInformationCollection(Client, Id)); + return GetCachedClient(client => new IotHubPrivateEndpointGroupInformationCollection(client, Id)); } /// @@ -229,8 +230,8 @@ public virtual IotHubPrivateEndpointGroupInformationCollection GetAllIotHubPriva /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIotHubPrivateEndpointGroupInformationAsync(string groupId, CancellationToken cancellationToken = default) { @@ -252,8 +253,8 @@ public virtual async Task /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIotHubPrivateEndpointGroupInformation(string groupId, CancellationToken cancellationToken = default) { @@ -264,7 +265,7 @@ public virtual Response GetIotHub /// An object representing collection of IotHubPrivateEndpointConnectionResources and their operations over a IotHubPrivateEndpointConnectionResource. public virtual IotHubPrivateEndpointConnectionCollection GetIotHubPrivateEndpointConnections() { - return GetCachedClient(Client => new IotHubPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new IotHubPrivateEndpointConnectionCollection(client, Id)); } /// @@ -282,8 +283,8 @@ public virtual IotHubPrivateEndpointConnectionCollection GetIotHubPrivateEndpoin /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIotHubPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -305,8 +306,8 @@ public virtual async Task> Get /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIotHubPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointConnectionResource.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointConnectionResource.cs index 5db44e72a6eb1..02c3a1bc9c747 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointConnectionResource.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.IotHub public partial class IotHubPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointGroupInformationResource.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointGroupInformationResource.cs index b3725de2a7fd1..cf32e29dcf75c 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointGroupInformationResource.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubPrivateEndpointGroupInformationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.IotHub public partial class IotHubPrivateEndpointGroupInformationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The groupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string groupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}"; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs index f0a2e0cfa9d80..1378f6807d642 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs @@ -73,7 +73,7 @@ protected KeyVaultCollection() { } } public partial class KeyVaultData : Azure.ResourceManager.Models.TrackedResourceData { - public KeyVaultData(Azure.Core.AzureLocation location, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public KeyVaultData(Azure.Core.AzureLocation location, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties) { } public Azure.ResourceManager.KeyVault.Models.KeyVaultProperties Properties { get { throw null; } set { } } } public static partial class KeyVaultExtensions @@ -254,7 +254,7 @@ protected ManagedHsmCollection() { } } public partial class ManagedHsmData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedHsmData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedHsmData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.KeyVault.Models.ManagedHsmProperties Properties { get { throw null; } set { } } public Azure.ResourceManager.KeyVault.Models.ManagedHsmSku Sku { get { throw null; } set { } } } @@ -277,7 +277,7 @@ protected ManagedHsmPrivateEndpointConnectionCollection() { } } public partial class ManagedHsmPrivateEndpointConnectionData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedHsmPrivateEndpointConnectionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedHsmPrivateEndpointConnectionData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.Core.ResourceIdentifier PrivateEndpointId { get { throw null; } } public Azure.ResourceManager.KeyVault.Models.ManagedHsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } set { } } @@ -332,6 +332,52 @@ protected ManagedHsmResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.KeyVault.ManagedHsmData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.KeyVault.Mocking +{ + public partial class MockableKeyVaultArmClient : Azure.ResourceManager.ArmResource + { + protected MockableKeyVaultArmClient() { } + public virtual Azure.ResourceManager.KeyVault.DeletedKeyVaultResource GetDeletedKeyVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.KeyVault.DeletedManagedHsmResource GetDeletedManagedHsmResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.KeyVault.KeyVaultResource GetKeyVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.KeyVault.KeyVaultSecretResource GetKeyVaultSecretResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.KeyVault.ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.KeyVault.ManagedHsmResource GetManagedHsmResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableKeyVaultResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableKeyVaultResourceGroupResource() { } + public virtual Azure.Response GetKeyVault(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKeyVaultAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KeyVault.KeyVaultCollection GetKeyVaults() { throw null; } + public virtual Azure.Response GetManagedHsm(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedHsmAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KeyVault.ManagedHsmCollection GetManagedHsms() { throw null; } + } + public partial class MockableKeyVaultSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableKeyVaultSubscriptionResource() { } + public virtual Azure.Response CheckKeyVaultNameAvailability(Azure.ResourceManager.KeyVault.Models.KeyVaultNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckKeyVaultNameAvailabilityAsync(Azure.ResourceManager.KeyVault.Models.KeyVaultNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckManagedHsmNameAvailability(Azure.ResourceManager.KeyVault.Models.ManagedHsmNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckManagedHsmNameAvailabilityAsync(Azure.ResourceManager.KeyVault.Models.ManagedHsmNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeletedKeyVault(Azure.Core.AzureLocation location, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeletedKeyVaultAsync(Azure.Core.AzureLocation location, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KeyVault.DeletedKeyVaultCollection GetDeletedKeyVaults() { throw null; } + public virtual Azure.Pageable GetDeletedKeyVaults(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedKeyVaultsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeletedManagedHsm(Azure.Core.AzureLocation location, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeletedManagedHsmAsync(Azure.Core.AzureLocation location, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KeyVault.DeletedManagedHsmCollection GetDeletedManagedHsms() { throw null; } + public virtual Azure.Pageable GetDeletedManagedHsms(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedManagedHsmsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetKeyVaults(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetKeyVaultsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedHsms(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedHsmsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.KeyVault.Models { public enum AccessPolicyUpdateKind @@ -1004,7 +1050,7 @@ internal ManagedHsmPrivateEndpointConnectionItemData() { } } public partial class ManagedHsmPrivateLinkResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedHsmPrivateLinkResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedHsmPrivateLinkResourceData(Azure.Core.AzureLocation location) { } public string GroupId { get { throw null; } } public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs index 9ada71e417726..a06fb203e85aa 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.KeyVault public partial class DeletedKeyVaultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string vaultName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}"; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs index b164533eb9c3e..95bbb34f27329 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.KeyVault public partial class DeletedManagedHsmResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string name) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}"; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs index 0fb4611640706..4297940d6d0b7 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.KeyVault.Mocking; using Azure.ResourceManager.KeyVault.Models; using Azure.ResourceManager.Resources; @@ -19,176 +20,145 @@ namespace Azure.ResourceManager.KeyVault /// A class to add extension methods to Azure.ResourceManager.KeyVault. public static partial class KeyVaultExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableKeyVaultArmClient GetMockableKeyVaultArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableKeyVaultArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableKeyVaultResourceGroupResource GetMockableKeyVaultResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableKeyVaultResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableKeyVaultSubscriptionResource GetMockableKeyVaultSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableKeyVaultSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region KeyVaultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KeyVaultResource GetKeyVaultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KeyVaultResource.ValidateResourceId(id); - return new KeyVaultResource(client, id); - } - ); + return GetMockableKeyVaultArmClient(client).GetKeyVaultResource(id); } - #endregion - #region DeletedKeyVaultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeletedKeyVaultResource GetDeletedKeyVaultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeletedKeyVaultResource.ValidateResourceId(id); - return new DeletedKeyVaultResource(client, id); - } - ); + return GetMockableKeyVaultArmClient(client).GetDeletedKeyVaultResource(id); } - #endregion - #region KeyVaultPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KeyVaultPrivateEndpointConnectionResource.ValidateResourceId(id); - return new KeyVaultPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableKeyVaultArmClient(client).GetKeyVaultPrivateEndpointConnectionResource(id); } - #endregion - #region ManagedHsmResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedHsmResource GetManagedHsmResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedHsmResource.ValidateResourceId(id); - return new ManagedHsmResource(client, id); - } - ); + return GetMockableKeyVaultArmClient(client).GetManagedHsmResource(id); } - #endregion - #region DeletedManagedHsmResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeletedManagedHsmResource GetDeletedManagedHsmResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeletedManagedHsmResource.ValidateResourceId(id); - return new DeletedManagedHsmResource(client, id); - } - ); + return GetMockableKeyVaultArmClient(client).GetDeletedManagedHsmResource(id); } - #endregion - #region ManagedHsmPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedHsmPrivateEndpointConnectionResource.ValidateResourceId(id); - return new ManagedHsmPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableKeyVaultArmClient(client).GetManagedHsmPrivateEndpointConnectionResource(id); } - #endregion - #region KeyVaultSecretResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KeyVaultSecretResource GetKeyVaultSecretResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KeyVaultSecretResource.ValidateResourceId(id); - return new KeyVaultSecretResource(client, id); - } - ); + return GetMockableKeyVaultArmClient(client).GetKeyVaultSecretResource(id); } - #endregion - /// Gets a collection of KeyVaultResources in the ResourceGroupResource. + /// + /// Gets a collection of KeyVaultResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of KeyVaultResources and their operations over a KeyVaultResource. public static KeyVaultCollection GetKeyVaults(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetKeyVaults(); + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaults(); } /// @@ -203,16 +173,20 @@ public static KeyVaultCollection GetKeyVaults(this ResourceGroupResource resourc /// Vaults_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetKeyVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetKeyVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultAsync(vaultName, cancellationToken).ConfigureAwait(false); } /// @@ -227,24 +201,34 @@ public static async Task> GetKeyVaultAsync(this Resou /// Vaults_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetKeyVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetKeyVaults().Get(vaultName, cancellationToken); + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVault(vaultName, cancellationToken); } - /// Gets a collection of ManagedHsmResources in the ResourceGroupResource. + /// + /// Gets a collection of ManagedHsmResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ManagedHsmResources and their operations over a ManagedHsmResource. public static ManagedHsmCollection GetManagedHsms(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetManagedHsms(); + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsms(); } /// @@ -259,16 +243,20 @@ public static ManagedHsmCollection GetManagedHsms(this ResourceGroupResource res /// ManagedHsms_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed HSM Pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedHsmAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetManagedHsms().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsmAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -283,24 +271,34 @@ public static async Task> GetManagedHsmAsync(this R /// ManagedHsms_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed HSM Pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedHsm(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetManagedHsms().Get(name, cancellationToken); + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsm(name, cancellationToken); } - /// Gets a collection of DeletedKeyVaultResources in the SubscriptionResource. + /// + /// Gets a collection of DeletedKeyVaultResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DeletedKeyVaultResources and their operations over a DeletedKeyVaultResource. public static DeletedKeyVaultCollection GetDeletedKeyVaults(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedKeyVaults(); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaults(); } /// @@ -315,17 +313,21 @@ public static DeletedKeyVaultCollection GetDeletedKeyVaults(this SubscriptionRes /// Vaults_GetDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the deleted vault. /// The name of the vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDeletedKeyVaultAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string vaultName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetDeletedKeyVaults().GetAsync(location, vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaultAsync(location, vaultName, cancellationToken).ConfigureAwait(false); } /// @@ -340,25 +342,35 @@ public static async Task> GetDeletedKeyVaultAs /// Vaults_GetDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the deleted vault. /// The name of the vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDeletedKeyVault(this SubscriptionResource subscriptionResource, AzureLocation location, string vaultName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetDeletedKeyVaults().Get(location, vaultName, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVault(location, vaultName, cancellationToken); } - /// Gets a collection of DeletedManagedHsmResources in the SubscriptionResource. + /// + /// Gets a collection of DeletedManagedHsmResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DeletedManagedHsmResources and their operations over a DeletedManagedHsmResource. public static DeletedManagedHsmCollection GetDeletedManagedHsms(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedManagedHsms(); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsms(); } /// @@ -373,17 +385,21 @@ public static DeletedManagedHsmCollection GetDeletedManagedHsms(this Subscriptio /// ManagedHsms_GetDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the deleted managed HSM. /// The name of the deleted managed HSM. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDeletedManagedHsmAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string name, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetDeletedManagedHsms().GetAsync(location, name, cancellationToken).ConfigureAwait(false); + return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsmAsync(location, name, cancellationToken).ConfigureAwait(false); } /// @@ -398,17 +414,21 @@ public static async Task> GetDeletedManagedH /// ManagedHsms_GetDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the deleted managed HSM. /// The name of the deleted managed HSM. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDeletedManagedHsm(this SubscriptionResource subscriptionResource, AzureLocation location, string name, CancellationToken cancellationToken = default) { - return subscriptionResource.GetDeletedManagedHsms().Get(location, name, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsm(location, name, cancellationToken); } /// @@ -423,6 +443,10 @@ public static Response GetDeletedManagedHsm(this Subs /// Vaults_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maximum number of results to return. @@ -430,7 +454,7 @@ public static Response GetDeletedManagedHsm(this Subs /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetKeyVaultsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetKeyVaultsAsync(top, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetKeyVaultsAsync(top, cancellationToken); } /// @@ -445,6 +469,10 @@ public static AsyncPageable GetKeyVaultsAsync(this Subscriptio /// Vaults_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maximum number of results to return. @@ -452,7 +480,7 @@ public static AsyncPageable GetKeyVaultsAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetKeyVaults(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetKeyVaults(top, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetKeyVaults(top, cancellationToken); } /// @@ -467,13 +495,17 @@ public static Pageable GetKeyVaults(this SubscriptionResource /// Vaults_ListDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedKeyVaultsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedKeyVaultsAsync(cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaultsAsync(cancellationToken); } /// @@ -488,13 +520,17 @@ public static AsyncPageable GetDeletedKeyVaultsAsync(th /// Vaults_ListDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedKeyVaults(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedKeyVaults(cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaults(cancellationToken); } /// @@ -509,6 +545,10 @@ public static Pageable GetDeletedKeyVaults(this Subscri /// Vaults_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the vault. @@ -516,9 +556,7 @@ public static Pageable GetDeletedKeyVaults(this Subscri /// is null. public static async Task> CheckKeyVaultNameAvailabilityAsync(this SubscriptionResource subscriptionResource, KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckKeyVaultNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckKeyVaultNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -533,6 +571,10 @@ public static async Task> CheckKeyVault /// Vaults_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the vault. @@ -540,9 +582,7 @@ public static async Task> CheckKeyVault /// is null. public static Response CheckKeyVaultNameAvailability(this SubscriptionResource subscriptionResource, KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckKeyVaultNameAvailability(content, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckKeyVaultNameAvailability(content, cancellationToken); } /// @@ -557,6 +597,10 @@ public static Response CheckKeyVaultNameAvailabi /// ManagedHsms_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maximum number of results to return. @@ -564,7 +608,7 @@ public static Response CheckKeyVaultNameAvailabi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetManagedHsmsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedHsmsAsync(top, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetManagedHsmsAsync(top, cancellationToken); } /// @@ -579,6 +623,10 @@ public static AsyncPageable GetManagedHsmsAsync(this Subscri /// ManagedHsms_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maximum number of results to return. @@ -586,7 +634,7 @@ public static AsyncPageable GetManagedHsmsAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetManagedHsms(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedHsms(top, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetManagedHsms(top, cancellationToken); } /// @@ -601,13 +649,17 @@ public static Pageable GetManagedHsms(this SubscriptionResou /// ManagedHsms_ListDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedManagedHsmsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedManagedHsmsAsync(cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsmsAsync(cancellationToken); } /// @@ -622,13 +674,17 @@ public static AsyncPageable GetDeletedManagedHsmsAsyn /// ManagedHsms_ListDeleted /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedManagedHsms(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedManagedHsms(cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsms(cancellationToken); } /// @@ -643,6 +699,10 @@ public static Pageable GetDeletedManagedHsms(this Sub /// ManagedHsms_CheckMhsmNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed hsm. @@ -650,9 +710,7 @@ public static Pageable GetDeletedManagedHsms(this Sub /// is null. public static async Task> CheckManagedHsmNameAvailabilityAsync(this SubscriptionResource subscriptionResource, ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckManagedHsmNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckManagedHsmNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -667,6 +725,10 @@ public static async Task> CheckManage /// ManagedHsms_CheckMhsmNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed hsm. @@ -674,9 +736,7 @@ public static async Task> CheckManage /// is null. public static Response CheckManagedHsmNameAvailability(this SubscriptionResource subscriptionResource, ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckManagedHsmNameAvailability(content, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckManagedHsmNameAvailability(content, cancellationToken); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs new file mode 100644 index 0000000000000..ce27107766701 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableKeyVaultArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableKeyVaultArmClient() + { + } + + /// 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 MockableKeyVaultArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableKeyVaultArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KeyVaultResource GetKeyVaultResource(ResourceIdentifier id) + { + KeyVaultResource.ValidateResourceId(id); + return new KeyVaultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeletedKeyVaultResource GetDeletedKeyVaultResource(ResourceIdentifier id) + { + DeletedKeyVaultResource.ValidateResourceId(id); + return new DeletedKeyVaultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(ResourceIdentifier id) + { + KeyVaultPrivateEndpointConnectionResource.ValidateResourceId(id); + return new KeyVaultPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedHsmResource GetManagedHsmResource(ResourceIdentifier id) + { + ManagedHsmResource.ValidateResourceId(id); + return new ManagedHsmResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeletedManagedHsmResource GetDeletedManagedHsmResource(ResourceIdentifier id) + { + DeletedManagedHsmResource.ValidateResourceId(id); + return new DeletedManagedHsmResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(ResourceIdentifier id) + { + ManagedHsmPrivateEndpointConnectionResource.ValidateResourceId(id); + return new ManagedHsmPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KeyVaultSecretResource GetKeyVaultSecretResource(ResourceIdentifier id) + { + KeyVaultSecretResource.ValidateResourceId(id); + return new KeyVaultSecretResource(Client, id); + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs new file mode 100644 index 0000000000000..219b960d37ecc --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableKeyVaultResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableKeyVaultResourceGroupResource() + { + } + + /// 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 MockableKeyVaultResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of KeyVaultResources in the ResourceGroupResource. + /// An object representing collection of KeyVaultResources and their operations over a KeyVaultResource. + public virtual KeyVaultCollection GetKeyVaults() + { + return GetCachedClient(client => new KeyVaultCollection(client, Id)); + } + + /// + /// Gets the specified Azure key vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_Get + /// + /// + /// + /// The name of the vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKeyVaultAsync(string vaultName, CancellationToken cancellationToken = default) + { + return await GetKeyVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Azure key vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_Get + /// + /// + /// + /// The name of the vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKeyVault(string vaultName, CancellationToken cancellationToken = default) + { + return GetKeyVaults().Get(vaultName, cancellationToken); + } + + /// Gets a collection of ManagedHsmResources in the ResourceGroupResource. + /// An object representing collection of ManagedHsmResources and their operations over a ManagedHsmResource. + public virtual ManagedHsmCollection GetManagedHsms() + { + return GetCachedClient(client => new ManagedHsmCollection(client, Id)); + } + + /// + /// Gets the specified managed HSM Pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// + /// + /// Operation Id + /// ManagedHsms_Get + /// + /// + /// + /// The name of the managed HSM Pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedHsmAsync(string name, CancellationToken cancellationToken = default) + { + return await GetManagedHsms().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified managed HSM Pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// + /// + /// Operation Id + /// ManagedHsms_Get + /// + /// + /// + /// The name of the managed HSM Pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedHsm(string name, CancellationToken cancellationToken = default) + { + return GetManagedHsms().Get(name, cancellationToken); + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs new file mode 100644 index 0000000000000..423e180b20859 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs @@ -0,0 +1,486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.KeyVault; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableKeyVaultSubscriptionResource : ArmResource + { + private ClientDiagnostics _keyVaultVaultsClientDiagnostics; + private VaultsRestOperations _keyVaultVaultsRestClient; + private ClientDiagnostics _vaultsClientDiagnostics; + private VaultsRestOperations _vaultsRestClient; + private ClientDiagnostics _managedHsmClientDiagnostics; + private ManagedHsmsRestOperations _managedHsmRestClient; + private ClientDiagnostics _managedHsmsClientDiagnostics; + private ManagedHsmsRestOperations _managedHsmsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableKeyVaultSubscriptionResource() + { + } + + /// 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 MockableKeyVaultSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics KeyVaultVaultsClientDiagnostics => _keyVaultVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultResource.ResourceType.Namespace, Diagnostics); + private VaultsRestOperations KeyVaultVaultsRestClient => _keyVaultVaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KeyVaultResource.ResourceType)); + private ClientDiagnostics VaultsClientDiagnostics => _vaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private VaultsRestOperations VaultsRestClient => _vaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ManagedHsmClientDiagnostics => _managedHsmClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHsmResource.ResourceType.Namespace, Diagnostics); + private ManagedHsmsRestOperations ManagedHsmRestClient => _managedHsmRestClient ??= new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedHsmResource.ResourceType)); + private ClientDiagnostics ManagedHsmsClientDiagnostics => _managedHsmsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ManagedHsmsRestOperations ManagedHsmsRestClient => _managedHsmsRestClient ??= new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DeletedKeyVaultResources in the SubscriptionResource. + /// An object representing collection of DeletedKeyVaultResources and their operations over a DeletedKeyVaultResource. + public virtual DeletedKeyVaultCollection GetDeletedKeyVaults() + { + return GetCachedClient(client => new DeletedKeyVaultCollection(client, Id)); + } + + /// + /// Gets the deleted Azure key vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_GetDeleted + /// + /// + /// + /// The location of the deleted vault. + /// The name of the vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeletedKeyVaultAsync(AzureLocation location, string vaultName, CancellationToken cancellationToken = default) + { + return await GetDeletedKeyVaults().GetAsync(location, vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the deleted Azure key vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_GetDeleted + /// + /// + /// + /// The location of the deleted vault. + /// The name of the vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeletedKeyVault(AzureLocation location, string vaultName, CancellationToken cancellationToken = default) + { + return GetDeletedKeyVaults().Get(location, vaultName, cancellationToken); + } + + /// Gets a collection of DeletedManagedHsmResources in the SubscriptionResource. + /// An object representing collection of DeletedManagedHsmResources and their operations over a DeletedManagedHsmResource. + public virtual DeletedManagedHsmCollection GetDeletedManagedHsms() + { + return GetCachedClient(client => new DeletedManagedHsmCollection(client, Id)); + } + + /// + /// Gets the specified deleted managed HSM. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name} + /// + /// + /// Operation Id + /// ManagedHsms_GetDeleted + /// + /// + /// + /// The location of the deleted managed HSM. + /// The name of the deleted managed HSM. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeletedManagedHsmAsync(AzureLocation location, string name, CancellationToken cancellationToken = default) + { + return await GetDeletedManagedHsms().GetAsync(location, name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified deleted managed HSM. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name} + /// + /// + /// Operation Id + /// ManagedHsms_GetDeleted + /// + /// + /// + /// The location of the deleted managed HSM. + /// The name of the deleted managed HSM. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeletedManagedHsm(AzureLocation location, string name, CancellationToken cancellationToken = default) + { + return GetDeletedManagedHsms().Get(location, name, cancellationToken); + } + + /// + /// The List operation gets information about the vaults associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults + /// + /// + /// Operation Id + /// Vaults_ListBySubscription + /// + /// + /// + /// Maximum number of results to return. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetKeyVaultsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), KeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetKeyVaults", "value", "nextLink", cancellationToken); + } + + /// + /// The List operation gets information about the vaults associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults + /// + /// + /// Operation Id + /// Vaults_ListBySubscription + /// + /// + /// + /// Maximum number of results to return. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetKeyVaults(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), KeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetKeyVaults", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about the deleted vaults in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults + /// + /// + /// Operation Id + /// Vaults_ListDeleted + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedKeyVaultsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), VaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about the deleted vaults in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults + /// + /// + /// Operation Id + /// Vaults_ListDeleted + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedKeyVaults(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), VaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults", "value", "nextLink", cancellationToken); + } + + /// + /// Checks that the vault name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability + /// + /// + /// Operation Id + /// Vaults_CheckNameAvailability + /// + /// + /// + /// The name of the vault. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckKeyVaultNameAvailabilityAsync(KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = KeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability"); + scope.Start(); + try + { + var response = await KeyVaultVaultsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the vault name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability + /// + /// + /// Operation Id + /// Vaults_CheckNameAvailability + /// + /// + /// + /// The name of the vault. + /// The cancellation token to use. + /// is null. + public virtual Response CheckKeyVaultNameAvailability(KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = KeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability"); + scope.Start(); + try + { + var response = KeyVaultVaultsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The List operation gets information about the managed HSM Pools associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs + /// + /// + /// Operation Id + /// ManagedHsms_ListBySubscription + /// + /// + /// + /// Maximum number of results to return. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedHsmsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmResource(Client, ManagedHsmData.DeserializeManagedHsmData(e)), ManagedHsmClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetManagedHsms", "value", "nextLink", cancellationToken); + } + + /// + /// The List operation gets information about the managed HSM Pools associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs + /// + /// + /// Operation Id + /// ManagedHsms_ListBySubscription + /// + /// + /// + /// Maximum number of results to return. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedHsms(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmResource(Client, ManagedHsmData.DeserializeManagedHsmData(e)), ManagedHsmClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetManagedHsms", "value", "nextLink", cancellationToken); + } + + /// + /// The List operation gets information about the deleted managed HSMs associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs + /// + /// + /// Operation Id + /// ManagedHsms_ListDeleted + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedManagedHsmsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmsRestClient.CreateListDeletedRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedManagedHsmResource(Client, DeletedManagedHsmData.DeserializeDeletedManagedHsmData(e)), ManagedHsmsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedManagedHsms", "value", "nextLink", cancellationToken); + } + + /// + /// The List operation gets information about the deleted managed HSMs associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs + /// + /// + /// Operation Id + /// ManagedHsms_ListDeleted + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedManagedHsms(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmsRestClient.CreateListDeletedRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedManagedHsmResource(Client, DeletedManagedHsmData.DeserializeDeletedManagedHsmData(e)), ManagedHsmsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedManagedHsms", "value", "nextLink", cancellationToken); + } + + /// + /// Checks that the managed hsm name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability + /// + /// + /// Operation Id + /// ManagedHsms_CheckMhsmNameAvailability + /// + /// + /// + /// The name of the managed hsm. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckManagedHsmNameAvailabilityAsync(ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ManagedHsmClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckManagedHsmNameAvailability"); + scope.Start(); + try + { + var response = await ManagedHsmRestClient.CheckManagedHsmNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the managed hsm name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability + /// + /// + /// Operation Id + /// ManagedHsms_CheckMhsmNameAvailability + /// + /// + /// + /// The name of the managed hsm. + /// The cancellation token to use. + /// is null. + public virtual Response CheckManagedHsmNameAvailability(ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ManagedHsmClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckManagedHsmNameAvailability"); + scope.Start(); + try + { + var response = ManagedHsmRestClient.CheckManagedHsmNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index bd48bddaf8005..0000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.KeyVault -{ - /// 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 KeyVaultResources in the ResourceGroupResource. - /// An object representing collection of KeyVaultResources and their operations over a KeyVaultResource. - public virtual KeyVaultCollection GetKeyVaults() - { - return GetCachedClient(Client => new KeyVaultCollection(Client, Id)); - } - - /// Gets a collection of ManagedHsmResources in the ResourceGroupResource. - /// An object representing collection of ManagedHsmResources and their operations over a ManagedHsmResource. - public virtual ManagedHsmCollection GetManagedHsms() - { - return GetCachedClient(Client => new ManagedHsmCollection(Client, Id)); - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d95aa8c4e3a40..0000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.KeyVault.Models; - -namespace Azure.ResourceManager.KeyVault -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _keyVaultVaultsClientDiagnostics; - private VaultsRestOperations _keyVaultVaultsRestClient; - private ClientDiagnostics _vaultsClientDiagnostics; - private VaultsRestOperations _vaultsRestClient; - private ClientDiagnostics _managedHsmClientDiagnostics; - private ManagedHsmsRestOperations _managedHsmRestClient; - private ClientDiagnostics _managedHsmsClientDiagnostics; - private ManagedHsmsRestOperations _managedHsmsRestClient; - - /// 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 KeyVaultVaultsClientDiagnostics => _keyVaultVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultResource.ResourceType.Namespace, Diagnostics); - private VaultsRestOperations KeyVaultVaultsRestClient => _keyVaultVaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KeyVaultResource.ResourceType)); - private ClientDiagnostics VaultsClientDiagnostics => _vaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private VaultsRestOperations VaultsRestClient => _vaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ManagedHsmClientDiagnostics => _managedHsmClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHsmResource.ResourceType.Namespace, Diagnostics); - private ManagedHsmsRestOperations ManagedHsmRestClient => _managedHsmRestClient ??= new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedHsmResource.ResourceType)); - private ClientDiagnostics ManagedHsmsClientDiagnostics => _managedHsmsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ManagedHsmsRestOperations ManagedHsmsRestClient => _managedHsmsRestClient ??= new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DeletedKeyVaultResources in the SubscriptionResource. - /// An object representing collection of DeletedKeyVaultResources and their operations over a DeletedKeyVaultResource. - public virtual DeletedKeyVaultCollection GetDeletedKeyVaults() - { - return GetCachedClient(Client => new DeletedKeyVaultCollection(Client, Id)); - } - - /// Gets a collection of DeletedManagedHsmResources in the SubscriptionResource. - /// An object representing collection of DeletedManagedHsmResources and their operations over a DeletedManagedHsmResource. - public virtual DeletedManagedHsmCollection GetDeletedManagedHsms() - { - return GetCachedClient(Client => new DeletedManagedHsmCollection(Client, Id)); - } - - /// - /// The List operation gets information about the vaults associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults - /// - /// - /// Operation Id - /// Vaults_ListBySubscription - /// - /// - /// - /// Maximum number of results to return. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetKeyVaultsAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), KeyVaultVaultsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetKeyVaults", "value", "nextLink", cancellationToken); - } - - /// - /// The List operation gets information about the vaults associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults - /// - /// - /// Operation Id - /// Vaults_ListBySubscription - /// - /// - /// - /// Maximum number of results to return. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetKeyVaults(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), KeyVaultVaultsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetKeyVaults", "value", "nextLink", cancellationToken); - } - - /// - /// Gets information about the deleted vaults in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults - /// - /// - /// Operation Id - /// Vaults_ListDeleted - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedKeyVaultsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), VaultsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedKeyVaults", "value", "nextLink", cancellationToken); - } - - /// - /// Gets information about the deleted vaults in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults - /// - /// - /// Operation Id - /// Vaults_ListDeleted - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedKeyVaults(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), VaultsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedKeyVaults", "value", "nextLink", cancellationToken); - } - - /// - /// Checks that the vault name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability - /// - /// - /// Operation Id - /// Vaults_CheckNameAvailability - /// - /// - /// - /// The name of the vault. - /// The cancellation token to use. - public virtual async Task> CheckKeyVaultNameAvailabilityAsync(KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = KeyVaultVaultsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckKeyVaultNameAvailability"); - scope.Start(); - try - { - var response = await KeyVaultVaultsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the vault name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability - /// - /// - /// Operation Id - /// Vaults_CheckNameAvailability - /// - /// - /// - /// The name of the vault. - /// The cancellation token to use. - public virtual Response CheckKeyVaultNameAvailability(KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = KeyVaultVaultsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckKeyVaultNameAvailability"); - scope.Start(); - try - { - var response = KeyVaultVaultsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// The List operation gets information about the managed HSM Pools associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs - /// - /// - /// Operation Id - /// ManagedHsms_ListBySubscription - /// - /// - /// - /// Maximum number of results to return. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedHsmsAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmResource(Client, ManagedHsmData.DeserializeManagedHsmData(e)), ManagedHsmClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedHsms", "value", "nextLink", cancellationToken); - } - - /// - /// The List operation gets information about the managed HSM Pools associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs - /// - /// - /// Operation Id - /// ManagedHsms_ListBySubscription - /// - /// - /// - /// Maximum number of results to return. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedHsms(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmResource(Client, ManagedHsmData.DeserializeManagedHsmData(e)), ManagedHsmClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedHsms", "value", "nextLink", cancellationToken); - } - - /// - /// The List operation gets information about the deleted managed HSMs associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs - /// - /// - /// Operation Id - /// ManagedHsms_ListDeleted - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedManagedHsmsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmsRestClient.CreateListDeletedRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedManagedHsmResource(Client, DeletedManagedHsmData.DeserializeDeletedManagedHsmData(e)), ManagedHsmsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedManagedHsms", "value", "nextLink", cancellationToken); - } - - /// - /// The List operation gets information about the deleted managed HSMs associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs - /// - /// - /// Operation Id - /// ManagedHsms_ListDeleted - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedManagedHsms(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmsRestClient.CreateListDeletedRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedManagedHsmResource(Client, DeletedManagedHsmData.DeserializeDeletedManagedHsmData(e)), ManagedHsmsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedManagedHsms", "value", "nextLink", cancellationToken); - } - - /// - /// Checks that the managed hsm name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability - /// - /// - /// Operation Id - /// ManagedHsms_CheckMhsmNameAvailability - /// - /// - /// - /// The name of the managed hsm. - /// The cancellation token to use. - public virtual async Task> CheckManagedHsmNameAvailabilityAsync(ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ManagedHsmClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckManagedHsmNameAvailability"); - scope.Start(); - try - { - var response = await ManagedHsmRestClient.CheckManagedHsmNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the managed hsm name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability - /// - /// - /// Operation Id - /// ManagedHsms_CheckMhsmNameAvailability - /// - /// - /// - /// The name of the managed hsm. - /// The cancellation token to use. - public virtual Response CheckManagedHsmNameAvailability(ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ManagedHsmClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckManagedHsmNameAvailability"); - scope.Start(); - try - { - var response = ManagedHsmRestClient.CheckManagedHsmNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs index 844f47ae2aa54..4453683b22b52 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.KeyVault public partial class KeyVaultPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs index 749b60a96b740..b109835150a66 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.KeyVault public partial class KeyVaultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of KeyVaultPrivateEndpointConnectionResources and their operations over a KeyVaultPrivateEndpointConnectionResource. public virtual KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections() { - return GetCachedClient(Client => new KeyVaultPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new KeyVaultPrivateEndpointConnectionCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEnd /// /// Name of the private endpoint connection associated with the key vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKeyVaultPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> G /// /// Name of the private endpoint connection associated with the key vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKeyVaultPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetKeyVaultPr /// An object representing collection of KeyVaultSecretResources and their operations over a KeyVaultSecretResource. public virtual KeyVaultSecretCollection GetKeyVaultSecrets() { - return GetCachedClient(Client => new KeyVaultSecretCollection(Client, Id)); + return GetCachedClient(client => new KeyVaultSecretCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual KeyVaultSecretCollection GetKeyVaultSecrets() /// /// The name of the secret. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKeyVaultSecretAsync(string secretName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> GetKeyVaultSecretAsy /// /// The name of the secret. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKeyVaultSecret(string secretName, CancellationToken cancellationToken = default) { diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs index 40e0f0bb83bf8..3e55bf8f2f46a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.KeyVault public partial class KeyVaultSecretResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The secretName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string secretName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs index 792bd2f0bcbbe..82a1c1728829f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.KeyVault public partial class ManagedHsmPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs index 2b6c39485b515..7ab5d1d25593d 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.KeyVault public partial class ManagedHsmResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"; @@ -102,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedHsmPrivateEndpointConnectionResources and their operations over a ManagedHsmPrivateEndpointConnectionResource. public virtual ManagedHsmPrivateEndpointConnectionCollection GetManagedHsmPrivateEndpointConnections() { - return GetCachedClient(Client => new ManagedHsmPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ManagedHsmPrivateEndpointConnectionCollection(client, Id)); } /// @@ -120,8 +123,8 @@ public virtual ManagedHsmPrivateEndpointConnectionCollection GetManagedHsmPrivat /// /// Name of the private endpoint connection associated with the managed hsm pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedHsmPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -143,8 +146,8 @@ public virtual async Task> /// /// Name of the private endpoint connection associated with the managed hsm pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedHsmPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/Azure.ResourceManager.KubernetesConfiguration.sln b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/Azure.ResourceManager.KubernetesConfiguration.sln index d2dff0306e017..33aa028174696 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/Azure.ResourceManager.KubernetesConfiguration.sln +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/Azure.ResourceManager.KubernetesConfiguration.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{6A779710-1385-445C-BAD7-EBF2E6A32B5C}") = "Azure.ResourceManager.KubernetesConfiguration", "src\Azure.ResourceManager.KubernetesConfiguration.csproj", "{16AF8428-5296-4267-BE2E-398ED8B1116B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.KubernetesConfiguration", "src\Azure.ResourceManager.KubernetesConfiguration.csproj", "{16AF8428-5296-4267-BE2E-398ED8B1116B}" EndProject -Project("{6A779710-1385-445C-BAD7-EBF2E6A32B5C}") = "Azure.ResourceManager.KubernetesConfiguration.Tests", "tests\Azure.ResourceManager.KubernetesConfiguration.Tests.csproj", "{70B71F10-69C4-41A0-AEB6-14D85FB3676F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.KubernetesConfiguration.Tests", "tests\Azure.ResourceManager.KubernetesConfiguration.Tests.csproj", "{70B71F10-69C4-41A0-AEB6-14D85FB3676F}" EndProject -Project("{6A779710-1385-445C-BAD7-EBF2E6A32B5C}") = "Azure.ResourceManager.KubernetesConfiguration.Samples", "samples\Azure.ResourceManager.KubernetesConfiguration.Samples.csproj", "{ED83F800-3669-4D21-969C-363874964B7B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.KubernetesConfiguration.Samples", "samples\Azure.ResourceManager.KubernetesConfiguration.Samples.csproj", "{ED83F800-3669-4D21-969C-363874964B7B}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3FB2426E-ED1E-4F15-BF20-2F4C5C1CFBE0} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {70B71F10-69C4-41A0-AEB6-14D85FB3676F}.Release|x64.Build.0 = Release|Any CPU {70B71F10-69C4-41A0-AEB6-14D85FB3676F}.Release|x86.ActiveCfg = Release|Any CPU {70B71F10-69C4-41A0-AEB6-14D85FB3676F}.Release|x86.Build.0 = Release|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Debug|x64.ActiveCfg = Debug|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Debug|x64.Build.0 = Debug|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Debug|x86.ActiveCfg = Debug|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Debug|x86.Build.0 = Debug|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Release|Any CPU.Build.0 = Release|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Release|x64.ActiveCfg = Release|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Release|x64.Build.0 = Release|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Release|x86.ActiveCfg = Release|Any CPU + {ED83F800-3669-4D21-969C-363874964B7B}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3FB2426E-ED1E-4F15-BF20-2F4C5C1CFBE0} EndGlobalSection EndGlobal diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/api/Azure.ResourceManager.KubernetesConfiguration.netstandard2.0.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/api/Azure.ResourceManager.KubernetesConfiguration.netstandard2.0.cs index a04bc4811c3a8..4afeacd3b58f2 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/api/Azure.ResourceManager.KubernetesConfiguration.netstandard2.0.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/api/Azure.ResourceManager.KubernetesConfiguration.netstandard2.0.cs @@ -168,6 +168,29 @@ protected KubernetesSourceControlConfigurationResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.KubernetesConfiguration.KubernetesSourceControlConfigurationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.KubernetesConfiguration.Mocking +{ + public partial class MockableKubernetesConfigurationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableKubernetesConfigurationArmClient() { } + public virtual Azure.ResourceManager.KubernetesConfiguration.KubernetesClusterExtensionResource GetKubernetesClusterExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.KubernetesConfiguration.KubernetesFluxConfigurationResource GetKubernetesFluxConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.KubernetesConfiguration.KubernetesSourceControlConfigurationResource GetKubernetesSourceControlConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableKubernetesConfigurationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableKubernetesConfigurationResourceGroupResource() { } + public virtual Azure.Response GetKubernetesClusterExtension(string clusterRp, string clusterResourceName, string clusterName, string extensionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKubernetesClusterExtensionAsync(string clusterRp, string clusterResourceName, string clusterName, string extensionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KubernetesConfiguration.KubernetesClusterExtensionCollection GetKubernetesClusterExtensions(string clusterRp, string clusterResourceName, string clusterName) { throw null; } + public virtual Azure.Response GetKubernetesFluxConfiguration(string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKubernetesFluxConfigurationAsync(string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KubernetesConfiguration.KubernetesFluxConfigurationCollection GetKubernetesFluxConfigurations(string clusterRp, string clusterResourceName, string clusterName) { throw null; } + public virtual Azure.Response GetKubernetesSourceControlConfiguration(string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKubernetesSourceControlConfigurationAsync(string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KubernetesConfiguration.KubernetesSourceControlConfigurationCollection GetKubernetesSourceControlConfigurations(string clusterRp, string clusterResourceName, string clusterName) { throw null; } + } +} namespace Azure.ResourceManager.KubernetesConfiguration.Models { public static partial class ArmKubernetesConfigurationModelFactory diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/KubernetesConfigurationExtensions.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/KubernetesConfigurationExtensions.cs index 2cc80c601a895..a55ef6fe6d196 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/KubernetesConfigurationExtensions.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/KubernetesConfigurationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.KubernetesConfiguration.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.KubernetesConfiguration @@ -18,93 +19,81 @@ namespace Azure.ResourceManager.KubernetesConfiguration /// A class to add extension methods to Azure.ResourceManager.KubernetesConfiguration. public static partial class KubernetesConfigurationExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableKubernetesConfigurationArmClient GetMockableKubernetesConfigurationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableKubernetesConfigurationArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableKubernetesConfigurationResourceGroupResource GetMockableKubernetesConfigurationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableKubernetesConfigurationResourceGroupResource(client, resource.Id)); } - #region KubernetesClusterExtensionResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KubernetesClusterExtensionResource GetKubernetesClusterExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KubernetesClusterExtensionResource.ValidateResourceId(id); - return new KubernetesClusterExtensionResource(client, id); - } - ); + return GetMockableKubernetesConfigurationArmClient(client).GetKubernetesClusterExtensionResource(id); } - #endregion - #region KubernetesFluxConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KubernetesFluxConfigurationResource GetKubernetesFluxConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KubernetesFluxConfigurationResource.ValidateResourceId(id); - return new KubernetesFluxConfigurationResource(client, id); - } - ); + return GetMockableKubernetesConfigurationArmClient(client).GetKubernetesFluxConfigurationResource(id); } - #endregion - #region KubernetesSourceControlConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KubernetesSourceControlConfigurationResource GetKubernetesSourceControlConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KubernetesSourceControlConfigurationResource.ValidateResourceId(id); - return new KubernetesSourceControlConfigurationResource(client, id); - } - ); + return GetMockableKubernetesConfigurationArmClient(client).GetKubernetesSourceControlConfigurationResource(id); } - #endregion - /// Gets a collection of KubernetesClusterExtensionResources in the ResourceGroupResource. + /// + /// Gets a collection of KubernetesClusterExtensionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. /// The name of the kubernetes cluster. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of KubernetesClusterExtensionResources and their operations over a KubernetesClusterExtensionResource. public static KubernetesClusterExtensionCollection GetKubernetesClusterExtensions(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName) { - Argument.AssertNotNullOrEmpty(clusterRp, nameof(clusterRp)); - Argument.AssertNotNullOrEmpty(clusterResourceName, nameof(clusterResourceName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetKubernetesClusterExtensions(clusterRp, clusterResourceName, clusterName); + return GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesClusterExtensions(clusterRp, clusterResourceName, clusterName); } /// @@ -119,6 +108,10 @@ public static KubernetesClusterExtensionCollection GetKubernetesClusterExtension /// Extensions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. @@ -126,12 +119,12 @@ public static KubernetesClusterExtensionCollection GetKubernetesClusterExtension /// The name of the kubernetes cluster. /// Name of the Extension. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetKubernetesClusterExtensionAsync(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName, string extensionName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetKubernetesClusterExtensions(clusterRp, clusterResourceName, clusterName).GetAsync(extensionName, cancellationToken).ConfigureAwait(false); + return await GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesClusterExtensionAsync(clusterRp, clusterResourceName, clusterName, extensionName, cancellationToken).ConfigureAwait(false); } /// @@ -146,6 +139,10 @@ public static async Task> GetKubern /// Extensions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. @@ -153,29 +150,31 @@ public static async Task> GetKubern /// The name of the kubernetes cluster. /// Name of the Extension. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetKubernetesClusterExtension(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName, string extensionName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetKubernetesClusterExtensions(clusterRp, clusterResourceName, clusterName).Get(extensionName, cancellationToken); + return GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesClusterExtension(clusterRp, clusterResourceName, clusterName, extensionName, cancellationToken); } - /// Gets a collection of KubernetesFluxConfigurationResources in the ResourceGroupResource. + /// + /// Gets a collection of KubernetesFluxConfigurationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. /// The name of the kubernetes cluster. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of KubernetesFluxConfigurationResources and their operations over a KubernetesFluxConfigurationResource. public static KubernetesFluxConfigurationCollection GetKubernetesFluxConfigurations(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName) { - Argument.AssertNotNullOrEmpty(clusterRp, nameof(clusterRp)); - Argument.AssertNotNullOrEmpty(clusterResourceName, nameof(clusterResourceName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetKubernetesFluxConfigurations(clusterRp, clusterResourceName, clusterName); + return GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesFluxConfigurations(clusterRp, clusterResourceName, clusterName); } /// @@ -190,6 +189,10 @@ public static KubernetesFluxConfigurationCollection GetKubernetesFluxConfigurati /// FluxConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. @@ -197,12 +200,12 @@ public static KubernetesFluxConfigurationCollection GetKubernetesFluxConfigurati /// The name of the kubernetes cluster. /// Name of the Flux Configuration. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetKubernetesFluxConfigurationAsync(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetKubernetesFluxConfigurations(clusterRp, clusterResourceName, clusterName).GetAsync(fluxConfigurationName, cancellationToken).ConfigureAwait(false); + return await GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesFluxConfigurationAsync(clusterRp, clusterResourceName, clusterName, fluxConfigurationName, cancellationToken).ConfigureAwait(false); } /// @@ -217,6 +220,10 @@ public static async Task> GetKuber /// FluxConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. @@ -224,29 +231,31 @@ public static async Task> GetKuber /// The name of the kubernetes cluster. /// Name of the Flux Configuration. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetKubernetesFluxConfiguration(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetKubernetesFluxConfigurations(clusterRp, clusterResourceName, clusterName).Get(fluxConfigurationName, cancellationToken); + return GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesFluxConfiguration(clusterRp, clusterResourceName, clusterName, fluxConfigurationName, cancellationToken); } - /// Gets a collection of KubernetesSourceControlConfigurationResources in the ResourceGroupResource. + /// + /// Gets a collection of KubernetesSourceControlConfigurationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. /// The name of the kubernetes cluster. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of KubernetesSourceControlConfigurationResources and their operations over a KubernetesSourceControlConfigurationResource. public static KubernetesSourceControlConfigurationCollection GetKubernetesSourceControlConfigurations(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName) { - Argument.AssertNotNullOrEmpty(clusterRp, nameof(clusterRp)); - Argument.AssertNotNullOrEmpty(clusterResourceName, nameof(clusterResourceName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetKubernetesSourceControlConfigurations(clusterRp, clusterResourceName, clusterName); + return GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesSourceControlConfigurations(clusterRp, clusterResourceName, clusterName); } /// @@ -261,6 +270,10 @@ public static KubernetesSourceControlConfigurationCollection GetKubernetesSource /// SourceControlConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. @@ -268,12 +281,12 @@ public static KubernetesSourceControlConfigurationCollection GetKubernetesSource /// The name of the kubernetes cluster. /// Name of the Source Control Configuration. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetKubernetesSourceControlConfigurationAsync(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetKubernetesSourceControlConfigurations(clusterRp, clusterResourceName, clusterName).GetAsync(sourceControlConfigurationName, cancellationToken).ConfigureAwait(false); + return await GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesSourceControlConfigurationAsync(clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, cancellationToken).ConfigureAwait(false); } /// @@ -288,6 +301,10 @@ public static async Task> /// SourceControlConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. @@ -295,12 +312,12 @@ public static async Task> /// The name of the kubernetes cluster. /// Name of the Source Control Configuration. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetKubernetesSourceControlConfiguration(this ResourceGroupResource resourceGroupResource, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetKubernetesSourceControlConfigurations(clusterRp, clusterResourceName, clusterName).Get(sourceControlConfigurationName, cancellationToken); + return GetMockableKubernetesConfigurationResourceGroupResource(resourceGroupResource).GetKubernetesSourceControlConfiguration(clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, cancellationToken); } } } diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/MockableKubernetesConfigurationArmClient.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/MockableKubernetesConfigurationArmClient.cs new file mode 100644 index 0000000000000..f5c1b9ac4ca27 --- /dev/null +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/MockableKubernetesConfigurationArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.KubernetesConfiguration; + +namespace Azure.ResourceManager.KubernetesConfiguration.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableKubernetesConfigurationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableKubernetesConfigurationArmClient() + { + } + + /// 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 MockableKubernetesConfigurationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableKubernetesConfigurationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KubernetesClusterExtensionResource GetKubernetesClusterExtensionResource(ResourceIdentifier id) + { + KubernetesClusterExtensionResource.ValidateResourceId(id); + return new KubernetesClusterExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KubernetesFluxConfigurationResource GetKubernetesFluxConfigurationResource(ResourceIdentifier id) + { + KubernetesFluxConfigurationResource.ValidateResourceId(id); + return new KubernetesFluxConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KubernetesSourceControlConfigurationResource GetKubernetesSourceControlConfigurationResource(ResourceIdentifier id) + { + KubernetesSourceControlConfigurationResource.ValidateResourceId(id); + return new KubernetesSourceControlConfigurationResource(Client, id); + } + } +} diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/MockableKubernetesConfigurationResourceGroupResource.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/MockableKubernetesConfigurationResourceGroupResource.cs new file mode 100644 index 0000000000000..8e738f434c495 --- /dev/null +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/MockableKubernetesConfigurationResourceGroupResource.cs @@ -0,0 +1,231 @@ +// 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.KubernetesConfiguration; + +namespace Azure.ResourceManager.KubernetesConfiguration.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableKubernetesConfigurationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableKubernetesConfigurationResourceGroupResource() + { + } + + /// 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 MockableKubernetesConfigurationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of KubernetesClusterExtensionResources in the ResourceGroupResource. + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// An object representing collection of KubernetesClusterExtensionResources and their operations over a KubernetesClusterExtensionResource. + public virtual KubernetesClusterExtensionCollection GetKubernetesClusterExtensions(string clusterRp, string clusterResourceName, string clusterName) + { + return new KubernetesClusterExtensionCollection(Client, Id, clusterRp, clusterResourceName, clusterName); + } + + /// + /// Gets Kubernetes Cluster Extension. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName} + /// + /// + /// Operation Id + /// Extensions_Get + /// + /// + /// + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// Name of the Extension. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKubernetesClusterExtensionAsync(string clusterRp, string clusterResourceName, string clusterName, string extensionName, CancellationToken cancellationToken = default) + { + return await GetKubernetesClusterExtensions(clusterRp, clusterResourceName, clusterName).GetAsync(extensionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets Kubernetes Cluster Extension. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName} + /// + /// + /// Operation Id + /// Extensions_Get + /// + /// + /// + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// Name of the Extension. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKubernetesClusterExtension(string clusterRp, string clusterResourceName, string clusterName, string extensionName, CancellationToken cancellationToken = default) + { + return GetKubernetesClusterExtensions(clusterRp, clusterResourceName, clusterName).Get(extensionName, cancellationToken); + } + + /// Gets a collection of KubernetesFluxConfigurationResources in the ResourceGroupResource. + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// An object representing collection of KubernetesFluxConfigurationResources and their operations over a KubernetesFluxConfigurationResource. + public virtual KubernetesFluxConfigurationCollection GetKubernetesFluxConfigurations(string clusterRp, string clusterResourceName, string clusterName) + { + return new KubernetesFluxConfigurationCollection(Client, Id, clusterRp, clusterResourceName, clusterName); + } + + /// + /// Gets details of the Flux Configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName} + /// + /// + /// Operation Id + /// FluxConfigurations_Get + /// + /// + /// + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// Name of the Flux Configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKubernetesFluxConfigurationAsync(string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, CancellationToken cancellationToken = default) + { + return await GetKubernetesFluxConfigurations(clusterRp, clusterResourceName, clusterName).GetAsync(fluxConfigurationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details of the Flux Configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName} + /// + /// + /// Operation Id + /// FluxConfigurations_Get + /// + /// + /// + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// Name of the Flux Configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKubernetesFluxConfiguration(string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, CancellationToken cancellationToken = default) + { + return GetKubernetesFluxConfigurations(clusterRp, clusterResourceName, clusterName).Get(fluxConfigurationName, cancellationToken); + } + + /// Gets a collection of KubernetesSourceControlConfigurationResources in the ResourceGroupResource. + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// An object representing collection of KubernetesSourceControlConfigurationResources and their operations over a KubernetesSourceControlConfigurationResource. + public virtual KubernetesSourceControlConfigurationCollection GetKubernetesSourceControlConfigurations(string clusterRp, string clusterResourceName, string clusterName) + { + return new KubernetesSourceControlConfigurationCollection(Client, Id, clusterRp, clusterResourceName, clusterName); + } + + /// + /// Gets details of the Source Control Configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName} + /// + /// + /// Operation Id + /// SourceControlConfigurations_Get + /// + /// + /// + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// Name of the Source Control Configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKubernetesSourceControlConfigurationAsync(string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, CancellationToken cancellationToken = default) + { + return await GetKubernetesSourceControlConfigurations(clusterRp, clusterResourceName, clusterName).GetAsync(sourceControlConfigurationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details of the Source Control Configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName} + /// + /// + /// Operation Id + /// SourceControlConfigurations_Get + /// + /// + /// + /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. + /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. + /// The name of the kubernetes cluster. + /// Name of the Source Control Configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKubernetesSourceControlConfiguration(string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, CancellationToken cancellationToken = default) + { + return GetKubernetesSourceControlConfigurations(clusterRp, clusterResourceName, clusterName).Get(sourceControlConfigurationName, cancellationToken); + } + } +} diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ec62f4eb6b57e..0000000000000 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.KubernetesConfiguration -{ - /// 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 KubernetesClusterExtensionResources in the ResourceGroupResource. - /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - /// The name of the kubernetes cluster. - /// An object representing collection of KubernetesClusterExtensionResources and their operations over a KubernetesClusterExtensionResource. - public virtual KubernetesClusterExtensionCollection GetKubernetesClusterExtensions(string clusterRp, string clusterResourceName, string clusterName) - { - return new KubernetesClusterExtensionCollection(Client, Id, clusterRp, clusterResourceName, clusterName); - } - - /// Gets a collection of KubernetesFluxConfigurationResources in the ResourceGroupResource. - /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - /// The name of the kubernetes cluster. - /// An object representing collection of KubernetesFluxConfigurationResources and their operations over a KubernetesFluxConfigurationResource. - public virtual KubernetesFluxConfigurationCollection GetKubernetesFluxConfigurations(string clusterRp, string clusterResourceName, string clusterName) - { - return new KubernetesFluxConfigurationCollection(Client, Id, clusterRp, clusterResourceName, clusterName); - } - - /// Gets a collection of KubernetesSourceControlConfigurationResources in the ResourceGroupResource. - /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - /// The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - /// The name of the kubernetes cluster. - /// An object representing collection of KubernetesSourceControlConfigurationResources and their operations over a KubernetesSourceControlConfigurationResource. - public virtual KubernetesSourceControlConfigurationCollection GetKubernetesSourceControlConfigurations(string clusterRp, string clusterResourceName, string clusterName) - { - return new KubernetesSourceControlConfigurationCollection(Client, Id, clusterRp, clusterResourceName, clusterName); - } - } -} diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesClusterExtensionResource.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesClusterExtensionResource.cs index ea38ebb83e3ff..5a53e94d83eca 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesClusterExtensionResource.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesClusterExtensionResource.cs @@ -28,6 +28,12 @@ namespace Azure.ResourceManager.KubernetesConfiguration public partial class KubernetesClusterExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterRp. + /// The clusterResourceName. + /// The clusterName. + /// The extensionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string extensionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"; diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesFluxConfigurationResource.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesFluxConfigurationResource.cs index 07a65ec395fdf..4905c921e7141 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesFluxConfigurationResource.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesFluxConfigurationResource.cs @@ -28,6 +28,12 @@ namespace Azure.ResourceManager.KubernetesConfiguration public partial class KubernetesFluxConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterRp. + /// The clusterResourceName. + /// The clusterName. + /// The fluxConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"; diff --git a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesSourceControlConfigurationResource.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesSourceControlConfigurationResource.cs index 264852af6da97..f63bd61d9b9e4 100644 --- a/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesSourceControlConfigurationResource.cs +++ b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/KubernetesSourceControlConfigurationResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.KubernetesConfiguration public partial class KubernetesSourceControlConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterRp. + /// The clusterResourceName. + /// The clusterName. + /// The sourceControlConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/api/Azure.ResourceManager.Kusto.netstandard2.0.cs b/sdk/kusto/Azure.ResourceManager.Kusto/api/Azure.ResourceManager.Kusto.netstandard2.0.cs index d4258dcff6321..13484638e6387 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/api/Azure.ResourceManager.Kusto.netstandard2.0.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/api/Azure.ResourceManager.Kusto.netstandard2.0.cs @@ -63,7 +63,7 @@ protected KustoClusterCollection() { } } public partial class KustoClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public KustoClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.Kusto.Models.KustoSku sku) : base (default(Azure.Core.AzureLocation)) { } + public KustoClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.Kusto.Models.KustoSku sku) { } public System.Collections.Generic.IList AcceptedAudiences { get { throw null; } } public System.Collections.Generic.IList AllowedFqdnList { get { throw null; } } public System.Collections.Generic.IList AllowedIPRangeList { get { throw null; } } @@ -579,6 +579,43 @@ protected SandboxCustomImageResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Kusto.SandboxCustomImageData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Kusto.Mocking +{ + public partial class MockableKustoArmClient : Azure.ResourceManager.ArmResource + { + protected MockableKustoArmClient() { } + public virtual Azure.ResourceManager.Kusto.KustoAttachedDatabaseConfigurationResource GetKustoAttachedDatabaseConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoClusterPrincipalAssignmentResource GetKustoClusterPrincipalAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoClusterResource GetKustoClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoDatabasePrincipalAssignmentResource GetKustoDatabasePrincipalAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoDatabaseResource GetKustoDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoDataConnectionResource GetKustoDataConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoManagedPrivateEndpointResource GetKustoManagedPrivateEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoPrivateEndpointConnectionResource GetKustoPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoPrivateLinkResource GetKustoPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoScriptResource GetKustoScriptResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Kusto.SandboxCustomImageResource GetSandboxCustomImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableKustoResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableKustoResourceGroupResource() { } + public virtual Azure.Response GetKustoCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKustoClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Kusto.KustoClusterCollection GetKustoClusters() { throw null; } + } + public partial class MockableKustoSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableKustoSubscriptionResource() { } + public virtual Azure.Response CheckKustoClusterNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.Kusto.Models.KustoClusterNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckKustoClusterNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Kusto.Models.KustoClusterNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetKustoClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetKustoClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetKustoEligibleSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetKustoEligibleSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkus(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Kusto.Models { public partial class AcceptedAudience @@ -797,7 +834,7 @@ public KustoClusterNameAvailabilityContent(string name) { } } public partial class KustoClusterPatch : Azure.ResourceManager.Models.TrackedResourceData { - public KustoClusterPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public KustoClusterPatch(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AcceptedAudiences { get { throw null; } } public System.Collections.Generic.IList AllowedFqdnList { get { throw null; } } public System.Collections.Generic.IList AllowedIPRangeList { get { throw null; } } diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/KustoExtensions.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/KustoExtensions.cs index 1908fe1a881f6..3f312c2e97eb0 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/KustoExtensions.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/KustoExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Kusto.Mocking; using Azure.ResourceManager.Kusto.Models; using Azure.ResourceManager.Resources; @@ -19,252 +20,209 @@ namespace Azure.ResourceManager.Kusto /// A class to add extension methods to Azure.ResourceManager.Kusto. public static partial class KustoExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableKustoArmClient GetMockableKustoArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableKustoArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableKustoResourceGroupResource GetMockableKustoResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableKustoResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableKustoSubscriptionResource GetMockableKustoSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableKustoSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region KustoClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoClusterResource GetKustoClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoClusterResource.ValidateResourceId(id); - return new KustoClusterResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoClusterResource(id); } - #endregion - #region KustoClusterPrincipalAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoClusterPrincipalAssignmentResource GetKustoClusterPrincipalAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoClusterPrincipalAssignmentResource.ValidateResourceId(id); - return new KustoClusterPrincipalAssignmentResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoClusterPrincipalAssignmentResource(id); } - #endregion - #region KustoDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoDatabaseResource GetKustoDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoDatabaseResource.ValidateResourceId(id); - return new KustoDatabaseResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoDatabaseResource(id); } - #endregion - #region KustoAttachedDatabaseConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoAttachedDatabaseConfigurationResource GetKustoAttachedDatabaseConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoAttachedDatabaseConfigurationResource.ValidateResourceId(id); - return new KustoAttachedDatabaseConfigurationResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoAttachedDatabaseConfigurationResource(id); } - #endregion - #region KustoManagedPrivateEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoManagedPrivateEndpointResource GetKustoManagedPrivateEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoManagedPrivateEndpointResource.ValidateResourceId(id); - return new KustoManagedPrivateEndpointResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoManagedPrivateEndpointResource(id); } - #endregion - #region KustoDatabasePrincipalAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoDatabasePrincipalAssignmentResource GetKustoDatabasePrincipalAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoDatabasePrincipalAssignmentResource.ValidateResourceId(id); - return new KustoDatabasePrincipalAssignmentResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoDatabasePrincipalAssignmentResource(id); } - #endregion - #region KustoScriptResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoScriptResource GetKustoScriptResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoScriptResource.ValidateResourceId(id); - return new KustoScriptResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoScriptResource(id); } - #endregion - #region SandboxCustomImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SandboxCustomImageResource GetSandboxCustomImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SandboxCustomImageResource.ValidateResourceId(id); - return new SandboxCustomImageResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetSandboxCustomImageResource(id); } - #endregion - #region KustoPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoPrivateEndpointConnectionResource GetKustoPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoPrivateEndpointConnectionResource.ValidateResourceId(id); - return new KustoPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoPrivateEndpointConnectionResource(id); } - #endregion - #region KustoPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoPrivateLinkResource GetKustoPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoPrivateLinkResource.ValidateResourceId(id); - return new KustoPrivateLinkResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoPrivateLinkResource(id); } - #endregion - #region KustoDataConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KustoDataConnectionResource GetKustoDataConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KustoDataConnectionResource.ValidateResourceId(id); - return new KustoDataConnectionResource(client, id); - } - ); + return GetMockableKustoArmClient(client).GetKustoDataConnectionResource(id); } - #endregion - /// Gets a collection of KustoClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of KustoClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of KustoClusterResources and their operations over a KustoClusterResource. public static KustoClusterCollection GetKustoClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetKustoClusters(); + return GetMockableKustoResourceGroupResource(resourceGroupResource).GetKustoClusters(); } /// @@ -279,16 +237,20 @@ public static KustoClusterCollection GetKustoClusters(this ResourceGroupResource /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Kusto cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetKustoClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetKustoClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableKustoResourceGroupResource(resourceGroupResource).GetKustoClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -303,16 +265,20 @@ public static async Task> GetKustoClusterAsync(th /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Kusto cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetKustoCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetKustoClusters().Get(clusterName, cancellationToken); + return GetMockableKustoResourceGroupResource(resourceGroupResource).GetKustoCluster(clusterName, cancellationToken); } /// @@ -327,13 +293,17 @@ public static Response GetKustoCluster(this ResourceGroupR /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetKustoClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetKustoClustersAsync(cancellationToken); + return GetMockableKustoSubscriptionResource(subscriptionResource).GetKustoClustersAsync(cancellationToken); } /// @@ -348,13 +318,17 @@ public static AsyncPageable GetKustoClustersAsync(this Sub /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetKustoClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetKustoClusters(cancellationToken); + return GetMockableKustoSubscriptionResource(subscriptionResource).GetKustoClusters(cancellationToken); } /// @@ -369,13 +343,17 @@ public static Pageable GetKustoClusters(this SubscriptionR /// Clusters_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetKustoEligibleSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetKustoEligibleSkusAsync(cancellationToken); + return GetMockableKustoSubscriptionResource(subscriptionResource).GetKustoEligibleSkusAsync(cancellationToken); } /// @@ -390,13 +368,17 @@ public static AsyncPageable GetKustoEligibleSkusAsync(this /// Clusters_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetKustoEligibleSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetKustoEligibleSkus(cancellationToken); + return GetMockableKustoSubscriptionResource(subscriptionResource).GetKustoEligibleSkus(cancellationToken); } /// @@ -411,6 +393,10 @@ public static Pageable GetKustoEligibleSkus(this Subscripti /// Clusters_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -419,9 +405,7 @@ public static Pageable GetKustoEligibleSkus(this Subscripti /// is null. public static async Task> CheckKustoClusterNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, KustoClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckKustoClusterNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableKustoSubscriptionResource(subscriptionResource).CheckKustoClusterNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -436,6 +420,10 @@ public static async Task> CheckKustoCluste /// Clusters_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -444,9 +432,7 @@ public static async Task> CheckKustoCluste /// is null. public static Response CheckKustoClusterNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, KustoClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckKustoClusterNameAvailability(location, content, cancellationToken); + return GetMockableKustoSubscriptionResource(subscriptionResource).CheckKustoClusterNameAvailability(location, content, cancellationToken); } /// @@ -461,6 +447,10 @@ public static Response CheckKustoClusterNameAvailab /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -468,7 +458,7 @@ public static Response CheckKustoClusterNameAvailab /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSkusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusAsync(location, cancellationToken); + return GetMockableKustoSubscriptionResource(subscriptionResource).GetSkusAsync(location, cancellationToken); } /// @@ -483,6 +473,10 @@ public static AsyncPageable GetSkusAsync(this SubscriptionR /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -490,7 +484,7 @@ public static AsyncPageable GetSkusAsync(this SubscriptionR /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSkus(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkus(location, cancellationToken); + return GetMockableKustoSubscriptionResource(subscriptionResource).GetSkus(location, cancellationToken); } } } diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoArmClient.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoArmClient.cs new file mode 100644 index 0000000000000..e4deeb44563f8 --- /dev/null +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoArmClient.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Kusto; + +namespace Azure.ResourceManager.Kusto.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableKustoArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableKustoArmClient() + { + } + + /// 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 MockableKustoArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableKustoArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoClusterResource GetKustoClusterResource(ResourceIdentifier id) + { + KustoClusterResource.ValidateResourceId(id); + return new KustoClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoClusterPrincipalAssignmentResource GetKustoClusterPrincipalAssignmentResource(ResourceIdentifier id) + { + KustoClusterPrincipalAssignmentResource.ValidateResourceId(id); + return new KustoClusterPrincipalAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoDatabaseResource GetKustoDatabaseResource(ResourceIdentifier id) + { + KustoDatabaseResource.ValidateResourceId(id); + return new KustoDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoAttachedDatabaseConfigurationResource GetKustoAttachedDatabaseConfigurationResource(ResourceIdentifier id) + { + KustoAttachedDatabaseConfigurationResource.ValidateResourceId(id); + return new KustoAttachedDatabaseConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoManagedPrivateEndpointResource GetKustoManagedPrivateEndpointResource(ResourceIdentifier id) + { + KustoManagedPrivateEndpointResource.ValidateResourceId(id); + return new KustoManagedPrivateEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoDatabasePrincipalAssignmentResource GetKustoDatabasePrincipalAssignmentResource(ResourceIdentifier id) + { + KustoDatabasePrincipalAssignmentResource.ValidateResourceId(id); + return new KustoDatabasePrincipalAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoScriptResource GetKustoScriptResource(ResourceIdentifier id) + { + KustoScriptResource.ValidateResourceId(id); + return new KustoScriptResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SandboxCustomImageResource GetSandboxCustomImageResource(ResourceIdentifier id) + { + SandboxCustomImageResource.ValidateResourceId(id); + return new SandboxCustomImageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoPrivateEndpointConnectionResource GetKustoPrivateEndpointConnectionResource(ResourceIdentifier id) + { + KustoPrivateEndpointConnectionResource.ValidateResourceId(id); + return new KustoPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoPrivateLinkResource GetKustoPrivateLinkResource(ResourceIdentifier id) + { + KustoPrivateLinkResource.ValidateResourceId(id); + return new KustoPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KustoDataConnectionResource GetKustoDataConnectionResource(ResourceIdentifier id) + { + KustoDataConnectionResource.ValidateResourceId(id); + return new KustoDataConnectionResource(Client, id); + } + } +} diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoResourceGroupResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoResourceGroupResource.cs new file mode 100644 index 0000000000000..cf08b8e70bf2a --- /dev/null +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Kusto; + +namespace Azure.ResourceManager.Kusto.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableKustoResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableKustoResourceGroupResource() + { + } + + /// 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 MockableKustoResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of KustoClusterResources in the ResourceGroupResource. + /// An object representing collection of KustoClusterResources and their operations over a KustoClusterResource. + public virtual KustoClusterCollection GetKustoClusters() + { + return GetCachedClient(client => new KustoClusterCollection(client, Id)); + } + + /// + /// Gets a Kusto cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the Kusto cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKustoClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetKustoClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Kusto cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the Kusto cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKustoCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetKustoClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoSubscriptionResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoSubscriptionResource.cs new file mode 100644 index 0000000000000..27c78f6e2c485 --- /dev/null +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/MockableKustoSubscriptionResource.cs @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Kusto; +using Azure.ResourceManager.Kusto.Models; + +namespace Azure.ResourceManager.Kusto.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableKustoSubscriptionResource : ArmResource + { + private ClientDiagnostics _kustoClusterClustersClientDiagnostics; + private ClustersRestOperations _kustoClusterClustersRestClient; + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableKustoSubscriptionResource() + { + } + + /// 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 MockableKustoSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics KustoClusterClustersClientDiagnostics => _kustoClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Kusto", KustoClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations KustoClusterClustersRestClient => _kustoClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KustoClusterResource.ResourceType)); + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Kusto", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all Kusto clusters within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetKustoClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KustoClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new KustoClusterResource(Client, KustoClusterData.DeserializeKustoClusterData(e)), KustoClusterClustersClientDiagnostics, Pipeline, "MockableKustoSubscriptionResource.GetKustoClusters", "value", null, cancellationToken); + } + + /// + /// Lists all Kusto clusters within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetKustoClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KustoClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new KustoClusterResource(Client, KustoClusterData.DeserializeKustoClusterData(e)), KustoClusterClustersClientDiagnostics, Pipeline, "MockableKustoSubscriptionResource.GetKustoClusters", "value", null, cancellationToken); + } + + /// + /// Lists eligible SKUs for Kusto resource provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus + /// + /// + /// Operation Id + /// Clusters_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetKustoEligibleSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KustoClusterClustersRestClient.CreateListSkusRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, KustoSkuDescription.DeserializeKustoSkuDescription, KustoClusterClustersClientDiagnostics, Pipeline, "MockableKustoSubscriptionResource.GetKustoEligibleSkus", "value", null, cancellationToken); + } + + /// + /// Lists eligible SKUs for Kusto resource provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus + /// + /// + /// Operation Id + /// Clusters_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetKustoEligibleSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KustoClusterClustersRestClient.CreateListSkusRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, KustoSkuDescription.DeserializeKustoSkuDescription, KustoClusterClustersClientDiagnostics, Pipeline, "MockableKustoSubscriptionResource.GetKustoEligibleSkus", "value", null, cancellationToken); + } + + /// + /// Checks that the cluster name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Clusters_CheckNameAvailability + /// + /// + /// + /// The name of Azure region. + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckKustoClusterNameAvailabilityAsync(AzureLocation location, KustoClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = KustoClusterClustersClientDiagnostics.CreateScope("MockableKustoSubscriptionResource.CheckKustoClusterNameAvailability"); + scope.Start(); + try + { + var response = await KustoClusterClustersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the cluster name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Clusters_CheckNameAvailability + /// + /// + /// + /// The name of Azure region. + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + public virtual Response CheckKustoClusterNameAvailability(AzureLocation location, KustoClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = KustoClusterClustersClientDiagnostics.CreateScope("MockableKustoSubscriptionResource.CheckKustoClusterNameAvailability"); + scope.Start(); + try + { + var response = KustoClusterClustersRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists eligible region SKUs for Kusto resource provider by Azure region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, KustoSkuDescription.DeserializeKustoSkuDescription, SkusClientDiagnostics, Pipeline, "MockableKustoSubscriptionResource.GetSkus", "value", null, cancellationToken); + } + + /// + /// Lists eligible region SKUs for Kusto resource provider by Azure region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkus(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, KustoSkuDescription.DeserializeKustoSkuDescription, SkusClientDiagnostics, Pipeline, "MockableKustoSubscriptionResource.GetSkus", "value", null, cancellationToken); + } + } +} diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index f49013758ecbe..0000000000000 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Kusto -{ - /// 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 KustoClusterResources in the ResourceGroupResource. - /// An object representing collection of KustoClusterResources and their operations over a KustoClusterResource. - public virtual KustoClusterCollection GetKustoClusters() - { - return GetCachedClient(Client => new KustoClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 5fd6452371b12..0000000000000 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Kusto.Models; - -namespace Azure.ResourceManager.Kusto -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _kustoClusterClustersClientDiagnostics; - private ClustersRestOperations _kustoClusterClustersRestClient; - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; - - /// 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 KustoClusterClustersClientDiagnostics => _kustoClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Kusto", KustoClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations KustoClusterClustersRestClient => _kustoClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KustoClusterResource.ResourceType)); - private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Kusto", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all Kusto clusters within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetKustoClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => KustoClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new KustoClusterResource(Client, KustoClusterData.DeserializeKustoClusterData(e)), KustoClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetKustoClusters", "value", null, cancellationToken); - } - - /// - /// Lists all Kusto clusters within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetKustoClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => KustoClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new KustoClusterResource(Client, KustoClusterData.DeserializeKustoClusterData(e)), KustoClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetKustoClusters", "value", null, cancellationToken); - } - - /// - /// Lists eligible SKUs for Kusto resource provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus - /// - /// - /// Operation Id - /// Clusters_ListSkus - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetKustoEligibleSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => KustoClusterClustersRestClient.CreateListSkusRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, KustoSkuDescription.DeserializeKustoSkuDescription, KustoClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetKustoEligibleSkus", "value", null, cancellationToken); - } - - /// - /// Lists eligible SKUs for Kusto resource provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus - /// - /// - /// Operation Id - /// Clusters_ListSkus - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetKustoEligibleSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => KustoClusterClustersRestClient.CreateListSkusRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, KustoSkuDescription.DeserializeKustoSkuDescription, KustoClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetKustoEligibleSkus", "value", null, cancellationToken); - } - - /// - /// Checks that the cluster name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Clusters_CheckNameAvailability - /// - /// - /// - /// The name of Azure region. - /// The name of the cluster. - /// The cancellation token to use. - public virtual async Task> CheckKustoClusterNameAvailabilityAsync(AzureLocation location, KustoClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = KustoClusterClustersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckKustoClusterNameAvailability"); - scope.Start(); - try - { - var response = await KustoClusterClustersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the cluster name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Clusters_CheckNameAvailability - /// - /// - /// - /// The name of Azure region. - /// The name of the cluster. - /// The cancellation token to use. - public virtual Response CheckKustoClusterNameAvailability(AzureLocation location, KustoClusterNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = KustoClusterClustersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckKustoClusterNameAvailability"); - scope.Start(); - try - { - var response = KustoClusterClustersRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists eligible region SKUs for Kusto resource provider by Azure region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, KustoSkuDescription.DeserializeKustoSkuDescription, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", null, cancellationToken); - } - - /// - /// Lists eligible region SKUs for Kusto resource provider by Azure region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkus(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, KustoSkuDescription.DeserializeKustoSkuDescription, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", null, cancellationToken); - } - } -} diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoAttachedDatabaseConfigurationResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoAttachedDatabaseConfigurationResource.cs index 9b34a0f7f7594..3dad3481432e4 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoAttachedDatabaseConfigurationResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoAttachedDatabaseConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Kusto public partial class KustoAttachedDatabaseConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The attachedDatabaseConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string attachedDatabaseConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterPrincipalAssignmentResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterPrincipalAssignmentResource.cs index bcdab6a35240f..0e12663f1aeab 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterPrincipalAssignmentResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterPrincipalAssignmentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Kusto public partial class KustoClusterPrincipalAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The principalAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string principalAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterResource.cs index dfa9f4ed5facf..1ebafb90d05a1 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Kusto public partial class KustoClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}"; @@ -119,7 +122,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of KustoClusterPrincipalAssignmentResources and their operations over a KustoClusterPrincipalAssignmentResource. public virtual KustoClusterPrincipalAssignmentCollection GetKustoClusterPrincipalAssignments() { - return GetCachedClient(Client => new KustoClusterPrincipalAssignmentCollection(Client, Id)); + return GetCachedClient(client => new KustoClusterPrincipalAssignmentCollection(client, Id)); } /// @@ -137,8 +140,8 @@ public virtual KustoClusterPrincipalAssignmentCollection GetKustoClusterPrincipa /// /// The name of the Kusto principalAssignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoClusterPrincipalAssignmentAsync(string principalAssignmentName, CancellationToken cancellationToken = default) { @@ -160,8 +163,8 @@ public virtual async Task> Get /// /// The name of the Kusto principalAssignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoClusterPrincipalAssignment(string principalAssignmentName, CancellationToken cancellationToken = default) { @@ -172,7 +175,7 @@ public virtual Response GetKustoCluster /// An object representing collection of KustoDatabaseResources and their operations over a KustoDatabaseResource. public virtual KustoDatabaseCollection GetKustoDatabases() { - return GetCachedClient(Client => new KustoDatabaseCollection(Client, Id)); + return GetCachedClient(client => new KustoDatabaseCollection(client, Id)); } /// @@ -190,8 +193,8 @@ public virtual KustoDatabaseCollection GetKustoDatabases() /// /// The name of the database in the Kusto cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -213,8 +216,8 @@ public virtual async Task> GetKustoDatabaseAsync /// /// The name of the database in the Kusto cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -225,7 +228,7 @@ public virtual Response GetKustoDatabase(string databaseN /// An object representing collection of KustoAttachedDatabaseConfigurationResources and their operations over a KustoAttachedDatabaseConfigurationResource. public virtual KustoAttachedDatabaseConfigurationCollection GetKustoAttachedDatabaseConfigurations() { - return GetCachedClient(Client => new KustoAttachedDatabaseConfigurationCollection(Client, Id)); + return GetCachedClient(client => new KustoAttachedDatabaseConfigurationCollection(client, Id)); } /// @@ -243,8 +246,8 @@ public virtual KustoAttachedDatabaseConfigurationCollection GetKustoAttachedData /// /// The name of the attached database configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoAttachedDatabaseConfigurationAsync(string attachedDatabaseConfigurationName, CancellationToken cancellationToken = default) { @@ -266,8 +269,8 @@ public virtual async Task> /// /// The name of the attached database configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoAttachedDatabaseConfiguration(string attachedDatabaseConfigurationName, CancellationToken cancellationToken = default) { @@ -278,7 +281,7 @@ public virtual Response GetKustoAtta /// An object representing collection of KustoManagedPrivateEndpointResources and their operations over a KustoManagedPrivateEndpointResource. public virtual KustoManagedPrivateEndpointCollection GetKustoManagedPrivateEndpoints() { - return GetCachedClient(Client => new KustoManagedPrivateEndpointCollection(Client, Id)); + return GetCachedClient(client => new KustoManagedPrivateEndpointCollection(client, Id)); } /// @@ -296,8 +299,8 @@ public virtual KustoManagedPrivateEndpointCollection GetKustoManagedPrivateEndpo /// /// The name of the managed private endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoManagedPrivateEndpointAsync(string managedPrivateEndpointName, CancellationToken cancellationToken = default) { @@ -319,8 +322,8 @@ public virtual async Task> GetKust /// /// The name of the managed private endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoManagedPrivateEndpoint(string managedPrivateEndpointName, CancellationToken cancellationToken = default) { @@ -331,7 +334,7 @@ public virtual Response GetKustoManagedPriv /// An object representing collection of SandboxCustomImageResources and their operations over a SandboxCustomImageResource. public virtual SandboxCustomImageCollection GetSandboxCustomImages() { - return GetCachedClient(Client => new SandboxCustomImageCollection(Client, Id)); + return GetCachedClient(client => new SandboxCustomImageCollection(client, Id)); } /// @@ -349,8 +352,8 @@ public virtual SandboxCustomImageCollection GetSandboxCustomImages() /// /// The name of the sandbox custom image. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSandboxCustomImageAsync(string sandboxCustomImageName, CancellationToken cancellationToken = default) { @@ -372,8 +375,8 @@ public virtual async Task> GetSandboxCustom /// /// The name of the sandbox custom image. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSandboxCustomImage(string sandboxCustomImageName, CancellationToken cancellationToken = default) { @@ -384,7 +387,7 @@ public virtual Response GetSandboxCustomImage(string /// An object representing collection of KustoPrivateEndpointConnectionResources and their operations over a KustoPrivateEndpointConnectionResource. public virtual KustoPrivateEndpointConnectionCollection GetKustoPrivateEndpointConnections() { - return GetCachedClient(Client => new KustoPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new KustoPrivateEndpointConnectionCollection(client, Id)); } /// @@ -402,8 +405,8 @@ public virtual KustoPrivateEndpointConnectionCollection GetKustoPrivateEndpointC /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -425,8 +428,8 @@ public virtual async Task> GetK /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -437,7 +440,7 @@ public virtual Response GetKustoPrivateE /// An object representing collection of KustoPrivateLinkResources and their operations over a KustoPrivateLinkResource. public virtual KustoPrivateLinkResourceCollection GetKustoPrivateLinkResources() { - return GetCachedClient(Client => new KustoPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new KustoPrivateLinkResourceCollection(client, Id)); } /// @@ -455,8 +458,8 @@ public virtual KustoPrivateLinkResourceCollection GetKustoPrivateLinkResources() /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -478,8 +481,8 @@ public virtual async Task> GetKustoPrivateLin /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDataConnectionResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDataConnectionResource.cs index f1c0517608992..86e0a41a468ce 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDataConnectionResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDataConnectionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Kusto public partial class KustoDataConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The databaseName. + /// The dataConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string databaseName, string dataConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabasePrincipalAssignmentResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabasePrincipalAssignmentResource.cs index e817a3a4b0f90..ee77dfa5d0264 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabasePrincipalAssignmentResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabasePrincipalAssignmentResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Kusto public partial class KustoDatabasePrincipalAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The databaseName. + /// The principalAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string databaseName, string principalAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseResource.cs index fd7e64f20f49e..3386df7713a0a 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Kusto public partial class KustoDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}"; @@ -111,7 +115,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of KustoDatabasePrincipalAssignmentResources and their operations over a KustoDatabasePrincipalAssignmentResource. public virtual KustoDatabasePrincipalAssignmentCollection GetKustoDatabasePrincipalAssignments() { - return GetCachedClient(Client => new KustoDatabasePrincipalAssignmentCollection(Client, Id)); + return GetCachedClient(client => new KustoDatabasePrincipalAssignmentCollection(client, Id)); } /// @@ -129,8 +133,8 @@ public virtual KustoDatabasePrincipalAssignmentCollection GetKustoDatabasePrinci /// /// The name of the Kusto principalAssignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoDatabasePrincipalAssignmentAsync(string principalAssignmentName, CancellationToken cancellationToken = default) { @@ -152,8 +156,8 @@ public virtual async Task> Ge /// /// The name of the Kusto principalAssignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoDatabasePrincipalAssignment(string principalAssignmentName, CancellationToken cancellationToken = default) { @@ -164,7 +168,7 @@ public virtual Response GetKustoDataba /// An object representing collection of KustoScriptResources and their operations over a KustoScriptResource. public virtual KustoScriptCollection GetKustoScripts() { - return GetCachedClient(Client => new KustoScriptCollection(Client, Id)); + return GetCachedClient(client => new KustoScriptCollection(client, Id)); } /// @@ -182,8 +186,8 @@ public virtual KustoScriptCollection GetKustoScripts() /// /// The name of the Kusto database script. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoScriptAsync(string scriptName, CancellationToken cancellationToken = default) { @@ -205,8 +209,8 @@ public virtual async Task> GetKustoScriptAsync(str /// /// The name of the Kusto database script. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoScript(string scriptName, CancellationToken cancellationToken = default) { @@ -217,7 +221,7 @@ public virtual Response GetKustoScript(string scriptName, C /// An object representing collection of KustoDataConnectionResources and their operations over a KustoDataConnectionResource. public virtual KustoDataConnectionCollection GetKustoDataConnections() { - return GetCachedClient(Client => new KustoDataConnectionCollection(Client, Id)); + return GetCachedClient(client => new KustoDataConnectionCollection(client, Id)); } /// @@ -235,8 +239,8 @@ public virtual KustoDataConnectionCollection GetKustoDataConnections() /// /// The name of the data connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetKustoDataConnectionAsync(string dataConnectionName, CancellationToken cancellationToken = default) { @@ -258,8 +262,8 @@ public virtual async Task> GetKustoDataCon /// /// The name of the data connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetKustoDataConnection(string dataConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoManagedPrivateEndpointResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoManagedPrivateEndpointResource.cs index 14b88aebb070e..19dbb30e2a989 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoManagedPrivateEndpointResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoManagedPrivateEndpointResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Kusto public partial class KustoManagedPrivateEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The managedPrivateEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string managedPrivateEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateEndpointConnectionResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateEndpointConnectionResource.cs index d80451fe92a59..f44257e72d4b6 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateEndpointConnectionResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Kusto public partial class KustoPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateLinkResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateLinkResource.cs index 106fcf08d44e3..5becc1960289d 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateLinkResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Kusto public partial class KustoPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoScriptResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoScriptResource.cs index cf1481fcd040a..867a20b4a06bd 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoScriptResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoScriptResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Kusto public partial class KustoScriptResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The databaseName. + /// The scriptName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string databaseName, string scriptName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}"; diff --git a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/SandboxCustomImageResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/SandboxCustomImageResource.cs index bc03af04d02cc..596dfea08af93 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/SandboxCustomImageResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/SandboxCustomImageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Kusto public partial class SandboxCustomImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The sandboxCustomImageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string sandboxCustomImageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/sandboxCustomImages/{sandboxCustomImageName}"; diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/api/Azure.ResourceManager.LabServices.netstandard2.0.cs b/sdk/labservices/Azure.ResourceManager.LabServices/api/Azure.ResourceManager.LabServices.netstandard2.0.cs index 3301e1c848284..51e5a577ac647 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/api/Azure.ResourceManager.LabServices.netstandard2.0.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/api/Azure.ResourceManager.LabServices.netstandard2.0.cs @@ -19,7 +19,7 @@ protected LabCollection() { } } public partial class LabData : Azure.ResourceManager.Models.TrackedResourceData { - public LabData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LabData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.LabServices.Models.LabAutoShutdownProfile AutoShutdownProfile { get { throw null; } set { } } public Azure.ResourceManager.LabServices.Models.LabConnectionProfile ConnectionProfile { get { throw null; } set { } } public string Description { get { throw null; } set { } } @@ -51,7 +51,7 @@ protected LabPlanCollection() { } } public partial class LabPlanData : Azure.ResourceManager.Models.TrackedResourceData { - public LabPlanData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LabPlanData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AllowedRegions { get { throw null; } } public Azure.ResourceManager.LabServices.Models.LabAutoShutdownProfile DefaultAutoShutdownProfile { get { throw null; } set { } } public Azure.ResourceManager.LabServices.Models.LabConnectionProfile DefaultConnectionProfile { get { throw null; } set { } } @@ -311,6 +311,41 @@ protected LabVirtualMachineResource() { } public virtual System.Threading.Tasks.Task StopAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.LabServices.Mocking +{ + public partial class MockableLabServicesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableLabServicesArmClient() { } + public virtual Azure.ResourceManager.LabServices.LabPlanResource GetLabPlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.LabServices.LabResource GetLabResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.LabServices.LabServicesScheduleResource GetLabServicesScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.LabServices.LabUserResource GetLabUserResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.LabServices.LabVirtualMachineImageResource GetLabVirtualMachineImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.LabServices.LabVirtualMachineResource GetLabVirtualMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableLabServicesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableLabServicesResourceGroupResource() { } + public virtual Azure.Response GetLab(string labName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLabAsync(string labName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetLabPlan(string labPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLabPlanAsync(string labPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.LabServices.LabPlanCollection GetLabPlans() { throw null; } + public virtual Azure.ResourceManager.LabServices.LabCollection GetLabs() { throw null; } + } + public partial class MockableLabServicesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableLabServicesSubscriptionResource() { } + public virtual Azure.Pageable GetLabPlans(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLabPlansAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLabs(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLabsAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkus(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsages(Azure.Core.AzureLocation location, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesAsync(Azure.Core.AzureLocation location, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.LabServices.Models { public static partial class ArmLabServicesModelFactory diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/LabServicesExtensions.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/LabServicesExtensions.cs index 1d692e525940a..89b385728615a 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/LabServicesExtensions.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/LabServicesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.LabServices.Mocking; using Azure.ResourceManager.LabServices.Models; using Azure.ResourceManager.Resources; @@ -19,157 +20,129 @@ namespace Azure.ResourceManager.LabServices /// A class to add extension methods to Azure.ResourceManager.LabServices. public static partial class LabServicesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableLabServicesArmClient GetMockableLabServicesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableLabServicesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableLabServicesResourceGroupResource GetMockableLabServicesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableLabServicesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableLabServicesSubscriptionResource GetMockableLabServicesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableLabServicesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region LabVirtualMachineImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LabVirtualMachineImageResource GetLabVirtualMachineImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LabVirtualMachineImageResource.ValidateResourceId(id); - return new LabVirtualMachineImageResource(client, id); - } - ); + return GetMockableLabServicesArmClient(client).GetLabVirtualMachineImageResource(id); } - #endregion - #region LabPlanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LabPlanResource GetLabPlanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LabPlanResource.ValidateResourceId(id); - return new LabPlanResource(client, id); - } - ); + return GetMockableLabServicesArmClient(client).GetLabPlanResource(id); } - #endregion - #region LabResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LabResource GetLabResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LabResource.ValidateResourceId(id); - return new LabResource(client, id); - } - ); + return GetMockableLabServicesArmClient(client).GetLabResource(id); } - #endregion - #region LabServicesScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LabServicesScheduleResource GetLabServicesScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LabServicesScheduleResource.ValidateResourceId(id); - return new LabServicesScheduleResource(client, id); - } - ); + return GetMockableLabServicesArmClient(client).GetLabServicesScheduleResource(id); } - #endregion - #region LabUserResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LabUserResource GetLabUserResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LabUserResource.ValidateResourceId(id); - return new LabUserResource(client, id); - } - ); + return GetMockableLabServicesArmClient(client).GetLabUserResource(id); } - #endregion - #region LabVirtualMachineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LabVirtualMachineResource GetLabVirtualMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LabVirtualMachineResource.ValidateResourceId(id); - return new LabVirtualMachineResource(client, id); - } - ); + return GetMockableLabServicesArmClient(client).GetLabVirtualMachineResource(id); } - #endregion - /// Gets a collection of LabPlanResources in the ResourceGroupResource. + /// + /// Gets a collection of LabPlanResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LabPlanResources and their operations over a LabPlanResource. public static LabPlanCollection GetLabPlans(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLabPlans(); + return GetMockableLabServicesResourceGroupResource(resourceGroupResource).GetLabPlans(); } /// @@ -184,16 +157,20 @@ public static LabPlanCollection GetLabPlans(this ResourceGroupResource resourceG /// LabPlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs and in UI. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLabPlanAsync(this ResourceGroupResource resourceGroupResource, string labPlanName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLabPlans().GetAsync(labPlanName, cancellationToken).ConfigureAwait(false); + return await GetMockableLabServicesResourceGroupResource(resourceGroupResource).GetLabPlanAsync(labPlanName, cancellationToken).ConfigureAwait(false); } /// @@ -208,24 +185,34 @@ public static async Task> GetLabPlanAsync(this Resourc /// LabPlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs and in UI. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLabPlan(this ResourceGroupResource resourceGroupResource, string labPlanName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLabPlans().Get(labPlanName, cancellationToken); + return GetMockableLabServicesResourceGroupResource(resourceGroupResource).GetLabPlan(labPlanName, cancellationToken); } - /// Gets a collection of LabResources in the ResourceGroupResource. + /// + /// Gets a collection of LabResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LabResources and their operations over a LabResource. public static LabCollection GetLabs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLabs(); + return GetMockableLabServicesResourceGroupResource(resourceGroupResource).GetLabs(); } /// @@ -240,16 +227,20 @@ public static LabCollection GetLabs(this ResourceGroupResource resourceGroupReso /// Labs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the lab that uniquely identifies it within containing lab plan. Used in resource URIs. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLabAsync(this ResourceGroupResource resourceGroupResource, string labName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLabs().GetAsync(labName, cancellationToken).ConfigureAwait(false); + return await GetMockableLabServicesResourceGroupResource(resourceGroupResource).GetLabAsync(labName, cancellationToken).ConfigureAwait(false); } /// @@ -264,16 +255,20 @@ public static async Task> GetLabAsync(this ResourceGroupRe /// Labs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the lab that uniquely identifies it within containing lab plan. Used in resource URIs. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLab(this ResourceGroupResource resourceGroupResource, string labName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLabs().Get(labName, cancellationToken); + return GetMockableLabServicesResourceGroupResource(resourceGroupResource).GetLab(labName, cancellationToken); } /// @@ -288,6 +283,10 @@ public static Response GetLab(this ResourceGroupResource resourceGr /// LabPlans_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply to the operation. @@ -295,7 +294,7 @@ public static Response GetLab(this ResourceGroupResource resourceGr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLabPlansAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLabPlansAsync(filter, cancellationToken); + return GetMockableLabServicesSubscriptionResource(subscriptionResource).GetLabPlansAsync(filter, cancellationToken); } /// @@ -310,6 +309,10 @@ public static AsyncPageable GetLabPlansAsync(this SubscriptionR /// LabPlans_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply to the operation. @@ -317,7 +320,7 @@ public static AsyncPageable GetLabPlansAsync(this SubscriptionR /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLabPlans(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLabPlans(filter, cancellationToken); + return GetMockableLabServicesSubscriptionResource(subscriptionResource).GetLabPlans(filter, cancellationToken); } /// @@ -332,6 +335,10 @@ public static Pageable GetLabPlans(this SubscriptionResource su /// Labs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply to the operation. @@ -339,7 +346,7 @@ public static Pageable GetLabPlans(this SubscriptionResource su /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLabsAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLabsAsync(filter, cancellationToken); + return GetMockableLabServicesSubscriptionResource(subscriptionResource).GetLabsAsync(filter, cancellationToken); } /// @@ -354,6 +361,10 @@ public static AsyncPageable GetLabsAsync(this SubscriptionResource /// Labs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply to the operation. @@ -361,7 +372,7 @@ public static AsyncPageable GetLabsAsync(this SubscriptionResource /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLabs(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLabs(filter, cancellationToken); + return GetMockableLabServicesSubscriptionResource(subscriptionResource).GetLabs(filter, cancellationToken); } /// @@ -376,6 +387,10 @@ public static Pageable GetLabs(this SubscriptionResource subscripti /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply to the operation. @@ -383,7 +398,7 @@ public static Pageable GetLabs(this SubscriptionResource subscripti /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSkusAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusAsync(filter, cancellationToken); + return GetMockableLabServicesSubscriptionResource(subscriptionResource).GetSkusAsync(filter, cancellationToken); } /// @@ -398,6 +413,10 @@ public static AsyncPageable GetSkusAsync(this Subscript /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply to the operation. @@ -405,7 +424,7 @@ public static AsyncPageable GetSkusAsync(this Subscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSkus(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkus(filter, cancellationToken); + return GetMockableLabServicesSubscriptionResource(subscriptionResource).GetSkus(filter, cancellationToken); } /// @@ -420,6 +439,10 @@ public static Pageable GetSkus(this SubscriptionResourc /// Usages_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location name. @@ -428,7 +451,7 @@ public static Pageable GetSkus(this SubscriptionResourc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesAsync(location, filter, cancellationToken); + return GetMockableLabServicesSubscriptionResource(subscriptionResource).GetUsagesAsync(location, filter, cancellationToken); } /// @@ -443,6 +466,10 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionRe /// Usages_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location name. @@ -451,7 +478,7 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionRe /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsages(this SubscriptionResource subscriptionResource, AzureLocation location, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsages(location, filter, cancellationToken); + return GetMockableLabServicesSubscriptionResource(subscriptionResource).GetUsages(location, filter, cancellationToken); } } } diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesArmClient.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesArmClient.cs new file mode 100644 index 0000000000000..ab3d020d2c42b --- /dev/null +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesArmClient.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.LabServices; + +namespace Azure.ResourceManager.LabServices.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableLabServicesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableLabServicesArmClient() + { + } + + /// 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 MockableLabServicesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableLabServicesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LabVirtualMachineImageResource GetLabVirtualMachineImageResource(ResourceIdentifier id) + { + LabVirtualMachineImageResource.ValidateResourceId(id); + return new LabVirtualMachineImageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LabPlanResource GetLabPlanResource(ResourceIdentifier id) + { + LabPlanResource.ValidateResourceId(id); + return new LabPlanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LabResource GetLabResource(ResourceIdentifier id) + { + LabResource.ValidateResourceId(id); + return new LabResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LabServicesScheduleResource GetLabServicesScheduleResource(ResourceIdentifier id) + { + LabServicesScheduleResource.ValidateResourceId(id); + return new LabServicesScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LabUserResource GetLabUserResource(ResourceIdentifier id) + { + LabUserResource.ValidateResourceId(id); + return new LabUserResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LabVirtualMachineResource GetLabVirtualMachineResource(ResourceIdentifier id) + { + LabVirtualMachineResource.ValidateResourceId(id); + return new LabVirtualMachineResource(Client, id); + } + } +} diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesResourceGroupResource.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesResourceGroupResource.cs new file mode 100644 index 0000000000000..394f021505b56 --- /dev/null +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.LabServices; + +namespace Azure.ResourceManager.LabServices.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableLabServicesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableLabServicesResourceGroupResource() + { + } + + /// 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 MockableLabServicesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LabPlanResources in the ResourceGroupResource. + /// An object representing collection of LabPlanResources and their operations over a LabPlanResource. + public virtual LabPlanCollection GetLabPlans() + { + return GetCachedClient(client => new LabPlanCollection(client, Id)); + } + + /// + /// Retrieves the properties of a Lab Plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName} + /// + /// + /// Operation Id + /// LabPlans_Get + /// + /// + /// + /// The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs and in UI. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLabPlanAsync(string labPlanName, CancellationToken cancellationToken = default) + { + return await GetLabPlans().GetAsync(labPlanName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the properties of a Lab Plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName} + /// + /// + /// Operation Id + /// LabPlans_Get + /// + /// + /// + /// The name of the lab plan that uniquely identifies it within containing resource group. Used in resource URIs and in UI. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLabPlan(string labPlanName, CancellationToken cancellationToken = default) + { + return GetLabPlans().Get(labPlanName, cancellationToken); + } + + /// Gets a collection of LabResources in the ResourceGroupResource. + /// An object representing collection of LabResources and their operations over a LabResource. + public virtual LabCollection GetLabs() + { + return GetCachedClient(client => new LabCollection(client, Id)); + } + + /// + /// Returns the properties of a lab resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName} + /// + /// + /// Operation Id + /// Labs_Get + /// + /// + /// + /// The name of the lab that uniquely identifies it within containing lab plan. Used in resource URIs. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLabAsync(string labName, CancellationToken cancellationToken = default) + { + return await GetLabs().GetAsync(labName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the properties of a lab resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName} + /// + /// + /// Operation Id + /// Labs_Get + /// + /// + /// + /// The name of the lab that uniquely identifies it within containing lab plan. Used in resource URIs. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLab(string labName, CancellationToken cancellationToken = default) + { + return GetLabs().Get(labName, cancellationToken); + } + } +} diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesSubscriptionResource.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesSubscriptionResource.cs new file mode 100644 index 0000000000000..8a223a7d70140 --- /dev/null +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/MockableLabServicesSubscriptionResource.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.LabServices; +using Azure.ResourceManager.LabServices.Models; + +namespace Azure.ResourceManager.LabServices.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableLabServicesSubscriptionResource : ArmResource + { + private ClientDiagnostics _labPlanClientDiagnostics; + private LabPlansRestOperations _labPlanRestClient; + private ClientDiagnostics _labClientDiagnostics; + private LabsRestOperations _labRestClient; + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableLabServicesSubscriptionResource() + { + } + + /// 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 MockableLabServicesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LabPlanClientDiagnostics => _labPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LabServices", LabPlanResource.ResourceType.Namespace, Diagnostics); + private LabPlansRestOperations LabPlanRestClient => _labPlanRestClient ??= new LabPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LabPlanResource.ResourceType)); + private ClientDiagnostics LabClientDiagnostics => _labClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LabServices", LabResource.ResourceType.Namespace, Diagnostics); + private LabsRestOperations LabRestClient => _labRestClient ??= new LabsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LabResource.ResourceType)); + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LabServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LabServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labPlans + /// + /// + /// Operation Id + /// LabPlans_ListBySubscription + /// + /// + /// + /// The filter to apply to the operation. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLabPlansAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LabPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LabPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LabPlanResource(Client, LabPlanData.DeserializeLabPlanData(e)), LabPlanClientDiagnostics, Pipeline, "MockableLabServicesSubscriptionResource.GetLabPlans", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of all lab plans within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labPlans + /// + /// + /// Operation Id + /// LabPlans_ListBySubscription + /// + /// + /// + /// The filter to apply to the operation. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLabPlans(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LabPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LabPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LabPlanResource(Client, LabPlanData.DeserializeLabPlanData(e)), LabPlanClientDiagnostics, Pipeline, "MockableLabServicesSubscriptionResource.GetLabPlans", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labs + /// + /// + /// Operation Id + /// Labs_ListBySubscription + /// + /// + /// + /// The filter to apply to the operation. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLabsAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LabRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LabRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LabResource(Client, LabData.DeserializeLabData(e)), LabClientDiagnostics, Pipeline, "MockableLabServicesSubscriptionResource.GetLabs", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of all labs for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labs + /// + /// + /// Operation Id + /// Labs_ListBySubscription + /// + /// + /// + /// The filter to apply to the operation. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLabs(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LabRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LabRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LabResource(Client, LabData.DeserializeLabData(e)), LabClientDiagnostics, Pipeline, "MockableLabServicesSubscriptionResource.GetLabs", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of Azure Lab Services resource SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The filter to apply to the operation. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableLabServicesSku.DeserializeAvailableLabServicesSku, SkusClientDiagnostics, Pipeline, "MockableLabServicesSubscriptionResource.GetSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of Azure Lab Services resource SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The filter to apply to the operation. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkus(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableLabServicesSku.DeserializeAvailableLabServicesSku, SkusClientDiagnostics, Pipeline, "MockableLabServicesSubscriptionResource.GetSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Returns list of usage per SKU family for the specified subscription in the specified region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListByLocation + /// + /// + /// + /// The location name. + /// The filter to apply to the operation. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(AzureLocation location, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LabServicesUsage.DeserializeLabServicesUsage, UsagesClientDiagnostics, Pipeline, "MockableLabServicesSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Returns list of usage per SKU family for the specified subscription in the specified region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListByLocation + /// + /// + /// + /// The location name. + /// The filter to apply to the operation. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(AzureLocation location, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LabServicesUsage.DeserializeLabServicesUsage, UsagesClientDiagnostics, Pipeline, "MockableLabServicesSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 647728d9c8f80..0000000000000 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.LabServices -{ - /// 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 LabPlanResources in the ResourceGroupResource. - /// An object representing collection of LabPlanResources and their operations over a LabPlanResource. - public virtual LabPlanCollection GetLabPlans() - { - return GetCachedClient(Client => new LabPlanCollection(Client, Id)); - } - - /// Gets a collection of LabResources in the ResourceGroupResource. - /// An object representing collection of LabResources and their operations over a LabResource. - public virtual LabCollection GetLabs() - { - return GetCachedClient(Client => new LabCollection(Client, Id)); - } - } -} diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index f1425715fe143..0000000000000 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.LabServices.Models; - -namespace Azure.ResourceManager.LabServices -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _labPlanClientDiagnostics; - private LabPlansRestOperations _labPlanRestClient; - private ClientDiagnostics _labClientDiagnostics; - private LabsRestOperations _labRestClient; - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - - /// 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 LabPlanClientDiagnostics => _labPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LabServices", LabPlanResource.ResourceType.Namespace, Diagnostics); - private LabPlansRestOperations LabPlanRestClient => _labPlanRestClient ??= new LabPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LabPlanResource.ResourceType)); - private ClientDiagnostics LabClientDiagnostics => _labClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LabServices", LabResource.ResourceType.Namespace, Diagnostics); - private LabsRestOperations LabRestClient => _labRestClient ??= new LabsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LabResource.ResourceType)); - private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LabServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LabServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns a list of all lab plans within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labPlans - /// - /// - /// Operation Id - /// LabPlans_ListBySubscription - /// - /// - /// - /// The filter to apply to the operation. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLabPlansAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LabPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LabPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LabPlanResource(Client, LabPlanData.DeserializeLabPlanData(e)), LabPlanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLabPlans", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of all lab plans within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labPlans - /// - /// - /// Operation Id - /// LabPlans_ListBySubscription - /// - /// - /// - /// The filter to apply to the operation. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLabPlans(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LabPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LabPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LabPlanResource(Client, LabPlanData.DeserializeLabPlanData(e)), LabPlanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLabPlans", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of all labs for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labs - /// - /// - /// Operation Id - /// Labs_ListBySubscription - /// - /// - /// - /// The filter to apply to the operation. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLabsAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LabRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LabRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LabResource(Client, LabData.DeserializeLabData(e)), LabClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLabs", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of all labs for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labs - /// - /// - /// Operation Id - /// Labs_ListBySubscription - /// - /// - /// - /// The filter to apply to the operation. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLabs(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LabRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LabRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LabResource(Client, LabData.DeserializeLabData(e)), LabClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLabs", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of Azure Lab Services resource SKUs. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The filter to apply to the operation. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableLabServicesSku.DeserializeAvailableLabServicesSku, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of Azure Lab Services resource SKUs. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The filter to apply to the operation. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkus(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableLabServicesSku.DeserializeAvailableLabServicesSku, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Returns list of usage per SKU family for the specified subscription in the specified region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_ListByLocation - /// - /// - /// - /// The location name. - /// The filter to apply to the operation. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(AzureLocation location, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LabServicesUsage.DeserializeLabServicesUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Returns list of usage per SKU family for the specified subscription in the specified region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_ListByLocation - /// - /// - /// - /// The location name. - /// The filter to apply to the operation. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(AzureLocation location, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LabServicesUsage.DeserializeLabServicesUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanResource.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanResource.cs index f2faa0f4718e1..82d94e2b9d934 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanResource.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.LabServices public partial class LabPlanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labPlanName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labPlanName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LabVirtualMachineImageResources and their operations over a LabVirtualMachineImageResource. public virtual LabVirtualMachineImageCollection GetLabVirtualMachineImages() { - return GetCachedClient(Client => new LabVirtualMachineImageCollection(Client, Id)); + return GetCachedClient(client => new LabVirtualMachineImageCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual LabVirtualMachineImageCollection GetLabVirtualMachineImages() /// /// The image name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLabVirtualMachineImageAsync(string imageName, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetLabVirtua /// /// The image name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLabVirtualMachineImage(string imageName, CancellationToken cancellationToken = default) { diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabResource.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabResource.cs index 01a3e07ba083d..56ea5094d9655 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabResource.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.LabServices public partial class LabResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LabServicesScheduleResources and their operations over a LabServicesScheduleResource. public virtual LabServicesScheduleCollection GetLabServicesSchedules() { - return GetCachedClient(Client => new LabServicesScheduleCollection(Client, Id)); + return GetCachedClient(client => new LabServicesScheduleCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual LabServicesScheduleCollection GetLabServicesSchedules() /// /// The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLabServicesScheduleAsync(string scheduleName, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetLabServicesS /// /// The name of the schedule that uniquely identifies it within containing lab. Used in resource URIs. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLabServicesSchedule(string scheduleName, CancellationToken cancellationToken = default) { @@ -145,7 +148,7 @@ public virtual Response GetLabServicesSchedule(stri /// An object representing collection of LabUserResources and their operations over a LabUserResource. public virtual LabUserCollection GetLabUsers() { - return GetCachedClient(Client => new LabUserCollection(Client, Id)); + return GetCachedClient(client => new LabUserCollection(client, Id)); } /// @@ -163,8 +166,8 @@ public virtual LabUserCollection GetLabUsers() /// /// The name of the user that uniquely identifies it within containing lab. Used in resource URIs. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLabUserAsync(string userName, CancellationToken cancellationToken = default) { @@ -186,8 +189,8 @@ public virtual async Task> GetLabUserAsync(string user /// /// The name of the user that uniquely identifies it within containing lab. Used in resource URIs. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLabUser(string userName, CancellationToken cancellationToken = default) { @@ -198,7 +201,7 @@ public virtual Response GetLabUser(string userName, Cancellatio /// An object representing collection of LabVirtualMachineResources and their operations over a LabVirtualMachineResource. public virtual LabVirtualMachineCollection GetLabVirtualMachines() { - return GetCachedClient(Client => new LabVirtualMachineCollection(Client, Id)); + return GetCachedClient(client => new LabVirtualMachineCollection(client, Id)); } /// @@ -216,8 +219,8 @@ public virtual LabVirtualMachineCollection GetLabVirtualMachines() /// /// The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource URIs. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLabVirtualMachineAsync(string virtualMachineName, CancellationToken cancellationToken = default) { @@ -239,8 +242,8 @@ public virtual async Task> GetLabVirtualMach /// /// The ID of the virtual machine that uniquely identifies it within the containing lab. Used in resource URIs. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLabVirtualMachine(string virtualMachineName, CancellationToken cancellationToken = default) { diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabServicesScheduleResource.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabServicesScheduleResource.cs index 065c157081327..e708951717b1a 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabServicesScheduleResource.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabServicesScheduleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.LabServices public partial class LabServicesScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The scheduleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string scheduleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/schedules/{scheduleName}"; diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabUserResource.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabUserResource.cs index 937ccee170503..bd56e7a9b6ef1 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabUserResource.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabUserResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.LabServices public partial class LabUserResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The userName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/users/{userName}"; diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineImageResource.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineImageResource.cs index d36e134fe5e77..132fb4581f82d 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineImageResource.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineImageResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.LabServices public partial class LabVirtualMachineImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labPlanName. + /// The imageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labPlanName, string imageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labPlans/{labPlanName}/images/{imageName}"; diff --git a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineResource.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineResource.cs index a394e2d8a5427..2f01aa636b172 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineResource.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabVirtualMachineResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.LabServices public partial class LabVirtualMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The virtualMachineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string virtualMachineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labs/{labName}/virtualMachines/{virtualMachineName}"; diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/Azure.ResourceManager.LoadTesting.sln b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/Azure.ResourceManager.LoadTesting.sln index b3c7f14d32045..90514d9dfcbde 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/Azure.ResourceManager.LoadTesting.sln +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/Azure.ResourceManager.LoadTesting.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{65D4B47A-B717-491B-8539-7002738F4BB9}") = "Azure.ResourceManager.LoadTesting", "src\Azure.ResourceManager.LoadTesting.csproj", "{3E734620-9710-42A0-AB64-095ED203143F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.LoadTesting", "src\Azure.ResourceManager.LoadTesting.csproj", "{3E734620-9710-42A0-AB64-095ED203143F}" EndProject -Project("{65D4B47A-B717-491B-8539-7002738F4BB9}") = "Azure.ResourceManager.LoadTesting.Tests", "tests\Azure.ResourceManager.LoadTesting.Tests.csproj", "{6C77A7BF-0FFB-4CBB-8B0E-7822C0874CE8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.LoadTesting.Tests", "tests\Azure.ResourceManager.LoadTesting.Tests.csproj", "{6C77A7BF-0FFB-4CBB-8B0E-7822C0874CE8}" EndProject -Project("{65D4B47A-B717-491B-8539-7002738F4BB9}") = "Azure.ResourceManager.LoadTesting.Samples", "samples\Azure.ResourceManager.LoadTesting.Samples.csproj", "{BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.LoadTesting.Samples", "samples\Azure.ResourceManager.LoadTesting.Samples.csproj", "{BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A045540F-B15C-48DD-841E-320FC3F467C1} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {6C77A7BF-0FFB-4CBB-8B0E-7822C0874CE8}.Release|x64.Build.0 = Release|Any CPU {6C77A7BF-0FFB-4CBB-8B0E-7822C0874CE8}.Release|x86.ActiveCfg = Release|Any CPU {6C77A7BF-0FFB-4CBB-8B0E-7822C0874CE8}.Release|x86.Build.0 = Release|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Debug|x64.ActiveCfg = Debug|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Debug|x64.Build.0 = Debug|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Debug|x86.ActiveCfg = Debug|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Debug|x86.Build.0 = Debug|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Release|Any CPU.Build.0 = Release|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Release|x64.ActiveCfg = Release|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Release|x64.Build.0 = Release|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Release|x86.ActiveCfg = Release|Any CPU + {BEEED57D-0C08-4BDC-A31E-97B7C3964E0A}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A045540F-B15C-48DD-841E-320FC3F467C1} EndGlobalSection EndGlobal diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/api/Azure.ResourceManager.LoadTesting.netstandard2.0.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/api/Azure.ResourceManager.LoadTesting.netstandard2.0.cs index 551e24aff61d1..f79acb49a7d62 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/api/Azure.ResourceManager.LoadTesting.netstandard2.0.cs +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/api/Azure.ResourceManager.LoadTesting.netstandard2.0.cs @@ -88,7 +88,7 @@ protected LoadTestingResourceCollection() { } } public partial class LoadTestingResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public LoadTestingResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LoadTestingResourceData(Azure.Core.AzureLocation location) { } public string DataPlaneUri { get { throw null; } } public string Description { get { throw null; } set { } } public Azure.ResourceManager.LoadTesting.Models.LoadTestingCmkEncryptionProperties Encryption { get { throw null; } set { } } @@ -96,6 +96,31 @@ public LoadTestingResourceData(Azure.Core.AzureLocation location) : base (defaul public Azure.ResourceManager.LoadTesting.Models.LoadTestingProvisioningState? ProvisioningState { get { throw null; } } } } +namespace Azure.ResourceManager.LoadTesting.Mocking +{ + public partial class MockableLoadTestingArmClient : Azure.ResourceManager.ArmResource + { + protected MockableLoadTestingArmClient() { } + public virtual Azure.ResourceManager.LoadTesting.LoadTestingQuotaResource GetLoadTestingQuotaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.LoadTesting.LoadTestingResource GetLoadTestingResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableLoadTestingResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableLoadTestingResourceGroupResource() { } + public virtual Azure.Response GetLoadTestingResource(string loadTestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLoadTestingResourceAsync(string loadTestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.LoadTesting.LoadTestingResourceCollection GetLoadTestingResources() { throw null; } + } + public partial class MockableLoadTestingSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableLoadTestingSubscriptionResource() { } + public virtual Azure.ResourceManager.LoadTesting.LoadTestingQuotaCollection GetAllLoadTestingQuota(Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response GetLoadTestingQuota(Azure.Core.AzureLocation location, string quotaBucketName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLoadTestingQuotaAsync(Azure.Core.AzureLocation location, string quotaBucketName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLoadTestingResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLoadTestingResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.LoadTesting.Models { public static partial class ArmLoadTestingModelFactory diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/LoadTestingExtensions.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/LoadTestingExtensions.cs index d12ca546e7806..d26d7675ef642 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/LoadTestingExtensions.cs +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/LoadTestingExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.LoadTesting.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.LoadTesting @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.LoadTesting /// A class to add extension methods to Azure.ResourceManager.LoadTesting. public static partial class LoadTestingExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableLoadTestingArmClient GetMockableLoadTestingArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableLoadTestingArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableLoadTestingResourceGroupResource GetMockableLoadTestingResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableLoadTestingResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableLoadTestingSubscriptionResource GetMockableLoadTestingSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableLoadTestingSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region LoadTestingQuotaResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LoadTestingQuotaResource GetLoadTestingQuotaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LoadTestingQuotaResource.ValidateResourceId(id); - return new LoadTestingQuotaResource(client, id); - } - ); + return GetMockableLoadTestingArmClient(client).GetLoadTestingQuotaResource(id); } - #endregion - #region LoadTestingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LoadTestingResource GetLoadTestingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LoadTestingResource.ValidateResourceId(id); - return new LoadTestingResource(client, id); - } - ); + return GetMockableLoadTestingArmClient(client).GetLoadTestingResource(id); } - #endregion - /// Gets a collection of LoadTestingResources in the ResourceGroupResource. + /// + /// Gets a collection of LoadTestingResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LoadTestingResources and their operations over a LoadTestingResource. public static LoadTestingResourceCollection GetLoadTestingResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLoadTestingResources(); + return GetMockableLoadTestingResourceGroupResource(resourceGroupResource).GetLoadTestingResources(); } /// @@ -107,16 +92,20 @@ public static LoadTestingResourceCollection GetLoadTestingResources(this Resourc /// LoadTests_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Load Test name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLoadTestingResourceAsync(this ResourceGroupResource resourceGroupResource, string loadTestName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLoadTestingResources().GetAsync(loadTestName, cancellationToken).ConfigureAwait(false); + return await GetMockableLoadTestingResourceGroupResource(resourceGroupResource).GetLoadTestingResourceAsync(loadTestName, cancellationToken).ConfigureAwait(false); } /// @@ -131,25 +120,35 @@ public static async Task> GetLoadTestingResourceAs /// LoadTests_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Load Test name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLoadTestingResource(this ResourceGroupResource resourceGroupResource, string loadTestName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLoadTestingResources().Get(loadTestName, cancellationToken); + return GetMockableLoadTestingResourceGroupResource(resourceGroupResource).GetLoadTestingResource(loadTestName, cancellationToken); } - /// Gets a collection of LoadTestingQuotaResources in the SubscriptionResource. + /// + /// Gets a collection of LoadTestingQuotaResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of Azure region. /// An object representing collection of LoadTestingQuotaResources and their operations over a LoadTestingQuotaResource. public static LoadTestingQuotaCollection GetAllLoadTestingQuota(this SubscriptionResource subscriptionResource, AzureLocation location) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllLoadTestingQuota(location); + return GetMockableLoadTestingSubscriptionResource(subscriptionResource).GetAllLoadTestingQuota(location); } /// @@ -164,17 +163,21 @@ public static LoadTestingQuotaCollection GetAllLoadTestingQuota(this Subscriptio /// Quotas_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. /// Quota Bucket name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLoadTestingQuotaAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string quotaBucketName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetAllLoadTestingQuota(location).GetAsync(quotaBucketName, cancellationToken).ConfigureAwait(false); + return await GetMockableLoadTestingSubscriptionResource(subscriptionResource).GetLoadTestingQuotaAsync(location, quotaBucketName, cancellationToken).ConfigureAwait(false); } /// @@ -189,17 +192,21 @@ public static async Task> GetLoadTestingQuota /// Quotas_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. /// Quota Bucket name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLoadTestingQuota(this SubscriptionResource subscriptionResource, AzureLocation location, string quotaBucketName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetAllLoadTestingQuota(location).Get(quotaBucketName, cancellationToken); + return GetMockableLoadTestingSubscriptionResource(subscriptionResource).GetLoadTestingQuota(location, quotaBucketName, cancellationToken); } /// @@ -214,13 +221,17 @@ public static Response GetLoadTestingQuota(this Subscr /// LoadTests_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetLoadTestingResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLoadTestingResourcesAsync(cancellationToken); + return GetMockableLoadTestingSubscriptionResource(subscriptionResource).GetLoadTestingResourcesAsync(cancellationToken); } /// @@ -235,13 +246,17 @@ public static AsyncPageable GetLoadTestingResourcesAsync(th /// LoadTests_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetLoadTestingResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLoadTestingResources(cancellationToken); + return GetMockableLoadTestingSubscriptionResource(subscriptionResource).GetLoadTestingResources(cancellationToken); } } } diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingArmClient.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingArmClient.cs new file mode 100644 index 0000000000000..72f9562fe5d7d --- /dev/null +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.LoadTesting; + +namespace Azure.ResourceManager.LoadTesting.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableLoadTestingArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableLoadTestingArmClient() + { + } + + /// 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 MockableLoadTestingArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableLoadTestingArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LoadTestingQuotaResource GetLoadTestingQuotaResource(ResourceIdentifier id) + { + LoadTestingQuotaResource.ValidateResourceId(id); + return new LoadTestingQuotaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LoadTestingResource GetLoadTestingResource(ResourceIdentifier id) + { + LoadTestingResource.ValidateResourceId(id); + return new LoadTestingResource(Client, id); + } + } +} diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingResourceGroupResource.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingResourceGroupResource.cs new file mode 100644 index 0000000000000..c260b8c2cc604 --- /dev/null +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.LoadTesting; + +namespace Azure.ResourceManager.LoadTesting.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableLoadTestingResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableLoadTestingResourceGroupResource() + { + } + + /// 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 MockableLoadTestingResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LoadTestingResources in the ResourceGroupResource. + /// An object representing collection of LoadTestingResources and their operations over a LoadTestingResource. + public virtual LoadTestingResourceCollection GetLoadTestingResources() + { + return GetCachedClient(client => new LoadTestingResourceCollection(client, Id)); + } + + /// + /// Get a LoadTest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName} + /// + /// + /// Operation Id + /// LoadTests_Get + /// + /// + /// + /// Load Test name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLoadTestingResourceAsync(string loadTestName, CancellationToken cancellationToken = default) + { + return await GetLoadTestingResources().GetAsync(loadTestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a LoadTest resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName} + /// + /// + /// Operation Id + /// LoadTests_Get + /// + /// + /// + /// Load Test name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLoadTestingResource(string loadTestName, CancellationToken cancellationToken = default) + { + return GetLoadTestingResources().Get(loadTestName, cancellationToken); + } + } +} diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingSubscriptionResource.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingSubscriptionResource.cs new file mode 100644 index 0000000000000..2908c6f74f320 --- /dev/null +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/MockableLoadTestingSubscriptionResource.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.LoadTesting; + +namespace Azure.ResourceManager.LoadTesting.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableLoadTestingSubscriptionResource : ArmResource + { + private ClientDiagnostics _loadTestingResourceLoadTestsClientDiagnostics; + private LoadTestsRestOperations _loadTestingResourceLoadTestsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableLoadTestingSubscriptionResource() + { + } + + /// 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 MockableLoadTestingSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LoadTestingResourceLoadTestsClientDiagnostics => _loadTestingResourceLoadTestsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LoadTesting", LoadTestingResource.ResourceType.Namespace, Diagnostics); + private LoadTestsRestOperations LoadTestingResourceLoadTestsRestClient => _loadTestingResourceLoadTestsRestClient ??= new LoadTestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LoadTestingResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LoadTestingQuotaResources in the SubscriptionResource. + /// The name of Azure region. + /// An object representing collection of LoadTestingQuotaResources and their operations over a LoadTestingQuotaResource. + public virtual LoadTestingQuotaCollection GetAllLoadTestingQuota(AzureLocation location) + { + return new LoadTestingQuotaCollection(Client, Id, location); + } + + /// + /// Get the available quota for a quota bucket per region per subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName} + /// + /// + /// Operation Id + /// Quotas_Get + /// + /// + /// + /// The name of Azure region. + /// Quota Bucket name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLoadTestingQuotaAsync(AzureLocation location, string quotaBucketName, CancellationToken cancellationToken = default) + { + return await GetAllLoadTestingQuota(location).GetAsync(quotaBucketName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the available quota for a quota bucket per region per subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName} + /// + /// + /// Operation Id + /// Quotas_Get + /// + /// + /// + /// The name of Azure region. + /// Quota Bucket name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLoadTestingQuota(AzureLocation location, string quotaBucketName, CancellationToken cancellationToken = default) + { + return GetAllLoadTestingQuota(location).Get(quotaBucketName, cancellationToken); + } + + /// + /// Lists loadtests resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/loadTests + /// + /// + /// Operation Id + /// LoadTests_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLoadTestingResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LoadTestingResourceLoadTestsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LoadTestingResourceLoadTestsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LoadTestingResource(Client, LoadTestingResourceData.DeserializeLoadTestingResourceData(e)), LoadTestingResourceLoadTestsClientDiagnostics, Pipeline, "MockableLoadTestingSubscriptionResource.GetLoadTestingResources", "value", "nextLink", cancellationToken); + } + + /// + /// Lists loadtests resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/loadTests + /// + /// + /// Operation Id + /// LoadTests_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLoadTestingResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LoadTestingResourceLoadTestsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LoadTestingResourceLoadTestsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LoadTestingResource(Client, LoadTestingResourceData.DeserializeLoadTestingResourceData(e)), LoadTestingResourceLoadTestsClientDiagnostics, Pipeline, "MockableLoadTestingSubscriptionResource.GetLoadTestingResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3b6684064c294..0000000000000 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.LoadTesting -{ - /// 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 LoadTestingResources in the ResourceGroupResource. - /// An object representing collection of LoadTestingResources and their operations over a LoadTestingResource. - public virtual LoadTestingResourceCollection GetLoadTestingResources() - { - return GetCachedClient(Client => new LoadTestingResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index dafdba0f7c1b6..0000000000000 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.LoadTesting -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _loadTestingResourceLoadTestsClientDiagnostics; - private LoadTestsRestOperations _loadTestingResourceLoadTestsRestClient; - - /// 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 LoadTestingResourceLoadTestsClientDiagnostics => _loadTestingResourceLoadTestsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.LoadTesting", LoadTestingResource.ResourceType.Namespace, Diagnostics); - private LoadTestsRestOperations LoadTestingResourceLoadTestsRestClient => _loadTestingResourceLoadTestsRestClient ??= new LoadTestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LoadTestingResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of LoadTestingQuotaResources in the SubscriptionResource. - /// The name of Azure region. - /// An object representing collection of LoadTestingQuotaResources and their operations over a LoadTestingQuotaResource. - public virtual LoadTestingQuotaCollection GetAllLoadTestingQuota(AzureLocation location) - { - return new LoadTestingQuotaCollection(Client, Id, location); - } - - /// - /// Lists loadtests resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/loadTests - /// - /// - /// Operation Id - /// LoadTests_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLoadTestingResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LoadTestingResourceLoadTestsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LoadTestingResourceLoadTestsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LoadTestingResource(Client, LoadTestingResourceData.DeserializeLoadTestingResourceData(e)), LoadTestingResourceLoadTestsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLoadTestingResources", "value", "nextLink", cancellationToken); - } - - /// - /// Lists loadtests resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/loadTests - /// - /// - /// Operation Id - /// LoadTests_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLoadTestingResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LoadTestingResourceLoadTestsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LoadTestingResourceLoadTestsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LoadTestingResource(Client, LoadTestingResourceData.DeserializeLoadTestingResourceData(e)), LoadTestingResourceLoadTestsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLoadTestingResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingQuotaResource.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingQuotaResource.cs index 530de70354a15..47c9690528369 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingQuotaResource.cs +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingQuotaResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.LoadTesting public partial class LoadTestingQuotaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The quotaBucketName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string quotaBucketName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName}"; diff --git a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingResource.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingResource.cs index e6e2192e3f89d..661b8f3943cc6 100644 --- a/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingResource.cs +++ b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/LoadTestingResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.LoadTesting public partial class LoadTestingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The loadTestName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string loadTestName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/api/Azure.ResourceManager.Logic.netstandard2.0.cs b/sdk/logic/Azure.ResourceManager.Logic/api/Azure.ResourceManager.Logic.netstandard2.0.cs index 54ff45d32c604..c4502b1f905c6 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/api/Azure.ResourceManager.Logic.netstandard2.0.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/api/Azure.ResourceManager.Logic.netstandard2.0.cs @@ -19,7 +19,7 @@ protected IntegrationAccountAgreementCollection() { } } public partial class IntegrationAccountAgreementData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountAgreementData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountAgreementType agreementType, string hostPartner, string guestPartner, Azure.ResourceManager.Logic.Models.IntegrationAccountBusinessIdentity hostIdentity, Azure.ResourceManager.Logic.Models.IntegrationAccountBusinessIdentity guestIdentity, Azure.ResourceManager.Logic.Models.IntegrationAccountAgreementContent content) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountAgreementData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountAgreementType agreementType, string hostPartner, string guestPartner, Azure.ResourceManager.Logic.Models.IntegrationAccountBusinessIdentity hostIdentity, Azure.ResourceManager.Logic.Models.IntegrationAccountBusinessIdentity guestIdentity, Azure.ResourceManager.Logic.Models.IntegrationAccountAgreementContent content) { } public Azure.ResourceManager.Logic.Models.IntegrationAccountAgreementType AgreementType { get { throw null; } set { } } public System.DateTimeOffset? ChangedOn { get { throw null; } } public Azure.ResourceManager.Logic.Models.IntegrationAccountAgreementContent Content { get { throw null; } set { } } @@ -71,7 +71,7 @@ protected IntegrationAccountAssemblyDefinitionCollection() { } } public partial class IntegrationAccountAssemblyDefinitionData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountAssemblyDefinitionData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountAssemblyProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountAssemblyDefinitionData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountAssemblyProperties properties) { } public Azure.ResourceManager.Logic.Models.IntegrationAccountAssemblyProperties Properties { get { throw null; } set { } } } public partial class IntegrationAccountAssemblyDefinitionResource : Azure.ResourceManager.ArmResource @@ -115,7 +115,7 @@ protected IntegrationAccountBatchConfigurationCollection() { } } public partial class IntegrationAccountBatchConfigurationData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountBatchConfigurationData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountBatchConfigurationProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountBatchConfigurationData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountBatchConfigurationProperties properties) { } public Azure.ResourceManager.Logic.Models.IntegrationAccountBatchConfigurationProperties Properties { get { throw null; } set { } } } public partial class IntegrationAccountBatchConfigurationResource : Azure.ResourceManager.ArmResource @@ -157,7 +157,7 @@ protected IntegrationAccountCertificateCollection() { } } public partial class IntegrationAccountCertificateData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountCertificateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountCertificateData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? ChangedOn { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.Logic.Models.IntegrationAccountKeyVaultKeyReference Key { get { throw null; } set { } } @@ -203,7 +203,7 @@ protected IntegrationAccountCollection() { } } public partial class IntegrationAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Logic.Models.LogicResourceReference IntegrationServiceEnvironment { get { throw null; } set { } } public Azure.ResourceManager.Logic.Models.IntegrationAccountSkuName? SkuName { get { throw null; } set { } } public Azure.ResourceManager.Logic.Models.LogicWorkflowState? State { get { throw null; } set { } } @@ -227,7 +227,7 @@ protected IntegrationAccountMapCollection() { } } public partial class IntegrationAccountMapData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountMapData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountMapType mapType) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountMapData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountMapType mapType) { } public System.DateTimeOffset? ChangedOn { get { throw null; } } public System.BinaryData Content { get { throw null; } set { } } public Azure.ResourceManager.Logic.Models.LogicContentLink ContentLink { get { throw null; } } @@ -278,7 +278,7 @@ protected IntegrationAccountPartnerCollection() { } } public partial class IntegrationAccountPartnerData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountPartnerData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountPartnerType partnerType, Azure.ResourceManager.Logic.Models.IntegrationAccountPartnerContent content) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountPartnerData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountPartnerType partnerType, Azure.ResourceManager.Logic.Models.IntegrationAccountPartnerContent content) { } public System.Collections.Generic.IList B2BBusinessIdentities { get { throw null; } } public System.DateTimeOffset? ChangedOn { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } @@ -378,7 +378,7 @@ protected IntegrationAccountSchemaCollection() { } } public partial class IntegrationAccountSchemaData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountSchemaData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountSchemaType schemaType) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountSchemaData(Azure.Core.AzureLocation location, Azure.ResourceManager.Logic.Models.IntegrationAccountSchemaType schemaType) { } public System.DateTimeOffset? ChangedOn { get { throw null; } } public System.BinaryData Content { get { throw null; } set { } } public Azure.ResourceManager.Logic.Models.LogicContentLink ContentLink { get { throw null; } } @@ -431,7 +431,7 @@ protected IntegrationAccountSessionCollection() { } } public partial class IntegrationAccountSessionData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationAccountSessionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationAccountSessionData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? ChangedOn { get { throw null; } } public System.BinaryData Content { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } @@ -475,7 +475,7 @@ protected IntegrationServiceEnvironmentCollection() { } } public partial class IntegrationServiceEnvironmentData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationServiceEnvironmentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationServiceEnvironmentData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Logic.Models.IntegrationServiceEnvironmentProperties Properties { get { throw null; } set { } } public Azure.ResourceManager.Logic.Models.IntegrationServiceEnvironmentSku Sku { get { throw null; } set { } } @@ -499,7 +499,7 @@ protected IntegrationServiceEnvironmentManagedApiCollection() { } } public partial class IntegrationServiceEnvironmentManagedApiData : Azure.ResourceManager.Models.TrackedResourceData { - public IntegrationServiceEnvironmentManagedApiData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public IntegrationServiceEnvironmentManagedApiData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Logic.Models.LogicApiResourceDefinitions ApiDefinitions { get { throw null; } } public System.Uri ApiDefinitionUri { get { throw null; } } public System.Collections.Generic.IReadOnlyList Capabilities { get { throw null; } } @@ -627,7 +627,7 @@ protected LogicWorkflowCollection() { } } public partial class LogicWorkflowData : Azure.ResourceManager.Models.TrackedResourceData { - public LogicWorkflowData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LogicWorkflowData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Logic.Models.FlowAccessControlConfiguration AccessControl { get { throw null; } set { } } public string AccessEndpoint { get { throw null; } } public System.DateTimeOffset? ChangedOn { get { throw null; } } @@ -645,7 +645,7 @@ public LogicWorkflowData(Azure.Core.AzureLocation location) : base (default(Azur } public partial class LogicWorkflowRequestHistoryData : Azure.ResourceManager.Models.TrackedResourceData { - public LogicWorkflowRequestHistoryData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LogicWorkflowRequestHistoryData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Logic.Models.LogicWorkflowRequestHistoryProperties Properties { get { throw null; } set { } } } public partial class LogicWorkflowResource : Azure.ResourceManager.ArmResource @@ -746,7 +746,7 @@ protected LogicWorkflowRunActionRepetitionCollection() { } } public partial class LogicWorkflowRunActionRepetitionDefinitionData : Azure.ResourceManager.Models.TrackedResourceData { - public LogicWorkflowRunActionRepetitionDefinitionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LogicWorkflowRunActionRepetitionDefinitionData(Azure.Core.AzureLocation location) { } public string Code { get { throw null; } set { } } public Azure.ResourceManager.Logic.Models.LogicWorkflowRunActionCorrelation Correlation { get { throw null; } set { } } public System.DateTimeOffset? EndOn { get { throw null; } set { } } @@ -1054,7 +1054,7 @@ protected LogicWorkflowVersionCollection() { } } public partial class LogicWorkflowVersionData : Azure.ResourceManager.Models.TrackedResourceData { - public LogicWorkflowVersionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LogicWorkflowVersionData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Logic.Models.FlowAccessControlConfiguration AccessControl { get { throw null; } set { } } public string AccessEndpoint { get { throw null; } } public System.DateTimeOffset? ChangedOn { get { throw null; } } @@ -1081,6 +1081,60 @@ protected LogicWorkflowVersionResource() { } public virtual System.Threading.Tasks.Task> GetCallbackUrlWorkflowVersionTriggerAsync(string triggerName, Azure.ResourceManager.Logic.Models.ListOperationCallbackUrlParameterInfo info = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Logic.Mocking +{ + public partial class MockableLogicArmClient : Azure.ResourceManager.ArmResource + { + protected MockableLogicArmClient() { } + public virtual Azure.ResourceManager.Logic.IntegrationAccountAgreementResource GetIntegrationAccountAgreementResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountAssemblyDefinitionResource GetIntegrationAccountAssemblyDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountBatchConfigurationResource GetIntegrationAccountBatchConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountCertificateResource GetIntegrationAccountCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountMapResource GetIntegrationAccountMapResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountPartnerResource GetIntegrationAccountPartnerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountResource GetIntegrationAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountSchemaResource GetIntegrationAccountSchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountSessionResource GetIntegrationAccountSessionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationServiceEnvironmentManagedApiResource GetIntegrationServiceEnvironmentManagedApiResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationServiceEnvironmentResource GetIntegrationServiceEnvironmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowResource GetLogicWorkflowResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowRunActionRepetitionRequestHistoryResource GetLogicWorkflowRunActionRepetitionRequestHistoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowRunActionRepetitionResource GetLogicWorkflowRunActionRepetitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowRunActionRequestHistoryResource GetLogicWorkflowRunActionRequestHistoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowRunActionResource GetLogicWorkflowRunActionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowRunActionScopeRepetitionResource GetLogicWorkflowRunActionScopeRepetitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowRunOperationResource GetLogicWorkflowRunOperationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowRunResource GetLogicWorkflowRunResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowTriggerHistoryResource GetLogicWorkflowTriggerHistoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowTriggerResource GetLogicWorkflowTriggerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowVersionResource GetLogicWorkflowVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableLogicResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableLogicResourceGroupResource() { } + public virtual Azure.Response GetIntegrationAccount(string integrationAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIntegrationAccountAsync(string integrationAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationAccountCollection GetIntegrationAccounts() { throw null; } + public virtual Azure.Response GetIntegrationServiceEnvironment(string integrationServiceEnvironmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIntegrationServiceEnvironmentAsync(string integrationServiceEnvironmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Logic.IntegrationServiceEnvironmentCollection GetIntegrationServiceEnvironments() { throw null; } + public virtual Azure.Response GetLogicWorkflow(string workflowName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLogicWorkflowAsync(string workflowName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Logic.LogicWorkflowCollection GetLogicWorkflows() { throw null; } + public virtual Azure.Response ValidateByLocationWorkflow(Azure.Core.AzureLocation location, string workflowName, Azure.ResourceManager.Logic.LogicWorkflowData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ValidateByLocationWorkflowAsync(Azure.Core.AzureLocation location, string workflowName, Azure.ResourceManager.Logic.LogicWorkflowData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableLogicSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableLogicSubscriptionResource() { } + public virtual Azure.Pageable GetIntegrationAccounts(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetIntegrationAccountsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetIntegrationServiceEnvironments(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetIntegrationServiceEnvironmentsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLogicWorkflows(int? top = default(int?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLogicWorkflowsAsync(int? top = default(int?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Logic.Models { public static partial class ArmLogicModelFactory @@ -2125,7 +2179,7 @@ public LogicApiOperationAnnotation() { } } public partial class LogicApiOperationInfo : Azure.ResourceManager.Models.TrackedResourceData { - public LogicApiOperationInfo(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LogicApiOperationInfo(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Logic.Models.LogicApiOperationProperties Properties { get { throw null; } set { } } } public partial class LogicApiOperationProperties diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/LogicExtensions.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/LogicExtensions.cs index 0cba29b50914b..af5d1c27c10b9 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/LogicExtensions.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/LogicExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Logic.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Logic @@ -18,461 +19,385 @@ namespace Azure.ResourceManager.Logic /// A class to add extension methods to Azure.ResourceManager.Logic. public static partial class LogicExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableLogicArmClient GetMockableLogicArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableLogicArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableLogicResourceGroupResource GetMockableLogicResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableLogicResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableLogicSubscriptionResource GetMockableLogicSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableLogicSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region LogicWorkflowResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowResource GetLogicWorkflowResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowResource.ValidateResourceId(id); - return new LogicWorkflowResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowResource(id); } - #endregion - #region LogicWorkflowVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowVersionResource GetLogicWorkflowVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowVersionResource.ValidateResourceId(id); - return new LogicWorkflowVersionResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowVersionResource(id); } - #endregion - #region LogicWorkflowTriggerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowTriggerResource GetLogicWorkflowTriggerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowTriggerResource.ValidateResourceId(id); - return new LogicWorkflowTriggerResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowTriggerResource(id); } - #endregion - #region LogicWorkflowTriggerHistoryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowTriggerHistoryResource GetLogicWorkflowTriggerHistoryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowTriggerHistoryResource.ValidateResourceId(id); - return new LogicWorkflowTriggerHistoryResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowTriggerHistoryResource(id); } - #endregion - #region LogicWorkflowRunResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowRunResource GetLogicWorkflowRunResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowRunResource.ValidateResourceId(id); - return new LogicWorkflowRunResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowRunResource(id); } - #endregion - #region LogicWorkflowRunOperationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowRunOperationResource GetLogicWorkflowRunOperationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowRunOperationResource.ValidateResourceId(id); - return new LogicWorkflowRunOperationResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowRunOperationResource(id); } - #endregion - #region LogicWorkflowRunActionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowRunActionResource GetLogicWorkflowRunActionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowRunActionResource.ValidateResourceId(id); - return new LogicWorkflowRunActionResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowRunActionResource(id); } - #endregion - #region LogicWorkflowRunActionRepetitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowRunActionRepetitionResource GetLogicWorkflowRunActionRepetitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowRunActionRepetitionResource.ValidateResourceId(id); - return new LogicWorkflowRunActionRepetitionResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowRunActionRepetitionResource(id); } - #endregion - #region LogicWorkflowRunActionScopeRepetitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowRunActionScopeRepetitionResource GetLogicWorkflowRunActionScopeRepetitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowRunActionScopeRepetitionResource.ValidateResourceId(id); - return new LogicWorkflowRunActionScopeRepetitionResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowRunActionScopeRepetitionResource(id); } - #endregion - #region LogicWorkflowRunActionRepetitionRequestHistoryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowRunActionRepetitionRequestHistoryResource GetLogicWorkflowRunActionRepetitionRequestHistoryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowRunActionRepetitionRequestHistoryResource.ValidateResourceId(id); - return new LogicWorkflowRunActionRepetitionRequestHistoryResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowRunActionRepetitionRequestHistoryResource(id); } - #endregion - #region LogicWorkflowRunActionRequestHistoryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicWorkflowRunActionRequestHistoryResource GetLogicWorkflowRunActionRequestHistoryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicWorkflowRunActionRequestHistoryResource.ValidateResourceId(id); - return new LogicWorkflowRunActionRequestHistoryResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetLogicWorkflowRunActionRequestHistoryResource(id); } - #endregion - #region IntegrationAccountResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountResource GetIntegrationAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountResource.ValidateResourceId(id); - return new IntegrationAccountResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountResource(id); } - #endregion - #region IntegrationAccountAssemblyDefinitionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountAssemblyDefinitionResource GetIntegrationAccountAssemblyDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountAssemblyDefinitionResource.ValidateResourceId(id); - return new IntegrationAccountAssemblyDefinitionResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountAssemblyDefinitionResource(id); } - #endregion - #region IntegrationAccountBatchConfigurationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountBatchConfigurationResource GetIntegrationAccountBatchConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountBatchConfigurationResource.ValidateResourceId(id); - return new IntegrationAccountBatchConfigurationResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountBatchConfigurationResource(id); } - #endregion - #region IntegrationAccountSchemaResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountSchemaResource GetIntegrationAccountSchemaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountSchemaResource.ValidateResourceId(id); - return new IntegrationAccountSchemaResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountSchemaResource(id); } - #endregion - #region IntegrationAccountMapResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountMapResource GetIntegrationAccountMapResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountMapResource.ValidateResourceId(id); - return new IntegrationAccountMapResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountMapResource(id); } - #endregion - #region IntegrationAccountPartnerResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountPartnerResource GetIntegrationAccountPartnerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountPartnerResource.ValidateResourceId(id); - return new IntegrationAccountPartnerResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountPartnerResource(id); } - #endregion - #region IntegrationAccountAgreementResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountAgreementResource GetIntegrationAccountAgreementResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountAgreementResource.ValidateResourceId(id); - return new IntegrationAccountAgreementResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountAgreementResource(id); } - #endregion - #region IntegrationAccountCertificateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountCertificateResource GetIntegrationAccountCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountCertificateResource.ValidateResourceId(id); - return new IntegrationAccountCertificateResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountCertificateResource(id); } - #endregion - #region IntegrationAccountSessionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationAccountSessionResource GetIntegrationAccountSessionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationAccountSessionResource.ValidateResourceId(id); - return new IntegrationAccountSessionResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationAccountSessionResource(id); } - #endregion - #region IntegrationServiceEnvironmentResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationServiceEnvironmentResource GetIntegrationServiceEnvironmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationServiceEnvironmentResource.ValidateResourceId(id); - return new IntegrationServiceEnvironmentResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationServiceEnvironmentResource(id); } - #endregion - #region IntegrationServiceEnvironmentManagedApiResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IntegrationServiceEnvironmentManagedApiResource GetIntegrationServiceEnvironmentManagedApiResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IntegrationServiceEnvironmentManagedApiResource.ValidateResourceId(id); - return new IntegrationServiceEnvironmentManagedApiResource(client, id); - } - ); + return GetMockableLogicArmClient(client).GetIntegrationServiceEnvironmentManagedApiResource(id); } - #endregion - /// Gets a collection of LogicWorkflowResources in the ResourceGroupResource. + /// + /// Gets a collection of LogicWorkflowResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LogicWorkflowResources and their operations over a LogicWorkflowResource. public static LogicWorkflowCollection GetLogicWorkflows(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLogicWorkflows(); + return GetMockableLogicResourceGroupResource(resourceGroupResource).GetLogicWorkflows(); } /// @@ -487,16 +412,20 @@ public static LogicWorkflowCollection GetLogicWorkflows(this ResourceGroupResour /// Workflows_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The workflow name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLogicWorkflowAsync(this ResourceGroupResource resourceGroupResource, string workflowName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLogicWorkflows().GetAsync(workflowName, cancellationToken).ConfigureAwait(false); + return await GetMockableLogicResourceGroupResource(resourceGroupResource).GetLogicWorkflowAsync(workflowName, cancellationToken).ConfigureAwait(false); } /// @@ -511,24 +440,34 @@ public static async Task> GetLogicWorkflowAsync( /// Workflows_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The workflow name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLogicWorkflow(this ResourceGroupResource resourceGroupResource, string workflowName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLogicWorkflows().Get(workflowName, cancellationToken); + return GetMockableLogicResourceGroupResource(resourceGroupResource).GetLogicWorkflow(workflowName, cancellationToken); } - /// Gets a collection of IntegrationAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of IntegrationAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of IntegrationAccountResources and their operations over a IntegrationAccountResource. public static IntegrationAccountCollection GetIntegrationAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetIntegrationAccounts(); + return GetMockableLogicResourceGroupResource(resourceGroupResource).GetIntegrationAccounts(); } /// @@ -543,16 +482,20 @@ public static IntegrationAccountCollection GetIntegrationAccounts(this ResourceG /// IntegrationAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The integration account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetIntegrationAccountAsync(this ResourceGroupResource resourceGroupResource, string integrationAccountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetIntegrationAccounts().GetAsync(integrationAccountName, cancellationToken).ConfigureAwait(false); + return await GetMockableLogicResourceGroupResource(resourceGroupResource).GetIntegrationAccountAsync(integrationAccountName, cancellationToken).ConfigureAwait(false); } /// @@ -567,24 +510,34 @@ public static async Task> GetIntegrationAcc /// IntegrationAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The integration account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetIntegrationAccount(this ResourceGroupResource resourceGroupResource, string integrationAccountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetIntegrationAccounts().Get(integrationAccountName, cancellationToken); + return GetMockableLogicResourceGroupResource(resourceGroupResource).GetIntegrationAccount(integrationAccountName, cancellationToken); } - /// Gets a collection of IntegrationServiceEnvironmentResources in the ResourceGroupResource. + /// + /// Gets a collection of IntegrationServiceEnvironmentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of IntegrationServiceEnvironmentResources and their operations over a IntegrationServiceEnvironmentResource. public static IntegrationServiceEnvironmentCollection GetIntegrationServiceEnvironments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetIntegrationServiceEnvironments(); + return GetMockableLogicResourceGroupResource(resourceGroupResource).GetIntegrationServiceEnvironments(); } /// @@ -599,16 +552,20 @@ public static IntegrationServiceEnvironmentCollection GetIntegrationServiceEnvir /// IntegrationServiceEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The integration service environment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetIntegrationServiceEnvironmentAsync(this ResourceGroupResource resourceGroupResource, string integrationServiceEnvironmentName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetIntegrationServiceEnvironments().GetAsync(integrationServiceEnvironmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableLogicResourceGroupResource(resourceGroupResource).GetIntegrationServiceEnvironmentAsync(integrationServiceEnvironmentName, cancellationToken).ConfigureAwait(false); } /// @@ -623,16 +580,20 @@ public static async Task> GetInt /// IntegrationServiceEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The integration service environment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetIntegrationServiceEnvironment(this ResourceGroupResource resourceGroupResource, string integrationServiceEnvironmentName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetIntegrationServiceEnvironments().Get(integrationServiceEnvironmentName, cancellationToken); + return GetMockableLogicResourceGroupResource(resourceGroupResource).GetIntegrationServiceEnvironment(integrationServiceEnvironmentName, cancellationToken); } /// @@ -647,6 +608,10 @@ public static Response GetIntegrationServ /// Workflows_ValidateByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The workflow location. @@ -657,10 +622,7 @@ public static Response GetIntegrationServ /// or is null. public static async Task ValidateByLocationWorkflowAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string workflowName, LogicWorkflowData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(workflowName, nameof(workflowName)); - Argument.AssertNotNull(data, nameof(data)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).ValidateByLocationWorkflowAsync(location, workflowName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableLogicResourceGroupResource(resourceGroupResource).ValidateByLocationWorkflowAsync(location, workflowName, data, cancellationToken).ConfigureAwait(false); } /// @@ -675,6 +637,10 @@ public static async Task ValidateByLocationWorkflowAsync(this Resource /// Workflows_ValidateByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The workflow location. @@ -685,10 +651,7 @@ public static async Task ValidateByLocationWorkflowAsync(this Resource /// or is null. public static Response ValidateByLocationWorkflow(this ResourceGroupResource resourceGroupResource, AzureLocation location, string workflowName, LogicWorkflowData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(workflowName, nameof(workflowName)); - Argument.AssertNotNull(data, nameof(data)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).ValidateByLocationWorkflow(location, workflowName, data, cancellationToken); + return GetMockableLogicResourceGroupResource(resourceGroupResource).ValidateByLocationWorkflow(location, workflowName, data, cancellationToken); } /// @@ -703,6 +666,10 @@ public static Response ValidateByLocationWorkflow(this ResourceGroupResource res /// Workflows_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The number of items to be included in the result. @@ -711,7 +678,7 @@ public static Response ValidateByLocationWorkflow(this ResourceGroupResource res /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLogicWorkflowsAsync(this SubscriptionResource subscriptionResource, int? top = null, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLogicWorkflowsAsync(top, filter, cancellationToken); + return GetMockableLogicSubscriptionResource(subscriptionResource).GetLogicWorkflowsAsync(top, filter, cancellationToken); } /// @@ -726,6 +693,10 @@ public static AsyncPageable GetLogicWorkflowsAsync(this S /// Workflows_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The number of items to be included in the result. @@ -734,7 +705,7 @@ public static AsyncPageable GetLogicWorkflowsAsync(this S /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLogicWorkflows(this SubscriptionResource subscriptionResource, int? top = null, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLogicWorkflows(top, filter, cancellationToken); + return GetMockableLogicSubscriptionResource(subscriptionResource).GetLogicWorkflows(top, filter, cancellationToken); } /// @@ -749,6 +720,10 @@ public static Pageable GetLogicWorkflows(this Subscriptio /// IntegrationAccounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The number of items to be included in the result. @@ -756,7 +731,7 @@ public static Pageable GetLogicWorkflows(this Subscriptio /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetIntegrationAccountsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIntegrationAccountsAsync(top, cancellationToken); + return GetMockableLogicSubscriptionResource(subscriptionResource).GetIntegrationAccountsAsync(top, cancellationToken); } /// @@ -771,6 +746,10 @@ public static AsyncPageable GetIntegrationAccountsAs /// IntegrationAccounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The number of items to be included in the result. @@ -778,7 +757,7 @@ public static AsyncPageable GetIntegrationAccountsAs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetIntegrationAccounts(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIntegrationAccounts(top, cancellationToken); + return GetMockableLogicSubscriptionResource(subscriptionResource).GetIntegrationAccounts(top, cancellationToken); } /// @@ -793,6 +772,10 @@ public static Pageable GetIntegrationAccounts(this S /// IntegrationServiceEnvironments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The number of items to be included in the result. @@ -800,7 +783,7 @@ public static Pageable GetIntegrationAccounts(this S /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetIntegrationServiceEnvironmentsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIntegrationServiceEnvironmentsAsync(top, cancellationToken); + return GetMockableLogicSubscriptionResource(subscriptionResource).GetIntegrationServiceEnvironmentsAsync(top, cancellationToken); } /// @@ -815,6 +798,10 @@ public static AsyncPageable GetIntegratio /// IntegrationServiceEnvironments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The number of items to be included in the result. @@ -822,7 +809,7 @@ public static AsyncPageable GetIntegratio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetIntegrationServiceEnvironments(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIntegrationServiceEnvironments(top, cancellationToken); + return GetMockableLogicSubscriptionResource(subscriptionResource).GetIntegrationServiceEnvironments(top, cancellationToken); } } } diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicArmClient.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicArmClient.cs new file mode 100644 index 0000000000000..57a02ad134c54 --- /dev/null +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicArmClient.cs @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Logic; + +namespace Azure.ResourceManager.Logic.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableLogicArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableLogicArmClient() + { + } + + /// 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 MockableLogicArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableLogicArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowResource GetLogicWorkflowResource(ResourceIdentifier id) + { + LogicWorkflowResource.ValidateResourceId(id); + return new LogicWorkflowResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowVersionResource GetLogicWorkflowVersionResource(ResourceIdentifier id) + { + LogicWorkflowVersionResource.ValidateResourceId(id); + return new LogicWorkflowVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowTriggerResource GetLogicWorkflowTriggerResource(ResourceIdentifier id) + { + LogicWorkflowTriggerResource.ValidateResourceId(id); + return new LogicWorkflowTriggerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowTriggerHistoryResource GetLogicWorkflowTriggerHistoryResource(ResourceIdentifier id) + { + LogicWorkflowTriggerHistoryResource.ValidateResourceId(id); + return new LogicWorkflowTriggerHistoryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowRunResource GetLogicWorkflowRunResource(ResourceIdentifier id) + { + LogicWorkflowRunResource.ValidateResourceId(id); + return new LogicWorkflowRunResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowRunOperationResource GetLogicWorkflowRunOperationResource(ResourceIdentifier id) + { + LogicWorkflowRunOperationResource.ValidateResourceId(id); + return new LogicWorkflowRunOperationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowRunActionResource GetLogicWorkflowRunActionResource(ResourceIdentifier id) + { + LogicWorkflowRunActionResource.ValidateResourceId(id); + return new LogicWorkflowRunActionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowRunActionRepetitionResource GetLogicWorkflowRunActionRepetitionResource(ResourceIdentifier id) + { + LogicWorkflowRunActionRepetitionResource.ValidateResourceId(id); + return new LogicWorkflowRunActionRepetitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowRunActionScopeRepetitionResource GetLogicWorkflowRunActionScopeRepetitionResource(ResourceIdentifier id) + { + LogicWorkflowRunActionScopeRepetitionResource.ValidateResourceId(id); + return new LogicWorkflowRunActionScopeRepetitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowRunActionRepetitionRequestHistoryResource GetLogicWorkflowRunActionRepetitionRequestHistoryResource(ResourceIdentifier id) + { + LogicWorkflowRunActionRepetitionRequestHistoryResource.ValidateResourceId(id); + return new LogicWorkflowRunActionRepetitionRequestHistoryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicWorkflowRunActionRequestHistoryResource GetLogicWorkflowRunActionRequestHistoryResource(ResourceIdentifier id) + { + LogicWorkflowRunActionRequestHistoryResource.ValidateResourceId(id); + return new LogicWorkflowRunActionRequestHistoryResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountResource GetIntegrationAccountResource(ResourceIdentifier id) + { + IntegrationAccountResource.ValidateResourceId(id); + return new IntegrationAccountResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountAssemblyDefinitionResource GetIntegrationAccountAssemblyDefinitionResource(ResourceIdentifier id) + { + IntegrationAccountAssemblyDefinitionResource.ValidateResourceId(id); + return new IntegrationAccountAssemblyDefinitionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountBatchConfigurationResource GetIntegrationAccountBatchConfigurationResource(ResourceIdentifier id) + { + IntegrationAccountBatchConfigurationResource.ValidateResourceId(id); + return new IntegrationAccountBatchConfigurationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountSchemaResource GetIntegrationAccountSchemaResource(ResourceIdentifier id) + { + IntegrationAccountSchemaResource.ValidateResourceId(id); + return new IntegrationAccountSchemaResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountMapResource GetIntegrationAccountMapResource(ResourceIdentifier id) + { + IntegrationAccountMapResource.ValidateResourceId(id); + return new IntegrationAccountMapResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountPartnerResource GetIntegrationAccountPartnerResource(ResourceIdentifier id) + { + IntegrationAccountPartnerResource.ValidateResourceId(id); + return new IntegrationAccountPartnerResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountAgreementResource GetIntegrationAccountAgreementResource(ResourceIdentifier id) + { + IntegrationAccountAgreementResource.ValidateResourceId(id); + return new IntegrationAccountAgreementResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountCertificateResource GetIntegrationAccountCertificateResource(ResourceIdentifier id) + { + IntegrationAccountCertificateResource.ValidateResourceId(id); + return new IntegrationAccountCertificateResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationAccountSessionResource GetIntegrationAccountSessionResource(ResourceIdentifier id) + { + IntegrationAccountSessionResource.ValidateResourceId(id); + return new IntegrationAccountSessionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationServiceEnvironmentResource GetIntegrationServiceEnvironmentResource(ResourceIdentifier id) + { + IntegrationServiceEnvironmentResource.ValidateResourceId(id); + return new IntegrationServiceEnvironmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IntegrationServiceEnvironmentManagedApiResource GetIntegrationServiceEnvironmentManagedApiResource(ResourceIdentifier id) + { + IntegrationServiceEnvironmentManagedApiResource.ValidateResourceId(id); + return new IntegrationServiceEnvironmentManagedApiResource(Client, id); + } + } +} diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicResourceGroupResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicResourceGroupResource.cs new file mode 100644 index 0000000000000..b30fb7931e727 --- /dev/null +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicResourceGroupResource.cs @@ -0,0 +1,281 @@ +// 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; +using Azure.ResourceManager.Logic; + +namespace Azure.ResourceManager.Logic.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableLogicResourceGroupResource : ArmResource + { + private ClientDiagnostics _logicWorkflowWorkflowsClientDiagnostics; + private WorkflowsRestOperations _logicWorkflowWorkflowsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableLogicResourceGroupResource() + { + } + + /// 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 MockableLogicResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LogicWorkflowWorkflowsClientDiagnostics => _logicWorkflowWorkflowsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Logic", LogicWorkflowResource.ResourceType.Namespace, Diagnostics); + private WorkflowsRestOperations LogicWorkflowWorkflowsRestClient => _logicWorkflowWorkflowsRestClient ??= new WorkflowsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogicWorkflowResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LogicWorkflowResources in the ResourceGroupResource. + /// An object representing collection of LogicWorkflowResources and their operations over a LogicWorkflowResource. + public virtual LogicWorkflowCollection GetLogicWorkflows() + { + return GetCachedClient(client => new LogicWorkflowCollection(client, Id)); + } + + /// + /// Gets a workflow. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName} + /// + /// + /// Operation Id + /// Workflows_Get + /// + /// + /// + /// The workflow name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLogicWorkflowAsync(string workflowName, CancellationToken cancellationToken = default) + { + return await GetLogicWorkflows().GetAsync(workflowName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a workflow. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName} + /// + /// + /// Operation Id + /// Workflows_Get + /// + /// + /// + /// The workflow name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLogicWorkflow(string workflowName, CancellationToken cancellationToken = default) + { + return GetLogicWorkflows().Get(workflowName, cancellationToken); + } + + /// Gets a collection of IntegrationAccountResources in the ResourceGroupResource. + /// An object representing collection of IntegrationAccountResources and their operations over a IntegrationAccountResource. + public virtual IntegrationAccountCollection GetIntegrationAccounts() + { + return GetCachedClient(client => new IntegrationAccountCollection(client, Id)); + } + + /// + /// Gets an integration account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName} + /// + /// + /// Operation Id + /// IntegrationAccounts_Get + /// + /// + /// + /// The integration account name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetIntegrationAccountAsync(string integrationAccountName, CancellationToken cancellationToken = default) + { + return await GetIntegrationAccounts().GetAsync(integrationAccountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an integration account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName} + /// + /// + /// Operation Id + /// IntegrationAccounts_Get + /// + /// + /// + /// The integration account name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetIntegrationAccount(string integrationAccountName, CancellationToken cancellationToken = default) + { + return GetIntegrationAccounts().Get(integrationAccountName, cancellationToken); + } + + /// Gets a collection of IntegrationServiceEnvironmentResources in the ResourceGroupResource. + /// An object representing collection of IntegrationServiceEnvironmentResources and their operations over a IntegrationServiceEnvironmentResource. + public virtual IntegrationServiceEnvironmentCollection GetIntegrationServiceEnvironments() + { + return GetCachedClient(client => new IntegrationServiceEnvironmentCollection(client, Id)); + } + + /// + /// Gets an integration service environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName} + /// + /// + /// Operation Id + /// IntegrationServiceEnvironments_Get + /// + /// + /// + /// The integration service environment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetIntegrationServiceEnvironmentAsync(string integrationServiceEnvironmentName, CancellationToken cancellationToken = default) + { + return await GetIntegrationServiceEnvironments().GetAsync(integrationServiceEnvironmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an integration service environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName} + /// + /// + /// Operation Id + /// IntegrationServiceEnvironments_Get + /// + /// + /// + /// The integration service environment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetIntegrationServiceEnvironment(string integrationServiceEnvironmentName, CancellationToken cancellationToken = default) + { + return GetIntegrationServiceEnvironments().Get(integrationServiceEnvironmentName, cancellationToken); + } + + /// + /// Validates the workflow definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/locations/{location}/workflows/{workflowName}/validate + /// + /// + /// Operation Id + /// Workflows_ValidateByLocation + /// + /// + /// + /// The workflow location. + /// The workflow name. + /// The workflow. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task ValidateByLocationWorkflowAsync(AzureLocation location, string workflowName, LogicWorkflowData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workflowName, nameof(workflowName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = LogicWorkflowWorkflowsClientDiagnostics.CreateScope("MockableLogicResourceGroupResource.ValidateByLocationWorkflow"); + scope.Start(); + try + { + var response = await LogicWorkflowWorkflowsRestClient.ValidateByLocationAsync(Id.SubscriptionId, Id.ResourceGroupName, location, workflowName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validates the workflow definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/locations/{location}/workflows/{workflowName}/validate + /// + /// + /// Operation Id + /// Workflows_ValidateByLocation + /// + /// + /// + /// The workflow location. + /// The workflow name. + /// The workflow. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response ValidateByLocationWorkflow(AzureLocation location, string workflowName, LogicWorkflowData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workflowName, nameof(workflowName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = LogicWorkflowWorkflowsClientDiagnostics.CreateScope("MockableLogicResourceGroupResource.ValidateByLocationWorkflow"); + scope.Start(); + try + { + var response = LogicWorkflowWorkflowsRestClient.ValidateByLocation(Id.SubscriptionId, Id.ResourceGroupName, location, workflowName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicSubscriptionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicSubscriptionResource.cs new file mode 100644 index 0000000000000..345c630854971 --- /dev/null +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/MockableLogicSubscriptionResource.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Logic; + +namespace Azure.ResourceManager.Logic.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableLogicSubscriptionResource : ArmResource + { + private ClientDiagnostics _logicWorkflowWorkflowsClientDiagnostics; + private WorkflowsRestOperations _logicWorkflowWorkflowsRestClient; + private ClientDiagnostics _integrationAccountClientDiagnostics; + private IntegrationAccountsRestOperations _integrationAccountRestClient; + private ClientDiagnostics _integrationServiceEnvironmentClientDiagnostics; + private IntegrationServiceEnvironmentsRestOperations _integrationServiceEnvironmentRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableLogicSubscriptionResource() + { + } + + /// 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 MockableLogicSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LogicWorkflowWorkflowsClientDiagnostics => _logicWorkflowWorkflowsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Logic", LogicWorkflowResource.ResourceType.Namespace, Diagnostics); + private WorkflowsRestOperations LogicWorkflowWorkflowsRestClient => _logicWorkflowWorkflowsRestClient ??= new WorkflowsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogicWorkflowResource.ResourceType)); + private ClientDiagnostics IntegrationAccountClientDiagnostics => _integrationAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Logic", IntegrationAccountResource.ResourceType.Namespace, Diagnostics); + private IntegrationAccountsRestOperations IntegrationAccountRestClient => _integrationAccountRestClient ??= new IntegrationAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IntegrationAccountResource.ResourceType)); + private ClientDiagnostics IntegrationServiceEnvironmentClientDiagnostics => _integrationServiceEnvironmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Logic", IntegrationServiceEnvironmentResource.ResourceType.Namespace, Diagnostics); + private IntegrationServiceEnvironmentsRestOperations IntegrationServiceEnvironmentRestClient => _integrationServiceEnvironmentRestClient ??= new IntegrationServiceEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IntegrationServiceEnvironmentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets a list of workflows by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows + /// + /// + /// Operation Id + /// Workflows_ListBySubscription + /// + /// + /// + /// The number of items to be included in the result. + /// The filter to apply on the operation. Options for filters include: State, Trigger, and ReferencedResourceId. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLogicWorkflowsAsync(int? top = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LogicWorkflowWorkflowsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LogicWorkflowWorkflowsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LogicWorkflowResource(Client, LogicWorkflowData.DeserializeLogicWorkflowData(e)), LogicWorkflowWorkflowsClientDiagnostics, Pipeline, "MockableLogicSubscriptionResource.GetLogicWorkflows", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of workflows by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows + /// + /// + /// Operation Id + /// Workflows_ListBySubscription + /// + /// + /// + /// The number of items to be included in the result. + /// The filter to apply on the operation. Options for filters include: State, Trigger, and ReferencedResourceId. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLogicWorkflows(int? top = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LogicWorkflowWorkflowsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LogicWorkflowWorkflowsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LogicWorkflowResource(Client, LogicWorkflowData.DeserializeLogicWorkflowData(e)), LogicWorkflowWorkflowsClientDiagnostics, Pipeline, "MockableLogicSubscriptionResource.GetLogicWorkflows", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of integration accounts by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationAccounts + /// + /// + /// Operation Id + /// IntegrationAccounts_ListBySubscription + /// + /// + /// + /// The number of items to be included in the result. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetIntegrationAccountsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IntegrationAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IntegrationAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IntegrationAccountResource(Client, IntegrationAccountData.DeserializeIntegrationAccountData(e)), IntegrationAccountClientDiagnostics, Pipeline, "MockableLogicSubscriptionResource.GetIntegrationAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of integration accounts by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationAccounts + /// + /// + /// Operation Id + /// IntegrationAccounts_ListBySubscription + /// + /// + /// + /// The number of items to be included in the result. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetIntegrationAccounts(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IntegrationAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IntegrationAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IntegrationAccountResource(Client, IntegrationAccountData.DeserializeIntegrationAccountData(e)), IntegrationAccountClientDiagnostics, Pipeline, "MockableLogicSubscriptionResource.GetIntegrationAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of integration service environments by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationServiceEnvironments + /// + /// + /// Operation Id + /// IntegrationServiceEnvironments_ListBySubscription + /// + /// + /// + /// The number of items to be included in the result. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetIntegrationServiceEnvironmentsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IntegrationServiceEnvironmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IntegrationServiceEnvironmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IntegrationServiceEnvironmentResource(Client, IntegrationServiceEnvironmentData.DeserializeIntegrationServiceEnvironmentData(e)), IntegrationServiceEnvironmentClientDiagnostics, Pipeline, "MockableLogicSubscriptionResource.GetIntegrationServiceEnvironments", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of integration service environments by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationServiceEnvironments + /// + /// + /// Operation Id + /// IntegrationServiceEnvironments_ListBySubscription + /// + /// + /// + /// The number of items to be included in the result. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetIntegrationServiceEnvironments(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IntegrationServiceEnvironmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IntegrationServiceEnvironmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IntegrationServiceEnvironmentResource(Client, IntegrationServiceEnvironmentData.DeserializeIntegrationServiceEnvironmentData(e)), IntegrationServiceEnvironmentClientDiagnostics, Pipeline, "MockableLogicSubscriptionResource.GetIntegrationServiceEnvironments", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index fb807d1271c58..0000000000000 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,132 +0,0 @@ -// 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.Logic -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _logicWorkflowWorkflowsClientDiagnostics; - private WorkflowsRestOperations _logicWorkflowWorkflowsRestClient; - - /// 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 ClientDiagnostics LogicWorkflowWorkflowsClientDiagnostics => _logicWorkflowWorkflowsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Logic", LogicWorkflowResource.ResourceType.Namespace, Diagnostics); - private WorkflowsRestOperations LogicWorkflowWorkflowsRestClient => _logicWorkflowWorkflowsRestClient ??= new WorkflowsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogicWorkflowResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of LogicWorkflowResources in the ResourceGroupResource. - /// An object representing collection of LogicWorkflowResources and their operations over a LogicWorkflowResource. - public virtual LogicWorkflowCollection GetLogicWorkflows() - { - return GetCachedClient(Client => new LogicWorkflowCollection(Client, Id)); - } - - /// Gets a collection of IntegrationAccountResources in the ResourceGroupResource. - /// An object representing collection of IntegrationAccountResources and their operations over a IntegrationAccountResource. - public virtual IntegrationAccountCollection GetIntegrationAccounts() - { - return GetCachedClient(Client => new IntegrationAccountCollection(Client, Id)); - } - - /// Gets a collection of IntegrationServiceEnvironmentResources in the ResourceGroupResource. - /// An object representing collection of IntegrationServiceEnvironmentResources and their operations over a IntegrationServiceEnvironmentResource. - public virtual IntegrationServiceEnvironmentCollection GetIntegrationServiceEnvironments() - { - return GetCachedClient(Client => new IntegrationServiceEnvironmentCollection(Client, Id)); - } - - /// - /// Validates the workflow definition. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/locations/{location}/workflows/{workflowName}/validate - /// - /// - /// Operation Id - /// Workflows_ValidateByLocation - /// - /// - /// - /// The workflow location. - /// The workflow name. - /// The workflow. - /// The cancellation token to use. - public virtual async Task ValidateByLocationWorkflowAsync(AzureLocation location, string workflowName, LogicWorkflowData data, CancellationToken cancellationToken = default) - { - using var scope = LogicWorkflowWorkflowsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.ValidateByLocationWorkflow"); - scope.Start(); - try - { - var response = await LogicWorkflowWorkflowsRestClient.ValidateByLocationAsync(Id.SubscriptionId, Id.ResourceGroupName, location, workflowName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Validates the workflow definition. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/locations/{location}/workflows/{workflowName}/validate - /// - /// - /// Operation Id - /// Workflows_ValidateByLocation - /// - /// - /// - /// The workflow location. - /// The workflow name. - /// The workflow. - /// The cancellation token to use. - public virtual Response ValidateByLocationWorkflow(AzureLocation location, string workflowName, LogicWorkflowData data, CancellationToken cancellationToken = default) - { - using var scope = LogicWorkflowWorkflowsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.ValidateByLocationWorkflow"); - scope.Start(); - try - { - var response = LogicWorkflowWorkflowsRestClient.ValidateByLocation(Id.SubscriptionId, Id.ResourceGroupName, location, workflowName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 3ede1c07a0e39..0000000000000 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Logic -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _logicWorkflowWorkflowsClientDiagnostics; - private WorkflowsRestOperations _logicWorkflowWorkflowsRestClient; - private ClientDiagnostics _integrationAccountClientDiagnostics; - private IntegrationAccountsRestOperations _integrationAccountRestClient; - private ClientDiagnostics _integrationServiceEnvironmentClientDiagnostics; - private IntegrationServiceEnvironmentsRestOperations _integrationServiceEnvironmentRestClient; - - /// 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 LogicWorkflowWorkflowsClientDiagnostics => _logicWorkflowWorkflowsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Logic", LogicWorkflowResource.ResourceType.Namespace, Diagnostics); - private WorkflowsRestOperations LogicWorkflowWorkflowsRestClient => _logicWorkflowWorkflowsRestClient ??= new WorkflowsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogicWorkflowResource.ResourceType)); - private ClientDiagnostics IntegrationAccountClientDiagnostics => _integrationAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Logic", IntegrationAccountResource.ResourceType.Namespace, Diagnostics); - private IntegrationAccountsRestOperations IntegrationAccountRestClient => _integrationAccountRestClient ??= new IntegrationAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IntegrationAccountResource.ResourceType)); - private ClientDiagnostics IntegrationServiceEnvironmentClientDiagnostics => _integrationServiceEnvironmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Logic", IntegrationServiceEnvironmentResource.ResourceType.Namespace, Diagnostics); - private IntegrationServiceEnvironmentsRestOperations IntegrationServiceEnvironmentRestClient => _integrationServiceEnvironmentRestClient ??= new IntegrationServiceEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IntegrationServiceEnvironmentResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets a list of workflows by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows - /// - /// - /// Operation Id - /// Workflows_ListBySubscription - /// - /// - /// - /// The number of items to be included in the result. - /// The filter to apply on the operation. Options for filters include: State, Trigger, and ReferencedResourceId. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLogicWorkflowsAsync(int? top = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LogicWorkflowWorkflowsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LogicWorkflowWorkflowsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LogicWorkflowResource(Client, LogicWorkflowData.DeserializeLogicWorkflowData(e)), LogicWorkflowWorkflowsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLogicWorkflows", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of workflows by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows - /// - /// - /// Operation Id - /// Workflows_ListBySubscription - /// - /// - /// - /// The number of items to be included in the result. - /// The filter to apply on the operation. Options for filters include: State, Trigger, and ReferencedResourceId. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLogicWorkflows(int? top = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LogicWorkflowWorkflowsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LogicWorkflowWorkflowsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LogicWorkflowResource(Client, LogicWorkflowData.DeserializeLogicWorkflowData(e)), LogicWorkflowWorkflowsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLogicWorkflows", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of integration accounts by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationAccounts - /// - /// - /// Operation Id - /// IntegrationAccounts_ListBySubscription - /// - /// - /// - /// The number of items to be included in the result. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetIntegrationAccountsAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IntegrationAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IntegrationAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IntegrationAccountResource(Client, IntegrationAccountData.DeserializeIntegrationAccountData(e)), IntegrationAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIntegrationAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of integration accounts by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationAccounts - /// - /// - /// Operation Id - /// IntegrationAccounts_ListBySubscription - /// - /// - /// - /// The number of items to be included in the result. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetIntegrationAccounts(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IntegrationAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IntegrationAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IntegrationAccountResource(Client, IntegrationAccountData.DeserializeIntegrationAccountData(e)), IntegrationAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIntegrationAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of integration service environments by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationServiceEnvironments - /// - /// - /// Operation Id - /// IntegrationServiceEnvironments_ListBySubscription - /// - /// - /// - /// The number of items to be included in the result. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetIntegrationServiceEnvironmentsAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IntegrationServiceEnvironmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IntegrationServiceEnvironmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IntegrationServiceEnvironmentResource(Client, IntegrationServiceEnvironmentData.DeserializeIntegrationServiceEnvironmentData(e)), IntegrationServiceEnvironmentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIntegrationServiceEnvironments", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of integration service environments by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Logic/integrationServiceEnvironments - /// - /// - /// Operation Id - /// IntegrationServiceEnvironments_ListBySubscription - /// - /// - /// - /// The number of items to be included in the result. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetIntegrationServiceEnvironments(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IntegrationServiceEnvironmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IntegrationServiceEnvironmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IntegrationServiceEnvironmentResource(Client, IntegrationServiceEnvironmentData.DeserializeIntegrationServiceEnvironmentData(e)), IntegrationServiceEnvironmentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIntegrationServiceEnvironments", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAgreementResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAgreementResource.cs index cca8885f72def..51cbcb05a351f 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAgreementResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAgreementResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountAgreementResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. + /// The agreementName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName, string agreementName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/agreements/{agreementName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAssemblyDefinitionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAssemblyDefinitionResource.cs index bc905f154faf6..f3089205b4e3f 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAssemblyDefinitionResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountAssemblyDefinitionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountAssemblyDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. + /// The assemblyArtifactName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName, string assemblyArtifactName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/assemblies/{assemblyArtifactName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountBatchConfigurationResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountBatchConfigurationResource.cs index 34b0816d041f6..0a11954d065d9 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountBatchConfigurationResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountBatchConfigurationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountBatchConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. + /// The batchConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName, string batchConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/batchConfigurations/{batchConfigurationName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCertificateResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCertificateResource.cs index c4d4560c6075c..0185051e37426 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCertificateResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountCertificateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/certificates/{certificateName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountMapResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountMapResource.cs index 7ed3c2beb6558..7b44921babe31 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountMapResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountMapResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountMapResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. + /// The mapName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName, string mapName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/maps/{mapName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountPartnerResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountPartnerResource.cs index 0aae0e003b3e4..960c4279e77a8 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountPartnerResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountPartnerResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountPartnerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. + /// The partnerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName, string partnerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/partners/{partnerName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountResource.cs index b0caf6fb20b9e..6de4295947149 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of IntegrationAccountAssemblyDefinitionResources and their operations over a IntegrationAccountAssemblyDefinitionResource. public virtual IntegrationAccountAssemblyDefinitionCollection GetIntegrationAccountAssemblyDefinitions() { - return GetCachedClient(Client => new IntegrationAccountAssemblyDefinitionCollection(Client, Id)); + return GetCachedClient(client => new IntegrationAccountAssemblyDefinitionCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual IntegrationAccountAssemblyDefinitionCollection GetIntegrationAcco /// /// The assembly artifact name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationAccountAssemblyDefinitionAsync(string assemblyArtifactName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task /// /// The assembly artifact name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationAccountAssemblyDefinition(string assemblyArtifactName, CancellationToken cancellationToken = default) { @@ -147,7 +150,7 @@ public virtual Response GetIntegra /// An object representing collection of IntegrationAccountBatchConfigurationResources and their operations over a IntegrationAccountBatchConfigurationResource. public virtual IntegrationAccountBatchConfigurationCollection GetIntegrationAccountBatchConfigurations() { - return GetCachedClient(Client => new IntegrationAccountBatchConfigurationCollection(Client, Id)); + return GetCachedClient(client => new IntegrationAccountBatchConfigurationCollection(client, Id)); } /// @@ -165,8 +168,8 @@ public virtual IntegrationAccountBatchConfigurationCollection GetIntegrationAcco /// /// The batch configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationAccountBatchConfigurationAsync(string batchConfigurationName, CancellationToken cancellationToken = default) { @@ -188,8 +191,8 @@ public virtual async Task /// /// The batch configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationAccountBatchConfiguration(string batchConfigurationName, CancellationToken cancellationToken = default) { @@ -200,7 +203,7 @@ public virtual Response GetIntegra /// An object representing collection of IntegrationAccountSchemaResources and their operations over a IntegrationAccountSchemaResource. public virtual IntegrationAccountSchemaCollection GetIntegrationAccountSchemas() { - return GetCachedClient(Client => new IntegrationAccountSchemaCollection(Client, Id)); + return GetCachedClient(client => new IntegrationAccountSchemaCollection(client, Id)); } /// @@ -218,8 +221,8 @@ public virtual IntegrationAccountSchemaCollection GetIntegrationAccountSchemas() /// /// The integration account schema name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationAccountSchemaAsync(string schemaName, CancellationToken cancellationToken = default) { @@ -241,8 +244,8 @@ public virtual async Task> GetIntegra /// /// The integration account schema name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationAccountSchema(string schemaName, CancellationToken cancellationToken = default) { @@ -253,7 +256,7 @@ public virtual Response GetIntegrationAccountS /// An object representing collection of IntegrationAccountMapResources and their operations over a IntegrationAccountMapResource. public virtual IntegrationAccountMapCollection GetIntegrationAccountMaps() { - return GetCachedClient(Client => new IntegrationAccountMapCollection(Client, Id)); + return GetCachedClient(client => new IntegrationAccountMapCollection(client, Id)); } /// @@ -271,8 +274,8 @@ public virtual IntegrationAccountMapCollection GetIntegrationAccountMaps() /// /// The integration account map name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationAccountMapAsync(string mapName, CancellationToken cancellationToken = default) { @@ -294,8 +297,8 @@ public virtual async Task> GetIntegratio /// /// The integration account map name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationAccountMap(string mapName, CancellationToken cancellationToken = default) { @@ -306,7 +309,7 @@ public virtual Response GetIntegrationAccountMap( /// An object representing collection of IntegrationAccountPartnerResources and their operations over a IntegrationAccountPartnerResource. public virtual IntegrationAccountPartnerCollection GetIntegrationAccountPartners() { - return GetCachedClient(Client => new IntegrationAccountPartnerCollection(Client, Id)); + return GetCachedClient(client => new IntegrationAccountPartnerCollection(client, Id)); } /// @@ -324,8 +327,8 @@ public virtual IntegrationAccountPartnerCollection GetIntegrationAccountPartners /// /// The integration account partner name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationAccountPartnerAsync(string partnerName, CancellationToken cancellationToken = default) { @@ -347,8 +350,8 @@ public virtual async Task> GetIntegr /// /// The integration account partner name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationAccountPartner(string partnerName, CancellationToken cancellationToken = default) { @@ -359,7 +362,7 @@ public virtual Response GetIntegrationAccount /// An object representing collection of IntegrationAccountAgreementResources and their operations over a IntegrationAccountAgreementResource. public virtual IntegrationAccountAgreementCollection GetIntegrationAccountAgreements() { - return GetCachedClient(Client => new IntegrationAccountAgreementCollection(Client, Id)); + return GetCachedClient(client => new IntegrationAccountAgreementCollection(client, Id)); } /// @@ -377,8 +380,8 @@ public virtual IntegrationAccountAgreementCollection GetIntegrationAccountAgreem /// /// The integration account agreement name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationAccountAgreementAsync(string agreementName, CancellationToken cancellationToken = default) { @@ -400,8 +403,8 @@ public virtual async Task> GetInte /// /// The integration account agreement name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationAccountAgreement(string agreementName, CancellationToken cancellationToken = default) { @@ -412,7 +415,7 @@ public virtual Response GetIntegrationAccou /// An object representing collection of IntegrationAccountCertificateResources and their operations over a IntegrationAccountCertificateResource. public virtual IntegrationAccountCertificateCollection GetIntegrationAccountCertificates() { - return GetCachedClient(Client => new IntegrationAccountCertificateCollection(Client, Id)); + return GetCachedClient(client => new IntegrationAccountCertificateCollection(client, Id)); } /// @@ -430,8 +433,8 @@ public virtual IntegrationAccountCertificateCollection GetIntegrationAccountCert /// /// The integration account certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationAccountCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -453,8 +456,8 @@ public virtual async Task> GetIn /// /// The integration account certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationAccountCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -465,7 +468,7 @@ public virtual Response GetIntegrationAcc /// An object representing collection of IntegrationAccountSessionResources and their operations over a IntegrationAccountSessionResource. public virtual IntegrationAccountSessionCollection GetIntegrationAccountSessions() { - return GetCachedClient(Client => new IntegrationAccountSessionCollection(Client, Id)); + return GetCachedClient(client => new IntegrationAccountSessionCollection(client, Id)); } /// @@ -483,8 +486,8 @@ public virtual IntegrationAccountSessionCollection GetIntegrationAccountSessions /// /// The integration account session name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationAccountSessionAsync(string sessionName, CancellationToken cancellationToken = default) { @@ -506,8 +509,8 @@ public virtual async Task> GetIntegr /// /// The integration account session name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationAccountSession(string sessionName, CancellationToken cancellationToken = default) { diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSchemaResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSchemaResource.cs index 95c2823e03305..aee97f41ccaef 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSchemaResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSchemaResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountSchemaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. + /// The schemaName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName, string schemaName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/schemas/{schemaName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSessionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSessionResource.cs index 8a530a3b8ca7e..3f0580ff84cf7 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSessionResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountSessionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationAccountSessionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The integrationAccountName. + /// The sessionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string integrationAccountName, string sessionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/{integrationAccountName}/sessions/{sessionName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentManagedApiResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentManagedApiResource.cs index 1beafb873d9d8..177f49b5fb603 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentManagedApiResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentManagedApiResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationServiceEnvironmentManagedApiResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroup. + /// The integrationServiceEnvironmentName. + /// The apiName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroup, string integrationServiceEnvironmentName, string apiName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}/managedApis/{apiName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentResource.cs index 6fe72b8faab54..c6c1c5a08c388 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Logic public partial class IntegrationServiceEnvironmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroup. + /// The integrationServiceEnvironmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroup, string integrationServiceEnvironmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Logic/integrationServiceEnvironments/{integrationServiceEnvironmentName}"; @@ -102,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of IntegrationServiceEnvironmentManagedApiResources and their operations over a IntegrationServiceEnvironmentManagedApiResource. public virtual IntegrationServiceEnvironmentManagedApiCollection GetIntegrationServiceEnvironmentManagedApis() { - return GetCachedClient(Client => new IntegrationServiceEnvironmentManagedApiCollection(Client, Id)); + return GetCachedClient(client => new IntegrationServiceEnvironmentManagedApiCollection(client, Id)); } /// @@ -120,8 +123,8 @@ public virtual IntegrationServiceEnvironmentManagedApiCollection GetIntegrationS /// /// The api name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIntegrationServiceEnvironmentManagedApiAsync(string apiName, CancellationToken cancellationToken = default) { @@ -143,8 +146,8 @@ public virtual async Task /// The api name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIntegrationServiceEnvironmentManagedApi(string apiName, CancellationToken cancellationToken = default) { diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowResource.cs index 41171e189ddd0..cb78365c1dfed 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LogicWorkflowVersionResources and their operations over a LogicWorkflowVersionResource. public virtual LogicWorkflowVersionCollection GetLogicWorkflowVersions() { - return GetCachedClient(Client => new LogicWorkflowVersionCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowVersionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual LogicWorkflowVersionCollection GetLogicWorkflowVersions() /// /// The workflow versionId. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowVersionAsync(string versionId, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetLogicWorkfl /// /// The workflow versionId. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowVersion(string versionId, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetLogicWorkflowVersion(st /// An object representing collection of LogicWorkflowTriggerResources and their operations over a LogicWorkflowTriggerResource. public virtual LogicWorkflowTriggerCollection GetLogicWorkflowTriggers() { - return GetCachedClient(Client => new LogicWorkflowTriggerCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowTriggerCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual LogicWorkflowTriggerCollection GetLogicWorkflowTriggers() /// /// The workflow trigger name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowTriggerAsync(string triggerName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetLogicWorkfl /// /// The workflow trigger name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowTrigger(string triggerName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetLogicWorkflowTrigger(st /// An object representing collection of LogicWorkflowRunResources and their operations over a LogicWorkflowRunResource. public virtual LogicWorkflowRunCollection GetLogicWorkflowRuns() { - return GetCachedClient(Client => new LogicWorkflowRunCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowRunCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual LogicWorkflowRunCollection GetLogicWorkflowRuns() /// /// The workflow run name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowRunAsync(string runName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetLogicWorkflowRu /// /// The workflow run name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowRun(string runName, CancellationToken cancellationToken = default) { diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionRequestHistoryResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionRequestHistoryResource.cs index 10b6bf01c5329..c67088fedfe6f 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionRequestHistoryResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionRequestHistoryResource.cs @@ -25,6 +25,13 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowRunActionRepetitionRequestHistoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The runName. + /// The actionName. + /// The repetitionName. + /// The requestHistoryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string runName, string actionName, string repetitionName, string requestHistoryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName}/requestHistories/{requestHistoryName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionResource.cs index b7426a5a5e7f8..8253a6ebee1fe 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowRunActionRepetitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The runName. + /// The actionName. + /// The repetitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string runName, string actionName, string repetitionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/repetitions/{repetitionName}"; @@ -92,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LogicWorkflowRunActionRepetitionRequestHistoryResources and their operations over a LogicWorkflowRunActionRepetitionRequestHistoryResource. public virtual LogicWorkflowRunActionRepetitionRequestHistoryCollection GetLogicWorkflowRunActionRepetitionRequestHistories() { - return GetCachedClient(Client => new LogicWorkflowRunActionRepetitionRequestHistoryCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowRunActionRepetitionRequestHistoryCollection(client, Id)); } /// @@ -110,8 +116,8 @@ public virtual LogicWorkflowRunActionRepetitionRequestHistoryCollection GetLogic /// /// The request history name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowRunActionRepetitionRequestHistoryAsync(string requestHistoryName, CancellationToken cancellationToken = default) { @@ -133,8 +139,8 @@ public virtual async Task /// The request history name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowRunActionRepetitionRequestHistory(string requestHistoryName, CancellationToken cancellationToken = default) { diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRequestHistoryResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRequestHistoryResource.cs index eff8a8d63906c..dd54b65e1558a 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRequestHistoryResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRequestHistoryResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowRunActionRequestHistoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The runName. + /// The actionName. + /// The requestHistoryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string runName, string actionName, string requestHistoryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/requestHistories/{requestHistoryName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionResource.cs index 936858a192c92..f5c7cd73fef4c 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowRunActionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The runName. + /// The actionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string runName, string actionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}"; @@ -92,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LogicWorkflowRunActionRepetitionResources and their operations over a LogicWorkflowRunActionRepetitionResource. public virtual LogicWorkflowRunActionRepetitionCollection GetLogicWorkflowRunActionRepetitions() { - return GetCachedClient(Client => new LogicWorkflowRunActionRepetitionCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowRunActionRepetitionCollection(client, Id)); } /// @@ -110,8 +115,8 @@ public virtual LogicWorkflowRunActionRepetitionCollection GetLogicWorkflowRunAct /// /// The workflow repetition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowRunActionRepetitionAsync(string repetitionName, CancellationToken cancellationToken = default) { @@ -133,8 +138,8 @@ public virtual async Task> Ge /// /// The workflow repetition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowRunActionRepetition(string repetitionName, CancellationToken cancellationToken = default) { @@ -145,7 +150,7 @@ public virtual Response GetLogicWorkfl /// An object representing collection of LogicWorkflowRunActionScopeRepetitionResources and their operations over a LogicWorkflowRunActionScopeRepetitionResource. public virtual LogicWorkflowRunActionScopeRepetitionCollection GetLogicWorkflowRunActionScopeRepetitions() { - return GetCachedClient(Client => new LogicWorkflowRunActionScopeRepetitionCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowRunActionScopeRepetitionCollection(client, Id)); } /// @@ -163,8 +168,8 @@ public virtual LogicWorkflowRunActionScopeRepetitionCollection GetLogicWorkflowR /// /// The workflow repetition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowRunActionScopeRepetitionAsync(string repetitionName, CancellationToken cancellationToken = default) { @@ -186,8 +191,8 @@ public virtual async Task /// The workflow repetition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowRunActionScopeRepetition(string repetitionName, CancellationToken cancellationToken = default) { @@ -198,7 +203,7 @@ public virtual Response GetLogicW /// An object representing collection of LogicWorkflowRunActionRequestHistoryResources and their operations over a LogicWorkflowRunActionRequestHistoryResource. public virtual LogicWorkflowRunActionRequestHistoryCollection GetLogicWorkflowRunActionRequestHistories() { - return GetCachedClient(Client => new LogicWorkflowRunActionRequestHistoryCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowRunActionRequestHistoryCollection(client, Id)); } /// @@ -216,8 +221,8 @@ public virtual LogicWorkflowRunActionRequestHistoryCollection GetLogicWorkflowRu /// /// The request history name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowRunActionRequestHistoryAsync(string requestHistoryName, CancellationToken cancellationToken = default) { @@ -239,8 +244,8 @@ public virtual async Task /// /// The request history name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowRunActionRequestHistory(string requestHistoryName, CancellationToken cancellationToken = default) { diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionScopeRepetitionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionScopeRepetitionResource.cs index 786b724df11b6..3b4f5bad35a67 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionScopeRepetitionResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionScopeRepetitionResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowRunActionScopeRepetitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The runName. + /// The actionName. + /// The repetitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string runName, string actionName, string repetitionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions/{actionName}/scopeRepetitions/{repetitionName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunOperationResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunOperationResource.cs index a6dd51708b9e2..ce6155b8be2f6 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunOperationResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunOperationResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowRunOperationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The runName. + /// The operationId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string runName, string operationId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/operations/{operationId}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunResource.cs index d23ea5681b495..50858e4b98b7d 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowRunResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The runName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string runName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LogicWorkflowRunOperationResources and their operations over a LogicWorkflowRunOperationResource. public virtual LogicWorkflowRunOperationCollection GetLogicWorkflowRunOperations() { - return GetCachedClient(Client => new LogicWorkflowRunOperationCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowRunOperationCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual LogicWorkflowRunOperationCollection GetLogicWorkflowRunOperations /// /// The workflow operation id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowRunOperationAsync(string operationId, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetLogicW /// /// The workflow operation id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowRunOperation(string operationId, CancellationToken cancellationToken = default) { @@ -143,7 +147,7 @@ public virtual Response GetLogicWorkflowRunOp /// An object representing collection of LogicWorkflowRunActionResources and their operations over a LogicWorkflowRunActionResource. public virtual LogicWorkflowRunActionCollection GetLogicWorkflowRunActions() { - return GetCachedClient(Client => new LogicWorkflowRunActionCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowRunActionCollection(client, Id)); } /// @@ -161,8 +165,8 @@ public virtual LogicWorkflowRunActionCollection GetLogicWorkflowRunActions() /// /// The workflow action name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowRunActionAsync(string actionName, CancellationToken cancellationToken = default) { @@ -184,8 +188,8 @@ public virtual async Task> GetLogicWork /// /// The workflow action name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowRunAction(string actionName, CancellationToken cancellationToken = default) { diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerHistoryResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerHistoryResource.cs index f9a7f34ae963d..9559d5b7b966a 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerHistoryResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerHistoryResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowTriggerHistoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The triggerName. + /// The historyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string triggerName, string historyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}/histories/{historyName}"; diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerResource.cs index 60c4cb384743a..458dbf2a47d1d 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowTriggerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The triggerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string triggerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/triggers/{triggerName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LogicWorkflowTriggerHistoryResources and their operations over a LogicWorkflowTriggerHistoryResource. public virtual LogicWorkflowTriggerHistoryCollection GetLogicWorkflowTriggerHistories() { - return GetCachedClient(Client => new LogicWorkflowTriggerHistoryCollection(Client, Id)); + return GetCachedClient(client => new LogicWorkflowTriggerHistoryCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual LogicWorkflowTriggerHistoryCollection GetLogicWorkflowTriggerHist /// /// The workflow trigger history name. Corresponds to the run name for triggers that resulted in a run. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogicWorkflowTriggerHistoryAsync(string historyName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetLogi /// /// The workflow trigger history name. Corresponds to the run name for triggers that resulted in a run. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogicWorkflowTriggerHistory(string historyName, CancellationToken cancellationToken = default) { diff --git a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowVersionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowVersionResource.cs index a19d46fe09860..5a3ce98430cf1 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowVersionResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowVersionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Logic public partial class LogicWorkflowVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workflowName. + /// The versionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workflowName, string versionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionId}"; diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/Azure.ResourceManager.MachineLearningCompute.sln b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/Azure.ResourceManager.MachineLearningCompute.sln index 0ee4e5f65beef..dc5c7e95dd027 100644 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/Azure.ResourceManager.MachineLearningCompute.sln +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/Azure.ResourceManager.MachineLearningCompute.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{AD28C841-23ED-4538-8D21-178A02D67B0C}") = "Azure.ResourceManager.MachineLearningCompute", "src\Azure.ResourceManager.MachineLearningCompute.csproj", "{BA27E854-E57A-45E1-8324-04109F54B232}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.MachineLearningCompute", "src\Azure.ResourceManager.MachineLearningCompute.csproj", "{BA27E854-E57A-45E1-8324-04109F54B232}" EndProject -Project("{AD28C841-23ED-4538-8D21-178A02D67B0C}") = "Azure.ResourceManager.MachineLearningCompute.Tests", "tests\Azure.ResourceManager.MachineLearningCompute.Tests.csproj", "{1D409A86-C07D-4967-9115-78AEECBF4D25}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.MachineLearningCompute.Tests", "tests\Azure.ResourceManager.MachineLearningCompute.Tests.csproj", "{1D409A86-C07D-4967-9115-78AEECBF4D25}" EndProject -Project("{AD28C841-23ED-4538-8D21-178A02D67B0C}") = "Azure.ResourceManager.MachineLearningCompute.Samples", "samples\Azure.ResourceManager.MachineLearningCompute.Samples.csproj", "{67C9A380-0892-4F04-AAA1-EEA63B66F465}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.MachineLearningCompute.Samples", "samples\Azure.ResourceManager.MachineLearningCompute.Samples.csproj", "{67C9A380-0892-4F04-AAA1-EEA63B66F465}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D4CBDE2E-7C1A-4FD4-920E-1193C4A9BA1F} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {1D409A86-C07D-4967-9115-78AEECBF4D25}.Release|x64.Build.0 = Release|Any CPU {1D409A86-C07D-4967-9115-78AEECBF4D25}.Release|x86.ActiveCfg = Release|Any CPU {1D409A86-C07D-4967-9115-78AEECBF4D25}.Release|x86.Build.0 = Release|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Debug|Any CPU.Build.0 = Debug|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Debug|x64.ActiveCfg = Debug|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Debug|x64.Build.0 = Debug|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Debug|x86.ActiveCfg = Debug|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Debug|x86.Build.0 = Debug|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Release|Any CPU.ActiveCfg = Release|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Release|Any CPU.Build.0 = Release|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Release|x64.ActiveCfg = Release|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Release|x64.Build.0 = Release|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Release|x86.ActiveCfg = Release|Any CPU + {67C9A380-0892-4F04-AAA1-EEA63B66F465}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D4CBDE2E-7C1A-4FD4-920E-1193C4A9BA1F} EndGlobalSection EndGlobal diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/api/Azure.ResourceManager.MachineLearningCompute.netstandard2.0.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/api/Azure.ResourceManager.MachineLearningCompute.netstandard2.0.cs index 47ec09b493a2b..62aad4b245b9d 100644 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/api/Azure.ResourceManager.MachineLearningCompute.netstandard2.0.cs +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/api/Azure.ResourceManager.MachineLearningCompute.netstandard2.0.cs @@ -30,7 +30,7 @@ protected OperationalizationClusterCollection() { } } public partial class OperationalizationClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public OperationalizationClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public OperationalizationClusterData(Azure.Core.AzureLocation location) { } public string AppInsightsResourceId { get { throw null; } set { } } public Azure.ResourceManager.MachineLearningCompute.Models.ClusterType? ClusterType { get { throw null; } set { } } public string ContainerRegistryResourceId { get { throw null; } set { } } @@ -70,6 +70,33 @@ protected OperationalizationClusterResource() { } public virtual System.Threading.Tasks.Task> UpdateSystemServicesAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.MachineLearningCompute.Mocking +{ + public partial class MockableMachineLearningComputeArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMachineLearningComputeArmClient() { } + public virtual Azure.ResourceManager.MachineLearningCompute.OperationalizationClusterResource GetOperationalizationClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMachineLearningComputeResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMachineLearningComputeResourceGroupResource() { } + public virtual Azure.Response GetOperationalizationCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOperationalizationClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MachineLearningCompute.OperationalizationClusterCollection GetOperationalizationClusters() { throw null; } + } + public partial class MockableMachineLearningComputeSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMachineLearningComputeSubscriptionResource() { } + public virtual Azure.Pageable GetOperationalizationClusters(string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationalizationClustersAsync(string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableMachineLearningComputeTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableMachineLearningComputeTenantResource() { } + public virtual Azure.Pageable GetAvailableOperationsMachineLearningComputes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableOperationsMachineLearningComputesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.MachineLearningCompute.Models { public partial class AcsClusterProperties diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MachineLearningComputeExtensions.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MachineLearningComputeExtensions.cs index ed8e98da8a4c5..9511abe8a18a3 100644 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MachineLearningComputeExtensions.cs +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MachineLearningComputeExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.MachineLearningCompute.Mocking; using Azure.ResourceManager.MachineLearningCompute.Models; using Azure.ResourceManager.Resources; @@ -19,78 +20,54 @@ namespace Azure.ResourceManager.MachineLearningCompute /// A class to add extension methods to Azure.ResourceManager.MachineLearningCompute. public static partial class MachineLearningComputeExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMachineLearningComputeArmClient GetMockableMachineLearningComputeArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMachineLearningComputeArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMachineLearningComputeResourceGroupResource GetMockableMachineLearningComputeResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMachineLearningComputeResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMachineLearningComputeSubscriptionResource GetMockableMachineLearningComputeSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMachineLearningComputeSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMachineLearningComputeTenantResource GetMockableMachineLearningComputeTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMachineLearningComputeTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region OperationalizationClusterResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalizationClusterResource GetOperationalizationClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalizationClusterResource.ValidateResourceId(id); - return new OperationalizationClusterResource(client, id); - } - ); + return GetMockableMachineLearningComputeArmClient(client).GetOperationalizationClusterResource(id); } - #endregion - /// Gets a collection of OperationalizationClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of OperationalizationClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of OperationalizationClusterResources and their operations over a OperationalizationClusterResource. public static OperationalizationClusterCollection GetOperationalizationClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetOperationalizationClusters(); + return GetMockableMachineLearningComputeResourceGroupResource(resourceGroupResource).GetOperationalizationClusters(); } /// @@ -105,16 +82,20 @@ public static OperationalizationClusterCollection GetOperationalizationClusters( /// OperationalizationClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetOperationalizationClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetOperationalizationClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableMachineLearningComputeResourceGroupResource(resourceGroupResource).GetOperationalizationClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -129,16 +110,20 @@ public static async Task> GetOperati /// OperationalizationClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetOperationalizationCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetOperationalizationClusters().Get(clusterName, cancellationToken); + return GetMockableMachineLearningComputeResourceGroupResource(resourceGroupResource).GetOperationalizationCluster(clusterName, cancellationToken); } /// @@ -153,6 +138,10 @@ public static Response GetOperationalizationC /// OperationalizationClusters_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token for pagination. @@ -160,7 +149,7 @@ public static Response GetOperationalizationC /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetOperationalizationClustersAsync(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOperationalizationClustersAsync(skiptoken, cancellationToken); + return GetMockableMachineLearningComputeSubscriptionResource(subscriptionResource).GetOperationalizationClustersAsync(skiptoken, cancellationToken); } /// @@ -175,6 +164,10 @@ public static AsyncPageable GetOperationaliza /// OperationalizationClusters_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token for pagination. @@ -182,7 +175,7 @@ public static AsyncPageable GetOperationaliza /// A collection of that may take multiple service requests to iterate over. public static Pageable GetOperationalizationClusters(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOperationalizationClusters(skiptoken, cancellationToken); + return GetMockableMachineLearningComputeSubscriptionResource(subscriptionResource).GetOperationalizationClusters(skiptoken, cancellationToken); } /// @@ -197,13 +190,17 @@ public static Pageable GetOperationalizationC /// MachineLearningCompute_ListAvailableOperations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableOperationsMachineLearningComputesAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetAvailableOperationsMachineLearningComputesAsync(cancellationToken); + return GetMockableMachineLearningComputeTenantResource(tenantResource).GetAvailableOperationsMachineLearningComputesAsync(cancellationToken); } /// @@ -218,13 +215,17 @@ public static AsyncPageable GetAvailableOperationsMachineLear /// MachineLearningCompute_ListAvailableOperations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableOperationsMachineLearningComputes(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetAvailableOperationsMachineLearningComputes(cancellationToken); + return GetMockableMachineLearningComputeTenantResource(tenantResource).GetAvailableOperationsMachineLearningComputes(cancellationToken); } } } diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeArmClient.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeArmClient.cs new file mode 100644 index 0000000000000..a3b4aaac1316f --- /dev/null +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MachineLearningCompute; + +namespace Azure.ResourceManager.MachineLearningCompute.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMachineLearningComputeArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMachineLearningComputeArmClient() + { + } + + /// 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 MockableMachineLearningComputeArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMachineLearningComputeArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalizationClusterResource GetOperationalizationClusterResource(ResourceIdentifier id) + { + OperationalizationClusterResource.ValidateResourceId(id); + return new OperationalizationClusterResource(Client, id); + } + } +} diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeResourceGroupResource.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeResourceGroupResource.cs new file mode 100644 index 0000000000000..cd205d0e99fde --- /dev/null +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.MachineLearningCompute; + +namespace Azure.ResourceManager.MachineLearningCompute.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMachineLearningComputeResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMachineLearningComputeResourceGroupResource() + { + } + + /// 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 MockableMachineLearningComputeResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of OperationalizationClusterResources in the ResourceGroupResource. + /// An object representing collection of OperationalizationClusterResources and their operations over a OperationalizationClusterResource. + public virtual OperationalizationClusterCollection GetOperationalizationClusters() + { + return GetCachedClient(client => new OperationalizationClusterCollection(client, Id)); + } + + /// + /// Gets the operationalization cluster resource view. Note that the credentials are not returned by this call. Call ListKeys to get them. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName} + /// + /// + /// Operation Id + /// OperationalizationClusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetOperationalizationClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetOperationalizationClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the operationalization cluster resource view. Note that the credentials are not returned by this call. Call ListKeys to get them. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName} + /// + /// + /// Operation Id + /// OperationalizationClusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetOperationalizationCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetOperationalizationClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeSubscriptionResource.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeSubscriptionResource.cs new file mode 100644 index 0000000000000..619b53456cd91 --- /dev/null +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeSubscriptionResource.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.MachineLearningCompute; + +namespace Azure.ResourceManager.MachineLearningCompute.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMachineLearningComputeSubscriptionResource : ArmResource + { + private ClientDiagnostics _operationalizationClusterClientDiagnostics; + private OperationalizationClustersRestOperations _operationalizationClusterRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMachineLearningComputeSubscriptionResource() + { + } + + /// 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 MockableMachineLearningComputeSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OperationalizationClusterClientDiagnostics => _operationalizationClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearningCompute", OperationalizationClusterResource.ResourceType.Namespace, Diagnostics); + private OperationalizationClustersRestOperations OperationalizationClusterRestClient => _operationalizationClusterRestClient ??= new OperationalizationClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OperationalizationClusterResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the operationalization clusters in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningCompute/operationalizationClusters + /// + /// + /// Operation Id + /// OperationalizationClusters_ListBySubscriptionId + /// + /// + /// + /// Continuation token for pagination. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationalizationClustersAsync(string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalizationClusterRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationalizationClusterRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OperationalizationClusterResource(Client, OperationalizationClusterData.DeserializeOperationalizationClusterData(e)), OperationalizationClusterClientDiagnostics, Pipeline, "MockableMachineLearningComputeSubscriptionResource.GetOperationalizationClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the operationalization clusters in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningCompute/operationalizationClusters + /// + /// + /// Operation Id + /// OperationalizationClusters_ListBySubscriptionId + /// + /// + /// + /// Continuation token for pagination. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperationalizationClusters(string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalizationClusterRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationalizationClusterRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OperationalizationClusterResource(Client, OperationalizationClusterData.DeserializeOperationalizationClusterData(e)), OperationalizationClusterClientDiagnostics, Pipeline, "MockableMachineLearningComputeSubscriptionResource.GetOperationalizationClusters", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeTenantResource.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeTenantResource.cs new file mode 100644 index 0000000000000..efbd2b59abb08 --- /dev/null +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MockableMachineLearningComputeTenantResource.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.MachineLearningCompute; +using Azure.ResourceManager.MachineLearningCompute.Models; + +namespace Azure.ResourceManager.MachineLearningCompute.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableMachineLearningComputeTenantResource : ArmResource + { + private ClientDiagnostics _machineLearningComputeClientDiagnostics; + private MachineLearningComputeRestOperations _machineLearningComputeRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMachineLearningComputeTenantResource() + { + } + + /// 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 MockableMachineLearningComputeTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MachineLearningComputeClientDiagnostics => _machineLearningComputeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearningCompute", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MachineLearningComputeRestOperations MachineLearningComputeRestClient => _machineLearningComputeRestClient ??= new MachineLearningComputeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all available operations. + /// + /// + /// Request Path + /// /providers/Microsoft.MachineLearningCompute/operations + /// + /// + /// Operation Id + /// MachineLearningCompute_ListAvailableOperations + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableOperationsMachineLearningComputesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningComputeRestClient.CreateListAvailableOperationsRequest(); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ResourceOperation.DeserializeResourceOperation, MachineLearningComputeClientDiagnostics, Pipeline, "MockableMachineLearningComputeTenantResource.GetAvailableOperationsMachineLearningComputes", "value", null, cancellationToken); + } + + /// + /// Gets all available operations. + /// + /// + /// Request Path + /// /providers/Microsoft.MachineLearningCompute/operations + /// + /// + /// Operation Id + /// MachineLearningCompute_ListAvailableOperations + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableOperationsMachineLearningComputes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningComputeRestClient.CreateListAvailableOperationsRequest(); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ResourceOperation.DeserializeResourceOperation, MachineLearningComputeClientDiagnostics, Pipeline, "MockableMachineLearningComputeTenantResource.GetAvailableOperationsMachineLearningComputes", "value", null, cancellationToken); + } + } +} diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 6682e7421c8c2..0000000000000 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MachineLearningCompute -{ - /// 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 OperationalizationClusterResources in the ResourceGroupResource. - /// An object representing collection of OperationalizationClusterResources and their operations over a OperationalizationClusterResource. - public virtual OperationalizationClusterCollection GetOperationalizationClusters() - { - return GetCachedClient(Client => new OperationalizationClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 614fb6155eb2a..0000000000000 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MachineLearningCompute -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _operationalizationClusterClientDiagnostics; - private OperationalizationClustersRestOperations _operationalizationClusterRestClient; - - /// 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 OperationalizationClusterClientDiagnostics => _operationalizationClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearningCompute", OperationalizationClusterResource.ResourceType.Namespace, Diagnostics); - private OperationalizationClustersRestOperations OperationalizationClusterRestClient => _operationalizationClusterRestClient ??= new OperationalizationClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OperationalizationClusterResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the operationalization clusters in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningCompute/operationalizationClusters - /// - /// - /// Operation Id - /// OperationalizationClusters_ListBySubscriptionId - /// - /// - /// - /// Continuation token for pagination. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationalizationClustersAsync(string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalizationClusterRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationalizationClusterRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OperationalizationClusterResource(Client, OperationalizationClusterData.DeserializeOperationalizationClusterData(e)), OperationalizationClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOperationalizationClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the operationalization clusters in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningCompute/operationalizationClusters - /// - /// - /// Operation Id - /// OperationalizationClusters_ListBySubscriptionId - /// - /// - /// - /// Continuation token for pagination. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationalizationClusters(string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalizationClusterRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationalizationClusterRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OperationalizationClusterResource(Client, OperationalizationClusterData.DeserializeOperationalizationClusterData(e)), OperationalizationClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOperationalizationClusters", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 922eb80cace37..0000000000000 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.MachineLearningCompute.Models; - -namespace Azure.ResourceManager.MachineLearningCompute -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _machineLearningComputeClientDiagnostics; - private MachineLearningComputeRestOperations _machineLearningComputeRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics MachineLearningComputeClientDiagnostics => _machineLearningComputeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearningCompute", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MachineLearningComputeRestOperations MachineLearningComputeRestClient => _machineLearningComputeRestClient ??= new MachineLearningComputeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets all available operations. - /// - /// - /// Request Path - /// /providers/Microsoft.MachineLearningCompute/operations - /// - /// - /// Operation Id - /// MachineLearningCompute_ListAvailableOperations - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableOperationsMachineLearningComputesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningComputeRestClient.CreateListAvailableOperationsRequest(); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ResourceOperation.DeserializeResourceOperation, MachineLearningComputeClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetAvailableOperationsMachineLearningComputes", "value", null, cancellationToken); - } - - /// - /// Gets all available operations. - /// - /// - /// Request Path - /// /providers/Microsoft.MachineLearningCompute/operations - /// - /// - /// Operation Id - /// MachineLearningCompute_ListAvailableOperations - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableOperationsMachineLearningComputes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningComputeRestClient.CreateListAvailableOperationsRequest(); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ResourceOperation.DeserializeResourceOperation, MachineLearningComputeClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetAvailableOperationsMachineLearningComputes", "value", null, cancellationToken); - } - } -} diff --git a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/OperationalizationClusterResource.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/OperationalizationClusterResource.cs index 33b0be7a66757..53cf0f030e55a 100644 --- a/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/OperationalizationClusterResource.cs +++ b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/OperationalizationClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.MachineLearningCompute public partial class OperationalizationClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningCompute/operationalizationClusters/{clusterName}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/api/Azure.ResourceManager.MachineLearning.netstandard2.0.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/api/Azure.ResourceManager.MachineLearning.netstandard2.0.cs index 02e73deaab31f..203ecf408a0ec 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/api/Azure.ResourceManager.MachineLearning.netstandard2.0.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/api/Azure.ResourceManager.MachineLearning.netstandard2.0.cs @@ -19,7 +19,7 @@ protected MachineLearningBatchDeploymentCollection() { } } public partial class MachineLearningBatchDeploymentData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningBatchDeploymentData(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningBatchDeploymentProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningBatchDeploymentData(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningBatchDeploymentProperties properties) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public string Kind { get { throw null; } set { } } public Azure.ResourceManager.MachineLearning.Models.MachineLearningBatchDeploymentProperties Properties { get { throw null; } set { } } @@ -64,7 +64,7 @@ protected MachineLearningBatchEndpointCollection() { } } public partial class MachineLearningBatchEndpointData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningBatchEndpointData(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningBatchEndpointProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningBatchEndpointData(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningBatchEndpointProperties properties) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public string Kind { get { throw null; } set { } } public Azure.ResourceManager.MachineLearning.Models.MachineLearningBatchEndpointProperties Properties { get { throw null; } set { } } @@ -274,7 +274,7 @@ protected MachineLearningComputeCollection() { } } public partial class MachineLearningComputeData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningComputeData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningComputeData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.MachineLearning.Models.MachineLearningComputeProperties Properties { get { throw null; } set { } } public Azure.ResourceManager.MachineLearning.Models.MachineLearningSku Sku { get { throw null; } set { } } @@ -942,7 +942,7 @@ protected MachineLearningOnlineDeploymentCollection() { } } public partial class MachineLearningOnlineDeploymentData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningOnlineDeploymentData(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningOnlineDeploymentProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningOnlineDeploymentData(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningOnlineDeploymentProperties properties) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public string Kind { get { throw null; } set { } } public Azure.ResourceManager.MachineLearning.Models.MachineLearningOnlineDeploymentProperties Properties { get { throw null; } set { } } @@ -993,7 +993,7 @@ protected MachineLearningOnlineEndpointCollection() { } } public partial class MachineLearningOnlineEndpointData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningOnlineEndpointData(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningOnlineEndpointProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningOnlineEndpointData(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningOnlineEndpointProperties properties) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public string Kind { get { throw null; } set { } } public Azure.ResourceManager.MachineLearning.Models.MachineLearningOnlineEndpointProperties Properties { get { throw null; } set { } } @@ -1083,7 +1083,7 @@ protected MachineLearningPrivateEndpointConnectionCollection() { } } public partial class MachineLearningPrivateEndpointConnectionData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningPrivateEndpointConnectionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningPrivateEndpointConnectionData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.MachineLearning.Models.MachineLearningPrivateLinkServiceConnectionState ConnectionState { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.MachineLearning.Models.MachineLearningPrivateEndpoint PrivateEndpoint { get { throw null; } set { } } @@ -1196,7 +1196,7 @@ protected MachineLearningRegistryCollection() { } } public partial class MachineLearningRegistryData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningRegistryData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningRegistryData(Azure.Core.AzureLocation location) { } public System.Uri DiscoveryUri { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public string IntellectualPropertyPublisher { get { throw null; } set { } } @@ -1547,7 +1547,7 @@ protected MachineLearningWorkspaceConnectionResource() { } } public partial class MachineLearningWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningWorkspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningWorkspaceData(Azure.Core.AzureLocation location) { } public bool? AllowPublicAccessWhenBehindVnet { get { throw null; } set { } } public string ApplicationInsights { get { throw null; } set { } } public System.Collections.Generic.IList AssociatedWorkspaces { get { throw null; } } @@ -1754,6 +1754,82 @@ protected MachineLearninRegistryComponentVersionResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.MachineLearning.MachineLearningComponentVersionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.MachineLearning.Mocking +{ + public partial class MockableMachineLearningArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMachineLearningArmClient() { } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningBatchDeploymentResource GetMachineLearningBatchDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningBatchEndpointResource GetMachineLearningBatchEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningCodeContainerResource GetMachineLearningCodeContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningCodeVersionResource GetMachineLearningCodeVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningComponentContainerResource GetMachineLearningComponentContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningComponentVersionResource GetMachineLearningComponentVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningComputeResource GetMachineLearningComputeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningDataContainerResource GetMachineLearningDataContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningDatastoreResource GetMachineLearningDatastoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningDataVersionResource GetMachineLearningDataVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningEnvironmentContainerResource GetMachineLearningEnvironmentContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningEnvironmentVersionResource GetMachineLearningEnvironmentVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningFeatureResource GetMachineLearningFeatureResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningFeatureSetContainerResource GetMachineLearningFeatureSetContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningFeatureSetVersionResource GetMachineLearningFeatureSetVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningFeatureStoreEntityContainerResource GetMachineLearningFeatureStoreEntityContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningFeaturestoreEntityVersionResource GetMachineLearningFeaturestoreEntityVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningJobResource GetMachineLearningJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningLabelingJobResource GetMachineLearningLabelingJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningModelContainerResource GetMachineLearningModelContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningModelVersionResource GetMachineLearningModelVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningOnlineDeploymentResource GetMachineLearningOnlineDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningOnlineEndpointResource GetMachineLearningOnlineEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningOutboundRuleBasicResource GetMachineLearningOutboundRuleBasicResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningPrivateEndpointConnectionResource GetMachineLearningPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryCodeContainerResource GetMachineLearningRegistryCodeContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryCodeVersionResource GetMachineLearningRegistryCodeVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryDataContainerResource GetMachineLearningRegistryDataContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryDataVersionResource GetMachineLearningRegistryDataVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryEnvironmentContainerResource GetMachineLearningRegistryEnvironmentContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryEnvironmentVersionResource GetMachineLearningRegistryEnvironmentVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryModelContainerResource GetMachineLearningRegistryModelContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryModelVersionResource GetMachineLearningRegistryModelVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryResource GetMachineLearningRegistryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningScheduleResource GetMachineLearningScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningWorkspaceConnectionResource GetMachineLearningWorkspaceConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningWorkspaceResource GetMachineLearningWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearninRegistryComponentContainerResource GetMachineLearninRegistryComponentContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearninRegistryComponentVersionResource GetMachineLearninRegistryComponentVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMachineLearningResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMachineLearningResourceGroupResource() { } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningRegistryCollection GetMachineLearningRegistries() { throw null; } + public virtual Azure.Response GetMachineLearningRegistry(string registryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMachineLearningRegistryAsync(string registryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetMachineLearningWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMachineLearningWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MachineLearning.MachineLearningWorkspaceCollection GetMachineLearningWorkspaces() { throw null; } + } + public partial class MockableMachineLearningSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMachineLearningSubscriptionResource() { } + public virtual Azure.Pageable GetMachineLearningQuotas(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMachineLearningQuotasAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMachineLearningRegistries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMachineLearningRegistriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMachineLearningUsages(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMachineLearningUsagesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMachineLearningVmSizes(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMachineLearningVmSizesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMachineLearningWorkspaces(string skip = null, string kind = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetMachineLearningWorkspaces(string skip = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMachineLearningWorkspacesAsync(string skip = null, string kind = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetMachineLearningWorkspacesAsync(string skip = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable UpdateMachineLearningQuotas(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningQuotaUpdateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable UpdateMachineLearningQuotasAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.MachineLearning.Models.MachineLearningQuotaUpdateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.MachineLearning.Models { public partial class AccessKeyAuthTypeWorkspaceConnectionProperties : Azure.ResourceManager.MachineLearning.Models.MachineLearningWorkspaceConnectionProperties @@ -5658,7 +5734,7 @@ public MachineLearningPrivateEndpoint() { } } public partial class MachineLearningPrivateLinkResource : Azure.ResourceManager.Models.TrackedResourceData { - public MachineLearningPrivateLinkResource(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MachineLearningPrivateLinkResource(Azure.Core.AzureLocation location) { } public string GroupId { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Customized/Extensions/MachineLearningExtensions.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Customized/Extensions/MachineLearningExtensions.cs index 1b08c5ad790ba..0e45b3af0b09c 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Customized/Extensions/MachineLearningExtensions.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Customized/Extensions/MachineLearningExtensions.cs @@ -31,7 +31,9 @@ public static partial class MachineLearningExtensions /// An async collection of that may take multiple service requests to iterate over. [EditorBrowsable(EditorBrowsableState.Never)] public static AsyncPageable GetMachineLearningWorkspacesAsync(this SubscriptionResource subscriptionResource, string skip, CancellationToken cancellationToken) - => GetMachineLearningWorkspacesAsync(subscriptionResource, skip, null, cancellationToken); + { + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningWorkspacesAsync(skip, cancellationToken); + } /// /// Lists all the available machine learning workspaces under the specified subscription. @@ -52,6 +54,8 @@ public static AsyncPageable GetMachineLearning /// A collection of that may take multiple service requests to iterate over. [EditorBrowsable(EditorBrowsableState.Never)] public static Pageable GetMachineLearningWorkspaces(this SubscriptionResource subscriptionResource, string skip, CancellationToken cancellationToken) - => GetMachineLearningWorkspaces(subscriptionResource, skip, null, cancellationToken); + { + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningWorkspaces(skip, cancellationToken); + } } } diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Customized/Extensions/MockableMachineLearningSubscriptionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Customized/Extensions/MockableMachineLearningSubscriptionResource.cs new file mode 100644 index 0000000000000..c8baf637ee513 --- /dev/null +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Customized/Extensions/MockableMachineLearningSubscriptionResource.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.ComponentModel; +using System.Threading; + +namespace Azure.ResourceManager.MachineLearning.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMachineLearningSubscriptionResource : ArmResource + { + /// + /// Lists all the available machine learning workspaces under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// Continuation token for pagination. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetMachineLearningWorkspacesAsync(string skip = null, CancellationToken cancellationToken = default) + { + return GetMachineLearningWorkspacesAsync(skip, null, cancellationToken); + } + + /// + /// Lists all the available machine learning workspaces under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// Continuation token for pagination. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetMachineLearningWorkspaces(string skip = null, CancellationToken cancellationToken = default) + { + return GetMachineLearningWorkspaces(skip, null, cancellationToken); + } + } +} diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MachineLearningExtensions.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MachineLearningExtensions.cs index 2f27418ea6cef..2bd8c180acae6 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MachineLearningExtensions.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MachineLearningExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.MachineLearning.Mocking; using Azure.ResourceManager.MachineLearning.Models; using Azure.ResourceManager.Resources; @@ -19,784 +20,657 @@ namespace Azure.ResourceManager.MachineLearning /// A class to add extension methods to Azure.ResourceManager.MachineLearning. public static partial class MachineLearningExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMachineLearningArmClient GetMockableMachineLearningArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMachineLearningArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMachineLearningResourceGroupResource GetMockableMachineLearningResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMachineLearningResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMachineLearningSubscriptionResource GetMockableMachineLearningSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMachineLearningSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region MachineLearningComputeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningComputeResource GetMachineLearningComputeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningComputeResource.ValidateResourceId(id); - return new MachineLearningComputeResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningComputeResource(id); } - #endregion - #region MachineLearningRegistryCodeContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryCodeContainerResource GetMachineLearningRegistryCodeContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryCodeContainerResource.ValidateResourceId(id); - return new MachineLearningRegistryCodeContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryCodeContainerResource(id); } - #endregion - #region MachineLearningCodeContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningCodeContainerResource GetMachineLearningCodeContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningCodeContainerResource.ValidateResourceId(id); - return new MachineLearningCodeContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningCodeContainerResource(id); } - #endregion - #region MachineLearningRegistryCodeVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryCodeVersionResource GetMachineLearningRegistryCodeVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryCodeVersionResource.ValidateResourceId(id); - return new MachineLearningRegistryCodeVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryCodeVersionResource(id); } - #endregion - #region MachineLearningCodeVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningCodeVersionResource GetMachineLearningCodeVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningCodeVersionResource.ValidateResourceId(id); - return new MachineLearningCodeVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningCodeVersionResource(id); } - #endregion - #region MachineLearninRegistryComponentContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearninRegistryComponentContainerResource GetMachineLearninRegistryComponentContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearninRegistryComponentContainerResource.ValidateResourceId(id); - return new MachineLearninRegistryComponentContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearninRegistryComponentContainerResource(id); } - #endregion - #region MachineLearningComponentContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningComponentContainerResource GetMachineLearningComponentContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningComponentContainerResource.ValidateResourceId(id); - return new MachineLearningComponentContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningComponentContainerResource(id); } - #endregion - #region MachineLearninRegistryComponentVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearninRegistryComponentVersionResource GetMachineLearninRegistryComponentVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearninRegistryComponentVersionResource.ValidateResourceId(id); - return new MachineLearninRegistryComponentVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearninRegistryComponentVersionResource(id); } - #endregion - #region MachineLearningComponentVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningComponentVersionResource GetMachineLearningComponentVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningComponentVersionResource.ValidateResourceId(id); - return new MachineLearningComponentVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningComponentVersionResource(id); } - #endregion - #region MachineLearningRegistryDataContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryDataContainerResource GetMachineLearningRegistryDataContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryDataContainerResource.ValidateResourceId(id); - return new MachineLearningRegistryDataContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryDataContainerResource(id); } - #endregion - #region MachineLearningDataContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningDataContainerResource GetMachineLearningDataContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningDataContainerResource.ValidateResourceId(id); - return new MachineLearningDataContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningDataContainerResource(id); } - #endregion - #region MachineLearningRegistryDataVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryDataVersionResource GetMachineLearningRegistryDataVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryDataVersionResource.ValidateResourceId(id); - return new MachineLearningRegistryDataVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryDataVersionResource(id); } - #endregion - #region MachineLearningDataVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningDataVersionResource GetMachineLearningDataVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningDataVersionResource.ValidateResourceId(id); - return new MachineLearningDataVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningDataVersionResource(id); } - #endregion - #region MachineLearningRegistryEnvironmentContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryEnvironmentContainerResource GetMachineLearningRegistryEnvironmentContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryEnvironmentContainerResource.ValidateResourceId(id); - return new MachineLearningRegistryEnvironmentContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryEnvironmentContainerResource(id); } - #endregion - #region MachineLearningEnvironmentContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningEnvironmentContainerResource GetMachineLearningEnvironmentContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningEnvironmentContainerResource.ValidateResourceId(id); - return new MachineLearningEnvironmentContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningEnvironmentContainerResource(id); } - #endregion - #region MachineLearningRegistryEnvironmentVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryEnvironmentVersionResource GetMachineLearningRegistryEnvironmentVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryEnvironmentVersionResource.ValidateResourceId(id); - return new MachineLearningRegistryEnvironmentVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryEnvironmentVersionResource(id); } - #endregion - #region MachineLearningEnvironmentVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningEnvironmentVersionResource GetMachineLearningEnvironmentVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningEnvironmentVersionResource.ValidateResourceId(id); - return new MachineLearningEnvironmentVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningEnvironmentVersionResource(id); } - #endregion - #region MachineLearningRegistryModelContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryModelContainerResource GetMachineLearningRegistryModelContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryModelContainerResource.ValidateResourceId(id); - return new MachineLearningRegistryModelContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryModelContainerResource(id); } - #endregion - #region MachineLearningModelContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningModelContainerResource GetMachineLearningModelContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningModelContainerResource.ValidateResourceId(id); - return new MachineLearningModelContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningModelContainerResource(id); } - #endregion - #region MachineLearningRegistryModelVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryModelVersionResource GetMachineLearningRegistryModelVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryModelVersionResource.ValidateResourceId(id); - return new MachineLearningRegistryModelVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryModelVersionResource(id); } - #endregion - #region MachineLearningModelVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningModelVersionResource GetMachineLearningModelVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningModelVersionResource.ValidateResourceId(id); - return new MachineLearningModelVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningModelVersionResource(id); } - #endregion - #region MachineLearningBatchEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningBatchEndpointResource GetMachineLearningBatchEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningBatchEndpointResource.ValidateResourceId(id); - return new MachineLearningBatchEndpointResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningBatchEndpointResource(id); } - #endregion - #region MachineLearningBatchDeploymentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningBatchDeploymentResource GetMachineLearningBatchDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningBatchDeploymentResource.ValidateResourceId(id); - return new MachineLearningBatchDeploymentResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningBatchDeploymentResource(id); } - #endregion - #region MachineLearningDatastoreResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningDatastoreResource GetMachineLearningDatastoreResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningDatastoreResource.ValidateResourceId(id); - return new MachineLearningDatastoreResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningDatastoreResource(id); } - #endregion - #region MachineLearningFeatureSetContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningFeatureSetContainerResource GetMachineLearningFeatureSetContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningFeatureSetContainerResource.ValidateResourceId(id); - return new MachineLearningFeatureSetContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningFeatureSetContainerResource(id); } - #endregion - #region MachineLearningFeatureResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningFeatureResource GetMachineLearningFeatureResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningFeatureResource.ValidateResourceId(id); - return new MachineLearningFeatureResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningFeatureResource(id); } - #endregion - #region MachineLearningFeatureSetVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningFeatureSetVersionResource GetMachineLearningFeatureSetVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningFeatureSetVersionResource.ValidateResourceId(id); - return new MachineLearningFeatureSetVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningFeatureSetVersionResource(id); } - #endregion - #region MachineLearningFeatureStoreEntityContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningFeatureStoreEntityContainerResource GetMachineLearningFeatureStoreEntityContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningFeatureStoreEntityContainerResource.ValidateResourceId(id); - return new MachineLearningFeatureStoreEntityContainerResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningFeatureStoreEntityContainerResource(id); } - #endregion - #region MachineLearningFeaturestoreEntityVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningFeaturestoreEntityVersionResource GetMachineLearningFeaturestoreEntityVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningFeaturestoreEntityVersionResource.ValidateResourceId(id); - return new MachineLearningFeaturestoreEntityVersionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningFeaturestoreEntityVersionResource(id); } - #endregion - #region MachineLearningJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningJobResource GetMachineLearningJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningJobResource.ValidateResourceId(id); - return new MachineLearningJobResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningJobResource(id); } - #endregion - #region MachineLearningLabelingJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningLabelingJobResource GetMachineLearningLabelingJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningLabelingJobResource.ValidateResourceId(id); - return new MachineLearningLabelingJobResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningLabelingJobResource(id); } - #endregion - #region MachineLearningOnlineEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningOnlineEndpointResource GetMachineLearningOnlineEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningOnlineEndpointResource.ValidateResourceId(id); - return new MachineLearningOnlineEndpointResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningOnlineEndpointResource(id); } - #endregion - #region MachineLearningOnlineDeploymentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningOnlineDeploymentResource GetMachineLearningOnlineDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningOnlineDeploymentResource.ValidateResourceId(id); - return new MachineLearningOnlineDeploymentResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningOnlineDeploymentResource(id); } - #endregion - #region MachineLearningScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningScheduleResource GetMachineLearningScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningScheduleResource.ValidateResourceId(id); - return new MachineLearningScheduleResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningScheduleResource(id); } - #endregion - #region MachineLearningRegistryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningRegistryResource GetMachineLearningRegistryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningRegistryResource.ValidateResourceId(id); - return new MachineLearningRegistryResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningRegistryResource(id); } - #endregion - #region MachineLearningWorkspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningWorkspaceResource GetMachineLearningWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningWorkspaceResource.ValidateResourceId(id); - return new MachineLearningWorkspaceResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningWorkspaceResource(id); } - #endregion - #region MachineLearningWorkspaceConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningWorkspaceConnectionResource GetMachineLearningWorkspaceConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningWorkspaceConnectionResource.ValidateResourceId(id); - return new MachineLearningWorkspaceConnectionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningWorkspaceConnectionResource(id); } - #endregion - #region MachineLearningOutboundRuleBasicResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningOutboundRuleBasicResource GetMachineLearningOutboundRuleBasicResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningOutboundRuleBasicResource.ValidateResourceId(id); - return new MachineLearningOutboundRuleBasicResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningOutboundRuleBasicResource(id); } - #endregion - #region MachineLearningPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MachineLearningPrivateEndpointConnectionResource GetMachineLearningPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MachineLearningPrivateEndpointConnectionResource.ValidateResourceId(id); - return new MachineLearningPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableMachineLearningArmClient(client).GetMachineLearningPrivateEndpointConnectionResource(id); } - #endregion - /// Gets a collection of MachineLearningRegistryResources in the ResourceGroupResource. + /// + /// Gets a collection of MachineLearningRegistryResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MachineLearningRegistryResources and their operations over a MachineLearningRegistryResource. public static MachineLearningRegistryCollection GetMachineLearningRegistries(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMachineLearningRegistries(); + return GetMockableMachineLearningResourceGroupResource(resourceGroupResource).GetMachineLearningRegistries(); } /// @@ -811,16 +685,20 @@ public static MachineLearningRegistryCollection GetMachineLearningRegistries(thi /// Registries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of Azure Machine Learning registry. This is case-insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMachineLearningRegistryAsync(this ResourceGroupResource resourceGroupResource, string registryName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMachineLearningRegistries().GetAsync(registryName, cancellationToken).ConfigureAwait(false); + return await GetMockableMachineLearningResourceGroupResource(resourceGroupResource).GetMachineLearningRegistryAsync(registryName, cancellationToken).ConfigureAwait(false); } /// @@ -835,24 +713,34 @@ public static async Task> GetMachineLe /// Registries_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of Azure Machine Learning registry. This is case-insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMachineLearningRegistry(this ResourceGroupResource resourceGroupResource, string registryName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMachineLearningRegistries().Get(registryName, cancellationToken); + return GetMockableMachineLearningResourceGroupResource(resourceGroupResource).GetMachineLearningRegistry(registryName, cancellationToken); } - /// Gets a collection of MachineLearningWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of MachineLearningWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MachineLearningWorkspaceResources and their operations over a MachineLearningWorkspaceResource. public static MachineLearningWorkspaceCollection GetMachineLearningWorkspaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMachineLearningWorkspaces(); + return GetMockableMachineLearningResourceGroupResource(resourceGroupResource).GetMachineLearningWorkspaces(); } /// @@ -867,16 +755,20 @@ public static MachineLearningWorkspaceCollection GetMachineLearningWorkspaces(th /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of Azure Machine Learning workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMachineLearningWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMachineLearningWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableMachineLearningResourceGroupResource(resourceGroupResource).GetMachineLearningWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -891,16 +783,20 @@ public static async Task> GetMachineL /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of Azure Machine Learning workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMachineLearningWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMachineLearningWorkspaces().Get(workspaceName, cancellationToken); + return GetMockableMachineLearningResourceGroupResource(resourceGroupResource).GetMachineLearningWorkspace(workspaceName, cancellationToken); } /// @@ -915,6 +811,10 @@ public static Response GetMachineLearningWorks /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which resource usage is queried. @@ -922,7 +822,7 @@ public static Response GetMachineLearningWorks /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetMachineLearningUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningUsagesAsync(location, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningUsagesAsync(location, cancellationToken); } /// @@ -937,6 +837,10 @@ public static AsyncPageable GetMachineLearningUsagesAsync( /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which resource usage is queried. @@ -944,7 +848,7 @@ public static AsyncPageable GetMachineLearningUsagesAsync( /// A collection of that may take multiple service requests to iterate over. public static Pageable GetMachineLearningUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningUsages(location, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningUsages(location, cancellationToken); } /// @@ -959,6 +863,10 @@ public static Pageable GetMachineLearningUsages(this Subsc /// VirtualMachineSizes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location upon which virtual-machine-sizes is queried. @@ -966,7 +874,7 @@ public static Pageable GetMachineLearningUsages(this Subsc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetMachineLearningVmSizesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningVmSizesAsync(location, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningVmSizesAsync(location, cancellationToken); } /// @@ -981,6 +889,10 @@ public static AsyncPageable GetMachineLearningVmSizesAsyn /// VirtualMachineSizes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location upon which virtual-machine-sizes is queried. @@ -988,7 +900,7 @@ public static AsyncPageable GetMachineLearningVmSizesAsyn /// A collection of that may take multiple service requests to iterate over. public static Pageable GetMachineLearningVmSizes(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningVmSizes(location, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningVmSizes(location, cancellationToken); } /// @@ -1003,6 +915,10 @@ public static Pageable GetMachineLearningVmSizes(this Sub /// Quotas_Update /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for update quota is queried. @@ -1012,9 +928,7 @@ public static Pageable GetMachineLearningVmSizes(this Sub /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable UpdateMachineLearningQuotasAsync(this SubscriptionResource subscriptionResource, AzureLocation location, MachineLearningQuotaUpdateContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).UpdateMachineLearningQuotasAsync(location, content, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).UpdateMachineLearningQuotasAsync(location, content, cancellationToken); } /// @@ -1029,6 +943,10 @@ public static AsyncPageable UpdateMachineLe /// Quotas_Update /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for update quota is queried. @@ -1038,9 +956,7 @@ public static AsyncPageable UpdateMachineLe /// A collection of that may take multiple service requests to iterate over. public static Pageable UpdateMachineLearningQuotas(this SubscriptionResource subscriptionResource, AzureLocation location, MachineLearningQuotaUpdateContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).UpdateMachineLearningQuotas(location, content, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).UpdateMachineLearningQuotas(location, content, cancellationToken); } /// @@ -1055,6 +971,10 @@ public static Pageable UpdateMachineLearnin /// Quotas_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which resource usage is queried. @@ -1062,7 +982,7 @@ public static Pageable UpdateMachineLearnin /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetMachineLearningQuotasAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningQuotasAsync(location, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningQuotasAsync(location, cancellationToken); } /// @@ -1077,6 +997,10 @@ public static AsyncPageable GetMachineLearningQuot /// Quotas_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for which resource usage is queried. @@ -1084,7 +1008,7 @@ public static AsyncPageable GetMachineLearningQuot /// A collection of that may take multiple service requests to iterate over. public static Pageable GetMachineLearningQuotas(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningQuotas(location, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningQuotas(location, cancellationToken); } /// @@ -1099,13 +1023,17 @@ public static Pageable GetMachineLearningQuotas(th /// Registries_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMachineLearningRegistriesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningRegistriesAsync(cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningRegistriesAsync(cancellationToken); } /// @@ -1120,13 +1048,17 @@ public static AsyncPageable GetMachineLearningR /// Registries_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMachineLearningRegistries(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningRegistries(cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningRegistries(cancellationToken); } /// @@ -1141,6 +1073,10 @@ public static Pageable GetMachineLearningRegist /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token for pagination. @@ -1149,7 +1085,7 @@ public static Pageable GetMachineLearningRegist /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetMachineLearningWorkspacesAsync(this SubscriptionResource subscriptionResource, string skip = null, string kind = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningWorkspacesAsync(skip, kind, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningWorkspacesAsync(skip, kind, cancellationToken); } /// @@ -1164,6 +1100,10 @@ public static AsyncPageable GetMachineLearning /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token for pagination. @@ -1172,7 +1112,7 @@ public static AsyncPageable GetMachineLearning /// A collection of that may take multiple service requests to iterate over. public static Pageable GetMachineLearningWorkspaces(this SubscriptionResource subscriptionResource, string skip = null, string kind = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMachineLearningWorkspaces(skip, kind, cancellationToken); + return GetMockableMachineLearningSubscriptionResource(subscriptionResource).GetMachineLearningWorkspaces(skip, kind, cancellationToken); } } } diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningArmClient.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningArmClient.cs new file mode 100644 index 0000000000000..57b528b5ceb58 --- /dev/null +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningArmClient.cs @@ -0,0 +1,507 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MachineLearning; + +namespace Azure.ResourceManager.MachineLearning.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMachineLearningArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMachineLearningArmClient() + { + } + + /// 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 MockableMachineLearningArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMachineLearningArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningComputeResource GetMachineLearningComputeResource(ResourceIdentifier id) + { + MachineLearningComputeResource.ValidateResourceId(id); + return new MachineLearningComputeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryCodeContainerResource GetMachineLearningRegistryCodeContainerResource(ResourceIdentifier id) + { + MachineLearningRegistryCodeContainerResource.ValidateResourceId(id); + return new MachineLearningRegistryCodeContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningCodeContainerResource GetMachineLearningCodeContainerResource(ResourceIdentifier id) + { + MachineLearningCodeContainerResource.ValidateResourceId(id); + return new MachineLearningCodeContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryCodeVersionResource GetMachineLearningRegistryCodeVersionResource(ResourceIdentifier id) + { + MachineLearningRegistryCodeVersionResource.ValidateResourceId(id); + return new MachineLearningRegistryCodeVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningCodeVersionResource GetMachineLearningCodeVersionResource(ResourceIdentifier id) + { + MachineLearningCodeVersionResource.ValidateResourceId(id); + return new MachineLearningCodeVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearninRegistryComponentContainerResource GetMachineLearninRegistryComponentContainerResource(ResourceIdentifier id) + { + MachineLearninRegistryComponentContainerResource.ValidateResourceId(id); + return new MachineLearninRegistryComponentContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningComponentContainerResource GetMachineLearningComponentContainerResource(ResourceIdentifier id) + { + MachineLearningComponentContainerResource.ValidateResourceId(id); + return new MachineLearningComponentContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearninRegistryComponentVersionResource GetMachineLearninRegistryComponentVersionResource(ResourceIdentifier id) + { + MachineLearninRegistryComponentVersionResource.ValidateResourceId(id); + return new MachineLearninRegistryComponentVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningComponentVersionResource GetMachineLearningComponentVersionResource(ResourceIdentifier id) + { + MachineLearningComponentVersionResource.ValidateResourceId(id); + return new MachineLearningComponentVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryDataContainerResource GetMachineLearningRegistryDataContainerResource(ResourceIdentifier id) + { + MachineLearningRegistryDataContainerResource.ValidateResourceId(id); + return new MachineLearningRegistryDataContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningDataContainerResource GetMachineLearningDataContainerResource(ResourceIdentifier id) + { + MachineLearningDataContainerResource.ValidateResourceId(id); + return new MachineLearningDataContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryDataVersionResource GetMachineLearningRegistryDataVersionResource(ResourceIdentifier id) + { + MachineLearningRegistryDataVersionResource.ValidateResourceId(id); + return new MachineLearningRegistryDataVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningDataVersionResource GetMachineLearningDataVersionResource(ResourceIdentifier id) + { + MachineLearningDataVersionResource.ValidateResourceId(id); + return new MachineLearningDataVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryEnvironmentContainerResource GetMachineLearningRegistryEnvironmentContainerResource(ResourceIdentifier id) + { + MachineLearningRegistryEnvironmentContainerResource.ValidateResourceId(id); + return new MachineLearningRegistryEnvironmentContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningEnvironmentContainerResource GetMachineLearningEnvironmentContainerResource(ResourceIdentifier id) + { + MachineLearningEnvironmentContainerResource.ValidateResourceId(id); + return new MachineLearningEnvironmentContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryEnvironmentVersionResource GetMachineLearningRegistryEnvironmentVersionResource(ResourceIdentifier id) + { + MachineLearningRegistryEnvironmentVersionResource.ValidateResourceId(id); + return new MachineLearningRegistryEnvironmentVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningEnvironmentVersionResource GetMachineLearningEnvironmentVersionResource(ResourceIdentifier id) + { + MachineLearningEnvironmentVersionResource.ValidateResourceId(id); + return new MachineLearningEnvironmentVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryModelContainerResource GetMachineLearningRegistryModelContainerResource(ResourceIdentifier id) + { + MachineLearningRegistryModelContainerResource.ValidateResourceId(id); + return new MachineLearningRegistryModelContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningModelContainerResource GetMachineLearningModelContainerResource(ResourceIdentifier id) + { + MachineLearningModelContainerResource.ValidateResourceId(id); + return new MachineLearningModelContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryModelVersionResource GetMachineLearningRegistryModelVersionResource(ResourceIdentifier id) + { + MachineLearningRegistryModelVersionResource.ValidateResourceId(id); + return new MachineLearningRegistryModelVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningModelVersionResource GetMachineLearningModelVersionResource(ResourceIdentifier id) + { + MachineLearningModelVersionResource.ValidateResourceId(id); + return new MachineLearningModelVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningBatchEndpointResource GetMachineLearningBatchEndpointResource(ResourceIdentifier id) + { + MachineLearningBatchEndpointResource.ValidateResourceId(id); + return new MachineLearningBatchEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningBatchDeploymentResource GetMachineLearningBatchDeploymentResource(ResourceIdentifier id) + { + MachineLearningBatchDeploymentResource.ValidateResourceId(id); + return new MachineLearningBatchDeploymentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningDatastoreResource GetMachineLearningDatastoreResource(ResourceIdentifier id) + { + MachineLearningDatastoreResource.ValidateResourceId(id); + return new MachineLearningDatastoreResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningFeatureSetContainerResource GetMachineLearningFeatureSetContainerResource(ResourceIdentifier id) + { + MachineLearningFeatureSetContainerResource.ValidateResourceId(id); + return new MachineLearningFeatureSetContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningFeatureResource GetMachineLearningFeatureResource(ResourceIdentifier id) + { + MachineLearningFeatureResource.ValidateResourceId(id); + return new MachineLearningFeatureResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningFeatureSetVersionResource GetMachineLearningFeatureSetVersionResource(ResourceIdentifier id) + { + MachineLearningFeatureSetVersionResource.ValidateResourceId(id); + return new MachineLearningFeatureSetVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningFeatureStoreEntityContainerResource GetMachineLearningFeatureStoreEntityContainerResource(ResourceIdentifier id) + { + MachineLearningFeatureStoreEntityContainerResource.ValidateResourceId(id); + return new MachineLearningFeatureStoreEntityContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningFeaturestoreEntityVersionResource GetMachineLearningFeaturestoreEntityVersionResource(ResourceIdentifier id) + { + MachineLearningFeaturestoreEntityVersionResource.ValidateResourceId(id); + return new MachineLearningFeaturestoreEntityVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningJobResource GetMachineLearningJobResource(ResourceIdentifier id) + { + MachineLearningJobResource.ValidateResourceId(id); + return new MachineLearningJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningLabelingJobResource GetMachineLearningLabelingJobResource(ResourceIdentifier id) + { + MachineLearningLabelingJobResource.ValidateResourceId(id); + return new MachineLearningLabelingJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningOnlineEndpointResource GetMachineLearningOnlineEndpointResource(ResourceIdentifier id) + { + MachineLearningOnlineEndpointResource.ValidateResourceId(id); + return new MachineLearningOnlineEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningOnlineDeploymentResource GetMachineLearningOnlineDeploymentResource(ResourceIdentifier id) + { + MachineLearningOnlineDeploymentResource.ValidateResourceId(id); + return new MachineLearningOnlineDeploymentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningScheduleResource GetMachineLearningScheduleResource(ResourceIdentifier id) + { + MachineLearningScheduleResource.ValidateResourceId(id); + return new MachineLearningScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningRegistryResource GetMachineLearningRegistryResource(ResourceIdentifier id) + { + MachineLearningRegistryResource.ValidateResourceId(id); + return new MachineLearningRegistryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningWorkspaceResource GetMachineLearningWorkspaceResource(ResourceIdentifier id) + { + MachineLearningWorkspaceResource.ValidateResourceId(id); + return new MachineLearningWorkspaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningWorkspaceConnectionResource GetMachineLearningWorkspaceConnectionResource(ResourceIdentifier id) + { + MachineLearningWorkspaceConnectionResource.ValidateResourceId(id); + return new MachineLearningWorkspaceConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningOutboundRuleBasicResource GetMachineLearningOutboundRuleBasicResource(ResourceIdentifier id) + { + MachineLearningOutboundRuleBasicResource.ValidateResourceId(id); + return new MachineLearningOutboundRuleBasicResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MachineLearningPrivateEndpointConnectionResource GetMachineLearningPrivateEndpointConnectionResource(ResourceIdentifier id) + { + MachineLearningPrivateEndpointConnectionResource.ValidateResourceId(id); + return new MachineLearningPrivateEndpointConnectionResource(Client, id); + } + } +} diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningResourceGroupResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningResourceGroupResource.cs new file mode 100644 index 0000000000000..69e022a5bb75b --- /dev/null +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.MachineLearning; + +namespace Azure.ResourceManager.MachineLearning.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMachineLearningResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMachineLearningResourceGroupResource() + { + } + + /// 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 MockableMachineLearningResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MachineLearningRegistryResources in the ResourceGroupResource. + /// An object representing collection of MachineLearningRegistryResources and their operations over a MachineLearningRegistryResource. + public virtual MachineLearningRegistryCollection GetMachineLearningRegistries() + { + return GetCachedClient(client => new MachineLearningRegistryCollection(client, Id)); + } + + /// + /// Get registry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName} + /// + /// + /// Operation Id + /// Registries_Get + /// + /// + /// + /// Name of Azure Machine Learning registry. This is case-insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMachineLearningRegistryAsync(string registryName, CancellationToken cancellationToken = default) + { + return await GetMachineLearningRegistries().GetAsync(registryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get registry + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName} + /// + /// + /// Operation Id + /// Registries_Get + /// + /// + /// + /// Name of Azure Machine Learning registry. This is case-insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMachineLearningRegistry(string registryName, CancellationToken cancellationToken = default) + { + return GetMachineLearningRegistries().Get(registryName, cancellationToken); + } + + /// Gets a collection of MachineLearningWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of MachineLearningWorkspaceResources and their operations over a MachineLearningWorkspaceResource. + public virtual MachineLearningWorkspaceCollection GetMachineLearningWorkspaces() + { + return GetCachedClient(client => new MachineLearningWorkspaceCollection(client, Id)); + } + + /// + /// Gets the properties of the specified machine learning workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// Name of Azure Machine Learning workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMachineLearningWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetMachineLearningWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of the specified machine learning workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// Name of Azure Machine Learning workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMachineLearningWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetMachineLearningWorkspaces().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningSubscriptionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningSubscriptionResource.cs new file mode 100644 index 0000000000000..4432d004b5087 --- /dev/null +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MockableMachineLearningSubscriptionResource.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.MachineLearning; +using Azure.ResourceManager.MachineLearning.Models; + +namespace Azure.ResourceManager.MachineLearning.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMachineLearningSubscriptionResource : ArmResource + { + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + private ClientDiagnostics _virtualMachineSizesClientDiagnostics; + private VirtualMachineSizesRestOperations _virtualMachineSizesRestClient; + private ClientDiagnostics _quotasClientDiagnostics; + private QuotasRestOperations _quotasRestClient; + private ClientDiagnostics _machineLearningRegistryRegistriesClientDiagnostics; + private RegistriesRestOperations _machineLearningRegistryRegistriesRestClient; + private ClientDiagnostics _machineLearningWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _machineLearningWorkspaceWorkspacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMachineLearningSubscriptionResource() + { + } + + /// 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 MockableMachineLearningSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics VirtualMachineSizesClientDiagnostics => _virtualMachineSizesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private VirtualMachineSizesRestOperations VirtualMachineSizesRestClient => _virtualMachineSizesRestClient ??= new VirtualMachineSizesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics QuotasClientDiagnostics => _quotasClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private QuotasRestOperations QuotasRestClient => _quotasRestClient ??= new QuotasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics MachineLearningRegistryRegistriesClientDiagnostics => _machineLearningRegistryRegistriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", MachineLearningRegistryResource.ResourceType.Namespace, Diagnostics); + private RegistriesRestOperations MachineLearningRegistryRegistriesRestClient => _machineLearningRegistryRegistriesRestClient ??= new RegistriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MachineLearningRegistryResource.ResourceType)); + private ClientDiagnostics MachineLearningWorkspaceWorkspacesClientDiagnostics => _machineLearningWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", MachineLearningWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations MachineLearningWorkspaceWorkspacesRestClient => _machineLearningWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MachineLearningWorkspaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the current usage information as well as limits for AML resources for given subscription and location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// The location for which resource usage is queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMachineLearningUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, MachineLearningUsage.DeserializeMachineLearningUsage, UsagesClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the current usage information as well as limits for AML resources for given subscription and location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// The location for which resource usage is queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMachineLearningUsages(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, MachineLearningUsage.DeserializeMachineLearningUsage, UsagesClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Returns supported VM Sizes in a location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes + /// + /// + /// Operation Id + /// VirtualMachineSizes_List + /// + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMachineLearningVmSizesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineSizesRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MachineLearningVmSize.DeserializeMachineLearningVmSize, VirtualMachineSizesClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningVmSizes", "value", null, cancellationToken); + } + + /// + /// Returns supported VM Sizes in a location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes + /// + /// + /// Operation Id + /// VirtualMachineSizes_List + /// + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMachineLearningVmSizes(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineSizesRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MachineLearningVmSize.DeserializeMachineLearningVmSize, VirtualMachineSizesClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningVmSizes", "value", null, cancellationToken); + } + + /// + /// Update quota for each VM family in workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas + /// + /// + /// Operation Id + /// Quotas_Update + /// + /// + /// + /// The location for update quota is queried. + /// Quota update parameters. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable UpdateMachineLearningQuotasAsync(AzureLocation location, MachineLearningQuotaUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => QuotasRestClient.CreateUpdateRequest(Id.SubscriptionId, location, content); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MachineLearningWorkspaceQuotaUpdate.DeserializeMachineLearningWorkspaceQuotaUpdate, QuotasClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.UpdateMachineLearningQuotas", "value", null, cancellationToken); + } + + /// + /// Update quota for each VM family in workspace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas + /// + /// + /// Operation Id + /// Quotas_Update + /// + /// + /// + /// The location for update quota is queried. + /// Quota update parameters. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable UpdateMachineLearningQuotas(AzureLocation location, MachineLearningQuotaUpdateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => QuotasRestClient.CreateUpdateRequest(Id.SubscriptionId, location, content); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MachineLearningWorkspaceQuotaUpdate.DeserializeMachineLearningWorkspaceQuotaUpdate, QuotasClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.UpdateMachineLearningQuotas", "value", null, cancellationToken); + } + + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas + /// + /// + /// Operation Id + /// Quotas_List + /// + /// + /// + /// The location for which resource usage is queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMachineLearningQuotasAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => QuotasRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotasRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, MachineLearningResourceQuota.DeserializeMachineLearningResourceQuota, QuotasClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningQuotas", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas + /// + /// + /// Operation Id + /// Quotas_List + /// + /// + /// + /// The location for which resource usage is queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMachineLearningQuotas(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => QuotasRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotasRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, MachineLearningResourceQuota.DeserializeMachineLearningResourceQuota, QuotasClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningQuotas", "value", "nextLink", cancellationToken); + } + + /// + /// List registries by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/registries + /// + /// + /// Operation Id + /// Registries_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMachineLearningRegistriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningRegistryRegistriesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MachineLearningRegistryRegistriesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MachineLearningRegistryResource(Client, MachineLearningRegistryData.DeserializeMachineLearningRegistryData(e)), MachineLearningRegistryRegistriesClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningRegistries", "value", "nextLink", cancellationToken); + } + + /// + /// List registries by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/registries + /// + /// + /// Operation Id + /// Registries_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMachineLearningRegistries(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningRegistryRegistriesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MachineLearningRegistryRegistriesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MachineLearningRegistryResource(Client, MachineLearningRegistryData.DeserializeMachineLearningRegistryData(e)), MachineLearningRegistryRegistriesClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningRegistries", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available machine learning workspaces under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// Continuation token for pagination. + /// Kind of workspace. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMachineLearningWorkspacesAsync(string skip = null, string kind = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skip, kind); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MachineLearningWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skip, kind); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MachineLearningWorkspaceResource(Client, MachineLearningWorkspaceData.DeserializeMachineLearningWorkspaceData(e)), MachineLearningWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available machine learning workspaces under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// Continuation token for pagination. + /// Kind of workspace. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMachineLearningWorkspaces(string skip = null, string kind = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skip, kind); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MachineLearningWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skip, kind); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MachineLearningWorkspaceResource(Client, MachineLearningWorkspaceData.DeserializeMachineLearningWorkspaceData(e)), MachineLearningWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableMachineLearningSubscriptionResource.GetMachineLearningWorkspaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ecfc3a6b3627b..0000000000000 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MachineLearning -{ - /// 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 MachineLearningRegistryResources in the ResourceGroupResource. - /// An object representing collection of MachineLearningRegistryResources and their operations over a MachineLearningRegistryResource. - public virtual MachineLearningRegistryCollection GetMachineLearningRegistries() - { - return GetCachedClient(Client => new MachineLearningRegistryCollection(Client, Id)); - } - - /// Gets a collection of MachineLearningWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of MachineLearningWorkspaceResources and their operations over a MachineLearningWorkspaceResource. - public virtual MachineLearningWorkspaceCollection GetMachineLearningWorkspaces() - { - return GetCachedClient(Client => new MachineLearningWorkspaceCollection(Client, Id)); - } - } -} diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index e01328541757a..0000000000000 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.MachineLearning.Models; - -namespace Azure.ResourceManager.MachineLearning -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - private ClientDiagnostics _virtualMachineSizesClientDiagnostics; - private VirtualMachineSizesRestOperations _virtualMachineSizesRestClient; - private ClientDiagnostics _quotasClientDiagnostics; - private QuotasRestOperations _quotasRestClient; - private ClientDiagnostics _machineLearningRegistryRegistriesClientDiagnostics; - private RegistriesRestOperations _machineLearningRegistryRegistriesRestClient; - private ClientDiagnostics _machineLearningWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _machineLearningWorkspaceWorkspacesRestClient; - - /// 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 UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics VirtualMachineSizesClientDiagnostics => _virtualMachineSizesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private VirtualMachineSizesRestOperations VirtualMachineSizesRestClient => _virtualMachineSizesRestClient ??= new VirtualMachineSizesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics QuotasClientDiagnostics => _quotasClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private QuotasRestOperations QuotasRestClient => _quotasRestClient ??= new QuotasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics MachineLearningRegistryRegistriesClientDiagnostics => _machineLearningRegistryRegistriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", MachineLearningRegistryResource.ResourceType.Namespace, Diagnostics); - private RegistriesRestOperations MachineLearningRegistryRegistriesRestClient => _machineLearningRegistryRegistriesRestClient ??= new RegistriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MachineLearningRegistryResource.ResourceType)); - private ClientDiagnostics MachineLearningWorkspaceWorkspacesClientDiagnostics => _machineLearningWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MachineLearning", MachineLearningWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations MachineLearningWorkspaceWorkspacesRestClient => _machineLearningWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MachineLearningWorkspaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the current usage information as well as limits for AML resources for given subscription and location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// The location for which resource usage is queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMachineLearningUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, MachineLearningUsage.DeserializeMachineLearningUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the current usage information as well as limits for AML resources for given subscription and location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// The location for which resource usage is queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMachineLearningUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, MachineLearningUsage.DeserializeMachineLearningUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Returns supported VM Sizes in a location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes - /// - /// - /// Operation Id - /// VirtualMachineSizes_List - /// - /// - /// - /// The location upon which virtual-machine-sizes is queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMachineLearningVmSizesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineSizesRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MachineLearningVmSize.DeserializeMachineLearningVmSize, VirtualMachineSizesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningVmSizes", "value", null, cancellationToken); - } - - /// - /// Returns supported VM Sizes in a location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes - /// - /// - /// Operation Id - /// VirtualMachineSizes_List - /// - /// - /// - /// The location upon which virtual-machine-sizes is queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMachineLearningVmSizes(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualMachineSizesRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MachineLearningVmSize.DeserializeMachineLearningVmSize, VirtualMachineSizesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningVmSizes", "value", null, cancellationToken); - } - - /// - /// Update quota for each VM family in workspace. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas - /// - /// - /// Operation Id - /// Quotas_Update - /// - /// - /// - /// The location for update quota is queried. - /// Quota update parameters. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable UpdateMachineLearningQuotasAsync(AzureLocation location, MachineLearningQuotaUpdateContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QuotasRestClient.CreateUpdateRequest(Id.SubscriptionId, location, content); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MachineLearningWorkspaceQuotaUpdate.DeserializeMachineLearningWorkspaceQuotaUpdate, QuotasClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.UpdateMachineLearningQuotas", "value", null, cancellationToken); - } - - /// - /// Update quota for each VM family in workspace. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas - /// - /// - /// Operation Id - /// Quotas_Update - /// - /// - /// - /// The location for update quota is queried. - /// Quota update parameters. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable UpdateMachineLearningQuotas(AzureLocation location, MachineLearningQuotaUpdateContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QuotasRestClient.CreateUpdateRequest(Id.SubscriptionId, location, content); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MachineLearningWorkspaceQuotaUpdate.DeserializeMachineLearningWorkspaceQuotaUpdate, QuotasClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.UpdateMachineLearningQuotas", "value", null, cancellationToken); - } - - /// - /// Gets the currently assigned Workspace Quotas based on VMFamily. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas - /// - /// - /// Operation Id - /// Quotas_List - /// - /// - /// - /// The location for which resource usage is queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMachineLearningQuotasAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QuotasRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotasRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, MachineLearningResourceQuota.DeserializeMachineLearningResourceQuota, QuotasClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningQuotas", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the currently assigned Workspace Quotas based on VMFamily. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas - /// - /// - /// Operation Id - /// Quotas_List - /// - /// - /// - /// The location for which resource usage is queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMachineLearningQuotas(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QuotasRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotasRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, MachineLearningResourceQuota.DeserializeMachineLearningResourceQuota, QuotasClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningQuotas", "value", "nextLink", cancellationToken); - } - - /// - /// List registries by subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/registries - /// - /// - /// Operation Id - /// Registries_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMachineLearningRegistriesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningRegistryRegistriesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MachineLearningRegistryRegistriesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MachineLearningRegistryResource(Client, MachineLearningRegistryData.DeserializeMachineLearningRegistryData(e)), MachineLearningRegistryRegistriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningRegistries", "value", "nextLink", cancellationToken); - } - - /// - /// List registries by subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/registries - /// - /// - /// Operation Id - /// Registries_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMachineLearningRegistries(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningRegistryRegistriesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MachineLearningRegistryRegistriesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MachineLearningRegistryResource(Client, MachineLearningRegistryData.DeserializeMachineLearningRegistryData(e)), MachineLearningRegistryRegistriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningRegistries", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the available machine learning workspaces under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// Continuation token for pagination. - /// Kind of workspace. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMachineLearningWorkspacesAsync(string skip = null, string kind = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skip, kind); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MachineLearningWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skip, kind); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MachineLearningWorkspaceResource(Client, MachineLearningWorkspaceData.DeserializeMachineLearningWorkspaceData(e)), MachineLearningWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the available machine learning workspaces under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// Continuation token for pagination. - /// Kind of workspace. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMachineLearningWorkspaces(string skip = null, string kind = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MachineLearningWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skip, kind); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MachineLearningWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skip, kind); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MachineLearningWorkspaceResource(Client, MachineLearningWorkspaceData.DeserializeMachineLearningWorkspaceData(e)), MachineLearningWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMachineLearningWorkspaces", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentContainerResource.cs index 02bdeb110e1a2..2c5e99201fc00 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearninRegistryComponentContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The componentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string componentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearninRegistryComponentVersionResources and their operations over a MachineLearninRegistryComponentVersionResource. public virtual MachineLearninRegistryComponentVersionCollection GetMachineLearninRegistryComponentVersions() { - return GetCachedClient(Client => new MachineLearninRegistryComponentVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearninRegistryComponentVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearninRegistryComponentVersionCollection GetMachineLearni /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearninRegistryComponentVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearninRegistryComponentVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentVersionResource.cs index c6376fbbddb54..ba4752669b787 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentVersionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearninRegistryComponentVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The componentName. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string componentName, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchDeploymentResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchDeploymentResource.cs index 81e15d9dea444..f98aef246feac 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchDeploymentResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchDeploymentResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningBatchDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The endpointName. + /// The deploymentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string endpointName, string deploymentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointResource.cs index 8f172f63be135..b9dd3b03d49cb 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningBatchEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The endpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string endpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningBatchDeploymentResources and their operations over a MachineLearningBatchDeploymentResource. public virtual MachineLearningBatchDeploymentCollection GetMachineLearningBatchDeployments() { - return GetCachedClient(Client => new MachineLearningBatchDeploymentCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningBatchDeploymentCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual MachineLearningBatchDeploymentCollection GetMachineLearningBatchD /// /// The identifier for the Batch deployments. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningBatchDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetM /// /// The identifier for the Batch deployments. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningBatchDeployment(string deploymentName, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerResource.cs index e6bb135fbd4a3..2355e12b7c6ff 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningCodeContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningCodeVersionResources and their operations over a MachineLearningCodeVersionResource. public virtual MachineLearningCodeVersionCollection GetMachineLearningCodeVersions() { - return GetCachedClient(Client => new MachineLearningCodeVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningCodeVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningCodeVersionCollection GetMachineLearningCodeVersio /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningCodeVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetMachi /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningCodeVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeVersionResource.cs index 7ba137c50f49f..630cb8bb7c59b 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeVersionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningCodeVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerResource.cs index bc4a355d92215..0c1bc49326269 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningComponentContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningComponentVersionResources and their operations over a MachineLearningComponentVersionResource. public virtual MachineLearningComponentVersionCollection GetMachineLearningComponentVersions() { - return GetCachedClient(Client => new MachineLearningComponentVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningComponentVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningComponentVersionCollection GetMachineLearningCompo /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningComponentVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> Get /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningComponentVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentVersionResource.cs index 1169e2baba8ef..c6bb0a507e8cc 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentVersionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningComponentVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComputeResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComputeResource.cs index befaf9255fa46..2a354c457e765 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComputeResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComputeResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningComputeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The computeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string computeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerResource.cs index ad3cbeb4ead53..c146ac81d5c9d 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningDataContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningDataVersionResources and their operations over a MachineLearningDataVersionResource. public virtual MachineLearningDataVersionCollection GetMachineLearningDataVersions() { - return GetCachedClient(Client => new MachineLearningDataVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningDataVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningDataVersionCollection GetMachineLearningDataVersio /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningDataVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetMachi /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningDataVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataVersionResource.cs index e2a94e95efc71..7f6ac905c6dab 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataVersionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningDataVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDatastoreResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDatastoreResource.cs index dba5e6b946d66..1cc20b70de380 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDatastoreResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDatastoreResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningDatastoreResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerResource.cs index 21abbbb167a2e..7b2fad4b1997b 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningEnvironmentContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningEnvironmentVersionResources and their operations over a MachineLearningEnvironmentVersionResource. public virtual MachineLearningEnvironmentVersionCollection GetMachineLearningEnvironmentVersions() { - return GetCachedClient(Client => new MachineLearningEnvironmentVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningEnvironmentVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningEnvironmentVersionCollection GetMachineLearningEnv /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningEnvironmentVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> G /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningEnvironmentVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentVersionResource.cs index a89af9543db03..9972714c49840 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentVersionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningEnvironmentVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureResource.cs index fd6ba6a0fdb00..cbf5e9748123e 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningFeatureResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The featuresetName. + /// The featuresetVersion. + /// The featureName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string featuresetName, string featuresetVersion, string featureName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{featuresetName}/versions/{featuresetVersion}/features/{featureName}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetContainerResource.cs index 9139d5d81af28..37c096745d9ec 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningFeatureSetContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningFeatureSetVersionResources and their operations over a MachineLearningFeatureSetVersionResource. public virtual MachineLearningFeatureSetVersionCollection GetMachineLearningFeatureSetVersions() { - return GetCachedClient(Client => new MachineLearningFeatureSetVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningFeatureSetVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningFeatureSetVersionCollection GetMachineLearningFeat /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningFeatureSetVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> Ge /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningFeatureSetVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetVersionResource.cs index cb1865ffa9e0b..65e2e78bdc075 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetVersionResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningFeatureSetVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/versions/{version}"; @@ -92,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningFeatureResources and their operations over a MachineLearningFeatureResource. public virtual MachineLearningFeatureCollection GetMachineLearningFeatures() { - return GetCachedClient(Client => new MachineLearningFeatureCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningFeatureCollection(client, Id)); } /// @@ -110,8 +115,8 @@ public virtual MachineLearningFeatureCollection GetMachineLearningFeatures() /// /// Feature Name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningFeatureAsync(string featureName, CancellationToken cancellationToken = default) { @@ -133,8 +138,8 @@ public virtual async Task> GetMachineLe /// /// Feature Name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningFeature(string featureName, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureStoreEntityContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureStoreEntityContainerResource.cs index 2154c19f6b43c..aff5528be5548 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureStoreEntityContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureStoreEntityContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningFeatureStoreEntityContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningFeaturestoreEntityVersionResources and their operations over a MachineLearningFeaturestoreEntityVersionResource. public virtual MachineLearningFeaturestoreEntityVersionCollection GetMachineLearningFeaturestoreEntityVersions() { - return GetCachedClient(Client => new MachineLearningFeaturestoreEntityVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningFeaturestoreEntityVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningFeaturestoreEntityVersionCollection GetMachineLear /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningFeaturestoreEntityVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningFeaturestoreEntityVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeaturestoreEntityVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeaturestoreEntityVersionResource.cs index 059836b76ed61..3f634cc70b35b 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeaturestoreEntityVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeaturestoreEntityVersionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningFeaturestoreEntityVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningJobResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningJobResource.cs index 2c47c8bcf674e..a8b24806fc06f 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningJobResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningJobResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string id) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningLabelingJobResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningLabelingJobResource.cs index 3523fd491aa31..3fa14950b64fc 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningLabelingJobResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningLabelingJobResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningLabelingJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string id) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerResource.cs index a9a9c60468bff..91564276134a2 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningModelContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningModelVersionResources and their operations over a MachineLearningModelVersionResource. public virtual MachineLearningModelVersionCollection GetMachineLearningModelVersions() { - return GetCachedClient(Client => new MachineLearningModelVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningModelVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningModelVersionCollection GetMachineLearningModelVers /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningModelVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetMach /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningModelVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelVersionResource.cs index ea8ad9ecda332..d90539f9ce332 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelVersionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningModelVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineDeploymentResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineDeploymentResource.cs index 8c748ea311245..ca8539979467d 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineDeploymentResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineDeploymentResource.cs @@ -28,6 +28,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningOnlineDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The endpointName. + /// The deploymentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string endpointName, string deploymentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointResource.cs index 175fc1d9e8354..c65c0c334a370 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningOnlineEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The endpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string endpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningOnlineDeploymentResources and their operations over a MachineLearningOnlineDeploymentResource. public virtual MachineLearningOnlineDeploymentCollection GetMachineLearningOnlineDeployments() { - return GetCachedClient(Client => new MachineLearningOnlineDeploymentCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningOnlineDeploymentCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual MachineLearningOnlineDeploymentCollection GetMachineLearningOnlin /// /// Inference Endpoint Deployment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningOnlineDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> Get /// /// Inference Endpoint Deployment name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningOnlineDeployment(string deploymentName, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOutboundRuleBasicResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOutboundRuleBasicResource.cs index fa2ebf1c47295..b9bd4ff7f0644 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOutboundRuleBasicResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOutboundRuleBasicResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningOutboundRuleBasicResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningPrivateEndpointConnectionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningPrivateEndpointConnectionResource.cs index 1cc0de9fd54a9..1c0cbc69a3233 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningPrivateEndpointConnectionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeContainerResource.cs index df389f08a833a..d640502250ef2 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryCodeContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The codeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string codeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningRegistryCodeVersionResources and their operations over a MachineLearningRegistryCodeVersionResource. public virtual MachineLearningRegistryCodeVersionCollection GetMachineLearningRegistryCodeVersions() { - return GetCachedClient(Client => new MachineLearningRegistryCodeVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningRegistryCodeVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningRegistryCodeVersionCollection GetMachineLearningRe /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningRegistryCodeVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningRegistryCodeVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeVersionResource.cs index a15ea6f35ae2c..930131d25d138 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeVersionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryCodeVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The codeName. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string codeName, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataContainerResource.cs index 1c0de50b118e7..6d3c92cdacce4 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryDataContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningRegistryDataVersionResources and their operations over a MachineLearningRegistryDataVersionResource. public virtual MachineLearningRegistryDataVersionCollection GetMachineLearningRegistryDataVersions() { - return GetCachedClient(Client => new MachineLearningRegistryDataVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningRegistryDataVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningRegistryDataVersionCollection GetMachineLearningRe /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningRegistryDataVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> /// /// Version identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningRegistryDataVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataVersionResource.cs index df1bdeab1abde..457ca20799f71 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataVersionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryDataVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The name. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string name, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentContainerResource.cs index d8d26cf9f4919..29b197dc11af5 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryEnvironmentContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The environmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string environmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningRegistryEnvironmentVersionResources and their operations over a MachineLearningRegistryEnvironmentVersionResource. public virtual MachineLearningRegistryEnvironmentVersionCollection GetMachineLearningRegistryEnvironmentVersions() { - return GetCachedClient(Client => new MachineLearningRegistryEnvironmentVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningRegistryEnvironmentVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningRegistryEnvironmentVersionCollection GetMachineLea /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningRegistryEnvironmentVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningRegistryEnvironmentVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentVersionResource.cs index 70ba7ca91e415..0663b00045dee 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentVersionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryEnvironmentVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The environmentName. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string environmentName, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelContainerResource.cs index abf169fd56a67..c01fb9d78b26c 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelContainerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryModelContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The modelName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string modelName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningRegistryModelVersionResources and their operations over a MachineLearningRegistryModelVersionResource. public virtual MachineLearningRegistryModelVersionCollection GetMachineLearningRegistryModelVersions() { - return GetCachedClient(Client => new MachineLearningRegistryModelVersionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningRegistryModelVersionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MachineLearningRegistryModelVersionCollection GetMachineLearningR /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningRegistryModelVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> /// /// Version identifier. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningRegistryModelVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelVersionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelVersionResource.cs index 388c0e1eb1544..ddc2efa92b15e 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelVersionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryModelVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. + /// The modelName. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName, string modelName, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryResource.cs index be4f72d7662ee..96531d016659b 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningRegistryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The registryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string registryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningRegistryCodeContainerResources and their operations over a MachineLearningRegistryCodeContainerResource. public virtual MachineLearningRegistryCodeContainerCollection GetMachineLearningRegistryCodeContainers() { - return GetCachedClient(Client => new MachineLearningRegistryCodeContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningRegistryCodeContainerCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual MachineLearningRegistryCodeContainerCollection GetMachineLearning /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningRegistryCodeContainerAsync(string codeName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningRegistryCodeContainer(string codeName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetMachine /// An object representing collection of MachineLearninRegistryComponentContainerResources and their operations over a MachineLearninRegistryComponentContainerResource. public virtual MachineLearninRegistryComponentContainerCollection GetMachineLearninRegistryComponentContainers() { - return GetCachedClient(Client => new MachineLearninRegistryComponentContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearninRegistryComponentContainerCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual MachineLearninRegistryComponentContainerCollection GetMachineLear /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearninRegistryComponentContainerAsync(string componentName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearninRegistryComponentContainer(string componentName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetMac /// An object representing collection of MachineLearningRegistryDataContainerResources and their operations over a MachineLearningRegistryDataContainerResource. public virtual MachineLearningRegistryDataContainerCollection GetMachineLearningRegistryDataContainers() { - return GetCachedClient(Client => new MachineLearningRegistryDataContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningRegistryDataContainerCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual MachineLearningRegistryDataContainerCollection GetMachineLearning /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningRegistryDataContainerAsync(string name, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningRegistryDataContainer(string name, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetMachine /// An object representing collection of MachineLearningRegistryEnvironmentContainerResources and their operations over a MachineLearningRegistryEnvironmentContainerResource. public virtual MachineLearningRegistryEnvironmentContainerCollection GetMachineLearningRegistryEnvironmentContainers() { - return GetCachedClient(Client => new MachineLearningRegistryEnvironmentContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningRegistryEnvironmentContainerCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual MachineLearningRegistryEnvironmentContainerCollection GetMachineL /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningRegistryEnvironmentContainerAsync(string environmentName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningRegistryEnvironmentContainer(string environmentName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response Get /// An object representing collection of MachineLearningRegistryModelContainerResources and their operations over a MachineLearningRegistryModelContainerResource. public virtual MachineLearningRegistryModelContainerCollection GetMachineLearningRegistryModelContainers() { - return GetCachedClient(Client => new MachineLearningRegistryModelContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningRegistryModelContainerCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual MachineLearningRegistryModelContainerCollection GetMachineLearnin /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningRegistryModelContainerAsync(string modelName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningRegistryModelContainer(string modelName, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningScheduleResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningScheduleResource.cs index 7ba5e30237487..ab257011aae74 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningScheduleResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningScheduleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceConnectionResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceConnectionResource.cs index f9127200809ee..f76062539909f 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceConnectionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningWorkspaceConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}"; diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceResource.cs index e67a157de249c..43ff67c0c6e38 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.MachineLearning public partial class MachineLearningWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}"; @@ -106,7 +109,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MachineLearningComputeResources and their operations over a MachineLearningComputeResource. public virtual MachineLearningComputeCollection GetMachineLearningComputes() { - return GetCachedClient(Client => new MachineLearningComputeCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningComputeCollection(client, Id)); } /// @@ -124,8 +127,8 @@ public virtual MachineLearningComputeCollection GetMachineLearningComputes() /// /// Name of the Azure Machine Learning compute. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningComputeAsync(string computeName, CancellationToken cancellationToken = default) { @@ -147,8 +150,8 @@ public virtual async Task> GetMachineLe /// /// Name of the Azure Machine Learning compute. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningCompute(string computeName, CancellationToken cancellationToken = default) { @@ -159,7 +162,7 @@ public virtual Response GetMachineLearningComput /// An object representing collection of MachineLearningCodeContainerResources and their operations over a MachineLearningCodeContainerResource. public virtual MachineLearningCodeContainerCollection GetMachineLearningCodeContainers() { - return GetCachedClient(Client => new MachineLearningCodeContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningCodeContainerCollection(client, Id)); } /// @@ -177,8 +180,8 @@ public virtual MachineLearningCodeContainerCollection GetMachineLearningCodeCont /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningCodeContainerAsync(string name, CancellationToken cancellationToken = default) { @@ -200,8 +203,8 @@ public virtual async Task> GetMac /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningCodeContainer(string name, CancellationToken cancellationToken = default) { @@ -212,7 +215,7 @@ public virtual Response GetMachineLearning /// An object representing collection of MachineLearningComponentContainerResources and their operations over a MachineLearningComponentContainerResource. public virtual MachineLearningComponentContainerCollection GetMachineLearningComponentContainers() { - return GetCachedClient(Client => new MachineLearningComponentContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningComponentContainerCollection(client, Id)); } /// @@ -230,8 +233,8 @@ public virtual MachineLearningComponentContainerCollection GetMachineLearningCom /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningComponentContainerAsync(string name, CancellationToken cancellationToken = default) { @@ -253,8 +256,8 @@ public virtual async Task> G /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningComponentContainer(string name, CancellationToken cancellationToken = default) { @@ -265,7 +268,7 @@ public virtual Response GetMachineLea /// An object representing collection of MachineLearningDataContainerResources and their operations over a MachineLearningDataContainerResource. public virtual MachineLearningDataContainerCollection GetMachineLearningDataContainers() { - return GetCachedClient(Client => new MachineLearningDataContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningDataContainerCollection(client, Id)); } /// @@ -283,8 +286,8 @@ public virtual MachineLearningDataContainerCollection GetMachineLearningDataCont /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningDataContainerAsync(string name, CancellationToken cancellationToken = default) { @@ -306,8 +309,8 @@ public virtual async Task> GetMac /// /// Container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningDataContainer(string name, CancellationToken cancellationToken = default) { @@ -318,7 +321,7 @@ public virtual Response GetMachineLearning /// An object representing collection of MachineLearningEnvironmentContainerResources and their operations over a MachineLearningEnvironmentContainerResource. public virtual MachineLearningEnvironmentContainerCollection GetMachineLearningEnvironmentContainers() { - return GetCachedClient(Client => new MachineLearningEnvironmentContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningEnvironmentContainerCollection(client, Id)); } /// @@ -336,8 +339,8 @@ public virtual MachineLearningEnvironmentContainerCollection GetMachineLearningE /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningEnvironmentContainerAsync(string name, CancellationToken cancellationToken = default) { @@ -359,8 +362,8 @@ public virtual async Task> /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningEnvironmentContainer(string name, CancellationToken cancellationToken = default) { @@ -371,7 +374,7 @@ public virtual Response GetMachineL /// An object representing collection of MachineLearningModelContainerResources and their operations over a MachineLearningModelContainerResource. public virtual MachineLearningModelContainerCollection GetMachineLearningModelContainers() { - return GetCachedClient(Client => new MachineLearningModelContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningModelContainerCollection(client, Id)); } /// @@ -389,8 +392,8 @@ public virtual MachineLearningModelContainerCollection GetMachineLearningModelCo /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningModelContainerAsync(string name, CancellationToken cancellationToken = default) { @@ -412,8 +415,8 @@ public virtual async Task> GetMa /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningModelContainer(string name, CancellationToken cancellationToken = default) { @@ -424,7 +427,7 @@ public virtual Response GetMachineLearnin /// An object representing collection of MachineLearningBatchEndpointResources and their operations over a MachineLearningBatchEndpointResource. public virtual MachineLearningBatchEndpointCollection GetMachineLearningBatchEndpoints() { - return GetCachedClient(Client => new MachineLearningBatchEndpointCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningBatchEndpointCollection(client, Id)); } /// @@ -442,8 +445,8 @@ public virtual MachineLearningBatchEndpointCollection GetMachineLearningBatchEnd /// /// Name for the Batch Endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningBatchEndpointAsync(string endpointName, CancellationToken cancellationToken = default) { @@ -465,8 +468,8 @@ public virtual async Task> GetMac /// /// Name for the Batch Endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningBatchEndpoint(string endpointName, CancellationToken cancellationToken = default) { @@ -477,7 +480,7 @@ public virtual Response GetMachineLearning /// An object representing collection of MachineLearningDatastoreResources and their operations over a MachineLearningDatastoreResource. public virtual MachineLearningDatastoreCollection GetMachineLearningDatastores() { - return GetCachedClient(Client => new MachineLearningDatastoreCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningDatastoreCollection(client, Id)); } /// @@ -495,8 +498,8 @@ public virtual MachineLearningDatastoreCollection GetMachineLearningDatastores() /// /// Datastore name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningDatastoreAsync(string name, CancellationToken cancellationToken = default) { @@ -518,8 +521,8 @@ public virtual async Task> GetMachine /// /// Datastore name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningDatastore(string name, CancellationToken cancellationToken = default) { @@ -530,7 +533,7 @@ public virtual Response GetMachineLearningData /// An object representing collection of MachineLearningFeatureSetContainerResources and their operations over a MachineLearningFeatureSetContainerResource. public virtual MachineLearningFeatureSetContainerCollection GetMachineLearningFeatureSetContainers() { - return GetCachedClient(Client => new MachineLearningFeatureSetContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningFeatureSetContainerCollection(client, Id)); } /// @@ -548,8 +551,8 @@ public virtual MachineLearningFeatureSetContainerCollection GetMachineLearningFe /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningFeatureSetContainerAsync(string name, CancellationToken cancellationToken = default) { @@ -571,8 +574,8 @@ public virtual async Task> /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningFeatureSetContainer(string name, CancellationToken cancellationToken = default) { @@ -583,7 +586,7 @@ public virtual Response GetMachineLe /// An object representing collection of MachineLearningFeatureStoreEntityContainerResources and their operations over a MachineLearningFeatureStoreEntityContainerResource. public virtual MachineLearningFeatureStoreEntityContainerCollection GetMachineLearningFeatureStoreEntityContainers() { - return GetCachedClient(Client => new MachineLearningFeatureStoreEntityContainerCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningFeatureStoreEntityContainerCollection(client, Id)); } /// @@ -601,8 +604,8 @@ public virtual MachineLearningFeatureStoreEntityContainerCollection GetMachineLe /// /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningFeatureStoreEntityContainerAsync(string name, CancellationToken cancellationToken = default) { @@ -624,8 +627,8 @@ public virtual async Task /// Container name. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningFeatureStoreEntityContainer(string name, CancellationToken cancellationToken = default) { @@ -636,7 +639,7 @@ public virtual Response GetM /// An object representing collection of MachineLearningJobResources and their operations over a MachineLearningJobResource. public virtual MachineLearningJobCollection GetMachineLearningJobs() { - return GetCachedClient(Client => new MachineLearningJobCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningJobCollection(client, Id)); } /// @@ -654,8 +657,8 @@ public virtual MachineLearningJobCollection GetMachineLearningJobs() /// /// The name and identifier for the Job. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningJobAsync(string id, CancellationToken cancellationToken = default) { @@ -677,8 +680,8 @@ public virtual async Task> GetMachineLearni /// /// The name and identifier for the Job. This is case-sensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningJob(string id, CancellationToken cancellationToken = default) { @@ -689,7 +692,7 @@ public virtual Response GetMachineLearningJob(string /// An object representing collection of MachineLearningLabelingJobResources and their operations over a MachineLearningLabelingJobResource. public virtual MachineLearningLabelingJobCollection GetMachineLearningLabelingJobs() { - return GetCachedClient(Client => new MachineLearningLabelingJobCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningLabelingJobCollection(client, Id)); } /// @@ -709,8 +712,8 @@ public virtual MachineLearningLabelingJobCollection GetMachineLearningLabelingJo /// Boolean value to indicate whether to include JobInstructions in response. /// Boolean value to indicate Whether to include LabelCategories in response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningLabelingJobAsync(string id, bool? includeJobInstructions = null, bool? includeLabelCategories = null, CancellationToken cancellationToken = default) { @@ -734,8 +737,8 @@ public virtual async Task> GetMachi /// Boolean value to indicate whether to include JobInstructions in response. /// Boolean value to indicate Whether to include LabelCategories in response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningLabelingJob(string id, bool? includeJobInstructions = null, bool? includeLabelCategories = null, CancellationToken cancellationToken = default) { @@ -746,7 +749,7 @@ public virtual Response GetMachineLearningLa /// An object representing collection of MachineLearningOnlineEndpointResources and their operations over a MachineLearningOnlineEndpointResource. public virtual MachineLearningOnlineEndpointCollection GetMachineLearningOnlineEndpoints() { - return GetCachedClient(Client => new MachineLearningOnlineEndpointCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningOnlineEndpointCollection(client, Id)); } /// @@ -764,8 +767,8 @@ public virtual MachineLearningOnlineEndpointCollection GetMachineLearningOnlineE /// /// Online Endpoint name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningOnlineEndpointAsync(string endpointName, CancellationToken cancellationToken = default) { @@ -787,8 +790,8 @@ public virtual async Task> GetMa /// /// Online Endpoint name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningOnlineEndpoint(string endpointName, CancellationToken cancellationToken = default) { @@ -799,7 +802,7 @@ public virtual Response GetMachineLearnin /// An object representing collection of MachineLearningScheduleResources and their operations over a MachineLearningScheduleResource. public virtual MachineLearningScheduleCollection GetMachineLearningSchedules() { - return GetCachedClient(Client => new MachineLearningScheduleCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningScheduleCollection(client, Id)); } /// @@ -817,8 +820,8 @@ public virtual MachineLearningScheduleCollection GetMachineLearningSchedules() /// /// Schedule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningScheduleAsync(string name, CancellationToken cancellationToken = default) { @@ -840,8 +843,8 @@ public virtual async Task> GetMachineL /// /// Schedule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningSchedule(string name, CancellationToken cancellationToken = default) { @@ -852,7 +855,7 @@ public virtual Response GetMachineLearningSched /// An object representing collection of MachineLearningWorkspaceConnectionResources and their operations over a MachineLearningWorkspaceConnectionResource. public virtual MachineLearningWorkspaceConnectionCollection GetMachineLearningWorkspaceConnections() { - return GetCachedClient(Client => new MachineLearningWorkspaceConnectionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningWorkspaceConnectionCollection(client, Id)); } /// @@ -870,8 +873,8 @@ public virtual MachineLearningWorkspaceConnectionCollection GetMachineLearningWo /// /// Friendly name of the workspace connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningWorkspaceConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -893,8 +896,8 @@ public virtual async Task> /// /// Friendly name of the workspace connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningWorkspaceConnection(string connectionName, CancellationToken cancellationToken = default) { @@ -905,7 +908,7 @@ public virtual Response GetMachineLe /// An object representing collection of MachineLearningOutboundRuleBasicResources and their operations over a MachineLearningOutboundRuleBasicResource. public virtual MachineLearningOutboundRuleBasicCollection GetMachineLearningOutboundRuleBasics() { - return GetCachedClient(Client => new MachineLearningOutboundRuleBasicCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningOutboundRuleBasicCollection(client, Id)); } /// @@ -923,8 +926,8 @@ public virtual MachineLearningOutboundRuleBasicCollection GetMachineLearningOutb /// /// Name of the workspace managed network outbound rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningOutboundRuleBasicAsync(string ruleName, CancellationToken cancellationToken = default) { @@ -946,8 +949,8 @@ public virtual async Task> Ge /// /// Name of the workspace managed network outbound rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningOutboundRuleBasic(string ruleName, CancellationToken cancellationToken = default) { @@ -958,7 +961,7 @@ public virtual Response GetMachineLear /// An object representing collection of MachineLearningPrivateEndpointConnectionResources and their operations over a MachineLearningPrivateEndpointConnectionResource. public virtual MachineLearningPrivateEndpointConnectionCollection GetMachineLearningPrivateEndpointConnections() { - return GetCachedClient(Client => new MachineLearningPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new MachineLearningPrivateEndpointConnectionCollection(client, Id)); } /// @@ -976,8 +979,8 @@ public virtual MachineLearningPrivateEndpointConnectionCollection GetMachineLear /// /// NRP Private Endpoint Connection Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMachineLearningPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -999,8 +1002,8 @@ public virtual async Task /// NRP Private Endpoint Connection Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMachineLearningPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/tests/Azure.ResourceManager.MachineLearning.Tests.csproj b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/tests/Azure.ResourceManager.MachineLearning.Tests.csproj index 19e0d82d83811..542dc721d8429 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/tests/Azure.ResourceManager.MachineLearning.Tests.csproj +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/tests/Azure.ResourceManager.MachineLearning.Tests.csproj @@ -1,12 +1,12 @@  - - - + + + diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/CHANGELOG.md b/sdk/maintenance/Azure.ResourceManager.Maintenance/CHANGELOG.md index bcf3dd4e2258f..ef51d27198948 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/CHANGELOG.md +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.2.0-beta.5 (Unreleased) +## 1.2.0-beta.6 (Unreleased) ### Features Added @@ -10,6 +10,12 @@ ### Other Changes +## 1.2.0-beta.5 (2023-10-31) + +### Features Added + +- Upgraded api-version tag from 'package-2023-04' to 'package-preview-2023-09'. Tag detail available at https://github.com/Azure/azure-rest-api-specs/blob/13aec7f115c01ba6986ebf32488537392c0df6f5/specification/maintenance/resource-manager/readme.md + ## 1.2.0-beta.4 (2023-09-15) - Fix the string format of `StartOn` and `ExpireOn` in `MaintenanceConfigurationData` serialization. diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/api/Azure.ResourceManager.Maintenance.netstandard2.0.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/api/Azure.ResourceManager.Maintenance.netstandard2.0.cs index a8dee94ba2d48..2b53b3341ad80 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/api/Azure.ResourceManager.Maintenance.netstandard2.0.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/api/Azure.ResourceManager.Maintenance.netstandard2.0.cs @@ -3,6 +3,8 @@ namespace Azure.ResourceManager.Maintenance public partial class MaintenanceApplyUpdateCollection : Azure.ResourceManager.ArmCollection { protected MaintenanceApplyUpdateCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string providerName, string resourceType, string resourceName, string applyUpdateName, Azure.ResourceManager.Maintenance.MaintenanceApplyUpdateData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string providerName, string resourceType, string resourceName, string applyUpdateName, Azure.ResourceManager.Maintenance.MaintenanceApplyUpdateData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Exists(string providerName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> ExistsAsync(string providerName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(string providerName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -26,6 +28,8 @@ protected MaintenanceApplyUpdateResource() { } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string applyUpdateName) { 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Maintenance.MaintenanceApplyUpdateData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Maintenance.MaintenanceApplyUpdateData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MaintenanceConfigurationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -46,7 +50,7 @@ protected MaintenanceConfigurationCollection() { } } public partial class MaintenanceConfigurationData : Azure.ResourceManager.Models.TrackedResourceData { - public MaintenanceConfigurationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MaintenanceConfigurationData(Azure.Core.AzureLocation location) { } public System.TimeSpan? Duration { get { throw null; } set { } } public System.DateTimeOffset? ExpireOn { get { throw null; } set { } } public System.Collections.Generic.IDictionary ExtensionProperties { get { throw null; } } @@ -175,6 +179,89 @@ protected MaintenancePublicConfigurationResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Maintenance.Mocking +{ + public partial class MockableMaintenanceArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMaintenanceArmClient() { } + public virtual Azure.ResourceManager.Maintenance.MaintenanceApplyUpdateResource GetMaintenanceApplyUpdateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Maintenance.MaintenanceConfigurationResource GetMaintenanceConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Maintenance.MaintenancePublicConfigurationResource GetMaintenancePublicConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMaintenanceResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMaintenanceResourceGroupResource() { } + public virtual Azure.Response CreateOrUpdateApplyUpdate(string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateApplyUpdateAsync(string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateApplyUpdateByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateApplyUpdateByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateConfigurationAssignmentByParent(Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateConfigurationAssignmentByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateConfigurationAssignmentByParentAsync(Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateConfigurationAssignmentByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateOrUpdateConfigurationAssignmentByResourceGroup(string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteConfigurationAssignmentByParent(Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteConfigurationAssignmentByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteConfigurationAssignmentByParentAsync(Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteConfigurationAssignmentByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteConfigurationAssignmentByResourceGroup(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetApplyUpdatesByParent(Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceGetApplyUpdatesByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetApplyUpdatesByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApplyUpdatesByParentAsync(Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceGetApplyUpdatesByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApplyUpdatesByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetConfigurationAssignmentByParent(Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceGetConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfigurationAssignmentByParentAsync(Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceGetConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetConfigurationAssignmentByResourceGroup(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConfigurationAssignments(string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfigurationAssignmentsAsync(string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConfigurationAssignmentsByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfigurationAssignmentsByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetMaintenanceApplyUpdate(string providerName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMaintenanceApplyUpdateAsync(string providerName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Maintenance.MaintenanceApplyUpdateCollection GetMaintenanceApplyUpdates() { throw null; } + public virtual Azure.Pageable GetMaintenanceApplyUpdates(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMaintenanceApplyUpdatesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetMaintenanceConfiguration(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMaintenanceConfigurationAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Maintenance.MaintenanceConfigurationCollection GetMaintenanceConfigurations() { throw null; } + public virtual Azure.Pageable GetUpdates(string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUpdatesAsync(string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUpdatesByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUpdatesByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateConfigurationAssignmentByResourceGroup(string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableMaintenanceSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMaintenanceSubscriptionResource() { } + public virtual Azure.Response CreateOrUpdateConfigurationAssignmentBySubscription(string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteConfigurationAssignmentBySubscription(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetConfigurationAssignmentBySubscription(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetConfigurationAssignmentsBySubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetConfigurationAssignmentsBySubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMaintenanceApplyUpdates(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMaintenanceApplyUpdatesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMaintenanceConfigurations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMaintenanceConfigurationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetMaintenancePublicConfiguration(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMaintenancePublicConfigurationAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Maintenance.MaintenancePublicConfigurationCollection GetMaintenancePublicConfigurations() { throw null; } + public virtual Azure.Response UpdateConfigurationAssignmentBySubscription(string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Maintenance.Models { public static partial class ArmMaintenanceModelFactory @@ -311,8 +398,11 @@ internal MaintenanceUpdate() { } private readonly object _dummy; private readonly int _dummyPrimitive; public MaintenanceUpdateStatus(string value) { throw null; } + public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus Cancel { get { throw null; } } + public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus Cancelled { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus Completed { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus InProgress { get { throw null; } } + public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus NoUpdatesPending { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus Pending { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus RetryLater { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus RetryNow { get { throw null; } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/assets.json b/sdk/maintenance/Azure.ResourceManager.Maintenance/assets.json index ee11f58f3b95f..98df5f84f8d43 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/assets.json +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/maintenance/Azure.ResourceManager.Maintenance", - "Tag": "net/maintenance/Azure.ResourceManager.Maintenance_9d26c2d4d2" + "Tag": "net/maintenance/Azure.ResourceManager.Maintenance_2f8ca92d8c" } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateCollection.cs index c87dd776f0727..5805924dc2d12 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateCollection.cs @@ -12,6 +12,7 @@ using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.Maintenance; +using Azure.ResourceManager.Maintenance.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Maintenance.Samples @@ -23,7 +24,7 @@ public partial class Sample_MaintenanceApplyUpdateCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApplyUpdatesGet() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_Get.json // this example is just showing the usage of "ApplyUpdates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +61,7 @@ public async Task Get_ApplyUpdatesGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ApplyUpdatesGet() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_Get.json // this example is just showing the usage of "ApplyUpdates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +94,7 @@ public async Task Exists_ApplyUpdatesGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ApplyUpdatesGet() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_Get.json // this example is just showing the usage of "ApplyUpdates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -132,5 +133,86 @@ public async Task GetIfExists_ApplyUpdatesGet() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } } + + // ApplyUpdates_CreateOrUpdateOnly_NoCancellation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApplyUpdatesCreateOrUpdateOnlyNoCancellation() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_CreateOrUpdateOnly_NoCancellation.json + // this example is just showing the usage of "ApplyUpdates_CreateOrUpdateOrCancel" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MaintenanceApplyUpdateResource + MaintenanceApplyUpdateCollection collection = resourceGroupResource.GetMaintenanceApplyUpdates(); + + // invoke the operation + string providerName = "Microsoft.Compute"; + string resourceType = "virtualMachineScaleSets"; + string resourceName = "smdtest1"; + string applyUpdateName = "20230901121200"; + MaintenanceApplyUpdateData data = new MaintenanceApplyUpdateData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, providerName, resourceType, resourceName, applyUpdateName, data); + MaintenanceApplyUpdateResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MaintenanceApplyUpdateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApplyUpdates_CreateOrUpdateOrCancel + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApplyUpdatesCreateOrUpdateOrCancel() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_CreateOrUpdate_CancelMaintenance.json + // this example is just showing the usage of "ApplyUpdates_CreateOrUpdateOrCancel" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + string resourceGroupName = "examplerg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this MaintenanceApplyUpdateResource + MaintenanceApplyUpdateCollection collection = resourceGroupResource.GetMaintenanceApplyUpdates(); + + // invoke the operation + string providerName = "Microsoft.Maintenance"; + string resourceType = "maintenanceConfigurations"; + string resourceName = "maintenanceConfig1"; + string applyUpdateName = "20230901121200"; + MaintenanceApplyUpdateData data = new MaintenanceApplyUpdateData() + { + Status = MaintenanceUpdateStatus.Cancel, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, providerName, resourceType, resourceName, applyUpdateName, data); + MaintenanceApplyUpdateResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MaintenanceApplyUpdateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateResource.cs index d6dfe5853bf67..905b1fa50cd60 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateResource.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceApplyUpdateResource.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Identity; using Azure.ResourceManager; @@ -23,7 +24,7 @@ public partial class Sample_MaintenanceApplyUpdateResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetApplyUpdatesByParent_ApplyUpdatesGetParent() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_GetParent.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_GetParent.json // this example is just showing the usage of "ApplyUpdates_GetParent" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +55,7 @@ public async Task GetApplyUpdatesByParent_ApplyUpdatesGetParent() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ApplyUpdatesGet() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_Get.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_Get.json // this example is just showing the usage of "ApplyUpdates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -83,12 +84,87 @@ public async Task Get_ApplyUpdatesGet() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + // ApplyUpdates_CreateOrUpdateOnly_NoCancellation + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApplyUpdatesCreateOrUpdateOnlyNoCancellation() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_CreateOrUpdateOnly_NoCancellation.json + // this example is just showing the usage of "ApplyUpdates_CreateOrUpdateOrCancel" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MaintenanceApplyUpdateResource created on azure + // for more information of creating MaintenanceApplyUpdateResource, please refer to the document of MaintenanceApplyUpdateResource + string subscriptionId = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + string resourceGroupName = "examplerg"; + string providerName = "Microsoft.Compute"; + string resourceType = "virtualMachineScaleSets"; + string resourceName = "smdtest1"; + string applyUpdateName = "20230901121200"; + ResourceIdentifier maintenanceApplyUpdateResourceId = MaintenanceApplyUpdateResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, providerName, resourceType, resourceName, applyUpdateName); + MaintenanceApplyUpdateResource maintenanceApplyUpdate = client.GetMaintenanceApplyUpdateResource(maintenanceApplyUpdateResourceId); + + // invoke the operation + MaintenanceApplyUpdateData data = new MaintenanceApplyUpdateData(); + ArmOperation lro = await maintenanceApplyUpdate.UpdateAsync(WaitUntil.Completed, data); + MaintenanceApplyUpdateResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MaintenanceApplyUpdateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ApplyUpdates_CreateOrUpdateOrCancel + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApplyUpdatesCreateOrUpdateOrCancel() + { + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_CreateOrUpdate_CancelMaintenance.json + // this example is just showing the usage of "ApplyUpdates_CreateOrUpdateOrCancel" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MaintenanceApplyUpdateResource created on azure + // for more information of creating MaintenanceApplyUpdateResource, please refer to the document of MaintenanceApplyUpdateResource + string subscriptionId = "5b4b650e-28b9-4790-b3ab-ddbd88d727c4"; + string resourceGroupName = "examplerg"; + string providerName = "Microsoft.Maintenance"; + string resourceType = "maintenanceConfigurations"; + string resourceName = "maintenanceConfig1"; + string applyUpdateName = "20230901121200"; + ResourceIdentifier maintenanceApplyUpdateResourceId = MaintenanceApplyUpdateResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, providerName, resourceType, resourceName, applyUpdateName); + MaintenanceApplyUpdateResource maintenanceApplyUpdate = client.GetMaintenanceApplyUpdateResource(maintenanceApplyUpdateResourceId); + + // invoke the operation + MaintenanceApplyUpdateData data = new MaintenanceApplyUpdateData() + { + Status = MaintenanceUpdateStatus.Cancel, + }; + ArmOperation lro = await maintenanceApplyUpdate.UpdateAsync(WaitUntil.Completed, data); + MaintenanceApplyUpdateResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MaintenanceApplyUpdateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // ApplyUpdates_CreateOrUpdateParent [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateApplyUpdateByParent_ApplyUpdatesCreateOrUpdateParent() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdateParent.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_CreateOrUpdateParent.json // this example is just showing the usage of "ApplyUpdates_CreateOrUpdateParent" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -123,7 +199,7 @@ public async Task CreateOrUpdateApplyUpdateByParent_ApplyUpdatesCreateOrUpdatePa [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateApplyUpdate_ApplyUpdatesCreateOrUpdate() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_CreateOrUpdate.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_CreateOrUpdate.json // this example is just showing the usage of "ApplyUpdates_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -156,7 +232,7 @@ public async Task CreateOrUpdateApplyUpdate_ApplyUpdatesCreateOrUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetMaintenanceApplyUpdates_ApplyUpdatesList() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdates_List.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdates_List.json // this example is just showing the usage of "ApplyUpdates_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationCollection.cs index dc8cecace5e71..e9992d9e5d75c 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationCollection.cs @@ -24,7 +24,7 @@ public partial class Sample_MaintenanceConfigurationCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_MaintenanceConfigurationsGetForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +58,7 @@ public async Task Get_MaintenanceConfigurationsGetForResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_MaintenanceConfigurationsGetForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task Exists_MaintenanceConfigurationsGetForResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_MaintenanceConfigurationsGetForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -130,7 +130,7 @@ public async Task GetIfExists_MaintenanceConfigurationsGetForResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_MaintenanceConfigurationsGetForResourceGuestOSPatchLinux() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -164,7 +164,7 @@ public async Task Get_MaintenanceConfigurationsGetForResourceGuestOSPatchLinux() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_MaintenanceConfigurationsGetForResourceGuestOSPatchLinux() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -194,7 +194,7 @@ public async Task Exists_MaintenanceConfigurationsGetForResourceGuestOSPatchLinu [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_MaintenanceConfigurationsGetForResourceGuestOSPatchLinux() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -236,7 +236,7 @@ public async Task GetIfExists_MaintenanceConfigurationsGetForResourceGuestOSPatc [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_MaintenanceConfigurationsGetForResourceGuestOSPatchWindows() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -270,7 +270,7 @@ public async Task Get_MaintenanceConfigurationsGetForResourceGuestOSPatchWindows [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_MaintenanceConfigurationsGetForResourceGuestOSPatchWindows() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -300,7 +300,7 @@ public async Task Exists_MaintenanceConfigurationsGetForResourceGuestOSPatchWind [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_MaintenanceConfigurationsGetForResourceGuestOSPatchWindows() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -342,7 +342,7 @@ public async Task GetIfExists_MaintenanceConfigurationsGetForResourceGuestOSPatc [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_MaintenanceConfigurationsCreateOrUpdateForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_CreateOrUpdateForResource.json // this example is just showing the usage of "MaintenanceConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -388,7 +388,7 @@ public async Task CreateOrUpdate_MaintenanceConfigurationsCreateOrUpdateForResou [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_MaintenanceConfigurationsResourceGroupList() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurationsResourceGroup_List.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurationsResourceGroup_List.json // this example is just showing the usage of "MaintenanceConfigurationsForResourceGroup_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationResource.cs index b5a529c481b31..04242ebcd1728 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationResource.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenanceConfigurationResource.cs @@ -24,7 +24,7 @@ public partial class Sample_MaintenanceConfigurationResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_MaintenanceConfigurationsGetForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Get_MaintenanceConfigurationsGetForResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_MaintenanceConfigurationsGetForResourceGuestOSPatchLinux() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,7 +86,7 @@ public async Task Get_MaintenanceConfigurationsGetForResourceGuestOSPatchLinux() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_MaintenanceConfigurationsGetForResourceGuestOSPatchWindows() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows.json // this example is just showing the usage of "MaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -117,7 +117,7 @@ public async Task Get_MaintenanceConfigurationsGetForResourceGuestOSPatchWindows [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_MaintenanceConfigurationsDeleteForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_DeleteForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_DeleteForResource.json // this example is just showing the usage of "MaintenanceConfigurations_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -144,7 +144,7 @@ public async Task Delete_MaintenanceConfigurationsDeleteForResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_MaintenanceConfigurationsUpdateForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_UpdateForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_UpdateForResource.json // this example is just showing the usage of "MaintenanceConfigurations_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -186,7 +186,7 @@ public async Task Update_MaintenanceConfigurationsUpdateForResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetMaintenanceConfigurations_MaintenanceConfigurationsList() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/MaintenanceConfigurations_List.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/MaintenanceConfigurations_List.json // this example is just showing the usage of "MaintenanceConfigurations_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationCollection.cs index 626979eba1978..c32be08c63c87 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_MaintenancePublicConfigurationCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_PublicMaintenanceConfigurationsList() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_List.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/PublicMaintenanceConfigurations_List.json // this example is just showing the usage of "PublicMaintenanceConfigurations_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +58,7 @@ public async Task GetAll_PublicMaintenanceConfigurationsList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_PublicMaintenanceConfigurationsGetForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/PublicMaintenanceConfigurations_GetForResource.json // this example is just showing the usage of "PublicMaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_PublicMaintenanceConfigurationsGetForResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_PublicMaintenanceConfigurationsGetForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/PublicMaintenanceConfigurations_GetForResource.json // this example is just showing the usage of "PublicMaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -120,7 +120,7 @@ public async Task Exists_PublicMaintenanceConfigurationsGetForResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_PublicMaintenanceConfigurationsGetForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/PublicMaintenanceConfigurations_GetForResource.json // this example is just showing the usage of "PublicMaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationResource.cs index 00f58bc10435c..e749ac8a8fa9a 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationResource.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_MaintenancePublicConfigurationResource.cs @@ -21,7 +21,7 @@ public partial class Sample_MaintenancePublicConfigurationResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_PublicMaintenanceConfigurationsGetForResource() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/PublicMaintenanceConfigurations_GetForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/PublicMaintenanceConfigurations_GetForResource.json // this example is just showing the usage of "PublicMaintenanceConfigurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs index 908558de02eb4..cbb83deffb707 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_ResourceGroupResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfigurationAssignmentByParent_ConfigurationAssignmentsGetParent() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_GetParent.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignments_GetParent.json // this example is just showing the usage of "ConfigurationAssignments_GetParent" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task GetConfigurationAssignmentByParent_ConfigurationAssignmentsGet [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateConfigurationAssignmentByParent_ConfigurationAssignmentsCreateOrUpdateParent() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdateParent.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignments_CreateOrUpdateParent.json // this example is just showing the usage of "ConfigurationAssignments_CreateOrUpdateParent" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -81,7 +81,7 @@ public async Task CreateOrUpdateConfigurationAssignmentByParent_ConfigurationAss [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteConfigurationAssignmentByParent_ConfigurationAssignmentsDeleteParent() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_DeleteParent.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignments_DeleteParent.json // this example is just showing the usage of "ConfigurationAssignments_DeleteParent" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -108,7 +108,7 @@ public async Task DeleteConfigurationAssignmentByParent_ConfigurationAssignments [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfigurationAssignment_ConfigurationAssignmentsGet() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Get.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignments_Get.json // this example is just showing the usage of "ConfigurationAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -138,7 +138,7 @@ public async Task GetConfigurationAssignment_ConfigurationAssignmentsGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateConfigurationAssignment_ConfigurationAssignmentsCreateOrUpdate() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_CreateOrUpdate.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignments_CreateOrUpdate.json // this example is just showing the usage of "ConfigurationAssignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -172,7 +172,7 @@ public async Task CreateOrUpdateConfigurationAssignment_ConfigurationAssignments [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteConfigurationAssignment_ConfigurationAssignmentsDelete() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_Delete.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignments_Delete.json // this example is just showing the usage of "ConfigurationAssignments_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -202,7 +202,7 @@ public async Task DeleteConfigurationAssignment_ConfigurationAssignmentsDelete() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfigurationAssignmentsByParent_ConfigurationAssignmentsListParent() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_ListParent.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignments_ListParent.json // this example is just showing the usage of "ConfigurationAssignments_ListParent" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -236,7 +236,7 @@ public async Task GetConfigurationAssignmentsByParent_ConfigurationAssignmentsLi [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfigurationAssignments_ConfigurationAssignmentsList() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignments_List.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignments_List.json // this example is just showing the usage of "ConfigurationAssignments_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -268,7 +268,7 @@ public async Task GetConfigurationAssignments_ConfigurationAssignmentsList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetMaintenanceApplyUpdates_ApplyUpdatesResourceGroupList() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ApplyUpdatesResourceGroup_List.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ApplyUpdatesResourceGroup_List.json // this example is just showing the usage of "ApplyUpdateForResourceGroup_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -301,7 +301,7 @@ public async Task GetMaintenanceApplyUpdates_ApplyUpdatesResourceGroupList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfigurationAssignmentByResourceGroup_ConfigurationAssignmentsForResourceGroupGet() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Get.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsForResourceGroup_Get.json // this example is just showing the usage of "ConfigurationAssignmentsForResourceGroup_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -328,7 +328,7 @@ public async Task GetConfigurationAssignmentByResourceGroup_ConfigurationAssignm [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateConfigurationAssignmentByResourceGroup_ConfigurationAssignmentsForResourceGroupCreateOrUpdate() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_CreateOrUpdate.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsForResourceGroup_CreateOrUpdate.json // this example is just showing the usage of "ConfigurationAssignmentsForResourceGroup_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -385,7 +385,7 @@ public async Task CreateOrUpdateConfigurationAssignmentByResourceGroup_Configura [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task UpdateConfigurationAssignmentByResourceGroup_ConfigurationAssignmentsForResourceGroupCreateOrUpdate() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_UpdateForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsForResourceGroup_UpdateForResource.json // this example is just showing the usage of "ConfigurationAssignmentsForResourceGroup_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -442,7 +442,7 @@ public async Task UpdateConfigurationAssignmentByResourceGroup_ConfigurationAssi [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteConfigurationAssignmentByResourceGroup_ConfigurationAssignmentsForResourceGroupDelete() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForResourceGroup_Delete.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsForResourceGroup_Delete.json // this example is just showing the usage of "ConfigurationAssignmentsForResourceGroup_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -469,7 +469,7 @@ public async Task DeleteConfigurationAssignmentByResourceGroup_ConfigurationAssi [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetUpdatesByParent_UpdatesListParent() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_ListParent.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/Updates_ListParent.json // this example is just showing the usage of "Updates_ListParent" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -503,7 +503,7 @@ public async Task GetUpdatesByParent_UpdatesListParent() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetUpdates_UpdatesList() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/Updates_List.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/Updates_List.json // this example is just showing the usage of "Updates_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 9909af44a6250..19807a95cd862 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_SubscriptionResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfigurationAssignmentsBySubscription_ConfigurationAssignmentsResultWithinSubscriptionList() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsResultWithinSubscription_List.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsResultWithinSubscription_List.json // this example is just showing the usage of "ConfigurationAssignmentsWithinSubscription_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task GetConfigurationAssignmentsBySubscription_ConfigurationAssignm [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfigurationAssignmentBySubscription_ConfigurationAssignmentsGetParent() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Get.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsForSubscriptions_Get.json // this example is just showing the usage of "ConfigurationAssignmentsForSubscriptions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -77,7 +77,7 @@ public async Task GetConfigurationAssignmentBySubscription_ConfigurationAssignme [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateConfigurationAssignmentBySubscription_ConfigurationAssignmentsForSubscriptionsCreateOrUpdate() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_CreateOrUpdate.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsForSubscriptions_CreateOrUpdate.json // this example is just showing the usage of "ConfigurationAssignmentsForSubscriptions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -137,7 +137,7 @@ public async Task CreateOrUpdateConfigurationAssignmentBySubscription_Configurat [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task UpdateConfigurationAssignmentBySubscription_ConfigurationAssignmentsForSubscriptionsCreateOrUpdate() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_UpdateForResource.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsForSubscriptions_UpdateForResource.json // this example is just showing the usage of "ConfigurationAssignmentsForSubscriptions_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -197,7 +197,7 @@ public async Task UpdateConfigurationAssignmentBySubscription_ConfigurationAssig [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteConfigurationAssignmentBySubscription_ConfigurationAssignmentsForSubscriptionsDelete() { - // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/stable/2023-04-01/examples/ConfigurationAssignmentsForSubscriptions_Delete.json + // Generated from example definition: specification/maintenance/resource-manager/Microsoft.Maintenance/preview/2023-09-01-preview/examples/ConfigurationAssignmentsForSubscriptions_Delete.json // this example is just showing the usage of "ConfigurationAssignmentsForSubscriptions_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Azure.ResourceManager.Maintenance.csproj b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Azure.ResourceManager.Maintenance.csproj index 2ec4d181b9074..750a59e7b0f92 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Azure.ResourceManager.Maintenance.csproj +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Azure.ResourceManager.Maintenance.csproj @@ -1,6 +1,6 @@ - 1.2.0-beta.5 + 1.2.0-beta.6 1.1.2 Azure.ResourceManager.Maintenance diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MaintenanceExtensions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MaintenanceExtensions.cs index a7662fa882c32..182a144850da5 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MaintenanceExtensions.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MaintenanceExtensions.cs @@ -1,14 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#nullable disable + using System; -using System.Collections.Generic; -using System.Text; -using Azure.ResourceManager.Resources; -using System.Threading.Tasks; using System.Threading; -using Azure.Core; +using System.Threading.Tasks; using Azure.ResourceManager.Maintenance.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Maintenance { @@ -39,16 +38,7 @@ public static partial class MaintenanceExtensions /// , , , , or is null. public static async Task> GetApplyUpdatesByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); - - ResourceGroupResourceGetApplyUpdatesByParentOptions options = new ResourceGroupResourceGetApplyUpdatesByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, applyUpdateName); - - return await resourceGroupResource.GetApplyUpdatesByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetApplyUpdatesByParentAsync(providerName, resourceParentType, resourceParentType, resourceType, resourceName, applyUpdateName, cancellationToken).ConfigureAwait(false); } /// @@ -76,16 +66,7 @@ public static async Task> GetApplyUpdat /// , , , , or is null. public static Response GetApplyUpdatesByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); - - ResourceGroupResourceGetApplyUpdatesByParentOptions options = new ResourceGroupResourceGetApplyUpdatesByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, applyUpdateName); - - return resourceGroupResource.GetApplyUpdatesByParent(options, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetApplyUpdatesByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, applyUpdateName, cancellationToken); } /// @@ -114,17 +95,7 @@ public static Response GetApplyUpdatesByParent(t /// , , , , , or is null. public static async Task> CreateOrUpdateConfigurationAssignmentByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options = new ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data); - - return await resourceGroupResource.CreateOrUpdateConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); } /// @@ -153,17 +124,7 @@ public static async Task> Creat /// , , , , , or is null. public static Response CreateOrUpdateConfigurationAssignmentByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options = new ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data); - - return resourceGroupResource.CreateOrUpdateConfigurationAssignmentByParent(options, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); } /// @@ -191,16 +152,7 @@ public static Response CreateOrUpdateCon /// , , , , or is null. public static async Task> DeleteConfigurationAssignmentByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options = new ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName); - - return await resourceGroupResource.DeleteConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).DeleteConfigurationAssignmentByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -228,16 +180,7 @@ public static async Task> Delet /// , , , , or is null. public static Response DeleteConfigurationAssignmentByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options = new ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName); - - return resourceGroupResource.DeleteConfigurationAssignmentByParent(options, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).DeleteConfigurationAssignmentByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, cancellationToken); } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MockableMaintenanceResourceGroupResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MockableMaintenanceResourceGroupResource.cs new file mode 100644 index 0000000000000..192236472395c --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MockableMaintenanceResourceGroupResource.cs @@ -0,0 +1,236 @@ +// 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.Core; +using Azure.ResourceManager.Maintenance.Models; + +namespace Azure.ResourceManager.Maintenance.Mocking +{ + public partial class MockableMaintenanceResourceGroupResource : ArmResource + { + /// + /// Track maintenance updates to resource with parent + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_GetParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// applyUpdate Id. + /// The cancellation token to use. + /// , , , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + public virtual async Task> GetApplyUpdatesByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); + + ResourceGroupResourceGetApplyUpdatesByParentOptions options = new ResourceGroupResourceGetApplyUpdatesByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, applyUpdateName); + + return await GetApplyUpdatesByParentAsync(options, cancellationToken).ConfigureAwait(false); + } + + /// + /// Track maintenance updates to resource with parent + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_GetParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// applyUpdate Id. + /// The cancellation token to use. + /// , , , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + public virtual Response GetApplyUpdatesByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); + + ResourceGroupResourceGetApplyUpdatesByParentOptions options = new ResourceGroupResourceGetApplyUpdatesByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, applyUpdateName); + + return GetApplyUpdatesByParent(options, cancellationToken); + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdateParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , , , or is an empty string, and was expected to be non-empty. + /// , , , , , or is null. + public virtual async Task> CreateOrUpdateConfigurationAssignmentByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options = new ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data); + + return await CreateOrUpdateConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdateParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , , , or is an empty string, and was expected to be non-empty. + /// , , , , , or is null. + public virtual Response CreateOrUpdateConfigurationAssignmentByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options = new ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data); + + return CreateOrUpdateConfigurationAssignmentByParent(options, cancellationToken); + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_DeleteParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// , , , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + public virtual async Task> DeleteConfigurationAssignmentByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options = new ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName); + + return await DeleteConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_DeleteParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// , , , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + public virtual Response DeleteConfigurationAssignmentByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options = new ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName); + + return DeleteConfigurationAssignmentByParent(options, cancellationToken); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs index 12644938a10a6..dc1e61b50199a 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Maintenance.Mocking; using Azure.ResourceManager.Maintenance.Models; using Azure.ResourceManager.Resources; @@ -19,100 +20,81 @@ namespace Azure.ResourceManager.Maintenance /// A class to add extension methods to Azure.ResourceManager.Maintenance. public static partial class MaintenanceExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMaintenanceArmClient GetMockableMaintenanceArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMaintenanceArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMaintenanceResourceGroupResource GetMockableMaintenanceResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMaintenanceResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMaintenanceSubscriptionResource GetMockableMaintenanceSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMaintenanceSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region MaintenancePublicConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MaintenancePublicConfigurationResource GetMaintenancePublicConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MaintenancePublicConfigurationResource.ValidateResourceId(id); - return new MaintenancePublicConfigurationResource(client, id); - } - ); + return GetMockableMaintenanceArmClient(client).GetMaintenancePublicConfigurationResource(id); } - #endregion - #region MaintenanceConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MaintenanceConfigurationResource GetMaintenanceConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MaintenanceConfigurationResource.ValidateResourceId(id); - return new MaintenanceConfigurationResource(client, id); - } - ); + return GetMockableMaintenanceArmClient(client).GetMaintenanceConfigurationResource(id); } - #endregion - #region MaintenanceApplyUpdateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MaintenanceApplyUpdateResource GetMaintenanceApplyUpdateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MaintenanceApplyUpdateResource.ValidateResourceId(id); - return new MaintenanceApplyUpdateResource(client, id); - } - ); + return GetMockableMaintenanceArmClient(client).GetMaintenanceApplyUpdateResource(id); } - #endregion - /// Gets a collection of MaintenanceConfigurationResources in the ResourceGroupResource. + /// + /// Gets a collection of MaintenanceConfigurationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MaintenanceConfigurationResources and their operations over a MaintenanceConfigurationResource. public static MaintenanceConfigurationCollection GetMaintenanceConfigurations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMaintenanceConfigurations(); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetMaintenanceConfigurations(); } /// @@ -127,16 +109,20 @@ public static MaintenanceConfigurationCollection GetMaintenanceConfigurations(th /// MaintenanceConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maintenance Configuration Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMaintenanceConfigurationAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMaintenanceConfigurations().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetMaintenanceConfigurationAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -151,24 +137,34 @@ public static async Task> GetMaintena /// MaintenanceConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maintenance Configuration Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMaintenanceConfiguration(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMaintenanceConfigurations().Get(resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetMaintenanceConfiguration(resourceName, cancellationToken); } - /// Gets a collection of MaintenanceApplyUpdateResources in the ResourceGroupResource. + /// + /// Gets a collection of MaintenanceApplyUpdateResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MaintenanceApplyUpdateResources and their operations over a MaintenanceApplyUpdateResource. public static MaintenanceApplyUpdateCollection GetMaintenanceApplyUpdates(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMaintenanceApplyUpdates(); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetMaintenanceApplyUpdates(); } /// @@ -183,6 +179,10 @@ public static MaintenanceApplyUpdateCollection GetMaintenanceApplyUpdates(this R /// ApplyUpdates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -190,12 +190,12 @@ public static MaintenanceApplyUpdateCollection GetMaintenanceApplyUpdates(this R /// Resource identifier. /// applyUpdate Id. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMaintenanceApplyUpdateAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMaintenanceApplyUpdates().GetAsync(providerName, resourceType, resourceName, applyUpdateName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetMaintenanceApplyUpdateAsync(providerName, resourceType, resourceName, applyUpdateName, cancellationToken).ConfigureAwait(false); } /// @@ -210,6 +210,10 @@ public static async Task> GetMaintenanc /// ApplyUpdates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -217,12 +221,12 @@ public static async Task> GetMaintenanc /// Resource identifier. /// applyUpdate Id. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMaintenanceApplyUpdate(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMaintenanceApplyUpdates().Get(providerName, resourceType, resourceName, applyUpdateName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetMaintenanceApplyUpdate(providerName, resourceType, resourceName, applyUpdateName, cancellationToken); } /// @@ -237,6 +241,10 @@ public static Response GetMaintenanceApplyUpdate /// ApplyUpdates_GetParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -244,9 +252,7 @@ public static Response GetMaintenanceApplyUpdate /// is null. public static async Task> GetApplyUpdatesByParentAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplyUpdatesByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetApplyUpdatesByParentAsync(options, cancellationToken).ConfigureAwait(false); } /// @@ -261,6 +267,10 @@ public static async Task> GetApplyUpdat /// ApplyUpdates_GetParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -268,9 +278,7 @@ public static async Task> GetApplyUpdat /// is null. public static Response GetApplyUpdatesByParent(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplyUpdatesByParent(options, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetApplyUpdatesByParent(options, cancellationToken); } /// @@ -285,6 +293,10 @@ public static Response GetApplyUpdatesByParent(t /// ApplyUpdates_CreateOrUpdateParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -297,13 +309,7 @@ public static Response GetApplyUpdatesByParent(t /// , , , or is null. public static async Task> CreateOrUpdateApplyUpdateByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateApplyUpdateByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -318,6 +324,10 @@ public static async Task> CreateOrUpdat /// ApplyUpdates_CreateOrUpdateParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -330,13 +340,7 @@ public static async Task> CreateOrUpdat /// , , , or is null. public static Response CreateOrUpdateApplyUpdateByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateApplyUpdateByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); } /// @@ -351,6 +355,10 @@ public static Response CreateOrUpdateApplyUpdate /// ApplyUpdates_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -361,11 +369,7 @@ public static Response CreateOrUpdateApplyUpdate /// , or is null. public static async Task> CreateOrUpdateApplyUpdateAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateAsync(providerName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateApplyUpdateAsync(providerName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -380,6 +384,10 @@ public static async Task> CreateOrUpdat /// ApplyUpdates_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -390,11 +398,7 @@ public static async Task> CreateOrUpdat /// , or is null. public static Response CreateOrUpdateApplyUpdate(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdate(providerName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateApplyUpdate(providerName, resourceType, resourceName, cancellationToken); } /// @@ -409,6 +413,10 @@ public static Response CreateOrUpdateApplyUpdate /// ConfigurationAssignments_GetParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -416,9 +424,7 @@ public static Response CreateOrUpdateApplyUpdate /// is null. public static async Task> GetConfigurationAssignmentByParentAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); } /// @@ -433,6 +439,10 @@ public static async Task> GetCo /// ConfigurationAssignments_GetParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -440,9 +450,7 @@ public static async Task> GetCo /// is null. public static Response GetConfigurationAssignmentByParent(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentByParent(options, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignmentByParent(options, cancellationToken); } /// @@ -457,6 +465,10 @@ public static Response GetConfigurationA /// ConfigurationAssignments_CreateOrUpdateParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -464,9 +476,7 @@ public static Response GetConfigurationA /// is null. public static async Task> CreateOrUpdateConfigurationAssignmentByParentAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); } /// @@ -481,6 +491,10 @@ public static async Task> Creat /// ConfigurationAssignments_CreateOrUpdateParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -488,9 +502,7 @@ public static async Task> Creat /// is null. public static Response CreateOrUpdateConfigurationAssignmentByParent(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByParent(options, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByParent(options, cancellationToken); } /// @@ -505,6 +517,10 @@ public static Response CreateOrUpdateCon /// ConfigurationAssignments_DeleteParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -512,9 +528,7 @@ public static Response CreateOrUpdateCon /// is null. public static async Task> DeleteConfigurationAssignmentByParentAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).DeleteConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); } /// @@ -529,6 +543,10 @@ public static async Task> Delet /// ConfigurationAssignments_DeleteParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -536,9 +554,7 @@ public static async Task> Delet /// is null. public static Response DeleteConfigurationAssignmentByParent(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentByParent(options, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).DeleteConfigurationAssignmentByParent(options, cancellationToken); } /// @@ -553,6 +569,10 @@ public static Response DeleteConfigurati /// ConfigurationAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -564,12 +584,7 @@ public static Response DeleteConfigurati /// , , or is null. public static async Task> GetConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -584,6 +599,10 @@ public static async Task> GetCo /// ConfigurationAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -595,12 +614,7 @@ public static async Task> GetCo /// , , or is null. public static Response GetConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); } /// @@ -615,6 +629,10 @@ public static Response GetConfigurationA /// ConfigurationAssignments_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -627,13 +645,7 @@ public static Response GetConfigurationA /// , , , or is null. public static async Task> CreateOrUpdateConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); } /// @@ -648,6 +660,10 @@ public static async Task> Creat /// ConfigurationAssignments_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -660,13 +676,7 @@ public static async Task> Creat /// , , , or is null. public static Response CreateOrUpdateConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); } /// @@ -681,6 +691,10 @@ public static Response CreateOrUpdateCon /// ConfigurationAssignments_Delete /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -692,12 +706,7 @@ public static Response CreateOrUpdateCon /// , , or is null. public static async Task> DeleteConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).DeleteConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -712,6 +721,10 @@ public static async Task> Delet /// ConfigurationAssignments_Delete /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -723,12 +736,7 @@ public static async Task> Delet /// , , or is null. public static Response DeleteConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).DeleteConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); } /// @@ -743,6 +751,10 @@ public static Response DeleteConfigurati /// ConfigurationAssignments_ListParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -756,13 +768,7 @@ public static Response DeleteConfigurati /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetConfigurationAssignmentsByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentsByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignmentsByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); } /// @@ -777,6 +783,10 @@ public static AsyncPageable GetConfigura /// ConfigurationAssignments_ListParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -790,13 +800,7 @@ public static AsyncPageable GetConfigura /// A collection of that may take multiple service requests to iterate over. public static Pageable GetConfigurationAssignmentsByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentsByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignmentsByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); } /// @@ -811,6 +815,10 @@ public static Pageable GetConfigurationA /// ConfigurationAssignments_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -822,11 +830,7 @@ public static Pageable GetConfigurationA /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetConfigurationAssignmentsAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentsAsync(providerName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignmentsAsync(providerName, resourceType, resourceName, cancellationToken); } /// @@ -841,6 +845,10 @@ public static AsyncPageable GetConfigura /// ConfigurationAssignments_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -852,11 +860,7 @@ public static AsyncPageable GetConfigura /// A collection of that may take multiple service requests to iterate over. public static Pageable GetConfigurationAssignments(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignments(providerName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignments(providerName, resourceType, resourceName, cancellationToken); } /// @@ -871,13 +875,17 @@ public static Pageable GetConfigurationA /// ApplyUpdateForResourceGroup_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMaintenanceApplyUpdatesAsync(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMaintenanceApplyUpdatesAsync(cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetMaintenanceApplyUpdatesAsync(cancellationToken); } /// @@ -892,13 +900,17 @@ public static AsyncPageable GetMaintenanceApplyU /// ApplyUpdateForResourceGroup_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMaintenanceApplyUpdates(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMaintenanceApplyUpdates(cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetMaintenanceApplyUpdates(cancellationToken); } /// @@ -913,6 +925,10 @@ public static Pageable GetMaintenanceApplyUpdate /// ConfigurationAssignmentsForResourceGroup_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -921,9 +937,7 @@ public static Pageable GetMaintenanceApplyUpdate /// is null. public static async Task> GetConfigurationAssignmentByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentByResourceGroupAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignmentByResourceGroupAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -938,6 +952,10 @@ public static async Task> GetCo /// ConfigurationAssignmentsForResourceGroup_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -946,9 +964,7 @@ public static async Task> GetCo /// is null. public static Response GetConfigurationAssignmentByResourceGroup(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentByResourceGroup(configurationAssignmentName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetConfigurationAssignmentByResourceGroup(configurationAssignmentName, cancellationToken); } /// @@ -963,6 +979,10 @@ public static Response GetConfigurationA /// ConfigurationAssignmentsForResourceGroup_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -972,10 +992,7 @@ public static Response GetConfigurationA /// or is null. public static async Task> CreateOrUpdateConfigurationAssignmentByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByResourceGroupAsync(configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByResourceGroupAsync(configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); } /// @@ -990,6 +1007,10 @@ public static async Task> Creat /// ConfigurationAssignmentsForResourceGroup_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -999,10 +1020,7 @@ public static async Task> Creat /// or is null. public static Response CreateOrUpdateConfigurationAssignmentByResourceGroup(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByResourceGroup(configurationAssignmentName, data, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByResourceGroup(configurationAssignmentName, data, cancellationToken); } /// @@ -1017,6 +1035,10 @@ public static Response CreateOrUpdateCon /// ConfigurationAssignmentsForResourceGroup_Update /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -1026,10 +1048,7 @@ public static Response CreateOrUpdateCon /// or is null. public static async Task> UpdateConfigurationAssignmentByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).UpdateConfigurationAssignmentByResourceGroupAsync(configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).UpdateConfigurationAssignmentByResourceGroupAsync(configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); } /// @@ -1044,6 +1063,10 @@ public static async Task> Updat /// ConfigurationAssignmentsForResourceGroup_Update /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -1053,10 +1076,7 @@ public static async Task> Updat /// or is null. public static Response UpdateConfigurationAssignmentByResourceGroup(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).UpdateConfigurationAssignmentByResourceGroup(configurationAssignmentName, data, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).UpdateConfigurationAssignmentByResourceGroup(configurationAssignmentName, data, cancellationToken); } /// @@ -1071,6 +1091,10 @@ public static Response UpdateConfigurati /// ConfigurationAssignmentsForResourceGroup_Delete /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Unique configuration assignment name. @@ -1079,9 +1103,7 @@ public static Response UpdateConfigurati /// is null. public static async Task> DeleteConfigurationAssignmentByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentByResourceGroupAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceResourceGroupResource(resourceGroupResource).DeleteConfigurationAssignmentByResourceGroupAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -1096,6 +1118,10 @@ public static async Task> Delet /// ConfigurationAssignmentsForResourceGroup_Delete /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Unique configuration assignment name. @@ -1104,9 +1130,7 @@ public static async Task> Delet /// is null. public static Response DeleteConfigurationAssignmentByResourceGroup(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentByResourceGroup(configurationAssignmentName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).DeleteConfigurationAssignmentByResourceGroup(configurationAssignmentName, cancellationToken); } /// @@ -1121,6 +1145,10 @@ public static Response DeleteConfigurati /// Updates_ListParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -1134,13 +1162,7 @@ public static Response DeleteConfigurati /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUpdatesByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetUpdatesByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetUpdatesByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); } /// @@ -1155,6 +1177,10 @@ public static AsyncPageable GetUpdatesByParentAsync(this Reso /// Updates_ListParent /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -1168,13 +1194,7 @@ public static AsyncPageable GetUpdatesByParentAsync(this Reso /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUpdatesByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetUpdatesByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetUpdatesByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); } /// @@ -1189,6 +1209,10 @@ public static Pageable GetUpdatesByParent(this ResourceGroupR /// Updates_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -1200,11 +1224,7 @@ public static Pageable GetUpdatesByParent(this ResourceGroupR /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUpdatesAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetUpdatesAsync(providerName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetUpdatesAsync(providerName, resourceType, resourceName, cancellationToken); } /// @@ -1219,6 +1239,10 @@ public static AsyncPageable GetUpdatesAsync(this ResourceGrou /// Updates_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Resource provider name. @@ -1230,19 +1254,21 @@ public static AsyncPageable GetUpdatesAsync(this ResourceGrou /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUpdates(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetUpdates(providerName, resourceType, resourceName, cancellationToken); + return GetMockableMaintenanceResourceGroupResource(resourceGroupResource).GetUpdates(providerName, resourceType, resourceName, cancellationToken); } - /// Gets a collection of MaintenancePublicConfigurationResources in the SubscriptionResource. + /// + /// Gets a collection of MaintenancePublicConfigurationResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MaintenancePublicConfigurationResources and their operations over a MaintenancePublicConfigurationResource. public static MaintenancePublicConfigurationCollection GetMaintenancePublicConfigurations(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMaintenancePublicConfigurations(); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetMaintenancePublicConfigurations(); } /// @@ -1257,16 +1283,20 @@ public static MaintenancePublicConfigurationCollection GetMaintenancePublicConfi /// PublicMaintenanceConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maintenance Configuration Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMaintenancePublicConfigurationAsync(this SubscriptionResource subscriptionResource, string resourceName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetMaintenancePublicConfigurations().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetMaintenancePublicConfigurationAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -1281,16 +1311,20 @@ public static async Task> GetMa /// PublicMaintenanceConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Maintenance Configuration Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMaintenancePublicConfiguration(this SubscriptionResource subscriptionResource, string resourceName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetMaintenancePublicConfigurations().Get(resourceName, cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetMaintenancePublicConfiguration(resourceName, cancellationToken); } /// @@ -1305,13 +1339,17 @@ public static Response GetMaintenancePub /// ApplyUpdates_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMaintenanceApplyUpdatesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMaintenanceApplyUpdatesAsync(cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetMaintenanceApplyUpdatesAsync(cancellationToken); } /// @@ -1326,13 +1364,17 @@ public static AsyncPageable GetMaintenanceApplyU /// ApplyUpdates_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMaintenanceApplyUpdates(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMaintenanceApplyUpdates(cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetMaintenanceApplyUpdates(cancellationToken); } /// @@ -1347,13 +1389,17 @@ public static Pageable GetMaintenanceApplyUpdate /// MaintenanceConfigurations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMaintenanceConfigurationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMaintenanceConfigurationsAsync(cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetMaintenanceConfigurationsAsync(cancellationToken); } /// @@ -1368,13 +1414,17 @@ public static AsyncPageable GetMaintenanceConf /// MaintenanceConfigurations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMaintenanceConfigurations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMaintenanceConfigurations(cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetMaintenanceConfigurations(cancellationToken); } /// @@ -1389,13 +1439,17 @@ public static Pageable GetMaintenanceConfigura /// ConfigurationAssignmentsWithinSubscription_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConfigurationAssignmentsBySubscriptionAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurationAssignmentsBySubscriptionAsync(cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetConfigurationAssignmentsBySubscriptionAsync(cancellationToken); } /// @@ -1410,13 +1464,17 @@ public static AsyncPageable GetConfigura /// ConfigurationAssignmentsWithinSubscription_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetConfigurationAssignmentsBySubscription(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurationAssignmentsBySubscription(cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetConfigurationAssignmentsBySubscription(cancellationToken); } /// @@ -1431,6 +1489,10 @@ public static Pageable GetConfigurationA /// ConfigurationAssignmentsForSubscriptions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -1439,9 +1501,7 @@ public static Pageable GetConfigurationA /// is null. public static async Task> GetConfigurationAssignmentBySubscriptionAsync(this SubscriptionResource subscriptionResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurationAssignmentBySubscriptionAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetConfigurationAssignmentBySubscriptionAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -1456,6 +1516,10 @@ public static async Task> GetCo /// ConfigurationAssignmentsForSubscriptions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -1464,9 +1528,7 @@ public static async Task> GetCo /// is null. public static Response GetConfigurationAssignmentBySubscription(this SubscriptionResource subscriptionResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetConfigurationAssignmentBySubscription(configurationAssignmentName, cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).GetConfigurationAssignmentBySubscription(configurationAssignmentName, cancellationToken); } /// @@ -1481,6 +1543,10 @@ public static Response GetConfigurationA /// ConfigurationAssignmentsForSubscriptions_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -1490,10 +1556,7 @@ public static Response GetConfigurationA /// or is null. public static async Task> CreateOrUpdateConfigurationAssignmentBySubscriptionAsync(this SubscriptionResource subscriptionResource, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CreateOrUpdateConfigurationAssignmentBySubscriptionAsync(configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceSubscriptionResource(subscriptionResource).CreateOrUpdateConfigurationAssignmentBySubscriptionAsync(configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); } /// @@ -1508,6 +1571,10 @@ public static async Task> Creat /// ConfigurationAssignmentsForSubscriptions_CreateOrUpdate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -1517,10 +1584,7 @@ public static async Task> Creat /// or is null. public static Response CreateOrUpdateConfigurationAssignmentBySubscription(this SubscriptionResource subscriptionResource, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CreateOrUpdateConfigurationAssignmentBySubscription(configurationAssignmentName, data, cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).CreateOrUpdateConfigurationAssignmentBySubscription(configurationAssignmentName, data, cancellationToken); } /// @@ -1535,6 +1599,10 @@ public static Response CreateOrUpdateCon /// ConfigurationAssignmentsForSubscriptions_Update /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -1544,10 +1612,7 @@ public static Response CreateOrUpdateCon /// or is null. public static async Task> UpdateConfigurationAssignmentBySubscriptionAsync(this SubscriptionResource subscriptionResource, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).UpdateConfigurationAssignmentBySubscriptionAsync(configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceSubscriptionResource(subscriptionResource).UpdateConfigurationAssignmentBySubscriptionAsync(configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); } /// @@ -1562,6 +1627,10 @@ public static async Task> Updat /// ConfigurationAssignmentsForSubscriptions_Update /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Configuration assignment name. @@ -1571,10 +1640,7 @@ public static async Task> Updat /// or is null. public static Response UpdateConfigurationAssignmentBySubscription(this SubscriptionResource subscriptionResource, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).UpdateConfigurationAssignmentBySubscription(configurationAssignmentName, data, cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).UpdateConfigurationAssignmentBySubscription(configurationAssignmentName, data, cancellationToken); } /// @@ -1589,6 +1655,10 @@ public static Response UpdateConfigurati /// ConfigurationAssignmentsForSubscriptions_Delete /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Unique configuration assignment name. @@ -1597,9 +1667,7 @@ public static Response UpdateConfigurati /// is null. public static async Task> DeleteConfigurationAssignmentBySubscriptionAsync(this SubscriptionResource subscriptionResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).DeleteConfigurationAssignmentBySubscriptionAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableMaintenanceSubscriptionResource(subscriptionResource).DeleteConfigurationAssignmentBySubscriptionAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -1614,6 +1682,10 @@ public static async Task> Delet /// ConfigurationAssignmentsForSubscriptions_Delete /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Unique configuration assignment name. @@ -1622,9 +1694,7 @@ public static async Task> Delet /// is null. public static Response DeleteConfigurationAssignmentBySubscription(this SubscriptionResource subscriptionResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).DeleteConfigurationAssignmentBySubscription(configurationAssignmentName, cancellationToken); + return GetMockableMaintenanceSubscriptionResource(subscriptionResource).DeleteConfigurationAssignmentBySubscription(configurationAssignmentName, cancellationToken); } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceArmClient.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceArmClient.cs new file mode 100644 index 0000000000000..2a709d82244af --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Maintenance; + +namespace Azure.ResourceManager.Maintenance.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMaintenanceArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMaintenanceArmClient() + { + } + + /// 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 MockableMaintenanceArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMaintenanceArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MaintenancePublicConfigurationResource GetMaintenancePublicConfigurationResource(ResourceIdentifier id) + { + MaintenancePublicConfigurationResource.ValidateResourceId(id); + return new MaintenancePublicConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MaintenanceConfigurationResource GetMaintenanceConfigurationResource(ResourceIdentifier id) + { + MaintenanceConfigurationResource.ValidateResourceId(id); + return new MaintenanceConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MaintenanceApplyUpdateResource GetMaintenanceApplyUpdateResource(ResourceIdentifier id) + { + MaintenanceApplyUpdateResource.ValidateResourceId(id); + return new MaintenanceApplyUpdateResource(Client, id); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceResourceGroupResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceResourceGroupResource.cs new file mode 100644 index 0000000000000..661955368e6e5 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceResourceGroupResource.cs @@ -0,0 +1,1448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Maintenance; +using Azure.ResourceManager.Maintenance.Models; + +namespace Azure.ResourceManager.Maintenance.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMaintenanceResourceGroupResource : ArmResource + { + private ClientDiagnostics _maintenanceApplyUpdateApplyUpdatesClientDiagnostics; + private ApplyUpdatesRestOperations _maintenanceApplyUpdateApplyUpdatesRestClient; + private ClientDiagnostics _configurationAssignmentsClientDiagnostics; + private ConfigurationAssignmentsRestOperations _configurationAssignmentsRestClient; + private ClientDiagnostics _applyUpdateForResourceGroupClientDiagnostics; + private ApplyUpdateForResourceGroupRestOperations _applyUpdateForResourceGroupRestClient; + private ClientDiagnostics _configurationAssignmentsForResourceGroupClientDiagnostics; + private ConfigurationAssignmentsForResourceGroupRestOperations _configurationAssignmentsForResourceGroupRestClient; + private ClientDiagnostics _updatesClientDiagnostics; + private UpdatesRestOperations _updatesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMaintenanceResourceGroupResource() + { + } + + /// 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 MockableMaintenanceResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MaintenanceApplyUpdateApplyUpdatesClientDiagnostics => _maintenanceApplyUpdateApplyUpdatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceApplyUpdateResource.ResourceType.Namespace, Diagnostics); + private ApplyUpdatesRestOperations MaintenanceApplyUpdateApplyUpdatesRestClient => _maintenanceApplyUpdateApplyUpdatesRestClient ??= new ApplyUpdatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MaintenanceApplyUpdateResource.ResourceType)); + private ClientDiagnostics ConfigurationAssignmentsClientDiagnostics => _configurationAssignmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationAssignmentsRestOperations ConfigurationAssignmentsRestClient => _configurationAssignmentsRestClient ??= new ConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ApplyUpdateForResourceGroupClientDiagnostics => _applyUpdateForResourceGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ApplyUpdateForResourceGroupRestOperations ApplyUpdateForResourceGroupRestClient => _applyUpdateForResourceGroupRestClient ??= new ApplyUpdateForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ConfigurationAssignmentsForResourceGroupClientDiagnostics => _configurationAssignmentsForResourceGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationAssignmentsForResourceGroupRestOperations ConfigurationAssignmentsForResourceGroupRestClient => _configurationAssignmentsForResourceGroupRestClient ??= new ConfigurationAssignmentsForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics UpdatesClientDiagnostics => _updatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UpdatesRestOperations UpdatesRestClient => _updatesRestClient ??= new UpdatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MaintenanceConfigurationResources in the ResourceGroupResource. + /// An object representing collection of MaintenanceConfigurationResources and their operations over a MaintenanceConfigurationResource. + public virtual MaintenanceConfigurationCollection GetMaintenanceConfigurations() + { + return GetCachedClient(client => new MaintenanceConfigurationCollection(client, Id)); + } + + /// + /// Get Configuration record + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName} + /// + /// + /// Operation Id + /// MaintenanceConfigurations_Get + /// + /// + /// + /// Maintenance Configuration Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMaintenanceConfigurationAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetMaintenanceConfigurations().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Configuration record + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName} + /// + /// + /// Operation Id + /// MaintenanceConfigurations_Get + /// + /// + /// + /// Maintenance Configuration Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMaintenanceConfiguration(string resourceName, CancellationToken cancellationToken = default) + { + return GetMaintenanceConfigurations().Get(resourceName, cancellationToken); + } + + /// Gets a collection of MaintenanceApplyUpdateResources in the ResourceGroupResource. + /// An object representing collection of MaintenanceApplyUpdateResources and their operations over a MaintenanceApplyUpdateResource. + public virtual MaintenanceApplyUpdateCollection GetMaintenanceApplyUpdates() + { + return GetCachedClient(client => new MaintenanceApplyUpdateCollection(client, Id)); + } + + /// + /// Track maintenance updates to resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_Get + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// applyUpdate Id. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMaintenanceApplyUpdateAsync(string providerName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) + { + return await GetMaintenanceApplyUpdates().GetAsync(providerName, resourceType, resourceName, applyUpdateName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Track maintenance updates to resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_Get + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// applyUpdate Id. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMaintenanceApplyUpdate(string providerName, string resourceType, string resourceName, string applyUpdateName, CancellationToken cancellationToken = default) + { + return GetMaintenanceApplyUpdates().Get(providerName, resourceType, resourceName, applyUpdateName, cancellationToken); + } + + /// + /// Track maintenance updates to resource with parent + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_GetParent + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetApplyUpdatesByParentAsync(ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.GetApplyUpdatesByParent"); + scope.Start(); + try + { + var response = await MaintenanceApplyUpdateApplyUpdatesRestClient.GetParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ApplyUpdateName, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Track maintenance updates to resource with parent + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_GetParent + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual Response GetApplyUpdatesByParent(ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.GetApplyUpdatesByParent"); + scope.Start(); + try + { + var response = MaintenanceApplyUpdateApplyUpdatesRestClient.GetParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ApplyUpdateName, cancellationToken); + return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Apply maintenance updates to resource with parent + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default + /// + /// + /// Operation Id + /// ApplyUpdates_CreateOrUpdateParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual async Task> CreateOrUpdateApplyUpdateByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateApplyUpdateByParent"); + scope.Start(); + try + { + var response = await MaintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateParentAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Apply maintenance updates to resource with parent + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default + /// + /// + /// Operation Id + /// ApplyUpdates_CreateOrUpdateParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual Response CreateOrUpdateApplyUpdateByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateApplyUpdateByParent"); + scope.Start(); + try + { + var response = MaintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateParent(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Apply maintenance updates to resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default + /// + /// + /// Operation Id + /// ApplyUpdates_CreateOrUpdate + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> CreateOrUpdateApplyUpdateAsync(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateApplyUpdate"); + scope.Start(); + try + { + var response = await MaintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Apply maintenance updates to resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default + /// + /// + /// Operation Id + /// ApplyUpdates_CreateOrUpdate + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual Response CreateOrUpdateApplyUpdate(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateApplyUpdate"); + scope.Start(); + try + { + var response = MaintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, cancellationToken); + return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_GetParent + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetConfigurationAssignmentByParentAsync(ResourceGroupResourceGetConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.GetConfigurationAssignmentByParent"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsRestClient.GetParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_GetParent + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual Response GetConfigurationAssignmentByParent(ResourceGroupResourceGetConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.GetConfigurationAssignmentByParent"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsRestClient.GetParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdateParent + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateConfigurationAssignmentByParentAsync(ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateConfigurationAssignmentByParent"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsRestClient.CreateOrUpdateParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, options.Data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdateParent + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual Response CreateOrUpdateConfigurationAssignmentByParent(ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateConfigurationAssignmentByParent"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsRestClient.CreateOrUpdateParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, options.Data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_DeleteParent + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual async Task> DeleteConfigurationAssignmentByParentAsync(ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.DeleteConfigurationAssignmentByParent"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsRestClient.DeleteParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_DeleteParent + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + public virtual Response DeleteConfigurationAssignmentByParent(ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.DeleteConfigurationAssignmentByParent"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsRestClient.DeleteParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_Get + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual async Task> GetConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.GetConfigurationAssignment"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_Get + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual Response GetConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.GetConfigurationAssignment"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdate + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual async Task> CreateOrUpdateConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateConfigurationAssignment"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdate + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual Response CreateOrUpdateConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateConfigurationAssignment"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_Delete + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual async Task> DeleteConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.DeleteConfigurationAssignment"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_Delete + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual Response DeleteConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.DeleteConfigurationAssignment"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_ListParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationAssignmentsByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetConfigurationAssignmentsByParent", "value", null, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_ListParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurationAssignmentsByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetConfigurationAssignmentsByParent", "value", null, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_List + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationAssignmentsAsync(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetConfigurationAssignments", "value", null, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_List + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurationAssignments(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetConfigurationAssignments", "value", null, cancellationToken); + } + + /// + /// Get Configuration records within a subscription and resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/applyUpdates + /// + /// + /// Operation Id + /// ApplyUpdateForResourceGroup_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMaintenanceApplyUpdatesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplyUpdateForResourceGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MaintenanceApplyUpdateResource(Client, MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(e)), ApplyUpdateForResourceGroupClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetMaintenanceApplyUpdates", "value", null, cancellationToken); + } + + /// + /// Get Configuration records within a subscription and resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/applyUpdates + /// + /// + /// Operation Id + /// ApplyUpdateForResourceGroup_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMaintenanceApplyUpdates(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplyUpdateForResourceGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MaintenanceApplyUpdateResource(Client, MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(e)), ApplyUpdateForResourceGroupClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetMaintenanceApplyUpdates", "value", null, cancellationToken); + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.GetConfigurationAssignmentByResourceGroup"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsForResourceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetConfigurationAssignmentByResourceGroup(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.GetConfigurationAssignmentByResourceGroup"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsForResourceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_CreateOrUpdate + /// + /// + /// + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateConfigurationAssignmentByResourceGroup"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsForResourceGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_CreateOrUpdate + /// + /// + /// + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response CreateOrUpdateConfigurationAssignmentByResourceGroup(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.CreateOrUpdateConfigurationAssignmentByResourceGroup"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsForResourceGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Update + /// + /// + /// + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.UpdateConfigurationAssignmentByResourceGroup"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsForResourceGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Update + /// + /// + /// + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response UpdateConfigurationAssignmentByResourceGroup(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.UpdateConfigurationAssignmentByResourceGroup"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsForResourceGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Delete + /// + /// + /// + /// Unique configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> DeleteConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.DeleteConfigurationAssignmentByResourceGroup"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsForResourceGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Delete + /// + /// + /// + /// Unique configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeleteConfigurationAssignmentByResourceGroup(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MockableMaintenanceResourceGroupResource.DeleteConfigurationAssignmentByResourceGroup"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsForResourceGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get updates to resources. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates + /// + /// + /// Operation Id + /// Updates_ListParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUpdatesByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => UpdatesRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceUpdate.DeserializeMaintenanceUpdate, UpdatesClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetUpdatesByParent", "value", null, cancellationToken); + } + + /// + /// Get updates to resources. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates + /// + /// + /// Operation Id + /// Updates_ListParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUpdatesByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => UpdatesRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceUpdate.DeserializeMaintenanceUpdate, UpdatesClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetUpdatesByParent", "value", null, cancellationToken); + } + + /// + /// Get updates to resources. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates + /// + /// + /// Operation Id + /// Updates_List + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUpdatesAsync(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => UpdatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceUpdate.DeserializeMaintenanceUpdate, UpdatesClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetUpdates", "value", null, cancellationToken); + } + + /// + /// Get updates to resources. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates + /// + /// + /// Operation Id + /// Updates_List + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUpdates(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => UpdatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceUpdate.DeserializeMaintenanceUpdate, UpdatesClientDiagnostics, Pipeline, "MockableMaintenanceResourceGroupResource.GetUpdates", "value", null, cancellationToken); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceSubscriptionResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceSubscriptionResource.cs new file mode 100644 index 0000000000000..cb29558ed9fee --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MockableMaintenanceSubscriptionResource.cs @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Maintenance; +using Azure.ResourceManager.Maintenance.Models; + +namespace Azure.ResourceManager.Maintenance.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMaintenanceSubscriptionResource : ArmResource + { + private ClientDiagnostics _maintenanceApplyUpdateApplyUpdatesClientDiagnostics; + private ApplyUpdatesRestOperations _maintenanceApplyUpdateApplyUpdatesRestClient; + private ClientDiagnostics _maintenanceConfigurationClientDiagnostics; + private MaintenanceConfigurationsRestOperations _maintenanceConfigurationRestClient; + private ClientDiagnostics _configurationAssignmentsWithinSubscriptionClientDiagnostics; + private ConfigurationAssignmentsWithinSubscriptionRestOperations _configurationAssignmentsWithinSubscriptionRestClient; + private ClientDiagnostics _configurationAssignmentsForSubscriptionsClientDiagnostics; + private ConfigurationAssignmentsForSubscriptionsRestOperations _configurationAssignmentsForSubscriptionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMaintenanceSubscriptionResource() + { + } + + /// 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 MockableMaintenanceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MaintenanceApplyUpdateApplyUpdatesClientDiagnostics => _maintenanceApplyUpdateApplyUpdatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceApplyUpdateResource.ResourceType.Namespace, Diagnostics); + private ApplyUpdatesRestOperations MaintenanceApplyUpdateApplyUpdatesRestClient => _maintenanceApplyUpdateApplyUpdatesRestClient ??= new ApplyUpdatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MaintenanceApplyUpdateResource.ResourceType)); + private ClientDiagnostics MaintenanceConfigurationClientDiagnostics => _maintenanceConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceConfigurationResource.ResourceType.Namespace, Diagnostics); + private MaintenanceConfigurationsRestOperations MaintenanceConfigurationRestClient => _maintenanceConfigurationRestClient ??= new MaintenanceConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MaintenanceConfigurationResource.ResourceType)); + private ClientDiagnostics ConfigurationAssignmentsWithinSubscriptionClientDiagnostics => _configurationAssignmentsWithinSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationAssignmentsWithinSubscriptionRestOperations ConfigurationAssignmentsWithinSubscriptionRestClient => _configurationAssignmentsWithinSubscriptionRestClient ??= new ConfigurationAssignmentsWithinSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ConfigurationAssignmentsForSubscriptionsClientDiagnostics => _configurationAssignmentsForSubscriptionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationAssignmentsForSubscriptionsRestOperations ConfigurationAssignmentsForSubscriptionsRestClient => _configurationAssignmentsForSubscriptionsRestClient ??= new ConfigurationAssignmentsForSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MaintenancePublicConfigurationResources in the SubscriptionResource. + /// An object representing collection of MaintenancePublicConfigurationResources and their operations over a MaintenancePublicConfigurationResource. + public virtual MaintenancePublicConfigurationCollection GetMaintenancePublicConfigurations() + { + return GetCachedClient(client => new MaintenancePublicConfigurationCollection(client, Id)); + } + + /// + /// Get Public Maintenance Configuration record + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName} + /// + /// + /// Operation Id + /// PublicMaintenanceConfigurations_Get + /// + /// + /// + /// Maintenance Configuration Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMaintenancePublicConfigurationAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetMaintenancePublicConfigurations().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Public Maintenance Configuration record + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName} + /// + /// + /// Operation Id + /// PublicMaintenanceConfigurations_Get + /// + /// + /// + /// Maintenance Configuration Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMaintenancePublicConfiguration(string resourceName, CancellationToken cancellationToken = default) + { + return GetMaintenancePublicConfigurations().Get(resourceName, cancellationToken); + } + + /// + /// Get Configuration records within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates + /// + /// + /// Operation Id + /// ApplyUpdates_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMaintenanceApplyUpdatesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MaintenanceApplyUpdateApplyUpdatesRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MaintenanceApplyUpdateResource(Client, MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(e)), MaintenanceApplyUpdateApplyUpdatesClientDiagnostics, Pipeline, "MockableMaintenanceSubscriptionResource.GetMaintenanceApplyUpdates", "value", null, cancellationToken); + } + + /// + /// Get Configuration records within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates + /// + /// + /// Operation Id + /// ApplyUpdates_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMaintenanceApplyUpdates(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MaintenanceApplyUpdateApplyUpdatesRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MaintenanceApplyUpdateResource(Client, MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(e)), MaintenanceApplyUpdateApplyUpdatesClientDiagnostics, Pipeline, "MockableMaintenanceSubscriptionResource.GetMaintenanceApplyUpdates", "value", null, cancellationToken); + } + + /// + /// Get Configuration records within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/maintenanceConfigurations + /// + /// + /// Operation Id + /// MaintenanceConfigurations_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMaintenanceConfigurationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MaintenanceConfigurationRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MaintenanceConfigurationResource(Client, MaintenanceConfigurationData.DeserializeMaintenanceConfigurationData(e)), MaintenanceConfigurationClientDiagnostics, Pipeline, "MockableMaintenanceSubscriptionResource.GetMaintenanceConfigurations", "value", null, cancellationToken); + } + + /// + /// Get Configuration records within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/maintenanceConfigurations + /// + /// + /// Operation Id + /// MaintenanceConfigurations_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMaintenanceConfigurations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MaintenanceConfigurationRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MaintenanceConfigurationResource(Client, MaintenanceConfigurationData.DeserializeMaintenanceConfigurationData(e)), MaintenanceConfigurationClientDiagnostics, Pipeline, "MockableMaintenanceSubscriptionResource.GetMaintenanceConfigurations", "value", null, cancellationToken); + } + + /// + /// Get configuration assignment within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignmentsWithinSubscription_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationAssignmentsBySubscriptionAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsWithinSubscriptionRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsWithinSubscriptionClientDiagnostics, Pipeline, "MockableMaintenanceSubscriptionResource.GetConfigurationAssignmentsBySubscription", "value", null, cancellationToken); + } + + /// + /// Get configuration assignment within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignmentsWithinSubscription_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurationAssignmentsBySubscription(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsWithinSubscriptionRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsWithinSubscriptionClientDiagnostics, Pipeline, "MockableMaintenanceSubscriptionResource.GetConfigurationAssignmentsBySubscription", "value", null, cancellationToken); + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MockableMaintenanceSubscriptionResource.GetConfigurationAssignmentBySubscription"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsForSubscriptionsRestClient.GetAsync(Id.SubscriptionId, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetConfigurationAssignmentBySubscription(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MockableMaintenanceSubscriptionResource.GetConfigurationAssignmentBySubscription"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsForSubscriptionsRestClient.Get(Id.SubscriptionId, configurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_CreateOrUpdate + /// + /// + /// + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MockableMaintenanceSubscriptionResource.CreateOrUpdateConfigurationAssignmentBySubscription"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsForSubscriptionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_CreateOrUpdate + /// + /// + /// + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response CreateOrUpdateConfigurationAssignmentBySubscription(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MockableMaintenanceSubscriptionResource.CreateOrUpdateConfigurationAssignmentBySubscription"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsForSubscriptionsRestClient.CreateOrUpdate(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Update + /// + /// + /// + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MockableMaintenanceSubscriptionResource.UpdateConfigurationAssignmentBySubscription"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsForSubscriptionsRestClient.UpdateAsync(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Update + /// + /// + /// + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response UpdateConfigurationAssignmentBySubscription(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MockableMaintenanceSubscriptionResource.UpdateConfigurationAssignmentBySubscription"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsForSubscriptionsRestClient.Update(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Delete + /// + /// + /// + /// Unique configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> DeleteConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MockableMaintenanceSubscriptionResource.DeleteConfigurationAssignmentBySubscription"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsForSubscriptionsRestClient.DeleteAsync(Id.SubscriptionId, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Delete + /// + /// + /// + /// Unique configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeleteConfigurationAssignmentBySubscription(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MockableMaintenanceSubscriptionResource.DeleteConfigurationAssignmentBySubscription"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsForSubscriptionsRestClient.Delete(Id.SubscriptionId, configurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 154a784272ec0..0000000000000 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,1161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Maintenance.Models; - -namespace Azure.ResourceManager.Maintenance -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _maintenanceApplyUpdateApplyUpdatesClientDiagnostics; - private ApplyUpdatesRestOperations _maintenanceApplyUpdateApplyUpdatesRestClient; - private ClientDiagnostics _configurationAssignmentsClientDiagnostics; - private ConfigurationAssignmentsRestOperations _configurationAssignmentsRestClient; - private ClientDiagnostics _applyUpdateForResourceGroupClientDiagnostics; - private ApplyUpdateForResourceGroupRestOperations _applyUpdateForResourceGroupRestClient; - private ClientDiagnostics _configurationAssignmentsForResourceGroupClientDiagnostics; - private ConfigurationAssignmentsForResourceGroupRestOperations _configurationAssignmentsForResourceGroupRestClient; - private ClientDiagnostics _updatesClientDiagnostics; - private UpdatesRestOperations _updatesRestClient; - - /// 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 ClientDiagnostics MaintenanceApplyUpdateApplyUpdatesClientDiagnostics => _maintenanceApplyUpdateApplyUpdatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceApplyUpdateResource.ResourceType.Namespace, Diagnostics); - private ApplyUpdatesRestOperations MaintenanceApplyUpdateApplyUpdatesRestClient => _maintenanceApplyUpdateApplyUpdatesRestClient ??= new ApplyUpdatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MaintenanceApplyUpdateResource.ResourceType)); - private ClientDiagnostics ConfigurationAssignmentsClientDiagnostics => _configurationAssignmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ConfigurationAssignmentsRestOperations ConfigurationAssignmentsRestClient => _configurationAssignmentsRestClient ??= new ConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ApplyUpdateForResourceGroupClientDiagnostics => _applyUpdateForResourceGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ApplyUpdateForResourceGroupRestOperations ApplyUpdateForResourceGroupRestClient => _applyUpdateForResourceGroupRestClient ??= new ApplyUpdateForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ConfigurationAssignmentsForResourceGroupClientDiagnostics => _configurationAssignmentsForResourceGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ConfigurationAssignmentsForResourceGroupRestOperations ConfigurationAssignmentsForResourceGroupRestClient => _configurationAssignmentsForResourceGroupRestClient ??= new ConfigurationAssignmentsForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics UpdatesClientDiagnostics => _updatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UpdatesRestOperations UpdatesRestClient => _updatesRestClient ??= new UpdatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of MaintenanceConfigurationResources in the ResourceGroupResource. - /// An object representing collection of MaintenanceConfigurationResources and their operations over a MaintenanceConfigurationResource. - public virtual MaintenanceConfigurationCollection GetMaintenanceConfigurations() - { - return GetCachedClient(Client => new MaintenanceConfigurationCollection(Client, Id)); - } - - /// Gets a collection of MaintenanceApplyUpdateResources in the ResourceGroupResource. - /// An object representing collection of MaintenanceApplyUpdateResources and their operations over a MaintenanceApplyUpdateResource. - public virtual MaintenanceApplyUpdateCollection GetMaintenanceApplyUpdates() - { - return GetCachedClient(Client => new MaintenanceApplyUpdateCollection(Client, Id)); - } - - /// - /// Track maintenance updates to resource with parent - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} - /// - /// - /// Operation Id - /// ApplyUpdates_GetParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual async Task> GetApplyUpdatesByParentAsync(ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetApplyUpdatesByParent"); - scope.Start(); - try - { - var response = await MaintenanceApplyUpdateApplyUpdatesRestClient.GetParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ApplyUpdateName, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Track maintenance updates to resource with parent - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} - /// - /// - /// Operation Id - /// ApplyUpdates_GetParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual Response GetApplyUpdatesByParent(ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetApplyUpdatesByParent"); - scope.Start(); - try - { - var response = MaintenanceApplyUpdateApplyUpdatesRestClient.GetParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ApplyUpdateName, cancellationToken); - return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Apply maintenance updates to resource with parent - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default - /// - /// - /// Operation Id - /// ApplyUpdates_CreateOrUpdateParent - /// - /// - /// - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateApplyUpdateByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateApplyUpdateByParent"); - scope.Start(); - try - { - var response = await MaintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateParentAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Apply maintenance updates to resource with parent - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default - /// - /// - /// Operation Id - /// ApplyUpdates_CreateOrUpdateParent - /// - /// - /// - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - public virtual Response CreateOrUpdateApplyUpdateByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateApplyUpdateByParent"); - scope.Start(); - try - { - var response = MaintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateParent(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); - return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Apply maintenance updates to resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default - /// - /// - /// Operation Id - /// ApplyUpdates_CreateOrUpdate - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateApplyUpdateAsync(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateApplyUpdate"); - scope.Start(); - try - { - var response = await MaintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Apply maintenance updates to resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default - /// - /// - /// Operation Id - /// ApplyUpdates_CreateOrUpdate - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - public virtual Response CreateOrUpdateApplyUpdate(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - using var scope = MaintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateApplyUpdate"); - scope.Start(); - try - { - var response = MaintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, cancellationToken); - return Response.FromValue(new MaintenanceApplyUpdateResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get configuration assignment for resource.. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_GetParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual async Task> GetConfigurationAssignmentByParentAsync(ResourceGroupResourceGetConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.GetParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get configuration assignment for resource.. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_GetParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual Response GetConfigurationAssignmentByParent(ResourceGroupResourceGetConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.GetParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdateParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateConfigurationAssignmentByParentAsync(ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.CreateOrUpdateParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, options.Data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdateParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual Response CreateOrUpdateConfigurationAssignmentByParent(ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.CreateOrUpdateParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, options.Data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_DeleteParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual async Task> DeleteConfigurationAssignmentByParentAsync(ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.DeleteParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_DeleteParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual Response DeleteConfigurationAssignmentByParent(ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.DeleteParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get configuration assignment for resource.. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_Get - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The cancellation token to use. - public virtual async Task> GetConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetConfigurationAssignment"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get configuration assignment for resource.. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_Get - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The cancellation token to use. - public virtual Response GetConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetConfigurationAssignment"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdate - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignment"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdate - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual Response CreateOrUpdateConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignment"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_Delete - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Unique configuration assignment name. - /// The cancellation token to use. - public virtual async Task> DeleteConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignment"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_Delete - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Unique configuration assignment name. - /// The cancellation token to use. - public virtual Response DeleteConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignment"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List configurationAssignments for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignments_ListParent - /// - /// - /// - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationAssignmentsByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignmentsByParent", "value", null, cancellationToken); - } - - /// - /// List configurationAssignments for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignments_ListParent - /// - /// - /// - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurationAssignmentsByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignmentsByParent", "value", null, cancellationToken); - } - - /// - /// List configurationAssignments for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignments_List - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationAssignmentsAsync(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignments", "value", null, cancellationToken); - } - - /// - /// List configurationAssignments for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignments_List - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurationAssignments(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignments", "value", null, cancellationToken); - } - - /// - /// Get Configuration records within a subscription and resource group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/applyUpdates - /// - /// - /// Operation Id - /// ApplyUpdateForResourceGroup_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMaintenanceApplyUpdatesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplyUpdateForResourceGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MaintenanceApplyUpdateResource(Client, MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(e)), ApplyUpdateForResourceGroupClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetMaintenanceApplyUpdates", "value", null, cancellationToken); - } - - /// - /// Get Configuration records within a subscription and resource group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/applyUpdates - /// - /// - /// Operation Id - /// ApplyUpdateForResourceGroup_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMaintenanceApplyUpdates(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplyUpdateForResourceGroupRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MaintenanceApplyUpdateResource(Client, MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(e)), ApplyUpdateForResourceGroupClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetMaintenanceApplyUpdates", "value", null, cancellationToken); - } - - /// - /// Get configuration assignment for resource.. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForResourceGroup_Get - /// - /// - /// - /// Configuration assignment name. - /// The cancellation token to use. - public virtual async Task> GetConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetConfigurationAssignmentByResourceGroup"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsForResourceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get configuration assignment for resource.. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForResourceGroup_Get - /// - /// - /// - /// Configuration assignment name. - /// The cancellation token to use. - public virtual Response GetConfigurationAssignmentByResourceGroup(string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetConfigurationAssignmentByResourceGroup"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsForResourceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForResourceGroup_CreateOrUpdate - /// - /// - /// - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignmentByResourceGroup"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsForResourceGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForResourceGroup_CreateOrUpdate - /// - /// - /// - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual Response CreateOrUpdateConfigurationAssignmentByResourceGroup(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignmentByResourceGroup"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsForResourceGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForResourceGroup_Update - /// - /// - /// - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual async Task> UpdateConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.UpdateConfigurationAssignmentByResourceGroup"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsForResourceGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForResourceGroup_Update - /// - /// - /// - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual Response UpdateConfigurationAssignmentByResourceGroup(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.UpdateConfigurationAssignmentByResourceGroup"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsForResourceGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForResourceGroup_Delete - /// - /// - /// - /// Unique configuration assignment name. - /// The cancellation token to use. - public virtual async Task> DeleteConfigurationAssignmentByResourceGroupAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignmentByResourceGroup"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsForResourceGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForResourceGroup_Delete - /// - /// - /// - /// Unique configuration assignment name. - /// The cancellation token to use. - public virtual Response DeleteConfigurationAssignmentByResourceGroup(string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignmentByResourceGroup"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsForResourceGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get updates to resources. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates - /// - /// - /// Operation Id - /// Updates_ListParent - /// - /// - /// - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUpdatesByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UpdatesRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceUpdate.DeserializeMaintenanceUpdate, UpdatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetUpdatesByParent", "value", null, cancellationToken); - } - - /// - /// Get updates to resources. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates - /// - /// - /// Operation Id - /// Updates_ListParent - /// - /// - /// - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUpdatesByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UpdatesRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceUpdate.DeserializeMaintenanceUpdate, UpdatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetUpdatesByParent", "value", null, cancellationToken); - } - - /// - /// Get updates to resources. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates - /// - /// - /// Operation Id - /// Updates_List - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUpdatesAsync(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UpdatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceUpdate.DeserializeMaintenanceUpdate, UpdatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetUpdates", "value", null, cancellationToken); - } - - /// - /// Get updates to resources. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates - /// - /// - /// Operation Id - /// Updates_List - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUpdates(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UpdatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceUpdate.DeserializeMaintenanceUpdate, UpdatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetUpdates", "value", null, cancellationToken); - } - } -} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b921547d35e3c..0000000000000 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Maintenance.Models; - -namespace Azure.ResourceManager.Maintenance -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _maintenanceApplyUpdateApplyUpdatesClientDiagnostics; - private ApplyUpdatesRestOperations _maintenanceApplyUpdateApplyUpdatesRestClient; - private ClientDiagnostics _maintenanceConfigurationClientDiagnostics; - private MaintenanceConfigurationsRestOperations _maintenanceConfigurationRestClient; - private ClientDiagnostics _configurationAssignmentsWithinSubscriptionClientDiagnostics; - private ConfigurationAssignmentsWithinSubscriptionRestOperations _configurationAssignmentsWithinSubscriptionRestClient; - private ClientDiagnostics _configurationAssignmentsForSubscriptionsClientDiagnostics; - private ConfigurationAssignmentsForSubscriptionsRestOperations _configurationAssignmentsForSubscriptionsRestClient; - - /// 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 MaintenanceApplyUpdateApplyUpdatesClientDiagnostics => _maintenanceApplyUpdateApplyUpdatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceApplyUpdateResource.ResourceType.Namespace, Diagnostics); - private ApplyUpdatesRestOperations MaintenanceApplyUpdateApplyUpdatesRestClient => _maintenanceApplyUpdateApplyUpdatesRestClient ??= new ApplyUpdatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MaintenanceApplyUpdateResource.ResourceType)); - private ClientDiagnostics MaintenanceConfigurationClientDiagnostics => _maintenanceConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceConfigurationResource.ResourceType.Namespace, Diagnostics); - private MaintenanceConfigurationsRestOperations MaintenanceConfigurationRestClient => _maintenanceConfigurationRestClient ??= new MaintenanceConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MaintenanceConfigurationResource.ResourceType)); - private ClientDiagnostics ConfigurationAssignmentsWithinSubscriptionClientDiagnostics => _configurationAssignmentsWithinSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ConfigurationAssignmentsWithinSubscriptionRestOperations ConfigurationAssignmentsWithinSubscriptionRestClient => _configurationAssignmentsWithinSubscriptionRestClient ??= new ConfigurationAssignmentsWithinSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ConfigurationAssignmentsForSubscriptionsClientDiagnostics => _configurationAssignmentsForSubscriptionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ConfigurationAssignmentsForSubscriptionsRestOperations ConfigurationAssignmentsForSubscriptionsRestClient => _configurationAssignmentsForSubscriptionsRestClient ??= new ConfigurationAssignmentsForSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of MaintenancePublicConfigurationResources in the SubscriptionResource. - /// An object representing collection of MaintenancePublicConfigurationResources and their operations over a MaintenancePublicConfigurationResource. - public virtual MaintenancePublicConfigurationCollection GetMaintenancePublicConfigurations() - { - return GetCachedClient(Client => new MaintenancePublicConfigurationCollection(Client, Id)); - } - - /// - /// Get Configuration records within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates - /// - /// - /// Operation Id - /// ApplyUpdates_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMaintenanceApplyUpdatesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MaintenanceApplyUpdateApplyUpdatesRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MaintenanceApplyUpdateResource(Client, MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(e)), MaintenanceApplyUpdateApplyUpdatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMaintenanceApplyUpdates", "value", null, cancellationToken); - } - - /// - /// Get Configuration records within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates - /// - /// - /// Operation Id - /// ApplyUpdates_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMaintenanceApplyUpdates(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MaintenanceApplyUpdateApplyUpdatesRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MaintenanceApplyUpdateResource(Client, MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(e)), MaintenanceApplyUpdateApplyUpdatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMaintenanceApplyUpdates", "value", null, cancellationToken); - } - - /// - /// Get Configuration records within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/maintenanceConfigurations - /// - /// - /// Operation Id - /// MaintenanceConfigurations_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMaintenanceConfigurationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MaintenanceConfigurationRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MaintenanceConfigurationResource(Client, MaintenanceConfigurationData.DeserializeMaintenanceConfigurationData(e)), MaintenanceConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMaintenanceConfigurations", "value", null, cancellationToken); - } - - /// - /// Get Configuration records within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/maintenanceConfigurations - /// - /// - /// Operation Id - /// MaintenanceConfigurations_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMaintenanceConfigurations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MaintenanceConfigurationRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MaintenanceConfigurationResource(Client, MaintenanceConfigurationData.DeserializeMaintenanceConfigurationData(e)), MaintenanceConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMaintenanceConfigurations", "value", null, cancellationToken); - } - - /// - /// Get configuration assignment within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignmentsWithinSubscription_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationAssignmentsBySubscriptionAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsWithinSubscriptionRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsWithinSubscriptionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfigurationAssignmentsBySubscription", "value", null, cancellationToken); - } - - /// - /// Get configuration assignment within a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignmentsWithinSubscription_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurationAssignmentsBySubscription(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsWithinSubscriptionRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsWithinSubscriptionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfigurationAssignmentsBySubscription", "value", null, cancellationToken); - } - - /// - /// Get configuration assignment for resource.. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForSubscriptions_Get - /// - /// - /// - /// Configuration assignment name. - /// The cancellation token to use. - public virtual async Task> GetConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetConfigurationAssignmentBySubscription"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsForSubscriptionsRestClient.GetAsync(Id.SubscriptionId, configurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get configuration assignment for resource.. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForSubscriptions_Get - /// - /// - /// - /// Configuration assignment name. - /// The cancellation token to use. - public virtual Response GetConfigurationAssignmentBySubscription(string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetConfigurationAssignmentBySubscription"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsForSubscriptionsRestClient.Get(Id.SubscriptionId, configurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForSubscriptions_CreateOrUpdate - /// - /// - /// - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateOrUpdateConfigurationAssignmentBySubscription"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsForSubscriptionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForSubscriptions_CreateOrUpdate - /// - /// - /// - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual Response CreateOrUpdateConfigurationAssignmentBySubscription(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateOrUpdateConfigurationAssignmentBySubscription"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsForSubscriptionsRestClient.CreateOrUpdate(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForSubscriptions_Update - /// - /// - /// - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual async Task> UpdateConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.UpdateConfigurationAssignmentBySubscription"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsForSubscriptionsRestClient.UpdateAsync(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForSubscriptions_Update - /// - /// - /// - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual Response UpdateConfigurationAssignmentBySubscription(string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.UpdateConfigurationAssignmentBySubscription"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsForSubscriptionsRestClient.Update(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForSubscriptions_Delete - /// - /// - /// - /// Unique configuration assignment name. - /// The cancellation token to use. - public virtual async Task> DeleteConfigurationAssignmentBySubscriptionAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.DeleteConfigurationAssignmentBySubscription"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsForSubscriptionsRestClient.DeleteAsync(Id.SubscriptionId, configurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignmentsForSubscriptions_Delete - /// - /// - /// - /// Unique configuration assignment name. - /// The cancellation token to use. - public virtual Response DeleteConfigurationAssignmentBySubscription(string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.DeleteConfigurationAssignmentBySubscription"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsForSubscriptionsRestClient.Delete(Id.SubscriptionId, configurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateCollection.cs index b826253b54c2f..e05bb444bf40f 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateCollection.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateCollection.cs @@ -51,6 +51,100 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); } + /// + /// Apply maintenance updates to resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_CreateOrUpdateOrCancel + /// + /// + /// + /// 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. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// ApplyUpdate name. + /// The ApplyUpdate. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string providerName, string resourceType, string resourceName, string applyUpdateName, MaintenanceApplyUpdateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MaintenanceApplyUpdateCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _maintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateOrCancelAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, applyUpdateName, data, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceApplyUpdateResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Apply maintenance updates to resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_CreateOrUpdateOrCancel + /// + /// + /// + /// 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. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// ApplyUpdate name. + /// The ApplyUpdate. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string providerName, string resourceType, string resourceName, string applyUpdateName, MaintenanceApplyUpdateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MaintenanceApplyUpdateCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _maintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateOrCancel(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, applyUpdateName, data, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceApplyUpdateResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Track maintenance updates to resource /// diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateResource.cs index e82c24109b867..b0c18be2a9a88 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateResource.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceApplyUpdateResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.Maintenance public partial class MaintenanceApplyUpdateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The providerName. + /// The resourceType. + /// The resourceName. + /// The applyUpdateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string applyUpdateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}"; @@ -151,5 +157,81 @@ public virtual Response Get(CancellationToken ca throw; } } + + /// + /// Apply maintenance updates to resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_CreateOrUpdateOrCancel + /// + /// + /// + /// 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 ApplyUpdate. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, MaintenanceApplyUpdateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MaintenanceApplyUpdateResource.Update"); + scope.Start(); + try + { + var response = await _maintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateOrCancelAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceApplyUpdateResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Apply maintenance updates to resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + /// + /// + /// Operation Id + /// ApplyUpdates_CreateOrUpdateOrCancel + /// + /// + /// + /// 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 ApplyUpdate. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, MaintenanceApplyUpdateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceApplyUpdateApplyUpdatesClientDiagnostics.CreateScope("MaintenanceApplyUpdateResource.Update"); + scope.Start(); + try + { + var response = _maintenanceApplyUpdateApplyUpdatesRestClient.CreateOrUpdateOrCancel(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.ResourceType.Namespace, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceApplyUpdateResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationResource.cs index 0396e0155396f..312ca704df836 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationResource.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Maintenance public partial class MaintenanceConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}"; diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenancePublicConfigurationResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenancePublicConfigurationResource.cs index e16a0f8618349..4e91040216a5f 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenancePublicConfigurationResource.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenancePublicConfigurationResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Maintenance public partial class MaintenancePublicConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName}"; diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceUpdateStatus.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceUpdateStatus.cs index 7e9727f516bfb..5cd38e2f63494 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceUpdateStatus.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceUpdateStatus.cs @@ -27,6 +27,9 @@ public MaintenanceUpdateStatus(string value) private const string CompletedValue = "Completed"; private const string RetryNowValue = "RetryNow"; private const string RetryLaterValue = "RetryLater"; + private const string NoUpdatesPendingValue = "NoUpdatesPending"; + private const string CancelValue = "Cancel"; + private const string CancelledValue = "Cancelled"; /// There are pending updates to be installed. public static MaintenanceUpdateStatus Pending { get; } = new MaintenanceUpdateStatus(PendingValue); @@ -38,6 +41,12 @@ public MaintenanceUpdateStatus(string value) public static MaintenanceUpdateStatus RetryNow { get; } = new MaintenanceUpdateStatus(RetryNowValue); /// Updates installation failed and should be retried later. public static MaintenanceUpdateStatus RetryLater { get; } = new MaintenanceUpdateStatus(RetryLaterValue); + /// No updates are pending. + public static MaintenanceUpdateStatus NoUpdatesPending { get; } = new MaintenanceUpdateStatus(NoUpdatesPendingValue); + /// Cancel the schedule and stop creating PMR for resources part of it. Applicable to Maintenance Configuration resource type only. + public static MaintenanceUpdateStatus Cancel { get; } = new MaintenanceUpdateStatus(CancelValue); + /// Send the Cancelled response to the user if request came to cancel the schedule. Applicable to Maintenance Configuration resource type only. + public static MaintenanceUpdateStatus Cancelled { get; } = new MaintenanceUpdateStatus(CancelledValue); /// Determines if two values are the same. public static bool operator ==(MaintenanceUpdateStatus left, MaintenanceUpdateStatus right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdateForResourceGroupRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdateForResourceGroupRestOperations.cs index 25c415cfde788..d8ba821b0ee4f 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdateForResourceGroupRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdateForResourceGroupRestOperations.cs @@ -33,7 +33,7 @@ public ApplyUpdateForResourceGroupRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdatesRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdatesRestOperations.cs index ac6362773a278..584fd137eba88 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdatesRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdatesRestOperations.cs @@ -33,7 +33,7 @@ public ApplyUpdatesRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -245,6 +245,112 @@ public Response Get(string subscriptionId, string re } } + internal HttpMessage CreateCreateOrUpdateOrCancelRequest(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string applyUpdateName, MaintenanceApplyUpdateData 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/", false); + uri.AppendPath(providerName, true); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, true); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.Maintenance/applyUpdates/", false); + uri.AppendPath(applyUpdateName, 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; + } + + /// Apply maintenance updates to resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// ApplyUpdate name. + /// The ApplyUpdate. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateOrCancelAsync(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string applyUpdateName, MaintenanceApplyUpdateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateOrCancelRequest(subscriptionId, resourceGroupName, providerName, resourceType, resourceName, applyUpdateName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + MaintenanceApplyUpdateData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Apply maintenance updates to resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// ApplyUpdate name. + /// The ApplyUpdate. + /// The cancellation token to use. + /// , , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdateOrCancel(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string applyUpdateName, MaintenanceApplyUpdateData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(applyUpdateName, nameof(applyUpdateName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateOrCancelRequest(subscriptionId, resourceGroupName, providerName, resourceType, resourceName, applyUpdateName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + MaintenanceApplyUpdateData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceApplyUpdateData.DeserializeMaintenanceApplyUpdateData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateCreateOrUpdateParentRequest(string subscriptionId, string resourceGroupName, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName) { var message = _pipeline.CreateMessage(); diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForResourceGroupRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForResourceGroupRestOperations.cs index 963160dc31a45..0cff7917356ac 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForResourceGroupRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForResourceGroupRestOperations.cs @@ -33,7 +33,7 @@ public ConfigurationAssignmentsForResourceGroupRestOperations(HttpPipeline pipel { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForSubscriptionsRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForSubscriptionsRestOperations.cs index 990ace62a7eeb..a5120a16eab43 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForSubscriptionsRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForSubscriptionsRestOperations.cs @@ -33,7 +33,7 @@ public ConfigurationAssignmentsForSubscriptionsRestOperations(HttpPipeline pipel { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsRestOperations.cs index 6a26ce06130df..b8721d68b7ed4 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsRestOperations.cs @@ -33,7 +33,7 @@ public ConfigurationAssignmentsRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsWithinSubscriptionRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsWithinSubscriptionRestOperations.cs index d123705c78c53..85e0dc017803b 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsWithinSubscriptionRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsWithinSubscriptionRestOperations.cs @@ -33,7 +33,7 @@ public ConfigurationAssignmentsWithinSubscriptionRestOperations(HttpPipeline pip { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsForResourceGroupRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsForResourceGroupRestOperations.cs index 4887dfcdef8c9..978471b0d57c8 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsForResourceGroupRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsForResourceGroupRestOperations.cs @@ -33,7 +33,7 @@ public MaintenanceConfigurationsForResourceGroupRestOperations(HttpPipeline pipe { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs index 339001128ef0e..0eb4513c8cf70 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs @@ -33,7 +33,7 @@ public MaintenanceConfigurationsRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/PublicMaintenanceConfigurationsRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/PublicMaintenanceConfigurationsRestOperations.cs index 10f5a31635c9d..eb24681ff2787 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/PublicMaintenanceConfigurationsRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/PublicMaintenanceConfigurationsRestOperations.cs @@ -33,7 +33,7 @@ public PublicMaintenanceConfigurationsRestOperations(HttpPipeline pipeline, stri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/UpdatesRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/UpdatesRestOperations.cs index 32b3023d90960..7b6cb61e69fb3 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/UpdatesRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/UpdatesRestOperations.cs @@ -33,7 +33,7 @@ public UpdatesRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/autorest.md b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/autorest.md index 3d17905c886cb..8531c66f38eea 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/autorest.md +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/autorest.md @@ -8,8 +8,8 @@ azure-arm: true csharp: true library-name: Maintenance namespace: Azure.ResourceManager.Maintenance -require: https://github.com/Azure/azure-rest-api-specs/blob/e680f9bf4f154ec427ba7feac432ed8efd9665d0/specification/maintenance/resource-manager/readme.md -#tag: package-2023-04 +require: https://github.com/Azure/azure-rest-api-specs/blob/13aec7f115c01ba6986ebf32488537392c0df6f5/specification/maintenance/resource-manager/readme.md +#tag: package-2023-09 output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/MaintenanceManagementTestBase.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/MaintenanceManagementTestBase.cs index a2ddc7a6d5848..44c81c9494277 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/MaintenanceManagementTestBase.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/MaintenanceManagementTestBase.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Maintenance.Tests public class MaintenanceManagementTestBase : ManagementRecordedTestBase { protected ArmClient Client { get; private set; } - protected AzureLocation Location = AzureLocation.EastUS; + protected AzureLocation Location = new AzureLocation("centraluseuap"); protected MaintenanceManagementTestBase(bool isAsync, RecordedTestMode mode) : base(isAsync, mode) diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/Scenario/MaintanenceConfigurationCancellationTests.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/Scenario/MaintanenceConfigurationCancellationTests.cs new file mode 100644 index 0000000000000..abaef55658347 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/Scenario/MaintanenceConfigurationCancellationTests.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Maintenance.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Maintenance.Tests +{ + public sealed class MaintanenceConfigurationCancellationTests : MaintenanceManagementTestBase + { + private SubscriptionResource _subscription; + private ResourceGroupResource _resourceGroup; + private MaintenanceApplyUpdateCollection _configCollection; + + public MaintanenceConfigurationCancellationTests(bool isAsync) : base(isAsync) //, RecordedTestMode.Record) + { } + + [SetUp] + public async Task Setup() + { + _subscription = await Client.GetDefaultSubscriptionAsync(); + + _resourceGroup = await CreateResourceGroup( + _subscription, + "Maintenance-RG-", + Location); + + _configCollection = _resourceGroup.GetMaintenanceApplyUpdates(); + } + + [TearDown] + public async Task TearDown() + { + await _resourceGroup.DeleteAsync(WaitUntil.Completed); + } + + [RecordedTest] + public async Task MaintenanceConfigurationCancelTest() + { + string resourceName = Recording.GenerateAssetName("maintenance-config-"); + + DateTimeOffset startOn = Recording.UtcNow.AddMinutes(12); + MaintenanceConfigurationResource config = await CreateMaintenanceConfiguration(resourceName, startOn); + Assert.IsNotEmpty(config.Data.Id); + + MaintenanceApplyUpdateData data = new MaintenanceApplyUpdateData() + { + Status = MaintenanceUpdateStatus.Cancel, + }; + string providerName = "Microsoft.Maintenance"; + string resourceType = "maintenanceConfigurations"; + string applyUpdateName = $"{startOn:yyyyMMddHHmm00}"; + + // wait 3 minutes + await Delay(3 * 60 * 1000, playbackDelayMilliseconds: 0); + + // cancel the maintenance + bool retry; + do + { + try + { + retry = false; + ArmOperation lro = await _configCollection.CreateOrUpdateAsync(WaitUntil.Completed, providerName, resourceType, resourceName, applyUpdateName, data); + MaintenanceApplyUpdateResource result = lro.Value; + + Assert.IsTrue(result.HasData); + Assert.AreEqual(result.Data.Status, MaintenanceUpdateStatus.Cancelled); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + retry = true; + await Delay(30 * 1000); + } + else + { + throw ex; + } + } + } while (retry && startOn > DateTime.UtcNow); + + if (retry) + { + Assert.Fail("Maintenance configuration could not be cancelled. Got 404 responses for all tries."); + } + } + + private async Task CreateMaintenanceConfiguration(string resourceName, DateTimeOffset startOn) + { + MaintenanceConfigurationData data = new MaintenanceConfigurationData(Location) + { + Namespace = "Microsoft.Maintenance", + MaintenanceScope = MaintenanceScope.InGuestPatch, + Visibility = MaintenanceConfigurationVisibility.Custom, + StartOn = startOn, + ExpireOn = DateTimeOffset.Parse("9999-12-31 00:00"), + Duration = TimeSpan.Parse("02:00"), + TimeZone = "UTC", + RecurEvery = "Day", + InstallPatches = new MaintenancePatchConfiguration(MaintenanceRebootOption.Always, + new MaintenanceWindowsPatchSettings(new List(), new List(), new List() { "Security", "Critical" }, false), + new MaintenanceLinuxPatchSettings(new List(), new List(), new List() { "Security", "Critical" })) + }; + data.ExtensionProperties.Add("InGuestPatchMode", "User"); + + ArmOperation lro = await _resourceGroup.GetMaintenanceConfigurations().CreateOrUpdateAsync(WaitUntil.Completed, resourceName, data); + + return lro.Value; + } + } +} diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/Azure.ResourceManager.ManagedNetwork.sln b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/Azure.ResourceManager.ManagedNetwork.sln index 23e6bd57ae0c4..5fa5e6d59af2d 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/Azure.ResourceManager.ManagedNetwork.sln +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/Azure.ResourceManager.ManagedNetwork.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{66FDB37C-4C3F-4A8E-8179-8100436787C3}") = "Azure.ResourceManager.ManagedNetwork", "src\Azure.ResourceManager.ManagedNetwork.csproj", "{ED0DE0B2-BE3E-4BCD-BD49-FB64C1A1AE54}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagedNetwork", "src\Azure.ResourceManager.ManagedNetwork.csproj", "{ED0DE0B2-BE3E-4BCD-BD49-FB64C1A1AE54}" EndProject -Project("{66FDB37C-4C3F-4A8E-8179-8100436787C3}") = "Azure.ResourceManager.ManagedNetwork.Tests", "tests\Azure.ResourceManager.ManagedNetwork.Tests.csproj", "{FC290C9B-B085-4B3F-91EF-88A5332F08C7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagedNetwork.Tests", "tests\Azure.ResourceManager.ManagedNetwork.Tests.csproj", "{FC290C9B-B085-4B3F-91EF-88A5332F08C7}" EndProject -Project("{66FDB37C-4C3F-4A8E-8179-8100436787C3}") = "Azure.ResourceManager.ManagedNetwork.Samples", "samples\Azure.ResourceManager.ManagedNetwork.Samples.csproj", "{DA31C2DD-A753-45FE-BD9D-25120213EA53}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagedNetwork.Samples", "samples\Azure.ResourceManager.ManagedNetwork.Samples.csproj", "{DA31C2DD-A753-45FE-BD9D-25120213EA53}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {BC2C69E6-6C35-4618-A6D7-F1A8B999FE39} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {FC290C9B-B085-4B3F-91EF-88A5332F08C7}.Release|x64.Build.0 = Release|Any CPU {FC290C9B-B085-4B3F-91EF-88A5332F08C7}.Release|x86.ActiveCfg = Release|Any CPU {FC290C9B-B085-4B3F-91EF-88A5332F08C7}.Release|x86.Build.0 = Release|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Debug|x64.ActiveCfg = Debug|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Debug|x64.Build.0 = Debug|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Debug|x86.ActiveCfg = Debug|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Debug|x86.Build.0 = Debug|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Release|Any CPU.Build.0 = Release|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Release|x64.ActiveCfg = Release|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Release|x64.Build.0 = Release|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Release|x86.ActiveCfg = Release|Any CPU + {DA31C2DD-A753-45FE-BD9D-25120213EA53}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BC2C69E6-6C35-4618-A6D7-F1A8B999FE39} EndGlobalSection EndGlobal diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/api/Azure.ResourceManager.ManagedNetwork.netstandard2.0.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/api/Azure.ResourceManager.ManagedNetwork.netstandard2.0.cs index 5c4d369fcc396..985046b4dc35a 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/api/Azure.ResourceManager.ManagedNetwork.netstandard2.0.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/api/Azure.ResourceManager.ManagedNetwork.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ManagedNetworkCollection() { } } public partial class ManagedNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedNetworkData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedNetworkData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ManagedNetwork.Models.ConnectivityCollection Connectivity { get { throw null; } } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.ManagedNetwork.Models.ProvisioningState? ProvisioningState { get { throw null; } } @@ -186,6 +186,33 @@ protected ScopeAssignmentResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ManagedNetwork.ScopeAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ManagedNetwork.Mocking +{ + public partial class MockableManagedNetworkArmClient : Azure.ResourceManager.ArmResource + { + protected MockableManagedNetworkArmClient() { } + public virtual Azure.ResourceManager.ManagedNetwork.ManagedNetworkGroupResource GetManagedNetworkGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetwork.ManagedNetworkPeeringPolicyResource GetManagedNetworkPeeringPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetwork.ManagedNetworkResource GetManagedNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetScopeAssignment(Azure.Core.ResourceIdentifier scope, string scopeAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScopeAssignmentAsync(Azure.Core.ResourceIdentifier scope, string scopeAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetwork.ScopeAssignmentResource GetScopeAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetwork.ScopeAssignmentCollection GetScopeAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + } + public partial class MockableManagedNetworkResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableManagedNetworkResourceGroupResource() { } + public virtual Azure.Response GetManagedNetwork(string managedNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedNetworkAsync(string managedNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetwork.ManagedNetworkCollection GetManagedNetworks() { throw null; } + } + public partial class MockableManagedNetworkSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableManagedNetworkSubscriptionResource() { } + public virtual Azure.Pageable GetManagedNetworks(int? top = default(int?), string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedNetworksAsync(int? top = default(int?), string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ManagedNetwork.Models { public static partial class ArmManagedNetworkModelFactory diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index b4748f2700953..0000000000000 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedNetwork -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ScopeAssignmentResources in the ArmResource. - /// An object representing collection of ScopeAssignmentResources and their operations over a ScopeAssignmentResource. - public virtual ScopeAssignmentCollection GetScopeAssignments() - { - return GetCachedClient(Client => new ScopeAssignmentCollection(Client, Id)); - } - } -} diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ManagedNetworkExtensions.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ManagedNetworkExtensions.cs index e9a9c1f7afdb2..6627548a91fbc 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ManagedNetworkExtensions.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ManagedNetworkExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ManagedNetwork.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ManagedNetwork @@ -18,194 +19,170 @@ namespace Azure.ResourceManager.ManagedNetwork /// A class to add extension methods to Azure.ResourceManager.ManagedNetwork. public static partial class ManagedNetworkExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableManagedNetworkArmClient GetMockableManagedNetworkArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableManagedNetworkArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableManagedNetworkResourceGroupResource GetMockableManagedNetworkResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableManagedNetworkResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableManagedNetworkSubscriptionResource GetMockableManagedNetworkSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableManagedNetworkSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + /// + /// Gets a collection of ScopeAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of ScopeAssignmentResources and their operations over a ScopeAssignmentResource. + public static ScopeAssignmentCollection GetScopeAssignments(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return GetMockableManagedNetworkArmClient(client).GetScopeAssignments(scope); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + /// + /// Get the specified scope assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName} + /// + /// + /// Operation Id + /// ScopeAssignments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of the scope assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetScopeAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string scopeAssignmentName, CancellationToken cancellationToken = default) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return await GetMockableManagedNetworkArmClient(client).GetScopeAssignmentAsync(scope, scopeAssignmentName, cancellationToken).ConfigureAwait(false); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + /// + /// Get the specified scope assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName} + /// + /// + /// Operation Id + /// ScopeAssignments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of the scope assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetScopeAssignment(this ArmClient client, ResourceIdentifier scope, string scopeAssignmentName, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return GetMockableManagedNetworkArmClient(client).GetScopeAssignment(scope, scopeAssignmentName, cancellationToken); } - #region ManagedNetworkResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedNetworkResource GetManagedNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedNetworkResource.ValidateResourceId(id); - return new ManagedNetworkResource(client, id); - } - ); + return GetMockableManagedNetworkArmClient(client).GetManagedNetworkResource(id); } - #endregion - #region ScopeAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScopeAssignmentResource GetScopeAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScopeAssignmentResource.ValidateResourceId(id); - return new ScopeAssignmentResource(client, id); - } - ); + return GetMockableManagedNetworkArmClient(client).GetScopeAssignmentResource(id); } - #endregion - #region ManagedNetworkGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedNetworkGroupResource GetManagedNetworkGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedNetworkGroupResource.ValidateResourceId(id); - return new ManagedNetworkGroupResource(client, id); - } - ); + return GetMockableManagedNetworkArmClient(client).GetManagedNetworkGroupResource(id); } - #endregion - #region ManagedNetworkPeeringPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedNetworkPeeringPolicyResource GetManagedNetworkPeeringPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedNetworkPeeringPolicyResource.ValidateResourceId(id); - return new ManagedNetworkPeeringPolicyResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of ScopeAssignmentResources in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of ScopeAssignmentResources and their operations over a ScopeAssignmentResource. - public static ScopeAssignmentCollection GetScopeAssignments(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetScopeAssignments(); + return GetMockableManagedNetworkArmClient(client).GetManagedNetworkPeeringPolicyResource(id); } /// - /// Get the specified scope assignment. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName} - /// + /// Gets a collection of ManagedNetworkResources in the ResourceGroupResource. /// - /// Operation Id - /// ScopeAssignments_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name of the scope assignment to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetScopeAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string scopeAssignmentName, CancellationToken cancellationToken = default) - { - return await client.GetScopeAssignments(scope).GetAsync(scopeAssignmentName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the specified scope assignment. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName} - /// - /// - /// Operation Id - /// ScopeAssignments_Get - /// - /// - /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name of the scope assignment to get. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetScopeAssignment(this ArmClient client, ResourceIdentifier scope, string scopeAssignmentName, CancellationToken cancellationToken = default) - { - return client.GetScopeAssignments(scope).Get(scopeAssignmentName, cancellationToken); - } - - /// Gets a collection of ManagedNetworkResources in the ResourceGroupResource. /// The instance the method will execute against. /// An object representing collection of ManagedNetworkResources and their operations over a ManagedNetworkResource. public static ManagedNetworkCollection GetManagedNetworks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetManagedNetworks(); + return GetMockableManagedNetworkResourceGroupResource(resourceGroupResource).GetManagedNetworks(); } /// @@ -220,16 +197,20 @@ public static ManagedNetworkCollection GetManagedNetworks(this ResourceGroupReso /// ManagedNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Managed Network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedNetworkAsync(this ResourceGroupResource resourceGroupResource, string managedNetworkName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetManagedNetworks().GetAsync(managedNetworkName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkResourceGroupResource(resourceGroupResource).GetManagedNetworkAsync(managedNetworkName, cancellationToken).ConfigureAwait(false); } /// @@ -244,16 +225,20 @@ public static async Task> GetManagedNetworkAsyn /// ManagedNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Managed Network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedNetwork(this ResourceGroupResource resourceGroupResource, string managedNetworkName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetManagedNetworks().Get(managedNetworkName, cancellationToken); + return GetMockableManagedNetworkResourceGroupResource(resourceGroupResource).GetManagedNetwork(managedNetworkName, cancellationToken); } /// @@ -268,6 +253,10 @@ public static Response GetManagedNetwork(this ResourceGr /// ManagedNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// May be used to limit the number of results in a page for list queries. @@ -276,7 +265,7 @@ public static Response GetManagedNetwork(this ResourceGr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetManagedNetworksAsync(this SubscriptionResource subscriptionResource, int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedNetworksAsync(top, skiptoken, cancellationToken); + return GetMockableManagedNetworkSubscriptionResource(subscriptionResource).GetManagedNetworksAsync(top, skiptoken, cancellationToken); } /// @@ -291,6 +280,10 @@ public static AsyncPageable GetManagedNetworksAsync(this /// ManagedNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// May be used to limit the number of results in a page for list queries. @@ -299,7 +292,7 @@ public static AsyncPageable GetManagedNetworksAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetManagedNetworks(this SubscriptionResource subscriptionResource, int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedNetworks(top, skiptoken, cancellationToken); + return GetMockableManagedNetworkSubscriptionResource(subscriptionResource).GetManagedNetworks(top, skiptoken, cancellationToken); } } } diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkArmClient.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkArmClient.cs new file mode 100644 index 0000000000000..99d315433c733 --- /dev/null +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkArmClient.cs @@ -0,0 +1,147 @@ +// 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.ManagedNetwork; + +namespace Azure.ResourceManager.ManagedNetwork.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableManagedNetworkArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedNetworkArmClient() + { + } + + /// 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 MockableManagedNetworkArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableManagedNetworkArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ScopeAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of ScopeAssignmentResources and their operations over a ScopeAssignmentResource. + public virtual ScopeAssignmentCollection GetScopeAssignments(ResourceIdentifier scope) + { + return new ScopeAssignmentCollection(Client, scope); + } + + /// + /// Get the specified scope assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName} + /// + /// + /// Operation Id + /// ScopeAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the scope assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScopeAssignmentAsync(ResourceIdentifier scope, string scopeAssignmentName, CancellationToken cancellationToken = default) + { + return await GetScopeAssignments(scope).GetAsync(scopeAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the specified scope assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName} + /// + /// + /// Operation Id + /// ScopeAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the scope assignment to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScopeAssignment(ResourceIdentifier scope, string scopeAssignmentName, CancellationToken cancellationToken = default) + { + return GetScopeAssignments(scope).Get(scopeAssignmentName, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedNetworkResource GetManagedNetworkResource(ResourceIdentifier id) + { + ManagedNetworkResource.ValidateResourceId(id); + return new ManagedNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScopeAssignmentResource GetScopeAssignmentResource(ResourceIdentifier id) + { + ScopeAssignmentResource.ValidateResourceId(id); + return new ScopeAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedNetworkGroupResource GetManagedNetworkGroupResource(ResourceIdentifier id) + { + ManagedNetworkGroupResource.ValidateResourceId(id); + return new ManagedNetworkGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedNetworkPeeringPolicyResource GetManagedNetworkPeeringPolicyResource(ResourceIdentifier id) + { + ManagedNetworkPeeringPolicyResource.ValidateResourceId(id); + return new ManagedNetworkPeeringPolicyResource(Client, id); + } + } +} diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkResourceGroupResource.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkResourceGroupResource.cs new file mode 100644 index 0000000000000..ccf32b59092ee --- /dev/null +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ManagedNetwork; + +namespace Azure.ResourceManager.ManagedNetwork.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableManagedNetworkResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedNetworkResourceGroupResource() + { + } + + /// 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 MockableManagedNetworkResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ManagedNetworkResources in the ResourceGroupResource. + /// An object representing collection of ManagedNetworkResources and their operations over a ManagedNetworkResource. + public virtual ManagedNetworkCollection GetManagedNetworks() + { + return GetCachedClient(client => new ManagedNetworkCollection(client, Id)); + } + + /// + /// The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed Network name + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName} + /// + /// + /// Operation Id + /// ManagedNetworks_Get + /// + /// + /// + /// The name of the Managed Network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedNetworkAsync(string managedNetworkName, CancellationToken cancellationToken = default) + { + return await GetManagedNetworks().GetAsync(managedNetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// The Get ManagedNetworks operation gets a Managed Network Resource, specified by the resource group and Managed Network name + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName} + /// + /// + /// Operation Id + /// ManagedNetworks_Get + /// + /// + /// + /// The name of the Managed Network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedNetwork(string managedNetworkName, CancellationToken cancellationToken = default) + { + return GetManagedNetworks().Get(managedNetworkName, cancellationToken); + } + } +} diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkSubscriptionResource.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkSubscriptionResource.cs new file mode 100644 index 0000000000000..f553c6b133173 --- /dev/null +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/MockableManagedNetworkSubscriptionResource.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ManagedNetwork; + +namespace Azure.ResourceManager.ManagedNetwork.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableManagedNetworkSubscriptionResource : ArmResource + { + private ClientDiagnostics _managedNetworkClientDiagnostics; + private ManagedNetworksRestOperations _managedNetworkRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableManagedNetworkSubscriptionResource() + { + } + + /// 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 MockableManagedNetworkSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ManagedNetworkClientDiagnostics => _managedNetworkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetwork", ManagedNetworkResource.ResourceType.Namespace, Diagnostics); + private ManagedNetworksRestOperations ManagedNetworkRestClient => _managedNetworkRestClient ??= new ManagedNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedNetworkResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current subscription in a paginated format. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetwork/managedNetworks + /// + /// + /// Operation Id + /// ManagedNetworks_ListBySubscription + /// + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedNetworksAsync(int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedNetworkRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedNetworkRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, skiptoken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedNetworkResource(Client, ManagedNetworkData.DeserializeManagedNetworkData(e)), ManagedNetworkClientDiagnostics, Pipeline, "MockableManagedNetworkSubscriptionResource.GetManagedNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current subscription in a paginated format. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetwork/managedNetworks + /// + /// + /// Operation Id + /// ManagedNetworks_ListBySubscription + /// + /// + /// + /// May be used to limit the number of results in a page for list queries. + /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedNetworks(int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedNetworkRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedNetworkRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, skiptoken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedNetworkResource(Client, ManagedNetworkData.DeserializeManagedNetworkData(e)), ManagedNetworkClientDiagnostics, Pipeline, "MockableManagedNetworkSubscriptionResource.GetManagedNetworks", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index fe9b5263ac21b..0000000000000 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedNetwork -{ - /// 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 ManagedNetworkResources in the ResourceGroupResource. - /// An object representing collection of ManagedNetworkResources and their operations over a ManagedNetworkResource. - public virtual ManagedNetworkCollection GetManagedNetworks() - { - return GetCachedClient(Client => new ManagedNetworkCollection(Client, Id)); - } - } -} diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 72855a96bf582..0000000000000 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedNetwork -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _managedNetworkClientDiagnostics; - private ManagedNetworksRestOperations _managedNetworkRestClient; - - /// 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 ManagedNetworkClientDiagnostics => _managedNetworkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetwork", ManagedNetworkResource.ResourceType.Namespace, Diagnostics); - private ManagedNetworksRestOperations ManagedNetworkRestClient => _managedNetworkRestClient ??= new ManagedNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedNetworkResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current subscription in a paginated format. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetwork/managedNetworks - /// - /// - /// Operation Id - /// ManagedNetworks_ListBySubscription - /// - /// - /// - /// May be used to limit the number of results in a page for list queries. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedNetworksAsync(int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedNetworkRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedNetworkRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, skiptoken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedNetworkResource(Client, ManagedNetworkData.DeserializeManagedNetworkData(e)), ManagedNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current subscription in a paginated format. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetwork/managedNetworks - /// - /// - /// Operation Id - /// ManagedNetworks_ListBySubscription - /// - /// - /// - /// May be used to limit the number of results in a page for list queries. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedNetworks(int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedNetworkRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedNetworkRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, skiptoken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedNetworkResource(Client, ManagedNetworkData.DeserializeManagedNetworkData(e)), ManagedNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedNetworks", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkGroupResource.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkGroupResource.cs index af35cbe858bec..d44f52723a510 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkGroupResource.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ManagedNetwork public partial class ManagedNetworkGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedNetworkName. + /// The managedNetworkGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedNetworkName, string managedNetworkGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkGroups/{managedNetworkGroupName}"; diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkPeeringPolicyResource.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkPeeringPolicyResource.cs index 5a2da847054c2..c621d06cd6565 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkPeeringPolicyResource.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkPeeringPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ManagedNetwork public partial class ManagedNetworkPeeringPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedNetworkName. + /// The managedNetworkPeeringPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedNetworkName, string managedNetworkPeeringPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}/managedNetworkPeeringPolicies/{managedNetworkPeeringPolicyName}"; diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkResource.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkResource.cs index 684dab362b6c1..9ae517a788450 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkResource.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetwork public partial class ManagedNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetwork/managedNetworks/{managedNetworkName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedNetworkGroupResources and their operations over a ManagedNetworkGroupResource. public virtual ManagedNetworkGroupCollection GetManagedNetworkGroups() { - return GetCachedClient(Client => new ManagedNetworkGroupCollection(Client, Id)); + return GetCachedClient(client => new ManagedNetworkGroupCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ManagedNetworkGroupCollection GetManagedNetworkGroups() /// /// The name of the Managed Network Group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedNetworkGroupAsync(string managedNetworkGroupName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetManagedNetwo /// /// The name of the Managed Network Group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedNetworkGroup(string managedNetworkGroupName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetManagedNetworkGroup(stri /// An object representing collection of ManagedNetworkPeeringPolicyResources and their operations over a ManagedNetworkPeeringPolicyResource. public virtual ManagedNetworkPeeringPolicyCollection GetManagedNetworkPeeringPolicies() { - return GetCachedClient(Client => new ManagedNetworkPeeringPolicyCollection(Client, Id)); + return GetCachedClient(client => new ManagedNetworkPeeringPolicyCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual ManagedNetworkPeeringPolicyCollection GetManagedNetworkPeeringPol /// /// The name of the Managed Network Peering Policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedNetworkPeeringPolicyAsync(string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetMana /// /// The name of the Managed Network Peering Policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedNetworkPeeringPolicy(string managedNetworkPeeringPolicyName, CancellationToken cancellationToken = default) { diff --git a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ScopeAssignmentResource.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ScopeAssignmentResource.cs index f0681b979dace..d795144c2f0ef 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ScopeAssignmentResource.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ScopeAssignmentResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.ManagedNetwork public partial class ScopeAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The scopeAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string scopeAssignmentName) { var resourceId = $"{scope}/providers/Microsoft.ManagedNetwork/scopeAssignments/{scopeAssignmentName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/api/Azure.ResourceManager.ManagedNetworkFabric.netstandard2.0.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/api/Azure.ResourceManager.ManagedNetworkFabric.netstandard2.0.cs index 98be44b3929ad..98e2f72b07e19 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/api/Azure.ResourceManager.ManagedNetworkFabric.netstandard2.0.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/api/Azure.ResourceManager.ManagedNetworkFabric.netstandard2.0.cs @@ -136,7 +136,7 @@ protected NetworkDeviceCollection() { } } public partial class NetworkDeviceData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkDeviceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetworkDeviceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricConfigurationState? ConfigurationState { get { throw null; } } @@ -280,7 +280,7 @@ protected NetworkFabricAccessControlListCollection() { } } public partial class NetworkFabricAccessControlListData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricAccessControlListData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricAccessControlListData(Azure.Core.AzureLocation location) { } public System.Uri AclsUri { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } @@ -354,7 +354,7 @@ protected NetworkFabricControllerCollection() { } } public partial class NetworkFabricControllerData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricControllerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricControllerData(Azure.Core.AzureLocation location) { } public string Annotation { get { throw null; } set { } } public System.Collections.Generic.IList InfrastructureExpressRouteConnections { get { throw null; } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricControllerServices InfrastructureServices { get { throw null; } } @@ -392,7 +392,7 @@ protected NetworkFabricControllerResource() { } } public partial class NetworkFabricData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricData(Azure.Core.AzureLocation location, string networkFabricSku, Azure.Core.ResourceIdentifier networkFabricControllerId, int serverCountPerRack, string ipv4Prefix, long fabricAsn, Azure.ResourceManager.ManagedNetworkFabric.Models.TerminalServerConfiguration terminalServerConfiguration, Azure.ResourceManager.ManagedNetworkFabric.Models.ManagementNetworkConfigurationProperties managementNetworkConfiguration) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricData(Azure.Core.AzureLocation location, string networkFabricSku, Azure.Core.ResourceIdentifier networkFabricControllerId, int serverCountPerRack, string ipv4Prefix, long fabricAsn, Azure.ResourceManager.ManagedNetworkFabric.Models.TerminalServerConfiguration terminalServerConfiguration, Azure.ResourceManager.ManagedNetworkFabric.Models.ManagementNetworkConfigurationProperties managementNetworkConfiguration) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricConfigurationState? ConfigurationState { get { throw null; } } @@ -539,7 +539,7 @@ protected NetworkFabricInternetGatewayCollection() { } } public partial class NetworkFabricInternetGatewayData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricInternetGatewayData(Azure.Core.AzureLocation location, Azure.ResourceManager.ManagedNetworkFabric.Models.InternetGatewayType typePropertiesType, Azure.Core.ResourceIdentifier networkFabricControllerId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricInternetGatewayData(Azure.Core.AzureLocation location, Azure.ResourceManager.ManagedNetworkFabric.Models.InternetGatewayType typePropertiesType, Azure.Core.ResourceIdentifier networkFabricControllerId) { } public string Annotation { get { throw null; } set { } } public Azure.Core.ResourceIdentifier InternetGatewayRuleId { get { throw null; } set { } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -588,7 +588,7 @@ protected NetworkFabricInternetGatewayRuleCollection() { } } public partial class NetworkFabricInternetGatewayRuleData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricInternetGatewayRuleData(Azure.Core.AzureLocation location, Azure.ResourceManager.ManagedNetworkFabric.Models.InternetGatewayRules ruleProperties) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricInternetGatewayRuleData(Azure.Core.AzureLocation location, Azure.ResourceManager.ManagedNetworkFabric.Models.InternetGatewayRules ruleProperties) { } public string Annotation { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList InternetGatewayIds { get { throw null; } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricProvisioningState? ProvisioningState { get { throw null; } } @@ -633,7 +633,7 @@ protected NetworkFabricIPCommunityCollection() { } } public partial class NetworkFabricIPCommunityData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricIPCommunityData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricIPCommunityData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricConfigurationState? ConfigurationState { get { throw null; } } @@ -679,7 +679,7 @@ protected NetworkFabricIPExtendedCommunityCollection() { } } public partial class NetworkFabricIPExtendedCommunityData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricIPExtendedCommunityData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable ipExtendedCommunityRules) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricIPExtendedCommunityData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable ipExtendedCommunityRules) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricConfigurationState? ConfigurationState { get { throw null; } } @@ -725,7 +725,7 @@ protected NetworkFabricIPPrefixCollection() { } } public partial class NetworkFabricIPPrefixData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricIPPrefixData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricIPPrefixData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricConfigurationState? ConfigurationState { get { throw null; } } @@ -771,7 +771,7 @@ protected NetworkFabricL2IsolationDomainCollection() { } } public partial class NetworkFabricL2IsolationDomainData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricL2IsolationDomainData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId, int vlanId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricL2IsolationDomainData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId, int vlanId) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricConfigurationState? ConfigurationState { get { throw null; } } @@ -825,7 +825,7 @@ protected NetworkFabricL3IsolationDomainCollection() { } } public partial class NetworkFabricL3IsolationDomainData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricL3IsolationDomainData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricL3IsolationDomainData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public Azure.ResourceManager.ManagedNetworkFabric.Models.AggregateRouteConfiguration AggregateRouteConfiguration { get { throw null; } set { } } public string Annotation { get { throw null; } set { } } @@ -887,7 +887,7 @@ protected NetworkFabricNeighborGroupCollection() { } } public partial class NetworkFabricNeighborGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricNeighborGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricNeighborGroupData(Azure.Core.AzureLocation location) { } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NeighborGroupDestination Destination { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList NetworkTapIds { get { throw null; } } @@ -974,7 +974,7 @@ protected NetworkFabricRoutePolicyCollection() { } } public partial class NetworkFabricRoutePolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkFabricRoutePolicyData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkFabricRoutePolicyData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.AddressFamilyType? AddressFamilyType { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } @@ -1064,7 +1064,7 @@ protected NetworkPacketBrokerCollection() { } } public partial class NetworkPacketBrokerData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkPacketBrokerData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkPacketBrokerData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId) { } public System.Collections.Generic.IReadOnlyList NeighborGroupIds { get { throw null; } } public System.Collections.Generic.IReadOnlyList NetworkDeviceIds { get { throw null; } } public Azure.Core.ResourceIdentifier NetworkFabricId { get { throw null; } set { } } @@ -1111,7 +1111,7 @@ protected NetworkRackCollection() { } } public partial class NetworkRackData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkRackData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkRackData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkFabricId) { } public string Annotation { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList NetworkDevices { get { throw null; } } public Azure.Core.ResourceIdentifier NetworkFabricId { get { throw null; } set { } } @@ -1157,7 +1157,7 @@ protected NetworkTapCollection() { } } public partial class NetworkTapData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkTapData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkPacketBrokerId, System.Collections.Generic.IEnumerable destinations) : base (default(Azure.Core.AzureLocation)) { } + public NetworkTapData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier networkPacketBrokerId, System.Collections.Generic.IEnumerable destinations) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricConfigurationState? ConfigurationState { get { throw null; } } @@ -1210,7 +1210,7 @@ protected NetworkTapRuleCollection() { } } public partial class NetworkTapRuleData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkTapRuleData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetworkTapRuleData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricAdministrativeState? AdministrativeState { get { throw null; } } public string Annotation { get { throw null; } set { } } public Azure.ResourceManager.ManagedNetworkFabric.Models.NetworkFabricConfigurationState? ConfigurationState { get { throw null; } } @@ -1302,6 +1302,135 @@ protected NetworkToNetworkInterconnectResource() { } public virtual System.Threading.Tasks.Task> UpdateNpbStaticRouteBfdAdministrativeStateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ManagedNetworkFabric.Models.UpdateAdministrativeStateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ManagedNetworkFabric.Mocking +{ + public partial class MockableManagedNetworkFabricArmClient : Azure.ResourceManager.ArmResource + { + protected MockableManagedNetworkFabricArmClient() { } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkDeviceInterfaceResource GetNetworkDeviceInterfaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkDeviceResource GetNetworkDeviceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkDeviceSkuResource GetNetworkDeviceSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricAccessControlListResource GetNetworkFabricAccessControlListResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricControllerResource GetNetworkFabricControllerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricExternalNetworkResource GetNetworkFabricExternalNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricInternalNetworkResource GetNetworkFabricInternalNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricInternetGatewayResource GetNetworkFabricInternetGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricInternetGatewayRuleResource GetNetworkFabricInternetGatewayRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricIPCommunityResource GetNetworkFabricIPCommunityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricIPExtendedCommunityResource GetNetworkFabricIPExtendedCommunityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricIPPrefixResource GetNetworkFabricIPPrefixResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricL2IsolationDomainResource GetNetworkFabricL2IsolationDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricL3IsolationDomainResource GetNetworkFabricL3IsolationDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricNeighborGroupResource GetNetworkFabricNeighborGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricResource GetNetworkFabricResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricRoutePolicyResource GetNetworkFabricRoutePolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricSkuResource GetNetworkFabricSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkPacketBrokerResource GetNetworkPacketBrokerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkRackResource GetNetworkRackResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkTapResource GetNetworkTapResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkTapRuleResource GetNetworkTapRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkToNetworkInterconnectResource GetNetworkToNetworkInterconnectResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableManagedNetworkFabricResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableManagedNetworkFabricResourceGroupResource() { } + public virtual Azure.Response GetNetworkDevice(string networkDeviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkDeviceAsync(string networkDeviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkDeviceCollection GetNetworkDevices() { throw null; } + public virtual Azure.Response GetNetworkFabric(string networkFabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkFabricAccessControlList(string accessControlListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricAccessControlListAsync(string accessControlListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricAccessControlListCollection GetNetworkFabricAccessControlLists() { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricAsync(string networkFabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkFabricController(string networkFabricControllerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricControllerAsync(string networkFabricControllerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricControllerCollection GetNetworkFabricControllers() { throw null; } + public virtual Azure.Response GetNetworkFabricInternetGateway(string internetGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricInternetGatewayAsync(string internetGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkFabricInternetGatewayRule(string internetGatewayRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricInternetGatewayRuleAsync(string internetGatewayRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricInternetGatewayRuleCollection GetNetworkFabricInternetGatewayRules() { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricInternetGatewayCollection GetNetworkFabricInternetGateways() { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricIPCommunityCollection GetNetworkFabricIPCommunities() { throw null; } + public virtual Azure.Response GetNetworkFabricIPCommunity(string ipCommunityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricIPCommunityAsync(string ipCommunityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricIPExtendedCommunityCollection GetNetworkFabricIPExtendedCommunities() { throw null; } + public virtual Azure.Response GetNetworkFabricIPExtendedCommunity(string ipExtendedCommunityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricIPExtendedCommunityAsync(string ipExtendedCommunityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkFabricIPPrefix(string ipPrefixName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricIPPrefixAsync(string ipPrefixName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricIPPrefixCollection GetNetworkFabricIPPrefixes() { throw null; } + public virtual Azure.Response GetNetworkFabricL2IsolationDomain(string l2IsolationDomainName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricL2IsolationDomainAsync(string l2IsolationDomainName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricL2IsolationDomainCollection GetNetworkFabricL2IsolationDomains() { throw null; } + public virtual Azure.Response GetNetworkFabricL3IsolationDomain(string l3IsolationDomainName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricL3IsolationDomainAsync(string l3IsolationDomainName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricL3IsolationDomainCollection GetNetworkFabricL3IsolationDomains() { throw null; } + public virtual Azure.Response GetNetworkFabricNeighborGroup(string neighborGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricNeighborGroupAsync(string neighborGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricNeighborGroupCollection GetNetworkFabricNeighborGroups() { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricRoutePolicyCollection GetNetworkFabricRoutePolicies() { throw null; } + public virtual Azure.Response GetNetworkFabricRoutePolicy(string routePolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricRoutePolicyAsync(string routePolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricCollection GetNetworkFabrics() { throw null; } + public virtual Azure.Response GetNetworkPacketBroker(string networkPacketBrokerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkPacketBrokerAsync(string networkPacketBrokerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkPacketBrokerCollection GetNetworkPacketBrokers() { throw null; } + public virtual Azure.Response GetNetworkRack(string networkRackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkRackAsync(string networkRackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkRackCollection GetNetworkRacks() { throw null; } + public virtual Azure.Response GetNetworkTap(string networkTapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkTapAsync(string networkTapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkTapRule(string networkTapRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkTapRuleAsync(string networkTapRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkTapRuleCollection GetNetworkTapRules() { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkTapCollection GetNetworkTaps() { throw null; } + } + public partial class MockableManagedNetworkFabricSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableManagedNetworkFabricSubscriptionResource() { } + public virtual Azure.Pageable GetNetworkDevices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkDevicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkDeviceSku(string networkDeviceSkuName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkDeviceSkuAsync(string networkDeviceSkuName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkDeviceSkuCollection GetNetworkDeviceSkus() { throw null; } + public virtual Azure.Pageable GetNetworkFabricAccessControlLists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricAccessControlListsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricControllers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricControllersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricInternetGatewayRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricInternetGatewayRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricInternetGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricInternetGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricIPCommunities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricIPCommunitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricIPExtendedCommunities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricIPExtendedCommunitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricIPPrefixes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricIPPrefixesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricL2IsolationDomains(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricL2IsolationDomainsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricL3IsolationDomains(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricL3IsolationDomainsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricNeighborGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricNeighborGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabricRoutePolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricRoutePoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkFabrics(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkFabricsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkFabricSku(string networkFabricSkuName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkFabricSkuAsync(string networkFabricSkuName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedNetworkFabric.NetworkFabricSkuCollection GetNetworkFabricSkus() { throw null; } + public virtual Azure.Pageable GetNetworkPacketBrokers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkPacketBrokersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkRacks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkRacksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkTapRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkTapRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkTaps(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkTapsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ManagedNetworkFabric.Models { public partial class AccessControlListAction diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ManagedNetworkFabricExtensions.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ManagedNetworkFabricExtensions.cs index 6cab632a853a0..65065db33f70b 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ManagedNetworkFabricExtensions.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ManagedNetworkFabricExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ManagedNetworkFabric.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ManagedNetworkFabric @@ -18,480 +19,401 @@ namespace Azure.ResourceManager.ManagedNetworkFabric /// A class to add extension methods to Azure.ResourceManager.ManagedNetworkFabric. public static partial class ManagedNetworkFabricExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableManagedNetworkFabricArmClient GetMockableManagedNetworkFabricArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableManagedNetworkFabricArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableManagedNetworkFabricResourceGroupResource GetMockableManagedNetworkFabricResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableManagedNetworkFabricResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableManagedNetworkFabricSubscriptionResource GetMockableManagedNetworkFabricSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableManagedNetworkFabricSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region NetworkFabricAccessControlListResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricAccessControlListResource GetNetworkFabricAccessControlListResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricAccessControlListResource.ValidateResourceId(id); - return new NetworkFabricAccessControlListResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricAccessControlListResource(id); } - #endregion - #region NetworkFabricInternetGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricInternetGatewayResource GetNetworkFabricInternetGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricInternetGatewayResource.ValidateResourceId(id); - return new NetworkFabricInternetGatewayResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricInternetGatewayResource(id); } - #endregion - #region NetworkFabricInternetGatewayRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricInternetGatewayRuleResource GetNetworkFabricInternetGatewayRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricInternetGatewayRuleResource.ValidateResourceId(id); - return new NetworkFabricInternetGatewayRuleResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricInternetGatewayRuleResource(id); } - #endregion - #region NetworkFabricIPCommunityResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricIPCommunityResource GetNetworkFabricIPCommunityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricIPCommunityResource.ValidateResourceId(id); - return new NetworkFabricIPCommunityResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricIPCommunityResource(id); } - #endregion - #region NetworkFabricIPExtendedCommunityResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricIPExtendedCommunityResource GetNetworkFabricIPExtendedCommunityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricIPExtendedCommunityResource.ValidateResourceId(id); - return new NetworkFabricIPExtendedCommunityResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricIPExtendedCommunityResource(id); } - #endregion - #region NetworkFabricIPPrefixResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricIPPrefixResource GetNetworkFabricIPPrefixResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricIPPrefixResource.ValidateResourceId(id); - return new NetworkFabricIPPrefixResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricIPPrefixResource(id); } - #endregion - #region NetworkFabricL2IsolationDomainResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricL2IsolationDomainResource GetNetworkFabricL2IsolationDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricL2IsolationDomainResource.ValidateResourceId(id); - return new NetworkFabricL2IsolationDomainResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricL2IsolationDomainResource(id); } - #endregion - #region NetworkFabricL3IsolationDomainResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricL3IsolationDomainResource GetNetworkFabricL3IsolationDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricL3IsolationDomainResource.ValidateResourceId(id); - return new NetworkFabricL3IsolationDomainResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricL3IsolationDomainResource(id); } - #endregion - #region NetworkFabricInternalNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricInternalNetworkResource GetNetworkFabricInternalNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricInternalNetworkResource.ValidateResourceId(id); - return new NetworkFabricInternalNetworkResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricInternalNetworkResource(id); } - #endregion - #region NetworkFabricExternalNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricExternalNetworkResource GetNetworkFabricExternalNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricExternalNetworkResource.ValidateResourceId(id); - return new NetworkFabricExternalNetworkResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricExternalNetworkResource(id); } - #endregion - #region NetworkFabricNeighborGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricNeighborGroupResource GetNetworkFabricNeighborGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricNeighborGroupResource.ValidateResourceId(id); - return new NetworkFabricNeighborGroupResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricNeighborGroupResource(id); } - #endregion - #region NetworkDeviceSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkDeviceSkuResource GetNetworkDeviceSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkDeviceSkuResource.ValidateResourceId(id); - return new NetworkDeviceSkuResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkDeviceSkuResource(id); } - #endregion - #region NetworkDeviceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkDeviceResource GetNetworkDeviceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkDeviceResource.ValidateResourceId(id); - return new NetworkDeviceResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkDeviceResource(id); } - #endregion - #region NetworkDeviceInterfaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkDeviceInterfaceResource GetNetworkDeviceInterfaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkDeviceInterfaceResource.ValidateResourceId(id); - return new NetworkDeviceInterfaceResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkDeviceInterfaceResource(id); } - #endregion - #region NetworkFabricControllerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricControllerResource GetNetworkFabricControllerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricControllerResource.ValidateResourceId(id); - return new NetworkFabricControllerResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricControllerResource(id); } - #endregion - #region NetworkFabricSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricSkuResource GetNetworkFabricSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricSkuResource.ValidateResourceId(id); - return new NetworkFabricSkuResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricSkuResource(id); } - #endregion - #region NetworkFabricResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricResource GetNetworkFabricResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricResource.ValidateResourceId(id); - return new NetworkFabricResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricResource(id); } - #endregion - #region NetworkToNetworkInterconnectResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkToNetworkInterconnectResource GetNetworkToNetworkInterconnectResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkToNetworkInterconnectResource.ValidateResourceId(id); - return new NetworkToNetworkInterconnectResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkToNetworkInterconnectResource(id); } - #endregion - #region NetworkPacketBrokerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkPacketBrokerResource GetNetworkPacketBrokerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkPacketBrokerResource.ValidateResourceId(id); - return new NetworkPacketBrokerResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkPacketBrokerResource(id); } - #endregion - #region NetworkRackResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkRackResource GetNetworkRackResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkRackResource.ValidateResourceId(id); - return new NetworkRackResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkRackResource(id); } - #endregion - #region NetworkTapRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkTapRuleResource GetNetworkTapRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkTapRuleResource.ValidateResourceId(id); - return new NetworkTapRuleResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkTapRuleResource(id); } - #endregion - #region NetworkTapResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkTapResource GetNetworkTapResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkTapResource.ValidateResourceId(id); - return new NetworkTapResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkTapResource(id); } - #endregion - #region NetworkFabricRoutePolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFabricRoutePolicyResource GetNetworkFabricRoutePolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFabricRoutePolicyResource.ValidateResourceId(id); - return new NetworkFabricRoutePolicyResource(client, id); - } - ); + return GetMockableManagedNetworkFabricArmClient(client).GetNetworkFabricRoutePolicyResource(id); } - #endregion - /// Gets a collection of NetworkFabricAccessControlListResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricAccessControlListResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricAccessControlListResources and their operations over a NetworkFabricAccessControlListResource. public static NetworkFabricAccessControlListCollection GetNetworkFabricAccessControlLists(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricAccessControlLists(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricAccessControlLists(); } /// @@ -506,16 +428,20 @@ public static NetworkFabricAccessControlListCollection GetNetworkFabricAccessCon /// AccessControlLists_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Access Control List. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricAccessControlListAsync(this ResourceGroupResource resourceGroupResource, string accessControlListName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricAccessControlLists().GetAsync(accessControlListName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricAccessControlListAsync(accessControlListName, cancellationToken).ConfigureAwait(false); } /// @@ -530,24 +456,34 @@ public static async Task> GetNe /// AccessControlLists_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Access Control List. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricAccessControlList(this ResourceGroupResource resourceGroupResource, string accessControlListName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricAccessControlLists().Get(accessControlListName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricAccessControlList(accessControlListName, cancellationToken); } - /// Gets a collection of NetworkFabricInternetGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricInternetGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricInternetGatewayResources and their operations over a NetworkFabricInternetGatewayResource. public static NetworkFabricInternetGatewayCollection GetNetworkFabricInternetGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricInternetGateways(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricInternetGateways(); } /// @@ -562,16 +498,20 @@ public static NetworkFabricInternetGatewayCollection GetNetworkFabricInternetGat /// InternetGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Internet Gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricInternetGatewayAsync(this ResourceGroupResource resourceGroupResource, string internetGatewayName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricInternetGateways().GetAsync(internetGatewayName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricInternetGatewayAsync(internetGatewayName, cancellationToken).ConfigureAwait(false); } /// @@ -586,24 +526,34 @@ public static async Task> GetNetw /// InternetGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Internet Gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricInternetGateway(this ResourceGroupResource resourceGroupResource, string internetGatewayName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricInternetGateways().Get(internetGatewayName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricInternetGateway(internetGatewayName, cancellationToken); } - /// Gets a collection of NetworkFabricInternetGatewayRuleResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricInternetGatewayRuleResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricInternetGatewayRuleResources and their operations over a NetworkFabricInternetGatewayRuleResource. public static NetworkFabricInternetGatewayRuleCollection GetNetworkFabricInternetGatewayRules(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricInternetGatewayRules(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricInternetGatewayRules(); } /// @@ -618,16 +568,20 @@ public static NetworkFabricInternetGatewayRuleCollection GetNetworkFabricInterne /// InternetGatewayRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Internet Gateway rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricInternetGatewayRuleAsync(this ResourceGroupResource resourceGroupResource, string internetGatewayRuleName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricInternetGatewayRules().GetAsync(internetGatewayRuleName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricInternetGatewayRuleAsync(internetGatewayRuleName, cancellationToken).ConfigureAwait(false); } /// @@ -642,24 +596,34 @@ public static async Task> Get /// InternetGatewayRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Internet Gateway rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricInternetGatewayRule(this ResourceGroupResource resourceGroupResource, string internetGatewayRuleName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricInternetGatewayRules().Get(internetGatewayRuleName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricInternetGatewayRule(internetGatewayRuleName, cancellationToken); } - /// Gets a collection of NetworkFabricIPCommunityResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricIPCommunityResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricIPCommunityResources and their operations over a NetworkFabricIPCommunityResource. public static NetworkFabricIPCommunityCollection GetNetworkFabricIPCommunities(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricIPCommunities(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPCommunities(); } /// @@ -674,16 +638,20 @@ public static NetworkFabricIPCommunityCollection GetNetworkFabricIPCommunities(t /// IpCommunities_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the IP Community. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricIPCommunityAsync(this ResourceGroupResource resourceGroupResource, string ipCommunityName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricIPCommunities().GetAsync(ipCommunityName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPCommunityAsync(ipCommunityName, cancellationToken).ConfigureAwait(false); } /// @@ -698,24 +666,34 @@ public static async Task> GetNetworkF /// IpCommunities_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the IP Community. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricIPCommunity(this ResourceGroupResource resourceGroupResource, string ipCommunityName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricIPCommunities().Get(ipCommunityName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPCommunity(ipCommunityName, cancellationToken); } - /// Gets a collection of NetworkFabricIPExtendedCommunityResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricIPExtendedCommunityResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricIPExtendedCommunityResources and their operations over a NetworkFabricIPExtendedCommunityResource. public static NetworkFabricIPExtendedCommunityCollection GetNetworkFabricIPExtendedCommunities(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricIPExtendedCommunities(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPExtendedCommunities(); } /// @@ -730,16 +708,20 @@ public static NetworkFabricIPExtendedCommunityCollection GetNetworkFabricIPExten /// IpExtendedCommunities_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the IP Extended Community. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricIPExtendedCommunityAsync(this ResourceGroupResource resourceGroupResource, string ipExtendedCommunityName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricIPExtendedCommunities().GetAsync(ipExtendedCommunityName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPExtendedCommunityAsync(ipExtendedCommunityName, cancellationToken).ConfigureAwait(false); } /// @@ -754,24 +736,34 @@ public static async Task> Get /// IpExtendedCommunities_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the IP Extended Community. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricIPExtendedCommunity(this ResourceGroupResource resourceGroupResource, string ipExtendedCommunityName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricIPExtendedCommunities().Get(ipExtendedCommunityName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPExtendedCommunity(ipExtendedCommunityName, cancellationToken); } - /// Gets a collection of NetworkFabricIPPrefixResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricIPPrefixResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricIPPrefixResources and their operations over a NetworkFabricIPPrefixResource. public static NetworkFabricIPPrefixCollection GetNetworkFabricIPPrefixes(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricIPPrefixes(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPPrefixes(); } /// @@ -786,16 +778,20 @@ public static NetworkFabricIPPrefixCollection GetNetworkFabricIPPrefixes(this Re /// IpPrefixes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the IP Prefix. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricIPPrefixAsync(this ResourceGroupResource resourceGroupResource, string ipPrefixName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricIPPrefixes().GetAsync(ipPrefixName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPPrefixAsync(ipPrefixName, cancellationToken).ConfigureAwait(false); } /// @@ -810,24 +806,34 @@ public static async Task> GetNetworkFabr /// IpPrefixes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the IP Prefix. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricIPPrefix(this ResourceGroupResource resourceGroupResource, string ipPrefixName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricIPPrefixes().Get(ipPrefixName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricIPPrefix(ipPrefixName, cancellationToken); } - /// Gets a collection of NetworkFabricL2IsolationDomainResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricL2IsolationDomainResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricL2IsolationDomainResources and their operations over a NetworkFabricL2IsolationDomainResource. public static NetworkFabricL2IsolationDomainCollection GetNetworkFabricL2IsolationDomains(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricL2IsolationDomains(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricL2IsolationDomains(); } /// @@ -842,16 +848,20 @@ public static NetworkFabricL2IsolationDomainCollection GetNetworkFabricL2Isolati /// L2IsolationDomains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the L2 Isolation Domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricL2IsolationDomainAsync(this ResourceGroupResource resourceGroupResource, string l2IsolationDomainName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricL2IsolationDomains().GetAsync(l2IsolationDomainName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricL2IsolationDomainAsync(l2IsolationDomainName, cancellationToken).ConfigureAwait(false); } /// @@ -866,24 +876,34 @@ public static async Task> GetNe /// L2IsolationDomains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the L2 Isolation Domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricL2IsolationDomain(this ResourceGroupResource resourceGroupResource, string l2IsolationDomainName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricL2IsolationDomains().Get(l2IsolationDomainName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricL2IsolationDomain(l2IsolationDomainName, cancellationToken); } - /// Gets a collection of NetworkFabricL3IsolationDomainResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricL3IsolationDomainResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricL3IsolationDomainResources and their operations over a NetworkFabricL3IsolationDomainResource. public static NetworkFabricL3IsolationDomainCollection GetNetworkFabricL3IsolationDomains(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricL3IsolationDomains(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricL3IsolationDomains(); } /// @@ -898,16 +918,20 @@ public static NetworkFabricL3IsolationDomainCollection GetNetworkFabricL3Isolati /// L3IsolationDomains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the L3 Isolation Domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricL3IsolationDomainAsync(this ResourceGroupResource resourceGroupResource, string l3IsolationDomainName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricL3IsolationDomains().GetAsync(l3IsolationDomainName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricL3IsolationDomainAsync(l3IsolationDomainName, cancellationToken).ConfigureAwait(false); } /// @@ -922,24 +946,34 @@ public static async Task> GetNe /// L3IsolationDomains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the L3 Isolation Domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricL3IsolationDomain(this ResourceGroupResource resourceGroupResource, string l3IsolationDomainName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricL3IsolationDomains().Get(l3IsolationDomainName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricL3IsolationDomain(l3IsolationDomainName, cancellationToken); } - /// Gets a collection of NetworkFabricNeighborGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricNeighborGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricNeighborGroupResources and their operations over a NetworkFabricNeighborGroupResource. public static NetworkFabricNeighborGroupCollection GetNetworkFabricNeighborGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricNeighborGroups(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricNeighborGroups(); } /// @@ -954,16 +988,20 @@ public static NetworkFabricNeighborGroupCollection GetNetworkFabricNeighborGroup /// NeighborGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Neighbor Group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricNeighborGroupAsync(this ResourceGroupResource resourceGroupResource, string neighborGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricNeighborGroups().GetAsync(neighborGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricNeighborGroupAsync(neighborGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -978,24 +1016,34 @@ public static async Task> GetNetwor /// NeighborGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Neighbor Group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricNeighborGroup(this ResourceGroupResource resourceGroupResource, string neighborGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricNeighborGroups().Get(neighborGroupName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricNeighborGroup(neighborGroupName, cancellationToken); } - /// Gets a collection of NetworkDeviceResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkDeviceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkDeviceResources and their operations over a NetworkDeviceResource. public static NetworkDeviceCollection GetNetworkDevices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkDevices(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkDevices(); } /// @@ -1010,16 +1058,20 @@ public static NetworkDeviceCollection GetNetworkDevices(this ResourceGroupResour /// NetworkDevices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Device. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkDeviceAsync(this ResourceGroupResource resourceGroupResource, string networkDeviceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkDevices().GetAsync(networkDeviceName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkDeviceAsync(networkDeviceName, cancellationToken).ConfigureAwait(false); } /// @@ -1034,24 +1086,34 @@ public static async Task> GetNetworkDeviceAsync( /// NetworkDevices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Device. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkDevice(this ResourceGroupResource resourceGroupResource, string networkDeviceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkDevices().Get(networkDeviceName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkDevice(networkDeviceName, cancellationToken); } - /// Gets a collection of NetworkFabricControllerResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricControllerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricControllerResources and their operations over a NetworkFabricControllerResource. public static NetworkFabricControllerCollection GetNetworkFabricControllers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricControllers(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricControllers(); } /// @@ -1066,16 +1128,20 @@ public static NetworkFabricControllerCollection GetNetworkFabricControllers(this /// NetworkFabricControllers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Fabric Controller. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricControllerAsync(this ResourceGroupResource resourceGroupResource, string networkFabricControllerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricControllers().GetAsync(networkFabricControllerName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricControllerAsync(networkFabricControllerName, cancellationToken).ConfigureAwait(false); } /// @@ -1090,24 +1156,34 @@ public static async Task> GetNetworkFa /// NetworkFabricControllers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Fabric Controller. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricController(this ResourceGroupResource resourceGroupResource, string networkFabricControllerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricControllers().Get(networkFabricControllerName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricController(networkFabricControllerName, cancellationToken); } - /// Gets a collection of NetworkFabricResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricResources and their operations over a NetworkFabricResource. public static NetworkFabricCollection GetNetworkFabrics(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabrics(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabrics(); } /// @@ -1122,16 +1198,20 @@ public static NetworkFabricCollection GetNetworkFabrics(this ResourceGroupResour /// NetworkFabrics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Fabric. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricAsync(this ResourceGroupResource resourceGroupResource, string networkFabricName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabrics().GetAsync(networkFabricName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricAsync(networkFabricName, cancellationToken).ConfigureAwait(false); } /// @@ -1146,24 +1226,34 @@ public static async Task> GetNetworkFabricAsync( /// NetworkFabrics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Fabric. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabric(this ResourceGroupResource resourceGroupResource, string networkFabricName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabrics().Get(networkFabricName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabric(networkFabricName, cancellationToken); } - /// Gets a collection of NetworkPacketBrokerResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkPacketBrokerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkPacketBrokerResources and their operations over a NetworkPacketBrokerResource. public static NetworkPacketBrokerCollection GetNetworkPacketBrokers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkPacketBrokers(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkPacketBrokers(); } /// @@ -1178,16 +1268,20 @@ public static NetworkPacketBrokerCollection GetNetworkPacketBrokers(this Resourc /// NetworkPacketBrokers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Packet Broker. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkPacketBrokerAsync(this ResourceGroupResource resourceGroupResource, string networkPacketBrokerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkPacketBrokers().GetAsync(networkPacketBrokerName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkPacketBrokerAsync(networkPacketBrokerName, cancellationToken).ConfigureAwait(false); } /// @@ -1202,24 +1296,34 @@ public static async Task> GetNetworkPacket /// NetworkPacketBrokers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Packet Broker. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkPacketBroker(this ResourceGroupResource resourceGroupResource, string networkPacketBrokerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkPacketBrokers().Get(networkPacketBrokerName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkPacketBroker(networkPacketBrokerName, cancellationToken); } - /// Gets a collection of NetworkRackResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkRackResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkRackResources and their operations over a NetworkRackResource. public static NetworkRackCollection GetNetworkRacks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkRacks(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkRacks(); } /// @@ -1234,16 +1338,20 @@ public static NetworkRackCollection GetNetworkRacks(this ResourceGroupResource r /// NetworkRacks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Rack. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkRackAsync(this ResourceGroupResource resourceGroupResource, string networkRackName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkRacks().GetAsync(networkRackName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkRackAsync(networkRackName, cancellationToken).ConfigureAwait(false); } /// @@ -1258,24 +1366,34 @@ public static async Task> GetNetworkRackAsync(this /// NetworkRacks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Rack. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkRack(this ResourceGroupResource resourceGroupResource, string networkRackName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkRacks().Get(networkRackName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkRack(networkRackName, cancellationToken); } - /// Gets a collection of NetworkTapRuleResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkTapRuleResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkTapRuleResources and their operations over a NetworkTapRuleResource. public static NetworkTapRuleCollection GetNetworkTapRules(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkTapRules(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkTapRules(); } /// @@ -1290,16 +1408,20 @@ public static NetworkTapRuleCollection GetNetworkTapRules(this ResourceGroupReso /// NetworkTapRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Tap Rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkTapRuleAsync(this ResourceGroupResource resourceGroupResource, string networkTapRuleName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkTapRules().GetAsync(networkTapRuleName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkTapRuleAsync(networkTapRuleName, cancellationToken).ConfigureAwait(false); } /// @@ -1314,24 +1436,34 @@ public static async Task> GetNetworkTapRuleAsyn /// NetworkTapRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Tap Rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkTapRule(this ResourceGroupResource resourceGroupResource, string networkTapRuleName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkTapRules().Get(networkTapRuleName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkTapRule(networkTapRuleName, cancellationToken); } - /// Gets a collection of NetworkTapResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkTapResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkTapResources and their operations over a NetworkTapResource. public static NetworkTapCollection GetNetworkTaps(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkTaps(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkTaps(); } /// @@ -1346,16 +1478,20 @@ public static NetworkTapCollection GetNetworkTaps(this ResourceGroupResource res /// NetworkTaps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Tap. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkTapAsync(this ResourceGroupResource resourceGroupResource, string networkTapName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkTaps().GetAsync(networkTapName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkTapAsync(networkTapName, cancellationToken).ConfigureAwait(false); } /// @@ -1370,24 +1506,34 @@ public static async Task> GetNetworkTapAsync(this R /// NetworkTaps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Tap. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkTap(this ResourceGroupResource resourceGroupResource, string networkTapName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkTaps().Get(networkTapName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkTap(networkTapName, cancellationToken); } - /// Gets a collection of NetworkFabricRoutePolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkFabricRoutePolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricRoutePolicyResources and their operations over a NetworkFabricRoutePolicyResource. public static NetworkFabricRoutePolicyCollection GetNetworkFabricRoutePolicies(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkFabricRoutePolicies(); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricRoutePolicies(); } /// @@ -1402,16 +1548,20 @@ public static NetworkFabricRoutePolicyCollection GetNetworkFabricRoutePolicies(t /// RoutePolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Route Policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricRoutePolicyAsync(this ResourceGroupResource resourceGroupResource, string routePolicyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkFabricRoutePolicies().GetAsync(routePolicyName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricRoutePolicyAsync(routePolicyName, cancellationToken).ConfigureAwait(false); } /// @@ -1426,24 +1576,34 @@ public static async Task> GetNetworkF /// RoutePolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Route Policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricRoutePolicy(this ResourceGroupResource resourceGroupResource, string routePolicyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkFabricRoutePolicies().Get(routePolicyName, cancellationToken); + return GetMockableManagedNetworkFabricResourceGroupResource(resourceGroupResource).GetNetworkFabricRoutePolicy(routePolicyName, cancellationToken); } - /// Gets a collection of NetworkDeviceSkuResources in the SubscriptionResource. + /// + /// Gets a collection of NetworkDeviceSkuResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkDeviceSkuResources and their operations over a NetworkDeviceSkuResource. public static NetworkDeviceSkuCollection GetNetworkDeviceSkus(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkDeviceSkus(); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkDeviceSkus(); } /// @@ -1458,16 +1618,20 @@ public static NetworkDeviceSkuCollection GetNetworkDeviceSkus(this SubscriptionR /// NetworkDeviceSkus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Device SKU. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkDeviceSkuAsync(this SubscriptionResource subscriptionResource, string networkDeviceSkuName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetNetworkDeviceSkus().GetAsync(networkDeviceSkuName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkDeviceSkuAsync(networkDeviceSkuName, cancellationToken).ConfigureAwait(false); } /// @@ -1482,24 +1646,34 @@ public static async Task> GetNetworkDeviceSku /// NetworkDeviceSkus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Device SKU. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkDeviceSku(this SubscriptionResource subscriptionResource, string networkDeviceSkuName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetNetworkDeviceSkus().Get(networkDeviceSkuName, cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkDeviceSku(networkDeviceSkuName, cancellationToken); } - /// Gets a collection of NetworkFabricSkuResources in the SubscriptionResource. + /// + /// Gets a collection of NetworkFabricSkuResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkFabricSkuResources and their operations over a NetworkFabricSkuResource. public static NetworkFabricSkuCollection GetNetworkFabricSkus(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricSkus(); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricSkus(); } /// @@ -1514,16 +1688,20 @@ public static NetworkFabricSkuCollection GetNetworkFabricSkus(this SubscriptionR /// NetworkFabricSkus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Fabric SKU. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkFabricSkuAsync(this SubscriptionResource subscriptionResource, string networkFabricSkuName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetNetworkFabricSkus().GetAsync(networkFabricSkuName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricSkuAsync(networkFabricSkuName, cancellationToken).ConfigureAwait(false); } /// @@ -1538,16 +1716,20 @@ public static async Task> GetNetworkFabricSku /// NetworkFabricSkus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Network Fabric SKU. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkFabricSku(this SubscriptionResource subscriptionResource, string networkFabricSkuName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetNetworkFabricSkus().Get(networkFabricSkuName, cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricSku(networkFabricSkuName, cancellationToken); } /// @@ -1562,13 +1744,17 @@ public static Response GetNetworkFabricSku(this Subscr /// AccessControlLists_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricAccessControlListsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricAccessControlListsAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricAccessControlListsAsync(cancellationToken); } /// @@ -1583,13 +1769,17 @@ public static AsyncPageable GetNetworkFa /// AccessControlLists_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricAccessControlLists(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricAccessControlLists(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricAccessControlLists(cancellationToken); } /// @@ -1604,13 +1794,17 @@ public static Pageable GetNetworkFabricA /// InternetGateways_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricInternetGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricInternetGatewaysAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricInternetGatewaysAsync(cancellationToken); } /// @@ -1625,13 +1819,17 @@ public static AsyncPageable GetNetworkFabr /// InternetGateways_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricInternetGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricInternetGateways(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricInternetGateways(cancellationToken); } /// @@ -1646,13 +1844,17 @@ public static Pageable GetNetworkFabricInt /// InternetGatewayRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricInternetGatewayRulesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricInternetGatewayRulesAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricInternetGatewayRulesAsync(cancellationToken); } /// @@ -1667,13 +1869,17 @@ public static AsyncPageable GetNetwork /// InternetGatewayRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricInternetGatewayRules(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricInternetGatewayRules(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricInternetGatewayRules(cancellationToken); } /// @@ -1688,13 +1894,17 @@ public static Pageable GetNetworkFabri /// IpCommunities_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricIPCommunitiesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricIPCommunitiesAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricIPCommunitiesAsync(cancellationToken); } /// @@ -1709,13 +1919,17 @@ public static AsyncPageable GetNetworkFabricIP /// IpCommunities_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricIPCommunities(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricIPCommunities(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricIPCommunities(cancellationToken); } /// @@ -1730,13 +1944,17 @@ public static Pageable GetNetworkFabricIPCommu /// IpExtendedCommunities_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricIPExtendedCommunitiesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricIPExtendedCommunitiesAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricIPExtendedCommunitiesAsync(cancellationToken); } /// @@ -1751,13 +1969,17 @@ public static AsyncPageable GetNetwork /// IpExtendedCommunities_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricIPExtendedCommunities(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricIPExtendedCommunities(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricIPExtendedCommunities(cancellationToken); } /// @@ -1772,13 +1994,17 @@ public static Pageable GetNetworkFabri /// IpPrefixes_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricIPPrefixesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricIPPrefixesAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricIPPrefixesAsync(cancellationToken); } /// @@ -1793,13 +2019,17 @@ public static AsyncPageable GetNetworkFabricIPPre /// IpPrefixes_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricIPPrefixes(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricIPPrefixes(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricIPPrefixes(cancellationToken); } /// @@ -1814,13 +2044,17 @@ public static Pageable GetNetworkFabricIPPrefixes /// L2IsolationDomains_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricL2IsolationDomainsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricL2IsolationDomainsAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricL2IsolationDomainsAsync(cancellationToken); } /// @@ -1835,13 +2069,17 @@ public static AsyncPageable GetNetworkFa /// L2IsolationDomains_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricL2IsolationDomains(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricL2IsolationDomains(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricL2IsolationDomains(cancellationToken); } /// @@ -1856,13 +2094,17 @@ public static Pageable GetNetworkFabricL /// L3IsolationDomains_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricL3IsolationDomainsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricL3IsolationDomainsAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricL3IsolationDomainsAsync(cancellationToken); } /// @@ -1877,13 +2119,17 @@ public static AsyncPageable GetNetworkFa /// L3IsolationDomains_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricL3IsolationDomains(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricL3IsolationDomains(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricL3IsolationDomains(cancellationToken); } /// @@ -1898,13 +2144,17 @@ public static Pageable GetNetworkFabricL /// NeighborGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricNeighborGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricNeighborGroupsAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricNeighborGroupsAsync(cancellationToken); } /// @@ -1919,13 +2169,17 @@ public static AsyncPageable GetNetworkFabric /// NeighborGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricNeighborGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricNeighborGroups(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricNeighborGroups(cancellationToken); } /// @@ -1940,13 +2194,17 @@ public static Pageable GetNetworkFabricNeigh /// NetworkDevices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkDevicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkDevicesAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkDevicesAsync(cancellationToken); } /// @@ -1961,13 +2219,17 @@ public static AsyncPageable GetNetworkDevicesAsync(this S /// NetworkDevices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkDevices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkDevices(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkDevices(cancellationToken); } /// @@ -1982,13 +2244,17 @@ public static Pageable GetNetworkDevices(this Subscriptio /// NetworkFabricControllers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricControllersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricControllersAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricControllersAsync(cancellationToken); } /// @@ -2003,13 +2269,17 @@ public static AsyncPageable GetNetworkFabricCon /// NetworkFabricControllers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricControllers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricControllers(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricControllers(cancellationToken); } /// @@ -2024,13 +2294,17 @@ public static Pageable GetNetworkFabricControll /// NetworkFabrics_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricsAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricsAsync(cancellationToken); } /// @@ -2045,13 +2319,17 @@ public static AsyncPageable GetNetworkFabricsAsync(this S /// NetworkFabrics_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabrics(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabrics(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabrics(cancellationToken); } /// @@ -2066,13 +2344,17 @@ public static Pageable GetNetworkFabrics(this Subscriptio /// NetworkPacketBrokers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkPacketBrokersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkPacketBrokersAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkPacketBrokersAsync(cancellationToken); } /// @@ -2087,13 +2369,17 @@ public static AsyncPageable GetNetworkPacketBrokers /// NetworkPacketBrokers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkPacketBrokers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkPacketBrokers(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkPacketBrokers(cancellationToken); } /// @@ -2108,13 +2394,17 @@ public static Pageable GetNetworkPacketBrokers(this /// NetworkRacks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkRacksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkRacksAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkRacksAsync(cancellationToken); } /// @@ -2129,13 +2419,17 @@ public static AsyncPageable GetNetworkRacksAsync(this Subsc /// NetworkRacks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkRacks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkRacks(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkRacks(cancellationToken); } /// @@ -2150,13 +2444,17 @@ public static Pageable GetNetworkRacks(this SubscriptionRes /// NetworkTapRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkTapRulesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkTapRulesAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkTapRulesAsync(cancellationToken); } /// @@ -2171,13 +2469,17 @@ public static AsyncPageable GetNetworkTapRulesAsync(this /// NetworkTapRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkTapRules(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkTapRules(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkTapRules(cancellationToken); } /// @@ -2192,13 +2494,17 @@ public static Pageable GetNetworkTapRules(this Subscript /// NetworkTaps_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkTapsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkTapsAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkTapsAsync(cancellationToken); } /// @@ -2213,13 +2519,17 @@ public static AsyncPageable GetNetworkTapsAsync(this Subscri /// NetworkTaps_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkTaps(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkTaps(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkTaps(cancellationToken); } /// @@ -2234,13 +2544,17 @@ public static Pageable GetNetworkTaps(this SubscriptionResou /// RoutePolicies_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricRoutePoliciesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricRoutePoliciesAsync(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricRoutePoliciesAsync(cancellationToken); } /// @@ -2255,13 +2569,17 @@ public static AsyncPageable GetNetworkFabricRo /// RoutePolicies_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkFabricRoutePolicies(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkFabricRoutePolicies(cancellationToken); + return GetMockableManagedNetworkFabricSubscriptionResource(subscriptionResource).GetNetworkFabricRoutePolicies(cancellationToken); } } } diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricArmClient.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricArmClient.cs new file mode 100644 index 0000000000000..df851d7699d8f --- /dev/null +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricArmClient.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ManagedNetworkFabric; + +namespace Azure.ResourceManager.ManagedNetworkFabric.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableManagedNetworkFabricArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedNetworkFabricArmClient() + { + } + + /// 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 MockableManagedNetworkFabricArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableManagedNetworkFabricArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricAccessControlListResource GetNetworkFabricAccessControlListResource(ResourceIdentifier id) + { + NetworkFabricAccessControlListResource.ValidateResourceId(id); + return new NetworkFabricAccessControlListResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricInternetGatewayResource GetNetworkFabricInternetGatewayResource(ResourceIdentifier id) + { + NetworkFabricInternetGatewayResource.ValidateResourceId(id); + return new NetworkFabricInternetGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricInternetGatewayRuleResource GetNetworkFabricInternetGatewayRuleResource(ResourceIdentifier id) + { + NetworkFabricInternetGatewayRuleResource.ValidateResourceId(id); + return new NetworkFabricInternetGatewayRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricIPCommunityResource GetNetworkFabricIPCommunityResource(ResourceIdentifier id) + { + NetworkFabricIPCommunityResource.ValidateResourceId(id); + return new NetworkFabricIPCommunityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricIPExtendedCommunityResource GetNetworkFabricIPExtendedCommunityResource(ResourceIdentifier id) + { + NetworkFabricIPExtendedCommunityResource.ValidateResourceId(id); + return new NetworkFabricIPExtendedCommunityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricIPPrefixResource GetNetworkFabricIPPrefixResource(ResourceIdentifier id) + { + NetworkFabricIPPrefixResource.ValidateResourceId(id); + return new NetworkFabricIPPrefixResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricL2IsolationDomainResource GetNetworkFabricL2IsolationDomainResource(ResourceIdentifier id) + { + NetworkFabricL2IsolationDomainResource.ValidateResourceId(id); + return new NetworkFabricL2IsolationDomainResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricL3IsolationDomainResource GetNetworkFabricL3IsolationDomainResource(ResourceIdentifier id) + { + NetworkFabricL3IsolationDomainResource.ValidateResourceId(id); + return new NetworkFabricL3IsolationDomainResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricInternalNetworkResource GetNetworkFabricInternalNetworkResource(ResourceIdentifier id) + { + NetworkFabricInternalNetworkResource.ValidateResourceId(id); + return new NetworkFabricInternalNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricExternalNetworkResource GetNetworkFabricExternalNetworkResource(ResourceIdentifier id) + { + NetworkFabricExternalNetworkResource.ValidateResourceId(id); + return new NetworkFabricExternalNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricNeighborGroupResource GetNetworkFabricNeighborGroupResource(ResourceIdentifier id) + { + NetworkFabricNeighborGroupResource.ValidateResourceId(id); + return new NetworkFabricNeighborGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkDeviceSkuResource GetNetworkDeviceSkuResource(ResourceIdentifier id) + { + NetworkDeviceSkuResource.ValidateResourceId(id); + return new NetworkDeviceSkuResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkDeviceResource GetNetworkDeviceResource(ResourceIdentifier id) + { + NetworkDeviceResource.ValidateResourceId(id); + return new NetworkDeviceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkDeviceInterfaceResource GetNetworkDeviceInterfaceResource(ResourceIdentifier id) + { + NetworkDeviceInterfaceResource.ValidateResourceId(id); + return new NetworkDeviceInterfaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricControllerResource GetNetworkFabricControllerResource(ResourceIdentifier id) + { + NetworkFabricControllerResource.ValidateResourceId(id); + return new NetworkFabricControllerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricSkuResource GetNetworkFabricSkuResource(ResourceIdentifier id) + { + NetworkFabricSkuResource.ValidateResourceId(id); + return new NetworkFabricSkuResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricResource GetNetworkFabricResource(ResourceIdentifier id) + { + NetworkFabricResource.ValidateResourceId(id); + return new NetworkFabricResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkToNetworkInterconnectResource GetNetworkToNetworkInterconnectResource(ResourceIdentifier id) + { + NetworkToNetworkInterconnectResource.ValidateResourceId(id); + return new NetworkToNetworkInterconnectResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkPacketBrokerResource GetNetworkPacketBrokerResource(ResourceIdentifier id) + { + NetworkPacketBrokerResource.ValidateResourceId(id); + return new NetworkPacketBrokerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkRackResource GetNetworkRackResource(ResourceIdentifier id) + { + NetworkRackResource.ValidateResourceId(id); + return new NetworkRackResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkTapRuleResource GetNetworkTapRuleResource(ResourceIdentifier id) + { + NetworkTapRuleResource.ValidateResourceId(id); + return new NetworkTapRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkTapResource GetNetworkTapResource(ResourceIdentifier id) + { + NetworkTapResource.ValidateResourceId(id); + return new NetworkTapResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFabricRoutePolicyResource GetNetworkFabricRoutePolicyResource(ResourceIdentifier id) + { + NetworkFabricRoutePolicyResource.ValidateResourceId(id); + return new NetworkFabricRoutePolicyResource(Client, id); + } + } +} diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricResourceGroupResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricResourceGroupResource.cs new file mode 100644 index 0000000000000..55fd8d672fc6c --- /dev/null +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricResourceGroupResource.cs @@ -0,0 +1,940 @@ +// 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.ManagedNetworkFabric; + +namespace Azure.ResourceManager.ManagedNetworkFabric.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableManagedNetworkFabricResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedNetworkFabricResourceGroupResource() + { + } + + /// 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 MockableManagedNetworkFabricResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NetworkFabricAccessControlListResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricAccessControlListResources and their operations over a NetworkFabricAccessControlListResource. + public virtual NetworkFabricAccessControlListCollection GetNetworkFabricAccessControlLists() + { + return GetCachedClient(client => new NetworkFabricAccessControlListCollection(client, Id)); + } + + /// + /// Implements Access Control List GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName} + /// + /// + /// Operation Id + /// AccessControlLists_Get + /// + /// + /// + /// Name of the Access Control List. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricAccessControlListAsync(string accessControlListName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricAccessControlLists().GetAsync(accessControlListName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements Access Control List GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName} + /// + /// + /// Operation Id + /// AccessControlLists_Get + /// + /// + /// + /// Name of the Access Control List. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricAccessControlList(string accessControlListName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricAccessControlLists().Get(accessControlListName, cancellationToken); + } + + /// Gets a collection of NetworkFabricInternetGatewayResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricInternetGatewayResources and their operations over a NetworkFabricInternetGatewayResource. + public virtual NetworkFabricInternetGatewayCollection GetNetworkFabricInternetGateways() + { + return GetCachedClient(client => new NetworkFabricInternetGatewayCollection(client, Id)); + } + + /// + /// Implements Gateway GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGateways/{internetGatewayName} + /// + /// + /// Operation Id + /// InternetGateways_Get + /// + /// + /// + /// Name of the Internet Gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricInternetGatewayAsync(string internetGatewayName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricInternetGateways().GetAsync(internetGatewayName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements Gateway GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGateways/{internetGatewayName} + /// + /// + /// Operation Id + /// InternetGateways_Get + /// + /// + /// + /// Name of the Internet Gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricInternetGateway(string internetGatewayName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricInternetGateways().Get(internetGatewayName, cancellationToken); + } + + /// Gets a collection of NetworkFabricInternetGatewayRuleResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricInternetGatewayRuleResources and their operations over a NetworkFabricInternetGatewayRuleResource. + public virtual NetworkFabricInternetGatewayRuleCollection GetNetworkFabricInternetGatewayRules() + { + return GetCachedClient(client => new NetworkFabricInternetGatewayRuleCollection(client, Id)); + } + + /// + /// Gets an Internet Gateway Rule resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGatewayRules/{internetGatewayRuleName} + /// + /// + /// Operation Id + /// InternetGatewayRules_Get + /// + /// + /// + /// Name of the Internet Gateway rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricInternetGatewayRuleAsync(string internetGatewayRuleName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricInternetGatewayRules().GetAsync(internetGatewayRuleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an Internet Gateway Rule resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGatewayRules/{internetGatewayRuleName} + /// + /// + /// Operation Id + /// InternetGatewayRules_Get + /// + /// + /// + /// Name of the Internet Gateway rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricInternetGatewayRule(string internetGatewayRuleName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricInternetGatewayRules().Get(internetGatewayRuleName, cancellationToken); + } + + /// Gets a collection of NetworkFabricIPCommunityResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricIPCommunityResources and their operations over a NetworkFabricIPCommunityResource. + public virtual NetworkFabricIPCommunityCollection GetNetworkFabricIPCommunities() + { + return GetCachedClient(client => new NetworkFabricIPCommunityCollection(client, Id)); + } + + /// + /// Implements an IP Community GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName} + /// + /// + /// Operation Id + /// IpCommunities_Get + /// + /// + /// + /// Name of the IP Community. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricIPCommunityAsync(string ipCommunityName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricIPCommunities().GetAsync(ipCommunityName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements an IP Community GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName} + /// + /// + /// Operation Id + /// IpCommunities_Get + /// + /// + /// + /// Name of the IP Community. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricIPCommunity(string ipCommunityName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricIPCommunities().Get(ipCommunityName, cancellationToken); + } + + /// Gets a collection of NetworkFabricIPExtendedCommunityResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricIPExtendedCommunityResources and their operations over a NetworkFabricIPExtendedCommunityResource. + public virtual NetworkFabricIPExtendedCommunityCollection GetNetworkFabricIPExtendedCommunities() + { + return GetCachedClient(client => new NetworkFabricIPExtendedCommunityCollection(client, Id)); + } + + /// + /// Implements IP Extended Community GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName} + /// + /// + /// Operation Id + /// IpExtendedCommunities_Get + /// + /// + /// + /// Name of the IP Extended Community. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricIPExtendedCommunityAsync(string ipExtendedCommunityName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricIPExtendedCommunities().GetAsync(ipExtendedCommunityName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements IP Extended Community GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName} + /// + /// + /// Operation Id + /// IpExtendedCommunities_Get + /// + /// + /// + /// Name of the IP Extended Community. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricIPExtendedCommunity(string ipExtendedCommunityName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricIPExtendedCommunities().Get(ipExtendedCommunityName, cancellationToken); + } + + /// Gets a collection of NetworkFabricIPPrefixResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricIPPrefixResources and their operations over a NetworkFabricIPPrefixResource. + public virtual NetworkFabricIPPrefixCollection GetNetworkFabricIPPrefixes() + { + return GetCachedClient(client => new NetworkFabricIPPrefixCollection(client, Id)); + } + + /// + /// Implements IP Prefix GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName} + /// + /// + /// Operation Id + /// IpPrefixes_Get + /// + /// + /// + /// Name of the IP Prefix. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricIPPrefixAsync(string ipPrefixName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricIPPrefixes().GetAsync(ipPrefixName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements IP Prefix GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName} + /// + /// + /// Operation Id + /// IpPrefixes_Get + /// + /// + /// + /// Name of the IP Prefix. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricIPPrefix(string ipPrefixName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricIPPrefixes().Get(ipPrefixName, cancellationToken); + } + + /// Gets a collection of NetworkFabricL2IsolationDomainResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricL2IsolationDomainResources and their operations over a NetworkFabricL2IsolationDomainResource. + public virtual NetworkFabricL2IsolationDomainCollection GetNetworkFabricL2IsolationDomains() + { + return GetCachedClient(client => new NetworkFabricL2IsolationDomainCollection(client, Id)); + } + + /// + /// Implements L2 Isolation Domain GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName} + /// + /// + /// Operation Id + /// L2IsolationDomains_Get + /// + /// + /// + /// Name of the L2 Isolation Domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricL2IsolationDomainAsync(string l2IsolationDomainName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricL2IsolationDomains().GetAsync(l2IsolationDomainName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements L2 Isolation Domain GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName} + /// + /// + /// Operation Id + /// L2IsolationDomains_Get + /// + /// + /// + /// Name of the L2 Isolation Domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricL2IsolationDomain(string l2IsolationDomainName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricL2IsolationDomains().Get(l2IsolationDomainName, cancellationToken); + } + + /// Gets a collection of NetworkFabricL3IsolationDomainResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricL3IsolationDomainResources and their operations over a NetworkFabricL3IsolationDomainResource. + public virtual NetworkFabricL3IsolationDomainCollection GetNetworkFabricL3IsolationDomains() + { + return GetCachedClient(client => new NetworkFabricL3IsolationDomainCollection(client, Id)); + } + + /// + /// Retrieves details of this L3 Isolation Domain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName} + /// + /// + /// Operation Id + /// L3IsolationDomains_Get + /// + /// + /// + /// Name of the L3 Isolation Domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricL3IsolationDomainAsync(string l3IsolationDomainName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricL3IsolationDomains().GetAsync(l3IsolationDomainName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves details of this L3 Isolation Domain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName} + /// + /// + /// Operation Id + /// L3IsolationDomains_Get + /// + /// + /// + /// Name of the L3 Isolation Domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricL3IsolationDomain(string l3IsolationDomainName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricL3IsolationDomains().Get(l3IsolationDomainName, cancellationToken); + } + + /// Gets a collection of NetworkFabricNeighborGroupResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricNeighborGroupResources and their operations over a NetworkFabricNeighborGroupResource. + public virtual NetworkFabricNeighborGroupCollection GetNetworkFabricNeighborGroups() + { + return GetCachedClient(client => new NetworkFabricNeighborGroupCollection(client, Id)); + } + + /// + /// Gets the Neighbor Group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/neighborGroups/{neighborGroupName} + /// + /// + /// Operation Id + /// NeighborGroups_Get + /// + /// + /// + /// Name of the Neighbor Group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricNeighborGroupAsync(string neighborGroupName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricNeighborGroups().GetAsync(neighborGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the Neighbor Group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/neighborGroups/{neighborGroupName} + /// + /// + /// Operation Id + /// NeighborGroups_Get + /// + /// + /// + /// Name of the Neighbor Group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricNeighborGroup(string neighborGroupName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricNeighborGroups().Get(neighborGroupName, cancellationToken); + } + + /// Gets a collection of NetworkDeviceResources in the ResourceGroupResource. + /// An object representing collection of NetworkDeviceResources and their operations over a NetworkDeviceResource. + public virtual NetworkDeviceCollection GetNetworkDevices() + { + return GetCachedClient(client => new NetworkDeviceCollection(client, Id)); + } + + /// + /// Gets the Network Device resource details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName} + /// + /// + /// Operation Id + /// NetworkDevices_Get + /// + /// + /// + /// Name of the Network Device. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkDeviceAsync(string networkDeviceName, CancellationToken cancellationToken = default) + { + return await GetNetworkDevices().GetAsync(networkDeviceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the Network Device resource details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName} + /// + /// + /// Operation Id + /// NetworkDevices_Get + /// + /// + /// + /// Name of the Network Device. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkDevice(string networkDeviceName, CancellationToken cancellationToken = default) + { + return GetNetworkDevices().Get(networkDeviceName, cancellationToken); + } + + /// Gets a collection of NetworkFabricControllerResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricControllerResources and their operations over a NetworkFabricControllerResource. + public virtual NetworkFabricControllerCollection GetNetworkFabricControllers() + { + return GetCachedClient(client => new NetworkFabricControllerCollection(client, Id)); + } + + /// + /// Shows the provisioning status of Network Fabric Controller. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName} + /// + /// + /// Operation Id + /// NetworkFabricControllers_Get + /// + /// + /// + /// Name of the Network Fabric Controller. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricControllerAsync(string networkFabricControllerName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricControllers().GetAsync(networkFabricControllerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Shows the provisioning status of Network Fabric Controller. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName} + /// + /// + /// Operation Id + /// NetworkFabricControllers_Get + /// + /// + /// + /// Name of the Network Fabric Controller. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricController(string networkFabricControllerName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricControllers().Get(networkFabricControllerName, cancellationToken); + } + + /// Gets a collection of NetworkFabricResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricResources and their operations over a NetworkFabricResource. + public virtual NetworkFabricCollection GetNetworkFabrics() + { + return GetCachedClient(client => new NetworkFabricCollection(client, Id)); + } + + /// + /// Get Network Fabric resource details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName} + /// + /// + /// Operation Id + /// NetworkFabrics_Get + /// + /// + /// + /// Name of the Network Fabric. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricAsync(string networkFabricName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabrics().GetAsync(networkFabricName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Network Fabric resource details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName} + /// + /// + /// Operation Id + /// NetworkFabrics_Get + /// + /// + /// + /// Name of the Network Fabric. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabric(string networkFabricName, CancellationToken cancellationToken = default) + { + return GetNetworkFabrics().Get(networkFabricName, cancellationToken); + } + + /// Gets a collection of NetworkPacketBrokerResources in the ResourceGroupResource. + /// An object representing collection of NetworkPacketBrokerResources and their operations over a NetworkPacketBrokerResource. + public virtual NetworkPacketBrokerCollection GetNetworkPacketBrokers() + { + return GetCachedClient(client => new NetworkPacketBrokerCollection(client, Id)); + } + + /// + /// Retrieves details of this Network Packet Broker. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers/{networkPacketBrokerName} + /// + /// + /// Operation Id + /// NetworkPacketBrokers_Get + /// + /// + /// + /// Name of the Network Packet Broker. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkPacketBrokerAsync(string networkPacketBrokerName, CancellationToken cancellationToken = default) + { + return await GetNetworkPacketBrokers().GetAsync(networkPacketBrokerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves details of this Network Packet Broker. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers/{networkPacketBrokerName} + /// + /// + /// Operation Id + /// NetworkPacketBrokers_Get + /// + /// + /// + /// Name of the Network Packet Broker. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkPacketBroker(string networkPacketBrokerName, CancellationToken cancellationToken = default) + { + return GetNetworkPacketBrokers().Get(networkPacketBrokerName, cancellationToken); + } + + /// Gets a collection of NetworkRackResources in the ResourceGroupResource. + /// An object representing collection of NetworkRackResources and their operations over a NetworkRackResource. + public virtual NetworkRackCollection GetNetworkRacks() + { + return GetCachedClient(client => new NetworkRackCollection(client, Id)); + } + + /// + /// Get Network Rack resource details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName} + /// + /// + /// Operation Id + /// NetworkRacks_Get + /// + /// + /// + /// Name of the Network Rack. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkRackAsync(string networkRackName, CancellationToken cancellationToken = default) + { + return await GetNetworkRacks().GetAsync(networkRackName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Network Rack resource details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName} + /// + /// + /// Operation Id + /// NetworkRacks_Get + /// + /// + /// + /// Name of the Network Rack. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkRack(string networkRackName, CancellationToken cancellationToken = default) + { + return GetNetworkRacks().Get(networkRackName, cancellationToken); + } + + /// Gets a collection of NetworkTapRuleResources in the ResourceGroupResource. + /// An object representing collection of NetworkTapRuleResources and their operations over a NetworkTapRuleResource. + public virtual NetworkTapRuleCollection GetNetworkTapRules() + { + return GetCachedClient(client => new NetworkTapRuleCollection(client, Id)); + } + + /// + /// Get Network Tap Rule resource details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTapRules/{networkTapRuleName} + /// + /// + /// Operation Id + /// NetworkTapRules_Get + /// + /// + /// + /// Name of the Network Tap Rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkTapRuleAsync(string networkTapRuleName, CancellationToken cancellationToken = default) + { + return await GetNetworkTapRules().GetAsync(networkTapRuleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Network Tap Rule resource details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTapRules/{networkTapRuleName} + /// + /// + /// Operation Id + /// NetworkTapRules_Get + /// + /// + /// + /// Name of the Network Tap Rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkTapRule(string networkTapRuleName, CancellationToken cancellationToken = default) + { + return GetNetworkTapRules().Get(networkTapRuleName, cancellationToken); + } + + /// Gets a collection of NetworkTapResources in the ResourceGroupResource. + /// An object representing collection of NetworkTapResources and their operations over a NetworkTapResource. + public virtual NetworkTapCollection GetNetworkTaps() + { + return GetCachedClient(client => new NetworkTapCollection(client, Id)); + } + + /// + /// Retrieves details of this Network Tap. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTaps/{networkTapName} + /// + /// + /// Operation Id + /// NetworkTaps_Get + /// + /// + /// + /// Name of the Network Tap. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkTapAsync(string networkTapName, CancellationToken cancellationToken = default) + { + return await GetNetworkTaps().GetAsync(networkTapName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves details of this Network Tap. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTaps/{networkTapName} + /// + /// + /// Operation Id + /// NetworkTaps_Get + /// + /// + /// + /// Name of the Network Tap. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkTap(string networkTapName, CancellationToken cancellationToken = default) + { + return GetNetworkTaps().Get(networkTapName, cancellationToken); + } + + /// Gets a collection of NetworkFabricRoutePolicyResources in the ResourceGroupResource. + /// An object representing collection of NetworkFabricRoutePolicyResources and their operations over a NetworkFabricRoutePolicyResource. + public virtual NetworkFabricRoutePolicyCollection GetNetworkFabricRoutePolicies() + { + return GetCachedClient(client => new NetworkFabricRoutePolicyCollection(client, Id)); + } + + /// + /// Implements Route Policy GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName} + /// + /// + /// Operation Id + /// RoutePolicies_Get + /// + /// + /// + /// Name of the Route Policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricRoutePolicyAsync(string routePolicyName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricRoutePolicies().GetAsync(routePolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements Route Policy GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName} + /// + /// + /// Operation Id + /// RoutePolicies_Get + /// + /// + /// + /// Name of the Route Policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricRoutePolicy(string routePolicyName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricRoutePolicies().Get(routePolicyName, cancellationToken); + } + } +} diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricSubscriptionResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricSubscriptionResource.cs new file mode 100644 index 0000000000000..9bd1cee652162 --- /dev/null +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/MockableManagedNetworkFabricSubscriptionResource.cs @@ -0,0 +1,965 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ManagedNetworkFabric; + +namespace Azure.ResourceManager.ManagedNetworkFabric.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableManagedNetworkFabricSubscriptionResource : ArmResource + { + private ClientDiagnostics _networkFabricAccessControlListAccessControlListsClientDiagnostics; + private AccessControlListsRestOperations _networkFabricAccessControlListAccessControlListsRestClient; + private ClientDiagnostics _networkFabricInternetGatewayInternetGatewaysClientDiagnostics; + private InternetGatewaysRestOperations _networkFabricInternetGatewayInternetGatewaysRestClient; + private ClientDiagnostics _networkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics; + private InternetGatewayRulesRestOperations _networkFabricInternetGatewayRuleInternetGatewayRulesRestClient; + private ClientDiagnostics _networkFabricIPCommunityIPCommunitiesClientDiagnostics; + private IpCommunitiesRestOperations _networkFabricIPCommunityIPCommunitiesRestClient; + private ClientDiagnostics _networkFabricIPExtendedCommunityIPExtendedCommunitiesClientDiagnostics; + private IpExtendedCommunitiesRestOperations _networkFabricIPExtendedCommunityIPExtendedCommunitiesRestClient; + private ClientDiagnostics _networkFabricIPPrefixIPPrefixesClientDiagnostics; + private IpPrefixesRestOperations _networkFabricIPPrefixIPPrefixesRestClient; + private ClientDiagnostics _networkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics; + private L2IsolationDomainsRestOperations _networkFabricL2IsolationDomainL2IsolationDomainsRestClient; + private ClientDiagnostics _networkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics; + private L3IsolationDomainsRestOperations _networkFabricL3IsolationDomainL3IsolationDomainsRestClient; + private ClientDiagnostics _networkFabricNeighborGroupNeighborGroupsClientDiagnostics; + private NeighborGroupsRestOperations _networkFabricNeighborGroupNeighborGroupsRestClient; + private ClientDiagnostics _networkDeviceClientDiagnostics; + private NetworkDevicesRestOperations _networkDeviceRestClient; + private ClientDiagnostics _networkFabricControllerClientDiagnostics; + private NetworkFabricControllersRestOperations _networkFabricControllerRestClient; + private ClientDiagnostics _networkFabricClientDiagnostics; + private NetworkFabricsRestOperations _networkFabricRestClient; + private ClientDiagnostics _networkPacketBrokerClientDiagnostics; + private NetworkPacketBrokersRestOperations _networkPacketBrokerRestClient; + private ClientDiagnostics _networkRackClientDiagnostics; + private NetworkRacksRestOperations _networkRackRestClient; + private ClientDiagnostics _networkTapRuleClientDiagnostics; + private NetworkTapRulesRestOperations _networkTapRuleRestClient; + private ClientDiagnostics _networkTapClientDiagnostics; + private NetworkTapsRestOperations _networkTapRestClient; + private ClientDiagnostics _networkFabricRoutePolicyRoutePoliciesClientDiagnostics; + private RoutePoliciesRestOperations _networkFabricRoutePolicyRoutePoliciesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableManagedNetworkFabricSubscriptionResource() + { + } + + /// 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 MockableManagedNetworkFabricSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics NetworkFabricAccessControlListAccessControlListsClientDiagnostics => _networkFabricAccessControlListAccessControlListsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricAccessControlListResource.ResourceType.Namespace, Diagnostics); + private AccessControlListsRestOperations NetworkFabricAccessControlListAccessControlListsRestClient => _networkFabricAccessControlListAccessControlListsRestClient ??= new AccessControlListsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricAccessControlListResource.ResourceType)); + private ClientDiagnostics NetworkFabricInternetGatewayInternetGatewaysClientDiagnostics => _networkFabricInternetGatewayInternetGatewaysClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricInternetGatewayResource.ResourceType.Namespace, Diagnostics); + private InternetGatewaysRestOperations NetworkFabricInternetGatewayInternetGatewaysRestClient => _networkFabricInternetGatewayInternetGatewaysRestClient ??= new InternetGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricInternetGatewayResource.ResourceType)); + private ClientDiagnostics NetworkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics => _networkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricInternetGatewayRuleResource.ResourceType.Namespace, Diagnostics); + private InternetGatewayRulesRestOperations NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient => _networkFabricInternetGatewayRuleInternetGatewayRulesRestClient ??= new InternetGatewayRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricInternetGatewayRuleResource.ResourceType)); + private ClientDiagnostics NetworkFabricIPCommunityIpCommunitiesClientDiagnostics => _networkFabricIPCommunityIPCommunitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricIPCommunityResource.ResourceType.Namespace, Diagnostics); + private IpCommunitiesRestOperations NetworkFabricIPCommunityIpCommunitiesRestClient => _networkFabricIPCommunityIPCommunitiesRestClient ??= new IpCommunitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricIPCommunityResource.ResourceType)); + private ClientDiagnostics NetworkFabricIPExtendedCommunityIpExtendedCommunitiesClientDiagnostics => _networkFabricIPExtendedCommunityIPExtendedCommunitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricIPExtendedCommunityResource.ResourceType.Namespace, Diagnostics); + private IpExtendedCommunitiesRestOperations NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient => _networkFabricIPExtendedCommunityIPExtendedCommunitiesRestClient ??= new IpExtendedCommunitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricIPExtendedCommunityResource.ResourceType)); + private ClientDiagnostics NetworkFabricIPPrefixIpPrefixesClientDiagnostics => _networkFabricIPPrefixIPPrefixesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricIPPrefixResource.ResourceType.Namespace, Diagnostics); + private IpPrefixesRestOperations NetworkFabricIPPrefixIpPrefixesRestClient => _networkFabricIPPrefixIPPrefixesRestClient ??= new IpPrefixesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricIPPrefixResource.ResourceType)); + private ClientDiagnostics NetworkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics => _networkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricL2IsolationDomainResource.ResourceType.Namespace, Diagnostics); + private L2IsolationDomainsRestOperations NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient => _networkFabricL2IsolationDomainL2IsolationDomainsRestClient ??= new L2IsolationDomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricL2IsolationDomainResource.ResourceType)); + private ClientDiagnostics NetworkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics => _networkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricL3IsolationDomainResource.ResourceType.Namespace, Diagnostics); + private L3IsolationDomainsRestOperations NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient => _networkFabricL3IsolationDomainL3IsolationDomainsRestClient ??= new L3IsolationDomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricL3IsolationDomainResource.ResourceType)); + private ClientDiagnostics NetworkFabricNeighborGroupNeighborGroupsClientDiagnostics => _networkFabricNeighborGroupNeighborGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricNeighborGroupResource.ResourceType.Namespace, Diagnostics); + private NeighborGroupsRestOperations NetworkFabricNeighborGroupNeighborGroupsRestClient => _networkFabricNeighborGroupNeighborGroupsRestClient ??= new NeighborGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricNeighborGroupResource.ResourceType)); + private ClientDiagnostics NetworkDeviceClientDiagnostics => _networkDeviceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkDeviceResource.ResourceType.Namespace, Diagnostics); + private NetworkDevicesRestOperations NetworkDeviceRestClient => _networkDeviceRestClient ??= new NetworkDevicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkDeviceResource.ResourceType)); + private ClientDiagnostics NetworkFabricControllerClientDiagnostics => _networkFabricControllerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricControllerResource.ResourceType.Namespace, Diagnostics); + private NetworkFabricControllersRestOperations NetworkFabricControllerRestClient => _networkFabricControllerRestClient ??= new NetworkFabricControllersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricControllerResource.ResourceType)); + private ClientDiagnostics NetworkFabricClientDiagnostics => _networkFabricClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricResource.ResourceType.Namespace, Diagnostics); + private NetworkFabricsRestOperations NetworkFabricRestClient => _networkFabricRestClient ??= new NetworkFabricsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricResource.ResourceType)); + private ClientDiagnostics NetworkPacketBrokerClientDiagnostics => _networkPacketBrokerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkPacketBrokerResource.ResourceType.Namespace, Diagnostics); + private NetworkPacketBrokersRestOperations NetworkPacketBrokerRestClient => _networkPacketBrokerRestClient ??= new NetworkPacketBrokersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkPacketBrokerResource.ResourceType)); + private ClientDiagnostics NetworkRackClientDiagnostics => _networkRackClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkRackResource.ResourceType.Namespace, Diagnostics); + private NetworkRacksRestOperations NetworkRackRestClient => _networkRackRestClient ??= new NetworkRacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkRackResource.ResourceType)); + private ClientDiagnostics NetworkTapRuleClientDiagnostics => _networkTapRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkTapRuleResource.ResourceType.Namespace, Diagnostics); + private NetworkTapRulesRestOperations NetworkTapRuleRestClient => _networkTapRuleRestClient ??= new NetworkTapRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkTapRuleResource.ResourceType)); + private ClientDiagnostics NetworkTapClientDiagnostics => _networkTapClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkTapResource.ResourceType.Namespace, Diagnostics); + private NetworkTapsRestOperations NetworkTapRestClient => _networkTapRestClient ??= new NetworkTapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkTapResource.ResourceType)); + private ClientDiagnostics NetworkFabricRoutePolicyRoutePoliciesClientDiagnostics => _networkFabricRoutePolicyRoutePoliciesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricRoutePolicyResource.ResourceType.Namespace, Diagnostics); + private RoutePoliciesRestOperations NetworkFabricRoutePolicyRoutePoliciesRestClient => _networkFabricRoutePolicyRoutePoliciesRestClient ??= new RoutePoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricRoutePolicyResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NetworkDeviceSkuResources in the SubscriptionResource. + /// An object representing collection of NetworkDeviceSkuResources and their operations over a NetworkDeviceSkuResource. + public virtual NetworkDeviceSkuCollection GetNetworkDeviceSkus() + { + return GetCachedClient(client => new NetworkDeviceSkuCollection(client, Id)); + } + + /// + /// Get a Network Device SKU details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus/{networkDeviceSkuName} + /// + /// + /// Operation Id + /// NetworkDeviceSkus_Get + /// + /// + /// + /// Name of the Network Device SKU. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkDeviceSkuAsync(string networkDeviceSkuName, CancellationToken cancellationToken = default) + { + return await GetNetworkDeviceSkus().GetAsync(networkDeviceSkuName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Network Device SKU details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus/{networkDeviceSkuName} + /// + /// + /// Operation Id + /// NetworkDeviceSkus_Get + /// + /// + /// + /// Name of the Network Device SKU. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkDeviceSku(string networkDeviceSkuName, CancellationToken cancellationToken = default) + { + return GetNetworkDeviceSkus().Get(networkDeviceSkuName, cancellationToken); + } + + /// Gets a collection of NetworkFabricSkuResources in the SubscriptionResource. + /// An object representing collection of NetworkFabricSkuResources and their operations over a NetworkFabricSkuResource. + public virtual NetworkFabricSkuCollection GetNetworkFabricSkus() + { + return GetCachedClient(client => new NetworkFabricSkuCollection(client, Id)); + } + + /// + /// Implements Network Fabric SKU GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus/{networkFabricSkuName} + /// + /// + /// Operation Id + /// NetworkFabricSkus_Get + /// + /// + /// + /// Name of the Network Fabric SKU. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkFabricSkuAsync(string networkFabricSkuName, CancellationToken cancellationToken = default) + { + return await GetNetworkFabricSkus().GetAsync(networkFabricSkuName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Implements Network Fabric SKU GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus/{networkFabricSkuName} + /// + /// + /// Operation Id + /// NetworkFabricSkus_Get + /// + /// + /// + /// Name of the Network Fabric SKU. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkFabricSku(string networkFabricSkuName, CancellationToken cancellationToken = default) + { + return GetNetworkFabricSkus().Get(networkFabricSkuName, cancellationToken); + } + + /// + /// Implements AccessControlLists list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/accessControlLists + /// + /// + /// Operation Id + /// AccessControlLists_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricAccessControlListsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricAccessControlListAccessControlListsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricAccessControlListAccessControlListsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricAccessControlListResource(Client, NetworkFabricAccessControlListData.DeserializeNetworkFabricAccessControlListData(e)), NetworkFabricAccessControlListAccessControlListsClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricAccessControlLists", "value", "nextLink", cancellationToken); + } + + /// + /// Implements AccessControlLists list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/accessControlLists + /// + /// + /// Operation Id + /// AccessControlLists_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricAccessControlLists(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricAccessControlListAccessControlListsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricAccessControlListAccessControlListsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricAccessControlListResource(Client, NetworkFabricAccessControlListData.DeserializeNetworkFabricAccessControlListData(e)), NetworkFabricAccessControlListAccessControlListsClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricAccessControlLists", "value", "nextLink", cancellationToken); + } + + /// + /// Displays Internet Gateways list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/internetGateways + /// + /// + /// Operation Id + /// InternetGateways_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricInternetGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricInternetGatewayInternetGatewaysRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricInternetGatewayInternetGatewaysRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricInternetGatewayResource(Client, NetworkFabricInternetGatewayData.DeserializeNetworkFabricInternetGatewayData(e)), NetworkFabricInternetGatewayInternetGatewaysClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricInternetGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Displays Internet Gateways list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/internetGateways + /// + /// + /// Operation Id + /// InternetGateways_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricInternetGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricInternetGatewayInternetGatewaysRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricInternetGatewayInternetGatewaysRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricInternetGatewayResource(Client, NetworkFabricInternetGatewayData.DeserializeNetworkFabricInternetGatewayData(e)), NetworkFabricInternetGatewayInternetGatewaysClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricInternetGateways", "value", "nextLink", cancellationToken); + } + + /// + /// List all Internet Gateway rules in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/internetGatewayRules + /// + /// + /// Operation Id + /// InternetGatewayRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricInternetGatewayRulesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricInternetGatewayRuleResource(Client, NetworkFabricInternetGatewayRuleData.DeserializeNetworkFabricInternetGatewayRuleData(e)), NetworkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricInternetGatewayRules", "value", "nextLink", cancellationToken); + } + + /// + /// List all Internet Gateway rules in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/internetGatewayRules + /// + /// + /// Operation Id + /// InternetGatewayRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricInternetGatewayRules(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricInternetGatewayRuleResource(Client, NetworkFabricInternetGatewayRuleData.DeserializeNetworkFabricInternetGatewayRuleData(e)), NetworkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricInternetGatewayRules", "value", "nextLink", cancellationToken); + } + + /// + /// Implements IP Communities list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipCommunities + /// + /// + /// Operation Id + /// IpCommunities_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricIPCommunitiesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPCommunityIpCommunitiesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPCommunityIpCommunitiesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPCommunityResource(Client, NetworkFabricIPCommunityData.DeserializeNetworkFabricIPCommunityData(e)), NetworkFabricIPCommunityIpCommunitiesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricIPCommunities", "value", "nextLink", cancellationToken); + } + + /// + /// Implements IP Communities list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipCommunities + /// + /// + /// Operation Id + /// IpCommunities_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricIPCommunities(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPCommunityIpCommunitiesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPCommunityIpCommunitiesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPCommunityResource(Client, NetworkFabricIPCommunityData.DeserializeNetworkFabricIPCommunityData(e)), NetworkFabricIPCommunityIpCommunitiesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricIPCommunities", "value", "nextLink", cancellationToken); + } + + /// + /// Implements IpExtendedCommunities list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities + /// + /// + /// Operation Id + /// IpExtendedCommunities_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricIPExtendedCommunitiesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPExtendedCommunityResource(Client, NetworkFabricIPExtendedCommunityData.DeserializeNetworkFabricIPExtendedCommunityData(e)), NetworkFabricIPExtendedCommunityIpExtendedCommunitiesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricIPExtendedCommunities", "value", "nextLink", cancellationToken); + } + + /// + /// Implements IpExtendedCommunities list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities + /// + /// + /// Operation Id + /// IpExtendedCommunities_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricIPExtendedCommunities(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPExtendedCommunityResource(Client, NetworkFabricIPExtendedCommunityData.DeserializeNetworkFabricIPExtendedCommunityData(e)), NetworkFabricIPExtendedCommunityIpExtendedCommunitiesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricIPExtendedCommunities", "value", "nextLink", cancellationToken); + } + + /// + /// Implements IpPrefixes list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes + /// + /// + /// Operation Id + /// IpPrefixes_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricIPPrefixesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPPrefixIpPrefixesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPPrefixIpPrefixesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPPrefixResource(Client, NetworkFabricIPPrefixData.DeserializeNetworkFabricIPPrefixData(e)), NetworkFabricIPPrefixIpPrefixesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricIPPrefixes", "value", "nextLink", cancellationToken); + } + + /// + /// Implements IpPrefixes list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes + /// + /// + /// Operation Id + /// IpPrefixes_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricIPPrefixes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPPrefixIpPrefixesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPPrefixIpPrefixesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPPrefixResource(Client, NetworkFabricIPPrefixData.DeserializeNetworkFabricIPPrefixData(e)), NetworkFabricIPPrefixIpPrefixesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricIPPrefixes", "value", "nextLink", cancellationToken); + } + + /// + /// Displays L2IsolationDomains list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains + /// + /// + /// Operation Id + /// L2IsolationDomains_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricL2IsolationDomainsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricL2IsolationDomainResource(Client, NetworkFabricL2IsolationDomainData.DeserializeNetworkFabricL2IsolationDomainData(e)), NetworkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricL2IsolationDomains", "value", "nextLink", cancellationToken); + } + + /// + /// Displays L2IsolationDomains list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains + /// + /// + /// Operation Id + /// L2IsolationDomains_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricL2IsolationDomains(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricL2IsolationDomainResource(Client, NetworkFabricL2IsolationDomainData.DeserializeNetworkFabricL2IsolationDomainData(e)), NetworkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricL2IsolationDomains", "value", "nextLink", cancellationToken); + } + + /// + /// Displays L3IsolationDomains list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains + /// + /// + /// Operation Id + /// L3IsolationDomains_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricL3IsolationDomainsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricL3IsolationDomainResource(Client, NetworkFabricL3IsolationDomainData.DeserializeNetworkFabricL3IsolationDomainData(e)), NetworkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricL3IsolationDomains", "value", "nextLink", cancellationToken); + } + + /// + /// Displays L3IsolationDomains list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains + /// + /// + /// Operation Id + /// L3IsolationDomains_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricL3IsolationDomains(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricL3IsolationDomainResource(Client, NetworkFabricL3IsolationDomainData.DeserializeNetworkFabricL3IsolationDomainData(e)), NetworkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricL3IsolationDomains", "value", "nextLink", cancellationToken); + } + + /// + /// Displays NeighborGroups list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/neighborGroups + /// + /// + /// Operation Id + /// NeighborGroups_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricNeighborGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricNeighborGroupNeighborGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricNeighborGroupNeighborGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricNeighborGroupResource(Client, NetworkFabricNeighborGroupData.DeserializeNetworkFabricNeighborGroupData(e)), NetworkFabricNeighborGroupNeighborGroupsClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricNeighborGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Displays NeighborGroups list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/neighborGroups + /// + /// + /// Operation Id + /// NeighborGroups_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricNeighborGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricNeighborGroupNeighborGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricNeighborGroupNeighborGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricNeighborGroupResource(Client, NetworkFabricNeighborGroupData.DeserializeNetworkFabricNeighborGroupData(e)), NetworkFabricNeighborGroupNeighborGroupsClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricNeighborGroups", "value", "nextLink", cancellationToken); + } + + /// + /// List all the Network Device resources in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDevices + /// + /// + /// Operation Id + /// NetworkDevices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkDevicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkDeviceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkDeviceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkDeviceResource(Client, NetworkDeviceData.DeserializeNetworkDeviceData(e)), NetworkDeviceClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkDevices", "value", "nextLink", cancellationToken); + } + + /// + /// List all the Network Device resources in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDevices + /// + /// + /// Operation Id + /// NetworkDevices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkDevices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkDeviceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkDeviceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkDeviceResource(Client, NetworkDeviceData.DeserializeNetworkDeviceData(e)), NetworkDeviceClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkDevices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the NetworkFabricControllers by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers + /// + /// + /// Operation Id + /// NetworkFabricControllers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricControllersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricControllerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricControllerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricControllerResource(Client, NetworkFabricControllerData.DeserializeNetworkFabricControllerData(e)), NetworkFabricControllerClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricControllers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the NetworkFabricControllers by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers + /// + /// + /// Operation Id + /// NetworkFabricControllers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricControllers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricControllerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricControllerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricControllerResource(Client, NetworkFabricControllerData.DeserializeNetworkFabricControllerData(e)), NetworkFabricControllerClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricControllers", "value", "nextLink", cancellationToken); + } + + /// + /// List all the Network Fabric resources in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabrics + /// + /// + /// Operation Id + /// NetworkFabrics_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricResource(Client, NetworkFabricData.DeserializeNetworkFabricData(e)), NetworkFabricClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabrics", "value", "nextLink", cancellationToken); + } + + /// + /// List all the Network Fabric resources in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabrics + /// + /// + /// Operation Id + /// NetworkFabrics_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabrics(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricResource(Client, NetworkFabricData.DeserializeNetworkFabricData(e)), NetworkFabricClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabrics", "value", "nextLink", cancellationToken); + } + + /// + /// Displays Network Packet Brokers list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers + /// + /// + /// Operation Id + /// NetworkPacketBrokers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkPacketBrokersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkPacketBrokerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkPacketBrokerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkPacketBrokerResource(Client, NetworkPacketBrokerData.DeserializeNetworkPacketBrokerData(e)), NetworkPacketBrokerClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkPacketBrokers", "value", "nextLink", cancellationToken); + } + + /// + /// Displays Network Packet Brokers list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers + /// + /// + /// Operation Id + /// NetworkPacketBrokers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkPacketBrokers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkPacketBrokerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkPacketBrokerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkPacketBrokerResource(Client, NetworkPacketBrokerData.DeserializeNetworkPacketBrokerData(e)), NetworkPacketBrokerClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkPacketBrokers", "value", "nextLink", cancellationToken); + } + + /// + /// List all Network Rack resources in the given subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRacks + /// + /// + /// Operation Id + /// NetworkRacks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkRacksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkRackRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkRackRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkRackResource(Client, NetworkRackData.DeserializeNetworkRackData(e)), NetworkRackClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkRacks", "value", "nextLink", cancellationToken); + } + + /// + /// List all Network Rack resources in the given subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRacks + /// + /// + /// Operation Id + /// NetworkRacks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkRacks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkRackRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkRackRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkRackResource(Client, NetworkRackData.DeserializeNetworkRackData(e)), NetworkRackClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkRacks", "value", "nextLink", cancellationToken); + } + + /// + /// List all the Network Tap Rule resources in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkTapRules + /// + /// + /// Operation Id + /// NetworkTapRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkTapRulesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkTapRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkTapRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkTapRuleResource(Client, NetworkTapRuleData.DeserializeNetworkTapRuleData(e)), NetworkTapRuleClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkTapRules", "value", "nextLink", cancellationToken); + } + + /// + /// List all the Network Tap Rule resources in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkTapRules + /// + /// + /// Operation Id + /// NetworkTapRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkTapRules(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkTapRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkTapRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkTapRuleResource(Client, NetworkTapRuleData.DeserializeNetworkTapRuleData(e)), NetworkTapRuleClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkTapRules", "value", "nextLink", cancellationToken); + } + + /// + /// Displays Network Taps list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkTaps + /// + /// + /// Operation Id + /// NetworkTaps_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkTapsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkTapRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkTapRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkTapResource(Client, NetworkTapData.DeserializeNetworkTapData(e)), NetworkTapClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkTaps", "value", "nextLink", cancellationToken); + } + + /// + /// Displays Network Taps list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkTaps + /// + /// + /// Operation Id + /// NetworkTaps_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkTaps(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkTapRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkTapRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkTapResource(Client, NetworkTapData.DeserializeNetworkTapData(e)), NetworkTapClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkTaps", "value", "nextLink", cancellationToken); + } + + /// + /// Implements RoutePolicies list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/routePolicies + /// + /// + /// Operation Id + /// RoutePolicies_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkFabricRoutePoliciesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricRoutePolicyRoutePoliciesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricRoutePolicyRoutePoliciesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricRoutePolicyResource(Client, NetworkFabricRoutePolicyData.DeserializeNetworkFabricRoutePolicyData(e)), NetworkFabricRoutePolicyRoutePoliciesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricRoutePolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Implements RoutePolicies list by subscription GET method. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/routePolicies + /// + /// + /// Operation Id + /// RoutePolicies_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkFabricRoutePolicies(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricRoutePolicyRoutePoliciesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricRoutePolicyRoutePoliciesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricRoutePolicyResource(Client, NetworkFabricRoutePolicyData.DeserializeNetworkFabricRoutePolicyData(e)), NetworkFabricRoutePolicyRoutePoliciesClientDiagnostics, Pipeline, "MockableManagedNetworkFabricSubscriptionResource.GetNetworkFabricRoutePolicies", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 30435260e317a..0000000000000 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedNetworkFabric -{ - /// 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 NetworkFabricAccessControlListResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricAccessControlListResources and their operations over a NetworkFabricAccessControlListResource. - public virtual NetworkFabricAccessControlListCollection GetNetworkFabricAccessControlLists() - { - return GetCachedClient(Client => new NetworkFabricAccessControlListCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricInternetGatewayResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricInternetGatewayResources and their operations over a NetworkFabricInternetGatewayResource. - public virtual NetworkFabricInternetGatewayCollection GetNetworkFabricInternetGateways() - { - return GetCachedClient(Client => new NetworkFabricInternetGatewayCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricInternetGatewayRuleResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricInternetGatewayRuleResources and their operations over a NetworkFabricInternetGatewayRuleResource. - public virtual NetworkFabricInternetGatewayRuleCollection GetNetworkFabricInternetGatewayRules() - { - return GetCachedClient(Client => new NetworkFabricInternetGatewayRuleCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricIPCommunityResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricIPCommunityResources and their operations over a NetworkFabricIPCommunityResource. - public virtual NetworkFabricIPCommunityCollection GetNetworkFabricIPCommunities() - { - return GetCachedClient(Client => new NetworkFabricIPCommunityCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricIPExtendedCommunityResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricIPExtendedCommunityResources and their operations over a NetworkFabricIPExtendedCommunityResource. - public virtual NetworkFabricIPExtendedCommunityCollection GetNetworkFabricIPExtendedCommunities() - { - return GetCachedClient(Client => new NetworkFabricIPExtendedCommunityCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricIPPrefixResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricIPPrefixResources and their operations over a NetworkFabricIPPrefixResource. - public virtual NetworkFabricIPPrefixCollection GetNetworkFabricIPPrefixes() - { - return GetCachedClient(Client => new NetworkFabricIPPrefixCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricL2IsolationDomainResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricL2IsolationDomainResources and their operations over a NetworkFabricL2IsolationDomainResource. - public virtual NetworkFabricL2IsolationDomainCollection GetNetworkFabricL2IsolationDomains() - { - return GetCachedClient(Client => new NetworkFabricL2IsolationDomainCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricL3IsolationDomainResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricL3IsolationDomainResources and their operations over a NetworkFabricL3IsolationDomainResource. - public virtual NetworkFabricL3IsolationDomainCollection GetNetworkFabricL3IsolationDomains() - { - return GetCachedClient(Client => new NetworkFabricL3IsolationDomainCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricNeighborGroupResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricNeighborGroupResources and their operations over a NetworkFabricNeighborGroupResource. - public virtual NetworkFabricNeighborGroupCollection GetNetworkFabricNeighborGroups() - { - return GetCachedClient(Client => new NetworkFabricNeighborGroupCollection(Client, Id)); - } - - /// Gets a collection of NetworkDeviceResources in the ResourceGroupResource. - /// An object representing collection of NetworkDeviceResources and their operations over a NetworkDeviceResource. - public virtual NetworkDeviceCollection GetNetworkDevices() - { - return GetCachedClient(Client => new NetworkDeviceCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricControllerResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricControllerResources and their operations over a NetworkFabricControllerResource. - public virtual NetworkFabricControllerCollection GetNetworkFabricControllers() - { - return GetCachedClient(Client => new NetworkFabricControllerCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricResources and their operations over a NetworkFabricResource. - public virtual NetworkFabricCollection GetNetworkFabrics() - { - return GetCachedClient(Client => new NetworkFabricCollection(Client, Id)); - } - - /// Gets a collection of NetworkPacketBrokerResources in the ResourceGroupResource. - /// An object representing collection of NetworkPacketBrokerResources and their operations over a NetworkPacketBrokerResource. - public virtual NetworkPacketBrokerCollection GetNetworkPacketBrokers() - { - return GetCachedClient(Client => new NetworkPacketBrokerCollection(Client, Id)); - } - - /// Gets a collection of NetworkRackResources in the ResourceGroupResource. - /// An object representing collection of NetworkRackResources and their operations over a NetworkRackResource. - public virtual NetworkRackCollection GetNetworkRacks() - { - return GetCachedClient(Client => new NetworkRackCollection(Client, Id)); - } - - /// Gets a collection of NetworkTapRuleResources in the ResourceGroupResource. - /// An object representing collection of NetworkTapRuleResources and their operations over a NetworkTapRuleResource. - public virtual NetworkTapRuleCollection GetNetworkTapRules() - { - return GetCachedClient(Client => new NetworkTapRuleCollection(Client, Id)); - } - - /// Gets a collection of NetworkTapResources in the ResourceGroupResource. - /// An object representing collection of NetworkTapResources and their operations over a NetworkTapResource. - public virtual NetworkTapCollection GetNetworkTaps() - { - return GetCachedClient(Client => new NetworkTapCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricRoutePolicyResources in the ResourceGroupResource. - /// An object representing collection of NetworkFabricRoutePolicyResources and their operations over a NetworkFabricRoutePolicyResource. - public virtual NetworkFabricRoutePolicyCollection GetNetworkFabricRoutePolicies() - { - return GetCachedClient(Client => new NetworkFabricRoutePolicyCollection(Client, Id)); - } - } -} diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 32775a8812e8e..0000000000000 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,870 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedNetworkFabric -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _networkFabricAccessControlListAccessControlListsClientDiagnostics; - private AccessControlListsRestOperations _networkFabricAccessControlListAccessControlListsRestClient; - private ClientDiagnostics _networkFabricInternetGatewayInternetGatewaysClientDiagnostics; - private InternetGatewaysRestOperations _networkFabricInternetGatewayInternetGatewaysRestClient; - private ClientDiagnostics _networkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics; - private InternetGatewayRulesRestOperations _networkFabricInternetGatewayRuleInternetGatewayRulesRestClient; - private ClientDiagnostics _networkFabricIPCommunityIPCommunitiesClientDiagnostics; - private IpCommunitiesRestOperations _networkFabricIPCommunityIPCommunitiesRestClient; - private ClientDiagnostics _networkFabricIPExtendedCommunityIPExtendedCommunitiesClientDiagnostics; - private IpExtendedCommunitiesRestOperations _networkFabricIPExtendedCommunityIPExtendedCommunitiesRestClient; - private ClientDiagnostics _networkFabricIPPrefixIPPrefixesClientDiagnostics; - private IpPrefixesRestOperations _networkFabricIPPrefixIPPrefixesRestClient; - private ClientDiagnostics _networkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics; - private L2IsolationDomainsRestOperations _networkFabricL2IsolationDomainL2IsolationDomainsRestClient; - private ClientDiagnostics _networkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics; - private L3IsolationDomainsRestOperations _networkFabricL3IsolationDomainL3IsolationDomainsRestClient; - private ClientDiagnostics _networkFabricNeighborGroupNeighborGroupsClientDiagnostics; - private NeighborGroupsRestOperations _networkFabricNeighborGroupNeighborGroupsRestClient; - private ClientDiagnostics _networkDeviceClientDiagnostics; - private NetworkDevicesRestOperations _networkDeviceRestClient; - private ClientDiagnostics _networkFabricControllerClientDiagnostics; - private NetworkFabricControllersRestOperations _networkFabricControllerRestClient; - private ClientDiagnostics _networkFabricClientDiagnostics; - private NetworkFabricsRestOperations _networkFabricRestClient; - private ClientDiagnostics _networkPacketBrokerClientDiagnostics; - private NetworkPacketBrokersRestOperations _networkPacketBrokerRestClient; - private ClientDiagnostics _networkRackClientDiagnostics; - private NetworkRacksRestOperations _networkRackRestClient; - private ClientDiagnostics _networkTapRuleClientDiagnostics; - private NetworkTapRulesRestOperations _networkTapRuleRestClient; - private ClientDiagnostics _networkTapClientDiagnostics; - private NetworkTapsRestOperations _networkTapRestClient; - private ClientDiagnostics _networkFabricRoutePolicyRoutePoliciesClientDiagnostics; - private RoutePoliciesRestOperations _networkFabricRoutePolicyRoutePoliciesRestClient; - - /// 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 NetworkFabricAccessControlListAccessControlListsClientDiagnostics => _networkFabricAccessControlListAccessControlListsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricAccessControlListResource.ResourceType.Namespace, Diagnostics); - private AccessControlListsRestOperations NetworkFabricAccessControlListAccessControlListsRestClient => _networkFabricAccessControlListAccessControlListsRestClient ??= new AccessControlListsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricAccessControlListResource.ResourceType)); - private ClientDiagnostics NetworkFabricInternetGatewayInternetGatewaysClientDiagnostics => _networkFabricInternetGatewayInternetGatewaysClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricInternetGatewayResource.ResourceType.Namespace, Diagnostics); - private InternetGatewaysRestOperations NetworkFabricInternetGatewayInternetGatewaysRestClient => _networkFabricInternetGatewayInternetGatewaysRestClient ??= new InternetGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricInternetGatewayResource.ResourceType)); - private ClientDiagnostics NetworkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics => _networkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricInternetGatewayRuleResource.ResourceType.Namespace, Diagnostics); - private InternetGatewayRulesRestOperations NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient => _networkFabricInternetGatewayRuleInternetGatewayRulesRestClient ??= new InternetGatewayRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricInternetGatewayRuleResource.ResourceType)); - private ClientDiagnostics NetworkFabricIPCommunityIpCommunitiesClientDiagnostics => _networkFabricIPCommunityIPCommunitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricIPCommunityResource.ResourceType.Namespace, Diagnostics); - private IpCommunitiesRestOperations NetworkFabricIPCommunityIpCommunitiesRestClient => _networkFabricIPCommunityIPCommunitiesRestClient ??= new IpCommunitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricIPCommunityResource.ResourceType)); - private ClientDiagnostics NetworkFabricIPExtendedCommunityIpExtendedCommunitiesClientDiagnostics => _networkFabricIPExtendedCommunityIPExtendedCommunitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricIPExtendedCommunityResource.ResourceType.Namespace, Diagnostics); - private IpExtendedCommunitiesRestOperations NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient => _networkFabricIPExtendedCommunityIPExtendedCommunitiesRestClient ??= new IpExtendedCommunitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricIPExtendedCommunityResource.ResourceType)); - private ClientDiagnostics NetworkFabricIPPrefixIpPrefixesClientDiagnostics => _networkFabricIPPrefixIPPrefixesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricIPPrefixResource.ResourceType.Namespace, Diagnostics); - private IpPrefixesRestOperations NetworkFabricIPPrefixIpPrefixesRestClient => _networkFabricIPPrefixIPPrefixesRestClient ??= new IpPrefixesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricIPPrefixResource.ResourceType)); - private ClientDiagnostics NetworkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics => _networkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricL2IsolationDomainResource.ResourceType.Namespace, Diagnostics); - private L2IsolationDomainsRestOperations NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient => _networkFabricL2IsolationDomainL2IsolationDomainsRestClient ??= new L2IsolationDomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricL2IsolationDomainResource.ResourceType)); - private ClientDiagnostics NetworkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics => _networkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricL3IsolationDomainResource.ResourceType.Namespace, Diagnostics); - private L3IsolationDomainsRestOperations NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient => _networkFabricL3IsolationDomainL3IsolationDomainsRestClient ??= new L3IsolationDomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricL3IsolationDomainResource.ResourceType)); - private ClientDiagnostics NetworkFabricNeighborGroupNeighborGroupsClientDiagnostics => _networkFabricNeighborGroupNeighborGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricNeighborGroupResource.ResourceType.Namespace, Diagnostics); - private NeighborGroupsRestOperations NetworkFabricNeighborGroupNeighborGroupsRestClient => _networkFabricNeighborGroupNeighborGroupsRestClient ??= new NeighborGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricNeighborGroupResource.ResourceType)); - private ClientDiagnostics NetworkDeviceClientDiagnostics => _networkDeviceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkDeviceResource.ResourceType.Namespace, Diagnostics); - private NetworkDevicesRestOperations NetworkDeviceRestClient => _networkDeviceRestClient ??= new NetworkDevicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkDeviceResource.ResourceType)); - private ClientDiagnostics NetworkFabricControllerClientDiagnostics => _networkFabricControllerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricControllerResource.ResourceType.Namespace, Diagnostics); - private NetworkFabricControllersRestOperations NetworkFabricControllerRestClient => _networkFabricControllerRestClient ??= new NetworkFabricControllersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricControllerResource.ResourceType)); - private ClientDiagnostics NetworkFabricClientDiagnostics => _networkFabricClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricResource.ResourceType.Namespace, Diagnostics); - private NetworkFabricsRestOperations NetworkFabricRestClient => _networkFabricRestClient ??= new NetworkFabricsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricResource.ResourceType)); - private ClientDiagnostics NetworkPacketBrokerClientDiagnostics => _networkPacketBrokerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkPacketBrokerResource.ResourceType.Namespace, Diagnostics); - private NetworkPacketBrokersRestOperations NetworkPacketBrokerRestClient => _networkPacketBrokerRestClient ??= new NetworkPacketBrokersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkPacketBrokerResource.ResourceType)); - private ClientDiagnostics NetworkRackClientDiagnostics => _networkRackClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkRackResource.ResourceType.Namespace, Diagnostics); - private NetworkRacksRestOperations NetworkRackRestClient => _networkRackRestClient ??= new NetworkRacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkRackResource.ResourceType)); - private ClientDiagnostics NetworkTapRuleClientDiagnostics => _networkTapRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkTapRuleResource.ResourceType.Namespace, Diagnostics); - private NetworkTapRulesRestOperations NetworkTapRuleRestClient => _networkTapRuleRestClient ??= new NetworkTapRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkTapRuleResource.ResourceType)); - private ClientDiagnostics NetworkTapClientDiagnostics => _networkTapClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkTapResource.ResourceType.Namespace, Diagnostics); - private NetworkTapsRestOperations NetworkTapRestClient => _networkTapRestClient ??= new NetworkTapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkTapResource.ResourceType)); - private ClientDiagnostics NetworkFabricRoutePolicyRoutePoliciesClientDiagnostics => _networkFabricRoutePolicyRoutePoliciesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedNetworkFabric", NetworkFabricRoutePolicyResource.ResourceType.Namespace, Diagnostics); - private RoutePoliciesRestOperations NetworkFabricRoutePolicyRoutePoliciesRestClient => _networkFabricRoutePolicyRoutePoliciesRestClient ??= new RoutePoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkFabricRoutePolicyResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of NetworkDeviceSkuResources in the SubscriptionResource. - /// An object representing collection of NetworkDeviceSkuResources and their operations over a NetworkDeviceSkuResource. - public virtual NetworkDeviceSkuCollection GetNetworkDeviceSkus() - { - return GetCachedClient(Client => new NetworkDeviceSkuCollection(Client, Id)); - } - - /// Gets a collection of NetworkFabricSkuResources in the SubscriptionResource. - /// An object representing collection of NetworkFabricSkuResources and their operations over a NetworkFabricSkuResource. - public virtual NetworkFabricSkuCollection GetNetworkFabricSkus() - { - return GetCachedClient(Client => new NetworkFabricSkuCollection(Client, Id)); - } - - /// - /// Implements AccessControlLists list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/accessControlLists - /// - /// - /// Operation Id - /// AccessControlLists_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricAccessControlListsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricAccessControlListAccessControlListsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricAccessControlListAccessControlListsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricAccessControlListResource(Client, NetworkFabricAccessControlListData.DeserializeNetworkFabricAccessControlListData(e)), NetworkFabricAccessControlListAccessControlListsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricAccessControlLists", "value", "nextLink", cancellationToken); - } - - /// - /// Implements AccessControlLists list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/accessControlLists - /// - /// - /// Operation Id - /// AccessControlLists_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricAccessControlLists(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricAccessControlListAccessControlListsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricAccessControlListAccessControlListsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricAccessControlListResource(Client, NetworkFabricAccessControlListData.DeserializeNetworkFabricAccessControlListData(e)), NetworkFabricAccessControlListAccessControlListsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricAccessControlLists", "value", "nextLink", cancellationToken); - } - - /// - /// Displays Internet Gateways list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/internetGateways - /// - /// - /// Operation Id - /// InternetGateways_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricInternetGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricInternetGatewayInternetGatewaysRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricInternetGatewayInternetGatewaysRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricInternetGatewayResource(Client, NetworkFabricInternetGatewayData.DeserializeNetworkFabricInternetGatewayData(e)), NetworkFabricInternetGatewayInternetGatewaysClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricInternetGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Displays Internet Gateways list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/internetGateways - /// - /// - /// Operation Id - /// InternetGateways_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricInternetGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricInternetGatewayInternetGatewaysRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricInternetGatewayInternetGatewaysRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricInternetGatewayResource(Client, NetworkFabricInternetGatewayData.DeserializeNetworkFabricInternetGatewayData(e)), NetworkFabricInternetGatewayInternetGatewaysClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricInternetGateways", "value", "nextLink", cancellationToken); - } - - /// - /// List all Internet Gateway rules in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/internetGatewayRules - /// - /// - /// Operation Id - /// InternetGatewayRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricInternetGatewayRulesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricInternetGatewayRuleResource(Client, NetworkFabricInternetGatewayRuleData.DeserializeNetworkFabricInternetGatewayRuleData(e)), NetworkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricInternetGatewayRules", "value", "nextLink", cancellationToken); - } - - /// - /// List all Internet Gateway rules in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/internetGatewayRules - /// - /// - /// Operation Id - /// InternetGatewayRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricInternetGatewayRules(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricInternetGatewayRuleInternetGatewayRulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricInternetGatewayRuleResource(Client, NetworkFabricInternetGatewayRuleData.DeserializeNetworkFabricInternetGatewayRuleData(e)), NetworkFabricInternetGatewayRuleInternetGatewayRulesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricInternetGatewayRules", "value", "nextLink", cancellationToken); - } - - /// - /// Implements IP Communities list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipCommunities - /// - /// - /// Operation Id - /// IpCommunities_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricIPCommunitiesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPCommunityIpCommunitiesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPCommunityIpCommunitiesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPCommunityResource(Client, NetworkFabricIPCommunityData.DeserializeNetworkFabricIPCommunityData(e)), NetworkFabricIPCommunityIpCommunitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricIPCommunities", "value", "nextLink", cancellationToken); - } - - /// - /// Implements IP Communities list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipCommunities - /// - /// - /// Operation Id - /// IpCommunities_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricIPCommunities(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPCommunityIpCommunitiesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPCommunityIpCommunitiesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPCommunityResource(Client, NetworkFabricIPCommunityData.DeserializeNetworkFabricIPCommunityData(e)), NetworkFabricIPCommunityIpCommunitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricIPCommunities", "value", "nextLink", cancellationToken); - } - - /// - /// Implements IpExtendedCommunities list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities - /// - /// - /// Operation Id - /// IpExtendedCommunities_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricIPExtendedCommunitiesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPExtendedCommunityResource(Client, NetworkFabricIPExtendedCommunityData.DeserializeNetworkFabricIPExtendedCommunityData(e)), NetworkFabricIPExtendedCommunityIpExtendedCommunitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricIPExtendedCommunities", "value", "nextLink", cancellationToken); - } - - /// - /// Implements IpExtendedCommunities list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities - /// - /// - /// Operation Id - /// IpExtendedCommunities_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricIPExtendedCommunities(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPExtendedCommunityIpExtendedCommunitiesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPExtendedCommunityResource(Client, NetworkFabricIPExtendedCommunityData.DeserializeNetworkFabricIPExtendedCommunityData(e)), NetworkFabricIPExtendedCommunityIpExtendedCommunitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricIPExtendedCommunities", "value", "nextLink", cancellationToken); - } - - /// - /// Implements IpPrefixes list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes - /// - /// - /// Operation Id - /// IpPrefixes_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricIPPrefixesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPPrefixIpPrefixesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPPrefixIpPrefixesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPPrefixResource(Client, NetworkFabricIPPrefixData.DeserializeNetworkFabricIPPrefixData(e)), NetworkFabricIPPrefixIpPrefixesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricIPPrefixes", "value", "nextLink", cancellationToken); - } - - /// - /// Implements IpPrefixes list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes - /// - /// - /// Operation Id - /// IpPrefixes_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricIPPrefixes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricIPPrefixIpPrefixesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricIPPrefixIpPrefixesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricIPPrefixResource(Client, NetworkFabricIPPrefixData.DeserializeNetworkFabricIPPrefixData(e)), NetworkFabricIPPrefixIpPrefixesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricIPPrefixes", "value", "nextLink", cancellationToken); - } - - /// - /// Displays L2IsolationDomains list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains - /// - /// - /// Operation Id - /// L2IsolationDomains_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricL2IsolationDomainsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricL2IsolationDomainResource(Client, NetworkFabricL2IsolationDomainData.DeserializeNetworkFabricL2IsolationDomainData(e)), NetworkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricL2IsolationDomains", "value", "nextLink", cancellationToken); - } - - /// - /// Displays L2IsolationDomains list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains - /// - /// - /// Operation Id - /// L2IsolationDomains_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricL2IsolationDomains(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricL2IsolationDomainL2IsolationDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricL2IsolationDomainResource(Client, NetworkFabricL2IsolationDomainData.DeserializeNetworkFabricL2IsolationDomainData(e)), NetworkFabricL2IsolationDomainL2IsolationDomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricL2IsolationDomains", "value", "nextLink", cancellationToken); - } - - /// - /// Displays L3IsolationDomains list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains - /// - /// - /// Operation Id - /// L3IsolationDomains_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricL3IsolationDomainsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricL3IsolationDomainResource(Client, NetworkFabricL3IsolationDomainData.DeserializeNetworkFabricL3IsolationDomainData(e)), NetworkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricL3IsolationDomains", "value", "nextLink", cancellationToken); - } - - /// - /// Displays L3IsolationDomains list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains - /// - /// - /// Operation Id - /// L3IsolationDomains_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricL3IsolationDomains(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricL3IsolationDomainL3IsolationDomainsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricL3IsolationDomainResource(Client, NetworkFabricL3IsolationDomainData.DeserializeNetworkFabricL3IsolationDomainData(e)), NetworkFabricL3IsolationDomainL3IsolationDomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricL3IsolationDomains", "value", "nextLink", cancellationToken); - } - - /// - /// Displays NeighborGroups list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/neighborGroups - /// - /// - /// Operation Id - /// NeighborGroups_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricNeighborGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricNeighborGroupNeighborGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricNeighborGroupNeighborGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricNeighborGroupResource(Client, NetworkFabricNeighborGroupData.DeserializeNetworkFabricNeighborGroupData(e)), NetworkFabricNeighborGroupNeighborGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricNeighborGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Displays NeighborGroups list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/neighborGroups - /// - /// - /// Operation Id - /// NeighborGroups_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricNeighborGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricNeighborGroupNeighborGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricNeighborGroupNeighborGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricNeighborGroupResource(Client, NetworkFabricNeighborGroupData.DeserializeNetworkFabricNeighborGroupData(e)), NetworkFabricNeighborGroupNeighborGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricNeighborGroups", "value", "nextLink", cancellationToken); - } - - /// - /// List all the Network Device resources in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDevices - /// - /// - /// Operation Id - /// NetworkDevices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkDevicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkDeviceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkDeviceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkDeviceResource(Client, NetworkDeviceData.DeserializeNetworkDeviceData(e)), NetworkDeviceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkDevices", "value", "nextLink", cancellationToken); - } - - /// - /// List all the Network Device resources in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDevices - /// - /// - /// Operation Id - /// NetworkDevices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkDevices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkDeviceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkDeviceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkDeviceResource(Client, NetworkDeviceData.DeserializeNetworkDeviceData(e)), NetworkDeviceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkDevices", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the NetworkFabricControllers by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers - /// - /// - /// Operation Id - /// NetworkFabricControllers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricControllersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricControllerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricControllerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricControllerResource(Client, NetworkFabricControllerData.DeserializeNetworkFabricControllerData(e)), NetworkFabricControllerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricControllers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the NetworkFabricControllers by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers - /// - /// - /// Operation Id - /// NetworkFabricControllers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricControllers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricControllerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricControllerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricControllerResource(Client, NetworkFabricControllerData.DeserializeNetworkFabricControllerData(e)), NetworkFabricControllerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricControllers", "value", "nextLink", cancellationToken); - } - - /// - /// List all the Network Fabric resources in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabrics - /// - /// - /// Operation Id - /// NetworkFabrics_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricResource(Client, NetworkFabricData.DeserializeNetworkFabricData(e)), NetworkFabricClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabrics", "value", "nextLink", cancellationToken); - } - - /// - /// List all the Network Fabric resources in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabrics - /// - /// - /// Operation Id - /// NetworkFabrics_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabrics(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricResource(Client, NetworkFabricData.DeserializeNetworkFabricData(e)), NetworkFabricClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabrics", "value", "nextLink", cancellationToken); - } - - /// - /// Displays Network Packet Brokers list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers - /// - /// - /// Operation Id - /// NetworkPacketBrokers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkPacketBrokersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkPacketBrokerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkPacketBrokerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkPacketBrokerResource(Client, NetworkPacketBrokerData.DeserializeNetworkPacketBrokerData(e)), NetworkPacketBrokerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkPacketBrokers", "value", "nextLink", cancellationToken); - } - - /// - /// Displays Network Packet Brokers list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers - /// - /// - /// Operation Id - /// NetworkPacketBrokers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkPacketBrokers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkPacketBrokerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkPacketBrokerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkPacketBrokerResource(Client, NetworkPacketBrokerData.DeserializeNetworkPacketBrokerData(e)), NetworkPacketBrokerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkPacketBrokers", "value", "nextLink", cancellationToken); - } - - /// - /// List all Network Rack resources in the given subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRacks - /// - /// - /// Operation Id - /// NetworkRacks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkRacksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkRackRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkRackRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkRackResource(Client, NetworkRackData.DeserializeNetworkRackData(e)), NetworkRackClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkRacks", "value", "nextLink", cancellationToken); - } - - /// - /// List all Network Rack resources in the given subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkRacks - /// - /// - /// Operation Id - /// NetworkRacks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkRacks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkRackRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkRackRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkRackResource(Client, NetworkRackData.DeserializeNetworkRackData(e)), NetworkRackClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkRacks", "value", "nextLink", cancellationToken); - } - - /// - /// List all the Network Tap Rule resources in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkTapRules - /// - /// - /// Operation Id - /// NetworkTapRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkTapRulesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkTapRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkTapRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkTapRuleResource(Client, NetworkTapRuleData.DeserializeNetworkTapRuleData(e)), NetworkTapRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkTapRules", "value", "nextLink", cancellationToken); - } - - /// - /// List all the Network Tap Rule resources in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkTapRules - /// - /// - /// Operation Id - /// NetworkTapRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkTapRules(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkTapRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkTapRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkTapRuleResource(Client, NetworkTapRuleData.DeserializeNetworkTapRuleData(e)), NetworkTapRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkTapRules", "value", "nextLink", cancellationToken); - } - - /// - /// Displays Network Taps list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkTaps - /// - /// - /// Operation Id - /// NetworkTaps_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkTapsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkTapRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkTapRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkTapResource(Client, NetworkTapData.DeserializeNetworkTapData(e)), NetworkTapClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkTaps", "value", "nextLink", cancellationToken); - } - - /// - /// Displays Network Taps list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkTaps - /// - /// - /// Operation Id - /// NetworkTaps_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkTaps(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkTapRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkTapRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkTapResource(Client, NetworkTapData.DeserializeNetworkTapData(e)), NetworkTapClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkTaps", "value", "nextLink", cancellationToken); - } - - /// - /// Implements RoutePolicies list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/routePolicies - /// - /// - /// Operation Id - /// RoutePolicies_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkFabricRoutePoliciesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricRoutePolicyRoutePoliciesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricRoutePolicyRoutePoliciesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricRoutePolicyResource(Client, NetworkFabricRoutePolicyData.DeserializeNetworkFabricRoutePolicyData(e)), NetworkFabricRoutePolicyRoutePoliciesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricRoutePolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Implements RoutePolicies list by subscription GET method. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/routePolicies - /// - /// - /// Operation Id - /// RoutePolicies_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkFabricRoutePolicies(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkFabricRoutePolicyRoutePoliciesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkFabricRoutePolicyRoutePoliciesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkFabricRoutePolicyResource(Client, NetworkFabricRoutePolicyData.DeserializeNetworkFabricRoutePolicyData(e)), NetworkFabricRoutePolicyRoutePoliciesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkFabricRoutePolicies", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceInterfaceResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceInterfaceResource.cs index 9975433c8153b..ced21a13a719c 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceInterfaceResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceInterfaceResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkDeviceInterfaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkDeviceName. + /// The networkInterfaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkDeviceName, string networkInterfaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}/networkInterfaces/{networkInterfaceName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceResource.cs index 8a83170714731..c081576a908e2 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkDeviceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkDeviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkDeviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkDevices/{networkDeviceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkDeviceInterfaceResources and their operations over a NetworkDeviceInterfaceResource. public virtual NetworkDeviceInterfaceCollection GetNetworkDeviceInterfaces() { - return GetCachedClient(Client => new NetworkDeviceInterfaceCollection(Client, Id)); + return GetCachedClient(client => new NetworkDeviceInterfaceCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual NetworkDeviceInterfaceCollection GetNetworkDeviceInterfaces() /// /// Name of the Network Interface. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkDeviceInterfaceAsync(string networkInterfaceName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetNetworkDe /// /// Name of the Network Interface. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkDeviceInterface(string networkInterfaceName, CancellationToken cancellationToken = default) { diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceSkuResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceSkuResource.cs index 6ee260faa062d..644ce7cac2d30 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceSkuResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceSkuResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkDeviceSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The networkDeviceSkuName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string networkDeviceSkuName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkDeviceSkus/{networkDeviceSkuName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricAccessControlListResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricAccessControlListResource.cs index b88b3fea44d54..2a3bf5884ac3c 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricAccessControlListResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricAccessControlListResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricAccessControlListResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accessControlListName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accessControlListName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/accessControlLists/{accessControlListName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricControllerResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricControllerResource.cs index 862251508ae0a..6bbb3fb26fc41 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricControllerResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricControllerResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricControllerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkFabricControllerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFabricControllerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/{networkFabricControllerName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricExternalNetworkResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricExternalNetworkResource.cs index 95f3f2f406d99..4141a934d8f21 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricExternalNetworkResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricExternalNetworkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricExternalNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The l3IsolationDomainName. + /// The externalNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string l3IsolationDomainName, string externalNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPCommunityResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPCommunityResource.cs index b453c816ce112..f6b2f5cbfe84f 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPCommunityResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPCommunityResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricIPCommunityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ipCommunityName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ipCommunityName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipCommunities/{ipCommunityName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPExtendedCommunityResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPExtendedCommunityResource.cs index cfa045c8d9500..b3442ac60efef 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPExtendedCommunityResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPExtendedCommunityResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricIPExtendedCommunityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ipExtendedCommunityName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ipExtendedCommunityName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipExtendedCommunities/{ipExtendedCommunityName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPPrefixResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPPrefixResource.cs index 1faa6a95446c2..0cad19e3128c4 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPPrefixResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricIPPrefixResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricIPPrefixResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ipPrefixName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ipPrefixName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/ipPrefixes/{ipPrefixName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternalNetworkResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternalNetworkResource.cs index 141c54b1022b0..e2ff3be08f1f1 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternalNetworkResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternalNetworkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricInternalNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The l3IsolationDomainName. + /// The internalNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string l3IsolationDomainName, string internalNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/internalNetworks/{internalNetworkName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayResource.cs index f9d03c329b8dc..8e2bda36295dc 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricInternetGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The internetGatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string internetGatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGateways/{internetGatewayName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayRuleResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayRuleResource.cs index 9706348fc9440..49dee8b4d0f2a 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayRuleResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricInternetGatewayRuleResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricInternetGatewayRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The internetGatewayRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string internetGatewayRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/internetGatewayRules/{internetGatewayRuleName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL2IsolationDomainResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL2IsolationDomainResource.cs index 0c702dec40e94..3e217f38f5f3d 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL2IsolationDomainResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL2IsolationDomainResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricL2IsolationDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The l2IsolationDomainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string l2IsolationDomainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/{l2IsolationDomainName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainResource.cs index 9cd47592c9514..52c7cefa83e28 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricL3IsolationDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The l3IsolationDomainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string l3IsolationDomainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkFabricInternalNetworkResources and their operations over a NetworkFabricInternalNetworkResource. public virtual NetworkFabricInternalNetworkCollection GetNetworkFabricInternalNetworks() { - return GetCachedClient(Client => new NetworkFabricInternalNetworkCollection(Client, Id)); + return GetCachedClient(client => new NetworkFabricInternalNetworkCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual NetworkFabricInternalNetworkCollection GetNetworkFabricInternalNe /// /// Name of the Internal Network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkFabricInternalNetworkAsync(string internalNetworkName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetNet /// /// Name of the Internal Network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkFabricInternalNetwork(string internalNetworkName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetNetworkFabricIn /// An object representing collection of NetworkFabricExternalNetworkResources and their operations over a NetworkFabricExternalNetworkResource. public virtual NetworkFabricExternalNetworkCollection GetNetworkFabricExternalNetworks() { - return GetCachedClient(Client => new NetworkFabricExternalNetworkCollection(Client, Id)); + return GetCachedClient(client => new NetworkFabricExternalNetworkCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual NetworkFabricExternalNetworkCollection GetNetworkFabricExternalNe /// /// Name of the External Network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkFabricExternalNetworkAsync(string externalNetworkName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetNet /// /// Name of the External Network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkFabricExternalNetwork(string externalNetworkName, CancellationToken cancellationToken = default) { diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricNeighborGroupResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricNeighborGroupResource.cs index 97336ef68192f..333d8fe05081a 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricNeighborGroupResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricNeighborGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricNeighborGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The neighborGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string neighborGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/neighborGroups/{neighborGroupName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricResource.cs index 032b8574ed3ab..fcdcc4d2da43c 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkFabricName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFabricName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkToNetworkInterconnectResources and their operations over a NetworkToNetworkInterconnectResource. public virtual NetworkToNetworkInterconnectCollection GetNetworkToNetworkInterconnects() { - return GetCachedClient(Client => new NetworkToNetworkInterconnectCollection(Client, Id)); + return GetCachedClient(client => new NetworkToNetworkInterconnectCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual NetworkToNetworkInterconnectCollection GetNetworkToNetworkInterco /// /// Name of the Network to Network Interconnect. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkToNetworkInterconnectAsync(string networkToNetworkInterconnectName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetNet /// /// Name of the Network to Network Interconnect. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkToNetworkInterconnect(string networkToNetworkInterconnectName, CancellationToken cancellationToken = default) { diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricRoutePolicyResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricRoutePolicyResource.cs index 30c97acb0cbd7..5b6ec400fb264 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricRoutePolicyResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricRoutePolicyResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricRoutePolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The routePolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string routePolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/routePolicies/{routePolicyName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricSkuResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricSkuResource.cs index 470c0453e9cfb..4e99ad35423b3 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricSkuResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricSkuResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkFabricSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The networkFabricSkuName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string networkFabricSkuName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ManagedNetworkFabric/networkFabricSkus/{networkFabricSkuName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkPacketBrokerResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkPacketBrokerResource.cs index 0b7e6877df8e6..aab63e274c50f 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkPacketBrokerResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkPacketBrokerResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkPacketBrokerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkPacketBrokerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkPacketBrokerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkPacketBrokers/{networkPacketBrokerName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkRackResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkRackResource.cs index ce58e20a7be31..deef71f4ae15f 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkRackResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkRackResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkRackResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkRackName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkRackName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkRacks/{networkRackName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapResource.cs index 0b8923e1c8e81..6369884ebf4b5 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkTapResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkTapName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkTapName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTaps/{networkTapName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapRuleResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapRuleResource.cs index 70641b3d23ded..ea6fdd994e562 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapRuleResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkTapRuleResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkTapRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkTapRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkTapRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkTapRules/{networkTapRuleName}"; diff --git a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkToNetworkInterconnectResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkToNetworkInterconnectResource.cs index 06e61ac081b69..91ab279785227 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkToNetworkInterconnectResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkToNetworkInterconnectResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ManagedNetworkFabric public partial class NetworkToNetworkInterconnectResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkFabricName. + /// The networkToNetworkInterconnectName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkFabricName, string networkToNetworkInterconnectName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/networkFabrics/{networkFabricName}/networkToNetworkInterconnects/{networkToNetworkInterconnectName}"; diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/api/Azure.ResourceManager.ManagedServiceIdentities.netstandard2.0.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/api/Azure.ResourceManager.ManagedServiceIdentities.netstandard2.0.cs index 7a457e1199deb..d435d10404ec1 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/api/Azure.ResourceManager.ManagedServiceIdentities.netstandard2.0.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/api/Azure.ResourceManager.ManagedServiceIdentities.netstandard2.0.cs @@ -55,7 +55,7 @@ public static partial class ManagedServiceIdentitiesExtensions } public partial class SystemAssignedIdentityData : Azure.ResourceManager.Models.TrackedResourceData { - public SystemAssignedIdentityData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SystemAssignedIdentityData(Azure.Core.AzureLocation location) { } public System.Guid? ClientId { get { throw null; } } public System.Uri ClientSecretUri { get { throw null; } } public System.Guid? PrincipalId { get { throw null; } } @@ -108,7 +108,7 @@ protected UserAssignedIdentityCollection() { } } public partial class UserAssignedIdentityData : Azure.ResourceManager.Models.TrackedResourceData { - public UserAssignedIdentityData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public UserAssignedIdentityData(Azure.Core.AzureLocation location) { } public System.Guid? ClientId { get { throw null; } } public System.Guid? PrincipalId { get { throw null; } } public System.Guid? TenantId { get { throw null; } } @@ -143,6 +143,35 @@ protected UserAssignedIdentityResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.ManagedServiceIdentities.Models.UserAssignedIdentityPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ManagedServiceIdentities.Mocking +{ + public partial class MockableManagedServiceIdentitiesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableManagedServiceIdentitiesArmClient() { } + public virtual Azure.ResourceManager.ManagedServiceIdentities.FederatedIdentityCredentialResource GetFederatedIdentityCredentialResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedServiceIdentities.SystemAssignedIdentityResource GetSystemAssignedIdentity(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.ManagedServiceIdentities.SystemAssignedIdentityResource GetSystemAssignedIdentityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedServiceIdentities.UserAssignedIdentityResource GetUserAssignedIdentityResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableManagedServiceIdentitiesArmResource : Azure.ResourceManager.ArmResource + { + protected MockableManagedServiceIdentitiesArmResource() { } + public virtual Azure.ResourceManager.ManagedServiceIdentities.SystemAssignedIdentityResource GetSystemAssignedIdentity() { throw null; } + } + public partial class MockableManagedServiceIdentitiesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableManagedServiceIdentitiesResourceGroupResource() { } + public virtual Azure.ResourceManager.ManagedServiceIdentities.UserAssignedIdentityCollection GetUserAssignedIdentities() { throw null; } + public virtual Azure.Response GetUserAssignedIdentity(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetUserAssignedIdentityAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableManagedServiceIdentitiesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableManagedServiceIdentitiesSubscriptionResource() { } + public virtual Azure.Pageable GetUserAssignedIdentities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUserAssignedIdentitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ManagedServiceIdentities.Models { public static partial class ArmManagedServiceIdentitiesModelFactory @@ -161,7 +190,7 @@ internal IdentityAssociatedResourceData() { } } public partial class UserAssignedIdentityPatch : Azure.ResourceManager.Models.TrackedResourceData { - public UserAssignedIdentityPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public UserAssignedIdentityPatch(Azure.Core.AzureLocation location) { } public System.Guid? ClientId { get { throw null; } } public System.Guid? PrincipalId { get { throw null; } } public System.Guid? TenantId { get { throw null; } } diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 9ba7f0fbb0940..0000000000000 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedServiceIdentities -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets an object representing a SystemAssignedIdentityResource along with the instance operations that can be performed on it in the ArmResource. - /// Returns a object. - public virtual SystemAssignedIdentityResource GetSystemAssignedIdentity() - { - return new SystemAssignedIdentityResource(Client, Id.AppendProviderResource("Microsoft.ManagedIdentity", "identities", "default")); - } - } -} diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ManagedServiceIdentitiesExtensions.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ManagedServiceIdentitiesExtensions.cs index 9495b5e68ddb8..271abbcd2b05b 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ManagedServiceIdentitiesExtensions.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ManagedServiceIdentitiesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ManagedServiceIdentities.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ManagedServiceIdentities @@ -18,133 +19,115 @@ namespace Azure.ResourceManager.ManagedServiceIdentities /// A class to add extension methods to Azure.ResourceManager.ManagedServiceIdentities. public static partial class ManagedServiceIdentitiesExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableManagedServiceIdentitiesArmClient GetMockableManagedServiceIdentitiesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableManagedServiceIdentitiesArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableManagedServiceIdentitiesArmResource GetMockableManagedServiceIdentitiesArmResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableManagedServiceIdentitiesArmResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableManagedServiceIdentitiesResourceGroupResource GetMockableManagedServiceIdentitiesResourceGroupResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableManagedServiceIdentitiesResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableManagedServiceIdentitiesSubscriptionResource GetMockableManagedServiceIdentitiesSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableManagedServiceIdentitiesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + /// + /// Gets an object representing a SystemAssignedIdentityResource along with the instance operations that can be performed on it in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Returns a object. + public static SystemAssignedIdentityResource GetSystemAssignedIdentity(this ArmClient client, ResourceIdentifier scope) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return GetMockableManagedServiceIdentitiesArmClient(client).GetSystemAssignedIdentity(scope); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region SystemAssignedIdentityResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SystemAssignedIdentityResource GetSystemAssignedIdentityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SystemAssignedIdentityResource.ValidateResourceId(id); - return new SystemAssignedIdentityResource(client, id); - } - ); + return GetMockableManagedServiceIdentitiesArmClient(client).GetSystemAssignedIdentityResource(id); } - #endregion - #region UserAssignedIdentityResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static UserAssignedIdentityResource GetUserAssignedIdentityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - UserAssignedIdentityResource.ValidateResourceId(id); - return new UserAssignedIdentityResource(client, id); - } - ); + return GetMockableManagedServiceIdentitiesArmClient(client).GetUserAssignedIdentityResource(id); } - #endregion - #region FederatedIdentityCredentialResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FederatedIdentityCredentialResource GetFederatedIdentityCredentialResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FederatedIdentityCredentialResource.ValidateResourceId(id); - return new FederatedIdentityCredentialResource(client, id); - } - ); + return GetMockableManagedServiceIdentitiesArmClient(client).GetFederatedIdentityCredentialResource(id); } - #endregion - /// Gets an object representing a SystemAssignedIdentityResource along with the instance operations that can be performed on it in the ArmResource. + /// + /// Gets an object representing a SystemAssignedIdentityResource along with the instance operations that can be performed on it in the ArmResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Returns a object. public static SystemAssignedIdentityResource GetSystemAssignedIdentity(this ArmResource armResource) { - return GetArmResourceExtensionClient(armResource).GetSystemAssignedIdentity(); + return GetMockableManagedServiceIdentitiesArmResource(armResource).GetSystemAssignedIdentity(); } - /// Gets an object representing a SystemAssignedIdentityResource along with the instance operations that can be performed on it in the ArmResource. - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// Returns a object. - public static SystemAssignedIdentityResource GetSystemAssignedIdentity(this ArmClient client, ResourceIdentifier scope) - { - return GetArmResourceExtensionClient(client, scope).GetSystemAssignedIdentity(); - } - - /// Gets a collection of UserAssignedIdentityResources in the ResourceGroupResource. + /// + /// Gets a collection of UserAssignedIdentityResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of UserAssignedIdentityResources and their operations over a UserAssignedIdentityResource. public static UserAssignedIdentityCollection GetUserAssignedIdentities(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetUserAssignedIdentities(); + return GetMockableManagedServiceIdentitiesResourceGroupResource(resourceGroupResource).GetUserAssignedIdentities(); } /// @@ -159,16 +142,20 @@ public static UserAssignedIdentityCollection GetUserAssignedIdentities(this Reso /// UserAssignedIdentities_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the identity resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetUserAssignedIdentityAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetUserAssignedIdentities().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedServiceIdentitiesResourceGroupResource(resourceGroupResource).GetUserAssignedIdentityAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -183,16 +170,20 @@ public static async Task> GetUserAssigned /// UserAssignedIdentities_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the identity resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetUserAssignedIdentity(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetUserAssignedIdentities().Get(resourceName, cancellationToken); + return GetMockableManagedServiceIdentitiesResourceGroupResource(resourceGroupResource).GetUserAssignedIdentity(resourceName, cancellationToken); } /// @@ -207,13 +198,17 @@ public static Response GetUserAssignedIdentity(thi /// UserAssignedIdentities_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetUserAssignedIdentitiesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUserAssignedIdentitiesAsync(cancellationToken); + return GetMockableManagedServiceIdentitiesSubscriptionResource(subscriptionResource).GetUserAssignedIdentitiesAsync(cancellationToken); } /// @@ -228,13 +223,17 @@ public static AsyncPageable GetUserAssignedIdentit /// UserAssignedIdentities_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetUserAssignedIdentities(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUserAssignedIdentities(cancellationToken); + return GetMockableManagedServiceIdentitiesSubscriptionResource(subscriptionResource).GetUserAssignedIdentities(cancellationToken); } } } diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesArmClient.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesArmClient.cs new file mode 100644 index 0000000000000..cd80b0878b835 --- /dev/null +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesArmClient.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ManagedServiceIdentities; + +namespace Azure.ResourceManager.ManagedServiceIdentities.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableManagedServiceIdentitiesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedServiceIdentitiesArmClient() + { + } + + /// 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 MockableManagedServiceIdentitiesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableManagedServiceIdentitiesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets an object representing a SystemAssignedIdentityResource along with the instance operations that can be performed on it in the ArmClient. + /// The scope that the resource will apply against. + /// Returns a object. + public virtual SystemAssignedIdentityResource GetSystemAssignedIdentity(ResourceIdentifier scope) + { + return new SystemAssignedIdentityResource(Client, scope.AppendProviderResource("Microsoft.ManagedIdentity", "identities", "default")); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SystemAssignedIdentityResource GetSystemAssignedIdentityResource(ResourceIdentifier id) + { + SystemAssignedIdentityResource.ValidateResourceId(id); + return new SystemAssignedIdentityResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual UserAssignedIdentityResource GetUserAssignedIdentityResource(ResourceIdentifier id) + { + UserAssignedIdentityResource.ValidateResourceId(id); + return new UserAssignedIdentityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FederatedIdentityCredentialResource GetFederatedIdentityCredentialResource(ResourceIdentifier id) + { + FederatedIdentityCredentialResource.ValidateResourceId(id); + return new FederatedIdentityCredentialResource(Client, id); + } + } +} diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesArmResource.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesArmResource.cs new file mode 100644 index 0000000000000..87f774be52981 --- /dev/null +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesArmResource.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ManagedServiceIdentities; + +namespace Azure.ResourceManager.ManagedServiceIdentities.Mocking +{ + /// A class to add extension methods to ArmResource. + public partial class MockableManagedServiceIdentitiesArmResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedServiceIdentitiesArmResource() + { + } + + /// 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 MockableManagedServiceIdentitiesArmResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets an object representing a SystemAssignedIdentityResource along with the instance operations that can be performed on it in the ArmResource. + /// Returns a object. + public virtual SystemAssignedIdentityResource GetSystemAssignedIdentity() + { + return new SystemAssignedIdentityResource(Client, Id.AppendProviderResource("Microsoft.ManagedIdentity", "identities", "default")); + } + } +} diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesResourceGroupResource.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesResourceGroupResource.cs new file mode 100644 index 0000000000000..c46d196baf519 --- /dev/null +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ManagedServiceIdentities; + +namespace Azure.ResourceManager.ManagedServiceIdentities.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableManagedServiceIdentitiesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedServiceIdentitiesResourceGroupResource() + { + } + + /// 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 MockableManagedServiceIdentitiesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of UserAssignedIdentityResources in the ResourceGroupResource. + /// An object representing collection of UserAssignedIdentityResources and their operations over a UserAssignedIdentityResource. + public virtual UserAssignedIdentityCollection GetUserAssignedIdentities() + { + return GetCachedClient(client => new UserAssignedIdentityCollection(client, Id)); + } + + /// + /// Gets the identity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName} + /// + /// + /// Operation Id + /// UserAssignedIdentities_Get + /// + /// + /// + /// The name of the identity resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetUserAssignedIdentityAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetUserAssignedIdentities().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the identity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName} + /// + /// + /// Operation Id + /// UserAssignedIdentities_Get + /// + /// + /// + /// The name of the identity resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetUserAssignedIdentity(string resourceName, CancellationToken cancellationToken = default) + { + return GetUserAssignedIdentities().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesSubscriptionResource.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesSubscriptionResource.cs new file mode 100644 index 0000000000000..0f657ae1c970b --- /dev/null +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/MockableManagedServiceIdentitiesSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ManagedServiceIdentities; + +namespace Azure.ResourceManager.ManagedServiceIdentities.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableManagedServiceIdentitiesSubscriptionResource : ArmResource + { + private ClientDiagnostics _userAssignedIdentityClientDiagnostics; + private UserAssignedIdentitiesRestOperations _userAssignedIdentityRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableManagedServiceIdentitiesSubscriptionResource() + { + } + + /// 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 MockableManagedServiceIdentitiesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics UserAssignedIdentityClientDiagnostics => _userAssignedIdentityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedServiceIdentities", UserAssignedIdentityResource.ResourceType.Namespace, Diagnostics); + private UserAssignedIdentitiesRestOperations UserAssignedIdentityRestClient => _userAssignedIdentityRestClient ??= new UserAssignedIdentitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(UserAssignedIdentityResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all the userAssignedIdentities available under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities + /// + /// + /// Operation Id + /// UserAssignedIdentities_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUserAssignedIdentitiesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UserAssignedIdentityRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UserAssignedIdentityRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new UserAssignedIdentityResource(Client, UserAssignedIdentityData.DeserializeUserAssignedIdentityData(e)), UserAssignedIdentityClientDiagnostics, Pipeline, "MockableManagedServiceIdentitiesSubscriptionResource.GetUserAssignedIdentities", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the userAssignedIdentities available under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities + /// + /// + /// Operation Id + /// UserAssignedIdentities_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUserAssignedIdentities(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UserAssignedIdentityRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UserAssignedIdentityRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new UserAssignedIdentityResource(Client, UserAssignedIdentityData.DeserializeUserAssignedIdentityData(e)), UserAssignedIdentityClientDiagnostics, Pipeline, "MockableManagedServiceIdentitiesSubscriptionResource.GetUserAssignedIdentities", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 76c9977e20fa9..0000000000000 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedServiceIdentities -{ - /// 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 UserAssignedIdentityResources in the ResourceGroupResource. - /// An object representing collection of UserAssignedIdentityResources and their operations over a UserAssignedIdentityResource. - public virtual UserAssignedIdentityCollection GetUserAssignedIdentities() - { - return GetCachedClient(Client => new UserAssignedIdentityCollection(Client, Id)); - } - } -} diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b42f492470340..0000000000000 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedServiceIdentities -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _userAssignedIdentityClientDiagnostics; - private UserAssignedIdentitiesRestOperations _userAssignedIdentityRestClient; - - /// 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 UserAssignedIdentityClientDiagnostics => _userAssignedIdentityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagedServiceIdentities", UserAssignedIdentityResource.ResourceType.Namespace, Diagnostics); - private UserAssignedIdentitiesRestOperations UserAssignedIdentityRestClient => _userAssignedIdentityRestClient ??= new UserAssignedIdentitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(UserAssignedIdentityResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all the userAssignedIdentities available under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities - /// - /// - /// Operation Id - /// UserAssignedIdentities_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUserAssignedIdentitiesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UserAssignedIdentityRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UserAssignedIdentityRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new UserAssignedIdentityResource(Client, UserAssignedIdentityData.DeserializeUserAssignedIdentityData(e)), UserAssignedIdentityClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUserAssignedIdentities", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the userAssignedIdentities available under the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities - /// - /// - /// Operation Id - /// UserAssignedIdentities_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUserAssignedIdentities(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UserAssignedIdentityRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UserAssignedIdentityRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new UserAssignedIdentityResource(Client, UserAssignedIdentityData.DeserializeUserAssignedIdentityData(e)), UserAssignedIdentityClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUserAssignedIdentities", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/FederatedIdentityCredentialResource.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/FederatedIdentityCredentialResource.cs index 1152edd87f54c..cd961cf7e3b98 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/FederatedIdentityCredentialResource.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/FederatedIdentityCredentialResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ManagedServiceIdentities public partial class FederatedIdentityCredentialResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The federatedIdentityCredentialResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string federatedIdentityCredentialResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}/federatedIdentityCredentials/{federatedIdentityCredentialResourceName}"; diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/SystemAssignedIdentityResource.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/SystemAssignedIdentityResource.cs index fa896cc5cdd45..0334d72181aaa 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/SystemAssignedIdentityResource.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/SystemAssignedIdentityResource.cs @@ -25,6 +25,7 @@ namespace Azure.ResourceManager.ManagedServiceIdentities public partial class SystemAssignedIdentityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. public static ResourceIdentifier CreateResourceIdentifier(string scope) { var resourceId = $"{scope}/providers/Microsoft.ManagedIdentity/identities/default"; diff --git a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityResource.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityResource.cs index f155d5e64861d..b15656a4eedc3 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityResource.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ManagedServiceIdentities public partial class UserAssignedIdentityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FederatedIdentityCredentialResources and their operations over a FederatedIdentityCredentialResource. public virtual FederatedIdentityCredentialCollection GetFederatedIdentityCredentials() { - return GetCachedClient(Client => new FederatedIdentityCredentialCollection(Client, Id)); + return GetCachedClient(client => new FederatedIdentityCredentialCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual FederatedIdentityCredentialCollection GetFederatedIdentityCredent /// /// The name of the federated identity credential resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFederatedIdentityCredentialAsync(string federatedIdentityCredentialResourceName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetFede /// /// The name of the federated identity credential resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFederatedIdentityCredential(string federatedIdentityCredentialResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/Azure.ResourceManager.ManagedServices.sln b/sdk/managedservices/Azure.ResourceManager.ManagedServices/Azure.ResourceManager.ManagedServices.sln index 5fecd1fff9d6c..da2670fe7b2ed 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/Azure.ResourceManager.ManagedServices.sln +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/Azure.ResourceManager.ManagedServices.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{13278462-D9EB-40AE-BE8E-62992D0034E0}") = "Azure.ResourceManager.ManagedServices", "src\Azure.ResourceManager.ManagedServices.csproj", "{DD1D1E1D-DB11-413D-8C04-C6F5AD00C739}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagedServices", "src\Azure.ResourceManager.ManagedServices.csproj", "{DD1D1E1D-DB11-413D-8C04-C6F5AD00C739}" EndProject -Project("{13278462-D9EB-40AE-BE8E-62992D0034E0}") = "Azure.ResourceManager.ManagedServices.Tests", "tests\Azure.ResourceManager.ManagedServices.Tests.csproj", "{2F130B11-14FB-425A-AB79-27E6321C1844}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagedServices.Tests", "tests\Azure.ResourceManager.ManagedServices.Tests.csproj", "{2F130B11-14FB-425A-AB79-27E6321C1844}" EndProject -Project("{13278462-D9EB-40AE-BE8E-62992D0034E0}") = "Azure.ResourceManager.ManagedServices.Samples", "samples\Azure.ResourceManager.ManagedServices.Samples.csproj", "{957CB958-2E9A-4131-B0F9-A812786CA32F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagedServices.Samples", "samples\Azure.ResourceManager.ManagedServices.Samples.csproj", "{957CB958-2E9A-4131-B0F9-A812786CA32F}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B90CBAD1-51C8-4BB9-9990-FCE90D839295} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {2F130B11-14FB-425A-AB79-27E6321C1844}.Release|x64.Build.0 = Release|Any CPU {2F130B11-14FB-425A-AB79-27E6321C1844}.Release|x86.ActiveCfg = Release|Any CPU {2F130B11-14FB-425A-AB79-27E6321C1844}.Release|x86.Build.0 = Release|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Debug|x64.ActiveCfg = Debug|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Debug|x64.Build.0 = Debug|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Debug|x86.ActiveCfg = Debug|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Debug|x86.Build.0 = Debug|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Release|Any CPU.Build.0 = Release|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Release|x64.ActiveCfg = Release|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Release|x64.Build.0 = Release|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Release|x86.ActiveCfg = Release|Any CPU + {957CB958-2E9A-4131-B0F9-A812786CA32F}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B90CBAD1-51C8-4BB9-9990-FCE90D839295} EndGlobalSection EndGlobal diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/api/Azure.ResourceManager.ManagedServices.netstandard2.0.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/api/Azure.ResourceManager.ManagedServices.netstandard2.0.cs index 011d988ee5536..bb39f862c0e48 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/api/Azure.ResourceManager.ManagedServices.netstandard2.0.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/api/Azure.ResourceManager.ManagedServices.netstandard2.0.cs @@ -120,6 +120,25 @@ protected ManagedServicesRegistrationResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ManagedServices.ManagedServicesRegistrationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ManagedServices.Mocking +{ + public partial class MockableManagedServicesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableManagedServicesArmClient() { } + public virtual Azure.Response GetManagedServicesMarketplaceRegistration(Azure.Core.ResourceIdentifier scope, string marketplaceIdentifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedServicesMarketplaceRegistrationAsync(Azure.Core.ResourceIdentifier scope, string marketplaceIdentifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedServices.ManagedServicesMarketplaceRegistrationResource GetManagedServicesMarketplaceRegistrationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedServices.ManagedServicesMarketplaceRegistrationCollection GetManagedServicesMarketplaceRegistrations(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetManagedServicesRegistration(Azure.Core.ResourceIdentifier scope, string registrationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetManagedServicesRegistrationAssignment(Azure.Core.ResourceIdentifier scope, string registrationAssignmentId, bool? expandRegistrationDefinition = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedServicesRegistrationAssignmentAsync(Azure.Core.ResourceIdentifier scope, string registrationAssignmentId, bool? expandRegistrationDefinition = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedServices.ManagedServicesRegistrationAssignmentResource GetManagedServicesRegistrationAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedServices.ManagedServicesRegistrationAssignmentCollection GetManagedServicesRegistrationAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedServicesRegistrationAsync(Azure.Core.ResourceIdentifier scope, string registrationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagedServices.ManagedServicesRegistrationResource GetManagedServicesRegistrationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ManagedServices.ManagedServicesRegistrationCollection GetManagedServicesRegistrations(Azure.Core.ResourceIdentifier scope) { throw null; } + } +} namespace Azure.ResourceManager.ManagedServices.Models { public static partial class ArmManagedServicesModelFactory diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index c908067ab8235..0000000000000 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ManagedServices -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ManagedServicesRegistrationResources in the ArmResource. - /// An object representing collection of ManagedServicesRegistrationResources and their operations over a ManagedServicesRegistrationResource. - public virtual ManagedServicesRegistrationCollection GetManagedServicesRegistrations() - { - return GetCachedClient(Client => new ManagedServicesRegistrationCollection(Client, Id)); - } - - /// Gets a collection of ManagedServicesRegistrationAssignmentResources in the ArmResource. - /// An object representing collection of ManagedServicesRegistrationAssignmentResources and their operations over a ManagedServicesRegistrationAssignmentResource. - public virtual ManagedServicesRegistrationAssignmentCollection GetManagedServicesRegistrationAssignments() - { - return GetCachedClient(Client => new ManagedServicesRegistrationAssignmentCollection(Client, Id)); - } - - /// Gets a collection of ManagedServicesMarketplaceRegistrationResources in the ArmResource. - /// An object representing collection of ManagedServicesMarketplaceRegistrationResources and their operations over a ManagedServicesMarketplaceRegistrationResource. - public virtual ManagedServicesMarketplaceRegistrationCollection GetManagedServicesMarketplaceRegistrations() - { - return GetCachedClient(Client => new ManagedServicesMarketplaceRegistrationCollection(Client, Id)); - } - } -} diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/ManagedServicesExtensions.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/ManagedServicesExtensions.cs index fdfce24214493..74a5e6bc36c4d 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/ManagedServicesExtensions.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/ManagedServicesExtensions.cs @@ -11,91 +11,31 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ManagedServices.Mocking; namespace Azure.ResourceManager.ManagedServices { /// A class to add extension methods to Azure.ResourceManager.ManagedServices. public static partial class ManagedServicesExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableManagedServicesArmClient GetMockableManagedServicesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableManagedServicesArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); - } - #region ManagedServicesRegistrationResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedServicesRegistrationResource GetManagedServicesRegistrationResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagedServicesRegistrationResource.ValidateResourceId(id); - return new ManagedServicesRegistrationResource(client, id); - } - ); - } - #endregion - - #region ManagedServicesRegistrationAssignmentResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedServicesRegistrationAssignmentResource GetManagedServicesRegistrationAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagedServicesRegistrationAssignmentResource.ValidateResourceId(id); - return new ManagedServicesRegistrationAssignmentResource(client, id); - } - ); - } - #endregion - - #region ManagedServicesMarketplaceRegistrationResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of ManagedServicesRegistrationResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ManagedServicesMarketplaceRegistrationResource GetManagedServicesMarketplaceRegistrationResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ManagedServicesMarketplaceRegistrationResource.ValidateResourceId(id); - return new ManagedServicesMarketplaceRegistrationResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of ManagedServicesRegistrationResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of ManagedServicesRegistrationResources and their operations over a ManagedServicesRegistrationResource. public static ManagedServicesRegistrationCollection GetManagedServicesRegistrations(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetManagedServicesRegistrations(); + return GetMockableManagedServicesArmClient(client).GetManagedServicesRegistrations(scope); } /// @@ -110,17 +50,21 @@ public static ManagedServicesRegistrationCollection GetManagedServicesRegistrati /// RegistrationDefinitions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The GUID of the registration definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedServicesRegistrationAsync(this ArmClient client, ResourceIdentifier scope, string registrationId, CancellationToken cancellationToken = default) { - return await client.GetManagedServicesRegistrations(scope).GetAsync(registrationId, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedServicesArmClient(client).GetManagedServicesRegistrationAsync(scope, registrationId, cancellationToken).ConfigureAwait(false); } /// @@ -135,26 +79,36 @@ public static async Task> GetManag /// RegistrationDefinitions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The GUID of the registration definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedServicesRegistration(this ArmClient client, ResourceIdentifier scope, string registrationId, CancellationToken cancellationToken = default) { - return client.GetManagedServicesRegistrations(scope).Get(registrationId, cancellationToken); + return GetMockableManagedServicesArmClient(client).GetManagedServicesRegistration(scope, registrationId, cancellationToken); } - /// Gets a collection of ManagedServicesRegistrationAssignmentResources in the ArmResource. + /// + /// Gets a collection of ManagedServicesRegistrationAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of ManagedServicesRegistrationAssignmentResources and their operations over a ManagedServicesRegistrationAssignmentResource. public static ManagedServicesRegistrationAssignmentCollection GetManagedServicesRegistrationAssignments(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetManagedServicesRegistrationAssignments(); + return GetMockableManagedServicesArmClient(client).GetManagedServicesRegistrationAssignments(scope); } /// @@ -169,18 +123,22 @@ public static ManagedServicesRegistrationAssignmentCollection GetManagedServices /// RegistrationAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The GUID of the registration assignment. /// The flag indicating whether to return the registration definition details along with the registration assignment details. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedServicesRegistrationAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string registrationAssignmentId, bool? expandRegistrationDefinition = null, CancellationToken cancellationToken = default) { - return await client.GetManagedServicesRegistrationAssignments(scope).GetAsync(registrationAssignmentId, expandRegistrationDefinition, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedServicesArmClient(client).GetManagedServicesRegistrationAssignmentAsync(scope, registrationAssignmentId, expandRegistrationDefinition, cancellationToken).ConfigureAwait(false); } /// @@ -195,27 +153,37 @@ public static async Task /// RegistrationAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The GUID of the registration assignment. /// The flag indicating whether to return the registration definition details along with the registration assignment details. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedServicesRegistrationAssignment(this ArmClient client, ResourceIdentifier scope, string registrationAssignmentId, bool? expandRegistrationDefinition = null, CancellationToken cancellationToken = default) { - return client.GetManagedServicesRegistrationAssignments(scope).Get(registrationAssignmentId, expandRegistrationDefinition, cancellationToken); + return GetMockableManagedServicesArmClient(client).GetManagedServicesRegistrationAssignment(scope, registrationAssignmentId, expandRegistrationDefinition, cancellationToken); } - /// Gets a collection of ManagedServicesMarketplaceRegistrationResources in the ArmResource. + /// + /// Gets a collection of ManagedServicesMarketplaceRegistrationResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of ManagedServicesMarketplaceRegistrationResources and their operations over a ManagedServicesMarketplaceRegistrationResource. public static ManagedServicesMarketplaceRegistrationCollection GetManagedServicesMarketplaceRegistrations(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetManagedServicesMarketplaceRegistrations(); + return GetMockableManagedServicesArmClient(client).GetManagedServicesMarketplaceRegistrations(scope); } /// @@ -230,17 +198,21 @@ public static ManagedServicesMarketplaceRegistrationCollection GetManagedService /// MarketplaceRegistrationDefinitions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The Azure Marketplace identifier. Expected formats: {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or {publisher}.{product[-preview]} or {publisher}). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedServicesMarketplaceRegistrationAsync(this ArmClient client, ResourceIdentifier scope, string marketplaceIdentifier, CancellationToken cancellationToken = default) { - return await client.GetManagedServicesMarketplaceRegistrations(scope).GetAsync(marketplaceIdentifier, cancellationToken).ConfigureAwait(false); + return await GetMockableManagedServicesArmClient(client).GetManagedServicesMarketplaceRegistrationAsync(scope, marketplaceIdentifier, cancellationToken).ConfigureAwait(false); } /// @@ -255,17 +227,69 @@ public static async TaskMarketplaceRegistrationDefinitions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The Azure Marketplace identifier. Expected formats: {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or {publisher}.{product[-preview]} or {publisher}). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedServicesMarketplaceRegistration(this ArmClient client, ResourceIdentifier scope, string marketplaceIdentifier, CancellationToken cancellationToken = default) { - return client.GetManagedServicesMarketplaceRegistrations(scope).Get(marketplaceIdentifier, cancellationToken); + return GetMockableManagedServicesArmClient(client).GetManagedServicesMarketplaceRegistration(scope, marketplaceIdentifier, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedServicesRegistrationResource GetManagedServicesRegistrationResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableManagedServicesArmClient(client).GetManagedServicesRegistrationResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedServicesRegistrationAssignmentResource GetManagedServicesRegistrationAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableManagedServicesArmClient(client).GetManagedServicesRegistrationAssignmentResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedServicesMarketplaceRegistrationResource GetManagedServicesMarketplaceRegistrationResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableManagedServicesArmClient(client).GetManagedServicesMarketplaceRegistrationResource(id); } } } diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/MockableManagedServicesArmClient.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/MockableManagedServicesArmClient.cs new file mode 100644 index 0000000000000..16236b2995f98 --- /dev/null +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/MockableManagedServicesArmClient.cs @@ -0,0 +1,249 @@ +// 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.ManagedServices; + +namespace Azure.ResourceManager.ManagedServices.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableManagedServicesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedServicesArmClient() + { + } + + /// 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 MockableManagedServicesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableManagedServicesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ManagedServicesRegistrationResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of ManagedServicesRegistrationResources and their operations over a ManagedServicesRegistrationResource. + public virtual ManagedServicesRegistrationCollection GetManagedServicesRegistrations(ResourceIdentifier scope) + { + return new ManagedServicesRegistrationCollection(Client, scope); + } + + /// + /// Gets the registration definition details. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId} + /// + /// + /// Operation Id + /// RegistrationDefinitions_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The GUID of the registration definition. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedServicesRegistrationAsync(ResourceIdentifier scope, string registrationId, CancellationToken cancellationToken = default) + { + return await GetManagedServicesRegistrations(scope).GetAsync(registrationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the registration definition details. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId} + /// + /// + /// Operation Id + /// RegistrationDefinitions_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The GUID of the registration definition. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedServicesRegistration(ResourceIdentifier scope, string registrationId, CancellationToken cancellationToken = default) + { + return GetManagedServicesRegistrations(scope).Get(registrationId, cancellationToken); + } + + /// Gets a collection of ManagedServicesRegistrationAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of ManagedServicesRegistrationAssignmentResources and their operations over a ManagedServicesRegistrationAssignmentResource. + public virtual ManagedServicesRegistrationAssignmentCollection GetManagedServicesRegistrationAssignments(ResourceIdentifier scope) + { + return new ManagedServicesRegistrationAssignmentCollection(Client, scope); + } + + /// + /// Gets the details of the specified registration assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId} + /// + /// + /// Operation Id + /// RegistrationAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The GUID of the registration assignment. + /// The flag indicating whether to return the registration definition details along with the registration assignment details. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedServicesRegistrationAssignmentAsync(ResourceIdentifier scope, string registrationAssignmentId, bool? expandRegistrationDefinition = null, CancellationToken cancellationToken = default) + { + return await GetManagedServicesRegistrationAssignments(scope).GetAsync(registrationAssignmentId, expandRegistrationDefinition, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the specified registration assignment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId} + /// + /// + /// Operation Id + /// RegistrationAssignments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The GUID of the registration assignment. + /// The flag indicating whether to return the registration definition details along with the registration assignment details. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedServicesRegistrationAssignment(ResourceIdentifier scope, string registrationAssignmentId, bool? expandRegistrationDefinition = null, CancellationToken cancellationToken = default) + { + return GetManagedServicesRegistrationAssignments(scope).Get(registrationAssignmentId, expandRegistrationDefinition, cancellationToken); + } + + /// Gets a collection of ManagedServicesMarketplaceRegistrationResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of ManagedServicesMarketplaceRegistrationResources and their operations over a ManagedServicesMarketplaceRegistrationResource. + public virtual ManagedServicesMarketplaceRegistrationCollection GetManagedServicesMarketplaceRegistrations(ResourceIdentifier scope) + { + return new ManagedServicesMarketplaceRegistrationCollection(Client, scope); + } + + /// + /// Get the marketplace registration definition for the marketplace identifier. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier} + /// + /// + /// Operation Id + /// MarketplaceRegistrationDefinitions_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The Azure Marketplace identifier. Expected formats: {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or {publisher}.{product[-preview]} or {publisher}). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedServicesMarketplaceRegistrationAsync(ResourceIdentifier scope, string marketplaceIdentifier, CancellationToken cancellationToken = default) + { + return await GetManagedServicesMarketplaceRegistrations(scope).GetAsync(marketplaceIdentifier, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the marketplace registration definition for the marketplace identifier. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier} + /// + /// + /// Operation Id + /// MarketplaceRegistrationDefinitions_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The Azure Marketplace identifier. Expected formats: {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or {publisher}.{product[-preview]} or {publisher}). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedServicesMarketplaceRegistration(ResourceIdentifier scope, string marketplaceIdentifier, CancellationToken cancellationToken = default) + { + return GetManagedServicesMarketplaceRegistrations(scope).Get(marketplaceIdentifier, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedServicesRegistrationResource GetManagedServicesRegistrationResource(ResourceIdentifier id) + { + ManagedServicesRegistrationResource.ValidateResourceId(id); + return new ManagedServicesRegistrationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedServicesRegistrationAssignmentResource GetManagedServicesRegistrationAssignmentResource(ResourceIdentifier id) + { + ManagedServicesRegistrationAssignmentResource.ValidateResourceId(id); + return new ManagedServicesRegistrationAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedServicesMarketplaceRegistrationResource GetManagedServicesMarketplaceRegistrationResource(ResourceIdentifier id) + { + ManagedServicesMarketplaceRegistrationResource.ValidateResourceId(id); + return new ManagedServicesMarketplaceRegistrationResource(Client, id); + } + } +} diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesMarketplaceRegistrationResource.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesMarketplaceRegistrationResource.cs index ed1e9eb3a9fc3..31fbb9a8ae4d6 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesMarketplaceRegistrationResource.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesMarketplaceRegistrationResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.ManagedServices public partial class ManagedServicesMarketplaceRegistrationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The marketplaceIdentifier. public static ResourceIdentifier CreateResourceIdentifier(string scope, string marketplaceIdentifier) { var resourceId = $"{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier}"; diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationAssignmentResource.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationAssignmentResource.cs index 09f735a7c366d..69f15f15aaecb 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationAssignmentResource.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationAssignmentResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.ManagedServices public partial class ManagedServicesRegistrationAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The registrationAssignmentId. public static ResourceIdentifier CreateResourceIdentifier(string scope, string registrationAssignmentId) { var resourceId = $"{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}"; diff --git a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationResource.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationResource.cs index bc5a982cfea26..96f9c7643a052 100644 --- a/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationResource.cs +++ b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/ManagedServicesRegistrationResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.ManagedServices public partial class ManagedServicesRegistrationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The registrationId. public static ResourceIdentifier CreateResourceIdentifier(string scope, string registrationId) { var resourceId = $"{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationId}"; diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/Azure.ResourceManager.ManagementPartner.sln b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/Azure.ResourceManager.ManagementPartner.sln index 9a51f6c60c7f8..0e93bf03c7763 100644 --- a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/Azure.ResourceManager.ManagementPartner.sln +++ b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/Azure.ResourceManager.ManagementPartner.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{721D9016-E687-4C4C-8A40-A0FA37748D16}") = "Azure.ResourceManager.ManagementPartner", "src\Azure.ResourceManager.ManagementPartner.csproj", "{C28BE2B9-1C09-4B46-BEF8-FEA44DC5CAFB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagementPartner", "src\Azure.ResourceManager.ManagementPartner.csproj", "{C28BE2B9-1C09-4B46-BEF8-FEA44DC5CAFB}" EndProject -Project("{721D9016-E687-4C4C-8A40-A0FA37748D16}") = "Azure.ResourceManager.ManagementPartner.Tests", "tests\Azure.ResourceManager.ManagementPartner.Tests.csproj", "{83EC9548-E7F0-4322-B8FC-EF2C504371EC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagementPartner.Tests", "tests\Azure.ResourceManager.ManagementPartner.Tests.csproj", "{83EC9548-E7F0-4322-B8FC-EF2C504371EC}" EndProject -Project("{721D9016-E687-4C4C-8A40-A0FA37748D16}") = "Azure.ResourceManager.ManagementPartner.Samples", "samples\Azure.ResourceManager.ManagementPartner.Samples.csproj", "{F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagementPartner.Samples", "samples\Azure.ResourceManager.ManagementPartner.Samples.csproj", "{F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {E9E95139-0C9A-4CF1-8B39-640F366DCB0C} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {83EC9548-E7F0-4322-B8FC-EF2C504371EC}.Release|x64.Build.0 = Release|Any CPU {83EC9548-E7F0-4322-B8FC-EF2C504371EC}.Release|x86.ActiveCfg = Release|Any CPU {83EC9548-E7F0-4322-B8FC-EF2C504371EC}.Release|x86.Build.0 = Release|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Debug|x64.ActiveCfg = Debug|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Debug|x64.Build.0 = Debug|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Debug|x86.ActiveCfg = Debug|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Debug|x86.Build.0 = Debug|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Release|Any CPU.Build.0 = Release|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Release|x64.ActiveCfg = Release|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Release|x64.Build.0 = Release|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Release|x86.ActiveCfg = Release|Any CPU + {F67FBB8B-C4C0-4BF1-9173-7AE59C74DB32}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E9E95139-0C9A-4CF1-8B39-640F366DCB0C} EndGlobalSection EndGlobal diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/api/Azure.ResourceManager.ManagementPartner.netstandard2.0.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/api/Azure.ResourceManager.ManagementPartner.netstandard2.0.cs index 03cc3bb19a52f..93df473931700 100644 --- a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/api/Azure.ResourceManager.ManagementPartner.netstandard2.0.cs +++ b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/api/Azure.ResourceManager.ManagementPartner.netstandard2.0.cs @@ -49,6 +49,23 @@ protected PartnerResponseResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ManagementPartner.Mocking +{ + public partial class MockableManagementPartnerArmClient : Azure.ResourceManager.ArmResource + { + protected MockableManagementPartnerArmClient() { } + public virtual Azure.ResourceManager.ManagementPartner.PartnerResponseResource GetPartnerResponseResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableManagementPartnerTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableManagementPartnerTenantResource() { } + public virtual Azure.Pageable GetOperations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPartnerResponse(string partnerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPartnerResponseAsync(string partnerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ManagementPartner.PartnerResponseCollection GetPartnerResponses() { throw null; } + } +} namespace Azure.ResourceManager.ManagementPartner.Models { public static partial class ArmManagementPartnerModelFactory diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/ManagementPartnerExtensions.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/ManagementPartnerExtensions.cs index 285122844e260..375aa8f62d3ca 100644 --- a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/ManagementPartnerExtensions.cs +++ b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/ManagementPartnerExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ManagementPartner.Mocking; using Azure.ResourceManager.ManagementPartner.Models; using Azure.ResourceManager.Resources; @@ -19,46 +20,44 @@ namespace Azure.ResourceManager.ManagementPartner /// A class to add extension methods to Azure.ResourceManager.ManagementPartner. public static partial class ManagementPartnerExtensions { - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableManagementPartnerArmClient GetMockableManagementPartnerArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableManagementPartnerArmClient(client0)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableManagementPartnerTenantResource GetMockableManagementPartnerTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableManagementPartnerTenantResource(client, resource.Id)); } - #region PartnerResponseResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PartnerResponseResource GetPartnerResponseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PartnerResponseResource.ValidateResourceId(id); - return new PartnerResponseResource(client, id); - } - ); + return GetMockableManagementPartnerArmClient(client).GetPartnerResponseResource(id); } - #endregion - /// Gets a collection of PartnerResponseResources in the TenantResource. + /// + /// Gets a collection of PartnerResponseResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PartnerResponseResources and their operations over a PartnerResponseResource. public static PartnerResponseCollection GetPartnerResponses(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetPartnerResponses(); + return GetMockableManagementPartnerTenantResource(tenantResource).GetPartnerResponses(); } /// @@ -73,16 +72,20 @@ public static PartnerResponseCollection GetPartnerResponses(this TenantResource /// Partner_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Id of the Partner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPartnerResponseAsync(this TenantResource tenantResource, string partnerId, CancellationToken cancellationToken = default) { - return await tenantResource.GetPartnerResponses().GetAsync(partnerId, cancellationToken).ConfigureAwait(false); + return await GetMockableManagementPartnerTenantResource(tenantResource).GetPartnerResponseAsync(partnerId, cancellationToken).ConfigureAwait(false); } /// @@ -97,16 +100,20 @@ public static async Task> GetPartnerResponseAs /// Partner_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Id of the Partner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPartnerResponse(this TenantResource tenantResource, string partnerId, CancellationToken cancellationToken = default) { - return tenantResource.GetPartnerResponses().Get(partnerId, cancellationToken); + return GetMockableManagementPartnerTenantResource(tenantResource).GetPartnerResponse(partnerId, cancellationToken); } /// @@ -121,13 +128,17 @@ public static Response GetPartnerResponse(this TenantRe /// Operation_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsAsync(cancellationToken); + return GetMockableManagementPartnerTenantResource(tenantResource).GetOperationsAsync(cancellationToken); } /// @@ -142,13 +153,17 @@ public static AsyncPageable GetOperationsAsync(this TenantRes /// Operation_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperations(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperations(cancellationToken); + return GetMockableManagementPartnerTenantResource(tenantResource).GetOperations(cancellationToken); } } } diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/MockableManagementPartnerArmClient.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/MockableManagementPartnerArmClient.cs new file mode 100644 index 0000000000000..bdfbb25cb44e8 --- /dev/null +++ b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/MockableManagementPartnerArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ManagementPartner; + +namespace Azure.ResourceManager.ManagementPartner.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableManagementPartnerArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagementPartnerArmClient() + { + } + + /// 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 MockableManagementPartnerArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableManagementPartnerArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PartnerResponseResource GetPartnerResponseResource(ResourceIdentifier id) + { + PartnerResponseResource.ValidateResourceId(id); + return new PartnerResponseResource(Client, id); + } + } +} diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/MockableManagementPartnerTenantResource.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/MockableManagementPartnerTenantResource.cs new file mode 100644 index 0000000000000..2c4540cdd12ec --- /dev/null +++ b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/MockableManagementPartnerTenantResource.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ManagementPartner; +using Azure.ResourceManager.ManagementPartner.Models; + +namespace Azure.ResourceManager.ManagementPartner.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableManagementPartnerTenantResource : ArmResource + { + private ClientDiagnostics _operationClientDiagnostics; + private OperationRestOperations _operationRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableManagementPartnerTenantResource() + { + } + + /// 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 MockableManagementPartnerTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OperationClientDiagnostics => _operationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagementPartner", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OperationRestOperations OperationRestClient => _operationRestClient ??= new OperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PartnerResponseResources in the TenantResource. + /// An object representing collection of PartnerResponseResources and their operations over a PartnerResponseResource. + public virtual PartnerResponseCollection GetPartnerResponses() + { + return GetCachedClient(client => new PartnerResponseCollection(client, Id)); + } + + /// + /// Get the management partner using the partnerId, objectId and tenantId. + /// + /// + /// Request Path + /// /providers/Microsoft.ManagementPartner/partners/{partnerId} + /// + /// + /// Operation Id + /// Partner_Get + /// + /// + /// + /// Id of the Partner. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPartnerResponseAsync(string partnerId, CancellationToken cancellationToken = default) + { + return await GetPartnerResponses().GetAsync(partnerId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the management partner using the partnerId, objectId and tenantId. + /// + /// + /// Request Path + /// /providers/Microsoft.ManagementPartner/partners/{partnerId} + /// + /// + /// Operation Id + /// Partner_Get + /// + /// + /// + /// Id of the Partner. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPartnerResponse(string partnerId, CancellationToken cancellationToken = default) + { + return GetPartnerResponses().Get(partnerId, cancellationToken); + } + + /// + /// List all the operations. + /// + /// + /// Request Path + /// /providers/Microsoft.ManagementPartner/operations + /// + /// + /// Operation Id + /// Operation_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, OperationResponse.DeserializeOperationResponse, OperationClientDiagnostics, Pipeline, "MockableManagementPartnerTenantResource.GetOperations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the operations. + /// + /// + /// Request Path + /// /providers/Microsoft.ManagementPartner/operations + /// + /// + /// Operation Id + /// Operation_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, OperationResponse.DeserializeOperationResponse, OperationClientDiagnostics, Pipeline, "MockableManagementPartnerTenantResource.GetOperations", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index e9325d7068d65..0000000000000 --- a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ManagementPartner.Models; - -namespace Azure.ResourceManager.ManagementPartner -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _operationClientDiagnostics; - private OperationRestOperations _operationRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics OperationClientDiagnostics => _operationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ManagementPartner", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OperationRestOperations OperationRestClient => _operationRestClient ??= new OperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of PartnerResponseResources in the TenantResource. - /// An object representing collection of PartnerResponseResources and their operations over a PartnerResponseResource. - public virtual PartnerResponseCollection GetPartnerResponses() - { - return GetCachedClient(Client => new PartnerResponseCollection(Client, Id)); - } - - /// - /// List all the operations. - /// - /// - /// Request Path - /// /providers/Microsoft.ManagementPartner/operations - /// - /// - /// Operation Id - /// Operation_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, OperationResponse.DeserializeOperationResponse, OperationClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the operations. - /// - /// - /// Request Path - /// /providers/Microsoft.ManagementPartner/operations - /// - /// - /// Operation Id - /// Operation_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, OperationResponse.DeserializeOperationResponse, OperationClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperations", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/PartnerResponseResource.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/PartnerResponseResource.cs index 62bd14567bce5..3dc8ceb2a6c8e 100644 --- a/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/PartnerResponseResource.cs +++ b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/PartnerResponseResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.ManagementPartner public partial class PartnerResponseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The partnerId. public static ResourceIdentifier CreateResourceIdentifier(string partnerId) { var resourceId = $"/providers/Microsoft.ManagementPartner/partners/{partnerId}"; diff --git a/sdk/maps/Azure.ResourceManager.Maps/Azure.ResourceManager.Maps.sln b/sdk/maps/Azure.ResourceManager.Maps/Azure.ResourceManager.Maps.sln index 531a732f2a2e6..32076e0a7887d 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/Azure.ResourceManager.Maps.sln +++ b/sdk/maps/Azure.ResourceManager.Maps/Azure.ResourceManager.Maps.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F468144D-38B1-4FD5-95F0-0A3661988E03}") = "Azure.ResourceManager.Maps", "src\Azure.ResourceManager.Maps.csproj", "{BEA7BA7E-B567-40CA-BE96-10C963BD7AE3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Maps", "src\Azure.ResourceManager.Maps.csproj", "{BEA7BA7E-B567-40CA-BE96-10C963BD7AE3}" EndProject -Project("{F468144D-38B1-4FD5-95F0-0A3661988E03}") = "Azure.ResourceManager.Maps.Tests", "tests\Azure.ResourceManager.Maps.Tests.csproj", "{FFBE279B-1814-4B89-BDCB-6D41ED41D8C4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Maps.Tests", "tests\Azure.ResourceManager.Maps.Tests.csproj", "{FFBE279B-1814-4B89-BDCB-6D41ED41D8C4}" EndProject -Project("{F468144D-38B1-4FD5-95F0-0A3661988E03}") = "Azure.ResourceManager.Maps.Samples", "samples\Azure.ResourceManager.Maps.Samples.csproj", "{B981864E-6872-47B2-8014-D41382749EAF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Maps.Samples", "samples\Azure.ResourceManager.Maps.Samples.csproj", "{B981864E-6872-47B2-8014-D41382749EAF}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {23BE5AEE-830F-4786-87B6-1976CC37C396} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {FFBE279B-1814-4B89-BDCB-6D41ED41D8C4}.Release|x64.Build.0 = Release|Any CPU {FFBE279B-1814-4B89-BDCB-6D41ED41D8C4}.Release|x86.ActiveCfg = Release|Any CPU {FFBE279B-1814-4B89-BDCB-6D41ED41D8C4}.Release|x86.Build.0 = Release|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Debug|x64.ActiveCfg = Debug|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Debug|x64.Build.0 = Debug|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Debug|x86.ActiveCfg = Debug|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Debug|x86.Build.0 = Debug|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Release|Any CPU.Build.0 = Release|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Release|x64.ActiveCfg = Release|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Release|x64.Build.0 = Release|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Release|x86.ActiveCfg = Release|Any CPU + {B981864E-6872-47B2-8014-D41382749EAF}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {23BE5AEE-830F-4786-87B6-1976CC37C396} EndGlobalSection EndGlobal diff --git a/sdk/maps/Azure.ResourceManager.Maps/api/Azure.ResourceManager.Maps.netstandard2.0.cs b/sdk/maps/Azure.ResourceManager.Maps/api/Azure.ResourceManager.Maps.netstandard2.0.cs index 1f2b166b9b3c5..3ed9a7dd6a444 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/api/Azure.ResourceManager.Maps.netstandard2.0.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/api/Azure.ResourceManager.Maps.netstandard2.0.cs @@ -19,7 +19,7 @@ protected MapsAccountCollection() { } } public partial class MapsAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public MapsAccountData(Azure.Core.AzureLocation location, Azure.ResourceManager.Maps.Models.MapsSku sku) : base (default(Azure.Core.AzureLocation)) { } + public MapsAccountData(Azure.Core.AzureLocation location, Azure.ResourceManager.Maps.Models.MapsSku sku) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Maps.Models.MapsAccountKind? Kind { get { throw null; } set { } } public Azure.ResourceManager.Maps.Models.MapsAccountProperties Properties { get { throw null; } set { } } @@ -73,7 +73,7 @@ protected MapsCreatorCollection() { } } public partial class MapsCreatorData : Azure.ResourceManager.Models.TrackedResourceData { - public MapsCreatorData(Azure.Core.AzureLocation location, Azure.ResourceManager.Maps.Models.MapsCreatorProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public MapsCreatorData(Azure.Core.AzureLocation location, Azure.ResourceManager.Maps.Models.MapsCreatorProperties properties) { } public Azure.ResourceManager.Maps.Models.MapsCreatorProperties Properties { get { throw null; } set { } } } public partial class MapsCreatorResource : Azure.ResourceManager.ArmResource @@ -107,6 +107,28 @@ public static partial class MapsExtensions public static Azure.ResourceManager.Maps.MapsCreatorResource GetMapsCreatorResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } } +namespace Azure.ResourceManager.Maps.Mocking +{ + public partial class MockableMapsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMapsArmClient() { } + public virtual Azure.ResourceManager.Maps.MapsAccountResource GetMapsAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Maps.MapsCreatorResource GetMapsCreatorResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMapsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMapsResourceGroupResource() { } + public virtual Azure.Response GetMapsAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMapsAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Maps.MapsAccountCollection GetMapsAccounts() { throw null; } + } + public partial class MockableMapsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMapsSubscriptionResource() { } + public virtual Azure.Pageable GetMapsAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMapsAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Maps.Models { public static partial class ArmMapsModelFactory diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MapsExtensions.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MapsExtensions.cs index 4a488bdbecb2f..2fa65174e39ce 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MapsExtensions.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MapsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Maps.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Maps @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.Maps /// A class to add extension methods to Azure.ResourceManager.Maps. public static partial class MapsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMapsArmClient GetMockableMapsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMapsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMapsResourceGroupResource GetMockableMapsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMapsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMapsSubscriptionResource GetMockableMapsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMapsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region MapsAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MapsAccountResource GetMapsAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MapsAccountResource.ValidateResourceId(id); - return new MapsAccountResource(client, id); - } - ); + return GetMockableMapsArmClient(client).GetMapsAccountResource(id); } - #endregion - #region MapsCreatorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MapsCreatorResource GetMapsCreatorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MapsCreatorResource.ValidateResourceId(id); - return new MapsCreatorResource(client, id); - } - ); + return GetMockableMapsArmClient(client).GetMapsCreatorResource(id); } - #endregion - /// Gets a collection of MapsAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of MapsAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MapsAccountResources and their operations over a MapsAccountResource. public static MapsAccountCollection GetMapsAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMapsAccounts(); + return GetMockableMapsResourceGroupResource(resourceGroupResource).GetMapsAccounts(); } /// @@ -107,16 +92,20 @@ public static MapsAccountCollection GetMapsAccounts(this ResourceGroupResource r /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Maps Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMapsAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMapsAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableMapsResourceGroupResource(resourceGroupResource).GetMapsAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -131,16 +120,20 @@ public static async Task> GetMapsAccountAsync(this /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Maps Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMapsAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMapsAccounts().Get(accountName, cancellationToken); + return GetMockableMapsResourceGroupResource(resourceGroupResource).GetMapsAccount(accountName, cancellationToken); } /// @@ -155,13 +148,17 @@ public static Response GetMapsAccount(this ResourceGroupRes /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMapsAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMapsAccountsAsync(cancellationToken); + return GetMockableMapsSubscriptionResource(subscriptionResource).GetMapsAccountsAsync(cancellationToken); } /// @@ -176,13 +173,17 @@ public static AsyncPageable GetMapsAccountsAsync(this Subsc /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMapsAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMapsAccounts(cancellationToken); + return GetMockableMapsSubscriptionResource(subscriptionResource).GetMapsAccounts(cancellationToken); } } } diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsArmClient.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsArmClient.cs new file mode 100644 index 0000000000000..ce7a7f85daa26 --- /dev/null +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Maps; + +namespace Azure.ResourceManager.Maps.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMapsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMapsArmClient() + { + } + + /// 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 MockableMapsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMapsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MapsAccountResource GetMapsAccountResource(ResourceIdentifier id) + { + MapsAccountResource.ValidateResourceId(id); + return new MapsAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MapsCreatorResource GetMapsCreatorResource(ResourceIdentifier id) + { + MapsCreatorResource.ValidateResourceId(id); + return new MapsCreatorResource(Client, id); + } + } +} diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsResourceGroupResource.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsResourceGroupResource.cs new file mode 100644 index 0000000000000..41183b5744564 --- /dev/null +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Maps; + +namespace Azure.ResourceManager.Maps.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMapsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMapsResourceGroupResource() + { + } + + /// 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 MockableMapsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MapsAccountResources in the ResourceGroupResource. + /// An object representing collection of MapsAccountResources and their operations over a MapsAccountResource. + public virtual MapsAccountCollection GetMapsAccounts() + { + return GetCachedClient(client => new MapsAccountCollection(client, Id)); + } + + /// + /// Get a Maps Account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Maps Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMapsAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetMapsAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Maps Account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the Maps Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMapsAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetMapsAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsSubscriptionResource.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsSubscriptionResource.cs new file mode 100644 index 0000000000000..6bcd558c69a8b --- /dev/null +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MockableMapsSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Maps; + +namespace Azure.ResourceManager.Maps.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMapsSubscriptionResource : ArmResource + { + private ClientDiagnostics _mapsAccountAccountsClientDiagnostics; + private AccountsRestOperations _mapsAccountAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMapsSubscriptionResource() + { + } + + /// 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 MockableMapsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MapsAccountAccountsClientDiagnostics => _mapsAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maps", MapsAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations MapsAccountAccountsRestClient => _mapsAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MapsAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get all Maps Accounts in a Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maps/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMapsAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MapsAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MapsAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MapsAccountResource(Client, MapsAccountData.DeserializeMapsAccountData(e)), MapsAccountAccountsClientDiagnostics, Pipeline, "MockableMapsSubscriptionResource.GetMapsAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Get all Maps Accounts in a Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maps/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMapsAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MapsAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MapsAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MapsAccountResource(Client, MapsAccountData.DeserializeMapsAccountData(e)), MapsAccountAccountsClientDiagnostics, Pipeline, "MockableMapsSubscriptionResource.GetMapsAccounts", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 5349ad48c4156..0000000000000 --- a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Maps -{ - /// 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 MapsAccountResources in the ResourceGroupResource. - /// An object representing collection of MapsAccountResources and their operations over a MapsAccountResource. - public virtual MapsAccountCollection GetMapsAccounts() - { - return GetCachedClient(Client => new MapsAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index df78aca24d495..0000000000000 --- a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Maps -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _mapsAccountAccountsClientDiagnostics; - private AccountsRestOperations _mapsAccountAccountsRestClient; - - /// 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 MapsAccountAccountsClientDiagnostics => _mapsAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maps", MapsAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations MapsAccountAccountsRestClient => _mapsAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MapsAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get all Maps Accounts in a Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maps/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMapsAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MapsAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MapsAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MapsAccountResource(Client, MapsAccountData.DeserializeMapsAccountData(e)), MapsAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMapsAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Get all Maps Accounts in a Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Maps/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMapsAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MapsAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MapsAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MapsAccountResource(Client, MapsAccountData.DeserializeMapsAccountData(e)), MapsAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMapsAccounts", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountResource.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountResource.cs index bf73dbdf4791a..8fd163cfe8e4e 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountResource.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Maps public partial class MapsAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MapsCreatorResources and their operations over a MapsCreatorResource. public virtual MapsCreatorCollection GetMapsCreators() { - return GetCachedClient(Client => new MapsCreatorCollection(Client, Id)); + return GetCachedClient(client => new MapsCreatorCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual MapsCreatorCollection GetMapsCreators() /// /// The name of the Maps Creator instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMapsCreatorAsync(string creatorName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetMapsCreatorAsync(str /// /// The name of the Maps Creator instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMapsCreator(string creatorName, CancellationToken cancellationToken = default) { diff --git a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsCreatorResource.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsCreatorResource.cs index 2772187bad754..a333b16496236 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsCreatorResource.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsCreatorResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Maps public partial class MapsCreatorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The creatorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string creatorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/creators/{creatorName}"; diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/Azure.ResourceManager.Marketplace.sln b/sdk/marketplace/Azure.ResourceManager.Marketplace/Azure.ResourceManager.Marketplace.sln index 7fc1b871565d3..bc1eddc33f32c 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/Azure.ResourceManager.Marketplace.sln +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/Azure.ResourceManager.Marketplace.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{7A9FD2D9-CC84-4896-8B92-424B7F03671C}") = "Azure.ResourceManager.Marketplace", "src\Azure.ResourceManager.Marketplace.csproj", "{84810486-33BD-42ED-A8A4-FA047F9E6626}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Marketplace", "src\Azure.ResourceManager.Marketplace.csproj", "{84810486-33BD-42ED-A8A4-FA047F9E6626}" EndProject -Project("{7A9FD2D9-CC84-4896-8B92-424B7F03671C}") = "Azure.ResourceManager.Marketplace.Tests", "tests\Azure.ResourceManager.Marketplace.Tests.csproj", "{979A70DE-D021-4C54-B5E8-9804FB83F67C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Marketplace.Tests", "tests\Azure.ResourceManager.Marketplace.Tests.csproj", "{979A70DE-D021-4C54-B5E8-9804FB83F67C}" EndProject -Project("{7A9FD2D9-CC84-4896-8B92-424B7F03671C}") = "Azure.ResourceManager.Marketplace.Samples", "samples\Azure.ResourceManager.Marketplace.Samples.csproj", "{C36309D7-0416-4BAC-8F44-BBFC7458076E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Marketplace.Samples", "samples\Azure.ResourceManager.Marketplace.Samples.csproj", "{C36309D7-0416-4BAC-8F44-BBFC7458076E}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {AD793859-1C85-420F-AD0D-925A68686CD7} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {979A70DE-D021-4C54-B5E8-9804FB83F67C}.Release|x64.Build.0 = Release|Any CPU {979A70DE-D021-4C54-B5E8-9804FB83F67C}.Release|x86.ActiveCfg = Release|Any CPU {979A70DE-D021-4C54-B5E8-9804FB83F67C}.Release|x86.Build.0 = Release|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Debug|x64.ActiveCfg = Debug|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Debug|x64.Build.0 = Debug|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Debug|x86.ActiveCfg = Debug|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Debug|x86.Build.0 = Debug|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Release|Any CPU.Build.0 = Release|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Release|x64.ActiveCfg = Release|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Release|x64.Build.0 = Release|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Release|x86.ActiveCfg = Release|Any CPU + {C36309D7-0416-4BAC-8F44-BBFC7458076E}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AD793859-1C85-420F-AD0D-925A68686CD7} EndGlobalSection EndGlobal diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/api/Azure.ResourceManager.Marketplace.netstandard2.0.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/api/Azure.ResourceManager.Marketplace.netstandard2.0.cs index ca3dba4b8cbd3..e4c87866487ac 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/api/Azure.ResourceManager.Marketplace.netstandard2.0.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/api/Azure.ResourceManager.Marketplace.netstandard2.0.cs @@ -292,6 +292,25 @@ protected PrivateStoreResource() { } public virtual System.Threading.Tasks.Task UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Marketplace.PrivateStoreData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Marketplace.Mocking +{ + public partial class MockableMarketplaceArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMarketplaceArmClient() { } + public virtual Azure.ResourceManager.Marketplace.MarketplaceAdminApprovalRequestResource GetMarketplaceAdminApprovalRequestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Marketplace.MarketplaceApprovalRequestResource GetMarketplaceApprovalRequestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Marketplace.PrivateStoreCollectionInfoResource GetPrivateStoreCollectionInfoResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Marketplace.PrivateStoreOfferResource GetPrivateStoreOfferResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Marketplace.PrivateStoreResource GetPrivateStoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMarketplaceTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableMarketplaceTenantResource() { } + public virtual Azure.Response GetPrivateStore(System.Guid privateStoreId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPrivateStoreAsync(System.Guid privateStoreId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Marketplace.PrivateStoreCollection GetPrivateStores() { throw null; } + } +} namespace Azure.ResourceManager.Marketplace.Models { public partial class AcknowledgeOfferNotificationContent diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MarketplaceExtensions.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MarketplaceExtensions.cs index 98f3d45416558..4f445c2e763ab 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MarketplaceExtensions.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MarketplaceExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Marketplace.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Marketplace @@ -18,122 +19,108 @@ namespace Azure.ResourceManager.Marketplace /// A class to add extension methods to Azure.ResourceManager.Marketplace. public static partial class MarketplaceExtensions { - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableMarketplaceArmClient GetMockableMarketplaceArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMarketplaceArmClient(client0)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMarketplaceTenantResource GetMockableMarketplaceTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMarketplaceTenantResource(client, resource.Id)); } - #region PrivateStoreResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateStoreResource GetPrivateStoreResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateStoreResource.ValidateResourceId(id); - return new PrivateStoreResource(client, id); - } - ); + return GetMockableMarketplaceArmClient(client).GetPrivateStoreResource(id); } - #endregion - #region MarketplaceApprovalRequestResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MarketplaceApprovalRequestResource GetMarketplaceApprovalRequestResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MarketplaceApprovalRequestResource.ValidateResourceId(id); - return new MarketplaceApprovalRequestResource(client, id); - } - ); + return GetMockableMarketplaceArmClient(client).GetMarketplaceApprovalRequestResource(id); } - #endregion - #region MarketplaceAdminApprovalRequestResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MarketplaceAdminApprovalRequestResource GetMarketplaceAdminApprovalRequestResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MarketplaceAdminApprovalRequestResource.ValidateResourceId(id); - return new MarketplaceAdminApprovalRequestResource(client, id); - } - ); + return GetMockableMarketplaceArmClient(client).GetMarketplaceAdminApprovalRequestResource(id); } - #endregion - #region PrivateStoreCollectionInfoResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateStoreCollectionInfoResource GetPrivateStoreCollectionInfoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateStoreCollectionInfoResource.ValidateResourceId(id); - return new PrivateStoreCollectionInfoResource(client, id); - } - ); + return GetMockableMarketplaceArmClient(client).GetPrivateStoreCollectionInfoResource(id); } - #endregion - #region PrivateStoreOfferResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateStoreOfferResource GetPrivateStoreOfferResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateStoreOfferResource.ValidateResourceId(id); - return new PrivateStoreOfferResource(client, id); - } - ); + return GetMockableMarketplaceArmClient(client).GetPrivateStoreOfferResource(id); } - #endregion - /// Gets a collection of PrivateStoreResources in the TenantResource. + /// + /// Gets a collection of PrivateStoreResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PrivateStoreResources and their operations over a PrivateStoreResource. public static PrivateStoreCollection GetPrivateStores(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetPrivateStores(); + return GetMockableMarketplaceTenantResource(tenantResource).GetPrivateStores(); } /// @@ -148,6 +135,10 @@ public static PrivateStoreCollection GetPrivateStores(this TenantResource tenant /// PrivateStore_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The store ID - must use the tenant ID. @@ -155,7 +146,7 @@ public static PrivateStoreCollection GetPrivateStores(this TenantResource tenant [ForwardsClientCalls] public static async Task> GetPrivateStoreAsync(this TenantResource tenantResource, Guid privateStoreId, CancellationToken cancellationToken = default) { - return await tenantResource.GetPrivateStores().GetAsync(privateStoreId, cancellationToken).ConfigureAwait(false); + return await GetMockableMarketplaceTenantResource(tenantResource).GetPrivateStoreAsync(privateStoreId, cancellationToken).ConfigureAwait(false); } /// @@ -170,6 +161,10 @@ public static async Task> GetPrivateStoreAsync(th /// PrivateStore_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The store ID - must use the tenant ID. @@ -177,7 +172,7 @@ public static async Task> GetPrivateStoreAsync(th [ForwardsClientCalls] public static Response GetPrivateStore(this TenantResource tenantResource, Guid privateStoreId, CancellationToken cancellationToken = default) { - return tenantResource.GetPrivateStores().Get(privateStoreId, cancellationToken); + return GetMockableMarketplaceTenantResource(tenantResource).GetPrivateStore(privateStoreId, cancellationToken); } } } diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MockableMarketplaceArmClient.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MockableMarketplaceArmClient.cs new file mode 100644 index 0000000000000..85b86defe22e4 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MockableMarketplaceArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Marketplace; + +namespace Azure.ResourceManager.Marketplace.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMarketplaceArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMarketplaceArmClient() + { + } + + /// 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 MockableMarketplaceArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMarketplaceArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateStoreResource GetPrivateStoreResource(ResourceIdentifier id) + { + PrivateStoreResource.ValidateResourceId(id); + return new PrivateStoreResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MarketplaceApprovalRequestResource GetMarketplaceApprovalRequestResource(ResourceIdentifier id) + { + MarketplaceApprovalRequestResource.ValidateResourceId(id); + return new MarketplaceApprovalRequestResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MarketplaceAdminApprovalRequestResource GetMarketplaceAdminApprovalRequestResource(ResourceIdentifier id) + { + MarketplaceAdminApprovalRequestResource.ValidateResourceId(id); + return new MarketplaceAdminApprovalRequestResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateStoreCollectionInfoResource GetPrivateStoreCollectionInfoResource(ResourceIdentifier id) + { + PrivateStoreCollectionInfoResource.ValidateResourceId(id); + return new PrivateStoreCollectionInfoResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateStoreOfferResource GetPrivateStoreOfferResource(ResourceIdentifier id) + { + PrivateStoreOfferResource.ValidateResourceId(id); + return new PrivateStoreOfferResource(Client, id); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MockableMarketplaceTenantResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MockableMarketplaceTenantResource.cs new file mode 100644 index 0000000000000..185fc2b2d409f --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MockableMarketplaceTenantResource.cs @@ -0,0 +1,88 @@ +// 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.Marketplace; + +namespace Azure.ResourceManager.Marketplace.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableMarketplaceTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMarketplaceTenantResource() + { + } + + /// 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 MockableMarketplaceTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PrivateStoreResources in the TenantResource. + /// An object representing collection of PrivateStoreResources and their operations over a PrivateStoreResource. + public virtual PrivateStoreCollection GetPrivateStores() + { + return GetCachedClient(client => new PrivateStoreCollection(client, Id)); + } + + /// + /// Get information about the private store + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId} + /// + /// + /// Operation Id + /// PrivateStore_Get + /// + /// + /// + /// The store ID - must use the tenant ID. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetPrivateStoreAsync(Guid privateStoreId, CancellationToken cancellationToken = default) + { + return await GetPrivateStores().GetAsync(privateStoreId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about the private store + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId} + /// + /// + /// Operation Id + /// PrivateStore_Get + /// + /// + /// + /// The store ID - must use the tenant ID. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetPrivateStore(Guid privateStoreId, CancellationToken cancellationToken = default) + { + return GetPrivateStores().Get(privateStoreId, cancellationToken); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 731bbb4feb2e8..0000000000000 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Marketplace -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of PrivateStoreResources in the TenantResource. - /// An object representing collection of PrivateStoreResources and their operations over a PrivateStoreResource. - public virtual PrivateStoreCollection GetPrivateStores() - { - return GetCachedClient(Client => new PrivateStoreCollection(Client, Id)); - } - } -} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceAdminApprovalRequestResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceAdminApprovalRequestResource.cs index ce2a489ade31e..b73e15de865c1 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceAdminApprovalRequestResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceAdminApprovalRequestResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Marketplace public partial class MarketplaceAdminApprovalRequestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The privateStoreId. + /// The adminRequestApprovalId. public static ResourceIdentifier CreateResourceIdentifier(Guid privateStoreId, string adminRequestApprovalId) { var resourceId = $"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}"; diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceApprovalRequestResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceApprovalRequestResource.cs index 87fe8c6153a2a..aee9be495d09c 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceApprovalRequestResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/MarketplaceApprovalRequestResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Marketplace public partial class MarketplaceApprovalRequestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The privateStoreId. + /// The requestApprovalId. public static ResourceIdentifier CreateResourceIdentifier(Guid privateStoreId, string requestApprovalId) { var resourceId = $"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}"; diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs index 7670a1e53d18e..fca20f97e3e3e 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.Marketplace public partial class PrivateStoreCollectionInfoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The privateStoreId. + /// The collectionId. public static ResourceIdentifier CreateResourceIdentifier(Guid privateStoreId, Guid collectionId) { var resourceId = $"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}"; @@ -101,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PrivateStoreOfferResources and their operations over a PrivateStoreOfferResource. public virtual PrivateStoreOfferCollection GetPrivateStoreOffers() { - return GetCachedClient(Client => new PrivateStoreOfferCollection(Client, Id)); + return GetCachedClient(client => new PrivateStoreOfferCollection(client, Id)); } /// @@ -119,8 +121,8 @@ public virtual PrivateStoreOfferCollection GetPrivateStoreOffers() /// /// The offer ID to update or delete. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPrivateStoreOfferAsync(string offerId, CancellationToken cancellationToken = default) { @@ -142,8 +144,8 @@ public virtual async Task> GetPrivateStoreOf /// /// The offer ID to update or delete. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPrivateStoreOffer(string offerId, CancellationToken cancellationToken = default) { diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreOfferResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreOfferResource.cs index ddf374f9cd89f..8fc81db3f2bb9 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreOfferResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreOfferResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Marketplace public partial class PrivateStoreOfferResource : ArmResource { /// Generate the resource identifier of a instance. + /// The privateStoreId. + /// The collectionId. + /// The offerId. public static ResourceIdentifier CreateResourceIdentifier(Guid privateStoreId, Guid collectionId, string offerId) { var resourceId = $"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}"; diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs index 3a9f725385d63..405cf395852a7 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs @@ -28,6 +28,7 @@ namespace Azure.ResourceManager.Marketplace public partial class PrivateStoreResource : ArmResource { /// Generate the resource identifier of a instance. + /// The privateStoreId. public static ResourceIdentifier CreateResourceIdentifier(Guid privateStoreId) { var resourceId = $"/providers/Microsoft.Marketplace/privateStores/{privateStoreId}"; @@ -97,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MarketplaceApprovalRequestResources and their operations over a MarketplaceApprovalRequestResource. public virtual MarketplaceApprovalRequestCollection GetMarketplaceApprovalRequests() { - return GetCachedClient(Client => new MarketplaceApprovalRequestCollection(Client, Id)); + return GetCachedClient(client => new MarketplaceApprovalRequestCollection(client, Id)); } /// @@ -115,8 +116,8 @@ public virtual MarketplaceApprovalRequestCollection GetMarketplaceApprovalReques /// /// The request approval ID to get create or update. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMarketplaceApprovalRequestAsync(string requestApprovalId, CancellationToken cancellationToken = default) { @@ -138,8 +139,8 @@ public virtual async Task> GetMarke /// /// The request approval ID to get create or update. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMarketplaceApprovalRequest(string requestApprovalId, CancellationToken cancellationToken = default) { @@ -150,7 +151,7 @@ public virtual Response GetMarketplaceApprov /// An object representing collection of MarketplaceAdminApprovalRequestResources and their operations over a MarketplaceAdminApprovalRequestResource. public virtual MarketplaceAdminApprovalRequestCollection GetMarketplaceAdminApprovalRequests() { - return GetCachedClient(Client => new MarketplaceAdminApprovalRequestCollection(Client, Id)); + return GetCachedClient(client => new MarketplaceAdminApprovalRequestCollection(client, Id)); } /// @@ -169,8 +170,8 @@ public virtual MarketplaceAdminApprovalRequestCollection GetMarketplaceAdminAppr /// The admin request approval ID to get create or update. /// The publisher id of this offer. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMarketplaceAdminApprovalRequestAsync(string adminRequestApprovalId, string publisherId, CancellationToken cancellationToken = default) { @@ -193,8 +194,8 @@ public virtual async Task> Get /// The admin request approval ID to get create or update. /// The publisher id of this offer. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMarketplaceAdminApprovalRequest(string adminRequestApprovalId, string publisherId, CancellationToken cancellationToken = default) { @@ -205,7 +206,7 @@ public virtual Response GetMarketplaceA /// An object representing collection of PrivateStoreCollectionInfoResources and their operations over a PrivateStoreCollectionInfoResource. public virtual PrivateStoreCollectionInfoCollection GetPrivateStoreCollectionInfos() { - return GetCachedClient(Client => new PrivateStoreCollectionInfoCollection(Client, Id)); + return GetCachedClient(client => new PrivateStoreCollectionInfoCollection(client, Id)); } /// diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/api/Azure.ResourceManager.MarketplaceOrdering.netstandard2.0.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/api/Azure.ResourceManager.MarketplaceOrdering.netstandard2.0.cs index 6e9fde2193474..b58197af36cd6 100644 --- a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/api/Azure.ResourceManager.MarketplaceOrdering.netstandard2.0.cs +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/api/Azure.ResourceManager.MarketplaceOrdering.netstandard2.0.cs @@ -73,6 +73,25 @@ public static partial class MarketplaceOrderingExtensions public static Azure.ResourceManager.MarketplaceOrdering.MarketplaceAgreementTermCollection GetMarketplaceAgreementTerms(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } } } +namespace Azure.ResourceManager.MarketplaceOrdering.Mocking +{ + public partial class MockableMarketplaceOrderingArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMarketplaceOrderingArmClient() { } + public virtual Azure.ResourceManager.MarketplaceOrdering.MarketplaceAgreementResource GetMarketplaceAgreementResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MarketplaceOrdering.MarketplaceAgreementTermResource GetMarketplaceAgreementTermResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMarketplaceOrderingSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMarketplaceOrderingSubscriptionResource() { } + public virtual Azure.Response GetMarketplaceAgreement(string publisherId, string offerId, string planId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMarketplaceAgreementAsync(string publisherId, string offerId, string planId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MarketplaceOrdering.MarketplaceAgreementCollection GetMarketplaceAgreements() { throw null; } + public virtual Azure.Response GetMarketplaceAgreementTerm(Azure.ResourceManager.MarketplaceOrdering.Models.AgreementOfferType offerType, string publisherId, string offerId, string planId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMarketplaceAgreementTermAsync(Azure.ResourceManager.MarketplaceOrdering.Models.AgreementOfferType offerType, string publisherId, string offerId, string planId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MarketplaceOrdering.MarketplaceAgreementTermCollection GetMarketplaceAgreementTerms() { throw null; } + } +} namespace Azure.ResourceManager.MarketplaceOrdering.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MarketplaceOrderingExtensions.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MarketplaceOrderingExtensions.cs index 623eefb2d9b87..813db77d9ea09 100644 --- a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MarketplaceOrderingExtensions.cs +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MarketplaceOrderingExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.MarketplaceOrdering.Mocking; using Azure.ResourceManager.MarketplaceOrdering.Models; using Azure.ResourceManager.Resources; @@ -19,65 +20,60 @@ namespace Azure.ResourceManager.MarketplaceOrdering /// A class to add extension methods to Azure.ResourceManager.MarketplaceOrdering. public static partial class MarketplaceOrderingExtensions { - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMarketplaceOrderingArmClient GetMockableMarketplaceOrderingArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMarketplaceOrderingArmClient(client0)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMarketplaceOrderingSubscriptionResource GetMockableMarketplaceOrderingSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMarketplaceOrderingSubscriptionResource(client, resource.Id)); } - #region MarketplaceAgreementTermResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MarketplaceAgreementTermResource GetMarketplaceAgreementTermResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MarketplaceAgreementTermResource.ValidateResourceId(id); - return new MarketplaceAgreementTermResource(client, id); - } - ); + return GetMockableMarketplaceOrderingArmClient(client).GetMarketplaceAgreementTermResource(id); } - #endregion - #region MarketplaceAgreementResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MarketplaceAgreementResource GetMarketplaceAgreementResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MarketplaceAgreementResource.ValidateResourceId(id); - return new MarketplaceAgreementResource(client, id); - } - ); + return GetMockableMarketplaceOrderingArmClient(client).GetMarketplaceAgreementResource(id); } - #endregion - /// Gets a collection of MarketplaceAgreementTermResources in the SubscriptionResource. + /// + /// Gets a collection of MarketplaceAgreementTermResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MarketplaceAgreementTermResources and their operations over a MarketplaceAgreementTermResource. public static MarketplaceAgreementTermCollection GetMarketplaceAgreementTerms(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMarketplaceAgreementTerms(); + return GetMockableMarketplaceOrderingSubscriptionResource(subscriptionResource).GetMarketplaceAgreementTerms(); } /// @@ -92,6 +88,10 @@ public static MarketplaceAgreementTermCollection GetMarketplaceAgreementTerms(th /// MarketplaceAgreements_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Offer Type, currently only virtualmachine type is supported. @@ -99,12 +99,12 @@ public static MarketplaceAgreementTermCollection GetMarketplaceAgreementTerms(th /// Offer identifier string of image being deployed. /// Plan identifier string of image being deployed. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMarketplaceAgreementTermAsync(this SubscriptionResource subscriptionResource, AgreementOfferType offerType, string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetMarketplaceAgreementTerms().GetAsync(offerType, publisherId, offerId, planId, cancellationToken).ConfigureAwait(false); + return await GetMockableMarketplaceOrderingSubscriptionResource(subscriptionResource).GetMarketplaceAgreementTermAsync(offerType, publisherId, offerId, planId, cancellationToken).ConfigureAwait(false); } /// @@ -119,6 +119,10 @@ public static async Task> GetMarketpl /// MarketplaceAgreements_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Offer Type, currently only virtualmachine type is supported. @@ -126,20 +130,26 @@ public static async Task> GetMarketpl /// Offer identifier string of image being deployed. /// Plan identifier string of image being deployed. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMarketplaceAgreementTerm(this SubscriptionResource subscriptionResource, AgreementOfferType offerType, string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) { - return subscriptionResource.GetMarketplaceAgreementTerms().Get(offerType, publisherId, offerId, planId, cancellationToken); + return GetMockableMarketplaceOrderingSubscriptionResource(subscriptionResource).GetMarketplaceAgreementTerm(offerType, publisherId, offerId, planId, cancellationToken); } - /// Gets a collection of MarketplaceAgreementResources in the SubscriptionResource. + /// + /// Gets a collection of MarketplaceAgreementResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MarketplaceAgreementResources and their operations over a MarketplaceAgreementResource. public static MarketplaceAgreementCollection GetMarketplaceAgreements(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMarketplaceAgreements(); + return GetMockableMarketplaceOrderingSubscriptionResource(subscriptionResource).GetMarketplaceAgreements(); } /// @@ -154,18 +164,22 @@ public static MarketplaceAgreementCollection GetMarketplaceAgreements(this Subsc /// MarketplaceAgreements_GetAgreement /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Publisher identifier string of image being deployed. /// Offer identifier string of image being deployed. /// Plan identifier string of image being deployed. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMarketplaceAgreementAsync(this SubscriptionResource subscriptionResource, string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetMarketplaceAgreements().GetAsync(publisherId, offerId, planId, cancellationToken).ConfigureAwait(false); + return await GetMockableMarketplaceOrderingSubscriptionResource(subscriptionResource).GetMarketplaceAgreementAsync(publisherId, offerId, planId, cancellationToken).ConfigureAwait(false); } /// @@ -180,18 +194,22 @@ public static async Task> GetMarketplaceA /// MarketplaceAgreements_GetAgreement /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Publisher identifier string of image being deployed. /// Offer identifier string of image being deployed. /// Plan identifier string of image being deployed. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMarketplaceAgreement(this SubscriptionResource subscriptionResource, string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) { - return subscriptionResource.GetMarketplaceAgreements().Get(publisherId, offerId, planId, cancellationToken); + return GetMockableMarketplaceOrderingSubscriptionResource(subscriptionResource).GetMarketplaceAgreement(publisherId, offerId, planId, cancellationToken); } } } diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MockableMarketplaceOrderingArmClient.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MockableMarketplaceOrderingArmClient.cs new file mode 100644 index 0000000000000..323259bac20a5 --- /dev/null +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MockableMarketplaceOrderingArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MarketplaceOrdering; + +namespace Azure.ResourceManager.MarketplaceOrdering.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMarketplaceOrderingArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMarketplaceOrderingArmClient() + { + } + + /// 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 MockableMarketplaceOrderingArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMarketplaceOrderingArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MarketplaceAgreementTermResource GetMarketplaceAgreementTermResource(ResourceIdentifier id) + { + MarketplaceAgreementTermResource.ValidateResourceId(id); + return new MarketplaceAgreementTermResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MarketplaceAgreementResource GetMarketplaceAgreementResource(ResourceIdentifier id) + { + MarketplaceAgreementResource.ValidateResourceId(id); + return new MarketplaceAgreementResource(Client, id); + } + } +} diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MockableMarketplaceOrderingSubscriptionResource.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MockableMarketplaceOrderingSubscriptionResource.cs new file mode 100644 index 0000000000000..709ba9741b28e --- /dev/null +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MockableMarketplaceOrderingSubscriptionResource.cs @@ -0,0 +1,156 @@ +// 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.MarketplaceOrdering; +using Azure.ResourceManager.MarketplaceOrdering.Models; + +namespace Azure.ResourceManager.MarketplaceOrdering.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMarketplaceOrderingSubscriptionResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMarketplaceOrderingSubscriptionResource() + { + } + + /// 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 MockableMarketplaceOrderingSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MarketplaceAgreementTermResources in the SubscriptionResource. + /// An object representing collection of MarketplaceAgreementTermResources and their operations over a MarketplaceAgreementTermResource. + public virtual MarketplaceAgreementTermCollection GetMarketplaceAgreementTerms() + { + return GetCachedClient(client => new MarketplaceAgreementTermCollection(client, Id)); + } + + /// + /// Get marketplace terms. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current + /// + /// + /// Operation Id + /// MarketplaceAgreements_Get + /// + /// + /// + /// Offer Type, currently only virtualmachine type is supported. + /// Publisher identifier string of image being deployed. + /// Offer identifier string of image being deployed. + /// Plan identifier string of image being deployed. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMarketplaceAgreementTermAsync(AgreementOfferType offerType, string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) + { + return await GetMarketplaceAgreementTerms().GetAsync(offerType, publisherId, offerId, planId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get marketplace terms. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current + /// + /// + /// Operation Id + /// MarketplaceAgreements_Get + /// + /// + /// + /// Offer Type, currently only virtualmachine type is supported. + /// Publisher identifier string of image being deployed. + /// Offer identifier string of image being deployed. + /// Plan identifier string of image being deployed. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMarketplaceAgreementTerm(AgreementOfferType offerType, string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) + { + return GetMarketplaceAgreementTerms().Get(offerType, publisherId, offerId, planId, cancellationToken); + } + + /// Gets a collection of MarketplaceAgreementResources in the SubscriptionResource. + /// An object representing collection of MarketplaceAgreementResources and their operations over a MarketplaceAgreementResource. + public virtual MarketplaceAgreementCollection GetMarketplaceAgreements() + { + return GetCachedClient(client => new MarketplaceAgreementCollection(client, Id)); + } + + /// + /// Get marketplace agreement. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId} + /// + /// + /// Operation Id + /// MarketplaceAgreements_GetAgreement + /// + /// + /// + /// Publisher identifier string of image being deployed. + /// Offer identifier string of image being deployed. + /// Plan identifier string of image being deployed. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMarketplaceAgreementAsync(string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) + { + return await GetMarketplaceAgreements().GetAsync(publisherId, offerId, planId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get marketplace agreement. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId} + /// + /// + /// Operation Id + /// MarketplaceAgreements_GetAgreement + /// + /// + /// + /// Publisher identifier string of image being deployed. + /// Offer identifier string of image being deployed. + /// Plan identifier string of image being deployed. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMarketplaceAgreement(string publisherId, string offerId, string planId, CancellationToken cancellationToken = default) + { + return GetMarketplaceAgreements().Get(publisherId, offerId, planId, cancellationToken); + } + } +} diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 7450d69a5cdc9..0000000000000 --- a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MarketplaceOrdering -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - /// 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 string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of MarketplaceAgreementTermResources in the SubscriptionResource. - /// An object representing collection of MarketplaceAgreementTermResources and their operations over a MarketplaceAgreementTermResource. - public virtual MarketplaceAgreementTermCollection GetMarketplaceAgreementTerms() - { - return GetCachedClient(Client => new MarketplaceAgreementTermCollection(Client, Id)); - } - - /// Gets a collection of MarketplaceAgreementResources in the SubscriptionResource. - /// An object representing collection of MarketplaceAgreementResources and their operations over a MarketplaceAgreementResource. - public virtual MarketplaceAgreementCollection GetMarketplaceAgreements() - { - return GetCachedClient(Client => new MarketplaceAgreementCollection(Client, Id)); - } - } -} diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementResource.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementResource.cs index c1833f1d9bd41..82b2f2d66d543 100644 --- a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementResource.cs +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MarketplaceOrdering public partial class MarketplaceAgreementResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The publisherId. + /// The offerId. + /// The planId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string publisherId, string offerId, string planId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/agreements/{publisherId}/offers/{offerId}/plans/{planId}"; diff --git a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementTermResource.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementTermResource.cs index 0c5267ad59a28..13dcbe2f0d231 100644 --- a/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementTermResource.cs +++ b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/MarketplaceAgreementTermResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.MarketplaceOrdering public partial class MarketplaceAgreementTermResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The offerType. + /// The publisherId. + /// The offerId. + /// The planId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AgreementOfferType offerType, string publisherId, string offerId, string planId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.MarketplaceOrdering/offerTypes/{offerType}/publishers/{publisherId}/offers/{offerId}/plans/{planId}/agreements/current"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/api/Azure.ResourceManager.Media.netstandard2.0.cs b/sdk/mediaservices/Azure.ResourceManager.Media/api/Azure.ResourceManager.Media.netstandard2.0.cs index 4d39966be0b58..8b728d1760238 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/api/Azure.ResourceManager.Media.netstandard2.0.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/api/Azure.ResourceManager.Media.netstandard2.0.cs @@ -266,7 +266,7 @@ protected MediaLiveEventCollection() { } } public partial class MediaLiveEventData : Azure.ResourceManager.Models.TrackedResourceData { - public MediaLiveEventData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MediaLiveEventData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.Media.Models.CrossSiteAccessPolicies CrossSiteAccessPolicies { get { throw null; } set { } } public string Description { get { throw null; } set { } } @@ -377,7 +377,7 @@ protected MediaServicesAccountCollection() { } } public partial class MediaServicesAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public MediaServicesAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MediaServicesAccountData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Media.Models.AccountEncryption Encryption { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Media.Models.MediaAccessControl KeyDeliveryAccessControl { get { throw null; } set { } } @@ -612,7 +612,7 @@ protected StreamingEndpointCollection() { } } public partial class StreamingEndpointData : Azure.ResourceManager.Models.TrackedResourceData { - public StreamingEndpointData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StreamingEndpointData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Media.Models.StreamingEndpointAccessControl AccessControl { get { throw null; } set { } } public string AvailabilitySetName { get { throw null; } set { } } public string CdnProfile { get { throw null; } set { } } @@ -750,6 +750,43 @@ protected StreamingPolicyResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Media.StreamingPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Media.Mocking +{ + public partial class MockableMediaArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMediaArmClient() { } + public virtual Azure.ResourceManager.Media.ContentKeyPolicyResource GetContentKeyPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaAssetFilterResource GetMediaAssetFilterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaAssetResource GetMediaAssetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaAssetTrackResource GetMediaAssetTrackResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaJobResource GetMediaJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaLiveEventResource GetMediaLiveEventResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaLiveOutputResource GetMediaLiveOutputResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaServicesAccountFilterResource GetMediaServicesAccountFilterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaServicesAccountResource GetMediaServicesAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaServicesPrivateEndpointConnectionResource GetMediaServicesPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaServicesPrivateLinkResource GetMediaServicesPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.MediaTransformResource GetMediaTransformResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.StreamingEndpointResource GetStreamingEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.StreamingLocatorResource GetStreamingLocatorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Media.StreamingPolicyResource GetStreamingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMediaResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMediaResourceGroupResource() { } + public virtual Azure.Response GetMediaServicesAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMediaServicesAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Media.MediaServicesAccountCollection GetMediaServicesAccounts() { throw null; } + } + public partial class MockableMediaSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMediaSubscriptionResource() { } + public virtual Azure.Response CheckMediaServicesNameAvailability(Azure.Core.AzureLocation locationName, Azure.ResourceManager.Media.Models.MediaServicesNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckMediaServicesNameAvailabilityAsync(Azure.Core.AzureLocation locationName, Azure.ResourceManager.Media.Models.MediaServicesNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMediaServicesAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMediaServicesAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Media.Models { public partial class AacAudio : Azure.ResourceManager.Media.Models.MediaAudioBase diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/ContentKeyPolicyResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/ContentKeyPolicyResource.cs index d838b3b253a28..9edff99d4d891 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/ContentKeyPolicyResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/ContentKeyPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Media public partial class ContentKeyPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The contentKeyPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string contentKeyPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MediaExtensions.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MediaExtensions.cs index 6d2b789148431..f1e21675b71d3 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MediaExtensions.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MediaExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Media.Mocking; using Azure.ResourceManager.Media.Models; using Azure.ResourceManager.Resources; @@ -19,328 +20,273 @@ namespace Azure.ResourceManager.Media /// A class to add extension methods to Azure.ResourceManager.Media. public static partial class MediaExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMediaArmClient GetMockableMediaArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMediaArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMediaResourceGroupResource GetMockableMediaResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMediaResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMediaSubscriptionResource GetMockableMediaSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMediaSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region MediaServicesAccountFilterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaServicesAccountFilterResource GetMediaServicesAccountFilterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaServicesAccountFilterResource.ValidateResourceId(id); - return new MediaServicesAccountFilterResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaServicesAccountFilterResource(id); } - #endregion - #region MediaServicesAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaServicesAccountResource GetMediaServicesAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaServicesAccountResource.ValidateResourceId(id); - return new MediaServicesAccountResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaServicesAccountResource(id); } - #endregion - #region MediaServicesPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaServicesPrivateLinkResource GetMediaServicesPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaServicesPrivateLinkResource.ValidateResourceId(id); - return new MediaServicesPrivateLinkResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaServicesPrivateLinkResource(id); } - #endregion - #region MediaServicesPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaServicesPrivateEndpointConnectionResource GetMediaServicesPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaServicesPrivateEndpointConnectionResource.ValidateResourceId(id); - return new MediaServicesPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaServicesPrivateEndpointConnectionResource(id); } - #endregion - #region MediaAssetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaAssetResource GetMediaAssetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaAssetResource.ValidateResourceId(id); - return new MediaAssetResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaAssetResource(id); } - #endregion - #region MediaAssetFilterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaAssetFilterResource GetMediaAssetFilterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaAssetFilterResource.ValidateResourceId(id); - return new MediaAssetFilterResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaAssetFilterResource(id); } - #endregion - #region MediaAssetTrackResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaAssetTrackResource GetMediaAssetTrackResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaAssetTrackResource.ValidateResourceId(id); - return new MediaAssetTrackResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaAssetTrackResource(id); } - #endregion - #region ContentKeyPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ContentKeyPolicyResource GetContentKeyPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ContentKeyPolicyResource.ValidateResourceId(id); - return new ContentKeyPolicyResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetContentKeyPolicyResource(id); } - #endregion - #region MediaTransformResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaTransformResource GetMediaTransformResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaTransformResource.ValidateResourceId(id); - return new MediaTransformResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaTransformResource(id); } - #endregion - #region MediaJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaJobResource GetMediaJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaJobResource.ValidateResourceId(id); - return new MediaJobResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaJobResource(id); } - #endregion - #region StreamingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamingPolicyResource GetStreamingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamingPolicyResource.ValidateResourceId(id); - return new StreamingPolicyResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetStreamingPolicyResource(id); } - #endregion - #region StreamingLocatorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamingLocatorResource GetStreamingLocatorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamingLocatorResource.ValidateResourceId(id); - return new StreamingLocatorResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetStreamingLocatorResource(id); } - #endregion - #region MediaLiveEventResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaLiveEventResource GetMediaLiveEventResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaLiveEventResource.ValidateResourceId(id); - return new MediaLiveEventResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaLiveEventResource(id); } - #endregion - #region MediaLiveOutputResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MediaLiveOutputResource GetMediaLiveOutputResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MediaLiveOutputResource.ValidateResourceId(id); - return new MediaLiveOutputResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetMediaLiveOutputResource(id); } - #endregion - #region StreamingEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamingEndpointResource GetStreamingEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamingEndpointResource.ValidateResourceId(id); - return new StreamingEndpointResource(client, id); - } - ); + return GetMockableMediaArmClient(client).GetStreamingEndpointResource(id); } - #endregion - /// Gets a collection of MediaServicesAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of MediaServicesAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MediaServicesAccountResources and their operations over a MediaServicesAccountResource. public static MediaServicesAccountCollection GetMediaServicesAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMediaServicesAccounts(); + return GetMockableMediaResourceGroupResource(resourceGroupResource).GetMediaServicesAccounts(); } /// @@ -355,16 +301,20 @@ public static MediaServicesAccountCollection GetMediaServicesAccounts(this Resou /// Mediaservices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Media Services account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMediaServicesAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMediaServicesAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableMediaResourceGroupResource(resourceGroupResource).GetMediaServicesAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -379,16 +329,20 @@ public static async Task> GetMediaService /// Mediaservices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Media Services account name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMediaServicesAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMediaServicesAccounts().Get(accountName, cancellationToken); + return GetMockableMediaResourceGroupResource(resourceGroupResource).GetMediaServicesAccount(accountName, cancellationToken); } /// @@ -403,13 +357,17 @@ public static Response GetMediaServicesAccount(thi /// Mediaservices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMediaServicesAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMediaServicesAccountsAsync(cancellationToken); + return GetMockableMediaSubscriptionResource(subscriptionResource).GetMediaServicesAccountsAsync(cancellationToken); } /// @@ -424,13 +382,17 @@ public static AsyncPageable GetMediaServicesAccoun /// Mediaservices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMediaServicesAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMediaServicesAccounts(cancellationToken); + return GetMockableMediaSubscriptionResource(subscriptionResource).GetMediaServicesAccounts(cancellationToken); } /// @@ -445,6 +407,10 @@ public static Pageable GetMediaServicesAccounts(th /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location name. @@ -453,9 +419,7 @@ public static Pageable GetMediaServicesAccounts(th /// is null. public static async Task> CheckMediaServicesNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, MediaServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMediaServicesNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); + return await GetMockableMediaSubscriptionResource(subscriptionResource).CheckMediaServicesNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); } /// @@ -470,6 +434,10 @@ public static async Task> CheckMed /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location name. @@ -478,9 +446,7 @@ public static async Task> CheckMed /// is null. public static Response CheckMediaServicesNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation locationName, MediaServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMediaServicesNameAvailability(locationName, content, cancellationToken); + return GetMockableMediaSubscriptionResource(subscriptionResource).CheckMediaServicesNameAvailability(locationName, content, cancellationToken); } } } diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaArmClient.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaArmClient.cs new file mode 100644 index 0000000000000..78fa72b8fabfb --- /dev/null +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaArmClient.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Media; + +namespace Azure.ResourceManager.Media.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMediaArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMediaArmClient() + { + } + + /// 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 MockableMediaArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMediaArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaServicesAccountFilterResource GetMediaServicesAccountFilterResource(ResourceIdentifier id) + { + MediaServicesAccountFilterResource.ValidateResourceId(id); + return new MediaServicesAccountFilterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaServicesAccountResource GetMediaServicesAccountResource(ResourceIdentifier id) + { + MediaServicesAccountResource.ValidateResourceId(id); + return new MediaServicesAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaServicesPrivateLinkResource GetMediaServicesPrivateLinkResource(ResourceIdentifier id) + { + MediaServicesPrivateLinkResource.ValidateResourceId(id); + return new MediaServicesPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaServicesPrivateEndpointConnectionResource GetMediaServicesPrivateEndpointConnectionResource(ResourceIdentifier id) + { + MediaServicesPrivateEndpointConnectionResource.ValidateResourceId(id); + return new MediaServicesPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaAssetResource GetMediaAssetResource(ResourceIdentifier id) + { + MediaAssetResource.ValidateResourceId(id); + return new MediaAssetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaAssetFilterResource GetMediaAssetFilterResource(ResourceIdentifier id) + { + MediaAssetFilterResource.ValidateResourceId(id); + return new MediaAssetFilterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaAssetTrackResource GetMediaAssetTrackResource(ResourceIdentifier id) + { + MediaAssetTrackResource.ValidateResourceId(id); + return new MediaAssetTrackResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContentKeyPolicyResource GetContentKeyPolicyResource(ResourceIdentifier id) + { + ContentKeyPolicyResource.ValidateResourceId(id); + return new ContentKeyPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaTransformResource GetMediaTransformResource(ResourceIdentifier id) + { + MediaTransformResource.ValidateResourceId(id); + return new MediaTransformResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaJobResource GetMediaJobResource(ResourceIdentifier id) + { + MediaJobResource.ValidateResourceId(id); + return new MediaJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamingPolicyResource GetStreamingPolicyResource(ResourceIdentifier id) + { + StreamingPolicyResource.ValidateResourceId(id); + return new StreamingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamingLocatorResource GetStreamingLocatorResource(ResourceIdentifier id) + { + StreamingLocatorResource.ValidateResourceId(id); + return new StreamingLocatorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaLiveEventResource GetMediaLiveEventResource(ResourceIdentifier id) + { + MediaLiveEventResource.ValidateResourceId(id); + return new MediaLiveEventResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MediaLiveOutputResource GetMediaLiveOutputResource(ResourceIdentifier id) + { + MediaLiveOutputResource.ValidateResourceId(id); + return new MediaLiveOutputResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamingEndpointResource GetStreamingEndpointResource(ResourceIdentifier id) + { + StreamingEndpointResource.ValidateResourceId(id); + return new StreamingEndpointResource(Client, id); + } + } +} diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaResourceGroupResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaResourceGroupResource.cs new file mode 100644 index 0000000000000..eeb4aef877ad8 --- /dev/null +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Media; + +namespace Azure.ResourceManager.Media.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMediaResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMediaResourceGroupResource() + { + } + + /// 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 MockableMediaResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MediaServicesAccountResources in the ResourceGroupResource. + /// An object representing collection of MediaServicesAccountResources and their operations over a MediaServicesAccountResource. + public virtual MediaServicesAccountCollection GetMediaServicesAccounts() + { + return GetCachedClient(client => new MediaServicesAccountCollection(client, Id)); + } + + /// + /// Get the details of a Media Services account + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName} + /// + /// + /// Operation Id + /// Mediaservices_Get + /// + /// + /// + /// The Media Services account name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMediaServicesAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetMediaServicesAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the details of a Media Services account + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName} + /// + /// + /// Operation Id + /// Mediaservices_Get + /// + /// + /// + /// The Media Services account name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMediaServicesAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetMediaServicesAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaSubscriptionResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaSubscriptionResource.cs new file mode 100644 index 0000000000000..0273ae6beedea --- /dev/null +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MockableMediaSubscriptionResource.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Media; +using Azure.ResourceManager.Media.Models; + +namespace Azure.ResourceManager.Media.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMediaSubscriptionResource : ArmResource + { + private ClientDiagnostics _mediaServicesAccountMediaservicesClientDiagnostics; + private MediaservicesRestOperations _mediaServicesAccountMediaservicesRestClient; + private ClientDiagnostics _locationsClientDiagnostics; + private LocationsRestOperations _locationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMediaSubscriptionResource() + { + } + + /// 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 MockableMediaSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MediaServicesAccountMediaservicesClientDiagnostics => _mediaServicesAccountMediaservicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Media", MediaServicesAccountResource.ResourceType.Namespace, Diagnostics); + private MediaservicesRestOperations MediaServicesAccountMediaservicesRestClient => _mediaServicesAccountMediaservicesRestClient ??= new MediaservicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MediaServicesAccountResource.ResourceType)); + private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Media", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Media Services accounts in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices + /// + /// + /// Operation Id + /// Mediaservices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMediaServicesAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MediaServicesAccountMediaservicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MediaServicesAccountMediaservicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MediaServicesAccountResource(Client, MediaServicesAccountData.DeserializeMediaServicesAccountData(e)), MediaServicesAccountMediaservicesClientDiagnostics, Pipeline, "MockableMediaSubscriptionResource.GetMediaServicesAccounts", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// List Media Services accounts in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices + /// + /// + /// Operation Id + /// Mediaservices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMediaServicesAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MediaServicesAccountMediaservicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MediaServicesAccountMediaservicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MediaServicesAccountResource(Client, MediaServicesAccountData.DeserializeMediaServicesAccountData(e)), MediaServicesAccountMediaservicesClientDiagnostics, Pipeline, "MockableMediaSubscriptionResource.GetMediaServicesAccounts", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Checks whether the Media Service resource name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// Location name. + /// The request parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckMediaServicesNameAvailabilityAsync(AzureLocation locationName, MediaServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableMediaSubscriptionResource.CheckMediaServicesNameAvailability"); + scope.Start(); + try + { + var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the Media Service resource name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// Location name. + /// The request parameters. + /// The cancellation token to use. + /// is null. + public virtual Response CheckMediaServicesNameAvailability(AzureLocation locationName, MediaServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableMediaSubscriptionResource.CheckMediaServicesNameAvailability"); + scope.Start(); + try + { + var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, locationName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3159e44e4066f..0000000000000 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Media -{ - /// 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 MediaServicesAccountResources in the ResourceGroupResource. - /// An object representing collection of MediaServicesAccountResources and their operations over a MediaServicesAccountResource. - public virtual MediaServicesAccountCollection GetMediaServicesAccounts() - { - return GetCachedClient(Client => new MediaServicesAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 1890146ad7456..0000000000000 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Media.Models; - -namespace Azure.ResourceManager.Media -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _mediaServicesAccountMediaservicesClientDiagnostics; - private MediaservicesRestOperations _mediaServicesAccountMediaservicesRestClient; - private ClientDiagnostics _locationsClientDiagnostics; - private LocationsRestOperations _locationsRestClient; - - /// 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 MediaServicesAccountMediaservicesClientDiagnostics => _mediaServicesAccountMediaservicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Media", MediaServicesAccountResource.ResourceType.Namespace, Diagnostics); - private MediaservicesRestOperations MediaServicesAccountMediaservicesRestClient => _mediaServicesAccountMediaservicesRestClient ??= new MediaservicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MediaServicesAccountResource.ResourceType)); - private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Media", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List Media Services accounts in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices - /// - /// - /// Operation Id - /// Mediaservices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMediaServicesAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MediaServicesAccountMediaservicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MediaServicesAccountMediaservicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MediaServicesAccountResource(Client, MediaServicesAccountData.DeserializeMediaServicesAccountData(e)), MediaServicesAccountMediaservicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMediaServicesAccounts", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// List Media Services accounts in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices - /// - /// - /// Operation Id - /// Mediaservices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMediaServicesAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MediaServicesAccountMediaservicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MediaServicesAccountMediaservicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MediaServicesAccountResource(Client, MediaServicesAccountData.DeserializeMediaServicesAccountData(e)), MediaServicesAccountMediaservicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMediaServicesAccounts", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Checks whether the Media Service resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// Location name. - /// The request parameters. - /// The cancellation token to use. - public virtual async Task> CheckMediaServicesNameAvailabilityAsync(AzureLocation locationName, MediaServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMediaServicesNameAvailability"); - scope.Start(); - try - { - var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether the Media Service resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// Location name. - /// The request parameters. - /// The cancellation token to use. - public virtual Response CheckMediaServicesNameAvailability(AzureLocation locationName, MediaServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMediaServicesNameAvailability"); - scope.Start(); - try - { - var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, locationName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetFilterResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetFilterResource.cs index 11bb5f562154d..0be4f4d78e8ed 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetFilterResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetFilterResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Media public partial class MediaAssetFilterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The assetName. + /// The filterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string assetName, string filterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetResource.cs index ef8b10cb6932b..765a3572204ff 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Media public partial class MediaAssetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The assetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string assetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MediaAssetFilterResources and their operations over a MediaAssetFilterResource. public virtual MediaAssetFilterCollection GetMediaAssetFilters() { - return GetCachedClient(Client => new MediaAssetFilterCollection(Client, Id)); + return GetCachedClient(client => new MediaAssetFilterCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual MediaAssetFilterCollection GetMediaAssetFilters() /// /// The Asset Filter name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaAssetFilterAsync(string filterName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetMediaAssetFilte /// /// The Asset Filter name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaAssetFilter(string filterName, CancellationToken cancellationToken = default) { @@ -145,7 +149,7 @@ public virtual Response GetMediaAssetFilter(string fil /// An object representing collection of MediaAssetTrackResources and their operations over a MediaAssetTrackResource. public virtual MediaAssetTrackCollection GetMediaAssetTracks() { - return GetCachedClient(Client => new MediaAssetTrackCollection(Client, Id)); + return GetCachedClient(client => new MediaAssetTrackCollection(client, Id)); } /// @@ -163,8 +167,8 @@ public virtual MediaAssetTrackCollection GetMediaAssetTracks() /// /// The Asset Track name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaAssetTrackAsync(string trackName, CancellationToken cancellationToken = default) { @@ -186,8 +190,8 @@ public virtual async Task> GetMediaAssetTrackA /// /// The Asset Track name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaAssetTrack(string trackName, CancellationToken cancellationToken = default) { diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetTrackResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetTrackResource.cs index face7cd5166a6..c6a6fb069d0f2 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetTrackResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetTrackResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Media public partial class MediaAssetTrackResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The assetName. + /// The trackName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string assetName, string trackName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/tracks/{trackName}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaJobResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaJobResource.cs index 179c482602037..853839e7aa9f1 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaJobResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaJobResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Media public partial class MediaJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The transformName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string transformName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventResource.cs index 049f2100db441..db44d41d54126 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Media public partial class MediaLiveEventResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The liveEventName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string liveEventName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MediaLiveOutputResources and their operations over a MediaLiveOutputResource. public virtual MediaLiveOutputCollection GetMediaLiveOutputs() { - return GetCachedClient(Client => new MediaLiveOutputCollection(Client, Id)); + return GetCachedClient(client => new MediaLiveOutputCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual MediaLiveOutputCollection GetMediaLiveOutputs() /// /// The name of the live output. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaLiveOutputAsync(string liveOutputName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetMediaLiveOutputA /// /// The name of the live output. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaLiveOutput(string liveOutputName, CancellationToken cancellationToken = default) { diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveOutputResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveOutputResource.cs index 1e0dd1bbc17aa..1f5c0cdeed5b1 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveOutputResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveOutputResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Media public partial class MediaLiveOutputResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The liveEventName. + /// The liveOutputName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string liveEventName, string liveOutputName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountFilterResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountFilterResource.cs index 20522aaf8bdc5..49e3762ccfeee 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountFilterResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountFilterResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Media public partial class MediaServicesAccountFilterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The filterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string filterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountResource.cs index a66678adf3226..44f3f675dd128 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Media public partial class MediaServicesAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MediaServicesAccountFilterResources and their operations over a MediaServicesAccountFilterResource. public virtual MediaServicesAccountFilterCollection GetMediaServicesAccountFilters() { - return GetCachedClient(Client => new MediaServicesAccountFilterCollection(Client, Id)); + return GetCachedClient(client => new MediaServicesAccountFilterCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual MediaServicesAccountFilterCollection GetMediaServicesAccountFilte /// /// The Account Filter name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaServicesAccountFilterAsync(string filterName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetMedia /// /// The Account Filter name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaServicesAccountFilter(string filterName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetMediaServicesAcco /// An object representing collection of MediaServicesPrivateLinkResources and their operations over a MediaServicesPrivateLinkResource. public virtual MediaServicesPrivateLinkResourceCollection GetMediaServicesPrivateLinkResources() { - return GetCachedClient(Client => new MediaServicesPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new MediaServicesPrivateLinkResourceCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual MediaServicesPrivateLinkResourceCollection GetMediaServicesPrivat /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaServicesPrivateLinkResourceAsync(string name, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetMediaSe /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaServicesPrivateLinkResource(string name, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetMediaServicesPrivat /// An object representing collection of MediaServicesPrivateEndpointConnectionResources and their operations over a MediaServicesPrivateEndpointConnectionResource. public virtual MediaServicesPrivateEndpointConnectionCollection GetMediaServicesPrivateEndpointConnections() { - return GetCachedClient(Client => new MediaServicesPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new MediaServicesPrivateEndpointConnectionCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual MediaServicesPrivateEndpointConnectionCollection GetMediaServices /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaServicesPrivateEndpointConnectionAsync(string name, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaServicesPrivateEndpointConnection(string name, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetMedia /// An object representing collection of MediaAssetResources and their operations over a MediaAssetResource. public virtual MediaAssetCollection GetMediaAssets() { - return GetCachedClient(Client => new MediaAssetCollection(Client, Id)); + return GetCachedClient(client => new MediaAssetCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual MediaAssetCollection GetMediaAssets() /// /// The Asset name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaAssetAsync(string assetName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetMediaAssetAsync(strin /// /// The Asset name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaAsset(string assetName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetMediaAsset(string assetName, Canc /// An object representing collection of ContentKeyPolicyResources and their operations over a ContentKeyPolicyResource. public virtual ContentKeyPolicyCollection GetContentKeyPolicies() { - return GetCachedClient(Client => new ContentKeyPolicyCollection(Client, Id)); + return GetCachedClient(client => new ContentKeyPolicyCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual ContentKeyPolicyCollection GetContentKeyPolicies() /// /// The Content Key Policy name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetContentKeyPolicyAsync(string contentKeyPolicyName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task> GetContentKeyPolic /// /// The Content Key Policy name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetContentKeyPolicy(string contentKeyPolicyName, CancellationToken cancellationToken = default) { @@ -358,7 +361,7 @@ public virtual Response GetContentKeyPolicy(string con /// An object representing collection of MediaTransformResources and their operations over a MediaTransformResource. public virtual MediaTransformCollection GetMediaTransforms() { - return GetCachedClient(Client => new MediaTransformCollection(Client, Id)); + return GetCachedClient(client => new MediaTransformCollection(client, Id)); } /// @@ -376,8 +379,8 @@ public virtual MediaTransformCollection GetMediaTransforms() /// /// The Transform name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaTransformAsync(string transformName, CancellationToken cancellationToken = default) { @@ -399,8 +402,8 @@ public virtual async Task> GetMediaTransformAsy /// /// The Transform name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaTransform(string transformName, CancellationToken cancellationToken = default) { @@ -411,7 +414,7 @@ public virtual Response GetMediaTransform(string transfo /// An object representing collection of StreamingPolicyResources and their operations over a StreamingPolicyResource. public virtual StreamingPolicyCollection GetStreamingPolicies() { - return GetCachedClient(Client => new StreamingPolicyCollection(Client, Id)); + return GetCachedClient(client => new StreamingPolicyCollection(client, Id)); } /// @@ -429,8 +432,8 @@ public virtual StreamingPolicyCollection GetStreamingPolicies() /// /// The Streaming Policy name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStreamingPolicyAsync(string streamingPolicyName, CancellationToken cancellationToken = default) { @@ -452,8 +455,8 @@ public virtual async Task> GetStreamingPolicyA /// /// The Streaming Policy name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStreamingPolicy(string streamingPolicyName, CancellationToken cancellationToken = default) { @@ -464,7 +467,7 @@ public virtual Response GetStreamingPolicy(string strea /// An object representing collection of StreamingLocatorResources and their operations over a StreamingLocatorResource. public virtual StreamingLocatorCollection GetStreamingLocators() { - return GetCachedClient(Client => new StreamingLocatorCollection(Client, Id)); + return GetCachedClient(client => new StreamingLocatorCollection(client, Id)); } /// @@ -482,8 +485,8 @@ public virtual StreamingLocatorCollection GetStreamingLocators() /// /// The Streaming Locator name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStreamingLocatorAsync(string streamingLocatorName, CancellationToken cancellationToken = default) { @@ -505,8 +508,8 @@ public virtual async Task> GetStreamingLocato /// /// The Streaming Locator name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStreamingLocator(string streamingLocatorName, CancellationToken cancellationToken = default) { @@ -517,7 +520,7 @@ public virtual Response GetStreamingLocator(string str /// An object representing collection of MediaLiveEventResources and their operations over a MediaLiveEventResource. public virtual MediaLiveEventCollection GetMediaLiveEvents() { - return GetCachedClient(Client => new MediaLiveEventCollection(Client, Id)); + return GetCachedClient(client => new MediaLiveEventCollection(client, Id)); } /// @@ -535,8 +538,8 @@ public virtual MediaLiveEventCollection GetMediaLiveEvents() /// /// The name of the live event, maximum length is 32. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaLiveEventAsync(string liveEventName, CancellationToken cancellationToken = default) { @@ -558,8 +561,8 @@ public virtual async Task> GetMediaLiveEventAsy /// /// The name of the live event, maximum length is 32. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaLiveEvent(string liveEventName, CancellationToken cancellationToken = default) { @@ -570,7 +573,7 @@ public virtual Response GetMediaLiveEvent(string liveEve /// An object representing collection of StreamingEndpointResources and their operations over a StreamingEndpointResource. public virtual StreamingEndpointCollection GetStreamingEndpoints() { - return GetCachedClient(Client => new StreamingEndpointCollection(Client, Id)); + return GetCachedClient(client => new StreamingEndpointCollection(client, Id)); } /// @@ -588,8 +591,8 @@ public virtual StreamingEndpointCollection GetStreamingEndpoints() /// /// The name of the streaming endpoint, maximum length is 24. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStreamingEndpointAsync(string streamingEndpointName, CancellationToken cancellationToken = default) { @@ -611,8 +614,8 @@ public virtual async Task> GetStreamingEndpo /// /// The name of the streaming endpoint, maximum length is 24. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStreamingEndpoint(string streamingEndpointName, CancellationToken cancellationToken = default) { diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateEndpointConnectionResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateEndpointConnectionResource.cs index e1ce3a28a6275..809d0b3fede87 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateEndpointConnectionResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Media public partial class MediaServicesPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateLinkResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateLinkResource.cs index c929b7b779c93..2cb5497232cf8 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateLinkResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Media public partial class MediaServicesPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources/{name}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformResource.cs index d5fdf5331544a..56b5368416411 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Media public partial class MediaTransformResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The transformName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string transformName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MediaJobResources and their operations over a MediaJobResource. public virtual MediaJobCollection GetMediaJobs() { - return GetCachedClient(Client => new MediaJobCollection(Client, Id)); + return GetCachedClient(client => new MediaJobCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual MediaJobCollection GetMediaJobs() /// /// The Job name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMediaJobAsync(string jobName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetMediaJobAsync(string jo /// /// The Job name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMediaJob(string jobName, CancellationToken cancellationToken = default) { diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingEndpointResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingEndpointResource.cs index e65ca31ff1898..a5e31e7de9dfe 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingEndpointResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingEndpointResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Media public partial class StreamingEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The streamingEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string streamingEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingLocatorResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingLocatorResource.cs index 62c4a0c3dfc16..f7c6ac0ab5d13 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingLocatorResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingLocatorResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Media public partial class StreamingLocatorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The streamingLocatorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string streamingLocatorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}"; diff --git a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingPolicyResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingPolicyResource.cs index 37526e3406747..61ae0daa37b2f 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingPolicyResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/StreamingPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Media public partial class StreamingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The streamingPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string streamingPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}"; diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/Azure.ResourceManager.MixedReality.sln b/sdk/mixedreality/Azure.ResourceManager.MixedReality/Azure.ResourceManager.MixedReality.sln index 57a98d4b5db81..ddd50fc6c043e 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/Azure.ResourceManager.MixedReality.sln +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/Azure.ResourceManager.MixedReality.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{27203A77-39F0-4E0B-BA27-58D9E879ECA7}") = "Azure.ResourceManager.MixedReality", "src\Azure.ResourceManager.MixedReality.csproj", "{0F146ABF-D6F4-4645-975E-A5D272AC8C68}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.MixedReality", "src\Azure.ResourceManager.MixedReality.csproj", "{0F146ABF-D6F4-4645-975E-A5D272AC8C68}" EndProject -Project("{27203A77-39F0-4E0B-BA27-58D9E879ECA7}") = "Azure.ResourceManager.MixedReality.Tests", "tests\Azure.ResourceManager.MixedReality.Tests.csproj", "{B2EC6130-E353-40CC-8783-5E0B44ABD4E6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.MixedReality.Tests", "tests\Azure.ResourceManager.MixedReality.Tests.csproj", "{B2EC6130-E353-40CC-8783-5E0B44ABD4E6}" EndProject -Project("{27203A77-39F0-4E0B-BA27-58D9E879ECA7}") = "Azure.ResourceManager.MixedReality.Samples", "samples\Azure.ResourceManager.MixedReality.Samples.csproj", "{EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.MixedReality.Samples", "samples\Azure.ResourceManager.MixedReality.Samples.csproj", "{EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B72C202C-01D1-4C78-B6E7-927AD0127A68} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {B2EC6130-E353-40CC-8783-5E0B44ABD4E6}.Release|x64.Build.0 = Release|Any CPU {B2EC6130-E353-40CC-8783-5E0B44ABD4E6}.Release|x86.ActiveCfg = Release|Any CPU {B2EC6130-E353-40CC-8783-5E0B44ABD4E6}.Release|x86.Build.0 = Release|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Debug|x64.ActiveCfg = Debug|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Debug|x64.Build.0 = Debug|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Debug|x86.ActiveCfg = Debug|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Debug|x86.Build.0 = Debug|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Release|Any CPU.Build.0 = Release|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Release|x64.ActiveCfg = Release|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Release|x64.Build.0 = Release|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Release|x86.ActiveCfg = Release|Any CPU + {EB4F9A1C-13A6-416C-BF1C-1242DDE1F968}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B72C202C-01D1-4C78-B6E7-927AD0127A68} EndGlobalSection EndGlobal diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/api/Azure.ResourceManager.MixedReality.netstandard2.0.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/api/Azure.ResourceManager.MixedReality.netstandard2.0.cs index c761d78121052..d51cae555786e 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/api/Azure.ResourceManager.MixedReality.netstandard2.0.cs +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/api/Azure.ResourceManager.MixedReality.netstandard2.0.cs @@ -36,7 +36,7 @@ protected RemoteRenderingAccountCollection() { } } public partial class RemoteRenderingAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public RemoteRenderingAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public RemoteRenderingAccountData(Azure.Core.AzureLocation location) { } public string AccountDomain { get { throw null; } } public System.Guid? AccountId { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } @@ -88,7 +88,7 @@ protected SpatialAnchorsAccountCollection() { } } public partial class SpatialAnchorsAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public SpatialAnchorsAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SpatialAnchorsAccountData(Azure.Core.AzureLocation location) { } public string AccountDomain { get { throw null; } } public System.Guid? AccountId { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } @@ -122,6 +122,35 @@ protected SpatialAnchorsAccountResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.MixedReality.SpatialAnchorsAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.MixedReality.Mocking +{ + public partial class MockableMixedRealityArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMixedRealityArmClient() { } + public virtual Azure.ResourceManager.MixedReality.RemoteRenderingAccountResource GetRemoteRenderingAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MixedReality.SpatialAnchorsAccountResource GetSpatialAnchorsAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMixedRealityResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMixedRealityResourceGroupResource() { } + public virtual Azure.Response GetRemoteRenderingAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRemoteRenderingAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MixedReality.RemoteRenderingAccountCollection GetRemoteRenderingAccounts() { throw null; } + public virtual Azure.Response GetSpatialAnchorsAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSpatialAnchorsAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MixedReality.SpatialAnchorsAccountCollection GetSpatialAnchorsAccounts() { throw null; } + } + public partial class MockableMixedRealitySubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMixedRealitySubscriptionResource() { } + public virtual Azure.Response CheckMixedRealityNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.MixedReality.Models.MixedRealityNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckMixedRealityNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.MixedReality.Models.MixedRealityNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRemoteRenderingAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRemoteRenderingAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSpatialAnchorsAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSpatialAnchorsAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.MixedReality.Models { public static partial class ArmMixedRealityModelFactory diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MixedRealityExtensions.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MixedRealityExtensions.cs index 8a9da3fe54998..caaa5c698c29f 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MixedRealityExtensions.cs +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MixedRealityExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.MixedReality.Mocking; using Azure.ResourceManager.MixedReality.Models; using Azure.ResourceManager.Resources; @@ -19,81 +20,65 @@ namespace Azure.ResourceManager.MixedReality /// A class to add extension methods to Azure.ResourceManager.MixedReality. public static partial class MixedRealityExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMixedRealityArmClient GetMockableMixedRealityArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMixedRealityArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMixedRealityResourceGroupResource GetMockableMixedRealityResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMixedRealityResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMixedRealitySubscriptionResource GetMockableMixedRealitySubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMixedRealitySubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region SpatialAnchorsAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SpatialAnchorsAccountResource GetSpatialAnchorsAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SpatialAnchorsAccountResource.ValidateResourceId(id); - return new SpatialAnchorsAccountResource(client, id); - } - ); + return GetMockableMixedRealityArmClient(client).GetSpatialAnchorsAccountResource(id); } - #endregion - #region RemoteRenderingAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RemoteRenderingAccountResource GetRemoteRenderingAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RemoteRenderingAccountResource.ValidateResourceId(id); - return new RemoteRenderingAccountResource(client, id); - } - ); + return GetMockableMixedRealityArmClient(client).GetRemoteRenderingAccountResource(id); } - #endregion - /// Gets a collection of SpatialAnchorsAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of SpatialAnchorsAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SpatialAnchorsAccountResources and their operations over a SpatialAnchorsAccountResource. public static SpatialAnchorsAccountCollection GetSpatialAnchorsAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSpatialAnchorsAccounts(); + return GetMockableMixedRealityResourceGroupResource(resourceGroupResource).GetSpatialAnchorsAccounts(); } /// @@ -108,16 +93,20 @@ public static SpatialAnchorsAccountCollection GetSpatialAnchorsAccounts(this Res /// SpatialAnchorsAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of an Mixed Reality Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSpatialAnchorsAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSpatialAnchorsAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableMixedRealityResourceGroupResource(resourceGroupResource).GetSpatialAnchorsAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -132,24 +121,34 @@ public static async Task> GetSpatialAnch /// SpatialAnchorsAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of an Mixed Reality Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSpatialAnchorsAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSpatialAnchorsAccounts().Get(accountName, cancellationToken); + return GetMockableMixedRealityResourceGroupResource(resourceGroupResource).GetSpatialAnchorsAccount(accountName, cancellationToken); } - /// Gets a collection of RemoteRenderingAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of RemoteRenderingAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RemoteRenderingAccountResources and their operations over a RemoteRenderingAccountResource. public static RemoteRenderingAccountCollection GetRemoteRenderingAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRemoteRenderingAccounts(); + return GetMockableMixedRealityResourceGroupResource(resourceGroupResource).GetRemoteRenderingAccounts(); } /// @@ -164,16 +163,20 @@ public static RemoteRenderingAccountCollection GetRemoteRenderingAccounts(this R /// RemoteRenderingAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of an Mixed Reality Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRemoteRenderingAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetRemoteRenderingAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableMixedRealityResourceGroupResource(resourceGroupResource).GetRemoteRenderingAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -188,16 +191,20 @@ public static async Task> GetRemoteRend /// RemoteRenderingAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of an Mixed Reality Account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRemoteRenderingAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetRemoteRenderingAccounts().Get(accountName, cancellationToken); + return GetMockableMixedRealityResourceGroupResource(resourceGroupResource).GetRemoteRenderingAccount(accountName, cancellationToken); } /// @@ -212,6 +219,10 @@ public static Response GetRemoteRenderingAccount /// CheckNameAvailabilityLocal /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location in which uniqueness will be verified. @@ -220,9 +231,7 @@ public static Response GetRemoteRenderingAccount /// is null. public static async Task> CheckMixedRealityNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, MixedRealityNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMixedRealityNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableMixedRealitySubscriptionResource(subscriptionResource).CheckMixedRealityNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -237,6 +246,10 @@ public static async Task> CheckMixe /// CheckNameAvailabilityLocal /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location in which uniqueness will be verified. @@ -245,9 +258,7 @@ public static async Task> CheckMixe /// is null. public static Response CheckMixedRealityNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, MixedRealityNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMixedRealityNameAvailability(location, content, cancellationToken); + return GetMockableMixedRealitySubscriptionResource(subscriptionResource).CheckMixedRealityNameAvailability(location, content, cancellationToken); } /// @@ -262,13 +273,17 @@ public static Response CheckMixedRealityName /// SpatialAnchorsAccounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSpatialAnchorsAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSpatialAnchorsAccountsAsync(cancellationToken); + return GetMockableMixedRealitySubscriptionResource(subscriptionResource).GetSpatialAnchorsAccountsAsync(cancellationToken); } /// @@ -283,13 +298,17 @@ public static AsyncPageable GetSpatialAnchorsAcco /// SpatialAnchorsAccounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSpatialAnchorsAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSpatialAnchorsAccounts(cancellationToken); + return GetMockableMixedRealitySubscriptionResource(subscriptionResource).GetSpatialAnchorsAccounts(cancellationToken); } /// @@ -304,13 +323,17 @@ public static Pageable GetSpatialAnchorsAccounts( /// RemoteRenderingAccounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRemoteRenderingAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRemoteRenderingAccountsAsync(cancellationToken); + return GetMockableMixedRealitySubscriptionResource(subscriptionResource).GetRemoteRenderingAccountsAsync(cancellationToken); } /// @@ -325,13 +348,17 @@ public static AsyncPageable GetRemoteRenderingAc /// RemoteRenderingAccounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRemoteRenderingAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRemoteRenderingAccounts(cancellationToken); + return GetMockableMixedRealitySubscriptionResource(subscriptionResource).GetRemoteRenderingAccounts(cancellationToken); } } } diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealityArmClient.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealityArmClient.cs new file mode 100644 index 0000000000000..8fde0d40478b8 --- /dev/null +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealityArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MixedReality; + +namespace Azure.ResourceManager.MixedReality.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMixedRealityArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMixedRealityArmClient() + { + } + + /// 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 MockableMixedRealityArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMixedRealityArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SpatialAnchorsAccountResource GetSpatialAnchorsAccountResource(ResourceIdentifier id) + { + SpatialAnchorsAccountResource.ValidateResourceId(id); + return new SpatialAnchorsAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RemoteRenderingAccountResource GetRemoteRenderingAccountResource(ResourceIdentifier id) + { + RemoteRenderingAccountResource.ValidateResourceId(id); + return new RemoteRenderingAccountResource(Client, id); + } + } +} diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealityResourceGroupResource.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealityResourceGroupResource.cs new file mode 100644 index 0000000000000..549f79ad2acbe --- /dev/null +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealityResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.MixedReality; + +namespace Azure.ResourceManager.MixedReality.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMixedRealityResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMixedRealityResourceGroupResource() + { + } + + /// 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 MockableMixedRealityResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SpatialAnchorsAccountResources in the ResourceGroupResource. + /// An object representing collection of SpatialAnchorsAccountResources and their operations over a SpatialAnchorsAccountResource. + public virtual SpatialAnchorsAccountCollection GetSpatialAnchorsAccounts() + { + return GetCachedClient(client => new SpatialAnchorsAccountCollection(client, Id)); + } + + /// + /// Retrieve a Spatial Anchors Account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName} + /// + /// + /// Operation Id + /// SpatialAnchorsAccounts_Get + /// + /// + /// + /// Name of an Mixed Reality Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSpatialAnchorsAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetSpatialAnchorsAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve a Spatial Anchors Account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName} + /// + /// + /// Operation Id + /// SpatialAnchorsAccounts_Get + /// + /// + /// + /// Name of an Mixed Reality Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSpatialAnchorsAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetSpatialAnchorsAccounts().Get(accountName, cancellationToken); + } + + /// Gets a collection of RemoteRenderingAccountResources in the ResourceGroupResource. + /// An object representing collection of RemoteRenderingAccountResources and their operations over a RemoteRenderingAccountResource. + public virtual RemoteRenderingAccountCollection GetRemoteRenderingAccounts() + { + return GetCachedClient(client => new RemoteRenderingAccountCollection(client, Id)); + } + + /// + /// Retrieve a Remote Rendering Account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName} + /// + /// + /// Operation Id + /// RemoteRenderingAccounts_Get + /// + /// + /// + /// Name of an Mixed Reality Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRemoteRenderingAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetRemoteRenderingAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve a Remote Rendering Account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName} + /// + /// + /// Operation Id + /// RemoteRenderingAccounts_Get + /// + /// + /// + /// Name of an Mixed Reality Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRemoteRenderingAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetRemoteRenderingAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealitySubscriptionResource.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealitySubscriptionResource.cs new file mode 100644 index 0000000000000..0db11f4d46755 --- /dev/null +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MockableMixedRealitySubscriptionResource.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.MixedReality; +using Azure.ResourceManager.MixedReality.Models; + +namespace Azure.ResourceManager.MixedReality.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMixedRealitySubscriptionResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private MixedRealityRestOperations _defaultRestClient; + private ClientDiagnostics _spatialAnchorsAccountClientDiagnostics; + private SpatialAnchorsAccountsRestOperations _spatialAnchorsAccountRestClient; + private ClientDiagnostics _remoteRenderingAccountClientDiagnostics; + private RemoteRenderingAccountsRestOperations _remoteRenderingAccountRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMixedRealitySubscriptionResource() + { + } + + /// 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 MockableMixedRealitySubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MixedReality", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MixedRealityRestOperations DefaultRestClient => _defaultRestClient ??= new MixedRealityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SpatialAnchorsAccountClientDiagnostics => _spatialAnchorsAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MixedReality", SpatialAnchorsAccountResource.ResourceType.Namespace, Diagnostics); + private SpatialAnchorsAccountsRestOperations SpatialAnchorsAccountRestClient => _spatialAnchorsAccountRestClient ??= new SpatialAnchorsAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SpatialAnchorsAccountResource.ResourceType)); + private ClientDiagnostics RemoteRenderingAccountClientDiagnostics => _remoteRenderingAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MixedReality", RemoteRenderingAccountResource.ResourceType.Namespace, Diagnostics); + private RemoteRenderingAccountsRestOperations RemoteRenderingAccountRestClient => _remoteRenderingAccountRestClient ??= new RemoteRenderingAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RemoteRenderingAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Check Name Availability for local uniqueness + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailabilityLocal + /// + /// + /// + /// The location in which uniqueness will be verified. + /// Check Name Availability Request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckMixedRealityNameAvailabilityAsync(AzureLocation location, MixedRealityNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableMixedRealitySubscriptionResource.CheckMixedRealityNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckNameAvailabilityLocalAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check Name Availability for local uniqueness + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailabilityLocal + /// + /// + /// + /// The location in which uniqueness will be verified. + /// Check Name Availability Request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckMixedRealityNameAvailability(AzureLocation location, MixedRealityNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableMixedRealitySubscriptionResource.CheckMixedRealityNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckNameAvailabilityLocal(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Spatial Anchors Accounts by Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts + /// + /// + /// Operation Id + /// SpatialAnchorsAccounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSpatialAnchorsAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SpatialAnchorsAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SpatialAnchorsAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SpatialAnchorsAccountResource(Client, SpatialAnchorsAccountData.DeserializeSpatialAnchorsAccountData(e)), SpatialAnchorsAccountClientDiagnostics, Pipeline, "MockableMixedRealitySubscriptionResource.GetSpatialAnchorsAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// List Spatial Anchors Accounts by Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts + /// + /// + /// Operation Id + /// SpatialAnchorsAccounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSpatialAnchorsAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SpatialAnchorsAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SpatialAnchorsAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SpatialAnchorsAccountResource(Client, SpatialAnchorsAccountData.DeserializeSpatialAnchorsAccountData(e)), SpatialAnchorsAccountClientDiagnostics, Pipeline, "MockableMixedRealitySubscriptionResource.GetSpatialAnchorsAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// List Remote Rendering Accounts by Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts + /// + /// + /// Operation Id + /// RemoteRenderingAccounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRemoteRenderingAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RemoteRenderingAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RemoteRenderingAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RemoteRenderingAccountResource(Client, RemoteRenderingAccountData.DeserializeRemoteRenderingAccountData(e)), RemoteRenderingAccountClientDiagnostics, Pipeline, "MockableMixedRealitySubscriptionResource.GetRemoteRenderingAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// List Remote Rendering Accounts by Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts + /// + /// + /// Operation Id + /// RemoteRenderingAccounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRemoteRenderingAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RemoteRenderingAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RemoteRenderingAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RemoteRenderingAccountResource(Client, RemoteRenderingAccountData.DeserializeRemoteRenderingAccountData(e)), RemoteRenderingAccountClientDiagnostics, Pipeline, "MockableMixedRealitySubscriptionResource.GetRemoteRenderingAccounts", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 19e16f03c0733..0000000000000 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MixedReality -{ - /// 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 SpatialAnchorsAccountResources in the ResourceGroupResource. - /// An object representing collection of SpatialAnchorsAccountResources and their operations over a SpatialAnchorsAccountResource. - public virtual SpatialAnchorsAccountCollection GetSpatialAnchorsAccounts() - { - return GetCachedClient(Client => new SpatialAnchorsAccountCollection(Client, Id)); - } - - /// Gets a collection of RemoteRenderingAccountResources in the ResourceGroupResource. - /// An object representing collection of RemoteRenderingAccountResources and their operations over a RemoteRenderingAccountResource. - public virtual RemoteRenderingAccountCollection GetRemoteRenderingAccounts() - { - return GetCachedClient(Client => new RemoteRenderingAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index bfec960a9a2be..0000000000000 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.MixedReality.Models; - -namespace Azure.ResourceManager.MixedReality -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private MixedRealityRestOperations _defaultRestClient; - private ClientDiagnostics _spatialAnchorsAccountClientDiagnostics; - private SpatialAnchorsAccountsRestOperations _spatialAnchorsAccountRestClient; - private ClientDiagnostics _remoteRenderingAccountClientDiagnostics; - private RemoteRenderingAccountsRestOperations _remoteRenderingAccountRestClient; - - /// 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 DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MixedReality", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MixedRealityRestOperations DefaultRestClient => _defaultRestClient ??= new MixedRealityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SpatialAnchorsAccountClientDiagnostics => _spatialAnchorsAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MixedReality", SpatialAnchorsAccountResource.ResourceType.Namespace, Diagnostics); - private SpatialAnchorsAccountsRestOperations SpatialAnchorsAccountRestClient => _spatialAnchorsAccountRestClient ??= new SpatialAnchorsAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SpatialAnchorsAccountResource.ResourceType)); - private ClientDiagnostics RemoteRenderingAccountClientDiagnostics => _remoteRenderingAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MixedReality", RemoteRenderingAccountResource.ResourceType.Namespace, Diagnostics); - private RemoteRenderingAccountsRestOperations RemoteRenderingAccountRestClient => _remoteRenderingAccountRestClient ??= new RemoteRenderingAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RemoteRenderingAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Check Name Availability for local uniqueness - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailabilityLocal - /// - /// - /// - /// The location in which uniqueness will be verified. - /// Check Name Availability Request. - /// The cancellation token to use. - public virtual async Task> CheckMixedRealityNameAvailabilityAsync(AzureLocation location, MixedRealityNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMixedRealityNameAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckNameAvailabilityLocalAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check Name Availability for local uniqueness - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailabilityLocal - /// - /// - /// - /// The location in which uniqueness will be verified. - /// Check Name Availability Request. - /// The cancellation token to use. - public virtual Response CheckMixedRealityNameAvailability(AzureLocation location, MixedRealityNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMixedRealityNameAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckNameAvailabilityLocal(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List Spatial Anchors Accounts by Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts - /// - /// - /// Operation Id - /// SpatialAnchorsAccounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSpatialAnchorsAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SpatialAnchorsAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SpatialAnchorsAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SpatialAnchorsAccountResource(Client, SpatialAnchorsAccountData.DeserializeSpatialAnchorsAccountData(e)), SpatialAnchorsAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSpatialAnchorsAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List Spatial Anchors Accounts by Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts - /// - /// - /// Operation Id - /// SpatialAnchorsAccounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSpatialAnchorsAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SpatialAnchorsAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SpatialAnchorsAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SpatialAnchorsAccountResource(Client, SpatialAnchorsAccountData.DeserializeSpatialAnchorsAccountData(e)), SpatialAnchorsAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSpatialAnchorsAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List Remote Rendering Accounts by Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts - /// - /// - /// Operation Id - /// RemoteRenderingAccounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRemoteRenderingAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RemoteRenderingAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RemoteRenderingAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RemoteRenderingAccountResource(Client, RemoteRenderingAccountData.DeserializeRemoteRenderingAccountData(e)), RemoteRenderingAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRemoteRenderingAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List Remote Rendering Accounts by Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts - /// - /// - /// Operation Id - /// RemoteRenderingAccounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRemoteRenderingAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RemoteRenderingAccountRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RemoteRenderingAccountRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RemoteRenderingAccountResource(Client, RemoteRenderingAccountData.DeserializeRemoteRenderingAccountData(e)), RemoteRenderingAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRemoteRenderingAccounts", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/RemoteRenderingAccountResource.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/RemoteRenderingAccountResource.cs index e80f9ef2c157f..548ee1a9c5859 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/RemoteRenderingAccountResource.cs +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/RemoteRenderingAccountResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.MixedReality public partial class RemoteRenderingAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}"; diff --git a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/SpatialAnchorsAccountResource.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/SpatialAnchorsAccountResource.cs index 16cc9512e3bfe..b2854da52ba72 100644 --- a/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/SpatialAnchorsAccountResource.cs +++ b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/SpatialAnchorsAccountResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.MixedReality public partial class SpatialAnchorsAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/CHANGELOG.md b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/CHANGELOG.md index 37417f48eef88..5027c646aee4b 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/CHANGELOG.md +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.2.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,12 @@ ### Other Changes +## 1.1.0 (2023-11-01) + +### Features Added + +- Updated api-version to `2023-09-01`. + ## 1.0.0 (2023-09-05) This package is the first stable release of the Azure Mobile Network management library. diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/api/Azure.ResourceManager.MobileNetwork.netstandard2.0.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/api/Azure.ResourceManager.MobileNetwork.netstandard2.0.cs index e9a8383898ac3..29fc3e3afd172 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/api/Azure.ResourceManager.MobileNetwork.netstandard2.0.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/api/Azure.ResourceManager.MobileNetwork.netstandard2.0.cs @@ -19,7 +19,7 @@ protected MobileAttachedDataNetworkCollection() { } } public partial class MobileAttachedDataNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public MobileAttachedDataNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties userPlaneDataInterface, System.Collections.Generic.IEnumerable dnsAddresses) : base (default(Azure.Core.AzureLocation)) { } + public MobileAttachedDataNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties userPlaneDataInterface, System.Collections.Generic.IEnumerable dnsAddresses) { } public System.Collections.Generic.IList DnsAddresses { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.NaptConfiguration NaptConfiguration { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } @@ -66,7 +66,7 @@ protected MobileDataNetworkCollection() { } } public partial class MobileDataNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public MobileDataNetworkData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MobileDataNetworkData(Azure.Core.AzureLocation location) { } public string Description { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } } @@ -109,7 +109,7 @@ protected MobileNetworkCollection() { } } public partial class MobileNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public MobileNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlmnId publicLandMobileNetworkIdentifier) : base (default(Azure.Core.AzureLocation)) { } + public MobileNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlmnId publicLandMobileNetworkIdentifier) { } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlmnId PublicLandMobileNetworkIdentifier { get { throw null; } set { } } public string ServiceKey { get { throw null; } } @@ -214,6 +214,7 @@ public MobileNetworkPacketCaptureData() { } public long? BytesToCapturePerPacket { get { throw null; } set { } } public System.DateTimeOffset? CaptureStartOn { get { throw null; } } public System.Collections.Generic.IList NetworkInterfaces { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OutputFiles { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } public string Reason { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPacketCaptureStatus? Status { get { throw null; } } @@ -290,7 +291,7 @@ protected MobileNetworkServiceCollection() { } } public partial class MobileNetworkServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public MobileNetworkServiceData(Azure.Core.AzureLocation location, int servicePrecedence, System.Collections.Generic.IEnumerable pccRules) : base (default(Azure.Core.AzureLocation)) { } + public MobileNetworkServiceData(Azure.Core.AzureLocation location, int servicePrecedence, System.Collections.Generic.IEnumerable pccRules) { } public System.Collections.Generic.IList PccRules { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } public int ServicePrecedence { get { throw null; } set { } } @@ -368,7 +369,7 @@ protected MobileNetworkSimGroupCollection() { } } public partial class MobileNetworkSimGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public MobileNetworkSimGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MobileNetworkSimGroupData(Azure.Core.AzureLocation location) { } public System.Uri KeyUri { get { throw null; } set { } } public Azure.Core.ResourceIdentifier MobileNetworkId { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } @@ -422,7 +423,7 @@ protected MobileNetworkSimPolicyCollection() { } } public partial class MobileNetworkSimPolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public MobileNetworkSimPolicyData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.Ambr ueAmbr, Azure.ResourceManager.Resources.Models.WritableSubResource defaultSlice, System.Collections.Generic.IEnumerable sliceConfigurations) : base (default(Azure.Core.AzureLocation)) { } + public MobileNetworkSimPolicyData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.Ambr ueAmbr, Azure.ResourceManager.Resources.Models.WritableSubResource defaultSlice, System.Collections.Generic.IEnumerable sliceConfigurations) { } public Azure.Core.ResourceIdentifier DefaultSliceId { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } public int? RegistrationTimer { get { throw null; } set { } } @@ -484,7 +485,7 @@ protected MobileNetworkSiteCollection() { } } public partial class MobileNetworkSiteData : Azure.ResourceManager.Models.TrackedResourceData { - public MobileNetworkSiteData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MobileNetworkSiteData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList NetworkFunctions { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } } @@ -529,7 +530,7 @@ protected MobileNetworkSliceCollection() { } } public partial class MobileNetworkSliceData : Azure.ResourceManager.Models.TrackedResourceData { - public MobileNetworkSliceData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.Snssai snssai) : base (default(Azure.Core.AzureLocation)) { } + public MobileNetworkSliceData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.Snssai snssai) { } public string Description { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.Snssai Snssai { get { throw null; } set { } } @@ -573,14 +574,17 @@ protected PacketCoreControlPlaneCollection() { } } public partial class PacketCoreControlPlaneData : Azure.ResourceManager.Models.TrackedResourceData { - public PacketCoreControlPlaneData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable sites, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformConfiguration platform, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties controlPlaneAccessInterface, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkBillingSku sku, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess) : base (default(Azure.Core.AzureLocation)) { } + public PacketCoreControlPlaneData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable sites, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformConfiguration platform, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties controlPlaneAccessInterface, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkBillingSku sku, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess) { } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties ControlPlaneAccessInterface { get { throw null; } set { } } + public System.Collections.Generic.IList ControlPlaneAccessVirtualIPv4Addresses { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkCoreNetworkType? CoreNetworkTechnology { get { throw null; } set { } } public System.Uri DiagnosticsUploadStorageAccountContainerUri { get { throw null; } set { } } + public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkEventHubConfiguration EventHub { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallation Installation { get { throw null; } set { } } public string InstalledVersion { get { throw null; } } public System.BinaryData InteropSettings { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkLocalDiagnosticsAccessConfiguration LocalDiagnosticsAccess { get { throw null; } set { } } + public int? NasRerouteMacroMmeGroupId { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformConfiguration Platform { get { throw null; } set { } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } public string RollbackVersion { get { throw null; } } @@ -650,9 +654,10 @@ protected PacketCoreDataPlaneCollection() { } } public partial class PacketCoreDataPlaneData : Azure.ResourceManager.Models.TrackedResourceData { - public PacketCoreDataPlaneData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties userPlaneAccessInterface) : base (default(Azure.Core.AzureLocation)) { } + public PacketCoreDataPlaneData(Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties userPlaneAccessInterface) { } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties UserPlaneAccessInterface { get { throw null; } set { } } + public System.Collections.Generic.IList UserPlaneAccessVirtualIPv4Addresses { get { throw null; } } } public partial class PacketCoreDataPlaneResource : Azure.ResourceManager.ArmResource { @@ -728,6 +733,61 @@ protected TenantPacketCoreControlPlaneVersionResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.MobileNetwork.Mocking +{ + public partial class MockableMobileNetworkArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMobileNetworkArmClient() { } + public virtual Azure.ResourceManager.MobileNetwork.MobileAttachedDataNetworkResource GetMobileAttachedDataNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileDataNetworkResource GetMobileDataNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkDiagnosticsPackageResource GetMobileNetworkDiagnosticsPackageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkPacketCaptureResource GetMobileNetworkPacketCaptureResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkResource GetMobileNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkServiceResource GetMobileNetworkServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkSimGroupResource GetMobileNetworkSimGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkSimPolicyResource GetMobileNetworkSimPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkSimResource GetMobileNetworkSimResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkSiteResource GetMobileNetworkSiteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkSliceResource GetMobileNetworkSliceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.PacketCoreControlPlaneResource GetPacketCoreControlPlaneResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.PacketCoreDataPlaneResource GetPacketCoreDataPlaneResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.SubscriptionPacketCoreControlPlaneVersionResource GetSubscriptionPacketCoreControlPlaneVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.TenantPacketCoreControlPlaneVersionResource GetTenantPacketCoreControlPlaneVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMobileNetworkResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMobileNetworkResourceGroupResource() { } + public virtual Azure.Response GetMobileNetwork(string mobileNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMobileNetworkAsync(string mobileNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkCollection GetMobileNetworks() { throw null; } + public virtual Azure.Response GetMobileNetworkSimGroup(string simGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMobileNetworkSimGroupAsync(string simGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.MobileNetworkSimGroupCollection GetMobileNetworkSimGroups() { throw null; } + public virtual Azure.Response GetPacketCoreControlPlane(string packetCoreControlPlaneName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPacketCoreControlPlaneAsync(string packetCoreControlPlaneName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.PacketCoreControlPlaneCollection GetPacketCoreControlPlanes() { throw null; } + } + public partial class MockableMobileNetworkSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMobileNetworkSubscriptionResource() { } + public virtual Azure.Pageable GetMobileNetworks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMobileNetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMobileNetworkSimGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMobileNetworkSimGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPacketCoreControlPlanes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPacketCoreControlPlanesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSubscriptionPacketCoreControlPlaneVersion(string versionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionPacketCoreControlPlaneVersionAsync(string versionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.SubscriptionPacketCoreControlPlaneVersionCollection GetSubscriptionPacketCoreControlPlaneVersions() { throw null; } + } + public partial class MockableMobileNetworkTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableMobileNetworkTenantResource() { } + public virtual Azure.Response GetTenantPacketCoreControlPlaneVersion(string versionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTenantPacketCoreControlPlaneVersionAsync(string versionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MobileNetwork.TenantPacketCoreControlPlaneVersionCollection GetTenantPacketCoreControlPlaneVersions() { throw null; } + } +} namespace Azure.ResourceManager.MobileNetwork.Models { public partial class Ambr @@ -746,7 +806,9 @@ public static partial class ArmMobileNetworkModelFactory public static Azure.ResourceManager.MobileNetwork.MobileNetworkDiagnosticsPackageData MobileNetworkDiagnosticsPackageData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkDiagnosticsPackageStatus? status = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkDiagnosticsPackageStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkHttpsServerCertificate MobileNetworkHttpsServerCertificate(System.Uri certificateUri = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkCertificateProvisioning provisioning = null) { throw null; } public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallation MobileNetworkInstallation(Azure.ResourceManager.MobileNetwork.Models.DesiredInstallationState? desiredState = default(Azure.ResourceManager.MobileNetwork.Models.DesiredInstallationState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationState? state = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkReinstallRequired? reinstallRequired = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkReinstallRequired?), System.Collections.Generic.IEnumerable reasons = null, Azure.Core.ResourceIdentifier operationId = null) { throw null; } - public static Azure.ResourceManager.MobileNetwork.MobileNetworkPacketCaptureData MobileNetworkPacketCaptureData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPacketCaptureStatus? status = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPacketCaptureStatus?), string reason = null, System.DateTimeOffset? captureStartOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable networkInterfaces = null, long? bytesToCapturePerPacket = default(long?), long? totalBytesPerSession = default(long?), int? timeLimitInSeconds = default(int?)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public static Azure.ResourceManager.MobileNetwork.MobileNetworkPacketCaptureData MobileNetworkPacketCaptureData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPacketCaptureStatus? status, string reason, System.DateTimeOffset? captureStartOn, System.Collections.Generic.IEnumerable networkInterfaces, long? bytesToCapturePerPacket, long? totalBytesPerSession, int? timeLimitInSeconds) { throw null; } + public static Azure.ResourceManager.MobileNetwork.MobileNetworkPacketCaptureData MobileNetworkPacketCaptureData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPacketCaptureStatus? status = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPacketCaptureStatus?), string reason = null, System.DateTimeOffset? captureStartOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable networkInterfaces = null, long? bytesToCapturePerPacket = default(long?), long? totalBytesPerSession = default(long?), int? timeLimitInSeconds = default(int?), System.Collections.Generic.IEnumerable outputFiles = null) { throw null; } public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformConfiguration MobileNetworkPlatformConfiguration(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformType platformType = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformType), Azure.Core.ResourceIdentifier azureStackEdgeDeviceId = null, System.Collections.Generic.IEnumerable azureStackEdgeDevices = null, Azure.Core.ResourceIdentifier azureStackHciClusterId = null, Azure.Core.ResourceIdentifier connectedClusterId = null, Azure.Core.ResourceIdentifier customLocationId = null) { throw null; } public static Azure.ResourceManager.MobileNetwork.MobileNetworkServiceData MobileNetworkServiceData(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.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), int servicePrecedence = 0, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkQosPolicy serviceQosPolicy = null, System.Collections.Generic.IEnumerable pccRules = null) { throw null; } public static Azure.ResourceManager.MobileNetwork.MobileNetworkSimData MobileNetworkSimData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkSimState? simState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkSimState?), System.Collections.Generic.IReadOnlyDictionary siteProvisioningState = null, string internationalMobileSubscriberIdentity = null, string integratedCircuitCardIdentifier = null, string deviceType = null, Azure.Core.ResourceIdentifier simPolicyId = null, System.Collections.Generic.IEnumerable staticIPConfiguration = null, string vendorName = null, string vendorKeyFingerprint = null, string authenticationKey = null, string operatorKeyCode = null) { throw null; } @@ -754,9 +816,13 @@ public static partial class ArmMobileNetworkModelFactory public static Azure.ResourceManager.MobileNetwork.MobileNetworkSimPolicyData MobileNetworkSimPolicyData(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.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), System.Collections.Generic.IReadOnlyDictionary siteProvisioningState = null, Azure.ResourceManager.MobileNetwork.Models.Ambr ueAmbr = null, Azure.Core.ResourceIdentifier defaultSliceId = null, int? rfspIndex = default(int?), int? registrationTimer = default(int?), System.Collections.Generic.IEnumerable sliceConfigurations = null) { throw null; } public static Azure.ResourceManager.MobileNetwork.MobileNetworkSiteData MobileNetworkSiteData(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.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), System.Collections.Generic.IEnumerable networkFunctions = null) { throw null; } public static Azure.ResourceManager.MobileNetwork.MobileNetworkSliceData MobileNetworkSliceData(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.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.Snssai snssai = null, string description = null) { throw null; } - public static Azure.ResourceManager.MobileNetwork.PacketCoreControlPlaneData PacketCoreControlPlaneData(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.MobileNetwork.Models.MobileNetworkManagedServiceIdentity userAssignedIdentity = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallation installation = null, System.Collections.Generic.IEnumerable sites = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformConfiguration platform = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkCoreNetworkType? coreNetworkTechnology = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkCoreNetworkType?), string version = null, string installedVersion = null, string rollbackVersion = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties controlPlaneAccessInterface = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkBillingSku sku = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkBillingSku), int? ueMtu = default(int?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess = null, System.Uri diagnosticsUploadStorageAccountContainerUri = null, System.BinaryData interopSettings = null) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public static Azure.ResourceManager.MobileNetwork.PacketCoreControlPlaneData PacketCoreControlPlaneData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, System.Collections.Generic.IDictionary tags, Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkManagedServiceIdentity userAssignedIdentity, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallation installation, System.Collections.Generic.IEnumerable sites, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformConfiguration platform, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkCoreNetworkType? coreNetworkTechnology, string version, string installedVersion, string rollbackVersion, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties controlPlaneAccessInterface, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkBillingSku sku, int? ueMtu, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess, System.Uri diagnosticsUploadStorageAccountContainerUri, System.BinaryData interopSettings) { throw null; } + public static Azure.ResourceManager.MobileNetwork.PacketCoreControlPlaneData PacketCoreControlPlaneData(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.MobileNetwork.Models.MobileNetworkManagedServiceIdentity userAssignedIdentity = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallation installation = null, System.Collections.Generic.IEnumerable sites = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkPlatformConfiguration platform = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkCoreNetworkType? coreNetworkTechnology = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkCoreNetworkType?), string version = null, string installedVersion = null, string rollbackVersion = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties controlPlaneAccessInterface = null, System.Collections.Generic.IEnumerable controlPlaneAccessVirtualIPv4Addresses = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkBillingSku sku = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkBillingSku), int? ueMtu = default(int?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess = null, System.Uri diagnosticsUploadStorageAccountContainerUri = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkEventHubConfiguration eventHub = null, int? nasRerouteMacroMmeGroupId = default(int?), System.BinaryData interopSettings = null) { throw null; } public static Azure.ResourceManager.MobileNetwork.PacketCoreControlPlaneVersionData PacketCoreControlPlaneVersionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), System.Collections.Generic.IEnumerable platforms = null) { throw null; } - public static Azure.ResourceManager.MobileNetwork.PacketCoreDataPlaneData PacketCoreDataPlaneData(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.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties userPlaneAccessInterface = null) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public static Azure.ResourceManager.MobileNetwork.PacketCoreDataPlaneData PacketCoreDataPlaneData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, System.Collections.Generic.IDictionary tags, Azure.Core.AzureLocation location, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties userPlaneAccessInterface) { throw null; } + public static Azure.ResourceManager.MobileNetwork.PacketCoreDataPlaneData PacketCoreDataPlaneData(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.MobileNetwork.Models.MobileNetworkProvisioningState? provisioningState = default(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkProvisioningState?), Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInterfaceProperties userPlaneAccessInterface = null, System.Collections.Generic.IEnumerable userPlaneAccessVirtualIPv4Addresses = null) { throw null; } } public partial class AsyncOperationStatus { @@ -903,6 +969,12 @@ public enum MobileNetworkCoreNetworkType public static bool operator !=(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkDiagnosticsPackageStatus left, Azure.ResourceManager.MobileNetwork.Models.MobileNetworkDiagnosticsPackageStatus right) { throw null; } public override string ToString() { throw null; } } + public partial class MobileNetworkEventHubConfiguration + { + public MobileNetworkEventHubConfiguration(Azure.Core.ResourceIdentifier id) { } + public Azure.Core.ResourceIdentifier Id { get { throw null; } set { } } + public int? ReportingInterval { get { throw null; } set { } } + } public partial class MobileNetworkHttpsServerCertificate { public MobileNetworkHttpsServerCertificate(System.Uri certificateUri) { } @@ -924,9 +996,15 @@ public MobileNetworkInstallation() { } private readonly object _dummy; private readonly int _dummyPrimitive; public MobileNetworkInstallationReason(string value) { throw null; } + public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason ControlPlaneAccessInterfaceHasChanged { get { throw null; } } + public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason ControlPlaneAccessVirtualIPv4AddressesHasChanged { get { throw null; } } public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason NoAttachedDataNetworks { get { throw null; } } public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason NoPacketCoreDataPlane { get { throw null; } } public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason NoSlices { get { throw null; } } + public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason PublicLandMobileNetworkIdentifierHasChanged { get { throw null; } } + public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason UserPlaneAccessInterfaceHasChanged { get { throw null; } } + public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason UserPlaneAccessVirtualIPv4AddressesHasChanged { get { throw null; } } + public static Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason UserPlaneDataInterfaceHasChanged { get { throw null; } } public bool Equals(Azure.ResourceManager.MobileNetwork.Models.MobileNetworkInstallationReason other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Azure.ResourceManager.MobileNetwork.csproj b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Azure.ResourceManager.MobileNetwork.csproj index 50a92e6632807..298f128940d03 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Azure.ResourceManager.MobileNetwork.csproj +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Azure.ResourceManager.MobileNetwork.csproj @@ -1,8 +1,8 @@ - 1.1.0-beta.1 + 1.2.0-beta.1 - 1.0.0 + 1.1.0 Azure.ResourceManager.MobileNetwork Azure Resource Manager client SDK for Azure resource provider MobileNetwork. azure;management;arm;resource manager;mobilenetwork diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Custom/ArmMobileNetworkModelFactory.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Custom/ArmMobileNetworkModelFactory.cs new file mode 100644 index 0000000000000..4a1d2f65cb50a --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Custom/ArmMobileNetworkModelFactory.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.MobileNetwork.Models +{ + public static partial class ArmMobileNetworkModelFactory + { + /// Initializes a new instance of MobileNetworkPacketCaptureData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The provisioning state of the packet capture session resource. + /// The status of the packet capture session. + /// The reason the current packet capture session state. + /// The start time of the packet capture session. + /// List of network interfaces to capture on. + /// Number of bytes captured per packet, the remaining bytes are truncated. The default "0" means the entire packet is captured. + /// Maximum size of the capture output. + /// Maximum duration of the capture session in seconds. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static MobileNetworkPacketCaptureData MobileNetworkPacketCaptureData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MobileNetworkProvisioningState? provisioningState, MobileNetworkPacketCaptureStatus? status, string reason, DateTimeOffset? captureStartOn, IEnumerable networkInterfaces, long? bytesToCapturePerPacket, long? totalBytesPerSession, int? timeLimitInSeconds) + => MobileNetworkPacketCaptureData(id, name, resourceType, systemData, provisioningState, status, reason, captureStartOn, networkInterfaces, bytesToCapturePerPacket, totalBytesPerSession, timeLimitInSeconds, outputFiles: default); + + /// Initializes a new instance of PacketCoreControlPlaneData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The identity used to retrieve the ingress certificate from Azure key vault. + /// The provisioning state of the packet core control plane resource. + /// The installation state of the packet core control plane resource. + /// Site(s) under which this packet core control plane should be deployed. The sites must be in the same location as the packet core control plane. + /// The platform where the packet core is deployed. + /// The core network technology generation (5G core or EPC / 4G core). + /// The desired version of the packet core software. + /// The currently installed version of the packet core software. + /// The previous version of the packet core software that was deployed. Used when performing the rollback action. + /// The control plane interface on the access network. For 5G networks, this is the N2 interface. For 4G networks, this is the S1-MME interface. + /// The SKU defining the throughput and SIM allowances for this packet core control plane deployment. + /// The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links for all data networks. The MTU set on the user plane access link is calculated to be 60 bytes greater than this value to allow for GTP encapsulation. + /// The kubernetes ingress configuration to control access to packet core diagnostics over local APIs. + /// Configuration for uploading packet core diagnostics. + /// Settings to allow interoperability with third party components e.g. RANs and UEs. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PacketCoreControlPlaneData PacketCoreControlPlaneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MobileNetworkManagedServiceIdentity userAssignedIdentity, MobileNetworkProvisioningState? provisioningState, MobileNetworkInstallation installation, IEnumerable sites, MobileNetworkPlatformConfiguration platform, MobileNetworkCoreNetworkType? coreNetworkTechnology, string version, string installedVersion, string rollbackVersion, MobileNetworkInterfaceProperties controlPlaneAccessInterface, MobileNetworkBillingSku sku, int? ueMtu, MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess, Uri diagnosticsUploadStorageAccountContainerUri, BinaryData interopSettings) + => PacketCoreControlPlaneData(id, name, resourceType, systemData, tags, location, userAssignedIdentity, provisioningState, installation, sites, platform, coreNetworkTechnology, version, installedVersion, rollbackVersion, controlPlaneAccessInterface, controlPlaneAccessVirtualIPv4Addresses: default, sku, ueMtu, localDiagnosticsAccess, diagnosticsUploadStorageAccountContainerUri, eventHub: default, nasRerouteMacroMmeGroupId: default, interopSettings); + + /// Initializes a new instance of PacketCoreDataPlaneData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The provisioning state of the packet core data plane resource. + /// The user plane interface on the access network. For 5G networks, this is the N3 interface. For 4G networks, this is the S1-U interface. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static PacketCoreDataPlaneData PacketCoreDataPlaneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MobileNetworkProvisioningState? provisioningState, MobileNetworkInterfaceProperties userPlaneAccessInterface) + => PacketCoreDataPlaneData(id, name, resourceType, systemData, tags, location, provisioningState, userPlaneAccessInterface, userPlaneAccessVirtualIPv4Addresses: default); + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/ArmMobileNetworkModelFactory.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/ArmMobileNetworkModelFactory.cs index aa1cf2ceddb3a..4bd7e9a540387 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/ArmMobileNetworkModelFactory.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/ArmMobileNetworkModelFactory.cs @@ -116,12 +116,14 @@ public static MobileNetworkData MobileNetworkData(ResourceIdentifier id = null, /// Number of bytes captured per packet, the remaining bytes are truncated. The default "0" means the entire packet is captured. /// Maximum size of the capture output. /// Maximum duration of the capture session in seconds. + /// The list of output files of a packet capture session. /// A new instance for mocking. - public static MobileNetworkPacketCaptureData MobileNetworkPacketCaptureData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MobileNetworkProvisioningState? provisioningState = null, MobileNetworkPacketCaptureStatus? status = null, string reason = null, DateTimeOffset? captureStartOn = null, IEnumerable networkInterfaces = null, long? bytesToCapturePerPacket = null, long? totalBytesPerSession = null, int? timeLimitInSeconds = null) + public static MobileNetworkPacketCaptureData MobileNetworkPacketCaptureData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MobileNetworkProvisioningState? provisioningState = null, MobileNetworkPacketCaptureStatus? status = null, string reason = null, DateTimeOffset? captureStartOn = null, IEnumerable networkInterfaces = null, long? bytesToCapturePerPacket = null, long? totalBytesPerSession = null, int? timeLimitInSeconds = null, IEnumerable outputFiles = null) { networkInterfaces ??= new List(); + outputFiles ??= new List(); - return new MobileNetworkPacketCaptureData(id, name, resourceType, systemData, provisioningState, status, reason, captureStartOn, networkInterfaces?.ToList(), bytesToCapturePerPacket, totalBytesPerSession, timeLimitInSeconds); + return new MobileNetworkPacketCaptureData(id, name, resourceType, systemData, provisioningState, status, reason, captureStartOn, networkInterfaces?.ToList(), bytesToCapturePerPacket, totalBytesPerSession, timeLimitInSeconds, outputFiles?.ToList()); } /// Initializes a new instance of AsyncOperationStatus. @@ -157,18 +159,22 @@ public static AsyncOperationStatus AsyncOperationStatus(string id = null, string /// The currently installed version of the packet core software. /// The previous version of the packet core software that was deployed. Used when performing the rollback action. /// The control plane interface on the access network. For 5G networks, this is the N2 interface. For 4G networks, this is the S1-MME interface. + /// The virtual IP address(es) for the control plane on the access network in a High Availability (HA) system. In an HA deployment the access network router should be configured to anycast traffic for this address to the control plane access interfaces on the active and standby nodes. In non-HA system this list should be omitted or empty. /// The SKU defining the throughput and SIM allowances for this packet core control plane deployment. /// The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links for all data networks. The MTU set on the user plane access link is calculated to be 60 bytes greater than this value to allow for GTP encapsulation. /// The kubernetes ingress configuration to control access to packet core diagnostics over local APIs. /// Configuration for uploading packet core diagnostics. + /// Configuration for sending packet core events to an Azure Event Hub. + /// Signaling configuration for the packet core. /// Settings to allow interoperability with third party components e.g. RANs and UEs. /// A new instance for mocking. - public static PacketCoreControlPlaneData PacketCoreControlPlaneData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, MobileNetworkManagedServiceIdentity userAssignedIdentity = null, MobileNetworkProvisioningState? provisioningState = null, MobileNetworkInstallation installation = null, IEnumerable sites = null, MobileNetworkPlatformConfiguration platform = null, MobileNetworkCoreNetworkType? coreNetworkTechnology = null, string version = null, string installedVersion = null, string rollbackVersion = null, MobileNetworkInterfaceProperties controlPlaneAccessInterface = null, MobileNetworkBillingSku sku = default, int? ueMtu = null, MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess = null, Uri diagnosticsUploadStorageAccountContainerUri = null, BinaryData interopSettings = null) + public static PacketCoreControlPlaneData PacketCoreControlPlaneData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, MobileNetworkManagedServiceIdentity userAssignedIdentity = null, MobileNetworkProvisioningState? provisioningState = null, MobileNetworkInstallation installation = null, IEnumerable sites = null, MobileNetworkPlatformConfiguration platform = null, MobileNetworkCoreNetworkType? coreNetworkTechnology = null, string version = null, string installedVersion = null, string rollbackVersion = null, MobileNetworkInterfaceProperties controlPlaneAccessInterface = null, IEnumerable controlPlaneAccessVirtualIPv4Addresses = null, MobileNetworkBillingSku sku = default, int? ueMtu = null, MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess = null, Uri diagnosticsUploadStorageAccountContainerUri = null, MobileNetworkEventHubConfiguration eventHub = null, int? nasRerouteMacroMmeGroupId = null, BinaryData interopSettings = null) { tags ??= new Dictionary(); sites ??= new List(); + controlPlaneAccessVirtualIPv4Addresses ??= new List(); - return new PacketCoreControlPlaneData(id, name, resourceType, systemData, tags, location, userAssignedIdentity, provisioningState, installation, sites?.ToList(), platform, coreNetworkTechnology, version, installedVersion, rollbackVersion, controlPlaneAccessInterface, sku, ueMtu, localDiagnosticsAccess, diagnosticsUploadStorageAccountContainerUri != null ? new DiagnosticsUploadConfiguration(diagnosticsUploadStorageAccountContainerUri) : null, interopSettings); + return new PacketCoreControlPlaneData(id, name, resourceType, systemData, tags, location, userAssignedIdentity, provisioningState, installation, sites?.ToList(), platform, coreNetworkTechnology, version, installedVersion, rollbackVersion, controlPlaneAccessInterface, controlPlaneAccessVirtualIPv4Addresses?.ToList(), sku, ueMtu, localDiagnosticsAccess, diagnosticsUploadStorageAccountContainerUri != null ? new DiagnosticsUploadConfiguration(diagnosticsUploadStorageAccountContainerUri) : null, eventHub, nasRerouteMacroMmeGroupId.HasValue ? new SignalingConfiguration(new NASRerouteConfiguration(nasRerouteMacroMmeGroupId.Value)) : null, interopSettings); } /// Initializes a new instance of MobileNetworkInstallation. @@ -242,12 +248,14 @@ public static PacketCoreControlPlaneVersionData PacketCoreControlPlaneVersionDat /// The location. /// The provisioning state of the packet core data plane resource. /// The user plane interface on the access network. For 5G networks, this is the N3 interface. For 4G networks, this is the S1-U interface. + /// The virtual IP address(es) for the user plane on the access network in a High Availability (HA) system. In an HA deployment the access network router should be configured to forward traffic for this address to the control plane access interface on the active or standby node. In non-HA system this list should be omitted or empty. /// A new instance for mocking. - public static PacketCoreDataPlaneData PacketCoreDataPlaneData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, MobileNetworkProvisioningState? provisioningState = null, MobileNetworkInterfaceProperties userPlaneAccessInterface = null) + public static PacketCoreDataPlaneData PacketCoreDataPlaneData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, MobileNetworkProvisioningState? provisioningState = null, MobileNetworkInterfaceProperties userPlaneAccessInterface = null, IEnumerable userPlaneAccessVirtualIPv4Addresses = null) { tags ??= new Dictionary(); + userPlaneAccessVirtualIPv4Addresses ??= new List(); - return new PacketCoreDataPlaneData(id, name, resourceType, systemData, tags, location, provisioningState, userPlaneAccessInterface); + return new PacketCoreDataPlaneData(id, name, resourceType, systemData, tags, location, provisioningState, userPlaneAccessInterface, userPlaneAccessVirtualIPv4Addresses?.ToList()); } /// Initializes a new instance of MobileNetworkServiceData. diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MobileNetworkExtensions.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MobileNetworkExtensions.cs index 72039f51f1724..343e5fb1d8684 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MobileNetworkExtensions.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MobileNetworkExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.MobileNetwork.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.MobileNetwork @@ -18,344 +19,278 @@ namespace Azure.ResourceManager.MobileNetwork /// A class to add extension methods to Azure.ResourceManager.MobileNetwork. public static partial class MobileNetworkExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMobileNetworkArmClient GetMockableMobileNetworkArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMobileNetworkArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMobileNetworkResourceGroupResource GetMockableMobileNetworkResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMobileNetworkResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMobileNetworkSubscriptionResource GetMockableMobileNetworkSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMobileNetworkSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMobileNetworkTenantResource GetMockableMobileNetworkTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMobileNetworkTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region MobileAttachedDataNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileAttachedDataNetworkResource GetMobileAttachedDataNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileAttachedDataNetworkResource.ValidateResourceId(id); - return new MobileAttachedDataNetworkResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileAttachedDataNetworkResource(id); } - #endregion - #region MobileDataNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileDataNetworkResource GetMobileDataNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileDataNetworkResource.ValidateResourceId(id); - return new MobileDataNetworkResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileDataNetworkResource(id); } - #endregion - #region MobileNetworkDiagnosticsPackageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkDiagnosticsPackageResource GetMobileNetworkDiagnosticsPackageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkDiagnosticsPackageResource.ValidateResourceId(id); - return new MobileNetworkDiagnosticsPackageResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkDiagnosticsPackageResource(id); } - #endregion - #region MobileNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkResource GetMobileNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkResource.ValidateResourceId(id); - return new MobileNetworkResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkResource(id); } - #endregion - #region MobileNetworkPacketCaptureResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkPacketCaptureResource GetMobileNetworkPacketCaptureResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkPacketCaptureResource.ValidateResourceId(id); - return new MobileNetworkPacketCaptureResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkPacketCaptureResource(id); } - #endregion - #region PacketCoreControlPlaneResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PacketCoreControlPlaneResource GetPacketCoreControlPlaneResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PacketCoreControlPlaneResource.ValidateResourceId(id); - return new PacketCoreControlPlaneResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetPacketCoreControlPlaneResource(id); } - #endregion - #region TenantPacketCoreControlPlaneVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TenantPacketCoreControlPlaneVersionResource GetTenantPacketCoreControlPlaneVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TenantPacketCoreControlPlaneVersionResource.ValidateResourceId(id); - return new TenantPacketCoreControlPlaneVersionResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetTenantPacketCoreControlPlaneVersionResource(id); } - #endregion - #region SubscriptionPacketCoreControlPlaneVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubscriptionPacketCoreControlPlaneVersionResource GetSubscriptionPacketCoreControlPlaneVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionPacketCoreControlPlaneVersionResource.ValidateResourceId(id); - return new SubscriptionPacketCoreControlPlaneVersionResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetSubscriptionPacketCoreControlPlaneVersionResource(id); } - #endregion - #region PacketCoreDataPlaneResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PacketCoreDataPlaneResource GetPacketCoreDataPlaneResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PacketCoreDataPlaneResource.ValidateResourceId(id); - return new PacketCoreDataPlaneResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetPacketCoreDataPlaneResource(id); } - #endregion - #region MobileNetworkServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkServiceResource GetMobileNetworkServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkServiceResource.ValidateResourceId(id); - return new MobileNetworkServiceResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkServiceResource(id); } - #endregion - #region MobileNetworkSimResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkSimResource GetMobileNetworkSimResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkSimResource.ValidateResourceId(id); - return new MobileNetworkSimResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkSimResource(id); } - #endregion - #region MobileNetworkSimGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkSimGroupResource GetMobileNetworkSimGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkSimGroupResource.ValidateResourceId(id); - return new MobileNetworkSimGroupResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkSimGroupResource(id); } - #endregion - #region MobileNetworkSimPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkSimPolicyResource GetMobileNetworkSimPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkSimPolicyResource.ValidateResourceId(id); - return new MobileNetworkSimPolicyResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkSimPolicyResource(id); } - #endregion - #region MobileNetworkSiteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkSiteResource GetMobileNetworkSiteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkSiteResource.ValidateResourceId(id); - return new MobileNetworkSiteResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkSiteResource(id); } - #endregion - #region MobileNetworkSliceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MobileNetworkSliceResource GetMobileNetworkSliceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MobileNetworkSliceResource.ValidateResourceId(id); - return new MobileNetworkSliceResource(client, id); - } - ); + return GetMockableMobileNetworkArmClient(client).GetMobileNetworkSliceResource(id); } - #endregion - /// Gets a collection of MobileNetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of MobileNetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MobileNetworkResources and their operations over a MobileNetworkResource. public static MobileNetworkCollection GetMobileNetworks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMobileNetworks(); + return GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetMobileNetworks(); } /// @@ -370,16 +305,20 @@ public static MobileNetworkCollection GetMobileNetworks(this ResourceGroupResour /// MobileNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the mobile network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMobileNetworkAsync(this ResourceGroupResource resourceGroupResource, string mobileNetworkName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMobileNetworks().GetAsync(mobileNetworkName, cancellationToken).ConfigureAwait(false); + return await GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetMobileNetworkAsync(mobileNetworkName, cancellationToken).ConfigureAwait(false); } /// @@ -394,24 +333,34 @@ public static async Task> GetMobileNetworkAsync( /// MobileNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the mobile network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMobileNetwork(this ResourceGroupResource resourceGroupResource, string mobileNetworkName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMobileNetworks().Get(mobileNetworkName, cancellationToken); + return GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetMobileNetwork(mobileNetworkName, cancellationToken); } - /// Gets a collection of PacketCoreControlPlaneResources in the ResourceGroupResource. + /// + /// Gets a collection of PacketCoreControlPlaneResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PacketCoreControlPlaneResources and their operations over a PacketCoreControlPlaneResource. public static PacketCoreControlPlaneCollection GetPacketCoreControlPlanes(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPacketCoreControlPlanes(); + return GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetPacketCoreControlPlanes(); } /// @@ -426,16 +375,20 @@ public static PacketCoreControlPlaneCollection GetPacketCoreControlPlanes(this R /// PacketCoreControlPlanes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the packet core control plane. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPacketCoreControlPlaneAsync(this ResourceGroupResource resourceGroupResource, string packetCoreControlPlaneName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPacketCoreControlPlanes().GetAsync(packetCoreControlPlaneName, cancellationToken).ConfigureAwait(false); + return await GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetPacketCoreControlPlaneAsync(packetCoreControlPlaneName, cancellationToken).ConfigureAwait(false); } /// @@ -450,24 +403,34 @@ public static async Task> GetPacketCore /// PacketCoreControlPlanes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the packet core control plane. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPacketCoreControlPlane(this ResourceGroupResource resourceGroupResource, string packetCoreControlPlaneName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPacketCoreControlPlanes().Get(packetCoreControlPlaneName, cancellationToken); + return GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetPacketCoreControlPlane(packetCoreControlPlaneName, cancellationToken); } - /// Gets a collection of MobileNetworkSimGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of MobileNetworkSimGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MobileNetworkSimGroupResources and their operations over a MobileNetworkSimGroupResource. public static MobileNetworkSimGroupCollection GetMobileNetworkSimGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMobileNetworkSimGroups(); + return GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetMobileNetworkSimGroups(); } /// @@ -482,16 +445,20 @@ public static MobileNetworkSimGroupCollection GetMobileNetworkSimGroups(this Res /// SimGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the SIM Group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMobileNetworkSimGroupAsync(this ResourceGroupResource resourceGroupResource, string simGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMobileNetworkSimGroups().GetAsync(simGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetMobileNetworkSimGroupAsync(simGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -506,24 +473,34 @@ public static async Task> GetMobileNetwo /// SimGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the SIM Group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMobileNetworkSimGroup(this ResourceGroupResource resourceGroupResource, string simGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMobileNetworkSimGroups().Get(simGroupName, cancellationToken); + return GetMockableMobileNetworkResourceGroupResource(resourceGroupResource).GetMobileNetworkSimGroup(simGroupName, cancellationToken); } - /// Gets a collection of SubscriptionPacketCoreControlPlaneVersionResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionPacketCoreControlPlaneVersionResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SubscriptionPacketCoreControlPlaneVersionResources and their operations over a SubscriptionPacketCoreControlPlaneVersionResource. public static SubscriptionPacketCoreControlPlaneVersionCollection GetSubscriptionPacketCoreControlPlaneVersions(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionPacketCoreControlPlaneVersions(); + return GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetSubscriptionPacketCoreControlPlaneVersions(); } /// @@ -538,16 +515,20 @@ public static SubscriptionPacketCoreControlPlaneVersionCollection GetSubscriptio /// PacketCoreControlPlaneVersions_GetBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the packet core control plane version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionPacketCoreControlPlaneVersionAsync(this SubscriptionResource subscriptionResource, string versionName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionPacketCoreControlPlaneVersions().GetAsync(versionName, cancellationToken).ConfigureAwait(false); + return await GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetSubscriptionPacketCoreControlPlaneVersionAsync(versionName, cancellationToken).ConfigureAwait(false); } /// @@ -562,16 +543,20 @@ public static async TaskPacketCoreControlPlaneVersions_GetBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the packet core control plane version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionPacketCoreControlPlaneVersion(this SubscriptionResource subscriptionResource, string versionName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionPacketCoreControlPlaneVersions().Get(versionName, cancellationToken); + return GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetSubscriptionPacketCoreControlPlaneVersion(versionName, cancellationToken); } /// @@ -586,13 +571,17 @@ public static Response GetSub /// MobileNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMobileNetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMobileNetworksAsync(cancellationToken); + return GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetMobileNetworksAsync(cancellationToken); } /// @@ -607,13 +596,17 @@ public static AsyncPageable GetMobileNetworksAsync(this S /// MobileNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMobileNetworks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMobileNetworks(cancellationToken); + return GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetMobileNetworks(cancellationToken); } /// @@ -628,13 +621,17 @@ public static Pageable GetMobileNetworks(this Subscriptio /// PacketCoreControlPlanes_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPacketCoreControlPlanesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPacketCoreControlPlanesAsync(cancellationToken); + return GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetPacketCoreControlPlanesAsync(cancellationToken); } /// @@ -649,13 +646,17 @@ public static AsyncPageable GetPacketCoreControl /// PacketCoreControlPlanes_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPacketCoreControlPlanes(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPacketCoreControlPlanes(cancellationToken); + return GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetPacketCoreControlPlanes(cancellationToken); } /// @@ -670,13 +671,17 @@ public static Pageable GetPacketCoreControlPlane /// SimGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMobileNetworkSimGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMobileNetworkSimGroupsAsync(cancellationToken); + return GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetMobileNetworkSimGroupsAsync(cancellationToken); } /// @@ -691,21 +696,31 @@ public static AsyncPageable GetMobileNetworkSimGr /// SimGroups_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMobileNetworkSimGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMobileNetworkSimGroups(cancellationToken); + return GetMockableMobileNetworkSubscriptionResource(subscriptionResource).GetMobileNetworkSimGroups(cancellationToken); } - /// Gets a collection of TenantPacketCoreControlPlaneVersionResources in the TenantResource. + /// + /// Gets a collection of TenantPacketCoreControlPlaneVersionResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TenantPacketCoreControlPlaneVersionResources and their operations over a TenantPacketCoreControlPlaneVersionResource. public static TenantPacketCoreControlPlaneVersionCollection GetTenantPacketCoreControlPlaneVersions(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetTenantPacketCoreControlPlaneVersions(); + return GetMockableMobileNetworkTenantResource(tenantResource).GetTenantPacketCoreControlPlaneVersions(); } /// @@ -720,16 +735,20 @@ public static TenantPacketCoreControlPlaneVersionCollection GetTenantPacketCoreC /// PacketCoreControlPlaneVersions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the packet core control plane version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTenantPacketCoreControlPlaneVersionAsync(this TenantResource tenantResource, string versionName, CancellationToken cancellationToken = default) { - return await tenantResource.GetTenantPacketCoreControlPlaneVersions().GetAsync(versionName, cancellationToken).ConfigureAwait(false); + return await GetMockableMobileNetworkTenantResource(tenantResource).GetTenantPacketCoreControlPlaneVersionAsync(versionName, cancellationToken).ConfigureAwait(false); } /// @@ -744,16 +763,20 @@ public static async Task> /// PacketCoreControlPlaneVersions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the packet core control plane version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTenantPacketCoreControlPlaneVersion(this TenantResource tenantResource, string versionName, CancellationToken cancellationToken = default) { - return tenantResource.GetTenantPacketCoreControlPlaneVersions().Get(versionName, cancellationToken); + return GetMockableMobileNetworkTenantResource(tenantResource).GetTenantPacketCoreControlPlaneVersion(versionName, cancellationToken); } } } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkArmClient.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkArmClient.cs new file mode 100644 index 0000000000000..8f71a0f9d9cf2 --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkArmClient.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MobileNetwork; + +namespace Azure.ResourceManager.MobileNetwork.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMobileNetworkArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMobileNetworkArmClient() + { + } + + /// 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 MockableMobileNetworkArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMobileNetworkArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileAttachedDataNetworkResource GetMobileAttachedDataNetworkResource(ResourceIdentifier id) + { + MobileAttachedDataNetworkResource.ValidateResourceId(id); + return new MobileAttachedDataNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileDataNetworkResource GetMobileDataNetworkResource(ResourceIdentifier id) + { + MobileDataNetworkResource.ValidateResourceId(id); + return new MobileDataNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkDiagnosticsPackageResource GetMobileNetworkDiagnosticsPackageResource(ResourceIdentifier id) + { + MobileNetworkDiagnosticsPackageResource.ValidateResourceId(id); + return new MobileNetworkDiagnosticsPackageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkResource GetMobileNetworkResource(ResourceIdentifier id) + { + MobileNetworkResource.ValidateResourceId(id); + return new MobileNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkPacketCaptureResource GetMobileNetworkPacketCaptureResource(ResourceIdentifier id) + { + MobileNetworkPacketCaptureResource.ValidateResourceId(id); + return new MobileNetworkPacketCaptureResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PacketCoreControlPlaneResource GetPacketCoreControlPlaneResource(ResourceIdentifier id) + { + PacketCoreControlPlaneResource.ValidateResourceId(id); + return new PacketCoreControlPlaneResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantPacketCoreControlPlaneVersionResource GetTenantPacketCoreControlPlaneVersionResource(ResourceIdentifier id) + { + TenantPacketCoreControlPlaneVersionResource.ValidateResourceId(id); + return new TenantPacketCoreControlPlaneVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionPacketCoreControlPlaneVersionResource GetSubscriptionPacketCoreControlPlaneVersionResource(ResourceIdentifier id) + { + SubscriptionPacketCoreControlPlaneVersionResource.ValidateResourceId(id); + return new SubscriptionPacketCoreControlPlaneVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PacketCoreDataPlaneResource GetPacketCoreDataPlaneResource(ResourceIdentifier id) + { + PacketCoreDataPlaneResource.ValidateResourceId(id); + return new PacketCoreDataPlaneResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkServiceResource GetMobileNetworkServiceResource(ResourceIdentifier id) + { + MobileNetworkServiceResource.ValidateResourceId(id); + return new MobileNetworkServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkSimResource GetMobileNetworkSimResource(ResourceIdentifier id) + { + MobileNetworkSimResource.ValidateResourceId(id); + return new MobileNetworkSimResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkSimGroupResource GetMobileNetworkSimGroupResource(ResourceIdentifier id) + { + MobileNetworkSimGroupResource.ValidateResourceId(id); + return new MobileNetworkSimGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkSimPolicyResource GetMobileNetworkSimPolicyResource(ResourceIdentifier id) + { + MobileNetworkSimPolicyResource.ValidateResourceId(id); + return new MobileNetworkSimPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkSiteResource GetMobileNetworkSiteResource(ResourceIdentifier id) + { + MobileNetworkSiteResource.ValidateResourceId(id); + return new MobileNetworkSiteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MobileNetworkSliceResource GetMobileNetworkSliceResource(ResourceIdentifier id) + { + MobileNetworkSliceResource.ValidateResourceId(id); + return new MobileNetworkSliceResource(Client, id); + } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkResourceGroupResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkResourceGroupResource.cs new file mode 100644 index 0000000000000..bfb4e7b1d7419 --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkResourceGroupResource.cs @@ -0,0 +1,198 @@ +// 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.MobileNetwork; + +namespace Azure.ResourceManager.MobileNetwork.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMobileNetworkResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMobileNetworkResourceGroupResource() + { + } + + /// 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 MockableMobileNetworkResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MobileNetworkResources in the ResourceGroupResource. + /// An object representing collection of MobileNetworkResources and their operations over a MobileNetworkResource. + public virtual MobileNetworkCollection GetMobileNetworks() + { + return GetCachedClient(client => new MobileNetworkCollection(client, Id)); + } + + /// + /// Gets information about the specified mobile network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName} + /// + /// + /// Operation Id + /// MobileNetworks_Get + /// + /// + /// + /// The name of the mobile network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMobileNetworkAsync(string mobileNetworkName, CancellationToken cancellationToken = default) + { + return await GetMobileNetworks().GetAsync(mobileNetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified mobile network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName} + /// + /// + /// Operation Id + /// MobileNetworks_Get + /// + /// + /// + /// The name of the mobile network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMobileNetwork(string mobileNetworkName, CancellationToken cancellationToken = default) + { + return GetMobileNetworks().Get(mobileNetworkName, cancellationToken); + } + + /// Gets a collection of PacketCoreControlPlaneResources in the ResourceGroupResource. + /// An object representing collection of PacketCoreControlPlaneResources and their operations over a PacketCoreControlPlaneResource. + public virtual PacketCoreControlPlaneCollection GetPacketCoreControlPlanes() + { + return GetCachedClient(client => new PacketCoreControlPlaneCollection(client, Id)); + } + + /// + /// Gets information about the specified packet core control plane. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName} + /// + /// + /// Operation Id + /// PacketCoreControlPlanes_Get + /// + /// + /// + /// The name of the packet core control plane. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPacketCoreControlPlaneAsync(string packetCoreControlPlaneName, CancellationToken cancellationToken = default) + { + return await GetPacketCoreControlPlanes().GetAsync(packetCoreControlPlaneName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified packet core control plane. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName} + /// + /// + /// Operation Id + /// PacketCoreControlPlanes_Get + /// + /// + /// + /// The name of the packet core control plane. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPacketCoreControlPlane(string packetCoreControlPlaneName, CancellationToken cancellationToken = default) + { + return GetPacketCoreControlPlanes().Get(packetCoreControlPlaneName, cancellationToken); + } + + /// Gets a collection of MobileNetworkSimGroupResources in the ResourceGroupResource. + /// An object representing collection of MobileNetworkSimGroupResources and their operations over a MobileNetworkSimGroupResource. + public virtual MobileNetworkSimGroupCollection GetMobileNetworkSimGroups() + { + return GetCachedClient(client => new MobileNetworkSimGroupCollection(client, Id)); + } + + /// + /// Gets information about the specified SIM group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName} + /// + /// + /// Operation Id + /// SimGroups_Get + /// + /// + /// + /// The name of the SIM Group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMobileNetworkSimGroupAsync(string simGroupName, CancellationToken cancellationToken = default) + { + return await GetMobileNetworkSimGroups().GetAsync(simGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified SIM group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName} + /// + /// + /// Operation Id + /// SimGroups_Get + /// + /// + /// + /// The name of the SIM Group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMobileNetworkSimGroup(string simGroupName, CancellationToken cancellationToken = default) + { + return GetMobileNetworkSimGroups().Get(simGroupName, cancellationToken); + } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkSubscriptionResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkSubscriptionResource.cs new file mode 100644 index 0000000000000..a17337c5b6de5 --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkSubscriptionResource.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.MobileNetwork; + +namespace Azure.ResourceManager.MobileNetwork.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMobileNetworkSubscriptionResource : ArmResource + { + private ClientDiagnostics _mobileNetworkClientDiagnostics; + private MobileNetworksRestOperations _mobileNetworkRestClient; + private ClientDiagnostics _packetCoreControlPlaneClientDiagnostics; + private PacketCoreControlPlanesRestOperations _packetCoreControlPlaneRestClient; + private ClientDiagnostics _mobileNetworkSimGroupSimGroupsClientDiagnostics; + private SimGroupsRestOperations _mobileNetworkSimGroupSimGroupsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMobileNetworkSubscriptionResource() + { + } + + /// 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 MockableMobileNetworkSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MobileNetworkClientDiagnostics => _mobileNetworkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MobileNetwork", MobileNetworkResource.ResourceType.Namespace, Diagnostics); + private MobileNetworksRestOperations MobileNetworkRestClient => _mobileNetworkRestClient ??= new MobileNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MobileNetworkResource.ResourceType)); + private ClientDiagnostics PacketCoreControlPlaneClientDiagnostics => _packetCoreControlPlaneClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MobileNetwork", PacketCoreControlPlaneResource.ResourceType.Namespace, Diagnostics); + private PacketCoreControlPlanesRestOperations PacketCoreControlPlaneRestClient => _packetCoreControlPlaneRestClient ??= new PacketCoreControlPlanesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PacketCoreControlPlaneResource.ResourceType)); + private ClientDiagnostics MobileNetworkSimGroupSimGroupsClientDiagnostics => _mobileNetworkSimGroupSimGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MobileNetwork", MobileNetworkSimGroupResource.ResourceType.Namespace, Diagnostics); + private SimGroupsRestOperations MobileNetworkSimGroupSimGroupsRestClient => _mobileNetworkSimGroupSimGroupsRestClient ??= new SimGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MobileNetworkSimGroupResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SubscriptionPacketCoreControlPlaneVersionResources in the SubscriptionResource. + /// An object representing collection of SubscriptionPacketCoreControlPlaneVersionResources and their operations over a SubscriptionPacketCoreControlPlaneVersionResource. + public virtual SubscriptionPacketCoreControlPlaneVersionCollection GetSubscriptionPacketCoreControlPlaneVersions() + { + return GetCachedClient(client => new SubscriptionPacketCoreControlPlaneVersionCollection(client, Id)); + } + + /// + /// Gets information about the specified packet core control plane version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName} + /// + /// + /// Operation Id + /// PacketCoreControlPlaneVersions_GetBySubscription + /// + /// + /// + /// The name of the packet core control plane version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionPacketCoreControlPlaneVersionAsync(string versionName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionPacketCoreControlPlaneVersions().GetAsync(versionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified packet core control plane version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName} + /// + /// + /// Operation Id + /// PacketCoreControlPlaneVersions_GetBySubscription + /// + /// + /// + /// The name of the packet core control plane version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionPacketCoreControlPlaneVersion(string versionName, CancellationToken cancellationToken = default) + { + return GetSubscriptionPacketCoreControlPlaneVersions().Get(versionName, cancellationToken); + } + + /// + /// Lists all the mobile networks in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/mobileNetworks + /// + /// + /// Operation Id + /// MobileNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMobileNetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MobileNetworkRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MobileNetworkRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MobileNetworkResource(Client, MobileNetworkData.DeserializeMobileNetworkData(e)), MobileNetworkClientDiagnostics, Pipeline, "MockableMobileNetworkSubscriptionResource.GetMobileNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the mobile networks in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/mobileNetworks + /// + /// + /// Operation Id + /// MobileNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMobileNetworks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MobileNetworkRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MobileNetworkRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MobileNetworkResource(Client, MobileNetworkData.DeserializeMobileNetworkData(e)), MobileNetworkClientDiagnostics, Pipeline, "MockableMobileNetworkSubscriptionResource.GetMobileNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the packet core control planes in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes + /// + /// + /// Operation Id + /// PacketCoreControlPlanes_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPacketCoreControlPlanesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PacketCoreControlPlaneRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PacketCoreControlPlaneRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PacketCoreControlPlaneResource(Client, PacketCoreControlPlaneData.DeserializePacketCoreControlPlaneData(e)), PacketCoreControlPlaneClientDiagnostics, Pipeline, "MockableMobileNetworkSubscriptionResource.GetPacketCoreControlPlanes", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the packet core control planes in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes + /// + /// + /// Operation Id + /// PacketCoreControlPlanes_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPacketCoreControlPlanes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PacketCoreControlPlaneRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PacketCoreControlPlaneRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PacketCoreControlPlaneResource(Client, PacketCoreControlPlaneData.DeserializePacketCoreControlPlaneData(e)), PacketCoreControlPlaneClientDiagnostics, Pipeline, "MockableMobileNetworkSubscriptionResource.GetPacketCoreControlPlanes", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the SIM groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/simGroups + /// + /// + /// Operation Id + /// SimGroups_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMobileNetworkSimGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MobileNetworkSimGroupSimGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MobileNetworkSimGroupSimGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MobileNetworkSimGroupResource(Client, MobileNetworkSimGroupData.DeserializeMobileNetworkSimGroupData(e)), MobileNetworkSimGroupSimGroupsClientDiagnostics, Pipeline, "MockableMobileNetworkSubscriptionResource.GetMobileNetworkSimGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the SIM groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/simGroups + /// + /// + /// Operation Id + /// SimGroups_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMobileNetworkSimGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MobileNetworkSimGroupSimGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MobileNetworkSimGroupSimGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MobileNetworkSimGroupResource(Client, MobileNetworkSimGroupData.DeserializeMobileNetworkSimGroupData(e)), MobileNetworkSimGroupSimGroupsClientDiagnostics, Pipeline, "MockableMobileNetworkSubscriptionResource.GetMobileNetworkSimGroups", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkTenantResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkTenantResource.cs new file mode 100644 index 0000000000000..76fc041b8b2d5 --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MockableMobileNetworkTenantResource.cs @@ -0,0 +1,92 @@ +// 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.MobileNetwork; + +namespace Azure.ResourceManager.MobileNetwork.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableMobileNetworkTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMobileNetworkTenantResource() + { + } + + /// 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 MockableMobileNetworkTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of TenantPacketCoreControlPlaneVersionResources in the TenantResource. + /// An object representing collection of TenantPacketCoreControlPlaneVersionResources and their operations over a TenantPacketCoreControlPlaneVersionResource. + public virtual TenantPacketCoreControlPlaneVersionCollection GetTenantPacketCoreControlPlaneVersions() + { + return GetCachedClient(client => new TenantPacketCoreControlPlaneVersionCollection(client, Id)); + } + + /// + /// Gets information about the specified packet core control plane version. + /// + /// + /// Request Path + /// /providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName} + /// + /// + /// Operation Id + /// PacketCoreControlPlaneVersions_Get + /// + /// + /// + /// The name of the packet core control plane version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTenantPacketCoreControlPlaneVersionAsync(string versionName, CancellationToken cancellationToken = default) + { + return await GetTenantPacketCoreControlPlaneVersions().GetAsync(versionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified packet core control plane version. + /// + /// + /// Request Path + /// /providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName} + /// + /// + /// Operation Id + /// PacketCoreControlPlaneVersions_Get + /// + /// + /// + /// The name of the packet core control plane version. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTenantPacketCoreControlPlaneVersion(string versionName, CancellationToken cancellationToken = default) + { + return GetTenantPacketCoreControlPlaneVersions().Get(versionName, cancellationToken); + } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ae9df5309c89f..0000000000000 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MobileNetwork -{ - /// 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 MobileNetworkResources in the ResourceGroupResource. - /// An object representing collection of MobileNetworkResources and their operations over a MobileNetworkResource. - public virtual MobileNetworkCollection GetMobileNetworks() - { - return GetCachedClient(Client => new MobileNetworkCollection(Client, Id)); - } - - /// Gets a collection of PacketCoreControlPlaneResources in the ResourceGroupResource. - /// An object representing collection of PacketCoreControlPlaneResources and their operations over a PacketCoreControlPlaneResource. - public virtual PacketCoreControlPlaneCollection GetPacketCoreControlPlanes() - { - return GetCachedClient(Client => new PacketCoreControlPlaneCollection(Client, Id)); - } - - /// Gets a collection of MobileNetworkSimGroupResources in the ResourceGroupResource. - /// An object representing collection of MobileNetworkSimGroupResources and their operations over a MobileNetworkSimGroupResource. - public virtual MobileNetworkSimGroupCollection GetMobileNetworkSimGroups() - { - return GetCachedClient(Client => new MobileNetworkSimGroupCollection(Client, Id)); - } - } -} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index c3888b94fe58e..0000000000000 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MobileNetwork -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _mobileNetworkClientDiagnostics; - private MobileNetworksRestOperations _mobileNetworkRestClient; - private ClientDiagnostics _packetCoreControlPlaneClientDiagnostics; - private PacketCoreControlPlanesRestOperations _packetCoreControlPlaneRestClient; - private ClientDiagnostics _mobileNetworkSimGroupSimGroupsClientDiagnostics; - private SimGroupsRestOperations _mobileNetworkSimGroupSimGroupsRestClient; - - /// 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 MobileNetworkClientDiagnostics => _mobileNetworkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MobileNetwork", MobileNetworkResource.ResourceType.Namespace, Diagnostics); - private MobileNetworksRestOperations MobileNetworkRestClient => _mobileNetworkRestClient ??= new MobileNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MobileNetworkResource.ResourceType)); - private ClientDiagnostics PacketCoreControlPlaneClientDiagnostics => _packetCoreControlPlaneClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MobileNetwork", PacketCoreControlPlaneResource.ResourceType.Namespace, Diagnostics); - private PacketCoreControlPlanesRestOperations PacketCoreControlPlaneRestClient => _packetCoreControlPlaneRestClient ??= new PacketCoreControlPlanesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PacketCoreControlPlaneResource.ResourceType)); - private ClientDiagnostics MobileNetworkSimGroupSimGroupsClientDiagnostics => _mobileNetworkSimGroupSimGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MobileNetwork", MobileNetworkSimGroupResource.ResourceType.Namespace, Diagnostics); - private SimGroupsRestOperations MobileNetworkSimGroupSimGroupsRestClient => _mobileNetworkSimGroupSimGroupsRestClient ??= new SimGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MobileNetworkSimGroupResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of SubscriptionPacketCoreControlPlaneVersionResources in the SubscriptionResource. - /// An object representing collection of SubscriptionPacketCoreControlPlaneVersionResources and their operations over a SubscriptionPacketCoreControlPlaneVersionResource. - public virtual SubscriptionPacketCoreControlPlaneVersionCollection GetSubscriptionPacketCoreControlPlaneVersions() - { - return GetCachedClient(Client => new SubscriptionPacketCoreControlPlaneVersionCollection(Client, Id)); - } - - /// - /// Lists all the mobile networks in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/mobileNetworks - /// - /// - /// Operation Id - /// MobileNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMobileNetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MobileNetworkRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MobileNetworkRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MobileNetworkResource(Client, MobileNetworkData.DeserializeMobileNetworkData(e)), MobileNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMobileNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the mobile networks in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/mobileNetworks - /// - /// - /// Operation Id - /// MobileNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMobileNetworks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MobileNetworkRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MobileNetworkRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MobileNetworkResource(Client, MobileNetworkData.DeserializeMobileNetworkData(e)), MobileNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMobileNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the packet core control planes in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes - /// - /// - /// Operation Id - /// PacketCoreControlPlanes_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPacketCoreControlPlanesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PacketCoreControlPlaneRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PacketCoreControlPlaneRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PacketCoreControlPlaneResource(Client, PacketCoreControlPlaneData.DeserializePacketCoreControlPlaneData(e)), PacketCoreControlPlaneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPacketCoreControlPlanes", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the packet core control planes in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes - /// - /// - /// Operation Id - /// PacketCoreControlPlanes_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPacketCoreControlPlanes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PacketCoreControlPlaneRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PacketCoreControlPlaneRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PacketCoreControlPlaneResource(Client, PacketCoreControlPlaneData.DeserializePacketCoreControlPlaneData(e)), PacketCoreControlPlaneClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPacketCoreControlPlanes", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the SIM groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/simGroups - /// - /// - /// Operation Id - /// SimGroups_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMobileNetworkSimGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MobileNetworkSimGroupSimGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MobileNetworkSimGroupSimGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MobileNetworkSimGroupResource(Client, MobileNetworkSimGroupData.DeserializeMobileNetworkSimGroupData(e)), MobileNetworkSimGroupSimGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMobileNetworkSimGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the SIM groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/simGroups - /// - /// - /// Operation Id - /// SimGroups_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMobileNetworkSimGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MobileNetworkSimGroupSimGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MobileNetworkSimGroupSimGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MobileNetworkSimGroupResource(Client, MobileNetworkSimGroupData.DeserializeMobileNetworkSimGroupData(e)), MobileNetworkSimGroupSimGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMobileNetworkSimGroups", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index e614c49faba69..0000000000000 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MobileNetwork -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of TenantPacketCoreControlPlaneVersionResources in the TenantResource. - /// An object representing collection of TenantPacketCoreControlPlaneVersionResources and their operations over a TenantPacketCoreControlPlaneVersionResource. - public virtual TenantPacketCoreControlPlaneVersionCollection GetTenantPacketCoreControlPlaneVersions() - { - return GetCachedClient(Client => new TenantPacketCoreControlPlaneVersionCollection(Client, Id)); - } - } -} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileAttachedDataNetworkResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileAttachedDataNetworkResource.cs index 0a4397f049032..0e22bb7773ea6 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileAttachedDataNetworkResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileAttachedDataNetworkResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileAttachedDataNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The packetCoreControlPlaneName. + /// The packetCoreDataPlaneName. + /// The attachedDataNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string packetCoreControlPlaneName, string packetCoreDataPlaneName, string attachedDataNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileDataNetworkResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileDataNetworkResource.cs index 447ae3f312f95..4a3fb56a2ae9b 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileDataNetworkResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileDataNetworkResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileDataNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mobileNetworkName. + /// The dataNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mobileNetworkName, string dataNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkDiagnosticsPackageResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkDiagnosticsPackageResource.cs index 1a70359005c1f..b5128f954c946 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkDiagnosticsPackageResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkDiagnosticsPackageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkDiagnosticsPackageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The packetCoreControlPlaneName. + /// The diagnosticsPackageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string packetCoreControlPlaneName, string diagnosticsPackageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureData.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureData.cs index c4171255c084b..effd0a0004a37 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureData.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureData.cs @@ -23,6 +23,7 @@ public partial class MobileNetworkPacketCaptureData : ResourceData public MobileNetworkPacketCaptureData() { NetworkInterfaces = new ChangeTrackingList(); + OutputFiles = new ChangeTrackingList(); } /// Initializes a new instance of MobileNetworkPacketCaptureData. @@ -38,7 +39,8 @@ public MobileNetworkPacketCaptureData() /// Number of bytes captured per packet, the remaining bytes are truncated. The default "0" means the entire packet is captured. /// Maximum size of the capture output. /// Maximum duration of the capture session in seconds. - internal MobileNetworkPacketCaptureData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MobileNetworkProvisioningState? provisioningState, MobileNetworkPacketCaptureStatus? status, string reason, DateTimeOffset? captureStartOn, IList networkInterfaces, long? bytesToCapturePerPacket, long? totalBytesPerSession, int? timeLimitInSeconds) : base(id, name, resourceType, systemData) + /// The list of output files of a packet capture session. + internal MobileNetworkPacketCaptureData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MobileNetworkProvisioningState? provisioningState, MobileNetworkPacketCaptureStatus? status, string reason, DateTimeOffset? captureStartOn, IList networkInterfaces, long? bytesToCapturePerPacket, long? totalBytesPerSession, int? timeLimitInSeconds, IReadOnlyList outputFiles) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; Status = status; @@ -48,6 +50,7 @@ internal MobileNetworkPacketCaptureData(ResourceIdentifier id, string name, Reso BytesToCapturePerPacket = bytesToCapturePerPacket; TotalBytesPerSession = totalBytesPerSession; TimeLimitInSeconds = timeLimitInSeconds; + OutputFiles = outputFiles; } /// The provisioning state of the packet capture session resource. @@ -66,5 +69,7 @@ internal MobileNetworkPacketCaptureData(ResourceIdentifier id, string name, Reso public long? TotalBytesPerSession { get; set; } /// Maximum duration of the capture session in seconds. public int? TimeLimitInSeconds { get; set; } + /// The list of output files of a packet capture session. + public IReadOnlyList OutputFiles { get; } } } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureResource.cs index 4af1718dfbecc..ce8fc86ecaaa1 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkPacketCaptureResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkPacketCaptureResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The packetCoreControlPlaneName. + /// The packetCaptureName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string packetCoreControlPlaneName, string packetCaptureName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkResource.cs index 30f83f4973613..ffa5b263afa97 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mobileNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mobileNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MobileDataNetworkResources and their operations over a MobileDataNetworkResource. public virtual MobileDataNetworkCollection GetMobileDataNetworks() { - return GetCachedClient(Client => new MobileDataNetworkCollection(Client, Id)); + return GetCachedClient(client => new MobileDataNetworkCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual MobileDataNetworkCollection GetMobileDataNetworks() /// /// The name of the data network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileDataNetworkAsync(string dataNetworkName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetMobileDataNetw /// /// The name of the data network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileDataNetwork(string dataNetworkName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetMobileDataNetwork(string d /// An object representing collection of MobileNetworkServiceResources and their operations over a MobileNetworkServiceResource. public virtual MobileNetworkServiceCollection GetMobileNetworkServices() { - return GetCachedClient(Client => new MobileNetworkServiceCollection(Client, Id)); + return GetCachedClient(client => new MobileNetworkServiceCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual MobileNetworkServiceCollection GetMobileNetworkServices() /// /// The name of the service. You must not use any of the following reserved strings - `default`, `requested` or `service`. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileNetworkServiceAsync(string serviceName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetMobileNetwo /// /// The name of the service. You must not use any of the following reserved strings - `default`, `requested` or `service`. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileNetworkService(string serviceName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetMobileNetworkService(st /// An object representing collection of MobileNetworkSimPolicyResources and their operations over a MobileNetworkSimPolicyResource. public virtual MobileNetworkSimPolicyCollection GetMobileNetworkSimPolicies() { - return GetCachedClient(Client => new MobileNetworkSimPolicyCollection(Client, Id)); + return GetCachedClient(client => new MobileNetworkSimPolicyCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual MobileNetworkSimPolicyCollection GetMobileNetworkSimPolicies() /// /// The name of the SIM policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileNetworkSimPolicyAsync(string simPolicyName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetMobileNet /// /// The name of the SIM policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileNetworkSimPolicy(string simPolicyName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetMobileNetworkSimPolic /// An object representing collection of MobileNetworkSiteResources and their operations over a MobileNetworkSiteResource. public virtual MobileNetworkSiteCollection GetMobileNetworkSites() { - return GetCachedClient(Client => new MobileNetworkSiteCollection(Client, Id)); + return GetCachedClient(client => new MobileNetworkSiteCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual MobileNetworkSiteCollection GetMobileNetworkSites() /// /// The name of the mobile network site. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileNetworkSiteAsync(string siteName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetMobileNetworkS /// /// The name of the mobile network site. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileNetworkSite(string siteName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetMobileNetworkSite(string s /// An object representing collection of MobileNetworkSliceResources and their operations over a MobileNetworkSliceResource. public virtual MobileNetworkSliceCollection GetMobileNetworkSlices() { - return GetCachedClient(Client => new MobileNetworkSliceCollection(Client, Id)); + return GetCachedClient(client => new MobileNetworkSliceCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual MobileNetworkSliceCollection GetMobileNetworkSlices() /// /// The name of the network slice. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileNetworkSliceAsync(string sliceName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task> GetMobileNetwork /// /// The name of the network slice. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileNetworkSlice(string sliceName, CancellationToken cancellationToken = default) { diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkServiceResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkServiceResource.cs index 342becef4af04..78225b2a69b64 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkServiceResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkServiceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mobileNetworkName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mobileNetworkName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupResource.cs index b9964b32858ec..3cd754fb32d19 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkSimGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The simGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string simGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MobileNetworkSimResources and their operations over a MobileNetworkSimResource. public virtual MobileNetworkSimCollection GetMobileNetworkSims() { - return GetCachedClient(Client => new MobileNetworkSimCollection(Client, Id)); + return GetCachedClient(client => new MobileNetworkSimCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual MobileNetworkSimCollection GetMobileNetworkSims() /// /// The name of the SIM. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileNetworkSimAsync(string simName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetMobileNetworkSi /// /// The name of the SIM. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileNetworkSim(string simName, CancellationToken cancellationToken = default) { diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimPolicyResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimPolicyResource.cs index dd434034d81f1..b647f2540ff51 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimPolicyResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimPolicyResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkSimPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mobileNetworkName. + /// The simPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mobileNetworkName, string simPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimResource.cs index 931100439178c..a22975c9c6f82 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkSimResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The simGroupName. + /// The simName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string simGroupName, string simName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSiteResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSiteResource.cs index 1e77ed104d834..cf40c5529f080 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSiteResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSiteResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkSiteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mobileNetworkName. + /// The siteName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mobileNetworkName, string siteName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSliceResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSliceResource.cs index 0db132efbc5f0..9af660f05ac34 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSliceResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSliceResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class MobileNetworkSliceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mobileNetworkName. + /// The sliceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mobileNetworkName, string sliceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkEventHubConfiguration.Serialization.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkEventHubConfiguration.Serialization.cs new file mode 100644 index 0000000000000..40a8369ee546a --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkEventHubConfiguration.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MobileNetwork.Models +{ + public partial class MobileNetworkEventHubConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (Optional.IsDefined(ReportingInterval)) + { + writer.WritePropertyName("reportingInterval"u8); + writer.WriteNumberValue(ReportingInterval.Value); + } + writer.WriteEndObject(); + } + + internal static MobileNetworkEventHubConfiguration DeserializeMobileNetworkEventHubConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + Optional reportingInterval = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("reportingInterval"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reportingInterval = property.Value.GetInt32(); + continue; + } + } + return new MobileNetworkEventHubConfiguration(id, Optional.ToNullable(reportingInterval)); + } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkEventHubConfiguration.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkEventHubConfiguration.cs new file mode 100644 index 0000000000000..cd8447232f9d3 --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkEventHubConfiguration.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.MobileNetwork.Models +{ + /// Configuration for sending packet core events to Azure Event Hub. + public partial class MobileNetworkEventHubConfiguration + { + /// Initializes a new instance of MobileNetworkEventHubConfiguration. + /// Resource ID of Azure Event Hub to send packet core events to. + /// is null. + public MobileNetworkEventHubConfiguration(ResourceIdentifier id) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + } + + /// Initializes a new instance of MobileNetworkEventHubConfiguration. + /// Resource ID of Azure Event Hub to send packet core events to. + /// The duration (in seconds) between UE usage reports. + internal MobileNetworkEventHubConfiguration(ResourceIdentifier id, int? reportingInterval) + { + Id = id; + ReportingInterval = reportingInterval; + } + + /// Resource ID of Azure Event Hub to send packet core events to. + public ResourceIdentifier Id { get; set; } + /// The duration (in seconds) between UE usage reports. + public int? ReportingInterval { get; set; } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkInstallationReason.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkInstallationReason.cs index a7448ce479ba8..0f06178fed3b7 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkInstallationReason.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkInstallationReason.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.MobileNetwork.Models { - /// The reason for the installation state of the packet core. + /// The reason or list of reasons why a packet core has not been installed or requires a reinstall. public readonly partial struct MobileNetworkInstallationReason : IEquatable { private readonly string _value; @@ -25,13 +25,31 @@ public MobileNetworkInstallationReason(string value) private const string NoSlicesValue = "NoSlices"; private const string NoPacketCoreDataPlaneValue = "NoPacketCoreDataPlane"; private const string NoAttachedDataNetworksValue = "NoAttachedDataNetworks"; + private const string PublicLandMobileNetworkIdentifierHasChangedValue = "PublicLandMobileNetworkIdentifierHasChanged"; + private const string ControlPlaneAccessInterfaceHasChangedValue = "ControlPlaneAccessInterfaceHasChanged"; + private const string UserPlaneAccessInterfaceHasChangedValue = "UserPlaneAccessInterfaceHasChanged"; + private const string UserPlaneDataInterfaceHasChangedValue = "UserPlaneDataInterfaceHasChanged"; + private const string ControlPlaneAccessVirtualIPv4AddressesHasChangedValue = "ControlPlaneAccessVirtualIpv4AddressesHasChanged"; + private const string UserPlaneAccessVirtualIPv4AddressesHasChangedValue = "UserPlaneAccessVirtualIpv4AddressesHasChanged"; - /// The mobile network does not have any applicable configured slices. + /// The packet core has not been installed as the mobile network does not have any applicable configured slices. public static MobileNetworkInstallationReason NoSlices { get; } = new MobileNetworkInstallationReason(NoSlicesValue); - /// There is no configured data plane for this packet core. + /// The packet core has not been installed as there is no configured data plane for this packet core. public static MobileNetworkInstallationReason NoPacketCoreDataPlane { get; } = new MobileNetworkInstallationReason(NoPacketCoreDataPlaneValue); - /// The packet core has no attached data networks. + /// The packet core has not been installed as the packet core has no attached data networks. public static MobileNetworkInstallationReason NoAttachedDataNetworks { get; } = new MobileNetworkInstallationReason(NoAttachedDataNetworksValue); + /// A reinstall is required as the packet core is running with out-of-date PLMN ID. + public static MobileNetworkInstallationReason PublicLandMobileNetworkIdentifierHasChanged { get; } = new MobileNetworkInstallationReason(PublicLandMobileNetworkIdentifierHasChangedValue); + /// A reinstall is required as the packet core is running with out-of-date control plane access interface information. + public static MobileNetworkInstallationReason ControlPlaneAccessInterfaceHasChanged { get; } = new MobileNetworkInstallationReason(ControlPlaneAccessInterfaceHasChangedValue); + /// A reinstall is required as the packet core is running with out-of-date user plane core interface. + public static MobileNetworkInstallationReason UserPlaneAccessInterfaceHasChanged { get; } = new MobileNetworkInstallationReason(UserPlaneAccessInterfaceHasChangedValue); + /// A reinstall is required as the packet core is running with out-of-date user plane access interface. + public static MobileNetworkInstallationReason UserPlaneDataInterfaceHasChanged { get; } = new MobileNetworkInstallationReason(UserPlaneDataInterfaceHasChangedValue); + /// A reinstall is required as the packet core is running with out-of-date control plane access network virtual IP address. + public static MobileNetworkInstallationReason ControlPlaneAccessVirtualIPv4AddressesHasChanged { get; } = new MobileNetworkInstallationReason(ControlPlaneAccessVirtualIPv4AddressesHasChangedValue); + /// A reinstall is required as the packet core is running with out-of-date user plane access network virtual IP address. + public static MobileNetworkInstallationReason UserPlaneAccessVirtualIPv4AddressesHasChanged { get; } = new MobileNetworkInstallationReason(UserPlaneAccessVirtualIPv4AddressesHasChangedValue); /// Determines if two values are the same. public static bool operator ==(MobileNetworkInstallationReason left, MobileNetworkInstallationReason right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkPacketCaptureData.Serialization.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkPacketCaptureData.Serialization.cs index 5409b25877fd2..f93fc5fbae2b7 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkPacketCaptureData.Serialization.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/MobileNetworkPacketCaptureData.Serialization.cs @@ -68,6 +68,7 @@ internal static MobileNetworkPacketCaptureData DeserializeMobileNetworkPacketCap Optional bytesToCapturePerPacket = default; Optional totalBytesPerSession = default; Optional timeLimitInSeconds = default; + Optional> outputFiles = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -176,11 +177,25 @@ internal static MobileNetworkPacketCaptureData DeserializeMobileNetworkPacketCap timeLimitInSeconds = property0.Value.GetInt32(); continue; } + if (property0.NameEquals("outputFiles"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outputFiles = array; + continue; + } } continue; } } - return new MobileNetworkPacketCaptureData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(status), reason.Value, Optional.ToNullable(captureStartTime), Optional.ToList(networkInterfaces), Optional.ToNullable(bytesToCapturePerPacket), Optional.ToNullable(totalBytesPerSession), Optional.ToNullable(timeLimitInSeconds)); + return new MobileNetworkPacketCaptureData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(status), reason.Value, Optional.ToNullable(captureStartTime), Optional.ToList(networkInterfaces), Optional.ToNullable(bytesToCapturePerPacket), Optional.ToNullable(totalBytesPerSession), Optional.ToNullable(timeLimitInSeconds), Optional.ToList(outputFiles)); } } } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/NASRerouteConfiguration.Serialization.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/NASRerouteConfiguration.Serialization.cs new file mode 100644 index 0000000000000..322a98b7798d0 --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/NASRerouteConfiguration.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.MobileNetwork.Models +{ + internal partial class NASRerouteConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("macroMmeGroupId"u8); + writer.WriteNumberValue(MacroMmeGroupId); + writer.WriteEndObject(); + } + + internal static NASRerouteConfiguration DeserializeNASRerouteConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int macroMmeGroupId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("macroMmeGroupId"u8)) + { + macroMmeGroupId = property.Value.GetInt32(); + continue; + } + } + return new NASRerouteConfiguration(macroMmeGroupId); + } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/NASRerouteConfiguration.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/NASRerouteConfiguration.cs new file mode 100644 index 0000000000000..13995b4492b08 --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/NASRerouteConfiguration.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.MobileNetwork.Models +{ + /// Configuration enabling NAS reroute. + internal partial class NASRerouteConfiguration + { + /// Initializes a new instance of NASRerouteConfiguration. + /// The macro network's MME group ID. This is where unknown UEs are sent to via NAS reroute. + public NASRerouteConfiguration(int macroMmeGroupId) + { + MacroMmeGroupId = macroMmeGroupId; + } + + /// The macro network's MME group ID. This is where unknown UEs are sent to via NAS reroute. + public int MacroMmeGroupId { get; set; } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/PacketCoreControlPlaneData.Serialization.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/PacketCoreControlPlaneData.Serialization.cs index d328d4a384338..7516e48784ab4 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/PacketCoreControlPlaneData.Serialization.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/PacketCoreControlPlaneData.Serialization.cs @@ -66,6 +66,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("controlPlaneAccessInterface"u8); writer.WriteObjectValue(ControlPlaneAccessInterface); + if (Optional.IsCollectionDefined(ControlPlaneAccessVirtualIPv4Addresses)) + { + writer.WritePropertyName("controlPlaneAccessVirtualIpv4Addresses"u8); + writer.WriteStartArray(); + foreach (var item in ControlPlaneAccessVirtualIPv4Addresses) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } writer.WritePropertyName("sku"u8); writer.WriteStringValue(Sku.ToString()); if (Optional.IsDefined(UeMtu)) @@ -80,6 +90,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("diagnosticsUpload"u8); writer.WriteObjectValue(DiagnosticsUpload); } + if (Optional.IsDefined(EventHub)) + { + writer.WritePropertyName("eventHub"u8); + writer.WriteObjectValue(EventHub); + } + if (Optional.IsDefined(Signaling)) + { + writer.WritePropertyName("signaling"u8); + writer.WriteObjectValue(Signaling); + } if (Optional.IsDefined(InteropSettings)) { writer.WritePropertyName("interopSettings"u8); @@ -118,10 +138,13 @@ internal static PacketCoreControlPlaneData DeserializePacketCoreControlPlaneData Optional installedVersion = default; Optional rollbackVersion = default; MobileNetworkInterfaceProperties controlPlaneAccessInterface = default; + Optional> controlPlaneAccessVirtualIPv4Addresses = default; MobileNetworkBillingSku sku = default; Optional ueMtu = default; MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess = default; Optional diagnosticsUpload = default; + Optional eventHub = default; + Optional signaling = default; Optional interopSettings = default; foreach (var property in element.EnumerateObject()) { @@ -248,6 +271,20 @@ internal static PacketCoreControlPlaneData DeserializePacketCoreControlPlaneData controlPlaneAccessInterface = MobileNetworkInterfaceProperties.DeserializeMobileNetworkInterfaceProperties(property0.Value); continue; } + if (property0.NameEquals("controlPlaneAccessVirtualIpv4Addresses"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + controlPlaneAccessVirtualIPv4Addresses = array; + continue; + } if (property0.NameEquals("sku"u8)) { sku = new MobileNetworkBillingSku(property0.Value.GetString()); @@ -276,6 +313,24 @@ internal static PacketCoreControlPlaneData DeserializePacketCoreControlPlaneData diagnosticsUpload = DiagnosticsUploadConfiguration.DeserializeDiagnosticsUploadConfiguration(property0.Value); continue; } + if (property0.NameEquals("eventHub"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventHub = MobileNetworkEventHubConfiguration.DeserializeMobileNetworkEventHubConfiguration(property0.Value); + continue; + } + if (property0.NameEquals("signaling"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + signaling = SignalingConfiguration.DeserializeSignalingConfiguration(property0.Value); + continue; + } if (property0.NameEquals("interopSettings"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -289,7 +344,7 @@ internal static PacketCoreControlPlaneData DeserializePacketCoreControlPlaneData continue; } } - return new PacketCoreControlPlaneData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity.Value, Optional.ToNullable(provisioningState), installation.Value, sites, platform, Optional.ToNullable(coreNetworkTechnology), version.Value, installedVersion.Value, rollbackVersion.Value, controlPlaneAccessInterface, sku, Optional.ToNullable(ueMtu), localDiagnosticsAccess, diagnosticsUpload.Value, interopSettings.Value); + return new PacketCoreControlPlaneData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity.Value, Optional.ToNullable(provisioningState), installation.Value, sites, platform, Optional.ToNullable(coreNetworkTechnology), version.Value, installedVersion.Value, rollbackVersion.Value, controlPlaneAccessInterface, Optional.ToList(controlPlaneAccessVirtualIPv4Addresses), sku, Optional.ToNullable(ueMtu), localDiagnosticsAccess, diagnosticsUpload.Value, eventHub.Value, signaling.Value, interopSettings.Value); } } } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/PacketCoreDataPlaneData.Serialization.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/PacketCoreDataPlaneData.Serialization.cs index 73816b17acbb2..1b5ffee017a39 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/PacketCoreDataPlaneData.Serialization.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/PacketCoreDataPlaneData.Serialization.cs @@ -35,6 +35,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("userPlaneAccessInterface"u8); writer.WriteObjectValue(UserPlaneAccessInterface); + if (Optional.IsCollectionDefined(UserPlaneAccessVirtualIPv4Addresses)) + { + writer.WritePropertyName("userPlaneAccessVirtualIpv4Addresses"u8); + writer.WriteStartArray(); + foreach (var item in UserPlaneAccessVirtualIPv4Addresses) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -53,6 +63,7 @@ internal static PacketCoreDataPlaneData DeserializePacketCoreDataPlaneData(JsonE Optional systemData = default; Optional provisioningState = default; MobileNetworkInterfaceProperties userPlaneAccessInterface = default; + Optional> userPlaneAccessVirtualIPv4Addresses = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -121,11 +132,25 @@ internal static PacketCoreDataPlaneData DeserializePacketCoreDataPlaneData(JsonE userPlaneAccessInterface = MobileNetworkInterfaceProperties.DeserializeMobileNetworkInterfaceProperties(property0.Value); continue; } + if (property0.NameEquals("userPlaneAccessVirtualIpv4Addresses"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + userPlaneAccessVirtualIPv4Addresses = array; + continue; + } } continue; } } - return new PacketCoreDataPlaneData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), userPlaneAccessInterface); + return new PacketCoreDataPlaneData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), userPlaneAccessInterface, Optional.ToList(userPlaneAccessVirtualIPv4Addresses)); } } } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/SignalingConfiguration.Serialization.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/SignalingConfiguration.Serialization.cs new file mode 100644 index 0000000000000..d2f3b2ace84fc --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/SignalingConfiguration.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MobileNetwork.Models +{ + internal partial class SignalingConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NasReroute)) + { + writer.WritePropertyName("nasReroute"u8); + writer.WriteObjectValue(NasReroute); + } + writer.WriteEndObject(); + } + + internal static SignalingConfiguration DeserializeSignalingConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nasReroute = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nasReroute"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nasReroute = NASRerouteConfiguration.DeserializeNASRerouteConfiguration(property.Value); + continue; + } + } + return new SignalingConfiguration(nasReroute.Value); + } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/SignalingConfiguration.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/SignalingConfiguration.cs new file mode 100644 index 0000000000000..b455aeec74d54 --- /dev/null +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Models/SignalingConfiguration.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.MobileNetwork.Models +{ + /// Signaling configuration for the packet core. + internal partial class SignalingConfiguration + { + /// Initializes a new instance of SignalingConfiguration. + public SignalingConfiguration() + { + } + + /// Initializes a new instance of SignalingConfiguration. + /// Configuration enabling 4G NAS reroute. + internal SignalingConfiguration(NASRerouteConfiguration nasReroute) + { + NasReroute = nasReroute; + } + + /// Configuration enabling 4G NAS reroute. + internal NASRerouteConfiguration NasReroute { get; set; } + /// The macro network's MME group ID. This is where unknown UEs are sent to via NAS reroute. + public int? NasRerouteMacroMmeGroupId + { + get => NasReroute is null ? default(int?) : NasReroute.MacroMmeGroupId; + set + { + NasReroute = value.HasValue ? new NASRerouteConfiguration(value.Value) : null; + } + } + } +} diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneData.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneData.cs index 2c092f4de3703..57a6c69920184 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneData.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneData.cs @@ -39,6 +39,7 @@ public PacketCoreControlPlaneData(AzureLocation location, IEnumerable(); Sku = sku; LocalDiagnosticsAccess = localDiagnosticsAccess; } @@ -60,12 +61,15 @@ public PacketCoreControlPlaneData(AzureLocation location, IEnumerable The currently installed version of the packet core software. /// The previous version of the packet core software that was deployed. Used when performing the rollback action. /// The control plane interface on the access network. For 5G networks, this is the N2 interface. For 4G networks, this is the S1-MME interface. + /// The virtual IP address(es) for the control plane on the access network in a High Availability (HA) system. In an HA deployment the access network router should be configured to anycast traffic for this address to the control plane access interfaces on the active and standby nodes. In non-HA system this list should be omitted or empty. /// The SKU defining the throughput and SIM allowances for this packet core control plane deployment. /// The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links for all data networks. The MTU set on the user plane access link is calculated to be 60 bytes greater than this value to allow for GTP encapsulation. /// The kubernetes ingress configuration to control access to packet core diagnostics over local APIs. /// Configuration for uploading packet core diagnostics. + /// Configuration for sending packet core events to an Azure Event Hub. + /// Signaling configuration for the packet core. /// Settings to allow interoperability with third party components e.g. RANs and UEs. - internal PacketCoreControlPlaneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MobileNetworkManagedServiceIdentity userAssignedIdentity, MobileNetworkProvisioningState? provisioningState, MobileNetworkInstallation installation, IList sites, MobileNetworkPlatformConfiguration platform, MobileNetworkCoreNetworkType? coreNetworkTechnology, string version, string installedVersion, string rollbackVersion, MobileNetworkInterfaceProperties controlPlaneAccessInterface, MobileNetworkBillingSku sku, int? ueMtu, MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess, DiagnosticsUploadConfiguration diagnosticsUpload, BinaryData interopSettings) : base(id, name, resourceType, systemData, tags, location) + internal PacketCoreControlPlaneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MobileNetworkManagedServiceIdentity userAssignedIdentity, MobileNetworkProvisioningState? provisioningState, MobileNetworkInstallation installation, IList sites, MobileNetworkPlatformConfiguration platform, MobileNetworkCoreNetworkType? coreNetworkTechnology, string version, string installedVersion, string rollbackVersion, MobileNetworkInterfaceProperties controlPlaneAccessInterface, IList controlPlaneAccessVirtualIPv4Addresses, MobileNetworkBillingSku sku, int? ueMtu, MobileNetworkLocalDiagnosticsAccessConfiguration localDiagnosticsAccess, DiagnosticsUploadConfiguration diagnosticsUpload, MobileNetworkEventHubConfiguration eventHub, SignalingConfiguration signaling, BinaryData interopSettings) : base(id, name, resourceType, systemData, tags, location) { UserAssignedIdentity = userAssignedIdentity; ProvisioningState = provisioningState; @@ -77,10 +81,13 @@ internal PacketCoreControlPlaneData(ResourceIdentifier id, string name, Resource InstalledVersion = installedVersion; RollbackVersion = rollbackVersion; ControlPlaneAccessInterface = controlPlaneAccessInterface; + ControlPlaneAccessVirtualIPv4Addresses = controlPlaneAccessVirtualIPv4Addresses; Sku = sku; UeMtu = ueMtu; LocalDiagnosticsAccess = localDiagnosticsAccess; DiagnosticsUpload = diagnosticsUpload; + EventHub = eventHub; + Signaling = signaling; InteropSettings = interopSettings; } @@ -104,6 +111,8 @@ internal PacketCoreControlPlaneData(ResourceIdentifier id, string name, Resource public string RollbackVersion { get; } /// The control plane interface on the access network. For 5G networks, this is the N2 interface. For 4G networks, this is the S1-MME interface. public MobileNetworkInterfaceProperties ControlPlaneAccessInterface { get; set; } + /// The virtual IP address(es) for the control plane on the access network in a High Availability (HA) system. In an HA deployment the access network router should be configured to anycast traffic for this address to the control plane access interfaces on the active and standby nodes. In non-HA system this list should be omitted or empty. + public IList ControlPlaneAccessVirtualIPv4Addresses { get; } /// The SKU defining the throughput and SIM allowances for this packet core control plane deployment. public MobileNetworkBillingSku Sku { get; set; } /// The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links for all data networks. The MTU set on the user plane access link is calculated to be 60 bytes greater than this value to allow for GTP encapsulation. @@ -119,6 +128,29 @@ public Uri DiagnosticsUploadStorageAccountContainerUri set => DiagnosticsUpload = new DiagnosticsUploadConfiguration(value); } + /// Configuration for sending packet core events to an Azure Event Hub. + public MobileNetworkEventHubConfiguration EventHub { get; set; } + /// Signaling configuration for the packet core. + internal SignalingConfiguration Signaling { get; set; } + /// The macro network's MME group ID. This is where unknown UEs are sent to via NAS reroute. + public int? NasRerouteMacroMmeGroupId + { + get => Signaling is null ? default : Signaling.NasRerouteMacroMmeGroupId; + set + { + if (value.HasValue) + { + if (Signaling is null) + Signaling = new SignalingConfiguration(); + Signaling.NasRerouteMacroMmeGroupId = value.Value; + } + else + { + Signaling = null; + } + } + } + /// /// Settings to allow interoperability with third party components e.g. RANs and UEs. /// diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneResource.cs index b46d3497179a0..1e70b9dc51bcd 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.MobileNetwork public partial class PacketCoreControlPlaneResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The packetCoreControlPlaneName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string packetCoreControlPlaneName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MobileNetworkDiagnosticsPackageResources and their operations over a MobileNetworkDiagnosticsPackageResource. public virtual MobileNetworkDiagnosticsPackageCollection GetMobileNetworkDiagnosticsPackages() { - return GetCachedClient(Client => new MobileNetworkDiagnosticsPackageCollection(Client, Id)); + return GetCachedClient(client => new MobileNetworkDiagnosticsPackageCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual MobileNetworkDiagnosticsPackageCollection GetMobileNetworkDiagnos /// /// The name of the diagnostics package. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileNetworkDiagnosticsPackageAsync(string diagnosticsPackageName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> Get /// /// The name of the diagnostics package. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileNetworkDiagnosticsPackage(string diagnosticsPackageName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetMobileNetwor /// An object representing collection of MobileNetworkPacketCaptureResources and their operations over a MobileNetworkPacketCaptureResource. public virtual MobileNetworkPacketCaptureCollection GetMobileNetworkPacketCaptures() { - return GetCachedClient(Client => new MobileNetworkPacketCaptureCollection(Client, Id)); + return GetCachedClient(client => new MobileNetworkPacketCaptureCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual MobileNetworkPacketCaptureCollection GetMobileNetworkPacketCaptur /// /// The name of the packet capture session. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileNetworkPacketCaptureAsync(string packetCaptureName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetMobil /// /// The name of the packet capture session. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileNetworkPacketCapture(string packetCaptureName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetMobileNetworkPack /// An object representing collection of PacketCoreDataPlaneResources and their operations over a PacketCoreDataPlaneResource. public virtual PacketCoreDataPlaneCollection GetPacketCoreDataPlanes() { - return GetCachedClient(Client => new PacketCoreDataPlaneCollection(Client, Id)); + return GetCachedClient(client => new PacketCoreDataPlaneCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual PacketCoreDataPlaneCollection GetPacketCoreDataPlanes() /// /// The name of the packet core data plane. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPacketCoreDataPlaneAsync(string packetCoreDataPlaneName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetPacketCoreDa /// /// The name of the packet core data plane. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPacketCoreDataPlane(string packetCoreDataPlaneName, CancellationToken cancellationToken = default) { diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneData.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneData.cs index 364b6aed35789..0fa17ce669ee4 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneData.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneData.cs @@ -28,6 +28,7 @@ public PacketCoreDataPlaneData(AzureLocation location, MobileNetworkInterfacePro Argument.AssertNotNull(userPlaneAccessInterface, nameof(userPlaneAccessInterface)); UserPlaneAccessInterface = userPlaneAccessInterface; + UserPlaneAccessVirtualIPv4Addresses = new ChangeTrackingList(); } /// Initializes a new instance of PacketCoreDataPlaneData. @@ -39,15 +40,19 @@ public PacketCoreDataPlaneData(AzureLocation location, MobileNetworkInterfacePro /// The location. /// The provisioning state of the packet core data plane resource. /// The user plane interface on the access network. For 5G networks, this is the N3 interface. For 4G networks, this is the S1-U interface. - internal PacketCoreDataPlaneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MobileNetworkProvisioningState? provisioningState, MobileNetworkInterfaceProperties userPlaneAccessInterface) : base(id, name, resourceType, systemData, tags, location) + /// The virtual IP address(es) for the user plane on the access network in a High Availability (HA) system. In an HA deployment the access network router should be configured to forward traffic for this address to the control plane access interface on the active or standby node. In non-HA system this list should be omitted or empty. + internal PacketCoreDataPlaneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MobileNetworkProvisioningState? provisioningState, MobileNetworkInterfaceProperties userPlaneAccessInterface, IList userPlaneAccessVirtualIPv4Addresses) : base(id, name, resourceType, systemData, tags, location) { ProvisioningState = provisioningState; UserPlaneAccessInterface = userPlaneAccessInterface; + UserPlaneAccessVirtualIPv4Addresses = userPlaneAccessVirtualIPv4Addresses; } /// The provisioning state of the packet core data plane resource. public MobileNetworkProvisioningState? ProvisioningState { get; } /// The user plane interface on the access network. For 5G networks, this is the N3 interface. For 4G networks, this is the S1-U interface. public MobileNetworkInterfaceProperties UserPlaneAccessInterface { get; set; } + /// The virtual IP address(es) for the user plane on the access network in a High Availability (HA) system. In an HA deployment the access network router should be configured to forward traffic for this address to the control plane access interface on the active or standby node. In non-HA system this list should be omitted or empty. + public IList UserPlaneAccessVirtualIPv4Addresses { get; } } } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneResource.cs index a36a93d37bc22..22a76a0b200ab 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.MobileNetwork public partial class PacketCoreDataPlaneResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The packetCoreControlPlaneName. + /// The packetCoreDataPlaneName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string packetCoreControlPlaneName, string packetCoreDataPlaneName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MobileAttachedDataNetworkResources and their operations over a MobileAttachedDataNetworkResource. public virtual MobileAttachedDataNetworkCollection GetMobileAttachedDataNetworks() { - return GetCachedClient(Client => new MobileAttachedDataNetworkCollection(Client, Id)); + return GetCachedClient(client => new MobileAttachedDataNetworkCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual MobileAttachedDataNetworkCollection GetMobileAttachedDataNetworks /// /// The name of the attached data network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMobileAttachedDataNetworkAsync(string attachedDataNetworkName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetMobile /// /// The name of the attached data network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMobileAttachedDataNetwork(string attachedDataNetworkName, CancellationToken cancellationToken = default) { diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/AttachedDataNetworksRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/AttachedDataNetworksRestOperations.cs index 5658b6021b69c..8f2ea6ce83822 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/AttachedDataNetworksRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/AttachedDataNetworksRestOperations.cs @@ -33,7 +33,7 @@ public AttachedDataNetworksRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/DataNetworksRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/DataNetworksRestOperations.cs index 5b6fed5b0ab37..2e1ec22172dac 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/DataNetworksRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/DataNetworksRestOperations.cs @@ -33,7 +33,7 @@ public DataNetworksRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/DiagnosticsPackagesRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/DiagnosticsPackagesRestOperations.cs index 60ce66fc0e04c..ddb7597a205f5 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/DiagnosticsPackagesRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/DiagnosticsPackagesRestOperations.cs @@ -33,7 +33,7 @@ public DiagnosticsPackagesRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/MobileNetworksRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/MobileNetworksRestOperations.cs index a786d2c5d981b..51c2eb05a819b 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/MobileNetworksRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/MobileNetworksRestOperations.cs @@ -33,7 +33,7 @@ public MobileNetworksRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCapturesRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCapturesRestOperations.cs index c19f13e3cbeb9..e8e645cc174b9 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCapturesRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCapturesRestOperations.cs @@ -33,7 +33,7 @@ public PacketCapturesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreControlPlaneVersionsRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreControlPlaneVersionsRestOperations.cs index dd9f187f5093d..8020028cb2257 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreControlPlaneVersionsRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreControlPlaneVersionsRestOperations.cs @@ -33,7 +33,7 @@ public PacketCoreControlPlaneVersionsRestOperations(HttpPipeline pipeline, strin { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreControlPlanesRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreControlPlanesRestOperations.cs index 3b1a6f6dcb173..3dc045eaa36e1 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreControlPlanesRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreControlPlanesRestOperations.cs @@ -33,7 +33,7 @@ public PacketCoreControlPlanesRestOperations(HttpPipeline pipeline, string appli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreDataPlanesRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreDataPlanesRestOperations.cs index 2c4263827644e..2e14a675aa187 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreDataPlanesRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/PacketCoreDataPlanesRestOperations.cs @@ -33,7 +33,7 @@ public PacketCoreDataPlanesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/ServicesRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/ServicesRestOperations.cs index 7e3ee988bebb1..4999b42d43f45 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/ServicesRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/ServicesRestOperations.cs @@ -33,7 +33,7 @@ public ServicesRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimGroupsRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimGroupsRestOperations.cs index b00d7a9c610ac..8441fd60631a1 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimGroupsRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimGroupsRestOperations.cs @@ -33,7 +33,7 @@ public SimGroupsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimPoliciesRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimPoliciesRestOperations.cs index bfa7a4e76f370..6e9bd865f457b 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimPoliciesRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimPoliciesRestOperations.cs @@ -33,7 +33,7 @@ public SimPoliciesRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimsRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimsRestOperations.cs index 425657bbca6a3..e500597baea22 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimsRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SimsRestOperations.cs @@ -33,7 +33,7 @@ public SimsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpo { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SitesRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SitesRestOperations.cs index 1ed7abec956b5..055167c6df5c4 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SitesRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SitesRestOperations.cs @@ -33,7 +33,7 @@ public SitesRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SlicesRestOperations.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SlicesRestOperations.cs index 88007fbc8b785..8cbe399ea24bd 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SlicesRestOperations.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/RestOperations/SlicesRestOperations.cs @@ -33,7 +33,7 @@ public SlicesRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/SubscriptionPacketCoreControlPlaneVersionResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/SubscriptionPacketCoreControlPlaneVersionResource.cs index 15c0d09649972..f0ae485660c16 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/SubscriptionPacketCoreControlPlaneVersionResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/SubscriptionPacketCoreControlPlaneVersionResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.MobileNetwork public partial class SubscriptionPacketCoreControlPlaneVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The versionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string versionName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/TenantPacketCoreControlPlaneVersionResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/TenantPacketCoreControlPlaneVersionResource.cs index ba155bb79fa25..a20a2a7550d56 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/TenantPacketCoreControlPlaneVersionResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/TenantPacketCoreControlPlaneVersionResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.MobileNetwork public partial class TenantPacketCoreControlPlaneVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The versionName. public static ResourceIdentifier CreateResourceIdentifier(string versionName) { var resourceId = $"/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}"; diff --git a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/autorest.md b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/autorest.md index 4e7b6efa58abf..e819de9bdfd88 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/autorest.md +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true csharp: true library-name: MobileNetwork namespace: Azure.ResourceManager.MobileNetwork -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a8cb7f03bd77ce9162e96592bfbeb1e0b2060262/specification/mobilenetwork/resource-manager/readme.md +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ebb588db81c5b2c46f6a0bbb0c8ee6da3bc410dc/specification/mobilenetwork/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true @@ -107,6 +107,8 @@ rename-mapping: DiagnosticsPackage: MobileNetworkDiagnosticsPackage DataNetwork: MobileDataNetwork AttachedDataNetwork: MobileAttachedDataNetwork + EventHubConfiguration: MobileNetworkEventHubConfiguration + EventHubConfiguration.id: -|arm-id directive: diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/CHANGELOG.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/CHANGELOG.md index 86b4c17399db5..30df46c5e3ccb 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/CHANGELOG.md +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/CHANGELOG.md @@ -15,13 +15,30 @@ ### Bugs Fixed * Fixed an issue during network failures which prevented the exporter to store -the telemetry offline for retrying at a later time. -([#38832](https://github.com/Azure/azure-sdk-for-net/pull/38832)) + the telemetry offline for retrying at a later time. + ([#38832](https://github.com/Azure/azure-sdk-for-net/pull/38832)) * Fixed an issue where `OriginalFormat` persisted in TraceTelemetry properties - with IncludeFormattedMessage enabled in OpenTelemetry LoggerProvider. This fix - prevents data duplication in message fields and properties. + with IncludeFormattedMessage set to true on [ + OpenTelemetryLoggerOptions](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggerOptions.cs) + of the OpenTelemetry LoggerProvider. This fix prevents data duplication in + message fields and properties. ([#39308](https://github.com/Azure/azure-sdk-for-net/pull/39308)) + +* Fixed an issue related to the processing of scopes that do not conform to a + key-value pair structure. + ([#39453](https://github.com/Azure/azure-sdk-for-net/pull/39453)) + * **Previous Behavior**: Logging a scope with a statement like + `logger.BeginScope("SomeScopeValue")` would result in adding + 'SomeScopeValue' to the properties using a key that follows the pattern + 'scope->*'. Additionally, 'OriginalFormatScope_*' keys were used to handle + formatted strings within the scope. + * **New Behavior**: + * Non-key-value pair scopes are no longer added to the properties, + resulting in cleaner and more efficient log output. + * 'OriginalFormatScope_*' keys have been removed. + * In case of duplicate keys within the scopes, only the first entry is + retained, while all subsequent duplicate entries are discarded. ### Other Changes diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/api/Azure.Monitor.OpenTelemetry.Exporter.net6.0.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/api/Azure.Monitor.OpenTelemetry.Exporter.net6.0.cs new file mode 100644 index 0000000000000..df4fa7a160503 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/api/Azure.Monitor.OpenTelemetry.Exporter.net6.0.cs @@ -0,0 +1,24 @@ +namespace Azure.Monitor.OpenTelemetry.Exporter +{ + public static partial class AzureMonitorExporterExtensions + { + public static OpenTelemetry.Logs.OpenTelemetryLoggerOptions AddAzureMonitorLogExporter(this OpenTelemetry.Logs.OpenTelemetryLoggerOptions loggerOptions, System.Action configure = null, Azure.Core.TokenCredential credential = null) { throw null; } + public static OpenTelemetry.Metrics.MeterProviderBuilder AddAzureMonitorMetricExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Action configure = null, Azure.Core.TokenCredential credential = null, string name = null) { throw null; } + public static OpenTelemetry.Trace.TracerProviderBuilder AddAzureMonitorTraceExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configure = null, Azure.Core.TokenCredential credential = null, string name = null) { throw null; } + } + public partial class AzureMonitorExporterOptions : Azure.Core.ClientOptions + { + public AzureMonitorExporterOptions() { } + public AzureMonitorExporterOptions(Azure.Monitor.OpenTelemetry.Exporter.AzureMonitorExporterOptions.ServiceVersion version = Azure.Monitor.OpenTelemetry.Exporter.AzureMonitorExporterOptions.ServiceVersion.v2_1) { } + public string ConnectionString { get { throw null; } set { } } + public Azure.Core.TokenCredential Credential { get { throw null; } set { } } + public bool DisableOfflineStorage { get { throw null; } set { } } + public float SamplingRatio { get { throw null; } set { } } + public string StorageDirectory { get { throw null; } set { } } + public Azure.Monitor.OpenTelemetry.Exporter.AzureMonitorExporterOptions.ServiceVersion Version { get { throw null; } set { } } + public enum ServiceVersion + { + v2_1 = 1, + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Azure.Monitor.OpenTelemetry.Exporter.csproj b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Azure.Monitor.OpenTelemetry.Exporter.csproj index cc8552a467788..aee2032344f7e 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Azure.Monitor.OpenTelemetry.Exporter.csproj +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Azure.Monitor.OpenTelemetry.Exporter.csproj @@ -9,6 +9,7 @@ net6.0;$(RequiredTargetFrameworks) true + $(DefineConstants);AZURE_MONITOR_EXPORTER; diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/ConnectionStringParser.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/ConnectionStringParser.cs index 9075238955ccd..321e9230d3d20 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/ConnectionStringParser.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/ConnectionStringParser.cs @@ -4,7 +4,11 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; +#if AZURE_MONITOR_EXPORTER using Azure.Monitor.OpenTelemetry.Exporter.Internals.Diagnostics; +#elif LIVE_METRICS_EXPORTER +using Azure.Monitor.OpenTelemetry.LiveMetrics.Internals.Diagnostics; +#endif // This alias is necessary because it will otherwise try to default to "Microsoft.Azure.Core" which doesn't exist. using AzureCoreConnectionString = Azure.Core.ConnectionString; @@ -41,11 +45,16 @@ public static ConnectionVars GetValues(string connectionString) return new ConnectionVars( instrumentationKey: connString.GetInstrumentationKey(), ingestionEndpoint: connString.GetIngestionEndpoint(), + liveEndpoint: connString.GetLiveEndpoint(), aadAudience: connString.GetAADAudience()); } catch (Exception ex) { +#if AZURE_MONITOR_EXPORTER AzureMonitorExporterEventSource.Log.FailedToParseConnectionString(ex); +#elif LIVE_METRICS_EXPORTER + LiveMetricsExporterEventSource.Log.FailedToParseConnectionString(ex); +#endif throw new InvalidOperationException("Connection String Error: " + ex.Message, ex); } } @@ -54,6 +63,12 @@ public static ConnectionVars GetValues(string connectionString) internal static string GetInstrumentationKey(this AzureCoreConnectionString connectionString) => connectionString.GetRequired(Constants.InstrumentationKeyKey); + internal static string GetIngestionEndpoint(this AzureCoreConnectionString connectionString) => + connectionString.GetEndpoint(endpointKeyName: Constants.IngestionExplicitEndpointKey, prefix: Constants.IngestionPrefix, defaultValue: Constants.DefaultIngestionEndpoint); + + internal static string GetLiveEndpoint(this AzureCoreConnectionString connectionString) => + connectionString.GetEndpoint(endpointKeyName: Constants.LiveExplicitEndpointKey, prefix: Constants.LivePrefix, defaultValue: Constants.DefaultLiveEndpoint); + /// /// Evaluate connection string and return the requested endpoint. /// @@ -64,29 +79,29 @@ public static ConnectionVars GetValues(string connectionString) /// 3. use default endpoint (location is ignored) /// This behavior is required by the Connection String Specification. /// - internal static string GetIngestionEndpoint(this AzureCoreConnectionString connectionString) + internal static string GetEndpoint(this AzureCoreConnectionString connectionString, string endpointKeyName, string prefix, string defaultValue) { // Passing the user input values through the Uri constructor will verify that we've built a valid endpoint. Uri? uri; - if (connectionString.TryGetNonRequiredValue(Constants.IngestionExplicitEndpointKey, out string? explicitEndpoint)) + if (connectionString.TryGetNonRequiredValue(endpointKeyName, out string? explicitEndpoint)) { if (!Uri.TryCreate(explicitEndpoint, UriKind.Absolute, out uri)) { - throw new ArgumentException($"The value for {Constants.IngestionExplicitEndpointKey} is invalid. '{explicitEndpoint}'"); + throw new ArgumentException($"The value for {endpointKeyName} is invalid. '{explicitEndpoint}'"); } } else if (connectionString.TryGetNonRequiredValue(Constants.EndpointSuffixKey, out string? endpointSuffix)) { var location = connectionString.GetNonRequired(Constants.LocationKey); - if (!TryBuildUri(prefix: Constants.IngestionPrefix, suffix: endpointSuffix, location: location, uri: out uri)) + if (!TryBuildUri(prefix: prefix, suffix: endpointSuffix, location: location, uri: out uri)) { throw new ArgumentException($"The value for {Constants.EndpointSuffixKey} is invalid. '{endpointSuffix}'"); } } else { - return Constants.DefaultIngestionEndpoint; + return defaultValue; } return uri.AbsoluteUri; diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/ConnectionVars.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/ConnectionVars.cs index 5f063ee42b78f..e92bd5b629040 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/ConnectionVars.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/ConnectionVars.cs @@ -8,10 +8,11 @@ namespace Azure.Monitor.OpenTelemetry.Exporter.Internals.ConnectionString /// internal class ConnectionVars { - public ConnectionVars(string instrumentationKey, string ingestionEndpoint, string? aadAudience) + public ConnectionVars(string instrumentationKey, string ingestionEndpoint, string liveEndpoint, string? aadAudience) { this.InstrumentationKey = instrumentationKey; this.IngestionEndpoint = ingestionEndpoint; + this.LiveEndpoint = liveEndpoint; this.AadAudience = aadAudience; } @@ -19,6 +20,8 @@ public ConnectionVars(string instrumentationKey, string ingestionEndpoint, strin public string IngestionEndpoint { get; } + public string LiveEndpoint { get; } + public string? AadAudience { get; } } } diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/Constants.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/Constants.cs index 3c558cbb203d1..d2dfe33997b11 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/Constants.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ConnectionString/Constants.cs @@ -10,16 +10,31 @@ internal static class Constants /// internal const string DefaultIngestionEndpoint = "https://dc.services.visualstudio.com/"; + /// + /// Default endpoint for Live Metrics (aka QuickPulse). + /// + internal const string DefaultLiveEndpoint = "https://rt.services.visualstudio.com/"; + /// /// Sub-domain for Ingestion endpoint (aka Breeze). (https://dc.applicationinsights.azure.com/). /// internal const string IngestionPrefix = "dc"; + /// + /// Sub-domain for Live Metrics endpoint (aka QuickPulse). (https://live.applicationinsights.azure.com/). + /// + internal const string LivePrefix = "live"; + /// /// This is the key that a customer would use to specify an explicit endpoint in the connection string. /// internal const string IngestionExplicitEndpointKey = "IngestionEndpoint"; + /// + /// This is the key that a customer would use to specify an explicit endpoint in the connection string. + /// + internal const string LiveExplicitEndpointKey = "LiveEndpoint"; + /// /// This is the key that a customer would use to specify an instrumentation key in the connection string. /// diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Diagnostics/AzureMonitorExporterEventSource.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Diagnostics/AzureMonitorExporterEventSource.cs index a72f015fbcc1f..f09ce334cd498 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Diagnostics/AzureMonitorExporterEventSource.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Diagnostics/AzureMonitorExporterEventSource.cs @@ -395,5 +395,41 @@ public void PartialContentResponseUnhandled(TelemetryErrorDetails error) [Event(39, Message = "Received a partial success from ingestion. This status code is not handled and telemetry will be lost. Error StatusCode: {0}. Error Message: {1}", Level = EventLevel.Warning)] public void PartialContentResponseUnhandled(string errorStatusCode, string errorMessage) => WriteEvent(39, errorStatusCode, errorMessage); + + [NonEvent] + public void FailedToAddScopeItem(string key, Exception ex) + { + if (IsEnabled(EventLevel.Warning)) + { + FailedToAddScopeItem(key, ex.FlattenException().ToInvariantString()); + } + } + + [Event(40, Message = "An exception {1} occurred while adding the scope value associated with the key {0}", Level = EventLevel.Warning)] + public void FailedToAddScopeItem(string key, string exceptionMessage) => WriteEvent(40, key, exceptionMessage); + + [NonEvent] + public void FailedToAddLogAttribute(string key, Exception ex) + { + if (IsEnabled(EventLevel.Warning)) + { + FailedToAddLogAttribute(key, ex.FlattenException().ToInvariantString()); + } + } + + [Event(41, Message = "An exception {1} occurred while adding the log attribute associated with the key {0}", Level = EventLevel.Warning)] + public void FailedToAddLogAttribute(string key, string exceptionMessage) => WriteEvent(41, key, exceptionMessage); + + [NonEvent] + public void FailedToReadEnvironmentVariables(Exception ex) + { + if (IsEnabled(EventLevel.Warning)) + { + FailedToReadEnvironmentVariables(ex.FlattenException().ToInvariantString()); + } + } + + [Event(42, Message = "Failed to read environment variables due to an exception. This may prevent the Exporter from initializing. {0}", Level = EventLevel.Warning)] + public void FailedToReadEnvironmentVariables(string errorMessage) => WriteEvent(42, errorMessage); } } diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/LogsHelper.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/LogsHelper.cs index e64c3867cd72f..ed12e8d3776f6 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/LogsHelper.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/LogsHelper.cs @@ -2,13 +2,11 @@ // Licensed under the MIT License. using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; -using System.Text; using Azure.Monitor.OpenTelemetry.Exporter.Internals.Diagnostics; using Azure.Monitor.OpenTelemetry.Exporter.Models; @@ -22,8 +20,32 @@ namespace Azure.Monitor.OpenTelemetry.Exporter.Internals internal static class LogsHelper { private const int Version = 2; - private static readonly ConcurrentDictionary s_depthCache = new ConcurrentDictionary(); - private static readonly Func s_convertDepthToStringRef = ConvertDepthToString; + private static readonly Action> s_processScope = (scope, properties) => + { + foreach (KeyValuePair scopeItem in scope) + { + if (string.IsNullOrEmpty(scopeItem.Key) || scopeItem.Key == "{OriginalFormat}") + { + continue; + } + + // Note: if Key exceeds MaxLength, the entire KVP will be dropped. + if (scopeItem.Key.Length <= SchemaConstants.MessageData_Properties_MaxKeyLength && scopeItem.Value != null) + { + try + { + if (!properties.ContainsKey(scopeItem.Key)) + { + properties.Add(scopeItem.Key, Convert.ToString(scopeItem.Value, CultureInfo.InvariantCulture)?.Truncate(SchemaConstants.MessageData_Properties_MaxValueLength)!); + } + } + catch (Exception ex) + { + AzureMonitorExporterEventSource.Log.FailedToAddScopeItem(scopeItem.Key, ex); + } + } + } + }; internal static List OtelToAzureMonitorLogs(Batch batchLogRecord, AzureMonitorResource? resource, string instrumentationKey) { @@ -69,28 +91,38 @@ internal static List OtelToAzureMonitorLogs(Batch batc foreach (KeyValuePair item in logRecord.Attributes ?? Enumerable.Empty>()) { - if (item.Key.Length <= SchemaConstants.KVP_MaxKeyLength && item.Value != null) + // Note: if Key exceeds MaxLength, the entire KVP will be dropped. + if (item.Key.Length <= SchemaConstants.MessageData_Properties_MaxKeyLength && item.Value != null) { - // Note: if Key exceeds MaxLength, the entire KVP will be dropped. - if (item.Key == "{OriginalFormat}") + try { - if (logRecord.Exception?.Message != null) + if (item.Key == "{OriginalFormat}") { - properties.Add("OriginalFormat", item.Value.ToString().Truncate(SchemaConstants.KVP_MaxValueLength) ?? "null"); + if (logRecord.Exception?.Message != null) + { + properties.Add("OriginalFormat", item.Value.ToString().Truncate(SchemaConstants.MessageData_Properties_MaxValueLength)!); + } + else if (message == null) + { + message = item.Value.ToString(); + } } - else if (message == null) + else { - message = item.Value.ToString(); + if (!properties.ContainsKey(item.Key)) + { + properties.Add(item.Key, item.Value.ToString().Truncate(SchemaConstants.MessageData_Properties_MaxValueLength)!); + } } } - else + catch (Exception ex) { - properties.Add(item.Key, item.Value.ToString().Truncate(SchemaConstants.KVP_MaxValueLength) ?? "null"); + AzureMonitorExporterEventSource.Log.FailedToAddLogAttribute(item.Key, ex); } } } - WriteScopeInformation(logRecord, properties); + logRecord.ForEachScope(s_processScope, properties); if (logRecord.EventId.Id != 0) { @@ -105,49 +137,6 @@ internal static List OtelToAzureMonitorLogs(Batch batc return message; } - internal static void WriteScopeInformation(LogRecord logRecord, IDictionary properties) - { - StringBuilder? builder = null; - int originalScopeDepth = 1; - logRecord.ForEachScope(ProcessScope, properties); - - void ProcessScope(LogRecordScope scope, IDictionary properties) - { - int valueDepth = 1; - foreach (KeyValuePair scopeItem in scope) - { - if (string.IsNullOrEmpty(scopeItem.Key)) - { - builder ??= new StringBuilder(); - builder.Append(" => ").Append(scope.Scope); - } - else if (scopeItem.Key == "{OriginalFormat}") - { - properties.Add($"OriginalFormatScope_{s_depthCache.GetOrAdd(originalScopeDepth, s_convertDepthToStringRef)}", - Convert.ToString(scope.Scope, CultureInfo.InvariantCulture) ?? "null"); - } - else if (!properties.TryGetValue(scopeItem.Key, out _)) - { - properties.Add(scopeItem.Key, - Convert.ToString(scopeItem.Value, CultureInfo.InvariantCulture) ?? "null"); - } - else - { - properties.Add($"{scopeItem.Key}_{s_depthCache.GetOrAdd(originalScopeDepth, s_convertDepthToStringRef)}_{s_depthCache.GetOrAdd(valueDepth, s_convertDepthToStringRef)}", - Convert.ToString(scopeItem.Value, CultureInfo.InvariantCulture) ?? "null"); - valueDepth++; - } - } - - originalScopeDepth++; - } - - if (builder?.Length > 0) - { - properties.Add("Scope", builder.ToString().Truncate(SchemaConstants.KVP_MaxValueLength)); - } - } - internal static string GetProblemId(Exception exception) { string methodName = "UnknownMethod"; @@ -210,7 +199,5 @@ internal static SeverityLevel GetSeverityLevel(LogLevel logLevel) return SeverityLevel.Verbose; } } - - private static string ConvertDepthToString(int depth) => $"{depth}"; } } diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/PersistentStorage/StorageHelper.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/PersistentStorage/StorageHelper.cs index ca811bbd41dfb..ef5add00632cc 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/PersistentStorage/StorageHelper.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/PersistentStorage/StorageHelper.cs @@ -2,9 +2,9 @@ // Licensed under the MIT License. using System; -using System.Collections; using System.IO; using System.Runtime.InteropServices; +using Azure.Monitor.OpenTelemetry.Exporter.Internals.Diagnostics; using Azure.Monitor.OpenTelemetry.Exporter.Internals.Platform; namespace Azure.Monitor.OpenTelemetry.Exporter.Internals.PersistentStorage @@ -30,19 +30,18 @@ internal static string GetStorageDirectory(IPlatform platform, string? configure internal static string? GetDefaultStorageDirectory(IPlatform platform) { string? dirPath; - IDictionary environmentVars = platform.GetEnvironmentVariables(); if (platform.IsOSPlatform(OSPlatform.Windows)) { - if (TryCreateTelemetryDirectory(platform: platform, path: environmentVars[EnvironmentVariableConstants.LOCALAPPDATA]?.ToString(), createdDirectoryPath: out dirPath) - || TryCreateTelemetryDirectory(platform: platform, path: environmentVars[EnvironmentVariableConstants.TEMP]?.ToString(), createdDirectoryPath: out dirPath)) + if (TryCreateTelemetryDirectory(platform: platform, path: platform.GetEnvironmentVariable(EnvironmentVariableConstants.LOCALAPPDATA), createdDirectoryPath: out dirPath) + || TryCreateTelemetryDirectory(platform: platform, path: platform.GetEnvironmentVariable(EnvironmentVariableConstants.TEMP), createdDirectoryPath: out dirPath)) { return dirPath; } } else { - if (TryCreateTelemetryDirectory(platform: platform, path: environmentVars[EnvironmentVariableConstants.TMPDIR]?.ToString(), createdDirectoryPath: out dirPath) + if (TryCreateTelemetryDirectory(platform: platform, path: platform.GetEnvironmentVariable(EnvironmentVariableConstants.TMPDIR), createdDirectoryPath: out dirPath) || TryCreateTelemetryDirectory(platform: platform, path: "/var/tmp/", createdDirectoryPath: out dirPath) || TryCreateTelemetryDirectory(platform: platform, path: "/tmp/", createdDirectoryPath: out dirPath)) { @@ -70,7 +69,16 @@ private static bool TryCreateTelemetryDirectory(IPlatform platform, string? path // these names need to be separate to use the correct OS specific DirectorySeparatorChar. createdDirectoryPath = Path.Combine(path, "Microsoft", "AzureMonitor"); - return platform.CreateDirectory(createdDirectoryPath); + try + { + platform.CreateDirectory(createdDirectoryPath); + return true; + } + catch (Exception ex) + { + AzureMonitorExporterEventSource.Log.ErrorCreatingStorageFolder(path, ex); + return false; + } } } } diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/DefaultPlatform.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/DefaultPlatform.cs index 806aad6a81df4..e1ec8ef3d47dd 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/DefaultPlatform.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/DefaultPlatform.cs @@ -3,18 +3,41 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; + +#if AZURE_MONITOR_EXPORTER using Azure.Monitor.OpenTelemetry.Exporter.Internals.Diagnostics; +#elif LIVE_METRICS_EXPORTER +using Azure.Monitor.OpenTelemetry.LiveMetrics.Internals.Diagnostics; +#endif namespace Azure.Monitor.OpenTelemetry.Exporter.Internals.Platform { internal class DefaultPlatform : IPlatform { - public string? GetEnvironmentVariable(string name) => Environment.GetEnvironmentVariable(name); + private readonly IDictionary _environmentVariables; + + public DefaultPlatform() + { + try + { + _environmentVariables = Environment.GetEnvironmentVariables(); + } + catch (Exception ex) + { +#if AZURE_MONITOR_EXPORTER + AzureMonitorExporterEventSource.Log.FailedToReadEnvironmentVariables(ex); +#elif LIVE_METRICS_EXPORTER + LiveMetricsExporterEventSource.Log.FailedToReadEnvironmentVariables(ex); +#endif + _environmentVariables = new Dictionary(); + } + } - public IDictionary GetEnvironmentVariables() => Environment.GetEnvironmentVariables(); + public string? GetEnvironmentVariable(string name) => _environmentVariables[name]?.ToString(); public string GetOSPlatformName() { @@ -36,19 +59,12 @@ public string GetOSPlatformName() public bool IsOSPlatform(OSPlatform osPlatform) => RuntimeInformation.IsOSPlatform(osPlatform); - public bool CreateDirectory(string path) - { - try - { - Directory.CreateDirectory(path); - return true; - } - catch (Exception ex) - { - AzureMonitorExporterEventSource.Log.ErrorCreatingStorageFolder(path, ex); - return false; - } - } + /// + /// Creates all directories and subdirectories in the specified path unless they already exist. + /// + /// This method does not catch any exceptions thrown by . + /// The directory to create + public void CreateDirectory(string path) => Directory.CreateDirectory(path); public string GetEnvironmentUserName() => Environment.UserName; diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/EnvironmentVariableConstants.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/EnvironmentVariableConstants.cs similarity index 89% rename from sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/EnvironmentVariableConstants.cs rename to sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/EnvironmentVariableConstants.cs index 000f17a3bc08c..04fdf154e43c2 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/EnvironmentVariableConstants.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/EnvironmentVariableConstants.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -namespace Azure.Monitor.OpenTelemetry.Exporter.Internals +namespace Azure.Monitor.OpenTelemetry.Exporter.Internals.Platform { internal static class EnvironmentVariableConstants { @@ -56,6 +56,11 @@ internal static class EnvironmentVariableConstants /// public const string WEBSITE_SITE_NAME = "WEBSITE_SITE_NAME"; + /// + /// INTERNAL ONLY. Used by Statsbeat to get the AKS ARM Namespace ID for AKS auto-instrumentation. + /// + public const string AKS_ARM_NAMESPACE_ID = "AKS_ARM_NAMESPACE_ID"; + /// /// When set to true, exporter will emit resources as metric telemetry. /// diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/IPlatform.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/IPlatform.cs index 453809c78aee1..c81aa2dcb8eec 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/IPlatform.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/IPlatform.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Collections; using System.Runtime.InteropServices; namespace Azure.Monitor.OpenTelemetry.Exporter.Internals.Platform @@ -15,13 +14,11 @@ internal interface IPlatform /// public string? GetEnvironmentVariable(string name); - public IDictionary GetEnvironmentVariables(); - public bool IsOSPlatform(OSPlatform osPlatform); public string GetOSPlatformName(); - public bool CreateDirectory(string path); + public void CreateDirectory(string path); public string GetEnvironmentUserName(); diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ResourceExtensions.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ResourceExtensions.cs index f38ca549afd76..2c4dd69b12566 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ResourceExtensions.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ResourceExtensions.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Net; using Azure.Monitor.OpenTelemetry.Exporter.Internals.Diagnostics; +using Azure.Monitor.OpenTelemetry.Exporter.Internals.Platform; using Azure.Monitor.OpenTelemetry.Exporter.Models; using OpenTelemetry.Resources; diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Statsbeat/AzureMonitorStatsbeat.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Statsbeat/AzureMonitorStatsbeat.cs index e505abaf2ff91..d06000528606a 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Statsbeat/AzureMonitorStatsbeat.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Statsbeat/AzureMonitorStatsbeat.cs @@ -189,6 +189,15 @@ private void SetResourceProviderDetails(IPlatform platform) return; } + var aksArmNamespaceId = platform.GetEnvironmentVariable(EnvironmentVariableConstants.AKS_ARM_NAMESPACE_ID); + if (aksArmNamespaceId != null) + { + _resourceProvider = "aks"; + _resourceProviderId = aksArmNamespaceId; + + return; + } + _resourceProvider = "unknown"; _resourceProviderId = "unknown"; } diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/TransmitterFactory.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/TransmitterFactory.cs index f87cf5ed3cf8b..db66c170e5f34 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/TransmitterFactory.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/TransmitterFactory.cs @@ -15,7 +15,6 @@ namespace Azure.Monitor.OpenTelemetry.Exporter.Internals internal sealed class TransmitterFactory { public static readonly TransmitterFactory Instance = new(); - public static readonly IPlatform platform = new DefaultPlatform(); internal readonly Dictionary _transmitters = new(); private readonly object _lockObj = new(); @@ -30,7 +29,7 @@ public AzureMonitorTransmitter Get(AzureMonitorExporterOptions azureMonitorExpor { if (!_transmitters.TryGetValue(key, out transmitter)) { - transmitter = new AzureMonitorTransmitter(azureMonitorExporterOptions, platform); + transmitter = new AzureMonitorTransmitter(azureMonitorExporterOptions, new DefaultPlatform()); _transmitters.Add(key, transmitter); } diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/CommonTestFramework/MockPlatform.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/CommonTestFramework/MockPlatform.cs index b7e1db67b6397..baef061e06cff 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/CommonTestFramework/MockPlatform.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/CommonTestFramework/MockPlatform.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using Azure.Monitor.OpenTelemetry.Exporter.Internals.Platform; @@ -15,7 +14,7 @@ internal class MockPlatform : IPlatform public string OSPlatformName { get; set; } = "UnitTest"; public Func IsOsPlatformFunc { get; set; } = (OSPlatform) => false; - public Func CreateDirectoryFunc { get; set; } = (path) => true; + public Action CreateDirectoryFunc { get; set; } = (path) => { }; public string UserName { get; set; } = "UnitTestUser"; public string ProcessName { get; set; } = "UnitTestProcess"; public string ApplicationBaseDirectory { get; set; } = "UnitTestDirectory"; @@ -24,13 +23,11 @@ internal class MockPlatform : IPlatform public string? GetEnvironmentVariable(string name) => environmentVariables.TryGetValue(name, out var value) ? value : null; - public IDictionary GetEnvironmentVariables() => environmentVariables; - public string GetOSPlatformName() => OSPlatformName; public bool IsOSPlatform(OSPlatform osPlatform) => IsOsPlatformFunc(osPlatform); - public bool CreateDirectory(string path) => CreateDirectoryFunc(path); + public void CreateDirectory(string path) => CreateDirectoryFunc(path); public string GetEnvironmentUserName() => UserName; diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/ConnectionString/ConnectionStringParserTests.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/ConnectionString/ConnectionStringParserTests.cs index 8400b839ee669..1ca1fc62fdc9e 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/ConnectionString/ConnectionStringParserTests.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/ConnectionString/ConnectionStringParserTests.cs @@ -15,8 +15,9 @@ public class ConnectionStringParserTests public void TestConnectionString_Full() { RunTest( - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://ingestion.azuremonitor.com/;AADAudience=https://monitor.azure.com//testing", + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://ingestion.azuremonitor.com/;LiveEndpoint=https://live.azuremonitor.com/;AADAudience=https://monitor.azure.com//testing", expectedIngestionEndpoint: "https://ingestion.azuremonitor.com/", + expectedLiveEndpoint: "https://live.azuremonitor.com/", expectedInstrumentationKey: "00000000-0000-0000-0000-000000000000", expectedAadAudience: "https://monitor.azure.com//testing"); } @@ -27,6 +28,7 @@ public void TestInstrumentationKey_IsRequired() Assert.Throws(() => RunTest( connectionString: "EndpointSuffix=ingestion.azuremonitor.com", expectedIngestionEndpoint: null, + expectedLiveEndpoint: null, expectedInstrumentationKey: null)); } @@ -36,6 +38,7 @@ public void TestInstrumentationKey_CannotBeEmpty() Assert.Throws(() => RunTest( connectionString: "InstrumentationKey=;EndpointSuffix=ingestion.azuremonitor.com", expectedIngestionEndpoint: null, + expectedLiveEndpoint: null, expectedInstrumentationKey: null)); } @@ -45,6 +48,7 @@ public void TestDefaultEndpoints() RunTest( connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000", expectedIngestionEndpoint: Constants.DefaultIngestionEndpoint, + expectedLiveEndpoint: Constants.DefaultLiveEndpoint, expectedInstrumentationKey: "00000000-0000-0000-0000-000000000000"); } @@ -54,6 +58,7 @@ public void TestEndpointSuffix() RunTest( connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com", expectedIngestionEndpoint: "https://dc.ingestion.azuremonitor.com/", + expectedLiveEndpoint: "https://live.ingestion.azuremonitor.com/", expectedInstrumentationKey: "00000000-0000-0000-0000-000000000000"); } @@ -61,8 +66,9 @@ public void TestEndpointSuffix() public void TestEndpointSuffix_WithExplicitOverride() { RunTest( - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com;IngestionEndpoint=https://custom.contoso.com:444/", + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com;IngestionEndpoint=https://custom.contoso.com:444/;LiveEndpoint=https://custom.contoso.com:555", expectedIngestionEndpoint: "https://custom.contoso.com:444/", + expectedLiveEndpoint: "https://custom.contoso.com:555/", expectedInstrumentationKey: "00000000-0000-0000-0000-000000000000"); } @@ -72,6 +78,7 @@ public void TestEndpointSuffix_WithLocation() RunTest( connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com;Location=westus2", expectedIngestionEndpoint: "https://westus2.dc.ingestion.azuremonitor.com/", + expectedLiveEndpoint: "https://westus2.live.ingestion.azuremonitor.com/", expectedInstrumentationKey: "00000000-0000-0000-0000-000000000000"); } @@ -79,17 +86,20 @@ public void TestEndpointSuffix_WithLocation() public void TestEndpointSuffix_WithLocation_WithExplicitOverride() { RunTest( - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com;Location=westus2;IngestionEndpoint=https://custom.contoso.com:444/", + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com;Location=westus2;IngestionEndpoint=https://custom.contoso.com:444/;LiveEndpoint=https://custom.contoso.com:555", expectedIngestionEndpoint: "https://custom.contoso.com:444/", + expectedLiveEndpoint: "https://custom.contoso.com:555/", expectedInstrumentationKey: "00000000-0000-0000-0000-000000000000"); } [Fact] public void TestExplicitOverride_PreservesSchema() { + // if "http" has been specified, we should not change it to "https". RunTest( - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=http://custom.contoso.com:444/", + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=http://custom.contoso.com:444/;LiveEndpoint=http://custom.contoso.com:555", expectedIngestionEndpoint: "http://custom.contoso.com:444/", + expectedLiveEndpoint: "http://custom.contoso.com:555/", expectedInstrumentationKey: "00000000-0000-0000-0000-000000000000"); } @@ -97,70 +107,61 @@ public void TestExplicitOverride_PreservesSchema() public void TestExplicitOverride_InvalidValue() { Assert.Throws(() => RunTest( - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https:////custom.contoso.com", - expectedIngestionEndpoint: null, - expectedInstrumentationKey: null)); + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https:////custom.contoso.com")); } [Fact] public void TestExplicitOverride_InvalidValue2() { Assert.Throws(() => RunTest( - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://www.~!@#$%&^*()_{}{}>:L\":\"_+_+_", - expectedIngestionEndpoint: null, - expectedInstrumentationKey: null)); + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://www.~!@#$%&^*()_{}{}>:L\":\"_+_+_")); } [Fact] public void TestExplicitOverride_InvalidValue3() { Assert.Throws(() => RunTest( - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=~!@#$%&^*()_{}{}>:L\":\"_+_+_", - expectedIngestionEndpoint: null, - expectedInstrumentationKey: null)); + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=~!@#$%&^*()_{}{}>:L\":\"_+_+_")); } [Fact] public void TestExplicitOverride_InvalidLocation() { Assert.Throws(() => RunTest( - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com;Location=~!@#$%&^*()_{}{}>:L\":\"_+_+_", - expectedIngestionEndpoint: null, - expectedInstrumentationKey: null)); + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com;Location=~!@#$%&^*()_{}{}>:L\":\"_+_+_")); } [Fact] public void TestMaliciousConnectionString() { Assert.Throws(() => RunTest( - connectionString: new string('*', Constants.ConnectionStringMaxLength + 1), - expectedIngestionEndpoint: null, - expectedInstrumentationKey: null)); + connectionString: new string('*', Constants.ConnectionStringMaxLength + 1))); } [Fact] public void TestParseConnectionString_Empty() { Assert.Throws(() => RunTest( - connectionString: "", - expectedIngestionEndpoint: null, - expectedInstrumentationKey: null)); + connectionString: "")); } [Fact] public void TestEndpointProvider_NoInstrumentationKey() { Assert.Throws(() => RunTest( - connectionString: "key1=value1;key2=value2;key3=value3", - expectedIngestionEndpoint: null, - expectedInstrumentationKey: null)); + connectionString: "key1=value1;key2=value2;key3=value3")); } - private void RunTest(string connectionString, string? expectedIngestionEndpoint, string? expectedInstrumentationKey, string? expectedAadAudience = null) + private void RunTest(string connectionString, + string? expectedIngestionEndpoint = null, + string? expectedLiveEndpoint = null, + string? expectedInstrumentationKey = null, + string? expectedAadAudience = null) { var connectionVars = ConnectionStringParser.GetValues(connectionString); Assert.Equal(expectedIngestionEndpoint, connectionVars.IngestionEndpoint); + Assert.Equal(expectedLiveEndpoint, connectionVars.LiveEndpoint); Assert.Equal(expectedInstrumentationKey, connectionVars.InstrumentationKey); Assert.Equal(expectedAadAudience, connectionVars.AadAudience); } diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/LogsHelperTests.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/LogsHelperTests.cs index a781d69873f95..798db7e2f3f23 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/LogsHelperTests.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/LogsHelperTests.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; - +using System.Linq; using Azure.Core; using Azure.Monitor.OpenTelemetry.Exporter.Internals; using Azure.Monitor.OpenTelemetry.Exporter.Models; @@ -232,5 +232,195 @@ public void ValidateTelemetryItem(string type) Assert.Equal(logResource.RoleName, telemetryItem[0].Tags[ContextTagKeys.AiCloudRole.ToString()]); Assert.Equal(logResource.RoleInstance, telemetryItem[0].Tags[ContextTagKeys.AiCloudRoleInstance.ToString()]); } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public void ValidateScopeHandlingInLogProcessing(bool includeScope) + { + // Arrange. + var logRecords = new List(1); + using var loggerFactory = LoggerFactory.Create(builder => + { + builder.AddOpenTelemetry(options => + { + options.IncludeScopes = includeScope; + options.AddInMemoryExporter(logRecords); + }); + }); + + var logger = loggerFactory.CreateLogger("Some category"); + + const string expectedScopeKey = "Some scope key"; + const string expectedScopeValue = "Some scope value"; + + // Act. + using (logger.BeginScope(new List> + { + new KeyValuePair(expectedScopeKey, expectedScopeValue), + })) + { + logger.LogInformation("Some log information message."); + } + + // Assert. + var logRecord = logRecords.Single(); + var properties = new ChangeTrackingDictionary(); + LogsHelper.GetMessageAndSetProperties(logRecords[0], properties); + + if (includeScope) + { + Assert.True(properties.TryGetValue(expectedScopeKey, out string actualScopeValue)); + Assert.Equal(expectedScopeValue, actualScopeValue); + } + else + { + Assert.False(properties.TryGetValue(expectedScopeKey, out string actualScopeValue)); + } + } + + [Theory] + [InlineData("Some scope value")] + [InlineData('a')] + [InlineData(123)] + [InlineData(12.34)] + [InlineData(null)] + public void VerifyHandlingOfVariousScopeDataTypes(object scopeValue) + { + // Arrange. + var logRecords = new List(1); + using var loggerFactory = LoggerFactory.Create(builder => + { + builder.AddOpenTelemetry(options => + { + options.IncludeScopes = true; + options.AddInMemoryExporter(logRecords); + }); + }); + + var logger = loggerFactory.CreateLogger("Some category"); + + const string expectedScopeKey = "Some scope key"; + + // Act. + using (logger.BeginScope(new List> + { + new KeyValuePair(expectedScopeKey, scopeValue), + })) + { + logger.LogInformation("Some log information message."); + } + + // Assert. + var logRecord = logRecords.Single(); + var properties = new ChangeTrackingDictionary(); + LogsHelper.GetMessageAndSetProperties(logRecords[0], properties); + + if (scopeValue != null) + { + Assert.Single(properties); // Assert that there is exactly one property + Assert.True(properties.TryGetValue(expectedScopeKey, out string actualScopeValue)); + Assert.Equal(scopeValue.ToString(), actualScopeValue); + } + else + { + Assert.Empty(properties); // Assert that properties are empty + } + } + + [Fact] + public void LogScope_WhenToStringOnCustomObjectThrows_ShouldStillProcessValidScopeItems() + { + // Arrange. + var logRecords = new List(1); + using var loggerFactory = LoggerFactory.Create(builder => + { + builder.AddOpenTelemetry(options => + { + options.IncludeScopes = true; + options.IncludeFormattedMessage = true; + options.AddInMemoryExporter(logRecords); + }); + }); + + var logger = loggerFactory.CreateLogger("Some category"); + + const string expectedScopeKey = "Some scope key"; + const string validScopeKey = "Valid key"; + const string validScopeValue = "Valid value"; + + // Act. + using (logger.BeginScope(new List> + { + new KeyValuePair(expectedScopeKey, new CustomObject()), + new KeyValuePair(validScopeKey, validScopeValue), + })) + { + logger.LogInformation("Some log information message."); + } + + // Assert. + var logRecord = logRecords.Single(); + var properties = new ChangeTrackingDictionary(); + LogsHelper.GetMessageAndSetProperties(logRecords[0], properties); + + Assert.False(properties.ContainsKey(expectedScopeKey), "Properties should not contain the key of the CustomObject that threw an exception"); + Assert.True(properties.ContainsKey(validScopeKey), "Properties should contain the key of the valid scope item."); + Assert.Equal(validScopeValue, properties[validScopeKey]); + Assert.Equal("Some log information message.", logRecords[0].FormattedMessage); + } + + [Fact] + public void DuplicateKeysInLogRecordAttributesAndLogScope() + { + // Arrange. + var logRecords = new List(1); + using var loggerFactory = LoggerFactory.Create(builder => + { + builder.AddOpenTelemetry(options => + { + options.IncludeScopes = true; + options.AddInMemoryExporter(logRecords); + }); + }); + + var logger = loggerFactory.CreateLogger("Some category"); + + const string expectedScopeKey = "Some scope key"; + const string expectedScopeValue = "Some scope value"; + const string duplicateScopeValue = "Some duplicate scope value"; + + const string expectedAttributeValue = "Some attribute value"; + const string duplicateAttributeValue = "Some duplicate attribute value"; + + // Act. + using (logger.BeginScope(new List> + { + new KeyValuePair(expectedScopeKey, expectedScopeValue), + new KeyValuePair(expectedScopeKey, duplicateScopeValue), + })) + { + logger.LogInformation("Some log information message. {attributeKey} {attributeKey}.", expectedAttributeValue, duplicateAttributeValue); + } + + // Assert. + var logRecord = logRecords.Single(); + var properties = new ChangeTrackingDictionary(); + LogsHelper.GetMessageAndSetProperties(logRecords[0], properties); + + Assert.Equal(2, properties.Count); + Assert.True(properties.TryGetValue(expectedScopeKey, out string actualScopeValue)); + Assert.Equal(expectedScopeValue, actualScopeValue); + Assert.True(properties.TryGetValue("attributeKey", out string actualAttributeValue)); + Assert.Equal(expectedAttributeValue, actualAttributeValue); + } + + private class CustomObject + { + public override string ToString() + { + throw new InvalidOperationException("Custom exception in ToString method"); + } + } } } diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/ResourceExtensionsTests.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/ResourceExtensionsTests.cs index 5591ebc9e1b34..673990be73edb 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/ResourceExtensionsTests.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/ResourceExtensionsTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Net; using Azure.Monitor.OpenTelemetry.Exporter.Internals; +using Azure.Monitor.OpenTelemetry.Exporter.Internals.Platform; using Azure.Monitor.OpenTelemetry.Exporter.Models; using OpenTelemetry.Resources; using Xunit; diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/StorageHelperTests.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/StorageHelperTests.cs index 0d23adf4d14e9..c19f42d8acd0f 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/StorageHelperTests.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/StorageHelperTests.cs @@ -72,7 +72,7 @@ public void VerifyGetStorageDirectory_Failure(string osName) { var platform = new MockPlatform(); platform.IsOsPlatformFunc = (os) => os.ToString() == osName; - platform.CreateDirectoryFunc = (path) => false; + platform.CreateDirectoryFunc = (path) => throw new Exception("unit test: failed to create directory"); Assert.Throws(() => StorageHelper.GetStorageDirectory(platform: platform, configuredStorageDirectory: null, instrumentationKey: "00000000-0000-0000-0000-000000000000")); } @@ -101,12 +101,19 @@ public void VerifyDefaultDirectory_Linux(int attempt, string envVarValue, string { // In NON-Windows environments, First attempt is an EnvironmentVariable. // If that's not available, we'll attempt hardcoded defaults. + // This test simulates repeated failures to verify that the StorageHelper is selecting the expected directories. int attemptCount = 0; var platform = new MockPlatform(); platform.IsOsPlatformFunc = (os) => os.ToString() == "LINUX"; platform.SetEnvironmentVariable("TMPDIR", envVarValue); - platform.CreateDirectoryFunc = (path) => attemptCount++ == attempt; + platform.CreateDirectoryFunc = (path) => + { + if (attemptCount++ != attempt) + { + throw new Exception("unit test: failed to create directory"); + } + }; var directoryPath = StorageHelper.GetDefaultStorageDirectory(platform: platform); diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/CHANGELOG.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/CHANGELOG.md new file mode 100644 index 0000000000000..4144f75694a03 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/CHANGELOG.md @@ -0,0 +1,3 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/README.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/README.md new file mode 100644 index 0000000000000..9cec295712bd6 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/README.md @@ -0,0 +1,34 @@ +# Azure Monitor Live Metrics client library for .NET + +TODO + +## Getting started + +### Install the package + + +### Prerequisites + + +### Authenticate the client + + +## Key concepts + +TODO + +## Examples + +TODO + +## Troubleshooting + +TODO + +## Next steps + +TODO + +## Contributing + +TODO \ No newline at end of file diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/api/Azure.Monitor.OpenTelemetry.LiveMetrics.netstandard2.0.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/api/Azure.Monitor.OpenTelemetry.LiveMetrics.netstandard2.0.cs new file mode 100644 index 0000000000000..d8a96c69ccf2f --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/api/Azure.Monitor.OpenTelemetry.LiveMetrics.netstandard2.0.cs @@ -0,0 +1,91 @@ +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DerivedMetricInfoAggregation : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DerivedMetricInfoAggregation(string value) { throw null; } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation Avg { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation Max { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation Min { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation Sum { get { throw null; } } + public bool Equals(Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation 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.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation left, Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation right) { throw null; } + public static implicit operator Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation (string value) { throw null; } + public static bool operator !=(Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation left, Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DerivedMetricInfoAggregation right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DocumentFilterConjunctionGroupInfoTelemetryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DocumentFilterConjunctionGroupInfoTelemetryType(string value) { throw null; } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType Dependency { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType Event { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType Exception { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType Metric { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType PerformanceCounter { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType Request { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType Trace { get { throw null; } } + public bool Equals(Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType 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.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType left, Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType right) { throw null; } + public static implicit operator Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType (string value) { throw null; } + public static bool operator !=(Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType left, Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentFilterConjunctionGroupInfoTelemetryType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DocumentIngressDocumentType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DocumentIngressDocumentType(string value) { throw null; } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType Event { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType Exception { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType RemoteDependency { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType Request { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType Trace { get { throw null; } } + public bool Equals(Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType 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.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType left, Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType right) { throw null; } + public static implicit operator Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType (string value) { throw null; } + public static bool operator !=(Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType left, Azure.Monitor.OpenTelemetry.LiveMetrics.Models.DocumentIngressDocumentType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FilterInfoPredicate : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FilterInfoPredicate(string value) { throw null; } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate Contains { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate DoesNotContain { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate Equal { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate GreaterThan { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate GreaterThanOrEqual { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate LessThan { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate LessThanOrEqual { get { throw null; } } + public static Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate NotEqual { get { throw null; } } + public bool Equals(Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate 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.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate left, Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate right) { throw null; } + public static implicit operator Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate (string value) { throw null; } + public static bool operator !=(Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate left, Azure.Monitor.OpenTelemetry.LiveMetrics.Models.FilterInfoPredicate right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Azure.Monitor.OpenTelemetry.LiveMetrics.csproj b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Azure.Monitor.OpenTelemetry.LiveMetrics.csproj new file mode 100644 index 0000000000000..a3fa380acd840 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Azure.Monitor.OpenTelemetry.LiveMetrics.csproj @@ -0,0 +1,31 @@ + + + An OpenTelemetry .NET AzureMonitor OpenTelemetry Live Metrics + AzureMonitor OpenTelemetry Live Metrics + 1.0.0-beta.1 + Azure Monitor OpenTelemetry live Metrics ApplicationInsights + $(RequiredTargetFrameworks) + true + enable + $(DefineConstants);LIVE_METRICS_EXPORTER; + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.Serialization.cs new file mode 100644 index 0000000000000..7c09d874a5e2d --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class CollectionConfigurationError : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CollectionConfigurationErrorType)) + { + writer.WritePropertyName("CollectionConfigurationErrorType"u8); + writer.WriteStringValue(CollectionConfigurationErrorType.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("Message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(FullException)) + { + writer.WritePropertyName("FullException"u8); + writer.WriteStringValue(FullException); + } + if (Optional.IsCollectionDefined(Data)) + { + writer.WritePropertyName("Data"u8); + writer.WriteStartArray(); + foreach (var item in Data) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.cs new file mode 100644 index 0000000000000..5ce71e78e08e5 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationError.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Represents an error while SDK parsing and applying an instance of CollectionConfigurationInfo. + internal partial class CollectionConfigurationError + { + /// Initializes a new instance of CollectionConfigurationError. + public CollectionConfigurationError() + { + Data = new ChangeTrackingList(); + } + + /// Collection configuration error type reported by SDK. + public CollectionConfigurationErrorType? CollectionConfigurationErrorType { get; set; } + /// Error message. + public string Message { get; set; } + /// Exception that leads to the creation of the configuration error. + public string FullException { get; set; } + /// Custom properties to add more information to the error. + public IList Data { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationErrorType.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationErrorType.cs new file mode 100644 index 0000000000000..70720b3a08a14 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationErrorType.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Collection configuration error type reported by SDK. + internal readonly partial struct CollectionConfigurationErrorType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CollectionConfigurationErrorType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PerformanceCounterParsingValue = "PerformanceCounterParsing"; + private const string PerformanceCounterUnexpectedValue = "PerformanceCounterUnexpected"; + private const string PerformanceCounterDuplicateIdsValue = "PerformanceCounterDuplicateIds"; + private const string DocumentStreamDuplicateIdsValue = "DocumentStreamDuplicateIds"; + private const string DocumentStreamFailureToCreateValue = "DocumentStreamFailureToCreate"; + private const string DocumentStreamFailureToCreateFilterUnexpectedValue = "DocumentStreamFailureToCreateFilterUnexpected"; + private const string MetricDuplicateIdsValue = "MetricDuplicateIds"; + private const string MetricTelemetryTypeUnsupportedValue = "MetricTelemetryTypeUnsupported"; + private const string MetricFailureToCreateValue = "MetricFailureToCreate"; + private const string MetricFailureToCreateFilterUnexpectedValue = "MetricFailureToCreateFilterUnexpected"; + private const string FilterFailureToCreateUnexpectedValue = "FilterFailureToCreateUnexpected"; + private const string CollectionConfigurationFailureToCreateUnexpectedValue = "CollectionConfigurationFailureToCreateUnexpected"; + + /// Unknown. + public static CollectionConfigurationErrorType Unknown { get; } = new CollectionConfigurationErrorType(UnknownValue); + /// PerformanceCounterParsing. + public static CollectionConfigurationErrorType PerformanceCounterParsing { get; } = new CollectionConfigurationErrorType(PerformanceCounterParsingValue); + /// PerformanceCounterUnexpected. + public static CollectionConfigurationErrorType PerformanceCounterUnexpected { get; } = new CollectionConfigurationErrorType(PerformanceCounterUnexpectedValue); + /// PerformanceCounterDuplicateIds. + public static CollectionConfigurationErrorType PerformanceCounterDuplicateIds { get; } = new CollectionConfigurationErrorType(PerformanceCounterDuplicateIdsValue); + /// DocumentStreamDuplicateIds. + public static CollectionConfigurationErrorType DocumentStreamDuplicateIds { get; } = new CollectionConfigurationErrorType(DocumentStreamDuplicateIdsValue); + /// DocumentStreamFailureToCreate. + public static CollectionConfigurationErrorType DocumentStreamFailureToCreate { get; } = new CollectionConfigurationErrorType(DocumentStreamFailureToCreateValue); + /// DocumentStreamFailureToCreateFilterUnexpected. + public static CollectionConfigurationErrorType DocumentStreamFailureToCreateFilterUnexpected { get; } = new CollectionConfigurationErrorType(DocumentStreamFailureToCreateFilterUnexpectedValue); + /// MetricDuplicateIds. + public static CollectionConfigurationErrorType MetricDuplicateIds { get; } = new CollectionConfigurationErrorType(MetricDuplicateIdsValue); + /// MetricTelemetryTypeUnsupported. + public static CollectionConfigurationErrorType MetricTelemetryTypeUnsupported { get; } = new CollectionConfigurationErrorType(MetricTelemetryTypeUnsupportedValue); + /// MetricFailureToCreate. + public static CollectionConfigurationErrorType MetricFailureToCreate { get; } = new CollectionConfigurationErrorType(MetricFailureToCreateValue); + /// MetricFailureToCreateFilterUnexpected. + public static CollectionConfigurationErrorType MetricFailureToCreateFilterUnexpected { get; } = new CollectionConfigurationErrorType(MetricFailureToCreateFilterUnexpectedValue); + /// FilterFailureToCreateUnexpected. + public static CollectionConfigurationErrorType FilterFailureToCreateUnexpected { get; } = new CollectionConfigurationErrorType(FilterFailureToCreateUnexpectedValue); + /// CollectionConfigurationFailureToCreateUnexpected. + public static CollectionConfigurationErrorType CollectionConfigurationFailureToCreateUnexpected { get; } = new CollectionConfigurationErrorType(CollectionConfigurationFailureToCreateUnexpectedValue); + /// Determines if two values are the same. + public static bool operator ==(CollectionConfigurationErrorType left, CollectionConfigurationErrorType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CollectionConfigurationErrorType left, CollectionConfigurationErrorType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CollectionConfigurationErrorType(string value) => new CollectionConfigurationErrorType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CollectionConfigurationErrorType other && Equals(other); + /// + public bool Equals(CollectionConfigurationErrorType 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/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.Serialization.cs new file mode 100644 index 0000000000000..29158710af8c3 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class CollectionConfigurationInfo + { + internal static CollectionConfigurationInfo DeserializeCollectionConfigurationInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional etag = default; + Optional> metrics = default; + Optional> documentStreams = default; + Optional quotaInfo = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Etag"u8)) + { + etag = property.Value.GetString(); + continue; + } + if (property.NameEquals("Metrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DerivedMetricInfo.DeserializeDerivedMetricInfo(item)); + } + metrics = array; + continue; + } + if (property.NameEquals("DocumentStreams"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentStreamInfo.DeserializeDocumentStreamInfo(item)); + } + documentStreams = array; + continue; + } + if (property.NameEquals("QuotaInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaInfo = QuotaConfigurationInfo.DeserializeQuotaConfigurationInfo(property.Value); + continue; + } + } + return new CollectionConfigurationInfo(etag.Value, Optional.ToList(metrics), Optional.ToList(documentStreams), quotaInfo.Value); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.cs new file mode 100644 index 0000000000000..e231ed3380694 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/CollectionConfigurationInfo.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Represents the collection configuration - a customizable description of performance counters, metrics, and full telemetry documents to be collected by the SDK. + internal partial class CollectionConfigurationInfo + { + /// Initializes a new instance of CollectionConfigurationInfo. + internal CollectionConfigurationInfo() + { + Metrics = new ChangeTrackingList(); + DocumentStreams = new ChangeTrackingList(); + } + + /// Initializes a new instance of CollectionConfigurationInfo. + /// An encoded string that indicates whether the collection configuration is changed. + /// An array of metric configuration info. + /// An array of document stream configuration info. + /// Control document quotas for QuickPulse. + internal CollectionConfigurationInfo(string etag, IReadOnlyList metrics, IReadOnlyList documentStreams, QuotaConfigurationInfo quotaInfo) + { + Etag = etag; + Metrics = metrics; + DocumentStreams = documentStreams; + QuotaInfo = quotaInfo; + } + + /// An encoded string that indicates whether the collection configuration is changed. + public string Etag { get; } + /// An array of metric configuration info. + public IReadOnlyList Metrics { get; } + /// An array of document stream configuration info. + public IReadOnlyList DocumentStreams { get; } + /// Control document quotas for QuickPulse. + public QuotaConfigurationInfo QuotaInfo { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.Serialization.cs new file mode 100644 index 0000000000000..bbd69405810e5 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class DerivedMetricInfo + { + internal static DerivedMetricInfo DeserializeDerivedMetricInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional telemetryType = default; + Optional> filterGroups = default; + Optional projection = default; + Optional aggregation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("TelemetryType"u8)) + { + telemetryType = property.Value.GetString(); + continue; + } + if (property.NameEquals("FilterGroups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FilterConjunctionGroupInfo.DeserializeFilterConjunctionGroupInfo(item)); + } + filterGroups = array; + continue; + } + if (property.NameEquals("Projection"u8)) + { + projection = property.Value.GetString(); + continue; + } + if (property.NameEquals("Aggregation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + aggregation = new DerivedMetricInfoAggregation(property.Value.GetString()); + continue; + } + } + return new DerivedMetricInfo(id.Value, telemetryType.Value, Optional.ToList(filterGroups), projection.Value, Optional.ToNullable(aggregation)); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.cs new file mode 100644 index 0000000000000..c82d222d3f9c4 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfo.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// A metric configuration set by UX to scope the metrics it's interested in. + internal partial class DerivedMetricInfo + { + /// Initializes a new instance of DerivedMetricInfo. + internal DerivedMetricInfo() + { + FilterGroups = new ChangeTrackingList(); + } + + /// Initializes a new instance of DerivedMetricInfo. + /// metric configuration identifier. + /// Telemetry type. + /// A collection of filters to scope metrics that UX needs. + /// Telemetry's metric dimension whose value is to be aggregated. Example values: Duration, Count(),... + /// Aggregation type. + internal DerivedMetricInfo(string id, string telemetryType, IReadOnlyList filterGroups, string projection, DerivedMetricInfoAggregation? aggregation) + { + Id = id; + TelemetryType = telemetryType; + FilterGroups = filterGroups; + Projection = projection; + Aggregation = aggregation; + } + + /// metric configuration identifier. + public string Id { get; } + /// Telemetry type. + public string TelemetryType { get; } + /// A collection of filters to scope metrics that UX needs. + public IReadOnlyList FilterGroups { get; } + /// Telemetry's metric dimension whose value is to be aggregated. Example values: Duration, Count(),... + public string Projection { get; } + /// Aggregation type. + public DerivedMetricInfoAggregation? Aggregation { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfoAggregation.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfoAggregation.cs new file mode 100644 index 0000000000000..92713bca6f496 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DerivedMetricInfoAggregation.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Aggregation type. + public readonly partial struct DerivedMetricInfoAggregation : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DerivedMetricInfoAggregation(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AvgValue = "Avg"; + private const string SumValue = "Sum"; + private const string MinValue = "Min"; + private const string MaxValue = "Max"; + + /// Avg. + public static DerivedMetricInfoAggregation Avg { get; } = new DerivedMetricInfoAggregation(AvgValue); + /// Sum. + public static DerivedMetricInfoAggregation Sum { get; } = new DerivedMetricInfoAggregation(SumValue); + /// Min. + public static DerivedMetricInfoAggregation Min { get; } = new DerivedMetricInfoAggregation(MinValue); + /// Max. + public static DerivedMetricInfoAggregation Max { get; } = new DerivedMetricInfoAggregation(MaxValue); + /// Determines if two values are the same. + public static bool operator ==(DerivedMetricInfoAggregation left, DerivedMetricInfoAggregation right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DerivedMetricInfoAggregation left, DerivedMetricInfoAggregation right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DerivedMetricInfoAggregation(string value) => new DerivedMetricInfoAggregation(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DerivedMetricInfoAggregation other && Equals(other); + /// + public bool Equals(DerivedMetricInfoAggregation 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/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.Serialization.cs new file mode 100644 index 0000000000000..03bfba4cfc4ae --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class DocumentFilterConjunctionGroupInfo + { + internal static DocumentFilterConjunctionGroupInfo DeserializeDocumentFilterConjunctionGroupInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional telemetryType = default; + Optional filters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("TelemetryType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + telemetryType = new DocumentFilterConjunctionGroupInfoTelemetryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("Filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filters = FilterConjunctionGroupInfo.DeserializeFilterConjunctionGroupInfo(property.Value); + continue; + } + } + return new DocumentFilterConjunctionGroupInfo(Optional.ToNullable(telemetryType), filters.Value); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.cs new file mode 100644 index 0000000000000..37e7b11ec03cb --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// A collection of filters for a specificy telemetry type. + internal partial class DocumentFilterConjunctionGroupInfo + { + /// Initializes a new instance of DocumentFilterConjunctionGroupInfo. + internal DocumentFilterConjunctionGroupInfo() + { + } + + /// Initializes a new instance of DocumentFilterConjunctionGroupInfo. + /// Telemetry type. + /// An AND-connected group of FilterInfo objects. + internal DocumentFilterConjunctionGroupInfo(DocumentFilterConjunctionGroupInfoTelemetryType? telemetryType, FilterConjunctionGroupInfo filters) + { + TelemetryType = telemetryType; + Filters = filters; + } + + /// Telemetry type. + public DocumentFilterConjunctionGroupInfoTelemetryType? TelemetryType { get; } + /// An AND-connected group of FilterInfo objects. + public FilterConjunctionGroupInfo Filters { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfoTelemetryType.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfoTelemetryType.cs new file mode 100644 index 0000000000000..f63ac090c40ab --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentFilterConjunctionGroupInfoTelemetryType.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Telemetry type. + public readonly partial struct DocumentFilterConjunctionGroupInfoTelemetryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DocumentFilterConjunctionGroupInfoTelemetryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RequestValue = "Request"; + private const string DependencyValue = "Dependency"; + private const string ExceptionValue = "Exception"; + private const string EventValue = "Event"; + private const string MetricValue = "Metric"; + private const string PerformanceCounterValue = "PerformanceCounter"; + private const string TraceValue = "Trace"; + + /// Request. + public static DocumentFilterConjunctionGroupInfoTelemetryType Request { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(RequestValue); + /// Dependency. + public static DocumentFilterConjunctionGroupInfoTelemetryType Dependency { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(DependencyValue); + /// Exception. + public static DocumentFilterConjunctionGroupInfoTelemetryType Exception { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(ExceptionValue); + /// Event. + public static DocumentFilterConjunctionGroupInfoTelemetryType Event { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(EventValue); + /// Metric. + public static DocumentFilterConjunctionGroupInfoTelemetryType Metric { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(MetricValue); + /// PerformanceCounter. + public static DocumentFilterConjunctionGroupInfoTelemetryType PerformanceCounter { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(PerformanceCounterValue); + /// Trace. + public static DocumentFilterConjunctionGroupInfoTelemetryType Trace { get; } = new DocumentFilterConjunctionGroupInfoTelemetryType(TraceValue); + /// Determines if two values are the same. + public static bool operator ==(DocumentFilterConjunctionGroupInfoTelemetryType left, DocumentFilterConjunctionGroupInfoTelemetryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DocumentFilterConjunctionGroupInfoTelemetryType left, DocumentFilterConjunctionGroupInfoTelemetryType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DocumentFilterConjunctionGroupInfoTelemetryType(string value) => new DocumentFilterConjunctionGroupInfoTelemetryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DocumentFilterConjunctionGroupInfoTelemetryType other && Equals(other); + /// + public bool Equals(DocumentFilterConjunctionGroupInfoTelemetryType 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/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..79d0a7a9effc3 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class DocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.cs new file mode 100644 index 0000000000000..51687e7b5ef98 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngress.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Base class of the specific document types. + internal partial class DocumentIngress + { + /// Initializes a new instance of DocumentIngress. + public DocumentIngress() + { + DocumentStreamIds = new ChangeTrackingList(); + Properties = new ChangeTrackingList(); + } + + /// Telemetry type. Types not defined in enum will get replaced with a 'Unknown' type. + public DocumentIngressDocumentType? DocumentType { get; set; } + /// An array of document streaming ids. Each id identifies a flow of documents customized by UX customers. + public IList DocumentStreamIds { get; } + /// Collection of custom properties. + public IList Properties { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngressDocumentType.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngressDocumentType.cs new file mode 100644 index 0000000000000..04c6c0fc1b05c --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentIngressDocumentType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Telemetry type. Types not defined in enum will get replaced with a 'Unknown' type. + public readonly partial struct DocumentIngressDocumentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DocumentIngressDocumentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RequestValue = "Request"; + private const string RemoteDependencyValue = "RemoteDependency"; + private const string ExceptionValue = "Exception"; + private const string EventValue = "Event"; + private const string TraceValue = "Trace"; + + /// Request. + public static DocumentIngressDocumentType Request { get; } = new DocumentIngressDocumentType(RequestValue); + /// RemoteDependency. + public static DocumentIngressDocumentType RemoteDependency { get; } = new DocumentIngressDocumentType(RemoteDependencyValue); + /// Exception. + public static DocumentIngressDocumentType Exception { get; } = new DocumentIngressDocumentType(ExceptionValue); + /// Event. + public static DocumentIngressDocumentType Event { get; } = new DocumentIngressDocumentType(EventValue); + /// Trace. + public static DocumentIngressDocumentType Trace { get; } = new DocumentIngressDocumentType(TraceValue); + /// Determines if two values are the same. + public static bool operator ==(DocumentIngressDocumentType left, DocumentIngressDocumentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DocumentIngressDocumentType left, DocumentIngressDocumentType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DocumentIngressDocumentType(string value) => new DocumentIngressDocumentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DocumentIngressDocumentType other && Equals(other); + /// + public bool Equals(DocumentIngressDocumentType 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/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.Serialization.cs new file mode 100644 index 0000000000000..1e2b3364f446e --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class DocumentStreamInfo + { + internal static DocumentStreamInfo DeserializeDocumentStreamInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional> documentFilterGroups = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("DocumentFilterGroups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentFilterConjunctionGroupInfo.DeserializeDocumentFilterConjunctionGroupInfo(item)); + } + documentFilterGroups = array; + continue; + } + } + return new DocumentStreamInfo(id.Value, Optional.ToList(documentFilterGroups)); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.cs new file mode 100644 index 0000000000000..f299b56c1a247 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/DocumentStreamInfo.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Configurations/filters set by UX to scope the document/telemetry it's interested in. + internal partial class DocumentStreamInfo + { + /// Initializes a new instance of DocumentStreamInfo. + internal DocumentStreamInfo() + { + DocumentFilterGroups = new ChangeTrackingList(); + } + + /// Initializes a new instance of DocumentStreamInfo. + /// Identifier of the document stream initiated by a UX. + /// Gets or sets an OR-connected collection of filter groups. + internal DocumentStreamInfo(string id, IReadOnlyList documentFilterGroups) + { + Id = id; + DocumentFilterGroups = documentFilterGroups; + } + + /// Identifier of the document stream initiated by a UX. + public string Id { get; } + /// Gets or sets an OR-connected collection of filter groups. + public IReadOnlyList DocumentFilterGroups { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..cefd2718c8921 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class EventDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("Name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.cs new file mode 100644 index 0000000000000..984f14806bf04 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/EventDocumentIngress.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Event type document. + internal partial class EventDocumentIngress : DocumentIngress + { + /// Initializes a new instance of EventDocumentIngress. + public EventDocumentIngress() + { + } + + /// Event name. + public string Name { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..faef7728f474a --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class ExceptionDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ExceptionType)) + { + writer.WritePropertyName("ExceptionType"u8); + writer.WriteStringValue(ExceptionType); + } + if (Optional.IsDefined(ExceptionMessage)) + { + writer.WritePropertyName("ExceptionMessage"u8); + writer.WriteStringValue(ExceptionMessage); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.cs new file mode 100644 index 0000000000000..d4a79e61927a3 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ExceptionDocumentIngress.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Exception type document. + internal partial class ExceptionDocumentIngress : DocumentIngress + { + /// Initializes a new instance of ExceptionDocumentIngress. + public ExceptionDocumentIngress() + { + } + + /// Exception type name. + public string ExceptionType { get; set; } + /// Exception message. + public string ExceptionMessage { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.Serialization.cs new file mode 100644 index 0000000000000..807a813562fee --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class FilterConjunctionGroupInfo + { + internal static FilterConjunctionGroupInfo DeserializeFilterConjunctionGroupInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> filters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("Filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FilterInfo.DeserializeFilterInfo(item)); + } + filters = array; + continue; + } + } + return new FilterConjunctionGroupInfo(Optional.ToList(filters)); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.cs new file mode 100644 index 0000000000000..964c26f34c636 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterConjunctionGroupInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// An AND-connected group of FilterInfo objects. + internal partial class FilterConjunctionGroupInfo + { + /// Initializes a new instance of FilterConjunctionGroupInfo. + internal FilterConjunctionGroupInfo() + { + Filters = new ChangeTrackingList(); + } + + /// Initializes a new instance of FilterConjunctionGroupInfo. + /// + internal FilterConjunctionGroupInfo(IReadOnlyList filters) + { + Filters = filters; + } + + /// Gets the filters. + public IReadOnlyList Filters { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.Serialization.cs new file mode 100644 index 0000000000000..3189997922c13 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class FilterInfo + { + internal static FilterInfo DeserializeFilterInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional fieldName = default; + Optional predicate = default; + Optional comparand = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("FieldName"u8)) + { + fieldName = property.Value.GetString(); + continue; + } + if (property.NameEquals("Predicate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + predicate = new FilterInfoPredicate(property.Value.GetString()); + continue; + } + if (property.NameEquals("Comparand"u8)) + { + comparand = property.Value.GetString(); + continue; + } + } + return new FilterInfo(fieldName.Value, Optional.ToNullable(predicate), comparand.Value); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.cs new file mode 100644 index 0000000000000..d2ce94c3d9037 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfo.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// A filter set on UX. + internal partial class FilterInfo + { + /// Initializes a new instance of FilterInfo. + internal FilterInfo() + { + } + + /// Initializes a new instance of FilterInfo. + /// dimension name of the filter. + /// Operator of the filter. + /// + internal FilterInfo(string fieldName, FilterInfoPredicate? predicate, string comparand) + { + FieldName = fieldName; + Predicate = predicate; + Comparand = comparand; + } + + /// dimension name of the filter. + public string FieldName { get; } + /// Operator of the filter. + public FilterInfoPredicate? Predicate { get; } + /// Gets the comparand. + public string Comparand { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfoPredicate.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfoPredicate.cs new file mode 100644 index 0000000000000..ee08e533204ab --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/FilterInfoPredicate.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Operator of the filter. + public readonly partial struct FilterInfoPredicate : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FilterInfoPredicate(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EqualValue = "Equal"; + private const string NotEqualValue = "NotEqual"; + private const string LessThanValue = "LessThan"; + private const string GreaterThanValue = "GreaterThan"; + private const string LessThanOrEqualValue = "LessThanOrEqual"; + private const string GreaterThanOrEqualValue = "GreaterThanOrEqual"; + private const string ContainsValue = "Contains"; + private const string DoesNotContainValue = "DoesNotContain"; + + /// Equal. + public static FilterInfoPredicate Equal { get; } = new FilterInfoPredicate(EqualValue); + /// NotEqual. + public static FilterInfoPredicate NotEqual { get; } = new FilterInfoPredicate(NotEqualValue); + /// LessThan. + public static FilterInfoPredicate LessThan { get; } = new FilterInfoPredicate(LessThanValue); + /// GreaterThan. + public static FilterInfoPredicate GreaterThan { get; } = new FilterInfoPredicate(GreaterThanValue); + /// LessThanOrEqual. + public static FilterInfoPredicate LessThanOrEqual { get; } = new FilterInfoPredicate(LessThanOrEqualValue); + /// GreaterThanOrEqual. + public static FilterInfoPredicate GreaterThanOrEqual { get; } = new FilterInfoPredicate(GreaterThanOrEqualValue); + /// Contains. + public static FilterInfoPredicate Contains { get; } = new FilterInfoPredicate(ContainsValue); + /// DoesNotContain. + public static FilterInfoPredicate DoesNotContain { get; } = new FilterInfoPredicate(DoesNotContainValue); + /// Determines if two values are the same. + public static bool operator ==(FilterInfoPredicate left, FilterInfoPredicate right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FilterInfoPredicate left, FilterInfoPredicate right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FilterInfoPredicate(string value) => new FilterInfoPredicate(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FilterInfoPredicate other && Equals(other); + /// + public bool Equals(FilterInfoPredicate 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/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.Serialization.cs new file mode 100644 index 0000000000000..e1177642fbf1c --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class KeyValuePairString : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.cs new file mode 100644 index 0000000000000..0c44085dcad46 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/KeyValuePairString.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// The KeyValuePairString. + internal partial class KeyValuePairString + { + /// Initializes a new instance of KeyValuePairString. + public KeyValuePairString() + { + } + + /// Gets or sets the key. + public string Key { get; set; } + /// Gets or sets the value. + public string Value { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.Serialization.cs new file mode 100644 index 0000000000000..d1c257968f8d1 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.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.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class MetricPoint : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("Name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("Value"u8); + writer.WriteNumberValue(Value.Value); + } + if (Optional.IsDefined(Weight)) + { + writer.WritePropertyName("Weight"u8); + writer.WriteNumberValue(Weight.Value); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.cs new file mode 100644 index 0000000000000..cd738c171aa94 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MetricPoint.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Metric data point. + internal partial class MetricPoint + { + /// Initializes a new instance of MetricPoint. + public MetricPoint() + { + } + + /// Metric name. + public string Name { get; set; } + /// Metric value. + public float? Value { get; set; } + /// Metric weight. + public int? Weight { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.Serialization.cs new file mode 100644 index 0000000000000..8d399d3ed7625 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class MonitoringDataPoint : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("Version"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsDefined(InvariantVersion)) + { + writer.WritePropertyName("InvariantVersion"u8); + writer.WriteNumberValue(InvariantVersion.Value); + } + if (Optional.IsDefined(Instance)) + { + writer.WritePropertyName("Instance"u8); + writer.WriteStringValue(Instance); + } + if (Optional.IsDefined(RoleName)) + { + writer.WritePropertyName("RoleName"u8); + writer.WriteStringValue(RoleName); + } + if (Optional.IsDefined(MachineName)) + { + writer.WritePropertyName("MachineName"u8); + writer.WriteStringValue(MachineName); + } + if (Optional.IsDefined(StreamId)) + { + writer.WritePropertyName("StreamId"u8); + writer.WriteStringValue(StreamId); + } + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("Timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (Optional.IsDefined(TransmissionTime)) + { + writer.WritePropertyName("TransmissionTime"u8); + writer.WriteStringValue(TransmissionTime.Value, "O"); + } + if (Optional.IsDefined(IsWebApp)) + { + writer.WritePropertyName("IsWebApp"u8); + writer.WriteBooleanValue(IsWebApp.Value); + } + if (Optional.IsDefined(PerformanceCollectionSupported)) + { + writer.WritePropertyName("PerformanceCollectionSupported"u8); + writer.WriteBooleanValue(PerformanceCollectionSupported.Value); + } + if (Optional.IsCollectionDefined(Metrics)) + { + writer.WritePropertyName("Metrics"u8); + writer.WriteStartArray(); + foreach (var item in Metrics) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Documents)) + { + writer.WritePropertyName("Documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TopCpuProcesses)) + { + writer.WritePropertyName("TopCpuProcesses"u8); + writer.WriteStartArray(); + foreach (var item in TopCpuProcesses) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CollectionConfigurationErrors)) + { + writer.WritePropertyName("CollectionConfigurationErrors"u8); + writer.WriteStartArray(); + foreach (var item in CollectionConfigurationErrors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.cs new file mode 100644 index 0000000000000..2ff80f257640e --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/MonitoringDataPoint.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Monitoring data point coming from SDK, which includes metrics, documents and other metadata info. + internal partial class MonitoringDataPoint + { + /// Initializes a new instance of MonitoringDataPoint. + public MonitoringDataPoint() + { + Metrics = new ChangeTrackingList(); + Documents = new ChangeTrackingList(); + TopCpuProcesses = new ChangeTrackingList(); + CollectionConfigurationErrors = new ChangeTrackingList(); + } + + /// AI SDK version. + public string Version { get; set; } + /// Version/generation of the data contract (MonitoringDataPoint) between SDK and QuickPulse. + public int? InvariantVersion { get; set; } + /// Service instance name where AI SDK lives. + public string Instance { get; set; } + /// Service role name. + public string RoleName { get; set; } + /// Computer name where AI SDK lives. + public string MachineName { get; set; } + /// Identifies an AI SDK as a trusted agent to report metrics and documents. + public string StreamId { get; set; } + /// Data point generation timestamp. + public DateTimeOffset? Timestamp { get; set; } + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + public DateTimeOffset? TransmissionTime { get; set; } + /// True if the current application is an Azure Web App. + public bool? IsWebApp { get; set; } + /// True if performance counters collection is supported. + public bool? PerformanceCollectionSupported { get; set; } + /// An array of meric data points. + public IList Metrics { get; } + /// An array of documents of a specific type {RequestDocumentIngress}, {RemoteDependencyDocumentIngress}, {ExceptionDocumentIngress}, {EventDocumentIngress}, or {TraceDocumentIngress}. + public IList Documents { get; } + /// An array of top cpu consumption data point. + public IList TopCpuProcesses { get; } + /// An array of error while parsing and applying . + public IList CollectionConfigurationErrors { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.Serialization.cs new file mode 100644 index 0000000000000..bb67299131319 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class ProcessCpuData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ProcessName)) + { + writer.WritePropertyName("ProcessName"u8); + writer.WriteStringValue(ProcessName); + } + if (Optional.IsDefined(CpuPercentage)) + { + writer.WritePropertyName("CpuPercentage"u8); + writer.WriteNumberValue(CpuPercentage.Value); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.cs new file mode 100644 index 0000000000000..af92288abe385 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ProcessCpuData.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// CPU consumption datapoint. + internal partial class ProcessCpuData + { + /// Initializes a new instance of ProcessCpuData. + public ProcessCpuData() + { + } + + /// Process name. + public string ProcessName { get; set; } + /// CPU consumption percentage. + public int? CpuPercentage { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.Serialization.cs new file mode 100644 index 0000000000000..fc0a47b73cf07 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class QuotaConfigurationInfo + { + internal static QuotaConfigurationInfo DeserializeQuotaConfigurationInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional initialQuota = default; + float maxQuota = default; + float quotaAccrualRatePerSec = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("InitialQuota"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initialQuota = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("MaxQuota"u8)) + { + maxQuota = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("QuotaAccrualRatePerSec"u8)) + { + quotaAccrualRatePerSec = property.Value.GetSingle(); + continue; + } + } + return new QuotaConfigurationInfo(Optional.ToNullable(initialQuota), maxQuota, quotaAccrualRatePerSec); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.cs new file mode 100644 index 0000000000000..526dc740a8f8a --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/QuotaConfigurationInfo.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Control document quotas for QuickPulse. + internal partial class QuotaConfigurationInfo + { + /// Initializes a new instance of QuotaConfigurationInfo. + /// Max quota. + /// Quota accrual rate per second. + internal QuotaConfigurationInfo(float maxQuota, float quotaAccrualRatePerSec) + { + MaxQuota = maxQuota; + QuotaAccrualRatePerSec = quotaAccrualRatePerSec; + } + + /// Initializes a new instance of QuotaConfigurationInfo. + /// Initial quota. + /// Max quota. + /// Quota accrual rate per second. + internal QuotaConfigurationInfo(float? initialQuota, float maxQuota, float quotaAccrualRatePerSec) + { + InitialQuota = initialQuota; + MaxQuota = maxQuota; + QuotaAccrualRatePerSec = quotaAccrualRatePerSec; + } + + /// Initial quota. + public float? InitialQuota { get; } + /// Max quota. + public float MaxQuota { get; } + /// Quota accrual rate per second. + public float QuotaAccrualRatePerSec { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..3c8e1df58ac13 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class RemoteDependencyDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("Name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(CommandName)) + { + writer.WritePropertyName("CommandName"u8); + writer.WriteStringValue(CommandName); + } + if (Optional.IsDefined(ResultCode)) + { + writer.WritePropertyName("ResultCode"u8); + writer.WriteStringValue(ResultCode); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("Duration"u8); + writer.WriteStringValue(Duration); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.cs new file mode 100644 index 0000000000000..97f4539bbc186 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RemoteDependencyDocumentIngress.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Dependency type document. + internal partial class RemoteDependencyDocumentIngress : DocumentIngress + { + /// Initializes a new instance of RemoteDependencyDocumentIngress. + public RemoteDependencyDocumentIngress() + { + } + + /// Name of the command initiated with this dependency call, e.g., GET /username. + public string Name { get; set; } + /// URL of the dependency call to the target, with all query string parameters. + public string CommandName { get; set; } + /// Result code of a dependency call. Examples are SQL error code and HTTP status code. + public string ResultCode { get; set; } + /// Request duration in ISO 8601 duration format, i.e., P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W. + public string Duration { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..d093befddf43e --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class RequestDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("Name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Url)) + { + writer.WritePropertyName("Url"u8); + writer.WriteStringValue(Url); + } + if (Optional.IsDefined(ResponseCode)) + { + writer.WritePropertyName("ResponseCode"u8); + writer.WriteStringValue(ResponseCode); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("Duration"u8); + writer.WriteStringValue(Duration); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.cs new file mode 100644 index 0000000000000..0c445fbc529a1 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/RequestDocumentIngress.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Request type document. + internal partial class RequestDocumentIngress : DocumentIngress + { + /// Initializes a new instance of RequestDocumentIngress. + public RequestDocumentIngress() + { + } + + /// Name of the request, e.g., 'GET /values/{id}'. + public string Name { get; set; } + /// Request URL with all query string parameters. + public string Url { get; set; } + /// Result of a request execution. For http requestss, it could be some HTTP status code. + public string ResponseCode { get; set; } + /// Request duration in ISO 8601 duration format, i.e., P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W. + public string Duration { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.Serialization.cs new file mode 100644 index 0000000000000..71737f1794ee1 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.Serialization.cs @@ -0,0 +1,62 @@ +// 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.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class ServiceError + { + internal static ServiceError DeserializeServiceError(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional requestId = default; + Optional responseDateTime = default; + Optional code = default; + Optional message = default; + Optional exception = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("RequestId"u8)) + { + requestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ResponseDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + responseDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("Code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("Message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("Exception"u8)) + { + exception = property.Value.GetString(); + continue; + } + } + return new ServiceError(requestId.Value, Optional.ToNullable(responseDateTime), code.Value, message.Value, exception.Value); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.cs new file mode 100644 index 0000000000000..68a11a28f53e9 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/ServiceError.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Optional http response body, whose existance carries additional error descriptions. + internal partial class ServiceError + { + /// Initializes a new instance of ServiceError. + internal ServiceError() + { + } + + /// Initializes a new instance of ServiceError. + /// A guid of the request that triggers the service error. + /// Service error response date time. + /// Error code. + /// Error message. + /// Message of the exception that triggers the error response. + internal ServiceError(string requestId, DateTimeOffset? responseDateTime, string code, string message, string exception) + { + RequestId = requestId; + ResponseDateTime = responseDateTime; + Code = code; + Message = message; + Exception = exception; + } + + /// A guid of the request that triggers the service error. + public string RequestId { get; } + /// Service error response date time. + public DateTimeOffset? ResponseDateTime { get; } + /// Error code. + public string Code { get; } + /// Error message. + public string Message { get; } + /// Message of the exception that triggers the error response. + public string Exception { get; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.Serialization.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.Serialization.cs new file mode 100644 index 0000000000000..3e1f93e02034d --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + internal partial class TraceDocumentIngress : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("Message"u8); + writer.WriteStringValue(Message); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("DocumentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (Optional.IsCollectionDefined(DocumentStreamIds)) + { + writer.WritePropertyName("DocumentStreamIds"u8); + writer.WriteStartArray(); + foreach (var item in DocumentStreamIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("Properties"u8); + writer.WriteStartArray(); + foreach (var item in Properties) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.cs new file mode 100644 index 0000000000000..04e901241dc27 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/Models/TraceDocumentIngress.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Models +{ + /// Trace type name. + internal partial class TraceDocumentIngress : DocumentIngress + { + /// Initializes a new instance of TraceDocumentIngress. + public TraceDocumentIngress() + { + } + + /// Trace message. + public string Message { get; set; } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPingHeaders.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPingHeaders.cs new file mode 100644 index 0000000000000..f957e91c10208 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPingHeaders.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics +{ + internal partial class QuickPulseSDKClientAPIsPingHeaders + { + private readonly Response _response; + public QuickPulseSDKClientAPIsPingHeaders(Response response) + { + _response = response; + } + /// A boolean flag indicating whether there are active user sessions 'watching' the SDK's ikey. If true, SDK must start collecting data and post'ing it to QuickPulse. Otherwise, SDK must keep ping'ing. + public string XMsQpsSubscribed => _response.Headers.TryGetValue("x-ms-qps-subscribed", out string value) ? value : null; + /// An encoded string that indicates whether the collection configuration is changed. + public string XMsQpsConfigurationEtag => _response.Headers.TryGetValue("x-ms-qps-configuration-etag", out string value) ? value : null; + /// Recommended time (in milliseconds) before an SDK should ping the service again. This header exists only when ikey is not watched by UX. + public int? XMsQpsServicePollingIntervalHint => _response.Headers.TryGetValue("x-ms-qps-service-polling-interval-hint", out int? value) ? value : null; + /// Contains a URI of the service endpoint that an SDK must permanently use for the particular resource. This header exists only when SDK is talking to QuickPulse's global endpoint. + public string XMsQpsServiceEndpointRedirectV2 => _response.Headers.TryGetValue("x-ms-qps-service-endpoint-redirect-v2", out string value) ? value : null; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPostHeaders.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPostHeaders.cs new file mode 100644 index 0000000000000..3cfb5c570bcb2 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsPostHeaders.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics +{ + internal partial class QuickPulseSDKClientAPIsPostHeaders + { + private readonly Response _response; + public QuickPulseSDKClientAPIsPostHeaders(Response response) + { + _response = response; + } + /// Tells SDK whether the input ikey is subscribed to by UX. + public string XMsQpsSubscribed => _response.Headers.TryGetValue("x-ms-qps-subscribed", out string value) ? value : null; + /// An encoded string that indicates whether the collection configuration is changed. + public string XMsQpsConfigurationEtag => _response.Headers.TryGetValue("x-ms-qps-configuration-etag", out string value) ? value : null; + /// A 8-byte long type of milliseconds QuickPulse suggests SDK polling period. + public int? XMsQpsServicePollingIntervalHint => _response.Headers.TryGetValue("x-ms-qps-service-polling-interval-hint", out int? value) ? value : null; + /// All official SDKs now uses v2 header. Use v2 instead. + public string XMsQpsServiceEndpointRedirect => _response.Headers.TryGetValue("x-ms-qps-service-endpoint-redirect", out string value) ? value : null; + /// URI of the service endpoint that an SDK must permanently use for the particular resource. + public string XMsQpsServiceEndpointRedirectV2 => _response.Headers.TryGetValue("x-ms-qps-service-endpoint-redirect-v2", out string value) ? value : null; + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsRestClient.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsRestClient.cs new file mode 100644 index 0000000000000..67635f0abd525 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Generated/QuickPulseSDKClientAPIsRestClient.cs @@ -0,0 +1,317 @@ +// 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 System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Monitor.OpenTelemetry.LiveMetrics.Models; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics +{ + internal partial class QuickPulseSDKClientAPIsRestClient + { + private readonly HttpPipeline _pipeline; + private readonly string _host; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// Initializes a new instance of QuickPulseSDKClientAPIsRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// QuickPulse endpoint: https://rt.services.visualstudio.com. The default value is "https://rt.services.visualstudio.com". + /// , or is null. + public QuickPulseSDKClientAPIsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string host) + { + ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _host = host ?? throw new ArgumentNullException(nameof(host)); + } + + internal HttpMessage CreatePingRequest(string ikey, string apikey, int? xMsQpsTransmissionTime, string xMsQpsMachineName, string xMsQpsInstanceName, string xMsQpsStreamId, string xMsQpsRoleName, string xMsQpsInvariantVersion, string xMsQpsConfigurationEtag, MonitoringDataPoint monitoringDataPoint) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_host, false); + uri.AppendPath("/QuickPulseService.svc/ping", false); + uri.AppendQuery("ikey", ikey, true); + if (apikey != null) + { + uri.AppendQuery("apikey", apikey, true); + } + request.Uri = uri; + if (xMsQpsTransmissionTime != null) + { + request.Headers.Add("x-ms-qps-transmission-time", xMsQpsTransmissionTime.Value); + } + if (xMsQpsMachineName != null) + { + request.Headers.Add("x-ms-qps-machine-name", xMsQpsMachineName); + } + if (xMsQpsInstanceName != null) + { + request.Headers.Add("x-ms-qps-instance-name", xMsQpsInstanceName); + } + if (xMsQpsStreamId != null) + { + request.Headers.Add("x-ms-qps-stream-id", xMsQpsStreamId); + } + if (xMsQpsRoleName != null) + { + request.Headers.Add("x-ms-qps-role-name", xMsQpsRoleName); + } + if (xMsQpsInvariantVersion != null) + { + request.Headers.Add("x-ms-qps-invariant-version", xMsQpsInvariantVersion); + } + if (xMsQpsConfigurationEtag != null) + { + request.Headers.Add("x-ms-qps-configuration-etag", xMsQpsConfigurationEtag); + } + request.Headers.Add("Accept", "application/json"); + if (monitoringDataPoint != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(monitoringDataPoint); + request.Content = content; + } + return message; + } + + /// SDK ping. + /// The ikey of the target Application Insights component that displays server info sent by /QuickPulseService.svc/ping. + /// Deprecated. An alternative way to pass api key. Use AAD auth instead. + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + /// Computer name where AI SDK lives. QuickPulse uses machine name with instance name as a backup. + /// Service instance name where AI SDK lives. QuickPulse uses machine name with instance name as a backup. + /// Identifies an AI SDK as trusted agent to report metrics and documents. + /// Cloud role name for which SDK reports metrics and documents. + /// Version/generation of the data contract (MonitoringDataPoint) between SDK and QuickPulse. + /// An encoded string that indicates whether the collection configuration is changed. + /// Data contract between SDK and QuickPulse. /QuickPulseService.svc/ping uses this as a backup source of machine name, instance name and invariant version. + /// The cancellation token to use. + /// is null. + public async Task> PingAsync(string ikey, string apikey = null, int? xMsQpsTransmissionTime = null, string xMsQpsMachineName = null, string xMsQpsInstanceName = null, string xMsQpsStreamId = null, string xMsQpsRoleName = null, string xMsQpsInvariantVersion = null, string xMsQpsConfigurationEtag = null, MonitoringDataPoint monitoringDataPoint = null, CancellationToken cancellationToken = default) + { + if (ikey == null) + { + throw new ArgumentNullException(nameof(ikey)); + } + + using var message = CreatePingRequest(ikey, apikey, xMsQpsTransmissionTime, xMsQpsMachineName, xMsQpsInstanceName, xMsQpsStreamId, xMsQpsRoleName, xMsQpsInvariantVersion, xMsQpsConfigurationEtag, monitoringDataPoint); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new QuickPulseSDKClientAPIsPingHeaders(message.Response); + switch (message.Response.Status) + { + case 200: + { + CollectionConfigurationInfo value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CollectionConfigurationInfo.DeserializeCollectionConfigurationInfo(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + case 400: + case 401: + case 403: + case 404: + case 500: + case 503: + { + ServiceError value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceError.DeserializeServiceError(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// SDK ping. + /// The ikey of the target Application Insights component that displays server info sent by /QuickPulseService.svc/ping. + /// Deprecated. An alternative way to pass api key. Use AAD auth instead. + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + /// Computer name where AI SDK lives. QuickPulse uses machine name with instance name as a backup. + /// Service instance name where AI SDK lives. QuickPulse uses machine name with instance name as a backup. + /// Identifies an AI SDK as trusted agent to report metrics and documents. + /// Cloud role name for which SDK reports metrics and documents. + /// Version/generation of the data contract (MonitoringDataPoint) between SDK and QuickPulse. + /// An encoded string that indicates whether the collection configuration is changed. + /// Data contract between SDK and QuickPulse. /QuickPulseService.svc/ping uses this as a backup source of machine name, instance name and invariant version. + /// The cancellation token to use. + /// is null. + public ResponseWithHeaders Ping(string ikey, string apikey = null, int? xMsQpsTransmissionTime = null, string xMsQpsMachineName = null, string xMsQpsInstanceName = null, string xMsQpsStreamId = null, string xMsQpsRoleName = null, string xMsQpsInvariantVersion = null, string xMsQpsConfigurationEtag = null, MonitoringDataPoint monitoringDataPoint = null, CancellationToken cancellationToken = default) + { + if (ikey == null) + { + throw new ArgumentNullException(nameof(ikey)); + } + + using var message = CreatePingRequest(ikey, apikey, xMsQpsTransmissionTime, xMsQpsMachineName, xMsQpsInstanceName, xMsQpsStreamId, xMsQpsRoleName, xMsQpsInvariantVersion, xMsQpsConfigurationEtag, monitoringDataPoint); + _pipeline.Send(message, cancellationToken); + var headers = new QuickPulseSDKClientAPIsPingHeaders(message.Response); + switch (message.Response.Status) + { + case 200: + { + CollectionConfigurationInfo value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CollectionConfigurationInfo.DeserializeCollectionConfigurationInfo(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + case 400: + case 401: + case 403: + case 404: + case 500: + case 503: + { + ServiceError value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceError.DeserializeServiceError(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreatePostRequest(string ikey, string apikey, string xMsQpsConfigurationEtag, int? xMsQpsTransmissionTime, IEnumerable monitoringDataPoints) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.AppendRaw(_host, false); + uri.AppendPath("/QuickPulseService.svc/post", false); + uri.AppendQuery("ikey", ikey, true); + if (apikey != null) + { + uri.AppendQuery("apikey", apikey, true); + } + request.Uri = uri; + if (xMsQpsConfigurationEtag != null) + { + request.Headers.Add("x-ms-qps-configuration-etag", xMsQpsConfigurationEtag); + } + if (xMsQpsTransmissionTime != null) + { + request.Headers.Add("x-ms-qps-transmission-time", xMsQpsTransmissionTime.Value); + } + request.Headers.Add("Accept", "application/json"); + if (monitoringDataPoints != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteStartArray(); + foreach (var item in monitoringDataPoints) + { + content.JsonWriter.WriteObjectValue(item); + } + content.JsonWriter.WriteEndArray(); + request.Content = content; + } + return message; + } + + /// SDK post. + /// The ikey of the target Application Insights component that displays metrics and documents sent by /QuickPulseService.svc/post. + /// An alternative way to pass api key. Deprecated. Use AAD authentication instead. + /// An encoded string that indicates whether the collection configuration is changed. + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + /// Data contract between SDK and QuickPulse. /QuickPulseService.svc/post uses this to publish metrics and documents to the backend QuickPulse server. + /// The cancellation token to use. + /// is null. + public async Task> PostAsync(string ikey, string apikey = null, string xMsQpsConfigurationEtag = null, int? xMsQpsTransmissionTime = null, IEnumerable monitoringDataPoints = null, CancellationToken cancellationToken = default) + { + if (ikey == null) + { + throw new ArgumentNullException(nameof(ikey)); + } + + using var message = CreatePostRequest(ikey, apikey, xMsQpsConfigurationEtag, xMsQpsTransmissionTime, monitoringDataPoints); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + var headers = new QuickPulseSDKClientAPIsPostHeaders(message.Response); + switch (message.Response.Status) + { + case 200: + { + CollectionConfigurationInfo value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CollectionConfigurationInfo.DeserializeCollectionConfigurationInfo(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + case 400: + case 401: + case 403: + case 404: + case 500: + case 503: + { + ServiceError value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServiceError.DeserializeServiceError(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// SDK post. + /// The ikey of the target Application Insights component that displays metrics and documents sent by /QuickPulseService.svc/post. + /// An alternative way to pass api key. Deprecated. Use AAD authentication instead. + /// An encoded string that indicates whether the collection configuration is changed. + /// Timestamp when SDK transmits the metrics and documents to QuickPulse. A 8-byte long type of ticks. + /// Data contract between SDK and QuickPulse. /QuickPulseService.svc/post uses this to publish metrics and documents to the backend QuickPulse server. + /// The cancellation token to use. + /// is null. + public ResponseWithHeaders Post(string ikey, string apikey = null, string xMsQpsConfigurationEtag = null, int? xMsQpsTransmissionTime = null, IEnumerable monitoringDataPoints = null, CancellationToken cancellationToken = default) + { + if (ikey == null) + { + throw new ArgumentNullException(nameof(ikey)); + } + + using var message = CreatePostRequest(ikey, apikey, xMsQpsConfigurationEtag, xMsQpsTransmissionTime, monitoringDataPoints); + _pipeline.Send(message, cancellationToken); + var headers = new QuickPulseSDKClientAPIsPostHeaders(message.Response); + switch (message.Response.Status) + { + case 200: + { + CollectionConfigurationInfo value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CollectionConfigurationInfo.DeserializeCollectionConfigurationInfo(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + case 400: + case 401: + case 403: + case 404: + case 500: + case 503: + { + ServiceError value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServiceError.DeserializeServiceError(document.RootElement); + return ResponseWithHeaders.FromValue(value, headers, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Internals/Diagnostics/LiveMetricsExporterEventSource.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Internals/Diagnostics/LiveMetricsExporterEventSource.cs new file mode 100644 index 0000000000000..276e70a33171d --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Internals/Diagnostics/LiveMetricsExporterEventSource.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Diagnostics.Tracing; +using System.Runtime.CompilerServices; +using Azure.Monitor.OpenTelemetry.Exporter.Internals; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Internals.Diagnostics +{ + /// + /// EventSource for the AzureMonitorExporter. + /// EventSource Guid at Runtime: 72f5588f-fa1c-502e-0627-e13dd2bd67c9. + /// (This guid can be found by debugging this class and inspecting the "Log" singleton and reading the "Guid" property). + /// + /// + /// PerfView Instructions: + /// + /// To collect all events: PerfView.exe collect -MaxCollectSec:300 -NoGui /onlyProviders=*OpenTelemetry-AzureMonitor-LiveMetrics + /// To collect events based on LogLevel: PerfView.exe collect -MaxCollectSec:300 -NoGui /onlyProviders:OpenTelemetry-AzureMonitor-LiveMetrics::Verbose + /// + /// Dotnet-Trace Instructions: + /// + /// To collect all events: dotnet-trace collect --process-id PID --providers OpenTelemetry-AzureMonitor-LiveMetrics + /// To collect events based on LogLevel: dotnet-trace collect --process-id PID --providers OpenTelemetry-AzureMonitor-LiveMetrics::Verbose + /// + /// Logman Instructions: + /// + /// Create a text file containing providers: echo "{72f5588f-fa1c-502e-0627-e13dd2bd67c9}" > providers.txt + /// Start collecting: logman -start exporter -pf providers.txt -ets -bs 1024 -nb 100 256 + /// Stop collecting: logman -stop exporter -ets + /// + /// + [EventSource(Name = EventSourceName)] + internal sealed class LiveMetricsExporterEventSource : EventSource + { + internal const string EventSourceName = "OpenTelemetry-AzureMonitor-LiveMetrics"; + + internal static readonly LiveMetricsExporterEventSource Log = new LiveMetricsExporterEventSource(); + + [NonEvent] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private bool IsEnabled(EventLevel eventLevel) => IsEnabled(eventLevel, EventKeywords.All); + + [NonEvent] + public void FailedToParseConnectionString(Exception ex) + { + if (IsEnabled(EventLevel.Error)) + { + FailedToParseConnectionString(ex.FlattenException().ToInvariantString()); + } + } + + [Event(1, Message = "Failed to parse ConnectionString due to an exception: {0}", Level = EventLevel.Error)] + public void FailedToParseConnectionString(string exceptionMessage) => WriteEvent(1, exceptionMessage); + + [NonEvent] + public void FailedToReadEnvironmentVariables(Exception ex) + { + if (IsEnabled(EventLevel.Warning)) + { + FailedToReadEnvironmentVariables(ex.FlattenException().ToInvariantString()); + } + } + + [Event(2, Message = "Failed to read environment variables due to an exception. This may prevent the Exporter from initializing. {0}", Level = EventLevel.Warning)] + public void FailedToReadEnvironmentVariables(string errorMessage) => WriteEvent(2, errorMessage); + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Properties/AssemblyInfo.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..c8296a1ac6153 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/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: InternalsVisibleTo("Azure.Monitor.OpenTelemetry.LiveMetrics.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Moq +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/autorest.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/autorest.md new file mode 100644 index 0000000000000..c999fae32e5f7 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/src/autorest.md @@ -0,0 +1,17 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +input-file: + - https://quickpulsespecs.blob.core.windows.net/specs/swagger-v2-for%20sdk%20only.json. +generation1-convenience-client: true +``` + +``` yaml +directive: +- from: swagger-document + where: $.definitions.* + transform: > + $["x-accessibility"]="internal" +``` diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests.csproj b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests.csproj new file mode 100644 index 0000000000000..5d507733c892a --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests.csproj @@ -0,0 +1,25 @@ + + + + $(RequiredTargetFrameworks) + enable + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests/LiveMetricsExporterEventSourceTests.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests/LiveMetricsExporterEventSourceTests.cs new file mode 100644 index 0000000000000..927f68ec17be7 --- /dev/null +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/tests/Azure.Monitor.OpenTelemetry.LiveMetrics.Tests/LiveMetricsExporterEventSourceTests.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Monitor.OpenTelemetry.Exporter.Tests.CommonTestFramework; +using Azure.Monitor.OpenTelemetry.LiveMetrics.Internals.Diagnostics; +using Xunit; + +namespace Azure.Monitor.OpenTelemetry.LiveMetrics.Tests +{ + public class LiveMetricsExporterEventSourceTests + { + /// + /// This test uses reflection to invoke every Event method in our EventSource class. + /// This validates that parameters are logged and helps to confirm that EventIds are correct. + /// + [Fact] + public void EventSourceTest_LiveMetricsExporterEventSource() + { + EventSourceTestHelper.MethodsAreImplementedConsistentlyWithTheirAttributes(LiveMetricsExporterEventSource.Log); + } + } +} diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.sln b/sdk/monitor/Azure.Monitor.OpenTelemetry.sln index e44b61ad022d8..42912211350d8 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.sln +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.sln @@ -52,6 +52,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core", "..\core\Azure EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp", "Azure.Monitor.OpenTelemetry.Exporter\tests\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp\Azure.Monitor.OpenTelemetry.Exporter.AotCompatibilityTestApp.csproj", "{D2174A00-93CF-4337-8600-4CE758C7D4AC}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Monitor.OpenTelemetry.LiveMetrics", "Azure.Monitor.OpenTelemetry.LiveMetrics\src\Azure.Monitor.OpenTelemetry.LiveMetrics.csproj", "{C13C8648-2B37-4334-97DC-322344E8EE8C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Monitor.OpenTelemetry.LiveMetrics.Tests", "Azure.Monitor.OpenTelemetry.LiveMetrics\tests\Azure.Monitor.OpenTelemetry.LiveMetrics.Tests\Azure.Monitor.OpenTelemetry.LiveMetrics.Tests.csproj", "{EA90D06D-D272-4A65-8DDA-6412B3F14572}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -114,6 +118,14 @@ Global {D2174A00-93CF-4337-8600-4CE758C7D4AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {D2174A00-93CF-4337-8600-4CE758C7D4AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {D2174A00-93CF-4337-8600-4CE758C7D4AC}.Release|Any CPU.Build.0 = Release|Any CPU + {C13C8648-2B37-4334-97DC-322344E8EE8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C13C8648-2B37-4334-97DC-322344E8EE8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C13C8648-2B37-4334-97DC-322344E8EE8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C13C8648-2B37-4334-97DC-322344E8EE8C}.Release|Any CPU.Build.0 = Release|Any CPU + {EA90D06D-D272-4A65-8DDA-6412B3F14572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA90D06D-D272-4A65-8DDA-6412B3F14572}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA90D06D-D272-4A65-8DDA-6412B3F14572}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA90D06D-D272-4A65-8DDA-6412B3F14572}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs b/sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs index da99eeb648e17..f2a3a30b517bf 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ActionGroupCollection() { } } public partial class ActionGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public ActionGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ActionGroupData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList ArmRoleReceivers { get { throw null; } } public System.Collections.Generic.IList AutomationRunbookReceivers { get { throw null; } } public System.Collections.Generic.IList AzureAppPushReceivers { get { throw null; } } @@ -79,7 +79,7 @@ protected ActivityLogAlertCollection() { } } public partial class ActivityLogAlertData : Azure.ResourceManager.Models.TrackedResourceData { - public ActivityLogAlertData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ActivityLogAlertData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList ActionsActionGroups { get { throw null; } } public System.Collections.Generic.IList ConditionAllOf { get { throw null; } set { } } public string Description { get { throw null; } set { } } @@ -125,7 +125,7 @@ protected AlertRuleCollection() { } } public partial class AlertRuleData : Azure.ResourceManager.Models.TrackedResourceData { - public AlertRuleData(Azure.Core.AzureLocation location, string alertRuleName, bool isEnabled, Azure.ResourceManager.Monitor.Models.AlertRuleCondition condition) : base (default(Azure.Core.AzureLocation)) { } + public AlertRuleData(Azure.Core.AzureLocation location, string alertRuleName, bool isEnabled, Azure.ResourceManager.Monitor.Models.AlertRuleCondition condition) { } public Azure.ResourceManager.Monitor.Models.AlertRuleAction Action { get { throw null; } set { } } public System.Collections.Generic.IList Actions { get { throw null; } } public string AlertRuleName { get { throw null; } set { } } @@ -178,7 +178,7 @@ protected AutoscaleSettingCollection() { } } public partial class AutoscaleSettingData : Azure.ResourceManager.Models.TrackedResourceData { - public AutoscaleSettingData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable profiles) : base (default(Azure.Core.AzureLocation)) { } + public AutoscaleSettingData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable profiles) { } public string AutoscaleSettingName { get { throw null; } set { } } public bool? IsEnabled { get { throw null; } set { } } public System.Collections.Generic.IList Notifications { get { throw null; } set { } } @@ -228,7 +228,7 @@ protected DataCollectionEndpointCollection() { } } public partial class DataCollectionEndpointData : Azure.ResourceManager.Models.TrackedResourceData { - public DataCollectionEndpointData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DataCollectionEndpointData(Azure.Core.AzureLocation location) { } public string ConfigurationAccessEndpoint { get { throw null; } } public string Description { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } @@ -327,7 +327,7 @@ protected DataCollectionRuleCollection() { } } public partial class DataCollectionRuleData : Azure.ResourceManager.Models.TrackedResourceData { - public DataCollectionRuleData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DataCollectionRuleData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier DataCollectionEndpointId { get { throw null; } set { } } public System.Collections.Generic.IList DataFlows { get { throw null; } } public Azure.ResourceManager.Monitor.Models.DataCollectionRuleDataSources DataSources { get { throw null; } set { } } @@ -459,7 +459,7 @@ protected LogProfileCollection() { } } public partial class LogProfileData : Azure.ResourceManager.Models.TrackedResourceData { - public LogProfileData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable locations, System.Collections.Generic.IEnumerable categories, Azure.ResourceManager.Monitor.Models.RetentionPolicy retentionPolicy) : base (default(Azure.Core.AzureLocation)) { } + public LogProfileData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable locations, System.Collections.Generic.IEnumerable categories, Azure.ResourceManager.Monitor.Models.RetentionPolicy retentionPolicy) { } public System.Collections.Generic.IList Categories { get { throw null; } } public System.Collections.Generic.IList Locations { get { throw null; } } public Azure.ResourceManager.Monitor.Models.RetentionPolicy RetentionPolicy { get { throw null; } set { } } @@ -505,7 +505,7 @@ protected MetricAlertCollection() { } } public partial class MetricAlertData : Azure.ResourceManager.Models.TrackedResourceData { - public MetricAlertData(Azure.Core.AzureLocation location, int severity, bool isEnabled, System.Collections.Generic.IEnumerable scopes, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, Azure.ResourceManager.Monitor.Models.MetricAlertCriteria criteria) : base (default(Azure.Core.AzureLocation)) { } + public MetricAlertData(Azure.Core.AzureLocation location, int severity, bool isEnabled, System.Collections.Generic.IEnumerable scopes, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, Azure.ResourceManager.Monitor.Models.MetricAlertCriteria criteria) { } public System.Collections.Generic.IList Actions { get { throw null; } } public Azure.ResourceManager.Monitor.Models.MetricAlertCriteria Criteria { get { throw null; } set { } } public string Description { get { throw null; } set { } } @@ -753,7 +753,7 @@ protected MonitorPrivateLinkScopeCollection() { } } public partial class MonitorPrivateLinkScopeData : Azure.ResourceManager.Models.TrackedResourceData { - public MonitorPrivateLinkScopeData(Azure.Core.AzureLocation location, Azure.ResourceManager.Monitor.Models.MonitorPrivateLinkAccessModeSettings accessModeSettings) : base (default(Azure.Core.AzureLocation)) { } + public MonitorPrivateLinkScopeData(Azure.Core.AzureLocation location, Azure.ResourceManager.Monitor.Models.MonitorPrivateLinkAccessModeSettings accessModeSettings) { } public Azure.ResourceManager.Monitor.Models.MonitorPrivateLinkAccessModeSettings AccessModeSettings { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public string ProvisioningState { get { throw null; } } @@ -863,7 +863,7 @@ protected MonitorWorkspaceResourceCollection() { } } public partial class MonitorWorkspaceResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public MonitorWorkspaceResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MonitorWorkspaceResourceData(Azure.Core.AzureLocation location) { } public string AccountId { get { throw null; } } public Azure.ResourceManager.Monitor.Models.MonitorWorkspaceDefaultIngestionSettings DefaultIngestionSettings { get { throw null; } } public Azure.ETag? ETag { get { throw null; } } @@ -891,7 +891,7 @@ protected ScheduledQueryRuleCollection() { } } public partial class ScheduledQueryRuleData : Azure.ResourceManager.Models.TrackedResourceData { - public ScheduledQueryRuleData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ScheduledQueryRuleData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Monitor.Models.ScheduledQueryRuleActions Actions { get { throw null; } set { } } public bool? AutoMitigate { get { throw null; } set { } } public bool? CheckWorkspaceAlertsStorageConfigured { get { throw null; } set { } } @@ -952,6 +952,142 @@ protected VmInsightsOnboardingStatusResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Monitor.Mocking +{ + public partial class MockableMonitorArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMonitorArmClient() { } + public virtual Azure.ResourceManager.Monitor.ActionGroupResource GetActionGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.ActivityLogAlertResource GetActivityLogAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.AlertRuleResource GetAlertRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.AutoscaleSettingResource GetAutoscaleSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.DataCollectionEndpointResource GetDataCollectionEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetDataCollectionRuleAssociation(Azure.Core.ResourceIdentifier scope, string associationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataCollectionRuleAssociationAsync(Azure.Core.ResourceIdentifier scope, string associationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.DataCollectionRuleAssociationResource GetDataCollectionRuleAssociationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.DataCollectionRuleAssociationCollection GetDataCollectionRuleAssociations(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Monitor.DataCollectionRuleResource GetDataCollectionRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetDiagnosticSetting(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiagnosticSettingAsync(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.DiagnosticSettingResource GetDiagnosticSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.DiagnosticSettingCollection GetDiagnosticSettings(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Monitor.DiagnosticSettingsCategoryCollection GetDiagnosticSettingsCategories(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetDiagnosticSettingsCategory(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiagnosticSettingsCategoryAsync(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.DiagnosticSettingsCategoryResource GetDiagnosticSettingsCategoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.LogProfileResource GetLogProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.MetricAlertResource GetMetricAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Pageable GetMonitorMetricBaselines(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.Monitor.Models.ArmResourceGetMonitorMetricBaselinesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMonitorMetricBaselinesAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.Monitor.Models.ArmResourceGetMonitorMetricBaselinesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMonitorMetricDefinitions(Azure.Core.ResourceIdentifier scope, string metricnamespace = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMonitorMetricDefinitionsAsync(Azure.Core.ResourceIdentifier scope, string metricnamespace = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMonitorMetricNamespaces(Azure.Core.ResourceIdentifier scope, string startTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMonitorMetricNamespacesAsync(Azure.Core.ResourceIdentifier scope, string startTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMonitorMetrics(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.Monitor.Models.ArmResourceGetMonitorMetricsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMonitorMetricsAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.Monitor.Models.ArmResourceGetMonitorMetricsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.MonitorPrivateEndpointConnectionResource GetMonitorPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.MonitorPrivateLinkResource GetMonitorPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.MonitorPrivateLinkScopedResource GetMonitorPrivateLinkScopedResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.MonitorPrivateLinkScopeResource GetMonitorPrivateLinkScopeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.MonitorWorkspaceResource GetMonitorWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.ScheduledQueryRuleResource GetScheduledQueryRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Monitor.VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatus(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.Monitor.VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatusResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMonitorResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMonitorResourceGroupResource() { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.ResourceManager.ArmOperation CreateNotifications(Azure.WaitUntil waitUntil, Azure.ResourceManager.Monitor.Models.NotificationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual System.Threading.Tasks.Task> CreateNotificationsAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Monitor.Models.NotificationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetActionGroup(string actionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetActionGroupAsync(string actionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.ActionGroupCollection GetActionGroups() { throw null; } + public virtual Azure.Response GetActivityLogAlert(string activityLogAlertName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetActivityLogAlertAsync(string activityLogAlertName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.ActivityLogAlertCollection GetActivityLogAlerts() { throw null; } + public virtual Azure.Response GetAlertRule(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAlertRuleAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.AlertRuleCollection GetAlertRules() { throw null; } + public virtual Azure.Response GetAutoscaleSetting(string autoscaleSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutoscaleSettingAsync(string autoscaleSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.AutoscaleSettingCollection GetAutoscaleSettings() { throw null; } + public virtual Azure.Response GetDataCollectionEndpoint(string dataCollectionEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataCollectionEndpointAsync(string dataCollectionEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.DataCollectionEndpointCollection GetDataCollectionEndpoints() { throw null; } + public virtual Azure.Response GetDataCollectionRule(string dataCollectionRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataCollectionRuleAsync(string dataCollectionRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.DataCollectionRuleCollection GetDataCollectionRules() { throw null; } + public virtual Azure.Response GetMetricAlert(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMetricAlertAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.MetricAlertCollection GetMetricAlerts() { throw null; } + public virtual Azure.Response GetMonitorPrivateLinkScope(string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMonitorPrivateLinkScopeAsync(string scopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.MonitorPrivateLinkScopeCollection GetMonitorPrivateLinkScopes() { throw null; } + public virtual Azure.Response GetMonitorWorkspaceResource(string azureMonitorWorkspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMonitorWorkspaceResourceAsync(string azureMonitorWorkspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.MonitorWorkspaceResourceCollection GetMonitorWorkspaceResources() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Response GetNotificationStatus(string notificationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual System.Threading.Tasks.Task> GetNotificationStatusAsync(string notificationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPrivateLinkScopeOperationStatus(string asyncOperationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPrivateLinkScopeOperationStatusAsync(string asyncOperationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetScheduledQueryRule(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetScheduledQueryRuleAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.ScheduledQueryRuleCollection GetScheduledQueryRules() { throw null; } + } + public partial class MockableMonitorSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMonitorSubscriptionResource() { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.ResourceManager.ArmOperation CreateNotifications(Azure.WaitUntil waitUntil, Azure.ResourceManager.Monitor.Models.NotificationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual System.Threading.Tasks.Task> CreateNotificationsAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Monitor.Models.NotificationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetActionGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetActionGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetActivityLogAlerts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetActivityLogAlertsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetActivityLogs(string filter, string select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetActivityLogsAsync(string filter, string select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAlertRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAlertRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAutoscaleSettings(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAutoscaleSettingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataCollectionEndpoints(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataCollectionEndpointsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataCollectionRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataCollectionRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetLogProfile(string logProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLogProfileAsync(string logProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Monitor.LogProfileCollection GetLogProfiles() { throw null; } + public virtual Azure.Pageable GetMetricAlerts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMetricAlertsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMonitorMetrics(Azure.ResourceManager.Monitor.Models.SubscriptionResourceGetMonitorMetricsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMonitorMetricsAsync(Azure.ResourceManager.Monitor.Models.SubscriptionResourceGetMonitorMetricsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMonitorMetricsWithPost(Azure.ResourceManager.Monitor.Models.SubscriptionResourceGetMonitorMetricsWithPostOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMonitorMetricsWithPostAsync(Azure.ResourceManager.Monitor.Models.SubscriptionResourceGetMonitorMetricsWithPostOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMonitorPrivateLinkScopes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMonitorPrivateLinkScopesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMonitorWorkspaceResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMonitorWorkspaceResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Response GetNotificationStatus(string notificationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual System.Threading.Tasks.Task> GetNotificationStatusAsync(string notificationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetScheduledQueryRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetScheduledQueryRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableMonitorTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableMonitorTenantResource() { } + public virtual Azure.Pageable GetEventCategories(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEventCategoriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetTenantActivityLogs(string filter = null, string select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTenantActivityLogsAsync(string filter = null, string select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Monitor.Models { public partial class ActionGroupEnableContent diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MockableMonitorResourceGroupResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MockableMonitorResourceGroupResource.cs new file mode 100644 index 0000000000000..a4f9ed68cfc04 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MockableMonitorResourceGroupResource.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Monitor.Models; + +namespace Azure.ResourceManager.Monitor.Mocking +{ + public partial class MockableMonitorResourceGroupResource : ArmResource + { + private ClientDiagnostics _deprecatedActionGroupClientDiagnostics; + private DeprecatedActionGroupsRestOperations _deprecatedActionGroupRestClient; + + private ClientDiagnostics DeprecatedActionGroupClientDiagnostics => _deprecatedActionGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActionGroupResource.ResourceType.Namespace, Diagnostics); + private DeprecatedActionGroupsRestOperations DeprecatedActionGroupRestClient => _deprecatedActionGroupRestClient ??= new DeprecatedActionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ActionGroupResource.ResourceType)); + + /// + /// Send test notifications to a set of provided receivers + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/createNotifications + /// + /// + /// Operation Id + /// ActionGroups_CreateNotificationsAtResourceGroupLevel + /// + /// + /// + /// 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 notification request body which includes the contact details. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task> CreateNotificationsAsync(WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateNotifications"); + scope.Start(); + try + { + var response = await DeprecatedActionGroupRestClient.CreateNotificationsAtResourceGroupLevelAsync(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken).ConfigureAwait(false); + var operation = new MonitorArmOperation(new NotificationStatusOperationSource(), DeprecatedActionGroupClientDiagnostics, Pipeline, DeprecatedActionGroupRestClient.CreateCreateNotificationsAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Send test notifications to a set of provided receivers + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/createNotifications + /// + /// + /// Operation Id + /// ActionGroups_CreateNotificationsAtResourceGroupLevel + /// + /// + /// + /// 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 notification request body which includes the contact details. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual ArmOperation CreateNotifications(WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateNotifications"); + scope.Start(); + try + { + var response = DeprecatedActionGroupRestClient.CreateNotificationsAtResourceGroupLevel(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken); + var operation = new MonitorArmOperation(new NotificationStatusOperationSource(), DeprecatedActionGroupClientDiagnostics, Pipeline, DeprecatedActionGroupRestClient.CreateCreateNotificationsAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the test notifications by the notification id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/notificationStatus/{notificationId} + /// + /// + /// Operation Id + /// ActionGroups_GetTestNotificationsAtResourceGroupLevel + /// + /// + /// + /// The notification id. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task> GetNotificationStatusAsync(string notificationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(notificationId, nameof(notificationId)); + + using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetNotificationStatus"); + scope.Start(); + try + { + var response = await DeprecatedActionGroupRestClient.GetTestNotificationsAtResourceGroupLevelAsync(Id.SubscriptionId, Id.ResourceGroupName, notificationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the test notifications by the notification id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/notificationStatus/{notificationId} + /// + /// + /// Operation Id + /// ActionGroups_GetTestNotificationsAtResourceGroupLevel + /// + /// + /// + /// The notification id. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Response GetNotificationStatus(string notificationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(notificationId, nameof(notificationId)); + + using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetNotificationStatus"); + scope.Start(); + try + { + var response = DeprecatedActionGroupRestClient.GetTestNotificationsAtResourceGroupLevel(Id.SubscriptionId, Id.ResourceGroupName, notificationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MockableMonitorSubscriptionResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MockableMonitorSubscriptionResource.cs new file mode 100644 index 0000000000000..2e3b0ef07d12b --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MockableMonitorSubscriptionResource.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Monitor.Models; + +namespace Azure.ResourceManager.Monitor.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMonitorSubscriptionResource : ArmResource + { + private ClientDiagnostics _deprecatedActionGroupClientDiagnostics; + private DeprecatedActionGroupsRestOperations _deprecatedActionGroupRestClient; + + private ClientDiagnostics DeprecatedActionGroupClientDiagnostics => _deprecatedActionGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActionGroupResource.ResourceType.Namespace, Diagnostics); + private DeprecatedActionGroupsRestOperations DeprecatedActionGroupRestClient => _deprecatedActionGroupRestClient ??= new DeprecatedActionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ActionGroupResource.ResourceType)); + + /// + /// Send test notifications to a set of provided receivers + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications + /// + /// + /// Operation Id + /// ActionGroups_PostTestNotifications + /// + /// + /// + /// 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 notification request body which includes the contact details. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task> CreateNotificationsAsync(WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateNotifications"); + scope.Start(); + try + { + var response = await DeprecatedActionGroupRestClient.PostTestNotificationsAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + var operation = new MonitorArmOperation(new NotificationStatusOperationSource(), DeprecatedActionGroupClientDiagnostics, Pipeline, DeprecatedActionGroupRestClient.CreatePostTestNotificationsRequest(Id.SubscriptionId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Send test notifications to a set of provided receivers + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications + /// + /// + /// Operation Id + /// ActionGroups_PostTestNotifications + /// + /// + /// + /// 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 notification request body which includes the contact details. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual ArmOperation CreateNotifications(WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateNotifications"); + scope.Start(); + try + { + var response = DeprecatedActionGroupRestClient.PostTestNotifications(Id.SubscriptionId, content, cancellationToken); + var operation = new MonitorArmOperation(new NotificationStatusOperationSource(), DeprecatedActionGroupClientDiagnostics, Pipeline, DeprecatedActionGroupRestClient.CreatePostTestNotificationsRequest(Id.SubscriptionId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the test notifications by the notification id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId} + /// + /// + /// Operation Id + /// ActionGroups_GetTestNotifications + /// + /// + /// + /// The notification id. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task> GetNotificationStatusAsync(string notificationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(notificationId, nameof(notificationId)); + + using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetNotificationStatus"); + scope.Start(); + try + { + var response = await DeprecatedActionGroupRestClient.GetTestNotificationsAsync(Id.SubscriptionId, notificationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the test notifications by the notification id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId} + /// + /// + /// Operation Id + /// ActionGroups_GetTestNotifications + /// + /// + /// + /// The notification id. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Response GetNotificationStatus(string notificationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(notificationId, nameof(notificationId)); + + using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetNotificationStatus"); + scope.Start(); + try + { + var response = DeprecatedActionGroupRestClient.GetTestNotifications(Id.SubscriptionId, notificationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MonitorExtensions.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MonitorExtensions.cs index ce372a76a209f..6fd62ee77eef2 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MonitorExtensions.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/MonitorExtensions.cs @@ -7,7 +7,6 @@ using System.ComponentModel; using System.Threading; using System.Threading.Tasks; -using Azure.Core; using Azure.ResourceManager.Monitor.Models; using Azure.ResourceManager.Resources; @@ -36,9 +35,7 @@ public static partial class MonitorExtensions [EditorBrowsable(EditorBrowsableState.Never)] public static async Task> CreateNotificationsAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CreateNotificationsAsync(waitUntil, content, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorSubscriptionResource(subscriptionResource).CreateNotificationsAsync(waitUntil, content, cancellationToken).ConfigureAwait(false); } /// @@ -62,9 +59,7 @@ public static async Task> CreateNotificationsAs [EditorBrowsable(EditorBrowsableState.Never)] public static ArmOperation CreateNotifications(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CreateNotifications(waitUntil, content, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).CreateNotifications(waitUntil, content, cancellationToken); } /// @@ -88,9 +83,7 @@ public static ArmOperation CreateNotifications(this Subscrip [EditorBrowsable(EditorBrowsableState.Never)] public static async Task> GetNotificationStatusAsync(this SubscriptionResource subscriptionResource, string notificationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(notificationId, nameof(notificationId)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetNotificationStatusAsync(notificationId, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorSubscriptionResource(subscriptionResource).GetNotificationStatusAsync(notificationId, cancellationToken).ConfigureAwait(false); } /// @@ -114,9 +107,7 @@ public static async Task> GetNotificationStatusAsyn [EditorBrowsable(EditorBrowsableState.Never)] public static Response GetNotificationStatus(this SubscriptionResource subscriptionResource, string notificationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(notificationId, nameof(notificationId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNotificationStatus(notificationId, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetNotificationStatus(notificationId, cancellationToken); } /// @@ -140,9 +131,7 @@ public static Response GetNotificationStatus(this Subscripti [EditorBrowsable(EditorBrowsableState.Never)] public static async Task> CreateNotificationsAsync(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateNotificationsAsync(waitUntil, content, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).CreateNotificationsAsync(waitUntil, content, cancellationToken).ConfigureAwait(false); } /// @@ -166,9 +155,7 @@ public static async Task> CreateNotificationsAs [EditorBrowsable(EditorBrowsableState.Never)] public static ArmOperation CreateNotifications(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateNotifications(waitUntil, content, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).CreateNotifications(waitUntil, content, cancellationToken); } /// @@ -192,9 +179,7 @@ public static ArmOperation CreateNotifications(this Resource [EditorBrowsable(EditorBrowsableState.Never)] public static async Task> GetNotificationStatusAsync(this ResourceGroupResource resourceGroupResource, string notificationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(notificationId, nameof(notificationId)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNotificationStatusAsync(notificationId, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetNotificationStatusAsync(notificationId, cancellationToken).ConfigureAwait(false); } /// @@ -218,9 +203,7 @@ public static async Task> GetNotificationStatusAsyn [EditorBrowsable(EditorBrowsableState.Never)] public static Response GetNotificationStatus(this ResourceGroupResource resourceGroupResource, string notificationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(notificationId, nameof(notificationId)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNotificationStatus(notificationId, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetNotificationStatus(notificationId, cancellationToken); } } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 804ae198397a0..0000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,155 +0,0 @@ -// 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.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Monitor.Models; - -namespace Azure.ResourceManager.Monitor -{ - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _deprecatedActionGroupClientDiagnostics; - private DeprecatedActionGroupsRestOperations _deprecatedActionGroupRestClient; - - private ClientDiagnostics DeprecatedActionGroupClientDiagnostics => _deprecatedActionGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActionGroupResource.ResourceType.Namespace, Diagnostics); - private DeprecatedActionGroupsRestOperations DeprecatedActionGroupRestClient => _deprecatedActionGroupRestClient ??= new DeprecatedActionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ActionGroupResource.ResourceType)); - - /// - /// Send test notifications to a set of provided receivers - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/createNotifications - /// - /// - /// Operation Id - /// ActionGroups_CreateNotificationsAtResourceGroupLevel - /// - /// - /// - /// 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 notification request body which includes the contact details. - /// The cancellation token to use. - public virtual async Task> CreateNotificationsAsync(WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) - { - using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateNotifications"); - scope.Start(); - try - { - var response = await DeprecatedActionGroupRestClient.CreateNotificationsAtResourceGroupLevelAsync(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken).ConfigureAwait(false); - var operation = new MonitorArmOperation(new NotificationStatusOperationSource(), DeprecatedActionGroupClientDiagnostics, Pipeline, DeprecatedActionGroupRestClient.CreateCreateNotificationsAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Send test notifications to a set of provided receivers - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/createNotifications - /// - /// - /// Operation Id - /// ActionGroups_CreateNotificationsAtResourceGroupLevel - /// - /// - /// - /// 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 notification request body which includes the contact details. - /// The cancellation token to use. - public virtual ArmOperation CreateNotifications(WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) - { - using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateNotifications"); - scope.Start(); - try - { - var response = DeprecatedActionGroupRestClient.CreateNotificationsAtResourceGroupLevel(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken); - var operation = new MonitorArmOperation(new NotificationStatusOperationSource(), DeprecatedActionGroupClientDiagnostics, Pipeline, DeprecatedActionGroupRestClient.CreateCreateNotificationsAtResourceGroupLevelRequest(Id.SubscriptionId, Id.ResourceGroupName, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the test notifications by the notification id - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/notificationStatus/{notificationId} - /// - /// - /// Operation Id - /// ActionGroups_GetTestNotificationsAtResourceGroupLevel - /// - /// - /// - /// The notification id. - /// The cancellation token to use. - public virtual async Task> GetNotificationStatusAsync(string notificationId, CancellationToken cancellationToken = default) - { - using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetNotificationStatus"); - scope.Start(); - try - { - var response = await DeprecatedActionGroupRestClient.GetTestNotificationsAtResourceGroupLevelAsync(Id.SubscriptionId, Id.ResourceGroupName, notificationId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the test notifications by the notification id - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/notificationStatus/{notificationId} - /// - /// - /// Operation Id - /// ActionGroups_GetTestNotificationsAtResourceGroupLevel - /// - /// - /// - /// The notification id. - /// The cancellation token to use. - public virtual Response GetNotificationStatus(string notificationId, CancellationToken cancellationToken = default) - { - using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetNotificationStatus"); - scope.Start(); - try - { - var response = DeprecatedActionGroupRestClient.GetTestNotificationsAtResourceGroupLevel(Id.SubscriptionId, Id.ResourceGroupName, notificationId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 63eff6eaff83e..0000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,156 +0,0 @@ -// 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.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Monitor.Models; - -namespace Azure.ResourceManager.Monitor -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _deprecatedActionGroupClientDiagnostics; - private DeprecatedActionGroupsRestOperations _deprecatedActionGroupRestClient; - - private ClientDiagnostics DeprecatedActionGroupClientDiagnostics => _deprecatedActionGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActionGroupResource.ResourceType.Namespace, Diagnostics); - private DeprecatedActionGroupsRestOperations DeprecatedActionGroupRestClient => _deprecatedActionGroupRestClient ??= new DeprecatedActionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ActionGroupResource.ResourceType)); - - /// - /// Send test notifications to a set of provided receivers - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications - /// - /// - /// Operation Id - /// ActionGroups_PostTestNotifications - /// - /// - /// - /// 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 notification request body which includes the contact details. - /// The cancellation token to use. - public virtual async Task> CreateNotificationsAsync(WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) - { - using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateNotifications"); - scope.Start(); - try - { - var response = await DeprecatedActionGroupRestClient.PostTestNotificationsAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - var operation = new MonitorArmOperation(new NotificationStatusOperationSource(), DeprecatedActionGroupClientDiagnostics, Pipeline, DeprecatedActionGroupRestClient.CreatePostTestNotificationsRequest(Id.SubscriptionId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Send test notifications to a set of provided receivers - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications - /// - /// - /// Operation Id - /// ActionGroups_PostTestNotifications - /// - /// - /// - /// 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 notification request body which includes the contact details. - /// The cancellation token to use. - public virtual ArmOperation CreateNotifications(WaitUntil waitUntil, NotificationContent content, CancellationToken cancellationToken = default) - { - using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CreateNotifications"); - scope.Start(); - try - { - var response = DeprecatedActionGroupRestClient.PostTestNotifications(Id.SubscriptionId, content, cancellationToken); - var operation = new MonitorArmOperation(new NotificationStatusOperationSource(), DeprecatedActionGroupClientDiagnostics, Pipeline, DeprecatedActionGroupRestClient.CreatePostTestNotificationsRequest(Id.SubscriptionId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the test notifications by the notification id - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId} - /// - /// - /// Operation Id - /// ActionGroups_GetTestNotifications - /// - /// - /// - /// The notification id. - /// The cancellation token to use. - public virtual async Task> GetNotificationStatusAsync(string notificationId, CancellationToken cancellationToken = default) - { - using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetNotificationStatus"); - scope.Start(); - try - { - var response = await DeprecatedActionGroupRestClient.GetTestNotificationsAsync(Id.SubscriptionId, notificationId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the test notifications by the notification id - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId} - /// - /// - /// Operation Id - /// ActionGroups_GetTestNotifications - /// - /// - /// - /// The notification id. - /// The cancellation token to use. - public virtual Response GetNotificationStatus(string notificationId, CancellationToken cancellationToken = default) - { - using var scope = DeprecatedActionGroupClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetNotificationStatus"); - scope.Start(); - try - { - var response = DeprecatedActionGroupRestClient.GetTestNotifications(Id.SubscriptionId, notificationId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActionGroupResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActionGroupResource.cs index 4faadf704ae71..eb4b97d1301ef 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActionGroupResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActionGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Monitor public partial class ActionGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The actionGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string actionGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActivityLogAlertResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActivityLogAlertResource.cs index 1f5425bd63432..c12019c0dc730 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActivityLogAlertResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ActivityLogAlertResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Monitor public partial class ActivityLogAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The activityLogAlertName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string activityLogAlertName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AlertRuleResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AlertRuleResource.cs index 07fdca0c3c94f..fbce430cae6b9 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AlertRuleResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AlertRuleResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Monitor public partial class AlertRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AutoscaleSettingResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AutoscaleSettingResource.cs index 57c2a220eb821..b3f1e07e0c108 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AutoscaleSettingResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/AutoscaleSettingResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Monitor public partial class AutoscaleSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The autoscaleSettingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string autoscaleSettingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionEndpointResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionEndpointResource.cs index fb7c4c96e4638..93bbf9b8c48c2 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionEndpointResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionEndpointResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Monitor public partial class DataCollectionEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dataCollectionEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dataCollectionEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleAssociationResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleAssociationResource.cs index 73afee137a6b6..2d121d4be8e36 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleAssociationResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleAssociationResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Monitor public partial class DataCollectionRuleAssociationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The associationName. public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string associationName) { var resourceId = $"{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleResource.cs index 56c1ad88d919f..7a51f9768af19 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DataCollectionRuleResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Monitor public partial class DataCollectionRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dataCollectionRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dataCollectionRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingResource.cs index 379479810bfc3..243e13ad4d060 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Monitor public partial class DiagnosticSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string name) { var resourceId = $"{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingsCategoryResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingsCategoryResource.cs index 0ac78d6374951..2d02ef3fc2933 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingsCategoryResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/DiagnosticSettingsCategoryResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Monitor public partial class DiagnosticSettingsCategoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string name) { var resourceId = $"{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 376d1af6787ce..0000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Monitor.Models; - -namespace Azure.ResourceManager.Monitor -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _metricDefinitionsClientDiagnostics; - private MetricDefinitionsRestOperations _metricDefinitionsRestClient; - private ClientDiagnostics _metricsClientDiagnostics; - private MetricsRestOperations _metricsRestClient; - private ClientDiagnostics _baselinesClientDiagnostics; - private BaselinesRestOperations _baselinesRestClient; - private ClientDiagnostics _metricNamespacesClientDiagnostics; - private MetricNamespacesRestOperations _metricNamespacesRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics MetricDefinitionsClientDiagnostics => _metricDefinitionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MetricDefinitionsRestOperations MetricDefinitionsRestClient => _metricDefinitionsRestClient ??= new MetricDefinitionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics MetricsClientDiagnostics => _metricsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MetricsRestOperations MetricsRestClient => _metricsRestClient ??= new MetricsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BaselinesClientDiagnostics => _baselinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BaselinesRestOperations BaselinesRestClient => _baselinesRestClient ??= new BaselinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics MetricNamespacesClientDiagnostics => _metricNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MetricNamespacesRestOperations MetricNamespacesRestClient => _metricNamespacesRestClient ??= new MetricNamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DiagnosticSettingResources in the ArmResource. - /// An object representing collection of DiagnosticSettingResources and their operations over a DiagnosticSettingResource. - public virtual DiagnosticSettingCollection GetDiagnosticSettings() - { - return GetCachedClient(Client => new DiagnosticSettingCollection(Client, Id)); - } - - /// Gets a collection of DiagnosticSettingsCategoryResources in the ArmResource. - /// An object representing collection of DiagnosticSettingsCategoryResources and their operations over a DiagnosticSettingsCategoryResource. - public virtual DiagnosticSettingsCategoryCollection GetDiagnosticSettingsCategories() - { - return GetCachedClient(Client => new DiagnosticSettingsCategoryCollection(Client, Id)); - } - - /// Gets an object representing a VmInsightsOnboardingStatusResource along with the instance operations that can be performed on it in the ArmResource. - /// Returns a object. - public virtual VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatus() - { - return new VmInsightsOnboardingStatusResource(Client, Id.AppendProviderResource("Microsoft.Insights", "vmInsightsOnboardingStatuses", "default")); - } - - /// Gets a collection of DataCollectionRuleAssociationResources in the ArmResource. - /// An object representing collection of DataCollectionRuleAssociationResources and their operations over a DataCollectionRuleAssociationResource. - public virtual DataCollectionRuleAssociationCollection GetDataCollectionRuleAssociations() - { - return GetCachedClient(Client => new DataCollectionRuleAssociationCollection(Client, Id)); - } - - /// - /// Lists the metric definitions for the resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/metricDefinitions - /// - /// - /// Operation Id - /// MetricDefinitions_List - /// - /// - /// - /// Metric namespace to query metric definitions for. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitorMetricDefinitionsAsync(string metricnamespace = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricDefinitionsRestClient.CreateListRequest(Id, metricnamespace); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorMetricDefinition.DeserializeMonitorMetricDefinition, MetricDefinitionsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetMonitorMetricDefinitions", "value", null, cancellationToken); - } - - /// - /// Lists the metric definitions for the resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/metricDefinitions - /// - /// - /// Operation Id - /// MetricDefinitions_List - /// - /// - /// - /// Metric namespace to query metric definitions for. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitorMetricDefinitions(string metricnamespace = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricDefinitionsRestClient.CreateListRequest(Id, metricnamespace); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorMetricDefinition.DeserializeMonitorMetricDefinition, MetricDefinitionsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetMonitorMetricDefinitions", "value", null, cancellationToken); - } - - /// - /// **Lists the metric values for a resource**. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/metrics - /// - /// - /// Operation Id - /// Metrics_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitorMetricsAsync(ArmResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListRequest(Id, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorMetric.DeserializeMonitorMetric, MetricsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetMonitorMetrics", "value", null, cancellationToken); - } - - /// - /// **Lists the metric values for a resource**. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/metrics - /// - /// - /// Operation Id - /// Metrics_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitorMetrics(ArmResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListRequest(Id, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorMetric.DeserializeMonitorMetric, MetricsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetMonitorMetrics", "value", null, cancellationToken); - } - - /// - /// **Lists the metric baseline values for a resource**. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/metricBaselines - /// - /// - /// Operation Id - /// Baselines_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitorMetricBaselinesAsync(ArmResourceGetMonitorMetricBaselinesOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BaselinesRestClient.CreateListRequest(Id, options.Metricnames, options.Metricnamespace, options.Timespan, options.Interval, options.Aggregation, options.Sensitivities, options.Filter, options.ResultType); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorSingleMetricBaseline.DeserializeMonitorSingleMetricBaseline, BaselinesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetMonitorMetricBaselines", "value", null, cancellationToken); - } - - /// - /// **Lists the metric baseline values for a resource**. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.Insights/metricBaselines - /// - /// - /// Operation Id - /// Baselines_List - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitorMetricBaselines(ArmResourceGetMonitorMetricBaselinesOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BaselinesRestClient.CreateListRequest(Id, options.Metricnames, options.Metricnamespace, options.Timespan, options.Interval, options.Aggregation, options.Sensitivities, options.Filter, options.ResultType); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorSingleMetricBaseline.DeserializeMonitorSingleMetricBaseline, BaselinesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetMonitorMetricBaselines", "value", null, cancellationToken); - } - - /// - /// Lists the metric namespaces for the resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/microsoft.insights/metricNamespaces - /// - /// - /// Operation Id - /// MetricNamespaces_List - /// - /// - /// - /// The ISO 8601 conform Date start time from which to query for metric namespaces. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitorMetricNamespacesAsync(string startTime = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricNamespacesRestClient.CreateListRequest(Id, startTime); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorMetricNamespace.DeserializeMonitorMetricNamespace, MetricNamespacesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetMonitorMetricNamespaces", "value", null, cancellationToken); - } - - /// - /// Lists the metric namespaces for the resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/microsoft.insights/metricNamespaces - /// - /// - /// Operation Id - /// MetricNamespaces_List - /// - /// - /// - /// The ISO 8601 conform Date start time from which to query for metric namespaces. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitorMetricNamespaces(string startTime = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricNamespacesRestClient.CreateListRequest(Id, startTime); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorMetricNamespace.DeserializeMonitorMetricNamespace, MetricNamespacesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetMonitorMetricNamespaces", "value", null, cancellationToken); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorArmClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorArmClient.cs new file mode 100644 index 0000000000000..c46964181eccb --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorArmClient.cs @@ -0,0 +1,647 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Monitor; +using Azure.ResourceManager.Monitor.Models; + +namespace Azure.ResourceManager.Monitor.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMonitorArmClient : ArmResource + { + private ClientDiagnostics _metricDefinitionsClientDiagnostics; + private MetricDefinitionsRestOperations _metricDefinitionsRestClient; + private ClientDiagnostics _metricsClientDiagnostics; + private MetricsRestOperations _metricsRestClient; + private ClientDiagnostics _baselinesClientDiagnostics; + private BaselinesRestOperations _baselinesRestClient; + private ClientDiagnostics _metricNamespacesClientDiagnostics; + private MetricNamespacesRestOperations _metricNamespacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMonitorArmClient() + { + } + + /// 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 MockableMonitorArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMonitorArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics MetricDefinitionsClientDiagnostics => _metricDefinitionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MetricDefinitionsRestOperations MetricDefinitionsRestClient => _metricDefinitionsRestClient ??= new MetricDefinitionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics MetricsClientDiagnostics => _metricsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MetricsRestOperations MetricsRestClient => _metricsRestClient ??= new MetricsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BaselinesClientDiagnostics => _baselinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BaselinesRestOperations BaselinesRestClient => _baselinesRestClient ??= new BaselinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics MetricNamespacesClientDiagnostics => _metricNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MetricNamespacesRestOperations MetricNamespacesRestClient => _metricNamespacesRestClient ??= new MetricNamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DiagnosticSettingResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of DiagnosticSettingResources and their operations over a DiagnosticSettingResource. + public virtual DiagnosticSettingCollection GetDiagnosticSettings(ResourceIdentifier scope) + { + return new DiagnosticSettingCollection(Client, scope); + } + + /// + /// Gets the active diagnostic settings for the specified resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name} + /// + /// + /// Operation Id + /// DiagnosticSettings_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the diagnostic setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDiagnosticSettingAsync(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + { + return await GetDiagnosticSettings(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the active diagnostic settings for the specified resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name} + /// + /// + /// Operation Id + /// DiagnosticSettings_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the diagnostic setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDiagnosticSetting(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + { + return GetDiagnosticSettings(scope).Get(name, cancellationToken); + } + + /// Gets a collection of DiagnosticSettingsCategoryResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of DiagnosticSettingsCategoryResources and their operations over a DiagnosticSettingsCategoryResource. + public virtual DiagnosticSettingsCategoryCollection GetDiagnosticSettingsCategories(ResourceIdentifier scope) + { + return new DiagnosticSettingsCategoryCollection(Client, scope); + } + + /// + /// Gets the diagnostic settings category for the specified resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name} + /// + /// + /// Operation Id + /// DiagnosticSettingsCategory_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the diagnostic setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDiagnosticSettingsCategoryAsync(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + { + return await GetDiagnosticSettingsCategories(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the diagnostic settings category for the specified resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name} + /// + /// + /// Operation Id + /// DiagnosticSettingsCategory_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the diagnostic setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDiagnosticSettingsCategory(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + { + return GetDiagnosticSettingsCategories(scope).Get(name, cancellationToken); + } + + /// Gets an object representing a VmInsightsOnboardingStatusResource along with the instance operations that can be performed on it in the ArmClient. + /// The scope that the resource will apply against. + /// Returns a object. + public virtual VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatus(ResourceIdentifier scope) + { + return new VmInsightsOnboardingStatusResource(Client, scope.AppendProviderResource("Microsoft.Insights", "vmInsightsOnboardingStatuses", "default")); + } + + /// Gets a collection of DataCollectionRuleAssociationResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of DataCollectionRuleAssociationResources and their operations over a DataCollectionRuleAssociationResource. + public virtual DataCollectionRuleAssociationCollection GetDataCollectionRuleAssociations(ResourceIdentifier scope) + { + return new DataCollectionRuleAssociationCollection(Client, scope); + } + + /// + /// Returns the specified association. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName} + /// + /// + /// Operation Id + /// DataCollectionRuleAssociations_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the association. The name is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataCollectionRuleAssociationAsync(ResourceIdentifier scope, string associationName, CancellationToken cancellationToken = default) + { + return await GetDataCollectionRuleAssociations(scope).GetAsync(associationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the specified association. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName} + /// + /// + /// Operation Id + /// DataCollectionRuleAssociations_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the association. The name is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataCollectionRuleAssociation(ResourceIdentifier scope, string associationName, CancellationToken cancellationToken = default) + { + return GetDataCollectionRuleAssociations(scope).Get(associationName, cancellationToken); + } + + /// + /// Lists the metric definitions for the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/metricDefinitions + /// + /// + /// Operation Id + /// MetricDefinitions_List + /// + /// + /// + /// The scope to use. + /// Metric namespace to query metric definitions for. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMonitorMetricDefinitionsAsync(ResourceIdentifier scope, string metricnamespace = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricDefinitionsRestClient.CreateListRequest(scope, metricnamespace); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorMetricDefinition.DeserializeMonitorMetricDefinition, MetricDefinitionsClientDiagnostics, Pipeline, "MockableMonitorArmClient.GetMonitorMetricDefinitions", "value", null, cancellationToken); + } + + /// + /// Lists the metric definitions for the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/metricDefinitions + /// + /// + /// Operation Id + /// MetricDefinitions_List + /// + /// + /// + /// The scope to use. + /// Metric namespace to query metric definitions for. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMonitorMetricDefinitions(ResourceIdentifier scope, string metricnamespace = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricDefinitionsRestClient.CreateListRequest(scope, metricnamespace); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorMetricDefinition.DeserializeMonitorMetricDefinition, MetricDefinitionsClientDiagnostics, Pipeline, "MockableMonitorArmClient.GetMonitorMetricDefinitions", "value", null, cancellationToken); + } + + /// + /// **Lists the metric values for a resource**. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/metrics + /// + /// + /// Operation Id + /// Metrics_List + /// + /// + /// + /// The scope to use. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMonitorMetricsAsync(ResourceIdentifier scope, ArmResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) + { + options ??= new ArmResourceGetMonitorMetricsOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListRequest(scope, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorMetric.DeserializeMonitorMetric, MetricsClientDiagnostics, Pipeline, "MockableMonitorArmClient.GetMonitorMetrics", "value", null, cancellationToken); + } + + /// + /// **Lists the metric values for a resource**. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/metrics + /// + /// + /// Operation Id + /// Metrics_List + /// + /// + /// + /// The scope to use. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMonitorMetrics(ResourceIdentifier scope, ArmResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) + { + options ??= new ArmResourceGetMonitorMetricsOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListRequest(scope, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorMetric.DeserializeMonitorMetric, MetricsClientDiagnostics, Pipeline, "MockableMonitorArmClient.GetMonitorMetrics", "value", null, cancellationToken); + } + + /// + /// **Lists the metric baseline values for a resource**. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/metricBaselines + /// + /// + /// Operation Id + /// Baselines_List + /// + /// + /// + /// The scope to use. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMonitorMetricBaselinesAsync(ResourceIdentifier scope, ArmResourceGetMonitorMetricBaselinesOptions options, CancellationToken cancellationToken = default) + { + options ??= new ArmResourceGetMonitorMetricBaselinesOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BaselinesRestClient.CreateListRequest(scope, options.Metricnames, options.Metricnamespace, options.Timespan, options.Interval, options.Aggregation, options.Sensitivities, options.Filter, options.ResultType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorSingleMetricBaseline.DeserializeMonitorSingleMetricBaseline, BaselinesClientDiagnostics, Pipeline, "MockableMonitorArmClient.GetMonitorMetricBaselines", "value", null, cancellationToken); + } + + /// + /// **Lists the metric baseline values for a resource**. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.Insights/metricBaselines + /// + /// + /// Operation Id + /// Baselines_List + /// + /// + /// + /// The scope to use. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMonitorMetricBaselines(ResourceIdentifier scope, ArmResourceGetMonitorMetricBaselinesOptions options, CancellationToken cancellationToken = default) + { + options ??= new ArmResourceGetMonitorMetricBaselinesOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BaselinesRestClient.CreateListRequest(scope, options.Metricnames, options.Metricnamespace, options.Timespan, options.Interval, options.Aggregation, options.Sensitivities, options.Filter, options.ResultType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorSingleMetricBaseline.DeserializeMonitorSingleMetricBaseline, BaselinesClientDiagnostics, Pipeline, "MockableMonitorArmClient.GetMonitorMetricBaselines", "value", null, cancellationToken); + } + + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/microsoft.insights/metricNamespaces + /// + /// + /// Operation Id + /// MetricNamespaces_List + /// + /// + /// + /// The scope to use. + /// The ISO 8601 conform Date start time from which to query for metric namespaces. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMonitorMetricNamespacesAsync(ResourceIdentifier scope, string startTime = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricNamespacesRestClient.CreateListRequest(scope, startTime); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorMetricNamespace.DeserializeMonitorMetricNamespace, MetricNamespacesClientDiagnostics, Pipeline, "MockableMonitorArmClient.GetMonitorMetricNamespaces", "value", null, cancellationToken); + } + + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/microsoft.insights/metricNamespaces + /// + /// + /// Operation Id + /// MetricNamespaces_List + /// + /// + /// + /// The scope to use. + /// The ISO 8601 conform Date start time from which to query for metric namespaces. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMonitorMetricNamespaces(ResourceIdentifier scope, string startTime = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricNamespacesRestClient.CreateListRequest(scope, startTime); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorMetricNamespace.DeserializeMonitorMetricNamespace, MetricNamespacesClientDiagnostics, Pipeline, "MockableMonitorArmClient.GetMonitorMetricNamespaces", "value", null, cancellationToken); + } + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutoscaleSettingResource GetAutoscaleSettingResource(ResourceIdentifier id) + { + AutoscaleSettingResource.ValidateResourceId(id); + return new AutoscaleSettingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AlertRuleResource GetAlertRuleResource(ResourceIdentifier id) + { + AlertRuleResource.ValidateResourceId(id); + return new AlertRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogProfileResource GetLogProfileResource(ResourceIdentifier id) + { + LogProfileResource.ValidateResourceId(id); + return new LogProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiagnosticSettingResource GetDiagnosticSettingResource(ResourceIdentifier id) + { + DiagnosticSettingResource.ValidateResourceId(id); + return new DiagnosticSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiagnosticSettingsCategoryResource GetDiagnosticSettingsCategoryResource(ResourceIdentifier id) + { + DiagnosticSettingsCategoryResource.ValidateResourceId(id); + return new DiagnosticSettingsCategoryResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ActionGroupResource GetActionGroupResource(ResourceIdentifier id) + { + ActionGroupResource.ValidateResourceId(id); + return new ActionGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MetricAlertResource GetMetricAlertResource(ResourceIdentifier id) + { + MetricAlertResource.ValidateResourceId(id); + return new MetricAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScheduledQueryRuleResource GetScheduledQueryRuleResource(ResourceIdentifier id) + { + ScheduledQueryRuleResource.ValidateResourceId(id); + return new ScheduledQueryRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatusResource(ResourceIdentifier id) + { + VmInsightsOnboardingStatusResource.ValidateResourceId(id); + return new VmInsightsOnboardingStatusResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitorPrivateLinkScopeResource GetMonitorPrivateLinkScopeResource(ResourceIdentifier id) + { + MonitorPrivateLinkScopeResource.ValidateResourceId(id); + return new MonitorPrivateLinkScopeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitorPrivateLinkResource GetMonitorPrivateLinkResource(ResourceIdentifier id) + { + MonitorPrivateLinkResource.ValidateResourceId(id); + return new MonitorPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitorPrivateEndpointConnectionResource GetMonitorPrivateEndpointConnectionResource(ResourceIdentifier id) + { + MonitorPrivateEndpointConnectionResource.ValidateResourceId(id); + return new MonitorPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitorPrivateLinkScopedResource GetMonitorPrivateLinkScopedResource(ResourceIdentifier id) + { + MonitorPrivateLinkScopedResource.ValidateResourceId(id); + return new MonitorPrivateLinkScopedResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ActivityLogAlertResource GetActivityLogAlertResource(ResourceIdentifier id) + { + ActivityLogAlertResource.ValidateResourceId(id); + return new ActivityLogAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataCollectionEndpointResource GetDataCollectionEndpointResource(ResourceIdentifier id) + { + DataCollectionEndpointResource.ValidateResourceId(id); + return new DataCollectionEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataCollectionRuleAssociationResource GetDataCollectionRuleAssociationResource(ResourceIdentifier id) + { + DataCollectionRuleAssociationResource.ValidateResourceId(id); + return new DataCollectionRuleAssociationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataCollectionRuleResource GetDataCollectionRuleResource(ResourceIdentifier id) + { + DataCollectionRuleResource.ValidateResourceId(id); + return new DataCollectionRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MonitorWorkspaceResource GetMonitorWorkspaceResource(ResourceIdentifier id) + { + MonitorWorkspaceResource.ValidateResourceId(id); + return new MonitorWorkspaceResource(Client, id); + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorResourceGroupResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorResourceGroupResource.cs new file mode 100644 index 0000000000000..704a6a3e95a18 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorResourceGroupResource.cs @@ -0,0 +1,647 @@ +// 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; +using Azure.ResourceManager.Monitor; +using Azure.ResourceManager.Monitor.Models; + +namespace Azure.ResourceManager.Monitor.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMonitorResourceGroupResource : ArmResource + { + private ClientDiagnostics _privateLinkScopeOperationStatusClientDiagnostics; + private PrivateLinkScopeOperationStatusRestOperations _privateLinkScopeOperationStatusRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMonitorResourceGroupResource() + { + } + + /// 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 MockableMonitorResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PrivateLinkScopeOperationStatusClientDiagnostics => _privateLinkScopeOperationStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PrivateLinkScopeOperationStatusRestOperations PrivateLinkScopeOperationStatusRestClient => _privateLinkScopeOperationStatusRestClient ??= new PrivateLinkScopeOperationStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AutoscaleSettingResources in the ResourceGroupResource. + /// An object representing collection of AutoscaleSettingResources and their operations over a AutoscaleSettingResource. + public virtual AutoscaleSettingCollection GetAutoscaleSettings() + { + return GetCachedClient(client => new AutoscaleSettingCollection(client, Id)); + } + + /// + /// Gets an autoscale setting + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName} + /// + /// + /// Operation Id + /// AutoscaleSettings_Get + /// + /// + /// + /// The autoscale setting name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutoscaleSettingAsync(string autoscaleSettingName, CancellationToken cancellationToken = default) + { + return await GetAutoscaleSettings().GetAsync(autoscaleSettingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an autoscale setting + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName} + /// + /// + /// Operation Id + /// AutoscaleSettings_Get + /// + /// + /// + /// The autoscale setting name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutoscaleSetting(string autoscaleSettingName, CancellationToken cancellationToken = default) + { + return GetAutoscaleSettings().Get(autoscaleSettingName, cancellationToken); + } + + /// Gets a collection of AlertRuleResources in the ResourceGroupResource. + /// An object representing collection of AlertRuleResources and their operations over a AlertRuleResource. + public virtual AlertRuleCollection GetAlertRules() + { + return GetCachedClient(client => new AlertRuleCollection(client, Id)); + } + + /// + /// Gets a classic metric alert rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName} + /// + /// + /// Operation Id + /// AlertRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAlertRuleAsync(string ruleName, CancellationToken cancellationToken = default) + { + return await GetAlertRules().GetAsync(ruleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a classic metric alert rule + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName} + /// + /// + /// Operation Id + /// AlertRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAlertRule(string ruleName, CancellationToken cancellationToken = default) + { + return GetAlertRules().Get(ruleName, cancellationToken); + } + + /// Gets a collection of ActionGroupResources in the ResourceGroupResource. + /// An object representing collection of ActionGroupResources and their operations over a ActionGroupResource. + public virtual ActionGroupCollection GetActionGroups() + { + return GetCachedClient(client => new ActionGroupCollection(client, Id)); + } + + /// + /// Get an action group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName} + /// + /// + /// Operation Id + /// ActionGroups_Get + /// + /// + /// + /// The name of the action group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetActionGroupAsync(string actionGroupName, CancellationToken cancellationToken = default) + { + return await GetActionGroups().GetAsync(actionGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an action group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName} + /// + /// + /// Operation Id + /// ActionGroups_Get + /// + /// + /// + /// The name of the action group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetActionGroup(string actionGroupName, CancellationToken cancellationToken = default) + { + return GetActionGroups().Get(actionGroupName, cancellationToken); + } + + /// Gets a collection of MetricAlertResources in the ResourceGroupResource. + /// An object representing collection of MetricAlertResources and their operations over a MetricAlertResource. + public virtual MetricAlertCollection GetMetricAlerts() + { + return GetCachedClient(client => new MetricAlertCollection(client, Id)); + } + + /// + /// Retrieve an alert rule definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName} + /// + /// + /// Operation Id + /// MetricAlerts_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMetricAlertAsync(string ruleName, CancellationToken cancellationToken = default) + { + return await GetMetricAlerts().GetAsync(ruleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve an alert rule definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName} + /// + /// + /// Operation Id + /// MetricAlerts_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMetricAlert(string ruleName, CancellationToken cancellationToken = default) + { + return GetMetricAlerts().Get(ruleName, cancellationToken); + } + + /// Gets a collection of ScheduledQueryRuleResources in the ResourceGroupResource. + /// An object representing collection of ScheduledQueryRuleResources and their operations over a ScheduledQueryRuleResource. + public virtual ScheduledQueryRuleCollection GetScheduledQueryRules() + { + return GetCachedClient(client => new ScheduledQueryRuleCollection(client, Id)); + } + + /// + /// Retrieve an scheduled query rule definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// + /// + /// Operation Id + /// ScheduledQueryRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetScheduledQueryRuleAsync(string ruleName, CancellationToken cancellationToken = default) + { + return await GetScheduledQueryRules().GetAsync(ruleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve an scheduled query rule definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// + /// + /// Operation Id + /// ScheduledQueryRules_Get + /// + /// + /// + /// The name of the rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScheduledQueryRule(string ruleName, CancellationToken cancellationToken = default) + { + return GetScheduledQueryRules().Get(ruleName, cancellationToken); + } + + /// Gets a collection of MonitorPrivateLinkScopeResources in the ResourceGroupResource. + /// An object representing collection of MonitorPrivateLinkScopeResources and their operations over a MonitorPrivateLinkScopeResource. + public virtual MonitorPrivateLinkScopeCollection GetMonitorPrivateLinkScopes() + { + return GetCachedClient(client => new MonitorPrivateLinkScopeCollection(client, Id)); + } + + /// + /// Returns a Azure Monitor PrivateLinkScope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName} + /// + /// + /// Operation Id + /// PrivateLinkScopes_Get + /// + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMonitorPrivateLinkScopeAsync(string scopeName, CancellationToken cancellationToken = default) + { + return await GetMonitorPrivateLinkScopes().GetAsync(scopeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a Azure Monitor PrivateLinkScope. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName} + /// + /// + /// Operation Id + /// PrivateLinkScopes_Get + /// + /// + /// + /// The name of the Azure Monitor PrivateLinkScope resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMonitorPrivateLinkScope(string scopeName, CancellationToken cancellationToken = default) + { + return GetMonitorPrivateLinkScopes().Get(scopeName, cancellationToken); + } + + /// Gets a collection of ActivityLogAlertResources in the ResourceGroupResource. + /// An object representing collection of ActivityLogAlertResources and their operations over a ActivityLogAlertResource. + public virtual ActivityLogAlertCollection GetActivityLogAlerts() + { + return GetCachedClient(client => new ActivityLogAlertCollection(client, Id)); + } + + /// + /// Get an Activity Log Alert rule. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName} + /// + /// + /// Operation Id + /// ActivityLogAlerts_Get + /// + /// + /// + /// The name of the Activity Log Alert rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetActivityLogAlertAsync(string activityLogAlertName, CancellationToken cancellationToken = default) + { + return await GetActivityLogAlerts().GetAsync(activityLogAlertName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an Activity Log Alert rule. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName} + /// + /// + /// Operation Id + /// ActivityLogAlerts_Get + /// + /// + /// + /// The name of the Activity Log Alert rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetActivityLogAlert(string activityLogAlertName, CancellationToken cancellationToken = default) + { + return GetActivityLogAlerts().Get(activityLogAlertName, cancellationToken); + } + + /// Gets a collection of DataCollectionEndpointResources in the ResourceGroupResource. + /// An object representing collection of DataCollectionEndpointResources and their operations over a DataCollectionEndpointResource. + public virtual DataCollectionEndpointCollection GetDataCollectionEndpoints() + { + return GetCachedClient(client => new DataCollectionEndpointCollection(client, Id)); + } + + /// + /// Returns the specified data collection endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName} + /// + /// + /// Operation Id + /// DataCollectionEndpoints_Get + /// + /// + /// + /// The name of the data collection endpoint. The name is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataCollectionEndpointAsync(string dataCollectionEndpointName, CancellationToken cancellationToken = default) + { + return await GetDataCollectionEndpoints().GetAsync(dataCollectionEndpointName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the specified data collection endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName} + /// + /// + /// Operation Id + /// DataCollectionEndpoints_Get + /// + /// + /// + /// The name of the data collection endpoint. The name is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataCollectionEndpoint(string dataCollectionEndpointName, CancellationToken cancellationToken = default) + { + return GetDataCollectionEndpoints().Get(dataCollectionEndpointName, cancellationToken); + } + + /// Gets a collection of DataCollectionRuleResources in the ResourceGroupResource. + /// An object representing collection of DataCollectionRuleResources and their operations over a DataCollectionRuleResource. + public virtual DataCollectionRuleCollection GetDataCollectionRules() + { + return GetCachedClient(client => new DataCollectionRuleCollection(client, Id)); + } + + /// + /// Returns the specified data collection rule. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName} + /// + /// + /// Operation Id + /// DataCollectionRules_Get + /// + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataCollectionRuleAsync(string dataCollectionRuleName, CancellationToken cancellationToken = default) + { + return await GetDataCollectionRules().GetAsync(dataCollectionRuleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the specified data collection rule. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName} + /// + /// + /// Operation Id + /// DataCollectionRules_Get + /// + /// + /// + /// The name of the data collection rule. The name is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataCollectionRule(string dataCollectionRuleName, CancellationToken cancellationToken = default) + { + return GetDataCollectionRules().Get(dataCollectionRuleName, cancellationToken); + } + + /// Gets a collection of MonitorWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of MonitorWorkspaceResources and their operations over a MonitorWorkspaceResource. + public virtual MonitorWorkspaceResourceCollection GetMonitorWorkspaceResources() + { + return GetCachedClient(client => new MonitorWorkspaceResourceCollection(client, Id)); + } + + /// + /// Returns the specific Azure Monitor workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName} + /// + /// + /// Operation Id + /// AzureMonitorWorkspaces_Get + /// + /// + /// + /// The name of the Azure Monitor workspace. The name is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMonitorWorkspaceResourceAsync(string azureMonitorWorkspaceName, CancellationToken cancellationToken = default) + { + return await GetMonitorWorkspaceResources().GetAsync(azureMonitorWorkspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the specific Azure Monitor workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName} + /// + /// + /// Operation Id + /// AzureMonitorWorkspaces_Get + /// + /// + /// + /// The name of the Azure Monitor workspace. The name is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMonitorWorkspaceResource(string azureMonitorWorkspaceName, CancellationToken cancellationToken = default) + { + return GetMonitorWorkspaceResources().Get(azureMonitorWorkspaceName, cancellationToken); + } + + /// + /// Get the status of an azure asynchronous operation associated with a private link scope operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId} + /// + /// + /// Operation Id + /// PrivateLinkScopeOperationStatus_Get + /// + /// + /// + /// The operation Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetPrivateLinkScopeOperationStatusAsync(string asyncOperationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(asyncOperationId, nameof(asyncOperationId)); + + using var scope = PrivateLinkScopeOperationStatusClientDiagnostics.CreateScope("MockableMonitorResourceGroupResource.GetPrivateLinkScopeOperationStatus"); + scope.Start(); + try + { + var response = await PrivateLinkScopeOperationStatusRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, asyncOperationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the status of an azure asynchronous operation associated with a private link scope operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId} + /// + /// + /// Operation Id + /// PrivateLinkScopeOperationStatus_Get + /// + /// + /// + /// The operation Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetPrivateLinkScopeOperationStatus(string asyncOperationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(asyncOperationId, nameof(asyncOperationId)); + + using var scope = PrivateLinkScopeOperationStatusClientDiagnostics.CreateScope("MockableMonitorResourceGroupResource.GetPrivateLinkScopeOperationStatus"); + scope.Start(); + try + { + var response = PrivateLinkScopeOperationStatusRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, asyncOperationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorSubscriptionResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorSubscriptionResource.cs new file mode 100644 index 0000000000000..3e8d2e358412a --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorSubscriptionResource.cs @@ -0,0 +1,733 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Monitor; +using Azure.ResourceManager.Monitor.Models; + +namespace Azure.ResourceManager.Monitor.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMonitorSubscriptionResource : ArmResource + { + private ClientDiagnostics _autoscaleSettingClientDiagnostics; + private AutoscaleSettingsRestOperations _autoscaleSettingRestClient; + private ClientDiagnostics _alertRuleClientDiagnostics; + private AlertRulesRestOperations _alertRuleRestClient; + private ClientDiagnostics _actionGroupClientDiagnostics; + private ActionGroupsRestOperations _actionGroupRestClient; + private ClientDiagnostics _activityLogsClientDiagnostics; + private ActivityLogsRestOperations _activityLogsRestClient; + private ClientDiagnostics _metricsClientDiagnostics; + private MetricsRestOperations _metricsRestClient; + private ClientDiagnostics _metricAlertClientDiagnostics; + private MetricAlertsRestOperations _metricAlertRestClient; + private ClientDiagnostics _scheduledQueryRuleClientDiagnostics; + private ScheduledQueryRulesRestOperations _scheduledQueryRuleRestClient; + private ClientDiagnostics _monitorPrivateLinkScopePrivateLinkScopesClientDiagnostics; + private PrivateLinkScopesRestOperations _monitorPrivateLinkScopePrivateLinkScopesRestClient; + private ClientDiagnostics _activityLogAlertClientDiagnostics; + private ActivityLogAlertsRestOperations _activityLogAlertRestClient; + private ClientDiagnostics _dataCollectionEndpointClientDiagnostics; + private DataCollectionEndpointsRestOperations _dataCollectionEndpointRestClient; + private ClientDiagnostics _dataCollectionRuleClientDiagnostics; + private DataCollectionRulesRestOperations _dataCollectionRuleRestClient; + private ClientDiagnostics _monitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics; + private AzureMonitorWorkspacesRestOperations _monitorWorkspaceResourceAzureMonitorWorkspacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMonitorSubscriptionResource() + { + } + + /// 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 MockableMonitorSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AutoscaleSettingClientDiagnostics => _autoscaleSettingClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", AutoscaleSettingResource.ResourceType.Namespace, Diagnostics); + private AutoscaleSettingsRestOperations AutoscaleSettingRestClient => _autoscaleSettingRestClient ??= new AutoscaleSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AutoscaleSettingResource.ResourceType)); + private ClientDiagnostics AlertRuleClientDiagnostics => _alertRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", AlertRuleResource.ResourceType.Namespace, Diagnostics); + private AlertRulesRestOperations AlertRuleRestClient => _alertRuleRestClient ??= new AlertRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AlertRuleResource.ResourceType)); + private ClientDiagnostics ActionGroupClientDiagnostics => _actionGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActionGroupResource.ResourceType.Namespace, Diagnostics); + private ActionGroupsRestOperations ActionGroupRestClient => _actionGroupRestClient ??= new ActionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ActionGroupResource.ResourceType)); + private ClientDiagnostics ActivityLogsClientDiagnostics => _activityLogsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ActivityLogsRestOperations ActivityLogsRestClient => _activityLogsRestClient ??= new ActivityLogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics MetricsClientDiagnostics => _metricsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MetricsRestOperations MetricsRestClient => _metricsRestClient ??= new MetricsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics MetricAlertClientDiagnostics => _metricAlertClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", MetricAlertResource.ResourceType.Namespace, Diagnostics); + private MetricAlertsRestOperations MetricAlertRestClient => _metricAlertRestClient ??= new MetricAlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MetricAlertResource.ResourceType)); + private ClientDiagnostics ScheduledQueryRuleClientDiagnostics => _scheduledQueryRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ScheduledQueryRuleResource.ResourceType.Namespace, Diagnostics); + private ScheduledQueryRulesRestOperations ScheduledQueryRuleRestClient => _scheduledQueryRuleRestClient ??= new ScheduledQueryRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScheduledQueryRuleResource.ResourceType)); + private ClientDiagnostics MonitorPrivateLinkScopePrivateLinkScopesClientDiagnostics => _monitorPrivateLinkScopePrivateLinkScopesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", MonitorPrivateLinkScopeResource.ResourceType.Namespace, Diagnostics); + private PrivateLinkScopesRestOperations MonitorPrivateLinkScopePrivateLinkScopesRestClient => _monitorPrivateLinkScopePrivateLinkScopesRestClient ??= new PrivateLinkScopesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MonitorPrivateLinkScopeResource.ResourceType)); + private ClientDiagnostics ActivityLogAlertClientDiagnostics => _activityLogAlertClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActivityLogAlertResource.ResourceType.Namespace, Diagnostics); + private ActivityLogAlertsRestOperations ActivityLogAlertRestClient => _activityLogAlertRestClient ??= new ActivityLogAlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ActivityLogAlertResource.ResourceType)); + private ClientDiagnostics DataCollectionEndpointClientDiagnostics => _dataCollectionEndpointClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", DataCollectionEndpointResource.ResourceType.Namespace, Diagnostics); + private DataCollectionEndpointsRestOperations DataCollectionEndpointRestClient => _dataCollectionEndpointRestClient ??= new DataCollectionEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataCollectionEndpointResource.ResourceType)); + private ClientDiagnostics DataCollectionRuleClientDiagnostics => _dataCollectionRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", DataCollectionRuleResource.ResourceType.Namespace, Diagnostics); + private DataCollectionRulesRestOperations DataCollectionRuleRestClient => _dataCollectionRuleRestClient ??= new DataCollectionRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataCollectionRuleResource.ResourceType)); + private ClientDiagnostics MonitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics => _monitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", MonitorWorkspaceResource.ResourceType.Namespace, Diagnostics); + private AzureMonitorWorkspacesRestOperations MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient => _monitorWorkspaceResourceAzureMonitorWorkspacesRestClient ??= new AzureMonitorWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MonitorWorkspaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LogProfileResources in the SubscriptionResource. + /// An object representing collection of LogProfileResources and their operations over a LogProfileResource. + public virtual LogProfileCollection GetLogProfiles() + { + return GetCachedClient(client => new LogProfileCollection(client, Id)); + } + + /// + /// Gets the log profile. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName} + /// + /// + /// Operation Id + /// LogProfiles_Get + /// + /// + /// + /// The name of the log profile. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLogProfileAsync(string logProfileName, CancellationToken cancellationToken = default) + { + return await GetLogProfiles().GetAsync(logProfileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the log profile. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName} + /// + /// + /// Operation Id + /// LogProfiles_Get + /// + /// + /// + /// The name of the log profile. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLogProfile(string logProfileName, CancellationToken cancellationToken = default) + { + return GetLogProfiles().Get(logProfileName, cancellationToken); + } + + /// + /// Lists the autoscale settings for a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings + /// + /// + /// Operation Id + /// AutoscaleSettings_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAutoscaleSettingsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AutoscaleSettingRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutoscaleSettingRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutoscaleSettingResource(Client, AutoscaleSettingData.DeserializeAutoscaleSettingData(e)), AutoscaleSettingClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetAutoscaleSettings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the autoscale settings for a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings + /// + /// + /// Operation Id + /// AutoscaleSettings_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAutoscaleSettings(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AutoscaleSettingRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutoscaleSettingRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutoscaleSettingResource(Client, AutoscaleSettingData.DeserializeAutoscaleSettingData(e)), AutoscaleSettingClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetAutoscaleSettings", "value", "nextLink", cancellationToken); + } + + /// + /// List the classic metric alert rules within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules + /// + /// + /// Operation Id + /// AlertRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAlertRulesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AlertRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AlertRuleResource(Client, AlertRuleData.DeserializeAlertRuleData(e)), AlertRuleClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetAlertRules", "value", null, cancellationToken); + } + + /// + /// List the classic metric alert rules within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules + /// + /// + /// Operation Id + /// AlertRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAlertRules(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AlertRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AlertRuleResource(Client, AlertRuleData.DeserializeAlertRuleData(e)), AlertRuleClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetAlertRules", "value", null, cancellationToken); + } + + /// + /// Get a list of all action groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups + /// + /// + /// Operation Id + /// ActionGroups_ListBySubscriptionId + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetActionGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ActionGroupRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ActionGroupResource(Client, ActionGroupData.DeserializeActionGroupData(e)), ActionGroupClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetActionGroups", "value", null, cancellationToken); + } + + /// + /// Get a list of all action groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups + /// + /// + /// Operation Id + /// ActionGroups_ListBySubscriptionId + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetActionGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ActionGroupRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ActionGroupResource(Client, ActionGroupData.DeserializeActionGroupData(e)), ActionGroupClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetActionGroups", "value", null, cancellationToken); + } + + /// + /// Provides the list of records from the activity logs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values + /// + /// + /// Operation Id + /// ActivityLogs_List + /// + /// + /// + /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. + /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetActivityLogsAsync(string filter, string select = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ActivityLogsRestClient.CreateListRequest(Id.SubscriptionId, filter, select); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ActivityLogsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, select); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EventDataInfo.DeserializeEventDataInfo, ActivityLogsClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetActivityLogs", "value", "nextLink", cancellationToken); + } + + /// + /// Provides the list of records from the activity logs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values + /// + /// + /// Operation Id + /// ActivityLogs_List + /// + /// + /// + /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. + /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetActivityLogs(string filter, string select = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ActivityLogsRestClient.CreateListRequest(Id.SubscriptionId, filter, select); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ActivityLogsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, select); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EventDataInfo.DeserializeEventDataInfo, ActivityLogsClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetActivityLogs", "value", "nextLink", cancellationToken); + } + + /// + /// **Lists the metric data for a subscription**. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics + /// + /// + /// Operation Id + /// Metrics_ListAtSubscriptionScope + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMonitorMetricsAsync(SubscriptionResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListAtSubscriptionScopeRequest(Id.SubscriptionId, options.Region, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, SubscriptionMonitorMetric.DeserializeSubscriptionMonitorMetric, MetricsClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMonitorMetrics", "value", null, cancellationToken); + } + + /// + /// **Lists the metric data for a subscription**. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics + /// + /// + /// Operation Id + /// Metrics_ListAtSubscriptionScope + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMonitorMetrics(SubscriptionResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListAtSubscriptionScopeRequest(Id.SubscriptionId, options.Region, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, SubscriptionMonitorMetric.DeserializeSubscriptionMonitorMetric, MetricsClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMonitorMetrics", "value", null, cancellationToken); + } + + /// + /// **Lists the metric data for a subscription**. Parameters can be specified on either query params or the body. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics + /// + /// + /// Operation Id + /// Metrics_ListAtSubscriptionScopePost + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMonitorMetricsWithPostAsync(SubscriptionResourceGetMonitorMetricsWithPostOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListAtSubscriptionScopePostRequest(Id.SubscriptionId, options.Region, options.Content, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, SubscriptionMonitorMetric.DeserializeSubscriptionMonitorMetric, MetricsClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMonitorMetricsWithPost", "value", null, cancellationToken); + } + + /// + /// **Lists the metric data for a subscription**. Parameters can be specified on either query params or the body. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics + /// + /// + /// Operation Id + /// Metrics_ListAtSubscriptionScopePost + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMonitorMetricsWithPost(SubscriptionResourceGetMonitorMetricsWithPostOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListAtSubscriptionScopePostRequest(Id.SubscriptionId, options.Region, options.Content, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, SubscriptionMonitorMetric.DeserializeSubscriptionMonitorMetric, MetricsClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMonitorMetricsWithPost", "value", null, cancellationToken); + } + + /// + /// Retrieve alert rule definitions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts + /// + /// + /// Operation Id + /// MetricAlerts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMetricAlertsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricAlertRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MetricAlertResource(Client, MetricAlertData.DeserializeMetricAlertData(e)), MetricAlertClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMetricAlerts", "value", null, cancellationToken); + } + + /// + /// Retrieve alert rule definitions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts + /// + /// + /// Operation Id + /// MetricAlerts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMetricAlerts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MetricAlertRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MetricAlertResource(Client, MetricAlertData.DeserializeMetricAlertData(e)), MetricAlertClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMetricAlerts", "value", null, cancellationToken); + } + + /// + /// Retrieve a scheduled query rule definitions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules + /// + /// + /// Operation Id + /// ScheduledQueryRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScheduledQueryRulesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScheduledQueryRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScheduledQueryRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScheduledQueryRuleResource(Client, ScheduledQueryRuleData.DeserializeScheduledQueryRuleData(e)), ScheduledQueryRuleClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetScheduledQueryRules", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieve a scheduled query rule definitions in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules + /// + /// + /// Operation Id + /// ScheduledQueryRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScheduledQueryRules(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ScheduledQueryRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScheduledQueryRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScheduledQueryRuleResource(Client, ScheduledQueryRuleData.DeserializeScheduledQueryRuleData(e)), ScheduledQueryRuleClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetScheduledQueryRules", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes + /// + /// + /// Operation Id + /// PrivateLinkScopes_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMonitorPrivateLinkScopesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MonitorPrivateLinkScopePrivateLinkScopesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MonitorPrivateLinkScopePrivateLinkScopesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MonitorPrivateLinkScopeResource(Client, MonitorPrivateLinkScopeData.DeserializeMonitorPrivateLinkScopeData(e)), MonitorPrivateLinkScopePrivateLinkScopesClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMonitorPrivateLinkScopes", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes + /// + /// + /// Operation Id + /// PrivateLinkScopes_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMonitorPrivateLinkScopes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MonitorPrivateLinkScopePrivateLinkScopesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MonitorPrivateLinkScopePrivateLinkScopesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MonitorPrivateLinkScopeResource(Client, MonitorPrivateLinkScopeData.DeserializeMonitorPrivateLinkScopeData(e)), MonitorPrivateLinkScopePrivateLinkScopesClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMonitorPrivateLinkScopes", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of all Activity Log Alert rules in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts + /// + /// + /// Operation Id + /// ActivityLogAlerts_ListBySubscriptionId + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetActivityLogAlertsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ActivityLogAlertRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ActivityLogAlertRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ActivityLogAlertResource(Client, ActivityLogAlertData.DeserializeActivityLogAlertData(e)), ActivityLogAlertClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetActivityLogAlerts", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of all Activity Log Alert rules in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts + /// + /// + /// Operation Id + /// ActivityLogAlerts_ListBySubscriptionId + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetActivityLogAlerts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ActivityLogAlertRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ActivityLogAlertRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ActivityLogAlertResource(Client, ActivityLogAlertData.DeserializeActivityLogAlertData(e)), ActivityLogAlertClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetActivityLogAlerts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all data collection endpoints in the specified subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints + /// + /// + /// Operation Id + /// DataCollectionEndpoints_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataCollectionEndpointsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataCollectionEndpointRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataCollectionEndpointRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataCollectionEndpointResource(Client, DataCollectionEndpointData.DeserializeDataCollectionEndpointData(e)), DataCollectionEndpointClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetDataCollectionEndpoints", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all data collection endpoints in the specified subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints + /// + /// + /// Operation Id + /// DataCollectionEndpoints_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataCollectionEndpoints(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataCollectionEndpointRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataCollectionEndpointRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataCollectionEndpointResource(Client, DataCollectionEndpointData.DeserializeDataCollectionEndpointData(e)), DataCollectionEndpointClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetDataCollectionEndpoints", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all data collection rules in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules + /// + /// + /// Operation Id + /// DataCollectionRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataCollectionRulesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataCollectionRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataCollectionRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataCollectionRuleResource(Client, DataCollectionRuleData.DeserializeDataCollectionRuleData(e)), DataCollectionRuleClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetDataCollectionRules", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all data collection rules in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules + /// + /// + /// Operation Id + /// DataCollectionRules_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataCollectionRules(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataCollectionRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataCollectionRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataCollectionRuleResource(Client, DataCollectionRuleData.DeserializeDataCollectionRuleData(e)), DataCollectionRuleClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetDataCollectionRules", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all workspaces in the specified subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts + /// + /// + /// Operation Id + /// AzureMonitorWorkspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMonitorWorkspaceResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MonitorWorkspaceResource(Client, MonitorWorkspaceResourceData.DeserializeMonitorWorkspaceResourceData(e)), MonitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMonitorWorkspaceResources", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all workspaces in the specified subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts + /// + /// + /// Operation Id + /// AzureMonitorWorkspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMonitorWorkspaceResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MonitorWorkspaceResource(Client, MonitorWorkspaceResourceData.DeserializeMonitorWorkspaceResourceData(e)), MonitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics, Pipeline, "MockableMonitorSubscriptionResource.GetMonitorWorkspaceResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorTenantResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorTenantResource.cs new file mode 100644 index 0000000000000..e6c4b52a010cf --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MockableMonitorTenantResource.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Monitor; +using Azure.ResourceManager.Monitor.Models; + +namespace Azure.ResourceManager.Monitor.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableMonitorTenantResource : ArmResource + { + private ClientDiagnostics _eventCategoriesClientDiagnostics; + private EventCategoriesRestOperations _eventCategoriesRestClient; + private ClientDiagnostics _tenantActivityLogsClientDiagnostics; + private TenantActivityLogsRestOperations _tenantActivityLogsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMonitorTenantResource() + { + } + + /// 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 MockableMonitorTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics EventCategoriesClientDiagnostics => _eventCategoriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private EventCategoriesRestOperations EventCategoriesRestClient => _eventCategoriesRestClient ??= new EventCategoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics TenantActivityLogsClientDiagnostics => _tenantActivityLogsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private TenantActivityLogsRestOperations TenantActivityLogsRestClient => _tenantActivityLogsRestClient ??= new TenantActivityLogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + /// + /// + /// Request Path + /// /providers/Microsoft.Insights/eventcategories + /// + /// + /// Operation Id + /// EventCategories_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEventCategoriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventCategoriesRestClient.CreateListRequest(); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorLocalizableString.DeserializeMonitorLocalizableString, EventCategoriesClientDiagnostics, Pipeline, "MockableMonitorTenantResource.GetEventCategories", "value", null, cancellationToken); + } + + /// + /// Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + /// + /// + /// Request Path + /// /providers/Microsoft.Insights/eventcategories + /// + /// + /// Operation Id + /// EventCategories_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEventCategories(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventCategoriesRestClient.CreateListRequest(); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorLocalizableString.DeserializeMonitorLocalizableString, EventCategoriesClientDiagnostics, Pipeline, "MockableMonitorTenantResource.GetEventCategories", "value", null, cancellationToken); + } + + /// + /// Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + /// + /// + /// Request Path + /// /providers/Microsoft.Insights/eventtypes/management/values + /// + /// + /// Operation Id + /// TenantActivityLogs_List + /// + /// + /// + /// Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetTenantActivityLogsAsync(string filter = null, string select = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TenantActivityLogsRestClient.CreateListRequest(filter, select); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TenantActivityLogsRestClient.CreateListNextPageRequest(nextLink, filter, select); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EventDataInfo.DeserializeEventDataInfo, TenantActivityLogsClientDiagnostics, Pipeline, "MockableMonitorTenantResource.GetTenantActivityLogs", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + /// + /// + /// Request Path + /// /providers/Microsoft.Insights/eventtypes/management/values + /// + /// + /// Operation Id + /// TenantActivityLogs_List + /// + /// + /// + /// Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetTenantActivityLogs(string filter = null, string select = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TenantActivityLogsRestClient.CreateListRequest(filter, select); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TenantActivityLogsRestClient.CreateListNextPageRequest(nextLink, filter, select); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EventDataInfo.DeserializeEventDataInfo, TenantActivityLogsClientDiagnostics, Pipeline, "MockableMonitorTenantResource.GetTenantActivityLogs", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MonitorExtensions.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MonitorExtensions.cs index c8cdea4dd007b..97b56c4c5e82a 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MonitorExtensions.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MonitorExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Monitor.Mocking; using Azure.ResourceManager.Monitor.Models; using Azure.ResourceManager.Resources; @@ -19,418 +20,39 @@ namespace Azure.ResourceManager.Monitor /// A class to add extension methods to Azure.ResourceManager.Monitor. public static partial class MonitorExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableMonitorArmClient GetMockableMonitorArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMonitorArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMonitorResourceGroupResource GetMockableMonitorResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMonitorResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMonitorSubscriptionResource GetMockableMonitorSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMonitorSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMonitorTenantResource GetMockableMonitorTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMonitorTenantResource(client, resource.Id)); } - 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); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region AutoscaleSettingResource - /// - /// 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 AutoscaleSettingResource GetAutoscaleSettingResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AutoscaleSettingResource.ValidateResourceId(id); - return new AutoscaleSettingResource(client, id); - } - ); - } - #endregion - - #region AlertRuleResource - /// - /// 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 AlertRuleResource GetAlertRuleResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - AlertRuleResource.ValidateResourceId(id); - return new AlertRuleResource(client, id); - } - ); - } - #endregion - - #region LogProfileResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static LogProfileResource GetLogProfileResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - LogProfileResource.ValidateResourceId(id); - return new LogProfileResource(client, id); - } - ); - } - #endregion - - #region DiagnosticSettingResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static DiagnosticSettingResource GetDiagnosticSettingResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - DiagnosticSettingResource.ValidateResourceId(id); - return new DiagnosticSettingResource(client, id); - } - ); - } - #endregion - - #region DiagnosticSettingsCategoryResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static DiagnosticSettingsCategoryResource GetDiagnosticSettingsCategoryResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - DiagnosticSettingsCategoryResource.ValidateResourceId(id); - return new DiagnosticSettingsCategoryResource(client, id); - } - ); - } - #endregion - - #region ActionGroupResource - /// - /// 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 ActionGroupResource GetActionGroupResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ActionGroupResource.ValidateResourceId(id); - return new ActionGroupResource(client, id); - } - ); - } - #endregion - - #region MetricAlertResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static MetricAlertResource GetMetricAlertResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - MetricAlertResource.ValidateResourceId(id); - return new MetricAlertResource(client, id); - } - ); - } - #endregion - - #region ScheduledQueryRuleResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ScheduledQueryRuleResource GetScheduledQueryRuleResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ScheduledQueryRuleResource.ValidateResourceId(id); - return new ScheduledQueryRuleResource(client, id); - } - ); - } - #endregion - - #region VmInsightsOnboardingStatusResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatusResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - VmInsightsOnboardingStatusResource.ValidateResourceId(id); - return new VmInsightsOnboardingStatusResource(client, id); - } - ); - } - #endregion - - #region MonitorPrivateLinkScopeResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static MonitorPrivateLinkScopeResource GetMonitorPrivateLinkScopeResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - MonitorPrivateLinkScopeResource.ValidateResourceId(id); - return new MonitorPrivateLinkScopeResource(client, id); - } - ); - } - #endregion - - #region MonitorPrivateLinkResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static MonitorPrivateLinkResource GetMonitorPrivateLinkResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - MonitorPrivateLinkResource.ValidateResourceId(id); - return new MonitorPrivateLinkResource(client, id); - } - ); - } - #endregion - - #region MonitorPrivateEndpointConnectionResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static MonitorPrivateEndpointConnectionResource GetMonitorPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - MonitorPrivateEndpointConnectionResource.ValidateResourceId(id); - return new MonitorPrivateEndpointConnectionResource(client, id); - } - ); - } - #endregion - - #region MonitorPrivateLinkScopedResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static MonitorPrivateLinkScopedResource GetMonitorPrivateLinkScopedResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - MonitorPrivateLinkScopedResource.ValidateResourceId(id); - return new MonitorPrivateLinkScopedResource(client, id); - } - ); - } - #endregion - - #region ActivityLogAlertResource - /// - /// 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 ActivityLogAlertResource GetActivityLogAlertResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ActivityLogAlertResource.ValidateResourceId(id); - return new ActivityLogAlertResource(client, id); - } - ); - } - #endregion - - #region DataCollectionEndpointResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static DataCollectionEndpointResource GetDataCollectionEndpointResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - DataCollectionEndpointResource.ValidateResourceId(id); - return new DataCollectionEndpointResource(client, id); - } - ); - } - #endregion - - #region DataCollectionRuleAssociationResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static DataCollectionRuleAssociationResource GetDataCollectionRuleAssociationResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - DataCollectionRuleAssociationResource.ValidateResourceId(id); - return new DataCollectionRuleAssociationResource(client, id); - } - ); - } - #endregion - - #region DataCollectionRuleResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static DataCollectionRuleResource GetDataCollectionRuleResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - DataCollectionRuleResource.ValidateResourceId(id); - return new DataCollectionRuleResource(client, id); - } - ); - } - #endregion - - #region MonitorWorkspaceResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of DiagnosticSettingResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static MonitorWorkspaceResource GetMonitorWorkspaceResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - MonitorWorkspaceResource.ValidateResourceId(id); - return new MonitorWorkspaceResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of DiagnosticSettingResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of DiagnosticSettingResources and their operations over a DiagnosticSettingResource. public static DiagnosticSettingCollection GetDiagnosticSettings(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetDiagnosticSettings(); + return GetMockableMonitorArmClient(client).GetDiagnosticSettings(scope); } /// @@ -445,17 +67,21 @@ public static DiagnosticSettingCollection GetDiagnosticSettings(this ArmClient c /// DiagnosticSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the diagnostic setting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDiagnosticSettingAsync(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - return await client.GetDiagnosticSettings(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorArmClient(client).GetDiagnosticSettingAsync(scope, name, cancellationToken).ConfigureAwait(false); } /// @@ -470,26 +96,36 @@ public static async Task> GetDiagnosticSetti /// DiagnosticSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the diagnostic setting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDiagnosticSetting(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - return client.GetDiagnosticSettings(scope).Get(name, cancellationToken); + return GetMockableMonitorArmClient(client).GetDiagnosticSetting(scope, name, cancellationToken); } - /// Gets a collection of DiagnosticSettingsCategoryResources in the ArmResource. + /// + /// Gets a collection of DiagnosticSettingsCategoryResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of DiagnosticSettingsCategoryResources and their operations over a DiagnosticSettingsCategoryResource. public static DiagnosticSettingsCategoryCollection GetDiagnosticSettingsCategories(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetDiagnosticSettingsCategories(); + return GetMockableMonitorArmClient(client).GetDiagnosticSettingsCategories(scope); } /// @@ -504,17 +140,21 @@ public static DiagnosticSettingsCategoryCollection GetDiagnosticSettingsCategori /// DiagnosticSettingsCategory_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the diagnostic setting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDiagnosticSettingsCategoryAsync(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - return await client.GetDiagnosticSettingsCategories(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorArmClient(client).GetDiagnosticSettingsCategoryAsync(scope, name, cancellationToken).ConfigureAwait(false); } /// @@ -529,35 +169,51 @@ public static async Task> GetDiagno /// DiagnosticSettingsCategory_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the diagnostic setting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDiagnosticSettingsCategory(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - return client.GetDiagnosticSettingsCategories(scope).Get(name, cancellationToken); + return GetMockableMonitorArmClient(client).GetDiagnosticSettingsCategory(scope, name, cancellationToken); } - /// Gets an object representing a VmInsightsOnboardingStatusResource along with the instance operations that can be performed on it in the ArmResource. + /// + /// Gets an object representing a VmInsightsOnboardingStatusResource along with the instance operations that can be performed on it in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Returns a object. public static VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatus(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetVmInsightsOnboardingStatus(); + return GetMockableMonitorArmClient(client).GetVmInsightsOnboardingStatus(scope); } - /// Gets a collection of DataCollectionRuleAssociationResources in the ArmResource. + /// + /// Gets a collection of DataCollectionRuleAssociationResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of DataCollectionRuleAssociationResources and their operations over a DataCollectionRuleAssociationResource. public static DataCollectionRuleAssociationCollection GetDataCollectionRuleAssociations(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetDataCollectionRuleAssociations(); + return GetMockableMonitorArmClient(client).GetDataCollectionRuleAssociations(scope); } /// @@ -572,17 +228,21 @@ public static DataCollectionRuleAssociationCollection GetDataCollectionRuleAssoc /// DataCollectionRuleAssociations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the association. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataCollectionRuleAssociationAsync(this ArmClient client, ResourceIdentifier scope, string associationName, CancellationToken cancellationToken = default) { - return await client.GetDataCollectionRuleAssociations(scope).GetAsync(associationName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorArmClient(client).GetDataCollectionRuleAssociationAsync(scope, associationName, cancellationToken).ConfigureAwait(false); } /// @@ -597,17 +257,21 @@ public static async Task> GetDat /// DataCollectionRuleAssociations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the association. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataCollectionRuleAssociation(this ArmClient client, ResourceIdentifier scope, string associationName, CancellationToken cancellationToken = default) { - return client.GetDataCollectionRuleAssociations(scope).Get(associationName, cancellationToken); + return GetMockableMonitorArmClient(client).GetDataCollectionRuleAssociation(scope, associationName, cancellationToken); } /// @@ -622,6 +286,10 @@ public static Response GetDataCollectionR /// MetricDefinitions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -629,7 +297,7 @@ public static Response GetDataCollectionR /// The cancellation token to use. public static AsyncPageable GetMonitorMetricDefinitionsAsync(this ArmClient client, ResourceIdentifier scope, string metricnamespace = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetMonitorMetricDefinitionsAsync(metricnamespace, cancellationToken); + return GetMockableMonitorArmClient(client).GetMonitorMetricDefinitionsAsync(scope, metricnamespace, cancellationToken); } /// @@ -644,6 +312,10 @@ public static AsyncPageable GetMonitorMetricDefinitions /// MetricDefinitions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -651,7 +323,7 @@ public static AsyncPageable GetMonitorMetricDefinitions /// The cancellation token to use. public static Pageable GetMonitorMetricDefinitions(this ArmClient client, ResourceIdentifier scope, string metricnamespace = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetMonitorMetricDefinitions(metricnamespace, cancellationToken); + return GetMockableMonitorArmClient(client).GetMonitorMetricDefinitions(scope, metricnamespace, cancellationToken); } /// @@ -666,6 +338,10 @@ public static Pageable GetMonitorMetricDefinitions(this /// Metrics_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -673,9 +349,7 @@ public static Pageable GetMonitorMetricDefinitions(this /// The cancellation token to use. public static AsyncPageable GetMonitorMetricsAsync(this ArmClient client, ResourceIdentifier scope, ArmResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) { - options ??= new ArmResourceGetMonitorMetricsOptions(); - - return GetArmResourceExtensionClient(client, scope).GetMonitorMetricsAsync(options, cancellationToken); + return GetMockableMonitorArmClient(client).GetMonitorMetricsAsync(scope, options, cancellationToken); } /// @@ -690,6 +364,10 @@ public static AsyncPageable GetMonitorMetricsAsync(this ArmClient /// Metrics_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -697,9 +375,7 @@ public static AsyncPageable GetMonitorMetricsAsync(this ArmClient /// The cancellation token to use. public static Pageable GetMonitorMetrics(this ArmClient client, ResourceIdentifier scope, ArmResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) { - options ??= new ArmResourceGetMonitorMetricsOptions(); - - return GetArmResourceExtensionClient(client, scope).GetMonitorMetrics(options, cancellationToken); + return GetMockableMonitorArmClient(client).GetMonitorMetrics(scope, options, cancellationToken); } /// @@ -714,16 +390,18 @@ public static Pageable GetMonitorMetrics(this ArmClient client, R /// Baselines_List /// /// - /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. /// The cancellation token to use. public static AsyncPageable GetMonitorMetricBaselinesAsync(this ArmClient client, ResourceIdentifier scope, ArmResourceGetMonitorMetricBaselinesOptions options, CancellationToken cancellationToken = default) { - options ??= new ArmResourceGetMonitorMetricBaselinesOptions(); - - return GetArmResourceExtensionClient(client, scope).GetMonitorMetricBaselinesAsync(options, cancellationToken); + return GetMockableMonitorArmClient(client).GetMonitorMetricBaselinesAsync(scope, options, cancellationToken); } /// @@ -734,72 +412,376 @@ public static AsyncPageable GetMonitorMetricBaselin /// /{resourceUri}/providers/Microsoft.Insights/metricBaselines /// /// - /// Operation Id - /// Baselines_List + /// Operation Id + /// Baselines_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + public static Pageable GetMonitorMetricBaselines(this ArmClient client, ResourceIdentifier scope, ArmResourceGetMonitorMetricBaselinesOptions options, CancellationToken cancellationToken = default) + { + return GetMockableMonitorArmClient(client).GetMonitorMetricBaselines(scope, options, cancellationToken); + } + + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/microsoft.insights/metricNamespaces + /// + /// + /// Operation Id + /// MetricNamespaces_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The ISO 8601 conform Date start time from which to query for metric namespaces. + /// The cancellation token to use. + public static AsyncPageable GetMonitorMetricNamespacesAsync(this ArmClient client, ResourceIdentifier scope, string startTime = null, CancellationToken cancellationToken = default) + { + return GetMockableMonitorArmClient(client).GetMonitorMetricNamespacesAsync(scope, startTime, cancellationToken); + } + + /// + /// Lists the metric namespaces for the resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/microsoft.insights/metricNamespaces + /// + /// + /// Operation Id + /// MetricNamespaces_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The ISO 8601 conform Date start time from which to query for metric namespaces. + /// The cancellation token to use. + public static Pageable GetMonitorMetricNamespaces(this ArmClient client, ResourceIdentifier scope, string startTime = null, CancellationToken cancellationToken = default) + { + return GetMockableMonitorArmClient(client).GetMonitorMetricNamespaces(scope, startTime, cancellationToken); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AutoscaleSettingResource GetAutoscaleSettingResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetAutoscaleSettingResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AlertRuleResource GetAlertRuleResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetAlertRuleResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static LogProfileResource GetLogProfileResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetLogProfileResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DiagnosticSettingResource GetDiagnosticSettingResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetDiagnosticSettingResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DiagnosticSettingsCategoryResource GetDiagnosticSettingsCategoryResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetDiagnosticSettingsCategoryResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ActionGroupResource GetActionGroupResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetActionGroupResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MetricAlertResource GetMetricAlertResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetMetricAlertResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ScheduledQueryRuleResource GetScheduledQueryRuleResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetScheduledQueryRuleResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatusResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetVmInsightsOnboardingStatusResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MonitorPrivateLinkScopeResource GetMonitorPrivateLinkScopeResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetMonitorPrivateLinkScopeResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MonitorPrivateLinkResource GetMonitorPrivateLinkResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetMonitorPrivateLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MonitorPrivateEndpointConnectionResource GetMonitorPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetMonitorPrivateEndpointConnectionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MonitorPrivateLinkScopedResource GetMonitorPrivateLinkScopedResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetMonitorPrivateLinkScopedResource(id); + } + + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ActivityLogAlertResource GetActivityLogAlertResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetActivityLogAlertResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DataCollectionEndpointResource GetDataCollectionEndpointResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMonitorArmClient(client).GetDataCollectionEndpointResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public static Pageable GetMonitorMetricBaselines(this ArmClient client, ResourceIdentifier scope, ArmResourceGetMonitorMetricBaselinesOptions options, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static DataCollectionRuleAssociationResource GetDataCollectionRuleAssociationResource(this ArmClient client, ResourceIdentifier id) { - options ??= new ArmResourceGetMonitorMetricBaselinesOptions(); - - return GetArmResourceExtensionClient(client, scope).GetMonitorMetricBaselines(options, cancellationToken); + return GetMockableMonitorArmClient(client).GetDataCollectionRuleAssociationResource(id); } /// - /// Lists the metric namespaces for the resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/microsoft.insights/metricNamespaces - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// MetricNamespaces_List + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The ISO 8601 conform Date start time from which to query for metric namespaces. - /// The cancellation token to use. - public static AsyncPageable GetMonitorMetricNamespacesAsync(this ArmClient client, ResourceIdentifier scope, string startTime = null, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static DataCollectionRuleResource GetDataCollectionRuleResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetMonitorMetricNamespacesAsync(startTime, cancellationToken); + return GetMockableMonitorArmClient(client).GetDataCollectionRuleResource(id); } /// - /// Lists the metric namespaces for the resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/microsoft.insights/metricNamespaces - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// MetricNamespaces_List + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The ISO 8601 conform Date start time from which to query for metric namespaces. - /// The cancellation token to use. - public static Pageable GetMonitorMetricNamespaces(this ArmClient client, ResourceIdentifier scope, string startTime = null, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static MonitorWorkspaceResource GetMonitorWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetMonitorMetricNamespaces(startTime, cancellationToken); + return GetMockableMonitorArmClient(client).GetMonitorWorkspaceResource(id); } - /// Gets a collection of AutoscaleSettingResources in the ResourceGroupResource. + /// + /// Gets a collection of AutoscaleSettingResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AutoscaleSettingResources and their operations over a AutoscaleSettingResource. public static AutoscaleSettingCollection GetAutoscaleSettings(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAutoscaleSettings(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetAutoscaleSettings(); } /// @@ -814,16 +796,20 @@ public static AutoscaleSettingCollection GetAutoscaleSettings(this ResourceGroup /// AutoscaleSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The autoscale setting name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutoscaleSettingAsync(this ResourceGroupResource resourceGroupResource, string autoscaleSettingName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAutoscaleSettings().GetAsync(autoscaleSettingName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetAutoscaleSettingAsync(autoscaleSettingName, cancellationToken).ConfigureAwait(false); } /// @@ -838,24 +824,34 @@ public static async Task> GetAutoscaleSetting /// AutoscaleSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The autoscale setting name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutoscaleSetting(this ResourceGroupResource resourceGroupResource, string autoscaleSettingName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAutoscaleSettings().Get(autoscaleSettingName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetAutoscaleSetting(autoscaleSettingName, cancellationToken); } - /// Gets a collection of AlertRuleResources in the ResourceGroupResource. + /// + /// Gets a collection of AlertRuleResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AlertRuleResources and their operations over a AlertRuleResource. public static AlertRuleCollection GetAlertRules(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAlertRules(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetAlertRules(); } /// @@ -870,16 +866,20 @@ public static AlertRuleCollection GetAlertRules(this ResourceGroupResource resou /// AlertRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAlertRuleAsync(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAlertRules().GetAsync(ruleName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetAlertRuleAsync(ruleName, cancellationToken).ConfigureAwait(false); } /// @@ -894,24 +894,34 @@ public static async Task> GetAlertRuleAsync(this Res /// AlertRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAlertRule(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAlertRules().Get(ruleName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetAlertRule(ruleName, cancellationToken); } - /// Gets a collection of ActionGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of ActionGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ActionGroupResources and their operations over a ActionGroupResource. public static ActionGroupCollection GetActionGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetActionGroups(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetActionGroups(); } /// @@ -926,16 +936,20 @@ public static ActionGroupCollection GetActionGroups(this ResourceGroupResource r /// ActionGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the action group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetActionGroupAsync(this ResourceGroupResource resourceGroupResource, string actionGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetActionGroups().GetAsync(actionGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetActionGroupAsync(actionGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -950,24 +964,34 @@ public static async Task> GetActionGroupAsync(this /// ActionGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the action group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetActionGroup(this ResourceGroupResource resourceGroupResource, string actionGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetActionGroups().Get(actionGroupName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetActionGroup(actionGroupName, cancellationToken); } - /// Gets a collection of MetricAlertResources in the ResourceGroupResource. + /// + /// Gets a collection of MetricAlertResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MetricAlertResources and their operations over a MetricAlertResource. public static MetricAlertCollection GetMetricAlerts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMetricAlerts(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMetricAlerts(); } /// @@ -982,16 +1006,20 @@ public static MetricAlertCollection GetMetricAlerts(this ResourceGroupResource r /// MetricAlerts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMetricAlertAsync(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMetricAlerts().GetAsync(ruleName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMetricAlertAsync(ruleName, cancellationToken).ConfigureAwait(false); } /// @@ -1006,24 +1034,34 @@ public static async Task> GetMetricAlertAsync(this /// MetricAlerts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMetricAlert(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMetricAlerts().Get(ruleName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMetricAlert(ruleName, cancellationToken); } - /// Gets a collection of ScheduledQueryRuleResources in the ResourceGroupResource. + /// + /// Gets a collection of ScheduledQueryRuleResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ScheduledQueryRuleResources and their operations over a ScheduledQueryRuleResource. public static ScheduledQueryRuleCollection GetScheduledQueryRules(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetScheduledQueryRules(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetScheduledQueryRules(); } /// @@ -1038,16 +1076,20 @@ public static ScheduledQueryRuleCollection GetScheduledQueryRules(this ResourceG /// ScheduledQueryRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetScheduledQueryRuleAsync(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetScheduledQueryRules().GetAsync(ruleName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetScheduledQueryRuleAsync(ruleName, cancellationToken).ConfigureAwait(false); } /// @@ -1062,24 +1104,34 @@ public static async Task> GetScheduledQuery /// ScheduledQueryRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetScheduledQueryRule(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetScheduledQueryRules().Get(ruleName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetScheduledQueryRule(ruleName, cancellationToken); } - /// Gets a collection of MonitorPrivateLinkScopeResources in the ResourceGroupResource. + /// + /// Gets a collection of MonitorPrivateLinkScopeResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MonitorPrivateLinkScopeResources and their operations over a MonitorPrivateLinkScopeResource. public static MonitorPrivateLinkScopeCollection GetMonitorPrivateLinkScopes(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMonitorPrivateLinkScopes(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMonitorPrivateLinkScopes(); } /// @@ -1094,16 +1146,20 @@ public static MonitorPrivateLinkScopeCollection GetMonitorPrivateLinkScopes(this /// PrivateLinkScopes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Monitor PrivateLinkScope resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMonitorPrivateLinkScopeAsync(this ResourceGroupResource resourceGroupResource, string scopeName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMonitorPrivateLinkScopes().GetAsync(scopeName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMonitorPrivateLinkScopeAsync(scopeName, cancellationToken).ConfigureAwait(false); } /// @@ -1118,24 +1174,34 @@ public static async Task> GetMonitorPr /// PrivateLinkScopes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Monitor PrivateLinkScope resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMonitorPrivateLinkScope(this ResourceGroupResource resourceGroupResource, string scopeName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMonitorPrivateLinkScopes().Get(scopeName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMonitorPrivateLinkScope(scopeName, cancellationToken); } - /// Gets a collection of ActivityLogAlertResources in the ResourceGroupResource. + /// + /// Gets a collection of ActivityLogAlertResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ActivityLogAlertResources and their operations over a ActivityLogAlertResource. public static ActivityLogAlertCollection GetActivityLogAlerts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetActivityLogAlerts(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetActivityLogAlerts(); } /// @@ -1150,16 +1216,20 @@ public static ActivityLogAlertCollection GetActivityLogAlerts(this ResourceGroup /// ActivityLogAlerts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Activity Log Alert rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetActivityLogAlertAsync(this ResourceGroupResource resourceGroupResource, string activityLogAlertName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetActivityLogAlerts().GetAsync(activityLogAlertName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetActivityLogAlertAsync(activityLogAlertName, cancellationToken).ConfigureAwait(false); } /// @@ -1174,24 +1244,34 @@ public static async Task> GetActivityLogAlert /// ActivityLogAlerts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Activity Log Alert rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetActivityLogAlert(this ResourceGroupResource resourceGroupResource, string activityLogAlertName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetActivityLogAlerts().Get(activityLogAlertName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetActivityLogAlert(activityLogAlertName, cancellationToken); } - /// Gets a collection of DataCollectionEndpointResources in the ResourceGroupResource. + /// + /// Gets a collection of DataCollectionEndpointResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataCollectionEndpointResources and their operations over a DataCollectionEndpointResource. public static DataCollectionEndpointCollection GetDataCollectionEndpoints(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataCollectionEndpoints(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetDataCollectionEndpoints(); } /// @@ -1206,16 +1286,20 @@ public static DataCollectionEndpointCollection GetDataCollectionEndpoints(this R /// DataCollectionEndpoints_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the data collection endpoint. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataCollectionEndpointAsync(this ResourceGroupResource resourceGroupResource, string dataCollectionEndpointName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataCollectionEndpoints().GetAsync(dataCollectionEndpointName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetDataCollectionEndpointAsync(dataCollectionEndpointName, cancellationToken).ConfigureAwait(false); } /// @@ -1230,24 +1314,34 @@ public static async Task> GetDataCollec /// DataCollectionEndpoints_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the data collection endpoint. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataCollectionEndpoint(this ResourceGroupResource resourceGroupResource, string dataCollectionEndpointName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataCollectionEndpoints().Get(dataCollectionEndpointName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetDataCollectionEndpoint(dataCollectionEndpointName, cancellationToken); } - /// Gets a collection of DataCollectionRuleResources in the ResourceGroupResource. + /// + /// Gets a collection of DataCollectionRuleResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataCollectionRuleResources and their operations over a DataCollectionRuleResource. public static DataCollectionRuleCollection GetDataCollectionRules(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataCollectionRules(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetDataCollectionRules(); } /// @@ -1262,16 +1356,20 @@ public static DataCollectionRuleCollection GetDataCollectionRules(this ResourceG /// DataCollectionRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the data collection rule. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataCollectionRuleAsync(this ResourceGroupResource resourceGroupResource, string dataCollectionRuleName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataCollectionRules().GetAsync(dataCollectionRuleName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetDataCollectionRuleAsync(dataCollectionRuleName, cancellationToken).ConfigureAwait(false); } /// @@ -1286,24 +1384,34 @@ public static async Task> GetDataCollection /// DataCollectionRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the data collection rule. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataCollectionRule(this ResourceGroupResource resourceGroupResource, string dataCollectionRuleName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataCollectionRules().Get(dataCollectionRuleName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetDataCollectionRule(dataCollectionRuleName, cancellationToken); } - /// Gets a collection of MonitorWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of MonitorWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MonitorWorkspaceResources and their operations over a MonitorWorkspaceResource. public static MonitorWorkspaceResourceCollection GetMonitorWorkspaceResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMonitorWorkspaceResources(); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMonitorWorkspaceResources(); } /// @@ -1318,16 +1426,20 @@ public static MonitorWorkspaceResourceCollection GetMonitorWorkspaceResources(th /// AzureMonitorWorkspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Monitor workspace. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMonitorWorkspaceResourceAsync(this ResourceGroupResource resourceGroupResource, string azureMonitorWorkspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMonitorWorkspaceResources().GetAsync(azureMonitorWorkspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMonitorWorkspaceResourceAsync(azureMonitorWorkspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -1342,16 +1454,20 @@ public static async Task> GetMonitorWorkspace /// AzureMonitorWorkspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Monitor workspace. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMonitorWorkspaceResource(this ResourceGroupResource resourceGroupResource, string azureMonitorWorkspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMonitorWorkspaceResources().Get(azureMonitorWorkspaceName, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetMonitorWorkspaceResource(azureMonitorWorkspaceName, cancellationToken); } /// @@ -1366,6 +1482,10 @@ public static Response GetMonitorWorkspaceResource(thi /// PrivateLinkScopeOperationStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The operation Id. @@ -1374,9 +1494,7 @@ public static Response GetMonitorWorkspaceResource(thi /// is null. public static async Task> GetPrivateLinkScopeOperationStatusAsync(this ResourceGroupResource resourceGroupResource, string asyncOperationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(asyncOperationId, nameof(asyncOperationId)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPrivateLinkScopeOperationStatusAsync(asyncOperationId, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorResourceGroupResource(resourceGroupResource).GetPrivateLinkScopeOperationStatusAsync(asyncOperationId, cancellationToken).ConfigureAwait(false); } /// @@ -1391,6 +1509,10 @@ public static async Task> GetPr /// PrivateLinkScopeOperationStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The operation Id. @@ -1399,17 +1521,21 @@ public static async Task> GetPr /// is null. public static Response GetPrivateLinkScopeOperationStatus(this ResourceGroupResource resourceGroupResource, string asyncOperationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(asyncOperationId, nameof(asyncOperationId)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPrivateLinkScopeOperationStatus(asyncOperationId, cancellationToken); + return GetMockableMonitorResourceGroupResource(resourceGroupResource).GetPrivateLinkScopeOperationStatus(asyncOperationId, cancellationToken); } - /// Gets a collection of LogProfileResources in the SubscriptionResource. + /// + /// Gets a collection of LogProfileResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LogProfileResources and their operations over a LogProfileResource. public static LogProfileCollection GetLogProfiles(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLogProfiles(); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetLogProfiles(); } /// @@ -1424,16 +1550,20 @@ public static LogProfileCollection GetLogProfiles(this SubscriptionResource subs /// LogProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the log profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLogProfileAsync(this SubscriptionResource subscriptionResource, string logProfileName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetLogProfiles().GetAsync(logProfileName, cancellationToken).ConfigureAwait(false); + return await GetMockableMonitorSubscriptionResource(subscriptionResource).GetLogProfileAsync(logProfileName, cancellationToken).ConfigureAwait(false); } /// @@ -1448,16 +1578,20 @@ public static async Task> GetLogProfileAsync(this S /// LogProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the log profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLogProfile(this SubscriptionResource subscriptionResource, string logProfileName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetLogProfiles().Get(logProfileName, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetLogProfile(logProfileName, cancellationToken); } /// @@ -1472,13 +1606,17 @@ public static Response GetLogProfile(this SubscriptionResour /// AutoscaleSettings_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAutoscaleSettingsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutoscaleSettingsAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetAutoscaleSettingsAsync(cancellationToken); } /// @@ -1493,13 +1631,17 @@ public static AsyncPageable GetAutoscaleSettingsAsync( /// AutoscaleSettings_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAutoscaleSettings(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutoscaleSettings(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetAutoscaleSettings(cancellationToken); } /// @@ -1514,13 +1656,17 @@ public static Pageable GetAutoscaleSettings(this Subsc /// AlertRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAlertRulesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAlertRulesAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetAlertRulesAsync(cancellationToken); } /// @@ -1535,13 +1681,17 @@ public static AsyncPageable GetAlertRulesAsync(this Subscript /// AlertRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAlertRules(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAlertRules(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetAlertRules(cancellationToken); } /// @@ -1556,13 +1706,17 @@ public static Pageable GetAlertRules(this SubscriptionResourc /// ActionGroups_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetActionGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetActionGroupsAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetActionGroupsAsync(cancellationToken); } /// @@ -1577,13 +1731,17 @@ public static AsyncPageable GetActionGroupsAsync(this Subsc /// ActionGroups_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetActionGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetActionGroups(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetActionGroups(cancellationToken); } /// @@ -1598,6 +1756,10 @@ public static Pageable GetActionGroups(this SubscriptionRes /// ActivityLogs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. @@ -1607,9 +1769,7 @@ public static Pageable GetActionGroups(this SubscriptionRes /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetActivityLogsAsync(this SubscriptionResource subscriptionResource, string filter, string select = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(filter, nameof(filter)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetActivityLogsAsync(filter, select, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetActivityLogsAsync(filter, select, cancellationToken); } /// @@ -1624,6 +1784,10 @@ public static AsyncPageable GetActivityLogsAsync(this Subscriptio /// ActivityLogs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. @@ -1633,9 +1797,7 @@ public static AsyncPageable GetActivityLogsAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetActivityLogs(this SubscriptionResource subscriptionResource, string filter, string select = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(filter, nameof(filter)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetActivityLogs(filter, select, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetActivityLogs(filter, select, cancellationToken); } /// @@ -1650,6 +1812,10 @@ public static Pageable GetActivityLogs(this SubscriptionResource /// Metrics_ListAtSubscriptionScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -1658,9 +1824,7 @@ public static Pageable GetActivityLogs(this SubscriptionResource /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetMonitorMetricsAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMonitorMetricsAsync(options, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMonitorMetricsAsync(options, cancellationToken); } /// @@ -1675,6 +1839,10 @@ public static AsyncPageable GetMonitorMetricsAsync(th /// Metrics_ListAtSubscriptionScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -1683,9 +1851,7 @@ public static AsyncPageable GetMonitorMetricsAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetMonitorMetrics(this SubscriptionResource subscriptionResource, SubscriptionResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMonitorMetrics(options, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMonitorMetrics(options, cancellationToken); } /// @@ -1700,6 +1866,10 @@ public static Pageable GetMonitorMetrics(this Subscri /// Metrics_ListAtSubscriptionScopePost /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -1708,9 +1878,7 @@ public static Pageable GetMonitorMetrics(this Subscri /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetMonitorMetricsWithPostAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetMonitorMetricsWithPostOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMonitorMetricsWithPostAsync(options, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMonitorMetricsWithPostAsync(options, cancellationToken); } /// @@ -1725,6 +1893,10 @@ public static AsyncPageable GetMonitorMetricsWithPost /// Metrics_ListAtSubscriptionScopePost /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -1733,9 +1905,7 @@ public static AsyncPageable GetMonitorMetricsWithPost /// A collection of that may take multiple service requests to iterate over. public static Pageable GetMonitorMetricsWithPost(this SubscriptionResource subscriptionResource, SubscriptionResourceGetMonitorMetricsWithPostOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMonitorMetricsWithPost(options, cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMonitorMetricsWithPost(options, cancellationToken); } /// @@ -1750,13 +1920,17 @@ public static Pageable GetMonitorMetricsWithPost(this /// MetricAlerts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMetricAlertsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMetricAlertsAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMetricAlertsAsync(cancellationToken); } /// @@ -1771,13 +1945,17 @@ public static AsyncPageable GetMetricAlertsAsync(this Subsc /// MetricAlerts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMetricAlerts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMetricAlerts(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMetricAlerts(cancellationToken); } /// @@ -1792,13 +1970,17 @@ public static Pageable GetMetricAlerts(this SubscriptionRes /// ScheduledQueryRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScheduledQueryRulesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScheduledQueryRulesAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetScheduledQueryRulesAsync(cancellationToken); } /// @@ -1813,13 +1995,17 @@ public static AsyncPageable GetScheduledQueryRulesAs /// ScheduledQueryRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetScheduledQueryRules(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetScheduledQueryRules(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetScheduledQueryRules(cancellationToken); } /// @@ -1834,13 +2020,17 @@ public static Pageable GetScheduledQueryRules(this S /// PrivateLinkScopes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMonitorPrivateLinkScopesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMonitorPrivateLinkScopesAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMonitorPrivateLinkScopesAsync(cancellationToken); } /// @@ -1855,13 +2045,17 @@ public static AsyncPageable GetMonitorPrivateLi /// PrivateLinkScopes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMonitorPrivateLinkScopes(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMonitorPrivateLinkScopes(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMonitorPrivateLinkScopes(cancellationToken); } /// @@ -1876,13 +2070,17 @@ public static Pageable GetMonitorPrivateLinkSco /// ActivityLogAlerts_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetActivityLogAlertsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetActivityLogAlertsAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetActivityLogAlertsAsync(cancellationToken); } /// @@ -1897,13 +2095,17 @@ public static AsyncPageable GetActivityLogAlertsAsync( /// ActivityLogAlerts_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetActivityLogAlerts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetActivityLogAlerts(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetActivityLogAlerts(cancellationToken); } /// @@ -1918,13 +2120,17 @@ public static Pageable GetActivityLogAlerts(this Subsc /// DataCollectionEndpoints_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataCollectionEndpointsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataCollectionEndpointsAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetDataCollectionEndpointsAsync(cancellationToken); } /// @@ -1939,13 +2145,17 @@ public static AsyncPageable GetDataCollectionEnd /// DataCollectionEndpoints_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataCollectionEndpoints(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataCollectionEndpoints(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetDataCollectionEndpoints(cancellationToken); } /// @@ -1960,13 +2170,17 @@ public static Pageable GetDataCollectionEndpoint /// DataCollectionRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataCollectionRulesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataCollectionRulesAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetDataCollectionRulesAsync(cancellationToken); } /// @@ -1981,13 +2195,17 @@ public static AsyncPageable GetDataCollectionRulesAs /// DataCollectionRules_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataCollectionRules(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataCollectionRules(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetDataCollectionRules(cancellationToken); } /// @@ -2002,13 +2220,17 @@ public static Pageable GetDataCollectionRules(this S /// AzureMonitorWorkspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMonitorWorkspaceResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMonitorWorkspaceResourcesAsync(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMonitorWorkspaceResourcesAsync(cancellationToken); } /// @@ -2023,13 +2245,17 @@ public static AsyncPageable GetMonitorWorkspaceResourc /// AzureMonitorWorkspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMonitorWorkspaceResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMonitorWorkspaceResources(cancellationToken); + return GetMockableMonitorSubscriptionResource(subscriptionResource).GetMonitorWorkspaceResources(cancellationToken); } /// @@ -2044,13 +2270,17 @@ public static Pageable GetMonitorWorkspaceResources(th /// EventCategories_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEventCategoriesAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetEventCategoriesAsync(cancellationToken); + return GetMockableMonitorTenantResource(tenantResource).GetEventCategoriesAsync(cancellationToken); } /// @@ -2065,13 +2295,17 @@ public static AsyncPageable GetEventCategoriesAsync(th /// EventCategories_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEventCategories(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetEventCategories(cancellationToken); + return GetMockableMonitorTenantResource(tenantResource).GetEventCategories(cancellationToken); } /// @@ -2086,6 +2320,10 @@ public static Pageable GetEventCategories(this TenantR /// TenantActivityLogs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. @@ -2094,7 +2332,7 @@ public static Pageable GetEventCategories(this TenantR /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetTenantActivityLogsAsync(this TenantResource tenantResource, string filter = null, string select = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetTenantActivityLogsAsync(filter, select, cancellationToken); + return GetMockableMonitorTenantResource(tenantResource).GetTenantActivityLogsAsync(filter, select, cancellationToken); } /// @@ -2109,6 +2347,10 @@ public static AsyncPageable GetTenantActivityLogsAsync(this Tenan /// TenantActivityLogs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. @@ -2117,7 +2359,7 @@ public static AsyncPageable GetTenantActivityLogsAsync(this Tenan /// A collection of that may take multiple service requests to iterate over. public static Pageable GetTenantActivityLogs(this TenantResource tenantResource, string filter = null, string select = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetTenantActivityLogs(filter, select, cancellationToken); + return GetMockableMonitorTenantResource(tenantResource).GetTenantActivityLogs(filter, select, cancellationToken); } } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3f878efff98f5..0000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,178 +0,0 @@ -// 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; -using Azure.ResourceManager.Monitor.Models; - -namespace Azure.ResourceManager.Monitor -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _privateLinkScopeOperationStatusClientDiagnostics; - private PrivateLinkScopeOperationStatusRestOperations _privateLinkScopeOperationStatusRestClient; - - /// 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 ClientDiagnostics PrivateLinkScopeOperationStatusClientDiagnostics => _privateLinkScopeOperationStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PrivateLinkScopeOperationStatusRestOperations PrivateLinkScopeOperationStatusRestClient => _privateLinkScopeOperationStatusRestClient ??= new PrivateLinkScopeOperationStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of AutoscaleSettingResources in the ResourceGroupResource. - /// An object representing collection of AutoscaleSettingResources and their operations over a AutoscaleSettingResource. - public virtual AutoscaleSettingCollection GetAutoscaleSettings() - { - return GetCachedClient(Client => new AutoscaleSettingCollection(Client, Id)); - } - - /// Gets a collection of AlertRuleResources in the ResourceGroupResource. - /// An object representing collection of AlertRuleResources and their operations over a AlertRuleResource. - public virtual AlertRuleCollection GetAlertRules() - { - return GetCachedClient(Client => new AlertRuleCollection(Client, Id)); - } - - /// Gets a collection of ActionGroupResources in the ResourceGroupResource. - /// An object representing collection of ActionGroupResources and their operations over a ActionGroupResource. - public virtual ActionGroupCollection GetActionGroups() - { - return GetCachedClient(Client => new ActionGroupCollection(Client, Id)); - } - - /// Gets a collection of MetricAlertResources in the ResourceGroupResource. - /// An object representing collection of MetricAlertResources and their operations over a MetricAlertResource. - public virtual MetricAlertCollection GetMetricAlerts() - { - return GetCachedClient(Client => new MetricAlertCollection(Client, Id)); - } - - /// Gets a collection of ScheduledQueryRuleResources in the ResourceGroupResource. - /// An object representing collection of ScheduledQueryRuleResources and their operations over a ScheduledQueryRuleResource. - public virtual ScheduledQueryRuleCollection GetScheduledQueryRules() - { - return GetCachedClient(Client => new ScheduledQueryRuleCollection(Client, Id)); - } - - /// Gets a collection of MonitorPrivateLinkScopeResources in the ResourceGroupResource. - /// An object representing collection of MonitorPrivateLinkScopeResources and their operations over a MonitorPrivateLinkScopeResource. - public virtual MonitorPrivateLinkScopeCollection GetMonitorPrivateLinkScopes() - { - return GetCachedClient(Client => new MonitorPrivateLinkScopeCollection(Client, Id)); - } - - /// Gets a collection of ActivityLogAlertResources in the ResourceGroupResource. - /// An object representing collection of ActivityLogAlertResources and their operations over a ActivityLogAlertResource. - public virtual ActivityLogAlertCollection GetActivityLogAlerts() - { - return GetCachedClient(Client => new ActivityLogAlertCollection(Client, Id)); - } - - /// Gets a collection of DataCollectionEndpointResources in the ResourceGroupResource. - /// An object representing collection of DataCollectionEndpointResources and their operations over a DataCollectionEndpointResource. - public virtual DataCollectionEndpointCollection GetDataCollectionEndpoints() - { - return GetCachedClient(Client => new DataCollectionEndpointCollection(Client, Id)); - } - - /// Gets a collection of DataCollectionRuleResources in the ResourceGroupResource. - /// An object representing collection of DataCollectionRuleResources and their operations over a DataCollectionRuleResource. - public virtual DataCollectionRuleCollection GetDataCollectionRules() - { - return GetCachedClient(Client => new DataCollectionRuleCollection(Client, Id)); - } - - /// Gets a collection of MonitorWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of MonitorWorkspaceResources and their operations over a MonitorWorkspaceResource. - public virtual MonitorWorkspaceResourceCollection GetMonitorWorkspaceResources() - { - return GetCachedClient(Client => new MonitorWorkspaceResourceCollection(Client, Id)); - } - - /// - /// Get the status of an azure asynchronous operation associated with a private link scope operation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId} - /// - /// - /// Operation Id - /// PrivateLinkScopeOperationStatus_Get - /// - /// - /// - /// The operation Id. - /// The cancellation token to use. - public virtual async Task> GetPrivateLinkScopeOperationStatusAsync(string asyncOperationId, CancellationToken cancellationToken = default) - { - using var scope = PrivateLinkScopeOperationStatusClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetPrivateLinkScopeOperationStatus"); - scope.Start(); - try - { - var response = await PrivateLinkScopeOperationStatusRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, asyncOperationId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the status of an azure asynchronous operation associated with a private link scope operation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId} - /// - /// - /// Operation Id - /// PrivateLinkScopeOperationStatus_Get - /// - /// - /// - /// The operation Id. - /// The cancellation token to use. - public virtual Response GetPrivateLinkScopeOperationStatus(string asyncOperationId, CancellationToken cancellationToken = default) - { - using var scope = PrivateLinkScopeOperationStatusClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetPrivateLinkScopeOperationStatus"); - scope.Start(); - try - { - var response = PrivateLinkScopeOperationStatusRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, asyncOperationId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index bcba8371c2d97..0000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,666 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Monitor.Models; - -namespace Azure.ResourceManager.Monitor -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _autoscaleSettingClientDiagnostics; - private AutoscaleSettingsRestOperations _autoscaleSettingRestClient; - private ClientDiagnostics _alertRuleClientDiagnostics; - private AlertRulesRestOperations _alertRuleRestClient; - private ClientDiagnostics _actionGroupClientDiagnostics; - private ActionGroupsRestOperations _actionGroupRestClient; - private ClientDiagnostics _activityLogsClientDiagnostics; - private ActivityLogsRestOperations _activityLogsRestClient; - private ClientDiagnostics _metricsClientDiagnostics; - private MetricsRestOperations _metricsRestClient; - private ClientDiagnostics _metricAlertClientDiagnostics; - private MetricAlertsRestOperations _metricAlertRestClient; - private ClientDiagnostics _scheduledQueryRuleClientDiagnostics; - private ScheduledQueryRulesRestOperations _scheduledQueryRuleRestClient; - private ClientDiagnostics _monitorPrivateLinkScopePrivateLinkScopesClientDiagnostics; - private PrivateLinkScopesRestOperations _monitorPrivateLinkScopePrivateLinkScopesRestClient; - private ClientDiagnostics _activityLogAlertClientDiagnostics; - private ActivityLogAlertsRestOperations _activityLogAlertRestClient; - private ClientDiagnostics _dataCollectionEndpointClientDiagnostics; - private DataCollectionEndpointsRestOperations _dataCollectionEndpointRestClient; - private ClientDiagnostics _dataCollectionRuleClientDiagnostics; - private DataCollectionRulesRestOperations _dataCollectionRuleRestClient; - private ClientDiagnostics _monitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics; - private AzureMonitorWorkspacesRestOperations _monitorWorkspaceResourceAzureMonitorWorkspacesRestClient; - - /// 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 AutoscaleSettingClientDiagnostics => _autoscaleSettingClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", AutoscaleSettingResource.ResourceType.Namespace, Diagnostics); - private AutoscaleSettingsRestOperations AutoscaleSettingRestClient => _autoscaleSettingRestClient ??= new AutoscaleSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AutoscaleSettingResource.ResourceType)); - private ClientDiagnostics AlertRuleClientDiagnostics => _alertRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", AlertRuleResource.ResourceType.Namespace, Diagnostics); - private AlertRulesRestOperations AlertRuleRestClient => _alertRuleRestClient ??= new AlertRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AlertRuleResource.ResourceType)); - private ClientDiagnostics ActionGroupClientDiagnostics => _actionGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActionGroupResource.ResourceType.Namespace, Diagnostics); - private ActionGroupsRestOperations ActionGroupRestClient => _actionGroupRestClient ??= new ActionGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ActionGroupResource.ResourceType)); - private ClientDiagnostics ActivityLogsClientDiagnostics => _activityLogsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ActivityLogsRestOperations ActivityLogsRestClient => _activityLogsRestClient ??= new ActivityLogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics MetricsClientDiagnostics => _metricsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MetricsRestOperations MetricsRestClient => _metricsRestClient ??= new MetricsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics MetricAlertClientDiagnostics => _metricAlertClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", MetricAlertResource.ResourceType.Namespace, Diagnostics); - private MetricAlertsRestOperations MetricAlertRestClient => _metricAlertRestClient ??= new MetricAlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MetricAlertResource.ResourceType)); - private ClientDiagnostics ScheduledQueryRuleClientDiagnostics => _scheduledQueryRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ScheduledQueryRuleResource.ResourceType.Namespace, Diagnostics); - private ScheduledQueryRulesRestOperations ScheduledQueryRuleRestClient => _scheduledQueryRuleRestClient ??= new ScheduledQueryRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScheduledQueryRuleResource.ResourceType)); - private ClientDiagnostics MonitorPrivateLinkScopePrivateLinkScopesClientDiagnostics => _monitorPrivateLinkScopePrivateLinkScopesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", MonitorPrivateLinkScopeResource.ResourceType.Namespace, Diagnostics); - private PrivateLinkScopesRestOperations MonitorPrivateLinkScopePrivateLinkScopesRestClient => _monitorPrivateLinkScopePrivateLinkScopesRestClient ??= new PrivateLinkScopesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MonitorPrivateLinkScopeResource.ResourceType)); - private ClientDiagnostics ActivityLogAlertClientDiagnostics => _activityLogAlertClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActivityLogAlertResource.ResourceType.Namespace, Diagnostics); - private ActivityLogAlertsRestOperations ActivityLogAlertRestClient => _activityLogAlertRestClient ??= new ActivityLogAlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ActivityLogAlertResource.ResourceType)); - private ClientDiagnostics DataCollectionEndpointClientDiagnostics => _dataCollectionEndpointClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", DataCollectionEndpointResource.ResourceType.Namespace, Diagnostics); - private DataCollectionEndpointsRestOperations DataCollectionEndpointRestClient => _dataCollectionEndpointRestClient ??= new DataCollectionEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataCollectionEndpointResource.ResourceType)); - private ClientDiagnostics DataCollectionRuleClientDiagnostics => _dataCollectionRuleClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", DataCollectionRuleResource.ResourceType.Namespace, Diagnostics); - private DataCollectionRulesRestOperations DataCollectionRuleRestClient => _dataCollectionRuleRestClient ??= new DataCollectionRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataCollectionRuleResource.ResourceType)); - private ClientDiagnostics MonitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics => _monitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", MonitorWorkspaceResource.ResourceType.Namespace, Diagnostics); - private AzureMonitorWorkspacesRestOperations MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient => _monitorWorkspaceResourceAzureMonitorWorkspacesRestClient ??= new AzureMonitorWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MonitorWorkspaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of LogProfileResources in the SubscriptionResource. - /// An object representing collection of LogProfileResources and their operations over a LogProfileResource. - public virtual LogProfileCollection GetLogProfiles() - { - return GetCachedClient(Client => new LogProfileCollection(Client, Id)); - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings - /// - /// - /// Operation Id - /// AutoscaleSettings_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAutoscaleSettingsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AutoscaleSettingRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutoscaleSettingRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutoscaleSettingResource(Client, AutoscaleSettingData.DeserializeAutoscaleSettingData(e)), AutoscaleSettingClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutoscaleSettings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings - /// - /// - /// Operation Id - /// AutoscaleSettings_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAutoscaleSettings(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AutoscaleSettingRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AutoscaleSettingRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutoscaleSettingResource(Client, AutoscaleSettingData.DeserializeAutoscaleSettingData(e)), AutoscaleSettingClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutoscaleSettings", "value", "nextLink", cancellationToken); - } - - /// - /// List the classic metric alert rules within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules - /// - /// - /// Operation Id - /// AlertRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAlertRulesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AlertRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AlertRuleResource(Client, AlertRuleData.DeserializeAlertRuleData(e)), AlertRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlertRules", "value", null, cancellationToken); - } - - /// - /// List the classic metric alert rules within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules - /// - /// - /// Operation Id - /// AlertRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAlertRules(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AlertRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AlertRuleResource(Client, AlertRuleData.DeserializeAlertRuleData(e)), AlertRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlertRules", "value", null, cancellationToken); - } - - /// - /// Get a list of all action groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups - /// - /// - /// Operation Id - /// ActionGroups_ListBySubscriptionId - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetActionGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ActionGroupRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ActionGroupResource(Client, ActionGroupData.DeserializeActionGroupData(e)), ActionGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetActionGroups", "value", null, cancellationToken); - } - - /// - /// Get a list of all action groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups - /// - /// - /// Operation Id - /// ActionGroups_ListBySubscriptionId - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetActionGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ActionGroupRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ActionGroupResource(Client, ActionGroupData.DeserializeActionGroupData(e)), ActionGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetActionGroups", "value", null, cancellationToken); - } - - /// - /// Provides the list of records from the activity logs. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values - /// - /// - /// Operation Id - /// ActivityLogs_List - /// - /// - /// - /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. - /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetActivityLogsAsync(string filter, string select = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ActivityLogsRestClient.CreateListRequest(Id.SubscriptionId, filter, select); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ActivityLogsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, select); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EventDataInfo.DeserializeEventDataInfo, ActivityLogsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetActivityLogs", "value", "nextLink", cancellationToken); - } - - /// - /// Provides the list of records from the activity logs. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values - /// - /// - /// Operation Id - /// ActivityLogs_List - /// - /// - /// - /// Reduces the set of data collected.<br>This argument is required and it also requires at least the start date/time.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. - /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetActivityLogs(string filter, string select = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ActivityLogsRestClient.CreateListRequest(Id.SubscriptionId, filter, select); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ActivityLogsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter, select); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EventDataInfo.DeserializeEventDataInfo, ActivityLogsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetActivityLogs", "value", "nextLink", cancellationToken); - } - - /// - /// **Lists the metric data for a subscription**. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics - /// - /// - /// Operation Id - /// Metrics_ListAtSubscriptionScope - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitorMetricsAsync(SubscriptionResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListAtSubscriptionScopeRequest(Id.SubscriptionId, options.Region, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, SubscriptionMonitorMetric.DeserializeSubscriptionMonitorMetric, MetricsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMonitorMetrics", "value", null, cancellationToken); - } - - /// - /// **Lists the metric data for a subscription**. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics - /// - /// - /// Operation Id - /// Metrics_ListAtSubscriptionScope - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitorMetrics(SubscriptionResourceGetMonitorMetricsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListAtSubscriptionScopeRequest(Id.SubscriptionId, options.Region, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, SubscriptionMonitorMetric.DeserializeSubscriptionMonitorMetric, MetricsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMonitorMetrics", "value", null, cancellationToken); - } - - /// - /// **Lists the metric data for a subscription**. Parameters can be specified on either query params or the body. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics - /// - /// - /// Operation Id - /// Metrics_ListAtSubscriptionScopePost - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitorMetricsWithPostAsync(SubscriptionResourceGetMonitorMetricsWithPostOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListAtSubscriptionScopePostRequest(Id.SubscriptionId, options.Region, options.Content, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, SubscriptionMonitorMetric.DeserializeSubscriptionMonitorMetric, MetricsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMonitorMetricsWithPost", "value", null, cancellationToken); - } - - /// - /// **Lists the metric data for a subscription**. Parameters can be specified on either query params or the body. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics - /// - /// - /// Operation Id - /// Metrics_ListAtSubscriptionScopePost - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitorMetricsWithPost(SubscriptionResourceGetMonitorMetricsWithPostOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricsRestClient.CreateListAtSubscriptionScopePostRequest(Id.SubscriptionId, options.Region, options.Content, options.Timespan, options.Interval, options.Metricnames, options.Aggregation, options.Top, options.Orderby, options.Filter, options.ResultType, options.Metricnamespace, options.AutoAdjustTimegrain, options.ValidateDimensions); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, SubscriptionMonitorMetric.DeserializeSubscriptionMonitorMetric, MetricsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMonitorMetricsWithPost", "value", null, cancellationToken); - } - - /// - /// Retrieve alert rule definitions in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts - /// - /// - /// Operation Id - /// MetricAlerts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMetricAlertsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricAlertRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MetricAlertResource(Client, MetricAlertData.DeserializeMetricAlertData(e)), MetricAlertClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMetricAlerts", "value", null, cancellationToken); - } - - /// - /// Retrieve alert rule definitions in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts - /// - /// - /// Operation Id - /// MetricAlerts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMetricAlerts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MetricAlertRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MetricAlertResource(Client, MetricAlertData.DeserializeMetricAlertData(e)), MetricAlertClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMetricAlerts", "value", null, cancellationToken); - } - - /// - /// Retrieve a scheduled query rule definitions in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules - /// - /// - /// Operation Id - /// ScheduledQueryRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScheduledQueryRulesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScheduledQueryRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScheduledQueryRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScheduledQueryRuleResource(Client, ScheduledQueryRuleData.DeserializeScheduledQueryRuleData(e)), ScheduledQueryRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScheduledQueryRules", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieve a scheduled query rule definitions in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules - /// - /// - /// Operation Id - /// ScheduledQueryRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScheduledQueryRules(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScheduledQueryRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScheduledQueryRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScheduledQueryRuleResource(Client, ScheduledQueryRuleData.DeserializeScheduledQueryRuleData(e)), ScheduledQueryRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetScheduledQueryRules", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes - /// - /// - /// Operation Id - /// PrivateLinkScopes_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitorPrivateLinkScopesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MonitorPrivateLinkScopePrivateLinkScopesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MonitorPrivateLinkScopePrivateLinkScopesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MonitorPrivateLinkScopeResource(Client, MonitorPrivateLinkScopeData.DeserializeMonitorPrivateLinkScopeData(e)), MonitorPrivateLinkScopePrivateLinkScopesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMonitorPrivateLinkScopes", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes - /// - /// - /// Operation Id - /// PrivateLinkScopes_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitorPrivateLinkScopes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MonitorPrivateLinkScopePrivateLinkScopesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MonitorPrivateLinkScopePrivateLinkScopesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MonitorPrivateLinkScopeResource(Client, MonitorPrivateLinkScopeData.DeserializeMonitorPrivateLinkScopeData(e)), MonitorPrivateLinkScopePrivateLinkScopesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMonitorPrivateLinkScopes", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of all Activity Log Alert rules in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts - /// - /// - /// Operation Id - /// ActivityLogAlerts_ListBySubscriptionId - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetActivityLogAlertsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ActivityLogAlertRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ActivityLogAlertRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ActivityLogAlertResource(Client, ActivityLogAlertData.DeserializeActivityLogAlertData(e)), ActivityLogAlertClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetActivityLogAlerts", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of all Activity Log Alert rules in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts - /// - /// - /// Operation Id - /// ActivityLogAlerts_ListBySubscriptionId - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetActivityLogAlerts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ActivityLogAlertRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ActivityLogAlertRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ActivityLogAlertResource(Client, ActivityLogAlertData.DeserializeActivityLogAlertData(e)), ActivityLogAlertClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetActivityLogAlerts", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all data collection endpoints in the specified subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints - /// - /// - /// Operation Id - /// DataCollectionEndpoints_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataCollectionEndpointsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataCollectionEndpointRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataCollectionEndpointRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataCollectionEndpointResource(Client, DataCollectionEndpointData.DeserializeDataCollectionEndpointData(e)), DataCollectionEndpointClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataCollectionEndpoints", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all data collection endpoints in the specified subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints - /// - /// - /// Operation Id - /// DataCollectionEndpoints_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataCollectionEndpoints(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataCollectionEndpointRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataCollectionEndpointRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataCollectionEndpointResource(Client, DataCollectionEndpointData.DeserializeDataCollectionEndpointData(e)), DataCollectionEndpointClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataCollectionEndpoints", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all data collection rules in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules - /// - /// - /// Operation Id - /// DataCollectionRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataCollectionRulesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataCollectionRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataCollectionRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataCollectionRuleResource(Client, DataCollectionRuleData.DeserializeDataCollectionRuleData(e)), DataCollectionRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataCollectionRules", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all data collection rules in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules - /// - /// - /// Operation Id - /// DataCollectionRules_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataCollectionRules(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataCollectionRuleRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataCollectionRuleRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataCollectionRuleResource(Client, DataCollectionRuleData.DeserializeDataCollectionRuleData(e)), DataCollectionRuleClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataCollectionRules", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all workspaces in the specified subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts - /// - /// - /// Operation Id - /// AzureMonitorWorkspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMonitorWorkspaceResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MonitorWorkspaceResource(Client, MonitorWorkspaceResourceData.DeserializeMonitorWorkspaceResourceData(e)), MonitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMonitorWorkspaceResources", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all workspaces in the specified subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts - /// - /// - /// Operation Id - /// AzureMonitorWorkspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMonitorWorkspaceResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MonitorWorkspaceResourceAzureMonitorWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MonitorWorkspaceResource(Client, MonitorWorkspaceResourceData.DeserializeMonitorWorkspaceResourceData(e)), MonitorWorkspaceResourceAzureMonitorWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMonitorWorkspaceResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 665aa0e90a915..0000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Monitor.Models; - -namespace Azure.ResourceManager.Monitor -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _eventCategoriesClientDiagnostics; - private EventCategoriesRestOperations _eventCategoriesRestClient; - private ClientDiagnostics _tenantActivityLogsClientDiagnostics; - private TenantActivityLogsRestOperations _tenantActivityLogsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics EventCategoriesClientDiagnostics => _eventCategoriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EventCategoriesRestOperations EventCategoriesRestClient => _eventCategoriesRestClient ??= new EventCategoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics TenantActivityLogsClientDiagnostics => _tenantActivityLogsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private TenantActivityLogsRestOperations TenantActivityLogsRestClient => _tenantActivityLogsRestClient ??= new TenantActivityLogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. - /// - /// - /// Request Path - /// /providers/Microsoft.Insights/eventcategories - /// - /// - /// Operation Id - /// EventCategories_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEventCategoriesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventCategoriesRestClient.CreateListRequest(); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MonitorLocalizableString.DeserializeMonitorLocalizableString, EventCategoriesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetEventCategories", "value", null, cancellationToken); - } - - /// - /// Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. - /// - /// - /// Request Path - /// /providers/Microsoft.Insights/eventcategories - /// - /// - /// Operation Id - /// EventCategories_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEventCategories(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventCategoriesRestClient.CreateListRequest(); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MonitorLocalizableString.DeserializeMonitorLocalizableString, EventCategoriesClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetEventCategories", "value", null, cancellationToken); - } - - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. - /// - /// - /// Request Path - /// /providers/Microsoft.Insights/eventtypes/management/values - /// - /// - /// Operation Id - /// TenantActivityLogs_List - /// - /// - /// - /// Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. - /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetTenantActivityLogsAsync(string filter = null, string select = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TenantActivityLogsRestClient.CreateListRequest(filter, select); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TenantActivityLogsRestClient.CreateListNextPageRequest(nextLink, filter, select); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EventDataInfo.DeserializeEventDataInfo, TenantActivityLogsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetTenantActivityLogs", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. - /// - /// - /// Request Path - /// /providers/Microsoft.Insights/eventtypes/management/values - /// - /// - /// Operation Id - /// TenantActivityLogs_List - /// - /// - /// - /// Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. - /// Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId*. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetTenantActivityLogs(string filter = null, string select = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TenantActivityLogsRestClient.CreateListRequest(filter, select); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TenantActivityLogsRestClient.CreateListNextPageRequest(nextLink, filter, select); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EventDataInfo.DeserializeEventDataInfo, TenantActivityLogsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetTenantActivityLogs", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogProfileResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogProfileResource.cs index 5c1c77f5f91b9..af60212f42a43 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogProfileResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogProfileResource.cs @@ -28,6 +28,8 @@ namespace Azure.ResourceManager.Monitor public partial class LogProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The logProfileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string logProfileName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MetricAlertResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MetricAlertResource.cs index 039fd04a56c00..3d9dd8d68f848 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MetricAlertResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MetricAlertResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Monitor public partial class MetricAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateEndpointConnectionResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateEndpointConnectionResource.cs index c94478b406f9c..785198eb9daac 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateEndpointConnectionResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Monitor public partial class MonitorPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scopeName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scopeName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkResource.cs index d4fcbff3f42f9..32ed758330767 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Monitor public partial class MonitorPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scopeName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scopeName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeResource.cs index f845c79fc08b9..67cdbb90dffc4 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Monitor public partial class MonitorPrivateLinkScopeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scopeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scopeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MonitorPrivateLinkResources and their operations over a MonitorPrivateLinkResource. public virtual MonitorPrivateLinkResourceCollection GetMonitorPrivateLinkResources() { - return GetCachedClient(Client => new MonitorPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new MonitorPrivateLinkResourceCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual MonitorPrivateLinkResourceCollection GetMonitorPrivateLinkResourc /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMonitorPrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetMonitorPrivat /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMonitorPrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetMonitorPrivateLinkResourc /// An object representing collection of MonitorPrivateEndpointConnectionResources and their operations over a MonitorPrivateEndpointConnectionResource. public virtual MonitorPrivateEndpointConnectionCollection GetMonitorPrivateEndpointConnections() { - return GetCachedClient(Client => new MonitorPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new MonitorPrivateEndpointConnectionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual MonitorPrivateEndpointConnectionCollection GetMonitorPrivateEndpo /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMonitorPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> Ge /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMonitorPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetMonitorPriv /// An object representing collection of MonitorPrivateLinkScopedResources and their operations over a MonitorPrivateLinkScopedResource. public virtual MonitorPrivateLinkScopedResourceCollection GetMonitorPrivateLinkScopedResources() { - return GetCachedClient(Client => new MonitorPrivateLinkScopedResourceCollection(Client, Id)); + return GetCachedClient(client => new MonitorPrivateLinkScopedResourceCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual MonitorPrivateLinkScopedResourceCollection GetMonitorPrivateLinkS /// /// The name of the scoped resource object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMonitorPrivateLinkScopedResourceAsync(string name, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetMonitor /// /// The name of the scoped resource object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMonitorPrivateLinkScopedResource(string name, CancellationToken cancellationToken = default) { diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopedResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopedResource.cs index d01e649834fb1..0fa498ae239a1 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopedResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopedResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Monitor public partial class MonitorPrivateLinkScopedResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scopeName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scopeName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorWorkspaceResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorWorkspaceResource.cs index 99a71f5de93ed..6ae5ef26cb319 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorWorkspaceResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorWorkspaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Monitor public partial class MonitorWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureMonitorWorkspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureMonitorWorkspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResource.cs index 360f64162ff65..30a6c4601364d 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Monitor public partial class ScheduledQueryRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"; diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/VmInsightsOnboardingStatusResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/VmInsightsOnboardingStatusResource.cs index 438758c20fa88..102897c275068 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/VmInsightsOnboardingStatusResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/VmInsightsOnboardingStatusResource.cs @@ -25,6 +25,7 @@ namespace Azure.ResourceManager.Monitor public partial class VmInsightsOnboardingStatusResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceUri. public static ResourceIdentifier CreateResourceIdentifier(string resourceUri) { var resourceId = $"{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"; diff --git a/sdk/monitor/ci.yml b/sdk/monitor/ci.yml index 8ec6766f9e41d..1b6e0860d7711 100644 --- a/sdk/monitor/ci.yml +++ b/sdk/monitor/ci.yml @@ -13,6 +13,7 @@ trigger: - sdk/monitor/service.projects - sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore - sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter + - sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics - sdk/monitor/Azure.Monitor.Query - sdk/monitor/Azure.Monitor.Ingestion @@ -29,6 +30,7 @@ pr: - sdk/monitor/service.projects - sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore - sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter + - sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics - sdk/monitor/Azure.Monitor.Query - sdk/monitor/Azure.Monitor.Ingestion @@ -43,6 +45,8 @@ extends: safeName: AzureMonitorOpenTelemetryAspNetCore - name: Azure.Monitor.OpenTelemetry.Exporter safeName: AzureMonitorOpenTelemetryExporter + - name: Azure.Monitor.OpenTelemetry.LiveMetrics + safeName: AzureMonitorOpenTelemetryLiveMetrics - name: Azure.Monitor.Query safeName: AzureMonitorQuery - name: Azure.Monitor.Ingestion diff --git a/sdk/mysql/Azure.ResourceManager.MySql/CHANGELOG.md b/sdk/mysql/Azure.ResourceManager.MySql/CHANGELOG.md index d53922fd14e99..9c7fa5f6992b7 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/CHANGELOG.md +++ b/sdk/mysql/Azure.ResourceManager.MySql/CHANGELOG.md @@ -1,14 +1,12 @@ # Release History -## 1.1.0-beta.3 (Unreleased) +## 1.1.0-beta.3 (2023-11-03) ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Upgraded the Flexible Server API version to `2023-06-01-preview`. +- CapabilitySets API with optimized schema +- New feature for Advanced Threat Protection ## 1.1.0-beta.2 (2023-06-07) diff --git a/sdk/mysql/Azure.ResourceManager.MySql/api/Azure.ResourceManager.MySql.netstandard2.0.cs b/sdk/mysql/Azure.ResourceManager.MySql/api/Azure.ResourceManager.MySql.netstandard2.0.cs index a493419d9a57d..142c8bc88b95d 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/api/Azure.ResourceManager.MySql.netstandard2.0.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/api/Azure.ResourceManager.MySql.netstandard2.0.cs @@ -387,7 +387,7 @@ protected MySqlServerCollection() { } } public partial class MySqlServerData : Azure.ResourceManager.Models.TrackedResourceData { - public MySqlServerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MySqlServerData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string ByokEnforcement { get { throw null; } } public System.DateTimeOffset? EarliestRestoreOn { get { throw null; } set { } } @@ -659,6 +659,12 @@ public static partial class FlexibleServersExtensions public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerCollection GetMySqlFlexibleServers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetMySqlFlexibleServers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetMySqlFlexibleServersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServersCapabilityCollection GetMySqlFlexibleServersCapabilities(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName) { throw null; } + public static Azure.Response GetMySqlFlexibleServersCapability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, string capabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetMySqlFlexibleServersCapabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, string capabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServersCapabilityResource GetMySqlFlexibleServersCapabilityResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetOperationResult(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetOperationResultAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation locationName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MySqlFlexibleServerAadAdministratorCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -805,7 +811,7 @@ protected MySqlFlexibleServerConfigurationResource() { } } public partial class MySqlFlexibleServerData : Azure.ResourceManager.Models.TrackedResourceData { - public MySqlFlexibleServerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MySqlFlexibleServerData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public string AvailabilityZone { get { throw null; } set { } } @@ -815,8 +821,10 @@ public MySqlFlexibleServerData(Azure.Core.AzureLocation location) : base (defaul public string FullyQualifiedDomainName { get { throw null; } } public Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerHighAvailability HighAvailability { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceProperties ImportSourceProperties { get { throw null; } set { } } public Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerMaintenanceWindow MaintenanceWindow { get { throw null; } set { } } public Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNetwork Network { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public int? ReplicaCapacity { get { throw null; } } public Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerReplicationRole? ReplicationRole { get { throw null; } set { } } public System.DateTimeOffset? RestorePointInTime { get { throw null; } set { } } @@ -911,6 +919,8 @@ protected MySqlFlexibleServerResource() { } public virtual Azure.ResourceManager.ArmOperation CreateBackupAndExport(Azure.WaitUntil waitUntil, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupAndExportContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateBackupAndExportAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupAndExportContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation CutoverMigrationServersMigration(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CutoverMigrationServersMigrationAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { 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.ResourceManager.ArmOperation Failover(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -953,19 +963,97 @@ protected MySqlFlexibleServerResource() { } public virtual Azure.Response ValidateBackup(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> ValidateBackupAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class MySqlFlexibleServersCapabilityCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected MySqlFlexibleServersCapabilityCollection() { } + public virtual Azure.Response Exists(string capabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string capabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string capabilitySetName, 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 capabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string capabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string capabilitySetName, 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 MySqlFlexibleServersCapabilityData : Azure.ResourceManager.Models.ResourceData + { + public MySqlFlexibleServersCapabilityData() { } + public System.Collections.Generic.IReadOnlyList SupportedFlexibleServerEditions { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SupportedGeoBackupRegions { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SupportedServerVersions { get { throw null; } } + } + public partial class MySqlFlexibleServersCapabilityResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected MySqlFlexibleServersCapabilityResource() { } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServersCapabilityData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Azure.Core.AzureLocation locationName, string capabilitySetName) { 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; } + } +} +namespace Azure.ResourceManager.MySql.FlexibleServers.Mocking +{ + public partial class MockableMySqlFlexibleServersArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMySqlFlexibleServersArmClient() { } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerAadAdministratorResource GetMySqlFlexibleServerAadAdministratorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerBackupResource GetMySqlFlexibleServerBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerConfigurationResource GetMySqlFlexibleServerConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerDatabaseResource GetMySqlFlexibleServerDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerFirewallRuleResource GetMySqlFlexibleServerFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerResource GetMySqlFlexibleServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServersCapabilityResource GetMySqlFlexibleServersCapabilityResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMySqlFlexibleServersResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMySqlFlexibleServersResourceGroupResource() { } + public virtual Azure.Response GetMySqlFlexibleServer(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMySqlFlexibleServerAsync(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerCollection GetMySqlFlexibleServers() { throw null; } + } + public partial class MockableMySqlFlexibleServersSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMySqlFlexibleServersSubscriptionResource() { } + public virtual Azure.Response CheckMySqlFlexibleServerNameAvailability(Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckMySqlFlexibleServerNameAvailabilityAsync(Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckMySqlFlexibleServerNameAvailabilityWithoutLocation(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckMySqlFlexibleServerNameAvailabilityWithoutLocationAsync(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExecuteCheckVirtualNetworkSubnetUsage(Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExecuteCheckVirtualNetworkSubnetUsageAsync(Azure.Core.AzureLocation locationName, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLocationBasedCapabilities(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLocationBasedCapabilitiesAsync(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMySqlFlexibleServers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMySqlFlexibleServersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServersCapabilityCollection GetMySqlFlexibleServersCapabilities(Azure.Core.AzureLocation locationName) { throw null; } + public virtual Azure.Response GetMySqlFlexibleServersCapability(Azure.Core.AzureLocation locationName, string capabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMySqlFlexibleServersCapabilityAsync(Azure.Core.AzureLocation locationName, string capabilitySetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetOperationResult(Azure.Core.AzureLocation locationName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOperationResultAsync(Azure.Core.AzureLocation locationName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableMySqlFlexibleServersTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableMySqlFlexibleServersTenantResource() { } + public virtual Azure.Response ExecuteGetPrivateDnsZoneSuffix(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExecuteGetPrivateDnsZoneSuffixAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } } namespace Azure.ResourceManager.MySql.FlexibleServers.Models { public static partial class ArmMySqlFlexibleServersModelFactory { public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerAadAdministratorData MySqlFlexibleServerAadAdministratorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerAdministratorType? administratorType = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerAdministratorType?), string login = null, string sid = null, System.Guid? tenantId = default(System.Guid?), Azure.Core.ResourceIdentifier identityResourceId = null) { throw null; } - public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupAndExportResult MySqlFlexibleServerBackupAndExportResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupAndExportOperationStatus? status = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupAndExportOperationStatus?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), double? percentComplete = default(double?), Azure.ResponseError error = null, long? datasourceSizeInBytes = default(long?), long? dataTransferredInBytes = default(long?), string backupMetadata = null) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupAndExportResult MySqlFlexibleServerBackupAndExportResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupAndExportOperationStatus? status = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupAndExportOperationStatus?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), double? percentComplete = default(double?), long? datasourceSizeInBytes = default(long?), long? dataTransferredInBytes = default(long?), string backupMetadata = null, Azure.ResponseError error = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerBackupData MySqlFlexibleServerBackupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string backupType = null, System.DateTimeOffset? completedOn = default(System.DateTimeOffset?), string source = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupProperties MySqlFlexibleServerBackupProperties(int? backupRetentionDays = default(int?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEnableStatusEnum? geoRedundantBackup = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEnableStatusEnum?), System.DateTimeOffset? earliestRestoreOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerCapabilityProperties MySqlFlexibleServerCapabilityProperties(string zone = null, System.Collections.Generic.IEnumerable supportedHAMode = null, System.Collections.Generic.IEnumerable supportedGeoBackupRegions = null, System.Collections.Generic.IEnumerable supportedFlexibleServerEditions = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerConfigurationData MySqlFlexibleServerConfigurationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string value = null, string currentValue = null, string description = null, string documentationLink = null, string defaultValue = null, string dataType = null, string allowedValues = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigurationSource? source = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigurationSource?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigReadOnlyState? isReadOnly = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigReadOnlyState?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigPendingRestartState? isConfigPendingRestart = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigPendingRestartState?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigDynamicState? isDynamicConfig = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigDynamicState?)) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerConfigurations MySqlFlexibleServerConfigurations(System.Collections.Generic.IEnumerable values = null) { throw null; } - public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerData MySqlFlexibleServerData(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.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerSku sku = null, string administratorLogin = null, string administratorLoginPassword = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVersion? version = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVersion?), string availabilityZone = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerCreateMode? createMode = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerCreateMode?), Azure.Core.ResourceIdentifier sourceServerResourceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerReplicationRole? replicationRole = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerReplicationRole?), int? replicaCapacity = default(int?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerDataEncryption dataEncryption = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerState? state = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerState?), string fullyQualifiedDomainName = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerStorage storage = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupProperties backup = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerHighAvailability highAvailability = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNetwork network = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerMaintenanceWindow maintenanceWindow = null) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerData MySqlFlexibleServerData(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.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerSku sku = null, string administratorLogin = null, string administratorLoginPassword = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVersion? version = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVersion?), string availabilityZone = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerCreateMode? createMode = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerCreateMode?), Azure.Core.ResourceIdentifier sourceServerResourceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerReplicationRole? replicationRole = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerReplicationRole?), int? replicaCapacity = default(int?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerDataEncryption dataEncryption = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerState? state = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerState?), string fullyQualifiedDomainName = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerStorage storage = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupProperties backup = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerHighAvailability highAvailability = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNetwork network = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerMaintenanceWindow maintenanceWindow = null, Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceProperties importSourceProperties = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServerDatabaseData MySqlFlexibleServerDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string charset = null, string collation = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerDelegatedSubnetUsage MySqlFlexibleServerDelegatedSubnetUsage(string subnetName = null, long? usage = default(long?)) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEditionCapability MySqlFlexibleServerEditionCapability(string name = null, System.Collections.Generic.IEnumerable supportedStorageEditions = null, System.Collections.Generic.IEnumerable supportedServerVersions = null) { throw null; } @@ -974,12 +1062,44 @@ public static partial class ArmMySqlFlexibleServersModelFactory public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerLogFile MySqlFlexibleServerLogFile(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, long? sizeInKB = default(long?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string typePropertiesType = null, System.DateTimeOffset? lastModifiedOn = default(System.DateTimeOffset?), System.Uri uri = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerNameAvailabilityResult MySqlFlexibleServerNameAvailabilityResult(string message = null, bool? isNameAvailable = default(bool?), string reason = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerPrivateDnsZoneSuffixResponse MySqlFlexibleServerPrivateDnsZoneSuffixResponse(string privateDnsZoneSuffix = null) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.MySqlFlexibleServersCapabilityData MySqlFlexibleServersCapabilityData(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.IEnumerable supportedGeoBackupRegions = null, System.Collections.Generic.IEnumerable supportedFlexibleServerEditions = null, System.Collections.Generic.IEnumerable supportedServerVersions = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerServerVersionCapability MySqlFlexibleServerServerVersionCapability(string name = null, System.Collections.Generic.IEnumerable supportedSkus = null) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerSkuCapability MySqlFlexibleServerSkuCapability(string name = null, long? vCores = default(long?), long? supportedIops = default(long?), long? supportedMemoryPerVCoreInMB = default(long?)) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnection MySqlFlexibleServersPrivateEndpointConnection(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.IEnumerable groupIds = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateLinkServiceConnectionState connectionState = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState?)) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerStorage MySqlFlexibleServerStorage(int? storageSizeInGB = default(int?), int? iops = default(int?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEnableStatusEnum? autoGrow = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEnableStatusEnum?), Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEnableStatusEnum? logOnDisk = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEnableStatusEnum?), string storageSku = null, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEnableStatusEnum? autoIoScaling = default(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerEnableStatusEnum?)) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerStorageEditionCapability MySqlFlexibleServerStorageEditionCapability(string name = null, long? minStorageSize = default(long?), long? maxStorageSize = default(long?), long? minBackupRetentionDays = default(long?), long? maxBackupRetentionDays = default(long?)) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerValidateBackupResult MySqlFlexibleServerValidateBackupResult(int? numberOfContainers = default(int?)) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerVirtualNetworkSubnetUsageResult MySqlFlexibleServerVirtualNetworkSubnetUsageResult(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string subscriptionId = null, System.Collections.Generic.IEnumerable delegatedSubnetsUsage = null) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.OperationStatusExtendedResult OperationStatusExtendedResult(Azure.Core.ResourceIdentifier id = null, Azure.Core.ResourceIdentifier resourceId = null, string name = null, string status = null, float? percentComplete = default(float?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null, System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.OperationStatusResult OperationStatusResult(Azure.Core.ResourceIdentifier id = null, Azure.Core.ResourceIdentifier resourceId = null, string name = null, string status = null, float? percentComplete = default(float?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.ServerEditionCapabilityV2 ServerEditionCapabilityV2(string name = null, string defaultSku = null, int? defaultStorageSize = default(int?), System.Collections.Generic.IEnumerable supportedStorageEditions = null, System.Collections.Generic.IEnumerable supportedSkus = null) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.ServerVersionCapabilityV2 ServerVersionCapabilityV2(string name = null) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.SkuCapabilityV2 SkuCapabilityV2(string name = null, long? vCores = default(long?), long? supportedIops = default(long?), long? supportedMemoryPerVCoreMB = default(long?), System.Collections.Generic.IEnumerable supportedZones = null, System.Collections.Generic.IEnumerable supportedHAMode = null) { throw null; } + } + public partial class ImportSourceProperties + { + public ImportSourceProperties() { } + public string DataDirPath { get { throw null; } set { } } + public string SasToken { get { throw null; } set { } } + public Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceStorageType? StorageType { get { throw null; } set { } } + public System.Uri StorageUri { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ImportSourceStorageType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ImportSourceStorageType(string value) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceStorageType AzureBlob { get { throw null; } } + public bool Equals(Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceStorageType 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.MySql.FlexibleServers.Models.ImportSourceStorageType left, Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceStorageType right) { throw null; } + public static implicit operator Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceStorageType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceStorageType left, Azure.ResourceManager.MySql.FlexibleServers.Models.ImportSourceStorageType right) { throw null; } + public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MySqlFlexibleServerAdministratorName : System.IEquatable @@ -1053,7 +1173,7 @@ public MySqlFlexibleServerBackupContentBase(Azure.ResourceManager.MySql.Flexible private readonly int _dummyPrimitive; public MySqlFlexibleServerBackupFormat(string value) { throw null; } public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupFormat CollatedFormat { get { throw null; } } - public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupFormat None { get { throw null; } } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupFormat Raw { get { throw null; } } public bool Equals(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerBackupFormat other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } @@ -1441,6 +1561,60 @@ internal MySqlFlexibleServerSkuCapability() { } public static bool operator !=(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerSkuTier left, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServerSkuTier right) { throw null; } public override string ToString() { throw null; } } + public partial class MySqlFlexibleServersPrivateEndpointConnection : Azure.ResourceManager.Models.ResourceData + { + public MySqlFlexibleServersPrivateEndpointConnection() { } + public Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateLinkServiceConnectionState ConnectionState { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList GroupIds { get { throw null; } } + public Azure.Core.ResourceIdentifier PrivateEndpointId { get { throw null; } } + public Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MySqlFlexibleServersPrivateEndpointConnectionProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState 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.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointConnectionProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MySqlFlexibleServersPrivateEndpointServiceConnectionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MySqlFlexibleServersPrivateEndpointServiceConnectionStatus(string value) { throw null; } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus Approved { get { throw null; } } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus Pending { get { throw null; } } + public static Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus 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.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class MySqlFlexibleServersPrivateLinkServiceConnectionState + { + public MySqlFlexibleServersPrivateLinkServiceConnectionState() { } + public string ActionsRequired { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.MySql.FlexibleServers.Models.MySqlFlexibleServersPrivateEndpointServiceConnectionStatus? Status { get { throw null; } set { } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MySqlFlexibleServerState : System.IEquatable { @@ -1518,6 +1692,87 @@ internal MySqlFlexibleServerVirtualNetworkSubnetUsageResult() { } public Azure.Core.AzureLocation? Location { get { throw null; } } public string SubscriptionId { get { throw null; } } } + public partial class OperationStatusExtendedResult : Azure.ResourceManager.MySql.FlexibleServers.Models.OperationStatusResult + { + internal OperationStatusExtendedResult() { } + public System.Collections.Generic.IReadOnlyDictionary Properties { get { throw null; } } + } + public partial class OperationStatusResult + { + internal OperationStatusResult() { } + public System.DateTimeOffset? EndOn { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public Azure.Core.ResourceIdentifier Id { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Operations { get { throw null; } } + public float? PercentComplete { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public string Status { get { throw null; } } + } + public partial class ServerEditionCapabilityV2 + { + internal ServerEditionCapabilityV2() { } + public string DefaultSku { get { throw null; } } + public int? DefaultStorageSize { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SupportedSkus { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SupportedStorageEditions { get { throw null; } } + } + public partial class ServerVersionCapabilityV2 + { + internal ServerVersionCapabilityV2() { } + public string Name { get { throw null; } } + } + public partial class SkuCapabilityV2 + { + internal SkuCapabilityV2() { } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SupportedHAMode { get { throw null; } } + public long? SupportedIops { get { throw null; } } + public long? SupportedMemoryPerVCoreMB { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SupportedZones { get { throw null; } } + public long? VCores { get { throw null; } } + } +} +namespace Azure.ResourceManager.MySql.Mocking +{ + public partial class MockableMySqlArmClient : Azure.ResourceManager.ArmResource + { + protected MockableMySqlArmClient() { } + public virtual Azure.ResourceManager.MySql.MySqlAdvisorResource GetMySqlAdvisorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlConfigurationResource GetMySqlConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlDatabaseResource GetMySqlDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlFirewallRuleResource GetMySqlFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlPrivateEndpointConnectionResource GetMySqlPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlPrivateLinkResource GetMySqlPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlQueryStatisticResource GetMySqlQueryStatisticResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlQueryTextResource GetMySqlQueryTextResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlRecommendationActionResource GetMySqlRecommendationActionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlServerAdministratorResource GetMySqlServerAdministratorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlServerKeyResource GetMySqlServerKeyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlServerResource GetMySqlServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlServerSecurityAlertPolicyResource GetMySqlServerSecurityAlertPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlVirtualNetworkRuleResource GetMySqlVirtualNetworkRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlWaitStatisticResource GetMySqlWaitStatisticResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableMySqlResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableMySqlResourceGroupResource() { } + public virtual Azure.Response GetMySqlServer(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMySqlServerAsync(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MySql.MySqlServerCollection GetMySqlServers() { throw null; } + } + public partial class MockableMySqlSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableMySqlSubscriptionResource() { } + public virtual Azure.Response CheckMySqlNameAvailability(Azure.ResourceManager.MySql.Models.MySqlNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckMySqlNameAvailabilityAsync(Azure.ResourceManager.MySql.Models.MySqlNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLocationBasedPerformanceTiers(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLocationBasedPerformanceTiersAsync(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMySqlServers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMySqlServersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } } namespace Azure.ResourceManager.MySql.Models { diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorCollection.cs index 0e33b3473acfb..47bf3efd68d92 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_MySqlFlexibleServerAadAdministratorCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAnAzureAdAdministrator() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorCreate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorCreate.json // this example is just showing the usage of "AzureADAdministrators_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -67,7 +67,7 @@ public async Task CreateOrUpdate_CreateAnAzureAdAdministrator() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAnAzureAdAdministrator() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorGet.json // this example is just showing the usage of "AzureADAdministrators_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -102,7 +102,7 @@ public async Task Get_GetAnAzureAdAdministrator() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAnAzureAdAdministrator() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorGet.json // this example is just showing the usage of "AzureADAdministrators_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -133,7 +133,7 @@ public async Task Exists_GetAnAzureAdAdministrator() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAnAzureAdAdministrator() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorGet.json // this example is just showing the usage of "AzureADAdministrators_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -176,7 +176,7 @@ public async Task GetIfExists_GetAnAzureAdAdministrator() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAzureADAdministratorsInAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorsListByServer.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorsListByServer.json // this example is just showing the usage of "AzureADAdministrators_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorResource.cs index 1072d6b521dcb..dc2fe0b73ed5d 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerAadAdministratorResource.cs @@ -23,7 +23,7 @@ public partial class Sample_MySqlFlexibleServerAadAdministratorResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateAnAzureAdAdministrator() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorCreate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorCreate.json // this example is just showing the usage of "AzureADAdministrators_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -64,7 +64,7 @@ public async Task Update_CreateAnAzureAdAdministrator() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAnAzureAdAdministrator() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorDelete.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorDelete.json // this example is just showing the usage of "AzureADAdministrators_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,7 +92,7 @@ public async Task Delete_DeleteAnAzureAdAdministrator() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAnAzureAdAdministrator() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2023-06-01-preview/examples/AzureADAdministratorGet.json // this example is just showing the usage of "AzureADAdministrators_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupCollection.cs index 1620be0cfdf71..b4b39537c4629 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_MySqlFlexibleServerBackupCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateBackupForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupPut.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/BackupPut.json // this example is just showing the usage of "Backups_Put" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +58,7 @@ public async Task CreateOrUpdate_CreateBackupForAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetABackupForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/BackupGet.json // this example is just showing the usage of "Backups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task Get_GetABackupForAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetABackupForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/BackupGet.json // this example is just showing the usage of "Backups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -124,7 +124,7 @@ public async Task Exists_GetABackupForAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetABackupForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/BackupGet.json // this example is just showing the usage of "Backups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -167,7 +167,7 @@ public async Task GetIfExists_GetABackupForAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListBackupsForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupsListByServer.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/BackupsListByServer.json // this example is just showing the usage of "Backups_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupResource.cs index 8515953a9fec7..5c4729df6efae 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerBackupResource.cs @@ -22,7 +22,7 @@ public partial class Sample_MySqlFlexibleServerBackupResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateBackupForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupPut.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/BackupPut.json // this example is just showing the usage of "Backups_Put" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Update_CreateBackupForAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetABackupForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/BackupGet.json // this example is just showing the usage of "Backups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerCollection.cs index 12382964233f1..6fc4f529f1677 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerCollection.cs @@ -25,7 +25,7 @@ public partial class Sample_MySqlFlexibleServerCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateANewServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerCreate.json // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task CreateOrUpdate_CreateANewServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAReplicaServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateReplica.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerCreateReplica.json // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -129,7 +129,7 @@ public async Task CreateOrUpdate_CreateAReplicaServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAServerAsAPointInTimeRestore() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateWithPointInTimeRestore.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerCreateWithPointInTimeRestore.json // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -175,7 +175,7 @@ public async Task CreateOrUpdate_CreateAServerAsAPointInTimeRestore() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAServerWithByok() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateWithBYOK.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerCreateWithBYOK.json // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -254,7 +254,7 @@ public async Task CreateOrUpdate_CreateAServerWithByok() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerGet.json // this example is just showing the usage of "Servers_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -288,7 +288,7 @@ public async Task Get_GetAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerGet.json // this example is just showing the usage of "Servers_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -318,7 +318,7 @@ public async Task Exists_GetAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerGet.json // this example is just showing the usage of "Servers_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -360,7 +360,7 @@ public async Task GetIfExists_GetAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAServerWithVnet() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGetWithVnet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerGetWithVnet.json // this example is just showing the usage of "Servers_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -394,7 +394,7 @@ public async Task Get_GetAServerWithVnet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAServerWithVnet() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGetWithVnet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerGetWithVnet.json // this example is just showing the usage of "Servers_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -424,7 +424,7 @@ public async Task Exists_GetAServerWithVnet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAServerWithVnet() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGetWithVnet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerGetWithVnet.json // this example is just showing the usage of "Servers_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -466,7 +466,7 @@ public async Task GetIfExists_GetAServerWithVnet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListServersInAResourceGroup() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServersListByResourceGroup.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServersListByResourceGroup.json // this example is just showing the usage of "Servers_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -502,7 +502,7 @@ public async Task GetAll_ListServersInAResourceGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReplicas_ListReplicasForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ReplicasListByServer.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ReplicasListByServer.json // this example is just showing the usage of "Replicas_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationCollection.cs index 65483dece9dd9..c0677beb54ebd 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_MySqlFlexibleServerConfigurationCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ConfigurationCreateOrUpdate() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationCreateOrUpdate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationCreateOrUpdate.json // this example is just showing the usage of "Configurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -64,7 +64,7 @@ public async Task CreateOrUpdate_ConfigurationCreateOrUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAConfiguration() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationGet.json // this example is just showing the usage of "Configurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -99,7 +99,7 @@ public async Task Get_GetAConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAConfiguration() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationGet.json // this example is just showing the usage of "Configurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -130,7 +130,7 @@ public async Task Exists_GetAConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAConfiguration() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationGet.json // this example is just showing the usage of "Configurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -173,7 +173,7 @@ public async Task GetIfExists_GetAConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAllConfigurationsForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationsListByServer.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationsListByServer.json // this example is just showing the usage of "Configurations_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationResource.cs index 86d7c721f9a83..ee888b621a932 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerConfigurationResource.cs @@ -23,7 +23,7 @@ public partial class Sample_MySqlFlexibleServerConfigurationResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateAUserConfiguration() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationUpdate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationUpdate.json // this example is just showing the usage of "Configurations_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -61,7 +61,7 @@ public async Task Update_UpdateAUserConfiguration() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAConfiguration() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationGet.json // this example is just showing the usage of "Configurations_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseCollection.cs index e47d07ab56237..44e87f1dea542 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_MySqlFlexibleServerDatabaseCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateADatabase() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseCreate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseCreate.json // this example is just showing the usage of "Databases_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -63,7 +63,7 @@ public async Task CreateOrUpdate_CreateADatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetADatabase() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseGet.json // this example is just showing the usage of "Databases_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -98,7 +98,7 @@ public async Task Get_GetADatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetADatabase() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseGet.json // this example is just showing the usage of "Databases_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -129,7 +129,7 @@ public async Task Exists_GetADatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetADatabase() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseGet.json // this example is just showing the usage of "Databases_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -172,7 +172,7 @@ public async Task GetIfExists_GetADatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListDatabasesInAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabasesListByServer.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabasesListByServer.json // this example is just showing the usage of "Databases_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseResource.cs index 4a55e131230eb..f1239e893596d 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerDatabaseResource.cs @@ -22,7 +22,7 @@ public partial class Sample_MySqlFlexibleServerDatabaseResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateADatabase() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseCreate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseCreate.json // this example is just showing the usage of "Databases_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task Update_CreateADatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteADatabase() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseDelete.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseDelete.json // this example is just showing the usage of "Databases_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task Delete_DeleteADatabase() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetADatabase() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2023-06-01-preview/examples/DatabaseGet.json // this example is just showing the usage of "Databases_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleCollection.cs index ab0d6b9c34c00..a088d1b2bde00 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleCollection.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_MySqlFlexibleServerFirewallRuleCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAFirewallRule() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleCreate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleCreate.json // this example is just showing the usage of "FirewallRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task CreateOrUpdate_CreateAFirewallRule() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAFirewallRule() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleGet.json // this example is just showing the usage of "FirewallRules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task Get_GetAFirewallRule() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAFirewallRule() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleGet.json // this example is just showing the usage of "FirewallRules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +126,7 @@ public async Task Exists_GetAFirewallRule() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAFirewallRule() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleGet.json // this example is just showing the usage of "FirewallRules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +169,7 @@ public async Task GetIfExists_GetAFirewallRule() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAllFirewallRulesInAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRulesListByServer.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRulesListByServer.json // this example is just showing the usage of "FirewallRules_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleResource.cs index b2def82c4b678..57b5b4168a223 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerFirewallRuleResource.cs @@ -23,7 +23,7 @@ public partial class Sample_MySqlFlexibleServerFirewallRuleResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateAFirewallRule() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleCreate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleCreate.json // this example is just showing the usage of "FirewallRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task Update_CreateAFirewallRule() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAFirewallRule() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleDelete.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleDelete.json // this example is just showing the usage of "FirewallRules_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -85,7 +85,7 @@ public async Task Delete_DeleteAFirewallRule() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAFirewallRule() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2023-06-01-preview/examples/FirewallRuleGet.json // this example is just showing the usage of "FirewallRules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerResource.cs index 0beb0ec80572b..be7f19e9e1305 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServerResource.cs @@ -25,7 +25,7 @@ public partial class Sample_MySqlFlexibleServerResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateBackupAndExport_CreateAndExportBackup() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupAndExport.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/BackupAndExport.json // this example is just showing the usage of "BackupAndExport_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task CreateBackupAndExport_CreateAndExportBackup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ValidateBackup_ValidateBackup() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/ValidateBackup.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2023-06-01-preview/examples/ValidateBackup.json // this example is just showing the usage of "BackupAndExport_ValidateBackup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -84,7 +84,7 @@ public async Task ValidateBackup_ValidateBackup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task UpdateConfigurations_ConfigurationList() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationsBatchUpdate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2023-06-01-preview/examples/ConfigurationsBatchUpdate.json // this example is just showing the usage of "Configurations_BatchUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -128,7 +128,7 @@ public async Task UpdateConfigurations_ConfigurationList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdate.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerUpdate.json // this example is just showing the usage of "Servers_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -154,6 +154,10 @@ public async Task Update_UpdateAServer() AutoGrow = MySqlFlexibleServerEnableStatusEnum.Disabled, AutoIoScaling = MySqlFlexibleServerEnableStatusEnum.Disabled, }, + Network = new MySqlFlexibleServerNetwork() + { + PublicNetworkAccess = MySqlFlexibleServerEnableStatusEnum.Disabled, + }, }; ArmOperation lro = await mySqlFlexibleServer.UpdateAsync(WaitUntil.Completed, patch); MySqlFlexibleServerResource result = lro.Value; @@ -170,7 +174,7 @@ public async Task Update_UpdateAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateServerCustomerMaintenanceWindow() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json // this example is just showing the usage of "Servers_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -212,7 +216,7 @@ public async Task Update_UpdateServerCustomerMaintenanceWindow() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateServerWithByok() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdateWithBYOK.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerUpdateWithBYOK.json // this example is just showing the usage of "Servers_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -262,7 +266,7 @@ public async Task Update_UpdateServerWithByok() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerDelete.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerDelete.json // this example is just showing the usage of "Servers_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -289,7 +293,7 @@ public async Task Delete_DeleteAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerGet.json // this example is just showing the usage of "Servers_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -320,7 +324,7 @@ public async Task Get_GetAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAServerWithVnet() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGetWithVnet.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerGetWithVnet.json // this example is just showing the usage of "Servers_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -351,7 +355,7 @@ public async Task Get_GetAServerWithVnet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetMySqlFlexibleServers_ListServersInASubscription() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServersList.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServersList.json // this example is just showing the usage of "Servers_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -383,7 +387,7 @@ public async Task GetMySqlFlexibleServers_ListServersInASubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Failover_RestartAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerFailover.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerFailover.json // this example is just showing the usage of "Servers_Failover" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -410,7 +414,7 @@ public async Task Failover_RestartAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Restart_RestartAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerRestart.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerRestart.json // this example is just showing the usage of "Servers_Restart" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -442,7 +446,7 @@ public async Task Restart_RestartAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Start_StartAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerStart.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerStart.json // this example is just showing the usage of "Servers_Start" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -469,7 +473,7 @@ public async Task Start_StartAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Stop_StopAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerStop.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerStop.json // this example is just showing the usage of "Servers_Stop" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -496,7 +500,7 @@ public async Task Stop_StopAServer() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ResetGtid_ResetGTIDOnAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerResetGtid.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/ServerResetGtid.json // this example is just showing the usage of "Servers_ResetGtid" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -522,12 +526,44 @@ public async Task ResetGtid_ResetGTIDOnAServer() Console.WriteLine($"Succeeded"); } + // Cutover migration for MySQL import + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CutoverMigrationServersMigration_CutoverMigrationForMySQLImport() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2023-06-01-preview/examples/CutoverMigration.json + // this example is just showing the usage of "ServersMigration_CutoverMigration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MySqlFlexibleServerResource created on azure + // for more information of creating MySqlFlexibleServerResource, please refer to the document of MySqlFlexibleServerResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "testrg"; + string serverName = "mysqltestserver"; + ResourceIdentifier mySqlFlexibleServerResourceId = MySqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName); + MySqlFlexibleServerResource mySqlFlexibleServer = client.GetMySqlFlexibleServerResource(mySqlFlexibleServerResourceId); + + // invoke the operation + ArmOperation lro = await mySqlFlexibleServer.CutoverMigrationServersMigrationAsync(WaitUntil.Completed); + MySqlFlexibleServerResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MySqlFlexibleServerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // List all server log files for a server [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetLogFiles_ListAllServerLogFilesForAServer() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/LogFiles/preview/2021-12-01-preview/examples/LogFilesListByServer.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/LogFiles/preview/2023-06-01-preview/examples/LogFilesListByServer.json // this example is just showing the usage of "LogFiles_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServersCapabilityCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServersCapabilityCollection.cs new file mode 100644 index 0000000000000..bb5ceaff3652d --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServersCapabilityCollection.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.MySql.FlexibleServers; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Samples +{ + public partial class Sample_MySqlFlexibleServersCapabilityCollection + { + // CapabilitySetsResult + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_CapabilitySetsResult() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CapabilitySetListByLocation.json + // this example is just showing the usage of "LocationBasedCapabilitySet_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this MySqlFlexibleServersCapabilityResource + AzureLocation locationName = new AzureLocation("WestUS"); + MySqlFlexibleServersCapabilityCollection collection = subscriptionResource.GetMySqlFlexibleServersCapabilities(locationName); + + // invoke the operation and iterate over the result + await foreach (MySqlFlexibleServersCapabilityResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MySqlFlexibleServersCapabilityData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // CapabilityResult + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CapabilityResult() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CapabilitySetByLocation.json + // this example is just showing the usage of "LocationBasedCapabilitySet_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this MySqlFlexibleServersCapabilityResource + AzureLocation locationName = new AzureLocation("WestUS"); + MySqlFlexibleServersCapabilityCollection collection = subscriptionResource.GetMySqlFlexibleServersCapabilities(locationName); + + // invoke the operation + string capabilitySetName = "default"; + MySqlFlexibleServersCapabilityResource result = await collection.GetAsync(capabilitySetName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MySqlFlexibleServersCapabilityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CapabilityResult + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_CapabilityResult() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CapabilitySetByLocation.json + // this example is just showing the usage of "LocationBasedCapabilitySet_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this MySqlFlexibleServersCapabilityResource + AzureLocation locationName = new AzureLocation("WestUS"); + MySqlFlexibleServersCapabilityCollection collection = subscriptionResource.GetMySqlFlexibleServersCapabilities(locationName); + + // invoke the operation + string capabilitySetName = "default"; + bool result = await collection.ExistsAsync(capabilitySetName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // CapabilityResult + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_CapabilityResult() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CapabilitySetByLocation.json + // this example is just showing the usage of "LocationBasedCapabilitySet_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this MySqlFlexibleServersCapabilityResource + AzureLocation locationName = new AzureLocation("WestUS"); + MySqlFlexibleServersCapabilityCollection collection = subscriptionResource.GetMySqlFlexibleServersCapabilities(locationName); + + // invoke the operation + string capabilitySetName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(capabilitySetName); + MySqlFlexibleServersCapabilityResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MySqlFlexibleServersCapabilityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServersCapabilityResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServersCapabilityResource.cs new file mode 100644 index 0000000000000..1b7bcbb72afb1 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_MySqlFlexibleServersCapabilityResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.MySql.FlexibleServers; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Samples +{ + public partial class Sample_MySqlFlexibleServersCapabilityResource + { + // CapabilityResult + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_CapabilityResult() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CapabilitySetByLocation.json + // this example is just showing the usage of "LocationBasedCapabilitySet_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MySqlFlexibleServersCapabilityResource created on azure + // for more information of creating MySqlFlexibleServersCapabilityResource, please refer to the document of MySqlFlexibleServersCapabilityResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + AzureLocation locationName = new AzureLocation("WestUS"); + string capabilitySetName = "default"; + ResourceIdentifier mySqlFlexibleServersCapabilityResourceId = MySqlFlexibleServersCapabilityResource.CreateResourceIdentifier(subscriptionId, locationName, capabilitySetName); + MySqlFlexibleServersCapabilityResource mySqlFlexibleServersCapability = client.GetMySqlFlexibleServersCapabilityResource(mySqlFlexibleServersCapabilityResourceId); + + // invoke the operation + MySqlFlexibleServersCapabilityResource result = await mySqlFlexibleServersCapability.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MySqlFlexibleServersCapabilityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 6a27c7b794bf6..121cbbd6532f4 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_SubscriptionResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetLocationBasedCapabilities_CapabilitiesList() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CapabilitiesByLocationList.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CapabilitiesByLocationList.json // this example is just showing the usage of "LocationBasedCapabilities_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task GetLocationBasedCapabilities_CapabilitiesList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ExecuteCheckVirtualNetworkSubnetUsage_CheckVirtualNetworkSubnetUsage() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckVirtualNetworkSubnetUsage.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CheckVirtualNetworkSubnetUsage.json // this example is just showing the usage of "CheckVirtualNetworkSubnetUsage_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,7 +82,7 @@ public async Task ExecuteCheckVirtualNetworkSubnetUsage_CheckVirtualNetworkSubne [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckMySqlFlexibleServerNameAvailability_CheckNameAvailability() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckNameAvailability.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CheckNameAvailability.json // this example is just showing the usage of "CheckNameAvailability_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -112,7 +112,7 @@ public async Task CheckMySqlFlexibleServerNameAvailability_CheckNameAvailability [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckMySqlFlexibleServerNameAvailabilityWithoutLocation_CheckNameAvailability() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckNameAvailability.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/CheckNameAvailability.json // this example is just showing the usage of "CheckNameAvailabilityWithoutLocation_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -135,5 +135,32 @@ public async Task CheckMySqlFlexibleServerNameAvailabilityWithoutLocation_CheckN Console.WriteLine($"Succeeded: {result}"); } + + // OperationResults_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetOperationResult_OperationResultsGet() + { + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/OperationResults_Get.json + // this example is just showing the usage of "OperationResults_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "11111111-2222-3333-4444-555555555555"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + AzureLocation locationName = new AzureLocation("westus"); + string operationId = "resource-provisioning-id-farmBeatsResourceName"; + OperationStatusExtendedResult result = await subscriptionResource.GetOperationResultAsync(locationName, operationId); + + Console.WriteLine($"Succeeded: {result}"); + } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_TenantResourceExtensions.cs index 27c8a94ad31b2..da712bac235dd 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_TenantResourceExtensions.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/samples/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -22,7 +22,7 @@ public partial class Sample_TenantResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ExecuteGetPrivateDnsZoneSuffix_GetPrivateDnsZoneSuffix() { - // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/GetPrivateDnsZoneSuffix.json + // Generated from example definition: specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2023-06-01-preview/examples/GetPrivateDnsZoneSuffix.json // this example is just showing the usage of "GetPrivateDnsZoneSuffix_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlArmClient.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlArmClient.cs new file mode 100644 index 0000000000000..dbfea3abc5c83 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlArmClient.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MySql; + +namespace Azure.ResourceManager.MySql.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMySqlArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMySqlArmClient() + { + } + + /// 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 MockableMySqlArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMySqlArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlServerResource GetMySqlServerResource(ResourceIdentifier id) + { + MySqlServerResource.ValidateResourceId(id); + return new MySqlServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlFirewallRuleResource GetMySqlFirewallRuleResource(ResourceIdentifier id) + { + MySqlFirewallRuleResource.ValidateResourceId(id); + return new MySqlFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlVirtualNetworkRuleResource GetMySqlVirtualNetworkRuleResource(ResourceIdentifier id) + { + MySqlVirtualNetworkRuleResource.ValidateResourceId(id); + return new MySqlVirtualNetworkRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlDatabaseResource GetMySqlDatabaseResource(ResourceIdentifier id) + { + MySqlDatabaseResource.ValidateResourceId(id); + return new MySqlDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlConfigurationResource GetMySqlConfigurationResource(ResourceIdentifier id) + { + MySqlConfigurationResource.ValidateResourceId(id); + return new MySqlConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlServerAdministratorResource GetMySqlServerAdministratorResource(ResourceIdentifier id) + { + MySqlServerAdministratorResource.ValidateResourceId(id); + return new MySqlServerAdministratorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlServerSecurityAlertPolicyResource GetMySqlServerSecurityAlertPolicyResource(ResourceIdentifier id) + { + MySqlServerSecurityAlertPolicyResource.ValidateResourceId(id); + return new MySqlServerSecurityAlertPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlQueryTextResource GetMySqlQueryTextResource(ResourceIdentifier id) + { + MySqlQueryTextResource.ValidateResourceId(id); + return new MySqlQueryTextResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlQueryStatisticResource GetMySqlQueryStatisticResource(ResourceIdentifier id) + { + MySqlQueryStatisticResource.ValidateResourceId(id); + return new MySqlQueryStatisticResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlWaitStatisticResource GetMySqlWaitStatisticResource(ResourceIdentifier id) + { + MySqlWaitStatisticResource.ValidateResourceId(id); + return new MySqlWaitStatisticResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlAdvisorResource GetMySqlAdvisorResource(ResourceIdentifier id) + { + MySqlAdvisorResource.ValidateResourceId(id); + return new MySqlAdvisorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlRecommendationActionResource GetMySqlRecommendationActionResource(ResourceIdentifier id) + { + MySqlRecommendationActionResource.ValidateResourceId(id); + return new MySqlRecommendationActionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlPrivateEndpointConnectionResource GetMySqlPrivateEndpointConnectionResource(ResourceIdentifier id) + { + MySqlPrivateEndpointConnectionResource.ValidateResourceId(id); + return new MySqlPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlPrivateLinkResource GetMySqlPrivateLinkResource(ResourceIdentifier id) + { + MySqlPrivateLinkResource.ValidateResourceId(id); + return new MySqlPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlServerKeyResource GetMySqlServerKeyResource(ResourceIdentifier id) + { + MySqlServerKeyResource.ValidateResourceId(id); + return new MySqlServerKeyResource(Client, id); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlResourceGroupResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlResourceGroupResource.cs new file mode 100644 index 0000000000000..a17aaf4a1514b --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.MySql; + +namespace Azure.ResourceManager.MySql.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMySqlResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMySqlResourceGroupResource() + { + } + + /// 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 MockableMySqlResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MySqlServerResources in the ResourceGroupResource. + /// An object representing collection of MySqlServerResources and their operations over a MySqlServerResource. + public virtual MySqlServerCollection GetMySqlServers() + { + return GetCachedClient(client => new MySqlServerCollection(client, Id)); + } + + /// + /// Gets information about a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMySqlServerAsync(string serverName, CancellationToken cancellationToken = default) + { + return await GetMySqlServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMySqlServer(string serverName, CancellationToken cancellationToken = default) + { + return GetMySqlServers().Get(serverName, cancellationToken); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlSubscriptionResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlSubscriptionResource.cs new file mode 100644 index 0000000000000..914107d5bf382 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MockableMySqlSubscriptionResource.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.MySql; +using Azure.ResourceManager.MySql.Models; + +namespace Azure.ResourceManager.MySql.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMySqlSubscriptionResource : ArmResource + { + private ClientDiagnostics _mySqlServerServersClientDiagnostics; + private ServersRestOperations _mySqlServerServersRestClient; + private ClientDiagnostics _locationBasedPerformanceTierClientDiagnostics; + private LocationBasedPerformanceTierRestOperations _locationBasedPerformanceTierRestClient; + private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; + private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMySqlSubscriptionResource() + { + } + + /// 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 MockableMySqlSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MySqlServerServersClientDiagnostics => _mySqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql", MySqlServerResource.ResourceType.Namespace, Diagnostics); + private ServersRestOperations MySqlServerServersRestClient => _mySqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MySqlServerResource.ResourceType)); + private ClientDiagnostics LocationBasedPerformanceTierClientDiagnostics => _locationBasedPerformanceTierClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationBasedPerformanceTierRestOperations LocationBasedPerformanceTierRestClient => _locationBasedPerformanceTierRestClient ??= new LocationBasedPerformanceTierRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMySqlServersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MySqlServerServersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MySqlServerResource(Client, MySqlServerData.DeserializeMySqlServerData(e)), MySqlServerServersClientDiagnostics, Pipeline, "MockableMySqlSubscriptionResource.GetMySqlServers", "value", null, cancellationToken); + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMySqlServers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MySqlServerServersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MySqlServerResource(Client, MySqlServerData.DeserializeMySqlServerData(e)), MySqlServerServersClientDiagnostics, Pipeline, "MockableMySqlSubscriptionResource.GetMySqlServers", "value", null, cancellationToken); + } + + /// + /// List all the performance tiers at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/performanceTiers + /// + /// + /// Operation Id + /// LocationBasedPerformanceTier_List + /// + /// + /// + /// The name of the location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLocationBasedPerformanceTiersAsync(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedPerformanceTierRestClient.CreateListRequest(Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MySqlPerformanceTier.DeserializeMySqlPerformanceTier, LocationBasedPerformanceTierClientDiagnostics, Pipeline, "MockableMySqlSubscriptionResource.GetLocationBasedPerformanceTiers", "value", null, cancellationToken); + } + + /// + /// List all the performance tiers at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/performanceTiers + /// + /// + /// Operation Id + /// LocationBasedPerformanceTier_List + /// + /// + /// + /// The name of the location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLocationBasedPerformanceTiers(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedPerformanceTierRestClient.CreateListRequest(Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MySqlPerformanceTier.DeserializeMySqlPerformanceTier, LocationBasedPerformanceTierClientDiagnostics, Pipeline, "MockableMySqlSubscriptionResource.GetLocationBasedPerformanceTiers", "value", null, cancellationToken); + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckMySqlNameAvailabilityAsync(MySqlNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockableMySqlSubscriptionResource.CheckMySqlNameAvailability"); + scope.Start(); + try + { + var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual Response CheckMySqlNameAvailability(MySqlNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockableMySqlSubscriptionResource.CheckMySqlNameAvailability"); + scope.Start(); + try + { + var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MySqlExtensions.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MySqlExtensions.cs index 965ad5854da7e..1ce19828fde88 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MySqlExtensions.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/MySqlExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.MySql.Mocking; using Azure.ResourceManager.MySql.Models; using Azure.ResourceManager.Resources; @@ -19,328 +20,273 @@ namespace Azure.ResourceManager.MySql /// A class to add extension methods to Azure.ResourceManager.MySql. public static partial class MySqlExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMySqlArmClient GetMockableMySqlArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMySqlArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMySqlResourceGroupResource GetMockableMySqlResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMySqlResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMySqlSubscriptionResource GetMockableMySqlSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMySqlSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region MySqlServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlServerResource GetMySqlServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlServerResource.ValidateResourceId(id); - return new MySqlServerResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlServerResource(id); } - #endregion - #region MySqlFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlFirewallRuleResource GetMySqlFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlFirewallRuleResource.ValidateResourceId(id); - return new MySqlFirewallRuleResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlFirewallRuleResource(id); } - #endregion - #region MySqlVirtualNetworkRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlVirtualNetworkRuleResource GetMySqlVirtualNetworkRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlVirtualNetworkRuleResource.ValidateResourceId(id); - return new MySqlVirtualNetworkRuleResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlVirtualNetworkRuleResource(id); } - #endregion - #region MySqlDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlDatabaseResource GetMySqlDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlDatabaseResource.ValidateResourceId(id); - return new MySqlDatabaseResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlDatabaseResource(id); } - #endregion - #region MySqlConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlConfigurationResource GetMySqlConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlConfigurationResource.ValidateResourceId(id); - return new MySqlConfigurationResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlConfigurationResource(id); } - #endregion - #region MySqlServerAdministratorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlServerAdministratorResource GetMySqlServerAdministratorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlServerAdministratorResource.ValidateResourceId(id); - return new MySqlServerAdministratorResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlServerAdministratorResource(id); } - #endregion - #region MySqlServerSecurityAlertPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlServerSecurityAlertPolicyResource GetMySqlServerSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlServerSecurityAlertPolicyResource.ValidateResourceId(id); - return new MySqlServerSecurityAlertPolicyResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlServerSecurityAlertPolicyResource(id); } - #endregion - #region MySqlQueryTextResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlQueryTextResource GetMySqlQueryTextResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlQueryTextResource.ValidateResourceId(id); - return new MySqlQueryTextResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlQueryTextResource(id); } - #endregion - #region MySqlQueryStatisticResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlQueryStatisticResource GetMySqlQueryStatisticResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlQueryStatisticResource.ValidateResourceId(id); - return new MySqlQueryStatisticResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlQueryStatisticResource(id); } - #endregion - #region MySqlWaitStatisticResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlWaitStatisticResource GetMySqlWaitStatisticResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlWaitStatisticResource.ValidateResourceId(id); - return new MySqlWaitStatisticResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlWaitStatisticResource(id); } - #endregion - #region MySqlAdvisorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlAdvisorResource GetMySqlAdvisorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlAdvisorResource.ValidateResourceId(id); - return new MySqlAdvisorResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlAdvisorResource(id); } - #endregion - #region MySqlRecommendationActionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlRecommendationActionResource GetMySqlRecommendationActionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlRecommendationActionResource.ValidateResourceId(id); - return new MySqlRecommendationActionResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlRecommendationActionResource(id); } - #endregion - #region MySqlPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlPrivateEndpointConnectionResource GetMySqlPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlPrivateEndpointConnectionResource.ValidateResourceId(id); - return new MySqlPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlPrivateEndpointConnectionResource(id); } - #endregion - #region MySqlPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlPrivateLinkResource GetMySqlPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlPrivateLinkResource.ValidateResourceId(id); - return new MySqlPrivateLinkResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlPrivateLinkResource(id); } - #endregion - #region MySqlServerKeyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlServerKeyResource GetMySqlServerKeyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlServerKeyResource.ValidateResourceId(id); - return new MySqlServerKeyResource(client, id); - } - ); + return GetMockableMySqlArmClient(client).GetMySqlServerKeyResource(id); } - #endregion - /// Gets a collection of MySqlServerResources in the ResourceGroupResource. + /// + /// Gets a collection of MySqlServerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MySqlServerResources and their operations over a MySqlServerResource. public static MySqlServerCollection GetMySqlServers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMySqlServers(); + return GetMockableMySqlResourceGroupResource(resourceGroupResource).GetMySqlServers(); } /// @@ -355,16 +301,20 @@ public static MySqlServerCollection GetMySqlServers(this ResourceGroupResource r /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMySqlServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMySqlServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + return await GetMockableMySqlResourceGroupResource(resourceGroupResource).GetMySqlServerAsync(serverName, cancellationToken).ConfigureAwait(false); } /// @@ -379,16 +329,20 @@ public static async Task> GetMySqlServerAsync(this /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMySqlServer(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMySqlServers().Get(serverName, cancellationToken); + return GetMockableMySqlResourceGroupResource(resourceGroupResource).GetMySqlServer(serverName, cancellationToken); } /// @@ -403,13 +357,17 @@ public static Response GetMySqlServer(this ResourceGroupRes /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMySqlServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMySqlServersAsync(cancellationToken); + return GetMockableMySqlSubscriptionResource(subscriptionResource).GetMySqlServersAsync(cancellationToken); } /// @@ -424,13 +382,17 @@ public static AsyncPageable GetMySqlServersAsync(this Subsc /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMySqlServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMySqlServers(cancellationToken); + return GetMockableMySqlSubscriptionResource(subscriptionResource).GetMySqlServers(cancellationToken); } /// @@ -445,6 +407,10 @@ public static Pageable GetMySqlServers(this SubscriptionRes /// LocationBasedPerformanceTier_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -452,7 +418,7 @@ public static Pageable GetMySqlServers(this SubscriptionRes /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLocationBasedPerformanceTiersAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLocationBasedPerformanceTiersAsync(locationName, cancellationToken); + return GetMockableMySqlSubscriptionResource(subscriptionResource).GetLocationBasedPerformanceTiersAsync(locationName, cancellationToken); } /// @@ -467,6 +433,10 @@ public static AsyncPageable GetLocationBasedPerformanceTie /// LocationBasedPerformanceTier_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -474,7 +444,7 @@ public static AsyncPageable GetLocationBasedPerformanceTie /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLocationBasedPerformanceTiers(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLocationBasedPerformanceTiers(locationName, cancellationToken); + return GetMockableMySqlSubscriptionResource(subscriptionResource).GetLocationBasedPerformanceTiers(locationName, cancellationToken); } /// @@ -489,6 +459,10 @@ public static Pageable GetLocationBasedPerformanceTiers(th /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if resource name is available. @@ -496,9 +470,7 @@ public static Pageable GetLocationBasedPerformanceTiers(th /// is null. public static async Task> CheckMySqlNameAvailabilityAsync(this SubscriptionResource subscriptionResource, MySqlNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMySqlNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableMySqlSubscriptionResource(subscriptionResource).CheckMySqlNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -513,6 +485,10 @@ public static async Task> CheckMySqlNameAv /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if resource name is available. @@ -520,9 +496,7 @@ public static async Task> CheckMySqlNameAv /// is null. public static Response CheckMySqlNameAvailability(this SubscriptionResource subscriptionResource, MySqlNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMySqlNameAvailability(content, cancellationToken); + return GetMockableMySqlSubscriptionResource(subscriptionResource).CheckMySqlNameAvailability(content, cancellationToken); } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 9a81738317f0a..0000000000000 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MySql -{ - /// 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 MySqlServerResources in the ResourceGroupResource. - /// An object representing collection of MySqlServerResources and their operations over a MySqlServerResource. - public virtual MySqlServerCollection GetMySqlServers() - { - return GetCachedClient(Client => new MySqlServerCollection(Client, Id)); - } - } -} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 60cfe673105a9..0000000000000 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.MySql.Models; - -namespace Azure.ResourceManager.MySql -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _mySqlServerServersClientDiagnostics; - private ServersRestOperations _mySqlServerServersRestClient; - private ClientDiagnostics _locationBasedPerformanceTierClientDiagnostics; - private LocationBasedPerformanceTierRestOperations _locationBasedPerformanceTierRestClient; - private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; - private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; - - /// 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 MySqlServerServersClientDiagnostics => _mySqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql", MySqlServerResource.ResourceType.Namespace, Diagnostics); - private ServersRestOperations MySqlServerServersRestClient => _mySqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MySqlServerResource.ResourceType)); - private ClientDiagnostics LocationBasedPerformanceTierClientDiagnostics => _locationBasedPerformanceTierClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationBasedPerformanceTierRestOperations LocationBasedPerformanceTierRestClient => _locationBasedPerformanceTierRestClient ??= new LocationBasedPerformanceTierRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the servers in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMySqlServersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MySqlServerServersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MySqlServerResource(Client, MySqlServerData.DeserializeMySqlServerData(e)), MySqlServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMySqlServers", "value", null, cancellationToken); - } - - /// - /// List all the servers in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMySqlServers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MySqlServerServersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new MySqlServerResource(Client, MySqlServerData.DeserializeMySqlServerData(e)), MySqlServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMySqlServers", "value", null, cancellationToken); - } - - /// - /// List all the performance tiers at specified location in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/performanceTiers - /// - /// - /// Operation Id - /// LocationBasedPerformanceTier_List - /// - /// - /// - /// The name of the location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLocationBasedPerformanceTiersAsync(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedPerformanceTierRestClient.CreateListRequest(Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MySqlPerformanceTier.DeserializeMySqlPerformanceTier, LocationBasedPerformanceTierClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLocationBasedPerformanceTiers", "value", null, cancellationToken); - } - - /// - /// List all the performance tiers at specified location in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/performanceTiers - /// - /// - /// Operation Id - /// LocationBasedPerformanceTier_List - /// - /// - /// - /// The name of the location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLocationBasedPerformanceTiers(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedPerformanceTierRestClient.CreateListRequest(Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MySqlPerformanceTier.DeserializeMySqlPerformanceTier, LocationBasedPerformanceTierClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLocationBasedPerformanceTiers", "value", null, cancellationToken); - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual async Task> CheckMySqlNameAvailabilityAsync(MySqlNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMySqlNameAvailability"); - scope.Start(); - try - { - var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual Response CheckMySqlNameAvailability(MySqlNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMySqlNameAvailability"); - scope.Start(); - try - { - var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorResource.cs index baa2ac6fe5023..dd8acbe2e29cb 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlAdvisorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The advisorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string advisorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}"; @@ -94,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MySqlRecommendationActionResources and their operations over a MySqlRecommendationActionResource. public virtual MySqlRecommendationActionCollection GetMySqlRecommendationActions() { - return GetCachedClient(Client => new MySqlRecommendationActionCollection(Client, Id)); + return GetCachedClient(client => new MySqlRecommendationActionCollection(client, Id)); } /// @@ -112,8 +116,8 @@ public virtual MySqlRecommendationActionCollection GetMySqlRecommendationActions /// /// The recommended action name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlRecommendationActionAsync(string recommendedActionName, CancellationToken cancellationToken = default) { @@ -135,8 +139,8 @@ public virtual async Task> GetMySqlR /// /// The recommended action name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlRecommendationAction(string recommendedActionName, CancellationToken cancellationToken = default) { diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationResource.cs index 055f21e45cb7a..83a6e527f7712 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseResource.cs index b0ea190cc0e0c..b004d862de151 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlDatabaseResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/databases/{databaseName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleResource.cs index 5835317d3c863..4bcba8c9f104a 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionResource.cs index b84c7be41b589..2c9a79616e7fc 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResource.cs index 75be7a89f1521..dba63b49a37c0 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateLinkResources/{groupName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticResource.cs index 5b51a1e9a2f58..8e385e93c4fdb 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryStatisticResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlQueryStatisticResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The queryStatisticId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string queryStatisticId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/topQueryStatistics/{queryStatisticId}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextResource.cs index b8a024d7e8ac7..4a439cda662a0 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlQueryTextResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlQueryTextResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The queryId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string queryId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/queryTexts/{queryId}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionResource.cs index a42afd53141d8..ff466ff248c3e 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlRecommendationActionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.MySql public partial class MySqlRecommendationActionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The advisorName. + /// The recommendedActionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string advisorName, string recommendedActionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorResource.cs index 62865c3a9159d..4e4e7ab566931 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerAdministratorResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.MySql public partial class MySqlServerAdministratorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/administrators/activeDirectory"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyResource.cs index 00f061ac701bd..30721769d2cc1 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerKeyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlServerKeyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The keyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string keyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys/{keyName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerResource.cs index 1797d88ba7200..a52dcaec379e7 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.MySql public partial class MySqlServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}"; @@ -118,7 +121,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MySqlFirewallRuleResources and their operations over a MySqlFirewallRuleResource. public virtual MySqlFirewallRuleCollection GetMySqlFirewallRules() { - return GetCachedClient(Client => new MySqlFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new MySqlFirewallRuleCollection(client, Id)); } /// @@ -136,8 +139,8 @@ public virtual MySqlFirewallRuleCollection GetMySqlFirewallRules() /// /// The name of the server firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -159,8 +162,8 @@ public virtual async Task> GetMySqlFirewallR /// /// The name of the server firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -171,7 +174,7 @@ public virtual Response GetMySqlFirewallRule(string f /// An object representing collection of MySqlVirtualNetworkRuleResources and their operations over a MySqlVirtualNetworkRuleResource. public virtual MySqlVirtualNetworkRuleCollection GetMySqlVirtualNetworkRules() { - return GetCachedClient(Client => new MySqlVirtualNetworkRuleCollection(Client, Id)); + return GetCachedClient(client => new MySqlVirtualNetworkRuleCollection(client, Id)); } /// @@ -189,8 +192,8 @@ public virtual MySqlVirtualNetworkRuleCollection GetMySqlVirtualNetworkRules() /// /// The name of the virtual network rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlVirtualNetworkRuleAsync(string virtualNetworkRuleName, CancellationToken cancellationToken = default) { @@ -212,8 +215,8 @@ public virtual async Task> GetMySqlVir /// /// The name of the virtual network rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlVirtualNetworkRule(string virtualNetworkRuleName, CancellationToken cancellationToken = default) { @@ -224,7 +227,7 @@ public virtual Response GetMySqlVirtualNetworkR /// An object representing collection of MySqlDatabaseResources and their operations over a MySqlDatabaseResource. public virtual MySqlDatabaseCollection GetMySqlDatabases() { - return GetCachedClient(Client => new MySqlDatabaseCollection(Client, Id)); + return GetCachedClient(client => new MySqlDatabaseCollection(client, Id)); } /// @@ -242,8 +245,8 @@ public virtual MySqlDatabaseCollection GetMySqlDatabases() /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -265,8 +268,8 @@ public virtual async Task> GetMySqlDatabaseAsync /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -277,7 +280,7 @@ public virtual Response GetMySqlDatabase(string databaseN /// An object representing collection of MySqlConfigurationResources and their operations over a MySqlConfigurationResource. public virtual MySqlConfigurationCollection GetMySqlConfigurations() { - return GetCachedClient(Client => new MySqlConfigurationCollection(Client, Id)); + return GetCachedClient(client => new MySqlConfigurationCollection(client, Id)); } /// @@ -295,8 +298,8 @@ public virtual MySqlConfigurationCollection GetMySqlConfigurations() /// /// The name of the server configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -318,8 +321,8 @@ public virtual async Task> GetMySqlConfigur /// /// The name of the server configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -337,7 +340,7 @@ public virtual MySqlServerAdministratorResource GetMySqlServerAdministrator() /// An object representing collection of MySqlServerSecurityAlertPolicyResources and their operations over a MySqlServerSecurityAlertPolicyResource. public virtual MySqlServerSecurityAlertPolicyCollection GetMySqlServerSecurityAlertPolicies() { - return GetCachedClient(Client => new MySqlServerSecurityAlertPolicyCollection(Client, Id)); + return GetCachedClient(client => new MySqlServerSecurityAlertPolicyCollection(client, Id)); } /// @@ -386,7 +389,7 @@ public virtual Response GetMySqlServerSe /// An object representing collection of MySqlQueryTextResources and their operations over a MySqlQueryTextResource. public virtual MySqlQueryTextCollection GetMySqlQueryTexts() { - return GetCachedClient(Client => new MySqlQueryTextCollection(Client, Id)); + return GetCachedClient(client => new MySqlQueryTextCollection(client, Id)); } /// @@ -404,8 +407,8 @@ public virtual MySqlQueryTextCollection GetMySqlQueryTexts() /// /// The Query-Store query identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlQueryTextAsync(string queryId, CancellationToken cancellationToken = default) { @@ -427,8 +430,8 @@ public virtual async Task> GetMySqlQueryTextAsy /// /// The Query-Store query identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlQueryText(string queryId, CancellationToken cancellationToken = default) { @@ -439,7 +442,7 @@ public virtual Response GetMySqlQueryText(string queryId /// An object representing collection of MySqlQueryStatisticResources and their operations over a MySqlQueryStatisticResource. public virtual MySqlQueryStatisticCollection GetMySqlQueryStatistics() { - return GetCachedClient(Client => new MySqlQueryStatisticCollection(Client, Id)); + return GetCachedClient(client => new MySqlQueryStatisticCollection(client, Id)); } /// @@ -457,8 +460,8 @@ public virtual MySqlQueryStatisticCollection GetMySqlQueryStatistics() /// /// The Query Statistic identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlQueryStatisticAsync(string queryStatisticId, CancellationToken cancellationToken = default) { @@ -480,8 +483,8 @@ public virtual async Task> GetMySqlQuerySt /// /// The Query Statistic identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlQueryStatistic(string queryStatisticId, CancellationToken cancellationToken = default) { @@ -492,7 +495,7 @@ public virtual Response GetMySqlQueryStatistic(stri /// An object representing collection of MySqlWaitStatisticResources and their operations over a MySqlWaitStatisticResource. public virtual MySqlWaitStatisticCollection GetMySqlWaitStatistics() { - return GetCachedClient(Client => new MySqlWaitStatisticCollection(Client, Id)); + return GetCachedClient(client => new MySqlWaitStatisticCollection(client, Id)); } /// @@ -510,8 +513,8 @@ public virtual MySqlWaitStatisticCollection GetMySqlWaitStatistics() /// /// The Wait Statistic identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlWaitStatisticAsync(string waitStatisticsId, CancellationToken cancellationToken = default) { @@ -533,8 +536,8 @@ public virtual async Task> GetMySqlWaitStat /// /// The Wait Statistic identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlWaitStatistic(string waitStatisticsId, CancellationToken cancellationToken = default) { @@ -545,7 +548,7 @@ public virtual Response GetMySqlWaitStatistic(string /// An object representing collection of MySqlAdvisorResources and their operations over a MySqlAdvisorResource. public virtual MySqlAdvisorCollection GetMySqlAdvisors() { - return GetCachedClient(Client => new MySqlAdvisorCollection(Client, Id)); + return GetCachedClient(client => new MySqlAdvisorCollection(client, Id)); } /// @@ -563,8 +566,8 @@ public virtual MySqlAdvisorCollection GetMySqlAdvisors() /// /// The advisor name for recommendation action. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlAdvisorAsync(string advisorName, CancellationToken cancellationToken = default) { @@ -586,8 +589,8 @@ public virtual async Task> GetMySqlAdvisorAsync(s /// /// The advisor name for recommendation action. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlAdvisor(string advisorName, CancellationToken cancellationToken = default) { @@ -598,7 +601,7 @@ public virtual Response GetMySqlAdvisor(string advisorName /// An object representing collection of MySqlPrivateEndpointConnectionResources and their operations over a MySqlPrivateEndpointConnectionResource. public virtual MySqlPrivateEndpointConnectionCollection GetMySqlPrivateEndpointConnections() { - return GetCachedClient(Client => new MySqlPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new MySqlPrivateEndpointConnectionCollection(client, Id)); } /// @@ -616,8 +619,8 @@ public virtual MySqlPrivateEndpointConnectionCollection GetMySqlPrivateEndpointC /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -639,8 +642,8 @@ public virtual async Task> GetM /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -651,7 +654,7 @@ public virtual Response GetMySqlPrivateE /// An object representing collection of MySqlPrivateLinkResources and their operations over a MySqlPrivateLinkResource. public virtual MySqlPrivateLinkResourceCollection GetMySqlPrivateLinkResources() { - return GetCachedClient(Client => new MySqlPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new MySqlPrivateLinkResourceCollection(client, Id)); } /// @@ -669,8 +672,8 @@ public virtual MySqlPrivateLinkResourceCollection GetMySqlPrivateLinkResources() /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlPrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -692,8 +695,8 @@ public virtual async Task> GetMySqlPrivateLin /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlPrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -704,7 +707,7 @@ public virtual Response GetMySqlPrivateLinkResource(st /// An object representing collection of MySqlServerKeyResources and their operations over a MySqlServerKeyResource. public virtual MySqlServerKeyCollection GetMySqlServerKeys() { - return GetCachedClient(Client => new MySqlServerKeyCollection(Client, Id)); + return GetCachedClient(client => new MySqlServerKeyCollection(client, Id)); } /// @@ -722,8 +725,8 @@ public virtual MySqlServerKeyCollection GetMySqlServerKeys() /// /// The name of the MySQL Server key to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlServerKeyAsync(string keyName, CancellationToken cancellationToken = default) { @@ -745,8 +748,8 @@ public virtual async Task> GetMySqlServerKeyAsy /// /// The name of the MySQL Server key to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlServerKey(string keyName, CancellationToken cancellationToken = default) { diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyResource.cs index 80c829520032f..4c7e496f2f62c 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerSecurityAlertPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlServerSecurityAlertPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The securityAlertPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, MySqlSecurityAlertPolicyName securityAlertPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleResource.cs index 19361946c8753..681dabbcf5fbc 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlVirtualNetworkRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlVirtualNetworkRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The virtualNetworkRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string virtualNetworkRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticResource.cs index 82cab612a2298..611d56910cde0 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlWaitStatisticResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql public partial class MySqlWaitStatisticResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The waitStatisticsId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string waitStatisticsId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/waitStatistics/{waitStatisticsId}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/ArmMySqlFlexibleServersModelFactory.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/ArmMySqlFlexibleServersModelFactory.cs index 5bc7bc08d4183..d68e0819bb539 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/ArmMySqlFlexibleServersModelFactory.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/ArmMySqlFlexibleServersModelFactory.cs @@ -58,14 +58,14 @@ public static MySqlFlexibleServerBackupData MySqlFlexibleServerBackupData(Resour /// Start time. /// End time. /// Operation progress (0-100). - /// The BackupAndExport operation error response. /// Size of datasource in bytes. /// Data transferred in bytes. /// Metadata related to backup to be stored for restoring resource in key-value pairs. + /// The error object. /// A new instance for mocking. - public static MySqlFlexibleServerBackupAndExportResult MySqlFlexibleServerBackupAndExportResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MySqlFlexibleServerBackupAndExportOperationStatus? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, double? percentComplete = null, ResponseError error = null, long? datasourceSizeInBytes = null, long? dataTransferredInBytes = null, string backupMetadata = null) + public static MySqlFlexibleServerBackupAndExportResult MySqlFlexibleServerBackupAndExportResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MySqlFlexibleServerBackupAndExportOperationStatus? status = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, double? percentComplete = null, long? datasourceSizeInBytes = null, long? dataTransferredInBytes = null, string backupMetadata = null, ResponseError error = null) { - return new MySqlFlexibleServerBackupAndExportResult(id, name, resourceType, systemData, status, startOn, endOn, percentComplete, error, datasourceSizeInBytes, dataTransferredInBytes, backupMetadata); + return new MySqlFlexibleServerBackupAndExportResult(id, name, resourceType, systemData, status, startOn, endOn, percentComplete, datasourceSizeInBytes, dataTransferredInBytes, backupMetadata, error); } /// Initializes a new instance of MySqlFlexibleServerValidateBackupResult. @@ -159,13 +159,16 @@ public static MySqlFlexibleServerFirewallRuleData MySqlFlexibleServerFirewallRul /// Backup related properties of a server. /// High availability related properties of a server. /// Network related properties of a server. + /// PrivateEndpointConnections related properties of a server. /// Maintenance window of a server. + /// Source properties for import from storage. /// A new instance for mocking. - public static MySqlFlexibleServerData MySqlFlexibleServerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, MySqlFlexibleServerSku sku = null, string administratorLogin = null, string administratorLoginPassword = null, MySqlFlexibleServerVersion? version = null, string availabilityZone = null, MySqlFlexibleServerCreateMode? createMode = null, ResourceIdentifier sourceServerResourceId = null, DateTimeOffset? restorePointInTime = null, MySqlFlexibleServerReplicationRole? replicationRole = null, int? replicaCapacity = null, MySqlFlexibleServerDataEncryption dataEncryption = null, MySqlFlexibleServerState? state = null, string fullyQualifiedDomainName = null, MySqlFlexibleServerStorage storage = null, MySqlFlexibleServerBackupProperties backup = null, MySqlFlexibleServerHighAvailability highAvailability = null, MySqlFlexibleServerNetwork network = null, MySqlFlexibleServerMaintenanceWindow maintenanceWindow = null) + public static MySqlFlexibleServerData MySqlFlexibleServerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, MySqlFlexibleServerSku sku = null, string administratorLogin = null, string administratorLoginPassword = null, MySqlFlexibleServerVersion? version = null, string availabilityZone = null, MySqlFlexibleServerCreateMode? createMode = null, ResourceIdentifier sourceServerResourceId = null, DateTimeOffset? restorePointInTime = null, MySqlFlexibleServerReplicationRole? replicationRole = null, int? replicaCapacity = null, MySqlFlexibleServerDataEncryption dataEncryption = null, MySqlFlexibleServerState? state = null, string fullyQualifiedDomainName = null, MySqlFlexibleServerStorage storage = null, MySqlFlexibleServerBackupProperties backup = null, MySqlFlexibleServerHighAvailability highAvailability = null, MySqlFlexibleServerNetwork network = null, IEnumerable privateEndpointConnections = null, MySqlFlexibleServerMaintenanceWindow maintenanceWindow = null, ImportSourceProperties importSourceProperties = null) { tags ??= new Dictionary(); + privateEndpointConnections ??= new List(); - return new MySqlFlexibleServerData(id, name, resourceType, systemData, tags, location, identity, sku, administratorLogin, administratorLoginPassword, version, availabilityZone, createMode, sourceServerResourceId, restorePointInTime, replicationRole, replicaCapacity, dataEncryption, state, fullyQualifiedDomainName, storage, backup, highAvailability, network, maintenanceWindow); + return new MySqlFlexibleServerData(id, name, resourceType, systemData, tags, location, identity, sku, administratorLogin, administratorLoginPassword, version, availabilityZone, createMode, sourceServerResourceId, restorePointInTime, replicationRole, replicaCapacity, dataEncryption, state, fullyQualifiedDomainName, storage, backup, highAvailability, network, privateEndpointConnections?.ToList(), maintenanceWindow, importSourceProperties); } /// Initializes a new instance of MySqlFlexibleServerStorage. @@ -201,6 +204,23 @@ public static MySqlFlexibleServerHighAvailability MySqlFlexibleServerHighAvailab return new MySqlFlexibleServerHighAvailability(mode, state, standbyAvailabilityZone); } + /// Initializes a new instance of MySqlFlexibleServersPrivateEndpointConnection. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The group ids for the private endpoint resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. + /// A new instance for mocking. + public static MySqlFlexibleServersPrivateEndpointConnection MySqlFlexibleServersPrivateEndpointConnection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable groupIds = null, ResourceIdentifier privateEndpointId = null, MySqlFlexibleServersPrivateLinkServiceConnectionState connectionState = null, MySqlFlexibleServersPrivateEndpointConnectionProvisioningState? provisioningState = null) + { + groupIds ??= new List(); + + return new MySqlFlexibleServersPrivateEndpointConnection(id, name, resourceType, systemData, groupIds?.ToList(), privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState); + } + /// Initializes a new instance of MySqlFlexibleServerLogFile. /// The id. /// The name. @@ -279,6 +299,63 @@ public static MySqlFlexibleServerSkuCapability MySqlFlexibleServerSkuCapability( return new MySqlFlexibleServerSkuCapability(name, vCores, supportedIops, supportedMemoryPerVCoreInMB); } + /// Initializes a new instance of MySqlFlexibleServersCapabilityData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// supported geo backup regions. + /// A list of supported flexible server editions. + /// A list of supported server versions. + /// A new instance for mocking. + public static MySqlFlexibleServersCapabilityData MySqlFlexibleServersCapabilityData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable supportedGeoBackupRegions = null, IEnumerable supportedFlexibleServerEditions = null, IEnumerable supportedServerVersions = null) + { + supportedGeoBackupRegions ??= new List(); + supportedFlexibleServerEditions ??= new List(); + supportedServerVersions ??= new List(); + + return new MySqlFlexibleServersCapabilityData(id, name, resourceType, systemData, supportedGeoBackupRegions?.ToList(), supportedFlexibleServerEditions?.ToList(), supportedServerVersions?.ToList()); + } + + /// Initializes a new instance of ServerEditionCapabilityV2. + /// Server edition name. + /// Default Sku name. + /// Default storage size. + /// A list of supported storage editions. + /// A list of supported Skus. + /// A new instance for mocking. + public static ServerEditionCapabilityV2 ServerEditionCapabilityV2(string name = null, string defaultSku = null, int? defaultStorageSize = null, IEnumerable supportedStorageEditions = null, IEnumerable supportedSkus = null) + { + supportedStorageEditions ??= new List(); + supportedSkus ??= new List(); + + return new ServerEditionCapabilityV2(name, defaultSku, defaultStorageSize, supportedStorageEditions?.ToList(), supportedSkus?.ToList()); + } + + /// Initializes a new instance of SkuCapabilityV2. + /// vCore name. + /// supported vCores. + /// supported IOPS. + /// supported memory per vCore in MB. + /// Supported zones. + /// Supported high availability mode. + /// A new instance for mocking. + public static SkuCapabilityV2 SkuCapabilityV2(string name = null, long? vCores = null, long? supportedIops = null, long? supportedMemoryPerVCoreMB = null, IEnumerable supportedZones = null, IEnumerable supportedHAMode = null) + { + supportedZones ??= new List(); + supportedHAMode ??= new List(); + + return new SkuCapabilityV2(name, vCores, supportedIops, supportedMemoryPerVCoreMB, supportedZones?.ToList(), supportedHAMode?.ToList()); + } + + /// Initializes a new instance of ServerVersionCapabilityV2. + /// server version. + /// A new instance for mocking. + public static ServerVersionCapabilityV2 ServerVersionCapabilityV2(string name = null) + { + return new ServerVersionCapabilityV2(name); + } + /// Initializes a new instance of MySqlFlexibleServerVirtualNetworkSubnetUsageResult. /// The location name. /// The subscription id. @@ -310,6 +387,44 @@ public static MySqlFlexibleServerNameAvailabilityResult MySqlFlexibleServerNameA return new MySqlFlexibleServerNameAvailabilityResult(message, isNameAvailable, reason); } + /// Initializes a new instance of OperationStatusExtendedResult. + /// Fully qualified ID for the async operation. + /// Fully qualified ID of the resource against which the original async operation was started. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// The extended properties of Operation Results. + /// A new instance for mocking. + public static OperationStatusExtendedResult OperationStatusExtendedResult(ResourceIdentifier id = null, ResourceIdentifier resourceId = null, string name = null, string status = null, float? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null, IReadOnlyDictionary properties = null) + { + operations ??= new List(); + properties ??= new Dictionary(); + + return new OperationStatusExtendedResult(id, resourceId, name, status, percentComplete, startOn, endOn, operations?.ToList(), error, properties); + } + + /// Initializes a new instance of OperationStatusResult. + /// Fully qualified ID for the async operation. + /// Fully qualified ID of the resource against which the original async operation was started. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// A new instance for mocking. + public static OperationStatusResult OperationStatusResult(ResourceIdentifier id = null, ResourceIdentifier resourceId = null, string name = null, string status = null, float? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null) + { + operations ??= new List(); + + return new OperationStatusResult(id, resourceId, name, status, percentComplete, startOn, endOn, operations?.ToList(), error); + } + /// Initializes a new instance of MySqlFlexibleServerPrivateDnsZoneSuffixResponse. /// Represents the private DNS zone suffix. /// A new instance for mocking. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs index 5871205b74d46..b34de9bfad20f 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.MySql.FlexibleServers.Mocking; using Azure.ResourceManager.MySql.FlexibleServers.Models; using Azure.ResourceManager.Resources; @@ -19,173 +20,150 @@ namespace Azure.ResourceManager.MySql.FlexibleServers /// A class to add extension methods to Azure.ResourceManager.MySql.FlexibleServers. public static partial class FlexibleServersExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableMySqlFlexibleServersArmClient GetMockableMySqlFlexibleServersArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableMySqlFlexibleServersArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMySqlFlexibleServersResourceGroupResource GetMockableMySqlFlexibleServersResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMySqlFlexibleServersResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableMySqlFlexibleServersSubscriptionResource GetMockableMySqlFlexibleServersSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableMySqlFlexibleServersSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableMySqlFlexibleServersTenantResource GetMockableMySqlFlexibleServersTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableMySqlFlexibleServersTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region MySqlFlexibleServerAadAdministratorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlFlexibleServerAadAdministratorResource GetMySqlFlexibleServerAadAdministratorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlFlexibleServerAadAdministratorResource.ValidateResourceId(id); - return new MySqlFlexibleServerAadAdministratorResource(client, id); - } - ); + return GetMockableMySqlFlexibleServersArmClient(client).GetMySqlFlexibleServerAadAdministratorResource(id); } - #endregion - #region MySqlFlexibleServerBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlFlexibleServerBackupResource GetMySqlFlexibleServerBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlFlexibleServerBackupResource.ValidateResourceId(id); - return new MySqlFlexibleServerBackupResource(client, id); - } - ); + return GetMockableMySqlFlexibleServersArmClient(client).GetMySqlFlexibleServerBackupResource(id); } - #endregion - #region MySqlFlexibleServerConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlFlexibleServerConfigurationResource GetMySqlFlexibleServerConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlFlexibleServerConfigurationResource.ValidateResourceId(id); - return new MySqlFlexibleServerConfigurationResource(client, id); - } - ); + return GetMockableMySqlFlexibleServersArmClient(client).GetMySqlFlexibleServerConfigurationResource(id); } - #endregion - #region MySqlFlexibleServerDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlFlexibleServerDatabaseResource GetMySqlFlexibleServerDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlFlexibleServerDatabaseResource.ValidateResourceId(id); - return new MySqlFlexibleServerDatabaseResource(client, id); - } - ); + return GetMockableMySqlFlexibleServersArmClient(client).GetMySqlFlexibleServerDatabaseResource(id); } - #endregion - #region MySqlFlexibleServerFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlFlexibleServerFirewallRuleResource GetMySqlFlexibleServerFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlFlexibleServerFirewallRuleResource.ValidateResourceId(id); - return new MySqlFlexibleServerFirewallRuleResource(client, id); - } - ); + return GetMockableMySqlFlexibleServersArmClient(client).GetMySqlFlexibleServerFirewallRuleResource(id); } - #endregion - #region MySqlFlexibleServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MySqlFlexibleServerResource GetMySqlFlexibleServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MySqlFlexibleServerResource.ValidateResourceId(id); - return new MySqlFlexibleServerResource(client, id); - } - ); + return GetMockableMySqlFlexibleServersArmClient(client).GetMySqlFlexibleServerResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MySqlFlexibleServersCapabilityResource GetMySqlFlexibleServersCapabilityResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableMySqlFlexibleServersArmClient(client).GetMySqlFlexibleServersCapabilityResource(id); } - #endregion - /// Gets a collection of MySqlFlexibleServerResources in the ResourceGroupResource. + /// + /// Gets a collection of MySqlFlexibleServerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MySqlFlexibleServerResources and their operations over a MySqlFlexibleServerResource. public static MySqlFlexibleServerCollection GetMySqlFlexibleServers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMySqlFlexibleServers(); + return GetMockableMySqlFlexibleServersResourceGroupResource(resourceGroupResource).GetMySqlFlexibleServers(); } /// @@ -200,16 +178,20 @@ public static MySqlFlexibleServerCollection GetMySqlFlexibleServers(this Resourc /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMySqlFlexibleServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMySqlFlexibleServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + return await GetMockableMySqlFlexibleServersResourceGroupResource(resourceGroupResource).GetMySqlFlexibleServerAsync(serverName, cancellationToken).ConfigureAwait(false); } /// @@ -224,16 +206,93 @@ public static async Task> GetMySqlFlexible /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMySqlFlexibleServer(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMySqlFlexibleServers().Get(serverName, cancellationToken); + return GetMockableMySqlFlexibleServersResourceGroupResource(resourceGroupResource).GetMySqlFlexibleServer(serverName, cancellationToken); + } + + /// + /// Gets a collection of MySqlFlexibleServersCapabilityResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the location. + /// An object representing collection of MySqlFlexibleServersCapabilityResources and their operations over a MySqlFlexibleServersCapabilityResource. + public static MySqlFlexibleServersCapabilityCollection GetMySqlFlexibleServersCapabilities(this SubscriptionResource subscriptionResource, AzureLocation locationName) + { + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetMySqlFlexibleServersCapabilities(locationName); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the location. + /// Name of capability set. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetMySqlFlexibleServersCapabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string capabilitySetName, CancellationToken cancellationToken = default) + { + return await GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetMySqlFlexibleServersCapabilityAsync(locationName, capabilitySetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the location. + /// Name of capability set. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetMySqlFlexibleServersCapability(this SubscriptionResource subscriptionResource, AzureLocation locationName, string capabilitySetName, CancellationToken cancellationToken = default) + { + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetMySqlFlexibleServersCapability(locationName, capabilitySetName, cancellationToken); } /// @@ -248,13 +307,17 @@ public static Response GetMySqlFlexibleServer(this /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMySqlFlexibleServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMySqlFlexibleServersAsync(cancellationToken); + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetMySqlFlexibleServersAsync(cancellationToken); } /// @@ -269,13 +332,17 @@ public static AsyncPageable GetMySqlFlexibleServers /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMySqlFlexibleServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMySqlFlexibleServers(cancellationToken); + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetMySqlFlexibleServers(cancellationToken); } /// @@ -290,6 +357,10 @@ public static Pageable GetMySqlFlexibleServers(this /// LocationBasedCapabilities_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -297,7 +368,7 @@ public static Pageable GetMySqlFlexibleServers(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLocationBasedCapabilitiesAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLocationBasedCapabilitiesAsync(locationName, cancellationToken); + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetLocationBasedCapabilitiesAsync(locationName, cancellationToken); } /// @@ -312,6 +383,10 @@ public static AsyncPageable GetLocation /// LocationBasedCapabilities_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -319,7 +394,7 @@ public static AsyncPageable GetLocation /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLocationBasedCapabilities(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLocationBasedCapabilities(locationName, cancellationToken); + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetLocationBasedCapabilities(locationName, cancellationToken); } /// @@ -334,6 +409,10 @@ public static Pageable GetLocationBased /// CheckVirtualNetworkSubnetUsage_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -342,9 +421,7 @@ public static Pageable GetLocationBased /// is null. public static async Task> ExecuteCheckVirtualNetworkSubnetUsageAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, nameof(mySqlFlexibleServerVirtualNetworkSubnetUsageParameter)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ExecuteCheckVirtualNetworkSubnetUsageAsync(locationName, mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken).ConfigureAwait(false); + return await GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).ExecuteCheckVirtualNetworkSubnetUsageAsync(locationName, mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken).ConfigureAwait(false); } /// @@ -359,6 +436,10 @@ public static async TaskCheckVirtualNetworkSubnetUsage_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -367,9 +448,7 @@ public static async Task is null. public static Response ExecuteCheckVirtualNetworkSubnetUsage(this SubscriptionResource subscriptionResource, AzureLocation locationName, MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, nameof(mySqlFlexibleServerVirtualNetworkSubnetUsageParameter)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ExecuteCheckVirtualNetworkSubnetUsage(locationName, mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken); + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).ExecuteCheckVirtualNetworkSubnetUsage(locationName, mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken); } /// @@ -384,6 +463,10 @@ public static Response Execu /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -392,9 +475,7 @@ public static Response Execu /// is null. public static async Task> CheckMySqlFlexibleServerNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); + return await GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); } /// @@ -409,6 +490,10 @@ public static async Task> Ch /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -417,9 +502,7 @@ public static async Task> Ch /// is null. public static Response CheckMySqlFlexibleServerNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailability(locationName, content, cancellationToken); + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).CheckMySqlFlexibleServerNameAvailability(locationName, content, cancellationToken); } /// @@ -434,6 +517,10 @@ public static Response CheckMySqlFlex /// CheckNameAvailabilityWithoutLocation_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if server name is available. @@ -441,9 +528,7 @@ public static Response CheckMySqlFlex /// is null. public static async Task> CheckMySqlFlexibleServerNameAvailabilityWithoutLocationAsync(this SubscriptionResource subscriptionResource, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityWithoutLocationAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityWithoutLocationAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -458,6 +543,10 @@ public static async Task> Ch /// CheckNameAvailabilityWithoutLocation_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if server name is available. @@ -465,9 +554,63 @@ public static async Task> Ch /// is null. public static Response CheckMySqlFlexibleServerNameAvailabilityWithoutLocation(this SubscriptionResource subscriptionResource, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityWithoutLocation(content, cancellationToken); + } - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityWithoutLocation(content, cancellationToken); + /// + /// Get the operation result for a long running operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/operationResults/{operationId} + /// + /// + /// Operation Id + /// OperationResults_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the location. + /// The operation Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public static async Task> GetOperationResultAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string operationId, CancellationToken cancellationToken = default) + { + return await GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetOperationResultAsync(locationName, operationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the operation result for a long running operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/operationResults/{operationId} + /// + /// + /// Operation Id + /// OperationResults_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the location. + /// The operation Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public static Response GetOperationResult(this SubscriptionResource subscriptionResource, AzureLocation locationName, string operationId, CancellationToken cancellationToken = default) + { + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).GetOperationResult(locationName, operationId, cancellationToken); } /// @@ -482,12 +625,16 @@ public static Response CheckMySqlFlex /// GetPrivateDnsZoneSuffix_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> ExecuteGetPrivateDnsZoneSuffixAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return await GetTenantResourceExtensionClient(tenantResource).ExecuteGetPrivateDnsZoneSuffixAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableMySqlFlexibleServersTenantResource(tenantResource).ExecuteGetPrivateDnsZoneSuffixAsync(cancellationToken).ConfigureAwait(false); } /// @@ -502,12 +649,16 @@ public static async TaskGetPrivateDnsZoneSuffix_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response ExecuteGetPrivateDnsZoneSuffix(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).ExecuteGetPrivateDnsZoneSuffix(cancellationToken); + return GetMockableMySqlFlexibleServersTenantResource(tenantResource).ExecuteGetPrivateDnsZoneSuffix(cancellationToken); } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersArmClient.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersArmClient.cs new file mode 100644 index 0000000000000..e00a633e1f48b --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MySql.FlexibleServers; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableMySqlFlexibleServersArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMySqlFlexibleServersArmClient() + { + } + + /// 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 MockableMySqlFlexibleServersArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableMySqlFlexibleServersArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlFlexibleServerAadAdministratorResource GetMySqlFlexibleServerAadAdministratorResource(ResourceIdentifier id) + { + MySqlFlexibleServerAadAdministratorResource.ValidateResourceId(id); + return new MySqlFlexibleServerAadAdministratorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlFlexibleServerBackupResource GetMySqlFlexibleServerBackupResource(ResourceIdentifier id) + { + MySqlFlexibleServerBackupResource.ValidateResourceId(id); + return new MySqlFlexibleServerBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlFlexibleServerConfigurationResource GetMySqlFlexibleServerConfigurationResource(ResourceIdentifier id) + { + MySqlFlexibleServerConfigurationResource.ValidateResourceId(id); + return new MySqlFlexibleServerConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlFlexibleServerDatabaseResource GetMySqlFlexibleServerDatabaseResource(ResourceIdentifier id) + { + MySqlFlexibleServerDatabaseResource.ValidateResourceId(id); + return new MySqlFlexibleServerDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlFlexibleServerFirewallRuleResource GetMySqlFlexibleServerFirewallRuleResource(ResourceIdentifier id) + { + MySqlFlexibleServerFirewallRuleResource.ValidateResourceId(id); + return new MySqlFlexibleServerFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlFlexibleServerResource GetMySqlFlexibleServerResource(ResourceIdentifier id) + { + MySqlFlexibleServerResource.ValidateResourceId(id); + return new MySqlFlexibleServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MySqlFlexibleServersCapabilityResource GetMySqlFlexibleServersCapabilityResource(ResourceIdentifier id) + { + MySqlFlexibleServersCapabilityResource.ValidateResourceId(id); + return new MySqlFlexibleServersCapabilityResource(Client, id); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersResourceGroupResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersResourceGroupResource.cs new file mode 100644 index 0000000000000..75dd12be99292 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.MySql.FlexibleServers; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableMySqlFlexibleServersResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableMySqlFlexibleServersResourceGroupResource() + { + } + + /// 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 MockableMySqlFlexibleServersResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MySqlFlexibleServerResources in the ResourceGroupResource. + /// An object representing collection of MySqlFlexibleServerResources and their operations over a MySqlFlexibleServerResource. + public virtual MySqlFlexibleServerCollection GetMySqlFlexibleServers() + { + return GetCachedClient(client => new MySqlFlexibleServerCollection(client, Id)); + } + + /// + /// Gets information about a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMySqlFlexibleServerAsync(string serverName, CancellationToken cancellationToken = default) + { + return await GetMySqlFlexibleServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMySqlFlexibleServer(string serverName, CancellationToken cancellationToken = default) + { + return GetMySqlFlexibleServers().Get(serverName, cancellationToken); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersSubscriptionResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersSubscriptionResource.cs new file mode 100644 index 0000000000000..c158069e02c59 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersSubscriptionResource.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.MySql.FlexibleServers; +using Azure.ResourceManager.MySql.FlexibleServers.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableMySqlFlexibleServersSubscriptionResource : ArmResource + { + private ClientDiagnostics _mySqlFlexibleServerServersClientDiagnostics; + private ServersRestOperations _mySqlFlexibleServerServersRestClient; + private ClientDiagnostics _locationBasedCapabilitiesClientDiagnostics; + private LocationBasedCapabilitiesRestOperations _locationBasedCapabilitiesRestClient; + private ClientDiagnostics _checkVirtualNetworkSubnetUsageClientDiagnostics; + private CheckVirtualNetworkSubnetUsageRestOperations _checkVirtualNetworkSubnetUsageRestClient; + private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; + private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; + private ClientDiagnostics _checkNameAvailabilityWithoutLocationClientDiagnostics; + private CheckNameAvailabilityWithoutLocationRestOperations _checkNameAvailabilityWithoutLocationRestClient; + private ClientDiagnostics _operationResultsClientDiagnostics; + private OperationResultsRestOperations _operationResultsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMySqlFlexibleServersSubscriptionResource() + { + } + + /// 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 MockableMySqlFlexibleServersSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MySqlFlexibleServerServersClientDiagnostics => _mySqlFlexibleServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", MySqlFlexibleServerResource.ResourceType.Namespace, Diagnostics); + private ServersRestOperations MySqlFlexibleServerServersRestClient => _mySqlFlexibleServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MySqlFlexibleServerResource.ResourceType)); + private ClientDiagnostics LocationBasedCapabilitiesClientDiagnostics => _locationBasedCapabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationBasedCapabilitiesRestOperations LocationBasedCapabilitiesRestClient => _locationBasedCapabilitiesRestClient ??= new LocationBasedCapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckVirtualNetworkSubnetUsageClientDiagnostics => _checkVirtualNetworkSubnetUsageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckVirtualNetworkSubnetUsageRestOperations CheckVirtualNetworkSubnetUsageRestClient => _checkVirtualNetworkSubnetUsageRestClient ??= new CheckVirtualNetworkSubnetUsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckNameAvailabilityWithoutLocationClientDiagnostics => _checkNameAvailabilityWithoutLocationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityWithoutLocationRestOperations CheckNameAvailabilityWithoutLocationRestClient => _checkNameAvailabilityWithoutLocationRestClient ??= new CheckNameAvailabilityWithoutLocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics OperationResultsClientDiagnostics => _operationResultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OperationResultsRestOperations OperationResultsRestClient => _operationResultsRestClient ??= new OperationResultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MySqlFlexibleServersCapabilityResources in the SubscriptionResource. + /// The name of the location. + /// An object representing collection of MySqlFlexibleServersCapabilityResources and their operations over a MySqlFlexibleServersCapabilityResource. + public virtual MySqlFlexibleServersCapabilityCollection GetMySqlFlexibleServersCapabilities(AzureLocation locationName) + { + return new MySqlFlexibleServersCapabilityCollection(Client, Id, locationName); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// The name of the location. + /// Name of capability set. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMySqlFlexibleServersCapabilityAsync(AzureLocation locationName, string capabilitySetName, CancellationToken cancellationToken = default) + { + return await GetMySqlFlexibleServersCapabilities(locationName).GetAsync(capabilitySetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// The name of the location. + /// Name of capability set. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMySqlFlexibleServersCapability(AzureLocation locationName, string capabilitySetName, CancellationToken cancellationToken = default) + { + return GetMySqlFlexibleServersCapabilities(locationName).Get(capabilitySetName, cancellationToken); + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/flexibleServers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMySqlFlexibleServersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MySqlFlexibleServerServersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MySqlFlexibleServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MySqlFlexibleServerResource(Client, MySqlFlexibleServerData.DeserializeMySqlFlexibleServerData(e)), MySqlFlexibleServerServersClientDiagnostics, Pipeline, "MockableMySqlFlexibleServersSubscriptionResource.GetMySqlFlexibleServers", "value", "nextLink", cancellationToken); + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/flexibleServers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMySqlFlexibleServers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MySqlFlexibleServerServersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MySqlFlexibleServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MySqlFlexibleServerResource(Client, MySqlFlexibleServerData.DeserializeMySqlFlexibleServerData(e)), MySqlFlexibleServerServersClientDiagnostics, Pipeline, "MockableMySqlFlexibleServersSubscriptionResource.GetMySqlFlexibleServers", "value", "nextLink", cancellationToken); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilities + /// + /// + /// Operation Id + /// LocationBasedCapabilities_List + /// + /// + /// + /// The name of the location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLocationBasedCapabilitiesAsync(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedCapabilitiesRestClient.CreateListRequest(Id.SubscriptionId, locationName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedCapabilitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, MySqlFlexibleServerCapabilityProperties.DeserializeMySqlFlexibleServerCapabilityProperties, LocationBasedCapabilitiesClientDiagnostics, Pipeline, "MockableMySqlFlexibleServersSubscriptionResource.GetLocationBasedCapabilities", "value", "nextLink", cancellationToken); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilities + /// + /// + /// Operation Id + /// LocationBasedCapabilities_List + /// + /// + /// + /// The name of the location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLocationBasedCapabilities(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedCapabilitiesRestClient.CreateListRequest(Id.SubscriptionId, locationName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedCapabilitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, MySqlFlexibleServerCapabilityProperties.DeserializeMySqlFlexibleServerCapabilityProperties, LocationBasedCapabilitiesClientDiagnostics, Pipeline, "MockableMySqlFlexibleServersSubscriptionResource.GetLocationBasedCapabilities", "value", "nextLink", cancellationToken); + } + + /// + /// Get virtual network subnet usage for a given vNet resource id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkVirtualNetworkSubnetUsage + /// + /// + /// Operation Id + /// CheckVirtualNetworkSubnetUsage_Execute + /// + /// + /// + /// The name of the location. + /// The required parameters for creating or updating a server. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExecuteCheckVirtualNetworkSubnetUsageAsync(AzureLocation locationName, MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, nameof(mySqlFlexibleServerVirtualNetworkSubnetUsageParameter)); + + using var scope = CheckVirtualNetworkSubnetUsageClientDiagnostics.CreateScope("MockableMySqlFlexibleServersSubscriptionResource.ExecuteCheckVirtualNetworkSubnetUsage"); + scope.Start(); + try + { + var response = await CheckVirtualNetworkSubnetUsageRestClient.ExecuteAsync(Id.SubscriptionId, locationName, mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get virtual network subnet usage for a given vNet resource id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkVirtualNetworkSubnetUsage + /// + /// + /// Operation Id + /// CheckVirtualNetworkSubnetUsage_Execute + /// + /// + /// + /// The name of the location. + /// The required parameters for creating or updating a server. + /// The cancellation token to use. + /// is null. + public virtual Response ExecuteCheckVirtualNetworkSubnetUsage(AzureLocation locationName, MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, nameof(mySqlFlexibleServerVirtualNetworkSubnetUsageParameter)); + + using var scope = CheckVirtualNetworkSubnetUsageClientDiagnostics.CreateScope("MockableMySqlFlexibleServersSubscriptionResource.ExecuteCheckVirtualNetworkSubnetUsage"); + scope.Start(); + try + { + var response = CheckVirtualNetworkSubnetUsageRestClient.Execute(Id.SubscriptionId, locationName, mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for server + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The name of the location. + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckMySqlFlexibleServerNameAvailabilityAsync(AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockableMySqlFlexibleServersSubscriptionResource.CheckMySqlFlexibleServerNameAvailability"); + scope.Start(); + try + { + var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for server + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The name of the location. + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + /// is null. + public virtual Response CheckMySqlFlexibleServerNameAvailability(AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockableMySqlFlexibleServersSubscriptionResource.CheckMySqlFlexibleServerNameAvailability"); + scope.Start(); + try + { + var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, locationName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for server + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailabilityWithoutLocation_Execute + /// + /// + /// + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckMySqlFlexibleServerNameAvailabilityWithoutLocationAsync(MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityWithoutLocationClientDiagnostics.CreateScope("MockableMySqlFlexibleServersSubscriptionResource.CheckMySqlFlexibleServerNameAvailabilityWithoutLocation"); + scope.Start(); + try + { + var response = await CheckNameAvailabilityWithoutLocationRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for server + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailabilityWithoutLocation_Execute + /// + /// + /// + /// The required parameters for checking if server name is available. + /// The cancellation token to use. + /// is null. + public virtual Response CheckMySqlFlexibleServerNameAvailabilityWithoutLocation(MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityWithoutLocationClientDiagnostics.CreateScope("MockableMySqlFlexibleServersSubscriptionResource.CheckMySqlFlexibleServerNameAvailabilityWithoutLocation"); + scope.Start(); + try + { + var response = CheckNameAvailabilityWithoutLocationRestClient.Execute(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the operation result for a long running operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/operationResults/{operationId} + /// + /// + /// Operation Id + /// OperationResults_Get + /// + /// + /// + /// The name of the location. + /// The operation Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetOperationResultAsync(AzureLocation locationName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = OperationResultsClientDiagnostics.CreateScope("MockableMySqlFlexibleServersSubscriptionResource.GetOperationResult"); + scope.Start(); + try + { + var response = await OperationResultsRestClient.GetAsync(Id.SubscriptionId, locationName, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the operation result for a long running operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/operationResults/{operationId} + /// + /// + /// Operation Id + /// OperationResults_Get + /// + /// + /// + /// The name of the location. + /// The operation Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetOperationResult(AzureLocation locationName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = OperationResultsClientDiagnostics.CreateScope("MockableMySqlFlexibleServersSubscriptionResource.GetOperationResult"); + scope.Start(); + try + { + var response = OperationResultsRestClient.Get(Id.SubscriptionId, locationName, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersTenantResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersTenantResource.cs new file mode 100644 index 0000000000000..9caf7028f97c0 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersTenantResource.cs @@ -0,0 +1,107 @@ +// 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; +using Azure.ResourceManager.MySql.FlexibleServers; +using Azure.ResourceManager.MySql.FlexibleServers.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableMySqlFlexibleServersTenantResource : ArmResource + { + private ClientDiagnostics _getPrivateDnsZoneSuffixClientDiagnostics; + private GetPrivateDnsZoneSuffixRestOperations _getPrivateDnsZoneSuffixRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableMySqlFlexibleServersTenantResource() + { + } + + /// 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 MockableMySqlFlexibleServersTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics GetPrivateDnsZoneSuffixClientDiagnostics => _getPrivateDnsZoneSuffixClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private GetPrivateDnsZoneSuffixRestOperations GetPrivateDnsZoneSuffixRestClient => _getPrivateDnsZoneSuffixRestClient ??= new GetPrivateDnsZoneSuffixRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get private DNS zone suffix in the cloud. + /// + /// + /// Request Path + /// /providers/Microsoft.DBforMySQL/getPrivateDnsZoneSuffix + /// + /// + /// Operation Id + /// GetPrivateDnsZoneSuffix_Execute + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> ExecuteGetPrivateDnsZoneSuffixAsync(CancellationToken cancellationToken = default) + { + using var scope = GetPrivateDnsZoneSuffixClientDiagnostics.CreateScope("MockableMySqlFlexibleServersTenantResource.ExecuteGetPrivateDnsZoneSuffix"); + scope.Start(); + try + { + var response = await GetPrivateDnsZoneSuffixRestClient.ExecuteAsync(cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get private DNS zone suffix in the cloud. + /// + /// + /// Request Path + /// /providers/Microsoft.DBforMySQL/getPrivateDnsZoneSuffix + /// + /// + /// Operation Id + /// GetPrivateDnsZoneSuffix_Execute + /// + /// + /// + /// The cancellation token to use. + public virtual Response ExecuteGetPrivateDnsZoneSuffix(CancellationToken cancellationToken = default) + { + using var scope = GetPrivateDnsZoneSuffixClientDiagnostics.CreateScope("MockableMySqlFlexibleServersTenantResource.ExecuteGetPrivateDnsZoneSuffix"); + scope.Start(); + try + { + var response = GetPrivateDnsZoneSuffixRestClient.Execute(cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index f6b92bac38da7..0000000000000 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.MySql.FlexibleServers -{ - /// 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 MySqlFlexibleServerResources in the ResourceGroupResource. - /// An object representing collection of MySqlFlexibleServerResources and their operations over a MySqlFlexibleServerResource. - public virtual MySqlFlexibleServerCollection GetMySqlFlexibleServers() - { - return GetCachedClient(Client => new MySqlFlexibleServerCollection(Client, Id)); - } - } -} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index abf6b109ea721..0000000000000 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,343 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.MySql.FlexibleServers.Models; - -namespace Azure.ResourceManager.MySql.FlexibleServers -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _mySqlFlexibleServerServersClientDiagnostics; - private ServersRestOperations _mySqlFlexibleServerServersRestClient; - private ClientDiagnostics _locationBasedCapabilitiesClientDiagnostics; - private LocationBasedCapabilitiesRestOperations _locationBasedCapabilitiesRestClient; - private ClientDiagnostics _checkVirtualNetworkSubnetUsageClientDiagnostics; - private CheckVirtualNetworkSubnetUsageRestOperations _checkVirtualNetworkSubnetUsageRestClient; - private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; - private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; - private ClientDiagnostics _checkNameAvailabilityWithoutLocationClientDiagnostics; - private CheckNameAvailabilityWithoutLocationRestOperations _checkNameAvailabilityWithoutLocationRestClient; - - /// 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 MySqlFlexibleServerServersClientDiagnostics => _mySqlFlexibleServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", MySqlFlexibleServerResource.ResourceType.Namespace, Diagnostics); - private ServersRestOperations MySqlFlexibleServerServersRestClient => _mySqlFlexibleServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MySqlFlexibleServerResource.ResourceType)); - private ClientDiagnostics LocationBasedCapabilitiesClientDiagnostics => _locationBasedCapabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationBasedCapabilitiesRestOperations LocationBasedCapabilitiesRestClient => _locationBasedCapabilitiesRestClient ??= new LocationBasedCapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CheckVirtualNetworkSubnetUsageClientDiagnostics => _checkVirtualNetworkSubnetUsageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CheckVirtualNetworkSubnetUsageRestOperations CheckVirtualNetworkSubnetUsageRestClient => _checkVirtualNetworkSubnetUsageRestClient ??= new CheckVirtualNetworkSubnetUsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CheckNameAvailabilityWithoutLocationClientDiagnostics => _checkNameAvailabilityWithoutLocationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CheckNameAvailabilityWithoutLocationRestOperations CheckNameAvailabilityWithoutLocationRestClient => _checkNameAvailabilityWithoutLocationRestClient ??= new CheckNameAvailabilityWithoutLocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the servers in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/flexibleServers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMySqlFlexibleServersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MySqlFlexibleServerServersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MySqlFlexibleServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MySqlFlexibleServerResource(Client, MySqlFlexibleServerData.DeserializeMySqlFlexibleServerData(e)), MySqlFlexibleServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMySqlFlexibleServers", "value", "nextLink", cancellationToken); - } - - /// - /// List all the servers in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/flexibleServers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMySqlFlexibleServers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MySqlFlexibleServerServersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MySqlFlexibleServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MySqlFlexibleServerResource(Client, MySqlFlexibleServerData.DeserializeMySqlFlexibleServerData(e)), MySqlFlexibleServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMySqlFlexibleServers", "value", "nextLink", cancellationToken); - } - - /// - /// Get capabilities at specified location in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilities - /// - /// - /// Operation Id - /// LocationBasedCapabilities_List - /// - /// - /// - /// The name of the location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLocationBasedCapabilitiesAsync(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedCapabilitiesRestClient.CreateListRequest(Id.SubscriptionId, locationName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedCapabilitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, MySqlFlexibleServerCapabilityProperties.DeserializeMySqlFlexibleServerCapabilityProperties, LocationBasedCapabilitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLocationBasedCapabilities", "value", "nextLink", cancellationToken); - } - - /// - /// Get capabilities at specified location in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilities - /// - /// - /// Operation Id - /// LocationBasedCapabilities_List - /// - /// - /// - /// The name of the location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLocationBasedCapabilities(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedCapabilitiesRestClient.CreateListRequest(Id.SubscriptionId, locationName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedCapabilitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, MySqlFlexibleServerCapabilityProperties.DeserializeMySqlFlexibleServerCapabilityProperties, LocationBasedCapabilitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLocationBasedCapabilities", "value", "nextLink", cancellationToken); - } - - /// - /// Get virtual network subnet usage for a given vNet resource id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkVirtualNetworkSubnetUsage - /// - /// - /// Operation Id - /// CheckVirtualNetworkSubnetUsage_Execute - /// - /// - /// - /// The name of the location. - /// The required parameters for creating or updating a server. - /// The cancellation token to use. - public virtual async Task> ExecuteCheckVirtualNetworkSubnetUsageAsync(AzureLocation locationName, MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) - { - using var scope = CheckVirtualNetworkSubnetUsageClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExecuteCheckVirtualNetworkSubnetUsage"); - scope.Start(); - try - { - var response = await CheckVirtualNetworkSubnetUsageRestClient.ExecuteAsync(Id.SubscriptionId, locationName, mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get virtual network subnet usage for a given vNet resource id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkVirtualNetworkSubnetUsage - /// - /// - /// Operation Id - /// CheckVirtualNetworkSubnetUsage_Execute - /// - /// - /// - /// The name of the location. - /// The required parameters for creating or updating a server. - /// The cancellation token to use. - public virtual Response ExecuteCheckVirtualNetworkSubnetUsage(AzureLocation locationName, MySqlFlexibleServerVirtualNetworkSubnetUsageParameter mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) - { - using var scope = CheckVirtualNetworkSubnetUsageClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExecuteCheckVirtualNetworkSubnetUsage"); - scope.Start(); - try - { - var response = CheckVirtualNetworkSubnetUsageRestClient.Execute(Id.SubscriptionId, locationName, mySqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for server - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The name of the location. - /// The required parameters for checking if server name is available. - /// The cancellation token to use. - public virtual async Task> CheckMySqlFlexibleServerNameAvailabilityAsync(AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMySqlFlexibleServerNameAvailability"); - scope.Start(); - try - { - var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for server - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The name of the location. - /// The required parameters for checking if server name is available. - /// The cancellation token to use. - public virtual Response CheckMySqlFlexibleServerNameAvailability(AzureLocation locationName, MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMySqlFlexibleServerNameAvailability"); - scope.Start(); - try - { - var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, locationName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for server - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailabilityWithoutLocation_Execute - /// - /// - /// - /// The required parameters for checking if server name is available. - /// The cancellation token to use. - public virtual async Task> CheckMySqlFlexibleServerNameAvailabilityWithoutLocationAsync(MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityWithoutLocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMySqlFlexibleServerNameAvailabilityWithoutLocation"); - scope.Start(); - try - { - var response = await CheckNameAvailabilityWithoutLocationRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for server - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailabilityWithoutLocation_Execute - /// - /// - /// - /// The required parameters for checking if server name is available. - /// The cancellation token to use. - public virtual Response CheckMySqlFlexibleServerNameAvailabilityWithoutLocation(MySqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityWithoutLocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckMySqlFlexibleServerNameAvailabilityWithoutLocation"); - scope.Start(); - try - { - var response = CheckNameAvailabilityWithoutLocationRestClient.Execute(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index bf0b0866fe16a..0000000000000 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,106 +0,0 @@ -// 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; -using Azure.ResourceManager.MySql.FlexibleServers.Models; - -namespace Azure.ResourceManager.MySql.FlexibleServers -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _getPrivateDnsZoneSuffixClientDiagnostics; - private GetPrivateDnsZoneSuffixRestOperations _getPrivateDnsZoneSuffixRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics GetPrivateDnsZoneSuffixClientDiagnostics => _getPrivateDnsZoneSuffixClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private GetPrivateDnsZoneSuffixRestOperations GetPrivateDnsZoneSuffixRestClient => _getPrivateDnsZoneSuffixRestClient ??= new GetPrivateDnsZoneSuffixRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get private DNS zone suffix in the cloud. - /// - /// - /// Request Path - /// /providers/Microsoft.DBforMySQL/getPrivateDnsZoneSuffix - /// - /// - /// Operation Id - /// GetPrivateDnsZoneSuffix_Execute - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> ExecuteGetPrivateDnsZoneSuffixAsync(CancellationToken cancellationToken = default) - { - using var scope = GetPrivateDnsZoneSuffixClientDiagnostics.CreateScope("TenantResourceExtensionClient.ExecuteGetPrivateDnsZoneSuffix"); - scope.Start(); - try - { - var response = await GetPrivateDnsZoneSuffixRestClient.ExecuteAsync(cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get private DNS zone suffix in the cloud. - /// - /// - /// Request Path - /// /providers/Microsoft.DBforMySQL/getPrivateDnsZoneSuffix - /// - /// - /// Operation Id - /// GetPrivateDnsZoneSuffix_Execute - /// - /// - /// - /// The cancellation token to use. - public virtual Response ExecuteGetPrivateDnsZoneSuffix(CancellationToken cancellationToken = default) - { - using var scope = GetPrivateDnsZoneSuffixClientDiagnostics.CreateScope("TenantResourceExtensionClient.ExecuteGetPrivateDnsZoneSuffix"); - scope.Start(); - try - { - var response = GetPrivateDnsZoneSuffixRestClient.Execute(cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.Serialization.cs new file mode 100644 index 0000000000000..14e0f224a7d9c --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.Serialization.cs @@ -0,0 +1,50 @@ +// 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.MySql.FlexibleServers; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + internal partial class CapabilitySetsList + { + internal static CapabilitySetsList DeserializeCapabilitySetsList(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MySqlFlexibleServersCapabilityData.DeserializeMySqlFlexibleServersCapabilityData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new CapabilitySetsList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.cs new file mode 100644 index 0000000000000..582dc0fb6e7c0 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/CapabilitySetsList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.MySql.FlexibleServers; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// location capability set. + internal partial class CapabilitySetsList + { + /// Initializes a new instance of CapabilitySetsList. + internal CapabilitySetsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of CapabilitySetsList. + /// A list of supported capability sets. + /// Link to retrieve next page of results. + internal CapabilitySetsList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// A list of supported capability sets. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceProperties.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceProperties.Serialization.cs new file mode 100644 index 0000000000000..a481ff9cadae6 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceProperties.Serialization.cs @@ -0,0 +1,86 @@ +// 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.MySql.FlexibleServers.Models +{ + public partial class ImportSourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(StorageType)) + { + writer.WritePropertyName("storageType"u8); + writer.WriteStringValue(StorageType.Value.ToString()); + } + if (Optional.IsDefined(StorageUri)) + { + writer.WritePropertyName("storageUrl"u8); + writer.WriteStringValue(StorageUri.AbsoluteUri); + } + if (Optional.IsDefined(SasToken)) + { + writer.WritePropertyName("sasToken"u8); + writer.WriteStringValue(SasToken); + } + if (Optional.IsDefined(DataDirPath)) + { + writer.WritePropertyName("dataDirPath"u8); + writer.WriteStringValue(DataDirPath); + } + writer.WriteEndObject(); + } + + internal static ImportSourceProperties DeserializeImportSourceProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional storageType = default; + Optional storageUrl = default; + Optional sasToken = default; + Optional dataDirPath = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageType = new ImportSourceStorageType(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("sasToken"u8)) + { + sasToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataDirPath"u8)) + { + dataDirPath = property.Value.GetString(); + continue; + } + } + return new ImportSourceProperties(Optional.ToNullable(storageType), storageUrl.Value, sasToken.Value, dataDirPath.Value); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceProperties.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceProperties.cs new file mode 100644 index 0000000000000..b370e76778abd --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// Import source related properties. + public partial class ImportSourceProperties + { + /// Initializes a new instance of ImportSourceProperties. + public ImportSourceProperties() + { + } + + /// Initializes a new instance of ImportSourceProperties. + /// Storage type of import source. + /// Uri of the import source storage. + /// Sas token for accessing source storage. Read and list permissions are required for sas token. + /// Relative path of data directory in storage. + internal ImportSourceProperties(ImportSourceStorageType? storageType, Uri storageUri, string sasToken, string dataDirPath) + { + StorageType = storageType; + StorageUri = storageUri; + SasToken = sasToken; + DataDirPath = dataDirPath; + } + + /// Storage type of import source. + public ImportSourceStorageType? StorageType { get; set; } + /// Uri of the import source storage. + public Uri StorageUri { get; set; } + /// Sas token for accessing source storage. Read and list permissions are required for sas token. + public string SasToken { get; set; } + /// Relative path of data directory in storage. + public string DataDirPath { get; set; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceStorageType.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceStorageType.cs new file mode 100644 index 0000000000000..ee2e290b68567 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ImportSourceStorageType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// Storage type of import source. + public readonly partial struct ImportSourceStorageType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ImportSourceStorageType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureBlobValue = "AzureBlob"; + + /// AzureBlob. + public static ImportSourceStorageType AzureBlob { get; } = new ImportSourceStorageType(AzureBlobValue); + /// Determines if two values are the same. + public static bool operator ==(ImportSourceStorageType left, ImportSourceStorageType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ImportSourceStorageType left, ImportSourceStorageType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ImportSourceStorageType(string value) => new ImportSourceStorageType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ImportSourceStorageType other && Equals(other); + /// + public bool Equals(ImportSourceStorageType 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/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupAndExportResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupAndExportResult.Serialization.cs index d9de8e416878b..4f28666e6c3c8 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupAndExportResult.Serialization.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupAndExportResult.Serialization.cs @@ -189,7 +189,7 @@ internal static MySqlFlexibleServerBackupAndExportResult DeserializeMySqlFlexibl continue; } } - return new MySqlFlexibleServerBackupAndExportResult(id, name, type, systemData.Value, Optional.ToNullable(status), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(percentComplete), error.Value, Optional.ToNullable(datasourceSizeInBytes), Optional.ToNullable(dataTransferredInBytes), backupMetadata.Value); + return new MySqlFlexibleServerBackupAndExportResult(id, name, type, systemData.Value, Optional.ToNullable(status), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToNullable(percentComplete), Optional.ToNullable(datasourceSizeInBytes), Optional.ToNullable(dataTransferredInBytes), backupMetadata.Value, error.Value); } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupAndExportResult.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupAndExportResult.cs index 260a6831c2868..a4c88c58d9da0 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupAndExportResult.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupAndExportResult.cs @@ -29,20 +29,20 @@ public MySqlFlexibleServerBackupAndExportResult() /// Start time. /// End time. /// Operation progress (0-100). - /// The BackupAndExport operation error response. /// Size of datasource in bytes. /// Data transferred in bytes. /// Metadata related to backup to be stored for restoring resource in key-value pairs. - internal MySqlFlexibleServerBackupAndExportResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MySqlFlexibleServerBackupAndExportOperationStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, double? percentComplete, ResponseError error, long? datasourceSizeInBytes, long? dataTransferredInBytes, string backupMetadata) : base(id, name, resourceType, systemData) + /// The error object. + internal MySqlFlexibleServerBackupAndExportResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MySqlFlexibleServerBackupAndExportOperationStatus? status, DateTimeOffset? startOn, DateTimeOffset? endOn, double? percentComplete, long? datasourceSizeInBytes, long? dataTransferredInBytes, string backupMetadata, ResponseError error) : base(id, name, resourceType, systemData) { Status = status; StartOn = startOn; EndOn = endOn; PercentComplete = percentComplete; - Error = error; DatasourceSizeInBytes = datasourceSizeInBytes; DataTransferredInBytes = dataTransferredInBytes; BackupMetadata = backupMetadata; + Error = error; } /// The operation status. @@ -53,13 +53,13 @@ internal MySqlFlexibleServerBackupAndExportResult(ResourceIdentifier id, string public DateTimeOffset? EndOn { get; set; } /// Operation progress (0-100). public double? PercentComplete { get; set; } - /// The BackupAndExport operation error response. - public ResponseError Error { get; set; } /// Size of datasource in bytes. public long? DatasourceSizeInBytes { get; set; } /// Data transferred in bytes. public long? DataTransferredInBytes { get; set; } /// Metadata related to backup to be stored for restoring resource in key-value pairs. public string BackupMetadata { get; set; } + /// The error object. + public ResponseError Error { get; set; } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupFormat.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupFormat.cs index 728465d0d5f11..7b493ae1af25e 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupFormat.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerBackupFormat.cs @@ -22,13 +22,13 @@ public MySqlFlexibleServerBackupFormat(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string NoneValue = "None"; private const string CollatedFormatValue = "CollatedFormat"; + private const string RawValue = "Raw"; - /// None. - public static MySqlFlexibleServerBackupFormat None { get; } = new MySqlFlexibleServerBackupFormat(NoneValue); /// CollatedFormat. public static MySqlFlexibleServerBackupFormat CollatedFormat { get; } = new MySqlFlexibleServerBackupFormat(CollatedFormatValue); + /// Raw. + public static MySqlFlexibleServerBackupFormat Raw { get; } = new MySqlFlexibleServerBackupFormat(RawValue); /// Determines if two values are the same. public static bool operator ==(MySqlFlexibleServerBackupFormat left, MySqlFlexibleServerBackupFormat right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerData.Serialization.cs index ff54fb21efcf3..38d0d79041c49 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerData.Serialization.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerData.Serialization.cs @@ -114,6 +114,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("maintenanceWindow"u8); writer.WriteObjectValue(MaintenanceWindow); } + if (Optional.IsDefined(ImportSourceProperties)) + { + writer.WritePropertyName("importSourceProperties"u8); + writer.WriteObjectValue(ImportSourceProperties); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -148,7 +153,9 @@ internal static MySqlFlexibleServerData DeserializeMySqlFlexibleServerData(JsonE Optional backup = default; Optional highAvailability = default; Optional network = default; + Optional> privateEndpointConnections = default; Optional maintenanceWindow = default; + Optional importSourceProperties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity"u8)) @@ -349,6 +356,20 @@ internal static MySqlFlexibleServerData DeserializeMySqlFlexibleServerData(JsonE network = MySqlFlexibleServerNetwork.DeserializeMySqlFlexibleServerNetwork(property0.Value); continue; } + if (property0.NameEquals("privateEndpointConnections"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MySqlFlexibleServersPrivateEndpointConnection.DeserializeMySqlFlexibleServersPrivateEndpointConnection(item)); + } + privateEndpointConnections = array; + continue; + } if (property0.NameEquals("maintenanceWindow"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -358,11 +379,20 @@ internal static MySqlFlexibleServerData DeserializeMySqlFlexibleServerData(JsonE maintenanceWindow = MySqlFlexibleServerMaintenanceWindow.DeserializeMySqlFlexibleServerMaintenanceWindow(property0.Value); continue; } + if (property0.NameEquals("importSourceProperties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + importSourceProperties = ImportSourceProperties.DeserializeImportSourceProperties(property0.Value); + continue; + } } continue; } } - return new MySqlFlexibleServerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, sku.Value, administratorLogin.Value, administratorLoginPassword.Value, Optional.ToNullable(version), availabilityZone.Value, Optional.ToNullable(createMode), sourceServerResourceId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(replicationRole), Optional.ToNullable(replicaCapacity), dataEncryption.Value, Optional.ToNullable(state), fullyQualifiedDomainName.Value, storage.Value, backup.Value, highAvailability.Value, network.Value, maintenanceWindow.Value); + return new MySqlFlexibleServerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, sku.Value, administratorLogin.Value, administratorLoginPassword.Value, Optional.ToNullable(version), availabilityZone.Value, Optional.ToNullable(createMode), sourceServerResourceId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(replicationRole), Optional.ToNullable(replicaCapacity), dataEncryption.Value, Optional.ToNullable(state), fullyQualifiedDomainName.Value, storage.Value, backup.Value, highAvailability.Value, network.Value, Optional.ToList(privateEndpointConnections), maintenanceWindow.Value, importSourceProperties.Value); } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerGtidSetContent.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerGtidSetContent.cs index 9a32b2b489372..11bb19ca3b6bd 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerGtidSetContent.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServerGtidSetContent.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.MySql.FlexibleServers.Models { - /// Server gtid set parameters. + /// Server Gtid set parameters. public partial class MySqlFlexibleServerGtidSetContent { /// Initializes a new instance of MySqlFlexibleServerGtidSetContent. @@ -15,7 +15,7 @@ public MySqlFlexibleServerGtidSetContent() { } - /// The gtid set of server. + /// The Gtid set of server. public string GtidSet { get; set; } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersCapabilityData.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersCapabilityData.Serialization.cs new file mode 100644 index 0000000000000..b0d59f9225da1 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersCapabilityData.Serialization.cs @@ -0,0 +1,124 @@ +// 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.Models; +using Azure.ResourceManager.MySql.FlexibleServers.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers +{ + public partial class MySqlFlexibleServersCapabilityData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MySqlFlexibleServersCapabilityData DeserializeMySqlFlexibleServersCapabilityData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional> supportedGeoBackupRegions = default; + Optional> supportedFlexibleServerEditions = default; + Optional> supportedServerVersions = default; + foreach (var property in element.EnumerateObject()) + { + 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("supportedGeoBackupRegions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + supportedGeoBackupRegions = array; + continue; + } + if (property0.NameEquals("supportedFlexibleServerEditions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ServerEditionCapabilityV2.DeserializeServerEditionCapabilityV2(item)); + } + supportedFlexibleServerEditions = array; + continue; + } + if (property0.NameEquals("supportedServerVersions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ServerVersionCapabilityV2.DeserializeServerVersionCapabilityV2(item)); + } + supportedServerVersions = array; + continue; + } + } + continue; + } + } + return new MySqlFlexibleServersCapabilityData(id, name, type, systemData.Value, Optional.ToList(supportedGeoBackupRegions), Optional.ToList(supportedFlexibleServerEditions), Optional.ToList(supportedServerVersions)); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnection.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnection.Serialization.cs new file mode 100644 index 0000000000000..e5a76f6d67b74 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnection.Serialization.cs @@ -0,0 +1,134 @@ +// 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.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + public partial class MySqlFlexibleServersPrivateEndpointConnection : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"u8); + JsonSerializer.Serialize(writer, PrivateEndpoint); + } + if (Optional.IsDefined(ConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(ConnectionState); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MySqlFlexibleServersPrivateEndpointConnection DeserializeMySqlFlexibleServersPrivateEndpointConnection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional> groupIds = default; + Optional privateEndpoint = default; + Optional privateLinkServiceConnectionState = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + 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("groupIds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + groupIds = array; + continue; + } + if (property0.NameEquals("privateEndpoint"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateEndpoint = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("privateLinkServiceConnectionState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateLinkServiceConnectionState = MySqlFlexibleServersPrivateLinkServiceConnectionState.DeserializeMySqlFlexibleServersPrivateLinkServiceConnectionState(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new MySqlFlexibleServersPrivateEndpointConnection(id, name, type, systemData.Value, Optional.ToList(groupIds), privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnection.cs new file mode 100644 index 0000000000000..0708b0f788a11 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnection.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// The private endpoint connection resource. + public partial class MySqlFlexibleServersPrivateEndpointConnection : ResourceData + { + /// Initializes a new instance of MySqlFlexibleServersPrivateEndpointConnection. + public MySqlFlexibleServersPrivateEndpointConnection() + { + GroupIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of MySqlFlexibleServersPrivateEndpointConnection. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The group ids for the private endpoint resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. + internal MySqlFlexibleServersPrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList groupIds, SubResource privateEndpoint, MySqlFlexibleServersPrivateLinkServiceConnectionState connectionState, MySqlFlexibleServersPrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + GroupIds = groupIds; + PrivateEndpoint = privateEndpoint; + ConnectionState = connectionState; + ProvisioningState = provisioningState; + } + + /// The group ids for the private endpoint resource. + public IReadOnlyList GroupIds { get; } + /// The private endpoint resource. + internal SubResource PrivateEndpoint { get; set; } + /// Gets Id. + public ResourceIdentifier PrivateEndpointId + { + get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; + } + + /// A collection of information about the state of the connection between service consumer and provider. + public MySqlFlexibleServersPrivateLinkServiceConnectionState ConnectionState { get; set; } + /// The provisioning state of the private endpoint connection resource. + public MySqlFlexibleServersPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnectionProvisioningState.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 0000000000000..0b2e50c0d650e --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// The current provisioning state. + public readonly partial struct MySqlFlexibleServersPrivateEndpointConnectionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string CreatingValue = "Creating"; + private const string DeletingValue = "Deleting"; + private const string FailedValue = "Failed"; + + /// Succeeded. + public static MySqlFlexibleServersPrivateEndpointConnectionProvisioningState Succeeded { get; } = new MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(SucceededValue); + /// Creating. + public static MySqlFlexibleServersPrivateEndpointConnectionProvisioningState Creating { get; } = new MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(CreatingValue); + /// Deleting. + public static MySqlFlexibleServersPrivateEndpointConnectionProvisioningState Deleting { get; } = new MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(DeletingValue); + /// Failed. + public static MySqlFlexibleServersPrivateEndpointConnectionProvisioningState Failed { get; } = new MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(MySqlFlexibleServersPrivateEndpointConnectionProvisioningState left, MySqlFlexibleServersPrivateEndpointConnectionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MySqlFlexibleServersPrivateEndpointConnectionProvisioningState left, MySqlFlexibleServersPrivateEndpointConnectionProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(string value) => new MySqlFlexibleServersPrivateEndpointConnectionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MySqlFlexibleServersPrivateEndpointConnectionProvisioningState other && Equals(other); + /// + public bool Equals(MySqlFlexibleServersPrivateEndpointConnectionProvisioningState 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/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointServiceConnectionStatus.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 0000000000000..a3f537c2a75e1 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateEndpointServiceConnectionStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// The private endpoint connection status. + public readonly partial struct MySqlFlexibleServersPrivateEndpointServiceConnectionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MySqlFlexibleServersPrivateEndpointServiceConnectionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string ApprovedValue = "Approved"; + private const string RejectedValue = "Rejected"; + + /// Pending. + public static MySqlFlexibleServersPrivateEndpointServiceConnectionStatus Pending { get; } = new MySqlFlexibleServersPrivateEndpointServiceConnectionStatus(PendingValue); + /// Approved. + public static MySqlFlexibleServersPrivateEndpointServiceConnectionStatus Approved { get; } = new MySqlFlexibleServersPrivateEndpointServiceConnectionStatus(ApprovedValue); + /// Rejected. + public static MySqlFlexibleServersPrivateEndpointServiceConnectionStatus Rejected { get; } = new MySqlFlexibleServersPrivateEndpointServiceConnectionStatus(RejectedValue); + /// Determines if two values are the same. + public static bool operator ==(MySqlFlexibleServersPrivateEndpointServiceConnectionStatus left, MySqlFlexibleServersPrivateEndpointServiceConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MySqlFlexibleServersPrivateEndpointServiceConnectionStatus left, MySqlFlexibleServersPrivateEndpointServiceConnectionStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MySqlFlexibleServersPrivateEndpointServiceConnectionStatus(string value) => new MySqlFlexibleServersPrivateEndpointServiceConnectionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MySqlFlexibleServersPrivateEndpointServiceConnectionStatus other && Equals(other); + /// + public bool Equals(MySqlFlexibleServersPrivateEndpointServiceConnectionStatus 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/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateLinkServiceConnectionState.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateLinkServiceConnectionState.Serialization.cs new file mode 100644 index 0000000000000..2e5324007df46 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateLinkServiceConnectionState.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + public partial class MySqlFlexibleServersPrivateLinkServiceConnectionState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(ActionsRequired)) + { + writer.WritePropertyName("actionsRequired"u8); + writer.WriteStringValue(ActionsRequired); + } + writer.WriteEndObject(); + } + + internal static MySqlFlexibleServersPrivateLinkServiceConnectionState DeserializeMySqlFlexibleServersPrivateLinkServiceConnectionState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional description = default; + Optional actionsRequired = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new MySqlFlexibleServersPrivateEndpointServiceConnectionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionsRequired"u8)) + { + actionsRequired = property.Value.GetString(); + continue; + } + } + return new MySqlFlexibleServersPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateLinkServiceConnectionState.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateLinkServiceConnectionState.cs new file mode 100644 index 0000000000000..f569c8a13316c --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/MySqlFlexibleServersPrivateLinkServiceConnectionState.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// A collection of information about the state of the connection between service consumer and provider. + public partial class MySqlFlexibleServersPrivateLinkServiceConnectionState + { + /// Initializes a new instance of MySqlFlexibleServersPrivateLinkServiceConnectionState. + public MySqlFlexibleServersPrivateLinkServiceConnectionState() + { + } + + /// Initializes a new instance of MySqlFlexibleServersPrivateLinkServiceConnectionState. + /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + /// The reason for approval/rejection of the connection. + /// A message indicating if changes on the service provider require any updates on the consumer. + internal MySqlFlexibleServersPrivateLinkServiceConnectionState(MySqlFlexibleServersPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + } + + /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + public MySqlFlexibleServersPrivateEndpointServiceConnectionStatus? Status { get; set; } + /// The reason for approval/rejection of the connection. + public string Description { get; set; } + /// A message indicating if changes on the service provider require any updates on the consumer. + public string ActionsRequired { get; set; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusExtendedResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusExtendedResult.Serialization.cs new file mode 100644 index 0000000000000..d2ee7898439c3 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusExtendedResult.Serialization.cs @@ -0,0 +1,139 @@ +// 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; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + public partial class OperationStatusExtendedResult + { + internal static OperationStatusExtendedResult DeserializeOperationStatusExtendedResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> properties = default; + Optional id = default; + Optional resourceId = default; + Optional name = default; + string status = default; + Optional percentComplete = default; + Optional startTime = default; + Optional endTime = default; + Optional> operations = default; + Optional error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + properties = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("operations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeOperationStatusResult(item)); + } + operations = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new OperationStatusExtendedResult(id.Value, resourceId.Value, name.Value, status, Optional.ToNullable(percentComplete), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToList(operations), error.Value, Optional.ToDictionary(properties)); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusExtendedResult.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusExtendedResult.cs new file mode 100644 index 0000000000000..9208a95c435f7 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusExtendedResult.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// Represents Operation Results API Response. + public partial class OperationStatusExtendedResult : OperationStatusResult + { + /// Initializes a new instance of OperationStatusExtendedResult. + /// Operation status. + /// is null. + internal OperationStatusExtendedResult(string status) : base(status) + { + Argument.AssertNotNull(status, nameof(status)); + + Properties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of OperationStatusExtendedResult. + /// Fully qualified ID for the async operation. + /// Fully qualified ID of the resource against which the original async operation was started. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// The extended properties of Operation Results. + internal OperationStatusExtendedResult(ResourceIdentifier id, ResourceIdentifier resourceId, string name, string status, float? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error, IReadOnlyDictionary properties) : base(id, resourceId, name, status, percentComplete, startOn, endOn, operations, error) + { + Properties = properties; + } + + /// + /// The extended properties of Operation Results + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IReadOnlyDictionary Properties { get; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusResult.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusResult.Serialization.cs new file mode 100644 index 0000000000000..1df10b1e6db8f --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusResult.Serialization.cs @@ -0,0 +1,117 @@ +// 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; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + public partial class OperationStatusResult + { + internal static OperationStatusResult DeserializeOperationStatusResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional resourceId = default; + Optional name = default; + string status = default; + Optional percentComplete = default; + Optional startTime = default; + Optional endTime = default; + Optional> operations = default; + Optional error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("operations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeOperationStatusResult(item)); + } + operations = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new OperationStatusResult(id.Value, resourceId.Value, name.Value, status, Optional.ToNullable(percentComplete), Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToList(operations), error.Value); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusResult.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusResult.cs new file mode 100644 index 0000000000000..3bfde0fb8a7a3 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/OperationStatusResult.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// The current status of an async operation. + public partial class OperationStatusResult + { + /// Initializes a new instance of OperationStatusResult. + /// Operation status. + /// is null. + internal OperationStatusResult(string status) + { + Argument.AssertNotNull(status, nameof(status)); + + Status = status; + Operations = new ChangeTrackingList(); + } + + /// Initializes a new instance of OperationStatusResult. + /// Fully qualified ID for the async operation. + /// Fully qualified ID of the resource against which the original async operation was started. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + internal OperationStatusResult(ResourceIdentifier id, ResourceIdentifier resourceId, string name, string status, float? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error) + { + Id = id; + ResourceId = resourceId; + Name = name; + Status = status; + PercentComplete = percentComplete; + StartOn = startOn; + EndOn = endOn; + Operations = operations; + Error = error; + } + + /// Fully qualified ID for the async operation. + public ResourceIdentifier Id { get; } + /// Fully qualified ID of the resource against which the original async operation was started. + public ResourceIdentifier ResourceId { get; } + /// Name of the async operation. + public string Name { get; } + /// Operation status. + public string Status { get; } + /// Percent of the operation that is complete. + public float? PercentComplete { get; } + /// The start time of the operation. + public DateTimeOffset? StartOn { get; } + /// The end time of the operation. + public DateTimeOffset? EndOn { get; } + /// The operations list. + public IReadOnlyList Operations { get; } + /// If present, details of the operation error. + public ResponseError Error { get; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerEditionCapabilityV2.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerEditionCapabilityV2.Serialization.cs new file mode 100644 index 0000000000000..d901576f4c493 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerEditionCapabilityV2.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + public partial class ServerEditionCapabilityV2 + { + internal static ServerEditionCapabilityV2 DeserializeServerEditionCapabilityV2(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional defaultSku = default; + Optional defaultStorageSize = default; + Optional> supportedStorageEditions = default; + Optional> supportedSkus = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultSku"u8)) + { + defaultSku = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultStorageSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultStorageSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("supportedStorageEditions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MySqlFlexibleServerStorageEditionCapability.DeserializeMySqlFlexibleServerStorageEditionCapability(item)); + } + supportedStorageEditions = array; + continue; + } + if (property.NameEquals("supportedSkus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SkuCapabilityV2.DeserializeSkuCapabilityV2(item)); + } + supportedSkus = array; + continue; + } + } + return new ServerEditionCapabilityV2(name.Value, defaultSku.Value, Optional.ToNullable(defaultStorageSize), Optional.ToList(supportedStorageEditions), Optional.ToList(supportedSkus)); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerEditionCapabilityV2.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerEditionCapabilityV2.cs new file mode 100644 index 0000000000000..0e0b0647a8f32 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerEditionCapabilityV2.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// Server edition capabilities. + public partial class ServerEditionCapabilityV2 + { + /// Initializes a new instance of ServerEditionCapabilityV2. + internal ServerEditionCapabilityV2() + { + SupportedStorageEditions = new ChangeTrackingList(); + SupportedSkus = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServerEditionCapabilityV2. + /// Server edition name. + /// Default Sku name. + /// Default storage size. + /// A list of supported storage editions. + /// A list of supported Skus. + internal ServerEditionCapabilityV2(string name, string defaultSku, int? defaultStorageSize, IReadOnlyList supportedStorageEditions, IReadOnlyList supportedSkus) + { + Name = name; + DefaultSku = defaultSku; + DefaultStorageSize = defaultStorageSize; + SupportedStorageEditions = supportedStorageEditions; + SupportedSkus = supportedSkus; + } + + /// Server edition name. + public string Name { get; } + /// Default Sku name. + public string DefaultSku { get; } + /// Default storage size. + public int? DefaultStorageSize { get; } + /// A list of supported storage editions. + public IReadOnlyList SupportedStorageEditions { get; } + /// A list of supported Skus. + public IReadOnlyList SupportedSkus { get; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerVersionCapabilityV2.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerVersionCapabilityV2.Serialization.cs new file mode 100644 index 0000000000000..40b9dd4356074 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerVersionCapabilityV2.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + public partial class ServerVersionCapabilityV2 + { + internal static ServerVersionCapabilityV2 DeserializeServerVersionCapabilityV2(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + } + return new ServerVersionCapabilityV2(name.Value); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerVersionCapabilityV2.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerVersionCapabilityV2.cs new file mode 100644 index 0000000000000..66ca42f228fac --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/ServerVersionCapabilityV2.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// Server version capabilities. + public partial class ServerVersionCapabilityV2 + { + /// Initializes a new instance of ServerVersionCapabilityV2. + internal ServerVersionCapabilityV2() + { + } + + /// Initializes a new instance of ServerVersionCapabilityV2. + /// server version. + internal ServerVersionCapabilityV2(string name) + { + Name = name; + } + + /// server version. + public string Name { get; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/SkuCapabilityV2.Serialization.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/SkuCapabilityV2.Serialization.cs new file mode 100644 index 0000000000000..e4d7a5d69522b --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/SkuCapabilityV2.Serialization.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + public partial class SkuCapabilityV2 + { + internal static SkuCapabilityV2 DeserializeSkuCapabilityV2(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional vCores = default; + Optional supportedIops = default; + Optional supportedMemoryPerVCoreMB = default; + Optional> supportedZones = default; + Optional> supportedHAMode = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("vCores"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vCores = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("supportedIops"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + supportedIops = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("supportedMemoryPerVCoreMB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + supportedMemoryPerVCoreMB = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("supportedZones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + supportedZones = array; + continue; + } + if (property.NameEquals("supportedHAMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + supportedHAMode = array; + continue; + } + } + return new SkuCapabilityV2(name.Value, Optional.ToNullable(vCores), Optional.ToNullable(supportedIops), Optional.ToNullable(supportedMemoryPerVCoreMB), Optional.ToList(supportedZones), Optional.ToList(supportedHAMode)); + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/SkuCapabilityV2.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/SkuCapabilityV2.cs new file mode 100644 index 0000000000000..d4c5cd6b9cdcb --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Models/SkuCapabilityV2.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.MySql.FlexibleServers.Models +{ + /// Sku capability. + public partial class SkuCapabilityV2 + { + /// Initializes a new instance of SkuCapabilityV2. + internal SkuCapabilityV2() + { + SupportedZones = new ChangeTrackingList(); + SupportedHAMode = new ChangeTrackingList(); + } + + /// Initializes a new instance of SkuCapabilityV2. + /// vCore name. + /// supported vCores. + /// supported IOPS. + /// supported memory per vCore in MB. + /// Supported zones. + /// Supported high availability mode. + internal SkuCapabilityV2(string name, long? vCores, long? supportedIops, long? supportedMemoryPerVCoreMB, IReadOnlyList supportedZones, IReadOnlyList supportedHAMode) + { + Name = name; + VCores = vCores; + SupportedIops = supportedIops; + SupportedMemoryPerVCoreMB = supportedMemoryPerVCoreMB; + SupportedZones = supportedZones; + SupportedHAMode = supportedHAMode; + } + + /// vCore name. + public string Name { get; } + /// supported vCores. + public long? VCores { get; } + /// supported IOPS. + public long? SupportedIops { get; } + /// supported memory per vCore in MB. + public long? SupportedMemoryPerVCoreMB { get; } + /// Supported zones. + public IReadOnlyList SupportedZones { get; } + /// Supported high availability mode. + public IReadOnlyList SupportedHAMode { get; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerAadAdministratorResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerAadAdministratorResource.cs index 82b52754dd193..7dc41ddaf6ebd 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerAadAdministratorResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerAadAdministratorResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.MySql.FlexibleServers public partial class MySqlFlexibleServerAadAdministratorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The administratorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, MySqlFlexibleServerAdministratorName administratorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerBackupResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerBackupResource.cs index b4e03fc7a91ee..43d2e28655cda 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerBackupResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerBackupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql.FlexibleServers public partial class MySqlFlexibleServerBackupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The backupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string backupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backups/{backupName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerConfigurationResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerConfigurationResource.cs index 45c9e5095c6ea..4ac9a86cd90e5 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerConfigurationResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql.FlexibleServers public partial class MySqlFlexibleServerConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/configurations/{configurationName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerData.cs index 2e06ccb2fc9dc..bb123982da888 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerData.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerData.cs @@ -23,6 +23,7 @@ public partial class MySqlFlexibleServerData : TrackedResourceData /// The location. public MySqlFlexibleServerData(AzureLocation location) : base(location) { + PrivateEndpointConnections = new ChangeTrackingList(); } /// Initializes a new instance of MySqlFlexibleServerData. @@ -50,8 +51,10 @@ public MySqlFlexibleServerData(AzureLocation location) : base(location) /// Backup related properties of a server. /// High availability related properties of a server. /// Network related properties of a server. + /// PrivateEndpointConnections related properties of a server. /// Maintenance window of a server. - internal MySqlFlexibleServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, MySqlFlexibleServerSku sku, string administratorLogin, string administratorLoginPassword, MySqlFlexibleServerVersion? version, string availabilityZone, MySqlFlexibleServerCreateMode? createMode, ResourceIdentifier sourceServerResourceId, DateTimeOffset? restorePointInTime, MySqlFlexibleServerReplicationRole? replicationRole, int? replicaCapacity, MySqlFlexibleServerDataEncryption dataEncryption, MySqlFlexibleServerState? state, string fullyQualifiedDomainName, MySqlFlexibleServerStorage storage, MySqlFlexibleServerBackupProperties backup, MySqlFlexibleServerHighAvailability highAvailability, MySqlFlexibleServerNetwork network, MySqlFlexibleServerMaintenanceWindow maintenanceWindow) : base(id, name, resourceType, systemData, tags, location) + /// Source properties for import from storage. + internal MySqlFlexibleServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, MySqlFlexibleServerSku sku, string administratorLogin, string administratorLoginPassword, MySqlFlexibleServerVersion? version, string availabilityZone, MySqlFlexibleServerCreateMode? createMode, ResourceIdentifier sourceServerResourceId, DateTimeOffset? restorePointInTime, MySqlFlexibleServerReplicationRole? replicationRole, int? replicaCapacity, MySqlFlexibleServerDataEncryption dataEncryption, MySqlFlexibleServerState? state, string fullyQualifiedDomainName, MySqlFlexibleServerStorage storage, MySqlFlexibleServerBackupProperties backup, MySqlFlexibleServerHighAvailability highAvailability, MySqlFlexibleServerNetwork network, IReadOnlyList privateEndpointConnections, MySqlFlexibleServerMaintenanceWindow maintenanceWindow, ImportSourceProperties importSourceProperties) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; Sku = sku; @@ -71,7 +74,9 @@ internal MySqlFlexibleServerData(ResourceIdentifier id, string name, ResourceTyp Backup = backup; HighAvailability = highAvailability; Network = network; + PrivateEndpointConnections = privateEndpointConnections; MaintenanceWindow = maintenanceWindow; + ImportSourceProperties = importSourceProperties; } /// The cmk identity for the server. Current supported identity types: UserAssigned. @@ -110,7 +115,11 @@ internal MySqlFlexibleServerData(ResourceIdentifier id, string name, ResourceTyp public MySqlFlexibleServerHighAvailability HighAvailability { get; set; } /// Network related properties of a server. public MySqlFlexibleServerNetwork Network { get; set; } + /// PrivateEndpointConnections related properties of a server. + public IReadOnlyList PrivateEndpointConnections { get; } /// Maintenance window of a server. public MySqlFlexibleServerMaintenanceWindow MaintenanceWindow { get; set; } + /// Source properties for import from storage. + public ImportSourceProperties ImportSourceProperties { get; set; } } } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerDatabaseResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerDatabaseResource.cs index a9c7fde2e8d4d..545ad71b1c93f 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerDatabaseResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerDatabaseResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql.FlexibleServers public partial class MySqlFlexibleServerDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/databases/{databaseName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerFirewallRuleResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerFirewallRuleResource.cs index bb8e5713257be..0941433b2d4b7 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerFirewallRuleResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.MySql.FlexibleServers public partial class MySqlFlexibleServerFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerResource.cs index 6519b6ad1ebcf..5a91ac5d0b7d8 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.MySql.FlexibleServers public partial class MySqlFlexibleServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}"; @@ -41,6 +44,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly BackupAndExportRestOperations _backupAndExportRestClient; private readonly ClientDiagnostics _mySqlFlexibleServerConfigurationConfigurationsClientDiagnostics; private readonly ConfigurationsRestOperations _mySqlFlexibleServerConfigurationConfigurationsRestClient; + private readonly ClientDiagnostics _serversMigrationClientDiagnostics; + private readonly ServersMigrationRestOperations _serversMigrationRestClient; private readonly ClientDiagnostics _logFilesClientDiagnostics; private readonly LogFilesRestOperations _logFilesRestClient; private readonly MySqlFlexibleServerData _data; @@ -72,6 +77,8 @@ internal MySqlFlexibleServerResource(ArmClient client, ResourceIdentifier id) : _mySqlFlexibleServerConfigurationConfigurationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", MySqlFlexibleServerConfigurationResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(MySqlFlexibleServerConfigurationResource.ResourceType, out string mySqlFlexibleServerConfigurationConfigurationsApiVersion); _mySqlFlexibleServerConfigurationConfigurationsRestClient = new ConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, mySqlFlexibleServerConfigurationConfigurationsApiVersion); + _serversMigrationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _serversMigrationRestClient = new ServersMigrationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _logFilesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); _logFilesRestClient = new LogFilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG @@ -107,7 +114,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MySqlFlexibleServerAadAdministratorResources and their operations over a MySqlFlexibleServerAadAdministratorResource. public virtual MySqlFlexibleServerAadAdministratorCollection GetMySqlFlexibleServerAadAdministrators() { - return GetCachedClient(Client => new MySqlFlexibleServerAadAdministratorCollection(Client, Id)); + return GetCachedClient(client => new MySqlFlexibleServerAadAdministratorCollection(client, Id)); } /// @@ -156,7 +163,7 @@ public virtual Response GetMySqlFle /// An object representing collection of MySqlFlexibleServerBackupResources and their operations over a MySqlFlexibleServerBackupResource. public virtual MySqlFlexibleServerBackupCollection GetMySqlFlexibleServerBackups() { - return GetCachedClient(Client => new MySqlFlexibleServerBackupCollection(Client, Id)); + return GetCachedClient(client => new MySqlFlexibleServerBackupCollection(client, Id)); } /// @@ -174,8 +181,8 @@ public virtual MySqlFlexibleServerBackupCollection GetMySqlFlexibleServerBackups /// /// The name of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlFlexibleServerBackupAsync(string backupName, CancellationToken cancellationToken = default) { @@ -197,8 +204,8 @@ public virtual async Task> GetMySqlF /// /// The name of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlFlexibleServerBackup(string backupName, CancellationToken cancellationToken = default) { @@ -209,7 +216,7 @@ public virtual Response GetMySqlFlexibleServe /// An object representing collection of MySqlFlexibleServerConfigurationResources and their operations over a MySqlFlexibleServerConfigurationResource. public virtual MySqlFlexibleServerConfigurationCollection GetMySqlFlexibleServerConfigurations() { - return GetCachedClient(Client => new MySqlFlexibleServerConfigurationCollection(Client, Id)); + return GetCachedClient(client => new MySqlFlexibleServerConfigurationCollection(client, Id)); } /// @@ -227,8 +234,8 @@ public virtual MySqlFlexibleServerConfigurationCollection GetMySqlFlexibleServer /// /// The name of the server configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlFlexibleServerConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -250,8 +257,8 @@ public virtual async Task> Ge /// /// The name of the server configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlFlexibleServerConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -262,7 +269,7 @@ public virtual Response GetMySqlFlexib /// An object representing collection of MySqlFlexibleServerDatabaseResources and their operations over a MySqlFlexibleServerDatabaseResource. public virtual MySqlFlexibleServerDatabaseCollection GetMySqlFlexibleServerDatabases() { - return GetCachedClient(Client => new MySqlFlexibleServerDatabaseCollection(Client, Id)); + return GetCachedClient(client => new MySqlFlexibleServerDatabaseCollection(client, Id)); } /// @@ -280,8 +287,8 @@ public virtual MySqlFlexibleServerDatabaseCollection GetMySqlFlexibleServerDatab /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlFlexibleServerDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -303,8 +310,8 @@ public virtual async Task> GetMySq /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlFlexibleServerDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -315,7 +322,7 @@ public virtual Response GetMySqlFlexibleSer /// An object representing collection of MySqlFlexibleServerFirewallRuleResources and their operations over a MySqlFlexibleServerFirewallRuleResource. public virtual MySqlFlexibleServerFirewallRuleCollection GetMySqlFlexibleServerFirewallRules() { - return GetCachedClient(Client => new MySqlFlexibleServerFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new MySqlFlexibleServerFirewallRuleCollection(client, Id)); } /// @@ -333,8 +340,8 @@ public virtual MySqlFlexibleServerFirewallRuleCollection GetMySqlFlexibleServerF /// /// The name of the server firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMySqlFlexibleServerFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -356,8 +363,8 @@ public virtual async Task> Get /// /// The name of the server firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMySqlFlexibleServerFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -1140,6 +1147,74 @@ public virtual ArmOperation ResetGtid(WaitUntil waitUntil, MySqlFlexibleServerGt } } + /// + /// Cutover migration for MySQL import, it will switch source elastic server DNS to flexible server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/cutoverMigration + /// + /// + /// Operation Id + /// ServersMigration_CutoverMigration + /// + /// + /// + /// 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> CutoverMigrationServersMigrationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serversMigrationClientDiagnostics.CreateScope("MySqlFlexibleServerResource.CutoverMigrationServersMigration"); + scope.Start(); + try + { + var response = await _serversMigrationRestClient.CutoverMigrationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new FlexibleServersArmOperation(new MySqlFlexibleServerOperationSource(Client), _serversMigrationClientDiagnostics, Pipeline, _serversMigrationRestClient.CreateCutoverMigrationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Cutover migration for MySQL import, it will switch source elastic server DNS to flexible server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/cutoverMigration + /// + /// + /// Operation Id + /// ServersMigration_CutoverMigration + /// + /// + /// + /// 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 CutoverMigrationServersMigration(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _serversMigrationClientDiagnostics.CreateScope("MySqlFlexibleServerResource.CutoverMigrationServersMigration"); + scope.Start(); + try + { + var response = _serversMigrationRestClient.CutoverMigration(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new FlexibleServersArmOperation(new MySqlFlexibleServerOperationSource(Client), _serversMigrationClientDiagnostics, Pipeline, _serversMigrationRestClient.CreateCutoverMigrationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// List all the server log files in a given server. /// diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityCollection.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityCollection.cs new file mode 100644 index 0000000000000..a5976a3136c73 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityCollection.cs @@ -0,0 +1,337 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.MySql.FlexibleServers +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetMySqlFlexibleServersCapabilities method from an instance of . + /// + public partial class MySqlFlexibleServersCapabilityCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics; + private readonly LocationBasedCapabilitySetRestOperations _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient; + private readonly AzureLocation _locationName; + + /// Initializes a new instance of the class for mocking. + protected MySqlFlexibleServersCapabilityCollection() + { + } + + /// 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. + /// The name of the location. + internal MySqlFlexibleServersCapabilityCollection(ArmClient client, ResourceIdentifier id, AzureLocation locationName) : base(client, id) + { + _locationName = locationName; + _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", MySqlFlexibleServersCapabilityResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MySqlFlexibleServersCapabilityResource.ResourceType, out string mySqlFlexibleServersCapabilityLocationBasedCapabilitySetApiVersion); + _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient = new LocationBasedCapabilitySetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, mySqlFlexibleServersCapabilityLocationBasedCapabilitySetApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// Name of capability set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string capabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilitySetName, nameof(capabilitySetName)); + + using var scope = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics.CreateScope("MySqlFlexibleServersCapabilityCollection.Get"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_locationName), capabilitySetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServersCapabilityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// Name of capability set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string capabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilitySetName, nameof(capabilitySetName)); + + using var scope = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics.CreateScope("MySqlFlexibleServersCapabilityCollection.Get"); + scope.Start(); + try + { + var response = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.Get(Id.SubscriptionId, new AzureLocation(_locationName), capabilitySetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServersCapabilityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_List + /// + /// + /// + /// 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) => _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(_locationName)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_locationName)); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MySqlFlexibleServersCapabilityResource(Client, MySqlFlexibleServersCapabilityData.DeserializeMySqlFlexibleServersCapabilityData(e)), _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics, Pipeline, "MySqlFlexibleServersCapabilityCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_List + /// + /// + /// + /// 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) => _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(_locationName)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_locationName)); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MySqlFlexibleServersCapabilityResource(Client, MySqlFlexibleServersCapabilityData.DeserializeMySqlFlexibleServersCapabilityData(e)), _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics, Pipeline, "MySqlFlexibleServersCapabilityCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// Name of capability set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string capabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilitySetName, nameof(capabilitySetName)); + + using var scope = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics.CreateScope("MySqlFlexibleServersCapabilityCollection.Exists"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_locationName), capabilitySetName, 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}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// Name of capability set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string capabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilitySetName, nameof(capabilitySetName)); + + using var scope = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics.CreateScope("MySqlFlexibleServersCapabilityCollection.Exists"); + scope.Start(); + try + { + var response = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.Get(Id.SubscriptionId, new AzureLocation(_locationName), capabilitySetName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// Name of capability set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string capabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilitySetName, nameof(capabilitySetName)); + + using var scope = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics.CreateScope("MySqlFlexibleServersCapabilityCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_locationName), capabilitySetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServersCapabilityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// Name of capability set. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string capabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(capabilitySetName, nameof(capabilitySetName)); + + using var scope = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics.CreateScope("MySqlFlexibleServersCapabilityCollection.GetIfExists"); + scope.Start(); + try + { + var response = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.Get(Id.SubscriptionId, new AzureLocation(_locationName), capabilitySetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServersCapabilityResource(Client, response.Value), 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/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityData.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityData.cs new file mode 100644 index 0000000000000..15afd4dff5ffa --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.MySql.FlexibleServers.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers +{ + /// + /// A class representing the MySqlFlexibleServersCapability data model. + /// Represents a location capability set. + /// + public partial class MySqlFlexibleServersCapabilityData : ResourceData + { + /// Initializes a new instance of MySqlFlexibleServersCapabilityData. + public MySqlFlexibleServersCapabilityData() + { + SupportedGeoBackupRegions = new ChangeTrackingList(); + SupportedFlexibleServerEditions = new ChangeTrackingList(); + SupportedServerVersions = new ChangeTrackingList(); + } + + /// Initializes a new instance of MySqlFlexibleServersCapabilityData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// supported geo backup regions. + /// A list of supported flexible server editions. + /// A list of supported server versions. + internal MySqlFlexibleServersCapabilityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList supportedGeoBackupRegions, IReadOnlyList supportedFlexibleServerEditions, IReadOnlyList supportedServerVersions) : base(id, name, resourceType, systemData) + { + SupportedGeoBackupRegions = supportedGeoBackupRegions; + SupportedFlexibleServerEditions = supportedFlexibleServerEditions; + SupportedServerVersions = supportedServerVersions; + } + + /// supported geo backup regions. + public IReadOnlyList SupportedGeoBackupRegions { get; } + /// A list of supported flexible server editions. + public IReadOnlyList SupportedFlexibleServerEditions { get; } + /// A list of supported server versions. + public IReadOnlyList SupportedServerVersions { get; } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityResource.cs new file mode 100644 index 0000000000000..7c4663c94cd50 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServersCapabilityResource.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +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.MySql.FlexibleServers +{ + /// + /// A Class representing a MySqlFlexibleServersCapability along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetMySqlFlexibleServersCapabilityResource method. + /// Otherwise you can get one from its parent resource using the GetMySqlFlexibleServersCapability method. + /// + public partial class MySqlFlexibleServersCapabilityResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. + /// The capabilitySetName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation locationName, string capabilitySetName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics; + private readonly LocationBasedCapabilitySetRestOperations _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient; + private readonly MySqlFlexibleServersCapabilityData _data; + + /// Initializes a new instance of the class for mocking. + protected MySqlFlexibleServersCapabilityResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal MySqlFlexibleServersCapabilityResource(ArmClient client, MySqlFlexibleServersCapabilityData 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 MySqlFlexibleServersCapabilityResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MySql.FlexibleServers", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string mySqlFlexibleServersCapabilityLocationBasedCapabilitySetApiVersion); + _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient = new LocationBasedCapabilitySetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, mySqlFlexibleServersCapabilityLocationBasedCapabilitySetApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DBforMySQL/locations/capabilitySets"; + + /// 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 MySqlFlexibleServersCapabilityData 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 capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics.CreateScope("MySqlFlexibleServersCapabilityResource.Get"); + scope.Start(); + try + { + var response = await _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServersCapabilityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName} + /// + /// + /// Operation Id + /// LocationBasedCapabilitySet_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetClientDiagnostics.CreateScope("MySqlFlexibleServersCapabilityResource.Get"); + scope.Start(); + try + { + var response = _mySqlFlexibleServersCapabilityLocationBasedCapabilitySetRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MySqlFlexibleServersCapabilityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/AzureADAdministratorsRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/AzureADAdministratorsRestOperations.cs index a12fdd349fd73..20deb9120c40b 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/AzureADAdministratorsRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/AzureADAdministratorsRestOperations.cs @@ -33,7 +33,7 @@ public AzureADAdministratorsRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,7 +64,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates an existing Azure Active Directory administrator. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the Azure AD Administrator. @@ -93,7 +93,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates an existing Azure Active Directory administrator. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the Azure AD Administrator. @@ -144,7 +144,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes an Azure AD Administrator. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the Azure AD Administrator. @@ -171,7 +171,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes an Azure AD Administrator. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the Azure AD Administrator. @@ -220,7 +220,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets information about an azure ad administrator. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the Azure AD Administrator. @@ -252,7 +252,7 @@ public async Task> GetAsync(st } /// Gets information about an azure ad administrator. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the Azure AD Administrator. @@ -305,7 +305,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res } /// List all the AAD administrators in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -334,7 +334,7 @@ public async Task> ListB } /// List all the AAD administrators in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -378,7 +378,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// List all the AAD administrators in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -409,7 +409,7 @@ public async Task> ListB /// List all the AAD administrators in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/BackupAndExportRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/BackupAndExportRestOperations.cs index 86c32b42c562d..eda819449f381 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/BackupAndExportRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/BackupAndExportRestOperations.cs @@ -33,7 +33,7 @@ public BackupAndExportRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-30-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -63,7 +63,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Exports the backup of the given server by creating a backup if not existing. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for creating and exporting backup of the given server. @@ -90,7 +90,7 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Exports the backup of the given server by creating a backup if not existing. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for creating and exporting backup of the given server. @@ -138,7 +138,7 @@ internal HttpMessage CreateValidateBackupRequest(string subscriptionId, string r } /// Validates if backup can be performed for given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -167,7 +167,7 @@ public async Task> ValidateBac } /// Validates if backup can be performed for given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/BackupsRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/BackupsRestOperations.cs index 231f55054803f..774d5556587a6 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/BackupsRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/BackupsRestOperations.cs @@ -33,7 +33,7 @@ public BackupsRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-30-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -60,7 +60,7 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou } /// Create backup for a given server with specified backup name. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the backup. @@ -91,7 +91,7 @@ public async Task> PutAsync(string subsc } /// Create backup for a given server with specified backup name. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the backup. @@ -144,7 +144,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// List all the backups for a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the backup. @@ -177,7 +177,7 @@ public async Task> GetAsync(string subsc } /// List all the backups for a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the backup. @@ -231,7 +231,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res } /// List all the backups for a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -260,7 +260,7 @@ public async Task> ListByServerAsy } /// List all the backups for a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -304,7 +304,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// List all the backups for a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -335,7 +335,7 @@ public async Task> ListByServerNex /// List all the backups for a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs index 92249e9cbb915..cc997fa2e8e74 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs @@ -33,7 +33,7 @@ public CheckNameAvailabilityRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,7 +61,7 @@ internal HttpMessage CreateExecuteRequest(string subscriptionId, AzureLocation l } /// Check the availability of name for server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the location. /// The required parameters for checking if server name is available. /// The cancellation token to use. @@ -89,7 +89,7 @@ public async Task> ExecuteAs } /// Check the availability of name for server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the location. /// The required parameters for checking if server name is available. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityWithoutLocationRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityWithoutLocationRestOperations.cs index 5ef2f392e60e3..4719949941639 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityWithoutLocationRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckNameAvailabilityWithoutLocationRestOperations.cs @@ -33,7 +33,7 @@ public CheckNameAvailabilityWithoutLocationRestOperations(HttpPipeline pipeline, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,7 +59,7 @@ internal HttpMessage CreateExecuteRequest(string subscriptionId, MySqlFlexibleSe } /// Check the availability of name for server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The required parameters for checking if server name is available. /// The cancellation token to use. /// or is null. @@ -86,7 +86,7 @@ public async Task> ExecuteAs } /// Check the availability of name for server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The required parameters for checking if server name is available. /// The cancellation token to use. /// or is null. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckVirtualNetworkSubnetUsageRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckVirtualNetworkSubnetUsageRestOperations.cs index e159195841daf..e9f84313a0ceb 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckVirtualNetworkSubnetUsageRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/CheckVirtualNetworkSubnetUsageRestOperations.cs @@ -33,7 +33,7 @@ public CheckVirtualNetworkSubnetUsageRestOperations(HttpPipeline pipeline, strin { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -61,7 +61,7 @@ internal HttpMessage CreateExecuteRequest(string subscriptionId, AzureLocation l } /// Get virtual network subnet usage for a given vNet resource id. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the location. /// The required parameters for creating or updating a server. /// The cancellation token to use. @@ -89,7 +89,7 @@ public async Task> } /// Get virtual network subnet usage for a given vNet resource id. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the location. /// The required parameters for creating or updating a server. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ConfigurationsRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ConfigurationsRestOperations.cs index a4b10ec04da67..d6c326fdaae12 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ConfigurationsRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ConfigurationsRestOperations.cs @@ -33,7 +33,7 @@ public ConfigurationsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,7 +64,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Updates a configuration of a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server configuration. @@ -93,7 +93,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Updates a configuration of a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server configuration. @@ -148,7 +148,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates a configuration of a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server configuration. @@ -177,7 +177,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates a configuration of a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server configuration. @@ -228,7 +228,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets information about a configuration of server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server configuration. @@ -261,7 +261,7 @@ public async Task> GetAsync(strin } /// Gets information about a configuration of server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server configuration. @@ -319,7 +319,7 @@ internal HttpMessage CreateBatchUpdateRequest(string subscriptionId, string reso } /// Update a list of configurations in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The parameters for updating a list of server configuration. @@ -346,7 +346,7 @@ public async Task BatchUpdateAsync(string subscriptionId, string resou } /// Update a list of configurations in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The parameters for updating a list of server configuration. @@ -410,7 +410,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res } /// List all the configurations in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The tags of the server configuration. @@ -443,7 +443,7 @@ public async Task> ListBySe } /// List all the configurations in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The tags of the server configuration. @@ -491,7 +491,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// List all the configurations in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The tags of the server configuration. @@ -526,7 +526,7 @@ public async Task> ListBySe /// List all the configurations in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The tags of the server configuration. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/DatabasesRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/DatabasesRestOperations.cs index 1b0e1e66b8c58..0131cc8f5a34f 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/DatabasesRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/DatabasesRestOperations.cs @@ -33,7 +33,7 @@ public DatabasesRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,7 +64,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new database or updates an existing database. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the database. @@ -94,7 +94,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates a new database or updates an existing database. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the database. @@ -146,7 +146,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a database. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the database. @@ -174,7 +174,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a database. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the database. @@ -224,7 +224,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets information about a database. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the database. @@ -257,7 +257,7 @@ public async Task> GetAsync(string sub } /// Gets information about a database. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the database. @@ -311,7 +311,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res } /// List all the databases in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -340,7 +340,7 @@ public async Task> ListByServerA } /// List all the databases in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -384,7 +384,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// List all the databases in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -415,7 +415,7 @@ public async Task> ListByServerN /// List all the databases in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/FirewallRulesRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/FirewallRulesRestOperations.cs index 30461fbf0efe5..5e8419f28dd8f 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/FirewallRulesRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/FirewallRulesRestOperations.cs @@ -33,7 +33,7 @@ public FirewallRulesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,7 +64,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates a new firewall rule or updates an existing firewall rule. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server firewall rule. @@ -94,7 +94,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates a new firewall rule or updates an existing firewall rule. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server firewall rule. @@ -146,7 +146,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a firewall rule. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server firewall rule. @@ -174,7 +174,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a firewall rule. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server firewall rule. @@ -224,7 +224,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets information about a server firewall rule. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server firewall rule. @@ -257,7 +257,7 @@ public async Task> GetAsync(string } /// Gets information about a server firewall rule. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The name of the server firewall rule. @@ -311,7 +311,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res } /// List all the firewall rules in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -340,7 +340,7 @@ public async Task> ListBySer } /// List all the firewall rules in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -384,7 +384,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// List all the firewall rules in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -415,7 +415,7 @@ public async Task> ListBySer /// List all the firewall rules in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/GetPrivateDnsZoneSuffixRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/GetPrivateDnsZoneSuffixRestOperations.cs index a9cf582c25ced..6c71f0a2a7a42 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/GetPrivateDnsZoneSuffixRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/GetPrivateDnsZoneSuffixRestOperations.cs @@ -33,7 +33,7 @@ public GetPrivateDnsZoneSuffixRestOperations(HttpPipeline pipeline, string appli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LocationBasedCapabilitiesRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LocationBasedCapabilitiesRestOperations.cs index 4be0757eb6ca0..eb9e8599a25d8 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LocationBasedCapabilitiesRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LocationBasedCapabilitiesRestOperations.cs @@ -33,7 +33,7 @@ public LocationBasedCapabilitiesRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -57,7 +57,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, AzureLocation loca } /// Get capabilities at specified location in a given subscription. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the location. /// The cancellation token to use. /// is null. @@ -83,7 +83,7 @@ public async Task> ListAsync } /// Get capabilities at specified location in a given subscription. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the location. /// The cancellation token to use. /// is null. @@ -124,7 +124,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Get capabilities at specified location in a given subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the location. /// The cancellation token to use. /// or is null. @@ -152,7 +152,7 @@ public async Task> ListNextP /// Get capabilities at specified location in a given subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the location. /// The cancellation token to use. /// or is null. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LocationBasedCapabilitySetRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LocationBasedCapabilitySetRestOperations.cs new file mode 100644 index 0000000000000..acdd9afdb0167 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LocationBasedCapabilitySetRestOperations.cs @@ -0,0 +1,261 @@ +// 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.MySql.FlexibleServers.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers +{ + internal partial class LocationBasedCapabilitySetRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of LocationBasedCapabilitySetRestOperations. + /// 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 LocationBasedCapabilitySetRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, AzureLocation locationName) + { + 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.DBforMySQL/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/capabilitySets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get capabilities at specified location in a given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the location. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, AzureLocation locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, locationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CapabilitySetsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CapabilitySetsList.DeserializeCapabilitySetsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get capabilities at specified location in a given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the location. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, AzureLocation locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, locationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CapabilitySetsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CapabilitySetsList.DeserializeCapabilitySetsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation locationName, string capabilitySetName) + { + 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.DBforMySQL/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/capabilitySets/", false); + uri.AppendPath(capabilitySetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get capabilities at specified location in a given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the location. + /// Name of capability set. + /// 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, AzureLocation locationName, string capabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(capabilitySetName, nameof(capabilitySetName)); + + using var message = CreateGetRequest(subscriptionId, locationName, capabilitySetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MySqlFlexibleServersCapabilityData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MySqlFlexibleServersCapabilityData.DeserializeMySqlFlexibleServersCapabilityData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MySqlFlexibleServersCapabilityData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get capabilities at specified location in a given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the location. + /// Name of capability set. + /// 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, AzureLocation locationName, string capabilitySetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(capabilitySetName, nameof(capabilitySetName)); + + using var message = CreateGetRequest(subscriptionId, locationName, capabilitySetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MySqlFlexibleServersCapabilityData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MySqlFlexibleServersCapabilityData.DeserializeMySqlFlexibleServersCapabilityData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MySqlFlexibleServersCapabilityData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, AzureLocation locationName) + { + 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; + } + + /// Get capabilities at specified location in a given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the location. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, AzureLocation locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, locationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CapabilitySetsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CapabilitySetsList.DeserializeCapabilitySetsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get capabilities at specified location in a given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the location. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, AzureLocation locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, locationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CapabilitySetsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CapabilitySetsList.DeserializeCapabilitySetsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LogFilesRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LogFilesRestOperations.cs index 88b5c5630e3d5..c99379757cbe9 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LogFilesRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/LogFilesRestOperations.cs @@ -33,7 +33,7 @@ public LogFilesRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-12-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,7 +59,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res } /// List all the server log files in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -88,7 +88,7 @@ public async Task> ListByServerAs } /// List all the server log files in a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -132,7 +132,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// List all the server log files in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -163,7 +163,7 @@ public async Task> ListByServerNe /// List all the server log files in a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/OperationResultsRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/OperationResultsRestOperations.cs new file mode 100644 index 0000000000000..2c2da0e98d898 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/OperationResultsRestOperations.cs @@ -0,0 +1,116 @@ +// 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.MySql.FlexibleServers.Models; + +namespace Azure.ResourceManager.MySql.FlexibleServers +{ + internal partial class OperationResultsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OperationResultsRestOperations. + /// 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 OperationResultsRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation locationName, string operationId) + { + 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.DBforMySQL/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/operationResults/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the operation result for a long running operation. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the location. + /// The operation Id. + /// 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, AzureLocation locationName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, locationName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationStatusExtendedResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OperationStatusExtendedResult.DeserializeOperationStatusExtendedResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the operation result for a long running operation. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the location. + /// The operation Id. + /// 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, AzureLocation locationName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetRequest(subscriptionId, locationName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationStatusExtendedResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OperationStatusExtendedResult.DeserializeOperationStatusExtendedResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ReplicasRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ReplicasRestOperations.cs index afea9ca1bb1ef..2dcf5c0431455 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ReplicasRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ReplicasRestOperations.cs @@ -33,7 +33,7 @@ public ReplicasRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-30-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,7 +59,7 @@ internal HttpMessage CreateListByServerRequest(string subscriptionId, string res } /// List all the replicas for a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -88,7 +88,7 @@ public async Task> ListByServerAsync(str } /// List all the replicas for a given server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -132,7 +132,7 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string s /// List all the replicas for a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -163,7 +163,7 @@ public async Task> ListByServerNextPageA /// List all the replicas for a given server. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ServersMigrationRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ServersMigrationRestOperations.cs new file mode 100644 index 0000000000000..7ca6cf1e8f433 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ServersMigrationRestOperations.cs @@ -0,0 +1,109 @@ +// 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; + +namespace Azure.ResourceManager.MySql.FlexibleServers +{ + internal partial class ServersMigrationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ServersMigrationRestOperations. + /// 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 ServersMigrationRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateCutoverMigrationRequest(string subscriptionId, string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DBforMySQL/flexibleServers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/cutoverMigration", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Cutover migration for MySQL import, it will switch source elastic server DNS to flexible server. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the server. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CutoverMigrationAsync(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var message = CreateCutoverMigrationRequest(subscriptionId, resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Cutover migration for MySQL import, it will switch source elastic server DNS to flexible server. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the server. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CutoverMigration(string subscriptionId, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + + using var message = CreateCutoverMigrationRequest(subscriptionId, resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ServersRestOperations.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ServersRestOperations.cs index 7c6b8b914adb6..d08d160b1d60e 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ServersRestOperations.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/RestOperations/ServersRestOperations.cs @@ -33,7 +33,7 @@ public ServersRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-30-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -62,7 +62,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Creates a new server or updates an existing server. The update action will overwrite the existing server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for creating or updating a server. @@ -90,7 +90,7 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Creates a new server or updates an existing server. The update action will overwrite the existing server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for creating or updating a server. @@ -142,7 +142,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for updating a server. @@ -169,7 +169,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for updating a server. @@ -216,7 +216,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -242,7 +242,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -288,7 +288,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets information about a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -319,7 +319,7 @@ public async Task> GetAsync(string subscriptio } /// Gets information about a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -369,7 +369,7 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str } /// List all the servers in a given resource group. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// or is null. @@ -396,7 +396,7 @@ public async Task> ListByResourceGroupAs } /// List all the servers in a given resource group. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// or is null. @@ -440,7 +440,7 @@ internal HttpMessage CreateListRequest(string subscriptionId) } /// List all the servers in a given subscription. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -465,7 +465,7 @@ public async Task> ListAsync(string subs } /// List all the servers in a given subscription. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -511,7 +511,7 @@ internal HttpMessage CreateFailoverRequest(string subscriptionId, string resourc } /// Manual failover a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -536,7 +536,7 @@ public async Task FailoverAsync(string subscriptionId, string resource } /// Manual failover a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -586,7 +586,7 @@ internal HttpMessage CreateRestartRequest(string subscriptionId, string resource } /// Restarts a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for restarting a server. @@ -613,7 +613,7 @@ public async Task RestartAsync(string subscriptionId, string resourceG } /// Restarts a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for restarting a server. @@ -661,7 +661,7 @@ internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGr } /// Starts a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -686,7 +686,7 @@ public async Task StartAsync(string subscriptionId, string resourceGro } /// Starts a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -732,7 +732,7 @@ internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGro } /// Stops a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -757,7 +757,7 @@ public async Task StopAsync(string subscriptionId, string resourceGrou } /// Stops a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The cancellation token to use. @@ -807,7 +807,7 @@ internal HttpMessage CreateResetGtidRequest(string subscriptionId, string resour } /// Resets GTID on a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for resetting GTID on a server. @@ -834,7 +834,7 @@ public async Task ResetGtidAsync(string subscriptionId, string resourc } /// Resets GTID on a server. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the server. /// The required parameters for resetting GTID on a server. @@ -876,7 +876,7 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// List all the servers in a given resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -905,7 +905,7 @@ public async Task> ListByResourceGroupNe /// List all the servers in a given resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -948,7 +948,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// List all the servers in a given subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -975,7 +975,7 @@ public async Task> ListNextPageAsync(str /// List all the servers in a given subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/mysql/Azure.ResourceManager.MySql/src/autorest.md b/sdk/mysql/Azure.ResourceManager.MySql/src/autorest.md index 2603dbcb39013..c93c1183543b2 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/autorest.md +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/autorest.md @@ -8,17 +8,17 @@ csharp: true clear-output-folder: true skip-csproj: true library-name: MySql -#mgmt-debug: +#mgmt-debug: # show-serialized-names: true batch: - tag: package-2020-01-01 - - tag: package-flexibleserver-2022-09-30-preview + - tag: package-flexibleserver-2023-06-01-preview ``` ``` yaml $(tag) == 'package-2020-01-01' namespace: Azure.ResourceManager.MySql -require: https://github.com/Azure/azure-rest-api-specs/blob/4f6418dca8c15697489bbe6f855558bb79ca5bf5/specification/mysql/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/b7b77b11ba1f6defc86d309d4ca0d51b2a2646a7/specification/mysql/resource-manager/readme.md output-folder: $(this-folder)/MySql/Generated sample-gen: output-folder: $(this-folder)/../samples/Generated @@ -70,6 +70,7 @@ acronym-mapping: prepend-rp-prefix: - Advisor + - Capability - Configuration - Database - FirewallRule @@ -183,9 +184,11 @@ directive: ``` -``` yaml $(tag) == 'package-flexibleserver-2022-09-30-preview' +``` yaml $(tag) == 'package-flexibleserver-2023-06-01-preview' +input-file: +- https://github.com/Azure/azure-rest-api-specs/blob/b7b77b11ba1f6defc86d309d4ca0d51b2a2646a7/specification/common-types/resource-management/v5/privatelinks.json namespace: Azure.ResourceManager.MySql.FlexibleServers -require: https://github.com/Azure/azure-rest-api-specs/blob/6c6b16dc98d720304633b76c8e82c282ffa9cc08/specification/mysql/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/b7b77b11ba1f6defc86d309d4ca0d51b2a2646a7/specification/mysql/resource-manager/readme.md output-folder: $(this-folder)/MySqlFlexibleServers/Generated sample-gen: output-folder: $(this-folder)/../samples/Generated @@ -247,7 +250,7 @@ rename-mapping: MaintenanceWindow: MySqlFlexibleServerMaintenanceWindow Backup: MySqlFlexibleServerBackupProperties Storage: MySqlFlexibleServerStorage - Sku: MySqlFlexibleServerSku + MySQLServerSku: MySqlFlexibleServerSku Network: MySqlFlexibleServerNetwork HighAvailability: MySqlFlexibleServerHighAvailability HighAvailabilityMode: MySqlFlexibleServerHighAvailabilityMode @@ -280,7 +283,7 @@ rename-mapping: NameAvailability: MySqlFlexibleServerNameAvailabilityResult CreateMode: MySqlFlexibleServerCreateMode DataEncryptionType: MySqlFlexibleServerDataEncryptionType - SkuTier: MySqlFlexibleServerSkuTier + ServerSkuTier: MySqlFlexibleServerSkuTier IsReadOnly: MySqlFlexibleServerConfigReadOnlyState IsDynamicConfig: MySqlFlexibleServerConfigDynamicState IsConfigPendingRestart: MySqlFlexibleServerConfigPendingRestartState @@ -313,9 +316,10 @@ directive: - from: FlexibleServers.json where: $.definitions transform: > - $.Identity['x-ms-client-flatten'] = false; - $.Identity.properties.userAssignedIdentities.additionalProperties['$ref'] = '#/definitions/UserAssignedIdentity'; - delete $.Identity.properties.userAssignedIdentities.additionalProperties.items; + $.MySQLServerIdentity['x-ms-client-flatten'] = false; + $.MySQLServerIdentity.properties.userAssignedIdentities.additionalProperties['$ref'] = '#/definitions/UserAssignedIdentity'; + delete $.MySQLServerIdentity.properties.userAssignedIdentities.additionalProperties.items; + $.ServerProperties.properties.privateEndpointConnections.items['$ref'] = '../../../../../../common-types/resource-management/v5/privatelinks.json#/definitions/PrivateEndpointConnection'; # Add a new mode for update operation - from: Configurations.json diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/CHANGELOG.md b/sdk/netapp/Azure.ResourceManager.NetApp/CHANGELOG.md index f56e855e2b784..59e394386571c 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/CHANGELOG.md +++ b/sdk/netapp/Azure.ResourceManager.NetApp/CHANGELOG.md @@ -10,6 +10,11 @@ ### Other Changes +## 1.4.1 (Unreleased) + +### Bugs Fixed +- Fixed serialization issue when VolumeSnapshotProperties.SnapshotPolicyId is empty string + ## 1.4.0 (2023-10-19) - Updated to support ANF api-version 2023-05-01 ### Features Added diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/api/Azure.ResourceManager.NetApp.netstandard2.0.cs b/sdk/netapp/Azure.ResourceManager.NetApp/api/Azure.ResourceManager.NetApp.netstandard2.0.cs index 1675aa53336b3..dadc328b754a8 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/api/Azure.ResourceManager.NetApp.netstandard2.0.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/api/Azure.ResourceManager.NetApp.netstandard2.0.cs @@ -19,7 +19,7 @@ protected CapacityPoolCollection() { } } public partial class CapacityPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public CapacityPoolData(Azure.Core.AzureLocation location, long size, Azure.ResourceManager.NetApp.Models.NetAppFileServiceLevel serviceLevel) : base (default(Azure.Core.AzureLocation)) { } + public CapacityPoolData(Azure.Core.AzureLocation location, long size, Azure.ResourceManager.NetApp.Models.NetAppFileServiceLevel serviceLevel) { } public Azure.ResourceManager.NetApp.Models.CapacityPoolEncryptionType? EncryptionType { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } public bool? IsCoolAccessEnabled { get { throw null; } set { } } @@ -102,7 +102,7 @@ protected NetAppAccountCollection() { } } public partial class NetAppAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public NetAppAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetAppAccountData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList ActiveDirectories { get { throw null; } } public bool? DisableShowmount { get { throw null; } } public Azure.ResourceManager.NetApp.Models.NetAppAccountEncryption Encryption { get { throw null; } set { } } @@ -190,7 +190,7 @@ protected NetAppBackupPolicyCollection() { } } public partial class NetAppBackupPolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public NetAppBackupPolicyData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetAppBackupPolicyData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier BackupPolicyId { get { throw null; } } public int? DailyBackupsToKeep { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } @@ -363,7 +363,7 @@ protected NetAppVolumeCollection() { } } public partial class NetAppVolumeData : Azure.ResourceManager.Models.TrackedResourceData { - public NetAppVolumeData(Azure.Core.AzureLocation location, string creationToken, long usageThreshold, Azure.Core.ResourceIdentifier subnetId) : base (default(Azure.Core.AzureLocation)) { } + public NetAppVolumeData(Azure.Core.AzureLocation location, string creationToken, long usageThreshold, Azure.Core.ResourceIdentifier subnetId) { } public float? ActualThroughputMibps { get { throw null; } } public Azure.ResourceManager.NetApp.Models.NetAppAvsDataStore? AvsDataStore { get { throw null; } set { } } public string BackupId { get { throw null; } set { } } @@ -474,7 +474,7 @@ protected NetAppVolumeQuotaRuleCollection() { } } public partial class NetAppVolumeQuotaRuleData : Azure.ResourceManager.Models.TrackedResourceData { - public NetAppVolumeQuotaRuleData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetAppVolumeQuotaRuleData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NetApp.Models.NetAppProvisioningState? ProvisioningState { get { throw null; } } public long? QuotaSizeInKiBs { get { throw null; } set { } } public string QuotaTarget { get { throw null; } set { } } @@ -635,7 +635,7 @@ protected SnapshotPolicyCollection() { } } public partial class SnapshotPolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public SnapshotPolicyData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SnapshotPolicyData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NetApp.Models.SnapshotPolicyDailySchedule DailySchedule { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.NetApp.Models.SnapshotPolicyHourlySchedule HourlySchedule { get { throw null; } set { } } @@ -667,6 +667,55 @@ protected SnapshotPolicyResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.NetApp.Models.SnapshotPolicyPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.NetApp.Mocking +{ + public partial class MockableNetAppArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNetAppArmClient() { } + public virtual Azure.ResourceManager.NetApp.CapacityPoolResource GetCapacityPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.ResourceManager.NetApp.NetAppAccountBackupResource GetNetAppAccountBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetApp.NetAppAccountResource GetNetAppAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetApp.NetAppBackupPolicyResource GetNetAppBackupPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetApp.NetAppSubvolumeInfoResource GetNetAppSubvolumeInfoResource(Azure.Core.ResourceIdentifier id) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.ResourceManager.NetApp.NetAppVolumeBackupResource GetNetAppVolumeBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetApp.NetAppVolumeGroupResource GetNetAppVolumeGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetApp.NetAppVolumeQuotaRuleResource GetNetAppVolumeQuotaRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetApp.NetAppVolumeResource GetNetAppVolumeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetApp.NetAppVolumeSnapshotResource GetNetAppVolumeSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetApp.SnapshotPolicyResource GetSnapshotPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNetAppResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNetAppResourceGroupResource() { } + public virtual Azure.Response GetNetAppAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetAppAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetApp.NetAppAccountCollection GetNetAppAccounts() { throw null; } + } + public partial class MockableNetAppSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNetAppSubscriptionResource() { } + public virtual Azure.Response CheckNetAppFilePathAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.NetAppFilePathAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNetAppFilePathAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.NetAppFilePathAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckNetAppNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.NetAppNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNetAppNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.NetAppNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckNetAppQuotaAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.NetAppQuotaAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNetAppQuotaAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.NetAppQuotaAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetAppAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetAppAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetAppQuotaLimit(Azure.Core.AzureLocation location, string quotaLimitName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetAppQuotaLimitAsync(Azure.Core.AzureLocation location, string quotaLimitName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetAppQuotaLimits(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetAppQuotaLimitsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response QueryNetworkSiblingSetNetAppResource(Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.QueryNetworkSiblingSetContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> QueryNetworkSiblingSetNetAppResourceAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.QueryNetworkSiblingSetContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response QueryRegionInfoNetAppResource(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> QueryRegionInfoNetAppResourceAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation UpdateNetworkSiblingSetNetAppResource(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.UpdateNetworkSiblingSetContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateNetworkSiblingSetNetAppResourceAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.NetApp.Models.UpdateNetworkSiblingSetContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.NetApp.Models { public static partial class ArmNetAppModelFactory @@ -736,7 +785,7 @@ internal AvailabilityZoneMapping() { } } public partial class CapacityPoolPatch : Azure.ResourceManager.Models.TrackedResourceData { - public CapacityPoolPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CapacityPoolPatch(Azure.Core.AzureLocation location) { } public bool? IsCoolAccessEnabled { get { throw null; } set { } } public Azure.ResourceManager.NetApp.Models.CapacityPoolQosType? QosType { get { throw null; } set { } } public long? Size { get { throw null; } set { } } @@ -863,7 +912,7 @@ public NetAppAccountEncryption() { } } public partial class NetAppAccountPatch : Azure.ResourceManager.Models.TrackedResourceData { - public NetAppAccountPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetAppAccountPatch(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList ActiveDirectories { get { throw null; } } public bool? DisableShowmount { get { throw null; } } public Azure.ResourceManager.NetApp.Models.NetAppAccountEncryption Encryption { get { throw null; } set { } } @@ -908,7 +957,7 @@ public NetAppAccountPatch(Azure.Core.AzureLocation location) : base (default(Azu } public partial class NetAppBackupPolicyPatch : Azure.ResourceManager.Models.TrackedResourceData { - public NetAppBackupPolicyPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetAppBackupPolicyPatch(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier BackupPolicyId { get { throw null; } } public int? DailyBackupsToKeep { get { throw null; } set { } } public bool? IsEnabled { get { throw null; } set { } } @@ -1507,7 +1556,7 @@ internal NetAppVolumeMountTarget() { } } public partial class NetAppVolumePatch : Azure.ResourceManager.Models.TrackedResourceData { - public NetAppVolumePatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NetAppVolumePatch(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NetApp.Models.CoolAccessRetrievalPolicy? CoolAccessRetrievalPolicy { get { throw null; } set { } } public int? CoolnessPeriod { get { throw null; } set { } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1783,7 +1832,7 @@ public SnapshotPolicyMonthlySchedule() { } } public partial class SnapshotPolicyPatch : Azure.ResourceManager.Models.TrackedResourceData { - public SnapshotPolicyPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SnapshotPolicyPatch(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NetApp.Models.SnapshotPolicyDailySchedule DailySchedule { get { throw null; } set { } } public Azure.ResourceManager.NetApp.Models.SnapshotPolicyHourlySchedule HourlySchedule { get { throw null; } set { } } public bool? IsEnabled { get { throw null; } set { } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Custom/Extensions/MockableNetAppArmClient.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Custom/Extensions/MockableNetAppArmClient.cs new file mode 100644 index 0000000000000..982ccbd41e89b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Custom/Extensions/MockableNetAppArmClient.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.ComponentModel; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNetAppArmClient : ArmResource + { + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual NetAppAccountBackupResource GetNetAppAccountBackupResource(ResourceIdentifier id) + { + NetAppAccountBackupResource.ValidateResourceId(id); + return new NetAppAccountBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + [EditorBrowsable(EditorBrowsableState.Never)] + + public virtual NetAppVolumeBackupResource GetNetAppVolumeBackupResource(ResourceIdentifier id) + { + NetAppVolumeBackupResource.ValidateResourceId(id); + return new NetAppVolumeBackupResource(Client, id); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Custom/Extensions/NetAppExtensions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Custom/Extensions/NetAppExtensions.cs index c079cea4ed9ba..3f6a3255f77a2 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Custom/Extensions/NetAppExtensions.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Custom/Extensions/NetAppExtensions.cs @@ -18,7 +18,6 @@ namespace Azure.ResourceManager.NetApp /// A class to add extension methods to Azure.ResourceManager.NetApp. public static partial class NetAppExtensions { - #region NetAppAccountBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -29,16 +28,9 @@ public static partial class NetAppExtensions [EditorBrowsable(EditorBrowsableState.Never)] public static NetAppAccountBackupResource GetNetAppAccountBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppAccountBackupResource.ValidateResourceId(id); - return new NetAppAccountBackupResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppAccountBackupResource(id); } - #endregion - #region NetAppVolumeBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -50,13 +42,7 @@ public static NetAppAccountBackupResource GetNetAppAccountBackupResource(this Ar public static NetAppVolumeBackupResource GetNetAppVolumeBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppVolumeBackupResource.ValidateResourceId(id); - return new NetAppVolumeBackupResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppVolumeBackupResource(id); } - #endregion } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs index 5c6a752575fcf..51ceed724dc30 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NetApp public partial class CapacityPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetAppVolumeResources and their operations over a NetAppVolumeResource. public virtual NetAppVolumeCollection GetNetAppVolumes() { - return GetCachedClient(Client => new NetAppVolumeCollection(Client, Id)); + return GetCachedClient(client => new NetAppVolumeCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual NetAppVolumeCollection GetNetAppVolumes() /// /// The name of the volume. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetAppVolumeAsync(string volumeName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetNetAppVolumeAsync(s /// /// The name of the volume. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetAppVolume(string volumeName, CancellationToken cancellationToken = default) { diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppArmClient.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppArmClient.cs new file mode 100644 index 0000000000000..c94688ba7f0fa --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppArmClient.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNetAppArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetAppArmClient() + { + } + + /// 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 MockableNetAppArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNetAppArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppAccountResource GetNetAppAccountResource(ResourceIdentifier id) + { + NetAppAccountResource.ValidateResourceId(id); + return new NetAppAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CapacityPoolResource GetCapacityPoolResource(ResourceIdentifier id) + { + CapacityPoolResource.ValidateResourceId(id); + return new CapacityPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppVolumeResource GetNetAppVolumeResource(ResourceIdentifier id) + { + NetAppVolumeResource.ValidateResourceId(id); + return new NetAppVolumeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppVolumeSnapshotResource GetNetAppVolumeSnapshotResource(ResourceIdentifier id) + { + NetAppVolumeSnapshotResource.ValidateResourceId(id); + return new NetAppVolumeSnapshotResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SnapshotPolicyResource GetSnapshotPolicyResource(ResourceIdentifier id) + { + SnapshotPolicyResource.ValidateResourceId(id); + return new SnapshotPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppBackupPolicyResource GetNetAppBackupPolicyResource(ResourceIdentifier id) + { + NetAppBackupPolicyResource.ValidateResourceId(id); + return new NetAppBackupPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppVolumeQuotaRuleResource GetNetAppVolumeQuotaRuleResource(ResourceIdentifier id) + { + NetAppVolumeQuotaRuleResource.ValidateResourceId(id); + return new NetAppVolumeQuotaRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppVolumeGroupResource GetNetAppVolumeGroupResource(ResourceIdentifier id) + { + NetAppVolumeGroupResource.ValidateResourceId(id); + return new NetAppVolumeGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppSubvolumeInfoResource GetNetAppSubvolumeInfoResource(ResourceIdentifier id) + { + NetAppSubvolumeInfoResource.ValidateResourceId(id); + return new NetAppSubvolumeInfoResource(Client, id); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppResourceGroupResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppResourceGroupResource.cs new file mode 100644 index 0000000000000..429472c50932b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.NetApp; + +namespace Azure.ResourceManager.NetApp.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNetAppResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetAppResourceGroupResource() + { + } + + /// 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 MockableNetAppResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NetAppAccountResources in the ResourceGroupResource. + /// An object representing collection of NetAppAccountResources and their operations over a NetAppAccountResource. + public virtual NetAppAccountCollection GetNetAppAccounts() + { + return GetCachedClient(client => new NetAppAccountCollection(client, Id)); + } + + /// + /// Get the NetApp account + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the NetApp account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetAppAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetNetAppAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the NetApp account + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the NetApp account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetAppAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetNetAppAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppSubscriptionResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppSubscriptionResource.cs new file mode 100644 index 0000000000000..83feb7a5622a2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppSubscriptionResource.cs @@ -0,0 +1,636 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNetAppSubscriptionResource : ArmResource + { + private ClientDiagnostics _netAppResourceClientDiagnostics; + private NetAppResourceRestOperations _netAppResourceRestClient; + private ClientDiagnostics _netAppResourceQuotaLimitsClientDiagnostics; + private NetAppResourceQuotaLimitsRestOperations _netAppResourceQuotaLimitsRestClient; + private ClientDiagnostics _netAppAccountAccountsClientDiagnostics; + private AccountsRestOperations _netAppAccountAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNetAppSubscriptionResource() + { + } + + /// 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 MockableNetAppSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics NetAppResourceClientDiagnostics => _netAppResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private NetAppResourceRestOperations NetAppResourceRestClient => _netAppResourceRestClient ??= new NetAppResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics NetAppResourceQuotaLimitsClientDiagnostics => _netAppResourceQuotaLimitsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private NetAppResourceQuotaLimitsRestOperations NetAppResourceQuotaLimitsRestClient => _netAppResourceQuotaLimitsRestClient ??= new NetAppResourceQuotaLimitsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics NetAppAccountAccountsClientDiagnostics => _netAppAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations NetAppAccountAccountsRestClient => _netAppAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetAppAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Check if a resource name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// NetAppResource_CheckNameAvailability + /// + /// + /// + /// The name of Azure region. + /// Name availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNetAppNameAvailabilityAsync(AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppNameAvailability"); + scope.Start(); + try + { + var response = await NetAppResourceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a resource name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// NetAppResource_CheckNameAvailability + /// + /// + /// + /// The name of Azure region. + /// Name availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNetAppNameAvailability(AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppNameAvailability"); + scope.Start(); + try + { + var response = NetAppResourceRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a file path is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability + /// + /// + /// Operation Id + /// NetAppResource_CheckFilePathAvailability + /// + /// + /// + /// The name of Azure region. + /// File path availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNetAppFilePathAvailabilityAsync(AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppFilePathAvailability"); + scope.Start(); + try + { + var response = await NetAppResourceRestClient.CheckFilePathAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a file path is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability + /// + /// + /// Operation Id + /// NetAppResource_CheckFilePathAvailability + /// + /// + /// + /// The name of Azure region. + /// File path availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNetAppFilePathAvailability(AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppFilePathAvailability"); + scope.Start(); + try + { + var response = NetAppResourceRestClient.CheckFilePathAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a quota is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability + /// + /// + /// Operation Id + /// NetAppResource_CheckQuotaAvailability + /// + /// + /// + /// The name of Azure region. + /// Quota availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNetAppQuotaAvailabilityAsync(AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppQuotaAvailability"); + scope.Start(); + try + { + var response = await NetAppResourceRestClient.CheckQuotaAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a quota is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability + /// + /// + /// Operation Id + /// NetAppResource_CheckQuotaAvailability + /// + /// + /// + /// The name of Azure region. + /// Quota availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNetAppQuotaAvailability(AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppQuotaAvailability"); + scope.Start(); + try + { + var response = NetAppResourceRestClient.CheckQuotaAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Provides storage to network proximity and logical zone mapping information. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo + /// + /// + /// Operation Id + /// NetAppResource_QueryRegionInfo + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + public virtual async Task> QueryRegionInfoNetAppResourceAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryRegionInfoNetAppResource"); + scope.Start(); + try + { + var response = await NetAppResourceRestClient.QueryRegionInfoAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Provides storage to network proximity and logical zone mapping information. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo + /// + /// + /// Operation Id + /// NetAppResource_QueryRegionInfo + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + public virtual Response QueryRegionInfoNetAppResource(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryRegionInfoNetAppResource"); + scope.Start(); + try + { + var response = NetAppResourceRestClient.QueryRegionInfo(Id.SubscriptionId, location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified network sibling set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/queryNetworkSiblingSet + /// + /// + /// Operation Id + /// NetAppResource_QueryNetworkSiblingSet + /// + /// + /// + /// The name of Azure region. + /// Network sibling set to query. + /// The cancellation token to use. + /// is null. + public virtual async Task> QueryNetworkSiblingSetNetAppResourceAsync(AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryNetworkSiblingSetNetAppResource"); + scope.Start(); + try + { + var response = await NetAppResourceRestClient.QueryNetworkSiblingSetAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified network sibling set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/queryNetworkSiblingSet + /// + /// + /// Operation Id + /// NetAppResource_QueryNetworkSiblingSet + /// + /// + /// + /// The name of Azure region. + /// Network sibling set to query. + /// The cancellation token to use. + /// is null. + public virtual Response QueryNetworkSiblingSetNetAppResource(AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryNetworkSiblingSetNetAppResource"); + scope.Start(); + try + { + var response = NetAppResourceRestClient.QueryNetworkSiblingSet(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the network features of the specified network sibling set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/updateNetworkSiblingSet + /// + /// + /// Operation Id + /// NetAppResource_UpdateNetworkSiblingSet + /// + /// + /// + /// 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 Azure region. + /// Update for the specified network sibling set. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateNetworkSiblingSetNetAppResourceAsync(WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.UpdateNetworkSiblingSetNetAppResource"); + scope.Start(); + try + { + var response = await NetAppResourceRestClient.UpdateNetworkSiblingSetAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + var operation = new NetAppArmOperation(new NetworkSiblingSetOperationSource(), NetAppResourceClientDiagnostics, Pipeline, NetAppResourceRestClient.CreateUpdateNetworkSiblingSetRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the network features of the specified network sibling set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/updateNetworkSiblingSet + /// + /// + /// Operation Id + /// NetAppResource_UpdateNetworkSiblingSet + /// + /// + /// + /// 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 Azure region. + /// Update for the specified network sibling set. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation UpdateNetworkSiblingSetNetAppResource(WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.UpdateNetworkSiblingSetNetAppResource"); + scope.Start(); + try + { + var response = NetAppResourceRestClient.UpdateNetworkSiblingSet(Id.SubscriptionId, location, content, cancellationToken); + var operation = new NetAppArmOperation(new NetworkSiblingSetOperationSource(), NetAppResourceClientDiagnostics, Pipeline, NetAppResourceRestClient.CreateUpdateNetworkSiblingSetRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default and current limits for quotas + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits + /// + /// + /// Operation Id + /// NetAppResourceQuotaLimits_List + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetAppQuotaLimitsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppResourceQuotaLimitsRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem, NetAppResourceQuotaLimitsClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppQuotaLimits", "value", null, cancellationToken); + } + + /// + /// Get the default and current limits for quotas + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits + /// + /// + /// Operation Id + /// NetAppResourceQuotaLimits_List + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetAppQuotaLimits(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppResourceQuotaLimitsRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem, NetAppResourceQuotaLimitsClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppQuotaLimits", "value", null, cancellationToken); + } + + /// + /// Get the default and current subscription quota limit + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName} + /// + /// + /// Operation Id + /// NetAppResourceQuotaLimits_Get + /// + /// + /// + /// The name of Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetNetAppQuotaLimitAsync(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + using var scope = NetAppResourceQuotaLimitsClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppQuotaLimit"); + scope.Start(); + try + { + var response = await NetAppResourceQuotaLimitsRestClient.GetAsync(Id.SubscriptionId, location, quotaLimitName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default and current subscription quota limit + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName} + /// + /// + /// Operation Id + /// NetAppResourceQuotaLimits_Get + /// + /// + /// + /// The name of Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetNetAppQuotaLimit(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + using var scope = NetAppResourceQuotaLimitsClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppQuotaLimit"); + scope.Start(); + try + { + var response = NetAppResourceQuotaLimitsRestClient.Get(Id.SubscriptionId, location, quotaLimitName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List and describe all NetApp accounts in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetAppAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppAccountResource(Client, NetAppAccountData.DeserializeNetAppAccountData(e)), NetAppAccountAccountsClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// List and describe all NetApp accounts in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetAppAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppAccountResource(Client, NetAppAccountData.DeserializeNetAppAccountData(e)), NetAppAccountAccountsClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppAccounts", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/NetAppExtensions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/NetAppExtensions.cs index 9d8a9f1248088..cf9a93fc1e4e8 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/NetAppExtensions.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/NetAppExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Mocking; using Azure.ResourceManager.NetApp.Models; using Azure.ResourceManager.Resources; @@ -19,214 +20,177 @@ namespace Azure.ResourceManager.NetApp /// A class to add extension methods to Azure.ResourceManager.NetApp. public static partial class NetAppExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableNetAppArmClient GetMockableNetAppArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableNetAppArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNetAppResourceGroupResource GetMockableNetAppResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNetAppResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableNetAppSubscriptionResource GetMockableNetAppSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableNetAppSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region NetAppAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetAppAccountResource GetNetAppAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppAccountResource.ValidateResourceId(id); - return new NetAppAccountResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppAccountResource(id); } - #endregion - #region CapacityPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CapacityPoolResource GetCapacityPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CapacityPoolResource.ValidateResourceId(id); - return new CapacityPoolResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetCapacityPoolResource(id); } - #endregion - #region NetAppVolumeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetAppVolumeResource GetNetAppVolumeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppVolumeResource.ValidateResourceId(id); - return new NetAppVolumeResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppVolumeResource(id); } - #endregion - #region NetAppVolumeSnapshotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetAppVolumeSnapshotResource GetNetAppVolumeSnapshotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppVolumeSnapshotResource.ValidateResourceId(id); - return new NetAppVolumeSnapshotResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppVolumeSnapshotResource(id); } - #endregion - #region SnapshotPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SnapshotPolicyResource GetSnapshotPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SnapshotPolicyResource.ValidateResourceId(id); - return new SnapshotPolicyResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetSnapshotPolicyResource(id); } - #endregion - #region NetAppBackupPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetAppBackupPolicyResource GetNetAppBackupPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppBackupPolicyResource.ValidateResourceId(id); - return new NetAppBackupPolicyResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppBackupPolicyResource(id); } - #endregion - #region NetAppVolumeQuotaRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetAppVolumeQuotaRuleResource GetNetAppVolumeQuotaRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppVolumeQuotaRuleResource.ValidateResourceId(id); - return new NetAppVolumeQuotaRuleResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppVolumeQuotaRuleResource(id); } - #endregion - #region NetAppVolumeGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetAppVolumeGroupResource GetNetAppVolumeGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppVolumeGroupResource.ValidateResourceId(id); - return new NetAppVolumeGroupResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppVolumeGroupResource(id); } - #endregion - #region NetAppSubvolumeInfoResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetAppSubvolumeInfoResource GetNetAppSubvolumeInfoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetAppSubvolumeInfoResource.ValidateResourceId(id); - return new NetAppSubvolumeInfoResource(client, id); - } - ); + return GetMockableNetAppArmClient(client).GetNetAppSubvolumeInfoResource(id); } - #endregion - /// Gets a collection of NetAppAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of NetAppAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetAppAccountResources and their operations over a NetAppAccountResource. public static NetAppAccountCollection GetNetAppAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetAppAccounts(); + return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppAccounts(); } /// @@ -241,16 +205,20 @@ public static NetAppAccountCollection GetNetAppAccounts(this ResourceGroupResour /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the NetApp account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetAppAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetAppAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -265,16 +233,20 @@ public static async Task> GetNetAppAccountAsync( /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the NetApp account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetAppAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetAppAccounts().Get(accountName, cancellationToken); + return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppAccount(accountName, cancellationToken); } /// @@ -289,6 +261,10 @@ public static Response GetNetAppAccount(this ResourceGrou /// NetAppResource_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -297,9 +273,7 @@ public static Response GetNetAppAccount(this ResourceGrou /// is null. public static async Task> CheckNetAppNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNetAppNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -314,6 +288,10 @@ public static async Task> CheckNetAppNam /// NetAppResource_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -322,9 +300,7 @@ public static async Task> CheckNetAppNam /// is null. public static Response CheckNetAppNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNetAppNameAvailability(location, content, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppNameAvailability(location, content, cancellationToken); } /// @@ -339,6 +315,10 @@ public static Response CheckNetAppNameAvailabilit /// NetAppResource_CheckFilePathAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -347,9 +327,7 @@ public static Response CheckNetAppNameAvailabilit /// is null. public static async Task> CheckNetAppFilePathAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNetAppFilePathAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppFilePathAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -364,6 +342,10 @@ public static async Task> CheckNetAppFil /// NetAppResource_CheckFilePathAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -372,9 +354,7 @@ public static async Task> CheckNetAppFil /// is null. public static Response CheckNetAppFilePathAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNetAppFilePathAvailability(location, content, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppFilePathAvailability(location, content, cancellationToken); } /// @@ -389,6 +369,10 @@ public static Response CheckNetAppFilePathAvailab /// NetAppResource_CheckQuotaAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -397,9 +381,7 @@ public static Response CheckNetAppFilePathAvailab /// is null. public static async Task> CheckNetAppQuotaAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNetAppQuotaAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppQuotaAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -414,6 +396,10 @@ public static async Task> CheckNetAppQuo /// NetAppResource_CheckQuotaAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -422,9 +408,7 @@ public static async Task> CheckNetAppQuo /// is null. public static Response CheckNetAppQuotaAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNetAppQuotaAvailability(location, content, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppQuotaAvailability(location, content, cancellationToken); } /// @@ -439,13 +423,17 @@ public static Response CheckNetAppQuotaAvailabili /// NetAppResource_QueryRegionInfo /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. /// The cancellation token to use. public static async Task> QueryRegionInfoNetAppResourceAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).QueryRegionInfoNetAppResourceAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableNetAppSubscriptionResource(subscriptionResource).QueryRegionInfoNetAppResourceAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -460,13 +448,17 @@ public static async Task> QueryRegionInfoNetAppResour /// NetAppResource_QueryRegionInfo /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. /// The cancellation token to use. public static Response QueryRegionInfoNetAppResource(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).QueryRegionInfoNetAppResource(location, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).QueryRegionInfoNetAppResource(location, cancellationToken); } /// @@ -481,6 +473,10 @@ public static Response QueryRegionInfoNetAppResource(this Subs /// NetAppResource_QueryNetworkSiblingSet /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -489,9 +485,7 @@ public static Response QueryRegionInfoNetAppResource(this Subs /// is null. public static async Task> QueryNetworkSiblingSetNetAppResourceAsync(this SubscriptionResource subscriptionResource, AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).QueryNetworkSiblingSetNetAppResourceAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableNetAppSubscriptionResource(subscriptionResource).QueryNetworkSiblingSetNetAppResourceAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -506,6 +500,10 @@ public static async Task> QueryNetworkSiblingSetNetA /// NetAppResource_QueryNetworkSiblingSet /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -514,9 +512,7 @@ public static async Task> QueryNetworkSiblingSetNetA /// is null. public static Response QueryNetworkSiblingSetNetAppResource(this SubscriptionResource subscriptionResource, AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).QueryNetworkSiblingSetNetAppResource(location, content, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).QueryNetworkSiblingSetNetAppResource(location, content, cancellationToken); } /// @@ -531,6 +527,10 @@ public static Response QueryNetworkSiblingSetNetAppResource(t /// NetAppResource_UpdateNetworkSiblingSet /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -540,9 +540,7 @@ public static Response QueryNetworkSiblingSetNetAppResource(t /// is null. public static async Task> UpdateNetworkSiblingSetNetAppResourceAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).UpdateNetworkSiblingSetNetAppResourceAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableNetAppSubscriptionResource(subscriptionResource).UpdateNetworkSiblingSetNetAppResourceAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); } /// @@ -557,6 +555,10 @@ public static async Task> UpdateNetworkSiblingSe /// NetAppResource_UpdateNetworkSiblingSet /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -566,9 +568,7 @@ public static async Task> UpdateNetworkSiblingSe /// is null. public static ArmOperation UpdateNetworkSiblingSetNetAppResource(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).UpdateNetworkSiblingSetNetAppResource(waitUntil, location, content, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).UpdateNetworkSiblingSetNetAppResource(waitUntil, location, content, cancellationToken); } /// @@ -583,6 +583,10 @@ public static ArmOperation UpdateNetworkSiblingSetNetAppResou /// NetAppResourceQuotaLimits_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -590,7 +594,7 @@ public static ArmOperation UpdateNetworkSiblingSetNetAppResou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetNetAppQuotaLimitsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetAppQuotaLimitsAsync(location, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppQuotaLimitsAsync(location, cancellationToken); } /// @@ -605,6 +609,10 @@ public static AsyncPageable GetNetAppQuotaLimitsAsy /// NetAppResourceQuotaLimits_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -612,7 +620,7 @@ public static AsyncPageable GetNetAppQuotaLimitsAsy /// A collection of that may take multiple service requests to iterate over. public static Pageable GetNetAppQuotaLimits(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetAppQuotaLimits(location, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppQuotaLimits(location, cancellationToken); } /// @@ -627,6 +635,10 @@ public static Pageable GetNetAppQuotaLimits(this Su /// NetAppResourceQuotaLimits_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -636,9 +648,7 @@ public static Pageable GetNetAppQuotaLimits(this Su /// is null. public static async Task> GetNetAppQuotaLimitAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetAppQuotaLimitAsync(location, quotaLimitName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppQuotaLimitAsync(location, quotaLimitName, cancellationToken).ConfigureAwait(false); } /// @@ -653,6 +663,10 @@ public static async Task> GetNetAppQuotaLi /// NetAppResourceQuotaLimits_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -662,9 +676,7 @@ public static async Task> GetNetAppQuotaLi /// is null. public static Response GetNetAppQuotaLimit(this SubscriptionResource subscriptionResource, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetAppQuotaLimit(location, quotaLimitName, cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppQuotaLimit(location, quotaLimitName, cancellationToken); } /// @@ -679,13 +691,17 @@ public static Response GetNetAppQuotaLimit(this Sub /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetAppAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetAppAccountsAsync(cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppAccountsAsync(cancellationToken); } /// @@ -700,13 +716,17 @@ public static AsyncPageable GetNetAppAccountsAsync(this S /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetAppAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetAppAccounts(cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppAccounts(cancellationToken); } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 51609d609e1ff..0000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NetApp -{ - /// 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 NetAppAccountResources in the ResourceGroupResource. - /// An object representing collection of NetAppAccountResources and their operations over a NetAppAccountResource. - public virtual NetAppAccountCollection GetNetAppAccounts() - { - return GetCachedClient(Client => new NetAppAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index dedbaa98ecac2..0000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,597 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _netAppResourceClientDiagnostics; - private NetAppResourceRestOperations _netAppResourceRestClient; - private ClientDiagnostics _netAppResourceQuotaLimitsClientDiagnostics; - private NetAppResourceQuotaLimitsRestOperations _netAppResourceQuotaLimitsRestClient; - private ClientDiagnostics _netAppAccountAccountsClientDiagnostics; - private AccountsRestOperations _netAppAccountAccountsRestClient; - - /// 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 NetAppResourceClientDiagnostics => _netAppResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private NetAppResourceRestOperations NetAppResourceRestClient => _netAppResourceRestClient ??= new NetAppResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics NetAppResourceQuotaLimitsClientDiagnostics => _netAppResourceQuotaLimitsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private NetAppResourceQuotaLimitsRestOperations NetAppResourceQuotaLimitsRestClient => _netAppResourceQuotaLimitsRestClient ??= new NetAppResourceQuotaLimitsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics NetAppAccountAccountsClientDiagnostics => _netAppAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations NetAppAccountAccountsRestClient => _netAppAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetAppAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Check if a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckNameAvailability - /// - /// - /// - /// The name of Azure region. - /// Name availability request. - /// The cancellation token to use. - public virtual async Task> CheckNetAppNameAvailabilityAsync(AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNetAppNameAvailability"); - scope.Start(); - try - { - var response = await NetAppResourceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckNameAvailability - /// - /// - /// - /// The name of Azure region. - /// Name availability request. - /// The cancellation token to use. - public virtual Response CheckNetAppNameAvailability(AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNetAppNameAvailability"); - scope.Start(); - try - { - var response = NetAppResourceRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if a file path is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckFilePathAvailability - /// - /// - /// - /// The name of Azure region. - /// File path availability request. - /// The cancellation token to use. - public virtual async Task> CheckNetAppFilePathAvailabilityAsync(AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNetAppFilePathAvailability"); - scope.Start(); - try - { - var response = await NetAppResourceRestClient.CheckFilePathAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if a file path is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckFilePathAvailability - /// - /// - /// - /// The name of Azure region. - /// File path availability request. - /// The cancellation token to use. - public virtual Response CheckNetAppFilePathAvailability(AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNetAppFilePathAvailability"); - scope.Start(); - try - { - var response = NetAppResourceRestClient.CheckFilePathAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if a quota is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckQuotaAvailability - /// - /// - /// - /// The name of Azure region. - /// Quota availability request. - /// The cancellation token to use. - public virtual async Task> CheckNetAppQuotaAvailabilityAsync(AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNetAppQuotaAvailability"); - scope.Start(); - try - { - var response = await NetAppResourceRestClient.CheckQuotaAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check if a quota is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckQuotaAvailability - /// - /// - /// - /// The name of Azure region. - /// Quota availability request. - /// The cancellation token to use. - public virtual Response CheckNetAppQuotaAvailability(AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNetAppQuotaAvailability"); - scope.Start(); - try - { - var response = NetAppResourceRestClient.CheckQuotaAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo - /// - /// - /// Operation Id - /// NetAppResource_QueryRegionInfo - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - public virtual async Task> QueryRegionInfoNetAppResourceAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.QueryRegionInfoNetAppResource"); - scope.Start(); - try - { - var response = await NetAppResourceRestClient.QueryRegionInfoAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo - /// - /// - /// Operation Id - /// NetAppResource_QueryRegionInfo - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - public virtual Response QueryRegionInfoNetAppResource(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.QueryRegionInfoNetAppResource"); - scope.Start(); - try - { - var response = NetAppResourceRestClient.QueryRegionInfo(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/queryNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_QueryNetworkSiblingSet - /// - /// - /// - /// The name of Azure region. - /// Network sibling set to query. - /// The cancellation token to use. - public virtual async Task> QueryNetworkSiblingSetNetAppResourceAsync(AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.QueryNetworkSiblingSetNetAppResource"); - scope.Start(); - try - { - var response = await NetAppResourceRestClient.QueryNetworkSiblingSetAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/queryNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_QueryNetworkSiblingSet - /// - /// - /// - /// The name of Azure region. - /// Network sibling set to query. - /// The cancellation token to use. - public virtual Response QueryNetworkSiblingSetNetAppResource(AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.QueryNetworkSiblingSetNetAppResource"); - scope.Start(); - try - { - var response = NetAppResourceRestClient.QueryNetworkSiblingSet(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update the network features of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/updateNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_UpdateNetworkSiblingSet - /// - /// - /// - /// 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 Azure region. - /// Update for the specified network sibling set. - /// The cancellation token to use. - public virtual async Task> UpdateNetworkSiblingSetNetAppResourceAsync(WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.UpdateNetworkSiblingSetNetAppResource"); - scope.Start(); - try - { - var response = await NetAppResourceRestClient.UpdateNetworkSiblingSetAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetworkSiblingSetOperationSource(), NetAppResourceClientDiagnostics, Pipeline, NetAppResourceRestClient.CreateUpdateNetworkSiblingSetRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update the network features of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/updateNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_UpdateNetworkSiblingSet - /// - /// - /// - /// 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 Azure region. - /// Update for the specified network sibling set. - /// The cancellation token to use. - public virtual ArmOperation UpdateNetworkSiblingSetNetAppResource(WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.UpdateNetworkSiblingSetNetAppResource"); - scope.Start(); - try - { - var response = NetAppResourceRestClient.UpdateNetworkSiblingSet(Id.SubscriptionId, location, content, cancellationToken); - var operation = new NetAppArmOperation(new NetworkSiblingSetOperationSource(), NetAppResourceClientDiagnostics, Pipeline, NetAppResourceRestClient.CreateUpdateNetworkSiblingSetRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the default and current limits for quotas - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_List - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetAppQuotaLimitsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppResourceQuotaLimitsRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem, NetAppResourceQuotaLimitsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetAppQuotaLimits", "value", null, cancellationToken); - } - - /// - /// Get the default and current limits for quotas - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_List - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetAppQuotaLimits(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppResourceQuotaLimitsRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem, NetAppResourceQuotaLimitsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetAppQuotaLimits", "value", null, cancellationToken); - } - - /// - /// Get the default and current subscription quota limit - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName} - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_Get - /// - /// - /// - /// The name of Azure region. - /// The name of the Quota Limit. - /// The cancellation token to use. - public virtual async Task> GetNetAppQuotaLimitAsync(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceQuotaLimitsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetNetAppQuotaLimit"); - scope.Start(); - try - { - var response = await NetAppResourceQuotaLimitsRestClient.GetAsync(Id.SubscriptionId, location, quotaLimitName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the default and current subscription quota limit - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName} - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_Get - /// - /// - /// - /// The name of Azure region. - /// The name of the Quota Limit. - /// The cancellation token to use. - public virtual Response GetNetAppQuotaLimit(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) - { - using var scope = NetAppResourceQuotaLimitsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetNetAppQuotaLimit"); - scope.Start(); - try - { - var response = NetAppResourceQuotaLimitsRestClient.Get(Id.SubscriptionId, location, quotaLimitName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List and describe all NetApp accounts in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetAppAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppAccountResource(Client, NetAppAccountData.DeserializeNetAppAccountData(e)), NetAppAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetAppAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List and describe all NetApp accounts in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetAppAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppAccountResource(Client, NetAppAccountData.DeserializeNetAppAccountData(e)), NetAppAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetAppAccounts", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.Serialization.cs index 5d05765c6ea5e..ef371ddbb5213 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.Serialization.cs @@ -34,7 +34,7 @@ internal static VolumeSnapshotProperties DeserializeVolumeSnapshotProperties(Jso { if (property.NameEquals("snapshotPolicyId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (property.Value.ValueKind == JsonValueKind.Null || property.Value.ValueKind == JsonValueKind.String && property.Value.GetString().Length == 0) { continue; } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs index 220b79542c637..b6c225237b2ac 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.NetApp public partial class NetAppAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"; @@ -99,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CapacityPoolResources and their operations over a CapacityPoolResource. public virtual CapacityPoolCollection GetCapacityPools() { - return GetCachedClient(Client => new CapacityPoolCollection(Client, Id)); + return GetCachedClient(client => new CapacityPoolCollection(client, Id)); } /// @@ -117,8 +120,8 @@ public virtual CapacityPoolCollection GetCapacityPools() /// /// The name of the capacity pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCapacityPoolAsync(string poolName, CancellationToken cancellationToken = default) { @@ -140,8 +143,8 @@ public virtual async Task> GetCapacityPoolAsync(s /// /// The name of the capacity pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCapacityPool(string poolName, CancellationToken cancellationToken = default) { @@ -152,7 +155,7 @@ public virtual Response GetCapacityPool(string poolName, C /// An object representing collection of SnapshotPolicyResources and their operations over a SnapshotPolicyResource. public virtual SnapshotPolicyCollection GetSnapshotPolicies() { - return GetCachedClient(Client => new SnapshotPolicyCollection(Client, Id)); + return GetCachedClient(client => new SnapshotPolicyCollection(client, Id)); } /// @@ -170,8 +173,8 @@ public virtual SnapshotPolicyCollection GetSnapshotPolicies() /// /// The name of the snapshot policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSnapshotPolicyAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) { @@ -193,8 +196,8 @@ public virtual async Task> GetSnapshotPolicyAsy /// /// The name of the snapshot policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSnapshotPolicy(string snapshotPolicyName, CancellationToken cancellationToken = default) { @@ -205,7 +208,7 @@ public virtual Response GetSnapshotPolicy(string snapsho /// An object representing collection of NetAppBackupPolicyResources and their operations over a NetAppBackupPolicyResource. public virtual NetAppBackupPolicyCollection GetNetAppBackupPolicies() { - return GetCachedClient(Client => new NetAppBackupPolicyCollection(Client, Id)); + return GetCachedClient(client => new NetAppBackupPolicyCollection(client, Id)); } /// @@ -223,8 +226,8 @@ public virtual NetAppBackupPolicyCollection GetNetAppBackupPolicies() /// /// Backup policy Name which uniquely identify backup policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetAppBackupPolicyAsync(string backupPolicyName, CancellationToken cancellationToken = default) { @@ -246,8 +249,8 @@ public virtual async Task> GetNetAppBackupP /// /// Backup policy Name which uniquely identify backup policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetAppBackupPolicy(string backupPolicyName, CancellationToken cancellationToken = default) { @@ -258,7 +261,7 @@ public virtual Response GetNetAppBackupPolicy(string /// An object representing collection of NetAppVolumeGroupResources and their operations over a NetAppVolumeGroupResource. public virtual NetAppVolumeGroupCollection GetNetAppVolumeGroups() { - return GetCachedClient(Client => new NetAppVolumeGroupCollection(Client, Id)); + return GetCachedClient(client => new NetAppVolumeGroupCollection(client, Id)); } /// @@ -276,8 +279,8 @@ public virtual NetAppVolumeGroupCollection GetNetAppVolumeGroups() /// /// The name of the volumeGroup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetAppVolumeGroupAsync(string volumeGroupName, CancellationToken cancellationToken = default) { @@ -299,8 +302,8 @@ public virtual async Task> GetNetAppVolumeGr /// /// The name of the volumeGroup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetAppVolumeGroup(string volumeGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.cs index b3dc8ec90b03b..19956dc2ac7cf 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NetApp public partial class NetAppBackupPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The backupPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"; diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.cs index 455b2492253cd..8dac9b75795f7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.NetApp public partial class NetAppSubvolumeInfoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The subvolumeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"; diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.cs index 29f0e8baa9166..bf485e54e7c24 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.NetApp public partial class NetAppVolumeGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The volumeGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"; diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.cs index cf27a96ed48a4..a2eaaaacd7195 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.NetApp public partial class NetAppVolumeQuotaRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The volumeQuotaRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"; diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs index c552ca0e93125..15d19f848916d 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs @@ -28,6 +28,11 @@ namespace Azure.ResourceManager.NetApp public partial class NetAppVolumeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"; @@ -97,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetAppVolumeSnapshotResources and their operations over a NetAppVolumeSnapshotResource. public virtual NetAppVolumeSnapshotCollection GetNetAppVolumeSnapshots() { - return GetCachedClient(Client => new NetAppVolumeSnapshotCollection(Client, Id)); + return GetCachedClient(client => new NetAppVolumeSnapshotCollection(client, Id)); } /// @@ -115,8 +120,8 @@ public virtual NetAppVolumeSnapshotCollection GetNetAppVolumeSnapshots() /// /// The name of the snapshot. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetAppVolumeSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) { @@ -138,8 +143,8 @@ public virtual async Task> GetNetAppVolum /// /// The name of the snapshot. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetAppVolumeSnapshot(string snapshotName, CancellationToken cancellationToken = default) { @@ -150,7 +155,7 @@ public virtual Response GetNetAppVolumeSnapshot(st /// An object representing collection of NetAppVolumeQuotaRuleResources and their operations over a NetAppVolumeQuotaRuleResource. public virtual NetAppVolumeQuotaRuleCollection GetNetAppVolumeQuotaRules() { - return GetCachedClient(Client => new NetAppVolumeQuotaRuleCollection(Client, Id)); + return GetCachedClient(client => new NetAppVolumeQuotaRuleCollection(client, Id)); } /// @@ -168,8 +173,8 @@ public virtual NetAppVolumeQuotaRuleCollection GetNetAppVolumeQuotaRules() /// /// The name of volume quota rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetAppVolumeQuotaRuleAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) { @@ -191,8 +196,8 @@ public virtual async Task> GetNetAppVolu /// /// The name of volume quota rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetAppVolumeQuotaRule(string volumeQuotaRuleName, CancellationToken cancellationToken = default) { @@ -203,7 +208,7 @@ public virtual Response GetNetAppVolumeQuotaRule( /// An object representing collection of NetAppSubvolumeInfoResources and their operations over a NetAppSubvolumeInfoResource. public virtual NetAppSubvolumeInfoCollection GetNetAppSubvolumeInfos() { - return GetCachedClient(Client => new NetAppSubvolumeInfoCollection(Client, Id)); + return GetCachedClient(client => new NetAppSubvolumeInfoCollection(client, Id)); } /// @@ -221,8 +226,8 @@ public virtual NetAppSubvolumeInfoCollection GetNetAppSubvolumeInfos() /// /// The name of the subvolume. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetAppSubvolumeInfoAsync(string subvolumeName, CancellationToken cancellationToken = default) { @@ -244,8 +249,8 @@ public virtual async Task> GetNetAppSubvol /// /// The name of the subvolume. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetAppSubvolumeInfo(string subvolumeName, CancellationToken cancellationToken = default) { diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.cs index e235b35de7fe3..3b5ad49ae1c48 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.NetApp public partial class NetAppVolumeSnapshotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The snapshotName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"; diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.cs index f09476b9660fb..3a52cf2ff162a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.NetApp public partial class SnapshotPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The snapshotPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"; diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md b/sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md index 4ce10123409da..a2eb7c2c745ff 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md @@ -228,6 +228,10 @@ rename-mapping: VolumeRelocationProperties: NetAppVolumeRelocationProperties FileAccessLogs: NetAppFileAccessLog GetGroupIdListForLdapUserResponse: GetGroupIdListForLdapUserResult + +models-to-treat-empty-string-as-null: +- VolumeSnapshotProperties + list-exception: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} diff --git a/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md b/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md index 6ac8222ae78b6..14031c9c3e5d0 100644 --- a/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md +++ b/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md @@ -27,6 +27,12 @@ - Upgraded Azure.Core from 1.34.0 to 1.35.0 +## 1.5.0-beta.1 (2023-08-14) + +### Features Added + +- Make `NetworkArmClientMockingExtension`, `NetworkManagementGroupMockingExtension`, `NetworkResourceGroupMockingExtension`, `NetworkSubscriptionMockingExtension` public for mocking the extension methods. + ## 1.4.0 (2023-07-31) ### Features Added diff --git a/sdk/network/Azure.ResourceManager.Network/api/Azure.ResourceManager.Network.netstandard2.0.cs b/sdk/network/Azure.ResourceManager.Network/api/Azure.ResourceManager.Network.netstandard2.0.cs index ba100baccbbcc..149c6f0b0b4bc 100644 --- a/sdk/network/Azure.ResourceManager.Network/api/Azure.ResourceManager.Network.netstandard2.0.cs +++ b/sdk/network/Azure.ResourceManager.Network/api/Azure.ResourceManager.Network.netstandard2.0.cs @@ -817,7 +817,7 @@ protected DdosProtectionPlanCollection() { } } public partial class DdosProtectionPlanData : Azure.ResourceManager.Models.TrackedResourceData { - public DdosProtectionPlanData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DdosProtectionPlanData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.Network.Models.NetworkProvisioningState? ProvisioningState { get { throw null; } } public System.Collections.Generic.IReadOnlyList PublicIPAddresses { get { throw null; } } @@ -1557,7 +1557,7 @@ protected ExpressRouteProviderPortCollection() { } } public partial class ExpressRouteProviderPortData : Azure.ResourceManager.Models.TrackedResourceData { - public ExpressRouteProviderPortData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ExpressRouteProviderPortData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public int? OverprovisionFactor { get { throw null; } set { } } public string PeeringLocation { get { throw null; } set { } } @@ -5809,6 +5809,421 @@ protected WebApplicationFirewallPolicyResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Network.WebApplicationFirewallPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Network.Mocking +{ + public partial class MockableNetworkArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNetworkArmClient() { } + public virtual Azure.ResourceManager.Network.AdminRuleGroupResource GetAdminRuleGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ApplicationGatewayPrivateEndpointConnectionResource GetApplicationGatewayPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ApplicationGatewayResource GetApplicationGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ApplicationGatewayWafDynamicManifestResource GetApplicationGatewayWafDynamicManifestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ApplicationSecurityGroupResource GetApplicationSecurityGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.AzureFirewallResource GetAzureFirewallResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.AzureWebCategoryResource GetAzureWebCategoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.BackendAddressPoolResource GetBackendAddressPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.BaseAdminRuleResource GetBaseAdminRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.BastionHostResource GetBastionHostResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.BgpConnectionResource GetBgpConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.CloudServiceSwapResource GetCloudServiceSwapResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ConnectionMonitorResource GetConnectionMonitorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ConnectivityConfigurationResource GetConnectivityConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.CustomIPPrefixResource GetCustomIPPrefixResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.DdosCustomPolicyResource GetDdosCustomPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.DdosProtectionPlanResource GetDdosProtectionPlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.DefaultSecurityRuleResource GetDefaultSecurityRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.DscpConfigurationResource GetDscpConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteCircuitAuthorizationResource GetExpressRouteCircuitAuthorizationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteCircuitConnectionResource GetExpressRouteCircuitConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteCircuitPeeringResource GetExpressRouteCircuitPeeringResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteCircuitResource GetExpressRouteCircuitResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteConnectionResource GetExpressRouteConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteCrossConnectionPeeringResource GetExpressRouteCrossConnectionPeeringResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteCrossConnectionResource GetExpressRouteCrossConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteGatewayResource GetExpressRouteGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteLinkResource GetExpressRouteLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRoutePortAuthorizationResource GetExpressRoutePortAuthorizationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRoutePortResource GetExpressRoutePortResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRoutePortsLocationResource GetExpressRoutePortsLocationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteProviderPortResource GetExpressRouteProviderPortResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.FirewallPolicyResource GetFirewallPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.FirewallPolicyRuleCollectionGroupResource GetFirewallPolicyRuleCollectionGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.FlowLogResource GetFlowLogResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.FrontendIPConfigurationResource GetFrontendIPConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.HubIPConfigurationResource GetHubIPConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.HubRouteTableResource GetHubRouteTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.HubVirtualNetworkConnectionResource GetHubVirtualNetworkConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.InboundNatRuleResource GetInboundNatRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.IPAllocationResource GetIPAllocationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.IPGroupResource GetIPGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.LoadBalancerResource GetLoadBalancerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.LoadBalancingRuleResource GetLoadBalancingRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.LocalNetworkGatewayResource GetLocalNetworkGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ManagementGroupNetworkManagerConnectionResource GetManagementGroupNetworkManagerConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NatGatewayResource GetNatGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkGroupResource GetNetworkGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkGroupStaticMemberResource GetNetworkGroupStaticMemberResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkInterfaceIPConfigurationResource GetNetworkInterfaceIPConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkInterfaceResource GetNetworkInterfaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkInterfaceTapConfigurationResource GetNetworkInterfaceTapConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkManagerResource GetNetworkManagerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkPrivateEndpointConnectionResource GetNetworkPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkProfileResource GetNetworkProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkSecurityGroupResource GetNetworkSecurityGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkVirtualApplianceConnectionResource GetNetworkVirtualApplianceConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkVirtualApplianceResource GetNetworkVirtualApplianceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkVirtualApplianceSkuResource GetNetworkVirtualApplianceSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkWatcherResource GetNetworkWatcherResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.OutboundRuleResource GetOutboundRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.P2SVpnGatewayResource GetP2SVpnGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.PacketCaptureResource GetPacketCaptureResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.PeerExpressRouteCircuitConnectionResource GetPeerExpressRouteCircuitConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.PolicySignaturesOverridesForIdpsResource GetPolicySignaturesOverridesForIdpsResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.PrivateDnsZoneGroupResource GetPrivateDnsZoneGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.PrivateEndpointResource GetPrivateEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.PrivateLinkServiceResource GetPrivateLinkServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ProbeResource GetProbeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.PublicIPAddressResource GetPublicIPAddressResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.PublicIPPrefixResource GetPublicIPPrefixResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.RouteFilterResource GetRouteFilterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.RouteFilterRuleResource GetRouteFilterRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.RouteMapResource GetRouteMapResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.RouteResource GetRouteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.RouteTableResource GetRouteTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.RoutingIntentResource GetRoutingIntentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ScopeConnectionResource GetScopeConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.SecurityAdminConfigurationResource GetSecurityAdminConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.SecurityPartnerProviderResource GetSecurityPartnerProviderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.SecurityRuleResource GetSecurityRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ServiceEndpointPolicyDefinitionResource GetServiceEndpointPolicyDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.ServiceEndpointPolicyResource GetServiceEndpointPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.SubnetResource GetSubnetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.SubscriptionNetworkManagerConnectionResource GetSubscriptionNetworkManagerConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualApplianceSiteResource GetVirtualApplianceSiteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualHubResource GetVirtualHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualHubRouteTableV2Resource GetVirtualHubRouteTableV2Resource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualMachineScaleSetNetworkResource GetVirtualMachineScaleSetNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualMachineScaleSetVmNetworkResource GetVirtualMachineScaleSetVmNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkGatewayConnectionResource GetVirtualNetworkGatewayConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkGatewayNatRuleResource GetVirtualNetworkGatewayNatRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkGatewayResource GetVirtualNetworkGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkPeeringResource GetVirtualNetworkPeeringResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkResource GetVirtualNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkTapResource GetVirtualNetworkTapResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualRouterPeeringResource GetVirtualRouterPeeringResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualRouterResource GetVirtualRouterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualWanResource GetVirtualWanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VpnConnectionResource GetVpnConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VpnGatewayNatRuleResource GetVpnGatewayNatRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VpnGatewayResource GetVpnGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VpnServerConfigurationPolicyGroupResource GetVpnServerConfigurationPolicyGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VpnServerConfigurationResource GetVpnServerConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VpnSiteLinkConnectionResource GetVpnSiteLinkConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VpnSiteLinkResource GetVpnSiteLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.VpnSiteResource GetVpnSiteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Network.WebApplicationFirewallPolicyResource GetWebApplicationFirewallPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNetworkManagementGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkManagementGroupResource() { } + public virtual Azure.Response GetManagementGroupNetworkManagerConnection(string networkManagerConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagementGroupNetworkManagerConnectionAsync(string networkManagerConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ManagementGroupNetworkManagerConnectionCollection GetManagementGroupNetworkManagerConnections() { throw null; } + } + public partial class MockableNetworkResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkResourceGroupResource() { } + public virtual Azure.ResourceManager.ArmOperation CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Network.Models.CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkServiceAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Network.Models.CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetApplicationGateway(string applicationGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApplicationGatewayAsync(string applicationGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ApplicationGatewayCollection GetApplicationGateways() { throw null; } + public virtual Azure.Response GetApplicationSecurityGroup(string applicationSecurityGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApplicationSecurityGroupAsync(string applicationSecurityGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ApplicationSecurityGroupCollection GetApplicationSecurityGroups() { throw null; } + public virtual Azure.Pageable GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServicesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailablePrivateEndpointTypesByResourceGroup(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailablePrivateEndpointTypesByResourceGroupAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableResourceGroupDelegations(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableResourceGroupDelegationsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableServiceAliasesByResourceGroup(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableServiceAliasesByResourceGroupAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAzureFirewall(string azureFirewallName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAzureFirewallAsync(string azureFirewallName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.AzureFirewallCollection GetAzureFirewalls() { throw null; } + public virtual Azure.Response GetBastionHost(string bastionHostName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBastionHostAsync(string bastionHostName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.BastionHostCollection GetBastionHosts() { throw null; } + public virtual Azure.Response GetCloudServiceSwap(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCloudServiceSwapAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.CloudServiceSwapCollection GetCloudServiceSwaps(string resourceName) { throw null; } + public virtual Azure.Response GetCustomIPPrefix(string customIPPrefixName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCustomIPPrefixAsync(string customIPPrefixName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.CustomIPPrefixCollection GetCustomIPPrefixes() { throw null; } + public virtual Azure.ResourceManager.Network.DdosCustomPolicyCollection GetDdosCustomPolicies() { throw null; } + public virtual Azure.Response GetDdosCustomPolicy(string ddosCustomPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDdosCustomPolicyAsync(string ddosCustomPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDdosProtectionPlan(string ddosProtectionPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDdosProtectionPlanAsync(string ddosProtectionPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.DdosProtectionPlanCollection GetDdosProtectionPlans() { throw null; } + public virtual Azure.Response GetDscpConfiguration(string dscpConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDscpConfigurationAsync(string dscpConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.DscpConfigurationCollection GetDscpConfigurations() { throw null; } + public virtual Azure.Response GetExpressRouteCircuit(string circuitName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExpressRouteCircuitAsync(string circuitName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteCircuitCollection GetExpressRouteCircuits() { throw null; } + public virtual Azure.Response GetExpressRouteCrossConnection(string crossConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExpressRouteCrossConnectionAsync(string crossConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteCrossConnectionCollection GetExpressRouteCrossConnections() { throw null; } + public virtual Azure.Response GetExpressRouteGateway(string expressRouteGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExpressRouteGatewayAsync(string expressRouteGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteGatewayCollection GetExpressRouteGateways() { throw null; } + public virtual Azure.Response GetExpressRoutePort(string expressRoutePortName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExpressRoutePortAsync(string expressRoutePortName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRoutePortCollection GetExpressRoutePorts() { throw null; } + public virtual Azure.ResourceManager.Network.FirewallPolicyCollection GetFirewallPolicies() { throw null; } + public virtual Azure.Response GetFirewallPolicy(string firewallPolicyName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetFirewallPolicyAsync(string firewallPolicyName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetIPAllocation(string ipAllocationName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIPAllocationAsync(string ipAllocationName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.IPAllocationCollection GetIPAllocations() { throw null; } + public virtual Azure.Response GetIPGroup(string ipGroupsName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIPGroupAsync(string ipGroupsName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.IPGroupCollection GetIPGroups() { throw null; } + public virtual Azure.Response GetLoadBalancer(string loadBalancerName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLoadBalancerAsync(string loadBalancerName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.LoadBalancerCollection GetLoadBalancers() { throw null; } + public virtual Azure.Response GetLocalNetworkGateway(string localNetworkGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLocalNetworkGatewayAsync(string localNetworkGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.LocalNetworkGatewayCollection GetLocalNetworkGateways() { throw null; } + public virtual Azure.Response GetNatGateway(string natGatewayName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNatGatewayAsync(string natGatewayName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.NatGatewayCollection GetNatGateways() { throw null; } + public virtual Azure.Response GetNetworkInterface(string networkInterfaceName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkInterfaceAsync(string networkInterfaceName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkInterfaceCollection GetNetworkInterfaces() { throw null; } + public virtual Azure.Response GetNetworkManager(string networkManagerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkManagerAsync(string networkManagerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkManagerCollection GetNetworkManagers() { throw null; } + public virtual Azure.Response GetNetworkProfile(string networkProfileName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkProfileAsync(string networkProfileName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkProfileCollection GetNetworkProfiles() { throw null; } + public virtual Azure.Response GetNetworkSecurityGroup(string networkSecurityGroupName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkSecurityGroupAsync(string networkSecurityGroupName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkSecurityGroupCollection GetNetworkSecurityGroups() { throw null; } + public virtual Azure.Response GetNetworkVirtualAppliance(string networkVirtualApplianceName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkVirtualApplianceAsync(string networkVirtualApplianceName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkVirtualApplianceCollection GetNetworkVirtualAppliances() { throw null; } + public virtual Azure.Response GetNetworkWatcher(string networkWatcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkWatcherAsync(string networkWatcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkWatcherCollection GetNetworkWatchers() { throw null; } + public virtual Azure.Response GetP2SVpnGateway(string gatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetP2SVpnGatewayAsync(string gatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.P2SVpnGatewayCollection GetP2SVpnGateways() { throw null; } + public virtual Azure.Response GetPrivateEndpoint(string privateEndpointName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPrivateEndpointAsync(string privateEndpointName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.PrivateEndpointCollection GetPrivateEndpoints() { throw null; } + public virtual Azure.Response GetPrivateLinkService(string serviceName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPrivateLinkServiceAsync(string serviceName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.PrivateLinkServiceCollection GetPrivateLinkServices() { throw null; } + public virtual Azure.Response GetPublicIPAddress(string publicIPAddressName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPublicIPAddressAsync(string publicIPAddressName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.PublicIPAddressCollection GetPublicIPAddresses() { throw null; } + public virtual Azure.Response GetPublicIPPrefix(string publicIPPrefixName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPublicIPPrefixAsync(string publicIPPrefixName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.PublicIPPrefixCollection GetPublicIPPrefixes() { throw null; } + public virtual Azure.Response GetRouteFilter(string routeFilterName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRouteFilterAsync(string routeFilterName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.RouteFilterCollection GetRouteFilters() { throw null; } + public virtual Azure.Response GetRouteTable(string routeTableName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRouteTableAsync(string routeTableName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.RouteTableCollection GetRouteTables() { throw null; } + public virtual Azure.Response GetSecurityPartnerProvider(string securityPartnerProviderName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityPartnerProviderAsync(string securityPartnerProviderName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.SecurityPartnerProviderCollection GetSecurityPartnerProviders() { throw null; } + public virtual Azure.ResourceManager.Network.ServiceEndpointPolicyCollection GetServiceEndpointPolicies() { throw null; } + public virtual Azure.Response GetServiceEndpointPolicy(string serviceEndpointPolicyName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceEndpointPolicyAsync(string serviceEndpointPolicyName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetVirtualHub(string virtualHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualHubAsync(string virtualHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualHubCollection GetVirtualHubs() { throw null; } + public virtual Azure.Response GetVirtualNetwork(string virtualNetworkName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualNetworkAsync(string virtualNetworkName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetVirtualNetworkGateway(string virtualNetworkGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualNetworkGatewayAsync(string virtualNetworkGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetVirtualNetworkGatewayConnection(string virtualNetworkGatewayConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualNetworkGatewayConnectionAsync(string virtualNetworkGatewayConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkGatewayConnectionCollection GetVirtualNetworkGatewayConnections() { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkGatewayCollection GetVirtualNetworkGateways() { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkCollection GetVirtualNetworks() { throw null; } + public virtual Azure.Response GetVirtualNetworkTap(string tapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualNetworkTapAsync(string tapName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualNetworkTapCollection GetVirtualNetworkTaps() { throw null; } + public virtual Azure.Response GetVirtualRouter(string virtualRouterName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualRouterAsync(string virtualRouterName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualRouterCollection GetVirtualRouters() { throw null; } + public virtual Azure.Response GetVirtualWan(string virtualWanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualWanAsync(string virtualWanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.VirtualWanCollection GetVirtualWans() { throw null; } + public virtual Azure.Response GetVpnGateway(string gatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVpnGatewayAsync(string gatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.VpnGatewayCollection GetVpnGateways() { throw null; } + public virtual Azure.Response GetVpnServerConfiguration(string vpnServerConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVpnServerConfigurationAsync(string vpnServerConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.VpnServerConfigurationCollection GetVpnServerConfigurations() { throw null; } + public virtual Azure.Response GetVpnSite(string vpnSiteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVpnSiteAsync(string vpnSiteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.VpnSiteCollection GetVpnSites() { throw null; } + public virtual Azure.ResourceManager.Network.WebApplicationFirewallPolicyCollection GetWebApplicationFirewallPolicies() { throw null; } + public virtual Azure.Response GetWebApplicationFirewallPolicy(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWebApplicationFirewallPolicyAsync(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableNetworkSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkSubscriptionResource() { } + public virtual Azure.Response CheckDnsNameAvailability(Azure.Core.AzureLocation location, string domainNameLabel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDnsNameAvailabilityAsync(Azure.Core.AzureLocation location, string domainNameLabel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation CheckPrivateLinkServiceVisibilityPrivateLinkService(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Network.Models.CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPrivateLinkServiceVisibilityPrivateLinkServiceAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Network.Models.CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllServiceTagInformation(Azure.Core.AzureLocation location, bool? noAddressPrefixes = default(bool?), string tagName = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllServiceTagInformationAsync(Azure.Core.AzureLocation location, bool? noAddressPrefixes = default(bool?), string tagName = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppGatewayAvailableWafRuleSets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppGatewayAvailableWafRuleSetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetApplicationGatewayAvailableSslOptions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApplicationGatewayAvailableSslOptionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetApplicationGatewayAvailableSslPredefinedPolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApplicationGatewayAvailableSslPredefinedPoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetApplicationGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApplicationGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetApplicationGatewaySslPredefinedPolicy(string predefinedPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApplicationGatewaySslPredefinedPolicyAsync(string predefinedPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetApplicationGatewayWafDynamicManifest(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetApplicationGatewayWafDynamicManifestAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ApplicationGatewayWafDynamicManifestCollection GetApplicationGatewayWafDynamicManifests(Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Pageable GetApplicationSecurityGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApplicationSecurityGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAutoApprovedPrivateLinkServicesPrivateLinkServices(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAutoApprovedPrivateLinkServicesPrivateLinkServicesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableDelegations(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableDelegationsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableEndpointServices(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableEndpointServicesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailablePrivateEndpointTypes(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailablePrivateEndpointTypesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableRequestHeadersApplicationGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableRequestHeadersApplicationGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableResponseHeadersApplicationGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableResponseHeadersApplicationGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableServerVariablesApplicationGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableServerVariablesApplicationGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableServiceAliases(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableServiceAliasesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAzureFirewallFqdnTags(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAzureFirewallFqdnTagsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAzureFirewalls(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAzureFirewallsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.AzureWebCategoryCollection GetAzureWebCategories() { throw null; } + public virtual Azure.Response GetAzureWebCategory(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAzureWebCategoryAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBastionHosts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBastionHostsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBgpServiceCommunities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBgpServiceCommunitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCustomIPPrefixes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCustomIPPrefixesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDdosProtectionPlans(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDdosProtectionPlansAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDscpConfigurations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDscpConfigurationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetExpressRouteCircuits(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExpressRouteCircuitsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetExpressRouteCrossConnections(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExpressRouteCrossConnectionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetExpressRouteGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExpressRouteGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetExpressRoutePorts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExpressRoutePortsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetExpressRoutePortsLocation(string locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExpressRoutePortsLocationAsync(string locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRoutePortsLocationCollection GetExpressRoutePortsLocations() { throw null; } + public virtual Azure.Response GetExpressRouteProviderPort(string providerport, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExpressRouteProviderPortAsync(string providerport, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.ExpressRouteProviderPortCollection GetExpressRouteProviderPorts() { throw null; } + public virtual Azure.Pageable GetExpressRouteServiceProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExpressRouteServiceProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetFirewallPolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFirewallPoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetIPAllocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetIPAllocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetIPGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetIPGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLoadBalancers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLoadBalancersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNatGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNatGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkInterfaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkInterfacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkManagers(int? top = default(int?), string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkManagersAsync(int? top = default(int?), string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkProfiles(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkSecurityGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkSecurityGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkVirtualAppliances(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkVirtualAppliancesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkVirtualApplianceSku(string skuName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkVirtualApplianceSkuAsync(string skuName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.NetworkVirtualApplianceSkuCollection GetNetworkVirtualApplianceSkus() { throw null; } + public virtual Azure.Pageable GetNetworkWatchers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkWatchersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetP2SVpnGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetP2SVpnGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPrivateEndpoints(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateEndpointsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPrivateLinkServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateLinkServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPublicIPAddresses(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPublicIPAddressesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPublicIPPrefixes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPublicIPPrefixesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRouteFilters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRouteFiltersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRouteTables(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRouteTablesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecurityPartnerProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecurityPartnerProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetServiceEndpointPoliciesByServiceEndpointPolicy(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetServiceEndpointPoliciesByServiceEndpointPolicyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetServiceTag(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceTagAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSubscriptionNetworkManagerConnection(string networkManagerConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionNetworkManagerConnectionAsync(string networkManagerConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Network.SubscriptionNetworkManagerConnectionCollection GetSubscriptionNetworkManagerConnections() { throw null; } + public virtual Azure.Pageable GetUsages(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualHubs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualHubsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualNetworks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualNetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualNetworkTaps(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualNetworkTapsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualRouters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualRoutersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualWans(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualWansAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVpnGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVpnGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVpnServerConfigurations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVpnServerConfigurationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVpnSites(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVpnSitesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWebApplicationFirewallPolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWebApplicationFirewallPoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation SwapPublicIPAddressesLoadBalancer(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Network.Models.LoadBalancerVipSwapContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task SwapPublicIPAddressesLoadBalancerAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.Network.Models.LoadBalancerVipSwapContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Network.Models { public partial class AadAuthenticationParameters diff --git a/sdk/network/Azure.ResourceManager.Network/src/Customization/Extensions/NetworkExtensions.cs b/sdk/network/Azure.ResourceManager.Network/src/Customization/Extensions/NetworkExtensions.cs index 544c1724ec632..560afe0ccfd4d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Customization/Extensions/NetworkExtensions.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Customization/Extensions/NetworkExtensions.cs @@ -33,7 +33,7 @@ public static partial class NetworkExtensions [Obsolete("This method is obsoleted and will be removed in a future release, please use `GetAppGatewayAvailableWafRuleSetsAsync` instead", false)] public static AsyncPageable GetApplicationGatewayAvailableWafRuleSetsAsyncAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppGatewayAvailableWafRuleSetsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAppGatewayAvailableWafRuleSetsAsync(cancellationToken); } /// @@ -56,7 +56,7 @@ public static AsyncPageable GetApplicationGat [Obsolete("This method is obsoleted and will be removed in a future release, please use `GetAppGatewayAvailableWafRuleSets` instead", false)] public static Pageable GetApplicationGatewayAvailableWafRuleSetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppGatewayAvailableWafRuleSets(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAppGatewayAvailableWafRuleSets(cancellationToken); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupResource.cs index c79b3efe5803c..f4603138c095c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Network public partial class AdminRuleGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkManagerName. + /// The configurationName. + /// The ruleCollectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkManagerName, string configurationName, string ruleCollectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BaseAdminRuleResources and their operations over a BaseAdminRuleResource. public virtual BaseAdminRuleCollection GetBaseAdminRules() { - return GetCachedClient(Client => new BaseAdminRuleCollection(Client, Id)); + return GetCachedClient(client => new BaseAdminRuleCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual BaseAdminRuleCollection GetBaseAdminRules() /// /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBaseAdminRuleAsync(string ruleName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetBaseAdminRuleAsync /// /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBaseAdminRule(string ruleName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionResource.cs index 5ed4a5c262816..af45aa9828274 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ApplicationGatewayPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The applicationGatewayName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string applicationGatewayName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayResource.cs index 78051b280d1d5..9b77b150a3111 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Network public partial class ApplicationGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The applicationGatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string applicationGatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ApplicationGatewayPrivateEndpointConnectionResources and their operations over a ApplicationGatewayPrivateEndpointConnectionResource. public virtual ApplicationGatewayPrivateEndpointConnectionCollection GetApplicationGatewayPrivateEndpointConnections() { - return GetCachedClient(Client => new ApplicationGatewayPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ApplicationGatewayPrivateEndpointConnectionCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual ApplicationGatewayPrivateEndpointConnectionCollection GetApplicat /// /// The name of the application gateway private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetApplicationGatewayPrivateEndpointConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task /// The name of the application gateway private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetApplicationGatewayPrivateEndpointConnection(string connectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayWafDynamicManifestResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayWafDynamicManifestResource.cs index d93e64823ab9f..76f7254c57a82 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayWafDynamicManifestResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayWafDynamicManifestResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Network public partial class ApplicationGatewayWafDynamicManifestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupResource.cs index b9f76595c7171..a40f882863156 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class ApplicationSecurityGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The applicationSecurityGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string applicationSecurityGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallResource.cs index 7c5c86baf7050..34f917446e35c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class AzureFirewallResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureFirewallName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureFirewallName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureWebCategoryResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureWebCategoryResource.cs index f9f5d5e1072fa..114c16ac8814f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureWebCategoryResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureWebCategoryResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Network public partial class AzureWebCategoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string name) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolResource.cs index 295064a234cfd..706a22951b396 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Network public partial class BackendAddressPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The loadBalancerName. + /// The backendAddressPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string loadBalancerName, string backendAddressPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BaseAdminRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BaseAdminRuleResource.cs index 5953c6887926c..9f3c2eb808a7a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BaseAdminRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BaseAdminRuleResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Network public partial class BaseAdminRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkManagerName. + /// The configurationName. + /// The ruleCollectionName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkManagerName, string configurationName, string ruleCollectionName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}/ruleCollections/{ruleCollectionName}/rules/{ruleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostResource.cs index eabd5bbcc6ddb..1c5b076252a47 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class BastionHostResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The bastionHostName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string bastionHostName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionResource.cs index da820b3c1b3aa..190cf3799896a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Network public partial class BgpConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualHubName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualHubName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/CloudServiceSwapResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/CloudServiceSwapResource.cs index d4410e8b2ec77..c215569bed7ac 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/CloudServiceSwapResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/CloudServiceSwapResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Network public partial class CloudServiceSwapResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The groupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string groupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/swap"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectionMonitorResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectionMonitorResource.cs index 4094e18b7021d..fe8a6c5f4a66b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectionMonitorResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectionMonitorResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Network public partial class ConnectionMonitorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkWatcherName. + /// The connectionMonitorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkWatcherName, string connectionMonitorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectivityConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectivityConfigurationResource.cs index 272424ddb268c..4f5273dbe7e87 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectivityConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ConnectivityConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ConnectivityConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkManagerName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkManagerName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/connectivityConfigurations/{configurationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIPPrefixResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIPPrefixResource.cs index ba2f3eb5d0dbc..38b03f7497618 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIPPrefixResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIPPrefixResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class CustomIPPrefixResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The customIPPrefixName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string customIPPrefixName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIPPrefixName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyResource.cs index d5a27f87244fb..8b3ec8d49046c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class DdosCustomPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ddosCustomPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ddosCustomPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanResource.cs index ac2b9b02fa5f9..6ac71e331fb30 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class DdosProtectionPlanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ddosProtectionPlanName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ddosProtectionPlanName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DefaultSecurityRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DefaultSecurityRuleResource.cs index 179e536144aca..c6a29495fc9f8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DefaultSecurityRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DefaultSecurityRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class DefaultSecurityRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkSecurityGroupName. + /// The defaultSecurityRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkSecurityGroupName, string defaultSecurityRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationResource.cs index dd47c43dadcfe..0896bd63635f4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Network public partial class DscpConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dscpConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dscpConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationResource.cs index 3929efaf40602..4cc32815b135b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteCircuitAuthorizationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The circuitName. + /// The authorizationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string circuitName, string authorizationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionResource.cs index 13f1e92cba77d..aff9b2aa5978f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteCircuitConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The circuitName. + /// The peeringName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string circuitName, string peeringName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringResource.cs index cfe69db0150aa..aac5a5585b342 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteCircuitPeeringResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The circuitName. + /// The peeringName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string circuitName, string peeringName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}"; @@ -96,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ExpressRouteCircuitConnectionResources and their operations over a ExpressRouteCircuitConnectionResource. public virtual ExpressRouteCircuitConnectionCollection GetExpressRouteCircuitConnections() { - return GetCachedClient(Client => new ExpressRouteCircuitConnectionCollection(Client, Id)); + return GetCachedClient(client => new ExpressRouteCircuitConnectionCollection(client, Id)); } /// @@ -114,8 +118,8 @@ public virtual ExpressRouteCircuitConnectionCollection GetExpressRouteCircuitCon /// /// The name of the express route circuit connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExpressRouteCircuitConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -137,8 +141,8 @@ public virtual async Task> GetEx /// /// The name of the express route circuit connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExpressRouteCircuitConnection(string connectionName, CancellationToken cancellationToken = default) { @@ -149,7 +153,7 @@ public virtual Response GetExpressRouteCi /// An object representing collection of PeerExpressRouteCircuitConnectionResources and their operations over a PeerExpressRouteCircuitConnectionResource. public virtual PeerExpressRouteCircuitConnectionCollection GetPeerExpressRouteCircuitConnections() { - return GetCachedClient(Client => new PeerExpressRouteCircuitConnectionCollection(Client, Id)); + return GetCachedClient(client => new PeerExpressRouteCircuitConnectionCollection(client, Id)); } /// @@ -167,8 +171,8 @@ public virtual PeerExpressRouteCircuitConnectionCollection GetPeerExpressRouteCi /// /// The name of the peer express route circuit connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPeerExpressRouteCircuitConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -190,8 +194,8 @@ public virtual async Task> G /// /// The name of the peer express route circuit connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPeerExpressRouteCircuitConnection(string connectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitResource.cs index 3c91b792152a8..a784e16965c91 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteCircuitResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The circuitName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string circuitName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ExpressRouteCircuitAuthorizationResources and their operations over a ExpressRouteCircuitAuthorizationResource. public virtual ExpressRouteCircuitAuthorizationCollection GetExpressRouteCircuitAuthorizations() { - return GetCachedClient(Client => new ExpressRouteCircuitAuthorizationCollection(Client, Id)); + return GetCachedClient(client => new ExpressRouteCircuitAuthorizationCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ExpressRouteCircuitAuthorizationCollection GetExpressRouteCircuit /// /// The name of the authorization. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExpressRouteCircuitAuthorizationAsync(string authorizationName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> Ge /// /// The name of the authorization. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExpressRouteCircuitAuthorization(string authorizationName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetExpressRout /// An object representing collection of ExpressRouteCircuitPeeringResources and their operations over a ExpressRouteCircuitPeeringResource. public virtual ExpressRouteCircuitPeeringCollection GetExpressRouteCircuitPeerings() { - return GetCachedClient(Client => new ExpressRouteCircuitPeeringCollection(Client, Id)); + return GetCachedClient(client => new ExpressRouteCircuitPeeringCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual ExpressRouteCircuitPeeringCollection GetExpressRouteCircuitPeerin /// /// The name of the peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExpressRouteCircuitPeeringAsync(string peeringName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetExpre /// /// The name of the peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExpressRouteCircuitPeering(string peeringName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionResource.cs index 649edc82b858c..e2c1971a34a54 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The expressRouteGatewayName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string expressRouteGatewayName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringResource.cs index 11c9f99ae2c74..cd409dd0e9242 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteCrossConnectionPeeringResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The crossConnectionName. + /// The peeringName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string crossConnectionName, string peeringName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionResource.cs index 185a8249408c3..261254c6408c3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteCrossConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The crossConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string crossConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ExpressRouteCrossConnectionPeeringResources and their operations over a ExpressRouteCrossConnectionPeeringResource. public virtual ExpressRouteCrossConnectionPeeringCollection GetExpressRouteCrossConnectionPeerings() { - return GetCachedClient(Client => new ExpressRouteCrossConnectionPeeringCollection(Client, Id)); + return GetCachedClient(client => new ExpressRouteCrossConnectionPeeringCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ExpressRouteCrossConnectionPeeringCollection GetExpressRouteCross /// /// The name of the peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExpressRouteCrossConnectionPeeringAsync(string peeringName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> /// /// The name of the peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExpressRouteCrossConnectionPeering(string peeringName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayResource.cs index 599c36e3546d6..46708052f49fc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The expressRouteGatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string expressRouteGatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ExpressRouteConnectionResources and their operations over a ExpressRouteConnectionResource. public virtual ExpressRouteConnectionCollection GetExpressRouteConnections() { - return GetCachedClient(Client => new ExpressRouteConnectionCollection(Client, Id)); + return GetCachedClient(client => new ExpressRouteConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ExpressRouteConnectionCollection GetExpressRouteConnections() /// /// The name of the ExpressRoute connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExpressRouteConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetExpressRo /// /// The name of the ExpressRoute connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExpressRouteConnection(string connectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteLinkResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteLinkResource.cs index 10afac6b47714..ce11d4e5f2ad0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteLinkResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The expressRoutePortName. + /// The linkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string expressRoutePortName, string linkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortAuthorizationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortAuthorizationResource.cs index 32f34a208d404..4d537baa6bcb0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortAuthorizationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortAuthorizationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ExpressRoutePortAuthorizationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The expressRoutePortName. + /// The authorizationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string expressRoutePortName, string authorizationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortResource.cs index f76df3d252484..e61699b47e90d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class ExpressRoutePortResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The expressRoutePortName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string expressRoutePortName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ExpressRouteLinkResources and their operations over a ExpressRouteLinkResource. public virtual ExpressRouteLinkCollection GetExpressRouteLinks() { - return GetCachedClient(Client => new ExpressRouteLinkCollection(Client, Id)); + return GetCachedClient(client => new ExpressRouteLinkCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ExpressRouteLinkCollection GetExpressRouteLinks() /// /// The name of the ExpressRouteLink resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExpressRouteLinkAsync(string linkName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetExpressRouteLin /// /// The name of the ExpressRouteLink resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExpressRouteLink(string linkName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetExpressRouteLink(string lin /// An object representing collection of ExpressRoutePortAuthorizationResources and their operations over a ExpressRoutePortAuthorizationResource. public virtual ExpressRoutePortAuthorizationCollection GetExpressRoutePortAuthorizations() { - return GetCachedClient(Client => new ExpressRoutePortAuthorizationCollection(Client, Id)); + return GetCachedClient(client => new ExpressRoutePortAuthorizationCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual ExpressRoutePortAuthorizationCollection GetExpressRoutePortAuthor /// /// The name of the authorization. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetExpressRoutePortAuthorizationAsync(string authorizationName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetEx /// /// The name of the authorization. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetExpressRoutePortAuthorization(string authorizationName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortsLocationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortsLocationResource.cs index 74c926334f6e6..4971423b008e6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortsLocationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortsLocationResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Network public partial class ExpressRoutePortsLocationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string locationName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteProviderPortResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteProviderPortResource.cs index 4507d3e119e36..7031c414e4faa 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteProviderPortResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteProviderPortResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Network public partial class ExpressRouteProviderPortResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerport. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerport) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs deleted file mode 100644 index d680f58f9dbd3..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Network -{ - /// A class to add extension methods to ManagementGroupResource. - internal partial class ManagementGroupResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ManagementGroupResourceExtensionClient() - { - } - - /// 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 ManagementGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ManagementGroupNetworkManagerConnectionResources in the ManagementGroupResource. - /// An object representing collection of ManagementGroupNetworkManagerConnectionResources and their operations over a ManagementGroupNetworkManagerConnectionResource. - public virtual ManagementGroupNetworkManagerConnectionCollection GetManagementGroupNetworkManagerConnections() - { - return GetCachedClient(Client => new ManagementGroupNetworkManagerConnectionCollection(Client, Id)); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkArmClient.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkArmClient.cs new file mode 100644 index 0000000000000..494076fbc6cc9 --- /dev/null +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkArmClient.cs @@ -0,0 +1,1335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Network; + +namespace Azure.ResourceManager.Network.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNetworkArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetworkArmClient() + { + } + + /// 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 MockableNetworkArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNetworkArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApplicationGatewayResource GetApplicationGatewayResource(ResourceIdentifier id) + { + ApplicationGatewayResource.ValidateResourceId(id); + return new ApplicationGatewayResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApplicationGatewayPrivateEndpointConnectionResource GetApplicationGatewayPrivateEndpointConnectionResource(ResourceIdentifier id) + { + ApplicationGatewayPrivateEndpointConnectionResource.ValidateResourceId(id); + return new ApplicationGatewayPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApplicationGatewayWafDynamicManifestResource GetApplicationGatewayWafDynamicManifestResource(ResourceIdentifier id) + { + ApplicationGatewayWafDynamicManifestResource.ValidateResourceId(id); + return new ApplicationGatewayWafDynamicManifestResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ApplicationSecurityGroupResource GetApplicationSecurityGroupResource(ResourceIdentifier id) + { + ApplicationSecurityGroupResource.ValidateResourceId(id); + return new ApplicationSecurityGroupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AzureFirewallResource GetAzureFirewallResource(ResourceIdentifier id) + { + AzureFirewallResource.ValidateResourceId(id); + return new AzureFirewallResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AzureWebCategoryResource GetAzureWebCategoryResource(ResourceIdentifier id) + { + AzureWebCategoryResource.ValidateResourceId(id); + return new AzureWebCategoryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BastionHostResource GetBastionHostResource(ResourceIdentifier id) + { + BastionHostResource.ValidateResourceId(id); + return new BastionHostResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteProviderPortResource GetExpressRouteProviderPortResource(ResourceIdentifier id) + { + ExpressRouteProviderPortResource.ValidateResourceId(id); + return new ExpressRouteProviderPortResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CloudServiceSwapResource GetCloudServiceSwapResource(ResourceIdentifier id) + { + CloudServiceSwapResource.ValidateResourceId(id); + return new CloudServiceSwapResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CustomIPPrefixResource GetCustomIPPrefixResource(ResourceIdentifier id) + { + CustomIPPrefixResource.ValidateResourceId(id); + return new CustomIPPrefixResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DdosCustomPolicyResource GetDdosCustomPolicyResource(ResourceIdentifier id) + { + DdosCustomPolicyResource.ValidateResourceId(id); + return new DdosCustomPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DdosProtectionPlanResource GetDdosProtectionPlanResource(ResourceIdentifier id) + { + DdosProtectionPlanResource.ValidateResourceId(id); + return new DdosProtectionPlanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DscpConfigurationResource GetDscpConfigurationResource(ResourceIdentifier id) + { + DscpConfigurationResource.ValidateResourceId(id); + return new DscpConfigurationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteCircuitAuthorizationResource GetExpressRouteCircuitAuthorizationResource(ResourceIdentifier id) + { + ExpressRouteCircuitAuthorizationResource.ValidateResourceId(id); + return new ExpressRouteCircuitAuthorizationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteCircuitPeeringResource GetExpressRouteCircuitPeeringResource(ResourceIdentifier id) + { + ExpressRouteCircuitPeeringResource.ValidateResourceId(id); + return new ExpressRouteCircuitPeeringResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteCircuitConnectionResource GetExpressRouteCircuitConnectionResource(ResourceIdentifier id) + { + ExpressRouteCircuitConnectionResource.ValidateResourceId(id); + return new ExpressRouteCircuitConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PeerExpressRouteCircuitConnectionResource GetPeerExpressRouteCircuitConnectionResource(ResourceIdentifier id) + { + PeerExpressRouteCircuitConnectionResource.ValidateResourceId(id); + return new PeerExpressRouteCircuitConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteCircuitResource GetExpressRouteCircuitResource(ResourceIdentifier id) + { + ExpressRouteCircuitResource.ValidateResourceId(id); + return new ExpressRouteCircuitResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteCrossConnectionResource GetExpressRouteCrossConnectionResource(ResourceIdentifier id) + { + ExpressRouteCrossConnectionResource.ValidateResourceId(id); + return new ExpressRouteCrossConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteCrossConnectionPeeringResource GetExpressRouteCrossConnectionPeeringResource(ResourceIdentifier id) + { + ExpressRouteCrossConnectionPeeringResource.ValidateResourceId(id); + return new ExpressRouteCrossConnectionPeeringResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRoutePortsLocationResource GetExpressRoutePortsLocationResource(ResourceIdentifier id) + { + ExpressRoutePortsLocationResource.ValidateResourceId(id); + return new ExpressRoutePortsLocationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRoutePortResource GetExpressRoutePortResource(ResourceIdentifier id) + { + ExpressRoutePortResource.ValidateResourceId(id); + return new ExpressRoutePortResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteLinkResource GetExpressRouteLinkResource(ResourceIdentifier id) + { + ExpressRouteLinkResource.ValidateResourceId(id); + return new ExpressRouteLinkResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRoutePortAuthorizationResource GetExpressRoutePortAuthorizationResource(ResourceIdentifier id) + { + ExpressRoutePortAuthorizationResource.ValidateResourceId(id); + return new ExpressRoutePortAuthorizationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FirewallPolicyResource GetFirewallPolicyResource(ResourceIdentifier id) + { + FirewallPolicyResource.ValidateResourceId(id); + return new FirewallPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FirewallPolicyRuleCollectionGroupResource GetFirewallPolicyRuleCollectionGroupResource(ResourceIdentifier id) + { + FirewallPolicyRuleCollectionGroupResource.ValidateResourceId(id); + return new FirewallPolicyRuleCollectionGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PolicySignaturesOverridesForIdpsResource GetPolicySignaturesOverridesForIdpsResource(ResourceIdentifier id) + { + PolicySignaturesOverridesForIdpsResource.ValidateResourceId(id); + return new PolicySignaturesOverridesForIdpsResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IPAllocationResource GetIPAllocationResource(ResourceIdentifier id) + { + IPAllocationResource.ValidateResourceId(id); + return new IPAllocationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IPGroupResource GetIPGroupResource(ResourceIdentifier id) + { + IPGroupResource.ValidateResourceId(id); + return new IPGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LoadBalancerResource GetLoadBalancerResource(ResourceIdentifier id) + { + LoadBalancerResource.ValidateResourceId(id); + return new LoadBalancerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackendAddressPoolResource GetBackendAddressPoolResource(ResourceIdentifier id) + { + BackendAddressPoolResource.ValidateResourceId(id); + return new BackendAddressPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontendIPConfigurationResource GetFrontendIPConfigurationResource(ResourceIdentifier id) + { + FrontendIPConfigurationResource.ValidateResourceId(id); + return new FrontendIPConfigurationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual InboundNatRuleResource GetInboundNatRuleResource(ResourceIdentifier id) + { + InboundNatRuleResource.ValidateResourceId(id); + return new InboundNatRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LoadBalancingRuleResource GetLoadBalancingRuleResource(ResourceIdentifier id) + { + LoadBalancingRuleResource.ValidateResourceId(id); + return new LoadBalancingRuleResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OutboundRuleResource GetOutboundRuleResource(ResourceIdentifier id) + { + OutboundRuleResource.ValidateResourceId(id); + return new OutboundRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProbeResource GetProbeResource(ResourceIdentifier id) + { + ProbeResource.ValidateResourceId(id); + return new ProbeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NatGatewayResource GetNatGatewayResource(ResourceIdentifier id) + { + NatGatewayResource.ValidateResourceId(id); + return new NatGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkInterfaceResource GetNetworkInterfaceResource(ResourceIdentifier id) + { + NetworkInterfaceResource.ValidateResourceId(id); + return new NetworkInterfaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkInterfaceIPConfigurationResource GetNetworkInterfaceIPConfigurationResource(ResourceIdentifier id) + { + NetworkInterfaceIPConfigurationResource.ValidateResourceId(id); + return new NetworkInterfaceIPConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkInterfaceTapConfigurationResource GetNetworkInterfaceTapConfigurationResource(ResourceIdentifier id) + { + NetworkInterfaceTapConfigurationResource.ValidateResourceId(id); + return new NetworkInterfaceTapConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkManagerResource GetNetworkManagerResource(ResourceIdentifier id) + { + NetworkManagerResource.ValidateResourceId(id); + return new NetworkManagerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionNetworkManagerConnectionResource GetSubscriptionNetworkManagerConnectionResource(ResourceIdentifier id) + { + SubscriptionNetworkManagerConnectionResource.ValidateResourceId(id); + return new SubscriptionNetworkManagerConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagementGroupNetworkManagerConnectionResource GetManagementGroupNetworkManagerConnectionResource(ResourceIdentifier id) + { + ManagementGroupNetworkManagerConnectionResource.ValidateResourceId(id); + return new ManagementGroupNetworkManagerConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConnectivityConfigurationResource GetConnectivityConfigurationResource(ResourceIdentifier id) + { + ConnectivityConfigurationResource.ValidateResourceId(id); + return new ConnectivityConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkGroupResource GetNetworkGroupResource(ResourceIdentifier id) + { + NetworkGroupResource.ValidateResourceId(id); + return new NetworkGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkGroupStaticMemberResource GetNetworkGroupStaticMemberResource(ResourceIdentifier id) + { + NetworkGroupStaticMemberResource.ValidateResourceId(id); + return new NetworkGroupStaticMemberResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScopeConnectionResource GetScopeConnectionResource(ResourceIdentifier id) + { + ScopeConnectionResource.ValidateResourceId(id); + return new ScopeConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityAdminConfigurationResource GetSecurityAdminConfigurationResource(ResourceIdentifier id) + { + SecurityAdminConfigurationResource.ValidateResourceId(id); + return new SecurityAdminConfigurationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AdminRuleGroupResource GetAdminRuleGroupResource(ResourceIdentifier id) + { + AdminRuleGroupResource.ValidateResourceId(id); + return new AdminRuleGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BaseAdminRuleResource GetBaseAdminRuleResource(ResourceIdentifier id) + { + BaseAdminRuleResource.ValidateResourceId(id); + return new BaseAdminRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkProfileResource GetNetworkProfileResource(ResourceIdentifier id) + { + NetworkProfileResource.ValidateResourceId(id); + return new NetworkProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkSecurityGroupResource GetNetworkSecurityGroupResource(ResourceIdentifier id) + { + NetworkSecurityGroupResource.ValidateResourceId(id); + return new NetworkSecurityGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityRuleResource GetSecurityRuleResource(ResourceIdentifier id) + { + SecurityRuleResource.ValidateResourceId(id); + return new SecurityRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DefaultSecurityRuleResource GetDefaultSecurityRuleResource(ResourceIdentifier id) + { + DefaultSecurityRuleResource.ValidateResourceId(id); + return new DefaultSecurityRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkVirtualApplianceResource GetNetworkVirtualApplianceResource(ResourceIdentifier id) + { + NetworkVirtualApplianceResource.ValidateResourceId(id); + return new NetworkVirtualApplianceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualApplianceSiteResource GetVirtualApplianceSiteResource(ResourceIdentifier id) + { + VirtualApplianceSiteResource.ValidateResourceId(id); + return new VirtualApplianceSiteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkVirtualApplianceSkuResource GetNetworkVirtualApplianceSkuResource(ResourceIdentifier id) + { + NetworkVirtualApplianceSkuResource.ValidateResourceId(id); + return new NetworkVirtualApplianceSkuResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkWatcherResource GetNetworkWatcherResource(ResourceIdentifier id) + { + NetworkWatcherResource.ValidateResourceId(id); + return new NetworkWatcherResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PacketCaptureResource GetPacketCaptureResource(ResourceIdentifier id) + { + PacketCaptureResource.ValidateResourceId(id); + return new PacketCaptureResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConnectionMonitorResource GetConnectionMonitorResource(ResourceIdentifier id) + { + ConnectionMonitorResource.ValidateResourceId(id); + return new ConnectionMonitorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FlowLogResource GetFlowLogResource(ResourceIdentifier id) + { + FlowLogResource.ValidateResourceId(id); + return new FlowLogResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateEndpointResource GetPrivateEndpointResource(ResourceIdentifier id) + { + PrivateEndpointResource.ValidateResourceId(id); + return new PrivateEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsZoneGroupResource GetPrivateDnsZoneGroupResource(ResourceIdentifier id) + { + PrivateDnsZoneGroupResource.ValidateResourceId(id); + return new PrivateDnsZoneGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateLinkServiceResource GetPrivateLinkServiceResource(ResourceIdentifier id) + { + PrivateLinkServiceResource.ValidateResourceId(id); + return new PrivateLinkServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkPrivateEndpointConnectionResource GetNetworkPrivateEndpointConnectionResource(ResourceIdentifier id) + { + NetworkPrivateEndpointConnectionResource.ValidateResourceId(id); + return new NetworkPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PublicIPAddressResource GetPublicIPAddressResource(ResourceIdentifier id) + { + PublicIPAddressResource.ValidateResourceId(id); + return new PublicIPAddressResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PublicIPPrefixResource GetPublicIPPrefixResource(ResourceIdentifier id) + { + PublicIPPrefixResource.ValidateResourceId(id); + return new PublicIPPrefixResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RouteFilterResource GetRouteFilterResource(ResourceIdentifier id) + { + RouteFilterResource.ValidateResourceId(id); + return new RouteFilterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RouteFilterRuleResource GetRouteFilterRuleResource(ResourceIdentifier id) + { + RouteFilterRuleResource.ValidateResourceId(id); + return new RouteFilterRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RouteTableResource GetRouteTableResource(ResourceIdentifier id) + { + RouteTableResource.ValidateResourceId(id); + return new RouteTableResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RouteResource GetRouteResource(ResourceIdentifier id) + { + RouteResource.ValidateResourceId(id); + return new RouteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityPartnerProviderResource GetSecurityPartnerProviderResource(ResourceIdentifier id) + { + SecurityPartnerProviderResource.ValidateResourceId(id); + return new SecurityPartnerProviderResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceEndpointPolicyResource GetServiceEndpointPolicyResource(ResourceIdentifier id) + { + ServiceEndpointPolicyResource.ValidateResourceId(id); + return new ServiceEndpointPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceEndpointPolicyDefinitionResource GetServiceEndpointPolicyDefinitionResource(ResourceIdentifier id) + { + ServiceEndpointPolicyDefinitionResource.ValidateResourceId(id); + return new ServiceEndpointPolicyDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkResource GetVirtualNetworkResource(ResourceIdentifier id) + { + VirtualNetworkResource.ValidateResourceId(id); + return new VirtualNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubnetResource GetSubnetResource(ResourceIdentifier id) + { + SubnetResource.ValidateResourceId(id); + return new SubnetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkPeeringResource GetVirtualNetworkPeeringResource(ResourceIdentifier id) + { + VirtualNetworkPeeringResource.ValidateResourceId(id); + return new VirtualNetworkPeeringResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkGatewayResource GetVirtualNetworkGatewayResource(ResourceIdentifier id) + { + VirtualNetworkGatewayResource.ValidateResourceId(id); + return new VirtualNetworkGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkGatewayConnectionResource GetVirtualNetworkGatewayConnectionResource(ResourceIdentifier id) + { + VirtualNetworkGatewayConnectionResource.ValidateResourceId(id); + return new VirtualNetworkGatewayConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LocalNetworkGatewayResource GetLocalNetworkGatewayResource(ResourceIdentifier id) + { + LocalNetworkGatewayResource.ValidateResourceId(id); + return new LocalNetworkGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkGatewayNatRuleResource GetVirtualNetworkGatewayNatRuleResource(ResourceIdentifier id) + { + VirtualNetworkGatewayNatRuleResource.ValidateResourceId(id); + return new VirtualNetworkGatewayNatRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkTapResource GetVirtualNetworkTapResource(ResourceIdentifier id) + { + VirtualNetworkTapResource.ValidateResourceId(id); + return new VirtualNetworkTapResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualRouterResource GetVirtualRouterResource(ResourceIdentifier id) + { + VirtualRouterResource.ValidateResourceId(id); + return new VirtualRouterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualRouterPeeringResource GetVirtualRouterPeeringResource(ResourceIdentifier id) + { + VirtualRouterPeeringResource.ValidateResourceId(id); + return new VirtualRouterPeeringResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualWanResource GetVirtualWanResource(ResourceIdentifier id) + { + VirtualWanResource.ValidateResourceId(id); + return new VirtualWanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VpnSiteResource GetVpnSiteResource(ResourceIdentifier id) + { + VpnSiteResource.ValidateResourceId(id); + return new VpnSiteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VpnSiteLinkResource GetVpnSiteLinkResource(ResourceIdentifier id) + { + VpnSiteLinkResource.ValidateResourceId(id); + return new VpnSiteLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VpnServerConfigurationResource GetVpnServerConfigurationResource(ResourceIdentifier id) + { + VpnServerConfigurationResource.ValidateResourceId(id); + return new VpnServerConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VpnServerConfigurationPolicyGroupResource GetVpnServerConfigurationPolicyGroupResource(ResourceIdentifier id) + { + VpnServerConfigurationPolicyGroupResource.ValidateResourceId(id); + return new VpnServerConfigurationPolicyGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualHubResource GetVirtualHubResource(ResourceIdentifier id) + { + VirtualHubResource.ValidateResourceId(id); + return new VirtualHubResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RouteMapResource GetRouteMapResource(ResourceIdentifier id) + { + RouteMapResource.ValidateResourceId(id); + return new RouteMapResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HubVirtualNetworkConnectionResource GetHubVirtualNetworkConnectionResource(ResourceIdentifier id) + { + HubVirtualNetworkConnectionResource.ValidateResourceId(id); + return new HubVirtualNetworkConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VpnGatewayResource GetVpnGatewayResource(ResourceIdentifier id) + { + VpnGatewayResource.ValidateResourceId(id); + return new VpnGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VpnConnectionResource GetVpnConnectionResource(ResourceIdentifier id) + { + VpnConnectionResource.ValidateResourceId(id); + return new VpnConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VpnSiteLinkConnectionResource GetVpnSiteLinkConnectionResource(ResourceIdentifier id) + { + VpnSiteLinkConnectionResource.ValidateResourceId(id); + return new VpnSiteLinkConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VpnGatewayNatRuleResource GetVpnGatewayNatRuleResource(ResourceIdentifier id) + { + VpnGatewayNatRuleResource.ValidateResourceId(id); + return new VpnGatewayNatRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual P2SVpnGatewayResource GetP2SVpnGatewayResource(ResourceIdentifier id) + { + P2SVpnGatewayResource.ValidateResourceId(id); + return new P2SVpnGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualHubRouteTableV2Resource GetVirtualHubRouteTableV2Resource(ResourceIdentifier id) + { + VirtualHubRouteTableV2Resource.ValidateResourceId(id); + return new VirtualHubRouteTableV2Resource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteGatewayResource GetExpressRouteGatewayResource(ResourceIdentifier id) + { + ExpressRouteGatewayResource.ValidateResourceId(id); + return new ExpressRouteGatewayResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExpressRouteConnectionResource GetExpressRouteConnectionResource(ResourceIdentifier id) + { + ExpressRouteConnectionResource.ValidateResourceId(id); + return new ExpressRouteConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkVirtualApplianceConnectionResource GetNetworkVirtualApplianceConnectionResource(ResourceIdentifier id) + { + NetworkVirtualApplianceConnectionResource.ValidateResourceId(id); + return new NetworkVirtualApplianceConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BgpConnectionResource GetBgpConnectionResource(ResourceIdentifier id) + { + BgpConnectionResource.ValidateResourceId(id); + return new BgpConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HubIPConfigurationResource GetHubIPConfigurationResource(ResourceIdentifier id) + { + HubIPConfigurationResource.ValidateResourceId(id); + return new HubIPConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HubRouteTableResource GetHubRouteTableResource(ResourceIdentifier id) + { + HubRouteTableResource.ValidateResourceId(id); + return new HubRouteTableResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RoutingIntentResource GetRoutingIntentResource(ResourceIdentifier id) + { + RoutingIntentResource.ValidateResourceId(id); + return new RoutingIntentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebApplicationFirewallPolicyResource GetWebApplicationFirewallPolicyResource(ResourceIdentifier id) + { + WebApplicationFirewallPolicyResource.ValidateResourceId(id); + return new WebApplicationFirewallPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineScaleSetNetworkResource GetVirtualMachineScaleSetNetworkResource(ResourceIdentifier id) + { + VirtualMachineScaleSetNetworkResource.ValidateResourceId(id); + return new VirtualMachineScaleSetNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualMachineScaleSetVmNetworkResource GetVirtualMachineScaleSetVmNetworkResource(ResourceIdentifier id) + { + VirtualMachineScaleSetVmNetworkResource.ValidateResourceId(id); + return new VirtualMachineScaleSetVmNetworkResource(Client, id); + } + } +} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkManagementGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkManagementGroupResource.cs new file mode 100644 index 0000000000000..a1fb9869cc529 --- /dev/null +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkManagementGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Network; + +namespace Azure.ResourceManager.Network.Mocking +{ + /// A class to add extension methods to ManagementGroupResource. + public partial class MockableNetworkManagementGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetworkManagementGroupResource() + { + } + + /// 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 MockableNetworkManagementGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ManagementGroupNetworkManagerConnectionResources in the ManagementGroupResource. + /// An object representing collection of ManagementGroupNetworkManagerConnectionResources and their operations over a ManagementGroupNetworkManagerConnectionResource. + public virtual ManagementGroupNetworkManagerConnectionCollection GetManagementGroupNetworkManagerConnections() + { + return GetCachedClient(client => new ManagementGroupNetworkManagerConnectionCollection(client, Id)); + } + + /// + /// Get a specified connection created by this management group. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName} + /// + /// + /// Operation Id + /// ManagementGroupNetworkManagerConnections_Get + /// + /// + /// + /// Name for the network manager connection. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagementGroupNetworkManagerConnectionAsync(string networkManagerConnectionName, CancellationToken cancellationToken = default) + { + return await GetManagementGroupNetworkManagerConnections().GetAsync(networkManagerConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specified connection created by this management group. + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName} + /// + /// + /// Operation Id + /// ManagementGroupNetworkManagerConnections_Get + /// + /// + /// + /// Name for the network manager connection. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagementGroupNetworkManagerConnection(string networkManagerConnectionName, CancellationToken cancellationToken = default) + { + return GetManagementGroupNetworkManagerConnections().Get(networkManagerConnectionName, cancellationToken); + } + } +} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkResourceGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkResourceGroupResource.cs new file mode 100644 index 0000000000000..025e3aba418f1 --- /dev/null +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkResourceGroupResource.cs @@ -0,0 +1,2748 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Network; +using Azure.ResourceManager.Network.Models; + +namespace Azure.ResourceManager.Network.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNetworkResourceGroupResource : ArmResource + { + private ClientDiagnostics _availableResourceGroupDelegationsClientDiagnostics; + private AvailableResourceGroupDelegationsRestOperations _availableResourceGroupDelegationsRestClient; + private ClientDiagnostics _availableServiceAliasesClientDiagnostics; + private AvailableServiceAliasesRestOperations _availableServiceAliasesRestClient; + private ClientDiagnostics _availablePrivateEndpointTypesClientDiagnostics; + private AvailablePrivateEndpointTypesRestOperations _availablePrivateEndpointTypesRestClient; + private ClientDiagnostics _privateLinkServicesClientDiagnostics; + private PrivateLinkServicesRestOperations _privateLinkServicesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNetworkResourceGroupResource() + { + } + + /// 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 MockableNetworkResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AvailableResourceGroupDelegationsClientDiagnostics => _availableResourceGroupDelegationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableResourceGroupDelegationsRestOperations AvailableResourceGroupDelegationsRestClient => _availableResourceGroupDelegationsRestClient ??= new AvailableResourceGroupDelegationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AvailableServiceAliasesClientDiagnostics => _availableServiceAliasesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableServiceAliasesRestOperations AvailableServiceAliasesRestClient => _availableServiceAliasesRestClient ??= new AvailableServiceAliasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AvailablePrivateEndpointTypesClientDiagnostics => _availablePrivateEndpointTypesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailablePrivateEndpointTypesRestOperations AvailablePrivateEndpointTypesRestClient => _availablePrivateEndpointTypesRestClient ??= new AvailablePrivateEndpointTypesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PrivateLinkServicesClientDiagnostics => _privateLinkServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PrivateLinkServicesRestOperations PrivateLinkServicesRestClient => _privateLinkServicesRestClient ??= new PrivateLinkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ApplicationGatewayResources in the ResourceGroupResource. + /// An object representing collection of ApplicationGatewayResources and their operations over a ApplicationGatewayResource. + public virtual ApplicationGatewayCollection GetApplicationGateways() + { + return GetCachedClient(client => new ApplicationGatewayCollection(client, Id)); + } + + /// + /// Gets the specified application gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName} + /// + /// + /// Operation Id + /// ApplicationGateways_Get + /// + /// + /// + /// The name of the application gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetApplicationGatewayAsync(string applicationGatewayName, CancellationToken cancellationToken = default) + { + return await GetApplicationGateways().GetAsync(applicationGatewayName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified application gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName} + /// + /// + /// Operation Id + /// ApplicationGateways_Get + /// + /// + /// + /// The name of the application gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetApplicationGateway(string applicationGatewayName, CancellationToken cancellationToken = default) + { + return GetApplicationGateways().Get(applicationGatewayName, cancellationToken); + } + + /// Gets a collection of ApplicationSecurityGroupResources in the ResourceGroupResource. + /// An object representing collection of ApplicationSecurityGroupResources and their operations over a ApplicationSecurityGroupResource. + public virtual ApplicationSecurityGroupCollection GetApplicationSecurityGroups() + { + return GetCachedClient(client => new ApplicationSecurityGroupCollection(client, Id)); + } + + /// + /// Gets information about the specified application security group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName} + /// + /// + /// Operation Id + /// ApplicationSecurityGroups_Get + /// + /// + /// + /// The name of the application security group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetApplicationSecurityGroupAsync(string applicationSecurityGroupName, CancellationToken cancellationToken = default) + { + return await GetApplicationSecurityGroups().GetAsync(applicationSecurityGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified application security group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName} + /// + /// + /// Operation Id + /// ApplicationSecurityGroups_Get + /// + /// + /// + /// The name of the application security group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetApplicationSecurityGroup(string applicationSecurityGroupName, CancellationToken cancellationToken = default) + { + return GetApplicationSecurityGroups().Get(applicationSecurityGroupName, cancellationToken); + } + + /// Gets a collection of AzureFirewallResources in the ResourceGroupResource. + /// An object representing collection of AzureFirewallResources and their operations over a AzureFirewallResource. + public virtual AzureFirewallCollection GetAzureFirewalls() + { + return GetCachedClient(client => new AzureFirewallCollection(client, Id)); + } + + /// + /// Gets the specified Azure Firewall. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName} + /// + /// + /// Operation Id + /// AzureFirewalls_Get + /// + /// + /// + /// The name of the Azure Firewall. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAzureFirewallAsync(string azureFirewallName, CancellationToken cancellationToken = default) + { + return await GetAzureFirewalls().GetAsync(azureFirewallName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Azure Firewall. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName} + /// + /// + /// Operation Id + /// AzureFirewalls_Get + /// + /// + /// + /// The name of the Azure Firewall. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAzureFirewall(string azureFirewallName, CancellationToken cancellationToken = default) + { + return GetAzureFirewalls().Get(azureFirewallName, cancellationToken); + } + + /// Gets a collection of BastionHostResources in the ResourceGroupResource. + /// An object representing collection of BastionHostResources and their operations over a BastionHostResource. + public virtual BastionHostCollection GetBastionHosts() + { + return GetCachedClient(client => new BastionHostCollection(client, Id)); + } + + /// + /// Gets the specified Bastion Host. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName} + /// + /// + /// Operation Id + /// BastionHosts_Get + /// + /// + /// + /// The name of the Bastion Host. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBastionHostAsync(string bastionHostName, CancellationToken cancellationToken = default) + { + return await GetBastionHosts().GetAsync(bastionHostName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Bastion Host. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName} + /// + /// + /// Operation Id + /// BastionHosts_Get + /// + /// + /// + /// The name of the Bastion Host. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBastionHost(string bastionHostName, CancellationToken cancellationToken = default) + { + return GetBastionHosts().Get(bastionHostName, cancellationToken); + } + + /// Gets a collection of CloudServiceSwapResources in the ResourceGroupResource. + /// The name of the cloud service. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of CloudServiceSwapResources and their operations over a CloudServiceSwapResource. + public virtual CloudServiceSwapCollection GetCloudServiceSwaps(string resourceName) + { + return new CloudServiceSwapCollection(Client, Id, resourceName); + } + + /// + /// Gets the SwapResource which identifies the slot type for the specified cloud service. The slot type on a cloud service can either be Staging or Production + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource} + /// + /// + /// Operation Id + /// VipSwap_Get + /// + /// + /// + /// The name of the cloud service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCloudServiceSwapAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetCloudServiceSwaps(resourceName).GetAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the SwapResource which identifies the slot type for the specified cloud service. The slot type on a cloud service can either be Staging or Production + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Compute/cloudServices/{resourceName}/providers/Microsoft.Network/cloudServiceSlots/{singletonResource} + /// + /// + /// Operation Id + /// VipSwap_Get + /// + /// + /// + /// The name of the cloud service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCloudServiceSwap(string resourceName, CancellationToken cancellationToken = default) + { + return GetCloudServiceSwaps(resourceName).Get(cancellationToken); + } + + /// Gets a collection of CustomIPPrefixResources in the ResourceGroupResource. + /// An object representing collection of CustomIPPrefixResources and their operations over a CustomIPPrefixResource. + public virtual CustomIPPrefixCollection GetCustomIPPrefixes() + { + return GetCachedClient(client => new CustomIPPrefixCollection(client, Id)); + } + + /// + /// Gets the specified custom IP prefix in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName} + /// + /// + /// Operation Id + /// CustomIPPrefixes_Get + /// + /// + /// + /// The name of the custom IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCustomIPPrefixAsync(string customIPPrefixName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetCustomIPPrefixes().GetAsync(customIPPrefixName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified custom IP prefix in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName} + /// + /// + /// Operation Id + /// CustomIPPrefixes_Get + /// + /// + /// + /// The name of the custom IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCustomIPPrefix(string customIPPrefixName, string expand = null, CancellationToken cancellationToken = default) + { + return GetCustomIPPrefixes().Get(customIPPrefixName, expand, cancellationToken); + } + + /// Gets a collection of DdosCustomPolicyResources in the ResourceGroupResource. + /// An object representing collection of DdosCustomPolicyResources and their operations over a DdosCustomPolicyResource. + public virtual DdosCustomPolicyCollection GetDdosCustomPolicies() + { + return GetCachedClient(client => new DdosCustomPolicyCollection(client, Id)); + } + + /// + /// Gets information about the specified DDoS custom policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName} + /// + /// + /// Operation Id + /// DdosCustomPolicies_Get + /// + /// + /// + /// The name of the DDoS custom policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDdosCustomPolicyAsync(string ddosCustomPolicyName, CancellationToken cancellationToken = default) + { + return await GetDdosCustomPolicies().GetAsync(ddosCustomPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified DDoS custom policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName} + /// + /// + /// Operation Id + /// DdosCustomPolicies_Get + /// + /// + /// + /// The name of the DDoS custom policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDdosCustomPolicy(string ddosCustomPolicyName, CancellationToken cancellationToken = default) + { + return GetDdosCustomPolicies().Get(ddosCustomPolicyName, cancellationToken); + } + + /// Gets a collection of DdosProtectionPlanResources in the ResourceGroupResource. + /// An object representing collection of DdosProtectionPlanResources and their operations over a DdosProtectionPlanResource. + public virtual DdosProtectionPlanCollection GetDdosProtectionPlans() + { + return GetCachedClient(client => new DdosProtectionPlanCollection(client, Id)); + } + + /// + /// Gets information about the specified DDoS protection plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName} + /// + /// + /// Operation Id + /// DdosProtectionPlans_Get + /// + /// + /// + /// The name of the DDoS protection plan. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDdosProtectionPlanAsync(string ddosProtectionPlanName, CancellationToken cancellationToken = default) + { + return await GetDdosProtectionPlans().GetAsync(ddosProtectionPlanName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified DDoS protection plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName} + /// + /// + /// Operation Id + /// DdosProtectionPlans_Get + /// + /// + /// + /// The name of the DDoS protection plan. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDdosProtectionPlan(string ddosProtectionPlanName, CancellationToken cancellationToken = default) + { + return GetDdosProtectionPlans().Get(ddosProtectionPlanName, cancellationToken); + } + + /// Gets a collection of DscpConfigurationResources in the ResourceGroupResource. + /// An object representing collection of DscpConfigurationResources and their operations over a DscpConfigurationResource. + public virtual DscpConfigurationCollection GetDscpConfigurations() + { + return GetCachedClient(client => new DscpConfigurationCollection(client, Id)); + } + + /// + /// Gets a DSCP Configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName} + /// + /// + /// Operation Id + /// DscpConfiguration_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDscpConfigurationAsync(string dscpConfigurationName, CancellationToken cancellationToken = default) + { + return await GetDscpConfigurations().GetAsync(dscpConfigurationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a DSCP Configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName} + /// + /// + /// Operation Id + /// DscpConfiguration_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDscpConfiguration(string dscpConfigurationName, CancellationToken cancellationToken = default) + { + return GetDscpConfigurations().Get(dscpConfigurationName, cancellationToken); + } + + /// Gets a collection of ExpressRouteCircuitResources in the ResourceGroupResource. + /// An object representing collection of ExpressRouteCircuitResources and their operations over a ExpressRouteCircuitResource. + public virtual ExpressRouteCircuitCollection GetExpressRouteCircuits() + { + return GetCachedClient(client => new ExpressRouteCircuitCollection(client, Id)); + } + + /// + /// Gets information about the specified express route circuit. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName} + /// + /// + /// Operation Id + /// ExpressRouteCircuits_Get + /// + /// + /// + /// The name of express route circuit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetExpressRouteCircuitAsync(string circuitName, CancellationToken cancellationToken = default) + { + return await GetExpressRouteCircuits().GetAsync(circuitName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified express route circuit. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName} + /// + /// + /// Operation Id + /// ExpressRouteCircuits_Get + /// + /// + /// + /// The name of express route circuit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetExpressRouteCircuit(string circuitName, CancellationToken cancellationToken = default) + { + return GetExpressRouteCircuits().Get(circuitName, cancellationToken); + } + + /// Gets a collection of ExpressRouteCrossConnectionResources in the ResourceGroupResource. + /// An object representing collection of ExpressRouteCrossConnectionResources and their operations over a ExpressRouteCrossConnectionResource. + public virtual ExpressRouteCrossConnectionCollection GetExpressRouteCrossConnections() + { + return GetCachedClient(client => new ExpressRouteCrossConnectionCollection(client, Id)); + } + + /// + /// Gets details about the specified ExpressRouteCrossConnection. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName} + /// + /// + /// Operation Id + /// ExpressRouteCrossConnections_Get + /// + /// + /// + /// The name of the ExpressRouteCrossConnection (service key of the circuit). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetExpressRouteCrossConnectionAsync(string crossConnectionName, CancellationToken cancellationToken = default) + { + return await GetExpressRouteCrossConnections().GetAsync(crossConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details about the specified ExpressRouteCrossConnection. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName} + /// + /// + /// Operation Id + /// ExpressRouteCrossConnections_Get + /// + /// + /// + /// The name of the ExpressRouteCrossConnection (service key of the circuit). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetExpressRouteCrossConnection(string crossConnectionName, CancellationToken cancellationToken = default) + { + return GetExpressRouteCrossConnections().Get(crossConnectionName, cancellationToken); + } + + /// Gets a collection of ExpressRoutePortResources in the ResourceGroupResource. + /// An object representing collection of ExpressRoutePortResources and their operations over a ExpressRoutePortResource. + public virtual ExpressRoutePortCollection GetExpressRoutePorts() + { + return GetCachedClient(client => new ExpressRoutePortCollection(client, Id)); + } + + /// + /// Retrieves the requested ExpressRoutePort resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName} + /// + /// + /// Operation Id + /// ExpressRoutePorts_Get + /// + /// + /// + /// The name of ExpressRoutePort. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetExpressRoutePortAsync(string expressRoutePortName, CancellationToken cancellationToken = default) + { + return await GetExpressRoutePorts().GetAsync(expressRoutePortName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the requested ExpressRoutePort resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName} + /// + /// + /// Operation Id + /// ExpressRoutePorts_Get + /// + /// + /// + /// The name of ExpressRoutePort. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetExpressRoutePort(string expressRoutePortName, CancellationToken cancellationToken = default) + { + return GetExpressRoutePorts().Get(expressRoutePortName, cancellationToken); + } + + /// Gets a collection of FirewallPolicyResources in the ResourceGroupResource. + /// An object representing collection of FirewallPolicyResources and their operations over a FirewallPolicyResource. + public virtual FirewallPolicyCollection GetFirewallPolicies() + { + return GetCachedClient(client => new FirewallPolicyCollection(client, Id)); + } + + /// + /// Gets the specified Firewall Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName} + /// + /// + /// Operation Id + /// FirewallPolicies_Get + /// + /// + /// + /// The name of the Firewall Policy. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFirewallPolicyAsync(string firewallPolicyName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetFirewallPolicies().GetAsync(firewallPolicyName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Firewall Policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName} + /// + /// + /// Operation Id + /// FirewallPolicies_Get + /// + /// + /// + /// The name of the Firewall Policy. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFirewallPolicy(string firewallPolicyName, string expand = null, CancellationToken cancellationToken = default) + { + return GetFirewallPolicies().Get(firewallPolicyName, expand, cancellationToken); + } + + /// Gets a collection of IPAllocationResources in the ResourceGroupResource. + /// An object representing collection of IPAllocationResources and their operations over a IPAllocationResource. + public virtual IPAllocationCollection GetIPAllocations() + { + return GetCachedClient(client => new IPAllocationCollection(client, Id)); + } + + /// + /// Gets the specified IpAllocation by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName} + /// + /// + /// Operation Id + /// IpAllocations_Get + /// + /// + /// + /// The name of the IpAllocation. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetIPAllocationAsync(string ipAllocationName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetIPAllocations().GetAsync(ipAllocationName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified IpAllocation by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName} + /// + /// + /// Operation Id + /// IpAllocations_Get + /// + /// + /// + /// The name of the IpAllocation. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetIPAllocation(string ipAllocationName, string expand = null, CancellationToken cancellationToken = default) + { + return GetIPAllocations().Get(ipAllocationName, expand, cancellationToken); + } + + /// Gets a collection of IPGroupResources in the ResourceGroupResource. + /// An object representing collection of IPGroupResources and their operations over a IPGroupResource. + public virtual IPGroupCollection GetIPGroups() + { + return GetCachedClient(client => new IPGroupCollection(client, Id)); + } + + /// + /// Gets the specified ipGroups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName} + /// + /// + /// Operation Id + /// IpGroups_Get + /// + /// + /// + /// The name of the ipGroups. + /// Expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetIPGroupAsync(string ipGroupsName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetIPGroups().GetAsync(ipGroupsName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified ipGroups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName} + /// + /// + /// Operation Id + /// IpGroups_Get + /// + /// + /// + /// The name of the ipGroups. + /// Expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetIPGroup(string ipGroupsName, string expand = null, CancellationToken cancellationToken = default) + { + return GetIPGroups().Get(ipGroupsName, expand, cancellationToken); + } + + /// Gets a collection of LoadBalancerResources in the ResourceGroupResource. + /// An object representing collection of LoadBalancerResources and their operations over a LoadBalancerResource. + public virtual LoadBalancerCollection GetLoadBalancers() + { + return GetCachedClient(client => new LoadBalancerCollection(client, Id)); + } + + /// + /// Gets the specified load balancer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// + /// The name of the load balancer. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLoadBalancerAsync(string loadBalancerName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetLoadBalancers().GetAsync(loadBalancerName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified load balancer. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName} + /// + /// + /// Operation Id + /// LoadBalancers_Get + /// + /// + /// + /// The name of the load balancer. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLoadBalancer(string loadBalancerName, string expand = null, CancellationToken cancellationToken = default) + { + return GetLoadBalancers().Get(loadBalancerName, expand, cancellationToken); + } + + /// Gets a collection of NatGatewayResources in the ResourceGroupResource. + /// An object representing collection of NatGatewayResources and their operations over a NatGatewayResource. + public virtual NatGatewayCollection GetNatGateways() + { + return GetCachedClient(client => new NatGatewayCollection(client, Id)); + } + + /// + /// Gets the specified nat gateway in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName} + /// + /// + /// Operation Id + /// NatGateways_Get + /// + /// + /// + /// The name of the nat gateway. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNatGatewayAsync(string natGatewayName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetNatGateways().GetAsync(natGatewayName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified nat gateway in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName} + /// + /// + /// Operation Id + /// NatGateways_Get + /// + /// + /// + /// The name of the nat gateway. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNatGateway(string natGatewayName, string expand = null, CancellationToken cancellationToken = default) + { + return GetNatGateways().Get(natGatewayName, expand, cancellationToken); + } + + /// Gets a collection of NetworkInterfaceResources in the ResourceGroupResource. + /// An object representing collection of NetworkInterfaceResources and their operations over a NetworkInterfaceResource. + public virtual NetworkInterfaceCollection GetNetworkInterfaces() + { + return GetCachedClient(client => new NetworkInterfaceCollection(client, Id)); + } + + /// + /// Gets information about the specified network interface. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName} + /// + /// + /// Operation Id + /// NetworkInterfaces_Get + /// + /// + /// + /// The name of the network interface. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkInterfaceAsync(string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetNetworkInterfaces().GetAsync(networkInterfaceName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified network interface. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName} + /// + /// + /// Operation Id + /// NetworkInterfaces_Get + /// + /// + /// + /// The name of the network interface. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkInterface(string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default) + { + return GetNetworkInterfaces().Get(networkInterfaceName, expand, cancellationToken); + } + + /// Gets a collection of NetworkManagerResources in the ResourceGroupResource. + /// An object representing collection of NetworkManagerResources and their operations over a NetworkManagerResource. + public virtual NetworkManagerCollection GetNetworkManagers() + { + return GetCachedClient(client => new NetworkManagerCollection(client, Id)); + } + + /// + /// Gets the specified Network Manager. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName} + /// + /// + /// Operation Id + /// NetworkManagers_Get + /// + /// + /// + /// The name of the network manager. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkManagerAsync(string networkManagerName, CancellationToken cancellationToken = default) + { + return await GetNetworkManagers().GetAsync(networkManagerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Network Manager. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName} + /// + /// + /// Operation Id + /// NetworkManagers_Get + /// + /// + /// + /// The name of the network manager. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkManager(string networkManagerName, CancellationToken cancellationToken = default) + { + return GetNetworkManagers().Get(networkManagerName, cancellationToken); + } + + /// Gets a collection of NetworkProfileResources in the ResourceGroupResource. + /// An object representing collection of NetworkProfileResources and their operations over a NetworkProfileResource. + public virtual NetworkProfileCollection GetNetworkProfiles() + { + return GetCachedClient(client => new NetworkProfileCollection(client, Id)); + } + + /// + /// Gets the specified network profile in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName} + /// + /// + /// Operation Id + /// NetworkProfiles_Get + /// + /// + /// + /// The name of the public IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkProfileAsync(string networkProfileName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetNetworkProfiles().GetAsync(networkProfileName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified network profile in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName} + /// + /// + /// Operation Id + /// NetworkProfiles_Get + /// + /// + /// + /// The name of the public IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkProfile(string networkProfileName, string expand = null, CancellationToken cancellationToken = default) + { + return GetNetworkProfiles().Get(networkProfileName, expand, cancellationToken); + } + + /// Gets a collection of NetworkSecurityGroupResources in the ResourceGroupResource. + /// An object representing collection of NetworkSecurityGroupResources and their operations over a NetworkSecurityGroupResource. + public virtual NetworkSecurityGroupCollection GetNetworkSecurityGroups() + { + return GetCachedClient(client => new NetworkSecurityGroupCollection(client, Id)); + } + + /// + /// Gets the specified network security group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName} + /// + /// + /// Operation Id + /// NetworkSecurityGroups_Get + /// + /// + /// + /// The name of the network security group. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkSecurityGroupAsync(string networkSecurityGroupName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetNetworkSecurityGroups().GetAsync(networkSecurityGroupName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified network security group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName} + /// + /// + /// Operation Id + /// NetworkSecurityGroups_Get + /// + /// + /// + /// The name of the network security group. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkSecurityGroup(string networkSecurityGroupName, string expand = null, CancellationToken cancellationToken = default) + { + return GetNetworkSecurityGroups().Get(networkSecurityGroupName, expand, cancellationToken); + } + + /// Gets a collection of NetworkVirtualApplianceResources in the ResourceGroupResource. + /// An object representing collection of NetworkVirtualApplianceResources and their operations over a NetworkVirtualApplianceResource. + public virtual NetworkVirtualApplianceCollection GetNetworkVirtualAppliances() + { + return GetCachedClient(client => new NetworkVirtualApplianceCollection(client, Id)); + } + + /// + /// Gets the specified Network Virtual Appliance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName} + /// + /// + /// Operation Id + /// NetworkVirtualAppliances_Get + /// + /// + /// + /// The name of Network Virtual Appliance. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkVirtualApplianceAsync(string networkVirtualApplianceName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetNetworkVirtualAppliances().GetAsync(networkVirtualApplianceName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Network Virtual Appliance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName} + /// + /// + /// Operation Id + /// NetworkVirtualAppliances_Get + /// + /// + /// + /// The name of Network Virtual Appliance. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkVirtualAppliance(string networkVirtualApplianceName, string expand = null, CancellationToken cancellationToken = default) + { + return GetNetworkVirtualAppliances().Get(networkVirtualApplianceName, expand, cancellationToken); + } + + /// Gets a collection of NetworkWatcherResources in the ResourceGroupResource. + /// An object representing collection of NetworkWatcherResources and their operations over a NetworkWatcherResource. + public virtual NetworkWatcherCollection GetNetworkWatchers() + { + return GetCachedClient(client => new NetworkWatcherCollection(client, Id)); + } + + /// + /// Gets the specified network watcher by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName} + /// + /// + /// Operation Id + /// NetworkWatchers_Get + /// + /// + /// + /// The name of the network watcher. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkWatcherAsync(string networkWatcherName, CancellationToken cancellationToken = default) + { + return await GetNetworkWatchers().GetAsync(networkWatcherName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified network watcher by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName} + /// + /// + /// Operation Id + /// NetworkWatchers_Get + /// + /// + /// + /// The name of the network watcher. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkWatcher(string networkWatcherName, CancellationToken cancellationToken = default) + { + return GetNetworkWatchers().Get(networkWatcherName, cancellationToken); + } + + /// Gets a collection of PrivateEndpointResources in the ResourceGroupResource. + /// An object representing collection of PrivateEndpointResources and their operations over a PrivateEndpointResource. + public virtual PrivateEndpointCollection GetPrivateEndpoints() + { + return GetCachedClient(client => new PrivateEndpointCollection(client, Id)); + } + + /// + /// Gets the specified private endpoint by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// PrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPrivateEndpointAsync(string privateEndpointName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetPrivateEndpoints().GetAsync(privateEndpointName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified private endpoint by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// PrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPrivateEndpoint(string privateEndpointName, string expand = null, CancellationToken cancellationToken = default) + { + return GetPrivateEndpoints().Get(privateEndpointName, expand, cancellationToken); + } + + /// Gets a collection of PrivateLinkServiceResources in the ResourceGroupResource. + /// An object representing collection of PrivateLinkServiceResources and their operations over a PrivateLinkServiceResource. + public virtual PrivateLinkServiceCollection GetPrivateLinkServices() + { + return GetCachedClient(client => new PrivateLinkServiceCollection(client, Id)); + } + + /// + /// Gets the specified private link service by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName} + /// + /// + /// Operation Id + /// PrivateLinkServices_Get + /// + /// + /// + /// The name of the private link service. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPrivateLinkServiceAsync(string serviceName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetPrivateLinkServices().GetAsync(serviceName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified private link service by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName} + /// + /// + /// Operation Id + /// PrivateLinkServices_Get + /// + /// + /// + /// The name of the private link service. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPrivateLinkService(string serviceName, string expand = null, CancellationToken cancellationToken = default) + { + return GetPrivateLinkServices().Get(serviceName, expand, cancellationToken); + } + + /// Gets a collection of PublicIPAddressResources in the ResourceGroupResource. + /// An object representing collection of PublicIPAddressResources and their operations over a PublicIPAddressResource. + public virtual PublicIPAddressCollection GetPublicIPAddresses() + { + return GetCachedClient(client => new PublicIPAddressCollection(client, Id)); + } + + /// + /// Gets the specified public IP address in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName} + /// + /// + /// Operation Id + /// PublicIPAddresses_Get + /// + /// + /// + /// The name of the public IP address. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPublicIPAddressAsync(string publicIPAddressName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetPublicIPAddresses().GetAsync(publicIPAddressName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified public IP address in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName} + /// + /// + /// Operation Id + /// PublicIPAddresses_Get + /// + /// + /// + /// The name of the public IP address. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPublicIPAddress(string publicIPAddressName, string expand = null, CancellationToken cancellationToken = default) + { + return GetPublicIPAddresses().Get(publicIPAddressName, expand, cancellationToken); + } + + /// Gets a collection of PublicIPPrefixResources in the ResourceGroupResource. + /// An object representing collection of PublicIPPrefixResources and their operations over a PublicIPPrefixResource. + public virtual PublicIPPrefixCollection GetPublicIPPrefixes() + { + return GetCachedClient(client => new PublicIPPrefixCollection(client, Id)); + } + + /// + /// Gets the specified public IP prefix in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName} + /// + /// + /// Operation Id + /// PublicIPPrefixes_Get + /// + /// + /// + /// The name of the public IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPublicIPPrefixAsync(string publicIPPrefixName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetPublicIPPrefixes().GetAsync(publicIPPrefixName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified public IP prefix in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName} + /// + /// + /// Operation Id + /// PublicIPPrefixes_Get + /// + /// + /// + /// The name of the public IP prefix. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPublicIPPrefix(string publicIPPrefixName, string expand = null, CancellationToken cancellationToken = default) + { + return GetPublicIPPrefixes().Get(publicIPPrefixName, expand, cancellationToken); + } + + /// Gets a collection of RouteFilterResources in the ResourceGroupResource. + /// An object representing collection of RouteFilterResources and their operations over a RouteFilterResource. + public virtual RouteFilterCollection GetRouteFilters() + { + return GetCachedClient(client => new RouteFilterCollection(client, Id)); + } + + /// + /// Gets the specified route filter. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName} + /// + /// + /// Operation Id + /// RouteFilters_Get + /// + /// + /// + /// The name of the route filter. + /// Expands referenced express route bgp peering resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRouteFilterAsync(string routeFilterName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetRouteFilters().GetAsync(routeFilterName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified route filter. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName} + /// + /// + /// Operation Id + /// RouteFilters_Get + /// + /// + /// + /// The name of the route filter. + /// Expands referenced express route bgp peering resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRouteFilter(string routeFilterName, string expand = null, CancellationToken cancellationToken = default) + { + return GetRouteFilters().Get(routeFilterName, expand, cancellationToken); + } + + /// Gets a collection of RouteTableResources in the ResourceGroupResource. + /// An object representing collection of RouteTableResources and their operations over a RouteTableResource. + public virtual RouteTableCollection GetRouteTables() + { + return GetCachedClient(client => new RouteTableCollection(client, Id)); + } + + /// + /// Gets the specified route table. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName} + /// + /// + /// Operation Id + /// RouteTables_Get + /// + /// + /// + /// The name of the route table. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRouteTableAsync(string routeTableName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetRouteTables().GetAsync(routeTableName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified route table. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName} + /// + /// + /// Operation Id + /// RouteTables_Get + /// + /// + /// + /// The name of the route table. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRouteTable(string routeTableName, string expand = null, CancellationToken cancellationToken = default) + { + return GetRouteTables().Get(routeTableName, expand, cancellationToken); + } + + /// Gets a collection of SecurityPartnerProviderResources in the ResourceGroupResource. + /// An object representing collection of SecurityPartnerProviderResources and their operations over a SecurityPartnerProviderResource. + public virtual SecurityPartnerProviderCollection GetSecurityPartnerProviders() + { + return GetCachedClient(client => new SecurityPartnerProviderCollection(client, Id)); + } + + /// + /// Gets the specified Security Partner Provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName} + /// + /// + /// Operation Id + /// SecurityPartnerProviders_Get + /// + /// + /// + /// The name of the Security Partner Provider. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityPartnerProviderAsync(string securityPartnerProviderName, CancellationToken cancellationToken = default) + { + return await GetSecurityPartnerProviders().GetAsync(securityPartnerProviderName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Security Partner Provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName} + /// + /// + /// Operation Id + /// SecurityPartnerProviders_Get + /// + /// + /// + /// The name of the Security Partner Provider. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityPartnerProvider(string securityPartnerProviderName, CancellationToken cancellationToken = default) + { + return GetSecurityPartnerProviders().Get(securityPartnerProviderName, cancellationToken); + } + + /// Gets a collection of ServiceEndpointPolicyResources in the ResourceGroupResource. + /// An object representing collection of ServiceEndpointPolicyResources and their operations over a ServiceEndpointPolicyResource. + public virtual ServiceEndpointPolicyCollection GetServiceEndpointPolicies() + { + return GetCachedClient(client => new ServiceEndpointPolicyCollection(client, Id)); + } + + /// + /// Gets the specified service Endpoint Policies in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName} + /// + /// + /// Operation Id + /// ServiceEndpointPolicies_Get + /// + /// + /// + /// The name of the service endpoint policy. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceEndpointPolicyAsync(string serviceEndpointPolicyName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetServiceEndpointPolicies().GetAsync(serviceEndpointPolicyName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified service Endpoint Policies in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName} + /// + /// + /// Operation Id + /// ServiceEndpointPolicies_Get + /// + /// + /// + /// The name of the service endpoint policy. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceEndpointPolicy(string serviceEndpointPolicyName, string expand = null, CancellationToken cancellationToken = default) + { + return GetServiceEndpointPolicies().Get(serviceEndpointPolicyName, expand, cancellationToken); + } + + /// Gets a collection of VirtualNetworkResources in the ResourceGroupResource. + /// An object representing collection of VirtualNetworkResources and their operations over a VirtualNetworkResource. + public virtual VirtualNetworkCollection GetVirtualNetworks() + { + return GetCachedClient(client => new VirtualNetworkCollection(client, Id)); + } + + /// + /// Gets the specified virtual network by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// The name of the virtual network. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualNetworkAsync(string virtualNetworkName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetVirtualNetworks().GetAsync(virtualNetworkName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified virtual network by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName} + /// + /// + /// Operation Id + /// VirtualNetworks_Get + /// + /// + /// + /// The name of the virtual network. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualNetwork(string virtualNetworkName, string expand = null, CancellationToken cancellationToken = default) + { + return GetVirtualNetworks().Get(virtualNetworkName, expand, cancellationToken); + } + + /// Gets a collection of VirtualNetworkGatewayResources in the ResourceGroupResource. + /// An object representing collection of VirtualNetworkGatewayResources and their operations over a VirtualNetworkGatewayResource. + public virtual VirtualNetworkGatewayCollection GetVirtualNetworkGateways() + { + return GetCachedClient(client => new VirtualNetworkGatewayCollection(client, Id)); + } + + /// + /// Gets the specified virtual network gateway by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName} + /// + /// + /// Operation Id + /// VirtualNetworkGateways_Get + /// + /// + /// + /// The name of the virtual network gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualNetworkGatewayAsync(string virtualNetworkGatewayName, CancellationToken cancellationToken = default) + { + return await GetVirtualNetworkGateways().GetAsync(virtualNetworkGatewayName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified virtual network gateway by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName} + /// + /// + /// Operation Id + /// VirtualNetworkGateways_Get + /// + /// + /// + /// The name of the virtual network gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualNetworkGateway(string virtualNetworkGatewayName, CancellationToken cancellationToken = default) + { + return GetVirtualNetworkGateways().Get(virtualNetworkGatewayName, cancellationToken); + } + + /// Gets a collection of VirtualNetworkGatewayConnectionResources in the ResourceGroupResource. + /// An object representing collection of VirtualNetworkGatewayConnectionResources and their operations over a VirtualNetworkGatewayConnectionResource. + public virtual VirtualNetworkGatewayConnectionCollection GetVirtualNetworkGatewayConnections() + { + return GetCachedClient(client => new VirtualNetworkGatewayConnectionCollection(client, Id)); + } + + /// + /// Gets the specified virtual network gateway connection by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName} + /// + /// + /// Operation Id + /// VirtualNetworkGatewayConnections_Get + /// + /// + /// + /// The name of the virtual network gateway connection. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualNetworkGatewayConnectionAsync(string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default) + { + return await GetVirtualNetworkGatewayConnections().GetAsync(virtualNetworkGatewayConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified virtual network gateway connection by resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName} + /// + /// + /// Operation Id + /// VirtualNetworkGatewayConnections_Get + /// + /// + /// + /// The name of the virtual network gateway connection. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualNetworkGatewayConnection(string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default) + { + return GetVirtualNetworkGatewayConnections().Get(virtualNetworkGatewayConnectionName, cancellationToken); + } + + /// Gets a collection of LocalNetworkGatewayResources in the ResourceGroupResource. + /// An object representing collection of LocalNetworkGatewayResources and their operations over a LocalNetworkGatewayResource. + public virtual LocalNetworkGatewayCollection GetLocalNetworkGateways() + { + return GetCachedClient(client => new LocalNetworkGatewayCollection(client, Id)); + } + + /// + /// Gets the specified local network gateway in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName} + /// + /// + /// Operation Id + /// LocalNetworkGateways_Get + /// + /// + /// + /// The name of the local network gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLocalNetworkGatewayAsync(string localNetworkGatewayName, CancellationToken cancellationToken = default) + { + return await GetLocalNetworkGateways().GetAsync(localNetworkGatewayName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified local network gateway in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName} + /// + /// + /// Operation Id + /// LocalNetworkGateways_Get + /// + /// + /// + /// The name of the local network gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLocalNetworkGateway(string localNetworkGatewayName, CancellationToken cancellationToken = default) + { + return GetLocalNetworkGateways().Get(localNetworkGatewayName, cancellationToken); + } + + /// Gets a collection of VirtualNetworkTapResources in the ResourceGroupResource. + /// An object representing collection of VirtualNetworkTapResources and their operations over a VirtualNetworkTapResource. + public virtual VirtualNetworkTapCollection GetVirtualNetworkTaps() + { + return GetCachedClient(client => new VirtualNetworkTapCollection(client, Id)); + } + + /// + /// Gets information about the specified virtual network tap. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName} + /// + /// + /// Operation Id + /// VirtualNetworkTaps_Get + /// + /// + /// + /// The name of virtual network tap. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualNetworkTapAsync(string tapName, CancellationToken cancellationToken = default) + { + return await GetVirtualNetworkTaps().GetAsync(tapName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified virtual network tap. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName} + /// + /// + /// Operation Id + /// VirtualNetworkTaps_Get + /// + /// + /// + /// The name of virtual network tap. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualNetworkTap(string tapName, CancellationToken cancellationToken = default) + { + return GetVirtualNetworkTaps().Get(tapName, cancellationToken); + } + + /// Gets a collection of VirtualRouterResources in the ResourceGroupResource. + /// An object representing collection of VirtualRouterResources and their operations over a VirtualRouterResource. + public virtual VirtualRouterCollection GetVirtualRouters() + { + return GetCachedClient(client => new VirtualRouterCollection(client, Id)); + } + + /// + /// Gets the specified Virtual Router. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName} + /// + /// + /// Operation Id + /// VirtualRouters_Get + /// + /// + /// + /// The name of the Virtual Router. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualRouterAsync(string virtualRouterName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetVirtualRouters().GetAsync(virtualRouterName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Virtual Router. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName} + /// + /// + /// Operation Id + /// VirtualRouters_Get + /// + /// + /// + /// The name of the Virtual Router. + /// Expands referenced resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualRouter(string virtualRouterName, string expand = null, CancellationToken cancellationToken = default) + { + return GetVirtualRouters().Get(virtualRouterName, expand, cancellationToken); + } + + /// Gets a collection of VirtualWanResources in the ResourceGroupResource. + /// An object representing collection of VirtualWanResources and their operations over a VirtualWanResource. + public virtual VirtualWanCollection GetVirtualWans() + { + return GetCachedClient(client => new VirtualWanCollection(client, Id)); + } + + /// + /// Retrieves the details of a VirtualWAN. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName} + /// + /// + /// Operation Id + /// VirtualWans_Get + /// + /// + /// + /// The name of the VirtualWAN being retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualWanAsync(string virtualWanName, CancellationToken cancellationToken = default) + { + return await GetVirtualWans().GetAsync(virtualWanName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the details of a VirtualWAN. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName} + /// + /// + /// Operation Id + /// VirtualWans_Get + /// + /// + /// + /// The name of the VirtualWAN being retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualWan(string virtualWanName, CancellationToken cancellationToken = default) + { + return GetVirtualWans().Get(virtualWanName, cancellationToken); + } + + /// Gets a collection of VpnSiteResources in the ResourceGroupResource. + /// An object representing collection of VpnSiteResources and their operations over a VpnSiteResource. + public virtual VpnSiteCollection GetVpnSites() + { + return GetCachedClient(client => new VpnSiteCollection(client, Id)); + } + + /// + /// Retrieves the details of a VPN site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName} + /// + /// + /// Operation Id + /// VpnSites_Get + /// + /// + /// + /// The name of the VpnSite being retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVpnSiteAsync(string vpnSiteName, CancellationToken cancellationToken = default) + { + return await GetVpnSites().GetAsync(vpnSiteName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the details of a VPN site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName} + /// + /// + /// Operation Id + /// VpnSites_Get + /// + /// + /// + /// The name of the VpnSite being retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVpnSite(string vpnSiteName, CancellationToken cancellationToken = default) + { + return GetVpnSites().Get(vpnSiteName, cancellationToken); + } + + /// Gets a collection of VpnServerConfigurationResources in the ResourceGroupResource. + /// An object representing collection of VpnServerConfigurationResources and their operations over a VpnServerConfigurationResource. + public virtual VpnServerConfigurationCollection GetVpnServerConfigurations() + { + return GetCachedClient(client => new VpnServerConfigurationCollection(client, Id)); + } + + /// + /// Retrieves the details of a VpnServerConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName} + /// + /// + /// Operation Id + /// VpnServerConfigurations_Get + /// + /// + /// + /// The name of the VpnServerConfiguration being retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVpnServerConfigurationAsync(string vpnServerConfigurationName, CancellationToken cancellationToken = default) + { + return await GetVpnServerConfigurations().GetAsync(vpnServerConfigurationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the details of a VpnServerConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName} + /// + /// + /// Operation Id + /// VpnServerConfigurations_Get + /// + /// + /// + /// The name of the VpnServerConfiguration being retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVpnServerConfiguration(string vpnServerConfigurationName, CancellationToken cancellationToken = default) + { + return GetVpnServerConfigurations().Get(vpnServerConfigurationName, cancellationToken); + } + + /// Gets a collection of VirtualHubResources in the ResourceGroupResource. + /// An object representing collection of VirtualHubResources and their operations over a VirtualHubResource. + public virtual VirtualHubCollection GetVirtualHubs() + { + return GetCachedClient(client => new VirtualHubCollection(client, Id)); + } + + /// + /// Retrieves the details of a VirtualHub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName} + /// + /// + /// Operation Id + /// VirtualHubs_Get + /// + /// + /// + /// The name of the VirtualHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualHubAsync(string virtualHubName, CancellationToken cancellationToken = default) + { + return await GetVirtualHubs().GetAsync(virtualHubName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the details of a VirtualHub. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName} + /// + /// + /// Operation Id + /// VirtualHubs_Get + /// + /// + /// + /// The name of the VirtualHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualHub(string virtualHubName, CancellationToken cancellationToken = default) + { + return GetVirtualHubs().Get(virtualHubName, cancellationToken); + } + + /// Gets a collection of VpnGatewayResources in the ResourceGroupResource. + /// An object representing collection of VpnGatewayResources and their operations over a VpnGatewayResource. + public virtual VpnGatewayCollection GetVpnGateways() + { + return GetCachedClient(client => new VpnGatewayCollection(client, Id)); + } + + /// + /// Retrieves the details of a virtual wan vpn gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName} + /// + /// + /// Operation Id + /// VpnGateways_Get + /// + /// + /// + /// The name of the gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVpnGatewayAsync(string gatewayName, CancellationToken cancellationToken = default) + { + return await GetVpnGateways().GetAsync(gatewayName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the details of a virtual wan vpn gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName} + /// + /// + /// Operation Id + /// VpnGateways_Get + /// + /// + /// + /// The name of the gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVpnGateway(string gatewayName, CancellationToken cancellationToken = default) + { + return GetVpnGateways().Get(gatewayName, cancellationToken); + } + + /// Gets a collection of P2SVpnGatewayResources in the ResourceGroupResource. + /// An object representing collection of P2SVpnGatewayResources and their operations over a P2SVpnGatewayResource. + public virtual P2SVpnGatewayCollection GetP2SVpnGateways() + { + return GetCachedClient(client => new P2SVpnGatewayCollection(client, Id)); + } + + /// + /// Retrieves the details of a virtual wan p2s vpn gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName} + /// + /// + /// Operation Id + /// P2sVpnGateways_Get + /// + /// + /// + /// The name of the gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetP2SVpnGatewayAsync(string gatewayName, CancellationToken cancellationToken = default) + { + return await GetP2SVpnGateways().GetAsync(gatewayName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the details of a virtual wan p2s vpn gateway. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName} + /// + /// + /// Operation Id + /// P2sVpnGateways_Get + /// + /// + /// + /// The name of the gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetP2SVpnGateway(string gatewayName, CancellationToken cancellationToken = default) + { + return GetP2SVpnGateways().Get(gatewayName, cancellationToken); + } + + /// Gets a collection of ExpressRouteGatewayResources in the ResourceGroupResource. + /// An object representing collection of ExpressRouteGatewayResources and their operations over a ExpressRouteGatewayResource. + public virtual ExpressRouteGatewayCollection GetExpressRouteGateways() + { + return GetCachedClient(client => new ExpressRouteGatewayCollection(client, Id)); + } + + /// + /// Fetches the details of a ExpressRoute gateway in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName} + /// + /// + /// Operation Id + /// ExpressRouteGateways_Get + /// + /// + /// + /// The name of the ExpressRoute gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetExpressRouteGatewayAsync(string expressRouteGatewayName, CancellationToken cancellationToken = default) + { + return await GetExpressRouteGateways().GetAsync(expressRouteGatewayName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fetches the details of a ExpressRoute gateway in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName} + /// + /// + /// Operation Id + /// ExpressRouteGateways_Get + /// + /// + /// + /// The name of the ExpressRoute gateway. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetExpressRouteGateway(string expressRouteGatewayName, CancellationToken cancellationToken = default) + { + return GetExpressRouteGateways().Get(expressRouteGatewayName, cancellationToken); + } + + /// Gets a collection of WebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// An object representing collection of WebApplicationFirewallPolicyResources and their operations over a WebApplicationFirewallPolicyResource. + public virtual WebApplicationFirewallPolicyCollection GetWebApplicationFirewallPolicies() + { + return GetCachedClient(client => new WebApplicationFirewallPolicyCollection(client, Id)); + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// WebApplicationFirewallPolicies_Get + /// + /// + /// + /// The name of the policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWebApplicationFirewallPolicyAsync(string policyName, CancellationToken cancellationToken = default) + { + return await GetWebApplicationFirewallPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve protection policy with specified name within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName} + /// + /// + /// Operation Id + /// WebApplicationFirewallPolicies_Get + /// + /// + /// + /// The name of the policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWebApplicationFirewallPolicy(string policyName, CancellationToken cancellationToken = default) + { + return GetWebApplicationFirewallPolicies().Get(policyName, cancellationToken); + } + + /// + /// Gets all of the available subnet delegations for this resource group in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations + /// + /// + /// Operation Id + /// AvailableResourceGroupDelegations_List + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableResourceGroupDelegationsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableResourceGroupDelegationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableResourceGroupDelegationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableDelegation.DeserializeAvailableDelegation, AvailableResourceGroupDelegationsClientDiagnostics, Pipeline, "MockableNetworkResourceGroupResource.GetAvailableResourceGroupDelegations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all of the available subnet delegations for this resource group in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations + /// + /// + /// Operation Id + /// AvailableResourceGroupDelegations_List + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableResourceGroupDelegations(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableResourceGroupDelegationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableResourceGroupDelegationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableDelegation.DeserializeAvailableDelegation, AvailableResourceGroupDelegationsClientDiagnostics, Pipeline, "MockableNetworkResourceGroupResource.GetAvailableResourceGroupDelegations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all available service aliases for this resource group in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases + /// + /// + /// Operation Id + /// AvailableServiceAliases_ListByResourceGroup + /// + /// + /// + /// The location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableServiceAliasesByResourceGroupAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableServiceAliasesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableServiceAliasesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableServiceAlias.DeserializeAvailableServiceAlias, AvailableServiceAliasesClientDiagnostics, Pipeline, "MockableNetworkResourceGroupResource.GetAvailableServiceAliasesByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all available service aliases for this resource group in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases + /// + /// + /// Operation Id + /// AvailableServiceAliases_ListByResourceGroup + /// + /// + /// + /// The location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableServiceAliasesByResourceGroup(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableServiceAliasesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableServiceAliasesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableServiceAlias.DeserializeAvailableServiceAlias, AvailableServiceAliasesClientDiagnostics, Pipeline, "MockableNetworkResourceGroupResource.GetAvailableServiceAliasesByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes + /// + /// + /// Operation Id + /// AvailablePrivateEndpointTypes_ListByResourceGroup + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailablePrivateEndpointTypesByResourceGroupAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailablePrivateEndpointTypesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailablePrivateEndpointTypesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailablePrivateEndpointType.DeserializeAvailablePrivateEndpointType, AvailablePrivateEndpointTypesClientDiagnostics, Pipeline, "MockableNetworkResourceGroupResource.GetAvailablePrivateEndpointTypesByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes + /// + /// + /// Operation Id + /// AvailablePrivateEndpointTypes_ListByResourceGroup + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailablePrivateEndpointTypesByResourceGroup(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailablePrivateEndpointTypesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailablePrivateEndpointTypesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailablePrivateEndpointType.DeserializeAvailablePrivateEndpointType, AvailablePrivateEndpointTypesClientDiagnostics, Pipeline, "MockableNetworkResourceGroupResource.GetAvailablePrivateEndpointTypesByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether the subscription is visible to private link service in the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility + /// + /// + /// Operation Id + /// PrivateLinkServices_CheckPrivateLinkServiceVisibilityByResourceGroup + /// + /// + /// + /// 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 location of the domain name. + /// The request body of CheckPrivateLinkService API call. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkServiceAsync(WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(checkPrivateLinkServiceVisibilityRequest, nameof(checkPrivateLinkServiceVisibilityRequest)); + + using var scope = PrivateLinkServicesClientDiagnostics.CreateScope("MockableNetworkResourceGroupResource.CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService"); + scope.Start(); + try + { + var response = await PrivateLinkServicesRestClient.CheckPrivateLinkServiceVisibilityByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken).ConfigureAwait(false); + var operation = new NetworkArmOperation(new PrivateLinkServiceVisibilityOperationSource(), PrivateLinkServicesClientDiagnostics, Pipeline, PrivateLinkServicesRestClient.CreateCheckPrivateLinkServiceVisibilityByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, checkPrivateLinkServiceVisibilityRequest).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the subscription is visible to private link service in the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility + /// + /// + /// Operation Id + /// PrivateLinkServices_CheckPrivateLinkServiceVisibilityByResourceGroup + /// + /// + /// + /// 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 location of the domain name. + /// The request body of CheckPrivateLinkService API call. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService(WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(checkPrivateLinkServiceVisibilityRequest, nameof(checkPrivateLinkServiceVisibilityRequest)); + + using var scope = PrivateLinkServicesClientDiagnostics.CreateScope("MockableNetworkResourceGroupResource.CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService"); + scope.Start(); + try + { + var response = PrivateLinkServicesRestClient.CheckPrivateLinkServiceVisibilityByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken); + var operation = new NetworkArmOperation(new PrivateLinkServiceVisibilityOperationSource(), PrivateLinkServicesClientDiagnostics, Pipeline, PrivateLinkServicesRestClient.CreateCheckPrivateLinkServiceVisibilityByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, checkPrivateLinkServiceVisibilityRequest).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices + /// + /// + /// Operation Id + /// PrivateLinkServices_ListAutoApprovedPrivateLinkServicesByResourceGroup + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServicesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AutoApprovedPrivateLinkService.DeserializeAutoApprovedPrivateLinkService, PrivateLinkServicesClientDiagnostics, Pipeline, "MockableNetworkResourceGroupResource.GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices + /// + /// + /// Operation Id + /// PrivateLinkServices_ListAutoApprovedPrivateLinkServicesByResourceGroup + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AutoApprovedPrivateLinkService.DeserializeAutoApprovedPrivateLinkService, PrivateLinkServicesClientDiagnostics, Pipeline, "MockableNetworkResourceGroupResource.GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkSubscriptionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkSubscriptionResource.cs new file mode 100644 index 0000000000000..75f99496dca8a --- /dev/null +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/MockableNetworkSubscriptionResource.cs @@ -0,0 +1,3417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Network; +using Azure.ResourceManager.Network.Models; + +namespace Azure.ResourceManager.Network.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNetworkSubscriptionResource : ArmResource + { + private ClientDiagnostics _applicationGatewayClientDiagnostics; + private ApplicationGatewaysRestOperations _applicationGatewayRestClient; + private ClientDiagnostics _applicationSecurityGroupClientDiagnostics; + private ApplicationSecurityGroupsRestOperations _applicationSecurityGroupRestClient; + private ClientDiagnostics _availableDelegationsClientDiagnostics; + private AvailableDelegationsRestOperations _availableDelegationsRestClient; + private ClientDiagnostics _availableServiceAliasesClientDiagnostics; + private AvailableServiceAliasesRestOperations _availableServiceAliasesRestClient; + private ClientDiagnostics _azureFirewallClientDiagnostics; + private AzureFirewallsRestOperations _azureFirewallRestClient; + private ClientDiagnostics _azureFirewallFqdnTagsClientDiagnostics; + private AzureFirewallFqdnTagsRestOperations _azureFirewallFqdnTagsRestClient; + private ClientDiagnostics _bastionHostClientDiagnostics; + private BastionHostsRestOperations _bastionHostRestClient; + private ClientDiagnostics _expressRouteProviderPortClientDiagnostics; + private NetworkManagementRestOperations _expressRouteProviderPortRestClient; + private ClientDiagnostics _customIPPrefixClientDiagnostics; + private CustomIPPrefixesRestOperations _customIPPrefixRestClient; + private ClientDiagnostics _ddosProtectionPlanClientDiagnostics; + private DdosProtectionPlansRestOperations _ddosProtectionPlanRestClient; + private ClientDiagnostics _dscpConfigurationClientDiagnostics; + private DscpConfigurationRestOperations _dscpConfigurationRestClient; + private ClientDiagnostics _availableEndpointServicesClientDiagnostics; + private AvailableEndpointServicesRestOperations _availableEndpointServicesRestClient; + private ClientDiagnostics _expressRouteCircuitClientDiagnostics; + private ExpressRouteCircuitsRestOperations _expressRouteCircuitRestClient; + private ClientDiagnostics _expressRouteServiceProvidersClientDiagnostics; + private ExpressRouteServiceProvidersRestOperations _expressRouteServiceProvidersRestClient; + private ClientDiagnostics _expressRouteCrossConnectionClientDiagnostics; + private ExpressRouteCrossConnectionsRestOperations _expressRouteCrossConnectionRestClient; + private ClientDiagnostics _expressRoutePortClientDiagnostics; + private ExpressRoutePortsRestOperations _expressRoutePortRestClient; + private ClientDiagnostics _firewallPolicyClientDiagnostics; + private FirewallPoliciesRestOperations _firewallPolicyRestClient; + private ClientDiagnostics _ipAllocationIPAllocationsClientDiagnostics; + private IpAllocationsRestOperations _ipAllocationIPAllocationsRestClient; + private ClientDiagnostics _ipGroupIPGroupsClientDiagnostics; + private IpGroupsRestOperations _ipGroupIPGroupsRestClient; + private ClientDiagnostics _loadBalancerClientDiagnostics; + private LoadBalancersRestOperations _loadBalancerRestClient; + private ClientDiagnostics _natGatewayClientDiagnostics; + private NatGatewaysRestOperations _natGatewayRestClient; + private ClientDiagnostics _networkInterfaceClientDiagnostics; + private NetworkInterfacesRestOperations _networkInterfaceRestClient; + private ClientDiagnostics _networkManagerClientDiagnostics; + private NetworkManagersRestOperations _networkManagerRestClient; + private ClientDiagnostics _networkProfileClientDiagnostics; + private NetworkProfilesRestOperations _networkProfileRestClient; + private ClientDiagnostics _networkSecurityGroupClientDiagnostics; + private NetworkSecurityGroupsRestOperations _networkSecurityGroupRestClient; + private ClientDiagnostics _networkVirtualApplianceClientDiagnostics; + private NetworkVirtualAppliancesRestOperations _networkVirtualApplianceRestClient; + private ClientDiagnostics _networkWatcherClientDiagnostics; + private NetworkWatchersRestOperations _networkWatcherRestClient; + private ClientDiagnostics _privateEndpointClientDiagnostics; + private PrivateEndpointsRestOperations _privateEndpointRestClient; + private ClientDiagnostics _availablePrivateEndpointTypesClientDiagnostics; + private AvailablePrivateEndpointTypesRestOperations _availablePrivateEndpointTypesRestClient; + private ClientDiagnostics _privateLinkServiceClientDiagnostics; + private PrivateLinkServicesRestOperations _privateLinkServiceRestClient; + private ClientDiagnostics _privateLinkServicesClientDiagnostics; + private PrivateLinkServicesRestOperations _privateLinkServicesRestClient; + private ClientDiagnostics _publicIPAddressClientDiagnostics; + private PublicIPAddressesRestOperations _publicIPAddressRestClient; + private ClientDiagnostics _publicIPPrefixClientDiagnostics; + private PublicIPPrefixesRestOperations _publicIPPrefixRestClient; + private ClientDiagnostics _routeFilterClientDiagnostics; + private RouteFiltersRestOperations _routeFilterRestClient; + private ClientDiagnostics _routeTableClientDiagnostics; + private RouteTablesRestOperations _routeTableRestClient; + private ClientDiagnostics _securityPartnerProviderClientDiagnostics; + private SecurityPartnerProvidersRestOperations _securityPartnerProviderRestClient; + private ClientDiagnostics _bgpServiceCommunitiesClientDiagnostics; + private BgpServiceCommunitiesRestOperations _bgpServiceCommunitiesRestClient; + private ClientDiagnostics _serviceEndpointPolicyClientDiagnostics; + private ServiceEndpointPoliciesRestOperations _serviceEndpointPolicyRestClient; + private ClientDiagnostics _serviceTagsClientDiagnostics; + private ServiceTagsRestOperations _serviceTagsRestClient; + private ClientDiagnostics _serviceTagInformationClientDiagnostics; + private ServiceTagInformationRestOperations _serviceTagInformationRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + private ClientDiagnostics _virtualNetworkClientDiagnostics; + private VirtualNetworksRestOperations _virtualNetworkRestClient; + private ClientDiagnostics _virtualNetworkTapClientDiagnostics; + private VirtualNetworkTapsRestOperations _virtualNetworkTapRestClient; + private ClientDiagnostics _virtualRouterClientDiagnostics; + private VirtualRoutersRestOperations _virtualRouterRestClient; + private ClientDiagnostics _virtualWanClientDiagnostics; + private VirtualWansRestOperations _virtualWanRestClient; + private ClientDiagnostics _vpnSiteClientDiagnostics; + private VpnSitesRestOperations _vpnSiteRestClient; + private ClientDiagnostics _vpnServerConfigurationClientDiagnostics; + private VpnServerConfigurationsRestOperations _vpnServerConfigurationRestClient; + private ClientDiagnostics _virtualHubClientDiagnostics; + private VirtualHubsRestOperations _virtualHubRestClient; + private ClientDiagnostics _vpnGatewayClientDiagnostics; + private VpnGatewaysRestOperations _vpnGatewayRestClient; + private ClientDiagnostics _p2sVpnGatewayP2sVpnGatewaysClientDiagnostics; + private P2SVpnGatewaysRestOperations _p2sVpnGatewayP2sVpnGatewaysRestClient; + private ClientDiagnostics _expressRouteGatewayClientDiagnostics; + private ExpressRouteGatewaysRestOperations _expressRouteGatewayRestClient; + private ClientDiagnostics _webApplicationFirewallPolicyClientDiagnostics; + private WebApplicationFirewallPoliciesRestOperations _webApplicationFirewallPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNetworkSubscriptionResource() + { + } + + /// 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 MockableNetworkSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ApplicationGatewayClientDiagnostics => _applicationGatewayClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ApplicationGatewayResource.ResourceType.Namespace, Diagnostics); + private ApplicationGatewaysRestOperations ApplicationGatewayRestClient => _applicationGatewayRestClient ??= new ApplicationGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApplicationGatewayResource.ResourceType)); + private ClientDiagnostics ApplicationSecurityGroupClientDiagnostics => _applicationSecurityGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ApplicationSecurityGroupResource.ResourceType.Namespace, Diagnostics); + private ApplicationSecurityGroupsRestOperations ApplicationSecurityGroupRestClient => _applicationSecurityGroupRestClient ??= new ApplicationSecurityGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApplicationSecurityGroupResource.ResourceType)); + private ClientDiagnostics AvailableDelegationsClientDiagnostics => _availableDelegationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableDelegationsRestOperations AvailableDelegationsRestClient => _availableDelegationsRestClient ??= new AvailableDelegationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AvailableServiceAliasesClientDiagnostics => _availableServiceAliasesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableServiceAliasesRestOperations AvailableServiceAliasesRestClient => _availableServiceAliasesRestClient ??= new AvailableServiceAliasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AzureFirewallClientDiagnostics => _azureFirewallClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", AzureFirewallResource.ResourceType.Namespace, Diagnostics); + private AzureFirewallsRestOperations AzureFirewallRestClient => _azureFirewallRestClient ??= new AzureFirewallsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AzureFirewallResource.ResourceType)); + private ClientDiagnostics AzureFirewallFqdnTagsClientDiagnostics => _azureFirewallFqdnTagsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzureFirewallFqdnTagsRestOperations AzureFirewallFqdnTagsRestClient => _azureFirewallFqdnTagsRestClient ??= new AzureFirewallFqdnTagsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BastionHostClientDiagnostics => _bastionHostClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", BastionHostResource.ResourceType.Namespace, Diagnostics); + private BastionHostsRestOperations BastionHostRestClient => _bastionHostRestClient ??= new BastionHostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BastionHostResource.ResourceType)); + private ClientDiagnostics ExpressRouteProviderPortClientDiagnostics => _expressRouteProviderPortClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRouteProviderPortResource.ResourceType.Namespace, Diagnostics); + private NetworkManagementRestOperations ExpressRouteProviderPortRestClient => _expressRouteProviderPortRestClient ??= new NetworkManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRouteProviderPortResource.ResourceType)); + private ClientDiagnostics CustomIPPrefixClientDiagnostics => _customIPPrefixClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", CustomIPPrefixResource.ResourceType.Namespace, Diagnostics); + private CustomIPPrefixesRestOperations CustomIPPrefixRestClient => _customIPPrefixRestClient ??= new CustomIPPrefixesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CustomIPPrefixResource.ResourceType)); + private ClientDiagnostics DdosProtectionPlanClientDiagnostics => _ddosProtectionPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", DdosProtectionPlanResource.ResourceType.Namespace, Diagnostics); + private DdosProtectionPlansRestOperations DdosProtectionPlanRestClient => _ddosProtectionPlanRestClient ??= new DdosProtectionPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DdosProtectionPlanResource.ResourceType)); + private ClientDiagnostics DscpConfigurationClientDiagnostics => _dscpConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", DscpConfigurationResource.ResourceType.Namespace, Diagnostics); + private DscpConfigurationRestOperations DscpConfigurationRestClient => _dscpConfigurationRestClient ??= new DscpConfigurationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DscpConfigurationResource.ResourceType)); + private ClientDiagnostics AvailableEndpointServicesClientDiagnostics => _availableEndpointServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailableEndpointServicesRestOperations AvailableEndpointServicesRestClient => _availableEndpointServicesRestClient ??= new AvailableEndpointServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ExpressRouteCircuitClientDiagnostics => _expressRouteCircuitClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRouteCircuitResource.ResourceType.Namespace, Diagnostics); + private ExpressRouteCircuitsRestOperations ExpressRouteCircuitRestClient => _expressRouteCircuitRestClient ??= new ExpressRouteCircuitsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRouteCircuitResource.ResourceType)); + private ClientDiagnostics ExpressRouteServiceProvidersClientDiagnostics => _expressRouteServiceProvidersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ExpressRouteServiceProvidersRestOperations ExpressRouteServiceProvidersRestClient => _expressRouteServiceProvidersRestClient ??= new ExpressRouteServiceProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ExpressRouteCrossConnectionClientDiagnostics => _expressRouteCrossConnectionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRouteCrossConnectionResource.ResourceType.Namespace, Diagnostics); + private ExpressRouteCrossConnectionsRestOperations ExpressRouteCrossConnectionRestClient => _expressRouteCrossConnectionRestClient ??= new ExpressRouteCrossConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRouteCrossConnectionResource.ResourceType)); + private ClientDiagnostics ExpressRoutePortClientDiagnostics => _expressRoutePortClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRoutePortResource.ResourceType.Namespace, Diagnostics); + private ExpressRoutePortsRestOperations ExpressRoutePortRestClient => _expressRoutePortRestClient ??= new ExpressRoutePortsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRoutePortResource.ResourceType)); + private ClientDiagnostics FirewallPolicyClientDiagnostics => _firewallPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", FirewallPolicyResource.ResourceType.Namespace, Diagnostics); + private FirewallPoliciesRestOperations FirewallPolicyRestClient => _firewallPolicyRestClient ??= new FirewallPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FirewallPolicyResource.ResourceType)); + private ClientDiagnostics IPAllocationIpAllocationsClientDiagnostics => _ipAllocationIPAllocationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", IPAllocationResource.ResourceType.Namespace, Diagnostics); + private IpAllocationsRestOperations IPAllocationIpAllocationsRestClient => _ipAllocationIPAllocationsRestClient ??= new IpAllocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IPAllocationResource.ResourceType)); + private ClientDiagnostics IPGroupIpGroupsClientDiagnostics => _ipGroupIPGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", IPGroupResource.ResourceType.Namespace, Diagnostics); + private IpGroupsRestOperations IPGroupIpGroupsRestClient => _ipGroupIPGroupsRestClient ??= new IpGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IPGroupResource.ResourceType)); + private ClientDiagnostics LoadBalancerClientDiagnostics => _loadBalancerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", LoadBalancerResource.ResourceType.Namespace, Diagnostics); + private LoadBalancersRestOperations LoadBalancerRestClient => _loadBalancerRestClient ??= new LoadBalancersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LoadBalancerResource.ResourceType)); + private ClientDiagnostics NatGatewayClientDiagnostics => _natGatewayClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NatGatewayResource.ResourceType.Namespace, Diagnostics); + private NatGatewaysRestOperations NatGatewayRestClient => _natGatewayRestClient ??= new NatGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NatGatewayResource.ResourceType)); + private ClientDiagnostics NetworkInterfaceClientDiagnostics => _networkInterfaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkInterfaceResource.ResourceType.Namespace, Diagnostics); + private NetworkInterfacesRestOperations NetworkInterfaceRestClient => _networkInterfaceRestClient ??= new NetworkInterfacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkInterfaceResource.ResourceType)); + private ClientDiagnostics NetworkManagerClientDiagnostics => _networkManagerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkManagerResource.ResourceType.Namespace, Diagnostics); + private NetworkManagersRestOperations NetworkManagerRestClient => _networkManagerRestClient ??= new NetworkManagersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkManagerResource.ResourceType)); + private ClientDiagnostics NetworkProfileClientDiagnostics => _networkProfileClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkProfileResource.ResourceType.Namespace, Diagnostics); + private NetworkProfilesRestOperations NetworkProfileRestClient => _networkProfileRestClient ??= new NetworkProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkProfileResource.ResourceType)); + private ClientDiagnostics NetworkSecurityGroupClientDiagnostics => _networkSecurityGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkSecurityGroupResource.ResourceType.Namespace, Diagnostics); + private NetworkSecurityGroupsRestOperations NetworkSecurityGroupRestClient => _networkSecurityGroupRestClient ??= new NetworkSecurityGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkSecurityGroupResource.ResourceType)); + private ClientDiagnostics NetworkVirtualApplianceClientDiagnostics => _networkVirtualApplianceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkVirtualApplianceResource.ResourceType.Namespace, Diagnostics); + private NetworkVirtualAppliancesRestOperations NetworkVirtualApplianceRestClient => _networkVirtualApplianceRestClient ??= new NetworkVirtualAppliancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkVirtualApplianceResource.ResourceType)); + private ClientDiagnostics NetworkWatcherClientDiagnostics => _networkWatcherClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkWatcherResource.ResourceType.Namespace, Diagnostics); + private NetworkWatchersRestOperations NetworkWatcherRestClient => _networkWatcherRestClient ??= new NetworkWatchersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkWatcherResource.ResourceType)); + private ClientDiagnostics PrivateEndpointClientDiagnostics => _privateEndpointClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", PrivateEndpointResource.ResourceType.Namespace, Diagnostics); + private PrivateEndpointsRestOperations PrivateEndpointRestClient => _privateEndpointRestClient ??= new PrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PrivateEndpointResource.ResourceType)); + private ClientDiagnostics AvailablePrivateEndpointTypesClientDiagnostics => _availablePrivateEndpointTypesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailablePrivateEndpointTypesRestOperations AvailablePrivateEndpointTypesRestClient => _availablePrivateEndpointTypesRestClient ??= new AvailablePrivateEndpointTypesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PrivateLinkServiceClientDiagnostics => _privateLinkServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", PrivateLinkServiceResource.ResourceType.Namespace, Diagnostics); + private PrivateLinkServicesRestOperations PrivateLinkServiceRestClient => _privateLinkServiceRestClient ??= new PrivateLinkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PrivateLinkServiceResource.ResourceType)); + private ClientDiagnostics PrivateLinkServicesClientDiagnostics => _privateLinkServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PrivateLinkServicesRestOperations PrivateLinkServicesRestClient => _privateLinkServicesRestClient ??= new PrivateLinkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PublicIPAddressClientDiagnostics => _publicIPAddressClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", PublicIPAddressResource.ResourceType.Namespace, Diagnostics); + private PublicIPAddressesRestOperations PublicIPAddressRestClient => _publicIPAddressRestClient ??= new PublicIPAddressesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PublicIPAddressResource.ResourceType)); + private ClientDiagnostics PublicIPPrefixClientDiagnostics => _publicIPPrefixClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", PublicIPPrefixResource.ResourceType.Namespace, Diagnostics); + private PublicIPPrefixesRestOperations PublicIPPrefixRestClient => _publicIPPrefixRestClient ??= new PublicIPPrefixesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PublicIPPrefixResource.ResourceType)); + private ClientDiagnostics RouteFilterClientDiagnostics => _routeFilterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", RouteFilterResource.ResourceType.Namespace, Diagnostics); + private RouteFiltersRestOperations RouteFilterRestClient => _routeFilterRestClient ??= new RouteFiltersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RouteFilterResource.ResourceType)); + private ClientDiagnostics RouteTableClientDiagnostics => _routeTableClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", RouteTableResource.ResourceType.Namespace, Diagnostics); + private RouteTablesRestOperations RouteTableRestClient => _routeTableRestClient ??= new RouteTablesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RouteTableResource.ResourceType)); + private ClientDiagnostics SecurityPartnerProviderClientDiagnostics => _securityPartnerProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", SecurityPartnerProviderResource.ResourceType.Namespace, Diagnostics); + private SecurityPartnerProvidersRestOperations SecurityPartnerProviderRestClient => _securityPartnerProviderRestClient ??= new SecurityPartnerProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecurityPartnerProviderResource.ResourceType)); + private ClientDiagnostics BgpServiceCommunitiesClientDiagnostics => _bgpServiceCommunitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BgpServiceCommunitiesRestOperations BgpServiceCommunitiesRestClient => _bgpServiceCommunitiesRestClient ??= new BgpServiceCommunitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ServiceEndpointPolicyClientDiagnostics => _serviceEndpointPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ServiceEndpointPolicyResource.ResourceType.Namespace, Diagnostics); + private ServiceEndpointPoliciesRestOperations ServiceEndpointPolicyRestClient => _serviceEndpointPolicyRestClient ??= new ServiceEndpointPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceEndpointPolicyResource.ResourceType)); + private ClientDiagnostics ServiceTagsClientDiagnostics => _serviceTagsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ServiceTagsRestOperations ServiceTagsRestClient => _serviceTagsRestClient ??= new ServiceTagsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ServiceTagInformationClientDiagnostics => _serviceTagInformationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ServiceTagInformationRestOperations ServiceTagInformationRestClient => _serviceTagInformationRestClient ??= new ServiceTagInformationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics VirtualNetworkClientDiagnostics => _virtualNetworkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualNetworkResource.ResourceType.Namespace, Diagnostics); + private VirtualNetworksRestOperations VirtualNetworkRestClient => _virtualNetworkRestClient ??= new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualNetworkResource.ResourceType)); + private ClientDiagnostics VirtualNetworkTapClientDiagnostics => _virtualNetworkTapClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualNetworkTapResource.ResourceType.Namespace, Diagnostics); + private VirtualNetworkTapsRestOperations VirtualNetworkTapRestClient => _virtualNetworkTapRestClient ??= new VirtualNetworkTapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualNetworkTapResource.ResourceType)); + private ClientDiagnostics VirtualRouterClientDiagnostics => _virtualRouterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualRouterResource.ResourceType.Namespace, Diagnostics); + private VirtualRoutersRestOperations VirtualRouterRestClient => _virtualRouterRestClient ??= new VirtualRoutersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualRouterResource.ResourceType)); + private ClientDiagnostics VirtualWanClientDiagnostics => _virtualWanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualWanResource.ResourceType.Namespace, Diagnostics); + private VirtualWansRestOperations VirtualWanRestClient => _virtualWanRestClient ??= new VirtualWansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualWanResource.ResourceType)); + private ClientDiagnostics VpnSiteClientDiagnostics => _vpnSiteClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VpnSiteResource.ResourceType.Namespace, Diagnostics); + private VpnSitesRestOperations VpnSiteRestClient => _vpnSiteRestClient ??= new VpnSitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VpnSiteResource.ResourceType)); + private ClientDiagnostics VpnServerConfigurationClientDiagnostics => _vpnServerConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VpnServerConfigurationResource.ResourceType.Namespace, Diagnostics); + private VpnServerConfigurationsRestOperations VpnServerConfigurationRestClient => _vpnServerConfigurationRestClient ??= new VpnServerConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VpnServerConfigurationResource.ResourceType)); + private ClientDiagnostics VirtualHubClientDiagnostics => _virtualHubClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualHubResource.ResourceType.Namespace, Diagnostics); + private VirtualHubsRestOperations VirtualHubRestClient => _virtualHubRestClient ??= new VirtualHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualHubResource.ResourceType)); + private ClientDiagnostics VpnGatewayClientDiagnostics => _vpnGatewayClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VpnGatewayResource.ResourceType.Namespace, Diagnostics); + private VpnGatewaysRestOperations VpnGatewayRestClient => _vpnGatewayRestClient ??= new VpnGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VpnGatewayResource.ResourceType)); + private ClientDiagnostics P2SVpnGatewayP2sVpnGatewaysClientDiagnostics => _p2sVpnGatewayP2sVpnGatewaysClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", P2SVpnGatewayResource.ResourceType.Namespace, Diagnostics); + private P2SVpnGatewaysRestOperations P2SVpnGatewayP2sVpnGatewaysRestClient => _p2sVpnGatewayP2sVpnGatewaysRestClient ??= new P2SVpnGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(P2SVpnGatewayResource.ResourceType)); + private ClientDiagnostics ExpressRouteGatewayClientDiagnostics => _expressRouteGatewayClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRouteGatewayResource.ResourceType.Namespace, Diagnostics); + private ExpressRouteGatewaysRestOperations ExpressRouteGatewayRestClient => _expressRouteGatewayRestClient ??= new ExpressRouteGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRouteGatewayResource.ResourceType)); + private ClientDiagnostics WebApplicationFirewallPolicyClientDiagnostics => _webApplicationFirewallPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", WebApplicationFirewallPolicyResource.ResourceType.Namespace, Diagnostics); + private WebApplicationFirewallPoliciesRestOperations WebApplicationFirewallPolicyRestClient => _webApplicationFirewallPolicyRestClient ??= new WebApplicationFirewallPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WebApplicationFirewallPolicyResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ApplicationGatewayWafDynamicManifestResources in the SubscriptionResource. + /// The region where the nrp are located at. + /// An object representing collection of ApplicationGatewayWafDynamicManifestResources and their operations over a ApplicationGatewayWafDynamicManifestResource. + public virtual ApplicationGatewayWafDynamicManifestCollection GetApplicationGatewayWafDynamicManifests(AzureLocation location) + { + return new ApplicationGatewayWafDynamicManifestCollection(Client, Id, location); + } + + /// + /// Gets the regional application gateway waf manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault + /// + /// + /// Operation Id + /// ApplicationGatewayWafDynamicManifestsDefault_Get + /// + /// + /// + /// The region where the nrp are located at. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetApplicationGatewayWafDynamicManifestAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + return await GetApplicationGatewayWafDynamicManifests(location).GetAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the regional application gateway waf manifest. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/applicationGatewayWafDynamicManifests/dafault + /// + /// + /// Operation Id + /// ApplicationGatewayWafDynamicManifestsDefault_Get + /// + /// + /// + /// The region where the nrp are located at. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetApplicationGatewayWafDynamicManifest(AzureLocation location, CancellationToken cancellationToken = default) + { + return GetApplicationGatewayWafDynamicManifests(location).Get(cancellationToken); + } + + /// Gets a collection of AzureWebCategoryResources in the SubscriptionResource. + /// An object representing collection of AzureWebCategoryResources and their operations over a AzureWebCategoryResource. + public virtual AzureWebCategoryCollection GetAzureWebCategories() + { + return GetCachedClient(client => new AzureWebCategoryCollection(client, Id)); + } + + /// + /// Gets the specified Azure Web Category. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name} + /// + /// + /// Operation Id + /// WebCategories_Get + /// + /// + /// + /// The name of the azureWebCategory. + /// Expands resourceIds back referenced by the azureWebCategory resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAzureWebCategoryAsync(string name, string expand = null, CancellationToken cancellationToken = default) + { + return await GetAzureWebCategories().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Azure Web Category. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name} + /// + /// + /// Operation Id + /// WebCategories_Get + /// + /// + /// + /// The name of the azureWebCategory. + /// Expands resourceIds back referenced by the azureWebCategory resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAzureWebCategory(string name, string expand = null, CancellationToken cancellationToken = default) + { + return GetAzureWebCategories().Get(name, expand, cancellationToken); + } + + /// Gets a collection of ExpressRouteProviderPortResources in the SubscriptionResource. + /// An object representing collection of ExpressRouteProviderPortResources and their operations over a ExpressRouteProviderPortResource. + public virtual ExpressRouteProviderPortCollection GetExpressRouteProviderPorts() + { + return GetCachedClient(client => new ExpressRouteProviderPortCollection(client, Id)); + } + + /// + /// Retrieves detail of a provider port. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport} + /// + /// + /// Operation Id + /// ExpressRouteProviderPort + /// + /// + /// + /// The name of the provider port. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetExpressRouteProviderPortAsync(string providerport, CancellationToken cancellationToken = default) + { + return await GetExpressRouteProviderPorts().GetAsync(providerport, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves detail of a provider port. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteProviderPorts/{providerport} + /// + /// + /// Operation Id + /// ExpressRouteProviderPort + /// + /// + /// + /// The name of the provider port. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetExpressRouteProviderPort(string providerport, CancellationToken cancellationToken = default) + { + return GetExpressRouteProviderPorts().Get(providerport, cancellationToken); + } + + /// Gets a collection of ExpressRoutePortsLocationResources in the SubscriptionResource. + /// An object representing collection of ExpressRoutePortsLocationResources and their operations over a ExpressRoutePortsLocationResource. + public virtual ExpressRoutePortsLocationCollection GetExpressRoutePortsLocations() + { + return GetCachedClient(client => new ExpressRoutePortsLocationCollection(client, Id)); + } + + /// + /// Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths available at said peering location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName} + /// + /// + /// Operation Id + /// ExpressRoutePortsLocations_Get + /// + /// + /// + /// Name of the requested ExpressRoutePort peering location. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetExpressRoutePortsLocationAsync(string locationName, CancellationToken cancellationToken = default) + { + return await GetExpressRoutePortsLocations().GetAsync(locationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths available at said peering location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName} + /// + /// + /// Operation Id + /// ExpressRoutePortsLocations_Get + /// + /// + /// + /// Name of the requested ExpressRoutePort peering location. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetExpressRoutePortsLocation(string locationName, CancellationToken cancellationToken = default) + { + return GetExpressRoutePortsLocations().Get(locationName, cancellationToken); + } + + /// Gets a collection of SubscriptionNetworkManagerConnectionResources in the SubscriptionResource. + /// An object representing collection of SubscriptionNetworkManagerConnectionResources and their operations over a SubscriptionNetworkManagerConnectionResource. + public virtual SubscriptionNetworkManagerConnectionCollection GetSubscriptionNetworkManagerConnections() + { + return GetCachedClient(client => new SubscriptionNetworkManagerConnectionCollection(client, Id)); + } + + /// + /// Get a specified connection created by this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName} + /// + /// + /// Operation Id + /// SubscriptionNetworkManagerConnections_Get + /// + /// + /// + /// Name for the network manager connection. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionNetworkManagerConnectionAsync(string networkManagerConnectionName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionNetworkManagerConnections().GetAsync(networkManagerConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specified connection created by this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName} + /// + /// + /// Operation Id + /// SubscriptionNetworkManagerConnections_Get + /// + /// + /// + /// Name for the network manager connection. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionNetworkManagerConnection(string networkManagerConnectionName, CancellationToken cancellationToken = default) + { + return GetSubscriptionNetworkManagerConnections().Get(networkManagerConnectionName, cancellationToken); + } + + /// Gets a collection of NetworkVirtualApplianceSkuResources in the SubscriptionResource. + /// An object representing collection of NetworkVirtualApplianceSkuResources and their operations over a NetworkVirtualApplianceSkuResource. + public virtual NetworkVirtualApplianceSkuCollection GetNetworkVirtualApplianceSkus() + { + return GetCachedClient(client => new NetworkVirtualApplianceSkuCollection(client, Id)); + } + + /// + /// Retrieves a single available sku for network virtual appliance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName} + /// + /// + /// Operation Id + /// VirtualApplianceSkus_Get + /// + /// + /// + /// Name of the Sku. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkVirtualApplianceSkuAsync(string skuName, CancellationToken cancellationToken = default) + { + return await GetNetworkVirtualApplianceSkus().GetAsync(skuName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a single available sku for network virtual appliance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName} + /// + /// + /// Operation Id + /// VirtualApplianceSkus_Get + /// + /// + /// + /// Name of the Sku. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkVirtualApplianceSku(string skuName, CancellationToken cancellationToken = default) + { + return GetNetworkVirtualApplianceSkus().Get(skuName, cancellationToken); + } + + /// + /// Gets all the application gateways in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways + /// + /// + /// Operation Id + /// ApplicationGateways_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApplicationGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationGatewayRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApplicationGatewayResource(Client, ApplicationGatewayData.DeserializeApplicationGatewayData(e)), ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetApplicationGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the application gateways in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways + /// + /// + /// Operation Id + /// ApplicationGateways_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApplicationGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationGatewayRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApplicationGatewayResource(Client, ApplicationGatewayData.DeserializeApplicationGatewayData(e)), ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetApplicationGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all available server variables. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableServerVariables + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableServerVariablesApplicationGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableServerVariablesRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableServerVariablesApplicationGateways", "", null, cancellationToken); + } + + /// + /// Lists all available server variables. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableServerVariables + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableServerVariablesApplicationGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableServerVariablesRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableServerVariablesApplicationGateways", "", null, cancellationToken); + } + + /// + /// Lists all available request headers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableRequestHeaders + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableRequestHeadersApplicationGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableRequestHeadersRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableRequestHeadersApplicationGateways", "", null, cancellationToken); + } + + /// + /// Lists all available request headers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableRequestHeaders + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableRequestHeadersApplicationGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableRequestHeadersRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableRequestHeadersApplicationGateways", "", null, cancellationToken); + } + + /// + /// Lists all available response headers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableResponseHeaders + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableResponseHeadersApplicationGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableResponseHeadersRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableResponseHeadersApplicationGateways", "", null, cancellationToken); + } + + /// + /// Lists all available response headers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableResponseHeaders + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableResponseHeadersApplicationGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableResponseHeadersRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableResponseHeadersApplicationGateways", "", null, cancellationToken); + } + + /// + /// Lists all available web application firewall rule sets. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableWafRuleSets + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppGatewayAvailableWafRuleSetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableWafRuleSetsRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ApplicationGatewayFirewallRuleSet.DeserializeApplicationGatewayFirewallRuleSet, ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAppGatewayAvailableWafRuleSets", "value", null, cancellationToken); + } + + /// + /// Lists all available web application firewall rule sets. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableWafRuleSets + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppGatewayAvailableWafRuleSets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableWafRuleSetsRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ApplicationGatewayFirewallRuleSet.DeserializeApplicationGatewayFirewallRuleSet, ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAppGatewayAvailableWafRuleSets", "value", null, cancellationToken); + } + + /// + /// Lists available Ssl options for configuring Ssl policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableSslOptions + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetApplicationGatewayAvailableSslOptionsAsync(CancellationToken cancellationToken = default) + { + using var scope = ApplicationGatewayClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.GetApplicationGatewayAvailableSslOptions"); + scope.Start(); + try + { + var response = await ApplicationGatewayRestClient.ListAvailableSslOptionsAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists available Ssl options for configuring Ssl policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableSslOptions + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetApplicationGatewayAvailableSslOptions(CancellationToken cancellationToken = default) + { + using var scope = ApplicationGatewayClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.GetApplicationGatewayAvailableSslOptions"); + scope.Start(); + try + { + var response = ApplicationGatewayRestClient.ListAvailableSslOptions(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all SSL predefined policies for configuring Ssl policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableSslPredefinedPolicies + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApplicationGatewayAvailableSslPredefinedPoliciesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableSslPredefinedPoliciesRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationGatewayRestClient.CreateListAvailableSslPredefinedPoliciesNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApplicationGatewaySslPredefinedPolicy.DeserializeApplicationGatewaySslPredefinedPolicy, ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetApplicationGatewayAvailableSslPredefinedPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all SSL predefined policies for configuring Ssl policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies + /// + /// + /// Operation Id + /// ApplicationGateways_ListAvailableSslPredefinedPolicies + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApplicationGatewayAvailableSslPredefinedPolicies(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableSslPredefinedPoliciesRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationGatewayRestClient.CreateListAvailableSslPredefinedPoliciesNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApplicationGatewaySslPredefinedPolicy.DeserializeApplicationGatewaySslPredefinedPolicy, ApplicationGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetApplicationGatewayAvailableSslPredefinedPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Gets Ssl predefined policy with the specified policy name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName} + /// + /// + /// Operation Id + /// ApplicationGateways_GetSslPredefinedPolicy + /// + /// + /// + /// Name of Ssl predefined policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetApplicationGatewaySslPredefinedPolicyAsync(string predefinedPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(predefinedPolicyName, nameof(predefinedPolicyName)); + + using var scope = ApplicationGatewayClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.GetApplicationGatewaySslPredefinedPolicy"); + scope.Start(); + try + { + var response = await ApplicationGatewayRestClient.GetSslPredefinedPolicyAsync(Id.SubscriptionId, predefinedPolicyName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets Ssl predefined policy with the specified policy name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName} + /// + /// + /// Operation Id + /// ApplicationGateways_GetSslPredefinedPolicy + /// + /// + /// + /// Name of Ssl predefined policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetApplicationGatewaySslPredefinedPolicy(string predefinedPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(predefinedPolicyName, nameof(predefinedPolicyName)); + + using var scope = ApplicationGatewayClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.GetApplicationGatewaySslPredefinedPolicy"); + scope.Start(); + try + { + var response = ApplicationGatewayRestClient.GetSslPredefinedPolicy(Id.SubscriptionId, predefinedPolicyName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all application security groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups + /// + /// + /// Operation Id + /// ApplicationSecurityGroups_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApplicationSecurityGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationSecurityGroupRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationSecurityGroupRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApplicationSecurityGroupResource(Client, ApplicationSecurityGroupData.DeserializeApplicationSecurityGroupData(e)), ApplicationSecurityGroupClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetApplicationSecurityGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all application security groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups + /// + /// + /// Operation Id + /// ApplicationSecurityGroups_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApplicationSecurityGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationSecurityGroupRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationSecurityGroupRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApplicationSecurityGroupResource(Client, ApplicationSecurityGroupData.DeserializeApplicationSecurityGroupData(e)), ApplicationSecurityGroupClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetApplicationSecurityGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all of the available subnet delegations for this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations + /// + /// + /// Operation Id + /// AvailableDelegations_List + /// + /// + /// + /// The location of the subnet. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableDelegationsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableDelegationsRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableDelegationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableDelegation.DeserializeAvailableDelegation, AvailableDelegationsClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableDelegations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all of the available subnet delegations for this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations + /// + /// + /// Operation Id + /// AvailableDelegations_List + /// + /// + /// + /// The location of the subnet. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableDelegations(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableDelegationsRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableDelegationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableDelegation.DeserializeAvailableDelegation, AvailableDelegationsClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableDelegations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all available service aliases for this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases + /// + /// + /// Operation Id + /// AvailableServiceAliases_List + /// + /// + /// + /// The location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableServiceAliasesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableServiceAliasesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableServiceAliasesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableServiceAlias.DeserializeAvailableServiceAlias, AvailableServiceAliasesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableServiceAliases", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all available service aliases for this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases + /// + /// + /// Operation Id + /// AvailableServiceAliases_List + /// + /// + /// + /// The location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableServiceAliases(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableServiceAliasesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableServiceAliasesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableServiceAlias.DeserializeAvailableServiceAlias, AvailableServiceAliasesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableServiceAliases", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Azure Firewalls in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls + /// + /// + /// Operation Id + /// AzureFirewalls_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAzureFirewallsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureFirewallRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureFirewallRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AzureFirewallResource(Client, AzureFirewallData.DeserializeAzureFirewallData(e)), AzureFirewallClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAzureFirewalls", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Azure Firewalls in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls + /// + /// + /// Operation Id + /// AzureFirewalls_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAzureFirewalls(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureFirewallRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureFirewallRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AzureFirewallResource(Client, AzureFirewallData.DeserializeAzureFirewallData(e)), AzureFirewallClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAzureFirewalls", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Azure Firewall FQDN Tags in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags + /// + /// + /// Operation Id + /// AzureFirewallFqdnTags_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAzureFirewallFqdnTagsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureFirewallFqdnTagsRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureFirewallFqdnTagsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AzureFirewallFqdnTag.DeserializeAzureFirewallFqdnTag, AzureFirewallFqdnTagsClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAzureFirewallFqdnTags", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Azure Firewall FQDN Tags in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags + /// + /// + /// Operation Id + /// AzureFirewallFqdnTags_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAzureFirewallFqdnTags(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureFirewallFqdnTagsRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureFirewallFqdnTagsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AzureFirewallFqdnTag.DeserializeAzureFirewallFqdnTag, AzureFirewallFqdnTagsClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAzureFirewallFqdnTags", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all Bastion Hosts in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts + /// + /// + /// Operation Id + /// BastionHosts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBastionHostsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BastionHostRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BastionHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BastionHostResource(Client, BastionHostData.DeserializeBastionHostData(e)), BastionHostClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetBastionHosts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all Bastion Hosts in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts + /// + /// + /// Operation Id + /// BastionHosts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBastionHosts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BastionHostRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BastionHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BastionHostResource(Client, BastionHostData.DeserializeBastionHostData(e)), BastionHostClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetBastionHosts", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether a domain name in the cloudapp.azure.com zone is available for use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability + /// + /// + /// Operation Id + /// CheckDnsNameAvailability + /// + /// + /// + /// The location of the domain name. + /// The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckDnsNameAvailabilityAsync(AzureLocation location, string domainNameLabel, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(domainNameLabel, nameof(domainNameLabel)); + + using var scope = ExpressRouteProviderPortClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.CheckDnsNameAvailability"); + scope.Start(); + try + { + var response = await ExpressRouteProviderPortRestClient.CheckDnsNameAvailabilityAsync(Id.SubscriptionId, location, domainNameLabel, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether a domain name in the cloudapp.azure.com zone is available for use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability + /// + /// + /// Operation Id + /// CheckDnsNameAvailability + /// + /// + /// + /// The location of the domain name. + /// The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. + /// The cancellation token to use. + /// is null. + public virtual Response CheckDnsNameAvailability(AzureLocation location, string domainNameLabel, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(domainNameLabel, nameof(domainNameLabel)); + + using var scope = ExpressRouteProviderPortClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.CheckDnsNameAvailability"); + scope.Start(); + try + { + var response = ExpressRouteProviderPortRestClient.CheckDnsNameAvailability(Id.SubscriptionId, location, domainNameLabel, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all the custom IP prefixes in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes + /// + /// + /// Operation Id + /// CustomIPPrefixes_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCustomIPPrefixesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CustomIPPrefixRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomIPPrefixRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CustomIPPrefixResource(Client, CustomIPPrefixData.DeserializeCustomIPPrefixData(e)), CustomIPPrefixClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetCustomIPPrefixes", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the custom IP prefixes in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes + /// + /// + /// Operation Id + /// CustomIPPrefixes_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCustomIPPrefixes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CustomIPPrefixRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomIPPrefixRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CustomIPPrefixResource(Client, CustomIPPrefixData.DeserializeCustomIPPrefixData(e)), CustomIPPrefixClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetCustomIPPrefixes", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all DDoS protection plans in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans + /// + /// + /// Operation Id + /// DdosProtectionPlans_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDdosProtectionPlansAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DdosProtectionPlanRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DdosProtectionPlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DdosProtectionPlanResource(Client, DdosProtectionPlanData.DeserializeDdosProtectionPlanData(e)), DdosProtectionPlanClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetDdosProtectionPlans", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all DDoS protection plans in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans + /// + /// + /// Operation Id + /// DdosProtectionPlans_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDdosProtectionPlans(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DdosProtectionPlanRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DdosProtectionPlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DdosProtectionPlanResource(Client, DdosProtectionPlanData.DeserializeDdosProtectionPlanData(e)), DdosProtectionPlanClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetDdosProtectionPlans", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all dscp configurations in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations + /// + /// + /// Operation Id + /// DscpConfiguration_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDscpConfigurationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DscpConfigurationRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DscpConfigurationRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DscpConfigurationResource(Client, DscpConfigurationData.DeserializeDscpConfigurationData(e)), DscpConfigurationClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetDscpConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all dscp configurations in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations + /// + /// + /// Operation Id + /// DscpConfiguration_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDscpConfigurations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DscpConfigurationRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DscpConfigurationRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DscpConfigurationResource(Client, DscpConfigurationData.DeserializeDscpConfigurationData(e)), DscpConfigurationClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetDscpConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// List what values of endpoint services are available for use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices + /// + /// + /// Operation Id + /// AvailableEndpointServices_List + /// + /// + /// + /// The location to check available endpoint services. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableEndpointServicesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableEndpointServicesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableEndpointServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EndpointServiceResult.DeserializeEndpointServiceResult, AvailableEndpointServicesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableEndpointServices", "value", "nextLink", cancellationToken); + } + + /// + /// List what values of endpoint services are available for use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices + /// + /// + /// Operation Id + /// AvailableEndpointServices_List + /// + /// + /// + /// The location to check available endpoint services. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableEndpointServices(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableEndpointServicesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableEndpointServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EndpointServiceResult.DeserializeEndpointServiceResult, AvailableEndpointServicesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailableEndpointServices", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the express route circuits in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits + /// + /// + /// Operation Id + /// ExpressRouteCircuits_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetExpressRouteCircuitsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteCircuitRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteCircuitRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteCircuitResource(Client, ExpressRouteCircuitData.DeserializeExpressRouteCircuitData(e)), ExpressRouteCircuitClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRouteCircuits", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the express route circuits in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits + /// + /// + /// Operation Id + /// ExpressRouteCircuits_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetExpressRouteCircuits(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteCircuitRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteCircuitRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteCircuitResource(Client, ExpressRouteCircuitData.DeserializeExpressRouteCircuitData(e)), ExpressRouteCircuitClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRouteCircuits", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the available express route service providers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders + /// + /// + /// Operation Id + /// ExpressRouteServiceProviders_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetExpressRouteServiceProvidersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteServiceProvidersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteServiceProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ExpressRouteServiceProvider.DeserializeExpressRouteServiceProvider, ExpressRouteServiceProvidersClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRouteServiceProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the available express route service providers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders + /// + /// + /// Operation Id + /// ExpressRouteServiceProviders_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetExpressRouteServiceProviders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteServiceProvidersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteServiceProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ExpressRouteServiceProvider.DeserializeExpressRouteServiceProvider, ExpressRouteServiceProvidersClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRouteServiceProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves all the ExpressRouteCrossConnections in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections + /// + /// + /// Operation Id + /// ExpressRouteCrossConnections_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetExpressRouteCrossConnectionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteCrossConnectionRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteCrossConnectionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteCrossConnectionResource(Client, ExpressRouteCrossConnectionData.DeserializeExpressRouteCrossConnectionData(e)), ExpressRouteCrossConnectionClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRouteCrossConnections", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves all the ExpressRouteCrossConnections in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections + /// + /// + /// Operation Id + /// ExpressRouteCrossConnections_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetExpressRouteCrossConnections(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteCrossConnectionRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteCrossConnectionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteCrossConnectionResource(Client, ExpressRouteCrossConnectionData.DeserializeExpressRouteCrossConnectionData(e)), ExpressRouteCrossConnectionClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRouteCrossConnections", "value", "nextLink", cancellationToken); + } + + /// + /// List all the ExpressRoutePort resources in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts + /// + /// + /// Operation Id + /// ExpressRoutePorts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetExpressRoutePortsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRoutePortRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRoutePortRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExpressRoutePortResource(Client, ExpressRoutePortData.DeserializeExpressRoutePortData(e)), ExpressRoutePortClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRoutePorts", "value", "nextLink", cancellationToken); + } + + /// + /// List all the ExpressRoutePort resources in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts + /// + /// + /// Operation Id + /// ExpressRoutePorts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetExpressRoutePorts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRoutePortRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRoutePortRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExpressRoutePortResource(Client, ExpressRoutePortData.DeserializeExpressRoutePortData(e)), ExpressRoutePortClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRoutePorts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies + /// + /// + /// Operation Id + /// FirewallPolicies_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFirewallPoliciesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FirewallPolicyRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FirewallPolicyRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FirewallPolicyResource(Client, FirewallPolicyData.DeserializeFirewallPolicyData(e)), FirewallPolicyClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetFirewallPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies + /// + /// + /// Operation Id + /// FirewallPolicies_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFirewallPolicies(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => FirewallPolicyRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FirewallPolicyRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FirewallPolicyResource(Client, FirewallPolicyData.DeserializeFirewallPolicyData(e)), FirewallPolicyClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetFirewallPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all IpAllocations in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations + /// + /// + /// Operation Id + /// IpAllocations_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetIPAllocationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IPAllocationIpAllocationsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IPAllocationIpAllocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IPAllocationResource(Client, IPAllocationData.DeserializeIPAllocationData(e)), IPAllocationIpAllocationsClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetIPAllocations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all IpAllocations in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations + /// + /// + /// Operation Id + /// IpAllocations_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetIPAllocations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IPAllocationIpAllocationsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IPAllocationIpAllocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IPAllocationResource(Client, IPAllocationData.DeserializeIPAllocationData(e)), IPAllocationIpAllocationsClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetIPAllocations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all IpGroups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups + /// + /// + /// Operation Id + /// IpGroups_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetIPGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IPGroupIpGroupsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IPGroupIpGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IPGroupResource(Client, IPGroupData.DeserializeIPGroupData(e)), IPGroupIpGroupsClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetIPGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all IpGroups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups + /// + /// + /// Operation Id + /// IpGroups_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetIPGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IPGroupIpGroupsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IPGroupIpGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IPGroupResource(Client, IPGroupData.DeserializeIPGroupData(e)), IPGroupIpGroupsClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetIPGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the load balancers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers + /// + /// + /// Operation Id + /// LoadBalancers_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLoadBalancersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LoadBalancerRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LoadBalancerRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LoadBalancerResource(Client, LoadBalancerData.DeserializeLoadBalancerData(e)), LoadBalancerClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetLoadBalancers", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the load balancers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers + /// + /// + /// Operation Id + /// LoadBalancers_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLoadBalancers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LoadBalancerRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LoadBalancerRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LoadBalancerResource(Client, LoadBalancerData.DeserializeLoadBalancerData(e)), LoadBalancerClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetLoadBalancers", "value", "nextLink", cancellationToken); + } + + /// + /// Swaps VIPs between two load balancers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses + /// + /// + /// Operation Id + /// LoadBalancers_SwapPublicIpAddresses + /// + /// + /// + /// 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 region where load balancers are located at. + /// Parameters that define which VIPs should be swapped. + /// The cancellation token to use. + /// is null. + public virtual async Task SwapPublicIPAddressesLoadBalancerAsync(WaitUntil waitUntil, AzureLocation location, LoadBalancerVipSwapContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LoadBalancerClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.SwapPublicIPAddressesLoadBalancer"); + scope.Start(); + try + { + var response = await LoadBalancerRestClient.SwapPublicIPAddressesAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + var operation = new NetworkArmOperation(LoadBalancerClientDiagnostics, Pipeline, LoadBalancerRestClient.CreateSwapPublicIPAddressesRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Swaps VIPs between two load balancers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses + /// + /// + /// Operation Id + /// LoadBalancers_SwapPublicIpAddresses + /// + /// + /// + /// 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 region where load balancers are located at. + /// Parameters that define which VIPs should be swapped. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation SwapPublicIPAddressesLoadBalancer(WaitUntil waitUntil, AzureLocation location, LoadBalancerVipSwapContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LoadBalancerClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.SwapPublicIPAddressesLoadBalancer"); + scope.Start(); + try + { + var response = LoadBalancerRestClient.SwapPublicIPAddresses(Id.SubscriptionId, location, content, cancellationToken); + var operation = new NetworkArmOperation(LoadBalancerClientDiagnostics, Pipeline, LoadBalancerRestClient.CreateSwapPublicIPAddressesRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all the Nat Gateways in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways + /// + /// + /// Operation Id + /// NatGateways_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNatGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NatGatewayRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NatGatewayRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NatGatewayResource(Client, NatGatewayData.DeserializeNatGatewayData(e)), NatGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNatGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Nat Gateways in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways + /// + /// + /// Operation Id + /// NatGateways_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNatGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NatGatewayRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NatGatewayRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NatGatewayResource(Client, NatGatewayData.DeserializeNatGatewayData(e)), NatGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNatGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all network interfaces in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces + /// + /// + /// Operation Id + /// NetworkInterfaces_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkInterfacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkInterfaceRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkInterfaceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkInterfaceResource(Client, NetworkInterfaceData.DeserializeNetworkInterfaceData(e)), NetworkInterfaceClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkInterfaces", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all network interfaces in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces + /// + /// + /// Operation Id + /// NetworkInterfaces_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkInterfaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkInterfaceRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkInterfaceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkInterfaceResource(Client, NetworkInterfaceData.DeserializeNetworkInterfaceData(e)), NetworkInterfaceClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkInterfaces", "value", "nextLink", cancellationToken); + } + + /// + /// List all network managers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers + /// + /// + /// Operation Id + /// NetworkManagers_ListBySubscription + /// + /// + /// + /// An optional query parameter which specifies the maximum number of records to be returned by the server. + /// SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkManagersAsync(int? top = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkManagerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkManagerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkManagerResource(Client, NetworkManagerData.DeserializeNetworkManagerData(e)), NetworkManagerClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkManagers", "value", "nextLink", cancellationToken); + } + + /// + /// List all network managers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers + /// + /// + /// Operation Id + /// NetworkManagers_ListBySubscription + /// + /// + /// + /// An optional query parameter which specifies the maximum number of records to be returned by the server. + /// SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkManagers(int? top = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkManagerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkManagerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkManagerResource(Client, NetworkManagerData.DeserializeNetworkManagerData(e)), NetworkManagerClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkManagers", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the network profiles in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles + /// + /// + /// Operation Id + /// NetworkProfiles_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkProfilesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkProfileRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkProfileRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkProfileResource(Client, NetworkProfileData.DeserializeNetworkProfileData(e)), NetworkProfileClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the network profiles in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles + /// + /// + /// Operation Id + /// NetworkProfiles_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkProfiles(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkProfileRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkProfileRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkProfileResource(Client, NetworkProfileData.DeserializeNetworkProfileData(e)), NetworkProfileClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all network security groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups + /// + /// + /// Operation Id + /// NetworkSecurityGroups_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkSecurityGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkSecurityGroupRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkSecurityGroupRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkSecurityGroupResource(Client, NetworkSecurityGroupData.DeserializeNetworkSecurityGroupData(e)), NetworkSecurityGroupClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkSecurityGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all network security groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups + /// + /// + /// Operation Id + /// NetworkSecurityGroups_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkSecurityGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkSecurityGroupRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkSecurityGroupRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkSecurityGroupResource(Client, NetworkSecurityGroupData.DeserializeNetworkSecurityGroupData(e)), NetworkSecurityGroupClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkSecurityGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all Network Virtual Appliances in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances + /// + /// + /// Operation Id + /// NetworkVirtualAppliances_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkVirtualAppliancesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkVirtualApplianceRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkVirtualApplianceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkVirtualApplianceResource(Client, NetworkVirtualApplianceData.DeserializeNetworkVirtualApplianceData(e)), NetworkVirtualApplianceClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkVirtualAppliances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all Network Virtual Appliances in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances + /// + /// + /// Operation Id + /// NetworkVirtualAppliances_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkVirtualAppliances(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkVirtualApplianceRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkVirtualApplianceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkVirtualApplianceResource(Client, NetworkVirtualApplianceData.DeserializeNetworkVirtualApplianceData(e)), NetworkVirtualApplianceClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkVirtualAppliances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all network watchers by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers + /// + /// + /// Operation Id + /// NetworkWatchers_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkWatchersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkWatcherRestClient.CreateListAllRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new NetworkWatcherResource(Client, NetworkWatcherData.DeserializeNetworkWatcherData(e)), NetworkWatcherClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkWatchers", "value", null, cancellationToken); + } + + /// + /// Gets all network watchers by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers + /// + /// + /// Operation Id + /// NetworkWatchers_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkWatchers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkWatcherRestClient.CreateListAllRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new NetworkWatcherResource(Client, NetworkWatcherData.DeserializeNetworkWatcherData(e)), NetworkWatcherClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetNetworkWatchers", "value", null, cancellationToken); + } + + /// + /// Gets all private endpoints in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints + /// + /// + /// Operation Id + /// PrivateEndpoints_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPrivateEndpointsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateEndpointRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateEndpointRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PrivateEndpointResource(Client, PrivateEndpointData.DeserializePrivateEndpointData(e)), PrivateEndpointClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetPrivateEndpoints", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all private endpoints in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints + /// + /// + /// Operation Id + /// PrivateEndpoints_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPrivateEndpoints(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateEndpointRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateEndpointRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PrivateEndpointResource(Client, PrivateEndpointData.DeserializePrivateEndpointData(e)), PrivateEndpointClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetPrivateEndpoints", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes + /// + /// + /// Operation Id + /// AvailablePrivateEndpointTypes_List + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailablePrivateEndpointTypesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailablePrivateEndpointTypesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailablePrivateEndpointTypesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailablePrivateEndpointType.DeserializeAvailablePrivateEndpointType, AvailablePrivateEndpointTypesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailablePrivateEndpointTypes", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes + /// + /// + /// Operation Id + /// AvailablePrivateEndpointTypes_List + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailablePrivateEndpointTypes(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailablePrivateEndpointTypesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailablePrivateEndpointTypesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailablePrivateEndpointType.DeserializeAvailablePrivateEndpointType, AvailablePrivateEndpointTypesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAvailablePrivateEndpointTypes", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all private link service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices + /// + /// + /// Operation Id + /// PrivateLinkServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPrivateLinkServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PrivateLinkServiceResource(Client, PrivateLinkServiceData.DeserializePrivateLinkServiceData(e)), PrivateLinkServiceClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetPrivateLinkServices", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all private link service in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices + /// + /// + /// Operation Id + /// PrivateLinkServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPrivateLinkServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PrivateLinkServiceResource(Client, PrivateLinkServiceData.DeserializePrivateLinkServiceData(e)), PrivateLinkServiceClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetPrivateLinkServices", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether the subscription is visible to private link service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility + /// + /// + /// Operation Id + /// PrivateLinkServices_CheckPrivateLinkServiceVisibility + /// + /// + /// + /// 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 location of the domain name. + /// The request body of CheckPrivateLinkService API call. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPrivateLinkServiceVisibilityPrivateLinkServiceAsync(WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(checkPrivateLinkServiceVisibilityRequest, nameof(checkPrivateLinkServiceVisibilityRequest)); + + using var scope = PrivateLinkServicesClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.CheckPrivateLinkServiceVisibilityPrivateLinkService"); + scope.Start(); + try + { + var response = await PrivateLinkServicesRestClient.CheckPrivateLinkServiceVisibilityAsync(Id.SubscriptionId, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken).ConfigureAwait(false); + var operation = new NetworkArmOperation(new PrivateLinkServiceVisibilityOperationSource(), PrivateLinkServicesClientDiagnostics, Pipeline, PrivateLinkServicesRestClient.CreateCheckPrivateLinkServiceVisibilityRequest(Id.SubscriptionId, location, checkPrivateLinkServiceVisibilityRequest).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the subscription is visible to private link service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility + /// + /// + /// Operation Id + /// PrivateLinkServices_CheckPrivateLinkServiceVisibility + /// + /// + /// + /// 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 location of the domain name. + /// The request body of CheckPrivateLinkService API call. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CheckPrivateLinkServiceVisibilityPrivateLinkService(WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(checkPrivateLinkServiceVisibilityRequest, nameof(checkPrivateLinkServiceVisibilityRequest)); + + using var scope = PrivateLinkServicesClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.CheckPrivateLinkServiceVisibilityPrivateLinkService"); + scope.Start(); + try + { + var response = PrivateLinkServicesRestClient.CheckPrivateLinkServiceVisibility(Id.SubscriptionId, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken); + var operation = new NetworkArmOperation(new PrivateLinkServiceVisibilityOperationSource(), PrivateLinkServicesClientDiagnostics, Pipeline, PrivateLinkServicesRestClient.CreateCheckPrivateLinkServiceVisibilityRequest(Id.SubscriptionId, location, checkPrivateLinkServiceVisibilityRequest).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices + /// + /// + /// Operation Id + /// PrivateLinkServices_ListAutoApprovedPrivateLinkServices + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAutoApprovedPrivateLinkServicesPrivateLinkServicesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AutoApprovedPrivateLinkService.DeserializeAutoApprovedPrivateLinkService, PrivateLinkServicesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAutoApprovedPrivateLinkServicesPrivateLinkServices", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices + /// + /// + /// Operation Id + /// PrivateLinkServices_ListAutoApprovedPrivateLinkServices + /// + /// + /// + /// The location of the domain name. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAutoApprovedPrivateLinkServicesPrivateLinkServices(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AutoApprovedPrivateLinkService.DeserializeAutoApprovedPrivateLinkService, PrivateLinkServicesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAutoApprovedPrivateLinkServicesPrivateLinkServices", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the public IP addresses in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses + /// + /// + /// Operation Id + /// PublicIPAddresses_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPublicIPAddressesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublicIPAddressRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicIPAddressRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublicIPAddressResource(Client, PublicIPAddressData.DeserializePublicIPAddressData(e)), PublicIPAddressClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetPublicIPAddresses", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the public IP addresses in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses + /// + /// + /// Operation Id + /// PublicIPAddresses_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPublicIPAddresses(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublicIPAddressRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicIPAddressRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublicIPAddressResource(Client, PublicIPAddressData.DeserializePublicIPAddressData(e)), PublicIPAddressClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetPublicIPAddresses", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the public IP prefixes in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes + /// + /// + /// Operation Id + /// PublicIPPrefixes_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPublicIPPrefixesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublicIPPrefixRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicIPPrefixRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublicIPPrefixResource(Client, PublicIPPrefixData.DeserializePublicIPPrefixData(e)), PublicIPPrefixClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetPublicIPPrefixes", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the public IP prefixes in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes + /// + /// + /// Operation Id + /// PublicIPPrefixes_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPublicIPPrefixes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PublicIPPrefixRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicIPPrefixRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublicIPPrefixResource(Client, PublicIPPrefixData.DeserializePublicIPPrefixData(e)), PublicIPPrefixClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetPublicIPPrefixes", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all route filters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters + /// + /// + /// Operation Id + /// RouteFilters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRouteFiltersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RouteFilterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RouteFilterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RouteFilterResource(Client, RouteFilterData.DeserializeRouteFilterData(e)), RouteFilterClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetRouteFilters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all route filters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters + /// + /// + /// Operation Id + /// RouteFilters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRouteFilters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RouteFilterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RouteFilterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RouteFilterResource(Client, RouteFilterData.DeserializeRouteFilterData(e)), RouteFilterClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetRouteFilters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all route tables in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables + /// + /// + /// Operation Id + /// RouteTables_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRouteTablesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RouteTableRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RouteTableRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RouteTableResource(Client, RouteTableData.DeserializeRouteTableData(e)), RouteTableClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetRouteTables", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all route tables in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables + /// + /// + /// Operation Id + /// RouteTables_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRouteTables(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RouteTableRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RouteTableRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RouteTableResource(Client, RouteTableData.DeserializeRouteTableData(e)), RouteTableClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetRouteTables", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Security Partner Providers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders + /// + /// + /// Operation Id + /// SecurityPartnerProviders_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecurityPartnerProvidersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityPartnerProviderRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityPartnerProviderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecurityPartnerProviderResource(Client, SecurityPartnerProviderData.DeserializeSecurityPartnerProviderData(e)), SecurityPartnerProviderClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetSecurityPartnerProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Security Partner Providers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders + /// + /// + /// Operation Id + /// SecurityPartnerProviders_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecurityPartnerProviders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityPartnerProviderRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityPartnerProviderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecurityPartnerProviderResource(Client, SecurityPartnerProviderData.DeserializeSecurityPartnerProviderData(e)), SecurityPartnerProviderClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetSecurityPartnerProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the available bgp service communities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities + /// + /// + /// Operation Id + /// BgpServiceCommunities_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBgpServiceCommunitiesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BgpServiceCommunitiesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BgpServiceCommunitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BgpServiceCommunity.DeserializeBgpServiceCommunity, BgpServiceCommunitiesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetBgpServiceCommunities", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the available bgp service communities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities + /// + /// + /// Operation Id + /// BgpServiceCommunities_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBgpServiceCommunities(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => BgpServiceCommunitiesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BgpServiceCommunitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BgpServiceCommunity.DeserializeBgpServiceCommunity, BgpServiceCommunitiesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetBgpServiceCommunities", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the service endpoint policies in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies + /// + /// + /// Operation Id + /// ServiceEndpointPolicies_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetServiceEndpointPoliciesByServiceEndpointPolicyAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceEndpointPolicyRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceEndpointPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceEndpointPolicyResource(Client, ServiceEndpointPolicyData.DeserializeServiceEndpointPolicyData(e)), ServiceEndpointPolicyClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetServiceEndpointPoliciesByServiceEndpointPolicy", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the service endpoint policies in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies + /// + /// + /// Operation Id + /// ServiceEndpointPolicies_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetServiceEndpointPoliciesByServiceEndpointPolicy(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceEndpointPolicyRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceEndpointPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceEndpointPolicyResource(Client, ServiceEndpointPolicyData.DeserializeServiceEndpointPolicyData(e)), ServiceEndpointPolicyClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetServiceEndpointPoliciesByServiceEndpointPolicy", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of service tag information resources. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags + /// + /// + /// Operation Id + /// ServiceTags_List + /// + /// + /// + /// The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). + /// The cancellation token to use. + public virtual async Task> GetServiceTagAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = ServiceTagsClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.GetServiceTag"); + scope.Start(); + try + { + var response = await ServiceTagsRestClient.ListAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of service tag information resources. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags + /// + /// + /// Operation Id + /// ServiceTags_List + /// + /// + /// + /// The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). + /// The cancellation token to use. + public virtual Response GetServiceTag(AzureLocation location, CancellationToken cancellationToken = default) + { + using var scope = ServiceTagsClientDiagnostics.CreateScope("MockableNetworkSubscriptionResource.GetServiceTag"); + scope.Start(); + try + { + var response = ServiceTagsRestClient.List(Id.SubscriptionId, location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of service tag information resources with pagination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails + /// + /// + /// Operation Id + /// ServiceTagInformation_List + /// + /// + /// + /// The location that will be used as a reference for cloud (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). + /// Do not return address prefixes for the tag(s). + /// Return tag information for a particular tag. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllServiceTagInformationAsync(AzureLocation location, bool? noAddressPrefixes = null, string tagName = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceTagInformationRestClient.CreateListRequest(Id.SubscriptionId, location, noAddressPrefixes, tagName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceTagInformationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, noAddressPrefixes, tagName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ServiceTagInformation.DeserializeServiceTagInformation, ServiceTagInformationClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAllServiceTagInformation", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of service tag information resources with pagination. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails + /// + /// + /// Operation Id + /// ServiceTagInformation_List + /// + /// + /// + /// The location that will be used as a reference for cloud (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). + /// Do not return address prefixes for the tag(s). + /// Return tag information for a particular tag. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllServiceTagInformation(AzureLocation location, bool? noAddressPrefixes = null, string tagName = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceTagInformationRestClient.CreateListRequest(Id.SubscriptionId, location, noAddressPrefixes, tagName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceTagInformationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, noAddressPrefixes, tagName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ServiceTagInformation.DeserializeServiceTagInformation, ServiceTagInformationClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetAllServiceTagInformation", "value", "nextLink", cancellationToken); + } + + /// + /// List network usages for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// The location where resource usage is queried. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, NetworkUsage.DeserializeNetworkUsage, UsagesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// List network usages for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// The location where resource usage is queried. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, NetworkUsage.DeserializeNetworkUsage, UsagesClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all virtual networks in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks + /// + /// + /// Operation Id + /// VirtualNetworks_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualNetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all virtual networks in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks + /// + /// + /// Operation Id + /// VirtualNetworks_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualNetworks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the VirtualNetworkTaps in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps + /// + /// + /// Operation Id + /// VirtualNetworkTaps_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualNetworkTapsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkTapRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkTapRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkTapResource(Client, VirtualNetworkTapData.DeserializeVirtualNetworkTapData(e)), VirtualNetworkTapClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualNetworkTaps", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the VirtualNetworkTaps in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps + /// + /// + /// Operation Id + /// VirtualNetworkTaps_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualNetworkTaps(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkTapRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkTapRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkTapResource(Client, VirtualNetworkTapData.DeserializeVirtualNetworkTapData(e)), VirtualNetworkTapClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualNetworkTaps", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Virtual Routers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters + /// + /// + /// Operation Id + /// VirtualRouters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualRoutersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualRouterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualRouterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualRouterResource(Client, VirtualRouterData.DeserializeVirtualRouterData(e)), VirtualRouterClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualRouters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the Virtual Routers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters + /// + /// + /// Operation Id + /// VirtualRouters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualRouters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualRouterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualRouterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualRouterResource(Client, VirtualRouterData.DeserializeVirtualRouterData(e)), VirtualRouterClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualRouters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VirtualWANs in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans + /// + /// + /// Operation Id + /// VirtualWans_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualWansAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWanRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualWanResource(Client, VirtualWanData.DeserializeVirtualWanData(e)), VirtualWanClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualWans", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VirtualWANs in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans + /// + /// + /// Operation Id + /// VirtualWans_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualWans(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWanRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualWanResource(Client, VirtualWanData.DeserializeVirtualWanData(e)), VirtualWanClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualWans", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VpnSites in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites + /// + /// + /// Operation Id + /// VpnSites_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVpnSitesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VpnSiteRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VpnSiteResource(Client, VpnSiteData.DeserializeVpnSiteData(e)), VpnSiteClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVpnSites", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VpnSites in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites + /// + /// + /// Operation Id + /// VpnSites_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVpnSites(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VpnSiteRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VpnSiteResource(Client, VpnSiteData.DeserializeVpnSiteData(e)), VpnSiteClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVpnSites", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VpnServerConfigurations in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations + /// + /// + /// Operation Id + /// VpnServerConfigurations_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVpnServerConfigurationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VpnServerConfigurationRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnServerConfigurationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VpnServerConfigurationResource(Client, VpnServerConfigurationData.DeserializeVpnServerConfigurationData(e)), VpnServerConfigurationClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVpnServerConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VpnServerConfigurations in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations + /// + /// + /// Operation Id + /// VpnServerConfigurations_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVpnServerConfigurations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VpnServerConfigurationRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnServerConfigurationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VpnServerConfigurationResource(Client, VpnServerConfigurationData.DeserializeVpnServerConfigurationData(e)), VpnServerConfigurationClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVpnServerConfigurations", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VirtualHubs in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs + /// + /// + /// Operation Id + /// VirtualHubs_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualHubsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualHubRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualHubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualHubResource(Client, VirtualHubData.DeserializeVirtualHubData(e)), VirtualHubClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualHubs", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VirtualHubs in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs + /// + /// + /// Operation Id + /// VirtualHubs_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualHubs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualHubRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualHubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualHubResource(Client, VirtualHubData.DeserializeVirtualHubData(e)), VirtualHubClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVirtualHubs", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VpnGateways in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways + /// + /// + /// Operation Id + /// VpnGateways_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVpnGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VpnGatewayRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnGatewayRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VpnGatewayResource(Client, VpnGatewayData.DeserializeVpnGatewayData(e)), VpnGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVpnGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the VpnGateways in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways + /// + /// + /// Operation Id + /// VpnGateways_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVpnGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VpnGatewayRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnGatewayRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VpnGatewayResource(Client, VpnGatewayData.DeserializeVpnGatewayData(e)), VpnGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetVpnGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the P2SVpnGateways in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways + /// + /// + /// Operation Id + /// P2sVpnGateways_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetP2SVpnGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => P2SVpnGatewayP2sVpnGatewaysRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => P2SVpnGatewayP2sVpnGatewaysRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new P2SVpnGatewayResource(Client, P2SVpnGatewayData.DeserializeP2SVpnGatewayData(e)), P2SVpnGatewayP2sVpnGatewaysClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetP2SVpnGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the P2SVpnGateways in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways + /// + /// + /// Operation Id + /// P2sVpnGateways_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetP2SVpnGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => P2SVpnGatewayP2sVpnGatewaysRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => P2SVpnGatewayP2sVpnGatewaysRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new P2SVpnGatewayResource(Client, P2SVpnGatewayData.DeserializeP2SVpnGatewayData(e)), P2SVpnGatewayP2sVpnGatewaysClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetP2SVpnGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Lists ExpressRoute gateways under a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways + /// + /// + /// Operation Id + /// ExpressRouteGateways_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetExpressRouteGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteGatewayRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ExpressRouteGatewayResource(Client, ExpressRouteGatewayData.DeserializeExpressRouteGatewayData(e)), ExpressRouteGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRouteGateways", "value", null, cancellationToken); + } + + /// + /// Lists ExpressRoute gateways under a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways + /// + /// + /// Operation Id + /// ExpressRouteGateways_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetExpressRouteGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteGatewayRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ExpressRouteGatewayResource(Client, ExpressRouteGatewayData.DeserializeExpressRouteGatewayData(e)), ExpressRouteGatewayClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetExpressRouteGateways", "value", null, cancellationToken); + } + + /// + /// Gets all the WAF policies in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies + /// + /// + /// Operation Id + /// WebApplicationFirewallPolicies_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWebApplicationFirewallPoliciesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WebApplicationFirewallPolicyRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebApplicationFirewallPolicyRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebApplicationFirewallPolicyResource(Client, WebApplicationFirewallPolicyData.DeserializeWebApplicationFirewallPolicyData(e)), WebApplicationFirewallPolicyClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetWebApplicationFirewallPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the WAF policies in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies + /// + /// + /// Operation Id + /// WebApplicationFirewallPolicies_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWebApplicationFirewallPolicies(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WebApplicationFirewallPolicyRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebApplicationFirewallPolicyRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebApplicationFirewallPolicyResource(Client, WebApplicationFirewallPolicyData.DeserializeWebApplicationFirewallPolicyData(e)), WebApplicationFirewallPolicyClientDiagnostics, Pipeline, "MockableNetworkSubscriptionResource.GetWebApplicationFirewallPolicies", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/NetworkExtensions.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/NetworkExtensions.cs index 4997a4ba859c6..dbdd746e6dfe3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/NetworkExtensions.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/NetworkExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.ManagementGroups; +using Azure.ResourceManager.Network.Mocking; using Azure.ResourceManager.Network.Models; using Azure.ResourceManager.Resources; @@ -20,2111 +21,1766 @@ namespace Azure.ResourceManager.Network /// A class to add extension methods to Azure.ResourceManager.Network. public static partial class NetworkExtensions { - private static ManagementGroupResourceExtensionClient GetManagementGroupResourceExtensionClient(ArmResource resource) + private static MockableNetworkArmClient GetMockableNetworkArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ManagementGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableNetworkArmClient(client0)); } - private static ManagementGroupResourceExtensionClient GetManagementGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNetworkManagementGroupResource GetMockableNetworkManagementGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ManagementGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNetworkManagementGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableNetworkResourceGroupResource GetMockableNetworkResourceGroupResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableNetworkResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNetworkSubscriptionResource GetMockableNetworkSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNetworkSubscriptionResource(client, resource.Id)); } - 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 ApplicationGatewayResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApplicationGatewayResource GetApplicationGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApplicationGatewayResource.ValidateResourceId(id); - return new ApplicationGatewayResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetApplicationGatewayResource(id); } - #endregion - #region ApplicationGatewayPrivateEndpointConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApplicationGatewayPrivateEndpointConnectionResource GetApplicationGatewayPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApplicationGatewayPrivateEndpointConnectionResource.ValidateResourceId(id); - return new ApplicationGatewayPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetApplicationGatewayPrivateEndpointConnectionResource(id); } - #endregion - #region ApplicationGatewayWafDynamicManifestResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApplicationGatewayWafDynamicManifestResource GetApplicationGatewayWafDynamicManifestResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApplicationGatewayWafDynamicManifestResource.ValidateResourceId(id); - return new ApplicationGatewayWafDynamicManifestResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetApplicationGatewayWafDynamicManifestResource(id); } - #endregion - #region ApplicationSecurityGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ApplicationSecurityGroupResource GetApplicationSecurityGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ApplicationSecurityGroupResource.ValidateResourceId(id); - return new ApplicationSecurityGroupResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetApplicationSecurityGroupResource(id); } - #endregion - #region AzureFirewallResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AzureFirewallResource GetAzureFirewallResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AzureFirewallResource.ValidateResourceId(id); - return new AzureFirewallResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetAzureFirewallResource(id); } - #endregion - #region AzureWebCategoryResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AzureWebCategoryResource GetAzureWebCategoryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AzureWebCategoryResource.ValidateResourceId(id); - return new AzureWebCategoryResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetAzureWebCategoryResource(id); } - #endregion - #region BastionHostResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BastionHostResource GetBastionHostResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BastionHostResource.ValidateResourceId(id); - return new BastionHostResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetBastionHostResource(id); } - #endregion - #region ExpressRouteProviderPortResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteProviderPortResource GetExpressRouteProviderPortResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteProviderPortResource.ValidateResourceId(id); - return new ExpressRouteProviderPortResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteProviderPortResource(id); } - #endregion - #region CloudServiceSwapResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CloudServiceSwapResource GetCloudServiceSwapResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CloudServiceSwapResource.ValidateResourceId(id); - return new CloudServiceSwapResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetCloudServiceSwapResource(id); } - #endregion - #region CustomIPPrefixResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CustomIPPrefixResource GetCustomIPPrefixResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CustomIPPrefixResource.ValidateResourceId(id); - return new CustomIPPrefixResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetCustomIPPrefixResource(id); } - #endregion - #region DdosCustomPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DdosCustomPolicyResource GetDdosCustomPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DdosCustomPolicyResource.ValidateResourceId(id); - return new DdosCustomPolicyResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetDdosCustomPolicyResource(id); } - #endregion - #region DdosProtectionPlanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DdosProtectionPlanResource GetDdosProtectionPlanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DdosProtectionPlanResource.ValidateResourceId(id); - return new DdosProtectionPlanResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetDdosProtectionPlanResource(id); } - #endregion - #region DscpConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DscpConfigurationResource GetDscpConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DscpConfigurationResource.ValidateResourceId(id); - return new DscpConfigurationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetDscpConfigurationResource(id); } - #endregion - #region ExpressRouteCircuitAuthorizationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteCircuitAuthorizationResource GetExpressRouteCircuitAuthorizationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteCircuitAuthorizationResource.ValidateResourceId(id); - return new ExpressRouteCircuitAuthorizationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteCircuitAuthorizationResource(id); } - #endregion - #region ExpressRouteCircuitPeeringResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteCircuitPeeringResource GetExpressRouteCircuitPeeringResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteCircuitPeeringResource.ValidateResourceId(id); - return new ExpressRouteCircuitPeeringResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteCircuitPeeringResource(id); } - #endregion - #region ExpressRouteCircuitConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteCircuitConnectionResource GetExpressRouteCircuitConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteCircuitConnectionResource.ValidateResourceId(id); - return new ExpressRouteCircuitConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteCircuitConnectionResource(id); } - #endregion - #region PeerExpressRouteCircuitConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PeerExpressRouteCircuitConnectionResource GetPeerExpressRouteCircuitConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PeerExpressRouteCircuitConnectionResource.ValidateResourceId(id); - return new PeerExpressRouteCircuitConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetPeerExpressRouteCircuitConnectionResource(id); } - #endregion - #region ExpressRouteCircuitResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteCircuitResource GetExpressRouteCircuitResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteCircuitResource.ValidateResourceId(id); - return new ExpressRouteCircuitResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteCircuitResource(id); } - #endregion - #region ExpressRouteCrossConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteCrossConnectionResource GetExpressRouteCrossConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteCrossConnectionResource.ValidateResourceId(id); - return new ExpressRouteCrossConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteCrossConnectionResource(id); } - #endregion - #region ExpressRouteCrossConnectionPeeringResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteCrossConnectionPeeringResource GetExpressRouteCrossConnectionPeeringResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteCrossConnectionPeeringResource.ValidateResourceId(id); - return new ExpressRouteCrossConnectionPeeringResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteCrossConnectionPeeringResource(id); } - #endregion - #region ExpressRoutePortsLocationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRoutePortsLocationResource GetExpressRoutePortsLocationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRoutePortsLocationResource.ValidateResourceId(id); - return new ExpressRoutePortsLocationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRoutePortsLocationResource(id); } - #endregion - #region ExpressRoutePortResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRoutePortResource GetExpressRoutePortResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRoutePortResource.ValidateResourceId(id); - return new ExpressRoutePortResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRoutePortResource(id); } - #endregion - #region ExpressRouteLinkResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteLinkResource GetExpressRouteLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteLinkResource.ValidateResourceId(id); - return new ExpressRouteLinkResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteLinkResource(id); } - #endregion - #region ExpressRoutePortAuthorizationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRoutePortAuthorizationResource GetExpressRoutePortAuthorizationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRoutePortAuthorizationResource.ValidateResourceId(id); - return new ExpressRoutePortAuthorizationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRoutePortAuthorizationResource(id); } - #endregion - #region FirewallPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FirewallPolicyResource GetFirewallPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FirewallPolicyResource.ValidateResourceId(id); - return new FirewallPolicyResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetFirewallPolicyResource(id); } - #endregion - #region FirewallPolicyRuleCollectionGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FirewallPolicyRuleCollectionGroupResource GetFirewallPolicyRuleCollectionGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FirewallPolicyRuleCollectionGroupResource.ValidateResourceId(id); - return new FirewallPolicyRuleCollectionGroupResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetFirewallPolicyRuleCollectionGroupResource(id); } - #endregion - #region PolicySignaturesOverridesForIdpsResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PolicySignaturesOverridesForIdpsResource GetPolicySignaturesOverridesForIdpsResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PolicySignaturesOverridesForIdpsResource.ValidateResourceId(id); - return new PolicySignaturesOverridesForIdpsResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetPolicySignaturesOverridesForIdpsResource(id); } - #endregion - #region IPAllocationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IPAllocationResource GetIPAllocationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IPAllocationResource.ValidateResourceId(id); - return new IPAllocationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetIPAllocationResource(id); } - #endregion - #region IPGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IPGroupResource GetIPGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IPGroupResource.ValidateResourceId(id); - return new IPGroupResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetIPGroupResource(id); } - #endregion - #region LoadBalancerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LoadBalancerResource GetLoadBalancerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LoadBalancerResource.ValidateResourceId(id); - return new LoadBalancerResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetLoadBalancerResource(id); } - #endregion - #region BackendAddressPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackendAddressPoolResource GetBackendAddressPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackendAddressPoolResource.ValidateResourceId(id); - return new BackendAddressPoolResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetBackendAddressPoolResource(id); } - #endregion - #region FrontendIPConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontendIPConfigurationResource GetFrontendIPConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontendIPConfigurationResource.ValidateResourceId(id); - return new FrontendIPConfigurationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetFrontendIPConfigurationResource(id); } - #endregion - #region InboundNatRuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static InboundNatRuleResource GetInboundNatRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - InboundNatRuleResource.ValidateResourceId(id); - return new InboundNatRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetInboundNatRuleResource(id); } - #endregion - #region LoadBalancingRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LoadBalancingRuleResource GetLoadBalancingRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LoadBalancingRuleResource.ValidateResourceId(id); - return new LoadBalancingRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetLoadBalancingRuleResource(id); } - #endregion - #region OutboundRuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OutboundRuleResource GetOutboundRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OutboundRuleResource.ValidateResourceId(id); - return new OutboundRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetOutboundRuleResource(id); } - #endregion - #region ProbeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProbeResource GetProbeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProbeResource.ValidateResourceId(id); - return new ProbeResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetProbeResource(id); } - #endregion - #region NatGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NatGatewayResource GetNatGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NatGatewayResource.ValidateResourceId(id); - return new NatGatewayResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNatGatewayResource(id); } - #endregion - #region NetworkInterfaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkInterfaceResource GetNetworkInterfaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkInterfaceResource.ValidateResourceId(id); - return new NetworkInterfaceResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkInterfaceResource(id); } - #endregion - #region NetworkInterfaceIPConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkInterfaceIPConfigurationResource GetNetworkInterfaceIPConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkInterfaceIPConfigurationResource.ValidateResourceId(id); - return new NetworkInterfaceIPConfigurationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkInterfaceIPConfigurationResource(id); } - #endregion - #region NetworkInterfaceTapConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkInterfaceTapConfigurationResource GetNetworkInterfaceTapConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkInterfaceTapConfigurationResource.ValidateResourceId(id); - return new NetworkInterfaceTapConfigurationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkInterfaceTapConfigurationResource(id); } - #endregion - #region NetworkManagerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkManagerResource GetNetworkManagerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkManagerResource.ValidateResourceId(id); - return new NetworkManagerResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkManagerResource(id); } - #endregion - #region SubscriptionNetworkManagerConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubscriptionNetworkManagerConnectionResource GetSubscriptionNetworkManagerConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionNetworkManagerConnectionResource.ValidateResourceId(id); - return new SubscriptionNetworkManagerConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetSubscriptionNetworkManagerConnectionResource(id); } - #endregion - #region ManagementGroupNetworkManagerConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagementGroupNetworkManagerConnectionResource GetManagementGroupNetworkManagerConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagementGroupNetworkManagerConnectionResource.ValidateResourceId(id); - return new ManagementGroupNetworkManagerConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetManagementGroupNetworkManagerConnectionResource(id); } - #endregion - #region ConnectivityConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ConnectivityConfigurationResource GetConnectivityConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ConnectivityConfigurationResource.ValidateResourceId(id); - return new ConnectivityConfigurationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetConnectivityConfigurationResource(id); } - #endregion - #region NetworkGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkGroupResource GetNetworkGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkGroupResource.ValidateResourceId(id); - return new NetworkGroupResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkGroupResource(id); } - #endregion - #region NetworkGroupStaticMemberResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkGroupStaticMemberResource GetNetworkGroupStaticMemberResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkGroupStaticMemberResource.ValidateResourceId(id); - return new NetworkGroupStaticMemberResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkGroupStaticMemberResource(id); } - #endregion - #region ScopeConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScopeConnectionResource GetScopeConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScopeConnectionResource.ValidateResourceId(id); - return new ScopeConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetScopeConnectionResource(id); } - #endregion - #region SecurityAdminConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityAdminConfigurationResource GetSecurityAdminConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityAdminConfigurationResource.ValidateResourceId(id); - return new SecurityAdminConfigurationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetSecurityAdminConfigurationResource(id); } - #endregion - #region AdminRuleGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AdminRuleGroupResource GetAdminRuleGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AdminRuleGroupResource.ValidateResourceId(id); - return new AdminRuleGroupResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetAdminRuleGroupResource(id); } - #endregion - #region BaseAdminRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BaseAdminRuleResource GetBaseAdminRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BaseAdminRuleResource.ValidateResourceId(id); - return new BaseAdminRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetBaseAdminRuleResource(id); } - #endregion - #region NetworkProfileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkProfileResource GetNetworkProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkProfileResource.ValidateResourceId(id); - return new NetworkProfileResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkProfileResource(id); } - #endregion - #region NetworkSecurityGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkSecurityGroupResource GetNetworkSecurityGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkSecurityGroupResource.ValidateResourceId(id); - return new NetworkSecurityGroupResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkSecurityGroupResource(id); } - #endregion - #region SecurityRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityRuleResource GetSecurityRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityRuleResource.ValidateResourceId(id); - return new SecurityRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetSecurityRuleResource(id); } - #endregion - #region DefaultSecurityRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DefaultSecurityRuleResource GetDefaultSecurityRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DefaultSecurityRuleResource.ValidateResourceId(id); - return new DefaultSecurityRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetDefaultSecurityRuleResource(id); } - #endregion - #region NetworkVirtualApplianceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkVirtualApplianceResource GetNetworkVirtualApplianceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkVirtualApplianceResource.ValidateResourceId(id); - return new NetworkVirtualApplianceResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkVirtualApplianceResource(id); } - #endregion - #region VirtualApplianceSiteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualApplianceSiteResource GetVirtualApplianceSiteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualApplianceSiteResource.ValidateResourceId(id); - return new VirtualApplianceSiteResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualApplianceSiteResource(id); } - #endregion - #region NetworkVirtualApplianceSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkVirtualApplianceSkuResource GetNetworkVirtualApplianceSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkVirtualApplianceSkuResource.ValidateResourceId(id); - return new NetworkVirtualApplianceSkuResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkVirtualApplianceSkuResource(id); } - #endregion - #region NetworkWatcherResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkWatcherResource GetNetworkWatcherResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkWatcherResource.ValidateResourceId(id); - return new NetworkWatcherResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkWatcherResource(id); } - #endregion - #region PacketCaptureResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PacketCaptureResource GetPacketCaptureResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PacketCaptureResource.ValidateResourceId(id); - return new PacketCaptureResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetPacketCaptureResource(id); } - #endregion - #region ConnectionMonitorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ConnectionMonitorResource GetConnectionMonitorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ConnectionMonitorResource.ValidateResourceId(id); - return new ConnectionMonitorResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetConnectionMonitorResource(id); } - #endregion - #region FlowLogResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FlowLogResource GetFlowLogResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FlowLogResource.ValidateResourceId(id); - return new FlowLogResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetFlowLogResource(id); } - #endregion - #region PrivateEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateEndpointResource GetPrivateEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateEndpointResource.ValidateResourceId(id); - return new PrivateEndpointResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetPrivateEndpointResource(id); } - #endregion - #region PrivateDnsZoneGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsZoneGroupResource GetPrivateDnsZoneGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsZoneGroupResource.ValidateResourceId(id); - return new PrivateDnsZoneGroupResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetPrivateDnsZoneGroupResource(id); } - #endregion - #region PrivateLinkServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateLinkServiceResource GetPrivateLinkServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateLinkServiceResource.ValidateResourceId(id); - return new PrivateLinkServiceResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetPrivateLinkServiceResource(id); } - #endregion - #region NetworkPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkPrivateEndpointConnectionResource GetNetworkPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkPrivateEndpointConnectionResource.ValidateResourceId(id); - return new NetworkPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkPrivateEndpointConnectionResource(id); } - #endregion - #region PublicIPAddressResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PublicIPAddressResource GetPublicIPAddressResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PublicIPAddressResource.ValidateResourceId(id); - return new PublicIPAddressResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetPublicIPAddressResource(id); } - #endregion - #region PublicIPPrefixResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PublicIPPrefixResource GetPublicIPPrefixResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PublicIPPrefixResource.ValidateResourceId(id); - return new PublicIPPrefixResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetPublicIPPrefixResource(id); } - #endregion - #region RouteFilterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RouteFilterResource GetRouteFilterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RouteFilterResource.ValidateResourceId(id); - return new RouteFilterResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetRouteFilterResource(id); } - #endregion - #region RouteFilterRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RouteFilterRuleResource GetRouteFilterRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RouteFilterRuleResource.ValidateResourceId(id); - return new RouteFilterRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetRouteFilterRuleResource(id); } - #endregion - #region RouteTableResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RouteTableResource GetRouteTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RouteTableResource.ValidateResourceId(id); - return new RouteTableResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetRouteTableResource(id); } - #endregion - #region RouteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RouteResource GetRouteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RouteResource.ValidateResourceId(id); - return new RouteResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetRouteResource(id); } - #endregion - #region SecurityPartnerProviderResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityPartnerProviderResource GetSecurityPartnerProviderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityPartnerProviderResource.ValidateResourceId(id); - return new SecurityPartnerProviderResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetSecurityPartnerProviderResource(id); } - #endregion - #region ServiceEndpointPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceEndpointPolicyResource GetServiceEndpointPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceEndpointPolicyResource.ValidateResourceId(id); - return new ServiceEndpointPolicyResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetServiceEndpointPolicyResource(id); } - #endregion - #region ServiceEndpointPolicyDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceEndpointPolicyDefinitionResource GetServiceEndpointPolicyDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceEndpointPolicyDefinitionResource.ValidateResourceId(id); - return new ServiceEndpointPolicyDefinitionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetServiceEndpointPolicyDefinitionResource(id); } - #endregion - #region VirtualNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkResource GetVirtualNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkResource.ValidateResourceId(id); - return new VirtualNetworkResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualNetworkResource(id); } - #endregion - #region SubnetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubnetResource GetSubnetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubnetResource.ValidateResourceId(id); - return new SubnetResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetSubnetResource(id); } - #endregion - #region VirtualNetworkPeeringResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkPeeringResource GetVirtualNetworkPeeringResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkPeeringResource.ValidateResourceId(id); - return new VirtualNetworkPeeringResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualNetworkPeeringResource(id); } - #endregion - #region VirtualNetworkGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkGatewayResource GetVirtualNetworkGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkGatewayResource.ValidateResourceId(id); - return new VirtualNetworkGatewayResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualNetworkGatewayResource(id); } - #endregion - #region VirtualNetworkGatewayConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkGatewayConnectionResource GetVirtualNetworkGatewayConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkGatewayConnectionResource.ValidateResourceId(id); - return new VirtualNetworkGatewayConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualNetworkGatewayConnectionResource(id); } - #endregion - #region LocalNetworkGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LocalNetworkGatewayResource GetLocalNetworkGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LocalNetworkGatewayResource.ValidateResourceId(id); - return new LocalNetworkGatewayResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetLocalNetworkGatewayResource(id); } - #endregion - #region VirtualNetworkGatewayNatRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkGatewayNatRuleResource GetVirtualNetworkGatewayNatRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkGatewayNatRuleResource.ValidateResourceId(id); - return new VirtualNetworkGatewayNatRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualNetworkGatewayNatRuleResource(id); } - #endregion - #region VirtualNetworkTapResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkTapResource GetVirtualNetworkTapResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkTapResource.ValidateResourceId(id); - return new VirtualNetworkTapResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualNetworkTapResource(id); } - #endregion - #region VirtualRouterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualRouterResource GetVirtualRouterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualRouterResource.ValidateResourceId(id); - return new VirtualRouterResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualRouterResource(id); } - #endregion - #region VirtualRouterPeeringResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualRouterPeeringResource GetVirtualRouterPeeringResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualRouterPeeringResource.ValidateResourceId(id); - return new VirtualRouterPeeringResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualRouterPeeringResource(id); } - #endregion - #region VirtualWanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualWanResource GetVirtualWanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualWanResource.ValidateResourceId(id); - return new VirtualWanResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualWanResource(id); } - #endregion - #region VpnSiteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VpnSiteResource GetVpnSiteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VpnSiteResource.ValidateResourceId(id); - return new VpnSiteResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVpnSiteResource(id); } - #endregion - #region VpnSiteLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VpnSiteLinkResource GetVpnSiteLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VpnSiteLinkResource.ValidateResourceId(id); - return new VpnSiteLinkResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVpnSiteLinkResource(id); } - #endregion - #region VpnServerConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VpnServerConfigurationResource GetVpnServerConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VpnServerConfigurationResource.ValidateResourceId(id); - return new VpnServerConfigurationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVpnServerConfigurationResource(id); } - #endregion - #region VpnServerConfigurationPolicyGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VpnServerConfigurationPolicyGroupResource GetVpnServerConfigurationPolicyGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VpnServerConfigurationPolicyGroupResource.ValidateResourceId(id); - return new VpnServerConfigurationPolicyGroupResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVpnServerConfigurationPolicyGroupResource(id); } - #endregion - #region VirtualHubResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualHubResource GetVirtualHubResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualHubResource.ValidateResourceId(id); - return new VirtualHubResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualHubResource(id); } - #endregion - #region RouteMapResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RouteMapResource GetRouteMapResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RouteMapResource.ValidateResourceId(id); - return new RouteMapResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetRouteMapResource(id); } - #endregion - #region HubVirtualNetworkConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HubVirtualNetworkConnectionResource GetHubVirtualNetworkConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HubVirtualNetworkConnectionResource.ValidateResourceId(id); - return new HubVirtualNetworkConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetHubVirtualNetworkConnectionResource(id); } - #endregion - #region VpnGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VpnGatewayResource GetVpnGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VpnGatewayResource.ValidateResourceId(id); - return new VpnGatewayResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVpnGatewayResource(id); } - #endregion - #region VpnConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VpnConnectionResource GetVpnConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VpnConnectionResource.ValidateResourceId(id); - return new VpnConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVpnConnectionResource(id); } - #endregion - #region VpnSiteLinkConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VpnSiteLinkConnectionResource GetVpnSiteLinkConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VpnSiteLinkConnectionResource.ValidateResourceId(id); - return new VpnSiteLinkConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVpnSiteLinkConnectionResource(id); } - #endregion - #region VpnGatewayNatRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VpnGatewayNatRuleResource GetVpnGatewayNatRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VpnGatewayNatRuleResource.ValidateResourceId(id); - return new VpnGatewayNatRuleResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVpnGatewayNatRuleResource(id); } - #endregion - #region P2SVpnGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static P2SVpnGatewayResource GetP2SVpnGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - P2SVpnGatewayResource.ValidateResourceId(id); - return new P2SVpnGatewayResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetP2SVpnGatewayResource(id); } - #endregion - #region VirtualHubRouteTableV2Resource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualHubRouteTableV2Resource GetVirtualHubRouteTableV2Resource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualHubRouteTableV2Resource.ValidateResourceId(id); - return new VirtualHubRouteTableV2Resource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualHubRouteTableV2Resource(id); } - #endregion - #region ExpressRouteGatewayResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteGatewayResource GetExpressRouteGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteGatewayResource.ValidateResourceId(id); - return new ExpressRouteGatewayResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteGatewayResource(id); } - #endregion - #region ExpressRouteConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExpressRouteConnectionResource GetExpressRouteConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExpressRouteConnectionResource.ValidateResourceId(id); - return new ExpressRouteConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetExpressRouteConnectionResource(id); } - #endregion - #region NetworkVirtualApplianceConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkVirtualApplianceConnectionResource GetNetworkVirtualApplianceConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkVirtualApplianceConnectionResource.ValidateResourceId(id); - return new NetworkVirtualApplianceConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetNetworkVirtualApplianceConnectionResource(id); } - #endregion - #region BgpConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BgpConnectionResource GetBgpConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BgpConnectionResource.ValidateResourceId(id); - return new BgpConnectionResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetBgpConnectionResource(id); } - #endregion - #region HubIPConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HubIPConfigurationResource GetHubIPConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HubIPConfigurationResource.ValidateResourceId(id); - return new HubIPConfigurationResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetHubIPConfigurationResource(id); } - #endregion - #region HubRouteTableResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HubRouteTableResource GetHubRouteTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HubRouteTableResource.ValidateResourceId(id); - return new HubRouteTableResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetHubRouteTableResource(id); } - #endregion - #region RoutingIntentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RoutingIntentResource GetRoutingIntentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RoutingIntentResource.ValidateResourceId(id); - return new RoutingIntentResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetRoutingIntentResource(id); } - #endregion - #region WebApplicationFirewallPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebApplicationFirewallPolicyResource GetWebApplicationFirewallPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebApplicationFirewallPolicyResource.ValidateResourceId(id); - return new WebApplicationFirewallPolicyResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetWebApplicationFirewallPolicyResource(id); } - #endregion - #region VirtualMachineScaleSetNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineScaleSetNetworkResource GetVirtualMachineScaleSetNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineScaleSetNetworkResource.ValidateResourceId(id); - return new VirtualMachineScaleSetNetworkResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualMachineScaleSetNetworkResource(id); } - #endregion - #region VirtualMachineScaleSetVmNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualMachineScaleSetVmNetworkResource GetVirtualMachineScaleSetVmNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualMachineScaleSetVmNetworkResource.ValidateResourceId(id); - return new VirtualMachineScaleSetVmNetworkResource(client, id); - } - ); + return GetMockableNetworkArmClient(client).GetVirtualMachineScaleSetVmNetworkResource(id); } - #endregion - /// Gets a collection of ManagementGroupNetworkManagerConnectionResources in the ManagementGroupResource. + /// + /// Gets a collection of ManagementGroupNetworkManagerConnectionResources in the ManagementGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ManagementGroupNetworkManagerConnectionResources and their operations over a ManagementGroupNetworkManagerConnectionResource. public static ManagementGroupNetworkManagerConnectionCollection GetManagementGroupNetworkManagerConnections(this ManagementGroupResource managementGroupResource) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetManagementGroupNetworkManagerConnections(); + return GetMockableNetworkManagementGroupResource(managementGroupResource).GetManagementGroupNetworkManagerConnections(); } /// @@ -2139,16 +1795,20 @@ public static ManagementGroupNetworkManagerConnectionCollection GetManagementGro /// ManagementGroupNetworkManagerConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name for the network manager connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagementGroupNetworkManagerConnectionAsync(this ManagementGroupResource managementGroupResource, string networkManagerConnectionName, CancellationToken cancellationToken = default) { - return await managementGroupResource.GetManagementGroupNetworkManagerConnections().GetAsync(networkManagerConnectionName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkManagementGroupResource(managementGroupResource).GetManagementGroupNetworkManagerConnectionAsync(networkManagerConnectionName, cancellationToken).ConfigureAwait(false); } /// @@ -2163,24 +1823,34 @@ public static async TaskManagementGroupNetworkManagerConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name for the network manager connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagementGroupNetworkManagerConnection(this ManagementGroupResource managementGroupResource, string networkManagerConnectionName, CancellationToken cancellationToken = default) { - return managementGroupResource.GetManagementGroupNetworkManagerConnections().Get(networkManagerConnectionName, cancellationToken); + return GetMockableNetworkManagementGroupResource(managementGroupResource).GetManagementGroupNetworkManagerConnection(networkManagerConnectionName, cancellationToken); } - /// Gets a collection of ApplicationGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of ApplicationGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ApplicationGatewayResources and their operations over a ApplicationGatewayResource. public static ApplicationGatewayCollection GetApplicationGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplicationGateways(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetApplicationGateways(); } /// @@ -2195,16 +1865,20 @@ public static ApplicationGatewayCollection GetApplicationGateways(this ResourceG /// ApplicationGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the application gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetApplicationGatewayAsync(this ResourceGroupResource resourceGroupResource, string applicationGatewayName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetApplicationGateways().GetAsync(applicationGatewayName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetApplicationGatewayAsync(applicationGatewayName, cancellationToken).ConfigureAwait(false); } /// @@ -2219,24 +1893,34 @@ public static async Task> GetApplicationGat /// ApplicationGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the application gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetApplicationGateway(this ResourceGroupResource resourceGroupResource, string applicationGatewayName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetApplicationGateways().Get(applicationGatewayName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetApplicationGateway(applicationGatewayName, cancellationToken); } - /// Gets a collection of ApplicationSecurityGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of ApplicationSecurityGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ApplicationSecurityGroupResources and their operations over a ApplicationSecurityGroupResource. public static ApplicationSecurityGroupCollection GetApplicationSecurityGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplicationSecurityGroups(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetApplicationSecurityGroups(); } /// @@ -2251,16 +1935,20 @@ public static ApplicationSecurityGroupCollection GetApplicationSecurityGroups(th /// ApplicationSecurityGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the application security group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetApplicationSecurityGroupAsync(this ResourceGroupResource resourceGroupResource, string applicationSecurityGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetApplicationSecurityGroups().GetAsync(applicationSecurityGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetApplicationSecurityGroupAsync(applicationSecurityGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -2275,24 +1963,34 @@ public static async Task> GetApplicat /// ApplicationSecurityGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the application security group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetApplicationSecurityGroup(this ResourceGroupResource resourceGroupResource, string applicationSecurityGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetApplicationSecurityGroups().Get(applicationSecurityGroupName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetApplicationSecurityGroup(applicationSecurityGroupName, cancellationToken); } - /// Gets a collection of AzureFirewallResources in the ResourceGroupResource. + /// + /// Gets a collection of AzureFirewallResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AzureFirewallResources and their operations over a AzureFirewallResource. public static AzureFirewallCollection GetAzureFirewalls(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAzureFirewalls(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAzureFirewalls(); } /// @@ -2307,16 +2005,20 @@ public static AzureFirewallCollection GetAzureFirewalls(this ResourceGroupResour /// AzureFirewalls_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Firewall. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAzureFirewallAsync(this ResourceGroupResource resourceGroupResource, string azureFirewallName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAzureFirewalls().GetAsync(azureFirewallName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAzureFirewallAsync(azureFirewallName, cancellationToken).ConfigureAwait(false); } /// @@ -2331,24 +2033,34 @@ public static async Task> GetAzureFirewallAsync( /// AzureFirewalls_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Firewall. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAzureFirewall(this ResourceGroupResource resourceGroupResource, string azureFirewallName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAzureFirewalls().Get(azureFirewallName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAzureFirewall(azureFirewallName, cancellationToken); } - /// Gets a collection of BastionHostResources in the ResourceGroupResource. + /// + /// Gets a collection of BastionHostResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BastionHostResources and their operations over a BastionHostResource. public static BastionHostCollection GetBastionHosts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBastionHosts(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetBastionHosts(); } /// @@ -2363,16 +2075,20 @@ public static BastionHostCollection GetBastionHosts(this ResourceGroupResource r /// BastionHosts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Bastion Host. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBastionHostAsync(this ResourceGroupResource resourceGroupResource, string bastionHostName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBastionHosts().GetAsync(bastionHostName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetBastionHostAsync(bastionHostName, cancellationToken).ConfigureAwait(false); } /// @@ -2387,29 +2103,37 @@ public static async Task> GetBastionHostAsync(this /// BastionHosts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Bastion Host. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBastionHost(this ResourceGroupResource resourceGroupResource, string bastionHostName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBastionHosts().Get(bastionHostName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetBastionHost(bastionHostName, cancellationToken); } - /// Gets a collection of CloudServiceSwapResources in the ResourceGroupResource. + /// + /// Gets a collection of CloudServiceSwapResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the cloud service. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of CloudServiceSwapResources and their operations over a CloudServiceSwapResource. public static CloudServiceSwapCollection GetCloudServiceSwaps(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCloudServiceSwaps(resourceName); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetCloudServiceSwaps(resourceName); } /// @@ -2424,16 +2148,20 @@ public static CloudServiceSwapCollection GetCloudServiceSwaps(this ResourceGroup /// VipSwap_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cloud service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCloudServiceSwapAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCloudServiceSwaps(resourceName).GetAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetCloudServiceSwapAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -2448,24 +2176,34 @@ public static async Task> GetCloudServiceSwap /// VipSwap_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cloud service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCloudServiceSwap(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCloudServiceSwaps(resourceName).Get(cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetCloudServiceSwap(resourceName, cancellationToken); } - /// Gets a collection of CustomIPPrefixResources in the ResourceGroupResource. + /// + /// Gets a collection of CustomIPPrefixResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CustomIPPrefixResources and their operations over a CustomIPPrefixResource. public static CustomIPPrefixCollection GetCustomIPPrefixes(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCustomIPPrefixes(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetCustomIPPrefixes(); } /// @@ -2480,17 +2218,21 @@ public static CustomIPPrefixCollection GetCustomIPPrefixes(this ResourceGroupRes /// CustomIPPrefixes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the custom IP prefix. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCustomIPPrefixAsync(this ResourceGroupResource resourceGroupResource, string customIPPrefixName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCustomIPPrefixes().GetAsync(customIPPrefixName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetCustomIPPrefixAsync(customIPPrefixName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -2505,25 +2247,35 @@ public static async Task> GetCustomIPPrefixAsyn /// CustomIPPrefixes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the custom IP prefix. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCustomIPPrefix(this ResourceGroupResource resourceGroupResource, string customIPPrefixName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCustomIPPrefixes().Get(customIPPrefixName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetCustomIPPrefix(customIPPrefixName, expand, cancellationToken); } - /// Gets a collection of DdosCustomPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of DdosCustomPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DdosCustomPolicyResources and their operations over a DdosCustomPolicyResource. public static DdosCustomPolicyCollection GetDdosCustomPolicies(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDdosCustomPolicies(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDdosCustomPolicies(); } /// @@ -2538,16 +2290,20 @@ public static DdosCustomPolicyCollection GetDdosCustomPolicies(this ResourceGrou /// DdosCustomPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DDoS custom policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDdosCustomPolicyAsync(this ResourceGroupResource resourceGroupResource, string ddosCustomPolicyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDdosCustomPolicies().GetAsync(ddosCustomPolicyName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDdosCustomPolicyAsync(ddosCustomPolicyName, cancellationToken).ConfigureAwait(false); } /// @@ -2562,24 +2318,34 @@ public static async Task> GetDdosCustomPolicy /// DdosCustomPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DDoS custom policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDdosCustomPolicy(this ResourceGroupResource resourceGroupResource, string ddosCustomPolicyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDdosCustomPolicies().Get(ddosCustomPolicyName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDdosCustomPolicy(ddosCustomPolicyName, cancellationToken); } - /// Gets a collection of DdosProtectionPlanResources in the ResourceGroupResource. + /// + /// Gets a collection of DdosProtectionPlanResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DdosProtectionPlanResources and their operations over a DdosProtectionPlanResource. public static DdosProtectionPlanCollection GetDdosProtectionPlans(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDdosProtectionPlans(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDdosProtectionPlans(); } /// @@ -2594,16 +2360,20 @@ public static DdosProtectionPlanCollection GetDdosProtectionPlans(this ResourceG /// DdosProtectionPlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DDoS protection plan. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDdosProtectionPlanAsync(this ResourceGroupResource resourceGroupResource, string ddosProtectionPlanName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDdosProtectionPlans().GetAsync(ddosProtectionPlanName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDdosProtectionPlanAsync(ddosProtectionPlanName, cancellationToken).ConfigureAwait(false); } /// @@ -2618,24 +2388,34 @@ public static async Task> GetDdosProtection /// DdosProtectionPlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the DDoS protection plan. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDdosProtectionPlan(this ResourceGroupResource resourceGroupResource, string ddosProtectionPlanName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDdosProtectionPlans().Get(ddosProtectionPlanName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDdosProtectionPlan(ddosProtectionPlanName, cancellationToken); } - /// Gets a collection of DscpConfigurationResources in the ResourceGroupResource. + /// + /// Gets a collection of DscpConfigurationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DscpConfigurationResources and their operations over a DscpConfigurationResource. public static DscpConfigurationCollection GetDscpConfigurations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDscpConfigurations(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDscpConfigurations(); } /// @@ -2650,16 +2430,20 @@ public static DscpConfigurationCollection GetDscpConfigurations(this ResourceGro /// DscpConfiguration_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDscpConfigurationAsync(this ResourceGroupResource resourceGroupResource, string dscpConfigurationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDscpConfigurations().GetAsync(dscpConfigurationName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDscpConfigurationAsync(dscpConfigurationName, cancellationToken).ConfigureAwait(false); } /// @@ -2674,24 +2458,34 @@ public static async Task> GetDscpConfigurati /// DscpConfiguration_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDscpConfiguration(this ResourceGroupResource resourceGroupResource, string dscpConfigurationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDscpConfigurations().Get(dscpConfigurationName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetDscpConfiguration(dscpConfigurationName, cancellationToken); } - /// Gets a collection of ExpressRouteCircuitResources in the ResourceGroupResource. + /// + /// Gets a collection of ExpressRouteCircuitResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ExpressRouteCircuitResources and their operations over a ExpressRouteCircuitResource. public static ExpressRouteCircuitCollection GetExpressRouteCircuits(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetExpressRouteCircuits(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteCircuits(); } /// @@ -2706,16 +2500,20 @@ public static ExpressRouteCircuitCollection GetExpressRouteCircuits(this Resourc /// ExpressRouteCircuits_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of express route circuit. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetExpressRouteCircuitAsync(this ResourceGroupResource resourceGroupResource, string circuitName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetExpressRouteCircuits().GetAsync(circuitName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteCircuitAsync(circuitName, cancellationToken).ConfigureAwait(false); } /// @@ -2730,24 +2528,34 @@ public static async Task> GetExpressRouteC /// ExpressRouteCircuits_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of express route circuit. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetExpressRouteCircuit(this ResourceGroupResource resourceGroupResource, string circuitName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetExpressRouteCircuits().Get(circuitName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteCircuit(circuitName, cancellationToken); } - /// Gets a collection of ExpressRouteCrossConnectionResources in the ResourceGroupResource. + /// + /// Gets a collection of ExpressRouteCrossConnectionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ExpressRouteCrossConnectionResources and their operations over a ExpressRouteCrossConnectionResource. public static ExpressRouteCrossConnectionCollection GetExpressRouteCrossConnections(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetExpressRouteCrossConnections(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteCrossConnections(); } /// @@ -2762,16 +2570,20 @@ public static ExpressRouteCrossConnectionCollection GetExpressRouteCrossConnecti /// ExpressRouteCrossConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the ExpressRouteCrossConnection (service key of the circuit). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetExpressRouteCrossConnectionAsync(this ResourceGroupResource resourceGroupResource, string crossConnectionName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetExpressRouteCrossConnections().GetAsync(crossConnectionName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteCrossConnectionAsync(crossConnectionName, cancellationToken).ConfigureAwait(false); } /// @@ -2786,24 +2598,34 @@ public static async Task> GetExpre /// ExpressRouteCrossConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the ExpressRouteCrossConnection (service key of the circuit). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetExpressRouteCrossConnection(this ResourceGroupResource resourceGroupResource, string crossConnectionName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetExpressRouteCrossConnections().Get(crossConnectionName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteCrossConnection(crossConnectionName, cancellationToken); } - /// Gets a collection of ExpressRoutePortResources in the ResourceGroupResource. + /// + /// Gets a collection of ExpressRoutePortResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ExpressRoutePortResources and their operations over a ExpressRoutePortResource. public static ExpressRoutePortCollection GetExpressRoutePorts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetExpressRoutePorts(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRoutePorts(); } /// @@ -2818,16 +2640,20 @@ public static ExpressRoutePortCollection GetExpressRoutePorts(this ResourceGroup /// ExpressRoutePorts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of ExpressRoutePort. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetExpressRoutePortAsync(this ResourceGroupResource resourceGroupResource, string expressRoutePortName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetExpressRoutePorts().GetAsync(expressRoutePortName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRoutePortAsync(expressRoutePortName, cancellationToken).ConfigureAwait(false); } /// @@ -2842,24 +2668,34 @@ public static async Task> GetExpressRoutePort /// ExpressRoutePorts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of ExpressRoutePort. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetExpressRoutePort(this ResourceGroupResource resourceGroupResource, string expressRoutePortName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetExpressRoutePorts().Get(expressRoutePortName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRoutePort(expressRoutePortName, cancellationToken); } - /// Gets a collection of FirewallPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of FirewallPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of FirewallPolicyResources and their operations over a FirewallPolicyResource. public static FirewallPolicyCollection GetFirewallPolicies(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetFirewallPolicies(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetFirewallPolicies(); } /// @@ -2874,17 +2710,21 @@ public static FirewallPolicyCollection GetFirewallPolicies(this ResourceGroupRes /// FirewallPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Firewall Policy. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetFirewallPolicyAsync(this ResourceGroupResource resourceGroupResource, string firewallPolicyName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetFirewallPolicies().GetAsync(firewallPolicyName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetFirewallPolicyAsync(firewallPolicyName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -2899,25 +2739,35 @@ public static async Task> GetFirewallPolicyAsyn /// FirewallPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Firewall Policy. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetFirewallPolicy(this ResourceGroupResource resourceGroupResource, string firewallPolicyName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetFirewallPolicies().Get(firewallPolicyName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetFirewallPolicy(firewallPolicyName, expand, cancellationToken); } - /// Gets a collection of IPAllocationResources in the ResourceGroupResource. + /// + /// Gets a collection of IPAllocationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of IPAllocationResources and their operations over a IPAllocationResource. public static IPAllocationCollection GetIPAllocations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetIPAllocations(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetIPAllocations(); } /// @@ -2932,17 +2782,21 @@ public static IPAllocationCollection GetIPAllocations(this ResourceGroupResource /// IpAllocations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the IpAllocation. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetIPAllocationAsync(this ResourceGroupResource resourceGroupResource, string ipAllocationName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetIPAllocations().GetAsync(ipAllocationName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetIPAllocationAsync(ipAllocationName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -2957,25 +2811,35 @@ public static async Task> GetIPAllocationAsync(th /// IpAllocations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the IpAllocation. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetIPAllocation(this ResourceGroupResource resourceGroupResource, string ipAllocationName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetIPAllocations().Get(ipAllocationName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetIPAllocation(ipAllocationName, expand, cancellationToken); } - /// Gets a collection of IPGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of IPGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of IPGroupResources and their operations over a IPGroupResource. public static IPGroupCollection GetIPGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetIPGroups(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetIPGroups(); } /// @@ -2990,17 +2854,21 @@ public static IPGroupCollection GetIPGroups(this ResourceGroupResource resourceG /// IpGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the ipGroups. /// Expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetIPGroupAsync(this ResourceGroupResource resourceGroupResource, string ipGroupsName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetIPGroups().GetAsync(ipGroupsName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetIPGroupAsync(ipGroupsName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3015,25 +2883,35 @@ public static async Task> GetIPGroupAsync(this Resourc /// IpGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the ipGroups. /// Expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetIPGroup(this ResourceGroupResource resourceGroupResource, string ipGroupsName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetIPGroups().Get(ipGroupsName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetIPGroup(ipGroupsName, expand, cancellationToken); } - /// Gets a collection of LoadBalancerResources in the ResourceGroupResource. + /// + /// Gets a collection of LoadBalancerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LoadBalancerResources and their operations over a LoadBalancerResource. public static LoadBalancerCollection GetLoadBalancers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLoadBalancers(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetLoadBalancers(); } /// @@ -3048,17 +2926,21 @@ public static LoadBalancerCollection GetLoadBalancers(this ResourceGroupResource /// LoadBalancers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the load balancer. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLoadBalancerAsync(this ResourceGroupResource resourceGroupResource, string loadBalancerName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLoadBalancers().GetAsync(loadBalancerName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetLoadBalancerAsync(loadBalancerName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3073,25 +2955,35 @@ public static async Task> GetLoadBalancerAsync(th /// LoadBalancers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the load balancer. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLoadBalancer(this ResourceGroupResource resourceGroupResource, string loadBalancerName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLoadBalancers().Get(loadBalancerName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetLoadBalancer(loadBalancerName, expand, cancellationToken); } - /// Gets a collection of NatGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of NatGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NatGatewayResources and their operations over a NatGatewayResource. public static NatGatewayCollection GetNatGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNatGateways(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNatGateways(); } /// @@ -3106,17 +2998,21 @@ public static NatGatewayCollection GetNatGateways(this ResourceGroupResource res /// NatGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the nat gateway. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNatGatewayAsync(this ResourceGroupResource resourceGroupResource, string natGatewayName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNatGateways().GetAsync(natGatewayName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNatGatewayAsync(natGatewayName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3131,25 +3027,35 @@ public static async Task> GetNatGatewayAsync(this R /// NatGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the nat gateway. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNatGateway(this ResourceGroupResource resourceGroupResource, string natGatewayName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNatGateways().Get(natGatewayName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNatGateway(natGatewayName, expand, cancellationToken); } - /// Gets a collection of NetworkInterfaceResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkInterfaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkInterfaceResources and their operations over a NetworkInterfaceResource. public static NetworkInterfaceCollection GetNetworkInterfaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkInterfaces(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkInterfaces(); } /// @@ -3164,17 +3070,21 @@ public static NetworkInterfaceCollection GetNetworkInterfaces(this ResourceGroup /// NetworkInterfaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the network interface. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkInterfaceAsync(this ResourceGroupResource resourceGroupResource, string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkInterfaces().GetAsync(networkInterfaceName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkInterfaceAsync(networkInterfaceName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3189,25 +3099,35 @@ public static async Task> GetNetworkInterface /// NetworkInterfaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the network interface. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkInterface(this ResourceGroupResource resourceGroupResource, string networkInterfaceName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkInterfaces().Get(networkInterfaceName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkInterface(networkInterfaceName, expand, cancellationToken); } - /// Gets a collection of NetworkManagerResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkManagerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkManagerResources and their operations over a NetworkManagerResource. public static NetworkManagerCollection GetNetworkManagers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkManagers(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkManagers(); } /// @@ -3222,16 +3142,20 @@ public static NetworkManagerCollection GetNetworkManagers(this ResourceGroupReso /// NetworkManagers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the network manager. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkManagerAsync(this ResourceGroupResource resourceGroupResource, string networkManagerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkManagers().GetAsync(networkManagerName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkManagerAsync(networkManagerName, cancellationToken).ConfigureAwait(false); } /// @@ -3246,24 +3170,34 @@ public static async Task> GetNetworkManagerAsyn /// NetworkManagers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the network manager. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkManager(this ResourceGroupResource resourceGroupResource, string networkManagerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkManagers().Get(networkManagerName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkManager(networkManagerName, cancellationToken); } - /// Gets a collection of NetworkProfileResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkProfileResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkProfileResources and their operations over a NetworkProfileResource. public static NetworkProfileCollection GetNetworkProfiles(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkProfiles(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkProfiles(); } /// @@ -3278,17 +3212,21 @@ public static NetworkProfileCollection GetNetworkProfiles(this ResourceGroupReso /// NetworkProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the public IP prefix. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkProfileAsync(this ResourceGroupResource resourceGroupResource, string networkProfileName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkProfiles().GetAsync(networkProfileName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkProfileAsync(networkProfileName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3303,25 +3241,35 @@ public static async Task> GetNetworkProfileAsyn /// NetworkProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the public IP prefix. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkProfile(this ResourceGroupResource resourceGroupResource, string networkProfileName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkProfiles().Get(networkProfileName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkProfile(networkProfileName, expand, cancellationToken); } - /// Gets a collection of NetworkSecurityGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkSecurityGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkSecurityGroupResources and their operations over a NetworkSecurityGroupResource. public static NetworkSecurityGroupCollection GetNetworkSecurityGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkSecurityGroups(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkSecurityGroups(); } /// @@ -3336,17 +3284,21 @@ public static NetworkSecurityGroupCollection GetNetworkSecurityGroups(this Resou /// NetworkSecurityGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the network security group. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkSecurityGroupAsync(this ResourceGroupResource resourceGroupResource, string networkSecurityGroupName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkSecurityGroups().GetAsync(networkSecurityGroupName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkSecurityGroupAsync(networkSecurityGroupName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3361,25 +3313,35 @@ public static async Task> GetNetworkSecur /// NetworkSecurityGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the network security group. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkSecurityGroup(this ResourceGroupResource resourceGroupResource, string networkSecurityGroupName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkSecurityGroups().Get(networkSecurityGroupName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkSecurityGroup(networkSecurityGroupName, expand, cancellationToken); } - /// Gets a collection of NetworkVirtualApplianceResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkVirtualApplianceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkVirtualApplianceResources and their operations over a NetworkVirtualApplianceResource. public static NetworkVirtualApplianceCollection GetNetworkVirtualAppliances(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkVirtualAppliances(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkVirtualAppliances(); } /// @@ -3394,17 +3356,21 @@ public static NetworkVirtualApplianceCollection GetNetworkVirtualAppliances(this /// NetworkVirtualAppliances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Network Virtual Appliance. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkVirtualApplianceAsync(this ResourceGroupResource resourceGroupResource, string networkVirtualApplianceName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkVirtualAppliances().GetAsync(networkVirtualApplianceName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkVirtualApplianceAsync(networkVirtualApplianceName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3419,25 +3385,35 @@ public static async Task> GetNetworkVi /// NetworkVirtualAppliances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Network Virtual Appliance. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkVirtualAppliance(this ResourceGroupResource resourceGroupResource, string networkVirtualApplianceName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkVirtualAppliances().Get(networkVirtualApplianceName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkVirtualAppliance(networkVirtualApplianceName, expand, cancellationToken); } - /// Gets a collection of NetworkWatcherResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkWatcherResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkWatcherResources and their operations over a NetworkWatcherResource. public static NetworkWatcherCollection GetNetworkWatchers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkWatchers(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkWatchers(); } /// @@ -3452,16 +3428,20 @@ public static NetworkWatcherCollection GetNetworkWatchers(this ResourceGroupReso /// NetworkWatchers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the network watcher. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkWatcherAsync(this ResourceGroupResource resourceGroupResource, string networkWatcherName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkWatchers().GetAsync(networkWatcherName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkWatcherAsync(networkWatcherName, cancellationToken).ConfigureAwait(false); } /// @@ -3476,24 +3456,34 @@ public static async Task> GetNetworkWatcherAsyn /// NetworkWatchers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the network watcher. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkWatcher(this ResourceGroupResource resourceGroupResource, string networkWatcherName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkWatchers().Get(networkWatcherName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetNetworkWatcher(networkWatcherName, cancellationToken); } - /// Gets a collection of PrivateEndpointResources in the ResourceGroupResource. + /// + /// Gets a collection of PrivateEndpointResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PrivateEndpointResources and their operations over a PrivateEndpointResource. public static PrivateEndpointCollection GetPrivateEndpoints(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPrivateEndpoints(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPrivateEndpoints(); } /// @@ -3508,17 +3498,21 @@ public static PrivateEndpointCollection GetPrivateEndpoints(this ResourceGroupRe /// PrivateEndpoints_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the private endpoint. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPrivateEndpointAsync(this ResourceGroupResource resourceGroupResource, string privateEndpointName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPrivateEndpoints().GetAsync(privateEndpointName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPrivateEndpointAsync(privateEndpointName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3533,25 +3527,35 @@ public static async Task> GetPrivateEndpointAs /// PrivateEndpoints_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the private endpoint. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPrivateEndpoint(this ResourceGroupResource resourceGroupResource, string privateEndpointName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPrivateEndpoints().Get(privateEndpointName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPrivateEndpoint(privateEndpointName, expand, cancellationToken); } - /// Gets a collection of PrivateLinkServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of PrivateLinkServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PrivateLinkServiceResources and their operations over a PrivateLinkServiceResource. public static PrivateLinkServiceCollection GetPrivateLinkServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPrivateLinkServices(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPrivateLinkServices(); } /// @@ -3566,17 +3570,21 @@ public static PrivateLinkServiceCollection GetPrivateLinkServices(this ResourceG /// PrivateLinkServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the private link service. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPrivateLinkServiceAsync(this ResourceGroupResource resourceGroupResource, string serviceName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPrivateLinkServices().GetAsync(serviceName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPrivateLinkServiceAsync(serviceName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3591,25 +3599,35 @@ public static async Task> GetPrivateLinkSer /// PrivateLinkServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the private link service. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPrivateLinkService(this ResourceGroupResource resourceGroupResource, string serviceName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPrivateLinkServices().Get(serviceName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPrivateLinkService(serviceName, expand, cancellationToken); } - /// Gets a collection of PublicIPAddressResources in the ResourceGroupResource. + /// + /// Gets a collection of PublicIPAddressResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PublicIPAddressResources and their operations over a PublicIPAddressResource. public static PublicIPAddressCollection GetPublicIPAddresses(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPublicIPAddresses(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPublicIPAddresses(); } /// @@ -3624,17 +3642,21 @@ public static PublicIPAddressCollection GetPublicIPAddresses(this ResourceGroupR /// PublicIPAddresses_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the public IP address. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPublicIPAddressAsync(this ResourceGroupResource resourceGroupResource, string publicIPAddressName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPublicIPAddresses().GetAsync(publicIPAddressName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPublicIPAddressAsync(publicIPAddressName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3649,25 +3671,35 @@ public static async Task> GetPublicIPAddressAs /// PublicIPAddresses_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the public IP address. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPublicIPAddress(this ResourceGroupResource resourceGroupResource, string publicIPAddressName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPublicIPAddresses().Get(publicIPAddressName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPublicIPAddress(publicIPAddressName, expand, cancellationToken); } - /// Gets a collection of PublicIPPrefixResources in the ResourceGroupResource. + /// + /// Gets a collection of PublicIPPrefixResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PublicIPPrefixResources and their operations over a PublicIPPrefixResource. public static PublicIPPrefixCollection GetPublicIPPrefixes(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPublicIPPrefixes(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPublicIPPrefixes(); } /// @@ -3682,17 +3714,21 @@ public static PublicIPPrefixCollection GetPublicIPPrefixes(this ResourceGroupRes /// PublicIPPrefixes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the public IP prefix. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPublicIPPrefixAsync(this ResourceGroupResource resourceGroupResource, string publicIPPrefixName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPublicIPPrefixes().GetAsync(publicIPPrefixName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPublicIPPrefixAsync(publicIPPrefixName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3707,25 +3743,35 @@ public static async Task> GetPublicIPPrefixAsyn /// PublicIPPrefixes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the public IP prefix. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPublicIPPrefix(this ResourceGroupResource resourceGroupResource, string publicIPPrefixName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPublicIPPrefixes().Get(publicIPPrefixName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetPublicIPPrefix(publicIPPrefixName, expand, cancellationToken); } - /// Gets a collection of RouteFilterResources in the ResourceGroupResource. + /// + /// Gets a collection of RouteFilterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RouteFilterResources and their operations over a RouteFilterResource. public static RouteFilterCollection GetRouteFilters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRouteFilters(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetRouteFilters(); } /// @@ -3740,17 +3786,21 @@ public static RouteFilterCollection GetRouteFilters(this ResourceGroupResource r /// RouteFilters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the route filter. /// Expands referenced express route bgp peering resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRouteFilterAsync(this ResourceGroupResource resourceGroupResource, string routeFilterName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetRouteFilters().GetAsync(routeFilterName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetRouteFilterAsync(routeFilterName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3765,25 +3815,35 @@ public static async Task> GetRouteFilterAsync(this /// RouteFilters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the route filter. /// Expands referenced express route bgp peering resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRouteFilter(this ResourceGroupResource resourceGroupResource, string routeFilterName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetRouteFilters().Get(routeFilterName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetRouteFilter(routeFilterName, expand, cancellationToken); } - /// Gets a collection of RouteTableResources in the ResourceGroupResource. + /// + /// Gets a collection of RouteTableResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RouteTableResources and their operations over a RouteTableResource. public static RouteTableCollection GetRouteTables(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRouteTables(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetRouteTables(); } /// @@ -3798,17 +3858,21 @@ public static RouteTableCollection GetRouteTables(this ResourceGroupResource res /// RouteTables_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the route table. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRouteTableAsync(this ResourceGroupResource resourceGroupResource, string routeTableName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetRouteTables().GetAsync(routeTableName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetRouteTableAsync(routeTableName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3823,25 +3887,35 @@ public static async Task> GetRouteTableAsync(this R /// RouteTables_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the route table. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRouteTable(this ResourceGroupResource resourceGroupResource, string routeTableName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetRouteTables().Get(routeTableName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetRouteTable(routeTableName, expand, cancellationToken); } - /// Gets a collection of SecurityPartnerProviderResources in the ResourceGroupResource. + /// + /// Gets a collection of SecurityPartnerProviderResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityPartnerProviderResources and their operations over a SecurityPartnerProviderResource. public static SecurityPartnerProviderCollection GetSecurityPartnerProviders(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSecurityPartnerProviders(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetSecurityPartnerProviders(); } /// @@ -3856,16 +3930,20 @@ public static SecurityPartnerProviderCollection GetSecurityPartnerProviders(this /// SecurityPartnerProviders_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Security Partner Provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecurityPartnerProviderAsync(this ResourceGroupResource resourceGroupResource, string securityPartnerProviderName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSecurityPartnerProviders().GetAsync(securityPartnerProviderName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetSecurityPartnerProviderAsync(securityPartnerProviderName, cancellationToken).ConfigureAwait(false); } /// @@ -3880,24 +3958,34 @@ public static async Task> GetSecurityP /// SecurityPartnerProviders_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Security Partner Provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecurityPartnerProvider(this ResourceGroupResource resourceGroupResource, string securityPartnerProviderName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSecurityPartnerProviders().Get(securityPartnerProviderName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetSecurityPartnerProvider(securityPartnerProviderName, cancellationToken); } - /// Gets a collection of ServiceEndpointPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of ServiceEndpointPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ServiceEndpointPolicyResources and their operations over a ServiceEndpointPolicyResource. public static ServiceEndpointPolicyCollection GetServiceEndpointPolicies(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetServiceEndpointPolicies(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetServiceEndpointPolicies(); } /// @@ -3912,17 +4000,21 @@ public static ServiceEndpointPolicyCollection GetServiceEndpointPolicies(this Re /// ServiceEndpointPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the service endpoint policy. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetServiceEndpointPolicyAsync(this ResourceGroupResource resourceGroupResource, string serviceEndpointPolicyName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetServiceEndpointPolicies().GetAsync(serviceEndpointPolicyName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetServiceEndpointPolicyAsync(serviceEndpointPolicyName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3937,25 +4029,35 @@ public static async Task> GetServiceEndp /// ServiceEndpointPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the service endpoint policy. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetServiceEndpointPolicy(this ResourceGroupResource resourceGroupResource, string serviceEndpointPolicyName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetServiceEndpointPolicies().Get(serviceEndpointPolicyName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetServiceEndpointPolicy(serviceEndpointPolicyName, expand, cancellationToken); } - /// Gets a collection of VirtualNetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualNetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualNetworkResources and their operations over a VirtualNetworkResource. public static VirtualNetworkCollection GetVirtualNetworks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualNetworks(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworks(); } /// @@ -3970,17 +4072,21 @@ public static VirtualNetworkCollection GetVirtualNetworks(this ResourceGroupReso /// VirtualNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual network. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualNetworkAsync(this ResourceGroupResource resourceGroupResource, string virtualNetworkName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualNetworks().GetAsync(virtualNetworkName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkAsync(virtualNetworkName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -3995,25 +4101,35 @@ public static async Task> GetVirtualNetworkAsyn /// VirtualNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual network. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualNetwork(this ResourceGroupResource resourceGroupResource, string virtualNetworkName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualNetworks().Get(virtualNetworkName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetwork(virtualNetworkName, expand, cancellationToken); } - /// Gets a collection of VirtualNetworkGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualNetworkGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualNetworkGatewayResources and their operations over a VirtualNetworkGatewayResource. public static VirtualNetworkGatewayCollection GetVirtualNetworkGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualNetworkGateways(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkGateways(); } /// @@ -4028,16 +4144,20 @@ public static VirtualNetworkGatewayCollection GetVirtualNetworkGateways(this Res /// VirtualNetworkGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual network gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualNetworkGatewayAsync(this ResourceGroupResource resourceGroupResource, string virtualNetworkGatewayName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualNetworkGateways().GetAsync(virtualNetworkGatewayName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkGatewayAsync(virtualNetworkGatewayName, cancellationToken).ConfigureAwait(false); } /// @@ -4052,24 +4172,34 @@ public static async Task> GetVirtualNetw /// VirtualNetworkGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual network gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualNetworkGateway(this ResourceGroupResource resourceGroupResource, string virtualNetworkGatewayName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualNetworkGateways().Get(virtualNetworkGatewayName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkGateway(virtualNetworkGatewayName, cancellationToken); } - /// Gets a collection of VirtualNetworkGatewayConnectionResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualNetworkGatewayConnectionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualNetworkGatewayConnectionResources and their operations over a VirtualNetworkGatewayConnectionResource. public static VirtualNetworkGatewayConnectionCollection GetVirtualNetworkGatewayConnections(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualNetworkGatewayConnections(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkGatewayConnections(); } /// @@ -4084,16 +4214,20 @@ public static VirtualNetworkGatewayConnectionCollection GetVirtualNetworkGateway /// VirtualNetworkGatewayConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual network gateway connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualNetworkGatewayConnectionAsync(this ResourceGroupResource resourceGroupResource, string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualNetworkGatewayConnections().GetAsync(virtualNetworkGatewayConnectionName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkGatewayConnectionAsync(virtualNetworkGatewayConnectionName, cancellationToken).ConfigureAwait(false); } /// @@ -4108,24 +4242,34 @@ public static async Task> GetV /// VirtualNetworkGatewayConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual network gateway connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualNetworkGatewayConnection(this ResourceGroupResource resourceGroupResource, string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualNetworkGatewayConnections().Get(virtualNetworkGatewayConnectionName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkGatewayConnection(virtualNetworkGatewayConnectionName, cancellationToken); } - /// Gets a collection of LocalNetworkGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of LocalNetworkGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LocalNetworkGatewayResources and their operations over a LocalNetworkGatewayResource. public static LocalNetworkGatewayCollection GetLocalNetworkGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLocalNetworkGateways(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetLocalNetworkGateways(); } /// @@ -4140,16 +4284,20 @@ public static LocalNetworkGatewayCollection GetLocalNetworkGateways(this Resourc /// LocalNetworkGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the local network gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLocalNetworkGatewayAsync(this ResourceGroupResource resourceGroupResource, string localNetworkGatewayName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLocalNetworkGateways().GetAsync(localNetworkGatewayName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetLocalNetworkGatewayAsync(localNetworkGatewayName, cancellationToken).ConfigureAwait(false); } /// @@ -4164,24 +4312,34 @@ public static async Task> GetLocalNetworkG /// LocalNetworkGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the local network gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLocalNetworkGateway(this ResourceGroupResource resourceGroupResource, string localNetworkGatewayName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLocalNetworkGateways().Get(localNetworkGatewayName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetLocalNetworkGateway(localNetworkGatewayName, cancellationToken); } - /// Gets a collection of VirtualNetworkTapResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualNetworkTapResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualNetworkTapResources and their operations over a VirtualNetworkTapResource. public static VirtualNetworkTapCollection GetVirtualNetworkTaps(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualNetworkTaps(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkTaps(); } /// @@ -4196,16 +4354,20 @@ public static VirtualNetworkTapCollection GetVirtualNetworkTaps(this ResourceGro /// VirtualNetworkTaps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of virtual network tap. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualNetworkTapAsync(this ResourceGroupResource resourceGroupResource, string tapName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualNetworkTaps().GetAsync(tapName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkTapAsync(tapName, cancellationToken).ConfigureAwait(false); } /// @@ -4220,24 +4382,34 @@ public static async Task> GetVirtualNetworkT /// VirtualNetworkTaps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of virtual network tap. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualNetworkTap(this ResourceGroupResource resourceGroupResource, string tapName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualNetworkTaps().Get(tapName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualNetworkTap(tapName, cancellationToken); } - /// Gets a collection of VirtualRouterResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualRouterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualRouterResources and their operations over a VirtualRouterResource. public static VirtualRouterCollection GetVirtualRouters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualRouters(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualRouters(); } /// @@ -4252,17 +4424,21 @@ public static VirtualRouterCollection GetVirtualRouters(this ResourceGroupResour /// VirtualRouters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Virtual Router. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualRouterAsync(this ResourceGroupResource resourceGroupResource, string virtualRouterName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualRouters().GetAsync(virtualRouterName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualRouterAsync(virtualRouterName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -4277,25 +4453,35 @@ public static async Task> GetVirtualRouterAsync( /// VirtualRouters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Virtual Router. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualRouter(this ResourceGroupResource resourceGroupResource, string virtualRouterName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualRouters().Get(virtualRouterName, expand, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualRouter(virtualRouterName, expand, cancellationToken); } - /// Gets a collection of VirtualWanResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualWanResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualWanResources and their operations over a VirtualWanResource. public static VirtualWanCollection GetVirtualWans(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualWans(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualWans(); } /// @@ -4310,16 +4496,20 @@ public static VirtualWanCollection GetVirtualWans(this ResourceGroupResource res /// VirtualWans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VirtualWAN being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualWanAsync(this ResourceGroupResource resourceGroupResource, string virtualWanName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualWans().GetAsync(virtualWanName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualWanAsync(virtualWanName, cancellationToken).ConfigureAwait(false); } /// @@ -4334,24 +4524,34 @@ public static async Task> GetVirtualWanAsync(this R /// VirtualWans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VirtualWAN being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualWan(this ResourceGroupResource resourceGroupResource, string virtualWanName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualWans().Get(virtualWanName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualWan(virtualWanName, cancellationToken); } - /// Gets a collection of VpnSiteResources in the ResourceGroupResource. + /// + /// Gets a collection of VpnSiteResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VpnSiteResources and their operations over a VpnSiteResource. public static VpnSiteCollection GetVpnSites(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVpnSites(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnSites(); } /// @@ -4366,16 +4566,20 @@ public static VpnSiteCollection GetVpnSites(this ResourceGroupResource resourceG /// VpnSites_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VpnSite being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVpnSiteAsync(this ResourceGroupResource resourceGroupResource, string vpnSiteName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVpnSites().GetAsync(vpnSiteName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnSiteAsync(vpnSiteName, cancellationToken).ConfigureAwait(false); } /// @@ -4390,24 +4594,34 @@ public static async Task> GetVpnSiteAsync(this Resourc /// VpnSites_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VpnSite being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVpnSite(this ResourceGroupResource resourceGroupResource, string vpnSiteName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVpnSites().Get(vpnSiteName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnSite(vpnSiteName, cancellationToken); } - /// Gets a collection of VpnServerConfigurationResources in the ResourceGroupResource. + /// + /// Gets a collection of VpnServerConfigurationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VpnServerConfigurationResources and their operations over a VpnServerConfigurationResource. public static VpnServerConfigurationCollection GetVpnServerConfigurations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVpnServerConfigurations(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnServerConfigurations(); } /// @@ -4422,16 +4636,20 @@ public static VpnServerConfigurationCollection GetVpnServerConfigurations(this R /// VpnServerConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VpnServerConfiguration being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVpnServerConfigurationAsync(this ResourceGroupResource resourceGroupResource, string vpnServerConfigurationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVpnServerConfigurations().GetAsync(vpnServerConfigurationName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnServerConfigurationAsync(vpnServerConfigurationName, cancellationToken).ConfigureAwait(false); } /// @@ -4446,24 +4664,34 @@ public static async Task> GetVpnServerC /// VpnServerConfigurations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VpnServerConfiguration being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVpnServerConfiguration(this ResourceGroupResource resourceGroupResource, string vpnServerConfigurationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVpnServerConfigurations().Get(vpnServerConfigurationName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnServerConfiguration(vpnServerConfigurationName, cancellationToken); } - /// Gets a collection of VirtualHubResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualHubResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualHubResources and their operations over a VirtualHubResource. public static VirtualHubCollection GetVirtualHubs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualHubs(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualHubs(); } /// @@ -4478,16 +4706,20 @@ public static VirtualHubCollection GetVirtualHubs(this ResourceGroupResource res /// VirtualHubs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VirtualHub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualHubAsync(this ResourceGroupResource resourceGroupResource, string virtualHubName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualHubs().GetAsync(virtualHubName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualHubAsync(virtualHubName, cancellationToken).ConfigureAwait(false); } /// @@ -4502,24 +4734,34 @@ public static async Task> GetVirtualHubAsync(this R /// VirtualHubs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the VirtualHub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualHub(this ResourceGroupResource resourceGroupResource, string virtualHubName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualHubs().Get(virtualHubName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVirtualHub(virtualHubName, cancellationToken); } - /// Gets a collection of VpnGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of VpnGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VpnGatewayResources and their operations over a VpnGatewayResource. public static VpnGatewayCollection GetVpnGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVpnGateways(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnGateways(); } /// @@ -4534,16 +4776,20 @@ public static VpnGatewayCollection GetVpnGateways(this ResourceGroupResource res /// VpnGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVpnGatewayAsync(this ResourceGroupResource resourceGroupResource, string gatewayName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVpnGateways().GetAsync(gatewayName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnGatewayAsync(gatewayName, cancellationToken).ConfigureAwait(false); } /// @@ -4558,24 +4804,34 @@ public static async Task> GetVpnGatewayAsync(this R /// VpnGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVpnGateway(this ResourceGroupResource resourceGroupResource, string gatewayName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVpnGateways().Get(gatewayName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetVpnGateway(gatewayName, cancellationToken); } - /// Gets a collection of P2SVpnGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of P2SVpnGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of P2SVpnGatewayResources and their operations over a P2SVpnGatewayResource. public static P2SVpnGatewayCollection GetP2SVpnGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetP2SVpnGateways(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetP2SVpnGateways(); } /// @@ -4590,16 +4846,20 @@ public static P2SVpnGatewayCollection GetP2SVpnGateways(this ResourceGroupResour /// P2sVpnGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetP2SVpnGatewayAsync(this ResourceGroupResource resourceGroupResource, string gatewayName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetP2SVpnGateways().GetAsync(gatewayName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetP2SVpnGatewayAsync(gatewayName, cancellationToken).ConfigureAwait(false); } /// @@ -4614,24 +4874,34 @@ public static async Task> GetP2SVpnGatewayAsync( /// P2sVpnGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetP2SVpnGateway(this ResourceGroupResource resourceGroupResource, string gatewayName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetP2SVpnGateways().Get(gatewayName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetP2SVpnGateway(gatewayName, cancellationToken); } - /// Gets a collection of ExpressRouteGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of ExpressRouteGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ExpressRouteGatewayResources and their operations over a ExpressRouteGatewayResource. public static ExpressRouteGatewayCollection GetExpressRouteGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetExpressRouteGateways(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteGateways(); } /// @@ -4646,16 +4916,20 @@ public static ExpressRouteGatewayCollection GetExpressRouteGateways(this Resourc /// ExpressRouteGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the ExpressRoute gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetExpressRouteGatewayAsync(this ResourceGroupResource resourceGroupResource, string expressRouteGatewayName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetExpressRouteGateways().GetAsync(expressRouteGatewayName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteGatewayAsync(expressRouteGatewayName, cancellationToken).ConfigureAwait(false); } /// @@ -4670,24 +4944,34 @@ public static async Task> GetExpressRouteG /// ExpressRouteGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the ExpressRoute gateway. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetExpressRouteGateway(this ResourceGroupResource resourceGroupResource, string expressRouteGatewayName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetExpressRouteGateways().Get(expressRouteGatewayName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetExpressRouteGateway(expressRouteGatewayName, cancellationToken); } - /// Gets a collection of WebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of WebApplicationFirewallPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of WebApplicationFirewallPolicyResources and their operations over a WebApplicationFirewallPolicyResource. public static WebApplicationFirewallPolicyCollection GetWebApplicationFirewallPolicies(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetWebApplicationFirewallPolicies(); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetWebApplicationFirewallPolicies(); } /// @@ -4702,16 +4986,20 @@ public static WebApplicationFirewallPolicyCollection GetWebApplicationFirewallPo /// WebApplicationFirewallPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetWebApplicationFirewallPolicyAsync(this ResourceGroupResource resourceGroupResource, string policyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetWebApplicationFirewallPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).GetWebApplicationFirewallPolicyAsync(policyName, cancellationToken).ConfigureAwait(false); } /// @@ -4726,16 +5014,20 @@ public static async Task> GetWebA /// WebApplicationFirewallPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetWebApplicationFirewallPolicy(this ResourceGroupResource resourceGroupResource, string policyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetWebApplicationFirewallPolicies().Get(policyName, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetWebApplicationFirewallPolicy(policyName, cancellationToken); } /// @@ -4750,6 +5042,10 @@ public static Response GetWebApplicationFi /// AvailableResourceGroupDelegations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -4757,7 +5053,7 @@ public static Response GetWebApplicationFi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableResourceGroupDelegationsAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailableResourceGroupDelegationsAsync(location, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAvailableResourceGroupDelegationsAsync(location, cancellationToken); } /// @@ -4772,6 +5068,10 @@ public static AsyncPageable GetAvailableResourceGroupDelega /// AvailableResourceGroupDelegations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -4779,7 +5079,7 @@ public static AsyncPageable GetAvailableResourceGroupDelega /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableResourceGroupDelegations(this ResourceGroupResource resourceGroupResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailableResourceGroupDelegations(location, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAvailableResourceGroupDelegations(location, cancellationToken); } /// @@ -4794,6 +5094,10 @@ public static Pageable GetAvailableResourceGroupDelegations /// AvailableServiceAliases_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location. @@ -4801,7 +5105,7 @@ public static Pageable GetAvailableResourceGroupDelegations /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableServiceAliasesByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailableServiceAliasesByResourceGroupAsync(location, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAvailableServiceAliasesByResourceGroupAsync(location, cancellationToken); } /// @@ -4816,6 +5120,10 @@ public static AsyncPageable GetAvailableServiceAliasesByR /// AvailableServiceAliases_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location. @@ -4823,7 +5131,7 @@ public static AsyncPageable GetAvailableServiceAliasesByR /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableServiceAliasesByResourceGroup(this ResourceGroupResource resourceGroupResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailableServiceAliasesByResourceGroup(location, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAvailableServiceAliasesByResourceGroup(location, cancellationToken); } /// @@ -4838,6 +5146,10 @@ public static Pageable GetAvailableServiceAliasesByResour /// AvailablePrivateEndpointTypes_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -4845,7 +5157,7 @@ public static Pageable GetAvailableServiceAliasesByResour /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailablePrivateEndpointTypesByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailablePrivateEndpointTypesByResourceGroupAsync(location, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAvailablePrivateEndpointTypesByResourceGroupAsync(location, cancellationToken); } /// @@ -4860,6 +5172,10 @@ public static AsyncPageable GetAvailablePrivateEnd /// AvailablePrivateEndpointTypes_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -4867,7 +5183,7 @@ public static AsyncPageable GetAvailablePrivateEnd /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailablePrivateEndpointTypesByResourceGroup(this ResourceGroupResource resourceGroupResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailablePrivateEndpointTypesByResourceGroup(location, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAvailablePrivateEndpointTypesByResourceGroup(location, cancellationToken); } /// @@ -4882,6 +5198,10 @@ public static Pageable GetAvailablePrivateEndpoint /// PrivateLinkServices_CheckPrivateLinkServiceVisibilityByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -4891,9 +5211,7 @@ public static Pageable GetAvailablePrivateEndpoint /// is null. public static async Task> CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkServiceAsync(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(checkPrivateLinkServiceVisibilityRequest, nameof(checkPrivateLinkServiceVisibilityRequest)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkServiceAsync(waitUntil, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkResourceGroupResource(resourceGroupResource).CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkServiceAsync(waitUntil, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken).ConfigureAwait(false); } /// @@ -4908,6 +5226,10 @@ public static async Task> CheckPrivat /// PrivateLinkServices_CheckPrivateLinkServiceVisibilityByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -4917,9 +5239,7 @@ public static async Task> CheckPrivat /// is null. public static ArmOperation CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(checkPrivateLinkServiceVisibilityRequest, nameof(checkPrivateLinkServiceVisibilityRequest)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService(waitUntil, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService(waitUntil, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken); } /// @@ -4934,6 +5254,10 @@ public static ArmOperation CheckPrivateLinkService /// PrivateLinkServices_ListAutoApprovedPrivateLinkServicesByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -4941,7 +5265,7 @@ public static ArmOperation CheckPrivateLinkService /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServicesAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServicesAsync(location, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServicesAsync(location, cancellationToken); } /// @@ -4956,6 +5280,10 @@ public static AsyncPageable GetAutoApprovedPriva /// PrivateLinkServices_ListAutoApprovedPrivateLinkServicesByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -4963,16 +5291,22 @@ public static AsyncPageable GetAutoApprovedPriva /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices(this ResourceGroupResource resourceGroupResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices(location, cancellationToken); + return GetMockableNetworkResourceGroupResource(resourceGroupResource).GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices(location, cancellationToken); } - /// Gets a collection of ApplicationGatewayWafDynamicManifestResources in the SubscriptionResource. + /// + /// Gets a collection of ApplicationGatewayWafDynamicManifestResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The region where the nrp are located at. /// An object representing collection of ApplicationGatewayWafDynamicManifestResources and their operations over a ApplicationGatewayWafDynamicManifestResource. public static ApplicationGatewayWafDynamicManifestCollection GetApplicationGatewayWafDynamicManifests(this SubscriptionResource subscriptionResource, AzureLocation location) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGatewayWafDynamicManifests(location); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewayWafDynamicManifests(location); } /// @@ -4987,6 +5321,10 @@ public static ApplicationGatewayWafDynamicManifestCollection GetApplicationGatew /// ApplicationGatewayWafDynamicManifestsDefault_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region where the nrp are located at. @@ -4994,7 +5332,7 @@ public static ApplicationGatewayWafDynamicManifestCollection GetApplicationGatew [ForwardsClientCalls] public static async Task> GetApplicationGatewayWafDynamicManifestAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetApplicationGatewayWafDynamicManifests(location).GetAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewayWafDynamicManifestAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -5009,6 +5347,10 @@ public static async Task> /// ApplicationGatewayWafDynamicManifestsDefault_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region where the nrp are located at. @@ -5016,15 +5358,21 @@ public static async Task> [ForwardsClientCalls] public static Response GetApplicationGatewayWafDynamicManifest(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return subscriptionResource.GetApplicationGatewayWafDynamicManifests(location).Get(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewayWafDynamicManifest(location, cancellationToken); } - /// Gets a collection of AzureWebCategoryResources in the SubscriptionResource. + /// + /// Gets a collection of AzureWebCategoryResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AzureWebCategoryResources and their operations over a AzureWebCategoryResource. public static AzureWebCategoryCollection GetAzureWebCategories(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureWebCategories(); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAzureWebCategories(); } /// @@ -5039,17 +5387,21 @@ public static AzureWebCategoryCollection GetAzureWebCategories(this Subscription /// WebCategories_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the azureWebCategory. /// Expands resourceIds back referenced by the azureWebCategory resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAzureWebCategoryAsync(this SubscriptionResource subscriptionResource, string name, string expand = null, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetAzureWebCategories().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetAzureWebCategoryAsync(name, expand, cancellationToken).ConfigureAwait(false); } /// @@ -5064,25 +5416,35 @@ public static async Task> GetAzureWebCategory /// WebCategories_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the azureWebCategory. /// Expands resourceIds back referenced by the azureWebCategory resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAzureWebCategory(this SubscriptionResource subscriptionResource, string name, string expand = null, CancellationToken cancellationToken = default) { - return subscriptionResource.GetAzureWebCategories().Get(name, expand, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAzureWebCategory(name, expand, cancellationToken); } - /// Gets a collection of ExpressRouteProviderPortResources in the SubscriptionResource. + /// + /// Gets a collection of ExpressRouteProviderPortResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ExpressRouteProviderPortResources and their operations over a ExpressRouteProviderPortResource. public static ExpressRouteProviderPortCollection GetExpressRouteProviderPorts(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteProviderPorts(); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteProviderPorts(); } /// @@ -5097,16 +5459,20 @@ public static ExpressRouteProviderPortCollection GetExpressRouteProviderPorts(th /// ExpressRouteProviderPort /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the provider port. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetExpressRouteProviderPortAsync(this SubscriptionResource subscriptionResource, string providerport, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetExpressRouteProviderPorts().GetAsync(providerport, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteProviderPortAsync(providerport, cancellationToken).ConfigureAwait(false); } /// @@ -5121,24 +5487,34 @@ public static async Task> GetExpressR /// ExpressRouteProviderPort /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the provider port. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetExpressRouteProviderPort(this SubscriptionResource subscriptionResource, string providerport, CancellationToken cancellationToken = default) { - return subscriptionResource.GetExpressRouteProviderPorts().Get(providerport, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteProviderPort(providerport, cancellationToken); } - /// Gets a collection of ExpressRoutePortsLocationResources in the SubscriptionResource. + /// + /// Gets a collection of ExpressRoutePortsLocationResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ExpressRoutePortsLocationResources and their operations over a ExpressRoutePortsLocationResource. public static ExpressRoutePortsLocationCollection GetExpressRoutePortsLocations(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRoutePortsLocations(); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRoutePortsLocations(); } /// @@ -5153,16 +5529,20 @@ public static ExpressRoutePortsLocationCollection GetExpressRoutePortsLocations( /// ExpressRoutePortsLocations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the requested ExpressRoutePort peering location. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetExpressRoutePortsLocationAsync(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetExpressRoutePortsLocations().GetAsync(locationName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRoutePortsLocationAsync(locationName, cancellationToken).ConfigureAwait(false); } /// @@ -5177,24 +5557,34 @@ public static async Task> GetExpress /// ExpressRoutePortsLocations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the requested ExpressRoutePort peering location. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetExpressRoutePortsLocation(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetExpressRoutePortsLocations().Get(locationName, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRoutePortsLocation(locationName, cancellationToken); } - /// Gets a collection of SubscriptionNetworkManagerConnectionResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionNetworkManagerConnectionResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SubscriptionNetworkManagerConnectionResources and their operations over a SubscriptionNetworkManagerConnectionResource. public static SubscriptionNetworkManagerConnectionCollection GetSubscriptionNetworkManagerConnections(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionNetworkManagerConnections(); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetSubscriptionNetworkManagerConnections(); } /// @@ -5209,16 +5599,20 @@ public static SubscriptionNetworkManagerConnectionCollection GetSubscriptionNetw /// SubscriptionNetworkManagerConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name for the network manager connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionNetworkManagerConnectionAsync(this SubscriptionResource subscriptionResource, string networkManagerConnectionName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionNetworkManagerConnections().GetAsync(networkManagerConnectionName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetSubscriptionNetworkManagerConnectionAsync(networkManagerConnectionName, cancellationToken).ConfigureAwait(false); } /// @@ -5233,24 +5627,34 @@ public static async Task> /// SubscriptionNetworkManagerConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name for the network manager connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionNetworkManagerConnection(this SubscriptionResource subscriptionResource, string networkManagerConnectionName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionNetworkManagerConnections().Get(networkManagerConnectionName, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetSubscriptionNetworkManagerConnection(networkManagerConnectionName, cancellationToken); } - /// Gets a collection of NetworkVirtualApplianceSkuResources in the SubscriptionResource. + /// + /// Gets a collection of NetworkVirtualApplianceSkuResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkVirtualApplianceSkuResources and their operations over a NetworkVirtualApplianceSkuResource. public static NetworkVirtualApplianceSkuCollection GetNetworkVirtualApplianceSkus(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkVirtualApplianceSkus(); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkVirtualApplianceSkus(); } /// @@ -5265,16 +5669,20 @@ public static NetworkVirtualApplianceSkuCollection GetNetworkVirtualApplianceSku /// VirtualApplianceSkus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Sku. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkVirtualApplianceSkuAsync(this SubscriptionResource subscriptionResource, string skuName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetNetworkVirtualApplianceSkus().GetAsync(skuName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkVirtualApplianceSkuAsync(skuName, cancellationToken).ConfigureAwait(false); } /// @@ -5289,16 +5697,20 @@ public static async Task> GetNetwor /// VirtualApplianceSkus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Sku. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkVirtualApplianceSku(this SubscriptionResource subscriptionResource, string skuName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetNetworkVirtualApplianceSkus().Get(skuName, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkVirtualApplianceSku(skuName, cancellationToken); } /// @@ -5313,13 +5725,17 @@ public static Response GetNetworkVirtualAppl /// ApplicationGateways_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApplicationGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGatewaysAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewaysAsync(cancellationToken); } /// @@ -5334,13 +5750,17 @@ public static AsyncPageable GetApplicationGatewaysAs /// ApplicationGateways_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApplicationGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGateways(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGateways(cancellationToken); } /// @@ -5355,13 +5775,17 @@ public static Pageable GetApplicationGateways(this S /// ApplicationGateways_ListAvailableServerVariables /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableServerVariablesApplicationGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableServerVariablesApplicationGatewaysAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableServerVariablesApplicationGatewaysAsync(cancellationToken); } /// @@ -5376,13 +5800,17 @@ public static AsyncPageable GetAvailableServerVariablesApplicationGatewa /// ApplicationGateways_ListAvailableServerVariables /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableServerVariablesApplicationGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableServerVariablesApplicationGateways(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableServerVariablesApplicationGateways(cancellationToken); } /// @@ -5397,13 +5825,17 @@ public static Pageable GetAvailableServerVariablesApplicationGateways(th /// ApplicationGateways_ListAvailableRequestHeaders /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableRequestHeadersApplicationGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableRequestHeadersApplicationGatewaysAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableRequestHeadersApplicationGatewaysAsync(cancellationToken); } /// @@ -5418,13 +5850,17 @@ public static AsyncPageable GetAvailableRequestHeadersApplicationGateway /// ApplicationGateways_ListAvailableRequestHeaders /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableRequestHeadersApplicationGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableRequestHeadersApplicationGateways(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableRequestHeadersApplicationGateways(cancellationToken); } /// @@ -5439,13 +5875,17 @@ public static Pageable GetAvailableRequestHeadersApplicationGateways(thi /// ApplicationGateways_ListAvailableResponseHeaders /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableResponseHeadersApplicationGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableResponseHeadersApplicationGatewaysAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableResponseHeadersApplicationGatewaysAsync(cancellationToken); } /// @@ -5460,13 +5900,17 @@ public static AsyncPageable GetAvailableResponseHeadersApplicationGatewa /// ApplicationGateways_ListAvailableResponseHeaders /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAvailableResponseHeadersApplicationGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableResponseHeadersApplicationGateways(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableResponseHeadersApplicationGateways(cancellationToken); } /// @@ -5481,13 +5925,17 @@ public static Pageable GetAvailableResponseHeadersApplicationGateways(th /// ApplicationGateways_ListAvailableWafRuleSets /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppGatewayAvailableWafRuleSetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppGatewayAvailableWafRuleSetsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAppGatewayAvailableWafRuleSetsAsync(cancellationToken); } /// @@ -5502,13 +5950,17 @@ public static AsyncPageable GetAppGatewayAvai /// ApplicationGateways_ListAvailableWafRuleSets /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppGatewayAvailableWafRuleSets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppGatewayAvailableWafRuleSets(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAppGatewayAvailableWafRuleSets(cancellationToken); } /// @@ -5523,12 +5975,16 @@ public static Pageable GetAppGatewayAvailable /// ApplicationGateways_ListAvailableSslOptions /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetApplicationGatewayAvailableSslOptionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGatewayAvailableSslOptionsAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewayAvailableSslOptionsAsync(cancellationToken).ConfigureAwait(false); } /// @@ -5543,12 +5999,16 @@ public static async Task> Ge /// ApplicationGateways_ListAvailableSslOptions /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetApplicationGatewayAvailableSslOptions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGatewayAvailableSslOptions(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewayAvailableSslOptions(cancellationToken); } /// @@ -5563,13 +6023,17 @@ public static Response GetApplication /// ApplicationGateways_ListAvailableSslPredefinedPolicies /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApplicationGatewayAvailableSslPredefinedPoliciesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGatewayAvailableSslPredefinedPoliciesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewayAvailableSslPredefinedPoliciesAsync(cancellationToken); } /// @@ -5584,13 +6048,17 @@ public static AsyncPageable GetApplicatio /// ApplicationGateways_ListAvailableSslPredefinedPolicies /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApplicationGatewayAvailableSslPredefinedPolicies(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGatewayAvailableSslPredefinedPolicies(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewayAvailableSslPredefinedPolicies(cancellationToken); } /// @@ -5605,6 +6073,10 @@ public static Pageable GetApplicationGate /// ApplicationGateways_GetSslPredefinedPolicy /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of Ssl predefined policy. @@ -5613,9 +6085,7 @@ public static Pageable GetApplicationGate /// is null. public static async Task> GetApplicationGatewaySslPredefinedPolicyAsync(this SubscriptionResource subscriptionResource, string predefinedPolicyName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(predefinedPolicyName, nameof(predefinedPolicyName)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGatewaySslPredefinedPolicyAsync(predefinedPolicyName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewaySslPredefinedPolicyAsync(predefinedPolicyName, cancellationToken).ConfigureAwait(false); } /// @@ -5630,6 +6100,10 @@ public static async Task> GetApp /// ApplicationGateways_GetSslPredefinedPolicy /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of Ssl predefined policy. @@ -5638,9 +6112,7 @@ public static async Task> GetApp /// is null. public static Response GetApplicationGatewaySslPredefinedPolicy(this SubscriptionResource subscriptionResource, string predefinedPolicyName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(predefinedPolicyName, nameof(predefinedPolicyName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationGatewaySslPredefinedPolicy(predefinedPolicyName, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationGatewaySslPredefinedPolicy(predefinedPolicyName, cancellationToken); } /// @@ -5655,13 +6127,17 @@ public static Response GetApplicationGate /// ApplicationSecurityGroups_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApplicationSecurityGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationSecurityGroupsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationSecurityGroupsAsync(cancellationToken); } /// @@ -5676,13 +6152,17 @@ public static AsyncPageable GetApplicationSecu /// ApplicationSecurityGroups_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetApplicationSecurityGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetApplicationSecurityGroups(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetApplicationSecurityGroups(cancellationToken); } /// @@ -5697,6 +6177,10 @@ public static Pageable GetApplicationSecurityG /// AvailableDelegations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the subnet. @@ -5704,7 +6188,7 @@ public static Pageable GetApplicationSecurityG /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableDelegationsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableDelegationsAsync(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableDelegationsAsync(location, cancellationToken); } /// @@ -5719,6 +6203,10 @@ public static AsyncPageable GetAvailableDelegationsAsync(th /// AvailableDelegations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the subnet. @@ -5726,7 +6214,7 @@ public static AsyncPageable GetAvailableDelegationsAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableDelegations(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableDelegations(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableDelegations(location, cancellationToken); } /// @@ -5741,6 +6229,10 @@ public static Pageable GetAvailableDelegations(this Subscri /// AvailableServiceAliases_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location. @@ -5748,7 +6240,7 @@ public static Pageable GetAvailableDelegations(this Subscri /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableServiceAliasesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableServiceAliasesAsync(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableServiceAliasesAsync(location, cancellationToken); } /// @@ -5763,6 +6255,10 @@ public static AsyncPageable GetAvailableServiceAliasesAsy /// AvailableServiceAliases_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location. @@ -5770,7 +6266,7 @@ public static AsyncPageable GetAvailableServiceAliasesAsy /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableServiceAliases(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableServiceAliases(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableServiceAliases(location, cancellationToken); } /// @@ -5785,13 +6281,17 @@ public static Pageable GetAvailableServiceAliases(this Su /// AzureFirewalls_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzureFirewallsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureFirewallsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAzureFirewallsAsync(cancellationToken); } /// @@ -5806,13 +6306,17 @@ public static AsyncPageable GetAzureFirewallsAsync(this S /// AzureFirewalls_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzureFirewalls(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureFirewalls(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAzureFirewalls(cancellationToken); } /// @@ -5827,13 +6331,17 @@ public static Pageable GetAzureFirewalls(this Subscriptio /// AzureFirewallFqdnTags_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzureFirewallFqdnTagsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureFirewallFqdnTagsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAzureFirewallFqdnTagsAsync(cancellationToken); } /// @@ -5848,13 +6356,17 @@ public static AsyncPageable GetAzureFirewallFqdnTagsAsync( /// AzureFirewallFqdnTags_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzureFirewallFqdnTags(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureFirewallFqdnTags(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAzureFirewallFqdnTags(cancellationToken); } /// @@ -5869,13 +6381,17 @@ public static Pageable GetAzureFirewallFqdnTags(this Subsc /// BastionHosts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBastionHostsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBastionHostsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetBastionHostsAsync(cancellationToken); } /// @@ -5890,13 +6406,17 @@ public static AsyncPageable GetBastionHostsAsync(this Subsc /// BastionHosts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBastionHosts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBastionHosts(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetBastionHosts(cancellationToken); } /// @@ -5911,6 +6431,10 @@ public static Pageable GetBastionHosts(this SubscriptionRes /// CheckDnsNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -5919,9 +6443,7 @@ public static Pageable GetBastionHosts(this SubscriptionRes /// is null. public static async Task> CheckDnsNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string domainNameLabel, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(domainNameLabel, nameof(domainNameLabel)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDnsNameAvailabilityAsync(location, domainNameLabel, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).CheckDnsNameAvailabilityAsync(location, domainNameLabel, cancellationToken).ConfigureAwait(false); } /// @@ -5936,6 +6458,10 @@ public static async Task> CheckDnsNameAvaila /// CheckDnsNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -5944,9 +6470,7 @@ public static async Task> CheckDnsNameAvaila /// is null. public static Response CheckDnsNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, string domainNameLabel, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(domainNameLabel, nameof(domainNameLabel)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDnsNameAvailability(location, domainNameLabel, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).CheckDnsNameAvailability(location, domainNameLabel, cancellationToken); } /// @@ -5961,13 +6485,17 @@ public static Response CheckDnsNameAvailability(this /// CustomIPPrefixes_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCustomIPPrefixesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCustomIPPrefixesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetCustomIPPrefixesAsync(cancellationToken); } /// @@ -5982,13 +6510,17 @@ public static AsyncPageable GetCustomIPPrefixesAsync(thi /// CustomIPPrefixes_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCustomIPPrefixes(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCustomIPPrefixes(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetCustomIPPrefixes(cancellationToken); } /// @@ -6003,13 +6535,17 @@ public static Pageable GetCustomIPPrefixes(this Subscrip /// DdosProtectionPlans_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDdosProtectionPlansAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDdosProtectionPlansAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetDdosProtectionPlansAsync(cancellationToken); } /// @@ -6024,13 +6560,17 @@ public static AsyncPageable GetDdosProtectionPlansAs /// DdosProtectionPlans_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDdosProtectionPlans(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDdosProtectionPlans(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetDdosProtectionPlans(cancellationToken); } /// @@ -6045,13 +6585,17 @@ public static Pageable GetDdosProtectionPlans(this S /// DscpConfiguration_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDscpConfigurationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDscpConfigurationsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetDscpConfigurationsAsync(cancellationToken); } /// @@ -6066,13 +6610,17 @@ public static AsyncPageable GetDscpConfigurationsAsyn /// DscpConfiguration_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDscpConfigurations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDscpConfigurations(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetDscpConfigurations(cancellationToken); } /// @@ -6087,6 +6635,10 @@ public static Pageable GetDscpConfigurations(this Sub /// AvailableEndpointServices_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location to check available endpoint services. @@ -6094,7 +6646,7 @@ public static Pageable GetDscpConfigurations(this Sub /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableEndpointServicesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableEndpointServicesAsync(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableEndpointServicesAsync(location, cancellationToken); } /// @@ -6109,6 +6661,10 @@ public static AsyncPageable GetAvailableEndpointServicesA /// AvailableEndpointServices_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location to check available endpoint services. @@ -6116,7 +6672,7 @@ public static AsyncPageable GetAvailableEndpointServicesA /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableEndpointServices(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableEndpointServices(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailableEndpointServices(location, cancellationToken); } /// @@ -6131,13 +6687,17 @@ public static Pageable GetAvailableEndpointServices(this /// ExpressRouteCircuits_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRouteCircuitsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteCircuitsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteCircuitsAsync(cancellationToken); } /// @@ -6152,13 +6712,17 @@ public static AsyncPageable GetExpressRouteCircuits /// ExpressRouteCircuits_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRouteCircuits(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteCircuits(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteCircuits(cancellationToken); } /// @@ -6173,13 +6737,17 @@ public static Pageable GetExpressRouteCircuits(this /// ExpressRouteServiceProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRouteServiceProvidersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteServiceProvidersAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteServiceProvidersAsync(cancellationToken); } /// @@ -6194,13 +6762,17 @@ public static AsyncPageable GetExpressRouteServiceP /// ExpressRouteServiceProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRouteServiceProviders(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteServiceProviders(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteServiceProviders(cancellationToken); } /// @@ -6215,13 +6787,17 @@ public static Pageable GetExpressRouteServiceProvid /// ExpressRouteCrossConnections_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRouteCrossConnectionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteCrossConnectionsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteCrossConnectionsAsync(cancellationToken); } /// @@ -6236,13 +6812,17 @@ public static AsyncPageable GetExpressRoute /// ExpressRouteCrossConnections_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRouteCrossConnections(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteCrossConnections(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteCrossConnections(cancellationToken); } /// @@ -6257,13 +6837,17 @@ public static Pageable GetExpressRouteCross /// ExpressRoutePorts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRoutePortsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRoutePortsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRoutePortsAsync(cancellationToken); } /// @@ -6278,13 +6862,17 @@ public static AsyncPageable GetExpressRoutePortsAsync( /// ExpressRoutePorts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRoutePorts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRoutePorts(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRoutePorts(cancellationToken); } /// @@ -6299,13 +6887,17 @@ public static Pageable GetExpressRoutePorts(this Subsc /// FirewallPolicies_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFirewallPoliciesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFirewallPoliciesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetFirewallPoliciesAsync(cancellationToken); } /// @@ -6320,13 +6912,17 @@ public static AsyncPageable GetFirewallPoliciesAsync(thi /// FirewallPolicies_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetFirewallPolicies(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetFirewallPolicies(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetFirewallPolicies(cancellationToken); } /// @@ -6341,13 +6937,17 @@ public static Pageable GetFirewallPolicies(this Subscrip /// IpAllocations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIPAllocationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIPAllocationsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetIPAllocationsAsync(cancellationToken); } /// @@ -6362,13 +6962,17 @@ public static AsyncPageable GetIPAllocationsAsync(this Sub /// IpAllocations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIPAllocations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIPAllocations(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetIPAllocations(cancellationToken); } /// @@ -6383,13 +6987,17 @@ public static Pageable GetIPAllocations(this SubscriptionR /// IpGroups_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIPGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIPGroupsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetIPGroupsAsync(cancellationToken); } /// @@ -6404,13 +7012,17 @@ public static AsyncPageable GetIPGroupsAsync(this SubscriptionR /// IpGroups_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetIPGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIPGroups(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetIPGroups(cancellationToken); } /// @@ -6425,13 +7037,17 @@ public static Pageable GetIPGroups(this SubscriptionResource su /// LoadBalancers_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetLoadBalancersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLoadBalancersAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetLoadBalancersAsync(cancellationToken); } /// @@ -6446,13 +7062,17 @@ public static AsyncPageable GetLoadBalancersAsync(this Sub /// LoadBalancers_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetLoadBalancers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLoadBalancers(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetLoadBalancers(cancellationToken); } /// @@ -6467,6 +7087,10 @@ public static Pageable GetLoadBalancers(this SubscriptionR /// LoadBalancers_SwapPublicIpAddresses /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -6476,9 +7100,7 @@ public static Pageable GetLoadBalancers(this SubscriptionR /// is null. public static async Task SwapPublicIPAddressesLoadBalancerAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, LoadBalancerVipSwapContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).SwapPublicIPAddressesLoadBalancerAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).SwapPublicIPAddressesLoadBalancerAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); } /// @@ -6493,6 +7115,10 @@ public static async Task SwapPublicIPAddressesLoadBalancerAsync(th /// LoadBalancers_SwapPublicIpAddresses /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -6502,9 +7128,7 @@ public static async Task SwapPublicIPAddressesLoadBalancerAsync(th /// is null. public static ArmOperation SwapPublicIPAddressesLoadBalancer(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, LoadBalancerVipSwapContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).SwapPublicIPAddressesLoadBalancer(waitUntil, location, content, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).SwapPublicIPAddressesLoadBalancer(waitUntil, location, content, cancellationToken); } /// @@ -6519,13 +7143,17 @@ public static ArmOperation SwapPublicIPAddressesLoadBalancer(this SubscriptionRe /// NatGateways_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNatGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNatGatewaysAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNatGatewaysAsync(cancellationToken); } /// @@ -6540,13 +7168,17 @@ public static AsyncPageable GetNatGatewaysAsync(this Subscri /// NatGateways_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNatGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNatGateways(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNatGateways(cancellationToken); } /// @@ -6561,13 +7193,17 @@ public static Pageable GetNatGateways(this SubscriptionResou /// NetworkInterfaces_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkInterfacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkInterfacesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkInterfacesAsync(cancellationToken); } /// @@ -6582,13 +7218,17 @@ public static AsyncPageable GetNetworkInterfacesAsync( /// NetworkInterfaces_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkInterfaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkInterfaces(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkInterfaces(cancellationToken); } /// @@ -6603,6 +7243,10 @@ public static Pageable GetNetworkInterfaces(this Subsc /// NetworkManagers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// An optional query parameter which specifies the maximum number of records to be returned by the server. @@ -6611,7 +7255,7 @@ public static Pageable GetNetworkInterfaces(this Subsc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetNetworkManagersAsync(this SubscriptionResource subscriptionResource, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkManagersAsync(top, skipToken, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkManagersAsync(top, skipToken, cancellationToken); } /// @@ -6626,6 +7270,10 @@ public static AsyncPageable GetNetworkManagersAsync(this /// NetworkManagers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// An optional query parameter which specifies the maximum number of records to be returned by the server. @@ -6634,7 +7282,7 @@ public static AsyncPageable GetNetworkManagersAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetNetworkManagers(this SubscriptionResource subscriptionResource, int? top = null, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkManagers(top, skipToken, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkManagers(top, skipToken, cancellationToken); } /// @@ -6649,13 +7297,17 @@ public static Pageable GetNetworkManagers(this Subscript /// NetworkProfiles_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkProfilesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkProfilesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkProfilesAsync(cancellationToken); } /// @@ -6670,13 +7322,17 @@ public static AsyncPageable GetNetworkProfilesAsync(this /// NetworkProfiles_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkProfiles(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkProfiles(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkProfiles(cancellationToken); } /// @@ -6691,13 +7347,17 @@ public static Pageable GetNetworkProfiles(this Subscript /// NetworkSecurityGroups_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkSecurityGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkSecurityGroupsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkSecurityGroupsAsync(cancellationToken); } /// @@ -6712,13 +7372,17 @@ public static AsyncPageable GetNetworkSecurityGrou /// NetworkSecurityGroups_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkSecurityGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkSecurityGroups(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkSecurityGroups(cancellationToken); } /// @@ -6733,13 +7397,17 @@ public static Pageable GetNetworkSecurityGroups(th /// NetworkVirtualAppliances_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkVirtualAppliancesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkVirtualAppliancesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkVirtualAppliancesAsync(cancellationToken); } /// @@ -6754,13 +7422,17 @@ public static AsyncPageable GetNetworkVirtualAp /// NetworkVirtualAppliances_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkVirtualAppliances(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkVirtualAppliances(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkVirtualAppliances(cancellationToken); } /// @@ -6775,13 +7447,17 @@ public static Pageable GetNetworkVirtualApplian /// NetworkWatchers_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkWatchersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkWatchersAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkWatchersAsync(cancellationToken); } /// @@ -6796,13 +7472,17 @@ public static AsyncPageable GetNetworkWatchersAsync(this /// NetworkWatchers_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkWatchers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkWatchers(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetNetworkWatchers(cancellationToken); } /// @@ -6817,13 +7497,17 @@ public static Pageable GetNetworkWatchers(this Subscript /// PrivateEndpoints_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPrivateEndpointsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPrivateEndpointsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetPrivateEndpointsAsync(cancellationToken); } /// @@ -6838,13 +7522,17 @@ public static AsyncPageable GetPrivateEndpointsAsync(th /// PrivateEndpoints_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPrivateEndpoints(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPrivateEndpoints(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetPrivateEndpoints(cancellationToken); } /// @@ -6859,6 +7547,10 @@ public static Pageable GetPrivateEndpoints(this Subscri /// AvailablePrivateEndpointTypes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -6866,7 +7558,7 @@ public static Pageable GetPrivateEndpoints(this Subscri /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailablePrivateEndpointTypesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailablePrivateEndpointTypesAsync(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailablePrivateEndpointTypesAsync(location, cancellationToken); } /// @@ -6881,6 +7573,10 @@ public static AsyncPageable GetAvailablePrivateEnd /// AvailablePrivateEndpointTypes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -6888,7 +7584,7 @@ public static AsyncPageable GetAvailablePrivateEnd /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailablePrivateEndpointTypes(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailablePrivateEndpointTypes(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAvailablePrivateEndpointTypes(location, cancellationToken); } /// @@ -6903,13 +7599,17 @@ public static Pageable GetAvailablePrivateEndpoint /// PrivateLinkServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPrivateLinkServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPrivateLinkServicesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetPrivateLinkServicesAsync(cancellationToken); } /// @@ -6924,13 +7624,17 @@ public static AsyncPageable GetPrivateLinkServicesAs /// PrivateLinkServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPrivateLinkServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPrivateLinkServices(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetPrivateLinkServices(cancellationToken); } /// @@ -6945,6 +7649,10 @@ public static Pageable GetPrivateLinkServices(this S /// PrivateLinkServices_CheckPrivateLinkServiceVisibility /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -6954,9 +7662,7 @@ public static Pageable GetPrivateLinkServices(this S /// is null. public static async Task> CheckPrivateLinkServiceVisibilityPrivateLinkServiceAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(checkPrivateLinkServiceVisibilityRequest, nameof(checkPrivateLinkServiceVisibilityRequest)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPrivateLinkServiceVisibilityPrivateLinkServiceAsync(waitUntil, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).CheckPrivateLinkServiceVisibilityPrivateLinkServiceAsync(waitUntil, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken).ConfigureAwait(false); } /// @@ -6971,6 +7677,10 @@ public static async Task> CheckPrivat /// PrivateLinkServices_CheckPrivateLinkServiceVisibility /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -6980,9 +7690,7 @@ public static async Task> CheckPrivat /// is null. public static ArmOperation CheckPrivateLinkServiceVisibilityPrivateLinkService(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(checkPrivateLinkServiceVisibilityRequest, nameof(checkPrivateLinkServiceVisibilityRequest)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPrivateLinkServiceVisibilityPrivateLinkService(waitUntil, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).CheckPrivateLinkServiceVisibilityPrivateLinkService(waitUntil, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken); } /// @@ -6997,6 +7705,10 @@ public static ArmOperation CheckPrivateLinkService /// PrivateLinkServices_ListAutoApprovedPrivateLinkServices /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -7004,7 +7716,7 @@ public static ArmOperation CheckPrivateLinkService /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAutoApprovedPrivateLinkServicesPrivateLinkServicesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutoApprovedPrivateLinkServicesPrivateLinkServicesAsync(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAutoApprovedPrivateLinkServicesPrivateLinkServicesAsync(location, cancellationToken); } /// @@ -7019,6 +7731,10 @@ public static AsyncPageable GetAutoApprovedPriva /// PrivateLinkServices_ListAutoApprovedPrivateLinkServices /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the domain name. @@ -7026,7 +7742,7 @@ public static AsyncPageable GetAutoApprovedPriva /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAutoApprovedPrivateLinkServicesPrivateLinkServices(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutoApprovedPrivateLinkServicesPrivateLinkServices(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAutoApprovedPrivateLinkServicesPrivateLinkServices(location, cancellationToken); } /// @@ -7041,13 +7757,17 @@ public static Pageable GetAutoApprovedPrivateLin /// PublicIPAddresses_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPublicIPAddressesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPublicIPAddressesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetPublicIPAddressesAsync(cancellationToken); } /// @@ -7062,13 +7782,17 @@ public static AsyncPageable GetPublicIPAddressesAsync(t /// PublicIPAddresses_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPublicIPAddresses(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPublicIPAddresses(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetPublicIPAddresses(cancellationToken); } /// @@ -7083,13 +7807,17 @@ public static Pageable GetPublicIPAddresses(this Subscr /// PublicIPPrefixes_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPublicIPPrefixesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPublicIPPrefixesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetPublicIPPrefixesAsync(cancellationToken); } /// @@ -7104,13 +7832,17 @@ public static AsyncPageable GetPublicIPPrefixesAsync(thi /// PublicIPPrefixes_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPublicIPPrefixes(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPublicIPPrefixes(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetPublicIPPrefixes(cancellationToken); } /// @@ -7125,13 +7857,17 @@ public static Pageable GetPublicIPPrefixes(this Subscrip /// RouteFilters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRouteFiltersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRouteFiltersAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetRouteFiltersAsync(cancellationToken); } /// @@ -7146,13 +7882,17 @@ public static AsyncPageable GetRouteFiltersAsync(this Subsc /// RouteFilters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRouteFilters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRouteFilters(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetRouteFilters(cancellationToken); } /// @@ -7167,13 +7907,17 @@ public static Pageable GetRouteFilters(this SubscriptionRes /// RouteTables_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRouteTablesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRouteTablesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetRouteTablesAsync(cancellationToken); } /// @@ -7188,13 +7932,17 @@ public static AsyncPageable GetRouteTablesAsync(this Subscri /// RouteTables_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRouteTables(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRouteTables(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetRouteTables(cancellationToken); } /// @@ -7209,13 +7957,17 @@ public static Pageable GetRouteTables(this SubscriptionResou /// SecurityPartnerProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecurityPartnerProvidersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityPartnerProvidersAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetSecurityPartnerProvidersAsync(cancellationToken); } /// @@ -7230,13 +7982,17 @@ public static AsyncPageable GetSecurityPartnerP /// SecurityPartnerProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecurityPartnerProviders(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityPartnerProviders(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetSecurityPartnerProviders(cancellationToken); } /// @@ -7251,13 +8007,17 @@ public static Pageable GetSecurityPartnerProvid /// BgpServiceCommunities_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBgpServiceCommunitiesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBgpServiceCommunitiesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetBgpServiceCommunitiesAsync(cancellationToken); } /// @@ -7272,13 +8032,17 @@ public static AsyncPageable GetBgpServiceCommunitiesAsync(t /// BgpServiceCommunities_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetBgpServiceCommunities(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBgpServiceCommunities(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetBgpServiceCommunities(cancellationToken); } /// @@ -7293,13 +8057,17 @@ public static Pageable GetBgpServiceCommunities(this Subscr /// ServiceEndpointPolicies_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServiceEndpointPoliciesByServiceEndpointPolicyAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceEndpointPoliciesByServiceEndpointPolicyAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetServiceEndpointPoliciesByServiceEndpointPolicyAsync(cancellationToken); } /// @@ -7314,13 +8082,17 @@ public static AsyncPageable GetServiceEndpointPol /// ServiceEndpointPolicies_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServiceEndpointPoliciesByServiceEndpointPolicy(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceEndpointPoliciesByServiceEndpointPolicy(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetServiceEndpointPoliciesByServiceEndpointPolicy(cancellationToken); } /// @@ -7335,13 +8107,17 @@ public static Pageable GetServiceEndpointPolicies /// ServiceTags_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). /// The cancellation token to use. public static async Task> GetServiceTagAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceTagAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkSubscriptionResource(subscriptionResource).GetServiceTagAsync(location, cancellationToken).ConfigureAwait(false); } /// @@ -7356,13 +8132,17 @@ public static async Task> GetServiceTagAsync(thi /// ServiceTags_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). /// The cancellation token to use. public static Response GetServiceTag(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceTag(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetServiceTag(location, cancellationToken); } /// @@ -7377,6 +8157,10 @@ public static Response GetServiceTag(this SubscriptionRes /// ServiceTagInformation_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location that will be used as a reference for cloud (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). @@ -7386,7 +8170,7 @@ public static Response GetServiceTag(this SubscriptionRes /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAllServiceTagInformationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, bool? noAddressPrefixes = null, string tagName = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllServiceTagInformationAsync(location, noAddressPrefixes, tagName, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAllServiceTagInformationAsync(location, noAddressPrefixes, tagName, cancellationToken); } /// @@ -7401,6 +8185,10 @@ public static AsyncPageable GetAllServiceTagInformationAs /// ServiceTagInformation_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location that will be used as a reference for cloud (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). @@ -7410,7 +8198,7 @@ public static AsyncPageable GetAllServiceTagInformationAs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAllServiceTagInformation(this SubscriptionResource subscriptionResource, AzureLocation location, bool? noAddressPrefixes = null, string tagName = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllServiceTagInformation(location, noAddressPrefixes, tagName, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetAllServiceTagInformation(location, noAddressPrefixes, tagName, cancellationToken); } /// @@ -7425,6 +8213,10 @@ public static Pageable GetAllServiceTagInformation(this S /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where resource usage is queried. @@ -7432,7 +8224,7 @@ public static Pageable GetAllServiceTagInformation(this S /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesAsync(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetUsagesAsync(location, cancellationToken); } /// @@ -7447,6 +8239,10 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionResour /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where resource usage is queried. @@ -7454,7 +8250,7 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionResour /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsages(location, cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetUsages(location, cancellationToken); } /// @@ -7469,13 +8265,17 @@ public static Pageable GetUsages(this SubscriptionResource subscri /// VirtualNetworks_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualNetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualNetworksAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualNetworksAsync(cancellationToken); } /// @@ -7490,13 +8290,17 @@ public static AsyncPageable GetVirtualNetworksAsync(this /// VirtualNetworks_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualNetworks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualNetworks(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualNetworks(cancellationToken); } /// @@ -7511,13 +8315,17 @@ public static Pageable GetVirtualNetworks(this Subscript /// VirtualNetworkTaps_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualNetworkTapsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualNetworkTapsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualNetworkTapsAsync(cancellationToken); } /// @@ -7532,13 +8340,17 @@ public static AsyncPageable GetVirtualNetworkTapsAsyn /// VirtualNetworkTaps_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualNetworkTaps(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualNetworkTaps(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualNetworkTaps(cancellationToken); } /// @@ -7553,13 +8365,17 @@ public static Pageable GetVirtualNetworkTaps(this Sub /// VirtualRouters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualRoutersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualRoutersAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualRoutersAsync(cancellationToken); } /// @@ -7574,13 +8390,17 @@ public static AsyncPageable GetVirtualRoutersAsync(this S /// VirtualRouters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualRouters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualRouters(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualRouters(cancellationToken); } /// @@ -7595,13 +8415,17 @@ public static Pageable GetVirtualRouters(this Subscriptio /// VirtualWans_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualWansAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualWansAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualWansAsync(cancellationToken); } /// @@ -7616,13 +8440,17 @@ public static AsyncPageable GetVirtualWansAsync(this Subscri /// VirtualWans_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualWans(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualWans(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualWans(cancellationToken); } /// @@ -7637,13 +8465,17 @@ public static Pageable GetVirtualWans(this SubscriptionResou /// VpnSites_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVpnSitesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVpnSitesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVpnSitesAsync(cancellationToken); } /// @@ -7658,13 +8490,17 @@ public static AsyncPageable GetVpnSitesAsync(this SubscriptionR /// VpnSites_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVpnSites(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVpnSites(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVpnSites(cancellationToken); } /// @@ -7679,13 +8515,17 @@ public static Pageable GetVpnSites(this SubscriptionResource su /// VpnServerConfigurations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVpnServerConfigurationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVpnServerConfigurationsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVpnServerConfigurationsAsync(cancellationToken); } /// @@ -7700,13 +8540,17 @@ public static AsyncPageable GetVpnServerConfigur /// VpnServerConfigurations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVpnServerConfigurations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVpnServerConfigurations(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVpnServerConfigurations(cancellationToken); } /// @@ -7721,13 +8565,17 @@ public static Pageable GetVpnServerConfiguration /// VirtualHubs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualHubsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualHubsAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualHubsAsync(cancellationToken); } /// @@ -7742,13 +8590,17 @@ public static AsyncPageable GetVirtualHubsAsync(this Subscri /// VirtualHubs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualHubs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualHubs(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVirtualHubs(cancellationToken); } /// @@ -7763,13 +8615,17 @@ public static Pageable GetVirtualHubs(this SubscriptionResou /// VpnGateways_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVpnGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVpnGatewaysAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVpnGatewaysAsync(cancellationToken); } /// @@ -7784,13 +8640,17 @@ public static AsyncPageable GetVpnGatewaysAsync(this Subscri /// VpnGateways_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVpnGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVpnGateways(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetVpnGateways(cancellationToken); } /// @@ -7805,13 +8665,17 @@ public static Pageable GetVpnGateways(this SubscriptionResou /// P2sVpnGateways_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetP2SVpnGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetP2SVpnGatewaysAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetP2SVpnGatewaysAsync(cancellationToken); } /// @@ -7826,13 +8690,17 @@ public static AsyncPageable GetP2SVpnGatewaysAsync(this S /// P2sVpnGateways_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetP2SVpnGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetP2SVpnGateways(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetP2SVpnGateways(cancellationToken); } /// @@ -7847,13 +8715,17 @@ public static Pageable GetP2SVpnGateways(this Subscriptio /// ExpressRouteGateways_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRouteGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteGatewaysAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteGatewaysAsync(cancellationToken); } /// @@ -7868,13 +8740,17 @@ public static AsyncPageable GetExpressRouteGateways /// ExpressRouteGateways_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExpressRouteGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExpressRouteGateways(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetExpressRouteGateways(cancellationToken); } /// @@ -7889,13 +8765,17 @@ public static Pageable GetExpressRouteGateways(this /// WebApplicationFirewallPolicies_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetWebApplicationFirewallPoliciesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWebApplicationFirewallPoliciesAsync(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetWebApplicationFirewallPoliciesAsync(cancellationToken); } /// @@ -7910,13 +8790,17 @@ public static AsyncPageable GetWebApplicat /// WebApplicationFirewallPolicies_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetWebApplicationFirewallPolicies(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWebApplicationFirewallPolicies(cancellationToken); + return GetMockableNetworkSubscriptionResource(subscriptionResource).GetWebApplicationFirewallPolicies(cancellationToken); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 417b8f76d9c9e..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,631 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Network.Models; - -namespace Azure.ResourceManager.Network -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _availableResourceGroupDelegationsClientDiagnostics; - private AvailableResourceGroupDelegationsRestOperations _availableResourceGroupDelegationsRestClient; - private ClientDiagnostics _availableServiceAliasesClientDiagnostics; - private AvailableServiceAliasesRestOperations _availableServiceAliasesRestClient; - private ClientDiagnostics _availablePrivateEndpointTypesClientDiagnostics; - private AvailablePrivateEndpointTypesRestOperations _availablePrivateEndpointTypesRestClient; - private ClientDiagnostics _privateLinkServicesClientDiagnostics; - private PrivateLinkServicesRestOperations _privateLinkServicesRestClient; - - /// 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 ClientDiagnostics AvailableResourceGroupDelegationsClientDiagnostics => _availableResourceGroupDelegationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableResourceGroupDelegationsRestOperations AvailableResourceGroupDelegationsRestClient => _availableResourceGroupDelegationsRestClient ??= new AvailableResourceGroupDelegationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AvailableServiceAliasesClientDiagnostics => _availableServiceAliasesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableServiceAliasesRestOperations AvailableServiceAliasesRestClient => _availableServiceAliasesRestClient ??= new AvailableServiceAliasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AvailablePrivateEndpointTypesClientDiagnostics => _availablePrivateEndpointTypesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailablePrivateEndpointTypesRestOperations AvailablePrivateEndpointTypesRestClient => _availablePrivateEndpointTypesRestClient ??= new AvailablePrivateEndpointTypesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PrivateLinkServicesClientDiagnostics => _privateLinkServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PrivateLinkServicesRestOperations PrivateLinkServicesRestClient => _privateLinkServicesRestClient ??= new PrivateLinkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ApplicationGatewayResources in the ResourceGroupResource. - /// An object representing collection of ApplicationGatewayResources and their operations over a ApplicationGatewayResource. - public virtual ApplicationGatewayCollection GetApplicationGateways() - { - return GetCachedClient(Client => new ApplicationGatewayCollection(Client, Id)); - } - - /// Gets a collection of ApplicationSecurityGroupResources in the ResourceGroupResource. - /// An object representing collection of ApplicationSecurityGroupResources and their operations over a ApplicationSecurityGroupResource. - public virtual ApplicationSecurityGroupCollection GetApplicationSecurityGroups() - { - return GetCachedClient(Client => new ApplicationSecurityGroupCollection(Client, Id)); - } - - /// Gets a collection of AzureFirewallResources in the ResourceGroupResource. - /// An object representing collection of AzureFirewallResources and their operations over a AzureFirewallResource. - public virtual AzureFirewallCollection GetAzureFirewalls() - { - return GetCachedClient(Client => new AzureFirewallCollection(Client, Id)); - } - - /// Gets a collection of BastionHostResources in the ResourceGroupResource. - /// An object representing collection of BastionHostResources and their operations over a BastionHostResource. - public virtual BastionHostCollection GetBastionHosts() - { - return GetCachedClient(Client => new BastionHostCollection(Client, Id)); - } - - /// Gets a collection of CloudServiceSwapResources in the ResourceGroupResource. - /// The name of the cloud service. - /// An object representing collection of CloudServiceSwapResources and their operations over a CloudServiceSwapResource. - public virtual CloudServiceSwapCollection GetCloudServiceSwaps(string resourceName) - { - return new CloudServiceSwapCollection(Client, Id, resourceName); - } - - /// Gets a collection of CustomIPPrefixResources in the ResourceGroupResource. - /// An object representing collection of CustomIPPrefixResources and their operations over a CustomIPPrefixResource. - public virtual CustomIPPrefixCollection GetCustomIPPrefixes() - { - return GetCachedClient(Client => new CustomIPPrefixCollection(Client, Id)); - } - - /// Gets a collection of DdosCustomPolicyResources in the ResourceGroupResource. - /// An object representing collection of DdosCustomPolicyResources and their operations over a DdosCustomPolicyResource. - public virtual DdosCustomPolicyCollection GetDdosCustomPolicies() - { - return GetCachedClient(Client => new DdosCustomPolicyCollection(Client, Id)); - } - - /// Gets a collection of DdosProtectionPlanResources in the ResourceGroupResource. - /// An object representing collection of DdosProtectionPlanResources and their operations over a DdosProtectionPlanResource. - public virtual DdosProtectionPlanCollection GetDdosProtectionPlans() - { - return GetCachedClient(Client => new DdosProtectionPlanCollection(Client, Id)); - } - - /// Gets a collection of DscpConfigurationResources in the ResourceGroupResource. - /// An object representing collection of DscpConfigurationResources and their operations over a DscpConfigurationResource. - public virtual DscpConfigurationCollection GetDscpConfigurations() - { - return GetCachedClient(Client => new DscpConfigurationCollection(Client, Id)); - } - - /// Gets a collection of ExpressRouteCircuitResources in the ResourceGroupResource. - /// An object representing collection of ExpressRouteCircuitResources and their operations over a ExpressRouteCircuitResource. - public virtual ExpressRouteCircuitCollection GetExpressRouteCircuits() - { - return GetCachedClient(Client => new ExpressRouteCircuitCollection(Client, Id)); - } - - /// Gets a collection of ExpressRouteCrossConnectionResources in the ResourceGroupResource. - /// An object representing collection of ExpressRouteCrossConnectionResources and their operations over a ExpressRouteCrossConnectionResource. - public virtual ExpressRouteCrossConnectionCollection GetExpressRouteCrossConnections() - { - return GetCachedClient(Client => new ExpressRouteCrossConnectionCollection(Client, Id)); - } - - /// Gets a collection of ExpressRoutePortResources in the ResourceGroupResource. - /// An object representing collection of ExpressRoutePortResources and their operations over a ExpressRoutePortResource. - public virtual ExpressRoutePortCollection GetExpressRoutePorts() - { - return GetCachedClient(Client => new ExpressRoutePortCollection(Client, Id)); - } - - /// Gets a collection of FirewallPolicyResources in the ResourceGroupResource. - /// An object representing collection of FirewallPolicyResources and their operations over a FirewallPolicyResource. - public virtual FirewallPolicyCollection GetFirewallPolicies() - { - return GetCachedClient(Client => new FirewallPolicyCollection(Client, Id)); - } - - /// Gets a collection of IPAllocationResources in the ResourceGroupResource. - /// An object representing collection of IPAllocationResources and their operations over a IPAllocationResource. - public virtual IPAllocationCollection GetIPAllocations() - { - return GetCachedClient(Client => new IPAllocationCollection(Client, Id)); - } - - /// Gets a collection of IPGroupResources in the ResourceGroupResource. - /// An object representing collection of IPGroupResources and their operations over a IPGroupResource. - public virtual IPGroupCollection GetIPGroups() - { - return GetCachedClient(Client => new IPGroupCollection(Client, Id)); - } - - /// Gets a collection of LoadBalancerResources in the ResourceGroupResource. - /// An object representing collection of LoadBalancerResources and their operations over a LoadBalancerResource. - public virtual LoadBalancerCollection GetLoadBalancers() - { - return GetCachedClient(Client => new LoadBalancerCollection(Client, Id)); - } - - /// Gets a collection of NatGatewayResources in the ResourceGroupResource. - /// An object representing collection of NatGatewayResources and their operations over a NatGatewayResource. - public virtual NatGatewayCollection GetNatGateways() - { - return GetCachedClient(Client => new NatGatewayCollection(Client, Id)); - } - - /// Gets a collection of NetworkInterfaceResources in the ResourceGroupResource. - /// An object representing collection of NetworkInterfaceResources and their operations over a NetworkInterfaceResource. - public virtual NetworkInterfaceCollection GetNetworkInterfaces() - { - return GetCachedClient(Client => new NetworkInterfaceCollection(Client, Id)); - } - - /// Gets a collection of NetworkManagerResources in the ResourceGroupResource. - /// An object representing collection of NetworkManagerResources and their operations over a NetworkManagerResource. - public virtual NetworkManagerCollection GetNetworkManagers() - { - return GetCachedClient(Client => new NetworkManagerCollection(Client, Id)); - } - - /// Gets a collection of NetworkProfileResources in the ResourceGroupResource. - /// An object representing collection of NetworkProfileResources and their operations over a NetworkProfileResource. - public virtual NetworkProfileCollection GetNetworkProfiles() - { - return GetCachedClient(Client => new NetworkProfileCollection(Client, Id)); - } - - /// Gets a collection of NetworkSecurityGroupResources in the ResourceGroupResource. - /// An object representing collection of NetworkSecurityGroupResources and their operations over a NetworkSecurityGroupResource. - public virtual NetworkSecurityGroupCollection GetNetworkSecurityGroups() - { - return GetCachedClient(Client => new NetworkSecurityGroupCollection(Client, Id)); - } - - /// Gets a collection of NetworkVirtualApplianceResources in the ResourceGroupResource. - /// An object representing collection of NetworkVirtualApplianceResources and their operations over a NetworkVirtualApplianceResource. - public virtual NetworkVirtualApplianceCollection GetNetworkVirtualAppliances() - { - return GetCachedClient(Client => new NetworkVirtualApplianceCollection(Client, Id)); - } - - /// Gets a collection of NetworkWatcherResources in the ResourceGroupResource. - /// An object representing collection of NetworkWatcherResources and their operations over a NetworkWatcherResource. - public virtual NetworkWatcherCollection GetNetworkWatchers() - { - return GetCachedClient(Client => new NetworkWatcherCollection(Client, Id)); - } - - /// Gets a collection of PrivateEndpointResources in the ResourceGroupResource. - /// An object representing collection of PrivateEndpointResources and their operations over a PrivateEndpointResource. - public virtual PrivateEndpointCollection GetPrivateEndpoints() - { - return GetCachedClient(Client => new PrivateEndpointCollection(Client, Id)); - } - - /// Gets a collection of PrivateLinkServiceResources in the ResourceGroupResource. - /// An object representing collection of PrivateLinkServiceResources and their operations over a PrivateLinkServiceResource. - public virtual PrivateLinkServiceCollection GetPrivateLinkServices() - { - return GetCachedClient(Client => new PrivateLinkServiceCollection(Client, Id)); - } - - /// Gets a collection of PublicIPAddressResources in the ResourceGroupResource. - /// An object representing collection of PublicIPAddressResources and their operations over a PublicIPAddressResource. - public virtual PublicIPAddressCollection GetPublicIPAddresses() - { - return GetCachedClient(Client => new PublicIPAddressCollection(Client, Id)); - } - - /// Gets a collection of PublicIPPrefixResources in the ResourceGroupResource. - /// An object representing collection of PublicIPPrefixResources and their operations over a PublicIPPrefixResource. - public virtual PublicIPPrefixCollection GetPublicIPPrefixes() - { - return GetCachedClient(Client => new PublicIPPrefixCollection(Client, Id)); - } - - /// Gets a collection of RouteFilterResources in the ResourceGroupResource. - /// An object representing collection of RouteFilterResources and their operations over a RouteFilterResource. - public virtual RouteFilterCollection GetRouteFilters() - { - return GetCachedClient(Client => new RouteFilterCollection(Client, Id)); - } - - /// Gets a collection of RouteTableResources in the ResourceGroupResource. - /// An object representing collection of RouteTableResources and their operations over a RouteTableResource. - public virtual RouteTableCollection GetRouteTables() - { - return GetCachedClient(Client => new RouteTableCollection(Client, Id)); - } - - /// Gets a collection of SecurityPartnerProviderResources in the ResourceGroupResource. - /// An object representing collection of SecurityPartnerProviderResources and their operations over a SecurityPartnerProviderResource. - public virtual SecurityPartnerProviderCollection GetSecurityPartnerProviders() - { - return GetCachedClient(Client => new SecurityPartnerProviderCollection(Client, Id)); - } - - /// Gets a collection of ServiceEndpointPolicyResources in the ResourceGroupResource. - /// An object representing collection of ServiceEndpointPolicyResources and their operations over a ServiceEndpointPolicyResource. - public virtual ServiceEndpointPolicyCollection GetServiceEndpointPolicies() - { - return GetCachedClient(Client => new ServiceEndpointPolicyCollection(Client, Id)); - } - - /// Gets a collection of VirtualNetworkResources in the ResourceGroupResource. - /// An object representing collection of VirtualNetworkResources and their operations over a VirtualNetworkResource. - public virtual VirtualNetworkCollection GetVirtualNetworks() - { - return GetCachedClient(Client => new VirtualNetworkCollection(Client, Id)); - } - - /// Gets a collection of VirtualNetworkGatewayResources in the ResourceGroupResource. - /// An object representing collection of VirtualNetworkGatewayResources and their operations over a VirtualNetworkGatewayResource. - public virtual VirtualNetworkGatewayCollection GetVirtualNetworkGateways() - { - return GetCachedClient(Client => new VirtualNetworkGatewayCollection(Client, Id)); - } - - /// Gets a collection of VirtualNetworkGatewayConnectionResources in the ResourceGroupResource. - /// An object representing collection of VirtualNetworkGatewayConnectionResources and their operations over a VirtualNetworkGatewayConnectionResource. - public virtual VirtualNetworkGatewayConnectionCollection GetVirtualNetworkGatewayConnections() - { - return GetCachedClient(Client => new VirtualNetworkGatewayConnectionCollection(Client, Id)); - } - - /// Gets a collection of LocalNetworkGatewayResources in the ResourceGroupResource. - /// An object representing collection of LocalNetworkGatewayResources and their operations over a LocalNetworkGatewayResource. - public virtual LocalNetworkGatewayCollection GetLocalNetworkGateways() - { - return GetCachedClient(Client => new LocalNetworkGatewayCollection(Client, Id)); - } - - /// Gets a collection of VirtualNetworkTapResources in the ResourceGroupResource. - /// An object representing collection of VirtualNetworkTapResources and their operations over a VirtualNetworkTapResource. - public virtual VirtualNetworkTapCollection GetVirtualNetworkTaps() - { - return GetCachedClient(Client => new VirtualNetworkTapCollection(Client, Id)); - } - - /// Gets a collection of VirtualRouterResources in the ResourceGroupResource. - /// An object representing collection of VirtualRouterResources and their operations over a VirtualRouterResource. - public virtual VirtualRouterCollection GetVirtualRouters() - { - return GetCachedClient(Client => new VirtualRouterCollection(Client, Id)); - } - - /// Gets a collection of VirtualWanResources in the ResourceGroupResource. - /// An object representing collection of VirtualWanResources and their operations over a VirtualWanResource. - public virtual VirtualWanCollection GetVirtualWans() - { - return GetCachedClient(Client => new VirtualWanCollection(Client, Id)); - } - - /// Gets a collection of VpnSiteResources in the ResourceGroupResource. - /// An object representing collection of VpnSiteResources and their operations over a VpnSiteResource. - public virtual VpnSiteCollection GetVpnSites() - { - return GetCachedClient(Client => new VpnSiteCollection(Client, Id)); - } - - /// Gets a collection of VpnServerConfigurationResources in the ResourceGroupResource. - /// An object representing collection of VpnServerConfigurationResources and their operations over a VpnServerConfigurationResource. - public virtual VpnServerConfigurationCollection GetVpnServerConfigurations() - { - return GetCachedClient(Client => new VpnServerConfigurationCollection(Client, Id)); - } - - /// Gets a collection of VirtualHubResources in the ResourceGroupResource. - /// An object representing collection of VirtualHubResources and their operations over a VirtualHubResource. - public virtual VirtualHubCollection GetVirtualHubs() - { - return GetCachedClient(Client => new VirtualHubCollection(Client, Id)); - } - - /// Gets a collection of VpnGatewayResources in the ResourceGroupResource. - /// An object representing collection of VpnGatewayResources and their operations over a VpnGatewayResource. - public virtual VpnGatewayCollection GetVpnGateways() - { - return GetCachedClient(Client => new VpnGatewayCollection(Client, Id)); - } - - /// Gets a collection of P2SVpnGatewayResources in the ResourceGroupResource. - /// An object representing collection of P2SVpnGatewayResources and their operations over a P2SVpnGatewayResource. - public virtual P2SVpnGatewayCollection GetP2SVpnGateways() - { - return GetCachedClient(Client => new P2SVpnGatewayCollection(Client, Id)); - } - - /// Gets a collection of ExpressRouteGatewayResources in the ResourceGroupResource. - /// An object representing collection of ExpressRouteGatewayResources and their operations over a ExpressRouteGatewayResource. - public virtual ExpressRouteGatewayCollection GetExpressRouteGateways() - { - return GetCachedClient(Client => new ExpressRouteGatewayCollection(Client, Id)); - } - - /// Gets a collection of WebApplicationFirewallPolicyResources in the ResourceGroupResource. - /// An object representing collection of WebApplicationFirewallPolicyResources and their operations over a WebApplicationFirewallPolicyResource. - public virtual WebApplicationFirewallPolicyCollection GetWebApplicationFirewallPolicies() - { - return GetCachedClient(Client => new WebApplicationFirewallPolicyCollection(Client, Id)); - } - - /// - /// Gets all of the available subnet delegations for this resource group in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations - /// - /// - /// Operation Id - /// AvailableResourceGroupDelegations_List - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableResourceGroupDelegationsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableResourceGroupDelegationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableResourceGroupDelegationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableDelegation.DeserializeAvailableDelegation, AvailableResourceGroupDelegationsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailableResourceGroupDelegations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all of the available subnet delegations for this resource group in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations - /// - /// - /// Operation Id - /// AvailableResourceGroupDelegations_List - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableResourceGroupDelegations(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableResourceGroupDelegationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableResourceGroupDelegationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableDelegation.DeserializeAvailableDelegation, AvailableResourceGroupDelegationsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailableResourceGroupDelegations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all available service aliases for this resource group in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases - /// - /// - /// Operation Id - /// AvailableServiceAliases_ListByResourceGroup - /// - /// - /// - /// The location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableServiceAliasesByResourceGroupAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableServiceAliasesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableServiceAliasesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableServiceAlias.DeserializeAvailableServiceAlias, AvailableServiceAliasesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailableServiceAliasesByResourceGroup", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all available service aliases for this resource group in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases - /// - /// - /// Operation Id - /// AvailableServiceAliases_ListByResourceGroup - /// - /// - /// - /// The location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableServiceAliasesByResourceGroup(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableServiceAliasesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableServiceAliasesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableServiceAlias.DeserializeAvailableServiceAlias, AvailableServiceAliasesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailableServiceAliasesByResourceGroup", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes - /// - /// - /// Operation Id - /// AvailablePrivateEndpointTypes_ListByResourceGroup - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailablePrivateEndpointTypesByResourceGroupAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailablePrivateEndpointTypesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailablePrivateEndpointTypesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailablePrivateEndpointType.DeserializeAvailablePrivateEndpointType, AvailablePrivateEndpointTypesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailablePrivateEndpointTypesByResourceGroup", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes - /// - /// - /// Operation Id - /// AvailablePrivateEndpointTypes_ListByResourceGroup - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailablePrivateEndpointTypesByResourceGroup(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailablePrivateEndpointTypesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailablePrivateEndpointTypesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailablePrivateEndpointType.DeserializeAvailablePrivateEndpointType, AvailablePrivateEndpointTypesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailablePrivateEndpointTypesByResourceGroup", "value", "nextLink", cancellationToken); - } - - /// - /// Checks whether the subscription is visible to private link service in the specified resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility - /// - /// - /// Operation Id - /// PrivateLinkServices_CheckPrivateLinkServiceVisibilityByResourceGroup - /// - /// - /// - /// 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 location of the domain name. - /// The request body of CheckPrivateLinkService API call. - /// The cancellation token to use. - public virtual async Task> CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkServiceAsync(WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) - { - using var scope = PrivateLinkServicesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService"); - scope.Start(); - try - { - var response = await PrivateLinkServicesRestClient.CheckPrivateLinkServiceVisibilityByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken).ConfigureAwait(false); - var operation = new NetworkArmOperation(new PrivateLinkServiceVisibilityOperationSource(), PrivateLinkServicesClientDiagnostics, Pipeline, PrivateLinkServicesRestClient.CreateCheckPrivateLinkServiceVisibilityByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, checkPrivateLinkServiceVisibilityRequest).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether the subscription is visible to private link service in the specified resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility - /// - /// - /// Operation Id - /// PrivateLinkServices_CheckPrivateLinkServiceVisibilityByResourceGroup - /// - /// - /// - /// 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 location of the domain name. - /// The request body of CheckPrivateLinkService API call. - /// The cancellation token to use. - public virtual ArmOperation CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService(WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) - { - using var scope = PrivateLinkServicesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckPrivateLinkServiceVisibilityByResourceGroupPrivateLinkService"); - scope.Start(); - try - { - var response = PrivateLinkServicesRestClient.CheckPrivateLinkServiceVisibilityByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken); - var operation = new NetworkArmOperation(new PrivateLinkServiceVisibilityOperationSource(), PrivateLinkServicesClientDiagnostics, Pipeline, PrivateLinkServicesRestClient.CreateCheckPrivateLinkServiceVisibilityByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, checkPrivateLinkServiceVisibilityRequest).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices - /// - /// - /// Operation Id - /// PrivateLinkServices_ListAutoApprovedPrivateLinkServicesByResourceGroup - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServicesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AutoApprovedPrivateLinkService.DeserializeAutoApprovedPrivateLinkService, PrivateLinkServicesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices - /// - /// - /// Operation Id - /// PrivateLinkServices_ListAutoApprovedPrivateLinkServicesByResourceGroup - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AutoApprovedPrivateLinkService.DeserializeAutoApprovedPrivateLinkService, PrivateLinkServicesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAutoApprovedPrivateLinkServicesByResourceGroupPrivateLinkServices", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 89496a249ba3f..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,3116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Network.Models; - -namespace Azure.ResourceManager.Network -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _applicationGatewayClientDiagnostics; - private ApplicationGatewaysRestOperations _applicationGatewayRestClient; - private ClientDiagnostics _applicationSecurityGroupClientDiagnostics; - private ApplicationSecurityGroupsRestOperations _applicationSecurityGroupRestClient; - private ClientDiagnostics _availableDelegationsClientDiagnostics; - private AvailableDelegationsRestOperations _availableDelegationsRestClient; - private ClientDiagnostics _availableServiceAliasesClientDiagnostics; - private AvailableServiceAliasesRestOperations _availableServiceAliasesRestClient; - private ClientDiagnostics _azureFirewallClientDiagnostics; - private AzureFirewallsRestOperations _azureFirewallRestClient; - private ClientDiagnostics _azureFirewallFqdnTagsClientDiagnostics; - private AzureFirewallFqdnTagsRestOperations _azureFirewallFqdnTagsRestClient; - private ClientDiagnostics _bastionHostClientDiagnostics; - private BastionHostsRestOperations _bastionHostRestClient; - private ClientDiagnostics _expressRouteProviderPortClientDiagnostics; - private NetworkManagementRestOperations _expressRouteProviderPortRestClient; - private ClientDiagnostics _customIPPrefixClientDiagnostics; - private CustomIPPrefixesRestOperations _customIPPrefixRestClient; - private ClientDiagnostics _ddosProtectionPlanClientDiagnostics; - private DdosProtectionPlansRestOperations _ddosProtectionPlanRestClient; - private ClientDiagnostics _dscpConfigurationClientDiagnostics; - private DscpConfigurationRestOperations _dscpConfigurationRestClient; - private ClientDiagnostics _availableEndpointServicesClientDiagnostics; - private AvailableEndpointServicesRestOperations _availableEndpointServicesRestClient; - private ClientDiagnostics _expressRouteCircuitClientDiagnostics; - private ExpressRouteCircuitsRestOperations _expressRouteCircuitRestClient; - private ClientDiagnostics _expressRouteServiceProvidersClientDiagnostics; - private ExpressRouteServiceProvidersRestOperations _expressRouteServiceProvidersRestClient; - private ClientDiagnostics _expressRouteCrossConnectionClientDiagnostics; - private ExpressRouteCrossConnectionsRestOperations _expressRouteCrossConnectionRestClient; - private ClientDiagnostics _expressRoutePortClientDiagnostics; - private ExpressRoutePortsRestOperations _expressRoutePortRestClient; - private ClientDiagnostics _firewallPolicyClientDiagnostics; - private FirewallPoliciesRestOperations _firewallPolicyRestClient; - private ClientDiagnostics _ipAllocationIPAllocationsClientDiagnostics; - private IpAllocationsRestOperations _ipAllocationIPAllocationsRestClient; - private ClientDiagnostics _ipGroupIPGroupsClientDiagnostics; - private IpGroupsRestOperations _ipGroupIPGroupsRestClient; - private ClientDiagnostics _loadBalancerClientDiagnostics; - private LoadBalancersRestOperations _loadBalancerRestClient; - private ClientDiagnostics _natGatewayClientDiagnostics; - private NatGatewaysRestOperations _natGatewayRestClient; - private ClientDiagnostics _networkInterfaceClientDiagnostics; - private NetworkInterfacesRestOperations _networkInterfaceRestClient; - private ClientDiagnostics _networkManagerClientDiagnostics; - private NetworkManagersRestOperations _networkManagerRestClient; - private ClientDiagnostics _networkProfileClientDiagnostics; - private NetworkProfilesRestOperations _networkProfileRestClient; - private ClientDiagnostics _networkSecurityGroupClientDiagnostics; - private NetworkSecurityGroupsRestOperations _networkSecurityGroupRestClient; - private ClientDiagnostics _networkVirtualApplianceClientDiagnostics; - private NetworkVirtualAppliancesRestOperations _networkVirtualApplianceRestClient; - private ClientDiagnostics _networkWatcherClientDiagnostics; - private NetworkWatchersRestOperations _networkWatcherRestClient; - private ClientDiagnostics _privateEndpointClientDiagnostics; - private PrivateEndpointsRestOperations _privateEndpointRestClient; - private ClientDiagnostics _availablePrivateEndpointTypesClientDiagnostics; - private AvailablePrivateEndpointTypesRestOperations _availablePrivateEndpointTypesRestClient; - private ClientDiagnostics _privateLinkServiceClientDiagnostics; - private PrivateLinkServicesRestOperations _privateLinkServiceRestClient; - private ClientDiagnostics _privateLinkServicesClientDiagnostics; - private PrivateLinkServicesRestOperations _privateLinkServicesRestClient; - private ClientDiagnostics _publicIPAddressClientDiagnostics; - private PublicIPAddressesRestOperations _publicIPAddressRestClient; - private ClientDiagnostics _publicIPPrefixClientDiagnostics; - private PublicIPPrefixesRestOperations _publicIPPrefixRestClient; - private ClientDiagnostics _routeFilterClientDiagnostics; - private RouteFiltersRestOperations _routeFilterRestClient; - private ClientDiagnostics _routeTableClientDiagnostics; - private RouteTablesRestOperations _routeTableRestClient; - private ClientDiagnostics _securityPartnerProviderClientDiagnostics; - private SecurityPartnerProvidersRestOperations _securityPartnerProviderRestClient; - private ClientDiagnostics _bgpServiceCommunitiesClientDiagnostics; - private BgpServiceCommunitiesRestOperations _bgpServiceCommunitiesRestClient; - private ClientDiagnostics _serviceEndpointPolicyClientDiagnostics; - private ServiceEndpointPoliciesRestOperations _serviceEndpointPolicyRestClient; - private ClientDiagnostics _serviceTagsClientDiagnostics; - private ServiceTagsRestOperations _serviceTagsRestClient; - private ClientDiagnostics _serviceTagInformationClientDiagnostics; - private ServiceTagInformationRestOperations _serviceTagInformationRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - private ClientDiagnostics _virtualNetworkClientDiagnostics; - private VirtualNetworksRestOperations _virtualNetworkRestClient; - private ClientDiagnostics _virtualNetworkTapClientDiagnostics; - private VirtualNetworkTapsRestOperations _virtualNetworkTapRestClient; - private ClientDiagnostics _virtualRouterClientDiagnostics; - private VirtualRoutersRestOperations _virtualRouterRestClient; - private ClientDiagnostics _virtualWanClientDiagnostics; - private VirtualWansRestOperations _virtualWanRestClient; - private ClientDiagnostics _vpnSiteClientDiagnostics; - private VpnSitesRestOperations _vpnSiteRestClient; - private ClientDiagnostics _vpnServerConfigurationClientDiagnostics; - private VpnServerConfigurationsRestOperations _vpnServerConfigurationRestClient; - private ClientDiagnostics _virtualHubClientDiagnostics; - private VirtualHubsRestOperations _virtualHubRestClient; - private ClientDiagnostics _vpnGatewayClientDiagnostics; - private VpnGatewaysRestOperations _vpnGatewayRestClient; - private ClientDiagnostics _p2sVpnGatewayP2sVpnGatewaysClientDiagnostics; - private P2SVpnGatewaysRestOperations _p2sVpnGatewayP2sVpnGatewaysRestClient; - private ClientDiagnostics _expressRouteGatewayClientDiagnostics; - private ExpressRouteGatewaysRestOperations _expressRouteGatewayRestClient; - private ClientDiagnostics _webApplicationFirewallPolicyClientDiagnostics; - private WebApplicationFirewallPoliciesRestOperations _webApplicationFirewallPolicyRestClient; - - /// 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 ApplicationGatewayClientDiagnostics => _applicationGatewayClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ApplicationGatewayResource.ResourceType.Namespace, Diagnostics); - private ApplicationGatewaysRestOperations ApplicationGatewayRestClient => _applicationGatewayRestClient ??= new ApplicationGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApplicationGatewayResource.ResourceType)); - private ClientDiagnostics ApplicationSecurityGroupClientDiagnostics => _applicationSecurityGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ApplicationSecurityGroupResource.ResourceType.Namespace, Diagnostics); - private ApplicationSecurityGroupsRestOperations ApplicationSecurityGroupRestClient => _applicationSecurityGroupRestClient ??= new ApplicationSecurityGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ApplicationSecurityGroupResource.ResourceType)); - private ClientDiagnostics AvailableDelegationsClientDiagnostics => _availableDelegationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableDelegationsRestOperations AvailableDelegationsRestClient => _availableDelegationsRestClient ??= new AvailableDelegationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AvailableServiceAliasesClientDiagnostics => _availableServiceAliasesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableServiceAliasesRestOperations AvailableServiceAliasesRestClient => _availableServiceAliasesRestClient ??= new AvailableServiceAliasesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AzureFirewallClientDiagnostics => _azureFirewallClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", AzureFirewallResource.ResourceType.Namespace, Diagnostics); - private AzureFirewallsRestOperations AzureFirewallRestClient => _azureFirewallRestClient ??= new AzureFirewallsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AzureFirewallResource.ResourceType)); - private ClientDiagnostics AzureFirewallFqdnTagsClientDiagnostics => _azureFirewallFqdnTagsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AzureFirewallFqdnTagsRestOperations AzureFirewallFqdnTagsRestClient => _azureFirewallFqdnTagsRestClient ??= new AzureFirewallFqdnTagsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BastionHostClientDiagnostics => _bastionHostClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", BastionHostResource.ResourceType.Namespace, Diagnostics); - private BastionHostsRestOperations BastionHostRestClient => _bastionHostRestClient ??= new BastionHostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BastionHostResource.ResourceType)); - private ClientDiagnostics ExpressRouteProviderPortClientDiagnostics => _expressRouteProviderPortClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRouteProviderPortResource.ResourceType.Namespace, Diagnostics); - private NetworkManagementRestOperations ExpressRouteProviderPortRestClient => _expressRouteProviderPortRestClient ??= new NetworkManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRouteProviderPortResource.ResourceType)); - private ClientDiagnostics CustomIPPrefixClientDiagnostics => _customIPPrefixClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", CustomIPPrefixResource.ResourceType.Namespace, Diagnostics); - private CustomIPPrefixesRestOperations CustomIPPrefixRestClient => _customIPPrefixRestClient ??= new CustomIPPrefixesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CustomIPPrefixResource.ResourceType)); - private ClientDiagnostics DdosProtectionPlanClientDiagnostics => _ddosProtectionPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", DdosProtectionPlanResource.ResourceType.Namespace, Diagnostics); - private DdosProtectionPlansRestOperations DdosProtectionPlanRestClient => _ddosProtectionPlanRestClient ??= new DdosProtectionPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DdosProtectionPlanResource.ResourceType)); - private ClientDiagnostics DscpConfigurationClientDiagnostics => _dscpConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", DscpConfigurationResource.ResourceType.Namespace, Diagnostics); - private DscpConfigurationRestOperations DscpConfigurationRestClient => _dscpConfigurationRestClient ??= new DscpConfigurationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DscpConfigurationResource.ResourceType)); - private ClientDiagnostics AvailableEndpointServicesClientDiagnostics => _availableEndpointServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailableEndpointServicesRestOperations AvailableEndpointServicesRestClient => _availableEndpointServicesRestClient ??= new AvailableEndpointServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ExpressRouteCircuitClientDiagnostics => _expressRouteCircuitClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRouteCircuitResource.ResourceType.Namespace, Diagnostics); - private ExpressRouteCircuitsRestOperations ExpressRouteCircuitRestClient => _expressRouteCircuitRestClient ??= new ExpressRouteCircuitsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRouteCircuitResource.ResourceType)); - private ClientDiagnostics ExpressRouteServiceProvidersClientDiagnostics => _expressRouteServiceProvidersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ExpressRouteServiceProvidersRestOperations ExpressRouteServiceProvidersRestClient => _expressRouteServiceProvidersRestClient ??= new ExpressRouteServiceProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ExpressRouteCrossConnectionClientDiagnostics => _expressRouteCrossConnectionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRouteCrossConnectionResource.ResourceType.Namespace, Diagnostics); - private ExpressRouteCrossConnectionsRestOperations ExpressRouteCrossConnectionRestClient => _expressRouteCrossConnectionRestClient ??= new ExpressRouteCrossConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRouteCrossConnectionResource.ResourceType)); - private ClientDiagnostics ExpressRoutePortClientDiagnostics => _expressRoutePortClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRoutePortResource.ResourceType.Namespace, Diagnostics); - private ExpressRoutePortsRestOperations ExpressRoutePortRestClient => _expressRoutePortRestClient ??= new ExpressRoutePortsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRoutePortResource.ResourceType)); - private ClientDiagnostics FirewallPolicyClientDiagnostics => _firewallPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", FirewallPolicyResource.ResourceType.Namespace, Diagnostics); - private FirewallPoliciesRestOperations FirewallPolicyRestClient => _firewallPolicyRestClient ??= new FirewallPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FirewallPolicyResource.ResourceType)); - private ClientDiagnostics IPAllocationIpAllocationsClientDiagnostics => _ipAllocationIPAllocationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", IPAllocationResource.ResourceType.Namespace, Diagnostics); - private IpAllocationsRestOperations IPAllocationIpAllocationsRestClient => _ipAllocationIPAllocationsRestClient ??= new IpAllocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IPAllocationResource.ResourceType)); - private ClientDiagnostics IPGroupIpGroupsClientDiagnostics => _ipGroupIPGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", IPGroupResource.ResourceType.Namespace, Diagnostics); - private IpGroupsRestOperations IPGroupIpGroupsRestClient => _ipGroupIPGroupsRestClient ??= new IpGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IPGroupResource.ResourceType)); - private ClientDiagnostics LoadBalancerClientDiagnostics => _loadBalancerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", LoadBalancerResource.ResourceType.Namespace, Diagnostics); - private LoadBalancersRestOperations LoadBalancerRestClient => _loadBalancerRestClient ??= new LoadBalancersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LoadBalancerResource.ResourceType)); - private ClientDiagnostics NatGatewayClientDiagnostics => _natGatewayClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NatGatewayResource.ResourceType.Namespace, Diagnostics); - private NatGatewaysRestOperations NatGatewayRestClient => _natGatewayRestClient ??= new NatGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NatGatewayResource.ResourceType)); - private ClientDiagnostics NetworkInterfaceClientDiagnostics => _networkInterfaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkInterfaceResource.ResourceType.Namespace, Diagnostics); - private NetworkInterfacesRestOperations NetworkInterfaceRestClient => _networkInterfaceRestClient ??= new NetworkInterfacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkInterfaceResource.ResourceType)); - private ClientDiagnostics NetworkManagerClientDiagnostics => _networkManagerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkManagerResource.ResourceType.Namespace, Diagnostics); - private NetworkManagersRestOperations NetworkManagerRestClient => _networkManagerRestClient ??= new NetworkManagersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkManagerResource.ResourceType)); - private ClientDiagnostics NetworkProfileClientDiagnostics => _networkProfileClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkProfileResource.ResourceType.Namespace, Diagnostics); - private NetworkProfilesRestOperations NetworkProfileRestClient => _networkProfileRestClient ??= new NetworkProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkProfileResource.ResourceType)); - private ClientDiagnostics NetworkSecurityGroupClientDiagnostics => _networkSecurityGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkSecurityGroupResource.ResourceType.Namespace, Diagnostics); - private NetworkSecurityGroupsRestOperations NetworkSecurityGroupRestClient => _networkSecurityGroupRestClient ??= new NetworkSecurityGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkSecurityGroupResource.ResourceType)); - private ClientDiagnostics NetworkVirtualApplianceClientDiagnostics => _networkVirtualApplianceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkVirtualApplianceResource.ResourceType.Namespace, Diagnostics); - private NetworkVirtualAppliancesRestOperations NetworkVirtualApplianceRestClient => _networkVirtualApplianceRestClient ??= new NetworkVirtualAppliancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkVirtualApplianceResource.ResourceType)); - private ClientDiagnostics NetworkWatcherClientDiagnostics => _networkWatcherClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", NetworkWatcherResource.ResourceType.Namespace, Diagnostics); - private NetworkWatchersRestOperations NetworkWatcherRestClient => _networkWatcherRestClient ??= new NetworkWatchersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkWatcherResource.ResourceType)); - private ClientDiagnostics PrivateEndpointClientDiagnostics => _privateEndpointClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", PrivateEndpointResource.ResourceType.Namespace, Diagnostics); - private PrivateEndpointsRestOperations PrivateEndpointRestClient => _privateEndpointRestClient ??= new PrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PrivateEndpointResource.ResourceType)); - private ClientDiagnostics AvailablePrivateEndpointTypesClientDiagnostics => _availablePrivateEndpointTypesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailablePrivateEndpointTypesRestOperations AvailablePrivateEndpointTypesRestClient => _availablePrivateEndpointTypesRestClient ??= new AvailablePrivateEndpointTypesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PrivateLinkServiceClientDiagnostics => _privateLinkServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", PrivateLinkServiceResource.ResourceType.Namespace, Diagnostics); - private PrivateLinkServicesRestOperations PrivateLinkServiceRestClient => _privateLinkServiceRestClient ??= new PrivateLinkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PrivateLinkServiceResource.ResourceType)); - private ClientDiagnostics PrivateLinkServicesClientDiagnostics => _privateLinkServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PrivateLinkServicesRestOperations PrivateLinkServicesRestClient => _privateLinkServicesRestClient ??= new PrivateLinkServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PublicIPAddressClientDiagnostics => _publicIPAddressClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", PublicIPAddressResource.ResourceType.Namespace, Diagnostics); - private PublicIPAddressesRestOperations PublicIPAddressRestClient => _publicIPAddressRestClient ??= new PublicIPAddressesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PublicIPAddressResource.ResourceType)); - private ClientDiagnostics PublicIPPrefixClientDiagnostics => _publicIPPrefixClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", PublicIPPrefixResource.ResourceType.Namespace, Diagnostics); - private PublicIPPrefixesRestOperations PublicIPPrefixRestClient => _publicIPPrefixRestClient ??= new PublicIPPrefixesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PublicIPPrefixResource.ResourceType)); - private ClientDiagnostics RouteFilterClientDiagnostics => _routeFilterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", RouteFilterResource.ResourceType.Namespace, Diagnostics); - private RouteFiltersRestOperations RouteFilterRestClient => _routeFilterRestClient ??= new RouteFiltersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RouteFilterResource.ResourceType)); - private ClientDiagnostics RouteTableClientDiagnostics => _routeTableClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", RouteTableResource.ResourceType.Namespace, Diagnostics); - private RouteTablesRestOperations RouteTableRestClient => _routeTableRestClient ??= new RouteTablesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RouteTableResource.ResourceType)); - private ClientDiagnostics SecurityPartnerProviderClientDiagnostics => _securityPartnerProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", SecurityPartnerProviderResource.ResourceType.Namespace, Diagnostics); - private SecurityPartnerProvidersRestOperations SecurityPartnerProviderRestClient => _securityPartnerProviderRestClient ??= new SecurityPartnerProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecurityPartnerProviderResource.ResourceType)); - private ClientDiagnostics BgpServiceCommunitiesClientDiagnostics => _bgpServiceCommunitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BgpServiceCommunitiesRestOperations BgpServiceCommunitiesRestClient => _bgpServiceCommunitiesRestClient ??= new BgpServiceCommunitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ServiceEndpointPolicyClientDiagnostics => _serviceEndpointPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ServiceEndpointPolicyResource.ResourceType.Namespace, Diagnostics); - private ServiceEndpointPoliciesRestOperations ServiceEndpointPolicyRestClient => _serviceEndpointPolicyRestClient ??= new ServiceEndpointPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceEndpointPolicyResource.ResourceType)); - private ClientDiagnostics ServiceTagsClientDiagnostics => _serviceTagsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ServiceTagsRestOperations ServiceTagsRestClient => _serviceTagsRestClient ??= new ServiceTagsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ServiceTagInformationClientDiagnostics => _serviceTagInformationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ServiceTagInformationRestOperations ServiceTagInformationRestClient => _serviceTagInformationRestClient ??= new ServiceTagInformationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics VirtualNetworkClientDiagnostics => _virtualNetworkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualNetworkResource.ResourceType.Namespace, Diagnostics); - private VirtualNetworksRestOperations VirtualNetworkRestClient => _virtualNetworkRestClient ??= new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualNetworkResource.ResourceType)); - private ClientDiagnostics VirtualNetworkTapClientDiagnostics => _virtualNetworkTapClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualNetworkTapResource.ResourceType.Namespace, Diagnostics); - private VirtualNetworkTapsRestOperations VirtualNetworkTapRestClient => _virtualNetworkTapRestClient ??= new VirtualNetworkTapsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualNetworkTapResource.ResourceType)); - private ClientDiagnostics VirtualRouterClientDiagnostics => _virtualRouterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualRouterResource.ResourceType.Namespace, Diagnostics); - private VirtualRoutersRestOperations VirtualRouterRestClient => _virtualRouterRestClient ??= new VirtualRoutersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualRouterResource.ResourceType)); - private ClientDiagnostics VirtualWanClientDiagnostics => _virtualWanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualWanResource.ResourceType.Namespace, Diagnostics); - private VirtualWansRestOperations VirtualWanRestClient => _virtualWanRestClient ??= new VirtualWansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualWanResource.ResourceType)); - private ClientDiagnostics VpnSiteClientDiagnostics => _vpnSiteClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VpnSiteResource.ResourceType.Namespace, Diagnostics); - private VpnSitesRestOperations VpnSiteRestClient => _vpnSiteRestClient ??= new VpnSitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VpnSiteResource.ResourceType)); - private ClientDiagnostics VpnServerConfigurationClientDiagnostics => _vpnServerConfigurationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VpnServerConfigurationResource.ResourceType.Namespace, Diagnostics); - private VpnServerConfigurationsRestOperations VpnServerConfigurationRestClient => _vpnServerConfigurationRestClient ??= new VpnServerConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VpnServerConfigurationResource.ResourceType)); - private ClientDiagnostics VirtualHubClientDiagnostics => _virtualHubClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VirtualHubResource.ResourceType.Namespace, Diagnostics); - private VirtualHubsRestOperations VirtualHubRestClient => _virtualHubRestClient ??= new VirtualHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualHubResource.ResourceType)); - private ClientDiagnostics VpnGatewayClientDiagnostics => _vpnGatewayClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", VpnGatewayResource.ResourceType.Namespace, Diagnostics); - private VpnGatewaysRestOperations VpnGatewayRestClient => _vpnGatewayRestClient ??= new VpnGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VpnGatewayResource.ResourceType)); - private ClientDiagnostics P2SVpnGatewayP2sVpnGatewaysClientDiagnostics => _p2sVpnGatewayP2sVpnGatewaysClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", P2SVpnGatewayResource.ResourceType.Namespace, Diagnostics); - private P2SVpnGatewaysRestOperations P2SVpnGatewayP2sVpnGatewaysRestClient => _p2sVpnGatewayP2sVpnGatewaysRestClient ??= new P2SVpnGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(P2SVpnGatewayResource.ResourceType)); - private ClientDiagnostics ExpressRouteGatewayClientDiagnostics => _expressRouteGatewayClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", ExpressRouteGatewayResource.ResourceType.Namespace, Diagnostics); - private ExpressRouteGatewaysRestOperations ExpressRouteGatewayRestClient => _expressRouteGatewayRestClient ??= new ExpressRouteGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ExpressRouteGatewayResource.ResourceType)); - private ClientDiagnostics WebApplicationFirewallPolicyClientDiagnostics => _webApplicationFirewallPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Network", WebApplicationFirewallPolicyResource.ResourceType.Namespace, Diagnostics); - private WebApplicationFirewallPoliciesRestOperations WebApplicationFirewallPolicyRestClient => _webApplicationFirewallPolicyRestClient ??= new WebApplicationFirewallPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WebApplicationFirewallPolicyResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ApplicationGatewayWafDynamicManifestResources in the SubscriptionResource. - /// The region where the nrp are located at. - /// An object representing collection of ApplicationGatewayWafDynamicManifestResources and their operations over a ApplicationGatewayWafDynamicManifestResource. - public virtual ApplicationGatewayWafDynamicManifestCollection GetApplicationGatewayWafDynamicManifests(AzureLocation location) - { - return new ApplicationGatewayWafDynamicManifestCollection(Client, Id, location); - } - - /// Gets a collection of AzureWebCategoryResources in the SubscriptionResource. - /// An object representing collection of AzureWebCategoryResources and their operations over a AzureWebCategoryResource. - public virtual AzureWebCategoryCollection GetAzureWebCategories() - { - return GetCachedClient(Client => new AzureWebCategoryCollection(Client, Id)); - } - - /// Gets a collection of ExpressRouteProviderPortResources in the SubscriptionResource. - /// An object representing collection of ExpressRouteProviderPortResources and their operations over a ExpressRouteProviderPortResource. - public virtual ExpressRouteProviderPortCollection GetExpressRouteProviderPorts() - { - return GetCachedClient(Client => new ExpressRouteProviderPortCollection(Client, Id)); - } - - /// Gets a collection of ExpressRoutePortsLocationResources in the SubscriptionResource. - /// An object representing collection of ExpressRoutePortsLocationResources and their operations over a ExpressRoutePortsLocationResource. - public virtual ExpressRoutePortsLocationCollection GetExpressRoutePortsLocations() - { - return GetCachedClient(Client => new ExpressRoutePortsLocationCollection(Client, Id)); - } - - /// Gets a collection of SubscriptionNetworkManagerConnectionResources in the SubscriptionResource. - /// An object representing collection of SubscriptionNetworkManagerConnectionResources and their operations over a SubscriptionNetworkManagerConnectionResource. - public virtual SubscriptionNetworkManagerConnectionCollection GetSubscriptionNetworkManagerConnections() - { - return GetCachedClient(Client => new SubscriptionNetworkManagerConnectionCollection(Client, Id)); - } - - /// Gets a collection of NetworkVirtualApplianceSkuResources in the SubscriptionResource. - /// An object representing collection of NetworkVirtualApplianceSkuResources and their operations over a NetworkVirtualApplianceSkuResource. - public virtual NetworkVirtualApplianceSkuCollection GetNetworkVirtualApplianceSkus() - { - return GetCachedClient(Client => new NetworkVirtualApplianceSkuCollection(Client, Id)); - } - - /// - /// Gets all the application gateways in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways - /// - /// - /// Operation Id - /// ApplicationGateways_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApplicationGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationGatewayRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApplicationGatewayResource(Client, ApplicationGatewayData.DeserializeApplicationGatewayData(e)), ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the application gateways in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways - /// - /// - /// Operation Id - /// ApplicationGateways_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApplicationGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationGatewayRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApplicationGatewayResource(Client, ApplicationGatewayData.DeserializeApplicationGatewayData(e)), ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all available server variables. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableServerVariables - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableServerVariablesApplicationGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableServerVariablesRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableServerVariablesApplicationGateways", "", null, cancellationToken); - } - - /// - /// Lists all available server variables. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableServerVariables - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableServerVariablesApplicationGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableServerVariablesRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableServerVariablesApplicationGateways", "", null, cancellationToken); - } - - /// - /// Lists all available request headers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableRequestHeaders - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableRequestHeadersApplicationGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableRequestHeadersRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableRequestHeadersApplicationGateways", "", null, cancellationToken); - } - - /// - /// Lists all available request headers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableRequestHeaders - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableRequestHeadersApplicationGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableRequestHeadersRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableRequestHeadersApplicationGateways", "", null, cancellationToken); - } - - /// - /// Lists all available response headers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableResponseHeaders - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableResponseHeadersApplicationGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableResponseHeadersRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableResponseHeadersApplicationGateways", "", null, cancellationToken); - } - - /// - /// Lists all available response headers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableResponseHeaders - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableResponseHeadersApplicationGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableResponseHeadersRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => e.GetString(), ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableResponseHeadersApplicationGateways", "", null, cancellationToken); - } - - /// - /// Lists all available web application firewall rule sets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableWafRuleSets - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppGatewayAvailableWafRuleSetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableWafRuleSetsRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ApplicationGatewayFirewallRuleSet.DeserializeApplicationGatewayFirewallRuleSet, ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppGatewayAvailableWafRuleSets", "value", null, cancellationToken); - } - - /// - /// Lists all available web application firewall rule sets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableWafRuleSets - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppGatewayAvailableWafRuleSets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableWafRuleSetsRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ApplicationGatewayFirewallRuleSet.DeserializeApplicationGatewayFirewallRuleSet, ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppGatewayAvailableWafRuleSets", "value", null, cancellationToken); - } - - /// - /// Lists available Ssl options for configuring Ssl policy. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableSslOptions - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetApplicationGatewayAvailableSslOptionsAsync(CancellationToken cancellationToken = default) - { - using var scope = ApplicationGatewayClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetApplicationGatewayAvailableSslOptions"); - scope.Start(); - try - { - var response = await ApplicationGatewayRestClient.ListAvailableSslOptionsAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists available Ssl options for configuring Ssl policy. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableSslOptions - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetApplicationGatewayAvailableSslOptions(CancellationToken cancellationToken = default) - { - using var scope = ApplicationGatewayClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetApplicationGatewayAvailableSslOptions"); - scope.Start(); - try - { - var response = ApplicationGatewayRestClient.ListAvailableSslOptions(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all SSL predefined policies for configuring Ssl policy. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableSslPredefinedPolicies - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApplicationGatewayAvailableSslPredefinedPoliciesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableSslPredefinedPoliciesRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationGatewayRestClient.CreateListAvailableSslPredefinedPoliciesNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApplicationGatewaySslPredefinedPolicy.DeserializeApplicationGatewaySslPredefinedPolicy, ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationGatewayAvailableSslPredefinedPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all SSL predefined policies for configuring Ssl policy. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies - /// - /// - /// Operation Id - /// ApplicationGateways_ListAvailableSslPredefinedPolicies - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApplicationGatewayAvailableSslPredefinedPolicies(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationGatewayRestClient.CreateListAvailableSslPredefinedPoliciesRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationGatewayRestClient.CreateListAvailableSslPredefinedPoliciesNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApplicationGatewaySslPredefinedPolicy.DeserializeApplicationGatewaySslPredefinedPolicy, ApplicationGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationGatewayAvailableSslPredefinedPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Gets Ssl predefined policy with the specified policy name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName} - /// - /// - /// Operation Id - /// ApplicationGateways_GetSslPredefinedPolicy - /// - /// - /// - /// Name of Ssl predefined policy. - /// The cancellation token to use. - public virtual async Task> GetApplicationGatewaySslPredefinedPolicyAsync(string predefinedPolicyName, CancellationToken cancellationToken = default) - { - using var scope = ApplicationGatewayClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetApplicationGatewaySslPredefinedPolicy"); - scope.Start(); - try - { - var response = await ApplicationGatewayRestClient.GetSslPredefinedPolicyAsync(Id.SubscriptionId, predefinedPolicyName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets Ssl predefined policy with the specified policy name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName} - /// - /// - /// Operation Id - /// ApplicationGateways_GetSslPredefinedPolicy - /// - /// - /// - /// Name of Ssl predefined policy. - /// The cancellation token to use. - public virtual Response GetApplicationGatewaySslPredefinedPolicy(string predefinedPolicyName, CancellationToken cancellationToken = default) - { - using var scope = ApplicationGatewayClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetApplicationGatewaySslPredefinedPolicy"); - scope.Start(); - try - { - var response = ApplicationGatewayRestClient.GetSslPredefinedPolicy(Id.SubscriptionId, predefinedPolicyName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets all application security groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups - /// - /// - /// Operation Id - /// ApplicationSecurityGroups_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApplicationSecurityGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationSecurityGroupRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationSecurityGroupRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ApplicationSecurityGroupResource(Client, ApplicationSecurityGroupData.DeserializeApplicationSecurityGroupData(e)), ApplicationSecurityGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationSecurityGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all application security groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups - /// - /// - /// Operation Id - /// ApplicationSecurityGroups_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApplicationSecurityGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ApplicationSecurityGroupRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ApplicationSecurityGroupRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ApplicationSecurityGroupResource(Client, ApplicationSecurityGroupData.DeserializeApplicationSecurityGroupData(e)), ApplicationSecurityGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetApplicationSecurityGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all of the available subnet delegations for this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations - /// - /// - /// Operation Id - /// AvailableDelegations_List - /// - /// - /// - /// The location of the subnet. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableDelegationsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableDelegationsRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableDelegationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableDelegation.DeserializeAvailableDelegation, AvailableDelegationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableDelegations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all of the available subnet delegations for this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations - /// - /// - /// Operation Id - /// AvailableDelegations_List - /// - /// - /// - /// The location of the subnet. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableDelegations(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableDelegationsRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableDelegationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableDelegation.DeserializeAvailableDelegation, AvailableDelegationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableDelegations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all available service aliases for this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases - /// - /// - /// Operation Id - /// AvailableServiceAliases_List - /// - /// - /// - /// The location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableServiceAliasesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableServiceAliasesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableServiceAliasesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailableServiceAlias.DeserializeAvailableServiceAlias, AvailableServiceAliasesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableServiceAliases", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all available service aliases for this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases - /// - /// - /// Operation Id - /// AvailableServiceAliases_List - /// - /// - /// - /// The location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableServiceAliases(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableServiceAliasesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableServiceAliasesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailableServiceAlias.DeserializeAvailableServiceAlias, AvailableServiceAliasesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableServiceAliases", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Azure Firewalls in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls - /// - /// - /// Operation Id - /// AzureFirewalls_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAzureFirewallsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzureFirewallRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureFirewallRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AzureFirewallResource(Client, AzureFirewallData.DeserializeAzureFirewallData(e)), AzureFirewallClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAzureFirewalls", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Azure Firewalls in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls - /// - /// - /// Operation Id - /// AzureFirewalls_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAzureFirewalls(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzureFirewallRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureFirewallRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AzureFirewallResource(Client, AzureFirewallData.DeserializeAzureFirewallData(e)), AzureFirewallClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAzureFirewalls", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Azure Firewall FQDN Tags in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags - /// - /// - /// Operation Id - /// AzureFirewallFqdnTags_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAzureFirewallFqdnTagsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzureFirewallFqdnTagsRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureFirewallFqdnTagsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AzureFirewallFqdnTag.DeserializeAzureFirewallFqdnTag, AzureFirewallFqdnTagsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAzureFirewallFqdnTags", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Azure Firewall FQDN Tags in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags - /// - /// - /// Operation Id - /// AzureFirewallFqdnTags_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAzureFirewallFqdnTags(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzureFirewallFqdnTagsRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureFirewallFqdnTagsRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AzureFirewallFqdnTag.DeserializeAzureFirewallFqdnTag, AzureFirewallFqdnTagsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAzureFirewallFqdnTags", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all Bastion Hosts in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts - /// - /// - /// Operation Id - /// BastionHosts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBastionHostsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BastionHostRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BastionHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BastionHostResource(Client, BastionHostData.DeserializeBastionHostData(e)), BastionHostClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBastionHosts", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all Bastion Hosts in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts - /// - /// - /// Operation Id - /// BastionHosts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBastionHosts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BastionHostRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BastionHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BastionHostResource(Client, BastionHostData.DeserializeBastionHostData(e)), BastionHostClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBastionHosts", "value", "nextLink", cancellationToken); - } - - /// - /// Checks whether a domain name in the cloudapp.azure.com zone is available for use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability - /// - /// - /// Operation Id - /// CheckDnsNameAvailability - /// - /// - /// - /// The location of the domain name. - /// The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. - /// The cancellation token to use. - public virtual async Task> CheckDnsNameAvailabilityAsync(AzureLocation location, string domainNameLabel, CancellationToken cancellationToken = default) - { - using var scope = ExpressRouteProviderPortClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDnsNameAvailability"); - scope.Start(); - try - { - var response = await ExpressRouteProviderPortRestClient.CheckDnsNameAvailabilityAsync(Id.SubscriptionId, location, domainNameLabel, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether a domain name in the cloudapp.azure.com zone is available for use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability - /// - /// - /// Operation Id - /// CheckDnsNameAvailability - /// - /// - /// - /// The location of the domain name. - /// The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. - /// The cancellation token to use. - public virtual Response CheckDnsNameAvailability(AzureLocation location, string domainNameLabel, CancellationToken cancellationToken = default) - { - using var scope = ExpressRouteProviderPortClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDnsNameAvailability"); - scope.Start(); - try - { - var response = ExpressRouteProviderPortRestClient.CheckDnsNameAvailability(Id.SubscriptionId, location, domainNameLabel, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets all the custom IP prefixes in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes - /// - /// - /// Operation Id - /// CustomIPPrefixes_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCustomIPPrefixesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CustomIPPrefixRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomIPPrefixRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CustomIPPrefixResource(Client, CustomIPPrefixData.DeserializeCustomIPPrefixData(e)), CustomIPPrefixClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCustomIPPrefixes", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the custom IP prefixes in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes - /// - /// - /// Operation Id - /// CustomIPPrefixes_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCustomIPPrefixes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CustomIPPrefixRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomIPPrefixRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CustomIPPrefixResource(Client, CustomIPPrefixData.DeserializeCustomIPPrefixData(e)), CustomIPPrefixClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCustomIPPrefixes", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all DDoS protection plans in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans - /// - /// - /// Operation Id - /// DdosProtectionPlans_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDdosProtectionPlansAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DdosProtectionPlanRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DdosProtectionPlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DdosProtectionPlanResource(Client, DdosProtectionPlanData.DeserializeDdosProtectionPlanData(e)), DdosProtectionPlanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDdosProtectionPlans", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all DDoS protection plans in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans - /// - /// - /// Operation Id - /// DdosProtectionPlans_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDdosProtectionPlans(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DdosProtectionPlanRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DdosProtectionPlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DdosProtectionPlanResource(Client, DdosProtectionPlanData.DeserializeDdosProtectionPlanData(e)), DdosProtectionPlanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDdosProtectionPlans", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all dscp configurations in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations - /// - /// - /// Operation Id - /// DscpConfiguration_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDscpConfigurationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DscpConfigurationRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DscpConfigurationRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DscpConfigurationResource(Client, DscpConfigurationData.DeserializeDscpConfigurationData(e)), DscpConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDscpConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all dscp configurations in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations - /// - /// - /// Operation Id - /// DscpConfiguration_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDscpConfigurations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DscpConfigurationRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DscpConfigurationRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DscpConfigurationResource(Client, DscpConfigurationData.DeserializeDscpConfigurationData(e)), DscpConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDscpConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// List what values of endpoint services are available for use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices - /// - /// - /// Operation Id - /// AvailableEndpointServices_List - /// - /// - /// - /// The location to check available endpoint services. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableEndpointServicesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableEndpointServicesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableEndpointServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EndpointServiceResult.DeserializeEndpointServiceResult, AvailableEndpointServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableEndpointServices", "value", "nextLink", cancellationToken); - } - - /// - /// List what values of endpoint services are available for use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices - /// - /// - /// Operation Id - /// AvailableEndpointServices_List - /// - /// - /// - /// The location to check available endpoint services. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableEndpointServices(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailableEndpointServicesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailableEndpointServicesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EndpointServiceResult.DeserializeEndpointServiceResult, AvailableEndpointServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableEndpointServices", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the express route circuits in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits - /// - /// - /// Operation Id - /// ExpressRouteCircuits_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetExpressRouteCircuitsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteCircuitRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteCircuitRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteCircuitResource(Client, ExpressRouteCircuitData.DeserializeExpressRouteCircuitData(e)), ExpressRouteCircuitClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRouteCircuits", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the express route circuits in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits - /// - /// - /// Operation Id - /// ExpressRouteCircuits_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetExpressRouteCircuits(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteCircuitRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteCircuitRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteCircuitResource(Client, ExpressRouteCircuitData.DeserializeExpressRouteCircuitData(e)), ExpressRouteCircuitClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRouteCircuits", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the available express route service providers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders - /// - /// - /// Operation Id - /// ExpressRouteServiceProviders_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetExpressRouteServiceProvidersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteServiceProvidersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteServiceProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ExpressRouteServiceProvider.DeserializeExpressRouteServiceProvider, ExpressRouteServiceProvidersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRouteServiceProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the available express route service providers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders - /// - /// - /// Operation Id - /// ExpressRouteServiceProviders_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetExpressRouteServiceProviders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteServiceProvidersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteServiceProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ExpressRouteServiceProvider.DeserializeExpressRouteServiceProvider, ExpressRouteServiceProvidersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRouteServiceProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieves all the ExpressRouteCrossConnections in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections - /// - /// - /// Operation Id - /// ExpressRouteCrossConnections_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetExpressRouteCrossConnectionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteCrossConnectionRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteCrossConnectionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteCrossConnectionResource(Client, ExpressRouteCrossConnectionData.DeserializeExpressRouteCrossConnectionData(e)), ExpressRouteCrossConnectionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRouteCrossConnections", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieves all the ExpressRouteCrossConnections in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections - /// - /// - /// Operation Id - /// ExpressRouteCrossConnections_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetExpressRouteCrossConnections(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteCrossConnectionRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRouteCrossConnectionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExpressRouteCrossConnectionResource(Client, ExpressRouteCrossConnectionData.DeserializeExpressRouteCrossConnectionData(e)), ExpressRouteCrossConnectionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRouteCrossConnections", "value", "nextLink", cancellationToken); - } - - /// - /// List all the ExpressRoutePort resources in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts - /// - /// - /// Operation Id - /// ExpressRoutePorts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetExpressRoutePortsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRoutePortRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRoutePortRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ExpressRoutePortResource(Client, ExpressRoutePortData.DeserializeExpressRoutePortData(e)), ExpressRoutePortClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRoutePorts", "value", "nextLink", cancellationToken); - } - - /// - /// List all the ExpressRoutePort resources in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts - /// - /// - /// Operation Id - /// ExpressRoutePorts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetExpressRoutePorts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRoutePortRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExpressRoutePortRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ExpressRoutePortResource(Client, ExpressRoutePortData.DeserializeExpressRoutePortData(e)), ExpressRoutePortClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRoutePorts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Firewall Policies in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies - /// - /// - /// Operation Id - /// FirewallPolicies_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetFirewallPoliciesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FirewallPolicyRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FirewallPolicyRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FirewallPolicyResource(Client, FirewallPolicyData.DeserializeFirewallPolicyData(e)), FirewallPolicyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFirewallPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Firewall Policies in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies - /// - /// - /// Operation Id - /// FirewallPolicies_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetFirewallPolicies(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => FirewallPolicyRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FirewallPolicyRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FirewallPolicyResource(Client, FirewallPolicyData.DeserializeFirewallPolicyData(e)), FirewallPolicyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetFirewallPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all IpAllocations in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations - /// - /// - /// Operation Id - /// IpAllocations_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetIPAllocationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IPAllocationIpAllocationsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IPAllocationIpAllocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IPAllocationResource(Client, IPAllocationData.DeserializeIPAllocationData(e)), IPAllocationIpAllocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIPAllocations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all IpAllocations in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations - /// - /// - /// Operation Id - /// IpAllocations_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetIPAllocations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IPAllocationIpAllocationsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IPAllocationIpAllocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IPAllocationResource(Client, IPAllocationData.DeserializeIPAllocationData(e)), IPAllocationIpAllocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIPAllocations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all IpGroups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups - /// - /// - /// Operation Id - /// IpGroups_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetIPGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IPGroupIpGroupsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IPGroupIpGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IPGroupResource(Client, IPGroupData.DeserializeIPGroupData(e)), IPGroupIpGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIPGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all IpGroups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups - /// - /// - /// Operation Id - /// IpGroups_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetIPGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IPGroupIpGroupsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IPGroupIpGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IPGroupResource(Client, IPGroupData.DeserializeIPGroupData(e)), IPGroupIpGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIPGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the load balancers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers - /// - /// - /// Operation Id - /// LoadBalancers_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLoadBalancersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LoadBalancerRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LoadBalancerRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LoadBalancerResource(Client, LoadBalancerData.DeserializeLoadBalancerData(e)), LoadBalancerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLoadBalancers", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the load balancers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers - /// - /// - /// Operation Id - /// LoadBalancers_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLoadBalancers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LoadBalancerRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LoadBalancerRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LoadBalancerResource(Client, LoadBalancerData.DeserializeLoadBalancerData(e)), LoadBalancerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLoadBalancers", "value", "nextLink", cancellationToken); - } - - /// - /// Swaps VIPs between two load balancers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses - /// - /// - /// Operation Id - /// LoadBalancers_SwapPublicIpAddresses - /// - /// - /// - /// 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 region where load balancers are located at. - /// Parameters that define which VIPs should be swapped. - /// The cancellation token to use. - public virtual async Task SwapPublicIPAddressesLoadBalancerAsync(WaitUntil waitUntil, AzureLocation location, LoadBalancerVipSwapContent content, CancellationToken cancellationToken = default) - { - using var scope = LoadBalancerClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SwapPublicIPAddressesLoadBalancer"); - scope.Start(); - try - { - var response = await LoadBalancerRestClient.SwapPublicIPAddressesAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - var operation = new NetworkArmOperation(LoadBalancerClientDiagnostics, Pipeline, LoadBalancerRestClient.CreateSwapPublicIPAddressesRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Swaps VIPs between two load balancers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses - /// - /// - /// Operation Id - /// LoadBalancers_SwapPublicIpAddresses - /// - /// - /// - /// 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 region where load balancers are located at. - /// Parameters that define which VIPs should be swapped. - /// The cancellation token to use. - public virtual ArmOperation SwapPublicIPAddressesLoadBalancer(WaitUntil waitUntil, AzureLocation location, LoadBalancerVipSwapContent content, CancellationToken cancellationToken = default) - { - using var scope = LoadBalancerClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SwapPublicIPAddressesLoadBalancer"); - scope.Start(); - try - { - var response = LoadBalancerRestClient.SwapPublicIPAddresses(Id.SubscriptionId, location, content, cancellationToken); - var operation = new NetworkArmOperation(LoadBalancerClientDiagnostics, Pipeline, LoadBalancerRestClient.CreateSwapPublicIPAddressesRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets all the Nat Gateways in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways - /// - /// - /// Operation Id - /// NatGateways_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNatGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NatGatewayRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NatGatewayRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NatGatewayResource(Client, NatGatewayData.DeserializeNatGatewayData(e)), NatGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNatGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Nat Gateways in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways - /// - /// - /// Operation Id - /// NatGateways_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNatGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NatGatewayRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NatGatewayRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NatGatewayResource(Client, NatGatewayData.DeserializeNatGatewayData(e)), NatGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNatGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all network interfaces in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces - /// - /// - /// Operation Id - /// NetworkInterfaces_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkInterfacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkInterfaceRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkInterfaceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkInterfaceResource(Client, NetworkInterfaceData.DeserializeNetworkInterfaceData(e)), NetworkInterfaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkInterfaces", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all network interfaces in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces - /// - /// - /// Operation Id - /// NetworkInterfaces_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkInterfaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkInterfaceRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkInterfaceRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkInterfaceResource(Client, NetworkInterfaceData.DeserializeNetworkInterfaceData(e)), NetworkInterfaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkInterfaces", "value", "nextLink", cancellationToken); - } - - /// - /// List all network managers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers - /// - /// - /// Operation Id - /// NetworkManagers_ListBySubscription - /// - /// - /// - /// An optional query parameter which specifies the maximum number of records to be returned by the server. - /// SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkManagersAsync(int? top = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkManagerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkManagerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkManagerResource(Client, NetworkManagerData.DeserializeNetworkManagerData(e)), NetworkManagerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkManagers", "value", "nextLink", cancellationToken); - } - - /// - /// List all network managers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagers - /// - /// - /// Operation Id - /// NetworkManagers_ListBySubscription - /// - /// - /// - /// An optional query parameter which specifies the maximum number of records to be returned by the server. - /// SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkManagers(int? top = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkManagerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkManagerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkManagerResource(Client, NetworkManagerData.DeserializeNetworkManagerData(e)), NetworkManagerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkManagers", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the network profiles in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles - /// - /// - /// Operation Id - /// NetworkProfiles_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkProfilesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkProfileRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkProfileRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkProfileResource(Client, NetworkProfileData.DeserializeNetworkProfileData(e)), NetworkProfileClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkProfiles", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the network profiles in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles - /// - /// - /// Operation Id - /// NetworkProfiles_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkProfiles(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkProfileRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkProfileRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkProfileResource(Client, NetworkProfileData.DeserializeNetworkProfileData(e)), NetworkProfileClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkProfiles", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all network security groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups - /// - /// - /// Operation Id - /// NetworkSecurityGroups_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkSecurityGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkSecurityGroupRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkSecurityGroupRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkSecurityGroupResource(Client, NetworkSecurityGroupData.DeserializeNetworkSecurityGroupData(e)), NetworkSecurityGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkSecurityGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all network security groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups - /// - /// - /// Operation Id - /// NetworkSecurityGroups_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkSecurityGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkSecurityGroupRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkSecurityGroupRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkSecurityGroupResource(Client, NetworkSecurityGroupData.DeserializeNetworkSecurityGroupData(e)), NetworkSecurityGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkSecurityGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all Network Virtual Appliances in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances - /// - /// - /// Operation Id - /// NetworkVirtualAppliances_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkVirtualAppliancesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkVirtualApplianceRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkVirtualApplianceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkVirtualApplianceResource(Client, NetworkVirtualApplianceData.DeserializeNetworkVirtualApplianceData(e)), NetworkVirtualApplianceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkVirtualAppliances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all Network Virtual Appliances in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances - /// - /// - /// Operation Id - /// NetworkVirtualAppliances_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkVirtualAppliances(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkVirtualApplianceRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkVirtualApplianceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkVirtualApplianceResource(Client, NetworkVirtualApplianceData.DeserializeNetworkVirtualApplianceData(e)), NetworkVirtualApplianceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkVirtualAppliances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all network watchers by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers - /// - /// - /// Operation Id - /// NetworkWatchers_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkWatchersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkWatcherRestClient.CreateListAllRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new NetworkWatcherResource(Client, NetworkWatcherData.DeserializeNetworkWatcherData(e)), NetworkWatcherClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkWatchers", "value", null, cancellationToken); - } - - /// - /// Gets all network watchers by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers - /// - /// - /// Operation Id - /// NetworkWatchers_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkWatchers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkWatcherRestClient.CreateListAllRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new NetworkWatcherResource(Client, NetworkWatcherData.DeserializeNetworkWatcherData(e)), NetworkWatcherClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkWatchers", "value", null, cancellationToken); - } - - /// - /// Gets all private endpoints in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints - /// - /// - /// Operation Id - /// PrivateEndpoints_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateEndpointsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateEndpointRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateEndpointRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PrivateEndpointResource(Client, PrivateEndpointData.DeserializePrivateEndpointData(e)), PrivateEndpointClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPrivateEndpoints", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all private endpoints in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints - /// - /// - /// Operation Id - /// PrivateEndpoints_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateEndpoints(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateEndpointRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateEndpointRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PrivateEndpointResource(Client, PrivateEndpointData.DeserializePrivateEndpointData(e)), PrivateEndpointClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPrivateEndpoints", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes - /// - /// - /// Operation Id - /// AvailablePrivateEndpointTypes_List - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailablePrivateEndpointTypesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailablePrivateEndpointTypesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailablePrivateEndpointTypesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AvailablePrivateEndpointType.DeserializeAvailablePrivateEndpointType, AvailablePrivateEndpointTypesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailablePrivateEndpointTypes", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes - /// - /// - /// Operation Id - /// AvailablePrivateEndpointTypes_List - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailablePrivateEndpointTypes(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailablePrivateEndpointTypesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailablePrivateEndpointTypesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AvailablePrivateEndpointType.DeserializeAvailablePrivateEndpointType, AvailablePrivateEndpointTypesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailablePrivateEndpointTypes", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all private link service in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices - /// - /// - /// Operation Id - /// PrivateLinkServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateLinkServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PrivateLinkServiceResource(Client, PrivateLinkServiceData.DeserializePrivateLinkServiceData(e)), PrivateLinkServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPrivateLinkServices", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all private link service in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices - /// - /// - /// Operation Id - /// PrivateLinkServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateLinkServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PrivateLinkServiceResource(Client, PrivateLinkServiceData.DeserializePrivateLinkServiceData(e)), PrivateLinkServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPrivateLinkServices", "value", "nextLink", cancellationToken); - } - - /// - /// Checks whether the subscription is visible to private link service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility - /// - /// - /// Operation Id - /// PrivateLinkServices_CheckPrivateLinkServiceVisibility - /// - /// - /// - /// 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 location of the domain name. - /// The request body of CheckPrivateLinkService API call. - /// The cancellation token to use. - public virtual async Task> CheckPrivateLinkServiceVisibilityPrivateLinkServiceAsync(WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) - { - using var scope = PrivateLinkServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPrivateLinkServiceVisibilityPrivateLinkService"); - scope.Start(); - try - { - var response = await PrivateLinkServicesRestClient.CheckPrivateLinkServiceVisibilityAsync(Id.SubscriptionId, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken).ConfigureAwait(false); - var operation = new NetworkArmOperation(new PrivateLinkServiceVisibilityOperationSource(), PrivateLinkServicesClientDiagnostics, Pipeline, PrivateLinkServicesRestClient.CreateCheckPrivateLinkServiceVisibilityRequest(Id.SubscriptionId, location, checkPrivateLinkServiceVisibilityRequest).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether the subscription is visible to private link service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility - /// - /// - /// Operation Id - /// PrivateLinkServices_CheckPrivateLinkServiceVisibility - /// - /// - /// - /// 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 location of the domain name. - /// The request body of CheckPrivateLinkService API call. - /// The cancellation token to use. - public virtual ArmOperation CheckPrivateLinkServiceVisibilityPrivateLinkService(WaitUntil waitUntil, AzureLocation location, CheckPrivateLinkServiceVisibilityRequest checkPrivateLinkServiceVisibilityRequest, CancellationToken cancellationToken = default) - { - using var scope = PrivateLinkServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPrivateLinkServiceVisibilityPrivateLinkService"); - scope.Start(); - try - { - var response = PrivateLinkServicesRestClient.CheckPrivateLinkServiceVisibility(Id.SubscriptionId, location, checkPrivateLinkServiceVisibilityRequest, cancellationToken); - var operation = new NetworkArmOperation(new PrivateLinkServiceVisibilityOperationSource(), PrivateLinkServicesClientDiagnostics, Pipeline, PrivateLinkServicesRestClient.CreateCheckPrivateLinkServiceVisibilityRequest(Id.SubscriptionId, location, checkPrivateLinkServiceVisibilityRequest).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices - /// - /// - /// Operation Id - /// PrivateLinkServices_ListAutoApprovedPrivateLinkServices - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAutoApprovedPrivateLinkServicesPrivateLinkServicesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AutoApprovedPrivateLinkService.DeserializeAutoApprovedPrivateLinkService, PrivateLinkServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutoApprovedPrivateLinkServicesPrivateLinkServices", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices - /// - /// - /// Operation Id - /// PrivateLinkServices_ListAutoApprovedPrivateLinkServices - /// - /// - /// - /// The location of the domain name. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAutoApprovedPrivateLinkServicesPrivateLinkServices(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateLinkServicesRestClient.CreateListAutoApprovedPrivateLinkServicesNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AutoApprovedPrivateLinkService.DeserializeAutoApprovedPrivateLinkService, PrivateLinkServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutoApprovedPrivateLinkServicesPrivateLinkServices", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the public IP addresses in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses - /// - /// - /// Operation Id - /// PublicIPAddresses_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPublicIPAddressesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PublicIPAddressRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicIPAddressRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublicIPAddressResource(Client, PublicIPAddressData.DeserializePublicIPAddressData(e)), PublicIPAddressClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPublicIPAddresses", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the public IP addresses in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses - /// - /// - /// Operation Id - /// PublicIPAddresses_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPublicIPAddresses(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PublicIPAddressRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicIPAddressRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublicIPAddressResource(Client, PublicIPAddressData.DeserializePublicIPAddressData(e)), PublicIPAddressClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPublicIPAddresses", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the public IP prefixes in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes - /// - /// - /// Operation Id - /// PublicIPPrefixes_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPublicIPPrefixesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PublicIPPrefixRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicIPPrefixRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PublicIPPrefixResource(Client, PublicIPPrefixData.DeserializePublicIPPrefixData(e)), PublicIPPrefixClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPublicIPPrefixes", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the public IP prefixes in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes - /// - /// - /// Operation Id - /// PublicIPPrefixes_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPublicIPPrefixes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PublicIPPrefixRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PublicIPPrefixRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PublicIPPrefixResource(Client, PublicIPPrefixData.DeserializePublicIPPrefixData(e)), PublicIPPrefixClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPublicIPPrefixes", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all route filters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters - /// - /// - /// Operation Id - /// RouteFilters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRouteFiltersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RouteFilterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RouteFilterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RouteFilterResource(Client, RouteFilterData.DeserializeRouteFilterData(e)), RouteFilterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRouteFilters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all route filters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters - /// - /// - /// Operation Id - /// RouteFilters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRouteFilters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RouteFilterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RouteFilterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RouteFilterResource(Client, RouteFilterData.DeserializeRouteFilterData(e)), RouteFilterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRouteFilters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all route tables in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables - /// - /// - /// Operation Id - /// RouteTables_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRouteTablesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RouteTableRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RouteTableRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RouteTableResource(Client, RouteTableData.DeserializeRouteTableData(e)), RouteTableClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRouteTables", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all route tables in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables - /// - /// - /// Operation Id - /// RouteTables_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRouteTables(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RouteTableRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RouteTableRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RouteTableResource(Client, RouteTableData.DeserializeRouteTableData(e)), RouteTableClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRouteTables", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Security Partner Providers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders - /// - /// - /// Operation Id - /// SecurityPartnerProviders_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecurityPartnerProvidersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityPartnerProviderRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityPartnerProviderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecurityPartnerProviderResource(Client, SecurityPartnerProviderData.DeserializeSecurityPartnerProviderData(e)), SecurityPartnerProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecurityPartnerProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Security Partner Providers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders - /// - /// - /// Operation Id - /// SecurityPartnerProviders_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecurityPartnerProviders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityPartnerProviderRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityPartnerProviderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecurityPartnerProviderResource(Client, SecurityPartnerProviderData.DeserializeSecurityPartnerProviderData(e)), SecurityPartnerProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecurityPartnerProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the available bgp service communities. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities - /// - /// - /// Operation Id - /// BgpServiceCommunities_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBgpServiceCommunitiesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BgpServiceCommunitiesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BgpServiceCommunitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, BgpServiceCommunity.DeserializeBgpServiceCommunity, BgpServiceCommunitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBgpServiceCommunities", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the available bgp service communities. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities - /// - /// - /// Operation Id - /// BgpServiceCommunities_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBgpServiceCommunities(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BgpServiceCommunitiesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BgpServiceCommunitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, BgpServiceCommunity.DeserializeBgpServiceCommunity, BgpServiceCommunitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBgpServiceCommunities", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the service endpoint policies in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies - /// - /// - /// Operation Id - /// ServiceEndpointPolicies_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetServiceEndpointPoliciesByServiceEndpointPolicyAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceEndpointPolicyRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceEndpointPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceEndpointPolicyResource(Client, ServiceEndpointPolicyData.DeserializeServiceEndpointPolicyData(e)), ServiceEndpointPolicyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServiceEndpointPoliciesByServiceEndpointPolicy", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the service endpoint policies in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies - /// - /// - /// Operation Id - /// ServiceEndpointPolicies_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetServiceEndpointPoliciesByServiceEndpointPolicy(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceEndpointPolicyRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceEndpointPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceEndpointPolicyResource(Client, ServiceEndpointPolicyData.DeserializeServiceEndpointPolicyData(e)), ServiceEndpointPolicyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServiceEndpointPoliciesByServiceEndpointPolicy", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of service tag information resources. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags - /// - /// - /// Operation Id - /// ServiceTags_List - /// - /// - /// - /// The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). - /// The cancellation token to use. - public virtual async Task> GetServiceTagAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = ServiceTagsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetServiceTag"); - scope.Start(); - try - { - var response = await ServiceTagsRestClient.ListAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of service tag information resources. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags - /// - /// - /// Operation Id - /// ServiceTags_List - /// - /// - /// - /// The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). - /// The cancellation token to use. - public virtual Response GetServiceTag(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = ServiceTagsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetServiceTag"); - scope.Start(); - try - { - var response = ServiceTagsRestClient.List(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of service tag information resources with pagination. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails - /// - /// - /// Operation Id - /// ServiceTagInformation_List - /// - /// - /// - /// The location that will be used as a reference for cloud (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). - /// Do not return address prefixes for the tag(s). - /// Return tag information for a particular tag. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllServiceTagInformationAsync(AzureLocation location, bool? noAddressPrefixes = null, string tagName = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceTagInformationRestClient.CreateListRequest(Id.SubscriptionId, location, noAddressPrefixes, tagName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceTagInformationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, noAddressPrefixes, tagName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ServiceTagInformation.DeserializeServiceTagInformation, ServiceTagInformationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllServiceTagInformation", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of service tag information resources with pagination. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails - /// - /// - /// Operation Id - /// ServiceTagInformation_List - /// - /// - /// - /// The location that will be used as a reference for cloud (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). - /// Do not return address prefixes for the tag(s). - /// Return tag information for a particular tag. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllServiceTagInformation(AzureLocation location, bool? noAddressPrefixes = null, string tagName = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceTagInformationRestClient.CreateListRequest(Id.SubscriptionId, location, noAddressPrefixes, tagName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceTagInformationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, noAddressPrefixes, tagName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ServiceTagInformation.DeserializeServiceTagInformation, ServiceTagInformationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllServiceTagInformation", "value", "nextLink", cancellationToken); - } - - /// - /// List network usages for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// The location where resource usage is queried. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, NetworkUsage.DeserializeNetworkUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// List network usages for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// The location where resource usage is queried. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, NetworkUsage.DeserializeNetworkUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all virtual networks in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks - /// - /// - /// Operation Id - /// VirtualNetworks_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualNetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all virtual networks in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks - /// - /// - /// Operation Id - /// VirtualNetworks_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualNetworks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkResource(Client, VirtualNetworkData.DeserializeVirtualNetworkData(e)), VirtualNetworkClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the VirtualNetworkTaps in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps - /// - /// - /// Operation Id - /// VirtualNetworkTaps_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualNetworkTapsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkTapRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkTapRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkTapResource(Client, VirtualNetworkTapData.DeserializeVirtualNetworkTapData(e)), VirtualNetworkTapClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworkTaps", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the VirtualNetworkTaps in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps - /// - /// - /// Operation Id - /// VirtualNetworkTaps_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualNetworkTaps(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualNetworkTapRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualNetworkTapRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualNetworkTapResource(Client, VirtualNetworkTapData.DeserializeVirtualNetworkTapData(e)), VirtualNetworkTapClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualNetworkTaps", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Virtual Routers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters - /// - /// - /// Operation Id - /// VirtualRouters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualRoutersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualRouterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualRouterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualRouterResource(Client, VirtualRouterData.DeserializeVirtualRouterData(e)), VirtualRouterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualRouters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the Virtual Routers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters - /// - /// - /// Operation Id - /// VirtualRouters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualRouters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualRouterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualRouterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualRouterResource(Client, VirtualRouterData.DeserializeVirtualRouterData(e)), VirtualRouterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualRouters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VirtualWANs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans - /// - /// - /// Operation Id - /// VirtualWans_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualWansAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWanRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualWanResource(Client, VirtualWanData.DeserializeVirtualWanData(e)), VirtualWanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualWans", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VirtualWANs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans - /// - /// - /// Operation Id - /// VirtualWans_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualWans(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWanRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualWanResource(Client, VirtualWanData.DeserializeVirtualWanData(e)), VirtualWanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualWans", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VpnSites in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites - /// - /// - /// Operation Id - /// VpnSites_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVpnSitesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VpnSiteRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VpnSiteResource(Client, VpnSiteData.DeserializeVpnSiteData(e)), VpnSiteClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVpnSites", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VpnSites in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites - /// - /// - /// Operation Id - /// VpnSites_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVpnSites(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VpnSiteRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VpnSiteResource(Client, VpnSiteData.DeserializeVpnSiteData(e)), VpnSiteClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVpnSites", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VpnServerConfigurations in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations - /// - /// - /// Operation Id - /// VpnServerConfigurations_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVpnServerConfigurationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VpnServerConfigurationRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnServerConfigurationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VpnServerConfigurationResource(Client, VpnServerConfigurationData.DeserializeVpnServerConfigurationData(e)), VpnServerConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVpnServerConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VpnServerConfigurations in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations - /// - /// - /// Operation Id - /// VpnServerConfigurations_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVpnServerConfigurations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VpnServerConfigurationRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnServerConfigurationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VpnServerConfigurationResource(Client, VpnServerConfigurationData.DeserializeVpnServerConfigurationData(e)), VpnServerConfigurationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVpnServerConfigurations", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VirtualHubs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs - /// - /// - /// Operation Id - /// VirtualHubs_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualHubsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualHubRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualHubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualHubResource(Client, VirtualHubData.DeserializeVirtualHubData(e)), VirtualHubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualHubs", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VirtualHubs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs - /// - /// - /// Operation Id - /// VirtualHubs_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualHubs(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualHubRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualHubRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualHubResource(Client, VirtualHubData.DeserializeVirtualHubData(e)), VirtualHubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualHubs", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VpnGateways in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways - /// - /// - /// Operation Id - /// VpnGateways_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVpnGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VpnGatewayRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnGatewayRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VpnGatewayResource(Client, VpnGatewayData.DeserializeVpnGatewayData(e)), VpnGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVpnGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the VpnGateways in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways - /// - /// - /// Operation Id - /// VpnGateways_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVpnGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VpnGatewayRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VpnGatewayRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VpnGatewayResource(Client, VpnGatewayData.DeserializeVpnGatewayData(e)), VpnGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVpnGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the P2SVpnGateways in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways - /// - /// - /// Operation Id - /// P2sVpnGateways_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetP2SVpnGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => P2SVpnGatewayP2sVpnGatewaysRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => P2SVpnGatewayP2sVpnGatewaysRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new P2SVpnGatewayResource(Client, P2SVpnGatewayData.DeserializeP2SVpnGatewayData(e)), P2SVpnGatewayP2sVpnGatewaysClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetP2SVpnGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the P2SVpnGateways in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways - /// - /// - /// Operation Id - /// P2sVpnGateways_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetP2SVpnGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => P2SVpnGatewayP2sVpnGatewaysRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => P2SVpnGatewayP2sVpnGatewaysRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new P2SVpnGatewayResource(Client, P2SVpnGatewayData.DeserializeP2SVpnGatewayData(e)), P2SVpnGatewayP2sVpnGatewaysClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetP2SVpnGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Lists ExpressRoute gateways under a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways - /// - /// - /// Operation Id - /// ExpressRouteGateways_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetExpressRouteGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteGatewayRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ExpressRouteGatewayResource(Client, ExpressRouteGatewayData.DeserializeExpressRouteGatewayData(e)), ExpressRouteGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRouteGateways", "value", null, cancellationToken); - } - - /// - /// Lists ExpressRoute gateways under a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways - /// - /// - /// Operation Id - /// ExpressRouteGateways_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetExpressRouteGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExpressRouteGatewayRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ExpressRouteGatewayResource(Client, ExpressRouteGatewayData.DeserializeExpressRouteGatewayData(e)), ExpressRouteGatewayClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExpressRouteGateways", "value", null, cancellationToken); - } - - /// - /// Gets all the WAF policies in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies - /// - /// - /// Operation Id - /// WebApplicationFirewallPolicies_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWebApplicationFirewallPoliciesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WebApplicationFirewallPolicyRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebApplicationFirewallPolicyRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebApplicationFirewallPolicyResource(Client, WebApplicationFirewallPolicyData.DeserializeWebApplicationFirewallPolicyData(e)), WebApplicationFirewallPolicyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebApplicationFirewallPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the WAF policies in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies - /// - /// - /// Operation Id - /// WebApplicationFirewallPolicies_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWebApplicationFirewallPolicies(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WebApplicationFirewallPolicyRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebApplicationFirewallPolicyRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebApplicationFirewallPolicyResource(Client, WebApplicationFirewallPolicyData.DeserializeWebApplicationFirewallPolicyData(e)), WebApplicationFirewallPolicyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebApplicationFirewallPolicies", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyResource.cs index d19afa7be5e5c..74031999d71d0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class FirewallPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The firewallPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string firewallPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}"; @@ -101,7 +104,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FirewallPolicyRuleCollectionGroupResources and their operations over a FirewallPolicyRuleCollectionGroupResource. public virtual FirewallPolicyRuleCollectionGroupCollection GetFirewallPolicyRuleCollectionGroups() { - return GetCachedClient(Client => new FirewallPolicyRuleCollectionGroupCollection(Client, Id)); + return GetCachedClient(client => new FirewallPolicyRuleCollectionGroupCollection(client, Id)); } /// @@ -119,8 +122,8 @@ public virtual FirewallPolicyRuleCollectionGroupCollection GetFirewallPolicyRule /// /// The name of the FirewallPolicyRuleCollectionGroup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFirewallPolicyRuleCollectionGroupAsync(string ruleCollectionGroupName, CancellationToken cancellationToken = default) { @@ -142,8 +145,8 @@ public virtual async Task> G /// /// The name of the FirewallPolicyRuleCollectionGroup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFirewallPolicyRuleCollectionGroup(string ruleCollectionGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupResource.cs index 59f2f453b5ddb..0c6954df427a6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class FirewallPolicyRuleCollectionGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The firewallPolicyName. + /// The ruleCollectionGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string firewallPolicyName, string ruleCollectionGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogResource.cs index 8e1b0095d6e8c..730eba4d395dd 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Network public partial class FlowLogResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkWatcherName. + /// The flowLogName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkWatcherName, string flowLogName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FrontendIPConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FrontendIPConfigurationResource.cs index 13ea6528afcd3..113f7d0323252 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FrontendIPConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FrontendIPConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class FrontendIPConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The loadBalancerName. + /// The frontendIPConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string loadBalancerName, string frontendIPConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIPConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIPConfigurationResource.cs index 7f7eac6605a46..b0edf3d1e6288 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIPConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIPConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class HubIPConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualHubName. + /// The ipConfigName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualHubName, string ipConfigName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableResource.cs index 5ccbd9aa4a19d..f4bbf8fb89bab 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class HubRouteTableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualHubName. + /// The routeTableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualHubName, string routeTableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionResource.cs index c6964102aaaf0..b410767326d9d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class HubVirtualNetworkConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualHubName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualHubName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/IPAllocationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/IPAllocationResource.cs index f113152003f7d..e383474d2cd03 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/IPAllocationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/IPAllocationResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class IPAllocationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ipAllocationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ipAllocationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/IPGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/IPGroupResource.cs index 53767cd03ccfd..b48478b9b2079 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/IPGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/IPGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class IPGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ipGroupsName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ipGroupsName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleResource.cs index e66bb7e8463bb..d4badf7913d7d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class InboundNatRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The loadBalancerName. + /// The inboundNatRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string loadBalancerName, string inboundNatRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerResource.cs index f81ee70080eff..af520f25867e3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Network public partial class LoadBalancerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The loadBalancerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string loadBalancerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BackendAddressPoolResources and their operations over a BackendAddressPoolResource. public virtual BackendAddressPoolCollection GetBackendAddressPools() { - return GetCachedClient(Client => new BackendAddressPoolCollection(Client, Id)); + return GetCachedClient(client => new BackendAddressPoolCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual BackendAddressPoolCollection GetBackendAddressPools() /// /// The name of the backend address pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBackendAddressPoolAsync(string backendAddressPoolName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetBackendAddres /// /// The name of the backend address pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBackendAddressPool(string backendAddressPoolName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetBackendAddressPool(string /// An object representing collection of FrontendIPConfigurationResources and their operations over a FrontendIPConfigurationResource. public virtual FrontendIPConfigurationCollection GetFrontendIPConfigurations() { - return GetCachedClient(Client => new FrontendIPConfigurationCollection(Client, Id)); + return GetCachedClient(client => new FrontendIPConfigurationCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual FrontendIPConfigurationCollection GetFrontendIPConfigurations() /// /// The name of the frontend IP configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontendIPConfigurationAsync(string frontendIPConfigurationName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> GetFrontend /// /// The name of the frontend IP configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontendIPConfiguration(string frontendIPConfigurationName, CancellationToken cancellationToken = default) { @@ -204,7 +207,7 @@ public virtual Response GetFrontendIPConfigurat /// An object representing collection of InboundNatRuleResources and their operations over a InboundNatRuleResource. public virtual InboundNatRuleCollection GetInboundNatRules() { - return GetCachedClient(Client => new InboundNatRuleCollection(Client, Id)); + return GetCachedClient(client => new InboundNatRuleCollection(client, Id)); } /// @@ -223,8 +226,8 @@ public virtual InboundNatRuleCollection GetInboundNatRules() /// The name of the inbound NAT rule. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetInboundNatRuleAsync(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) { @@ -247,8 +250,8 @@ public virtual async Task> GetInboundNatRuleAsy /// The name of the inbound NAT rule. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetInboundNatRule(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) { @@ -259,7 +262,7 @@ public virtual Response GetInboundNatRule(string inbound /// An object representing collection of LoadBalancingRuleResources and their operations over a LoadBalancingRuleResource. public virtual LoadBalancingRuleCollection GetLoadBalancingRules() { - return GetCachedClient(Client => new LoadBalancingRuleCollection(Client, Id)); + return GetCachedClient(client => new LoadBalancingRuleCollection(client, Id)); } /// @@ -277,8 +280,8 @@ public virtual LoadBalancingRuleCollection GetLoadBalancingRules() /// /// The name of the load balancing rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLoadBalancingRuleAsync(string loadBalancingRuleName, CancellationToken cancellationToken = default) { @@ -300,8 +303,8 @@ public virtual async Task> GetLoadBalancingR /// /// The name of the load balancing rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLoadBalancingRule(string loadBalancingRuleName, CancellationToken cancellationToken = default) { @@ -312,7 +315,7 @@ public virtual Response GetLoadBalancingRule(string l /// An object representing collection of OutboundRuleResources and their operations over a OutboundRuleResource. public virtual OutboundRuleCollection GetOutboundRules() { - return GetCachedClient(Client => new OutboundRuleCollection(Client, Id)); + return GetCachedClient(client => new OutboundRuleCollection(client, Id)); } /// @@ -330,8 +333,8 @@ public virtual OutboundRuleCollection GetOutboundRules() /// /// The name of the outbound rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOutboundRuleAsync(string outboundRuleName, CancellationToken cancellationToken = default) { @@ -353,8 +356,8 @@ public virtual async Task> GetOutboundRuleAsync(s /// /// The name of the outbound rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOutboundRule(string outboundRuleName, CancellationToken cancellationToken = default) { @@ -365,7 +368,7 @@ public virtual Response GetOutboundRule(string outboundRul /// An object representing collection of ProbeResources and their operations over a ProbeResource. public virtual ProbeCollection GetProbes() { - return GetCachedClient(Client => new ProbeCollection(Client, Id)); + return GetCachedClient(client => new ProbeCollection(client, Id)); } /// @@ -383,8 +386,8 @@ public virtual ProbeCollection GetProbes() /// /// The name of the probe. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProbeAsync(string probeName, CancellationToken cancellationToken = default) { @@ -406,8 +409,8 @@ public virtual async Task> GetProbeAsync(string probeNam /// /// The name of the probe. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProbe(string probeName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancingRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancingRuleResource.cs index 326233d398cb4..29e9bcbeeef67 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancingRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancingRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class LoadBalancingRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The loadBalancerName. + /// The loadBalancingRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string loadBalancerName, string loadBalancingRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayResource.cs index a45dc87599d4d..962f850f7f9f4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class LocalNetworkGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The localNetworkGatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string localNetworkGatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ManagementGroupNetworkManagerConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ManagementGroupNetworkManagerConnectionResource.cs index e94419530ce42..9ca4203f490c5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ManagementGroupNetworkManagerConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ManagementGroupNetworkManagerConnectionResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Network public partial class ManagementGroupNetworkManagerConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The networkManagerConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string networkManagerConnectionName) { var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayResource.cs index 8782eb8a90847..8b1dc133ce66c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class NatGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The natGatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string natGatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupResource.cs index 964daa40daf4e..72e59dcc0b3e3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class NetworkGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkManagerName. + /// The networkGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkManagerName, string networkGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkGroupStaticMemberResources and their operations over a NetworkGroupStaticMemberResource. public virtual NetworkGroupStaticMemberCollection GetNetworkGroupStaticMembers() { - return GetCachedClient(Client => new NetworkGroupStaticMemberCollection(Client, Id)); + return GetCachedClient(client => new NetworkGroupStaticMemberCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual NetworkGroupStaticMemberCollection GetNetworkGroupStaticMembers() /// /// The name of the static member. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkGroupStaticMemberAsync(string staticMemberName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetNetwork /// /// The name of the static member. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkGroupStaticMember(string staticMemberName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupStaticMemberResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupStaticMemberResource.cs index db6626226eca7..c1d7f4b215806 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupStaticMemberResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupStaticMemberResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Network public partial class NetworkGroupStaticMemberResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkManagerName. + /// The networkGroupName. + /// The staticMemberName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkManagerName, string networkGroupName, string staticMemberName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/networkGroups/{networkGroupName}/staticMembers/{staticMemberName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceIPConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceIPConfigurationResource.cs index 935737faa549c..56016d81505c2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceIPConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceIPConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class NetworkInterfaceIPConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkInterfaceName. + /// The ipConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkInterfaceName, string ipConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceResource.cs index 448b4ffd5e8d0..997877b8af4fc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Network public partial class NetworkInterfaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkInterfaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkInterfaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkInterfaceIPConfigurationResources and their operations over a NetworkInterfaceIPConfigurationResource. public virtual NetworkInterfaceIPConfigurationCollection GetNetworkInterfaceIPConfigurations() { - return GetCachedClient(Client => new NetworkInterfaceIPConfigurationCollection(Client, Id)); + return GetCachedClient(client => new NetworkInterfaceIPConfigurationCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual NetworkInterfaceIPConfigurationCollection GetNetworkInterfaceIPCo /// /// The name of the ip configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkInterfaceIPConfigurationAsync(string ipConfigurationName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> Get /// /// The name of the ip configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkInterfaceIPConfiguration(string ipConfigurationName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetNetworkInter /// An object representing collection of NetworkInterfaceTapConfigurationResources and their operations over a NetworkInterfaceTapConfigurationResource. public virtual NetworkInterfaceTapConfigurationCollection GetNetworkInterfaceTapConfigurations() { - return GetCachedClient(Client => new NetworkInterfaceTapConfigurationCollection(Client, Id)); + return GetCachedClient(client => new NetworkInterfaceTapConfigurationCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual NetworkInterfaceTapConfigurationCollection GetNetworkInterfaceTap /// /// The name of the tap configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkInterfaceTapConfigurationAsync(string tapConfigurationName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> Ge /// /// The name of the tap configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkInterfaceTapConfiguration(string tapConfigurationName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationResource.cs index cee031891de81..d2419dc23d67b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class NetworkInterfaceTapConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkInterfaceName. + /// The tapConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkInterfaceName, string tapConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerResource.cs index 647f2f66b5855..018b8fd2a625d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Network public partial class NetworkManagerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkManagerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkManagerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}"; @@ -107,7 +110,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ConnectivityConfigurationResources and their operations over a ConnectivityConfigurationResource. public virtual ConnectivityConfigurationCollection GetConnectivityConfigurations() { - return GetCachedClient(Client => new ConnectivityConfigurationCollection(Client, Id)); + return GetCachedClient(client => new ConnectivityConfigurationCollection(client, Id)); } /// @@ -125,8 +128,8 @@ public virtual ConnectivityConfigurationCollection GetConnectivityConfigurations /// /// The name of the network manager connectivity configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetConnectivityConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -148,8 +151,8 @@ public virtual async Task> GetConnec /// /// The name of the network manager connectivity configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetConnectivityConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -160,7 +163,7 @@ public virtual Response GetConnectivityConfig /// An object representing collection of NetworkGroupResources and their operations over a NetworkGroupResource. public virtual NetworkGroupCollection GetNetworkGroups() { - return GetCachedClient(Client => new NetworkGroupCollection(Client, Id)); + return GetCachedClient(client => new NetworkGroupCollection(client, Id)); } /// @@ -178,8 +181,8 @@ public virtual NetworkGroupCollection GetNetworkGroups() /// /// The name of the network group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkGroupAsync(string networkGroupName, CancellationToken cancellationToken = default) { @@ -201,8 +204,8 @@ public virtual async Task> GetNetworkGroupAsync(s /// /// The name of the network group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkGroup(string networkGroupName, CancellationToken cancellationToken = default) { @@ -213,7 +216,7 @@ public virtual Response GetNetworkGroup(string networkGrou /// An object representing collection of ScopeConnectionResources and their operations over a ScopeConnectionResource. public virtual ScopeConnectionCollection GetScopeConnections() { - return GetCachedClient(Client => new ScopeConnectionCollection(Client, Id)); + return GetCachedClient(client => new ScopeConnectionCollection(client, Id)); } /// @@ -231,8 +234,8 @@ public virtual ScopeConnectionCollection GetScopeConnections() /// /// Name for the cross-tenant connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetScopeConnectionAsync(string scopeConnectionName, CancellationToken cancellationToken = default) { @@ -254,8 +257,8 @@ public virtual async Task> GetScopeConnectionA /// /// Name for the cross-tenant connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetScopeConnection(string scopeConnectionName, CancellationToken cancellationToken = default) { @@ -266,7 +269,7 @@ public virtual Response GetScopeConnection(string scope /// An object representing collection of SecurityAdminConfigurationResources and their operations over a SecurityAdminConfigurationResource. public virtual SecurityAdminConfigurationCollection GetSecurityAdminConfigurations() { - return GetCachedClient(Client => new SecurityAdminConfigurationCollection(Client, Id)); + return GetCachedClient(client => new SecurityAdminConfigurationCollection(client, Id)); } /// @@ -284,8 +287,8 @@ public virtual SecurityAdminConfigurationCollection GetSecurityAdminConfiguratio /// /// The name of the network manager Security Configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityAdminConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -307,8 +310,8 @@ public virtual async Task> GetSecur /// /// The name of the network manager Security Configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityAdminConfiguration(string configurationName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkPrivateEndpointConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkPrivateEndpointConnectionResource.cs index 797da1c17422f..00eb1499ff941 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkPrivateEndpointConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class NetworkPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. + /// The peConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName, string peConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileResource.cs index 6ac73259282ae..74935b58d2c82 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class NetworkProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkProfileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkProfileName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupResource.cs index 49489f611c161..82e411ccde42b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class NetworkSecurityGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkSecurityGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkSecurityGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SecurityRuleResources and their operations over a SecurityRuleResource. public virtual SecurityRuleCollection GetSecurityRules() { - return GetCachedClient(Client => new SecurityRuleCollection(Client, Id)); + return GetCachedClient(client => new SecurityRuleCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual SecurityRuleCollection GetSecurityRules() /// /// The name of the security rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityRuleAsync(string securityRuleName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetSecurityRuleAsync(s /// /// The name of the security rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityRule(string securityRuleName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetSecurityRule(string securityRul /// An object representing collection of DefaultSecurityRuleResources and their operations over a DefaultSecurityRuleResource. public virtual DefaultSecurityRuleCollection GetDefaultSecurityRules() { - return GetCachedClient(Client => new DefaultSecurityRuleCollection(Client, Id)); + return GetCachedClient(client => new DefaultSecurityRuleCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual DefaultSecurityRuleCollection GetDefaultSecurityRules() /// /// The name of the default security rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDefaultSecurityRuleAsync(string defaultSecurityRuleName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetDefaultSecur /// /// The name of the default security rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDefaultSecurityRule(string defaultSecurityRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceConnectionResource.cs index 3cd3c2c749dea..5272c186188be 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class NetworkVirtualApplianceConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkVirtualApplianceName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkVirtualApplianceName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/networkVirtualApplianceConnections/{connectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceResource.cs index f6535deffd28b..011c6d0e6896a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class NetworkVirtualApplianceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkVirtualApplianceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkVirtualApplianceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}"; @@ -97,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VirtualApplianceSiteResources and their operations over a VirtualApplianceSiteResource. public virtual VirtualApplianceSiteCollection GetVirtualApplianceSites() { - return GetCachedClient(Client => new VirtualApplianceSiteCollection(Client, Id)); + return GetCachedClient(client => new VirtualApplianceSiteCollection(client, Id)); } /// @@ -115,8 +118,8 @@ public virtual VirtualApplianceSiteCollection GetVirtualApplianceSites() /// /// The name of the site. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualApplianceSiteAsync(string siteName, CancellationToken cancellationToken = default) { @@ -138,8 +141,8 @@ public virtual async Task> GetVirtualAppl /// /// The name of the site. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualApplianceSite(string siteName, CancellationToken cancellationToken = default) { @@ -150,7 +153,7 @@ public virtual Response GetVirtualApplianceSite(st /// An object representing collection of NetworkVirtualApplianceConnectionResources and their operations over a NetworkVirtualApplianceConnectionResource. public virtual NetworkVirtualApplianceConnectionCollection GetNetworkVirtualApplianceConnections() { - return GetCachedClient(Client => new NetworkVirtualApplianceConnectionCollection(Client, Id)); + return GetCachedClient(client => new NetworkVirtualApplianceConnectionCollection(client, Id)); } /// @@ -168,8 +171,8 @@ public virtual NetworkVirtualApplianceConnectionCollection GetNetworkVirtualAppl /// /// The name of the NVA connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkVirtualApplianceConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -191,8 +194,8 @@ public virtual async Task> G /// /// The name of the NVA connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkVirtualApplianceConnection(string connectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceSkuResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceSkuResource.cs index ef785f9958934..34000b9ecb60b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceSkuResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceSkuResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Network public partial class NetworkVirtualApplianceSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The skuName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string skuName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherResource.cs index f080ad4c3d56a..4f5995c5a1a67 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class NetworkWatcherResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkWatcherName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkWatcherName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PacketCaptureResources and their operations over a PacketCaptureResource. public virtual PacketCaptureCollection GetPacketCaptures() { - return GetCachedClient(Client => new PacketCaptureCollection(Client, Id)); + return GetCachedClient(client => new PacketCaptureCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual PacketCaptureCollection GetPacketCaptures() /// /// The name of the packet capture session. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPacketCaptureAsync(string packetCaptureName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetPacketCaptureAsync /// /// The name of the packet capture session. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPacketCapture(string packetCaptureName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetPacketCapture(string packetCap /// An object representing collection of ConnectionMonitorResources and their operations over a ConnectionMonitorResource. public virtual ConnectionMonitorCollection GetConnectionMonitors() { - return GetCachedClient(Client => new ConnectionMonitorCollection(Client, Id)); + return GetCachedClient(client => new ConnectionMonitorCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual ConnectionMonitorCollection GetConnectionMonitors() /// /// The name of the connection monitor. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetConnectionMonitorAsync(string connectionMonitorName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetConnectionMoni /// /// The name of the connection monitor. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetConnectionMonitor(string connectionMonitorName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetConnectionMonitor(string c /// An object representing collection of FlowLogResources and their operations over a FlowLogResource. public virtual FlowLogCollection GetFlowLogs() { - return GetCachedClient(Client => new FlowLogCollection(Client, Id)); + return GetCachedClient(client => new FlowLogCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual FlowLogCollection GetFlowLogs() /// /// The name of the flow log resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFlowLogAsync(string flowLogName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetFlowLogAsync(string flow /// /// The name of the flow log resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFlowLog(string flowLogName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/OutboundRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/OutboundRuleResource.cs index 4e8b113832ff8..66a8f8511b63a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/OutboundRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/OutboundRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class OutboundRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The loadBalancerName. + /// The outboundRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string loadBalancerName, string outboundRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayResource.cs index 9205f42580571..91f1ba56683fd 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class P2SVpnGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The gatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string gatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureResource.cs index 17bb384c01b94..37df7a3353b9b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Network public partial class PacketCaptureResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkWatcherName. + /// The packetCaptureName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkWatcherName, string packetCaptureName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PeerExpressRouteCircuitConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PeerExpressRouteCircuitConnectionResource.cs index 97de8567dbee0..df883086b856d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PeerExpressRouteCircuitConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PeerExpressRouteCircuitConnectionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Network public partial class PeerExpressRouteCircuitConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The circuitName. + /// The peeringName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string circuitName, string peeringName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections/{connectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PolicySignaturesOverridesForIdpsResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PolicySignaturesOverridesForIdpsResource.cs index 7f4607d155f6e..9c0edaecde07e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PolicySignaturesOverridesForIdpsResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PolicySignaturesOverridesForIdpsResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Network public partial class PolicySignaturesOverridesForIdpsResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The firewallPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string firewallPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupResource.cs index d4c4cf727596a..46ca23c90d383 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class PrivateDnsZoneGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateEndpointName. + /// The privateDnsZoneGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateEndpointName, string privateDnsZoneGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointResource.cs index c49e2a2338285..021c4f3ff1a17 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Network public partial class PrivateEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PrivateDnsZoneGroupResources and their operations over a PrivateDnsZoneGroupResource. public virtual PrivateDnsZoneGroupCollection GetPrivateDnsZoneGroups() { - return GetCachedClient(Client => new PrivateDnsZoneGroupCollection(Client, Id)); + return GetCachedClient(client => new PrivateDnsZoneGroupCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual PrivateDnsZoneGroupCollection GetPrivateDnsZoneGroups() /// /// The name of the private dns zone group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPrivateDnsZoneGroupAsync(string privateDnsZoneGroupName, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetPrivateDnsZo /// /// The name of the private dns zone group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPrivateDnsZoneGroup(string privateDnsZoneGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceResource.cs index cb305739b1145..aaaecb6e501e2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Network public partial class PrivateLinkServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkPrivateEndpointConnectionResources and their operations over a NetworkPrivateEndpointConnectionResource. public virtual NetworkPrivateEndpointConnectionCollection GetNetworkPrivateEndpointConnections() { - return GetCachedClient(Client => new NetworkPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new NetworkPrivateEndpointConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual NetworkPrivateEndpointConnectionCollection GetNetworkPrivateEndpo /// The name of the private end point connection. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkPrivateEndpointConnectionAsync(string peConnectionName, string expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> Ge /// The name of the private end point connection. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkPrivateEndpointConnection(string peConnectionName, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ProbeResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ProbeResource.cs index 1c35d68270147..816f20aaab868 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ProbeResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ProbeResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ProbeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The loadBalancerName. + /// The probeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string loadBalancerName, string probeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressResource.cs index 55b6027d6e14a..13af46fde29ae 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class PublicIPAddressResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publicIPAddressName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publicIPAddressName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIPAddressName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixResource.cs index d0715e63cbbfd..1123911f7305f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class PublicIPPrefixResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The publicIPPrefixName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string publicIPPrefixName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterResource.cs index b85932b509908..ab2a45b559fee 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class RouteFilterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The routeFilterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string routeFilterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RouteFilterRuleResources and their operations over a RouteFilterRuleResource. public virtual RouteFilterRuleCollection GetRouteFilterRules() { - return GetCachedClient(Client => new RouteFilterRuleCollection(Client, Id)); + return GetCachedClient(client => new RouteFilterRuleCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual RouteFilterRuleCollection GetRouteFilterRules() /// /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRouteFilterRuleAsync(string ruleName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetRouteFilterRuleA /// /// The name of the rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRouteFilterRule(string ruleName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleResource.cs index 29f6eddd24eac..eaff0630ff575 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class RouteFilterRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The routeFilterName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string routeFilterName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteMapResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteMapResource.cs index 5e8f3ec84b6ee..ed819d6f70d56 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteMapResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteMapResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class RouteMapResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualHubName. + /// The routeMapName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualHubName, string routeMapName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeMaps/{routeMapName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteResource.cs index a1a89250c5f53..37fd35e5cfc4b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class RouteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The routeTableName. + /// The routeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string routeTableName, string routeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableResource.cs index 8908ea0b82842..49cf9c56e57b7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class RouteTableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The routeTableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string routeTableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RouteResources and their operations over a RouteResource. public virtual RouteCollection GetRoutes() { - return GetCachedClient(Client => new RouteCollection(Client, Id)); + return GetCachedClient(client => new RouteCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual RouteCollection GetRoutes() /// /// The name of the route. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRouteAsync(string routeName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetRouteAsync(string routeNam /// /// The name of the route. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRoute(string routeName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RoutingIntentResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RoutingIntentResource.cs index 4797933201685..2b7cd1e1c446f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RoutingIntentResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RoutingIntentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class RoutingIntentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualHubName. + /// The routingIntentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualHubName, string routingIntentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ScopeConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ScopeConnectionResource.cs index 89a73226150c0..662e83cd70027 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ScopeConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ScopeConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ScopeConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkManagerName. + /// The scopeConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkManagerName, string scopeConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/scopeConnections/{scopeConnectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationResource.cs index b7b869f6c40aa..3e140e5a32fb3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class SecurityAdminConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkManagerName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkManagerName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkManagers/{networkManagerName}/securityAdminConfigurations/{configurationName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AdminRuleGroupResources and their operations over a AdminRuleGroupResource. public virtual AdminRuleGroupCollection GetAdminRuleGroups() { - return GetCachedClient(Client => new AdminRuleGroupCollection(Client, Id)); + return GetCachedClient(client => new AdminRuleGroupCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual AdminRuleGroupCollection GetAdminRuleGroups() /// /// The name of the network manager security Configuration rule collection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAdminRuleGroupAsync(string ruleCollectionName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetAdminRuleGroupAsy /// /// The name of the network manager security Configuration rule collection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAdminRuleGroup(string ruleCollectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderResource.cs index a1aeb8f9521e1..e7b11caa1ec9f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class SecurityPartnerProviderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The securityPartnerProviderName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string securityPartnerProviderName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleResource.cs index cc2645f74247b..d5bb794899a57 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class SecurityRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkSecurityGroupName. + /// The securityRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkSecurityGroupName, string securityRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionResource.cs index 2454dc3084c55..1b8593ad6a664 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class ServiceEndpointPolicyDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceEndpointPolicyName. + /// The serviceEndpointPolicyDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceEndpointPolicyName, string serviceEndpointPolicyDefinitionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyResource.cs index ab579cc8e1d99..9ec9006b84a35 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class ServiceEndpointPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serviceEndpointPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serviceEndpointPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceEndpointPolicyDefinitionResources and their operations over a ServiceEndpointPolicyDefinitionResource. public virtual ServiceEndpointPolicyDefinitionCollection GetServiceEndpointPolicyDefinitions() { - return GetCachedClient(Client => new ServiceEndpointPolicyDefinitionCollection(Client, Id)); + return GetCachedClient(client => new ServiceEndpointPolicyDefinitionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ServiceEndpointPolicyDefinitionCollection GetServiceEndpointPolic /// /// The name of the service endpoint policy definition name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceEndpointPolicyDefinitionAsync(string serviceEndpointPolicyDefinitionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> Get /// /// The name of the service endpoint policy definition name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceEndpointPolicyDefinition(string serviceEndpointPolicyDefinitionName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetResource.cs index ae8805aa80d0f..cf3b5ea29f5d9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Network public partial class SubnetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkName. + /// The subnetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkName, string subnetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubscriptionNetworkManagerConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubscriptionNetworkManagerConnectionResource.cs index 5bb0e7c7c0d70..2c63ece9e19a4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubscriptionNetworkManagerConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubscriptionNetworkManagerConnectionResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Network public partial class SubscriptionNetworkManagerConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The networkManagerConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string networkManagerConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkManagerConnections/{networkManagerConnectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteResource.cs index d6ef7a19d59f0..1a4e7fed383aa 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class VirtualApplianceSiteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The networkVirtualApplianceName. + /// The siteName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string networkVirtualApplianceName, string siteName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubResource.cs index 42fa480371564..e53a153f68d66 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class VirtualHubResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualHubName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualHubName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RouteMapResources and their operations over a RouteMapResource. public virtual RouteMapCollection GetRouteMaps() { - return GetCachedClient(Client => new RouteMapCollection(Client, Id)); + return GetCachedClient(client => new RouteMapCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual RouteMapCollection GetRouteMaps() /// /// The name of the RouteMap. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRouteMapAsync(string routeMapName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetRouteMapAsync(string ro /// /// The name of the RouteMap. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRouteMap(string routeMapName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetRouteMap(string routeMapName, Cance /// An object representing collection of HubVirtualNetworkConnectionResources and their operations over a HubVirtualNetworkConnectionResource. public virtual HubVirtualNetworkConnectionCollection GetHubVirtualNetworkConnections() { - return GetCachedClient(Client => new HubVirtualNetworkConnectionCollection(Client, Id)); + return GetCachedClient(client => new HubVirtualNetworkConnectionCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual HubVirtualNetworkConnectionCollection GetHubVirtualNetworkConnect /// /// The name of the vpn connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHubVirtualNetworkConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetHubV /// /// The name of the vpn connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHubVirtualNetworkConnection(string connectionName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetHubVirtualNetwor /// An object representing collection of VirtualHubRouteTableV2Resources and their operations over a VirtualHubRouteTableV2Resource. public virtual VirtualHubRouteTableV2Collection GetVirtualHubRouteTableV2s() { - return GetCachedClient(Client => new VirtualHubRouteTableV2Collection(Client, Id)); + return GetCachedClient(client => new VirtualHubRouteTableV2Collection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual VirtualHubRouteTableV2Collection GetVirtualHubRouteTableV2s() /// /// The name of the VirtualHubRouteTableV2. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualHubRouteTableV2Async(string routeTableName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetVirtualHu /// /// The name of the VirtualHubRouteTableV2. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualHubRouteTableV2(string routeTableName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetVirtualHubRouteTableV /// An object representing collection of BgpConnectionResources and their operations over a BgpConnectionResource. public virtual BgpConnectionCollection GetBgpConnections() { - return GetCachedClient(Client => new BgpConnectionCollection(Client, Id)); + return GetCachedClient(client => new BgpConnectionCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual BgpConnectionCollection GetBgpConnections() /// /// The name of the connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBgpConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetBgpConnectionAsync /// /// The name of the connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBgpConnection(string connectionName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetBgpConnection(string connectio /// An object representing collection of HubIPConfigurationResources and their operations over a HubIPConfigurationResource. public virtual HubIPConfigurationCollection GetHubIPConfigurations() { - return GetCachedClient(Client => new HubIPConfigurationCollection(Client, Id)); + return GetCachedClient(client => new HubIPConfigurationCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual HubIPConfigurationCollection GetHubIPConfigurations() /// /// The name of the ipconfig. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHubIPConfigurationAsync(string ipConfigName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task> GetHubIPConfigur /// /// The name of the ipconfig. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHubIPConfiguration(string ipConfigName, CancellationToken cancellationToken = default) { @@ -358,7 +361,7 @@ public virtual Response GetHubIPConfiguration(string /// An object representing collection of HubRouteTableResources and their operations over a HubRouteTableResource. public virtual HubRouteTableCollection GetHubRouteTables() { - return GetCachedClient(Client => new HubRouteTableCollection(Client, Id)); + return GetCachedClient(client => new HubRouteTableCollection(client, Id)); } /// @@ -376,8 +379,8 @@ public virtual HubRouteTableCollection GetHubRouteTables() /// /// The name of the RouteTable. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHubRouteTableAsync(string routeTableName, CancellationToken cancellationToken = default) { @@ -399,8 +402,8 @@ public virtual async Task> GetHubRouteTableAsync /// /// The name of the RouteTable. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHubRouteTable(string routeTableName, CancellationToken cancellationToken = default) { @@ -411,7 +414,7 @@ public virtual Response GetHubRouteTable(string routeTabl /// An object representing collection of RoutingIntentResources and their operations over a RoutingIntentResource. public virtual RoutingIntentCollection GetRoutingIntents() { - return GetCachedClient(Client => new RoutingIntentCollection(Client, Id)); + return GetCachedClient(client => new RoutingIntentCollection(client, Id)); } /// @@ -429,8 +432,8 @@ public virtual RoutingIntentCollection GetRoutingIntents() /// /// The name of the RoutingIntent. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRoutingIntentAsync(string routingIntentName, CancellationToken cancellationToken = default) { @@ -452,8 +455,8 @@ public virtual async Task> GetRoutingIntentAsync /// /// The name of the RoutingIntent. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRoutingIntent(string routingIntentName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Resource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Resource.cs index 2d22aa0ca5ad0..b8d7619a5a08d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Resource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Resource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class VirtualHubRouteTableV2Resource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualHubName. + /// The routeTableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualHubName, string routeTableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualMachineScaleSetNetworkResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualMachineScaleSetNetworkResource.cs index f7b6dfc76739f..145c845cded93 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualMachineScaleSetNetworkResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualMachineScaleSetNetworkResource.cs @@ -23,6 +23,9 @@ namespace Azure.ResourceManager.Network public partial class VirtualMachineScaleSetNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineScaleSetName. internal static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineScaleSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualMachineScaleSetVmNetworkResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualMachineScaleSetVmNetworkResource.cs index 6cf75277c422d..b87b9112018ed 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualMachineScaleSetVmNetworkResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualMachineScaleSetVmNetworkResource.cs @@ -24,6 +24,10 @@ namespace Azure.ResourceManager.Network public partial class VirtualMachineScaleSetVmNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineScaleSetName. + /// The virtualmachineIndex. internal static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineScaleSetName, string virtualmachineIndex) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionResource.cs index 7cce913bbb524..300f40a36fe7b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class VirtualNetworkGatewayConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkGatewayConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkGatewayConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleResource.cs index b5d2b959e5330..232c521f35a5c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class VirtualNetworkGatewayNatRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkGatewayName. + /// The natRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayResource.cs index 853876592f197..31a0d36b90710 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Network public partial class VirtualNetworkGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkGatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkGatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VirtualNetworkGatewayNatRuleResources and their operations over a VirtualNetworkGatewayNatRuleResource. public virtual VirtualNetworkGatewayNatRuleCollection GetVirtualNetworkGatewayNatRules() { - return GetCachedClient(Client => new VirtualNetworkGatewayNatRuleCollection(Client, Id)); + return GetCachedClient(client => new VirtualNetworkGatewayNatRuleCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual VirtualNetworkGatewayNatRuleCollection GetVirtualNetworkGatewayNa /// /// The name of the nat rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualNetworkGatewayNatRuleAsync(string natRuleName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetVir /// /// The name of the nat rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualNetworkGatewayNatRule(string natRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringResource.cs index f005a3a7bf497..9a906042bfe77 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Network public partial class VirtualNetworkPeeringResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkName. + /// The virtualNetworkPeeringName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkName, string virtualNetworkPeeringName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkResource.cs index 204fb12674945..850c0a8891ba3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Network public partial class VirtualNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}"; @@ -99,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SubnetResources and their operations over a SubnetResource. public virtual SubnetCollection GetSubnets() { - return GetCachedClient(Client => new SubnetCollection(Client, Id)); + return GetCachedClient(client => new SubnetCollection(client, Id)); } /// @@ -118,8 +121,8 @@ public virtual SubnetCollection GetSubnets() /// The name of the subnet. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSubnetAsync(string subnetName, string expand = null, CancellationToken cancellationToken = default) { @@ -142,8 +145,8 @@ public virtual async Task> GetSubnetAsync(string subnet /// The name of the subnet. /// Expands referenced resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSubnet(string subnetName, string expand = null, CancellationToken cancellationToken = default) { @@ -154,7 +157,7 @@ public virtual Response GetSubnet(string subnetName, string expa /// An object representing collection of VirtualNetworkPeeringResources and their operations over a VirtualNetworkPeeringResource. public virtual VirtualNetworkPeeringCollection GetVirtualNetworkPeerings() { - return GetCachedClient(Client => new VirtualNetworkPeeringCollection(Client, Id)); + return GetCachedClient(client => new VirtualNetworkPeeringCollection(client, Id)); } /// @@ -172,8 +175,8 @@ public virtual VirtualNetworkPeeringCollection GetVirtualNetworkPeerings() /// /// The name of the virtual network peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualNetworkPeeringAsync(string virtualNetworkPeeringName, CancellationToken cancellationToken = default) { @@ -195,8 +198,8 @@ public virtual async Task> GetVirtualNet /// /// The name of the virtual network peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualNetworkPeering(string virtualNetworkPeeringName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapResource.cs index 05bf2567a4a93..f3aab3f3c7003 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class VirtualNetworkTapResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The tapName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string tapName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringResource.cs index 8e689ea5b981f..07dd6d412dd0e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class VirtualRouterPeeringResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualRouterName. + /// The peeringName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualRouterName, string peeringName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterResource.cs index 6b044ff765d22..e39508cabfb30 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Network public partial class VirtualRouterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualRouterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualRouterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VirtualRouterPeeringResources and their operations over a VirtualRouterPeeringResource. public virtual VirtualRouterPeeringCollection GetVirtualRouterPeerings() { - return GetCachedClient(Client => new VirtualRouterPeeringCollection(Client, Id)); + return GetCachedClient(client => new VirtualRouterPeeringCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual VirtualRouterPeeringCollection GetVirtualRouterPeerings() /// /// The name of the Virtual Router Peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVirtualRouterPeeringAsync(string peeringName, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetVirtualRout /// /// The name of the Virtual Router Peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVirtualRouterPeering(string peeringName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWanResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWanResource.cs index cc2bdcdd2234d..05005245965c3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWanResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWanResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class VirtualWanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualWanName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualWanName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWanName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionResource.cs index 6c2f9ec24030e..c1566ca6d5d4b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Network public partial class VpnConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The gatewayName. + /// The connectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string gatewayName, string connectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VpnSiteLinkConnectionResources and their operations over a VpnSiteLinkConnectionResource. public virtual VpnSiteLinkConnectionCollection GetVpnSiteLinkConnections() { - return GetCachedClient(Client => new VpnSiteLinkConnectionCollection(Client, Id)); + return GetCachedClient(client => new VpnSiteLinkConnectionCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual VpnSiteLinkConnectionCollection GetVpnSiteLinkConnections() /// /// The name of the vpn connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVpnSiteLinkConnectionAsync(string linkConnectionName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetVpnSiteLin /// /// The name of the vpn connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVpnSiteLinkConnection(string linkConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleResource.cs index f3dcf4d92f949..836cd0269154a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class VpnGatewayNatRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The gatewayName. + /// The natRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string gatewayName, string natRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayResource.cs index 40c61ca245efb..c42cb60a08113 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class VpnGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The gatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string gatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VpnConnectionResources and their operations over a VpnConnectionResource. public virtual VpnConnectionCollection GetVpnConnections() { - return GetCachedClient(Client => new VpnConnectionCollection(Client, Id)); + return GetCachedClient(client => new VpnConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual VpnConnectionCollection GetVpnConnections() /// /// The name of the vpn connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVpnConnectionAsync(string connectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetVpnConnectionAsync /// /// The name of the vpn connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVpnConnection(string connectionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetVpnConnection(string connectio /// An object representing collection of VpnGatewayNatRuleResources and their operations over a VpnGatewayNatRuleResource. public virtual VpnGatewayNatRuleCollection GetVpnGatewayNatRules() { - return GetCachedClient(Client => new VpnGatewayNatRuleCollection(Client, Id)); + return GetCachedClient(client => new VpnGatewayNatRuleCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual VpnGatewayNatRuleCollection GetVpnGatewayNatRules() /// /// The name of the nat rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVpnGatewayNatRuleAsync(string natRuleName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetVpnGatewayNatR /// /// The name of the nat rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVpnGatewayNatRule(string natRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationPolicyGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationPolicyGroupResource.cs index 8552578e011ab..b67dd3b52f2b7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationPolicyGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationPolicyGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class VpnServerConfigurationPolicyGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vpnServerConfigurationName. + /// The configurationPolicyGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vpnServerConfigurationName, string configurationPolicyGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationResource.cs index 5d766ecef5fe0..5df50478829e6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class VpnServerConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vpnServerConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vpnServerConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VpnServerConfigurationPolicyGroupResources and their operations over a VpnServerConfigurationPolicyGroupResource. public virtual VpnServerConfigurationPolicyGroupCollection GetVpnServerConfigurationPolicyGroups() { - return GetCachedClient(Client => new VpnServerConfigurationPolicyGroupCollection(Client, Id)); + return GetCachedClient(client => new VpnServerConfigurationPolicyGroupCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual VpnServerConfigurationPolicyGroupCollection GetVpnServerConfigura /// /// The name of the ConfigurationPolicyGroup being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVpnServerConfigurationPolicyGroupAsync(string configurationPolicyGroupName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> G /// /// The name of the ConfigurationPolicyGroup being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVpnServerConfigurationPolicyGroup(string configurationPolicyGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkConnectionResource.cs index 00f6306d3010f..271f3b1c9b965 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkConnectionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Network public partial class VpnSiteLinkConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The gatewayName. + /// The connectionName. + /// The linkConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string gatewayName, string connectionName, string linkConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkResource.cs index 6475d61464001..a981a3942a20e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Network public partial class VpnSiteLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vpnSiteName. + /// The vpnSiteLinkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vpnSiteName, string vpnSiteLinkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName}"; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteResource.cs index 15a54f52291ed..04933f71290f5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Network public partial class VpnSiteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vpnSiteName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vpnSiteName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VpnSiteLinkResources and their operations over a VpnSiteLinkResource. public virtual VpnSiteLinkCollection GetVpnSiteLinks() { - return GetCachedClient(Client => new VpnSiteLinkCollection(Client, Id)); + return GetCachedClient(client => new VpnSiteLinkCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual VpnSiteLinkCollection GetVpnSiteLinks() /// /// The name of the VpnSiteLink being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVpnSiteLinkAsync(string vpnSiteLinkName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetVpnSiteLinkAsync(str /// /// The name of the VpnSiteLink being retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVpnSiteLink(string vpnSiteLinkName, CancellationToken cancellationToken = default) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyResource.cs index b407e96a5639e..6ec57c7f0cd53 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Network public partial class WebApplicationFirewallPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}"; diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/CHANGELOG.md b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/CHANGELOG.md index 3863f17d62ef0..da1117c27ac7f 100644 --- a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/CHANGELOG.md +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.1 (2023-11-01) ### General New Features diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/api/Azure.ResourceManager.NetworkAnalytics.netstandard2.0.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/api/Azure.ResourceManager.NetworkAnalytics.netstandard2.0.cs index bfa7c9459e54e..7967d018ab959 100644 --- a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/api/Azure.ResourceManager.NetworkAnalytics.netstandard2.0.cs +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/api/Azure.ResourceManager.NetworkAnalytics.netstandard2.0.cs @@ -19,7 +19,7 @@ protected DataProductCollection() { } } public partial class DataProductData : Azure.ResourceManager.Models.TrackedResourceData { - public DataProductData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DataProductData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList AvailableMinorVersions { get { throw null; } } public Azure.ResourceManager.NetworkAnalytics.Models.ConsumptionEndpointsProperties ConsumptionEndpoints { get { throw null; } } public string CurrentMinorVersion { get { throw null; } set { } } @@ -104,6 +104,31 @@ public static partial class NetworkAnalyticsExtensions public static Azure.AsyncPageable GetDataProductsCatalogsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.NetworkAnalytics.Mocking +{ + public partial class MockableNetworkAnalyticsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNetworkAnalyticsArmClient() { } + public virtual Azure.ResourceManager.NetworkAnalytics.DataProductResource GetDataProductResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkAnalytics.DataProductsCatalogResource GetDataProductsCatalogResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNetworkAnalyticsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkAnalyticsResourceGroupResource() { } + public virtual Azure.Response GetDataProduct(string dataProductName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataProductAsync(string dataProductName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkAnalytics.DataProductCollection GetDataProducts() { throw null; } + public virtual Azure.ResourceManager.NetworkAnalytics.DataProductsCatalogResource GetDataProductsCatalog() { throw null; } + } + public partial class MockableNetworkAnalyticsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkAnalyticsSubscriptionResource() { } + public virtual Azure.Pageable GetDataProducts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataProductsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataProductsCatalogs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataProductsCatalogsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.NetworkAnalytics.Models { public partial class AccountSasContent diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Azure.ResourceManager.NetworkAnalytics.csproj b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Azure.ResourceManager.NetworkAnalytics.csproj index 0199d3ac34b98..d1733a2f3060e 100644 --- a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Azure.ResourceManager.NetworkAnalytics.csproj +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Azure.ResourceManager.NetworkAnalytics.csproj @@ -1,6 +1,6 @@ - + - 1.0.0-beta.1 + 1.0.0-beta.2 Azure.ResourceManager.NetworkAnalytics Azure Resource Manager client SDK for Azure resource provider NetworkAnalytics. azure;management;arm;resource manager;networkanalytics diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/DataProductResource.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/DataProductResource.cs index 63ffe604931e4..ee5b0dcfbdb94 100644 --- a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/DataProductResource.cs +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/DataProductResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.NetworkAnalytics public partial class DataProductResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dataProductName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dataProductName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName}"; diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/DataProductsCatalogResource.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/DataProductsCatalogResource.cs index 42146255f4955..a5ad8b435e3a7 100644 --- a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/DataProductsCatalogResource.cs +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/DataProductsCatalogResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.NetworkAnalytics public partial class DataProductsCatalogResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs/default"; diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsArmClient.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsArmClient.cs new file mode 100644 index 0000000000000..d7652172fdae5 --- /dev/null +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NetworkAnalytics; + +namespace Azure.ResourceManager.NetworkAnalytics.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNetworkAnalyticsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetworkAnalyticsArmClient() + { + } + + /// 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 MockableNetworkAnalyticsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNetworkAnalyticsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataProductResource GetDataProductResource(ResourceIdentifier id) + { + DataProductResource.ValidateResourceId(id); + return new DataProductResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataProductsCatalogResource GetDataProductsCatalogResource(ResourceIdentifier id) + { + DataProductsCatalogResource.ValidateResourceId(id); + return new DataProductsCatalogResource(Client, id); + } + } +} diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsResourceGroupResource.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsResourceGroupResource.cs new file mode 100644 index 0000000000000..de559747f006f --- /dev/null +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsResourceGroupResource.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NetworkAnalytics; + +namespace Azure.ResourceManager.NetworkAnalytics.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNetworkAnalyticsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetworkAnalyticsResourceGroupResource() + { + } + + /// 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 MockableNetworkAnalyticsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataProductResources in the ResourceGroupResource. + /// An object representing collection of DataProductResources and their operations over a DataProductResource. + public virtual DataProductCollection GetDataProducts() + { + return GetCachedClient(client => new DataProductCollection(client, Id)); + } + + /// + /// Retrieve data product resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName} + /// + /// + /// Operation Id + /// DataProducts_Get + /// + /// + /// + /// The data product resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataProductAsync(string dataProductName, CancellationToken cancellationToken = default) + { + return await GetDataProducts().GetAsync(dataProductName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve data product resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkAnalytics/dataProducts/{dataProductName} + /// + /// + /// Operation Id + /// DataProducts_Get + /// + /// + /// + /// The data product resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataProduct(string dataProductName, CancellationToken cancellationToken = default) + { + return GetDataProducts().Get(dataProductName, cancellationToken); + } + + /// Gets an object representing a DataProductsCatalogResource along with the instance operations that can be performed on it in the ResourceGroupResource. + /// Returns a object. + public virtual DataProductsCatalogResource GetDataProductsCatalog() + { + return new DataProductsCatalogResource(Client, Id.AppendProviderResource("Microsoft.NetworkAnalytics", "dataProductsCatalogs", "default")); + } + } +} diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsSubscriptionResource.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsSubscriptionResource.cs new file mode 100644 index 0000000000000..b9cd1d17197c3 --- /dev/null +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/MockableNetworkAnalyticsSubscriptionResource.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetworkAnalytics; + +namespace Azure.ResourceManager.NetworkAnalytics.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNetworkAnalyticsSubscriptionResource : ArmResource + { + private ClientDiagnostics _dataProductClientDiagnostics; + private DataProductsRestOperations _dataProductRestClient; + private ClientDiagnostics _dataProductsCatalogClientDiagnostics; + private DataProductsCatalogsRestOperations _dataProductsCatalogRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNetworkAnalyticsSubscriptionResource() + { + } + + /// 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 MockableNetworkAnalyticsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataProductClientDiagnostics => _dataProductClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkAnalytics", DataProductResource.ResourceType.Namespace, Diagnostics); + private DataProductsRestOperations DataProductRestClient => _dataProductRestClient ??= new DataProductsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataProductResource.ResourceType)); + private ClientDiagnostics DataProductsCatalogClientDiagnostics => _dataProductsCatalogClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkAnalytics", DataProductsCatalogResource.ResourceType.Namespace, Diagnostics); + private DataProductsCatalogsRestOperations DataProductsCatalogRestClient => _dataProductsCatalogRestClient ??= new DataProductsCatalogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataProductsCatalogResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List data products by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProducts + /// + /// + /// Operation Id + /// DataProducts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataProductsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataProductRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProductRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataProductResource(Client, DataProductData.DeserializeDataProductData(e)), DataProductClientDiagnostics, Pipeline, "MockableNetworkAnalyticsSubscriptionResource.GetDataProducts", "value", "nextLink", cancellationToken); + } + + /// + /// List data products by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProducts + /// + /// + /// Operation Id + /// DataProducts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataProducts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataProductRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProductRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataProductResource(Client, DataProductData.DeserializeDataProductData(e)), DataProductClientDiagnostics, Pipeline, "MockableNetworkAnalyticsSubscriptionResource.GetDataProducts", "value", "nextLink", cancellationToken); + } + + /// + /// List data catalog by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs + /// + /// + /// Operation Id + /// DataProductsCatalogs_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataProductsCatalogsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataProductsCatalogRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProductsCatalogRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataProductsCatalogResource(Client, DataProductsCatalogData.DeserializeDataProductsCatalogData(e)), DataProductsCatalogClientDiagnostics, Pipeline, "MockableNetworkAnalyticsSubscriptionResource.GetDataProductsCatalogs", "value", "nextLink", cancellationToken); + } + + /// + /// List data catalog by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs + /// + /// + /// Operation Id + /// DataProductsCatalogs_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataProductsCatalogs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataProductsCatalogRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProductsCatalogRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataProductsCatalogResource(Client, DataProductsCatalogData.DeserializeDataProductsCatalogData(e)), DataProductsCatalogClientDiagnostics, Pipeline, "MockableNetworkAnalyticsSubscriptionResource.GetDataProductsCatalogs", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/NetworkAnalyticsExtensions.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/NetworkAnalyticsExtensions.cs index 906ed4ce0f617..429b6aa254543 100644 --- a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/NetworkAnalyticsExtensions.cs +++ b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/NetworkAnalyticsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.NetworkAnalytics.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetworkAnalytics @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.NetworkAnalytics /// A class to add extension methods to Azure.ResourceManager.NetworkAnalytics. public static partial class NetworkAnalyticsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableNetworkAnalyticsArmClient GetMockableNetworkAnalyticsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableNetworkAnalyticsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNetworkAnalyticsResourceGroupResource GetMockableNetworkAnalyticsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNetworkAnalyticsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableNetworkAnalyticsSubscriptionResource GetMockableNetworkAnalyticsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableNetworkAnalyticsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataProductResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataProductResource GetDataProductResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataProductResource.ValidateResourceId(id); - return new DataProductResource(client, id); - } - ); + return GetMockableNetworkAnalyticsArmClient(client).GetDataProductResource(id); } - #endregion - #region DataProductsCatalogResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataProductsCatalogResource GetDataProductsCatalogResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataProductsCatalogResource.ValidateResourceId(id); - return new DataProductsCatalogResource(client, id); - } - ); + return GetMockableNetworkAnalyticsArmClient(client).GetDataProductsCatalogResource(id); } - #endregion - /// Gets a collection of DataProductResources in the ResourceGroupResource. + /// + /// Gets a collection of DataProductResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataProductResources and their operations over a DataProductResource. public static DataProductCollection GetDataProducts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataProducts(); + return GetMockableNetworkAnalyticsResourceGroupResource(resourceGroupResource).GetDataProducts(); } /// @@ -107,16 +92,20 @@ public static DataProductCollection GetDataProducts(this ResourceGroupResource r /// DataProducts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The data product resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataProductAsync(this ResourceGroupResource resourceGroupResource, string dataProductName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataProducts().GetAsync(dataProductName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkAnalyticsResourceGroupResource(resourceGroupResource).GetDataProductAsync(dataProductName, cancellationToken).ConfigureAwait(false); } /// @@ -131,24 +120,34 @@ public static async Task> GetDataProductAsync(this /// DataProducts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The data product resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataProduct(this ResourceGroupResource resourceGroupResource, string dataProductName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataProducts().Get(dataProductName, cancellationToken); + return GetMockableNetworkAnalyticsResourceGroupResource(resourceGroupResource).GetDataProduct(dataProductName, cancellationToken); } - /// Gets an object representing a DataProductsCatalogResource along with the instance operations that can be performed on it in the ResourceGroupResource. + /// + /// Gets an object representing a DataProductsCatalogResource along with the instance operations that can be performed on it in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Returns a object. public static DataProductsCatalogResource GetDataProductsCatalog(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataProductsCatalog(); + return GetMockableNetworkAnalyticsResourceGroupResource(resourceGroupResource).GetDataProductsCatalog(); } /// @@ -163,13 +162,17 @@ public static DataProductsCatalogResource GetDataProductsCatalog(this ResourceGr /// DataProducts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataProductsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataProductsAsync(cancellationToken); + return GetMockableNetworkAnalyticsSubscriptionResource(subscriptionResource).GetDataProductsAsync(cancellationToken); } /// @@ -184,13 +187,17 @@ public static AsyncPageable GetDataProductsAsync(this Subsc /// DataProducts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataProducts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataProducts(cancellationToken); + return GetMockableNetworkAnalyticsSubscriptionResource(subscriptionResource).GetDataProducts(cancellationToken); } /// @@ -205,13 +212,17 @@ public static Pageable GetDataProducts(this SubscriptionRes /// DataProductsCatalogs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataProductsCatalogsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataProductsCatalogsAsync(cancellationToken); + return GetMockableNetworkAnalyticsSubscriptionResource(subscriptionResource).GetDataProductsCatalogsAsync(cancellationToken); } /// @@ -226,13 +237,17 @@ public static AsyncPageable GetDataProductsCatalogs /// DataProductsCatalogs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDataProductsCatalogs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataProductsCatalogs(cancellationToken); + return GetMockableNetworkAnalyticsSubscriptionResource(subscriptionResource).GetDataProductsCatalogs(cancellationToken); } } } diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 0d7ab7ef8bce0..0000000000000 --- a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NetworkAnalytics -{ - /// 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 DataProductResources in the ResourceGroupResource. - /// An object representing collection of DataProductResources and their operations over a DataProductResource. - public virtual DataProductCollection GetDataProducts() - { - return GetCachedClient(Client => new DataProductCollection(Client, Id)); - } - - /// Gets an object representing a DataProductsCatalogResource along with the instance operations that can be performed on it in the ResourceGroupResource. - /// Returns a object. - public virtual DataProductsCatalogResource GetDataProductsCatalog() - { - return new DataProductsCatalogResource(Client, Id.AppendProviderResource("Microsoft.NetworkAnalytics", "dataProductsCatalogs", "default")); - } - } -} diff --git a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 1a6aeb1dc1186..0000000000000 --- a/sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NetworkAnalytics -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataProductClientDiagnostics; - private DataProductsRestOperations _dataProductRestClient; - private ClientDiagnostics _dataProductsCatalogClientDiagnostics; - private DataProductsCatalogsRestOperations _dataProductsCatalogRestClient; - - /// 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 DataProductClientDiagnostics => _dataProductClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkAnalytics", DataProductResource.ResourceType.Namespace, Diagnostics); - private DataProductsRestOperations DataProductRestClient => _dataProductRestClient ??= new DataProductsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataProductResource.ResourceType)); - private ClientDiagnostics DataProductsCatalogClientDiagnostics => _dataProductsCatalogClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkAnalytics", DataProductsCatalogResource.ResourceType.Namespace, Diagnostics); - private DataProductsCatalogsRestOperations DataProductsCatalogRestClient => _dataProductsCatalogRestClient ??= new DataProductsCatalogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataProductsCatalogResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List data products by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProducts - /// - /// - /// Operation Id - /// DataProducts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataProductsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataProductRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProductRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataProductResource(Client, DataProductData.DeserializeDataProductData(e)), DataProductClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataProducts", "value", "nextLink", cancellationToken); - } - - /// - /// List data products by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProducts - /// - /// - /// Operation Id - /// DataProducts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataProducts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataProductRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProductRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataProductResource(Client, DataProductData.DeserializeDataProductData(e)), DataProductClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataProducts", "value", "nextLink", cancellationToken); - } - - /// - /// List data catalog by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs - /// - /// - /// Operation Id - /// DataProductsCatalogs_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataProductsCatalogsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataProductsCatalogRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProductsCatalogRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataProductsCatalogResource(Client, DataProductsCatalogData.DeserializeDataProductsCatalogData(e)), DataProductsCatalogClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataProductsCatalogs", "value", "nextLink", cancellationToken); - } - - /// - /// List data catalog by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProductsCatalogs - /// - /// - /// Operation Id - /// DataProductsCatalogs_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataProductsCatalogs(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataProductsCatalogRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataProductsCatalogRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataProductsCatalogResource(Client, DataProductsCatalogData.DeserializeDataProductsCatalogData(e)), DataProductsCatalogClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataProductsCatalogs", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/README.md b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/README.md index ec98a76358816..60765f49d5dfe 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/README.md +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/README.md @@ -10,7 +10,7 @@ This library follows the [new Azure SDK guidelines](https://azure.github.io/azur - Better error-handling. - Support uniform telemetry across all languages. -## Getting started +## Getting started ### Install the package @@ -77,4 +77,4 @@ more information, see the [Code of Conduct FAQ][coc_faq] or contact [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 +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/api/Azure.ResourceManager.NetworkCloud.netstandard2.0.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/api/Azure.ResourceManager.NetworkCloud.netstandard2.0.cs index c500523b53429..bd0e0f6c79f8e 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/api/Azure.ResourceManager.NetworkCloud.netstandard2.0.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/api/Azure.ResourceManager.NetworkCloud.netstandard2.0.cs @@ -19,7 +19,7 @@ protected NetworkCloudAgentPoolCollection() { } } public partial class NetworkCloudAgentPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudAgentPoolData(Azure.Core.AzureLocation location, long count, Azure.ResourceManager.NetworkCloud.Models.NetworkCloudAgentPoolMode mode, string vmSkuName) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudAgentPoolData(Azure.Core.AzureLocation location, long count, Azure.ResourceManager.NetworkCloud.Models.NetworkCloudAgentPoolMode mode, string vmSkuName) { } public Azure.ResourceManager.NetworkCloud.Models.AdministratorConfiguration AdministratorConfiguration { get { throw null; } set { } } public Azure.ResourceManager.NetworkCloud.Models.NetworkCloudAgentConfiguration AgentOptions { get { throw null; } set { } } public Azure.ResourceManager.NetworkCloud.Models.AttachedNetworkConfiguration AttachedNetworkConfiguration { get { throw null; } set { } } @@ -73,7 +73,7 @@ protected NetworkCloudBareMetalMachineCollection() { } } public partial class NetworkCloudBareMetalMachineData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudBareMetalMachineData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string bmcConnectionString, Azure.ResourceManager.NetworkCloud.Models.AdministrativeCredentials bmcCredentials, string bmcMacAddress, string bootMacAddress, string machineDetails, string machineName, string machineSkuId, Azure.Core.ResourceIdentifier rackId, long rackSlot, string serialNumber) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudBareMetalMachineData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string bmcConnectionString, Azure.ResourceManager.NetworkCloud.Models.AdministrativeCredentials bmcCredentials, string bmcMacAddress, string bootMacAddress, string machineDetails, string machineName, string machineSkuId, Azure.Core.ResourceIdentifier rackId, long rackSlot, string serialNumber) { } public System.Collections.Generic.IReadOnlyList AssociatedResourceIds { get { throw null; } } public string BmcConnectionString { get { throw null; } set { } } public Azure.ResourceManager.NetworkCloud.Models.AdministrativeCredentials BmcCredentials { get { throw null; } set { } } @@ -123,7 +123,7 @@ protected NetworkCloudBareMetalMachineKeySetCollection() { } } public partial class NetworkCloudBareMetalMachineKeySetData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudBareMetalMachineKeySetData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string azureGroupId, System.DateTimeOffset expireOn, System.Collections.Generic.IEnumerable jumpHostsAllowed, Azure.ResourceManager.NetworkCloud.Models.BareMetalMachineKeySetPrivilegeLevel privilegeLevel, System.Collections.Generic.IEnumerable userList) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudBareMetalMachineKeySetData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string azureGroupId, System.DateTimeOffset expireOn, System.Collections.Generic.IEnumerable jumpHostsAllowed, Azure.ResourceManager.NetworkCloud.Models.BareMetalMachineKeySetPrivilegeLevel privilegeLevel, System.Collections.Generic.IEnumerable userList) { } public string AzureGroupId { get { throw null; } set { } } public Azure.ResourceManager.NetworkCloud.Models.BareMetalMachineKeySetDetailedStatus? DetailedStatus { get { throw null; } } public string DetailedStatusMessage { get { throw null; } } @@ -214,7 +214,7 @@ protected NetworkCloudBmcKeySetCollection() { } } public partial class NetworkCloudBmcKeySetData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudBmcKeySetData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string azureGroupId, System.DateTimeOffset expireOn, Azure.ResourceManager.NetworkCloud.Models.BmcKeySetPrivilegeLevel privilegeLevel, System.Collections.Generic.IEnumerable userList) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudBmcKeySetData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string azureGroupId, System.DateTimeOffset expireOn, Azure.ResourceManager.NetworkCloud.Models.BmcKeySetPrivilegeLevel privilegeLevel, System.Collections.Generic.IEnumerable userList) { } public string AzureGroupId { get { throw null; } set { } } public Azure.ResourceManager.NetworkCloud.Models.BmcKeySetDetailedStatus? DetailedStatus { get { throw null; } } public string DetailedStatusMessage { get { throw null; } } @@ -265,7 +265,7 @@ protected NetworkCloudCloudServicesNetworkCollection() { } } public partial class NetworkCloudCloudServicesNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudCloudServicesNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudCloudServicesNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation) { } public System.Collections.Generic.IList AdditionalEgressEndpoints { get { throw null; } } public System.Collections.Generic.IReadOnlyList AssociatedResourceIds { get { throw null; } } public Azure.Core.ResourceIdentifier ClusterId { get { throw null; } } @@ -318,7 +318,7 @@ protected NetworkCloudClusterCollection() { } } public partial class NetworkCloudClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.ResourceManager.NetworkCloud.Models.NetworkCloudRackDefinition aggregatorOrSingleRackDefinition, Azure.ResourceManager.NetworkCloud.Models.ClusterType clusterType, string clusterVersion, Azure.Core.ResourceIdentifier networkFabricId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.ResourceManager.NetworkCloud.Models.NetworkCloudRackDefinition aggregatorOrSingleRackDefinition, Azure.ResourceManager.NetworkCloud.Models.ClusterType clusterType, string clusterVersion, Azure.Core.ResourceIdentifier networkFabricId) { } public Azure.ResourceManager.NetworkCloud.Models.NetworkCloudRackDefinition AggregatorOrSingleRackDefinition { get { throw null; } set { } } public Azure.Core.ResourceIdentifier AnalyticsWorkspaceId { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList AvailableUpgradeVersions { get { throw null; } } @@ -363,7 +363,7 @@ protected NetworkCloudClusterManagerCollection() { } } public partial class NetworkCloudClusterManagerData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudClusterManagerData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier fabricControllerId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudClusterManagerData(Azure.Core.AzureLocation location, Azure.Core.ResourceIdentifier fabricControllerId) { } public Azure.Core.ResourceIdentifier AnalyticsWorkspaceId { get { throw null; } set { } } public System.Collections.Generic.IList AvailabilityZones { get { throw null; } } public System.Collections.Generic.IReadOnlyList ClusterVersions { get { throw null; } } @@ -414,7 +414,7 @@ protected NetworkCloudClusterMetricsConfigurationCollection() { } } public partial class NetworkCloudClusterMetricsConfigurationData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudClusterMetricsConfigurationData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, long collectionInterval) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudClusterMetricsConfigurationData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, long collectionInterval) { } public long CollectionInterval { get { throw null; } set { } } public Azure.ResourceManager.NetworkCloud.Models.ClusterMetricsConfigurationDetailedStatus? DetailedStatus { get { throw null; } } public string DetailedStatusMessage { get { throw null; } } @@ -579,7 +579,7 @@ protected NetworkCloudKubernetesClusterCollection() { } } public partial class NetworkCloudKubernetesClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudKubernetesClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.ResourceManager.NetworkCloud.Models.ControlPlaneNodeConfiguration controlPlaneNodeConfiguration, System.Collections.Generic.IEnumerable initialAgentPoolConfigurations, string kubernetesVersion, Azure.ResourceManager.NetworkCloud.Models.KubernetesClusterNetworkConfiguration networkConfiguration) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudKubernetesClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.ResourceManager.NetworkCloud.Models.ControlPlaneNodeConfiguration controlPlaneNodeConfiguration, System.Collections.Generic.IEnumerable initialAgentPoolConfigurations, string kubernetesVersion, Azure.ResourceManager.NetworkCloud.Models.KubernetesClusterNetworkConfiguration networkConfiguration) { } public System.Collections.Generic.IList AadAdminGroupObjectIds { get { throw null; } set { } } public Azure.ResourceManager.NetworkCloud.Models.AdministratorConfiguration AdministratorConfiguration { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList AttachedNetworkIds { get { throw null; } } @@ -643,7 +643,7 @@ protected NetworkCloudL2NetworkCollection() { } } public partial class NetworkCloudL2NetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudL2NetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.Core.ResourceIdentifier l2IsolationDomainId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudL2NetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.Core.ResourceIdentifier l2IsolationDomainId) { } public System.Collections.Generic.IReadOnlyList AssociatedResourceIds { get { throw null; } } public Azure.Core.ResourceIdentifier ClusterId { get { throw null; } } public Azure.ResourceManager.NetworkCloud.Models.L2NetworkDetailedStatus? DetailedStatus { get { throw null; } } @@ -695,7 +695,7 @@ protected NetworkCloudL3NetworkCollection() { } } public partial class NetworkCloudL3NetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudL3NetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.Core.ResourceIdentifier l3IsolationDomainId, long vlan) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudL3NetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.Core.ResourceIdentifier l3IsolationDomainId, long vlan) { } public System.Collections.Generic.IReadOnlyList AssociatedResourceIds { get { throw null; } } public Azure.Core.ResourceIdentifier ClusterId { get { throw null; } } public Azure.ResourceManager.NetworkCloud.Models.L3NetworkDetailedStatus? DetailedStatus { get { throw null; } } @@ -750,7 +750,7 @@ protected NetworkCloudRackCollection() { } } public partial class NetworkCloudRackData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudRackData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string availabilityZone, string rackLocation, string rackSerialNumber, Azure.Core.ResourceIdentifier rackSkuId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudRackData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string availabilityZone, string rackLocation, string rackSerialNumber, Azure.Core.ResourceIdentifier rackSkuId) { } public string AvailabilityZone { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ClusterId { get { throw null; } } public Azure.ResourceManager.NetworkCloud.Models.RackDetailedStatus? DetailedStatus { get { throw null; } } @@ -833,7 +833,7 @@ protected NetworkCloudStorageApplianceCollection() { } } public partial class NetworkCloudStorageApplianceData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudStorageApplianceData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.ResourceManager.NetworkCloud.Models.AdministrativeCredentials administratorCredentials, Azure.Core.ResourceIdentifier rackId, long rackSlot, string serialNumber, string storageApplianceSkuId) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudStorageApplianceData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.ResourceManager.NetworkCloud.Models.AdministrativeCredentials administratorCredentials, Azure.Core.ResourceIdentifier rackId, long rackSlot, string serialNumber, string storageApplianceSkuId) { } public Azure.ResourceManager.NetworkCloud.Models.AdministrativeCredentials AdministratorCredentials { get { throw null; } set { } } public long? Capacity { get { throw null; } } public long? CapacityUsed { get { throw null; } } @@ -891,7 +891,7 @@ protected NetworkCloudTrunkedNetworkCollection() { } } public partial class NetworkCloudTrunkedNetworkData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudTrunkedNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, System.Collections.Generic.IEnumerable isolationDomainIds, System.Collections.Generic.IEnumerable vlans) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudTrunkedNetworkData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, System.Collections.Generic.IEnumerable isolationDomainIds, System.Collections.Generic.IEnumerable vlans) { } public System.Collections.Generic.IReadOnlyList AssociatedResourceIds { get { throw null; } } public Azure.Core.ResourceIdentifier ClusterId { get { throw null; } } public Azure.ResourceManager.NetworkCloud.Models.TrunkedNetworkDetailedStatus? DetailedStatus { get { throw null; } } @@ -961,7 +961,7 @@ protected NetworkCloudVirtualMachineConsoleCollection() { } } public partial class NetworkCloudVirtualMachineConsoleData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudVirtualMachineConsoleData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.ResourceManager.NetworkCloud.Models.ConsoleEnabled enabled, Azure.ResourceManager.NetworkCloud.Models.NetworkCloudSshPublicKey sshPublicKey) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudVirtualMachineConsoleData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, Azure.ResourceManager.NetworkCloud.Models.ConsoleEnabled enabled, Azure.ResourceManager.NetworkCloud.Models.NetworkCloudSshPublicKey sshPublicKey) { } public Azure.ResourceManager.NetworkCloud.Models.ConsoleDetailedStatus? DetailedStatus { get { throw null; } } public string DetailedStatusMessage { get { throw null; } } public Azure.ResourceManager.NetworkCloud.Models.ConsoleEnabled Enabled { get { throw null; } set { } } @@ -994,7 +994,7 @@ protected NetworkCloudVirtualMachineConsoleResource() { } } public partial class NetworkCloudVirtualMachineData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudVirtualMachineData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string adminUsername, Azure.ResourceManager.NetworkCloud.Models.NetworkAttachment cloudServicesNetworkAttachment, long cpuCores, long memorySizeInGB, Azure.ResourceManager.NetworkCloud.Models.NetworkCloudStorageProfile storageProfile, string vmImage) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudVirtualMachineData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, string adminUsername, Azure.ResourceManager.NetworkCloud.Models.NetworkAttachment cloudServicesNetworkAttachment, long cpuCores, long memorySizeInGB, Azure.ResourceManager.NetworkCloud.Models.NetworkCloudStorageProfile storageProfile, string vmImage) { } public string AdminUsername { get { throw null; } set { } } public string AvailabilityZone { get { throw null; } } public Azure.Core.ResourceIdentifier BareMetalMachineId { get { throw null; } } @@ -1071,7 +1071,7 @@ protected NetworkCloudVolumeCollection() { } } public partial class NetworkCloudVolumeData : Azure.ResourceManager.Models.TrackedResourceData { - public NetworkCloudVolumeData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, long sizeInMiB) : base (default(Azure.Core.AzureLocation)) { } + public NetworkCloudVolumeData(Azure.Core.AzureLocation location, Azure.ResourceManager.NetworkCloud.Models.ExtendedLocation extendedLocation, long sizeInMiB) { } public System.Collections.Generic.IReadOnlyList AttachedTo { get { throw null; } } public Azure.ResourceManager.NetworkCloud.Models.VolumeDetailedStatus? DetailedStatus { get { throw null; } } public string DetailedStatusMessage { get { throw null; } } @@ -1101,6 +1101,102 @@ protected NetworkCloudVolumeResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.NetworkCloud.Models.NetworkCloudVolumePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.NetworkCloud.Mocking +{ + public partial class MockableNetworkCloudArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNetworkCloudArmClient() { } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudAgentPoolResource GetNetworkCloudAgentPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudBareMetalMachineKeySetResource GetNetworkCloudBareMetalMachineKeySetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudBareMetalMachineResource GetNetworkCloudBareMetalMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudBmcKeySetResource GetNetworkCloudBmcKeySetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudCloudServicesNetworkResource GetNetworkCloudCloudServicesNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudClusterManagerResource GetNetworkCloudClusterManagerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudClusterMetricsConfigurationResource GetNetworkCloudClusterMetricsConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudClusterResource GetNetworkCloudClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudKubernetesClusterResource GetNetworkCloudKubernetesClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudL2NetworkResource GetNetworkCloudL2NetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudL3NetworkResource GetNetworkCloudL3NetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudRackResource GetNetworkCloudRackResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudRackSkuResource GetNetworkCloudRackSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudStorageApplianceResource GetNetworkCloudStorageApplianceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudTrunkedNetworkResource GetNetworkCloudTrunkedNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudVirtualMachineConsoleResource GetNetworkCloudVirtualMachineConsoleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudVirtualMachineResource GetNetworkCloudVirtualMachineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudVolumeResource GetNetworkCloudVolumeResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNetworkCloudResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkCloudResourceGroupResource() { } + public virtual Azure.Response GetNetworkCloudBareMetalMachine(string bareMetalMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudBareMetalMachineAsync(string bareMetalMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudBareMetalMachineCollection GetNetworkCloudBareMetalMachines() { throw null; } + public virtual Azure.Response GetNetworkCloudCloudServicesNetwork(string cloudServicesNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudCloudServicesNetworkAsync(string cloudServicesNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudCloudServicesNetworkCollection GetNetworkCloudCloudServicesNetworks() { throw null; } + public virtual Azure.Response GetNetworkCloudCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkCloudClusterManager(string clusterManagerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudClusterManagerAsync(string clusterManagerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudClusterManagerCollection GetNetworkCloudClusterManagers() { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudClusterCollection GetNetworkCloudClusters() { throw null; } + public virtual Azure.Response GetNetworkCloudKubernetesCluster(string kubernetesClusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudKubernetesClusterAsync(string kubernetesClusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudKubernetesClusterCollection GetNetworkCloudKubernetesClusters() { throw null; } + public virtual Azure.Response GetNetworkCloudL2Network(string l2NetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudL2NetworkAsync(string l2NetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudL2NetworkCollection GetNetworkCloudL2Networks() { throw null; } + public virtual Azure.Response GetNetworkCloudL3Network(string l3NetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudL3NetworkAsync(string l3NetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudL3NetworkCollection GetNetworkCloudL3Networks() { throw null; } + public virtual Azure.Response GetNetworkCloudRack(string rackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudRackAsync(string rackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudRackCollection GetNetworkCloudRacks() { throw null; } + public virtual Azure.Response GetNetworkCloudStorageAppliance(string storageApplianceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudStorageApplianceAsync(string storageApplianceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudStorageApplianceCollection GetNetworkCloudStorageAppliances() { throw null; } + public virtual Azure.Response GetNetworkCloudTrunkedNetwork(string trunkedNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudTrunkedNetworkAsync(string trunkedNetworkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudTrunkedNetworkCollection GetNetworkCloudTrunkedNetworks() { throw null; } + public virtual Azure.Response GetNetworkCloudVirtualMachine(string virtualMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudVirtualMachineAsync(string virtualMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudVirtualMachineCollection GetNetworkCloudVirtualMachines() { throw null; } + public virtual Azure.Response GetNetworkCloudVolume(string volumeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudVolumeAsync(string volumeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudVolumeCollection GetNetworkCloudVolumes() { throw null; } + } + public partial class MockableNetworkCloudSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkCloudSubscriptionResource() { } + public virtual Azure.Pageable GetNetworkCloudBareMetalMachines(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudBareMetalMachinesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudCloudServicesNetworks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudCloudServicesNetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudClusterManagers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudClusterManagersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudKubernetesClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudKubernetesClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudL2Networks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudL2NetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudL3Networks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudL3NetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudRacks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudRacksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetNetworkCloudRackSku(string rackSkuName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNetworkCloudRackSkuAsync(string rackSkuName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkCloud.NetworkCloudRackSkuCollection GetNetworkCloudRackSkus() { throw null; } + public virtual Azure.Pageable GetNetworkCloudStorageAppliances(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudStorageAppliancesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudTrunkedNetworks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudTrunkedNetworksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudVirtualMachines(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudVirtualMachinesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNetworkCloudVolumes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNetworkCloudVolumesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.NetworkCloud.Models { public partial class AdministrativeCredentials diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudArmClient.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudArmClient.cs new file mode 100644 index 0000000000000..ab5d8551fdb44 --- /dev/null +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudArmClient.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NetworkCloud; + +namespace Azure.ResourceManager.NetworkCloud.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNetworkCloudArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetworkCloudArmClient() + { + } + + /// 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 MockableNetworkCloudArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNetworkCloudArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudBareMetalMachineResource GetNetworkCloudBareMetalMachineResource(ResourceIdentifier id) + { + NetworkCloudBareMetalMachineResource.ValidateResourceId(id); + return new NetworkCloudBareMetalMachineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudCloudServicesNetworkResource GetNetworkCloudCloudServicesNetworkResource(ResourceIdentifier id) + { + NetworkCloudCloudServicesNetworkResource.ValidateResourceId(id); + return new NetworkCloudCloudServicesNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudClusterManagerResource GetNetworkCloudClusterManagerResource(ResourceIdentifier id) + { + NetworkCloudClusterManagerResource.ValidateResourceId(id); + return new NetworkCloudClusterManagerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudClusterResource GetNetworkCloudClusterResource(ResourceIdentifier id) + { + NetworkCloudClusterResource.ValidateResourceId(id); + return new NetworkCloudClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudKubernetesClusterResource GetNetworkCloudKubernetesClusterResource(ResourceIdentifier id) + { + NetworkCloudKubernetesClusterResource.ValidateResourceId(id); + return new NetworkCloudKubernetesClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudL2NetworkResource GetNetworkCloudL2NetworkResource(ResourceIdentifier id) + { + NetworkCloudL2NetworkResource.ValidateResourceId(id); + return new NetworkCloudL2NetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudL3NetworkResource GetNetworkCloudL3NetworkResource(ResourceIdentifier id) + { + NetworkCloudL3NetworkResource.ValidateResourceId(id); + return new NetworkCloudL3NetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudRackSkuResource GetNetworkCloudRackSkuResource(ResourceIdentifier id) + { + NetworkCloudRackSkuResource.ValidateResourceId(id); + return new NetworkCloudRackSkuResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudRackResource GetNetworkCloudRackResource(ResourceIdentifier id) + { + NetworkCloudRackResource.ValidateResourceId(id); + return new NetworkCloudRackResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudStorageApplianceResource GetNetworkCloudStorageApplianceResource(ResourceIdentifier id) + { + NetworkCloudStorageApplianceResource.ValidateResourceId(id); + return new NetworkCloudStorageApplianceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudTrunkedNetworkResource GetNetworkCloudTrunkedNetworkResource(ResourceIdentifier id) + { + NetworkCloudTrunkedNetworkResource.ValidateResourceId(id); + return new NetworkCloudTrunkedNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudVirtualMachineResource GetNetworkCloudVirtualMachineResource(ResourceIdentifier id) + { + NetworkCloudVirtualMachineResource.ValidateResourceId(id); + return new NetworkCloudVirtualMachineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudVolumeResource GetNetworkCloudVolumeResource(ResourceIdentifier id) + { + NetworkCloudVolumeResource.ValidateResourceId(id); + return new NetworkCloudVolumeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudBareMetalMachineKeySetResource GetNetworkCloudBareMetalMachineKeySetResource(ResourceIdentifier id) + { + NetworkCloudBareMetalMachineKeySetResource.ValidateResourceId(id); + return new NetworkCloudBareMetalMachineKeySetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudBmcKeySetResource GetNetworkCloudBmcKeySetResource(ResourceIdentifier id) + { + NetworkCloudBmcKeySetResource.ValidateResourceId(id); + return new NetworkCloudBmcKeySetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudClusterMetricsConfigurationResource GetNetworkCloudClusterMetricsConfigurationResource(ResourceIdentifier id) + { + NetworkCloudClusterMetricsConfigurationResource.ValidateResourceId(id); + return new NetworkCloudClusterMetricsConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudAgentPoolResource GetNetworkCloudAgentPoolResource(ResourceIdentifier id) + { + NetworkCloudAgentPoolResource.ValidateResourceId(id); + return new NetworkCloudAgentPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkCloudVirtualMachineConsoleResource GetNetworkCloudVirtualMachineConsoleResource(ResourceIdentifier id) + { + NetworkCloudVirtualMachineConsoleResource.ValidateResourceId(id); + return new NetworkCloudVirtualMachineConsoleResource(Client, id); + } + } +} diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudResourceGroupResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudResourceGroupResource.cs new file mode 100644 index 0000000000000..48d7f89b06993 --- /dev/null +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudResourceGroupResource.cs @@ -0,0 +1,675 @@ +// 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.NetworkCloud; + +namespace Azure.ResourceManager.NetworkCloud.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNetworkCloudResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetworkCloudResourceGroupResource() + { + } + + /// 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 MockableNetworkCloudResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NetworkCloudBareMetalMachineResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudBareMetalMachineResources and their operations over a NetworkCloudBareMetalMachineResource. + public virtual NetworkCloudBareMetalMachineCollection GetNetworkCloudBareMetalMachines() + { + return GetCachedClient(client => new NetworkCloudBareMetalMachineCollection(client, Id)); + } + + /// + /// Get properties of the provided bare metal machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName} + /// + /// + /// Operation Id + /// BareMetalMachines_Get + /// + /// + /// + /// The name of the bare metal machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudBareMetalMachineAsync(string bareMetalMachineName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudBareMetalMachines().GetAsync(bareMetalMachineName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided bare metal machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName} + /// + /// + /// Operation Id + /// BareMetalMachines_Get + /// + /// + /// + /// The name of the bare metal machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudBareMetalMachine(string bareMetalMachineName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudBareMetalMachines().Get(bareMetalMachineName, cancellationToken); + } + + /// Gets a collection of NetworkCloudCloudServicesNetworkResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudCloudServicesNetworkResources and their operations over a NetworkCloudCloudServicesNetworkResource. + public virtual NetworkCloudCloudServicesNetworkCollection GetNetworkCloudCloudServicesNetworks() + { + return GetCachedClient(client => new NetworkCloudCloudServicesNetworkCollection(client, Id)); + } + + /// + /// Get properties of the provided cloud services network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName} + /// + /// + /// Operation Id + /// CloudServicesNetworks_Get + /// + /// + /// + /// The name of the cloud services network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudCloudServicesNetworkAsync(string cloudServicesNetworkName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudCloudServicesNetworks().GetAsync(cloudServicesNetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided cloud services network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName} + /// + /// + /// Operation Id + /// CloudServicesNetworks_Get + /// + /// + /// + /// The name of the cloud services network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudCloudServicesNetwork(string cloudServicesNetworkName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudCloudServicesNetworks().Get(cloudServicesNetworkName, cancellationToken); + } + + /// Gets a collection of NetworkCloudClusterManagerResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudClusterManagerResources and their operations over a NetworkCloudClusterManagerResource. + public virtual NetworkCloudClusterManagerCollection GetNetworkCloudClusterManagers() + { + return GetCachedClient(client => new NetworkCloudClusterManagerCollection(client, Id)); + } + + /// + /// Get the properties of the provided cluster manager. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName} + /// + /// + /// Operation Id + /// ClusterManagers_Get + /// + /// + /// + /// The name of the cluster manager. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudClusterManagerAsync(string clusterManagerName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudClusterManagers().GetAsync(clusterManagerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of the provided cluster manager. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName} + /// + /// + /// Operation Id + /// ClusterManagers_Get + /// + /// + /// + /// The name of the cluster manager. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudClusterManager(string clusterManagerName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudClusterManagers().Get(clusterManagerName, cancellationToken); + } + + /// Gets a collection of NetworkCloudClusterResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudClusterResources and their operations over a NetworkCloudClusterResource. + public virtual NetworkCloudClusterCollection GetNetworkCloudClusters() + { + return GetCachedClient(client => new NetworkCloudClusterCollection(client, Id)); + } + + /// + /// Get properties of the provided cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudClusters().Get(clusterName, cancellationToken); + } + + /// Gets a collection of NetworkCloudKubernetesClusterResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudKubernetesClusterResources and their operations over a NetworkCloudKubernetesClusterResource. + public virtual NetworkCloudKubernetesClusterCollection GetNetworkCloudKubernetesClusters() + { + return GetCachedClient(client => new NetworkCloudKubernetesClusterCollection(client, Id)); + } + + /// + /// Get properties of the provided the Kubernetes cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName} + /// + /// + /// Operation Id + /// KubernetesClusters_Get + /// + /// + /// + /// The name of the Kubernetes cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudKubernetesClusterAsync(string kubernetesClusterName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudKubernetesClusters().GetAsync(kubernetesClusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided the Kubernetes cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName} + /// + /// + /// Operation Id + /// KubernetesClusters_Get + /// + /// + /// + /// The name of the Kubernetes cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudKubernetesCluster(string kubernetesClusterName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudKubernetesClusters().Get(kubernetesClusterName, cancellationToken); + } + + /// Gets a collection of NetworkCloudL2NetworkResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudL2NetworkResources and their operations over a NetworkCloudL2NetworkResource. + public virtual NetworkCloudL2NetworkCollection GetNetworkCloudL2Networks() + { + return GetCachedClient(client => new NetworkCloudL2NetworkCollection(client, Id)); + } + + /// + /// Get properties of the provided layer 2 (L2) network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName} + /// + /// + /// Operation Id + /// L2Networks_Get + /// + /// + /// + /// The name of the L2 network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudL2NetworkAsync(string l2NetworkName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudL2Networks().GetAsync(l2NetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided layer 2 (L2) network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName} + /// + /// + /// Operation Id + /// L2Networks_Get + /// + /// + /// + /// The name of the L2 network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudL2Network(string l2NetworkName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudL2Networks().Get(l2NetworkName, cancellationToken); + } + + /// Gets a collection of NetworkCloudL3NetworkResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudL3NetworkResources and their operations over a NetworkCloudL3NetworkResource. + public virtual NetworkCloudL3NetworkCollection GetNetworkCloudL3Networks() + { + return GetCachedClient(client => new NetworkCloudL3NetworkCollection(client, Id)); + } + + /// + /// Get properties of the provided layer 3 (L3) network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName} + /// + /// + /// Operation Id + /// L3Networks_Get + /// + /// + /// + /// The name of the L3 network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudL3NetworkAsync(string l3NetworkName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudL3Networks().GetAsync(l3NetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided layer 3 (L3) network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName} + /// + /// + /// Operation Id + /// L3Networks_Get + /// + /// + /// + /// The name of the L3 network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudL3Network(string l3NetworkName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudL3Networks().Get(l3NetworkName, cancellationToken); + } + + /// Gets a collection of NetworkCloudRackResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudRackResources and their operations over a NetworkCloudRackResource. + public virtual NetworkCloudRackCollection GetNetworkCloudRacks() + { + return GetCachedClient(client => new NetworkCloudRackCollection(client, Id)); + } + + /// + /// Get properties of the provided rack. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName} + /// + /// + /// Operation Id + /// Racks_Get + /// + /// + /// + /// The name of the rack. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudRackAsync(string rackName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudRacks().GetAsync(rackName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided rack. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName} + /// + /// + /// Operation Id + /// Racks_Get + /// + /// + /// + /// The name of the rack. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudRack(string rackName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudRacks().Get(rackName, cancellationToken); + } + + /// Gets a collection of NetworkCloudStorageApplianceResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudStorageApplianceResources and their operations over a NetworkCloudStorageApplianceResource. + public virtual NetworkCloudStorageApplianceCollection GetNetworkCloudStorageAppliances() + { + return GetCachedClient(client => new NetworkCloudStorageApplianceCollection(client, Id)); + } + + /// + /// Get properties of the provided storage appliance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName} + /// + /// + /// Operation Id + /// StorageAppliances_Get + /// + /// + /// + /// The name of the storage appliance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudStorageApplianceAsync(string storageApplianceName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudStorageAppliances().GetAsync(storageApplianceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided storage appliance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName} + /// + /// + /// Operation Id + /// StorageAppliances_Get + /// + /// + /// + /// The name of the storage appliance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudStorageAppliance(string storageApplianceName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudStorageAppliances().Get(storageApplianceName, cancellationToken); + } + + /// Gets a collection of NetworkCloudTrunkedNetworkResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudTrunkedNetworkResources and their operations over a NetworkCloudTrunkedNetworkResource. + public virtual NetworkCloudTrunkedNetworkCollection GetNetworkCloudTrunkedNetworks() + { + return GetCachedClient(client => new NetworkCloudTrunkedNetworkCollection(client, Id)); + } + + /// + /// Get properties of the provided trunked network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName} + /// + /// + /// Operation Id + /// TrunkedNetworks_Get + /// + /// + /// + /// The name of the trunked network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudTrunkedNetworkAsync(string trunkedNetworkName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudTrunkedNetworks().GetAsync(trunkedNetworkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided trunked network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName} + /// + /// + /// Operation Id + /// TrunkedNetworks_Get + /// + /// + /// + /// The name of the trunked network. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudTrunkedNetwork(string trunkedNetworkName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudTrunkedNetworks().Get(trunkedNetworkName, cancellationToken); + } + + /// Gets a collection of NetworkCloudVirtualMachineResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudVirtualMachineResources and their operations over a NetworkCloudVirtualMachineResource. + public virtual NetworkCloudVirtualMachineCollection GetNetworkCloudVirtualMachines() + { + return GetCachedClient(client => new NetworkCloudVirtualMachineCollection(client, Id)); + } + + /// + /// Get properties of the provided virtual machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudVirtualMachineAsync(string virtualMachineName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudVirtualMachines().GetAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided virtual machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName} + /// + /// + /// Operation Id + /// VirtualMachines_Get + /// + /// + /// + /// The name of the virtual machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudVirtualMachine(string virtualMachineName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudVirtualMachines().Get(virtualMachineName, cancellationToken); + } + + /// Gets a collection of NetworkCloudVolumeResources in the ResourceGroupResource. + /// An object representing collection of NetworkCloudVolumeResources and their operations over a NetworkCloudVolumeResource. + public virtual NetworkCloudVolumeCollection GetNetworkCloudVolumes() + { + return GetCachedClient(client => new NetworkCloudVolumeCollection(client, Id)); + } + + /// + /// Get properties of the provided volume. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName} + /// + /// + /// Operation Id + /// Volumes_Get + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudVolumeAsync(string volumeName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudVolumes().GetAsync(volumeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of the provided volume. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName} + /// + /// + /// Operation Id + /// Volumes_Get + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudVolume(string volumeName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudVolumes().Get(volumeName, cancellationToken); + } + } +} diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudSubscriptionResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudSubscriptionResource.cs new file mode 100644 index 0000000000000..261644e994132 --- /dev/null +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudSubscriptionResource.cs @@ -0,0 +1,672 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetworkCloud; + +namespace Azure.ResourceManager.NetworkCloud.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNetworkCloudSubscriptionResource : ArmResource + { + private ClientDiagnostics _networkCloudBareMetalMachineBareMetalMachinesClientDiagnostics; + private BareMetalMachinesRestOperations _networkCloudBareMetalMachineBareMetalMachinesRestClient; + private ClientDiagnostics _networkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics; + private CloudServicesNetworksRestOperations _networkCloudCloudServicesNetworkCloudServicesNetworksRestClient; + private ClientDiagnostics _networkCloudClusterManagerClusterManagersClientDiagnostics; + private ClusterManagersRestOperations _networkCloudClusterManagerClusterManagersRestClient; + private ClientDiagnostics _networkCloudClusterClustersClientDiagnostics; + private ClustersRestOperations _networkCloudClusterClustersRestClient; + private ClientDiagnostics _networkCloudKubernetesClusterKubernetesClustersClientDiagnostics; + private KubernetesClustersRestOperations _networkCloudKubernetesClusterKubernetesClustersRestClient; + private ClientDiagnostics _networkCloudL2NetworkL2NetworksClientDiagnostics; + private L2NetworksRestOperations _networkCloudL2NetworkL2NetworksRestClient; + private ClientDiagnostics _networkCloudL3NetworkL3NetworksClientDiagnostics; + private L3NetworksRestOperations _networkCloudL3NetworkL3NetworksRestClient; + private ClientDiagnostics _networkCloudRackRacksClientDiagnostics; + private RacksRestOperations _networkCloudRackRacksRestClient; + private ClientDiagnostics _networkCloudStorageApplianceStorageAppliancesClientDiagnostics; + private StorageAppliancesRestOperations _networkCloudStorageApplianceStorageAppliancesRestClient; + private ClientDiagnostics _networkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics; + private TrunkedNetworksRestOperations _networkCloudTrunkedNetworkTrunkedNetworksRestClient; + private ClientDiagnostics _networkCloudVirtualMachineVirtualMachinesClientDiagnostics; + private VirtualMachinesRestOperations _networkCloudVirtualMachineVirtualMachinesRestClient; + private ClientDiagnostics _networkCloudVolumeVolumesClientDiagnostics; + private VolumesRestOperations _networkCloudVolumeVolumesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNetworkCloudSubscriptionResource() + { + } + + /// 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 MockableNetworkCloudSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics NetworkCloudBareMetalMachineBareMetalMachinesClientDiagnostics => _networkCloudBareMetalMachineBareMetalMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudBareMetalMachineResource.ResourceType.Namespace, Diagnostics); + private BareMetalMachinesRestOperations NetworkCloudBareMetalMachineBareMetalMachinesRestClient => _networkCloudBareMetalMachineBareMetalMachinesRestClient ??= new BareMetalMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudBareMetalMachineResource.ResourceType)); + private ClientDiagnostics NetworkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics => _networkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudCloudServicesNetworkResource.ResourceType.Namespace, Diagnostics); + private CloudServicesNetworksRestOperations NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient => _networkCloudCloudServicesNetworkCloudServicesNetworksRestClient ??= new CloudServicesNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudCloudServicesNetworkResource.ResourceType)); + private ClientDiagnostics NetworkCloudClusterManagerClusterManagersClientDiagnostics => _networkCloudClusterManagerClusterManagersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudClusterManagerResource.ResourceType.Namespace, Diagnostics); + private ClusterManagersRestOperations NetworkCloudClusterManagerClusterManagersRestClient => _networkCloudClusterManagerClusterManagersRestClient ??= new ClusterManagersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudClusterManagerResource.ResourceType)); + private ClientDiagnostics NetworkCloudClusterClustersClientDiagnostics => _networkCloudClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations NetworkCloudClusterClustersRestClient => _networkCloudClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudClusterResource.ResourceType)); + private ClientDiagnostics NetworkCloudKubernetesClusterKubernetesClustersClientDiagnostics => _networkCloudKubernetesClusterKubernetesClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudKubernetesClusterResource.ResourceType.Namespace, Diagnostics); + private KubernetesClustersRestOperations NetworkCloudKubernetesClusterKubernetesClustersRestClient => _networkCloudKubernetesClusterKubernetesClustersRestClient ??= new KubernetesClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudKubernetesClusterResource.ResourceType)); + private ClientDiagnostics NetworkCloudL2NetworkL2NetworksClientDiagnostics => _networkCloudL2NetworkL2NetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudL2NetworkResource.ResourceType.Namespace, Diagnostics); + private L2NetworksRestOperations NetworkCloudL2NetworkL2NetworksRestClient => _networkCloudL2NetworkL2NetworksRestClient ??= new L2NetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudL2NetworkResource.ResourceType)); + private ClientDiagnostics NetworkCloudL3NetworkL3NetworksClientDiagnostics => _networkCloudL3NetworkL3NetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudL3NetworkResource.ResourceType.Namespace, Diagnostics); + private L3NetworksRestOperations NetworkCloudL3NetworkL3NetworksRestClient => _networkCloudL3NetworkL3NetworksRestClient ??= new L3NetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudL3NetworkResource.ResourceType)); + private ClientDiagnostics NetworkCloudRackRacksClientDiagnostics => _networkCloudRackRacksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudRackResource.ResourceType.Namespace, Diagnostics); + private RacksRestOperations NetworkCloudRackRacksRestClient => _networkCloudRackRacksRestClient ??= new RacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudRackResource.ResourceType)); + private ClientDiagnostics NetworkCloudStorageApplianceStorageAppliancesClientDiagnostics => _networkCloudStorageApplianceStorageAppliancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudStorageApplianceResource.ResourceType.Namespace, Diagnostics); + private StorageAppliancesRestOperations NetworkCloudStorageApplianceStorageAppliancesRestClient => _networkCloudStorageApplianceStorageAppliancesRestClient ??= new StorageAppliancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudStorageApplianceResource.ResourceType)); + private ClientDiagnostics NetworkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics => _networkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudTrunkedNetworkResource.ResourceType.Namespace, Diagnostics); + private TrunkedNetworksRestOperations NetworkCloudTrunkedNetworkTrunkedNetworksRestClient => _networkCloudTrunkedNetworkTrunkedNetworksRestClient ??= new TrunkedNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudTrunkedNetworkResource.ResourceType)); + private ClientDiagnostics NetworkCloudVirtualMachineVirtualMachinesClientDiagnostics => _networkCloudVirtualMachineVirtualMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudVirtualMachineResource.ResourceType.Namespace, Diagnostics); + private VirtualMachinesRestOperations NetworkCloudVirtualMachineVirtualMachinesRestClient => _networkCloudVirtualMachineVirtualMachinesRestClient ??= new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudVirtualMachineResource.ResourceType)); + private ClientDiagnostics NetworkCloudVolumeVolumesClientDiagnostics => _networkCloudVolumeVolumesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudVolumeResource.ResourceType.Namespace, Diagnostics); + private VolumesRestOperations NetworkCloudVolumeVolumesRestClient => _networkCloudVolumeVolumesRestClient ??= new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudVolumeResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NetworkCloudRackSkuResources in the SubscriptionResource. + /// An object representing collection of NetworkCloudRackSkuResources and their operations over a NetworkCloudRackSkuResource. + public virtual NetworkCloudRackSkuCollection GetNetworkCloudRackSkus() + { + return GetCachedClient(client => new NetworkCloudRackSkuCollection(client, Id)); + } + + /// + /// Get the properties of the provided rack SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus/{rackSkuName} + /// + /// + /// Operation Id + /// RackSkus_Get + /// + /// + /// + /// The name of the rack SKU. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkCloudRackSkuAsync(string rackSkuName, CancellationToken cancellationToken = default) + { + return await GetNetworkCloudRackSkus().GetAsync(rackSkuName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of the provided rack SKU. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus/{rackSkuName} + /// + /// + /// Operation Id + /// RackSkus_Get + /// + /// + /// + /// The name of the rack SKU. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkCloudRackSku(string rackSkuName, CancellationToken cancellationToken = default) + { + return GetNetworkCloudRackSkus().Get(rackSkuName, cancellationToken); + } + + /// + /// Get a list of bare metal machines in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines + /// + /// + /// Operation Id + /// BareMetalMachines_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudBareMetalMachinesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudBareMetalMachineBareMetalMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudBareMetalMachineBareMetalMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudBareMetalMachineResource(Client, NetworkCloudBareMetalMachineData.DeserializeNetworkCloudBareMetalMachineData(e)), NetworkCloudBareMetalMachineBareMetalMachinesClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudBareMetalMachines", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of bare metal machines in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines + /// + /// + /// Operation Id + /// BareMetalMachines_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudBareMetalMachines(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudBareMetalMachineBareMetalMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudBareMetalMachineBareMetalMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudBareMetalMachineResource(Client, NetworkCloudBareMetalMachineData.DeserializeNetworkCloudBareMetalMachineData(e)), NetworkCloudBareMetalMachineBareMetalMachinesClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudBareMetalMachines", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of cloud services networks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks + /// + /// + /// Operation Id + /// CloudServicesNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudCloudServicesNetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudCloudServicesNetworkResource(Client, NetworkCloudCloudServicesNetworkData.DeserializeNetworkCloudCloudServicesNetworkData(e)), NetworkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudCloudServicesNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of cloud services networks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks + /// + /// + /// Operation Id + /// CloudServicesNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudCloudServicesNetworks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudCloudServicesNetworkResource(Client, NetworkCloudCloudServicesNetworkData.DeserializeNetworkCloudCloudServicesNetworkData(e)), NetworkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudCloudServicesNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of cluster managers in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers + /// + /// + /// Operation Id + /// ClusterManagers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudClusterManagersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudClusterManagerClusterManagersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudClusterManagerClusterManagersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudClusterManagerResource(Client, NetworkCloudClusterManagerData.DeserializeNetworkCloudClusterManagerData(e)), NetworkCloudClusterManagerClusterManagersClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudClusterManagers", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of cluster managers in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers + /// + /// + /// Operation Id + /// ClusterManagers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudClusterManagers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudClusterManagerClusterManagersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudClusterManagerClusterManagersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudClusterManagerResource(Client, NetworkCloudClusterManagerData.DeserializeNetworkCloudClusterManagerData(e)), NetworkCloudClusterManagerClusterManagersClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudClusterManagers", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of clusters in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters + /// + /// + /// Operation Id + /// Clusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudClusterResource(Client, NetworkCloudClusterData.DeserializeNetworkCloudClusterData(e)), NetworkCloudClusterClustersClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of clusters in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters + /// + /// + /// Operation Id + /// Clusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudClusterResource(Client, NetworkCloudClusterData.DeserializeNetworkCloudClusterData(e)), NetworkCloudClusterClustersClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of Kubernetes clusters in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/kubernetesClusters + /// + /// + /// Operation Id + /// KubernetesClusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudKubernetesClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudKubernetesClusterKubernetesClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudKubernetesClusterKubernetesClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudKubernetesClusterResource(Client, NetworkCloudKubernetesClusterData.DeserializeNetworkCloudKubernetesClusterData(e)), NetworkCloudKubernetesClusterKubernetesClustersClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudKubernetesClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of Kubernetes clusters in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/kubernetesClusters + /// + /// + /// Operation Id + /// KubernetesClusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudKubernetesClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudKubernetesClusterKubernetesClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudKubernetesClusterKubernetesClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudKubernetesClusterResource(Client, NetworkCloudKubernetesClusterData.DeserializeNetworkCloudKubernetesClusterData(e)), NetworkCloudKubernetesClusterKubernetesClustersClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudKubernetesClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of layer 2 (L2) networks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks + /// + /// + /// Operation Id + /// L2Networks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudL2NetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudL2NetworkL2NetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudL2NetworkL2NetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudL2NetworkResource(Client, NetworkCloudL2NetworkData.DeserializeNetworkCloudL2NetworkData(e)), NetworkCloudL2NetworkL2NetworksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudL2Networks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of layer 2 (L2) networks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks + /// + /// + /// Operation Id + /// L2Networks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudL2Networks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudL2NetworkL2NetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudL2NetworkL2NetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudL2NetworkResource(Client, NetworkCloudL2NetworkData.DeserializeNetworkCloudL2NetworkData(e)), NetworkCloudL2NetworkL2NetworksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudL2Networks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of layer 3 (L3) networks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks + /// + /// + /// Operation Id + /// L3Networks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudL3NetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudL3NetworkL3NetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudL3NetworkL3NetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudL3NetworkResource(Client, NetworkCloudL3NetworkData.DeserializeNetworkCloudL3NetworkData(e)), NetworkCloudL3NetworkL3NetworksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudL3Networks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of layer 3 (L3) networks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks + /// + /// + /// Operation Id + /// L3Networks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudL3Networks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudL3NetworkL3NetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudL3NetworkL3NetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudL3NetworkResource(Client, NetworkCloudL3NetworkData.DeserializeNetworkCloudL3NetworkData(e)), NetworkCloudL3NetworkL3NetworksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudL3Networks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of racks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks + /// + /// + /// Operation Id + /// Racks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudRacksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudRackRacksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudRackRacksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudRackResource(Client, NetworkCloudRackData.DeserializeNetworkCloudRackData(e)), NetworkCloudRackRacksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudRacks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of racks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks + /// + /// + /// Operation Id + /// Racks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudRacks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudRackRacksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudRackRacksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudRackResource(Client, NetworkCloudRackData.DeserializeNetworkCloudRackData(e)), NetworkCloudRackRacksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudRacks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of storage appliances in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances + /// + /// + /// Operation Id + /// StorageAppliances_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudStorageAppliancesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudStorageApplianceStorageAppliancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudStorageApplianceStorageAppliancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudStorageApplianceResource(Client, NetworkCloudStorageApplianceData.DeserializeNetworkCloudStorageApplianceData(e)), NetworkCloudStorageApplianceStorageAppliancesClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudStorageAppliances", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of storage appliances in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances + /// + /// + /// Operation Id + /// StorageAppliances_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudStorageAppliances(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudStorageApplianceStorageAppliancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudStorageApplianceStorageAppliancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudStorageApplianceResource(Client, NetworkCloudStorageApplianceData.DeserializeNetworkCloudStorageApplianceData(e)), NetworkCloudStorageApplianceStorageAppliancesClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudStorageAppliances", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of trunked networks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks + /// + /// + /// Operation Id + /// TrunkedNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudTrunkedNetworksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudTrunkedNetworkTrunkedNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudTrunkedNetworkTrunkedNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudTrunkedNetworkResource(Client, NetworkCloudTrunkedNetworkData.DeserializeNetworkCloudTrunkedNetworkData(e)), NetworkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudTrunkedNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of trunked networks in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks + /// + /// + /// Operation Id + /// TrunkedNetworks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudTrunkedNetworks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudTrunkedNetworkTrunkedNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudTrunkedNetworkTrunkedNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudTrunkedNetworkResource(Client, NetworkCloudTrunkedNetworkData.DeserializeNetworkCloudTrunkedNetworkData(e)), NetworkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudTrunkedNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of virtual machines in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudVirtualMachinesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudVirtualMachineResource(Client, NetworkCloudVirtualMachineData.DeserializeNetworkCloudVirtualMachineData(e)), NetworkCloudVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudVirtualMachines", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of virtual machines in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines + /// + /// + /// Operation Id + /// VirtualMachines_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudVirtualMachines(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudVirtualMachineResource(Client, NetworkCloudVirtualMachineData.DeserializeNetworkCloudVirtualMachineData(e)), NetworkCloudVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudVirtualMachines", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of volumes in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes + /// + /// + /// Operation Id + /// Volumes_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetworkCloudVolumesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudVolumeVolumesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudVolumeVolumesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudVolumeResource(Client, NetworkCloudVolumeData.DeserializeNetworkCloudVolumeData(e)), NetworkCloudVolumeVolumesClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudVolumes", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of volumes in the provided subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes + /// + /// + /// Operation Id + /// Volumes_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetworkCloudVolumes(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudVolumeVolumesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudVolumeVolumesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudVolumeResource(Client, NetworkCloudVolumeData.DeserializeNetworkCloudVolumeData(e)), NetworkCloudVolumeVolumesClientDiagnostics, Pipeline, "MockableNetworkCloudSubscriptionResource.GetNetworkCloudVolumes", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/NetworkCloudExtensions.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/NetworkCloudExtensions.cs index 8d626c63a823f..b7b61b0e49151 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/NetworkCloudExtensions.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/NetworkCloudExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.NetworkCloud.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetworkCloud @@ -18,385 +19,321 @@ namespace Azure.ResourceManager.NetworkCloud /// A class to add extension methods to Azure.ResourceManager.NetworkCloud. public static partial class NetworkCloudExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableNetworkCloudArmClient GetMockableNetworkCloudArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableNetworkCloudArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNetworkCloudResourceGroupResource GetMockableNetworkCloudResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNetworkCloudResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableNetworkCloudSubscriptionResource GetMockableNetworkCloudSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableNetworkCloudSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region NetworkCloudBareMetalMachineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudBareMetalMachineResource GetNetworkCloudBareMetalMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudBareMetalMachineResource.ValidateResourceId(id); - return new NetworkCloudBareMetalMachineResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudBareMetalMachineResource(id); } - #endregion - #region NetworkCloudCloudServicesNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudCloudServicesNetworkResource GetNetworkCloudCloudServicesNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudCloudServicesNetworkResource.ValidateResourceId(id); - return new NetworkCloudCloudServicesNetworkResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudCloudServicesNetworkResource(id); } - #endregion - #region NetworkCloudClusterManagerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudClusterManagerResource GetNetworkCloudClusterManagerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudClusterManagerResource.ValidateResourceId(id); - return new NetworkCloudClusterManagerResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudClusterManagerResource(id); } - #endregion - #region NetworkCloudClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudClusterResource GetNetworkCloudClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudClusterResource.ValidateResourceId(id); - return new NetworkCloudClusterResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudClusterResource(id); } - #endregion - #region NetworkCloudKubernetesClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudKubernetesClusterResource GetNetworkCloudKubernetesClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudKubernetesClusterResource.ValidateResourceId(id); - return new NetworkCloudKubernetesClusterResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudKubernetesClusterResource(id); } - #endregion - #region NetworkCloudL2NetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudL2NetworkResource GetNetworkCloudL2NetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudL2NetworkResource.ValidateResourceId(id); - return new NetworkCloudL2NetworkResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudL2NetworkResource(id); } - #endregion - #region NetworkCloudL3NetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudL3NetworkResource GetNetworkCloudL3NetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudL3NetworkResource.ValidateResourceId(id); - return new NetworkCloudL3NetworkResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudL3NetworkResource(id); } - #endregion - #region NetworkCloudRackSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudRackSkuResource GetNetworkCloudRackSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudRackSkuResource.ValidateResourceId(id); - return new NetworkCloudRackSkuResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudRackSkuResource(id); } - #endregion - #region NetworkCloudRackResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudRackResource GetNetworkCloudRackResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudRackResource.ValidateResourceId(id); - return new NetworkCloudRackResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudRackResource(id); } - #endregion - #region NetworkCloudStorageApplianceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudStorageApplianceResource GetNetworkCloudStorageApplianceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudStorageApplianceResource.ValidateResourceId(id); - return new NetworkCloudStorageApplianceResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudStorageApplianceResource(id); } - #endregion - #region NetworkCloudTrunkedNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudTrunkedNetworkResource GetNetworkCloudTrunkedNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudTrunkedNetworkResource.ValidateResourceId(id); - return new NetworkCloudTrunkedNetworkResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudTrunkedNetworkResource(id); } - #endregion - #region NetworkCloudVirtualMachineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudVirtualMachineResource GetNetworkCloudVirtualMachineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudVirtualMachineResource.ValidateResourceId(id); - return new NetworkCloudVirtualMachineResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudVirtualMachineResource(id); } - #endregion - #region NetworkCloudVolumeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudVolumeResource GetNetworkCloudVolumeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudVolumeResource.ValidateResourceId(id); - return new NetworkCloudVolumeResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudVolumeResource(id); } - #endregion - #region NetworkCloudBareMetalMachineKeySetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudBareMetalMachineKeySetResource GetNetworkCloudBareMetalMachineKeySetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudBareMetalMachineKeySetResource.ValidateResourceId(id); - return new NetworkCloudBareMetalMachineKeySetResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudBareMetalMachineKeySetResource(id); } - #endregion - #region NetworkCloudBmcKeySetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudBmcKeySetResource GetNetworkCloudBmcKeySetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudBmcKeySetResource.ValidateResourceId(id); - return new NetworkCloudBmcKeySetResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudBmcKeySetResource(id); } - #endregion - #region NetworkCloudClusterMetricsConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudClusterMetricsConfigurationResource GetNetworkCloudClusterMetricsConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudClusterMetricsConfigurationResource.ValidateResourceId(id); - return new NetworkCloudClusterMetricsConfigurationResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudClusterMetricsConfigurationResource(id); } - #endregion - #region NetworkCloudAgentPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudAgentPoolResource GetNetworkCloudAgentPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudAgentPoolResource.ValidateResourceId(id); - return new NetworkCloudAgentPoolResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudAgentPoolResource(id); } - #endregion - #region NetworkCloudVirtualMachineConsoleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkCloudVirtualMachineConsoleResource GetNetworkCloudVirtualMachineConsoleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkCloudVirtualMachineConsoleResource.ValidateResourceId(id); - return new NetworkCloudVirtualMachineConsoleResource(client, id); - } - ); + return GetMockableNetworkCloudArmClient(client).GetNetworkCloudVirtualMachineConsoleResource(id); } - #endregion - /// Gets a collection of NetworkCloudBareMetalMachineResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudBareMetalMachineResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudBareMetalMachineResources and their operations over a NetworkCloudBareMetalMachineResource. public static NetworkCloudBareMetalMachineCollection GetNetworkCloudBareMetalMachines(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudBareMetalMachines(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudBareMetalMachines(); } /// @@ -411,16 +348,20 @@ public static NetworkCloudBareMetalMachineCollection GetNetworkCloudBareMetalMac /// BareMetalMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the bare metal machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudBareMetalMachineAsync(this ResourceGroupResource resourceGroupResource, string bareMetalMachineName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudBareMetalMachines().GetAsync(bareMetalMachineName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudBareMetalMachineAsync(bareMetalMachineName, cancellationToken).ConfigureAwait(false); } /// @@ -435,24 +376,34 @@ public static async Task> GetNetw /// BareMetalMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the bare metal machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudBareMetalMachine(this ResourceGroupResource resourceGroupResource, string bareMetalMachineName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudBareMetalMachines().Get(bareMetalMachineName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudBareMetalMachine(bareMetalMachineName, cancellationToken); } - /// Gets a collection of NetworkCloudCloudServicesNetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudCloudServicesNetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudCloudServicesNetworkResources and their operations over a NetworkCloudCloudServicesNetworkResource. public static NetworkCloudCloudServicesNetworkCollection GetNetworkCloudCloudServicesNetworks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudCloudServicesNetworks(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudCloudServicesNetworks(); } /// @@ -467,16 +418,20 @@ public static NetworkCloudCloudServicesNetworkCollection GetNetworkCloudCloudSer /// CloudServicesNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cloud services network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudCloudServicesNetworkAsync(this ResourceGroupResource resourceGroupResource, string cloudServicesNetworkName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudCloudServicesNetworks().GetAsync(cloudServicesNetworkName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudCloudServicesNetworkAsync(cloudServicesNetworkName, cancellationToken).ConfigureAwait(false); } /// @@ -491,24 +446,34 @@ public static async Task> Get /// CloudServicesNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cloud services network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudCloudServicesNetwork(this ResourceGroupResource resourceGroupResource, string cloudServicesNetworkName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudCloudServicesNetworks().Get(cloudServicesNetworkName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudCloudServicesNetwork(cloudServicesNetworkName, cancellationToken); } - /// Gets a collection of NetworkCloudClusterManagerResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudClusterManagerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudClusterManagerResources and their operations over a NetworkCloudClusterManagerResource. public static NetworkCloudClusterManagerCollection GetNetworkCloudClusterManagers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudClusterManagers(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudClusterManagers(); } /// @@ -523,16 +488,20 @@ public static NetworkCloudClusterManagerCollection GetNetworkCloudClusterManager /// ClusterManagers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster manager. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudClusterManagerAsync(this ResourceGroupResource resourceGroupResource, string clusterManagerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudClusterManagers().GetAsync(clusterManagerName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudClusterManagerAsync(clusterManagerName, cancellationToken).ConfigureAwait(false); } /// @@ -547,24 +516,34 @@ public static async Task> GetNetwor /// ClusterManagers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster manager. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudClusterManager(this ResourceGroupResource resourceGroupResource, string clusterManagerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudClusterManagers().Get(clusterManagerName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudClusterManager(clusterManagerName, cancellationToken); } - /// Gets a collection of NetworkCloudClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudClusterResources and their operations over a NetworkCloudClusterResource. public static NetworkCloudClusterCollection GetNetworkCloudClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudClusters(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudClusters(); } /// @@ -579,16 +558,20 @@ public static NetworkCloudClusterCollection GetNetworkCloudClusters(this Resourc /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -603,24 +586,34 @@ public static async Task> GetNetworkCloudC /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudClusters().Get(clusterName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudCluster(clusterName, cancellationToken); } - /// Gets a collection of NetworkCloudKubernetesClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudKubernetesClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudKubernetesClusterResources and their operations over a NetworkCloudKubernetesClusterResource. public static NetworkCloudKubernetesClusterCollection GetNetworkCloudKubernetesClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudKubernetesClusters(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudKubernetesClusters(); } /// @@ -635,16 +628,20 @@ public static NetworkCloudKubernetesClusterCollection GetNetworkCloudKubernetesC /// KubernetesClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Kubernetes cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudKubernetesClusterAsync(this ResourceGroupResource resourceGroupResource, string kubernetesClusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudKubernetesClusters().GetAsync(kubernetesClusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudKubernetesClusterAsync(kubernetesClusterName, cancellationToken).ConfigureAwait(false); } /// @@ -659,24 +656,34 @@ public static async Task> GetNet /// KubernetesClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Kubernetes cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudKubernetesCluster(this ResourceGroupResource resourceGroupResource, string kubernetesClusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudKubernetesClusters().Get(kubernetesClusterName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudKubernetesCluster(kubernetesClusterName, cancellationToken); } - /// Gets a collection of NetworkCloudL2NetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudL2NetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudL2NetworkResources and their operations over a NetworkCloudL2NetworkResource. public static NetworkCloudL2NetworkCollection GetNetworkCloudL2Networks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudL2Networks(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudL2Networks(); } /// @@ -691,16 +698,20 @@ public static NetworkCloudL2NetworkCollection GetNetworkCloudL2Networks(this Res /// L2Networks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the L2 network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudL2NetworkAsync(this ResourceGroupResource resourceGroupResource, string l2NetworkName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudL2Networks().GetAsync(l2NetworkName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudL2NetworkAsync(l2NetworkName, cancellationToken).ConfigureAwait(false); } /// @@ -715,24 +726,34 @@ public static async Task> GetNetworkClou /// L2Networks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the L2 network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudL2Network(this ResourceGroupResource resourceGroupResource, string l2NetworkName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudL2Networks().Get(l2NetworkName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudL2Network(l2NetworkName, cancellationToken); } - /// Gets a collection of NetworkCloudL3NetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudL3NetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudL3NetworkResources and their operations over a NetworkCloudL3NetworkResource. public static NetworkCloudL3NetworkCollection GetNetworkCloudL3Networks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudL3Networks(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudL3Networks(); } /// @@ -747,16 +768,20 @@ public static NetworkCloudL3NetworkCollection GetNetworkCloudL3Networks(this Res /// L3Networks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the L3 network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudL3NetworkAsync(this ResourceGroupResource resourceGroupResource, string l3NetworkName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudL3Networks().GetAsync(l3NetworkName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudL3NetworkAsync(l3NetworkName, cancellationToken).ConfigureAwait(false); } /// @@ -771,24 +796,34 @@ public static async Task> GetNetworkClou /// L3Networks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the L3 network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudL3Network(this ResourceGroupResource resourceGroupResource, string l3NetworkName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudL3Networks().Get(l3NetworkName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudL3Network(l3NetworkName, cancellationToken); } - /// Gets a collection of NetworkCloudRackResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudRackResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudRackResources and their operations over a NetworkCloudRackResource. public static NetworkCloudRackCollection GetNetworkCloudRacks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudRacks(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudRacks(); } /// @@ -803,16 +838,20 @@ public static NetworkCloudRackCollection GetNetworkCloudRacks(this ResourceGroup /// Racks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rack. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudRackAsync(this ResourceGroupResource resourceGroupResource, string rackName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudRacks().GetAsync(rackName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudRackAsync(rackName, cancellationToken).ConfigureAwait(false); } /// @@ -827,24 +866,34 @@ public static async Task> GetNetworkCloudRack /// Racks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rack. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudRack(this ResourceGroupResource resourceGroupResource, string rackName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudRacks().Get(rackName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudRack(rackName, cancellationToken); } - /// Gets a collection of NetworkCloudStorageApplianceResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudStorageApplianceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudStorageApplianceResources and their operations over a NetworkCloudStorageApplianceResource. public static NetworkCloudStorageApplianceCollection GetNetworkCloudStorageAppliances(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudStorageAppliances(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudStorageAppliances(); } /// @@ -859,16 +908,20 @@ public static NetworkCloudStorageApplianceCollection GetNetworkCloudStorageAppli /// StorageAppliances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the storage appliance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudStorageApplianceAsync(this ResourceGroupResource resourceGroupResource, string storageApplianceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudStorageAppliances().GetAsync(storageApplianceName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudStorageApplianceAsync(storageApplianceName, cancellationToken).ConfigureAwait(false); } /// @@ -883,24 +936,34 @@ public static async Task> GetNetw /// StorageAppliances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the storage appliance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudStorageAppliance(this ResourceGroupResource resourceGroupResource, string storageApplianceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudStorageAppliances().Get(storageApplianceName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudStorageAppliance(storageApplianceName, cancellationToken); } - /// Gets a collection of NetworkCloudTrunkedNetworkResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudTrunkedNetworkResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudTrunkedNetworkResources and their operations over a NetworkCloudTrunkedNetworkResource. public static NetworkCloudTrunkedNetworkCollection GetNetworkCloudTrunkedNetworks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudTrunkedNetworks(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudTrunkedNetworks(); } /// @@ -915,16 +978,20 @@ public static NetworkCloudTrunkedNetworkCollection GetNetworkCloudTrunkedNetwork /// TrunkedNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the trunked network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudTrunkedNetworkAsync(this ResourceGroupResource resourceGroupResource, string trunkedNetworkName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudTrunkedNetworks().GetAsync(trunkedNetworkName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudTrunkedNetworkAsync(trunkedNetworkName, cancellationToken).ConfigureAwait(false); } /// @@ -939,24 +1006,34 @@ public static async Task> GetNetwor /// TrunkedNetworks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the trunked network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudTrunkedNetwork(this ResourceGroupResource resourceGroupResource, string trunkedNetworkName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudTrunkedNetworks().Get(trunkedNetworkName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudTrunkedNetwork(trunkedNetworkName, cancellationToken); } - /// Gets a collection of NetworkCloudVirtualMachineResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudVirtualMachineResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudVirtualMachineResources and their operations over a NetworkCloudVirtualMachineResource. public static NetworkCloudVirtualMachineCollection GetNetworkCloudVirtualMachines(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudVirtualMachines(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudVirtualMachines(); } /// @@ -971,16 +1048,20 @@ public static NetworkCloudVirtualMachineCollection GetNetworkCloudVirtualMachine /// VirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudVirtualMachineAsync(this ResourceGroupResource resourceGroupResource, string virtualMachineName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudVirtualMachines().GetAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudVirtualMachineAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); } /// @@ -995,24 +1076,34 @@ public static async Task> GetNetwor /// VirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudVirtualMachine(this ResourceGroupResource resourceGroupResource, string virtualMachineName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudVirtualMachines().Get(virtualMachineName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudVirtualMachine(virtualMachineName, cancellationToken); } - /// Gets a collection of NetworkCloudVolumeResources in the ResourceGroupResource. + /// + /// Gets a collection of NetworkCloudVolumeResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudVolumeResources and their operations over a NetworkCloudVolumeResource. public static NetworkCloudVolumeCollection GetNetworkCloudVolumes(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNetworkCloudVolumes(); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudVolumes(); } /// @@ -1027,16 +1118,20 @@ public static NetworkCloudVolumeCollection GetNetworkCloudVolumes(this ResourceG /// Volumes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the volume. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudVolumeAsync(this ResourceGroupResource resourceGroupResource, string volumeName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNetworkCloudVolumes().GetAsync(volumeName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudVolumeAsync(volumeName, cancellationToken).ConfigureAwait(false); } /// @@ -1051,24 +1146,34 @@ public static async Task> GetNetworkCloudVo /// Volumes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the volume. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudVolume(this ResourceGroupResource resourceGroupResource, string volumeName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNetworkCloudVolumes().Get(volumeName, cancellationToken); + return GetMockableNetworkCloudResourceGroupResource(resourceGroupResource).GetNetworkCloudVolume(volumeName, cancellationToken); } - /// Gets a collection of NetworkCloudRackSkuResources in the SubscriptionResource. + /// + /// Gets a collection of NetworkCloudRackSkuResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NetworkCloudRackSkuResources and their operations over a NetworkCloudRackSkuResource. public static NetworkCloudRackSkuCollection GetNetworkCloudRackSkus(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudRackSkus(); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudRackSkus(); } /// @@ -1083,16 +1188,20 @@ public static NetworkCloudRackSkuCollection GetNetworkCloudRackSkus(this Subscri /// RackSkus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rack SKU. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNetworkCloudRackSkuAsync(this SubscriptionResource subscriptionResource, string rackSkuName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetNetworkCloudRackSkus().GetAsync(rackSkuName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudRackSkuAsync(rackSkuName, cancellationToken).ConfigureAwait(false); } /// @@ -1107,16 +1216,20 @@ public static async Task> GetNetworkCloudR /// RackSkus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the rack SKU. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNetworkCloudRackSku(this SubscriptionResource subscriptionResource, string rackSkuName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetNetworkCloudRackSkus().Get(rackSkuName, cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudRackSku(rackSkuName, cancellationToken); } /// @@ -1131,13 +1244,17 @@ public static Response GetNetworkCloudRackSku(this /// BareMetalMachines_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudBareMetalMachinesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudBareMetalMachinesAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudBareMetalMachinesAsync(cancellationToken); } /// @@ -1152,13 +1269,17 @@ public static AsyncPageable GetNetworkClou /// BareMetalMachines_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudBareMetalMachines(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudBareMetalMachines(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudBareMetalMachines(cancellationToken); } /// @@ -1173,13 +1294,17 @@ public static Pageable GetNetworkCloudBare /// CloudServicesNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudCloudServicesNetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudCloudServicesNetworksAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudCloudServicesNetworksAsync(cancellationToken); } /// @@ -1194,13 +1319,17 @@ public static AsyncPageable GetNetwork /// CloudServicesNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudCloudServicesNetworks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudCloudServicesNetworks(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudCloudServicesNetworks(cancellationToken); } /// @@ -1215,13 +1344,17 @@ public static Pageable GetNetworkCloud /// ClusterManagers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudClusterManagersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudClusterManagersAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudClusterManagersAsync(cancellationToken); } /// @@ -1236,13 +1369,17 @@ public static AsyncPageable GetNetworkCloudC /// ClusterManagers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudClusterManagers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudClusterManagers(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudClusterManagers(cancellationToken); } /// @@ -1257,13 +1394,17 @@ public static Pageable GetNetworkCloudCluste /// Clusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudClustersAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudClustersAsync(cancellationToken); } /// @@ -1278,13 +1419,17 @@ public static AsyncPageable GetNetworkCloudClusters /// Clusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudClusters(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudClusters(cancellationToken); } /// @@ -1299,13 +1444,17 @@ public static Pageable GetNetworkCloudClusters(this /// KubernetesClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudKubernetesClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudKubernetesClustersAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudKubernetesClustersAsync(cancellationToken); } /// @@ -1320,13 +1469,17 @@ public static AsyncPageable GetNetworkClo /// KubernetesClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudKubernetesClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudKubernetesClusters(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudKubernetesClusters(cancellationToken); } /// @@ -1341,13 +1494,17 @@ public static Pageable GetNetworkCloudKub /// L2Networks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudL2NetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudL2NetworksAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudL2NetworksAsync(cancellationToken); } /// @@ -1362,13 +1519,17 @@ public static AsyncPageable GetNetworkCloudL2Netw /// L2Networks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudL2Networks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudL2Networks(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudL2Networks(cancellationToken); } /// @@ -1383,13 +1544,17 @@ public static Pageable GetNetworkCloudL2Networks( /// L3Networks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudL3NetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudL3NetworksAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudL3NetworksAsync(cancellationToken); } /// @@ -1404,13 +1569,17 @@ public static AsyncPageable GetNetworkCloudL3Netw /// L3Networks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudL3Networks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudL3Networks(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudL3Networks(cancellationToken); } /// @@ -1425,13 +1594,17 @@ public static Pageable GetNetworkCloudL3Networks( /// Racks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudRacksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudRacksAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudRacksAsync(cancellationToken); } /// @@ -1446,13 +1619,17 @@ public static AsyncPageable GetNetworkCloudRacksAsync( /// Racks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudRacks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudRacks(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudRacks(cancellationToken); } /// @@ -1467,13 +1644,17 @@ public static Pageable GetNetworkCloudRacks(this Subsc /// StorageAppliances_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudStorageAppliancesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudStorageAppliancesAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudStorageAppliancesAsync(cancellationToken); } /// @@ -1488,13 +1669,17 @@ public static AsyncPageable GetNetworkClou /// StorageAppliances_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudStorageAppliances(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudStorageAppliances(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudStorageAppliances(cancellationToken); } /// @@ -1509,13 +1694,17 @@ public static Pageable GetNetworkCloudStor /// TrunkedNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudTrunkedNetworksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudTrunkedNetworksAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudTrunkedNetworksAsync(cancellationToken); } /// @@ -1530,13 +1719,17 @@ public static AsyncPageable GetNetworkCloudT /// TrunkedNetworks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudTrunkedNetworks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudTrunkedNetworks(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudTrunkedNetworks(cancellationToken); } /// @@ -1551,13 +1744,17 @@ public static Pageable GetNetworkCloudTrunke /// VirtualMachines_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudVirtualMachinesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudVirtualMachinesAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudVirtualMachinesAsync(cancellationToken); } /// @@ -1572,13 +1769,17 @@ public static AsyncPageable GetNetworkCloudV /// VirtualMachines_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudVirtualMachines(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudVirtualMachines(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudVirtualMachines(cancellationToken); } /// @@ -1593,13 +1794,17 @@ public static Pageable GetNetworkCloudVirtua /// Volumes_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudVolumesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudVolumesAsync(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudVolumesAsync(cancellationToken); } /// @@ -1614,13 +1819,17 @@ public static AsyncPageable GetNetworkCloudVolumesAs /// Volumes_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNetworkCloudVolumes(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNetworkCloudVolumes(cancellationToken); + return GetMockableNetworkCloudSubscriptionResource(subscriptionResource).GetNetworkCloudVolumes(cancellationToken); } } } diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 99171835b9cb8..0000000000000 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NetworkCloud -{ - /// 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 NetworkCloudBareMetalMachineResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudBareMetalMachineResources and their operations over a NetworkCloudBareMetalMachineResource. - public virtual NetworkCloudBareMetalMachineCollection GetNetworkCloudBareMetalMachines() - { - return GetCachedClient(Client => new NetworkCloudBareMetalMachineCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudCloudServicesNetworkResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudCloudServicesNetworkResources and their operations over a NetworkCloudCloudServicesNetworkResource. - public virtual NetworkCloudCloudServicesNetworkCollection GetNetworkCloudCloudServicesNetworks() - { - return GetCachedClient(Client => new NetworkCloudCloudServicesNetworkCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudClusterManagerResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudClusterManagerResources and their operations over a NetworkCloudClusterManagerResource. - public virtual NetworkCloudClusterManagerCollection GetNetworkCloudClusterManagers() - { - return GetCachedClient(Client => new NetworkCloudClusterManagerCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudClusterResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudClusterResources and their operations over a NetworkCloudClusterResource. - public virtual NetworkCloudClusterCollection GetNetworkCloudClusters() - { - return GetCachedClient(Client => new NetworkCloudClusterCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudKubernetesClusterResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudKubernetesClusterResources and their operations over a NetworkCloudKubernetesClusterResource. - public virtual NetworkCloudKubernetesClusterCollection GetNetworkCloudKubernetesClusters() - { - return GetCachedClient(Client => new NetworkCloudKubernetesClusterCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudL2NetworkResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudL2NetworkResources and their operations over a NetworkCloudL2NetworkResource. - public virtual NetworkCloudL2NetworkCollection GetNetworkCloudL2Networks() - { - return GetCachedClient(Client => new NetworkCloudL2NetworkCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudL3NetworkResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudL3NetworkResources and their operations over a NetworkCloudL3NetworkResource. - public virtual NetworkCloudL3NetworkCollection GetNetworkCloudL3Networks() - { - return GetCachedClient(Client => new NetworkCloudL3NetworkCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudRackResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudRackResources and their operations over a NetworkCloudRackResource. - public virtual NetworkCloudRackCollection GetNetworkCloudRacks() - { - return GetCachedClient(Client => new NetworkCloudRackCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudStorageApplianceResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudStorageApplianceResources and their operations over a NetworkCloudStorageApplianceResource. - public virtual NetworkCloudStorageApplianceCollection GetNetworkCloudStorageAppliances() - { - return GetCachedClient(Client => new NetworkCloudStorageApplianceCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudTrunkedNetworkResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudTrunkedNetworkResources and their operations over a NetworkCloudTrunkedNetworkResource. - public virtual NetworkCloudTrunkedNetworkCollection GetNetworkCloudTrunkedNetworks() - { - return GetCachedClient(Client => new NetworkCloudTrunkedNetworkCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudVirtualMachineResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudVirtualMachineResources and their operations over a NetworkCloudVirtualMachineResource. - public virtual NetworkCloudVirtualMachineCollection GetNetworkCloudVirtualMachines() - { - return GetCachedClient(Client => new NetworkCloudVirtualMachineCollection(Client, Id)); - } - - /// Gets a collection of NetworkCloudVolumeResources in the ResourceGroupResource. - /// An object representing collection of NetworkCloudVolumeResources and their operations over a NetworkCloudVolumeResource. - public virtual NetworkCloudVolumeCollection GetNetworkCloudVolumes() - { - return GetCachedClient(Client => new NetworkCloudVolumeCollection(Client, Id)); - } - } -} diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index b05e250e63aaa..0000000000000 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,623 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NetworkCloud -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _networkCloudBareMetalMachineBareMetalMachinesClientDiagnostics; - private BareMetalMachinesRestOperations _networkCloudBareMetalMachineBareMetalMachinesRestClient; - private ClientDiagnostics _networkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics; - private CloudServicesNetworksRestOperations _networkCloudCloudServicesNetworkCloudServicesNetworksRestClient; - private ClientDiagnostics _networkCloudClusterManagerClusterManagersClientDiagnostics; - private ClusterManagersRestOperations _networkCloudClusterManagerClusterManagersRestClient; - private ClientDiagnostics _networkCloudClusterClustersClientDiagnostics; - private ClustersRestOperations _networkCloudClusterClustersRestClient; - private ClientDiagnostics _networkCloudKubernetesClusterKubernetesClustersClientDiagnostics; - private KubernetesClustersRestOperations _networkCloudKubernetesClusterKubernetesClustersRestClient; - private ClientDiagnostics _networkCloudL2NetworkL2NetworksClientDiagnostics; - private L2NetworksRestOperations _networkCloudL2NetworkL2NetworksRestClient; - private ClientDiagnostics _networkCloudL3NetworkL3NetworksClientDiagnostics; - private L3NetworksRestOperations _networkCloudL3NetworkL3NetworksRestClient; - private ClientDiagnostics _networkCloudRackRacksClientDiagnostics; - private RacksRestOperations _networkCloudRackRacksRestClient; - private ClientDiagnostics _networkCloudStorageApplianceStorageAppliancesClientDiagnostics; - private StorageAppliancesRestOperations _networkCloudStorageApplianceStorageAppliancesRestClient; - private ClientDiagnostics _networkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics; - private TrunkedNetworksRestOperations _networkCloudTrunkedNetworkTrunkedNetworksRestClient; - private ClientDiagnostics _networkCloudVirtualMachineVirtualMachinesClientDiagnostics; - private VirtualMachinesRestOperations _networkCloudVirtualMachineVirtualMachinesRestClient; - private ClientDiagnostics _networkCloudVolumeVolumesClientDiagnostics; - private VolumesRestOperations _networkCloudVolumeVolumesRestClient; - - /// 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 NetworkCloudBareMetalMachineBareMetalMachinesClientDiagnostics => _networkCloudBareMetalMachineBareMetalMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudBareMetalMachineResource.ResourceType.Namespace, Diagnostics); - private BareMetalMachinesRestOperations NetworkCloudBareMetalMachineBareMetalMachinesRestClient => _networkCloudBareMetalMachineBareMetalMachinesRestClient ??= new BareMetalMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudBareMetalMachineResource.ResourceType)); - private ClientDiagnostics NetworkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics => _networkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudCloudServicesNetworkResource.ResourceType.Namespace, Diagnostics); - private CloudServicesNetworksRestOperations NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient => _networkCloudCloudServicesNetworkCloudServicesNetworksRestClient ??= new CloudServicesNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudCloudServicesNetworkResource.ResourceType)); - private ClientDiagnostics NetworkCloudClusterManagerClusterManagersClientDiagnostics => _networkCloudClusterManagerClusterManagersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudClusterManagerResource.ResourceType.Namespace, Diagnostics); - private ClusterManagersRestOperations NetworkCloudClusterManagerClusterManagersRestClient => _networkCloudClusterManagerClusterManagersRestClient ??= new ClusterManagersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudClusterManagerResource.ResourceType)); - private ClientDiagnostics NetworkCloudClusterClustersClientDiagnostics => _networkCloudClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations NetworkCloudClusterClustersRestClient => _networkCloudClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudClusterResource.ResourceType)); - private ClientDiagnostics NetworkCloudKubernetesClusterKubernetesClustersClientDiagnostics => _networkCloudKubernetesClusterKubernetesClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudKubernetesClusterResource.ResourceType.Namespace, Diagnostics); - private KubernetesClustersRestOperations NetworkCloudKubernetesClusterKubernetesClustersRestClient => _networkCloudKubernetesClusterKubernetesClustersRestClient ??= new KubernetesClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudKubernetesClusterResource.ResourceType)); - private ClientDiagnostics NetworkCloudL2NetworkL2NetworksClientDiagnostics => _networkCloudL2NetworkL2NetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudL2NetworkResource.ResourceType.Namespace, Diagnostics); - private L2NetworksRestOperations NetworkCloudL2NetworkL2NetworksRestClient => _networkCloudL2NetworkL2NetworksRestClient ??= new L2NetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudL2NetworkResource.ResourceType)); - private ClientDiagnostics NetworkCloudL3NetworkL3NetworksClientDiagnostics => _networkCloudL3NetworkL3NetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudL3NetworkResource.ResourceType.Namespace, Diagnostics); - private L3NetworksRestOperations NetworkCloudL3NetworkL3NetworksRestClient => _networkCloudL3NetworkL3NetworksRestClient ??= new L3NetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudL3NetworkResource.ResourceType)); - private ClientDiagnostics NetworkCloudRackRacksClientDiagnostics => _networkCloudRackRacksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudRackResource.ResourceType.Namespace, Diagnostics); - private RacksRestOperations NetworkCloudRackRacksRestClient => _networkCloudRackRacksRestClient ??= new RacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudRackResource.ResourceType)); - private ClientDiagnostics NetworkCloudStorageApplianceStorageAppliancesClientDiagnostics => _networkCloudStorageApplianceStorageAppliancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudStorageApplianceResource.ResourceType.Namespace, Diagnostics); - private StorageAppliancesRestOperations NetworkCloudStorageApplianceStorageAppliancesRestClient => _networkCloudStorageApplianceStorageAppliancesRestClient ??= new StorageAppliancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudStorageApplianceResource.ResourceType)); - private ClientDiagnostics NetworkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics => _networkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudTrunkedNetworkResource.ResourceType.Namespace, Diagnostics); - private TrunkedNetworksRestOperations NetworkCloudTrunkedNetworkTrunkedNetworksRestClient => _networkCloudTrunkedNetworkTrunkedNetworksRestClient ??= new TrunkedNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudTrunkedNetworkResource.ResourceType)); - private ClientDiagnostics NetworkCloudVirtualMachineVirtualMachinesClientDiagnostics => _networkCloudVirtualMachineVirtualMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudVirtualMachineResource.ResourceType.Namespace, Diagnostics); - private VirtualMachinesRestOperations NetworkCloudVirtualMachineVirtualMachinesRestClient => _networkCloudVirtualMachineVirtualMachinesRestClient ??= new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudVirtualMachineResource.ResourceType)); - private ClientDiagnostics NetworkCloudVolumeVolumesClientDiagnostics => _networkCloudVolumeVolumesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkCloud", NetworkCloudVolumeResource.ResourceType.Namespace, Diagnostics); - private VolumesRestOperations NetworkCloudVolumeVolumesRestClient => _networkCloudVolumeVolumesRestClient ??= new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetworkCloudVolumeResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of NetworkCloudRackSkuResources in the SubscriptionResource. - /// An object representing collection of NetworkCloudRackSkuResources and their operations over a NetworkCloudRackSkuResource. - public virtual NetworkCloudRackSkuCollection GetNetworkCloudRackSkus() - { - return GetCachedClient(Client => new NetworkCloudRackSkuCollection(Client, Id)); - } - - /// - /// Get a list of bare metal machines in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines - /// - /// - /// Operation Id - /// BareMetalMachines_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudBareMetalMachinesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudBareMetalMachineBareMetalMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudBareMetalMachineBareMetalMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudBareMetalMachineResource(Client, NetworkCloudBareMetalMachineData.DeserializeNetworkCloudBareMetalMachineData(e)), NetworkCloudBareMetalMachineBareMetalMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudBareMetalMachines", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of bare metal machines in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines - /// - /// - /// Operation Id - /// BareMetalMachines_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudBareMetalMachines(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudBareMetalMachineBareMetalMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudBareMetalMachineBareMetalMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudBareMetalMachineResource(Client, NetworkCloudBareMetalMachineData.DeserializeNetworkCloudBareMetalMachineData(e)), NetworkCloudBareMetalMachineBareMetalMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudBareMetalMachines", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of cloud services networks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks - /// - /// - /// Operation Id - /// CloudServicesNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudCloudServicesNetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudCloudServicesNetworkResource(Client, NetworkCloudCloudServicesNetworkData.DeserializeNetworkCloudCloudServicesNetworkData(e)), NetworkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudCloudServicesNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of cloud services networks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks - /// - /// - /// Operation Id - /// CloudServicesNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudCloudServicesNetworks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudCloudServicesNetworkCloudServicesNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudCloudServicesNetworkResource(Client, NetworkCloudCloudServicesNetworkData.DeserializeNetworkCloudCloudServicesNetworkData(e)), NetworkCloudCloudServicesNetworkCloudServicesNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudCloudServicesNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of cluster managers in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers - /// - /// - /// Operation Id - /// ClusterManagers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudClusterManagersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudClusterManagerClusterManagersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudClusterManagerClusterManagersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudClusterManagerResource(Client, NetworkCloudClusterManagerData.DeserializeNetworkCloudClusterManagerData(e)), NetworkCloudClusterManagerClusterManagersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudClusterManagers", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of cluster managers in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers - /// - /// - /// Operation Id - /// ClusterManagers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudClusterManagers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudClusterManagerClusterManagersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudClusterManagerClusterManagersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudClusterManagerResource(Client, NetworkCloudClusterManagerData.DeserializeNetworkCloudClusterManagerData(e)), NetworkCloudClusterManagerClusterManagersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudClusterManagers", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of clusters in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters - /// - /// - /// Operation Id - /// Clusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudClusterResource(Client, NetworkCloudClusterData.DeserializeNetworkCloudClusterData(e)), NetworkCloudClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of clusters in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters - /// - /// - /// Operation Id - /// Clusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudClusterResource(Client, NetworkCloudClusterData.DeserializeNetworkCloudClusterData(e)), NetworkCloudClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of Kubernetes clusters in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/kubernetesClusters - /// - /// - /// Operation Id - /// KubernetesClusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudKubernetesClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudKubernetesClusterKubernetesClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudKubernetesClusterKubernetesClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudKubernetesClusterResource(Client, NetworkCloudKubernetesClusterData.DeserializeNetworkCloudKubernetesClusterData(e)), NetworkCloudKubernetesClusterKubernetesClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudKubernetesClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of Kubernetes clusters in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/kubernetesClusters - /// - /// - /// Operation Id - /// KubernetesClusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudKubernetesClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudKubernetesClusterKubernetesClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudKubernetesClusterKubernetesClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudKubernetesClusterResource(Client, NetworkCloudKubernetesClusterData.DeserializeNetworkCloudKubernetesClusterData(e)), NetworkCloudKubernetesClusterKubernetesClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudKubernetesClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of layer 2 (L2) networks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks - /// - /// - /// Operation Id - /// L2Networks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudL2NetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudL2NetworkL2NetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudL2NetworkL2NetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudL2NetworkResource(Client, NetworkCloudL2NetworkData.DeserializeNetworkCloudL2NetworkData(e)), NetworkCloudL2NetworkL2NetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudL2Networks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of layer 2 (L2) networks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks - /// - /// - /// Operation Id - /// L2Networks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudL2Networks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudL2NetworkL2NetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudL2NetworkL2NetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudL2NetworkResource(Client, NetworkCloudL2NetworkData.DeserializeNetworkCloudL2NetworkData(e)), NetworkCloudL2NetworkL2NetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudL2Networks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of layer 3 (L3) networks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks - /// - /// - /// Operation Id - /// L3Networks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudL3NetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudL3NetworkL3NetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudL3NetworkL3NetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudL3NetworkResource(Client, NetworkCloudL3NetworkData.DeserializeNetworkCloudL3NetworkData(e)), NetworkCloudL3NetworkL3NetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudL3Networks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of layer 3 (L3) networks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks - /// - /// - /// Operation Id - /// L3Networks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudL3Networks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudL3NetworkL3NetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudL3NetworkL3NetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudL3NetworkResource(Client, NetworkCloudL3NetworkData.DeserializeNetworkCloudL3NetworkData(e)), NetworkCloudL3NetworkL3NetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudL3Networks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of racks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks - /// - /// - /// Operation Id - /// Racks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudRacksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudRackRacksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudRackRacksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudRackResource(Client, NetworkCloudRackData.DeserializeNetworkCloudRackData(e)), NetworkCloudRackRacksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudRacks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of racks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks - /// - /// - /// Operation Id - /// Racks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudRacks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudRackRacksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudRackRacksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudRackResource(Client, NetworkCloudRackData.DeserializeNetworkCloudRackData(e)), NetworkCloudRackRacksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudRacks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of storage appliances in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances - /// - /// - /// Operation Id - /// StorageAppliances_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudStorageAppliancesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudStorageApplianceStorageAppliancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudStorageApplianceStorageAppliancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudStorageApplianceResource(Client, NetworkCloudStorageApplianceData.DeserializeNetworkCloudStorageApplianceData(e)), NetworkCloudStorageApplianceStorageAppliancesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudStorageAppliances", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of storage appliances in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances - /// - /// - /// Operation Id - /// StorageAppliances_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudStorageAppliances(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudStorageApplianceStorageAppliancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudStorageApplianceStorageAppliancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudStorageApplianceResource(Client, NetworkCloudStorageApplianceData.DeserializeNetworkCloudStorageApplianceData(e)), NetworkCloudStorageApplianceStorageAppliancesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudStorageAppliances", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of trunked networks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks - /// - /// - /// Operation Id - /// TrunkedNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudTrunkedNetworksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudTrunkedNetworkTrunkedNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudTrunkedNetworkTrunkedNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudTrunkedNetworkResource(Client, NetworkCloudTrunkedNetworkData.DeserializeNetworkCloudTrunkedNetworkData(e)), NetworkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudTrunkedNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of trunked networks in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks - /// - /// - /// Operation Id - /// TrunkedNetworks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudTrunkedNetworks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudTrunkedNetworkTrunkedNetworksRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudTrunkedNetworkTrunkedNetworksRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudTrunkedNetworkResource(Client, NetworkCloudTrunkedNetworkData.DeserializeNetworkCloudTrunkedNetworkData(e)), NetworkCloudTrunkedNetworkTrunkedNetworksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudTrunkedNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of virtual machines in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudVirtualMachinesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudVirtualMachineResource(Client, NetworkCloudVirtualMachineData.DeserializeNetworkCloudVirtualMachineData(e)), NetworkCloudVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudVirtualMachines", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of virtual machines in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines - /// - /// - /// Operation Id - /// VirtualMachines_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudVirtualMachines(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudVirtualMachineVirtualMachinesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudVirtualMachineResource(Client, NetworkCloudVirtualMachineData.DeserializeNetworkCloudVirtualMachineData(e)), NetworkCloudVirtualMachineVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudVirtualMachines", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of volumes in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes - /// - /// - /// Operation Id - /// Volumes_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetworkCloudVolumesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudVolumeVolumesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudVolumeVolumesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudVolumeResource(Client, NetworkCloudVolumeData.DeserializeNetworkCloudVolumeData(e)), NetworkCloudVolumeVolumesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudVolumes", "value", "nextLink", cancellationToken); - } - - /// - /// Get a list of volumes in the provided subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes - /// - /// - /// Operation Id - /// Volumes_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetworkCloudVolumes(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetworkCloudVolumeVolumesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetworkCloudVolumeVolumesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkCloudVolumeResource(Client, NetworkCloudVolumeData.DeserializeNetworkCloudVolumeData(e)), NetworkCloudVolumeVolumesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNetworkCloudVolumes", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudAgentPoolResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudAgentPoolResource.cs index 88025c5c4aea7..ce6d7ed6da705 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudAgentPoolResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudAgentPoolResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudAgentPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The kubernetesClusterName. + /// The agentPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string kubernetesClusterName, string agentPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineKeySetResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineKeySetResource.cs index 5f8d4d7ffb42f..36c3e5b4b2be1 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineKeySetResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineKeySetResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudBareMetalMachineKeySetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The bareMetalMachineKeySetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string bareMetalMachineKeySetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineResource.cs index d326e95649871..901497c7531b7 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBareMetalMachineResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudBareMetalMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The bareMetalMachineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string bareMetalMachineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBmcKeySetResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBmcKeySetResource.cs index f3627cdd526ec..fff29d82be498 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBmcKeySetResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudBmcKeySetResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudBmcKeySetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The bmcKeySetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string bmcKeySetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudCloudServicesNetworkResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudCloudServicesNetworkResource.cs index 43b6e298ea8d8..8a1acda2df358 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudCloudServicesNetworkResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudCloudServicesNetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudCloudServicesNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cloudServicesNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cloudServicesNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterManagerResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterManagerResource.cs index 14d8733326319..eae0bf3eb2ce4 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterManagerResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterManagerResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudClusterManagerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterManagerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterManagerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterMetricsConfigurationResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterMetricsConfigurationResource.cs index 9d7ff9356f3b4..de1cb498bbd94 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterMetricsConfigurationResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterMetricsConfigurationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudClusterMetricsConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The metricsConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string metricsConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterResource.cs index e1669745e9e52..997a825e10529 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkCloudBareMetalMachineKeySetResources and their operations over a NetworkCloudBareMetalMachineKeySetResource. public virtual NetworkCloudBareMetalMachineKeySetCollection GetNetworkCloudBareMetalMachineKeySets() { - return GetCachedClient(Client => new NetworkCloudBareMetalMachineKeySetCollection(Client, Id)); + return GetCachedClient(client => new NetworkCloudBareMetalMachineKeySetCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual NetworkCloudBareMetalMachineKeySetCollection GetNetworkCloudBareM /// /// The name of the bare metal machine key set. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkCloudBareMetalMachineKeySetAsync(string bareMetalMachineKeySetName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> /// /// The name of the bare metal machine key set. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkCloudBareMetalMachineKeySet(string bareMetalMachineKeySetName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetNetworkCl /// An object representing collection of NetworkCloudBmcKeySetResources and their operations over a NetworkCloudBmcKeySetResource. public virtual NetworkCloudBmcKeySetCollection GetNetworkCloudBmcKeySets() { - return GetCachedClient(Client => new NetworkCloudBmcKeySetCollection(Client, Id)); + return GetCachedClient(client => new NetworkCloudBmcKeySetCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual NetworkCloudBmcKeySetCollection GetNetworkCloudBmcKeySets() /// /// The name of the baseboard management controller key set. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkCloudBmcKeySetAsync(string bmcKeySetName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetNetworkClo /// /// The name of the baseboard management controller key set. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkCloudBmcKeySet(string bmcKeySetName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetNetworkCloudBmcKeySet( /// An object representing collection of NetworkCloudClusterMetricsConfigurationResources and their operations over a NetworkCloudClusterMetricsConfigurationResource. public virtual NetworkCloudClusterMetricsConfigurationCollection GetNetworkCloudClusterMetricsConfigurations() { - return GetCachedClient(Client => new NetworkCloudClusterMetricsConfigurationCollection(Client, Id)); + return GetCachedClient(client => new NetworkCloudClusterMetricsConfigurationCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual NetworkCloudClusterMetricsConfigurationCollection GetNetworkCloud /// /// The name of the metrics configuration for the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkCloudClusterMetricsConfigurationAsync(string metricsConfigurationName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task /// The name of the metrics configuration for the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkCloudClusterMetricsConfiguration(string metricsConfigurationName, CancellationToken cancellationToken = default) { diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterResource.cs index e4e93223528ba..2a536d10f3415 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudKubernetesClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The kubernetesClusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string kubernetesClusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkCloudAgentPoolResources and their operations over a NetworkCloudAgentPoolResource. public virtual NetworkCloudAgentPoolCollection GetNetworkCloudAgentPools() { - return GetCachedClient(Client => new NetworkCloudAgentPoolCollection(Client, Id)); + return GetCachedClient(client => new NetworkCloudAgentPoolCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual NetworkCloudAgentPoolCollection GetNetworkCloudAgentPools() /// /// The name of the Kubernetes cluster agent pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkCloudAgentPoolAsync(string agentPoolName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetNetworkClo /// /// The name of the Kubernetes cluster agent pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkCloudAgentPool(string agentPoolName, CancellationToken cancellationToken = default) { diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL2NetworkResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL2NetworkResource.cs index a774c51305600..a41cfbf6469b9 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL2NetworkResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL2NetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudL2NetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The l2NetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string l2NetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL3NetworkResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL3NetworkResource.cs index 5e70e3fd0a032..6ca5daaee0791 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL3NetworkResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudL3NetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudL3NetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The l3NetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string l3NetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackResource.cs index f04cbf515cb56..f218dad91ad51 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudRackResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The rackName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string rackName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackSkuResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackSkuResource.cs index b074905833574..154361815cbce 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackSkuResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudRackSkuResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudRackSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The rackSkuName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string rackSkuName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus/{rackSkuName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudStorageApplianceResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudStorageApplianceResource.cs index f046532f69cde..adfa14322b6f5 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudStorageApplianceResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudStorageApplianceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudStorageApplianceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageApplianceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageApplianceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudTrunkedNetworkResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudTrunkedNetworkResource.cs index 3d26d4224b527..c69f5571ed48a 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudTrunkedNetworkResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudTrunkedNetworkResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudTrunkedNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The trunkedNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string trunkedNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineConsoleResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineConsoleResource.cs index c3872258ef4ca..b5f6253301bed 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineConsoleResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineConsoleResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudVirtualMachineConsoleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineName. + /// The consoleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineName, string consoleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}"; diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineResource.cs index fee8d99c22c67..5ca3e09f03b5f 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudVirtualMachineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NetworkCloudVirtualMachineConsoleResources and their operations over a NetworkCloudVirtualMachineConsoleResource. public virtual NetworkCloudVirtualMachineConsoleCollection GetNetworkCloudVirtualMachineConsoles() { - return GetCachedClient(Client => new NetworkCloudVirtualMachineConsoleCollection(Client, Id)); + return GetCachedClient(client => new NetworkCloudVirtualMachineConsoleCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual NetworkCloudVirtualMachineConsoleCollection GetNetworkCloudVirtua /// /// The name of the virtual machine console. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkCloudVirtualMachineConsoleAsync(string consoleName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> G /// /// The name of the virtual machine console. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkCloudVirtualMachineConsole(string consoleName, CancellationToken cancellationToken = default) { diff --git a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVolumeResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVolumeResource.cs index 7028f29551f4f..03424964c0059 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVolumeResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVolumeResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkCloud public partial class NetworkCloudVolumeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The volumeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string volumeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}"; diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/api/Azure.ResourceManager.NetworkFunction.netstandard2.0.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/api/Azure.ResourceManager.NetworkFunction.netstandard2.0.cs index 5f2a3d1a83edf..4b2f96bd3b5b9 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/api/Azure.ResourceManager.NetworkFunction.netstandard2.0.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/api/Azure.ResourceManager.NetworkFunction.netstandard2.0.cs @@ -19,7 +19,7 @@ protected AzureTrafficCollectorCollection() { } } public partial class AzureTrafficCollectorData : Azure.ResourceManager.Models.TrackedResourceData { - public AzureTrafficCollectorData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AzureTrafficCollectorData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList CollectorPolicies { get { throw null; } } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.NetworkFunction.Models.CollectorProvisioningState? ProvisioningState { get { throw null; } } @@ -67,7 +67,7 @@ protected CollectorPolicyCollection() { } } public partial class CollectorPolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public CollectorPolicyData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public CollectorPolicyData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList EmissionPolicies { get { throw null; } } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.NetworkFunction.Models.IngestionPolicyPropertiesFormat IngestionPolicy { get { throw null; } set { } } @@ -104,6 +104,28 @@ public static partial class NetworkFunctionExtensions public static Azure.ResourceManager.NetworkFunction.CollectorPolicyResource GetCollectorPolicyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } } +namespace Azure.ResourceManager.NetworkFunction.Mocking +{ + public partial class MockableNetworkFunctionArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNetworkFunctionArmClient() { } + public virtual Azure.ResourceManager.NetworkFunction.AzureTrafficCollectorResource GetAzureTrafficCollectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NetworkFunction.CollectorPolicyResource GetCollectorPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNetworkFunctionResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkFunctionResourceGroupResource() { } + public virtual Azure.Response GetAzureTrafficCollector(string azureTrafficCollectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAzureTrafficCollectorAsync(string azureTrafficCollectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NetworkFunction.AzureTrafficCollectorCollection GetAzureTrafficCollectors() { throw null; } + } + public partial class MockableNetworkFunctionSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNetworkFunctionSubscriptionResource() { } + public virtual Azure.Pageable GetAzureTrafficCollectors(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAzureTrafficCollectorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.NetworkFunction.Models { public static partial class ArmNetworkFunctionModelFactory diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorResource.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorResource.cs index b981b6e701d88..562c04102b2c0 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorResource.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NetworkFunction public partial class AzureTrafficCollectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureTrafficCollectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureTrafficCollectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CollectorPolicyResources and their operations over a CollectorPolicyResource. public virtual CollectorPolicyCollection GetCollectorPolicies() { - return GetCachedClient(Client => new CollectorPolicyCollection(Client, Id)); + return GetCachedClient(client => new CollectorPolicyCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual CollectorPolicyCollection GetCollectorPolicies() /// /// Collector Policy Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCollectorPolicyAsync(string collectorPolicyName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetCollectorPolicyA /// /// Collector Policy Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCollectorPolicy(string collectorPolicyName, CancellationToken cancellationToken = default) { diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/CollectorPolicyResource.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/CollectorPolicyResource.cs index f7f670d3c3124..9288728dfccb5 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/CollectorPolicyResource.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/CollectorPolicyResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NetworkFunction public partial class CollectorPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureTrafficCollectorName. + /// The collectorPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureTrafficCollectorName, string collectorPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}"; diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionArmClient.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionArmClient.cs new file mode 100644 index 0000000000000..55054fcb744d6 --- /dev/null +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NetworkFunction; + +namespace Azure.ResourceManager.NetworkFunction.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNetworkFunctionArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetworkFunctionArmClient() + { + } + + /// 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 MockableNetworkFunctionArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNetworkFunctionArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AzureTrafficCollectorResource GetAzureTrafficCollectorResource(ResourceIdentifier id) + { + AzureTrafficCollectorResource.ValidateResourceId(id); + return new AzureTrafficCollectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CollectorPolicyResource GetCollectorPolicyResource(ResourceIdentifier id) + { + CollectorPolicyResource.ValidateResourceId(id); + return new CollectorPolicyResource(Client, id); + } + } +} diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionResourceGroupResource.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionResourceGroupResource.cs new file mode 100644 index 0000000000000..37df53b97b5be --- /dev/null +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.NetworkFunction; + +namespace Azure.ResourceManager.NetworkFunction.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNetworkFunctionResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNetworkFunctionResourceGroupResource() + { + } + + /// 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 MockableNetworkFunctionResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AzureTrafficCollectorResources in the ResourceGroupResource. + /// An object representing collection of AzureTrafficCollectorResources and their operations over a AzureTrafficCollectorResource. + public virtual AzureTrafficCollectorCollection GetAzureTrafficCollectors() + { + return GetCachedClient(client => new AzureTrafficCollectorCollection(client, Id)); + } + + /// + /// Gets the specified Azure Traffic Collector in a specified resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName} + /// + /// + /// Operation Id + /// AzureTrafficCollectors_Get + /// + /// + /// + /// Azure Traffic Collector name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAzureTrafficCollectorAsync(string azureTrafficCollectorName, CancellationToken cancellationToken = default) + { + return await GetAzureTrafficCollectors().GetAsync(azureTrafficCollectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Azure Traffic Collector in a specified resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName} + /// + /// + /// Operation Id + /// AzureTrafficCollectors_Get + /// + /// + /// + /// Azure Traffic Collector name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAzureTrafficCollector(string azureTrafficCollectorName, CancellationToken cancellationToken = default) + { + return GetAzureTrafficCollectors().Get(azureTrafficCollectorName, cancellationToken); + } + } +} diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionSubscriptionResource.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionSubscriptionResource.cs new file mode 100644 index 0000000000000..066e354e8f5b7 --- /dev/null +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetworkFunction; + +namespace Azure.ResourceManager.NetworkFunction.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNetworkFunctionSubscriptionResource : ArmResource + { + private ClientDiagnostics _azureTrafficCollectorsBySubscriptionClientDiagnostics; + private AzureTrafficCollectorsBySubscriptionRestOperations _azureTrafficCollectorsBySubscriptionRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNetworkFunctionSubscriptionResource() + { + } + + /// 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 MockableNetworkFunctionSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AzureTrafficCollectorsBySubscriptionClientDiagnostics => _azureTrafficCollectorsBySubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkFunction", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzureTrafficCollectorsBySubscriptionRestOperations AzureTrafficCollectorsBySubscriptionRestClient => _azureTrafficCollectorsBySubscriptionRestClient ??= new AzureTrafficCollectorsBySubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Return list of Azure Traffic Collectors in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkFunction/azureTrafficCollectors + /// + /// + /// Operation Id + /// AzureTrafficCollectorsBySubscription_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAzureTrafficCollectorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureTrafficCollectorsBySubscriptionRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureTrafficCollectorsBySubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AzureTrafficCollectorResource(Client, AzureTrafficCollectorData.DeserializeAzureTrafficCollectorData(e)), AzureTrafficCollectorsBySubscriptionClientDiagnostics, Pipeline, "MockableNetworkFunctionSubscriptionResource.GetAzureTrafficCollectors", "value", "nextLink", cancellationToken); + } + + /// + /// Return list of Azure Traffic Collectors in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkFunction/azureTrafficCollectors + /// + /// + /// Operation Id + /// AzureTrafficCollectorsBySubscription_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAzureTrafficCollectors(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureTrafficCollectorsBySubscriptionRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureTrafficCollectorsBySubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AzureTrafficCollectorResource(Client, AzureTrafficCollectorData.DeserializeAzureTrafficCollectorData(e)), AzureTrafficCollectorsBySubscriptionClientDiagnostics, Pipeline, "MockableNetworkFunctionSubscriptionResource.GetAzureTrafficCollectors", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/NetworkFunctionExtensions.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/NetworkFunctionExtensions.cs index 4a1aadd97d96c..1bd5e576b12f6 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/NetworkFunctionExtensions.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/NetworkFunctionExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.NetworkFunction.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetworkFunction @@ -18,81 +19,65 @@ namespace Azure.ResourceManager.NetworkFunction /// A class to add extension methods to Azure.ResourceManager.NetworkFunction. public static partial class NetworkFunctionExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableNetworkFunctionArmClient GetMockableNetworkFunctionArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableNetworkFunctionArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNetworkFunctionResourceGroupResource GetMockableNetworkFunctionResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNetworkFunctionResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableNetworkFunctionSubscriptionResource GetMockableNetworkFunctionSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableNetworkFunctionSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AzureTrafficCollectorResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AzureTrafficCollectorResource GetAzureTrafficCollectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AzureTrafficCollectorResource.ValidateResourceId(id); - return new AzureTrafficCollectorResource(client, id); - } - ); + return GetMockableNetworkFunctionArmClient(client).GetAzureTrafficCollectorResource(id); } - #endregion - #region CollectorPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CollectorPolicyResource GetCollectorPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CollectorPolicyResource.ValidateResourceId(id); - return new CollectorPolicyResource(client, id); - } - ); + return GetMockableNetworkFunctionArmClient(client).GetCollectorPolicyResource(id); } - #endregion - /// Gets a collection of AzureTrafficCollectorResources in the ResourceGroupResource. + /// + /// Gets a collection of AzureTrafficCollectorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AzureTrafficCollectorResources and their operations over a AzureTrafficCollectorResource. public static AzureTrafficCollectorCollection GetAzureTrafficCollectors(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAzureTrafficCollectors(); + return GetMockableNetworkFunctionResourceGroupResource(resourceGroupResource).GetAzureTrafficCollectors(); } /// @@ -107,16 +92,20 @@ public static AzureTrafficCollectorCollection GetAzureTrafficCollectors(this Res /// AzureTrafficCollectors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure Traffic Collector name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAzureTrafficCollectorAsync(this ResourceGroupResource resourceGroupResource, string azureTrafficCollectorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAzureTrafficCollectors().GetAsync(azureTrafficCollectorName, cancellationToken).ConfigureAwait(false); + return await GetMockableNetworkFunctionResourceGroupResource(resourceGroupResource).GetAzureTrafficCollectorAsync(azureTrafficCollectorName, cancellationToken).ConfigureAwait(false); } /// @@ -131,16 +120,20 @@ public static async Task> GetAzureTraffi /// AzureTrafficCollectors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure Traffic Collector name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAzureTrafficCollector(this ResourceGroupResource resourceGroupResource, string azureTrafficCollectorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAzureTrafficCollectors().Get(azureTrafficCollectorName, cancellationToken); + return GetMockableNetworkFunctionResourceGroupResource(resourceGroupResource).GetAzureTrafficCollector(azureTrafficCollectorName, cancellationToken); } /// @@ -155,13 +148,17 @@ public static Response GetAzureTrafficCollector(t /// AzureTrafficCollectorsBySubscription_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzureTrafficCollectorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureTrafficCollectorsAsync(cancellationToken); + return GetMockableNetworkFunctionSubscriptionResource(subscriptionResource).GetAzureTrafficCollectorsAsync(cancellationToken); } /// @@ -176,13 +173,17 @@ public static AsyncPageable GetAzureTrafficCollec /// AzureTrafficCollectorsBySubscription_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzureTrafficCollectors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureTrafficCollectors(cancellationToken); + return GetMockableNetworkFunctionSubscriptionResource(subscriptionResource).GetAzureTrafficCollectors(cancellationToken); } } } diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index f6da75c891d96..0000000000000 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NetworkFunction -{ - /// 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 AzureTrafficCollectorResources in the ResourceGroupResource. - /// An object representing collection of AzureTrafficCollectorResources and their operations over a AzureTrafficCollectorResource. - public virtual AzureTrafficCollectorCollection GetAzureTrafficCollectors() - { - return GetCachedClient(Client => new AzureTrafficCollectorCollection(Client, Id)); - } - } -} diff --git a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 1ebf2dc0c8d35..0000000000000 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NetworkFunction -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _azureTrafficCollectorsBySubscriptionClientDiagnostics; - private AzureTrafficCollectorsBySubscriptionRestOperations _azureTrafficCollectorsBySubscriptionRestClient; - - /// 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 AzureTrafficCollectorsBySubscriptionClientDiagnostics => _azureTrafficCollectorsBySubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetworkFunction", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AzureTrafficCollectorsBySubscriptionRestOperations AzureTrafficCollectorsBySubscriptionRestClient => _azureTrafficCollectorsBySubscriptionRestClient ??= new AzureTrafficCollectorsBySubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Return list of Azure Traffic Collectors in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkFunction/azureTrafficCollectors - /// - /// - /// Operation Id - /// AzureTrafficCollectorsBySubscription_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAzureTrafficCollectorsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzureTrafficCollectorsBySubscriptionRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureTrafficCollectorsBySubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AzureTrafficCollectorResource(Client, AzureTrafficCollectorData.DeserializeAzureTrafficCollectorData(e)), AzureTrafficCollectorsBySubscriptionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAzureTrafficCollectors", "value", "nextLink", cancellationToken); - } - - /// - /// Return list of Azure Traffic Collectors in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetworkFunction/azureTrafficCollectors - /// - /// - /// Operation Id - /// AzureTrafficCollectorsBySubscription_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAzureTrafficCollectors(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzureTrafficCollectorsBySubscriptionRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureTrafficCollectorsBySubscriptionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AzureTrafficCollectorResource(Client, AzureTrafficCollectorData.DeserializeAzureTrafficCollectorData(e)), AzureTrafficCollectorsBySubscriptionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAzureTrafficCollectors", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/api/Azure.ResourceManager.NewRelicObservability.netstandard2.0.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/api/Azure.ResourceManager.NewRelicObservability.netstandard2.0.cs index 9c26377c8b18f..831be69487e20 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/api/Azure.ResourceManager.NewRelicObservability.netstandard2.0.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/api/Azure.ResourceManager.NewRelicObservability.netstandard2.0.cs @@ -56,7 +56,7 @@ protected NewRelicMonitorResourceCollection() { } } public partial class NewRelicMonitorResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public NewRelicMonitorResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NewRelicMonitorResourceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NewRelicObservability.Models.NewRelicObservabilityAccountCreationSource? AccountCreationSource { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.NewRelicObservability.Models.NewRelicLiftrResourceCategory? LiftrResourceCategory { get { throw null; } } @@ -125,6 +125,34 @@ protected NewRelicObservabilityTagRuleResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.NewRelicObservability.Models.NewRelicObservabilityTagRulePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.NewRelicObservability.Mocking +{ + public partial class MockableNewRelicObservabilityArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNewRelicObservabilityArmClient() { } + public virtual Azure.ResourceManager.NewRelicObservability.NewRelicMonitorResource GetNewRelicMonitorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NewRelicObservability.NewRelicObservabilityTagRuleResource GetNewRelicObservabilityTagRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNewRelicObservabilityResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNewRelicObservabilityResourceGroupResource() { } + public virtual Azure.Response GetNewRelicMonitorResource(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNewRelicMonitorResourceAsync(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NewRelicObservability.NewRelicMonitorResourceCollection GetNewRelicMonitorResources() { throw null; } + } + public partial class MockableNewRelicObservabilitySubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNewRelicObservabilitySubscriptionResource() { } + public virtual Azure.Pageable GetNewRelicAccounts(string userEmail, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNewRelicAccountsAsync(string userEmail, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNewRelicMonitorResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNewRelicMonitorResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNewRelicOrganizations(string userEmail, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNewRelicOrganizationsAsync(string userEmail, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNewRelicPlans(string accountId = null, string organizationId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNewRelicPlansAsync(string accountId = null, string organizationId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.NewRelicObservability.Models { public static partial class ArmNewRelicObservabilityModelFactory diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilityArmClient.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilityArmClient.cs new file mode 100644 index 0000000000000..b245146e45a9c --- /dev/null +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilityArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NewRelicObservability; + +namespace Azure.ResourceManager.NewRelicObservability.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNewRelicObservabilityArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNewRelicObservabilityArmClient() + { + } + + /// 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 MockableNewRelicObservabilityArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNewRelicObservabilityArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NewRelicMonitorResource GetNewRelicMonitorResource(ResourceIdentifier id) + { + NewRelicMonitorResource.ValidateResourceId(id); + return new NewRelicMonitorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NewRelicObservabilityTagRuleResource GetNewRelicObservabilityTagRuleResource(ResourceIdentifier id) + { + NewRelicObservabilityTagRuleResource.ValidateResourceId(id); + return new NewRelicObservabilityTagRuleResource(Client, id); + } + } +} diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilityResourceGroupResource.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilityResourceGroupResource.cs new file mode 100644 index 0000000000000..ca74e3b7caad5 --- /dev/null +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilityResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.NewRelicObservability; + +namespace Azure.ResourceManager.NewRelicObservability.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNewRelicObservabilityResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNewRelicObservabilityResourceGroupResource() + { + } + + /// 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 MockableNewRelicObservabilityResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NewRelicMonitorResources in the ResourceGroupResource. + /// An object representing collection of NewRelicMonitorResources and their operations over a NewRelicMonitorResource. + public virtual NewRelicMonitorResourceCollection GetNewRelicMonitorResources() + { + return GetCachedClient(client => new NewRelicMonitorResourceCollection(client, Id)); + } + + /// + /// Get a NewRelicMonitorResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Name of the Monitors resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNewRelicMonitorResourceAsync(string monitorName, CancellationToken cancellationToken = default) + { + return await GetNewRelicMonitorResources().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a NewRelicMonitorResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName} + /// + /// + /// Operation Id + /// Monitors_Get + /// + /// + /// + /// Name of the Monitors resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNewRelicMonitorResource(string monitorName, CancellationToken cancellationToken = default) + { + return GetNewRelicMonitorResources().Get(monitorName, cancellationToken); + } + } +} diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilitySubscriptionResource.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilitySubscriptionResource.cs new file mode 100644 index 0000000000000..c1d2e86984ed0 --- /dev/null +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilitySubscriptionResource.cs @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NewRelicObservability; +using Azure.ResourceManager.NewRelicObservability.Models; + +namespace Azure.ResourceManager.NewRelicObservability.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNewRelicObservabilitySubscriptionResource : ArmResource + { + private ClientDiagnostics _accountsClientDiagnostics; + private AccountsRestOperations _accountsRestClient; + private ClientDiagnostics _newRelicMonitorResourceMonitorsClientDiagnostics; + private MonitorsRestOperations _newRelicMonitorResourceMonitorsRestClient; + private ClientDiagnostics _organizationsClientDiagnostics; + private OrganizationsRestOperations _organizationsRestClient; + private ClientDiagnostics _plansClientDiagnostics; + private PlansRestOperations _plansRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNewRelicObservabilitySubscriptionResource() + { + } + + /// 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 MockableNewRelicObservabilitySubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AccountsClientDiagnostics => _accountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NewRelicObservability", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AccountsRestOperations AccountsRestClient => _accountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics NewRelicMonitorResourceMonitorsClientDiagnostics => _newRelicMonitorResourceMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NewRelicObservability", NewRelicMonitorResource.ResourceType.Namespace, Diagnostics); + private MonitorsRestOperations NewRelicMonitorResourceMonitorsRestClient => _newRelicMonitorResourceMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NewRelicMonitorResource.ResourceType)); + private ClientDiagnostics OrganizationsClientDiagnostics => _organizationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NewRelicObservability", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OrganizationsRestOperations OrganizationsRestClient => _organizationsRestClient ??= new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PlansClientDiagnostics => _plansClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NewRelicObservability", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PlansRestOperations PlansRestClient => _plansRestClient ??= new PlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all the existing accounts + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// User Email. + /// Location for NewRelic. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNewRelicAccountsAsync(string userEmail, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(userEmail, nameof(userEmail)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => AccountsRestClient.CreateListRequest(Id.SubscriptionId, userEmail, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, userEmail, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, NewRelicAccountResourceData.DeserializeNewRelicAccountResourceData, AccountsClientDiagnostics, Pipeline, "MockableNewRelicObservabilitySubscriptionResource.GetNewRelicAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// List all the existing accounts + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/accounts + /// + /// + /// Operation Id + /// Accounts_List + /// + /// + /// + /// User Email. + /// Location for NewRelic. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNewRelicAccounts(string userEmail, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(userEmail, nameof(userEmail)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => AccountsRestClient.CreateListRequest(Id.SubscriptionId, userEmail, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, userEmail, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, NewRelicAccountResourceData.DeserializeNewRelicAccountResourceData, AccountsClientDiagnostics, Pipeline, "MockableNewRelicObservabilitySubscriptionResource.GetNewRelicAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// List NewRelicMonitorResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/monitors + /// + /// + /// Operation Id + /// Monitors_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNewRelicMonitorResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NewRelicMonitorResourceMonitorsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NewRelicMonitorResourceMonitorsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NewRelicMonitorResource(Client, NewRelicMonitorResourceData.DeserializeNewRelicMonitorResourceData(e)), NewRelicMonitorResourceMonitorsClientDiagnostics, Pipeline, "MockableNewRelicObservabilitySubscriptionResource.GetNewRelicMonitorResources", "value", "nextLink", cancellationToken); + } + + /// + /// List NewRelicMonitorResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/monitors + /// + /// + /// Operation Id + /// Monitors_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNewRelicMonitorResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NewRelicMonitorResourceMonitorsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NewRelicMonitorResourceMonitorsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NewRelicMonitorResource(Client, NewRelicMonitorResourceData.DeserializeNewRelicMonitorResourceData(e)), NewRelicMonitorResourceMonitorsClientDiagnostics, Pipeline, "MockableNewRelicObservabilitySubscriptionResource.GetNewRelicMonitorResources", "value", "nextLink", cancellationToken); + } + + /// + /// List all the existing organizations + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/organizations + /// + /// + /// Operation Id + /// Organizations_List + /// + /// + /// + /// User Email. + /// Location for NewRelic. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNewRelicOrganizationsAsync(string userEmail, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(userEmail, nameof(userEmail)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => OrganizationsRestClient.CreateListRequest(Id.SubscriptionId, userEmail, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrganizationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, userEmail, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, NewRelicOrganizationResourceData.DeserializeNewRelicOrganizationResourceData, OrganizationsClientDiagnostics, Pipeline, "MockableNewRelicObservabilitySubscriptionResource.GetNewRelicOrganizations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the existing organizations + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/organizations + /// + /// + /// Operation Id + /// Organizations_List + /// + /// + /// + /// User Email. + /// Location for NewRelic. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNewRelicOrganizations(string userEmail, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(userEmail, nameof(userEmail)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => OrganizationsRestClient.CreateListRequest(Id.SubscriptionId, userEmail, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrganizationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, userEmail, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, NewRelicOrganizationResourceData.DeserializeNewRelicOrganizationResourceData, OrganizationsClientDiagnostics, Pipeline, "MockableNewRelicObservabilitySubscriptionResource.GetNewRelicOrganizations", "value", "nextLink", cancellationToken); + } + + /// + /// List plans data + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/plans + /// + /// + /// Operation Id + /// Plans_List + /// + /// + /// + /// Account Id. + /// Organization Id. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNewRelicPlansAsync(string accountId = null, string organizationId = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PlansRestClient.CreateListRequest(Id.SubscriptionId, accountId, organizationId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PlansRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, accountId, organizationId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, NewRelicPlanData.DeserializeNewRelicPlanData, PlansClientDiagnostics, Pipeline, "MockableNewRelicObservabilitySubscriptionResource.GetNewRelicPlans", "value", "nextLink", cancellationToken); + } + + /// + /// List plans data + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/plans + /// + /// + /// Operation Id + /// Plans_List + /// + /// + /// + /// Account Id. + /// Organization Id. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNewRelicPlans(string accountId = null, string organizationId = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PlansRestClient.CreateListRequest(Id.SubscriptionId, accountId, organizationId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PlansRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, accountId, organizationId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, NewRelicPlanData.DeserializeNewRelicPlanData, PlansClientDiagnostics, Pipeline, "MockableNewRelicObservabilitySubscriptionResource.GetNewRelicPlans", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/NewRelicObservabilityExtensions.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/NewRelicObservabilityExtensions.cs index 63ed3148b37ac..b111f7ee301af 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/NewRelicObservabilityExtensions.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/NewRelicObservabilityExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.NewRelicObservability.Mocking; using Azure.ResourceManager.NewRelicObservability.Models; using Azure.ResourceManager.Resources; @@ -19,81 +20,65 @@ namespace Azure.ResourceManager.NewRelicObservability /// A class to add extension methods to Azure.ResourceManager.NewRelicObservability. public static partial class NewRelicObservabilityExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableNewRelicObservabilityArmClient GetMockableNewRelicObservabilityArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableNewRelicObservabilityArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNewRelicObservabilityResourceGroupResource GetMockableNewRelicObservabilityResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNewRelicObservabilityResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableNewRelicObservabilitySubscriptionResource GetMockableNewRelicObservabilitySubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableNewRelicObservabilitySubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region NewRelicMonitorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NewRelicMonitorResource GetNewRelicMonitorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NewRelicMonitorResource.ValidateResourceId(id); - return new NewRelicMonitorResource(client, id); - } - ); + return GetMockableNewRelicObservabilityArmClient(client).GetNewRelicMonitorResource(id); } - #endregion - #region NewRelicObservabilityTagRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NewRelicObservabilityTagRuleResource GetNewRelicObservabilityTagRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NewRelicObservabilityTagRuleResource.ValidateResourceId(id); - return new NewRelicObservabilityTagRuleResource(client, id); - } - ); + return GetMockableNewRelicObservabilityArmClient(client).GetNewRelicObservabilityTagRuleResource(id); } - #endregion - /// Gets a collection of NewRelicMonitorResources in the ResourceGroupResource. + /// + /// Gets a collection of NewRelicMonitorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NewRelicMonitorResources and their operations over a NewRelicMonitorResource. public static NewRelicMonitorResourceCollection GetNewRelicMonitorResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNewRelicMonitorResources(); + return GetMockableNewRelicObservabilityResourceGroupResource(resourceGroupResource).GetNewRelicMonitorResources(); } /// @@ -108,16 +93,20 @@ public static NewRelicMonitorResourceCollection GetNewRelicMonitorResources(this /// Monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Monitors resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNewRelicMonitorResourceAsync(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNewRelicMonitorResources().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + return await GetMockableNewRelicObservabilityResourceGroupResource(resourceGroupResource).GetNewRelicMonitorResourceAsync(monitorName, cancellationToken).ConfigureAwait(false); } /// @@ -132,16 +121,20 @@ public static async Task> GetNewRelicMonitorRe /// Monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Monitors resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNewRelicMonitorResource(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNewRelicMonitorResources().Get(monitorName, cancellationToken); + return GetMockableNewRelicObservabilityResourceGroupResource(resourceGroupResource).GetNewRelicMonitorResource(monitorName, cancellationToken); } /// @@ -156,6 +149,10 @@ public static Response GetNewRelicMonitorResource(this /// Accounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// User Email. @@ -165,9 +162,7 @@ public static Response GetNewRelicMonitorResource(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetNewRelicAccountsAsync(this SubscriptionResource subscriptionResource, string userEmail, AzureLocation location, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(userEmail, nameof(userEmail)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNewRelicAccountsAsync(userEmail, location, cancellationToken); + return GetMockableNewRelicObservabilitySubscriptionResource(subscriptionResource).GetNewRelicAccountsAsync(userEmail, location, cancellationToken); } /// @@ -182,6 +177,10 @@ public static AsyncPageable GetNewRelicAccountsAsyn /// Accounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// User Email. @@ -191,9 +190,7 @@ public static AsyncPageable GetNewRelicAccountsAsyn /// A collection of that may take multiple service requests to iterate over. public static Pageable GetNewRelicAccounts(this SubscriptionResource subscriptionResource, string userEmail, AzureLocation location, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(userEmail, nameof(userEmail)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNewRelicAccounts(userEmail, location, cancellationToken); + return GetMockableNewRelicObservabilitySubscriptionResource(subscriptionResource).GetNewRelicAccounts(userEmail, location, cancellationToken); } /// @@ -208,13 +205,17 @@ public static Pageable GetNewRelicAccounts(this Sub /// Monitors_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNewRelicMonitorResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNewRelicMonitorResourcesAsync(cancellationToken); + return GetMockableNewRelicObservabilitySubscriptionResource(subscriptionResource).GetNewRelicMonitorResourcesAsync(cancellationToken); } /// @@ -229,13 +230,17 @@ public static AsyncPageable GetNewRelicMonitorResources /// Monitors_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNewRelicMonitorResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNewRelicMonitorResources(cancellationToken); + return GetMockableNewRelicObservabilitySubscriptionResource(subscriptionResource).GetNewRelicMonitorResources(cancellationToken); } /// @@ -250,6 +255,10 @@ public static Pageable GetNewRelicMonitorResources(this /// Organizations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// User Email. @@ -259,9 +268,7 @@ public static Pageable GetNewRelicMonitorResources(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetNewRelicOrganizationsAsync(this SubscriptionResource subscriptionResource, string userEmail, AzureLocation location, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(userEmail, nameof(userEmail)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNewRelicOrganizationsAsync(userEmail, location, cancellationToken); + return GetMockableNewRelicObservabilitySubscriptionResource(subscriptionResource).GetNewRelicOrganizationsAsync(userEmail, location, cancellationToken); } /// @@ -276,6 +283,10 @@ public static AsyncPageable GetNewRelicOrganiz /// Organizations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// User Email. @@ -285,9 +296,7 @@ public static AsyncPageable GetNewRelicOrganiz /// A collection of that may take multiple service requests to iterate over. public static Pageable GetNewRelicOrganizations(this SubscriptionResource subscriptionResource, string userEmail, AzureLocation location, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(userEmail, nameof(userEmail)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNewRelicOrganizations(userEmail, location, cancellationToken); + return GetMockableNewRelicObservabilitySubscriptionResource(subscriptionResource).GetNewRelicOrganizations(userEmail, location, cancellationToken); } /// @@ -302,6 +311,10 @@ public static Pageable GetNewRelicOrganization /// Plans_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Account Id. @@ -310,7 +323,7 @@ public static Pageable GetNewRelicOrganization /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetNewRelicPlansAsync(this SubscriptionResource subscriptionResource, string accountId = null, string organizationId = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNewRelicPlansAsync(accountId, organizationId, cancellationToken); + return GetMockableNewRelicObservabilitySubscriptionResource(subscriptionResource).GetNewRelicPlansAsync(accountId, organizationId, cancellationToken); } /// @@ -325,6 +338,10 @@ public static AsyncPageable GetNewRelicPlansAsync(this Subscri /// Plans_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Account Id. @@ -333,7 +350,7 @@ public static AsyncPageable GetNewRelicPlansAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetNewRelicPlans(this SubscriptionResource subscriptionResource, string accountId = null, string organizationId = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNewRelicPlans(accountId, organizationId, cancellationToken); + return GetMockableNewRelicObservabilitySubscriptionResource(subscriptionResource).GetNewRelicPlans(accountId, organizationId, cancellationToken); } } } diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index f50e139d51224..0000000000000 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NewRelicObservability -{ - /// 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 NewRelicMonitorResources in the ResourceGroupResource. - /// An object representing collection of NewRelicMonitorResources and their operations over a NewRelicMonitorResource. - public virtual NewRelicMonitorResourceCollection GetNewRelicMonitorResources() - { - return GetCachedClient(Client => new NewRelicMonitorResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 8d314857ef89b..0000000000000 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.NewRelicObservability.Models; - -namespace Azure.ResourceManager.NewRelicObservability -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _accountsClientDiagnostics; - private AccountsRestOperations _accountsRestClient; - private ClientDiagnostics _newRelicMonitorResourceMonitorsClientDiagnostics; - private MonitorsRestOperations _newRelicMonitorResourceMonitorsRestClient; - private ClientDiagnostics _organizationsClientDiagnostics; - private OrganizationsRestOperations _organizationsRestClient; - private ClientDiagnostics _plansClientDiagnostics; - private PlansRestOperations _plansRestClient; - - /// 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 AccountsClientDiagnostics => _accountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NewRelicObservability", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AccountsRestOperations AccountsRestClient => _accountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics NewRelicMonitorResourceMonitorsClientDiagnostics => _newRelicMonitorResourceMonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NewRelicObservability", NewRelicMonitorResource.ResourceType.Namespace, Diagnostics); - private MonitorsRestOperations NewRelicMonitorResourceMonitorsRestClient => _newRelicMonitorResourceMonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NewRelicMonitorResource.ResourceType)); - private ClientDiagnostics OrganizationsClientDiagnostics => _organizationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NewRelicObservability", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OrganizationsRestOperations OrganizationsRestClient => _organizationsRestClient ??= new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PlansClientDiagnostics => _plansClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NewRelicObservability", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PlansRestOperations PlansRestClient => _plansRestClient ??= new PlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the existing accounts - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/accounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// - /// User Email. - /// Location for NewRelic. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNewRelicAccountsAsync(string userEmail, AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AccountsRestClient.CreateListRequest(Id.SubscriptionId, userEmail, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, userEmail, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, NewRelicAccountResourceData.DeserializeNewRelicAccountResourceData, AccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNewRelicAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List all the existing accounts - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/accounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// - /// User Email. - /// Location for NewRelic. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNewRelicAccounts(string userEmail, AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AccountsRestClient.CreateListRequest(Id.SubscriptionId, userEmail, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, userEmail, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, NewRelicAccountResourceData.DeserializeNewRelicAccountResourceData, AccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNewRelicAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List NewRelicMonitorResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/monitors - /// - /// - /// Operation Id - /// Monitors_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNewRelicMonitorResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NewRelicMonitorResourceMonitorsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NewRelicMonitorResourceMonitorsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NewRelicMonitorResource(Client, NewRelicMonitorResourceData.DeserializeNewRelicMonitorResourceData(e)), NewRelicMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNewRelicMonitorResources", "value", "nextLink", cancellationToken); - } - - /// - /// List NewRelicMonitorResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/monitors - /// - /// - /// Operation Id - /// Monitors_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNewRelicMonitorResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NewRelicMonitorResourceMonitorsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NewRelicMonitorResourceMonitorsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NewRelicMonitorResource(Client, NewRelicMonitorResourceData.DeserializeNewRelicMonitorResourceData(e)), NewRelicMonitorResourceMonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNewRelicMonitorResources", "value", "nextLink", cancellationToken); - } - - /// - /// List all the existing organizations - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/organizations - /// - /// - /// Operation Id - /// Organizations_List - /// - /// - /// - /// User Email. - /// Location for NewRelic. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNewRelicOrganizationsAsync(string userEmail, AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OrganizationsRestClient.CreateListRequest(Id.SubscriptionId, userEmail, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrganizationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, userEmail, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, NewRelicOrganizationResourceData.DeserializeNewRelicOrganizationResourceData, OrganizationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNewRelicOrganizations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the existing organizations - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/organizations - /// - /// - /// Operation Id - /// Organizations_List - /// - /// - /// - /// User Email. - /// Location for NewRelic. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNewRelicOrganizations(string userEmail, AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OrganizationsRestClient.CreateListRequest(Id.SubscriptionId, userEmail, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrganizationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, userEmail, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, NewRelicOrganizationResourceData.DeserializeNewRelicOrganizationResourceData, OrganizationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNewRelicOrganizations", "value", "nextLink", cancellationToken); - } - - /// - /// List plans data - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/plans - /// - /// - /// Operation Id - /// Plans_List - /// - /// - /// - /// Account Id. - /// Organization Id. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNewRelicPlansAsync(string accountId = null, string organizationId = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PlansRestClient.CreateListRequest(Id.SubscriptionId, accountId, organizationId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PlansRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, accountId, organizationId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, NewRelicPlanData.DeserializeNewRelicPlanData, PlansClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNewRelicPlans", "value", "nextLink", cancellationToken); - } - - /// - /// List plans data - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/NewRelic.Observability/plans - /// - /// - /// Operation Id - /// Plans_List - /// - /// - /// - /// Account Id. - /// Organization Id. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNewRelicPlans(string accountId = null, string organizationId = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PlansRestClient.CreateListRequest(Id.SubscriptionId, accountId, organizationId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PlansRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, accountId, organizationId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, NewRelicPlanData.DeserializeNewRelicPlanData, PlansClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNewRelicPlans", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResource.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResource.cs index fec613a795ab5..233c6361ce961 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResource.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.NewRelicObservability public partial class NewRelicMonitorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NewRelicObservabilityTagRuleResources and their operations over a NewRelicObservabilityTagRuleResource. public virtual NewRelicObservabilityTagRuleCollection GetNewRelicObservabilityTagRules() { - return GetCachedClient(Client => new NewRelicObservabilityTagRuleCollection(Client, Id)); + return GetCachedClient(client => new NewRelicObservabilityTagRuleCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual NewRelicObservabilityTagRuleCollection GetNewRelicObservabilityTa /// /// Name of the TagRule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNewRelicObservabilityTagRuleAsync(string ruleSetName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetNew /// /// Name of the TagRule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNewRelicObservabilityTagRule(string ruleSetName, CancellationToken cancellationToken = default) { diff --git a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicObservabilityTagRuleResource.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicObservabilityTagRuleResource.cs index 4b054a02332de..f855d78e23cdc 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicObservabilityTagRuleResource.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicObservabilityTagRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.NewRelicObservability public partial class NewRelicObservabilityTagRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. + /// The ruleSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}"; diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/api/Azure.ResourceManager.Nginx.netstandard2.0.cs b/sdk/nginx/Azure.ResourceManager.Nginx/api/Azure.ResourceManager.Nginx.netstandard2.0.cs index 6678a501c066e..741ca29558c6d 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/api/Azure.ResourceManager.Nginx.netstandard2.0.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/api/Azure.ResourceManager.Nginx.netstandard2.0.cs @@ -19,7 +19,7 @@ protected NginxCertificateCollection() { } } public partial class NginxCertificateData : Azure.ResourceManager.Models.TrackedResourceData { - public NginxCertificateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NginxCertificateData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Nginx.Models.NginxCertificateProperties Properties { get { throw null; } set { } } } public partial class NginxCertificateResource : Azure.ResourceManager.ArmResource @@ -61,7 +61,7 @@ protected NginxConfigurationCollection() { } } public partial class NginxConfigurationData : Azure.ResourceManager.Models.TrackedResourceData { - public NginxConfigurationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NginxConfigurationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Nginx.Models.NginxConfigurationProperties Properties { get { throw null; } set { } } } public partial class NginxConfigurationResource : Azure.ResourceManager.ArmResource @@ -103,7 +103,7 @@ protected NginxDeploymentCollection() { } } public partial class NginxDeploymentData : Azure.ResourceManager.Models.TrackedResourceData { - public NginxDeploymentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NginxDeploymentData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Nginx.Models.NginxDeploymentProperties Properties { get { throw null; } set { } } public string SkuName { get { throw null; } set { } } @@ -146,6 +146,29 @@ public static partial class NginxExtensions public static Azure.AsyncPageable GetNginxDeploymentsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Nginx.Mocking +{ + public partial class MockableNginxArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNginxArmClient() { } + public virtual Azure.ResourceManager.Nginx.NginxCertificateResource GetNginxCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Nginx.NginxConfigurationResource GetNginxConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Nginx.NginxDeploymentResource GetNginxDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNginxResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNginxResourceGroupResource() { } + public virtual Azure.Response GetNginxDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNginxDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Nginx.NginxDeploymentCollection GetNginxDeployments() { throw null; } + } + public partial class MockableNginxSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNginxSubscriptionResource() { } + public virtual Azure.Pageable GetNginxDeployments(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNginxDeploymentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Nginx.Models { public static partial class ArmNginxModelFactory diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxArmClient.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxArmClient.cs new file mode 100644 index 0000000000000..70a32c10106de --- /dev/null +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Nginx; + +namespace Azure.ResourceManager.Nginx.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNginxArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNginxArmClient() + { + } + + /// 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 MockableNginxArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNginxArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NginxCertificateResource GetNginxCertificateResource(ResourceIdentifier id) + { + NginxCertificateResource.ValidateResourceId(id); + return new NginxCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NginxConfigurationResource GetNginxConfigurationResource(ResourceIdentifier id) + { + NginxConfigurationResource.ValidateResourceId(id); + return new NginxConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NginxDeploymentResource GetNginxDeploymentResource(ResourceIdentifier id) + { + NginxDeploymentResource.ValidateResourceId(id); + return new NginxDeploymentResource(Client, id); + } + } +} diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxResourceGroupResource.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxResourceGroupResource.cs new file mode 100644 index 0000000000000..1889c85113ef4 --- /dev/null +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Nginx; + +namespace Azure.ResourceManager.Nginx.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNginxResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNginxResourceGroupResource() + { + } + + /// 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 MockableNginxResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NginxDeploymentResources in the ResourceGroupResource. + /// An object representing collection of NginxDeploymentResources and their operations over a NginxDeploymentResource. + public virtual NginxDeploymentCollection GetNginxDeployments() + { + return GetCachedClient(client => new NginxDeploymentCollection(client, Id)); + } + + /// + /// Get the Nginx deployment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The name of targeted Nginx deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNginxDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetNginxDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the Nginx deployment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The name of targeted Nginx deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNginxDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetNginxDeployments().Get(deploymentName, cancellationToken); + } + } +} diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxSubscriptionResource.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxSubscriptionResource.cs new file mode 100644 index 0000000000000..aced2a0cbce8c --- /dev/null +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/MockableNginxSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Nginx; + +namespace Azure.ResourceManager.Nginx.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNginxSubscriptionResource : ArmResource + { + private ClientDiagnostics _nginxDeploymentDeploymentsClientDiagnostics; + private DeploymentsRestOperations _nginxDeploymentDeploymentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNginxSubscriptionResource() + { + } + + /// 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 MockableNginxSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics NginxDeploymentDeploymentsClientDiagnostics => _nginxDeploymentDeploymentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Nginx", NginxDeploymentResource.ResourceType.Namespace, Diagnostics); + private DeploymentsRestOperations NginxDeploymentDeploymentsRestClient => _nginxDeploymentDeploymentsRestClient ??= new DeploymentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NginxDeploymentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List the Nginx deployments resources + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments + /// + /// + /// Operation Id + /// Deployments_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNginxDeploymentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NginxDeploymentDeploymentsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NginxDeploymentDeploymentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NginxDeploymentResource(Client, NginxDeploymentData.DeserializeNginxDeploymentData(e)), NginxDeploymentDeploymentsClientDiagnostics, Pipeline, "MockableNginxSubscriptionResource.GetNginxDeployments", "value", "nextLink", cancellationToken); + } + + /// + /// List the Nginx deployments resources + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments + /// + /// + /// Operation Id + /// Deployments_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNginxDeployments(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NginxDeploymentDeploymentsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NginxDeploymentDeploymentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NginxDeploymentResource(Client, NginxDeploymentData.DeserializeNginxDeploymentData(e)), NginxDeploymentDeploymentsClientDiagnostics, Pipeline, "MockableNginxSubscriptionResource.GetNginxDeployments", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/NginxExtensions.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/NginxExtensions.cs index 0bd9e7839fa4f..8850c42e60002 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/NginxExtensions.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/NginxExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Nginx.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Nginx @@ -18,100 +19,81 @@ namespace Azure.ResourceManager.Nginx /// A class to add extension methods to Azure.ResourceManager.Nginx. public static partial class NginxExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableNginxArmClient GetMockableNginxArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableNginxArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNginxResourceGroupResource GetMockableNginxResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNginxResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableNginxSubscriptionResource GetMockableNginxSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableNginxSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region NginxCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NginxCertificateResource GetNginxCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NginxCertificateResource.ValidateResourceId(id); - return new NginxCertificateResource(client, id); - } - ); + return GetMockableNginxArmClient(client).GetNginxCertificateResource(id); } - #endregion - #region NginxConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NginxConfigurationResource GetNginxConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NginxConfigurationResource.ValidateResourceId(id); - return new NginxConfigurationResource(client, id); - } - ); + return GetMockableNginxArmClient(client).GetNginxConfigurationResource(id); } - #endregion - #region NginxDeploymentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NginxDeploymentResource GetNginxDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NginxDeploymentResource.ValidateResourceId(id); - return new NginxDeploymentResource(client, id); - } - ); + return GetMockableNginxArmClient(client).GetNginxDeploymentResource(id); } - #endregion - /// Gets a collection of NginxDeploymentResources in the ResourceGroupResource. + /// + /// Gets a collection of NginxDeploymentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NginxDeploymentResources and their operations over a NginxDeploymentResource. public static NginxDeploymentCollection GetNginxDeployments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNginxDeployments(); + return GetMockableNginxResourceGroupResource(resourceGroupResource).GetNginxDeployments(); } /// @@ -126,16 +108,20 @@ public static NginxDeploymentCollection GetNginxDeployments(this ResourceGroupRe /// Deployments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of targeted Nginx deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNginxDeploymentAsync(this ResourceGroupResource resourceGroupResource, string deploymentName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNginxDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + return await GetMockableNginxResourceGroupResource(resourceGroupResource).GetNginxDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); } /// @@ -150,16 +136,20 @@ public static async Task> GetNginxDeploymentAs /// Deployments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of targeted Nginx deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNginxDeployment(this ResourceGroupResource resourceGroupResource, string deploymentName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNginxDeployments().Get(deploymentName, cancellationToken); + return GetMockableNginxResourceGroupResource(resourceGroupResource).GetNginxDeployment(deploymentName, cancellationToken); } /// @@ -174,13 +164,17 @@ public static Response GetNginxDeployment(this Resource /// Deployments_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNginxDeploymentsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNginxDeploymentsAsync(cancellationToken); + return GetMockableNginxSubscriptionResource(subscriptionResource).GetNginxDeploymentsAsync(cancellationToken); } /// @@ -195,13 +189,17 @@ public static AsyncPageable GetNginxDeploymentsAsync(th /// Deployments_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNginxDeployments(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNginxDeployments(cancellationToken); + return GetMockableNginxSubscriptionResource(subscriptionResource).GetNginxDeployments(cancellationToken); } } } diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3bdaae57228b4..0000000000000 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Nginx -{ - /// 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 NginxDeploymentResources in the ResourceGroupResource. - /// An object representing collection of NginxDeploymentResources and their operations over a NginxDeploymentResource. - public virtual NginxDeploymentCollection GetNginxDeployments() - { - return GetCachedClient(Client => new NginxDeploymentCollection(Client, Id)); - } - } -} diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 6e2b42c2587ac..0000000000000 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Nginx -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _nginxDeploymentDeploymentsClientDiagnostics; - private DeploymentsRestOperations _nginxDeploymentDeploymentsRestClient; - - /// 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 NginxDeploymentDeploymentsClientDiagnostics => _nginxDeploymentDeploymentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Nginx", NginxDeploymentResource.ResourceType.Namespace, Diagnostics); - private DeploymentsRestOperations NginxDeploymentDeploymentsRestClient => _nginxDeploymentDeploymentsRestClient ??= new DeploymentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NginxDeploymentResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List the Nginx deployments resources - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments - /// - /// - /// Operation Id - /// Deployments_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNginxDeploymentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NginxDeploymentDeploymentsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NginxDeploymentDeploymentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NginxDeploymentResource(Client, NginxDeploymentData.DeserializeNginxDeploymentData(e)), NginxDeploymentDeploymentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNginxDeployments", "value", "nextLink", cancellationToken); - } - - /// - /// List the Nginx deployments resources - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Nginx.NginxPlus/nginxDeployments - /// - /// - /// Operation Id - /// Deployments_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNginxDeployments(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NginxDeploymentDeploymentsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NginxDeploymentDeploymentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NginxDeploymentResource(Client, NginxDeploymentData.DeserializeNginxDeploymentData(e)), NginxDeploymentDeploymentsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNginxDeployments", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxCertificateResource.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxCertificateResource.cs index 991f3a44fa641..fe8137a02763f 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxCertificateResource.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxCertificateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Nginx public partial class NginxCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deploymentName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deploymentName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}"; diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxConfigurationResource.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxConfigurationResource.cs index 938030ae202ee..857d3068d679f 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxConfigurationResource.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxConfigurationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Nginx public partial class NginxConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deploymentName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deploymentName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}"; diff --git a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentResource.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentResource.cs index 42f4795d0cd58..2335854dd1aef 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentResource.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Nginx public partial class NginxDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The deploymentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string deploymentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NginxCertificateResources and their operations over a NginxCertificateResource. public virtual NginxCertificateCollection GetNginxCertificates() { - return GetCachedClient(Client => new NginxCertificateCollection(Client, Id)); + return GetCachedClient(client => new NginxCertificateCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual NginxCertificateCollection GetNginxCertificates() /// /// The name of certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNginxCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetNginxCertificat /// /// The name of certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNginxCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetNginxCertificate(string cer /// An object representing collection of NginxConfigurationResources and their operations over a NginxConfigurationResource. public virtual NginxConfigurationCollection GetNginxConfigurations() { - return GetCachedClient(Client => new NginxConfigurationCollection(Client, Id)); + return GetCachedClient(client => new NginxConfigurationCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual NginxConfigurationCollection GetNginxConfigurations() /// /// The name of configuration, only 'default' is supported value due to the singleton of Nginx conf. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNginxConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetNginxConfigur /// /// The name of configuration, only 'default' is supported value due to the singleton of Nginx conf. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNginxConfiguration(string configurationName, CancellationToken cancellationToken = default) { diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/api/Azure.ResourceManager.NotificationHubs.netstandard2.0.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/api/Azure.ResourceManager.NotificationHubs.netstandard2.0.cs index ea81ddd0b12f2..c06c36beebcad 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/api/Azure.ResourceManager.NotificationHubs.netstandard2.0.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/api/Azure.ResourceManager.NotificationHubs.netstandard2.0.cs @@ -19,7 +19,7 @@ protected NotificationHubAuthorizationRuleCollection() { } } public partial class NotificationHubAuthorizationRuleData : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubAuthorizationRuleData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubAuthorizationRuleData(Azure.Core.AzureLocation location) { } public string ClaimType { get { throw null; } } public string ClaimValue { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } @@ -68,7 +68,7 @@ protected NotificationHubCollection() { } } public partial class NotificationHubData : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubAdmCredential AdmCredential { get { throw null; } set { } } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubApnsCredential ApnsCredential { get { throw null; } set { } } public System.Collections.Generic.IList AuthorizationRules { get { throw null; } } @@ -134,7 +134,7 @@ protected NotificationHubNamespaceCollection() { } } public partial class NotificationHubNamespaceData : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubNamespaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubNamespaceData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } set { } } public string DataCenter { get { throw null; } set { } } public bool? IsCritical { get { throw null; } set { } } @@ -221,6 +221,32 @@ public static partial class NotificationHubsExtensions public static Azure.ResourceManager.NotificationHubs.NotificationHubResource GetNotificationHubResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } } +namespace Azure.ResourceManager.NotificationHubs.Mocking +{ + public partial class MockableNotificationHubsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNotificationHubsArmClient() { } + public virtual Azure.ResourceManager.NotificationHubs.NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NotificationHubs.NotificationHubNamespaceAuthorizationRuleResource GetNotificationHubNamespaceAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NotificationHubs.NotificationHubNamespaceResource GetNotificationHubNamespaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.NotificationHubs.NotificationHubResource GetNotificationHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNotificationHubsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNotificationHubsResourceGroupResource() { } + public virtual Azure.Response GetNotificationHubNamespace(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNotificationHubNamespaceAsync(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NotificationHubs.NotificationHubNamespaceCollection GetNotificationHubNamespaces() { throw null; } + } + public partial class MockableNotificationHubsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNotificationHubsSubscriptionResource() { } + public virtual Azure.Response CheckNotificationHubNamespaceAvailability(Azure.ResourceManager.NotificationHubs.Models.NotificationHubAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNotificationHubNamespaceAvailabilityAsync(Azure.ResourceManager.NotificationHubs.Models.NotificationHubAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetNotificationHubNamespaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNotificationHubNamespacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.NotificationHubs.Models { public static partial class ArmNotificationHubsModelFactory @@ -267,13 +293,13 @@ public NotificationHubApnsCredential() { } } public partial class NotificationHubAvailabilityContent : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubAvailabilityContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubAvailabilityContent(Azure.Core.AzureLocation location) { } public bool? IsAvailiable { get { throw null; } set { } } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubSku Sku { get { throw null; } set { } } } public partial class NotificationHubAvailabilityResult : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubAvailabilityResult(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubAvailabilityResult(Azure.Core.AzureLocation location) { } public bool? IsAvailiable { get { throw null; } set { } } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubSku Sku { get { throw null; } set { } } } @@ -286,7 +312,7 @@ public NotificationHubBaiduCredential() { } } public partial class NotificationHubCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubCreateOrUpdateContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubCreateOrUpdateContent(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubAdmCredential AdmCredential { get { throw null; } set { } } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubApnsCredential ApnsCredential { get { throw null; } set { } } public System.Collections.Generic.IList AuthorizationRules { get { throw null; } } @@ -316,7 +342,7 @@ public NotificationHubMpnsCredential() { } } public partial class NotificationHubNamespaceCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubNamespaceCreateOrUpdateContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubNamespaceCreateOrUpdateContent(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } set { } } public string DataCenter { get { throw null; } set { } } public bool? IsCritical { get { throw null; } set { } } @@ -346,7 +372,7 @@ public enum NotificationHubNamespaceType } public partial class NotificationHubPatch : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubPatch(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubAdmCredential AdmCredential { get { throw null; } set { } } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubApnsCredential ApnsCredential { get { throw null; } set { } } public System.Collections.Generic.IList AuthorizationRules { get { throw null; } } @@ -360,7 +386,7 @@ public NotificationHubPatch(Azure.Core.AzureLocation location) : base (default(A } public partial class NotificationHubPnsCredentials : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubPnsCredentials(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubPnsCredentials(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubAdmCredential AdmCredential { get { throw null; } set { } } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubApnsCredential ApnsCredential { get { throw null; } set { } } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubBaiduCredential BaiduCredential { get { throw null; } set { } } @@ -413,7 +439,7 @@ public NotificationHubSku(Azure.ResourceManager.NotificationHubs.Models.Notifica } public partial class NotificationHubTestSendResult : Azure.ResourceManager.Models.TrackedResourceData { - public NotificationHubTestSendResult(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public NotificationHubTestSendResult(Azure.Core.AzureLocation location) { } public int? Failure { get { throw null; } set { } } public System.BinaryData Results { get { throw null; } set { } } public Azure.ResourceManager.NotificationHubs.Models.NotificationHubSku Sku { get { throw null; } set { } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs new file mode 100644 index 0000000000000..e1c8a0e4aa949 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNotificationHubsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNotificationHubsArmClient() + { + } + + /// 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 MockableNotificationHubsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNotificationHubsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NotificationHubNamespaceResource GetNotificationHubNamespaceResource(ResourceIdentifier id) + { + NotificationHubNamespaceResource.ValidateResourceId(id); + return new NotificationHubNamespaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NotificationHubNamespaceAuthorizationRuleResource GetNotificationHubNamespaceAuthorizationRuleResource(ResourceIdentifier id) + { + NotificationHubNamespaceAuthorizationRuleResource.ValidateResourceId(id); + return new NotificationHubNamespaceAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(ResourceIdentifier id) + { + NotificationHubAuthorizationRuleResource.ValidateResourceId(id); + return new NotificationHubAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NotificationHubResource GetNotificationHubResource(ResourceIdentifier id) + { + NotificationHubResource.ValidateResourceId(id); + return new NotificationHubResource(Client, id); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsResourceGroupResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsResourceGroupResource.cs new file mode 100644 index 0000000000000..55940c8117c83 --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.NotificationHubs; + +namespace Azure.ResourceManager.NotificationHubs.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNotificationHubsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNotificationHubsResourceGroupResource() + { + } + + /// 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 MockableNotificationHubsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NotificationHubNamespaceResources in the ResourceGroupResource. + /// An object representing collection of NotificationHubNamespaceResources and their operations over a NotificationHubNamespaceResource. + public virtual NotificationHubNamespaceCollection GetNotificationHubNamespaces() + { + return GetCachedClient(client => new NotificationHubNamespaceCollection(client, Id)); + } + + /// + /// Returns the description for the specified namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNotificationHubNamespaceAsync(string namespaceName, CancellationToken cancellationToken = default) + { + return await GetNotificationHubNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the description for the specified namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNotificationHubNamespace(string namespaceName, CancellationToken cancellationToken = default) + { + return GetNotificationHubNamespaces().Get(namespaceName, cancellationToken); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs new file mode 100644 index 0000000000000..926111724845d --- /dev/null +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsSubscriptionResource.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs; +using Azure.ResourceManager.NotificationHubs.Models; + +namespace Azure.ResourceManager.NotificationHubs.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNotificationHubsSubscriptionResource : ArmResource + { + private ClientDiagnostics _notificationHubNamespaceNamespacesClientDiagnostics; + private NamespacesRestOperations _notificationHubNamespaceNamespacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNotificationHubsSubscriptionResource() + { + } + + /// 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 MockableNotificationHubsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics NotificationHubNamespaceNamespacesClientDiagnostics => _notificationHubNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", NotificationHubNamespaceResource.ResourceType.Namespace, Diagnostics); + private NamespacesRestOperations NotificationHubNamespaceNamespacesRestClient => _notificationHubNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NotificationHubNamespaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks the availability of the given service namespace across all Azure subscriptions. This is useful because the domain name is created based on the service namespace name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability + /// + /// + /// Operation Id + /// Namespaces_CheckAvailability + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNotificationHubNamespaceAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NotificationHubNamespaceNamespacesClientDiagnostics.CreateScope("MockableNotificationHubsSubscriptionResource.CheckNotificationHubNamespaceAvailability"); + scope.Start(); + try + { + var response = await NotificationHubNamespaceNamespacesRestClient.CheckAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks the availability of the given service namespace across all Azure subscriptions. This is useful because the domain name is created based on the service namespace name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability + /// + /// + /// Operation Id + /// Namespaces_CheckAvailability + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNotificationHubNamespaceAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NotificationHubNamespaceNamespacesClientDiagnostics.CreateScope("MockableNotificationHubsSubscriptionResource.CheckNotificationHubNamespaceAvailability"); + scope.Start(); + try + { + var response = NotificationHubNamespaceNamespacesRestClient.CheckAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListAll + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNotificationHubNamespacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NotificationHubNamespaceNamespacesRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NotificationHubNamespaceNamespacesRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceResource(Client, NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(e)), NotificationHubNamespaceNamespacesClientDiagnostics, Pipeline, "MockableNotificationHubsSubscriptionResource.GetNotificationHubNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces + /// + /// + /// Operation Id + /// Namespaces_ListAll + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNotificationHubNamespaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NotificationHubNamespaceNamespacesRestClient.CreateListAllRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NotificationHubNamespaceNamespacesRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceResource(Client, NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(e)), NotificationHubNamespaceNamespacesClientDiagnostics, Pipeline, "MockableNotificationHubsSubscriptionResource.GetNotificationHubNamespaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs index abb488051ec2f..cfab41ee8ce08 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/NotificationHubsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.NotificationHubs.Mocking; using Azure.ResourceManager.NotificationHubs.Models; using Azure.ResourceManager.Resources; @@ -19,119 +20,97 @@ namespace Azure.ResourceManager.NotificationHubs /// A class to add extension methods to Azure.ResourceManager.NotificationHubs. public static partial class NotificationHubsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableNotificationHubsArmClient GetMockableNotificationHubsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableNotificationHubsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableNotificationHubsResourceGroupResource GetMockableNotificationHubsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableNotificationHubsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableNotificationHubsSubscriptionResource GetMockableNotificationHubsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableNotificationHubsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region NotificationHubNamespaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NotificationHubNamespaceResource GetNotificationHubNamespaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NotificationHubNamespaceResource.ValidateResourceId(id); - return new NotificationHubNamespaceResource(client, id); - } - ); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceResource(id); } - #endregion - #region NotificationHubNamespaceAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NotificationHubNamespaceAuthorizationRuleResource GetNotificationHubNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NotificationHubNamespaceAuthorizationRuleResource.ValidateResourceId(id); - return new NotificationHubNamespaceAuthorizationRuleResource(client, id); - } - ); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubNamespaceAuthorizationRuleResource(id); } - #endregion - #region NotificationHubAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NotificationHubAuthorizationRuleResource GetNotificationHubAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NotificationHubAuthorizationRuleResource.ValidateResourceId(id); - return new NotificationHubAuthorizationRuleResource(client, id); - } - ); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubAuthorizationRuleResource(id); } - #endregion - #region NotificationHubResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NotificationHubResource GetNotificationHubResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NotificationHubResource.ValidateResourceId(id); - return new NotificationHubResource(client, id); - } - ); + return GetMockableNotificationHubsArmClient(client).GetNotificationHubResource(id); } - #endregion - /// Gets a collection of NotificationHubNamespaceResources in the ResourceGroupResource. + /// + /// Gets a collection of NotificationHubNamespaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of NotificationHubNamespaceResources and their operations over a NotificationHubNamespaceResource. public static NotificationHubNamespaceCollection GetNotificationHubNamespaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetNotificationHubNamespaces(); + return GetMockableNotificationHubsResourceGroupResource(resourceGroupResource).GetNotificationHubNamespaces(); } /// @@ -146,16 +125,20 @@ public static NotificationHubNamespaceCollection GetNotificationHubNamespaces(th /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetNotificationHubNamespaceAsync(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetNotificationHubNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableNotificationHubsResourceGroupResource(resourceGroupResource).GetNotificationHubNamespaceAsync(namespaceName, cancellationToken).ConfigureAwait(false); } /// @@ -170,16 +153,20 @@ public static async Task> GetNotifica /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetNotificationHubNamespace(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetNotificationHubNamespaces().Get(namespaceName, cancellationToken); + return GetMockableNotificationHubsResourceGroupResource(resourceGroupResource).GetNotificationHubNamespace(namespaceName, cancellationToken); } /// @@ -194,6 +181,10 @@ public static Response GetNotificationHubNames /// Namespaces_CheckAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace name. @@ -201,9 +192,7 @@ public static Response GetNotificationHubNames /// is null. public static async Task> CheckNotificationHubNamespaceAvailabilityAsync(this SubscriptionResource subscriptionResource, NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNotificationHubNamespaceAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableNotificationHubsSubscriptionResource(subscriptionResource).CheckNotificationHubNamespaceAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -218,6 +207,10 @@ public static async Task> CheckNotif /// Namespaces_CheckAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace name. @@ -225,9 +218,7 @@ public static async Task> CheckNotif /// is null. public static Response CheckNotificationHubNamespaceAvailability(this SubscriptionResource subscriptionResource, NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNotificationHubNamespaceAvailability(content, cancellationToken); + return GetMockableNotificationHubsSubscriptionResource(subscriptionResource).CheckNotificationHubNamespaceAvailability(content, cancellationToken); } /// @@ -242,13 +233,17 @@ public static Response CheckNotificationHubNa /// Namespaces_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNotificationHubNamespacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNotificationHubNamespacesAsync(cancellationToken); + return GetMockableNotificationHubsSubscriptionResource(subscriptionResource).GetNotificationHubNamespacesAsync(cancellationToken); } /// @@ -263,13 +258,17 @@ public static AsyncPageable GetNotificationHub /// Namespaces_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetNotificationHubNamespaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetNotificationHubNamespaces(cancellationToken); + return GetMockableNotificationHubsSubscriptionResource(subscriptionResource).GetNotificationHubNamespaces(cancellationToken); } } } diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 6ed679de8b08f..0000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.NotificationHubs -{ - /// 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 NotificationHubNamespaceResources in the ResourceGroupResource. - /// An object representing collection of NotificationHubNamespaceResources and their operations over a NotificationHubNamespaceResource. - public virtual NotificationHubNamespaceCollection GetNotificationHubNamespaces() - { - return GetCachedClient(Client => new NotificationHubNamespaceCollection(Client, Id)); - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d7306a039ab70..0000000000000 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.NotificationHubs.Models; - -namespace Azure.ResourceManager.NotificationHubs -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _notificationHubNamespaceNamespacesClientDiagnostics; - private NamespacesRestOperations _notificationHubNamespaceNamespacesRestClient; - - /// 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 NotificationHubNamespaceNamespacesClientDiagnostics => _notificationHubNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NotificationHubs", NotificationHubNamespaceResource.ResourceType.Namespace, Diagnostics); - private NamespacesRestOperations NotificationHubNamespaceNamespacesRestClient => _notificationHubNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NotificationHubNamespaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks the availability of the given service namespace across all Azure subscriptions. This is useful because the domain name is created based on the service namespace name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability - /// - /// - /// Operation Id - /// Namespaces_CheckAvailability - /// - /// - /// - /// The namespace name. - /// The cancellation token to use. - public virtual async Task> CheckNotificationHubNamespaceAvailabilityAsync(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NotificationHubNamespaceNamespacesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNotificationHubNamespaceAvailability"); - scope.Start(); - try - { - var response = await NotificationHubNamespaceNamespacesRestClient.CheckAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks the availability of the given service namespace across all Azure subscriptions. This is useful because the domain name is created based on the service namespace name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability - /// - /// - /// Operation Id - /// Namespaces_CheckAvailability - /// - /// - /// - /// The namespace name. - /// The cancellation token to use. - public virtual Response CheckNotificationHubNamespaceAvailability(NotificationHubAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NotificationHubNamespaceNamespacesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNotificationHubNamespaceAvailability"); - scope.Start(); - try - { - var response = NotificationHubNamespaceNamespacesRestClient.CheckAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces - /// - /// - /// Operation Id - /// Namespaces_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNotificationHubNamespacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NotificationHubNamespaceNamespacesRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NotificationHubNamespaceNamespacesRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceResource(Client, NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(e)), NotificationHubNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNotificationHubNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the available namespaces within the subscription irrespective of the resourceGroups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces - /// - /// - /// Operation Id - /// Namespaces_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNotificationHubNamespaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NotificationHubNamespaceNamespacesRestClient.CreateListAllRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NotificationHubNamespaceNamespacesRestClient.CreateListAllNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NotificationHubNamespaceResource(Client, NotificationHubNamespaceData.DeserializeNotificationHubNamespaceData(e)), NotificationHubNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetNotificationHubNamespaces", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs index 5041315666fa6..64878c5c16cb5 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubAuthorizationRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.NotificationHubs public partial class NotificationHubAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The notificationHubName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}"; diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs index 8413ab3f45908..bd07d55034a95 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceAuthorizationRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.NotificationHubs public partial class NotificationHubNamespaceAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"; diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs index 65dbf24a50c4e..916d05ed7c914 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.NotificationHubs public partial class NotificationHubNamespaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}"; @@ -97,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NotificationHubNamespaceAuthorizationRuleResources and their operations over a NotificationHubNamespaceAuthorizationRuleResource. public virtual NotificationHubNamespaceAuthorizationRuleCollection GetNotificationHubNamespaceAuthorizationRules() { - return GetCachedClient(Client => new NotificationHubNamespaceAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new NotificationHubNamespaceAuthorizationRuleCollection(client, Id)); } /// @@ -115,8 +118,8 @@ public virtual NotificationHubNamespaceAuthorizationRuleCollection GetNotificati /// /// Authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNotificationHubNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -138,8 +141,8 @@ public virtual async Task /// Authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNotificationHubNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -150,7 +153,7 @@ public virtual Response GetNo /// An object representing collection of NotificationHubResources and their operations over a NotificationHubResource. public virtual NotificationHubCollection GetNotificationHubs() { - return GetCachedClient(Client => new NotificationHubCollection(Client, Id)); + return GetCachedClient(client => new NotificationHubCollection(client, Id)); } /// @@ -168,8 +171,8 @@ public virtual NotificationHubCollection GetNotificationHubs() /// /// The notification hub name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNotificationHubAsync(string notificationHubName, CancellationToken cancellationToken = default) { @@ -191,8 +194,8 @@ public virtual async Task> GetNotificationHubA /// /// The notification hub name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNotificationHub(string notificationHubName, CancellationToken cancellationToken = default) { diff --git a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs index f0b407adc62eb..4ebe34e5d200c 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.NotificationHubs public partial class NotificationHubResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The notificationHubName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string notificationHubName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of NotificationHubAuthorizationRuleResources and their operations over a NotificationHubAuthorizationRuleResource. public virtual NotificationHubAuthorizationRuleCollection GetNotificationHubAuthorizationRules() { - return GetCachedClient(Client => new NotificationHubAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new NotificationHubAuthorizationRuleCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual NotificationHubAuthorizationRuleCollection GetNotificationHubAuth /// /// authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNotificationHubAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> Ge /// /// authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNotificationHubAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md b/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md index fd55414684f89..e07f36f9f9873 100644 --- a/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md +++ b/sdk/openai/Azure.AI.OpenAI/CHANGELOG.md @@ -6,6 +6,85 @@ ### Breaking Changes +This update includes a number of version-to-version breaking changes to the API. + +#### Streaming for completions and chat completions + +Streaming Completions and Streaming Chat Completions have been significantly updated to use simpler, shallower usage +patterns and data representations. The goal of these changes is to make streaming much easier to consume in common +cases while still retaining full functionality in more complex ones (e.g. with multiple choices requested). +- A new `StreamingResponse` type is introduced that implicitly exposes an `IAsyncEnumerable` derived from + the underlying response. +- `OpenAI.GetCompletionsStreaming()` now returns a `StreamingResponse` that may be directly + enumerated over. `StreamingCompletions`, `StreamingChoice`, and the corresponding methods are removed. +- Because Chat Completions use a distinct structure for their streaming response messages, a new + `StreamingChatCompletionsUpdate` type is introduced that encapsulates this update data. +- Correspondingly, `OpenAI.GetChatCompletionsStreaming()` now returns a + `StreamingResponse` that may be enumerated over directly. + `StreamingChatCompletions`, `StreamingChatChoice`, and related methods are removed. +- For more information, please see + [the related pull request description](https://github.com/Azure/azure-sdk-for-net/pull/39347) as well as the + updated snippets in the project README. + +#### `deploymentOrModelName` moved to `*Options.DeploymentName` + +`deploymentOrModelName` and related method parameters on `OpenAIClient` have been moved to `DeploymentName` +properties in the corresponding method options. This is intended to promote consistency across scenario, +language, and Azure/non-Azure OpenAI use. + +As an example, the following: + +```csharp +ChatCompletionsOptions chatCompletionsOptions = new() +{ + Messages = { new(ChatRole.User, "Hello, assistant!") }, +}; +Response response = client.GetChatCompletions("gpt-4", chatCompletionsOptions); +``` + +...is now re-written as: + +```csharp +ChatCompletionsOptions chatCompletionsOptions = new() +{ + DeploymentName = "gpt-4", + Messages = { new(ChatRole.User, "Hello, assistant!") }, +}; +Response response = client.GetChatCompletions(chatCompletionsOptions); +``` + +#### Consistency in complex method options type constructors + +With the migration of `DeploymentName` into method complex options types, these options types have now been snapped to +follow a common pattern: each complex options type will feature a default constructor that allows `init`-style setting +of properties as well as a single additional constructor that accepts *all* required parameters for the corresponding +method. Existing constructors that no longer meet that "all" requirement, including those impacted by the addition of +`DeploymentName`, have been removed. The "convenience" constructors that represented required parameter data +differently -- for example, `EmbeddingsOptions(string)`, have also been removed in favor of the consistent "set of +directly provide" choice. + +More exhaustively, *removed* are: + +- `AudioTranscriptionOptions(BinaryData)` +- `AudioTranslationOptions(BinaryData)` +- `ChatCompletionsOptions(IEnumerable)` +- `CompletionsOptions(IEnumerable)` +- `EmbeddingsOptions(string)` +- `EmbeddingsOptions(IEnumerable)` + +And *added* as replacements are: + +- `AudioTranscriptionOptions(string, BinaryData)` +- `AudioTranslationOptions(string, BinaryData)` +- `ChatCompletionsOptions(string, IEnumerable)` +- `CompletionsOptions(string, IEnumerable)` +- `EmbeddingsOptions(string, IEnumerable)` + +#### Embeddings + +To align representations of embeddings across Azure AI, the `Embeddings` type has been updated to use +`ReadOnlyMemory` instead of `IReadOnlyList`. + ### Bugs Fixed ### Other Changes diff --git a/sdk/openai/Azure.AI.OpenAI/README.md b/sdk/openai/Azure.AI.OpenAI/README.md index 7c296debd4bee..646a327e73513 100644 --- a/sdk/openai/Azure.AI.OpenAI/README.md +++ b/sdk/openai/Azure.AI.OpenAI/README.md @@ -74,9 +74,11 @@ OpenAIClient client = useAzureOpenAI new AzureKeyCredential("your-azure-openai-resource-api-key")) : new OpenAIClient("your-api-key-from-platform.openai.com"); -Response response = await client.GetCompletionsAsync( - "text-davinci-003", // assumes a matching model deployment or model name - "Hello, world!"); +Response response = await client.GetCompletionsAsync(new CompletionsOptions() +{ + DeploymentName = "text-davinci-003", // assumes a matching model deployment or model name + Prompts = { "Hello, world!" }, +}); foreach (Choice choice in response.Value.Choices) { @@ -103,7 +105,7 @@ We guarantee that all client instance methods are thread-safe and independent of You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/openai/Azure.AI.OpenAI/tests/Samples). -### Generate Chatbot Response +### Generate chatbot response The `GenerateChatbotResponse` method authenticates using a DefaultAzureCredential, then generates text responses to input prompts. @@ -111,16 +113,18 @@ The `GenerateChatbotResponse` method authenticates using a DefaultAzureCredentia string endpoint = "https://myaccount.openai.azure.com/"; var client = new OpenAIClient(new Uri(endpoint), new DefaultAzureCredential()); -string deploymentName = "text-davinci-003"; -string prompt = "What is Azure OpenAI?"; -Console.Write($"Input: {prompt}"); +CompletionsOptions completionsOptions = new() +{ + DeploymentName = "text-davinci-003", + Prompts = { "What is Azure OpenAI?" }, +}; -Response completionsResponse = client.GetCompletions(deploymentName, prompt); +Response completionsResponse = client.GetCompletions(completionsOptions); string completion = completionsResponse.Value.Choices[0].Text; Console.WriteLine($"Chatbot: {completion}"); ``` -### Generate Multiple Chatbot Responses With Subscription Key +### Generate multiple chatbot responses with subscription key The `GenerateMultipleChatbotResponsesWithSubscriptionKey` method gives an example of generating text responses to input prompts using an Azure subscription key @@ -130,29 +134,28 @@ string key = "YOUR_AZURE_OPENAI_KEY"; string endpoint = "https://myaccount.openai.azure.com/"; var client = new OpenAIClient(new Uri(endpoint), new AzureKeyCredential(key)); -List examplePrompts = new(){ - "How are you today?", - "What is Azure OpenAI?", - "Why do children love dinosaurs?", - "Generate a proof of Euler's identity", - "Describe in single words only the good things that come into your mind about your mother.", +CompletionsOptions completionsOptions = new() +{ + DeploymentName = "text-davinci-003", + Prompts = + { + "How are you today?", + "What is Azure OpenAI?", + "Why do children love dinosaurs?", + "Generate a proof of Euler's identity", + "Describe in single words only the good things that come into your mind about your mother." + }, }; -string deploymentName = "text-davinci-003"; +Response completionsResponse = client.GetCompletions(completionsOptions); -foreach (string prompt in examplePrompts) +foreach (Choice choice in completionsResponse.Value.Choices) { - Console.Write($"Input: {prompt}"); - CompletionsOptions completionsOptions = new CompletionsOptions(); - completionsOptions.Prompts.Add(prompt); - - Response completionsResponse = client.GetCompletions(deploymentName, completionsOptions); - string completion = completionsResponse.Value.Choices[0].Text; - Console.WriteLine($"Chatbot: {completion}"); + Console.WriteLine($"Response for prompt {choice.Index}: {choice.Text}"); } ``` -### Summarize Text with Completion +### Summarize text with completion The `SummarizeText` method generates a summarization of the given input prompt. @@ -180,23 +183,23 @@ string summarizationPrompt = @$" Console.Write($"Input: {summarizationPrompt}"); var completionsOptions = new CompletionsOptions() { + DeploymentName = "text-davinci-003", Prompts = { summarizationPrompt }, }; -string deploymentName = "text-davinci-003"; - -Response completionsResponse = client.GetCompletions(deploymentName, completionsOptions); +Response completionsResponse = client.GetCompletions(completionsOptions); string completion = completionsResponse.Value.Choices[0].Text; Console.WriteLine($"Summarization: {completion}"); ``` -### Stream Chat Messages with non-Azure OpenAI +### Stream chat messages with non-Azure OpenAI ```C# Snippet:StreamChatMessages string nonAzureOpenAIApiKey = "your-api-key-from-platform.openai.com"; var client = new OpenAIClient(nonAzureOpenAIApiKey, new OpenAIClientOptions()); var chatCompletionsOptions = new ChatCompletionsOptions() { + DeploymentName = "gpt-3.5-turbo", // Use DeploymentName for "model" with non-Azure clients Messages = { new ChatMessage(ChatRole.System, "You are a helpful assistant. You will talk like a pirate."), @@ -206,22 +209,52 @@ var chatCompletionsOptions = new ChatCompletionsOptions() } }; -Response response = await client.GetChatCompletionsStreamingAsync( - deploymentOrModelName: "gpt-3.5-turbo", - chatCompletionsOptions); -using StreamingChatCompletions streamingChatCompletions = response.Value; +await foreach (StreamingChatCompletionsUpdate chatUpdate in client.GetChatCompletionsStreaming(chatCompletionsOptions)) +{ + if (chatUpdate.Role.HasValue) + { + Console.Write($"{chatUpdate.Role.Value.ToString().ToUpperInvariant()}: "); + } + if (!string.IsNullOrEmpty(chatUpdate.ContentUpdate)) + { + Console.Write(chatUpdate.ContentUpdate); + } +} +``` + +When explicitly requesting more than one `Choice` while streaming, use the `ChoiceIndex` property on +`StreamingChatCompletionsUpdate` to determine which `Choice` each update corresponds to. -await foreach (StreamingChatChoice choice in streamingChatCompletions.GetChoicesStreaming()) +```C# Snippet:StreamChatMessagesWithMultipleChoices +// A ChoiceCount > 1 will feature multiple, parallel, independent text generations arriving on the +// same response. This may be useful when choosing between multiple candidates for a single request. +var chatCompletionsOptions = new ChatCompletionsOptions() { - await foreach (ChatMessage message in choice.GetMessageStreaming()) + Messages = { new ChatMessage(ChatRole.User, "Write a limerick about bananas.") }, + ChoiceCount = 4 +}; + +await foreach (StreamingChatCompletionsUpdate chatUpdate + in client.GetChatCompletionsStreaming(chatCompletionsOptions)) +{ + // Choice-specific information like Role and ContentUpdate will also provide a ChoiceIndex that allows + // StreamingChatCompletionsUpdate data for independent choices to be appropriately separated. + if (chatUpdate.ChoiceIndex.HasValue) { - Console.Write(message.Content); + int choiceIndex = chatUpdate.ChoiceIndex.Value; + if (chatUpdate.Role.HasValue) + { + textBoxes[choiceIndex].Text += $"{chatUpdate.Role.Value.ToString().ToUpperInvariant()}: "; + } + if (!string.IsNullOrEmpty(chatUpdate.ContentUpdate)) + { + textBoxes[choiceIndex].Text += chatUpdate.ContentUpdate; + } } - Console.WriteLine(); } ``` -### Use Chat Functions +### Use chat functions Chat Functions allow a caller of Chat Completions to define capabilities that the model can use to extend its functionality into external tools and data sources. @@ -274,16 +307,17 @@ var conversationMessages = new List() new(ChatRole.User, "What is the weather like in Boston?"), }; -var chatCompletionsOptions = new ChatCompletionsOptions(); +var chatCompletionsOptions = new ChatCompletionsOptions() +{ + DeploymentName = "gpt-35-turbo-0613", +}; foreach (ChatMessage chatMessage in conversationMessages) { chatCompletionsOptions.Messages.Add(chatMessage); } chatCompletionsOptions.Functions.Add(getWeatherFuntionDefinition); -Response response = await client.GetChatCompletionsAsync( - "gpt-35-turbo-0613", - chatCompletionsOptions); +Response response = await client.GetChatCompletionsAsync(chatCompletionsOptions); ``` If the model determines that it should call a Chat Function, a finish reason of 'FunctionCall' will be populated on @@ -335,6 +369,47 @@ if (responseChoice.FinishReason == CompletionsFinishReason.FunctionCall) } ``` +When using streaming, capture streaming response components as they arrive and accumulate streaming function arguments +in the same manner used for streaming content. Then, in the place of using the `ChatMessage` from the non-streaming +response, instead add a new `ChatMessage` instance for history, created from the streamed information. + +```C# Snippet::ChatFunctions::StreamingFunctions +string functionName = null; +StringBuilder contentBuilder = new(); +StringBuilder functionArgumentsBuilder = new(); +ChatRole streamedRole = default; +CompletionsFinishReason finishReason = default; + +await foreach (StreamingChatCompletionsUpdate update + in client.GetChatCompletionsStreaming(chatCompletionsOptions)) +{ + contentBuilder.Append(update.ContentUpdate); + functionName ??= update.FunctionName; + functionArgumentsBuilder.Append(update.FunctionArgumentsUpdate); + streamedRole = update.Role ?? default; + finishReason = update.FinishReason ?? default; +} + +if (finishReason == CompletionsFinishReason.FunctionCall) +{ + string lastContent = contentBuilder.ToString(); + string unvalidatedArguments = functionArgumentsBuilder.ToString(); + ChatMessage chatMessageForHistory = new(streamedRole, lastContent) + { + FunctionCall = new(functionName, unvalidatedArguments), + }; + conversationMessages.Add(chatMessageForHistory); + + // Handle from here just like the non-streaming case +} +``` + +Please note: while streamed function information (name, arguments) may be evaluated as it arrives, it should not be +considered complete or confirmed until the `FinishReason` of `FunctionCall` is received. It may be appropriate to make +best-effort attempts at "warm-up" or other speculative preparation based on a function name or particular key/value +appearing in the accumulated, partial JSON arguments, but no strong assumptions about validity, ordering, or other +details should be evaluated until the arguments are fully available and confirmed via `FinishReason`. + ### Use your own data with Azure OpenAI The use your own data feature is unique to Azure OpenAI and won't work with a client configured to use the non-Azure service. @@ -345,6 +420,7 @@ See [the Azure OpenAI using your own data quickstart](https://learn.microsoft.co ```C# Snippet:ChatUsingYourOwnData var chatCompletionsOptions = new ChatCompletionsOptions() { + DeploymentName = "gpt-35-turbo-0613", Messages = { new ChatMessage( @@ -368,9 +444,7 @@ var chatCompletionsOptions = new ChatCompletionsOptions() } } }; -Response response = await client.GetChatCompletionsAsync( - "gpt-35-turbo-0613", - chatCompletionsOptions); +Response response = await client.GetChatCompletionsAsync(chatCompletionsOptions); ChatMessage message = response.Value.Choices[0].Message; // The final, data-informed response still appears in the ChatMessages as usual Console.WriteLine($"{message.Role}: {message.Content}"); @@ -385,6 +459,21 @@ foreach (ChatMessage contextMessage in message.AzureExtensionsContext.Messages) } ``` +### Generate embeddings + +```C# Snippet:GenerateEmbeddings +EmbeddingsOptions embeddingsOptions = new() +{ + DeploymentName = "text-embedding-ada-002", + Input = { "Your text string goes here" }, +}; +Response response = await client.GetEmbeddingsAsync(embeddingsOptions); + +// The response includes the generated embedding. +EmbeddingItem item = response.Value.Data[0]; +ReadOnlyMemory embedding = item.Embedding; +`````` + ### Generate images with DALL-E image generation models ```C# Snippet:GenerateImages @@ -406,13 +495,13 @@ using Stream audioStreamFromFile = File.OpenRead("myAudioFile.mp3"); var transcriptionOptions = new AudioTranscriptionOptions() { + DeploymentName = "my-whisper-deployment", // whisper-1 as model name for non-Azure OpenAI AudioData = BinaryData.FromStream(audioStreamFromFile), ResponseFormat = AudioTranscriptionFormat.Verbose, }; -Response transcriptionResponse = await client.GetAudioTranscriptionAsync( - deploymentId: "my-whisper-deployment", // whisper-1 as model name for non-Azure OpenAI - transcriptionOptions); +Response transcriptionResponse + = await client.GetAudioTranscriptionAsync(transcriptionOptions); AudioTranscription transcription = transcriptionResponse.Value; // When using Simple, SRT, or VTT formats, only transcription.Text will be populated @@ -427,13 +516,12 @@ using Stream audioStreamFromFile = File.OpenRead("mySpanishAudioFile.mp3"); var translationOptions = new AudioTranslationOptions() { + DeploymentName = "my-whisper-deployment", // whisper-1 as model name for non-Azure OpenAI AudioData = BinaryData.FromStream(audioStreamFromFile), ResponseFormat = AudioTranslationFormat.Verbose, }; -Response translationResponse = await client.GetAudioTranslationAsync( - deploymentId: "my-whisper-deployment", // whisper-1 as model name for non-Azure OpenAI - translationOptions); +Response translationResponse = await client.GetAudioTranslationAsync(translationOptions); AudioTranslation translation = translationResponse.Value; // When using Simple, SRT, or VTT formats, only translation.Text will be populated diff --git a/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs b/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs index a4b3f10dcf7df..6e9bb46de543a 100644 --- a/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs +++ b/sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs @@ -31,8 +31,9 @@ internal AudioTranscription() { } public partial class AudioTranscriptionOptions { public AudioTranscriptionOptions() { } - public AudioTranscriptionOptions(System.BinaryData audioData) { } + public AudioTranscriptionOptions(string deploymentName, System.BinaryData audioData) { } public System.BinaryData AudioData { get { throw null; } set { } } + public string DeploymentName { get { throw null; } set { } } public string Language { get { throw null; } set { } } public string Prompt { get { throw null; } set { } } public Azure.AI.OpenAI.AudioTranscriptionFormat? ResponseFormat { get { throw null; } set { } } @@ -83,8 +84,9 @@ internal AudioTranslation() { } public partial class AudioTranslationOptions { public AudioTranslationOptions() { } - public AudioTranslationOptions(System.BinaryData audioData) { } + public AudioTranslationOptions(string deploymentName, System.BinaryData audioData) { } public System.BinaryData AudioData { get { throw null; } set { } } + public string DeploymentName { get { throw null; } set { } } public string Prompt { get { throw null; } set { } } public Azure.AI.OpenAI.AudioTranslationFormat? ResponseFormat { get { throw null; } set { } } public float? Temperature { get { throw null; } set { } } @@ -114,6 +116,8 @@ public partial class AzureChatExtensionsMessageContext { public AzureChatExtensionsMessageContext() { } public System.Collections.Generic.IList Messages { get { throw null; } } + public Azure.AI.OpenAI.ContentFilterResults RequestContentFilterResults { get { throw null; } } + public Azure.AI.OpenAI.ContentFilterResults ResponseContentFilterResults { get { throw null; } } } public partial class AzureChatExtensionsOptions { @@ -198,16 +202,13 @@ public static partial class AzureOpenAIModelFactory public static Azure.AI.OpenAI.CompletionsUsage CompletionsUsage(int completionTokens = 0, int promptTokens = 0, int totalTokens = 0) { throw null; } public static Azure.AI.OpenAI.ContentFilterResult ContentFilterResult(Azure.AI.OpenAI.ContentFilterSeverity severity = default(Azure.AI.OpenAI.ContentFilterSeverity), bool filtered = false) { throw null; } public static Azure.AI.OpenAI.ContentFilterResults ContentFilterResults(Azure.AI.OpenAI.ContentFilterResult sexual = null, Azure.AI.OpenAI.ContentFilterResult violence = null, Azure.AI.OpenAI.ContentFilterResult hate = null, Azure.AI.OpenAI.ContentFilterResult selfHarm = null, Azure.ResponseError error = null) { throw null; } - public static Azure.AI.OpenAI.EmbeddingItem EmbeddingItem(System.Collections.Generic.IEnumerable embedding = null, int index = 0) { throw null; } + public static Azure.AI.OpenAI.EmbeddingItem EmbeddingItem(System.ReadOnlyMemory embedding = default(System.ReadOnlyMemory), int index = 0) { throw null; } public static Azure.AI.OpenAI.Embeddings Embeddings(System.Collections.Generic.IEnumerable data = null, Azure.AI.OpenAI.EmbeddingsUsage usage = null) { throw null; } public static Azure.AI.OpenAI.EmbeddingsUsage EmbeddingsUsage(int promptTokens = 0, int totalTokens = 0) { throw null; } public static Azure.AI.OpenAI.ImageGenerations ImageGenerations(System.DateTimeOffset created = default(System.DateTimeOffset), System.Collections.Generic.IEnumerable data = null) { throw null; } public static Azure.AI.OpenAI.ImageLocation ImageLocation(System.Uri url = null) { throw null; } public static Azure.AI.OpenAI.PromptFilterResult PromptFilterResult(int promptIndex = 0, Azure.AI.OpenAI.ContentFilterResults contentFilterResults = null) { throw null; } - public static Azure.AI.OpenAI.StreamingChatChoice StreamingChatChoice(Azure.AI.OpenAI.ChatChoice originalBaseChoice = null) { throw null; } - public static Azure.AI.OpenAI.StreamingChatCompletions StreamingChatCompletions(Azure.AI.OpenAI.ChatCompletions baseChatCompletions = null, System.Collections.Generic.List streamingChatChoices = null) { throw null; } - public static Azure.AI.OpenAI.StreamingChoice StreamingChoice(Azure.AI.OpenAI.Choice originalBaseChoice = null) { throw null; } - public static Azure.AI.OpenAI.StreamingCompletions StreamingCompletions(Azure.AI.OpenAI.Completions baseCompletions = null, System.Collections.Generic.List streamingChoices = null) { throw null; } + public static Azure.AI.OpenAI.StreamingChatCompletionsUpdate StreamingChatCompletionsUpdate(string id, System.DateTimeOffset created, int? choiceIndex = default(int?), Azure.AI.OpenAI.ChatRole? role = default(Azure.AI.OpenAI.ChatRole?), string authorName = null, string contentUpdate = null, Azure.AI.OpenAI.CompletionsFinishReason? finishReason = default(Azure.AI.OpenAI.CompletionsFinishReason?), string functionName = null, string functionArgumentsUpdate = null, Azure.AI.OpenAI.AzureChatExtensionsMessageContext azureExtensionsContext = null) { throw null; } } public partial class ChatChoice { @@ -229,9 +230,10 @@ internal ChatCompletions() { } public partial class ChatCompletionsOptions { public ChatCompletionsOptions() { } - public ChatCompletionsOptions(System.Collections.Generic.IEnumerable messages) { } + public ChatCompletionsOptions(string deploymentName, System.Collections.Generic.IEnumerable messages) { } public Azure.AI.OpenAI.AzureChatExtensionsOptions AzureExtensionsOptions { get { throw null; } set { } } public int? ChoiceCount { get { throw null; } set { } } + public string DeploymentName { get { throw null; } set { } } public float? FrequencyPenalty { get { throw null; } set { } } public Azure.AI.OpenAI.FunctionDefinition FunctionCall { get { throw null; } set { } } public System.Collections.Generic.IList Functions { get { throw null; } set { } } @@ -324,8 +326,9 @@ internal CompletionsLogProbabilityModel() { } public partial class CompletionsOptions { public CompletionsOptions() { } - public CompletionsOptions(System.Collections.Generic.IEnumerable prompts) { } + public CompletionsOptions(string deploymentName, System.Collections.Generic.IEnumerable prompts) { } public int? ChoicesPerPrompt { get { throw null; } set { } } + public string DeploymentName { get { throw null; } set { } } public bool? Echo { get { throw null; } set { } } public float? FrequencyPenalty { get { throw null; } set { } } public int? GenerationSampleCount { get { throw null; } set { } } @@ -384,7 +387,7 @@ internal ContentFilterResults() { } public partial class EmbeddingItem { internal EmbeddingItem() { } - public System.Collections.Generic.IReadOnlyList Embedding { get { throw null; } } + public System.ReadOnlyMemory Embedding { get { throw null; } } public int Index { get { throw null; } } } public partial class Embeddings @@ -396,9 +399,9 @@ internal Embeddings() { } public partial class EmbeddingsOptions { public EmbeddingsOptions() { } - public EmbeddingsOptions(System.Collections.Generic.IEnumerable input) { } - public EmbeddingsOptions(string input) { } - public System.Collections.Generic.IList Input { get { throw null; } } + public EmbeddingsOptions(string deploymentName, System.Collections.Generic.IEnumerable input) { } + public string DeploymentName { get { throw null; } set { } } + public System.Collections.Generic.IList Input { get { throw null; } set { } } public string User { get { throw null; } set { } } } public partial class EmbeddingsUsage @@ -472,22 +475,20 @@ public OpenAIClient(System.Uri endpoint, Azure.AzureKeyCredential keyCredential, public OpenAIClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredential) { } public OpenAIClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredential, Azure.AI.OpenAI.OpenAIClientOptions options) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response GetAudioTranscription(string deploymentId, Azure.AI.OpenAI.AudioTranscriptionOptions audioTranscriptionOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAudioTranscriptionAsync(string deploymentId, Azure.AI.OpenAI.AudioTranscriptionOptions audioTranscriptionOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetAudioTranslation(string deploymentId, Azure.AI.OpenAI.AudioTranslationOptions audioTranslationOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAudioTranslationAsync(string deploymentId, Azure.AI.OpenAI.AudioTranslationOptions audioTranslationOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetChatCompletions(string deploymentOrModelName, Azure.AI.OpenAI.ChatCompletionsOptions chatCompletionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetChatCompletionsAsync(string deploymentOrModelName, Azure.AI.OpenAI.ChatCompletionsOptions chatCompletionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetChatCompletionsStreaming(string deploymentOrModelName, Azure.AI.OpenAI.ChatCompletionsOptions chatCompletionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetChatCompletionsStreamingAsync(string deploymentOrModelName, Azure.AI.OpenAI.ChatCompletionsOptions chatCompletionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetCompletions(string deploymentOrModelName, Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetCompletions(string deploymentOrModelName, string prompt, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetCompletionsAsync(string deploymentOrModelName, Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetCompletionsAsync(string deploymentOrModelName, string prompt, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetCompletionsStreaming(string deploymentOrModelName, Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetCompletionsStreamingAsync(string deploymentOrModelName, Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetEmbeddings(string deploymentOrModelName, Azure.AI.OpenAI.EmbeddingsOptions embeddingsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetEmbeddingsAsync(string deploymentOrModelName, Azure.AI.OpenAI.EmbeddingsOptions embeddingsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAudioTranscription(Azure.AI.OpenAI.AudioTranscriptionOptions audioTranscriptionOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAudioTranscriptionAsync(Azure.AI.OpenAI.AudioTranscriptionOptions audioTranscriptionOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAudioTranslation(Azure.AI.OpenAI.AudioTranslationOptions audioTranslationOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAudioTranslationAsync(Azure.AI.OpenAI.AudioTranslationOptions audioTranslationOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetChatCompletions(Azure.AI.OpenAI.ChatCompletionsOptions chatCompletionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetChatCompletionsAsync(Azure.AI.OpenAI.ChatCompletionsOptions chatCompletionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AI.OpenAI.StreamingResponse GetChatCompletionsStreaming(Azure.AI.OpenAI.ChatCompletionsOptions chatCompletionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetChatCompletionsStreamingAsync(Azure.AI.OpenAI.ChatCompletionsOptions chatCompletionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCompletions(Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCompletionsAsync(Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AI.OpenAI.StreamingResponse GetCompletionsStreaming(Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCompletionsStreamingAsync(Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetEmbeddings(Azure.AI.OpenAI.EmbeddingsOptions embeddingsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEmbeddingsAsync(Azure.AI.OpenAI.EmbeddingsOptions embeddingsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetImageGenerations(Azure.AI.OpenAI.ImageGenerationOptions imageGenerationOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetImageGenerationsAsync(Azure.AI.OpenAI.ImageGenerationOptions imageGenerationOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } @@ -510,42 +511,29 @@ internal PromptFilterResult() { } public Azure.AI.OpenAI.ContentFilterResults ContentFilterResults { get { throw null; } } public int PromptIndex { get { throw null; } } } - public partial class StreamingChatChoice + public partial class StreamingChatCompletionsUpdate { - internal StreamingChatChoice() { } - public Azure.AI.OpenAI.ContentFilterResults ContentFilterResults { get { throw null; } } - public Azure.AI.OpenAI.CompletionsFinishReason? FinishReason { get { throw null; } } - public int? Index { get { throw null; } } - public System.Collections.Generic.IAsyncEnumerable GetMessageStreaming([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class StreamingChatCompletions : System.IDisposable - { - internal StreamingChatCompletions() { } + internal StreamingChatCompletionsUpdate() { } + public string AuthorName { get { throw null; } } + public Azure.AI.OpenAI.AzureChatExtensionsMessageContext AzureExtensionsContext { get { throw null; } } + public int? ChoiceIndex { get { throw null; } } + public string ContentUpdate { get { throw null; } } public System.DateTimeOffset Created { get { throw null; } } - public string Id { get { throw null; } } - public System.Collections.Generic.IReadOnlyList PromptFilterResults { get { throw null; } } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public System.Collections.Generic.IAsyncEnumerable GetChoicesStreaming([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class StreamingChoice - { - internal StreamingChoice() { } - public Azure.AI.OpenAI.ContentFilterResults ContentFilterResults { get { throw null; } } public Azure.AI.OpenAI.CompletionsFinishReason? FinishReason { get { throw null; } } - public int? Index { get { throw null; } } - public Azure.AI.OpenAI.CompletionsLogProbabilityModel LogProbabilityModel { get { throw null; } } - public System.Collections.Generic.IAsyncEnumerable GetTextStreaming([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public string FunctionArgumentsUpdate { get { throw null; } } + public string FunctionName { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.OpenAI.ChatRole? Role { get { throw null; } } } - public partial class StreamingCompletions : System.IDisposable + public partial class StreamingResponse : System.Collections.Generic.IAsyncEnumerable, System.IDisposable { - internal StreamingCompletions() { } - public System.DateTimeOffset Created { get { throw null; } } - public string Id { get { throw null; } } - public System.Collections.Generic.IReadOnlyList PromptFilterResults { get { throw null; } } + internal StreamingResponse() { } + public static Azure.AI.OpenAI.StreamingResponse CreateFromResponse(Azure.Response response, System.Func> asyncEnumerableProcessor) { throw null; } public void Dispose() { } protected virtual void Dispose(bool disposing) { } - public System.Collections.Generic.IAsyncEnumerable GetChoicesStreaming([System.Runtime.CompilerServices.EnumeratorCancellationAttribute] System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public System.Collections.Generic.IAsyncEnumerable EnumerateValues() { throw null; } + public Azure.Response GetRawResponse() { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } } } namespace Microsoft.Extensions.Azure diff --git a/sdk/openai/Azure.AI.OpenAI/assets.json b/sdk/openai/Azure.AI.OpenAI/assets.json index 9b85d4de7bc32..70d05d961a746 100644 --- a/sdk/openai/Azure.AI.OpenAI/assets.json +++ b/sdk/openai/Azure.AI.OpenAI/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/openai/Azure.AI.OpenAI", - "Tag": "net/openai/Azure.AI.OpenAI_52e82965d8" + "Tag": "net/openai/Azure.AI.OpenAI_41a964dc8d" } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom.Suppressions/OpenAIClient.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom.Suppressions/OpenAIClient.cs index 63b090689b041..889aada048212 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom.Suppressions/OpenAIClient.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom.Suppressions/OpenAIClient.cs @@ -10,10 +10,18 @@ namespace Azure.AI.OpenAI { [CodeGenSuppress("GetCompletions", typeof(string), typeof(RequestContent), typeof(RequestContext))] [CodeGenSuppress("GetCompletionsAsync", typeof(string), typeof(RequestContent), typeof(RequestContext))] + [CodeGenSuppress("GetCompletions", typeof(string), typeof(CompletionsOptions), typeof(CancellationToken))] + [CodeGenSuppress("GetCompletionsAsync", typeof(string), typeof(CompletionsOptions), typeof(CancellationToken))] + [CodeGenSuppress("GetCompletionsStreaming", typeof(string), typeof(CompletionsOptions), typeof(CancellationToken))] + [CodeGenSuppress("GetCompletionsStreamingAsync", typeof(string), typeof(CompletionsOptions), typeof(CancellationToken))] [CodeGenSuppress("GetChatCompletions", typeof(string), typeof(RequestContent), typeof(RequestContext))] [CodeGenSuppress("GetChatCompletionsAsync", typeof(string), typeof(RequestContent), typeof(RequestContext))] + [CodeGenSuppress("GetChatCompletions", typeof(string), typeof(ChatCompletionsOptions), typeof(CancellationToken))] + [CodeGenSuppress("GetChatCompletionsAsync", typeof(string), typeof(ChatCompletionsOptions), typeof(CancellationToken))] [CodeGenSuppress("GetEmbeddings", typeof(string), typeof(RequestContent), typeof(RequestContext))] [CodeGenSuppress("GetEmbeddingsAsync", typeof(string), typeof(RequestContent), typeof(RequestContext))] + [CodeGenSuppress("GetEmbeddings", typeof(string), typeof(EmbeddingsOptions), typeof(CancellationToken))] + [CodeGenSuppress("GetEmbeddingsAsync", typeof(string), typeof(EmbeddingsOptions), typeof(CancellationToken))] [CodeGenSuppress("GetChatCompletionsWithAzureExtensions", typeof(string), typeof(RequestContent), typeof(RequestContext))] [CodeGenSuppress("GetChatCompletionsWithAzureExtensions", typeof(string), typeof(ChatCompletionsOptions), typeof(CancellationToken))] [CodeGenSuppress("GetChatCompletionsWithAzureExtensionsAsync", typeof(string), typeof(RequestContent), typeof(RequestContext))] diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranscriptionOptions.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranscriptionOptions.Serialization.cs index 1dc3ecb666d12..19ad40fdcd6e7 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranscriptionOptions.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranscriptionOptions.Serialization.cs @@ -13,7 +13,7 @@ public partial class AudioTranscriptionOptions internal virtual RequestContent ToRequestContent() { var content = new MultipartFormDataRequestContent(); - content.Add(new StringContent(InternalNonAzureModelName), "model"); + content.Add(new StringContent(DeploymentName), "model"); content.Add(new ByteArrayContent(AudioData.ToArray()), "file", "@file.wav"); if (Optional.IsDefined(ResponseFormat)) { diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranscriptionOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranscriptionOptions.cs index 8c21c1180cc4a..58f022b4d6b59 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranscriptionOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranscriptionOptions.cs @@ -4,9 +4,11 @@ #nullable disable using System; +using Azure.Core; namespace Azure.AI.OpenAI { + [CodeGenSuppress("AudioTranscriptionOptions", typeof(BinaryData))] public partial class AudioTranscriptionOptions { /// @@ -28,10 +30,44 @@ public partial class AudioTranscriptionOptions /// public BinaryData AudioData { get; set; } + /// + /// Gets or sets the deployment name to use for a transcription request. + /// + /// + /// + /// When making a request against Azure OpenAI, this should be the customizable name of the "model deployment" + /// (example: my-gpt4-deployment) and not the name of the model itself (example: gpt-4). + /// + /// + /// When using non-Azure OpenAI, this corresponds to "model" in the request options and should use the + /// appropriate name of the model (example: gpt-4). + /// + /// + [CodeGenMember("InternalNonAzureModelName")] + public string DeploymentName { get; set; } + + /// + /// Creates a new instance of . + /// + /// The deployment name to use for audio transcription. + /// The audio data to transcribe. + /// + /// or is null. + /// + /// + /// is an empty string. + /// + public AudioTranscriptionOptions(string deploymentName, BinaryData audioData) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(audioData, nameof(audioData)); + + DeploymentName = deploymentName; + AudioData = audioData; + } + /// Initializes a new instance of AudioTranscriptionOptions. public AudioTranscriptionOptions() { } - - internal string InternalNonAzureModelName { get; set; } } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranslationOptions.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranslationOptions.Serialization.cs index ad1f88925c413..8f8fd714929cf 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranslationOptions.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranslationOptions.Serialization.cs @@ -13,7 +13,7 @@ public partial class AudioTranslationOptions internal virtual RequestContent ToRequestContent() { var content = new MultipartFormDataRequestContent(); - content.Add(new StringContent(InternalNonAzureModelName), "model"); + content.Add(new StringContent(DeploymentName), "model"); content.Add(new ByteArrayContent(AudioData.ToArray()), "file", "@file.wav"); if (Optional.IsDefined(ResponseFormat)) { diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranslationOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranslationOptions.cs index 38eb7dfd56114..25d6d5a16faf3 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranslationOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AudioTranslationOptions.cs @@ -4,10 +4,11 @@ #nullable disable using System; +using Azure.Core; namespace Azure.AI.OpenAI { - /// The configuration information for an audio translation request. + [CodeGenSuppress("AudioTranslationOptions", typeof(BinaryData))] public partial class AudioTranslationOptions { /// @@ -29,7 +30,41 @@ public partial class AudioTranslationOptions /// public BinaryData AudioData { get; set; } - internal string InternalNonAzureModelName { get; set; } + /// + /// Gets or sets the deployment name to use for a translation request. + /// + /// + /// + /// When making a request against Azure OpenAI, this should be the customizable name of the "model deployment" + /// (example: my-gpt4-deployment) and not the name of the model itself (example: gpt-4). + /// + /// + /// When using non-Azure OpenAI, this corresponds to "model" in the request options and should use the + /// appropriate name of the model (example: gpt-4). + /// + /// + [CodeGenMember("InternalNonAzureModelName")] + public string DeploymentName { get; set; } + + /// + /// Creates a new instance of . + /// + /// The deployment name to use for audio translation. + /// The audio data to translate. + /// + /// or is null. + /// + /// + /// is an empty string. + /// + public AudioTranslationOptions(string deploymentName, BinaryData audioData) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(audioData, nameof(audioData)); + + DeploymentName = deploymentName; + AudioData = audioData; + } /// /// Initializes a new instance of AudioTranslationOptions. diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureChatExtensionsMessageContext.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureChatExtensionsMessageContext.cs new file mode 100644 index 0000000000000..1e903ab1326ba --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureChatExtensionsMessageContext.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.AI.OpenAI +{ + /// + /// A representation of the additional context information available when Azure OpenAI chat extensions are involved + /// in the generation of a corresponding chat completions response. This context information is only populated when + /// using an Azure OpenAI request configured to use a matching extension. + /// + public partial class AzureChatExtensionsMessageContext + { + public ContentFilterResults RequestContentFilterResults { get; internal set; } + public ContentFilterResults ResponseContentFilterResults { get; internal set; } + + internal AzureChatExtensionsMessageContext( + IList messages, + ContentFilterResults requestContentFilterResults, + ContentFilterResults responseContentFilterResults) + : this(messages) + { + RequestContentFilterResults = requestContentFilterResults; + ResponseContentFilterResults = responseContentFilterResults; + } + } +} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIModelFactory.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIModelFactory.cs index a879727738372..9cdbf2b7d2767 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIModelFactory.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/AzureOpenAIModelFactory.cs @@ -14,11 +14,11 @@ namespace Azure.AI.OpenAI public static partial class AzureOpenAIModelFactory { /// Initializes a new instance of ChatChoice. - /// The chat message associated with this chat completions choice + /// The chat message associated with this chat completions choice. /// The ordered index associated with this chat completions choice. /// The reason that this chat completions choice completed its generated. - /// For streamed choices, the internal representation of a 'delta' payload - /// The category annotations for this chat choice's content filtering + /// For streamed choices, the internal representation of a 'delta' payload. + /// The category annotations for this chat choice's content filtering. /// A new instance for mocking. public static ChatChoice ChatChoice( ChatMessage message = null, @@ -30,50 +30,29 @@ public static ChatChoice ChatChoice( return new ChatChoice(message, index, finishReason, deltaMessage, contentFilterResults); } - /// - /// Initializes a new instance of StreamingChoice for tests and mocking. - /// - /// An underlying Choice for this streaming representation - /// A new instance of StreamingChoice - public static StreamingChoice StreamingChoice(Choice originalBaseChoice = null) + public static StreamingChatCompletionsUpdate StreamingChatCompletionsUpdate( + string id, + DateTimeOffset created, + int? choiceIndex = null, + ChatRole? role = null, + string authorName = null, + string contentUpdate = null, + CompletionsFinishReason? finishReason = null, + string functionName = null, + string functionArgumentsUpdate = null, + AzureChatExtensionsMessageContext azureExtensionsContext = null) { - return new StreamingChoice(originalBaseChoice); - } - - /// - /// Initializes a new instance of StreamingCompletions for tests and mocking. - /// - /// The non-streaming completions to base this streaming representation on - /// The streaming choices associated with this streaming completions - /// A new instance of StreamingCompletions - public static StreamingCompletions StreamingCompletions( - Completions baseCompletions = null, - List streamingChoices = null) - { - return new StreamingCompletions(baseCompletions, streamingChoices); - } - - /// - /// Initializes a new instance of StreamingChatChoice for tests and mocking. - /// - /// An underlying ChatChoice for this streaming representation - /// A new instance of StreamingChatChoice - public static StreamingChatChoice StreamingChatChoice(ChatChoice originalBaseChoice = null) - { - return new StreamingChatChoice(originalBaseChoice); - } - - /// - /// Initializes a new instance of StreamingChatCompletions for tests and mocking. - /// - /// The non-streaming completions to base this streaming representation on - /// The streaming choices associated with this streaming chat completions - /// A new instance of StreamingChatCompletions - public static StreamingChatCompletions StreamingChatCompletions( - ChatCompletions baseChatCompletions = null, - List streamingChatChoices = null) - { - return new StreamingChatCompletions(baseChatCompletions, streamingChatChoices); + return new StreamingChatCompletionsUpdate( + id, + created, + choiceIndex, + role, + authorName, + contentUpdate, + finishReason, + functionName, + functionArgumentsUpdate, + azureExtensionsContext); } /// Initializes a new instance of AudioTranscription. diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/ChatCompletionsOptions.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/ChatCompletionsOptions.Serialization.cs index 07707a77300b5..e75de69621567 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/ChatCompletionsOptions.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/ChatCompletionsOptions.Serialization.cs @@ -17,6 +17,11 @@ public partial class ChatCompletionsOptions : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(DeploymentName)) + { + writer.WritePropertyName("model"u8); + writer.WriteStringValue(DeploymentName); + } writer.WritePropertyName("messages"u8); writer.WriteStartArray(); foreach (var item in Messages) @@ -167,11 +172,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("stream"); } } - if (Optional.IsDefined(InternalNonAzureModelName)) - { - writer.WritePropertyName("model"u8); - writer.WriteStringValue(InternalNonAzureModelName); - } if (AzureExtensionsOptions != null) { // CUSTOM CODE NOTE: Extensions options currently deserialize directly into the payload (not as a diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/ChatCompletionsOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/ChatCompletionsOptions.cs index eaafb9b534c87..ad3c4e85e5cb1 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/ChatCompletionsOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/ChatCompletionsOptions.cs @@ -9,14 +9,28 @@ namespace Azure.AI.OpenAI { - /// - /// The configuration information used for a chat completions request. - /// + [CodeGenSuppress("ChatCompletionsOptions", typeof(IEnumerable))] public partial class ChatCompletionsOptions { /// public int? ChoiceCount { get; set; } + /// + /// Gets or sets the deployment name to use for a chat completions request. + /// + /// + /// + /// When making a request against Azure OpenAI, this should be the customizable name of the "model deployment" + /// (example: my-gpt4-deployment) and not the name of the model itself (example: gpt-4). + /// + /// + /// When using non-Azure OpenAI, this corresponds to "model" in the request options and should use the + /// appropriate name of the model (example: gpt-4). + /// + /// + [CodeGenMember("InternalNonAzureModelName")] + public string DeploymentName { get; set; } + /// public float? FrequencyPenalty { get; set; } @@ -78,29 +92,37 @@ public partial class ChatCompletionsOptions // CUSTOM CODE NOTE: the following properties are forward declared here as internal as their behavior is // otherwise handled in the custom implementation. internal IList InternalAzureExtensionsDataSources { get; set; } - internal string InternalNonAzureModelName { get; set; } internal bool? InternalShouldStreamResponse { get; set; } internal IDictionary InternalStringKeyedTokenSelectionBiases { get; } /// Initializes a new instance of ChatCompletionsOptions. + /// The deployment name to use for chat completions. /// /// The collection of context messages associated with this chat completions request. /// Typical usage begins with a chat message for the System role that provides instructions for /// the behavior of the assistant, followed by alternating messages between the User and /// Assistant roles. /// - /// is null. - public ChatCompletionsOptions(IEnumerable messages) : this() + /// + /// or is null. + /// + /// + /// is an empty string. + /// + public ChatCompletionsOptions(string deploymentName, IEnumerable messages) : this() { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); Argument.AssertNotNull(messages, nameof(messages)); + DeploymentName = deploymentName; + foreach (ChatMessage chatMessage in messages) { Messages.Add(chatMessage); } } - /// + /// Initializes a new instance of ChatCompletionsOptions. public ChatCompletionsOptions() { // CUSTOM CODE NOTE: Empty constructors are added to options classes to facilitate property-only use; this diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/Choice.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/Choice.cs index e53ed4b2e9d44..91890116a6aeb 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/Choice.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/Choice.cs @@ -20,7 +20,7 @@ public partial class Choice /// The ordered index associated with this completions choice. /// The log probabilities model for tokens associated with this completions choice. /// Reason for finishing. - /// or is null. + /// is null. internal Choice(string text, int index, CompletionsLogProbabilityModel logProbabilityModel, CompletionsFinishReason finishReason) { Argument.AssertNotNull(text, nameof(text)); diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsOptions.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsOptions.Serialization.cs index ff58248147bdf..a635cbfc621a0 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsOptions.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsOptions.Serialization.cs @@ -3,6 +3,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -14,62 +15,36 @@ public partial class CompletionsOptions : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - // CUSTOM: only serialize if prompts is non-empty - if (Optional.IsCollectionDefined(Prompts) && Prompts.Count > 0) + writer.WritePropertyName("prompt"u8); + writer.WriteStartArray(); + foreach (var item in Prompts) { - writer.WritePropertyName("prompt"u8); - writer.WriteStartArray(); - foreach (var item in Prompts) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); + writer.WriteStringValue(item); } + writer.WriteEndArray(); if (Optional.IsDefined(MaxTokens)) { - if (MaxTokens != null) - { - writer.WritePropertyName("max_tokens"u8); - writer.WriteNumberValue(MaxTokens.Value); - } - else - { - writer.WriteNull("max_tokens"); - } + writer.WritePropertyName("max_tokens"u8); + writer.WriteNumberValue(MaxTokens.Value); } if (Optional.IsDefined(Temperature)) { - if (Temperature != null) - { - writer.WritePropertyName("temperature"u8); - writer.WriteNumberValue(Temperature.Value); - } - else - { - writer.WriteNull("temperature"); - } + writer.WritePropertyName("temperature"u8); + writer.WriteNumberValue(Temperature.Value); } if (Optional.IsDefined(NucleusSamplingFactor)) { - if (NucleusSamplingFactor != null) - { - writer.WritePropertyName("top_p"u8); - writer.WriteNumberValue(NucleusSamplingFactor.Value); - } - else - { - writer.WriteNull("top_p"); - } + writer.WritePropertyName("top_p"u8); + writer.WriteNumberValue(NucleusSamplingFactor.Value); } - // CUSTOM: serialize to if (Optional.IsCollectionDefined(TokenSelectionBiases)) { writer.WritePropertyName("logit_bias"u8); writer.WriteStartObject(); - foreach (var item in TokenSelectionBiases) + foreach (KeyValuePair keyValuePair in TokenSelectionBiases) { - writer.WritePropertyName($"{item.Key}"); - writer.WriteNumberValue(item.Value); + writer.WritePropertyName($"{keyValuePair.Key}"); + writer.WriteNumberValue(keyValuePair.Value); } writer.WriteEndObject(); } @@ -80,39 +55,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } if (Optional.IsDefined(ChoicesPerPrompt)) { - if (ChoicesPerPrompt != null) - { - writer.WritePropertyName("n"u8); - writer.WriteNumberValue(ChoicesPerPrompt.Value); - } - else - { - writer.WriteNull("n"); - } + writer.WritePropertyName("n"u8); + writer.WriteNumberValue(ChoicesPerPrompt.Value); } if (Optional.IsDefined(LogProbabilityCount)) { - if (LogProbabilityCount != null) - { - writer.WritePropertyName("logprobs"u8); - writer.WriteNumberValue(LogProbabilityCount.Value); - } - else - { - writer.WriteNull("logprobs"); - } + writer.WritePropertyName("logprobs"u8); + writer.WriteNumberValue(LogProbabilityCount.Value); } if (Optional.IsDefined(Echo)) { - if (Echo != null) - { - writer.WritePropertyName("echo"u8); - writer.WriteBooleanValue(Echo.Value); - } - else - { - writer.WriteNull("echo"); - } + writer.WritePropertyName("echo"u8); + writer.WriteBooleanValue(Echo.Value); } if (Optional.IsCollectionDefined(StopSequences)) { @@ -126,56 +80,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } if (Optional.IsDefined(PresencePenalty)) { - if (PresencePenalty != null) - { - writer.WritePropertyName("presence_penalty"u8); - writer.WriteNumberValue(PresencePenalty.Value); - } - else - { - writer.WriteNull("presence_penalty"); - } + writer.WritePropertyName("presence_penalty"u8); + writer.WriteNumberValue(PresencePenalty.Value); } if (Optional.IsDefined(FrequencyPenalty)) { - if (FrequencyPenalty != null) - { - writer.WritePropertyName("frequency_penalty"u8); - writer.WriteNumberValue(FrequencyPenalty.Value); - } - else - { - writer.WriteNull("frequency_penalty"); - } + writer.WritePropertyName("frequency_penalty"u8); + writer.WriteNumberValue(FrequencyPenalty.Value); } if (Optional.IsDefined(GenerationSampleCount)) { - if (GenerationSampleCount != null) - { - writer.WritePropertyName("best_of"u8); - writer.WriteNumberValue(GenerationSampleCount.Value); - } - else - { - writer.WriteNull("best_of"); - } + writer.WritePropertyName("best_of"u8); + writer.WriteNumberValue(GenerationSampleCount.Value); } if (Optional.IsDefined(InternalShouldStreamResponse)) { - if (InternalShouldStreamResponse != null) - { - writer.WritePropertyName("stream"u8); - writer.WriteBooleanValue(InternalShouldStreamResponse.Value); - } - else - { - writer.WriteNull("stream"); - } + writer.WritePropertyName("stream"u8); + writer.WriteBooleanValue(InternalShouldStreamResponse.Value); } - if (Optional.IsDefined(InternalNonAzureModelName)) + if (Optional.IsDefined(DeploymentName)) { writer.WritePropertyName("model"u8); - writer.WriteStringValue(InternalNonAzureModelName); + writer.WriteStringValue(DeploymentName); } writer.WriteEndObject(); } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsOptions.cs index 6a63ffe0f0c30..6ab47fca5a719 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/CompletionsOptions.cs @@ -10,6 +10,7 @@ namespace Azure.AI.OpenAI { + [CodeGenSuppress("CompletionsOptions", typeof(IEnumerable))] public partial class CompletionsOptions { /// @@ -24,6 +25,22 @@ public partial class CompletionsOptions /// public int? ChoicesPerPrompt { get; set; } + /// + /// Gets or sets the deployment name to use for a completions request. + /// + /// + /// + /// When making a request against Azure OpenAI, this should be the customizable name of the "model deployment" + /// (example: my-gpt4-deployment) and not the name of the model itself (example: gpt-4). + /// + /// + /// When using non-Azure OpenAI, this corresponds to "model" in the request options and should use the + /// appropriate name of the model (example: gpt-4). + /// + /// + [CodeGenMember("InternalNonAzureModelName")] + public string DeploymentName { get; set; } + /// /// Gets or sets a value specifying whether a completion should include its input prompt as a prefix to /// its generated output. @@ -131,8 +148,6 @@ public partial class CompletionsOptions /// public float? Temperature { get; set; } - internal IDictionary InternalStringKeyedTokenSelectionBiases { get; } - /// /// Gets a dictionary of modifications to the likelihood of specified GPT tokens appearing in a completions /// result. Maps token IDs to associated bias scores from -100 to 100, with minimum and maximum values @@ -147,26 +162,36 @@ public partial class CompletionsOptions public IDictionary TokenSelectionBiases { get; } internal bool? InternalShouldStreamResponse { get; set; } - internal string InternalNonAzureModelName { get; set; } + + internal IDictionary InternalStringKeyedTokenSelectionBiases { get; } /// Initializes a new instance of CompletionsOptions. + /// The deployment name to use for this request. /// The prompts to generate completions from. - /// is null. - public CompletionsOptions(IEnumerable prompts) + /// + /// is an empty string. + /// + /// + /// or is null. + /// + public CompletionsOptions(string deploymentName, IEnumerable prompts) + : this() { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); Argument.AssertNotNull(prompts, nameof(prompts)); Prompts = prompts.ToList(); - TokenSelectionBiases = new ChangeTrackingDictionary(); - StopSequences = new ChangeTrackingList(); } /// Initializes a new instance of CompletionsOptions. public CompletionsOptions() - : this(new ChangeTrackingList()) { // CUSTOM CODE NOTE: Empty constructors are added to options classes to facilitate property-only use; this // may be reconsidered for required payload constituents in the future. + Prompts = new ChangeTrackingList(); + InternalStringKeyedTokenSelectionBiases = new ChangeTrackingDictionary(); + TokenSelectionBiases = new ChangeTrackingDictionary(); + StopSequences = new ChangeTrackingList(); } } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/EmbeddingItem.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/EmbeddingItem.cs new file mode 100644 index 0000000000000..49858f629e2ca --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/EmbeddingItem.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.OpenAI +{ + /// Representation of a single embeddings relatedness comparison. + public partial class EmbeddingItem + { + // CUSTOM CODE NOTE: The change of the Embedding property to ReadOnlyMemory + // results in the constructor below being generated twice and thus a build error. + // We're adding it here verbatim as custom code to work around this issue. + + /// Initializes a new instance of EmbeddingItem. + /// + /// List of embeddings value for the input prompt. These represent a measurement of the + /// vector-based relatedness of the provided input. + /// + /// Index of the prompt to which the EmbeddingItem corresponds. + internal EmbeddingItem(ReadOnlyMemory embedding, int index) + { + Embedding = embedding; + Index = index; + } + + // CUSTOM CODE NOTE: We want to represent embeddings as ReadOnlyMemory instead + // of IReadOnlyList. + public ReadOnlyMemory Embedding { get; } + } +} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/EmbeddingsOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/EmbeddingsOptions.cs index f6f9c2ed3920e..3774ea6cc0351 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/EmbeddingsOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/EmbeddingsOptions.cs @@ -4,22 +4,63 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Linq; using Azure.Core; namespace Azure.AI.OpenAI { - /// Schema to create a prompt completion from a deployment. + [CodeGenSuppress("EmbeddingsOptions", typeof(IEnumerable))] public partial class EmbeddingsOptions { - internal string InternalNonAzureModelName { get; set; } + /// + /// Gets or sets the deployment name to use for an embeddings request. + /// + /// + /// + /// When making a request against Azure OpenAI, this should be the customizable name of the "model deployment" + /// (example: my-gpt4-deployment) and not the name of the model itself (example: gpt-4). + /// + /// + /// When using non-Azure OpenAI, this corresponds to "model" in the request options and should use the + /// appropriate name of the model (example: gpt-4). + /// + /// + [CodeGenMember("InternalNonAzureModelName")] + public string DeploymentName { get; set; } - /// - public EmbeddingsOptions(string input) - : this(new string[] { input }) + /// + /// Input texts to get embeddings for, encoded as a an array of strings. + /// Each input must not exceed 2048 tokens in length. + /// + /// Unless you are embedding code, we suggest replacing newlines (\n) in your input with a single space, + /// as we have observed inferior results when newlines are present. + /// + public IList Input { get; set; } = new ChangeTrackingList(); + + /// + /// Creates a new instance of . + /// + /// The deployment name to use for embeddings. + /// The collection of inputs to run an embeddings operation across. + /// + /// or is null. + /// + /// + /// is an empty string. + /// + public EmbeddingsOptions(string deploymentName, IEnumerable input) { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(input, nameof(input)); + + DeploymentName = deploymentName; + Input = input.ToList(); } - /// + /// + /// Creates a new instance of . + /// public EmbeddingsOptions() { // CUSTOM CODE NOTE: Empty constructors are added to options classes to facilitate property-only use; this diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageGenerationOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageGenerationOptions.cs index e4aba4f2eb785..f98776f67f551 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageGenerationOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageGenerationOptions.cs @@ -5,7 +5,6 @@ namespace Azure.AI.OpenAI { - /// Represents the request data used to generate images. public partial class ImageGenerationOptions { /// Initializes a new instance of ImageGenerationOptions. diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/OpenAIClient.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/OpenAIClient.cs index e46691d42ae88..eb6792e9753d7 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/OpenAIClient.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/OpenAIClient.cs @@ -4,16 +4,17 @@ #nullable disable using System; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Azure.Core.Sse; namespace Azure.AI.OpenAI { public partial class OpenAIClient { - private const int DefaultMaxCompletionsTokens = 100; private const string PublicOpenAIApiVersion = "1"; private const string PublicOpenAIEndpoint = $"https://api.openai.com/v{PublicOpenAIApiVersion}"; @@ -127,29 +128,26 @@ public OpenAIClient(string openAIApiKey) } /// Return textual completions as configured for a given prompt. - /// - /// Specifies either the model deployment name (when using Azure OpenAI) or model name (when using - /// non-Azure OpenAI) to use for this request. - /// /// /// The options for this completions request. /// /// The cancellation token to use. /// - /// or is null. + /// or is null. + /// + /// + /// is an empty string. /// public virtual Response GetCompletions( - string deploymentOrModelName, CompletionsOptions completionsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(completionsOptions, nameof(completionsOptions)); + Argument.AssertNotNullOrEmpty(completionsOptions.DeploymentName, nameof(completionsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetCompletions"); scope.Start(); - completionsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; completionsOptions.InternalShouldStreamResponse = null; RequestContent content = completionsOptions.ToRequestContent(); @@ -157,7 +155,7 @@ public virtual Response GetCompletions( try { - using HttpMessage message = CreatePostRequestMessage(deploymentOrModelName, "completions", content, context); + using HttpMessage message = CreatePostRequestMessage(completionsOptions, content, context); Response response = _pipeline.ProcessMessage(message, context, cancellationToken); return Response.FromValue(Completions.FromResponse(response), response); } @@ -168,30 +166,27 @@ public virtual Response GetCompletions( } } - /// - public virtual Response GetCompletions( - string deploymentOrModelName, - string prompt, - CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(prompt, nameof(prompt)); - CompletionsOptions simpleOptions = GetDefaultCompletionsOptions(prompt); - return GetCompletions(deploymentOrModelName, simpleOptions, cancellationToken); - } - - /// + /// Return textual completions as configured for a given prompt. + /// + /// The options for this completions request. + /// + /// The cancellation token to use. + /// + /// or is null. + /// + /// + /// is an empty string. + /// public virtual async Task> GetCompletionsAsync( - string deploymentOrModelName, CompletionsOptions completionsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(completionsOptions, nameof(completionsOptions)); + Argument.AssertNotNullOrEmpty(completionsOptions.DeploymentName, nameof(completionsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetCompletions"); scope.Start(); - completionsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; completionsOptions.InternalShouldStreamResponse = null; RequestContent content = completionsOptions.ToRequestContent(); @@ -199,7 +194,7 @@ public virtual async Task> GetCompletionsAsync( try { - using HttpMessage message = CreatePostRequestMessage(deploymentOrModelName, "completions", content, context); + using HttpMessage message = CreatePostRequestMessage(completionsOptions, content, context); Response response = await _pipeline.ProcessMessageAsync(message, context, cancellationToken) .ConfigureAwait(false); return Response.FromValue(Completions.FromResponse(response), response); @@ -211,48 +206,34 @@ public virtual async Task> GetCompletionsAsync( } } - /// - public virtual Task> GetCompletionsAsync( - string deploymentOrModelName, - string prompt, - CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(prompt, nameof(prompt)); - CompletionsOptions simpleOptions = GetDefaultCompletionsOptions(prompt); - return GetCompletionsAsync(deploymentOrModelName, simpleOptions, cancellationToken); - } - /// /// Begin a completions request and get an object that can stream response data as it becomes available. /// - /// - /// - /// /// the chat completions options for this completions request. /// /// a cancellation token that can be used to cancel the initial request or ongoing streaming operation. /// /// - /// or is null. + /// or is null. + /// + /// + /// is an empty string. /// - /// Service returned a non-success status code. /// - /// A response that, if the request was successful, includes a instance. + /// A response that, if the request was successful, may be asynchronously enumerated for + /// instances. /// - public virtual Response GetCompletionsStreaming( - string deploymentOrModelName, + [SuppressMessage("Usage", "AZC0015:Unexpected client method return type.")] + public virtual StreamingResponse GetCompletionsStreaming( CompletionsOptions completionsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(completionsOptions, nameof(completionsOptions)); + Argument.AssertNotNullOrEmpty(completionsOptions.DeploymentName, nameof(completionsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetCompletionsStreaming"); scope.Start(); - completionsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; completionsOptions.InternalShouldStreamResponse = true; RequestContent content = completionsOptions.ToRequestContent(); @@ -261,14 +242,15 @@ public virtual Response GetCompletionsStreaming( try { // Response value object takes IDisposable ownership of message - HttpMessage message = CreatePostRequestMessage( - deploymentOrModelName, - "completions", - content, - context); + HttpMessage message = CreatePostRequestMessage(completionsOptions, content, context); message.BufferResponse = false; Response baseResponse = _pipeline.ProcessMessage(message, context, cancellationToken); - return Response.FromValue(new StreamingCompletions(baseResponse), baseResponse); + return StreamingResponse.CreateFromResponse( + baseResponse, + (responseForEnumeration) => SseAsyncEnumerator.EnumerateFromSseStream( + responseForEnumeration.ContentStream, + Completions.DeserializeCompletions, + cancellationToken)); } catch (Exception e) { @@ -277,16 +259,31 @@ public virtual Response GetCompletionsStreaming( } } - /// - public virtual async Task> GetCompletionsStreamingAsync( - string deploymentOrModelName, + /// + /// Begin a completions request and get an object that can stream response data as it becomes available. + /// + /// the chat completions options for this completions request. + /// + /// a cancellation token that can be used to cancel the initial request or ongoing streaming operation. + /// + /// + /// or is null. + /// + /// + /// is an empty string. + /// + /// + /// A response that, if the request was successful, may be asynchronously enumerated for + /// instances. + /// + [SuppressMessage("Usage", "AZC0015:Unexpected client method return type.")] + public virtual async Task> GetCompletionsStreamingAsync( CompletionsOptions completionsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(completionsOptions, nameof(completionsOptions)); + Argument.AssertNotNullOrEmpty(completionsOptions.DeploymentName, nameof(completionsOptions.DeploymentName)); - completionsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; completionsOptions.InternalShouldStreamResponse = true; using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetCompletionsStreaming"); @@ -298,15 +295,16 @@ public virtual async Task> GetCompletionsStreamin try { // Response value object takes IDisposable ownership of message - HttpMessage message = CreatePostRequestMessage( - deploymentOrModelName, - "completions", - content, - context); + HttpMessage message = CreatePostRequestMessage(completionsOptions, content, context); message.BufferResponse = false; Response baseResponse = await _pipeline.ProcessMessageAsync(message, context, cancellationToken) .ConfigureAwait(false); - return Response.FromValue(new StreamingCompletions(baseResponse), baseResponse); + return StreamingResponse.CreateFromResponse( + baseResponse, + (responseForEnumeration) => SseAsyncEnumerator.EnumerateFromSseStream( + responseForEnumeration.ContentStream, + Completions.DeserializeCompletions, + cancellationToken)); } catch (Exception e) { @@ -316,42 +314,32 @@ public virtual async Task> GetCompletionsStreamin } /// Get chat completions for provided chat context messages. - /// - /// - /// /// The options for this chat completions request. /// The cancellation token to use. /// - /// or is null. + /// or is null. + /// + /// + /// is an empty string. /// public virtual Response GetChatCompletions( - string deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(chatCompletionsOptions, nameof(chatCompletionsOptions)); + Argument.AssertNotNullOrEmpty(chatCompletionsOptions.DeploymentName, nameof(chatCompletionsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetChatCompletions"); scope.Start(); - chatCompletionsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; chatCompletionsOptions.InternalShouldStreamResponse = null; - string operationPath = GetOperationPath(chatCompletionsOptions); - RequestContent content = chatCompletionsOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); try { - using HttpMessage message = CreatePostRequestMessage( - deploymentOrModelName, - operationPath, - content, - context); + using HttpMessage message = CreatePostRequestMessage(chatCompletionsOptions, content, context); Response response = _pipeline.ProcessMessage(message, context, cancellationToken); return Response.FromValue(ChatCompletions.FromResponse(response), response); } @@ -362,33 +350,33 @@ public virtual Response GetChatCompletions( } } - /// + /// Get chat completions for provided chat context messages. + /// The options for this chat completions request. + /// The cancellation token to use. + /// + /// or is null. + /// + /// + /// is an empty string. + /// public virtual async Task> GetChatCompletionsAsync( - string deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(chatCompletionsOptions, nameof(chatCompletionsOptions)); + Argument.AssertNotNullOrEmpty(chatCompletionsOptions.DeploymentName, nameof(chatCompletionsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetChatCompletions"); scope.Start(); - chatCompletionsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; chatCompletionsOptions.InternalShouldStreamResponse = null; - string operationPath = GetOperationPath(chatCompletionsOptions); - RequestContent content = chatCompletionsOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); try { - using HttpMessage message = CreatePostRequestMessage( - deploymentOrModelName, - operationPath, - content, - context); + using HttpMessage message = CreatePostRequestMessage(chatCompletionsOptions, content, context); Response response = await _pipeline.ProcessMessageAsync(message, context, cancellationToken) .ConfigureAwait(false); return Response.FromValue(ChatCompletions.FromResponse(response), response); @@ -404,11 +392,6 @@ public virtual async Task> GetChatCompletionsAsync( /// Begin a chat completions request and get an object that can stream response data as it becomes /// available. /// - /// - /// - /// /// /// the chat completions options for this chat completions request. /// @@ -416,40 +399,41 @@ public virtual async Task> GetChatCompletionsAsync( /// a cancellation token that can be used to cancel the initial request or ongoing streaming operation. /// /// - /// or is null. + /// or is null. + /// + /// + /// is an empty string. /// - /// Service returned a non-success status code. /// The response returned from the service. - public virtual Response GetChatCompletionsStreaming( - string deploymentOrModelName, + [SuppressMessage("Usage", "AZC0015:Unexpected client method return type.")] + public virtual StreamingResponse GetChatCompletionsStreaming( ChatCompletionsOptions chatCompletionsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(chatCompletionsOptions, nameof(chatCompletionsOptions)); + Argument.AssertNotNullOrEmpty(chatCompletionsOptions.DeploymentName, nameof(chatCompletionsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetChatCompletionsStreaming"); scope.Start(); - chatCompletionsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; chatCompletionsOptions.InternalShouldStreamResponse = true; - string operationPath = GetOperationPath(chatCompletionsOptions); - RequestContent content = chatCompletionsOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); try { // Response value object takes IDisposable ownership of message - HttpMessage message = CreatePostRequestMessage( - deploymentOrModelName, - operationPath, - content, - context); + HttpMessage message = CreatePostRequestMessage(chatCompletionsOptions, content, context); message.BufferResponse = false; Response baseResponse = _pipeline.ProcessMessage(message, context, cancellationToken); - return Response.FromValue(new StreamingChatCompletions(baseResponse), baseResponse); + return StreamingResponse.CreateFromResponse( + baseResponse, + (responseForEnumeration) + => SseAsyncEnumerator.EnumerateFromSseStream( + responseForEnumeration.ContentStream, + StreamingChatCompletionsUpdate.DeserializeStreamingChatCompletionsUpdates, + cancellationToken)); } catch (Exception e) { @@ -458,40 +442,58 @@ public virtual Response GetChatCompletionsStreaming( } } - /// - public virtual async Task> GetChatCompletionsStreamingAsync( - string deploymentOrModelName, + /// + /// Begin a chat completions request and get an object that can stream response data as it becomes + /// available. + /// + /// + /// the chat completions options for this chat completions request. + /// + /// + /// a cancellation token that can be used to cancel the initial request or ongoing streaming operation. + /// + /// + /// or is null. + /// + /// + /// is an empty string. + /// + /// + /// A response that, if the request was successful, may be asynchronously enumerated for + /// instances. + /// + [SuppressMessage("Usage", "AZC0015:Unexpected client method return type.")] + public virtual async Task> GetChatCompletionsStreamingAsync( ChatCompletionsOptions chatCompletionsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(chatCompletionsOptions, nameof(chatCompletionsOptions)); + Argument.AssertNotNullOrEmpty(chatCompletionsOptions.DeploymentName, nameof(chatCompletionsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetChatCompletionsStreaming"); scope.Start(); - chatCompletionsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; chatCompletionsOptions.InternalShouldStreamResponse = true; - string operationPath = GetOperationPath(chatCompletionsOptions); - RequestContent content = chatCompletionsOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); try { // Response value object takes IDisposable ownership of message - HttpMessage message = CreatePostRequestMessage( - deploymentOrModelName, - operationPath, - content, - context); + HttpMessage message = CreatePostRequestMessage(chatCompletionsOptions, content, context); message.BufferResponse = false; Response baseResponse = await _pipeline.ProcessMessageAsync( message, context, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new StreamingChatCompletions(baseResponse), baseResponse); + return StreamingResponse.CreateFromResponse( + baseResponse, + (responseForEnumeration) + => SseAsyncEnumerator.EnumerateFromSseStream( + responseForEnumeration.ContentStream, + StreamingChatCompletionsUpdate.DeserializeStreamingChatCompletionsUpdates, + cancellationToken)); } catch (Exception e) { @@ -501,38 +503,30 @@ public virtual async Task> GetChatCompletions } /// Return the computed embeddings for a given prompt. - /// - /// - /// /// The options for this embeddings request. /// The cancellation token to use. /// - /// or is null. + /// or is null. /// /// - /// is an empty string and was expected to be non-empty. + /// is an empty string. /// public virtual Response GetEmbeddings( - string deploymentOrModelName, EmbeddingsOptions embeddingsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(embeddingsOptions, nameof(embeddingsOptions)); + Argument.AssertNotNullOrEmpty(embeddingsOptions.DeploymentName, nameof(embeddingsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetEmbeddings"); scope.Start(); - embeddingsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; - RequestContent content = embeddingsOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); try { - HttpMessage message = CreatePostRequestMessage(deploymentOrModelName, "embeddings", content, context); + HttpMessage message = CreatePostRequestMessage(embeddingsOptions, content, context); Response response = _pipeline.ProcessMessage(message, context, cancellationToken); return Response.FromValue(Embeddings.FromResponse(response), response); } @@ -543,26 +537,31 @@ public virtual Response GetEmbeddings( } } - /// + /// Return the computed embeddings for a given prompt. + /// The options for this embeddings request. + /// The cancellation token to use. + /// + /// or is null. + /// + /// + /// is an empty string. + /// public virtual async Task> GetEmbeddingsAsync( - string deploymentOrModelName, EmbeddingsOptions embeddingsOptions, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deploymentOrModelName, nameof(deploymentOrModelName)); Argument.AssertNotNull(embeddingsOptions, nameof(embeddingsOptions)); + Argument.AssertNotNullOrEmpty(embeddingsOptions.DeploymentName, nameof(embeddingsOptions.DeploymentName)); using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetEmbeddings"); scope.Start(); - embeddingsOptions.InternalNonAzureModelName = _isConfiguredForAzureOpenAI ? null : deploymentOrModelName; - RequestContent content = embeddingsOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); try { - HttpMessage message = CreatePostRequestMessage(deploymentOrModelName, "embeddings", content, context); + HttpMessage message = CreatePostRequestMessage(embeddingsOptions, content, context); Response response = await _pipeline.ProcessMessageAsync(message, context, cancellationToken) .ConfigureAwait(false); return Response.FromValue(Embeddings.FromResponse(response), response); @@ -584,6 +583,9 @@ public virtual async Task> GetEmbeddingsAsync( /// /// An optional cancellation token that may be used to abort an ongoing request. /// + /// + /// is null. + /// /// /// The response information for the image generations request. /// @@ -643,6 +645,9 @@ Operation imagesOperation /// /// An optional cancellation token that may be used to abort an ongoing request. /// + /// + /// is null. + /// /// /// The response information for the image generations request. /// @@ -695,32 +700,35 @@ Operation imagesOperation } /// Transcribes audio into the input language. - /// Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request. /// /// Transcription request. /// Requesting format 'json' will result on only the 'text' field being set. /// For more output data use 'verbose_json. /// /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetAudioTranscriptionAsync(string deploymentId, AudioTranscriptionOptions audioTranscriptionOptions, CancellationToken cancellationToken = default) + /// + /// or is null. + /// + /// + /// is an empty string. + /// + public virtual async Task> GetAudioTranscriptionAsync( + AudioTranscriptionOptions audioTranscriptionOptions, + CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); Argument.AssertNotNull(audioTranscriptionOptions, nameof(audioTranscriptionOptions)); + Argument.AssertNotNullOrEmpty(audioTranscriptionOptions.DeploymentName, nameof(audioTranscriptionOptions.DeploymentName)); - using var scope = ClientDiagnostics.CreateScope("OpenAIClient.GetAudioTranscription"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetAudioTranscription"); scope.Start(); - audioTranscriptionOptions.InternalNonAzureModelName = deploymentId; - RequestContent content = audioTranscriptionOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); Response rawResponse = default; try { - using HttpMessage message = CreateGetAudioTranscriptionRequest(deploymentId, content, context); + using HttpMessage message = CreateGetAudioTranscriptionRequest(audioTranscriptionOptions, content, context); rawResponse = await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -733,32 +741,35 @@ public virtual async Task> GetAudioTranscriptionAsy } /// Transcribes audio into the input language. - /// Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request. /// /// Transcription request. /// Requesting format 'json' will result on only the 'text' field being set. /// For more output data use 'verbose_json. /// /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetAudioTranscription(string deploymentId, AudioTranscriptionOptions audioTranscriptionOptions, CancellationToken cancellationToken = default) + /// + /// or is null. + /// + /// + /// is an empty string. + /// + public virtual Response GetAudioTranscription( + AudioTranscriptionOptions audioTranscriptionOptions, + CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); Argument.AssertNotNull(audioTranscriptionOptions, nameof(audioTranscriptionOptions)); + Argument.AssertNotNullOrEmpty(audioTranscriptionOptions.DeploymentName, nameof(audioTranscriptionOptions.DeploymentName)); - using var scope = ClientDiagnostics.CreateScope("OpenAIClient.GetAudioTranscription"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetAudioTranscription"); scope.Start(); - audioTranscriptionOptions.InternalNonAzureModelName = deploymentId; - RequestContent content = audioTranscriptionOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); Response rawResponse = default; try { - using HttpMessage message = CreateGetAudioTranscriptionRequest(deploymentId, content, context); + using HttpMessage message = CreateGetAudioTranscriptionRequest(audioTranscriptionOptions, content, context); rawResponse = _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -771,35 +782,35 @@ public virtual Response GetAudioTranscription(string deploym } /// Transcribes and translates input audio into English text. - /// Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request. /// /// Translation request. /// Requesting format 'json' will result on only the 'text' field being set. /// For more output data use 'verbose_json. /// /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetAudioTranslationAsync(string deploymentId, AudioTranslationOptions audioTranslationOptions, CancellationToken cancellationToken = default) + /// + /// or is null. + /// + /// + /// is an empty string. + /// + public virtual async Task> GetAudioTranslationAsync( + AudioTranslationOptions audioTranslationOptions, + CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); Argument.AssertNotNull(audioTranslationOptions, nameof(audioTranslationOptions)); + Argument.AssertNotNullOrEmpty(audioTranslationOptions.DeploymentName, nameof(audioTranslationOptions.DeploymentName)); - // Custom code: merely linking the deployment ID (== model name) into the request body for non-Azure use - audioTranslationOptions.InternalNonAzureModelName = deploymentId; - - using var scope = ClientDiagnostics.CreateScope("OpenAIClient.GetAudioTranslation"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetAudioTranslation"); scope.Start(); - audioTranslationOptions.InternalNonAzureModelName = deploymentId; - RequestContent content = audioTranslationOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); Response rawResponse = default; try { - using HttpMessage message = CreateGetAudioTranslationRequest(deploymentId, content, context); + using HttpMessage message = CreateGetAudioTranslationRequest(audioTranslationOptions, content, context); rawResponse = await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -812,32 +823,35 @@ public virtual async Task> GetAudioTranslationAsync(s } /// Transcribes and translates input audio into English text. - /// Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request. /// /// Translation request. /// Requesting format 'json' will result on only the 'text' field being set. /// For more output data use 'verbose_json. /// /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetAudioTranslation(string deploymentId, AudioTranslationOptions audioTranslationOptions, CancellationToken cancellationToken = default) + /// + /// or is null. + /// + /// + /// is an empty string. + /// + public virtual Response GetAudioTranslation( + AudioTranslationOptions audioTranslationOptions, + CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); Argument.AssertNotNull(audioTranslationOptions, nameof(audioTranslationOptions)); + Argument.AssertNotNullOrEmpty(audioTranslationOptions.DeploymentName, nameof(audioTranslationOptions.DeploymentName)); - using var scope = ClientDiagnostics.CreateScope("OpenAIClient.GetAudioTranslation"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("OpenAIClient.GetAudioTranslation"); scope.Start(); - audioTranslationOptions.InternalNonAzureModelName = deploymentId; - RequestContent content = audioTranslationOptions.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); Response rawResponse = default; try { - using HttpMessage message = CreateGetAudioTranslationRequest(deploymentId, content, context); + using HttpMessage message = CreateGetAudioTranslationRequest(audioTranslationOptions, content, context); rawResponse = _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -868,6 +882,29 @@ internal RequestUriBuilder GetUri(string deploymentOrModelName, string operation return uri; } + internal HttpMessage CreatePostRequestMessage( + CompletionsOptions completionsOptions, + RequestContent content, + RequestContext context) + => CreatePostRequestMessage(completionsOptions.DeploymentName, "completions", content, context); + + internal HttpMessage CreatePostRequestMessage( + ChatCompletionsOptions chatCompletionsOptions, + RequestContent content, + RequestContext context) + { + string operationPath = chatCompletionsOptions.AzureExtensionsOptions != null + ? "extensions/chat/completions" + : "chat/completions"; + return CreatePostRequestMessage(chatCompletionsOptions.DeploymentName, operationPath, content, context); + } + + internal HttpMessage CreatePostRequestMessage( + EmbeddingsOptions embeddingsOptions, + RequestContent content, + RequestContext context) + => CreatePostRequestMessage(embeddingsOptions.DeploymentName, "embeddings", content, context); + internal HttpMessage CreatePostRequestMessage( string deploymentOrModelName, string operationPath, @@ -890,41 +927,30 @@ private static TokenCredential CreateDelegatedToken(string token) return DelegatedTokenCredential.Create((_, _) => accessToken); } - private static CompletionsOptions GetDefaultCompletionsOptions(string prompt) - { - return new CompletionsOptions() - { - Prompts = - { - prompt, - }, - MaxTokens = DefaultMaxCompletionsTokens, - }; - } - - private static string GetOperationPath(ChatCompletionsOptions chatCompletionsOptions) - => chatCompletionsOptions.AzureExtensionsOptions != null - ? "extensions/chat/completions" - : "chat/completions"; - - internal HttpMessage CreateGetAudioTranscriptionRequest(string deploymentId, RequestContent content, RequestContext context) + internal HttpMessage CreateGetAudioTranscriptionRequest( + AudioTranscriptionOptions audioTranscriptionOptions, + RequestContent content, + RequestContext context) { HttpMessage message = _pipeline.CreateMessage(context, ResponseClassifier200); Request request = message.Request; request.Method = RequestMethod.Post; - request.Uri = GetUri(deploymentId, "audio/transcriptions"); + request.Uri = GetUri(audioTranscriptionOptions.DeploymentName, "audio/transcriptions"); request.Content = content; string boundary = (content as MultipartFormDataRequestContent).Boundary; request.Headers.Add("content-type", $"multipart/form-data; boundary={boundary}"); return message; } - internal HttpMessage CreateGetAudioTranslationRequest(string deploymentId, RequestContent content, RequestContext context) + internal HttpMessage CreateGetAudioTranslationRequest( + AudioTranslationOptions audioTranslationOptions, + RequestContent content, + RequestContext context) { HttpMessage message = _pipeline.CreateMessage(context, ResponseClassifier200); Request request = message.Request; request.Method = RequestMethod.Post; - request.Uri = GetUri(deploymentId, "audio/translations"); + request.Uri = GetUri(audioTranslationOptions.DeploymentName, "audio/translations"); request.Content = content; string boundary = (content as MultipartFormDataRequestContent).Boundary; request.Headers.Add("content-type", $"multipart/form-data; boundary={boundary}"); diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatChoice.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatChoice.cs deleted file mode 100644 index 0a631b29116fc..0000000000000 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatChoice.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading; - -namespace Azure.AI.OpenAI -{ - public class StreamingChatChoice - { - private readonly IList _baseChoices; - private readonly object _baseChoicesLock = new object(); - private readonly AsyncAutoResetEvent _updateAvailableEvent; - - /// - /// Gets the response index associated with this StreamingChoice as represented relative to other Choices - /// in the same Completions response. - /// - /// - /// Indices may be used to correlate individual Choices within a Completions result to their configured - /// prompts as provided in the request. As an example, if two Choices are requested for each of four prompts, - /// the Choices with indices 0 and 1 will correspond to the first prompt, 2 and 3 to the second, and so on. - /// - public int? Index => GetLocked(() => _baseChoices.Last().Index); - - /// - /// Gets a value representing why response generation ended when producing this StreamingChoice. - /// - /// - /// Normal termination typically provides "stop" and encountering token limits in a request typically - /// provides "length." If no value is present, this StreamingChoice is still in progress. - /// - public CompletionsFinishReason? FinishReason => GetLocked(() => _baseChoices.Last().FinishReason); - - /// - /// Information about the content filtering category (hate, sexual, violence, self_harm), if it - /// has been detected, as well as the severity level (very_low, low, medium, high-scale that - /// determines the intensity and risk level of harmful content) and if it has been filtered or not. - /// - public ContentFilterResults ContentFilterResults - => GetLocked(() => - { - return _baseChoices - .LastOrDefault(baseChoice => baseChoice.ContentFilterResults != null && baseChoice.ContentFilterResults.Hate != null) - ?.ContentFilterResults; - }); - - internal ChatMessage StreamingDeltaMessage { get; set; } - - private bool _isFinishedStreaming { get; set; } = false; - - private Exception _pumpException { get; set; } - - internal StreamingChatChoice(ChatChoice originalBaseChoice) - { - _baseChoices = new List() { originalBaseChoice }; - _updateAvailableEvent = new AsyncAutoResetEvent(); - } - - internal void UpdateFromEventStreamChatChoice(ChatChoice streamingChatChoice) - { - lock (_baseChoicesLock) - { - _baseChoices.Add(streamingChatChoice); - } - if (streamingChatChoice.FinishReason != null) - { - EnsureFinishStreaming(); - } - _updateAvailableEvent.Set(); - } - - /// - /// Gets an asynchronous enumeration that will retrieve the Completion text associated with this Choice as it - /// becomes available. Each string will provide one or more tokens, including whitespace, and a full - /// concatenation of all enumerated strings is functionally equivalent to the single Text property on a - /// non-streaming Completions Choice. - /// - /// - /// - public async IAsyncEnumerable GetMessageStreaming( - [EnumeratorCancellation] CancellationToken cancellationToken = default) - { - bool isFinalIndex = false; - for (int i = 0; !isFinalIndex && !cancellationToken.IsCancellationRequested; i++) - { - bool doneWaiting = false; - while (!doneWaiting) - { - lock (_baseChoicesLock) - { - ChatChoice mostRecentChoice = _baseChoices.Last(); - - doneWaiting = _isFinishedStreaming || i < _baseChoices.Count; - isFinalIndex = _isFinishedStreaming && i >= _baseChoices.Count - 1; - } - - if (!doneWaiting) - { - await _updateAvailableEvent.WaitAsync(cancellationToken).ConfigureAwait(false); - } - } - - if (_pumpException != null) - { - throw _pumpException; - } - - ChatMessage message = null; - - lock (_baseChoicesLock) - { - if (i < _baseChoices.Count) - { - message = _baseChoices[i].InternalStreamingDeltaMessage; - message.Role = _baseChoices.First().InternalStreamingDeltaMessage.Role; - } - } - - if (message != null) - { - yield return message; - } - } - } - - internal void EnsureFinishStreaming(Exception pumpException = null) - { - if (!_isFinishedStreaming) - { - _isFinishedStreaming = true; - _pumpException = pumpException; - _updateAvailableEvent.Set(); - } - } - - private T GetLocked(Func func) - { - lock (_baseChoicesLock) - { - return func.Invoke(); - } - } - } -} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletions.cs deleted file mode 100644 index 824a4bd8a0ec3..0000000000000 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletions.cs +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core.Sse; - -namespace Azure.AI.OpenAI -{ - public class StreamingChatCompletions : IDisposable - { - private readonly Response _baseResponse; - private readonly SseReader _baseResponseReader; - private readonly IList _baseChatCompletions; - private readonly object _baseCompletionsLock = new(); - private readonly IList _streamingChatChoices; - private readonly object _streamingChoicesLock = new(); - private readonly AsyncAutoResetEvent _updateAvailableEvent; - private bool _streamingTaskComplete; - private bool _disposedValue; - private Exception _pumpException; - - /// - /// Gets the earliest Completion creation timestamp associated with this streamed response. - /// - public DateTimeOffset Created => GetLocked(() => _baseChatCompletions.Last().Created); - - /// - /// Gets the unique identifier associated with this streaming Completions response. - /// - public string Id => GetLocked(() => _baseChatCompletions.Last().Id); - - /// - /// Content filtering results for zero or more prompts in the request. In a streaming request, - /// results for different prompts may arrive at different times or in different orders. - /// - public IReadOnlyList PromptFilterResults - => GetLocked(() => - { - return _baseChatCompletions.Where(singleBaseChatCompletion => singleBaseChatCompletion.PromptFilterResults != null) - .SelectMany(singleBaseChatCompletion => singleBaseChatCompletion.PromptFilterResults) - .OrderBy(singleBaseCompletion => singleBaseCompletion.PromptIndex) - .ToList(); - }); - - internal StreamingChatCompletions(Response response) - { - _baseResponse = response; - _baseResponseReader = new SseReader(response.ContentStream); - _updateAvailableEvent = new AsyncAutoResetEvent(); - _baseChatCompletions = new List(); - _streamingChatChoices = new List(); - _streamingTaskComplete = false; - _ = Task.Run(async () => - { - try - { - while (true) - { - SseLine? sseEvent = await _baseResponseReader.TryReadSingleFieldEventAsync().ConfigureAwait(false); - if (sseEvent == null) - { - _baseResponse.ContentStream?.Dispose(); - break; - } - - ReadOnlyMemory name = sseEvent.Value.FieldName; - if (!name.Span.SequenceEqual("data".AsSpan())) - throw new InvalidDataException(); - - ReadOnlyMemory value = sseEvent.Value.FieldValue; - if (value.Span.SequenceEqual("[DONE]".AsSpan())) - { - _baseResponse.ContentStream?.Dispose(); - break; - } - - JsonDocument sseMessageJson = JsonDocument.Parse(sseEvent.Value.FieldValue); - ChatCompletions chatCompletionsFromSse = ChatCompletions.DeserializeChatCompletions(sseMessageJson.RootElement); - - lock (_baseCompletionsLock) - { - _baseChatCompletions.Add(chatCompletionsFromSse); - } - - foreach (ChatChoice chatChoiceFromSse in chatCompletionsFromSse.Choices) - { - lock (_streamingChoicesLock) - { - StreamingChatChoice existingStreamingChoice = _streamingChatChoices - .FirstOrDefault(chatChoice => chatChoice.Index == chatChoiceFromSse.Index); - if (existingStreamingChoice == null) - { - StreamingChatChoice newStreamingChatChoice = new(chatChoiceFromSse); - _streamingChatChoices.Add(newStreamingChatChoice); - _updateAvailableEvent.Set(); - } - else - { - existingStreamingChoice.UpdateFromEventStreamChatChoice(chatChoiceFromSse); - } - } - } - } - } - catch (Exception pumpException) - { - _pumpException = pumpException; - } - finally - { - lock (_streamingChoicesLock) - { - // If anything went wrong and a StreamingChatChoice didn't naturally determine it was complete - // based on a non-null finish reason, ensure that nothing's left incomplete (and potentially - // hanging!) now. - foreach (StreamingChatChoice streamingChatChoice in _streamingChatChoices) - { - streamingChatChoice.EnsureFinishStreaming(_pumpException); - } - } - _streamingTaskComplete = true; - _updateAvailableEvent.Set(); - } - }); - } - - public async IAsyncEnumerable GetChoicesStreaming( - [EnumeratorCancellation] CancellationToken cancellationToken = default) - { - bool isFinalIndex = false; - for (int i = 0; !isFinalIndex && !cancellationToken.IsCancellationRequested; i++) - { - bool doneWaiting = false; - while (!doneWaiting) - { - lock (_streamingChoicesLock) - { - doneWaiting = _streamingTaskComplete || i < _streamingChatChoices.Count; - isFinalIndex = _streamingTaskComplete && i >= _streamingChatChoices.Count - 1; - } - - if (!doneWaiting) - { - await _updateAvailableEvent.WaitAsync(cancellationToken).ConfigureAwait(false); - } - } - - if (_pumpException != null) - { - throw _pumpException; - } - - StreamingChatChoice newChatChoice = null; - lock (_streamingChoicesLock) - { - if (i < _streamingChatChoices.Count) - { - newChatChoice = _streamingChatChoices[i]; - } - } - - if (newChatChoice != null) - { - yield return newChatChoice; - } - } - } - - internal StreamingChatCompletions( - ChatCompletions baseChatCompletions = null, - List streamingChatChoices = null) - { - _baseChatCompletions = new List(); - _baseChatCompletions.Add(baseChatCompletions); - _streamingChatChoices = streamingChatChoices; - _streamingTaskComplete = true; - } - - public void Dispose() - { - Dispose(disposing: true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!_disposedValue) - { - if (disposing) - { - _baseResponseReader.Dispose(); - } - - _disposedValue = true; - } - } - - private T GetLocked(Func func) - { - lock (_baseCompletionsLock) - { - return func.Invoke(); - } - } - } -} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletionsUpdate.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletionsUpdate.Serialization.cs new file mode 100644 index 0000000000000..4d11ca2a15229 --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletionsUpdate.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Threading; +using Azure.Core; + +namespace Azure.AI.OpenAI +{ + public partial class StreamingChatCompletionsUpdate + { + internal static List DeserializeStreamingChatCompletionsUpdates(JsonElement element) + { + var results = new List(); + if (element.ValueKind == JsonValueKind.Null) + { + return results; + } + string id = default; + DateTimeOffset created = default; + AzureChatExtensionsMessageContext azureExtensionsContext = null; + ContentFilterResults requestContentFilterResults = null; + foreach (JsonProperty property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("created"u8)) + { + created = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + continue; + } + // CUSTOM CODE NOTE: temporary, custom handling of forked keys for prompt filter results + if (property.NameEquals("prompt_annotations"u8) || property.NameEquals("prompt_filter_results")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + PromptFilterResult promptFilterResult = PromptFilterResult.DeserializePromptFilterResult(item); + requestContentFilterResults = promptFilterResult.ContentFilterResults; + } + continue; + } + if (property.NameEquals("choices"u8)) + { + foreach (JsonElement choiceElement in property.Value.EnumerateArray()) + { + ChatRole? role = null; + string contentUpdate = null; + string functionName = null; + string authorName = null; + string functionArgumentsUpdate = null; + int choiceIndex = 0; + CompletionsFinishReason? finishReason = null; + ContentFilterResults responseContentFilterResults = null; + foreach (JsonProperty choiceProperty in choiceElement.EnumerateObject()) + { + if (choiceProperty.NameEquals("index"u8)) + { + choiceIndex = choiceProperty.Value.GetInt32(); + continue; + } + if (choiceProperty.NameEquals("finish_reason"u8)) + { + finishReason = new CompletionsFinishReason(choiceProperty.Value.GetString()); + continue; + } + if (choiceProperty.NameEquals("delta"u8)) + { + foreach (JsonProperty deltaProperty in choiceProperty.Value.EnumerateObject()) + { + if (deltaProperty.NameEquals("role"u8)) + { + role = deltaProperty.Value.GetString(); + continue; + } + if (deltaProperty.NameEquals("name"u8)) + { + authorName = deltaProperty.Value.GetString(); + continue; + } + if (deltaProperty.NameEquals("content"u8)) + { + contentUpdate = deltaProperty.Value.GetString(); + continue; + } + if (deltaProperty.NameEquals("function_call"u8)) + { + foreach (JsonProperty functionProperty in deltaProperty.Value.EnumerateObject()) + { + if (functionProperty.NameEquals("name"u8)) + { + functionName = functionProperty.Value.GetString(); + continue; + } + if (functionProperty.NameEquals("arguments"u8)) + { + functionArgumentsUpdate = functionProperty.Value.GetString(); + } + } + } + if (deltaProperty.NameEquals("context"u8)) + { + azureExtensionsContext = AzureChatExtensionsMessageContext + .DeserializeAzureChatExtensionsMessageContext(deltaProperty.Value); + continue; + } + } + } + if (choiceProperty.NameEquals("content_filter_results"u8)) + { + if (choiceProperty.Value.EnumerateObject().Any()) + { + responseContentFilterResults = ContentFilterResults.DeserializeContentFilterResults(choiceProperty.Value); + } + continue; + } + } + if (requestContentFilterResults is not null || responseContentFilterResults is not null) + { + azureExtensionsContext ??= new AzureChatExtensionsMessageContext(); + azureExtensionsContext.RequestContentFilterResults = requestContentFilterResults; + azureExtensionsContext.ResponseContentFilterResults = responseContentFilterResults; + } + results.Add(new StreamingChatCompletionsUpdate( + id, + created, + choiceIndex, + role, + authorName, + contentUpdate, + finishReason, + functionName, + functionArgumentsUpdate, + azureExtensionsContext)); + } + continue; + } + } + if (results.Count == 0) + { + if (requestContentFilterResults is not null) + { + azureExtensionsContext ??= new AzureChatExtensionsMessageContext() + { + RequestContentFilterResults = requestContentFilterResults, + }; + } + results.Add(new StreamingChatCompletionsUpdate(id, created, azureExtensionsContext: azureExtensionsContext)); + } + return results; + } + } +} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletionsUpdate.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletionsUpdate.cs new file mode 100644 index 0000000000000..7232ca9845853 --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChatCompletionsUpdate.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Threading; +using Azure.Core.Sse; + +namespace Azure.AI.OpenAI +{ + /// + /// Represents an incremental update to a streamed Chat Completions response. + /// + public partial class StreamingChatCompletionsUpdate + { + /// + /// Gets a unique identifier associated with this streamed Chat Completions response. + /// + /// + /// + /// Corresponds to $.id in the underlying REST schema. + /// + /// When using Azure OpenAI, note that the values of and may not be + /// populated until the first containing role, content, or + /// function information. + /// + public string Id { get; } + + /// + /// Gets the first timestamp associated with generation activity for this completions response, + /// represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. + /// + /// + /// + /// Corresponds to $.created in the underlying REST schema. + /// + /// When using Azure OpenAI, note that the values of and may not be + /// populated until the first containing role, content, or + /// function information. + /// + public DateTimeOffset Created { get; } + + /// + /// Gets the associated with this update. + /// + /// + /// + /// Corresponds to e.g. $.choices[0].delta.role in the underlying REST schema. + /// + /// assignment typically occurs in a single update across a streamed Chat Completions + /// choice and the value should be considered to be persist for all subsequent updates without a + /// that bear the same . + /// + public ChatRole? Role { get; } + + /// + /// Gets the content fragment associated with this update. + /// + /// + /// + /// Corresponds to e.g. $.choices[0].delta.content in the underlying REST schema. + /// + /// Each update contains only a small number of tokens. When presenting or reconstituting a full, streamed + /// response, all values for the same should be + /// combined. + /// + public string ContentUpdate { get; } + + /// + /// Gets the name of a function to be called. + /// + /// + /// Corresponds to e.g. $.choices[0].delta.function_call.name in the underlying REST schema. + /// + public string FunctionName { get; } + + /// + /// Gets a function arguments fragment associated with this update. + /// + /// + /// + /// Corresponds to e.g. $.choices[0].delta.function_call.arguments in the underlying REST schema. + /// + /// + /// + /// Each update contains only a small number of tokens. When presenting or reconstituting a full, streamed + /// arguments body, all values for the same + /// should be combined. + /// + /// + /// + /// As is the case for non-streaming , the content provided for function + /// arguments is not guaranteed to be well-formed JSON or to contain expected data. Callers should validate + /// function arguments before using them. + /// + /// + public string FunctionArgumentsUpdate { get; } + + /// + /// Gets an optional name associated with the role of the streamed Chat Completion, typically as previously + /// specified in a system message. + /// + /// + /// + /// Corresponds to e.g. $.choices[0].delta.name in the underlying REST schema. + /// + /// + public string AuthorName { get; } + + /// + /// Gets the associated with this update. + /// + /// + /// + /// Corresponds to e.g. $.choices[0].finish_reason in the underlying REST schema. + /// + /// + /// assignment typically appears in the final streamed update message associated + /// with a choice. + /// + /// + public CompletionsFinishReason? FinishReason { get; } + + /// + /// Gets the choice index associated with this streamed update. + /// + /// + /// + /// Corresponds to e.g. $.choices[0].index in the underlying REST schema. + /// + /// + /// Unless a value greater than one was provided to ('n' in + /// REST), only one choice will be generated. In that case, this value will always be 0 and may not need to be + /// considered. + /// + /// + /// When providing a value greater than one to , this index + /// identifies which logical response the payload is associated with. In the event that a single underlying + /// server-sent event contains multiple choices, multiple instances of + /// will be created. + /// + /// + public int? ChoiceIndex { get; } + + /// + /// Gets additional data associated with this update that is specific to use with Azure OpenAI and that + /// service's extended capabilities. + /// + public AzureChatExtensionsMessageContext AzureExtensionsContext { get; } + + internal StreamingChatCompletionsUpdate( + string id, + DateTimeOffset created, + int? choiceIndex = null, + ChatRole? role = null, + string authorName = null, + string contentUpdate = null, + CompletionsFinishReason? finishReason = null, + string functionName = null, + string functionArgumentsUpdate = null, + AzureChatExtensionsMessageContext azureExtensionsContext = null) + { + Id = id; + Created = created; + ChoiceIndex = choiceIndex; + Role = role; + AuthorName = authorName; + ContentUpdate = contentUpdate; + FinishReason = finishReason; + FunctionName = functionName; + FunctionArgumentsUpdate = functionArgumentsUpdate; + AzureExtensionsContext = azureExtensionsContext; + } + } +} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChoice.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChoice.cs deleted file mode 100644 index 51fbde8ed9a60..0000000000000 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingChoice.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading; - -namespace Azure.AI.OpenAI -{ - public class StreamingChoice - { - private readonly IList _baseChoices; - private readonly object _baseChoicesLock = new object(); - private readonly AsyncAutoResetEvent _updateAvailableEvent; - - /// - /// Gets the response index associated with this StreamingChoice as represented relative to other Choices - /// in the same Completions response. - /// - /// - /// Indices may be used to correlate individual Choices within a Completions result to their configured - /// prompts as provided in the request. As an example, if two Choices are requested for each of four prompts, - /// the Choices with indices 0 and 1 will correspond to the first prompt, 2 and 3 to the second, and so on. - /// - public int? Index => GetLocked(() => _baseChoices.Last().Index); - - /// - /// Gets a value representing why response generation ended when producing this StreamingChoice. - /// - /// - /// Normal termination typically provides "stop" and encountering token limits in a request typically - /// provides "length." If no value is present, this StreamingChoice is still in progress. - /// - public CompletionsFinishReason? FinishReason => GetLocked(() => _baseChoices.Last().FinishReason); - - /// - /// Information about the content filtering category (hate, sexual, violence, self_harm), if it - /// has been detected, as well as the severity level (very_low, low, medium, high-scale that - /// determines the intensity and risk level of harmful content) and if it has been filtered or not. - /// - public ContentFilterResults ContentFilterResults - => GetLocked(() => - { - return _baseChoices - .LastOrDefault(baseChoice => baseChoice.ContentFilterResults != null && baseChoice.ContentFilterResults.Hate != null) - ?.ContentFilterResults; - }); - - private bool _isFinishedStreaming { get; set; } = false; - - private Exception _pumpException { get; set; } - - /// - /// Gets the log probabilities associated with tokens in this Choice. - /// - public CompletionsLogProbabilityModel LogProbabilityModel - => GetLocked(() => _baseChoices.Last().LogProbabilityModel); - - internal StreamingChoice(Choice originalBaseChoice) - { - _baseChoices = new List() { originalBaseChoice }; - _updateAvailableEvent = new AsyncAutoResetEvent(); - } - - internal void UpdateFromEventStreamChoice(Choice streamingChoice) - { - lock (_baseChoicesLock) - { - _baseChoices.Add(streamingChoice); - } - if (streamingChoice.FinishReason != null) - { - EnsureFinishStreaming(); - } - _updateAvailableEvent.Set(); - } - - /// - /// Gets an asynchronous enumeration that will retrieve the Completion text associated with this Choice as it - /// becomes available. Each string will provide one or more tokens, including whitespace, and a full - /// concatenation of all enumerated strings is functionally equivalent to the single Text property on a - /// non-streaming Completions Choice. - /// - /// - /// - public async IAsyncEnumerable GetTextStreaming( - [EnumeratorCancellation] CancellationToken cancellationToken = default) - { - bool isFinalIndex = false; - for (int i = 0; !isFinalIndex && !cancellationToken.IsCancellationRequested; i++) - { - bool doneWaiting = false; - while (!doneWaiting) - { - lock (_baseChoicesLock) - { - Choice mostRecentChoice = _baseChoices.Last(); - - doneWaiting = _isFinishedStreaming || i < _baseChoices.Count; - isFinalIndex = _isFinishedStreaming && i >= _baseChoices.Count - 1; - } - - if (!doneWaiting) - { - await _updateAvailableEvent.WaitAsync(cancellationToken).ConfigureAwait(false); - } - } - - if (_pumpException != null) - { - throw _pumpException; - } - - string newText = string.Empty; - lock (_baseChoicesLock) - { - if (i < _baseChoices.Count) - { - newText = _baseChoices[i].Text; - } - } - - if (!string.IsNullOrEmpty(newText)) - { - yield return newText; - } - } - } - - internal void EnsureFinishStreaming(Exception pumpException = null) - { - if (!_isFinishedStreaming) - { - _isFinishedStreaming = true; - _pumpException = pumpException; - _updateAvailableEvent.Set(); - } - } - - private T GetLocked(Func func) - { - lock (_baseChoicesLock) - { - return func.Invoke(); - } - } - } -} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingCompletions.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingCompletions.cs deleted file mode 100644 index 70796d90f156c..0000000000000 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/StreamingCompletions.cs +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core.Sse; - -namespace Azure.AI.OpenAI -{ - public class StreamingCompletions : IDisposable - { - private readonly Response _baseResponse; - private readonly SseReader _baseResponseReader; - private readonly IList _baseCompletions; - private readonly object _baseCompletionsLock = new(); - private readonly IList _streamingChoices; - private readonly object _streamingChoicesLock = new(); - private readonly AsyncAutoResetEvent _updateAvailableEvent; - private bool _streamingTaskComplete; - private bool _disposedValue; - private Exception _pumpException; - - /// - /// Gets the earliest Completion creation timestamp associated with this streamed response. - /// - public DateTimeOffset Created => GetLocked(() => _baseCompletions.Last().Created); - - /// - /// Gets the unique identifier associated with this streaming Completions response. - /// - public string Id => GetLocked(() => _baseCompletions.Last().Id); - - /// - /// Content filtering results for zero or more prompts in the request. In a streaming request, - /// results for different prompts may arrive at different times or in different orders. - /// - public IReadOnlyList PromptFilterResults - => GetLocked(() => - { - return _baseCompletions.Where(singleBaseCompletion => singleBaseCompletion.PromptFilterResults != null) - .SelectMany(singleBaseCompletion => singleBaseCompletion.PromptFilterResults) - .OrderBy(singleBaseCompletion => singleBaseCompletion.PromptIndex) - .ToList(); - }); - - internal StreamingCompletions(Response response) - { - _baseResponse = response; - _baseResponseReader = new SseReader(response.ContentStream); - _updateAvailableEvent = new AsyncAutoResetEvent(); - _baseCompletions = new List(); - _streamingChoices = new List(); - _streamingTaskComplete = false; - _ = Task.Run(async () => - { - try - { - while (true) - { - SseLine? sseEvent = await _baseResponseReader.TryReadSingleFieldEventAsync().ConfigureAwait(false); - if (sseEvent == null) - { - _baseResponse.ContentStream?.Dispose(); - break; - } - - ReadOnlyMemory name = sseEvent.Value.FieldName; - if (!name.Span.SequenceEqual("data".AsSpan())) - throw new InvalidDataException(); - - ReadOnlyMemory value = sseEvent.Value.FieldValue; - if (value.Span.SequenceEqual("[DONE]".AsSpan())) - { - _baseResponse.ContentStream?.Dispose(); - break; - } - - JsonDocument sseMessageJson = JsonDocument.Parse(sseEvent.Value.FieldValue); - Completions completionsFromSse = Completions.DeserializeCompletions(sseMessageJson.RootElement); - - lock (_baseCompletionsLock) - { - _baseCompletions.Add(completionsFromSse); - } - - foreach (Choice choiceFromSse in completionsFromSse.Choices) - { - lock (_streamingChoicesLock) - { - StreamingChoice existingStreamingChoice = _streamingChoices - .FirstOrDefault(choice => choice.Index == choiceFromSse.Index); - if (existingStreamingChoice == null) - { - StreamingChoice newStreamingChoice = new(choiceFromSse); - _streamingChoices.Add(newStreamingChoice); - _updateAvailableEvent.Set(); - } - else - { - existingStreamingChoice.UpdateFromEventStreamChoice(choiceFromSse); - } - } - } - } - } - catch (Exception pumpException) - { - _pumpException = pumpException; - } - finally - { - lock (_streamingChoicesLock) - { - // If anything went wrong and a StreamingChoice didn't naturally determine it was complete - // based on a non-null finish reason, ensure that nothing's left incomplete (and potentially - // hanging!) now. - foreach (StreamingChoice streamingChoice in _streamingChoices) - { - streamingChoice.EnsureFinishStreaming(_pumpException); - } - } - _streamingTaskComplete = true; - _updateAvailableEvent.Set(); - } - }); - } - - public async IAsyncEnumerable GetChoicesStreaming( - [EnumeratorCancellation] CancellationToken cancellationToken = default) - { - bool isFinalIndex = false; - for (int i = 0; !isFinalIndex && !cancellationToken.IsCancellationRequested; i++) - { - bool doneWaiting = false; - while (!doneWaiting) - { - lock (_streamingChoicesLock) - { - doneWaiting = _streamingTaskComplete || i < _streamingChoices.Count; - isFinalIndex = _streamingTaskComplete && i >= _streamingChoices.Count - 1; - } - - if (!doneWaiting) - { - await _updateAvailableEvent.WaitAsync(cancellationToken).ConfigureAwait(false); - } - } - - if (_pumpException != null) - { - throw _pumpException; - } - - StreamingChoice newChoice = null; - lock (_streamingChoicesLock) - { - if (i < _streamingChoices.Count) - { - newChoice = _streamingChoices[i]; - } - } - - if (newChoice != null) - { - yield return newChoice; - } - } - } - - internal StreamingCompletions( - Completions baseCompletions = null, - IList streamingChoices = null) - { - _baseCompletions.Add(baseCompletions); - _streamingChoices = streamingChoices; - _streamingTaskComplete = true; - } - - public void Dispose() - { - Dispose(disposing: true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!_disposedValue) - { - if (disposing) - { - _baseResponseReader.Dispose(); - } - - _disposedValue = true; - } - } - - private T GetLocked(Func func) - { - lock (_baseCompletionsLock) - { - return func.Invoke(); - } - } - } -} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.Serialization.cs index 4fad75e9040b1..e70c36c2e4cc8 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.Serialization.cs @@ -37,10 +37,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("temperature"u8); writer.WriteNumberValue(Temperature.Value); } - if (Optional.IsDefined(InternalNonAzureModelName)) + if (Optional.IsDefined(DeploymentName)) { writer.WritePropertyName("model"u8); - writer.WriteStringValue(InternalNonAzureModelName); + writer.WriteStringValue(DeploymentName); } writer.WriteEndObject(); } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.cs index 38fc1b9a3ff4f..f5460a934f133 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranscriptionOptions.cs @@ -13,19 +13,6 @@ namespace Azure.AI.OpenAI /// The configuration information for an audio transcription request. public partial class AudioTranscriptionOptions { - /// Initializes a new instance of AudioTranscriptionOptions. - /// - /// The audio data to transcribe. This must be the binary content of a file in one of the supported media formats: - /// flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. - /// - /// is null. - public AudioTranscriptionOptions(BinaryData audioData) - { - Argument.AssertNotNull(audioData, nameof(audioData)); - - AudioData = audioData; - } - /// Initializes a new instance of AudioTranscriptionOptions. /// /// The audio data to transcribe. This must be the binary content of a file in one of the supported media formats: @@ -46,15 +33,15 @@ public AudioTranscriptionOptions(BinaryData audioData) /// Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. /// If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit. /// - /// The model to use for this transcription request. - internal AudioTranscriptionOptions(BinaryData audioData, AudioTranscriptionFormat? responseFormat, string language, string prompt, float? temperature, string internalNonAzureModelName) + /// The model to use for this transcription request. + internal AudioTranscriptionOptions(BinaryData audioData, AudioTranscriptionFormat? responseFormat, string language, string prompt, float? temperature, string deploymentName) { AudioData = audioData; ResponseFormat = responseFormat; Language = language; Prompt = prompt; Temperature = temperature; - InternalNonAzureModelName = internalNonAzureModelName; + DeploymentName = deploymentName; } /// The requested format of the transcription response data, which will influence the content and detail of the result. public AudioTranscriptionFormat? ResponseFormat { get; set; } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.Serialization.cs index a7f43534234a9..90b5da9c23a96 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.Serialization.cs @@ -32,10 +32,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("temperature"u8); writer.WriteNumberValue(Temperature.Value); } - if (Optional.IsDefined(InternalNonAzureModelName)) + if (Optional.IsDefined(DeploymentName)) { writer.WritePropertyName("model"u8); - writer.WriteStringValue(InternalNonAzureModelName); + writer.WriteStringValue(DeploymentName); } writer.WriteEndObject(); } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.cs index fe60b53dca163..0cf8ee9d3ce55 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AudioTranslationOptions.cs @@ -13,19 +13,6 @@ namespace Azure.AI.OpenAI /// The configuration information for an audio translation request. public partial class AudioTranslationOptions { - /// Initializes a new instance of AudioTranslationOptions. - /// - /// The audio data to translate. This must be the binary content of a file in one of the supported media formats: - /// flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. - /// - /// is null. - public AudioTranslationOptions(BinaryData audioData) - { - Argument.AssertNotNull(audioData, nameof(audioData)); - - AudioData = audioData; - } - /// Initializes a new instance of AudioTranslationOptions. /// /// The audio data to translate. This must be the binary content of a file in one of the supported media formats: @@ -41,14 +28,14 @@ public AudioTranslationOptions(BinaryData audioData) /// Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. /// If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit. /// - /// The model to use for this translation request. - internal AudioTranslationOptions(BinaryData audioData, AudioTranslationFormat? responseFormat, string prompt, float? temperature, string internalNonAzureModelName) + /// The model to use for this translation request. + internal AudioTranslationOptions(BinaryData audioData, AudioTranslationFormat? responseFormat, string prompt, float? temperature, string deploymentName) { AudioData = audioData; ResponseFormat = responseFormat; Prompt = prompt; Temperature = temperature; - InternalNonAzureModelName = internalNonAzureModelName; + DeploymentName = deploymentName; } /// The requested format of the translation response data, which will influence the content and detail of the result. public AudioTranslationFormat? ResponseFormat { get; set; } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureOpenAIModelFactory.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureOpenAIModelFactory.cs index 4d48aec9e8275..b73982221f51b 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureOpenAIModelFactory.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/AzureOpenAIModelFactory.cs @@ -33,11 +33,9 @@ public static Embeddings Embeddings(IEnumerable data = null, Embe /// /// Index of the prompt to which the EmbeddingItem corresponds. /// A new instance for mocking. - public static EmbeddingItem EmbeddingItem(IEnumerable embedding = null, int index = default) + public static EmbeddingItem EmbeddingItem(ReadOnlyMemory embedding = default, int index = default) { - embedding ??= new List(); - - return new EmbeddingItem(embedding?.ToList(), index); + return new EmbeddingItem(embedding, index); } /// Initializes a new instance of EmbeddingsUsage. diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/ChatCompletionsOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/ChatCompletionsOptions.cs index 55a3999e41d28..da714f6e56733 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/ChatCompletionsOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/ChatCompletionsOptions.cs @@ -80,7 +80,7 @@ public partial class ChatCompletionsOptions /// decrease the likelihood of the model repeating the same statements verbatim. /// /// A value indicating whether chat completions should be streamed for this request. - /// + /// /// The model name to provide as part of this completions request. /// Not applicable to Azure OpenAI, where deployment information should be included in the Azure /// resource URI that's connected to. @@ -89,7 +89,7 @@ public partial class ChatCompletionsOptions /// The configuration entries for Azure OpenAI chat extensions that use them. /// This additional specification is only compatible with Azure OpenAI. /// - internal ChatCompletionsOptions(IList messages, IList functions, FunctionDefinition functionCall, int? maxTokens, float? temperature, float? nucleusSamplingFactor, IDictionary internalStringKeyedTokenSelectionBiases, string user, int? choiceCount, IList stopSequences, float? presencePenalty, float? frequencyPenalty, bool? internalShouldStreamResponse, string internalNonAzureModelName, IList internalAzureExtensionsDataSources) + internal ChatCompletionsOptions(IList messages, IList functions, FunctionDefinition functionCall, int? maxTokens, float? temperature, float? nucleusSamplingFactor, IDictionary internalStringKeyedTokenSelectionBiases, string user, int? choiceCount, IList stopSequences, float? presencePenalty, float? frequencyPenalty, bool? internalShouldStreamResponse, string deploymentName, IList internalAzureExtensionsDataSources) { Messages = messages; Functions = functions; @@ -104,7 +104,7 @@ internal ChatCompletionsOptions(IList messages, IList /// A value indicating whether chat completions should be streamed for this request. - /// + /// /// The model name to provide as part of this completions request. /// Not applicable to Azure OpenAI, where deployment information should be included in the Azure /// resource URI that's connected to. /// - internal CompletionsOptions(IList prompts, int? maxTokens, float? temperature, float? nucleusSamplingFactor, IDictionary internalStringKeyedTokenSelectionBiases, string user, int? choicesPerPrompt, int? logProbabilityCount, bool? echo, IList stopSequences, float? presencePenalty, float? frequencyPenalty, int? generationSampleCount, bool? internalShouldStreamResponse, string internalNonAzureModelName) + internal CompletionsOptions(IList prompts, int? maxTokens, float? temperature, float? nucleusSamplingFactor, IDictionary internalStringKeyedTokenSelectionBiases, string user, int? choicesPerPrompt, int? logProbabilityCount, bool? echo, IList stopSequences, float? presencePenalty, float? frequencyPenalty, int? generationSampleCount, bool? internalShouldStreamResponse, string deploymentName) { Prompts = prompts; MaxTokens = maxTokens; @@ -105,7 +105,7 @@ internal CompletionsOptions(IList prompts, int? maxTokens, float? temper FrequencyPenalty = frequencyPenalty; GenerationSampleCount = generationSampleCount; InternalShouldStreamResponse = internalShouldStreamResponse; - InternalNonAzureModelName = internalNonAzureModelName; + DeploymentName = deploymentName; } /// /// An identifier for the caller or end user of the operation. This may be used for tracking diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingItem.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingItem.Serialization.cs index 73fcef3c328fe..d0beb31615985 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingItem.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingItem.Serialization.cs @@ -5,7 +5,7 @@ #nullable disable -using System.Collections.Generic; +using System; using System.Text.Json; using Azure; @@ -19,18 +19,24 @@ internal static EmbeddingItem DeserializeEmbeddingItem(JsonElement element) { return null; } - IReadOnlyList embedding = default; + ReadOnlyMemory embedding = default; int index = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("embedding"u8)) { - List array = new List(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + int index0 = 0; + float[] array = new float[property.Value.GetArrayLength()]; foreach (var item in property.Value.EnumerateArray()) { - array.Add(item.GetSingle()); + array[index0] = item.GetSingle(); + index0++; } - embedding = array; + embedding = new ReadOnlyMemory(array); continue; } if (property.NameEquals("index"u8)) diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingItem.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingItem.cs index b1cd9e879f18f..928746b1982e8 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingItem.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingItem.cs @@ -6,47 +6,12 @@ #nullable disable using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; namespace Azure.AI.OpenAI { /// Representation of a single embeddings relatedness comparison. public partial class EmbeddingItem { - /// Initializes a new instance of EmbeddingItem. - /// - /// List of embeddings value for the input prompt. These represent a measurement of the - /// vector-based relatedness of the provided input. - /// - /// Index of the prompt to which the EmbeddingItem corresponds. - /// is null. - internal EmbeddingItem(IEnumerable embedding, int index) - { - Argument.AssertNotNull(embedding, nameof(embedding)); - - Embedding = embedding.ToList(); - Index = index; - } - - /// Initializes a new instance of EmbeddingItem. - /// - /// List of embeddings value for the input prompt. These represent a measurement of the - /// vector-based relatedness of the provided input. - /// - /// Index of the prompt to which the EmbeddingItem corresponds. - internal EmbeddingItem(IReadOnlyList embedding, int index) - { - Embedding = embedding; - Index = index; - } - - /// - /// List of embeddings value for the input prompt. These represent a measurement of the - /// vector-based relatedness of the provided input. - /// - public IReadOnlyList Embedding { get; } /// Index of the prompt to which the EmbeddingItem corresponds. public int Index { get; } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingsOptions.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingsOptions.Serialization.cs index 8130196e2e410..b6023c36f1d36 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingsOptions.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingsOptions.Serialization.cs @@ -20,10 +20,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("user"u8); writer.WriteStringValue(User); } - if (Optional.IsDefined(InternalNonAzureModelName)) + if (Optional.IsDefined(DeploymentName)) { writer.WritePropertyName("model"u8); - writer.WriteStringValue(InternalNonAzureModelName); + writer.WriteStringValue(DeploymentName); } writer.WritePropertyName("input"u8); writer.WriteStartArray(); diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingsOptions.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingsOptions.cs index 88b9de89ca20f..986586a57af87 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingsOptions.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/EmbeddingsOptions.cs @@ -19,28 +19,12 @@ namespace Azure.AI.OpenAI /// public partial class EmbeddingsOptions { - /// Initializes a new instance of EmbeddingsOptions. - /// - /// Input texts to get embeddings for, encoded as a an array of strings. - /// Each input must not exceed 2048 tokens in length. - /// - /// Unless you are embedding code, we suggest replacing newlines (\n) in your input with a single space, - /// as we have observed inferior results when newlines are present. - /// - /// is null. - public EmbeddingsOptions(IEnumerable input) - { - Argument.AssertNotNull(input, nameof(input)); - - Input = input.ToList(); - } - /// Initializes a new instance of EmbeddingsOptions. /// /// An identifier for the caller or end user of the operation. This may be used for tracking /// or rate-limiting purposes. /// - /// + /// /// The model name to provide as part of this embeddings request. /// Not applicable to Azure OpenAI, where deployment information should be included in the Azure /// resource URI that's connected to. @@ -52,10 +36,10 @@ public EmbeddingsOptions(IEnumerable input) /// Unless you are embedding code, we suggest replacing newlines (\n) in your input with a single space, /// as we have observed inferior results when newlines are present. /// - internal EmbeddingsOptions(string user, string internalNonAzureModelName, IList input) + internal EmbeddingsOptions(string user, string deploymentName, IList input) { User = user; - InternalNonAzureModelName = internalNonAzureModelName; + DeploymentName = deploymentName; Input = input; } @@ -64,13 +48,5 @@ internal EmbeddingsOptions(string user, string internalNonAzureModelName, IList< /// or rate-limiting purposes. /// public string User { get; set; } - /// - /// Input texts to get embeddings for, encoded as a an array of strings. - /// Each input must not exceed 2048 tokens in length. - /// - /// Unless you are embedding code, we suggest replacing newlines (\n) in your input with a single space, - /// as we have observed inferior results when newlines are present. - /// - public IList Input { get; } } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Helpers/SseAsyncEnumerator.cs b/sdk/openai/Azure.AI.OpenAI/src/Helpers/SseAsyncEnumerator.cs new file mode 100644 index 0000000000000..9c32d20ee4e6f --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/src/Helpers/SseAsyncEnumerator.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Threading; + +namespace Azure.Core.Sse +{ + internal static class SseAsyncEnumerator + { + internal static async IAsyncEnumerable EnumerateFromSseStream( + Stream stream, + Func> multiElementDeserializer, + [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + try + { + using SseReader sseReader = new(stream); + while (!cancellationToken.IsCancellationRequested) + { + SseLine? sseEvent = await sseReader.TryReadSingleFieldEventAsync().ConfigureAwait(false); + if (sseEvent is not null) + { + ReadOnlyMemory name = sseEvent.Value.FieldName; + if (!name.Span.SequenceEqual("data".AsSpan())) + { + throw new InvalidDataException(); + } + ReadOnlyMemory value = sseEvent.Value.FieldValue; + if (value.Span.SequenceEqual("[DONE]".AsSpan())) + { + break; + } + using JsonDocument sseMessageJson = JsonDocument.Parse(value); + IEnumerable newItems = multiElementDeserializer.Invoke(sseMessageJson.RootElement); + foreach (T item in newItems) + { + yield return item; + } + } + } + } + finally + { + // Always dispose the stream immediately once enumeration is complete for any reason + stream.Dispose(); + } + } + + internal static IAsyncEnumerable EnumerateFromSseStream( + Stream stream, + Func elementDeserializer, + CancellationToken cancellationToken = default) + => EnumerateFromSseStream( + stream, + (element) => new T[] { elementDeserializer.Invoke(element) }, + cancellationToken); + } +} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Helpers/SseReader.cs b/sdk/openai/Azure.AI.OpenAI/src/Helpers/SseReader.cs index 6e39bad0565db..80636253e3107 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Helpers/SseReader.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Helpers/SseReader.cs @@ -24,12 +24,12 @@ public SseReader(Stream stream) { while (true) { - var line = TryReadLine(); + SseLine? line = TryReadLine(); if (line == null) return null; if (line.Value.IsEmpty) throw new InvalidDataException("event expected."); - var empty = TryReadLine(); + SseLine? empty = TryReadLine(); if (empty != null && !empty.Value.IsEmpty) throw new NotSupportedException("Multi-filed events not supported."); if (!line.Value.IsComment) @@ -42,12 +42,12 @@ public SseReader(Stream stream) { while (true) { - var line = await TryReadLineAsync().ConfigureAwait(false); + SseLine? line = await TryReadLineAsync().ConfigureAwait(false); if (line == null) return null; if (line.Value.IsEmpty) throw new InvalidDataException("event expected."); - var empty = await TryReadLineAsync().ConfigureAwait(false); + SseLine? empty = await TryReadLineAsync().ConfigureAwait(false); if (empty != null && !empty.Value.IsEmpty) throw new NotSupportedException("Multi-filed events not supported."); if (!line.Value.IsComment) diff --git a/sdk/openai/Azure.AI.OpenAI/src/Helpers/StreamingResponse.cs b/sdk/openai/Azure.AI.OpenAI/src/Helpers/StreamingResponse.cs new file mode 100644 index 0000000000000..5ba9fcb5aff47 --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/src/Helpers/StreamingResponse.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading; + +namespace Azure.AI.OpenAI; + +/// +/// Represents an operation response with streaming content that can be deserialized and enumerated while the response +/// is still being received. +/// +/// The data type representative of distinct, streamable items. +public class StreamingResponse + : IDisposable + , IAsyncEnumerable +{ + private Response _rawResponse { get; } + private IAsyncEnumerable _asyncEnumerableSource { get; } + private bool _disposedValue { get; set; } + + private StreamingResponse() { } + + private StreamingResponse( + Response rawResponse, + Func> asyncEnumerableProcessor) + { + _rawResponse = rawResponse; + _asyncEnumerableSource = asyncEnumerableProcessor.Invoke(rawResponse); + } + + /// + /// Creates a new instance of using the provided underlying HTTP response. The + /// provided function will be used to resolve the response into an asynchronous enumeration of streamed response + /// items. + /// + /// The HTTP response. + /// + /// The function that will resolve the provided response into an IAsyncEnumerable. + /// + /// + /// A new instance of that will be capable of asynchronous enumeration of + /// items from the HTTP response. + /// + public static StreamingResponse CreateFromResponse( + Response response, + Func> asyncEnumerableProcessor) + { + return new(response, asyncEnumerableProcessor); + } + + /// + /// Gets the underlying instance that this may enumerate + /// over. + /// + /// The instance attached to this . + public Response GetRawResponse() => _rawResponse; + + /// + /// Gets the asynchronously enumerable collection of distinct, streamable items in the response. + /// + /// + /// The return value of this method may be used with the "await foreach" statement. + /// + /// As explicitly implements , callers may + /// enumerate a instance directly instead of calling this method. + /// + /// + /// + public IAsyncEnumerable EnumerateValues() => this; + + /// + public void Dispose() + { + Dispose(disposing: true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + _rawResponse?.Dispose(); + } + _disposedValue = true; + } + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + => _asyncEnumerableSource.GetAsyncEnumerator(cancellationToken); +} diff --git a/sdk/openai/Azure.AI.OpenAI/tests/AudioTranscriptionTests.cs b/sdk/openai/Azure.AI.OpenAI/tests/AudioTranscriptionTests.cs index d7e473991a7f0..295b3c63a59fc 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/AudioTranscriptionTests.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/AudioTranscriptionTests.cs @@ -43,6 +43,7 @@ public async Task TranscriptionWorksWithFormat( var requestOptions = new AudioTranscriptionOptions() { + DeploymentName = deploymentOrModelName, AudioData = BinaryData.FromStream(audioFileStream), Temperature = (float)0.25, }; @@ -59,9 +60,7 @@ public async Task TranscriptionWorksWithFormat( }; } - Response response = await client.GetAudioTranscriptionAsync( - deploymentOrModelName, - requestOptions); + Response response = await client.GetAudioTranscriptionAsync(requestOptions); string text = response.Value.Text; Assert.That(text, Is.Not.Null.Or.Empty); diff --git a/sdk/openai/Azure.AI.OpenAI/tests/AudioTranslationTests.cs b/sdk/openai/Azure.AI.OpenAI/tests/AudioTranslationTests.cs index 20bf363c6fe3f..c616e874e4dbe 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/AudioTranslationTests.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/AudioTranslationTests.cs @@ -43,6 +43,7 @@ public async Task TranslationWorksWithFormat( var requestOptions = new AudioTranslationOptions() { + DeploymentName = deploymentOrModelName, AudioData = BinaryData.FromStream(audioFileStream), Temperature = (float)0.25, }; @@ -59,9 +60,7 @@ public async Task TranslationWorksWithFormat( }; } - Response response = await client.GetAudioTranslationAsync( - deploymentOrModelName, - requestOptions); + Response response = await client.GetAudioTranslationAsync(requestOptions); string text = response.Value.Text; Assert.That(text, Is.Not.Null.Or.Empty); diff --git a/sdk/openai/Azure.AI.OpenAI/tests/AzureChatExtensionsTests.cs b/sdk/openai/Azure.AI.OpenAI/tests/AzureChatExtensionsTests.cs index 7f56bb370064c..428bee6f54e0c 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/AzureChatExtensionsTests.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/AzureChatExtensionsTests.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text; using System.Text.Json; using System.Threading.Tasks; using Azure.Core.TestFramework; @@ -46,7 +47,7 @@ public async Task BasicSearchExtensionWorks( { Endpoint = "https://openaisdktestsearch.search.windows.net", IndexName = "openai-test-index-carbon-wiki", - Key = GetCognitiveSearchApiKey().Key, + GetCognitiveSearchApiKey().Key, }, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }), }, @@ -62,6 +63,7 @@ public async Task BasicSearchExtensionWorks( var requestOptions = new ChatCompletionsOptions() { + DeploymentName = deploymentOrModelName, Messages = { new ChatMessage(ChatRole.User, "What does PR complete mean?"), @@ -70,7 +72,7 @@ public async Task BasicSearchExtensionWorks( AzureExtensionsOptions = extensionsOptions, }; - Response response = await client.GetChatCompletionsAsync(deploymentOrModelName, requestOptions); + Response response = await client.GetChatCompletionsAsync(requestOptions); Assert.That(response, Is.Not.Null); Assert.That(response.Value, Is.Not.Null); Assert.That(response.Value.Choices, Is.Not.Null.Or.Empty); @@ -99,6 +101,7 @@ public async Task StreamingSearchExtensionWorks(OpenAIClientServiceTarget servic var requestOptions = new ChatCompletionsOptions() { + DeploymentName = deploymentOrModelName, Messages = { new ChatMessage(ChatRole.User, "What does PR complete mean?"), @@ -115,7 +118,7 @@ public async Task StreamingSearchExtensionWorks(OpenAIClientServiceTarget servic { Endpoint = "https://openaisdktestsearch.search.windows.net", IndexName = "openai-test-index-carbon-wiki", - Key = GetCognitiveSearchApiKey().Key, + GetCognitiveSearchApiKey().Key, }, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }), }, @@ -123,30 +126,34 @@ public async Task StreamingSearchExtensionWorks(OpenAIClientServiceTarget servic }, }; - Response response = await client.GetChatCompletionsStreamingAsync( - deploymentOrModelName, - requestOptions); + using StreamingResponse response + = await client.GetChatCompletionsStreamingAsync(requestOptions); Assert.That(response, Is.Not.Null); - Assert.That(response.Value, Is.Not.Null); - - using StreamingChatCompletions streamingChatCompletions = response.Value; + Assert.That(response.GetRawResponse(), Is.Not.Null); - int choiceCount = 0; - List messageChunks = new(); + ChatRole? streamedRole = null; + IEnumerable azureContextMessages = null; + StringBuilder contentBuilder = new(); - await foreach (StreamingChatChoice streamingChatChoice in response.Value.GetChoicesStreaming()) + await foreach (StreamingChatCompletionsUpdate chatUpdate in response) { - choiceCount++; - await foreach (ChatMessage chatMessage in streamingChatChoice.GetMessageStreaming()) + if (chatUpdate.Role.HasValue) + { + Assert.That(streamedRole, Is.Null); + streamedRole = chatUpdate.Role.Value; + } + if (chatUpdate.AzureExtensionsContext?.Messages?.Count > 0) { - messageChunks.Add(chatMessage); + Assert.That(azureContextMessages, Is.Null); + azureContextMessages = chatUpdate.AzureExtensionsContext.Messages; } + contentBuilder.Append(chatUpdate.ContentUpdate); } - Assert.That(choiceCount, Is.EqualTo(1)); - Assert.That(messageChunks, Is.Not.Null.Or.Empty); - Assert.That(messageChunks.Any(chunk => chunk.AzureExtensionsContext != null && chunk.AzureExtensionsContext.Messages.Any(m => m.Role == ChatRole.Tool))); - //Assert.That(messageChunks.Any(chunk => chunk.Role == ChatRole.Assistant)); - Assert.That(messageChunks.Any(chunk => !string.IsNullOrWhiteSpace(chunk.Content))); + Assert.That(streamedRole, Is.EqualTo(ChatRole.Assistant)); + Assert.That(contentBuilder.ToString(), Is.Not.Null.Or.Empty); + Assert.That(azureContextMessages, Is.Not.Null.Or.Empty); + Assert.That(azureContextMessages.Any(contextMessage => contextMessage.Role == ChatRole.Tool)); + Assert.That(azureContextMessages.Any(contextMessage => !string.IsNullOrEmpty(contextMessage.Content))); } } diff --git a/sdk/openai/Azure.AI.OpenAI/tests/ChatFunctionsTests.cs b/sdk/openai/Azure.AI.OpenAI/tests/ChatFunctionsTests.cs index 36b612ce299dd..079000119ce9d 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/ChatFunctionsTests.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/ChatFunctionsTests.cs @@ -2,11 +2,9 @@ // Licensed under the MIT License. using System; -using System.Linq; using System.Text; using System.Text.Json; using System.Threading.Tasks; -using Azure.Core.Pipeline; using Azure.Core.TestFramework; using NUnit.Framework; @@ -31,6 +29,7 @@ public async Task SimpleFunctionCallWorks(OpenAIClientServiceTarget serviceTarge var requestOptions = new ChatCompletionsOptions() { + DeploymentName = deploymentOrModelName, Functions = { s_futureTemperatureFunction }, Messages = { @@ -40,7 +39,7 @@ public async Task SimpleFunctionCallWorks(OpenAIClientServiceTarget serviceTarge MaxTokens = 512, }; - Response response = await client.GetChatCompletionsAsync(deploymentOrModelName, requestOptions); + Response response = await client.GetChatCompletionsAsync(requestOptions); Assert.That(response, Is.Not.Null); Assert.That(response.Value, Is.Not.Null); @@ -54,6 +53,7 @@ public async Task SimpleFunctionCallWorks(OpenAIClientServiceTarget serviceTarge ChatCompletionsOptions followupOptions = new() { + DeploymentName = deploymentOrModelName, Functions = { s_futureTemperatureFunction }, MaxTokens = 512, }; @@ -74,7 +74,7 @@ public async Task SimpleFunctionCallWorks(OpenAIClientServiceTarget serviceTarge new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }), }); - Response followupResponse = await client.GetChatCompletionsAsync(deploymentOrModelName, followupOptions); + Response followupResponse = await client.GetChatCompletionsAsync(followupOptions); Assert.That(followupResponse, Is.Not.Null); Assert.That(followupResponse.Value, Is.Not.Null); Assert.That(followupResponse.Value.Choices, Is.Not.Null.Or.Empty); @@ -94,6 +94,7 @@ public async Task StreamingFunctionCallWorks(OpenAIClientServiceTarget serviceTa var requestOptions = new ChatCompletionsOptions() { + DeploymentName = deploymentOrModelName, Functions = { s_futureTemperatureFunction }, Messages = { @@ -103,31 +104,27 @@ public async Task StreamingFunctionCallWorks(OpenAIClientServiceTarget serviceTa MaxTokens = 512, }; - Response response - = await client.GetChatCompletionsStreamingAsync(deploymentOrModelName, requestOptions); + StreamingResponse response + = await client.GetChatCompletionsStreamingAsync(requestOptions); Assert.That(response, Is.Not.Null); - using StreamingChatCompletions streamingChatCompletions = response.Value; - - ChatRole streamedRole = default; - string functionName = default; + ChatRole? streamedRole = default; + string functionName = null; StringBuilder argumentsBuilder = new(); - await foreach (StreamingChatChoice choice in streamingChatCompletions.GetChoicesStreaming()) + await foreach (StreamingChatCompletionsUpdate chatUpdate in response) { - await foreach (ChatMessage message in choice.GetMessageStreaming()) + if (chatUpdate.Role.HasValue) { - if (message.Role != default) - { - streamedRole = message.Role; - } - if (message.FunctionCall?.Name != null) - { - Assert.That(functionName, Is.Null.Or.Empty); - functionName = message.FunctionCall.Name; - } - argumentsBuilder.Append(message.FunctionCall?.Arguments ?? string.Empty); + Assert.That(streamedRole, Is.Null, "role should only appear once"); + streamedRole = chatUpdate.Role.Value; } + if (!string.IsNullOrEmpty(chatUpdate.FunctionName)) + { + Assert.That(functionName, Is.Null, "function_name should only appear once"); + functionName = chatUpdate.FunctionName; + } + argumentsBuilder.Append(chatUpdate.FunctionArgumentsUpdate); } Assert.That(streamedRole, Is.EqualTo(ChatRole.Assistant)); @@ -159,4 +156,23 @@ Response response }, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }) }; + + private static readonly FunctionDefinition s_wordOfTheDayFunction = new() + { + Name = "get_word_of_the_day", + Description = "requests a featured word for a given day of the week", + Parameters = BinaryData.FromObjectAsJson(new + { + Type = "object", + Properties = new + { + DayOfWeek = new + { + Type = "string", + Description = "the name of a day of the week, like Wednesday", + }, + } + }, + new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }) + }; } diff --git a/sdk/openai/Azure.AI.OpenAI/tests/OpenAIInferenceModelFactoryTests.cs.cs b/sdk/openai/Azure.AI.OpenAI/tests/OpenAIInferenceModelFactoryTests.cs.cs index ea9e18667a16a..eff9e748f1368 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/OpenAIInferenceModelFactoryTests.cs.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/OpenAIInferenceModelFactoryTests.cs.cs @@ -4,6 +4,8 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text; +using System.Threading.Tasks; using NUnit.Framework; namespace Azure.AI.OpenAI.Tests @@ -180,5 +182,46 @@ public void TestAudioTranslation() Assert.That(audioTranslation.Segments, Is.Not.Null.Or.Empty); Assert.That(audioTranslation.Segments.Count, Is.EqualTo(1)); } + + [Test] + public async Task TestStreamingChatCompletions() + { + const string expectedId = "expected-id-value"; + + StreamingChatCompletionsUpdate[] updates = new[] + { + AzureOpenAIModelFactory.StreamingChatCompletionsUpdate( + expectedId, + DateTime.Now, + role: ChatRole.Assistant, + contentUpdate: "hello"), + AzureOpenAIModelFactory.StreamingChatCompletionsUpdate( + expectedId, + DateTime.Now, + contentUpdate: " world"), + AzureOpenAIModelFactory.StreamingChatCompletionsUpdate( + expectedId, + DateTime.Now, + finishReason: CompletionsFinishReason.Stopped), + }; + + async IAsyncEnumerable EnumerateMockUpdates() + { + foreach (StreamingChatCompletionsUpdate update in updates) + { + yield return update; + } + await Task.Delay(0); + } + + StringBuilder contentBuilder = new(); + await foreach (StreamingChatCompletionsUpdate update in EnumerateMockUpdates()) + { + Assert.That(update.Id == expectedId); + Assert.That(update.Created > new DateTimeOffset(new DateTime(2023, 1, 1))); + contentBuilder.Append(update.ContentUpdate); + } + Assert.That(contentBuilder.ToString() == "hello world"); + } } } diff --git a/sdk/openai/Azure.AI.OpenAI/tests/OpenAIInferenceTests.cs b/sdk/openai/Azure.AI.OpenAI/tests/OpenAIInferenceTests.cs index f7eaaf696bc35..b0697089a10da 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/OpenAIInferenceTests.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/OpenAIInferenceTests.cs @@ -27,6 +27,7 @@ public async Task Completions(OpenAIClientServiceTarget serviceTarget) Assert.That(client, Is.InstanceOf()); CompletionsOptions requestOptions = new() { + DeploymentName = deploymentOrModelName, Prompts = { "Hello world", @@ -34,7 +35,7 @@ public async Task Completions(OpenAIClientServiceTarget serviceTarget) }, }; Assert.That(requestOptions, Is.InstanceOf()); - Response response = await client.GetCompletionsAsync(deploymentOrModelName, requestOptions); + Response response = await client.GetCompletionsAsync(requestOptions); Assert.That(response, Is.Not.Null); Assert.That(response, Is.InstanceOf>()); Assert.That(response.Value, Is.Not.Null); @@ -43,19 +44,6 @@ public async Task Completions(OpenAIClientServiceTarget serviceTarget) Assert.That(response.Value.Choices[0].FinishReason, Is.Not.Null.Or.Empty); } - [RecordedTest] - [TestCase(OpenAIClientServiceTarget.Azure)] - [TestCase(OpenAIClientServiceTarget.NonAzure)] - public async Task SimpleCompletions(OpenAIClientServiceTarget serviceTarget) - { - OpenAIClient client = GetTestClient(serviceTarget); - string deploymentOrModelName = OpenAITestBase.GetDeploymentOrModelName( - serviceTarget, - OpenAIClientScenario.LegacyCompletions); - Response response = await client.GetCompletionsAsync(deploymentOrModelName, "Hello world!"); - Assert.That(response, Is.InstanceOf>()); - } - [RecordedTest] [TestCase(OpenAIClientServiceTarget.Azure)] [TestCase(OpenAIClientServiceTarget.NonAzure, Ignore = "Tokens not supported for non-Azure")] @@ -63,11 +51,13 @@ public async Task CompletionsWithTokenCredential(OpenAIClientServiceTarget servi { OpenAIClient client = GetTestClient(serviceTarget, OpenAIClientAuthenticationType.Token); string deploymentName = OpenAITestBase.GetDeploymentOrModelName(serviceTarget, OpenAIClientScenario.LegacyCompletions); - var requestOptions = new CompletionsOptions(); - requestOptions.Prompts.Add("Hello, world!"); - requestOptions.Prompts.Add("I can have multiple prompts"); + var requestOptions = new CompletionsOptions() + { + DeploymentName = deploymentName, + Prompts = { "Hello, world!", "I can have multiple prompts" }, + }; Assert.That(requestOptions, Is.InstanceOf()); - Response response = await client.GetCompletionsAsync(deploymentName, requestOptions); + Response response = await client.GetCompletionsAsync(requestOptions); Assert.That(response, Is.InstanceOf>()); Assert.That(response.Value.Choices, Is.Not.Null.Or.Empty); Assert.That(response.Value.Choices.Count, Is.EqualTo(2)); @@ -80,10 +70,21 @@ public async Task Embeddings(OpenAIClientServiceTarget serviceTarget) { OpenAIClient client = GetTestClient(serviceTarget); string deploymentOrModelName = OpenAITestBase.GetDeploymentOrModelName(serviceTarget, OpenAIClientScenario.Embeddings); - var embeddingsRequest = new EmbeddingsOptions("Your text string goes here"); - Assert.That(embeddingsRequest, Is.InstanceOf()); - Response response = await client.GetEmbeddingsAsync(deploymentOrModelName, embeddingsRequest); + var embeddingsOptions = new EmbeddingsOptions() + { + DeploymentName = deploymentOrModelName, + Input = { "Your text string goes here" }, + }; + Assert.That(embeddingsOptions, Is.InstanceOf()); + Response response = await client.GetEmbeddingsAsync(embeddingsOptions); Assert.That(response, Is.InstanceOf>()); + Assert.That(response.Value, Is.Not.Null); + Assert.That(response.Value.Data, Is.Not.Null.Or.Empty); + + EmbeddingItem firstItem = response.Value.Data[0]; + Assert.That(firstItem, Is.Not.Null); + Assert.That(firstItem.Index, Is.EqualTo(0)); + Assert.That(firstItem.Embedding, Is.Not.Null.Or.Empty); } [RecordedTest] @@ -95,6 +96,7 @@ public async Task CompletionsUsageField(OpenAIClientServiceTarget serviceTarget) string deploymentOrModelName = OpenAITestBase.GetDeploymentOrModelName(serviceTarget, OpenAIClientScenario.LegacyCompletions); var requestOptions = new CompletionsOptions() { + DeploymentName = deploymentOrModelName, Prompts = { "Hello world", @@ -105,7 +107,7 @@ public async Task CompletionsUsageField(OpenAIClientServiceTarget serviceTarget) LogProbabilityCount = 1, }; int expectedChoiceCount = (requestOptions.ChoicesPerPrompt ?? 1) * requestOptions.Prompts.Count; - Response response = await client.GetCompletionsAsync(deploymentOrModelName, requestOptions); + Response response = await client.GetCompletionsAsync(requestOptions); Assert.That(response.GetRawResponse(), Is.Not.Null.Or.Empty); Assert.That(response.Value, Is.Not.Null); Assert.That(response.Value.Id, Is.Not.Null.Or.Empty); @@ -140,6 +142,7 @@ public async Task ChatCompletions(OpenAIClientServiceTarget serviceTarget) OpenAIClientScenario.ChatCompletions); var requestOptions = new ChatCompletionsOptions() { + DeploymentName = deploymentOrModelName, Messages = { new ChatMessage(ChatRole.System, "You are a helpful assistant."), @@ -148,9 +151,7 @@ public async Task ChatCompletions(OpenAIClientServiceTarget serviceTarget) new ChatMessage(ChatRole.User, "What temperature should I bake pizza at?"), }, }; - Response response = await client.GetChatCompletionsAsync( - deploymentOrModelName, - requestOptions); + Response response = await client.GetChatCompletionsAsync(requestOptions); Assert.That(response, Is.Not.Null); Assert.That(response.Value, Is.InstanceOf()); Assert.That(response.Value.Id, Is.Not.Null.Or.Empty); @@ -173,12 +174,13 @@ public async Task ChatCompletionsContentFilterCategories(OpenAIClientServiceTarg string deploymentOrModelName = OpenAITestBase.GetDeploymentOrModelName(serviceTarget, OpenAIClientScenario.ChatCompletions); var requestOptions = new ChatCompletionsOptions() { + DeploymentName = deploymentOrModelName, Messages = { new ChatMessage(ChatRole.User, "How do I cook a bell pepper?"), }, }; - Response response = await client.GetChatCompletionsAsync(deploymentOrModelName, requestOptions); + Response response = await client.GetChatCompletionsAsync(requestOptions); Assert.That(response, Is.Not.Null); Assert.That(response.Value, Is.Not.Null); @@ -204,10 +206,11 @@ string deploymentOrModelName = OpenAITestBase.GetDeploymentOrModelName(serviceTarget, OpenAIClientScenario.LegacyCompletions); var requestOptions = new CompletionsOptions() { + DeploymentName = deploymentOrModelName, Prompts = { "How do I cook a bell pepper?" }, Temperature = 0 }; - Response response = await client.GetCompletionsAsync(deploymentOrModelName, requestOptions); + Response response = await client.GetCompletionsAsync(requestOptions); Assert.That(response, Is.Not.Null); Assert.That(response.Value, Is.Not.Null); @@ -234,6 +237,7 @@ public async Task StreamingChatCompletions(OpenAIClientServiceTarget serviceTarg OpenAIClientScenario.ChatCompletions); var requestOptions = new ChatCompletionsOptions() { + DeploymentName = deploymentOrModelName, Messages = { new ChatMessage(ChatRole.System, "You are a helpful assistant."), @@ -243,34 +247,56 @@ public async Task StreamingChatCompletions(OpenAIClientServiceTarget serviceTarg }, MaxTokens = 512, }; - Response streamingResponse - = await client.GetChatCompletionsStreamingAsync(deploymentOrModelName, requestOptions); - Assert.That(streamingResponse, Is.Not.Null); - using StreamingChatCompletions streamingChatCompletions = streamingResponse.Value; - Assert.That(streamingChatCompletions, Is.InstanceOf()); - int totalMessages = 0; + StreamingResponse response + = await client.GetChatCompletionsStreamingAsync(requestOptions); + Assert.That(response, Is.Not.Null); + + StringBuilder contentBuilder = new(); + bool gotRole = false; + bool gotRequestContentFilterResults = false; + bool gotResponseContentFilterResults = false; - await foreach (StreamingChatChoice streamingChoice in streamingChatCompletions.GetChoicesStreaming()) + await foreach (StreamingChatCompletionsUpdate chatUpdate in response) { - Assert.That(streamingChoice, Is.Not.Null); - await foreach (ChatMessage streamingMessage in streamingChoice.GetMessageStreaming()) + Assert.That(chatUpdate, Is.Not.Null); + + if (chatUpdate.AzureExtensionsContext?.RequestContentFilterResults is null) + { + Assert.That(chatUpdate.Id, Is.Not.Null.Or.Empty); + Assert.That(chatUpdate.Created, Is.GreaterThan(new DateTimeOffset(new DateTime(2023, 1, 1)))); + Assert.That(chatUpdate.Created, Is.LessThan(DateTimeOffset.UtcNow.AddDays(7))); + } + if (chatUpdate.Role.HasValue) { - Assert.That(streamingMessage.Role, Is.EqualTo(ChatRole.Assistant)); - totalMessages++; + Assert.IsFalse(gotRole); + Assert.That(chatUpdate.Role.Value, Is.EqualTo(ChatRole.Assistant)); + gotRole = true; + } + if (chatUpdate.ContentUpdate is not null) + { + contentBuilder.Append(chatUpdate.ContentUpdate); + } + if (chatUpdate.AzureExtensionsContext?.RequestContentFilterResults is not null) + { + Assert.IsFalse(gotRequestContentFilterResults); + AssertExpectedContentFilterResults(chatUpdate.AzureExtensionsContext.RequestContentFilterResults, serviceTarget); + gotRequestContentFilterResults = true; + } + if (chatUpdate.AzureExtensionsContext?.ResponseContentFilterResults is not null) + { + AssertExpectedContentFilterResults(chatUpdate.AzureExtensionsContext.ResponseContentFilterResults, serviceTarget); + gotResponseContentFilterResults = true; } - AssertExpectedContentFilterResults(streamingChoice.ContentFilterResults, serviceTarget); } - Assert.That(totalMessages, Is.GreaterThan(1)); - - // Note: these top-level values *are likely not yet populated* until *after* at least one streaming - // choice has arrived. - Assert.That(streamingResponse.GetRawResponse(), Is.Not.Null.Or.Empty); - Assert.That(streamingChatCompletions.Id, Is.Not.Null.Or.Empty); - Assert.That(streamingChatCompletions.Created, Is.GreaterThan(new DateTimeOffset(new DateTime(2023, 1, 1)))); - Assert.That(streamingChatCompletions.Created, Is.LessThan(DateTimeOffset.UtcNow.AddDays(7))); - AssertExpectedPromptFilterResults(streamingChatCompletions.PromptFilterResults, serviceTarget, (requestOptions.ChoiceCount ?? 1)); + Assert.IsTrue(gotRole); + Assert.That(contentBuilder.ToString(), Is.Not.Null.Or.Empty); + if (serviceTarget == OpenAIClientServiceTarget.Azure) + { + Assert.IsTrue(gotRequestContentFilterResults); + Assert.IsTrue(gotResponseContentFilterResults); + } } [RecordedTest] @@ -283,6 +309,7 @@ public async Task AdvancedCompletionsOptions(OpenAIClientServiceTarget serviceTa string promptText = "Are bananas especially radioactive?"; var requestOptions = new CompletionsOptions() { + DeploymentName = deploymentOrModelName, Prompts = { promptText }, GenerationSampleCount = 3, Temperature = 0.75f, @@ -298,7 +325,7 @@ public async Task AdvancedCompletionsOptions(OpenAIClientServiceTarget serviceTa [15991] = -100, // 'anas' }, }; - Response response = await client.GetCompletionsAsync(deploymentOrModelName, requestOptions); + Response response = await client.GetCompletionsAsync(requestOptions); Assert.That(response, Is.Not.Null); string rawResponse = response.GetRawResponse().Content.ToString(); @@ -327,11 +354,14 @@ public async Task AdvancedCompletionsOptions(OpenAIClientServiceTarget serviceTa public void BadDeploymentFails(OpenAIClientServiceTarget serviceTarget) { OpenAIClient client = GetTestClient(serviceTarget); - var completionsRequest = new CompletionsOptions(); - completionsRequest.Prompts.Add("Hello world"); + var completionsRequest = new CompletionsOptions() + { + DeploymentName = "BAD_DEPLOYMENT_ID", + Prompts = { "Hello world" }, + }; RequestFailedException exception = Assert.ThrowsAsync(async () => { - await client.GetCompletionsAsync("BAD_DEPLOYMENT_ID", completionsRequest); + await client.GetCompletionsAsync(completionsRequest); }); Assert.AreEqual(404, exception.Status); Assert.That(exception.ErrorCode, Is.EqualTo("DeploymentNotFound")); @@ -346,6 +376,7 @@ public async Task TokenCutoff(OpenAIClientServiceTarget serviceTarget) string deploymentOrModelName = OpenAITestBase.GetDeploymentOrModelName(serviceTarget, OpenAIClientScenario.LegacyCompletions); var requestOptions = new CompletionsOptions() { + DeploymentName = deploymentOrModelName, Prompts = { "How long would it take an unladen swallow to travel between Seattle, WA" @@ -353,7 +384,7 @@ public async Task TokenCutoff(OpenAIClientServiceTarget serviceTarget) }, MaxTokens = 3, }; - Response response = await client.GetCompletionsAsync(deploymentOrModelName, requestOptions); + Response response = await client.GetCompletionsAsync(requestOptions); Assert.That(response, Is.Not.Null); Assert.That(response.Value, Is.Not.Null); Assert.That(response.Value.Choices, Is.Not.Null.Or.Empty); @@ -367,14 +398,12 @@ public async Task TokenCutoff(OpenAIClientServiceTarget serviceTarget) [TestCase(OpenAIClientServiceTarget.NonAzure)] public async Task StreamingCompletions(OpenAIClientServiceTarget serviceTarget) { - // Temporary test note: at the time of authoring, content filter results aren't included for completions - // with the latest 2023-07-01-preview service API version. We'll manually configure one version behind - // pending the latest version having these results enabled. OpenAIClient client = GetTestClient(serviceTarget); string deploymentOrModelName = OpenAITestBase.GetDeploymentOrModelName(serviceTarget, OpenAIClientScenario.LegacyCompletions); var requestOptions = new CompletionsOptions() { + DeploymentName = deploymentOrModelName, Prompts = { "Tell me some jokes about mangos", @@ -384,61 +413,71 @@ public async Task StreamingCompletions(OpenAIClientServiceTarget serviceTarget) LogProbabilityCount = 1, }; - Response response = await client.GetCompletionsStreamingAsync( - deploymentOrModelName, - requestOptions); + using StreamingResponse response = await client.GetCompletionsStreamingAsync(requestOptions); Assert.That(response, Is.Not.Null); - // StreamingCompletions implements IDisposable; capturing the .Value field of `response` with a `using` - // statement is unusual but properly ensures that `.Dispose()` will be called, as `Response` does *not* - // implement IDisposable or otherwise ensure that an `IDisposable` underlying `.Value` is disposed. - using StreamingCompletions responseValue = response.Value; - - int originallyEnumeratedChoices = 0; - var originallyEnumeratedTextParts = new List>(); + Dictionary promptFilterResultsByPromptIndex = new(); + Dictionary finishReasonsByChoiceIndex = new(); + Dictionary textBuildersByChoiceIndex = new(); - await foreach (StreamingChoice choice in responseValue.GetChoicesStreaming()) + await foreach (Completions streamingCompletions in response) { - List textPartsForChoice = new(); - StringBuilder choiceTextBuilder = new(); - await foreach (string choiceTextPart in choice.GetTextStreaming()) + if (streamingCompletions.PromptFilterResults is not null) { - choiceTextBuilder.Append(choiceTextPart); - textPartsForChoice.Add(choiceTextPart); + foreach (PromptFilterResult promptFilterResult in streamingCompletions.PromptFilterResults) + { + // When providing multiple prompts, the filter results may arrive across separate messages and + // the payload array index may differ from the in-data index property + AssertExpectedContentFilterResults(promptFilterResult.ContentFilterResults, serviceTarget); + promptFilterResultsByPromptIndex[promptFilterResult.PromptIndex] = promptFilterResult; + } + } + foreach (Choice choice in streamingCompletions.Choices) + { + if (choice.FinishReason.HasValue) + { + // Each choice should only receive a single finish reason and, in this case, it should be + // 'stop' + Assert.That(!finishReasonsByChoiceIndex.ContainsKey(choice.Index)); + Assert.That(choice.FinishReason.Value == CompletionsFinishReason.Stopped); + finishReasonsByChoiceIndex[choice.Index] = choice.FinishReason.Value; + } + + // The 'Text' property of streamed Completions will only contain the incremental update for a + // choice; these should be appended to each other to form the complete text + if (!textBuildersByChoiceIndex.ContainsKey(choice.Index)) + { + textBuildersByChoiceIndex[choice.Index] = new(); + } + textBuildersByChoiceIndex[choice.Index].Append(choice.Text); + + Assert.That(choice.LogProbabilityModel, Is.Not.Null); + + if (!string.IsNullOrEmpty(choice.Text)) + { + // Content filter results are only populated when content (text) is present + AssertExpectedContentFilterResults(choice.ContentFilterResults, serviceTarget); + } } - Assert.That(choiceTextBuilder.ToString(), Is.Not.Null.Or.Empty); - Assert.That(choice.LogProbabilityModel, Is.Not.Null); - AssertExpectedContentFilterResults(choice.ContentFilterResults, serviceTarget); - originallyEnumeratedChoices++; - originallyEnumeratedTextParts.Add(textPartsForChoice); } - // Note: these top-level values *are likely not yet populated* until *after* at least one streaming - // choice has arrived. - Assert.That(response.GetRawResponse(), Is.Not.Null.Or.Empty); - Assert.That(responseValue.Id, Is.Not.Null.Or.Empty); - Assert.That(responseValue.Created, Is.GreaterThan(new DateTimeOffset(new DateTime(2023, 1, 1)))); - Assert.That(responseValue.Created, Is.LessThan(DateTimeOffset.UtcNow.AddDays(7))); - - AssertExpectedPromptFilterResults( - responseValue.PromptFilterResults, - serviceTarget, - expectedCount: requestOptions.Prompts.Count * (requestOptions.ChoicesPerPrompt ?? 1)); + int expectedPromptCount = requestOptions.Prompts.Count; + int expectedChoiceCount = expectedPromptCount * (requestOptions.ChoicesPerPrompt ?? 1); - // Validate stability of enumeration (non-cancelled case) - IReadOnlyList secondPassChoices = await GetBlockingListFromIAsyncEnumerable( - responseValue.GetChoicesStreaming()); - Assert.AreEqual(originallyEnumeratedChoices, secondPassChoices.Count); - for (int i = 0; i < secondPassChoices.Count; i++) + if (serviceTarget == OpenAIClientServiceTarget.Azure) { - IReadOnlyList secondPassTextParts = await GetBlockingListFromIAsyncEnumerable( - secondPassChoices[i].GetTextStreaming()); - Assert.AreEqual(originallyEnumeratedTextParts[i].Count, secondPassTextParts.Count); - for (int j = 0; j < originallyEnumeratedTextParts[i].Count; j++) + for (int i = 0; i < expectedPromptCount; i++) { - Assert.AreEqual(originallyEnumeratedTextParts[i][j], secondPassTextParts[j]); + Assert.That(promptFilterResultsByPromptIndex.ContainsKey(i)); } } + + for (int i = 0; i < expectedChoiceCount; i++) + { + Assert.That(finishReasonsByChoiceIndex.ContainsKey(i)); + Assert.That(textBuildersByChoiceIndex.ContainsKey(i)); + Assert.That(textBuildersByChoiceIndex[i].ToString(), Is.Not.Null.Or.Empty); + } } [RecordedTest] @@ -458,18 +497,6 @@ public void JsonTypeSerialization() Assert.That(messageFromUtf8Bytes.Content, Is.EqualTo(originalMessage.Content)); } - // Lightweight reimplementation of .NET 7 .ToBlockingEnumerable().ToList() - private static async Task> GetBlockingListFromIAsyncEnumerable( - IAsyncEnumerable asyncValues) - { - List result = new(); - await foreach (T asyncValue in asyncValues) - { - result.Add(asyncValue); - } - return result; - } - private void AssertExpectedPromptFilterResults( IReadOnlyList promptFilterResults, OpenAIClientServiceTarget serviceTarget, diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample01_Chatbot.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample01_Chatbot.cs index 0b8687ee008d6..0056142fe5170 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample01_Chatbot.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample01_Chatbot.cs @@ -20,11 +20,13 @@ public void GetChatbotResponse() var client = new OpenAIClient(new Uri(endpoint), new DefaultAzureCredential()); #endregion - string deploymentName = "text-davinci-003"; - string prompt = "What is Azure OpenAI?"; - Console.Write($"Input: {prompt}"); + CompletionsOptions completionsOptions = new() + { + DeploymentName = "text-davinci-003", + Prompts = { "What is Azure OpenAI?" }, + }; - Response completionsResponse = client.GetCompletions(deploymentName, prompt); + Response completionsResponse = client.GetCompletions(completionsOptions); string completion = completionsResponse.Value.Choices[0].Text; Console.WriteLine($"Chatbot: {completion}"); #endregion diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample02_ChatbotWithKey.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample02_ChatbotWithKey.cs index 09209f56edf86..bf4ce204c8447 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample02_ChatbotWithKey.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample02_ChatbotWithKey.cs @@ -19,25 +19,24 @@ public void GetMultipleResponsesWithSubscriptionKey() string endpoint = "https://myaccount.openai.azure.com/"; var client = new OpenAIClient(new Uri(endpoint), new AzureKeyCredential(key)); - List examplePrompts = new(){ - "How are you today?", - "What is Azure OpenAI?", - "Why do children love dinosaurs?", - "Generate a proof of Euler's identity", - "Describe in single words only the good things that come into your mind about your mother.", + CompletionsOptions completionsOptions = new() + { + DeploymentName = "text-davinci-003", + Prompts = + { + "How are you today?", + "What is Azure OpenAI?", + "Why do children love dinosaurs?", + "Generate a proof of Euler's identity", + "Describe in single words only the good things that come into your mind about your mother." + }, }; - string deploymentName = "text-davinci-003"; + Response completionsResponse = client.GetCompletions(completionsOptions); - foreach (string prompt in examplePrompts) + foreach (Choice choice in completionsResponse.Value.Choices) { - Console.Write($"Input: {prompt}"); - CompletionsOptions completionsOptions = new CompletionsOptions(); - completionsOptions.Prompts.Add(prompt); - - Response completionsResponse = client.GetCompletions(deploymentName, completionsOptions); - string completion = completionsResponse.Value.Choices[0].Text; - Console.WriteLine($"Chatbot: {completion}"); + Console.WriteLine($"Response for prompt {choice.Index}: {choice.Text}"); } #endregion } diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample03_SummarizeText.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample03_SummarizeText.cs index 97ef9d0df7f6b..aef9f2a94301d 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample03_SummarizeText.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample03_SummarizeText.cs @@ -38,12 +38,11 @@ Summarize the following text. Console.Write($"Input: {summarizationPrompt}"); var completionsOptions = new CompletionsOptions() { + DeploymentName = "text-davinci-003", Prompts = { summarizationPrompt }, }; - string deploymentName = "text-davinci-003"; - - Response completionsResponse = client.GetCompletions(deploymentName, completionsOptions); + Response completionsResponse = client.GetCompletions(completionsOptions); string completion = completionsResponse.Value.Choices[0].Text; Console.WriteLine($"Summarization: {completion}"); #endregion diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample04_StreamingChat.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample04_StreamingChat.cs index 21a25241f13d2..af229369b9c29 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample04_StreamingChat.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample04_StreamingChat.cs @@ -2,9 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Threading.Tasks; -using Azure.Identity; using NUnit.Framework; namespace Azure.AI.OpenAI.Tests.Samples @@ -20,6 +18,7 @@ public async Task StreamingChatWithNonAzureOpenAI() var client = new OpenAIClient(nonAzureOpenAIApiKey, new OpenAIClientOptions()); var chatCompletionsOptions = new ChatCompletionsOptions() { + DeploymentName = "gpt-3.5-turbo", // Use DeploymentName for "model" with non-Azure clients Messages = { new ChatMessage(ChatRole.System, "You are a helpful assistant. You will talk like a pirate."), @@ -29,18 +28,54 @@ public async Task StreamingChatWithNonAzureOpenAI() } }; - Response response = await client.GetChatCompletionsStreamingAsync( - deploymentOrModelName: "gpt-3.5-turbo", - chatCompletionsOptions); - using StreamingChatCompletions streamingChatCompletions = response.Value; + await foreach (StreamingChatCompletionsUpdate chatUpdate in client.GetChatCompletionsStreaming(chatCompletionsOptions)) + { + if (chatUpdate.Role.HasValue) + { + Console.Write($"{chatUpdate.Role.Value.ToString().ToUpperInvariant()}: "); + } + if (!string.IsNullOrEmpty(chatUpdate.ContentUpdate)) + { + Console.Write(chatUpdate.ContentUpdate); + } + } + #endregion + } + + [Test] + [Ignore("Only verifying that the sample builds")] + public async Task StreamingChatWithMultipleChoices() + { + string nonAzureOpenAIApiKey = "your-api-key-from-platform.openai.com"; + var client = new OpenAIClient(nonAzureOpenAIApiKey, new OpenAIClientOptions()); + (object, string Text)[] textBoxes = new (object, string)[4]; + + #region Snippet:StreamChatMessagesWithMultipleChoices + // A ChoiceCount > 1 will feature multiple, parallel, independent text generations arriving on the + // same response. This may be useful when choosing between multiple candidates for a single request. + var chatCompletionsOptions = new ChatCompletionsOptions() + { + Messages = { new ChatMessage(ChatRole.User, "Write a limerick about bananas.") }, + ChoiceCount = 4 + }; - await foreach (StreamingChatChoice choice in streamingChatCompletions.GetChoicesStreaming()) + await foreach (StreamingChatCompletionsUpdate chatUpdate + in client.GetChatCompletionsStreaming(chatCompletionsOptions)) { - await foreach (ChatMessage message in choice.GetMessageStreaming()) + // Choice-specific information like Role and ContentUpdate will also provide a ChoiceIndex that allows + // StreamingChatCompletionsUpdate data for independent choices to be appropriately separated. + if (chatUpdate.ChoiceIndex.HasValue) { - Console.Write(message.Content); + int choiceIndex = chatUpdate.ChoiceIndex.Value; + if (chatUpdate.Role.HasValue) + { + textBoxes[choiceIndex].Text += $"{chatUpdate.Role.Value.ToString().ToUpperInvariant()}: "; + } + if (!string.IsNullOrEmpty(chatUpdate.ContentUpdate)) + { + textBoxes[choiceIndex].Text += chatUpdate.ContentUpdate; + } } - Console.WriteLine(); } #endregion } diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample05_AzureOrNot.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample05_AzureOrNot.cs index b3425873b3ebc..61379a0725965 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample05_AzureOrNot.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample05_AzureOrNot.cs @@ -23,9 +23,11 @@ public async Task GetCompletionsFromAzureOrNonAzureOpenAIAsync(bool useAzureOpen : new OpenAIClient("your-api-key-from-platform.openai.com"); #endregion - Response response = await client.GetCompletionsAsync( - "text-davinci-003", // assumes a matching model deployment or model name - "Hello, world!"); + Response response = await client.GetCompletionsAsync(new CompletionsOptions() + { + DeploymentName = "text-davinci-003", // assumes a matching model deployment or model name + Prompts = { "Hello, world!" }, + }); foreach (Choice choice in response.Value.Choices) { diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample06_ImageGenerations.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample06_ImageGenerations.cs index d6b9cd5ecf6af..f8416d63665e3 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample06_ImageGenerations.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample06_ImageGenerations.cs @@ -9,7 +9,7 @@ namespace Azure.AI.OpenAI.Tests.Samples { - public partial class StreamingChat + public partial class ImagesSamples { [Test] [Ignore("Only verifying that the sample builds")] diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample07_ChatFunctions.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample07_ChatFunctions.cs index 7b747adc2dfdc..69ed13eb9ec47 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample07_ChatFunctions.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample07_ChatFunctions.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using System.IO; +using System.Text; using System.Text.Json; using System.Threading.Tasks; using Azure.Identity; @@ -54,16 +54,17 @@ public async Task ChatFunctions() new(ChatRole.User, "What is the weather like in Boston?"), }; - var chatCompletionsOptions = new ChatCompletionsOptions(); + var chatCompletionsOptions = new ChatCompletionsOptions() + { + DeploymentName = "gpt-35-turbo-0613", + }; foreach (ChatMessage chatMessage in conversationMessages) { chatCompletionsOptions.Messages.Add(chatMessage); } chatCompletionsOptions.Functions.Add(getWeatherFuntionDefinition); - Response response = await client.GetChatCompletionsAsync( - "gpt-35-turbo-0613", - chatCompletionsOptions); + Response response = await client.GetChatCompletionsAsync(chatCompletionsOptions); #endregion #region Snippet:ChatFunctions:HandleFunctionCall @@ -99,6 +100,37 @@ public async Task ChatFunctions() } } #endregion + + #region Snippet::ChatFunctions::StreamingFunctions + string functionName = null; + StringBuilder contentBuilder = new(); + StringBuilder functionArgumentsBuilder = new(); + ChatRole streamedRole = default; + CompletionsFinishReason finishReason = default; + + await foreach (StreamingChatCompletionsUpdate update + in client.GetChatCompletionsStreaming(chatCompletionsOptions)) + { + contentBuilder.Append(update.ContentUpdate); + functionName ??= update.FunctionName; + functionArgumentsBuilder.Append(update.FunctionArgumentsUpdate); + streamedRole = update.Role ?? default; + finishReason = update.FinishReason ?? default; + } + + if (finishReason == CompletionsFinishReason.FunctionCall) + { + string lastContent = contentBuilder.ToString(); + string unvalidatedArguments = functionArgumentsBuilder.ToString(); + ChatMessage chatMessageForHistory = new(streamedRole, lastContent) + { + FunctionCall = new(functionName, unvalidatedArguments), + }; + conversationMessages.Add(chatMessageForHistory); + + // Handle from here just like the non-streaming case + } + #endregion } } } diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample08_UseYourOwnData.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample08_UseYourOwnData.cs index fb142a89a82b9..e12ac32a75fb4 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample08_UseYourOwnData.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample08_UseYourOwnData.cs @@ -23,6 +23,7 @@ public async Task ChatUsingYourOwnData() #region Snippet:ChatUsingYourOwnData var chatCompletionsOptions = new ChatCompletionsOptions() { + DeploymentName = "gpt-35-turbo-0613", Messages = { new ChatMessage( @@ -46,9 +47,7 @@ public async Task ChatUsingYourOwnData() } } }; - Response response = await client.GetChatCompletionsAsync( - "gpt-35-turbo-0613", - chatCompletionsOptions); + Response response = await client.GetChatCompletionsAsync(chatCompletionsOptions); ChatMessage message = response.Value.Choices[0].Message; // The final, data-informed response still appears in the ChatMessages as usual Console.WriteLine($"{message.Role}: {message.Content}"); diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample09_TranscribeAudio.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample09_TranscribeAudio.cs index fb77d2f21993e..081d3319ae6e1 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample09_TranscribeAudio.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample09_TranscribeAudio.cs @@ -9,7 +9,7 @@ namespace Azure.AI.OpenAI.Tests.Samples { - public partial class StreamingChat + public partial class AudioSamples { [Test] [Ignore("Only verifying that the sample builds")] @@ -23,13 +23,13 @@ public async Task TranscribeAudio() var transcriptionOptions = new AudioTranscriptionOptions() { + DeploymentName = "my-whisper-deployment", // whisper-1 as model name for non-Azure OpenAI AudioData = BinaryData.FromStream(audioStreamFromFile), ResponseFormat = AudioTranscriptionFormat.Verbose, }; - Response transcriptionResponse = await client.GetAudioTranscriptionAsync( - deploymentId: "my-whisper-deployment", // whisper-1 as model name for non-Azure OpenAI - transcriptionOptions); + Response transcriptionResponse + = await client.GetAudioTranscriptionAsync(transcriptionOptions); AudioTranscription transcription = transcriptionResponse.Value; // When using Simple, SRT, or VTT formats, only transcription.Text will be populated diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample10_TranslateAudio.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample10_TranslateAudio.cs index 8b3bfabe95ec1..02716ef0310e4 100644 --- a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample10_TranslateAudio.cs +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample10_TranslateAudio.cs @@ -9,7 +9,7 @@ namespace Azure.AI.OpenAI.Tests.Samples { - public partial class StreamingChat + public partial class AudioSamples { [Test] [Ignore("Only verifying that the sample builds")] @@ -23,13 +23,12 @@ public async Task TranslateAudio() var translationOptions = new AudioTranslationOptions() { + DeploymentName = "my-whisper-deployment", // whisper-1 as model name for non-Azure OpenAI AudioData = BinaryData.FromStream(audioStreamFromFile), ResponseFormat = AudioTranslationFormat.Verbose, }; - Response translationResponse = await client.GetAudioTranslationAsync( - deploymentId: "my-whisper-deployment", // whisper-1 as model name for non-Azure OpenAI - translationOptions); + Response translationResponse = await client.GetAudioTranslationAsync(translationOptions); AudioTranslation translation = translationResponse.Value; // When using Simple, SRT, or VTT formats, only translation.Text will be populated diff --git a/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample11_Embeddings.cs b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample11_Embeddings.cs new file mode 100644 index 0000000000000..47e65fa9b33b8 --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/tests/Samples/Sample11_Embeddings.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.OpenAI.Tests.Samples +{ + public partial class EmbeddingsSamples + { + [Test] + [Ignore("Only verifying that the sample builds")] + public async Task GenerateEmbeddings() + { + string endpoint = "https://myaccount.openai.azure.com/"; + var client = new OpenAIClient(new Uri(endpoint), new DefaultAzureCredential()); + + #region Snippet:GenerateEmbeddings + EmbeddingsOptions embeddingsOptions = new() + { + DeploymentName = "text-embedding-ada-002", + Input = { "Your text string goes here" }, + }; + Response response = await client.GetEmbeddingsAsync(embeddingsOptions); + + // The response includes the generated embedding. + EmbeddingItem item = response.Value.Data[0]; + ReadOnlyMemory embedding = item.Embedding; + #endregion + } + } +} diff --git a/sdk/openai/Azure.AI.OpenAI/tests/StreamingResponseTests.cs b/sdk/openai/Azure.AI.OpenAI/tests/StreamingResponseTests.cs new file mode 100644 index 0000000000000..a1d59a9361954 --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/tests/StreamingResponseTests.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using NUnit.Framework; + +namespace Azure.AI.OpenAI.Tests; + +[TestFixture] +public class StreamingResponseTests +{ + [Test] + public async Task SingleEnumeration() + { + byte[] responseCharacters = Encoding.UTF8.GetBytes("abcde"); + using Stream responseStream = new MemoryStream(responseCharacters); + + StreamingResponse response = StreamingResponse.CreateFromResponse( + response: new TestResponse(responseStream), + asyncEnumerableProcessor: (r) => EnumerateCharactersFromResponse(r)); + + int index = 0; + await foreach (char characterInResponse in response) + { + Assert.That(index < responseCharacters.Length); + Assert.That((char)responseCharacters[index] == characterInResponse); + index++; + } + Assert.That(index == responseCharacters.Length); + } + + [Test] + public async Task CancellationViaParameter() + { + byte[] responseCharacters = Encoding.UTF8.GetBytes("abcdefg"); + using Stream responseStream = new MemoryStream(responseCharacters); + + var cancelSource = new CancellationTokenSource(); + + StreamingResponse response = StreamingResponse.CreateFromResponse( + response: new TestResponse(responseStream), + asyncEnumerableProcessor: (r) => EnumerateCharactersFromResponse(r, cancelSource.Token)); + + int index = 0; + await foreach (char characterInResponse in response) + { + Assert.That(index < responseCharacters.Length); + Assert.That((char)responseCharacters[index] == characterInResponse); + if (index == 2) + { + cancelSource.Cancel(); + } + index++; + } + Assert.That(index == 3); + } + + [Test] + public async Task CancellationViaWithCancellation() + { + byte[] responseCharacters = Encoding.UTF8.GetBytes("abcdefg"); + using Stream responseStream = new MemoryStream(responseCharacters); + + async static IAsyncEnumerable EnumerateViaWithCancellation( + Response response, + [EnumeratorCancellation] CancellationToken cancellationToken) + { + ConfiguredCancelableAsyncEnumerable enumerable + = EnumerateCharactersFromResponse(response).WithCancellation(cancellationToken); + await foreach (var character in enumerable) + { + yield return character; + } + } + + var cancelSource = new CancellationTokenSource(); + + StreamingResponse response = StreamingResponse.CreateFromResponse( + response: new TestResponse(responseStream), + asyncEnumerableProcessor: (r) => EnumerateViaWithCancellation(r, cancelSource.Token)); + + int index = 0; + await foreach (char characterInResponse in response) + { + Assert.That(index < responseCharacters.Length); + Assert.That((char)responseCharacters[index] == characterInResponse); + if (index == 2) + { + cancelSource.Cancel(); + } + index++; + } + Assert.That(index == 3); + } + + [Test] + public async Task CancellationWhenThrowing() + { + byte[] responseCharacters = Encoding.UTF8.GetBytes("abcdefg"); + using Stream responseStream = new MemoryStream(responseCharacters); + + var cancelSource = new CancellationTokenSource(); + + StreamingResponse response = StreamingResponse.CreateFromResponse( + response: new TestResponse(responseStream), + asyncEnumerableProcessor: (r) => EnumerateCharactersFromResponse(r, cancelSource.Token)); + + int index = 0; + await foreach (char characterInResponse in response) + { + Assert.That(index < responseCharacters.Length); + Assert.That((char)responseCharacters[index] == characterInResponse); + if (index == 2) + { + cancelSource.Cancel(); + } + index++; + } + Assert.That(index == 3); + + Exception exception = null; + try + { + cancelSource.Token.ThrowIfCancellationRequested(); + } + catch (Exception ex) + { + exception = ex; + } + + Assert.That(exception, Is.InstanceOf()); + } + + private static async IAsyncEnumerable EnumerateCharactersFromResponse( + Response responseToEnumerate, + [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + if (responseToEnumerate?.ContentStream?.CanRead == true) + { + byte[] buffer = new byte[1]; + while ( + !cancellationToken.IsCancellationRequested + && (await responseToEnumerate.ContentStream.ReadAsync(buffer, 0, 1)) == 1) + { + yield return (char)buffer[0]; + } + } + } + + private class TestResponse : Response + { + public override int Status => throw new NotImplementedException(); + + public override string ReasonPhrase => throw new NotImplementedException(); + + public override Stream ContentStream + { + get => _contentStream; + set => throw new NotImplementedException(); + } + + public override string ClientRequestId + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + private Stream _contentStream { get; } + + public TestResponse(Stream stream) + { + _contentStream = stream; + } + + public override void Dispose() => _contentStream?.Dispose(); + + protected override bool ContainsHeader(string name) => throw new NotImplementedException(); + + protected override IEnumerable EnumerateHeaders() + => throw new NotImplementedException(); + + protected override bool TryGetHeader(string name, out string value) + => throw new NotImplementedException(); + + protected override bool TryGetHeaderValues(string name, out IEnumerable values) + => throw new NotImplementedException(); + } +} diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/api/Azure.ResourceManager.EnergyServices.netstandard2.0.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/api/Azure.ResourceManager.EnergyServices.netstandard2.0.cs index da5b66d4ae14c..e340c85fcf1c4 100644 --- a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/api/Azure.ResourceManager.EnergyServices.netstandard2.0.cs +++ b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/api/Azure.ResourceManager.EnergyServices.netstandard2.0.cs @@ -19,7 +19,7 @@ protected EnergyServiceCollection() { } } public partial class EnergyServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public EnergyServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public EnergyServiceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.EnergyServices.Models.EnergyServiceProperties Properties { get { throw null; } set { } } } public partial class EnergyServiceResource : Azure.ResourceManager.ArmResource @@ -60,6 +60,29 @@ public static partial class EnergyServicesExtensions public static Azure.AsyncPageable GetEnergyServicesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.EnergyServices.Mocking +{ + public partial class MockableEnergyServicesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableEnergyServicesArmClient() { } + public virtual Azure.ResourceManager.EnergyServices.EnergyServiceResource GetEnergyServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableEnergyServicesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableEnergyServicesResourceGroupResource() { } + public virtual Azure.Response GetEnergyService(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEnergyServiceAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.EnergyServices.EnergyServiceCollection GetEnergyServices() { throw null; } + } + public partial class MockableEnergyServicesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableEnergyServicesSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityLocation(Azure.ResourceManager.EnergyServices.Models.EnergyServiceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityLocationAsync(Azure.ResourceManager.EnergyServices.Models.EnergyServiceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEnergyServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEnergyServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.EnergyServices.Models { public static partial class ArmEnergyServicesModelFactory diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/EnergyServiceResource.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/EnergyServiceResource.cs index d17ce92b192e8..ab069dc3aa0ee 100644 --- a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/EnergyServiceResource.cs +++ b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/EnergyServiceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.EnergyServices public partial class EnergyServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices/{resourceName}"; diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/EnergyServicesExtensions.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/EnergyServicesExtensions.cs index 28f24985b0f8d..3ee7fcf909c4d 100644 --- a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/EnergyServicesExtensions.cs +++ b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/EnergyServicesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.EnergyServices.Mocking; using Azure.ResourceManager.EnergyServices.Models; using Azure.ResourceManager.Resources; @@ -19,62 +20,49 @@ namespace Azure.ResourceManager.EnergyServices /// A class to add extension methods to Azure.ResourceManager.EnergyServices. public static partial class EnergyServicesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableEnergyServicesArmClient GetMockableEnergyServicesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableEnergyServicesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableEnergyServicesResourceGroupResource GetMockableEnergyServicesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableEnergyServicesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableEnergyServicesSubscriptionResource GetMockableEnergyServicesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableEnergyServicesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region EnergyServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EnergyServiceResource GetEnergyServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EnergyServiceResource.ValidateResourceId(id); - return new EnergyServiceResource(client, id); - } - ); + return GetMockableEnergyServicesArmClient(client).GetEnergyServiceResource(id); } - #endregion - /// Gets a collection of EnergyServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of EnergyServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of EnergyServiceResources and their operations over a EnergyServiceResource. public static EnergyServiceCollection GetEnergyServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetEnergyServices(); + return GetMockableEnergyServicesResourceGroupResource(resourceGroupResource).GetEnergyServices(); } /// @@ -89,16 +77,20 @@ public static EnergyServiceCollection GetEnergyServices(this ResourceGroupResour /// EnergyServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetEnergyServiceAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetEnergyServices().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableEnergyServicesResourceGroupResource(resourceGroupResource).GetEnergyServiceAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -113,16 +105,20 @@ public static async Task> GetEnergyServiceAsync( /// EnergyServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetEnergyService(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetEnergyServices().Get(resourceName, cancellationToken); + return GetMockableEnergyServicesResourceGroupResource(resourceGroupResource).GetEnergyService(resourceName, cancellationToken); } /// @@ -137,6 +133,10 @@ public static Response GetEnergyService(this ResourceGrou /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// NameAvailabilityRequest object. @@ -144,9 +144,7 @@ public static Response GetEnergyService(this ResourceGrou /// is null. public static async Task> CheckNameAvailabilityLocationAsync(this SubscriptionResource subscriptionResource, EnergyServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityLocationAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableEnergyServicesSubscriptionResource(subscriptionResource).CheckNameAvailabilityLocationAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -161,6 +159,10 @@ public static async Task> CheckNam /// Locations_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// NameAvailabilityRequest object. @@ -168,9 +170,7 @@ public static async Task> CheckNam /// is null. public static Response CheckNameAvailabilityLocation(this SubscriptionResource subscriptionResource, EnergyServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityLocation(content, cancellationToken); + return GetMockableEnergyServicesSubscriptionResource(subscriptionResource).CheckNameAvailabilityLocation(content, cancellationToken); } /// @@ -185,13 +185,17 @@ public static Response CheckNameAvailabilit /// EnergyServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEnergyServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEnergyServicesAsync(cancellationToken); + return GetMockableEnergyServicesSubscriptionResource(subscriptionResource).GetEnergyServicesAsync(cancellationToken); } /// @@ -206,13 +210,17 @@ public static AsyncPageable GetEnergyServicesAsync(this S /// EnergyServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetEnergyServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetEnergyServices(cancellationToken); + return GetMockableEnergyServicesSubscriptionResource(subscriptionResource).GetEnergyServices(cancellationToken); } } } diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesArmClient.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesArmClient.cs new file mode 100644 index 0000000000000..c4e2233236428 --- /dev/null +++ b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.EnergyServices; + +namespace Azure.ResourceManager.EnergyServices.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableEnergyServicesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableEnergyServicesArmClient() + { + } + + /// 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 MockableEnergyServicesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableEnergyServicesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EnergyServiceResource GetEnergyServiceResource(ResourceIdentifier id) + { + EnergyServiceResource.ValidateResourceId(id); + return new EnergyServiceResource(Client, id); + } + } +} diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesResourceGroupResource.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesResourceGroupResource.cs new file mode 100644 index 0000000000000..2b5e8a3e68ff8 --- /dev/null +++ b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.EnergyServices; + +namespace Azure.ResourceManager.EnergyServices.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableEnergyServicesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableEnergyServicesResourceGroupResource() + { + } + + /// 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 MockableEnergyServicesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of EnergyServiceResources in the ResourceGroupResource. + /// An object representing collection of EnergyServiceResources and their operations over a EnergyServiceResource. + public virtual EnergyServiceCollection GetEnergyServices() + { + return GetCachedClient(client => new EnergyServiceCollection(client, Id)); + } + + /// + /// Returns oep resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices/{resourceName} + /// + /// + /// Operation Id + /// EnergyServices_Get + /// + /// + /// + /// The resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEnergyServiceAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetEnergyServices().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns oep resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices/{resourceName} + /// + /// + /// Operation Id + /// EnergyServices_Get + /// + /// + /// + /// The resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEnergyService(string resourceName, CancellationToken cancellationToken = default) + { + return GetEnergyServices().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesSubscriptionResource.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesSubscriptionResource.cs new file mode 100644 index 0000000000000..eec4ddf2ee3d7 --- /dev/null +++ b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/MockableEnergyServicesSubscriptionResource.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.EnergyServices; +using Azure.ResourceManager.EnergyServices.Models; + +namespace Azure.ResourceManager.EnergyServices.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableEnergyServicesSubscriptionResource : ArmResource + { + private ClientDiagnostics _locationsClientDiagnostics; + private LocationsRestOperations _locationsRestClient; + private ClientDiagnostics _energyServiceClientDiagnostics; + private EnergyServicesRestOperations _energyServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableEnergyServicesSubscriptionResource() + { + } + + /// 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 MockableEnergyServicesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EnergyServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics EnergyServiceClientDiagnostics => _energyServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EnergyServices", EnergyServiceResource.ResourceType.Namespace, Diagnostics); + private EnergyServicesRestOperations EnergyServiceRestClient => _energyServiceRestClient ??= new EnergyServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EnergyServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks the name availability of the resource with requested resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// NameAvailabilityRequest object. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNameAvailabilityLocationAsync(EnergyServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableEnergyServicesSubscriptionResource.CheckNameAvailabilityLocation"); + scope.Start(); + try + { + var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks the name availability of the resource with requested resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/checkNameAvailability + /// + /// + /// Operation Id + /// Locations_CheckNameAvailability + /// + /// + /// + /// NameAvailabilityRequest object. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNameAvailabilityLocation(EnergyServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = LocationsClientDiagnostics.CreateScope("MockableEnergyServicesSubscriptionResource.CheckNameAvailabilityLocation"); + scope.Start(); + try + { + var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists a collection of oep resources under the given Azure Subscription ID. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/energyServices + /// + /// + /// Operation Id + /// EnergyServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEnergyServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EnergyServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EnergyServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EnergyServiceResource(Client, EnergyServiceData.DeserializeEnergyServiceData(e)), EnergyServiceClientDiagnostics, Pipeline, "MockableEnergyServicesSubscriptionResource.GetEnergyServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists a collection of oep resources under the given Azure Subscription ID. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/energyServices + /// + /// + /// Operation Id + /// EnergyServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEnergyServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EnergyServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EnergyServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EnergyServiceResource(Client, EnergyServiceData.DeserializeEnergyServiceData(e)), EnergyServiceClientDiagnostics, Pipeline, "MockableEnergyServicesSubscriptionResource.GetEnergyServices", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index b9f0b6bae0324..0000000000000 --- a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.EnergyServices -{ - /// 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 EnergyServiceResources in the ResourceGroupResource. - /// An object representing collection of EnergyServiceResources and their operations over a EnergyServiceResource. - public virtual EnergyServiceCollection GetEnergyServices() - { - return GetCachedClient(Client => new EnergyServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index f64fa14a96057..0000000000000 --- a/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.EnergyServices.Models; - -namespace Azure.ResourceManager.EnergyServices -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _locationsClientDiagnostics; - private LocationsRestOperations _locationsRestClient; - private ClientDiagnostics _energyServiceClientDiagnostics; - private EnergyServicesRestOperations _energyServiceRestClient; - - /// 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 LocationsClientDiagnostics => _locationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EnergyServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationsRestOperations LocationsRestClient => _locationsRestClient ??= new LocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics EnergyServiceClientDiagnostics => _energyServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.EnergyServices", EnergyServiceResource.ResourceType.Namespace, Diagnostics); - private EnergyServicesRestOperations EnergyServiceRestClient => _energyServiceRestClient ??= new EnergyServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EnergyServiceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks the name availability of the resource with requested resource name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// NameAvailabilityRequest object. - /// The cancellation token to use. - public virtual async Task> CheckNameAvailabilityLocationAsync(EnergyServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityLocation"); - scope.Start(); - try - { - var response = await LocationsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks the name availability of the resource with requested resource name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/checkNameAvailability - /// - /// - /// Operation Id - /// Locations_CheckNameAvailability - /// - /// - /// - /// NameAvailabilityRequest object. - /// The cancellation token to use. - public virtual Response CheckNameAvailabilityLocation(EnergyServiceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = LocationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityLocation"); - scope.Start(); - try - { - var response = LocationsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists a collection of oep resources under the given Azure Subscription ID. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/energyServices - /// - /// - /// Operation Id - /// EnergyServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetEnergyServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EnergyServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EnergyServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EnergyServiceResource(Client, EnergyServiceData.DeserializeEnergyServiceData(e)), EnergyServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEnergyServices", "value", "nextLink", cancellationToken); - } - - /// - /// Lists a collection of oep resources under the given Azure Subscription ID. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/energyServices - /// - /// - /// Operation Id - /// EnergyServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetEnergyServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EnergyServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EnergyServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EnergyServiceResource(Client, EnergyServiceData.DeserializeEnergyServiceData(e)), EnergyServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetEnergyServices", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/api/Azure.ResourceManager.OperationalInsights.netstandard2.0.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/api/Azure.ResourceManager.OperationalInsights.netstandard2.0.cs index 3a94eae169f4b..37b8f9872a7ea 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/api/Azure.ResourceManager.OperationalInsights.netstandard2.0.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/api/Azure.ResourceManager.OperationalInsights.netstandard2.0.cs @@ -50,7 +50,7 @@ protected LogAnalyticsQueryPackCollection() { } } public partial class LogAnalyticsQueryPackData : Azure.ResourceManager.Models.TrackedResourceData { - public LogAnalyticsQueryPackData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LogAnalyticsQueryPackData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public System.DateTimeOffset? ModifiedOn { get { throw null; } } public string ProvisioningState { get { throw null; } } @@ -114,7 +114,7 @@ protected OperationalInsightsClusterCollection() { } } public partial class OperationalInsightsClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public OperationalInsightsClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public OperationalInsightsClusterData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AssociatedWorkspaces { get { throw null; } } public Azure.ResourceManager.OperationalInsights.Models.OperationalInsightsBillingType? BillingType { get { throw null; } set { } } public Azure.ResourceManager.OperationalInsights.Models.OperationalInsightsCapacityReservationProperties CapacityReservationProperties { get { throw null; } set { } } @@ -463,7 +463,7 @@ protected OperationalInsightsWorkspaceCollection() { } } public partial class OperationalInsightsWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public OperationalInsightsWorkspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public OperationalInsightsWorkspaceData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public System.Guid? CustomerId { get { throw null; } } public Azure.Core.ResourceIdentifier DefaultDataCollectionRuleResourceId { get { throw null; } set { } } @@ -593,6 +593,53 @@ protected StorageInsightResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.OperationalInsights.StorageInsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.OperationalInsights.Mocking +{ + public partial class MockableOperationalInsightsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableOperationalInsightsArmClient() { } + public virtual Azure.ResourceManager.OperationalInsights.LogAnalyticsQueryPackResource GetLogAnalyticsQueryPackResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.LogAnalyticsQueryResource GetLogAnalyticsQueryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsClusterResource GetOperationalInsightsClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsDataExportResource GetOperationalInsightsDataExportResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsDataSourceResource GetOperationalInsightsDataSourceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsLinkedServiceResource GetOperationalInsightsLinkedServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsLinkedStorageAccountsResource GetOperationalInsightsLinkedStorageAccountsResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsSavedSearchResource GetOperationalInsightsSavedSearchResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsTableResource GetOperationalInsightsTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsWorkspaceResource GetOperationalInsightsWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.StorageInsightResource GetStorageInsightResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableOperationalInsightsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableOperationalInsightsResourceGroupResource() { } + public virtual Azure.Response CreateOrUpdateWithoutNameQueryPack(Azure.ResourceManager.OperationalInsights.LogAnalyticsQueryPackData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateWithoutNameQueryPackAsync(Azure.ResourceManager.OperationalInsights.LogAnalyticsQueryPackData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeletedWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetLogAnalyticsQueryPack(string queryPackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLogAnalyticsQueryPackAsync(string queryPackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.LogAnalyticsQueryPackCollection GetLogAnalyticsQueryPacks() { throw null; } + public virtual Azure.Response GetOperationalInsightsCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOperationalInsightsClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsClusterCollection GetOperationalInsightsClusters() { throw null; } + public virtual Azure.Response GetOperationalInsightsWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOperationalInsightsWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.OperationalInsights.OperationalInsightsWorkspaceCollection GetOperationalInsightsWorkspaces() { throw null; } + } + public partial class MockableOperationalInsightsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableOperationalInsightsSubscriptionResource() { } + public virtual Azure.Pageable GetDeletedWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLogAnalyticsQueryPacks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLogAnalyticsQueryPacksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetOperationalInsightsClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationalInsightsClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetOperationalInsightsWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationalInsightsWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.OperationalInsights.Models { public static partial class ArmOperationalInsightsModelFactory diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsArmClient.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsArmClient.cs new file mode 100644 index 0000000000000..f887e80a63e4e --- /dev/null +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsArmClient.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.OperationalInsights; + +namespace Azure.ResourceManager.OperationalInsights.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableOperationalInsightsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableOperationalInsightsArmClient() + { + } + + /// 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 MockableOperationalInsightsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableOperationalInsightsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogAnalyticsQueryPackResource GetLogAnalyticsQueryPackResource(ResourceIdentifier id) + { + LogAnalyticsQueryPackResource.ValidateResourceId(id); + return new LogAnalyticsQueryPackResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogAnalyticsQueryResource GetLogAnalyticsQueryResource(ResourceIdentifier id) + { + LogAnalyticsQueryResource.ValidateResourceId(id); + return new LogAnalyticsQueryResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsDataExportResource GetOperationalInsightsDataExportResource(ResourceIdentifier id) + { + OperationalInsightsDataExportResource.ValidateResourceId(id); + return new OperationalInsightsDataExportResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsDataSourceResource GetOperationalInsightsDataSourceResource(ResourceIdentifier id) + { + OperationalInsightsDataSourceResource.ValidateResourceId(id); + return new OperationalInsightsDataSourceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsLinkedServiceResource GetOperationalInsightsLinkedServiceResource(ResourceIdentifier id) + { + OperationalInsightsLinkedServiceResource.ValidateResourceId(id); + return new OperationalInsightsLinkedServiceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsLinkedStorageAccountsResource GetOperationalInsightsLinkedStorageAccountsResource(ResourceIdentifier id) + { + OperationalInsightsLinkedStorageAccountsResource.ValidateResourceId(id); + return new OperationalInsightsLinkedStorageAccountsResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageInsightResource GetStorageInsightResource(ResourceIdentifier id) + { + StorageInsightResource.ValidateResourceId(id); + return new StorageInsightResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsSavedSearchResource GetOperationalInsightsSavedSearchResource(ResourceIdentifier id) + { + OperationalInsightsSavedSearchResource.ValidateResourceId(id); + return new OperationalInsightsSavedSearchResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsClusterResource GetOperationalInsightsClusterResource(ResourceIdentifier id) + { + OperationalInsightsClusterResource.ValidateResourceId(id); + return new OperationalInsightsClusterResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsWorkspaceResource GetOperationalInsightsWorkspaceResource(ResourceIdentifier id) + { + OperationalInsightsWorkspaceResource.ValidateResourceId(id); + return new OperationalInsightsWorkspaceResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsTableResource GetOperationalInsightsTableResource(ResourceIdentifier id) + { + OperationalInsightsTableResource.ValidateResourceId(id); + return new OperationalInsightsTableResource(Client, id); + } + } +} diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsResourceGroupResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsResourceGroupResource.cs new file mode 100644 index 0000000000000..73abf6988388b --- /dev/null +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsResourceGroupResource.cs @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.OperationalInsights; + +namespace Azure.ResourceManager.OperationalInsights.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableOperationalInsightsResourceGroupResource : ArmResource + { + private ClientDiagnostics _logAnalyticsQueryPackQueryPacksClientDiagnostics; + private QueryPacksRestOperations _logAnalyticsQueryPackQueryPacksRestClient; + private ClientDiagnostics _deletedWorkspacesClientDiagnostics; + private DeletedWorkspacesRestOperations _deletedWorkspacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableOperationalInsightsResourceGroupResource() + { + } + + /// 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 MockableOperationalInsightsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LogAnalyticsQueryPackQueryPacksClientDiagnostics => _logAnalyticsQueryPackQueryPacksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", LogAnalyticsQueryPackResource.ResourceType.Namespace, Diagnostics); + private QueryPacksRestOperations LogAnalyticsQueryPackQueryPacksRestClient => _logAnalyticsQueryPackQueryPacksRestClient ??= new QueryPacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogAnalyticsQueryPackResource.ResourceType)); + private ClientDiagnostics DeletedWorkspacesClientDiagnostics => _deletedWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DeletedWorkspacesRestOperations DeletedWorkspacesRestClient => _deletedWorkspacesRestClient ??= new DeletedWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LogAnalyticsQueryPackResources in the ResourceGroupResource. + /// An object representing collection of LogAnalyticsQueryPackResources and their operations over a LogAnalyticsQueryPackResource. + public virtual LogAnalyticsQueryPackCollection GetLogAnalyticsQueryPacks() + { + return GetCachedClient(client => new LogAnalyticsQueryPackCollection(client, Id)); + } + + /// + /// Returns a Log Analytics QueryPack. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName} + /// + /// + /// Operation Id + /// QueryPacks_Get + /// + /// + /// + /// The name of the Log Analytics QueryPack resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLogAnalyticsQueryPackAsync(string queryPackName, CancellationToken cancellationToken = default) + { + return await GetLogAnalyticsQueryPacks().GetAsync(queryPackName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a Log Analytics QueryPack. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName} + /// + /// + /// Operation Id + /// QueryPacks_Get + /// + /// + /// + /// The name of the Log Analytics QueryPack resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLogAnalyticsQueryPack(string queryPackName, CancellationToken cancellationToken = default) + { + return GetLogAnalyticsQueryPacks().Get(queryPackName, cancellationToken); + } + + /// Gets a collection of OperationalInsightsClusterResources in the ResourceGroupResource. + /// An object representing collection of OperationalInsightsClusterResources and their operations over a OperationalInsightsClusterResource. + public virtual OperationalInsightsClusterCollection GetOperationalInsightsClusters() + { + return GetCachedClient(client => new OperationalInsightsClusterCollection(client, Id)); + } + + /// + /// Gets a Log Analytics cluster instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the Log Analytics Cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetOperationalInsightsClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetOperationalInsightsClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Log Analytics cluster instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// Name of the Log Analytics Cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetOperationalInsightsCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetOperationalInsightsClusters().Get(clusterName, cancellationToken); + } + + /// Gets a collection of OperationalInsightsWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of OperationalInsightsWorkspaceResources and their operations over a OperationalInsightsWorkspaceResource. + public virtual OperationalInsightsWorkspaceCollection GetOperationalInsightsWorkspaces() + { + return GetCachedClient(client => new OperationalInsightsWorkspaceCollection(client, Id)); + } + + /// + /// Gets a workspace instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetOperationalInsightsWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetOperationalInsightsWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a workspace instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetOperationalInsightsWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetOperationalInsightsWorkspaces().Get(workspaceName, cancellationToken); + } + + /// + /// Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks + /// + /// + /// Operation Id + /// QueryPacks_CreateOrUpdateWithoutName + /// + /// + /// + /// Properties that need to be specified to create or update a Log Analytics QueryPack. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateWithoutNameQueryPackAsync(LogAnalyticsQueryPackData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = LogAnalyticsQueryPackQueryPacksClientDiagnostics.CreateScope("MockableOperationalInsightsResourceGroupResource.CreateOrUpdateWithoutNameQueryPack"); + scope.Start(); + try + { + var response = await LogAnalyticsQueryPackQueryPacksRestClient.CreateOrUpdateWithoutNameAsync(Id.SubscriptionId, Id.ResourceGroupName, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new LogAnalyticsQueryPackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks + /// + /// + /// Operation Id + /// QueryPacks_CreateOrUpdateWithoutName + /// + /// + /// + /// Properties that need to be specified to create or update a Log Analytics QueryPack. + /// The cancellation token to use. + /// is null. + public virtual Response CreateOrUpdateWithoutNameQueryPack(LogAnalyticsQueryPackData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = LogAnalyticsQueryPackQueryPacksClientDiagnostics.CreateScope("MockableOperationalInsightsResourceGroupResource.CreateOrUpdateWithoutNameQueryPack"); + scope.Start(); + try + { + var response = LogAnalyticsQueryPackQueryPacksRestClient.CreateOrUpdateWithoutName(Id.SubscriptionId, Id.ResourceGroupName, data, cancellationToken); + return Response.FromValue(new LogAnalyticsQueryPackResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets recently deleted workspaces in a resource group, available for recovery. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/deletedWorkspaces + /// + /// + /// Operation Id + /// DeletedWorkspaces_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedWorkspacesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), DeletedWorkspacesClientDiagnostics, Pipeline, "MockableOperationalInsightsResourceGroupResource.GetDeletedWorkspaces", "value", null, cancellationToken); + } + + /// + /// Gets recently deleted workspaces in a resource group, available for recovery. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/deletedWorkspaces + /// + /// + /// Operation Id + /// DeletedWorkspaces_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedWorkspacesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), DeletedWorkspacesClientDiagnostics, Pipeline, "MockableOperationalInsightsResourceGroupResource.GetDeletedWorkspaces", "value", null, cancellationToken); + } + } +} diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsSubscriptionResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsSubscriptionResource.cs new file mode 100644 index 0000000000000..4edbeb2ee0f10 --- /dev/null +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsSubscriptionResource.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.OperationalInsights; + +namespace Azure.ResourceManager.OperationalInsights.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableOperationalInsightsSubscriptionResource : ArmResource + { + private ClientDiagnostics _logAnalyticsQueryPackQueryPacksClientDiagnostics; + private QueryPacksRestOperations _logAnalyticsQueryPackQueryPacksRestClient; + private ClientDiagnostics _operationalInsightsClusterClustersClientDiagnostics; + private ClustersRestOperations _operationalInsightsClusterClustersRestClient; + private ClientDiagnostics _operationalInsightsWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _operationalInsightsWorkspaceWorkspacesRestClient; + private ClientDiagnostics _deletedWorkspacesClientDiagnostics; + private DeletedWorkspacesRestOperations _deletedWorkspacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableOperationalInsightsSubscriptionResource() + { + } + + /// 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 MockableOperationalInsightsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LogAnalyticsQueryPackQueryPacksClientDiagnostics => _logAnalyticsQueryPackQueryPacksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", LogAnalyticsQueryPackResource.ResourceType.Namespace, Diagnostics); + private QueryPacksRestOperations LogAnalyticsQueryPackQueryPacksRestClient => _logAnalyticsQueryPackQueryPacksRestClient ??= new QueryPacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogAnalyticsQueryPackResource.ResourceType)); + private ClientDiagnostics OperationalInsightsClusterClustersClientDiagnostics => _operationalInsightsClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", OperationalInsightsClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations OperationalInsightsClusterClustersRestClient => _operationalInsightsClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OperationalInsightsClusterResource.ResourceType)); + private ClientDiagnostics OperationalInsightsWorkspaceWorkspacesClientDiagnostics => _operationalInsightsWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", OperationalInsightsWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations OperationalInsightsWorkspaceWorkspacesRestClient => _operationalInsightsWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OperationalInsightsWorkspaceResource.ResourceType)); + private ClientDiagnostics DeletedWorkspacesClientDiagnostics => _deletedWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DeletedWorkspacesRestOperations DeletedWorkspacesRestClient => _deletedWorkspacesRestClient ??= new DeletedWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets a list of all Log Analytics QueryPacks within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/queryPacks + /// + /// + /// Operation Id + /// QueryPacks_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLogAnalyticsQueryPacksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LogAnalyticsQueryPackQueryPacksRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LogAnalyticsQueryPackQueryPacksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LogAnalyticsQueryPackResource(Client, LogAnalyticsQueryPackData.DeserializeLogAnalyticsQueryPackData(e)), LogAnalyticsQueryPackQueryPacksClientDiagnostics, Pipeline, "MockableOperationalInsightsSubscriptionResource.GetLogAnalyticsQueryPacks", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Log Analytics QueryPacks within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/queryPacks + /// + /// + /// Operation Id + /// QueryPacks_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLogAnalyticsQueryPacks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LogAnalyticsQueryPackQueryPacksRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LogAnalyticsQueryPackQueryPacksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LogAnalyticsQueryPackResource(Client, LogAnalyticsQueryPackData.DeserializeLogAnalyticsQueryPackData(e)), LogAnalyticsQueryPackQueryPacksClientDiagnostics, Pipeline, "MockableOperationalInsightsSubscriptionResource.GetLogAnalyticsQueryPacks", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the Log Analytics clusters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationalInsightsClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalInsightsClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationalInsightsClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OperationalInsightsClusterResource(Client, OperationalInsightsClusterData.DeserializeOperationalInsightsClusterData(e)), OperationalInsightsClusterClustersClientDiagnostics, Pipeline, "MockableOperationalInsightsSubscriptionResource.GetOperationalInsightsClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the Log Analytics clusters in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperationalInsightsClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalInsightsClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationalInsightsClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OperationalInsightsClusterResource(Client, OperationalInsightsClusterData.DeserializeOperationalInsightsClusterData(e)), OperationalInsightsClusterClustersClientDiagnostics, Pipeline, "MockableOperationalInsightsSubscriptionResource.GetOperationalInsightsClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the workspaces in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces + /// + /// + /// Operation Id + /// Workspaces_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationalInsightsWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalInsightsWorkspaceWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), OperationalInsightsWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableOperationalInsightsSubscriptionResource.GetOperationalInsightsWorkspaces", "value", null, cancellationToken); + } + + /// + /// Gets the workspaces in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces + /// + /// + /// Operation Id + /// Workspaces_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperationalInsightsWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalInsightsWorkspaceWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), OperationalInsightsWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableOperationalInsightsSubscriptionResource.GetOperationalInsightsWorkspaces", "value", null, cancellationToken); + } + + /// + /// Gets recently deleted workspaces in a subscription, available for recovery. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/deletedWorkspaces + /// + /// + /// Operation Id + /// DeletedWorkspaces_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), DeletedWorkspacesClientDiagnostics, Pipeline, "MockableOperationalInsightsSubscriptionResource.GetDeletedWorkspaces", "value", null, cancellationToken); + } + + /// + /// Gets recently deleted workspaces in a subscription, available for recovery. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/deletedWorkspaces + /// + /// + /// Operation Id + /// DeletedWorkspaces_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), DeletedWorkspacesClientDiagnostics, Pipeline, "MockableOperationalInsightsSubscriptionResource.GetDeletedWorkspaces", "value", null, cancellationToken); + } + } +} diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/OperationalInsightsExtensions.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/OperationalInsightsExtensions.cs index 2469b03bd6af7..e81ca5d02044e 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/OperationalInsightsExtensions.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/OperationalInsightsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.OperationalInsights.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.OperationalInsights @@ -18,252 +19,209 @@ namespace Azure.ResourceManager.OperationalInsights /// A class to add extension methods to Azure.ResourceManager.OperationalInsights. public static partial class OperationalInsightsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableOperationalInsightsArmClient GetMockableOperationalInsightsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableOperationalInsightsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableOperationalInsightsResourceGroupResource GetMockableOperationalInsightsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableOperationalInsightsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableOperationalInsightsSubscriptionResource GetMockableOperationalInsightsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableOperationalInsightsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region LogAnalyticsQueryPackResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogAnalyticsQueryPackResource GetLogAnalyticsQueryPackResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogAnalyticsQueryPackResource.ValidateResourceId(id); - return new LogAnalyticsQueryPackResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetLogAnalyticsQueryPackResource(id); } - #endregion - #region LogAnalyticsQueryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogAnalyticsQueryResource GetLogAnalyticsQueryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogAnalyticsQueryResource.ValidateResourceId(id); - return new LogAnalyticsQueryResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetLogAnalyticsQueryResource(id); } - #endregion - #region OperationalInsightsDataExportResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsDataExportResource GetOperationalInsightsDataExportResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsDataExportResource.ValidateResourceId(id); - return new OperationalInsightsDataExportResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetOperationalInsightsDataExportResource(id); } - #endregion - #region OperationalInsightsDataSourceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsDataSourceResource GetOperationalInsightsDataSourceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsDataSourceResource.ValidateResourceId(id); - return new OperationalInsightsDataSourceResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetOperationalInsightsDataSourceResource(id); } - #endregion - #region OperationalInsightsLinkedServiceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsLinkedServiceResource GetOperationalInsightsLinkedServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsLinkedServiceResource.ValidateResourceId(id); - return new OperationalInsightsLinkedServiceResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetOperationalInsightsLinkedServiceResource(id); } - #endregion - #region OperationalInsightsLinkedStorageAccountsResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsLinkedStorageAccountsResource GetOperationalInsightsLinkedStorageAccountsResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsLinkedStorageAccountsResource.ValidateResourceId(id); - return new OperationalInsightsLinkedStorageAccountsResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetOperationalInsightsLinkedStorageAccountsResource(id); } - #endregion - #region StorageInsightResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageInsightResource GetStorageInsightResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageInsightResource.ValidateResourceId(id); - return new StorageInsightResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetStorageInsightResource(id); } - #endregion - #region OperationalInsightsSavedSearchResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsSavedSearchResource GetOperationalInsightsSavedSearchResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsSavedSearchResource.ValidateResourceId(id); - return new OperationalInsightsSavedSearchResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetOperationalInsightsSavedSearchResource(id); } - #endregion - #region OperationalInsightsClusterResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsClusterResource GetOperationalInsightsClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsClusterResource.ValidateResourceId(id); - return new OperationalInsightsClusterResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetOperationalInsightsClusterResource(id); } - #endregion - #region OperationalInsightsWorkspaceResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsWorkspaceResource GetOperationalInsightsWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsWorkspaceResource.ValidateResourceId(id); - return new OperationalInsightsWorkspaceResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetOperationalInsightsWorkspaceResource(id); } - #endregion - #region OperationalInsightsTableResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsTableResource GetOperationalInsightsTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsTableResource.ValidateResourceId(id); - return new OperationalInsightsTableResource(client, id); - } - ); + return GetMockableOperationalInsightsArmClient(client).GetOperationalInsightsTableResource(id); } - #endregion - /// Gets a collection of LogAnalyticsQueryPackResources in the ResourceGroupResource. + /// + /// Gets a collection of LogAnalyticsQueryPackResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LogAnalyticsQueryPackResources and their operations over a LogAnalyticsQueryPackResource. public static LogAnalyticsQueryPackCollection GetLogAnalyticsQueryPacks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLogAnalyticsQueryPacks(); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetLogAnalyticsQueryPacks(); } /// @@ -278,16 +236,20 @@ public static LogAnalyticsQueryPackCollection GetLogAnalyticsQueryPacks(this Res /// QueryPacks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Log Analytics QueryPack resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLogAnalyticsQueryPackAsync(this ResourceGroupResource resourceGroupResource, string queryPackName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLogAnalyticsQueryPacks().GetAsync(queryPackName, cancellationToken).ConfigureAwait(false); + return await GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetLogAnalyticsQueryPackAsync(queryPackName, cancellationToken).ConfigureAwait(false); } /// @@ -302,24 +264,34 @@ public static async Task> GetLogAnalytic /// QueryPacks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Log Analytics QueryPack resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLogAnalyticsQueryPack(this ResourceGroupResource resourceGroupResource, string queryPackName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLogAnalyticsQueryPacks().Get(queryPackName, cancellationToken); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetLogAnalyticsQueryPack(queryPackName, cancellationToken); } - /// Gets a collection of OperationalInsightsClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of OperationalInsightsClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of OperationalInsightsClusterResources and their operations over a OperationalInsightsClusterResource. public static OperationalInsightsClusterCollection GetOperationalInsightsClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetOperationalInsightsClusters(); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetOperationalInsightsClusters(); } /// @@ -334,16 +306,20 @@ public static OperationalInsightsClusterCollection GetOperationalInsightsCluster /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Log Analytics Cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetOperationalInsightsClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetOperationalInsightsClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetOperationalInsightsClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -358,24 +334,34 @@ public static async Task> GetOperat /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Log Analytics Cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetOperationalInsightsCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetOperationalInsightsClusters().Get(clusterName, cancellationToken); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetOperationalInsightsCluster(clusterName, cancellationToken); } - /// Gets a collection of OperationalInsightsWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of OperationalInsightsWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of OperationalInsightsWorkspaceResources and their operations over a OperationalInsightsWorkspaceResource. public static OperationalInsightsWorkspaceCollection GetOperationalInsightsWorkspaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetOperationalInsightsWorkspaces(); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetOperationalInsightsWorkspaces(); } /// @@ -390,16 +376,20 @@ public static OperationalInsightsWorkspaceCollection GetOperationalInsightsWorks /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetOperationalInsightsWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetOperationalInsightsWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetOperationalInsightsWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -414,16 +404,20 @@ public static async Task> GetOper /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetOperationalInsightsWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetOperationalInsightsWorkspaces().Get(workspaceName, cancellationToken); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetOperationalInsightsWorkspace(workspaceName, cancellationToken); } /// @@ -438,6 +432,10 @@ public static Response GetOperationalInsig /// QueryPacks_CreateOrUpdateWithoutName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Properties that need to be specified to create or update a Log Analytics QueryPack. @@ -445,9 +443,7 @@ public static Response GetOperationalInsig /// is null. public static async Task> CreateOrUpdateWithoutNameQueryPackAsync(this ResourceGroupResource resourceGroupResource, LogAnalyticsQueryPackData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateWithoutNameQueryPackAsync(data, cancellationToken).ConfigureAwait(false); + return await GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).CreateOrUpdateWithoutNameQueryPackAsync(data, cancellationToken).ConfigureAwait(false); } /// @@ -462,6 +458,10 @@ public static async Task> CreateOrUpdate /// QueryPacks_CreateOrUpdateWithoutName /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Properties that need to be specified to create or update a Log Analytics QueryPack. @@ -469,9 +469,7 @@ public static async Task> CreateOrUpdate /// is null. public static Response CreateOrUpdateWithoutNameQueryPack(this ResourceGroupResource resourceGroupResource, LogAnalyticsQueryPackData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateWithoutNameQueryPack(data, cancellationToken); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).CreateOrUpdateWithoutNameQueryPack(data, cancellationToken); } /// @@ -486,13 +484,17 @@ public static Response CreateOrUpdateWithoutNameQ /// DeletedWorkspaces_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedWorkspacesAsync(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDeletedWorkspacesAsync(cancellationToken); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetDeletedWorkspacesAsync(cancellationToken); } /// @@ -507,13 +509,17 @@ public static AsyncPageable GetDeletedWork /// DeletedWorkspaces_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedWorkspaces(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDeletedWorkspaces(cancellationToken); + return GetMockableOperationalInsightsResourceGroupResource(resourceGroupResource).GetDeletedWorkspaces(cancellationToken); } /// @@ -528,13 +534,17 @@ public static Pageable GetDeletedWorkspace /// QueryPacks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetLogAnalyticsQueryPacksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLogAnalyticsQueryPacksAsync(cancellationToken); + return GetMockableOperationalInsightsSubscriptionResource(subscriptionResource).GetLogAnalyticsQueryPacksAsync(cancellationToken); } /// @@ -549,13 +559,17 @@ public static AsyncPageable GetLogAnalyticsQueryP /// QueryPacks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetLogAnalyticsQueryPacks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLogAnalyticsQueryPacks(cancellationToken); + return GetMockableOperationalInsightsSubscriptionResource(subscriptionResource).GetLogAnalyticsQueryPacks(cancellationToken); } /// @@ -570,13 +584,17 @@ public static Pageable GetLogAnalyticsQueryPacks( /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationalInsightsClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOperationalInsightsClustersAsync(cancellationToken); + return GetMockableOperationalInsightsSubscriptionResource(subscriptionResource).GetOperationalInsightsClustersAsync(cancellationToken); } /// @@ -591,13 +609,17 @@ public static AsyncPageable GetOperationalIn /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationalInsightsClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOperationalInsightsClusters(cancellationToken); + return GetMockableOperationalInsightsSubscriptionResource(subscriptionResource).GetOperationalInsightsClusters(cancellationToken); } /// @@ -612,13 +634,17 @@ public static Pageable GetOperationalInsight /// Workspaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationalInsightsWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOperationalInsightsWorkspacesAsync(cancellationToken); + return GetMockableOperationalInsightsSubscriptionResource(subscriptionResource).GetOperationalInsightsWorkspacesAsync(cancellationToken); } /// @@ -633,13 +659,17 @@ public static AsyncPageable GetOperational /// Workspaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationalInsightsWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOperationalInsightsWorkspaces(cancellationToken); + return GetMockableOperationalInsightsSubscriptionResource(subscriptionResource).GetOperationalInsightsWorkspaces(cancellationToken); } /// @@ -654,13 +684,17 @@ public static Pageable GetOperationalInsig /// DeletedWorkspaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedWorkspacesAsync(cancellationToken); + return GetMockableOperationalInsightsSubscriptionResource(subscriptionResource).GetDeletedWorkspacesAsync(cancellationToken); } /// @@ -675,13 +709,17 @@ public static AsyncPageable GetDeletedWork /// DeletedWorkspaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedWorkspaces(cancellationToken); + return GetMockableOperationalInsightsSubscriptionResource(subscriptionResource).GetDeletedWorkspaces(cancellationToken); } } } diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 8c6af96c79808..0000000000000 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.OperationalInsights -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _logAnalyticsQueryPackQueryPacksClientDiagnostics; - private QueryPacksRestOperations _logAnalyticsQueryPackQueryPacksRestClient; - private ClientDiagnostics _deletedWorkspacesClientDiagnostics; - private DeletedWorkspacesRestOperations _deletedWorkspacesRestClient; - - /// 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 ClientDiagnostics LogAnalyticsQueryPackQueryPacksClientDiagnostics => _logAnalyticsQueryPackQueryPacksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", LogAnalyticsQueryPackResource.ResourceType.Namespace, Diagnostics); - private QueryPacksRestOperations LogAnalyticsQueryPackQueryPacksRestClient => _logAnalyticsQueryPackQueryPacksRestClient ??= new QueryPacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogAnalyticsQueryPackResource.ResourceType)); - private ClientDiagnostics DeletedWorkspacesClientDiagnostics => _deletedWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DeletedWorkspacesRestOperations DeletedWorkspacesRestClient => _deletedWorkspacesRestClient ??= new DeletedWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of LogAnalyticsQueryPackResources in the ResourceGroupResource. - /// An object representing collection of LogAnalyticsQueryPackResources and their operations over a LogAnalyticsQueryPackResource. - public virtual LogAnalyticsQueryPackCollection GetLogAnalyticsQueryPacks() - { - return GetCachedClient(Client => new LogAnalyticsQueryPackCollection(Client, Id)); - } - - /// Gets a collection of OperationalInsightsClusterResources in the ResourceGroupResource. - /// An object representing collection of OperationalInsightsClusterResources and their operations over a OperationalInsightsClusterResource. - public virtual OperationalInsightsClusterCollection GetOperationalInsightsClusters() - { - return GetCachedClient(Client => new OperationalInsightsClusterCollection(Client, Id)); - } - - /// Gets a collection of OperationalInsightsWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of OperationalInsightsWorkspaceResources and their operations over a OperationalInsightsWorkspaceResource. - public virtual OperationalInsightsWorkspaceCollection GetOperationalInsightsWorkspaces() - { - return GetCachedClient(Client => new OperationalInsightsWorkspaceCollection(Client, Id)); - } - - /// - /// Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks - /// - /// - /// Operation Id - /// QueryPacks_CreateOrUpdateWithoutName - /// - /// - /// - /// Properties that need to be specified to create or update a Log Analytics QueryPack. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateWithoutNameQueryPackAsync(LogAnalyticsQueryPackData data, CancellationToken cancellationToken = default) - { - using var scope = LogAnalyticsQueryPackQueryPacksClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateWithoutNameQueryPack"); - scope.Start(); - try - { - var response = await LogAnalyticsQueryPackQueryPacksRestClient.CreateOrUpdateWithoutNameAsync(Id.SubscriptionId, Id.ResourceGroupName, data, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new LogAnalyticsQueryPackResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks - /// - /// - /// Operation Id - /// QueryPacks_CreateOrUpdateWithoutName - /// - /// - /// - /// Properties that need to be specified to create or update a Log Analytics QueryPack. - /// The cancellation token to use. - public virtual Response CreateOrUpdateWithoutNameQueryPack(LogAnalyticsQueryPackData data, CancellationToken cancellationToken = default) - { - using var scope = LogAnalyticsQueryPackQueryPacksClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateWithoutNameQueryPack"); - scope.Start(); - try - { - var response = LogAnalyticsQueryPackQueryPacksRestClient.CreateOrUpdateWithoutName(Id.SubscriptionId, Id.ResourceGroupName, data, cancellationToken); - return Response.FromValue(new LogAnalyticsQueryPackResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets recently deleted workspaces in a resource group, available for recovery. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/deletedWorkspaces - /// - /// - /// Operation Id - /// DeletedWorkspaces_ListByResourceGroup - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedWorkspacesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), DeletedWorkspacesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetDeletedWorkspaces", "value", null, cancellationToken); - } - - /// - /// Gets recently deleted workspaces in a resource group, available for recovery. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/deletedWorkspaces - /// - /// - /// Operation Id - /// DeletedWorkspaces_ListByResourceGroup - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedWorkspacesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), DeletedWorkspacesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetDeletedWorkspaces", "value", null, cancellationToken); - } - } -} diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 8891deb9d5263..0000000000000 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.OperationalInsights -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _logAnalyticsQueryPackQueryPacksClientDiagnostics; - private QueryPacksRestOperations _logAnalyticsQueryPackQueryPacksRestClient; - private ClientDiagnostics _operationalInsightsClusterClustersClientDiagnostics; - private ClustersRestOperations _operationalInsightsClusterClustersRestClient; - private ClientDiagnostics _operationalInsightsWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _operationalInsightsWorkspaceWorkspacesRestClient; - private ClientDiagnostics _deletedWorkspacesClientDiagnostics; - private DeletedWorkspacesRestOperations _deletedWorkspacesRestClient; - - /// 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 LogAnalyticsQueryPackQueryPacksClientDiagnostics => _logAnalyticsQueryPackQueryPacksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", LogAnalyticsQueryPackResource.ResourceType.Namespace, Diagnostics); - private QueryPacksRestOperations LogAnalyticsQueryPackQueryPacksRestClient => _logAnalyticsQueryPackQueryPacksRestClient ??= new QueryPacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogAnalyticsQueryPackResource.ResourceType)); - private ClientDiagnostics OperationalInsightsClusterClustersClientDiagnostics => _operationalInsightsClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", OperationalInsightsClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations OperationalInsightsClusterClustersRestClient => _operationalInsightsClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OperationalInsightsClusterResource.ResourceType)); - private ClientDiagnostics OperationalInsightsWorkspaceWorkspacesClientDiagnostics => _operationalInsightsWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", OperationalInsightsWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations OperationalInsightsWorkspaceWorkspacesRestClient => _operationalInsightsWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OperationalInsightsWorkspaceResource.ResourceType)); - private ClientDiagnostics DeletedWorkspacesClientDiagnostics => _deletedWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OperationalInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DeletedWorkspacesRestOperations DeletedWorkspacesRestClient => _deletedWorkspacesRestClient ??= new DeletedWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets a list of all Log Analytics QueryPacks within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/queryPacks - /// - /// - /// Operation Id - /// QueryPacks_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLogAnalyticsQueryPacksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LogAnalyticsQueryPackQueryPacksRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LogAnalyticsQueryPackQueryPacksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LogAnalyticsQueryPackResource(Client, LogAnalyticsQueryPackData.DeserializeLogAnalyticsQueryPackData(e)), LogAnalyticsQueryPackQueryPacksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLogAnalyticsQueryPacks", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all Log Analytics QueryPacks within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/queryPacks - /// - /// - /// Operation Id - /// QueryPacks_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLogAnalyticsQueryPacks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LogAnalyticsQueryPackQueryPacksRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LogAnalyticsQueryPackQueryPacksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LogAnalyticsQueryPackResource(Client, LogAnalyticsQueryPackData.DeserializeLogAnalyticsQueryPackData(e)), LogAnalyticsQueryPackQueryPacksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLogAnalyticsQueryPacks", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the Log Analytics clusters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationalInsightsClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalInsightsClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationalInsightsClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OperationalInsightsClusterResource(Client, OperationalInsightsClusterData.DeserializeOperationalInsightsClusterData(e)), OperationalInsightsClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOperationalInsightsClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the Log Analytics clusters in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationalInsightsClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalInsightsClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationalInsightsClusterClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OperationalInsightsClusterResource(Client, OperationalInsightsClusterData.DeserializeOperationalInsightsClusterData(e)), OperationalInsightsClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOperationalInsightsClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the workspaces in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces - /// - /// - /// Operation Id - /// Workspaces_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationalInsightsWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalInsightsWorkspaceWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), OperationalInsightsWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOperationalInsightsWorkspaces", "value", null, cancellationToken); - } - - /// - /// Gets the workspaces in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces - /// - /// - /// Operation Id - /// Workspaces_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationalInsightsWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationalInsightsWorkspaceWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), OperationalInsightsWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOperationalInsightsWorkspaces", "value", null, cancellationToken); - } - - /// - /// Gets recently deleted workspaces in a subscription, available for recovery. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/deletedWorkspaces - /// - /// - /// Operation Id - /// DeletedWorkspaces_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), DeletedWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedWorkspaces", "value", null, cancellationToken); - } - - /// - /// Gets recently deleted workspaces in a subscription, available for recovery. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/deletedWorkspaces - /// - /// - /// Operation Id - /// DeletedWorkspaces_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new OperationalInsightsWorkspaceResource(Client, OperationalInsightsWorkspaceData.DeserializeOperationalInsightsWorkspaceData(e)), DeletedWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedWorkspaces", "value", null, cancellationToken); - } - } -} diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackResource.cs index 41b88691c0d3c..a9bea26269af3 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.OperationalInsights public partial class LogAnalyticsQueryPackResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The queryPackName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string queryPackName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName}"; @@ -99,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LogAnalyticsQueryResources and their operations over a LogAnalyticsQueryResource. public virtual LogAnalyticsQueryCollection GetLogAnalyticsQueries() { - return GetCachedClient(Client => new LogAnalyticsQueryCollection(Client, Id)); + return GetCachedClient(client => new LogAnalyticsQueryCollection(client, Id)); } /// @@ -117,8 +120,8 @@ public virtual LogAnalyticsQueryCollection GetLogAnalyticsQueries() /// /// The id of a specific query defined in the Log Analytics QueryPack. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLogAnalyticsQueryAsync(string id, CancellationToken cancellationToken = default) { @@ -140,8 +143,8 @@ public virtual async Task> GetLogAnalyticsQu /// /// The id of a specific query defined in the Log Analytics QueryPack. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLogAnalyticsQuery(string id, CancellationToken cancellationToken = default) { diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryResource.cs index 6985a6525ec98..7781e954875d8 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.OperationalInsights public partial class LogAnalyticsQueryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The queryPackName. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string queryPackName, string id) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName}/queries/{id}"; diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsClusterResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsClusterResource.cs index e4285d9587723..2e80197dea83f 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsClusterResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.OperationalInsights public partial class OperationalInsightsClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}"; diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataExportResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataExportResource.cs index f492e4b793966..bd19a10d9fcc0 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataExportResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataExportResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.OperationalInsights public partial class OperationalInsightsDataExportResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The dataExportName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string dataExportName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName}"; diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataSourceResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataSourceResource.cs index 8b46bd198f351..a9023e5c39beb 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataSourceResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsDataSourceResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.OperationalInsights public partial class OperationalInsightsDataSourceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The dataSourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string dataSourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}"; diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedServiceResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedServiceResource.cs index b25acf5777da7..330cc0a164e78 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedServiceResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedServiceResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.OperationalInsights public partial class OperationalInsightsLinkedServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The linkedServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string linkedServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}"; diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedStorageAccountsResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedStorageAccountsResource.cs index 98d25fc8f710d..b2d2f0bf3f745 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedStorageAccountsResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsLinkedStorageAccountsResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.OperationalInsights public partial class OperationalInsightsLinkedStorageAccountsResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The dataSourceType. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, OperationalInsightsDataSourceType dataSourceType) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}"; diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsSavedSearchResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsSavedSearchResource.cs index 9ad91797e1a63..e556fe6f23d81 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsSavedSearchResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsSavedSearchResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.OperationalInsights public partial class OperationalInsightsSavedSearchResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The savedSearchId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string savedSearchId) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId}"; diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsTableResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsTableResource.cs index 588261fe72dbb..d65328ad8a737 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsTableResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsTableResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.OperationalInsights public partial class OperationalInsightsTableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}"; diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceResource.cs index 95ad403fe13ee..f14420711f5eb 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.OperationalInsights public partial class OperationalInsightsWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}"; @@ -126,7 +129,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of OperationalInsightsDataExportResources and their operations over a OperationalInsightsDataExportResource. public virtual OperationalInsightsDataExportCollection GetOperationalInsightsDataExports() { - return GetCachedClient(Client => new OperationalInsightsDataExportCollection(Client, Id)); + return GetCachedClient(client => new OperationalInsightsDataExportCollection(client, Id)); } /// @@ -144,8 +147,8 @@ public virtual OperationalInsightsDataExportCollection GetOperationalInsightsDat /// /// The data export rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOperationalInsightsDataExportAsync(string dataExportName, CancellationToken cancellationToken = default) { @@ -167,8 +170,8 @@ public virtual async Task> GetOp /// /// The data export rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOperationalInsightsDataExport(string dataExportName, CancellationToken cancellationToken = default) { @@ -179,7 +182,7 @@ public virtual Response GetOperationalIns /// An object representing collection of OperationalInsightsDataSourceResources and their operations over a OperationalInsightsDataSourceResource. public virtual OperationalInsightsDataSourceCollection GetOperationalInsightsDataSources() { - return GetCachedClient(Client => new OperationalInsightsDataSourceCollection(Client, Id)); + return GetCachedClient(client => new OperationalInsightsDataSourceCollection(client, Id)); } /// @@ -197,8 +200,8 @@ public virtual OperationalInsightsDataSourceCollection GetOperationalInsightsDat /// /// Name of the datasource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOperationalInsightsDataSourceAsync(string dataSourceName, CancellationToken cancellationToken = default) { @@ -220,8 +223,8 @@ public virtual async Task> GetOp /// /// Name of the datasource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOperationalInsightsDataSource(string dataSourceName, CancellationToken cancellationToken = default) { @@ -232,7 +235,7 @@ public virtual Response GetOperationalIns /// An object representing collection of OperationalInsightsLinkedServiceResources and their operations over a OperationalInsightsLinkedServiceResource. public virtual OperationalInsightsLinkedServiceCollection GetOperationalInsightsLinkedServices() { - return GetCachedClient(Client => new OperationalInsightsLinkedServiceCollection(Client, Id)); + return GetCachedClient(client => new OperationalInsightsLinkedServiceCollection(client, Id)); } /// @@ -250,8 +253,8 @@ public virtual OperationalInsightsLinkedServiceCollection GetOperationalInsights /// /// Name of the linked service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOperationalInsightsLinkedServiceAsync(string linkedServiceName, CancellationToken cancellationToken = default) { @@ -273,8 +276,8 @@ public virtual async Task> Ge /// /// Name of the linked service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOperationalInsightsLinkedService(string linkedServiceName, CancellationToken cancellationToken = default) { @@ -285,7 +288,7 @@ public virtual Response GetOperational /// An object representing collection of OperationalInsightsLinkedStorageAccountsResources and their operations over a OperationalInsightsLinkedStorageAccountsResource. public virtual OperationalInsightsLinkedStorageAccountsCollection GetAllOperationalInsightsLinkedStorageAccounts() { - return GetCachedClient(Client => new OperationalInsightsLinkedStorageAccountsCollection(Client, Id)); + return GetCachedClient(client => new OperationalInsightsLinkedStorageAccountsCollection(client, Id)); } /// @@ -334,7 +337,7 @@ public virtual Response GetOpe /// An object representing collection of StorageInsightResources and their operations over a StorageInsightResource. public virtual StorageInsightCollection GetStorageInsights() { - return GetCachedClient(Client => new StorageInsightCollection(Client, Id)); + return GetCachedClient(client => new StorageInsightCollection(client, Id)); } /// @@ -352,8 +355,8 @@ public virtual StorageInsightCollection GetStorageInsights() /// /// Name of the storageInsightsConfigs resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageInsightAsync(string storageInsightName, CancellationToken cancellationToken = default) { @@ -375,8 +378,8 @@ public virtual async Task> GetStorageInsightAsy /// /// Name of the storageInsightsConfigs resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageInsight(string storageInsightName, CancellationToken cancellationToken = default) { @@ -387,7 +390,7 @@ public virtual Response GetStorageInsight(string storage /// An object representing collection of OperationalInsightsSavedSearchResources and their operations over a OperationalInsightsSavedSearchResource. public virtual OperationalInsightsSavedSearchCollection GetOperationalInsightsSavedSearches() { - return GetCachedClient(Client => new OperationalInsightsSavedSearchCollection(Client, Id)); + return GetCachedClient(client => new OperationalInsightsSavedSearchCollection(client, Id)); } /// @@ -405,8 +408,8 @@ public virtual OperationalInsightsSavedSearchCollection GetOperationalInsightsSa /// /// The id of the saved search. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOperationalInsightsSavedSearchAsync(string savedSearchId, CancellationToken cancellationToken = default) { @@ -428,8 +431,8 @@ public virtual async Task> GetO /// /// The id of the saved search. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOperationalInsightsSavedSearch(string savedSearchId, CancellationToken cancellationToken = default) { @@ -440,7 +443,7 @@ public virtual Response GetOperationalIn /// An object representing collection of OperationalInsightsTableResources and their operations over a OperationalInsightsTableResource. public virtual OperationalInsightsTableCollection GetOperationalInsightsTables() { - return GetCachedClient(Client => new OperationalInsightsTableCollection(Client, Id)); + return GetCachedClient(client => new OperationalInsightsTableCollection(client, Id)); } /// @@ -458,8 +461,8 @@ public virtual OperationalInsightsTableCollection GetOperationalInsightsTables() /// /// The name of the table. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOperationalInsightsTableAsync(string tableName, CancellationToken cancellationToken = default) { @@ -481,8 +484,8 @@ public virtual async Task> GetOperati /// /// The name of the table. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOperationalInsightsTable(string tableName, CancellationToken cancellationToken = default) { diff --git a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/StorageInsightResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/StorageInsightResource.cs index bbca11a770936..33209ccf6f36b 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/StorageInsightResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/StorageInsightResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.OperationalInsights public partial class StorageInsightResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The storageInsightName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string storageInsightName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}"; diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/api/Azure.ResourceManager.Orbital.netstandard2.0.cs b/sdk/orbital/Azure.ResourceManager.Orbital/api/Azure.ResourceManager.Orbital.netstandard2.0.cs index a55d4fb08a896..2451f68e2e5b3 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/api/Azure.ResourceManager.Orbital.netstandard2.0.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/api/Azure.ResourceManager.Orbital.netstandard2.0.cs @@ -91,7 +91,7 @@ protected OrbitalContactProfileCollection() { } } public partial class OrbitalContactProfileData : Azure.ResourceManager.Models.TrackedResourceData { - public OrbitalContactProfileData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public OrbitalContactProfileData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Orbital.Models.AutoTrackingConfiguration? AutoTrackingConfiguration { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } public System.Uri EventHubUri { get { throw null; } set { } } @@ -174,7 +174,7 @@ protected OrbitalSpacecraftCollection() { } } public partial class OrbitalSpacecraftData : Azure.ResourceManager.Models.TrackedResourceData { - public OrbitalSpacecraftData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public OrbitalSpacecraftData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public System.Collections.Generic.IList Links { get { throw null; } } public string NoradId { get { throw null; } set { } } @@ -209,6 +209,38 @@ protected OrbitalSpacecraftResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Orbital.Models.OrbitalSpacecraftTags orbitalSpacecraftTags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Orbital.Mocking +{ + public partial class MockableOrbitalArmClient : Azure.ResourceManager.ArmResource + { + protected MockableOrbitalArmClient() { } + public virtual Azure.ResourceManager.Orbital.AvailableGroundStationResource GetAvailableGroundStationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Orbital.OrbitalContactProfileResource GetOrbitalContactProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Orbital.OrbitalContactResource GetOrbitalContactResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Orbital.OrbitalSpacecraftResource GetOrbitalSpacecraftResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableOrbitalResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableOrbitalResourceGroupResource() { } + public virtual Azure.Response GetOrbitalContactProfile(string contactProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOrbitalContactProfileAsync(string contactProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Orbital.OrbitalContactProfileCollection GetOrbitalContactProfiles() { throw null; } + public virtual Azure.Response GetOrbitalSpacecraft(string spacecraftName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOrbitalSpacecraftAsync(string spacecraftName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Orbital.OrbitalSpacecraftCollection GetOrbitalSpacecrafts() { throw null; } + } + public partial class MockableOrbitalSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableOrbitalSubscriptionResource() { } + public virtual Azure.Response GetAvailableGroundStation(string groundStationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailableGroundStationAsync(string groundStationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Orbital.AvailableGroundStationCollection GetAvailableGroundStations() { throw null; } + public virtual Azure.Pageable GetOrbitalContactProfiles(string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOrbitalContactProfilesAsync(string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetOrbitalSpacecrafts(string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOrbitalSpacecraftsAsync(string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Orbital.Models { public static partial class ArmOrbitalModelFactory diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/AvailableGroundStationResource.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/AvailableGroundStationResource.cs index bd244bf625223..d172dc09d05c2 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/AvailableGroundStationResource.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/AvailableGroundStationResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Orbital public partial class AvailableGroundStationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The groundStationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string groundStationName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}"; diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalArmClient.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalArmClient.cs new file mode 100644 index 0000000000000..638cae0e3e4e7 --- /dev/null +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Orbital; + +namespace Azure.ResourceManager.Orbital.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableOrbitalArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableOrbitalArmClient() + { + } + + /// 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 MockableOrbitalArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableOrbitalArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OrbitalSpacecraftResource GetOrbitalSpacecraftResource(ResourceIdentifier id) + { + OrbitalSpacecraftResource.ValidateResourceId(id); + return new OrbitalSpacecraftResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OrbitalContactResource GetOrbitalContactResource(ResourceIdentifier id) + { + OrbitalContactResource.ValidateResourceId(id); + return new OrbitalContactResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OrbitalContactProfileResource GetOrbitalContactProfileResource(ResourceIdentifier id) + { + OrbitalContactProfileResource.ValidateResourceId(id); + return new OrbitalContactProfileResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvailableGroundStationResource GetAvailableGroundStationResource(ResourceIdentifier id) + { + AvailableGroundStationResource.ValidateResourceId(id); + return new AvailableGroundStationResource(Client, id); + } + } +} diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalResourceGroupResource.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalResourceGroupResource.cs new file mode 100644 index 0000000000000..eb22b385732e5 --- /dev/null +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.Orbital; + +namespace Azure.ResourceManager.Orbital.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableOrbitalResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableOrbitalResourceGroupResource() + { + } + + /// 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 MockableOrbitalResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of OrbitalSpacecraftResources in the ResourceGroupResource. + /// An object representing collection of OrbitalSpacecraftResources and their operations over a OrbitalSpacecraftResource. + public virtual OrbitalSpacecraftCollection GetOrbitalSpacecrafts() + { + return GetCachedClient(client => new OrbitalSpacecraftCollection(client, Id)); + } + + /// + /// Gets the specified spacecraft in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName} + /// + /// + /// Operation Id + /// Spacecrafts_Get + /// + /// + /// + /// Spacecraft ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetOrbitalSpacecraftAsync(string spacecraftName, CancellationToken cancellationToken = default) + { + return await GetOrbitalSpacecrafts().GetAsync(spacecraftName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified spacecraft in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName} + /// + /// + /// Operation Id + /// Spacecrafts_Get + /// + /// + /// + /// Spacecraft ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetOrbitalSpacecraft(string spacecraftName, CancellationToken cancellationToken = default) + { + return GetOrbitalSpacecrafts().Get(spacecraftName, cancellationToken); + } + + /// Gets a collection of OrbitalContactProfileResources in the ResourceGroupResource. + /// An object representing collection of OrbitalContactProfileResources and their operations over a OrbitalContactProfileResource. + public virtual OrbitalContactProfileCollection GetOrbitalContactProfiles() + { + return GetCachedClient(client => new OrbitalContactProfileCollection(client, Id)); + } + + /// + /// Gets the specified contact Profile in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName} + /// + /// + /// Operation Id + /// ContactProfiles_Get + /// + /// + /// + /// Contact Profile name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetOrbitalContactProfileAsync(string contactProfileName, CancellationToken cancellationToken = default) + { + return await GetOrbitalContactProfiles().GetAsync(contactProfileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified contact Profile in a specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName} + /// + /// + /// Operation Id + /// ContactProfiles_Get + /// + /// + /// + /// Contact Profile name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetOrbitalContactProfile(string contactProfileName, CancellationToken cancellationToken = default) + { + return GetOrbitalContactProfiles().Get(contactProfileName, cancellationToken); + } + } +} diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalSubscriptionResource.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalSubscriptionResource.cs new file mode 100644 index 0000000000000..cd2d803a7d40d --- /dev/null +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/MockableOrbitalSubscriptionResource.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Orbital; + +namespace Azure.ResourceManager.Orbital.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableOrbitalSubscriptionResource : ArmResource + { + private ClientDiagnostics _orbitalSpacecraftSpacecraftsClientDiagnostics; + private SpacecraftsRestOperations _orbitalSpacecraftSpacecraftsRestClient; + private ClientDiagnostics _orbitalContactProfileContactProfilesClientDiagnostics; + private ContactProfilesRestOperations _orbitalContactProfileContactProfilesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableOrbitalSubscriptionResource() + { + } + + /// 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 MockableOrbitalSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OrbitalSpacecraftSpacecraftsClientDiagnostics => _orbitalSpacecraftSpacecraftsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Orbital", OrbitalSpacecraftResource.ResourceType.Namespace, Diagnostics); + private SpacecraftsRestOperations OrbitalSpacecraftSpacecraftsRestClient => _orbitalSpacecraftSpacecraftsRestClient ??= new SpacecraftsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OrbitalSpacecraftResource.ResourceType)); + private ClientDiagnostics OrbitalContactProfileContactProfilesClientDiagnostics => _orbitalContactProfileContactProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Orbital", OrbitalContactProfileResource.ResourceType.Namespace, Diagnostics); + private ContactProfilesRestOperations OrbitalContactProfileContactProfilesRestClient => _orbitalContactProfileContactProfilesRestClient ??= new ContactProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OrbitalContactProfileResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AvailableGroundStationResources in the SubscriptionResource. + /// An object representing collection of AvailableGroundStationResources and their operations over a AvailableGroundStationResource. + public virtual AvailableGroundStationCollection GetAvailableGroundStations() + { + return GetCachedClient(client => new AvailableGroundStationCollection(client, Id)); + } + + /// + /// Gets the specified available ground station. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName} + /// + /// + /// Operation Id + /// AvailableGroundStations_Get + /// + /// + /// + /// Ground Station name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAvailableGroundStationAsync(string groundStationName, CancellationToken cancellationToken = default) + { + return await GetAvailableGroundStations().GetAsync(groundStationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified available ground station. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName} + /// + /// + /// Operation Id + /// AvailableGroundStations_Get + /// + /// + /// + /// Ground Station name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAvailableGroundStation(string groundStationName, CancellationToken cancellationToken = default) + { + return GetAvailableGroundStations().Get(groundStationName, cancellationToken); + } + + /// + /// Returns list of spacecrafts by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts + /// + /// + /// Operation Id + /// Spacecrafts_ListBySubscription + /// + /// + /// + /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOrbitalSpacecraftsAsync(string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OrbitalSpacecraftSpacecraftsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrbitalSpacecraftSpacecraftsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OrbitalSpacecraftResource(Client, OrbitalSpacecraftData.DeserializeOrbitalSpacecraftData(e)), OrbitalSpacecraftSpacecraftsClientDiagnostics, Pipeline, "MockableOrbitalSubscriptionResource.GetOrbitalSpacecrafts", "value", "nextLink", cancellationToken); + } + + /// + /// Returns list of spacecrafts by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts + /// + /// + /// Operation Id + /// Spacecrafts_ListBySubscription + /// + /// + /// + /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOrbitalSpacecrafts(string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OrbitalSpacecraftSpacecraftsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrbitalSpacecraftSpacecraftsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OrbitalSpacecraftResource(Client, OrbitalSpacecraftData.DeserializeOrbitalSpacecraftData(e)), OrbitalSpacecraftSpacecraftsClientDiagnostics, Pipeline, "MockableOrbitalSubscriptionResource.GetOrbitalSpacecrafts", "value", "nextLink", cancellationToken); + } + + /// + /// Returns list of contact profiles by Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles + /// + /// + /// Operation Id + /// ContactProfiles_ListBySubscription + /// + /// + /// + /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOrbitalContactProfilesAsync(string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OrbitalContactProfileContactProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrbitalContactProfileContactProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OrbitalContactProfileResource(Client, OrbitalContactProfileData.DeserializeOrbitalContactProfileData(e)), OrbitalContactProfileContactProfilesClientDiagnostics, Pipeline, "MockableOrbitalSubscriptionResource.GetOrbitalContactProfiles", "value", "nextLink", cancellationToken); + } + + /// + /// Returns list of contact profiles by Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles + /// + /// + /// Operation Id + /// ContactProfiles_ListBySubscription + /// + /// + /// + /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOrbitalContactProfiles(string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OrbitalContactProfileContactProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrbitalContactProfileContactProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OrbitalContactProfileResource(Client, OrbitalContactProfileData.DeserializeOrbitalContactProfileData(e)), OrbitalContactProfileContactProfilesClientDiagnostics, Pipeline, "MockableOrbitalSubscriptionResource.GetOrbitalContactProfiles", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/OrbitalExtensions.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/OrbitalExtensions.cs index c358ea26e85f2..81a589df64204 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/OrbitalExtensions.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/OrbitalExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Orbital.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Orbital @@ -18,119 +19,97 @@ namespace Azure.ResourceManager.Orbital /// A class to add extension methods to Azure.ResourceManager.Orbital. public static partial class OrbitalExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableOrbitalArmClient GetMockableOrbitalArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableOrbitalArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableOrbitalResourceGroupResource GetMockableOrbitalResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableOrbitalResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableOrbitalSubscriptionResource GetMockableOrbitalSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableOrbitalSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region OrbitalSpacecraftResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OrbitalSpacecraftResource GetOrbitalSpacecraftResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OrbitalSpacecraftResource.ValidateResourceId(id); - return new OrbitalSpacecraftResource(client, id); - } - ); + return GetMockableOrbitalArmClient(client).GetOrbitalSpacecraftResource(id); } - #endregion - #region OrbitalContactResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OrbitalContactResource GetOrbitalContactResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OrbitalContactResource.ValidateResourceId(id); - return new OrbitalContactResource(client, id); - } - ); + return GetMockableOrbitalArmClient(client).GetOrbitalContactResource(id); } - #endregion - #region OrbitalContactProfileResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OrbitalContactProfileResource GetOrbitalContactProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OrbitalContactProfileResource.ValidateResourceId(id); - return new OrbitalContactProfileResource(client, id); - } - ); + return GetMockableOrbitalArmClient(client).GetOrbitalContactProfileResource(id); } - #endregion - #region AvailableGroundStationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvailableGroundStationResource GetAvailableGroundStationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvailableGroundStationResource.ValidateResourceId(id); - return new AvailableGroundStationResource(client, id); - } - ); + return GetMockableOrbitalArmClient(client).GetAvailableGroundStationResource(id); } - #endregion - /// Gets a collection of OrbitalSpacecraftResources in the ResourceGroupResource. + /// + /// Gets a collection of OrbitalSpacecraftResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of OrbitalSpacecraftResources and their operations over a OrbitalSpacecraftResource. public static OrbitalSpacecraftCollection GetOrbitalSpacecrafts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetOrbitalSpacecrafts(); + return GetMockableOrbitalResourceGroupResource(resourceGroupResource).GetOrbitalSpacecrafts(); } /// @@ -145,16 +124,20 @@ public static OrbitalSpacecraftCollection GetOrbitalSpacecrafts(this ResourceGro /// Spacecrafts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Spacecraft ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetOrbitalSpacecraftAsync(this ResourceGroupResource resourceGroupResource, string spacecraftName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetOrbitalSpacecrafts().GetAsync(spacecraftName, cancellationToken).ConfigureAwait(false); + return await GetMockableOrbitalResourceGroupResource(resourceGroupResource).GetOrbitalSpacecraftAsync(spacecraftName, cancellationToken).ConfigureAwait(false); } /// @@ -169,24 +152,34 @@ public static async Task> GetOrbitalSpacecra /// Spacecrafts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Spacecraft ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetOrbitalSpacecraft(this ResourceGroupResource resourceGroupResource, string spacecraftName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetOrbitalSpacecrafts().Get(spacecraftName, cancellationToken); + return GetMockableOrbitalResourceGroupResource(resourceGroupResource).GetOrbitalSpacecraft(spacecraftName, cancellationToken); } - /// Gets a collection of OrbitalContactProfileResources in the ResourceGroupResource. + /// + /// Gets a collection of OrbitalContactProfileResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of OrbitalContactProfileResources and their operations over a OrbitalContactProfileResource. public static OrbitalContactProfileCollection GetOrbitalContactProfiles(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetOrbitalContactProfiles(); + return GetMockableOrbitalResourceGroupResource(resourceGroupResource).GetOrbitalContactProfiles(); } /// @@ -201,16 +194,20 @@ public static OrbitalContactProfileCollection GetOrbitalContactProfiles(this Res /// ContactProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Contact Profile name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetOrbitalContactProfileAsync(this ResourceGroupResource resourceGroupResource, string contactProfileName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetOrbitalContactProfiles().GetAsync(contactProfileName, cancellationToken).ConfigureAwait(false); + return await GetMockableOrbitalResourceGroupResource(resourceGroupResource).GetOrbitalContactProfileAsync(contactProfileName, cancellationToken).ConfigureAwait(false); } /// @@ -225,24 +222,34 @@ public static async Task> GetOrbitalCont /// ContactProfiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Contact Profile name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetOrbitalContactProfile(this ResourceGroupResource resourceGroupResource, string contactProfileName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetOrbitalContactProfiles().Get(contactProfileName, cancellationToken); + return GetMockableOrbitalResourceGroupResource(resourceGroupResource).GetOrbitalContactProfile(contactProfileName, cancellationToken); } - /// Gets a collection of AvailableGroundStationResources in the SubscriptionResource. + /// + /// Gets a collection of AvailableGroundStationResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AvailableGroundStationResources and their operations over a AvailableGroundStationResource. public static AvailableGroundStationCollection GetAvailableGroundStations(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableGroundStations(); + return GetMockableOrbitalSubscriptionResource(subscriptionResource).GetAvailableGroundStations(); } /// @@ -257,16 +264,20 @@ public static AvailableGroundStationCollection GetAvailableGroundStations(this S /// AvailableGroundStations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Ground Station name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAvailableGroundStationAsync(this SubscriptionResource subscriptionResource, string groundStationName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetAvailableGroundStations().GetAsync(groundStationName, cancellationToken).ConfigureAwait(false); + return await GetMockableOrbitalSubscriptionResource(subscriptionResource).GetAvailableGroundStationAsync(groundStationName, cancellationToken).ConfigureAwait(false); } /// @@ -281,16 +292,20 @@ public static async Task> GetAvailableG /// AvailableGroundStations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Ground Station name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAvailableGroundStation(this SubscriptionResource subscriptionResource, string groundStationName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetAvailableGroundStations().Get(groundStationName, cancellationToken); + return GetMockableOrbitalSubscriptionResource(subscriptionResource).GetAvailableGroundStation(groundStationName, cancellationToken); } /// @@ -305,6 +320,10 @@ public static Response GetAvailableGroundStation /// Spacecrafts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. @@ -312,7 +331,7 @@ public static Response GetAvailableGroundStation /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetOrbitalSpacecraftsAsync(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOrbitalSpacecraftsAsync(skiptoken, cancellationToken); + return GetMockableOrbitalSubscriptionResource(subscriptionResource).GetOrbitalSpacecraftsAsync(skiptoken, cancellationToken); } /// @@ -327,6 +346,10 @@ public static AsyncPageable GetOrbitalSpacecraftsAsyn /// Spacecrafts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. @@ -334,7 +357,7 @@ public static AsyncPageable GetOrbitalSpacecraftsAsyn /// A collection of that may take multiple service requests to iterate over. public static Pageable GetOrbitalSpacecrafts(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOrbitalSpacecrafts(skiptoken, cancellationToken); + return GetMockableOrbitalSubscriptionResource(subscriptionResource).GetOrbitalSpacecrafts(skiptoken, cancellationToken); } /// @@ -349,6 +372,10 @@ public static Pageable GetOrbitalSpacecrafts(this Sub /// ContactProfiles_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. @@ -356,7 +383,7 @@ public static Pageable GetOrbitalSpacecrafts(this Sub /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetOrbitalContactProfilesAsync(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOrbitalContactProfilesAsync(skiptoken, cancellationToken); + return GetMockableOrbitalSubscriptionResource(subscriptionResource).GetOrbitalContactProfilesAsync(skiptoken, cancellationToken); } /// @@ -371,6 +398,10 @@ public static AsyncPageable GetOrbitalContactProf /// ContactProfiles_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. @@ -378,7 +409,7 @@ public static AsyncPageable GetOrbitalContactProf /// A collection of that may take multiple service requests to iterate over. public static Pageable GetOrbitalContactProfiles(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOrbitalContactProfiles(skiptoken, cancellationToken); + return GetMockableOrbitalSubscriptionResource(subscriptionResource).GetOrbitalContactProfiles(skiptoken, cancellationToken); } } } diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index e452e4ac0f9ad..0000000000000 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Orbital -{ - /// 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 OrbitalSpacecraftResources in the ResourceGroupResource. - /// An object representing collection of OrbitalSpacecraftResources and their operations over a OrbitalSpacecraftResource. - public virtual OrbitalSpacecraftCollection GetOrbitalSpacecrafts() - { - return GetCachedClient(Client => new OrbitalSpacecraftCollection(Client, Id)); - } - - /// Gets a collection of OrbitalContactProfileResources in the ResourceGroupResource. - /// An object representing collection of OrbitalContactProfileResources and their operations over a OrbitalContactProfileResource. - public virtual OrbitalContactProfileCollection GetOrbitalContactProfiles() - { - return GetCachedClient(Client => new OrbitalContactProfileCollection(Client, Id)); - } - } -} diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 68fbde0c3f7a0..0000000000000 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Orbital -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _orbitalSpacecraftSpacecraftsClientDiagnostics; - private SpacecraftsRestOperations _orbitalSpacecraftSpacecraftsRestClient; - private ClientDiagnostics _orbitalContactProfileContactProfilesClientDiagnostics; - private ContactProfilesRestOperations _orbitalContactProfileContactProfilesRestClient; - - /// 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 OrbitalSpacecraftSpacecraftsClientDiagnostics => _orbitalSpacecraftSpacecraftsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Orbital", OrbitalSpacecraftResource.ResourceType.Namespace, Diagnostics); - private SpacecraftsRestOperations OrbitalSpacecraftSpacecraftsRestClient => _orbitalSpacecraftSpacecraftsRestClient ??= new SpacecraftsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OrbitalSpacecraftResource.ResourceType)); - private ClientDiagnostics OrbitalContactProfileContactProfilesClientDiagnostics => _orbitalContactProfileContactProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Orbital", OrbitalContactProfileResource.ResourceType.Namespace, Diagnostics); - private ContactProfilesRestOperations OrbitalContactProfileContactProfilesRestClient => _orbitalContactProfileContactProfilesRestClient ??= new ContactProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OrbitalContactProfileResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of AvailableGroundStationResources in the SubscriptionResource. - /// An object representing collection of AvailableGroundStationResources and their operations over a AvailableGroundStationResource. - public virtual AvailableGroundStationCollection GetAvailableGroundStations() - { - return GetCachedClient(Client => new AvailableGroundStationCollection(Client, Id)); - } - - /// - /// Returns list of spacecrafts by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts - /// - /// - /// Operation Id - /// Spacecrafts_ListBySubscription - /// - /// - /// - /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOrbitalSpacecraftsAsync(string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OrbitalSpacecraftSpacecraftsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrbitalSpacecraftSpacecraftsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OrbitalSpacecraftResource(Client, OrbitalSpacecraftData.DeserializeOrbitalSpacecraftData(e)), OrbitalSpacecraftSpacecraftsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOrbitalSpacecrafts", "value", "nextLink", cancellationToken); - } - - /// - /// Returns list of spacecrafts by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/spacecrafts - /// - /// - /// Operation Id - /// Spacecrafts_ListBySubscription - /// - /// - /// - /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOrbitalSpacecrafts(string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OrbitalSpacecraftSpacecraftsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrbitalSpacecraftSpacecraftsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OrbitalSpacecraftResource(Client, OrbitalSpacecraftData.DeserializeOrbitalSpacecraftData(e)), OrbitalSpacecraftSpacecraftsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOrbitalSpacecrafts", "value", "nextLink", cancellationToken); - } - - /// - /// Returns list of contact profiles by Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles - /// - /// - /// Operation Id - /// ContactProfiles_ListBySubscription - /// - /// - /// - /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOrbitalContactProfilesAsync(string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OrbitalContactProfileContactProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrbitalContactProfileContactProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OrbitalContactProfileResource(Client, OrbitalContactProfileData.DeserializeOrbitalContactProfileData(e)), OrbitalContactProfileContactProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOrbitalContactProfiles", "value", "nextLink", cancellationToken); - } - - /// - /// Returns list of contact profiles by Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Orbital/contactProfiles - /// - /// - /// Operation Id - /// ContactProfiles_ListBySubscription - /// - /// - /// - /// An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous list operation call returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOrbitalContactProfiles(string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OrbitalContactProfileContactProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OrbitalContactProfileContactProfilesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OrbitalContactProfileResource(Client, OrbitalContactProfileData.DeserializeOrbitalContactProfileData(e)), OrbitalContactProfileContactProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOrbitalContactProfiles", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactProfileResource.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactProfileResource.cs index f1a083a3c8666..80198dcbf0d50 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactProfileResource.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactProfileResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Orbital public partial class OrbitalContactProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The contactProfileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string contactProfileName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/contactProfiles/{contactProfileName}"; diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactResource.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactResource.cs index ff5cd6bdc2fdb..7e6886fafeb9d 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactResource.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalContactResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Orbital public partial class OrbitalContactResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The spacecraftName. + /// The contactName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string spacecraftName, string contactName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}"; diff --git a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftResource.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftResource.cs index 0d5cc47dcd238..0a376a6657aaa 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftResource.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Orbital public partial class OrbitalSpacecraftResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The spacecraftName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string spacecraftName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of OrbitalContactResources and their operations over a OrbitalContactResource. public virtual OrbitalContactCollection GetOrbitalContacts() { - return GetCachedClient(Client => new OrbitalContactCollection(Client, Id)); + return GetCachedClient(client => new OrbitalContactCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual OrbitalContactCollection GetOrbitalContacts() /// /// Contact name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOrbitalContactAsync(string contactName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetOrbitalContactAsy /// /// Contact name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOrbitalContact(string contactName, CancellationToken cancellationToken = default) { diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/api/Azure.ResourceManager.PaloAltoNetworks.Ngfw.netstandard2.0.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/api/Azure.ResourceManager.PaloAltoNetworks.Ngfw.netstandard2.0.cs index 107abc042b6d9..3e89215a7d950 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/api/Azure.ResourceManager.PaloAltoNetworks.Ngfw.netstandard2.0.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/api/Azure.ResourceManager.PaloAltoNetworks.Ngfw.netstandard2.0.cs @@ -260,7 +260,7 @@ protected LocalRulestackCollection() { } } public partial class LocalRulestackData : Azure.ResourceManager.Models.TrackedResourceData { - public LocalRulestackData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public LocalRulestackData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AssociatedSubscriptions { get { throw null; } } public Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.RuleCreationDefaultMode? DefaultMode { get { throw null; } set { } } public string Description { get { throw null; } set { } } @@ -513,7 +513,7 @@ protected PaloAltoNetworksFirewallCollection() { } } public partial class PaloAltoNetworksFirewallData : Azure.ResourceManager.Models.TrackedResourceData { - public PaloAltoNetworksFirewallData(Azure.Core.AzureLocation location, Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.FirewallNetworkProfile networkProfile, Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.FirewallDnsSettings dnsSettings, Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.FirewallBillingPlanInfo planData, Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.PanFirewallMarketplaceDetails marketplaceDetails) : base (default(Azure.Core.AzureLocation)) { } + public PaloAltoNetworksFirewallData(Azure.Core.AzureLocation location, Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.FirewallNetworkProfile networkProfile, Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.FirewallDnsSettings dnsSettings, Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.FirewallBillingPlanInfo planData, Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.PanFirewallMarketplaceDetails marketplaceDetails) { } public Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.RulestackDetails AssociatedRulestack { get { throw null; } set { } } public Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models.FirewallDnsSettings DnsSettings { get { throw null; } set { } } public System.Collections.Generic.IList FrontEndSettings { get { throw null; } } @@ -697,6 +697,51 @@ protected PreRulestackRuleResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.PaloAltoNetworks.Ngfw.PreRulestackRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw.Mocking +{ + public partial class MockablePaloAltoNetworksNgfwArmClient : Azure.ResourceManager.ArmResource + { + protected MockablePaloAltoNetworksNgfwArmClient() { } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.GlobalRulestackCertificateObjectResource GetGlobalRulestackCertificateObjectResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.GlobalRulestackFqdnResource GetGlobalRulestackFqdnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.GlobalRulestackPrefixResource GetGlobalRulestackPrefixResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.GlobalRulestackResource GetGlobalRulestackResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.LocalRulestackCertificateObjectResource GetLocalRulestackCertificateObjectResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.LocalRulestackFqdnResource GetLocalRulestackFqdnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.LocalRulestackPrefixResource GetLocalRulestackPrefixResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.LocalRulestackResource GetLocalRulestackResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.LocalRulestackRuleResource GetLocalRulestackRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.PaloAltoNetworksFirewallResource GetPaloAltoNetworksFirewallResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.PaloAltoNetworksFirewallStatusResource GetPaloAltoNetworksFirewallStatusResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.PostRulestackRuleResource GetPostRulestackRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.PreRulestackRuleResource GetPreRulestackRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockablePaloAltoNetworksNgfwResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePaloAltoNetworksNgfwResourceGroupResource() { } + public virtual Azure.Response GetLocalRulestack(string localRulestackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLocalRulestackAsync(string localRulestackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.LocalRulestackCollection GetLocalRulestacks() { throw null; } + public virtual Azure.Response GetPaloAltoNetworksFirewall(string firewallName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPaloAltoNetworksFirewallAsync(string firewallName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.PaloAltoNetworksFirewallCollection GetPaloAltoNetworksFirewalls() { throw null; } + } + public partial class MockablePaloAltoNetworksNgfwSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockablePaloAltoNetworksNgfwSubscriptionResource() { } + public virtual Azure.Pageable GetLocalRulestacks(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLocalRulestacksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPaloAltoNetworksFirewalls(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPaloAltoNetworksFirewallsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePaloAltoNetworksNgfwTenantResource : Azure.ResourceManager.ArmResource + { + protected MockablePaloAltoNetworksNgfwTenantResource() { } + public virtual Azure.Response GetGlobalRulestack(string globalRulestackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGlobalRulestackAsync(string globalRulestackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PaloAltoNetworks.Ngfw.GlobalRulestackCollection GetGlobalRulestacks() { throw null; } + } +} namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw.Models { public partial class AdvancedSecurityObject diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwArmClient.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwArmClient.cs new file mode 100644 index 0000000000000..7f83bac066d9d --- /dev/null +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwArmClient.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.PaloAltoNetworks.Ngfw; + +namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockablePaloAltoNetworksNgfwArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePaloAltoNetworksNgfwArmClient() + { + } + + /// 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 MockablePaloAltoNetworksNgfwArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockablePaloAltoNetworksNgfwArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GlobalRulestackResource GetGlobalRulestackResource(ResourceIdentifier id) + { + GlobalRulestackResource.ValidateResourceId(id); + return new GlobalRulestackResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GlobalRulestackCertificateObjectResource GetGlobalRulestackCertificateObjectResource(ResourceIdentifier id) + { + GlobalRulestackCertificateObjectResource.ValidateResourceId(id); + return new GlobalRulestackCertificateObjectResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GlobalRulestackFqdnResource GetGlobalRulestackFqdnResource(ResourceIdentifier id) + { + GlobalRulestackFqdnResource.ValidateResourceId(id); + return new GlobalRulestackFqdnResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostRulestackRuleResource GetPostRulestackRuleResource(ResourceIdentifier id) + { + PostRulestackRuleResource.ValidateResourceId(id); + return new PostRulestackRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GlobalRulestackPrefixResource GetGlobalRulestackPrefixResource(ResourceIdentifier id) + { + GlobalRulestackPrefixResource.ValidateResourceId(id); + return new GlobalRulestackPrefixResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PreRulestackRuleResource GetPreRulestackRuleResource(ResourceIdentifier id) + { + PreRulestackRuleResource.ValidateResourceId(id); + return new PreRulestackRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PaloAltoNetworksFirewallResource GetPaloAltoNetworksFirewallResource(ResourceIdentifier id) + { + PaloAltoNetworksFirewallResource.ValidateResourceId(id); + return new PaloAltoNetworksFirewallResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LocalRulestackResource GetLocalRulestackResource(ResourceIdentifier id) + { + LocalRulestackResource.ValidateResourceId(id); + return new LocalRulestackResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PaloAltoNetworksFirewallStatusResource GetPaloAltoNetworksFirewallStatusResource(ResourceIdentifier id) + { + PaloAltoNetworksFirewallStatusResource.ValidateResourceId(id); + return new PaloAltoNetworksFirewallStatusResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LocalRulestackCertificateObjectResource GetLocalRulestackCertificateObjectResource(ResourceIdentifier id) + { + LocalRulestackCertificateObjectResource.ValidateResourceId(id); + return new LocalRulestackCertificateObjectResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LocalRulestackFqdnResource GetLocalRulestackFqdnResource(ResourceIdentifier id) + { + LocalRulestackFqdnResource.ValidateResourceId(id); + return new LocalRulestackFqdnResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LocalRulestackRuleResource GetLocalRulestackRuleResource(ResourceIdentifier id) + { + LocalRulestackRuleResource.ValidateResourceId(id); + return new LocalRulestackRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LocalRulestackPrefixResource GetLocalRulestackPrefixResource(ResourceIdentifier id) + { + LocalRulestackPrefixResource.ValidateResourceId(id); + return new LocalRulestackPrefixResource(Client, id); + } + } +} diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwResourceGroupResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwResourceGroupResource.cs new file mode 100644 index 0000000000000..27589ed049e24 --- /dev/null +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.PaloAltoNetworks.Ngfw; + +namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockablePaloAltoNetworksNgfwResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePaloAltoNetworksNgfwResourceGroupResource() + { + } + + /// 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 MockablePaloAltoNetworksNgfwResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PaloAltoNetworksFirewallResources in the ResourceGroupResource. + /// An object representing collection of PaloAltoNetworksFirewallResources and their operations over a PaloAltoNetworksFirewallResource. + public virtual PaloAltoNetworksFirewallCollection GetPaloAltoNetworksFirewalls() + { + return GetCachedClient(client => new PaloAltoNetworksFirewallCollection(client, Id)); + } + + /// + /// Get a FirewallResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName} + /// + /// + /// Operation Id + /// Firewalls_Get + /// + /// + /// + /// Firewall resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPaloAltoNetworksFirewallAsync(string firewallName, CancellationToken cancellationToken = default) + { + return await GetPaloAltoNetworksFirewalls().GetAsync(firewallName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a FirewallResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName} + /// + /// + /// Operation Id + /// Firewalls_Get + /// + /// + /// + /// Firewall resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPaloAltoNetworksFirewall(string firewallName, CancellationToken cancellationToken = default) + { + return GetPaloAltoNetworksFirewalls().Get(firewallName, cancellationToken); + } + + /// Gets a collection of LocalRulestackResources in the ResourceGroupResource. + /// An object representing collection of LocalRulestackResources and their operations over a LocalRulestackResource. + public virtual LocalRulestackCollection GetLocalRulestacks() + { + return GetCachedClient(client => new LocalRulestackCollection(client, Id)); + } + + /// + /// Get a LocalRulestackResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName} + /// + /// + /// Operation Id + /// LocalRulestacks_Get + /// + /// + /// + /// LocalRulestack resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLocalRulestackAsync(string localRulestackName, CancellationToken cancellationToken = default) + { + return await GetLocalRulestacks().GetAsync(localRulestackName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a LocalRulestackResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName} + /// + /// + /// Operation Id + /// LocalRulestacks_Get + /// + /// + /// + /// LocalRulestack resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLocalRulestack(string localRulestackName, CancellationToken cancellationToken = default) + { + return GetLocalRulestacks().Get(localRulestackName, cancellationToken); + } + } +} diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwSubscriptionResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwSubscriptionResource.cs new file mode 100644 index 0000000000000..086af55a87244 --- /dev/null +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwSubscriptionResource.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PaloAltoNetworks.Ngfw; + +namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockablePaloAltoNetworksNgfwSubscriptionResource : ArmResource + { + private ClientDiagnostics _paloAltoNetworksFirewallFirewallsClientDiagnostics; + private FirewallsRestOperations _paloAltoNetworksFirewallFirewallsRestClient; + private ClientDiagnostics _localRulestackClientDiagnostics; + private LocalRulestacksRestOperations _localRulestackRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePaloAltoNetworksNgfwSubscriptionResource() + { + } + + /// 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 MockablePaloAltoNetworksNgfwSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PaloAltoNetworksFirewallFirewallsClientDiagnostics => _paloAltoNetworksFirewallFirewallsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PaloAltoNetworks.Ngfw", PaloAltoNetworksFirewallResource.ResourceType.Namespace, Diagnostics); + private FirewallsRestOperations PaloAltoNetworksFirewallFirewallsRestClient => _paloAltoNetworksFirewallFirewallsRestClient ??= new FirewallsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PaloAltoNetworksFirewallResource.ResourceType)); + private ClientDiagnostics LocalRulestackClientDiagnostics => _localRulestackClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PaloAltoNetworks.Ngfw", LocalRulestackResource.ResourceType.Namespace, Diagnostics); + private LocalRulestacksRestOperations LocalRulestackRestClient => _localRulestackRestClient ??= new LocalRulestacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LocalRulestackResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List FirewallResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls + /// + /// + /// Operation Id + /// Firewalls_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPaloAltoNetworksFirewallsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PaloAltoNetworksFirewallFirewallsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PaloAltoNetworksFirewallFirewallsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PaloAltoNetworksFirewallResource(Client, PaloAltoNetworksFirewallData.DeserializePaloAltoNetworksFirewallData(e)), PaloAltoNetworksFirewallFirewallsClientDiagnostics, Pipeline, "MockablePaloAltoNetworksNgfwSubscriptionResource.GetPaloAltoNetworksFirewalls", "value", "nextLink", cancellationToken); + } + + /// + /// List FirewallResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls + /// + /// + /// Operation Id + /// Firewalls_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPaloAltoNetworksFirewalls(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PaloAltoNetworksFirewallFirewallsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PaloAltoNetworksFirewallFirewallsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PaloAltoNetworksFirewallResource(Client, PaloAltoNetworksFirewallData.DeserializePaloAltoNetworksFirewallData(e)), PaloAltoNetworksFirewallFirewallsClientDiagnostics, Pipeline, "MockablePaloAltoNetworksNgfwSubscriptionResource.GetPaloAltoNetworksFirewalls", "value", "nextLink", cancellationToken); + } + + /// + /// List LocalRulestackResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks + /// + /// + /// Operation Id + /// LocalRulestacks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLocalRulestacksAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocalRulestackRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocalRulestackRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LocalRulestackResource(Client, LocalRulestackData.DeserializeLocalRulestackData(e)), LocalRulestackClientDiagnostics, Pipeline, "MockablePaloAltoNetworksNgfwSubscriptionResource.GetLocalRulestacks", "value", "nextLink", cancellationToken); + } + + /// + /// List LocalRulestackResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks + /// + /// + /// Operation Id + /// LocalRulestacks_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLocalRulestacks(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocalRulestackRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocalRulestackRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LocalRulestackResource(Client, LocalRulestackData.DeserializeLocalRulestackData(e)), LocalRulestackClientDiagnostics, Pipeline, "MockablePaloAltoNetworksNgfwSubscriptionResource.GetLocalRulestacks", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwTenantResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwTenantResource.cs new file mode 100644 index 0000000000000..c4737aaff565b --- /dev/null +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwTenantResource.cs @@ -0,0 +1,92 @@ +// 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.PaloAltoNetworks.Ngfw; + +namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockablePaloAltoNetworksNgfwTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePaloAltoNetworksNgfwTenantResource() + { + } + + /// 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 MockablePaloAltoNetworksNgfwTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of GlobalRulestackResources in the TenantResource. + /// An object representing collection of GlobalRulestackResources and their operations over a GlobalRulestackResource. + public virtual GlobalRulestackCollection GetGlobalRulestacks() + { + return GetCachedClient(client => new GlobalRulestackCollection(client, Id)); + } + + /// + /// Get a GlobalRulestackResource + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName} + /// + /// + /// Operation Id + /// GlobalRulestack_Get + /// + /// + /// + /// GlobalRulestack resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGlobalRulestackAsync(string globalRulestackName, CancellationToken cancellationToken = default) + { + return await GetGlobalRulestacks().GetAsync(globalRulestackName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a GlobalRulestackResource + /// + /// + /// Request Path + /// /providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName} + /// + /// + /// Operation Id + /// GlobalRulestack_Get + /// + /// + /// + /// GlobalRulestack resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGlobalRulestack(string globalRulestackName, CancellationToken cancellationToken = default) + { + return GetGlobalRulestacks().Get(globalRulestackName, cancellationToken); + } + } +} diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/NgfwExtensions.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/NgfwExtensions.cs index 6babf1d380ef2..c955b943bf377 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/NgfwExtensions.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/NgfwExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.PaloAltoNetworks.Ngfw.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw @@ -18,306 +19,246 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw /// A class to add extension methods to Azure.ResourceManager.PaloAltoNetworks.Ngfw. public static partial class NgfwExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockablePaloAltoNetworksNgfwArmClient GetMockablePaloAltoNetworksNgfwArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockablePaloAltoNetworksNgfwArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePaloAltoNetworksNgfwResourceGroupResource GetMockablePaloAltoNetworksNgfwResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePaloAltoNetworksNgfwResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockablePaloAltoNetworksNgfwSubscriptionResource GetMockablePaloAltoNetworksNgfwSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePaloAltoNetworksNgfwSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePaloAltoNetworksNgfwTenantResource GetMockablePaloAltoNetworksNgfwTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePaloAltoNetworksNgfwTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region GlobalRulestackResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GlobalRulestackResource GetGlobalRulestackResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GlobalRulestackResource.ValidateResourceId(id); - return new GlobalRulestackResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetGlobalRulestackResource(id); } - #endregion - #region GlobalRulestackCertificateObjectResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GlobalRulestackCertificateObjectResource GetGlobalRulestackCertificateObjectResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GlobalRulestackCertificateObjectResource.ValidateResourceId(id); - return new GlobalRulestackCertificateObjectResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetGlobalRulestackCertificateObjectResource(id); } - #endregion - #region GlobalRulestackFqdnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GlobalRulestackFqdnResource GetGlobalRulestackFqdnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GlobalRulestackFqdnResource.ValidateResourceId(id); - return new GlobalRulestackFqdnResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetGlobalRulestackFqdnResource(id); } - #endregion - #region PostRulestackRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostRulestackRuleResource GetPostRulestackRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostRulestackRuleResource.ValidateResourceId(id); - return new PostRulestackRuleResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetPostRulestackRuleResource(id); } - #endregion - #region GlobalRulestackPrefixResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GlobalRulestackPrefixResource GetGlobalRulestackPrefixResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GlobalRulestackPrefixResource.ValidateResourceId(id); - return new GlobalRulestackPrefixResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetGlobalRulestackPrefixResource(id); } - #endregion - #region PreRulestackRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PreRulestackRuleResource GetPreRulestackRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PreRulestackRuleResource.ValidateResourceId(id); - return new PreRulestackRuleResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetPreRulestackRuleResource(id); } - #endregion - #region PaloAltoNetworksFirewallResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PaloAltoNetworksFirewallResource GetPaloAltoNetworksFirewallResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PaloAltoNetworksFirewallResource.ValidateResourceId(id); - return new PaloAltoNetworksFirewallResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetPaloAltoNetworksFirewallResource(id); } - #endregion - #region LocalRulestackResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LocalRulestackResource GetLocalRulestackResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LocalRulestackResource.ValidateResourceId(id); - return new LocalRulestackResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetLocalRulestackResource(id); } - #endregion - #region PaloAltoNetworksFirewallStatusResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PaloAltoNetworksFirewallStatusResource GetPaloAltoNetworksFirewallStatusResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PaloAltoNetworksFirewallStatusResource.ValidateResourceId(id); - return new PaloAltoNetworksFirewallStatusResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetPaloAltoNetworksFirewallStatusResource(id); } - #endregion - #region LocalRulestackCertificateObjectResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LocalRulestackCertificateObjectResource GetLocalRulestackCertificateObjectResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LocalRulestackCertificateObjectResource.ValidateResourceId(id); - return new LocalRulestackCertificateObjectResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetLocalRulestackCertificateObjectResource(id); } - #endregion - #region LocalRulestackFqdnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LocalRulestackFqdnResource GetLocalRulestackFqdnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LocalRulestackFqdnResource.ValidateResourceId(id); - return new LocalRulestackFqdnResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetLocalRulestackFqdnResource(id); } - #endregion - #region LocalRulestackRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LocalRulestackRuleResource GetLocalRulestackRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LocalRulestackRuleResource.ValidateResourceId(id); - return new LocalRulestackRuleResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetLocalRulestackRuleResource(id); } - #endregion - #region LocalRulestackPrefixResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LocalRulestackPrefixResource GetLocalRulestackPrefixResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LocalRulestackPrefixResource.ValidateResourceId(id); - return new LocalRulestackPrefixResource(client, id); - } - ); + return GetMockablePaloAltoNetworksNgfwArmClient(client).GetLocalRulestackPrefixResource(id); } - #endregion - /// Gets a collection of PaloAltoNetworksFirewallResources in the ResourceGroupResource. + /// + /// Gets a collection of PaloAltoNetworksFirewallResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PaloAltoNetworksFirewallResources and their operations over a PaloAltoNetworksFirewallResource. public static PaloAltoNetworksFirewallCollection GetPaloAltoNetworksFirewalls(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPaloAltoNetworksFirewalls(); + return GetMockablePaloAltoNetworksNgfwResourceGroupResource(resourceGroupResource).GetPaloAltoNetworksFirewalls(); } /// @@ -332,16 +273,20 @@ public static PaloAltoNetworksFirewallCollection GetPaloAltoNetworksFirewalls(th /// Firewalls_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Firewall resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPaloAltoNetworksFirewallAsync(this ResourceGroupResource resourceGroupResource, string firewallName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPaloAltoNetworksFirewalls().GetAsync(firewallName, cancellationToken).ConfigureAwait(false); + return await GetMockablePaloAltoNetworksNgfwResourceGroupResource(resourceGroupResource).GetPaloAltoNetworksFirewallAsync(firewallName, cancellationToken).ConfigureAwait(false); } /// @@ -356,24 +301,34 @@ public static async Task> GetPaloAlto /// Firewalls_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Firewall resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPaloAltoNetworksFirewall(this ResourceGroupResource resourceGroupResource, string firewallName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPaloAltoNetworksFirewalls().Get(firewallName, cancellationToken); + return GetMockablePaloAltoNetworksNgfwResourceGroupResource(resourceGroupResource).GetPaloAltoNetworksFirewall(firewallName, cancellationToken); } - /// Gets a collection of LocalRulestackResources in the ResourceGroupResource. + /// + /// Gets a collection of LocalRulestackResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of LocalRulestackResources and their operations over a LocalRulestackResource. public static LocalRulestackCollection GetLocalRulestacks(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLocalRulestacks(); + return GetMockablePaloAltoNetworksNgfwResourceGroupResource(resourceGroupResource).GetLocalRulestacks(); } /// @@ -388,16 +343,20 @@ public static LocalRulestackCollection GetLocalRulestacks(this ResourceGroupReso /// LocalRulestacks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// LocalRulestack resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetLocalRulestackAsync(this ResourceGroupResource resourceGroupResource, string localRulestackName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLocalRulestacks().GetAsync(localRulestackName, cancellationToken).ConfigureAwait(false); + return await GetMockablePaloAltoNetworksNgfwResourceGroupResource(resourceGroupResource).GetLocalRulestackAsync(localRulestackName, cancellationToken).ConfigureAwait(false); } /// @@ -412,16 +371,20 @@ public static async Task> GetLocalRulestackAsyn /// LocalRulestacks_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// LocalRulestack resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetLocalRulestack(this ResourceGroupResource resourceGroupResource, string localRulestackName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLocalRulestacks().Get(localRulestackName, cancellationToken); + return GetMockablePaloAltoNetworksNgfwResourceGroupResource(resourceGroupResource).GetLocalRulestack(localRulestackName, cancellationToken); } /// @@ -436,13 +399,17 @@ public static Response GetLocalRulestack(this ResourceGr /// Firewalls_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPaloAltoNetworksFirewallsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPaloAltoNetworksFirewallsAsync(cancellationToken); + return GetMockablePaloAltoNetworksNgfwSubscriptionResource(subscriptionResource).GetPaloAltoNetworksFirewallsAsync(cancellationToken); } /// @@ -457,13 +424,17 @@ public static AsyncPageable GetPaloAltoNetwork /// Firewalls_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPaloAltoNetworksFirewalls(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPaloAltoNetworksFirewalls(cancellationToken); + return GetMockablePaloAltoNetworksNgfwSubscriptionResource(subscriptionResource).GetPaloAltoNetworksFirewalls(cancellationToken); } /// @@ -478,13 +449,17 @@ public static Pageable GetPaloAltoNetworksFire /// LocalRulestacks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetLocalRulestacksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLocalRulestacksAsync(cancellationToken); + return GetMockablePaloAltoNetworksNgfwSubscriptionResource(subscriptionResource).GetLocalRulestacksAsync(cancellationToken); } /// @@ -499,21 +474,31 @@ public static AsyncPageable GetLocalRulestacksAsync(this /// LocalRulestacks_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetLocalRulestacks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLocalRulestacks(cancellationToken); + return GetMockablePaloAltoNetworksNgfwSubscriptionResource(subscriptionResource).GetLocalRulestacks(cancellationToken); } - /// Gets a collection of GlobalRulestackResources in the TenantResource. + /// + /// Gets a collection of GlobalRulestackResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of GlobalRulestackResources and their operations over a GlobalRulestackResource. public static GlobalRulestackCollection GetGlobalRulestacks(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetGlobalRulestacks(); + return GetMockablePaloAltoNetworksNgfwTenantResource(tenantResource).GetGlobalRulestacks(); } /// @@ -528,16 +513,20 @@ public static GlobalRulestackCollection GetGlobalRulestacks(this TenantResource /// GlobalRulestack_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// GlobalRulestack resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetGlobalRulestackAsync(this TenantResource tenantResource, string globalRulestackName, CancellationToken cancellationToken = default) { - return await tenantResource.GetGlobalRulestacks().GetAsync(globalRulestackName, cancellationToken).ConfigureAwait(false); + return await GetMockablePaloAltoNetworksNgfwTenantResource(tenantResource).GetGlobalRulestackAsync(globalRulestackName, cancellationToken).ConfigureAwait(false); } /// @@ -552,16 +541,20 @@ public static async Task> GetGlobalRulestackAs /// GlobalRulestack_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// GlobalRulestack resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetGlobalRulestack(this TenantResource tenantResource, string globalRulestackName, CancellationToken cancellationToken = default) { - return tenantResource.GetGlobalRulestacks().Get(globalRulestackName, cancellationToken); + return GetMockablePaloAltoNetworksNgfwTenantResource(tenantResource).GetGlobalRulestack(globalRulestackName, cancellationToken); } } } diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 8115d9e6845a0..0000000000000 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw -{ - /// 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 PaloAltoNetworksFirewallResources in the ResourceGroupResource. - /// An object representing collection of PaloAltoNetworksFirewallResources and their operations over a PaloAltoNetworksFirewallResource. - public virtual PaloAltoNetworksFirewallCollection GetPaloAltoNetworksFirewalls() - { - return GetCachedClient(Client => new PaloAltoNetworksFirewallCollection(Client, Id)); - } - - /// Gets a collection of LocalRulestackResources in the ResourceGroupResource. - /// An object representing collection of LocalRulestackResources and their operations over a LocalRulestackResource. - public virtual LocalRulestackCollection GetLocalRulestacks() - { - return GetCachedClient(Client => new LocalRulestackCollection(Client, Id)); - } - } -} diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index ff35ad18c2d03..0000000000000 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _paloAltoNetworksFirewallFirewallsClientDiagnostics; - private FirewallsRestOperations _paloAltoNetworksFirewallFirewallsRestClient; - private ClientDiagnostics _localRulestackClientDiagnostics; - private LocalRulestacksRestOperations _localRulestackRestClient; - - /// 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 PaloAltoNetworksFirewallFirewallsClientDiagnostics => _paloAltoNetworksFirewallFirewallsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PaloAltoNetworks.Ngfw", PaloAltoNetworksFirewallResource.ResourceType.Namespace, Diagnostics); - private FirewallsRestOperations PaloAltoNetworksFirewallFirewallsRestClient => _paloAltoNetworksFirewallFirewallsRestClient ??= new FirewallsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PaloAltoNetworksFirewallResource.ResourceType)); - private ClientDiagnostics LocalRulestackClientDiagnostics => _localRulestackClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PaloAltoNetworks.Ngfw", LocalRulestackResource.ResourceType.Namespace, Diagnostics); - private LocalRulestacksRestOperations LocalRulestackRestClient => _localRulestackRestClient ??= new LocalRulestacksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LocalRulestackResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List FirewallResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls - /// - /// - /// Operation Id - /// Firewalls_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPaloAltoNetworksFirewallsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PaloAltoNetworksFirewallFirewallsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PaloAltoNetworksFirewallFirewallsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PaloAltoNetworksFirewallResource(Client, PaloAltoNetworksFirewallData.DeserializePaloAltoNetworksFirewallData(e)), PaloAltoNetworksFirewallFirewallsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPaloAltoNetworksFirewalls", "value", "nextLink", cancellationToken); - } - - /// - /// List FirewallResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls - /// - /// - /// Operation Id - /// Firewalls_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPaloAltoNetworksFirewalls(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PaloAltoNetworksFirewallFirewallsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PaloAltoNetworksFirewallFirewallsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PaloAltoNetworksFirewallResource(Client, PaloAltoNetworksFirewallData.DeserializePaloAltoNetworksFirewallData(e)), PaloAltoNetworksFirewallFirewallsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPaloAltoNetworksFirewalls", "value", "nextLink", cancellationToken); - } - - /// - /// List LocalRulestackResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks - /// - /// - /// Operation Id - /// LocalRulestacks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLocalRulestacksAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocalRulestackRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocalRulestackRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LocalRulestackResource(Client, LocalRulestackData.DeserializeLocalRulestackData(e)), LocalRulestackClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLocalRulestacks", "value", "nextLink", cancellationToken); - } - - /// - /// List LocalRulestackResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks - /// - /// - /// Operation Id - /// LocalRulestacks_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLocalRulestacks(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocalRulestackRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocalRulestackRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LocalRulestackResource(Client, LocalRulestackData.DeserializeLocalRulestackData(e)), LocalRulestackClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLocalRulestacks", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index d3c08f7293985..0000000000000 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of GlobalRulestackResources in the TenantResource. - /// An object representing collection of GlobalRulestackResources and their operations over a GlobalRulestackResource. - public virtual GlobalRulestackCollection GetGlobalRulestacks() - { - return GetCachedClient(Client => new GlobalRulestackCollection(Client, Id)); - } - } -} diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCertificateObjectResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCertificateObjectResource.cs index 3ee26dc555cb6..c39c875e685dd 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCertificateObjectResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackCertificateObjectResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class GlobalRulestackCertificateObjectResource : ArmResource { /// Generate the resource identifier of a instance. + /// The globalRulestackName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string globalRulestackName, string name) { var resourceId = $"/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackFqdnResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackFqdnResource.cs index bde6d34a22be0..a46bbee9270f9 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackFqdnResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackFqdnResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class GlobalRulestackFqdnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The globalRulestackName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string globalRulestackName, string name) { var resourceId = $"/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackPrefixResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackPrefixResource.cs index cbafe43bfbf6f..bb2f113dcde39 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackPrefixResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackPrefixResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class GlobalRulestackPrefixResource : ArmResource { /// Generate the resource identifier of a instance. + /// The globalRulestackName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string globalRulestackName, string name) { var resourceId = $"/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackResource.cs index af0fab7f36838..6cc071abc6012 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackResource.cs @@ -28,6 +28,7 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class GlobalRulestackResource : ArmResource { /// Generate the resource identifier of a instance. + /// The globalRulestackName. public static ResourceIdentifier CreateResourceIdentifier(string globalRulestackName) { var resourceId = $"/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"; @@ -93,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GlobalRulestackCertificateObjectResources and their operations over a GlobalRulestackCertificateObjectResource. public virtual GlobalRulestackCertificateObjectCollection GetGlobalRulestackCertificateObjects() { - return GetCachedClient(Client => new GlobalRulestackCertificateObjectCollection(Client, Id)); + return GetCachedClient(client => new GlobalRulestackCertificateObjectCollection(client, Id)); } /// @@ -111,8 +112,8 @@ public virtual GlobalRulestackCertificateObjectCollection GetGlobalRulestackCert /// /// certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGlobalRulestackCertificateObjectAsync(string name, CancellationToken cancellationToken = default) { @@ -134,8 +135,8 @@ public virtual async Task> Ge /// /// certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGlobalRulestackCertificateObject(string name, CancellationToken cancellationToken = default) { @@ -146,7 +147,7 @@ public virtual Response GetGlobalRules /// An object representing collection of GlobalRulestackFqdnResources and their operations over a GlobalRulestackFqdnResource. public virtual GlobalRulestackFqdnCollection GetGlobalRulestackFqdns() { - return GetCachedClient(Client => new GlobalRulestackFqdnCollection(Client, Id)); + return GetCachedClient(client => new GlobalRulestackFqdnCollection(client, Id)); } /// @@ -164,8 +165,8 @@ public virtual GlobalRulestackFqdnCollection GetGlobalRulestackFqdns() /// /// fqdn list name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGlobalRulestackFqdnAsync(string name, CancellationToken cancellationToken = default) { @@ -187,8 +188,8 @@ public virtual async Task> GetGlobalRulest /// /// fqdn list name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGlobalRulestackFqdn(string name, CancellationToken cancellationToken = default) { @@ -199,7 +200,7 @@ public virtual Response GetGlobalRulestackFqdn(stri /// An object representing collection of PostRulestackRuleResources and their operations over a PostRulestackRuleResource. public virtual PostRulestackRuleCollection GetPostRulestackRules() { - return GetCachedClient(Client => new PostRulestackRuleCollection(Client, Id)); + return GetCachedClient(client => new PostRulestackRuleCollection(client, Id)); } /// @@ -217,8 +218,8 @@ public virtual PostRulestackRuleCollection GetPostRulestackRules() /// /// Post Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostRulestackRuleAsync(string priority, CancellationToken cancellationToken = default) { @@ -240,8 +241,8 @@ public virtual async Task> GetPostRulestackR /// /// Post Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostRulestackRule(string priority, CancellationToken cancellationToken = default) { @@ -252,7 +253,7 @@ public virtual Response GetPostRulestackRule(string p /// An object representing collection of GlobalRulestackPrefixResources and their operations over a GlobalRulestackPrefixResource. public virtual GlobalRulestackPrefixCollection GetGlobalRulestackPrefixes() { - return GetCachedClient(Client => new GlobalRulestackPrefixCollection(Client, Id)); + return GetCachedClient(client => new GlobalRulestackPrefixCollection(client, Id)); } /// @@ -270,8 +271,8 @@ public virtual GlobalRulestackPrefixCollection GetGlobalRulestackPrefixes() /// /// Local Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGlobalRulestackPrefixAsync(string name, CancellationToken cancellationToken = default) { @@ -293,8 +294,8 @@ public virtual async Task> GetGlobalRule /// /// Local Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGlobalRulestackPrefix(string name, CancellationToken cancellationToken = default) { @@ -305,7 +306,7 @@ public virtual Response GetGlobalRulestackPrefix( /// An object representing collection of PreRulestackRuleResources and their operations over a PreRulestackRuleResource. public virtual PreRulestackRuleCollection GetPreRulestackRules() { - return GetCachedClient(Client => new PreRulestackRuleCollection(Client, Id)); + return GetCachedClient(client => new PreRulestackRuleCollection(client, Id)); } /// @@ -323,8 +324,8 @@ public virtual PreRulestackRuleCollection GetPreRulestackRules() /// /// Pre Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPreRulestackRuleAsync(string priority, CancellationToken cancellationToken = default) { @@ -346,8 +347,8 @@ public virtual async Task> GetPreRulestackRul /// /// Pre Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPreRulestackRule(string priority, CancellationToken cancellationToken = default) { diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCertificateObjectResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCertificateObjectResource.cs index ab2458de40f7a..7be26bf55ab3b 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCertificateObjectResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackCertificateObjectResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class LocalRulestackCertificateObjectResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The localRulestackName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string localRulestackName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackFqdnResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackFqdnResource.cs index dbc7720115595..38af7abdc1206 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackFqdnResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackFqdnResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class LocalRulestackFqdnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The localRulestackName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string localRulestackName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackPrefixResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackPrefixResource.cs index 00622ff86b022..ac14cb454f61e 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackPrefixResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackPrefixResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class LocalRulestackPrefixResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The localRulestackName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string localRulestackName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackResource.cs index 1da0cb91e70fe..7298638251a48 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class LocalRulestackResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The localRulestackName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string localRulestackName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of LocalRulestackCertificateObjectResources and their operations over a LocalRulestackCertificateObjectResource. public virtual LocalRulestackCertificateObjectCollection GetLocalRulestackCertificateObjects() { - return GetCachedClient(Client => new LocalRulestackCertificateObjectCollection(Client, Id)); + return GetCachedClient(client => new LocalRulestackCertificateObjectCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual LocalRulestackCertificateObjectCollection GetLocalRulestackCertif /// /// certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLocalRulestackCertificateObjectAsync(string name, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> Get /// /// certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLocalRulestackCertificateObject(string name, CancellationToken cancellationToken = default) { @@ -147,7 +150,7 @@ public virtual Response GetLocalRulesta /// An object representing collection of LocalRulestackFqdnResources and their operations over a LocalRulestackFqdnResource. public virtual LocalRulestackFqdnCollection GetLocalRulestackFqdns() { - return GetCachedClient(Client => new LocalRulestackFqdnCollection(Client, Id)); + return GetCachedClient(client => new LocalRulestackFqdnCollection(client, Id)); } /// @@ -165,8 +168,8 @@ public virtual LocalRulestackFqdnCollection GetLocalRulestackFqdns() /// /// fqdn list name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLocalRulestackFqdnAsync(string name, CancellationToken cancellationToken = default) { @@ -188,8 +191,8 @@ public virtual async Task> GetLocalRulestac /// /// fqdn list name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLocalRulestackFqdn(string name, CancellationToken cancellationToken = default) { @@ -200,7 +203,7 @@ public virtual Response GetLocalRulestackFqdn(string /// An object representing collection of LocalRulestackRuleResources and their operations over a LocalRulestackRuleResource. public virtual LocalRulestackRuleCollection GetLocalRulestackRules() { - return GetCachedClient(Client => new LocalRulestackRuleCollection(Client, Id)); + return GetCachedClient(client => new LocalRulestackRuleCollection(client, Id)); } /// @@ -218,8 +221,8 @@ public virtual LocalRulestackRuleCollection GetLocalRulestackRules() /// /// Local Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLocalRulestackRuleAsync(string priority, CancellationToken cancellationToken = default) { @@ -241,8 +244,8 @@ public virtual async Task> GetLocalRulestac /// /// Local Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLocalRulestackRule(string priority, CancellationToken cancellationToken = default) { @@ -253,7 +256,7 @@ public virtual Response GetLocalRulestackRule(string /// An object representing collection of LocalRulestackPrefixResources and their operations over a LocalRulestackPrefixResource. public virtual LocalRulestackPrefixCollection GetLocalRulestackPrefixes() { - return GetCachedClient(Client => new LocalRulestackPrefixCollection(Client, Id)); + return GetCachedClient(client => new LocalRulestackPrefixCollection(client, Id)); } /// @@ -271,8 +274,8 @@ public virtual LocalRulestackPrefixCollection GetLocalRulestackPrefixes() /// /// Local Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetLocalRulestackPrefixAsync(string name, CancellationToken cancellationToken = default) { @@ -294,8 +297,8 @@ public virtual async Task> GetLocalRulest /// /// Local Rule priority. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetLocalRulestackPrefix(string name, CancellationToken cancellationToken = default) { diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackRuleResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackRuleResource.cs index 3e527ed02b8fc..8fab5e89b3ab1 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackRuleResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class LocalRulestackRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The localRulestackName. + /// The priority. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string localRulestackName, string priority) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallResource.cs index d87587de6fdc1..69e380651e78f 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class PaloAltoNetworksFirewallResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The firewallName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string firewallName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallStatusResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallStatusResource.cs index 3a2b2e37d7de3..b8ca6d68dd36c 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallStatusResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PaloAltoNetworksFirewallStatusResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class PaloAltoNetworksFirewallStatusResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The firewallName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string firewallName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PostRulestackRuleResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PostRulestackRuleResource.cs index de3d8ca7776d3..ca2f8f0fe9df0 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PostRulestackRuleResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PostRulestackRuleResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class PostRulestackRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The globalRulestackName. + /// The priority. public static ResourceIdentifier CreateResourceIdentifier(string globalRulestackName, string priority) { var resourceId = $"/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}"; diff --git a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PreRulestackRuleResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PreRulestackRuleResource.cs index fe0f33dcb3062..1b7f72d3f9e09 100644 --- a/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PreRulestackRuleResource.cs +++ b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/PreRulestackRuleResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.PaloAltoNetworks.Ngfw public partial class PreRulestackRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The globalRulestackName. + /// The priority. public static ResourceIdentifier CreateResourceIdentifier(string globalRulestackName, string priority) { var resourceId = $"/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}"; diff --git a/sdk/peering/Azure.ResourceManager.Peering/api/Azure.ResourceManager.Peering.netstandard2.0.cs b/sdk/peering/Azure.ResourceManager.Peering/api/Azure.ResourceManager.Peering.netstandard2.0.cs index 1fbc6fe194527..0d69331d00d0e 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/api/Azure.ResourceManager.Peering.netstandard2.0.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/api/Azure.ResourceManager.Peering.netstandard2.0.cs @@ -101,7 +101,7 @@ protected PeeringCollection() { } } public partial class PeeringData : Azure.ResourceManager.Models.TrackedResourceData { - public PeeringData(Azure.Core.AzureLocation location, Azure.ResourceManager.Peering.Models.PeeringSku sku, Azure.ResourceManager.Peering.Models.PeeringKind kind) : base (default(Azure.Core.AzureLocation)) { } + public PeeringData(Azure.Core.AzureLocation location, Azure.ResourceManager.Peering.Models.PeeringSku sku, Azure.ResourceManager.Peering.Models.PeeringKind kind) { } public Azure.ResourceManager.Peering.Models.DirectPeeringProperties Direct { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.ExchangePeeringProperties Exchange { get { throw null; } set { } } public Azure.ResourceManager.Peering.Models.PeeringKind Kind { get { throw null; } set { } } @@ -279,7 +279,7 @@ protected PeeringServiceCollection() { } } public partial class PeeringServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public PeeringServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PeeringServiceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Peering.Models.PeeringLogAnalyticsWorkspaceProperties LogAnalyticsWorkspaceProperties { get { throw null; } set { } } public string PeeringServiceLocation { get { throw null; } set { } } public string PeeringServiceProvider { get { throw null; } set { } } @@ -357,6 +357,59 @@ protected PeeringServiceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Peering.Models.PeeringServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Peering.Mocking +{ + public partial class MockablePeeringArmClient : Azure.ResourceManager.ArmResource + { + protected MockablePeeringArmClient() { } + public virtual Azure.ResourceManager.Peering.ConnectionMonitorTestResource GetConnectionMonitorTestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Peering.PeerAsnResource GetPeerAsnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Peering.PeeringRegisteredAsnResource GetPeeringRegisteredAsnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Peering.PeeringRegisteredPrefixResource GetPeeringRegisteredPrefixResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Peering.PeeringResource GetPeeringResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Peering.PeeringServicePrefixResource GetPeeringServicePrefixResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Peering.PeeringServiceResource GetPeeringServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockablePeeringResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePeeringResourceGroupResource() { } + public virtual Azure.Response GetPeering(string peeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPeeringAsync(string peeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Peering.PeeringCollection GetPeerings() { throw null; } + public virtual Azure.Response GetPeeringService(string peeringServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPeeringServiceAsync(string peeringServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Peering.PeeringServiceCollection GetPeeringServices() { throw null; } + } + public partial class MockablePeeringSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockablePeeringSubscriptionResource() { } + public virtual Azure.Response CheckPeeringServiceProviderAvailability(Azure.ResourceManager.Peering.Models.CheckPeeringServiceProviderAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPeeringServiceProviderAvailabilityAsync(Azure.ResourceManager.Peering.Models.CheckPeeringServiceProviderAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCdnPeeringPrefixes(string peeringLocation, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCdnPeeringPrefixesAsync(string peeringLocation, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPeerAsn(string peerAsnName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPeerAsnAsync(string peerAsnName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Peering.PeerAsnCollection GetPeerAsns() { throw null; } + public virtual Azure.Pageable GetPeeringLocations(Azure.ResourceManager.Peering.Models.PeeringLocationsKind kind, Azure.ResourceManager.Peering.Models.PeeringLocationsDirectPeeringType? directPeeringType = default(Azure.ResourceManager.Peering.Models.PeeringLocationsDirectPeeringType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPeeringLocationsAsync(Azure.ResourceManager.Peering.Models.PeeringLocationsKind kind, Azure.ResourceManager.Peering.Models.PeeringLocationsDirectPeeringType? directPeeringType = default(Azure.ResourceManager.Peering.Models.PeeringLocationsDirectPeeringType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPeerings(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPeeringsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPeeringsByLegacyPeering(string peeringLocation, Azure.ResourceManager.Peering.Models.LegacyPeeringsKind kind, int? asn = default(int?), Azure.ResourceManager.Peering.Models.DirectPeeringType? directPeeringType = default(Azure.ResourceManager.Peering.Models.DirectPeeringType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPeeringsByLegacyPeeringAsync(string peeringLocation, Azure.ResourceManager.Peering.Models.LegacyPeeringsKind kind, int? asn = default(int?), Azure.ResourceManager.Peering.Models.DirectPeeringType? directPeeringType = default(Azure.ResourceManager.Peering.Models.DirectPeeringType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPeeringServiceCountries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPeeringServiceCountriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPeeringServiceLocations(string country = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPeeringServiceLocationsAsync(string country = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPeeringServiceProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPeeringServiceProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPeeringServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPeeringServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response InitializePeeringServiceConnectionMonitor(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task InitializePeeringServiceConnectionMonitorAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response InvokeLookingGlass(Azure.ResourceManager.Peering.Models.LookingGlassCommand command, Azure.ResourceManager.Peering.Models.LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> InvokeLookingGlassAsync(Azure.ResourceManager.Peering.Models.LookingGlassCommand command, Azure.ResourceManager.Peering.Models.LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Peering.Models { public static partial class ArmPeeringModelFactory diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestResource.cs index b598eadae6639..0c2aceedef04c 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/ConnectionMonitorTestResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Peering public partial class ConnectionMonitorTestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The peeringServiceName. + /// The connectionMonitorTestName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string peeringServiceName, string connectionMonitorTestName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}"; diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringArmClient.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringArmClient.cs new file mode 100644 index 0000000000000..1cec286d6cf52 --- /dev/null +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Peering; + +namespace Azure.ResourceManager.Peering.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockablePeeringArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePeeringArmClient() + { + } + + /// 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 MockablePeeringArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockablePeeringArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PeerAsnResource GetPeerAsnResource(ResourceIdentifier id) + { + PeerAsnResource.ValidateResourceId(id); + return new PeerAsnResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PeeringRegisteredAsnResource GetPeeringRegisteredAsnResource(ResourceIdentifier id) + { + PeeringRegisteredAsnResource.ValidateResourceId(id); + return new PeeringRegisteredAsnResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PeeringRegisteredPrefixResource GetPeeringRegisteredPrefixResource(ResourceIdentifier id) + { + PeeringRegisteredPrefixResource.ValidateResourceId(id); + return new PeeringRegisteredPrefixResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PeeringResource GetPeeringResource(ResourceIdentifier id) + { + PeeringResource.ValidateResourceId(id); + return new PeeringResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConnectionMonitorTestResource GetConnectionMonitorTestResource(ResourceIdentifier id) + { + ConnectionMonitorTestResource.ValidateResourceId(id); + return new ConnectionMonitorTestResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PeeringServicePrefixResource GetPeeringServicePrefixResource(ResourceIdentifier id) + { + PeeringServicePrefixResource.ValidateResourceId(id); + return new PeeringServicePrefixResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PeeringServiceResource GetPeeringServiceResource(ResourceIdentifier id) + { + PeeringServiceResource.ValidateResourceId(id); + return new PeeringServiceResource(Client, id); + } + } +} diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringResourceGroupResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringResourceGroupResource.cs new file mode 100644 index 0000000000000..df745fa930456 --- /dev/null +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.Peering; + +namespace Azure.ResourceManager.Peering.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockablePeeringResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePeeringResourceGroupResource() + { + } + + /// 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 MockablePeeringResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PeeringResources in the ResourceGroupResource. + /// An object representing collection of PeeringResources and their operations over a PeeringResource. + public virtual PeeringCollection GetPeerings() + { + return GetCachedClient(client => new PeeringCollection(client, Id)); + } + + /// + /// Gets an existing peering with the specified name under the given subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName} + /// + /// + /// Operation Id + /// Peerings_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPeeringAsync(string peeringName, CancellationToken cancellationToken = default) + { + return await GetPeerings().GetAsync(peeringName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an existing peering with the specified name under the given subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName} + /// + /// + /// Operation Id + /// Peerings_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPeering(string peeringName, CancellationToken cancellationToken = default) + { + return GetPeerings().Get(peeringName, cancellationToken); + } + + /// Gets a collection of PeeringServiceResources in the ResourceGroupResource. + /// An object representing collection of PeeringServiceResources and their operations over a PeeringServiceResource. + public virtual PeeringServiceCollection GetPeeringServices() + { + return GetCachedClient(client => new PeeringServiceCollection(client, Id)); + } + + /// + /// Gets an existing peering service with the specified name under the given subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName} + /// + /// + /// Operation Id + /// PeeringServices_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPeeringServiceAsync(string peeringServiceName, CancellationToken cancellationToken = default) + { + return await GetPeeringServices().GetAsync(peeringServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an existing peering service with the specified name under the given subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName} + /// + /// + /// Operation Id + /// PeeringServices_Get + /// + /// + /// + /// The name of the peering. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPeeringService(string peeringServiceName, CancellationToken cancellationToken = default) + { + return GetPeeringServices().Get(peeringServiceName, cancellationToken); + } + } +} diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringSubscriptionResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringSubscriptionResource.cs new file mode 100644 index 0000000000000..26a7d70b72502 --- /dev/null +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/MockablePeeringSubscriptionResource.cs @@ -0,0 +1,721 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Peering; +using Azure.ResourceManager.Peering.Models; + +namespace Azure.ResourceManager.Peering.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockablePeeringSubscriptionResource : ArmResource + { + private ClientDiagnostics _cdnPeeringPrefixesClientDiagnostics; + private CdnPeeringPrefixesRestOperations _cdnPeeringPrefixesRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private PeeringManagementRestOperations _defaultRestClient; + private ClientDiagnostics _legacyPeeringsClientDiagnostics; + private LegacyPeeringsRestOperations _legacyPeeringsRestClient; + private ClientDiagnostics _lookingGlassClientDiagnostics; + private LookingGlassRestOperations _lookingGlassRestClient; + private ClientDiagnostics _peeringLocationsClientDiagnostics; + private PeeringLocationsRestOperations _peeringLocationsRestClient; + private ClientDiagnostics _peeringClientDiagnostics; + private PeeringsRestOperations _peeringRestClient; + private ClientDiagnostics _peeringServiceCountriesClientDiagnostics; + private PeeringServiceCountriesRestOperations _peeringServiceCountriesRestClient; + private ClientDiagnostics _peeringServiceLocationsClientDiagnostics; + private PeeringServiceLocationsRestOperations _peeringServiceLocationsRestClient; + private ClientDiagnostics _peeringServiceProvidersClientDiagnostics; + private PeeringServiceProvidersRestOperations _peeringServiceProvidersRestClient; + private ClientDiagnostics _peeringServiceClientDiagnostics; + private PeeringServicesRestOperations _peeringServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePeeringSubscriptionResource() + { + } + + /// 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 MockablePeeringSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CdnPeeringPrefixesClientDiagnostics => _cdnPeeringPrefixesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CdnPeeringPrefixesRestOperations CdnPeeringPrefixesRestClient => _cdnPeeringPrefixesRestClient ??= new CdnPeeringPrefixesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PeeringManagementRestOperations DefaultRestClient => _defaultRestClient ??= new PeeringManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics LegacyPeeringsClientDiagnostics => _legacyPeeringsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LegacyPeeringsRestOperations LegacyPeeringsRestClient => _legacyPeeringsRestClient ??= new LegacyPeeringsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics LookingGlassClientDiagnostics => _lookingGlassClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LookingGlassRestOperations LookingGlassRestClient => _lookingGlassRestClient ??= new LookingGlassRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PeeringLocationsClientDiagnostics => _peeringLocationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PeeringLocationsRestOperations PeeringLocationsRestClient => _peeringLocationsRestClient ??= new PeeringLocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PeeringClientDiagnostics => _peeringClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", PeeringResource.ResourceType.Namespace, Diagnostics); + private PeeringsRestOperations PeeringRestClient => _peeringRestClient ??= new PeeringsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PeeringResource.ResourceType)); + private ClientDiagnostics PeeringServiceCountriesClientDiagnostics => _peeringServiceCountriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PeeringServiceCountriesRestOperations PeeringServiceCountriesRestClient => _peeringServiceCountriesRestClient ??= new PeeringServiceCountriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PeeringServiceLocationsClientDiagnostics => _peeringServiceLocationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PeeringServiceLocationsRestOperations PeeringServiceLocationsRestClient => _peeringServiceLocationsRestClient ??= new PeeringServiceLocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PeeringServiceProvidersClientDiagnostics => _peeringServiceProvidersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PeeringServiceProvidersRestOperations PeeringServiceProvidersRestClient => _peeringServiceProvidersRestClient ??= new PeeringServiceProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PeeringServiceClientDiagnostics => _peeringServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", PeeringServiceResource.ResourceType.Namespace, Diagnostics); + private PeeringServicesRestOperations PeeringServiceRestClient => _peeringServiceRestClient ??= new PeeringServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PeeringServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PeerAsnResources in the SubscriptionResource. + /// An object representing collection of PeerAsnResources and their operations over a PeerAsnResource. + public virtual PeerAsnCollection GetPeerAsns() + { + return GetCachedClient(client => new PeerAsnCollection(client, Id)); + } + + /// + /// Gets the peer ASN with the specified name under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName} + /// + /// + /// Operation Id + /// PeerAsns_Get + /// + /// + /// + /// The peer ASN name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPeerAsnAsync(string peerAsnName, CancellationToken cancellationToken = default) + { + return await GetPeerAsns().GetAsync(peerAsnName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the peer ASN with the specified name under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName} + /// + /// + /// Operation Id + /// PeerAsns_Get + /// + /// + /// + /// The peer ASN name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPeerAsn(string peerAsnName, CancellationToken cancellationToken = default) + { + return GetPeerAsns().Get(peerAsnName, cancellationToken); + } + + /// + /// Lists all of the advertised prefixes for the specified peering location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/cdnPeeringPrefixes + /// + /// + /// Operation Id + /// CdnPeeringPrefixes_List + /// + /// + /// + /// The peering location. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCdnPeeringPrefixesAsync(string peeringLocation, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(peeringLocation, nameof(peeringLocation)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CdnPeeringPrefixesRestClient.CreateListRequest(Id.SubscriptionId, peeringLocation); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CdnPeeringPrefixesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, peeringLocation); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CdnPeeringPrefix.DeserializeCdnPeeringPrefix, CdnPeeringPrefixesClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetCdnPeeringPrefixes", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the advertised prefixes for the specified peering location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/cdnPeeringPrefixes + /// + /// + /// Operation Id + /// CdnPeeringPrefixes_List + /// + /// + /// + /// The peering location. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCdnPeeringPrefixes(string peeringLocation, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(peeringLocation, nameof(peeringLocation)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CdnPeeringPrefixesRestClient.CreateListRequest(Id.SubscriptionId, peeringLocation); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CdnPeeringPrefixesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, peeringLocation); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CdnPeeringPrefix.DeserializeCdnPeeringPrefix, CdnPeeringPrefixesClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetCdnPeeringPrefixes", "value", "nextLink", cancellationToken); + } + + /// + /// Checks if the peering service provider is present within 1000 miles of customer's location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability + /// + /// + /// Operation Id + /// CheckServiceProviderAvailability + /// + /// + /// + /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPeeringServiceProviderAvailabilityAsync(CheckPeeringServiceProviderAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockablePeeringSubscriptionResource.CheckPeeringServiceProviderAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckServiceProviderAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks if the peering service provider is present within 1000 miles of customer's location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability + /// + /// + /// Operation Id + /// CheckServiceProviderAvailability + /// + /// + /// + /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPeeringServiceProviderAvailability(CheckPeeringServiceProviderAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockablePeeringSubscriptionResource.CheckPeeringServiceProviderAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckServiceProviderAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all of the legacy peerings under the given subscription matching the specified kind and location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings + /// + /// + /// Operation Id + /// LegacyPeerings_List + /// + /// + /// + /// The location of the peering. + /// The kind of the peering. + /// The ASN number associated with a legacy peering. + /// The direct peering type. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPeeringsByLegacyPeeringAsync(string peeringLocation, LegacyPeeringsKind kind, int? asn = null, DirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(peeringLocation, nameof(peeringLocation)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LegacyPeeringsRestClient.CreateListRequest(Id.SubscriptionId, peeringLocation, kind, asn, directPeeringType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LegacyPeeringsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, peeringLocation, kind, asn, directPeeringType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PeeringResource(Client, PeeringData.DeserializePeeringData(e)), LegacyPeeringsClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringsByLegacyPeering", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the legacy peerings under the given subscription matching the specified kind and location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings + /// + /// + /// Operation Id + /// LegacyPeerings_List + /// + /// + /// + /// The location of the peering. + /// The kind of the peering. + /// The ASN number associated with a legacy peering. + /// The direct peering type. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPeeringsByLegacyPeering(string peeringLocation, LegacyPeeringsKind kind, int? asn = null, DirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(peeringLocation, nameof(peeringLocation)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LegacyPeeringsRestClient.CreateListRequest(Id.SubscriptionId, peeringLocation, kind, asn, directPeeringType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LegacyPeeringsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, peeringLocation, kind, asn, directPeeringType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PeeringResource(Client, PeeringData.DeserializePeeringData(e)), LegacyPeeringsClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringsByLegacyPeering", "value", "nextLink", cancellationToken); + } + + /// + /// Run looking glass functionality + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass + /// + /// + /// Operation Id + /// LookingGlass_Invoke + /// + /// + /// + /// The command to be executed: ping, traceroute, bgpRoute. + /// The type of the source: Edge site or Azure Region. + /// The location of the source. + /// The IP address of the destination. + /// The cancellation token to use. + /// or is null. + public virtual async Task> InvokeLookingGlassAsync(LookingGlassCommand command, LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(sourceLocation, nameof(sourceLocation)); + Argument.AssertNotNull(destinationIP, nameof(destinationIP)); + + using var scope = LookingGlassClientDiagnostics.CreateScope("MockablePeeringSubscriptionResource.InvokeLookingGlass"); + scope.Start(); + try + { + var response = await LookingGlassRestClient.InvokeAsync(Id.SubscriptionId, command, sourceType, sourceLocation, destinationIP, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Run looking glass functionality + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass + /// + /// + /// Operation Id + /// LookingGlass_Invoke + /// + /// + /// + /// The command to be executed: ping, traceroute, bgpRoute. + /// The type of the source: Edge site or Azure Region. + /// The location of the source. + /// The IP address of the destination. + /// The cancellation token to use. + /// or is null. + public virtual Response InvokeLookingGlass(LookingGlassCommand command, LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(sourceLocation, nameof(sourceLocation)); + Argument.AssertNotNull(destinationIP, nameof(destinationIP)); + + using var scope = LookingGlassClientDiagnostics.CreateScope("MockablePeeringSubscriptionResource.InvokeLookingGlass"); + scope.Start(); + try + { + var response = LookingGlassRestClient.Invoke(Id.SubscriptionId, command, sourceType, sourceLocation, destinationIP, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all of the available peering locations for the specified kind of peering. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations + /// + /// + /// Operation Id + /// PeeringLocations_List + /// + /// + /// + /// The kind of the peering. + /// The type of direct peering. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPeeringLocationsAsync(PeeringLocationsKind kind, PeeringLocationsDirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringLocationsRestClient.CreateListRequest(Id.SubscriptionId, kind, directPeeringType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringLocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, kind, directPeeringType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PeeringLocation.DeserializePeeringLocation, PeeringLocationsClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringLocations", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available peering locations for the specified kind of peering. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations + /// + /// + /// Operation Id + /// PeeringLocations_List + /// + /// + /// + /// The kind of the peering. + /// The type of direct peering. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPeeringLocations(PeeringLocationsKind kind, PeeringLocationsDirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringLocationsRestClient.CreateListRequest(Id.SubscriptionId, kind, directPeeringType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringLocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, kind, directPeeringType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PeeringLocation.DeserializePeeringLocation, PeeringLocationsClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringLocations", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the peerings under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerings + /// + /// + /// Operation Id + /// Peerings_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPeeringsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PeeringResource(Client, PeeringData.DeserializePeeringData(e)), PeeringClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeerings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the peerings under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerings + /// + /// + /// Operation Id + /// Peerings_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPeerings(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PeeringResource(Client, PeeringData.DeserializePeeringData(e)), PeeringClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeerings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available countries for peering service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries + /// + /// + /// Operation Id + /// PeeringServiceCountries_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPeeringServiceCountriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceCountriesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceCountriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PeeringServiceCountry.DeserializePeeringServiceCountry, PeeringServiceCountriesClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringServiceCountries", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available countries for peering service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries + /// + /// + /// Operation Id + /// PeeringServiceCountries_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPeeringServiceCountries(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceCountriesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceCountriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PeeringServiceCountry.DeserializePeeringServiceCountry, PeeringServiceCountriesClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringServiceCountries", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available locations for peering service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceLocations + /// + /// + /// Operation Id + /// PeeringServiceLocations_List + /// + /// + /// + /// The country of interest, in which the locations are to be present. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPeeringServiceLocationsAsync(string country = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceLocationsRestClient.CreateListRequest(Id.SubscriptionId, country); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceLocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, country); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PeeringServiceLocation.DeserializePeeringServiceLocation, PeeringServiceLocationsClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringServiceLocations", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available locations for peering service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceLocations + /// + /// + /// Operation Id + /// PeeringServiceLocations_List + /// + /// + /// + /// The country of interest, in which the locations are to be present. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPeeringServiceLocations(string country = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceLocationsRestClient.CreateListRequest(Id.SubscriptionId, country); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceLocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, country); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PeeringServiceLocation.DeserializePeeringServiceLocation, PeeringServiceLocationsClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringServiceLocations", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available peering service locations for the specified kind of peering. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceProviders + /// + /// + /// Operation Id + /// PeeringServiceProviders_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPeeringServiceProvidersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceProvidersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PeeringServiceProvider.DeserializePeeringServiceProvider, PeeringServiceProvidersClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringServiceProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the available peering service locations for the specified kind of peering. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceProviders + /// + /// + /// Operation Id + /// PeeringServiceProviders_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPeeringServiceProviders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceProvidersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PeeringServiceProvider.DeserializePeeringServiceProvider, PeeringServiceProvidersClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringServiceProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the peerings under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServices + /// + /// + /// Operation Id + /// PeeringServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPeeringServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PeeringServiceResource(Client, PeeringServiceData.DeserializePeeringServiceData(e)), PeeringServiceClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringServices", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the peerings under the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServices + /// + /// + /// Operation Id + /// PeeringServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPeeringServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PeeringServiceResource(Client, PeeringServiceData.DeserializePeeringServiceData(e)), PeeringServiceClientDiagnostics, Pipeline, "MockablePeeringSubscriptionResource.GetPeeringServices", "value", "nextLink", cancellationToken); + } + + /// + /// Initialize Peering Service for Connection Monitor functionality + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor + /// + /// + /// Operation Id + /// PeeringServices_InitializeConnectionMonitor + /// + /// + /// + /// The cancellation token to use. + public virtual async Task InitializePeeringServiceConnectionMonitorAsync(CancellationToken cancellationToken = default) + { + using var scope = PeeringServiceClientDiagnostics.CreateScope("MockablePeeringSubscriptionResource.InitializePeeringServiceConnectionMonitor"); + scope.Start(); + try + { + var response = await PeeringServiceRestClient.InitializeConnectionMonitorAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Initialize Peering Service for Connection Monitor functionality + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor + /// + /// + /// Operation Id + /// PeeringServices_InitializeConnectionMonitor + /// + /// + /// + /// The cancellation token to use. + public virtual Response InitializePeeringServiceConnectionMonitor(CancellationToken cancellationToken = default) + { + using var scope = PeeringServiceClientDiagnostics.CreateScope("MockablePeeringSubscriptionResource.InitializePeeringServiceConnectionMonitor"); + scope.Start(); + try + { + var response = PeeringServiceRestClient.InitializeConnectionMonitor(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/PeeringExtensions.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/PeeringExtensions.cs index a46d8a056cb97..9105e6d492b77 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/PeeringExtensions.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/PeeringExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Peering.Mocking; using Azure.ResourceManager.Peering.Models; using Azure.ResourceManager.Resources; @@ -19,176 +20,145 @@ namespace Azure.ResourceManager.Peering /// A class to add extension methods to Azure.ResourceManager.Peering. public static partial class PeeringExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockablePeeringArmClient GetMockablePeeringArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockablePeeringArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePeeringResourceGroupResource GetMockablePeeringResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePeeringResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockablePeeringSubscriptionResource GetMockablePeeringSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePeeringSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region PeerAsnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PeerAsnResource GetPeerAsnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PeerAsnResource.ValidateResourceId(id); - return new PeerAsnResource(client, id); - } - ); + return GetMockablePeeringArmClient(client).GetPeerAsnResource(id); } - #endregion - #region PeeringRegisteredAsnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PeeringRegisteredAsnResource GetPeeringRegisteredAsnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PeeringRegisteredAsnResource.ValidateResourceId(id); - return new PeeringRegisteredAsnResource(client, id); - } - ); + return GetMockablePeeringArmClient(client).GetPeeringRegisteredAsnResource(id); } - #endregion - #region PeeringRegisteredPrefixResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PeeringRegisteredPrefixResource GetPeeringRegisteredPrefixResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PeeringRegisteredPrefixResource.ValidateResourceId(id); - return new PeeringRegisteredPrefixResource(client, id); - } - ); + return GetMockablePeeringArmClient(client).GetPeeringRegisteredPrefixResource(id); } - #endregion - #region PeeringResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PeeringResource GetPeeringResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PeeringResource.ValidateResourceId(id); - return new PeeringResource(client, id); - } - ); + return GetMockablePeeringArmClient(client).GetPeeringResource(id); } - #endregion - #region ConnectionMonitorTestResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ConnectionMonitorTestResource GetConnectionMonitorTestResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ConnectionMonitorTestResource.ValidateResourceId(id); - return new ConnectionMonitorTestResource(client, id); - } - ); + return GetMockablePeeringArmClient(client).GetConnectionMonitorTestResource(id); } - #endregion - #region PeeringServicePrefixResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PeeringServicePrefixResource GetPeeringServicePrefixResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PeeringServicePrefixResource.ValidateResourceId(id); - return new PeeringServicePrefixResource(client, id); - } - ); + return GetMockablePeeringArmClient(client).GetPeeringServicePrefixResource(id); } - #endregion - #region PeeringServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PeeringServiceResource GetPeeringServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PeeringServiceResource.ValidateResourceId(id); - return new PeeringServiceResource(client, id); - } - ); + return GetMockablePeeringArmClient(client).GetPeeringServiceResource(id); } - #endregion - /// Gets a collection of PeeringResources in the ResourceGroupResource. + /// + /// Gets a collection of PeeringResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PeeringResources and their operations over a PeeringResource. public static PeeringCollection GetPeerings(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPeerings(); + return GetMockablePeeringResourceGroupResource(resourceGroupResource).GetPeerings(); } /// @@ -203,16 +173,20 @@ public static PeeringCollection GetPeerings(this ResourceGroupResource resourceG /// Peerings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPeeringAsync(this ResourceGroupResource resourceGroupResource, string peeringName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPeerings().GetAsync(peeringName, cancellationToken).ConfigureAwait(false); + return await GetMockablePeeringResourceGroupResource(resourceGroupResource).GetPeeringAsync(peeringName, cancellationToken).ConfigureAwait(false); } /// @@ -227,24 +201,34 @@ public static async Task> GetPeeringAsync(this Resourc /// Peerings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPeering(this ResourceGroupResource resourceGroupResource, string peeringName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPeerings().Get(peeringName, cancellationToken); + return GetMockablePeeringResourceGroupResource(resourceGroupResource).GetPeering(peeringName, cancellationToken); } - /// Gets a collection of PeeringServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of PeeringServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PeeringServiceResources and their operations over a PeeringServiceResource. public static PeeringServiceCollection GetPeeringServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPeeringServices(); + return GetMockablePeeringResourceGroupResource(resourceGroupResource).GetPeeringServices(); } /// @@ -259,16 +243,20 @@ public static PeeringServiceCollection GetPeeringServices(this ResourceGroupReso /// PeeringServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPeeringServiceAsync(this ResourceGroupResource resourceGroupResource, string peeringServiceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPeeringServices().GetAsync(peeringServiceName, cancellationToken).ConfigureAwait(false); + return await GetMockablePeeringResourceGroupResource(resourceGroupResource).GetPeeringServiceAsync(peeringServiceName, cancellationToken).ConfigureAwait(false); } /// @@ -283,24 +271,34 @@ public static async Task> GetPeeringServiceAsyn /// PeeringServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the peering. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPeeringService(this ResourceGroupResource resourceGroupResource, string peeringServiceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPeeringServices().Get(peeringServiceName, cancellationToken); + return GetMockablePeeringResourceGroupResource(resourceGroupResource).GetPeeringService(peeringServiceName, cancellationToken); } - /// Gets a collection of PeerAsnResources in the SubscriptionResource. + /// + /// Gets a collection of PeerAsnResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PeerAsnResources and their operations over a PeerAsnResource. public static PeerAsnCollection GetPeerAsns(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeerAsns(); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeerAsns(); } /// @@ -315,16 +313,20 @@ public static PeerAsnCollection GetPeerAsns(this SubscriptionResource subscripti /// PeerAsns_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The peer ASN name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPeerAsnAsync(this SubscriptionResource subscriptionResource, string peerAsnName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetPeerAsns().GetAsync(peerAsnName, cancellationToken).ConfigureAwait(false); + return await GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeerAsnAsync(peerAsnName, cancellationToken).ConfigureAwait(false); } /// @@ -339,16 +341,20 @@ public static async Task> GetPeerAsnAsync(this Subscri /// PeerAsns_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The peer ASN name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPeerAsn(this SubscriptionResource subscriptionResource, string peerAsnName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetPeerAsns().Get(peerAsnName, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeerAsn(peerAsnName, cancellationToken); } /// @@ -363,6 +369,10 @@ public static Response GetPeerAsn(this SubscriptionResource sub /// CdnPeeringPrefixes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The peering location. @@ -371,9 +381,7 @@ public static Response GetPeerAsn(this SubscriptionResource sub /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCdnPeeringPrefixesAsync(this SubscriptionResource subscriptionResource, string peeringLocation, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(peeringLocation, nameof(peeringLocation)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCdnPeeringPrefixesAsync(peeringLocation, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetCdnPeeringPrefixesAsync(peeringLocation, cancellationToken); } /// @@ -388,6 +396,10 @@ public static AsyncPageable GetCdnPeeringPrefixesAsync(this Su /// CdnPeeringPrefixes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The peering location. @@ -396,9 +408,7 @@ public static AsyncPageable GetCdnPeeringPrefixesAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCdnPeeringPrefixes(this SubscriptionResource subscriptionResource, string peeringLocation, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(peeringLocation, nameof(peeringLocation)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCdnPeeringPrefixes(peeringLocation, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetCdnPeeringPrefixes(peeringLocation, cancellationToken); } /// @@ -413,6 +423,10 @@ public static Pageable GetCdnPeeringPrefixes(this Subscription /// CheckServiceProviderAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. @@ -420,9 +434,7 @@ public static Pageable GetCdnPeeringPrefixes(this Subscription /// is null. public static async Task> CheckPeeringServiceProviderAvailabilityAsync(this SubscriptionResource subscriptionResource, CheckPeeringServiceProviderAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPeeringServiceProviderAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockablePeeringSubscriptionResource(subscriptionResource).CheckPeeringServiceProviderAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -437,6 +449,10 @@ public static async Task> CheckPeer /// CheckServiceProviderAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. @@ -444,9 +460,7 @@ public static async Task> CheckPeer /// is null. public static Response CheckPeeringServiceProviderAvailability(this SubscriptionResource subscriptionResource, CheckPeeringServiceProviderAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPeeringServiceProviderAvailability(content, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).CheckPeeringServiceProviderAvailability(content, cancellationToken); } /// @@ -461,6 +475,10 @@ public static Response CheckPeeringServicePr /// LegacyPeerings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the peering. @@ -472,9 +490,7 @@ public static Response CheckPeeringServicePr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPeeringsByLegacyPeeringAsync(this SubscriptionResource subscriptionResource, string peeringLocation, LegacyPeeringsKind kind, int? asn = null, DirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(peeringLocation, nameof(peeringLocation)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringsByLegacyPeeringAsync(peeringLocation, kind, asn, directPeeringType, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringsByLegacyPeeringAsync(peeringLocation, kind, asn, directPeeringType, cancellationToken); } /// @@ -489,6 +505,10 @@ public static AsyncPageable GetPeeringsByLegacyPeeringAsync(thi /// LegacyPeerings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the peering. @@ -500,9 +520,7 @@ public static AsyncPageable GetPeeringsByLegacyPeeringAsync(thi /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPeeringsByLegacyPeering(this SubscriptionResource subscriptionResource, string peeringLocation, LegacyPeeringsKind kind, int? asn = null, DirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(peeringLocation, nameof(peeringLocation)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringsByLegacyPeering(peeringLocation, kind, asn, directPeeringType, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringsByLegacyPeering(peeringLocation, kind, asn, directPeeringType, cancellationToken); } /// @@ -517,6 +535,10 @@ public static Pageable GetPeeringsByLegacyPeering(this Subscrip /// LookingGlass_Invoke /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The command to be executed: ping, traceroute, bgpRoute. @@ -527,10 +549,7 @@ public static Pageable GetPeeringsByLegacyPeering(this Subscrip /// or is null. public static async Task> InvokeLookingGlassAsync(this SubscriptionResource subscriptionResource, LookingGlassCommand command, LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(sourceLocation, nameof(sourceLocation)); - Argument.AssertNotNull(destinationIP, nameof(destinationIP)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).InvokeLookingGlassAsync(command, sourceType, sourceLocation, destinationIP, cancellationToken).ConfigureAwait(false); + return await GetMockablePeeringSubscriptionResource(subscriptionResource).InvokeLookingGlassAsync(command, sourceType, sourceLocation, destinationIP, cancellationToken).ConfigureAwait(false); } /// @@ -545,6 +564,10 @@ public static async Task> InvokeLookingGlassAsync(t /// LookingGlass_Invoke /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The command to be executed: ping, traceroute, bgpRoute. @@ -555,10 +578,7 @@ public static async Task> InvokeLookingGlassAsync(t /// or is null. public static Response InvokeLookingGlass(this SubscriptionResource subscriptionResource, LookingGlassCommand command, LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(sourceLocation, nameof(sourceLocation)); - Argument.AssertNotNull(destinationIP, nameof(destinationIP)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).InvokeLookingGlass(command, sourceType, sourceLocation, destinationIP, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).InvokeLookingGlass(command, sourceType, sourceLocation, destinationIP, cancellationToken); } /// @@ -573,6 +593,10 @@ public static Response InvokeLookingGlass(this SubscriptionR /// PeeringLocations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The kind of the peering. @@ -581,7 +605,7 @@ public static Response InvokeLookingGlass(this SubscriptionR /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPeeringLocationsAsync(this SubscriptionResource subscriptionResource, PeeringLocationsKind kind, PeeringLocationsDirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringLocationsAsync(kind, directPeeringType, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringLocationsAsync(kind, directPeeringType, cancellationToken); } /// @@ -596,6 +620,10 @@ public static AsyncPageable GetPeeringLocationsAsync(this Subsc /// PeeringLocations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The kind of the peering. @@ -604,7 +632,7 @@ public static AsyncPageable GetPeeringLocationsAsync(this Subsc /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPeeringLocations(this SubscriptionResource subscriptionResource, PeeringLocationsKind kind, PeeringLocationsDirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringLocations(kind, directPeeringType, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringLocations(kind, directPeeringType, cancellationToken); } /// @@ -619,13 +647,17 @@ public static Pageable GetPeeringLocations(this SubscriptionRes /// Peerings_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPeeringsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringsAsync(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringsAsync(cancellationToken); } /// @@ -640,13 +672,17 @@ public static AsyncPageable GetPeeringsAsync(this SubscriptionR /// Peerings_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPeerings(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeerings(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeerings(cancellationToken); } /// @@ -661,13 +697,17 @@ public static Pageable GetPeerings(this SubscriptionResource su /// PeeringServiceCountries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPeeringServiceCountriesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringServiceCountriesAsync(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringServiceCountriesAsync(cancellationToken); } /// @@ -682,13 +722,17 @@ public static AsyncPageable GetPeeringServiceCountriesAsy /// PeeringServiceCountries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPeeringServiceCountries(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringServiceCountries(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringServiceCountries(cancellationToken); } /// @@ -703,6 +747,10 @@ public static Pageable GetPeeringServiceCountries(this Su /// PeeringServiceLocations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The country of interest, in which the locations are to be present. @@ -710,7 +758,7 @@ public static Pageable GetPeeringServiceCountries(this Su /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPeeringServiceLocationsAsync(this SubscriptionResource subscriptionResource, string country = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringServiceLocationsAsync(country, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringServiceLocationsAsync(country, cancellationToken); } /// @@ -725,6 +773,10 @@ public static AsyncPageable GetPeeringServiceLocationsAs /// PeeringServiceLocations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The country of interest, in which the locations are to be present. @@ -732,7 +784,7 @@ public static AsyncPageable GetPeeringServiceLocationsAs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPeeringServiceLocations(this SubscriptionResource subscriptionResource, string country = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringServiceLocations(country, cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringServiceLocations(country, cancellationToken); } /// @@ -747,13 +799,17 @@ public static Pageable GetPeeringServiceLocations(this S /// PeeringServiceProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPeeringServiceProvidersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringServiceProvidersAsync(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringServiceProvidersAsync(cancellationToken); } /// @@ -768,13 +824,17 @@ public static AsyncPageable GetPeeringServiceProvidersAs /// PeeringServiceProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPeeringServiceProviders(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringServiceProviders(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringServiceProviders(cancellationToken); } /// @@ -789,13 +849,17 @@ public static Pageable GetPeeringServiceProviders(this S /// PeeringServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPeeringServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringServicesAsync(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringServicesAsync(cancellationToken); } /// @@ -810,13 +874,17 @@ public static AsyncPageable GetPeeringServicesAsync(this /// PeeringServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPeeringServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPeeringServices(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).GetPeeringServices(cancellationToken); } /// @@ -831,12 +899,16 @@ public static Pageable GetPeeringServices(this Subscript /// PeeringServices_InitializeConnectionMonitor /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task InitializePeeringServiceConnectionMonitorAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).InitializePeeringServiceConnectionMonitorAsync(cancellationToken).ConfigureAwait(false); + return await GetMockablePeeringSubscriptionResource(subscriptionResource).InitializePeeringServiceConnectionMonitorAsync(cancellationToken).ConfigureAwait(false); } /// @@ -851,12 +923,16 @@ public static async Task InitializePeeringServiceConnectionMonitorAsyn /// PeeringServices_InitializeConnectionMonitor /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response InitializePeeringServiceConnectionMonitor(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).InitializePeeringServiceConnectionMonitor(cancellationToken); + return GetMockablePeeringSubscriptionResource(subscriptionResource).InitializePeeringServiceConnectionMonitor(cancellationToken); } } } diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 7af68a7a83c51..0000000000000 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Peering -{ - /// 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 PeeringResources in the ResourceGroupResource. - /// An object representing collection of PeeringResources and their operations over a PeeringResource. - public virtual PeeringCollection GetPeerings() - { - return GetCachedClient(Client => new PeeringCollection(Client, Id)); - } - - /// Gets a collection of PeeringServiceResources in the ResourceGroupResource. - /// An object representing collection of PeeringServiceResources and their operations over a PeeringServiceResource. - public virtual PeeringServiceCollection GetPeeringServices() - { - return GetCachedClient(Client => new PeeringServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d7e40bc28fd83..0000000000000 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,648 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Peering.Models; - -namespace Azure.ResourceManager.Peering -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _cdnPeeringPrefixesClientDiagnostics; - private CdnPeeringPrefixesRestOperations _cdnPeeringPrefixesRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private PeeringManagementRestOperations _defaultRestClient; - private ClientDiagnostics _legacyPeeringsClientDiagnostics; - private LegacyPeeringsRestOperations _legacyPeeringsRestClient; - private ClientDiagnostics _lookingGlassClientDiagnostics; - private LookingGlassRestOperations _lookingGlassRestClient; - private ClientDiagnostics _peeringLocationsClientDiagnostics; - private PeeringLocationsRestOperations _peeringLocationsRestClient; - private ClientDiagnostics _peeringClientDiagnostics; - private PeeringsRestOperations _peeringRestClient; - private ClientDiagnostics _peeringServiceCountriesClientDiagnostics; - private PeeringServiceCountriesRestOperations _peeringServiceCountriesRestClient; - private ClientDiagnostics _peeringServiceLocationsClientDiagnostics; - private PeeringServiceLocationsRestOperations _peeringServiceLocationsRestClient; - private ClientDiagnostics _peeringServiceProvidersClientDiagnostics; - private PeeringServiceProvidersRestOperations _peeringServiceProvidersRestClient; - private ClientDiagnostics _peeringServiceClientDiagnostics; - private PeeringServicesRestOperations _peeringServiceRestClient; - - /// 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 CdnPeeringPrefixesClientDiagnostics => _cdnPeeringPrefixesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CdnPeeringPrefixesRestOperations CdnPeeringPrefixesRestClient => _cdnPeeringPrefixesRestClient ??= new CdnPeeringPrefixesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PeeringManagementRestOperations DefaultRestClient => _defaultRestClient ??= new PeeringManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics LegacyPeeringsClientDiagnostics => _legacyPeeringsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LegacyPeeringsRestOperations LegacyPeeringsRestClient => _legacyPeeringsRestClient ??= new LegacyPeeringsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics LookingGlassClientDiagnostics => _lookingGlassClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LookingGlassRestOperations LookingGlassRestClient => _lookingGlassRestClient ??= new LookingGlassRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PeeringLocationsClientDiagnostics => _peeringLocationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PeeringLocationsRestOperations PeeringLocationsRestClient => _peeringLocationsRestClient ??= new PeeringLocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PeeringClientDiagnostics => _peeringClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", PeeringResource.ResourceType.Namespace, Diagnostics); - private PeeringsRestOperations PeeringRestClient => _peeringRestClient ??= new PeeringsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PeeringResource.ResourceType)); - private ClientDiagnostics PeeringServiceCountriesClientDiagnostics => _peeringServiceCountriesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PeeringServiceCountriesRestOperations PeeringServiceCountriesRestClient => _peeringServiceCountriesRestClient ??= new PeeringServiceCountriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PeeringServiceLocationsClientDiagnostics => _peeringServiceLocationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PeeringServiceLocationsRestOperations PeeringServiceLocationsRestClient => _peeringServiceLocationsRestClient ??= new PeeringServiceLocationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PeeringServiceProvidersClientDiagnostics => _peeringServiceProvidersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PeeringServiceProvidersRestOperations PeeringServiceProvidersRestClient => _peeringServiceProvidersRestClient ??= new PeeringServiceProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PeeringServiceClientDiagnostics => _peeringServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Peering", PeeringServiceResource.ResourceType.Namespace, Diagnostics); - private PeeringServicesRestOperations PeeringServiceRestClient => _peeringServiceRestClient ??= new PeeringServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PeeringServiceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of PeerAsnResources in the SubscriptionResource. - /// An object representing collection of PeerAsnResources and their operations over a PeerAsnResource. - public virtual PeerAsnCollection GetPeerAsns() - { - return GetCachedClient(Client => new PeerAsnCollection(Client, Id)); - } - - /// - /// Lists all of the advertised prefixes for the specified peering location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/cdnPeeringPrefixes - /// - /// - /// Operation Id - /// CdnPeeringPrefixes_List - /// - /// - /// - /// The peering location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCdnPeeringPrefixesAsync(string peeringLocation, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CdnPeeringPrefixesRestClient.CreateListRequest(Id.SubscriptionId, peeringLocation); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CdnPeeringPrefixesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, peeringLocation); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CdnPeeringPrefix.DeserializeCdnPeeringPrefix, CdnPeeringPrefixesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCdnPeeringPrefixes", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the advertised prefixes for the specified peering location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/cdnPeeringPrefixes - /// - /// - /// Operation Id - /// CdnPeeringPrefixes_List - /// - /// - /// - /// The peering location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCdnPeeringPrefixes(string peeringLocation, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CdnPeeringPrefixesRestClient.CreateListRequest(Id.SubscriptionId, peeringLocation); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CdnPeeringPrefixesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, peeringLocation); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CdnPeeringPrefix.DeserializeCdnPeeringPrefix, CdnPeeringPrefixesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCdnPeeringPrefixes", "value", "nextLink", cancellationToken); - } - - /// - /// Checks if the peering service provider is present within 1000 miles of customer's location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability - /// - /// - /// Operation Id - /// CheckServiceProviderAvailability - /// - /// - /// - /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. - /// The cancellation token to use. - public virtual async Task> CheckPeeringServiceProviderAvailabilityAsync(CheckPeeringServiceProviderAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPeeringServiceProviderAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckServiceProviderAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks if the peering service provider is present within 1000 miles of customer's location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability - /// - /// - /// Operation Id - /// CheckServiceProviderAvailability - /// - /// - /// - /// The CheckServiceProviderAvailabilityInput indicating customer location and service provider. - /// The cancellation token to use. - public virtual Response CheckPeeringServiceProviderAvailability(CheckPeeringServiceProviderAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPeeringServiceProviderAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckServiceProviderAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all of the legacy peerings under the given subscription matching the specified kind and location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings - /// - /// - /// Operation Id - /// LegacyPeerings_List - /// - /// - /// - /// The location of the peering. - /// The kind of the peering. - /// The ASN number associated with a legacy peering. - /// The direct peering type. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPeeringsByLegacyPeeringAsync(string peeringLocation, LegacyPeeringsKind kind, int? asn = null, DirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LegacyPeeringsRestClient.CreateListRequest(Id.SubscriptionId, peeringLocation, kind, asn, directPeeringType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LegacyPeeringsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, peeringLocation, kind, asn, directPeeringType); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PeeringResource(Client, PeeringData.DeserializePeeringData(e)), LegacyPeeringsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringsByLegacyPeering", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the legacy peerings under the given subscription matching the specified kind and location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings - /// - /// - /// Operation Id - /// LegacyPeerings_List - /// - /// - /// - /// The location of the peering. - /// The kind of the peering. - /// The ASN number associated with a legacy peering. - /// The direct peering type. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPeeringsByLegacyPeering(string peeringLocation, LegacyPeeringsKind kind, int? asn = null, DirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LegacyPeeringsRestClient.CreateListRequest(Id.SubscriptionId, peeringLocation, kind, asn, directPeeringType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LegacyPeeringsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, peeringLocation, kind, asn, directPeeringType); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PeeringResource(Client, PeeringData.DeserializePeeringData(e)), LegacyPeeringsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringsByLegacyPeering", "value", "nextLink", cancellationToken); - } - - /// - /// Run looking glass functionality - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass - /// - /// - /// Operation Id - /// LookingGlass_Invoke - /// - /// - /// - /// The command to be executed: ping, traceroute, bgpRoute. - /// The type of the source: Edge site or Azure Region. - /// The location of the source. - /// The IP address of the destination. - /// The cancellation token to use. - public virtual async Task> InvokeLookingGlassAsync(LookingGlassCommand command, LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, CancellationToken cancellationToken = default) - { - using var scope = LookingGlassClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.InvokeLookingGlass"); - scope.Start(); - try - { - var response = await LookingGlassRestClient.InvokeAsync(Id.SubscriptionId, command, sourceType, sourceLocation, destinationIP, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Run looking glass functionality - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass - /// - /// - /// Operation Id - /// LookingGlass_Invoke - /// - /// - /// - /// The command to be executed: ping, traceroute, bgpRoute. - /// The type of the source: Edge site or Azure Region. - /// The location of the source. - /// The IP address of the destination. - /// The cancellation token to use. - public virtual Response InvokeLookingGlass(LookingGlassCommand command, LookingGlassSourceType sourceType, string sourceLocation, string destinationIP, CancellationToken cancellationToken = default) - { - using var scope = LookingGlassClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.InvokeLookingGlass"); - scope.Start(); - try - { - var response = LookingGlassRestClient.Invoke(Id.SubscriptionId, command, sourceType, sourceLocation, destinationIP, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all of the available peering locations for the specified kind of peering. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations - /// - /// - /// Operation Id - /// PeeringLocations_List - /// - /// - /// - /// The kind of the peering. - /// The type of direct peering. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPeeringLocationsAsync(PeeringLocationsKind kind, PeeringLocationsDirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringLocationsRestClient.CreateListRequest(Id.SubscriptionId, kind, directPeeringType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringLocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, kind, directPeeringType); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PeeringLocation.DeserializePeeringLocation, PeeringLocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringLocations", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available peering locations for the specified kind of peering. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations - /// - /// - /// Operation Id - /// PeeringLocations_List - /// - /// - /// - /// The kind of the peering. - /// The type of direct peering. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPeeringLocations(PeeringLocationsKind kind, PeeringLocationsDirectPeeringType? directPeeringType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringLocationsRestClient.CreateListRequest(Id.SubscriptionId, kind, directPeeringType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringLocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, kind, directPeeringType); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PeeringLocation.DeserializePeeringLocation, PeeringLocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringLocations", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the peerings under the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerings - /// - /// - /// Operation Id - /// Peerings_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPeeringsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PeeringResource(Client, PeeringData.DeserializePeeringData(e)), PeeringClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeerings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the peerings under the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerings - /// - /// - /// Operation Id - /// Peerings_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPeerings(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PeeringResource(Client, PeeringData.DeserializePeeringData(e)), PeeringClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeerings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available countries for peering service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries - /// - /// - /// Operation Id - /// PeeringServiceCountries_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPeeringServiceCountriesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceCountriesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceCountriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PeeringServiceCountry.DeserializePeeringServiceCountry, PeeringServiceCountriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringServiceCountries", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available countries for peering service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries - /// - /// - /// Operation Id - /// PeeringServiceCountries_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPeeringServiceCountries(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceCountriesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceCountriesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PeeringServiceCountry.DeserializePeeringServiceCountry, PeeringServiceCountriesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringServiceCountries", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available locations for peering service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceLocations - /// - /// - /// Operation Id - /// PeeringServiceLocations_List - /// - /// - /// - /// The country of interest, in which the locations are to be present. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPeeringServiceLocationsAsync(string country = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceLocationsRestClient.CreateListRequest(Id.SubscriptionId, country); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceLocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, country); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PeeringServiceLocation.DeserializePeeringServiceLocation, PeeringServiceLocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringServiceLocations", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available locations for peering service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceLocations - /// - /// - /// Operation Id - /// PeeringServiceLocations_List - /// - /// - /// - /// The country of interest, in which the locations are to be present. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPeeringServiceLocations(string country = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceLocationsRestClient.CreateListRequest(Id.SubscriptionId, country); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceLocationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, country); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PeeringServiceLocation.DeserializePeeringServiceLocation, PeeringServiceLocationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringServiceLocations", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available peering service locations for the specified kind of peering. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceProviders - /// - /// - /// Operation Id - /// PeeringServiceProviders_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPeeringServiceProvidersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceProvidersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PeeringServiceProvider.DeserializePeeringServiceProvider, PeeringServiceProvidersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringServiceProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the available peering service locations for the specified kind of peering. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceProviders - /// - /// - /// Operation Id - /// PeeringServiceProviders_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPeeringServiceProviders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceProvidersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PeeringServiceProvider.DeserializePeeringServiceProvider, PeeringServiceProvidersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringServiceProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the peerings under the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServices - /// - /// - /// Operation Id - /// PeeringServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPeeringServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PeeringServiceResource(Client, PeeringServiceData.DeserializePeeringServiceData(e)), PeeringServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringServices", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the peerings under the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServices - /// - /// - /// Operation Id - /// PeeringServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPeeringServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PeeringServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PeeringServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PeeringServiceResource(Client, PeeringServiceData.DeserializePeeringServiceData(e)), PeeringServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPeeringServices", "value", "nextLink", cancellationToken); - } - - /// - /// Initialize Peering Service for Connection Monitor functionality - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor - /// - /// - /// Operation Id - /// PeeringServices_InitializeConnectionMonitor - /// - /// - /// - /// The cancellation token to use. - public virtual async Task InitializePeeringServiceConnectionMonitorAsync(CancellationToken cancellationToken = default) - { - using var scope = PeeringServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.InitializePeeringServiceConnectionMonitor"); - scope.Start(); - try - { - var response = await PeeringServiceRestClient.InitializeConnectionMonitorAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Initialize Peering Service for Connection Monitor functionality - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor - /// - /// - /// Operation Id - /// PeeringServices_InitializeConnectionMonitor - /// - /// - /// - /// The cancellation token to use. - public virtual Response InitializePeeringServiceConnectionMonitor(CancellationToken cancellationToken = default) - { - using var scope = PeeringServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.InitializePeeringServiceConnectionMonitor"); - scope.Start(); - try - { - var response = PeeringServiceRestClient.InitializeConnectionMonitor(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnResource.cs index 4851a1f7c1b4f..cde25320400a5 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeerAsnResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Peering public partial class PeerAsnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The peerAsnName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string peerAsnName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peerAsns/{peerAsnName}"; diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnResource.cs index 0caab71608b9c..5c315639c6fef 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredAsnResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Peering public partial class PeeringRegisteredAsnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The peeringName. + /// The registeredAsnName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string peeringName, string registeredAsnName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}"; diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixResource.cs index 52797cf0e34d7..e8e458f3787a1 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringRegisteredPrefixResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Peering public partial class PeeringRegisteredPrefixResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The peeringName. + /// The registeredPrefixName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string peeringName, string registeredPrefixName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}"; diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringResource.cs index 127769602746b..ef4fe36b39a95 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Peering public partial class PeeringResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The peeringName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string peeringName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}"; @@ -102,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PeeringRegisteredAsnResources and their operations over a PeeringRegisteredAsnResource. public virtual PeeringRegisteredAsnCollection GetPeeringRegisteredAsns() { - return GetCachedClient(Client => new PeeringRegisteredAsnCollection(Client, Id)); + return GetCachedClient(client => new PeeringRegisteredAsnCollection(client, Id)); } /// @@ -120,8 +123,8 @@ public virtual PeeringRegisteredAsnCollection GetPeeringRegisteredAsns() /// /// The name of the registered ASN. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPeeringRegisteredAsnAsync(string registeredAsnName, CancellationToken cancellationToken = default) { @@ -143,8 +146,8 @@ public virtual async Task> GetPeeringRegi /// /// The name of the registered ASN. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPeeringRegisteredAsn(string registeredAsnName, CancellationToken cancellationToken = default) { @@ -155,7 +158,7 @@ public virtual Response GetPeeringRegisteredAsn(st /// An object representing collection of PeeringRegisteredPrefixResources and their operations over a PeeringRegisteredPrefixResource. public virtual PeeringRegisteredPrefixCollection GetPeeringRegisteredPrefixes() { - return GetCachedClient(Client => new PeeringRegisteredPrefixCollection(Client, Id)); + return GetCachedClient(client => new PeeringRegisteredPrefixCollection(client, Id)); } /// @@ -173,8 +176,8 @@ public virtual PeeringRegisteredPrefixCollection GetPeeringRegisteredPrefixes() /// /// The name of the registered prefix. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPeeringRegisteredPrefixAsync(string registeredPrefixName, CancellationToken cancellationToken = default) { @@ -196,8 +199,8 @@ public virtual async Task> GetPeeringR /// /// The name of the registered prefix. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPeeringRegisteredPrefix(string registeredPrefixName, CancellationToken cancellationToken = default) { diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixResource.cs index 556bffd0ab62a..65935349a5f69 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServicePrefixResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Peering public partial class PeeringServicePrefixResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The peeringServiceName. + /// The prefixName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string peeringServiceName, string prefixName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}"; diff --git a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceResource.cs index ef48ad4f0e6ff..39ad4c5faf38a 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Peering public partial class PeeringServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The peeringServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string peeringServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ConnectionMonitorTestResources and their operations over a ConnectionMonitorTestResource. public virtual ConnectionMonitorTestCollection GetConnectionMonitorTests() { - return GetCachedClient(Client => new ConnectionMonitorTestCollection(Client, Id)); + return GetCachedClient(client => new ConnectionMonitorTestCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ConnectionMonitorTestCollection GetConnectionMonitorTests() /// /// The name of the connection monitor test. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetConnectionMonitorTestAsync(string connectionMonitorTestName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetConnection /// /// The name of the connection monitor test. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetConnectionMonitorTest(string connectionMonitorTestName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetConnectionMonitorTest( /// An object representing collection of PeeringServicePrefixResources and their operations over a PeeringServicePrefixResource. public virtual PeeringServicePrefixCollection GetPeeringServicePrefixes() { - return GetCachedClient(Client => new PeeringServicePrefixCollection(Client, Id)); + return GetCachedClient(client => new PeeringServicePrefixCollection(client, Id)); } /// @@ -165,8 +168,8 @@ public virtual PeeringServicePrefixCollection GetPeeringServicePrefixes() /// The name of the prefix. /// The properties to be expanded. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPeeringServicePrefixAsync(string prefixName, string expand = null, CancellationToken cancellationToken = default) { @@ -189,8 +192,8 @@ public virtual async Task> GetPeeringServ /// The name of the prefix. /// The properties to be expanded. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPeeringServicePrefix(string prefixName, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/api/Azure.ResourceManager.PolicyInsights.netstandard2.0.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/api/Azure.ResourceManager.PolicyInsights.netstandard2.0.cs index 3194b3c062613..511c17b3ec9ae 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/api/Azure.ResourceManager.PolicyInsights.netstandard2.0.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/api/Azure.ResourceManager.PolicyInsights.netstandard2.0.cs @@ -211,6 +211,145 @@ protected PolicyRemediationResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.PolicyInsights.PolicyRemediationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + public partial class MockablePolicyInsightsArmClient : Azure.ResourceManager.ArmResource + { + protected MockablePolicyInsightsArmClient() { } + public virtual Azure.Response GetPolicyAttestation(Azure.Core.ResourceIdentifier scope, string attestationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPolicyAttestationAsync(Azure.Core.ResourceIdentifier scope, string attestationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PolicyInsights.PolicyAttestationResource GetPolicyAttestationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PolicyInsights.PolicyAttestationCollection GetPolicyAttestations(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetPolicyEventQueryResults(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyEventQueryResultsAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PolicyInsights.PolicyMetadataResource GetPolicyMetadataResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetPolicyRemediation(Azure.Core.ResourceIdentifier scope, string remediationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPolicyRemediationAsync(Azure.Core.ResourceIdentifier scope, string remediationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PolicyInsights.PolicyRemediationResource GetPolicyRemediationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PolicyInsights.PolicyRemediationCollection GetPolicyRemediations(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetPolicyStateQueryResults(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyStateQueryResultsAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyTrackedResourceQueryResults(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizePolicyStates(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizePolicyStatesAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePolicyInsightsManagementGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePolicyInsightsManagementGroupResource() { } + public virtual Azure.Response CheckPolicyRestrictions(Azure.ResourceManager.PolicyInsights.Models.CheckManagementGroupPolicyRestrictionsContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPolicyRestrictionsAsync(Azure.ResourceManager.PolicyInsights.Models.CheckManagementGroupPolicyRestrictionsContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyEventQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyEventQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyStateQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyStateQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyTrackedResourceQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizePolicyStates(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizePolicyStatesAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePolicyInsightsPolicyAssignmentResource : Azure.ResourceManager.ArmResource + { + protected MockablePolicyInsightsPolicyAssignmentResource() { } + public virtual Azure.Pageable GetPolicyEventQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyEventQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyStateQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyStateQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizePolicyStates(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizePolicyStatesAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePolicyInsightsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePolicyInsightsResourceGroupResource() { } + public virtual Azure.Response CheckPolicyRestrictions(Azure.ResourceManager.PolicyInsights.Models.CheckPolicyRestrictionsContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPolicyRestrictionsAsync(Azure.ResourceManager.PolicyInsights.Models.CheckPolicyRestrictionsContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyEventQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyEventQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyStateQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyStateQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyTrackedResourceQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEvents(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEventsAsync(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStates(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStatesAsync(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizeForResourceGroupLevelPolicyAssignmentPolicyStates(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizeForResourceGroupLevelPolicyAssignmentPolicyStatesAsync(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizePolicyStates(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizePolicyStatesAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation TriggerPolicyStateEvaluation(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task TriggerPolicyStateEvaluationAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePolicyInsightsSubscriptionPolicyDefinitionResource : Azure.ResourceManager.ArmResource + { + protected MockablePolicyInsightsSubscriptionPolicyDefinitionResource() { } + public virtual Azure.Pageable GetPolicyEventQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyEventQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyStateQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyStateQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizePolicyStates(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizePolicyStatesAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePolicyInsightsSubscriptionPolicySetDefinitionResource : Azure.ResourceManager.ArmResource + { + protected MockablePolicyInsightsSubscriptionPolicySetDefinitionResource() { } + public virtual Azure.Pageable GetPolicyEventQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyEventQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyStateQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyStateQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizePolicyStates(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizePolicyStatesAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePolicyInsightsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockablePolicyInsightsSubscriptionResource() { } + public virtual Azure.Response CheckPolicyRestrictions(Azure.ResourceManager.PolicyInsights.Models.CheckPolicyRestrictionsContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPolicyRestrictionsAsync(Azure.ResourceManager.PolicyInsights.Models.CheckPolicyRestrictionsContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyEventQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyEventQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyStateQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyStateQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPolicyTrackedResourceQueryResults(Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyTrackedResourceType policyTrackedResourceType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueryResultsForPolicyDefinitionPolicyEvents(string policyDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueryResultsForPolicyDefinitionPolicyEventsAsync(string policyDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueryResultsForPolicyDefinitionPolicyStates(string policyDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueryResultsForPolicyDefinitionPolicyStatesAsync(string policyDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueryResultsForPolicySetDefinitionPolicyEvents(string policySetDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueryResultsForPolicySetDefinitionPolicyEventsAsync(string policySetDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueryResultsForPolicySetDefinitionPolicyStates(string policySetDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueryResultsForPolicySetDefinitionPolicyStatesAsync(string policySetDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEvents(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEventsAsync(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyEventType policyEventType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStates(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStatesAsync(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateType policyStateType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizeForPolicyDefinitionPolicyStates(string policyDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizeForPolicyDefinitionPolicyStatesAsync(string policyDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizeForPolicySetDefinitionPolicyStates(string policySetDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizeForPolicySetDefinitionPolicyStatesAsync(string policySetDefinitionName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizeForSubscriptionLevelPolicyAssignmentPolicyStates(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizeForSubscriptionLevelPolicyAssignmentPolicyStatesAsync(string policyAssignmentName, Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable SummarizePolicyStates(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable SummarizePolicyStatesAsync(Azure.ResourceManager.PolicyInsights.Models.PolicyStateSummaryType policyStateSummaryType, Azure.ResourceManager.PolicyInsights.Models.PolicyQuerySettings policyQuerySettings = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation TriggerPolicyStateEvaluation(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task TriggerPolicyStateEvaluationAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePolicyInsightsTenantResource : Azure.ResourceManager.ArmResource + { + protected MockablePolicyInsightsTenantResource() { } + public virtual Azure.ResourceManager.PolicyInsights.PolicyMetadataCollection GetAllPolicyMetadata() { throw null; } + public virtual Azure.Response GetPolicyMetadata(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPolicyMetadataAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class PolicyInsightsResourceGroupMockingExtension : Azure.ResourceManager.ArmResource + { + public PolicyInsightsResourceGroupMockingExtension() { } + } + public partial class PolicyInsightsSubscriptionMockingExtension : Azure.ResourceManager.ArmResource + { + public PolicyInsightsSubscriptionMockingExtension() { } + } +} namespace Azure.ResourceManager.PolicyInsights.Models { public static partial class ArmPolicyInsightsModelFactory diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsPolicyAssignmentResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsPolicyAssignmentResource.cs new file mode 100644 index 0000000000000..d08082009acde --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsPolicyAssignmentResource.cs @@ -0,0 +1,415 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to PolicyAssignmentResource. + public partial class MockablePolicyInsightsPolicyAssignmentResource : ArmResource + { + private ClientDiagnostics _policyEventsClientDiagnostics; + private PolicyEventsRestOperations _policyEventsRestClient; + private ClientDiagnostics _policyStatesClientDiagnostics; + private PolicyStatesRestOperations _policyStatesRestClient; + + private static readonly ResourceType _subscription = new ResourceType("Microsoft.Resources/subscriptions"); + private static readonly ResourceType _resourceGroup = new ResourceType("Microsoft.Resources/resourceGroups"); + + /// Initializes a new instance of the class for mocking. + protected MockablePolicyInsightsPolicyAssignmentResource() + { + } + + /// 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 MockablePolicyInsightsPolicyAssignmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Summarizes policy states for the subscription level or resource group level policy assignment. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// Operation Id: PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// Operation Id: PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.SummarizePolicyStates"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = await PolicyStatesRestClient.SummarizeForResourceGroupLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = await PolicyStatesRestClient.SummarizeForSubscriptionLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// + /// Summarizes policy states for the subscription level or resource group level policy assignment. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// Operation Id: PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// Operation Id: PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.SummarizePolicyStates"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = PolicyStatesRestClient.SummarizeForResourceGroupLevelPolicyAssignment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = PolicyStatesRestClient.SummarizeForSubscriptionLevelPolicyAssignment(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// + /// Queries policy states for the subscription level or resource group level policy assignment. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// Operation Id: PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// Operation Id: PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = await PolicyStatesRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = await PolicyStatesRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = await PolicyStatesRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = await PolicyStatesRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy states for the subscription level or resource group level policy assignment. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// Operation Id: PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// Operation Id: PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = PolicyStatesRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = PolicyStatesRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignment(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = PolicyStatesRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = PolicyStatesRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentNextPage(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy events for the subscription level or resource group level policy assignment. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// Operation Id: PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// Operation Id: PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = await PolicyEventsRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = await PolicyEventsRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = await PolicyEventsRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = await PolicyEventsRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy events for the subscription level or resource group level policy assignment. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// Operation Id: PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// Operation Id: PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = PolicyEventsRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = PolicyEventsRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignment(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == _resourceGroup) + { + var response = PolicyEventsRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else if (Id.Parent.ResourceType == _subscription) + { + var response = PolicyEventsRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentNextPage(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + else + { + throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsSubscriptionPolicyDefinitionResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsSubscriptionPolicyDefinitionResource.cs new file mode 100644 index 0000000000000..45c8749b8d9bd --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsSubscriptionPolicyDefinitionResource.cs @@ -0,0 +1,280 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to SubscriptionPolicyDefinitionResource. + public partial class MockablePolicyInsightsSubscriptionPolicyDefinitionResource : ArmResource + { + private ClientDiagnostics _policyEventsClientDiagnostics; + private PolicyEventsRestOperations _policyEventsRestClient; + private ClientDiagnostics _policyStatesClientDiagnostics; + private PolicyStatesRestOperations _policyStatesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePolicyInsightsSubscriptionPolicyDefinitionResource() + { + } + + /// 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 MockablePolicyInsightsSubscriptionPolicyDefinitionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Summarizes policy states for the subscription level policy definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// Operation Id: PolicyStates_SummarizeForPolicyDefinition + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.SummarizePolicyStates"); + scope.Start(); + try + { + var response = await PolicyStatesRestClient.SummarizeForPolicyDefinitionAsync(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// + /// Summarizes policy states for the subscription level policy definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// Operation Id: PolicyStates_SummarizeForPolicyDefinition + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.SummarizePolicyStates"); + scope.Start(); + try + { + var response = PolicyStatesRestClient.SummarizeForPolicyDefinition(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// + /// Queries policy states for the subscription level policy definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// Operation Id: PolicyStates_ListQueryResultsForPolicyDefinition + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + var response = await PolicyStatesRestClient.ListQueryResultsForPolicyDefinitionAsync(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + var response = await PolicyStatesRestClient.ListQueryResultsForPolicyDefinitionNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy states for the subscription level policy definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// Operation Id: PolicyStates_ListQueryResultsForPolicyDefinition + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + var response = PolicyStatesRestClient.ListQueryResultsForPolicyDefinition(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + var response = PolicyStatesRestClient.ListQueryResultsForPolicyDefinitionNextPage(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy events for the subscription level policy definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// Operation Id: PolicyEvents_ListQueryResultsForPolicyDefinition + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + var response = await PolicyEventsRestClient.ListQueryResultsForPolicyDefinitionAsync(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + var response = await PolicyEventsRestClient.ListQueryResultsForPolicyDefinitionNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy events for the subscription level policy definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// Operation Id: PolicyEvents_ListQueryResultsForPolicyDefinition + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + var response = PolicyEventsRestClient.ListQueryResultsForPolicyDefinition(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + var response = PolicyEventsRestClient.ListQueryResultsForPolicyDefinitionNextPage(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsSubscriptionPolicySetDefinitionResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsSubscriptionPolicySetDefinitionResource.cs new file mode 100644 index 0000000000000..32583b73260b9 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/MockablePolicyInsightsSubscriptionPolicySetDefinitionResource.cs @@ -0,0 +1,280 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to SubscriptionPolicySetDefinition. + public partial class MockablePolicyInsightsSubscriptionPolicySetDefinitionResource : ArmResource + { + private ClientDiagnostics _policyEventsClientDiagnostics; + private PolicyEventsRestOperations _policyEventsRestClient; + private ClientDiagnostics _policyStatesClientDiagnostics; + private PolicyStatesRestOperations _policyStatesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePolicyInsightsSubscriptionPolicySetDefinitionResource() + { + } + + /// 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 MockablePolicyInsightsSubscriptionPolicySetDefinitionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Summarizes policy states for the subscription level policy set definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// Operation Id: PolicyStates_SummarizeForPolicySetDefinition + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.SummarizePolicyStates"); + scope.Start(); + try + { + var response = await PolicyStatesRestClient.SummarizeForPolicySetDefinitionAsync(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + } + + /// + /// Summarizes policy states for the subscription level policy set definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// Operation Id: PolicyStates_SummarizeForPolicySetDefinition + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.SummarizePolicyStates"); + scope.Start(); + try + { + var response = PolicyStatesRestClient.SummarizeForPolicySetDefinition(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + } + + /// + /// Queries policy states for the subscription level policy set definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// Operation Id: PolicyStates_ListQueryResultsForPolicySetDefinition + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + var response = await PolicyStatesRestClient.ListQueryResultsForPolicySetDefinitionAsync(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + var response = await PolicyStatesRestClient.ListQueryResultsForPolicySetDefinitionNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy states for the subscription level policy set definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// Operation Id: PolicyStates_ListQueryResultsForPolicySetDefinition + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + var response = PolicyStatesRestClient.ListQueryResultsForPolicySetDefinition(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); + scope.Start(); + try + { + var response = PolicyStatesRestClient.ListQueryResultsForPolicySetDefinitionNextPage(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy events for the subscription level policy set definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// Operation Id: PolicyEvents_ListQueryResultsForPolicySetDefinition + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + var response = await PolicyEventsRestClient.ListQueryResultsForPolicySetDefinitionAsync(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + var response = await PolicyEventsRestClient.ListQueryResultsForPolicySetDefinitionNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Queries policy events for the subscription level policy set definition. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// Operation Id: PolicyEvents_ListQueryResultsForPolicySetDefinition + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + var response = PolicyEventsRestClient.ListQueryResultsForPolicySetDefinition(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); + scope.Start(); + try + { + var response = PolicyEventsRestClient.ListQueryResultsForPolicySetDefinitionNextPage(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyAssignmentResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyAssignmentResourceExtensionClient.cs deleted file mode 100644 index fb4b70ac97e95..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyAssignmentResourceExtensionClient.cs +++ /dev/null @@ -1,415 +0,0 @@ -// 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.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to PolicyAssignmentResource. - internal partial class PolicyAssignmentResourceExtensionClient : ArmResource - { - private ClientDiagnostics _policyEventsClientDiagnostics; - private PolicyEventsRestOperations _policyEventsRestClient; - private ClientDiagnostics _policyStatesClientDiagnostics; - private PolicyStatesRestOperations _policyStatesRestClient; - - private static readonly ResourceType _subscription = new ResourceType("Microsoft.Resources/subscriptions"); - private static readonly ResourceType _resourceGroup = new ResourceType("Microsoft.Resources/resourceGroups"); - - /// Initializes a new instance of the class for mocking. - protected PolicyAssignmentResourceExtensionClient() - { - } - - /// 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 PolicyAssignmentResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Summarizes policy states for the subscription level or resource group level policy assignment. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// Operation Id: PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// Operation Id: PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.SummarizePolicyStates"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = await PolicyStatesRestClient.SummarizeForResourceGroupLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = await PolicyStatesRestClient.SummarizeForSubscriptionLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); - } - - /// - /// Summarizes policy states for the subscription level or resource group level policy assignment. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// Operation Id: PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// Operation Id: PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.SummarizePolicyStates"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = PolicyStatesRestClient.SummarizeForResourceGroupLevelPolicyAssignment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = PolicyStatesRestClient.SummarizeForSubscriptionLevelPolicyAssignment(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); - } - - /// - /// Queries policy states for the subscription level or resource group level policy assignment. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// Operation Id: PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// Operation Id: PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = await PolicyStatesRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = await PolicyStatesRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = await PolicyStatesRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = await PolicyStatesRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy states for the subscription level or resource group level policy assignment. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// Operation Id: PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// Operation Id: PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = PolicyStatesRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = PolicyStatesRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignment(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = PolicyStatesRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = PolicyStatesRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentNextPage(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy events for the subscription level or resource group level policy assignment. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// Operation Id: PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// Operation Id: PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = await PolicyEventsRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = await PolicyEventsRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentAsync(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = await PolicyEventsRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = await PolicyEventsRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy events for the subscription level or resource group level policy assignment. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// Operation Id: PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// Operation Id: PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = PolicyEventsRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = PolicyEventsRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignment(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("PolicyAssignmentResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - if (Id.Parent.ResourceType == _resourceGroup) - { - var response = PolicyEventsRestClient.ListQueryResultsForResourceGroupLevelPolicyAssignmentNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else if (Id.Parent.ResourceType == _subscription) - { - var response = PolicyEventsRestClient.ListQueryResultsForSubscriptionLevelPolicyAssignmentNextPage(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - else - { - throw new InvalidOperationException("This method can only execute against subscription level or resource group level policy assignment."); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsExtensions.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsExtensions.cs index 88d72157e923e..8430a4c45acef 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsExtensions.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsExtensions.cs @@ -3,11 +3,9 @@ #nullable disable -using System; -using System.Runtime.CompilerServices; using System.Threading; -using System.Threading.Tasks; using Azure.Core; +using Azure.ResourceManager.PolicyInsights.Mocking; using Azure.ResourceManager.PolicyInsights.Models; using Azure.ResourceManager.Resources; @@ -43,13 +41,9 @@ namespace Azure.ResourceManager.PolicyInsights [CodeGenSuppress("SummarizeForSubscriptionLevelPolicyAssignmentPolicyStatesAsync", typeof(SubscriptionResource), typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] public static partial class PolicyInsightsExtensions { - private static PolicyAssignmentResourceExtensionClient GetExtensionClient(PolicyAssignmentResource policyAssignmentResource) + private static MockablePolicyInsightsPolicyAssignmentResource GetMockablePolicyInsightsPolicyAssignmentResource(ArmResource resource) { - return policyAssignmentResource.GetCachedClient((client) => - { - return new PolicyAssignmentResourceExtensionClient(client, policyAssignmentResource.Id); - } - ); + return resource.GetCachedClient(client => new MockablePolicyInsightsPolicyAssignmentResource(client, resource.Id)); } /// @@ -72,7 +66,7 @@ private static PolicyAssignmentResourceExtensionClient GetExtensionClient(Policy /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable SummarizePolicyStatesAsync(this PolicyAssignmentResource policyAssignmentResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(policyAssignmentResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsPolicyAssignmentResource(policyAssignmentResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -95,7 +89,7 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Polic /// A collection of that may take multiple service requests to iterate over. public static Pageable SummarizePolicyStates(this PolicyAssignmentResource policyAssignmentResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(policyAssignmentResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsPolicyAssignmentResource(policyAssignmentResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -118,7 +112,7 @@ public static Pageable SummarizePolicyStates(this PolicyAssignmen /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyStateQueryResultsAsync(this PolicyAssignmentResource policyAssignmentResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(policyAssignmentResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsPolicyAssignmentResource(policyAssignmentResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -141,7 +135,7 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Po /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyStateQueryResults(this PolicyAssignmentResource policyAssignmentResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(policyAssignmentResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsPolicyAssignmentResource(policyAssignmentResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -164,7 +158,7 @@ public static Pageable GetPolicyStateQueryResults(this PolicyAssign /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyEventQueryResultsAsync(this PolicyAssignmentResource policyAssignmentResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(policyAssignmentResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsPolicyAssignmentResource(policyAssignmentResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -187,16 +181,12 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Po /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyEventQueryResults(this PolicyAssignmentResource policyAssignmentResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(policyAssignmentResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsPolicyAssignmentResource(policyAssignmentResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); } - private static SubscriptionPolicyDefinitionResourceExtensionClient GetExtensionClient(SubscriptionPolicyDefinitionResource subscriptionPolicyDefinitionResource) + private static MockablePolicyInsightsSubscriptionPolicyDefinitionResource GetMockablePolicyInsightsSubscriptionPolicyDefinitionResource(ArmResource resource) { - return subscriptionPolicyDefinitionResource.GetCachedClient((client) => - { - return new SubscriptionPolicyDefinitionResourceExtensionClient(client, subscriptionPolicyDefinitionResource.Id); - } - ); + return resource.GetCachedClient(client => new MockablePolicyInsightsSubscriptionPolicyDefinitionResource(client, resource.Id)); } /// @@ -219,7 +209,7 @@ private static SubscriptionPolicyDefinitionResourceExtensionClient GetExtensionC /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable SummarizePolicyStatesAsync(this SubscriptionPolicyDefinitionResource subscriptionPolicyDefinitionResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicyDefinitionResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicyDefinitionResource(subscriptionPolicyDefinitionResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -242,7 +232,7 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Subsc /// A collection of that may take multiple service requests to iterate over. public static Pageable SummarizePolicyStates(this SubscriptionPolicyDefinitionResource subscriptionPolicyDefinitionResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicyDefinitionResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicyDefinitionResource(subscriptionPolicyDefinitionResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -265,7 +255,7 @@ public static Pageable SummarizePolicyStates(this SubscriptionPol /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyStateQueryResultsAsync(this SubscriptionPolicyDefinitionResource subscriptionPolicyDefinitionResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicyDefinitionResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicyDefinitionResource(subscriptionPolicyDefinitionResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -288,7 +278,7 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyStateQueryResults(this SubscriptionPolicyDefinitionResource subscriptionPolicyDefinitionResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicyDefinitionResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicyDefinitionResource(subscriptionPolicyDefinitionResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -311,7 +301,7 @@ public static Pageable GetPolicyStateQueryResults(this Subscription /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyEventQueryResultsAsync(this SubscriptionPolicyDefinitionResource subscriptionPolicyDefinitionResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicyDefinitionResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicyDefinitionResource(subscriptionPolicyDefinitionResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -334,16 +324,12 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyEventQueryResults(this SubscriptionPolicyDefinitionResource subscriptionPolicyDefinitionResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicyDefinitionResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicyDefinitionResource(subscriptionPolicyDefinitionResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); } - private static SubscriptionPolicySetDefinitionResourceExtensionClient GetExtensionClient(SubscriptionPolicySetDefinitionResource subscriptionPolicySetDefinitionResource) + private static MockablePolicyInsightsSubscriptionPolicySetDefinitionResource GetMockablePolicyInsightsSubscriptionPolicySetDefinitionResource(ArmResource resource) { - return subscriptionPolicySetDefinitionResource.GetCachedClient((client) => - { - return new SubscriptionPolicySetDefinitionResourceExtensionClient(client, subscriptionPolicySetDefinitionResource.Id); - } - ); + return resource.GetCachedClient(client => new MockablePolicyInsightsSubscriptionPolicySetDefinitionResource(client, resource.Id)); } /// @@ -366,7 +352,7 @@ private static SubscriptionPolicySetDefinitionResourceExtensionClient GetExtensi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable SummarizePolicyStatesAsync(this SubscriptionPolicySetDefinitionResource subscriptionPolicySetDefinitionResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicySetDefinitionResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicySetDefinitionResource(subscriptionPolicySetDefinitionResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -389,7 +375,7 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Subsc /// A collection of that may take multiple service requests to iterate over. public static Pageable SummarizePolicyStates(this SubscriptionPolicySetDefinitionResource subscriptionPolicySetDefinitionResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicySetDefinitionResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicySetDefinitionResource(subscriptionPolicySetDefinitionResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -412,7 +398,7 @@ public static Pageable SummarizePolicyStates(this SubscriptionPol /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyStateQueryResultsAsync(this SubscriptionPolicySetDefinitionResource subscriptionPolicySetDefinitionResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicySetDefinitionResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicySetDefinitionResource(subscriptionPolicySetDefinitionResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -435,7 +421,7 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyStateQueryResults(this SubscriptionPolicySetDefinitionResource subscriptionPolicySetDefinitionResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicySetDefinitionResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicySetDefinitionResource(subscriptionPolicySetDefinitionResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -458,7 +444,7 @@ public static Pageable GetPolicyStateQueryResults(this Subscription /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyEventQueryResultsAsync(this SubscriptionPolicySetDefinitionResource subscriptionPolicySetDefinitionResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicySetDefinitionResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicySetDefinitionResource(subscriptionPolicySetDefinitionResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -481,7 +467,7 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyEventQueryResults(this SubscriptionPolicySetDefinitionResource subscriptionPolicySetDefinitionResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionPolicySetDefinitionResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionPolicySetDefinitionResource(subscriptionPolicySetDefinitionResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); } } } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsResourceGroupMockingExtension.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsResourceGroupMockingExtension.cs new file mode 100644 index 0000000000000..f3f39e3bb5eda --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsResourceGroupMockingExtension.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Threading; +using Azure.Core; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + [CodeGenSuppress("GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEvents", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEventsAsync", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStates", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStatesAsync", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("SummarizeForResourceGroupLevelPolicyAssignmentPolicyStates", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("SummarizeForResourceGroupLevelPolicyAssignmentPolicyStatesAsync", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + public partial class PolicyInsightsResourceGroupMockingExtension : ArmResource + { + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsSubscriptionMockingExtension.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsSubscriptionMockingExtension.cs new file mode 100644 index 0000000000000..953f250813441 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/PolicyInsightsSubscriptionMockingExtension.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Threading; +using Azure.Core; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + [CodeGenSuppress("GetQueryResultsForPolicyDefinitionPolicyEvents", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForPolicyDefinitionPolicyEventsAsync", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForPolicySetDefinitionPolicyEvents", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForPolicySetDefinitionPolicyEventsAsync", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEvents", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEventsAsync", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForPolicyDefinitionPolicyStates", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForPolicyDefinitionPolicyStatesAsync", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForPolicySetDefinitionPolicyStates", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForPolicySetDefinitionPolicyStatesAsync", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStates", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStatesAsync", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("SummarizeForPolicyDefinitionPolicyStates", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("SummarizeForPolicyDefinitionPolicyStatesAsync", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("SummarizeForPolicySetDefinitionPolicyStates", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("SummarizeForPolicySetDefinitionPolicyStatesAsync", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("SummarizeForSubscriptionLevelPolicyAssignmentPolicyStates", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + [CodeGenSuppress("SummarizeForSubscriptionLevelPolicyAssignmentPolicyStatesAsync", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] + public partial class PolicyInsightsSubscriptionMockingExtension : ArmResource + { + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index e94574364e4cd..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System.Threading; -using Azure.Core; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to ResourceGroupResource. - [CodeGenSuppress("GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEvents", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEventsAsync", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStates", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStatesAsync", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("SummarizeForResourceGroupLevelPolicyAssignmentPolicyStates", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("SummarizeForResourceGroupLevelPolicyAssignmentPolicyStatesAsync", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionPolicyDefinitionResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionPolicyDefinitionResourceExtensionClient.cs deleted file mode 100644 index 5dc66f87d4aed..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionPolicyDefinitionResourceExtensionClient.cs +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Globalization; -using System.Net; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to SubscriptionPolicyDefinitionResource. - internal partial class SubscriptionPolicyDefinitionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _policyEventsClientDiagnostics; - private PolicyEventsRestOperations _policyEventsRestClient; - private ClientDiagnostics _policyStatesClientDiagnostics; - private PolicyStatesRestOperations _policyStatesRestClient; - - /// Initializes a new instance of the class for mocking. - protected SubscriptionPolicyDefinitionResourceExtensionClient() - { - } - - /// 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 SubscriptionPolicyDefinitionResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Summarizes policy states for the subscription level policy definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// Operation Id: PolicyStates_SummarizeForPolicyDefinition - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.SummarizePolicyStates"); - scope.Start(); - try - { - var response = await PolicyStatesRestClient.SummarizeForPolicyDefinitionAsync(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); - } - - /// - /// Summarizes policy states for the subscription level policy definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// Operation Id: PolicyStates_SummarizeForPolicyDefinition - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.SummarizePolicyStates"); - scope.Start(); - try - { - var response = PolicyStatesRestClient.SummarizeForPolicyDefinition(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); - } - - /// - /// Queries policy states for the subscription level policy definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// Operation Id: PolicyStates_ListQueryResultsForPolicyDefinition - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - var response = await PolicyStatesRestClient.ListQueryResultsForPolicyDefinitionAsync(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - var response = await PolicyStatesRestClient.ListQueryResultsForPolicyDefinitionNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy states for the subscription level policy definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// Operation Id: PolicyStates_ListQueryResultsForPolicyDefinition - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - var response = PolicyStatesRestClient.ListQueryResultsForPolicyDefinition(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - var response = PolicyStatesRestClient.ListQueryResultsForPolicyDefinitionNextPage(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy events for the subscription level policy definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// Operation Id: PolicyEvents_ListQueryResultsForPolicyDefinition - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - var response = await PolicyEventsRestClient.ListQueryResultsForPolicyDefinitionAsync(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - var response = await PolicyEventsRestClient.ListQueryResultsForPolicyDefinitionNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy events for the subscription level policy definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// Operation Id: PolicyEvents_ListQueryResultsForPolicyDefinition - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - var response = PolicyEventsRestClient.ListQueryResultsForPolicyDefinition(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicyDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - var response = PolicyEventsRestClient.ListQueryResultsForPolicyDefinitionNextPage(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionPolicySetDefinitionResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionPolicySetDefinitionResourceExtensionClient.cs deleted file mode 100644 index 781d13565303d..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionPolicySetDefinitionResourceExtensionClient.cs +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Globalization; -using System.Net; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to SubscriptionPolicySetDefinition. - internal partial class SubscriptionPolicySetDefinitionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _policyEventsClientDiagnostics; - private PolicyEventsRestOperations _policyEventsRestClient; - private ClientDiagnostics _policyStatesClientDiagnostics; - private PolicyStatesRestOperations _policyStatesRestClient; - - /// Initializes a new instance of the class for mocking. - protected SubscriptionPolicySetDefinitionResourceExtensionClient() - { - } - - /// 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 SubscriptionPolicySetDefinitionResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Summarizes policy states for the subscription level policy set definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// Operation Id: PolicyStates_SummarizeForPolicySetDefinition - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.SummarizePolicyStates"); - scope.Start(); - try - { - var response = await PolicyStatesRestClient.SummarizeForPolicySetDefinitionAsync(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); - } - - /// - /// Summarizes policy states for the subscription level policy set definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// Operation Id: PolicyStates_SummarizeForPolicySetDefinition - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.SummarizePolicyStates"); - scope.Start(); - try - { - var response = PolicyStatesRestClient.SummarizeForPolicySetDefinition(Id.SubscriptionId, Id.Name, policyStateSummaryType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); - } - - /// - /// Queries policy states for the subscription level policy set definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// Operation Id: PolicyStates_ListQueryResultsForPolicySetDefinition - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - var response = await PolicyStatesRestClient.ListQueryResultsForPolicySetDefinitionAsync(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - var response = await PolicyStatesRestClient.ListQueryResultsForPolicySetDefinitionNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy states for the subscription level policy set definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// Operation Id: PolicyStates_ListQueryResultsForPolicySetDefinition - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - var response = PolicyStatesRestClient.ListQueryResultsForPolicySetDefinition(Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyStateQueryResults"); - scope.Start(); - try - { - var response = PolicyStatesRestClient.ListQueryResultsForPolicySetDefinitionNextPage(nextLink, Id.SubscriptionId, Id.Name, policyStateType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy events for the subscription level policy set definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// Operation Id: PolicyEvents_ListQueryResultsForPolicySetDefinition - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - var response = await PolicyEventsRestClient.ListQueryResultsForPolicySetDefinitionAsync(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - var response = await PolicyEventsRestClient.ListQueryResultsForPolicySetDefinitionNextPageAsync(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Queries policy events for the subscription level policy set definition. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// Operation Id: PolicyEvents_ListQueryResultsForPolicySetDefinition - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - var response = PolicyEventsRestClient.ListQueryResultsForPolicySetDefinition(Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = PolicyEventsClientDiagnostics.CreateScope("SubscriptionPolicySetDefinitionResourceExtensionClient.GetPolicyEventQueryResults"); - scope.Start(); - try - { - var response = PolicyEventsRestClient.ListQueryResultsForPolicySetDefinitionNextPage(nextLink, Id.SubscriptionId, Id.Name, policyEventType, policyQuerySettings, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.ODataNextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index f3fca86d9c7ae..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Customized/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Azure.Core; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to SubscriptionResource. - [CodeGenSuppress("GetQueryResultsForPolicyDefinitionPolicyEvents", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForPolicyDefinitionPolicyEventsAsync", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForPolicySetDefinitionPolicyEvents", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForPolicySetDefinitionPolicyEventsAsync", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEvents", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEventsAsync", typeof(string), typeof(PolicyEventType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForPolicyDefinitionPolicyStates", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForPolicyDefinitionPolicyStatesAsync", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForPolicySetDefinitionPolicyStates", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForPolicySetDefinitionPolicyStatesAsync", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStates", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStatesAsync", typeof(string), typeof(PolicyStateType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("SummarizeForPolicyDefinitionPolicyStates", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("SummarizeForPolicyDefinitionPolicyStatesAsync", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("SummarizeForPolicySetDefinitionPolicyStates", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("SummarizeForPolicySetDefinitionPolicyStatesAsync", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("SummarizeForSubscriptionLevelPolicyAssignmentPolicyStates", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - [CodeGenSuppress("SummarizeForSubscriptionLevelPolicyAssignmentPolicyStatesAsync", typeof(string), typeof(PolicyStateSummaryType), typeof(PolicyQuerySettings), typeof(CancellationToken))] - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 0d3c9db5117bf..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _policyTrackedResourcesClientDiagnostics; - private PolicyTrackedResourcesRestOperations _policyTrackedResourcesRestClient; - private ClientDiagnostics _policyEventsClientDiagnostics; - private PolicyEventsRestOperations _policyEventsRestClient; - private ClientDiagnostics _policyStatesClientDiagnostics; - private PolicyStatesRestOperations _policyStatesRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics PolicyTrackedResourcesClientDiagnostics => _policyTrackedResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyTrackedResourcesRestOperations PolicyTrackedResourcesRestClient => _policyTrackedResourcesRestClient ??= new PolicyTrackedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of PolicyRemediationResources in the ArmResource. - /// An object representing collection of PolicyRemediationResources and their operations over a PolicyRemediationResource. - public virtual PolicyRemediationCollection GetPolicyRemediations() - { - return GetCachedClient(Client => new PolicyRemediationCollection(Client, Id)); - } - - /// Gets a collection of PolicyAttestationResources in the ArmResource. - /// An object representing collection of PolicyAttestationResources and their operations over a PolicyAttestationResource. - public virtual PolicyAttestationCollection GetPolicyAttestations() - { - return GetCachedClient(Client => new PolicyAttestationCollection(Client, Id)); - } - - /// - /// Queries policy tracked resources under the resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyTrackedResources_ListQueryResultsForResource - /// - /// - /// - /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceRequest(Id, policyTrackedResourceType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, Id, policyTrackedResourceType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); - } - - /// - /// Queries policy tracked resources under the resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyTrackedResources_ListQueryResultsForResource - /// - /// - /// - /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyTrackedResourceQueryResults(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceRequest(Id, policyTrackedResourceType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, Id, policyTrackedResourceType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); - } - - /// - /// Queries policy events for the resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// - /// - /// Operation Id - /// PolicyEvents_ListQueryResultsForResource - /// - /// - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceRequest(Id, policyEventType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, Id, policyEventType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy events for the resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// - /// - /// Operation Id - /// PolicyEvents_ListQueryResultsForResource - /// - /// - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceRequest(Id, policyEventType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, Id, policyEventType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy states for the resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyStates_ListQueryResultsForResource - /// - /// - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceRequest(Id, policyStateType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, Id, policyStateType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy states for the resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyStates_ListQueryResultsForResource - /// - /// - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceRequest(Id, policyStateType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, Id, policyStateType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Summarizes policy states for the resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// - /// - /// Operation Id - /// PolicyStates_SummarizeForResource - /// - /// - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceRequest(Id, policyStateSummaryType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.SummarizePolicyStates", "value", null, cancellationToken); - } - - /// - /// Summarizes policy states for the resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// - /// - /// Operation Id - /// PolicyStates_SummarizeForResource - /// - /// - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceRequest(Id, policyStateSummaryType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.SummarizePolicyStates", "value", null, cancellationToken); - } - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs deleted file mode 100644 index aa11be80a77b4..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to ManagementGroupResource. - internal partial class ManagementGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _policyTrackedResourcesClientDiagnostics; - private PolicyTrackedResourcesRestOperations _policyTrackedResourcesRestClient; - private ClientDiagnostics _policyEventsClientDiagnostics; - private PolicyEventsRestOperations _policyEventsRestClient; - private ClientDiagnostics _policyStatesClientDiagnostics; - private PolicyStatesRestOperations _policyStatesRestClient; - private ClientDiagnostics _policyRestrictionsClientDiagnostics; - private PolicyRestrictionsRestOperations _policyRestrictionsRestClient; - - /// Initializes a new instance of the class for mocking. - protected ManagementGroupResourceExtensionClient() - { - } - - /// 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 ManagementGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics PolicyTrackedResourcesClientDiagnostics => _policyTrackedResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyTrackedResourcesRestOperations PolicyTrackedResourcesRestClient => _policyTrackedResourcesRestClient ??= new PolicyTrackedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyRestrictionsClientDiagnostics => _policyRestrictionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyRestrictionsRestOperations PolicyRestrictionsRestClient => _policyRestrictionsRestClient ??= new PolicyRestrictionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Queries policy tracked resources under the management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyTrackedResources_ListQueryResultsForManagementGroup - /// - /// - /// - /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyTrackedResourceType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyTrackedResourceType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "ManagementGroupResourceExtensionClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); - } - - /// - /// Queries policy tracked resources under the management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyTrackedResources_ListQueryResultsForManagementGroup - /// - /// - /// - /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyTrackedResourceQueryResults(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyTrackedResourceType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyTrackedResourceType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "ManagementGroupResourceExtensionClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); - } - - /// - /// Queries policy events for the resources under the management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// - /// - /// Operation Id - /// PolicyEvents_ListQueryResultsForManagementGroup - /// - /// - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyEventType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyEventType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "ManagementGroupResourceExtensionClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy events for the resources under the management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// - /// - /// Operation Id - /// PolicyEvents_ListQueryResultsForManagementGroup - /// - /// - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyEventType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyEventType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "ManagementGroupResourceExtensionClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy states for the resources under the management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyStates_ListQueryResultsForManagementGroup - /// - /// - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyStateType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyStateType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "ManagementGroupResourceExtensionClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy states for the resources under the management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyStates_ListQueryResultsForManagementGroup - /// - /// - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyStateType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyStateType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "ManagementGroupResourceExtensionClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Summarizes policy states for the resources under the management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// - /// - /// Operation Id - /// PolicyStates_SummarizeForManagementGroup - /// - /// - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForManagementGroupRequest(Id.Name, policyStateSummaryType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "ManagementGroupResourceExtensionClient.SummarizePolicyStates", "value", null, cancellationToken); - } - - /// - /// Summarizes policy states for the resources under the management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// - /// - /// Operation Id - /// PolicyStates_SummarizeForManagementGroup - /// - /// - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForManagementGroupRequest(Id.Name, policyStateSummaryType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "ManagementGroupResourceExtensionClient.SummarizePolicyStates", "value", null, cancellationToken); - } - - /// - /// Checks what restrictions Azure Policy will place on resources within a management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions - /// - /// - /// Operation Id - /// PolicyRestrictions_CheckAtManagementGroupScope - /// - /// - /// - /// The check policy restrictions parameters. - /// The cancellation token to use. - public virtual async Task> CheckPolicyRestrictionsAsync(CheckManagementGroupPolicyRestrictionsContent content, CancellationToken cancellationToken = default) - { - using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("ManagementGroupResourceExtensionClient.CheckPolicyRestrictions"); - scope.Start(); - try - { - var response = await PolicyRestrictionsRestClient.CheckAtManagementGroupScopeAsync(Id.Name, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks what restrictions Azure Policy will place on resources within a management group. - /// - /// - /// Request Path - /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions - /// - /// - /// Operation Id - /// PolicyRestrictions_CheckAtManagementGroupScope - /// - /// - /// - /// The check policy restrictions parameters. - /// The cancellation token to use. - public virtual Response CheckPolicyRestrictions(CheckManagementGroupPolicyRestrictionsContent content, CancellationToken cancellationToken = default) - { - using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("ManagementGroupResourceExtensionClient.CheckPolicyRestrictions"); - scope.Start(); - try - { - var response = PolicyRestrictionsRestClient.CheckAtManagementGroupScope(Id.Name, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsArmClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsArmClient.cs new file mode 100644 index 0000000000000..90774928504a5 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsArmClient.cs @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PolicyInsights; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockablePolicyInsightsArmClient : ArmResource + { + private ClientDiagnostics _policyTrackedResourcesClientDiagnostics; + private PolicyTrackedResourcesRestOperations _policyTrackedResourcesRestClient; + private ClientDiagnostics _policyEventsClientDiagnostics; + private PolicyEventsRestOperations _policyEventsRestClient; + private ClientDiagnostics _policyStatesClientDiagnostics; + private PolicyStatesRestOperations _policyStatesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePolicyInsightsArmClient() + { + } + + /// 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 MockablePolicyInsightsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockablePolicyInsightsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics PolicyTrackedResourcesClientDiagnostics => _policyTrackedResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyTrackedResourcesRestOperations PolicyTrackedResourcesRestClient => _policyTrackedResourcesRestClient ??= new PolicyTrackedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PolicyRemediationResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of PolicyRemediationResources and their operations over a PolicyRemediationResource. + public virtual PolicyRemediationCollection GetPolicyRemediations(ResourceIdentifier scope) + { + return new PolicyRemediationCollection(Client, scope); + } + + /// + /// Gets an existing remediation at resource scope. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName} + /// + /// + /// Operation Id + /// Remediations_GetAtResource + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the remediation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPolicyRemediationAsync(ResourceIdentifier scope, string remediationName, CancellationToken cancellationToken = default) + { + return await GetPolicyRemediations(scope).GetAsync(remediationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an existing remediation at resource scope. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName} + /// + /// + /// Operation Id + /// Remediations_GetAtResource + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the remediation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPolicyRemediation(ResourceIdentifier scope, string remediationName, CancellationToken cancellationToken = default) + { + return GetPolicyRemediations(scope).Get(remediationName, cancellationToken); + } + + /// Gets a collection of PolicyAttestationResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of PolicyAttestationResources and their operations over a PolicyAttestationResource. + public virtual PolicyAttestationCollection GetPolicyAttestations(ResourceIdentifier scope) + { + return new PolicyAttestationCollection(Client, scope); + } + + /// + /// Gets an existing attestation at resource scope. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName} + /// + /// + /// Operation Id + /// Attestations_GetAtResource + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the attestation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPolicyAttestationAsync(ResourceIdentifier scope, string attestationName, CancellationToken cancellationToken = default) + { + return await GetPolicyAttestations(scope).GetAsync(attestationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an existing attestation at resource scope. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName} + /// + /// + /// Operation Id + /// Attestations_GetAtResource + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the attestation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPolicyAttestation(ResourceIdentifier scope, string attestationName, CancellationToken cancellationToken = default) + { + return GetPolicyAttestations(scope).Get(attestationName, cancellationToken); + } + + /// + /// Queries policy tracked resources under the resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyTrackedResources_ListQueryResultsForResource + /// + /// + /// + /// The scope to use. + /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(ResourceIdentifier scope, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceRequest(scope, policyTrackedResourceType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, scope, policyTrackedResourceType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "MockablePolicyInsightsArmClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); + } + + /// + /// Queries policy tracked resources under the resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyTrackedResources_ListQueryResultsForResource + /// + /// + /// + /// The scope to use. + /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyTrackedResourceQueryResults(ResourceIdentifier scope, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceRequest(scope, policyTrackedResourceType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, scope, policyTrackedResourceType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "MockablePolicyInsightsArmClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForResource + /// + /// + /// + /// The scope to use. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyEventQueryResultsAsync(ResourceIdentifier scope, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceRequest(scope, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, scope, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsArmClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForResource + /// + /// + /// + /// The scope to use. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyEventQueryResults(ResourceIdentifier scope, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceRequest(scope, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, scope, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsArmClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForResource + /// + /// + /// + /// The scope to use. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyStateQueryResultsAsync(ResourceIdentifier scope, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceRequest(scope, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, scope, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsArmClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForResource + /// + /// + /// + /// The scope to use. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyStateQueryResults(ResourceIdentifier scope, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceRequest(scope, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceNextPageRequest(nextLink, scope, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsArmClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Summarizes policy states for the resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForResource + /// + /// + /// + /// The scope to use. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizePolicyStatesAsync(ResourceIdentifier scope, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceRequest(scope, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsArmClient.SummarizePolicyStates", "value", null, cancellationToken); + } + + /// + /// Summarizes policy states for the resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForResource + /// + /// + /// + /// The scope to use. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizePolicyStates(ResourceIdentifier scope, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceRequest(scope, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsArmClient.SummarizePolicyStates", "value", null, cancellationToken); + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PolicyRemediationResource GetPolicyRemediationResource(ResourceIdentifier id) + { + PolicyRemediationResource.ValidateResourceId(id); + return new PolicyRemediationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PolicyMetadataResource GetPolicyMetadataResource(ResourceIdentifier id) + { + PolicyMetadataResource.ValidateResourceId(id); + return new PolicyMetadataResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PolicyAttestationResource GetPolicyAttestationResource(ResourceIdentifier id) + { + PolicyAttestationResource.ValidateResourceId(id); + return new PolicyAttestationResource(Client, id); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsManagementGroupResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsManagementGroupResource.cs new file mode 100644 index 0000000000000..a3108e21f45e9 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsManagementGroupResource.cs @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PolicyInsights; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to ManagementGroupResource. + public partial class MockablePolicyInsightsManagementGroupResource : ArmResource + { + private ClientDiagnostics _policyTrackedResourcesClientDiagnostics; + private PolicyTrackedResourcesRestOperations _policyTrackedResourcesRestClient; + private ClientDiagnostics _policyEventsClientDiagnostics; + private PolicyEventsRestOperations _policyEventsRestClient; + private ClientDiagnostics _policyStatesClientDiagnostics; + private PolicyStatesRestOperations _policyStatesRestClient; + private ClientDiagnostics _policyRestrictionsClientDiagnostics; + private PolicyRestrictionsRestOperations _policyRestrictionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePolicyInsightsManagementGroupResource() + { + } + + /// 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 MockablePolicyInsightsManagementGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PolicyTrackedResourcesClientDiagnostics => _policyTrackedResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyTrackedResourcesRestOperations PolicyTrackedResourcesRestClient => _policyTrackedResourcesRestClient ??= new PolicyTrackedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyRestrictionsClientDiagnostics => _policyRestrictionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyRestrictionsRestOperations PolicyRestrictionsRestClient => _policyRestrictionsRestClient ??= new PolicyRestrictionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Queries policy tracked resources under the management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyTrackedResources_ListQueryResultsForManagementGroup + /// + /// + /// + /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyTrackedResourceType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyTrackedResourceType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "MockablePolicyInsightsManagementGroupResource.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); + } + + /// + /// Queries policy tracked resources under the management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyTrackedResources_ListQueryResultsForManagementGroup + /// + /// + /// + /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyTrackedResourceQueryResults(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyTrackedResourceType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyTrackedResourceType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "MockablePolicyInsightsManagementGroupResource.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resources under the management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForManagementGroup + /// + /// + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsManagementGroupResource.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resources under the management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForManagementGroup + /// + /// + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsManagementGroupResource.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resources under the management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForManagementGroup + /// + /// + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsManagementGroupResource.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resources under the management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForManagementGroup + /// + /// + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForManagementGroupRequest(Id.Name, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForManagementGroupNextPageRequest(nextLink, Id.Name, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsManagementGroupResource.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Summarizes policy states for the resources under the management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForManagementGroup + /// + /// + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForManagementGroupRequest(Id.Name, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsManagementGroupResource.SummarizePolicyStates", "value", null, cancellationToken); + } + + /// + /// Summarizes policy states for the resources under the management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForManagementGroup + /// + /// + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForManagementGroupRequest(Id.Name, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsManagementGroupResource.SummarizePolicyStates", "value", null, cancellationToken); + } + + /// + /// Checks what restrictions Azure Policy will place on resources within a management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions + /// + /// + /// Operation Id + /// PolicyRestrictions_CheckAtManagementGroupScope + /// + /// + /// + /// The check policy restrictions parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPolicyRestrictionsAsync(CheckManagementGroupPolicyRestrictionsContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("MockablePolicyInsightsManagementGroupResource.CheckPolicyRestrictions"); + scope.Start(); + try + { + var response = await PolicyRestrictionsRestClient.CheckAtManagementGroupScopeAsync(Id.Name, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks what restrictions Azure Policy will place on resources within a management group. + /// + /// + /// Request Path + /// /providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions + /// + /// + /// Operation Id + /// PolicyRestrictions_CheckAtManagementGroupScope + /// + /// + /// + /// The check policy restrictions parameters. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPolicyRestrictions(CheckManagementGroupPolicyRestrictionsContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("MockablePolicyInsightsManagementGroupResource.CheckPolicyRestrictions"); + scope.Start(); + try + { + var response = PolicyRestrictionsRestClient.CheckAtManagementGroupScope(Id.Name, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsResourceGroupResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsResourceGroupResource.cs new file mode 100644 index 0000000000000..2dd7ae6e283c6 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsResourceGroupResource.cs @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PolicyInsights; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockablePolicyInsightsResourceGroupResource : ArmResource + { + private ClientDiagnostics _policyTrackedResourcesClientDiagnostics; + private PolicyTrackedResourcesRestOperations _policyTrackedResourcesRestClient; + private ClientDiagnostics _policyEventsClientDiagnostics; + private PolicyEventsRestOperations _policyEventsRestClient; + private ClientDiagnostics _policyStatesClientDiagnostics; + private PolicyStatesRestOperations _policyStatesRestClient; + private ClientDiagnostics _policyRestrictionsClientDiagnostics; + private PolicyRestrictionsRestOperations _policyRestrictionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePolicyInsightsResourceGroupResource() + { + } + + /// 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 MockablePolicyInsightsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PolicyTrackedResourcesClientDiagnostics => _policyTrackedResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyTrackedResourcesRestOperations PolicyTrackedResourcesRestClient => _policyTrackedResourcesRestClient ??= new PolicyTrackedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyRestrictionsClientDiagnostics => _policyRestrictionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyRestrictionsRestOperations PolicyRestrictionsRestClient => _policyRestrictionsRestClient ??= new PolicyRestrictionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Queries policy tracked resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyTrackedResources_ListQueryResultsForResourceGroup + /// + /// + /// + /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyTrackedResourceType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyTrackedResourceType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); + } + + /// + /// Queries policy tracked resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyTrackedResources_ListQueryResultsForResourceGroup + /// + /// + /// + /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyTrackedResourceQueryResults(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyTrackedResourceType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyTrackedResourceType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForResourceGroup + /// + /// + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForResourceGroup + /// + /// + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEventsAsync(string policyAssignmentName, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEvents", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEvents(string policyAssignmentName, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyEvents", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForResourceGroup + /// + /// + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForResourceGroup + /// + /// + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Summarizes policy states for the resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForResourceGroup + /// + /// + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.SummarizePolicyStates", "value", null, cancellationToken); + } + + /// + /// Summarizes policy states for the resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForResourceGroup + /// + /// + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.SummarizePolicyStates", "value", null, cancellationToken); + } + + /// + /// Triggers a policy evaluation scan for all the resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation + /// + /// + /// Operation Id + /// PolicyStates_TriggerResourceGroupEvaluation + /// + /// + /// + /// 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 TriggerPolicyStateEvaluationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("MockablePolicyInsightsResourceGroupResource.TriggerPolicyStateEvaluation"); + scope.Start(); + try + { + var response = await PolicyStatesRestClient.TriggerResourceGroupEvaluationAsync(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken).ConfigureAwait(false); + var operation = new PolicyInsightsArmOperation(PolicyStatesClientDiagnostics, Pipeline, PolicyStatesRestClient.CreateTriggerResourceGroupEvaluationRequest(Id.SubscriptionId, Id.ResourceGroupName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers a policy evaluation scan for all the resources under the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation + /// + /// + /// Operation Id + /// PolicyStates_TriggerResourceGroupEvaluation + /// + /// + /// + /// 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 TriggerPolicyStateEvaluation(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("MockablePolicyInsightsResourceGroupResource.TriggerPolicyStateEvaluation"); + scope.Start(); + try + { + var response = PolicyStatesRestClient.TriggerResourceGroupEvaluation(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken); + var operation = new PolicyInsightsArmOperation(PolicyStatesClientDiagnostics, Pipeline, PolicyStatesRestClient.CreateTriggerResourceGroupEvaluationRequest(Id.SubscriptionId, Id.ResourceGroupName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Queries policy states for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStatesAsync(string policyAssignmentName, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStates", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStates(string policyAssignmentName, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupLevelPolicyAssignmentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.GetQueryResultsForResourceGroupLevelPolicyAssignmentPolicyStates", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Summarizes policy states for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizeForResourceGroupLevelPolicyAssignmentPolicyStatesAsync(string policyAssignmentName, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceGroupLevelPolicyAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.SummarizeForResourceGroupLevelPolicyAssignmentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Summarizes policy states for the resource group level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForResourceGroupLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizeForResourceGroupLevelPolicyAssignmentPolicyStates(string policyAssignmentName, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceGroupLevelPolicyAssignmentRequest(Id.SubscriptionId, Id.ResourceGroupName, policyAssignmentName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsResourceGroupResource.SummarizeForResourceGroupLevelPolicyAssignmentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the resource group the resource will be created in is already known. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions + /// + /// + /// Operation Id + /// PolicyRestrictions_CheckAtResourceGroupScope + /// + /// + /// + /// The check policy restrictions parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPolicyRestrictionsAsync(CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("MockablePolicyInsightsResourceGroupResource.CheckPolicyRestrictions"); + scope.Start(); + try + { + var response = await PolicyRestrictionsRestClient.CheckAtResourceGroupScopeAsync(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the resource group the resource will be created in is already known. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions + /// + /// + /// Operation Id + /// PolicyRestrictions_CheckAtResourceGroupScope + /// + /// + /// + /// The check policy restrictions parameters. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPolicyRestrictions(CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("MockablePolicyInsightsResourceGroupResource.CheckPolicyRestrictions"); + scope.Start(); + try + { + var response = PolicyRestrictionsRestClient.CheckAtResourceGroupScope(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsSubscriptionResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsSubscriptionResource.cs new file mode 100644 index 0000000000000..07f8d529f0db0 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsSubscriptionResource.cs @@ -0,0 +1,902 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PolicyInsights; +using Azure.ResourceManager.PolicyInsights.Models; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockablePolicyInsightsSubscriptionResource : ArmResource + { + private ClientDiagnostics _policyTrackedResourcesClientDiagnostics; + private PolicyTrackedResourcesRestOperations _policyTrackedResourcesRestClient; + private ClientDiagnostics _policyEventsClientDiagnostics; + private PolicyEventsRestOperations _policyEventsRestClient; + private ClientDiagnostics _policyStatesClientDiagnostics; + private PolicyStatesRestOperations _policyStatesRestClient; + private ClientDiagnostics _policyRestrictionsClientDiagnostics; + private PolicyRestrictionsRestOperations _policyRestrictionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePolicyInsightsSubscriptionResource() + { + } + + /// 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 MockablePolicyInsightsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PolicyTrackedResourcesClientDiagnostics => _policyTrackedResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyTrackedResourcesRestOperations PolicyTrackedResourcesRestClient => _policyTrackedResourcesRestClient ??= new PolicyTrackedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PolicyRestrictionsClientDiagnostics => _policyRestrictionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PolicyRestrictionsRestOperations PolicyRestrictionsRestClient => _policyRestrictionsRestClient ??= new PolicyRestrictionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Queries policy tracked resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyTrackedResources_ListQueryResultsForSubscription + /// + /// + /// + /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyTrackedResourceType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyTrackedResourceType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); + } + + /// + /// Queries policy tracked resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyTrackedResources_ListQueryResultsForSubscription + /// + /// + /// + /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyTrackedResourceQueryResults(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyTrackedResourceType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyTrackedResourceType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForSubscription + /// + /// + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForSubscription + /// + /// + /// + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the subscription level policy set definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForPolicySetDefinition + /// + /// + /// + /// Policy set definition name. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForPolicySetDefinitionPolicyEventsAsync(string policySetDefinitionName, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForPolicySetDefinitionRequest(Id.SubscriptionId, policySetDefinitionName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForPolicySetDefinitionNextPageRequest(nextLink, Id.SubscriptionId, policySetDefinitionName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForPolicySetDefinitionPolicyEvents", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the subscription level policy set definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForPolicySetDefinition + /// + /// + /// + /// Policy set definition name. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForPolicySetDefinitionPolicyEvents(string policySetDefinitionName, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForPolicySetDefinitionRequest(Id.SubscriptionId, policySetDefinitionName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForPolicySetDefinitionNextPageRequest(nextLink, Id.SubscriptionId, policySetDefinitionName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForPolicySetDefinitionPolicyEvents", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForPolicyDefinition + /// + /// + /// + /// Policy definition name. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForPolicyDefinitionPolicyEventsAsync(string policyDefinitionName, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForPolicyDefinitionRequest(Id.SubscriptionId, policyDefinitionName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForPolicyDefinitionNextPageRequest(nextLink, Id.SubscriptionId, policyDefinitionName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForPolicyDefinitionPolicyEvents", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForPolicyDefinition + /// + /// + /// + /// Policy definition name. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForPolicyDefinitionPolicyEvents(string policyDefinitionName, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForPolicyDefinitionRequest(Id.SubscriptionId, policyDefinitionName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForPolicyDefinitionNextPageRequest(nextLink, Id.SubscriptionId, policyDefinitionName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForPolicyDefinitionPolicyEvents", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEventsAsync(string policyAssignmentName, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(Id.SubscriptionId, policyAssignmentName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentNextPageRequest(nextLink, Id.SubscriptionId, policyAssignmentName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEvents", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy events for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults + /// + /// + /// Operation Id + /// PolicyEvents_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEvents(string policyAssignmentName, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(Id.SubscriptionId, policyAssignmentName, policyEventType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentNextPageRequest(nextLink, Id.SubscriptionId, policyAssignmentName, policyEventType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyEvents", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForSubscription + /// + /// + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForSubscription + /// + /// + /// + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Summarizes policy states for the resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForSubscription + /// + /// + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForSubscriptionRequest(Id.SubscriptionId, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.SummarizePolicyStates", "value", null, cancellationToken); + } + + /// + /// Summarizes policy states for the resources under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForSubscription + /// + /// + /// + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForSubscriptionRequest(Id.SubscriptionId, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.SummarizePolicyStates", "value", null, cancellationToken); + } + + /// + /// Triggers a policy evaluation scan for all the resources under the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation + /// + /// + /// Operation Id + /// PolicyStates_TriggerSubscriptionEvaluation + /// + /// + /// + /// 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 TriggerPolicyStateEvaluationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("MockablePolicyInsightsSubscriptionResource.TriggerPolicyStateEvaluation"); + scope.Start(); + try + { + var response = await PolicyStatesRestClient.TriggerSubscriptionEvaluationAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + var operation = new PolicyInsightsArmOperation(PolicyStatesClientDiagnostics, Pipeline, PolicyStatesRestClient.CreateTriggerSubscriptionEvaluationRequest(Id.SubscriptionId).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers a policy evaluation scan for all the resources under the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation + /// + /// + /// Operation Id + /// PolicyStates_TriggerSubscriptionEvaluation + /// + /// + /// + /// 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 TriggerPolicyStateEvaluation(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = PolicyStatesClientDiagnostics.CreateScope("MockablePolicyInsightsSubscriptionResource.TriggerPolicyStateEvaluation"); + scope.Start(); + try + { + var response = PolicyStatesRestClient.TriggerSubscriptionEvaluation(Id.SubscriptionId, cancellationToken); + var operation = new PolicyInsightsArmOperation(PolicyStatesClientDiagnostics, Pipeline, PolicyStatesRestClient.CreateTriggerSubscriptionEvaluationRequest(Id.SubscriptionId).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Queries policy states for the subscription level policy set definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForPolicySetDefinition + /// + /// + /// + /// Policy set definition name. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForPolicySetDefinitionPolicyStatesAsync(string policySetDefinitionName, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForPolicySetDefinitionRequest(Id.SubscriptionId, policySetDefinitionName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForPolicySetDefinitionNextPageRequest(nextLink, Id.SubscriptionId, policySetDefinitionName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForPolicySetDefinitionPolicyStates", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the subscription level policy set definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForPolicySetDefinition + /// + /// + /// + /// Policy set definition name. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForPolicySetDefinitionPolicyStates(string policySetDefinitionName, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForPolicySetDefinitionRequest(Id.SubscriptionId, policySetDefinitionName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForPolicySetDefinitionNextPageRequest(nextLink, Id.SubscriptionId, policySetDefinitionName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForPolicySetDefinitionPolicyStates", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Summarizes policy states for the subscription level policy set definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForPolicySetDefinition + /// + /// + /// + /// Policy set definition name. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizeForPolicySetDefinitionPolicyStatesAsync(string policySetDefinitionName, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForPolicySetDefinitionRequest(Id.SubscriptionId, policySetDefinitionName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.SummarizeForPolicySetDefinitionPolicyStates", "value", null, cancellationToken); + } + + /// + /// Summarizes policy states for the subscription level policy set definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForPolicySetDefinition + /// + /// + /// + /// Policy set definition name. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizeForPolicySetDefinitionPolicyStates(string policySetDefinitionName, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policySetDefinitionName, nameof(policySetDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForPolicySetDefinitionRequest(Id.SubscriptionId, policySetDefinitionName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.SummarizeForPolicySetDefinitionPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries policy states for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForPolicyDefinition + /// + /// + /// + /// Policy definition name. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForPolicyDefinitionPolicyStatesAsync(string policyDefinitionName, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForPolicyDefinitionRequest(Id.SubscriptionId, policyDefinitionName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForPolicyDefinitionNextPageRequest(nextLink, Id.SubscriptionId, policyDefinitionName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForPolicyDefinitionPolicyStates", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForPolicyDefinition + /// + /// + /// + /// Policy definition name. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForPolicyDefinitionPolicyStates(string policyDefinitionName, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForPolicyDefinitionRequest(Id.SubscriptionId, policyDefinitionName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForPolicyDefinitionNextPageRequest(nextLink, Id.SubscriptionId, policyDefinitionName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForPolicyDefinitionPolicyStates", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Summarizes policy states for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForPolicyDefinition + /// + /// + /// + /// Policy definition name. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizeForPolicyDefinitionPolicyStatesAsync(string policyDefinitionName, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForPolicyDefinitionRequest(Id.SubscriptionId, policyDefinitionName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.SummarizeForPolicyDefinitionPolicyStates", "value", null, cancellationToken); + } + + /// + /// Summarizes policy states for the subscription level policy definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForPolicyDefinition + /// + /// + /// + /// Policy definition name. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizeForPolicyDefinitionPolicyStates(string policyDefinitionName, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyDefinitionName, nameof(policyDefinitionName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForPolicyDefinitionRequest(Id.SubscriptionId, policyDefinitionName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.SummarizeForPolicyDefinitionPolicyStates", "value", null, cancellationToken); + } + + /// + /// Queries policy states for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStatesAsync(string policyAssignmentName, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(Id.SubscriptionId, policyAssignmentName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentNextPageRequest(nextLink, Id.SubscriptionId, policyAssignmentName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStates", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Queries policy states for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults + /// + /// + /// Operation Id + /// PolicyStates_ListQueryResultsForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStates(string policyAssignmentName, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentRequest(Id.SubscriptionId, policyAssignmentName, policyStateType, policyQuerySettings); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionLevelPolicyAssignmentNextPageRequest(nextLink, Id.SubscriptionId, policyAssignmentName, policyStateType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.GetQueryResultsForSubscriptionLevelPolicyAssignmentPolicyStates", "value", "@odata.nextLink", cancellationToken); + } + + /// + /// Summarizes policy states for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable SummarizeForSubscriptionLevelPolicyAssignmentPolicyStatesAsync(string policyAssignmentName, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForSubscriptionLevelPolicyAssignmentRequest(Id.SubscriptionId, policyAssignmentName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.SummarizeForSubscriptionLevelPolicyAssignmentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Summarizes policy states for the subscription level policy assignment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize + /// + /// + /// Operation Id + /// PolicyStates_SummarizeForSubscriptionLevelPolicyAssignment + /// + /// + /// + /// Policy assignment name. + /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable SummarizeForSubscriptionLevelPolicyAssignmentPolicyStates(string policyAssignmentName, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyAssignmentName, nameof(policyAssignmentName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForSubscriptionLevelPolicyAssignmentRequest(Id.SubscriptionId, policyAssignmentName, policyStateSummaryType, policyQuerySettings); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "MockablePolicyInsightsSubscriptionResource.SummarizeForSubscriptionLevelPolicyAssignmentPolicyStates", "value", null, cancellationToken); + } + + /// + /// Checks what restrictions Azure Policy will place on a resource within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions + /// + /// + /// Operation Id + /// PolicyRestrictions_CheckAtSubscriptionScope + /// + /// + /// + /// The check policy restrictions parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPolicyRestrictionsAsync(CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("MockablePolicyInsightsSubscriptionResource.CheckPolicyRestrictions"); + scope.Start(); + try + { + var response = await PolicyRestrictionsRestClient.CheckAtSubscriptionScopeAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks what restrictions Azure Policy will place on a resource within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions + /// + /// + /// Operation Id + /// PolicyRestrictions_CheckAtSubscriptionScope + /// + /// + /// + /// The check policy restrictions parameters. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPolicyRestrictions(CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("MockablePolicyInsightsSubscriptionResource.CheckPolicyRestrictions"); + scope.Start(); + try + { + var response = PolicyRestrictionsRestClient.CheckAtSubscriptionScope(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsTenantResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsTenantResource.cs new file mode 100644 index 0000000000000..f4991df944085 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/MockablePolicyInsightsTenantResource.cs @@ -0,0 +1,90 @@ +// 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.PolicyInsights; + +namespace Azure.ResourceManager.PolicyInsights.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockablePolicyInsightsTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePolicyInsightsTenantResource() + { + } + + /// 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 MockablePolicyInsightsTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PolicyMetadataResources in the TenantResource. + /// An object representing collection of PolicyMetadataResources and their operations over a PolicyMetadataResource. + public virtual PolicyMetadataCollection GetAllPolicyMetadata() + { + return GetCachedClient(client => new PolicyMetadataCollection(client, Id)); + } + + /// + /// Get policy metadata resource. + /// + /// + /// Request Path + /// /providers/Microsoft.PolicyInsights/policyMetadata/{resourceName} + /// + /// + /// Operation Id + /// PolicyMetadata_GetResource + /// + /// + /// + /// The name of the policy metadata resource. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetPolicyMetadataAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetAllPolicyMetadata().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get policy metadata resource. + /// + /// + /// Request Path + /// /providers/Microsoft.PolicyInsights/policyMetadata/{resourceName} + /// + /// + /// Operation Id + /// PolicyMetadata_GetResource + /// + /// + /// + /// The name of the policy metadata resource. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public virtual Response GetPolicyMetadata(string resourceName, CancellationToken cancellationToken = default) + { + return GetAllPolicyMetadata().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/PolicyInsightsExtensions.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/PolicyInsightsExtensions.cs index 6daca714d3867..b30f330cd297a 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/PolicyInsightsExtensions.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/PolicyInsightsExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.ManagementGroups; +using Azure.ResourceManager.PolicyInsights.Mocking; using Azure.ResourceManager.PolicyInsights.Models; using Azure.ResourceManager.Resources; @@ -20,149 +21,44 @@ namespace Azure.ResourceManager.PolicyInsights /// A class to add extension methods to Azure.ResourceManager.PolicyInsights. public static partial class PolicyInsightsExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockablePolicyInsightsArmClient GetMockablePolicyInsightsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockablePolicyInsightsArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePolicyInsightsManagementGroupResource GetMockablePolicyInsightsManagementGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePolicyInsightsManagementGroupResource(client, resource.Id)); } - private static ManagementGroupResourceExtensionClient GetManagementGroupResourceExtensionClient(ArmResource resource) + private static MockablePolicyInsightsResourceGroupResource GetMockablePolicyInsightsResourceGroupResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ManagementGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePolicyInsightsResourceGroupResource(client, resource.Id)); } - private static ManagementGroupResourceExtensionClient GetManagementGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePolicyInsightsSubscriptionResource GetMockablePolicyInsightsSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ManagementGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePolicyInsightsSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockablePolicyInsightsTenantResource GetMockablePolicyInsightsTenantResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePolicyInsightsTenantResource(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); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region PolicyRemediationResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static PolicyRemediationResource GetPolicyRemediationResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - PolicyRemediationResource.ValidateResourceId(id); - return new PolicyRemediationResource(client, id); - } - ); - } - #endregion - - #region PolicyMetadataResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static PolicyMetadataResource GetPolicyMetadataResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - PolicyMetadataResource.ValidateResourceId(id); - return new PolicyMetadataResource(client, id); - } - ); - } - #endregion - - #region PolicyAttestationResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of PolicyRemediationResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static PolicyAttestationResource GetPolicyAttestationResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - PolicyAttestationResource.ValidateResourceId(id); - return new PolicyAttestationResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of PolicyRemediationResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of PolicyRemediationResources and their operations over a PolicyRemediationResource. public static PolicyRemediationCollection GetPolicyRemediations(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetPolicyRemediations(); + return GetMockablePolicyInsightsArmClient(client).GetPolicyRemediations(scope); } /// @@ -177,17 +73,21 @@ public static PolicyRemediationCollection GetPolicyRemediations(this ArmClient c /// Remediations_GetAtResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the remediation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPolicyRemediationAsync(this ArmClient client, ResourceIdentifier scope, string remediationName, CancellationToken cancellationToken = default) { - return await client.GetPolicyRemediations(scope).GetAsync(remediationName, cancellationToken).ConfigureAwait(false); + return await GetMockablePolicyInsightsArmClient(client).GetPolicyRemediationAsync(scope, remediationName, cancellationToken).ConfigureAwait(false); } /// @@ -202,26 +102,36 @@ public static async Task> GetPolicyRemediati /// Remediations_GetAtResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the remediation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPolicyRemediation(this ArmClient client, ResourceIdentifier scope, string remediationName, CancellationToken cancellationToken = default) { - return client.GetPolicyRemediations(scope).Get(remediationName, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).GetPolicyRemediation(scope, remediationName, cancellationToken); } - /// Gets a collection of PolicyAttestationResources in the ArmResource. + /// + /// Gets a collection of PolicyAttestationResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of PolicyAttestationResources and their operations over a PolicyAttestationResource. public static PolicyAttestationCollection GetPolicyAttestations(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetPolicyAttestations(); + return GetMockablePolicyInsightsArmClient(client).GetPolicyAttestations(scope); } /// @@ -236,17 +146,21 @@ public static PolicyAttestationCollection GetPolicyAttestations(this ArmClient c /// Attestations_GetAtResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the attestation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPolicyAttestationAsync(this ArmClient client, ResourceIdentifier scope, string attestationName, CancellationToken cancellationToken = default) { - return await client.GetPolicyAttestations(scope).GetAsync(attestationName, cancellationToken).ConfigureAwait(false); + return await GetMockablePolicyInsightsArmClient(client).GetPolicyAttestationAsync(scope, attestationName, cancellationToken).ConfigureAwait(false); } /// @@ -261,17 +175,21 @@ public static async Task> GetPolicyAttestati /// Attestations_GetAtResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name of the attestation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPolicyAttestation(this ArmClient client, ResourceIdentifier scope, string attestationName, CancellationToken cancellationToken = default) { - return client.GetPolicyAttestations(scope).Get(attestationName, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).GetPolicyAttestation(scope, attestationName, cancellationToken); } /// @@ -286,6 +204,10 @@ public static Response GetPolicyAttestation(this ArmC /// PolicyTrackedResources_ListQueryResultsForResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -294,7 +216,7 @@ public static Response GetPolicyAttestation(this ArmC /// The cancellation token to use. public static AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(this ArmClient client, ResourceIdentifier scope, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetPolicyTrackedResourceQueryResultsAsync(policyTrackedResourceType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).GetPolicyTrackedResourceQueryResultsAsync(scope, policyTrackedResourceType, policyQuerySettings, cancellationToken); } /// @@ -309,6 +231,10 @@ public static AsyncPageable GetPolicyTrackedResourc /// PolicyTrackedResources_ListQueryResultsForResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -317,7 +243,7 @@ public static AsyncPageable GetPolicyTrackedResourc /// The cancellation token to use. public static Pageable GetPolicyTrackedResourceQueryResults(this ArmClient client, ResourceIdentifier scope, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetPolicyTrackedResourceQueryResults(policyTrackedResourceType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).GetPolicyTrackedResourceQueryResults(scope, policyTrackedResourceType, policyQuerySettings, cancellationToken); } /// @@ -332,6 +258,10 @@ public static Pageable GetPolicyTrackedResourceQuer /// PolicyEvents_ListQueryResultsForResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -340,7 +270,7 @@ public static Pageable GetPolicyTrackedResourceQuer /// The cancellation token to use. public static AsyncPageable GetPolicyEventQueryResultsAsync(this ArmClient client, ResourceIdentifier scope, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).GetPolicyEventQueryResultsAsync(scope, policyEventType, policyQuerySettings, cancellationToken); } /// @@ -355,6 +285,10 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Ar /// PolicyEvents_ListQueryResultsForResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -363,7 +297,7 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Ar /// The cancellation token to use. public static Pageable GetPolicyEventQueryResults(this ArmClient client, ResourceIdentifier scope, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).GetPolicyEventQueryResults(scope, policyEventType, policyQuerySettings, cancellationToken); } /// @@ -378,6 +312,10 @@ public static Pageable GetPolicyEventQueryResults(this ArmClient cl /// PolicyStates_ListQueryResultsForResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -386,7 +324,7 @@ public static Pageable GetPolicyEventQueryResults(this ArmClient cl /// The cancellation token to use. public static AsyncPageable GetPolicyStateQueryResultsAsync(this ArmClient client, ResourceIdentifier scope, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).GetPolicyStateQueryResultsAsync(scope, policyStateType, policyQuerySettings, cancellationToken); } /// @@ -401,6 +339,10 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Ar /// PolicyStates_ListQueryResultsForResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -409,7 +351,7 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Ar /// The cancellation token to use. public static Pageable GetPolicyStateQueryResults(this ArmClient client, ResourceIdentifier scope, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).GetPolicyStateQueryResults(scope, policyStateType, policyQuerySettings, cancellationToken); } /// @@ -424,6 +366,10 @@ public static Pageable GetPolicyStateQueryResults(this ArmClient cl /// PolicyStates_SummarizeForResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -432,7 +378,7 @@ public static Pageable GetPolicyStateQueryResults(this ArmClient cl /// The cancellation token to use. public static AsyncPageable SummarizePolicyStatesAsync(this ArmClient client, ResourceIdentifier scope, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).SummarizePolicyStatesAsync(scope, policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -447,6 +393,10 @@ public static AsyncPageable SummarizePolicyStatesAsync(this ArmCl /// PolicyStates_SummarizeForResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -455,7 +405,55 @@ public static AsyncPageable SummarizePolicyStatesAsync(this ArmCl /// The cancellation token to use. public static Pageable SummarizePolicyStates(this ArmClient client, ResourceIdentifier scope, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsArmClient(client).SummarizePolicyStates(scope, policyStateSummaryType, policyQuerySettings, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PolicyRemediationResource GetPolicyRemediationResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockablePolicyInsightsArmClient(client).GetPolicyRemediationResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PolicyMetadataResource GetPolicyMetadataResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockablePolicyInsightsArmClient(client).GetPolicyMetadataResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PolicyAttestationResource GetPolicyAttestationResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockablePolicyInsightsArmClient(client).GetPolicyAttestationResource(id); } /// @@ -470,6 +468,10 @@ public static Pageable SummarizePolicyStates(this ArmClient clien /// PolicyTrackedResources_ListQueryResultsForManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. @@ -478,7 +480,7 @@ public static Pageable SummarizePolicyStates(this ArmClient clien /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(this ManagementGroupResource managementGroupResource, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetPolicyTrackedResourceQueryResultsAsync(policyTrackedResourceType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).GetPolicyTrackedResourceQueryResultsAsync(policyTrackedResourceType, policyQuerySettings, cancellationToken); } /// @@ -493,6 +495,10 @@ public static AsyncPageable GetPolicyTrackedResourc /// PolicyTrackedResources_ListQueryResultsForManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. @@ -501,7 +507,7 @@ public static AsyncPageable GetPolicyTrackedResourc /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyTrackedResourceQueryResults(this ManagementGroupResource managementGroupResource, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetPolicyTrackedResourceQueryResults(policyTrackedResourceType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).GetPolicyTrackedResourceQueryResults(policyTrackedResourceType, policyQuerySettings, cancellationToken); } /// @@ -516,6 +522,10 @@ public static Pageable GetPolicyTrackedResourceQuer /// PolicyEvents_ListQueryResultsForManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. @@ -524,7 +534,7 @@ public static Pageable GetPolicyTrackedResourceQuer /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyEventQueryResultsAsync(this ManagementGroupResource managementGroupResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -539,6 +549,10 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Ma /// PolicyEvents_ListQueryResultsForManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. @@ -547,7 +561,7 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Ma /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyEventQueryResults(this ManagementGroupResource managementGroupResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -562,6 +576,10 @@ public static Pageable GetPolicyEventQueryResults(this ManagementGr /// PolicyStates_ListQueryResultsForManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). @@ -570,7 +588,7 @@ public static Pageable GetPolicyEventQueryResults(this ManagementGr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyStateQueryResultsAsync(this ManagementGroupResource managementGroupResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -585,6 +603,10 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Ma /// PolicyStates_ListQueryResultsForManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). @@ -593,7 +615,7 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Ma /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyStateQueryResults(this ManagementGroupResource managementGroupResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -608,6 +630,10 @@ public static Pageable GetPolicyStateQueryResults(this ManagementGr /// PolicyStates_SummarizeForManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. @@ -616,7 +642,7 @@ public static Pageable GetPolicyStateQueryResults(this ManagementGr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable SummarizePolicyStatesAsync(this ManagementGroupResource managementGroupResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -631,6 +657,10 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Manag /// PolicyStates_SummarizeForManagementGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. @@ -639,7 +669,7 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Manag /// A collection of that may take multiple service requests to iterate over. public static Pageable SummarizePolicyStates(this ManagementGroupResource managementGroupResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -654,6 +684,10 @@ public static Pageable SummarizePolicyStates(this ManagementGroup /// PolicyRestrictions_CheckAtManagementGroupScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The check policy restrictions parameters. @@ -661,9 +695,7 @@ public static Pageable SummarizePolicyStates(this ManagementGroup /// is null. public static async Task> CheckPolicyRestrictionsAsync(this ManagementGroupResource managementGroupResource, CheckManagementGroupPolicyRestrictionsContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetManagementGroupResourceExtensionClient(managementGroupResource).CheckPolicyRestrictionsAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).CheckPolicyRestrictionsAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -678,6 +710,10 @@ public static async Task> CheckPolicyRes /// PolicyRestrictions_CheckAtManagementGroupScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The check policy restrictions parameters. @@ -685,9 +721,7 @@ public static async Task> CheckPolicyRes /// is null. public static Response CheckPolicyRestrictions(this ManagementGroupResource managementGroupResource, CheckManagementGroupPolicyRestrictionsContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetManagementGroupResourceExtensionClient(managementGroupResource).CheckPolicyRestrictions(content, cancellationToken); + return GetMockablePolicyInsightsManagementGroupResource(managementGroupResource).CheckPolicyRestrictions(content, cancellationToken); } /// @@ -702,6 +736,10 @@ public static Response CheckPolicyRestrictions(th /// PolicyTrackedResources_ListQueryResultsForResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. @@ -710,7 +748,7 @@ public static Response CheckPolicyRestrictions(th /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(this ResourceGroupResource resourceGroupResource, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPolicyTrackedResourceQueryResultsAsync(policyTrackedResourceType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).GetPolicyTrackedResourceQueryResultsAsync(policyTrackedResourceType, policyQuerySettings, cancellationToken); } /// @@ -725,6 +763,10 @@ public static AsyncPageable GetPolicyTrackedResourc /// PolicyTrackedResources_ListQueryResultsForResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. @@ -733,7 +775,7 @@ public static AsyncPageable GetPolicyTrackedResourc /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyTrackedResourceQueryResults(this ResourceGroupResource resourceGroupResource, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPolicyTrackedResourceQueryResults(policyTrackedResourceType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).GetPolicyTrackedResourceQueryResults(policyTrackedResourceType, policyQuerySettings, cancellationToken); } /// @@ -748,6 +790,10 @@ public static Pageable GetPolicyTrackedResourceQuer /// PolicyEvents_ListQueryResultsForResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. @@ -756,7 +802,7 @@ public static Pageable GetPolicyTrackedResourceQuer /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyEventQueryResultsAsync(this ResourceGroupResource resourceGroupResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -771,6 +817,10 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Re /// PolicyEvents_ListQueryResultsForResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. @@ -779,7 +829,7 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Re /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyEventQueryResults(this ResourceGroupResource resourceGroupResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -794,6 +844,10 @@ public static Pageable GetPolicyEventQueryResults(this ResourceGrou /// PolicyStates_ListQueryResultsForResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). @@ -802,7 +856,7 @@ public static Pageable GetPolicyEventQueryResults(this ResourceGrou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyStateQueryResultsAsync(this ResourceGroupResource resourceGroupResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -817,6 +871,10 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Re /// PolicyStates_ListQueryResultsForResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). @@ -825,7 +883,7 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Re /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyStateQueryResults(this ResourceGroupResource resourceGroupResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -840,6 +898,10 @@ public static Pageable GetPolicyStateQueryResults(this ResourceGrou /// PolicyStates_SummarizeForResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. @@ -848,7 +910,7 @@ public static Pageable GetPolicyStateQueryResults(this ResourceGrou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable SummarizePolicyStatesAsync(this ResourceGroupResource resourceGroupResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -863,6 +925,10 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Resou /// PolicyStates_SummarizeForResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. @@ -871,7 +937,7 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Resou /// A collection of that may take multiple service requests to iterate over. public static Pageable SummarizePolicyStates(this ResourceGroupResource resourceGroupResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -886,13 +952,17 @@ public static Pageable SummarizePolicyStates(this ResourceGroupRe /// PolicyStates_TriggerResourceGroupEvaluation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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 static async Task TriggerPolicyStateEvaluationAsync(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, CancellationToken cancellationToken = default) { - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).TriggerPolicyStateEvaluationAsync(waitUntil, cancellationToken).ConfigureAwait(false); + return await GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).TriggerPolicyStateEvaluationAsync(waitUntil, cancellationToken).ConfigureAwait(false); } /// @@ -907,13 +977,17 @@ public static async Task TriggerPolicyStateEvaluationAsync(this Re /// PolicyStates_TriggerResourceGroupEvaluation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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 static ArmOperation TriggerPolicyStateEvaluation(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).TriggerPolicyStateEvaluation(waitUntil, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).TriggerPolicyStateEvaluation(waitUntil, cancellationToken); } /// @@ -928,6 +1002,10 @@ public static ArmOperation TriggerPolicyStateEvaluation(this ResourceGroupResour /// PolicyRestrictions_CheckAtResourceGroupScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The check policy restrictions parameters. @@ -935,9 +1013,7 @@ public static ArmOperation TriggerPolicyStateEvaluation(this ResourceGroupResour /// is null. public static async Task> CheckPolicyRestrictionsAsync(this ResourceGroupResource resourceGroupResource, CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckPolicyRestrictionsAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).CheckPolicyRestrictionsAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -952,6 +1028,10 @@ public static async Task> CheckPolicyRes /// PolicyRestrictions_CheckAtResourceGroupScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The check policy restrictions parameters. @@ -959,9 +1039,7 @@ public static async Task> CheckPolicyRes /// is null. public static Response CheckPolicyRestrictions(this ResourceGroupResource resourceGroupResource, CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckPolicyRestrictions(content, cancellationToken); + return GetMockablePolicyInsightsResourceGroupResource(resourceGroupResource).CheckPolicyRestrictions(content, cancellationToken); } /// @@ -976,6 +1054,10 @@ public static Response CheckPolicyRestrictions(th /// PolicyTrackedResources_ListQueryResultsForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. @@ -984,7 +1066,7 @@ public static Response CheckPolicyRestrictions(th /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(this SubscriptionResource subscriptionResource, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPolicyTrackedResourceQueryResultsAsync(policyTrackedResourceType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).GetPolicyTrackedResourceQueryResultsAsync(policyTrackedResourceType, policyQuerySettings, cancellationToken); } /// @@ -999,6 +1081,10 @@ public static AsyncPageable GetPolicyTrackedResourc /// PolicyTrackedResources_ListQueryResultsForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. @@ -1007,7 +1093,7 @@ public static AsyncPageable GetPolicyTrackedResourc /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyTrackedResourceQueryResults(this SubscriptionResource subscriptionResource, PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPolicyTrackedResourceQueryResults(policyTrackedResourceType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).GetPolicyTrackedResourceQueryResults(policyTrackedResourceType, policyQuerySettings, cancellationToken); } /// @@ -1022,6 +1108,10 @@ public static Pageable GetPolicyTrackedResourceQuer /// PolicyEvents_ListQueryResultsForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. @@ -1030,7 +1120,7 @@ public static Pageable GetPolicyTrackedResourceQuer /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyEventQueryResultsAsync(this SubscriptionResource subscriptionResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).GetPolicyEventQueryResultsAsync(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -1045,6 +1135,10 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Su /// PolicyEvents_ListQueryResultsForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. @@ -1053,7 +1147,7 @@ public static AsyncPageable GetPolicyEventQueryResultsAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyEventQueryResults(this SubscriptionResource subscriptionResource, PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).GetPolicyEventQueryResults(policyEventType, policyQuerySettings, cancellationToken); } /// @@ -1068,6 +1162,10 @@ public static Pageable GetPolicyEventQueryResults(this Subscription /// PolicyStates_ListQueryResultsForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). @@ -1076,7 +1174,7 @@ public static Pageable GetPolicyEventQueryResults(this Subscription /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPolicyStateQueryResultsAsync(this SubscriptionResource subscriptionResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).GetPolicyStateQueryResultsAsync(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -1091,6 +1189,10 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Su /// PolicyStates_ListQueryResultsForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). @@ -1099,7 +1201,7 @@ public static AsyncPageable GetPolicyStateQueryResultsAsync(this Su /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPolicyStateQueryResults(this SubscriptionResource subscriptionResource, PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).GetPolicyStateQueryResults(policyStateType, policyQuerySettings, cancellationToken); } /// @@ -1114,6 +1216,10 @@ public static Pageable GetPolicyStateQueryResults(this Subscription /// PolicyStates_SummarizeForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. @@ -1122,7 +1228,7 @@ public static Pageable GetPolicyStateQueryResults(this Subscription /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable SummarizePolicyStatesAsync(this SubscriptionResource subscriptionResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).SummarizePolicyStatesAsync(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -1137,6 +1243,10 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Subsc /// PolicyStates_SummarizeForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. @@ -1145,7 +1255,7 @@ public static AsyncPageable SummarizePolicyStatesAsync(this Subsc /// A collection of that may take multiple service requests to iterate over. public static Pageable SummarizePolicyStates(this SubscriptionResource subscriptionResource, PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).SummarizePolicyStates(policyStateSummaryType, policyQuerySettings, cancellationToken); } /// @@ -1160,13 +1270,17 @@ public static Pageable SummarizePolicyStates(this SubscriptionRes /// PolicyStates_TriggerSubscriptionEvaluation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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 static async Task TriggerPolicyStateEvaluationAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).TriggerPolicyStateEvaluationAsync(waitUntil, cancellationToken).ConfigureAwait(false); + return await GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).TriggerPolicyStateEvaluationAsync(waitUntil, cancellationToken).ConfigureAwait(false); } /// @@ -1181,13 +1295,17 @@ public static async Task TriggerPolicyStateEvaluationAsync(this Su /// PolicyStates_TriggerSubscriptionEvaluation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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 static ArmOperation TriggerPolicyStateEvaluation(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).TriggerPolicyStateEvaluation(waitUntil, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).TriggerPolicyStateEvaluation(waitUntil, cancellationToken); } /// @@ -1202,6 +1320,10 @@ public static ArmOperation TriggerPolicyStateEvaluation(this SubscriptionResourc /// PolicyRestrictions_CheckAtSubscriptionScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The check policy restrictions parameters. @@ -1209,9 +1331,7 @@ public static ArmOperation TriggerPolicyStateEvaluation(this SubscriptionResourc /// is null. public static async Task> CheckPolicyRestrictionsAsync(this SubscriptionResource subscriptionResource, CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPolicyRestrictionsAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).CheckPolicyRestrictionsAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -1226,6 +1346,10 @@ public static async Task> CheckPolicyRes /// PolicyRestrictions_CheckAtSubscriptionScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The check policy restrictions parameters. @@ -1233,17 +1357,21 @@ public static async Task> CheckPolicyRes /// is null. public static Response CheckPolicyRestrictions(this SubscriptionResource subscriptionResource, CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPolicyRestrictions(content, cancellationToken); + return GetMockablePolicyInsightsSubscriptionResource(subscriptionResource).CheckPolicyRestrictions(content, cancellationToken); } - /// Gets a collection of PolicyMetadataResources in the TenantResource. + /// + /// Gets a collection of PolicyMetadataResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PolicyMetadataResources and their operations over a PolicyMetadataResource. public static PolicyMetadataCollection GetAllPolicyMetadata(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetAllPolicyMetadata(); + return GetMockablePolicyInsightsTenantResource(tenantResource).GetAllPolicyMetadata(); } /// @@ -1258,6 +1386,10 @@ public static PolicyMetadataCollection GetAllPolicyMetadata(this TenantResource /// PolicyMetadata_GetResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the policy metadata resource. @@ -1266,7 +1398,7 @@ public static PolicyMetadataCollection GetAllPolicyMetadata(this TenantResource [ForwardsClientCalls] public static async Task> GetPolicyMetadataAsync(this TenantResource tenantResource, string resourceName, CancellationToken cancellationToken = default) { - return await tenantResource.GetAllPolicyMetadata().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockablePolicyInsightsTenantResource(tenantResource).GetPolicyMetadataAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -1281,6 +1413,10 @@ public static async Task> GetPolicyMetadataAsyn /// PolicyMetadata_GetResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the policy metadata resource. @@ -1289,7 +1425,7 @@ public static async Task> GetPolicyMetadataAsyn [ForwardsClientCalls] public static Response GetPolicyMetadata(this TenantResource tenantResource, string resourceName, CancellationToken cancellationToken = default) { - return tenantResource.GetAllPolicyMetadata().Get(resourceName, cancellationToken); + return GetMockablePolicyInsightsTenantResource(tenantResource).GetPolicyMetadata(resourceName, cancellationToken); } } } diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 1fa1255266aa2..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _policyTrackedResourcesClientDiagnostics; - private PolicyTrackedResourcesRestOperations _policyTrackedResourcesRestClient; - private ClientDiagnostics _policyEventsClientDiagnostics; - private PolicyEventsRestOperations _policyEventsRestClient; - private ClientDiagnostics _policyStatesClientDiagnostics; - private PolicyStatesRestOperations _policyStatesRestClient; - private ClientDiagnostics _policyRestrictionsClientDiagnostics; - private PolicyRestrictionsRestOperations _policyRestrictionsRestClient; - - /// 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 ClientDiagnostics PolicyTrackedResourcesClientDiagnostics => _policyTrackedResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyTrackedResourcesRestOperations PolicyTrackedResourcesRestClient => _policyTrackedResourcesRestClient ??= new PolicyTrackedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyRestrictionsClientDiagnostics => _policyRestrictionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyRestrictionsRestOperations PolicyRestrictionsRestClient => _policyRestrictionsRestClient ??= new PolicyRestrictionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Queries policy tracked resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyTrackedResources_ListQueryResultsForResourceGroup - /// - /// - /// - /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyTrackedResourceType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyTrackedResourceType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); - } - - /// - /// Queries policy tracked resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyTrackedResources_ListQueryResultsForResourceGroup - /// - /// - /// - /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyTrackedResourceQueryResults(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyTrackedResourceType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyTrackedResourceType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); - } - - /// - /// Queries policy events for the resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// - /// - /// Operation Id - /// PolicyEvents_ListQueryResultsForResourceGroup - /// - /// - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyEventType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyEventType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy events for the resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// - /// - /// Operation Id - /// PolicyEvents_ListQueryResultsForResourceGroup - /// - /// - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyEventType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyEventType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy states for the resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyStates_ListQueryResultsForResourceGroup - /// - /// - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyStateType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyStateType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy states for the resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyStates_ListQueryResultsForResourceGroup - /// - /// - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyStateType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, policyStateType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Summarizes policy states for the resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// - /// - /// Operation Id - /// PolicyStates_SummarizeForResourceGroup - /// - /// - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyStateSummaryType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.SummarizePolicyStates", "value", null, cancellationToken); - } - - /// - /// Summarizes policy states for the resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// - /// - /// Operation Id - /// PolicyStates_SummarizeForResourceGroup - /// - /// - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, policyStateSummaryType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.SummarizePolicyStates", "value", null, cancellationToken); - } - - /// - /// Triggers a policy evaluation scan for all the resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation - /// - /// - /// Operation Id - /// PolicyStates_TriggerResourceGroupEvaluation - /// - /// - /// - /// 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 TriggerPolicyStateEvaluationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.TriggerPolicyStateEvaluation"); - scope.Start(); - try - { - var response = await PolicyStatesRestClient.TriggerResourceGroupEvaluationAsync(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken).ConfigureAwait(false); - var operation = new PolicyInsightsArmOperation(PolicyStatesClientDiagnostics, Pipeline, PolicyStatesRestClient.CreateTriggerResourceGroupEvaluationRequest(Id.SubscriptionId, Id.ResourceGroupName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers a policy evaluation scan for all the resources under the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation - /// - /// - /// Operation Id - /// PolicyStates_TriggerResourceGroupEvaluation - /// - /// - /// - /// 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 TriggerPolicyStateEvaluation(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.TriggerPolicyStateEvaluation"); - scope.Start(); - try - { - var response = PolicyStatesRestClient.TriggerResourceGroupEvaluation(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken); - var operation = new PolicyInsightsArmOperation(PolicyStatesClientDiagnostics, Pipeline, PolicyStatesRestClient.CreateTriggerResourceGroupEvaluationRequest(Id.SubscriptionId, Id.ResourceGroupName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the resource group the resource will be created in is already known. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions - /// - /// - /// Operation Id - /// PolicyRestrictions_CheckAtResourceGroupScope - /// - /// - /// - /// The check policy restrictions parameters. - /// The cancellation token to use. - public virtual async Task> CheckPolicyRestrictionsAsync(CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) - { - using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckPolicyRestrictions"); - scope.Start(); - try - { - var response = await PolicyRestrictionsRestClient.CheckAtResourceGroupScopeAsync(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks what restrictions Azure Policy will place on a resource within a resource group. Use this when the resource group the resource will be created in is already known. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions - /// - /// - /// Operation Id - /// PolicyRestrictions_CheckAtResourceGroupScope - /// - /// - /// - /// The check policy restrictions parameters. - /// The cancellation token to use. - public virtual Response CheckPolicyRestrictions(CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) - { - using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckPolicyRestrictions"); - scope.Start(); - try - { - var response = PolicyRestrictionsRestClient.CheckAtResourceGroupScope(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 0362d28004ea8..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PolicyInsights.Models; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _policyTrackedResourcesClientDiagnostics; - private PolicyTrackedResourcesRestOperations _policyTrackedResourcesRestClient; - private ClientDiagnostics _policyEventsClientDiagnostics; - private PolicyEventsRestOperations _policyEventsRestClient; - private ClientDiagnostics _policyStatesClientDiagnostics; - private PolicyStatesRestOperations _policyStatesRestClient; - private ClientDiagnostics _policyRestrictionsClientDiagnostics; - private PolicyRestrictionsRestOperations _policyRestrictionsRestClient; - - /// 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 PolicyTrackedResourcesClientDiagnostics => _policyTrackedResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyTrackedResourcesRestOperations PolicyTrackedResourcesRestClient => _policyTrackedResourcesRestClient ??= new PolicyTrackedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyEventsClientDiagnostics => _policyEventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyEventsRestOperations PolicyEventsRestClient => _policyEventsRestClient ??= new PolicyEventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyStatesClientDiagnostics => _policyStatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyStatesRestOperations PolicyStatesRestClient => _policyStatesRestClient ??= new PolicyStatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PolicyRestrictionsClientDiagnostics => _policyRestrictionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PolicyInsights", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private PolicyRestrictionsRestOperations PolicyRestrictionsRestClient => _policyRestrictionsRestClient ??= new PolicyRestrictionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Queries policy tracked resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyTrackedResources_ListQueryResultsForSubscription - /// - /// - /// - /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyTrackedResourceQueryResultsAsync(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyTrackedResourceType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyTrackedResourceType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); - } - - /// - /// Queries policy tracked resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyTrackedResources_ListQueryResultsForSubscription - /// - /// - /// - /// The name of the virtual resource under PolicyTrackedResources resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyTrackedResourceQueryResults(PolicyTrackedResourceType policyTrackedResourceType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyTrackedResourceType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyTrackedResourcesRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyTrackedResourceType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyTrackedResourceRecord.DeserializePolicyTrackedResourceRecord, PolicyTrackedResourcesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPolicyTrackedResourceQueryResults", "value", "nextLink", cancellationToken); - } - - /// - /// Queries policy events for the resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// - /// - /// Operation Id - /// PolicyEvents_ListQueryResultsForSubscription - /// - /// - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyEventQueryResultsAsync(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyEventType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyEventType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy events for the resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults - /// - /// - /// Operation Id - /// PolicyEvents_ListQueryResultsForSubscription - /// - /// - /// - /// The name of the virtual resource under PolicyEvents resource type; only "default" is allowed. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyEventQueryResults(PolicyEventType policyEventType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyEventType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyEventsRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyEventType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyEvent.DeserializePolicyEvent, PolicyEventsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPolicyEventQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy states for the resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyStates_ListQueryResultsForSubscription - /// - /// - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPolicyStateQueryResultsAsync(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyStateType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyStateType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Queries policy states for the resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults - /// - /// - /// Operation Id - /// PolicyStates_ListQueryResultsForSubscription - /// - /// - /// - /// The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPolicyStateQueryResults(PolicyStateType policyStateType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionRequest(Id.SubscriptionId, policyStateType, policyQuerySettings); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PolicyStatesRestClient.CreateListQueryResultsForSubscriptionNextPageRequest(nextLink, Id.SubscriptionId, policyStateType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PolicyState.DeserializePolicyState, PolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPolicyStateQueryResults", "value", "@odata.nextLink", cancellationToken); - } - - /// - /// Summarizes policy states for the resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// - /// - /// Operation Id - /// PolicyStates_SummarizeForSubscription - /// - /// - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable SummarizePolicyStatesAsync(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForSubscriptionRequest(Id.SubscriptionId, policyStateSummaryType, policyQuerySettings); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.SummarizePolicyStates", "value", null, cancellationToken); - } - - /// - /// Summarizes policy states for the resources under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize - /// - /// - /// Operation Id - /// PolicyStates_SummarizeForSubscription - /// - /// - /// - /// The virtual resource under PolicyStates resource type for summarize action. In a given time range, 'latest' represents the latest policy state(s) and is the only allowed value. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable SummarizePolicyStates(PolicyStateSummaryType policyStateSummaryType, PolicyQuerySettings policyQuerySettings = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PolicyStatesRestClient.CreateSummarizeForSubscriptionRequest(Id.SubscriptionId, policyStateSummaryType, policyQuerySettings); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PolicySummary.DeserializePolicySummary, PolicyStatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.SummarizePolicyStates", "value", null, cancellationToken); - } - - /// - /// Triggers a policy evaluation scan for all the resources under the subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation - /// - /// - /// Operation Id - /// PolicyStates_TriggerSubscriptionEvaluation - /// - /// - /// - /// 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 TriggerPolicyStateEvaluationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.TriggerPolicyStateEvaluation"); - scope.Start(); - try - { - var response = await PolicyStatesRestClient.TriggerSubscriptionEvaluationAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - var operation = new PolicyInsightsArmOperation(PolicyStatesClientDiagnostics, Pipeline, PolicyStatesRestClient.CreateTriggerSubscriptionEvaluationRequest(Id.SubscriptionId).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers a policy evaluation scan for all the resources under the subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation - /// - /// - /// Operation Id - /// PolicyStates_TriggerSubscriptionEvaluation - /// - /// - /// - /// 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 TriggerPolicyStateEvaluation(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = PolicyStatesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.TriggerPolicyStateEvaluation"); - scope.Start(); - try - { - var response = PolicyStatesRestClient.TriggerSubscriptionEvaluation(Id.SubscriptionId, cancellationToken); - var operation = new PolicyInsightsArmOperation(PolicyStatesClientDiagnostics, Pipeline, PolicyStatesRestClient.CreateTriggerSubscriptionEvaluationRequest(Id.SubscriptionId).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks what restrictions Azure Policy will place on a resource within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions - /// - /// - /// Operation Id - /// PolicyRestrictions_CheckAtSubscriptionScope - /// - /// - /// - /// The check policy restrictions parameters. - /// The cancellation token to use. - public virtual async Task> CheckPolicyRestrictionsAsync(CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) - { - using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPolicyRestrictions"); - scope.Start(); - try - { - var response = await PolicyRestrictionsRestClient.CheckAtSubscriptionScopeAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks what restrictions Azure Policy will place on a resource within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/checkPolicyRestrictions - /// - /// - /// Operation Id - /// PolicyRestrictions_CheckAtSubscriptionScope - /// - /// - /// - /// The check policy restrictions parameters. - /// The cancellation token to use. - public virtual Response CheckPolicyRestrictions(CheckPolicyRestrictionsContent content, CancellationToken cancellationToken = default) - { - using var scope = PolicyRestrictionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPolicyRestrictions"); - scope.Start(); - try - { - var response = PolicyRestrictionsRestClient.CheckAtSubscriptionScope(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index adfc9a5d3fd4e..0000000000000 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PolicyInsights -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of PolicyMetadataResources in the TenantResource. - /// An object representing collection of PolicyMetadataResources and their operations over a PolicyMetadataResource. - public virtual PolicyMetadataCollection GetAllPolicyMetadata() - { - return GetCachedClient(Client => new PolicyMetadataCollection(Client, Id)); - } - } -} diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyAttestationResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyAttestationResource.cs index 20cdbb937592b..1a13cd33c08b8 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyAttestationResource.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyAttestationResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.PolicyInsights public partial class PolicyAttestationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceId. + /// The attestationName. public static ResourceIdentifier CreateResourceIdentifier(string resourceId, string attestationName) { var resourceId0 = $"{resourceId}/providers/Microsoft.PolicyInsights/attestations/{attestationName}"; diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyMetadataResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyMetadataResource.cs index a8e6286bc1825..4648b83e3cdb9 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyMetadataResource.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyMetadataResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.PolicyInsights public partial class PolicyMetadataResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string resourceName) { var resourceId = $"/providers/Microsoft.PolicyInsights/policyMetadata/{resourceName}"; diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationResource.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationResource.cs index cea4048d3bbbb..39d9e7f230eb0 100644 --- a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationResource.cs +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/PolicyRemediationResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.PolicyInsights public partial class PolicyRemediationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceId. + /// The remediationName. public static ResourceIdentifier CreateResourceIdentifier(string resourceId, string remediationName) { var resourceId0 = $"{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}"; diff --git a/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/tests/Mock/MockingTests.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/tests/Mock/MockingTests.cs new file mode 100644 index 0000000000000..7c64ddb9542a5 --- /dev/null +++ b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/tests/Mock/MockingTests.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure.ResourceManager.PolicyInsights.Mocking; +using Azure.ResourceManager.PolicyInsights.Models; +using Azure.ResourceManager.Resources; +using Moq; +using NUnit.Framework; + +namespace Azure.ResourceManager.PolicyInsights.Tests.Mock +{ + public class MockingTests + { + [Test] + public async Task Mocking_GetPolicyAssignmentExtensions() + { + #region mocking data + var subscriptionId = Guid.NewGuid().ToString(); + var policyAssignmentName = Guid.NewGuid().ToString(); + var policyAssignmentId = PolicyAssignmentResource.CreateResourceIdentifier(SubscriptionResource.CreateResourceIdentifier(subscriptionId), policyAssignmentName); + var querySettings = new PolicyQuerySettings() + { + OrderBy = "PolicyAssignmentId, ResourceId asc" + }; + var summaryResult = new List + { + ArmPolicyInsightsModelFactory.PolicySummary(odataContext: "1"), + ArmPolicyInsightsModelFactory.PolicySummary(odataContext: "2"), + }; + #endregion + + #region mocking setup + var clientMock = new Mock(); + var policyAssignmentExtensionMock = new Mock(); + var policyAssignmentResourceMock = new Mock(); + var pageableResultMock = new Mock>(); + // set up Id + policyAssignmentResourceMock.Setup(a => a.Id).Returns(policyAssignmentId); + // setup the mock for getting policy assignment resource + clientMock.Setup(c => c.GetPolicyAssignmentResource(policyAssignmentId)).Returns(policyAssignmentResourceMock.Object); + // setup the mock for getting policy states + // step 1: setup the extension instance + var pageableResult = AsyncPageable.FromPages(new[] { Page.FromValues(summaryResult, null, null) }); + policyAssignmentExtensionMock.Setup(e => e.SummarizePolicyStatesAsync(PolicyStateSummaryType.Latest, querySettings, default)).Returns(pageableResult); // creating a pageable result is quite cumbersome + // step 2: setup the extendee to return the result + policyAssignmentResourceMock.Setup(a => a.GetCachedClient(It.IsAny>())).Returns(policyAssignmentExtensionMock.Object); + #endregion + + var client = clientMock.Object; + var policyAssignmentResource = client.GetPolicyAssignmentResource(policyAssignmentId); + var result = policyAssignmentResource.SummarizePolicyStatesAsync(PolicyStateSummaryType.Latest, querySettings); + var count = 0; + await foreach (var item in result) + { + Assert.AreEqual(summaryResult[count], item); + count++; + } + } + } +} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/api/Azure.ResourceManager.PostgreSql.netstandard2.0.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/api/Azure.ResourceManager.PostgreSql.netstandard2.0.cs index e935eb0ce3985..d5022ee5bd123 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/api/Azure.ResourceManager.PostgreSql.netstandard2.0.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/api/Azure.ResourceManager.PostgreSql.netstandard2.0.cs @@ -246,7 +246,7 @@ protected PostgreSqlServerCollection() { } } public partial class PostgreSqlServerData : Azure.ResourceManager.Models.TrackedResourceData { - public PostgreSqlServerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PostgreSqlServerData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string ByokEnforcement { get { throw null; } } public System.DateTimeOffset? EarliestRestoreOn { get { throw null; } set { } } @@ -602,7 +602,7 @@ protected PostgreSqlFlexibleServerConfigurationResource() { } } public partial class PostgreSqlFlexibleServerData : Azure.ResourceManager.Models.TrackedResourceData { - public PostgreSqlFlexibleServerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PostgreSqlFlexibleServerData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerAuthConfig AuthConfig { get { throw null; } set { } } @@ -816,7 +816,7 @@ protected PostgreSqlMigrationCollection() { } } public partial class PostgreSqlMigrationData : Azure.ResourceManager.Models.TrackedResourceData { - public PostgreSqlMigrationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PostgreSqlMigrationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlMigrationCancel? Cancel { get { throw null; } set { } } public Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlMigrationStatus CurrentStatus { get { throw null; } } public System.Collections.Generic.IList DbsToCancelMigrationOn { get { throw null; } } @@ -859,6 +859,48 @@ protected PostgreSqlMigrationResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlMigrationPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Mocking +{ + public partial class MockablePostgreSqlFlexibleServersArmClient : Azure.ResourceManager.ArmResource + { + protected MockablePostgreSqlFlexibleServersArmClient() { } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlFlexibleServerActiveDirectoryAdministratorResource GetPostgreSqlFlexibleServerActiveDirectoryAdministratorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlFlexibleServerBackupResource GetPostgreSqlFlexibleServerBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlFlexibleServerConfigurationResource GetPostgreSqlFlexibleServerConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlFlexibleServerDatabaseResource GetPostgreSqlFlexibleServerDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlFlexibleServerFirewallRuleResource GetPostgreSqlFlexibleServerFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlFlexibleServerResource GetPostgreSqlFlexibleServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlLtrServerBackupOperationResource GetPostgreSqlLtrServerBackupOperationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlMigrationResource GetPostgreSqlMigrationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockablePostgreSqlFlexibleServersResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePostgreSqlFlexibleServersResourceGroupResource() { } + public virtual Azure.Response GetPostgreSqlFlexibleServer(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPostgreSqlFlexibleServerAsync(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.FlexibleServers.PostgreSqlFlexibleServerCollection GetPostgreSqlFlexibleServers() { throw null; } + } + public partial class MockablePostgreSqlFlexibleServersSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockablePostgreSqlFlexibleServersSubscriptionResource() { } + public virtual Azure.Response CheckPostgreSqlFlexibleServerNameAvailability(Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPostgreSqlFlexibleServerNameAvailabilityAsync(Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation(Azure.Core.AzureLocation locationName, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPostgreSqlFlexibleServerNameAvailabilityWithLocationAsync(Azure.Core.AzureLocation locationName, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ExecuteLocationBasedCapabilities(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ExecuteLocationBasedCapabilitiesAsync(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ExecuteVirtualNetworkSubnetUsage(Azure.Core.AzureLocation locationName, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExecuteVirtualNetworkSubnetUsageAsync(Azure.Core.AzureLocation locationName, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPostgreSqlFlexibleServers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPostgreSqlFlexibleServersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePostgreSqlFlexibleServersTenantResource : Azure.ResourceManager.ArmResource + { + protected MockablePostgreSqlFlexibleServersTenantResource() { } + public virtual Azure.Response ExecuteGetPrivateDnsZoneSuffix(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExecuteGetPrivateDnsZoneSuffixAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Models { public static partial class ArmPostgreSqlFlexibleServersModelFactory @@ -2104,6 +2146,40 @@ internal ServerSku() { } public override string ToString() { throw null; } } } +namespace Azure.ResourceManager.PostgreSql.Mocking +{ + public partial class MockablePostgreSqlArmClient : Azure.ResourceManager.ArmResource + { + protected MockablePostgreSqlArmClient() { } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlConfigurationResource GetPostgreSqlConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlDatabaseResource GetPostgreSqlDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlFirewallRuleResource GetPostgreSqlFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlPrivateEndpointConnectionResource GetPostgreSqlPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlPrivateLinkResource GetPostgreSqlPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlServerAdministratorResource GetPostgreSqlServerAdministratorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlServerKeyResource GetPostgreSqlServerKeyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlServerResource GetPostgreSqlServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlServerSecurityAlertPolicyResource GetPostgreSqlServerSecurityAlertPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlVirtualNetworkRuleResource GetPostgreSqlVirtualNetworkRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockablePostgreSqlResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePostgreSqlResourceGroupResource() { } + public virtual Azure.Response GetPostgreSqlServer(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPostgreSqlServerAsync(string serverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PostgreSql.PostgreSqlServerCollection GetPostgreSqlServers() { throw null; } + } + public partial class MockablePostgreSqlSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockablePostgreSqlSubscriptionResource() { } + public virtual Azure.Response CheckPostgreSqlNameAvailability(Azure.ResourceManager.PostgreSql.Models.PostgreSqlNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPostgreSqlNameAvailabilityAsync(Azure.ResourceManager.PostgreSql.Models.PostgreSqlNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLocationBasedPerformanceTiers(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLocationBasedPerformanceTiersAsync(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPostgreSqlServers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPostgreSqlServersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.PostgreSql.Models { public static partial class ArmPostgreSqlModelFactory diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlArmClient.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlArmClient.cs new file mode 100644 index 0000000000000..26bff05172235 --- /dev/null +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlArmClient.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.PostgreSql; + +namespace Azure.ResourceManager.PostgreSql.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockablePostgreSqlArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePostgreSqlArmClient() + { + } + + /// 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 MockablePostgreSqlArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockablePostgreSqlArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlServerResource GetPostgreSqlServerResource(ResourceIdentifier id) + { + PostgreSqlServerResource.ValidateResourceId(id); + return new PostgreSqlServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlFirewallRuleResource GetPostgreSqlFirewallRuleResource(ResourceIdentifier id) + { + PostgreSqlFirewallRuleResource.ValidateResourceId(id); + return new PostgreSqlFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlVirtualNetworkRuleResource GetPostgreSqlVirtualNetworkRuleResource(ResourceIdentifier id) + { + PostgreSqlVirtualNetworkRuleResource.ValidateResourceId(id); + return new PostgreSqlVirtualNetworkRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlDatabaseResource GetPostgreSqlDatabaseResource(ResourceIdentifier id) + { + PostgreSqlDatabaseResource.ValidateResourceId(id); + return new PostgreSqlDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlConfigurationResource GetPostgreSqlConfigurationResource(ResourceIdentifier id) + { + PostgreSqlConfigurationResource.ValidateResourceId(id); + return new PostgreSqlConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlServerAdministratorResource GetPostgreSqlServerAdministratorResource(ResourceIdentifier id) + { + PostgreSqlServerAdministratorResource.ValidateResourceId(id); + return new PostgreSqlServerAdministratorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlServerSecurityAlertPolicyResource GetPostgreSqlServerSecurityAlertPolicyResource(ResourceIdentifier id) + { + PostgreSqlServerSecurityAlertPolicyResource.ValidateResourceId(id); + return new PostgreSqlServerSecurityAlertPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlPrivateEndpointConnectionResource GetPostgreSqlPrivateEndpointConnectionResource(ResourceIdentifier id) + { + PostgreSqlPrivateEndpointConnectionResource.ValidateResourceId(id); + return new PostgreSqlPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlPrivateLinkResource GetPostgreSqlPrivateLinkResource(ResourceIdentifier id) + { + PostgreSqlPrivateLinkResource.ValidateResourceId(id); + return new PostgreSqlPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlServerKeyResource GetPostgreSqlServerKeyResource(ResourceIdentifier id) + { + PostgreSqlServerKeyResource.ValidateResourceId(id); + return new PostgreSqlServerKeyResource(Client, id); + } + } +} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlResourceGroupResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlResourceGroupResource.cs new file mode 100644 index 0000000000000..8dac60102bd2b --- /dev/null +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.PostgreSql; + +namespace Azure.ResourceManager.PostgreSql.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockablePostgreSqlResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePostgreSqlResourceGroupResource() + { + } + + /// 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 MockablePostgreSqlResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PostgreSqlServerResources in the ResourceGroupResource. + /// An object representing collection of PostgreSqlServerResources and their operations over a PostgreSqlServerResource. + public virtual PostgreSqlServerCollection GetPostgreSqlServers() + { + return GetCachedClient(client => new PostgreSqlServerCollection(client, Id)); + } + + /// + /// Gets information about a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPostgreSqlServerAsync(string serverName, CancellationToken cancellationToken = default) + { + return await GetPostgreSqlServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPostgreSqlServer(string serverName, CancellationToken cancellationToken = default) + { + return GetPostgreSqlServers().Get(serverName, cancellationToken); + } + } +} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlSubscriptionResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlSubscriptionResource.cs new file mode 100644 index 0000000000000..257944a7f984f --- /dev/null +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/MockablePostgreSqlSubscriptionResource.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PostgreSql; +using Azure.ResourceManager.PostgreSql.Models; + +namespace Azure.ResourceManager.PostgreSql.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockablePostgreSqlSubscriptionResource : ArmResource + { + private ClientDiagnostics _postgreSqlServerServersClientDiagnostics; + private ServersRestOperations _postgreSqlServerServersRestClient; + private ClientDiagnostics _locationBasedPerformanceTierClientDiagnostics; + private LocationBasedPerformanceTierRestOperations _locationBasedPerformanceTierRestClient; + private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; + private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePostgreSqlSubscriptionResource() + { + } + + /// 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 MockablePostgreSqlSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PostgreSqlServerServersClientDiagnostics => _postgreSqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql", PostgreSqlServerResource.ResourceType.Namespace, Diagnostics); + private ServersRestOperations PostgreSqlServerServersRestClient => _postgreSqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PostgreSqlServerResource.ResourceType)); + private ClientDiagnostics LocationBasedPerformanceTierClientDiagnostics => _locationBasedPerformanceTierClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationBasedPerformanceTierRestOperations LocationBasedPerformanceTierRestClient => _locationBasedPerformanceTierRestClient ??= new LocationBasedPerformanceTierRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPostgreSqlServersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PostgreSqlServerServersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new PostgreSqlServerResource(Client, PostgreSqlServerData.DeserializePostgreSqlServerData(e)), PostgreSqlServerServersClientDiagnostics, Pipeline, "MockablePostgreSqlSubscriptionResource.GetPostgreSqlServers", "value", null, cancellationToken); + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPostgreSqlServers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PostgreSqlServerServersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new PostgreSqlServerResource(Client, PostgreSqlServerData.DeserializePostgreSqlServerData(e)), PostgreSqlServerServersClientDiagnostics, Pipeline, "MockablePostgreSqlSubscriptionResource.GetPostgreSqlServers", "value", null, cancellationToken); + } + + /// + /// List all the performance tiers at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers + /// + /// + /// Operation Id + /// LocationBasedPerformanceTier_List + /// + /// + /// + /// The name of the location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLocationBasedPerformanceTiersAsync(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedPerformanceTierRestClient.CreateListRequest(Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PostgreSqlPerformanceTierProperties.DeserializePostgreSqlPerformanceTierProperties, LocationBasedPerformanceTierClientDiagnostics, Pipeline, "MockablePostgreSqlSubscriptionResource.GetLocationBasedPerformanceTiers", "value", null, cancellationToken); + } + + /// + /// List all the performance tiers at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers + /// + /// + /// Operation Id + /// LocationBasedPerformanceTier_List + /// + /// + /// + /// The name of the location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLocationBasedPerformanceTiers(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedPerformanceTierRestClient.CreateListRequest(Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PostgreSqlPerformanceTierProperties.DeserializePostgreSqlPerformanceTierProperties, LocationBasedPerformanceTierClientDiagnostics, Pipeline, "MockablePostgreSqlSubscriptionResource.GetLocationBasedPerformanceTiers", "value", null, cancellationToken); + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPostgreSqlNameAvailabilityAsync(PostgreSqlNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockablePostgreSqlSubscriptionResource.CheckPostgreSqlNameAvailability"); + scope.Start(); + try + { + var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPostgreSqlNameAvailability(PostgreSqlNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockablePostgreSqlSubscriptionResource.CheckPostgreSqlNameAvailability"); + scope.Start(); + try + { + var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/PostgreSqlExtensions.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/PostgreSqlExtensions.cs index 8a3289f9fa39a..c60ccddf1b9dd 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/PostgreSqlExtensions.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/PostgreSqlExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.PostgreSql.Mocking; using Azure.ResourceManager.PostgreSql.Models; using Azure.ResourceManager.Resources; @@ -19,233 +20,193 @@ namespace Azure.ResourceManager.PostgreSql /// A class to add extension methods to Azure.ResourceManager.PostgreSql. public static partial class PostgreSqlExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockablePostgreSqlArmClient GetMockablePostgreSqlArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockablePostgreSqlArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePostgreSqlResourceGroupResource GetMockablePostgreSqlResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePostgreSqlResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockablePostgreSqlSubscriptionResource GetMockablePostgreSqlSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePostgreSqlSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region PostgreSqlServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlServerResource GetPostgreSqlServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlServerResource.ValidateResourceId(id); - return new PostgreSqlServerResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlServerResource(id); } - #endregion - #region PostgreSqlFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlFirewallRuleResource GetPostgreSqlFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlFirewallRuleResource.ValidateResourceId(id); - return new PostgreSqlFirewallRuleResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlFirewallRuleResource(id); } - #endregion - #region PostgreSqlVirtualNetworkRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlVirtualNetworkRuleResource GetPostgreSqlVirtualNetworkRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlVirtualNetworkRuleResource.ValidateResourceId(id); - return new PostgreSqlVirtualNetworkRuleResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlVirtualNetworkRuleResource(id); } - #endregion - #region PostgreSqlDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlDatabaseResource GetPostgreSqlDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlDatabaseResource.ValidateResourceId(id); - return new PostgreSqlDatabaseResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlDatabaseResource(id); } - #endregion - #region PostgreSqlConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlConfigurationResource GetPostgreSqlConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlConfigurationResource.ValidateResourceId(id); - return new PostgreSqlConfigurationResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlConfigurationResource(id); } - #endregion - #region PostgreSqlServerAdministratorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlServerAdministratorResource GetPostgreSqlServerAdministratorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlServerAdministratorResource.ValidateResourceId(id); - return new PostgreSqlServerAdministratorResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlServerAdministratorResource(id); } - #endregion - #region PostgreSqlServerSecurityAlertPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlServerSecurityAlertPolicyResource GetPostgreSqlServerSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlServerSecurityAlertPolicyResource.ValidateResourceId(id); - return new PostgreSqlServerSecurityAlertPolicyResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlServerSecurityAlertPolicyResource(id); } - #endregion - #region PostgreSqlPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlPrivateEndpointConnectionResource GetPostgreSqlPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlPrivateEndpointConnectionResource.ValidateResourceId(id); - return new PostgreSqlPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlPrivateEndpointConnectionResource(id); } - #endregion - #region PostgreSqlPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlPrivateLinkResource GetPostgreSqlPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlPrivateLinkResource.ValidateResourceId(id); - return new PostgreSqlPrivateLinkResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlPrivateLinkResource(id); } - #endregion - #region PostgreSqlServerKeyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlServerKeyResource GetPostgreSqlServerKeyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlServerKeyResource.ValidateResourceId(id); - return new PostgreSqlServerKeyResource(client, id); - } - ); + return GetMockablePostgreSqlArmClient(client).GetPostgreSqlServerKeyResource(id); } - #endregion - /// Gets a collection of PostgreSqlServerResources in the ResourceGroupResource. + /// + /// Gets a collection of PostgreSqlServerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PostgreSqlServerResources and their operations over a PostgreSqlServerResource. public static PostgreSqlServerCollection GetPostgreSqlServers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPostgreSqlServers(); + return GetMockablePostgreSqlResourceGroupResource(resourceGroupResource).GetPostgreSqlServers(); } /// @@ -260,16 +221,20 @@ public static PostgreSqlServerCollection GetPostgreSqlServers(this ResourceGroup /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPostgreSqlServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPostgreSqlServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + return await GetMockablePostgreSqlResourceGroupResource(resourceGroupResource).GetPostgreSqlServerAsync(serverName, cancellationToken).ConfigureAwait(false); } /// @@ -284,16 +249,20 @@ public static async Task> GetPostgreSqlServer /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPostgreSqlServer(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPostgreSqlServers().Get(serverName, cancellationToken); + return GetMockablePostgreSqlResourceGroupResource(resourceGroupResource).GetPostgreSqlServer(serverName, cancellationToken); } /// @@ -308,13 +277,17 @@ public static Response GetPostgreSqlServer(this Resour /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPostgreSqlServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPostgreSqlServersAsync(cancellationToken); + return GetMockablePostgreSqlSubscriptionResource(subscriptionResource).GetPostgreSqlServersAsync(cancellationToken); } /// @@ -329,13 +302,17 @@ public static AsyncPageable GetPostgreSqlServersAsync( /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPostgreSqlServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPostgreSqlServers(cancellationToken); + return GetMockablePostgreSqlSubscriptionResource(subscriptionResource).GetPostgreSqlServers(cancellationToken); } /// @@ -350,6 +327,10 @@ public static Pageable GetPostgreSqlServers(this Subsc /// LocationBasedPerformanceTier_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -357,7 +338,7 @@ public static Pageable GetPostgreSqlServers(this Subsc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLocationBasedPerformanceTiersAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLocationBasedPerformanceTiersAsync(locationName, cancellationToken); + return GetMockablePostgreSqlSubscriptionResource(subscriptionResource).GetLocationBasedPerformanceTiersAsync(locationName, cancellationToken); } /// @@ -372,6 +353,10 @@ public static AsyncPageable GetLocationBase /// LocationBasedPerformanceTier_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -379,7 +364,7 @@ public static AsyncPageable GetLocationBase /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLocationBasedPerformanceTiers(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLocationBasedPerformanceTiers(locationName, cancellationToken); + return GetMockablePostgreSqlSubscriptionResource(subscriptionResource).GetLocationBasedPerformanceTiers(locationName, cancellationToken); } /// @@ -394,6 +379,10 @@ public static Pageable GetLocationBasedPerf /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if resource name is available. @@ -401,9 +390,7 @@ public static Pageable GetLocationBasedPerf /// is null. public static async Task> CheckPostgreSqlNameAvailabilityAsync(this SubscriptionResource subscriptionResource, PostgreSqlNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPostgreSqlNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockablePostgreSqlSubscriptionResource(subscriptionResource).CheckPostgreSqlNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -418,6 +405,10 @@ public static async Task> CheckPostgr /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if resource name is available. @@ -425,9 +416,7 @@ public static async Task> CheckPostgr /// is null. public static Response CheckPostgreSqlNameAvailability(this SubscriptionResource subscriptionResource, PostgreSqlNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPostgreSqlNameAvailability(content, cancellationToken); + return GetMockablePostgreSqlSubscriptionResource(subscriptionResource).CheckPostgreSqlNameAvailability(content, cancellationToken); } } } diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 46cd056c429b1..0000000000000 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PostgreSql -{ - /// 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 PostgreSqlServerResources in the ResourceGroupResource. - /// An object representing collection of PostgreSqlServerResources and their operations over a PostgreSqlServerResource. - public virtual PostgreSqlServerCollection GetPostgreSqlServers() - { - return GetCachedClient(Client => new PostgreSqlServerCollection(Client, Id)); - } - } -} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index c5f8c73b20abd..0000000000000 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PostgreSql.Models; - -namespace Azure.ResourceManager.PostgreSql -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _postgreSqlServerServersClientDiagnostics; - private ServersRestOperations _postgreSqlServerServersRestClient; - private ClientDiagnostics _locationBasedPerformanceTierClientDiagnostics; - private LocationBasedPerformanceTierRestOperations _locationBasedPerformanceTierRestClient; - private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; - private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; - - /// 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 PostgreSqlServerServersClientDiagnostics => _postgreSqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql", PostgreSqlServerResource.ResourceType.Namespace, Diagnostics); - private ServersRestOperations PostgreSqlServerServersRestClient => _postgreSqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PostgreSqlServerResource.ResourceType)); - private ClientDiagnostics LocationBasedPerformanceTierClientDiagnostics => _locationBasedPerformanceTierClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationBasedPerformanceTierRestOperations LocationBasedPerformanceTierRestClient => _locationBasedPerformanceTierRestClient ??= new LocationBasedPerformanceTierRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the servers in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPostgreSqlServersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PostgreSqlServerServersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new PostgreSqlServerResource(Client, PostgreSqlServerData.DeserializePostgreSqlServerData(e)), PostgreSqlServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPostgreSqlServers", "value", null, cancellationToken); - } - - /// - /// List all the servers in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPostgreSqlServers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PostgreSqlServerServersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new PostgreSqlServerResource(Client, PostgreSqlServerData.DeserializePostgreSqlServerData(e)), PostgreSqlServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPostgreSqlServers", "value", null, cancellationToken); - } - - /// - /// List all the performance tiers at specified location in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers - /// - /// - /// Operation Id - /// LocationBasedPerformanceTier_List - /// - /// - /// - /// The name of the location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLocationBasedPerformanceTiersAsync(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedPerformanceTierRestClient.CreateListRequest(Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, PostgreSqlPerformanceTierProperties.DeserializePostgreSqlPerformanceTierProperties, LocationBasedPerformanceTierClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLocationBasedPerformanceTiers", "value", null, cancellationToken); - } - - /// - /// List all the performance tiers at specified location in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers - /// - /// - /// Operation Id - /// LocationBasedPerformanceTier_List - /// - /// - /// - /// The name of the location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLocationBasedPerformanceTiers(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedPerformanceTierRestClient.CreateListRequest(Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, PostgreSqlPerformanceTierProperties.DeserializePostgreSqlPerformanceTierProperties, LocationBasedPerformanceTierClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLocationBasedPerformanceTiers", "value", null, cancellationToken); - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual async Task> CheckPostgreSqlNameAvailabilityAsync(PostgreSqlNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPostgreSqlNameAvailability"); - scope.Start(); - try - { - var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual Response CheckPostgreSqlNameAvailability(PostgreSqlNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPostgreSqlNameAvailability"); - scope.Start(); - try - { - var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlConfigurationResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlConfigurationResource.cs index d803e6d06bf3f..4782c029812eb 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlConfigurationResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlDatabaseResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlDatabaseResource.cs index dd8332f835936..37ecbb4ba2606 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlDatabaseResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlDatabaseResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlFirewallRuleResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlFirewallRuleResource.cs index 3c42f6b7ec325..963c1495a8972 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlFirewallRuleResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateEndpointConnectionResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateEndpointConnectionResource.cs index 34115b119a2c4..e39b73cfed632 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateEndpointConnectionResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateLinkResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateLinkResource.cs index 3bc3688d58467..67770f8e57ce1 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateLinkResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerAdministratorResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerAdministratorResource.cs index 294b6750900e7..ba5665cf52aff 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerAdministratorResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerAdministratorResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlServerAdministratorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerKeyResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerKeyResource.cs index dab25560caa6b..ed3c41847550a 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerKeyResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerKeyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlServerKeyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The keyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string keyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerResource.cs index a7efb75139aef..295950cd60ed5 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}"; @@ -110,7 +113,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PostgreSqlFirewallRuleResources and their operations over a PostgreSqlFirewallRuleResource. public virtual PostgreSqlFirewallRuleCollection GetPostgreSqlFirewallRules() { - return GetCachedClient(Client => new PostgreSqlFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlFirewallRuleCollection(client, Id)); } /// @@ -128,8 +131,8 @@ public virtual PostgreSqlFirewallRuleCollection GetPostgreSqlFirewallRules() /// /// The name of the server firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -151,8 +154,8 @@ public virtual async Task> GetPostgreSq /// /// The name of the server firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -163,7 +166,7 @@ public virtual Response GetPostgreSqlFirewallRul /// An object representing collection of PostgreSqlVirtualNetworkRuleResources and their operations over a PostgreSqlVirtualNetworkRuleResource. public virtual PostgreSqlVirtualNetworkRuleCollection GetPostgreSqlVirtualNetworkRules() { - return GetCachedClient(Client => new PostgreSqlVirtualNetworkRuleCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlVirtualNetworkRuleCollection(client, Id)); } /// @@ -181,8 +184,8 @@ public virtual PostgreSqlVirtualNetworkRuleCollection GetPostgreSqlVirtualNetwor /// /// The name of the virtual network rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlVirtualNetworkRuleAsync(string virtualNetworkRuleName, CancellationToken cancellationToken = default) { @@ -204,8 +207,8 @@ public virtual async Task> GetPos /// /// The name of the virtual network rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlVirtualNetworkRule(string virtualNetworkRuleName, CancellationToken cancellationToken = default) { @@ -216,7 +219,7 @@ public virtual Response GetPostgreSqlVirtu /// An object representing collection of PostgreSqlDatabaseResources and their operations over a PostgreSqlDatabaseResource. public virtual PostgreSqlDatabaseCollection GetPostgreSqlDatabases() { - return GetCachedClient(Client => new PostgreSqlDatabaseCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlDatabaseCollection(client, Id)); } /// @@ -234,8 +237,8 @@ public virtual PostgreSqlDatabaseCollection GetPostgreSqlDatabases() /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -257,8 +260,8 @@ public virtual async Task> GetPostgreSqlDat /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -269,7 +272,7 @@ public virtual Response GetPostgreSqlDatabase(string /// An object representing collection of PostgreSqlConfigurationResources and their operations over a PostgreSqlConfigurationResource. public virtual PostgreSqlConfigurationCollection GetPostgreSqlConfigurations() { - return GetCachedClient(Client => new PostgreSqlConfigurationCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlConfigurationCollection(client, Id)); } /// @@ -287,8 +290,8 @@ public virtual PostgreSqlConfigurationCollection GetPostgreSqlConfigurations() /// /// The name of the server configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -310,8 +313,8 @@ public virtual async Task> GetPostgreS /// /// The name of the server configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -329,7 +332,7 @@ public virtual PostgreSqlServerAdministratorResource GetPostgreSqlServerAdminist /// An object representing collection of PostgreSqlServerSecurityAlertPolicyResources and their operations over a PostgreSqlServerSecurityAlertPolicyResource. public virtual PostgreSqlServerSecurityAlertPolicyCollection GetPostgreSqlServerSecurityAlertPolicies() { - return GetCachedClient(Client => new PostgreSqlServerSecurityAlertPolicyCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlServerSecurityAlertPolicyCollection(client, Id)); } /// @@ -378,7 +381,7 @@ public virtual Response GetPostgreS /// An object representing collection of PostgreSqlPrivateEndpointConnectionResources and their operations over a PostgreSqlPrivateEndpointConnectionResource. public virtual PostgreSqlPrivateEndpointConnectionCollection GetPostgreSqlPrivateEndpointConnections() { - return GetCachedClient(Client => new PostgreSqlPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlPrivateEndpointConnectionCollection(client, Id)); } /// @@ -396,8 +399,8 @@ public virtual PostgreSqlPrivateEndpointConnectionCollection GetPostgreSqlPrivat /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -419,8 +422,8 @@ public virtual async Task> /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -431,7 +434,7 @@ public virtual Response GetPostgreS /// An object representing collection of PostgreSqlPrivateLinkResources and their operations over a PostgreSqlPrivateLinkResource. public virtual PostgreSqlPrivateLinkResourceCollection GetPostgreSqlPrivateLinkResources() { - return GetCachedClient(Client => new PostgreSqlPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlPrivateLinkResourceCollection(client, Id)); } /// @@ -449,8 +452,8 @@ public virtual PostgreSqlPrivateLinkResourceCollection GetPostgreSqlPrivateLinkR /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlPrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -472,8 +475,8 @@ public virtual async Task> GetPostgreSql /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlPrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -484,7 +487,7 @@ public virtual Response GetPostgreSqlPrivateLinkR /// An object representing collection of PostgreSqlServerKeyResources and their operations over a PostgreSqlServerKeyResource. public virtual PostgreSqlServerKeyCollection GetPostgreSqlServerKeys() { - return GetCachedClient(Client => new PostgreSqlServerKeyCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlServerKeyCollection(client, Id)); } /// @@ -502,8 +505,8 @@ public virtual PostgreSqlServerKeyCollection GetPostgreSqlServerKeys() /// /// The name of the PostgreSQL Server key to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlServerKeyAsync(string keyName, CancellationToken cancellationToken = default) { @@ -525,8 +528,8 @@ public virtual async Task> GetPostgreSqlSe /// /// The name of the PostgreSQL Server key to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlServerKey(string keyName, CancellationToken cancellationToken = default) { diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerSecurityAlertPolicyResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerSecurityAlertPolicyResource.cs index c4f1c151b2237..ad4aca373fa1d 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerSecurityAlertPolicyResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerSecurityAlertPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlServerSecurityAlertPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The securityAlertPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, PostgreSqlSecurityAlertPolicyName securityAlertPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlVirtualNetworkRuleResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlVirtualNetworkRuleResource.cs index 608f75990605b..31fb815d4e927 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlVirtualNetworkRuleResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlVirtualNetworkRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql public partial class PostgreSqlVirtualNetworkRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The virtualNetworkRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string virtualNetworkRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs index 929c823d9440c..1223939d9ef88 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.PostgreSql.FlexibleServers.Mocking; using Azure.ResourceManager.PostgreSql.FlexibleServers.Models; using Azure.ResourceManager.Resources; @@ -19,211 +20,166 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers /// A class to add extension methods to Azure.ResourceManager.PostgreSql.FlexibleServers. public static partial class FlexibleServersExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockablePostgreSqlFlexibleServersArmClient GetMockablePostgreSqlFlexibleServersArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockablePostgreSqlFlexibleServersArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePostgreSqlFlexibleServersResourceGroupResource GetMockablePostgreSqlFlexibleServersResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePostgreSqlFlexibleServersResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockablePostgreSqlFlexibleServersSubscriptionResource GetMockablePostgreSqlFlexibleServersSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePostgreSqlFlexibleServersSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePostgreSqlFlexibleServersTenantResource GetMockablePostgreSqlFlexibleServersTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePostgreSqlFlexibleServersTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region PostgreSqlFlexibleServerActiveDirectoryAdministratorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlFlexibleServerActiveDirectoryAdministratorResource GetPostgreSqlFlexibleServerActiveDirectoryAdministratorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.ValidateResourceId(id); - return new PostgreSqlFlexibleServerActiveDirectoryAdministratorResource(client, id); - } - ); + return GetMockablePostgreSqlFlexibleServersArmClient(client).GetPostgreSqlFlexibleServerActiveDirectoryAdministratorResource(id); } - #endregion - #region PostgreSqlFlexibleServerBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlFlexibleServerBackupResource GetPostgreSqlFlexibleServerBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlFlexibleServerBackupResource.ValidateResourceId(id); - return new PostgreSqlFlexibleServerBackupResource(client, id); - } - ); + return GetMockablePostgreSqlFlexibleServersArmClient(client).GetPostgreSqlFlexibleServerBackupResource(id); } - #endregion - #region PostgreSqlFlexibleServerConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlFlexibleServerConfigurationResource GetPostgreSqlFlexibleServerConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlFlexibleServerConfigurationResource.ValidateResourceId(id); - return new PostgreSqlFlexibleServerConfigurationResource(client, id); - } - ); + return GetMockablePostgreSqlFlexibleServersArmClient(client).GetPostgreSqlFlexibleServerConfigurationResource(id); } - #endregion - #region PostgreSqlFlexibleServerDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlFlexibleServerDatabaseResource GetPostgreSqlFlexibleServerDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlFlexibleServerDatabaseResource.ValidateResourceId(id); - return new PostgreSqlFlexibleServerDatabaseResource(client, id); - } - ); + return GetMockablePostgreSqlFlexibleServersArmClient(client).GetPostgreSqlFlexibleServerDatabaseResource(id); } - #endregion - #region PostgreSqlFlexibleServerFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlFlexibleServerFirewallRuleResource GetPostgreSqlFlexibleServerFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlFlexibleServerFirewallRuleResource.ValidateResourceId(id); - return new PostgreSqlFlexibleServerFirewallRuleResource(client, id); - } - ); + return GetMockablePostgreSqlFlexibleServersArmClient(client).GetPostgreSqlFlexibleServerFirewallRuleResource(id); } - #endregion - #region PostgreSqlFlexibleServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlFlexibleServerResource GetPostgreSqlFlexibleServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlFlexibleServerResource.ValidateResourceId(id); - return new PostgreSqlFlexibleServerResource(client, id); - } - ); + return GetMockablePostgreSqlFlexibleServersArmClient(client).GetPostgreSqlFlexibleServerResource(id); } - #endregion - #region PostgreSqlMigrationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlMigrationResource GetPostgreSqlMigrationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlMigrationResource.ValidateResourceId(id); - return new PostgreSqlMigrationResource(client, id); - } - ); + return GetMockablePostgreSqlFlexibleServersArmClient(client).GetPostgreSqlMigrationResource(id); } - #endregion - #region PostgreSqlLtrServerBackupOperationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PostgreSqlLtrServerBackupOperationResource GetPostgreSqlLtrServerBackupOperationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PostgreSqlLtrServerBackupOperationResource.ValidateResourceId(id); - return new PostgreSqlLtrServerBackupOperationResource(client, id); - } - ); + return GetMockablePostgreSqlFlexibleServersArmClient(client).GetPostgreSqlLtrServerBackupOperationResource(id); } - #endregion - /// Gets a collection of PostgreSqlFlexibleServerResources in the ResourceGroupResource. + /// + /// Gets a collection of PostgreSqlFlexibleServerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PostgreSqlFlexibleServerResources and their operations over a PostgreSqlFlexibleServerResource. public static PostgreSqlFlexibleServerCollection GetPostgreSqlFlexibleServers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPostgreSqlFlexibleServers(); + return GetMockablePostgreSqlFlexibleServersResourceGroupResource(resourceGroupResource).GetPostgreSqlFlexibleServers(); } /// @@ -238,16 +194,20 @@ public static PostgreSqlFlexibleServerCollection GetPostgreSqlFlexibleServers(th /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPostgreSqlFlexibleServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPostgreSqlFlexibleServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + return await GetMockablePostgreSqlFlexibleServersResourceGroupResource(resourceGroupResource).GetPostgreSqlFlexibleServerAsync(serverName, cancellationToken).ConfigureAwait(false); } /// @@ -262,16 +222,20 @@ public static async Task> GetPostgreS /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPostgreSqlFlexibleServer(this ResourceGroupResource resourceGroupResource, string serverName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPostgreSqlFlexibleServers().Get(serverName, cancellationToken); + return GetMockablePostgreSqlFlexibleServersResourceGroupResource(resourceGroupResource).GetPostgreSqlFlexibleServer(serverName, cancellationToken); } /// @@ -286,6 +250,10 @@ public static Response GetPostgreSqlFlexibleSe /// LocationBasedCapabilities_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -293,7 +261,7 @@ public static Response GetPostgreSqlFlexibleSe /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable ExecuteLocationBasedCapabilitiesAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).ExecuteLocationBasedCapabilitiesAsync(locationName, cancellationToken); + return GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).ExecuteLocationBasedCapabilitiesAsync(locationName, cancellationToken); } /// @@ -308,6 +276,10 @@ public static AsyncPageable Execut /// LocationBasedCapabilities_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -315,7 +287,7 @@ public static AsyncPageable Execut /// A collection of that may take multiple service requests to iterate over. public static Pageable ExecuteLocationBasedCapabilities(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).ExecuteLocationBasedCapabilities(locationName, cancellationToken); + return GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).ExecuteLocationBasedCapabilities(locationName, cancellationToken); } /// @@ -330,6 +302,10 @@ public static Pageable ExecuteLoca /// CheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if resource name is available. @@ -337,9 +313,7 @@ public static Pageable ExecuteLoca /// is null. public static async Task> CheckPostgreSqlFlexibleServerNameAvailabilityAsync(this SubscriptionResource subscriptionResource, PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPostgreSqlFlexibleServerNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).CheckPostgreSqlFlexibleServerNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -354,6 +328,10 @@ public static async TaskCheckNameAvailability_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The required parameters for checking if resource name is available. @@ -361,9 +339,7 @@ public static async Task is null. public static Response CheckPostgreSqlFlexibleServerNameAvailability(this SubscriptionResource subscriptionResource, PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPostgreSqlFlexibleServerNameAvailability(content, cancellationToken); + return GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).CheckPostgreSqlFlexibleServerNameAvailability(content, cancellationToken); } /// @@ -378,6 +354,10 @@ public static Response CheckPost /// CheckNameAvailabilityWithLocation_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -386,9 +366,7 @@ public static Response CheckPost /// is null. public static async Task> CheckPostgreSqlFlexibleServerNameAvailabilityWithLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPostgreSqlFlexibleServerNameAvailabilityWithLocationAsync(locationName, content, cancellationToken).ConfigureAwait(false); + return await GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).CheckPostgreSqlFlexibleServerNameAvailabilityWithLocationAsync(locationName, content, cancellationToken).ConfigureAwait(false); } /// @@ -403,6 +381,10 @@ public static async TaskCheckNameAvailabilityWithLocation_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -411,9 +393,7 @@ public static async Task is null. public static Response CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation(locationName, content, cancellationToken); + return GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation(locationName, content, cancellationToken); } /// @@ -428,13 +408,17 @@ public static Response CheckPost /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPostgreSqlFlexibleServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPostgreSqlFlexibleServersAsync(cancellationToken); + return GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).GetPostgreSqlFlexibleServersAsync(cancellationToken); } /// @@ -449,13 +433,17 @@ public static AsyncPageable GetPostgreSqlFlexi /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPostgreSqlFlexibleServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPostgreSqlFlexibleServers(cancellationToken); + return GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).GetPostgreSqlFlexibleServers(cancellationToken); } /// @@ -470,6 +458,10 @@ public static Pageable GetPostgreSqlFlexibleSe /// VirtualNetworkSubnetUsage_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -478,9 +470,7 @@ public static Pageable GetPostgreSqlFlexibleSe /// is null. public static async Task> ExecuteVirtualNetworkSubnetUsageAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, nameof(postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ExecuteVirtualNetworkSubnetUsageAsync(locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken).ConfigureAwait(false); + return await GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).ExecuteVirtualNetworkSubnetUsageAsync(locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken).ConfigureAwait(false); } /// @@ -495,6 +485,10 @@ public static async TaskVirtualNetworkSubnetUsage_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the location. @@ -503,9 +497,7 @@ public static async Task is null. public static Response ExecuteVirtualNetworkSubnetUsage(this SubscriptionResource subscriptionResource, AzureLocation locationName, PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, nameof(postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ExecuteVirtualNetworkSubnetUsage(locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken); + return GetMockablePostgreSqlFlexibleServersSubscriptionResource(subscriptionResource).ExecuteVirtualNetworkSubnetUsage(locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken); } /// @@ -520,12 +512,16 @@ public static Response /// GetPrivateDnsZoneSuffix_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> ExecuteGetPrivateDnsZoneSuffixAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return await GetTenantResourceExtensionClient(tenantResource).ExecuteGetPrivateDnsZoneSuffixAsync(cancellationToken).ConfigureAwait(false); + return await GetMockablePostgreSqlFlexibleServersTenantResource(tenantResource).ExecuteGetPrivateDnsZoneSuffixAsync(cancellationToken).ConfigureAwait(false); } /// @@ -540,12 +536,16 @@ public static async Task> ExecuteGetPrivateDnsZoneSuffixAsync(t /// GetPrivateDnsZoneSuffix_Execute /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response ExecuteGetPrivateDnsZoneSuffix(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).ExecuteGetPrivateDnsZoneSuffix(cancellationToken); + return GetMockablePostgreSqlFlexibleServersTenantResource(tenantResource).ExecuteGetPrivateDnsZoneSuffix(cancellationToken); } } } diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersArmClient.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersArmClient.cs new file mode 100644 index 0000000000000..cb1d1fcbcc68a --- /dev/null +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersArmClient.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.PostgreSql.FlexibleServers; + +namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockablePostgreSqlFlexibleServersArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePostgreSqlFlexibleServersArmClient() + { + } + + /// 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 MockablePostgreSqlFlexibleServersArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockablePostgreSqlFlexibleServersArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlFlexibleServerActiveDirectoryAdministratorResource GetPostgreSqlFlexibleServerActiveDirectoryAdministratorResource(ResourceIdentifier id) + { + PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.ValidateResourceId(id); + return new PostgreSqlFlexibleServerActiveDirectoryAdministratorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlFlexibleServerBackupResource GetPostgreSqlFlexibleServerBackupResource(ResourceIdentifier id) + { + PostgreSqlFlexibleServerBackupResource.ValidateResourceId(id); + return new PostgreSqlFlexibleServerBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlFlexibleServerConfigurationResource GetPostgreSqlFlexibleServerConfigurationResource(ResourceIdentifier id) + { + PostgreSqlFlexibleServerConfigurationResource.ValidateResourceId(id); + return new PostgreSqlFlexibleServerConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlFlexibleServerDatabaseResource GetPostgreSqlFlexibleServerDatabaseResource(ResourceIdentifier id) + { + PostgreSqlFlexibleServerDatabaseResource.ValidateResourceId(id); + return new PostgreSqlFlexibleServerDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlFlexibleServerFirewallRuleResource GetPostgreSqlFlexibleServerFirewallRuleResource(ResourceIdentifier id) + { + PostgreSqlFlexibleServerFirewallRuleResource.ValidateResourceId(id); + return new PostgreSqlFlexibleServerFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlFlexibleServerResource GetPostgreSqlFlexibleServerResource(ResourceIdentifier id) + { + PostgreSqlFlexibleServerResource.ValidateResourceId(id); + return new PostgreSqlFlexibleServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlMigrationResource GetPostgreSqlMigrationResource(ResourceIdentifier id) + { + PostgreSqlMigrationResource.ValidateResourceId(id); + return new PostgreSqlMigrationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PostgreSqlLtrServerBackupOperationResource GetPostgreSqlLtrServerBackupOperationResource(ResourceIdentifier id) + { + PostgreSqlLtrServerBackupOperationResource.ValidateResourceId(id); + return new PostgreSqlLtrServerBackupOperationResource(Client, id); + } + } +} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersResourceGroupResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersResourceGroupResource.cs new file mode 100644 index 0000000000000..5561c1711fca7 --- /dev/null +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.PostgreSql.FlexibleServers; + +namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockablePostgreSqlFlexibleServersResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePostgreSqlFlexibleServersResourceGroupResource() + { + } + + /// 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 MockablePostgreSqlFlexibleServersResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PostgreSqlFlexibleServerResources in the ResourceGroupResource. + /// An object representing collection of PostgreSqlFlexibleServerResources and their operations over a PostgreSqlFlexibleServerResource. + public virtual PostgreSqlFlexibleServerCollection GetPostgreSqlFlexibleServers() + { + return GetCachedClient(client => new PostgreSqlFlexibleServerCollection(client, Id)); + } + + /// + /// Gets information about a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPostgreSqlFlexibleServerAsync(string serverName, CancellationToken cancellationToken = default) + { + return await GetPostgreSqlFlexibleServers().GetAsync(serverName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPostgreSqlFlexibleServer(string serverName, CancellationToken cancellationToken = default) + { + return GetPostgreSqlFlexibleServers().Get(serverName, cancellationToken); + } + } +} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersSubscriptionResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersSubscriptionResource.cs new file mode 100644 index 0000000000000..35d8ceafc82b3 --- /dev/null +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersSubscriptionResource.cs @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PostgreSql.FlexibleServers; +using Azure.ResourceManager.PostgreSql.FlexibleServers.Models; + +namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockablePostgreSqlFlexibleServersSubscriptionResource : ArmResource + { + private ClientDiagnostics _locationBasedCapabilitiesClientDiagnostics; + private LocationBasedCapabilitiesRestOperations _locationBasedCapabilitiesRestClient; + private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; + private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; + private ClientDiagnostics _checkNameAvailabilityWithLocationClientDiagnostics; + private CheckNameAvailabilityWithLocationRestOperations _checkNameAvailabilityWithLocationRestClient; + private ClientDiagnostics _postgreSqlFlexibleServerServersClientDiagnostics; + private ServersRestOperations _postgreSqlFlexibleServerServersRestClient; + private ClientDiagnostics _virtualNetworkSubnetUsageClientDiagnostics; + private VirtualNetworkSubnetUsageRestOperations _virtualNetworkSubnetUsageRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePostgreSqlFlexibleServersSubscriptionResource() + { + } + + /// 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 MockablePostgreSqlFlexibleServersSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LocationBasedCapabilitiesClientDiagnostics => _locationBasedCapabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationBasedCapabilitiesRestOperations LocationBasedCapabilitiesRestClient => _locationBasedCapabilitiesRestClient ??= new LocationBasedCapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CheckNameAvailabilityWithLocationClientDiagnostics => _checkNameAvailabilityWithLocationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityWithLocationRestOperations CheckNameAvailabilityWithLocationRestClient => _checkNameAvailabilityWithLocationRestClient ??= new CheckNameAvailabilityWithLocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics PostgreSqlFlexibleServerServersClientDiagnostics => _postgreSqlFlexibleServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", PostgreSqlFlexibleServerResource.ResourceType.Namespace, Diagnostics); + private ServersRestOperations PostgreSqlFlexibleServerServersRestClient => _postgreSqlFlexibleServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PostgreSqlFlexibleServerResource.ResourceType)); + private ClientDiagnostics VirtualNetworkSubnetUsageClientDiagnostics => _virtualNetworkSubnetUsageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private VirtualNetworkSubnetUsageRestOperations VirtualNetworkSubnetUsageRestClient => _virtualNetworkSubnetUsageRestClient ??= new VirtualNetworkSubnetUsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities + /// + /// + /// Operation Id + /// LocationBasedCapabilities_Execute + /// + /// + /// + /// The name of the location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ExecuteLocationBasedCapabilitiesAsync(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedCapabilitiesRestClient.CreateExecuteRequest(Id.SubscriptionId, locationName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedCapabilitiesRestClient.CreateExecuteNextPageRequest(nextLink, Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PostgreSqlFlexibleServerCapabilityProperties.DeserializePostgreSqlFlexibleServerCapabilityProperties, LocationBasedCapabilitiesClientDiagnostics, Pipeline, "MockablePostgreSqlFlexibleServersSubscriptionResource.ExecuteLocationBasedCapabilities", "value", "nextLink", cancellationToken); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities + /// + /// + /// Operation Id + /// LocationBasedCapabilities_Execute + /// + /// + /// + /// The name of the location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ExecuteLocationBasedCapabilities(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedCapabilitiesRestClient.CreateExecuteRequest(Id.SubscriptionId, locationName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedCapabilitiesRestClient.CreateExecuteNextPageRequest(nextLink, Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PostgreSqlFlexibleServerCapabilityProperties.DeserializePostgreSqlFlexibleServerCapabilityProperties, LocationBasedCapabilitiesClientDiagnostics, Pipeline, "MockablePostgreSqlFlexibleServersSubscriptionResource.ExecuteLocationBasedCapabilities", "value", "nextLink", cancellationToken); + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPostgreSqlFlexibleServerNameAvailabilityAsync(PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockablePostgreSqlFlexibleServersSubscriptionResource.CheckPostgreSqlFlexibleServerNameAvailability"); + scope.Start(); + try + { + var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Execute + /// + /// + /// + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPostgreSqlFlexibleServerNameAvailability(PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("MockablePostgreSqlFlexibleServersSubscriptionResource.CheckPostgreSqlFlexibleServerNameAvailability"); + scope.Start(); + try + { + var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailabilityWithLocation_Execute + /// + /// + /// + /// The name of the location. + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPostgreSqlFlexibleServerNameAvailabilityWithLocationAsync(AzureLocation locationName, PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityWithLocationClientDiagnostics.CreateScope("MockablePostgreSqlFlexibleServersSubscriptionResource.CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation"); + scope.Start(); + try + { + var response = await CheckNameAvailabilityWithLocationRestClient.ExecuteAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of name for resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailabilityWithLocation_Execute + /// + /// + /// + /// The name of the location. + /// The required parameters for checking if resource name is available. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation(AzureLocation locationName, PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CheckNameAvailabilityWithLocationClientDiagnostics.CreateScope("MockablePostgreSqlFlexibleServersSubscriptionResource.CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation"); + scope.Start(); + try + { + var response = CheckNameAvailabilityWithLocationRestClient.Execute(Id.SubscriptionId, locationName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPostgreSqlFlexibleServersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PostgreSqlFlexibleServerServersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PostgreSqlFlexibleServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PostgreSqlFlexibleServerResource(Client, PostgreSqlFlexibleServerData.DeserializePostgreSqlFlexibleServerData(e)), PostgreSqlFlexibleServerServersClientDiagnostics, Pipeline, "MockablePostgreSqlFlexibleServersSubscriptionResource.GetPostgreSqlFlexibleServers", "value", "nextLink", cancellationToken); + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPostgreSqlFlexibleServers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PostgreSqlFlexibleServerServersRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PostgreSqlFlexibleServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PostgreSqlFlexibleServerResource(Client, PostgreSqlFlexibleServerData.DeserializePostgreSqlFlexibleServerData(e)), PostgreSqlFlexibleServerServersClientDiagnostics, Pipeline, "MockablePostgreSqlFlexibleServersSubscriptionResource.GetPostgreSqlFlexibleServers", "value", "nextLink", cancellationToken); + } + + /// + /// Get virtual network subnet usage for a given vNet resource id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage + /// + /// + /// Operation Id + /// VirtualNetworkSubnetUsage_Execute + /// + /// + /// + /// The name of the location. + /// The required parameters for creating or updating a server. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExecuteVirtualNetworkSubnetUsageAsync(AzureLocation locationName, PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, nameof(postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter)); + + using var scope = VirtualNetworkSubnetUsageClientDiagnostics.CreateScope("MockablePostgreSqlFlexibleServersSubscriptionResource.ExecuteVirtualNetworkSubnetUsage"); + scope.Start(); + try + { + var response = await VirtualNetworkSubnetUsageRestClient.ExecuteAsync(Id.SubscriptionId, locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get virtual network subnet usage for a given vNet resource id. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage + /// + /// + /// Operation Id + /// VirtualNetworkSubnetUsage_Execute + /// + /// + /// + /// The name of the location. + /// The required parameters for creating or updating a server. + /// The cancellation token to use. + /// is null. + public virtual Response ExecuteVirtualNetworkSubnetUsage(AzureLocation locationName, PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, nameof(postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter)); + + using var scope = VirtualNetworkSubnetUsageClientDiagnostics.CreateScope("MockablePostgreSqlFlexibleServersSubscriptionResource.ExecuteVirtualNetworkSubnetUsage"); + scope.Start(); + try + { + var response = VirtualNetworkSubnetUsageRestClient.Execute(Id.SubscriptionId, locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersTenantResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersTenantResource.cs new file mode 100644 index 0000000000000..70c6a0f5a8bd7 --- /dev/null +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/MockablePostgreSqlFlexibleServersTenantResource.cs @@ -0,0 +1,106 @@ +// 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; +using Azure.ResourceManager.PostgreSql.FlexibleServers; + +namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockablePostgreSqlFlexibleServersTenantResource : ArmResource + { + private ClientDiagnostics _getPrivateDnsZoneSuffixClientDiagnostics; + private GetPrivateDnsZoneSuffixRestOperations _getPrivateDnsZoneSuffixRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePostgreSqlFlexibleServersTenantResource() + { + } + + /// 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 MockablePostgreSqlFlexibleServersTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics GetPrivateDnsZoneSuffixClientDiagnostics => _getPrivateDnsZoneSuffixClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private GetPrivateDnsZoneSuffixRestOperations GetPrivateDnsZoneSuffixRestClient => _getPrivateDnsZoneSuffixRestClient ??= new GetPrivateDnsZoneSuffixRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get private DNS zone suffix in the cloud + /// + /// + /// Request Path + /// /providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix + /// + /// + /// Operation Id + /// GetPrivateDnsZoneSuffix_Execute + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> ExecuteGetPrivateDnsZoneSuffixAsync(CancellationToken cancellationToken = default) + { + using var scope = GetPrivateDnsZoneSuffixClientDiagnostics.CreateScope("MockablePostgreSqlFlexibleServersTenantResource.ExecuteGetPrivateDnsZoneSuffix"); + scope.Start(); + try + { + var response = await GetPrivateDnsZoneSuffixRestClient.ExecuteAsync(cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get private DNS zone suffix in the cloud + /// + /// + /// Request Path + /// /providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix + /// + /// + /// Operation Id + /// GetPrivateDnsZoneSuffix_Execute + /// + /// + /// + /// The cancellation token to use. + public virtual Response ExecuteGetPrivateDnsZoneSuffix(CancellationToken cancellationToken = default) + { + using var scope = GetPrivateDnsZoneSuffixClientDiagnostics.CreateScope("MockablePostgreSqlFlexibleServersTenantResource.ExecuteGetPrivateDnsZoneSuffix"); + scope.Start(); + try + { + var response = GetPrivateDnsZoneSuffixRestClient.Execute(cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 143eadb87c547..0000000000000 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PostgreSql.FlexibleServers -{ - /// 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 PostgreSqlFlexibleServerResources in the ResourceGroupResource. - /// An object representing collection of PostgreSqlFlexibleServerResources and their operations over a PostgreSqlFlexibleServerResource. - public virtual PostgreSqlFlexibleServerCollection GetPostgreSqlFlexibleServers() - { - return GetCachedClient(Client => new PostgreSqlFlexibleServerCollection(Client, Id)); - } - } -} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 3e335cbefe4b6..0000000000000 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,343 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PostgreSql.FlexibleServers.Models; - -namespace Azure.ResourceManager.PostgreSql.FlexibleServers -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _locationBasedCapabilitiesClientDiagnostics; - private LocationBasedCapabilitiesRestOperations _locationBasedCapabilitiesRestClient; - private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; - private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; - private ClientDiagnostics _checkNameAvailabilityWithLocationClientDiagnostics; - private CheckNameAvailabilityWithLocationRestOperations _checkNameAvailabilityWithLocationRestClient; - private ClientDiagnostics _postgreSqlFlexibleServerServersClientDiagnostics; - private ServersRestOperations _postgreSqlFlexibleServerServersRestClient; - private ClientDiagnostics _virtualNetworkSubnetUsageClientDiagnostics; - private VirtualNetworkSubnetUsageRestOperations _virtualNetworkSubnetUsageRestClient; - - /// 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 LocationBasedCapabilitiesClientDiagnostics => _locationBasedCapabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LocationBasedCapabilitiesRestOperations LocationBasedCapabilitiesRestClient => _locationBasedCapabilitiesRestClient ??= new LocationBasedCapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CheckNameAvailabilityWithLocationClientDiagnostics => _checkNameAvailabilityWithLocationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CheckNameAvailabilityWithLocationRestOperations CheckNameAvailabilityWithLocationRestClient => _checkNameAvailabilityWithLocationRestClient ??= new CheckNameAvailabilityWithLocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics PostgreSqlFlexibleServerServersClientDiagnostics => _postgreSqlFlexibleServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", PostgreSqlFlexibleServerResource.ResourceType.Namespace, Diagnostics); - private ServersRestOperations PostgreSqlFlexibleServerServersRestClient => _postgreSqlFlexibleServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PostgreSqlFlexibleServerResource.ResourceType)); - private ClientDiagnostics VirtualNetworkSubnetUsageClientDiagnostics => _virtualNetworkSubnetUsageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private VirtualNetworkSubnetUsageRestOperations VirtualNetworkSubnetUsageRestClient => _virtualNetworkSubnetUsageRestClient ??= new VirtualNetworkSubnetUsageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get capabilities at specified location in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities - /// - /// - /// Operation Id - /// LocationBasedCapabilities_Execute - /// - /// - /// - /// The name of the location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable ExecuteLocationBasedCapabilitiesAsync(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedCapabilitiesRestClient.CreateExecuteRequest(Id.SubscriptionId, locationName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedCapabilitiesRestClient.CreateExecuteNextPageRequest(nextLink, Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PostgreSqlFlexibleServerCapabilityProperties.DeserializePostgreSqlFlexibleServerCapabilityProperties, LocationBasedCapabilitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.ExecuteLocationBasedCapabilities", "value", "nextLink", cancellationToken); - } - - /// - /// Get capabilities at specified location in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities - /// - /// - /// Operation Id - /// LocationBasedCapabilities_Execute - /// - /// - /// - /// The name of the location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable ExecuteLocationBasedCapabilities(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedCapabilitiesRestClient.CreateExecuteRequest(Id.SubscriptionId, locationName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedCapabilitiesRestClient.CreateExecuteNextPageRequest(nextLink, Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PostgreSqlFlexibleServerCapabilityProperties.DeserializePostgreSqlFlexibleServerCapabilityProperties, LocationBasedCapabilitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.ExecuteLocationBasedCapabilities", "value", "nextLink", cancellationToken); - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual async Task> CheckPostgreSqlFlexibleServerNameAvailabilityAsync(PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPostgreSqlFlexibleServerNameAvailability"); - scope.Start(); - try - { - var response = await CheckNameAvailabilityRestClient.ExecuteAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability_Execute - /// - /// - /// - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual Response CheckPostgreSqlFlexibleServerNameAvailability(PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPostgreSqlFlexibleServerNameAvailability"); - scope.Start(); - try - { - var response = CheckNameAvailabilityRestClient.Execute(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailabilityWithLocation_Execute - /// - /// - /// - /// The name of the location. - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual async Task> CheckPostgreSqlFlexibleServerNameAvailabilityWithLocationAsync(AzureLocation locationName, PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityWithLocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation"); - scope.Start(); - try - { - var response = await CheckNameAvailabilityWithLocationRestClient.ExecuteAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of name for resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailabilityWithLocation_Execute - /// - /// - /// - /// The name of the location. - /// The required parameters for checking if resource name is available. - /// The cancellation token to use. - public virtual Response CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation(AzureLocation locationName, PostgreSqlFlexibleServerNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = CheckNameAvailabilityWithLocationClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation"); - scope.Start(); - try - { - var response = CheckNameAvailabilityWithLocationRestClient.Execute(Id.SubscriptionId, locationName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all the servers in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPostgreSqlFlexibleServersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PostgreSqlFlexibleServerServersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PostgreSqlFlexibleServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PostgreSqlFlexibleServerResource(Client, PostgreSqlFlexibleServerData.DeserializePostgreSqlFlexibleServerData(e)), PostgreSqlFlexibleServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPostgreSqlFlexibleServers", "value", "nextLink", cancellationToken); - } - - /// - /// List all the servers in a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPostgreSqlFlexibleServers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PostgreSqlFlexibleServerServersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PostgreSqlFlexibleServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PostgreSqlFlexibleServerResource(Client, PostgreSqlFlexibleServerData.DeserializePostgreSqlFlexibleServerData(e)), PostgreSqlFlexibleServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPostgreSqlFlexibleServers", "value", "nextLink", cancellationToken); - } - - /// - /// Get virtual network subnet usage for a given vNet resource id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage - /// - /// - /// Operation Id - /// VirtualNetworkSubnetUsage_Execute - /// - /// - /// - /// The name of the location. - /// The required parameters for creating or updating a server. - /// The cancellation token to use. - public virtual async Task> ExecuteVirtualNetworkSubnetUsageAsync(AzureLocation locationName, PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) - { - using var scope = VirtualNetworkSubnetUsageClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExecuteVirtualNetworkSubnetUsage"); - scope.Start(); - try - { - var response = await VirtualNetworkSubnetUsageRestClient.ExecuteAsync(Id.SubscriptionId, locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get virtual network subnet usage for a given vNet resource id. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage - /// - /// - /// Operation Id - /// VirtualNetworkSubnetUsage_Execute - /// - /// - /// - /// The name of the location. - /// The required parameters for creating or updating a server. - /// The cancellation token to use. - public virtual Response ExecuteVirtualNetworkSubnetUsage(AzureLocation locationName, PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, CancellationToken cancellationToken = default) - { - using var scope = VirtualNetworkSubnetUsageClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ExecuteVirtualNetworkSubnetUsage"); - scope.Start(); - try - { - var response = VirtualNetworkSubnetUsageRestClient.Execute(Id.SubscriptionId, locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index b7a7c06aa8c3f..0000000000000 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,105 +0,0 @@ -// 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.PostgreSql.FlexibleServers -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _getPrivateDnsZoneSuffixClientDiagnostics; - private GetPrivateDnsZoneSuffixRestOperations _getPrivateDnsZoneSuffixRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics GetPrivateDnsZoneSuffixClientDiagnostics => _getPrivateDnsZoneSuffixClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PostgreSql.FlexibleServers", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private GetPrivateDnsZoneSuffixRestOperations GetPrivateDnsZoneSuffixRestClient => _getPrivateDnsZoneSuffixRestClient ??= new GetPrivateDnsZoneSuffixRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get private DNS zone suffix in the cloud - /// - /// - /// Request Path - /// /providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix - /// - /// - /// Operation Id - /// GetPrivateDnsZoneSuffix_Execute - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> ExecuteGetPrivateDnsZoneSuffixAsync(CancellationToken cancellationToken = default) - { - using var scope = GetPrivateDnsZoneSuffixClientDiagnostics.CreateScope("TenantResourceExtensionClient.ExecuteGetPrivateDnsZoneSuffix"); - scope.Start(); - try - { - var response = await GetPrivateDnsZoneSuffixRestClient.ExecuteAsync(cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get private DNS zone suffix in the cloud - /// - /// - /// Request Path - /// /providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix - /// - /// - /// Operation Id - /// GetPrivateDnsZoneSuffix_Execute - /// - /// - /// - /// The cancellation token to use. - public virtual Response ExecuteGetPrivateDnsZoneSuffix(CancellationToken cancellationToken = default) - { - using var scope = GetPrivateDnsZoneSuffixClientDiagnostics.CreateScope("TenantResourceExtensionClient.ExecuteGetPrivateDnsZoneSuffix"); - scope.Start(); - try - { - var response = GetPrivateDnsZoneSuffixRestClient.Execute(cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.cs index 5e80d22e38a1b..299110713d76d 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers public partial class PostgreSqlFlexibleServerActiveDirectoryAdministratorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The objectId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string objectId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerBackupResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerBackupResource.cs index 79e2574413e2c..c0b2257ab2961 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerBackupResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerBackupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers public partial class PostgreSqlFlexibleServerBackupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The backupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string backupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups/{backupName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerConfigurationResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerConfigurationResource.cs index 4406ebd625a4c..891db7274ceab 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerConfigurationResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers public partial class PostgreSqlFlexibleServerConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The configurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string configurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerDatabaseResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerDatabaseResource.cs index 0a9dfa9dc332a..20904dc7c549e 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerDatabaseResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerDatabaseResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers public partial class PostgreSqlFlexibleServerDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerFirewallRuleResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerFirewallRuleResource.cs index c84157969f2b8..c14ced08b523b 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerFirewallRuleResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers public partial class PostgreSqlFlexibleServerFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerResource.cs index 60af361759e24..a5b2d7e2582d6 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers public partial class PostgreSqlFlexibleServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}"; @@ -110,7 +113,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PostgreSqlFlexibleServerActiveDirectoryAdministratorResources and their operations over a PostgreSqlFlexibleServerActiveDirectoryAdministratorResource. public virtual PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection GetPostgreSqlFlexibleServerActiveDirectoryAdministrators() { - return GetCachedClient(Client => new PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection(client, Id)); } /// @@ -128,8 +131,8 @@ public virtual PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection Ge /// /// Guid of the objectId for the administrator. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlFlexibleServerActiveDirectoryAdministratorAsync(string objectId, CancellationToken cancellationToken = default) { @@ -151,8 +154,8 @@ public virtual async Task /// Guid of the objectId for the administrator. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlFlexibleServerActiveDirectoryAdministrator(string objectId, CancellationToken cancellationToken = default) { @@ -163,7 +166,7 @@ public virtual Response An object representing collection of PostgreSqlFlexibleServerBackupResources and their operations over a PostgreSqlFlexibleServerBackupResource. public virtual PostgreSqlFlexibleServerBackupCollection GetPostgreSqlFlexibleServerBackups() { - return GetCachedClient(Client => new PostgreSqlFlexibleServerBackupCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlFlexibleServerBackupCollection(client, Id)); } /// @@ -181,8 +184,8 @@ public virtual PostgreSqlFlexibleServerBackupCollection GetPostgreSqlFlexibleSer /// /// The name of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlFlexibleServerBackupAsync(string backupName, CancellationToken cancellationToken = default) { @@ -204,8 +207,8 @@ public virtual async Task> GetP /// /// The name of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlFlexibleServerBackup(string backupName, CancellationToken cancellationToken = default) { @@ -216,7 +219,7 @@ public virtual Response GetPostgreSqlFle /// An object representing collection of PostgreSqlFlexibleServerConfigurationResources and their operations over a PostgreSqlFlexibleServerConfigurationResource. public virtual PostgreSqlFlexibleServerConfigurationCollection GetPostgreSqlFlexibleServerConfigurations() { - return GetCachedClient(Client => new PostgreSqlFlexibleServerConfigurationCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlFlexibleServerConfigurationCollection(client, Id)); } /// @@ -234,8 +237,8 @@ public virtual PostgreSqlFlexibleServerConfigurationCollection GetPostgreSqlFlex /// /// The name of the server configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlFlexibleServerConfigurationAsync(string configurationName, CancellationToken cancellationToken = default) { @@ -257,8 +260,8 @@ public virtual async Task /// The name of the server configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlFlexibleServerConfiguration(string configurationName, CancellationToken cancellationToken = default) { @@ -269,7 +272,7 @@ public virtual Response GetPostgr /// An object representing collection of PostgreSqlFlexibleServerDatabaseResources and their operations over a PostgreSqlFlexibleServerDatabaseResource. public virtual PostgreSqlFlexibleServerDatabaseCollection GetPostgreSqlFlexibleServerDatabases() { - return GetCachedClient(Client => new PostgreSqlFlexibleServerDatabaseCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlFlexibleServerDatabaseCollection(client, Id)); } /// @@ -287,8 +290,8 @@ public virtual PostgreSqlFlexibleServerDatabaseCollection GetPostgreSqlFlexibleS /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlFlexibleServerDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -310,8 +313,8 @@ public virtual async Task> Ge /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlFlexibleServerDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -322,7 +325,7 @@ public virtual Response GetPostgreSqlF /// An object representing collection of PostgreSqlFlexibleServerFirewallRuleResources and their operations over a PostgreSqlFlexibleServerFirewallRuleResource. public virtual PostgreSqlFlexibleServerFirewallRuleCollection GetPostgreSqlFlexibleServerFirewallRules() { - return GetCachedClient(Client => new PostgreSqlFlexibleServerFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlFlexibleServerFirewallRuleCollection(client, Id)); } /// @@ -340,8 +343,8 @@ public virtual PostgreSqlFlexibleServerFirewallRuleCollection GetPostgreSqlFlexi /// /// The name of the server firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlFlexibleServerFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -363,8 +366,8 @@ public virtual async Task /// /// The name of the server firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlFlexibleServerFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -375,7 +378,7 @@ public virtual Response GetPostgre /// An object representing collection of PostgreSqlMigrationResources and their operations over a PostgreSqlMigrationResource. public virtual PostgreSqlMigrationCollection GetPostgreSqlMigrations() { - return GetCachedClient(Client => new PostgreSqlMigrationCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlMigrationCollection(client, Id)); } /// @@ -393,8 +396,8 @@ public virtual PostgreSqlMigrationCollection GetPostgreSqlMigrations() /// /// The name of the migration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlMigrationAsync(string migrationName, CancellationToken cancellationToken = default) { @@ -416,8 +419,8 @@ public virtual async Task> GetPostgreSqlMi /// /// The name of the migration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlMigration(string migrationName, CancellationToken cancellationToken = default) { @@ -428,7 +431,7 @@ public virtual Response GetPostgreSqlMigration(stri /// An object representing collection of PostgreSqlLtrServerBackupOperationResources and their operations over a PostgreSqlLtrServerBackupOperationResource. public virtual PostgreSqlLtrServerBackupOperationCollection GetPostgreSqlLtrServerBackupOperations() { - return GetCachedClient(Client => new PostgreSqlLtrServerBackupOperationCollection(Client, Id)); + return GetCachedClient(client => new PostgreSqlLtrServerBackupOperationCollection(client, Id)); } /// @@ -446,8 +449,8 @@ public virtual PostgreSqlLtrServerBackupOperationCollection GetPostgreSqlLtrServ /// /// The name of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPostgreSqlLtrServerBackupOperationAsync(string backupName, CancellationToken cancellationToken = default) { @@ -469,8 +472,8 @@ public virtual async Task> /// /// The name of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPostgreSqlLtrServerBackupOperation(string backupName, CancellationToken cancellationToken = default) { diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlLtrServerBackupOperationResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlLtrServerBackupOperationResource.cs index a86d5236fe6ab..6a160f9556035 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlLtrServerBackupOperationResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlLtrServerBackupOperationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers public partial class PostgreSqlLtrServerBackupOperationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The backupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string backupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName}"; diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlMigrationResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlMigrationResource.cs index 267bf97210b9a..0b0a9fe92c844 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlMigrationResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlMigrationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.PostgreSql.FlexibleServers public partial class PostgreSqlMigrationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The targetDbServerName. + /// The migrationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string targetDbServerName, string migrationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}"; diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/api/Azure.ResourceManager.PowerBIDedicated.netstandard2.0.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/api/Azure.ResourceManager.PowerBIDedicated.netstandard2.0.cs index aafc98d1289a7..81b144592e5ac 100644 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/api/Azure.ResourceManager.PowerBIDedicated.netstandard2.0.cs +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/api/Azure.ResourceManager.PowerBIDedicated.netstandard2.0.cs @@ -119,6 +119,37 @@ public static partial class PowerBIDedicatedExtensions public static Azure.AsyncPageable GetSkusCapacitiesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.PowerBIDedicated.Mocking +{ + public partial class MockablePowerBIDedicatedArmClient : Azure.ResourceManager.ArmResource + { + protected MockablePowerBIDedicatedArmClient() { } + public virtual Azure.ResourceManager.PowerBIDedicated.AutoScaleVCoreResource GetAutoScaleVCoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PowerBIDedicated.DedicatedCapacityResource GetDedicatedCapacityResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockablePowerBIDedicatedResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePowerBIDedicatedResourceGroupResource() { } + public virtual Azure.Response GetAutoScaleVCore(string vcoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutoScaleVCoreAsync(string vcoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PowerBIDedicated.AutoScaleVCoreCollection GetAutoScaleVCores() { throw null; } + public virtual Azure.ResourceManager.PowerBIDedicated.DedicatedCapacityCollection GetDedicatedCapacities() { throw null; } + public virtual Azure.Response GetDedicatedCapacity(string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDedicatedCapacityAsync(string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePowerBIDedicatedSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockablePowerBIDedicatedSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityCapacity(Azure.Core.AzureLocation location, Azure.ResourceManager.PowerBIDedicated.Models.CheckCapacityNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityCapacityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.PowerBIDedicated.Models.CheckCapacityNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAutoScaleVCores(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAutoScaleVCoresAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDedicatedCapacities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDedicatedCapacitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkusCapacities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusCapacitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.PowerBIDedicated.Models { public static partial class ArmPowerBIDedicatedModelFactory diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/AutoScaleVCoreResource.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/AutoScaleVCoreResource.cs index 9b524175879b7..24fdda31e3533 100644 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/AutoScaleVCoreResource.cs +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/AutoScaleVCoreResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.PowerBIDedicated public partial class AutoScaleVCoreResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vcoreName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vcoreName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/autoScaleVCores/{vcoreName}"; diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/DedicatedCapacityResource.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/DedicatedCapacityResource.cs index 9cc7c143d19c5..6aca40ec2f368 100644 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/DedicatedCapacityResource.cs +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/DedicatedCapacityResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.PowerBIDedicated public partial class DedicatedCapacityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dedicatedCapacityName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dedicatedCapacityName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}"; diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedArmClient.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedArmClient.cs new file mode 100644 index 0000000000000..b71d89aa39805 --- /dev/null +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.PowerBIDedicated; + +namespace Azure.ResourceManager.PowerBIDedicated.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockablePowerBIDedicatedArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePowerBIDedicatedArmClient() + { + } + + /// 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 MockablePowerBIDedicatedArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockablePowerBIDedicatedArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DedicatedCapacityResource GetDedicatedCapacityResource(ResourceIdentifier id) + { + DedicatedCapacityResource.ValidateResourceId(id); + return new DedicatedCapacityResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutoScaleVCoreResource GetAutoScaleVCoreResource(ResourceIdentifier id) + { + AutoScaleVCoreResource.ValidateResourceId(id); + return new AutoScaleVCoreResource(Client, id); + } + } +} diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedResourceGroupResource.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedResourceGroupResource.cs new file mode 100644 index 0000000000000..991777f3cc9c0 --- /dev/null +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.PowerBIDedicated; + +namespace Azure.ResourceManager.PowerBIDedicated.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockablePowerBIDedicatedResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePowerBIDedicatedResourceGroupResource() + { + } + + /// 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 MockablePowerBIDedicatedResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DedicatedCapacityResources in the ResourceGroupResource. + /// An object representing collection of DedicatedCapacityResources and their operations over a DedicatedCapacityResource. + public virtual DedicatedCapacityCollection GetDedicatedCapacities() + { + return GetCachedClient(client => new DedicatedCapacityCollection(client, Id)); + } + + /// + /// Gets details about the specified dedicated capacity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName} + /// + /// + /// Operation Id + /// Capacities_GetDetails + /// + /// + /// + /// The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDedicatedCapacityAsync(string dedicatedCapacityName, CancellationToken cancellationToken = default) + { + return await GetDedicatedCapacities().GetAsync(dedicatedCapacityName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details about the specified dedicated capacity. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName} + /// + /// + /// Operation Id + /// Capacities_GetDetails + /// + /// + /// + /// The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDedicatedCapacity(string dedicatedCapacityName, CancellationToken cancellationToken = default) + { + return GetDedicatedCapacities().Get(dedicatedCapacityName, cancellationToken); + } + + /// Gets a collection of AutoScaleVCoreResources in the ResourceGroupResource. + /// An object representing collection of AutoScaleVCoreResources and their operations over a AutoScaleVCoreResource. + public virtual AutoScaleVCoreCollection GetAutoScaleVCores() + { + return GetCachedClient(client => new AutoScaleVCoreCollection(client, Id)); + } + + /// + /// Gets details about the specified auto scale v-core. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/autoScaleVCores/{vcoreName} + /// + /// + /// Operation Id + /// AutoScaleVCores_Get + /// + /// + /// + /// The name of the auto scale v-core. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutoScaleVCoreAsync(string vcoreName, CancellationToken cancellationToken = default) + { + return await GetAutoScaleVCores().GetAsync(vcoreName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details about the specified auto scale v-core. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/autoScaleVCores/{vcoreName} + /// + /// + /// Operation Id + /// AutoScaleVCores_Get + /// + /// + /// + /// The name of the auto scale v-core. It must be a minimum of 3 characters, and a maximum of 63. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutoScaleVCore(string vcoreName, CancellationToken cancellationToken = default) + { + return GetAutoScaleVCores().Get(vcoreName, cancellationToken); + } + } +} diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedSubscriptionResource.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedSubscriptionResource.cs new file mode 100644 index 0000000000000..a3427f41f3541 --- /dev/null +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/MockablePowerBIDedicatedSubscriptionResource.cs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PowerBIDedicated; +using Azure.ResourceManager.PowerBIDedicated.Models; + +namespace Azure.ResourceManager.PowerBIDedicated.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockablePowerBIDedicatedSubscriptionResource : ArmResource + { + private ClientDiagnostics _dedicatedCapacityCapacitiesClientDiagnostics; + private CapacitiesRestOperations _dedicatedCapacityCapacitiesRestClient; + private ClientDiagnostics _autoScaleVCoreClientDiagnostics; + private AutoScaleVCoresRestOperations _autoScaleVCoreRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePowerBIDedicatedSubscriptionResource() + { + } + + /// 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 MockablePowerBIDedicatedSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DedicatedCapacityCapacitiesClientDiagnostics => _dedicatedCapacityCapacitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PowerBIDedicated", DedicatedCapacityResource.ResourceType.Namespace, Diagnostics); + private CapacitiesRestOperations DedicatedCapacityCapacitiesRestClient => _dedicatedCapacityCapacitiesRestClient ??= new CapacitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DedicatedCapacityResource.ResourceType)); + private ClientDiagnostics AutoScaleVCoreClientDiagnostics => _autoScaleVCoreClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PowerBIDedicated", AutoScaleVCoreResource.ResourceType.Namespace, Diagnostics); + private AutoScaleVCoresRestOperations AutoScaleVCoreRestClient => _autoScaleVCoreRestClient ??= new AutoScaleVCoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AutoScaleVCoreResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all the Dedicated capacities for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/capacities + /// + /// + /// Operation Id + /// Capacities_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDedicatedCapacitiesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedCapacityCapacitiesRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new DedicatedCapacityResource(Client, DedicatedCapacityData.DeserializeDedicatedCapacityData(e)), DedicatedCapacityCapacitiesClientDiagnostics, Pipeline, "MockablePowerBIDedicatedSubscriptionResource.GetDedicatedCapacities", "value", null, cancellationToken); + } + + /// + /// Lists all the Dedicated capacities for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/capacities + /// + /// + /// Operation Id + /// Capacities_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDedicatedCapacities(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedCapacityCapacitiesRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new DedicatedCapacityResource(Client, DedicatedCapacityData.DeserializeDedicatedCapacityData(e)), DedicatedCapacityCapacitiesClientDiagnostics, Pipeline, "MockablePowerBIDedicatedSubscriptionResource.GetDedicatedCapacities", "value", null, cancellationToken); + } + + /// + /// Lists eligible SKUs for PowerBI Dedicated resource provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/skus + /// + /// + /// Operation Id + /// Capacities_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusCapacitiesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedCapacityCapacitiesRestClient.CreateListSkusRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CapacitySku.DeserializeCapacitySku, DedicatedCapacityCapacitiesClientDiagnostics, Pipeline, "MockablePowerBIDedicatedSubscriptionResource.GetSkusCapacities", "value", null, cancellationToken); + } + + /// + /// Lists eligible SKUs for PowerBI Dedicated resource provider. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/skus + /// + /// + /// Operation Id + /// Capacities_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkusCapacities(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedCapacityCapacitiesRestClient.CreateListSkusRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CapacitySku.DeserializeCapacitySku, DedicatedCapacityCapacitiesClientDiagnostics, Pipeline, "MockablePowerBIDedicatedSubscriptionResource.GetSkusCapacities", "value", null, cancellationToken); + } + + /// + /// Check the name availability in the target location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Capacities_CheckNameAvailability + /// + /// + /// + /// The region name which the operation will lookup into. + /// The name of the capacity. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNameAvailabilityCapacityAsync(AzureLocation location, CheckCapacityNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DedicatedCapacityCapacitiesClientDiagnostics.CreateScope("MockablePowerBIDedicatedSubscriptionResource.CheckNameAvailabilityCapacity"); + scope.Start(); + try + { + var response = await DedicatedCapacityCapacitiesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the name availability in the target location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// Capacities_CheckNameAvailability + /// + /// + /// + /// The region name which the operation will lookup into. + /// The name of the capacity. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNameAvailabilityCapacity(AzureLocation location, CheckCapacityNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DedicatedCapacityCapacitiesClientDiagnostics.CreateScope("MockablePowerBIDedicatedSubscriptionResource.CheckNameAvailabilityCapacity"); + scope.Start(); + try + { + var response = DedicatedCapacityCapacitiesRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the auto scale v-cores for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/autoScaleVCores + /// + /// + /// Operation Id + /// AutoScaleVCores_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAutoScaleVCoresAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AutoScaleVCoreRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutoScaleVCoreResource(Client, AutoScaleVCoreData.DeserializeAutoScaleVCoreData(e)), AutoScaleVCoreClientDiagnostics, Pipeline, "MockablePowerBIDedicatedSubscriptionResource.GetAutoScaleVCores", "value", null, cancellationToken); + } + + /// + /// Lists all the auto scale v-cores for the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/autoScaleVCores + /// + /// + /// Operation Id + /// AutoScaleVCores_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAutoScaleVCores(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AutoScaleVCoreRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutoScaleVCoreResource(Client, AutoScaleVCoreData.DeserializeAutoScaleVCoreData(e)), AutoScaleVCoreClientDiagnostics, Pipeline, "MockablePowerBIDedicatedSubscriptionResource.GetAutoScaleVCores", "value", null, cancellationToken); + } + } +} diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/PowerBIDedicatedExtensions.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/PowerBIDedicatedExtensions.cs index 70eab902cfdfb..a0a18c135654c 100644 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/PowerBIDedicatedExtensions.cs +++ b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/PowerBIDedicatedExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.PowerBIDedicated.Mocking; using Azure.ResourceManager.PowerBIDedicated.Models; using Azure.ResourceManager.Resources; @@ -19,81 +20,65 @@ namespace Azure.ResourceManager.PowerBIDedicated /// A class to add extension methods to Azure.ResourceManager.PowerBIDedicated. public static partial class PowerBIDedicatedExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockablePowerBIDedicatedArmClient GetMockablePowerBIDedicatedArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockablePowerBIDedicatedArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePowerBIDedicatedResourceGroupResource GetMockablePowerBIDedicatedResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePowerBIDedicatedResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockablePowerBIDedicatedSubscriptionResource GetMockablePowerBIDedicatedSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePowerBIDedicatedSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DedicatedCapacityResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DedicatedCapacityResource GetDedicatedCapacityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DedicatedCapacityResource.ValidateResourceId(id); - return new DedicatedCapacityResource(client, id); - } - ); + return GetMockablePowerBIDedicatedArmClient(client).GetDedicatedCapacityResource(id); } - #endregion - #region AutoScaleVCoreResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AutoScaleVCoreResource GetAutoScaleVCoreResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AutoScaleVCoreResource.ValidateResourceId(id); - return new AutoScaleVCoreResource(client, id); - } - ); + return GetMockablePowerBIDedicatedArmClient(client).GetAutoScaleVCoreResource(id); } - #endregion - /// Gets a collection of DedicatedCapacityResources in the ResourceGroupResource. + /// + /// Gets a collection of DedicatedCapacityResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DedicatedCapacityResources and their operations over a DedicatedCapacityResource. public static DedicatedCapacityCollection GetDedicatedCapacities(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDedicatedCapacities(); + return GetMockablePowerBIDedicatedResourceGroupResource(resourceGroupResource).GetDedicatedCapacities(); } /// @@ -108,16 +93,20 @@ public static DedicatedCapacityCollection GetDedicatedCapacities(this ResourceGr /// Capacities_GetDetails /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDedicatedCapacityAsync(this ResourceGroupResource resourceGroupResource, string dedicatedCapacityName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDedicatedCapacities().GetAsync(dedicatedCapacityName, cancellationToken).ConfigureAwait(false); + return await GetMockablePowerBIDedicatedResourceGroupResource(resourceGroupResource).GetDedicatedCapacityAsync(dedicatedCapacityName, cancellationToken).ConfigureAwait(false); } /// @@ -132,24 +121,34 @@ public static async Task> GetDedicatedCapaci /// Capacities_GetDetails /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDedicatedCapacity(this ResourceGroupResource resourceGroupResource, string dedicatedCapacityName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDedicatedCapacities().Get(dedicatedCapacityName, cancellationToken); + return GetMockablePowerBIDedicatedResourceGroupResource(resourceGroupResource).GetDedicatedCapacity(dedicatedCapacityName, cancellationToken); } - /// Gets a collection of AutoScaleVCoreResources in the ResourceGroupResource. + /// + /// Gets a collection of AutoScaleVCoreResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AutoScaleVCoreResources and their operations over a AutoScaleVCoreResource. public static AutoScaleVCoreCollection GetAutoScaleVCores(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAutoScaleVCores(); + return GetMockablePowerBIDedicatedResourceGroupResource(resourceGroupResource).GetAutoScaleVCores(); } /// @@ -164,16 +163,20 @@ public static AutoScaleVCoreCollection GetAutoScaleVCores(this ResourceGroupReso /// AutoScaleVCores_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the auto scale v-core. It must be a minimum of 3 characters, and a maximum of 63. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutoScaleVCoreAsync(this ResourceGroupResource resourceGroupResource, string vcoreName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAutoScaleVCores().GetAsync(vcoreName, cancellationToken).ConfigureAwait(false); + return await GetMockablePowerBIDedicatedResourceGroupResource(resourceGroupResource).GetAutoScaleVCoreAsync(vcoreName, cancellationToken).ConfigureAwait(false); } /// @@ -188,16 +191,20 @@ public static async Task> GetAutoScaleVCoreAsyn /// AutoScaleVCores_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the auto scale v-core. It must be a minimum of 3 characters, and a maximum of 63. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutoScaleVCore(this ResourceGroupResource resourceGroupResource, string vcoreName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAutoScaleVCores().Get(vcoreName, cancellationToken); + return GetMockablePowerBIDedicatedResourceGroupResource(resourceGroupResource).GetAutoScaleVCore(vcoreName, cancellationToken); } /// @@ -212,13 +219,17 @@ public static Response GetAutoScaleVCore(this ResourceGr /// Capacities_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDedicatedCapacitiesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDedicatedCapacitiesAsync(cancellationToken); + return GetMockablePowerBIDedicatedSubscriptionResource(subscriptionResource).GetDedicatedCapacitiesAsync(cancellationToken); } /// @@ -233,13 +244,17 @@ public static AsyncPageable GetDedicatedCapacitiesAsy /// Capacities_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDedicatedCapacities(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDedicatedCapacities(cancellationToken); + return GetMockablePowerBIDedicatedSubscriptionResource(subscriptionResource).GetDedicatedCapacities(cancellationToken); } /// @@ -254,13 +269,17 @@ public static Pageable GetDedicatedCapacities(this Su /// Capacities_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkusCapacitiesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusCapacitiesAsync(cancellationToken); + return GetMockablePowerBIDedicatedSubscriptionResource(subscriptionResource).GetSkusCapacitiesAsync(cancellationToken); } /// @@ -275,13 +294,17 @@ public static AsyncPageable GetSkusCapacitiesAsync(this Subscriptio /// Capacities_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkusCapacities(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusCapacities(cancellationToken); + return GetMockablePowerBIDedicatedSubscriptionResource(subscriptionResource).GetSkusCapacities(cancellationToken); } /// @@ -296,6 +319,10 @@ public static Pageable GetSkusCapacities(this SubscriptionResource /// Capacities_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region name which the operation will lookup into. @@ -304,9 +331,7 @@ public static Pageable GetSkusCapacities(this SubscriptionResource /// is null. public static async Task> CheckNameAvailabilityCapacityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CheckCapacityNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityCapacityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockablePowerBIDedicatedSubscriptionResource(subscriptionResource).CheckNameAvailabilityCapacityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -321,6 +346,10 @@ public static async Task> CheckNam /// Capacities_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region name which the operation will lookup into. @@ -329,9 +358,7 @@ public static async Task> CheckNam /// is null. public static Response CheckNameAvailabilityCapacity(this SubscriptionResource subscriptionResource, AzureLocation location, CheckCapacityNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityCapacity(location, content, cancellationToken); + return GetMockablePowerBIDedicatedSubscriptionResource(subscriptionResource).CheckNameAvailabilityCapacity(location, content, cancellationToken); } /// @@ -346,13 +373,17 @@ public static Response CheckNameAvailabilit /// AutoScaleVCores_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAutoScaleVCoresAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutoScaleVCoresAsync(cancellationToken); + return GetMockablePowerBIDedicatedSubscriptionResource(subscriptionResource).GetAutoScaleVCoresAsync(cancellationToken); } /// @@ -367,13 +398,17 @@ public static AsyncPageable GetAutoScaleVCoresAsync(this /// AutoScaleVCores_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAutoScaleVCores(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutoScaleVCores(cancellationToken); + return GetMockablePowerBIDedicatedSubscriptionResource(subscriptionResource).GetAutoScaleVCores(cancellationToken); } } } diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index b5a6b737ef051..0000000000000 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PowerBIDedicated -{ - /// 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 DedicatedCapacityResources in the ResourceGroupResource. - /// An object representing collection of DedicatedCapacityResources and their operations over a DedicatedCapacityResource. - public virtual DedicatedCapacityCollection GetDedicatedCapacities() - { - return GetCachedClient(Client => new DedicatedCapacityCollection(Client, Id)); - } - - /// Gets a collection of AutoScaleVCoreResources in the ResourceGroupResource. - /// An object representing collection of AutoScaleVCoreResources and their operations over a AutoScaleVCoreResource. - public virtual AutoScaleVCoreCollection GetAutoScaleVCores() - { - return GetCachedClient(Client => new AutoScaleVCoreCollection(Client, Id)); - } - } -} diff --git a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 43d508f594bc5..0000000000000 --- a/sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.PowerBIDedicated.Models; - -namespace Azure.ResourceManager.PowerBIDedicated -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dedicatedCapacityCapacitiesClientDiagnostics; - private CapacitiesRestOperations _dedicatedCapacityCapacitiesRestClient; - private ClientDiagnostics _autoScaleVCoreClientDiagnostics; - private AutoScaleVCoresRestOperations _autoScaleVCoreRestClient; - - /// 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 DedicatedCapacityCapacitiesClientDiagnostics => _dedicatedCapacityCapacitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PowerBIDedicated", DedicatedCapacityResource.ResourceType.Namespace, Diagnostics); - private CapacitiesRestOperations DedicatedCapacityCapacitiesRestClient => _dedicatedCapacityCapacitiesRestClient ??= new CapacitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DedicatedCapacityResource.ResourceType)); - private ClientDiagnostics AutoScaleVCoreClientDiagnostics => _autoScaleVCoreClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PowerBIDedicated", AutoScaleVCoreResource.ResourceType.Namespace, Diagnostics); - private AutoScaleVCoresRestOperations AutoScaleVCoreRestClient => _autoScaleVCoreRestClient ??= new AutoScaleVCoresRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AutoScaleVCoreResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all the Dedicated capacities for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/capacities - /// - /// - /// Operation Id - /// Capacities_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDedicatedCapacitiesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedCapacityCapacitiesRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new DedicatedCapacityResource(Client, DedicatedCapacityData.DeserializeDedicatedCapacityData(e)), DedicatedCapacityCapacitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedCapacities", "value", null, cancellationToken); - } - - /// - /// Lists all the Dedicated capacities for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/capacities - /// - /// - /// Operation Id - /// Capacities_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDedicatedCapacities(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedCapacityCapacitiesRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new DedicatedCapacityResource(Client, DedicatedCapacityData.DeserializeDedicatedCapacityData(e)), DedicatedCapacityCapacitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDedicatedCapacities", "value", null, cancellationToken); - } - - /// - /// Lists eligible SKUs for PowerBI Dedicated resource provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/skus - /// - /// - /// Operation Id - /// Capacities_ListSkus - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusCapacitiesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedCapacityCapacitiesRestClient.CreateListSkusRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, CapacitySku.DeserializeCapacitySku, DedicatedCapacityCapacitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkusCapacities", "value", null, cancellationToken); - } - - /// - /// Lists eligible SKUs for PowerBI Dedicated resource provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/skus - /// - /// - /// Operation Id - /// Capacities_ListSkus - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkusCapacities(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedCapacityCapacitiesRestClient.CreateListSkusRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, CapacitySku.DeserializeCapacitySku, DedicatedCapacityCapacitiesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkusCapacities", "value", null, cancellationToken); - } - - /// - /// Check the name availability in the target location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Capacities_CheckNameAvailability - /// - /// - /// - /// The region name which the operation will lookup into. - /// The name of the capacity. - /// The cancellation token to use. - public virtual async Task> CheckNameAvailabilityCapacityAsync(AzureLocation location, CheckCapacityNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DedicatedCapacityCapacitiesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityCapacity"); - scope.Start(); - try - { - var response = await DedicatedCapacityCapacitiesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the name availability in the target location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// Capacities_CheckNameAvailability - /// - /// - /// - /// The region name which the operation will lookup into. - /// The name of the capacity. - /// The cancellation token to use. - public virtual Response CheckNameAvailabilityCapacity(AzureLocation location, CheckCapacityNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DedicatedCapacityCapacitiesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityCapacity"); - scope.Start(); - try - { - var response = DedicatedCapacityCapacitiesRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all the auto scale v-cores for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/autoScaleVCores - /// - /// - /// Operation Id - /// AutoScaleVCores_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAutoScaleVCoresAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AutoScaleVCoreRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AutoScaleVCoreResource(Client, AutoScaleVCoreData.DeserializeAutoScaleVCoreData(e)), AutoScaleVCoreClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutoScaleVCores", "value", null, cancellationToken); - } - - /// - /// Lists all the auto scale v-cores for the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/autoScaleVCores - /// - /// - /// Operation Id - /// AutoScaleVCores_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAutoScaleVCores(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AutoScaleVCoreRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AutoScaleVCoreResource(Client, AutoScaleVCoreData.DeserializeAutoScaleVCoreData(e)), AutoScaleVCoreClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAutoScaleVCores", "value", null, cancellationToken); - } - } -} diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/Azure.ResourceManager.PrivateDns.sln b/sdk/privatedns/Azure.ResourceManager.PrivateDns/Azure.ResourceManager.PrivateDns.sln index b11744591625d..cc5aa0c0e71d4 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/Azure.ResourceManager.PrivateDns.sln +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/Azure.ResourceManager.PrivateDns.sln @@ -1,21 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BCCA942-A639-4B72-9A08-F74AFF80121D}") = "Azure.ResourceManager.PrivateDns", "src\Azure.ResourceManager.PrivateDns.csproj", "{4F3323E1-DBDE-45CD-81D6-9F755B11E3B9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.PrivateDns", "src\Azure.ResourceManager.PrivateDns.csproj", "{4F3323E1-DBDE-45CD-81D6-9F755B11E3B9}" EndProject -Project("{8BCCA942-A639-4B72-9A08-F74AFF80121D}") = "Azure.ResourceManager.PrivateDns.Tests", "tests\Azure.ResourceManager.PrivateDns.Tests.csproj", "{AE92756D-428C-41B1-B264-1671BCAB9262}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.PrivateDns.Tests", "tests\Azure.ResourceManager.PrivateDns.Tests.csproj", "{AE92756D-428C-41B1-B264-1671BCAB9262}" EndProject -Project("{8BCCA942-A639-4B72-9A08-F74AFF80121D}") = "Azure.ResourceManager.PrivateDns.Samples", "samples\Azure.ResourceManager.PrivateDns.Samples.csproj", "{CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.PrivateDns.Samples", "samples\Azure.ResourceManager.PrivateDns.Samples.csproj", "{CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}" EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {9A33B00E-DD4E-4F38-8880-6916FFD057E9} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -49,5 +43,23 @@ Global {AE92756D-428C-41B1-B264-1671BCAB9262}.Release|x64.Build.0 = Release|Any CPU {AE92756D-428C-41B1-B264-1671BCAB9262}.Release|x86.ActiveCfg = Release|Any CPU {AE92756D-428C-41B1-B264-1671BCAB9262}.Release|x86.Build.0 = Release|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Debug|x64.ActiveCfg = Debug|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Debug|x64.Build.0 = Debug|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Debug|x86.ActiveCfg = Debug|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Debug|x86.Build.0 = Debug|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Release|Any CPU.Build.0 = Release|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Release|x64.ActiveCfg = Release|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Release|x64.Build.0 = Release|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Release|x86.ActiveCfg = Release|Any CPU + {CCC31236-7E37-4AC3-8BA4-4FDD23E87CB4}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9A33B00E-DD4E-4F38-8880-6916FFD057E9} EndGlobalSection EndGlobal diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/api/Azure.ResourceManager.PrivateDns.netstandard2.0.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/api/Azure.ResourceManager.PrivateDns.netstandard2.0.cs index 8aba72ee01a27..247fa7b8158f8 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/api/Azure.ResourceManager.PrivateDns.netstandard2.0.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/api/Azure.ResourceManager.PrivateDns.netstandard2.0.cs @@ -328,7 +328,7 @@ protected PrivateDnsZoneCollection() { } } public partial class PrivateDnsZoneData : Azure.ResourceManager.Models.TrackedResourceData { - public PrivateDnsZoneData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PrivateDnsZoneData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public string InternalId { get { throw null; } } public long? MaxNumberOfRecords { get { throw null; } } @@ -407,7 +407,7 @@ protected VirtualNetworkLinkCollection() { } } public partial class VirtualNetworkLinkData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualNetworkLinkData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualNetworkLinkData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.PrivateDns.Models.PrivateDnsProvisioningState? PrivateDnsProvisioningState { get { throw null; } } public bool? RegistrationEnabled { get { throw null; } set { } } @@ -435,6 +435,36 @@ protected VirtualNetworkLinkResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.PrivateDns.VirtualNetworkLinkData data, Azure.ETag? ifMatch = default(Azure.ETag?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.PrivateDns.Mocking +{ + public partial class MockablePrivateDnsArmClient : Azure.ResourceManager.ArmResource + { + protected MockablePrivateDnsArmClient() { } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsAaaaRecordResource GetPrivateDnsAaaaRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsARecordResource GetPrivateDnsARecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsCnameRecordResource GetPrivateDnsCnameRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsMXRecordResource GetPrivateDnsMXRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsPtrRecordResource GetPrivateDnsPtrRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsSoaRecordResource GetPrivateDnsSoaRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsSrvRecordResource GetPrivateDnsSrvRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsTxtRecordResource GetPrivateDnsTxtRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsZoneResource GetPrivateDnsZoneResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.VirtualNetworkLinkResource GetVirtualNetworkLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockablePrivateDnsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePrivateDnsResourceGroupResource() { } + public virtual Azure.Response GetPrivateDnsZone(string privateZoneName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPrivateDnsZoneAsync(string privateZoneName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PrivateDns.PrivateDnsZoneCollection GetPrivateDnsZones() { throw null; } + } + public partial class MockablePrivateDnsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockablePrivateDnsSubscriptionResource() { } + public virtual Azure.Pageable GetPrivateDnsZones(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateDnsZonesAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.PrivateDns.Models { public static partial class ArmPrivateDnsModelFactory diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsArmClient.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsArmClient.cs new file mode 100644 index 0000000000000..6cf87fa806d3f --- /dev/null +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsArmClient.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.PrivateDns; + +namespace Azure.ResourceManager.PrivateDns.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockablePrivateDnsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePrivateDnsArmClient() + { + } + + /// 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 MockablePrivateDnsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockablePrivateDnsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsZoneResource GetPrivateDnsZoneResource(ResourceIdentifier id) + { + PrivateDnsZoneResource.ValidateResourceId(id); + return new PrivateDnsZoneResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualNetworkLinkResource GetVirtualNetworkLinkResource(ResourceIdentifier id) + { + VirtualNetworkLinkResource.ValidateResourceId(id); + return new VirtualNetworkLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsARecordResource GetPrivateDnsARecordResource(ResourceIdentifier id) + { + PrivateDnsARecordResource.ValidateResourceId(id); + return new PrivateDnsARecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsAaaaRecordResource GetPrivateDnsAaaaRecordResource(ResourceIdentifier id) + { + PrivateDnsAaaaRecordResource.ValidateResourceId(id); + return new PrivateDnsAaaaRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsCnameRecordResource GetPrivateDnsCnameRecordResource(ResourceIdentifier id) + { + PrivateDnsCnameRecordResource.ValidateResourceId(id); + return new PrivateDnsCnameRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsMXRecordResource GetPrivateDnsMXRecordResource(ResourceIdentifier id) + { + PrivateDnsMXRecordResource.ValidateResourceId(id); + return new PrivateDnsMXRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsPtrRecordResource GetPrivateDnsPtrRecordResource(ResourceIdentifier id) + { + PrivateDnsPtrRecordResource.ValidateResourceId(id); + return new PrivateDnsPtrRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsSoaRecordResource GetPrivateDnsSoaRecordResource(ResourceIdentifier id) + { + PrivateDnsSoaRecordResource.ValidateResourceId(id); + return new PrivateDnsSoaRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsSrvRecordResource GetPrivateDnsSrvRecordResource(ResourceIdentifier id) + { + PrivateDnsSrvRecordResource.ValidateResourceId(id); + return new PrivateDnsSrvRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PrivateDnsTxtRecordResource GetPrivateDnsTxtRecordResource(ResourceIdentifier id) + { + PrivateDnsTxtRecordResource.ValidateResourceId(id); + return new PrivateDnsTxtRecordResource(Client, id); + } + } +} diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsResourceGroupResource.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsResourceGroupResource.cs new file mode 100644 index 0000000000000..f1265cee79e8f --- /dev/null +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.PrivateDns; + +namespace Azure.ResourceManager.PrivateDns.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockablePrivateDnsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePrivateDnsResourceGroupResource() + { + } + + /// 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 MockablePrivateDnsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PrivateDnsZoneResources in the ResourceGroupResource. + /// An object representing collection of PrivateDnsZoneResources and their operations over a PrivateDnsZoneResource. + public virtual PrivateDnsZoneCollection GetPrivateDnsZones() + { + return GetCachedClient(client => new PrivateDnsZoneCollection(client, Id)); + } + + /// + /// Gets a Private DNS zone. Retrieves the zone properties, but not the virtual networks links or the record sets within the zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName} + /// + /// + /// Operation Id + /// PrivateZones_Get + /// + /// + /// + /// The name of the Private DNS zone (without a terminating dot). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPrivateDnsZoneAsync(string privateZoneName, CancellationToken cancellationToken = default) + { + return await GetPrivateDnsZones().GetAsync(privateZoneName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Private DNS zone. Retrieves the zone properties, but not the virtual networks links or the record sets within the zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName} + /// + /// + /// Operation Id + /// PrivateZones_Get + /// + /// + /// + /// The name of the Private DNS zone (without a terminating dot). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPrivateDnsZone(string privateZoneName, CancellationToken cancellationToken = default) + { + return GetPrivateDnsZones().Get(privateZoneName, cancellationToken); + } + } +} diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsSubscriptionResource.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsSubscriptionResource.cs new file mode 100644 index 0000000000000..071262b447a53 --- /dev/null +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsSubscriptionResource.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.PrivateDns; + +namespace Azure.ResourceManager.PrivateDns.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockablePrivateDnsSubscriptionResource : ArmResource + { + private ClientDiagnostics _privateDnsZonePrivateZonesClientDiagnostics; + private PrivateZonesRestOperations _privateDnsZonePrivateZonesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePrivateDnsSubscriptionResource() + { + } + + /// 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 MockablePrivateDnsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PrivateDnsZonePrivateZonesClientDiagnostics => _privateDnsZonePrivateZonesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PrivateDns", PrivateDnsZoneResource.ResourceType.Namespace, Diagnostics); + private PrivateZonesRestOperations PrivateDnsZonePrivateZonesRestClient => _privateDnsZonePrivateZonesRestClient ??= new PrivateZonesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PrivateDnsZoneResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the Private DNS zones in all resource groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones + /// + /// + /// Operation Id + /// PrivateZones_List + /// + /// + /// + /// The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPrivateDnsZonesAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateDnsZonePrivateZonesRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateDnsZonePrivateZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PrivateDnsZoneResource(Client, PrivateDnsZoneData.DeserializePrivateDnsZoneData(e)), PrivateDnsZonePrivateZonesClientDiagnostics, Pipeline, "MockablePrivateDnsSubscriptionResource.GetPrivateDnsZones", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the Private DNS zones in all resource groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones + /// + /// + /// Operation Id + /// PrivateZones_List + /// + /// + /// + /// The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPrivateDnsZones(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateDnsZonePrivateZonesRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateDnsZonePrivateZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PrivateDnsZoneResource(Client, PrivateDnsZoneData.DeserializePrivateDnsZoneData(e)), PrivateDnsZonePrivateZonesClientDiagnostics, Pipeline, "MockablePrivateDnsSubscriptionResource.GetPrivateDnsZones", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/PrivateDnsExtensions.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/PrivateDnsExtensions.cs index ed7989f2e08d2..1e21edfa68021 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/PrivateDnsExtensions.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/PrivateDnsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.PrivateDns.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.PrivateDns @@ -18,233 +19,193 @@ namespace Azure.ResourceManager.PrivateDns /// A class to add extension methods to Azure.ResourceManager.PrivateDns. public static partial class PrivateDnsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockablePrivateDnsArmClient GetMockablePrivateDnsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockablePrivateDnsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePrivateDnsResourceGroupResource GetMockablePrivateDnsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePrivateDnsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockablePrivateDnsSubscriptionResource GetMockablePrivateDnsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePrivateDnsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region PrivateDnsZoneResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsZoneResource GetPrivateDnsZoneResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsZoneResource.ValidateResourceId(id); - return new PrivateDnsZoneResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsZoneResource(id); } - #endregion - #region VirtualNetworkLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualNetworkLinkResource GetVirtualNetworkLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualNetworkLinkResource.ValidateResourceId(id); - return new VirtualNetworkLinkResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetVirtualNetworkLinkResource(id); } - #endregion - #region PrivateDnsARecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsARecordResource GetPrivateDnsARecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsARecordResource.ValidateResourceId(id); - return new PrivateDnsARecordResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsARecordResource(id); } - #endregion - #region PrivateDnsAaaaRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsAaaaRecordResource GetPrivateDnsAaaaRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsAaaaRecordResource.ValidateResourceId(id); - return new PrivateDnsAaaaRecordResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsAaaaRecordResource(id); } - #endregion - #region PrivateDnsCnameRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsCnameRecordResource GetPrivateDnsCnameRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsCnameRecordResource.ValidateResourceId(id); - return new PrivateDnsCnameRecordResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsCnameRecordResource(id); } - #endregion - #region PrivateDnsMXRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsMXRecordResource GetPrivateDnsMXRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsMXRecordResource.ValidateResourceId(id); - return new PrivateDnsMXRecordResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsMXRecordResource(id); } - #endregion - #region PrivateDnsPtrRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsPtrRecordResource GetPrivateDnsPtrRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsPtrRecordResource.ValidateResourceId(id); - return new PrivateDnsPtrRecordResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsPtrRecordResource(id); } - #endregion - #region PrivateDnsSoaRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsSoaRecordResource GetPrivateDnsSoaRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsSoaRecordResource.ValidateResourceId(id); - return new PrivateDnsSoaRecordResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsSoaRecordResource(id); } - #endregion - #region PrivateDnsSrvRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsSrvRecordResource GetPrivateDnsSrvRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsSrvRecordResource.ValidateResourceId(id); - return new PrivateDnsSrvRecordResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsSrvRecordResource(id); } - #endregion - #region PrivateDnsTxtRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PrivateDnsTxtRecordResource GetPrivateDnsTxtRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PrivateDnsTxtRecordResource.ValidateResourceId(id); - return new PrivateDnsTxtRecordResource(client, id); - } - ); + return GetMockablePrivateDnsArmClient(client).GetPrivateDnsTxtRecordResource(id); } - #endregion - /// Gets a collection of PrivateDnsZoneResources in the ResourceGroupResource. + /// + /// Gets a collection of PrivateDnsZoneResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PrivateDnsZoneResources and their operations over a PrivateDnsZoneResource. public static PrivateDnsZoneCollection GetPrivateDnsZones(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPrivateDnsZones(); + return GetMockablePrivateDnsResourceGroupResource(resourceGroupResource).GetPrivateDnsZones(); } /// @@ -259,16 +220,20 @@ public static PrivateDnsZoneCollection GetPrivateDnsZones(this ResourceGroupReso /// PrivateZones_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Private DNS zone (without a terminating dot). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPrivateDnsZoneAsync(this ResourceGroupResource resourceGroupResource, string privateZoneName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPrivateDnsZones().GetAsync(privateZoneName, cancellationToken).ConfigureAwait(false); + return await GetMockablePrivateDnsResourceGroupResource(resourceGroupResource).GetPrivateDnsZoneAsync(privateZoneName, cancellationToken).ConfigureAwait(false); } /// @@ -283,16 +248,20 @@ public static async Task> GetPrivateDnsZoneAsyn /// PrivateZones_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Private DNS zone (without a terminating dot). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPrivateDnsZone(this ResourceGroupResource resourceGroupResource, string privateZoneName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPrivateDnsZones().Get(privateZoneName, cancellationToken); + return GetMockablePrivateDnsResourceGroupResource(resourceGroupResource).GetPrivateDnsZone(privateZoneName, cancellationToken); } /// @@ -307,6 +276,10 @@ public static Response GetPrivateDnsZone(this ResourceGr /// PrivateZones_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. @@ -314,7 +287,7 @@ public static Response GetPrivateDnsZone(this ResourceGr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPrivateDnsZonesAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPrivateDnsZonesAsync(top, cancellationToken); + return GetMockablePrivateDnsSubscriptionResource(subscriptionResource).GetPrivateDnsZonesAsync(top, cancellationToken); } /// @@ -329,6 +302,10 @@ public static AsyncPageable GetPrivateDnsZonesAsync(this /// PrivateZones_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. @@ -336,7 +313,7 @@ public static AsyncPageable GetPrivateDnsZonesAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPrivateDnsZones(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPrivateDnsZones(top, cancellationToken); + return GetMockablePrivateDnsSubscriptionResource(subscriptionResource).GetPrivateDnsZones(top, cancellationToken); } } } diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index a8e2975e741f2..0000000000000 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PrivateDns -{ - /// 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 PrivateDnsZoneResources in the ResourceGroupResource. - /// An object representing collection of PrivateDnsZoneResources and their operations over a PrivateDnsZoneResource. - public virtual PrivateDnsZoneCollection GetPrivateDnsZones() - { - return GetCachedClient(Client => new PrivateDnsZoneCollection(Client, Id)); - } - } -} diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 2f5c45cb0b6b9..0000000000000 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.PrivateDns -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _privateDnsZonePrivateZonesClientDiagnostics; - private PrivateZonesRestOperations _privateDnsZonePrivateZonesRestClient; - - /// 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 PrivateDnsZonePrivateZonesClientDiagnostics => _privateDnsZonePrivateZonesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.PrivateDns", PrivateDnsZoneResource.ResourceType.Namespace, Diagnostics); - private PrivateZonesRestOperations PrivateDnsZonePrivateZonesRestClient => _privateDnsZonePrivateZonesRestClient ??= new PrivateZonesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PrivateDnsZoneResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists the Private DNS zones in all resource groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones - /// - /// - /// Operation Id - /// PrivateZones_List - /// - /// - /// - /// The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateDnsZonesAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateDnsZonePrivateZonesRestClient.CreateListRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateDnsZonePrivateZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PrivateDnsZoneResource(Client, PrivateDnsZoneData.DeserializePrivateDnsZoneData(e)), PrivateDnsZonePrivateZonesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPrivateDnsZones", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the Private DNS zones in all resource groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones - /// - /// - /// Operation Id - /// PrivateZones_List - /// - /// - /// - /// The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateDnsZones(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateDnsZonePrivateZonesRestClient.CreateListRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PrivateDnsZonePrivateZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PrivateDnsZoneResource(Client, PrivateDnsZoneData.DeserializePrivateDnsZoneData(e)), PrivateDnsZonePrivateZonesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPrivateDnsZones", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkResource.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkResource.cs index 5f92703670086..75cbb8b929ddd 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkResource.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.PrivateDns public partial class VirtualNetworkLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateZoneName. + /// The virtualNetworkLinkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateZoneName, string virtualNetworkLinkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}/virtualNetworkLinks/{virtualNetworkLinkName}"; diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/api/Azure.ResourceManager.ProviderHub.netstandard2.0.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/api/Azure.ResourceManager.ProviderHub.netstandard2.0.cs index 92d03e85c0b37..6a378ae5a54a5 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/api/Azure.ResourceManager.ProviderHub.netstandard2.0.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/api/Azure.ResourceManager.ProviderHub.netstandard2.0.cs @@ -353,6 +353,29 @@ protected ResourceTypeSkuResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ProviderHub.ResourceTypeSkuData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ProviderHub.Mocking +{ + public partial class MockableProviderHubArmClient : Azure.ResourceManager.ArmResource + { + protected MockableProviderHubArmClient() { } + public virtual Azure.ResourceManager.ProviderHub.CustomRolloutResource GetCustomRolloutResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.DefaultRolloutResource GetDefaultRolloutResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.NestedResourceTypeFirstSkuResource GetNestedResourceTypeFirstSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.NestedResourceTypeSecondSkuResource GetNestedResourceTypeSecondSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.NestedResourceTypeThirdSkuResource GetNestedResourceTypeThirdSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.NotificationRegistrationResource GetNotificationRegistrationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.ProviderRegistrationResource GetProviderRegistrationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.ResourceTypeRegistrationResource GetResourceTypeRegistrationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.ResourceTypeSkuResource GetResourceTypeSkuResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableProviderHubSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableProviderHubSubscriptionResource() { } + public virtual Azure.Response GetProviderRegistration(string providerNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetProviderRegistrationAsync(string providerNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ProviderHub.ProviderRegistrationCollection GetProviderRegistrations() { throw null; } + } +} namespace Azure.ResourceManager.ProviderHub.Models { public static partial class ArmProviderHubModelFactory diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/CustomRolloutResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/CustomRolloutResource.cs index 18caca98337d8..7616d001b509d 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/CustomRolloutResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/CustomRolloutResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ProviderHub public partial class CustomRolloutResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. + /// The rolloutName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace, string rolloutName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/customRollouts/{rolloutName}"; diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/DefaultRolloutResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/DefaultRolloutResource.cs index b341a8dcfdf72..931a38479f153 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/DefaultRolloutResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/DefaultRolloutResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ProviderHub public partial class DefaultRolloutResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. + /// The rolloutName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace, string rolloutName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/defaultRollouts/{rolloutName}"; diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/MockableProviderHubArmClient.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/MockableProviderHubArmClient.cs new file mode 100644 index 0000000000000..3f0abc3c23874 --- /dev/null +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/MockableProviderHubArmClient.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ProviderHub; + +namespace Azure.ResourceManager.ProviderHub.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableProviderHubArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableProviderHubArmClient() + { + } + + /// 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 MockableProviderHubArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableProviderHubArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CustomRolloutResource GetCustomRolloutResource(ResourceIdentifier id) + { + CustomRolloutResource.ValidateResourceId(id); + return new CustomRolloutResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DefaultRolloutResource GetDefaultRolloutResource(ResourceIdentifier id) + { + DefaultRolloutResource.ValidateResourceId(id); + return new DefaultRolloutResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NotificationRegistrationResource GetNotificationRegistrationResource(ResourceIdentifier id) + { + NotificationRegistrationResource.ValidateResourceId(id); + return new NotificationRegistrationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProviderRegistrationResource GetProviderRegistrationResource(ResourceIdentifier id) + { + ProviderRegistrationResource.ValidateResourceId(id); + return new ProviderRegistrationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceTypeRegistrationResource GetResourceTypeRegistrationResource(ResourceIdentifier id) + { + ResourceTypeRegistrationResource.ValidateResourceId(id); + return new ResourceTypeRegistrationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceTypeSkuResource GetResourceTypeSkuResource(ResourceIdentifier id) + { + ResourceTypeSkuResource.ValidateResourceId(id); + return new ResourceTypeSkuResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NestedResourceTypeFirstSkuResource GetNestedResourceTypeFirstSkuResource(ResourceIdentifier id) + { + NestedResourceTypeFirstSkuResource.ValidateResourceId(id); + return new NestedResourceTypeFirstSkuResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NestedResourceTypeSecondSkuResource GetNestedResourceTypeSecondSkuResource(ResourceIdentifier id) + { + NestedResourceTypeSecondSkuResource.ValidateResourceId(id); + return new NestedResourceTypeSecondSkuResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NestedResourceTypeThirdSkuResource GetNestedResourceTypeThirdSkuResource(ResourceIdentifier id) + { + NestedResourceTypeThirdSkuResource.ValidateResourceId(id); + return new NestedResourceTypeThirdSkuResource(Client, id); + } + } +} diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/MockableProviderHubSubscriptionResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/MockableProviderHubSubscriptionResource.cs new file mode 100644 index 0000000000000..2546d5c30f25f --- /dev/null +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/MockableProviderHubSubscriptionResource.cs @@ -0,0 +1,92 @@ +// 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.ProviderHub; + +namespace Azure.ResourceManager.ProviderHub.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableProviderHubSubscriptionResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableProviderHubSubscriptionResource() + { + } + + /// 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 MockableProviderHubSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ProviderRegistrationResources in the SubscriptionResource. + /// An object representing collection of ProviderRegistrationResources and their operations over a ProviderRegistrationResource. + public virtual ProviderRegistrationCollection GetProviderRegistrations() + { + return GetCachedClient(client => new ProviderRegistrationCollection(client, Id)); + } + + /// + /// Gets the provider registration details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace} + /// + /// + /// Operation Id + /// ProviderRegistrations_Get + /// + /// + /// + /// The name of the resource provider hosted within ProviderHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetProviderRegistrationAsync(string providerNamespace, CancellationToken cancellationToken = default) + { + return await GetProviderRegistrations().GetAsync(providerNamespace, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the provider registration details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace} + /// + /// + /// Operation Id + /// ProviderRegistrations_Get + /// + /// + /// + /// The name of the resource provider hosted within ProviderHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetProviderRegistration(string providerNamespace, CancellationToken cancellationToken = default) + { + return GetProviderRegistrations().Get(providerNamespace, cancellationToken); + } + } +} diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/ProviderHubExtensions.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/ProviderHubExtensions.cs index 0b8f18fdb731c..00ff3d2b6062d 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/ProviderHubExtensions.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/ProviderHubExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ProviderHub.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ProviderHub @@ -18,198 +19,172 @@ namespace Azure.ResourceManager.ProviderHub /// A class to add extension methods to Azure.ResourceManager.ProviderHub. public static partial class ProviderHubExtensions { - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableProviderHubArmClient GetMockableProviderHubArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableProviderHubArmClient(client0)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableProviderHubSubscriptionResource GetMockableProviderHubSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableProviderHubSubscriptionResource(client, resource.Id)); } - #region CustomRolloutResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CustomRolloutResource GetCustomRolloutResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CustomRolloutResource.ValidateResourceId(id); - return new CustomRolloutResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetCustomRolloutResource(id); } - #endregion - #region DefaultRolloutResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DefaultRolloutResource GetDefaultRolloutResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DefaultRolloutResource.ValidateResourceId(id); - return new DefaultRolloutResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetDefaultRolloutResource(id); } - #endregion - #region NotificationRegistrationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NotificationRegistrationResource GetNotificationRegistrationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NotificationRegistrationResource.ValidateResourceId(id); - return new NotificationRegistrationResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetNotificationRegistrationResource(id); } - #endregion - #region ProviderRegistrationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProviderRegistrationResource GetProviderRegistrationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProviderRegistrationResource.ValidateResourceId(id); - return new ProviderRegistrationResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetProviderRegistrationResource(id); } - #endregion - #region ResourceTypeRegistrationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourceTypeRegistrationResource GetResourceTypeRegistrationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceTypeRegistrationResource.ValidateResourceId(id); - return new ResourceTypeRegistrationResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetResourceTypeRegistrationResource(id); } - #endregion - #region ResourceTypeSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourceTypeSkuResource GetResourceTypeSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceTypeSkuResource.ValidateResourceId(id); - return new ResourceTypeSkuResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetResourceTypeSkuResource(id); } - #endregion - #region NestedResourceTypeFirstSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NestedResourceTypeFirstSkuResource GetNestedResourceTypeFirstSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NestedResourceTypeFirstSkuResource.ValidateResourceId(id); - return new NestedResourceTypeFirstSkuResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetNestedResourceTypeFirstSkuResource(id); } - #endregion - #region NestedResourceTypeSecondSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NestedResourceTypeSecondSkuResource GetNestedResourceTypeSecondSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NestedResourceTypeSecondSkuResource.ValidateResourceId(id); - return new NestedResourceTypeSecondSkuResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetNestedResourceTypeSecondSkuResource(id); } - #endregion - #region NestedResourceTypeThirdSkuResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NestedResourceTypeThirdSkuResource GetNestedResourceTypeThirdSkuResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NestedResourceTypeThirdSkuResource.ValidateResourceId(id); - return new NestedResourceTypeThirdSkuResource(client, id); - } - ); + return GetMockableProviderHubArmClient(client).GetNestedResourceTypeThirdSkuResource(id); } - #endregion - /// Gets a collection of ProviderRegistrationResources in the SubscriptionResource. + /// + /// Gets a collection of ProviderRegistrationResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ProviderRegistrationResources and their operations over a ProviderRegistrationResource. public static ProviderRegistrationCollection GetProviderRegistrations(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetProviderRegistrations(); + return GetMockableProviderHubSubscriptionResource(subscriptionResource).GetProviderRegistrations(); } /// @@ -224,16 +199,20 @@ public static ProviderRegistrationCollection GetProviderRegistrations(this Subsc /// ProviderRegistrations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource provider hosted within ProviderHub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetProviderRegistrationAsync(this SubscriptionResource subscriptionResource, string providerNamespace, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetProviderRegistrations().GetAsync(providerNamespace, cancellationToken).ConfigureAwait(false); + return await GetMockableProviderHubSubscriptionResource(subscriptionResource).GetProviderRegistrationAsync(providerNamespace, cancellationToken).ConfigureAwait(false); } /// @@ -248,16 +227,20 @@ public static async Task> GetProviderRegi /// ProviderRegistrations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource provider hosted within ProviderHub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetProviderRegistration(this SubscriptionResource subscriptionResource, string providerNamespace, CancellationToken cancellationToken = default) { - return subscriptionResource.GetProviderRegistrations().Get(providerNamespace, cancellationToken); + return GetMockableProviderHubSubscriptionResource(subscriptionResource).GetProviderRegistration(providerNamespace, cancellationToken); } } } diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 8f07a6732b569..0000000000000 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ProviderHub -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - /// 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 string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ProviderRegistrationResources in the SubscriptionResource. - /// An object representing collection of ProviderRegistrationResources and their operations over a ProviderRegistrationResource. - public virtual ProviderRegistrationCollection GetProviderRegistrations() - { - return GetCachedClient(Client => new ProviderRegistrationCollection(Client, Id)); - } - } -} diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeFirstSkuResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeFirstSkuResource.cs index a6cfa7bddacc6..e7e8c06663ee8 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeFirstSkuResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeFirstSkuResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ProviderHub public partial class NestedResourceTypeFirstSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. + /// The resourceType. + /// The nestedResourceTypeFirst. + /// The sku. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace, string resourceType, string nestedResourceTypeFirst, string sku) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}"; diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeSecondSkuResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeSecondSkuResource.cs index 1404694ec97d7..cfd35a835d2d8 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeSecondSkuResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeSecondSkuResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.ProviderHub public partial class NestedResourceTypeSecondSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. + /// The resourceType. + /// The nestedResourceTypeFirst. + /// The nestedResourceTypeSecond. + /// The sku. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace, string resourceType, string nestedResourceTypeFirst, string nestedResourceTypeSecond, string sku) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/resourcetypeRegistrations/{nestedResourceTypeSecond}/skus/{sku}"; diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeThirdSkuResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeThirdSkuResource.cs index 0c52d23bda469..54de05a9f20bd 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeThirdSkuResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NestedResourceTypeThirdSkuResource.cs @@ -25,6 +25,13 @@ namespace Azure.ResourceManager.ProviderHub public partial class NestedResourceTypeThirdSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. + /// The resourceType. + /// The nestedResourceTypeFirst. + /// The nestedResourceTypeSecond. + /// The nestedResourceTypeThird. + /// The sku. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace, string resourceType, string nestedResourceTypeFirst, string nestedResourceTypeSecond, string nestedResourceTypeThird, string sku) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/resourcetypeRegistrations/{nestedResourceTypeSecond}/resourcetypeRegistrations/{nestedResourceTypeThird}/skus/{sku}"; diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NotificationRegistrationResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NotificationRegistrationResource.cs index 2a721034c6022..886992bbd0f05 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NotificationRegistrationResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/NotificationRegistrationResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ProviderHub public partial class NotificationRegistrationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. + /// The notificationRegistrationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace, string notificationRegistrationName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/notificationRegistrations/{notificationRegistrationName}"; diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationResource.cs index 4aaef20653968..c99093f2e88f8 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.ProviderHub public partial class ProviderRegistrationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}"; @@ -96,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CustomRolloutResources and their operations over a CustomRolloutResource. public virtual CustomRolloutCollection GetCustomRollouts() { - return GetCachedClient(Client => new CustomRolloutCollection(Client, Id)); + return GetCachedClient(client => new CustomRolloutCollection(client, Id)); } /// @@ -114,8 +116,8 @@ public virtual CustomRolloutCollection GetCustomRollouts() /// /// The rollout name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCustomRolloutAsync(string rolloutName, CancellationToken cancellationToken = default) { @@ -137,8 +139,8 @@ public virtual async Task> GetCustomRolloutAsync /// /// The rollout name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCustomRollout(string rolloutName, CancellationToken cancellationToken = default) { @@ -149,7 +151,7 @@ public virtual Response GetCustomRollout(string rolloutNa /// An object representing collection of DefaultRolloutResources and their operations over a DefaultRolloutResource. public virtual DefaultRolloutCollection GetDefaultRollouts() { - return GetCachedClient(Client => new DefaultRolloutCollection(Client, Id)); + return GetCachedClient(client => new DefaultRolloutCollection(client, Id)); } /// @@ -167,8 +169,8 @@ public virtual DefaultRolloutCollection GetDefaultRollouts() /// /// The rollout name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDefaultRolloutAsync(string rolloutName, CancellationToken cancellationToken = default) { @@ -190,8 +192,8 @@ public virtual async Task> GetDefaultRolloutAsy /// /// The rollout name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDefaultRollout(string rolloutName, CancellationToken cancellationToken = default) { @@ -202,7 +204,7 @@ public virtual Response GetDefaultRollout(string rollout /// An object representing collection of NotificationRegistrationResources and their operations over a NotificationRegistrationResource. public virtual NotificationRegistrationCollection GetNotificationRegistrations() { - return GetCachedClient(Client => new NotificationRegistrationCollection(Client, Id)); + return GetCachedClient(client => new NotificationRegistrationCollection(client, Id)); } /// @@ -220,8 +222,8 @@ public virtual NotificationRegistrationCollection GetNotificationRegistrations() /// /// The notification registration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNotificationRegistrationAsync(string notificationRegistrationName, CancellationToken cancellationToken = default) { @@ -243,8 +245,8 @@ public virtual async Task> GetNotific /// /// The notification registration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNotificationRegistration(string notificationRegistrationName, CancellationToken cancellationToken = default) { @@ -255,7 +257,7 @@ public virtual Response GetNotificationRegistr /// An object representing collection of ResourceTypeRegistrationResources and their operations over a ResourceTypeRegistrationResource. public virtual ResourceTypeRegistrationCollection GetResourceTypeRegistrations() { - return GetCachedClient(Client => new ResourceTypeRegistrationCollection(Client, Id)); + return GetCachedClient(client => new ResourceTypeRegistrationCollection(client, Id)); } /// @@ -273,8 +275,8 @@ public virtual ResourceTypeRegistrationCollection GetResourceTypeRegistrations() /// /// The resource type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetResourceTypeRegistrationAsync(string resourceType, CancellationToken cancellationToken = default) { @@ -296,8 +298,8 @@ public virtual async Task> GetResourc /// /// The resource type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetResourceTypeRegistration(string resourceType, CancellationToken cancellationToken = default) { diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationResource.cs index d885048d79459..e807f78a96455 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ProviderHub public partial class ResourceTypeRegistrationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. + /// The resourceType. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace, string resourceType) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}"; @@ -90,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ResourceTypeSkuResources and their operations over a ResourceTypeSkuResource. public virtual ResourceTypeSkuCollection GetResourceTypeSkus() { - return GetCachedClient(Client => new ResourceTypeSkuCollection(Client, Id)); + return GetCachedClient(client => new ResourceTypeSkuCollection(client, Id)); } /// @@ -108,8 +111,8 @@ public virtual ResourceTypeSkuCollection GetResourceTypeSkus() /// /// The SKU. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetResourceTypeSkuAsync(string sku, CancellationToken cancellationToken = default) { @@ -131,8 +134,8 @@ public virtual async Task> GetResourceTypeSkuA /// /// The SKU. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetResourceTypeSku(string sku, CancellationToken cancellationToken = default) { @@ -141,13 +144,11 @@ public virtual Response GetResourceTypeSku(string sku, /// Gets a collection of NestedResourceTypeFirstSkuResources in the ResourceTypeRegistration. /// The first child resource type. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of NestedResourceTypeFirstSkuResources and their operations over a NestedResourceTypeFirstSkuResource. public virtual NestedResourceTypeFirstSkuCollection GetNestedResourceTypeFirstSkus(string nestedResourceTypeFirst) { - Argument.AssertNotNullOrEmpty(nestedResourceTypeFirst, nameof(nestedResourceTypeFirst)); - return new NestedResourceTypeFirstSkuCollection(Client, Id, nestedResourceTypeFirst); } @@ -167,8 +168,8 @@ public virtual NestedResourceTypeFirstSkuCollection GetNestedResourceTypeFirstSk /// The first child resource type. /// The SKU. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNestedResourceTypeFirstSkuAsync(string nestedResourceTypeFirst, string sku, CancellationToken cancellationToken = default) { @@ -191,8 +192,8 @@ public virtual async Task> GetNeste /// The first child resource type. /// The SKU. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNestedResourceTypeFirstSku(string nestedResourceTypeFirst, string sku, CancellationToken cancellationToken = default) { @@ -202,14 +203,11 @@ public virtual Response GetNestedResourceTyp /// Gets a collection of NestedResourceTypeSecondSkuResources in the ResourceTypeRegistration. /// The first child resource type. /// The second child resource type. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. /// An object representing collection of NestedResourceTypeSecondSkuResources and their operations over a NestedResourceTypeSecondSkuResource. public virtual NestedResourceTypeSecondSkuCollection GetNestedResourceTypeSecondSkus(string nestedResourceTypeFirst, string nestedResourceTypeSecond) { - Argument.AssertNotNullOrEmpty(nestedResourceTypeFirst, nameof(nestedResourceTypeFirst)); - Argument.AssertNotNullOrEmpty(nestedResourceTypeSecond, nameof(nestedResourceTypeSecond)); - return new NestedResourceTypeSecondSkuCollection(Client, Id, nestedResourceTypeFirst, nestedResourceTypeSecond); } @@ -230,8 +228,8 @@ public virtual NestedResourceTypeSecondSkuCollection GetNestedResourceTypeSecond /// The second child resource type. /// The SKU. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNestedResourceTypeSecondSkuAsync(string nestedResourceTypeFirst, string nestedResourceTypeSecond, string sku, CancellationToken cancellationToken = default) { @@ -255,8 +253,8 @@ public virtual async Task> GetNest /// The second child resource type. /// The SKU. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNestedResourceTypeSecondSku(string nestedResourceTypeFirst, string nestedResourceTypeSecond, string sku, CancellationToken cancellationToken = default) { @@ -267,15 +265,11 @@ public virtual Response GetNestedResourceTy /// The first child resource type. /// The second child resource type. /// The third child resource type. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of NestedResourceTypeThirdSkuResources and their operations over a NestedResourceTypeThirdSkuResource. public virtual NestedResourceTypeThirdSkuCollection GetNestedResourceTypeThirdSkus(string nestedResourceTypeFirst, string nestedResourceTypeSecond, string nestedResourceTypeThird) { - Argument.AssertNotNullOrEmpty(nestedResourceTypeFirst, nameof(nestedResourceTypeFirst)); - Argument.AssertNotNullOrEmpty(nestedResourceTypeSecond, nameof(nestedResourceTypeSecond)); - Argument.AssertNotNullOrEmpty(nestedResourceTypeThird, nameof(nestedResourceTypeThird)); - return new NestedResourceTypeThirdSkuCollection(Client, Id, nestedResourceTypeFirst, nestedResourceTypeSecond, nestedResourceTypeThird); } @@ -297,8 +291,8 @@ public virtual NestedResourceTypeThirdSkuCollection GetNestedResourceTypeThirdSk /// The third child resource type. /// The SKU. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNestedResourceTypeThirdSkuAsync(string nestedResourceTypeFirst, string nestedResourceTypeSecond, string nestedResourceTypeThird, string sku, CancellationToken cancellationToken = default) { @@ -323,8 +317,8 @@ public virtual async Task> GetNeste /// The third child resource type. /// The SKU. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNestedResourceTypeThirdSku(string nestedResourceTypeFirst, string nestedResourceTypeSecond, string nestedResourceTypeThird, string sku, CancellationToken cancellationToken = default) { diff --git a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeSkuResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeSkuResource.cs index b1db5226f9984..4df8001e44c82 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeSkuResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeSkuResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ProviderHub public partial class ResourceTypeSkuResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerNamespace. + /// The resourceType. + /// The sku. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerNamespace, string resourceType, string sku) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ProviderHub/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}"; diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/Docs/PurviewMetadataPolicyClient.xml b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/Docs/PurviewMetadataPolicyClient.xml index cd76847a8f1a9..5dd59f8dc24d3 100644 --- a/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/Docs/PurviewMetadataPolicyClient.xml +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/Generated/Docs/PurviewMetadataPolicyClient.xml @@ -7,7 +7,7 @@ This sample shows how to call UpdateMetadataPolicyAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); +PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); using RequestContent content = null; Response response = await client.UpdateMetadataPolicyAsync("", content); @@ -19,7 +19,7 @@ This sample shows how to call UpdateMetadataPolicyAsync with all parameters and "); TokenCredential credential = new DefaultAzureCredential(); -PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); +PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); using RequestContent content = RequestContent.Create(new { @@ -112,7 +112,7 @@ This sample shows how to call UpdateMetadataPolicy and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); +PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); using RequestContent content = null; Response response = client.UpdateMetadataPolicy("", content); @@ -124,7 +124,7 @@ This sample shows how to call UpdateMetadataPolicy with all parameters and reque "); TokenCredential credential = new DefaultAzureCredential(); -PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); +PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); using RequestContent content = RequestContent.Create(new { @@ -217,7 +217,7 @@ This sample shows how to call GetMetadataPolicyAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); +PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); Response response = await client.GetMetadataPolicyAsync("", null); @@ -228,7 +228,7 @@ This sample shows how to call GetMetadataPolicyAsync with all parameters and par "); TokenCredential credential = new DefaultAzureCredential(); -PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); +PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); Response response = await client.GetMetadataPolicyAsync("", null); @@ -263,7 +263,7 @@ This sample shows how to call GetMetadataPolicy and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); +PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); Response response = client.GetMetadataPolicy("", null); @@ -274,7 +274,7 @@ This sample shows how to call GetMetadataPolicy with all parameters and parse th "); TokenCredential credential = new DefaultAzureCredential(); -PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); +PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); Response response = client.GetMetadataPolicy("", null); diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/Generated/Samples/Samples_PurviewMetadataPolicyClient.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/Generated/Samples/Samples_PurviewMetadataPolicyClient.cs index c526d2a15bac2..d73e8175a5a78 100644 --- a/sdk/purview/Azure.Analytics.Purview.Administration/tests/Generated/Samples/Samples_PurviewMetadataPolicyClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/Generated/Samples/Samples_PurviewMetadataPolicyClient.cs @@ -24,7 +24,7 @@ public void Example_UpdateMetadataPolicy_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); + PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); using RequestContent content = null; Response response = client.UpdateMetadataPolicy("", content); @@ -39,7 +39,7 @@ public async Task Example_UpdateMetadataPolicy_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); + PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); using RequestContent content = null; Response response = await client.UpdateMetadataPolicyAsync("", content); @@ -54,7 +54,7 @@ public void Example_UpdateMetadataPolicy_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); + PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); using RequestContent content = RequestContent.Create(new { @@ -147,7 +147,7 @@ public async Task Example_UpdateMetadataPolicy_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); + PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); using RequestContent content = RequestContent.Create(new { @@ -240,7 +240,7 @@ public void Example_GetMetadataPolicy_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); + PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); Response response = client.GetMetadataPolicy("", null); @@ -254,7 +254,7 @@ public async Task Example_GetMetadataPolicy_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); + PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); Response response = await client.GetMetadataPolicyAsync("", null); @@ -268,7 +268,7 @@ public void Example_GetMetadataPolicy_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); + PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); Response response = client.GetMetadataPolicy("", null); @@ -303,7 +303,7 @@ public async Task Example_GetMetadataPolicy_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, null, credential); + PurviewMetadataPolicyClient client = new PurviewMetadataPolicyClient(endpoint, (string)null, credential); Response response = await client.GetMetadataPolicyAsync("", null); diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/tests/Generated/Samples/Samples_PurviewMetadataRolesClient.cs b/sdk/purview/Azure.Analytics.Purview.Administration/tests/Generated/Samples/Samples_PurviewMetadataRolesClient.cs index cbe8b7bfd0631..4d61e7a53dd4b 100644 --- a/sdk/purview/Azure.Analytics.Purview.Administration/tests/Generated/Samples/Samples_PurviewMetadataRolesClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Administration/tests/Generated/Samples/Samples_PurviewMetadataRolesClient.cs @@ -8,6 +8,7 @@ using System; using System.Text.Json; using System.Threading.Tasks; +using Azure; using Azure.Analytics.Purview.Administration; using Azure.Core; using Azure.Identity; diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/tests/Generated/Samples/Samples_PurviewEntities.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/tests/Generated/Samples/Samples_PurviewEntities.cs index b58ffa9460f13..fcdcba7ff17b4 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/tests/Generated/Samples/Samples_PurviewEntities.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/tests/Generated/Samples/Samples_PurviewEntities.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.IO; using System.Text.Json; using System.Threading.Tasks; diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/tests/Generated/Samples/Samples_PurviewGlossaries.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/tests/Generated/Samples/Samples_PurviewGlossaries.cs index 675243c3c699e..00af70f9ecdbf 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/tests/Generated/Samples/Samples_PurviewGlossaries.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/tests/Generated/Samples/Samples_PurviewGlossaries.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.IO; using System.Text.Json; using System.Threading.Tasks; diff --git a/sdk/purview/Azure.Analytics.Purview.Sharing/tests/Generated/Samples/Samples_ShareResourcesClient.cs b/sdk/purview/Azure.Analytics.Purview.Sharing/tests/Generated/Samples/Samples_ShareResourcesClient.cs index d21b63eeb71b0..1521f0c5942cb 100644 --- a/sdk/purview/Azure.Analytics.Purview.Sharing/tests/Generated/Samples/Samples_ShareResourcesClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Sharing/tests/Generated/Samples/Samples_ShareResourcesClient.cs @@ -8,6 +8,7 @@ using System; using System.Text.Json; using System.Threading.Tasks; +using Azure; using Azure.Analytics.Purview.Sharing; using Azure.Core; using Azure.Identity; diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_PurviewWorkflowServiceClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_PurviewWorkflowServiceClient.cs index e52265b87b050..7b37cc4747baa 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_PurviewWorkflowServiceClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_PurviewWorkflowServiceClient.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure; diff --git a/sdk/purview/Azure.ResourceManager.Purview/api/Azure.ResourceManager.Purview.netstandard2.0.cs b/sdk/purview/Azure.ResourceManager.Purview/api/Azure.ResourceManager.Purview.netstandard2.0.cs index 48e132f97a9ff..78991a26d54a2 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/api/Azure.ResourceManager.Purview.netstandard2.0.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/api/Azure.ResourceManager.Purview.netstandard2.0.cs @@ -19,7 +19,7 @@ protected PurviewAccountCollection() { } } public partial class PurviewAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public PurviewAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PurviewAccountData(Azure.Core.AzureLocation location) { } public string CloudConnectorsAwsExternalId { get { throw null; } } public string CreatedBy { get { throw null; } } public string CreatedByObjectId { get { throw null; } } @@ -152,6 +152,41 @@ internal PurviewPrivateLinkResourceData() { } public Azure.ResourceManager.Purview.Models.PurviewPrivateLinkResourceProperties Properties { get { throw null; } } } } +namespace Azure.ResourceManager.Purview.Mocking +{ + public partial class MockablePurviewArmClient : Azure.ResourceManager.ArmResource + { + protected MockablePurviewArmClient() { } + public virtual Azure.ResourceManager.Purview.PurviewAccountResource GetPurviewAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Purview.PurviewPrivateEndpointConnectionResource GetPurviewPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Purview.PurviewPrivateLinkResource GetPurviewPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockablePurviewResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockablePurviewResourceGroupResource() { } + public virtual Azure.Response GetPurviewAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPurviewAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Purview.PurviewAccountCollection GetPurviewAccounts() { throw null; } + } + public partial class MockablePurviewSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockablePurviewSubscriptionResource() { } + public virtual Azure.Response CheckPurviewAccountNameAvailability(Azure.ResourceManager.Purview.Models.PurviewAccountNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPurviewAccountNameAvailabilityAsync(Azure.ResourceManager.Purview.Models.PurviewAccountNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPurviewAccounts(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPurviewAccountsAsync(string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockablePurviewTenantResource : Azure.ResourceManager.ArmResource + { + protected MockablePurviewTenantResource() { } + public virtual Azure.Response GetDefaultAccount(System.Guid scopeTenantId, Azure.ResourceManager.Purview.Models.PurviewAccountScopeType scopeType, string scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDefaultAccountAsync(System.Guid scopeTenantId, Azure.ResourceManager.Purview.Models.PurviewAccountScopeType scopeType, string scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveDefaultAccount(System.Guid scopeTenantId, Azure.ResourceManager.Purview.Models.PurviewAccountScopeType scopeType, string scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task RemoveDefaultAccountAsync(System.Guid scopeTenantId, Azure.ResourceManager.Purview.Models.PurviewAccountScopeType scopeType, string scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetDefaultAccount(Azure.ResourceManager.Purview.Models.DefaultPurviewAccountPayload defaultAccountPayload, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetDefaultAccountAsync(Azure.ResourceManager.Purview.Models.DefaultPurviewAccountPayload defaultAccountPayload, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Purview.Models { public static partial class ArmPurviewModelFactory diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewArmClient.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewArmClient.cs new file mode 100644 index 0000000000000..7426ccc74b189 --- /dev/null +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Purview; + +namespace Azure.ResourceManager.Purview.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockablePurviewArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePurviewArmClient() + { + } + + /// 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 MockablePurviewArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockablePurviewArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PurviewAccountResource GetPurviewAccountResource(ResourceIdentifier id) + { + PurviewAccountResource.ValidateResourceId(id); + return new PurviewAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PurviewPrivateEndpointConnectionResource GetPurviewPrivateEndpointConnectionResource(ResourceIdentifier id) + { + PurviewPrivateEndpointConnectionResource.ValidateResourceId(id); + return new PurviewPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PurviewPrivateLinkResource GetPurviewPrivateLinkResource(ResourceIdentifier id) + { + PurviewPrivateLinkResource.ValidateResourceId(id); + return new PurviewPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewResourceGroupResource.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewResourceGroupResource.cs new file mode 100644 index 0000000000000..5da7eae98eb32 --- /dev/null +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Purview; + +namespace Azure.ResourceManager.Purview.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockablePurviewResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockablePurviewResourceGroupResource() + { + } + + /// 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 MockablePurviewResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of PurviewAccountResources in the ResourceGroupResource. + /// An object representing collection of PurviewAccountResources and their operations over a PurviewAccountResource. + public virtual PurviewAccountCollection GetPurviewAccounts() + { + return GetCachedClient(client => new PurviewAccountCollection(client, Id)); + } + + /// + /// Get an account + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetPurviewAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + return await GetPurviewAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an account + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName} + /// + /// + /// Operation Id + /// Accounts_Get + /// + /// + /// + /// The name of the account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetPurviewAccount(string accountName, CancellationToken cancellationToken = default) + { + return GetPurviewAccounts().Get(accountName, cancellationToken); + } + } +} diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewSubscriptionResource.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewSubscriptionResource.cs new file mode 100644 index 0000000000000..b2b93b708b39a --- /dev/null +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewSubscriptionResource.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Purview; +using Azure.ResourceManager.Purview.Models; + +namespace Azure.ResourceManager.Purview.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockablePurviewSubscriptionResource : ArmResource + { + private ClientDiagnostics _purviewAccountAccountsClientDiagnostics; + private AccountsRestOperations _purviewAccountAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePurviewSubscriptionResource() + { + } + + /// 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 MockablePurviewSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics PurviewAccountAccountsClientDiagnostics => _purviewAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Purview", PurviewAccountResource.ResourceType.Namespace, Diagnostics); + private AccountsRestOperations PurviewAccountAccountsRestClient => _purviewAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PurviewAccountResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List accounts in Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The skip token. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPurviewAccountsAsync(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PurviewAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PurviewAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PurviewAccountResource(Client, PurviewAccountData.DeserializePurviewAccountData(e)), PurviewAccountAccountsClientDiagnostics, Pipeline, "MockablePurviewSubscriptionResource.GetPurviewAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// List accounts in Subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts + /// + /// + /// Operation Id + /// Accounts_ListBySubscription + /// + /// + /// + /// The skip token. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPurviewAccounts(string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => PurviewAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PurviewAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PurviewAccountResource(Client, PurviewAccountData.DeserializePurviewAccountData(e)), PurviewAccountAccountsClientDiagnostics, Pipeline, "MockablePurviewSubscriptionResource.GetPurviewAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Checks if account name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckNameAvailability + /// + /// + /// + /// The check name availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPurviewAccountNameAvailabilityAsync(PurviewAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PurviewAccountAccountsClientDiagnostics.CreateScope("MockablePurviewSubscriptionResource.CheckPurviewAccountNameAvailability"); + scope.Start(); + try + { + var response = await PurviewAccountAccountsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks if account name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckNameAvailability + /// + /// + /// + /// The check name availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPurviewAccountNameAvailability(PurviewAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PurviewAccountAccountsClientDiagnostics.CreateScope("MockablePurviewSubscriptionResource.CheckPurviewAccountNameAvailability"); + scope.Start(); + try + { + var response = PurviewAccountAccountsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewTenantResource.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewTenantResource.cs new file mode 100644 index 0000000000000..aa9fb8a8f21b8 --- /dev/null +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/MockablePurviewTenantResource.cs @@ -0,0 +1,247 @@ +// 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; +using Azure.ResourceManager.Purview; +using Azure.ResourceManager.Purview.Models; + +namespace Azure.ResourceManager.Purview.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockablePurviewTenantResource : ArmResource + { + private ClientDiagnostics _defaultAccountsClientDiagnostics; + private DefaultAccountsRestOperations _defaultAccountsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockablePurviewTenantResource() + { + } + + /// 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 MockablePurviewTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultAccountsClientDiagnostics => _defaultAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Purview", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DefaultAccountsRestOperations DefaultAccountsRestClient => _defaultAccountsRestClient ??= new DefaultAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get the default account for the scope. + /// + /// + /// Request Path + /// /providers/Microsoft.Purview/getDefaultAccount + /// + /// + /// Operation Id + /// DefaultAccounts_Get + /// + /// + /// + /// The tenant ID. + /// The scope for the default account. + /// The Id of the scope object, for example if the scope is "Subscription" then it is the ID of that subscription. + /// The cancellation token to use. + public virtual async Task> GetDefaultAccountAsync(Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) + { + using var scope0 = DefaultAccountsClientDiagnostics.CreateScope("MockablePurviewTenantResource.GetDefaultAccount"); + scope0.Start(); + try + { + var response = await DefaultAccountsRestClient.GetAsync(scopeTenantId, scopeType, scope, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Get the default account for the scope. + /// + /// + /// Request Path + /// /providers/Microsoft.Purview/getDefaultAccount + /// + /// + /// Operation Id + /// DefaultAccounts_Get + /// + /// + /// + /// The tenant ID. + /// The scope for the default account. + /// The Id of the scope object, for example if the scope is "Subscription" then it is the ID of that subscription. + /// The cancellation token to use. + public virtual Response GetDefaultAccount(Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) + { + using var scope0 = DefaultAccountsClientDiagnostics.CreateScope("MockablePurviewTenantResource.GetDefaultAccount"); + scope0.Start(); + try + { + var response = DefaultAccountsRestClient.Get(scopeTenantId, scopeType, scope, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Sets the default account for the scope. + /// + /// + /// Request Path + /// /providers/Microsoft.Purview/setDefaultAccount + /// + /// + /// Operation Id + /// DefaultAccounts_Set + /// + /// + /// + /// The payload containing the default account information and the scope. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetDefaultAccountAsync(DefaultPurviewAccountPayload defaultAccountPayload, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(defaultAccountPayload, nameof(defaultAccountPayload)); + + using var scope = DefaultAccountsClientDiagnostics.CreateScope("MockablePurviewTenantResource.SetDefaultAccount"); + scope.Start(); + try + { + var response = await DefaultAccountsRestClient.SetAsync(defaultAccountPayload, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Sets the default account for the scope. + /// + /// + /// Request Path + /// /providers/Microsoft.Purview/setDefaultAccount + /// + /// + /// Operation Id + /// DefaultAccounts_Set + /// + /// + /// + /// The payload containing the default account information and the scope. + /// The cancellation token to use. + /// is null. + public virtual Response SetDefaultAccount(DefaultPurviewAccountPayload defaultAccountPayload, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(defaultAccountPayload, nameof(defaultAccountPayload)); + + using var scope = DefaultAccountsClientDiagnostics.CreateScope("MockablePurviewTenantResource.SetDefaultAccount"); + scope.Start(); + try + { + var response = DefaultAccountsRestClient.Set(defaultAccountPayload, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the default account from the scope. + /// + /// + /// Request Path + /// /providers/Microsoft.Purview/removeDefaultAccount + /// + /// + /// Operation Id + /// DefaultAccounts_Remove + /// + /// + /// + /// The tenant ID. + /// The scope for the default account. + /// The Id of the scope object, for example if the scope is "Subscription" then it is the ID of that subscription. + /// The cancellation token to use. + public virtual async Task RemoveDefaultAccountAsync(Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) + { + using var scope0 = DefaultAccountsClientDiagnostics.CreateScope("MockablePurviewTenantResource.RemoveDefaultAccount"); + scope0.Start(); + try + { + var response = await DefaultAccountsRestClient.RemoveAsync(scopeTenantId, scopeType, scope, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Removes the default account from the scope. + /// + /// + /// Request Path + /// /providers/Microsoft.Purview/removeDefaultAccount + /// + /// + /// Operation Id + /// DefaultAccounts_Remove + /// + /// + /// + /// The tenant ID. + /// The scope for the default account. + /// The Id of the scope object, for example if the scope is "Subscription" then it is the ID of that subscription. + /// The cancellation token to use. + public virtual Response RemoveDefaultAccount(Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) + { + using var scope0 = DefaultAccountsClientDiagnostics.CreateScope("MockablePurviewTenantResource.RemoveDefaultAccount"); + scope0.Start(); + try + { + var response = DefaultAccountsRestClient.Remove(scopeTenantId, scopeType, scope, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + } +} diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/PurviewExtensions.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/PurviewExtensions.cs index 96683532b51bd..48a9576b4c329 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/PurviewExtensions.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/PurviewExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Purview.Mocking; using Azure.ResourceManager.Purview.Models; using Azure.ResourceManager.Resources; @@ -19,116 +20,86 @@ namespace Azure.ResourceManager.Purview /// A class to add extension methods to Azure.ResourceManager.Purview. public static partial class PurviewExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockablePurviewArmClient GetMockablePurviewArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockablePurviewArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePurviewResourceGroupResource GetMockablePurviewResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePurviewResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockablePurviewSubscriptionResource GetMockablePurviewSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockablePurviewSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockablePurviewTenantResource GetMockablePurviewTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockablePurviewTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region PurviewAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PurviewAccountResource GetPurviewAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PurviewAccountResource.ValidateResourceId(id); - return new PurviewAccountResource(client, id); - } - ); + return GetMockablePurviewArmClient(client).GetPurviewAccountResource(id); } - #endregion - #region PurviewPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PurviewPrivateEndpointConnectionResource GetPurviewPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PurviewPrivateEndpointConnectionResource.ValidateResourceId(id); - return new PurviewPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockablePurviewArmClient(client).GetPurviewPrivateEndpointConnectionResource(id); } - #endregion - #region PurviewPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PurviewPrivateLinkResource GetPurviewPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PurviewPrivateLinkResource.ValidateResourceId(id); - return new PurviewPrivateLinkResource(client, id); - } - ); + return GetMockablePurviewArmClient(client).GetPurviewPrivateLinkResource(id); } - #endregion - /// Gets a collection of PurviewAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of PurviewAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of PurviewAccountResources and their operations over a PurviewAccountResource. public static PurviewAccountCollection GetPurviewAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetPurviewAccounts(); + return GetMockablePurviewResourceGroupResource(resourceGroupResource).GetPurviewAccounts(); } /// @@ -143,16 +114,20 @@ public static PurviewAccountCollection GetPurviewAccounts(this ResourceGroupReso /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetPurviewAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetPurviewAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + return await GetMockablePurviewResourceGroupResource(resourceGroupResource).GetPurviewAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -167,16 +142,20 @@ public static async Task> GetPurviewAccountAsyn /// Accounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetPurviewAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetPurviewAccounts().Get(accountName, cancellationToken); + return GetMockablePurviewResourceGroupResource(resourceGroupResource).GetPurviewAccount(accountName, cancellationToken); } /// @@ -191,6 +170,10 @@ public static Response GetPurviewAccount(this ResourceGr /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The skip token. @@ -198,7 +181,7 @@ public static Response GetPurviewAccount(this ResourceGr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetPurviewAccountsAsync(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPurviewAccountsAsync(skipToken, cancellationToken); + return GetMockablePurviewSubscriptionResource(subscriptionResource).GetPurviewAccountsAsync(skipToken, cancellationToken); } /// @@ -213,6 +196,10 @@ public static AsyncPageable GetPurviewAccountsAsync(this /// Accounts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The skip token. @@ -220,7 +207,7 @@ public static AsyncPageable GetPurviewAccountsAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetPurviewAccounts(this SubscriptionResource subscriptionResource, string skipToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPurviewAccounts(skipToken, cancellationToken); + return GetMockablePurviewSubscriptionResource(subscriptionResource).GetPurviewAccounts(skipToken, cancellationToken); } /// @@ -235,6 +222,10 @@ public static Pageable GetPurviewAccounts(this Subscript /// Accounts_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The check name availability request. @@ -242,9 +233,7 @@ public static Pageable GetPurviewAccounts(this Subscript /// is null. public static async Task> CheckPurviewAccountNameAvailabilityAsync(this SubscriptionResource subscriptionResource, PurviewAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPurviewAccountNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockablePurviewSubscriptionResource(subscriptionResource).CheckPurviewAccountNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -259,6 +248,10 @@ public static async Task> CheckPu /// Accounts_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The check name availability request. @@ -266,9 +259,7 @@ public static async Task> CheckPu /// is null. public static Response CheckPurviewAccountNameAvailability(this SubscriptionResource subscriptionResource, PurviewAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckPurviewAccountNameAvailability(content, cancellationToken); + return GetMockablePurviewSubscriptionResource(subscriptionResource).CheckPurviewAccountNameAvailability(content, cancellationToken); } /// @@ -283,6 +274,10 @@ public static Response CheckPurviewAccount /// DefaultAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The tenant ID. @@ -291,7 +286,7 @@ public static Response CheckPurviewAccount /// The cancellation token to use. public static async Task> GetDefaultAccountAsync(this TenantResource tenantResource, Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) { - return await GetTenantResourceExtensionClient(tenantResource).GetDefaultAccountAsync(scopeTenantId, scopeType, scope, cancellationToken).ConfigureAwait(false); + return await GetMockablePurviewTenantResource(tenantResource).GetDefaultAccountAsync(scopeTenantId, scopeType, scope, cancellationToken).ConfigureAwait(false); } /// @@ -306,6 +301,10 @@ public static async Task> GetDefaultAccou /// DefaultAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The tenant ID. @@ -314,7 +313,7 @@ public static async Task> GetDefaultAccou /// The cancellation token to use. public static Response GetDefaultAccount(this TenantResource tenantResource, Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetDefaultAccount(scopeTenantId, scopeType, scope, cancellationToken); + return GetMockablePurviewTenantResource(tenantResource).GetDefaultAccount(scopeTenantId, scopeType, scope, cancellationToken); } /// @@ -329,6 +328,10 @@ public static Response GetDefaultAccount(this Tena /// DefaultAccounts_Set /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The payload containing the default account information and the scope. @@ -336,9 +339,7 @@ public static Response GetDefaultAccount(this Tena /// is null. public static async Task> SetDefaultAccountAsync(this TenantResource tenantResource, DefaultPurviewAccountPayload defaultAccountPayload, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(defaultAccountPayload, nameof(defaultAccountPayload)); - - return await GetTenantResourceExtensionClient(tenantResource).SetDefaultAccountAsync(defaultAccountPayload, cancellationToken).ConfigureAwait(false); + return await GetMockablePurviewTenantResource(tenantResource).SetDefaultAccountAsync(defaultAccountPayload, cancellationToken).ConfigureAwait(false); } /// @@ -353,6 +354,10 @@ public static async Task> SetDefaultAccou /// DefaultAccounts_Set /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The payload containing the default account information and the scope. @@ -360,9 +365,7 @@ public static async Task> SetDefaultAccou /// is null. public static Response SetDefaultAccount(this TenantResource tenantResource, DefaultPurviewAccountPayload defaultAccountPayload, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(defaultAccountPayload, nameof(defaultAccountPayload)); - - return GetTenantResourceExtensionClient(tenantResource).SetDefaultAccount(defaultAccountPayload, cancellationToken); + return GetMockablePurviewTenantResource(tenantResource).SetDefaultAccount(defaultAccountPayload, cancellationToken); } /// @@ -377,6 +380,10 @@ public static Response SetDefaultAccount(this Tena /// DefaultAccounts_Remove /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The tenant ID. @@ -385,7 +392,7 @@ public static Response SetDefaultAccount(this Tena /// The cancellation token to use. public static async Task RemoveDefaultAccountAsync(this TenantResource tenantResource, Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) { - return await GetTenantResourceExtensionClient(tenantResource).RemoveDefaultAccountAsync(scopeTenantId, scopeType, scope, cancellationToken).ConfigureAwait(false); + return await GetMockablePurviewTenantResource(tenantResource).RemoveDefaultAccountAsync(scopeTenantId, scopeType, scope, cancellationToken).ConfigureAwait(false); } /// @@ -400,6 +407,10 @@ public static async Task RemoveDefaultAccountAsync(this TenantResource /// DefaultAccounts_Remove /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The tenant ID. @@ -408,7 +419,7 @@ public static async Task RemoveDefaultAccountAsync(this TenantResource /// The cancellation token to use. public static Response RemoveDefaultAccount(this TenantResource tenantResource, Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).RemoveDefaultAccount(scopeTenantId, scopeType, scope, cancellationToken); + return GetMockablePurviewTenantResource(tenantResource).RemoveDefaultAccount(scopeTenantId, scopeType, scope, cancellationToken); } } } diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index f8d64e6cf13bd..0000000000000 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Purview -{ - /// 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 PurviewAccountResources in the ResourceGroupResource. - /// An object representing collection of PurviewAccountResources and their operations over a PurviewAccountResource. - public virtual PurviewAccountCollection GetPurviewAccounts() - { - return GetCachedClient(Client => new PurviewAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index c14a968a7182d..0000000000000 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Purview.Models; - -namespace Azure.ResourceManager.Purview -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _purviewAccountAccountsClientDiagnostics; - private AccountsRestOperations _purviewAccountAccountsRestClient; - - /// 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 PurviewAccountAccountsClientDiagnostics => _purviewAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Purview", PurviewAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations PurviewAccountAccountsRestClient => _purviewAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(PurviewAccountResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List accounts in Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The skip token. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPurviewAccountsAsync(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PurviewAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PurviewAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PurviewAccountResource(Client, PurviewAccountData.DeserializePurviewAccountData(e)), PurviewAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPurviewAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List accounts in Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// - /// The skip token. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPurviewAccounts(string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => PurviewAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PurviewAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PurviewAccountResource(Client, PurviewAccountData.DeserializePurviewAccountData(e)), PurviewAccountAccountsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPurviewAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Checks if account name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability - /// - /// - /// Operation Id - /// Accounts_CheckNameAvailability - /// - /// - /// - /// The check name availability request. - /// The cancellation token to use. - public virtual async Task> CheckPurviewAccountNameAvailabilityAsync(PurviewAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = PurviewAccountAccountsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPurviewAccountNameAvailability"); - scope.Start(); - try - { - var response = await PurviewAccountAccountsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks if account name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability - /// - /// - /// Operation Id - /// Accounts_CheckNameAvailability - /// - /// - /// - /// The check name availability request. - /// The cancellation token to use. - public virtual Response CheckPurviewAccountNameAvailability(PurviewAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = PurviewAccountAccountsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckPurviewAccountNameAvailability"); - scope.Start(); - try - { - var response = PurviewAccountAccountsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 0c05ae6f6ce12..0000000000000 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,240 +0,0 @@ -// 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; -using Azure.ResourceManager.Purview.Models; - -namespace Azure.ResourceManager.Purview -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultAccountsClientDiagnostics; - private DefaultAccountsRestOperations _defaultAccountsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics DefaultAccountsClientDiagnostics => _defaultAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Purview", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DefaultAccountsRestOperations DefaultAccountsRestClient => _defaultAccountsRestClient ??= new DefaultAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get the default account for the scope. - /// - /// - /// Request Path - /// /providers/Microsoft.Purview/getDefaultAccount - /// - /// - /// Operation Id - /// DefaultAccounts_Get - /// - /// - /// - /// The tenant ID. - /// The scope for the default account. - /// The Id of the scope object, for example if the scope is "Subscription" then it is the ID of that subscription. - /// The cancellation token to use. - public virtual async Task> GetDefaultAccountAsync(Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) - { - using var scope0 = DefaultAccountsClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetDefaultAccount"); - scope0.Start(); - try - { - var response = await DefaultAccountsRestClient.GetAsync(scopeTenantId, scopeType, scope, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// - /// Get the default account for the scope. - /// - /// - /// Request Path - /// /providers/Microsoft.Purview/getDefaultAccount - /// - /// - /// Operation Id - /// DefaultAccounts_Get - /// - /// - /// - /// The tenant ID. - /// The scope for the default account. - /// The Id of the scope object, for example if the scope is "Subscription" then it is the ID of that subscription. - /// The cancellation token to use. - public virtual Response GetDefaultAccount(Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) - { - using var scope0 = DefaultAccountsClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetDefaultAccount"); - scope0.Start(); - try - { - var response = DefaultAccountsRestClient.Get(scopeTenantId, scopeType, scope, cancellationToken); - return response; - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// - /// Sets the default account for the scope. - /// - /// - /// Request Path - /// /providers/Microsoft.Purview/setDefaultAccount - /// - /// - /// Operation Id - /// DefaultAccounts_Set - /// - /// - /// - /// The payload containing the default account information and the scope. - /// The cancellation token to use. - public virtual async Task> SetDefaultAccountAsync(DefaultPurviewAccountPayload defaultAccountPayload, CancellationToken cancellationToken = default) - { - using var scope = DefaultAccountsClientDiagnostics.CreateScope("TenantResourceExtensionClient.SetDefaultAccount"); - scope.Start(); - try - { - var response = await DefaultAccountsRestClient.SetAsync(defaultAccountPayload, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Sets the default account for the scope. - /// - /// - /// Request Path - /// /providers/Microsoft.Purview/setDefaultAccount - /// - /// - /// Operation Id - /// DefaultAccounts_Set - /// - /// - /// - /// The payload containing the default account information and the scope. - /// The cancellation token to use. - public virtual Response SetDefaultAccount(DefaultPurviewAccountPayload defaultAccountPayload, CancellationToken cancellationToken = default) - { - using var scope = DefaultAccountsClientDiagnostics.CreateScope("TenantResourceExtensionClient.SetDefaultAccount"); - scope.Start(); - try - { - var response = DefaultAccountsRestClient.Set(defaultAccountPayload, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes the default account from the scope. - /// - /// - /// Request Path - /// /providers/Microsoft.Purview/removeDefaultAccount - /// - /// - /// Operation Id - /// DefaultAccounts_Remove - /// - /// - /// - /// The tenant ID. - /// The scope for the default account. - /// The Id of the scope object, for example if the scope is "Subscription" then it is the ID of that subscription. - /// The cancellation token to use. - public virtual async Task RemoveDefaultAccountAsync(Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) - { - using var scope0 = DefaultAccountsClientDiagnostics.CreateScope("TenantResourceExtensionClient.RemoveDefaultAccount"); - scope0.Start(); - try - { - var response = await DefaultAccountsRestClient.RemoveAsync(scopeTenantId, scopeType, scope, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - - /// - /// Removes the default account from the scope. - /// - /// - /// Request Path - /// /providers/Microsoft.Purview/removeDefaultAccount - /// - /// - /// Operation Id - /// DefaultAccounts_Remove - /// - /// - /// - /// The tenant ID. - /// The scope for the default account. - /// The Id of the scope object, for example if the scope is "Subscription" then it is the ID of that subscription. - /// The cancellation token to use. - public virtual Response RemoveDefaultAccount(Guid scopeTenantId, PurviewAccountScopeType scopeType, string scope = null, CancellationToken cancellationToken = default) - { - using var scope0 = DefaultAccountsClientDiagnostics.CreateScope("TenantResourceExtensionClient.RemoveDefaultAccount"); - scope0.Start(); - try - { - var response = DefaultAccountsRestClient.Remove(scopeTenantId, scopeType, scope, cancellationToken); - return response; - } - catch (Exception e) - { - scope0.Failed(e); - throw; - } - } - } -} diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountResource.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountResource.cs index 3f7e9375380cb..3b7152214174d 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountResource.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Purview public partial class PurviewAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of PurviewPrivateEndpointConnectionResources and their operations over a PurviewPrivateEndpointConnectionResource. public virtual PurviewPrivateEndpointConnectionCollection GetPurviewPrivateEndpointConnections() { - return GetCachedClient(Client => new PurviewPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new PurviewPrivateEndpointConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual PurviewPrivateEndpointConnectionCollection GetPurviewPrivateEndpo /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPurviewPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> Ge /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPurviewPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetPurviewPriv /// An object representing collection of PurviewPrivateLinkResources and their operations over a PurviewPrivateLinkResource. public virtual PurviewPrivateLinkResourceCollection GetPurviewPrivateLinkResources() { - return GetCachedClient(Client => new PurviewPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new PurviewPrivateLinkResourceCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual PurviewPrivateLinkResourceCollection GetPurviewPrivateLinkResourc /// /// The group identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPurviewPrivateLinkResourceAsync(string groupId, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetPurviewPrivat /// /// The group identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPurviewPrivateLinkResource(string groupId, CancellationToken cancellationToken = default) { diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateEndpointConnectionResource.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateEndpointConnectionResource.cs index 581eae7dbee86..6bbcb5c0f2eee 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateEndpointConnectionResource.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Purview public partial class PurviewPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateLinkResource.cs b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateLinkResource.cs index 6ccce437b63f1..2d906a6d7be5b 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateLinkResource.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Purview public partial class PurviewPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The groupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string groupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources/{groupId}"; diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/api/Azure.ResourceManager.Quantum.netstandard2.0.cs b/sdk/quantum/Azure.ResourceManager.Quantum/api/Azure.ResourceManager.Quantum.netstandard2.0.cs index 16a0960e4e649..b588a2ccd3a0e 100644 --- a/sdk/quantum/Azure.ResourceManager.Quantum/api/Azure.ResourceManager.Quantum.netstandard2.0.cs +++ b/sdk/quantum/Azure.ResourceManager.Quantum/api/Azure.ResourceManager.Quantum.netstandard2.0.cs @@ -32,7 +32,7 @@ protected QuantumWorkspaceCollection() { } } public partial class QuantumWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public QuantumWorkspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public QuantumWorkspaceData(Azure.Core.AzureLocation location) { } public System.Uri EndpointUri { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList Providers { get { throw null; } } @@ -61,6 +61,31 @@ protected QuantumWorkspaceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Quantum.Models.QuantumWorkspacePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Quantum.Mocking +{ + public partial class MockableQuantumArmClient : Azure.ResourceManager.ArmResource + { + protected MockableQuantumArmClient() { } + public virtual Azure.ResourceManager.Quantum.QuantumWorkspaceResource GetQuantumWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableQuantumResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableQuantumResourceGroupResource() { } + public virtual Azure.Response GetQuantumWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetQuantumWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quantum.QuantumWorkspaceCollection GetQuantumWorkspaces() { throw null; } + } + public partial class MockableQuantumSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableQuantumSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityWorkspace(string locationName, Azure.ResourceManager.Quantum.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityWorkspaceAsync(string locationName, Azure.ResourceManager.Quantum.Models.CheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetOfferings(string locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOfferingsAsync(string locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQuantumWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQuantumWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Quantum.Models { public static partial class ArmQuantumModelFactory diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumArmClient.cs b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumArmClient.cs new file mode 100644 index 0000000000000..24168dd7403b2 --- /dev/null +++ b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Quantum; + +namespace Azure.ResourceManager.Quantum.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableQuantumArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableQuantumArmClient() + { + } + + /// 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 MockableQuantumArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableQuantumArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual QuantumWorkspaceResource GetQuantumWorkspaceResource(ResourceIdentifier id) + { + QuantumWorkspaceResource.ValidateResourceId(id); + return new QuantumWorkspaceResource(Client, id); + } + } +} diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumResourceGroupResource.cs b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumResourceGroupResource.cs new file mode 100644 index 0000000000000..40a6cbaa53b12 --- /dev/null +++ b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Quantum; + +namespace Azure.ResourceManager.Quantum.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableQuantumResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableQuantumResourceGroupResource() + { + } + + /// 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 MockableQuantumResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of QuantumWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of QuantumWorkspaceResources and their operations over a QuantumWorkspaceResource. + public virtual QuantumWorkspaceCollection GetQuantumWorkspaces() + { + return GetCachedClient(client => new QuantumWorkspaceCollection(client, Id)); + } + + /// + /// Returns the Workspace resource associated with the given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the quantum workspace resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetQuantumWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetQuantumWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the Workspace resource associated with the given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the quantum workspace resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetQuantumWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetQuantumWorkspaces().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumSubscriptionResource.cs b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumSubscriptionResource.cs new file mode 100644 index 0000000000000..ded0e81399ddb --- /dev/null +++ b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/MockableQuantumSubscriptionResource.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Quantum; +using Azure.ResourceManager.Quantum.Models; + +namespace Azure.ResourceManager.Quantum.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableQuantumSubscriptionResource : ArmResource + { + private ClientDiagnostics _quantumWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _quantumWorkspaceWorkspacesRestClient; + private ClientDiagnostics _offeringsClientDiagnostics; + private OfferingsRestOperations _offeringsRestClient; + private ClientDiagnostics _workspaceClientDiagnostics; + private WorkspaceRestOperations _workspaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableQuantumSubscriptionResource() + { + } + + /// 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 MockableQuantumSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics QuantumWorkspaceWorkspacesClientDiagnostics => _quantumWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quantum", QuantumWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations QuantumWorkspaceWorkspacesRestClient => _quantumWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(QuantumWorkspaceResource.ResourceType)); + private ClientDiagnostics OfferingsClientDiagnostics => _offeringsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quantum", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OfferingsRestOperations OfferingsRestClient => _offeringsRestClient ??= new OfferingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics WorkspaceClientDiagnostics => _workspaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quantum", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private WorkspaceRestOperations WorkspaceRestClient => _workspaceRestClient ??= new WorkspaceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the list of Workspaces within a Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQuantumWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => QuantumWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuantumWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new QuantumWorkspaceResource(Client, QuantumWorkspaceData.DeserializeQuantumWorkspaceData(e)), QuantumWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableQuantumSubscriptionResource.GetQuantumWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Workspaces within a Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/workspaces + /// + /// + /// Operation Id + /// Workspaces_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQuantumWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => QuantumWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuantumWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new QuantumWorkspaceResource(Client, QuantumWorkspaceData.DeserializeQuantumWorkspaceData(e)), QuantumWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableQuantumSubscriptionResource.GetQuantumWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Returns the list of all provider offerings available for the given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/offerings + /// + /// + /// Operation Id + /// Offerings_List + /// + /// + /// + /// Location. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOfferingsAsync(string locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => OfferingsRestClient.CreateListRequest(Id.SubscriptionId, locationName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OfferingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProviderDescription.DeserializeProviderDescription, OfferingsClientDiagnostics, Pipeline, "MockableQuantumSubscriptionResource.GetOfferings", "value", "nextLink", cancellationToken); + } + + /// + /// Returns the list of all provider offerings available for the given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/offerings + /// + /// + /// Operation Id + /// Offerings_List + /// + /// + /// + /// Location. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOfferings(string locationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => OfferingsRestClient.CreateListRequest(Id.SubscriptionId, locationName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OfferingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProviderDescription.DeserializeProviderDescription, OfferingsClientDiagnostics, Pipeline, "MockableQuantumSubscriptionResource.GetOfferings", "value", "nextLink", cancellationToken); + } + + /// + /// Check the availability of the resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// Workspace_CheckNameAvailability + /// + /// + /// + /// Location. + /// The name and type of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CheckNameAvailabilityWorkspaceAsync(string locationName, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = WorkspaceClientDiagnostics.CreateScope("MockableQuantumSubscriptionResource.CheckNameAvailabilityWorkspace"); + scope.Start(); + try + { + var response = await WorkspaceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of the resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// Workspace_CheckNameAvailability + /// + /// + /// + /// Location. + /// The name and type of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response CheckNameAvailabilityWorkspace(string locationName, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = WorkspaceClientDiagnostics.CreateScope("MockableQuantumSubscriptionResource.CheckNameAvailabilityWorkspace"); + scope.Start(); + try + { + var response = WorkspaceRestClient.CheckNameAvailability(Id.SubscriptionId, locationName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/QuantumExtensions.cs b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/QuantumExtensions.cs index 8fd23a8decbe8..c9b536b74cac7 100644 --- a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/QuantumExtensions.cs +++ b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/QuantumExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Quantum.Mocking; using Azure.ResourceManager.Quantum.Models; using Azure.ResourceManager.Resources; @@ -19,62 +20,49 @@ namespace Azure.ResourceManager.Quantum /// A class to add extension methods to Azure.ResourceManager.Quantum. public static partial class QuantumExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableQuantumArmClient GetMockableQuantumArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableQuantumArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableQuantumResourceGroupResource GetMockableQuantumResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableQuantumResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableQuantumSubscriptionResource GetMockableQuantumSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableQuantumSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region QuantumWorkspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static QuantumWorkspaceResource GetQuantumWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - QuantumWorkspaceResource.ValidateResourceId(id); - return new QuantumWorkspaceResource(client, id); - } - ); + return GetMockableQuantumArmClient(client).GetQuantumWorkspaceResource(id); } - #endregion - /// Gets a collection of QuantumWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of QuantumWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of QuantumWorkspaceResources and their operations over a QuantumWorkspaceResource. public static QuantumWorkspaceCollection GetQuantumWorkspaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetQuantumWorkspaces(); + return GetMockableQuantumResourceGroupResource(resourceGroupResource).GetQuantumWorkspaces(); } /// @@ -89,16 +77,20 @@ public static QuantumWorkspaceCollection GetQuantumWorkspaces(this ResourceGroup /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the quantum workspace resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetQuantumWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetQuantumWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableQuantumResourceGroupResource(resourceGroupResource).GetQuantumWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -113,16 +105,20 @@ public static async Task> GetQuantumWorkspace /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the quantum workspace resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetQuantumWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetQuantumWorkspaces().Get(workspaceName, cancellationToken); + return GetMockableQuantumResourceGroupResource(resourceGroupResource).GetQuantumWorkspace(workspaceName, cancellationToken); } /// @@ -137,13 +133,17 @@ public static Response GetQuantumWorkspace(this Resour /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetQuantumWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetQuantumWorkspacesAsync(cancellationToken); + return GetMockableQuantumSubscriptionResource(subscriptionResource).GetQuantumWorkspacesAsync(cancellationToken); } /// @@ -158,13 +158,17 @@ public static AsyncPageable GetQuantumWorkspacesAsync( /// Workspaces_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetQuantumWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetQuantumWorkspaces(cancellationToken); + return GetMockableQuantumSubscriptionResource(subscriptionResource).GetQuantumWorkspaces(cancellationToken); } /// @@ -179,6 +183,10 @@ public static Pageable GetQuantumWorkspaces(this Subsc /// Offerings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location. @@ -188,9 +196,7 @@ public static Pageable GetQuantumWorkspaces(this Subsc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetOfferingsAsync(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOfferingsAsync(locationName, cancellationToken); + return GetMockableQuantumSubscriptionResource(subscriptionResource).GetOfferingsAsync(locationName, cancellationToken); } /// @@ -205,6 +211,10 @@ public static AsyncPageable GetOfferingsAsync(this Subscrip /// Offerings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location. @@ -214,9 +224,7 @@ public static AsyncPageable GetOfferingsAsync(this Subscrip /// A collection of that may take multiple service requests to iterate over. public static Pageable GetOfferings(this SubscriptionResource subscriptionResource, string locationName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetOfferings(locationName, cancellationToken); + return GetMockableQuantumSubscriptionResource(subscriptionResource).GetOfferings(locationName, cancellationToken); } /// @@ -231,6 +239,10 @@ public static Pageable GetOfferings(this SubscriptionResour /// Workspace_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location. @@ -240,10 +252,7 @@ public static Pageable GetOfferings(this SubscriptionResour /// or is null. public static async Task> CheckNameAvailabilityWorkspaceAsync(this SubscriptionResource subscriptionResource, string locationName, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityWorkspaceAsync(locationName, content, cancellationToken).ConfigureAwait(false); + return await GetMockableQuantumSubscriptionResource(subscriptionResource).CheckNameAvailabilityWorkspaceAsync(locationName, content, cancellationToken).ConfigureAwait(false); } /// @@ -258,6 +267,10 @@ public static async Task> CheckNameAvailab /// Workspace_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location. @@ -267,10 +280,7 @@ public static async Task> CheckNameAvailab /// or is null. public static Response CheckNameAvailabilityWorkspace(this SubscriptionResource subscriptionResource, string locationName, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckNameAvailabilityWorkspace(locationName, content, cancellationToken); + return GetMockableQuantumSubscriptionResource(subscriptionResource).CheckNameAvailabilityWorkspace(locationName, content, cancellationToken); } } } diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ec146eb5a8c8f..0000000000000 --- a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Quantum -{ - /// 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 QuantumWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of QuantumWorkspaceResources and their operations over a QuantumWorkspaceResource. - public virtual QuantumWorkspaceCollection GetQuantumWorkspaces() - { - return GetCachedClient(Client => new QuantumWorkspaceCollection(Client, Id)); - } - } -} diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index ef6516614d54c..0000000000000 --- a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Quantum.Models; - -namespace Azure.ResourceManager.Quantum -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _quantumWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _quantumWorkspaceWorkspacesRestClient; - private ClientDiagnostics _offeringsClientDiagnostics; - private OfferingsRestOperations _offeringsRestClient; - private ClientDiagnostics _workspaceClientDiagnostics; - private WorkspaceRestOperations _workspaceRestClient; - - /// 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 QuantumWorkspaceWorkspacesClientDiagnostics => _quantumWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quantum", QuantumWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations QuantumWorkspaceWorkspacesRestClient => _quantumWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(QuantumWorkspaceResource.ResourceType)); - private ClientDiagnostics OfferingsClientDiagnostics => _offeringsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quantum", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OfferingsRestOperations OfferingsRestClient => _offeringsRestClient ??= new OfferingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics WorkspaceClientDiagnostics => _workspaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quantum", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private WorkspaceRestOperations WorkspaceRestClient => _workspaceRestClient ??= new WorkspaceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the list of Workspaces within a Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetQuantumWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QuantumWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuantumWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new QuantumWorkspaceResource(Client, QuantumWorkspaceData.DeserializeQuantumWorkspaceData(e)), QuantumWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQuantumWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Workspaces within a Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/workspaces - /// - /// - /// Operation Id - /// Workspaces_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetQuantumWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QuantumWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuantumWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new QuantumWorkspaceResource(Client, QuantumWorkspaceData.DeserializeQuantumWorkspaceData(e)), QuantumWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQuantumWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// Returns the list of all provider offerings available for the given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/offerings - /// - /// - /// Operation Id - /// Offerings_List - /// - /// - /// - /// Location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOfferingsAsync(string locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OfferingsRestClient.CreateListRequest(Id.SubscriptionId, locationName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OfferingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProviderDescription.DeserializeProviderDescription, OfferingsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOfferings", "value", "nextLink", cancellationToken); - } - - /// - /// Returns the list of all provider offerings available for the given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/offerings - /// - /// - /// Operation Id - /// Offerings_List - /// - /// - /// - /// Location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOfferings(string locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OfferingsRestClient.CreateListRequest(Id.SubscriptionId, locationName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OfferingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProviderDescription.DeserializeProviderDescription, OfferingsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetOfferings", "value", "nextLink", cancellationToken); - } - - /// - /// Check the availability of the resource name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// Workspace_CheckNameAvailability - /// - /// - /// - /// Location. - /// The name and type of the resource. - /// The cancellation token to use. - public virtual async Task> CheckNameAvailabilityWorkspaceAsync(string locationName, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = WorkspaceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityWorkspace"); - scope.Start(); - try - { - var response = await WorkspaceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of the resource name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// Workspace_CheckNameAvailability - /// - /// - /// - /// Location. - /// The name and type of the resource. - /// The cancellation token to use. - public virtual Response CheckNameAvailabilityWorkspace(string locationName, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = WorkspaceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckNameAvailabilityWorkspace"); - scope.Start(); - try - { - var response = WorkspaceRestClient.CheckNameAvailability(Id.SubscriptionId, locationName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/QuantumWorkspaceResource.cs b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/QuantumWorkspaceResource.cs index 55edb569c809d..cd184e30f41c4 100644 --- a/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/QuantumWorkspaceResource.cs +++ b/sdk/quantum/Azure.ResourceManager.Quantum/src/Generated/QuantumWorkspaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Quantum public partial class QuantumWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}"; diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/api/Azure.ResourceManager.Qumulo.netstandard2.0.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/api/Azure.ResourceManager.Qumulo.netstandard2.0.cs index ba6862972d7f9..a26a025359ac5 100644 --- a/sdk/qumulo/Azure.ResourceManager.Qumulo/api/Azure.ResourceManager.Qumulo.netstandard2.0.cs +++ b/sdk/qumulo/Azure.ResourceManager.Qumulo/api/Azure.ResourceManager.Qumulo.netstandard2.0.cs @@ -48,7 +48,7 @@ protected QumuloFileSystemResourceCollection() { } } public partial class QumuloFileSystemResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public QumuloFileSystemResourceData(Azure.Core.AzureLocation location, Azure.ResourceManager.Qumulo.Models.MarketplaceDetails marketplaceDetails, Azure.ResourceManager.Qumulo.Models.StorageSku storageSku, Azure.ResourceManager.Qumulo.Models.QumuloUserDetails userDetails, string delegatedSubnetId, string adminPassword, int initialCapacity) : base (default(Azure.Core.AzureLocation)) { } + public QumuloFileSystemResourceData(Azure.Core.AzureLocation location, Azure.ResourceManager.Qumulo.Models.MarketplaceDetails marketplaceDetails, Azure.ResourceManager.Qumulo.Models.StorageSku storageSku, Azure.ResourceManager.Qumulo.Models.QumuloUserDetails userDetails, string delegatedSubnetId, string adminPassword, int initialCapacity) { } public string AdminPassword { get { throw null; } set { } } public string AvailabilityZone { get { throw null; } set { } } public System.Uri ClusterLoginUri { get { throw null; } set { } } @@ -62,6 +62,27 @@ public QumuloFileSystemResourceData(Azure.Core.AzureLocation location, Azure.Res public string UserDetailsEmail { get { throw null; } set { } } } } +namespace Azure.ResourceManager.Qumulo.Mocking +{ + public partial class MockableQumuloArmClient : Azure.ResourceManager.ArmResource + { + protected MockableQumuloArmClient() { } + public virtual Azure.ResourceManager.Qumulo.QumuloFileSystemResource GetQumuloFileSystemResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableQumuloResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableQumuloResourceGroupResource() { } + public virtual Azure.Response GetQumuloFileSystemResource(string fileSystemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetQumuloFileSystemResourceAsync(string fileSystemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Qumulo.QumuloFileSystemResourceCollection GetQumuloFileSystemResources() { throw null; } + } + public partial class MockableQumuloSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableQumuloSubscriptionResource() { } + public virtual Azure.Pageable GetQumuloFileSystemResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQumuloFileSystemResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Qumulo.Models { public static partial class ArmQumuloModelFactory diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloArmClient.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloArmClient.cs new file mode 100644 index 0000000000000..af4e6cd17fd13 --- /dev/null +++ b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Qumulo; + +namespace Azure.ResourceManager.Qumulo.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableQumuloArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableQumuloArmClient() + { + } + + /// 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 MockableQumuloArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableQumuloArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual QumuloFileSystemResource GetQumuloFileSystemResource(ResourceIdentifier id) + { + QumuloFileSystemResource.ValidateResourceId(id); + return new QumuloFileSystemResource(Client, id); + } + } +} diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloResourceGroupResource.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloResourceGroupResource.cs new file mode 100644 index 0000000000000..72ec4bb8d4e92 --- /dev/null +++ b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Qumulo; + +namespace Azure.ResourceManager.Qumulo.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableQumuloResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableQumuloResourceGroupResource() + { + } + + /// 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 MockableQumuloResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of QumuloFileSystemResources in the ResourceGroupResource. + /// An object representing collection of QumuloFileSystemResources and their operations over a QumuloFileSystemResource. + public virtual QumuloFileSystemResourceCollection GetQumuloFileSystemResources() + { + return GetCachedClient(client => new QumuloFileSystemResourceCollection(client, Id)); + } + + /// + /// Get a FileSystemResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName} + /// + /// + /// Operation Id + /// FileSystems_Get + /// + /// + /// + /// Name of the File System resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetQumuloFileSystemResourceAsync(string fileSystemName, CancellationToken cancellationToken = default) + { + return await GetQumuloFileSystemResources().GetAsync(fileSystemName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a FileSystemResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName} + /// + /// + /// Operation Id + /// FileSystems_Get + /// + /// + /// + /// Name of the File System resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetQumuloFileSystemResource(string fileSystemName, CancellationToken cancellationToken = default) + { + return GetQumuloFileSystemResources().Get(fileSystemName, cancellationToken); + } + } +} diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloSubscriptionResource.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloSubscriptionResource.cs new file mode 100644 index 0000000000000..5519453095669 --- /dev/null +++ b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/MockableQumuloSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Qumulo; + +namespace Azure.ResourceManager.Qumulo.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableQumuloSubscriptionResource : ArmResource + { + private ClientDiagnostics _qumuloFileSystemResourceFileSystemsClientDiagnostics; + private FileSystemsRestOperations _qumuloFileSystemResourceFileSystemsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableQumuloSubscriptionResource() + { + } + + /// 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 MockableQumuloSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics QumuloFileSystemResourceFileSystemsClientDiagnostics => _qumuloFileSystemResourceFileSystemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Qumulo", QumuloFileSystemResource.ResourceType.Namespace, Diagnostics); + private FileSystemsRestOperations QumuloFileSystemResourceFileSystemsRestClient => _qumuloFileSystemResourceFileSystemsRestClient ??= new FileSystemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(QumuloFileSystemResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List FileSystemResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Qumulo.Storage/fileSystems + /// + /// + /// Operation Id + /// FileSystems_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQumuloFileSystemResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => QumuloFileSystemResourceFileSystemsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QumuloFileSystemResourceFileSystemsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new QumuloFileSystemResource(Client, QumuloFileSystemResourceData.DeserializeQumuloFileSystemResourceData(e)), QumuloFileSystemResourceFileSystemsClientDiagnostics, Pipeline, "MockableQumuloSubscriptionResource.GetQumuloFileSystemResources", "value", "nextLink", cancellationToken); + } + + /// + /// List FileSystemResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Qumulo.Storage/fileSystems + /// + /// + /// Operation Id + /// FileSystems_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQumuloFileSystemResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => QumuloFileSystemResourceFileSystemsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QumuloFileSystemResourceFileSystemsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new QumuloFileSystemResource(Client, QumuloFileSystemResourceData.DeserializeQumuloFileSystemResourceData(e)), QumuloFileSystemResourceFileSystemsClientDiagnostics, Pipeline, "MockableQumuloSubscriptionResource.GetQumuloFileSystemResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/QumuloExtensions.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/QumuloExtensions.cs index cc098bea72c26..1a5413c8e31bb 100644 --- a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/QumuloExtensions.cs +++ b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/QumuloExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Qumulo.Mocking; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Qumulo @@ -18,62 +19,49 @@ namespace Azure.ResourceManager.Qumulo /// A class to add extension methods to Azure.ResourceManager.Qumulo. public static partial class QumuloExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableQumuloArmClient GetMockableQumuloArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableQumuloArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableQumuloResourceGroupResource GetMockableQumuloResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableQumuloResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableQumuloSubscriptionResource GetMockableQumuloSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableQumuloSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region QumuloFileSystemResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static QumuloFileSystemResource GetQumuloFileSystemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - QumuloFileSystemResource.ValidateResourceId(id); - return new QumuloFileSystemResource(client, id); - } - ); + return GetMockableQumuloArmClient(client).GetQumuloFileSystemResource(id); } - #endregion - /// Gets a collection of QumuloFileSystemResources in the ResourceGroupResource. + /// + /// Gets a collection of QumuloFileSystemResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of QumuloFileSystemResources and their operations over a QumuloFileSystemResource. public static QumuloFileSystemResourceCollection GetQumuloFileSystemResources(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetQumuloFileSystemResources(); + return GetMockableQumuloResourceGroupResource(resourceGroupResource).GetQumuloFileSystemResources(); } /// @@ -88,16 +76,20 @@ public static QumuloFileSystemResourceCollection GetQumuloFileSystemResources(th /// FileSystems_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the File System resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetQumuloFileSystemResourceAsync(this ResourceGroupResource resourceGroupResource, string fileSystemName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetQumuloFileSystemResources().GetAsync(fileSystemName, cancellationToken).ConfigureAwait(false); + return await GetMockableQumuloResourceGroupResource(resourceGroupResource).GetQumuloFileSystemResourceAsync(fileSystemName, cancellationToken).ConfigureAwait(false); } /// @@ -112,16 +104,20 @@ public static async Task> GetQumuloFileSystem /// FileSystems_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the File System resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetQumuloFileSystemResource(this ResourceGroupResource resourceGroupResource, string fileSystemName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetQumuloFileSystemResources().Get(fileSystemName, cancellationToken); + return GetMockableQumuloResourceGroupResource(resourceGroupResource).GetQumuloFileSystemResource(fileSystemName, cancellationToken); } /// @@ -136,13 +132,17 @@ public static Response GetQumuloFileSystemResource(thi /// FileSystems_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetQumuloFileSystemResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetQumuloFileSystemResourcesAsync(cancellationToken); + return GetMockableQumuloSubscriptionResource(subscriptionResource).GetQumuloFileSystemResourcesAsync(cancellationToken); } /// @@ -157,13 +157,17 @@ public static AsyncPageable GetQumuloFileSystemResourc /// FileSystems_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetQumuloFileSystemResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetQumuloFileSystemResources(cancellationToken); + return GetMockableQumuloSubscriptionResource(subscriptionResource).GetQumuloFileSystemResources(cancellationToken); } } } diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 44a3cac71aed2..0000000000000 --- a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Qumulo -{ - /// 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 QumuloFileSystemResources in the ResourceGroupResource. - /// An object representing collection of QumuloFileSystemResources and their operations over a QumuloFileSystemResource. - public virtual QumuloFileSystemResourceCollection GetQumuloFileSystemResources() - { - return GetCachedClient(Client => new QumuloFileSystemResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index bcf9866049310..0000000000000 --- a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Qumulo -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _qumuloFileSystemResourceFileSystemsClientDiagnostics; - private FileSystemsRestOperations _qumuloFileSystemResourceFileSystemsRestClient; - - /// 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 QumuloFileSystemResourceFileSystemsClientDiagnostics => _qumuloFileSystemResourceFileSystemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Qumulo", QumuloFileSystemResource.ResourceType.Namespace, Diagnostics); - private FileSystemsRestOperations QumuloFileSystemResourceFileSystemsRestClient => _qumuloFileSystemResourceFileSystemsRestClient ??= new FileSystemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(QumuloFileSystemResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List FileSystemResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Qumulo.Storage/fileSystems - /// - /// - /// Operation Id - /// FileSystems_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetQumuloFileSystemResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QumuloFileSystemResourceFileSystemsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QumuloFileSystemResourceFileSystemsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new QumuloFileSystemResource(Client, QumuloFileSystemResourceData.DeserializeQumuloFileSystemResourceData(e)), QumuloFileSystemResourceFileSystemsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQumuloFileSystemResources", "value", "nextLink", cancellationToken); - } - - /// - /// List FileSystemResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Qumulo.Storage/fileSystems - /// - /// - /// Operation Id - /// FileSystems_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetQumuloFileSystemResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QumuloFileSystemResourceFileSystemsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QumuloFileSystemResourceFileSystemsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new QumuloFileSystemResource(Client, QumuloFileSystemResourceData.DeserializeQumuloFileSystemResourceData(e)), QumuloFileSystemResourceFileSystemsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQumuloFileSystemResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/QumuloFileSystemResource.cs b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/QumuloFileSystemResource.cs index e138f054f32f9..88371faeb801c 100644 --- a/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/QumuloFileSystemResource.cs +++ b/sdk/qumulo/Azure.ResourceManager.Qumulo/src/Generated/QumuloFileSystemResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Qumulo public partial class QumuloFileSystemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fileSystemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fileSystemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}"; diff --git a/sdk/quota/Azure.ResourceManager.Quota/api/Azure.ResourceManager.Quota.netstandard2.0.cs b/sdk/quota/Azure.ResourceManager.Quota/api/Azure.ResourceManager.Quota.netstandard2.0.cs index e4d968428e0db..57b7e74411f05 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/api/Azure.ResourceManager.Quota.netstandard2.0.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/api/Azure.ResourceManager.Quota.netstandard2.0.cs @@ -116,6 +116,31 @@ protected QuotaRequestDetailResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Quota.Mocking +{ + public partial class MockableQuotaArmClient : Azure.ResourceManager.ArmResource + { + protected MockableQuotaArmClient() { } + public virtual Azure.Response GetCurrentQuotaLimitBase(Azure.Core.ResourceIdentifier scope, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCurrentQuotaLimitBaseAsync(Azure.Core.ResourceIdentifier scope, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.CurrentQuotaLimitBaseResource GetCurrentQuotaLimitBaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.CurrentQuotaLimitBaseCollection GetCurrentQuotaLimitBases(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetCurrentUsagesBase(Azure.Core.ResourceIdentifier scope, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCurrentUsagesBaseAsync(Azure.Core.ResourceIdentifier scope, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.CurrentUsagesBaseResource GetCurrentUsagesBaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.CurrentUsagesBaseCollection GetCurrentUsagesBases(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetQuotaRequestDetail(Azure.Core.ResourceIdentifier scope, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetQuotaRequestDetailAsync(Azure.Core.ResourceIdentifier scope, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Quota.QuotaRequestDetailResource GetQuotaRequestDetailResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Quota.QuotaRequestDetailCollection GetQuotaRequestDetails(Azure.Core.ResourceIdentifier scope) { throw null; } + } + public partial class MockableQuotaTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableQuotaTenantResource() { } + public virtual Azure.Pageable GetQuotaOperations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQuotaOperationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Quota.Models { public static partial class ArmQuotaModelFactory diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseResource.cs index 6424b5dd7d47a..900bc5444ef28 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentQuotaLimitBaseResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Quota public partial class CurrentQuotaLimitBaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string resourceName) { var resourceId = $"{scope}/providers/Microsoft.Quota/quotas/{resourceName}"; diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseResource.cs index 698b50853428a..406d7bc686870 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/CurrentUsagesBaseResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Quota public partial class CurrentUsagesBaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string resourceName) { var resourceId = $"{scope}/providers/Microsoft.Quota/usages/{resourceName}"; diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index acd0676706101..0000000000000 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Quota -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of CurrentUsagesBaseResources in the ArmResource. - /// An object representing collection of CurrentUsagesBaseResources and their operations over a CurrentUsagesBaseResource. - public virtual CurrentUsagesBaseCollection GetCurrentUsagesBases() - { - return GetCachedClient(Client => new CurrentUsagesBaseCollection(Client, Id)); - } - - /// Gets a collection of CurrentQuotaLimitBaseResources in the ArmResource. - /// An object representing collection of CurrentQuotaLimitBaseResources and their operations over a CurrentQuotaLimitBaseResource. - public virtual CurrentQuotaLimitBaseCollection GetCurrentQuotaLimitBases() - { - return GetCachedClient(Client => new CurrentQuotaLimitBaseCollection(Client, Id)); - } - - /// Gets a collection of QuotaRequestDetailResources in the ArmResource. - /// An object representing collection of QuotaRequestDetailResources and their operations over a QuotaRequestDetailResource. - public virtual QuotaRequestDetailCollection GetQuotaRequestDetails() - { - return GetCachedClient(Client => new QuotaRequestDetailCollection(Client, Id)); - } - } -} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaArmClient.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaArmClient.cs new file mode 100644 index 0000000000000..c51880bd4e52c --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaArmClient.cs @@ -0,0 +1,267 @@ +// 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.Quota; + +namespace Azure.ResourceManager.Quota.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableQuotaArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableQuotaArmClient() + { + } + + /// 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 MockableQuotaArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableQuotaArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CurrentUsagesBaseResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of CurrentUsagesBaseResources and their operations over a CurrentUsagesBaseResource. + public virtual CurrentUsagesBaseCollection GetCurrentUsagesBases(ResourceIdentifier scope) + { + return new CurrentUsagesBaseCollection(Client, scope); + } + + /// + /// Get the current usage of a resource. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/usages/{resourceName} + /// + /// + /// Operation Id + /// Usages_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCurrentUsagesBaseAsync(ResourceIdentifier scope, string resourceName, CancellationToken cancellationToken = default) + { + return await GetCurrentUsagesBases(scope).GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the current usage of a resource. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/usages/{resourceName} + /// + /// + /// Operation Id + /// Usages_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCurrentUsagesBase(ResourceIdentifier scope, string resourceName, CancellationToken cancellationToken = default) + { + return GetCurrentUsagesBases(scope).Get(resourceName, cancellationToken); + } + + /// Gets a collection of CurrentQuotaLimitBaseResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of CurrentQuotaLimitBaseResources and their operations over a CurrentQuotaLimitBaseResource. + public virtual CurrentQuotaLimitBaseCollection GetCurrentQuotaLimitBases(ResourceIdentifier scope) + { + return new CurrentQuotaLimitBaseCollection(Client, scope); + } + + /// + /// Get the quota limit of a resource. The response can be used to determine the remaining quota to calculate a new quota limit that can be submitted with a PUT request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/quotas/{resourceName} + /// + /// + /// Operation Id + /// Quota_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCurrentQuotaLimitBaseAsync(ResourceIdentifier scope, string resourceName, CancellationToken cancellationToken = default) + { + return await GetCurrentQuotaLimitBases(scope).GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the quota limit of a resource. The response can be used to determine the remaining quota to calculate a new quota limit that can be submitted with a PUT request. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/quotas/{resourceName} + /// + /// + /// Operation Id + /// Quota_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCurrentQuotaLimitBase(ResourceIdentifier scope, string resourceName, CancellationToken cancellationToken = default) + { + return GetCurrentQuotaLimitBases(scope).Get(resourceName, cancellationToken); + } + + /// Gets a collection of QuotaRequestDetailResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of QuotaRequestDetailResources and their operations over a QuotaRequestDetailResource. + public virtual QuotaRequestDetailCollection GetQuotaRequestDetails(ResourceIdentifier scope) + { + return new QuotaRequestDetailCollection(Client, scope); + } + + /// + /// Get the quota request details and status by quota request ID for the resources of the resource provider at a specific location. The quota request ID **id** is returned in the response of the PUT operation. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/quotaRequests/{id} + /// + /// + /// Operation Id + /// QuotaRequestStatus_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Quota request ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetQuotaRequestDetailAsync(ResourceIdentifier scope, string id, CancellationToken cancellationToken = default) + { + return await GetQuotaRequestDetails(scope).GetAsync(id, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the quota request details and status by quota request ID for the resources of the resource provider at a specific location. The quota request ID **id** is returned in the response of the PUT operation. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Quota/quotaRequests/{id} + /// + /// + /// Operation Id + /// QuotaRequestStatus_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Quota request ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetQuotaRequestDetail(ResourceIdentifier scope, string id, CancellationToken cancellationToken = default) + { + return GetQuotaRequestDetails(scope).Get(id, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CurrentUsagesBaseResource GetCurrentUsagesBaseResource(ResourceIdentifier id) + { + CurrentUsagesBaseResource.ValidateResourceId(id); + return new CurrentUsagesBaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CurrentQuotaLimitBaseResource GetCurrentQuotaLimitBaseResource(ResourceIdentifier id) + { + CurrentQuotaLimitBaseResource.ValidateResourceId(id); + return new CurrentQuotaLimitBaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual QuotaRequestDetailResource GetQuotaRequestDetailResource(ResourceIdentifier id) + { + QuotaRequestDetailResource.ValidateResourceId(id); + return new QuotaRequestDetailResource(Client, id); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaTenantResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaTenantResource.cs new file mode 100644 index 0000000000000..b88404d89f274 --- /dev/null +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/MockableQuotaTenantResource.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Quota; +using Azure.ResourceManager.Quota.Models; + +namespace Azure.ResourceManager.Quota.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableQuotaTenantResource : ArmResource + { + private ClientDiagnostics _quotaOperationClientDiagnostics; + private QuotaOperationRestOperations _quotaOperationRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableQuotaTenantResource() + { + } + + /// 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 MockableQuotaTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics QuotaOperationClientDiagnostics => _quotaOperationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quota", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private QuotaOperationRestOperations QuotaOperationRestClient => _quotaOperationRestClient ??= new QuotaOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all the operations supported by the Microsoft.Quota resource provider. + /// + /// + /// Request Path + /// /providers/Microsoft.Quota/operations + /// + /// + /// Operation Id + /// QuotaOperation_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQuotaOperationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => QuotaOperationRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotaOperationRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, QuotaOperationResult.DeserializeQuotaOperationResult, QuotaOperationClientDiagnostics, Pipeline, "MockableQuotaTenantResource.GetQuotaOperations", "value", "nextLink", cancellationToken); + } + + /// + /// List all the operations supported by the Microsoft.Quota resource provider. + /// + /// + /// Request Path + /// /providers/Microsoft.Quota/operations + /// + /// + /// Operation Id + /// QuotaOperation_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQuotaOperations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => QuotaOperationRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotaOperationRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, QuotaOperationResult.DeserializeQuotaOperationResult, QuotaOperationClientDiagnostics, Pipeline, "MockableQuotaTenantResource.GetQuotaOperations", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/QuotaExtensions.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/QuotaExtensions.cs index 41dda3945133b..a45014ffca949 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/QuotaExtensions.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/QuotaExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Quota.Mocking; using Azure.ResourceManager.Quota.Models; using Azure.ResourceManager.Resources; @@ -19,101 +20,29 @@ namespace Azure.ResourceManager.Quota /// A class to add extension methods to Azure.ResourceManager.Quota. public static partial class QuotaExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableQuotaArmClient GetMockableQuotaArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableQuotaArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableQuotaTenantResource GetMockableQuotaTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableQuotaTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region CurrentUsagesBaseResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CurrentUsagesBaseResource GetCurrentUsagesBaseResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - CurrentUsagesBaseResource.ValidateResourceId(id); - return new CurrentUsagesBaseResource(client, id); - } - ); - } - #endregion - - #region CurrentQuotaLimitBaseResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CurrentQuotaLimitBaseResource GetCurrentQuotaLimitBaseResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - CurrentQuotaLimitBaseResource.ValidateResourceId(id); - return new CurrentQuotaLimitBaseResource(client, id); - } - ); - } - #endregion - - #region QuotaRequestDetailResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of CurrentUsagesBaseResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static QuotaRequestDetailResource GetQuotaRequestDetailResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - QuotaRequestDetailResource.ValidateResourceId(id); - return new QuotaRequestDetailResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of CurrentUsagesBaseResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of CurrentUsagesBaseResources and their operations over a CurrentUsagesBaseResource. public static CurrentUsagesBaseCollection GetCurrentUsagesBases(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetCurrentUsagesBases(); + return GetMockableQuotaArmClient(client).GetCurrentUsagesBases(scope); } /// @@ -128,6 +57,10 @@ public static CurrentUsagesBaseCollection GetCurrentUsagesBases(this ArmClient c /// Usages_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -138,12 +71,12 @@ public static CurrentUsagesBaseCollection GetCurrentUsagesBases(this ArmClient c /// For Microsoft.Network PublicIPAddresses. /// /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCurrentUsagesBaseAsync(this ArmClient client, ResourceIdentifier scope, string resourceName, CancellationToken cancellationToken = default) { - return await client.GetCurrentUsagesBases(scope).GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableQuotaArmClient(client).GetCurrentUsagesBaseAsync(scope, resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -158,6 +91,10 @@ public static async Task> GetCurrentUsagesBa /// Usages_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -168,21 +105,27 @@ public static async Task> GetCurrentUsagesBa /// For Microsoft.Network PublicIPAddresses. /// /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCurrentUsagesBase(this ArmClient client, ResourceIdentifier scope, string resourceName, CancellationToken cancellationToken = default) { - return client.GetCurrentUsagesBases(scope).Get(resourceName, cancellationToken); + return GetMockableQuotaArmClient(client).GetCurrentUsagesBase(scope, resourceName, cancellationToken); } - /// Gets a collection of CurrentQuotaLimitBaseResources in the ArmResource. + /// + /// Gets a collection of CurrentQuotaLimitBaseResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of CurrentQuotaLimitBaseResources and their operations over a CurrentQuotaLimitBaseResource. public static CurrentQuotaLimitBaseCollection GetCurrentQuotaLimitBases(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetCurrentQuotaLimitBases(); + return GetMockableQuotaArmClient(client).GetCurrentQuotaLimitBases(scope); } /// @@ -197,6 +140,10 @@ public static CurrentQuotaLimitBaseCollection GetCurrentQuotaLimitBases(this Arm /// Quota_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -207,12 +154,12 @@ public static CurrentQuotaLimitBaseCollection GetCurrentQuotaLimitBases(this Arm /// For Microsoft.Network PublicIPAddresses. /// /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCurrentQuotaLimitBaseAsync(this ArmClient client, ResourceIdentifier scope, string resourceName, CancellationToken cancellationToken = default) { - return await client.GetCurrentQuotaLimitBases(scope).GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableQuotaArmClient(client).GetCurrentQuotaLimitBaseAsync(scope, resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -227,6 +174,10 @@ public static async Task> GetCurrentQuot /// Quota_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -237,21 +188,27 @@ public static async Task> GetCurrentQuot /// For Microsoft.Network PublicIPAddresses. /// /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCurrentQuotaLimitBase(this ArmClient client, ResourceIdentifier scope, string resourceName, CancellationToken cancellationToken = default) { - return client.GetCurrentQuotaLimitBases(scope).Get(resourceName, cancellationToken); + return GetMockableQuotaArmClient(client).GetCurrentQuotaLimitBase(scope, resourceName, cancellationToken); } - /// Gets a collection of QuotaRequestDetailResources in the ArmResource. + /// + /// Gets a collection of QuotaRequestDetailResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of QuotaRequestDetailResources and their operations over a QuotaRequestDetailResource. public static QuotaRequestDetailCollection GetQuotaRequestDetails(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetQuotaRequestDetails(); + return GetMockableQuotaArmClient(client).GetQuotaRequestDetails(scope); } /// @@ -266,17 +223,21 @@ public static QuotaRequestDetailCollection GetQuotaRequestDetails(this ArmClient /// QuotaRequestStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Quota request ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetQuotaRequestDetailAsync(this ArmClient client, ResourceIdentifier scope, string id, CancellationToken cancellationToken = default) { - return await client.GetQuotaRequestDetails(scope).GetAsync(id, cancellationToken).ConfigureAwait(false); + return await GetMockableQuotaArmClient(client).GetQuotaRequestDetailAsync(scope, id, cancellationToken).ConfigureAwait(false); } /// @@ -291,17 +252,69 @@ public static async Task> GetQuotaRequestDe /// QuotaRequestStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Quota request ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetQuotaRequestDetail(this ArmClient client, ResourceIdentifier scope, string id, CancellationToken cancellationToken = default) { - return client.GetQuotaRequestDetails(scope).Get(id, cancellationToken); + return GetMockableQuotaArmClient(client).GetQuotaRequestDetail(scope, id, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static CurrentUsagesBaseResource GetCurrentUsagesBaseResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableQuotaArmClient(client).GetCurrentUsagesBaseResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static CurrentQuotaLimitBaseResource GetCurrentQuotaLimitBaseResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableQuotaArmClient(client).GetCurrentQuotaLimitBaseResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static QuotaRequestDetailResource GetQuotaRequestDetailResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableQuotaArmClient(client).GetQuotaRequestDetailResource(id); } /// @@ -316,13 +329,17 @@ public static Response GetQuotaRequestDetail(this Ar /// QuotaOperation_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetQuotaOperationsAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetQuotaOperationsAsync(cancellationToken); + return GetMockableQuotaTenantResource(tenantResource).GetQuotaOperationsAsync(cancellationToken); } /// @@ -337,13 +354,17 @@ public static AsyncPageable GetQuotaOperationsAsync(this T /// QuotaOperation_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetQuotaOperations(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetQuotaOperations(cancellationToken); + return GetMockableQuotaTenantResource(tenantResource).GetQuotaOperations(cancellationToken); } } } diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 41343bb69708d..0000000000000 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Quota.Models; - -namespace Azure.ResourceManager.Quota -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _quotaOperationClientDiagnostics; - private QuotaOperationRestOperations _quotaOperationRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics QuotaOperationClientDiagnostics => _quotaOperationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Quota", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private QuotaOperationRestOperations QuotaOperationRestClient => _quotaOperationRestClient ??= new QuotaOperationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List all the operations supported by the Microsoft.Quota resource provider. - /// - /// - /// Request Path - /// /providers/Microsoft.Quota/operations - /// - /// - /// Operation Id - /// QuotaOperation_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetQuotaOperationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QuotaOperationRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotaOperationRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, QuotaOperationResult.DeserializeQuotaOperationResult, QuotaOperationClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetQuotaOperations", "value", "nextLink", cancellationToken); - } - - /// - /// List all the operations supported by the Microsoft.Quota resource provider. - /// - /// - /// Request Path - /// /providers/Microsoft.Quota/operations - /// - /// - /// Operation Id - /// QuotaOperation_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetQuotaOperations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => QuotaOperationRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => QuotaOperationRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, QuotaOperationResult.DeserializeQuotaOperationResult, QuotaOperationClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetQuotaOperations", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailResource.cs b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailResource.cs index 650ecb02af8a0..c23e8af4c668d 100644 --- a/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailResource.cs +++ b/sdk/quota/Azure.ResourceManager.Quota/src/Generated/QuotaRequestDetailResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Quota public partial class QuotaRequestDetailResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string scope, string id) { var resourceId = $"{scope}/providers/Microsoft.Quota/quotaRequests/{id}"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/api/Azure.ResourceManager.RecoveryServicesBackup.netstandard2.0.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/api/Azure.ResourceManager.RecoveryServicesBackup.netstandard2.0.cs index 73773e6577ff4..0d65ca1d0e233 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/api/Azure.ResourceManager.RecoveryServicesBackup.netstandard2.0.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/api/Azure.ResourceManager.RecoveryServicesBackup.netstandard2.0.cs @@ -17,7 +17,7 @@ protected BackupEngineCollection() { } } public partial class BackupEngineData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupEngineData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupEngineData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupGenericEngine Properties { get { throw null; } set { } } } @@ -48,7 +48,7 @@ protected BackupJobCollection() { } } public partial class BackupJobData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupJobData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupJobData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupGenericJob Properties { get { throw null; } set { } } } @@ -78,7 +78,7 @@ protected BackupPrivateEndpointConnectionCollection() { } } public partial class BackupPrivateEndpointConnectionData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupPrivateEndpointConnectionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupPrivateEndpointConnectionData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupPrivateEndpointConnectionProperties Properties { get { throw null; } set { } } } @@ -116,7 +116,7 @@ protected BackupProtectedItemCollection() { } } public partial class BackupProtectedItemData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupProtectedItemData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupProtectedItemData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupGenericProtectedItem Properties { get { throw null; } set { } } } @@ -161,7 +161,7 @@ protected BackupProtectionContainerCollection() { } } public partial class BackupProtectionContainerData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupProtectionContainerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupProtectionContainerData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupGenericProtectionContainer Properties { get { throw null; } set { } } } @@ -206,7 +206,7 @@ protected BackupProtectionIntentCollection() { } } public partial class BackupProtectionIntentData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupProtectionIntentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupProtectionIntentData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupGenericProtectionIntent Properties { get { throw null; } set { } } } @@ -249,7 +249,7 @@ protected BackupProtectionPolicyCollection() { } } public partial class BackupProtectionPolicyData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupProtectionPolicyData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupProtectionPolicyData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupGenericProtectionPolicy Properties { get { throw null; } set { } } } @@ -290,7 +290,7 @@ protected BackupRecoveryPointCollection() { } } public partial class BackupRecoveryPointData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupRecoveryPointData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupRecoveryPointData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupGenericRecoveryPoint Properties { get { throw null; } set { } } } @@ -326,7 +326,7 @@ protected BackupResourceConfigCollection() { } } public partial class BackupResourceConfigData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupResourceConfigData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupResourceConfigData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupResourceConfigProperties Properties { get { throw null; } set { } } } @@ -366,7 +366,7 @@ protected BackupResourceEncryptionConfigExtendedCollection() { } } public partial class BackupResourceEncryptionConfigExtendedData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupResourceEncryptionConfigExtendedData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupResourceEncryptionConfigExtendedData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupResourceEncryptionConfigExtendedProperties Properties { get { throw null; } set { } } } @@ -402,7 +402,7 @@ protected BackupResourceVaultConfigCollection() { } } public partial class BackupResourceVaultConfigData : Azure.ResourceManager.Models.TrackedResourceData { - public BackupResourceVaultConfigData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupResourceVaultConfigData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupResourceVaultConfigProperties Properties { get { throw null; } set { } } } @@ -514,7 +514,7 @@ protected ResourceGuardProxyCollection() { } } public partial class ResourceGuardProxyData : Azure.ResourceManager.Models.TrackedResourceData { - public ResourceGuardProxyData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ResourceGuardProxyData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.ResourceGuardProxyProperties Properties { get { throw null; } set { } } } @@ -541,6 +541,89 @@ protected ResourceGuardProxyResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesBackup.ResourceGuardProxyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.RecoveryServicesBackup.Mocking +{ + public partial class MockableRecoveryServicesBackupArmClient : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesBackupArmClient() { } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupEngineResource GetBackupEngineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupJobResource GetBackupJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupPrivateEndpointConnectionResource GetBackupPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupProtectedItemResource GetBackupProtectedItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupProtectionContainerResource GetBackupProtectionContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupProtectionIntentResource GetBackupProtectionIntentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupProtectionPolicyResource GetBackupProtectionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupRecoveryPointResource GetBackupRecoveryPointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupResourceConfigResource GetBackupResourceConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupResourceEncryptionConfigExtendedResource GetBackupResourceEncryptionConfigExtendedResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupResourceVaultConfigResource GetBackupResourceVaultConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.ResourceGuardProxyResource GetResourceGuardProxyResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableRecoveryServicesBackupResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesBackupResourceGroupResource() { } + public virtual Azure.Response ExportJob(string vaultName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ExportJobAsync(string vaultName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBackupEngine(string vaultName, string backupEngineName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupEngineAsync(string vaultName, string backupEngineName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupEngineCollection GetBackupEngines(string vaultName) { throw null; } + public virtual Azure.Response GetBackupJob(string vaultName, string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupJobAsync(string vaultName, string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupJobCollection GetBackupJobs(string vaultName) { throw null; } + public virtual Azure.Response GetBackupPrivateEndpointConnection(string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupPrivateEndpointConnectionAsync(string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupPrivateEndpointConnectionCollection GetBackupPrivateEndpointConnections() { throw null; } + public virtual Azure.Pageable GetBackupProtectableItems(string vaultName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBackupProtectableItemsAsync(string vaultName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBackupProtectedItems(string vaultName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBackupProtectedItemsAsync(string vaultName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBackupProtectionContainer(string vaultName, string fabricName, string containerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupProtectionContainerAsync(string vaultName, string fabricName, string containerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupProtectionContainerCollection GetBackupProtectionContainers() { throw null; } + public virtual Azure.Pageable GetBackupProtectionContainers(string vaultName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBackupProtectionContainersAsync(string vaultName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBackupProtectionIntent(string vaultName, string fabricName, string intentObjectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupProtectionIntentAsync(string vaultName, string fabricName, string intentObjectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupProtectionIntentCollection GetBackupProtectionIntents() { throw null; } + public virtual Azure.Pageable GetBackupProtectionIntents(string vaultName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBackupProtectionIntentsAsync(string vaultName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupProtectionPolicyCollection GetBackupProtectionPolicies(string vaultName) { throw null; } + public virtual Azure.Response GetBackupProtectionPolicy(string vaultName, string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupProtectionPolicyAsync(string vaultName, string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetBackupResourceConfig(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupResourceConfigAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupResourceConfigCollection GetBackupResourceConfigs() { throw null; } + public virtual Azure.Response GetBackupResourceEncryptionConfigExtended(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupResourceEncryptionConfigExtendedAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupResourceEncryptionConfigExtendedCollection GetBackupResourceEncryptionConfigExtendeds() { throw null; } + public virtual Azure.Response GetBackupResourceVaultConfig(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupResourceVaultConfigAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.BackupResourceVaultConfigCollection GetBackupResourceVaultConfigs() { throw null; } + public virtual Azure.Pageable GetBackupUsageSummaries(string vaultName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBackupUsageSummariesAsync(string vaultName, string filter = null, string skipToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProtectableContainers(string vaultName, string fabricName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProtectableContainersAsync(string vaultName, string fabricName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesBackup.ResourceGuardProxyCollection GetResourceGuardProxies(string vaultName) { throw null; } + public virtual Azure.Response GetResourceGuardProxy(string vaultName, string resourceGuardProxyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceGuardProxyAsync(string vaultName, string resourceGuardProxyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSecurityPin(string vaultName, Azure.ResourceManager.RecoveryServicesBackup.Models.SecurityPinContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityPinAsync(string vaultName, Azure.ResourceManager.RecoveryServicesBackup.Models.SecurityPinContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSoftDeletedProtectionContainers(string vaultName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSoftDeletedProtectionContainersAsync(string vaultName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RefreshProtectionContainer(string vaultName, string fabricName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task RefreshProtectionContainerAsync(string vaultName, string fabricName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableRecoveryServicesBackupSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesBackupSubscriptionResource() { } + public virtual Azure.Response GetBackupStatus(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesBackup.Models.BackupStatusContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBackupStatusAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesBackup.Models.BackupStatusContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ValidateFeatureSupport(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesBackup.Models.FeatureSupportContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateFeatureSupportAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesBackup.Models.FeatureSupportContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ValidateProtectionIntent(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesBackup.Models.PreValidateEnableBackupContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateProtectionIntentAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesBackup.Models.PreValidateEnableBackupContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.RecoveryServicesBackup.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -1047,7 +1130,7 @@ public BackupResourceEncryptionConfig() { } } public partial class BackupResourceEncryptionConfigExtendedCreateOrUpdateContent : Azure.ResourceManager.Models.TrackedResourceData { - public BackupResourceEncryptionConfigExtendedCreateOrUpdateContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public BackupResourceEncryptionConfigExtendedCreateOrUpdateContent(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupResourceEncryptionConfig Properties { get { throw null; } set { } } } @@ -2195,7 +2278,7 @@ protected ProtectableContainer() { } } public partial class ProtectableContainerResource : Azure.ResourceManager.Models.TrackedResourceData { - public ProtectableContainerResource(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ProtectableContainerResource(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.ProtectableContainer Properties { get { throw null; } set { } } } @@ -2224,7 +2307,7 @@ public ProtectableContainerResource(Azure.Core.AzureLocation location) : base (d } public partial class ProvisionIlrConnectionContent : Azure.ResourceManager.Models.TrackedResourceData { - public ProvisionIlrConnectionContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ProvisionIlrConnectionContent(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.IlrContent Properties { get { throw null; } set { } } } @@ -2732,7 +2815,7 @@ internal TokenInformation() { } } public partial class TriggerBackupContent : Azure.ResourceManager.Models.TrackedResourceData { - public TriggerBackupContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public TriggerBackupContent(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.BackupContent Properties { get { throw null; } set { } } } @@ -2748,7 +2831,7 @@ public TriggerDataMoveContent(Azure.Core.ResourceIdentifier sourceResourceId, Az } public partial class TriggerRestoreContent : Azure.ResourceManager.Models.TrackedResourceData { - public TriggerRestoreContent(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public TriggerRestoreContent(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.RestoreContent Properties { get { throw null; } set { } } } @@ -3138,7 +3221,7 @@ protected WorkloadItem() { } } public partial class WorkloadItemResource : Azure.ResourceManager.Models.TrackedResourceData { - public WorkloadItemResource(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public WorkloadItemResource(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.WorkloadItem Properties { get { throw null; } set { } } } @@ -3205,7 +3288,7 @@ protected WorkloadProtectableItem() { } } public partial class WorkloadProtectableItemResource : Azure.ResourceManager.Models.TrackedResourceData { - public WorkloadProtectableItemResource(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public WorkloadProtectableItemResource(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServicesBackup.Models.WorkloadProtectableItem Properties { get { throw null; } set { } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupEngineResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupEngineResource.cs index dd5a4c96ef9a4..571d2c35573b8 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupEngineResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupEngineResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupEngineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The backupEngineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string backupEngineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupJobResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupJobResource.cs index cd445587cb755..55ac0a03da3c2 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupJobResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupJobResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupPrivateEndpointConnectionResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupPrivateEndpointConnectionResource.cs index c2a958d493c28..fe801752c34da 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupPrivateEndpointConnectionResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupPrivateEndpointConnectionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemResource.cs index a5a5d0796c4bd..da3ebda1ca2c5 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemResource.cs @@ -28,6 +28,12 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupProtectedItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The fabricName. + /// The containerName. + /// The protectedItemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string fabricName, string containerName, string protectedItemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"; @@ -101,7 +107,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BackupRecoveryPointResources and their operations over a BackupRecoveryPointResource. public virtual BackupRecoveryPointCollection GetBackupRecoveryPoints() { - return GetCachedClient(Client => new BackupRecoveryPointCollection(Client, Id)); + return GetCachedClient(client => new BackupRecoveryPointCollection(client, Id)); } /// @@ -120,8 +126,8 @@ public virtual BackupRecoveryPointCollection GetBackupRecoveryPoints() /// /// RecoveryPointID represents the backed up data to be fetched. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBackupRecoveryPointAsync(string recoveryPointId, CancellationToken cancellationToken = default) { @@ -144,8 +150,8 @@ public virtual async Task> GetBackupRecove /// /// RecoveryPointID represents the backed up data to be fetched. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBackupRecoveryPoint(string recoveryPointId, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerResource.cs index 4d66fc870fe13..a6b6d3778e0ef 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerResource.cs @@ -29,6 +29,11 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupProtectionContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The fabricName. + /// The containerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string fabricName, string containerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"; @@ -98,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BackupProtectedItemResources and their operations over a BackupProtectedItemResource. public virtual BackupProtectedItemCollection GetBackupProtectedItems() { - return GetCachedClient(Client => new BackupProtectedItemCollection(Client, Id)); + return GetCachedClient(client => new BackupProtectedItemCollection(client, Id)); } /// @@ -118,8 +123,8 @@ public virtual BackupProtectedItemCollection GetBackupProtectedItems() /// Backed up item name whose details are to be fetched. /// OData filter options. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBackupProtectedItemAsync(string protectedItemName, string filter = null, CancellationToken cancellationToken = default) { @@ -143,8 +148,8 @@ public virtual async Task> GetBackupProtec /// Backed up item name whose details are to be fetched. /// OData filter options. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBackupProtectedItem(string protectedItemName, string filter = null, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionIntentResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionIntentResource.cs index 55eed6a2afb8e..0ea707e39c4ce 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionIntentResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionIntentResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupProtectionIntentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The fabricName. + /// The intentObjectName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string fabricName, string intentObjectName) { var resourceId = $"/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionPolicyResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionPolicyResource.cs index 5d4951ddc6cd2..4c50bae89b7f0 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionPolicyResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionPolicyResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupProtectionPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupRecoveryPointResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupRecoveryPointResource.cs index 69d8f1f2129c2..8e653b39273a3 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupRecoveryPointResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupRecoveryPointResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupRecoveryPointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The fabricName. + /// The containerName. + /// The protectedItemName. + /// The recoveryPointId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string fabricName, string containerName, string protectedItemName, string recoveryPointId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceConfigResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceConfigResource.cs index 4e1a445e60cb1..8453c030eca65 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceConfigResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceConfigResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupResourceConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { var resourceId = $"/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceEncryptionConfigExtendedResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceEncryptionConfigExtendedResource.cs index 9538c9a5964ec..8c9f951093b98 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceEncryptionConfigExtendedResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceEncryptionConfigExtendedResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupResourceEncryptionConfigExtendedResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceVaultConfigResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceVaultConfigResource.cs index 7320c5103f9ad..c3b9d0bab9d2f 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceVaultConfigResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupResourceVaultConfigResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class BackupResourceVaultConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"; diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupArmClient.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupArmClient.cs new file mode 100644 index 0000000000000..fd297641ad66b --- /dev/null +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupArmClient.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesBackup; + +namespace Azure.ResourceManager.RecoveryServicesBackup.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableRecoveryServicesBackupArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesBackupArmClient() + { + } + + /// 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 MockableRecoveryServicesBackupArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableRecoveryServicesBackupArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupResourceConfigResource GetBackupResourceConfigResource(ResourceIdentifier id) + { + BackupResourceConfigResource.ValidateResourceId(id); + return new BackupResourceConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupProtectionIntentResource GetBackupProtectionIntentResource(ResourceIdentifier id) + { + BackupProtectionIntentResource.ValidateResourceId(id); + return new BackupProtectionIntentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupResourceVaultConfigResource GetBackupResourceVaultConfigResource(ResourceIdentifier id) + { + BackupResourceVaultConfigResource.ValidateResourceId(id); + return new BackupResourceVaultConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupResourceEncryptionConfigExtendedResource GetBackupResourceEncryptionConfigExtendedResource(ResourceIdentifier id) + { + BackupResourceEncryptionConfigExtendedResource.ValidateResourceId(id); + return new BackupResourceEncryptionConfigExtendedResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupPrivateEndpointConnectionResource GetBackupPrivateEndpointConnectionResource(ResourceIdentifier id) + { + BackupPrivateEndpointConnectionResource.ValidateResourceId(id); + return new BackupPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupProtectedItemResource GetBackupProtectedItemResource(ResourceIdentifier id) + { + BackupProtectedItemResource.ValidateResourceId(id); + return new BackupProtectedItemResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupRecoveryPointResource GetBackupRecoveryPointResource(ResourceIdentifier id) + { + BackupRecoveryPointResource.ValidateResourceId(id); + return new BackupRecoveryPointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupProtectionPolicyResource GetBackupProtectionPolicyResource(ResourceIdentifier id) + { + BackupProtectionPolicyResource.ValidateResourceId(id); + return new BackupProtectionPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupJobResource GetBackupJobResource(ResourceIdentifier id) + { + BackupJobResource.ValidateResourceId(id); + return new BackupJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupEngineResource GetBackupEngineResource(ResourceIdentifier id) + { + BackupEngineResource.ValidateResourceId(id); + return new BackupEngineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupProtectionContainerResource GetBackupProtectionContainerResource(ResourceIdentifier id) + { + BackupProtectionContainerResource.ValidateResourceId(id); + return new BackupProtectionContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceGuardProxyResource GetResourceGuardProxyResource(ResourceIdentifier id) + { + ResourceGuardProxyResource.ValidateResourceId(id); + return new ResourceGuardProxyResource(Client, id); + } + } +} diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupResourceGroupResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupResourceGroupResource.cs new file mode 100644 index 0000000000000..36b580cb68124 --- /dev/null +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupResourceGroupResource.cs @@ -0,0 +1,1278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesBackup; +using Azure.ResourceManager.RecoveryServicesBackup.Models; + +namespace Azure.ResourceManager.RecoveryServicesBackup.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableRecoveryServicesBackupResourceGroupResource : ArmResource + { + private ClientDiagnostics _backupProtectionIntentClientDiagnostics; + private BackupProtectionIntentRestOperations _backupProtectionIntentRestClient; + private ClientDiagnostics _backupUsageSummariesClientDiagnostics; + private BackupUsageSummariesRestOperations _backupUsageSummariesRestClient; + private ClientDiagnostics _jobsClientDiagnostics; + private JobsRestOperations _jobsRestClient; + private ClientDiagnostics _backupProtectedItemsClientDiagnostics; + private BackupProtectedItemsRestOperations _backupProtectedItemsRestClient; + private ClientDiagnostics _protectableContainersClientDiagnostics; + private ProtectableContainersRestOperations _protectableContainersRestClient; + private ClientDiagnostics _backupProtectionContainerProtectionContainersClientDiagnostics; + private ProtectionContainersRestOperations _backupProtectionContainerProtectionContainersRestClient; + private ClientDiagnostics _backupProtectableItemsClientDiagnostics; + private BackupProtectableItemsRestOperations _backupProtectableItemsRestClient; + private ClientDiagnostics _backupProtectionContainersClientDiagnostics; + private BackupProtectionContainersRestOperations _backupProtectionContainersRestClient; + private ClientDiagnostics _deletedProtectionContainersClientDiagnostics; + private DeletedProtectionContainersRestOperations _deletedProtectionContainersRestClient; + private ClientDiagnostics _securityPINsClientDiagnostics; + private SecurityPINsRestOperations _securityPINsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesBackupResourceGroupResource() + { + } + + /// 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 MockableRecoveryServicesBackupResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics BackupProtectionIntentClientDiagnostics => _backupProtectionIntentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BackupProtectionIntentRestOperations BackupProtectionIntentRestClient => _backupProtectionIntentRestClient ??= new BackupProtectionIntentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BackupUsageSummariesClientDiagnostics => _backupUsageSummariesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BackupUsageSummariesRestOperations BackupUsageSummariesRestClient => _backupUsageSummariesRestClient ??= new BackupUsageSummariesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics JobsClientDiagnostics => _jobsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private JobsRestOperations JobsRestClient => _jobsRestClient ??= new JobsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BackupProtectedItemsClientDiagnostics => _backupProtectedItemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BackupProtectedItemsRestOperations BackupProtectedItemsRestClient => _backupProtectedItemsRestClient ??= new BackupProtectedItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ProtectableContainersClientDiagnostics => _protectableContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ProtectableContainersRestOperations ProtectableContainersRestClient => _protectableContainersRestClient ??= new ProtectableContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BackupProtectionContainerProtectionContainersClientDiagnostics => _backupProtectionContainerProtectionContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", BackupProtectionContainerResource.ResourceType.Namespace, Diagnostics); + private ProtectionContainersRestOperations BackupProtectionContainerProtectionContainersRestClient => _backupProtectionContainerProtectionContainersRestClient ??= new ProtectionContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BackupProtectionContainerResource.ResourceType)); + private ClientDiagnostics BackupProtectableItemsClientDiagnostics => _backupProtectableItemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BackupProtectableItemsRestOperations BackupProtectableItemsRestClient => _backupProtectableItemsRestClient ??= new BackupProtectableItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BackupProtectionContainersClientDiagnostics => _backupProtectionContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BackupProtectionContainersRestOperations BackupProtectionContainersRestClient => _backupProtectionContainersRestClient ??= new BackupProtectionContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DeletedProtectionContainersClientDiagnostics => _deletedProtectionContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DeletedProtectionContainersRestOperations DeletedProtectionContainersRestClient => _deletedProtectionContainersRestClient ??= new DeletedProtectionContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SecurityPINsClientDiagnostics => _securityPINsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SecurityPINsRestOperations SecurityPINsRestClient => _securityPINsRestClient ??= new SecurityPINsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of BackupResourceConfigResources in the ResourceGroupResource. + /// An object representing collection of BackupResourceConfigResources and their operations over a BackupResourceConfigResource. + public virtual BackupResourceConfigCollection GetBackupResourceConfigs() + { + return GetCachedClient(client => new BackupResourceConfigCollection(client, Id)); + } + + /// + /// Fetches resource storage config. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig + /// + /// + /// Operation Id + /// BackupResourceStorageConfigsNonCRR_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupResourceConfigAsync(string vaultName, CancellationToken cancellationToken = default) + { + return await GetBackupResourceConfigs().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fetches resource storage config. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig + /// + /// + /// Operation Id + /// BackupResourceStorageConfigsNonCRR_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupResourceConfig(string vaultName, CancellationToken cancellationToken = default) + { + return GetBackupResourceConfigs().Get(vaultName, cancellationToken); + } + + /// Gets a collection of BackupProtectionIntentResources in the ResourceGroupResource. + /// An object representing collection of BackupProtectionIntentResources and their operations over a BackupProtectionIntentResource. + public virtual BackupProtectionIntentCollection GetBackupProtectionIntents() + { + return GetCachedClient(client => new BackupProtectionIntentCollection(client, Id)); + } + + /// + /// Provides the details of the protection intent up item. This is an asynchronous operation. To know the status of the operation, + /// call the GetItemOperationResult API. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName} + /// + /// + /// Operation Id + /// ProtectionIntent_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Fabric name associated with the backed up item. + /// Backed up item name whose details are to be fetched. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupProtectionIntentAsync(string vaultName, string fabricName, string intentObjectName, CancellationToken cancellationToken = default) + { + return await GetBackupProtectionIntents().GetAsync(vaultName, fabricName, intentObjectName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Provides the details of the protection intent up item. This is an asynchronous operation. To know the status of the operation, + /// call the GetItemOperationResult API. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName} + /// + /// + /// Operation Id + /// ProtectionIntent_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Fabric name associated with the backed up item. + /// Backed up item name whose details are to be fetched. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupProtectionIntent(string vaultName, string fabricName, string intentObjectName, CancellationToken cancellationToken = default) + { + return GetBackupProtectionIntents().Get(vaultName, fabricName, intentObjectName, cancellationToken); + } + + /// Gets a collection of BackupResourceVaultConfigResources in the ResourceGroupResource. + /// An object representing collection of BackupResourceVaultConfigResources and their operations over a BackupResourceVaultConfigResource. + public virtual BackupResourceVaultConfigCollection GetBackupResourceVaultConfigs() + { + return GetCachedClient(client => new BackupResourceVaultConfigCollection(client, Id)); + } + + /// + /// Fetches resource vault config. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig + /// + /// + /// Operation Id + /// BackupResourceVaultConfigs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupResourceVaultConfigAsync(string vaultName, CancellationToken cancellationToken = default) + { + return await GetBackupResourceVaultConfigs().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fetches resource vault config. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig + /// + /// + /// Operation Id + /// BackupResourceVaultConfigs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupResourceVaultConfig(string vaultName, CancellationToken cancellationToken = default) + { + return GetBackupResourceVaultConfigs().Get(vaultName, cancellationToken); + } + + /// Gets a collection of BackupResourceEncryptionConfigExtendedResources in the ResourceGroupResource. + /// An object representing collection of BackupResourceEncryptionConfigExtendedResources and their operations over a BackupResourceEncryptionConfigExtendedResource. + public virtual BackupResourceEncryptionConfigExtendedCollection GetBackupResourceEncryptionConfigExtendeds() + { + return GetCachedClient(client => new BackupResourceEncryptionConfigExtendedCollection(client, Id)); + } + + /// + /// Fetches Vault Encryption config. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig + /// + /// + /// Operation Id + /// BackupResourceEncryptionConfigs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupResourceEncryptionConfigExtendedAsync(string vaultName, CancellationToken cancellationToken = default) + { + return await GetBackupResourceEncryptionConfigExtendeds().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fetches Vault Encryption config. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig + /// + /// + /// Operation Id + /// BackupResourceEncryptionConfigs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupResourceEncryptionConfigExtended(string vaultName, CancellationToken cancellationToken = default) + { + return GetBackupResourceEncryptionConfigExtendeds().Get(vaultName, cancellationToken); + } + + /// Gets a collection of BackupPrivateEndpointConnectionResources in the ResourceGroupResource. + /// An object representing collection of BackupPrivateEndpointConnectionResources and their operations over a BackupPrivateEndpointConnectionResource. + public virtual BackupPrivateEndpointConnectionCollection GetBackupPrivateEndpointConnections() + { + return GetCachedClient(client => new BackupPrivateEndpointConnectionCollection(client, Id)); + } + + /// + /// Get Private Endpoint Connection. This call is made by Backup Admin. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupPrivateEndpointConnectionAsync(string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + return await GetBackupPrivateEndpointConnections().GetAsync(vaultName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Private Endpoint Connection. This call is made by Backup Admin. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnection_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupPrivateEndpointConnection(string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + return GetBackupPrivateEndpointConnections().Get(vaultName, privateEndpointConnectionName, cancellationToken); + } + + /// Gets a collection of BackupProtectionPolicyResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of BackupProtectionPolicyResources and their operations over a BackupProtectionPolicyResource. + public virtual BackupProtectionPolicyCollection GetBackupProtectionPolicies(string vaultName) + { + return new BackupProtectionPolicyCollection(Client, Id, vaultName); + } + + /// + /// Provides the details of the backup policies associated to Recovery Services Vault. This is an asynchronous + /// operation. Status of the operation can be fetched using GetPolicyOperationResult API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName} + /// + /// + /// Operation Id + /// ProtectionPolicies_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Backup policy information to be fetched. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupProtectionPolicyAsync(string vaultName, string policyName, CancellationToken cancellationToken = default) + { + return await GetBackupProtectionPolicies(vaultName).GetAsync(policyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Provides the details of the backup policies associated to Recovery Services Vault. This is an asynchronous + /// operation. Status of the operation can be fetched using GetPolicyOperationResult API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName} + /// + /// + /// Operation Id + /// ProtectionPolicies_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Backup policy information to be fetched. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupProtectionPolicy(string vaultName, string policyName, CancellationToken cancellationToken = default) + { + return GetBackupProtectionPolicies(vaultName).Get(policyName, cancellationToken); + } + + /// Gets a collection of BackupJobResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of BackupJobResources and their operations over a BackupJobResource. + public virtual BackupJobCollection GetBackupJobs(string vaultName) + { + return new BackupJobCollection(Client, Id, vaultName); + } + + /// + /// Gets extended information associated with the job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName} + /// + /// + /// Operation Id + /// JobDetails_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the job whose details are to be fetched. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupJobAsync(string vaultName, string jobName, CancellationToken cancellationToken = default) + { + return await GetBackupJobs(vaultName).GetAsync(jobName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets extended information associated with the job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName} + /// + /// + /// Operation Id + /// JobDetails_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the job whose details are to be fetched. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupJob(string vaultName, string jobName, CancellationToken cancellationToken = default) + { + return GetBackupJobs(vaultName).Get(jobName, cancellationToken); + } + + /// Gets a collection of BackupEngineResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of BackupEngineResources and their operations over a BackupEngineResource. + public virtual BackupEngineCollection GetBackupEngines(string vaultName) + { + return new BackupEngineCollection(Client, Id, vaultName); + } + + /// + /// Returns backup management server registered to Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName} + /// + /// + /// Operation Id + /// BackupEngines_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the backup management server. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupEngineAsync(string vaultName, string backupEngineName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + return await GetBackupEngines(vaultName).GetAsync(backupEngineName, filter, skipToken, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns backup management server registered to Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName} + /// + /// + /// Operation Id + /// BackupEngines_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the backup management server. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupEngine(string vaultName, string backupEngineName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + return GetBackupEngines(vaultName).Get(backupEngineName, filter, skipToken, cancellationToken); + } + + /// Gets a collection of BackupProtectionContainerResources in the ResourceGroupResource. + /// An object representing collection of BackupProtectionContainerResources and their operations over a BackupProtectionContainerResource. + public virtual BackupProtectionContainerCollection GetBackupProtectionContainers() + { + return GetCachedClient(client => new BackupProtectionContainerCollection(client, Id)); + } + + /// + /// Gets details of the specific container registered to your Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName} + /// + /// + /// Operation Id + /// ProtectionContainers_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the fabric where the container belongs. + /// Name of the container whose details need to be fetched. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupProtectionContainerAsync(string vaultName, string fabricName, string containerName, CancellationToken cancellationToken = default) + { + return await GetBackupProtectionContainers().GetAsync(vaultName, fabricName, containerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details of the specific container registered to your Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName} + /// + /// + /// Operation Id + /// ProtectionContainers_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the fabric where the container belongs. + /// Name of the container whose details need to be fetched. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupProtectionContainer(string vaultName, string fabricName, string containerName, CancellationToken cancellationToken = default) + { + return GetBackupProtectionContainers().Get(vaultName, fabricName, containerName, cancellationToken); + } + + /// Gets a collection of ResourceGuardProxyResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of ResourceGuardProxyResources and their operations over a ResourceGuardProxyResource. + public virtual ResourceGuardProxyCollection GetResourceGuardProxies(string vaultName) + { + return new ResourceGuardProxyCollection(Client, Id, vaultName); + } + + /// + /// Returns ResourceGuardProxy under vault and with the name referenced in request + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// ResourceGuardProxy_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The String to use. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceGuardProxyAsync(string vaultName, string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + return await GetResourceGuardProxies(vaultName).GetAsync(resourceGuardProxyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns ResourceGuardProxy under vault and with the name referenced in request + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// ResourceGuardProxy_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The String to use. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceGuardProxy(string vaultName, string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + return GetResourceGuardProxies(vaultName).Get(resourceGuardProxyName, cancellationToken); + } + + /// + /// Provides a pageable list of all intents that are present within a vault. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents + /// + /// + /// Operation Id + /// BackupProtectionIntent_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBackupProtectionIntentsAsync(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectionIntentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectionIntentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionIntentResource(Client, BackupProtectionIntentData.DeserializeBackupProtectionIntentData(e)), BackupProtectionIntentClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupProtectionIntents", "value", "nextLink", cancellationToken); + } + + /// + /// Provides a pageable list of all intents that are present within a vault. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents + /// + /// + /// Operation Id + /// BackupProtectionIntent_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBackupProtectionIntents(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectionIntentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectionIntentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionIntentResource(Client, BackupProtectionIntentData.DeserializeBackupProtectionIntentData(e)), BackupProtectionIntentClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupProtectionIntents", "value", "nextLink", cancellationToken); + } + + /// + /// Fetches the backup management usage summaries of the vault. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries + /// + /// + /// Operation Id + /// BackupUsageSummaries_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBackupUsageSummariesAsync(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupUsageSummariesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, BackupManagementUsage.DeserializeBackupManagementUsage, BackupUsageSummariesClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupUsageSummaries", "value", null, cancellationToken); + } + + /// + /// Fetches the backup management usage summaries of the vault. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries + /// + /// + /// Operation Id + /// BackupUsageSummaries_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBackupUsageSummaries(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupUsageSummariesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, BackupManagementUsage.DeserializeBackupManagementUsage, BackupUsageSummariesClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupUsageSummaries", "value", null, cancellationToken); + } + + /// + /// Triggers export of jobs specified by filters and returns an OperationID to track. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport + /// + /// + /// Operation Id + /// Jobs_Export + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task ExportJobAsync(string vaultName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = JobsClientDiagnostics.CreateScope("MockableRecoveryServicesBackupResourceGroupResource.ExportJob"); + scope.Start(); + try + { + var response = await JobsRestClient.ExportAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Triggers export of jobs specified by filters and returns an OperationID to track. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport + /// + /// + /// Operation Id + /// Jobs_Export + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response ExportJob(string vaultName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = JobsClientDiagnostics.CreateScope("MockableRecoveryServicesBackupResourceGroupResource.ExportJob"); + scope.Start(); + try + { + var response = JobsRestClient.Export(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Provides a pageable list of all items that are backed up within a vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems + /// + /// + /// Operation Id + /// BackupProtectedItems_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBackupProtectedItemsAsync(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectedItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectedItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BackupProtectedItemResource(Client, BackupProtectedItemData.DeserializeBackupProtectedItemData(e)), BackupProtectedItemsClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupProtectedItems", "value", "nextLink", cancellationToken); + } + + /// + /// Provides a pageable list of all items that are backed up within a vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems + /// + /// + /// Operation Id + /// BackupProtectedItems_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBackupProtectedItems(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectedItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectedItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BackupProtectedItemResource(Client, BackupProtectedItemData.DeserializeBackupProtectedItemData(e)), BackupProtectedItemsClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupProtectedItems", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the containers that can be registered to Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers + /// + /// + /// Operation Id + /// ProtectableContainers_List + /// + /// + /// + /// The name of the recovery services vault. + /// The String to use. + /// OData filter options. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProtectableContainersAsync(string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ProtectableContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProtectableContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProtectableContainerResource.DeserializeProtectableContainerResource, ProtectableContainersClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetProtectableContainers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the containers that can be registered to Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers + /// + /// + /// Operation Id + /// ProtectableContainers_List + /// + /// + /// + /// The name of the recovery services vault. + /// The String to use. + /// OData filter options. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProtectableContainers(string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ProtectableContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProtectableContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProtectableContainerResource.DeserializeProtectableContainerResource, ProtectableContainersClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetProtectableContainers", "value", "nextLink", cancellationToken); + } + + /// + /// Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an + /// asynchronous operation. To know the status of the operation, call GetRefreshOperationResult API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers + /// + /// + /// Operation Id + /// ProtectionContainers_Refresh + /// + /// + /// + /// The name of the recovery services vault. + /// Fabric name associated the container. + /// OData filter options. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task RefreshProtectionContainerAsync(string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = BackupProtectionContainerProtectionContainersClientDiagnostics.CreateScope("MockableRecoveryServicesBackupResourceGroupResource.RefreshProtectionContainer"); + scope.Start(); + try + { + var response = await BackupProtectionContainerProtectionContainersRestClient.RefreshAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an + /// asynchronous operation. To know the status of the operation, call GetRefreshOperationResult API. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers + /// + /// + /// Operation Id + /// ProtectionContainers_Refresh + /// + /// + /// + /// The name of the recovery services vault. + /// Fabric name associated the container. + /// OData filter options. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response RefreshProtectionContainer(string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = BackupProtectionContainerProtectionContainersClientDiagnostics.CreateScope("MockableRecoveryServicesBackupResourceGroupResource.RefreshProtectionContainer"); + scope.Start(); + try + { + var response = BackupProtectionContainerProtectionContainersRestClient.Refresh(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Provides a pageable list of protectable objects within your subscription according to the query filter and the + /// pagination parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems + /// + /// + /// Operation Id + /// BackupProtectableItems_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBackupProtectableItemsAsync(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectableItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectableItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, WorkloadProtectableItemResource.DeserializeWorkloadProtectableItemResource, BackupProtectableItemsClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupProtectableItems", "value", "nextLink", cancellationToken); + } + + /// + /// Provides a pageable list of protectable objects within your subscription according to the query filter and the + /// pagination parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems + /// + /// + /// Operation Id + /// BackupProtectableItems_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// skipToken Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBackupProtectableItems(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectableItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectableItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, WorkloadProtectableItemResource.DeserializeWorkloadProtectableItemResource, BackupProtectableItemsClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupProtectableItems", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the containers registered to Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers + /// + /// + /// Operation Id + /// BackupProtectionContainers_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBackupProtectionContainersAsync(string vaultName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionContainerResource(Client, BackupProtectionContainerData.DeserializeBackupProtectionContainerData(e)), BackupProtectionContainersClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupProtectionContainers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the containers registered to Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers + /// + /// + /// Operation Id + /// BackupProtectionContainers_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBackupProtectionContainers(string vaultName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionContainerResource(Client, BackupProtectionContainerData.DeserializeBackupProtectionContainerData(e)), BackupProtectionContainersClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetBackupProtectionContainers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the soft deleted containers registered to Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers + /// + /// + /// Operation Id + /// DeletedProtectionContainers_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSoftDeletedProtectionContainersAsync(string vaultName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionContainerResource(Client, BackupProtectionContainerData.DeserializeBackupProtectionContainerData(e)), DeletedProtectionContainersClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetSoftDeletedProtectionContainers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the soft deleted containers registered to Recovery Services Vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers + /// + /// + /// Operation Id + /// DeletedProtectionContainers_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSoftDeletedProtectionContainers(string vaultName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionContainerResource(Client, BackupProtectionContainerData.DeserializeBackupProtectionContainerData(e)), DeletedProtectionContainersClientDiagnostics, Pipeline, "MockableRecoveryServicesBackupResourceGroupResource.GetSoftDeletedProtectionContainers", "value", "nextLink", cancellationToken); + } + + /// + /// Get the security PIN. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN + /// + /// + /// Operation Id + /// SecurityPINs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// security pin request. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetSecurityPinAsync(string vaultName, SecurityPinContent content = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = SecurityPINsClientDiagnostics.CreateScope("MockableRecoveryServicesBackupResourceGroupResource.GetSecurityPin"); + scope.Start(); + try + { + var response = await SecurityPINsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the security PIN. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN + /// + /// + /// Operation Id + /// SecurityPINs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// security pin request. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetSecurityPin(string vaultName, SecurityPinContent content = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = SecurityPINsClientDiagnostics.CreateScope("MockableRecoveryServicesBackupResourceGroupResource.GetSecurityPin"); + scope.Start(); + try + { + var response = SecurityPINsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupSubscriptionResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupSubscriptionResource.cs new file mode 100644 index 0000000000000..07ddb5e2dd26c --- /dev/null +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupSubscriptionResource.cs @@ -0,0 +1,271 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesBackup; +using Azure.ResourceManager.RecoveryServicesBackup.Models; + +namespace Azure.ResourceManager.RecoveryServicesBackup.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableRecoveryServicesBackupSubscriptionResource : ArmResource + { + private ClientDiagnostics _backupProtectionIntentProtectionIntentClientDiagnostics; + private ProtectionIntentRestOperations _backupProtectionIntentProtectionIntentRestClient; + private ClientDiagnostics _backupStatusClientDiagnostics; + private BackupStatusRestOperations _backupStatusRestClient; + private ClientDiagnostics _featureSupportClientDiagnostics; + private FeatureSupportRestOperations _featureSupportRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesBackupSubscriptionResource() + { + } + + /// 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 MockableRecoveryServicesBackupSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics BackupProtectionIntentProtectionIntentClientDiagnostics => _backupProtectionIntentProtectionIntentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", BackupProtectionIntentResource.ResourceType.Namespace, Diagnostics); + private ProtectionIntentRestOperations BackupProtectionIntentProtectionIntentRestClient => _backupProtectionIntentProtectionIntentRestClient ??= new ProtectionIntentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BackupProtectionIntentResource.ResourceType)); + private ClientDiagnostics BackupStatusClientDiagnostics => _backupStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BackupStatusRestOperations BackupStatusRestClient => _backupStatusRestClient ??= new BackupStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics FeatureSupportClientDiagnostics => _featureSupportClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private FeatureSupportRestOperations FeatureSupportRestClient => _featureSupportRestClient ??= new FeatureSupportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// It will validate followings + /// 1. Vault capacity + /// 2. VM is already protected + /// 3. Any VM related configuration passed in properties. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection + /// + /// + /// Operation Id + /// ProtectionIntent_Validate + /// + /// + /// + /// Azure region to hit Api. + /// Enable backup validation request on Virtual Machine. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateProtectionIntentAsync(AzureLocation location, PreValidateEnableBackupContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BackupProtectionIntentProtectionIntentClientDiagnostics.CreateScope("MockableRecoveryServicesBackupSubscriptionResource.ValidateProtectionIntent"); + scope.Start(); + try + { + var response = await BackupProtectionIntentProtectionIntentRestClient.ValidateAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// It will validate followings + /// 1. Vault capacity + /// 2. VM is already protected + /// 3. Any VM related configuration passed in properties. + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection + /// + /// + /// Operation Id + /// ProtectionIntent_Validate + /// + /// + /// + /// Azure region to hit Api. + /// Enable backup validation request on Virtual Machine. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateProtectionIntent(AzureLocation location, PreValidateEnableBackupContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BackupProtectionIntentProtectionIntentClientDiagnostics.CreateScope("MockableRecoveryServicesBackupSubscriptionResource.ValidateProtectionIntent"); + scope.Start(); + try + { + var response = BackupProtectionIntentProtectionIntentRestClient.Validate(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the container backup status + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus + /// + /// + /// Operation Id + /// BackupStatus_Get + /// + /// + /// + /// Azure region to hit Api. + /// Container Backup Status Request. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetBackupStatusAsync(AzureLocation location, BackupStatusContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BackupStatusClientDiagnostics.CreateScope("MockableRecoveryServicesBackupSubscriptionResource.GetBackupStatus"); + scope.Start(); + try + { + var response = await BackupStatusRestClient.GetAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the container backup status + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus + /// + /// + /// Operation Id + /// BackupStatus_Get + /// + /// + /// + /// Azure region to hit Api. + /// Container Backup Status Request. + /// The cancellation token to use. + /// is null. + public virtual Response GetBackupStatus(AzureLocation location, BackupStatusContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = BackupStatusClientDiagnostics.CreateScope("MockableRecoveryServicesBackupSubscriptionResource.GetBackupStatus"); + scope.Start(); + try + { + var response = BackupStatusRestClient.Get(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// It will validate if given feature with resource properties is supported in service + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures + /// + /// + /// Operation Id + /// FeatureSupport_Validate + /// + /// + /// + /// Azure region to hit Api. + /// Feature support request object. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateFeatureSupportAsync(AzureLocation location, FeatureSupportContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = FeatureSupportClientDiagnostics.CreateScope("MockableRecoveryServicesBackupSubscriptionResource.ValidateFeatureSupport"); + scope.Start(); + try + { + var response = await FeatureSupportRestClient.ValidateAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// It will validate if given feature with resource properties is supported in service + /// + /// + /// Request Path + /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures + /// + /// + /// Operation Id + /// FeatureSupport_Validate + /// + /// + /// + /// Azure region to hit Api. + /// Feature support request object. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateFeatureSupport(AzureLocation location, FeatureSupportContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = FeatureSupportClientDiagnostics.CreateScope("MockableRecoveryServicesBackupSubscriptionResource.ValidateFeatureSupport"); + scope.Start(); + try + { + var response = FeatureSupportRestClient.Validate(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/RecoveryServicesBackupExtensions.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/RecoveryServicesBackupExtensions.cs index bc20d599d96ed..55c5bae02691e 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/RecoveryServicesBackupExtensions.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/RecoveryServicesBackupExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesBackup.Mocking; using Azure.ResourceManager.RecoveryServicesBackup.Models; using Azure.ResourceManager.Resources; @@ -19,271 +20,225 @@ namespace Azure.ResourceManager.RecoveryServicesBackup /// A class to add extension methods to Azure.ResourceManager.RecoveryServicesBackup. public static partial class RecoveryServicesBackupExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableRecoveryServicesBackupArmClient GetMockableRecoveryServicesBackupArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableRecoveryServicesBackupArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableRecoveryServicesBackupResourceGroupResource GetMockableRecoveryServicesBackupResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableRecoveryServicesBackupResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableRecoveryServicesBackupSubscriptionResource GetMockableRecoveryServicesBackupSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableRecoveryServicesBackupSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region BackupResourceConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupResourceConfigResource GetBackupResourceConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupResourceConfigResource.ValidateResourceId(id); - return new BackupResourceConfigResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupResourceConfigResource(id); } - #endregion - #region BackupProtectionIntentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupProtectionIntentResource GetBackupProtectionIntentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupProtectionIntentResource.ValidateResourceId(id); - return new BackupProtectionIntentResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupProtectionIntentResource(id); } - #endregion - #region BackupResourceVaultConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupResourceVaultConfigResource GetBackupResourceVaultConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupResourceVaultConfigResource.ValidateResourceId(id); - return new BackupResourceVaultConfigResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupResourceVaultConfigResource(id); } - #endregion - #region BackupResourceEncryptionConfigExtendedResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupResourceEncryptionConfigExtendedResource GetBackupResourceEncryptionConfigExtendedResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupResourceEncryptionConfigExtendedResource.ValidateResourceId(id); - return new BackupResourceEncryptionConfigExtendedResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupResourceEncryptionConfigExtendedResource(id); } - #endregion - #region BackupPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupPrivateEndpointConnectionResource GetBackupPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupPrivateEndpointConnectionResource.ValidateResourceId(id); - return new BackupPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupPrivateEndpointConnectionResource(id); } - #endregion - #region BackupProtectedItemResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupProtectedItemResource GetBackupProtectedItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupProtectedItemResource.ValidateResourceId(id); - return new BackupProtectedItemResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupProtectedItemResource(id); } - #endregion - #region BackupRecoveryPointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupRecoveryPointResource GetBackupRecoveryPointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupRecoveryPointResource.ValidateResourceId(id); - return new BackupRecoveryPointResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupRecoveryPointResource(id); } - #endregion - #region BackupProtectionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupProtectionPolicyResource GetBackupProtectionPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupProtectionPolicyResource.ValidateResourceId(id); - return new BackupProtectionPolicyResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupProtectionPolicyResource(id); } - #endregion - #region BackupJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupJobResource GetBackupJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupJobResource.ValidateResourceId(id); - return new BackupJobResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupJobResource(id); } - #endregion - #region BackupEngineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupEngineResource GetBackupEngineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupEngineResource.ValidateResourceId(id); - return new BackupEngineResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupEngineResource(id); } - #endregion - #region BackupProtectionContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupProtectionContainerResource GetBackupProtectionContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupProtectionContainerResource.ValidateResourceId(id); - return new BackupProtectionContainerResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetBackupProtectionContainerResource(id); } - #endregion - #region ResourceGuardProxyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourceGuardProxyResource GetResourceGuardProxyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceGuardProxyResource.ValidateResourceId(id); - return new ResourceGuardProxyResource(client, id); - } - ); + return GetMockableRecoveryServicesBackupArmClient(client).GetResourceGuardProxyResource(id); } - #endregion - /// Gets a collection of BackupResourceConfigResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupResourceConfigResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BackupResourceConfigResources and their operations over a BackupResourceConfigResource. public static BackupResourceConfigCollection GetBackupResourceConfigs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupResourceConfigs(); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceConfigs(); } /// @@ -298,16 +253,20 @@ public static BackupResourceConfigCollection GetBackupResourceConfigs(this Resou /// BackupResourceStorageConfigsNonCRR_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupResourceConfigAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupResourceConfigs().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceConfigAsync(vaultName, cancellationToken).ConfigureAwait(false); } /// @@ -322,24 +281,34 @@ public static async Task> GetBackupResour /// BackupResourceStorageConfigsNonCRR_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupResourceConfig(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupResourceConfigs().Get(vaultName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceConfig(vaultName, cancellationToken); } - /// Gets a collection of BackupProtectionIntentResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupProtectionIntentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BackupProtectionIntentResources and their operations over a BackupProtectionIntentResource. public static BackupProtectionIntentCollection GetBackupProtectionIntents(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectionIntents(); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionIntents(); } /// @@ -355,18 +324,22 @@ public static BackupProtectionIntentCollection GetBackupProtectionIntents(this R /// ProtectionIntent_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Fabric name associated with the backed up item. /// Backed up item name whose details are to be fetched. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupProtectionIntentAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string fabricName, string intentObjectName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupProtectionIntents().GetAsync(vaultName, fabricName, intentObjectName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionIntentAsync(vaultName, fabricName, intentObjectName, cancellationToken).ConfigureAwait(false); } /// @@ -382,26 +355,36 @@ public static async Task> GetBackupProt /// ProtectionIntent_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Fabric name associated with the backed up item. /// Backed up item name whose details are to be fetched. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupProtectionIntent(this ResourceGroupResource resourceGroupResource, string vaultName, string fabricName, string intentObjectName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupProtectionIntents().Get(vaultName, fabricName, intentObjectName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionIntent(vaultName, fabricName, intentObjectName, cancellationToken); } - /// Gets a collection of BackupResourceVaultConfigResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupResourceVaultConfigResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BackupResourceVaultConfigResources and their operations over a BackupResourceVaultConfigResource. public static BackupResourceVaultConfigCollection GetBackupResourceVaultConfigs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupResourceVaultConfigs(); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceVaultConfigs(); } /// @@ -416,16 +399,20 @@ public static BackupResourceVaultConfigCollection GetBackupResourceVaultConfigs( /// BackupResourceVaultConfigs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupResourceVaultConfigAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupResourceVaultConfigs().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceVaultConfigAsync(vaultName, cancellationToken).ConfigureAwait(false); } /// @@ -440,24 +427,34 @@ public static async Task> GetBackupR /// BackupResourceVaultConfigs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupResourceVaultConfig(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupResourceVaultConfigs().Get(vaultName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceVaultConfig(vaultName, cancellationToken); } - /// Gets a collection of BackupResourceEncryptionConfigExtendedResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupResourceEncryptionConfigExtendedResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BackupResourceEncryptionConfigExtendedResources and their operations over a BackupResourceEncryptionConfigExtendedResource. public static BackupResourceEncryptionConfigExtendedCollection GetBackupResourceEncryptionConfigExtendeds(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupResourceEncryptionConfigExtendeds(); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceEncryptionConfigExtendeds(); } /// @@ -472,16 +469,20 @@ public static BackupResourceEncryptionConfigExtendedCollection GetBackupResource /// BackupResourceEncryptionConfigs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupResourceEncryptionConfigExtendedAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupResourceEncryptionConfigExtendeds().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceEncryptionConfigExtendedAsync(vaultName, cancellationToken).ConfigureAwait(false); } /// @@ -496,24 +497,34 @@ public static async TaskBackupResourceEncryptionConfigs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupResourceEncryptionConfigExtended(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupResourceEncryptionConfigExtendeds().Get(vaultName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupResourceEncryptionConfigExtended(vaultName, cancellationToken); } - /// Gets a collection of BackupPrivateEndpointConnectionResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupPrivateEndpointConnectionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BackupPrivateEndpointConnectionResources and their operations over a BackupPrivateEndpointConnectionResource. public static BackupPrivateEndpointConnectionCollection GetBackupPrivateEndpointConnections(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupPrivateEndpointConnections(); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupPrivateEndpointConnections(); } /// @@ -528,17 +539,21 @@ public static BackupPrivateEndpointConnectionCollection GetBackupPrivateEndpoint /// PrivateEndpointConnection_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The name of the private endpoint connection. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupPrivateEndpointConnectionAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupPrivateEndpointConnections().GetAsync(vaultName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupPrivateEndpointConnectionAsync(vaultName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); } /// @@ -553,30 +568,38 @@ public static async Task> GetB /// PrivateEndpointConnection_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The name of the private endpoint connection. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupPrivateEndpointConnection(this ResourceGroupResource resourceGroupResource, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupPrivateEndpointConnections().Get(vaultName, privateEndpointConnectionName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupPrivateEndpointConnection(vaultName, privateEndpointConnectionName, cancellationToken); } - /// Gets a collection of BackupProtectionPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupProtectionPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of BackupProtectionPolicyResources and their operations over a BackupProtectionPolicyResource. public static BackupProtectionPolicyCollection GetBackupProtectionPolicies(this ResourceGroupResource resourceGroupResource, string vaultName) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectionPolicies(vaultName); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionPolicies(vaultName); } /// @@ -592,17 +615,21 @@ public static BackupProtectionPolicyCollection GetBackupProtectionPolicies(this /// ProtectionPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Backup policy information to be fetched. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupProtectionPolicyAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string policyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupProtectionPolicies(vaultName).GetAsync(policyName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionPolicyAsync(vaultName, policyName, cancellationToken).ConfigureAwait(false); } /// @@ -618,30 +645,38 @@ public static async Task> GetBackupProt /// ProtectionPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Backup policy information to be fetched. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupProtectionPolicy(this ResourceGroupResource resourceGroupResource, string vaultName, string policyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupProtectionPolicies(vaultName).Get(policyName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionPolicy(vaultName, policyName, cancellationToken); } - /// Gets a collection of BackupJobResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupJobResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of BackupJobResources and their operations over a BackupJobResource. public static BackupJobCollection GetBackupJobs(this ResourceGroupResource resourceGroupResource, string vaultName) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupJobs(vaultName); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupJobs(vaultName); } /// @@ -656,17 +691,21 @@ public static BackupJobCollection GetBackupJobs(this ResourceGroupResource resou /// JobDetails_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Name of the job whose details are to be fetched. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupJobAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string jobName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupJobs(vaultName).GetAsync(jobName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupJobAsync(vaultName, jobName, cancellationToken).ConfigureAwait(false); } /// @@ -681,30 +720,38 @@ public static async Task> GetBackupJobAsync(this Res /// JobDetails_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Name of the job whose details are to be fetched. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupJob(this ResourceGroupResource resourceGroupResource, string vaultName, string jobName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupJobs(vaultName).Get(jobName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupJob(vaultName, jobName, cancellationToken); } - /// Gets a collection of BackupEngineResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupEngineResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of BackupEngineResources and their operations over a BackupEngineResource. public static BackupEngineCollection GetBackupEngines(this ResourceGroupResource resourceGroupResource, string vaultName) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupEngines(vaultName); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupEngines(vaultName); } /// @@ -719,6 +766,10 @@ public static BackupEngineCollection GetBackupEngines(this ResourceGroupResource /// BackupEngines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -726,12 +777,12 @@ public static BackupEngineCollection GetBackupEngines(this ResourceGroupResource /// OData filter options. /// skipToken Filter. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupEngineAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string backupEngineName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupEngines(vaultName).GetAsync(backupEngineName, filter, skipToken, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupEngineAsync(vaultName, backupEngineName, filter, skipToken, cancellationToken).ConfigureAwait(false); } /// @@ -746,6 +797,10 @@ public static async Task> GetBackupEngineAsync(th /// BackupEngines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -753,20 +808,26 @@ public static async Task> GetBackupEngineAsync(th /// OData filter options. /// skipToken Filter. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupEngine(this ResourceGroupResource resourceGroupResource, string vaultName, string backupEngineName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupEngines(vaultName).Get(backupEngineName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupEngine(vaultName, backupEngineName, filter, skipToken, cancellationToken); } - /// Gets a collection of BackupProtectionContainerResources in the ResourceGroupResource. + /// + /// Gets a collection of BackupProtectionContainerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BackupProtectionContainerResources and their operations over a BackupProtectionContainerResource. public static BackupProtectionContainerCollection GetBackupProtectionContainers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectionContainers(); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionContainers(); } /// @@ -781,18 +842,22 @@ public static BackupProtectionContainerCollection GetBackupProtectionContainers( /// ProtectionContainers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Name of the fabric where the container belongs. /// Name of the container whose details need to be fetched. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBackupProtectionContainerAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string fabricName, string containerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetBackupProtectionContainers().GetAsync(vaultName, fabricName, containerName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionContainerAsync(vaultName, fabricName, containerName, cancellationToken).ConfigureAwait(false); } /// @@ -807,31 +872,39 @@ public static async Task> GetBackupP /// ProtectionContainers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Name of the fabric where the container belongs. /// Name of the container whose details need to be fetched. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBackupProtectionContainer(this ResourceGroupResource resourceGroupResource, string vaultName, string fabricName, string containerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetBackupProtectionContainers().Get(vaultName, fabricName, containerName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionContainer(vaultName, fabricName, containerName, cancellationToken); } - /// Gets a collection of ResourceGuardProxyResources in the ResourceGroupResource. + /// + /// Gets a collection of ResourceGuardProxyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of ResourceGuardProxyResources and their operations over a ResourceGuardProxyResource. public static ResourceGuardProxyCollection GetResourceGuardProxies(this ResourceGroupResource resourceGroupResource, string vaultName) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetResourceGuardProxies(vaultName); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetResourceGuardProxies(vaultName); } /// @@ -846,17 +919,21 @@ public static ResourceGuardProxyCollection GetResourceGuardProxies(this Resource /// ResourceGuardProxy_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The String to use. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceGuardProxyAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string resourceGuardProxyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetResourceGuardProxies(vaultName).GetAsync(resourceGuardProxyName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetResourceGuardProxyAsync(vaultName, resourceGuardProxyName, cancellationToken).ConfigureAwait(false); } /// @@ -871,17 +948,21 @@ public static async Task> GetResourceGuardP /// ResourceGuardProxy_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The String to use. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceGuardProxy(this ResourceGroupResource resourceGroupResource, string vaultName, string resourceGuardProxyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetResourceGuardProxies(vaultName).Get(resourceGuardProxyName, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetResourceGuardProxy(vaultName, resourceGuardProxyName, cancellationToken); } /// @@ -896,6 +977,10 @@ public static Response GetResourceGuardProxy(this Re /// BackupProtectionIntent_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -907,9 +992,7 @@ public static Response GetResourceGuardProxy(this Re /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBackupProtectionIntentsAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectionIntentsAsync(vaultName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionIntentsAsync(vaultName, filter, skipToken, cancellationToken); } /// @@ -924,6 +1007,10 @@ public static AsyncPageable GetBackupProtectionI /// BackupProtectionIntent_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -935,9 +1022,7 @@ public static AsyncPageable GetBackupProtectionI /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBackupProtectionIntents(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectionIntents(vaultName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionIntents(vaultName, filter, skipToken, cancellationToken); } /// @@ -952,6 +1037,10 @@ public static Pageable GetBackupProtectionIntent /// BackupUsageSummaries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -963,9 +1052,7 @@ public static Pageable GetBackupProtectionIntent /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBackupUsageSummariesAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupUsageSummariesAsync(vaultName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupUsageSummariesAsync(vaultName, filter, skipToken, cancellationToken); } /// @@ -980,6 +1067,10 @@ public static AsyncPageable GetBackupUsageSummariesAsync( /// BackupUsageSummaries_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -991,9 +1082,7 @@ public static AsyncPageable GetBackupUsageSummariesAsync( /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBackupUsageSummaries(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupUsageSummaries(vaultName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupUsageSummaries(vaultName, filter, skipToken, cancellationToken); } /// @@ -1008,6 +1097,10 @@ public static Pageable GetBackupUsageSummaries(this Resou /// Jobs_Export /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1017,9 +1110,7 @@ public static Pageable GetBackupUsageSummaries(this Resou /// is null. public static async Task ExportJobAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).ExportJobAsync(vaultName, filter, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).ExportJobAsync(vaultName, filter, cancellationToken).ConfigureAwait(false); } /// @@ -1034,6 +1125,10 @@ public static async Task ExportJobAsync(this ResourceGroupResource res /// Jobs_Export /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1043,9 +1138,7 @@ public static async Task ExportJobAsync(this ResourceGroupResource res /// is null. public static Response ExportJob(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).ExportJob(vaultName, filter, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).ExportJob(vaultName, filter, cancellationToken); } /// @@ -1060,6 +1153,10 @@ public static Response ExportJob(this ResourceGroupResource resourceGroupResourc /// BackupProtectedItems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1071,9 +1168,7 @@ public static Response ExportJob(this ResourceGroupResource resourceGroupResourc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBackupProtectedItemsAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectedItemsAsync(vaultName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectedItemsAsync(vaultName, filter, skipToken, cancellationToken); } /// @@ -1088,6 +1183,10 @@ public static AsyncPageable GetBackupProtectedItems /// BackupProtectedItems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1099,9 +1198,7 @@ public static AsyncPageable GetBackupProtectedItems /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBackupProtectedItems(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectedItems(vaultName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectedItems(vaultName, filter, skipToken, cancellationToken); } /// @@ -1116,6 +1213,10 @@ public static Pageable GetBackupProtectedItems(this /// ProtectableContainers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1127,10 +1228,7 @@ public static Pageable GetBackupProtectedItems(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetProtectableContainersAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetProtectableContainersAsync(vaultName, fabricName, filter, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetProtectableContainersAsync(vaultName, fabricName, filter, cancellationToken); } /// @@ -1145,6 +1243,10 @@ public static AsyncPageable GetProtectableContaine /// ProtectableContainers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1156,10 +1258,7 @@ public static AsyncPageable GetProtectableContaine /// A collection of that may take multiple service requests to iterate over. public static Pageable GetProtectableContainers(this ResourceGroupResource resourceGroupResource, string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetProtectableContainers(vaultName, fabricName, filter, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetProtectableContainers(vaultName, fabricName, filter, cancellationToken); } /// @@ -1175,6 +1274,10 @@ public static Pageable GetProtectableContainers(th /// ProtectionContainers_Refresh /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1185,10 +1288,7 @@ public static Pageable GetProtectableContainers(th /// or is null. public static async Task RefreshProtectionContainerAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).RefreshProtectionContainerAsync(vaultName, fabricName, filter, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).RefreshProtectionContainerAsync(vaultName, fabricName, filter, cancellationToken).ConfigureAwait(false); } /// @@ -1204,6 +1304,10 @@ public static async Task RefreshProtectionContainerAsync(this Resource /// ProtectionContainers_Refresh /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1214,10 +1318,7 @@ public static async Task RefreshProtectionContainerAsync(this Resource /// or is null. public static Response RefreshProtectionContainer(this ResourceGroupResource resourceGroupResource, string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).RefreshProtectionContainer(vaultName, fabricName, filter, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).RefreshProtectionContainer(vaultName, fabricName, filter, cancellationToken); } /// @@ -1233,6 +1334,10 @@ public static Response RefreshProtectionContainer(this ResourceGroupResource res /// BackupProtectableItems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1244,9 +1349,7 @@ public static Response RefreshProtectionContainer(this ResourceGroupResource res /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBackupProtectableItemsAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectableItemsAsync(vaultName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectableItemsAsync(vaultName, filter, skipToken, cancellationToken); } /// @@ -1262,6 +1365,10 @@ public static AsyncPageable GetBackupProtectabl /// BackupProtectableItems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1273,9 +1380,7 @@ public static AsyncPageable GetBackupProtectabl /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBackupProtectableItems(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectableItems(vaultName, filter, skipToken, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectableItems(vaultName, filter, skipToken, cancellationToken); } /// @@ -1290,6 +1395,10 @@ public static Pageable GetBackupProtectableItem /// BackupProtectionContainers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1300,9 +1409,7 @@ public static Pageable GetBackupProtectableItem /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBackupProtectionContainersAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectionContainersAsync(vaultName, filter, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionContainersAsync(vaultName, filter, cancellationToken); } /// @@ -1317,6 +1424,10 @@ public static AsyncPageable GetBackupProtecti /// BackupProtectionContainers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1327,9 +1438,7 @@ public static AsyncPageable GetBackupProtecti /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBackupProtectionContainers(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetBackupProtectionContainers(vaultName, filter, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetBackupProtectionContainers(vaultName, filter, cancellationToken); } /// @@ -1344,6 +1453,10 @@ public static Pageable GetBackupProtectionCon /// DeletedProtectionContainers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1354,9 +1467,7 @@ public static Pageable GetBackupProtectionCon /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSoftDeletedProtectionContainersAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSoftDeletedProtectionContainersAsync(vaultName, filter, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetSoftDeletedProtectionContainersAsync(vaultName, filter, cancellationToken); } /// @@ -1371,6 +1482,10 @@ public static AsyncPageable GetSoftDeletedPro /// DeletedProtectionContainers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1381,9 +1496,7 @@ public static AsyncPageable GetSoftDeletedPro /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSoftDeletedProtectionContainers(this ResourceGroupResource resourceGroupResource, string vaultName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSoftDeletedProtectionContainers(vaultName, filter, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetSoftDeletedProtectionContainers(vaultName, filter, cancellationToken); } /// @@ -1398,6 +1511,10 @@ public static Pageable GetSoftDeletedProtecti /// SecurityPINs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1407,9 +1524,7 @@ public static Pageable GetSoftDeletedProtecti /// is null. public static async Task> GetSecurityPinAsync(this ResourceGroupResource resourceGroupResource, string vaultName, SecurityPinContent content = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSecurityPinAsync(vaultName, content, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetSecurityPinAsync(vaultName, content, cancellationToken).ConfigureAwait(false); } /// @@ -1424,6 +1539,10 @@ public static async Task> GetSecurityPinAsync(this Re /// SecurityPINs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1433,9 +1552,7 @@ public static async Task> GetSecurityPinAsync(this Re /// is null. public static Response GetSecurityPin(this ResourceGroupResource resourceGroupResource, string vaultName, SecurityPinContent content = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSecurityPin(vaultName, content, cancellationToken); + return GetMockableRecoveryServicesBackupResourceGroupResource(resourceGroupResource).GetSecurityPin(vaultName, content, cancellationToken); } /// @@ -1453,6 +1570,10 @@ public static Response GetSecurityPin(this ResourceGroupResour /// ProtectionIntent_Validate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region to hit Api. @@ -1461,9 +1582,7 @@ public static Response GetSecurityPin(this ResourceGroupResour /// is null. public static async Task> ValidateProtectionIntentAsync(this SubscriptionResource subscriptionResource, AzureLocation location, PreValidateEnableBackupContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateProtectionIntentAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupSubscriptionResource(subscriptionResource).ValidateProtectionIntentAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -1481,6 +1600,10 @@ public static async Task> ValidateProtec /// ProtectionIntent_Validate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region to hit Api. @@ -1489,9 +1612,7 @@ public static async Task> ValidateProtec /// is null. public static Response ValidateProtectionIntent(this SubscriptionResource subscriptionResource, AzureLocation location, PreValidateEnableBackupContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateProtectionIntent(location, content, cancellationToken); + return GetMockableRecoveryServicesBackupSubscriptionResource(subscriptionResource).ValidateProtectionIntent(location, content, cancellationToken); } /// @@ -1506,6 +1627,10 @@ public static Response ValidateProtectionIntent(t /// BackupStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region to hit Api. @@ -1514,9 +1639,7 @@ public static Response ValidateProtectionIntent(t /// is null. public static async Task> GetBackupStatusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, BackupStatusContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetBackupStatusAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupSubscriptionResource(subscriptionResource).GetBackupStatusAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -1531,6 +1654,10 @@ public static async Task> GetBackupStatusAsync(this /// BackupStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region to hit Api. @@ -1539,9 +1666,7 @@ public static async Task> GetBackupStatusAsync(this /// is null. public static Response GetBackupStatus(this SubscriptionResource subscriptionResource, AzureLocation location, BackupStatusContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBackupStatus(location, content, cancellationToken); + return GetMockableRecoveryServicesBackupSubscriptionResource(subscriptionResource).GetBackupStatus(location, content, cancellationToken); } /// @@ -1556,6 +1681,10 @@ public static Response GetBackupStatus(this SubscriptionReso /// FeatureSupport_Validate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region to hit Api. @@ -1564,9 +1693,7 @@ public static Response GetBackupStatus(this SubscriptionReso /// is null. public static async Task> ValidateFeatureSupportAsync(this SubscriptionResource subscriptionResource, AzureLocation location, FeatureSupportContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateFeatureSupportAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesBackupSubscriptionResource(subscriptionResource).ValidateFeatureSupportAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -1581,6 +1708,10 @@ public static async Task> ValidateFeatu /// FeatureSupport_Validate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure region to hit Api. @@ -1589,9 +1720,7 @@ public static async Task> ValidateFeatu /// is null. public static Response ValidateFeatureSupport(this SubscriptionResource subscriptionResource, AzureLocation location, FeatureSupportContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateFeatureSupport(location, content, cancellationToken); + return GetMockableRecoveryServicesBackupSubscriptionResource(subscriptionResource).ValidateFeatureSupport(location, content, cancellationToken); } } } diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 73b2172c0c0a6..0000000000000 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,699 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.RecoveryServicesBackup.Models; - -namespace Azure.ResourceManager.RecoveryServicesBackup -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _backupProtectionIntentClientDiagnostics; - private BackupProtectionIntentRestOperations _backupProtectionIntentRestClient; - private ClientDiagnostics _backupUsageSummariesClientDiagnostics; - private BackupUsageSummariesRestOperations _backupUsageSummariesRestClient; - private ClientDiagnostics _jobsClientDiagnostics; - private JobsRestOperations _jobsRestClient; - private ClientDiagnostics _backupProtectedItemsClientDiagnostics; - private BackupProtectedItemsRestOperations _backupProtectedItemsRestClient; - private ClientDiagnostics _protectableContainersClientDiagnostics; - private ProtectableContainersRestOperations _protectableContainersRestClient; - private ClientDiagnostics _backupProtectionContainerProtectionContainersClientDiagnostics; - private ProtectionContainersRestOperations _backupProtectionContainerProtectionContainersRestClient; - private ClientDiagnostics _backupProtectableItemsClientDiagnostics; - private BackupProtectableItemsRestOperations _backupProtectableItemsRestClient; - private ClientDiagnostics _backupProtectionContainersClientDiagnostics; - private BackupProtectionContainersRestOperations _backupProtectionContainersRestClient; - private ClientDiagnostics _deletedProtectionContainersClientDiagnostics; - private DeletedProtectionContainersRestOperations _deletedProtectionContainersRestClient; - private ClientDiagnostics _securityPINsClientDiagnostics; - private SecurityPINsRestOperations _securityPINsRestClient; - - /// 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 ClientDiagnostics BackupProtectionIntentClientDiagnostics => _backupProtectionIntentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BackupProtectionIntentRestOperations BackupProtectionIntentRestClient => _backupProtectionIntentRestClient ??= new BackupProtectionIntentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BackupUsageSummariesClientDiagnostics => _backupUsageSummariesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BackupUsageSummariesRestOperations BackupUsageSummariesRestClient => _backupUsageSummariesRestClient ??= new BackupUsageSummariesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics JobsClientDiagnostics => _jobsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private JobsRestOperations JobsRestClient => _jobsRestClient ??= new JobsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BackupProtectedItemsClientDiagnostics => _backupProtectedItemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BackupProtectedItemsRestOperations BackupProtectedItemsRestClient => _backupProtectedItemsRestClient ??= new BackupProtectedItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ProtectableContainersClientDiagnostics => _protectableContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ProtectableContainersRestOperations ProtectableContainersRestClient => _protectableContainersRestClient ??= new ProtectableContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BackupProtectionContainerProtectionContainersClientDiagnostics => _backupProtectionContainerProtectionContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", BackupProtectionContainerResource.ResourceType.Namespace, Diagnostics); - private ProtectionContainersRestOperations BackupProtectionContainerProtectionContainersRestClient => _backupProtectionContainerProtectionContainersRestClient ??= new ProtectionContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BackupProtectionContainerResource.ResourceType)); - private ClientDiagnostics BackupProtectableItemsClientDiagnostics => _backupProtectableItemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BackupProtectableItemsRestOperations BackupProtectableItemsRestClient => _backupProtectableItemsRestClient ??= new BackupProtectableItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BackupProtectionContainersClientDiagnostics => _backupProtectionContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BackupProtectionContainersRestOperations BackupProtectionContainersRestClient => _backupProtectionContainersRestClient ??= new BackupProtectionContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DeletedProtectionContainersClientDiagnostics => _deletedProtectionContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DeletedProtectionContainersRestOperations DeletedProtectionContainersRestClient => _deletedProtectionContainersRestClient ??= new DeletedProtectionContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SecurityPINsClientDiagnostics => _securityPINsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SecurityPINsRestOperations SecurityPINsRestClient => _securityPINsRestClient ??= new SecurityPINsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of BackupResourceConfigResources in the ResourceGroupResource. - /// An object representing collection of BackupResourceConfigResources and their operations over a BackupResourceConfigResource. - public virtual BackupResourceConfigCollection GetBackupResourceConfigs() - { - return GetCachedClient(Client => new BackupResourceConfigCollection(Client, Id)); - } - - /// Gets a collection of BackupProtectionIntentResources in the ResourceGroupResource. - /// An object representing collection of BackupProtectionIntentResources and their operations over a BackupProtectionIntentResource. - public virtual BackupProtectionIntentCollection GetBackupProtectionIntents() - { - return GetCachedClient(Client => new BackupProtectionIntentCollection(Client, Id)); - } - - /// Gets a collection of BackupResourceVaultConfigResources in the ResourceGroupResource. - /// An object representing collection of BackupResourceVaultConfigResources and their operations over a BackupResourceVaultConfigResource. - public virtual BackupResourceVaultConfigCollection GetBackupResourceVaultConfigs() - { - return GetCachedClient(Client => new BackupResourceVaultConfigCollection(Client, Id)); - } - - /// Gets a collection of BackupResourceEncryptionConfigExtendedResources in the ResourceGroupResource. - /// An object representing collection of BackupResourceEncryptionConfigExtendedResources and their operations over a BackupResourceEncryptionConfigExtendedResource. - public virtual BackupResourceEncryptionConfigExtendedCollection GetBackupResourceEncryptionConfigExtendeds() - { - return GetCachedClient(Client => new BackupResourceEncryptionConfigExtendedCollection(Client, Id)); - } - - /// Gets a collection of BackupPrivateEndpointConnectionResources in the ResourceGroupResource. - /// An object representing collection of BackupPrivateEndpointConnectionResources and their operations over a BackupPrivateEndpointConnectionResource. - public virtual BackupPrivateEndpointConnectionCollection GetBackupPrivateEndpointConnections() - { - return GetCachedClient(Client => new BackupPrivateEndpointConnectionCollection(Client, Id)); - } - - /// Gets a collection of BackupProtectionPolicyResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of BackupProtectionPolicyResources and their operations over a BackupProtectionPolicyResource. - public virtual BackupProtectionPolicyCollection GetBackupProtectionPolicies(string vaultName) - { - return new BackupProtectionPolicyCollection(Client, Id, vaultName); - } - - /// Gets a collection of BackupJobResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of BackupJobResources and their operations over a BackupJobResource. - public virtual BackupJobCollection GetBackupJobs(string vaultName) - { - return new BackupJobCollection(Client, Id, vaultName); - } - - /// Gets a collection of BackupEngineResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of BackupEngineResources and their operations over a BackupEngineResource. - public virtual BackupEngineCollection GetBackupEngines(string vaultName) - { - return new BackupEngineCollection(Client, Id, vaultName); - } - - /// Gets a collection of BackupProtectionContainerResources in the ResourceGroupResource. - /// An object representing collection of BackupProtectionContainerResources and their operations over a BackupProtectionContainerResource. - public virtual BackupProtectionContainerCollection GetBackupProtectionContainers() - { - return GetCachedClient(Client => new BackupProtectionContainerCollection(Client, Id)); - } - - /// Gets a collection of ResourceGuardProxyResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of ResourceGuardProxyResources and their operations over a ResourceGuardProxyResource. - public virtual ResourceGuardProxyCollection GetResourceGuardProxies(string vaultName) - { - return new ResourceGuardProxyCollection(Client, Id, vaultName); - } - - /// - /// Provides a pageable list of all intents that are present within a vault. - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents - /// - /// - /// Operation Id - /// BackupProtectionIntent_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// skipToken Filter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBackupProtectionIntentsAsync(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectionIntentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectionIntentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionIntentResource(Client, BackupProtectionIntentData.DeserializeBackupProtectionIntentData(e)), BackupProtectionIntentClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupProtectionIntents", "value", "nextLink", cancellationToken); - } - - /// - /// Provides a pageable list of all intents that are present within a vault. - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents - /// - /// - /// Operation Id - /// BackupProtectionIntent_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// skipToken Filter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBackupProtectionIntents(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectionIntentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectionIntentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionIntentResource(Client, BackupProtectionIntentData.DeserializeBackupProtectionIntentData(e)), BackupProtectionIntentClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupProtectionIntents", "value", "nextLink", cancellationToken); - } - - /// - /// Fetches the backup management usage summaries of the vault. - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries - /// - /// - /// Operation Id - /// BackupUsageSummaries_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// skipToken Filter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBackupUsageSummariesAsync(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupUsageSummariesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, BackupManagementUsage.DeserializeBackupManagementUsage, BackupUsageSummariesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupUsageSummaries", "value", null, cancellationToken); - } - - /// - /// Fetches the backup management usage summaries of the vault. - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries - /// - /// - /// Operation Id - /// BackupUsageSummaries_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// skipToken Filter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBackupUsageSummaries(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupUsageSummariesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, BackupManagementUsage.DeserializeBackupManagementUsage, BackupUsageSummariesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupUsageSummaries", "value", null, cancellationToken); - } - - /// - /// Triggers export of jobs specified by filters and returns an OperationID to track. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport - /// - /// - /// Operation Id - /// Jobs_Export - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// The cancellation token to use. - public virtual async Task ExportJobAsync(string vaultName, string filter = null, CancellationToken cancellationToken = default) - { - using var scope = JobsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.ExportJob"); - scope.Start(); - try - { - var response = await JobsRestClient.ExportAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Triggers export of jobs specified by filters and returns an OperationID to track. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport - /// - /// - /// Operation Id - /// Jobs_Export - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// The cancellation token to use. - public virtual Response ExportJob(string vaultName, string filter = null, CancellationToken cancellationToken = default) - { - using var scope = JobsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.ExportJob"); - scope.Start(); - try - { - var response = JobsRestClient.Export(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Provides a pageable list of all items that are backed up within a vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems - /// - /// - /// Operation Id - /// BackupProtectedItems_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// skipToken Filter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBackupProtectedItemsAsync(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectedItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectedItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BackupProtectedItemResource(Client, BackupProtectedItemData.DeserializeBackupProtectedItemData(e)), BackupProtectedItemsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupProtectedItems", "value", "nextLink", cancellationToken); - } - - /// - /// Provides a pageable list of all items that are backed up within a vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems - /// - /// - /// Operation Id - /// BackupProtectedItems_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// skipToken Filter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBackupProtectedItems(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectedItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectedItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BackupProtectedItemResource(Client, BackupProtectedItemData.DeserializeBackupProtectedItemData(e)), BackupProtectedItemsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupProtectedItems", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the containers that can be registered to Recovery Services Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers - /// - /// - /// Operation Id - /// ProtectableContainers_List - /// - /// - /// - /// The name of the recovery services vault. - /// The String to use. - /// OData filter options. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProtectableContainersAsync(string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProtectableContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProtectableContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ProtectableContainerResource.DeserializeProtectableContainerResource, ProtectableContainersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetProtectableContainers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the containers that can be registered to Recovery Services Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers - /// - /// - /// Operation Id - /// ProtectableContainers_List - /// - /// - /// - /// The name of the recovery services vault. - /// The String to use. - /// OData filter options. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProtectableContainers(string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProtectableContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProtectableContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ProtectableContainerResource.DeserializeProtectableContainerResource, ProtectableContainersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetProtectableContainers", "value", "nextLink", cancellationToken); - } - - /// - /// Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an - /// asynchronous operation. To know the status of the operation, call GetRefreshOperationResult API. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers - /// - /// - /// Operation Id - /// ProtectionContainers_Refresh - /// - /// - /// - /// The name of the recovery services vault. - /// Fabric name associated the container. - /// OData filter options. - /// The cancellation token to use. - public virtual async Task RefreshProtectionContainerAsync(string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) - { - using var scope = BackupProtectionContainerProtectionContainersClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.RefreshProtectionContainer"); - scope.Start(); - try - { - var response = await BackupProtectionContainerProtectionContainersRestClient.RefreshAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an - /// asynchronous operation. To know the status of the operation, call GetRefreshOperationResult API. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers - /// - /// - /// Operation Id - /// ProtectionContainers_Refresh - /// - /// - /// - /// The name of the recovery services vault. - /// Fabric name associated the container. - /// OData filter options. - /// The cancellation token to use. - public virtual Response RefreshProtectionContainer(string vaultName, string fabricName, string filter = null, CancellationToken cancellationToken = default) - { - using var scope = BackupProtectionContainerProtectionContainersClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.RefreshProtectionContainer"); - scope.Start(); - try - { - var response = BackupProtectionContainerProtectionContainersRestClient.Refresh(Id.SubscriptionId, Id.ResourceGroupName, vaultName, fabricName, filter, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Provides a pageable list of protectable objects within your subscription according to the query filter and the - /// pagination parameters. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems - /// - /// - /// Operation Id - /// BackupProtectableItems_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// skipToken Filter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBackupProtectableItemsAsync(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectableItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectableItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, WorkloadProtectableItemResource.DeserializeWorkloadProtectableItemResource, BackupProtectableItemsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupProtectableItems", "value", "nextLink", cancellationToken); - } - - /// - /// Provides a pageable list of protectable objects within your subscription according to the query filter and the - /// pagination parameters. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems - /// - /// - /// Operation Id - /// BackupProtectableItems_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// skipToken Filter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBackupProtectableItems(string vaultName, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectableItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectableItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter, skipToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, WorkloadProtectableItemResource.DeserializeWorkloadProtectableItemResource, BackupProtectableItemsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupProtectableItems", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the containers registered to Recovery Services Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers - /// - /// - /// Operation Id - /// BackupProtectionContainers_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBackupProtectionContainersAsync(string vaultName, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionContainerResource(Client, BackupProtectionContainerData.DeserializeBackupProtectionContainerData(e)), BackupProtectionContainersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupProtectionContainers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the containers registered to Recovery Services Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers - /// - /// - /// Operation Id - /// BackupProtectionContainers_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBackupProtectionContainers(string vaultName, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => BackupProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BackupProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionContainerResource(Client, BackupProtectionContainerData.DeserializeBackupProtectionContainerData(e)), BackupProtectionContainersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetBackupProtectionContainers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the soft deleted containers registered to Recovery Services Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers - /// - /// - /// Operation Id - /// DeletedProtectionContainers_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSoftDeletedProtectionContainersAsync(string vaultName, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionContainerResource(Client, BackupProtectionContainerData.DeserializeBackupProtectionContainerData(e)), DeletedProtectionContainersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSoftDeletedProtectionContainers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the soft deleted containers registered to Recovery Services Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers - /// - /// - /// Operation Id - /// DeletedProtectionContainers_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSoftDeletedProtectionContainers(string vaultName, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, vaultName, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BackupProtectionContainerResource(Client, BackupProtectionContainerData.DeserializeBackupProtectionContainerData(e)), DeletedProtectionContainersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSoftDeletedProtectionContainers", "value", "nextLink", cancellationToken); - } - - /// - /// Get the security PIN. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN - /// - /// - /// Operation Id - /// SecurityPINs_Get - /// - /// - /// - /// The name of the recovery services vault. - /// security pin request. - /// The cancellation token to use. - public virtual async Task> GetSecurityPinAsync(string vaultName, SecurityPinContent content = null, CancellationToken cancellationToken = default) - { - using var scope = SecurityPINsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetSecurityPin"); - scope.Start(); - try - { - var response = await SecurityPINsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the security PIN. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN - /// - /// - /// Operation Id - /// SecurityPINs_Get - /// - /// - /// - /// The name of the recovery services vault. - /// security pin request. - /// The cancellation token to use. - public virtual Response GetSecurityPin(string vaultName, SecurityPinContent content = null, CancellationToken cancellationToken = default) - { - using var scope = SecurityPINsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetSecurityPin"); - scope.Start(); - try - { - var response = SecurityPINsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 67dcfe9ae991b..0000000000000 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,252 +0,0 @@ -// 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; -using Azure.ResourceManager.RecoveryServicesBackup.Models; - -namespace Azure.ResourceManager.RecoveryServicesBackup -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _backupProtectionIntentProtectionIntentClientDiagnostics; - private ProtectionIntentRestOperations _backupProtectionIntentProtectionIntentRestClient; - private ClientDiagnostics _backupStatusClientDiagnostics; - private BackupStatusRestOperations _backupStatusRestClient; - private ClientDiagnostics _featureSupportClientDiagnostics; - private FeatureSupportRestOperations _featureSupportRestClient; - - /// 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 BackupProtectionIntentProtectionIntentClientDiagnostics => _backupProtectionIntentProtectionIntentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", BackupProtectionIntentResource.ResourceType.Namespace, Diagnostics); - private ProtectionIntentRestOperations BackupProtectionIntentProtectionIntentRestClient => _backupProtectionIntentProtectionIntentRestClient ??= new ProtectionIntentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(BackupProtectionIntentResource.ResourceType)); - private ClientDiagnostics BackupStatusClientDiagnostics => _backupStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BackupStatusRestOperations BackupStatusRestClient => _backupStatusRestClient ??= new BackupStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics FeatureSupportClientDiagnostics => _featureSupportClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesBackup", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private FeatureSupportRestOperations FeatureSupportRestClient => _featureSupportRestClient ??= new FeatureSupportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// It will validate followings - /// 1. Vault capacity - /// 2. VM is already protected - /// 3. Any VM related configuration passed in properties. - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection - /// - /// - /// Operation Id - /// ProtectionIntent_Validate - /// - /// - /// - /// Azure region to hit Api. - /// Enable backup validation request on Virtual Machine. - /// The cancellation token to use. - public virtual async Task> ValidateProtectionIntentAsync(AzureLocation location, PreValidateEnableBackupContent content, CancellationToken cancellationToken = default) - { - using var scope = BackupProtectionIntentProtectionIntentClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateProtectionIntent"); - scope.Start(); - try - { - var response = await BackupProtectionIntentProtectionIntentRestClient.ValidateAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// It will validate followings - /// 1. Vault capacity - /// 2. VM is already protected - /// 3. Any VM related configuration passed in properties. - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection - /// - /// - /// Operation Id - /// ProtectionIntent_Validate - /// - /// - /// - /// Azure region to hit Api. - /// Enable backup validation request on Virtual Machine. - /// The cancellation token to use. - public virtual Response ValidateProtectionIntent(AzureLocation location, PreValidateEnableBackupContent content, CancellationToken cancellationToken = default) - { - using var scope = BackupProtectionIntentProtectionIntentClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateProtectionIntent"); - scope.Start(); - try - { - var response = BackupProtectionIntentProtectionIntentRestClient.Validate(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the container backup status - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus - /// - /// - /// Operation Id - /// BackupStatus_Get - /// - /// - /// - /// Azure region to hit Api. - /// Container Backup Status Request. - /// The cancellation token to use. - public virtual async Task> GetBackupStatusAsync(AzureLocation location, BackupStatusContent content, CancellationToken cancellationToken = default) - { - using var scope = BackupStatusClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetBackupStatus"); - scope.Start(); - try - { - var response = await BackupStatusRestClient.GetAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the container backup status - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus - /// - /// - /// Operation Id - /// BackupStatus_Get - /// - /// - /// - /// Azure region to hit Api. - /// Container Backup Status Request. - /// The cancellation token to use. - public virtual Response GetBackupStatus(AzureLocation location, BackupStatusContent content, CancellationToken cancellationToken = default) - { - using var scope = BackupStatusClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetBackupStatus"); - scope.Start(); - try - { - var response = BackupStatusRestClient.Get(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// It will validate if given feature with resource properties is supported in service - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures - /// - /// - /// Operation Id - /// FeatureSupport_Validate - /// - /// - /// - /// Azure region to hit Api. - /// Feature support request object. - /// The cancellation token to use. - public virtual async Task> ValidateFeatureSupportAsync(AzureLocation location, FeatureSupportContent content, CancellationToken cancellationToken = default) - { - using var scope = FeatureSupportClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateFeatureSupport"); - scope.Start(); - try - { - var response = await FeatureSupportRestClient.ValidateAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// It will validate if given feature with resource properties is supported in service - /// - /// - /// Request Path - /// /Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures - /// - /// - /// Operation Id - /// FeatureSupport_Validate - /// - /// - /// - /// Azure region to hit Api. - /// Feature support request object. - /// The cancellation token to use. - public virtual Response ValidateFeatureSupport(AzureLocation location, FeatureSupportContent content, CancellationToken cancellationToken = default) - { - using var scope = FeatureSupportClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateFeatureSupport"); - scope.Start(); - try - { - var response = FeatureSupportRestClient.Validate(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/ResourceGuardProxyResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/ResourceGuardProxyResource.cs index 94551840a66cc..02d2b41a91346 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/ResourceGuardProxyResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/ResourceGuardProxyResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.RecoveryServicesBackup public partial class ResourceGuardProxyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The resourceGuardProxyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"; diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/api/Azure.ResourceManager.RecoveryServicesDataReplication.netstandard2.0.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/api/Azure.ResourceManager.RecoveryServicesDataReplication.netstandard2.0.cs index 7862c75f35fd5..baafdcd260464 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/api/Azure.ResourceManager.RecoveryServicesDataReplication.netstandard2.0.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/api/Azure.ResourceManager.RecoveryServicesDataReplication.netstandard2.0.cs @@ -119,7 +119,7 @@ protected DataReplicationFabricCollection() { } } public partial class DataReplicationFabricData : Azure.ResourceManager.Models.TrackedResourceData { - public DataReplicationFabricData(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public DataReplicationFabricData(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricProperties properties) { } public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricProperties Properties { get { throw null; } set { } } } public partial class DataReplicationFabricResource : Azure.ResourceManager.ArmResource @@ -307,7 +307,7 @@ protected DataReplicationVaultCollection() { } } public partial class DataReplicationVaultData : Azure.ResourceManager.Models.TrackedResourceData { - public DataReplicationVaultData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public DataReplicationVaultData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationVaultProperties Properties { get { throw null; } set { } } } public partial class DataReplicationVaultResource : Azure.ResourceManager.ArmResource @@ -406,6 +406,45 @@ public static partial class RecoveryServicesDataReplicationExtensions public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationWorkflowResource GetDataReplicationWorkflowResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } } +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Mocking +{ + public partial class MockableRecoveryServicesDataReplicationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesDataReplicationArmClient() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraResource GetDataReplicationDraResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEmailConfigurationResource GetDataReplicationEmailConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEventResource GetDataReplicationEventResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationFabricResource GetDataReplicationFabricResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyResource GetDataReplicationPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemResource GetDataReplicationProtectedItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationRecoveryPointResource GetDataReplicationRecoveryPointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionResource GetDataReplicationReplicationExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationVaultResource GetDataReplicationVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationWorkflowResource GetDataReplicationWorkflowResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableRecoveryServicesDataReplicationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesDataReplicationResourceGroupResource() { } + public virtual Azure.Response DeploymentPreflight(string deploymentId, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DeploymentPreflightModel body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeploymentPreflightAsync(string deploymentId, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DeploymentPreflightModel body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDataReplicationFabric(string fabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationFabricAsync(string fabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationFabricCollection GetDataReplicationFabrics() { throw null; } + public virtual Azure.Response GetDataReplicationVault(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationVaultAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationVaultCollection GetDataReplicationVaults() { throw null; } + } + public partial class MockableRecoveryServicesDataReplicationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesDataReplicationSubscriptionResource() { } + public virtual Azure.Response CheckDataReplicationNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationNameAvailabilityContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckDataReplicationNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationNameAvailabilityContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataReplicationFabrics(string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataReplicationFabricsAsync(string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDataReplicationVaults(string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDataReplicationVaultsAsync(string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models { public static partial class ArmRecoveryServicesDataReplicationModelFactory diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraResource.cs index cdffaa9b5db9c..6bb7a87b5ba22 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationDraResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fabricName. + /// The fabricAgentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}"; diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationResource.cs index b5915579adf3a..a5e9ff0a5ca72 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationEmailConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The emailConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}"; diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventResource.cs index 6f3b7533dd10a..09612280f6ba3 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationEventResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The eventName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string eventName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}"; diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs index 0115d392e7d5e..1969a7e824a4b 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationFabricResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fabricName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fabricName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataReplicationDraResources and their operations over a DataReplicationDraResource. public virtual DataReplicationDraCollection GetDataReplicationDras() { - return GetCachedClient(Client => new DataReplicationDraCollection(Client, Id)); + return GetCachedClient(client => new DataReplicationDraCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual DataReplicationDraCollection GetDataReplicationDras() /// /// The fabric agent (Dra) name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataReplicationDraAsync(string fabricAgentName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetDataReplicati /// /// The fabric agent (Dra) name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataReplicationDra(string fabricAgentName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyResource.cs index 07f748aa39354..d13800a13fa25 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}"; diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs index 29efc9f05ed85..25828ff0d2eb9 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationProtectedItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The protectedItemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataReplicationRecoveryPointResources and their operations over a DataReplicationRecoveryPointResource. public virtual DataReplicationRecoveryPointCollection GetDataReplicationRecoveryPoints() { - return GetCachedClient(Client => new DataReplicationRecoveryPointCollection(Client, Id)); + return GetCachedClient(client => new DataReplicationRecoveryPointCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual DataReplicationRecoveryPointCollection GetDataReplicationRecovery /// /// The recovery point name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataReplicationRecoveryPointAsync(string recoveryPointName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetDat /// /// The recovery point name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataReplicationRecoveryPoint(string recoveryPointName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointResource.cs index 610d80e69fcb6..acc038d60ad88 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationRecoveryPointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The protectedItemName. + /// The recoveryPointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string recoveryPointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}"; diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionResource.cs index 8263c6ea2c788..58e4cde83e4b8 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationReplicationExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The replicationExtensionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}"; diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs index 2c48bd5d8a6f9..b55e7d6653dbe 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationVaultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DataReplicationEmailConfigurationResources and their operations over a DataReplicationEmailConfigurationResource. public virtual DataReplicationEmailConfigurationCollection GetDataReplicationEmailConfigurations() { - return GetCachedClient(Client => new DataReplicationEmailConfigurationCollection(Client, Id)); + return GetCachedClient(client => new DataReplicationEmailConfigurationCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual DataReplicationEmailConfigurationCollection GetDataReplicationEma /// /// The email configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataReplicationEmailConfigurationAsync(string emailConfigurationName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> G /// /// The email configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataReplicationEmailConfiguration(string emailConfigurationName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetDataReplic /// An object representing collection of DataReplicationEventResources and their operations over a DataReplicationEventResource. public virtual DataReplicationEventCollection GetDataReplicationEvents() { - return GetCachedClient(Client => new DataReplicationEventCollection(Client, Id)); + return GetCachedClient(client => new DataReplicationEventCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual DataReplicationEventCollection GetDataReplicationEvents() /// /// The event name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataReplicationEventAsync(string eventName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetDataReplica /// /// The event name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataReplicationEvent(string eventName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetDataReplicationEvent(st /// An object representing collection of DataReplicationPolicyResources and their operations over a DataReplicationPolicyResource. public virtual DataReplicationPolicyCollection GetDataReplicationPolicies() { - return GetCachedClient(Client => new DataReplicationPolicyCollection(Client, Id)); + return GetCachedClient(client => new DataReplicationPolicyCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual DataReplicationPolicyCollection GetDataReplicationPolicies() /// /// The policy name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataReplicationPolicyAsync(string policyName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetDataReplic /// /// The policy name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataReplicationPolicy(string policyName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetDataReplicationPolicy( /// An object representing collection of DataReplicationProtectedItemResources and their operations over a DataReplicationProtectedItemResource. public virtual DataReplicationProtectedItemCollection GetDataReplicationProtectedItems() { - return GetCachedClient(Client => new DataReplicationProtectedItemCollection(Client, Id)); + return GetCachedClient(client => new DataReplicationProtectedItemCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual DataReplicationProtectedItemCollection GetDataReplicationProtecte /// /// The protected item name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataReplicationProtectedItemAsync(string protectedItemName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetDat /// /// The protected item name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataReplicationProtectedItem(string protectedItemName, CancellationToken cancellationToken = default) { @@ -305,7 +308,7 @@ public virtual Response GetDataReplication /// An object representing collection of DataReplicationReplicationExtensionResources and their operations over a DataReplicationReplicationExtensionResource. public virtual DataReplicationReplicationExtensionCollection GetDataReplicationReplicationExtensions() { - return GetCachedClient(Client => new DataReplicationReplicationExtensionCollection(Client, Id)); + return GetCachedClient(client => new DataReplicationReplicationExtensionCollection(client, Id)); } /// @@ -323,8 +326,8 @@ public virtual DataReplicationReplicationExtensionCollection GetDataReplicationR /// /// The replication extension name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataReplicationReplicationExtensionAsync(string replicationExtensionName, CancellationToken cancellationToken = default) { @@ -346,8 +349,8 @@ public virtual async Task> /// /// The replication extension name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataReplicationReplicationExtension(string replicationExtensionName, CancellationToken cancellationToken = default) { @@ -358,7 +361,7 @@ public virtual Response GetDataRepl /// An object representing collection of DataReplicationWorkflowResources and their operations over a DataReplicationWorkflowResource. public virtual DataReplicationWorkflowCollection GetDataReplicationWorkflows() { - return GetCachedClient(Client => new DataReplicationWorkflowCollection(Client, Id)); + return GetCachedClient(client => new DataReplicationWorkflowCollection(client, Id)); } /// @@ -376,8 +379,8 @@ public virtual DataReplicationWorkflowCollection GetDataReplicationWorkflows() /// /// The job (workflow) name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataReplicationWorkflowAsync(string jobName, CancellationToken cancellationToken = default) { @@ -399,8 +402,8 @@ public virtual async Task> GetDataRepl /// /// The job (workflow) name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataReplicationWorkflow(string jobName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowResource.cs index 9b8acc77b6903..bdd88d6d37296 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication public partial class DataReplicationWorkflowResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}"; diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationArmClient.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationArmClient.cs new file mode 100644 index 0000000000000..698f777acb02b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationArmClient.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableRecoveryServicesDataReplicationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesDataReplicationArmClient() + { + } + + /// 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 MockableRecoveryServicesDataReplicationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableRecoveryServicesDataReplicationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationDraResource GetDataReplicationDraResource(ResourceIdentifier id) + { + DataReplicationDraResource.ValidateResourceId(id); + return new DataReplicationDraResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationEmailConfigurationResource GetDataReplicationEmailConfigurationResource(ResourceIdentifier id) + { + DataReplicationEmailConfigurationResource.ValidateResourceId(id); + return new DataReplicationEmailConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationEventResource GetDataReplicationEventResource(ResourceIdentifier id) + { + DataReplicationEventResource.ValidateResourceId(id); + return new DataReplicationEventResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationFabricResource GetDataReplicationFabricResource(ResourceIdentifier id) + { + DataReplicationFabricResource.ValidateResourceId(id); + return new DataReplicationFabricResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationPolicyResource GetDataReplicationPolicyResource(ResourceIdentifier id) + { + DataReplicationPolicyResource.ValidateResourceId(id); + return new DataReplicationPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationProtectedItemResource GetDataReplicationProtectedItemResource(ResourceIdentifier id) + { + DataReplicationProtectedItemResource.ValidateResourceId(id); + return new DataReplicationProtectedItemResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationRecoveryPointResource GetDataReplicationRecoveryPointResource(ResourceIdentifier id) + { + DataReplicationRecoveryPointResource.ValidateResourceId(id); + return new DataReplicationRecoveryPointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationReplicationExtensionResource GetDataReplicationReplicationExtensionResource(ResourceIdentifier id) + { + DataReplicationReplicationExtensionResource.ValidateResourceId(id); + return new DataReplicationReplicationExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationVaultResource GetDataReplicationVaultResource(ResourceIdentifier id) + { + DataReplicationVaultResource.ValidateResourceId(id); + return new DataReplicationVaultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataReplicationWorkflowResource GetDataReplicationWorkflowResource(ResourceIdentifier id) + { + DataReplicationWorkflowResource.ValidateResourceId(id); + return new DataReplicationWorkflowResource(Client, id); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationResourceGroupResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationResourceGroupResource.cs new file mode 100644 index 0000000000000..8054ee6d909d5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationResourceGroupResource.cs @@ -0,0 +1,225 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableRecoveryServicesDataReplicationResourceGroupResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private AzureSiteRecoveryManagementServiceAPIRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesDataReplicationResourceGroupResource() + { + } + + /// 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 MockableRecoveryServicesDataReplicationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzureSiteRecoveryManagementServiceAPIRestOperations DefaultRestClient => _defaultRestClient ??= new AzureSiteRecoveryManagementServiceAPIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataReplicationFabricResources in the ResourceGroupResource. + /// An object representing collection of DataReplicationFabricResources and their operations over a DataReplicationFabricResource. + public virtual DataReplicationFabricCollection GetDataReplicationFabrics() + { + return GetCachedClient(client => new DataReplicationFabricCollection(client, Id)); + } + + /// + /// Gets the details of the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The fabric name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationFabricAsync(string fabricName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationFabrics().GetAsync(fabricName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The fabric name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataReplicationFabric(string fabricName, CancellationToken cancellationToken = default) + { + return GetDataReplicationFabrics().Get(fabricName, cancellationToken); + } + + /// Gets a collection of DataReplicationVaultResources in the ResourceGroupResource. + /// An object representing collection of DataReplicationVaultResources and their operations over a DataReplicationVaultResource. + public virtual DataReplicationVaultCollection GetDataReplicationVaults() + { + return GetCachedClient(client => new DataReplicationVaultCollection(client, Id)); + } + + /// + /// Gets the details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The vault name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationVaultAsync(string vaultName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The vault name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataReplicationVault(string vaultName, CancellationToken cancellationToken = default) + { + return GetDataReplicationVaults().Get(vaultName, cancellationToken); + } + + /// + /// Performs resource deployment validation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight + /// + /// + /// Operation Id + /// DeploymentPreflight + /// + /// + /// + /// Deployment Id. + /// Deployment preflight model. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> DeploymentPreflightAsync(string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableRecoveryServicesDataReplicationResourceGroupResource.DeploymentPreflight"); + scope.Start(); + try + { + var response = await DefaultRestClient.DeploymentPreflightAsync(Id.SubscriptionId, Id.ResourceGroupName, deploymentId, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs resource deployment validation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight + /// + /// + /// Operation Id + /// DeploymentPreflight + /// + /// + /// + /// Deployment Id. + /// Deployment preflight model. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DeploymentPreflight(string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableRecoveryServicesDataReplicationResourceGroupResource.DeploymentPreflight"); + scope.Start(); + try + { + var response = DefaultRestClient.DeploymentPreflight(Id.SubscriptionId, Id.ResourceGroupName, deploymentId, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationSubscriptionResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationSubscriptionResource.cs new file mode 100644 index 0000000000000..fa588cd50ef6a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationSubscriptionResource.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableRecoveryServicesDataReplicationSubscriptionResource : ArmResource + { + private ClientDiagnostics _dataReplicationFabricFabricClientDiagnostics; + private FabricRestOperations _dataReplicationFabricFabricRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private AzureSiteRecoveryManagementServiceAPIRestOperations _defaultRestClient; + private ClientDiagnostics _dataReplicationVaultVaultClientDiagnostics; + private VaultRestOperations _dataReplicationVaultVaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesDataReplicationSubscriptionResource() + { + } + + /// 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 MockableRecoveryServicesDataReplicationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DataReplicationFabricFabricClientDiagnostics => _dataReplicationFabricFabricClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationFabricResource.ResourceType.Namespace, Diagnostics); + private FabricRestOperations DataReplicationFabricFabricRestClient => _dataReplicationFabricFabricRestClient ??= new FabricRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataReplicationFabricResource.ResourceType)); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzureSiteRecoveryManagementServiceAPIRestOperations DefaultRestClient => _defaultRestClient ??= new AzureSiteRecoveryManagementServiceAPIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DataReplicationVaultVaultClientDiagnostics => _dataReplicationVaultVaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationVaultResource.ResourceType.Namespace, Diagnostics); + private VaultRestOperations DataReplicationVaultVaultRestClient => _dataReplicationVaultVaultRestClient ??= new VaultRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataReplicationVaultResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the list of fabrics in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics + /// + /// + /// Operation Id + /// Fabric_ListBySubscription + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataReplicationFabricsAsync(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationFabricResource(Client, DataReplicationFabricData.DeserializeDataReplicationFabricData(e)), DataReplicationFabricFabricClientDiagnostics, Pipeline, "MockableRecoveryServicesDataReplicationSubscriptionResource.GetDataReplicationFabrics", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of fabrics in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics + /// + /// + /// Operation Id + /// Fabric_ListBySubscription + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataReplicationFabrics(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationFabricResource(Client, DataReplicationFabricData.DeserializeDataReplicationFabricData(e)), DataReplicationFabricFabricClientDiagnostics, Pipeline, "MockableRecoveryServicesDataReplicationSubscriptionResource.GetDataReplicationFabrics", "value", "nextLink", cancellationToken); + } + + /// + /// Checks the resource name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// The name of the Azure region. + /// Resource details. + /// The cancellation token to use. + public virtual async Task> CheckDataReplicationNameAvailabilityAsync(AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableRecoveryServicesDataReplicationSubscriptionResource.CheckDataReplicationNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks the resource name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// The name of the Azure region. + /// Resource details. + /// The cancellation token to use. + public virtual Response CheckDataReplicationNameAvailability(AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableRecoveryServicesDataReplicationSubscriptionResource.CheckDataReplicationNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of vaults in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults + /// + /// + /// Operation Id + /// Vault_ListBySubscription + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataReplicationVaultsAsync(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationVaultResource(Client, DataReplicationVaultData.DeserializeDataReplicationVaultData(e)), DataReplicationVaultVaultClientDiagnostics, Pipeline, "MockableRecoveryServicesDataReplicationSubscriptionResource.GetDataReplicationVaults", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of vaults in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults + /// + /// + /// Operation Id + /// Vault_ListBySubscription + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataReplicationVaults(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationVaultResource(Client, DataReplicationVaultData.DeserializeDataReplicationVaultData(e)), DataReplicationVaultVaultClientDiagnostics, Pipeline, "MockableRecoveryServicesDataReplicationSubscriptionResource.GetDataReplicationVaults", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/RecoveryServicesDataReplicationExtensions.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/RecoveryServicesDataReplicationExtensions.cs index a7f4414a17e6b..59c73b5d26d7d 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/RecoveryServicesDataReplicationExtensions.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/RecoveryServicesDataReplicationExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication.Mocking; using Azure.ResourceManager.RecoveryServicesDataReplication.Models; using Azure.ResourceManager.Resources; @@ -19,233 +20,193 @@ namespace Azure.ResourceManager.RecoveryServicesDataReplication /// A class to add extension methods to Azure.ResourceManager.RecoveryServicesDataReplication. public static partial class RecoveryServicesDataReplicationExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableRecoveryServicesDataReplicationArmClient GetMockableRecoveryServicesDataReplicationArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableRecoveryServicesDataReplicationArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableRecoveryServicesDataReplicationResourceGroupResource GetMockableRecoveryServicesDataReplicationResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableRecoveryServicesDataReplicationResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableRecoveryServicesDataReplicationSubscriptionResource GetMockableRecoveryServicesDataReplicationSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableRecoveryServicesDataReplicationSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataReplicationDraResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationDraResource GetDataReplicationDraResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationDraResource.ValidateResourceId(id); - return new DataReplicationDraResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationDraResource(id); } - #endregion - #region DataReplicationEmailConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationEmailConfigurationResource GetDataReplicationEmailConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationEmailConfigurationResource.ValidateResourceId(id); - return new DataReplicationEmailConfigurationResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationEmailConfigurationResource(id); } - #endregion - #region DataReplicationEventResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationEventResource GetDataReplicationEventResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationEventResource.ValidateResourceId(id); - return new DataReplicationEventResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationEventResource(id); } - #endregion - #region DataReplicationFabricResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationFabricResource GetDataReplicationFabricResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationFabricResource.ValidateResourceId(id); - return new DataReplicationFabricResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationFabricResource(id); } - #endregion - #region DataReplicationPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationPolicyResource GetDataReplicationPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationPolicyResource.ValidateResourceId(id); - return new DataReplicationPolicyResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationPolicyResource(id); } - #endregion - #region DataReplicationProtectedItemResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationProtectedItemResource GetDataReplicationProtectedItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationProtectedItemResource.ValidateResourceId(id); - return new DataReplicationProtectedItemResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationProtectedItemResource(id); } - #endregion - #region DataReplicationRecoveryPointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationRecoveryPointResource GetDataReplicationRecoveryPointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationRecoveryPointResource.ValidateResourceId(id); - return new DataReplicationRecoveryPointResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationRecoveryPointResource(id); } - #endregion - #region DataReplicationReplicationExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationReplicationExtensionResource GetDataReplicationReplicationExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationReplicationExtensionResource.ValidateResourceId(id); - return new DataReplicationReplicationExtensionResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationReplicationExtensionResource(id); } - #endregion - #region DataReplicationVaultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationVaultResource GetDataReplicationVaultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationVaultResource.ValidateResourceId(id); - return new DataReplicationVaultResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationVaultResource(id); } - #endregion - #region DataReplicationWorkflowResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataReplicationWorkflowResource GetDataReplicationWorkflowResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataReplicationWorkflowResource.ValidateResourceId(id); - return new DataReplicationWorkflowResource(client, id); - } - ); + return GetMockableRecoveryServicesDataReplicationArmClient(client).GetDataReplicationWorkflowResource(id); } - #endregion - /// Gets a collection of DataReplicationFabricResources in the ResourceGroupResource. + /// + /// Gets a collection of DataReplicationFabricResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataReplicationFabricResources and their operations over a DataReplicationFabricResource. public static DataReplicationFabricCollection GetDataReplicationFabrics(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataReplicationFabrics(); + return GetMockableRecoveryServicesDataReplicationResourceGroupResource(resourceGroupResource).GetDataReplicationFabrics(); } /// @@ -260,16 +221,20 @@ public static DataReplicationFabricCollection GetDataReplicationFabrics(this Res /// Fabric_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The fabric name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataReplicationFabricAsync(this ResourceGroupResource resourceGroupResource, string fabricName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataReplicationFabrics().GetAsync(fabricName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesDataReplicationResourceGroupResource(resourceGroupResource).GetDataReplicationFabricAsync(fabricName, cancellationToken).ConfigureAwait(false); } /// @@ -284,24 +249,34 @@ public static async Task> GetDataReplica /// Fabric_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The fabric name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataReplicationFabric(this ResourceGroupResource resourceGroupResource, string fabricName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataReplicationFabrics().Get(fabricName, cancellationToken); + return GetMockableRecoveryServicesDataReplicationResourceGroupResource(resourceGroupResource).GetDataReplicationFabric(fabricName, cancellationToken); } - /// Gets a collection of DataReplicationVaultResources in the ResourceGroupResource. + /// + /// Gets a collection of DataReplicationVaultResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DataReplicationVaultResources and their operations over a DataReplicationVaultResource. public static DataReplicationVaultCollection GetDataReplicationVaults(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataReplicationVaults(); + return GetMockableRecoveryServicesDataReplicationResourceGroupResource(resourceGroupResource).GetDataReplicationVaults(); } /// @@ -316,16 +291,20 @@ public static DataReplicationVaultCollection GetDataReplicationVaults(this Resou /// Vault_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The vault name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDataReplicationVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDataReplicationVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesDataReplicationResourceGroupResource(resourceGroupResource).GetDataReplicationVaultAsync(vaultName, cancellationToken).ConfigureAwait(false); } /// @@ -340,16 +319,20 @@ public static async Task> GetDataReplicat /// Vault_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The vault name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDataReplicationVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDataReplicationVaults().Get(vaultName, cancellationToken); + return GetMockableRecoveryServicesDataReplicationResourceGroupResource(resourceGroupResource).GetDataReplicationVault(vaultName, cancellationToken); } /// @@ -364,6 +347,10 @@ public static Response GetDataReplicationVault(thi /// DeploymentPreflight /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Deployment Id. @@ -373,9 +360,7 @@ public static Response GetDataReplicationVault(thi /// is null. public static async Task> DeploymentPreflightAsync(this ResourceGroupResource resourceGroupResource, string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).DeploymentPreflightAsync(deploymentId, body, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesDataReplicationResourceGroupResource(resourceGroupResource).DeploymentPreflightAsync(deploymentId, body, cancellationToken).ConfigureAwait(false); } /// @@ -390,6 +375,10 @@ public static async Task> DeploymentPreflight /// DeploymentPreflight /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Deployment Id. @@ -399,9 +388,7 @@ public static async Task> DeploymentPreflight /// is null. public static Response DeploymentPreflight(this ResourceGroupResource resourceGroupResource, string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).DeploymentPreflight(deploymentId, body, cancellationToken); + return GetMockableRecoveryServicesDataReplicationResourceGroupResource(resourceGroupResource).DeploymentPreflight(deploymentId, body, cancellationToken); } /// @@ -416,6 +403,10 @@ public static Response DeploymentPreflight(this Resour /// Fabric_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token from the previous call. @@ -423,7 +414,7 @@ public static Response DeploymentPreflight(this Resour /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDataReplicationFabricsAsync(this SubscriptionResource subscriptionResource, string continuationToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataReplicationFabricsAsync(continuationToken, cancellationToken); + return GetMockableRecoveryServicesDataReplicationSubscriptionResource(subscriptionResource).GetDataReplicationFabricsAsync(continuationToken, cancellationToken); } /// @@ -438,6 +429,10 @@ public static AsyncPageable GetDataReplicationFab /// Fabric_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token from the previous call. @@ -445,7 +440,7 @@ public static AsyncPageable GetDataReplicationFab /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDataReplicationFabrics(this SubscriptionResource subscriptionResource, string continuationToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataReplicationFabrics(continuationToken, cancellationToken); + return GetMockableRecoveryServicesDataReplicationSubscriptionResource(subscriptionResource).GetDataReplicationFabrics(continuationToken, cancellationToken); } /// @@ -460,6 +455,10 @@ public static Pageable GetDataReplicationFabrics( /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure region. @@ -467,7 +466,7 @@ public static Pageable GetDataReplicationFabrics( /// The cancellation token to use. public static async Task> CheckDataReplicationNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataReplicationNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesDataReplicationSubscriptionResource(subscriptionResource).CheckDataReplicationNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -482,6 +481,10 @@ public static async Task> CheckD /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure region. @@ -489,7 +492,7 @@ public static async Task> CheckD /// The cancellation token to use. public static Response CheckDataReplicationNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataReplicationNameAvailability(location, content, cancellationToken); + return GetMockableRecoveryServicesDataReplicationSubscriptionResource(subscriptionResource).CheckDataReplicationNameAvailability(location, content, cancellationToken); } /// @@ -504,6 +507,10 @@ public static Response CheckDataReplicati /// Vault_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token from the previous call. @@ -511,7 +518,7 @@ public static Response CheckDataReplicati /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDataReplicationVaultsAsync(this SubscriptionResource subscriptionResource, string continuationToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataReplicationVaultsAsync(continuationToken, cancellationToken); + return GetMockableRecoveryServicesDataReplicationSubscriptionResource(subscriptionResource).GetDataReplicationVaultsAsync(continuationToken, cancellationToken); } /// @@ -526,6 +533,10 @@ public static AsyncPageable GetDataReplicationVaul /// Vault_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Continuation token from the previous call. @@ -533,7 +544,7 @@ public static AsyncPageable GetDataReplicationVaul /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDataReplicationVaults(this SubscriptionResource subscriptionResource, string continuationToken = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataReplicationVaults(continuationToken, cancellationToken); + return GetMockableRecoveryServicesDataReplicationSubscriptionResource(subscriptionResource).GetDataReplicationVaults(continuationToken, cancellationToken); } } } diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 28bf48155fcc5..0000000000000 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,124 +0,0 @@ -// 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; -using Azure.ResourceManager.RecoveryServicesDataReplication.Models; - -namespace Azure.ResourceManager.RecoveryServicesDataReplication -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private AzureSiteRecoveryManagementServiceAPIRestOperations _defaultRestClient; - - /// 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 ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AzureSiteRecoveryManagementServiceAPIRestOperations DefaultRestClient => _defaultRestClient ??= new AzureSiteRecoveryManagementServiceAPIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DataReplicationFabricResources in the ResourceGroupResource. - /// An object representing collection of DataReplicationFabricResources and their operations over a DataReplicationFabricResource. - public virtual DataReplicationFabricCollection GetDataReplicationFabrics() - { - return GetCachedClient(Client => new DataReplicationFabricCollection(Client, Id)); - } - - /// Gets a collection of DataReplicationVaultResources in the ResourceGroupResource. - /// An object representing collection of DataReplicationVaultResources and their operations over a DataReplicationVaultResource. - public virtual DataReplicationVaultCollection GetDataReplicationVaults() - { - return GetCachedClient(Client => new DataReplicationVaultCollection(Client, Id)); - } - - /// - /// Performs resource deployment validation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight - /// - /// - /// Operation Id - /// DeploymentPreflight - /// - /// - /// - /// Deployment Id. - /// Deployment preflight model. - /// The cancellation token to use. - public virtual async Task> DeploymentPreflightAsync(string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeploymentPreflight"); - scope.Start(); - try - { - var response = await DefaultRestClient.DeploymentPreflightAsync(Id.SubscriptionId, Id.ResourceGroupName, deploymentId, body, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Performs resource deployment validation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight - /// - /// - /// Operation Id - /// DeploymentPreflight - /// - /// - /// - /// Deployment Id. - /// Deployment preflight model. - /// The cancellation token to use. - public virtual Response DeploymentPreflight(string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeploymentPreflight"); - scope.Start(); - try - { - var response = DefaultRestClient.DeploymentPreflight(Id.SubscriptionId, Id.ResourceGroupName, deploymentId, body, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 3ffb3aaf3ae35..0000000000000 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.RecoveryServicesDataReplication.Models; - -namespace Azure.ResourceManager.RecoveryServicesDataReplication -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _dataReplicationFabricFabricClientDiagnostics; - private FabricRestOperations _dataReplicationFabricFabricRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private AzureSiteRecoveryManagementServiceAPIRestOperations _defaultRestClient; - private ClientDiagnostics _dataReplicationVaultVaultClientDiagnostics; - private VaultRestOperations _dataReplicationVaultVaultRestClient; - - /// 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 DataReplicationFabricFabricClientDiagnostics => _dataReplicationFabricFabricClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationFabricResource.ResourceType.Namespace, Diagnostics); - private FabricRestOperations DataReplicationFabricFabricRestClient => _dataReplicationFabricFabricRestClient ??= new FabricRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataReplicationFabricResource.ResourceType)); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AzureSiteRecoveryManagementServiceAPIRestOperations DefaultRestClient => _defaultRestClient ??= new AzureSiteRecoveryManagementServiceAPIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DataReplicationVaultVaultClientDiagnostics => _dataReplicationVaultVaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationVaultResource.ResourceType.Namespace, Diagnostics); - private VaultRestOperations DataReplicationVaultVaultRestClient => _dataReplicationVaultVaultRestClient ??= new VaultRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataReplicationVaultResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the list of fabrics in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics - /// - /// - /// Operation Id - /// Fabric_ListBySubscription - /// - /// - /// - /// Continuation token from the previous call. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataReplicationFabricsAsync(string continuationToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationFabricResource(Client, DataReplicationFabricData.DeserializeDataReplicationFabricData(e)), DataReplicationFabricFabricClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataReplicationFabrics", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of fabrics in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics - /// - /// - /// Operation Id - /// Fabric_ListBySubscription - /// - /// - /// - /// Continuation token from the previous call. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataReplicationFabrics(string continuationToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationFabricResource(Client, DataReplicationFabricData.DeserializeDataReplicationFabricData(e)), DataReplicationFabricFabricClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataReplicationFabrics", "value", "nextLink", cancellationToken); - } - - /// - /// Checks the resource name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// The name of the Azure region. - /// Resource details. - /// The cancellation token to use. - public virtual async Task> CheckDataReplicationNameAvailabilityAsync(AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataReplicationNameAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks the resource name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// The name of the Azure region. - /// Resource details. - /// The cancellation token to use. - public virtual Response CheckDataReplicationNameAvailability(AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataReplicationNameAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the list of vaults in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults - /// - /// - /// Operation Id - /// Vault_ListBySubscription - /// - /// - /// - /// Continuation token from the previous call. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDataReplicationVaultsAsync(string continuationToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationVaultResource(Client, DataReplicationVaultData.DeserializeDataReplicationVaultData(e)), DataReplicationVaultVaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataReplicationVaults", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of vaults in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults - /// - /// - /// Operation Id - /// Vault_ListBySubscription - /// - /// - /// - /// Continuation token from the previous call. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDataReplicationVaults(string continuationToken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationVaultResource(Client, DataReplicationVaultData.DeserializeDataReplicationVaultData(e)), DataReplicationVaultVaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataReplicationVaults", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/api/Azure.ResourceManager.RecoveryServicesSiteRecovery.netstandard2.0.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/api/Azure.ResourceManager.RecoveryServicesSiteRecovery.netstandard2.0.cs index 936ad6ea0b338..dcb4aa745e3b3 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/api/Azure.ResourceManager.RecoveryServicesSiteRecovery.netstandard2.0.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/api/Azure.ResourceManager.RecoveryServicesSiteRecovery.netstandard2.0.cs @@ -998,6 +998,95 @@ protected StorageClassificationResource() { } public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.StorageClassificationMappingCollection GetStorageClassificationMappings() { throw null; } } } +namespace Azure.ResourceManager.RecoveryServicesSiteRecovery.Mocking +{ + public partial class MockableRecoveryServicesSiteRecoveryArmClient : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesSiteRecoveryArmClient() { } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.MigrationRecoveryPointResource GetMigrationRecoveryPointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.ProtectionContainerMappingResource GetProtectionContainerMappingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.ReplicationEligibilityResultResource GetReplicationEligibilityResultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.ReplicationProtectedItemResource GetReplicationProtectedItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.ReplicationProtectionIntentResource GetReplicationProtectionIntentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryAlertResource GetSiteRecoveryAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryEventResource GetSiteRecoveryEventResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryFabricResource GetSiteRecoveryFabricResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryJobResource GetSiteRecoveryJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryLogicalNetworkResource GetSiteRecoveryLogicalNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryMigrationItemResource GetSiteRecoveryMigrationItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryNetworkMappingResource GetSiteRecoveryNetworkMappingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryNetworkResource GetSiteRecoveryNetworkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryPointResource GetSiteRecoveryPointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryPolicyResource GetSiteRecoveryPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryProtectableItemResource GetSiteRecoveryProtectableItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryProtectionContainerResource GetSiteRecoveryProtectionContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryRecoveryPlanResource GetSiteRecoveryRecoveryPlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryServicesProviderResource GetSiteRecoveryServicesProviderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryVaultSettingResource GetSiteRecoveryVaultSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryVCenterResource GetSiteRecoveryVCenterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.StorageClassificationMappingResource GetStorageClassificationMappingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.StorageClassificationResource GetStorageClassificationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableRecoveryServicesSiteRecoveryResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesSiteRecoveryResourceGroupResource() { } + public virtual Azure.Pageable GetProtectionContainerMappings(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProtectionContainerMappingsAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetReplicationAppliances(string resourceName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetReplicationAppliancesAsync(string resourceName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetReplicationEligibilityResult(string virtualMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetReplicationEligibilityResultAsync(string virtualMachineName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.ReplicationEligibilityResultCollection GetReplicationEligibilityResults(string virtualMachineName) { throw null; } + public virtual Azure.Pageable GetReplicationProtectedItems(string resourceName, string skipToken = null, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetReplicationProtectedItemsAsync(string resourceName, string skipToken = null, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetReplicationProtectionIntent(string resourceName, string intentObjectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetReplicationProtectionIntentAsync(string resourceName, string intentObjectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.ReplicationProtectionIntentCollection GetReplicationProtectionIntents(string resourceName) { throw null; } + public virtual Azure.Response GetReplicationVaultHealth(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetReplicationVaultHealthAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSiteRecoveryAlert(string resourceName, string alertSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteRecoveryAlertAsync(string resourceName, string alertSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryAlertCollection GetSiteRecoveryAlerts(string resourceName) { throw null; } + public virtual Azure.Response GetSiteRecoveryEvent(string resourceName, string eventName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteRecoveryEventAsync(string resourceName, string eventName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryEventCollection GetSiteRecoveryEvents(string resourceName) { throw null; } + public virtual Azure.Response GetSiteRecoveryFabric(string resourceName, string fabricName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteRecoveryFabricAsync(string resourceName, string fabricName, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryFabricCollection GetSiteRecoveryFabrics(string resourceName) { throw null; } + public virtual Azure.Response GetSiteRecoveryJob(string resourceName, string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteRecoveryJobAsync(string resourceName, string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryJobCollection GetSiteRecoveryJobs(string resourceName) { throw null; } + public virtual Azure.Pageable GetSiteRecoveryMigrationItems(string resourceName, string skipToken = null, string takeToken = null, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSiteRecoveryMigrationItemsAsync(string resourceName, string skipToken = null, string takeToken = null, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSiteRecoveryNetworkMappings(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSiteRecoveryNetworkMappingsAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSiteRecoveryNetworks(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSiteRecoveryNetworksAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryPolicyCollection GetSiteRecoveryPolicies(string resourceName) { throw null; } + public virtual Azure.Response GetSiteRecoveryPolicy(string resourceName, string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteRecoveryPolicyAsync(string resourceName, string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSiteRecoveryProtectionContainers(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSiteRecoveryProtectionContainersAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSiteRecoveryRecoveryPlan(string resourceName, string recoveryPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteRecoveryRecoveryPlanAsync(string resourceName, string recoveryPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryRecoveryPlanCollection GetSiteRecoveryRecoveryPlans(string resourceName) { throw null; } + public virtual Azure.Pageable GetSiteRecoveryServicesProviders(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSiteRecoveryServicesProvidersAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSiteRecoveryVaultSetting(string resourceName, string vaultSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSiteRecoveryVaultSettingAsync(string resourceName, string vaultSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesSiteRecovery.SiteRecoveryVaultSettingCollection GetSiteRecoveryVaultSettings(string resourceName) { throw null; } + public virtual Azure.Pageable GetSiteRecoveryVCenters(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSiteRecoveryVCentersAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStorageClassificationMappings(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageClassificationMappingsAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStorageClassifications(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageClassificationsAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSupportedOperatingSystem(string resourceName, string instanceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSupportedOperatingSystemAsync(string resourceName, string instanceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation RefreshReplicationVaultHealth(Azure.WaitUntil waitUntil, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RefreshReplicationVaultHealthAsync(Azure.WaitUntil waitUntil, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.RecoveryServicesSiteRecovery.Models { public partial class A2AAddDisksContent : Azure.ResourceManager.RecoveryServicesSiteRecovery.Models.SiteRecoveryAddDisksProviderSpecificContent diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/MockableRecoveryServicesSiteRecoveryArmClient.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/MockableRecoveryServicesSiteRecoveryArmClient.cs new file mode 100644 index 0000000000000..c02a181ef0045 --- /dev/null +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/MockableRecoveryServicesSiteRecoveryArmClient.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesSiteRecovery; + +namespace Azure.ResourceManager.RecoveryServicesSiteRecovery.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableRecoveryServicesSiteRecoveryArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesSiteRecoveryArmClient() + { + } + + /// 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 MockableRecoveryServicesSiteRecoveryArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableRecoveryServicesSiteRecoveryArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryAlertResource GetSiteRecoveryAlertResource(ResourceIdentifier id) + { + SiteRecoveryAlertResource.ValidateResourceId(id); + return new SiteRecoveryAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReplicationEligibilityResultResource GetReplicationEligibilityResultResource(ResourceIdentifier id) + { + ReplicationEligibilityResultResource.ValidateResourceId(id); + return new ReplicationEligibilityResultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryEventResource GetSiteRecoveryEventResource(ResourceIdentifier id) + { + SiteRecoveryEventResource.ValidateResourceId(id); + return new SiteRecoveryEventResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryFabricResource GetSiteRecoveryFabricResource(ResourceIdentifier id) + { + SiteRecoveryFabricResource.ValidateResourceId(id); + return new SiteRecoveryFabricResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryLogicalNetworkResource GetSiteRecoveryLogicalNetworkResource(ResourceIdentifier id) + { + SiteRecoveryLogicalNetworkResource.ValidateResourceId(id); + return new SiteRecoveryLogicalNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryNetworkResource GetSiteRecoveryNetworkResource(ResourceIdentifier id) + { + SiteRecoveryNetworkResource.ValidateResourceId(id); + return new SiteRecoveryNetworkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryNetworkMappingResource GetSiteRecoveryNetworkMappingResource(ResourceIdentifier id) + { + SiteRecoveryNetworkMappingResource.ValidateResourceId(id); + return new SiteRecoveryNetworkMappingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryProtectionContainerResource GetSiteRecoveryProtectionContainerResource(ResourceIdentifier id) + { + SiteRecoveryProtectionContainerResource.ValidateResourceId(id); + return new SiteRecoveryProtectionContainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryMigrationItemResource GetSiteRecoveryMigrationItemResource(ResourceIdentifier id) + { + SiteRecoveryMigrationItemResource.ValidateResourceId(id); + return new SiteRecoveryMigrationItemResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MigrationRecoveryPointResource GetMigrationRecoveryPointResource(ResourceIdentifier id) + { + MigrationRecoveryPointResource.ValidateResourceId(id); + return new MigrationRecoveryPointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryProtectableItemResource GetSiteRecoveryProtectableItemResource(ResourceIdentifier id) + { + SiteRecoveryProtectableItemResource.ValidateResourceId(id); + return new SiteRecoveryProtectableItemResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReplicationProtectedItemResource GetReplicationProtectedItemResource(ResourceIdentifier id) + { + ReplicationProtectedItemResource.ValidateResourceId(id); + return new ReplicationProtectedItemResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryPointResource GetSiteRecoveryPointResource(ResourceIdentifier id) + { + SiteRecoveryPointResource.ValidateResourceId(id); + return new SiteRecoveryPointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProtectionContainerMappingResource GetProtectionContainerMappingResource(ResourceIdentifier id) + { + ProtectionContainerMappingResource.ValidateResourceId(id); + return new ProtectionContainerMappingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryServicesProviderResource GetSiteRecoveryServicesProviderResource(ResourceIdentifier id) + { + SiteRecoveryServicesProviderResource.ValidateResourceId(id); + return new SiteRecoveryServicesProviderResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageClassificationResource GetStorageClassificationResource(ResourceIdentifier id) + { + StorageClassificationResource.ValidateResourceId(id); + return new StorageClassificationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageClassificationMappingResource GetStorageClassificationMappingResource(ResourceIdentifier id) + { + StorageClassificationMappingResource.ValidateResourceId(id); + return new StorageClassificationMappingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryVCenterResource GetSiteRecoveryVCenterResource(ResourceIdentifier id) + { + SiteRecoveryVCenterResource.ValidateResourceId(id); + return new SiteRecoveryVCenterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryJobResource GetSiteRecoveryJobResource(ResourceIdentifier id) + { + SiteRecoveryJobResource.ValidateResourceId(id); + return new SiteRecoveryJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryPolicyResource GetSiteRecoveryPolicyResource(ResourceIdentifier id) + { + SiteRecoveryPolicyResource.ValidateResourceId(id); + return new SiteRecoveryPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReplicationProtectionIntentResource GetReplicationProtectionIntentResource(ResourceIdentifier id) + { + ReplicationProtectionIntentResource.ValidateResourceId(id); + return new ReplicationProtectionIntentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryRecoveryPlanResource GetSiteRecoveryRecoveryPlanResource(ResourceIdentifier id) + { + SiteRecoveryRecoveryPlanResource.ValidateResourceId(id); + return new SiteRecoveryRecoveryPlanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecoveryVaultSettingResource GetSiteRecoveryVaultSettingResource(ResourceIdentifier id) + { + SiteRecoveryVaultSettingResource.ValidateResourceId(id); + return new SiteRecoveryVaultSettingResource(Client, id); + } + } +} diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/MockableRecoveryServicesSiteRecoveryResourceGroupResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/MockableRecoveryServicesSiteRecoveryResourceGroupResource.cs new file mode 100644 index 0000000000000..fa7abbc4cd026 --- /dev/null +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/MockableRecoveryServicesSiteRecoveryResourceGroupResource.cs @@ -0,0 +1,1444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesSiteRecovery; +using Azure.ResourceManager.RecoveryServicesSiteRecovery.Models; + +namespace Azure.ResourceManager.RecoveryServicesSiteRecovery.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableRecoveryServicesSiteRecoveryResourceGroupResource : ArmResource + { + private ClientDiagnostics _replicationAppliancesClientDiagnostics; + private ReplicationAppliancesRestOperations _replicationAppliancesRestClient; + private ClientDiagnostics _siteRecoveryNetworkReplicationNetworksClientDiagnostics; + private ReplicationNetworksRestOperations _siteRecoveryNetworkReplicationNetworksRestClient; + private ClientDiagnostics _siteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics; + private ReplicationNetworkMappingsRestOperations _siteRecoveryNetworkMappingReplicationNetworkMappingsRestClient; + private ClientDiagnostics _siteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics; + private ReplicationProtectionContainersRestOperations _siteRecoveryProtectionContainerReplicationProtectionContainersRestClient; + private ClientDiagnostics _siteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics; + private ReplicationMigrationItemsRestOperations _siteRecoveryMigrationItemReplicationMigrationItemsRestClient; + private ClientDiagnostics _replicationProtectedItemClientDiagnostics; + private ReplicationProtectedItemsRestOperations _replicationProtectedItemRestClient; + private ClientDiagnostics _protectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics; + private ReplicationProtectionContainerMappingsRestOperations _protectionContainerMappingReplicationProtectionContainerMappingsRestClient; + private ClientDiagnostics _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics; + private ReplicationRecoveryServicesProvidersRestOperations _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient; + private ClientDiagnostics _storageClassificationReplicationStorageClassificationsClientDiagnostics; + private ReplicationStorageClassificationsRestOperations _storageClassificationReplicationStorageClassificationsRestClient; + private ClientDiagnostics _storageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics; + private ReplicationStorageClassificationMappingsRestOperations _storageClassificationMappingReplicationStorageClassificationMappingsRestClient; + private ClientDiagnostics _siteRecoveryVCenterReplicationvCentersClientDiagnostics; + private ReplicationvCentersRestOperations _siteRecoveryVCenterReplicationvCentersRestClient; + private ClientDiagnostics _supportedOperatingSystemsClientDiagnostics; + private SupportedOperatingSystemsRestOperations _supportedOperatingSystemsRestClient; + private ClientDiagnostics _replicationVaultHealthClientDiagnostics; + private ReplicationVaultHealthRestOperations _replicationVaultHealthRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesSiteRecoveryResourceGroupResource() + { + } + + /// 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 MockableRecoveryServicesSiteRecoveryResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ReplicationAppliancesClientDiagnostics => _replicationAppliancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ReplicationAppliancesRestOperations ReplicationAppliancesRestClient => _replicationAppliancesRestClient ??= new ReplicationAppliancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SiteRecoveryNetworkReplicationNetworksClientDiagnostics => _siteRecoveryNetworkReplicationNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryNetworkResource.ResourceType.Namespace, Diagnostics); + private ReplicationNetworksRestOperations SiteRecoveryNetworkReplicationNetworksRestClient => _siteRecoveryNetworkReplicationNetworksRestClient ??= new ReplicationNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryNetworkResource.ResourceType)); + private ClientDiagnostics SiteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics => _siteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryNetworkMappingResource.ResourceType.Namespace, Diagnostics); + private ReplicationNetworkMappingsRestOperations SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient => _siteRecoveryNetworkMappingReplicationNetworkMappingsRestClient ??= new ReplicationNetworkMappingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryNetworkMappingResource.ResourceType)); + private ClientDiagnostics SiteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics => _siteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryProtectionContainerResource.ResourceType.Namespace, Diagnostics); + private ReplicationProtectionContainersRestOperations SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient => _siteRecoveryProtectionContainerReplicationProtectionContainersRestClient ??= new ReplicationProtectionContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryProtectionContainerResource.ResourceType)); + private ClientDiagnostics SiteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics => _siteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryMigrationItemResource.ResourceType.Namespace, Diagnostics); + private ReplicationMigrationItemsRestOperations SiteRecoveryMigrationItemReplicationMigrationItemsRestClient => _siteRecoveryMigrationItemReplicationMigrationItemsRestClient ??= new ReplicationMigrationItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryMigrationItemResource.ResourceType)); + private ClientDiagnostics ReplicationProtectedItemClientDiagnostics => _replicationProtectedItemClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ReplicationProtectedItemResource.ResourceType.Namespace, Diagnostics); + private ReplicationProtectedItemsRestOperations ReplicationProtectedItemRestClient => _replicationProtectedItemRestClient ??= new ReplicationProtectedItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ReplicationProtectedItemResource.ResourceType)); + private ClientDiagnostics ProtectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics => _protectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ProtectionContainerMappingResource.ResourceType.Namespace, Diagnostics); + private ReplicationProtectionContainerMappingsRestOperations ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient => _protectionContainerMappingReplicationProtectionContainerMappingsRestClient ??= new ReplicationProtectionContainerMappingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ProtectionContainerMappingResource.ResourceType)); + private ClientDiagnostics SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics => _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryServicesProviderResource.ResourceType.Namespace, Diagnostics); + private ReplicationRecoveryServicesProvidersRestOperations SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient => _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient ??= new ReplicationRecoveryServicesProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryServicesProviderResource.ResourceType)); + private ClientDiagnostics StorageClassificationReplicationStorageClassificationsClientDiagnostics => _storageClassificationReplicationStorageClassificationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", StorageClassificationResource.ResourceType.Namespace, Diagnostics); + private ReplicationStorageClassificationsRestOperations StorageClassificationReplicationStorageClassificationsRestClient => _storageClassificationReplicationStorageClassificationsRestClient ??= new ReplicationStorageClassificationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageClassificationResource.ResourceType)); + private ClientDiagnostics StorageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics => _storageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", StorageClassificationMappingResource.ResourceType.Namespace, Diagnostics); + private ReplicationStorageClassificationMappingsRestOperations StorageClassificationMappingReplicationStorageClassificationMappingsRestClient => _storageClassificationMappingReplicationStorageClassificationMappingsRestClient ??= new ReplicationStorageClassificationMappingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageClassificationMappingResource.ResourceType)); + private ClientDiagnostics SiteRecoveryVCenterReplicationvCentersClientDiagnostics => _siteRecoveryVCenterReplicationvCentersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryVCenterResource.ResourceType.Namespace, Diagnostics); + private ReplicationvCentersRestOperations SiteRecoveryVCenterReplicationvCentersRestClient => _siteRecoveryVCenterReplicationvCentersRestClient ??= new ReplicationvCentersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryVCenterResource.ResourceType)); + private ClientDiagnostics SupportedOperatingSystemsClientDiagnostics => _supportedOperatingSystemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SupportedOperatingSystemsRestOperations SupportedOperatingSystemsRestClient => _supportedOperatingSystemsRestClient ??= new SupportedOperatingSystemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ReplicationVaultHealthClientDiagnostics => _replicationVaultHealthClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ReplicationVaultHealthRestOperations ReplicationVaultHealthRestClient => _replicationVaultHealthRestClient ??= new ReplicationVaultHealthRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SiteRecoveryAlertResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of SiteRecoveryAlertResources and their operations over a SiteRecoveryAlertResource. + public virtual SiteRecoveryAlertCollection GetSiteRecoveryAlerts(string resourceName) + { + return new SiteRecoveryAlertCollection(Client, Id, resourceName); + } + + /// + /// Gets the details of the specified email notification(alert) configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName} + /// + /// + /// Operation Id + /// ReplicationAlertSettings_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The name of the email notification configuration. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteRecoveryAlertAsync(string resourceName, string alertSettingName, CancellationToken cancellationToken = default) + { + return await GetSiteRecoveryAlerts(resourceName).GetAsync(alertSettingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the specified email notification(alert) configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName} + /// + /// + /// Operation Id + /// ReplicationAlertSettings_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The name of the email notification configuration. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSiteRecoveryAlert(string resourceName, string alertSettingName, CancellationToken cancellationToken = default) + { + return GetSiteRecoveryAlerts(resourceName).Get(alertSettingName, cancellationToken); + } + + /// Gets a collection of ReplicationEligibilityResultResources in the ResourceGroupResource. + /// Virtual Machine name. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of ReplicationEligibilityResultResources and their operations over a ReplicationEligibilityResultResource. + public virtual ReplicationEligibilityResultCollection GetReplicationEligibilityResults(string virtualMachineName) + { + return new ReplicationEligibilityResultCollection(Client, Id, virtualMachineName); + } + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default + /// + /// + /// Operation Id + /// ReplicationEligibilityResults_Get + /// + /// + /// + /// Virtual Machine name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetReplicationEligibilityResultAsync(string virtualMachineName, CancellationToken cancellationToken = default) + { + return await GetReplicationEligibilityResults(virtualMachineName).GetAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Validates whether a given VM can be protected or not in which case returns list of errors. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default + /// + /// + /// Operation Id + /// ReplicationEligibilityResults_Get + /// + /// + /// + /// Virtual Machine name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetReplicationEligibilityResult(string virtualMachineName, CancellationToken cancellationToken = default) + { + return GetReplicationEligibilityResults(virtualMachineName).Get(cancellationToken); + } + + /// Gets a collection of SiteRecoveryEventResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of SiteRecoveryEventResources and their operations over a SiteRecoveryEventResource. + public virtual SiteRecoveryEventCollection GetSiteRecoveryEvents(string resourceName) + { + return new SiteRecoveryEventCollection(Client, Id, resourceName); + } + + /// + /// The operation to get the details of an Azure Site recovery event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName} + /// + /// + /// Operation Id + /// ReplicationEvents_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The name of the Azure Site Recovery event. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteRecoveryEventAsync(string resourceName, string eventName, CancellationToken cancellationToken = default) + { + return await GetSiteRecoveryEvents(resourceName).GetAsync(eventName, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to get the details of an Azure Site recovery event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName} + /// + /// + /// Operation Id + /// ReplicationEvents_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The name of the Azure Site Recovery event. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSiteRecoveryEvent(string resourceName, string eventName, CancellationToken cancellationToken = default) + { + return GetSiteRecoveryEvents(resourceName).Get(eventName, cancellationToken); + } + + /// Gets a collection of SiteRecoveryFabricResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of SiteRecoveryFabricResources and their operations over a SiteRecoveryFabricResource. + public virtual SiteRecoveryFabricCollection GetSiteRecoveryFabrics(string resourceName) + { + return new SiteRecoveryFabricCollection(Client, Id, resourceName); + } + + /// + /// Gets the details of an Azure Site Recovery fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// ReplicationFabrics_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Fabric name. + /// OData filter options. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteRecoveryFabricAsync(string resourceName, string fabricName, string filter = null, CancellationToken cancellationToken = default) + { + return await GetSiteRecoveryFabrics(resourceName).GetAsync(fabricName, filter, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of an Azure Site Recovery fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// ReplicationFabrics_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Fabric name. + /// OData filter options. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSiteRecoveryFabric(string resourceName, string fabricName, string filter = null, CancellationToken cancellationToken = default) + { + return GetSiteRecoveryFabrics(resourceName).Get(fabricName, filter, cancellationToken); + } + + /// Gets a collection of SiteRecoveryJobResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of SiteRecoveryJobResources and their operations over a SiteRecoveryJobResource. + public virtual SiteRecoveryJobCollection GetSiteRecoveryJobs(string resourceName) + { + return new SiteRecoveryJobCollection(Client, Id, resourceName); + } + + /// + /// Get the details of an Azure Site Recovery job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName} + /// + /// + /// Operation Id + /// ReplicationJobs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Job identifier. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteRecoveryJobAsync(string resourceName, string jobName, CancellationToken cancellationToken = default) + { + return await GetSiteRecoveryJobs(resourceName).GetAsync(jobName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the details of an Azure Site Recovery job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName} + /// + /// + /// Operation Id + /// ReplicationJobs_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Job identifier. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSiteRecoveryJob(string resourceName, string jobName, CancellationToken cancellationToken = default) + { + return GetSiteRecoveryJobs(resourceName).Get(jobName, cancellationToken); + } + + /// Gets a collection of SiteRecoveryPolicyResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of SiteRecoveryPolicyResources and their operations over a SiteRecoveryPolicyResource. + public virtual SiteRecoveryPolicyCollection GetSiteRecoveryPolicies(string resourceName) + { + return new SiteRecoveryPolicyCollection(Client, Id, resourceName); + } + + /// + /// Gets the details of a replication policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// ReplicationPolicies_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Replication policy name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteRecoveryPolicyAsync(string resourceName, string policyName, CancellationToken cancellationToken = default) + { + return await GetSiteRecoveryPolicies(resourceName).GetAsync(policyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of a replication policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// ReplicationPolicies_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Replication policy name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSiteRecoveryPolicy(string resourceName, string policyName, CancellationToken cancellationToken = default) + { + return GetSiteRecoveryPolicies(resourceName).Get(policyName, cancellationToken); + } + + /// Gets a collection of ReplicationProtectionIntentResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of ReplicationProtectionIntentResources and their operations over a ReplicationProtectionIntentResource. + public virtual ReplicationProtectionIntentCollection GetReplicationProtectionIntents(string resourceName) + { + return new ReplicationProtectionIntentCollection(Client, Id, resourceName); + } + + /// + /// Gets the details of an ASR replication protection intent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName} + /// + /// + /// Operation Id + /// ReplicationProtectionIntents_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Replication protection intent name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetReplicationProtectionIntentAsync(string resourceName, string intentObjectName, CancellationToken cancellationToken = default) + { + return await GetReplicationProtectionIntents(resourceName).GetAsync(intentObjectName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of an ASR replication protection intent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName} + /// + /// + /// Operation Id + /// ReplicationProtectionIntents_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Replication protection intent name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetReplicationProtectionIntent(string resourceName, string intentObjectName, CancellationToken cancellationToken = default) + { + return GetReplicationProtectionIntents(resourceName).Get(intentObjectName, cancellationToken); + } + + /// Gets a collection of SiteRecoveryRecoveryPlanResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of SiteRecoveryRecoveryPlanResources and their operations over a SiteRecoveryRecoveryPlanResource. + public virtual SiteRecoveryRecoveryPlanCollection GetSiteRecoveryRecoveryPlans(string resourceName) + { + return new SiteRecoveryRecoveryPlanCollection(Client, Id, resourceName); + } + + /// + /// Gets the details of the recovery plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName} + /// + /// + /// Operation Id + /// ReplicationRecoveryPlans_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the recovery plan. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteRecoveryRecoveryPlanAsync(string resourceName, string recoveryPlanName, CancellationToken cancellationToken = default) + { + return await GetSiteRecoveryRecoveryPlans(resourceName).GetAsync(recoveryPlanName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the recovery plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName} + /// + /// + /// Operation Id + /// ReplicationRecoveryPlans_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Name of the recovery plan. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSiteRecoveryRecoveryPlan(string resourceName, string recoveryPlanName, CancellationToken cancellationToken = default) + { + return GetSiteRecoveryRecoveryPlans(resourceName).Get(recoveryPlanName, cancellationToken); + } + + /// Gets a collection of SiteRecoveryVaultSettingResources in the ResourceGroupResource. + /// The name of the recovery services vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of SiteRecoveryVaultSettingResources and their operations over a SiteRecoveryVaultSettingResource. + public virtual SiteRecoveryVaultSettingCollection GetSiteRecoveryVaultSettings(string resourceName) + { + return new SiteRecoveryVaultSettingCollection(Client, Id, resourceName); + } + + /// + /// Gets the vault setting. This includes the Migration Hub connection settings. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName} + /// + /// + /// Operation Id + /// ReplicationVaultSetting_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Vault setting name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSiteRecoveryVaultSettingAsync(string resourceName, string vaultSettingName, CancellationToken cancellationToken = default) + { + return await GetSiteRecoveryVaultSettings(resourceName).GetAsync(vaultSettingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the vault setting. This includes the Migration Hub connection settings. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName} + /// + /// + /// Operation Id + /// ReplicationVaultSetting_Get + /// + /// + /// + /// The name of the recovery services vault. + /// Vault setting name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSiteRecoveryVaultSetting(string resourceName, string vaultSettingName, CancellationToken cancellationToken = default) + { + return GetSiteRecoveryVaultSettings(resourceName).Get(vaultSettingName, cancellationToken); + } + + /// + /// Gets the list of Azure Site Recovery appliances for the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances + /// + /// + /// Operation Id + /// ReplicationAppliances_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReplicationAppliancesAsync(string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ReplicationAppliancesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReplicationAppliancesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SiteRecoveryReplicationAppliance.DeserializeSiteRecoveryReplicationAppliance, ReplicationAppliancesClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetReplicationAppliances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of Azure Site Recovery appliances for the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances + /// + /// + /// Operation Id + /// ReplicationAppliances_List + /// + /// + /// + /// The name of the recovery services vault. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReplicationAppliances(string resourceName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ReplicationAppliancesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReplicationAppliancesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SiteRecoveryReplicationAppliance.DeserializeSiteRecoveryReplicationAppliance, ReplicationAppliancesClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetReplicationAppliances", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the networks available in a vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks + /// + /// + /// Operation Id + /// ReplicationNetworks_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSiteRecoveryNetworksAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryNetworkReplicationNetworksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryNetworkReplicationNetworksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryNetworkResource(Client, SiteRecoveryNetworkData.DeserializeSiteRecoveryNetworkData(e)), SiteRecoveryNetworkReplicationNetworksClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the networks available in a vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks + /// + /// + /// Operation Id + /// ReplicationNetworks_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSiteRecoveryNetworks(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryNetworkReplicationNetworksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryNetworkReplicationNetworksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryNetworkResource(Client, SiteRecoveryNetworkData.DeserializeSiteRecoveryNetworkData(e)), SiteRecoveryNetworkReplicationNetworksClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryNetworks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all ASR network mappings in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings + /// + /// + /// Operation Id + /// ReplicationNetworkMappings_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSiteRecoveryNetworkMappingsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryNetworkMappingResource(Client, SiteRecoveryNetworkMappingData.DeserializeSiteRecoveryNetworkMappingData(e)), SiteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryNetworkMappings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all ASR network mappings in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings + /// + /// + /// Operation Id + /// ReplicationNetworkMappings_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSiteRecoveryNetworkMappings(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryNetworkMappingResource(Client, SiteRecoveryNetworkMappingData.DeserializeSiteRecoveryNetworkMappingData(e)), SiteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryNetworkMappings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the protection containers in a vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers + /// + /// + /// Operation Id + /// ReplicationProtectionContainers_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSiteRecoveryProtectionContainersAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryProtectionContainerResource(Client, SiteRecoveryProtectionContainerData.DeserializeSiteRecoveryProtectionContainerData(e)), SiteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryProtectionContainers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the protection containers in a vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers + /// + /// + /// Operation Id + /// ReplicationProtectionContainers_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSiteRecoveryProtectionContainers(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryProtectionContainerResource(Client, SiteRecoveryProtectionContainerData.DeserializeSiteRecoveryProtectionContainerData(e)), SiteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryProtectionContainers", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of migration items in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems + /// + /// + /// Operation Id + /// ReplicationMigrationItems_List + /// + /// + /// + /// The name of the recovery services vault. + /// The pagination token. + /// The page size. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSiteRecoveryMigrationItemsAsync(string resourceName, string skipToken = null, string takeToken = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryMigrationItemReplicationMigrationItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, takeToken, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryMigrationItemReplicationMigrationItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, takeToken, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryMigrationItemResource(Client, SiteRecoveryMigrationItemData.DeserializeSiteRecoveryMigrationItemData(e)), SiteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryMigrationItems", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of migration items in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems + /// + /// + /// Operation Id + /// ReplicationMigrationItems_List + /// + /// + /// + /// The name of the recovery services vault. + /// The pagination token. + /// The page size. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSiteRecoveryMigrationItems(string resourceName, string skipToken = null, string takeToken = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryMigrationItemReplicationMigrationItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, takeToken, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryMigrationItemReplicationMigrationItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, takeToken, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryMigrationItemResource(Client, SiteRecoveryMigrationItemData.DeserializeSiteRecoveryMigrationItemData(e)), SiteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryMigrationItems", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of ASR replication protected items in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems + /// + /// + /// Operation Id + /// ReplicationProtectedItems_List + /// + /// + /// + /// The name of the recovery services vault. + /// The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReplicationProtectedItemsAsync(string resourceName, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ReplicationProtectedItemRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReplicationProtectedItemRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ReplicationProtectedItemResource(Client, ReplicationProtectedItemData.DeserializeReplicationProtectedItemData(e)), ReplicationProtectedItemClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetReplicationProtectedItems", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of ASR replication protected items in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems + /// + /// + /// Operation Id + /// ReplicationProtectedItems_List + /// + /// + /// + /// The name of the recovery services vault. + /// The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null. + /// OData filter options. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReplicationProtectedItems(string resourceName, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ReplicationProtectedItemRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReplicationProtectedItemRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ReplicationProtectedItemResource(Client, ReplicationProtectedItemData.DeserializeReplicationProtectedItemData(e)), ReplicationProtectedItemClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetReplicationProtectedItems", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the protection container mappings in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings + /// + /// + /// Operation Id + /// ReplicationProtectionContainerMappings_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetProtectionContainerMappingsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProtectionContainerMappingResource(Client, ProtectionContainerMappingData.DeserializeProtectionContainerMappingData(e)), ProtectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetProtectionContainerMappings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the protection container mappings in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings + /// + /// + /// Operation Id + /// ReplicationProtectionContainerMappings_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetProtectionContainerMappings(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProtectionContainerMappingResource(Client, ProtectionContainerMappingData.DeserializeProtectionContainerMappingData(e)), ProtectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetProtectionContainerMappings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the registered recovery services providers in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders + /// + /// + /// Operation Id + /// ReplicationRecoveryServicesProviders_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSiteRecoveryServicesProvidersAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryServicesProviderResource(Client, SiteRecoveryServicesProviderData.DeserializeSiteRecoveryServicesProviderData(e)), SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryServicesProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the registered recovery services providers in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders + /// + /// + /// Operation Id + /// ReplicationRecoveryServicesProviders_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSiteRecoveryServicesProviders(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryServicesProviderResource(Client, SiteRecoveryServicesProviderData.DeserializeSiteRecoveryServicesProviderData(e)), SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryServicesProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the storage classifications in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications + /// + /// + /// Operation Id + /// ReplicationStorageClassifications_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageClassificationsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageClassificationReplicationStorageClassificationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageClassificationReplicationStorageClassificationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageClassificationResource(Client, StorageClassificationData.DeserializeStorageClassificationData(e)), StorageClassificationReplicationStorageClassificationsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetStorageClassifications", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the storage classifications in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications + /// + /// + /// Operation Id + /// ReplicationStorageClassifications_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageClassifications(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageClassificationReplicationStorageClassificationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageClassificationReplicationStorageClassificationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageClassificationResource(Client, StorageClassificationData.DeserializeStorageClassificationData(e)), StorageClassificationReplicationStorageClassificationsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetStorageClassifications", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the storage classification mappings in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings + /// + /// + /// Operation Id + /// ReplicationStorageClassificationMappings_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageClassificationMappingsAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageClassificationMappingReplicationStorageClassificationMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageClassificationMappingReplicationStorageClassificationMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageClassificationMappingResource(Client, StorageClassificationMappingData.DeserializeStorageClassificationMappingData(e)), StorageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetStorageClassificationMappings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the storage classification mappings in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings + /// + /// + /// Operation Id + /// ReplicationStorageClassificationMappings_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageClassificationMappings(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageClassificationMappingReplicationStorageClassificationMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageClassificationMappingReplicationStorageClassificationMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageClassificationMappingResource(Client, StorageClassificationMappingData.DeserializeStorageClassificationMappingData(e)), StorageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetStorageClassificationMappings", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the vCenter servers registered in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters + /// + /// + /// Operation Id + /// ReplicationvCenters_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSiteRecoveryVCentersAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryVCenterReplicationvCentersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryVCenterReplicationvCentersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryVCenterResource(Client, SiteRecoveryVCenterData.DeserializeSiteRecoveryVCenterData(e)), SiteRecoveryVCenterReplicationvCentersClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryVCenters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the vCenter servers registered in the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters + /// + /// + /// Operation Id + /// ReplicationvCenters_List + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSiteRecoveryVCenters(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryVCenterReplicationvCentersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryVCenterReplicationvCentersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryVCenterResource(Client, SiteRecoveryVCenterData.DeserializeSiteRecoveryVCenterData(e)), SiteRecoveryVCenterReplicationvCentersClientDiagnostics, Pipeline, "MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSiteRecoveryVCenters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the data of supported operating systems by SRS. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems + /// + /// + /// Operation Id + /// SupportedOperatingSystems_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The instance type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetSupportedOperatingSystemAsync(string resourceName, string instanceType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = SupportedOperatingSystemsClientDiagnostics.CreateScope("MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSupportedOperatingSystem"); + scope.Start(); + try + { + var response = await SupportedOperatingSystemsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, instanceType, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the data of supported operating systems by SRS. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems + /// + /// + /// Operation Id + /// SupportedOperatingSystems_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The instance type. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetSupportedOperatingSystem(string resourceName, string instanceType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = SupportedOperatingSystemsClientDiagnostics.CreateScope("MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetSupportedOperatingSystem"); + scope.Start(); + try + { + var response = SupportedOperatingSystemsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, instanceType, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the health details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth + /// + /// + /// Operation Id + /// ReplicationVaultHealth_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetReplicationVaultHealthAsync(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = ReplicationVaultHealthClientDiagnostics.CreateScope("MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetReplicationVaultHealth"); + scope.Start(); + try + { + var response = await ReplicationVaultHealthRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the health details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth + /// + /// + /// Operation Id + /// ReplicationVaultHealth_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetReplicationVaultHealth(string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = ReplicationVaultHealthClientDiagnostics.CreateScope("MockableRecoveryServicesSiteRecoveryResourceGroupResource.GetReplicationVaultHealth"); + scope.Start(); + try + { + var response = ReplicationVaultHealthRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Refreshes health summary of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh + /// + /// + /// Operation Id + /// ReplicationVaultHealth_Refresh + /// + /// + /// + /// 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 recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> RefreshReplicationVaultHealthAsync(WaitUntil waitUntil, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = ReplicationVaultHealthClientDiagnostics.CreateScope("MockableRecoveryServicesSiteRecoveryResourceGroupResource.RefreshReplicationVaultHealth"); + scope.Start(); + try + { + var response = await ReplicationVaultHealthRestClient.RefreshAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesSiteRecoveryArmOperation(new VaultHealthDetailsOperationSource(), ReplicationVaultHealthClientDiagnostics, Pipeline, ReplicationVaultHealthRestClient.CreateRefreshRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Refreshes health summary of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh + /// + /// + /// Operation Id + /// ReplicationVaultHealth_Refresh + /// + /// + /// + /// 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 recovery services vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual ArmOperation RefreshReplicationVaultHealth(WaitUntil waitUntil, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var scope = ReplicationVaultHealthClientDiagnostics.CreateScope("MockableRecoveryServicesSiteRecoveryResourceGroupResource.RefreshReplicationVaultHealth"); + scope.Start(); + try + { + var response = ReplicationVaultHealthRestClient.Refresh(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); + var operation = new RecoveryServicesSiteRecoveryArmOperation(new VaultHealthDetailsOperationSource(), ReplicationVaultHealthClientDiagnostics, Pipeline, ReplicationVaultHealthRestClient.CreateRefreshRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/RecoveryServicesSiteRecoveryExtensions.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/RecoveryServicesSiteRecoveryExtensions.cs index 85badd6bf35c6..bdcd1f57ba4fd 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/RecoveryServicesSiteRecoveryExtensions.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/RecoveryServicesSiteRecoveryExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesSiteRecovery.Mocking; using Azure.ResourceManager.RecoveryServicesSiteRecovery.Models; using Azure.ResourceManager.Resources; @@ -19,469 +20,399 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery /// A class to add extension methods to Azure.ResourceManager.RecoveryServicesSiteRecovery. public static partial class RecoveryServicesSiteRecoveryExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableRecoveryServicesSiteRecoveryArmClient GetMockableRecoveryServicesSiteRecoveryArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableRecoveryServicesSiteRecoveryArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableRecoveryServicesSiteRecoveryResourceGroupResource GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableRecoveryServicesSiteRecoveryResourceGroupResource(client, resource.Id)); } - #region SiteRecoveryAlertResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryAlertResource GetSiteRecoveryAlertResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryAlertResource.ValidateResourceId(id); - return new SiteRecoveryAlertResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryAlertResource(id); } - #endregion - #region ReplicationEligibilityResultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ReplicationEligibilityResultResource GetReplicationEligibilityResultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ReplicationEligibilityResultResource.ValidateResourceId(id); - return new ReplicationEligibilityResultResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetReplicationEligibilityResultResource(id); } - #endregion - #region SiteRecoveryEventResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryEventResource GetSiteRecoveryEventResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryEventResource.ValidateResourceId(id); - return new SiteRecoveryEventResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryEventResource(id); } - #endregion - #region SiteRecoveryFabricResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryFabricResource GetSiteRecoveryFabricResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryFabricResource.ValidateResourceId(id); - return new SiteRecoveryFabricResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryFabricResource(id); } - #endregion - #region SiteRecoveryLogicalNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryLogicalNetworkResource GetSiteRecoveryLogicalNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryLogicalNetworkResource.ValidateResourceId(id); - return new SiteRecoveryLogicalNetworkResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryLogicalNetworkResource(id); } - #endregion - #region SiteRecoveryNetworkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryNetworkResource GetSiteRecoveryNetworkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryNetworkResource.ValidateResourceId(id); - return new SiteRecoveryNetworkResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryNetworkResource(id); } - #endregion - #region SiteRecoveryNetworkMappingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryNetworkMappingResource GetSiteRecoveryNetworkMappingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryNetworkMappingResource.ValidateResourceId(id); - return new SiteRecoveryNetworkMappingResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryNetworkMappingResource(id); } - #endregion - #region SiteRecoveryProtectionContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryProtectionContainerResource GetSiteRecoveryProtectionContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryProtectionContainerResource.ValidateResourceId(id); - return new SiteRecoveryProtectionContainerResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryProtectionContainerResource(id); } - #endregion - #region SiteRecoveryMigrationItemResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryMigrationItemResource GetSiteRecoveryMigrationItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryMigrationItemResource.ValidateResourceId(id); - return new SiteRecoveryMigrationItemResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryMigrationItemResource(id); } - #endregion - #region MigrationRecoveryPointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MigrationRecoveryPointResource GetMigrationRecoveryPointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MigrationRecoveryPointResource.ValidateResourceId(id); - return new MigrationRecoveryPointResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetMigrationRecoveryPointResource(id); } - #endregion - #region SiteRecoveryProtectableItemResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryProtectableItemResource GetSiteRecoveryProtectableItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryProtectableItemResource.ValidateResourceId(id); - return new SiteRecoveryProtectableItemResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryProtectableItemResource(id); } - #endregion - #region ReplicationProtectedItemResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ReplicationProtectedItemResource GetReplicationProtectedItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ReplicationProtectedItemResource.ValidateResourceId(id); - return new ReplicationProtectedItemResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetReplicationProtectedItemResource(id); } - #endregion - #region SiteRecoveryPointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryPointResource GetSiteRecoveryPointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryPointResource.ValidateResourceId(id); - return new SiteRecoveryPointResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryPointResource(id); } - #endregion - #region ProtectionContainerMappingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProtectionContainerMappingResource GetProtectionContainerMappingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProtectionContainerMappingResource.ValidateResourceId(id); - return new ProtectionContainerMappingResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetProtectionContainerMappingResource(id); } - #endregion - #region SiteRecoveryServicesProviderResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryServicesProviderResource GetSiteRecoveryServicesProviderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryServicesProviderResource.ValidateResourceId(id); - return new SiteRecoveryServicesProviderResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryServicesProviderResource(id); } - #endregion - #region StorageClassificationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageClassificationResource GetStorageClassificationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageClassificationResource.ValidateResourceId(id); - return new StorageClassificationResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetStorageClassificationResource(id); } - #endregion - #region StorageClassificationMappingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageClassificationMappingResource GetStorageClassificationMappingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageClassificationMappingResource.ValidateResourceId(id); - return new StorageClassificationMappingResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetStorageClassificationMappingResource(id); } - #endregion - #region SiteRecoveryVCenterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryVCenterResource GetSiteRecoveryVCenterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryVCenterResource.ValidateResourceId(id); - return new SiteRecoveryVCenterResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryVCenterResource(id); } - #endregion - #region SiteRecoveryJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryJobResource GetSiteRecoveryJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryJobResource.ValidateResourceId(id); - return new SiteRecoveryJobResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryJobResource(id); } - #endregion - #region SiteRecoveryPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryPolicyResource GetSiteRecoveryPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryPolicyResource.ValidateResourceId(id); - return new SiteRecoveryPolicyResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryPolicyResource(id); } - #endregion - #region ReplicationProtectionIntentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ReplicationProtectionIntentResource GetReplicationProtectionIntentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ReplicationProtectionIntentResource.ValidateResourceId(id); - return new ReplicationProtectionIntentResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetReplicationProtectionIntentResource(id); } - #endregion - #region SiteRecoveryRecoveryPlanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryRecoveryPlanResource GetSiteRecoveryRecoveryPlanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryRecoveryPlanResource.ValidateResourceId(id); - return new SiteRecoveryRecoveryPlanResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryRecoveryPlanResource(id); } - #endregion - #region SiteRecoveryVaultSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecoveryVaultSettingResource GetSiteRecoveryVaultSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecoveryVaultSettingResource.ValidateResourceId(id); - return new SiteRecoveryVaultSettingResource(client, id); - } - ); + return GetMockableRecoveryServicesSiteRecoveryArmClient(client).GetSiteRecoveryVaultSettingResource(id); } - #endregion - /// Gets a collection of SiteRecoveryAlertResources in the ResourceGroupResource. + /// + /// Gets a collection of SiteRecoveryAlertResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of SiteRecoveryAlertResources and their operations over a SiteRecoveryAlertResource. public static SiteRecoveryAlertCollection GetSiteRecoveryAlerts(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryAlerts(resourceName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryAlerts(resourceName); } /// @@ -496,17 +427,21 @@ public static SiteRecoveryAlertCollection GetSiteRecoveryAlerts(this ResourceGro /// ReplicationAlertSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The name of the email notification configuration. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSiteRecoveryAlertAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string alertSettingName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSiteRecoveryAlerts(resourceName).GetAsync(alertSettingName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryAlertAsync(resourceName, alertSettingName, cancellationToken).ConfigureAwait(false); } /// @@ -521,30 +456,38 @@ public static async Task> GetSiteRecoveryAle /// ReplicationAlertSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The name of the email notification configuration. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSiteRecoveryAlert(this ResourceGroupResource resourceGroupResource, string resourceName, string alertSettingName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSiteRecoveryAlerts(resourceName).Get(alertSettingName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryAlert(resourceName, alertSettingName, cancellationToken); } - /// Gets a collection of ReplicationEligibilityResultResources in the ResourceGroupResource. + /// + /// Gets a collection of ReplicationEligibilityResultResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Virtual Machine name. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of ReplicationEligibilityResultResources and their operations over a ReplicationEligibilityResultResource. public static ReplicationEligibilityResultCollection GetReplicationEligibilityResults(this ResourceGroupResource resourceGroupResource, string virtualMachineName) { - Argument.AssertNotNullOrEmpty(virtualMachineName, nameof(virtualMachineName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetReplicationEligibilityResults(virtualMachineName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationEligibilityResults(virtualMachineName); } /// @@ -559,16 +502,20 @@ public static ReplicationEligibilityResultCollection GetReplicationEligibilityRe /// ReplicationEligibilityResults_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Virtual Machine name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetReplicationEligibilityResultAsync(this ResourceGroupResource resourceGroupResource, string virtualMachineName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetReplicationEligibilityResults(virtualMachineName).GetAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationEligibilityResultAsync(virtualMachineName, cancellationToken).ConfigureAwait(false); } /// @@ -583,29 +530,37 @@ public static async Task> GetRepl /// ReplicationEligibilityResults_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Virtual Machine name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetReplicationEligibilityResult(this ResourceGroupResource resourceGroupResource, string virtualMachineName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetReplicationEligibilityResults(virtualMachineName).Get(cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationEligibilityResult(virtualMachineName, cancellationToken); } - /// Gets a collection of SiteRecoveryEventResources in the ResourceGroupResource. + /// + /// Gets a collection of SiteRecoveryEventResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of SiteRecoveryEventResources and their operations over a SiteRecoveryEventResource. public static SiteRecoveryEventCollection GetSiteRecoveryEvents(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryEvents(resourceName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryEvents(resourceName); } /// @@ -620,17 +575,21 @@ public static SiteRecoveryEventCollection GetSiteRecoveryEvents(this ResourceGro /// ReplicationEvents_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The name of the Azure Site Recovery event. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSiteRecoveryEventAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string eventName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSiteRecoveryEvents(resourceName).GetAsync(eventName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryEventAsync(resourceName, eventName, cancellationToken).ConfigureAwait(false); } /// @@ -645,30 +604,38 @@ public static async Task> GetSiteRecoveryEve /// ReplicationEvents_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The name of the Azure Site Recovery event. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSiteRecoveryEvent(this ResourceGroupResource resourceGroupResource, string resourceName, string eventName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSiteRecoveryEvents(resourceName).Get(eventName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryEvent(resourceName, eventName, cancellationToken); } - /// Gets a collection of SiteRecoveryFabricResources in the ResourceGroupResource. + /// + /// Gets a collection of SiteRecoveryFabricResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of SiteRecoveryFabricResources and their operations over a SiteRecoveryFabricResource. public static SiteRecoveryFabricCollection GetSiteRecoveryFabrics(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryFabrics(resourceName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryFabrics(resourceName); } /// @@ -683,18 +650,22 @@ public static SiteRecoveryFabricCollection GetSiteRecoveryFabrics(this ResourceG /// ReplicationFabrics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Fabric name. /// OData filter options. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSiteRecoveryFabricAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string fabricName, string filter = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSiteRecoveryFabrics(resourceName).GetAsync(fabricName, filter, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryFabricAsync(resourceName, fabricName, filter, cancellationToken).ConfigureAwait(false); } /// @@ -709,31 +680,39 @@ public static async Task> GetSiteRecoveryFa /// ReplicationFabrics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Fabric name. /// OData filter options. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSiteRecoveryFabric(this ResourceGroupResource resourceGroupResource, string resourceName, string fabricName, string filter = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSiteRecoveryFabrics(resourceName).Get(fabricName, filter, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryFabric(resourceName, fabricName, filter, cancellationToken); } - /// Gets a collection of SiteRecoveryJobResources in the ResourceGroupResource. + /// + /// Gets a collection of SiteRecoveryJobResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of SiteRecoveryJobResources and their operations over a SiteRecoveryJobResource. public static SiteRecoveryJobCollection GetSiteRecoveryJobs(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryJobs(resourceName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryJobs(resourceName); } /// @@ -748,17 +727,21 @@ public static SiteRecoveryJobCollection GetSiteRecoveryJobs(this ResourceGroupRe /// ReplicationJobs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Job identifier. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSiteRecoveryJobAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string jobName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSiteRecoveryJobs(resourceName).GetAsync(jobName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryJobAsync(resourceName, jobName, cancellationToken).ConfigureAwait(false); } /// @@ -773,30 +756,38 @@ public static async Task> GetSiteRecoveryJobAs /// ReplicationJobs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Job identifier. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSiteRecoveryJob(this ResourceGroupResource resourceGroupResource, string resourceName, string jobName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSiteRecoveryJobs(resourceName).Get(jobName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryJob(resourceName, jobName, cancellationToken); } - /// Gets a collection of SiteRecoveryPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of SiteRecoveryPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of SiteRecoveryPolicyResources and their operations over a SiteRecoveryPolicyResource. public static SiteRecoveryPolicyCollection GetSiteRecoveryPolicies(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryPolicies(resourceName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryPolicies(resourceName); } /// @@ -811,17 +802,21 @@ public static SiteRecoveryPolicyCollection GetSiteRecoveryPolicies(this Resource /// ReplicationPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Replication policy name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSiteRecoveryPolicyAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string policyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSiteRecoveryPolicies(resourceName).GetAsync(policyName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryPolicyAsync(resourceName, policyName, cancellationToken).ConfigureAwait(false); } /// @@ -836,30 +831,38 @@ public static async Task> GetSiteRecoveryPo /// ReplicationPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Replication policy name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSiteRecoveryPolicy(this ResourceGroupResource resourceGroupResource, string resourceName, string policyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSiteRecoveryPolicies(resourceName).Get(policyName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryPolicy(resourceName, policyName, cancellationToken); } - /// Gets a collection of ReplicationProtectionIntentResources in the ResourceGroupResource. + /// + /// Gets a collection of ReplicationProtectionIntentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of ReplicationProtectionIntentResources and their operations over a ReplicationProtectionIntentResource. public static ReplicationProtectionIntentCollection GetReplicationProtectionIntents(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetReplicationProtectionIntents(resourceName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationProtectionIntents(resourceName); } /// @@ -874,17 +877,21 @@ public static ReplicationProtectionIntentCollection GetReplicationProtectionInte /// ReplicationProtectionIntents_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Replication protection intent name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetReplicationProtectionIntentAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string intentObjectName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetReplicationProtectionIntents(resourceName).GetAsync(intentObjectName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationProtectionIntentAsync(resourceName, intentObjectName, cancellationToken).ConfigureAwait(false); } /// @@ -899,30 +906,38 @@ public static async Task> GetRepli /// ReplicationProtectionIntents_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Replication protection intent name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetReplicationProtectionIntent(this ResourceGroupResource resourceGroupResource, string resourceName, string intentObjectName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetReplicationProtectionIntents(resourceName).Get(intentObjectName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationProtectionIntent(resourceName, intentObjectName, cancellationToken); } - /// Gets a collection of SiteRecoveryRecoveryPlanResources in the ResourceGroupResource. + /// + /// Gets a collection of SiteRecoveryRecoveryPlanResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of SiteRecoveryRecoveryPlanResources and their operations over a SiteRecoveryRecoveryPlanResource. public static SiteRecoveryRecoveryPlanCollection GetSiteRecoveryRecoveryPlans(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryRecoveryPlans(resourceName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryRecoveryPlans(resourceName); } /// @@ -937,17 +952,21 @@ public static SiteRecoveryRecoveryPlanCollection GetSiteRecoveryRecoveryPlans(th /// ReplicationRecoveryPlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Name of the recovery plan. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSiteRecoveryRecoveryPlanAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string recoveryPlanName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSiteRecoveryRecoveryPlans(resourceName).GetAsync(recoveryPlanName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryRecoveryPlanAsync(resourceName, recoveryPlanName, cancellationToken).ConfigureAwait(false); } /// @@ -962,30 +981,38 @@ public static async Task> GetSiteReco /// ReplicationRecoveryPlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Name of the recovery plan. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSiteRecoveryRecoveryPlan(this ResourceGroupResource resourceGroupResource, string resourceName, string recoveryPlanName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSiteRecoveryRecoveryPlans(resourceName).Get(recoveryPlanName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryRecoveryPlan(resourceName, recoveryPlanName, cancellationToken); } - /// Gets a collection of SiteRecoveryVaultSettingResources in the ResourceGroupResource. + /// + /// Gets a collection of SiteRecoveryVaultSettingResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the recovery services vault. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of SiteRecoveryVaultSettingResources and their operations over a SiteRecoveryVaultSettingResource. public static SiteRecoveryVaultSettingCollection GetSiteRecoveryVaultSettings(this ResourceGroupResource resourceGroupResource, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryVaultSettings(resourceName); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryVaultSettings(resourceName); } /// @@ -1000,17 +1027,21 @@ public static SiteRecoveryVaultSettingCollection GetSiteRecoveryVaultSettings(th /// ReplicationVaultSetting_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Vault setting name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSiteRecoveryVaultSettingAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string vaultSettingName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSiteRecoveryVaultSettings(resourceName).GetAsync(vaultSettingName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryVaultSettingAsync(resourceName, vaultSettingName, cancellationToken).ConfigureAwait(false); } /// @@ -1025,17 +1056,21 @@ public static async Task> GetSiteReco /// ReplicationVaultSetting_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// Vault setting name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSiteRecoveryVaultSetting(this ResourceGroupResource resourceGroupResource, string resourceName, string vaultSettingName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSiteRecoveryVaultSettings(resourceName).Get(vaultSettingName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryVaultSetting(resourceName, vaultSettingName, cancellationToken); } /// @@ -1050,6 +1085,10 @@ public static Response GetSiteRecoveryVaultSet /// ReplicationAppliances_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1060,9 +1099,7 @@ public static Response GetSiteRecoveryVaultSet /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetReplicationAppliancesAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetReplicationAppliancesAsync(resourceName, filter, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationAppliancesAsync(resourceName, filter, cancellationToken); } /// @@ -1077,6 +1114,10 @@ public static AsyncPageable GetReplicationAppl /// ReplicationAppliances_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1087,9 +1128,7 @@ public static AsyncPageable GetReplicationAppl /// A collection of that may take multiple service requests to iterate over. public static Pageable GetReplicationAppliances(this ResourceGroupResource resourceGroupResource, string resourceName, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetReplicationAppliances(resourceName, filter, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationAppliances(resourceName, filter, cancellationToken); } /// @@ -1104,6 +1143,10 @@ public static Pageable GetReplicationAppliance /// ReplicationNetworks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1113,9 +1156,7 @@ public static Pageable GetReplicationAppliance /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSiteRecoveryNetworksAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryNetworksAsync(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryNetworksAsync(resourceName, cancellationToken); } /// @@ -1130,6 +1171,10 @@ public static AsyncPageable GetSiteRecoveryNetworks /// ReplicationNetworks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1139,9 +1184,7 @@ public static AsyncPageable GetSiteRecoveryNetworks /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSiteRecoveryNetworks(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryNetworks(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryNetworks(resourceName, cancellationToken); } /// @@ -1156,6 +1199,10 @@ public static Pageable GetSiteRecoveryNetworks(this /// ReplicationNetworkMappings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1165,9 +1212,7 @@ public static Pageable GetSiteRecoveryNetworks(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSiteRecoveryNetworkMappingsAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryNetworkMappingsAsync(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryNetworkMappingsAsync(resourceName, cancellationToken); } /// @@ -1182,6 +1227,10 @@ public static AsyncPageable GetSiteRecoveryN /// ReplicationNetworkMappings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1191,9 +1240,7 @@ public static AsyncPageable GetSiteRecoveryN /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSiteRecoveryNetworkMappings(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryNetworkMappings(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryNetworkMappings(resourceName, cancellationToken); } /// @@ -1208,6 +1255,10 @@ public static Pageable GetSiteRecoveryNetwor /// ReplicationProtectionContainers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1217,9 +1268,7 @@ public static Pageable GetSiteRecoveryNetwor /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSiteRecoveryProtectionContainersAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryProtectionContainersAsync(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryProtectionContainersAsync(resourceName, cancellationToken); } /// @@ -1234,6 +1283,10 @@ public static AsyncPageable GetSiteReco /// ReplicationProtectionContainers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1243,9 +1296,7 @@ public static AsyncPageable GetSiteReco /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSiteRecoveryProtectionContainers(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryProtectionContainers(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryProtectionContainers(resourceName, cancellationToken); } /// @@ -1260,6 +1311,10 @@ public static Pageable GetSiteRecoveryP /// ReplicationMigrationItems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1272,9 +1327,7 @@ public static Pageable GetSiteRecoveryP /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSiteRecoveryMigrationItemsAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string skipToken = null, string takeToken = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryMigrationItemsAsync(resourceName, skipToken, takeToken, filter, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryMigrationItemsAsync(resourceName, skipToken, takeToken, filter, cancellationToken); } /// @@ -1289,6 +1342,10 @@ public static AsyncPageable GetSiteRecoveryMi /// ReplicationMigrationItems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1301,9 +1358,7 @@ public static AsyncPageable GetSiteRecoveryMi /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSiteRecoveryMigrationItems(this ResourceGroupResource resourceGroupResource, string resourceName, string skipToken = null, string takeToken = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryMigrationItems(resourceName, skipToken, takeToken, filter, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryMigrationItems(resourceName, skipToken, takeToken, filter, cancellationToken); } /// @@ -1318,6 +1373,10 @@ public static Pageable GetSiteRecoveryMigrati /// ReplicationProtectedItems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1329,9 +1388,7 @@ public static Pageable GetSiteRecoveryMigrati /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetReplicationProtectedItemsAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetReplicationProtectedItemsAsync(resourceName, skipToken, filter, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationProtectedItemsAsync(resourceName, skipToken, filter, cancellationToken); } /// @@ -1346,6 +1403,10 @@ public static AsyncPageable GetReplicationProt /// ReplicationProtectedItems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1357,9 +1418,7 @@ public static AsyncPageable GetReplicationProt /// A collection of that may take multiple service requests to iterate over. public static Pageable GetReplicationProtectedItems(this ResourceGroupResource resourceGroupResource, string resourceName, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetReplicationProtectedItems(resourceName, skipToken, filter, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationProtectedItems(resourceName, skipToken, filter, cancellationToken); } /// @@ -1374,6 +1433,10 @@ public static Pageable GetReplicationProtected /// ReplicationProtectionContainerMappings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1383,9 +1446,7 @@ public static Pageable GetReplicationProtected /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetProtectionContainerMappingsAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetProtectionContainerMappingsAsync(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetProtectionContainerMappingsAsync(resourceName, cancellationToken); } /// @@ -1400,6 +1461,10 @@ public static AsyncPageable GetProtectionCon /// ReplicationProtectionContainerMappings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1409,9 +1474,7 @@ public static AsyncPageable GetProtectionCon /// A collection of that may take multiple service requests to iterate over. public static Pageable GetProtectionContainerMappings(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetProtectionContainerMappings(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetProtectionContainerMappings(resourceName, cancellationToken); } /// @@ -1426,6 +1489,10 @@ public static Pageable GetProtectionContaine /// ReplicationRecoveryServicesProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1435,9 +1502,7 @@ public static Pageable GetProtectionContaine /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSiteRecoveryServicesProvidersAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryServicesProvidersAsync(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryServicesProvidersAsync(resourceName, cancellationToken); } /// @@ -1452,6 +1517,10 @@ public static AsyncPageable GetSiteRecover /// ReplicationRecoveryServicesProviders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1461,9 +1530,7 @@ public static AsyncPageable GetSiteRecover /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSiteRecoveryServicesProviders(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryServicesProviders(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryServicesProviders(resourceName, cancellationToken); } /// @@ -1478,6 +1545,10 @@ public static Pageable GetSiteRecoveryServ /// ReplicationStorageClassifications_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1487,9 +1558,7 @@ public static Pageable GetSiteRecoveryServ /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetStorageClassificationsAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageClassificationsAsync(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetStorageClassificationsAsync(resourceName, cancellationToken); } /// @@ -1504,6 +1573,10 @@ public static AsyncPageable GetStorageClassificat /// ReplicationStorageClassifications_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1513,9 +1586,7 @@ public static AsyncPageable GetStorageClassificat /// A collection of that may take multiple service requests to iterate over. public static Pageable GetStorageClassifications(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageClassifications(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetStorageClassifications(resourceName, cancellationToken); } /// @@ -1530,6 +1601,10 @@ public static Pageable GetStorageClassifications( /// ReplicationStorageClassificationMappings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1539,9 +1614,7 @@ public static Pageable GetStorageClassifications( /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetStorageClassificationMappingsAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageClassificationMappingsAsync(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetStorageClassificationMappingsAsync(resourceName, cancellationToken); } /// @@ -1556,6 +1629,10 @@ public static AsyncPageable GetStorageClas /// ReplicationStorageClassificationMappings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1565,9 +1642,7 @@ public static AsyncPageable GetStorageClas /// A collection of that may take multiple service requests to iterate over. public static Pageable GetStorageClassificationMappings(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageClassificationMappings(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetStorageClassificationMappings(resourceName, cancellationToken); } /// @@ -1582,6 +1657,10 @@ public static Pageable GetStorageClassific /// ReplicationvCenters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1591,9 +1670,7 @@ public static Pageable GetStorageClassific /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSiteRecoveryVCentersAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryVCentersAsync(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryVCentersAsync(resourceName, cancellationToken); } /// @@ -1608,6 +1685,10 @@ public static AsyncPageable GetSiteRecoveryVCenters /// ReplicationvCenters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1617,9 +1698,7 @@ public static AsyncPageable GetSiteRecoveryVCenters /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSiteRecoveryVCenters(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSiteRecoveryVCenters(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSiteRecoveryVCenters(resourceName, cancellationToken); } /// @@ -1634,6 +1713,10 @@ public static Pageable GetSiteRecoveryVCenters(this /// SupportedOperatingSystems_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1643,9 +1726,7 @@ public static Pageable GetSiteRecoveryVCenters(this /// is null. public static async Task> GetSupportedOperatingSystemAsync(this ResourceGroupResource resourceGroupResource, string resourceName, string instanceType = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSupportedOperatingSystemAsync(resourceName, instanceType, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSupportedOperatingSystemAsync(resourceName, instanceType, cancellationToken).ConfigureAwait(false); } /// @@ -1660,6 +1741,10 @@ public static async Task> GetSup /// SupportedOperatingSystems_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1669,9 +1754,7 @@ public static async Task> GetSup /// is null. public static Response GetSupportedOperatingSystem(this ResourceGroupResource resourceGroupResource, string resourceName, string instanceType = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSupportedOperatingSystem(resourceName, instanceType, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetSupportedOperatingSystem(resourceName, instanceType, cancellationToken); } /// @@ -1686,6 +1769,10 @@ public static Response GetSupportedOperat /// ReplicationVaultHealth_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1694,9 +1781,7 @@ public static Response GetSupportedOperat /// is null. public static async Task> GetReplicationVaultHealthAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetReplicationVaultHealthAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationVaultHealthAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -1711,6 +1796,10 @@ public static async Task> GetReplicationVaultHealth /// ReplicationVaultHealth_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. @@ -1719,9 +1808,7 @@ public static async Task> GetReplicationVaultHealth /// is null. public static Response GetReplicationVaultHealth(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetReplicationVaultHealth(resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).GetReplicationVaultHealth(resourceName, cancellationToken); } /// @@ -1736,6 +1823,10 @@ public static Response GetReplicationVaultHealth(this Resour /// ReplicationVaultHealth_Refresh /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1745,9 +1836,7 @@ public static Response GetReplicationVaultHealth(this Resour /// is null. public static async Task> RefreshReplicationVaultHealthAsync(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).RefreshReplicationVaultHealthAsync(waitUntil, resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).RefreshReplicationVaultHealthAsync(waitUntil, resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -1762,6 +1851,10 @@ public static async Task> RefreshReplicationVau /// ReplicationVaultHealth_Refresh /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -1771,9 +1864,7 @@ public static async Task> RefreshReplicationVau /// is null. public static ArmOperation RefreshReplicationVaultHealth(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, string resourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).RefreshReplicationVaultHealth(waitUntil, resourceName, cancellationToken); + return GetMockableRecoveryServicesSiteRecoveryResourceGroupResource(resourceGroupResource).RefreshReplicationVaultHealth(waitUntil, resourceName, cancellationToken); } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 5000af15cb07e..0000000000000 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,881 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.RecoveryServicesSiteRecovery.Models; - -namespace Azure.ResourceManager.RecoveryServicesSiteRecovery -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _replicationAppliancesClientDiagnostics; - private ReplicationAppliancesRestOperations _replicationAppliancesRestClient; - private ClientDiagnostics _siteRecoveryNetworkReplicationNetworksClientDiagnostics; - private ReplicationNetworksRestOperations _siteRecoveryNetworkReplicationNetworksRestClient; - private ClientDiagnostics _siteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics; - private ReplicationNetworkMappingsRestOperations _siteRecoveryNetworkMappingReplicationNetworkMappingsRestClient; - private ClientDiagnostics _siteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics; - private ReplicationProtectionContainersRestOperations _siteRecoveryProtectionContainerReplicationProtectionContainersRestClient; - private ClientDiagnostics _siteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics; - private ReplicationMigrationItemsRestOperations _siteRecoveryMigrationItemReplicationMigrationItemsRestClient; - private ClientDiagnostics _replicationProtectedItemClientDiagnostics; - private ReplicationProtectedItemsRestOperations _replicationProtectedItemRestClient; - private ClientDiagnostics _protectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics; - private ReplicationProtectionContainerMappingsRestOperations _protectionContainerMappingReplicationProtectionContainerMappingsRestClient; - private ClientDiagnostics _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics; - private ReplicationRecoveryServicesProvidersRestOperations _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient; - private ClientDiagnostics _storageClassificationReplicationStorageClassificationsClientDiagnostics; - private ReplicationStorageClassificationsRestOperations _storageClassificationReplicationStorageClassificationsRestClient; - private ClientDiagnostics _storageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics; - private ReplicationStorageClassificationMappingsRestOperations _storageClassificationMappingReplicationStorageClassificationMappingsRestClient; - private ClientDiagnostics _siteRecoveryVCenterReplicationvCentersClientDiagnostics; - private ReplicationvCentersRestOperations _siteRecoveryVCenterReplicationvCentersRestClient; - private ClientDiagnostics _supportedOperatingSystemsClientDiagnostics; - private SupportedOperatingSystemsRestOperations _supportedOperatingSystemsRestClient; - private ClientDiagnostics _replicationVaultHealthClientDiagnostics; - private ReplicationVaultHealthRestOperations _replicationVaultHealthRestClient; - - /// 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 ClientDiagnostics ReplicationAppliancesClientDiagnostics => _replicationAppliancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReplicationAppliancesRestOperations ReplicationAppliancesRestClient => _replicationAppliancesRestClient ??= new ReplicationAppliancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SiteRecoveryNetworkReplicationNetworksClientDiagnostics => _siteRecoveryNetworkReplicationNetworksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryNetworkResource.ResourceType.Namespace, Diagnostics); - private ReplicationNetworksRestOperations SiteRecoveryNetworkReplicationNetworksRestClient => _siteRecoveryNetworkReplicationNetworksRestClient ??= new ReplicationNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryNetworkResource.ResourceType)); - private ClientDiagnostics SiteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics => _siteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryNetworkMappingResource.ResourceType.Namespace, Diagnostics); - private ReplicationNetworkMappingsRestOperations SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient => _siteRecoveryNetworkMappingReplicationNetworkMappingsRestClient ??= new ReplicationNetworkMappingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryNetworkMappingResource.ResourceType)); - private ClientDiagnostics SiteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics => _siteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryProtectionContainerResource.ResourceType.Namespace, Diagnostics); - private ReplicationProtectionContainersRestOperations SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient => _siteRecoveryProtectionContainerReplicationProtectionContainersRestClient ??= new ReplicationProtectionContainersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryProtectionContainerResource.ResourceType)); - private ClientDiagnostics SiteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics => _siteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryMigrationItemResource.ResourceType.Namespace, Diagnostics); - private ReplicationMigrationItemsRestOperations SiteRecoveryMigrationItemReplicationMigrationItemsRestClient => _siteRecoveryMigrationItemReplicationMigrationItemsRestClient ??= new ReplicationMigrationItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryMigrationItemResource.ResourceType)); - private ClientDiagnostics ReplicationProtectedItemClientDiagnostics => _replicationProtectedItemClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ReplicationProtectedItemResource.ResourceType.Namespace, Diagnostics); - private ReplicationProtectedItemsRestOperations ReplicationProtectedItemRestClient => _replicationProtectedItemRestClient ??= new ReplicationProtectedItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ReplicationProtectedItemResource.ResourceType)); - private ClientDiagnostics ProtectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics => _protectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ProtectionContainerMappingResource.ResourceType.Namespace, Diagnostics); - private ReplicationProtectionContainerMappingsRestOperations ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient => _protectionContainerMappingReplicationProtectionContainerMappingsRestClient ??= new ReplicationProtectionContainerMappingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ProtectionContainerMappingResource.ResourceType)); - private ClientDiagnostics SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics => _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryServicesProviderResource.ResourceType.Namespace, Diagnostics); - private ReplicationRecoveryServicesProvidersRestOperations SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient => _siteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient ??= new ReplicationRecoveryServicesProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryServicesProviderResource.ResourceType)); - private ClientDiagnostics StorageClassificationReplicationStorageClassificationsClientDiagnostics => _storageClassificationReplicationStorageClassificationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", StorageClassificationResource.ResourceType.Namespace, Diagnostics); - private ReplicationStorageClassificationsRestOperations StorageClassificationReplicationStorageClassificationsRestClient => _storageClassificationReplicationStorageClassificationsRestClient ??= new ReplicationStorageClassificationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageClassificationResource.ResourceType)); - private ClientDiagnostics StorageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics => _storageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", StorageClassificationMappingResource.ResourceType.Namespace, Diagnostics); - private ReplicationStorageClassificationMappingsRestOperations StorageClassificationMappingReplicationStorageClassificationMappingsRestClient => _storageClassificationMappingReplicationStorageClassificationMappingsRestClient ??= new ReplicationStorageClassificationMappingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageClassificationMappingResource.ResourceType)); - private ClientDiagnostics SiteRecoveryVCenterReplicationvCentersClientDiagnostics => _siteRecoveryVCenterReplicationvCentersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", SiteRecoveryVCenterResource.ResourceType.Namespace, Diagnostics); - private ReplicationvCentersRestOperations SiteRecoveryVCenterReplicationvCentersRestClient => _siteRecoveryVCenterReplicationvCentersRestClient ??= new ReplicationvCentersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SiteRecoveryVCenterResource.ResourceType)); - private ClientDiagnostics SupportedOperatingSystemsClientDiagnostics => _supportedOperatingSystemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SupportedOperatingSystemsRestOperations SupportedOperatingSystemsRestClient => _supportedOperatingSystemsRestClient ??= new SupportedOperatingSystemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReplicationVaultHealthClientDiagnostics => _replicationVaultHealthClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesSiteRecovery", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReplicationVaultHealthRestOperations ReplicationVaultHealthRestClient => _replicationVaultHealthRestClient ??= new ReplicationVaultHealthRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of SiteRecoveryAlertResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of SiteRecoveryAlertResources and their operations over a SiteRecoveryAlertResource. - public virtual SiteRecoveryAlertCollection GetSiteRecoveryAlerts(string resourceName) - { - return new SiteRecoveryAlertCollection(Client, Id, resourceName); - } - - /// Gets a collection of ReplicationEligibilityResultResources in the ResourceGroupResource. - /// Virtual Machine name. - /// An object representing collection of ReplicationEligibilityResultResources and their operations over a ReplicationEligibilityResultResource. - public virtual ReplicationEligibilityResultCollection GetReplicationEligibilityResults(string virtualMachineName) - { - return new ReplicationEligibilityResultCollection(Client, Id, virtualMachineName); - } - - /// Gets a collection of SiteRecoveryEventResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of SiteRecoveryEventResources and their operations over a SiteRecoveryEventResource. - public virtual SiteRecoveryEventCollection GetSiteRecoveryEvents(string resourceName) - { - return new SiteRecoveryEventCollection(Client, Id, resourceName); - } - - /// Gets a collection of SiteRecoveryFabricResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of SiteRecoveryFabricResources and their operations over a SiteRecoveryFabricResource. - public virtual SiteRecoveryFabricCollection GetSiteRecoveryFabrics(string resourceName) - { - return new SiteRecoveryFabricCollection(Client, Id, resourceName); - } - - /// Gets a collection of SiteRecoveryJobResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of SiteRecoveryJobResources and their operations over a SiteRecoveryJobResource. - public virtual SiteRecoveryJobCollection GetSiteRecoveryJobs(string resourceName) - { - return new SiteRecoveryJobCollection(Client, Id, resourceName); - } - - /// Gets a collection of SiteRecoveryPolicyResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of SiteRecoveryPolicyResources and their operations over a SiteRecoveryPolicyResource. - public virtual SiteRecoveryPolicyCollection GetSiteRecoveryPolicies(string resourceName) - { - return new SiteRecoveryPolicyCollection(Client, Id, resourceName); - } - - /// Gets a collection of ReplicationProtectionIntentResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of ReplicationProtectionIntentResources and their operations over a ReplicationProtectionIntentResource. - public virtual ReplicationProtectionIntentCollection GetReplicationProtectionIntents(string resourceName) - { - return new ReplicationProtectionIntentCollection(Client, Id, resourceName); - } - - /// Gets a collection of SiteRecoveryRecoveryPlanResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of SiteRecoveryRecoveryPlanResources and their operations over a SiteRecoveryRecoveryPlanResource. - public virtual SiteRecoveryRecoveryPlanCollection GetSiteRecoveryRecoveryPlans(string resourceName) - { - return new SiteRecoveryRecoveryPlanCollection(Client, Id, resourceName); - } - - /// Gets a collection of SiteRecoveryVaultSettingResources in the ResourceGroupResource. - /// The name of the recovery services vault. - /// An object representing collection of SiteRecoveryVaultSettingResources and their operations over a SiteRecoveryVaultSettingResource. - public virtual SiteRecoveryVaultSettingCollection GetSiteRecoveryVaultSettings(string resourceName) - { - return new SiteRecoveryVaultSettingCollection(Client, Id, resourceName); - } - - /// - /// Gets the list of Azure Site Recovery appliances for the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances - /// - /// - /// Operation Id - /// ReplicationAppliances_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetReplicationAppliancesAsync(string resourceName, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReplicationAppliancesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReplicationAppliancesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SiteRecoveryReplicationAppliance.DeserializeSiteRecoveryReplicationAppliance, ReplicationAppliancesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetReplicationAppliances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of Azure Site Recovery appliances for the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances - /// - /// - /// Operation Id - /// ReplicationAppliances_List - /// - /// - /// - /// The name of the recovery services vault. - /// OData filter options. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetReplicationAppliances(string resourceName, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReplicationAppliancesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReplicationAppliancesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SiteRecoveryReplicationAppliance.DeserializeSiteRecoveryReplicationAppliance, ReplicationAppliancesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetReplicationAppliances", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the networks available in a vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks - /// - /// - /// Operation Id - /// ReplicationNetworks_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSiteRecoveryNetworksAsync(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryNetworkReplicationNetworksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryNetworkReplicationNetworksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryNetworkResource(Client, SiteRecoveryNetworkData.DeserializeSiteRecoveryNetworkData(e)), SiteRecoveryNetworkReplicationNetworksClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the networks available in a vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks - /// - /// - /// Operation Id - /// ReplicationNetworks_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSiteRecoveryNetworks(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryNetworkReplicationNetworksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryNetworkReplicationNetworksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryNetworkResource(Client, SiteRecoveryNetworkData.DeserializeSiteRecoveryNetworkData(e)), SiteRecoveryNetworkReplicationNetworksClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryNetworks", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all ASR network mappings in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings - /// - /// - /// Operation Id - /// ReplicationNetworkMappings_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSiteRecoveryNetworkMappingsAsync(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryNetworkMappingResource(Client, SiteRecoveryNetworkMappingData.DeserializeSiteRecoveryNetworkMappingData(e)), SiteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryNetworkMappings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all ASR network mappings in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings - /// - /// - /// Operation Id - /// ReplicationNetworkMappings_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSiteRecoveryNetworkMappings(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryNetworkMappingReplicationNetworkMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryNetworkMappingResource(Client, SiteRecoveryNetworkMappingData.DeserializeSiteRecoveryNetworkMappingData(e)), SiteRecoveryNetworkMappingReplicationNetworkMappingsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryNetworkMappings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the protection containers in a vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers - /// - /// - /// Operation Id - /// ReplicationProtectionContainers_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSiteRecoveryProtectionContainersAsync(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryProtectionContainerResource(Client, SiteRecoveryProtectionContainerData.DeserializeSiteRecoveryProtectionContainerData(e)), SiteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryProtectionContainers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the protection containers in a vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers - /// - /// - /// Operation Id - /// ReplicationProtectionContainers_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSiteRecoveryProtectionContainers(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryProtectionContainerReplicationProtectionContainersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryProtectionContainerResource(Client, SiteRecoveryProtectionContainerData.DeserializeSiteRecoveryProtectionContainerData(e)), SiteRecoveryProtectionContainerReplicationProtectionContainersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryProtectionContainers", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of migration items in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems - /// - /// - /// Operation Id - /// ReplicationMigrationItems_List - /// - /// - /// - /// The name of the recovery services vault. - /// The pagination token. - /// The page size. - /// OData filter options. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSiteRecoveryMigrationItemsAsync(string resourceName, string skipToken = null, string takeToken = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryMigrationItemReplicationMigrationItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, takeToken, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryMigrationItemReplicationMigrationItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, takeToken, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryMigrationItemResource(Client, SiteRecoveryMigrationItemData.DeserializeSiteRecoveryMigrationItemData(e)), SiteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryMigrationItems", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of migration items in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems - /// - /// - /// Operation Id - /// ReplicationMigrationItems_List - /// - /// - /// - /// The name of the recovery services vault. - /// The pagination token. - /// The page size. - /// OData filter options. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSiteRecoveryMigrationItems(string resourceName, string skipToken = null, string takeToken = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryMigrationItemReplicationMigrationItemsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, takeToken, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryMigrationItemReplicationMigrationItemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, takeToken, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryMigrationItemResource(Client, SiteRecoveryMigrationItemData.DeserializeSiteRecoveryMigrationItemData(e)), SiteRecoveryMigrationItemReplicationMigrationItemsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryMigrationItems", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of ASR replication protected items in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems - /// - /// - /// Operation Id - /// ReplicationProtectedItems_List - /// - /// - /// - /// The name of the recovery services vault. - /// The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null. - /// OData filter options. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetReplicationProtectedItemsAsync(string resourceName, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReplicationProtectedItemRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReplicationProtectedItemRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ReplicationProtectedItemResource(Client, ReplicationProtectedItemData.DeserializeReplicationProtectedItemData(e)), ReplicationProtectedItemClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetReplicationProtectedItems", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of ASR replication protected items in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems - /// - /// - /// Operation Id - /// ReplicationProtectedItems_List - /// - /// - /// - /// The name of the recovery services vault. - /// The pagination token. Possible values: "FabricId" or "FabricId_CloudId" or null. - /// OData filter options. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetReplicationProtectedItems(string resourceName, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReplicationProtectedItemRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReplicationProtectedItemRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName, skipToken, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ReplicationProtectedItemResource(Client, ReplicationProtectedItemData.DeserializeReplicationProtectedItemData(e)), ReplicationProtectedItemClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetReplicationProtectedItems", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the protection container mappings in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings - /// - /// - /// Operation Id - /// ReplicationProtectionContainerMappings_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetProtectionContainerMappingsAsync(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ProtectionContainerMappingResource(Client, ProtectionContainerMappingData.DeserializeProtectionContainerMappingData(e)), ProtectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetProtectionContainerMappings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the protection container mappings in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings - /// - /// - /// Operation Id - /// ReplicationProtectionContainerMappings_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetProtectionContainerMappings(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProtectionContainerMappingReplicationProtectionContainerMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ProtectionContainerMappingResource(Client, ProtectionContainerMappingData.DeserializeProtectionContainerMappingData(e)), ProtectionContainerMappingReplicationProtectionContainerMappingsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetProtectionContainerMappings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the registered recovery services providers in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders - /// - /// - /// Operation Id - /// ReplicationRecoveryServicesProviders_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSiteRecoveryServicesProvidersAsync(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryServicesProviderResource(Client, SiteRecoveryServicesProviderData.DeserializeSiteRecoveryServicesProviderData(e)), SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryServicesProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the registered recovery services providers in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders - /// - /// - /// Operation Id - /// ReplicationRecoveryServicesProviders_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSiteRecoveryServicesProviders(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryServicesProviderResource(Client, SiteRecoveryServicesProviderData.DeserializeSiteRecoveryServicesProviderData(e)), SiteRecoveryServicesProviderReplicationRecoveryServicesProvidersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryServicesProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the storage classifications in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications - /// - /// - /// Operation Id - /// ReplicationStorageClassifications_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageClassificationsAsync(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageClassificationReplicationStorageClassificationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageClassificationReplicationStorageClassificationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageClassificationResource(Client, StorageClassificationData.DeserializeStorageClassificationData(e)), StorageClassificationReplicationStorageClassificationsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetStorageClassifications", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the storage classifications in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications - /// - /// - /// Operation Id - /// ReplicationStorageClassifications_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageClassifications(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageClassificationReplicationStorageClassificationsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageClassificationReplicationStorageClassificationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageClassificationResource(Client, StorageClassificationData.DeserializeStorageClassificationData(e)), StorageClassificationReplicationStorageClassificationsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetStorageClassifications", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the storage classification mappings in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings - /// - /// - /// Operation Id - /// ReplicationStorageClassificationMappings_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageClassificationMappingsAsync(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageClassificationMappingReplicationStorageClassificationMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageClassificationMappingReplicationStorageClassificationMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageClassificationMappingResource(Client, StorageClassificationMappingData.DeserializeStorageClassificationMappingData(e)), StorageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetStorageClassificationMappings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the storage classification mappings in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings - /// - /// - /// Operation Id - /// ReplicationStorageClassificationMappings_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageClassificationMappings(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageClassificationMappingReplicationStorageClassificationMappingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageClassificationMappingReplicationStorageClassificationMappingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageClassificationMappingResource(Client, StorageClassificationMappingData.DeserializeStorageClassificationMappingData(e)), StorageClassificationMappingReplicationStorageClassificationMappingsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetStorageClassificationMappings", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the vCenter servers registered in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters - /// - /// - /// Operation Id - /// ReplicationvCenters_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSiteRecoveryVCentersAsync(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryVCenterReplicationvCentersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryVCenterReplicationvCentersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryVCenterResource(Client, SiteRecoveryVCenterData.DeserializeSiteRecoveryVCenterData(e)), SiteRecoveryVCenterReplicationvCentersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryVCenters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the vCenter servers registered in the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters - /// - /// - /// Operation Id - /// ReplicationvCenters_List - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSiteRecoveryVCenters(string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SiteRecoveryVCenterReplicationvCentersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SiteRecoveryVCenterReplicationvCentersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, resourceName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SiteRecoveryVCenterResource(Client, SiteRecoveryVCenterData.DeserializeSiteRecoveryVCenterData(e)), SiteRecoveryVCenterReplicationvCentersClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetSiteRecoveryVCenters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the data of supported operating systems by SRS. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems - /// - /// - /// Operation Id - /// SupportedOperatingSystems_Get - /// - /// - /// - /// The name of the recovery services vault. - /// The instance type. - /// The cancellation token to use. - public virtual async Task> GetSupportedOperatingSystemAsync(string resourceName, string instanceType = null, CancellationToken cancellationToken = default) - { - using var scope = SupportedOperatingSystemsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetSupportedOperatingSystem"); - scope.Start(); - try - { - var response = await SupportedOperatingSystemsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, instanceType, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the data of supported operating systems by SRS. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems - /// - /// - /// Operation Id - /// SupportedOperatingSystems_Get - /// - /// - /// - /// The name of the recovery services vault. - /// The instance type. - /// The cancellation token to use. - public virtual Response GetSupportedOperatingSystem(string resourceName, string instanceType = null, CancellationToken cancellationToken = default) - { - using var scope = SupportedOperatingSystemsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetSupportedOperatingSystem"); - scope.Start(); - try - { - var response = SupportedOperatingSystemsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, instanceType, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the health details of the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth - /// - /// - /// Operation Id - /// ReplicationVaultHealth_Get - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - public virtual async Task> GetReplicationVaultHealthAsync(string resourceName, CancellationToken cancellationToken = default) - { - using var scope = ReplicationVaultHealthClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetReplicationVaultHealth"); - scope.Start(); - try - { - var response = await ReplicationVaultHealthRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the health details of the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth - /// - /// - /// Operation Id - /// ReplicationVaultHealth_Get - /// - /// - /// - /// The name of the recovery services vault. - /// The cancellation token to use. - public virtual Response GetReplicationVaultHealth(string resourceName, CancellationToken cancellationToken = default) - { - using var scope = ReplicationVaultHealthClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetReplicationVaultHealth"); - scope.Start(); - try - { - var response = ReplicationVaultHealthRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Refreshes health summary of the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh - /// - /// - /// Operation Id - /// ReplicationVaultHealth_Refresh - /// - /// - /// - /// 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 recovery services vault. - /// The cancellation token to use. - public virtual async Task> RefreshReplicationVaultHealthAsync(WaitUntil waitUntil, string resourceName, CancellationToken cancellationToken = default) - { - using var scope = ReplicationVaultHealthClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.RefreshReplicationVaultHealth"); - scope.Start(); - try - { - var response = await ReplicationVaultHealthRestClient.RefreshAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); - var operation = new RecoveryServicesSiteRecoveryArmOperation(new VaultHealthDetailsOperationSource(), ReplicationVaultHealthClientDiagnostics, Pipeline, ReplicationVaultHealthRestClient.CreateRefreshRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Refreshes health summary of the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh - /// - /// - /// Operation Id - /// ReplicationVaultHealth_Refresh - /// - /// - /// - /// 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 recovery services vault. - /// The cancellation token to use. - public virtual ArmOperation RefreshReplicationVaultHealth(WaitUntil waitUntil, string resourceName, CancellationToken cancellationToken = default) - { - using var scope = ReplicationVaultHealthClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.RefreshReplicationVaultHealth"); - scope.Start(); - try - { - var response = ReplicationVaultHealthRestClient.Refresh(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); - var operation = new RecoveryServicesSiteRecoveryArmOperation(new VaultHealthDetailsOperationSource(), ReplicationVaultHealthClientDiagnostics, Pipeline, ReplicationVaultHealthRestClient.CreateRefreshRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/MigrationRecoveryPointResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/MigrationRecoveryPointResource.cs index 82ec2f4d8b225..0d6e75ad3f00a 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/MigrationRecoveryPointResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/MigrationRecoveryPointResource.cs @@ -25,6 +25,13 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class MigrationRecoveryPointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The protectionContainerName. + /// The migrationItemName. + /// The migrationRecoveryPointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string protectionContainerName, string migrationItemName, string migrationRecoveryPointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ProtectionContainerMappingResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ProtectionContainerMappingResource.cs index 5be67e4be611b..ad2f047478655 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ProtectionContainerMappingResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ProtectionContainerMappingResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class ProtectionContainerMappingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The protectionContainerName. + /// The mappingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string protectionContainerName, string mappingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationEligibilityResultResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationEligibilityResultResource.cs index 8fb5b1d25a4d7..f90fd9490ed92 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationEligibilityResultResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationEligibilityResultResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class ReplicationEligibilityResultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualMachineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualMachineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemResource.cs index 47958df070778..6d3ccff16222e 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class ReplicationProtectedItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The protectionContainerName. + /// The replicatedProtectedItemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string protectionContainerName, string replicatedProtectedItemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}"; @@ -96,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteRecoveryPointResources and their operations over a SiteRecoveryPointResource. public virtual SiteRecoveryPointCollection GetSiteRecoveryPoints() { - return GetCachedClient(Client => new SiteRecoveryPointCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryPointCollection(client, Id)); } /// @@ -114,8 +120,8 @@ public virtual SiteRecoveryPointCollection GetSiteRecoveryPoints() /// /// The recovery point name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryPointAsync(string recoveryPointName, CancellationToken cancellationToken = default) { @@ -137,8 +143,8 @@ public virtual async Task> GetSiteRecoveryPo /// /// The recovery point name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryPoint(string recoveryPointName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectionIntentResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectionIntentResource.cs index 4de24e14650b8..1b037057548ab 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectionIntentResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectionIntentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class ReplicationProtectionIntentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The intentObjectName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string intentObjectName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryAlertResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryAlertResource.cs index 554feb44548cb..b58dd6eaa6ddd 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryAlertResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryAlertResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The alertSettingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string alertSettingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryEventResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryEventResource.cs index 26d0dbc2433cc..3038e84a25fa9 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryEventResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryEventResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryEventResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The eventName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string eventName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricResource.cs index 62b9d4a092592..7069dfe3e7a18 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryFabricResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteRecoveryLogicalNetworkResources and their operations over a SiteRecoveryLogicalNetworkResource. public virtual SiteRecoveryLogicalNetworkCollection GetSiteRecoveryLogicalNetworks() { - return GetCachedClient(Client => new SiteRecoveryLogicalNetworkCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryLogicalNetworkCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual SiteRecoveryLogicalNetworkCollection GetSiteRecoveryLogicalNetwor /// /// Logical network name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryLogicalNetworkAsync(string logicalNetworkName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetSiteR /// /// Logical network name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryLogicalNetwork(string logicalNetworkName, CancellationToken cancellationToken = default) { @@ -145,7 +149,7 @@ public virtual Response GetSiteRecoveryLogic /// An object representing collection of SiteRecoveryNetworkResources and their operations over a SiteRecoveryNetworkResource. public virtual SiteRecoveryNetworkCollection GetSiteRecoveryNetworks() { - return GetCachedClient(Client => new SiteRecoveryNetworkCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryNetworkCollection(client, Id)); } /// @@ -163,8 +167,8 @@ public virtual SiteRecoveryNetworkCollection GetSiteRecoveryNetworks() /// /// Primary network name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryNetworkAsync(string networkName, CancellationToken cancellationToken = default) { @@ -186,8 +190,8 @@ public virtual async Task> GetSiteRecovery /// /// Primary network name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryNetwork(string networkName, CancellationToken cancellationToken = default) { @@ -198,7 +202,7 @@ public virtual Response GetSiteRecoveryNetwork(stri /// An object representing collection of SiteRecoveryProtectionContainerResources and their operations over a SiteRecoveryProtectionContainerResource. public virtual SiteRecoveryProtectionContainerCollection GetSiteRecoveryProtectionContainers() { - return GetCachedClient(Client => new SiteRecoveryProtectionContainerCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryProtectionContainerCollection(client, Id)); } /// @@ -216,8 +220,8 @@ public virtual SiteRecoveryProtectionContainerCollection GetSiteRecoveryProtecti /// /// Protection container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryProtectionContainerAsync(string protectionContainerName, CancellationToken cancellationToken = default) { @@ -239,8 +243,8 @@ public virtual async Task> Get /// /// Protection container name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryProtectionContainer(string protectionContainerName, CancellationToken cancellationToken = default) { @@ -251,7 +255,7 @@ public virtual Response GetSiteRecovery /// An object representing collection of SiteRecoveryServicesProviderResources and their operations over a SiteRecoveryServicesProviderResource. public virtual SiteRecoveryServicesProviderCollection GetSiteRecoveryServicesProviders() { - return GetCachedClient(Client => new SiteRecoveryServicesProviderCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryServicesProviderCollection(client, Id)); } /// @@ -269,8 +273,8 @@ public virtual SiteRecoveryServicesProviderCollection GetSiteRecoveryServicesPro /// /// Recovery services provider name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryServicesProviderAsync(string providerName, CancellationToken cancellationToken = default) { @@ -292,8 +296,8 @@ public virtual async Task> GetSit /// /// Recovery services provider name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryServicesProvider(string providerName, CancellationToken cancellationToken = default) { @@ -304,7 +308,7 @@ public virtual Response GetSiteRecoverySer /// An object representing collection of StorageClassificationResources and their operations over a StorageClassificationResource. public virtual StorageClassificationCollection GetStorageClassifications() { - return GetCachedClient(Client => new StorageClassificationCollection(Client, Id)); + return GetCachedClient(client => new StorageClassificationCollection(client, Id)); } /// @@ -322,8 +326,8 @@ public virtual StorageClassificationCollection GetStorageClassifications() /// /// Storage classification name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageClassificationAsync(string storageClassificationName, CancellationToken cancellationToken = default) { @@ -345,8 +349,8 @@ public virtual async Task> GetStorageCla /// /// Storage classification name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageClassification(string storageClassificationName, CancellationToken cancellationToken = default) { @@ -357,7 +361,7 @@ public virtual Response GetStorageClassification( /// An object representing collection of SiteRecoveryVCenterResources and their operations over a SiteRecoveryVCenterResource. public virtual SiteRecoveryVCenterCollection GetSiteRecoveryVCenters() { - return GetCachedClient(Client => new SiteRecoveryVCenterCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryVCenterCollection(client, Id)); } /// @@ -375,8 +379,8 @@ public virtual SiteRecoveryVCenterCollection GetSiteRecoveryVCenters() /// /// vcenter name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryVCenterAsync(string vCenterName, CancellationToken cancellationToken = default) { @@ -398,8 +402,8 @@ public virtual async Task> GetSiteRecovery /// /// vcenter name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryVCenter(string vCenterName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryJobResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryJobResource.cs index 463e4d689603a..07f67e0f0c7af 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryJobResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryJobResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryLogicalNetworkResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryLogicalNetworkResource.cs index c425ac16b4893..60a998bfcc953 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryLogicalNetworkResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryLogicalNetworkResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryLogicalNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The logicalNetworkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string logicalNetworkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemResource.cs index 5f13df3db945b..2b989f5f4a93b 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryMigrationItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The protectionContainerName. + /// The migrationItemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string protectionContainerName, string migrationItemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}"; @@ -91,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MigrationRecoveryPointResources and their operations over a MigrationRecoveryPointResource. public virtual MigrationRecoveryPointCollection GetMigrationRecoveryPoints() { - return GetCachedClient(Client => new MigrationRecoveryPointCollection(Client, Id)); + return GetCachedClient(client => new MigrationRecoveryPointCollection(client, Id)); } /// @@ -109,8 +115,8 @@ public virtual MigrationRecoveryPointCollection GetMigrationRecoveryPoints() /// /// The migration recovery point name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMigrationRecoveryPointAsync(string migrationRecoveryPointName, CancellationToken cancellationToken = default) { @@ -132,8 +138,8 @@ public virtual async Task> GetMigration /// /// The migration recovery point name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMigrationRecoveryPoint(string migrationRecoveryPointName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkMappingResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkMappingResource.cs index bca5c280a55b3..75c8d7d62ced6 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkMappingResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkMappingResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryNetworkMappingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The networkName. + /// The networkMappingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string networkName, string networkMappingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkResource.cs index 2aaa14926e437..800c5d98cebf8 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryNetworkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The networkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string networkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteRecoveryNetworkMappingResources and their operations over a SiteRecoveryNetworkMappingResource. public virtual SiteRecoveryNetworkMappingCollection GetSiteRecoveryNetworkMappings() { - return GetCachedClient(Client => new SiteRecoveryNetworkMappingCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryNetworkMappingCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual SiteRecoveryNetworkMappingCollection GetSiteRecoveryNetworkMappin /// /// Network mapping name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryNetworkMappingAsync(string networkMappingName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetSiteR /// /// Network mapping name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryNetworkMapping(string networkMappingName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPointResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPointResource.cs index d80b814113e6c..c68777185d70f 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPointResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPointResource.cs @@ -25,6 +25,13 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryPointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The protectionContainerName. + /// The replicatedProtectedItemName. + /// The recoveryPointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string protectionContainerName, string replicatedProtectedItemName, string recoveryPointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPolicyResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPolicyResource.cs index de8c1154c57f2..76a7f52a3db1e 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPolicyResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryPolicyResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectableItemResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectableItemResource.cs index 6053c905d6b87..5f42bc6b04d82 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectableItemResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectableItemResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryProtectableItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The protectionContainerName. + /// The protectableItemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string protectionContainerName, string protectableItemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerResource.cs index e3e85f79ed020..433981071932e 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryProtectionContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The protectionContainerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string protectionContainerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteRecoveryMigrationItemResources and their operations over a SiteRecoveryMigrationItemResource. public virtual SiteRecoveryMigrationItemCollection GetSiteRecoveryMigrationItems() { - return GetCachedClient(Client => new SiteRecoveryMigrationItemCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryMigrationItemCollection(client, Id)); } /// @@ -109,8 +114,8 @@ public virtual SiteRecoveryMigrationItemCollection GetSiteRecoveryMigrationItems /// /// Migration item name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryMigrationItemAsync(string migrationItemName, CancellationToken cancellationToken = default) { @@ -132,8 +137,8 @@ public virtual async Task> GetSiteRe /// /// Migration item name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryMigrationItem(string migrationItemName, CancellationToken cancellationToken = default) { @@ -144,7 +149,7 @@ public virtual Response GetSiteRecoveryMigrat /// An object representing collection of SiteRecoveryProtectableItemResources and their operations over a SiteRecoveryProtectableItemResource. public virtual SiteRecoveryProtectableItemCollection GetSiteRecoveryProtectableItems() { - return GetCachedClient(Client => new SiteRecoveryProtectableItemCollection(Client, Id)); + return GetCachedClient(client => new SiteRecoveryProtectableItemCollection(client, Id)); } /// @@ -162,8 +167,8 @@ public virtual SiteRecoveryProtectableItemCollection GetSiteRecoveryProtectableI /// /// Protectable item name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecoveryProtectableItemAsync(string protectableItemName, CancellationToken cancellationToken = default) { @@ -185,8 +190,8 @@ public virtual async Task> GetSite /// /// Protectable item name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecoveryProtectableItem(string protectableItemName, CancellationToken cancellationToken = default) { @@ -197,7 +202,7 @@ public virtual Response GetSiteRecoveryProt /// An object representing collection of ReplicationProtectedItemResources and their operations over a ReplicationProtectedItemResource. public virtual ReplicationProtectedItemCollection GetReplicationProtectedItems() { - return GetCachedClient(Client => new ReplicationProtectedItemCollection(Client, Id)); + return GetCachedClient(client => new ReplicationProtectedItemCollection(client, Id)); } /// @@ -215,8 +220,8 @@ public virtual ReplicationProtectedItemCollection GetReplicationProtectedItems() /// /// Replication protected item name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetReplicationProtectedItemAsync(string replicatedProtectedItemName, CancellationToken cancellationToken = default) { @@ -238,8 +243,8 @@ public virtual async Task> GetReplica /// /// Replication protected item name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetReplicationProtectedItem(string replicatedProtectedItemName, CancellationToken cancellationToken = default) { @@ -250,7 +255,7 @@ public virtual Response GetReplicationProtecte /// An object representing collection of ProtectionContainerMappingResources and their operations over a ProtectionContainerMappingResource. public virtual ProtectionContainerMappingCollection GetProtectionContainerMappings() { - return GetCachedClient(Client => new ProtectionContainerMappingCollection(Client, Id)); + return GetCachedClient(client => new ProtectionContainerMappingCollection(client, Id)); } /// @@ -268,8 +273,8 @@ public virtual ProtectionContainerMappingCollection GetProtectionContainerMappin /// /// Protection Container mapping name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProtectionContainerMappingAsync(string mappingName, CancellationToken cancellationToken = default) { @@ -291,8 +296,8 @@ public virtual async Task> GetProte /// /// Protection Container mapping name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProtectionContainerMapping(string mappingName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryRecoveryPlanResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryRecoveryPlanResource.cs index 73d8911b77020..3a5c4d25083a8 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryRecoveryPlanResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryRecoveryPlanResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryRecoveryPlanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The recoveryPlanName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string recoveryPlanName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryServicesProviderResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryServicesProviderResource.cs index 1e6beeceffe80..6ec3ac98cec5d 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryServicesProviderResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryServicesProviderResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryServicesProviderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The providerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string providerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVCenterResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVCenterResource.cs index 377c3638be1ae..b184faa25d541 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVCenterResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVCenterResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryVCenterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The vCenterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string vCenterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vCenterName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVaultSettingResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVaultSettingResource.cs index 3f1788ec9e8f0..e78870d0cb241 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVaultSettingResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryVaultSettingResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class SiteRecoveryVaultSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The vaultSettingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string vaultSettingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationMappingResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationMappingResource.cs index 0f628a32333cf..aee0dc601626a 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationMappingResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationMappingResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class StorageClassificationMappingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The storageClassificationName. + /// The storageClassificationMappingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string storageClassificationName, string storageClassificationMappingName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}"; diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationResource.cs index 80d873fb0493b..50d815ca67387 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery public partial class StorageClassificationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The fabricName. + /// The storageClassificationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string fabricName, string storageClassificationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StorageClassificationMappingResources and their operations over a StorageClassificationMappingResource. public virtual StorageClassificationMappingCollection GetStorageClassificationMappings() { - return GetCachedClient(Client => new StorageClassificationMappingCollection(Client, Id)); + return GetCachedClient(client => new StorageClassificationMappingCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual StorageClassificationMappingCollection GetStorageClassificationMa /// /// Storage classification mapping name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageClassificationMappingAsync(string storageClassificationMappingName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetSto /// /// Storage classification mapping name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageClassificationMapping(string storageClassificationMappingName, CancellationToken cancellationToken = default) { diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.netstandard2.0.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.netstandard2.0.cs index d8fbf100c9f20..111c0526f7f76 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.netstandard2.0.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.netstandard2.0.cs @@ -66,7 +66,7 @@ protected RecoveryServicesVaultCollection() { } } public partial class RecoveryServicesVaultData : Azure.ResourceManager.Models.TrackedResourceData { - public RecoveryServicesVaultData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public RecoveryServicesVaultData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServices.Models.RecoveryServicesVaultProperties Properties { get { throw null; } set { } } @@ -128,6 +128,33 @@ protected RecoveryServicesVaultResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServices.Models.RecoveryServicesVaultPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.RecoveryServices.Mocking +{ + public partial class MockableRecoveryServicesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesArmClient() { } + public virtual Azure.ResourceManager.RecoveryServices.RecoveryServicesPrivateLinkResource GetRecoveryServicesPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServices.RecoveryServicesVaultExtendedInfoResource GetRecoveryServicesVaultExtendedInfoResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RecoveryServices.RecoveryServicesVaultResource GetRecoveryServicesVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableRecoveryServicesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesResourceGroupResource() { } + public virtual Azure.Response CheckRecoveryServicesNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServices.Models.RecoveryServicesNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckRecoveryServicesNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServices.Models.RecoveryServicesNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRecoveryServicesVault(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRecoveryServicesVaultAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServices.RecoveryServicesVaultCollection GetRecoveryServicesVaults() { throw null; } + } + public partial class MockableRecoveryServicesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableRecoveryServicesSubscriptionResource() { } + public virtual Azure.Response GetRecoveryServiceCapabilities(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServices.Models.ResourceCapabilities input, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRecoveryServiceCapabilitiesAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServices.Models.ResourceCapabilities input, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRecoveryServicesVaults(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRecoveryServicesVaultsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.RecoveryServices.Models { public static partial class ArmRecoveryServicesModelFactory @@ -474,7 +501,7 @@ public RecoveryServicesSoftDeleteSettings() { } } public partial class RecoveryServicesVaultPatch : Azure.ResourceManager.Models.TrackedResourceData { - public RecoveryServicesVaultPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public RecoveryServicesVaultPatch(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.RecoveryServices.Models.RecoveryServicesVaultProperties Properties { get { throw null; } set { } } diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesArmClient.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesArmClient.cs new file mode 100644 index 0000000000000..318fc1bac17a9 --- /dev/null +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServices; + +namespace Azure.ResourceManager.RecoveryServices.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableRecoveryServicesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesArmClient() + { + } + + /// 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 MockableRecoveryServicesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableRecoveryServicesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RecoveryServicesPrivateLinkResource GetRecoveryServicesPrivateLinkResource(ResourceIdentifier id) + { + RecoveryServicesPrivateLinkResource.ValidateResourceId(id); + return new RecoveryServicesPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RecoveryServicesVaultResource GetRecoveryServicesVaultResource(ResourceIdentifier id) + { + RecoveryServicesVaultResource.ValidateResourceId(id); + return new RecoveryServicesVaultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RecoveryServicesVaultExtendedInfoResource GetRecoveryServicesVaultExtendedInfoResource(ResourceIdentifier id) + { + RecoveryServicesVaultExtendedInfoResource.ValidateResourceId(id); + return new RecoveryServicesVaultExtendedInfoResource(Client, id); + } + } +} diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesResourceGroupResource.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesResourceGroupResource.cs new file mode 100644 index 0000000000000..a977bc529e01f --- /dev/null +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesResourceGroupResource.cs @@ -0,0 +1,174 @@ +// 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; +using Azure.ResourceManager.RecoveryServices; +using Azure.ResourceManager.RecoveryServices.Models; + +namespace Azure.ResourceManager.RecoveryServices.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableRecoveryServicesResourceGroupResource : ArmResource + { + private ClientDiagnostics _recoveryServicesClientDiagnostics; + private RecoveryServicesRestOperations _recoveryServicesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesResourceGroupResource() + { + } + + /// 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 MockableRecoveryServicesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics RecoveryServicesClientDiagnostics => _recoveryServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private RecoveryServicesRestOperations RecoveryServicesRestClient => _recoveryServicesRestClient ??= new RecoveryServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of RecoveryServicesVaultResources in the ResourceGroupResource. + /// An object representing collection of RecoveryServicesVaultResources and their operations over a RecoveryServicesVaultResource. + public virtual RecoveryServicesVaultCollection GetRecoveryServicesVaults() + { + return GetCachedClient(client => new RecoveryServicesVaultCollection(client, Id)); + } + + /// + /// Get the Vault details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRecoveryServicesVaultAsync(string vaultName, CancellationToken cancellationToken = default) + { + return await GetRecoveryServicesVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the Vault details. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName} + /// + /// + /// Operation Id + /// Vaults_Get + /// + /// + /// + /// The name of the recovery services vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRecoveryServicesVault(string vaultName, CancellationToken cancellationToken = default) + { + return GetRecoveryServicesVaults().Get(vaultName, cancellationToken); + } + + /// + /// API to check for resource name availability. + /// A name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type + /// or if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// RecoveryServices_CheckNameAvailability + /// + /// + /// + /// Location of the resource. + /// Contains information about Resource type and Resource name. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckRecoveryServicesNameAvailabilityAsync(AzureLocation location, RecoveryServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = RecoveryServicesClientDiagnostics.CreateScope("MockableRecoveryServicesResourceGroupResource.CheckRecoveryServicesNameAvailability"); + scope.Start(); + try + { + var response = await RecoveryServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// API to check for resource name availability. + /// A name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type + /// or if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// RecoveryServices_CheckNameAvailability + /// + /// + /// + /// Location of the resource. + /// Contains information about Resource type and Resource name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckRecoveryServicesNameAvailability(AzureLocation location, RecoveryServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = RecoveryServicesClientDiagnostics.CreateScope("MockableRecoveryServicesResourceGroupResource.CheckRecoveryServicesNameAvailability"); + scope.Start(); + try + { + var response = RecoveryServicesRestClient.CheckNameAvailability(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesSubscriptionResource.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesSubscriptionResource.cs new file mode 100644 index 0000000000000..5a78458f43008 --- /dev/null +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesSubscriptionResource.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServices; +using Azure.ResourceManager.RecoveryServices.Models; + +namespace Azure.ResourceManager.RecoveryServices.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableRecoveryServicesSubscriptionResource : ArmResource + { + private ClientDiagnostics _recoveryServicesClientDiagnostics; + private RecoveryServicesRestOperations _recoveryServicesRestClient; + private ClientDiagnostics _recoveryServicesVaultVaultsClientDiagnostics; + private VaultsRestOperations _recoveryServicesVaultVaultsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRecoveryServicesSubscriptionResource() + { + } + + /// 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 MockableRecoveryServicesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics RecoveryServicesClientDiagnostics => _recoveryServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private RecoveryServicesRestOperations RecoveryServicesRestClient => _recoveryServicesRestClient ??= new RecoveryServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics RecoveryServicesVaultVaultsClientDiagnostics => _recoveryServicesVaultVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServices", RecoveryServicesVaultResource.ResourceType.Namespace, Diagnostics); + private VaultsRestOperations RecoveryServicesVaultVaultsRestClient => _recoveryServicesVaultVaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RecoveryServicesVaultResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// API to get details about capabilities provided by Microsoft.RecoveryServices RP + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{location}/capabilities + /// + /// + /// Operation Id + /// RecoveryServices_Capabilities + /// + /// + /// + /// Location of the resource. + /// Contains information about Resource type and properties to get capabilities. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetRecoveryServiceCapabilitiesAsync(AzureLocation location, ResourceCapabilities input, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(input, nameof(input)); + + using var scope = RecoveryServicesClientDiagnostics.CreateScope("MockableRecoveryServicesSubscriptionResource.GetRecoveryServiceCapabilities"); + scope.Start(); + try + { + var response = await RecoveryServicesRestClient.CapabilitiesAsync(Id.SubscriptionId, location, input, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// API to get details about capabilities provided by Microsoft.RecoveryServices RP + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{location}/capabilities + /// + /// + /// Operation Id + /// RecoveryServices_Capabilities + /// + /// + /// + /// Location of the resource. + /// Contains information about Resource type and properties to get capabilities. + /// The cancellation token to use. + /// is null. + public virtual Response GetRecoveryServiceCapabilities(AzureLocation location, ResourceCapabilities input, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(input, nameof(input)); + + using var scope = RecoveryServicesClientDiagnostics.CreateScope("MockableRecoveryServicesSubscriptionResource.GetRecoveryServiceCapabilities"); + scope.Start(); + try + { + var response = RecoveryServicesRestClient.Capabilities(Id.SubscriptionId, location, input, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Fetches all the resources of the specified type in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults + /// + /// + /// Operation Id + /// Vaults_ListBySubscriptionId + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRecoveryServicesVaultsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RecoveryServicesVaultVaultsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RecoveryServicesVaultVaultsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RecoveryServicesVaultResource(Client, RecoveryServicesVaultData.DeserializeRecoveryServicesVaultData(e)), RecoveryServicesVaultVaultsClientDiagnostics, Pipeline, "MockableRecoveryServicesSubscriptionResource.GetRecoveryServicesVaults", "value", "nextLink", cancellationToken); + } + + /// + /// Fetches all the resources of the specified type in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults + /// + /// + /// Operation Id + /// Vaults_ListBySubscriptionId + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRecoveryServicesVaults(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RecoveryServicesVaultVaultsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RecoveryServicesVaultVaultsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RecoveryServicesVaultResource(Client, RecoveryServicesVaultData.DeserializeRecoveryServicesVaultData(e)), RecoveryServicesVaultVaultsClientDiagnostics, Pipeline, "MockableRecoveryServicesSubscriptionResource.GetRecoveryServicesVaults", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/RecoveryServicesExtensions.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/RecoveryServicesExtensions.cs index b3ffcb49e641b..09d189e6c5b98 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/RecoveryServicesExtensions.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/RecoveryServicesExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServices.Mocking; using Azure.ResourceManager.RecoveryServices.Models; using Azure.ResourceManager.Resources; @@ -19,100 +20,81 @@ namespace Azure.ResourceManager.RecoveryServices /// A class to add extension methods to Azure.ResourceManager.RecoveryServices. public static partial class RecoveryServicesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableRecoveryServicesArmClient GetMockableRecoveryServicesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableRecoveryServicesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableRecoveryServicesResourceGroupResource GetMockableRecoveryServicesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableRecoveryServicesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableRecoveryServicesSubscriptionResource GetMockableRecoveryServicesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableRecoveryServicesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region RecoveryServicesPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RecoveryServicesPrivateLinkResource GetRecoveryServicesPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RecoveryServicesPrivateLinkResource.ValidateResourceId(id); - return new RecoveryServicesPrivateLinkResource(client, id); - } - ); + return GetMockableRecoveryServicesArmClient(client).GetRecoveryServicesPrivateLinkResource(id); } - #endregion - #region RecoveryServicesVaultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RecoveryServicesVaultResource GetRecoveryServicesVaultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RecoveryServicesVaultResource.ValidateResourceId(id); - return new RecoveryServicesVaultResource(client, id); - } - ); + return GetMockableRecoveryServicesArmClient(client).GetRecoveryServicesVaultResource(id); } - #endregion - #region RecoveryServicesVaultExtendedInfoResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RecoveryServicesVaultExtendedInfoResource GetRecoveryServicesVaultExtendedInfoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RecoveryServicesVaultExtendedInfoResource.ValidateResourceId(id); - return new RecoveryServicesVaultExtendedInfoResource(client, id); - } - ); + return GetMockableRecoveryServicesArmClient(client).GetRecoveryServicesVaultExtendedInfoResource(id); } - #endregion - /// Gets a collection of RecoveryServicesVaultResources in the ResourceGroupResource. + /// + /// Gets a collection of RecoveryServicesVaultResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RecoveryServicesVaultResources and their operations over a RecoveryServicesVaultResource. public static RecoveryServicesVaultCollection GetRecoveryServicesVaults(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRecoveryServicesVaults(); + return GetMockableRecoveryServicesResourceGroupResource(resourceGroupResource).GetRecoveryServicesVaults(); } /// @@ -127,16 +109,20 @@ public static RecoveryServicesVaultCollection GetRecoveryServicesVaults(this Res /// Vaults_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRecoveryServicesVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetRecoveryServicesVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesResourceGroupResource(resourceGroupResource).GetRecoveryServicesVaultAsync(vaultName, cancellationToken).ConfigureAwait(false); } /// @@ -151,16 +137,20 @@ public static async Task> GetRecoverySer /// Vaults_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the recovery services vault. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRecoveryServicesVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetRecoveryServicesVaults().Get(vaultName, cancellationToken); + return GetMockableRecoveryServicesResourceGroupResource(resourceGroupResource).GetRecoveryServicesVault(vaultName, cancellationToken); } /// @@ -177,6 +167,10 @@ public static Response GetRecoveryServicesVault(t /// RecoveryServices_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the resource. @@ -185,9 +179,7 @@ public static Response GetRecoveryServicesVault(t /// is null. public static async Task> CheckRecoveryServicesNameAvailabilityAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, RecoveryServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckRecoveryServicesNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesResourceGroupResource(resourceGroupResource).CheckRecoveryServicesNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -204,6 +196,10 @@ public static async Task> Check /// RecoveryServices_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the resource. @@ -212,9 +208,7 @@ public static async Task> Check /// is null. public static Response CheckRecoveryServicesNameAvailability(this ResourceGroupResource resourceGroupResource, AzureLocation location, RecoveryServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CheckRecoveryServicesNameAvailability(location, content, cancellationToken); + return GetMockableRecoveryServicesResourceGroupResource(resourceGroupResource).CheckRecoveryServicesNameAvailability(location, content, cancellationToken); } /// @@ -229,6 +223,10 @@ public static Response CheckRecoveryServ /// RecoveryServices_Capabilities /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the resource. @@ -237,9 +235,7 @@ public static Response CheckRecoveryServ /// is null. public static async Task> GetRecoveryServiceCapabilitiesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, ResourceCapabilities input, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(input, nameof(input)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetRecoveryServiceCapabilitiesAsync(location, input, cancellationToken).ConfigureAwait(false); + return await GetMockableRecoveryServicesSubscriptionResource(subscriptionResource).GetRecoveryServiceCapabilitiesAsync(location, input, cancellationToken).ConfigureAwait(false); } /// @@ -254,6 +250,10 @@ public static async Task> GetRecoveryServiceCapabil /// RecoveryServices_Capabilities /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location of the resource. @@ -262,9 +262,7 @@ public static async Task> GetRecoveryServiceCapabil /// is null. public static Response GetRecoveryServiceCapabilities(this SubscriptionResource subscriptionResource, AzureLocation location, ResourceCapabilities input, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(input, nameof(input)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRecoveryServiceCapabilities(location, input, cancellationToken); + return GetMockableRecoveryServicesSubscriptionResource(subscriptionResource).GetRecoveryServiceCapabilities(location, input, cancellationToken); } /// @@ -279,13 +277,17 @@ public static Response GetRecoveryServiceCapabilities(this S /// Vaults_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRecoveryServicesVaultsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRecoveryServicesVaultsAsync(cancellationToken); + return GetMockableRecoveryServicesSubscriptionResource(subscriptionResource).GetRecoveryServicesVaultsAsync(cancellationToken); } /// @@ -300,13 +302,17 @@ public static AsyncPageable GetRecoveryServicesVa /// Vaults_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRecoveryServicesVaults(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRecoveryServicesVaults(cancellationToken); + return GetMockableRecoveryServicesSubscriptionResource(subscriptionResource).GetRecoveryServicesVaults(cancellationToken); } } } diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 7dddcc16c0cbc..0000000000000 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,121 +0,0 @@ -// 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; -using Azure.ResourceManager.RecoveryServices.Models; - -namespace Azure.ResourceManager.RecoveryServices -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _recoveryServicesClientDiagnostics; - private RecoveryServicesRestOperations _recoveryServicesRestClient; - - /// 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 ClientDiagnostics RecoveryServicesClientDiagnostics => _recoveryServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private RecoveryServicesRestOperations RecoveryServicesRestClient => _recoveryServicesRestClient ??= new RecoveryServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of RecoveryServicesVaultResources in the ResourceGroupResource. - /// An object representing collection of RecoveryServicesVaultResources and their operations over a RecoveryServicesVaultResource. - public virtual RecoveryServicesVaultCollection GetRecoveryServicesVaults() - { - return GetCachedClient(Client => new RecoveryServicesVaultCollection(Client, Id)); - } - - /// - /// API to check for resource name availability. - /// A name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type - /// or if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// RecoveryServices_CheckNameAvailability - /// - /// - /// - /// Location of the resource. - /// Contains information about Resource type and Resource name. - /// The cancellation token to use. - public virtual async Task> CheckRecoveryServicesNameAvailabilityAsync(AzureLocation location, RecoveryServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = RecoveryServicesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckRecoveryServicesNameAvailability"); - scope.Start(); - try - { - var response = await RecoveryServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// API to check for resource name availability. - /// A name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type - /// or if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// RecoveryServices_CheckNameAvailability - /// - /// - /// - /// Location of the resource. - /// Contains information about Resource type and Resource name. - /// The cancellation token to use. - public virtual Response CheckRecoveryServicesNameAvailability(AzureLocation location, RecoveryServicesNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = RecoveryServicesClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CheckRecoveryServicesNameAvailability"); - scope.Start(); - try - { - var response = RecoveryServicesRestClient.CheckNameAvailability(Id.SubscriptionId, Id.ResourceGroupName, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 372b1e8087461..0000000000000 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.RecoveryServices.Models; - -namespace Azure.ResourceManager.RecoveryServices -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _recoveryServicesClientDiagnostics; - private RecoveryServicesRestOperations _recoveryServicesRestClient; - private ClientDiagnostics _recoveryServicesVaultVaultsClientDiagnostics; - private VaultsRestOperations _recoveryServicesVaultVaultsRestClient; - - /// 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 RecoveryServicesClientDiagnostics => _recoveryServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private RecoveryServicesRestOperations RecoveryServicesRestClient => _recoveryServicesRestClient ??= new RecoveryServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics RecoveryServicesVaultVaultsClientDiagnostics => _recoveryServicesVaultVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServices", RecoveryServicesVaultResource.ResourceType.Namespace, Diagnostics); - private VaultsRestOperations RecoveryServicesVaultVaultsRestClient => _recoveryServicesVaultVaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RecoveryServicesVaultResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// API to get details about capabilities provided by Microsoft.RecoveryServices RP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{location}/capabilities - /// - /// - /// Operation Id - /// RecoveryServices_Capabilities - /// - /// - /// - /// Location of the resource. - /// Contains information about Resource type and properties to get capabilities. - /// The cancellation token to use. - public virtual async Task> GetRecoveryServiceCapabilitiesAsync(AzureLocation location, ResourceCapabilities input, CancellationToken cancellationToken = default) - { - using var scope = RecoveryServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRecoveryServiceCapabilities"); - scope.Start(); - try - { - var response = await RecoveryServicesRestClient.CapabilitiesAsync(Id.SubscriptionId, location, input, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// API to get details about capabilities provided by Microsoft.RecoveryServices RP - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{location}/capabilities - /// - /// - /// Operation Id - /// RecoveryServices_Capabilities - /// - /// - /// - /// Location of the resource. - /// Contains information about Resource type and properties to get capabilities. - /// The cancellation token to use. - public virtual Response GetRecoveryServiceCapabilities(AzureLocation location, ResourceCapabilities input, CancellationToken cancellationToken = default) - { - using var scope = RecoveryServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRecoveryServiceCapabilities"); - scope.Start(); - try - { - var response = RecoveryServicesRestClient.Capabilities(Id.SubscriptionId, location, input, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Fetches all the resources of the specified type in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults - /// - /// - /// Operation Id - /// Vaults_ListBySubscriptionId - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRecoveryServicesVaultsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RecoveryServicesVaultVaultsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RecoveryServicesVaultVaultsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RecoveryServicesVaultResource(Client, RecoveryServicesVaultData.DeserializeRecoveryServicesVaultData(e)), RecoveryServicesVaultVaultsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRecoveryServicesVaults", "value", "nextLink", cancellationToken); - } - - /// - /// Fetches all the resources of the specified type in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults - /// - /// - /// Operation Id - /// Vaults_ListBySubscriptionId - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRecoveryServicesVaults(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RecoveryServicesVaultVaultsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RecoveryServicesVaultVaultsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RecoveryServicesVaultResource(Client, RecoveryServicesVaultData.DeserializeRecoveryServicesVaultData(e)), RecoveryServicesVaultVaultsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRecoveryServicesVaults", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesPrivateLinkResource.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesPrivateLinkResource.cs index 5fb099c762725..d86b40c1db8b4 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesPrivateLinkResource.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.RecoveryServices public partial class RecoveryServicesPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultExtendedInfoResource.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultExtendedInfoResource.cs index a426576b01f45..c62db64797b19 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultExtendedInfoResource.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultExtendedInfoResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.RecoveryServices public partial class RecoveryServicesVaultExtendedInfoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo"; diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultResource.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultResource.cs index 6428d561d3fb5..fbd7bccde0f16 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultResource.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.RecoveryServices public partial class RecoveryServicesVaultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}"; @@ -110,7 +113,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RecoveryServicesPrivateLinkResources and their operations over a RecoveryServicesPrivateLinkResource. public virtual RecoveryServicesPrivateLinkResourceCollection GetRecoveryServicesPrivateLinkResources() { - return GetCachedClient(Client => new RecoveryServicesPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new RecoveryServicesPrivateLinkResourceCollection(client, Id)); } /// @@ -128,8 +131,8 @@ public virtual RecoveryServicesPrivateLinkResourceCollection GetRecoveryServices /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRecoveryServicesPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -151,8 +154,8 @@ public virtual async Task> GetReco /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRecoveryServicesPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.netstandard2.0.cs b/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.netstandard2.0.cs index 614e6814ba38d..6eb8fbb3ce9d9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.netstandard2.0.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.netstandard2.0.cs @@ -19,7 +19,7 @@ protected RedisCollection() { } } public partial class RedisData : Azure.ResourceManager.Models.TrackedResourceData { - public RedisData(Azure.Core.AzureLocation location, Azure.ResourceManager.Redis.Models.RedisSku sku) : base (default(Azure.Core.AzureLocation)) { } + public RedisData(Azure.Core.AzureLocation location, Azure.ResourceManager.Redis.Models.RedisSku sku) { } public Azure.ResourceManager.Redis.Models.RedisAccessKeys AccessKeys { get { throw null; } } public bool? EnableNonSslPort { get { throw null; } set { } } public string HostName { get { throw null; } } @@ -266,6 +266,35 @@ protected RedisResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Redis.Mocking +{ + public partial class MockableRedisArmClient : Azure.ResourceManager.ArmResource + { + protected MockableRedisArmClient() { } + public virtual Azure.ResourceManager.Redis.RedisFirewallRuleResource GetRedisFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyResource GetRedisLinkedServerWithPropertyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Redis.RedisPatchScheduleResource GetRedisPatchScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Redis.RedisPrivateEndpointConnectionResource GetRedisPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Redis.RedisResource GetRedisResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableRedisResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableRedisResourceGroupResource() { } + public virtual Azure.ResourceManager.Redis.RedisCollection GetAllRedis() { throw null; } + public virtual Azure.Response GetRedis(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRedisAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableRedisSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableRedisSubscriptionResource() { } + public virtual Azure.Response CheckRedisNameAvailability(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckRedisNameAvailabilityAsync(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllRedis(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllRedisAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAsyncOperationStatus(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsyncOperationStatusAsync(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Redis.Models { public static partial class ArmRedisModelFactory diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisArmClient.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisArmClient.cs new file mode 100644 index 0000000000000..31acdfda6d58c --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableRedisArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRedisArmClient() + { + } + + /// 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 MockableRedisArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableRedisArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisResource GetRedisResource(ResourceIdentifier id) + { + RedisResource.ValidateResourceId(id); + return new RedisResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisFirewallRuleResource GetRedisFirewallRuleResource(ResourceIdentifier id) + { + RedisFirewallRuleResource.ValidateResourceId(id); + return new RedisFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisPatchScheduleResource GetRedisPatchScheduleResource(ResourceIdentifier id) + { + RedisPatchScheduleResource.ValidateResourceId(id); + return new RedisPatchScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisLinkedServerWithPropertyResource GetRedisLinkedServerWithPropertyResource(ResourceIdentifier id) + { + RedisLinkedServerWithPropertyResource.ValidateResourceId(id); + return new RedisLinkedServerWithPropertyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisPrivateEndpointConnectionResource GetRedisPrivateEndpointConnectionResource(ResourceIdentifier id) + { + RedisPrivateEndpointConnectionResource.ValidateResourceId(id); + return new RedisPrivateEndpointConnectionResource(Client, id); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs new file mode 100644 index 0000000000000..073353359a082 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Redis; + +namespace Azure.ResourceManager.Redis.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableRedisResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRedisResourceGroupResource() + { + } + + /// 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 MockableRedisResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of RedisResources in the ResourceGroupResource. + /// An object representing collection of RedisResources and their operations over a RedisResource. + public virtual RedisCollection GetAllRedis() + { + return GetCachedClient(client => new RedisCollection(client, Id)); + } + + /// + /// Gets a Redis cache (resource description). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name} + /// + /// + /// Operation Id + /// Redis_Get + /// + /// + /// + /// The name of the Redis cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRedisAsync(string name, CancellationToken cancellationToken = default) + { + return await GetAllRedis().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Redis cache (resource description). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name} + /// + /// + /// Operation Id + /// Redis_Get + /// + /// + /// + /// The name of the Redis cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRedis(string name, CancellationToken cancellationToken = default) + { + return GetAllRedis().Get(name, cancellationToken); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs new file mode 100644 index 0000000000000..ba8e37c2de403 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Redis; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableRedisSubscriptionResource : ArmResource + { + private ClientDiagnostics _redisClientDiagnostics; + private RedisRestOperations _redisRestClient; + private ClientDiagnostics _asyncOperationStatusClientDiagnostics; + private AsyncOperationStatusRestOperations _asyncOperationStatusRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRedisSubscriptionResource() + { + } + + /// 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 MockableRedisSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics RedisClientDiagnostics => _redisClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); + private RedisRestOperations RedisRestClient => _redisRestClient ??= new RedisRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RedisResource.ResourceType)); + private ClientDiagnostics AsyncOperationStatusClientDiagnostics => _asyncOperationStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AsyncOperationStatusRestOperations AsyncOperationStatusRestClient => _asyncOperationStatusRestClient ??= new AsyncOperationStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks that the redis cache name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability + /// + /// + /// Operation Id + /// Redis_CheckNameAvailability + /// + /// + /// + /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. + /// The cancellation token to use. + /// is null. + public virtual async Task CheckRedisNameAvailabilityAsync(RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = RedisClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.CheckRedisNameAvailability"); + scope.Start(); + try + { + var response = await RedisRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the redis cache name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability + /// + /// + /// Operation Id + /// Redis_CheckNameAvailability + /// + /// + /// + /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. + /// The cancellation token to use. + /// is null. + public virtual Response CheckRedisNameAvailability(RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = RedisClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.CheckRedisNameAvailability"); + scope.Start(); + try + { + var response = RedisRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all Redis caches in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis + /// + /// + /// Operation Id + /// Redis_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllRedisAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RedisRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), RedisClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.GetAllRedis", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all Redis caches in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis + /// + /// + /// Operation Id + /// Redis_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllRedis(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RedisRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), RedisClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.GetAllRedis", "value", "nextLink", cancellationToken); + } + + /// + /// For checking the ongoing status of an operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId} + /// + /// + /// Operation Id + /// AsyncOperationStatus_Get + /// + /// + /// + /// The location at which operation was triggered. + /// The ID of asynchronous operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsyncOperationStatusAsync(AzureLocation location, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = AsyncOperationStatusClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.GetAsyncOperationStatus"); + scope.Start(); + try + { + var response = await AsyncOperationStatusRestClient.GetAsync(Id.SubscriptionId, location, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// For checking the ongoing status of an operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId} + /// + /// + /// Operation Id + /// AsyncOperationStatus_Get + /// + /// + /// + /// The location at which operation was triggered. + /// The ID of asynchronous operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetAsyncOperationStatus(AzureLocation location, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = AsyncOperationStatusClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.GetAsyncOperationStatus"); + scope.Start(); + try + { + var response = AsyncOperationStatusRestClient.Get(Id.SubscriptionId, location, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs index bb2f25a9ee797..03e77d62af7a9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Redis.Mocking; using Azure.ResourceManager.Redis.Models; using Azure.ResourceManager.Resources; @@ -19,138 +20,113 @@ namespace Azure.ResourceManager.Redis /// A class to add extension methods to Azure.ResourceManager.Redis. public static partial class RedisExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableRedisArmClient GetMockableRedisArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableRedisArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableRedisResourceGroupResource GetMockableRedisResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableRedisResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableRedisSubscriptionResource GetMockableRedisSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableRedisSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region RedisResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RedisResource GetRedisResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RedisResource.ValidateResourceId(id); - return new RedisResource(client, id); - } - ); + return GetMockableRedisArmClient(client).GetRedisResource(id); } - #endregion - #region RedisFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RedisFirewallRuleResource GetRedisFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RedisFirewallRuleResource.ValidateResourceId(id); - return new RedisFirewallRuleResource(client, id); - } - ); + return GetMockableRedisArmClient(client).GetRedisFirewallRuleResource(id); } - #endregion - #region RedisPatchScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RedisPatchScheduleResource GetRedisPatchScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RedisPatchScheduleResource.ValidateResourceId(id); - return new RedisPatchScheduleResource(client, id); - } - ); + return GetMockableRedisArmClient(client).GetRedisPatchScheduleResource(id); } - #endregion - #region RedisLinkedServerWithPropertyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RedisLinkedServerWithPropertyResource GetRedisLinkedServerWithPropertyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RedisLinkedServerWithPropertyResource.ValidateResourceId(id); - return new RedisLinkedServerWithPropertyResource(client, id); - } - ); + return GetMockableRedisArmClient(client).GetRedisLinkedServerWithPropertyResource(id); } - #endregion - #region RedisPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RedisPrivateEndpointConnectionResource GetRedisPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RedisPrivateEndpointConnectionResource.ValidateResourceId(id); - return new RedisPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableRedisArmClient(client).GetRedisPrivateEndpointConnectionResource(id); } - #endregion - /// Gets a collection of RedisResources in the ResourceGroupResource. + /// + /// Gets a collection of RedisResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RedisResources and their operations over a RedisResource. public static RedisCollection GetAllRedis(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAllRedis(); + return GetMockableRedisResourceGroupResource(resourceGroupResource).GetAllRedis(); } /// @@ -165,16 +141,20 @@ public static RedisCollection GetAllRedis(this ResourceGroupResource resourceGro /// Redis_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Redis cache. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRedisAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAllRedis().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -189,16 +169,20 @@ public static async Task> GetRedisAsync(this ResourceGro /// Redis_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Redis cache. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRedis(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAllRedis().Get(name, cancellationToken); + return GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedis(name, cancellationToken); } /// @@ -213,6 +197,10 @@ public static Response GetRedis(this ResourceGroupResource resour /// Redis_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. @@ -220,9 +208,7 @@ public static Response GetRedis(this ResourceGroupResource resour /// is null. public static async Task CheckRedisNameAvailabilityAsync(this SubscriptionResource subscriptionResource, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckRedisNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableRedisSubscriptionResource(subscriptionResource).CheckRedisNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -237,6 +223,10 @@ public static async Task CheckRedisNameAvailabilityAsync(this Subscrip /// Redis_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. @@ -244,9 +234,7 @@ public static async Task CheckRedisNameAvailabilityAsync(this Subscrip /// is null. public static Response CheckRedisNameAvailability(this SubscriptionResource subscriptionResource, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckRedisNameAvailability(content, cancellationToken); + return GetMockableRedisSubscriptionResource(subscriptionResource).CheckRedisNameAvailability(content, cancellationToken); } /// @@ -261,13 +249,17 @@ public static Response CheckRedisNameAvailability(this SubscriptionResource subs /// Redis_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAllRedisAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllRedisAsync(cancellationToken); + return GetMockableRedisSubscriptionResource(subscriptionResource).GetAllRedisAsync(cancellationToken); } /// @@ -282,13 +274,17 @@ public static AsyncPageable GetAllRedisAsync(this SubscriptionRes /// Redis_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAllRedis(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllRedis(cancellationToken); + return GetMockableRedisSubscriptionResource(subscriptionResource).GetAllRedis(cancellationToken); } /// @@ -303,6 +299,10 @@ public static Pageable GetAllRedis(this SubscriptionResource subs /// AsyncOperationStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location at which operation was triggered. @@ -312,9 +312,7 @@ public static Pageable GetAllRedis(this SubscriptionResource subs /// is null. public static async Task> GetAsyncOperationStatusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetAsyncOperationStatusAsync(location, operationId, cancellationToken).ConfigureAwait(false); + return await GetMockableRedisSubscriptionResource(subscriptionResource).GetAsyncOperationStatusAsync(location, operationId, cancellationToken).ConfigureAwait(false); } /// @@ -329,6 +327,10 @@ public static async Task> GetAsyncOperationStatus /// AsyncOperationStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location at which operation was triggered. @@ -338,9 +340,7 @@ public static async Task> GetAsyncOperationStatus /// is null. public static Response GetAsyncOperationStatus(this SubscriptionResource subscriptionResource, AzureLocation location, string operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAsyncOperationStatus(location, operationId, cancellationToken); + return GetMockableRedisSubscriptionResource(subscriptionResource).GetAsyncOperationStatus(location, operationId, cancellationToken); } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 3b91688e9110d..0000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Redis -{ - /// 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 RedisResources in the ResourceGroupResource. - /// An object representing collection of RedisResources and their operations over a RedisResource. - public virtual RedisCollection GetAllRedis() - { - return GetCachedClient(Client => new RedisCollection(Client, Id)); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index dc8fb907c4dc9..0000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Redis.Models; - -namespace Azure.ResourceManager.Redis -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _redisClientDiagnostics; - private RedisRestOperations _redisRestClient; - private ClientDiagnostics _asyncOperationStatusClientDiagnostics; - private AsyncOperationStatusRestOperations _asyncOperationStatusRestClient; - - /// 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 RedisClientDiagnostics => _redisClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); - private RedisRestOperations RedisRestClient => _redisRestClient ??= new RedisRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RedisResource.ResourceType)); - private ClientDiagnostics AsyncOperationStatusClientDiagnostics => _asyncOperationStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AsyncOperationStatusRestOperations AsyncOperationStatusRestClient => _asyncOperationStatusRestClient ??= new AsyncOperationStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks that the redis cache name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability - /// - /// - /// Operation Id - /// Redis_CheckNameAvailability - /// - /// - /// - /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. - /// The cancellation token to use. - public virtual async Task CheckRedisNameAvailabilityAsync(RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = RedisClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckRedisNameAvailability"); - scope.Start(); - try - { - var response = await RedisRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the redis cache name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability - /// - /// - /// Operation Id - /// Redis_CheckNameAvailability - /// - /// - /// - /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. - /// The cancellation token to use. - public virtual Response CheckRedisNameAvailability(RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = RedisClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckRedisNameAvailability"); - scope.Start(); - try - { - var response = RedisRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets all Redis caches in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis - /// - /// - /// Operation Id - /// Redis_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllRedisAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RedisRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), RedisClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllRedis", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all Redis caches in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis - /// - /// - /// Operation Id - /// Redis_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllRedis(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RedisRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), RedisClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllRedis", "value", "nextLink", cancellationToken); - } - - /// - /// For checking the ongoing status of an operation - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId} - /// - /// - /// Operation Id - /// AsyncOperationStatus_Get - /// - /// - /// - /// The location at which operation was triggered. - /// The ID of asynchronous operation. - /// The cancellation token to use. - public virtual async Task> GetAsyncOperationStatusAsync(AzureLocation location, string operationId, CancellationToken cancellationToken = default) - { - using var scope = AsyncOperationStatusClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAsyncOperationStatus"); - scope.Start(); - try - { - var response = await AsyncOperationStatusRestClient.GetAsync(Id.SubscriptionId, location, operationId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// For checking the ongoing status of an operation - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId} - /// - /// - /// Operation Id - /// AsyncOperationStatus_Get - /// - /// - /// - /// The location at which operation was triggered. - /// The ID of asynchronous operation. - /// The cancellation token to use. - public virtual Response GetAsyncOperationStatus(AzureLocation location, string operationId, CancellationToken cancellationToken = default) - { - using var scope = AsyncOperationStatusClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAsyncOperationStatus"); - scope.Start(); - try - { - var response = AsyncOperationStatusRestClient.Get(Id.SubscriptionId, location, operationId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleResource.cs index 430cc066c1586..20836f9117059 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Redis public partial class RedisFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cacheName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyResource.cs index 3a7ced82f825e..59df1cb131b3b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Redis public partial class RedisLinkedServerWithPropertyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The linkedServerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string linkedServerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs index 4c35efd15f97a..b3fc5d8d4fbf5 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Redis public partial class RedisPatchScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The defaultName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{defaultName}"; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionResource.cs index 1da67794450ff..a25521bf6d53b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Redis public partial class RedisPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cacheName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs index 410a404b6f957..f537cd987ec08 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Redis public partial class RedisResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RedisFirewallRuleResources and their operations over a RedisFirewallRuleResource. public virtual RedisFirewallRuleCollection GetRedisFirewallRules() { - return GetCachedClient(Client => new RedisFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new RedisFirewallRuleCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual RedisFirewallRuleCollection GetRedisFirewallRules() /// /// The name of the firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRedisFirewallRuleAsync(string ruleName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetRedisFirewallR /// /// The name of the firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRedisFirewallRule(string ruleName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetRedisFirewallRule(string r /// An object representing collection of RedisPatchScheduleResources and their operations over a RedisPatchScheduleResource. public virtual RedisPatchScheduleCollection GetRedisPatchSchedules() { - return GetCachedClient(Client => new RedisPatchScheduleCollection(Client, Id)); + return GetCachedClient(client => new RedisPatchScheduleCollection(client, Id)); } /// @@ -200,7 +203,7 @@ public virtual Response GetRedisPatchSchedule(RedisP /// An object representing collection of RedisLinkedServerWithPropertyResources and their operations over a RedisLinkedServerWithPropertyResource. public virtual RedisLinkedServerWithPropertyCollection GetRedisLinkedServerWithProperties() { - return GetCachedClient(Client => new RedisLinkedServerWithPropertyCollection(Client, Id)); + return GetCachedClient(client => new RedisLinkedServerWithPropertyCollection(client, Id)); } /// @@ -218,8 +221,8 @@ public virtual RedisLinkedServerWithPropertyCollection GetRedisLinkedServerWithP /// /// The name of the linked server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRedisLinkedServerWithPropertyAsync(string linkedServerName, CancellationToken cancellationToken = default) { @@ -241,8 +244,8 @@ public virtual async Task> GetRe /// /// The name of the linked server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRedisLinkedServerWithProperty(string linkedServerName, CancellationToken cancellationToken = default) { @@ -253,7 +256,7 @@ public virtual Response GetRedisLinkedSer /// An object representing collection of RedisPrivateEndpointConnectionResources and their operations over a RedisPrivateEndpointConnectionResource. public virtual RedisPrivateEndpointConnectionCollection GetRedisPrivateEndpointConnections() { - return GetCachedClient(Client => new RedisPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new RedisPrivateEndpointConnectionCollection(client, Id)); } /// @@ -271,8 +274,8 @@ public virtual RedisPrivateEndpointConnectionCollection GetRedisPrivateEndpointC /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRedisPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -294,8 +297,8 @@ public virtual async Task> GetR /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRedisPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/api/Azure.ResourceManager.RedisEnterprise.netstandard2.0.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/api/Azure.ResourceManager.RedisEnterprise.netstandard2.0.cs index 1b16e1d41fd83..272bb08d4dcc6 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/api/Azure.ResourceManager.RedisEnterprise.netstandard2.0.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/api/Azure.ResourceManager.RedisEnterprise.netstandard2.0.cs @@ -19,7 +19,7 @@ protected RedisEnterpriseClusterCollection() { } } public partial class RedisEnterpriseClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public RedisEnterpriseClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.RedisEnterprise.Models.RedisEnterpriseSku sku) : base (default(Azure.Core.AzureLocation)) { } + public RedisEnterpriseClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.RedisEnterprise.Models.RedisEnterpriseSku sku) { } public Azure.ResourceManager.RedisEnterprise.Models.RedisEnterpriseCustomerManagedKeyEncryption CustomerManagedKeyEncryption { get { throw null; } set { } } public string HostName { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } @@ -169,6 +169,33 @@ protected RedisEnterprisePrivateEndpointConnectionResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RedisEnterprise.RedisEnterprisePrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.RedisEnterprise.Mocking +{ + public partial class MockableRedisEnterpriseArmClient : Azure.ResourceManager.ArmResource + { + protected MockableRedisEnterpriseArmClient() { } + public virtual Azure.ResourceManager.RedisEnterprise.RedisEnterpriseClusterResource GetRedisEnterpriseClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RedisEnterprise.RedisEnterpriseDatabaseResource GetRedisEnterpriseDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.RedisEnterprise.RedisEnterprisePrivateEndpointConnectionResource GetRedisEnterprisePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableRedisEnterpriseResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableRedisEnterpriseResourceGroupResource() { } + public virtual Azure.Response GetRedisEnterpriseCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRedisEnterpriseClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RedisEnterprise.RedisEnterpriseClusterCollection GetRedisEnterpriseClusters() { throw null; } + } + public partial class MockableRedisEnterpriseSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableRedisEnterpriseSubscriptionResource() { } + public virtual Azure.Pageable GetRedisEnterpriseClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRedisEnterpriseClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRedisEnterpriseOperationsStatus(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRedisEnterpriseOperationsStatusAsync(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRedisEnterpriseSkus(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRedisEnterpriseSkusAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.RedisEnterprise.Models { public static partial class ArmRedisEnterpriseModelFactory diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseArmClient.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseArmClient.cs new file mode 100644 index 0000000000000..7011973fbe47e --- /dev/null +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.RedisEnterprise; + +namespace Azure.ResourceManager.RedisEnterprise.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableRedisEnterpriseArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRedisEnterpriseArmClient() + { + } + + /// 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 MockableRedisEnterpriseArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableRedisEnterpriseArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisEnterpriseClusterResource GetRedisEnterpriseClusterResource(ResourceIdentifier id) + { + RedisEnterpriseClusterResource.ValidateResourceId(id); + return new RedisEnterpriseClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisEnterpriseDatabaseResource GetRedisEnterpriseDatabaseResource(ResourceIdentifier id) + { + RedisEnterpriseDatabaseResource.ValidateResourceId(id); + return new RedisEnterpriseDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisEnterprisePrivateEndpointConnectionResource GetRedisEnterprisePrivateEndpointConnectionResource(ResourceIdentifier id) + { + RedisEnterprisePrivateEndpointConnectionResource.ValidateResourceId(id); + return new RedisEnterprisePrivateEndpointConnectionResource(Client, id); + } + } +} diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseResourceGroupResource.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseResourceGroupResource.cs new file mode 100644 index 0000000000000..cd4196a463567 --- /dev/null +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.RedisEnterprise; + +namespace Azure.ResourceManager.RedisEnterprise.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableRedisEnterpriseResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRedisEnterpriseResourceGroupResource() + { + } + + /// 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 MockableRedisEnterpriseResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of RedisEnterpriseClusterResources in the ResourceGroupResource. + /// An object representing collection of RedisEnterpriseClusterResources and their operations over a RedisEnterpriseClusterResource. + public virtual RedisEnterpriseClusterCollection GetRedisEnterpriseClusters() + { + return GetCachedClient(client => new RedisEnterpriseClusterCollection(client, Id)); + } + + /// + /// Gets information about a RedisEnterprise cluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName} + /// + /// + /// Operation Id + /// RedisEnterprise_Get + /// + /// + /// + /// The name of the RedisEnterprise cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRedisEnterpriseClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetRedisEnterpriseClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about a RedisEnterprise cluster + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName} + /// + /// + /// Operation Id + /// RedisEnterprise_Get + /// + /// + /// + /// The name of the RedisEnterprise cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRedisEnterpriseCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetRedisEnterpriseClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseSubscriptionResource.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseSubscriptionResource.cs new file mode 100644 index 0000000000000..3313e814be6e7 --- /dev/null +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseSubscriptionResource.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.RedisEnterprise; +using Azure.ResourceManager.RedisEnterprise.Models; + +namespace Azure.ResourceManager.RedisEnterprise.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableRedisEnterpriseSubscriptionResource : ArmResource + { + private ClientDiagnostics _operationsStatusClientDiagnostics; + private OperationsStatusRestOperations _operationsStatusRestClient; + private ClientDiagnostics _redisEnterpriseClusterRedisEnterpriseClientDiagnostics; + private RedisEnterpriseRestOperations _redisEnterpriseClusterRedisEnterpriseRestClient; + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRedisEnterpriseSubscriptionResource() + { + } + + /// 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 MockableRedisEnterpriseSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OperationsStatusClientDiagnostics => _operationsStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RedisEnterprise", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OperationsStatusRestOperations OperationsStatusRestClient => _operationsStatusRestClient ??= new OperationsStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics RedisEnterpriseClusterRedisEnterpriseClientDiagnostics => _redisEnterpriseClusterRedisEnterpriseClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RedisEnterprise", RedisEnterpriseClusterResource.ResourceType.Namespace, Diagnostics); + private RedisEnterpriseRestOperations RedisEnterpriseClusterRedisEnterpriseRestClient => _redisEnterpriseClusterRedisEnterpriseRestClient ??= new RedisEnterpriseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RedisEnterpriseClusterResource.ResourceType)); + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RedisEnterprise", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the status of operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/operationsStatus/{operationId} + /// + /// + /// Operation Id + /// OperationsStatus_Get + /// + /// + /// + /// The name of Azure region. + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetRedisEnterpriseOperationsStatusAsync(AzureLocation location, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = OperationsStatusClientDiagnostics.CreateScope("MockableRedisEnterpriseSubscriptionResource.GetRedisEnterpriseOperationsStatus"); + scope.Start(); + try + { + var response = await OperationsStatusRestClient.GetAsync(Id.SubscriptionId, location, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the status of operation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/operationsStatus/{operationId} + /// + /// + /// Operation Id + /// OperationsStatus_Get + /// + /// + /// + /// The name of Azure region. + /// The ID of an ongoing async operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetRedisEnterpriseOperationsStatus(AzureLocation location, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = OperationsStatusClientDiagnostics.CreateScope("MockableRedisEnterpriseSubscriptionResource.GetRedisEnterpriseOperationsStatus"); + scope.Start(); + try + { + var response = OperationsStatusRestClient.Get(Id.SubscriptionId, location, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all RedisEnterprise clusters in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redisEnterprise + /// + /// + /// Operation Id + /// RedisEnterprise_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRedisEnterpriseClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RedisEnterpriseClusterRedisEnterpriseRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisEnterpriseClusterRedisEnterpriseRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisEnterpriseClusterResource(Client, RedisEnterpriseClusterData.DeserializeRedisEnterpriseClusterData(e)), RedisEnterpriseClusterRedisEnterpriseClientDiagnostics, Pipeline, "MockableRedisEnterpriseSubscriptionResource.GetRedisEnterpriseClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all RedisEnterprise clusters in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redisEnterprise + /// + /// + /// Operation Id + /// RedisEnterprise_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRedisEnterpriseClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RedisEnterpriseClusterRedisEnterpriseRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisEnterpriseClusterRedisEnterpriseRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisEnterpriseClusterResource(Client, RedisEnterpriseClusterData.DeserializeRedisEnterpriseClusterData(e)), RedisEnterpriseClusterRedisEnterpriseClientDiagnostics, Pipeline, "MockableRedisEnterpriseSubscriptionResource.GetRedisEnterpriseClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about skus in specified location for the given subscription id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRedisEnterpriseSkusAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RedisEnterpriseRegionSkuDetail.DeserializeRedisEnterpriseRegionSkuDetail, SkusClientDiagnostics, Pipeline, "MockableRedisEnterpriseSubscriptionResource.GetRedisEnterpriseSkus", "value", null, cancellationToken); + } + + /// + /// Gets information about skus in specified location for the given subscription id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The name of Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRedisEnterpriseSkus(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RedisEnterpriseRegionSkuDetail.DeserializeRedisEnterpriseRegionSkuDetail, SkusClientDiagnostics, Pipeline, "MockableRedisEnterpriseSubscriptionResource.GetRedisEnterpriseSkus", "value", null, cancellationToken); + } + } +} diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/RedisEnterpriseExtensions.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/RedisEnterpriseExtensions.cs index 9d821d222bb4e..4ca7f2ea2b20a 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/RedisEnterpriseExtensions.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/RedisEnterpriseExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.RedisEnterprise.Mocking; using Azure.ResourceManager.RedisEnterprise.Models; using Azure.ResourceManager.Resources; @@ -19,100 +20,81 @@ namespace Azure.ResourceManager.RedisEnterprise /// A class to add extension methods to Azure.ResourceManager.RedisEnterprise. public static partial class RedisEnterpriseExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableRedisEnterpriseArmClient GetMockableRedisEnterpriseArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableRedisEnterpriseArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableRedisEnterpriseResourceGroupResource GetMockableRedisEnterpriseResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableRedisEnterpriseResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableRedisEnterpriseSubscriptionResource GetMockableRedisEnterpriseSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableRedisEnterpriseSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region RedisEnterpriseClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RedisEnterpriseClusterResource GetRedisEnterpriseClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RedisEnterpriseClusterResource.ValidateResourceId(id); - return new RedisEnterpriseClusterResource(client, id); - } - ); + return GetMockableRedisEnterpriseArmClient(client).GetRedisEnterpriseClusterResource(id); } - #endregion - #region RedisEnterpriseDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RedisEnterpriseDatabaseResource GetRedisEnterpriseDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RedisEnterpriseDatabaseResource.ValidateResourceId(id); - return new RedisEnterpriseDatabaseResource(client, id); - } - ); + return GetMockableRedisEnterpriseArmClient(client).GetRedisEnterpriseDatabaseResource(id); } - #endregion - #region RedisEnterprisePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RedisEnterprisePrivateEndpointConnectionResource GetRedisEnterprisePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RedisEnterprisePrivateEndpointConnectionResource.ValidateResourceId(id); - return new RedisEnterprisePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableRedisEnterpriseArmClient(client).GetRedisEnterprisePrivateEndpointConnectionResource(id); } - #endregion - /// Gets a collection of RedisEnterpriseClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of RedisEnterpriseClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RedisEnterpriseClusterResources and their operations over a RedisEnterpriseClusterResource. public static RedisEnterpriseClusterCollection GetRedisEnterpriseClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRedisEnterpriseClusters(); + return GetMockableRedisEnterpriseResourceGroupResource(resourceGroupResource).GetRedisEnterpriseClusters(); } /// @@ -127,16 +109,20 @@ public static RedisEnterpriseClusterCollection GetRedisEnterpriseClusters(this R /// RedisEnterprise_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the RedisEnterprise cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRedisEnterpriseClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetRedisEnterpriseClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableRedisEnterpriseResourceGroupResource(resourceGroupResource).GetRedisEnterpriseClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -151,16 +137,20 @@ public static async Task> GetRedisEnter /// RedisEnterprise_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the RedisEnterprise cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRedisEnterpriseCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetRedisEnterpriseClusters().Get(clusterName, cancellationToken); + return GetMockableRedisEnterpriseResourceGroupResource(resourceGroupResource).GetRedisEnterpriseCluster(clusterName, cancellationToken); } /// @@ -175,6 +165,10 @@ public static Response GetRedisEnterpriseCluster /// OperationsStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -184,9 +178,7 @@ public static Response GetRedisEnterpriseCluster /// is null. public static async Task> GetRedisEnterpriseOperationsStatusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetRedisEnterpriseOperationsStatusAsync(location, operationId, cancellationToken).ConfigureAwait(false); + return await GetMockableRedisEnterpriseSubscriptionResource(subscriptionResource).GetRedisEnterpriseOperationsStatusAsync(location, operationId, cancellationToken).ConfigureAwait(false); } /// @@ -201,6 +193,10 @@ public static async Task> GetRedisEnter /// OperationsStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -210,9 +206,7 @@ public static async Task> GetRedisEnter /// is null. public static Response GetRedisEnterpriseOperationsStatus(this SubscriptionResource subscriptionResource, AzureLocation location, string operationId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRedisEnterpriseOperationsStatus(location, operationId, cancellationToken); + return GetMockableRedisEnterpriseSubscriptionResource(subscriptionResource).GetRedisEnterpriseOperationsStatus(location, operationId, cancellationToken); } /// @@ -227,13 +221,17 @@ public static Response GetRedisEnterpriseOperati /// RedisEnterprise_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRedisEnterpriseClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRedisEnterpriseClustersAsync(cancellationToken); + return GetMockableRedisEnterpriseSubscriptionResource(subscriptionResource).GetRedisEnterpriseClustersAsync(cancellationToken); } /// @@ -248,13 +246,17 @@ public static AsyncPageable GetRedisEnterpriseCl /// RedisEnterprise_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRedisEnterpriseClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRedisEnterpriseClusters(cancellationToken); + return GetMockableRedisEnterpriseSubscriptionResource(subscriptionResource).GetRedisEnterpriseClusters(cancellationToken); } /// @@ -269,6 +271,10 @@ public static Pageable GetRedisEnterpriseCluster /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -276,7 +282,7 @@ public static Pageable GetRedisEnterpriseCluster /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetRedisEnterpriseSkusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRedisEnterpriseSkusAsync(location, cancellationToken); + return GetMockableRedisEnterpriseSubscriptionResource(subscriptionResource).GetRedisEnterpriseSkusAsync(location, cancellationToken); } /// @@ -291,6 +297,10 @@ public static AsyncPageable GetRedisEnterpriseSk /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -298,7 +308,7 @@ public static AsyncPageable GetRedisEnterpriseSk /// A collection of that may take multiple service requests to iterate over. public static Pageable GetRedisEnterpriseSkus(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRedisEnterpriseSkus(location, cancellationToken); + return GetMockableRedisEnterpriseSubscriptionResource(subscriptionResource).GetRedisEnterpriseSkus(location, cancellationToken); } } } diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 643384b3cc58a..0000000000000 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.RedisEnterprise -{ - /// 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 RedisEnterpriseClusterResources in the ResourceGroupResource. - /// An object representing collection of RedisEnterpriseClusterResources and their operations over a RedisEnterpriseClusterResource. - public virtual RedisEnterpriseClusterCollection GetRedisEnterpriseClusters() - { - return GetCachedClient(Client => new RedisEnterpriseClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 03154ad913ef6..0000000000000 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.RedisEnterprise.Models; - -namespace Azure.ResourceManager.RedisEnterprise -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _operationsStatusClientDiagnostics; - private OperationsStatusRestOperations _operationsStatusRestClient; - private ClientDiagnostics _redisEnterpriseClusterRedisEnterpriseClientDiagnostics; - private RedisEnterpriseRestOperations _redisEnterpriseClusterRedisEnterpriseRestClient; - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; - - /// 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 OperationsStatusClientDiagnostics => _operationsStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RedisEnterprise", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OperationsStatusRestOperations OperationsStatusRestClient => _operationsStatusRestClient ??= new OperationsStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics RedisEnterpriseClusterRedisEnterpriseClientDiagnostics => _redisEnterpriseClusterRedisEnterpriseClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RedisEnterprise", RedisEnterpriseClusterResource.ResourceType.Namespace, Diagnostics); - private RedisEnterpriseRestOperations RedisEnterpriseClusterRedisEnterpriseRestClient => _redisEnterpriseClusterRedisEnterpriseRestClient ??= new RedisEnterpriseRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RedisEnterpriseClusterResource.ResourceType)); - private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RedisEnterprise", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets the status of operation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/operationsStatus/{operationId} - /// - /// - /// Operation Id - /// OperationsStatus_Get - /// - /// - /// - /// The name of Azure region. - /// The ID of an ongoing async operation. - /// The cancellation token to use. - public virtual async Task> GetRedisEnterpriseOperationsStatusAsync(AzureLocation location, string operationId, CancellationToken cancellationToken = default) - { - using var scope = OperationsStatusClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRedisEnterpriseOperationsStatus"); - scope.Start(); - try - { - var response = await OperationsStatusRestClient.GetAsync(Id.SubscriptionId, location, operationId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the status of operation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/operationsStatus/{operationId} - /// - /// - /// Operation Id - /// OperationsStatus_Get - /// - /// - /// - /// The name of Azure region. - /// The ID of an ongoing async operation. - /// The cancellation token to use. - public virtual Response GetRedisEnterpriseOperationsStatus(AzureLocation location, string operationId, CancellationToken cancellationToken = default) - { - using var scope = OperationsStatusClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRedisEnterpriseOperationsStatus"); - scope.Start(); - try - { - var response = OperationsStatusRestClient.Get(Id.SubscriptionId, location, operationId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets all RedisEnterprise clusters in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redisEnterprise - /// - /// - /// Operation Id - /// RedisEnterprise_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRedisEnterpriseClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RedisEnterpriseClusterRedisEnterpriseRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisEnterpriseClusterRedisEnterpriseRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisEnterpriseClusterResource(Client, RedisEnterpriseClusterData.DeserializeRedisEnterpriseClusterData(e)), RedisEnterpriseClusterRedisEnterpriseClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRedisEnterpriseClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all RedisEnterprise clusters in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redisEnterprise - /// - /// - /// Operation Id - /// RedisEnterprise_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRedisEnterpriseClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RedisEnterpriseClusterRedisEnterpriseRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisEnterpriseClusterRedisEnterpriseRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisEnterpriseClusterResource(Client, RedisEnterpriseClusterData.DeserializeRedisEnterpriseClusterData(e)), RedisEnterpriseClusterRedisEnterpriseClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRedisEnterpriseClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets information about skus in specified location for the given subscription id - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRedisEnterpriseSkusAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RedisEnterpriseRegionSkuDetail.DeserializeRedisEnterpriseRegionSkuDetail, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRedisEnterpriseSkus", "value", null, cancellationToken); - } - - /// - /// Gets information about skus in specified location for the given subscription id - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The name of Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRedisEnterpriseSkus(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RedisEnterpriseRegionSkuDetail.DeserializeRedisEnterpriseRegionSkuDetail, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRedisEnterpriseSkus", "value", null, cancellationToken); - } - } -} diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterResource.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterResource.cs index a11ebb289fea8..d91b4d748c46a 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterResource.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.RedisEnterprise public partial class RedisEnterpriseClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RedisEnterpriseDatabaseResources and their operations over a RedisEnterpriseDatabaseResource. public virtual RedisEnterpriseDatabaseCollection GetRedisEnterpriseDatabases() { - return GetCachedClient(Client => new RedisEnterpriseDatabaseCollection(Client, Id)); + return GetCachedClient(client => new RedisEnterpriseDatabaseCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual RedisEnterpriseDatabaseCollection GetRedisEnterpriseDatabases() /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRedisEnterpriseDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetRedisEnt /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRedisEnterpriseDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetRedisEnterpriseDatab /// An object representing collection of RedisEnterprisePrivateEndpointConnectionResources and their operations over a RedisEnterprisePrivateEndpointConnectionResource. public virtual RedisEnterprisePrivateEndpointConnectionCollection GetRedisEnterprisePrivateEndpointConnections() { - return GetCachedClient(Client => new RedisEnterprisePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new RedisEnterprisePrivateEndpointConnectionCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual RedisEnterprisePrivateEndpointConnectionCollection GetRedisEnterp /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRedisEnterprisePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRedisEnterprisePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseDatabaseResource.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseDatabaseResource.cs index 6a7d73330242e..be9b8b7472478 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseDatabaseResource.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseDatabaseResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.RedisEnterprise public partial class RedisEnterpriseDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}"; diff --git a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterprisePrivateEndpointConnectionResource.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterprisePrivateEndpointConnectionResource.cs index 4241fe463a87a..7696e8c7b5685 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterprisePrivateEndpointConnectionResource.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterprisePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.RedisEnterprise public partial class RedisEnterprisePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/relay/Azure.ResourceManager.Relay/api/Azure.ResourceManager.Relay.netstandard2.0.cs b/sdk/relay/Azure.ResourceManager.Relay/api/Azure.ResourceManager.Relay.netstandard2.0.cs index 29b8312f55b29..1ce7cdfee0957 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/api/Azure.ResourceManager.Relay.netstandard2.0.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/api/Azure.ResourceManager.Relay.netstandard2.0.cs @@ -158,7 +158,7 @@ protected RelayNamespaceCollection() { } } public partial class RelayNamespaceData : Azure.ResourceManager.Models.TrackedResourceData { - public RelayNamespaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public RelayNamespaceData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string MetricId { get { throw null; } } public System.Collections.Generic.IList PrivateEndpointConnections { get { throw null; } } @@ -379,6 +379,37 @@ protected WcfRelayResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Relay.WcfRelayData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Relay.Mocking +{ + public partial class MockableRelayArmClient : Azure.ResourceManager.ArmResource + { + protected MockableRelayArmClient() { } + public virtual Azure.ResourceManager.Relay.RelayHybridConnectionAuthorizationRuleResource GetRelayHybridConnectionAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Relay.RelayHybridConnectionResource GetRelayHybridConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Relay.RelayNamespaceAuthorizationRuleResource GetRelayNamespaceAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Relay.RelayNamespaceResource GetRelayNamespaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Relay.RelayNetworkRuleSetResource GetRelayNetworkRuleSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Relay.RelayPrivateEndpointConnectionResource GetRelayPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Relay.RelayPrivateLinkResource GetRelayPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Relay.WcfRelayAuthorizationRuleResource GetWcfRelayAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Relay.WcfRelayResource GetWcfRelayResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableRelayResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableRelayResourceGroupResource() { } + public virtual Azure.Response GetRelayNamespace(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRelayNamespaceAsync(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Relay.RelayNamespaceCollection GetRelayNamespaces() { throw null; } + } + public partial class MockableRelaySubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableRelaySubscriptionResource() { } + public virtual Azure.Response CheckRelayNamespaceNameAvailability(Azure.ResourceManager.Relay.Models.RelayNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckRelayNamespaceNameAvailabilityAsync(Azure.ResourceManager.Relay.Models.RelayNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRelayNamespaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRelayNamespacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Relay.Models { public static partial class ArmRelayModelFactory diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelayArmClient.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelayArmClient.cs new file mode 100644 index 0000000000000..8b63079e79f36 --- /dev/null +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelayArmClient.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Relay; + +namespace Azure.ResourceManager.Relay.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableRelayArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRelayArmClient() + { + } + + /// 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 MockableRelayArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableRelayArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelayNamespaceAuthorizationRuleResource GetRelayNamespaceAuthorizationRuleResource(ResourceIdentifier id) + { + RelayNamespaceAuthorizationRuleResource.ValidateResourceId(id); + return new RelayNamespaceAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelayHybridConnectionAuthorizationRuleResource GetRelayHybridConnectionAuthorizationRuleResource(ResourceIdentifier id) + { + RelayHybridConnectionAuthorizationRuleResource.ValidateResourceId(id); + return new RelayHybridConnectionAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WcfRelayAuthorizationRuleResource GetWcfRelayAuthorizationRuleResource(ResourceIdentifier id) + { + WcfRelayAuthorizationRuleResource.ValidateResourceId(id); + return new WcfRelayAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelayNamespaceResource GetRelayNamespaceResource(ResourceIdentifier id) + { + RelayNamespaceResource.ValidateResourceId(id); + return new RelayNamespaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelayNetworkRuleSetResource GetRelayNetworkRuleSetResource(ResourceIdentifier id) + { + RelayNetworkRuleSetResource.ValidateResourceId(id); + return new RelayNetworkRuleSetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelayHybridConnectionResource GetRelayHybridConnectionResource(ResourceIdentifier id) + { + RelayHybridConnectionResource.ValidateResourceId(id); + return new RelayHybridConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WcfRelayResource GetWcfRelayResource(ResourceIdentifier id) + { + WcfRelayResource.ValidateResourceId(id); + return new WcfRelayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelayPrivateEndpointConnectionResource GetRelayPrivateEndpointConnectionResource(ResourceIdentifier id) + { + RelayPrivateEndpointConnectionResource.ValidateResourceId(id); + return new RelayPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RelayPrivateLinkResource GetRelayPrivateLinkResource(ResourceIdentifier id) + { + RelayPrivateLinkResource.ValidateResourceId(id); + return new RelayPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelayResourceGroupResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelayResourceGroupResource.cs new file mode 100644 index 0000000000000..492d60b3ff47f --- /dev/null +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelayResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Relay; + +namespace Azure.ResourceManager.Relay.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableRelayResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableRelayResourceGroupResource() + { + } + + /// 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 MockableRelayResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of RelayNamespaceResources in the ResourceGroupResource. + /// An object representing collection of RelayNamespaceResources and their operations over a RelayNamespaceResource. + public virtual RelayNamespaceCollection GetRelayNamespaces() + { + return GetCachedClient(client => new RelayNamespaceCollection(client, Id)); + } + + /// + /// Returns the description for the specified namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRelayNamespaceAsync(string namespaceName, CancellationToken cancellationToken = default) + { + return await GetRelayNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the description for the specified namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRelayNamespace(string namespaceName, CancellationToken cancellationToken = default) + { + return GetRelayNamespaces().Get(namespaceName, cancellationToken); + } + } +} diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelaySubscriptionResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelaySubscriptionResource.cs new file mode 100644 index 0000000000000..81664cdb08338 --- /dev/null +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/MockableRelaySubscriptionResource.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Relay; +using Azure.ResourceManager.Relay.Models; + +namespace Azure.ResourceManager.Relay.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableRelaySubscriptionResource : ArmResource + { + private ClientDiagnostics _relayNamespaceNamespacesClientDiagnostics; + private NamespacesRestOperations _relayNamespaceNamespacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRelaySubscriptionResource() + { + } + + /// 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 MockableRelaySubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics RelayNamespaceNamespacesClientDiagnostics => _relayNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Relay", RelayNamespaceResource.ResourceType.Namespace, Diagnostics); + private NamespacesRestOperations RelayNamespaceNamespacesRestClient => _relayNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RelayNamespaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Check the specified namespace name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Relay/checkNameAvailability + /// + /// + /// Operation Id + /// Namespaces_CheckNameAvailability + /// + /// + /// + /// Parameters to check availability of the specified namespace name. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckRelayNamespaceNameAvailabilityAsync(RelayNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = RelayNamespaceNamespacesClientDiagnostics.CreateScope("MockableRelaySubscriptionResource.CheckRelayNamespaceNameAvailability"); + scope.Start(); + try + { + var response = await RelayNamespaceNamespacesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the specified namespace name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Relay/checkNameAvailability + /// + /// + /// Operation Id + /// Namespaces_CheckNameAvailability + /// + /// + /// + /// Parameters to check availability of the specified namespace name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckRelayNamespaceNameAvailability(RelayNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = RelayNamespaceNamespacesClientDiagnostics.CreateScope("MockableRelaySubscriptionResource.CheckRelayNamespaceNameAvailability"); + scope.Start(); + try + { + var response = RelayNamespaceNamespacesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the available namespaces within the subscription regardless of the resourceGroups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Relay/namespaces + /// + /// + /// Operation Id + /// Namespaces_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRelayNamespacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RelayNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RelayNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RelayNamespaceResource(Client, RelayNamespaceData.DeserializeRelayNamespaceData(e)), RelayNamespaceNamespacesClientDiagnostics, Pipeline, "MockableRelaySubscriptionResource.GetRelayNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the available namespaces within the subscription regardless of the resourceGroups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Relay/namespaces + /// + /// + /// Operation Id + /// Namespaces_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRelayNamespaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RelayNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RelayNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RelayNamespaceResource(Client, RelayNamespaceData.DeserializeRelayNamespaceData(e)), RelayNamespaceNamespacesClientDiagnostics, Pipeline, "MockableRelaySubscriptionResource.GetRelayNamespaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/RelayExtensions.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/RelayExtensions.cs index 4ce1952a888d5..db21112d68350 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/RelayExtensions.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/RelayExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Relay.Mocking; using Azure.ResourceManager.Relay.Models; using Azure.ResourceManager.Resources; @@ -19,214 +20,177 @@ namespace Azure.ResourceManager.Relay /// A class to add extension methods to Azure.ResourceManager.Relay. public static partial class RelayExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableRelayArmClient GetMockableRelayArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableRelayArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableRelayResourceGroupResource GetMockableRelayResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableRelayResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableRelaySubscriptionResource GetMockableRelaySubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableRelaySubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region RelayNamespaceAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelayNamespaceAuthorizationRuleResource GetRelayNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelayNamespaceAuthorizationRuleResource.ValidateResourceId(id); - return new RelayNamespaceAuthorizationRuleResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetRelayNamespaceAuthorizationRuleResource(id); } - #endregion - #region RelayHybridConnectionAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelayHybridConnectionAuthorizationRuleResource GetRelayHybridConnectionAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelayHybridConnectionAuthorizationRuleResource.ValidateResourceId(id); - return new RelayHybridConnectionAuthorizationRuleResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetRelayHybridConnectionAuthorizationRuleResource(id); } - #endregion - #region WcfRelayAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WcfRelayAuthorizationRuleResource GetWcfRelayAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WcfRelayAuthorizationRuleResource.ValidateResourceId(id); - return new WcfRelayAuthorizationRuleResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetWcfRelayAuthorizationRuleResource(id); } - #endregion - #region RelayNamespaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelayNamespaceResource GetRelayNamespaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelayNamespaceResource.ValidateResourceId(id); - return new RelayNamespaceResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetRelayNamespaceResource(id); } - #endregion - #region RelayNetworkRuleSetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelayNetworkRuleSetResource GetRelayNetworkRuleSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelayNetworkRuleSetResource.ValidateResourceId(id); - return new RelayNetworkRuleSetResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetRelayNetworkRuleSetResource(id); } - #endregion - #region RelayHybridConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelayHybridConnectionResource GetRelayHybridConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelayHybridConnectionResource.ValidateResourceId(id); - return new RelayHybridConnectionResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetRelayHybridConnectionResource(id); } - #endregion - #region WcfRelayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WcfRelayResource GetWcfRelayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WcfRelayResource.ValidateResourceId(id); - return new WcfRelayResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetWcfRelayResource(id); } - #endregion - #region RelayPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelayPrivateEndpointConnectionResource GetRelayPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelayPrivateEndpointConnectionResource.ValidateResourceId(id); - return new RelayPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetRelayPrivateEndpointConnectionResource(id); } - #endregion - #region RelayPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RelayPrivateLinkResource GetRelayPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RelayPrivateLinkResource.ValidateResourceId(id); - return new RelayPrivateLinkResource(client, id); - } - ); + return GetMockableRelayArmClient(client).GetRelayPrivateLinkResource(id); } - #endregion - /// Gets a collection of RelayNamespaceResources in the ResourceGroupResource. + /// + /// Gets a collection of RelayNamespaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RelayNamespaceResources and their operations over a RelayNamespaceResource. public static RelayNamespaceCollection GetRelayNamespaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetRelayNamespaces(); + return GetMockableRelayResourceGroupResource(resourceGroupResource).GetRelayNamespaces(); } /// @@ -241,16 +205,20 @@ public static RelayNamespaceCollection GetRelayNamespaces(this ResourceGroupReso /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRelayNamespaceAsync(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetRelayNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableRelayResourceGroupResource(resourceGroupResource).GetRelayNamespaceAsync(namespaceName, cancellationToken).ConfigureAwait(false); } /// @@ -265,16 +233,20 @@ public static async Task> GetRelayNamespaceAsyn /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRelayNamespace(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetRelayNamespaces().Get(namespaceName, cancellationToken); + return GetMockableRelayResourceGroupResource(resourceGroupResource).GetRelayNamespace(namespaceName, cancellationToken); } /// @@ -289,6 +261,10 @@ public static Response GetRelayNamespace(this ResourceGr /// Namespaces_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters to check availability of the specified namespace name. @@ -296,9 +272,7 @@ public static Response GetRelayNamespace(this ResourceGr /// is null. public static async Task> CheckRelayNamespaceNameAvailabilityAsync(this SubscriptionResource subscriptionResource, RelayNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckRelayNamespaceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableRelaySubscriptionResource(subscriptionResource).CheckRelayNamespaceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -313,6 +287,10 @@ public static async Task> CheckRelayNamesp /// Namespaces_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters to check availability of the specified namespace name. @@ -320,9 +298,7 @@ public static async Task> CheckRelayNamesp /// is null. public static Response CheckRelayNamespaceNameAvailability(this SubscriptionResource subscriptionResource, RelayNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckRelayNamespaceNameAvailability(content, cancellationToken); + return GetMockableRelaySubscriptionResource(subscriptionResource).CheckRelayNamespaceNameAvailability(content, cancellationToken); } /// @@ -337,13 +313,17 @@ public static Response CheckRelayNamespaceNameAvail /// Namespaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRelayNamespacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRelayNamespacesAsync(cancellationToken); + return GetMockableRelaySubscriptionResource(subscriptionResource).GetRelayNamespacesAsync(cancellationToken); } /// @@ -358,13 +338,17 @@ public static AsyncPageable GetRelayNamespacesAsync(this /// Namespaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetRelayNamespaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRelayNamespaces(cancellationToken); + return GetMockableRelaySubscriptionResource(subscriptionResource).GetRelayNamespaces(cancellationToken); } } } diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 18e6c2bb452d6..0000000000000 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Relay -{ - /// 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 RelayNamespaceResources in the ResourceGroupResource. - /// An object representing collection of RelayNamespaceResources and their operations over a RelayNamespaceResource. - public virtual RelayNamespaceCollection GetRelayNamespaces() - { - return GetCachedClient(Client => new RelayNamespaceCollection(Client, Id)); - } - } -} diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 597334524cdeb..0000000000000 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Relay.Models; - -namespace Azure.ResourceManager.Relay -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _relayNamespaceNamespacesClientDiagnostics; - private NamespacesRestOperations _relayNamespaceNamespacesRestClient; - - /// 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 RelayNamespaceNamespacesClientDiagnostics => _relayNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Relay", RelayNamespaceResource.ResourceType.Namespace, Diagnostics); - private NamespacesRestOperations RelayNamespaceNamespacesRestClient => _relayNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RelayNamespaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Check the specified namespace name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Relay/checkNameAvailability - /// - /// - /// Operation Id - /// Namespaces_CheckNameAvailability - /// - /// - /// - /// Parameters to check availability of the specified namespace name. - /// The cancellation token to use. - public virtual async Task> CheckRelayNamespaceNameAvailabilityAsync(RelayNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = RelayNamespaceNamespacesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckRelayNamespaceNameAvailability"); - scope.Start(); - try - { - var response = await RelayNamespaceNamespacesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the specified namespace name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Relay/checkNameAvailability - /// - /// - /// Operation Id - /// Namespaces_CheckNameAvailability - /// - /// - /// - /// Parameters to check availability of the specified namespace name. - /// The cancellation token to use. - public virtual Response CheckRelayNamespaceNameAvailability(RelayNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = RelayNamespaceNamespacesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckRelayNamespaceNameAvailability"); - scope.Start(); - try - { - var response = RelayNamespaceNamespacesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all the available namespaces within the subscription regardless of the resourceGroups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Relay/namespaces - /// - /// - /// Operation Id - /// Namespaces_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRelayNamespacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RelayNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RelayNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RelayNamespaceResource(Client, RelayNamespaceData.DeserializeRelayNamespaceData(e)), RelayNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRelayNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the available namespaces within the subscription regardless of the resourceGroups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Relay/namespaces - /// - /// - /// Operation Id - /// Namespaces_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRelayNamespaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RelayNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RelayNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RelayNamespaceResource(Client, RelayNamespaceData.DeserializeRelayNamespaceData(e)), RelayNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRelayNamespaces", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionAuthorizationRuleResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionAuthorizationRuleResource.cs index 5aa2d5bb96e21..134f29800be90 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionAuthorizationRuleResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionAuthorizationRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Relay public partial class RelayHybridConnectionAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The hybridConnectionName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionResource.cs index cf76f2701a7db..d129fb822c248 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Relay public partial class RelayHybridConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The hybridConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string hybridConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/hybridConnections/{hybridConnectionName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RelayHybridConnectionAuthorizationRuleResources and their operations over a RelayHybridConnectionAuthorizationRuleResource. public virtual RelayHybridConnectionAuthorizationRuleCollection GetRelayHybridConnectionAuthorizationRules() { - return GetCachedClient(Client => new RelayHybridConnectionAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new RelayHybridConnectionAuthorizationRuleCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual RelayHybridConnectionAuthorizationRuleCollection GetRelayHybridCo /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRelayHybridConnectionAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRelayHybridConnectionAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceAuthorizationRuleResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceAuthorizationRuleResource.cs index c3486c814f900..24b70129739fd 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceAuthorizationRuleResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceAuthorizationRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Relay public partial class RelayNamespaceAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceResource.cs index 5fd5c261f281f..acf3968855767 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Relay public partial class RelayNamespaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RelayNamespaceAuthorizationRuleResources and their operations over a RelayNamespaceAuthorizationRuleResource. public virtual RelayNamespaceAuthorizationRuleCollection GetRelayNamespaceAuthorizationRules() { - return GetCachedClient(Client => new RelayNamespaceAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new RelayNamespaceAuthorizationRuleCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual RelayNamespaceAuthorizationRuleCollection GetRelayNamespaceAuthor /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRelayNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> Get /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRelayNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -153,7 +156,7 @@ public virtual RelayNetworkRuleSetResource GetRelayNetworkRuleSet() /// An object representing collection of RelayHybridConnectionResources and their operations over a RelayHybridConnectionResource. public virtual RelayHybridConnectionCollection GetRelayHybridConnections() { - return GetCachedClient(Client => new RelayHybridConnectionCollection(Client, Id)); + return GetCachedClient(client => new RelayHybridConnectionCollection(client, Id)); } /// @@ -171,8 +174,8 @@ public virtual RelayHybridConnectionCollection GetRelayHybridConnections() /// /// The hybrid connection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRelayHybridConnectionAsync(string hybridConnectionName, CancellationToken cancellationToken = default) { @@ -194,8 +197,8 @@ public virtual async Task> GetRelayHybri /// /// The hybrid connection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRelayHybridConnection(string hybridConnectionName, CancellationToken cancellationToken = default) { @@ -206,7 +209,7 @@ public virtual Response GetRelayHybridConnection( /// An object representing collection of WcfRelayResources and their operations over a WcfRelayResource. public virtual WcfRelayCollection GetWcfRelays() { - return GetCachedClient(Client => new WcfRelayCollection(Client, Id)); + return GetCachedClient(client => new WcfRelayCollection(client, Id)); } /// @@ -224,8 +227,8 @@ public virtual WcfRelayCollection GetWcfRelays() /// /// The relay name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWcfRelayAsync(string relayName, CancellationToken cancellationToken = default) { @@ -247,8 +250,8 @@ public virtual async Task> GetWcfRelayAsync(string re /// /// The relay name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWcfRelay(string relayName, CancellationToken cancellationToken = default) { @@ -259,7 +262,7 @@ public virtual Response GetWcfRelay(string relayName, Cancella /// An object representing collection of RelayPrivateEndpointConnectionResources and their operations over a RelayPrivateEndpointConnectionResource. public virtual RelayPrivateEndpointConnectionCollection GetRelayPrivateEndpointConnections() { - return GetCachedClient(Client => new RelayPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new RelayPrivateEndpointConnectionCollection(client, Id)); } /// @@ -277,8 +280,8 @@ public virtual RelayPrivateEndpointConnectionCollection GetRelayPrivateEndpointC /// /// The PrivateEndpointConnection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRelayPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -300,8 +303,8 @@ public virtual async Task> GetR /// /// The PrivateEndpointConnection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRelayPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -312,7 +315,7 @@ public virtual Response GetRelayPrivateE /// An object representing collection of RelayPrivateLinkResources and their operations over a RelayPrivateLinkResource. public virtual RelayPrivateLinkResourceCollection GetRelayPrivateLinkResources() { - return GetCachedClient(Client => new RelayPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new RelayPrivateLinkResourceCollection(client, Id)); } /// @@ -330,8 +333,8 @@ public virtual RelayPrivateLinkResourceCollection GetRelayPrivateLinkResources() /// /// The PrivateLinkResource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRelayPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -353,8 +356,8 @@ public virtual async Task> GetRelayPrivateLin /// /// The PrivateLinkResource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRelayPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNetworkRuleSetResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNetworkRuleSetResource.cs index ddeb805808163..69c30878c45c6 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNetworkRuleSetResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNetworkRuleSetResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Relay public partial class RelayNetworkRuleSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/networkRuleSets/default"; diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateEndpointConnectionResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateEndpointConnectionResource.cs index 798a1ce70d00e..cb7632ee89bdc 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateEndpointConnectionResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Relay public partial class RelayPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateLinkResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateLinkResource.cs index 4f0be2116cfff..b30f694b813cc 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateLinkResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Relay public partial class RelayPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayAuthorizationRuleResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayAuthorizationRuleResource.cs index 3feaecb34ae57..03f35090b6c41 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayAuthorizationRuleResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayAuthorizationRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Relay public partial class WcfRelayAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The relayName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string relayName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayResource.cs index b719d9e8d2263..3ebd80d0e6d70 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Relay public partial class WcfRelayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The relayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string relayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/wcfRelays/{relayName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of WcfRelayAuthorizationRuleResources and their operations over a WcfRelayAuthorizationRuleResource. public virtual WcfRelayAuthorizationRuleCollection GetWcfRelayAuthorizationRules() { - return GetCachedClient(Client => new WcfRelayAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new WcfRelayAuthorizationRuleCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual WcfRelayAuthorizationRuleCollection GetWcfRelayAuthorizationRules /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWcfRelayAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetWcfRel /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWcfRelayAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/api/Azure.ResourceManager.Reservations.netstandard2.0.cs b/sdk/reservations/Azure.ResourceManager.Reservations/api/Azure.ResourceManager.Reservations.netstandard2.0.cs index 240556851b28c..8090601d4a1c3 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/api/Azure.ResourceManager.Reservations.netstandard2.0.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/api/Azure.ResourceManager.Reservations.netstandard2.0.cs @@ -208,6 +208,50 @@ public static partial class ReservationsExtensions public static Azure.ResourceManager.Reservations.ReservationQuotaResource GetReservationQuotaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } } +namespace Azure.ResourceManager.Reservations.Mocking +{ + public partial class MockableReservationsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableReservationsArmClient() { } + public virtual Azure.ResourceManager.Reservations.QuotaRequestDetailResource GetQuotaRequestDetailResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Reservations.ReservationDetailResource GetReservationDetailResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Reservations.ReservationOrderResource GetReservationOrderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Reservations.ReservationQuotaResource GetReservationQuotaResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableReservationsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableReservationsSubscriptionResource() { } + public virtual Azure.ResourceManager.Reservations.ReservationQuotaCollection GetAllReservationQuota(string providerId, Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response GetAppliedReservations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppliedReservationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCatalog(Azure.ResourceManager.Reservations.Models.SubscriptionResourceGetCatalogOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCatalog(string reservedResourceType = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string publisherId = null, string offerId = null, string planId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCatalogAsync(Azure.ResourceManager.Reservations.Models.SubscriptionResourceGetCatalogOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCatalogAsync(string reservedResourceType = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string publisherId = null, string offerId = null, string planId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetQuotaRequestDetail(string providerId, Azure.Core.AzureLocation location, System.Guid id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetQuotaRequestDetailAsync(string providerId, Azure.Core.AzureLocation location, System.Guid id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Reservations.QuotaRequestDetailCollection GetQuotaRequestDetails(string providerId, Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response GetReservationQuota(string providerId, Azure.Core.AzureLocation location, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetReservationQuotaAsync(string providerId, Azure.Core.AzureLocation location, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableReservationsTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableReservationsTenantResource() { } + public virtual Azure.ResourceManager.ArmOperation CalculateReservationExchange(Azure.WaitUntil waitUntil, Azure.ResourceManager.Reservations.Models.CalculateExchangeContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CalculateReservationExchangeAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Reservations.Models.CalculateExchangeContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CalculateReservationOrder(Azure.ResourceManager.Reservations.Models.ReservationPurchaseContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CalculateReservationOrderAsync(Azure.ResourceManager.Reservations.Models.ReservationPurchaseContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Exchange(Azure.WaitUntil waitUntil, Azure.ResourceManager.Reservations.Models.ExchangeContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExchangeAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Reservations.Models.ExchangeContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetReservationDetails(Azure.ResourceManager.Reservations.Models.TenantResourceGetReservationDetailsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetReservationDetails(string filter = null, string orderby = null, string refreshSummary = null, float? skiptoken = default(float?), string selectedState = null, float? take = default(float?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetReservationDetailsAsync(Azure.ResourceManager.Reservations.Models.TenantResourceGetReservationDetailsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetReservationDetailsAsync(string filter = null, string orderby = null, string refreshSummary = null, float? skiptoken = default(float?), string selectedState = null, float? take = default(float?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetReservationOrder(System.Guid reservationOrderId, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetReservationOrderAsync(System.Guid reservationOrderId, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Reservations.ReservationOrderCollection GetReservationOrders() { throw null; } + } +} namespace Azure.ResourceManager.Reservations.Models { public partial class AppliedReservationData : Azure.ResourceManager.Models.ResourceData diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/MockableReservationsSubscriptionResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/MockableReservationsSubscriptionResource.cs new file mode 100644 index 0000000000000..fe4a093c7e737 --- /dev/null +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/MockableReservationsSubscriptionResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Reservations.Models; +using Azure.ResourceManager.Resources; +using System.Threading; + +namespace Azure.ResourceManager.Reservations.Mocking +{ + public partial class MockableReservationsSubscriptionResource : ArmResource + { + /// + /// Get the regions and skus that are available for RI purchase for the specified Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs + /// + /// + /// Operation Id + /// GetCatalog + /// + /// + /// + /// The type of the resource for which the skus should be provided. + /// Filters the skus based on the location specified in this parameter. This can be an azure region or global. + /// Publisher id used to get the third party products. + /// Offer id used to get the third party products. + /// Plan id used to get the third party products. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCatalogAsync(string reservedResourceType = null, AzureLocation? location = null, string publisherId = null, string offerId = null, string planId = null, CancellationToken cancellationToken = default) + { + SubscriptionResourceGetCatalogOptions options = new SubscriptionResourceGetCatalogOptions + { + ReservedResourceType = reservedResourceType, + Location = location, + PublisherId = publisherId, + OfferId = offerId, + PlanId = planId + }; + return GetCatalogAsync(options, cancellationToken); + } + + /// + /// Get the regions and skus that are available for RI purchase for the specified Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs + /// + /// + /// Operation Id + /// GetCatalog + /// + /// + /// + /// The type of the resource for which the skus should be provided. + /// Filters the skus based on the location specified in this parameter. This can be an azure region or global. + /// Publisher id used to get the third party products. + /// Offer id used to get the third party products. + /// Plan id used to get the third party products. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCatalog(string reservedResourceType = null, AzureLocation? location = null, string publisherId = null, string offerId = null, string planId = null, CancellationToken cancellationToken = default) + { + SubscriptionResourceGetCatalogOptions options = new SubscriptionResourceGetCatalogOptions + { + ReservedResourceType = reservedResourceType, + Location = location, + PublisherId = publisherId, + OfferId = offerId, + PlanId = planId + }; + return GetCatalog(options, cancellationToken); + } + } +} diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/MockableReservationsTenantResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/MockableReservationsTenantResource.cs new file mode 100644 index 0000000000000..edb220d5371be --- /dev/null +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/MockableReservationsTenantResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Threading; +using Azure.ResourceManager.Reservations.Models; + +namespace Azure.ResourceManager.Reservations.Mocking +{ + public partial class MockableReservationsTenantResource : ArmResource + { + /// + /// List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservations + /// + /// + /// Operation Id + /// Reservation_ListAll + /// + /// + /// + /// May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState}. + /// May be used to sort order by reservation properties. + /// To indicate whether to refresh the roll up counts of the reservations group by provisioning states. + /// The number of reservations to skip from the list before returning results. + /// The selected provisioning state. + /// To number of reservations to return. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReservationDetailsAsync(string filter = null, string orderby = null, string refreshSummary = null, float? skiptoken = null, string selectedState = null, float? take = null, CancellationToken cancellationToken = default) + { + TenantResourceGetReservationDetailsOptions options = new TenantResourceGetReservationDetailsOptions(); + options.Filter = filter; + options.Orderby = orderby; + options.RefreshSummary = refreshSummary; + options.Skiptoken = skiptoken; + options.SelectedState = selectedState; + options.Take = take; + + return GetReservationDetailsAsync(options, cancellationToken); + } + + /// + /// List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservations + /// + /// + /// Operation Id + /// Reservation_ListAll + /// + /// + /// + /// May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState}. + /// May be used to sort order by reservation properties. + /// To indicate whether to refresh the roll up counts of the reservations group by provisioning states. + /// The number of reservations to skip from the list before returning results. + /// The selected provisioning state. + /// To number of reservations to return. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReservationDetails(string filter = null, string orderby = null, string refreshSummary = null, float? skiptoken = null, string selectedState = null, float? take = null, CancellationToken cancellationToken = default) + { + TenantResourceGetReservationDetailsOptions options = new TenantResourceGetReservationDetailsOptions(); + options.Filter = filter; + options.Orderby = orderby; + options.RefreshSummary = refreshSummary; + options.Skiptoken = skiptoken; + options.SelectedState = selectedState; + options.Take = take; + + return GetReservationDetails(options, cancellationToken); + } + } +} diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/ReservationsExtensions.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/ReservationsExtensions.cs index c1d7dcccb94c5..b86d79a4bd82f 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/ReservationsExtensions.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Custom/Extensions/ReservationsExtensions.cs @@ -1,10 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Azure.ResourceManager.Resources; +#nullable disable + using System.Threading; -using Azure.ResourceManager.Reservations.Models; using Azure.Core; +using Azure.ResourceManager.Reservations.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Reservations { @@ -34,15 +36,7 @@ public static partial class ReservationsExtensions /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetReservationDetailsAsync(this TenantResource tenantResource, string filter = null, string orderby = null, string refreshSummary = null, float? skiptoken = null, string selectedState = null, float? take = null, CancellationToken cancellationToken = default) { - TenantResourceGetReservationDetailsOptions options = new TenantResourceGetReservationDetailsOptions(); - options.Filter = filter; - options.Orderby = orderby; - options.RefreshSummary = refreshSummary; - options.Skiptoken = skiptoken; - options.SelectedState = selectedState; - options.Take = take; - - return tenantResource.GetReservationDetailsAsync(options, cancellationToken); + return GetMockableReservationsTenantResource(tenantResource).GetReservationDetailsAsync(filter, orderby, refreshSummary, skiptoken, selectedState, take, cancellationToken); } /// @@ -69,15 +63,7 @@ public static AsyncPageable GetReservationDetailsAsyn /// A collection of that may take multiple service requests to iterate over. public static Pageable GetReservationDetails(this TenantResource tenantResource, string filter = null, string orderby = null, string refreshSummary = null, float? skiptoken = null, string selectedState = null, float? take = null, CancellationToken cancellationToken = default) { - TenantResourceGetReservationDetailsOptions options = new TenantResourceGetReservationDetailsOptions(); - options.Filter = filter; - options.Orderby = orderby; - options.RefreshSummary = refreshSummary; - options.Skiptoken = skiptoken; - options.SelectedState = selectedState; - options.Take = take; - - return tenantResource.GetReservationDetails(options, cancellationToken); + return GetMockableReservationsTenantResource(tenantResource).GetReservationDetails(filter, orderby, refreshSummary, skiptoken, selectedState, take, cancellationToken); } /// @@ -103,15 +89,7 @@ public static Pageable GetReservationDetails(this Ten /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCatalogAsync(this SubscriptionResource subscriptionResource, string reservedResourceType = null, AzureLocation? location = null, string publisherId = null, string offerId = null, string planId = null, CancellationToken cancellationToken = default) { - SubscriptionResourceGetCatalogOptions options = new SubscriptionResourceGetCatalogOptions - { - ReservedResourceType = reservedResourceType, - Location = location, - PublisherId = publisherId, - OfferId = offerId, - PlanId = planId - }; - return subscriptionResource.GetCatalogAsync(options, cancellationToken); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetCatalogAsync(reservedResourceType, location, publisherId, offerId, planId, cancellationToken); } /// @@ -137,15 +115,7 @@ public static AsyncPageable GetCatalogAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCatalog(this SubscriptionResource subscriptionResource, string reservedResourceType = null, AzureLocation? location = null, string publisherId = null, string offerId = null, string planId = null, CancellationToken cancellationToken = default) { - SubscriptionResourceGetCatalogOptions options = new SubscriptionResourceGetCatalogOptions - { - ReservedResourceType = reservedResourceType, - Location = location, - PublisherId = publisherId, - OfferId = offerId, - PlanId = planId - }; - return subscriptionResource.GetCatalog(options, cancellationToken); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetCatalog(reservedResourceType, location, publisherId, offerId, planId, cancellationToken); } } } diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsArmClient.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsArmClient.cs new file mode 100644 index 0000000000000..5ede1c3df4278 --- /dev/null +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Reservations; + +namespace Azure.ResourceManager.Reservations.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableReservationsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableReservationsArmClient() + { + } + + /// 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 MockableReservationsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableReservationsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReservationDetailResource GetReservationDetailResource(ResourceIdentifier id) + { + ReservationDetailResource.ValidateResourceId(id); + return new ReservationDetailResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReservationOrderResource GetReservationOrderResource(ResourceIdentifier id) + { + ReservationOrderResource.ValidateResourceId(id); + return new ReservationOrderResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ReservationQuotaResource GetReservationQuotaResource(ResourceIdentifier id) + { + ReservationQuotaResource.ValidateResourceId(id); + return new ReservationQuotaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual QuotaRequestDetailResource GetQuotaRequestDetailResource(ResourceIdentifier id) + { + QuotaRequestDetailResource.ValidateResourceId(id); + return new QuotaRequestDetailResource(Client, id); + } + } +} diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsSubscriptionResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsSubscriptionResource.cs new file mode 100644 index 0000000000000..9fd785aca2d8f --- /dev/null +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsSubscriptionResource.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Reservations; +using Azure.ResourceManager.Reservations.Models; + +namespace Azure.ResourceManager.Reservations.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableReservationsSubscriptionResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private AzureReservationAPIRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableReservationsSubscriptionResource() + { + } + + /// 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 MockableReservationsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzureReservationAPIRestOperations DefaultRestClient => _defaultRestClient ??= new AzureReservationAPIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ReservationQuotaResources in the SubscriptionResource. + /// Azure resource provider ID. + /// Azure region. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of ReservationQuotaResources and their operations over a ReservationQuotaResource. + public virtual ReservationQuotaCollection GetAllReservationQuota(string providerId, AzureLocation location) + { + return new ReservationQuotaCollection(Client, Id, providerId, location); + } + + /// + /// Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName} + /// + /// + /// Operation Id + /// Quota_Get + /// + /// + /// + /// Azure resource provider ID. + /// Azure region. + /// The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetReservationQuotaAsync(string providerId, AzureLocation location, string resourceName, CancellationToken cancellationToken = default) + { + return await GetAllReservationQuota(providerId, location).GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName} + /// + /// + /// Operation Id + /// Quota_Get + /// + /// + /// + /// Azure resource provider ID. + /// Azure region. + /// The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetReservationQuota(string providerId, AzureLocation location, string resourceName, CancellationToken cancellationToken = default) + { + return GetAllReservationQuota(providerId, location).Get(resourceName, cancellationToken); + } + + /// Gets a collection of QuotaRequestDetailResources in the SubscriptionResource. + /// Azure resource provider ID. + /// Azure region. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of QuotaRequestDetailResources and their operations over a QuotaRequestDetailResource. + public virtual QuotaRequestDetailCollection GetQuotaRequestDetails(string providerId, AzureLocation location) + { + return new QuotaRequestDetailCollection(Client, Id, providerId, location); + } + + /// + /// For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id} + /// + /// + /// Operation Id + /// QuotaRequestStatus_Get + /// + /// + /// + /// Azure resource provider ID. + /// Azure region. + /// Quota Request ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetQuotaRequestDetailAsync(string providerId, AzureLocation location, Guid id, CancellationToken cancellationToken = default) + { + return await GetQuotaRequestDetails(providerId, location).GetAsync(id, cancellationToken).ConfigureAwait(false); + } + + /// + /// For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id} + /// + /// + /// Operation Id + /// QuotaRequestStatus_Get + /// + /// + /// + /// Azure resource provider ID. + /// Azure region. + /// Quota Request ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetQuotaRequestDetail(string providerId, AzureLocation location, Guid id, CancellationToken cancellationToken = default) + { + return GetQuotaRequestDetails(providerId, location).Get(id, cancellationToken); + } + + /// + /// Get the regions and skus that are available for RI purchase for the specified Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs + /// + /// + /// Operation Id + /// GetCatalog + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCatalogAsync(SubscriptionResourceGetCatalogOptions options, CancellationToken cancellationToken = default) + { + options ??= new SubscriptionResourceGetCatalogOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateGetCatalogRequest(Id.SubscriptionId, options.ReservedResourceType, options.Location, options.PublisherId, options.OfferId, options.PlanId, options.Filter, options.Skip, options.Take); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateGetCatalogNextPageRequest(nextLink, Id.SubscriptionId, options.ReservedResourceType, options.Location, options.PublisherId, options.OfferId, options.PlanId, options.Filter, options.Skip, options.Take); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ReservationCatalog.DeserializeReservationCatalog, DefaultClientDiagnostics, Pipeline, "MockableReservationsSubscriptionResource.GetCatalog", "value", "nextLink", cancellationToken); + } + + /// + /// Get the regions and skus that are available for RI purchase for the specified Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs + /// + /// + /// Operation Id + /// GetCatalog + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCatalog(SubscriptionResourceGetCatalogOptions options, CancellationToken cancellationToken = default) + { + options ??= new SubscriptionResourceGetCatalogOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateGetCatalogRequest(Id.SubscriptionId, options.ReservedResourceType, options.Location, options.PublisherId, options.OfferId, options.PlanId, options.Filter, options.Skip, options.Take); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateGetCatalogNextPageRequest(nextLink, Id.SubscriptionId, options.ReservedResourceType, options.Location, options.PublisherId, options.OfferId, options.PlanId, options.Filter, options.Skip, options.Take); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ReservationCatalog.DeserializeReservationCatalog, DefaultClientDiagnostics, Pipeline, "MockableReservationsSubscriptionResource.GetCatalog", "value", "nextLink", cancellationToken); + } + + /// + /// Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations + /// + /// + /// Operation Id + /// GetAppliedReservationList + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAppliedReservationsAsync(CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableReservationsSubscriptionResource.GetAppliedReservations"); + scope.Start(); + try + { + var response = await DefaultRestClient.GetAppliedReservationListAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations + /// + /// + /// Operation Id + /// GetAppliedReservationList + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetAppliedReservations(CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableReservationsSubscriptionResource.GetAppliedReservations"); + scope.Start(); + try + { + var response = DefaultRestClient.GetAppliedReservationList(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsTenantResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsTenantResource.cs new file mode 100644 index 0000000000000..059f069635875 --- /dev/null +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsTenantResource.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Reservations; +using Azure.ResourceManager.Reservations.Models; + +namespace Azure.ResourceManager.Reservations.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableReservationsTenantResource : ArmResource + { + private ClientDiagnostics _reservationDetailReservationClientDiagnostics; + private ReservationRestOperations _reservationDetailReservationRestClient; + private ClientDiagnostics _reservationOrderClientDiagnostics; + private ReservationOrderRestOperations _reservationOrderRestClient; + private ClientDiagnostics _calculateExchangeClientDiagnostics; + private CalculateExchangeRestOperations _calculateExchangeRestClient; + private ClientDiagnostics _exchangeClientDiagnostics; + private ExchangeRestOperations _exchangeRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableReservationsTenantResource() + { + } + + /// 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 MockableReservationsTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ReservationDetailReservationClientDiagnostics => _reservationDetailReservationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ReservationDetailResource.ResourceType.Namespace, Diagnostics); + private ReservationRestOperations ReservationDetailReservationRestClient => _reservationDetailReservationRestClient ??= new ReservationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ReservationDetailResource.ResourceType)); + private ClientDiagnostics ReservationOrderClientDiagnostics => _reservationOrderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ReservationOrderResource.ResourceType.Namespace, Diagnostics); + private ReservationOrderRestOperations ReservationOrderRestClient => _reservationOrderRestClient ??= new ReservationOrderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ReservationOrderResource.ResourceType)); + private ClientDiagnostics CalculateExchangeClientDiagnostics => _calculateExchangeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CalculateExchangeRestOperations CalculateExchangeRestClient => _calculateExchangeRestClient ??= new CalculateExchangeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ExchangeClientDiagnostics => _exchangeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ExchangeRestOperations ExchangeRestClient => _exchangeRestClient ??= new ExchangeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ReservationOrderResources in the TenantResource. + /// An object representing collection of ReservationOrderResources and their operations over a ReservationOrderResource. + public virtual ReservationOrderCollection GetReservationOrders() + { + return GetCachedClient(client => new ReservationOrderCollection(client, Id)); + } + + /// + /// Get the details of the `ReservationOrder`. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId} + /// + /// + /// Operation Id + /// ReservationOrder_Get + /// + /// + /// + /// Order Id of the reservation. + /// May be used to expand the planInformation. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetReservationOrderAsync(Guid reservationOrderId, string expand = null, CancellationToken cancellationToken = default) + { + return await GetReservationOrders().GetAsync(reservationOrderId, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the details of the `ReservationOrder`. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId} + /// + /// + /// Operation Id + /// ReservationOrder_Get + /// + /// + /// + /// Order Id of the reservation. + /// May be used to expand the planInformation. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetReservationOrder(Guid reservationOrderId, string expand = null, CancellationToken cancellationToken = default) + { + return GetReservationOrders().Get(reservationOrderId, expand, cancellationToken); + } + + /// + /// List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservations + /// + /// + /// Operation Id + /// Reservation_ListAll + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReservationDetailsAsync(TenantResourceGetReservationDetailsOptions options, CancellationToken cancellationToken = default) + { + options ??= new TenantResourceGetReservationDetailsOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationDetailReservationRestClient.CreateListAllRequest(options.Filter, options.Orderby, options.RefreshSummary, options.Skiptoken, options.SelectedState, options.Take); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationDetailReservationRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.Orderby, options.RefreshSummary, options.Skiptoken, options.SelectedState, options.Take); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ReservationDetailResource(Client, ReservationDetailData.DeserializeReservationDetailData(e)), ReservationDetailReservationClientDiagnostics, Pipeline, "MockableReservationsTenantResource.GetReservationDetails", "value", "nextLink", cancellationToken); + } + + /// + /// List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/reservations + /// + /// + /// Operation Id + /// Reservation_ListAll + /// + /// + /// + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReservationDetails(TenantResourceGetReservationDetailsOptions options, CancellationToken cancellationToken = default) + { + options ??= new TenantResourceGetReservationDetailsOptions(); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationDetailReservationRestClient.CreateListAllRequest(options.Filter, options.Orderby, options.RefreshSummary, options.Skiptoken, options.SelectedState, options.Take); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationDetailReservationRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.Orderby, options.RefreshSummary, options.Skiptoken, options.SelectedState, options.Take); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ReservationDetailResource(Client, ReservationDetailData.DeserializeReservationDetailData(e)), ReservationDetailReservationClientDiagnostics, Pipeline, "MockableReservationsTenantResource.GetReservationDetails", "value", "nextLink", cancellationToken); + } + + /// + /// Calculate price for placing a `ReservationOrder`. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/calculatePrice + /// + /// + /// Operation Id + /// ReservationOrder_Calculate + /// + /// + /// + /// Information needed for calculate or purchase reservation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CalculateReservationOrderAsync(ReservationPurchaseContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ReservationOrderClientDiagnostics.CreateScope("MockableReservationsTenantResource.CalculateReservationOrder"); + scope.Start(); + try + { + var response = await ReservationOrderRestClient.CalculateAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Calculate price for placing a `ReservationOrder`. + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/calculatePrice + /// + /// + /// Operation Id + /// ReservationOrder_Calculate + /// + /// + /// + /// Information needed for calculate or purchase reservation. + /// The cancellation token to use. + /// is null. + public virtual Response CalculateReservationOrder(ReservationPurchaseContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ReservationOrderClientDiagnostics.CreateScope("MockableReservationsTenantResource.CalculateReservationOrder"); + scope.Start(); + try + { + var response = ReservationOrderRestClient.Calculate(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Calculates price for exchanging `Reservations` if there are no policy errors. + /// + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/calculateExchange + /// + /// + /// Operation Id + /// CalculateExchange_Post + /// + /// + /// + /// 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. + /// Request containing purchases and refunds that need to be executed. + /// The cancellation token to use. + /// is null. + public virtual async Task> CalculateReservationExchangeAsync(WaitUntil waitUntil, CalculateExchangeContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CalculateExchangeClientDiagnostics.CreateScope("MockableReservationsTenantResource.CalculateReservationExchange"); + scope.Start(); + try + { + var response = await CalculateExchangeRestClient.PostAsync(content, cancellationToken).ConfigureAwait(false); + var operation = new ReservationsArmOperation(new CalculateExchangeResultOperationSource(), CalculateExchangeClientDiagnostics, Pipeline, CalculateExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Calculates price for exchanging `Reservations` if there are no policy errors. + /// + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/calculateExchange + /// + /// + /// Operation Id + /// CalculateExchange_Post + /// + /// + /// + /// 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. + /// Request containing purchases and refunds that need to be executed. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CalculateReservationExchange(WaitUntil waitUntil, CalculateExchangeContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = CalculateExchangeClientDiagnostics.CreateScope("MockableReservationsTenantResource.CalculateReservationExchange"); + scope.Start(); + try + { + var response = CalculateExchangeRestClient.Post(content, cancellationToken); + var operation = new ReservationsArmOperation(new CalculateExchangeResultOperationSource(), CalculateExchangeClientDiagnostics, Pipeline, CalculateExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + /// + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/exchange + /// + /// + /// Operation Id + /// Exchange_Post + /// + /// + /// + /// 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. + /// Request containing the refunds and purchases that need to be executed. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExchangeAsync(WaitUntil waitUntil, ExchangeContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ExchangeClientDiagnostics.CreateScope("MockableReservationsTenantResource.Exchange"); + scope.Start(); + try + { + var response = await ExchangeRestClient.PostAsync(content, cancellationToken).ConfigureAwait(false); + var operation = new ReservationsArmOperation(new ExchangeResultOperationSource(), ExchangeClientDiagnostics, Pipeline, ExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + /// + /// + /// + /// Request Path + /// /providers/Microsoft.Capacity/exchange + /// + /// + /// Operation Id + /// Exchange_Post + /// + /// + /// + /// 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. + /// Request containing the refunds and purchases that need to be executed. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Exchange(WaitUntil waitUntil, ExchangeContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ExchangeClientDiagnostics.CreateScope("MockableReservationsTenantResource.Exchange"); + scope.Start(); + try + { + var response = ExchangeRestClient.Post(content, cancellationToken); + var operation = new ReservationsArmOperation(new ExchangeResultOperationSource(), ExchangeClientDiagnostics, Pipeline, ExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/ReservationsExtensions.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/ReservationsExtensions.cs index ea71a9bc1f510..0bfe32f80145d 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/ReservationsExtensions.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/ReservationsExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Reservations.Mocking; using Azure.ResourceManager.Reservations.Models; using Azure.ResourceManager.Resources; @@ -19,125 +20,101 @@ namespace Azure.ResourceManager.Reservations /// A class to add extension methods to Azure.ResourceManager.Reservations. public static partial class ReservationsExtensions { - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableReservationsArmClient GetMockableReservationsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableReservationsArmClient(client0)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableReservationsSubscriptionResource GetMockableReservationsSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableReservationsSubscriptionResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableReservationsTenantResource GetMockableReservationsTenantResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableReservationsTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region ReservationDetailResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ReservationDetailResource GetReservationDetailResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ReservationDetailResource.ValidateResourceId(id); - return new ReservationDetailResource(client, id); - } - ); + return GetMockableReservationsArmClient(client).GetReservationDetailResource(id); } - #endregion - #region ReservationOrderResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ReservationOrderResource GetReservationOrderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ReservationOrderResource.ValidateResourceId(id); - return new ReservationOrderResource(client, id); - } - ); + return GetMockableReservationsArmClient(client).GetReservationOrderResource(id); } - #endregion - #region ReservationQuotaResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ReservationQuotaResource GetReservationQuotaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ReservationQuotaResource.ValidateResourceId(id); - return new ReservationQuotaResource(client, id); - } - ); + return GetMockableReservationsArmClient(client).GetReservationQuotaResource(id); } - #endregion - #region QuotaRequestDetailResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static QuotaRequestDetailResource GetQuotaRequestDetailResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - QuotaRequestDetailResource.ValidateResourceId(id); - return new QuotaRequestDetailResource(client, id); - } - ); + return GetMockableReservationsArmClient(client).GetQuotaRequestDetailResource(id); } - #endregion - /// Gets a collection of ReservationQuotaResources in the SubscriptionResource. + /// + /// Gets a collection of ReservationQuotaResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Azure resource provider ID. /// Azure region. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of ReservationQuotaResources and their operations over a ReservationQuotaResource. public static ReservationQuotaCollection GetAllReservationQuota(this SubscriptionResource subscriptionResource, string providerId, AzureLocation location) { - Argument.AssertNotNullOrEmpty(providerId, nameof(providerId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllReservationQuota(providerId, location); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetAllReservationQuota(providerId, location); } /// @@ -152,18 +129,22 @@ public static ReservationQuotaCollection GetAllReservationQuota(this Subscriptio /// Quota_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure resource provider ID. /// Azure region. /// The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetReservationQuotaAsync(this SubscriptionResource subscriptionResource, string providerId, AzureLocation location, string resourceName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetAllReservationQuota(providerId, location).GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableReservationsSubscriptionResource(subscriptionResource).GetReservationQuotaAsync(providerId, location, resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -178,32 +159,40 @@ public static async Task> GetReservationQuota /// Quota_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure resource provider ID. /// Azure region. /// The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetReservationQuota(this SubscriptionResource subscriptionResource, string providerId, AzureLocation location, string resourceName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetAllReservationQuota(providerId, location).Get(resourceName, cancellationToken); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetReservationQuota(providerId, location, resourceName, cancellationToken); } - /// Gets a collection of QuotaRequestDetailResources in the SubscriptionResource. + /// + /// Gets a collection of QuotaRequestDetailResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Azure resource provider ID. /// Azure region. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of QuotaRequestDetailResources and their operations over a QuotaRequestDetailResource. public static QuotaRequestDetailCollection GetQuotaRequestDetails(this SubscriptionResource subscriptionResource, string providerId, AzureLocation location) { - Argument.AssertNotNullOrEmpty(providerId, nameof(providerId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetQuotaRequestDetails(providerId, location); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetQuotaRequestDetails(providerId, location); } /// @@ -218,18 +207,22 @@ public static QuotaRequestDetailCollection GetQuotaRequestDetails(this Subscript /// QuotaRequestStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure resource provider ID. /// Azure region. /// Quota Request ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetQuotaRequestDetailAsync(this SubscriptionResource subscriptionResource, string providerId, AzureLocation location, Guid id, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetQuotaRequestDetails(providerId, location).GetAsync(id, cancellationToken).ConfigureAwait(false); + return await GetMockableReservationsSubscriptionResource(subscriptionResource).GetQuotaRequestDetailAsync(providerId, location, id, cancellationToken).ConfigureAwait(false); } /// @@ -244,18 +237,22 @@ public static async Task> GetQuotaRequestDe /// QuotaRequestStatus_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure resource provider ID. /// Azure region. /// Quota Request ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetQuotaRequestDetail(this SubscriptionResource subscriptionResource, string providerId, AzureLocation location, Guid id, CancellationToken cancellationToken = default) { - return subscriptionResource.GetQuotaRequestDetails(providerId, location).Get(id, cancellationToken); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetQuotaRequestDetail(providerId, location, id, cancellationToken); } /// @@ -270,6 +267,10 @@ public static Response GetQuotaRequestDetail(this Su /// GetCatalog /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -277,9 +278,7 @@ public static Response GetQuotaRequestDetail(this Su /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetCatalogAsync(this SubscriptionResource subscriptionResource, SubscriptionResourceGetCatalogOptions options, CancellationToken cancellationToken = default) { - options ??= new SubscriptionResourceGetCatalogOptions(); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCatalogAsync(options, cancellationToken); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetCatalogAsync(options, cancellationToken); } /// @@ -294,6 +293,10 @@ public static AsyncPageable GetCatalogAsync(this Subscriptio /// GetCatalog /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -301,9 +304,7 @@ public static AsyncPageable GetCatalogAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetCatalog(this SubscriptionResource subscriptionResource, SubscriptionResourceGetCatalogOptions options, CancellationToken cancellationToken = default) { - options ??= new SubscriptionResourceGetCatalogOptions(); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCatalog(options, cancellationToken); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetCatalog(options, cancellationToken); } /// @@ -318,12 +319,16 @@ public static Pageable GetCatalog(this SubscriptionResource /// GetAppliedReservationList /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetAppliedReservationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppliedReservationsAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableReservationsSubscriptionResource(subscriptionResource).GetAppliedReservationsAsync(cancellationToken).ConfigureAwait(false); } /// @@ -338,20 +343,30 @@ public static async Task> GetAppliedReservation /// GetAppliedReservationList /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetAppliedReservations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppliedReservations(cancellationToken); + return GetMockableReservationsSubscriptionResource(subscriptionResource).GetAppliedReservations(cancellationToken); } - /// Gets a collection of ReservationOrderResources in the TenantResource. + /// + /// Gets a collection of ReservationOrderResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ReservationOrderResources and their operations over a ReservationOrderResource. public static ReservationOrderCollection GetReservationOrders(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetReservationOrders(); + return GetMockableReservationsTenantResource(tenantResource).GetReservationOrders(); } /// @@ -366,6 +381,10 @@ public static ReservationOrderCollection GetReservationOrders(this TenantResourc /// ReservationOrder_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Order Id of the reservation. @@ -374,7 +393,7 @@ public static ReservationOrderCollection GetReservationOrders(this TenantResourc [ForwardsClientCalls] public static async Task> GetReservationOrderAsync(this TenantResource tenantResource, Guid reservationOrderId, string expand = null, CancellationToken cancellationToken = default) { - return await tenantResource.GetReservationOrders().GetAsync(reservationOrderId, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableReservationsTenantResource(tenantResource).GetReservationOrderAsync(reservationOrderId, expand, cancellationToken).ConfigureAwait(false); } /// @@ -389,6 +408,10 @@ public static async Task> GetReservationOrder /// ReservationOrder_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Order Id of the reservation. @@ -397,7 +420,7 @@ public static async Task> GetReservationOrder [ForwardsClientCalls] public static Response GetReservationOrder(this TenantResource tenantResource, Guid reservationOrderId, string expand = null, CancellationToken cancellationToken = default) { - return tenantResource.GetReservationOrders().Get(reservationOrderId, expand, cancellationToken); + return GetMockableReservationsTenantResource(tenantResource).GetReservationOrder(reservationOrderId, expand, cancellationToken); } /// @@ -412,6 +435,10 @@ public static Response GetReservationOrder(this Tenant /// Reservation_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -419,9 +446,7 @@ public static Response GetReservationOrder(this Tenant /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetReservationDetailsAsync(this TenantResource tenantResource, TenantResourceGetReservationDetailsOptions options, CancellationToken cancellationToken = default) { - options ??= new TenantResourceGetReservationDetailsOptions(); - - return GetTenantResourceExtensionClient(tenantResource).GetReservationDetailsAsync(options, cancellationToken); + return GetMockableReservationsTenantResource(tenantResource).GetReservationDetailsAsync(options, cancellationToken); } /// @@ -436,6 +461,10 @@ public static AsyncPageable GetReservationDetailsAsyn /// Reservation_ListAll /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. @@ -443,9 +472,7 @@ public static AsyncPageable GetReservationDetailsAsyn /// A collection of that may take multiple service requests to iterate over. public static Pageable GetReservationDetails(this TenantResource tenantResource, TenantResourceGetReservationDetailsOptions options, CancellationToken cancellationToken = default) { - options ??= new TenantResourceGetReservationDetailsOptions(); - - return GetTenantResourceExtensionClient(tenantResource).GetReservationDetails(options, cancellationToken); + return GetMockableReservationsTenantResource(tenantResource).GetReservationDetails(options, cancellationToken); } /// @@ -460,6 +487,10 @@ public static Pageable GetReservationDetails(this Ten /// ReservationOrder_Calculate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Information needed for calculate or purchase reservation. @@ -467,9 +498,7 @@ public static Pageable GetReservationDetails(this Ten /// is null. public static async Task> CalculateReservationOrderAsync(this TenantResource tenantResource, ReservationPurchaseContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).CalculateReservationOrderAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableReservationsTenantResource(tenantResource).CalculateReservationOrderAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -484,6 +513,10 @@ public static async Task> CalculateReservationOrd /// ReservationOrder_Calculate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Information needed for calculate or purchase reservation. @@ -491,9 +524,7 @@ public static async Task> CalculateReservationOrd /// is null. public static Response CalculateReservationOrder(this TenantResource tenantResource, ReservationPurchaseContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).CalculateReservationOrder(content, cancellationToken); + return GetMockableReservationsTenantResource(tenantResource).CalculateReservationOrder(content, cancellationToken); } /// @@ -509,6 +540,10 @@ public static Response CalculateReservationOrder(this Tena /// CalculateExchange_Post /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -517,9 +552,7 @@ public static Response CalculateReservationOrder(this Tena /// is null. public static async Task> CalculateReservationExchangeAsync(this TenantResource tenantResource, WaitUntil waitUntil, CalculateExchangeContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).CalculateReservationExchangeAsync(waitUntil, content, cancellationToken).ConfigureAwait(false); + return await GetMockableReservationsTenantResource(tenantResource).CalculateReservationExchangeAsync(waitUntil, content, cancellationToken).ConfigureAwait(false); } /// @@ -535,6 +568,10 @@ public static async Task> CalculateReserva /// CalculateExchange_Post /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -543,9 +580,7 @@ public static async Task> CalculateReserva /// is null. public static ArmOperation CalculateReservationExchange(this TenantResource tenantResource, WaitUntil waitUntil, CalculateExchangeContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).CalculateReservationExchange(waitUntil, content, cancellationToken); + return GetMockableReservationsTenantResource(tenantResource).CalculateReservationExchange(waitUntil, content, cancellationToken); } /// @@ -561,6 +596,10 @@ public static ArmOperation CalculateReservationExchange /// Exchange_Post /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -569,9 +608,7 @@ public static ArmOperation CalculateReservationExchange /// is null. public static async Task> ExchangeAsync(this TenantResource tenantResource, WaitUntil waitUntil, ExchangeContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).ExchangeAsync(waitUntil, content, cancellationToken).ConfigureAwait(false); + return await GetMockableReservationsTenantResource(tenantResource).ExchangeAsync(waitUntil, content, cancellationToken).ConfigureAwait(false); } /// @@ -587,6 +624,10 @@ public static async Task> ExchangeAsync(this Tenant /// Exchange_Post /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -595,9 +636,7 @@ public static async Task> ExchangeAsync(this Tenant /// is null. public static ArmOperation Exchange(this TenantResource tenantResource, WaitUntil waitUntil, ExchangeContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).Exchange(waitUntil, content, cancellationToken); + return GetMockableReservationsTenantResource(tenantResource).Exchange(waitUntil, content, cancellationToken); } } } diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 90e9f26c50fa5..0000000000000 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Reservations.Models; - -namespace Azure.ResourceManager.Reservations -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private AzureReservationAPIRestOperations _defaultRestClient; - - /// 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 DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AzureReservationAPIRestOperations DefaultRestClient => _defaultRestClient ??= new AzureReservationAPIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ReservationQuotaResources in the SubscriptionResource. - /// Azure resource provider ID. - /// Azure region. - /// An object representing collection of ReservationQuotaResources and their operations over a ReservationQuotaResource. - public virtual ReservationQuotaCollection GetAllReservationQuota(string providerId, AzureLocation location) - { - return new ReservationQuotaCollection(Client, Id, providerId, location); - } - - /// Gets a collection of QuotaRequestDetailResources in the SubscriptionResource. - /// Azure resource provider ID. - /// Azure region. - /// An object representing collection of QuotaRequestDetailResources and their operations over a QuotaRequestDetailResource. - public virtual QuotaRequestDetailCollection GetQuotaRequestDetails(string providerId, AzureLocation location) - { - return new QuotaRequestDetailCollection(Client, Id, providerId, location); - } - - /// - /// Get the regions and skus that are available for RI purchase for the specified Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs - /// - /// - /// Operation Id - /// GetCatalog - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCatalogAsync(SubscriptionResourceGetCatalogOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateGetCatalogRequest(Id.SubscriptionId, options.ReservedResourceType, options.Location, options.PublisherId, options.OfferId, options.PlanId, options.Filter, options.Skip, options.Take); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateGetCatalogNextPageRequest(nextLink, Id.SubscriptionId, options.ReservedResourceType, options.Location, options.PublisherId, options.OfferId, options.PlanId, options.Filter, options.Skip, options.Take); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ReservationCatalog.DeserializeReservationCatalog, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCatalog", "value", "nextLink", cancellationToken); - } - - /// - /// Get the regions and skus that are available for RI purchase for the specified Azure subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs - /// - /// - /// Operation Id - /// GetCatalog - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCatalog(SubscriptionResourceGetCatalogOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateGetCatalogRequest(Id.SubscriptionId, options.ReservedResourceType, options.Location, options.PublisherId, options.OfferId, options.PlanId, options.Filter, options.Skip, options.Take); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateGetCatalogNextPageRequest(nextLink, Id.SubscriptionId, options.ReservedResourceType, options.Location, options.PublisherId, options.OfferId, options.PlanId, options.Filter, options.Skip, options.Take); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ReservationCatalog.DeserializeReservationCatalog, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCatalog", "value", "nextLink", cancellationToken); - } - - /// - /// Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations - /// - /// - /// Operation Id - /// GetAppliedReservationList - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAppliedReservationsAsync(CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAppliedReservations"); - scope.Start(); - try - { - var response = await DefaultRestClient.GetAppliedReservationListAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations - /// - /// - /// Operation Id - /// GetAppliedReservationList - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetAppliedReservations(CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAppliedReservations"); - scope.Start(); - try - { - var response = DefaultRestClient.GetAppliedReservationList(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index eddfe959cf732..0000000000000 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Reservations.Models; - -namespace Azure.ResourceManager.Reservations -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _reservationDetailReservationClientDiagnostics; - private ReservationRestOperations _reservationDetailReservationRestClient; - private ClientDiagnostics _reservationOrderClientDiagnostics; - private ReservationOrderRestOperations _reservationOrderRestClient; - private ClientDiagnostics _calculateExchangeClientDiagnostics; - private CalculateExchangeRestOperations _calculateExchangeRestClient; - private ClientDiagnostics _exchangeClientDiagnostics; - private ExchangeRestOperations _exchangeRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics ReservationDetailReservationClientDiagnostics => _reservationDetailReservationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ReservationDetailResource.ResourceType.Namespace, Diagnostics); - private ReservationRestOperations ReservationDetailReservationRestClient => _reservationDetailReservationRestClient ??= new ReservationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ReservationDetailResource.ResourceType)); - private ClientDiagnostics ReservationOrderClientDiagnostics => _reservationOrderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ReservationOrderResource.ResourceType.Namespace, Diagnostics); - private ReservationOrderRestOperations ReservationOrderRestClient => _reservationOrderRestClient ??= new ReservationOrderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ReservationOrderResource.ResourceType)); - private ClientDiagnostics CalculateExchangeClientDiagnostics => _calculateExchangeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CalculateExchangeRestOperations CalculateExchangeRestClient => _calculateExchangeRestClient ??= new CalculateExchangeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ExchangeClientDiagnostics => _exchangeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Reservations", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ExchangeRestOperations ExchangeRestClient => _exchangeRestClient ??= new ExchangeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ReservationOrderResources in the TenantResource. - /// An object representing collection of ReservationOrderResources and their operations over a ReservationOrderResource. - public virtual ReservationOrderCollection GetReservationOrders() - { - return GetCachedClient(Client => new ReservationOrderCollection(Client, Id)); - } - - /// - /// List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant. - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/reservations - /// - /// - /// Operation Id - /// Reservation_ListAll - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetReservationDetailsAsync(TenantResourceGetReservationDetailsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationDetailReservationRestClient.CreateListAllRequest(options.Filter, options.Orderby, options.RefreshSummary, options.Skiptoken, options.SelectedState, options.Take); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationDetailReservationRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.Orderby, options.RefreshSummary, options.Skiptoken, options.SelectedState, options.Take); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ReservationDetailResource(Client, ReservationDetailData.DeserializeReservationDetailData(e)), ReservationDetailReservationClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetReservationDetails", "value", "nextLink", cancellationToken); - } - - /// - /// List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant. - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/reservations - /// - /// - /// Operation Id - /// Reservation_ListAll - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetReservationDetails(TenantResourceGetReservationDetailsOptions options, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ReservationDetailReservationRestClient.CreateListAllRequest(options.Filter, options.Orderby, options.RefreshSummary, options.Skiptoken, options.SelectedState, options.Take); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ReservationDetailReservationRestClient.CreateListAllNextPageRequest(nextLink, options.Filter, options.Orderby, options.RefreshSummary, options.Skiptoken, options.SelectedState, options.Take); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ReservationDetailResource(Client, ReservationDetailData.DeserializeReservationDetailData(e)), ReservationDetailReservationClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetReservationDetails", "value", "nextLink", cancellationToken); - } - - /// - /// Calculate price for placing a `ReservationOrder`. - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/calculatePrice - /// - /// - /// Operation Id - /// ReservationOrder_Calculate - /// - /// - /// - /// Information needed for calculate or purchase reservation. - /// The cancellation token to use. - public virtual async Task> CalculateReservationOrderAsync(ReservationPurchaseContent content, CancellationToken cancellationToken = default) - { - using var scope = ReservationOrderClientDiagnostics.CreateScope("TenantResourceExtensionClient.CalculateReservationOrder"); - scope.Start(); - try - { - var response = await ReservationOrderRestClient.CalculateAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Calculate price for placing a `ReservationOrder`. - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/calculatePrice - /// - /// - /// Operation Id - /// ReservationOrder_Calculate - /// - /// - /// - /// Information needed for calculate or purchase reservation. - /// The cancellation token to use. - public virtual Response CalculateReservationOrder(ReservationPurchaseContent content, CancellationToken cancellationToken = default) - { - using var scope = ReservationOrderClientDiagnostics.CreateScope("TenantResourceExtensionClient.CalculateReservationOrder"); - scope.Start(); - try - { - var response = ReservationOrderRestClient.Calculate(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Calculates price for exchanging `Reservations` if there are no policy errors. - /// - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/calculateExchange - /// - /// - /// Operation Id - /// CalculateExchange_Post - /// - /// - /// - /// 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. - /// Request containing purchases and refunds that need to be executed. - /// The cancellation token to use. - public virtual async Task> CalculateReservationExchangeAsync(WaitUntil waitUntil, CalculateExchangeContent content, CancellationToken cancellationToken = default) - { - using var scope = CalculateExchangeClientDiagnostics.CreateScope("TenantResourceExtensionClient.CalculateReservationExchange"); - scope.Start(); - try - { - var response = await CalculateExchangeRestClient.PostAsync(content, cancellationToken).ConfigureAwait(false); - var operation = new ReservationsArmOperation(new CalculateExchangeResultOperationSource(), CalculateExchangeClientDiagnostics, Pipeline, CalculateExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Calculates price for exchanging `Reservations` if there are no policy errors. - /// - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/calculateExchange - /// - /// - /// Operation Id - /// CalculateExchange_Post - /// - /// - /// - /// 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. - /// Request containing purchases and refunds that need to be executed. - /// The cancellation token to use. - public virtual ArmOperation CalculateReservationExchange(WaitUntil waitUntil, CalculateExchangeContent content, CancellationToken cancellationToken = default) - { - using var scope = CalculateExchangeClientDiagnostics.CreateScope("TenantResourceExtensionClient.CalculateReservationExchange"); - scope.Start(); - try - { - var response = CalculateExchangeRestClient.Post(content, cancellationToken); - var operation = new ReservationsArmOperation(new CalculateExchangeResultOperationSource(), CalculateExchangeClientDiagnostics, Pipeline, CalculateExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. - /// - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/exchange - /// - /// - /// Operation Id - /// Exchange_Post - /// - /// - /// - /// 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. - /// Request containing the refunds and purchases that need to be executed. - /// The cancellation token to use. - public virtual async Task> ExchangeAsync(WaitUntil waitUntil, ExchangeContent content, CancellationToken cancellationToken = default) - { - using var scope = ExchangeClientDiagnostics.CreateScope("TenantResourceExtensionClient.Exchange"); - scope.Start(); - try - { - var response = await ExchangeRestClient.PostAsync(content, cancellationToken).ConfigureAwait(false); - var operation = new ReservationsArmOperation(new ExchangeResultOperationSource(), ExchangeClientDiagnostics, Pipeline, ExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. - /// - /// - /// - /// Request Path - /// /providers/Microsoft.Capacity/exchange - /// - /// - /// Operation Id - /// Exchange_Post - /// - /// - /// - /// 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. - /// Request containing the refunds and purchases that need to be executed. - /// The cancellation token to use. - public virtual ArmOperation Exchange(WaitUntil waitUntil, ExchangeContent content, CancellationToken cancellationToken = default) - { - using var scope = ExchangeClientDiagnostics.CreateScope("TenantResourceExtensionClient.Exchange"); - scope.Start(); - try - { - var response = ExchangeRestClient.Post(content, cancellationToken); - var operation = new ReservationsArmOperation(new ExchangeResultOperationSource(), ExchangeClientDiagnostics, Pipeline, ExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/QuotaRequestDetailResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/QuotaRequestDetailResource.cs index 980cf0fc92fa5..052d6ba8a9456 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/QuotaRequestDetailResource.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/QuotaRequestDetailResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Reservations public partial class QuotaRequestDetailResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerId. + /// The location. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerId, AzureLocation location, Guid id) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}"; diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationDetailResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationDetailResource.cs index 758e00d1fa1b0..63f2dfa17e852 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationDetailResource.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationDetailResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Reservations public partial class ReservationDetailResource : ArmResource { /// Generate the resource identifier of a instance. + /// The reservationOrderId. + /// The reservationId. public static ResourceIdentifier CreateResourceIdentifier(Guid reservationOrderId, Guid reservationId) { var resourceId = $"/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}"; diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderResource.cs index 557bf300e3eea..3e738ffec6e54 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderResource.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderResource.cs @@ -28,6 +28,7 @@ namespace Azure.ResourceManager.Reservations public partial class ReservationOrderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The reservationOrderId. public static ResourceIdentifier CreateResourceIdentifier(Guid reservationOrderId) { var resourceId = $"/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}"; @@ -106,7 +107,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ReservationDetailResources and their operations over a ReservationDetailResource. public virtual ReservationDetailCollection GetReservationDetails() { - return GetCachedClient(Client => new ReservationDetailCollection(Client, Id)); + return GetCachedClient(client => new ReservationDetailCollection(client, Id)); } /// diff --git a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationQuotaResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationQuotaResource.cs index df7052c28359b..6c04d30619a3d 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationQuotaResource.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationQuotaResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Reservations public partial class ReservationQuotaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The providerId. + /// The location. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string providerId, AzureLocation location, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}"; diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/api/Azure.ResourceManager.ResourceConnector.netstandard2.0.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/api/Azure.ResourceManager.ResourceConnector.netstandard2.0.cs index 10d9bcade2cee..18f35579c1ee8 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/api/Azure.ResourceManager.ResourceConnector.netstandard2.0.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/api/Azure.ResourceManager.ResourceConnector.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ResourceConnectorApplianceCollection() { } } public partial class ResourceConnectorApplianceData : Azure.ResourceManager.Models.TrackedResourceData { - public ResourceConnectorApplianceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ResourceConnectorApplianceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ResourceConnector.Models.ResourceConnectorDistro? Distro { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.ResourceConnector.Models.ApplianceProvider? InfrastructureConfigProvider { get { throw null; } set { } } @@ -66,6 +66,29 @@ public static partial class ResourceConnectorExtensions public static System.Threading.Tasks.Task> GetTelemetryConfigApplianceAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ResourceConnector.Mocking +{ + public partial class MockableResourceConnectorArmClient : Azure.ResourceManager.ArmResource + { + protected MockableResourceConnectorArmClient() { } + public virtual Azure.ResourceManager.ResourceConnector.ResourceConnectorApplianceResource GetResourceConnectorApplianceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableResourceConnectorResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceConnectorResourceGroupResource() { } + public virtual Azure.Response GetResourceConnectorAppliance(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceConnectorApplianceAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ResourceConnector.ResourceConnectorApplianceCollection GetResourceConnectorAppliances() { throw null; } + } + public partial class MockableResourceConnectorSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceConnectorSubscriptionResource() { } + public virtual Azure.Pageable GetResourceConnectorAppliances(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetResourceConnectorAppliancesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTelemetryConfigAppliance(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTelemetryConfigApplianceAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ResourceConnector.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorArmClient.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorArmClient.cs new file mode 100644 index 0000000000000..84c00e5e45cec --- /dev/null +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorArmClient.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceConnector; + +namespace Azure.ResourceManager.ResourceConnector.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableResourceConnectorArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourceConnectorArmClient() + { + } + + /// 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 MockableResourceConnectorArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableResourceConnectorArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceConnectorApplianceResource GetResourceConnectorApplianceResource(ResourceIdentifier id) + { + ResourceConnectorApplianceResource.ValidateResourceId(id); + return new ResourceConnectorApplianceResource(Client, id); + } + } +} diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorResourceGroupResource.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorResourceGroupResource.cs new file mode 100644 index 0000000000000..abf5a3b12e29d --- /dev/null +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ResourceConnector; + +namespace Azure.ResourceManager.ResourceConnector.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableResourceConnectorResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourceConnectorResourceGroupResource() + { + } + + /// 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 MockableResourceConnectorResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ResourceConnectorApplianceResources in the ResourceGroupResource. + /// An object representing collection of ResourceConnectorApplianceResources and their operations over a ResourceConnectorApplianceResource. + public virtual ResourceConnectorApplianceCollection GetResourceConnectorAppliances() + { + return GetCachedClient(client => new ResourceConnectorApplianceCollection(client, Id)); + } + + /// + /// Gets the details of an Appliance with a specified resource group and name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName} + /// + /// + /// Operation Id + /// Appliances_Get + /// + /// + /// + /// Appliances name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceConnectorApplianceAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetResourceConnectorAppliances().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of an Appliance with a specified resource group and name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName} + /// + /// + /// Operation Id + /// Appliances_Get + /// + /// + /// + /// Appliances name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceConnectorAppliance(string resourceName, CancellationToken cancellationToken = default) + { + return GetResourceConnectorAppliances().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorSubscriptionResource.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorSubscriptionResource.cs new file mode 100644 index 0000000000000..798d21dbc778a --- /dev/null +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/MockableResourceConnectorSubscriptionResource.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceConnector; +using Azure.ResourceManager.ResourceConnector.Models; + +namespace Azure.ResourceManager.ResourceConnector.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableResourceConnectorSubscriptionResource : ArmResource + { + private ClientDiagnostics _resourceConnectorApplianceAppliancesClientDiagnostics; + private AppliancesRestOperations _resourceConnectorApplianceAppliancesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourceConnectorSubscriptionResource() + { + } + + /// 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 MockableResourceConnectorSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ResourceConnectorApplianceAppliancesClientDiagnostics => _resourceConnectorApplianceAppliancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceConnector", ResourceConnectorApplianceResource.ResourceType.Namespace, Diagnostics); + private AppliancesRestOperations ResourceConnectorApplianceAppliancesRestClient => _resourceConnectorApplianceAppliancesRestClient ??= new AppliancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ResourceConnectorApplianceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/appliances + /// + /// + /// Operation Id + /// Appliances_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetResourceConnectorAppliancesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceConnectorApplianceAppliancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceConnectorApplianceAppliancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourceConnectorApplianceResource(Client, ResourceConnectorApplianceData.DeserializeResourceConnectorApplianceData(e)), ResourceConnectorApplianceAppliancesClientDiagnostics, Pipeline, "MockableResourceConnectorSubscriptionResource.GetResourceConnectorAppliances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/appliances + /// + /// + /// Operation Id + /// Appliances_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetResourceConnectorAppliances(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceConnectorApplianceAppliancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceConnectorApplianceAppliancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourceConnectorApplianceResource(Client, ResourceConnectorApplianceData.DeserializeResourceConnectorApplianceData(e)), ResourceConnectorApplianceAppliancesClientDiagnostics, Pipeline, "MockableResourceConnectorSubscriptionResource.GetResourceConnectorAppliances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the telemetry config. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/telemetryconfig + /// + /// + /// Operation Id + /// Appliances_GetTelemetryConfig + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetTelemetryConfigApplianceAsync(CancellationToken cancellationToken = default) + { + using var scope = ResourceConnectorApplianceAppliancesClientDiagnostics.CreateScope("MockableResourceConnectorSubscriptionResource.GetTelemetryConfigAppliance"); + scope.Start(); + try + { + var response = await ResourceConnectorApplianceAppliancesRestClient.GetTelemetryConfigAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the telemetry config. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/telemetryconfig + /// + /// + /// Operation Id + /// Appliances_GetTelemetryConfig + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetTelemetryConfigAppliance(CancellationToken cancellationToken = default) + { + using var scope = ResourceConnectorApplianceAppliancesClientDiagnostics.CreateScope("MockableResourceConnectorSubscriptionResource.GetTelemetryConfigAppliance"); + scope.Start(); + try + { + var response = ResourceConnectorApplianceAppliancesRestClient.GetTelemetryConfig(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/ResourceConnectorExtensions.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/ResourceConnectorExtensions.cs index 1f702d8194ff8..32192f8cdbb1e 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/ResourceConnectorExtensions.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/ResourceConnectorExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ResourceConnector.Mocking; using Azure.ResourceManager.ResourceConnector.Models; using Azure.ResourceManager.Resources; @@ -19,62 +20,49 @@ namespace Azure.ResourceManager.ResourceConnector /// A class to add extension methods to Azure.ResourceManager.ResourceConnector. public static partial class ResourceConnectorExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableResourceConnectorArmClient GetMockableResourceConnectorArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableResourceConnectorArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableResourceConnectorResourceGroupResource GetMockableResourceConnectorResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableResourceConnectorResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableResourceConnectorSubscriptionResource GetMockableResourceConnectorSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableResourceConnectorSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ResourceConnectorApplianceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourceConnectorApplianceResource GetResourceConnectorApplianceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceConnectorApplianceResource.ValidateResourceId(id); - return new ResourceConnectorApplianceResource(client, id); - } - ); + return GetMockableResourceConnectorArmClient(client).GetResourceConnectorApplianceResource(id); } - #endregion - /// Gets a collection of ResourceConnectorApplianceResources in the ResourceGroupResource. + /// + /// Gets a collection of ResourceConnectorApplianceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ResourceConnectorApplianceResources and their operations over a ResourceConnectorApplianceResource. public static ResourceConnectorApplianceCollection GetResourceConnectorAppliances(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetResourceConnectorAppliances(); + return GetMockableResourceConnectorResourceGroupResource(resourceGroupResource).GetResourceConnectorAppliances(); } /// @@ -89,16 +77,20 @@ public static ResourceConnectorApplianceCollection GetResourceConnectorAppliance /// Appliances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Appliances name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceConnectorApplianceAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetResourceConnectorAppliances().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceConnectorResourceGroupResource(resourceGroupResource).GetResourceConnectorApplianceAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -113,16 +105,20 @@ public static async Task> GetResour /// Appliances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Appliances name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceConnectorAppliance(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetResourceConnectorAppliances().Get(resourceName, cancellationToken); + return GetMockableResourceConnectorResourceGroupResource(resourceGroupResource).GetResourceConnectorAppliance(resourceName, cancellationToken); } /// @@ -137,13 +133,17 @@ public static Response GetResourceConnectorA /// Appliances_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourceConnectorAppliancesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceConnectorAppliancesAsync(cancellationToken); + return GetMockableResourceConnectorSubscriptionResource(subscriptionResource).GetResourceConnectorAppliancesAsync(cancellationToken); } /// @@ -158,13 +158,17 @@ public static AsyncPageable GetResourceConne /// Appliances_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetResourceConnectorAppliances(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceConnectorAppliances(cancellationToken); + return GetMockableResourceConnectorSubscriptionResource(subscriptionResource).GetResourceConnectorAppliances(cancellationToken); } /// @@ -179,12 +183,16 @@ public static Pageable GetResourceConnectorA /// Appliances_GetTelemetryConfig /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetTelemetryConfigApplianceAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetTelemetryConfigApplianceAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableResourceConnectorSubscriptionResource(subscriptionResource).GetTelemetryConfigApplianceAsync(cancellationToken).ConfigureAwait(false); } /// @@ -199,12 +207,16 @@ public static async Task> GetTelemetryC /// Appliances_GetTelemetryConfig /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetTelemetryConfigAppliance(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTelemetryConfigAppliance(cancellationToken); + return GetMockableResourceConnectorSubscriptionResource(subscriptionResource).GetTelemetryConfigAppliance(cancellationToken); } } } diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 4f7699aa9b314..0000000000000 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ResourceConnector -{ - /// 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 ResourceConnectorApplianceResources in the ResourceGroupResource. - /// An object representing collection of ResourceConnectorApplianceResources and their operations over a ResourceConnectorApplianceResource. - public virtual ResourceConnectorApplianceCollection GetResourceConnectorAppliances() - { - return GetCachedClient(Client => new ResourceConnectorApplianceCollection(Client, Id)); - } - } -} diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index f93abee43cbad..0000000000000 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ResourceConnector.Models; - -namespace Azure.ResourceManager.ResourceConnector -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _resourceConnectorApplianceAppliancesClientDiagnostics; - private AppliancesRestOperations _resourceConnectorApplianceAppliancesRestClient; - - /// 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 ResourceConnectorApplianceAppliancesClientDiagnostics => _resourceConnectorApplianceAppliancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceConnector", ResourceConnectorApplianceResource.ResourceType.Namespace, Diagnostics); - private AppliancesRestOperations ResourceConnectorApplianceAppliancesRestClient => _resourceConnectorApplianceAppliancesRestClient ??= new AppliancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ResourceConnectorApplianceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/appliances - /// - /// - /// Operation Id - /// Appliances_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetResourceConnectorAppliancesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceConnectorApplianceAppliancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceConnectorApplianceAppliancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourceConnectorApplianceResource(Client, ResourceConnectorApplianceData.DeserializeResourceConnectorApplianceData(e)), ResourceConnectorApplianceAppliancesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceConnectorAppliances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/appliances - /// - /// - /// Operation Id - /// Appliances_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetResourceConnectorAppliances(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceConnectorApplianceAppliancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceConnectorApplianceAppliancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourceConnectorApplianceResource(Client, ResourceConnectorApplianceData.DeserializeResourceConnectorApplianceData(e)), ResourceConnectorApplianceAppliancesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceConnectorAppliances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the telemetry config. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/telemetryconfig - /// - /// - /// Operation Id - /// Appliances_GetTelemetryConfig - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetTelemetryConfigApplianceAsync(CancellationToken cancellationToken = default) - { - using var scope = ResourceConnectorApplianceAppliancesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetTelemetryConfigAppliance"); - scope.Start(); - try - { - var response = await ResourceConnectorApplianceAppliancesRestClient.GetTelemetryConfigAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the telemetry config. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/telemetryconfig - /// - /// - /// Operation Id - /// Appliances_GetTelemetryConfig - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetTelemetryConfigAppliance(CancellationToken cancellationToken = default) - { - using var scope = ResourceConnectorApplianceAppliancesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetTelemetryConfigAppliance"); - scope.Start(); - try - { - var response = ResourceConnectorApplianceAppliancesRestClient.GetTelemetryConfig(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceResource.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceResource.cs index 8412b13bc279c..84ee0a483a73e 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceResource.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ResourceConnector public partial class ResourceConnectorApplianceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector/appliances/{resourceName}"; diff --git a/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/api/Azure.ResourceManager.ResourceGraph.netstandard2.0.cs b/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/api/Azure.ResourceManager.ResourceGraph.netstandard2.0.cs index d9ca724c99692..c34a0ba09c5f5 100644 --- a/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/api/Azure.ResourceManager.ResourceGraph.netstandard2.0.cs +++ b/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/api/Azure.ResourceManager.ResourceGraph.netstandard2.0.cs @@ -8,6 +8,17 @@ public static partial class ResourceGraphExtensions public static System.Threading.Tasks.Task> GetResourcesAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, Azure.ResourceManager.ResourceGraph.Models.ResourceQueryContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ResourceGraph.Mocking +{ + public partial class MockableResourceGraphTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceGraphTenantResource() { } + public virtual Azure.Response GetResourceHistory(Azure.ResourceManager.ResourceGraph.Models.ResourcesHistoryContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceHistoryAsync(Azure.ResourceManager.ResourceGraph.Models.ResourcesHistoryContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetResources(Azure.ResourceManager.ResourceGraph.Models.ResourceQueryContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourcesAsync(Azure.ResourceManager.ResourceGraph.Models.ResourceQueryContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ResourceGraph.Models { public static partial class ArmResourceGraphModelFactory diff --git a/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/MockableResourceGraphTenantResource.cs b/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/MockableResourceGraphTenantResource.cs new file mode 100644 index 0000000000000..94e0ef48d0eac --- /dev/null +++ b/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/MockableResourceGraphTenantResource.cs @@ -0,0 +1,183 @@ +// 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; +using Azure.ResourceManager.ResourceGraph; +using Azure.ResourceManager.ResourceGraph.Models; + +namespace Azure.ResourceManager.ResourceGraph.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableResourceGraphTenantResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private ResourceGraphRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourceGraphTenantResource() + { + } + + /// 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 MockableResourceGraphTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceGraph", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceGraphRestOperations DefaultRestClient => _defaultRestClient ??= new ResourceGraphRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Queries the resources managed by Azure Resource Manager for scopes specified in the request. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceGraph/resources + /// + /// + /// Operation Id + /// Resources + /// + /// + /// + /// Request specifying query and its options. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetResourcesAsync(ResourceQueryContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableResourceGraphTenantResource.GetResources"); + scope.Start(); + try + { + var response = await DefaultRestClient.ResourcesAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Queries the resources managed by Azure Resource Manager for scopes specified in the request. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceGraph/resources + /// + /// + /// Operation Id + /// Resources + /// + /// + /// + /// Request specifying query and its options. + /// The cancellation token to use. + /// is null. + public virtual Response GetResources(ResourceQueryContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableResourceGraphTenantResource.GetResources"); + scope.Start(); + try + { + var response = DefaultRestClient.Resources(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all snapshots of a resource for a given time interval. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceGraph/resourcesHistory + /// + /// + /// Operation Id + /// ResourcesHistory + /// + /// + /// + /// Request specifying the query and its options. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetResourceHistoryAsync(ResourcesHistoryContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableResourceGraphTenantResource.GetResourceHistory"); + scope.Start(); + try + { + var response = await DefaultRestClient.ResourcesHistoryAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all snapshots of a resource for a given time interval. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceGraph/resourcesHistory + /// + /// + /// Operation Id + /// ResourcesHistory + /// + /// + /// + /// Request specifying the query and its options. + /// The cancellation token to use. + /// is null. + public virtual Response GetResourceHistory(ResourcesHistoryContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableResourceGraphTenantResource.GetResourceHistory"); + scope.Start(); + try + { + var response = DefaultRestClient.ResourcesHistory(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/ResourceGraphExtensions.cs b/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/ResourceGraphExtensions.cs index d1d3300d1d631..bda74cbbe5c3b 100644 --- a/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/ResourceGraphExtensions.cs +++ b/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/ResourceGraphExtensions.cs @@ -9,8 +9,8 @@ using System.Threading; using System.Threading.Tasks; using Azure; -using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ResourceGraph.Mocking; using Azure.ResourceManager.ResourceGraph.Models; using Azure.ResourceManager.Resources; @@ -19,20 +19,9 @@ namespace Azure.ResourceManager.ResourceGraph /// A class to add extension methods to Azure.ResourceManager.ResourceGraph. public static partial class ResourceGraphExtensions { - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableResourceGraphTenantResource GetMockableResourceGraphTenantResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableResourceGraphTenantResource(client, resource.Id)); } /// @@ -47,6 +36,10 @@ private static TenantResourceExtensionClient GetTenantResourceExtensionClient(Ar /// Resources /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Request specifying query and its options. @@ -54,9 +47,7 @@ private static TenantResourceExtensionClient GetTenantResourceExtensionClient(Ar /// is null. public static async Task> GetResourcesAsync(this TenantResource tenantResource, ResourceQueryContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).GetResourcesAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceGraphTenantResource(tenantResource).GetResourcesAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -71,6 +62,10 @@ public static async Task> GetResourcesAsync(this T /// Resources /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Request specifying query and its options. @@ -78,9 +73,7 @@ public static async Task> GetResourcesAsync(this T /// is null. public static Response GetResources(this TenantResource tenantResource, ResourceQueryContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).GetResources(content, cancellationToken); + return GetMockableResourceGraphTenantResource(tenantResource).GetResources(content, cancellationToken); } /// @@ -95,6 +88,10 @@ public static Response GetResources(this TenantResource ten /// ResourcesHistory /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Request specifying the query and its options. @@ -102,9 +99,7 @@ public static Response GetResources(this TenantResource ten /// is null. public static async Task> GetResourceHistoryAsync(this TenantResource tenantResource, ResourcesHistoryContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).GetResourceHistoryAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceGraphTenantResource(tenantResource).GetResourceHistoryAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -119,6 +114,10 @@ public static async Task> GetResourceHistoryAsync(this Tena /// ResourcesHistory /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Request specifying the query and its options. @@ -126,9 +125,7 @@ public static async Task> GetResourceHistoryAsync(this Tena /// is null. public static Response GetResourceHistory(this TenantResource tenantResource, ResourcesHistoryContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).GetResourceHistory(content, cancellationToken); + return GetMockableResourceGraphTenantResource(tenantResource).GetResourceHistory(content, cancellationToken); } } } diff --git a/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index daa2a970c595b..0000000000000 --- a/sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,170 +0,0 @@ -// 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; -using Azure.ResourceManager.ResourceGraph.Models; - -namespace Azure.ResourceManager.ResourceGraph -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private ResourceGraphRestOperations _defaultRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceGraph", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceGraphRestOperations DefaultRestClient => _defaultRestClient ??= new ResourceGraphRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Queries the resources managed by Azure Resource Manager for scopes specified in the request. - /// - /// - /// Request Path - /// /providers/Microsoft.ResourceGraph/resources - /// - /// - /// Operation Id - /// Resources - /// - /// - /// - /// Request specifying query and its options. - /// The cancellation token to use. - public virtual async Task> GetResourcesAsync(ResourceQueryContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetResources"); - scope.Start(); - try - { - var response = await DefaultRestClient.ResourcesAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Queries the resources managed by Azure Resource Manager for scopes specified in the request. - /// - /// - /// Request Path - /// /providers/Microsoft.ResourceGraph/resources - /// - /// - /// Operation Id - /// Resources - /// - /// - /// - /// Request specifying query and its options. - /// The cancellation token to use. - public virtual Response GetResources(ResourceQueryContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetResources"); - scope.Start(); - try - { - var response = DefaultRestClient.Resources(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all snapshots of a resource for a given time interval. - /// - /// - /// Request Path - /// /providers/Microsoft.ResourceGraph/resourcesHistory - /// - /// - /// Operation Id - /// ResourcesHistory - /// - /// - /// - /// Request specifying the query and its options. - /// The cancellation token to use. - public virtual async Task> GetResourceHistoryAsync(ResourcesHistoryContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetResourceHistory"); - scope.Start(); - try - { - var response = await DefaultRestClient.ResourcesHistoryAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all snapshots of a resource for a given time interval. - /// - /// - /// Request Path - /// /providers/Microsoft.ResourceGraph/resourcesHistory - /// - /// - /// Operation Id - /// ResourcesHistory - /// - /// - /// - /// Request specifying the query and its options. - /// The cancellation token to use. - public virtual Response GetResourceHistory(ResourcesHistoryContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetResourceHistory"); - scope.Start(); - try - { - var response = DefaultRestClient.ResourcesHistory(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/CHANGELOG.md b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/CHANGELOG.md index a70bb5f478007..e6e79d2c2c7ed 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/CHANGELOG.md +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.1.0-beta.2 (Unreleased) +## 1.1.0-beta.3 (Unreleased) ### Features Added @@ -10,6 +10,24 @@ ### Other Changes +## 1.1.0-beta.2 (2023-10-31) + +### Features Added + +- Model Event has a new parameter arg_query +- Model Event has a new parameter event_sub_type +- Model Event has a new parameter maintenance_id +- Model Event has a new parameter maintenance_type +- Model EventImpactedResource has a new parameter maintenance_end_time +- Model EventImpactedResource has a new parameter maintenance_start_time +- Model EventImpactedResource has a new parameter resource_group +- Model EventImpactedResource has a new parameter resource_name +- Model EventImpactedResource has a new parameter status + +### Other Changes + +- Upgraded API version to `2023-10-01-preview` + ## 1.1.0-beta.1 (2023-05-31) ### Features Added diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/api/Azure.ResourceManager.ResourceHealth.netstandard2.0.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/api/Azure.ResourceManager.ResourceHealth.netstandard2.0.cs index 445bbdb62be76..c5f5f07f7245e 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/api/Azure.ResourceManager.ResourceHealth.netstandard2.0.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/api/Azure.ResourceManager.ResourceHealth.netstandard2.0.cs @@ -19,11 +19,13 @@ public partial class ResourceHealthEventData : Azure.ResourceManager.Models.Reso { internal ResourceHealthEventData() { } public string AdditionalInformationMessage { get { throw null; } } + public string ArgQuery { get { throw null; } } public Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventArticle Article { get { throw null; } } public string Description { get { throw null; } } public int? Duration { get { throw null; } } public Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLevelValue? EventLevel { get { throw null; } } public Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventSourceValue? EventSource { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue? EventSubType { get { throw null; } } public Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventTypeValue? EventType { get { throw null; } } public string ExternalIncidentId { get { throw null; } } public System.Collections.Generic.IReadOnlyList Faqs { get { throw null; } } @@ -40,6 +42,8 @@ internal ResourceHealthEventData() { } public System.DateTimeOffset? LastUpdateOn { get { throw null; } } public Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventInsightLevelValue? Level { get { throw null; } } public System.Collections.Generic.IReadOnlyList Links { get { throw null; } } + public string MaintenanceId { get { throw null; } } + public string MaintenanceType { get { throw null; } } public int? Priority { get { throw null; } } public string Reason { get { throw null; } } public Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventRecommendedActions RecommendedActions { get { throw null; } } @@ -76,6 +80,11 @@ public partial class ResourceHealthEventImpactedResourceData : Azure.ResourceMan { internal ResourceHealthEventImpactedResourceData() { } public System.Collections.Generic.IReadOnlyList Info { get { throw null; } } + public string MaintenanceEndTime { get { throw null; } } + public string MaintenanceStartTime { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public string ResourceName { get { throw null; } } + public string Status { get { throw null; } } public string TargetRegion { get { throw null; } } public Azure.Core.ResourceIdentifier TargetResourceId { get { throw null; } } public Azure.Core.ResourceType? TargetResourceType { get { throw null; } } @@ -257,6 +266,59 @@ protected TenantResourceHealthEventResource() { } public virtual Azure.ResourceManager.ResourceHealth.TenantResourceHealthEventImpactedResourceCollection GetTenantResourceHealthEventImpactedResources() { throw null; } } } +namespace Azure.ResourceManager.ResourceHealth.Mocking +{ + public partial class MockableResourceHealthArmClient : Azure.ResourceManager.ArmResource + { + protected MockableResourceHealthArmClient() { } + public virtual Azure.Response GetAvailabilityStatus(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailabilityStatusAsync(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailabilityStatuses(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailabilityStatusesAsync(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAvailabilityStatusOfChildResource(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailabilityStatusOfChildResourceAsync(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailabilityStatusOfChildResources(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailabilityStatusOfChildResourcesAsync(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHealthEventsOfSingleResource(Azure.Core.ResourceIdentifier scope, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHealthEventsOfSingleResourceAsync(Azure.Core.ResourceIdentifier scope, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetHistoricalAvailabilityStatusesOfChildResource(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetHistoricalAvailabilityStatusesOfChildResourceAsync(Azure.Core.ResourceIdentifier scope, string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.ResourceHealthEventImpactedResource GetResourceHealthEventImpactedResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.ResourceHealthEventResource GetResourceHealthEventResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.ResourceHealthMetadataEntityResource GetResourceHealthMetadataEntityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.ServiceEmergingIssueResource GetServiceEmergingIssueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.TenantResourceHealthEventImpactedResource GetTenantResourceHealthEventImpactedResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.TenantResourceHealthEventResource GetTenantResourceHealthEventResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableResourceHealthResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceHealthResourceGroupResource() { } + public virtual Azure.Pageable GetAvailabilityStatusesByResourceGroup(string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailabilityStatusesByResourceGroupAsync(string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableResourceHealthSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceHealthSubscriptionResource() { } + public virtual Azure.Pageable GetAvailabilityStatusesBySubscription(string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailabilityStatusesBySubscriptionAsync(string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetResourceHealthEvent(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceHealthEventAsync(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.ResourceHealthEventCollection GetResourceHealthEvents() { throw null; } + } + public partial class MockableResourceHealthTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceHealthTenantResource() { } + public virtual Azure.ResourceManager.ResourceHealth.ResourceHealthMetadataEntityCollection GetResourceHealthMetadataEntities() { throw null; } + public virtual Azure.Response GetResourceHealthMetadataEntity(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceHealthMetadataEntityAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetServiceEmergingIssue(Azure.ResourceManager.ResourceHealth.Models.EmergingIssueNameContent issueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceEmergingIssueAsync(Azure.ResourceManager.ResourceHealth.Models.EmergingIssueNameContent issueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.ServiceEmergingIssueCollection GetServiceEmergingIssues() { throw null; } + public virtual Azure.Response GetTenantResourceHealthEvent(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTenantResourceHealthEventAsync(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.TenantResourceHealthEventCollection GetTenantResourceHealthEvents() { throw null; } + } +} namespace Azure.ResourceManager.ResourceHealth.Models { public static partial class ArmResourceHealthModelFactory @@ -270,10 +332,10 @@ public static partial class ArmResourceHealthModelFactory public static Azure.ResourceManager.ResourceHealth.Models.ResourceHealthAvailabilityStatus ResourceHealthAvailabilityStatus(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthAvailabilityStatusProperties properties = null) { throw null; } public static Azure.ResourceManager.ResourceHealth.Models.ResourceHealthAvailabilityStatusProperties ResourceHealthAvailabilityStatusProperties(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthAvailabilityStateValue? availabilityState = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthAvailabilityStateValue?), string title = null, string summary = null, string detailedStatus = null, string reasonType = null, string context = null, string category = null, string articleId = null, System.DateTimeOffset? rootCauseAttributionOn = default(System.DateTimeOffset?), string healthEventType = null, string healthEventCause = null, string healthEventCategory = null, string healthEventId = null, System.DateTimeOffset? resolutionEta = default(System.DateTimeOffset?), System.DateTimeOffset? occuredOn = default(System.DateTimeOffset?), Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType? reasonChronicity = default(Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType?), System.DateTimeOffset? reportedOn = default(System.DateTimeOffset?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthAvailabilityStateRecentlyResolved recentlyResolved = null, System.Collections.Generic.IEnumerable recommendedActions = null, System.Collections.Generic.IEnumerable serviceImpactingEvents = null) { throw null; } public static Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventArticle ResourceHealthEventArticle(string articleContent = null, string articleId = null, System.BinaryData parameters = null) { throw null; } - public static Azure.ResourceManager.ResourceHealth.ResourceHealthEventData ResourceHealthEventData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventTypeValue? eventType = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventTypeValue?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventSourceValue? eventSource = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventSourceValue?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventStatusValue? status = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventStatusValue?), string title = null, string summary = null, string header = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventInsightLevelValue? level = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventInsightLevelValue?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLevelValue? eventLevel = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLevelValue?), string externalIncidentId = null, string reason = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventArticle article = null, System.Collections.Generic.IEnumerable links = null, System.DateTimeOffset? impactStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? impactMitigationOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable impact = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventRecommendedActions recommendedActions = null, System.Collections.Generic.IEnumerable faqs = null, bool? isHirEvent = default(bool?), bool? isMicrosoftSupportEnabled = default(bool?), string description = null, bool? isPlatformInitiated = default(bool?), bool? isChatWithUsEnabled = default(bool?), int? priority = default(int?), System.DateTimeOffset? lastUpdateOn = default(System.DateTimeOffset?), string hirStage = null, string additionalInformationMessage = null, int? duration = default(int?), string impactType = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.ResourceHealthEventData ResourceHealthEventData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventTypeValue? eventType = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventTypeValue?), Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue? eventSubType = default(Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventSourceValue? eventSource = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventSourceValue?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventStatusValue? status = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventStatusValue?), string title = null, string summary = null, string header = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventInsightLevelValue? level = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventInsightLevelValue?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLevelValue? eventLevel = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLevelValue?), string externalIncidentId = null, string reason = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventArticle article = null, System.Collections.Generic.IEnumerable links = null, System.DateTimeOffset? impactStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? impactMitigationOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable impact = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventRecommendedActions recommendedActions = null, System.Collections.Generic.IEnumerable faqs = null, bool? isHirEvent = default(bool?), bool? isMicrosoftSupportEnabled = default(bool?), string description = null, bool? isPlatformInitiated = default(bool?), bool? isChatWithUsEnabled = default(bool?), int? priority = default(int?), System.DateTimeOffset? lastUpdateOn = default(System.DateTimeOffset?), string hirStage = null, string additionalInformationMessage = null, int? duration = default(int?), string impactType = null, string maintenanceId = null, string maintenanceType = null, string argQuery = null) { throw null; } public static Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventFaq ResourceHealthEventFaq(string question = null, string answer = null, string localeCode = null) { throw null; } public static Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventImpact ResourceHealthEventImpact(string impactedService = null, System.Collections.Generic.IEnumerable impactedRegions = null) { throw null; } - public static Azure.ResourceManager.ResourceHealth.ResourceHealthEventImpactedResourceData ResourceHealthEventImpactedResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceType? targetResourceType = default(Azure.Core.ResourceType?), Azure.Core.ResourceIdentifier targetResourceId = null, string targetRegion = null, System.Collections.Generic.IEnumerable info = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.ResourceHealthEventImpactedResourceData ResourceHealthEventImpactedResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceType? targetResourceType = default(Azure.Core.ResourceType?), Azure.Core.ResourceIdentifier targetResourceId = null, string targetRegion = null, string resourceName = null, string resourceGroup = null, string status = null, string maintenanceStartTime = null, string maintenanceEndTime = null, System.Collections.Generic.IEnumerable info = null) { throw null; } public static Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventImpactedServiceRegion ResourceHealthEventImpactedServiceRegion(string impactedRegion = null, Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventStatusValue? status = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventStatusValue?), System.Collections.Generic.IEnumerable impactedSubscriptions = null, System.Collections.Generic.IEnumerable impactedTenants = null, System.DateTimeOffset? lastUpdateOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable updates = null) { throw null; } public static Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLink ResourceHealthEventLink(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLinkTypeValue? linkType = default(Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLinkTypeValue?), Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLinkDisplayText displayText = null, string extensionName = null, string bladeName = null, System.BinaryData parameters = null) { throw null; } public static Azure.ResourceManager.ResourceHealth.Models.ResourceHealthEventLinkDisplayText ResourceHealthEventLinkDisplayText(string value = null, string localizedValue = null) { throw null; } @@ -340,6 +402,23 @@ internal EmergingIssueImpactedRegion() { } public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EventSubTypeValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventSubTypeValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue Retirement { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue 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.ResourceHealth.Models.EventSubTypeValue left, Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue left, Azure.ResourceManager.ResourceHealth.Models.EventSubTypeValue right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MetadataEntityScenario : System.IEquatable { private readonly object _dummy; diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ArmResourceExtensions.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ArmResourceExtensions.cs deleted file mode 100644 index e8d81f551e21c..0000000000000 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ArmResourceExtensions.cs +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager; -using Azure.ResourceManager.ResourceHealth; -using Azure.ResourceManager.ResourceHealth.Models; - -namespace Azure.ResourceManager.ResourceHealth.Samples -{ - public partial class Sample_ArmResourceExtensions - { - // GetCurrentHealthByResource - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAvailabilityStatus_GetCurrentHealthByResource() - { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatus_GetByResource.json - // this example is just showing the usage of "AvailabilityStatuses_GetByResource" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // invoke the operation - string resourceUri = "resourceUri"; - ResourceIdentifier scope = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - string expand = "recommendedactions"; - ResourceHealthAvailabilityStatus result = await client.GetAvailabilityStatusAsync(scope, expand: expand); - - Console.WriteLine($"Succeeded: {result}"); - } - - // GetHealthHistoryByResource - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAvailabilityStatuses_GetHealthHistoryByResource() - { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_List.json - // this example is just showing the usage of "AvailabilityStatuses_List" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // invoke the operation and iterate over the result - string resourceUri = "resourceUri"; - ResourceIdentifier scope = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - await foreach (ResourceHealthAvailabilityStatus item in client.GetAvailabilityStatusesAsync(scope)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine($"Succeeded"); - } - - // ListEventsBySingleResource - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetHealthEventsOfSingleResource_ListEventsBySingleResource() - { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json - // this example is just showing the usage of "Events_ListBySingleResource" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // invoke the operation and iterate over the result - string resourceUri = "subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI"; - ResourceIdentifier scope = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - await foreach (ResourceHealthEventData item in client.GetHealthEventsOfSingleResourceAsync(scope)) - { - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {item.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // GetChildCurrentHealthByResource - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAvailabilityStatusOfChildResource_GetChildCurrentHealthByResource() - { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json - // this example is just showing the usage of "ChildAvailabilityStatuses_GetByResource" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // invoke the operation - string resourceUri = "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4"; - ResourceIdentifier scope = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - string expand = "recommendedactions"; - ResourceHealthAvailabilityStatus result = await client.GetAvailabilityStatusOfChildResourceAsync(scope, expand: expand); - - Console.WriteLine($"Succeeded: {result}"); - } - - // GetChildHealthHistoryByResource - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetHistoricalAvailabilityStatusesOfChildResource_GetChildHealthHistoryByResource() - { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json - // this example is just showing the usage of "ChildAvailabilityStatuses_List" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // invoke the operation and iterate over the result - string resourceUri = "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4"; - ResourceIdentifier scope = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - await foreach (ResourceHealthAvailabilityStatus item in client.GetHistoricalAvailabilityStatusesOfChildResourceAsync(scope)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine($"Succeeded"); - } - - // GetCurrentChildHealthByResource - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAvailabilityStatusOfChildResources_GetCurrentChildHealthByResource() - { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json - // this example is just showing the usage of "ChildResources_List" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // invoke the operation and iterate over the result - string resourceUri = "resourceUri"; - ResourceIdentifier scope = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - await foreach (ResourceHealthAvailabilityStatus item in client.GetAvailabilityStatusOfChildResourcesAsync(scope)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine($"Succeeded"); - } - } -} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs index 7ecb826ac762f..08f5dd78be21b 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_ResourceGroupResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAvailabilityStatusesByResourceGroup_ListByResourceGroup() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListByResourceGroup.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/AvailabilityStatuses_ListByResourceGroup.json // this example is just showing the usage of "AvailabilityStatuses_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventCollection.cs index 44aa4ec11b02f..06d56abeece84 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ResourceHealthEventCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListEventsBySubscriptionId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Events_ListBySubscriptionId.json // this example is just showing the usage of "Events_ListBySubscriptionId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task GetAll_ListEventsBySubscriptionId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json // this example is just showing the usage of "Event_GetBySubscriptionIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task Get_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json // this example is just showing the usage of "Event_GetBySubscriptionIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +126,7 @@ public async Task Exists_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json // this example is just showing the usage of "Event_GetBySubscriptionIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResource.cs index b8af367869e24..a961cae6b4a8b 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResource.cs @@ -21,7 +21,7 @@ public partial class Sample_ResourceHealthEventImpactedResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ImpactedResourcesGet() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_Get.json // this example is just showing the usage of "ImpactedResources_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResourceCollection.cs index 9c8c19b40058f..1c4d8a5c1433d 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResourceCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventImpactedResourceCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ResourceHealthEventImpactedResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListImpactedResourcesBySubscriptionId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json // this example is just showing the usage of "ImpactedResources_ListBySubscriptionIdAndEventId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,7 +59,7 @@ public async Task GetAll_ListImpactedResourcesBySubscriptionId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ImpactedResourcesGet() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_Get.json // this example is just showing the usage of "ImpactedResources_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task Get_ImpactedResourcesGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ImpactedResourcesGet() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_Get.json // this example is just showing the usage of "ImpactedResources_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -123,7 +123,7 @@ public async Task Exists_ImpactedResourcesGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ImpactedResourcesGet() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_Get.json // this example is just showing the usage of "ImpactedResources_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventResource.cs index 6cea6b47ef2ee..7e441d4d1afb4 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthEventResource.cs @@ -21,7 +21,7 @@ public partial class Sample_ResourceHealthEventResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventId_ListSecurityAdvisoryImpactedResourcesBySubscriptionId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json // this example is just showing the usage of "SecurityAdvisoryImpactedResources_ListBySubscriptionIdAndEventId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventId [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json // this example is just showing the usage of "Event_GetBySubscriptionIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -83,7 +83,7 @@ public async Task Get_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task FetchDetailsBySubscriptionIdAndTrackingId_EventDetailsBySubscriptionIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json // this example is just showing the usage of "Event_fetchDetailsBySubscriptionIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityCollection.cs index 3a3ef0015d6cd..b00741a8e8201 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_ResourceHealthMetadataEntityCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetMetadata() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Metadata_List.json // this example is just showing the usage of "Metadata_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task GetAll_GetMetadata() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetMetadata() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Metadata_GetEntity.json // this example is just showing the usage of "Metadata_GetEntity" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,7 +86,7 @@ public async Task Get_GetMetadata() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetMetadata() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Metadata_GetEntity.json // this example is just showing the usage of "Metadata_GetEntity" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -113,7 +113,7 @@ public async Task Exists_GetMetadata() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetMetadata() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Metadata_GetEntity.json // this example is just showing the usage of "Metadata_GetEntity" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityResource.cs index 322b4fece7935..29495bd057480 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ResourceHealthMetadataEntityResource.cs @@ -21,7 +21,7 @@ public partial class Sample_ResourceHealthMetadataEntityResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetMetadata() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Metadata_GetEntity.json // this example is just showing the usage of "Metadata_GetEntity" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueCollection.cs index f623796197576..45882925e0b47 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ServiceEmergingIssueCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetEmergingIssues() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/EmergingIssues_List.json // this example is just showing the usage of "EmergingIssues_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_GetEmergingIssues() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetEmergingIssues() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/EmergingIssues_Get.json // this example is just showing the usage of "EmergingIssues_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -87,7 +87,7 @@ public async Task Get_GetEmergingIssues() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetEmergingIssues() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/EmergingIssues_Get.json // this example is just showing the usage of "EmergingIssues_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -114,7 +114,7 @@ public async Task Exists_GetEmergingIssues() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetEmergingIssues() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/EmergingIssues_Get.json // this example is just showing the usage of "EmergingIssues_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueResource.cs index 24fda896e5b22..81829d199e3c5 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ServiceEmergingIssueResource.cs @@ -22,7 +22,7 @@ public partial class Sample_ServiceEmergingIssueResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetEmergingIssues() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/EmergingIssues_Get.json // this example is just showing the usage of "EmergingIssues_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 0051202fb12e9..f9c8e9c3503a7 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_SubscriptionResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAvailabilityStatusesBySubscription_ListHealthBySubscriptionId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/AvailabilityStatuses_ListBySubscriptionId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/AvailabilityStatuses_ListBySubscriptionId.json // this example is just showing the usage of "AvailabilityStatuses_ListBySubscriptionId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventCollection.cs index f62aaa13392eb..82928dcc33af0 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_TenantResourceHealthEventCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListEventsByTenantId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Events_ListByTenantId.json // this example is just showing the usage of "Events_ListByTenantId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_ListEventsByTenantId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_EventByTenantIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json // this example is just showing the usage of "Event_GetByTenantIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -90,7 +90,7 @@ public async Task Get_EventByTenantIdAndTrackingId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_EventByTenantIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json // this example is just showing the usage of "Event_GetByTenantIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -119,7 +119,7 @@ public async Task Exists_EventByTenantIdAndTrackingId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_EventByTenantIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json // this example is just showing the usage of "Event_GetByTenantIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResource.cs index 2313b1f79ebee..c11a0b6ad24b4 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResource.cs @@ -21,7 +21,7 @@ public partial class Sample_TenantResourceHealthEventImpactedResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ImpactedResourcesGet() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_GetByTenantId.json // this example is just showing the usage of "ImpactedResources_GetByTenantId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs index fc87b9aa75a89..df5a842e60547 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_TenantResourceHealthEventImpactedResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListEventsByTenantId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_ListByTenantId_ListByEventId.json // this example is just showing the usage of "ImpactedResources_ListByTenantIdAndEventId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +58,7 @@ public async Task GetAll_ListEventsByTenantId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ImpactedResourcesGet() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_GetByTenantId.json // this example is just showing the usage of "ImpactedResources_GetByTenantId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_ImpactedResourcesGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ImpactedResourcesGet() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_GetByTenantId.json // this example is just showing the usage of "ImpactedResources_GetByTenantId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -120,7 +120,7 @@ public async Task Exists_ImpactedResourcesGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ImpactedResourcesGet() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/ImpactedResources_GetByTenantId.json // this example is just showing the usage of "ImpactedResources_GetByTenantId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventResource.cs index 71dfec3e96d35..52ce36fe26601 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventResource.cs @@ -21,7 +21,7 @@ public partial class Sample_TenantResourceHealthEventResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventId_ListSecurityAdvisoryImpactedResourcesByTenantId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json // this example is just showing the usage of "SecurityAdvisoryImpactedResources_ListByTenantIdAndEventId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventId_ListS [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_EventByTenantIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json // this example is just showing the usage of "Event_GetByTenantIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -81,7 +81,7 @@ public async Task Get_EventByTenantIdAndTrackingId() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task FetchDetailsByTenantIdAndTrackingId_EventDetailsByTenantIdAndTrackingId() { - // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2023-10-01-preview/examples/Event_fetchDetailsByTenantIdAndTrackingId.json // this example is just showing the usage of "Event_fetchDetailsByTenantIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Azure.ResourceManager.ResourceHealth.csproj b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Azure.ResourceManager.ResourceHealth.csproj index e1c2a3446a140..5e4c0ef59166e 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Azure.ResourceManager.ResourceHealth.csproj +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Azure.ResourceManager.ResourceHealth.csproj @@ -1,6 +1,6 @@ - 1.1.0-beta.2 + 1.1.0-beta.3 1.0.0 Azure.ResourceManager.ResourceHealth diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ArmResourceHealthModelFactory.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ArmResourceHealthModelFactory.cs index 484997e81fd02..14850eb99cc60 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ArmResourceHealthModelFactory.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ArmResourceHealthModelFactory.cs @@ -143,13 +143,18 @@ public static MetadataSupportedValueDetail MetadataSupportedValueDetail(string i /// Resource type within Microsoft cloud. /// Identity for resource within Microsoft cloud. /// Impacted resource region name. + /// Resource name of the impacted resource. + /// Resource group name of the impacted resource. + /// Status of the impacted resource. + /// Start time of maintenance for the impacted resource. + /// End time of maintenance for the impacted resource. /// Additional information. /// A new instance for mocking. - public static ResourceHealthEventImpactedResourceData ResourceHealthEventImpactedResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceType? targetResourceType = null, ResourceIdentifier targetResourceId = null, string targetRegion = null, IEnumerable info = null) + public static ResourceHealthEventImpactedResourceData ResourceHealthEventImpactedResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceType? targetResourceType = null, ResourceIdentifier targetResourceId = null, string targetRegion = null, string resourceName = null, string resourceGroup = null, string status = null, string maintenanceStartTime = null, string maintenanceEndTime = null, IEnumerable info = null) { info ??= new List(); - return new ResourceHealthEventImpactedResourceData(id, name, resourceType, systemData, targetResourceType, targetResourceId, targetRegion, info?.ToList()); + return new ResourceHealthEventImpactedResourceData(id, name, resourceType, systemData, targetResourceType, targetResourceId, targetRegion, resourceName, resourceGroup, status, maintenanceStartTime, maintenanceEndTime, info?.ToList()); } /// Initializes a new instance of ResourceHealthKeyValueItem. @@ -167,6 +172,7 @@ public static ResourceHealthKeyValueItem ResourceHealthKeyValueItem(string key = /// The resourceType. /// The systemData. /// Type of event. + /// Sub type of the event. Currently used to determine retirement communications for health advisory events. /// Source of event. /// Current status of event. /// Title text of event. @@ -194,14 +200,17 @@ public static ResourceHealthKeyValueItem ResourceHealthKeyValueItem(string key = /// Additional information. /// duration in seconds. /// The type of the impact. + /// Unique identifier for planned maintenance event. + /// The type of planned maintenance event. + /// Azure Resource Graph query to fetch the affected resources from their existing Azure Resource Graph locations. /// A new instance for mocking. - public static ResourceHealthEventData ResourceHealthEventData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceHealthEventTypeValue? eventType = null, ResourceHealthEventSourceValue? eventSource = null, ResourceHealthEventStatusValue? status = null, string title = null, string summary = null, string header = null, ResourceHealthEventInsightLevelValue? level = null, ResourceHealthEventLevelValue? eventLevel = null, string externalIncidentId = null, string reason = null, ResourceHealthEventArticle article = null, IEnumerable links = null, DateTimeOffset? impactStartOn = null, DateTimeOffset? impactMitigationOn = null, IEnumerable impact = null, ResourceHealthEventRecommendedActions recommendedActions = null, IEnumerable faqs = null, bool? isHirEvent = null, bool? isMicrosoftSupportEnabled = null, string description = null, bool? isPlatformInitiated = null, bool? isChatWithUsEnabled = null, int? priority = null, DateTimeOffset? lastUpdateOn = null, string hirStage = null, string additionalInformationMessage = null, int? duration = null, string impactType = null) + public static ResourceHealthEventData ResourceHealthEventData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceHealthEventTypeValue? eventType = null, EventSubTypeValue? eventSubType = null, ResourceHealthEventSourceValue? eventSource = null, ResourceHealthEventStatusValue? status = null, string title = null, string summary = null, string header = null, ResourceHealthEventInsightLevelValue? level = null, ResourceHealthEventLevelValue? eventLevel = null, string externalIncidentId = null, string reason = null, ResourceHealthEventArticle article = null, IEnumerable links = null, DateTimeOffset? impactStartOn = null, DateTimeOffset? impactMitigationOn = null, IEnumerable impact = null, ResourceHealthEventRecommendedActions recommendedActions = null, IEnumerable faqs = null, bool? isHirEvent = null, bool? isMicrosoftSupportEnabled = null, string description = null, bool? isPlatformInitiated = null, bool? isChatWithUsEnabled = null, int? priority = null, DateTimeOffset? lastUpdateOn = null, string hirStage = null, string additionalInformationMessage = null, int? duration = null, string impactType = null, string maintenanceId = null, string maintenanceType = null, string argQuery = null) { links ??= new List(); impact ??= new List(); faqs ??= new List(); - return new ResourceHealthEventData(id, name, resourceType, systemData, eventType, eventSource, status, title, summary, header, level, eventLevel, externalIncidentId, reason, article, links?.ToList(), impactStartOn, impactMitigationOn, impact?.ToList(), recommendedActions, faqs?.ToList(), isHirEvent, isMicrosoftSupportEnabled, description, isPlatformInitiated, isChatWithUsEnabled, priority, lastUpdateOn, hirStage, additionalInformationMessage != null ? new ResourceHealthEventAdditionalInformation(additionalInformationMessage) : null, duration, impactType); + return new ResourceHealthEventData(id, name, resourceType, systemData, eventType, eventSubType, eventSource, status, title, summary, header, level, eventLevel, externalIncidentId, reason, article, links?.ToList(), impactStartOn, impactMitigationOn, impact?.ToList(), recommendedActions, faqs?.ToList(), isHirEvent, isMicrosoftSupportEnabled, description, isPlatformInitiated, isChatWithUsEnabled, priority, lastUpdateOn, hirStage, additionalInformationMessage != null ? new ResourceHealthEventAdditionalInformation(additionalInformationMessage) : null, duration, impactType, maintenanceId, maintenanceType, argQuery); } /// Initializes a new instance of ResourceHealthEventArticle. diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 6392c0823ce20..0000000000000 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ResourceHealth.Models; - -namespace Azure.ResourceManager.ResourceHealth -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _availabilityStatusesClientDiagnostics; - private AvailabilityStatusesRestOperations _availabilityStatusesRestClient; - private ClientDiagnostics _eventsClientDiagnostics; - private EventsRestOperations _eventsRestClient; - private ClientDiagnostics _childAvailabilityStatusesClientDiagnostics; - private ChildAvailabilityStatusesRestOperations _childAvailabilityStatusesRestClient; - private ClientDiagnostics _childResourcesClientDiagnostics; - private ChildResourcesRestOperations _childResourcesRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics AvailabilityStatusesClientDiagnostics => _availabilityStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailabilityStatusesRestOperations AvailabilityStatusesRestClient => _availabilityStatusesRestClient ??= new AvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics EventsClientDiagnostics => _eventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private EventsRestOperations EventsRestClient => _eventsRestClient ??= new EventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ChildAvailabilityStatusesClientDiagnostics => _childAvailabilityStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ChildAvailabilityStatusesRestOperations ChildAvailabilityStatusesRestClient => _childAvailabilityStatusesRestClient ??= new ChildAvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ChildResourcesClientDiagnostics => _childResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ChildResourcesRestOperations ChildResourcesRestClient => _childResourcesRestClient ??= new ChildResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets current availability status for a single resource - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current - /// - /// - /// Operation Id - /// AvailabilityStatuses_GetByResource - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - public virtual async Task> GetAvailabilityStatusAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = AvailabilityStatusesClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetAvailabilityStatus"); - scope.Start(); - try - { - var response = await AvailabilityStatusesRestClient.GetByResourceAsync(Id, filter, expand, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets current availability status for a single resource - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current - /// - /// - /// Operation Id - /// AvailabilityStatuses_GetByResource - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - public virtual Response GetAvailabilityStatus(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = AvailabilityStatusesClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetAvailabilityStatus"); - scope.Start(); - try - { - var response = AvailabilityStatusesRestClient.GetByResource(Id, filter, expand, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all historical availability transitions and impacting events for a single resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses - /// - /// - /// Operation Id - /// AvailabilityStatuses_List - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailabilityStatusesAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListRequest(Id, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListNextPageRequest(nextLink, Id, filter, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetAvailabilityStatuses", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all historical availability transitions and impacting events for a single resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses - /// - /// - /// Operation Id - /// AvailabilityStatuses_List - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailabilityStatuses(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListRequest(Id, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListNextPageRequest(nextLink, Id, filter, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetAvailabilityStatuses", "value", "nextLink", cancellationToken); - } - - /// - /// Lists current service health events for given resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/events - /// - /// - /// Operation Id - /// Events_ListBySingleResource - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHealthEventsOfSingleResourceAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventsRestClient.CreateListBySingleResourceRequest(Id, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventsRestClient.CreateListBySingleResourceNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthEventData.DeserializeResourceHealthEventData, EventsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetHealthEventsOfSingleResource", "value", "nextLink", cancellationToken); - } - - /// - /// Lists current service health events for given resource. - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/events - /// - /// - /// Operation Id - /// Events_ListBySingleResource - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHealthEventsOfSingleResource(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => EventsRestClient.CreateListBySingleResourceRequest(Id, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventsRestClient.CreateListBySingleResourceNextPageRequest(nextLink, Id, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthEventData.DeserializeResourceHealthEventData, EventsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetHealthEventsOfSingleResource", "value", "nextLink", cancellationToken); - } - - /// - /// Gets current availability status for a single resource - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current - /// - /// - /// Operation Id - /// ChildAvailabilityStatuses_GetByResource - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - public virtual async Task> GetAvailabilityStatusOfChildResourceAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = ChildAvailabilityStatusesClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetAvailabilityStatusOfChildResource"); - scope.Start(); - try - { - var response = await ChildAvailabilityStatusesRestClient.GetByResourceAsync(Id, filter, expand, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets current availability status for a single resource - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current - /// - /// - /// Operation Id - /// ChildAvailabilityStatuses_GetByResource - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - public virtual Response GetAvailabilityStatusOfChildResource(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - using var scope = ChildAvailabilityStatusesClientDiagnostics.CreateScope("ArmResourceExtensionClient.GetAvailabilityStatusOfChildResource"); - scope.Start(); - try - { - var response = ChildAvailabilityStatusesRestClient.GetByResource(Id, filter, expand, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses - /// - /// - /// Operation Id - /// ChildAvailabilityStatuses_List - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHistoricalAvailabilityStatusesOfChildResourceAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChildAvailabilityStatusesRestClient.CreateListRequest(Id, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChildAvailabilityStatusesRestClient.CreateListNextPageRequest(nextLink, Id, filter, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, ChildAvailabilityStatusesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetHistoricalAvailabilityStatusesOfChildResource", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses - /// - /// - /// Operation Id - /// ChildAvailabilityStatuses_List - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHistoricalAvailabilityStatusesOfChildResource(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChildAvailabilityStatusesRestClient.CreateListRequest(Id, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChildAvailabilityStatusesRestClient.CreateListNextPageRequest(nextLink, Id, filter, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, ChildAvailabilityStatusesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetHistoricalAvailabilityStatusesOfChildResource", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/childResources - /// - /// - /// Operation Id - /// ChildResources_List - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailabilityStatusOfChildResourcesAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChildResourcesRestClient.CreateListRequest(Id, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChildResourcesRestClient.CreateListNextPageRequest(nextLink, Id, filter, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, ChildResourcesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetAvailabilityStatusOfChildResources", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health - /// - /// - /// Request Path - /// /{resourceUri}/providers/Microsoft.ResourceHealth/childResources - /// - /// - /// Operation Id - /// ChildResources_List - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailabilityStatusOfChildResources(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ChildResourcesRestClient.CreateListRequest(Id, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChildResourcesRestClient.CreateListNextPageRequest(nextLink, Id, filter, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, ChildResourcesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetAvailabilityStatusOfChildResources", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthArmClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthArmClient.cs new file mode 100644 index 0000000000000..ec87b37524d98 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthArmClient.cs @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableResourceHealthArmClient : ArmResource + { + private ClientDiagnostics _availabilityStatusesClientDiagnostics; + private AvailabilityStatusesRestOperations _availabilityStatusesRestClient; + private ClientDiagnostics _eventsClientDiagnostics; + private EventsRestOperations _eventsRestClient; + private ClientDiagnostics _childAvailabilityStatusesClientDiagnostics; + private ChildAvailabilityStatusesRestOperations _childAvailabilityStatusesRestClient; + private ClientDiagnostics _childResourcesClientDiagnostics; + private ChildResourcesRestOperations _childResourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourceHealthArmClient() + { + } + + /// 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 MockableResourceHealthArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableResourceHealthArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics AvailabilityStatusesClientDiagnostics => _availabilityStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailabilityStatusesRestOperations AvailabilityStatusesRestClient => _availabilityStatusesRestClient ??= new AvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics EventsClientDiagnostics => _eventsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private EventsRestOperations EventsRestClient => _eventsRestClient ??= new EventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ChildAvailabilityStatusesClientDiagnostics => _childAvailabilityStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ChildAvailabilityStatusesRestOperations ChildAvailabilityStatusesRestClient => _childAvailabilityStatusesRestClient ??= new ChildAvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ChildResourcesClientDiagnostics => _childResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ChildResourcesRestOperations ChildResourcesRestClient => _childResourcesRestClient ??= new ChildResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets current availability status for a single resource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current + /// + /// + /// Operation Id + /// AvailabilityStatuses_GetByResource + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + public virtual async Task> GetAvailabilityStatusAsync(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + using var scope0 = AvailabilityStatusesClientDiagnostics.CreateScope("MockableResourceHealthArmClient.GetAvailabilityStatus"); + scope0.Start(); + try + { + var response = await AvailabilityStatusesRestClient.GetByResourceAsync(scope, filter, expand, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Gets current availability status for a single resource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current + /// + /// + /// Operation Id + /// AvailabilityStatuses_GetByResource + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + public virtual Response GetAvailabilityStatus(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + using var scope0 = AvailabilityStatusesClientDiagnostics.CreateScope("MockableResourceHealthArmClient.GetAvailabilityStatus"); + scope0.Start(); + try + { + var response = AvailabilityStatusesRestClient.GetByResource(scope, filter, expand, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists all historical availability transitions and impacting events for a single resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses + /// + /// + /// Operation Id + /// AvailabilityStatuses_List + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailabilityStatusesAsync(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListRequest(scope, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListNextPageRequest(nextLink, scope, filter, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "MockableResourceHealthArmClient.GetAvailabilityStatuses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all historical availability transitions and impacting events for a single resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses + /// + /// + /// Operation Id + /// AvailabilityStatuses_List + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailabilityStatuses(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListRequest(scope, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListNextPageRequest(nextLink, scope, filter, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "MockableResourceHealthArmClient.GetAvailabilityStatuses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists current service health events for given resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/events + /// + /// + /// Operation Id + /// Events_ListBySingleResource + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHealthEventsOfSingleResourceAsync(ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventsRestClient.CreateListBySingleResourceRequest(scope, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventsRestClient.CreateListBySingleResourceNextPageRequest(nextLink, scope, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthEventData.DeserializeResourceHealthEventData, EventsClientDiagnostics, Pipeline, "MockableResourceHealthArmClient.GetHealthEventsOfSingleResource", "value", "nextLink", cancellationToken); + } + + /// + /// Lists current service health events for given resource. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/events + /// + /// + /// Operation Id + /// Events_ListBySingleResource + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHealthEventsOfSingleResource(ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventsRestClient.CreateListBySingleResourceRequest(scope, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventsRestClient.CreateListBySingleResourceNextPageRequest(nextLink, scope, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthEventData.DeserializeResourceHealthEventData, EventsClientDiagnostics, Pipeline, "MockableResourceHealthArmClient.GetHealthEventsOfSingleResource", "value", "nextLink", cancellationToken); + } + + /// + /// Gets current availability status for a single resource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current + /// + /// + /// Operation Id + /// ChildAvailabilityStatuses_GetByResource + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + public virtual async Task> GetAvailabilityStatusOfChildResourceAsync(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + using var scope0 = ChildAvailabilityStatusesClientDiagnostics.CreateScope("MockableResourceHealthArmClient.GetAvailabilityStatusOfChildResource"); + scope0.Start(); + try + { + var response = await ChildAvailabilityStatusesRestClient.GetByResourceAsync(scope, filter, expand, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Gets current availability status for a single resource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current + /// + /// + /// Operation Id + /// ChildAvailabilityStatuses_GetByResource + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + public virtual Response GetAvailabilityStatusOfChildResource(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + using var scope0 = ChildAvailabilityStatusesClientDiagnostics.CreateScope("MockableResourceHealthArmClient.GetAvailabilityStatusOfChildResource"); + scope0.Start(); + try + { + var response = ChildAvailabilityStatusesRestClient.GetByResource(scope, filter, expand, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses + /// + /// + /// Operation Id + /// ChildAvailabilityStatuses_List + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHistoricalAvailabilityStatusesOfChildResourceAsync(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChildAvailabilityStatusesRestClient.CreateListRequest(scope, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChildAvailabilityStatusesRestClient.CreateListNextPageRequest(nextLink, scope, filter, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, ChildAvailabilityStatusesClientDiagnostics, Pipeline, "MockableResourceHealthArmClient.GetHistoricalAvailabilityStatusesOfChildResource", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the historical availability statuses for a single child resource. Use the nextLink property in the response to get the next page of availability status + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses + /// + /// + /// Operation Id + /// ChildAvailabilityStatuses_List + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHistoricalAvailabilityStatusesOfChildResource(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChildAvailabilityStatusesRestClient.CreateListRequest(scope, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChildAvailabilityStatusesRestClient.CreateListNextPageRequest(nextLink, scope, filter, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, ChildAvailabilityStatusesClientDiagnostics, Pipeline, "MockableResourceHealthArmClient.GetHistoricalAvailabilityStatusesOfChildResource", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/childResources + /// + /// + /// Operation Id + /// ChildResources_List + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailabilityStatusOfChildResourcesAsync(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChildResourcesRestClient.CreateListRequest(scope, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChildResourcesRestClient.CreateListNextPageRequest(nextLink, scope, filter, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, ChildResourcesClientDiagnostics, Pipeline, "MockableResourceHealthArmClient.GetAvailabilityStatusOfChildResources", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page of children current health + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/childResources + /// + /// + /// Operation Id + /// ChildResources_List + /// + /// + /// + /// The scope to use. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailabilityStatusOfChildResources(ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ChildResourcesRestClient.CreateListRequest(scope, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ChildResourcesRestClient.CreateListNextPageRequest(nextLink, scope, filter, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, ChildResourcesClientDiagnostics, Pipeline, "MockableResourceHealthArmClient.GetAvailabilityStatusOfChildResources", "value", "nextLink", cancellationToken); + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceHealthMetadataEntityResource GetResourceHealthMetadataEntityResource(ResourceIdentifier id) + { + ResourceHealthMetadataEntityResource.ValidateResourceId(id); + return new ResourceHealthMetadataEntityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceHealthEventImpactedResource GetResourceHealthEventImpactedResource(ResourceIdentifier id) + { + ResourceHealthEventImpactedResource.ValidateResourceId(id); + return new ResourceHealthEventImpactedResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantResourceHealthEventImpactedResource GetTenantResourceHealthEventImpactedResource(ResourceIdentifier id) + { + TenantResourceHealthEventImpactedResource.ValidateResourceId(id); + return new TenantResourceHealthEventImpactedResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceHealthEventResource GetResourceHealthEventResource(ResourceIdentifier id) + { + ResourceHealthEventResource.ValidateResourceId(id); + return new ResourceHealthEventResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantResourceHealthEventResource GetTenantResourceHealthEventResource(ResourceIdentifier id) + { + TenantResourceHealthEventResource.ValidateResourceId(id); + return new TenantResourceHealthEventResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceEmergingIssueResource GetServiceEmergingIssueResource(ResourceIdentifier id) + { + ServiceEmergingIssueResource.ValidateResourceId(id); + return new ServiceEmergingIssueResource(Client, id); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthResourceGroupResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthResourceGroupResource.cs new file mode 100644 index 0000000000000..424fde00f2391 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthResourceGroupResource.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableResourceHealthResourceGroupResource : ArmResource + { + private ClientDiagnostics _availabilityStatusesClientDiagnostics; + private AvailabilityStatusesRestOperations _availabilityStatusesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourceHealthResourceGroupResource() + { + } + + /// 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 MockableResourceHealthResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AvailabilityStatusesClientDiagnostics => _availabilityStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailabilityStatusesRestOperations AvailabilityStatusesRestClient => _availabilityStatusesRestClient ??= new AvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the current availability status for all the resources in the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses + /// + /// + /// Operation Id + /// AvailabilityStatuses_ListByResourceGroup + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailabilityStatusesByResourceGroupAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "MockableResourceHealthResourceGroupResource.GetAvailabilityStatusesByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the current availability status for all the resources in the resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses + /// + /// + /// Operation Id + /// AvailabilityStatuses_ListByResourceGroup + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailabilityStatusesByResourceGroup(string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "MockableResourceHealthResourceGroupResource.GetAvailabilityStatusesByResourceGroup", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthSubscriptionResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthSubscriptionResource.cs new file mode 100644 index 0000000000000..dd2a55002162b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthSubscriptionResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableResourceHealthSubscriptionResource : ArmResource + { + private ClientDiagnostics _availabilityStatusesClientDiagnostics; + private AvailabilityStatusesRestOperations _availabilityStatusesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourceHealthSubscriptionResource() + { + } + + /// 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 MockableResourceHealthSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AvailabilityStatusesClientDiagnostics => _availabilityStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AvailabilityStatusesRestOperations AvailabilityStatusesRestClient => _availabilityStatusesRestClient ??= new AvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ResourceHealthEventResources in the SubscriptionResource. + /// An object representing collection of ResourceHealthEventResources and their operations over a ResourceHealthEventResource. + public virtual ResourceHealthEventCollection GetResourceHealthEvents() + { + return GetCachedClient(client => new ResourceHealthEventCollection(client, Id)); + } + + /// + /// Service health event in the subscription by event tracking id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceHealthEventAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + return await GetResourceHealthEvents().GetAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + } + + /// + /// Service health event in the subscription by event tracking id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceHealthEvent(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + return GetResourceHealthEvents().Get(eventTrackingId, filter, queryStartTime, cancellationToken); + } + + /// + /// Lists the current availability status for all the resources in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses + /// + /// + /// Operation Id + /// AvailabilityStatuses_ListBySubscriptionId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailabilityStatusesBySubscriptionAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, filter, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "MockableResourceHealthSubscriptionResource.GetAvailabilityStatusesBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the current availability status for all the resources in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses + /// + /// + /// Operation Id + /// AvailabilityStatuses_ListBySubscriptionId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailabilityStatusesBySubscription(string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, filter, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, filter, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "MockableResourceHealthSubscriptionResource.GetAvailabilityStatusesBySubscription", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthTenantResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthTenantResource.cs new file mode 100644 index 0000000000000..db45c06fa8467 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/MockableResourceHealthTenantResource.cs @@ -0,0 +1,199 @@ +// 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.ResourceHealth; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableResourceHealthTenantResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourceHealthTenantResource() + { + } + + /// 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 MockableResourceHealthTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ResourceHealthMetadataEntityResources in the TenantResource. + /// An object representing collection of ResourceHealthMetadataEntityResources and their operations over a ResourceHealthMetadataEntityResource. + public virtual ResourceHealthMetadataEntityCollection GetResourceHealthMetadataEntities() + { + return GetCachedClient(client => new ResourceHealthMetadataEntityCollection(client, Id)); + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// Name of metadata entity. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceHealthMetadataEntityAsync(string name, CancellationToken cancellationToken = default) + { + return await GetResourceHealthMetadataEntities().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// Name of metadata entity. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceHealthMetadataEntity(string name, CancellationToken cancellationToken = default) + { + return GetResourceHealthMetadataEntities().Get(name, cancellationToken); + } + + /// Gets a collection of TenantResourceHealthEventResources in the TenantResource. + /// An object representing collection of TenantResourceHealthEventResources and their operations over a TenantResourceHealthEventResource. + public virtual TenantResourceHealthEventCollection GetTenantResourceHealthEvents() + { + return GetCachedClient(client => new TenantResourceHealthEventCollection(client, Id)); + } + + /// + /// Service health event in the tenant by event tracking id + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTenantResourceHealthEventAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + return await GetTenantResourceHealthEvents().GetAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + } + + /// + /// Service health event in the tenant by event tracking id + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTenantResourceHealthEvent(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + return GetTenantResourceHealthEvents().Get(eventTrackingId, filter, queryStartTime, cancellationToken); + } + + /// Gets a collection of ServiceEmergingIssueResources in the TenantResource. + /// An object representing collection of ServiceEmergingIssueResources and their operations over a ServiceEmergingIssueResource. + public virtual ServiceEmergingIssueCollection GetServiceEmergingIssues() + { + return GetCachedClient(client => new ServiceEmergingIssueCollection(client, Id)); + } + + /// + /// Gets Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The name of the emerging issue. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetServiceEmergingIssueAsync(EmergingIssueNameContent issueName, CancellationToken cancellationToken = default) + { + return await GetServiceEmergingIssues().GetAsync(issueName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The name of the emerging issue. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetServiceEmergingIssue(EmergingIssueNameContent issueName, CancellationToken cancellationToken = default) + { + return GetServiceEmergingIssues().Get(issueName, cancellationToken); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 9a4d05980f729..0000000000000 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ResourceHealth.Models; - -namespace Azure.ResourceManager.ResourceHealth -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _availabilityStatusesClientDiagnostics; - private AvailabilityStatusesRestOperations _availabilityStatusesRestClient; - - /// 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 ClientDiagnostics AvailabilityStatusesClientDiagnostics => _availabilityStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailabilityStatusesRestOperations AvailabilityStatusesRestClient => _availabilityStatusesRestClient ??= new AvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists the current availability status for all the resources in the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses - /// - /// - /// Operation Id - /// AvailabilityStatuses_ListByResourceGroup - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailabilityStatusesByResourceGroupAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailabilityStatusesByResourceGroup", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the current availability status for all the resources in the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceHealth/availabilityStatuses - /// - /// - /// Operation Id - /// AvailabilityStatuses_ListByResourceGroup - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailabilityStatusesByResourceGroup(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAvailabilityStatusesByResourceGroup", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceHealthExtensions.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceHealthExtensions.cs index c3b9ee6575d8d..a4c48f35d9f2e 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceHealthExtensions.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceHealthExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth.Mocking; using Azure.ResourceManager.ResourceHealth.Models; using Azure.ResourceManager.Resources; @@ -19,183 +20,26 @@ namespace Azure.ResourceManager.ResourceHealth /// A class to add extension methods to Azure.ResourceManager.ResourceHealth. public static partial class ResourceHealthExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableResourceHealthArmClient GetMockableResourceHealthArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableResourceHealthArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableResourceHealthResourceGroupResource GetMockableResourceHealthResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableResourceHealthResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableResourceHealthSubscriptionResource GetMockableResourceHealthSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableResourceHealthSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableResourceHealthTenantResource GetMockableResourceHealthTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableResourceHealthTenantResource(client, resource.Id)); } - 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); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region ResourceHealthMetadataEntityResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceHealthMetadataEntityResource GetResourceHealthMetadataEntityResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ResourceHealthMetadataEntityResource.ValidateResourceId(id); - return new ResourceHealthMetadataEntityResource(client, id); - } - ); - } - #endregion - - #region ResourceHealthEventImpactedResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceHealthEventImpactedResource GetResourceHealthEventImpactedResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ResourceHealthEventImpactedResource.ValidateResourceId(id); - return new ResourceHealthEventImpactedResource(client, id); - } - ); - } - #endregion - - #region TenantResourceHealthEventImpactedResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static TenantResourceHealthEventImpactedResource GetTenantResourceHealthEventImpactedResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - TenantResourceHealthEventImpactedResource.ValidateResourceId(id); - return new TenantResourceHealthEventImpactedResource(client, id); - } - ); - } - #endregion - - #region ResourceHealthEventResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceHealthEventResource GetResourceHealthEventResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ResourceHealthEventResource.ValidateResourceId(id); - return new ResourceHealthEventResource(client, id); - } - ); - } - #endregion - - #region TenantResourceHealthEventResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static TenantResourceHealthEventResource GetTenantResourceHealthEventResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - TenantResourceHealthEventResource.ValidateResourceId(id); - return new TenantResourceHealthEventResource(client, id); - } - ); - } - #endregion - - #region ServiceEmergingIssueResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ServiceEmergingIssueResource GetServiceEmergingIssueResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - ServiceEmergingIssueResource.ValidateResourceId(id); - return new ServiceEmergingIssueResource(client, id); - } - ); - } - #endregion - /// /// Gets current availability status for a single resource /// @@ -208,6 +52,10 @@ public static ServiceEmergingIssueResource GetServiceEmergingIssueResource(this /// AvailabilityStatuses_GetByResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -216,7 +64,7 @@ public static ServiceEmergingIssueResource GetServiceEmergingIssueResource(this /// The cancellation token to use. public static async Task> GetAvailabilityStatusAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return await GetArmResourceExtensionClient(client, scope).GetAvailabilityStatusAsync(filter, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceHealthArmClient(client).GetAvailabilityStatusAsync(scope, filter, expand, cancellationToken).ConfigureAwait(false); } /// @@ -231,6 +79,10 @@ public static async Task> GetAvailabi /// AvailabilityStatuses_GetByResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -239,7 +91,7 @@ public static async Task> GetAvailabi /// The cancellation token to use. public static Response GetAvailabilityStatus(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetAvailabilityStatus(filter, expand, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetAvailabilityStatus(scope, filter, expand, cancellationToken); } /// @@ -254,6 +106,10 @@ public static Response GetAvailabilityStatus(t /// AvailabilityStatuses_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -262,7 +118,7 @@ public static Response GetAvailabilityStatus(t /// The cancellation token to use. public static AsyncPageable GetAvailabilityStatusesAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetAvailabilityStatusesAsync(filter, expand, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetAvailabilityStatusesAsync(scope, filter, expand, cancellationToken); } /// @@ -277,6 +133,10 @@ public static AsyncPageable GetAvailabilitySta /// AvailabilityStatuses_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -285,7 +145,7 @@ public static AsyncPageable GetAvailabilitySta /// The cancellation token to use. public static Pageable GetAvailabilityStatuses(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetAvailabilityStatuses(filter, expand, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetAvailabilityStatuses(scope, filter, expand, cancellationToken); } /// @@ -300,6 +160,10 @@ public static Pageable GetAvailabilityStatuses /// Events_ListBySingleResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -307,7 +171,7 @@ public static Pageable GetAvailabilityStatuses /// The cancellation token to use. public static AsyncPageable GetHealthEventsOfSingleResourceAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetHealthEventsOfSingleResourceAsync(filter, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetHealthEventsOfSingleResourceAsync(scope, filter, cancellationToken); } /// @@ -322,6 +186,10 @@ public static AsyncPageable GetHealthEventsOfSingleReso /// Events_ListBySingleResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -329,7 +197,7 @@ public static AsyncPageable GetHealthEventsOfSingleReso /// The cancellation token to use. public static Pageable GetHealthEventsOfSingleResource(this ArmClient client, ResourceIdentifier scope, string filter = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetHealthEventsOfSingleResource(filter, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetHealthEventsOfSingleResource(scope, filter, cancellationToken); } /// @@ -344,6 +212,10 @@ public static Pageable GetHealthEventsOfSingleResource( /// ChildAvailabilityStatuses_GetByResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -352,7 +224,7 @@ public static Pageable GetHealthEventsOfSingleResource( /// The cancellation token to use. public static async Task> GetAvailabilityStatusOfChildResourceAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return await GetArmResourceExtensionClient(client, scope).GetAvailabilityStatusOfChildResourceAsync(filter, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceHealthArmClient(client).GetAvailabilityStatusOfChildResourceAsync(scope, filter, expand, cancellationToken).ConfigureAwait(false); } /// @@ -367,6 +239,10 @@ public static async Task> GetAvailabi /// ChildAvailabilityStatuses_GetByResource /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -375,7 +251,7 @@ public static async Task> GetAvailabi /// The cancellation token to use. public static Response GetAvailabilityStatusOfChildResource(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetAvailabilityStatusOfChildResource(filter, expand, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetAvailabilityStatusOfChildResource(scope, filter, expand, cancellationToken); } /// @@ -390,6 +266,10 @@ public static Response GetAvailabilityStatusOf /// ChildAvailabilityStatuses_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -398,7 +278,7 @@ public static Response GetAvailabilityStatusOf /// The cancellation token to use. public static AsyncPageable GetHistoricalAvailabilityStatusesOfChildResourceAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetHistoricalAvailabilityStatusesOfChildResourceAsync(filter, expand, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetHistoricalAvailabilityStatusesOfChildResourceAsync(scope, filter, expand, cancellationToken); } /// @@ -413,6 +293,10 @@ public static AsyncPageable GetHistoricalAvail /// ChildAvailabilityStatuses_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -421,7 +305,7 @@ public static AsyncPageable GetHistoricalAvail /// The cancellation token to use. public static Pageable GetHistoricalAvailabilityStatusesOfChildResource(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetHistoricalAvailabilityStatusesOfChildResource(filter, expand, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetHistoricalAvailabilityStatusesOfChildResource(scope, filter, expand, cancellationToken); } /// @@ -436,6 +320,10 @@ public static Pageable GetHistoricalAvailabili /// ChildResources_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -444,7 +332,7 @@ public static Pageable GetHistoricalAvailabili /// The cancellation token to use. public static AsyncPageable GetAvailabilityStatusOfChildResourcesAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetAvailabilityStatusOfChildResourcesAsync(filter, expand, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetAvailabilityStatusOfChildResourcesAsync(scope, filter, expand, cancellationToken); } /// @@ -459,6 +347,10 @@ public static AsyncPageable GetAvailabilitySta /// ChildResources_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -467,7 +359,103 @@ public static AsyncPageable GetAvailabilitySta /// The cancellation token to use. public static Pageable GetAvailabilityStatusOfChildResources(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetAvailabilityStatusOfChildResources(filter, expand, cancellationToken); + return GetMockableResourceHealthArmClient(client).GetAvailabilityStatusOfChildResources(scope, filter, expand, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceHealthMetadataEntityResource GetResourceHealthMetadataEntityResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableResourceHealthArmClient(client).GetResourceHealthMetadataEntityResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceHealthEventImpactedResource GetResourceHealthEventImpactedResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableResourceHealthArmClient(client).GetResourceHealthEventImpactedResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static TenantResourceHealthEventImpactedResource GetTenantResourceHealthEventImpactedResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableResourceHealthArmClient(client).GetTenantResourceHealthEventImpactedResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceHealthEventResource GetResourceHealthEventResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableResourceHealthArmClient(client).GetResourceHealthEventResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static TenantResourceHealthEventResource GetTenantResourceHealthEventResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableResourceHealthArmClient(client).GetTenantResourceHealthEventResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ServiceEmergingIssueResource GetServiceEmergingIssueResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableResourceHealthArmClient(client).GetServiceEmergingIssueResource(id); } /// @@ -482,6 +470,10 @@ public static Pageable GetAvailabilityStatusOf /// AvailabilityStatuses_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. @@ -490,7 +482,7 @@ public static Pageable GetAvailabilityStatusOf /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailabilityStatusesByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailabilityStatusesByResourceGroupAsync(filter, expand, cancellationToken); + return GetMockableResourceHealthResourceGroupResource(resourceGroupResource).GetAvailabilityStatusesByResourceGroupAsync(filter, expand, cancellationToken); } /// @@ -505,6 +497,10 @@ public static AsyncPageable GetAvailabilitySta /// AvailabilityStatuses_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. @@ -513,15 +509,21 @@ public static AsyncPageable GetAvailabilitySta /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailabilityStatusesByResourceGroup(this ResourceGroupResource resourceGroupResource, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAvailabilityStatusesByResourceGroup(filter, expand, cancellationToken); + return GetMockableResourceHealthResourceGroupResource(resourceGroupResource).GetAvailabilityStatusesByResourceGroup(filter, expand, cancellationToken); } - /// Gets a collection of ResourceHealthEventResources in the SubscriptionResource. + /// + /// Gets a collection of ResourceHealthEventResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ResourceHealthEventResources and their operations over a ResourceHealthEventResource. public static ResourceHealthEventCollection GetResourceHealthEvents(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceHealthEvents(); + return GetMockableResourceHealthSubscriptionResource(subscriptionResource).GetResourceHealthEvents(); } /// @@ -536,18 +538,22 @@ public static ResourceHealthEventCollection GetResourceHealthEvents(this Subscri /// Event_GetBySubscriptionIdAndTrackingId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Event Id which uniquely identifies ServiceHealth event. /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceHealthEventAsync(this SubscriptionResource subscriptionResource, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetResourceHealthEvents().GetAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceHealthSubscriptionResource(subscriptionResource).GetResourceHealthEventAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); } /// @@ -562,18 +568,22 @@ public static async Task> GetResourceHealt /// Event_GetBySubscriptionIdAndTrackingId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Event Id which uniquely identifies ServiceHealth event. /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceHealthEvent(this SubscriptionResource subscriptionResource, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) { - return subscriptionResource.GetResourceHealthEvents().Get(eventTrackingId, filter, queryStartTime, cancellationToken); + return GetMockableResourceHealthSubscriptionResource(subscriptionResource).GetResourceHealthEvent(eventTrackingId, filter, queryStartTime, cancellationToken); } /// @@ -588,6 +598,10 @@ public static Response GetResourceHealthEvent(this /// AvailabilityStatuses_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. @@ -596,7 +610,7 @@ public static Response GetResourceHealthEvent(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailabilityStatusesBySubscriptionAsync(this SubscriptionResource subscriptionResource, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailabilityStatusesBySubscriptionAsync(filter, expand, cancellationToken); + return GetMockableResourceHealthSubscriptionResource(subscriptionResource).GetAvailabilityStatusesBySubscriptionAsync(filter, expand, cancellationToken); } /// @@ -611,6 +625,10 @@ public static AsyncPageable GetAvailabilitySta /// AvailabilityStatuses_ListBySubscriptionId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. @@ -619,15 +637,21 @@ public static AsyncPageable GetAvailabilitySta /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailabilityStatusesBySubscription(this SubscriptionResource subscriptionResource, string filter = null, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailabilityStatusesBySubscription(filter, expand, cancellationToken); + return GetMockableResourceHealthSubscriptionResource(subscriptionResource).GetAvailabilityStatusesBySubscription(filter, expand, cancellationToken); } - /// Gets a collection of ResourceHealthMetadataEntityResources in the TenantResource. + /// + /// Gets a collection of ResourceHealthMetadataEntityResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ResourceHealthMetadataEntityResources and their operations over a ResourceHealthMetadataEntityResource. public static ResourceHealthMetadataEntityCollection GetResourceHealthMetadataEntities(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetResourceHealthMetadataEntities(); + return GetMockableResourceHealthTenantResource(tenantResource).GetResourceHealthMetadataEntities(); } /// @@ -642,16 +666,20 @@ public static ResourceHealthMetadataEntityCollection GetResourceHealthMetadataEn /// Metadata_GetEntity /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of metadata entity. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceHealthMetadataEntityAsync(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) { - return await tenantResource.GetResourceHealthMetadataEntities().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceHealthTenantResource(tenantResource).GetResourceHealthMetadataEntityAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -666,24 +694,34 @@ public static async Task> GetReso /// Metadata_GetEntity /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of metadata entity. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceHealthMetadataEntity(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) { - return tenantResource.GetResourceHealthMetadataEntities().Get(name, cancellationToken); + return GetMockableResourceHealthTenantResource(tenantResource).GetResourceHealthMetadataEntity(name, cancellationToken); } - /// Gets a collection of TenantResourceHealthEventResources in the TenantResource. + /// + /// Gets a collection of TenantResourceHealthEventResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TenantResourceHealthEventResources and their operations over a TenantResourceHealthEventResource. public static TenantResourceHealthEventCollection GetTenantResourceHealthEvents(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetTenantResourceHealthEvents(); + return GetMockableResourceHealthTenantResource(tenantResource).GetTenantResourceHealthEvents(); } /// @@ -698,18 +736,22 @@ public static TenantResourceHealthEventCollection GetTenantResourceHealthEvents( /// Event_GetByTenantIdAndTrackingId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Event Id which uniquely identifies ServiceHealth event. /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTenantResourceHealthEventAsync(this TenantResource tenantResource, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) { - return await tenantResource.GetTenantResourceHealthEvents().GetAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceHealthTenantResource(tenantResource).GetTenantResourceHealthEventAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); } /// @@ -724,26 +766,36 @@ public static async Task> GetTenantR /// Event_GetByTenantIdAndTrackingId /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Event Id which uniquely identifies ServiceHealth event. /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTenantResourceHealthEvent(this TenantResource tenantResource, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) { - return tenantResource.GetTenantResourceHealthEvents().Get(eventTrackingId, filter, queryStartTime, cancellationToken); + return GetMockableResourceHealthTenantResource(tenantResource).GetTenantResourceHealthEvent(eventTrackingId, filter, queryStartTime, cancellationToken); } - /// Gets a collection of ServiceEmergingIssueResources in the TenantResource. + /// + /// Gets a collection of ServiceEmergingIssueResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ServiceEmergingIssueResources and their operations over a ServiceEmergingIssueResource. public static ServiceEmergingIssueCollection GetServiceEmergingIssues(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetServiceEmergingIssues(); + return GetMockableResourceHealthTenantResource(tenantResource).GetServiceEmergingIssues(); } /// @@ -758,6 +810,10 @@ public static ServiceEmergingIssueCollection GetServiceEmergingIssues(this Tenan /// EmergingIssues_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the emerging issue. @@ -765,7 +821,7 @@ public static ServiceEmergingIssueCollection GetServiceEmergingIssues(this Tenan [ForwardsClientCalls] public static async Task> GetServiceEmergingIssueAsync(this TenantResource tenantResource, EmergingIssueNameContent issueName, CancellationToken cancellationToken = default) { - return await tenantResource.GetServiceEmergingIssues().GetAsync(issueName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceHealthTenantResource(tenantResource).GetServiceEmergingIssueAsync(issueName, cancellationToken).ConfigureAwait(false); } /// @@ -780,6 +836,10 @@ public static async Task> GetServiceEmerg /// EmergingIssues_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the emerging issue. @@ -787,7 +847,7 @@ public static async Task> GetServiceEmerg [ForwardsClientCalls] public static Response GetServiceEmergingIssue(this TenantResource tenantResource, EmergingIssueNameContent issueName, CancellationToken cancellationToken = default) { - return tenantResource.GetServiceEmergingIssues().Get(issueName, cancellationToken); + return GetMockableResourceHealthTenantResource(tenantResource).GetServiceEmergingIssue(issueName, cancellationToken); } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 8af0ad53a937a..0000000000000 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ResourceHealth.Models; - -namespace Azure.ResourceManager.ResourceHealth -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _availabilityStatusesClientDiagnostics; - private AvailabilityStatusesRestOperations _availabilityStatusesRestClient; - - /// 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 AvailabilityStatusesClientDiagnostics => _availabilityStatusesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AvailabilityStatusesRestOperations AvailabilityStatusesRestClient => _availabilityStatusesRestClient ??= new AvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ResourceHealthEventResources in the SubscriptionResource. - /// An object representing collection of ResourceHealthEventResources and their operations over a ResourceHealthEventResource. - public virtual ResourceHealthEventCollection GetResourceHealthEvents() - { - return GetCachedClient(Client => new ResourceHealthEventCollection(Client, Id)); - } - - /// - /// Lists the current availability status for all the resources in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses - /// - /// - /// Operation Id - /// AvailabilityStatuses_ListBySubscriptionId - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailabilityStatusesBySubscriptionAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, filter, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailabilityStatusesBySubscription", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the current availability status for all the resources in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/availabilityStatuses - /// - /// - /// Operation Id - /// AvailabilityStatuses_ListBySubscriptionId - /// - /// - /// - /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. - /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailabilityStatusesBySubscription(string filter = null, string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AvailabilityStatusesRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, filter, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AvailabilityStatusesRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, filter, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthAvailabilityStatus.DeserializeResourceHealthAvailabilityStatus, AvailabilityStatusesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailabilityStatusesBySubscription", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 4c04aeb0ced31..0000000000000 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ResourceHealth -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ResourceHealthMetadataEntityResources in the TenantResource. - /// An object representing collection of ResourceHealthMetadataEntityResources and their operations over a ResourceHealthMetadataEntityResource. - public virtual ResourceHealthMetadataEntityCollection GetResourceHealthMetadataEntities() - { - return GetCachedClient(Client => new ResourceHealthMetadataEntityCollection(Client, Id)); - } - - /// Gets a collection of TenantResourceHealthEventResources in the TenantResource. - /// An object representing collection of TenantResourceHealthEventResources and their operations over a TenantResourceHealthEventResource. - public virtual TenantResourceHealthEventCollection GetTenantResourceHealthEvents() - { - return GetCachedClient(Client => new TenantResourceHealthEventCollection(Client, Id)); - } - - /// Gets a collection of ServiceEmergingIssueResources in the TenantResource. - /// An object representing collection of ServiceEmergingIssueResources and their operations over a ServiceEmergingIssueResource. - public virtual ServiceEmergingIssueCollection GetServiceEmergingIssues() - { - return GetCachedClient(Client => new ServiceEmergingIssueCollection(Client, Id)); - } - } -} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventSubTypeValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventSubTypeValue.cs new file mode 100644 index 0000000000000..646d5287cace8 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventSubTypeValue.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Sub type of the event. Currently used to determine retirement communications for health advisory events. + public readonly partial struct EventSubTypeValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventSubTypeValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RetirementValue = "Retirement"; + + /// Retirement. + public static EventSubTypeValue Retirement { get; } = new EventSubTypeValue(RetirementValue); + /// Determines if two values are the same. + public static bool operator ==(EventSubTypeValue left, EventSubTypeValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventSubTypeValue left, EventSubTypeValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EventSubTypeValue(string value) => new EventSubTypeValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventSubTypeValue other && Equals(other); + /// + public bool Equals(EventSubTypeValue 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/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ResourceHealthEventData.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ResourceHealthEventData.Serialization.cs index ded1eebd5441e..8b899bd50fc16 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ResourceHealthEventData.Serialization.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ResourceHealthEventData.Serialization.cs @@ -27,6 +27,7 @@ internal static ResourceHealthEventData DeserializeResourceHealthEventData(JsonE ResourceType type = default; Optional systemData = default; Optional eventType = default; + Optional eventSubType = default; Optional eventSource = default; Optional status = default; Optional title = default; @@ -54,6 +55,9 @@ internal static ResourceHealthEventData DeserializeResourceHealthEventData(JsonE Optional additionalInformation = default; Optional duration = default; Optional impactType = default; + Optional maintenanceId = default; + Optional maintenanceType = default; + Optional argQuery = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -98,6 +102,15 @@ internal static ResourceHealthEventData DeserializeResourceHealthEventData(JsonE eventType = new ResourceHealthEventTypeValue(property0.Value.GetString()); continue; } + if (property0.NameEquals("eventSubType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventSubType = new EventSubTypeValue(property0.Value.GetString()); + continue; + } if (property0.NameEquals("eventSource"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -324,11 +337,26 @@ internal static ResourceHealthEventData DeserializeResourceHealthEventData(JsonE impactType = property0.Value.GetString(); continue; } + if (property0.NameEquals("maintenanceId"u8)) + { + maintenanceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("maintenanceType"u8)) + { + maintenanceType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("argQuery"u8)) + { + argQuery = property0.Value.GetString(); + continue; + } } continue; } } - return new ResourceHealthEventData(id, name, type, systemData.Value, Optional.ToNullable(eventType), Optional.ToNullable(eventSource), Optional.ToNullable(status), title.Value, summary.Value, header.Value, Optional.ToNullable(level), Optional.ToNullable(eventLevel), externalIncidentId.Value, reason.Value, article.Value, Optional.ToList(links), Optional.ToNullable(impactStartTime), Optional.ToNullable(impactMitigationTime), Optional.ToList(impact), recommendedActions.Value, Optional.ToList(faqs), Optional.ToNullable(isHIR), Optional.ToNullable(enableMicrosoftSupport), description.Value, Optional.ToNullable(platformInitiated), Optional.ToNullable(enableChatWithUs), Optional.ToNullable(priority), Optional.ToNullable(lastUpdateTime), hirStage.Value, additionalInformation.Value, Optional.ToNullable(duration), impactType.Value); + return new ResourceHealthEventData(id, name, type, systemData.Value, Optional.ToNullable(eventType), Optional.ToNullable(eventSubType), Optional.ToNullable(eventSource), Optional.ToNullable(status), title.Value, summary.Value, header.Value, Optional.ToNullable(level), Optional.ToNullable(eventLevel), externalIncidentId.Value, reason.Value, article.Value, Optional.ToList(links), Optional.ToNullable(impactStartTime), Optional.ToNullable(impactMitigationTime), Optional.ToList(impact), recommendedActions.Value, Optional.ToList(faqs), Optional.ToNullable(isHIR), Optional.ToNullable(enableMicrosoftSupport), description.Value, Optional.ToNullable(platformInitiated), Optional.ToNullable(enableChatWithUs), Optional.ToNullable(priority), Optional.ToNullable(lastUpdateTime), hirStage.Value, additionalInformation.Value, Optional.ToNullable(duration), impactType.Value, maintenanceId.Value, maintenanceType.Value, argQuery.Value); } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ResourceHealthEventImpactedResourceData.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ResourceHealthEventImpactedResourceData.Serialization.cs index 7f1803e49cff8..6ef88402fca5b 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ResourceHealthEventImpactedResourceData.Serialization.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ResourceHealthEventImpactedResourceData.Serialization.cs @@ -28,6 +28,11 @@ internal static ResourceHealthEventImpactedResourceData DeserializeResourceHealt Optional targetResourceType = default; Optional targetResourceId = default; Optional targetRegion = default; + Optional resourceName = default; + Optional resourceGroup = default; + Optional status = default; + Optional maintenanceStartTime = default; + Optional maintenanceEndTime = default; Optional> info = default; foreach (var property in element.EnumerateObject()) { @@ -87,6 +92,31 @@ internal static ResourceHealthEventImpactedResourceData DeserializeResourceHealt targetRegion = property0.Value.GetString(); continue; } + if (property0.NameEquals("resourceName"u8)) + { + resourceName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("resourceGroup"u8)) + { + resourceGroup = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status"u8)) + { + status = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("maintenanceStartTime"u8)) + { + maintenanceStartTime = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("maintenanceEndTime"u8)) + { + maintenanceEndTime = property0.Value.GetString(); + continue; + } if (property0.NameEquals("info"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -105,7 +135,7 @@ internal static ResourceHealthEventImpactedResourceData DeserializeResourceHealt continue; } } - return new ResourceHealthEventImpactedResourceData(id, name, type, systemData.Value, Optional.ToNullable(targetResourceType), targetResourceId.Value, targetRegion.Value, Optional.ToList(info)); + return new ResourceHealthEventImpactedResourceData(id, name, type, systemData.Value, Optional.ToNullable(targetResourceType), targetResourceId.Value, targetRegion.Value, resourceName.Value, resourceGroup.Value, status.Value, maintenanceStartTime.Value, maintenanceEndTime.Value, Optional.ToList(info)); } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventData.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventData.cs index 550fc508c9b25..d4ba19659f952 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventData.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventData.cs @@ -33,6 +33,7 @@ internal ResourceHealthEventData() /// The resourceType. /// The systemData. /// Type of event. + /// Sub type of the event. Currently used to determine retirement communications for health advisory events. /// Source of event. /// Current status of event. /// Title text of event. @@ -60,9 +61,13 @@ internal ResourceHealthEventData() /// Additional information. /// duration in seconds. /// The type of the impact. - internal ResourceHealthEventData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceHealthEventTypeValue? eventType, ResourceHealthEventSourceValue? eventSource, ResourceHealthEventStatusValue? status, string title, string summary, string header, ResourceHealthEventInsightLevelValue? level, ResourceHealthEventLevelValue? eventLevel, string externalIncidentId, string reason, ResourceHealthEventArticle article, IReadOnlyList links, DateTimeOffset? impactStartOn, DateTimeOffset? impactMitigationOn, IReadOnlyList impact, ResourceHealthEventRecommendedActions recommendedActions, IReadOnlyList faqs, bool? isHirEvent, bool? isMicrosoftSupportEnabled, string description, bool? isPlatformInitiated, bool? isChatWithUsEnabled, int? priority, DateTimeOffset? lastUpdateOn, string hirStage, ResourceHealthEventAdditionalInformation additionalInformation, int? duration, string impactType) : base(id, name, resourceType, systemData) + /// Unique identifier for planned maintenance event. + /// The type of planned maintenance event. + /// Azure Resource Graph query to fetch the affected resources from their existing Azure Resource Graph locations. + internal ResourceHealthEventData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceHealthEventTypeValue? eventType, EventSubTypeValue? eventSubType, ResourceHealthEventSourceValue? eventSource, ResourceHealthEventStatusValue? status, string title, string summary, string header, ResourceHealthEventInsightLevelValue? level, ResourceHealthEventLevelValue? eventLevel, string externalIncidentId, string reason, ResourceHealthEventArticle article, IReadOnlyList links, DateTimeOffset? impactStartOn, DateTimeOffset? impactMitigationOn, IReadOnlyList impact, ResourceHealthEventRecommendedActions recommendedActions, IReadOnlyList faqs, bool? isHirEvent, bool? isMicrosoftSupportEnabled, string description, bool? isPlatformInitiated, bool? isChatWithUsEnabled, int? priority, DateTimeOffset? lastUpdateOn, string hirStage, ResourceHealthEventAdditionalInformation additionalInformation, int? duration, string impactType, string maintenanceId, string maintenanceType, string argQuery) : base(id, name, resourceType, systemData) { EventType = eventType; + EventSubType = eventSubType; EventSource = eventSource; Status = status; Title = title; @@ -90,10 +95,15 @@ internal ResourceHealthEventData(ResourceIdentifier id, string name, ResourceTyp AdditionalInformation = additionalInformation; Duration = duration; ImpactType = impactType; + MaintenanceId = maintenanceId; + MaintenanceType = maintenanceType; + ArgQuery = argQuery; } /// Type of event. public ResourceHealthEventTypeValue? EventType { get; } + /// Sub type of the event. Currently used to determine retirement communications for health advisory events. + public EventSubTypeValue? EventSubType { get; } /// Source of event. public ResourceHealthEventSourceValue? EventSource { get; } /// Current status of event. @@ -154,5 +164,11 @@ public string AdditionalInformationMessage public int? Duration { get; } /// The type of the impact. public string ImpactType { get; } + /// Unique identifier for planned maintenance event. + public string MaintenanceId { get; } + /// The type of planned maintenance event. + public string MaintenanceType { get; } + /// Azure Resource Graph query to fetch the affected resources from their existing Azure Resource Graph locations. + public string ArgQuery { get; } } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResource.cs index 2916554e5a977..24c5690dcdcf9 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ResourceHealth public partial class ResourceHealthEventImpactedResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The eventTrackingId. + /// The impactedResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string eventTrackingId, string impactedResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}"; diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResourceData.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResourceData.cs index 8e39a71db8c16..7ddeae4e0ecb1 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResourceData.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventImpactedResourceData.cs @@ -32,12 +32,22 @@ internal ResourceHealthEventImpactedResourceData() /// Resource type within Microsoft cloud. /// Identity for resource within Microsoft cloud. /// Impacted resource region name. + /// Resource name of the impacted resource. + /// Resource group name of the impacted resource. + /// Status of the impacted resource. + /// Start time of maintenance for the impacted resource. + /// End time of maintenance for the impacted resource. /// Additional information. - internal ResourceHealthEventImpactedResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceType? targetResourceType, ResourceIdentifier targetResourceId, string targetRegion, IReadOnlyList info) : base(id, name, resourceType, systemData) + internal ResourceHealthEventImpactedResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceType? targetResourceType, ResourceIdentifier targetResourceId, string targetRegion, string resourceName, string resourceGroup, string status, string maintenanceStartTime, string maintenanceEndTime, IReadOnlyList info) : base(id, name, resourceType, systemData) { TargetResourceType = targetResourceType; TargetResourceId = targetResourceId; TargetRegion = targetRegion; + ResourceName = resourceName; + ResourceGroup = resourceGroup; + Status = status; + MaintenanceStartTime = maintenanceStartTime; + MaintenanceEndTime = maintenanceEndTime; Info = info; } @@ -47,6 +57,16 @@ internal ResourceHealthEventImpactedResourceData(ResourceIdentifier id, string n public ResourceIdentifier TargetResourceId { get; } /// Impacted resource region name. public string TargetRegion { get; } + /// Resource name of the impacted resource. + public string ResourceName { get; } + /// Resource group name of the impacted resource. + public string ResourceGroup { get; } + /// Status of the impacted resource. + public string Status { get; } + /// Start time of maintenance for the impacted resource. + public string MaintenanceStartTime { get; } + /// End time of maintenance for the impacted resource. + public string MaintenanceEndTime { get; } /// Additional information. public IReadOnlyList Info { get; } } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventResource.cs index 09b1556020a57..a1a89f974e7ac 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.ResourceHealth public partial class ResourceHealthEventResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The eventTrackingId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string eventTrackingId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"; @@ -96,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ResourceHealthEventImpactedResources and their operations over a ResourceHealthEventImpactedResource. public virtual ResourceHealthEventImpactedResourceCollection GetResourceHealthEventImpactedResources() { - return GetCachedClient(Client => new ResourceHealthEventImpactedResourceCollection(Client, Id)); + return GetCachedClient(client => new ResourceHealthEventImpactedResourceCollection(client, Id)); } /// @@ -114,8 +116,8 @@ public virtual ResourceHealthEventImpactedResourceCollection GetResourceHealthEv /// /// Name of the Impacted Resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetResourceHealthEventImpactedResourceAsync(string impactedResourceName, CancellationToken cancellationToken = default) { @@ -137,8 +139,8 @@ public virtual async Task> GetReso /// /// Name of the Impacted Resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetResourceHealthEventImpactedResource(string impactedResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthMetadataEntityResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthMetadataEntityResource.cs index d5dd5df0d9911..e3570a98b8627 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthMetadataEntityResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthMetadataEntityResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.ResourceHealth public partial class ResourceHealthMetadataEntityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string name) { var resourceId = $"/providers/Microsoft.ResourceHealth/metadata/{name}"; diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/AvailabilityStatusesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/AvailabilityStatusesRestOperations.cs index fabceb748bc00..15fe93f357c8c 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/AvailabilityStatusesRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/AvailabilityStatusesRestOperations.cs @@ -33,7 +33,7 @@ public AvailabilityStatusesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ChildAvailabilityStatusesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ChildAvailabilityStatusesRestOperations.cs index 65f83bcafb4f7..4025516c98357 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ChildAvailabilityStatusesRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ChildAvailabilityStatusesRestOperations.cs @@ -33,7 +33,7 @@ public ChildAvailabilityStatusesRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ChildResourcesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ChildResourcesRestOperations.cs index 5cb346b03e4b5..40e69caba2eae 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ChildResourcesRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ChildResourcesRestOperations.cs @@ -33,7 +33,7 @@ public ChildResourcesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EmergingIssuesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EmergingIssuesRestOperations.cs index 9691c9891a2bf..218b088411ec6 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EmergingIssuesRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EmergingIssuesRestOperations.cs @@ -33,7 +33,7 @@ public EmergingIssuesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventRestOperations.cs index 6b956e9f97820..fb39c828d20ce 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventRestOperations.cs @@ -32,7 +32,7 @@ public EventRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventsRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventsRestOperations.cs index 7e9a44e2d87a3..a21d358278b0a 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventsRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventsRestOperations.cs @@ -33,7 +33,7 @@ public EventsRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ImpactedResourcesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ImpactedResourcesRestOperations.cs index a4be08190e169..af689095e862a 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ImpactedResourcesRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ImpactedResourcesRestOperations.cs @@ -33,7 +33,7 @@ public ImpactedResourcesRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/MetadataRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/MetadataRestOperations.cs index 1b7ada1503f28..b1f45f76fa221 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/MetadataRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/MetadataRestOperations.cs @@ -33,7 +33,7 @@ public MetadataRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/SecurityAdvisoryImpactedResourcesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/SecurityAdvisoryImpactedResourcesRestOperations.cs index bb3dcb6c309c3..e3176d4b0c94a 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/SecurityAdvisoryImpactedResourcesRestOperations.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/SecurityAdvisoryImpactedResourcesRestOperations.cs @@ -33,7 +33,7 @@ public SecurityAdvisoryImpactedResourcesRestOperations(HttpPipeline pipeline, st { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-10-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ServiceEmergingIssueResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ServiceEmergingIssueResource.cs index d6e52429040e0..30bec77376ffc 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ServiceEmergingIssueResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ServiceEmergingIssueResource.cs @@ -27,6 +27,7 @@ namespace Azure.ResourceManager.ResourceHealth public partial class ServiceEmergingIssueResource : ArmResource { /// Generate the resource identifier of a instance. + /// The issueName. public static ResourceIdentifier CreateResourceIdentifier(EmergingIssueNameContent issueName) { var resourceId = $"/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"; diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResource.cs index 1eeeb61759ed1..34d8ea23b125f 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.ResourceHealth public partial class TenantResourceHealthEventImpactedResource : ArmResource { /// Generate the resource identifier of a instance. + /// The eventTrackingId. + /// The impactedResourceName. public static ResourceIdentifier CreateResourceIdentifier(string eventTrackingId, string impactedResourceName) { var resourceId = $"/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}"; diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventResource.cs index f7eae09250fd2..487dea5038302 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventResource.cs @@ -27,6 +27,7 @@ namespace Azure.ResourceManager.ResourceHealth public partial class TenantResourceHealthEventResource : ArmResource { /// Generate the resource identifier of a instance. + /// The eventTrackingId. public static ResourceIdentifier CreateResourceIdentifier(string eventTrackingId) { var resourceId = $"/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"; @@ -96,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of TenantResourceHealthEventImpactedResources and their operations over a TenantResourceHealthEventImpactedResource. public virtual TenantResourceHealthEventImpactedResourceCollection GetTenantResourceHealthEventImpactedResources() { - return GetCachedClient(Client => new TenantResourceHealthEventImpactedResourceCollection(Client, Id)); + return GetCachedClient(client => new TenantResourceHealthEventImpactedResourceCollection(client, Id)); } /// @@ -114,8 +115,8 @@ public virtual TenantResourceHealthEventImpactedResourceCollection GetTenantReso /// /// Name of the Impacted Resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTenantResourceHealthEventImpactedResourceAsync(string impactedResourceName, CancellationToken cancellationToken = default) { @@ -137,8 +138,8 @@ public virtual async Task> G /// /// Name of the Impacted Resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTenantResourceHealthEventImpactedResource(string impactedResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/autorest.md b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/autorest.md index c9612d90b23e2..0e30a70387c33 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/autorest.md +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/autorest.md @@ -7,8 +7,8 @@ azure-arm: true csharp: true library-name: ResourceHealth namespace: Azure.ResourceManager.ResourceHealth -require: https://github.com/Azure/azure-rest-api-specs/blob/56b585b014e28a73a0a7831e27b93fa803effead/specification/resourcehealth/resource-manager/readme.md -# tag: package-2022-10 +require: https://github.com/Azure/azure-rest-api-specs/blob/4bafbf3ab1532e390ad5757433679e9ebb5cbf38/specification/resourcehealth/resource-manager/readme.md +tag: package-preview-2023-10 output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/Azure.ResourceManager.ResourceHealth.Tests.csproj b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/Azure.ResourceManager.ResourceHealth.Tests.csproj index cdff0dc86a67f..4a9d8679070fa 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/Azure.ResourceManager.ResourceHealth.Tests.csproj +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/Azure.ResourceManager.ResourceHealth.Tests.csproj @@ -1,5 +1,6 @@  + diff --git a/sdk/resourcemanager/Azure.ResourceManager/CHANGELOG.md b/sdk/resourcemanager/Azure.ResourceManager/CHANGELOG.md index 273157f0234e8..405ad40cfbc84 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/CHANGELOG.md +++ b/sdk/resourcemanager/Azure.ResourceManager/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.8.0-beta.1 (Unreleased) +## 1.9.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,18 @@ ### Other Changes +## 1.8.0 (2023-11-02) + +### Features Added + +- Add a new method `GetCachedClient` in `ArmClient` class to unify the mocking experience. + +## 1.8.0-beta.1 (2023-08-09) + +### Features Added + +- Add a method `GetCachedClient` in `ArmClient` to enable mocking for extension methods. + ## 1.7.0 (2023-07-13) ### Other Changes diff --git a/sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.netstandard2.0.cs b/sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.netstandard2.0.cs index cc24bf48286d3..22f2d2c0cee51 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.netstandard2.0.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.netstandard2.0.cs @@ -6,6 +6,8 @@ protected ArmClient() { } public ArmClient(Azure.Core.TokenCredential credential) { } public ArmClient(Azure.Core.TokenCredential credential, string defaultSubscriptionId) { } public ArmClient(Azure.Core.TokenCredential credential, string defaultSubscriptionId, Azure.ResourceManager.ArmClientOptions options) { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual T GetCachedClient(System.Func clientFactory) where T : class { throw null; } public virtual Azure.ResourceManager.Resources.DataPolicyManifestResource GetDataPolicyManifestResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Resources.SubscriptionResource GetDefaultSubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetDefaultSubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ArmClient.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ArmClient.cs index bd5e08106bbb7..299382350158d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ArmClient.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ArmClient.cs @@ -297,5 +297,19 @@ public virtual T GetResourceClient(Func resourceFactory) { return resourceFactory(); } + + private readonly ConcurrentDictionary _clientCache = new ConcurrentDictionary(); + + /// + /// Gets a cached client to use for extension methods. + /// + /// The type of client to get. + /// The constructor factory for the client. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual T GetCachedClient(Func clientFactory) + where T : class + { + return _clientCache.GetOrAdd(typeof(T), (type) => { return clientFactory(this); }) as T; + } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Azure.ResourceManager.csproj b/sdk/resourcemanager/Azure.ResourceManager/src/Azure.ResourceManager.csproj index ae1199288bd50..2fc248100e6d5 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Azure.ResourceManager.csproj +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Azure.ResourceManager.csproj @@ -1,9 +1,9 @@ - 1.8.0-beta.1 + 1.9.0-beta.1 - 1.7.0 + 1.8.0 Azure.ResourceManager Microsoft Azure Resource Manager client SDK for Azure resources. azure;management;resource diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/ArmClient.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/ArmClient.cs index a814527cc301a..efe91fb3ac3fd 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/ArmClient.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/ArmClient.cs @@ -12,7 +12,6 @@ namespace Azure.ResourceManager { public partial class ArmClient { - #region ManagementGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -24,6 +23,5 @@ public virtual ManagementGroupResource GetManagementGroupResource(ResourceIdenti ManagementGroupResource.ValidateResourceId(id); return new ManagementGroupResource(this, id); } - #endregion } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/TenantResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/TenantResource.cs index 23b27abc58a10..a37ed36bd5118 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/TenantResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/TenantResource.cs @@ -21,7 +21,7 @@ public partial class TenantResource /// An object representing collection of ManagementGroupResources and their operations over a ManagementGroupResource. public virtual ManagementGroupCollection GetManagementGroups() { - return GetCachedClient(Client => new ManagementGroupCollection(Client, Id)); + return GetCachedClient(client => new ManagementGroupCollection(client, Id)); } /// @@ -44,8 +44,8 @@ public virtual ManagementGroupCollection GetManagementGroups() /// A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription'). /// Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagementGroupAsync(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default) { @@ -72,8 +72,8 @@ public virtual async Task> GetManagementGroupA /// A filter which allows the exclusion of subscriptions from results (i.e. '$filter=children.childType ne Subscription'). /// Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagementGroup(string groupId, ManagementGroupExpandType? expand = null, bool? recurse = null, string filter = null, string cacheControl = null, CancellationToken cancellationToken = default) { diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/ManagementGroupResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/ManagementGroupResource.cs index 31ac7af545c96..28e238b73a418 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/ManagementGroupResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/ManagementGroupResource.cs @@ -28,6 +28,7 @@ namespace Azure.ResourceManager.ManagementGroups public partial class ManagementGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The groupId. public static ResourceIdentifier CreateResourceIdentifier(string groupId) { var resourceId = $"/providers/Microsoft.Management/managementGroups/{groupId}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/DataPolicyManifestResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/DataPolicyManifestResource.cs index 7ca847d8f0d7a..de428c96443af 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/DataPolicyManifestResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/DataPolicyManifestResource.cs @@ -25,6 +25,7 @@ namespace Azure.ResourceManager.Resources public partial class DataPolicyManifestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The policyMode. public static ResourceIdentifier CreateResourceIdentifier(string policyMode) { var resourceId = $"/providers/Microsoft.Authorization/dataPolicyManifests/{policyMode}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmClient.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmClient.cs index 343be1099c6e6..aafe5e771b67a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmClient.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmClient.cs @@ -12,7 +12,6 @@ namespace Azure.ResourceManager { public partial class ArmClient { - #region PolicyAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -24,9 +23,7 @@ public virtual PolicyAssignmentResource GetPolicyAssignmentResource(ResourceIden PolicyAssignmentResource.ValidateResourceId(id); return new PolicyAssignmentResource(this, id); } - #endregion - #region ResourceProviderResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -38,9 +35,7 @@ public virtual ResourceProviderResource GetResourceProviderResource(ResourceIden ResourceProviderResource.ValidateResourceId(id); return new ResourceProviderResource(this, id); } - #endregion - #region ResourceGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -52,9 +47,7 @@ public virtual ResourceGroupResource GetResourceGroupResource(ResourceIdentifier ResourceGroupResource.ValidateResourceId(id); return new ResourceGroupResource(this, id); } - #endregion - #region TagResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -66,9 +59,7 @@ public virtual TagResource GetTagResource(ResourceIdentifier id) TagResource.ValidateResourceId(id); return new TagResource(this, id); } - #endregion - #region SubscriptionPolicyDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -80,9 +71,7 @@ public virtual SubscriptionPolicyDefinitionResource GetSubscriptionPolicyDefinit SubscriptionPolicyDefinitionResource.ValidateResourceId(id); return new SubscriptionPolicyDefinitionResource(this, id); } - #endregion - #region TenantPolicyDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -94,9 +83,7 @@ public virtual TenantPolicyDefinitionResource GetTenantPolicyDefinitionResource( TenantPolicyDefinitionResource.ValidateResourceId(id); return new TenantPolicyDefinitionResource(this, id); } - #endregion - #region ManagementGroupPolicyDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -108,9 +95,7 @@ public virtual ManagementGroupPolicyDefinitionResource GetManagementGroupPolicyD ManagementGroupPolicyDefinitionResource.ValidateResourceId(id); return new ManagementGroupPolicyDefinitionResource(this, id); } - #endregion - #region SubscriptionPolicySetDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -122,9 +107,7 @@ public virtual SubscriptionPolicySetDefinitionResource GetSubscriptionPolicySetD SubscriptionPolicySetDefinitionResource.ValidateResourceId(id); return new SubscriptionPolicySetDefinitionResource(this, id); } - #endregion - #region TenantPolicySetDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -136,9 +119,7 @@ public virtual TenantPolicySetDefinitionResource GetTenantPolicySetDefinitionRes TenantPolicySetDefinitionResource.ValidateResourceId(id); return new TenantPolicySetDefinitionResource(this, id); } - #endregion - #region ManagementGroupPolicySetDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -150,9 +131,7 @@ public virtual ManagementGroupPolicySetDefinitionResource GetManagementGroupPoli ManagementGroupPolicySetDefinitionResource.ValidateResourceId(id); return new ManagementGroupPolicySetDefinitionResource(this, id); } - #endregion - #region DataPolicyManifestResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -164,9 +143,7 @@ public virtual DataPolicyManifestResource GetDataPolicyManifestResource(Resource DataPolicyManifestResource.ValidateResourceId(id); return new DataPolicyManifestResource(this, id); } - #endregion - #region ManagementLockResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -178,9 +155,7 @@ public virtual ManagementLockResource GetManagementLockResource(ResourceIdentifi ManagementLockResource.ValidateResourceId(id); return new ManagementLockResource(this, id); } - #endregion - #region SubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -192,9 +167,7 @@ public virtual SubscriptionResource GetSubscriptionResource(ResourceIdentifier i SubscriptionResource.ValidateResourceId(id); return new SubscriptionResource(this, id); } - #endregion - #region FeatureResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -206,6 +179,5 @@ public virtual FeatureResource GetFeatureResource(ResourceIdentifier id) FeatureResource.ValidateResourceId(id); return new FeatureResource(this, id); } - #endregion } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmResource.cs index 17887414b18ee..e4448ac475f0e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmResource.cs @@ -20,7 +20,7 @@ public partial class ArmResource /// An object representing collection of PolicyAssignmentResources and their operations over a PolicyAssignmentResource. public virtual PolicyAssignmentCollection GetPolicyAssignments() { - return GetCachedClient(Client => new PolicyAssignmentCollection(Client, Id)); + return GetCachedClient(client => new PolicyAssignmentCollection(client, Id)); } /// @@ -38,8 +38,8 @@ public virtual PolicyAssignmentCollection GetPolicyAssignments() /// /// The name of the policy assignment to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetPolicyAssignmentAsync(string policyAssignmentName, CancellationToken cancellationToken = default) { @@ -61,8 +61,8 @@ public virtual async Task> GetPolicyAssignmen /// /// The name of the policy assignment to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetPolicyAssignment(string policyAssignmentName, CancellationToken cancellationToken = default) { @@ -73,7 +73,7 @@ public virtual Response GetPolicyAssignment(string pol /// An object representing collection of ManagementLockResources and their operations over a ManagementLockResource. public virtual ManagementLockCollection GetManagementLocks() { - return GetCachedClient(Client => new ManagementLockCollection(Client, Id)); + return GetCachedClient(client => new ManagementLockCollection(client, Id)); } /// @@ -91,8 +91,8 @@ public virtual ManagementLockCollection GetManagementLocks() /// /// The name of lock. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagementLockAsync(string lockName, CancellationToken cancellationToken = default) { @@ -114,8 +114,8 @@ public virtual async Task> GetManagementLockAsy /// /// The name of lock. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagementLock(string lockName, CancellationToken cancellationToken = default) { diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ManagementGroupResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ManagementGroupResource.cs index 7a691d92ccdec..2ec479d582f2f 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ManagementGroupResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ManagementGroupResource.cs @@ -20,7 +20,7 @@ public partial class ManagementGroupResource /// An object representing collection of ManagementGroupPolicyDefinitionResources and their operations over a ManagementGroupPolicyDefinitionResource. public virtual ManagementGroupPolicyDefinitionCollection GetManagementGroupPolicyDefinitions() { - return GetCachedClient(Client => new ManagementGroupPolicyDefinitionCollection(Client, Id)); + return GetCachedClient(client => new ManagementGroupPolicyDefinitionCollection(client, Id)); } /// @@ -38,8 +38,8 @@ public virtual ManagementGroupPolicyDefinitionCollection GetManagementGroupPolic /// /// The name of the policy definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagementGroupPolicyDefinitionAsync(string policyDefinitionName, CancellationToken cancellationToken = default) { @@ -61,8 +61,8 @@ public virtual async Task> Get /// /// The name of the policy definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagementGroupPolicyDefinition(string policyDefinitionName, CancellationToken cancellationToken = default) { @@ -73,7 +73,7 @@ public virtual Response GetManagementGr /// An object representing collection of ManagementGroupPolicySetDefinitionResources and their operations over a ManagementGroupPolicySetDefinitionResource. public virtual ManagementGroupPolicySetDefinitionCollection GetManagementGroupPolicySetDefinitions() { - return GetCachedClient(Client => new ManagementGroupPolicySetDefinitionCollection(Client, Id)); + return GetCachedClient(client => new ManagementGroupPolicySetDefinitionCollection(client, Id)); } /// @@ -91,8 +91,8 @@ public virtual ManagementGroupPolicySetDefinitionCollection GetManagementGroupPo /// /// The name of the policy set definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagementGroupPolicySetDefinitionAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) { @@ -114,8 +114,8 @@ public virtual async Task> /// /// The name of the policy set definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagementGroupPolicySetDefinition(string policySetDefinitionName, CancellationToken cancellationToken = default) { diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/FeatureResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/FeatureResource.cs index 074732fee98f1..319647d2b0fbf 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/FeatureResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/FeatureResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Resources public partial class FeatureResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceProviderNamespace. + /// The featureName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceProviderNamespace, string featureName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicyDefinitionResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicyDefinitionResource.cs index c1e719658a9a4..e12825dfa142b 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicyDefinitionResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicyDefinitionResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Resources public partial class ManagementGroupPolicyDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The policyDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string policyDefinitionName) { var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicySetDefinitionResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicySetDefinitionResource.cs index b90afe192e518..5b15d554bc2d3 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicySetDefinitionResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementGroupPolicySetDefinitionResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Resources public partial class ManagementGroupPolicySetDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The managementGroupId. + /// The policySetDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string managementGroupId, string policySetDefinitionName) { var resourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementLockResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementLockResource.cs index c0a88dffa3626..37c1f28712144 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementLockResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ManagementLockResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Resources public partial class ManagementLockResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The lockName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string lockName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/locks/{lockName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/PolicyAssignmentResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/PolicyAssignmentResource.cs index 24e4aee9cf94c..4ccae65b1a05b 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/PolicyAssignmentResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/PolicyAssignmentResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Resources public partial class PolicyAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The policyAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string policyAssignmentName) { var resourceId = $"{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceGroupResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceGroupResource.cs index f512d44e81f42..7c6555742e456 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceGroupResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceGroupResource.cs @@ -28,6 +28,8 @@ namespace Azure.ResourceManager.Resources public partial class ResourceGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderResource.cs index ff5de33788f6f..b51dcbafcd8d0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.Resources public partial class ResourceProviderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceProviderNamespace. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceProviderNamespace) { var resourceId = $"/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}"; @@ -96,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FeatureResources and their operations over a FeatureResource. public virtual FeatureCollection GetFeatures() { - return GetCachedClient(Client => new FeatureCollection(Client, Id)); + return GetCachedClient(client => new FeatureCollection(client, Id)); } /// @@ -114,8 +116,8 @@ public virtual FeatureCollection GetFeatures() /// /// The name of the feature to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFeatureAsync(string featureName, CancellationToken cancellationToken = default) { @@ -137,8 +139,8 @@ public virtual async Task> GetFeatureAsync(string feat /// /// The name of the feature to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFeature(string featureName, CancellationToken cancellationToken = default) { diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicyDefinitionResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicyDefinitionResource.cs index c6ab8f3e73f1f..93311bbbe6d21 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicyDefinitionResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicyDefinitionResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Resources public partial class SubscriptionPolicyDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The policyDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string policyDefinitionName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicySetDefinitionResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicySetDefinitionResource.cs index f02eb7ca5f03f..9192245b1c1cf 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicySetDefinitionResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionPolicySetDefinitionResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Resources public partial class SubscriptionPolicySetDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The policySetDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string policySetDefinitionName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionResource.cs index 54d1b93d2d768..0b1ed4ffb7305 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionResource.cs @@ -27,6 +27,7 @@ namespace Azure.ResourceManager.Resources public partial class SubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId) { var resourceId = $"/subscriptions/{subscriptionId}"; @@ -107,7 +108,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ResourceProviderResources and their operations over a ResourceProviderResource. public virtual ResourceProviderCollection GetResourceProviders() { - return GetCachedClient(Client => new ResourceProviderCollection(Client, Id)); + return GetCachedClient(client => new ResourceProviderCollection(client, Id)); } /// @@ -126,8 +127,8 @@ public virtual ResourceProviderCollection GetResourceProviders() /// The namespace of the resource provider. /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetResourceProviderAsync(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) { @@ -150,8 +151,8 @@ public virtual async Task> GetResourceProvide /// The namespace of the resource provider. /// The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetResourceProvider(string resourceProviderNamespace, string expand = null, CancellationToken cancellationToken = default) { @@ -162,7 +163,7 @@ public virtual Response GetResourceProvider(string res /// An object representing collection of ResourceGroupResources and their operations over a ResourceGroupResource. public virtual ResourceGroupCollection GetResourceGroups() { - return GetCachedClient(Client => new ResourceGroupCollection(Client, Id)); + return GetCachedClient(client => new ResourceGroupCollection(client, Id)); } /// @@ -180,8 +181,8 @@ public virtual ResourceGroupCollection GetResourceGroups() /// /// The name of the resource group to get. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) { @@ -203,8 +204,8 @@ public virtual async Task> GetResourceGroupAsync /// /// The name of the resource group to get. The name is case insensitive. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) { @@ -215,7 +216,7 @@ public virtual Response GetResourceGroup(string resourceG /// An object representing collection of SubscriptionPolicyDefinitionResources and their operations over a SubscriptionPolicyDefinitionResource. public virtual SubscriptionPolicyDefinitionCollection GetSubscriptionPolicyDefinitions() { - return GetCachedClient(Client => new SubscriptionPolicyDefinitionCollection(Client, Id)); + return GetCachedClient(client => new SubscriptionPolicyDefinitionCollection(client, Id)); } /// @@ -233,8 +234,8 @@ public virtual SubscriptionPolicyDefinitionCollection GetSubscriptionPolicyDefin /// /// The name of the policy definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSubscriptionPolicyDefinitionAsync(string policyDefinitionName, CancellationToken cancellationToken = default) { @@ -256,8 +257,8 @@ public virtual async Task> GetSub /// /// The name of the policy definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSubscriptionPolicyDefinition(string policyDefinitionName, CancellationToken cancellationToken = default) { @@ -268,7 +269,7 @@ public virtual Response GetSubscriptionPol /// An object representing collection of SubscriptionPolicySetDefinitionResources and their operations over a SubscriptionPolicySetDefinitionResource. public virtual SubscriptionPolicySetDefinitionCollection GetSubscriptionPolicySetDefinitions() { - return GetCachedClient(Client => new SubscriptionPolicySetDefinitionCollection(Client, Id)); + return GetCachedClient(client => new SubscriptionPolicySetDefinitionCollection(client, Id)); } /// @@ -286,8 +287,8 @@ public virtual SubscriptionPolicySetDefinitionCollection GetSubscriptionPolicySe /// /// The name of the policy set definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSubscriptionPolicySetDefinitionAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) { @@ -309,8 +310,8 @@ public virtual async Task> Get /// /// The name of the policy set definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSubscriptionPolicySetDefinition(string policySetDefinitionName, CancellationToken cancellationToken = default) { diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TagResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TagResource.cs index 177aa7ae94c8f..c22dba7c02c9a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TagResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TagResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.Resources public partial class TagResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. public static ResourceIdentifier CreateResourceIdentifier(string scope) { var resourceId = $"{scope}/providers/Microsoft.Resources/tags/default"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicyDefinitionResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicyDefinitionResource.cs index 6c5343a86fb58..6abbca1b8a162 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicyDefinitionResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicyDefinitionResource.cs @@ -25,6 +25,7 @@ namespace Azure.ResourceManager.Resources public partial class TenantPolicyDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The policyDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string policyDefinitionName) { var resourceId = $"/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicySetDefinitionResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicySetDefinitionResource.cs index b978e0b09bb79..740858cbd4ec8 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicySetDefinitionResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantPolicySetDefinitionResource.cs @@ -25,6 +25,7 @@ namespace Azure.ResourceManager.Resources public partial class TenantPolicySetDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The policySetDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string policySetDefinitionName) { var resourceId = $"/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantResource.cs index 8092739348b06..149f57bdf995d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantResource.cs @@ -84,14 +84,14 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GenericResources and their operations over a GenericResource. public virtual GenericResourceCollection GetGenericResources() { - return GetCachedClient(Client => new GenericResourceCollection(Client, Id)); + return GetCachedClient(client => new GenericResourceCollection(client, Id)); } /// Gets a collection of TenantPolicyDefinitionResources in the Tenant. /// An object representing collection of TenantPolicyDefinitionResources and their operations over a TenantPolicyDefinitionResource. public virtual TenantPolicyDefinitionCollection GetTenantPolicyDefinitions() { - return GetCachedClient(Client => new TenantPolicyDefinitionCollection(Client, Id)); + return GetCachedClient(client => new TenantPolicyDefinitionCollection(client, Id)); } /// @@ -109,8 +109,8 @@ public virtual TenantPolicyDefinitionCollection GetTenantPolicyDefinitions() /// /// The name of the built-in policy definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTenantPolicyDefinitionAsync(string policyDefinitionName, CancellationToken cancellationToken = default) { @@ -132,8 +132,8 @@ public virtual async Task> GetTenantPol /// /// The name of the built-in policy definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTenantPolicyDefinition(string policyDefinitionName, CancellationToken cancellationToken = default) { @@ -144,7 +144,7 @@ public virtual Response GetTenantPolicyDefinitio /// An object representing collection of TenantPolicySetDefinitionResources and their operations over a TenantPolicySetDefinitionResource. public virtual TenantPolicySetDefinitionCollection GetTenantPolicySetDefinitions() { - return GetCachedClient(Client => new TenantPolicySetDefinitionCollection(Client, Id)); + return GetCachedClient(client => new TenantPolicySetDefinitionCollection(client, Id)); } /// @@ -162,8 +162,8 @@ public virtual TenantPolicySetDefinitionCollection GetTenantPolicySetDefinitions /// /// The name of the policy set definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTenantPolicySetDefinitionAsync(string policySetDefinitionName, CancellationToken cancellationToken = default) { @@ -185,8 +185,8 @@ public virtual async Task> GetTenant /// /// The name of the policy set definition to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTenantPolicySetDefinition(string policySetDefinitionName, CancellationToken cancellationToken = default) { @@ -197,7 +197,7 @@ public virtual Response GetTenantPolicySetDef /// An object representing collection of DataPolicyManifestResources and their operations over a DataPolicyManifestResource. public virtual DataPolicyManifestCollection GetDataPolicyManifests() { - return GetCachedClient(Client => new DataPolicyManifestCollection(Client, Id)); + return GetCachedClient(client => new DataPolicyManifestCollection(client, Id)); } /// @@ -215,8 +215,8 @@ public virtual DataPolicyManifestCollection GetDataPolicyManifests() /// /// The policy mode of the data policy manifest to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDataPolicyManifestAsync(string policyMode, CancellationToken cancellationToken = default) { @@ -238,8 +238,8 @@ public virtual async Task> GetDataPolicyMan /// /// The policy mode of the data policy manifest to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDataPolicyManifest(string policyMode, CancellationToken cancellationToken = default) { @@ -250,7 +250,7 @@ public virtual Response GetDataPolicyManifest(string /// An object representing collection of SubscriptionResources and their operations over a SubscriptionResource. public virtual SubscriptionCollection GetSubscriptions() { - return GetCachedClient(Client => new SubscriptionCollection(Client, Id)); + return GetCachedClient(client => new SubscriptionCollection(client, Id)); } /// @@ -268,8 +268,8 @@ public virtual SubscriptionCollection GetSubscriptions() /// /// The ID of the target subscription. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { @@ -291,8 +291,8 @@ public virtual async Task> GetSubscriptionAsync(s /// /// The ID of the target subscription. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSubscription(string subscriptionId, CancellationToken cancellationToken = default) { diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/autorest.md b/sdk/resourcemanager/Azure.ResourceManager/src/autorest.md index c370ed9933957..4574c84d1c4d4 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/autorest.md +++ b/sdk/resourcemanager/Azure.ResourceManager/src/autorest.md @@ -244,6 +244,10 @@ operations-to-skip-lro-api-version-override: - Tags_UpdateAtScope - Tags_DeleteAtScope +generate-arm-resource-extensions: +- /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName} +- /{scope}/providers/Microsoft.Authorization/locks/{lockName} + format-by-name-rules: 'tenantId': 'uuid' 'etag': 'etag' diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index d4cf51536f834..71934ee839dc4 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -92,6 +92,8 @@ trigger: - sdk/hybridcompute/Azure.ResourceManager.HybridCompute - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes + - sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub @@ -275,6 +277,11 @@ pr: - sdk/hybridcompute/Azure.ResourceManager.HybridCompute - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes +<<<<<<< HEAD + - sdk/integrationspaces/Azure.ResourceManager.IntegrationSpaces +======= + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork +>>>>>>> 065bd90421 (Add .NET SDK for HybridNetwork service (#39386)) - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/api/Azure.ResourceManager.ResourceMover.netstandard2.0.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/api/Azure.ResourceManager.ResourceMover.netstandard2.0.cs index 2e0b5d1ad5716..d6c254401bc0d 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/api/Azure.ResourceManager.ResourceMover.netstandard2.0.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/api/Azure.ResourceManager.ResourceMover.netstandard2.0.cs @@ -55,7 +55,7 @@ protected MoverResourceSetCollection() { } } public partial class MoverResourceSetData : Azure.ResourceManager.Models.TrackedResourceData { - public MoverResourceSetData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public MoverResourceSetData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.ResourceMover.Models.MoverResourceSetProperties Properties { get { throw null; } set { } } @@ -110,6 +110,34 @@ public static partial class ResourceMoverExtensions public static Azure.AsyncPageable GetOperationsDiscoveriesAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ResourceMover.Mocking +{ + public partial class MockableResourceMoverArmClient : Azure.ResourceManager.ArmResource + { + protected MockableResourceMoverArmClient() { } + public virtual Azure.ResourceManager.ResourceMover.MoverResource GetMoverResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ResourceMover.MoverResourceSetResource GetMoverResourceSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableResourceMoverResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceMoverResourceGroupResource() { } + public virtual Azure.Response GetMoverResourceSet(string moverResourceSetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMoverResourceSetAsync(string moverResourceSetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ResourceMover.MoverResourceSetCollection GetMoverResourceSets() { throw null; } + } + public partial class MockableResourceMoverSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceMoverSubscriptionResource() { } + public virtual Azure.Pageable GetMoverResourceSets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMoverResourceSetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableResourceMoverTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableResourceMoverTenantResource() { } + public virtual Azure.Pageable GetOperationsDiscoveries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationsDiscoveriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ResourceMover.Models { public partial class AffectedMoverResourceInfo diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverArmClient.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverArmClient.cs new file mode 100644 index 0000000000000..028b4f838f1b6 --- /dev/null +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceMover; + +namespace Azure.ResourceManager.ResourceMover.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableResourceMoverArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourceMoverArmClient() + { + } + + /// 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 MockableResourceMoverArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableResourceMoverArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MoverResourceSetResource GetMoverResourceSetResource(ResourceIdentifier id) + { + MoverResourceSetResource.ValidateResourceId(id); + return new MoverResourceSetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MoverResource GetMoverResource(ResourceIdentifier id) + { + MoverResource.ValidateResourceId(id); + return new MoverResource(Client, id); + } + } +} diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverResourceGroupResource.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverResourceGroupResource.cs new file mode 100644 index 0000000000000..7abe3ceff90b5 --- /dev/null +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ResourceMover; + +namespace Azure.ResourceManager.ResourceMover.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableResourceMoverResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourceMoverResourceGroupResource() + { + } + + /// 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 MockableResourceMoverResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MoverResourceSetResources in the ResourceGroupResource. + /// An object representing collection of MoverResourceSetResources and their operations over a MoverResourceSetResource. + public virtual MoverResourceSetCollection GetMoverResourceSets() + { + return GetCachedClient(client => new MoverResourceSetCollection(client, Id)); + } + + /// + /// Gets the move collection. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName} + /// + /// + /// Operation Id + /// MoveCollections_Get + /// + /// + /// + /// The Move Collection Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetMoverResourceSetAsync(string moverResourceSetName, CancellationToken cancellationToken = default) + { + return await GetMoverResourceSets().GetAsync(moverResourceSetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the move collection. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName} + /// + /// + /// Operation Id + /// MoveCollections_Get + /// + /// + /// + /// The Move Collection Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetMoverResourceSet(string moverResourceSetName, CancellationToken cancellationToken = default) + { + return GetMoverResourceSets().Get(moverResourceSetName, cancellationToken); + } + } +} diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverSubscriptionResource.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverSubscriptionResource.cs new file mode 100644 index 0000000000000..07710c5ea8140 --- /dev/null +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceMover; + +namespace Azure.ResourceManager.ResourceMover.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableResourceMoverSubscriptionResource : ArmResource + { + private ClientDiagnostics _moverResourceSetMoveCollectionsClientDiagnostics; + private MoveCollectionsRestOperations _moverResourceSetMoveCollectionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourceMoverSubscriptionResource() + { + } + + /// 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 MockableResourceMoverSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MoverResourceSetMoveCollectionsClientDiagnostics => _moverResourceSetMoveCollectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceMover", MoverResourceSetResource.ResourceType.Namespace, Diagnostics); + private MoveCollectionsRestOperations MoverResourceSetMoveCollectionsRestClient => _moverResourceSetMoveCollectionsRestClient ??= new MoveCollectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MoverResourceSetResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get all the Move Collections in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Migrate/moveCollections + /// + /// + /// Operation Id + /// MoveCollections_ListMoveCollectionsBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMoverResourceSetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MoverResourceSetMoveCollectionsRestClient.CreateListMoveCollectionsBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MoverResourceSetMoveCollectionsRestClient.CreateListMoveCollectionsBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MoverResourceSetResource(Client, MoverResourceSetData.DeserializeMoverResourceSetData(e)), MoverResourceSetMoveCollectionsClientDiagnostics, Pipeline, "MockableResourceMoverSubscriptionResource.GetMoverResourceSets", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the Move Collections in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Migrate/moveCollections + /// + /// + /// Operation Id + /// MoveCollections_ListMoveCollectionsBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMoverResourceSets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MoverResourceSetMoveCollectionsRestClient.CreateListMoveCollectionsBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MoverResourceSetMoveCollectionsRestClient.CreateListMoveCollectionsBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MoverResourceSetResource(Client, MoverResourceSetData.DeserializeMoverResourceSetData(e)), MoverResourceSetMoveCollectionsClientDiagnostics, Pipeline, "MockableResourceMoverSubscriptionResource.GetMoverResourceSets", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverTenantResource.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverTenantResource.cs new file mode 100644 index 0000000000000..83d9ae4b21787 --- /dev/null +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/MockableResourceMoverTenantResource.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceMover; +using Azure.ResourceManager.ResourceMover.Models; + +namespace Azure.ResourceManager.ResourceMover.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableResourceMoverTenantResource : ArmResource + { + private ClientDiagnostics _operationsDiscoveryClientDiagnostics; + private OperationsDiscoveryRestOperations _operationsDiscoveryRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourceMoverTenantResource() + { + } + + /// 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 MockableResourceMoverTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OperationsDiscoveryClientDiagnostics => _operationsDiscoveryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceMover", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OperationsDiscoveryRestOperations OperationsDiscoveryRestClient => _operationsDiscoveryRestClient ??= new OperationsDiscoveryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// + /// + /// Request Path + /// /providers/Microsoft.Migrate/operations + /// + /// + /// Operation Id + /// OperationsDiscovery_Get + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationsDiscoveriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsDiscoveryRestClient.CreateGetRequest(); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MoverOperationsDiscovery.DeserializeMoverOperationsDiscovery, OperationsDiscoveryClientDiagnostics, Pipeline, "MockableResourceMoverTenantResource.GetOperationsDiscoveries", "value", null, cancellationToken); + } + + /// + /// + /// + /// Request Path + /// /providers/Microsoft.Migrate/operations + /// + /// + /// Operation Id + /// OperationsDiscovery_Get + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperationsDiscoveries(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsDiscoveryRestClient.CreateGetRequest(); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MoverOperationsDiscovery.DeserializeMoverOperationsDiscovery, OperationsDiscoveryClientDiagnostics, Pipeline, "MockableResourceMoverTenantResource.GetOperationsDiscoveries", "value", null, cancellationToken); + } + } +} diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index feb150ce0fcf7..0000000000000 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ResourceMover -{ - /// 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 MoverResourceSetResources in the ResourceGroupResource. - /// An object representing collection of MoverResourceSetResources and their operations over a MoverResourceSetResource. - public virtual MoverResourceSetCollection GetMoverResourceSets() - { - return GetCachedClient(Client => new MoverResourceSetCollection(Client, Id)); - } - } -} diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/ResourceMoverExtensions.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/ResourceMoverExtensions.cs index 0bddce4bb2d39..413fddec3c5fa 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/ResourceMoverExtensions.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/ResourceMoverExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ResourceMover.Mocking; using Azure.ResourceManager.ResourceMover.Models; using Azure.ResourceManager.Resources; @@ -19,97 +20,70 @@ namespace Azure.ResourceManager.ResourceMover /// A class to add extension methods to Azure.ResourceManager.ResourceMover. public static partial class ResourceMoverExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableResourceMoverArmClient GetMockableResourceMoverArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableResourceMoverArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableResourceMoverResourceGroupResource GetMockableResourceMoverResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableResourceMoverResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableResourceMoverSubscriptionResource GetMockableResourceMoverSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableResourceMoverSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableResourceMoverTenantResource GetMockableResourceMoverTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableResourceMoverTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region MoverResourceSetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MoverResourceSetResource GetMoverResourceSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MoverResourceSetResource.ValidateResourceId(id); - return new MoverResourceSetResource(client, id); - } - ); + return GetMockableResourceMoverArmClient(client).GetMoverResourceSetResource(id); } - #endregion - #region MoverResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MoverResource GetMoverResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MoverResource.ValidateResourceId(id); - return new MoverResource(client, id); - } - ); + return GetMockableResourceMoverArmClient(client).GetMoverResource(id); } - #endregion - /// Gets a collection of MoverResourceSetResources in the ResourceGroupResource. + /// + /// Gets a collection of MoverResourceSetResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of MoverResourceSetResources and their operations over a MoverResourceSetResource. public static MoverResourceSetCollection GetMoverResourceSets(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMoverResourceSets(); + return GetMockableResourceMoverResourceGroupResource(resourceGroupResource).GetMoverResourceSets(); } /// @@ -124,16 +98,20 @@ public static MoverResourceSetCollection GetMoverResourceSets(this ResourceGroup /// MoveCollections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Move Collection Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetMoverResourceSetAsync(this ResourceGroupResource resourceGroupResource, string moverResourceSetName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetMoverResourceSets().GetAsync(moverResourceSetName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourceMoverResourceGroupResource(resourceGroupResource).GetMoverResourceSetAsync(moverResourceSetName, cancellationToken).ConfigureAwait(false); } /// @@ -148,16 +126,20 @@ public static async Task> GetMoverResourceSet /// MoveCollections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Move Collection Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetMoverResourceSet(this ResourceGroupResource resourceGroupResource, string moverResourceSetName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetMoverResourceSets().Get(moverResourceSetName, cancellationToken); + return GetMockableResourceMoverResourceGroupResource(resourceGroupResource).GetMoverResourceSet(moverResourceSetName, cancellationToken); } /// @@ -172,13 +154,17 @@ public static Response GetMoverResourceSet(this Resour /// MoveCollections_ListMoveCollectionsBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMoverResourceSetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMoverResourceSetsAsync(cancellationToken); + return GetMockableResourceMoverSubscriptionResource(subscriptionResource).GetMoverResourceSetsAsync(cancellationToken); } /// @@ -193,13 +179,17 @@ public static AsyncPageable GetMoverResourceSetsAsync( /// MoveCollections_ListMoveCollectionsBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMoverResourceSets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMoverResourceSets(cancellationToken); + return GetMockableResourceMoverSubscriptionResource(subscriptionResource).GetMoverResourceSets(cancellationToken); } /// @@ -213,13 +203,17 @@ public static Pageable GetMoverResourceSets(this Subsc /// OperationsDiscovery_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsDiscoveriesAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsDiscoveriesAsync(cancellationToken); + return GetMockableResourceMoverTenantResource(tenantResource).GetOperationsDiscoveriesAsync(cancellationToken); } /// @@ -233,13 +227,17 @@ public static AsyncPageable GetOperationsDiscoveriesAs /// OperationsDiscovery_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsDiscoveries(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsDiscoveries(cancellationToken); + return GetMockableResourceMoverTenantResource(tenantResource).GetOperationsDiscoveries(cancellationToken); } } } diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 6e266dc09c9fd..0000000000000 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ResourceMover -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _moverResourceSetMoveCollectionsClientDiagnostics; - private MoveCollectionsRestOperations _moverResourceSetMoveCollectionsRestClient; - - /// 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 MoverResourceSetMoveCollectionsClientDiagnostics => _moverResourceSetMoveCollectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceMover", MoverResourceSetResource.ResourceType.Namespace, Diagnostics); - private MoveCollectionsRestOperations MoverResourceSetMoveCollectionsRestClient => _moverResourceSetMoveCollectionsRestClient ??= new MoveCollectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MoverResourceSetResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get all the Move Collections in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Migrate/moveCollections - /// - /// - /// Operation Id - /// MoveCollections_ListMoveCollectionsBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMoverResourceSetsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MoverResourceSetMoveCollectionsRestClient.CreateListMoveCollectionsBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MoverResourceSetMoveCollectionsRestClient.CreateListMoveCollectionsBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MoverResourceSetResource(Client, MoverResourceSetData.DeserializeMoverResourceSetData(e)), MoverResourceSetMoveCollectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMoverResourceSets", "value", "nextLink", cancellationToken); - } - - /// - /// Get all the Move Collections in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Migrate/moveCollections - /// - /// - /// Operation Id - /// MoveCollections_ListMoveCollectionsBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMoverResourceSets(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MoverResourceSetMoveCollectionsRestClient.CreateListMoveCollectionsBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MoverResourceSetMoveCollectionsRestClient.CreateListMoveCollectionsBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MoverResourceSetResource(Client, MoverResourceSetData.DeserializeMoverResourceSetData(e)), MoverResourceSetMoveCollectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMoverResourceSets", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 9298aae6345cd..0000000000000 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ResourceMover.Models; - -namespace Azure.ResourceManager.ResourceMover -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _operationsDiscoveryClientDiagnostics; - private OperationsDiscoveryRestOperations _operationsDiscoveryRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics OperationsDiscoveryClientDiagnostics => _operationsDiscoveryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ResourceMover", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OperationsDiscoveryRestOperations OperationsDiscoveryRestClient => _operationsDiscoveryRestClient ??= new OperationsDiscoveryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// - /// - /// Request Path - /// /providers/Microsoft.Migrate/operations - /// - /// - /// Operation Id - /// OperationsDiscovery_Get - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationsDiscoveriesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsDiscoveryRestClient.CreateGetRequest(); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MoverOperationsDiscovery.DeserializeMoverOperationsDiscovery, OperationsDiscoveryClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperationsDiscoveries", "value", null, cancellationToken); - } - - /// - /// - /// - /// Request Path - /// /providers/Microsoft.Migrate/operations - /// - /// - /// Operation Id - /// OperationsDiscovery_Get - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationsDiscoveries(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsDiscoveryRestClient.CreateGetRequest(); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MoverOperationsDiscovery.DeserializeMoverOperationsDiscovery, OperationsDiscoveryClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperationsDiscoveries", "value", null, cancellationToken); - } - } -} diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResource.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResource.cs index 6ba7e403d0f09..6a583cbcd7ea2 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResource.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ResourceMover public partial class MoverResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The moverResourceSetName. + /// The moverResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string moverResourceSetName, string moverResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moverResourceSetName}/moveResources/{moverResourceName}"; diff --git a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetResource.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetResource.cs index ac34596781415..56ba8252ec878 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetResource.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ResourceMover public partial class MoverResourceSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The moverResourceSetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string moverResourceSetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moverResourceSetName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of MoverResources and their operations over a MoverResource. public virtual MoverResourceCollection GetMoverResources() { - return GetCachedClient(Client => new MoverResourceCollection(Client, Id)); + return GetCachedClient(client => new MoverResourceCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual MoverResourceCollection GetMoverResources() /// /// The Move Resource Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetMoverResourceAsync(string moverResourceName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetMoverResourceAsync(string /// /// The Move Resource Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetMoverResource(string moverResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/resources/Azure.ResourceManager.Resources/Azure.ResourceManager.Resources.sln b/sdk/resources/Azure.ResourceManager.Resources/Azure.ResourceManager.Resources.sln index 178f9b739e4f0..9ac6f4b080a33 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/Azure.ResourceManager.Resources.sln +++ b/sdk/resources/Azure.ResourceManager.Resources/Azure.ResourceManager.Resources.sln @@ -1,7 +1,6 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30011.22 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 15.0.26124.0 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{62AF7C88-CE3F-416E-B18E-BC6F884C89E2}" EndProject @@ -21,18 +20,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x64.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x64.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x86.ActiveCfg = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|x86.Build.0 = Debug|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.Build.0 = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x64.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x64.Build.0 = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x86.ActiveCfg = Release|Any CPU - {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|x86.Build.0 = Release|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.Build.0 = Debug|Any CPU {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -69,6 +56,18 @@ Global {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|x64.Build.0 = Release|Any CPU {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|x86.ActiveCfg = Release|Any CPU {9D842058-41AB-42DD-82C8-F3DF49E25297}.Release|x86.Build.0 = Release|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Debug|x64.ActiveCfg = Debug|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Debug|x64.Build.0 = Debug|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Debug|x86.ActiveCfg = Debug|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Debug|x86.Build.0 = Debug|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Release|Any CPU.Build.0 = Release|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Release|x64.ActiveCfg = Release|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Release|x64.Build.0 = Release|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Release|x86.ActiveCfg = Release|Any CPU + {B2F70B5C-00C0-42AF-AFB5-386C048AD6DB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/resources/Azure.ResourceManager.Resources/CHANGELOG.md b/sdk/resources/Azure.ResourceManager.Resources/CHANGELOG.md index f884ede30d9a3..d7ca463fb02c8 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/CHANGELOG.md +++ b/sdk/resources/Azure.ResourceManager.Resources/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.7.0-beta.1 (Unreleased) +## 1.7.0-beta.2 (Unreleased) ### Features Added @@ -10,6 +10,12 @@ ### Other Changes +## 1.7.0-beta.1 (2023-08-14) + +### Features Added + +- Make `ResourcesArmClientMockingExtension`, `ResourcesManagementGroupMockingExtension`, `ResourcesResourceGroupMockingExtension`, `ResourcesSubscriptionMockingExtension` and `ResourcesTenantMockingExtension` public for mocking the extension methods. + ## 1.6.0 (2023-05-31) ### Features Added diff --git a/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs b/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs index ab0affbb4accf..e8e639d7f23ff 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs @@ -243,7 +243,7 @@ protected JitRequestCollection() { } } public partial class JitRequestData : Azure.ResourceManager.Models.TrackedResourceData { - public JitRequestData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public JitRequestData(Azure.Core.AzureLocation location) { } public string ApplicationResourceId { get { throw null; } set { } } public Azure.ResourceManager.Resources.Models.ArmApplicationDetails CreatedBy { get { throw null; } } public System.Collections.Generic.IList JitAuthorizationPolicies { get { throw null; } } @@ -435,6 +435,74 @@ protected TemplateSpecVersionResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Resources.Models.TemplateSpecVersionPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Resources.Mocking +{ + public partial class MockableResourcesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableResourcesArmClient() { } + public virtual Azure.ResourceManager.Resources.ArmApplicationDefinitionResource GetArmApplicationDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmApplicationResource GetArmApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmDeploymentResource GetArmDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmDeploymentScriptResource GetArmDeploymentScriptResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Resources.JitRequestResource GetJitRequestResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Resources.ScriptLogResource GetScriptLogResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Resources.TemplateSpecResource GetTemplateSpecResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Resources.TemplateSpecVersionResource GetTemplateSpecVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableResourcesManagementGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesManagementGroupResource() { } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmDeploymentCollection GetArmDeployments() { throw null; } + } + public partial class MockableResourcesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesResourceGroupResource() { } + public virtual Azure.Response GetArmApplication(string applicationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmApplicationAsync(string applicationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetArmApplicationDefinition(string applicationDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmApplicationDefinitionAsync(string applicationDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmApplicationDefinitionCollection GetArmApplicationDefinitions() { throw null; } + public virtual Azure.ResourceManager.Resources.ArmApplicationCollection GetArmApplications() { throw null; } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmDeploymentCollection GetArmDeployments() { throw null; } + public virtual Azure.Response GetArmDeploymentScript(string scriptName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentScriptAsync(string scriptName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmDeploymentScriptCollection GetArmDeploymentScripts() { throw null; } + public virtual Azure.Response GetJitRequest(string jitRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetJitRequestAsync(string jitRequestName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.JitRequestCollection GetJitRequests() { throw null; } + public virtual Azure.Response GetTemplateSpec(string templateSpecName, Azure.ResourceManager.Resources.Models.TemplateSpecExpandKind? expand = default(Azure.ResourceManager.Resources.Models.TemplateSpecExpandKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTemplateSpecAsync(string templateSpecName, Azure.ResourceManager.Resources.Models.TemplateSpecExpandKind? expand = default(Azure.ResourceManager.Resources.Models.TemplateSpecExpandKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.TemplateSpecCollection GetTemplateSpecs() { throw null; } + } + public partial class MockableResourcesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesSubscriptionResource() { } + public virtual Azure.Pageable GetArmApplications(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetArmApplicationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmDeploymentCollection GetArmDeployments() { throw null; } + public virtual Azure.Pageable GetArmDeploymentScripts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetArmDeploymentScriptsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetJitRequestDefinitions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetJitRequestDefinitionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetTemplateSpecs(Azure.ResourceManager.Resources.Models.TemplateSpecExpandKind? expand = default(Azure.ResourceManager.Resources.Models.TemplateSpecExpandKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTemplateSpecsAsync(Azure.ResourceManager.Resources.Models.TemplateSpecExpandKind? expand = default(Azure.ResourceManager.Resources.Models.TemplateSpecExpandKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableResourcesTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesTenantResource() { } + public virtual Azure.Response CalculateDeploymentTemplateHash(System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CalculateDeploymentTemplateHashAsync(System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.ArmDeploymentCollection GetArmDeployments() { throw null; } + } +} namespace Azure.ResourceManager.Resources.Models { public partial class ArmApplicationArtifact @@ -632,7 +700,7 @@ public ArmApplicationPolicy() { } } public partial class ArmApplicationResourceData : Azure.ResourceManager.Models.TrackedResourceData { - public ArmApplicationResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ArmApplicationResourceData(Azure.Core.AzureLocation location) { } public string ManagedBy { get { throw null; } set { } } public Azure.ResourceManager.Resources.Models.ArmApplicationSku Sku { get { throw null; } set { } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Azure.ResourceManager.Resources.csproj b/sdk/resources/Azure.ResourceManager.Resources/src/Azure.ResourceManager.Resources.csproj index 03580d75df02b..62625c49d2f7e 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Azure.ResourceManager.Resources.csproj +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Azure.ResourceManager.Resources.csproj @@ -1,6 +1,6 @@ - 1.7.0-beta.1 + 1.7.0-beta.2 1.6.0 Azure.ResourceManager.Resources diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationDefinitionResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationDefinitionResource.cs index f57bb8a82e9cc..8b84740f20fd4 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationDefinitionResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationDefinitionResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Resources public partial class ArmApplicationDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The applicationDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string applicationDefinitionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}"; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationResource.cs index c72ae79fcee59..c0e01611d8890 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmApplicationResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Resources public partial class ArmApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The applicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string applicationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}"; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentResource.cs index e637c1c8fdda8..b4b8efa9e95d6 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentResource.cs @@ -29,6 +29,8 @@ namespace Azure.ResourceManager.Resources public partial class ArmDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The deploymentName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string deploymentName) { var resourceId = $"{scope}/providers/Microsoft.Resources/deployments/{deploymentName}"; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentScriptResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentScriptResource.cs index 8aa0c84aad148..0ce27bdecdd12 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentScriptResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ArmDeploymentScriptResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Resources public partial class ArmDeploymentScriptResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scriptName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scriptName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}"; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs deleted file mode 100644 index cd14dcc67e1f1..0000000000000 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Resources -{ - /// A class to add extension methods to ManagementGroupResource. - internal partial class ManagementGroupResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ManagementGroupResourceExtensionClient() - { - } - - /// 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 ManagementGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ArmDeploymentResources in the ManagementGroupResource. - /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. - public virtual ArmDeploymentCollection GetArmDeployments() - { - return GetCachedClient(Client => new ArmDeploymentCollection(Client, Id)); - } - } -} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesArmClient.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesArmClient.cs new file mode 100644 index 0000000000000..161f2ffe9684d --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesArmClient.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Resources.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableResourcesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourcesArmClient() + { + } + + /// 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 MockableResourcesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableResourcesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ArmDeploymentResource GetArmDeploymentResource(ResourceIdentifier id) + { + ArmDeploymentResource.ValidateResourceId(id); + return new ArmDeploymentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ArmApplicationResource GetArmApplicationResource(ResourceIdentifier id) + { + ArmApplicationResource.ValidateResourceId(id); + return new ArmApplicationResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ArmApplicationDefinitionResource GetArmApplicationDefinitionResource(ResourceIdentifier id) + { + ArmApplicationDefinitionResource.ValidateResourceId(id); + return new ArmApplicationDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual JitRequestResource GetJitRequestResource(ResourceIdentifier id) + { + JitRequestResource.ValidateResourceId(id); + return new JitRequestResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ArmDeploymentScriptResource GetArmDeploymentScriptResource(ResourceIdentifier id) + { + ArmDeploymentScriptResource.ValidateResourceId(id); + return new ArmDeploymentScriptResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScriptLogResource GetScriptLogResource(ResourceIdentifier id) + { + ScriptLogResource.ValidateResourceId(id); + return new ScriptLogResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TemplateSpecResource GetTemplateSpecResource(ResourceIdentifier id) + { + TemplateSpecResource.ValidateResourceId(id); + return new TemplateSpecResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TemplateSpecVersionResource GetTemplateSpecVersionResource(ResourceIdentifier id) + { + TemplateSpecVersionResource.ValidateResourceId(id); + return new TemplateSpecVersionResource(Client, id); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesManagementGroupResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesManagementGroupResource.cs new file mode 100644 index 0000000000000..b75f833404f1f --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesManagementGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Resources.Mocking +{ + /// A class to add extension methods to ManagementGroupResource. + public partial class MockableResourcesManagementGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourcesManagementGroupResource() + { + } + + /// 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 MockableResourcesManagementGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ArmDeploymentResources in the ManagementGroupResource. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public virtual ArmDeploymentCollection GetArmDeployments() + { + return GetCachedClient(client => new ArmDeploymentCollection(client, Id)); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetArmDeployments().Get(deploymentName, cancellationToken); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesResourceGroupResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesResourceGroupResource.cs new file mode 100644 index 0000000000000..7610a270248a0 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesResourceGroupResource.cs @@ -0,0 +1,360 @@ +// 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; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Resources.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableResourcesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourcesResourceGroupResource() + { + } + + /// 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 MockableResourcesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ArmDeploymentResources in the ResourceGroupResource. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public virtual ArmDeploymentCollection GetArmDeployments() + { + return GetCachedClient(client => new ArmDeploymentCollection(client, Id)); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetArmDeployments().Get(deploymentName, cancellationToken); + } + + /// Gets a collection of ArmApplicationResources in the ResourceGroupResource. + /// An object representing collection of ArmApplicationResources and their operations over a ArmApplicationResource. + public virtual ArmApplicationCollection GetArmApplications() + { + return GetCachedClient(client => new ArmApplicationCollection(client, Id)); + } + + /// + /// Gets the managed application. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the managed application. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmApplicationAsync(string applicationName, CancellationToken cancellationToken = default) + { + return await GetArmApplications().GetAsync(applicationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the managed application. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName} + /// + /// + /// Operation Id + /// Applications_Get + /// + /// + /// + /// The name of the managed application. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmApplication(string applicationName, CancellationToken cancellationToken = default) + { + return GetArmApplications().Get(applicationName, cancellationToken); + } + + /// Gets a collection of ArmApplicationDefinitionResources in the ResourceGroupResource. + /// An object representing collection of ArmApplicationDefinitionResources and their operations over a ArmApplicationDefinitionResource. + public virtual ArmApplicationDefinitionCollection GetArmApplicationDefinitions() + { + return GetCachedClient(client => new ArmApplicationDefinitionCollection(client, Id)); + } + + /// + /// Gets the managed application definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName} + /// + /// + /// Operation Id + /// ApplicationDefinitions_Get + /// + /// + /// + /// The name of the managed application definition. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmApplicationDefinitionAsync(string applicationDefinitionName, CancellationToken cancellationToken = default) + { + return await GetArmApplicationDefinitions().GetAsync(applicationDefinitionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the managed application definition. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName} + /// + /// + /// Operation Id + /// ApplicationDefinitions_Get + /// + /// + /// + /// The name of the managed application definition. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmApplicationDefinition(string applicationDefinitionName, CancellationToken cancellationToken = default) + { + return GetArmApplicationDefinitions().Get(applicationDefinitionName, cancellationToken); + } + + /// Gets a collection of JitRequestResources in the ResourceGroupResource. + /// An object representing collection of JitRequestResources and their operations over a JitRequestResource. + public virtual JitRequestCollection GetJitRequests() + { + return GetCachedClient(client => new JitRequestCollection(client, Id)); + } + + /// + /// Gets the JIT request. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName} + /// + /// + /// Operation Id + /// JitRequests_Get + /// + /// + /// + /// The name of the JIT request. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetJitRequestAsync(string jitRequestName, CancellationToken cancellationToken = default) + { + return await GetJitRequests().GetAsync(jitRequestName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the JIT request. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName} + /// + /// + /// Operation Id + /// JitRequests_Get + /// + /// + /// + /// The name of the JIT request. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetJitRequest(string jitRequestName, CancellationToken cancellationToken = default) + { + return GetJitRequests().Get(jitRequestName, cancellationToken); + } + + /// Gets a collection of ArmDeploymentScriptResources in the ResourceGroupResource. + /// An object representing collection of ArmDeploymentScriptResources and their operations over a ArmDeploymentScriptResource. + public virtual ArmDeploymentScriptCollection GetArmDeploymentScripts() + { + return GetCachedClient(client => new ArmDeploymentScriptCollection(client, Id)); + } + + /// + /// Gets a deployment script with a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName} + /// + /// + /// Operation Id + /// DeploymentScripts_Get + /// + /// + /// + /// Name of the deployment script. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentScriptAsync(string scriptName, CancellationToken cancellationToken = default) + { + return await GetArmDeploymentScripts().GetAsync(scriptName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment script with a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName} + /// + /// + /// Operation Id + /// DeploymentScripts_Get + /// + /// + /// + /// Name of the deployment script. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeploymentScript(string scriptName, CancellationToken cancellationToken = default) + { + return GetArmDeploymentScripts().Get(scriptName, cancellationToken); + } + + /// Gets a collection of TemplateSpecResources in the ResourceGroupResource. + /// An object representing collection of TemplateSpecResources and their operations over a TemplateSpecResource. + public virtual TemplateSpecCollection GetTemplateSpecs() + { + return GetCachedClient(client => new TemplateSpecCollection(client, Id)); + } + + /// + /// Gets a Template Spec with a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName} + /// + /// + /// Operation Id + /// TemplateSpecs_Get + /// + /// + /// + /// Name of the Template Spec. + /// Allows for expansion of additional Template Spec details in the response. Optional. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTemplateSpecAsync(string templateSpecName, TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) + { + return await GetTemplateSpecs().GetAsync(templateSpecName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Template Spec with a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName} + /// + /// + /// Operation Id + /// TemplateSpecs_Get + /// + /// + /// + /// Name of the Template Spec. + /// Allows for expansion of additional Template Spec details in the response. Optional. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTemplateSpec(string templateSpecName, TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) + { + return GetTemplateSpecs().Get(templateSpecName, expand, cancellationToken); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesSubscriptionResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesSubscriptionResource.cs new file mode 100644 index 0000000000000..e8c5246fc167a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesSubscriptionResource.cs @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Resources.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableResourcesSubscriptionResource : ArmResource + { + private ClientDiagnostics _armApplicationApplicationsClientDiagnostics; + private ApplicationsRestOperations _armApplicationApplicationsRestClient; + private ClientDiagnostics _jitRequestClientDiagnostics; + private JitRequestsRestOperations _jitRequestRestClient; + private ClientDiagnostics _armDeploymentScriptDeploymentScriptsClientDiagnostics; + private DeploymentScriptsRestOperations _armDeploymentScriptDeploymentScriptsRestClient; + private ClientDiagnostics _templateSpecClientDiagnostics; + private TemplateSpecsRestOperations _templateSpecRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourcesSubscriptionResource() + { + } + + /// 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 MockableResourcesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ArmApplicationApplicationsClientDiagnostics => _armApplicationApplicationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", ArmApplicationResource.ResourceType.Namespace, Diagnostics); + private ApplicationsRestOperations ArmApplicationApplicationsRestClient => _armApplicationApplicationsRestClient ??= new ApplicationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ArmApplicationResource.ResourceType)); + private ClientDiagnostics JitRequestClientDiagnostics => _jitRequestClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", JitRequestResource.ResourceType.Namespace, Diagnostics); + private JitRequestsRestOperations JitRequestRestClient => _jitRequestRestClient ??= new JitRequestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(JitRequestResource.ResourceType)); + private ClientDiagnostics ArmDeploymentScriptDeploymentScriptsClientDiagnostics => _armDeploymentScriptDeploymentScriptsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", ArmDeploymentScriptResource.ResourceType.Namespace, Diagnostics); + private DeploymentScriptsRestOperations ArmDeploymentScriptDeploymentScriptsRestClient => _armDeploymentScriptDeploymentScriptsRestClient ??= new DeploymentScriptsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ArmDeploymentScriptResource.ResourceType)); + private ClientDiagnostics TemplateSpecClientDiagnostics => _templateSpecClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", TemplateSpecResource.ResourceType.Namespace, Diagnostics); + private TemplateSpecsRestOperations TemplateSpecRestClient => _templateSpecRestClient ??= new TemplateSpecsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TemplateSpecResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ArmDeploymentResources in the SubscriptionResource. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public virtual ArmDeploymentCollection GetArmDeployments() + { + return GetCachedClient(client => new ArmDeploymentCollection(client, Id)); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetArmDeployments().Get(deploymentName, cancellationToken); + } + + /// + /// Gets all the applications within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications + /// + /// + /// Operation Id + /// Applications_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetArmApplicationsAsync(CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => ArmApplicationApplicationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ArmApplicationApplicationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArmApplicationResource(Client, ArmApplicationData.DeserializeArmApplicationData(e)), ArmApplicationApplicationsClientDiagnostics, Pipeline, "MockableResourcesSubscriptionResource.GetArmApplications", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the applications within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications + /// + /// + /// Operation Id + /// Applications_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetArmApplications(CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => ArmApplicationApplicationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ArmApplicationApplicationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArmApplicationResource(Client, ArmApplicationData.DeserializeArmApplicationData(e)), ArmApplicationApplicationsClientDiagnostics, Pipeline, "MockableResourcesSubscriptionResource.GetArmApplications", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves all JIT requests within the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests + /// + /// + /// Operation Id + /// jitRequests_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetJitRequestDefinitionsAsync(CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => JitRequestRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new JitRequestResource(Client, JitRequestData.DeserializeJitRequestData(e)), JitRequestClientDiagnostics, Pipeline, "MockableResourcesSubscriptionResource.GetJitRequestDefinitions", "value", null, cancellationToken); + } + + /// + /// Retrieves all JIT requests within the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests + /// + /// + /// Operation Id + /// jitRequests_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetJitRequestDefinitions(CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => JitRequestRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new JitRequestResource(Client, JitRequestData.DeserializeJitRequestData(e)), JitRequestClientDiagnostics, Pipeline, "MockableResourcesSubscriptionResource.GetJitRequestDefinitions", "value", null, cancellationToken); + } + + /// + /// Lists all deployment scripts for a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentScripts + /// + /// + /// Operation Id + /// DeploymentScripts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetArmDeploymentScriptsAsync(CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => ArmDeploymentScriptDeploymentScriptsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ArmDeploymentScriptDeploymentScriptsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArmDeploymentScriptResource(Client, ArmDeploymentScriptData.DeserializeArmDeploymentScriptData(e)), ArmDeploymentScriptDeploymentScriptsClientDiagnostics, Pipeline, "MockableResourcesSubscriptionResource.GetArmDeploymentScripts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all deployment scripts for a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentScripts + /// + /// + /// Operation Id + /// DeploymentScripts_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetArmDeploymentScripts(CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => ArmDeploymentScriptDeploymentScriptsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ArmDeploymentScriptDeploymentScriptsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArmDeploymentScriptResource(Client, ArmDeploymentScriptData.DeserializeArmDeploymentScriptData(e)), ArmDeploymentScriptDeploymentScriptsClientDiagnostics, Pipeline, "MockableResourcesSubscriptionResource.GetArmDeploymentScripts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the Template Specs within the specified subscriptions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/templateSpecs + /// + /// + /// Operation Id + /// TemplateSpecs_ListBySubscription + /// + /// + /// + /// Allows for expansion of additional Template Spec details in the response. Optional. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetTemplateSpecsAsync(TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => TemplateSpecRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TemplateSpecRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TemplateSpecResource(Client, TemplateSpecData.DeserializeTemplateSpecData(e)), TemplateSpecClientDiagnostics, Pipeline, "MockableResourcesSubscriptionResource.GetTemplateSpecs", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the Template Specs within the specified subscriptions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/templateSpecs + /// + /// + /// Operation Id + /// TemplateSpecs_ListBySubscription + /// + /// + /// + /// Allows for expansion of additional Template Spec details in the response. Optional. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetTemplateSpecs(TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => TemplateSpecRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TemplateSpecRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TemplateSpecResource(Client, TemplateSpecData.DeserializeTemplateSpecData(e)), TemplateSpecClientDiagnostics, Pipeline, "MockableResourcesSubscriptionResource.GetTemplateSpecs", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesTenantResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesTenantResource.cs new file mode 100644 index 0000000000000..f331b40f83107 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/MockableResourcesTenantResource.cs @@ -0,0 +1,168 @@ +// 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; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Resources.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableResourcesTenantResource : ArmResource + { + private ClientDiagnostics _armDeploymentDeploymentsClientDiagnostics; + private DeploymentsRestOperations _armDeploymentDeploymentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourcesTenantResource() + { + } + + /// 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 MockableResourcesTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ArmDeploymentDeploymentsClientDiagnostics => _armDeploymentDeploymentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", ArmDeploymentResource.ResourceType.Namespace, Diagnostics); + private DeploymentsRestOperations ArmDeploymentDeploymentsRestClient => _armDeploymentDeploymentsRestClient ??= new DeploymentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ArmDeploymentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ArmDeploymentResources in the TenantResource. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public virtual ArmDeploymentCollection GetArmDeployments() + { + return GetCachedClient(client => new ArmDeploymentCollection(client, Id)); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetArmDeployments().Get(deploymentName, cancellationToken); + } + + /// + /// Calculate the hash of the given template. + /// + /// + /// Request Path + /// /providers/Microsoft.Resources/calculateTemplateHash + /// + /// + /// Operation Id + /// Deployments_CalculateTemplateHash + /// + /// + /// + /// The template provided to calculate hash. + /// The cancellation token to use. + /// is null. + public virtual async Task> CalculateDeploymentTemplateHashAsync(BinaryData template, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(template, nameof(template)); + + using var scope = ArmDeploymentDeploymentsClientDiagnostics.CreateScope("MockableResourcesTenantResource.CalculateDeploymentTemplateHash"); + scope.Start(); + try + { + var response = await ArmDeploymentDeploymentsRestClient.CalculateTemplateHashAsync(template, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Calculate the hash of the given template. + /// + /// + /// Request Path + /// /providers/Microsoft.Resources/calculateTemplateHash + /// + /// + /// Operation Id + /// Deployments_CalculateTemplateHash + /// + /// + /// + /// The template provided to calculate hash. + /// The cancellation token to use. + /// is null. + public virtual Response CalculateDeploymentTemplateHash(BinaryData template, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(template, nameof(template)); + + using var scope = ArmDeploymentDeploymentsClientDiagnostics.CreateScope("MockableResourcesTenantResource.CalculateDeploymentTemplateHash"); + scope.Start(); + try + { + var response = ArmDeploymentDeploymentsRestClient.CalculateTemplateHash(template, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index f4e37c1641960..0000000000000 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Resources -{ - /// 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 ArmDeploymentResources in the ResourceGroupResource. - /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. - public virtual ArmDeploymentCollection GetArmDeployments() - { - return GetCachedClient(Client => new ArmDeploymentCollection(Client, Id)); - } - - /// Gets a collection of ArmApplicationResources in the ResourceGroupResource. - /// An object representing collection of ArmApplicationResources and their operations over a ArmApplicationResource. - public virtual ArmApplicationCollection GetArmApplications() - { - return GetCachedClient(Client => new ArmApplicationCollection(Client, Id)); - } - - /// Gets a collection of ArmApplicationDefinitionResources in the ResourceGroupResource. - /// An object representing collection of ArmApplicationDefinitionResources and their operations over a ArmApplicationDefinitionResource. - public virtual ArmApplicationDefinitionCollection GetArmApplicationDefinitions() - { - return GetCachedClient(Client => new ArmApplicationDefinitionCollection(Client, Id)); - } - - /// Gets a collection of JitRequestResources in the ResourceGroupResource. - /// An object representing collection of JitRequestResources and their operations over a JitRequestResource. - public virtual JitRequestCollection GetJitRequests() - { - return GetCachedClient(Client => new JitRequestCollection(Client, Id)); - } - - /// Gets a collection of ArmDeploymentScriptResources in the ResourceGroupResource. - /// An object representing collection of ArmDeploymentScriptResources and their operations over a ArmDeploymentScriptResource. - public virtual ArmDeploymentScriptCollection GetArmDeploymentScripts() - { - return GetCachedClient(Client => new ArmDeploymentScriptCollection(Client, Id)); - } - - /// Gets a collection of TemplateSpecResources in the ResourceGroupResource. - /// An object representing collection of TemplateSpecResources and their operations over a TemplateSpecResource. - public virtual TemplateSpecCollection GetTemplateSpecs() - { - return GetCachedClient(Client => new TemplateSpecCollection(Client, Id)); - } - } -} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourcesExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourcesExtensions.cs index 17114817c9de1..b85f83cf8f242 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourcesExtensions.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourcesExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.ManagementGroups; +using Azure.ResourceManager.Resources.Mocking; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Resources @@ -19,227 +20,171 @@ namespace Azure.ResourceManager.Resources /// A class to add extension methods to Azure.ResourceManager.Resources. public static partial class ResourcesExtensions { - private static ManagementGroupResourceExtensionClient GetManagementGroupResourceExtensionClient(ArmResource resource) + private static MockableResourcesArmClient GetMockableResourcesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ManagementGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableResourcesArmClient(client0)); } - private static ManagementGroupResourceExtensionClient GetManagementGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableResourcesManagementGroupResource GetMockableResourcesManagementGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ManagementGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableResourcesManagementGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableResourcesResourceGroupResource GetMockableResourcesResourceGroupResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableResourcesResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableResourcesSubscriptionResource GetMockableResourcesSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableResourcesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableResourcesTenantResource GetMockableResourcesTenantResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableResourcesTenantResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region ArmDeploymentResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ArmDeploymentResource GetArmDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ArmDeploymentResource.ValidateResourceId(id); - return new ArmDeploymentResource(client, id); - } - ); + return GetMockableResourcesArmClient(client).GetArmDeploymentResource(id); } - #endregion - #region ArmApplicationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ArmApplicationResource GetArmApplicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ArmApplicationResource.ValidateResourceId(id); - return new ArmApplicationResource(client, id); - } - ); + return GetMockableResourcesArmClient(client).GetArmApplicationResource(id); } - #endregion - #region ArmApplicationDefinitionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ArmApplicationDefinitionResource GetArmApplicationDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ArmApplicationDefinitionResource.ValidateResourceId(id); - return new ArmApplicationDefinitionResource(client, id); - } - ); + return GetMockableResourcesArmClient(client).GetArmApplicationDefinitionResource(id); } - #endregion - #region JitRequestResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static JitRequestResource GetJitRequestResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - JitRequestResource.ValidateResourceId(id); - return new JitRequestResource(client, id); - } - ); + return GetMockableResourcesArmClient(client).GetJitRequestResource(id); } - #endregion - #region ArmDeploymentScriptResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ArmDeploymentScriptResource GetArmDeploymentScriptResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ArmDeploymentScriptResource.ValidateResourceId(id); - return new ArmDeploymentScriptResource(client, id); - } - ); + return GetMockableResourcesArmClient(client).GetArmDeploymentScriptResource(id); } - #endregion - #region ScriptLogResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScriptLogResource GetScriptLogResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScriptLogResource.ValidateResourceId(id); - return new ScriptLogResource(client, id); - } - ); + return GetMockableResourcesArmClient(client).GetScriptLogResource(id); } - #endregion - #region TemplateSpecResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TemplateSpecResource GetTemplateSpecResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TemplateSpecResource.ValidateResourceId(id); - return new TemplateSpecResource(client, id); - } - ); + return GetMockableResourcesArmClient(client).GetTemplateSpecResource(id); } - #endregion - #region TemplateSpecVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TemplateSpecVersionResource GetTemplateSpecVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TemplateSpecVersionResource.ValidateResourceId(id); - return new TemplateSpecVersionResource(client, id); - } - ); + return GetMockableResourcesArmClient(client).GetTemplateSpecVersionResource(id); } - #endregion - /// Gets a collection of ArmDeploymentResources in the ManagementGroupResource. + /// + /// Gets a collection of ArmDeploymentResources in the ManagementGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. public static ArmDeploymentCollection GetArmDeployments(this ManagementGroupResource managementGroupResource) { - return GetManagementGroupResourceExtensionClient(managementGroupResource).GetArmDeployments(); + return GetMockableResourcesManagementGroupResource(managementGroupResource).GetArmDeployments(); } /// @@ -254,16 +199,20 @@ public static ArmDeploymentCollection GetArmDeployments(this ManagementGroupReso /// Deployments_GetAtScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetArmDeploymentAsync(this ManagementGroupResource managementGroupResource, string deploymentName, CancellationToken cancellationToken = default) { - return await managementGroupResource.GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesManagementGroupResource(managementGroupResource).GetArmDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); } /// @@ -278,24 +227,34 @@ public static async Task> GetArmDeploymentAsync( /// Deployments_GetAtScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetArmDeployment(this ManagementGroupResource managementGroupResource, string deploymentName, CancellationToken cancellationToken = default) { - return managementGroupResource.GetArmDeployments().Get(deploymentName, cancellationToken); + return GetMockableResourcesManagementGroupResource(managementGroupResource).GetArmDeployment(deploymentName, cancellationToken); } - /// Gets a collection of ArmDeploymentResources in the ResourceGroupResource. + /// + /// Gets a collection of ArmDeploymentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. public static ArmDeploymentCollection GetArmDeployments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetArmDeployments(); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmDeployments(); } /// @@ -310,16 +269,20 @@ public static ArmDeploymentCollection GetArmDeployments(this ResourceGroupResour /// Deployments_GetAtScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetArmDeploymentAsync(this ResourceGroupResource resourceGroupResource, string deploymentName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); } /// @@ -334,24 +297,34 @@ public static async Task> GetArmDeploymentAsync( /// Deployments_GetAtScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetArmDeployment(this ResourceGroupResource resourceGroupResource, string deploymentName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetArmDeployments().Get(deploymentName, cancellationToken); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmDeployment(deploymentName, cancellationToken); } - /// Gets a collection of ArmApplicationResources in the ResourceGroupResource. + /// + /// Gets a collection of ArmApplicationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ArmApplicationResources and their operations over a ArmApplicationResource. public static ArmApplicationCollection GetArmApplications(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetArmApplications(); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmApplications(); } /// @@ -366,16 +339,20 @@ public static ArmApplicationCollection GetArmApplications(this ResourceGroupReso /// Applications_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetArmApplicationAsync(this ResourceGroupResource resourceGroupResource, string applicationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetArmApplications().GetAsync(applicationName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmApplicationAsync(applicationName, cancellationToken).ConfigureAwait(false); } /// @@ -390,24 +367,34 @@ public static async Task> GetArmApplicationAsyn /// Applications_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetArmApplication(this ResourceGroupResource resourceGroupResource, string applicationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetArmApplications().Get(applicationName, cancellationToken); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmApplication(applicationName, cancellationToken); } - /// Gets a collection of ArmApplicationDefinitionResources in the ResourceGroupResource. + /// + /// Gets a collection of ArmApplicationDefinitionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ArmApplicationDefinitionResources and their operations over a ArmApplicationDefinitionResource. public static ArmApplicationDefinitionCollection GetArmApplicationDefinitions(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetArmApplicationDefinitions(); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmApplicationDefinitions(); } /// @@ -422,16 +409,20 @@ public static ArmApplicationDefinitionCollection GetArmApplicationDefinitions(th /// ApplicationDefinitions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed application definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetArmApplicationDefinitionAsync(this ResourceGroupResource resourceGroupResource, string applicationDefinitionName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetArmApplicationDefinitions().GetAsync(applicationDefinitionName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmApplicationDefinitionAsync(applicationDefinitionName, cancellationToken).ConfigureAwait(false); } /// @@ -446,24 +437,34 @@ public static async Task> GetArmAppli /// ApplicationDefinitions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed application definition. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetArmApplicationDefinition(this ResourceGroupResource resourceGroupResource, string applicationDefinitionName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetArmApplicationDefinitions().Get(applicationDefinitionName, cancellationToken); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmApplicationDefinition(applicationDefinitionName, cancellationToken); } - /// Gets a collection of JitRequestResources in the ResourceGroupResource. + /// + /// Gets a collection of JitRequestResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of JitRequestResources and their operations over a JitRequestResource. public static JitRequestCollection GetJitRequests(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetJitRequests(); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetJitRequests(); } /// @@ -478,16 +479,20 @@ public static JitRequestCollection GetJitRequests(this ResourceGroupResource res /// JitRequests_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the JIT request. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetJitRequestAsync(this ResourceGroupResource resourceGroupResource, string jitRequestName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetJitRequests().GetAsync(jitRequestName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesResourceGroupResource(resourceGroupResource).GetJitRequestAsync(jitRequestName, cancellationToken).ConfigureAwait(false); } /// @@ -502,24 +507,34 @@ public static async Task> GetJitRequestAsync(this R /// JitRequests_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the JIT request. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetJitRequest(this ResourceGroupResource resourceGroupResource, string jitRequestName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetJitRequests().Get(jitRequestName, cancellationToken); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetJitRequest(jitRequestName, cancellationToken); } - /// Gets a collection of ArmDeploymentScriptResources in the ResourceGroupResource. + /// + /// Gets a collection of ArmDeploymentScriptResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ArmDeploymentScriptResources and their operations over a ArmDeploymentScriptResource. public static ArmDeploymentScriptCollection GetArmDeploymentScripts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetArmDeploymentScripts(); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmDeploymentScripts(); } /// @@ -534,16 +549,20 @@ public static ArmDeploymentScriptCollection GetArmDeploymentScripts(this Resourc /// DeploymentScripts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the deployment script. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetArmDeploymentScriptAsync(this ResourceGroupResource resourceGroupResource, string scriptName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetArmDeploymentScripts().GetAsync(scriptName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmDeploymentScriptAsync(scriptName, cancellationToken).ConfigureAwait(false); } /// @@ -558,24 +577,34 @@ public static async Task> GetArmDeployment /// DeploymentScripts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the deployment script. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetArmDeploymentScript(this ResourceGroupResource resourceGroupResource, string scriptName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetArmDeploymentScripts().Get(scriptName, cancellationToken); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetArmDeploymentScript(scriptName, cancellationToken); } - /// Gets a collection of TemplateSpecResources in the ResourceGroupResource. + /// + /// Gets a collection of TemplateSpecResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TemplateSpecResources and their operations over a TemplateSpecResource. public static TemplateSpecCollection GetTemplateSpecs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetTemplateSpecs(); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetTemplateSpecs(); } /// @@ -590,17 +619,21 @@ public static TemplateSpecCollection GetTemplateSpecs(this ResourceGroupResource /// TemplateSpecs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Template Spec. /// Allows for expansion of additional Template Spec details in the response. Optional. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTemplateSpecAsync(this ResourceGroupResource resourceGroupResource, string templateSpecName, TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetTemplateSpecs().GetAsync(templateSpecName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesResourceGroupResource(resourceGroupResource).GetTemplateSpecAsync(templateSpecName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -615,25 +648,35 @@ public static async Task> GetTemplateSpecAsync(th /// TemplateSpecs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Template Spec. /// Allows for expansion of additional Template Spec details in the response. Optional. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTemplateSpec(this ResourceGroupResource resourceGroupResource, string templateSpecName, TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetTemplateSpecs().Get(templateSpecName, expand, cancellationToken); + return GetMockableResourcesResourceGroupResource(resourceGroupResource).GetTemplateSpec(templateSpecName, expand, cancellationToken); } - /// Gets a collection of ArmDeploymentResources in the SubscriptionResource. + /// + /// Gets a collection of ArmDeploymentResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. public static ArmDeploymentCollection GetArmDeployments(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetArmDeployments(); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetArmDeployments(); } /// @@ -648,16 +691,20 @@ public static ArmDeploymentCollection GetArmDeployments(this SubscriptionResourc /// Deployments_GetAtScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetArmDeploymentAsync(this SubscriptionResource subscriptionResource, string deploymentName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesSubscriptionResource(subscriptionResource).GetArmDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); } /// @@ -672,16 +719,20 @@ public static async Task> GetArmDeploymentAsync( /// Deployments_GetAtScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetArmDeployment(this SubscriptionResource subscriptionResource, string deploymentName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetArmDeployments().Get(deploymentName, cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetArmDeployment(deploymentName, cancellationToken); } /// @@ -696,13 +747,17 @@ public static Response GetArmDeployment(this Subscription /// Applications_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetArmApplicationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetArmApplicationsAsync(cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetArmApplicationsAsync(cancellationToken); } /// @@ -717,13 +772,17 @@ public static AsyncPageable GetArmApplicationsAsync(this /// Applications_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetArmApplications(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetArmApplications(cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetArmApplications(cancellationToken); } /// @@ -738,13 +797,17 @@ public static Pageable GetArmApplications(this Subscript /// jitRequests_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetJitRequestDefinitionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetJitRequestDefinitionsAsync(cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetJitRequestDefinitionsAsync(cancellationToken); } /// @@ -759,13 +822,17 @@ public static AsyncPageable GetJitRequestDefinitionsAsync(th /// jitRequests_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetJitRequestDefinitions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetJitRequestDefinitions(cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetJitRequestDefinitions(cancellationToken); } /// @@ -780,13 +847,17 @@ public static Pageable GetJitRequestDefinitions(this Subscri /// DeploymentScripts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetArmDeploymentScriptsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetArmDeploymentScriptsAsync(cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetArmDeploymentScriptsAsync(cancellationToken); } /// @@ -801,13 +872,17 @@ public static AsyncPageable GetArmDeploymentScripts /// DeploymentScripts_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetArmDeploymentScripts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetArmDeploymentScripts(cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetArmDeploymentScripts(cancellationToken); } /// @@ -822,6 +897,10 @@ public static Pageable GetArmDeploymentScripts(this /// TemplateSpecs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Allows for expansion of additional Template Spec details in the response. Optional. @@ -829,7 +908,7 @@ public static Pageable GetArmDeploymentScripts(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetTemplateSpecsAsync(this SubscriptionResource subscriptionResource, TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTemplateSpecsAsync(expand, cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetTemplateSpecsAsync(expand, cancellationToken); } /// @@ -844,6 +923,10 @@ public static AsyncPageable GetTemplateSpecsAsync(this Sub /// TemplateSpecs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Allows for expansion of additional Template Spec details in the response. Optional. @@ -851,15 +934,21 @@ public static AsyncPageable GetTemplateSpecsAsync(this Sub /// A collection of that may take multiple service requests to iterate over. public static Pageable GetTemplateSpecs(this SubscriptionResource subscriptionResource, TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTemplateSpecs(expand, cancellationToken); + return GetMockableResourcesSubscriptionResource(subscriptionResource).GetTemplateSpecs(expand, cancellationToken); } - /// Gets a collection of ArmDeploymentResources in the TenantResource. + /// + /// Gets a collection of ArmDeploymentResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. public static ArmDeploymentCollection GetArmDeployments(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetArmDeployments(); + return GetMockableResourcesTenantResource(tenantResource).GetArmDeployments(); } /// @@ -874,16 +963,20 @@ public static ArmDeploymentCollection GetArmDeployments(this TenantResource tena /// Deployments_GetAtScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetArmDeploymentAsync(this TenantResource tenantResource, string deploymentName, CancellationToken cancellationToken = default) { - return await tenantResource.GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesTenantResource(tenantResource).GetArmDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); } /// @@ -898,16 +991,20 @@ public static async Task> GetArmDeploymentAsync( /// Deployments_GetAtScope /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetArmDeployment(this TenantResource tenantResource, string deploymentName, CancellationToken cancellationToken = default) { - return tenantResource.GetArmDeployments().Get(deploymentName, cancellationToken); + return GetMockableResourcesTenantResource(tenantResource).GetArmDeployment(deploymentName, cancellationToken); } /// @@ -922,6 +1019,10 @@ public static Response GetArmDeployment(this TenantResour /// Deployments_CalculateTemplateHash /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The template provided to calculate hash. @@ -929,9 +1030,7 @@ public static Response GetArmDeployment(this TenantResour /// is null. public static async Task> CalculateDeploymentTemplateHashAsync(this TenantResource tenantResource, BinaryData template, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(template, nameof(template)); - - return await GetTenantResourceExtensionClient(tenantResource).CalculateDeploymentTemplateHashAsync(template, cancellationToken).ConfigureAwait(false); + return await GetMockableResourcesTenantResource(tenantResource).CalculateDeploymentTemplateHashAsync(template, cancellationToken).ConfigureAwait(false); } /// @@ -946,6 +1045,10 @@ public static async Task> CalculateDeploymentTempla /// Deployments_CalculateTemplateHash /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The template provided to calculate hash. @@ -953,9 +1056,7 @@ public static async Task> CalculateDeploymentTempla /// is null. public static Response CalculateDeploymentTemplateHash(this TenantResource tenantResource, BinaryData template, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(template, nameof(template)); - - return GetTenantResourceExtensionClient(tenantResource).CalculateDeploymentTemplateHash(template, cancellationToken); + return GetMockableResourcesTenantResource(tenantResource).CalculateDeploymentTemplateHash(template, cancellationToken); } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 40909fe4d8012..0000000000000 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Resources -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _armApplicationApplicationsClientDiagnostics; - private ApplicationsRestOperations _armApplicationApplicationsRestClient; - private ClientDiagnostics _jitRequestClientDiagnostics; - private JitRequestsRestOperations _jitRequestRestClient; - private ClientDiagnostics _armDeploymentScriptDeploymentScriptsClientDiagnostics; - private DeploymentScriptsRestOperations _armDeploymentScriptDeploymentScriptsRestClient; - private ClientDiagnostics _templateSpecClientDiagnostics; - private TemplateSpecsRestOperations _templateSpecRestClient; - - /// 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 ArmApplicationApplicationsClientDiagnostics => _armApplicationApplicationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", ArmApplicationResource.ResourceType.Namespace, Diagnostics); - private ApplicationsRestOperations ArmApplicationApplicationsRestClient => _armApplicationApplicationsRestClient ??= new ApplicationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ArmApplicationResource.ResourceType)); - private ClientDiagnostics JitRequestClientDiagnostics => _jitRequestClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", JitRequestResource.ResourceType.Namespace, Diagnostics); - private JitRequestsRestOperations JitRequestRestClient => _jitRequestRestClient ??= new JitRequestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(JitRequestResource.ResourceType)); - private ClientDiagnostics ArmDeploymentScriptDeploymentScriptsClientDiagnostics => _armDeploymentScriptDeploymentScriptsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", ArmDeploymentScriptResource.ResourceType.Namespace, Diagnostics); - private DeploymentScriptsRestOperations ArmDeploymentScriptDeploymentScriptsRestClient => _armDeploymentScriptDeploymentScriptsRestClient ??= new DeploymentScriptsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ArmDeploymentScriptResource.ResourceType)); - private ClientDiagnostics TemplateSpecClientDiagnostics => _templateSpecClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", TemplateSpecResource.ResourceType.Namespace, Diagnostics); - private TemplateSpecsRestOperations TemplateSpecRestClient => _templateSpecRestClient ??= new TemplateSpecsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TemplateSpecResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ArmDeploymentResources in the SubscriptionResource. - /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. - public virtual ArmDeploymentCollection GetArmDeployments() - { - return GetCachedClient(Client => new ArmDeploymentCollection(Client, Id)); - } - - /// - /// Gets all the applications within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications - /// - /// - /// Operation Id - /// Applications_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetArmApplicationsAsync(CancellationToken cancellationToken = default) - { - Core.HttpMessage FirstPageRequest(int? pageSizeHint) => ArmApplicationApplicationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ArmApplicationApplicationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArmApplicationResource(Client, ArmApplicationData.DeserializeArmApplicationData(e)), ArmApplicationApplicationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetArmApplications", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the applications within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications - /// - /// - /// Operation Id - /// Applications_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetArmApplications(CancellationToken cancellationToken = default) - { - Core.HttpMessage FirstPageRequest(int? pageSizeHint) => ArmApplicationApplicationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ArmApplicationApplicationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArmApplicationResource(Client, ArmApplicationData.DeserializeArmApplicationData(e)), ArmApplicationApplicationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetArmApplications", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieves all JIT requests within the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests - /// - /// - /// Operation Id - /// jitRequests_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetJitRequestDefinitionsAsync(CancellationToken cancellationToken = default) - { - Core.HttpMessage FirstPageRequest(int? pageSizeHint) => JitRequestRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new JitRequestResource(Client, JitRequestData.DeserializeJitRequestData(e)), JitRequestClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetJitRequestDefinitions", "value", null, cancellationToken); - } - - /// - /// Retrieves all JIT requests within the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests - /// - /// - /// Operation Id - /// jitRequests_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetJitRequestDefinitions(CancellationToken cancellationToken = default) - { - Core.HttpMessage FirstPageRequest(int? pageSizeHint) => JitRequestRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new JitRequestResource(Client, JitRequestData.DeserializeJitRequestData(e)), JitRequestClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetJitRequestDefinitions", "value", null, cancellationToken); - } - - /// - /// Lists all deployment scripts for a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentScripts - /// - /// - /// Operation Id - /// DeploymentScripts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetArmDeploymentScriptsAsync(CancellationToken cancellationToken = default) - { - Core.HttpMessage FirstPageRequest(int? pageSizeHint) => ArmDeploymentScriptDeploymentScriptsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ArmDeploymentScriptDeploymentScriptsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArmDeploymentScriptResource(Client, ArmDeploymentScriptData.DeserializeArmDeploymentScriptData(e)), ArmDeploymentScriptDeploymentScriptsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetArmDeploymentScripts", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all deployment scripts for a given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentScripts - /// - /// - /// Operation Id - /// DeploymentScripts_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetArmDeploymentScripts(CancellationToken cancellationToken = default) - { - Core.HttpMessage FirstPageRequest(int? pageSizeHint) => ArmDeploymentScriptDeploymentScriptsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ArmDeploymentScriptDeploymentScriptsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArmDeploymentScriptResource(Client, ArmDeploymentScriptData.DeserializeArmDeploymentScriptData(e)), ArmDeploymentScriptDeploymentScriptsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetArmDeploymentScripts", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the Template Specs within the specified subscriptions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/templateSpecs - /// - /// - /// Operation Id - /// TemplateSpecs_ListBySubscription - /// - /// - /// - /// Allows for expansion of additional Template Spec details in the response. Optional. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetTemplateSpecsAsync(TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) - { - Core.HttpMessage FirstPageRequest(int? pageSizeHint) => TemplateSpecRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); - Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TemplateSpecRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TemplateSpecResource(Client, TemplateSpecData.DeserializeTemplateSpecData(e)), TemplateSpecClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTemplateSpecs", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the Template Specs within the specified subscriptions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/templateSpecs - /// - /// - /// Operation Id - /// TemplateSpecs_ListBySubscription - /// - /// - /// - /// Allows for expansion of additional Template Spec details in the response. Optional. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetTemplateSpecs(TemplateSpecExpandKind? expand = null, CancellationToken cancellationToken = default) - { - Core.HttpMessage FirstPageRequest(int? pageSizeHint) => TemplateSpecRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand); - Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TemplateSpecRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TemplateSpecResource(Client, TemplateSpecData.DeserializeTemplateSpecData(e)), TemplateSpecClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTemplateSpecs", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 0335edab456f3..0000000000000 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,115 +0,0 @@ -// 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; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Resources -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _armDeploymentDeploymentsClientDiagnostics; - private DeploymentsRestOperations _armDeploymentDeploymentsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics ArmDeploymentDeploymentsClientDiagnostics => _armDeploymentDeploymentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources", ArmDeploymentResource.ResourceType.Namespace, Diagnostics); - private DeploymentsRestOperations ArmDeploymentDeploymentsRestClient => _armDeploymentDeploymentsRestClient ??= new DeploymentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ArmDeploymentResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ArmDeploymentResources in the TenantResource. - /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. - public virtual ArmDeploymentCollection GetArmDeployments() - { - return GetCachedClient(Client => new ArmDeploymentCollection(Client, Id)); - } - - /// - /// Calculate the hash of the given template. - /// - /// - /// Request Path - /// /providers/Microsoft.Resources/calculateTemplateHash - /// - /// - /// Operation Id - /// Deployments_CalculateTemplateHash - /// - /// - /// - /// The template provided to calculate hash. - /// The cancellation token to use. - public virtual async Task> CalculateDeploymentTemplateHashAsync(BinaryData template, CancellationToken cancellationToken = default) - { - using var scope = ArmDeploymentDeploymentsClientDiagnostics.CreateScope("TenantResourceExtensionClient.CalculateDeploymentTemplateHash"); - scope.Start(); - try - { - var response = await ArmDeploymentDeploymentsRestClient.CalculateTemplateHashAsync(template, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Calculate the hash of the given template. - /// - /// - /// Request Path - /// /providers/Microsoft.Resources/calculateTemplateHash - /// - /// - /// Operation Id - /// Deployments_CalculateTemplateHash - /// - /// - /// - /// The template provided to calculate hash. - /// The cancellation token to use. - public virtual Response CalculateDeploymentTemplateHash(BinaryData template, CancellationToken cancellationToken = default) - { - using var scope = ArmDeploymentDeploymentsClientDiagnostics.CreateScope("TenantResourceExtensionClient.CalculateDeploymentTemplateHash"); - scope.Start(); - try - { - var response = ArmDeploymentDeploymentsRestClient.CalculateTemplateHash(template, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/JitRequestResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/JitRequestResource.cs index 3de054f24f5e4..7bd123fff860f 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/JitRequestResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/JitRequestResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Resources public partial class JitRequestResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jitRequestName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jitRequestName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}"; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ScriptLogResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ScriptLogResource.cs index 0e48ae241945f..f8fa8ee4946f2 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ScriptLogResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/ScriptLogResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Resources public partial class ScriptLogResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The scriptName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string scriptName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs/default"; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecResource.cs index b7e0f04abb9f4..20f61b0b5cedf 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.Resources public partial class TemplateSpecResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The templateSpecName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string templateSpecName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of TemplateSpecVersionResources and their operations over a TemplateSpecVersionResource. public virtual TemplateSpecVersionCollection GetTemplateSpecVersions() { - return GetCachedClient(Client => new TemplateSpecVersionCollection(Client, Id)); + return GetCachedClient(client => new TemplateSpecVersionCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual TemplateSpecVersionCollection GetTemplateSpecVersions() /// /// The version of the Template Spec. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTemplateSpecVersionAsync(string templateSpecVersion, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetTemplateSpec /// /// The version of the Template Spec. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTemplateSpecVersion(string templateSpecVersion, CancellationToken cancellationToken = default) { diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecVersionResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecVersionResource.cs index 98e3c8feef23a..67b4430081e26 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecVersionResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecVersionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Resources public partial class TemplateSpecVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The templateSpecName. + /// The templateSpecVersion. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string templateSpecName, string templateSpecVersion) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}"; diff --git a/sdk/search/Azure.ResourceManager.Search/CHANGELOG.md b/sdk/search/Azure.ResourceManager.Search/CHANGELOG.md index f1384805eccbc..a9aaa1a529cf2 100644 --- a/sdk/search/Azure.ResourceManager.Search/CHANGELOG.md +++ b/sdk/search/Azure.ResourceManager.Search/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.2.0-beta.2 (Unreleased) +## 1.3.0-beta.1 (Unreleased) ### Features Added @@ -17,12 +17,6 @@ - Added support for '2023-11-01' management plane API version. - Enable the [semantic search](https://learn.microsoft.com/azure/search/semantic-search-overview) feature -### Breaking Changes - -### Bugs Fixed - -### Other Changes - ## 1.2.0-beta.1 (2023-05-31) ### Features Added diff --git a/sdk/search/Azure.ResourceManager.Search/api/Azure.ResourceManager.Search.netstandard2.0.cs b/sdk/search/Azure.ResourceManager.Search/api/Azure.ResourceManager.Search.netstandard2.0.cs index 6191719a1d108..b1076dbb17dca 100644 --- a/sdk/search/Azure.ResourceManager.Search/api/Azure.ResourceManager.Search.netstandard2.0.cs +++ b/sdk/search/Azure.ResourceManager.Search/api/Azure.ResourceManager.Search.netstandard2.0.cs @@ -72,7 +72,7 @@ protected SearchServiceCollection() { } } public partial class SearchServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public SearchServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SearchServiceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Search.Models.SearchAadAuthDataPlaneAuthOptions AuthOptions { get { throw null; } set { } } public Azure.ResourceManager.Search.Models.SearchEncryptionWithCmk EncryptionWithCmk { get { throw null; } set { } } public Azure.ResourceManager.Search.Models.SearchServiceHostingMode? HostingMode { get { throw null; } set { } } @@ -165,6 +165,35 @@ public SharedSearchServicePrivateLinkResourceData() { } public Azure.ResourceManager.Search.Models.SharedSearchServicePrivateLinkResourceProperties Properties { get { throw null; } set { } } } } +namespace Azure.ResourceManager.Search.Mocking +{ + public partial class MockableSearchArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSearchArmClient() { } + public virtual Azure.ResourceManager.Search.SearchPrivateEndpointConnectionResource GetSearchPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Search.SearchServiceResource GetSearchServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Search.SharedSearchServicePrivateLinkResource GetSharedSearchServicePrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSearchResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSearchResourceGroupResource() { } + public virtual Azure.Response GetSearchService(string searchServiceName, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSearchServiceAsync(string searchServiceName, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Search.SearchServiceCollection GetSearchServices() { throw null; } + } + public partial class MockableSearchSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSearchSubscriptionResource() { } + public virtual Azure.Response CheckSearchServiceNameAvailability(Azure.ResourceManager.Search.Models.SearchServiceNameAvailabilityContent content, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckSearchServiceNameAvailabilityAsync(Azure.ResourceManager.Search.Models.SearchServiceNameAvailabilityContent content, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSearchServices(Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSearchServicesAsync(Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsagesBySubscription(Azure.Core.AzureLocation location, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesBySubscriptionAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UsageBySubscriptionSku(Azure.Core.AzureLocation location, string skuName, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UsageBySubscriptionSkuAsync(Azure.Core.AzureLocation location, string skuName, Azure.ResourceManager.Search.Models.SearchManagementRequestOptions searchManagementRequestOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Search.Models { public static partial class ArmSearchModelFactory @@ -340,7 +369,7 @@ internal SearchServiceNameAvailabilityResult() { } } public partial class SearchServicePatch : Azure.ResourceManager.Models.TrackedResourceData { - public SearchServicePatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SearchServicePatch(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Search.Models.SearchAadAuthDataPlaneAuthOptions AuthOptions { get { throw null; } set { } } public Azure.ResourceManager.Search.Models.SearchEncryptionWithCmk EncryptionWithCmk { get { throw null; } set { } } public Azure.ResourceManager.Search.Models.SearchServiceHostingMode? HostingMode { get { throw null; } set { } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Azure.ResourceManager.Search.csproj b/sdk/search/Azure.ResourceManager.Search/src/Azure.ResourceManager.Search.csproj index f5121ab21aba0..9c6e2c307c76b 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Azure.ResourceManager.Search.csproj +++ b/sdk/search/Azure.ResourceManager.Search/src/Azure.ResourceManager.Search.csproj @@ -1,8 +1,8 @@ - 1.2.0-beta.2 + 1.3.0-beta.1 - 1.1.0 + 1.2.0 Azure.ResourceManager.Search Microsoft Azure Resource Manager client SDK for Azure resource provider Microsoft.Search. azure;management;arm;resource manager;search diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchArmClient.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchArmClient.cs new file mode 100644 index 0000000000000..b58b36e685897 --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Search; + +namespace Azure.ResourceManager.Search.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSearchArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSearchArmClient() + { + } + + /// 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 MockableSearchArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSearchArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SearchServiceResource GetSearchServiceResource(ResourceIdentifier id) + { + SearchServiceResource.ValidateResourceId(id); + return new SearchServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SearchPrivateEndpointConnectionResource GetSearchPrivateEndpointConnectionResource(ResourceIdentifier id) + { + SearchPrivateEndpointConnectionResource.ValidateResourceId(id); + return new SearchPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SharedSearchServicePrivateLinkResource GetSharedSearchServicePrivateLinkResource(ResourceIdentifier id) + { + SharedSearchServicePrivateLinkResource.ValidateResourceId(id); + return new SharedSearchServicePrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchResourceGroupResource.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchResourceGroupResource.cs new file mode 100644 index 0000000000000..20eadbf0a4ab7 --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchResourceGroupResource.cs @@ -0,0 +1,95 @@ +// 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.Search; +using Azure.ResourceManager.Search.Models; + +namespace Azure.ResourceManager.Search.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSearchResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSearchResourceGroupResource() + { + } + + /// 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 MockableSearchResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SearchServiceResources in the ResourceGroupResource. + /// An object representing collection of SearchServiceResources and their operations over a SearchServiceResource. + public virtual SearchServiceCollection GetSearchServices() + { + return GetCachedClient(client => new SearchServiceCollection(client, Id)); + } + + /// + /// Gets the search service with the given name in the given resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the Azure Cognitive Search service associated with the specified resource group. + /// Parameter group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSearchServiceAsync(string searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + return await GetSearchServices().GetAsync(searchServiceName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the search service with the given name in the given resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// The name of the Azure Cognitive Search service associated with the specified resource group. + /// Parameter group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSearchService(string searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + return GetSearchServices().Get(searchServiceName, searchManagementRequestOptions, cancellationToken); + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchSubscriptionResource.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchSubscriptionResource.cs new file mode 100644 index 0000000000000..9af2c66b7fb6d --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchSubscriptionResource.cs @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Search; +using Azure.ResourceManager.Search.Models; + +namespace Azure.ResourceManager.Search.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSearchSubscriptionResource : ArmResource + { + private ClientDiagnostics _searchServiceServicesClientDiagnostics; + private ServicesRestOperations _searchServiceServicesRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private SearchManagementRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSearchSubscriptionResource() + { + } + + /// 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 MockableSearchSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SearchServiceServicesClientDiagnostics => _searchServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", SearchServiceResource.ResourceType.Namespace, Diagnostics); + private ServicesRestOperations SearchServiceServicesRestClient => _searchServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SearchServiceResource.ResourceType)); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SearchManagementRestOperations DefaultRestClient => _defaultRestClient ??= new SearchManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets a list of all Search services in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices + /// + /// + /// Operation Id + /// Services_ListBySubscription + /// + /// + /// + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSearchServicesAsync(SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SearchServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, searchManagementRequestOptions); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SearchServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, searchManagementRequestOptions); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SearchServiceResource(Client, SearchServiceData.DeserializeSearchServiceData(e)), SearchServiceServicesClientDiagnostics, Pipeline, "MockableSearchSubscriptionResource.GetSearchServices", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Search services in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices + /// + /// + /// Operation Id + /// Services_ListBySubscription + /// + /// + /// + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSearchServices(SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SearchServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, searchManagementRequestOptions); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SearchServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, searchManagementRequestOptions); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SearchServiceResource(Client, SearchServiceData.DeserializeSearchServiceData(e)), SearchServiceServicesClientDiagnostics, Pipeline, "MockableSearchSubscriptionResource.GetSearchServices", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability + /// + /// + /// Operation Id + /// Services_CheckNameAvailability + /// + /// + /// + /// The resource name and type to check. + /// Parameter group. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckSearchServiceNameAvailabilityAsync(SearchServiceNameAvailabilityContent content, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SearchServiceServicesClientDiagnostics.CreateScope("MockableSearchSubscriptionResource.CheckSearchServiceNameAvailability"); + scope.Start(); + try + { + var response = await SearchServiceServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability + /// + /// + /// Operation Id + /// Services_CheckNameAvailability + /// + /// + /// + /// The resource name and type to check. + /// Parameter group. + /// The cancellation token to use. + /// is null. + public virtual Response CheckSearchServiceNameAvailability(SearchServiceNameAvailabilityContent content, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SearchServiceServicesClientDiagnostics.CreateScope("MockableSearchSubscriptionResource.CheckSearchServiceNameAvailability"); + scope.Start(); + try + { + var response = SearchServiceServicesRestClient.CheckNameAvailability(Id.SubscriptionId, content, searchManagementRequestOptions, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of all Search quota usages in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListBySubscription + /// + /// + /// + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesBySubscriptionAsync(AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, location, searchManagementRequestOptions); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, location, searchManagementRequestOptions); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, QuotaUsageResult.DeserializeQuotaUsageResult, UsagesClientDiagnostics, Pipeline, "MockableSearchSubscriptionResource.GetUsagesBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all Search quota usages in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListBySubscription + /// + /// + /// + /// The unique location name for a Microsoft Azure geographic region. + /// Parameter group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsagesBySubscription(AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, location, searchManagementRequestOptions); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, location, searchManagementRequestOptions); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, QuotaUsageResult.DeserializeQuotaUsageResult, UsagesClientDiagnostics, Pipeline, "MockableSearchSubscriptionResource.GetUsagesBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the quota usage for a search sku in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName} + /// + /// + /// Operation Id + /// UsageBySubscriptionSku + /// + /// + /// + /// The unique location name for a Microsoft Azure geographic region. + /// The unique search service sku name supported by Azure Cognitive Search. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> UsageBySubscriptionSkuAsync(AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableSearchSubscriptionResource.UsageBySubscriptionSku"); + scope.Start(); + try + { + var response = await DefaultRestClient.UsageBySubscriptionSkuAsync(Id.SubscriptionId, location, skuName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the quota usage for a search sku in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName} + /// + /// + /// Operation Id + /// UsageBySubscriptionSku + /// + /// + /// + /// The unique location name for a Microsoft Azure geographic region. + /// The unique search service sku name supported by Azure Cognitive Search. + /// Parameter group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response UsageBySubscriptionSku(AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableSearchSubscriptionResource.UsageBySubscriptionSku"); + scope.Start(); + try + { + var response = DefaultRestClient.UsageBySubscriptionSku(Id.SubscriptionId, location, skuName, searchManagementRequestOptions, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index e4fd40c1cd7b0..0000000000000 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Search -{ - /// 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 SearchServiceResources in the ResourceGroupResource. - /// An object representing collection of SearchServiceResources and their operations over a SearchServiceResource. - public virtual SearchServiceCollection GetSearchServices() - { - return GetCachedClient(Client => new SearchServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SearchExtensions.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SearchExtensions.cs index dc8a7e8de7385..0257a52fc14f0 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SearchExtensions.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SearchExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Search.Mocking; using Azure.ResourceManager.Search.Models; namespace Azure.ResourceManager.Search @@ -19,100 +20,81 @@ namespace Azure.ResourceManager.Search /// A class to add extension methods to Azure.ResourceManager.Search. public static partial class SearchExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSearchArmClient GetMockableSearchArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSearchArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSearchResourceGroupResource GetMockableSearchResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSearchResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSearchSubscriptionResource GetMockableSearchSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSearchSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region SearchServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SearchServiceResource GetSearchServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SearchServiceResource.ValidateResourceId(id); - return new SearchServiceResource(client, id); - } - ); + return GetMockableSearchArmClient(client).GetSearchServiceResource(id); } - #endregion - #region SearchPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SearchPrivateEndpointConnectionResource GetSearchPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SearchPrivateEndpointConnectionResource.ValidateResourceId(id); - return new SearchPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableSearchArmClient(client).GetSearchPrivateEndpointConnectionResource(id); } - #endregion - #region SharedSearchServicePrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SharedSearchServicePrivateLinkResource GetSharedSearchServicePrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SharedSearchServicePrivateLinkResource.ValidateResourceId(id); - return new SharedSearchServicePrivateLinkResource(client, id); - } - ); + return GetMockableSearchArmClient(client).GetSharedSearchServicePrivateLinkResource(id); } - #endregion - /// Gets a collection of SearchServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of SearchServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SearchServiceResources and their operations over a SearchServiceResource. public static SearchServiceCollection GetSearchServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSearchServices(); + return GetMockableSearchResourceGroupResource(resourceGroupResource).GetSearchServices(); } /// @@ -127,17 +109,21 @@ public static SearchServiceCollection GetSearchServices(this ResourceGroupResour /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Cognitive Search service associated with the specified resource group. /// Parameter group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSearchServiceAsync(this ResourceGroupResource resourceGroupResource, string searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSearchServices().GetAsync(searchServiceName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); + return await GetMockableSearchResourceGroupResource(resourceGroupResource).GetSearchServiceAsync(searchServiceName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); } /// @@ -152,17 +138,21 @@ public static async Task> GetSearchServiceAsync( /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Azure Cognitive Search service associated with the specified resource group. /// Parameter group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSearchService(this ResourceGroupResource resourceGroupResource, string searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSearchServices().Get(searchServiceName, searchManagementRequestOptions, cancellationToken); + return GetMockableSearchResourceGroupResource(resourceGroupResource).GetSearchService(searchServiceName, searchManagementRequestOptions, cancellationToken); } /// @@ -177,6 +167,10 @@ public static Response GetSearchService(this ResourceGrou /// Services_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameter group. @@ -184,7 +178,7 @@ public static Response GetSearchService(this ResourceGrou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSearchServicesAsync(this SubscriptionResource subscriptionResource, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSearchServicesAsync(searchManagementRequestOptions, cancellationToken); + return GetMockableSearchSubscriptionResource(subscriptionResource).GetSearchServicesAsync(searchManagementRequestOptions, cancellationToken); } /// @@ -199,6 +193,10 @@ public static AsyncPageable GetSearchServicesAsync(this S /// Services_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameter group. @@ -206,7 +204,7 @@ public static AsyncPageable GetSearchServicesAsync(this S /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSearchServices(this SubscriptionResource subscriptionResource, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSearchServices(searchManagementRequestOptions, cancellationToken); + return GetMockableSearchSubscriptionResource(subscriptionResource).GetSearchServices(searchManagementRequestOptions, cancellationToken); } /// @@ -221,6 +219,10 @@ public static Pageable GetSearchServices(this Subscriptio /// Services_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource name and type to check. @@ -229,9 +231,7 @@ public static Pageable GetSearchServices(this Subscriptio /// is null. public static async Task> CheckSearchServiceNameAvailabilityAsync(this SubscriptionResource subscriptionResource, SearchServiceNameAvailabilityContent content, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSearchServiceNameAvailabilityAsync(content, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); + return await GetMockableSearchSubscriptionResource(subscriptionResource).CheckSearchServiceNameAvailabilityAsync(content, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); } /// @@ -246,6 +246,10 @@ public static async Task> CheckSea /// Services_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource name and type to check. @@ -254,9 +258,7 @@ public static async Task> CheckSea /// is null. public static Response CheckSearchServiceNameAvailability(this SubscriptionResource subscriptionResource, SearchServiceNameAvailabilityContent content, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSearchServiceNameAvailability(content, searchManagementRequestOptions, cancellationToken); + return GetMockableSearchSubscriptionResource(subscriptionResource).CheckSearchServiceNameAvailability(content, searchManagementRequestOptions, cancellationToken); } /// @@ -271,6 +273,10 @@ public static Response CheckSearchServiceNa /// Usages_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The unique location name for a Microsoft Azure geographic region. @@ -279,7 +285,7 @@ public static Response CheckSearchServiceNa /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesBySubscriptionAsync(this SubscriptionResource subscriptionResource, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesBySubscriptionAsync(location, searchManagementRequestOptions, cancellationToken); + return GetMockableSearchSubscriptionResource(subscriptionResource).GetUsagesBySubscriptionAsync(location, searchManagementRequestOptions, cancellationToken); } /// @@ -294,6 +300,10 @@ public static AsyncPageable GetUsagesBySubscriptionAsync(this /// Usages_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The unique location name for a Microsoft Azure geographic region. @@ -302,7 +312,7 @@ public static AsyncPageable GetUsagesBySubscriptionAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsagesBySubscription(this SubscriptionResource subscriptionResource, AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesBySubscription(location, searchManagementRequestOptions, cancellationToken); + return GetMockableSearchSubscriptionResource(subscriptionResource).GetUsagesBySubscription(location, searchManagementRequestOptions, cancellationToken); } /// @@ -317,6 +327,10 @@ public static Pageable GetUsagesBySubscription(this Subscripti /// UsageBySubscriptionSku /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The unique location name for a Microsoft Azure geographic region. @@ -327,9 +341,7 @@ public static Pageable GetUsagesBySubscription(this Subscripti /// is null. public static async Task> UsageBySubscriptionSkuAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).UsageBySubscriptionSkuAsync(location, skuName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); + return await GetMockableSearchSubscriptionResource(subscriptionResource).UsageBySubscriptionSkuAsync(location, skuName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); } /// @@ -344,6 +356,10 @@ public static async Task> UsageBySubscriptionSkuAsync /// UsageBySubscriptionSku /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The unique location name for a Microsoft Azure geographic region. @@ -354,9 +370,7 @@ public static async Task> UsageBySubscriptionSkuAsync /// is null. public static Response UsageBySubscriptionSku(this SubscriptionResource subscriptionResource, AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(skuName, nameof(skuName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).UsageBySubscriptionSku(location, skuName, searchManagementRequestOptions, cancellationToken); + return GetMockableSearchSubscriptionResource(subscriptionResource).UsageBySubscriptionSku(location, skuName, searchManagementRequestOptions, cancellationToken); } } } diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 80ca75afdcedf..0000000000000 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Search.Models; - -namespace Azure.ResourceManager.Search -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _searchServiceServicesClientDiagnostics; - private ServicesRestOperations _searchServiceServicesRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private SearchManagementRestOperations _defaultRestClient; - - /// 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 SearchServiceServicesClientDiagnostics => _searchServiceServicesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", SearchServiceResource.ResourceType.Namespace, Diagnostics); - private ServicesRestOperations SearchServiceServicesRestClient => _searchServiceServicesRestClient ??= new ServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SearchServiceResource.ResourceType)); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Search", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SearchManagementRestOperations DefaultRestClient => _defaultRestClient ??= new SearchManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets a list of all Search services in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices - /// - /// - /// Operation Id - /// Services_ListBySubscription - /// - /// - /// - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSearchServicesAsync(SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SearchServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, searchManagementRequestOptions); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SearchServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, searchManagementRequestOptions); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SearchServiceResource(Client, SearchServiceData.DeserializeSearchServiceData(e)), SearchServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSearchServices", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all Search services in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices - /// - /// - /// Operation Id - /// Services_ListBySubscription - /// - /// - /// - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSearchServices(SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SearchServiceServicesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, searchManagementRequestOptions); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SearchServiceServicesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, searchManagementRequestOptions); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SearchServiceResource(Client, SearchServiceData.DeserializeSearchServiceData(e)), SearchServiceServicesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSearchServices", "value", "nextLink", cancellationToken); - } - - /// - /// Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability - /// - /// - /// Operation Id - /// Services_CheckNameAvailability - /// - /// - /// - /// The resource name and type to check. - /// Parameter group. - /// The cancellation token to use. - public virtual async Task> CheckSearchServiceNameAvailabilityAsync(SearchServiceNameAvailabilityContent content, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) - { - using var scope = SearchServiceServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSearchServiceNameAvailability"); - scope.Start(); - try - { - var response = await SearchServiceServicesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability - /// - /// - /// Operation Id - /// Services_CheckNameAvailability - /// - /// - /// - /// The resource name and type to check. - /// Parameter group. - /// The cancellation token to use. - public virtual Response CheckSearchServiceNameAvailability(SearchServiceNameAvailabilityContent content, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) - { - using var scope = SearchServiceServicesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSearchServiceNameAvailability"); - scope.Start(); - try - { - var response = SearchServiceServicesRestClient.CheckNameAvailability(Id.SubscriptionId, content, searchManagementRequestOptions, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of all Search quota usages in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_ListBySubscription - /// - /// - /// - /// The unique location name for a Microsoft Azure geographic region. - /// Parameter group. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesBySubscriptionAsync(AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, location, searchManagementRequestOptions); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, location, searchManagementRequestOptions); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, QuotaUsageResult.DeserializeQuotaUsageResult, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesBySubscription", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all Search quota usages in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_ListBySubscription - /// - /// - /// - /// The unique location name for a Microsoft Azure geographic region. - /// Parameter group. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsagesBySubscription(AzureLocation location, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, location, searchManagementRequestOptions); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, location, searchManagementRequestOptions); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, QuotaUsageResult.DeserializeQuotaUsageResult, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesBySubscription", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the quota usage for a search sku in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName} - /// - /// - /// Operation Id - /// UsageBySubscriptionSku - /// - /// - /// - /// The unique location name for a Microsoft Azure geographic region. - /// The unique search service sku name supported by Azure Cognitive Search. - /// Parameter group. - /// The cancellation token to use. - public virtual async Task> UsageBySubscriptionSkuAsync(AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.UsageBySubscriptionSku"); - scope.Start(); - try - { - var response = await DefaultRestClient.UsageBySubscriptionSkuAsync(Id.SubscriptionId, location, skuName, searchManagementRequestOptions, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the quota usage for a search sku in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName} - /// - /// - /// Operation Id - /// UsageBySubscriptionSku - /// - /// - /// - /// The unique location name for a Microsoft Azure geographic region. - /// The unique search service sku name supported by Azure Cognitive Search. - /// Parameter group. - /// The cancellation token to use. - public virtual Response UsageBySubscriptionSku(AzureLocation location, string skuName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.UsageBySubscriptionSku"); - scope.Start(); - try - { - var response = DefaultRestClient.UsageBySubscriptionSku(Id.SubscriptionId, location, skuName, searchManagementRequestOptions, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchPrivateEndpointConnectionResource.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchPrivateEndpointConnectionResource.cs index 3fe5292e19967..e4ac88d2ebe36 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchPrivateEndpointConnectionResource.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Search public partial class SearchPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The searchServiceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string searchServiceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceResource.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceResource.cs index 9402e5eebf3f6..b84f1767cca4b 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceResource.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Search public partial class SearchServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The searchServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string searchServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"; @@ -106,7 +109,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SearchPrivateEndpointConnectionResources and their operations over a SearchPrivateEndpointConnectionResource. public virtual SearchPrivateEndpointConnectionCollection GetSearchPrivateEndpointConnections() { - return GetCachedClient(Client => new SearchPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new SearchPrivateEndpointConnectionCollection(client, Id)); } /// @@ -125,8 +128,8 @@ public virtual SearchPrivateEndpointConnectionCollection GetSearchPrivateEndpoin /// The name of the private endpoint connection to the Azure Cognitive Search service with the specified resource group. /// Parameter group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSearchPrivateEndpointConnectionAsync(string privateEndpointConnectionName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { @@ -149,8 +152,8 @@ public virtual async Task> Get /// The name of the private endpoint connection to the Azure Cognitive Search service with the specified resource group. /// Parameter group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSearchPrivateEndpointConnection(string privateEndpointConnectionName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { @@ -161,7 +164,7 @@ public virtual Response GetSearchPrivat /// An object representing collection of SharedSearchServicePrivateLinkResources and their operations over a SharedSearchServicePrivateLinkResource. public virtual SharedSearchServicePrivateLinkResourceCollection GetSharedSearchServicePrivateLinkResources() { - return GetCachedClient(Client => new SharedSearchServicePrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new SharedSearchServicePrivateLinkResourceCollection(client, Id)); } /// @@ -180,8 +183,8 @@ public virtual SharedSearchServicePrivateLinkResourceCollection GetSharedSearchS /// The name of the shared private link resource managed by the Azure Cognitive Search service within the specified resource group. /// Parameter group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSharedSearchServicePrivateLinkResourceAsync(string sharedPrivateLinkResourceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { @@ -204,8 +207,8 @@ public virtual async Task> GetS /// The name of the shared private link resource managed by the Azure Cognitive Search service within the specified resource group. /// Parameter group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSharedSearchServicePrivateLinkResource(string sharedPrivateLinkResourceName, SearchManagementRequestOptions searchManagementRequestOptions = null, CancellationToken cancellationToken = default) { diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/SharedSearchServicePrivateLinkResource.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/SharedSearchServicePrivateLinkResource.cs index 56ff39ce56dd1..b3ac36118b648 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/SharedSearchServicePrivateLinkResource.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/SharedSearchServicePrivateLinkResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Search public partial class SharedSearchServicePrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The searchServiceName. + /// The sharedPrivateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string searchServiceName, string sharedPrivateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}"; diff --git a/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingRawVectorQuery.md b/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingRawVectorQuery.md index ae806d897333f..2782499061deb 100644 --- a/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingRawVectorQuery.md +++ b/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingRawVectorQuery.md @@ -87,10 +87,10 @@ AzureKeyCredential credential = new AzureKeyCredential(key); OpenAIClient openAIClient = new OpenAIClient(endpoint, credential); string description = "Very popular hotel in town."; -EmbeddingsOptions embeddingsOptions = new(description); +EmbeddingsOptions embeddingsOptions = new("EmbeddingsModelName", new string[] { description }); -Embeddings embeddings = await openAIClient.GetEmbeddingsAsync("EmbeddingsModelName", embeddingsOptions); -IReadOnlyList descriptionVector = embeddings.Data[0].Embedding; +Embeddings embeddings = await openAIClient.GetEmbeddingsAsync(embeddingsOptions); +ReadOnlyMemory descriptionVector = embeddings.Data[0].Embedding; ``` In the sample code below, we are using hardcoded embeddings for the vector fields named `DescriptionVector` and `CategoryVector`: diff --git a/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingSemanticHybridQuery.md b/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingSemanticHybridQuery.md index fe4a427345edd..01571c482dd12 100644 --- a/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingSemanticHybridQuery.md +++ b/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingSemanticHybridQuery.md @@ -105,10 +105,10 @@ AzureKeyCredential credential = new AzureKeyCredential(key); OpenAIClient openAIClient = new OpenAIClient(endpoint, credential); string description = "Very popular hotel in town."; -EmbeddingsOptions embeddingsOptions = new(description); +EmbeddingsOptions embeddingsOptions = new("EmbeddingsModelName", new string[] { description }); -Embeddings embeddings = await openAIClient.GetEmbeddingsAsync("EmbeddingsModelName", embeddingsOptions); -IReadOnlyList descriptionVector = embeddings.Data[0].Embedding; +Embeddings embeddings = await openAIClient.GetEmbeddingsAsync(embeddingsOptions); +ReadOnlyMemory descriptionVector = embeddings.Data[0].Embedding; ``` In the sample code below, we are using hardcoded embeddings for the vector fields named `DescriptionVector` and `CategoryVector`: diff --git a/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingVectorizableTextQuery.md b/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingVectorizableTextQuery.md index cb6fea295d425..b8fd230caf209 100644 --- a/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingVectorizableTextQuery.md +++ b/sdk/search/Azure.Search.Documents/samples/Sample07_VectorSearch_UsingVectorizableTextQuery.md @@ -103,10 +103,10 @@ AzureKeyCredential credential = new AzureKeyCredential(key); OpenAIClient openAIClient = new OpenAIClient(endpoint, credential); string description = "Very popular hotel in town."; -EmbeddingsOptions embeddingsOptions = new(description); +EmbeddingsOptions embeddingsOptions = new("EmbeddingsModelName", new string[] { description }); -Embeddings embeddings = await openAIClient.GetEmbeddingsAsync("EmbeddingsModelName", embeddingsOptions); -IReadOnlyList descriptionVector = embeddings.Data[0].Embedding; +Embeddings embeddings = await openAIClient.GetEmbeddingsAsync(embeddingsOptions); +ReadOnlyMemory descriptionVector = embeddings.Data[0].Embedding; ``` In the sample code below, we are using hardcoded embeddings for the vector fields named `DescriptionVector` and `CategoryVector`: diff --git a/sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj b/sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj index b23eadc793180..273e7a624fbd3 100644 --- a/sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj +++ b/sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj @@ -27,7 +27,7 @@ - + diff --git a/sdk/search/Azure.Search.Documents/tests/Samples/Readme.cs b/sdk/search/Azure.Search.Documents/tests/Samples/Readme.cs index d9a1323659b90..fda5e53c1c27d 100644 --- a/sdk/search/Azure.Search.Documents/tests/Samples/Readme.cs +++ b/sdk/search/Azure.Search.Documents/tests/Samples/Readme.cs @@ -215,10 +215,10 @@ public async Task GetEmbeddings() OpenAIClient openAIClient = new OpenAIClient(endpoint, credential); string description = "Very popular hotel in town."; - EmbeddingsOptions embeddingsOptions = new(description); + EmbeddingsOptions embeddingsOptions = new("EmbeddingsModelName", new string[] { description }); - Embeddings embeddings = await openAIClient.GetEmbeddingsAsync("EmbeddingsModelName", embeddingsOptions); - IReadOnlyList descriptionVector = embeddings.Data[0].Embedding; + Embeddings embeddings = await openAIClient.GetEmbeddingsAsync(embeddingsOptions); + ReadOnlyMemory descriptionVector = embeddings.Data[0].Embedding; #endregion } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/api/Azure.ResourceManager.SecurityCenter.netstandard2.0.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/api/Azure.ResourceManager.SecurityCenter.netstandard2.0.cs index 1c78fd31e953e..61e97929f41eb 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/api/Azure.ResourceManager.SecurityCenter.netstandard2.0.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/api/Azure.ResourceManager.SecurityCenter.netstandard2.0.cs @@ -535,7 +535,7 @@ protected IotSecuritySolutionCollection() { } } public partial class IotSecuritySolutionData : Azure.ResourceManager.Models.TrackedResourceData { - public IotSecuritySolutionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public IotSecuritySolutionData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AdditionalWorkspaces { get { throw null; } } public System.Collections.Generic.IReadOnlyList AutoDiscoveredResources { get { throw null; } } public System.Collections.Generic.IList DisabledDataSources { get { throw null; } } @@ -979,7 +979,7 @@ protected SecurityAutomationCollection() { } } public partial class SecurityAutomationData : Azure.ResourceManager.Models.TrackedResourceData { - public SecurityAutomationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SecurityAutomationData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList Actions { get { throw null; } } public string Description { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } @@ -1443,7 +1443,7 @@ protected SecurityConnectorCollection() { } } public partial class SecurityConnectorData : Azure.ResourceManager.Models.TrackedResourceData { - public SecurityConnectorData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SecurityConnectorData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.SecurityCenter.Models.SecurityConnectorEnvironment EnvironmentData { get { throw null; } set { } } public Azure.ResourceManager.SecurityCenter.Models.SecurityCenterCloudName? EnvironmentName { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } set { } } @@ -2009,6 +2009,245 @@ protected TenantAssessmentMetadataResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.SecurityCenter.Mocking +{ + public partial class MockableSecurityCenterArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSecurityCenterArmClient() { } + public virtual Azure.Response CreateOrUpdateInformationProtectionPolicy(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.SecurityCenter.Models.InformationProtectionPolicyName informationProtectionPolicyName, Azure.ResourceManager.SecurityCenter.Models.InformationProtectionPolicy informationProtectionPolicy, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateInformationProtectionPolicyAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.SecurityCenter.Models.InformationProtectionPolicyName informationProtectionPolicyName, Azure.ResourceManager.SecurityCenter.Models.InformationProtectionPolicy informationProtectionPolicy, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.AdaptiveApplicationControlGroupResource GetAdaptiveApplicationControlGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.AdaptiveNetworkHardeningResource GetAdaptiveNetworkHardeningResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSetting(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.AutoProvisioningSettingResource GetAutoProvisioningSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetComplianceResult(Azure.Core.ResourceIdentifier scope, string complianceResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetComplianceResultAsync(Azure.Core.ResourceIdentifier scope, string complianceResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.ComplianceResultResource GetComplianceResultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.ComplianceResultCollection GetComplianceResults(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.CustomAssessmentAutomationResource GetCustomAssessmentAutomationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.CustomEntityStoreAssignmentResource GetCustomEntityStoreAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetDeviceSecurityGroup(Azure.Core.ResourceIdentifier scope, string deviceSecurityGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeviceSecurityGroupAsync(Azure.Core.ResourceIdentifier scope, string deviceSecurityGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.DeviceSecurityGroupResource GetDeviceSecurityGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.DeviceSecurityGroupCollection GetDeviceSecurityGroups(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.GovernanceAssignmentResource GetGovernanceAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetGovernanceRule(Azure.Core.ResourceIdentifier scope, string ruleId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGovernanceRuleAsync(Azure.Core.ResourceIdentifier scope, string ruleId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.GovernanceRuleResource GetGovernanceRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.GovernanceRuleCollection GetGovernanceRules(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetInformationProtectionPolicies(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetInformationProtectionPoliciesAsync(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.IngestionSettingResource GetIngestionSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.IotSecurityAggregatedAlertResource GetIotSecurityAggregatedAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.IotSecurityAggregatedRecommendationResource GetIotSecurityAggregatedRecommendationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.IotSecuritySolutionAnalyticsModelResource GetIotSecuritySolutionAnalyticsModelResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.IotSecuritySolutionResource GetIotSecuritySolutionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.JitNetworkAccessPolicyResource GetJitNetworkAccessPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.RegulatoryComplianceAssessmentResource GetRegulatoryComplianceAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.RegulatoryComplianceControlResource GetRegulatoryComplianceControlResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.RegulatoryComplianceStandardResource GetRegulatoryComplianceStandardResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.ResourceGroupSecurityAlertResource GetResourceGroupSecurityAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.ResourceGroupSecurityTaskResource GetResourceGroupSecurityTaskResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecureScoreResource GetSecureScoreResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityAlertsSuppressionRuleResource GetSecurityAlertsSuppressionRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetSecurityAssessment(Azure.Core.ResourceIdentifier scope, string assessmentName, Azure.ResourceManager.SecurityCenter.Models.SecurityAssessmentODataExpand? expand = default(Azure.ResourceManager.SecurityCenter.Models.SecurityAssessmentODataExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityAssessmentAsync(Azure.Core.ResourceIdentifier scope, string assessmentName, Azure.ResourceManager.SecurityCenter.Models.SecurityAssessmentODataExpand? expand = default(Azure.ResourceManager.SecurityCenter.Models.SecurityAssessmentODataExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityAssessmentResource GetSecurityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityAssessmentCollection GetSecurityAssessments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetSecurityAssessments(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecurityAssessmentsAsync(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityAutomationResource GetSecurityAutomationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityCenterLocationResource GetSecurityCenterLocationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityCenterPricingResource GetSecurityCenterPricingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityCloudConnectorResource GetSecurityCloudConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetSecurityCompliance(Azure.Core.ResourceIdentifier scope, string complianceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityComplianceAsync(Azure.Core.ResourceIdentifier scope, string complianceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityComplianceResource GetSecurityComplianceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityComplianceCollection GetSecurityCompliances(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityConnectorApplicationResource GetSecurityConnectorApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release.", false)] + public virtual Azure.ResourceManager.SecurityCenter.SecurityConnectorGovernanceRuleResource GetSecurityConnectorGovernanceRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityConnectorResource GetSecurityConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityContactResource GetSecurityContactResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecuritySettingResource GetSecuritySettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecuritySubAssessmentResource GetSecuritySubAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Pageable GetSecuritySubAssessments(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecuritySubAssessmentsAsync(Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityWorkspaceSettingResource GetSecurityWorkspaceSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.ServerVulnerabilityAssessmentResource GetServerVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SoftwareInventoryResource GetSoftwareInventoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetSqlVulnerabilityAssessmentBaselineRule(Azure.Core.ResourceIdentifier scope, string ruleId, System.Guid workspaceId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSqlVulnerabilityAssessmentBaselineRuleAsync(Azure.Core.ResourceIdentifier scope, string ruleId, System.Guid workspaceId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SqlVulnerabilityAssessmentBaselineRuleResource GetSqlVulnerabilityAssessmentBaselineRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SqlVulnerabilityAssessmentBaselineRuleCollection GetSqlVulnerabilityAssessmentBaselineRules(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetSqlVulnerabilityAssessmentScan(Azure.Core.ResourceIdentifier scope, string scanId, System.Guid workspaceId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSqlVulnerabilityAssessmentScanAsync(Azure.Core.ResourceIdentifier scope, string scanId, System.Guid workspaceId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SqlVulnerabilityAssessmentScanResource GetSqlVulnerabilityAssessmentScanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SqlVulnerabilityAssessmentScanCollection GetSqlVulnerabilityAssessmentScans(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SubscriptionAssessmentMetadataResource GetSubscriptionAssessmentMetadataResource(Azure.Core.ResourceIdentifier id) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release. Please use GetGovernanceRuleResource.", false)] + public virtual Azure.ResourceManager.SecurityCenter.SubscriptionGovernanceRuleResource GetSubscriptionGovernanceRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SubscriptionSecurityAlertResource GetSubscriptionSecurityAlertResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SubscriptionSecurityApplicationResource GetSubscriptionSecurityApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SubscriptionSecurityTaskResource GetSubscriptionSecurityTaskResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.TenantAssessmentMetadataResource GetTenantAssessmentMetadataResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSecurityCenterResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSecurityCenterResourceGroupResource() { } + public virtual Azure.Response GetAdaptiveNetworkHardening(string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAdaptiveNetworkHardeningAsync(string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.AdaptiveNetworkHardeningCollection GetAdaptiveNetworkHardenings(string resourceNamespace, string resourceType, string resourceName) { throw null; } + public virtual Azure.Pageable GetAlertsByResourceGroup(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAlertsByResourceGroupAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAllowedConnection(Azure.Core.AzureLocation ascLocation, Azure.ResourceManager.SecurityCenter.Models.SecurityCenterConnectionType connectionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAllowedConnectionAsync(Azure.Core.AzureLocation ascLocation, Azure.ResourceManager.SecurityCenter.Models.SecurityCenterConnectionType connectionType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCustomAssessmentAutomation(string customAssessmentAutomationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCustomAssessmentAutomationAsync(string customAssessmentAutomationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.CustomAssessmentAutomationCollection GetCustomAssessmentAutomations() { throw null; } + public virtual Azure.Response GetCustomEntityStoreAssignment(string customEntityStoreAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCustomEntityStoreAssignmentAsync(string customEntityStoreAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.CustomEntityStoreAssignmentCollection GetCustomEntityStoreAssignments() { throw null; } + public virtual Azure.Response GetDiscoveredSecuritySolution(Azure.Core.AzureLocation ascLocation, string discoveredSecuritySolutionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiscoveredSecuritySolutionAsync(Azure.Core.AzureLocation ascLocation, string discoveredSecuritySolutionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetExternalSecuritySolution(Azure.Core.AzureLocation ascLocation, string externalSecuritySolutionsName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetExternalSecuritySolutionAsync(Azure.Core.AzureLocation ascLocation, string externalSecuritySolutionsName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetIotSecuritySolution(string solutionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIotSecuritySolutionAsync(string solutionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.IotSecuritySolutionCollection GetIotSecuritySolutions() { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.JitNetworkAccessPolicyCollection GetJitNetworkAccessPolicies(Azure.Core.AzureLocation ascLocation) { throw null; } + public virtual Azure.Pageable GetJitNetworkAccessPolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetJitNetworkAccessPoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetJitNetworkAccessPolicy(Azure.Core.AzureLocation ascLocation, string jitNetworkAccessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetJitNetworkAccessPolicyAsync(Azure.Core.AzureLocation ascLocation, string jitNetworkAccessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetResourceGroupSecurityAlert(Azure.Core.AzureLocation ascLocation, string alertName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceGroupSecurityAlertAsync(Azure.Core.AzureLocation ascLocation, string alertName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.ResourceGroupSecurityAlertCollection GetResourceGroupSecurityAlerts(Azure.Core.AzureLocation ascLocation) { throw null; } + public virtual Azure.Response GetResourceGroupSecurityTask(Azure.Core.AzureLocation ascLocation, string taskName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceGroupSecurityTaskAsync(Azure.Core.AzureLocation ascLocation, string taskName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.ResourceGroupSecurityTaskCollection GetResourceGroupSecurityTasks(Azure.Core.AzureLocation ascLocation) { throw null; } + public virtual Azure.Response GetSecurityAutomation(string automationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityAutomationAsync(string automationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityAutomationCollection GetSecurityAutomations() { throw null; } + public virtual Azure.Response GetSecurityConnector(string securityConnectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityConnectorAsync(string securityConnectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityConnectorCollection GetSecurityConnectors() { throw null; } + public virtual Azure.Response GetSecuritySolution(Azure.Core.AzureLocation ascLocation, string securitySolutionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecuritySolutionAsync(Azure.Core.AzureLocation ascLocation, string securitySolutionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetServerVulnerabilityAssessment(string resourceNamespace, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServerVulnerabilityAssessmentAsync(string resourceNamespace, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.ServerVulnerabilityAssessmentCollection GetServerVulnerabilityAssessments(string resourceNamespace, string resourceType, string resourceName) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SoftwareInventoryCollection GetSoftwareInventories(string resourceNamespace, string resourceType, string resourceName) { throw null; } + public virtual Azure.Response GetSoftwareInventory(string resourceNamespace, string resourceType, string resourceName, string softwareName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSoftwareInventoryAsync(string resourceNamespace, string resourceType, string resourceName, string softwareName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTopology(Azure.Core.AzureLocation ascLocation, string topologyResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTopologyAsync(Azure.Core.AzureLocation ascLocation, string topologyResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableSecurityCenterSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSecurityCenterSubscriptionResource() { } + public virtual Azure.Pageable GetAdaptiveApplicationControlGroups(bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAdaptiveApplicationControlGroupsAsync(bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAlerts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAlertsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllowedConnections(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllowedConnectionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllSecuritySolutionsReferenceData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllSecuritySolutionsReferenceDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SubscriptionAssessmentMetadataCollection GetAllSubscriptionAssessmentMetadata() { throw null; } + public virtual Azure.Response GetAutoProvisioningSetting(string settingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAutoProvisioningSettingAsync(string settingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.AutoProvisioningSettingCollection GetAutoProvisioningSettings() { throw null; } + public virtual Azure.Pageable GetCustomAssessmentAutomations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCustomAssessmentAutomationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCustomEntityStoreAssignments(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCustomEntityStoreAssignmentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDiscoveredSecuritySolutions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDiscoveredSecuritySolutionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetExternalSecuritySolutions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExternalSecuritySolutionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetIngestionSetting(string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIngestionSettingAsync(string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.IngestionSettingCollection GetIngestionSettings() { throw null; } + public virtual Azure.Pageable GetIotSecuritySolutions(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetIotSecuritySolutionsAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetJitNetworkAccessPolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetJitNetworkAccessPoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetMdeOnboarding(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetMdeOnboardingAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetMdeOnboardings(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetMdeOnboardingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRegulatoryComplianceStandard(string regulatoryComplianceStandardName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRegulatoryComplianceStandardAsync(string regulatoryComplianceStandardName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.RegulatoryComplianceStandardCollection GetRegulatoryComplianceStandards() { throw null; } + public virtual Azure.Response GetSecureScore(string secureScoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecureScoreAsync(string secureScoreName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecureScoreControlDefinitionsBySubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecureScoreControlDefinitionsBySubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecureScoreControls(Azure.ResourceManager.SecurityCenter.Models.SecurityScoreODataExpand? expand = default(Azure.ResourceManager.SecurityCenter.Models.SecurityScoreODataExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecureScoreControlsAsync(Azure.ResourceManager.SecurityCenter.Models.SecurityScoreODataExpand? expand = default(Azure.ResourceManager.SecurityCenter.Models.SecurityScoreODataExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecureScoreCollection GetSecureScores() { throw null; } + public virtual Azure.Response GetSecurityAlertsSuppressionRule(string alertsSuppressionRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityAlertsSuppressionRuleAsync(string alertsSuppressionRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityAlertsSuppressionRuleCollection GetSecurityAlertsSuppressionRules() { throw null; } + public virtual Azure.Pageable GetSecurityAutomations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecurityAutomationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSecurityCenterLocation(Azure.Core.AzureLocation ascLocation, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityCenterLocationAsync(Azure.Core.AzureLocation ascLocation, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityCenterLocationCollection GetSecurityCenterLocations() { throw null; } + public virtual Azure.Response GetSecurityCenterPricing(string pricingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityCenterPricingAsync(string pricingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityCenterPricingCollection GetSecurityCenterPricings() { throw null; } + public virtual Azure.Response GetSecurityCloudConnector(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityCloudConnectorAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityCloudConnectorCollection GetSecurityCloudConnectors() { throw null; } + public virtual Azure.Pageable GetSecurityConnectors(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecurityConnectorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSecurityContact(string securityContactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityContactAsync(string securityContactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityContactCollection GetSecurityContacts() { throw null; } + public virtual Azure.Response GetSecuritySetting(Azure.ResourceManager.SecurityCenter.Models.SecuritySettingName settingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecuritySettingAsync(Azure.ResourceManager.SecurityCenter.Models.SecuritySettingName settingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecuritySettingCollection GetSecuritySettings() { throw null; } + public virtual Azure.Pageable GetSecuritySolutions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecuritySolutionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSecurityWorkspaceSetting(string workspaceSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecurityWorkspaceSettingAsync(string workspaceSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SecurityWorkspaceSettingCollection GetSecurityWorkspaceSettings() { throw null; } + public virtual Azure.Pageable GetSoftwareInventories(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSoftwareInventoriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSubscriptionAssessmentMetadata(string assessmentMetadataName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionAssessmentMetadataAsync(string assessmentMetadataName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release.", false)] + public virtual Azure.Response GetSubscriptionGovernanceRule(string ruleId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release.", false)] + public virtual System.Threading.Tasks.Task> GetSubscriptionGovernanceRuleAsync(string ruleId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release.", false)] + public virtual Azure.ResourceManager.SecurityCenter.SubscriptionGovernanceRuleCollection GetSubscriptionGovernanceRules() { throw null; } + public virtual Azure.Response GetSubscriptionSecurityApplication(string applicationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionSecurityApplicationAsync(string applicationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityCenter.SubscriptionSecurityApplicationCollection GetSubscriptionSecurityApplications() { throw null; } + public virtual Azure.Pageable GetTasks(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTasksAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetTopologies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTopologiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableSecurityCenterTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableSecurityCenterTenantResource() { } + public virtual Azure.ResourceManager.SecurityCenter.TenantAssessmentMetadataCollection GetAllTenantAssessmentMetadata() { throw null; } + public virtual Azure.Pageable GetSecureScoreControlDefinitions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecureScoreControlDefinitionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTenantAssessmentMetadata(string assessmentMetadataName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTenantAssessmentMetadataAsync(string assessmentMetadataName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.SecurityCenter.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/MockableSecurityCenterArmClient.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/MockableSecurityCenterArmClient.cs new file mode 100644 index 0000000000000..ab20f41ff05d3 --- /dev/null +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/MockableSecurityCenterArmClient.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.Core; + +namespace Azure.ResourceManager.SecurityCenter.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSecurityCenterArmClient : ArmResource + { + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// + /// The resource ID of the resource to get. + /// Returns a object. + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is obsolete and will be removed in a future release. Please use GetGovernanceRuleResource.", false)] + public virtual SubscriptionGovernanceRuleResource GetSubscriptionGovernanceRuleResource(ResourceIdentifier id) + { + SubscriptionGovernanceRuleResource.ValidateResourceId(id); + return new SubscriptionGovernanceRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is obsolete and will be removed in a future release.", false)] + public virtual SecurityConnectorGovernanceRuleResource GetSecurityConnectorGovernanceRuleResource(ResourceIdentifier id) + { + SecurityConnectorGovernanceRuleResource.ValidateResourceId(id); + return new SecurityConnectorGovernanceRuleResource(Client, id); + } + } +} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/MockableSecurityCenterSubscriptionResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/MockableSecurityCenterSubscriptionResource.cs new file mode 100644 index 0000000000000..0501c4d6a77b2 --- /dev/null +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/MockableSecurityCenterSubscriptionResource.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.Core; +using Azure.ResourceManager.Resources; +using System.Threading.Tasks; +using System.Threading; + +namespace Azure.ResourceManager.SecurityCenter.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSecurityCenterSubscriptionResource : ArmResource + { + /// Gets a collection of SubscriptionGovernanceRuleResources in the SubscriptionResource. + /// An object representing collection of SubscriptionGovernanceRuleResources and their operations over a SubscriptionGovernanceRuleResource. + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is obsolete and will be removed in a future release.", false)] + public virtual SubscriptionGovernanceRuleCollection GetSubscriptionGovernanceRules() + { + return GetCachedClient(Client => new SubscriptionGovernanceRuleCollection(Client, Id)); + } + + /// + /// Get a specific governanceRule for the requested scope by ruleId + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId} + /// + /// + /// Operation Id + /// GovernanceRules_Get + /// + /// + /// + /// The security GovernanceRule key - unique key for the standard GovernanceRule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is obsolete and will be removed in a future release.", false)] + public virtual async Task> GetSubscriptionGovernanceRuleAsync(string ruleId, CancellationToken cancellationToken = default) + { + return await GetSubscriptionGovernanceRules().GetAsync(ruleId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specific governanceRule for the requested scope by ruleId + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId} + /// + /// + /// Operation Id + /// GovernanceRules_Get + /// + /// + /// + /// The security GovernanceRule key - unique key for the standard GovernanceRule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is obsolete and will be removed in a future release.", false)] + public virtual Response GetSubscriptionGovernanceRule(string ruleId, CancellationToken cancellationToken = default) + { + return GetSubscriptionGovernanceRules().Get(ruleId, cancellationToken); + } + } +} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/SecurityCenterExtensions.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/SecurityCenterExtensions.cs index 7583419295a21..b186311b77bb8 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/SecurityCenterExtensions.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/Extensions/SecurityCenterExtensions.cs @@ -1,26 +1,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.ComponentModel; using System.Threading; using System.Threading.Tasks; -using Azure; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Resources; -using Azure.ResourceManager.SecurityCenter.Models; namespace Azure.ResourceManager.SecurityCenter { /// A class to add extension methods to Azure.ResourceManager.SecurityCenter. public static partial class SecurityCenterExtensions { - #region SubscriptionGovernanceRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// @@ -31,16 +25,9 @@ public static partial class SecurityCenterExtensions [Obsolete("This method is obsolete and will be removed in a future release. Please use GetGovernanceRuleResource.", false)] public static SubscriptionGovernanceRuleResource GetSubscriptionGovernanceRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionGovernanceRuleResource.ValidateResourceId(id); - return new SubscriptionGovernanceRuleResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSubscriptionGovernanceRuleResource(id); } - #endregion - #region SecurityConnectorGovernanceRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -52,14 +39,8 @@ public static SubscriptionGovernanceRuleResource GetSubscriptionGovernanceRuleRe [Obsolete("This method is obsolete and will be removed in a future release.", false)] public static SecurityConnectorGovernanceRuleResource GetSecurityConnectorGovernanceRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityConnectorGovernanceRuleResource.ValidateResourceId(id); - return new SecurityConnectorGovernanceRuleResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityConnectorGovernanceRuleResource(id); } - #endregion /// Gets a collection of SubscriptionGovernanceRuleResources in the SubscriptionResource. /// The instance the method will execute against. @@ -68,7 +49,7 @@ public static SecurityConnectorGovernanceRuleResource GetSecurityConnectorGovern [Obsolete("This method is obsolete and will be removed in a future release.", false)] public static SubscriptionGovernanceRuleCollection GetSubscriptionGovernanceRules(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionGovernanceRules(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSubscriptionGovernanceRules(); } /// @@ -94,7 +75,7 @@ public static SubscriptionGovernanceRuleCollection GetSubscriptionGovernanceRule [Obsolete("This method is obsolete and will be removed in a future release.", false)] public static async Task> GetSubscriptionGovernanceRuleAsync(this SubscriptionResource subscriptionResource, string ruleId, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionGovernanceRules().GetAsync(ruleId, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSubscriptionGovernanceRuleAsync(ruleId, cancellationToken).ConfigureAwait(false); } /// @@ -120,7 +101,7 @@ public static async Task> GetSubscr [Obsolete("This method is obsolete and will be removed in a future release.", false)] public static Response GetSubscriptionGovernanceRule(this SubscriptionResource subscriptionResource, string ruleId, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionGovernanceRules().Get(ruleId, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSubscriptionGovernanceRule(ruleId, cancellationToken); } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/SubscriptionResourceExtensionClient.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index c5d37f5a765a1..0000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Custom/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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; -using Azure.ResourceManager.SecurityCenter.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - /// Gets a collection of SubscriptionGovernanceRuleResources in the SubscriptionResource. - /// An object representing collection of SubscriptionGovernanceRuleResources and their operations over a SubscriptionGovernanceRuleResource. - [Obsolete("This method is obsolete and will be removed in a future release.", false)] - public virtual SubscriptionGovernanceRuleCollection GetSubscriptionGovernanceRules() - { - return GetCachedClient(Client => new SubscriptionGovernanceRuleCollection(Client, Id)); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveApplicationControlGroupResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveApplicationControlGroupResource.cs index 72c0081c84d77..a0554bddb5c46 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveApplicationControlGroupResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveApplicationControlGroupResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class AdaptiveApplicationControlGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The ascLocation. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation ascLocation, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveNetworkHardeningResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveNetworkHardeningResource.cs index baedacd1c4052..fc1a427a90a32 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveNetworkHardeningResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdaptiveNetworkHardeningResource.cs @@ -28,6 +28,12 @@ namespace Azure.ResourceManager.SecurityCenter public partial class AdaptiveNetworkHardeningResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceNamespace. + /// The resourceType. + /// The resourceName. + /// The adaptiveNetworkHardeningResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdvancedThreatProtectionSettingResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdvancedThreatProtectionSettingResource.cs index e693dc964016f..679a3f8b8efb9 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdvancedThreatProtectionSettingResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AdvancedThreatProtectionSettingResource.cs @@ -25,6 +25,7 @@ namespace Azure.ResourceManager.SecurityCenter public partial class AdvancedThreatProtectionSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceId. public static ResourceIdentifier CreateResourceIdentifier(string resourceId) { var resourceId0 = $"{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/current"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AutoProvisioningSettingResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AutoProvisioningSettingResource.cs index 78f72a039bdb0..55f7fa3ca5c07 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AutoProvisioningSettingResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/AutoProvisioningSettingResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class AutoProvisioningSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The settingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string settingName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ComplianceResultResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ComplianceResultResource.cs index f3dce225c94b7..8fd289f899fe6 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ComplianceResultResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ComplianceResultResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class ComplianceResultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceId. + /// The complianceResultName. public static ResourceIdentifier CreateResourceIdentifier(string resourceId, string complianceResultName) { var resourceId0 = $"{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomAssessmentAutomationResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomAssessmentAutomationResource.cs index 9ea0a12e24c87..2753711a3c873 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomAssessmentAutomationResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomAssessmentAutomationResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class CustomAssessmentAutomationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The customAssessmentAutomationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string customAssessmentAutomationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomEntityStoreAssignmentResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomEntityStoreAssignmentResource.cs index 6574b1c45d13c..b9dcde0bcff73 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomEntityStoreAssignmentResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/CustomEntityStoreAssignmentResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class CustomEntityStoreAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The customEntityStoreAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string customEntityStoreAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/DeviceSecurityGroupResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/DeviceSecurityGroupResource.cs index 08344c29cb95d..0ea74dd943285 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/DeviceSecurityGroupResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/DeviceSecurityGroupResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class DeviceSecurityGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceId. + /// The deviceSecurityGroupName. public static ResourceIdentifier CreateResourceIdentifier(string resourceId, string deviceSecurityGroupName) { var resourceId0 = $"{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index e901b761e5268..0000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.SecurityCenter.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _informationProtectionPoliciesClientDiagnostics; - private InformationProtectionPoliciesRestOperations _informationProtectionPoliciesRestClient; - private ClientDiagnostics _securitySubAssessmentSubAssessmentsClientDiagnostics; - private SubAssessmentsRestOperations _securitySubAssessmentSubAssessmentsRestClient; - private ClientDiagnostics _securityAssessmentAssessmentsClientDiagnostics; - private AssessmentsRestOperations _securityAssessmentAssessmentsRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics InformationProtectionPoliciesClientDiagnostics => _informationProtectionPoliciesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private InformationProtectionPoliciesRestOperations InformationProtectionPoliciesRestClient => _informationProtectionPoliciesRestClient ??= new InformationProtectionPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SecuritySubAssessmentSubAssessmentsClientDiagnostics => _securitySubAssessmentSubAssessmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SecuritySubAssessmentResource.ResourceType.Namespace, Diagnostics); - private SubAssessmentsRestOperations SecuritySubAssessmentSubAssessmentsRestClient => _securitySubAssessmentSubAssessmentsRestClient ??= new SubAssessmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecuritySubAssessmentResource.ResourceType)); - private ClientDiagnostics SecurityAssessmentAssessmentsClientDiagnostics => _securityAssessmentAssessmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SecurityAssessmentResource.ResourceType.Namespace, Diagnostics); - private AssessmentsRestOperations SecurityAssessmentAssessmentsRestClient => _securityAssessmentAssessmentsRestClient ??= new AssessmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecurityAssessmentResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ComplianceResultResources in the ArmResource. - /// An object representing collection of ComplianceResultResources and their operations over a ComplianceResultResource. - public virtual ComplianceResultCollection GetComplianceResults() - { - return GetCachedClient(Client => new ComplianceResultCollection(Client, Id)); - } - - /// Gets an object representing a AdvancedThreatProtectionSettingResource along with the instance operations that can be performed on it in the ArmResource. - /// Returns a object. - public virtual AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSetting() - { - return new AdvancedThreatProtectionSettingResource(Client, Id.AppendProviderResource("Microsoft.Security", "advancedThreatProtectionSettings", "current")); - } - - /// Gets a collection of DeviceSecurityGroupResources in the ArmResource. - /// An object representing collection of DeviceSecurityGroupResources and their operations over a DeviceSecurityGroupResource. - public virtual DeviceSecurityGroupCollection GetDeviceSecurityGroups() - { - return GetCachedClient(Client => new DeviceSecurityGroupCollection(Client, Id)); - } - - /// Gets a collection of SecurityComplianceResources in the ArmResource. - /// An object representing collection of SecurityComplianceResources and their operations over a SecurityComplianceResource. - public virtual SecurityComplianceCollection GetSecurityCompliances() - { - return GetCachedClient(Client => new SecurityComplianceCollection(Client, Id)); - } - - /// Gets a collection of SecurityAssessmentResources in the ArmResource. - /// An object representing collection of SecurityAssessmentResources and their operations over a SecurityAssessmentResource. - public virtual SecurityAssessmentCollection GetSecurityAssessments() - { - return GetCachedClient(Client => new SecurityAssessmentCollection(Client, Id)); - } - - /// Gets a collection of GovernanceRuleResources in the ArmResource. - /// An object representing collection of GovernanceRuleResources and their operations over a GovernanceRuleResource. - public virtual GovernanceRuleCollection GetGovernanceRules() - { - return GetCachedClient(Client => new GovernanceRuleCollection(Client, Id)); - } - - /// Gets a collection of SqlVulnerabilityAssessmentScanResources in the ArmResource. - /// An object representing collection of SqlVulnerabilityAssessmentScanResources and their operations over a SqlVulnerabilityAssessmentScanResource. - public virtual SqlVulnerabilityAssessmentScanCollection GetSqlVulnerabilityAssessmentScans() - { - return GetCachedClient(Client => new SqlVulnerabilityAssessmentScanCollection(Client, Id)); - } - - /// Gets a collection of SqlVulnerabilityAssessmentBaselineRuleResources in the ArmResource. - /// An object representing collection of SqlVulnerabilityAssessmentBaselineRuleResources and their operations over a SqlVulnerabilityAssessmentBaselineRuleResource. - public virtual SqlVulnerabilityAssessmentBaselineRuleCollection GetSqlVulnerabilityAssessmentBaselineRules() - { - return GetCachedClient(Client => new SqlVulnerabilityAssessmentBaselineRuleCollection(Client, Id)); - } - - /// - /// Details of the information protection policy. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName} - /// - /// - /// Operation Id - /// InformationProtectionPolicies_CreateOrUpdate - /// - /// - /// - /// Name of the information protection policy. - /// Information protection policy. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateInformationProtectionPolicyAsync(InformationProtectionPolicyName informationProtectionPolicyName, InformationProtectionPolicy informationProtectionPolicy, CancellationToken cancellationToken = default) - { - using var scope = InformationProtectionPoliciesClientDiagnostics.CreateScope("ArmResourceExtensionClient.CreateOrUpdateInformationProtectionPolicy"); - scope.Start(); - try - { - var response = await InformationProtectionPoliciesRestClient.CreateOrUpdateAsync(Id, informationProtectionPolicyName, informationProtectionPolicy, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Details of the information protection policy. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName} - /// - /// - /// Operation Id - /// InformationProtectionPolicies_CreateOrUpdate - /// - /// - /// - /// Name of the information protection policy. - /// Information protection policy. - /// The cancellation token to use. - public virtual Response CreateOrUpdateInformationProtectionPolicy(InformationProtectionPolicyName informationProtectionPolicyName, InformationProtectionPolicy informationProtectionPolicy, CancellationToken cancellationToken = default) - { - using var scope = InformationProtectionPoliciesClientDiagnostics.CreateScope("ArmResourceExtensionClient.CreateOrUpdateInformationProtectionPolicy"); - scope.Start(); - try - { - var response = InformationProtectionPoliciesRestClient.CreateOrUpdate(Id, informationProtectionPolicyName, informationProtectionPolicy, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Information protection policies of a specific management group. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies - /// - /// - /// Operation Id - /// InformationProtectionPolicies_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetInformationProtectionPoliciesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => InformationProtectionPoliciesRestClient.CreateListRequest(Id); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InformationProtectionPoliciesRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, InformationProtectionPolicy.DeserializeInformationProtectionPolicy, InformationProtectionPoliciesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetInformationProtectionPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Information protection policies of a specific management group. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies - /// - /// - /// Operation Id - /// InformationProtectionPolicies_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetInformationProtectionPolicies(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => InformationProtectionPoliciesRestClient.CreateListRequest(Id); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InformationProtectionPoliciesRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, InformationProtectionPolicy.DeserializeInformationProtectionPolicy, InformationProtectionPoliciesClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetInformationProtectionPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Get security sub-assessments on all your scanned resources inside a subscription scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/subAssessments - /// - /// - /// Operation Id - /// SubAssessments_ListAll - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecuritySubAssessmentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecuritySubAssessmentSubAssessmentsRestClient.CreateListAllRequest(Id); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecuritySubAssessmentSubAssessmentsRestClient.CreateListAllNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecuritySubAssessmentResource(Client, SecuritySubAssessmentData.DeserializeSecuritySubAssessmentData(e)), SecuritySubAssessmentSubAssessmentsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetSecuritySubAssessments", "value", "nextLink", cancellationToken); - } - - /// - /// Get security sub-assessments on all your scanned resources inside a subscription scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/subAssessments - /// - /// - /// Operation Id - /// SubAssessments_ListAll - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecuritySubAssessments(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecuritySubAssessmentSubAssessmentsRestClient.CreateListAllRequest(Id); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecuritySubAssessmentSubAssessmentsRestClient.CreateListAllNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecuritySubAssessmentResource(Client, SecuritySubAssessmentData.DeserializeSecuritySubAssessmentData(e)), SecuritySubAssessmentSubAssessmentsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetSecuritySubAssessments", "value", "nextLink", cancellationToken); - } - - /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/assessments - /// - /// - /// Operation Id - /// Assessments_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecurityAssessmentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityAssessmentAssessmentsRestClient.CreateListRequest(Id); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityAssessmentAssessmentsRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecurityAssessmentResource(Client, SecurityAssessmentData.DeserializeSecurityAssessmentData(e)), SecurityAssessmentAssessmentsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetSecurityAssessments", "value", "nextLink", cancellationToken); - } - - /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/assessments - /// - /// - /// Operation Id - /// Assessments_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecurityAssessments(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityAssessmentAssessmentsRestClient.CreateListRequest(Id); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityAssessmentAssessmentsRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecurityAssessmentResource(Client, SecurityAssessmentData.DeserializeSecurityAssessmentData(e)), SecurityAssessmentAssessmentsClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetSecurityAssessments", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterArmClient.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterArmClient.cs new file mode 100644 index 0000000000000..a995702f089da --- /dev/null +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterArmClient.cs @@ -0,0 +1,1203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.SecurityCenter; +using Azure.ResourceManager.SecurityCenter.Models; + +namespace Azure.ResourceManager.SecurityCenter.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSecurityCenterArmClient : ArmResource + { + private ClientDiagnostics _informationProtectionPoliciesClientDiagnostics; + private InformationProtectionPoliciesRestOperations _informationProtectionPoliciesRestClient; + private ClientDiagnostics _securitySubAssessmentSubAssessmentsClientDiagnostics; + private SubAssessmentsRestOperations _securitySubAssessmentSubAssessmentsRestClient; + private ClientDiagnostics _securityAssessmentAssessmentsClientDiagnostics; + private AssessmentsRestOperations _securityAssessmentAssessmentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSecurityCenterArmClient() + { + } + + /// 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 MockableSecurityCenterArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSecurityCenterArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics InformationProtectionPoliciesClientDiagnostics => _informationProtectionPoliciesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private InformationProtectionPoliciesRestOperations InformationProtectionPoliciesRestClient => _informationProtectionPoliciesRestClient ??= new InformationProtectionPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SecuritySubAssessmentSubAssessmentsClientDiagnostics => _securitySubAssessmentSubAssessmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SecuritySubAssessmentResource.ResourceType.Namespace, Diagnostics); + private SubAssessmentsRestOperations SecuritySubAssessmentSubAssessmentsRestClient => _securitySubAssessmentSubAssessmentsRestClient ??= new SubAssessmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecuritySubAssessmentResource.ResourceType)); + private ClientDiagnostics SecurityAssessmentAssessmentsClientDiagnostics => _securityAssessmentAssessmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SecurityAssessmentResource.ResourceType.Namespace, Diagnostics); + private AssessmentsRestOperations SecurityAssessmentAssessmentsRestClient => _securityAssessmentAssessmentsRestClient ??= new AssessmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecurityAssessmentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ComplianceResultResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of ComplianceResultResources and their operations over a ComplianceResultResource. + public virtual ComplianceResultCollection GetComplianceResults(ResourceIdentifier scope) + { + return new ComplianceResultCollection(Client, scope); + } + + /// + /// Security Compliance Result + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName} + /// + /// + /// Operation Id + /// ComplianceResults_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// name of the desired assessment compliance result. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetComplianceResultAsync(ResourceIdentifier scope, string complianceResultName, CancellationToken cancellationToken = default) + { + return await GetComplianceResults(scope).GetAsync(complianceResultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Security Compliance Result + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName} + /// + /// + /// Operation Id + /// ComplianceResults_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// name of the desired assessment compliance result. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetComplianceResult(ResourceIdentifier scope, string complianceResultName, CancellationToken cancellationToken = default) + { + return GetComplianceResults(scope).Get(complianceResultName, cancellationToken); + } + + /// Gets an object representing a AdvancedThreatProtectionSettingResource along with the instance operations that can be performed on it in the ArmClient. + /// The scope that the resource will apply against. + /// Returns a object. + public virtual AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSetting(ResourceIdentifier scope) + { + return new AdvancedThreatProtectionSettingResource(Client, scope.AppendProviderResource("Microsoft.Security", "advancedThreatProtectionSettings", "current")); + } + + /// Gets a collection of DeviceSecurityGroupResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of DeviceSecurityGroupResources and their operations over a DeviceSecurityGroupResource. + public virtual DeviceSecurityGroupCollection GetDeviceSecurityGroups(ResourceIdentifier scope) + { + return new DeviceSecurityGroupCollection(Client, scope); + } + + /// + /// Use this method to get the device security group for the specified IoT Hub resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName} + /// + /// + /// Operation Id + /// DeviceSecurityGroups_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the device security group. Note that the name of the device security group is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeviceSecurityGroupAsync(ResourceIdentifier scope, string deviceSecurityGroupName, CancellationToken cancellationToken = default) + { + return await GetDeviceSecurityGroups(scope).GetAsync(deviceSecurityGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Use this method to get the device security group for the specified IoT Hub resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName} + /// + /// + /// Operation Id + /// DeviceSecurityGroups_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of the device security group. Note that the name of the device security group is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeviceSecurityGroup(ResourceIdentifier scope, string deviceSecurityGroupName, CancellationToken cancellationToken = default) + { + return GetDeviceSecurityGroups(scope).Get(deviceSecurityGroupName, cancellationToken); + } + + /// Gets a collection of SecurityComplianceResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of SecurityComplianceResources and their operations over a SecurityComplianceResource. + public virtual SecurityComplianceCollection GetSecurityCompliances(ResourceIdentifier scope) + { + return new SecurityComplianceCollection(Client, scope); + } + + /// + /// Details of a specific Compliance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/compliances/{complianceName} + /// + /// + /// Operation Id + /// Compliances_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// name of the Compliance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityComplianceAsync(ResourceIdentifier scope, string complianceName, CancellationToken cancellationToken = default) + { + return await GetSecurityCompliances(scope).GetAsync(complianceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Details of a specific Compliance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/compliances/{complianceName} + /// + /// + /// Operation Id + /// Compliances_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// name of the Compliance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityCompliance(ResourceIdentifier scope, string complianceName, CancellationToken cancellationToken = default) + { + return GetSecurityCompliances(scope).Get(complianceName, cancellationToken); + } + + /// Gets a collection of SecurityAssessmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of SecurityAssessmentResources and their operations over a SecurityAssessmentResource. + public virtual SecurityAssessmentCollection GetSecurityAssessments(ResourceIdentifier scope) + { + return new SecurityAssessmentCollection(Client, scope); + } + + /// + /// Get a security assessment on your scanned resource + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/assessments/{assessmentName} + /// + /// + /// Operation Id + /// Assessments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The Assessment Key - Unique key for the assessment type. + /// OData expand. Optional. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityAssessmentAsync(ResourceIdentifier scope, string assessmentName, SecurityAssessmentODataExpand? expand = null, CancellationToken cancellationToken = default) + { + return await GetSecurityAssessments(scope).GetAsync(assessmentName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a security assessment on your scanned resource + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/assessments/{assessmentName} + /// + /// + /// Operation Id + /// Assessments_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The Assessment Key - Unique key for the assessment type. + /// OData expand. Optional. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityAssessment(ResourceIdentifier scope, string assessmentName, SecurityAssessmentODataExpand? expand = null, CancellationToken cancellationToken = default) + { + return GetSecurityAssessments(scope).Get(assessmentName, expand, cancellationToken); + } + + /// Gets a collection of GovernanceRuleResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of GovernanceRuleResources and their operations over a GovernanceRuleResource. + public virtual GovernanceRuleCollection GetGovernanceRules(ResourceIdentifier scope) + { + return new GovernanceRuleCollection(Client, scope); + } + + /// + /// Get a specific governance rule for the requested scope by ruleId + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/governanceRules/{ruleId} + /// + /// + /// Operation Id + /// GovernanceRules_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The governance rule key - unique key for the standard governance rule (GUID). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGovernanceRuleAsync(ResourceIdentifier scope, string ruleId, CancellationToken cancellationToken = default) + { + return await GetGovernanceRules(scope).GetAsync(ruleId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specific governance rule for the requested scope by ruleId + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/governanceRules/{ruleId} + /// + /// + /// Operation Id + /// GovernanceRules_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The governance rule key - unique key for the standard governance rule (GUID). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGovernanceRule(ResourceIdentifier scope, string ruleId, CancellationToken cancellationToken = default) + { + return GetGovernanceRules(scope).Get(ruleId, cancellationToken); + } + + /// Gets a collection of SqlVulnerabilityAssessmentScanResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of SqlVulnerabilityAssessmentScanResources and their operations over a SqlVulnerabilityAssessmentScanResource. + public virtual SqlVulnerabilityAssessmentScanCollection GetSqlVulnerabilityAssessmentScans(ResourceIdentifier scope) + { + return new SqlVulnerabilityAssessmentScanCollection(Client, scope); + } + + /// + /// Gets the scan details of a single scan record. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The scan Id. Type 'latest' to get the scan record for the latest scan. + /// The workspace Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlVulnerabilityAssessmentScanAsync(ResourceIdentifier scope, string scanId, Guid workspaceId, CancellationToken cancellationToken = default) + { + return await GetSqlVulnerabilityAssessmentScans(scope).GetAsync(scanId, workspaceId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the scan details of a single scan record. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The scan Id. Type 'latest' to get the scan record for the latest scan. + /// The workspace Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlVulnerabilityAssessmentScan(ResourceIdentifier scope, string scanId, Guid workspaceId, CancellationToken cancellationToken = default) + { + return GetSqlVulnerabilityAssessmentScans(scope).Get(scanId, workspaceId, cancellationToken); + } + + /// Gets a collection of SqlVulnerabilityAssessmentBaselineRuleResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of SqlVulnerabilityAssessmentBaselineRuleResources and their operations over a SqlVulnerabilityAssessmentBaselineRuleResource. + public virtual SqlVulnerabilityAssessmentBaselineRuleCollection GetSqlVulnerabilityAssessmentBaselineRules(ResourceIdentifier scope) + { + return new SqlVulnerabilityAssessmentBaselineRuleCollection(Client, scope); + } + + /// + /// Gets the results for a given rule in the Baseline. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentBaselineRules_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The rule Id. + /// The workspace Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlVulnerabilityAssessmentBaselineRuleAsync(ResourceIdentifier scope, string ruleId, Guid workspaceId, CancellationToken cancellationToken = default) + { + return await GetSqlVulnerabilityAssessmentBaselineRules(scope).GetAsync(ruleId, workspaceId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the results for a given rule in the Baseline. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentBaselineRules_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The rule Id. + /// The workspace Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlVulnerabilityAssessmentBaselineRule(ResourceIdentifier scope, string ruleId, Guid workspaceId, CancellationToken cancellationToken = default) + { + return GetSqlVulnerabilityAssessmentBaselineRules(scope).Get(ruleId, workspaceId, cancellationToken); + } + + /// + /// Details of the information protection policy. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName} + /// + /// + /// Operation Id + /// InformationProtectionPolicies_CreateOrUpdate + /// + /// + /// + /// The scope to use. + /// Name of the information protection policy. + /// Information protection policy. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateInformationProtectionPolicyAsync(ResourceIdentifier scope, InformationProtectionPolicyName informationProtectionPolicyName, InformationProtectionPolicy informationProtectionPolicy, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(informationProtectionPolicy, nameof(informationProtectionPolicy)); + + using var scope0 = InformationProtectionPoliciesClientDiagnostics.CreateScope("MockableSecurityCenterArmClient.CreateOrUpdateInformationProtectionPolicy"); + scope0.Start(); + try + { + var response = await InformationProtectionPoliciesRestClient.CreateOrUpdateAsync(scope, informationProtectionPolicyName, informationProtectionPolicy, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Details of the information protection policy. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName} + /// + /// + /// Operation Id + /// InformationProtectionPolicies_CreateOrUpdate + /// + /// + /// + /// The scope to use. + /// Name of the information protection policy. + /// Information protection policy. + /// The cancellation token to use. + /// is null. + public virtual Response CreateOrUpdateInformationProtectionPolicy(ResourceIdentifier scope, InformationProtectionPolicyName informationProtectionPolicyName, InformationProtectionPolicy informationProtectionPolicy, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(informationProtectionPolicy, nameof(informationProtectionPolicy)); + + using var scope0 = InformationProtectionPoliciesClientDiagnostics.CreateScope("MockableSecurityCenterArmClient.CreateOrUpdateInformationProtectionPolicy"); + scope0.Start(); + try + { + var response = InformationProtectionPoliciesRestClient.CreateOrUpdate(scope, informationProtectionPolicyName, informationProtectionPolicy, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Information protection policies of a specific management group. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies + /// + /// + /// Operation Id + /// InformationProtectionPolicies_List + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetInformationProtectionPoliciesAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InformationProtectionPoliciesRestClient.CreateListRequest(scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InformationProtectionPoliciesRestClient.CreateListNextPageRequest(nextLink, scope); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, InformationProtectionPolicy.DeserializeInformationProtectionPolicy, InformationProtectionPoliciesClientDiagnostics, Pipeline, "MockableSecurityCenterArmClient.GetInformationProtectionPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Information protection policies of a specific management group. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies + /// + /// + /// Operation Id + /// InformationProtectionPolicies_List + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetInformationProtectionPolicies(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InformationProtectionPoliciesRestClient.CreateListRequest(scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InformationProtectionPoliciesRestClient.CreateListNextPageRequest(nextLink, scope); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, InformationProtectionPolicy.DeserializeInformationProtectionPolicy, InformationProtectionPoliciesClientDiagnostics, Pipeline, "MockableSecurityCenterArmClient.GetInformationProtectionPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Get security sub-assessments on all your scanned resources inside a subscription scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/subAssessments + /// + /// + /// Operation Id + /// SubAssessments_ListAll + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecuritySubAssessmentsAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecuritySubAssessmentSubAssessmentsRestClient.CreateListAllRequest(scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecuritySubAssessmentSubAssessmentsRestClient.CreateListAllNextPageRequest(nextLink, scope); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecuritySubAssessmentResource(Client, SecuritySubAssessmentData.DeserializeSecuritySubAssessmentData(e)), SecuritySubAssessmentSubAssessmentsClientDiagnostics, Pipeline, "MockableSecurityCenterArmClient.GetSecuritySubAssessments", "value", "nextLink", cancellationToken); + } + + /// + /// Get security sub-assessments on all your scanned resources inside a subscription scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/subAssessments + /// + /// + /// Operation Id + /// SubAssessments_ListAll + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecuritySubAssessments(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecuritySubAssessmentSubAssessmentsRestClient.CreateListAllRequest(scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecuritySubAssessmentSubAssessmentsRestClient.CreateListAllNextPageRequest(nextLink, scope); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecuritySubAssessmentResource(Client, SecuritySubAssessmentData.DeserializeSecuritySubAssessmentData(e)), SecuritySubAssessmentSubAssessmentsClientDiagnostics, Pipeline, "MockableSecurityCenterArmClient.GetSecuritySubAssessments", "value", "nextLink", cancellationToken); + } + + /// + /// Get security assessments on all your scanned resources inside a scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/assessments + /// + /// + /// Operation Id + /// Assessments_List + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecurityAssessmentsAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityAssessmentAssessmentsRestClient.CreateListRequest(scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityAssessmentAssessmentsRestClient.CreateListNextPageRequest(nextLink, scope); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecurityAssessmentResource(Client, SecurityAssessmentData.DeserializeSecurityAssessmentData(e)), SecurityAssessmentAssessmentsClientDiagnostics, Pipeline, "MockableSecurityCenterArmClient.GetSecurityAssessments", "value", "nextLink", cancellationToken); + } + + /// + /// Get security assessments on all your scanned resources inside a scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/assessments + /// + /// + /// Operation Id + /// Assessments_List + /// + /// + /// + /// The scope to use. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecurityAssessments(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityAssessmentAssessmentsRestClient.CreateListRequest(scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityAssessmentAssessmentsRestClient.CreateListNextPageRequest(nextLink, scope); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecurityAssessmentResource(Client, SecurityAssessmentData.DeserializeSecurityAssessmentData(e)), SecurityAssessmentAssessmentsClientDiagnostics, Pipeline, "MockableSecurityCenterArmClient.GetSecurityAssessments", "value", "nextLink", cancellationToken); + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CustomAssessmentAutomationResource GetCustomAssessmentAutomationResource(ResourceIdentifier id) + { + CustomAssessmentAutomationResource.ValidateResourceId(id); + return new CustomAssessmentAutomationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CustomEntityStoreAssignmentResource GetCustomEntityStoreAssignmentResource(ResourceIdentifier id) + { + CustomEntityStoreAssignmentResource.ValidateResourceId(id); + return new CustomEntityStoreAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ComplianceResultResource GetComplianceResultResource(ResourceIdentifier id) + { + ComplianceResultResource.ValidateResourceId(id); + return new ComplianceResultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityCenterPricingResource GetSecurityCenterPricingResource(ResourceIdentifier id) + { + SecurityCenterPricingResource.ValidateResourceId(id); + return new SecurityCenterPricingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSettingResource(ResourceIdentifier id) + { + AdvancedThreatProtectionSettingResource.ValidateResourceId(id); + return new AdvancedThreatProtectionSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeviceSecurityGroupResource GetDeviceSecurityGroupResource(ResourceIdentifier id) + { + DeviceSecurityGroupResource.ValidateResourceId(id); + return new DeviceSecurityGroupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotSecuritySolutionResource GetIotSecuritySolutionResource(ResourceIdentifier id) + { + IotSecuritySolutionResource.ValidateResourceId(id); + return new IotSecuritySolutionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotSecuritySolutionAnalyticsModelResource GetIotSecuritySolutionAnalyticsModelResource(ResourceIdentifier id) + { + IotSecuritySolutionAnalyticsModelResource.ValidateResourceId(id); + return new IotSecuritySolutionAnalyticsModelResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotSecurityAggregatedAlertResource GetIotSecurityAggregatedAlertResource(ResourceIdentifier id) + { + IotSecurityAggregatedAlertResource.ValidateResourceId(id); + return new IotSecurityAggregatedAlertResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IotSecurityAggregatedRecommendationResource GetIotSecurityAggregatedRecommendationResource(ResourceIdentifier id) + { + IotSecurityAggregatedRecommendationResource.ValidateResourceId(id); + return new IotSecurityAggregatedRecommendationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityCenterLocationResource GetSecurityCenterLocationResource(ResourceIdentifier id) + { + SecurityCenterLocationResource.ValidateResourceId(id); + return new SecurityCenterLocationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionSecurityTaskResource GetSubscriptionSecurityTaskResource(ResourceIdentifier id) + { + SubscriptionSecurityTaskResource.ValidateResourceId(id); + return new SubscriptionSecurityTaskResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceGroupSecurityTaskResource GetResourceGroupSecurityTaskResource(ResourceIdentifier id) + { + ResourceGroupSecurityTaskResource.ValidateResourceId(id); + return new ResourceGroupSecurityTaskResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AutoProvisioningSettingResource GetAutoProvisioningSettingResource(ResourceIdentifier id) + { + AutoProvisioningSettingResource.ValidateResourceId(id); + return new AutoProvisioningSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityComplianceResource GetSecurityComplianceResource(ResourceIdentifier id) + { + SecurityComplianceResource.ValidateResourceId(id); + return new SecurityComplianceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityContactResource GetSecurityContactResource(ResourceIdentifier id) + { + SecurityContactResource.ValidateResourceId(id); + return new SecurityContactResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityWorkspaceSettingResource GetSecurityWorkspaceSettingResource(ResourceIdentifier id) + { + SecurityWorkspaceSettingResource.ValidateResourceId(id); + return new SecurityWorkspaceSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RegulatoryComplianceStandardResource GetRegulatoryComplianceStandardResource(ResourceIdentifier id) + { + RegulatoryComplianceStandardResource.ValidateResourceId(id); + return new RegulatoryComplianceStandardResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RegulatoryComplianceControlResource GetRegulatoryComplianceControlResource(ResourceIdentifier id) + { + RegulatoryComplianceControlResource.ValidateResourceId(id); + return new RegulatoryComplianceControlResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RegulatoryComplianceAssessmentResource GetRegulatoryComplianceAssessmentResource(ResourceIdentifier id) + { + RegulatoryComplianceAssessmentResource.ValidateResourceId(id); + return new RegulatoryComplianceAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecuritySubAssessmentResource GetSecuritySubAssessmentResource(ResourceIdentifier id) + { + SecuritySubAssessmentResource.ValidateResourceId(id); + return new SecuritySubAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityAutomationResource GetSecurityAutomationResource(ResourceIdentifier id) + { + SecurityAutomationResource.ValidateResourceId(id); + return new SecurityAutomationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityAlertsSuppressionRuleResource GetSecurityAlertsSuppressionRuleResource(ResourceIdentifier id) + { + SecurityAlertsSuppressionRuleResource.ValidateResourceId(id); + return new SecurityAlertsSuppressionRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServerVulnerabilityAssessmentResource GetServerVulnerabilityAssessmentResource(ResourceIdentifier id) + { + ServerVulnerabilityAssessmentResource.ValidateResourceId(id); + return new ServerVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantAssessmentMetadataResource GetTenantAssessmentMetadataResource(ResourceIdentifier id) + { + TenantAssessmentMetadataResource.ValidateResourceId(id); + return new TenantAssessmentMetadataResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionAssessmentMetadataResource GetSubscriptionAssessmentMetadataResource(ResourceIdentifier id) + { + SubscriptionAssessmentMetadataResource.ValidateResourceId(id); + return new SubscriptionAssessmentMetadataResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityAssessmentResource GetSecurityAssessmentResource(ResourceIdentifier id) + { + SecurityAssessmentResource.ValidateResourceId(id); + return new SecurityAssessmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AdaptiveApplicationControlGroupResource GetAdaptiveApplicationControlGroupResource(ResourceIdentifier id) + { + AdaptiveApplicationControlGroupResource.ValidateResourceId(id); + return new AdaptiveApplicationControlGroupResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AdaptiveNetworkHardeningResource GetAdaptiveNetworkHardeningResource(ResourceIdentifier id) + { + AdaptiveNetworkHardeningResource.ValidateResourceId(id); + return new AdaptiveNetworkHardeningResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual JitNetworkAccessPolicyResource GetJitNetworkAccessPolicyResource(ResourceIdentifier id) + { + JitNetworkAccessPolicyResource.ValidateResourceId(id); + return new JitNetworkAccessPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecureScoreResource GetSecureScoreResource(ResourceIdentifier id) + { + SecureScoreResource.ValidateResourceId(id); + return new SecureScoreResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityCloudConnectorResource GetSecurityCloudConnectorResource(ResourceIdentifier id) + { + SecurityCloudConnectorResource.ValidateResourceId(id); + return new SecurityCloudConnectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionSecurityAlertResource GetSubscriptionSecurityAlertResource(ResourceIdentifier id) + { + SubscriptionSecurityAlertResource.ValidateResourceId(id); + return new SubscriptionSecurityAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceGroupSecurityAlertResource GetResourceGroupSecurityAlertResource(ResourceIdentifier id) + { + ResourceGroupSecurityAlertResource.ValidateResourceId(id); + return new ResourceGroupSecurityAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecuritySettingResource GetSecuritySettingResource(ResourceIdentifier id) + { + SecuritySettingResource.ValidateResourceId(id); + return new SecuritySettingResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IngestionSettingResource GetIngestionSettingResource(ResourceIdentifier id) + { + IngestionSettingResource.ValidateResourceId(id); + return new IngestionSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SoftwareInventoryResource GetSoftwareInventoryResource(ResourceIdentifier id) + { + SoftwareInventoryResource.ValidateResourceId(id); + return new SoftwareInventoryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityConnectorResource GetSecurityConnectorResource(ResourceIdentifier id) + { + SecurityConnectorResource.ValidateResourceId(id); + return new SecurityConnectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GovernanceRuleResource GetGovernanceRuleResource(ResourceIdentifier id) + { + GovernanceRuleResource.ValidateResourceId(id); + return new GovernanceRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GovernanceAssignmentResource GetGovernanceAssignmentResource(ResourceIdentifier id) + { + GovernanceAssignmentResource.ValidateResourceId(id); + return new GovernanceAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionSecurityApplicationResource GetSubscriptionSecurityApplicationResource(ResourceIdentifier id) + { + SubscriptionSecurityApplicationResource.ValidateResourceId(id); + return new SubscriptionSecurityApplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityConnectorApplicationResource GetSecurityConnectorApplicationResource(ResourceIdentifier id) + { + SecurityConnectorApplicationResource.ValidateResourceId(id); + return new SecurityConnectorApplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlVulnerabilityAssessmentScanResource GetSqlVulnerabilityAssessmentScanResource(ResourceIdentifier id) + { + SqlVulnerabilityAssessmentScanResource.ValidateResourceId(id); + return new SqlVulnerabilityAssessmentScanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlVulnerabilityAssessmentBaselineRuleResource GetSqlVulnerabilityAssessmentBaselineRuleResource(ResourceIdentifier id) + { + SqlVulnerabilityAssessmentBaselineRuleResource.ValidateResourceId(id); + return new SqlVulnerabilityAssessmentBaselineRuleResource(Client, id); + } + } +} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterResourceGroupResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterResourceGroupResource.cs new file mode 100644 index 0000000000000..47fbb60022d00 --- /dev/null +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterResourceGroupResource.cs @@ -0,0 +1,1135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.SecurityCenter; +using Azure.ResourceManager.SecurityCenter.Models; + +namespace Azure.ResourceManager.SecurityCenter.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSecurityCenterResourceGroupResource : ArmResource + { + private ClientDiagnostics _allowedConnectionsClientDiagnostics; + private AllowedConnectionsRestOperations _allowedConnectionsRestClient; + private ClientDiagnostics _topologyClientDiagnostics; + private TopologyRestOperations _topologyRestClient; + private ClientDiagnostics _jitNetworkAccessPolicyClientDiagnostics; + private JitNetworkAccessPoliciesRestOperations _jitNetworkAccessPolicyRestClient; + private ClientDiagnostics _discoveredSecuritySolutionsClientDiagnostics; + private DiscoveredSecuritySolutionsRestOperations _discoveredSecuritySolutionsRestClient; + private ClientDiagnostics _externalSecuritySolutionsClientDiagnostics; + private ExternalSecuritySolutionsRestOperations _externalSecuritySolutionsRestClient; + private ClientDiagnostics _securitySolutionsClientDiagnostics; + private SecuritySolutionsRestOperations _securitySolutionsRestClient; + private ClientDiagnostics _alertsClientDiagnostics; + private AlertsRestOperations _alertsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSecurityCenterResourceGroupResource() + { + } + + /// 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 MockableSecurityCenterResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AllowedConnectionsClientDiagnostics => _allowedConnectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AllowedConnectionsRestOperations AllowedConnectionsRestClient => _allowedConnectionsRestClient ??= new AllowedConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics TopologyClientDiagnostics => _topologyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private TopologyRestOperations TopologyRestClient => _topologyRestClient ??= new TopologyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics JitNetworkAccessPolicyClientDiagnostics => _jitNetworkAccessPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", JitNetworkAccessPolicyResource.ResourceType.Namespace, Diagnostics); + private JitNetworkAccessPoliciesRestOperations JitNetworkAccessPolicyRestClient => _jitNetworkAccessPolicyRestClient ??= new JitNetworkAccessPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(JitNetworkAccessPolicyResource.ResourceType)); + private ClientDiagnostics DiscoveredSecuritySolutionsClientDiagnostics => _discoveredSecuritySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DiscoveredSecuritySolutionsRestOperations DiscoveredSecuritySolutionsRestClient => _discoveredSecuritySolutionsRestClient ??= new DiscoveredSecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ExternalSecuritySolutionsClientDiagnostics => _externalSecuritySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ExternalSecuritySolutionsRestOperations ExternalSecuritySolutionsRestClient => _externalSecuritySolutionsRestClient ??= new ExternalSecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SecuritySolutionsClientDiagnostics => _securitySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SecuritySolutionsRestOperations SecuritySolutionsRestClient => _securitySolutionsRestClient ??= new SecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AlertsClientDiagnostics => _alertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AlertsRestOperations AlertsRestClient => _alertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of CustomAssessmentAutomationResources in the ResourceGroupResource. + /// An object representing collection of CustomAssessmentAutomationResources and their operations over a CustomAssessmentAutomationResource. + public virtual CustomAssessmentAutomationCollection GetCustomAssessmentAutomations() + { + return GetCachedClient(client => new CustomAssessmentAutomationCollection(client, Id)); + } + + /// + /// Gets a single custom assessment automation by name for the provided subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName} + /// + /// + /// Operation Id + /// CustomAssessmentAutomations_Get + /// + /// + /// + /// Name of the Custom Assessment Automation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCustomAssessmentAutomationAsync(string customAssessmentAutomationName, CancellationToken cancellationToken = default) + { + return await GetCustomAssessmentAutomations().GetAsync(customAssessmentAutomationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a single custom assessment automation by name for the provided subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName} + /// + /// + /// Operation Id + /// CustomAssessmentAutomations_Get + /// + /// + /// + /// Name of the Custom Assessment Automation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCustomAssessmentAutomation(string customAssessmentAutomationName, CancellationToken cancellationToken = default) + { + return GetCustomAssessmentAutomations().Get(customAssessmentAutomationName, cancellationToken); + } + + /// Gets a collection of CustomEntityStoreAssignmentResources in the ResourceGroupResource. + /// An object representing collection of CustomEntityStoreAssignmentResources and their operations over a CustomEntityStoreAssignmentResource. + public virtual CustomEntityStoreAssignmentCollection GetCustomEntityStoreAssignments() + { + return GetCachedClient(client => new CustomEntityStoreAssignmentCollection(client, Id)); + } + + /// + /// Gets a single custom entity store assignment by name for the provided subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName} + /// + /// + /// Operation Id + /// CustomEntityStoreAssignments_Get + /// + /// + /// + /// Name of the custom entity store assignment. Generated name is GUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCustomEntityStoreAssignmentAsync(string customEntityStoreAssignmentName, CancellationToken cancellationToken = default) + { + return await GetCustomEntityStoreAssignments().GetAsync(customEntityStoreAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a single custom entity store assignment by name for the provided subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName} + /// + /// + /// Operation Id + /// CustomEntityStoreAssignments_Get + /// + /// + /// + /// Name of the custom entity store assignment. Generated name is GUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCustomEntityStoreAssignment(string customEntityStoreAssignmentName, CancellationToken cancellationToken = default) + { + return GetCustomEntityStoreAssignments().Get(customEntityStoreAssignmentName, cancellationToken); + } + + /// Gets a collection of IotSecuritySolutionResources in the ResourceGroupResource. + /// An object representing collection of IotSecuritySolutionResources and their operations over a IotSecuritySolutionResource. + public virtual IotSecuritySolutionCollection GetIotSecuritySolutions() + { + return GetCachedClient(client => new IotSecuritySolutionCollection(client, Id)); + } + + /// + /// User this method to get details of a specific IoT Security solution based on solution name + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName} + /// + /// + /// Operation Id + /// IotSecuritySolution_Get + /// + /// + /// + /// The name of the IoT Security solution. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetIotSecuritySolutionAsync(string solutionName, CancellationToken cancellationToken = default) + { + return await GetIotSecuritySolutions().GetAsync(solutionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// User this method to get details of a specific IoT Security solution based on solution name + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName} + /// + /// + /// Operation Id + /// IotSecuritySolution_Get + /// + /// + /// + /// The name of the IoT Security solution. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetIotSecuritySolution(string solutionName, CancellationToken cancellationToken = default) + { + return GetIotSecuritySolutions().Get(solutionName, cancellationToken); + } + + /// Gets a collection of ResourceGroupSecurityTaskResources in the ResourceGroupResource. + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// An object representing collection of ResourceGroupSecurityTaskResources and their operations over a ResourceGroupSecurityTaskResource. + public virtual ResourceGroupSecurityTaskCollection GetResourceGroupSecurityTasks(AzureLocation ascLocation) + { + return new ResourceGroupSecurityTaskCollection(Client, Id, ascLocation); + } + + /// + /// Recommended tasks that will help improve the security of the subscription proactively + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_GetResourceGroupLevelTask + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of the task object, will be a GUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceGroupSecurityTaskAsync(AzureLocation ascLocation, string taskName, CancellationToken cancellationToken = default) + { + return await GetResourceGroupSecurityTasks(ascLocation).GetAsync(taskName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Recommended tasks that will help improve the security of the subscription proactively + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName} + /// + /// + /// Operation Id + /// Tasks_GetResourceGroupLevelTask + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of the task object, will be a GUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceGroupSecurityTask(AzureLocation ascLocation, string taskName, CancellationToken cancellationToken = default) + { + return GetResourceGroupSecurityTasks(ascLocation).Get(taskName, cancellationToken); + } + + /// Gets a collection of SecurityAutomationResources in the ResourceGroupResource. + /// An object representing collection of SecurityAutomationResources and their operations over a SecurityAutomationResource. + public virtual SecurityAutomationCollection GetSecurityAutomations() + { + return GetCachedClient(client => new SecurityAutomationCollection(client, Id)); + } + + /// + /// Retrieves information about the model of a security automation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName} + /// + /// + /// Operation Id + /// Automations_Get + /// + /// + /// + /// The security automation name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityAutomationAsync(string automationName, CancellationToken cancellationToken = default) + { + return await GetSecurityAutomations().GetAsync(automationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves information about the model of a security automation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName} + /// + /// + /// Operation Id + /// Automations_Get + /// + /// + /// + /// The security automation name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityAutomation(string automationName, CancellationToken cancellationToken = default) + { + return GetSecurityAutomations().Get(automationName, cancellationToken); + } + + /// Gets a collection of ServerVulnerabilityAssessmentResources in the ResourceGroupResource. + /// The Namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// An object representing collection of ServerVulnerabilityAssessmentResources and their operations over a ServerVulnerabilityAssessmentResource. + public virtual ServerVulnerabilityAssessmentCollection GetServerVulnerabilityAssessments(string resourceNamespace, string resourceType, string resourceName) + { + return new ServerVulnerabilityAssessmentCollection(Client, Id, resourceNamespace, resourceType, resourceName); + } + + /// + /// Gets a server vulnerability assessment onboarding statuses on a given resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment} + /// + /// + /// Operation Id + /// ServerVulnerabilityAssessment_Get + /// + /// + /// + /// The Namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServerVulnerabilityAssessmentAsync(string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + return await GetServerVulnerabilityAssessments(resourceNamespace, resourceType, resourceName).GetAsync(cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a server vulnerability assessment onboarding statuses on a given resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment} + /// + /// + /// Operation Id + /// ServerVulnerabilityAssessment_Get + /// + /// + /// + /// The Namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServerVulnerabilityAssessment(string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + return GetServerVulnerabilityAssessments(resourceNamespace, resourceType, resourceName).Get(cancellationToken); + } + + /// Gets a collection of AdaptiveNetworkHardeningResources in the ResourceGroupResource. + /// The Namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// An object representing collection of AdaptiveNetworkHardeningResources and their operations over a AdaptiveNetworkHardeningResource. + public virtual AdaptiveNetworkHardeningCollection GetAdaptiveNetworkHardenings(string resourceNamespace, string resourceType, string resourceName) + { + return new AdaptiveNetworkHardeningCollection(Client, Id, resourceNamespace, resourceType, resourceName); + } + + /// + /// Gets a single Adaptive Network Hardening resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName} + /// + /// + /// Operation Id + /// AdaptiveNetworkHardenings_Get + /// + /// + /// + /// The Namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// The name of the Adaptive Network Hardening resource. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAdaptiveNetworkHardeningAsync(string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, CancellationToken cancellationToken = default) + { + return await GetAdaptiveNetworkHardenings(resourceNamespace, resourceType, resourceName).GetAsync(adaptiveNetworkHardeningResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a single Adaptive Network Hardening resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName} + /// + /// + /// Operation Id + /// AdaptiveNetworkHardenings_Get + /// + /// + /// + /// The Namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// The name of the Adaptive Network Hardening resource. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAdaptiveNetworkHardening(string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, CancellationToken cancellationToken = default) + { + return GetAdaptiveNetworkHardenings(resourceNamespace, resourceType, resourceName).Get(adaptiveNetworkHardeningResourceName, cancellationToken); + } + + /// Gets a collection of JitNetworkAccessPolicyResources in the ResourceGroupResource. + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// An object representing collection of JitNetworkAccessPolicyResources and their operations over a JitNetworkAccessPolicyResource. + public virtual JitNetworkAccessPolicyCollection GetJitNetworkAccessPolicies(AzureLocation ascLocation) + { + return new JitNetworkAccessPolicyCollection(Client, Id, ascLocation); + } + + /// + /// Policies for protecting resources using Just-in-Time access control for the subscription, location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName} + /// + /// + /// Operation Id + /// JitNetworkAccessPolicies_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of a Just-in-Time access configuration policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetJitNetworkAccessPolicyAsync(AzureLocation ascLocation, string jitNetworkAccessPolicyName, CancellationToken cancellationToken = default) + { + return await GetJitNetworkAccessPolicies(ascLocation).GetAsync(jitNetworkAccessPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Policies for protecting resources using Just-in-Time access control for the subscription, location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName} + /// + /// + /// Operation Id + /// JitNetworkAccessPolicies_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of a Just-in-Time access configuration policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetJitNetworkAccessPolicy(AzureLocation ascLocation, string jitNetworkAccessPolicyName, CancellationToken cancellationToken = default) + { + return GetJitNetworkAccessPolicies(ascLocation).Get(jitNetworkAccessPolicyName, cancellationToken); + } + + /// Gets a collection of ResourceGroupSecurityAlertResources in the ResourceGroupResource. + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// An object representing collection of ResourceGroupSecurityAlertResources and their operations over a ResourceGroupSecurityAlertResource. + public virtual ResourceGroupSecurityAlertCollection GetResourceGroupSecurityAlerts(AzureLocation ascLocation) + { + return new ResourceGroupSecurityAlertCollection(Client, Id, ascLocation); + } + + /// + /// Get an alert that is associated a resource group or a resource in a resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName} + /// + /// + /// Operation Id + /// Alerts_GetResourceGroupLevel + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of the alert object. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceGroupSecurityAlertAsync(AzureLocation ascLocation, string alertName, CancellationToken cancellationToken = default) + { + return await GetResourceGroupSecurityAlerts(ascLocation).GetAsync(alertName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an alert that is associated a resource group or a resource in a resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName} + /// + /// + /// Operation Id + /// Alerts_GetResourceGroupLevel + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of the alert object. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceGroupSecurityAlert(AzureLocation ascLocation, string alertName, CancellationToken cancellationToken = default) + { + return GetResourceGroupSecurityAlerts(ascLocation).Get(alertName, cancellationToken); + } + + /// Gets a collection of SoftwareInventoryResources in the ResourceGroupResource. + /// The namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// An object representing collection of SoftwareInventoryResources and their operations over a SoftwareInventoryResource. + public virtual SoftwareInventoryCollection GetSoftwareInventories(string resourceNamespace, string resourceType, string resourceName) + { + return new SoftwareInventoryCollection(Client, Id, resourceNamespace, resourceType, resourceName); + } + + /// + /// Gets a single software data of the virtual machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName} + /// + /// + /// Operation Id + /// SoftwareInventories_Get + /// + /// + /// + /// The namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// Name of the installed software. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSoftwareInventoryAsync(string resourceNamespace, string resourceType, string resourceName, string softwareName, CancellationToken cancellationToken = default) + { + return await GetSoftwareInventories(resourceNamespace, resourceType, resourceName).GetAsync(softwareName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a single software data of the virtual machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName} + /// + /// + /// Operation Id + /// SoftwareInventories_Get + /// + /// + /// + /// The namespace of the resource. + /// The type of the resource. + /// Name of the resource. + /// Name of the installed software. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSoftwareInventory(string resourceNamespace, string resourceType, string resourceName, string softwareName, CancellationToken cancellationToken = default) + { + return GetSoftwareInventories(resourceNamespace, resourceType, resourceName).Get(softwareName, cancellationToken); + } + + /// Gets a collection of SecurityConnectorResources in the ResourceGroupResource. + /// An object representing collection of SecurityConnectorResources and their operations over a SecurityConnectorResource. + public virtual SecurityConnectorCollection GetSecurityConnectors() + { + return GetCachedClient(client => new SecurityConnectorCollection(client, Id)); + } + + /// + /// Retrieves details of a specific security connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName} + /// + /// + /// Operation Id + /// SecurityConnectors_Get + /// + /// + /// + /// The security connector name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityConnectorAsync(string securityConnectorName, CancellationToken cancellationToken = default) + { + return await GetSecurityConnectors().GetAsync(securityConnectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves details of a specific security connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName} + /// + /// + /// Operation Id + /// SecurityConnectors_Get + /// + /// + /// + /// The security connector name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityConnector(string securityConnectorName, CancellationToken cancellationToken = default) + { + return GetSecurityConnectors().Get(securityConnectorName, cancellationToken); + } + + /// + /// Gets the list of all possible traffic between resources for the subscription and location, based on connection type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType} + /// + /// + /// Operation Id + /// AllowedConnections_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// The type of allowed connections (Internal, External). + /// The cancellation token to use. + public virtual async Task> GetAllowedConnectionAsync(AzureLocation ascLocation, SecurityCenterConnectionType connectionType, CancellationToken cancellationToken = default) + { + using var scope = AllowedConnectionsClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetAllowedConnection"); + scope.Start(); + try + { + var response = await AllowedConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, connectionType, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of all possible traffic between resources for the subscription and location, based on connection type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType} + /// + /// + /// Operation Id + /// AllowedConnections_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// The type of allowed connections (Internal, External). + /// The cancellation token to use. + public virtual Response GetAllowedConnection(AzureLocation ascLocation, SecurityCenterConnectionType connectionType, CancellationToken cancellationToken = default) + { + using var scope = AllowedConnectionsClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetAllowedConnection"); + scope.Start(); + try + { + var response = AllowedConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, connectionType, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a specific topology component. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName} + /// + /// + /// Operation Id + /// Topology_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of a topology resources collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetTopologyAsync(AzureLocation ascLocation, string topologyResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topologyResourceName, nameof(topologyResourceName)); + + using var scope = TopologyClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetTopology"); + scope.Start(); + try + { + var response = await TopologyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, topologyResourceName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a specific topology component. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName} + /// + /// + /// Operation Id + /// Topology_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of a topology resources collection. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetTopology(AzureLocation ascLocation, string topologyResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topologyResourceName, nameof(topologyResourceName)); + + using var scope = TopologyClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetTopology"); + scope.Start(); + try + { + var response = TopologyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, topologyResourceName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Policies for protecting resources using Just-in-Time access control for the subscription, location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies + /// + /// + /// Operation Id + /// JitNetworkAccessPolicies_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetJitNetworkAccessPoliciesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => JitNetworkAccessPolicyRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => JitNetworkAccessPolicyRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new JitNetworkAccessPolicyResource(Client, JitNetworkAccessPolicyData.DeserializeJitNetworkAccessPolicyData(e)), JitNetworkAccessPolicyClientDiagnostics, Pipeline, "MockableSecurityCenterResourceGroupResource.GetJitNetworkAccessPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Policies for protecting resources using Just-in-Time access control for the subscription, location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies + /// + /// + /// Operation Id + /// JitNetworkAccessPolicies_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetJitNetworkAccessPolicies(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => JitNetworkAccessPolicyRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => JitNetworkAccessPolicyRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new JitNetworkAccessPolicyResource(Client, JitNetworkAccessPolicyData.DeserializeJitNetworkAccessPolicyData(e)), JitNetworkAccessPolicyClientDiagnostics, Pipeline, "MockableSecurityCenterResourceGroupResource.GetJitNetworkAccessPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a specific discovered Security Solution. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName} + /// + /// + /// Operation Id + /// DiscoveredSecuritySolutions_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of a discovered security solution. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetDiscoveredSecuritySolutionAsync(AzureLocation ascLocation, string discoveredSecuritySolutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredSecuritySolutionName, nameof(discoveredSecuritySolutionName)); + + using var scope = DiscoveredSecuritySolutionsClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetDiscoveredSecuritySolution"); + scope.Start(); + try + { + var response = await DiscoveredSecuritySolutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, discoveredSecuritySolutionName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a specific discovered Security Solution. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName} + /// + /// + /// Operation Id + /// DiscoveredSecuritySolutions_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of a discovered security solution. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetDiscoveredSecuritySolution(AzureLocation ascLocation, string discoveredSecuritySolutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(discoveredSecuritySolutionName, nameof(discoveredSecuritySolutionName)); + + using var scope = DiscoveredSecuritySolutionsClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetDiscoveredSecuritySolution"); + scope.Start(); + try + { + var response = DiscoveredSecuritySolutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, discoveredSecuritySolutionName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a specific external Security Solution. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName} + /// + /// + /// Operation Id + /// ExternalSecuritySolutions_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of an external security solution. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetExternalSecuritySolutionAsync(AzureLocation ascLocation, string externalSecuritySolutionsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalSecuritySolutionsName, nameof(externalSecuritySolutionsName)); + + using var scope = ExternalSecuritySolutionsClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetExternalSecuritySolution"); + scope.Start(); + try + { + var response = await ExternalSecuritySolutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, externalSecuritySolutionsName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a specific external Security Solution. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName} + /// + /// + /// Operation Id + /// ExternalSecuritySolutions_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of an external security solution. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetExternalSecuritySolution(AzureLocation ascLocation, string externalSecuritySolutionsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(externalSecuritySolutionsName, nameof(externalSecuritySolutionsName)); + + using var scope = ExternalSecuritySolutionsClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetExternalSecuritySolution"); + scope.Start(); + try + { + var response = ExternalSecuritySolutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, externalSecuritySolutionsName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a specific Security Solution. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName} + /// + /// + /// Operation Id + /// SecuritySolutions_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of security solution. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetSecuritySolutionAsync(AzureLocation ascLocation, string securitySolutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securitySolutionName, nameof(securitySolutionName)); + + using var scope = SecuritySolutionsClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetSecuritySolution"); + scope.Start(); + try + { + var response = await SecuritySolutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, securitySolutionName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a specific Security Solution. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName} + /// + /// + /// Operation Id + /// SecuritySolutions_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// Name of security solution. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetSecuritySolution(AzureLocation ascLocation, string securitySolutionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(securitySolutionName, nameof(securitySolutionName)); + + using var scope = SecuritySolutionsClientDiagnostics.CreateScope("MockableSecurityCenterResourceGroupResource.GetSecuritySolution"); + scope.Start(); + try + { + var response = SecuritySolutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, securitySolutionName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the alerts that are associated with the resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts + /// + /// + /// Operation Id + /// Alerts_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAlertsByResourceGroupAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AlertsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityAlertData.DeserializeSecurityAlertData, AlertsClientDiagnostics, Pipeline, "MockableSecurityCenterResourceGroupResource.GetAlertsByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// List all the alerts that are associated with the resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts + /// + /// + /// Operation Id + /// Alerts_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAlertsByResourceGroup(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AlertsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityAlertData.DeserializeSecurityAlertData, AlertsClientDiagnostics, Pipeline, "MockableSecurityCenterResourceGroupResource.GetAlertsByResourceGroup", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterSubscriptionResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterSubscriptionResource.cs new file mode 100644 index 0000000000000..edc6497f2fd84 --- /dev/null +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterSubscriptionResource.cs @@ -0,0 +1,1701 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.SecurityCenter; +using Azure.ResourceManager.SecurityCenter.Models; + +namespace Azure.ResourceManager.SecurityCenter.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSecurityCenterSubscriptionResource : ArmResource + { + private ClientDiagnostics _mdeOnboardingsClientDiagnostics; + private MdeOnboardingsRestOperations _mdeOnboardingsRestClient; + private ClientDiagnostics _customAssessmentAutomationClientDiagnostics; + private CustomAssessmentAutomationsRestOperations _customAssessmentAutomationRestClient; + private ClientDiagnostics _customEntityStoreAssignmentClientDiagnostics; + private CustomEntityStoreAssignmentsRestOperations _customEntityStoreAssignmentRestClient; + private ClientDiagnostics _iotSecuritySolutionClientDiagnostics; + private IotSecuritySolutionRestOperations _iotSecuritySolutionRestClient; + private ClientDiagnostics _tasksClientDiagnostics; + private TasksRestOperations _tasksRestClient; + private ClientDiagnostics _securityAutomationAutomationsClientDiagnostics; + private AutomationsRestOperations _securityAutomationAutomationsRestClient; + private ClientDiagnostics _adaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics; + private AdaptiveApplicationControlsRestOperations _adaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient; + private ClientDiagnostics _allowedConnectionsClientDiagnostics; + private AllowedConnectionsRestOperations _allowedConnectionsRestClient; + private ClientDiagnostics _topologyClientDiagnostics; + private TopologyRestOperations _topologyRestClient; + private ClientDiagnostics _jitNetworkAccessPolicyClientDiagnostics; + private JitNetworkAccessPoliciesRestOperations _jitNetworkAccessPolicyRestClient; + private ClientDiagnostics _discoveredSecuritySolutionsClientDiagnostics; + private DiscoveredSecuritySolutionsRestOperations _discoveredSecuritySolutionsRestClient; + private ClientDiagnostics _securitySolutionsReferenceDataClientDiagnostics; + private SecuritySolutionsReferenceDataRestOperations _securitySolutionsReferenceDataRestClient; + private ClientDiagnostics _externalSecuritySolutionsClientDiagnostics; + private ExternalSecuritySolutionsRestOperations _externalSecuritySolutionsRestClient; + private ClientDiagnostics _secureScoreControlsClientDiagnostics; + private SecureScoreControlsRestOperations _secureScoreControlsRestClient; + private ClientDiagnostics _secureScoreControlDefinitionsClientDiagnostics; + private SecureScoreControlDefinitionsRestOperations _secureScoreControlDefinitionsRestClient; + private ClientDiagnostics _securitySolutionsClientDiagnostics; + private SecuritySolutionsRestOperations _securitySolutionsRestClient; + private ClientDiagnostics _alertsClientDiagnostics; + private AlertsRestOperations _alertsRestClient; + private ClientDiagnostics _softwareInventoryClientDiagnostics; + private SoftwareInventoriesRestOperations _softwareInventoryRestClient; + private ClientDiagnostics _securityConnectorClientDiagnostics; + private SecurityConnectorsRestOperations _securityConnectorRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSecurityCenterSubscriptionResource() + { + } + + /// 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 MockableSecurityCenterSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics MdeOnboardingsClientDiagnostics => _mdeOnboardingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private MdeOnboardingsRestOperations MdeOnboardingsRestClient => _mdeOnboardingsRestClient ??= new MdeOnboardingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CustomAssessmentAutomationClientDiagnostics => _customAssessmentAutomationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", CustomAssessmentAutomationResource.ResourceType.Namespace, Diagnostics); + private CustomAssessmentAutomationsRestOperations CustomAssessmentAutomationRestClient => _customAssessmentAutomationRestClient ??= new CustomAssessmentAutomationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CustomAssessmentAutomationResource.ResourceType)); + private ClientDiagnostics CustomEntityStoreAssignmentClientDiagnostics => _customEntityStoreAssignmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", CustomEntityStoreAssignmentResource.ResourceType.Namespace, Diagnostics); + private CustomEntityStoreAssignmentsRestOperations CustomEntityStoreAssignmentRestClient => _customEntityStoreAssignmentRestClient ??= new CustomEntityStoreAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CustomEntityStoreAssignmentResource.ResourceType)); + private ClientDiagnostics IotSecuritySolutionClientDiagnostics => _iotSecuritySolutionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", IotSecuritySolutionResource.ResourceType.Namespace, Diagnostics); + private IotSecuritySolutionRestOperations IotSecuritySolutionRestClient => _iotSecuritySolutionRestClient ??= new IotSecuritySolutionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IotSecuritySolutionResource.ResourceType)); + private ClientDiagnostics TasksClientDiagnostics => _tasksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private TasksRestOperations TasksRestClient => _tasksRestClient ??= new TasksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SecurityAutomationAutomationsClientDiagnostics => _securityAutomationAutomationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SecurityAutomationResource.ResourceType.Namespace, Diagnostics); + private AutomationsRestOperations SecurityAutomationAutomationsRestClient => _securityAutomationAutomationsRestClient ??= new AutomationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecurityAutomationResource.ResourceType)); + private ClientDiagnostics AdaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics => _adaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", AdaptiveApplicationControlGroupResource.ResourceType.Namespace, Diagnostics); + private AdaptiveApplicationControlsRestOperations AdaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient => _adaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient ??= new AdaptiveApplicationControlsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AdaptiveApplicationControlGroupResource.ResourceType)); + private ClientDiagnostics AllowedConnectionsClientDiagnostics => _allowedConnectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AllowedConnectionsRestOperations AllowedConnectionsRestClient => _allowedConnectionsRestClient ??= new AllowedConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics TopologyClientDiagnostics => _topologyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private TopologyRestOperations TopologyRestClient => _topologyRestClient ??= new TopologyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics JitNetworkAccessPolicyClientDiagnostics => _jitNetworkAccessPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", JitNetworkAccessPolicyResource.ResourceType.Namespace, Diagnostics); + private JitNetworkAccessPoliciesRestOperations JitNetworkAccessPolicyRestClient => _jitNetworkAccessPolicyRestClient ??= new JitNetworkAccessPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(JitNetworkAccessPolicyResource.ResourceType)); + private ClientDiagnostics DiscoveredSecuritySolutionsClientDiagnostics => _discoveredSecuritySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DiscoveredSecuritySolutionsRestOperations DiscoveredSecuritySolutionsRestClient => _discoveredSecuritySolutionsRestClient ??= new DiscoveredSecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics securitySolutionsReferenceDataClientDiagnostics => _securitySolutionsReferenceDataClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SecuritySolutionsReferenceDataRestOperations securitySolutionsReferenceDataRestClient => _securitySolutionsReferenceDataRestClient ??= new SecuritySolutionsReferenceDataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ExternalSecuritySolutionsClientDiagnostics => _externalSecuritySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ExternalSecuritySolutionsRestOperations ExternalSecuritySolutionsRestClient => _externalSecuritySolutionsRestClient ??= new ExternalSecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SecureScoreControlsClientDiagnostics => _secureScoreControlsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SecureScoreControlsRestOperations SecureScoreControlsRestClient => _secureScoreControlsRestClient ??= new SecureScoreControlsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SecureScoreControlDefinitionsClientDiagnostics => _secureScoreControlDefinitionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SecureScoreControlDefinitionsRestOperations SecureScoreControlDefinitionsRestClient => _secureScoreControlDefinitionsRestClient ??= new SecureScoreControlDefinitionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SecuritySolutionsClientDiagnostics => _securitySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SecuritySolutionsRestOperations SecuritySolutionsRestClient => _securitySolutionsRestClient ??= new SecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AlertsClientDiagnostics => _alertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AlertsRestOperations AlertsRestClient => _alertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SoftwareInventoryClientDiagnostics => _softwareInventoryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SoftwareInventoryResource.ResourceType.Namespace, Diagnostics); + private SoftwareInventoriesRestOperations SoftwareInventoryRestClient => _softwareInventoryRestClient ??= new SoftwareInventoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SoftwareInventoryResource.ResourceType)); + private ClientDiagnostics SecurityConnectorClientDiagnostics => _securityConnectorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SecurityConnectorResource.ResourceType.Namespace, Diagnostics); + private SecurityConnectorsRestOperations SecurityConnectorRestClient => _securityConnectorRestClient ??= new SecurityConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecurityConnectorResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SecurityCenterPricingResources in the SubscriptionResource. + /// An object representing collection of SecurityCenterPricingResources and their operations over a SecurityCenterPricingResource. + public virtual SecurityCenterPricingCollection GetSecurityCenterPricings() + { + return GetCachedClient(client => new SecurityCenterPricingCollection(client, Id)); + } + + /// + /// Gets a provided Microsoft Defender for Cloud pricing configuration in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName} + /// + /// + /// Operation Id + /// Pricings_Get + /// + /// + /// + /// name of the pricing configuration. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityCenterPricingAsync(string pricingName, CancellationToken cancellationToken = default) + { + return await GetSecurityCenterPricings().GetAsync(pricingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a provided Microsoft Defender for Cloud pricing configuration in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName} + /// + /// + /// Operation Id + /// Pricings_Get + /// + /// + /// + /// name of the pricing configuration. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityCenterPricing(string pricingName, CancellationToken cancellationToken = default) + { + return GetSecurityCenterPricings().Get(pricingName, cancellationToken); + } + + /// Gets a collection of SecurityCenterLocationResources in the SubscriptionResource. + /// An object representing collection of SecurityCenterLocationResources and their operations over a SecurityCenterLocationResource. + public virtual SecurityCenterLocationCollection GetSecurityCenterLocations() + { + return GetCachedClient(client => new SecurityCenterLocationCollection(client, Id)); + } + + /// + /// Details of a specific location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation} + /// + /// + /// Operation Id + /// Locations_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetSecurityCenterLocationAsync(AzureLocation ascLocation, CancellationToken cancellationToken = default) + { + return await GetSecurityCenterLocations().GetAsync(ascLocation, cancellationToken).ConfigureAwait(false); + } + + /// + /// Details of a specific location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation} + /// + /// + /// Operation Id + /// Locations_Get + /// + /// + /// + /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetSecurityCenterLocation(AzureLocation ascLocation, CancellationToken cancellationToken = default) + { + return GetSecurityCenterLocations().Get(ascLocation, cancellationToken); + } + + /// Gets a collection of AutoProvisioningSettingResources in the SubscriptionResource. + /// An object representing collection of AutoProvisioningSettingResources and their operations over a AutoProvisioningSettingResource. + public virtual AutoProvisioningSettingCollection GetAutoProvisioningSettings() + { + return GetCachedClient(client => new AutoProvisioningSettingCollection(client, Id)); + } + + /// + /// Details of a specific setting + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName} + /// + /// + /// Operation Id + /// AutoProvisioningSettings_Get + /// + /// + /// + /// Auto provisioning setting key. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutoProvisioningSettingAsync(string settingName, CancellationToken cancellationToken = default) + { + return await GetAutoProvisioningSettings().GetAsync(settingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Details of a specific setting + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName} + /// + /// + /// Operation Id + /// AutoProvisioningSettings_Get + /// + /// + /// + /// Auto provisioning setting key. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutoProvisioningSetting(string settingName, CancellationToken cancellationToken = default) + { + return GetAutoProvisioningSettings().Get(settingName, cancellationToken); + } + + /// Gets a collection of SecurityContactResources in the SubscriptionResource. + /// An object representing collection of SecurityContactResources and their operations over a SecurityContactResource. + public virtual SecurityContactCollection GetSecurityContacts() + { + return GetCachedClient(client => new SecurityContactCollection(client, Id)); + } + + /// + /// Get Default Security contact configurations for the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName} + /// + /// + /// Operation Id + /// SecurityContacts_Get + /// + /// + /// + /// Name of the security contact object. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityContactAsync(string securityContactName, CancellationToken cancellationToken = default) + { + return await GetSecurityContacts().GetAsync(securityContactName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Default Security contact configurations for the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName} + /// + /// + /// Operation Id + /// SecurityContacts_Get + /// + /// + /// + /// Name of the security contact object. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityContact(string securityContactName, CancellationToken cancellationToken = default) + { + return GetSecurityContacts().Get(securityContactName, cancellationToken); + } + + /// Gets a collection of SecurityWorkspaceSettingResources in the SubscriptionResource. + /// An object representing collection of SecurityWorkspaceSettingResources and their operations over a SecurityWorkspaceSettingResource. + public virtual SecurityWorkspaceSettingCollection GetSecurityWorkspaceSettings() + { + return GetCachedClient(client => new SecurityWorkspaceSettingCollection(client, Id)); + } + + /// + /// Settings about where we should store your security data and logs. If the result is empty, it means that no custom-workspace configuration was set + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName} + /// + /// + /// Operation Id + /// WorkspaceSettings_Get + /// + /// + /// + /// Name of the security setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityWorkspaceSettingAsync(string workspaceSettingName, CancellationToken cancellationToken = default) + { + return await GetSecurityWorkspaceSettings().GetAsync(workspaceSettingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Settings about where we should store your security data and logs. If the result is empty, it means that no custom-workspace configuration was set + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName} + /// + /// + /// Operation Id + /// WorkspaceSettings_Get + /// + /// + /// + /// Name of the security setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityWorkspaceSetting(string workspaceSettingName, CancellationToken cancellationToken = default) + { + return GetSecurityWorkspaceSettings().Get(workspaceSettingName, cancellationToken); + } + + /// Gets a collection of RegulatoryComplianceStandardResources in the SubscriptionResource. + /// An object representing collection of RegulatoryComplianceStandardResources and their operations over a RegulatoryComplianceStandardResource. + public virtual RegulatoryComplianceStandardCollection GetRegulatoryComplianceStandards() + { + return GetCachedClient(client => new RegulatoryComplianceStandardCollection(client, Id)); + } + + /// + /// Supported regulatory compliance details state for selected standard + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName} + /// + /// + /// Operation Id + /// RegulatoryComplianceStandards_Get + /// + /// + /// + /// Name of the regulatory compliance standard object. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRegulatoryComplianceStandardAsync(string regulatoryComplianceStandardName, CancellationToken cancellationToken = default) + { + return await GetRegulatoryComplianceStandards().GetAsync(regulatoryComplianceStandardName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Supported regulatory compliance details state for selected standard + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName} + /// + /// + /// Operation Id + /// RegulatoryComplianceStandards_Get + /// + /// + /// + /// Name of the regulatory compliance standard object. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRegulatoryComplianceStandard(string regulatoryComplianceStandardName, CancellationToken cancellationToken = default) + { + return GetRegulatoryComplianceStandards().Get(regulatoryComplianceStandardName, cancellationToken); + } + + /// Gets a collection of SecurityAlertsSuppressionRuleResources in the SubscriptionResource. + /// An object representing collection of SecurityAlertsSuppressionRuleResources and their operations over a SecurityAlertsSuppressionRuleResource. + public virtual SecurityAlertsSuppressionRuleCollection GetSecurityAlertsSuppressionRules() + { + return GetCachedClient(client => new SecurityAlertsSuppressionRuleCollection(client, Id)); + } + + /// + /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName} + /// + /// + /// Operation Id + /// AlertsSuppressionRules_Get + /// + /// + /// + /// The unique name of the suppression alert rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityAlertsSuppressionRuleAsync(string alertsSuppressionRuleName, CancellationToken cancellationToken = default) + { + return await GetSecurityAlertsSuppressionRules().GetAsync(alertsSuppressionRuleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName} + /// + /// + /// Operation Id + /// AlertsSuppressionRules_Get + /// + /// + /// + /// The unique name of the suppression alert rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityAlertsSuppressionRule(string alertsSuppressionRuleName, CancellationToken cancellationToken = default) + { + return GetSecurityAlertsSuppressionRules().Get(alertsSuppressionRuleName, cancellationToken); + } + + /// Gets a collection of SubscriptionAssessmentMetadataResources in the SubscriptionResource. + /// An object representing collection of SubscriptionAssessmentMetadataResources and their operations over a SubscriptionAssessmentMetadataResource. + public virtual SubscriptionAssessmentMetadataCollection GetAllSubscriptionAssessmentMetadata() + { + return GetCachedClient(client => new SubscriptionAssessmentMetadataCollection(client, Id)); + } + + /// + /// Get metadata information on an assessment type in a specific subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName} + /// + /// + /// Operation Id + /// AssessmentsMetadata_GetInSubscription + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionAssessmentMetadataAsync(string assessmentMetadataName, CancellationToken cancellationToken = default) + { + return await GetAllSubscriptionAssessmentMetadata().GetAsync(assessmentMetadataName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get metadata information on an assessment type in a specific subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName} + /// + /// + /// Operation Id + /// AssessmentsMetadata_GetInSubscription + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionAssessmentMetadata(string assessmentMetadataName, CancellationToken cancellationToken = default) + { + return GetAllSubscriptionAssessmentMetadata().Get(assessmentMetadataName, cancellationToken); + } + + /// Gets a collection of SecureScoreResources in the SubscriptionResource. + /// An object representing collection of SecureScoreResources and their operations over a SecureScoreResource. + public virtual SecureScoreCollection GetSecureScores() + { + return GetCachedClient(client => new SecureScoreCollection(client, Id)); + } + + /// + /// Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC Default initiative, use 'ascScore'. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName} + /// + /// + /// Operation Id + /// SecureScores_Get + /// + /// + /// + /// The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecureScoreAsync(string secureScoreName, CancellationToken cancellationToken = default) + { + return await GetSecureScores().GetAsync(secureScoreName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC Default initiative, use 'ascScore'. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName} + /// + /// + /// Operation Id + /// SecureScores_Get + /// + /// + /// + /// The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecureScore(string secureScoreName, CancellationToken cancellationToken = default) + { + return GetSecureScores().Get(secureScoreName, cancellationToken); + } + + /// Gets a collection of SecurityCloudConnectorResources in the SubscriptionResource. + /// An object representing collection of SecurityCloudConnectorResources and their operations over a SecurityCloudConnectorResource. + public virtual SecurityCloudConnectorCollection GetSecurityCloudConnectors() + { + return GetCachedClient(client => new SecurityCloudConnectorCollection(client, Id)); + } + + /// + /// Details of a specific cloud account connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connectors_Get + /// + /// + /// + /// Name of the cloud account connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecurityCloudConnectorAsync(string connectorName, CancellationToken cancellationToken = default) + { + return await GetSecurityCloudConnectors().GetAsync(connectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Details of a specific cloud account connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connectors_Get + /// + /// + /// + /// Name of the cloud account connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecurityCloudConnector(string connectorName, CancellationToken cancellationToken = default) + { + return GetSecurityCloudConnectors().Get(connectorName, cancellationToken); + } + + /// Gets a collection of SecuritySettingResources in the SubscriptionResource. + /// An object representing collection of SecuritySettingResources and their operations over a SecuritySettingResource. + public virtual SecuritySettingCollection GetSecuritySettings() + { + return GetCachedClient(client => new SecuritySettingCollection(client, Id)); + } + + /// + /// Settings of different configurations in Microsoft Defender for Cloud + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName} + /// + /// + /// Operation Id + /// Settings_Get + /// + /// + /// + /// The name of the setting. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetSecuritySettingAsync(SecuritySettingName settingName, CancellationToken cancellationToken = default) + { + return await GetSecuritySettings().GetAsync(settingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Settings of different configurations in Microsoft Defender for Cloud + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName} + /// + /// + /// Operation Id + /// Settings_Get + /// + /// + /// + /// The name of the setting. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetSecuritySetting(SecuritySettingName settingName, CancellationToken cancellationToken = default) + { + return GetSecuritySettings().Get(settingName, cancellationToken); + } + + /// Gets a collection of IngestionSettingResources in the SubscriptionResource. + /// An object representing collection of IngestionSettingResources and their operations over a IngestionSettingResource. + public virtual IngestionSettingCollection GetIngestionSettings() + { + return GetCachedClient(client => new IngestionSettingCollection(client, Id)); + } + + /// + /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} + /// + /// + /// Operation Id + /// IngestionSettings_Get + /// + /// + /// + /// Name of the ingestion setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetIngestionSettingAsync(string ingestionSettingName, CancellationToken cancellationToken = default) + { + return await GetIngestionSettings().GetAsync(ingestionSettingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} + /// + /// + /// Operation Id + /// IngestionSettings_Get + /// + /// + /// + /// Name of the ingestion setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetIngestionSetting(string ingestionSettingName, CancellationToken cancellationToken = default) + { + return GetIngestionSettings().Get(ingestionSettingName, cancellationToken); + } + + /// Gets a collection of SubscriptionSecurityApplicationResources in the SubscriptionResource. + /// An object representing collection of SubscriptionSecurityApplicationResources and their operations over a SubscriptionSecurityApplicationResource. + public virtual SubscriptionSecurityApplicationCollection GetSubscriptionSecurityApplications() + { + return GetCachedClient(client => new SubscriptionSecurityApplicationCollection(client, Id)); + } + + /// + /// Get a specific application for the requested scope by applicationId + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId} + /// + /// + /// Operation Id + /// Application_Get + /// + /// + /// + /// The security Application key - unique key for the standard application. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionSecurityApplicationAsync(string applicationId, CancellationToken cancellationToken = default) + { + return await GetSubscriptionSecurityApplications().GetAsync(applicationId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specific application for the requested scope by applicationId + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId} + /// + /// + /// Operation Id + /// Application_Get + /// + /// + /// + /// The security Application key - unique key for the standard application. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionSecurityApplication(string applicationId, CancellationToken cancellationToken = default) + { + return GetSubscriptionSecurityApplications().Get(applicationId, cancellationToken); + } + + /// + /// The configuration or data needed to onboard the machine to MDE + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings + /// + /// + /// Operation Id + /// MdeOnboardings_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetMdeOnboardingsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MdeOnboardingsRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MdeOnboarding.DeserializeMdeOnboarding, MdeOnboardingsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetMdeOnboardings", "value", null, cancellationToken); + } + + /// + /// The configuration or data needed to onboard the machine to MDE + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings + /// + /// + /// Operation Id + /// MdeOnboardings_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetMdeOnboardings(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => MdeOnboardingsRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MdeOnboarding.DeserializeMdeOnboarding, MdeOnboardingsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetMdeOnboardings", "value", null, cancellationToken); + } + + /// + /// The default configuration or data needed to onboard the machine to MDE + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default + /// + /// + /// Operation Id + /// MdeOnboardings_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetMdeOnboardingAsync(CancellationToken cancellationToken = default) + { + using var scope = MdeOnboardingsClientDiagnostics.CreateScope("MockableSecurityCenterSubscriptionResource.GetMdeOnboarding"); + scope.Start(); + try + { + var response = await MdeOnboardingsRestClient.GetAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The default configuration or data needed to onboard the machine to MDE + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default + /// + /// + /// Operation Id + /// MdeOnboardings_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetMdeOnboarding(CancellationToken cancellationToken = default) + { + using var scope = MdeOnboardingsClientDiagnostics.CreateScope("MockableSecurityCenterSubscriptionResource.GetMdeOnboarding"); + scope.Start(); + try + { + var response = MdeOnboardingsRestClient.Get(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List custom assessment automations by provided subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations + /// + /// + /// Operation Id + /// CustomAssessmentAutomations_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCustomAssessmentAutomationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CustomAssessmentAutomationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomAssessmentAutomationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CustomAssessmentAutomationResource(Client, CustomAssessmentAutomationData.DeserializeCustomAssessmentAutomationData(e)), CustomAssessmentAutomationClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetCustomAssessmentAutomations", "value", "nextLink", cancellationToken); + } + + /// + /// List custom assessment automations by provided subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations + /// + /// + /// Operation Id + /// CustomAssessmentAutomations_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCustomAssessmentAutomations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CustomAssessmentAutomationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomAssessmentAutomationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CustomAssessmentAutomationResource(Client, CustomAssessmentAutomationData.DeserializeCustomAssessmentAutomationData(e)), CustomAssessmentAutomationClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetCustomAssessmentAutomations", "value", "nextLink", cancellationToken); + } + + /// + /// List custom entity store assignments by provided subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments + /// + /// + /// Operation Id + /// CustomEntityStoreAssignments_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCustomEntityStoreAssignmentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CustomEntityStoreAssignmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomEntityStoreAssignmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CustomEntityStoreAssignmentResource(Client, CustomEntityStoreAssignmentData.DeserializeCustomEntityStoreAssignmentData(e)), CustomEntityStoreAssignmentClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetCustomEntityStoreAssignments", "value", "nextLink", cancellationToken); + } + + /// + /// List custom entity store assignments by provided subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments + /// + /// + /// Operation Id + /// CustomEntityStoreAssignments_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCustomEntityStoreAssignments(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CustomEntityStoreAssignmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomEntityStoreAssignmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CustomEntityStoreAssignmentResource(Client, CustomEntityStoreAssignmentData.DeserializeCustomEntityStoreAssignmentData(e)), CustomEntityStoreAssignmentClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetCustomEntityStoreAssignments", "value", "nextLink", cancellationToken); + } + + /// + /// Use this method to get the list of IoT Security solutions by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions + /// + /// + /// Operation Id + /// IotSecuritySolution_ListBySubscription + /// + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetIotSecuritySolutionsAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IotSecuritySolutionRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotSecuritySolutionRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IotSecuritySolutionResource(Client, IotSecuritySolutionData.DeserializeIotSecuritySolutionData(e)), IotSecuritySolutionClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetIotSecuritySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// Use this method to get the list of IoT Security solutions by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions + /// + /// + /// Operation Id + /// IotSecuritySolution_ListBySubscription + /// + /// + /// + /// Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetIotSecuritySolutions(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => IotSecuritySolutionRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotSecuritySolutionRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IotSecuritySolutionResource(Client, IotSecuritySolutionData.DeserializeIotSecuritySolutionData(e)), IotSecuritySolutionClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetIotSecuritySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// Recommended tasks that will help improve the security of the subscription proactively + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks + /// + /// + /// Operation Id + /// Tasks_List + /// + /// + /// + /// OData filter. Optional. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetTasksAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TasksRestClient.CreateListRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TasksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityTaskData.DeserializeSecurityTaskData, TasksClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetTasks", "value", "nextLink", cancellationToken); + } + + /// + /// Recommended tasks that will help improve the security of the subscription proactively + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks + /// + /// + /// Operation Id + /// Tasks_List + /// + /// + /// + /// OData filter. Optional. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetTasks(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TasksRestClient.CreateListRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TasksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityTaskData.DeserializeSecurityTaskData, TasksClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetTasks", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to get the next page of security automations for the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/automations + /// + /// + /// Operation Id + /// Automations_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecurityAutomationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityAutomationAutomationsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityAutomationAutomationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecurityAutomationResource(Client, SecurityAutomationData.DeserializeSecurityAutomationData(e)), SecurityAutomationAutomationsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecurityAutomations", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to get the next page of security automations for the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/automations + /// + /// + /// Operation Id + /// Automations_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecurityAutomations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityAutomationAutomationsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityAutomationAutomationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecurityAutomationResource(Client, SecurityAutomationData.DeserializeSecurityAutomationData(e)), SecurityAutomationAutomationsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecurityAutomations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of application control machine groups for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings + /// + /// + /// Operation Id + /// AdaptiveApplicationControls_List + /// + /// + /// + /// Include the policy rules. + /// Return output in a summarized form. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAdaptiveApplicationControlGroupsAsync(bool? includePathRecommendations = null, bool? summary = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AdaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient.CreateListRequest(Id.SubscriptionId, includePathRecommendations, summary); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AdaptiveApplicationControlGroupResource(Client, AdaptiveApplicationControlGroupData.DeserializeAdaptiveApplicationControlGroupData(e)), AdaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetAdaptiveApplicationControlGroups", "value", null, cancellationToken); + } + + /// + /// Gets a list of application control machine groups for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings + /// + /// + /// Operation Id + /// AdaptiveApplicationControls_List + /// + /// + /// + /// Include the policy rules. + /// Return output in a summarized form. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAdaptiveApplicationControlGroups(bool? includePathRecommendations = null, bool? summary = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AdaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient.CreateListRequest(Id.SubscriptionId, includePathRecommendations, summary); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AdaptiveApplicationControlGroupResource(Client, AdaptiveApplicationControlGroupData.DeserializeAdaptiveApplicationControlGroupData(e)), AdaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetAdaptiveApplicationControlGroups", "value", null, cancellationToken); + } + + /// + /// Gets the list of all possible traffic between resources for the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections + /// + /// + /// Operation Id + /// AllowedConnections_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllowedConnectionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AllowedConnectionsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AllowedConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityCenterAllowedConnection.DeserializeSecurityCenterAllowedConnection, AllowedConnectionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetAllowedConnections", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of all possible traffic between resources for the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections + /// + /// + /// Operation Id + /// AllowedConnections_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllowedConnections(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AllowedConnectionsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AllowedConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityCenterAllowedConnection.DeserializeSecurityCenterAllowedConnection, AllowedConnectionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetAllowedConnections", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list that allows to build a topology view of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies + /// + /// + /// Operation Id + /// Topology_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetTopologiesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TopologyRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TopologyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityTopologyResource.DeserializeSecurityTopologyResource, TopologyClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetTopologies", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list that allows to build a topology view of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies + /// + /// + /// Operation Id + /// Topology_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetTopologies(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TopologyRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TopologyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityTopologyResource.DeserializeSecurityTopologyResource, TopologyClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetTopologies", "value", "nextLink", cancellationToken); + } + + /// + /// Policies for protecting resources using Just-in-Time access control. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies + /// + /// + /// Operation Id + /// JitNetworkAccessPolicies_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetJitNetworkAccessPoliciesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => JitNetworkAccessPolicyRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => JitNetworkAccessPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new JitNetworkAccessPolicyResource(Client, JitNetworkAccessPolicyData.DeserializeJitNetworkAccessPolicyData(e)), JitNetworkAccessPolicyClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetJitNetworkAccessPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Policies for protecting resources using Just-in-Time access control. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies + /// + /// + /// Operation Id + /// JitNetworkAccessPolicies_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetJitNetworkAccessPolicies(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => JitNetworkAccessPolicyRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => JitNetworkAccessPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new JitNetworkAccessPolicyResource(Client, JitNetworkAccessPolicyData.DeserializeJitNetworkAccessPolicyData(e)), JitNetworkAccessPolicyClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetJitNetworkAccessPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of discovered Security Solutions for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions + /// + /// + /// Operation Id + /// DiscoveredSecuritySolutions_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDiscoveredSecuritySolutionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiscoveredSecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiscoveredSecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DiscoveredSecuritySolution.DeserializeDiscoveredSecuritySolution, DiscoveredSecuritySolutionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetDiscoveredSecuritySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of discovered Security Solutions for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions + /// + /// + /// Operation Id + /// DiscoveredSecuritySolutions_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDiscoveredSecuritySolutions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiscoveredSecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiscoveredSecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DiscoveredSecuritySolution.DeserializeDiscoveredSecuritySolution, DiscoveredSecuritySolutionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetDiscoveredSecuritySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all supported Security Solutions for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData + /// + /// + /// Operation Id + /// securitySolutionsReferenceData_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllSecuritySolutionsReferenceDataAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => securitySolutionsReferenceDataRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, SecuritySolutionsReferenceData.DeserializeSecuritySolutionsReferenceData, securitySolutionsReferenceDataClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetAllSecuritySolutionsReferenceData", "value", null, cancellationToken); + } + + /// + /// Gets a list of all supported Security Solutions for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData + /// + /// + /// Operation Id + /// securitySolutionsReferenceData_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllSecuritySolutionsReferenceData(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => securitySolutionsReferenceDataRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, SecuritySolutionsReferenceData.DeserializeSecuritySolutionsReferenceData, securitySolutionsReferenceDataClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetAllSecuritySolutionsReferenceData", "value", null, cancellationToken); + } + + /// + /// Gets a list of external security solutions for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions + /// + /// + /// Operation Id + /// ExternalSecuritySolutions_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetExternalSecuritySolutionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExternalSecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExternalSecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ExternalSecuritySolution.DeserializeExternalSecuritySolution, ExternalSecuritySolutionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetExternalSecuritySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of external security solutions for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions + /// + /// + /// Operation Id + /// ExternalSecuritySolutions_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetExternalSecuritySolutions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ExternalSecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExternalSecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ExternalSecuritySolution.DeserializeExternalSecuritySolution, ExternalSecuritySolutionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetExternalSecuritySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// Get all security controls within a scope + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls + /// + /// + /// Operation Id + /// SecureScoreControls_List + /// + /// + /// + /// OData expand. Optional. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecureScoreControlsAsync(SecurityScoreODataExpand? expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlsRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecureScoreControlDetails.DeserializeSecureScoreControlDetails, SecureScoreControlsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecureScoreControls", "value", "nextLink", cancellationToken); + } + + /// + /// Get all security controls within a scope + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls + /// + /// + /// Operation Id + /// SecureScoreControls_List + /// + /// + /// + /// OData expand. Optional. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecureScoreControls(SecurityScoreODataExpand? expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlsRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecureScoreControlDetails.DeserializeSecureScoreControlDetails, SecureScoreControlsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecureScoreControls", "value", "nextLink", cancellationToken); + } + + /// + /// For a specified subscription, list the available security controls, their assessments, and the max score + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions + /// + /// + /// Operation Id + /// SecureScoreControlDefinitions_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecureScoreControlDefinitionsBySubscriptionAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlDefinitionsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlDefinitionsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecureScoreControlDefinitionItem.DeserializeSecureScoreControlDefinitionItem, SecureScoreControlDefinitionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecureScoreControlDefinitionsBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// For a specified subscription, list the available security controls, their assessments, and the max score + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions + /// + /// + /// Operation Id + /// SecureScoreControlDefinitions_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecureScoreControlDefinitionsBySubscription(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlDefinitionsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlDefinitionsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecureScoreControlDefinitionItem.DeserializeSecureScoreControlDefinitionItem, SecureScoreControlDefinitionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecureScoreControlDefinitionsBySubscription", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of Security Solutions for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions + /// + /// + /// Operation Id + /// SecuritySolutions_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecuritySolutionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecuritySolution.DeserializeSecuritySolution, SecuritySolutionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecuritySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of Security Solutions for the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions + /// + /// + /// Operation Id + /// SecuritySolutions_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecuritySolutions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecuritySolution.DeserializeSecuritySolution, SecuritySolutionsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecuritySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// List all the alerts that are associated with the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts + /// + /// + /// Operation Id + /// Alerts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAlertsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AlertsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityAlertData.DeserializeSecurityAlertData, AlertsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetAlerts", "value", "nextLink", cancellationToken); + } + + /// + /// List all the alerts that are associated with the subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts + /// + /// + /// Operation Id + /// Alerts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAlerts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AlertsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityAlertData.DeserializeSecurityAlertData, AlertsClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetAlerts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the software inventory of all virtual machines in the subscriptions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories + /// + /// + /// Operation Id + /// SoftwareInventories_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSoftwareInventoriesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SoftwareInventoryRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SoftwareInventoryRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SoftwareInventoryResource(Client, SoftwareInventoryData.DeserializeSoftwareInventoryData(e)), SoftwareInventoryClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSoftwareInventories", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the software inventory of all virtual machines in the subscriptions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories + /// + /// + /// Operation Id + /// SoftwareInventories_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSoftwareInventories(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SoftwareInventoryRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SoftwareInventoryRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SoftwareInventoryResource(Client, SoftwareInventoryData.DeserializeSoftwareInventoryData(e)), SoftwareInventoryClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSoftwareInventories", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors + /// + /// + /// Operation Id + /// SecurityConnectors_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecurityConnectorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityConnectorRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityConnectorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecurityConnectorResource(Client, SecurityConnectorData.DeserializeSecurityConnectorData(e)), SecurityConnectorClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecurityConnectors", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors + /// + /// + /// Operation Id + /// SecurityConnectors_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecurityConnectors(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityConnectorRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityConnectorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecurityConnectorResource(Client, SecurityConnectorData.DeserializeSecurityConnectorData(e)), SecurityConnectorClientDiagnostics, Pipeline, "MockableSecurityCenterSubscriptionResource.GetSecurityConnectors", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterTenantResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterTenantResource.cs new file mode 100644 index 0000000000000..8ed3fb6cf001b --- /dev/null +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/MockableSecurityCenterTenantResource.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.SecurityCenter; +using Azure.ResourceManager.SecurityCenter.Models; + +namespace Azure.ResourceManager.SecurityCenter.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableSecurityCenterTenantResource : ArmResource + { + private ClientDiagnostics _secureScoreControlDefinitionsClientDiagnostics; + private SecureScoreControlDefinitionsRestOperations _secureScoreControlDefinitionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSecurityCenterTenantResource() + { + } + + /// 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 MockableSecurityCenterTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SecureScoreControlDefinitionsClientDiagnostics => _secureScoreControlDefinitionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SecureScoreControlDefinitionsRestOperations SecureScoreControlDefinitionsRestClient => _secureScoreControlDefinitionsRestClient ??= new SecureScoreControlDefinitionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of TenantAssessmentMetadataResources in the TenantResource. + /// An object representing collection of TenantAssessmentMetadataResources and their operations over a TenantAssessmentMetadataResource. + public virtual TenantAssessmentMetadataCollection GetAllTenantAssessmentMetadata() + { + return GetCachedClient(client => new TenantAssessmentMetadataCollection(client, Id)); + } + + /// + /// Get metadata information on an assessment type + /// + /// + /// Request Path + /// /providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName} + /// + /// + /// Operation Id + /// AssessmentsMetadata_Get + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTenantAssessmentMetadataAsync(string assessmentMetadataName, CancellationToken cancellationToken = default) + { + return await GetAllTenantAssessmentMetadata().GetAsync(assessmentMetadataName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get metadata information on an assessment type + /// + /// + /// Request Path + /// /providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName} + /// + /// + /// Operation Id + /// AssessmentsMetadata_Get + /// + /// + /// + /// The Assessment Key - Unique key for the assessment type. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTenantAssessmentMetadata(string assessmentMetadataName, CancellationToken cancellationToken = default) + { + return GetAllTenantAssessmentMetadata().Get(assessmentMetadataName, cancellationToken); + } + + /// + /// List the available security controls, their assessments, and the max score + /// + /// + /// Request Path + /// /providers/Microsoft.Security/secureScoreControlDefinitions + /// + /// + /// Operation Id + /// SecureScoreControlDefinitions_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecureScoreControlDefinitionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlDefinitionsRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlDefinitionsRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecureScoreControlDefinitionItem.DeserializeSecureScoreControlDefinitionItem, SecureScoreControlDefinitionsClientDiagnostics, Pipeline, "MockableSecurityCenterTenantResource.GetSecureScoreControlDefinitions", "value", "nextLink", cancellationToken); + } + + /// + /// List the available security controls, their assessments, and the max score + /// + /// + /// Request Path + /// /providers/Microsoft.Security/secureScoreControlDefinitions + /// + /// + /// Operation Id + /// SecureScoreControlDefinitions_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecureScoreControlDefinitions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlDefinitionsRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlDefinitionsRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecureScoreControlDefinitionItem.DeserializeSecureScoreControlDefinitionItem, SecureScoreControlDefinitionsClientDiagnostics, Pipeline, "MockableSecurityCenterTenantResource.GetSecureScoreControlDefinitions", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 31dabc523aef6..0000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,568 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.SecurityCenter.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _allowedConnectionsClientDiagnostics; - private AllowedConnectionsRestOperations _allowedConnectionsRestClient; - private ClientDiagnostics _topologyClientDiagnostics; - private TopologyRestOperations _topologyRestClient; - private ClientDiagnostics _jitNetworkAccessPolicyClientDiagnostics; - private JitNetworkAccessPoliciesRestOperations _jitNetworkAccessPolicyRestClient; - private ClientDiagnostics _discoveredSecuritySolutionsClientDiagnostics; - private DiscoveredSecuritySolutionsRestOperations _discoveredSecuritySolutionsRestClient; - private ClientDiagnostics _externalSecuritySolutionsClientDiagnostics; - private ExternalSecuritySolutionsRestOperations _externalSecuritySolutionsRestClient; - private ClientDiagnostics _securitySolutionsClientDiagnostics; - private SecuritySolutionsRestOperations _securitySolutionsRestClient; - private ClientDiagnostics _alertsClientDiagnostics; - private AlertsRestOperations _alertsRestClient; - - /// 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 ClientDiagnostics AllowedConnectionsClientDiagnostics => _allowedConnectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AllowedConnectionsRestOperations AllowedConnectionsRestClient => _allowedConnectionsRestClient ??= new AllowedConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics TopologyClientDiagnostics => _topologyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private TopologyRestOperations TopologyRestClient => _topologyRestClient ??= new TopologyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics JitNetworkAccessPolicyClientDiagnostics => _jitNetworkAccessPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", JitNetworkAccessPolicyResource.ResourceType.Namespace, Diagnostics); - private JitNetworkAccessPoliciesRestOperations JitNetworkAccessPolicyRestClient => _jitNetworkAccessPolicyRestClient ??= new JitNetworkAccessPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(JitNetworkAccessPolicyResource.ResourceType)); - private ClientDiagnostics DiscoveredSecuritySolutionsClientDiagnostics => _discoveredSecuritySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DiscoveredSecuritySolutionsRestOperations DiscoveredSecuritySolutionsRestClient => _discoveredSecuritySolutionsRestClient ??= new DiscoveredSecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ExternalSecuritySolutionsClientDiagnostics => _externalSecuritySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ExternalSecuritySolutionsRestOperations ExternalSecuritySolutionsRestClient => _externalSecuritySolutionsRestClient ??= new ExternalSecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SecuritySolutionsClientDiagnostics => _securitySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SecuritySolutionsRestOperations SecuritySolutionsRestClient => _securitySolutionsRestClient ??= new SecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AlertsClientDiagnostics => _alertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AlertsRestOperations AlertsRestClient => _alertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of CustomAssessmentAutomationResources in the ResourceGroupResource. - /// An object representing collection of CustomAssessmentAutomationResources and their operations over a CustomAssessmentAutomationResource. - public virtual CustomAssessmentAutomationCollection GetCustomAssessmentAutomations() - { - return GetCachedClient(Client => new CustomAssessmentAutomationCollection(Client, Id)); - } - - /// Gets a collection of CustomEntityStoreAssignmentResources in the ResourceGroupResource. - /// An object representing collection of CustomEntityStoreAssignmentResources and their operations over a CustomEntityStoreAssignmentResource. - public virtual CustomEntityStoreAssignmentCollection GetCustomEntityStoreAssignments() - { - return GetCachedClient(Client => new CustomEntityStoreAssignmentCollection(Client, Id)); - } - - /// Gets a collection of IotSecuritySolutionResources in the ResourceGroupResource. - /// An object representing collection of IotSecuritySolutionResources and their operations over a IotSecuritySolutionResource. - public virtual IotSecuritySolutionCollection GetIotSecuritySolutions() - { - return GetCachedClient(Client => new IotSecuritySolutionCollection(Client, Id)); - } - - /// Gets a collection of ResourceGroupSecurityTaskResources in the ResourceGroupResource. - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// An object representing collection of ResourceGroupSecurityTaskResources and their operations over a ResourceGroupSecurityTaskResource. - public virtual ResourceGroupSecurityTaskCollection GetResourceGroupSecurityTasks(AzureLocation ascLocation) - { - return new ResourceGroupSecurityTaskCollection(Client, Id, ascLocation); - } - - /// Gets a collection of SecurityAutomationResources in the ResourceGroupResource. - /// An object representing collection of SecurityAutomationResources and their operations over a SecurityAutomationResource. - public virtual SecurityAutomationCollection GetSecurityAutomations() - { - return GetCachedClient(Client => new SecurityAutomationCollection(Client, Id)); - } - - /// Gets a collection of ServerVulnerabilityAssessmentResources in the ResourceGroupResource. - /// The Namespace of the resource. - /// The type of the resource. - /// Name of the resource. - /// An object representing collection of ServerVulnerabilityAssessmentResources and their operations over a ServerVulnerabilityAssessmentResource. - public virtual ServerVulnerabilityAssessmentCollection GetServerVulnerabilityAssessments(string resourceNamespace, string resourceType, string resourceName) - { - return new ServerVulnerabilityAssessmentCollection(Client, Id, resourceNamespace, resourceType, resourceName); - } - - /// Gets a collection of AdaptiveNetworkHardeningResources in the ResourceGroupResource. - /// The Namespace of the resource. - /// The type of the resource. - /// Name of the resource. - /// An object representing collection of AdaptiveNetworkHardeningResources and their operations over a AdaptiveNetworkHardeningResource. - public virtual AdaptiveNetworkHardeningCollection GetAdaptiveNetworkHardenings(string resourceNamespace, string resourceType, string resourceName) - { - return new AdaptiveNetworkHardeningCollection(Client, Id, resourceNamespace, resourceType, resourceName); - } - - /// Gets a collection of JitNetworkAccessPolicyResources in the ResourceGroupResource. - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// An object representing collection of JitNetworkAccessPolicyResources and their operations over a JitNetworkAccessPolicyResource. - public virtual JitNetworkAccessPolicyCollection GetJitNetworkAccessPolicies(AzureLocation ascLocation) - { - return new JitNetworkAccessPolicyCollection(Client, Id, ascLocation); - } - - /// Gets a collection of ResourceGroupSecurityAlertResources in the ResourceGroupResource. - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// An object representing collection of ResourceGroupSecurityAlertResources and their operations over a ResourceGroupSecurityAlertResource. - public virtual ResourceGroupSecurityAlertCollection GetResourceGroupSecurityAlerts(AzureLocation ascLocation) - { - return new ResourceGroupSecurityAlertCollection(Client, Id, ascLocation); - } - - /// Gets a collection of SoftwareInventoryResources in the ResourceGroupResource. - /// The namespace of the resource. - /// The type of the resource. - /// Name of the resource. - /// An object representing collection of SoftwareInventoryResources and their operations over a SoftwareInventoryResource. - public virtual SoftwareInventoryCollection GetSoftwareInventories(string resourceNamespace, string resourceType, string resourceName) - { - return new SoftwareInventoryCollection(Client, Id, resourceNamespace, resourceType, resourceName); - } - - /// Gets a collection of SecurityConnectorResources in the ResourceGroupResource. - /// An object representing collection of SecurityConnectorResources and their operations over a SecurityConnectorResource. - public virtual SecurityConnectorCollection GetSecurityConnectors() - { - return GetCachedClient(Client => new SecurityConnectorCollection(Client, Id)); - } - - /// - /// Gets the list of all possible traffic between resources for the subscription and location, based on connection type. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType} - /// - /// - /// Operation Id - /// AllowedConnections_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// The type of allowed connections (Internal, External). - /// The cancellation token to use. - public virtual async Task> GetAllowedConnectionAsync(AzureLocation ascLocation, SecurityCenterConnectionType connectionType, CancellationToken cancellationToken = default) - { - using var scope = AllowedConnectionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllowedConnection"); - scope.Start(); - try - { - var response = await AllowedConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, connectionType, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the list of all possible traffic between resources for the subscription and location, based on connection type. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType} - /// - /// - /// Operation Id - /// AllowedConnections_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// The type of allowed connections (Internal, External). - /// The cancellation token to use. - public virtual Response GetAllowedConnection(AzureLocation ascLocation, SecurityCenterConnectionType connectionType, CancellationToken cancellationToken = default) - { - using var scope = AllowedConnectionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllowedConnection"); - scope.Start(); - try - { - var response = AllowedConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, connectionType, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a specific topology component. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName} - /// - /// - /// Operation Id - /// Topology_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// Name of a topology resources collection. - /// The cancellation token to use. - public virtual async Task> GetTopologyAsync(AzureLocation ascLocation, string topologyResourceName, CancellationToken cancellationToken = default) - { - using var scope = TopologyClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetTopology"); - scope.Start(); - try - { - var response = await TopologyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, topologyResourceName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a specific topology component. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName} - /// - /// - /// Operation Id - /// Topology_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// Name of a topology resources collection. - /// The cancellation token to use. - public virtual Response GetTopology(AzureLocation ascLocation, string topologyResourceName, CancellationToken cancellationToken = default) - { - using var scope = TopologyClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetTopology"); - scope.Start(); - try - { - var response = TopologyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, topologyResourceName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the subscription, location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies - /// - /// - /// Operation Id - /// JitNetworkAccessPolicies_ListByResourceGroup - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetJitNetworkAccessPoliciesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => JitNetworkAccessPolicyRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => JitNetworkAccessPolicyRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new JitNetworkAccessPolicyResource(Client, JitNetworkAccessPolicyData.DeserializeJitNetworkAccessPolicyData(e)), JitNetworkAccessPolicyClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetJitNetworkAccessPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the subscription, location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies - /// - /// - /// Operation Id - /// JitNetworkAccessPolicies_ListByResourceGroup - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetJitNetworkAccessPolicies(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => JitNetworkAccessPolicyRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => JitNetworkAccessPolicyRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new JitNetworkAccessPolicyResource(Client, JitNetworkAccessPolicyData.DeserializeJitNetworkAccessPolicyData(e)), JitNetworkAccessPolicyClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetJitNetworkAccessPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a specific discovered Security Solution. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName} - /// - /// - /// Operation Id - /// DiscoveredSecuritySolutions_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// Name of a discovered security solution. - /// The cancellation token to use. - public virtual async Task> GetDiscoveredSecuritySolutionAsync(AzureLocation ascLocation, string discoveredSecuritySolutionName, CancellationToken cancellationToken = default) - { - using var scope = DiscoveredSecuritySolutionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetDiscoveredSecuritySolution"); - scope.Start(); - try - { - var response = await DiscoveredSecuritySolutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, discoveredSecuritySolutionName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a specific discovered Security Solution. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName} - /// - /// - /// Operation Id - /// DiscoveredSecuritySolutions_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// Name of a discovered security solution. - /// The cancellation token to use. - public virtual Response GetDiscoveredSecuritySolution(AzureLocation ascLocation, string discoveredSecuritySolutionName, CancellationToken cancellationToken = default) - { - using var scope = DiscoveredSecuritySolutionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetDiscoveredSecuritySolution"); - scope.Start(); - try - { - var response = DiscoveredSecuritySolutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, discoveredSecuritySolutionName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a specific external Security Solution. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName} - /// - /// - /// Operation Id - /// ExternalSecuritySolutions_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// Name of an external security solution. - /// The cancellation token to use. - public virtual async Task> GetExternalSecuritySolutionAsync(AzureLocation ascLocation, string externalSecuritySolutionsName, CancellationToken cancellationToken = default) - { - using var scope = ExternalSecuritySolutionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetExternalSecuritySolution"); - scope.Start(); - try - { - var response = await ExternalSecuritySolutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, externalSecuritySolutionsName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a specific external Security Solution. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName} - /// - /// - /// Operation Id - /// ExternalSecuritySolutions_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// Name of an external security solution. - /// The cancellation token to use. - public virtual Response GetExternalSecuritySolution(AzureLocation ascLocation, string externalSecuritySolutionsName, CancellationToken cancellationToken = default) - { - using var scope = ExternalSecuritySolutionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetExternalSecuritySolution"); - scope.Start(); - try - { - var response = ExternalSecuritySolutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, externalSecuritySolutionsName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a specific Security Solution. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName} - /// - /// - /// Operation Id - /// SecuritySolutions_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// Name of security solution. - /// The cancellation token to use. - public virtual async Task> GetSecuritySolutionAsync(AzureLocation ascLocation, string securitySolutionName, CancellationToken cancellationToken = default) - { - using var scope = SecuritySolutionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetSecuritySolution"); - scope.Start(); - try - { - var response = await SecuritySolutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, securitySolutionName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a specific Security Solution. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName} - /// - /// - /// Operation Id - /// SecuritySolutions_Get - /// - /// - /// - /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. - /// Name of security solution. - /// The cancellation token to use. - public virtual Response GetSecuritySolution(AzureLocation ascLocation, string securitySolutionName, CancellationToken cancellationToken = default) - { - using var scope = SecuritySolutionsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetSecuritySolution"); - scope.Start(); - try - { - var response = SecuritySolutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ascLocation, securitySolutionName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts - /// - /// - /// Operation Id - /// Alerts_ListByResourceGroup - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAlertsByResourceGroupAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AlertsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityAlertData.DeserializeSecurityAlertData, AlertsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAlertsByResourceGroup", "value", "nextLink", cancellationToken); - } - - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts - /// - /// - /// Operation Id - /// Alerts_ListByResourceGroup - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAlertsByResourceGroup(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AlertsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityAlertData.DeserializeSecurityAlertData, AlertsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetAlertsByResourceGroup", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SecurityCenterExtensions.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SecurityCenterExtensions.cs index 5b462fa6c1bae..4568b0b382e6f 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SecurityCenterExtensions.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SecurityCenterExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.SecurityCenter.Mocking; using Azure.ResourceManager.SecurityCenter.Models; namespace Azure.ResourceManager.SecurityCenter @@ -19,1517 +20,1480 @@ namespace Azure.ResourceManager.SecurityCenter /// A class to add extension methods to Azure.ResourceManager.SecurityCenter. public static partial class SecurityCenterExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableSecurityCenterArmClient GetMockableSecurityCenterArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSecurityCenterArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSecurityCenterResourceGroupResource GetMockableSecurityCenterResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSecurityCenterResourceGroupResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSecurityCenterSubscriptionResource GetMockableSecurityCenterSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSecurityCenterSubscriptionResource(client, resource.Id)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSecurityCenterTenantResource GetMockableSecurityCenterTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSecurityCenterTenantResource(client, resource.Id)); } - 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); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region CustomAssessmentAutomationResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CustomAssessmentAutomationResource GetCustomAssessmentAutomationResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - CustomAssessmentAutomationResource.ValidateResourceId(id); - return new CustomAssessmentAutomationResource(client, id); - } - ); - } - #endregion - - #region CustomEntityStoreAssignmentResource - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of ComplianceResultResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static CustomEntityStoreAssignmentResource GetCustomEntityStoreAssignmentResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// An object representing collection of ComplianceResultResources and their operations over a ComplianceResultResource. + public static ComplianceResultCollection GetComplianceResults(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - CustomEntityStoreAssignmentResource.ValidateResourceId(id); - return new CustomEntityStoreAssignmentResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetComplianceResults(scope); } - #endregion - #region ComplianceResultResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Security Compliance Result + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName} + /// + /// + /// Operation Id + /// ComplianceResults_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ComplianceResultResource GetComplianceResultResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// name of the desired assessment compliance result. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetComplianceResultAsync(this ArmClient client, ResourceIdentifier scope, string complianceResultName, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - ComplianceResultResource.ValidateResourceId(id); - return new ComplianceResultResource(client, id); - } - ); + return await GetMockableSecurityCenterArmClient(client).GetComplianceResultAsync(scope, complianceResultName, cancellationToken).ConfigureAwait(false); } - #endregion - #region SecurityCenterPricingResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Security Compliance Result + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName} + /// + /// + /// Operation Id + /// ComplianceResults_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityCenterPricingResource GetSecurityCenterPricingResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// name of the desired assessment compliance result. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetComplianceResult(this ArmClient client, ResourceIdentifier scope, string complianceResultName, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SecurityCenterPricingResource.ValidateResourceId(id); - return new SecurityCenterPricingResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetComplianceResult(scope, complianceResultName, cancellationToken); } - #endregion - #region AdvancedThreatProtectionSettingResource /// - /// 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. + /// Gets an object representing a AdvancedThreatProtectionSettingResource along with the instance operations that can be performed on it in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. + /// The scope that the resource will apply against. /// Returns a object. - public static AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSettingResource(this ArmClient client, ResourceIdentifier id) + public static AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSetting(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - AdvancedThreatProtectionSettingResource.ValidateResourceId(id); - return new AdvancedThreatProtectionSettingResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetAdvancedThreatProtectionSetting(scope); } - #endregion - #region DeviceSecurityGroupResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of DeviceSecurityGroupResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static DeviceSecurityGroupResource GetDeviceSecurityGroupResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// An object representing collection of DeviceSecurityGroupResources and their operations over a DeviceSecurityGroupResource. + public static DeviceSecurityGroupCollection GetDeviceSecurityGroups(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - DeviceSecurityGroupResource.ValidateResourceId(id); - return new DeviceSecurityGroupResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetDeviceSecurityGroups(scope); } - #endregion - #region IotSecuritySolutionResource /// - /// 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. + /// Use this method to get the device security group for the specified IoT Hub resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName} + /// + /// + /// Operation Id + /// DeviceSecurityGroups_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static IotSecuritySolutionResource GetIotSecuritySolutionResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The name of the device security group. Note that the name of the device security group is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDeviceSecurityGroupAsync(this ArmClient client, ResourceIdentifier scope, string deviceSecurityGroupName, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - IotSecuritySolutionResource.ValidateResourceId(id); - return new IotSecuritySolutionResource(client, id); - } - ); + return await GetMockableSecurityCenterArmClient(client).GetDeviceSecurityGroupAsync(scope, deviceSecurityGroupName, cancellationToken).ConfigureAwait(false); } - #endregion - #region IotSecuritySolutionAnalyticsModelResource /// - /// 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. + /// Use this method to get the device security group for the specified IoT Hub resource. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName} + /// + /// + /// Operation Id + /// DeviceSecurityGroups_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static IotSecuritySolutionAnalyticsModelResource GetIotSecuritySolutionAnalyticsModelResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The name of the device security group. Note that the name of the device security group is case insensitive. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDeviceSecurityGroup(this ArmClient client, ResourceIdentifier scope, string deviceSecurityGroupName, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - IotSecuritySolutionAnalyticsModelResource.ValidateResourceId(id); - return new IotSecuritySolutionAnalyticsModelResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetDeviceSecurityGroup(scope, deviceSecurityGroupName, cancellationToken); } - #endregion - #region IotSecurityAggregatedAlertResource /// - /// 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. + /// Gets a collection of SecurityComplianceResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static IotSecurityAggregatedAlertResource GetIotSecurityAggregatedAlertResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// An object representing collection of SecurityComplianceResources and their operations over a SecurityComplianceResource. + public static SecurityComplianceCollection GetSecurityCompliances(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - IotSecurityAggregatedAlertResource.ValidateResourceId(id); - return new IotSecurityAggregatedAlertResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityCompliances(scope); } - #endregion - #region IotSecurityAggregatedRecommendationResource /// - /// 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. + /// Details of a specific Compliance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/compliances/{complianceName} + /// + /// + /// Operation Id + /// Compliances_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static IotSecurityAggregatedRecommendationResource GetIotSecurityAggregatedRecommendationResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// name of the Compliance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSecurityComplianceAsync(this ArmClient client, ResourceIdentifier scope, string complianceName, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - IotSecurityAggregatedRecommendationResource.ValidateResourceId(id); - return new IotSecurityAggregatedRecommendationResource(client, id); - } - ); + return await GetMockableSecurityCenterArmClient(client).GetSecurityComplianceAsync(scope, complianceName, cancellationToken).ConfigureAwait(false); } - #endregion - #region SecurityCenterLocationResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Details of a specific Compliance. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/compliances/{complianceName} + /// + /// + /// Operation Id + /// Compliances_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityCenterLocationResource GetSecurityCenterLocationResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// name of the Compliance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSecurityCompliance(this ArmClient client, ResourceIdentifier scope, string complianceName, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SecurityCenterLocationResource.ValidateResourceId(id); - return new SecurityCenterLocationResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityCompliance(scope, complianceName, cancellationToken); } - #endregion - #region SubscriptionSecurityTaskResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of SecurityAssessmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionSecurityTaskResource GetSubscriptionSecurityTaskResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// An object representing collection of SecurityAssessmentResources and their operations over a SecurityAssessmentResource. + public static SecurityAssessmentCollection GetSecurityAssessments(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - SubscriptionSecurityTaskResource.ValidateResourceId(id); - return new SubscriptionSecurityTaskResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityAssessments(scope); } - #endregion - #region ResourceGroupSecurityTaskResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Get a security assessment on your scanned resource + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/assessments/{assessmentName} + /// + /// + /// Operation Id + /// Assessments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceGroupSecurityTaskResource GetResourceGroupSecurityTaskResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The Assessment Key - Unique key for the assessment type. + /// OData expand. Optional. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSecurityAssessmentAsync(this ArmClient client, ResourceIdentifier scope, string assessmentName, SecurityAssessmentODataExpand? expand = null, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - ResourceGroupSecurityTaskResource.ValidateResourceId(id); - return new ResourceGroupSecurityTaskResource(client, id); - } - ); + return await GetMockableSecurityCenterArmClient(client).GetSecurityAssessmentAsync(scope, assessmentName, expand, cancellationToken).ConfigureAwait(false); } - #endregion - #region AutoProvisioningSettingResource /// - /// 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. + /// Get a security assessment on your scanned resource + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/assessments/{assessmentName} + /// + /// + /// Operation Id + /// Assessments_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static AutoProvisioningSettingResource GetAutoProvisioningSettingResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The Assessment Key - Unique key for the assessment type. + /// OData expand. Optional. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSecurityAssessment(this ArmClient client, ResourceIdentifier scope, string assessmentName, SecurityAssessmentODataExpand? expand = null, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - AutoProvisioningSettingResource.ValidateResourceId(id); - return new AutoProvisioningSettingResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityAssessment(scope, assessmentName, expand, cancellationToken); } - #endregion - #region SecurityComplianceResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of GovernanceRuleResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityComplianceResource GetSecurityComplianceResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// An object representing collection of GovernanceRuleResources and their operations over a GovernanceRuleResource. + public static GovernanceRuleCollection GetGovernanceRules(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - SecurityComplianceResource.ValidateResourceId(id); - return new SecurityComplianceResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetGovernanceRules(scope); } - #endregion - #region SecurityContactResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Get a specific governance rule for the requested scope by ruleId + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/governanceRules/{ruleId} + /// + /// + /// Operation Id + /// GovernanceRules_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityContactResource GetSecurityContactResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The governance rule key - unique key for the standard governance rule (GUID). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetGovernanceRuleAsync(this ArmClient client, ResourceIdentifier scope, string ruleId, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SecurityContactResource.ValidateResourceId(id); - return new SecurityContactResource(client, id); - } - ); + return await GetMockableSecurityCenterArmClient(client).GetGovernanceRuleAsync(scope, ruleId, cancellationToken).ConfigureAwait(false); } - #endregion - #region SecurityWorkspaceSettingResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Get a specific governance rule for the requested scope by ruleId + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/governanceRules/{ruleId} + /// + /// + /// Operation Id + /// GovernanceRules_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityWorkspaceSettingResource GetSecurityWorkspaceSettingResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The governance rule key - unique key for the standard governance rule (GUID). + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetGovernanceRule(this ArmClient client, ResourceIdentifier scope, string ruleId, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SecurityWorkspaceSettingResource.ValidateResourceId(id); - return new SecurityWorkspaceSettingResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetGovernanceRule(scope, ruleId, cancellationToken); } - #endregion - #region RegulatoryComplianceStandardResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of SqlVulnerabilityAssessmentScanResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static RegulatoryComplianceStandardResource GetRegulatoryComplianceStandardResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// An object representing collection of SqlVulnerabilityAssessmentScanResources and their operations over a SqlVulnerabilityAssessmentScanResource. + public static SqlVulnerabilityAssessmentScanCollection GetSqlVulnerabilityAssessmentScans(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - RegulatoryComplianceStandardResource.ValidateResourceId(id); - return new RegulatoryComplianceStandardResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSqlVulnerabilityAssessmentScans(scope); } - #endregion - #region RegulatoryComplianceControlResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets the scan details of a single scan record. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static RegulatoryComplianceControlResource GetRegulatoryComplianceControlResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The scan Id. Type 'latest' to get the scan record for the latest scan. + /// The workspace Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSqlVulnerabilityAssessmentScanAsync(this ArmClient client, ResourceIdentifier scope, string scanId, Guid workspaceId, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - RegulatoryComplianceControlResource.ValidateResourceId(id); - return new RegulatoryComplianceControlResource(client, id); - } - ); + return await GetMockableSecurityCenterArmClient(client).GetSqlVulnerabilityAssessmentScanAsync(scope, scanId, workspaceId, cancellationToken).ConfigureAwait(false); } - #endregion - #region RegulatoryComplianceAssessmentResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets the scan details of a single scan record. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentScans_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static RegulatoryComplianceAssessmentResource GetRegulatoryComplianceAssessmentResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The scan Id. Type 'latest' to get the scan record for the latest scan. + /// The workspace Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSqlVulnerabilityAssessmentScan(this ArmClient client, ResourceIdentifier scope, string scanId, Guid workspaceId, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - RegulatoryComplianceAssessmentResource.ValidateResourceId(id); - return new RegulatoryComplianceAssessmentResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSqlVulnerabilityAssessmentScan(scope, scanId, workspaceId, cancellationToken); } - #endregion - #region SecuritySubAssessmentResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of SqlVulnerabilityAssessmentBaselineRuleResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecuritySubAssessmentResource GetSecuritySubAssessmentResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// An object representing collection of SqlVulnerabilityAssessmentBaselineRuleResources and their operations over a SqlVulnerabilityAssessmentBaselineRuleResource. + public static SqlVulnerabilityAssessmentBaselineRuleCollection GetSqlVulnerabilityAssessmentBaselineRules(this ArmClient client, ResourceIdentifier scope) { - return client.GetResourceClient(() => - { - SecuritySubAssessmentResource.ValidateResourceId(id); - return new SecuritySubAssessmentResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSqlVulnerabilityAssessmentBaselineRules(scope); } - #endregion - #region SecurityAutomationResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets the results for a given rule in the Baseline. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentBaselineRules_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityAutomationResource GetSecurityAutomationResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The rule Id. + /// The workspace Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSqlVulnerabilityAssessmentBaselineRuleAsync(this ArmClient client, ResourceIdentifier scope, string ruleId, Guid workspaceId, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SecurityAutomationResource.ValidateResourceId(id); - return new SecurityAutomationResource(client, id); - } - ); + return await GetMockableSecurityCenterArmClient(client).GetSqlVulnerabilityAssessmentBaselineRuleAsync(scope, ruleId, workspaceId, cancellationToken).ConfigureAwait(false); } - #endregion - #region SecurityAlertsSuppressionRuleResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets the results for a given rule in the Baseline. + /// + /// + /// Request Path + /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId} + /// + /// + /// Operation Id + /// SqlVulnerabilityAssessmentBaselineRules_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityAlertsSuppressionRuleResource GetSecurityAlertsSuppressionRuleResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The rule Id. + /// The workspace Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSqlVulnerabilityAssessmentBaselineRule(this ArmClient client, ResourceIdentifier scope, string ruleId, Guid workspaceId, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SecurityAlertsSuppressionRuleResource.ValidateResourceId(id); - return new SecurityAlertsSuppressionRuleResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSqlVulnerabilityAssessmentBaselineRule(scope, ruleId, workspaceId, cancellationToken); } - #endregion - #region ServerVulnerabilityAssessmentResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Details of the information protection policy. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName} + /// + /// + /// Operation Id + /// InformationProtectionPolicies_CreateOrUpdate + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ServerVulnerabilityAssessmentResource GetServerVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// Name of the information protection policy. + /// Information protection policy. + /// The cancellation token to use. + /// is null. + public static async Task> CreateOrUpdateInformationProtectionPolicyAsync(this ArmClient client, ResourceIdentifier scope, InformationProtectionPolicyName informationProtectionPolicyName, InformationProtectionPolicy informationProtectionPolicy, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - ServerVulnerabilityAssessmentResource.ValidateResourceId(id); - return new ServerVulnerabilityAssessmentResource(client, id); - } - ); + return await GetMockableSecurityCenterArmClient(client).CreateOrUpdateInformationProtectionPolicyAsync(scope, informationProtectionPolicyName, informationProtectionPolicy, cancellationToken).ConfigureAwait(false); } - #endregion - #region TenantAssessmentMetadataResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Details of the information protection policy. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName} + /// + /// + /// Operation Id + /// InformationProtectionPolicies_CreateOrUpdate + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static TenantAssessmentMetadataResource GetTenantAssessmentMetadataResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// Name of the information protection policy. + /// Information protection policy. + /// The cancellation token to use. + /// is null. + public static Response CreateOrUpdateInformationProtectionPolicy(this ArmClient client, ResourceIdentifier scope, InformationProtectionPolicyName informationProtectionPolicyName, InformationProtectionPolicy informationProtectionPolicy, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - TenantAssessmentMetadataResource.ValidateResourceId(id); - return new TenantAssessmentMetadataResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).CreateOrUpdateInformationProtectionPolicy(scope, informationProtectionPolicyName, informationProtectionPolicy, cancellationToken); } - #endregion - #region SubscriptionAssessmentMetadataResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Information protection policies of a specific management group. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies + /// + /// + /// Operation Id + /// InformationProtectionPolicies_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionAssessmentMetadataResource GetSubscriptionAssessmentMetadataResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The cancellation token to use. + public static AsyncPageable GetInformationProtectionPoliciesAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SubscriptionAssessmentMetadataResource.ValidateResourceId(id); - return new SubscriptionAssessmentMetadataResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetInformationProtectionPoliciesAsync(scope, cancellationToken); } - #endregion - #region SecurityAssessmentResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Information protection policies of a specific management group. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies + /// + /// + /// Operation Id + /// InformationProtectionPolicies_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityAssessmentResource GetSecurityAssessmentResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The cancellation token to use. + public static Pageable GetInformationProtectionPolicies(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SecurityAssessmentResource.ValidateResourceId(id); - return new SecurityAssessmentResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetInformationProtectionPolicies(scope, cancellationToken); } - #endregion - #region AdaptiveApplicationControlGroupResource /// - /// 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. + /// Get security sub-assessments on all your scanned resources inside a subscription scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/subAssessments + /// + /// + /// Operation Id + /// SubAssessments_ListAll + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static AdaptiveApplicationControlGroupResource GetAdaptiveApplicationControlGroupResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The cancellation token to use. + public static AsyncPageable GetSecuritySubAssessmentsAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - AdaptiveApplicationControlGroupResource.ValidateResourceId(id); - return new AdaptiveApplicationControlGroupResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecuritySubAssessmentsAsync(scope, cancellationToken); } - #endregion - #region AdaptiveNetworkHardeningResource /// - /// 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. + /// Get security sub-assessments on all your scanned resources inside a subscription scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/subAssessments + /// + /// + /// Operation Id + /// SubAssessments_ListAll + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static AdaptiveNetworkHardeningResource GetAdaptiveNetworkHardeningResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The cancellation token to use. + public static Pageable GetSecuritySubAssessments(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - AdaptiveNetworkHardeningResource.ValidateResourceId(id); - return new AdaptiveNetworkHardeningResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecuritySubAssessments(scope, cancellationToken); } - #endregion - #region JitNetworkAccessPolicyResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Get security assessments on all your scanned resources inside a scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/assessments + /// + /// + /// Operation Id + /// Assessments_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static JitNetworkAccessPolicyResource GetJitNetworkAccessPolicyResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The cancellation token to use. + public static AsyncPageable GetSecurityAssessmentsAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - JitNetworkAccessPolicyResource.ValidateResourceId(id); - return new JitNetworkAccessPolicyResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityAssessmentsAsync(scope, cancellationToken); } - #endregion - #region SecureScoreResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Get security assessments on all your scanned resources inside a scope + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Security/assessments + /// + /// + /// Operation Id + /// Assessments_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SecureScoreResource GetSecureScoreResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// The cancellation token to use. + public static Pageable GetSecurityAssessments(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) { - return client.GetResourceClient(() => - { - SecureScoreResource.ValidateResourceId(id); - return new SecureScoreResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityAssessments(scope, cancellationToken); } - #endregion - #region SecurityCloudConnectorResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityCloudConnectorResource GetSecurityCloudConnectorResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static CustomAssessmentAutomationResource GetCustomAssessmentAutomationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityCloudConnectorResource.ValidateResourceId(id); - return new SecurityCloudConnectorResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetCustomAssessmentAutomationResource(id); } - #endregion - #region SubscriptionSecurityAlertResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionSecurityAlertResource GetSubscriptionSecurityAlertResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static CustomEntityStoreAssignmentResource GetCustomEntityStoreAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionSecurityAlertResource.ValidateResourceId(id); - return new SubscriptionSecurityAlertResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetCustomEntityStoreAssignmentResource(id); } - #endregion - #region ResourceGroupSecurityAlertResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static ResourceGroupSecurityAlertResource GetResourceGroupSecurityAlertResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ComplianceResultResource GetComplianceResultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceGroupSecurityAlertResource.ValidateResourceId(id); - return new ResourceGroupSecurityAlertResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetComplianceResultResource(id); } - #endregion - #region SecuritySettingResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SecuritySettingResource GetSecuritySettingResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static SecurityCenterPricingResource GetSecurityCenterPricingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecuritySettingResource.ValidateResourceId(id); - return new SecuritySettingResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityCenterPricingResource(id); } - #endregion - #region IngestionSettingResource /// - /// 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. + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static IngestionSettingResource GetIngestionSettingResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IngestionSettingResource.ValidateResourceId(id); - return new IngestionSettingResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetAdvancedThreatProtectionSettingResource(id); } - #endregion - #region SoftwareInventoryResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SoftwareInventoryResource GetSoftwareInventoryResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static DeviceSecurityGroupResource GetDeviceSecurityGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SoftwareInventoryResource.ValidateResourceId(id); - return new SoftwareInventoryResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetDeviceSecurityGroupResource(id); } - #endregion - #region SecurityConnectorResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityConnectorResource GetSecurityConnectorResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static IotSecuritySolutionResource GetIotSecuritySolutionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityConnectorResource.ValidateResourceId(id); - return new SecurityConnectorResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetIotSecuritySolutionResource(id); } - #endregion - #region GovernanceRuleResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static GovernanceRuleResource GetGovernanceRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static IotSecuritySolutionAnalyticsModelResource GetIotSecuritySolutionAnalyticsModelResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GovernanceRuleResource.ValidateResourceId(id); - return new GovernanceRuleResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetIotSecuritySolutionAnalyticsModelResource(id); } - #endregion - #region GovernanceAssignmentResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static GovernanceAssignmentResource GetGovernanceAssignmentResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static IotSecurityAggregatedAlertResource GetIotSecurityAggregatedAlertResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GovernanceAssignmentResource.ValidateResourceId(id); - return new GovernanceAssignmentResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetIotSecurityAggregatedAlertResource(id); } - #endregion - #region SubscriptionSecurityApplicationResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SubscriptionSecurityApplicationResource GetSubscriptionSecurityApplicationResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static IotSecurityAggregatedRecommendationResource GetIotSecurityAggregatedRecommendationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionSecurityApplicationResource.ValidateResourceId(id); - return new SubscriptionSecurityApplicationResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetIotSecurityAggregatedRecommendationResource(id); } - #endregion - #region SecurityConnectorApplicationResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SecurityConnectorApplicationResource GetSecurityConnectorApplicationResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static SecurityCenterLocationResource GetSecurityCenterLocationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityConnectorApplicationResource.ValidateResourceId(id); - return new SecurityConnectorApplicationResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSecurityCenterLocationResource(id); } - #endregion - #region SqlVulnerabilityAssessmentScanResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SqlVulnerabilityAssessmentScanResource GetSqlVulnerabilityAssessmentScanResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static SubscriptionSecurityTaskResource GetSubscriptionSecurityTaskResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlVulnerabilityAssessmentScanResource.ValidateResourceId(id); - return new SqlVulnerabilityAssessmentScanResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetSubscriptionSecurityTaskResource(id); } - #endregion - #region SqlVulnerabilityAssessmentBaselineRuleResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static SqlVulnerabilityAssessmentBaselineRuleResource GetSqlVulnerabilityAssessmentBaselineRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ResourceGroupSecurityTaskResource GetResourceGroupSecurityTaskResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlVulnerabilityAssessmentBaselineRuleResource.ValidateResourceId(id); - return new SqlVulnerabilityAssessmentBaselineRuleResource(client, id); - } - ); + return GetMockableSecurityCenterArmClient(client).GetResourceGroupSecurityTaskResource(id); } - #endregion - /// Gets a collection of ComplianceResultResources in the ArmResource. + /// + /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of ComplianceResultResources and their operations over a ComplianceResultResource. - public static ComplianceResultCollection GetComplianceResults(this ArmClient client, ResourceIdentifier scope) + /// The resource ID of the resource to get. + /// Returns a object. + public static AutoProvisioningSettingResource GetAutoProvisioningSettingResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetComplianceResults(); + return GetMockableSecurityCenterArmClient(client).GetAutoProvisioningSettingResource(id); } /// - /// Security Compliance Result - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// ComplianceResults_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// name of the desired assessment compliance result. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetComplianceResultAsync(this ArmClient client, ResourceIdentifier scope, string complianceResultName, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityComplianceResource GetSecurityComplianceResource(this ArmClient client, ResourceIdentifier id) { - return await client.GetComplianceResults(scope).GetAsync(complianceResultName, cancellationToken).ConfigureAwait(false); + return GetMockableSecurityCenterArmClient(client).GetSecurityComplianceResource(id); } /// - /// Security Compliance Result - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// ComplianceResults_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// name of the desired assessment compliance result. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetComplianceResult(this ArmClient client, ResourceIdentifier scope, string complianceResultName, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityContactResource GetSecurityContactResource(this ArmClient client, ResourceIdentifier id) { - return client.GetComplianceResults(scope).Get(complianceResultName, cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSecurityContactResource(id); } - /// Gets an object representing a AdvancedThreatProtectionSettingResource along with the instance operations that can be performed on it in the ArmResource. + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// Returns a object. - public static AdvancedThreatProtectionSettingResource GetAdvancedThreatProtectionSetting(this ArmClient client, ResourceIdentifier scope) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityWorkspaceSettingResource GetSecurityWorkspaceSettingResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetAdvancedThreatProtectionSetting(); + return GetMockableSecurityCenterArmClient(client).GetSecurityWorkspaceSettingResource(id); } - /// Gets a collection of DeviceSecurityGroupResources in the ArmResource. + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of DeviceSecurityGroupResources and their operations over a DeviceSecurityGroupResource. - public static DeviceSecurityGroupCollection GetDeviceSecurityGroups(this ArmClient client, ResourceIdentifier scope) + /// The resource ID of the resource to get. + /// Returns a object. + public static RegulatoryComplianceStandardResource GetRegulatoryComplianceStandardResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetDeviceSecurityGroups(); + return GetMockableSecurityCenterArmClient(client).GetRegulatoryComplianceStandardResource(id); } /// - /// Use this method to get the device security group for the specified IoT Hub resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// DeviceSecurityGroups_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name of the device security group. Note that the name of the device security group is case insensitive. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetDeviceSecurityGroupAsync(this ArmClient client, ResourceIdentifier scope, string deviceSecurityGroupName, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static RegulatoryComplianceControlResource GetRegulatoryComplianceControlResource(this ArmClient client, ResourceIdentifier id) { - return await client.GetDeviceSecurityGroups(scope).GetAsync(deviceSecurityGroupName, cancellationToken).ConfigureAwait(false); + return GetMockableSecurityCenterArmClient(client).GetRegulatoryComplianceControlResource(id); } /// - /// Use this method to get the device security group for the specified IoT Hub resource. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// DeviceSecurityGroups_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The name of the device security group. Note that the name of the device security group is case insensitive. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetDeviceSecurityGroup(this ArmClient client, ResourceIdentifier scope, string deviceSecurityGroupName, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static RegulatoryComplianceAssessmentResource GetRegulatoryComplianceAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetDeviceSecurityGroups(scope).Get(deviceSecurityGroupName, cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetRegulatoryComplianceAssessmentResource(id); } - /// Gets a collection of SecurityComplianceResources in the ArmResource. + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of SecurityComplianceResources and their operations over a SecurityComplianceResource. - public static SecurityComplianceCollection GetSecurityCompliances(this ArmClient client, ResourceIdentifier scope) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecuritySubAssessmentResource GetSecuritySubAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetSecurityCompliances(); + return GetMockableSecurityCenterArmClient(client).GetSecuritySubAssessmentResource(id); } /// - /// Details of a specific Compliance. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/compliances/{complianceName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// Compliances_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// name of the Compliance. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetSecurityComplianceAsync(this ArmClient client, ResourceIdentifier scope, string complianceName, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityAutomationResource GetSecurityAutomationResource(this ArmClient client, ResourceIdentifier id) { - return await client.GetSecurityCompliances(scope).GetAsync(complianceName, cancellationToken).ConfigureAwait(false); + return GetMockableSecurityCenterArmClient(client).GetSecurityAutomationResource(id); } /// - /// Details of a specific Compliance. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/compliances/{complianceName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// Compliances_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// name of the Compliance. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetSecurityCompliance(this ArmClient client, ResourceIdentifier scope, string complianceName, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityAlertsSuppressionRuleResource GetSecurityAlertsSuppressionRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetSecurityCompliances(scope).Get(complianceName, cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSecurityAlertsSuppressionRuleResource(id); } - /// Gets a collection of SecurityAssessmentResources in the ArmResource. + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of SecurityAssessmentResources and their operations over a SecurityAssessmentResource. - public static SecurityAssessmentCollection GetSecurityAssessments(this ArmClient client, ResourceIdentifier scope) + /// The resource ID of the resource to get. + /// Returns a object. + public static ServerVulnerabilityAssessmentResource GetServerVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetSecurityAssessments(); + return GetMockableSecurityCenterArmClient(client).GetServerVulnerabilityAssessmentResource(id); } /// - /// Get a security assessment on your scanned resource - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/assessments/{assessmentName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// Assessments_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The Assessment Key - Unique key for the assessment type. - /// OData expand. Optional. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetSecurityAssessmentAsync(this ArmClient client, ResourceIdentifier scope, string assessmentName, SecurityAssessmentODataExpand? expand = null, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static TenantAssessmentMetadataResource GetTenantAssessmentMetadataResource(this ArmClient client, ResourceIdentifier id) { - return await client.GetSecurityAssessments(scope).GetAsync(assessmentName, expand, cancellationToken).ConfigureAwait(false); + return GetMockableSecurityCenterArmClient(client).GetTenantAssessmentMetadataResource(id); } /// - /// Get a security assessment on your scanned resource - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/assessments/{assessmentName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// Assessments_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The Assessment Key - Unique key for the assessment type. - /// OData expand. Optional. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetSecurityAssessment(this ArmClient client, ResourceIdentifier scope, string assessmentName, SecurityAssessmentODataExpand? expand = null, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionAssessmentMetadataResource GetSubscriptionAssessmentMetadataResource(this ArmClient client, ResourceIdentifier id) { - return client.GetSecurityAssessments(scope).Get(assessmentName, expand, cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSubscriptionAssessmentMetadataResource(id); } - /// Gets a collection of GovernanceRuleResources in the ArmResource. + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of GovernanceRuleResources and their operations over a GovernanceRuleResource. - public static GovernanceRuleCollection GetGovernanceRules(this ArmClient client, ResourceIdentifier scope) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityAssessmentResource GetSecurityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetGovernanceRules(); + return GetMockableSecurityCenterArmClient(client).GetSecurityAssessmentResource(id); } /// - /// Get a specific governance rule for the requested scope by ruleId - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/governanceRules/{ruleId} - /// + /// 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. /// - /// Operation Id - /// GovernanceRules_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The governance rule key - unique key for the standard governance rule (GUID). - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetGovernanceRuleAsync(this ArmClient client, ResourceIdentifier scope, string ruleId, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static AdaptiveApplicationControlGroupResource GetAdaptiveApplicationControlGroupResource(this ArmClient client, ResourceIdentifier id) { - return await client.GetGovernanceRules(scope).GetAsync(ruleId, cancellationToken).ConfigureAwait(false); + return GetMockableSecurityCenterArmClient(client).GetAdaptiveApplicationControlGroupResource(id); } /// - /// Get a specific governance rule for the requested scope by ruleId - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/governanceRules/{ruleId} - /// + /// 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. /// - /// Operation Id - /// GovernanceRules_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The governance rule key - unique key for the standard governance rule (GUID). - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetGovernanceRule(this ArmClient client, ResourceIdentifier scope, string ruleId, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static AdaptiveNetworkHardeningResource GetAdaptiveNetworkHardeningResource(this ArmClient client, ResourceIdentifier id) { - return client.GetGovernanceRules(scope).Get(ruleId, cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetAdaptiveNetworkHardeningResource(id); } - /// Gets a collection of SqlVulnerabilityAssessmentScanResources in the ArmResource. + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of SqlVulnerabilityAssessmentScanResources and their operations over a SqlVulnerabilityAssessmentScanResource. - public static SqlVulnerabilityAssessmentScanCollection GetSqlVulnerabilityAssessmentScans(this ArmClient client, ResourceIdentifier scope) + /// The resource ID of the resource to get. + /// Returns a object. + public static JitNetworkAccessPolicyResource GetJitNetworkAccessPolicyResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetSqlVulnerabilityAssessmentScans(); + return GetMockableSecurityCenterArmClient(client).GetJitNetworkAccessPolicyResource(id); } /// - /// Gets the scan details of a single scan record. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// SqlVulnerabilityAssessmentScans_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The scan Id. Type 'latest' to get the scan record for the latest scan. - /// The workspace Id. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetSqlVulnerabilityAssessmentScanAsync(this ArmClient client, ResourceIdentifier scope, string scanId, Guid workspaceId, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecureScoreResource GetSecureScoreResource(this ArmClient client, ResourceIdentifier id) { - return await client.GetSqlVulnerabilityAssessmentScans(scope).GetAsync(scanId, workspaceId, cancellationToken).ConfigureAwait(false); + return GetMockableSecurityCenterArmClient(client).GetSecureScoreResource(id); } /// - /// Gets the scan details of a single scan record. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// SqlVulnerabilityAssessmentScans_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The scan Id. Type 'latest' to get the scan record for the latest scan. - /// The workspace Id. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetSqlVulnerabilityAssessmentScan(this ArmClient client, ResourceIdentifier scope, string scanId, Guid workspaceId, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityCloudConnectorResource GetSecurityCloudConnectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetSqlVulnerabilityAssessmentScans(scope).Get(scanId, workspaceId, cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSecurityCloudConnectorResource(id); } - /// Gets a collection of SqlVulnerabilityAssessmentBaselineRuleResources in the ArmResource. + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// An object representing collection of SqlVulnerabilityAssessmentBaselineRuleResources and their operations over a SqlVulnerabilityAssessmentBaselineRuleResource. - public static SqlVulnerabilityAssessmentBaselineRuleCollection GetSqlVulnerabilityAssessmentBaselineRules(this ArmClient client, ResourceIdentifier scope) + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionSecurityAlertResource GetSubscriptionSecurityAlertResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetSqlVulnerabilityAssessmentBaselineRules(); + return GetMockableSecurityCenterArmClient(client).GetSubscriptionSecurityAlertResource(id); } /// - /// Gets the results for a given rule in the Baseline. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// SqlVulnerabilityAssessmentBaselineRules_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The rule Id. - /// The workspace Id. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetSqlVulnerabilityAssessmentBaselineRuleAsync(this ArmClient client, ResourceIdentifier scope, string ruleId, Guid workspaceId, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceGroupSecurityAlertResource GetResourceGroupSecurityAlertResource(this ArmClient client, ResourceIdentifier id) { - return await client.GetSqlVulnerabilityAssessmentBaselineRules(scope).GetAsync(ruleId, workspaceId, cancellationToken).ConfigureAwait(false); + return GetMockableSecurityCenterArmClient(client).GetResourceGroupSecurityAlertResource(id); } /// - /// Gets the results for a given rule in the Baseline. - /// - /// - /// Request Path - /// /{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// SqlVulnerabilityAssessmentBaselineRules_Get + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The rule Id. - /// The workspace Id. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetSqlVulnerabilityAssessmentBaselineRule(this ArmClient client, ResourceIdentifier scope, string ruleId, Guid workspaceId, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecuritySettingResource GetSecuritySettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetSqlVulnerabilityAssessmentBaselineRules(scope).Get(ruleId, workspaceId, cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSecuritySettingResource(id); } /// - /// Details of the information protection policy. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName} - /// + /// 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. /// - /// Operation Id - /// InformationProtectionPolicies_CreateOrUpdate + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// Name of the information protection policy. - /// Information protection policy. - /// The cancellation token to use. - /// is null. - public static async Task> CreateOrUpdateInformationProtectionPolicyAsync(this ArmClient client, ResourceIdentifier scope, InformationProtectionPolicyName informationProtectionPolicyName, InformationProtectionPolicy informationProtectionPolicy, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static IngestionSettingResource GetIngestionSettingResource(this ArmClient client, ResourceIdentifier id) { - Argument.AssertNotNull(informationProtectionPolicy, nameof(informationProtectionPolicy)); - - return await GetArmResourceExtensionClient(client, scope).CreateOrUpdateInformationProtectionPolicyAsync(informationProtectionPolicyName, informationProtectionPolicy, cancellationToken).ConfigureAwait(false); + return GetMockableSecurityCenterArmClient(client).GetIngestionSettingResource(id); } /// - /// Details of the information protection policy. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName} - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// InformationProtectionPolicies_CreateOrUpdate + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// Name of the information protection policy. - /// Information protection policy. - /// The cancellation token to use. - /// is null. - public static Response CreateOrUpdateInformationProtectionPolicy(this ArmClient client, ResourceIdentifier scope, InformationProtectionPolicyName informationProtectionPolicyName, InformationProtectionPolicy informationProtectionPolicy, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SoftwareInventoryResource GetSoftwareInventoryResource(this ArmClient client, ResourceIdentifier id) { - Argument.AssertNotNull(informationProtectionPolicy, nameof(informationProtectionPolicy)); - - return GetArmResourceExtensionClient(client, scope).CreateOrUpdateInformationProtectionPolicy(informationProtectionPolicyName, informationProtectionPolicy, cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSoftwareInventoryResource(id); } /// - /// Information protection policies of a specific management group. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies + /// Mocking + /// To mock this method, please mock instead. /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityConnectorResource GetSecurityConnectorResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableSecurityCenterArmClient(client).GetSecurityConnectorResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// InformationProtectionPolicies_List + /// Mocking + /// To mock this method, please mock instead. /// - /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The cancellation token to use. - public static AsyncPageable GetInformationProtectionPoliciesAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static GovernanceRuleResource GetGovernanceRuleResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetInformationProtectionPoliciesAsync(cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetGovernanceRuleResource(id); } /// - /// Information protection policies of a specific management group. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/informationProtectionPolicies - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// InformationProtectionPolicies_List + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The cancellation token to use. - public static Pageable GetInformationProtectionPolicies(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static GovernanceAssignmentResource GetGovernanceAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetInformationProtectionPolicies(cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetGovernanceAssignmentResource(id); } /// - /// Get security sub-assessments on all your scanned resources inside a subscription scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/subAssessments - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// SubAssessments_ListAll + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The cancellation token to use. - public static AsyncPageable GetSecuritySubAssessmentsAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionSecurityApplicationResource GetSubscriptionSecurityApplicationResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetSecuritySubAssessmentsAsync(cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSubscriptionSecurityApplicationResource(id); } /// - /// Get security sub-assessments on all your scanned resources inside a subscription scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/subAssessments - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// SubAssessments_ListAll + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The cancellation token to use. - public static Pageable GetSecuritySubAssessments(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SecurityConnectorApplicationResource GetSecurityConnectorApplicationResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetSecuritySubAssessments(cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSecurityConnectorApplicationResource(id); } /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/assessments - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// Assessments_List + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The cancellation token to use. - public static AsyncPageable GetSecurityAssessmentsAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SqlVulnerabilityAssessmentScanResource GetSqlVulnerabilityAssessmentScanResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetSecurityAssessmentsAsync(cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSqlVulnerabilityAssessmentScanResource(id); } /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Security/assessments - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// - /// Operation Id - /// Assessments_List + /// Mocking + /// To mock this method, please mock instead. /// - /// /// /// The instance the method will execute against. - /// The scope that the resource will apply against. - /// The cancellation token to use. - public static Pageable GetSecurityAssessments(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) + /// The resource ID of the resource to get. + /// Returns a object. + public static SqlVulnerabilityAssessmentBaselineRuleResource GetSqlVulnerabilityAssessmentBaselineRuleResource(this ArmClient client, ResourceIdentifier id) { - return GetArmResourceExtensionClient(client, scope).GetSecurityAssessments(cancellationToken); + return GetMockableSecurityCenterArmClient(client).GetSqlVulnerabilityAssessmentBaselineRuleResource(id); } - /// Gets a collection of CustomAssessmentAutomationResources in the ResourceGroupResource. + /// + /// Gets a collection of CustomAssessmentAutomationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CustomAssessmentAutomationResources and their operations over a CustomAssessmentAutomationResource. public static CustomAssessmentAutomationCollection GetCustomAssessmentAutomations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCustomAssessmentAutomations(); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetCustomAssessmentAutomations(); } /// @@ -1544,16 +1508,20 @@ public static CustomAssessmentAutomationCollection GetCustomAssessmentAutomation /// CustomAssessmentAutomations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Custom Assessment Automation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCustomAssessmentAutomationAsync(this ResourceGroupResource resourceGroupResource, string customAssessmentAutomationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCustomAssessmentAutomations().GetAsync(customAssessmentAutomationName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetCustomAssessmentAutomationAsync(customAssessmentAutomationName, cancellationToken).ConfigureAwait(false); } /// @@ -1568,24 +1536,34 @@ public static async Task> GetCustom /// CustomAssessmentAutomations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Custom Assessment Automation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCustomAssessmentAutomation(this ResourceGroupResource resourceGroupResource, string customAssessmentAutomationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCustomAssessmentAutomations().Get(customAssessmentAutomationName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetCustomAssessmentAutomation(customAssessmentAutomationName, cancellationToken); } - /// Gets a collection of CustomEntityStoreAssignmentResources in the ResourceGroupResource. + /// + /// Gets a collection of CustomEntityStoreAssignmentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of CustomEntityStoreAssignmentResources and their operations over a CustomEntityStoreAssignmentResource. public static CustomEntityStoreAssignmentCollection GetCustomEntityStoreAssignments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetCustomEntityStoreAssignments(); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetCustomEntityStoreAssignments(); } /// @@ -1600,16 +1578,20 @@ public static CustomEntityStoreAssignmentCollection GetCustomEntityStoreAssignme /// CustomEntityStoreAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the custom entity store assignment. Generated name is GUID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetCustomEntityStoreAssignmentAsync(this ResourceGroupResource resourceGroupResource, string customEntityStoreAssignmentName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetCustomEntityStoreAssignments().GetAsync(customEntityStoreAssignmentName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetCustomEntityStoreAssignmentAsync(customEntityStoreAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -1624,24 +1606,34 @@ public static async Task> GetCusto /// CustomEntityStoreAssignments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the custom entity store assignment. Generated name is GUID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetCustomEntityStoreAssignment(this ResourceGroupResource resourceGroupResource, string customEntityStoreAssignmentName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetCustomEntityStoreAssignments().Get(customEntityStoreAssignmentName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetCustomEntityStoreAssignment(customEntityStoreAssignmentName, cancellationToken); } - /// Gets a collection of IotSecuritySolutionResources in the ResourceGroupResource. + /// + /// Gets a collection of IotSecuritySolutionResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of IotSecuritySolutionResources and their operations over a IotSecuritySolutionResource. public static IotSecuritySolutionCollection GetIotSecuritySolutions(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetIotSecuritySolutions(); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetIotSecuritySolutions(); } /// @@ -1656,16 +1648,20 @@ public static IotSecuritySolutionCollection GetIotSecuritySolutions(this Resourc /// IotSecuritySolution_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the IoT Security solution. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetIotSecuritySolutionAsync(this ResourceGroupResource resourceGroupResource, string solutionName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetIotSecuritySolutions().GetAsync(solutionName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetIotSecuritySolutionAsync(solutionName, cancellationToken).ConfigureAwait(false); } /// @@ -1680,25 +1676,35 @@ public static async Task> GetIotSecuritySo /// IotSecuritySolution_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the IoT Security solution. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetIotSecuritySolution(this ResourceGroupResource resourceGroupResource, string solutionName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetIotSecuritySolutions().Get(solutionName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetIotSecuritySolution(solutionName, cancellationToken); } - /// Gets a collection of ResourceGroupSecurityTaskResources in the ResourceGroupResource. + /// + /// Gets a collection of ResourceGroupSecurityTaskResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// An object representing collection of ResourceGroupSecurityTaskResources and their operations over a ResourceGroupSecurityTaskResource. public static ResourceGroupSecurityTaskCollection GetResourceGroupSecurityTasks(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetResourceGroupSecurityTasks(ascLocation); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetResourceGroupSecurityTasks(ascLocation); } /// @@ -1713,17 +1719,21 @@ public static ResourceGroupSecurityTaskCollection GetResourceGroupSecurityTasks( /// Tasks_GetResourceGroupLevelTask /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// Name of the task object, will be a GUID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceGroupSecurityTaskAsync(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string taskName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetResourceGroupSecurityTasks(ascLocation).GetAsync(taskName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetResourceGroupSecurityTaskAsync(ascLocation, taskName, cancellationToken).ConfigureAwait(false); } /// @@ -1738,25 +1748,35 @@ public static async Task> GetResourc /// Tasks_GetResourceGroupLevelTask /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// Name of the task object, will be a GUID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceGroupSecurityTask(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string taskName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetResourceGroupSecurityTasks(ascLocation).Get(taskName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetResourceGroupSecurityTask(ascLocation, taskName, cancellationToken); } - /// Gets a collection of SecurityAutomationResources in the ResourceGroupResource. + /// + /// Gets a collection of SecurityAutomationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityAutomationResources and their operations over a SecurityAutomationResource. public static SecurityAutomationCollection GetSecurityAutomations(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSecurityAutomations(); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSecurityAutomations(); } /// @@ -1771,16 +1791,20 @@ public static SecurityAutomationCollection GetSecurityAutomations(this ResourceG /// Automations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The security automation name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecurityAutomationAsync(this ResourceGroupResource resourceGroupResource, string automationName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSecurityAutomations().GetAsync(automationName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSecurityAutomationAsync(automationName, cancellationToken).ConfigureAwait(false); } /// @@ -1795,33 +1819,39 @@ public static async Task> GetSecurityAutoma /// Automations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The security automation name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecurityAutomation(this ResourceGroupResource resourceGroupResource, string automationName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSecurityAutomations().Get(automationName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSecurityAutomation(automationName, cancellationToken); } - /// Gets a collection of ServerVulnerabilityAssessmentResources in the ResourceGroupResource. + /// + /// Gets a collection of ServerVulnerabilityAssessmentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The Namespace of the resource. /// The type of the resource. /// Name of the resource. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of ServerVulnerabilityAssessmentResources and their operations over a ServerVulnerabilityAssessmentResource. public static ServerVulnerabilityAssessmentCollection GetServerVulnerabilityAssessments(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceNamespace, nameof(resourceNamespace)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetServerVulnerabilityAssessments(resourceNamespace, resourceType, resourceName); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetServerVulnerabilityAssessments(resourceNamespace, resourceType, resourceName); } /// @@ -1836,18 +1866,22 @@ public static ServerVulnerabilityAssessmentCollection GetServerVulnerabilityAsse /// ServerVulnerabilityAssessment_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Namespace of the resource. /// The type of the resource. /// Name of the resource. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetServerVulnerabilityAssessmentAsync(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetServerVulnerabilityAssessments(resourceNamespace, resourceType, resourceName).GetAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetServerVulnerabilityAssessmentAsync(resourceNamespace, resourceType, resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -1862,35 +1896,41 @@ public static async Task> GetSer /// ServerVulnerabilityAssessment_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Namespace of the resource. /// The type of the resource. /// Name of the resource. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetServerVulnerabilityAssessment(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetServerVulnerabilityAssessments(resourceNamespace, resourceType, resourceName).Get(cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetServerVulnerabilityAssessment(resourceNamespace, resourceType, resourceName, cancellationToken); } - /// Gets a collection of AdaptiveNetworkHardeningResources in the ResourceGroupResource. + /// + /// Gets a collection of AdaptiveNetworkHardeningResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The Namespace of the resource. /// The type of the resource. /// Name of the resource. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of AdaptiveNetworkHardeningResources and their operations over a AdaptiveNetworkHardeningResource. public static AdaptiveNetworkHardeningCollection GetAdaptiveNetworkHardenings(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceNamespace, nameof(resourceNamespace)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAdaptiveNetworkHardenings(resourceNamespace, resourceType, resourceName); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetAdaptiveNetworkHardenings(resourceNamespace, resourceType, resourceName); } /// @@ -1905,6 +1945,10 @@ public static AdaptiveNetworkHardeningCollection GetAdaptiveNetworkHardenings(th /// AdaptiveNetworkHardenings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Namespace of the resource. @@ -1912,12 +1956,12 @@ public static AdaptiveNetworkHardeningCollection GetAdaptiveNetworkHardenings(th /// Name of the resource. /// The name of the Adaptive Network Hardening resource. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAdaptiveNetworkHardeningAsync(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAdaptiveNetworkHardenings(resourceNamespace, resourceType, resourceName).GetAsync(adaptiveNetworkHardeningResourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetAdaptiveNetworkHardeningAsync(resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, cancellationToken).ConfigureAwait(false); } /// @@ -1932,6 +1976,10 @@ public static async Task> GetAdaptive /// AdaptiveNetworkHardenings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Namespace of the resource. @@ -1939,21 +1987,27 @@ public static async Task> GetAdaptive /// Name of the resource. /// The name of the Adaptive Network Hardening resource. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAdaptiveNetworkHardening(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAdaptiveNetworkHardenings(resourceNamespace, resourceType, resourceName).Get(adaptiveNetworkHardeningResourceName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetAdaptiveNetworkHardening(resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, cancellationToken); } - /// Gets a collection of JitNetworkAccessPolicyResources in the ResourceGroupResource. + /// + /// Gets a collection of JitNetworkAccessPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// An object representing collection of JitNetworkAccessPolicyResources and their operations over a JitNetworkAccessPolicyResource. public static JitNetworkAccessPolicyCollection GetJitNetworkAccessPolicies(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetJitNetworkAccessPolicies(ascLocation); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetJitNetworkAccessPolicies(ascLocation); } /// @@ -1968,17 +2022,21 @@ public static JitNetworkAccessPolicyCollection GetJitNetworkAccessPolicies(this /// JitNetworkAccessPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// Name of a Just-in-Time access configuration policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetJitNetworkAccessPolicyAsync(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string jitNetworkAccessPolicyName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetJitNetworkAccessPolicies(ascLocation).GetAsync(jitNetworkAccessPolicyName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetJitNetworkAccessPolicyAsync(ascLocation, jitNetworkAccessPolicyName, cancellationToken).ConfigureAwait(false); } /// @@ -1993,26 +2051,36 @@ public static async Task> GetJitNetwork /// JitNetworkAccessPolicies_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// Name of a Just-in-Time access configuration policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetJitNetworkAccessPolicy(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string jitNetworkAccessPolicyName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetJitNetworkAccessPolicies(ascLocation).Get(jitNetworkAccessPolicyName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetJitNetworkAccessPolicy(ascLocation, jitNetworkAccessPolicyName, cancellationToken); } - /// Gets a collection of ResourceGroupSecurityAlertResources in the ResourceGroupResource. + /// + /// Gets a collection of ResourceGroupSecurityAlertResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// An object representing collection of ResourceGroupSecurityAlertResources and their operations over a ResourceGroupSecurityAlertResource. public static ResourceGroupSecurityAlertCollection GetResourceGroupSecurityAlerts(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetResourceGroupSecurityAlerts(ascLocation); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetResourceGroupSecurityAlerts(ascLocation); } /// @@ -2027,17 +2095,21 @@ public static ResourceGroupSecurityAlertCollection GetResourceGroupSecurityAlert /// Alerts_GetResourceGroupLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// Name of the alert object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceGroupSecurityAlertAsync(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string alertName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetResourceGroupSecurityAlerts(ascLocation).GetAsync(alertName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetResourceGroupSecurityAlertAsync(ascLocation, alertName, cancellationToken).ConfigureAwait(false); } /// @@ -2052,34 +2124,40 @@ public static async Task> GetResour /// Alerts_GetResourceGroupLevel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. /// Name of the alert object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceGroupSecurityAlert(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string alertName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetResourceGroupSecurityAlerts(ascLocation).Get(alertName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetResourceGroupSecurityAlert(ascLocation, alertName, cancellationToken); } - /// Gets a collection of SoftwareInventoryResources in the ResourceGroupResource. + /// + /// Gets a collection of SoftwareInventoryResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The namespace of the resource. /// The type of the resource. /// Name of the resource. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of SoftwareInventoryResources and their operations over a SoftwareInventoryResource. public static SoftwareInventoryCollection GetSoftwareInventories(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName) { - Argument.AssertNotNullOrEmpty(resourceNamespace, nameof(resourceNamespace)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSoftwareInventories(resourceNamespace, resourceType, resourceName); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSoftwareInventories(resourceNamespace, resourceType, resourceName); } /// @@ -2094,6 +2172,10 @@ public static SoftwareInventoryCollection GetSoftwareInventories(this ResourceGr /// SoftwareInventories_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace of the resource. @@ -2101,12 +2183,12 @@ public static SoftwareInventoryCollection GetSoftwareInventories(this ResourceGr /// Name of the resource. /// Name of the installed software. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSoftwareInventoryAsync(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName, string softwareName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSoftwareInventories(resourceNamespace, resourceType, resourceName).GetAsync(softwareName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSoftwareInventoryAsync(resourceNamespace, resourceType, resourceName, softwareName, cancellationToken).ConfigureAwait(false); } /// @@ -2121,6 +2203,10 @@ public static async Task> GetSoftwareInvento /// SoftwareInventories_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace of the resource. @@ -2128,20 +2214,26 @@ public static async Task> GetSoftwareInvento /// Name of the resource. /// Name of the installed software. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSoftwareInventory(this ResourceGroupResource resourceGroupResource, string resourceNamespace, string resourceType, string resourceName, string softwareName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSoftwareInventories(resourceNamespace, resourceType, resourceName).Get(softwareName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSoftwareInventory(resourceNamespace, resourceType, resourceName, softwareName, cancellationToken); } - /// Gets a collection of SecurityConnectorResources in the ResourceGroupResource. + /// + /// Gets a collection of SecurityConnectorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityConnectorResources and their operations over a SecurityConnectorResource. public static SecurityConnectorCollection GetSecurityConnectors(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSecurityConnectors(); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSecurityConnectors(); } /// @@ -2156,16 +2248,20 @@ public static SecurityConnectorCollection GetSecurityConnectors(this ResourceGro /// SecurityConnectors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The security connector name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecurityConnectorAsync(this ResourceGroupResource resourceGroupResource, string securityConnectorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSecurityConnectors().GetAsync(securityConnectorName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSecurityConnectorAsync(securityConnectorName, cancellationToken).ConfigureAwait(false); } /// @@ -2180,16 +2276,20 @@ public static async Task> GetSecurityConnect /// SecurityConnectors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The security connector name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecurityConnector(this ResourceGroupResource resourceGroupResource, string securityConnectorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSecurityConnectors().Get(securityConnectorName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSecurityConnector(securityConnectorName, cancellationToken); } /// @@ -2204,6 +2304,10 @@ public static Response GetSecurityConnector(this Reso /// AllowedConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2211,7 +2315,7 @@ public static Response GetSecurityConnector(this Reso /// The cancellation token to use. public static async Task> GetAllowedConnectionAsync(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, SecurityCenterConnectionType connectionType, CancellationToken cancellationToken = default) { - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAllowedConnectionAsync(ascLocation, connectionType, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetAllowedConnectionAsync(ascLocation, connectionType, cancellationToken).ConfigureAwait(false); } /// @@ -2226,6 +2330,10 @@ public static async Task> GetAllowedCo /// AllowedConnections_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2233,7 +2341,7 @@ public static async Task> GetAllowedCo /// The cancellation token to use. public static Response GetAllowedConnection(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, SecurityCenterConnectionType connectionType, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAllowedConnection(ascLocation, connectionType, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetAllowedConnection(ascLocation, connectionType, cancellationToken); } /// @@ -2248,6 +2356,10 @@ public static Response GetAllowedConnection(thi /// Topology_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2257,9 +2369,7 @@ public static Response GetAllowedConnection(thi /// is null. public static async Task> GetTopologyAsync(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string topologyResourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topologyResourceName, nameof(topologyResourceName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetTopologyAsync(ascLocation, topologyResourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetTopologyAsync(ascLocation, topologyResourceName, cancellationToken).ConfigureAwait(false); } /// @@ -2274,6 +2384,10 @@ public static async Task> GetTopologyAsync(th /// Topology_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2283,9 +2397,7 @@ public static async Task> GetTopologyAsync(th /// is null. public static Response GetTopology(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string topologyResourceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(topologyResourceName, nameof(topologyResourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetTopology(ascLocation, topologyResourceName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetTopology(ascLocation, topologyResourceName, cancellationToken); } /// @@ -2300,13 +2412,17 @@ public static Response GetTopology(this ResourceGroupR /// JitNetworkAccessPolicies_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetJitNetworkAccessPoliciesAsync(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetJitNetworkAccessPoliciesAsync(cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetJitNetworkAccessPoliciesAsync(cancellationToken); } /// @@ -2321,13 +2437,17 @@ public static AsyncPageable GetJitNetworkAccessP /// JitNetworkAccessPolicies_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetJitNetworkAccessPolicies(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetJitNetworkAccessPolicies(cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetJitNetworkAccessPolicies(cancellationToken); } /// @@ -2342,6 +2462,10 @@ public static Pageable GetJitNetworkAccessPolici /// DiscoveredSecuritySolutions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2351,9 +2475,7 @@ public static Pageable GetJitNetworkAccessPolici /// is null. public static async Task> GetDiscoveredSecuritySolutionAsync(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string discoveredSecuritySolutionName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(discoveredSecuritySolutionName, nameof(discoveredSecuritySolutionName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDiscoveredSecuritySolutionAsync(ascLocation, discoveredSecuritySolutionName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetDiscoveredSecuritySolutionAsync(ascLocation, discoveredSecuritySolutionName, cancellationToken).ConfigureAwait(false); } /// @@ -2368,6 +2490,10 @@ public static async Task> GetDiscoveredSecu /// DiscoveredSecuritySolutions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2377,9 +2503,7 @@ public static async Task> GetDiscoveredSecu /// is null. public static Response GetDiscoveredSecuritySolution(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string discoveredSecuritySolutionName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(discoveredSecuritySolutionName, nameof(discoveredSecuritySolutionName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDiscoveredSecuritySolution(ascLocation, discoveredSecuritySolutionName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetDiscoveredSecuritySolution(ascLocation, discoveredSecuritySolutionName, cancellationToken); } /// @@ -2394,6 +2518,10 @@ public static Response GetDiscoveredSecuritySolution /// ExternalSecuritySolutions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2403,9 +2531,7 @@ public static Response GetDiscoveredSecuritySolution /// is null. public static async Task> GetExternalSecuritySolutionAsync(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string externalSecuritySolutionsName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalSecuritySolutionsName, nameof(externalSecuritySolutionsName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetExternalSecuritySolutionAsync(ascLocation, externalSecuritySolutionsName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetExternalSecuritySolutionAsync(ascLocation, externalSecuritySolutionsName, cancellationToken).ConfigureAwait(false); } /// @@ -2419,7 +2545,11 @@ public static async Task> GetExternalSecurity /// Operation Id /// ExternalSecuritySolutions_Get /// - /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2429,9 +2559,7 @@ public static async Task> GetExternalSecurity /// is null. public static Response GetExternalSecuritySolution(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string externalSecuritySolutionsName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalSecuritySolutionsName, nameof(externalSecuritySolutionsName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetExternalSecuritySolution(ascLocation, externalSecuritySolutionsName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetExternalSecuritySolution(ascLocation, externalSecuritySolutionsName, cancellationToken); } /// @@ -2446,6 +2574,10 @@ public static Response GetExternalSecuritySolution(thi /// SecuritySolutions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2455,9 +2587,7 @@ public static Response GetExternalSecuritySolution(thi /// is null. public static async Task> GetSecuritySolutionAsync(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string securitySolutionName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(securitySolutionName, nameof(securitySolutionName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSecuritySolutionAsync(ascLocation, securitySolutionName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSecuritySolutionAsync(ascLocation, securitySolutionName, cancellationToken).ConfigureAwait(false); } /// @@ -2472,6 +2602,10 @@ public static async Task> GetSecuritySolutionAsync(th /// SecuritySolutions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2481,9 +2615,7 @@ public static async Task> GetSecuritySolutionAsync(th /// is null. public static Response GetSecuritySolution(this ResourceGroupResource resourceGroupResource, AzureLocation ascLocation, string securitySolutionName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(securitySolutionName, nameof(securitySolutionName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSecuritySolution(ascLocation, securitySolutionName, cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetSecuritySolution(ascLocation, securitySolutionName, cancellationToken); } /// @@ -2498,13 +2630,17 @@ public static Response GetSecuritySolution(this ResourceGroupR /// Alerts_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAlertsByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAlertsByResourceGroupAsync(cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetAlertsByResourceGroupAsync(cancellationToken); } /// @@ -2519,21 +2655,31 @@ public static AsyncPageable GetAlertsByResourceGroupAsync(thi /// Alerts_ListByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAlertsByResourceGroup(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAlertsByResourceGroup(cancellationToken); + return GetMockableSecurityCenterResourceGroupResource(resourceGroupResource).GetAlertsByResourceGroup(cancellationToken); } - /// Gets a collection of SecurityCenterPricingResources in the SubscriptionResource. + /// + /// Gets a collection of SecurityCenterPricingResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityCenterPricingResources and their operations over a SecurityCenterPricingResource. public static SecurityCenterPricingCollection GetSecurityCenterPricings(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityCenterPricings(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCenterPricings(); } /// @@ -2548,16 +2694,20 @@ public static SecurityCenterPricingCollection GetSecurityCenterPricings(this Sub /// Pricings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// name of the pricing configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecurityCenterPricingAsync(this SubscriptionResource subscriptionResource, string pricingName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSecurityCenterPricings().GetAsync(pricingName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCenterPricingAsync(pricingName, cancellationToken).ConfigureAwait(false); } /// @@ -2572,24 +2722,34 @@ public static async Task> GetSecurityCen /// Pricings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// name of the pricing configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecurityCenterPricing(this SubscriptionResource subscriptionResource, string pricingName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSecurityCenterPricings().Get(pricingName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCenterPricing(pricingName, cancellationToken); } - /// Gets a collection of SecurityCenterLocationResources in the SubscriptionResource. + /// + /// Gets a collection of SecurityCenterLocationResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityCenterLocationResources and their operations over a SecurityCenterLocationResource. public static SecurityCenterLocationCollection GetSecurityCenterLocations(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityCenterLocations(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCenterLocations(); } /// @@ -2604,6 +2764,10 @@ public static SecurityCenterLocationCollection GetSecurityCenterLocations(this S /// Locations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2611,7 +2775,7 @@ public static SecurityCenterLocationCollection GetSecurityCenterLocations(this S [ForwardsClientCalls] public static async Task> GetSecurityCenterLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation ascLocation, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSecurityCenterLocations().GetAsync(ascLocation, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCenterLocationAsync(ascLocation, cancellationToken).ConfigureAwait(false); } /// @@ -2626,6 +2790,10 @@ public static async Task> GetSecurityCe /// Locations_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location where ASC stores the data of the subscription. can be retrieved from Get locations. @@ -2633,15 +2801,21 @@ public static async Task> GetSecurityCe [ForwardsClientCalls] public static Response GetSecurityCenterLocation(this SubscriptionResource subscriptionResource, AzureLocation ascLocation, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSecurityCenterLocations().Get(ascLocation, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCenterLocation(ascLocation, cancellationToken); } - /// Gets a collection of AutoProvisioningSettingResources in the SubscriptionResource. + /// + /// Gets a collection of AutoProvisioningSettingResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AutoProvisioningSettingResources and their operations over a AutoProvisioningSettingResource. public static AutoProvisioningSettingCollection GetAutoProvisioningSettings(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAutoProvisioningSettings(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAutoProvisioningSettings(); } /// @@ -2656,16 +2830,20 @@ public static AutoProvisioningSettingCollection GetAutoProvisioningSettings(this /// AutoProvisioningSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Auto provisioning setting key. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAutoProvisioningSettingAsync(this SubscriptionResource subscriptionResource, string settingName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetAutoProvisioningSettings().GetAsync(settingName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAutoProvisioningSettingAsync(settingName, cancellationToken).ConfigureAwait(false); } /// @@ -2680,24 +2858,34 @@ public static async Task> GetAutoProvi /// AutoProvisioningSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Auto provisioning setting key. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAutoProvisioningSetting(this SubscriptionResource subscriptionResource, string settingName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetAutoProvisioningSettings().Get(settingName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAutoProvisioningSetting(settingName, cancellationToken); } - /// Gets a collection of SecurityContactResources in the SubscriptionResource. + /// + /// Gets a collection of SecurityContactResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityContactResources and their operations over a SecurityContactResource. public static SecurityContactCollection GetSecurityContacts(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityContacts(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityContacts(); } /// @@ -2712,16 +2900,20 @@ public static SecurityContactCollection GetSecurityContacts(this SubscriptionRes /// SecurityContacts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the security contact object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecurityContactAsync(this SubscriptionResource subscriptionResource, string securityContactName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSecurityContacts().GetAsync(securityContactName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityContactAsync(securityContactName, cancellationToken).ConfigureAwait(false); } /// @@ -2736,24 +2928,34 @@ public static async Task> GetSecurityContactAs /// SecurityContacts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the security contact object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecurityContact(this SubscriptionResource subscriptionResource, string securityContactName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSecurityContacts().Get(securityContactName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityContact(securityContactName, cancellationToken); } - /// Gets a collection of SecurityWorkspaceSettingResources in the SubscriptionResource. + /// + /// Gets a collection of SecurityWorkspaceSettingResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityWorkspaceSettingResources and their operations over a SecurityWorkspaceSettingResource. public static SecurityWorkspaceSettingCollection GetSecurityWorkspaceSettings(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityWorkspaceSettings(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityWorkspaceSettings(); } /// @@ -2768,16 +2970,20 @@ public static SecurityWorkspaceSettingCollection GetSecurityWorkspaceSettings(th /// WorkspaceSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the security setting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecurityWorkspaceSettingAsync(this SubscriptionResource subscriptionResource, string workspaceSettingName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSecurityWorkspaceSettings().GetAsync(workspaceSettingName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityWorkspaceSettingAsync(workspaceSettingName, cancellationToken).ConfigureAwait(false); } /// @@ -2792,24 +2998,34 @@ public static async Task> GetSecurity /// WorkspaceSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the security setting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecurityWorkspaceSetting(this SubscriptionResource subscriptionResource, string workspaceSettingName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSecurityWorkspaceSettings().Get(workspaceSettingName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityWorkspaceSetting(workspaceSettingName, cancellationToken); } - /// Gets a collection of RegulatoryComplianceStandardResources in the SubscriptionResource. + /// + /// Gets a collection of RegulatoryComplianceStandardResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of RegulatoryComplianceStandardResources and their operations over a RegulatoryComplianceStandardResource. public static RegulatoryComplianceStandardCollection GetRegulatoryComplianceStandards(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRegulatoryComplianceStandards(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetRegulatoryComplianceStandards(); } /// @@ -2824,16 +3040,20 @@ public static RegulatoryComplianceStandardCollection GetRegulatoryComplianceStan /// RegulatoryComplianceStandards_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the regulatory compliance standard object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetRegulatoryComplianceStandardAsync(this SubscriptionResource subscriptionResource, string regulatoryComplianceStandardName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetRegulatoryComplianceStandards().GetAsync(regulatoryComplianceStandardName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetRegulatoryComplianceStandardAsync(regulatoryComplianceStandardName, cancellationToken).ConfigureAwait(false); } /// @@ -2848,24 +3068,34 @@ public static async Task> GetRegu /// RegulatoryComplianceStandards_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the regulatory compliance standard object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetRegulatoryComplianceStandard(this SubscriptionResource subscriptionResource, string regulatoryComplianceStandardName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetRegulatoryComplianceStandards().Get(regulatoryComplianceStandardName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetRegulatoryComplianceStandard(regulatoryComplianceStandardName, cancellationToken); } - /// Gets a collection of SecurityAlertsSuppressionRuleResources in the SubscriptionResource. + /// + /// Gets a collection of SecurityAlertsSuppressionRuleResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityAlertsSuppressionRuleResources and their operations over a SecurityAlertsSuppressionRuleResource. public static SecurityAlertsSuppressionRuleCollection GetSecurityAlertsSuppressionRules(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityAlertsSuppressionRules(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityAlertsSuppressionRules(); } /// @@ -2880,16 +3110,20 @@ public static SecurityAlertsSuppressionRuleCollection GetSecurityAlertsSuppressi /// AlertsSuppressionRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The unique name of the suppression alert rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecurityAlertsSuppressionRuleAsync(this SubscriptionResource subscriptionResource, string alertsSuppressionRuleName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSecurityAlertsSuppressionRules().GetAsync(alertsSuppressionRuleName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityAlertsSuppressionRuleAsync(alertsSuppressionRuleName, cancellationToken).ConfigureAwait(false); } /// @@ -2904,24 +3138,34 @@ public static async Task> GetSec /// AlertsSuppressionRules_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The unique name of the suppression alert rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecurityAlertsSuppressionRule(this SubscriptionResource subscriptionResource, string alertsSuppressionRuleName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSecurityAlertsSuppressionRules().Get(alertsSuppressionRuleName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityAlertsSuppressionRule(alertsSuppressionRuleName, cancellationToken); } - /// Gets a collection of SubscriptionAssessmentMetadataResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionAssessmentMetadataResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SubscriptionAssessmentMetadataResources and their operations over a SubscriptionAssessmentMetadataResource. public static SubscriptionAssessmentMetadataCollection GetAllSubscriptionAssessmentMetadata(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllSubscriptionAssessmentMetadata(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAllSubscriptionAssessmentMetadata(); } /// @@ -2936,16 +3180,20 @@ public static SubscriptionAssessmentMetadataCollection GetAllSubscriptionAssessm /// AssessmentsMetadata_GetInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Assessment Key - Unique key for the assessment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionAssessmentMetadataAsync(this SubscriptionResource subscriptionResource, string assessmentMetadataName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetAllSubscriptionAssessmentMetadata().GetAsync(assessmentMetadataName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSubscriptionAssessmentMetadataAsync(assessmentMetadataName, cancellationToken).ConfigureAwait(false); } /// @@ -2960,24 +3208,34 @@ public static async Task> GetSu /// AssessmentsMetadata_GetInSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Assessment Key - Unique key for the assessment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionAssessmentMetadata(this SubscriptionResource subscriptionResource, string assessmentMetadataName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetAllSubscriptionAssessmentMetadata().Get(assessmentMetadataName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSubscriptionAssessmentMetadata(assessmentMetadataName, cancellationToken); } - /// Gets a collection of SecureScoreResources in the SubscriptionResource. + /// + /// Gets a collection of SecureScoreResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecureScoreResources and their operations over a SecureScoreResource. public static SecureScoreCollection GetSecureScores(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecureScores(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecureScores(); } /// @@ -2992,16 +3250,20 @@ public static SecureScoreCollection GetSecureScores(this SubscriptionResource su /// SecureScores_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecureScoreAsync(this SubscriptionResource subscriptionResource, string secureScoreName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSecureScores().GetAsync(secureScoreName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecureScoreAsync(secureScoreName, cancellationToken).ConfigureAwait(false); } /// @@ -3016,24 +3278,34 @@ public static async Task> GetSecureScoreAsync(this /// SecureScores_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecureScore(this SubscriptionResource subscriptionResource, string secureScoreName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSecureScores().Get(secureScoreName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecureScore(secureScoreName, cancellationToken); } - /// Gets a collection of SecurityCloudConnectorResources in the SubscriptionResource. + /// + /// Gets a collection of SecurityCloudConnectorResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecurityCloudConnectorResources and their operations over a SecurityCloudConnectorResource. public static SecurityCloudConnectorCollection GetSecurityCloudConnectors(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityCloudConnectors(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCloudConnectors(); } /// @@ -3048,16 +3320,20 @@ public static SecurityCloudConnectorCollection GetSecurityCloudConnectors(this S /// Connectors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the cloud account connector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSecurityCloudConnectorAsync(this SubscriptionResource subscriptionResource, string connectorName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSecurityCloudConnectors().GetAsync(connectorName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCloudConnectorAsync(connectorName, cancellationToken).ConfigureAwait(false); } /// @@ -3072,24 +3348,34 @@ public static async Task> GetSecurityCl /// Connectors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the cloud account connector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSecurityCloudConnector(this SubscriptionResource subscriptionResource, string connectorName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSecurityCloudConnectors().Get(connectorName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityCloudConnector(connectorName, cancellationToken); } - /// Gets a collection of SecuritySettingResources in the SubscriptionResource. + /// + /// Gets a collection of SecuritySettingResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SecuritySettingResources and their operations over a SecuritySettingResource. public static SecuritySettingCollection GetSecuritySettings(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecuritySettings(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecuritySettings(); } /// @@ -3104,6 +3390,10 @@ public static SecuritySettingCollection GetSecuritySettings(this SubscriptionRes /// Settings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the setting. @@ -3111,7 +3401,7 @@ public static SecuritySettingCollection GetSecuritySettings(this SubscriptionRes [ForwardsClientCalls] public static async Task> GetSecuritySettingAsync(this SubscriptionResource subscriptionResource, SecuritySettingName settingName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSecuritySettings().GetAsync(settingName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecuritySettingAsync(settingName, cancellationToken).ConfigureAwait(false); } /// @@ -3126,6 +3416,10 @@ public static async Task> GetSecuritySettingAs /// Settings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the setting. @@ -3133,15 +3427,21 @@ public static async Task> GetSecuritySettingAs [ForwardsClientCalls] public static Response GetSecuritySetting(this SubscriptionResource subscriptionResource, SecuritySettingName settingName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSecuritySettings().Get(settingName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecuritySetting(settingName, cancellationToken); } - /// Gets a collection of IngestionSettingResources in the SubscriptionResource. + /// + /// Gets a collection of IngestionSettingResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of IngestionSettingResources and their operations over a IngestionSettingResource. public static IngestionSettingCollection GetIngestionSettings(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIngestionSettings(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetIngestionSettings(); } /// @@ -3156,16 +3456,20 @@ public static IngestionSettingCollection GetIngestionSettings(this SubscriptionR /// IngestionSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the ingestion setting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetIngestionSettingAsync(this SubscriptionResource subscriptionResource, string ingestionSettingName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetIngestionSettings().GetAsync(ingestionSettingName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetIngestionSettingAsync(ingestionSettingName, cancellationToken).ConfigureAwait(false); } /// @@ -3180,24 +3484,34 @@ public static async Task> GetIngestionSetting /// IngestionSettings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the ingestion setting. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetIngestionSetting(this SubscriptionResource subscriptionResource, string ingestionSettingName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetIngestionSettings().Get(ingestionSettingName, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetIngestionSetting(ingestionSettingName, cancellationToken); } - /// Gets a collection of SubscriptionSecurityApplicationResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionSecurityApplicationResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SubscriptionSecurityApplicationResources and their operations over a SubscriptionSecurityApplicationResource. public static SubscriptionSecurityApplicationCollection GetSubscriptionSecurityApplications(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionSecurityApplications(); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSubscriptionSecurityApplications(); } /// @@ -3212,16 +3526,20 @@ public static SubscriptionSecurityApplicationCollection GetSubscriptionSecurityA /// Application_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The security Application key - unique key for the standard application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionSecurityApplicationAsync(this SubscriptionResource subscriptionResource, string applicationId, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionSecurityApplications().GetAsync(applicationId, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSubscriptionSecurityApplicationAsync(applicationId, cancellationToken).ConfigureAwait(false); } /// @@ -3236,16 +3554,20 @@ public static async Task> GetS /// Application_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The security Application key - unique key for the standard application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionSecurityApplication(this SubscriptionResource subscriptionResource, string applicationId, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionSecurityApplications().Get(applicationId, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSubscriptionSecurityApplication(applicationId, cancellationToken); } /// @@ -3260,13 +3582,17 @@ public static Response GetSubscriptionS /// MdeOnboardings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMdeOnboardingsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMdeOnboardingsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetMdeOnboardingsAsync(cancellationToken); } /// @@ -3281,13 +3607,17 @@ public static AsyncPageable GetMdeOnboardingsAsync(this Subscript /// MdeOnboardings_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetMdeOnboardings(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMdeOnboardings(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetMdeOnboardings(cancellationToken); } /// @@ -3302,12 +3632,16 @@ public static Pageable GetMdeOnboardings(this SubscriptionResourc /// MdeOnboardings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetMdeOnboardingAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetMdeOnboardingAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetMdeOnboardingAsync(cancellationToken).ConfigureAwait(false); } /// @@ -3322,12 +3656,16 @@ public static async Task> GetMdeOnboardingAsync(this Sub /// MdeOnboardings_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetMdeOnboarding(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMdeOnboarding(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetMdeOnboarding(cancellationToken); } /// @@ -3342,13 +3680,17 @@ public static Response GetMdeOnboarding(this SubscriptionResource /// CustomAssessmentAutomations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCustomAssessmentAutomationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCustomAssessmentAutomationsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetCustomAssessmentAutomationsAsync(cancellationToken); } /// @@ -3363,13 +3705,17 @@ public static AsyncPageable GetCustomAssessm /// CustomAssessmentAutomations_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCustomAssessmentAutomations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCustomAssessmentAutomations(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetCustomAssessmentAutomations(cancellationToken); } /// @@ -3384,13 +3730,17 @@ public static Pageable GetCustomAssessmentAu /// CustomEntityStoreAssignments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCustomEntityStoreAssignmentsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCustomEntityStoreAssignmentsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetCustomEntityStoreAssignmentsAsync(cancellationToken); } /// @@ -3405,13 +3755,17 @@ public static AsyncPageable GetCustomEntity /// CustomEntityStoreAssignments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetCustomEntityStoreAssignments(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCustomEntityStoreAssignments(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetCustomEntityStoreAssignments(cancellationToken); } /// @@ -3426,6 +3780,10 @@ public static Pageable GetCustomEntityStore /// IotSecuritySolution_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. @@ -3433,7 +3791,7 @@ public static Pageable GetCustomEntityStore /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetIotSecuritySolutionsAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIotSecuritySolutionsAsync(filter, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetIotSecuritySolutionsAsync(filter, cancellationToken); } /// @@ -3448,6 +3806,10 @@ public static AsyncPageable GetIotSecuritySolutions /// IotSecuritySolution_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. @@ -3455,7 +3817,7 @@ public static AsyncPageable GetIotSecuritySolutions /// A collection of that may take multiple service requests to iterate over. public static Pageable GetIotSecuritySolutions(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIotSecuritySolutions(filter, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetIotSecuritySolutions(filter, cancellationToken); } /// @@ -3470,6 +3832,10 @@ public static Pageable GetIotSecuritySolutions(this /// Tasks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// OData filter. Optional. @@ -3477,7 +3843,7 @@ public static Pageable GetIotSecuritySolutions(this /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetTasksAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTasksAsync(filter, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetTasksAsync(filter, cancellationToken); } /// @@ -3492,6 +3858,10 @@ public static AsyncPageable GetTasksAsync(this SubscriptionRes /// Tasks_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// OData filter. Optional. @@ -3499,7 +3869,7 @@ public static AsyncPageable GetTasksAsync(this SubscriptionRes /// A collection of that may take multiple service requests to iterate over. public static Pageable GetTasks(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTasks(filter, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetTasks(filter, cancellationToken); } /// @@ -3514,13 +3884,17 @@ public static Pageable GetTasks(this SubscriptionResource subs /// Automations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecurityAutomationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityAutomationsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityAutomationsAsync(cancellationToken); } /// @@ -3535,13 +3909,17 @@ public static AsyncPageable GetSecurityAutomationsAs /// Automations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecurityAutomations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityAutomations(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityAutomations(cancellationToken); } /// @@ -3556,6 +3934,10 @@ public static Pageable GetSecurityAutomations(this S /// AdaptiveApplicationControls_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Include the policy rules. @@ -3564,7 +3946,7 @@ public static Pageable GetSecurityAutomations(this S /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAdaptiveApplicationControlGroupsAsync(this SubscriptionResource subscriptionResource, bool? includePathRecommendations = null, bool? summary = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAdaptiveApplicationControlGroupsAsync(includePathRecommendations, summary, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAdaptiveApplicationControlGroupsAsync(includePathRecommendations, summary, cancellationToken); } /// @@ -3579,6 +3961,10 @@ public static AsyncPageable GetAdaptive /// AdaptiveApplicationControls_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Include the policy rules. @@ -3587,7 +3973,7 @@ public static AsyncPageable GetAdaptive /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAdaptiveApplicationControlGroups(this SubscriptionResource subscriptionResource, bool? includePathRecommendations = null, bool? summary = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAdaptiveApplicationControlGroups(includePathRecommendations, summary, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAdaptiveApplicationControlGroups(includePathRecommendations, summary, cancellationToken); } /// @@ -3602,13 +3988,17 @@ public static Pageable GetAdaptiveAppli /// AllowedConnections_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAllowedConnectionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllowedConnectionsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAllowedConnectionsAsync(cancellationToken); } /// @@ -3623,13 +4013,17 @@ public static AsyncPageable GetAllowedConnectio /// AllowedConnections_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAllowedConnections(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllowedConnections(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAllowedConnections(cancellationToken); } /// @@ -3644,13 +4038,17 @@ public static Pageable GetAllowedConnections(th /// Topology_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetTopologiesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTopologiesAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetTopologiesAsync(cancellationToken); } /// @@ -3665,13 +4063,17 @@ public static AsyncPageable GetTopologiesAsync(this Su /// Topology_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetTopologies(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTopologies(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetTopologies(cancellationToken); } /// @@ -3686,13 +4088,17 @@ public static Pageable GetTopologies(this Subscription /// JitNetworkAccessPolicies_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetJitNetworkAccessPoliciesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetJitNetworkAccessPoliciesAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetJitNetworkAccessPoliciesAsync(cancellationToken); } /// @@ -3707,13 +4113,17 @@ public static AsyncPageable GetJitNetworkAccessP /// JitNetworkAccessPolicies_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetJitNetworkAccessPolicies(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetJitNetworkAccessPolicies(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetJitNetworkAccessPolicies(cancellationToken); } /// @@ -3728,13 +4138,17 @@ public static Pageable GetJitNetworkAccessPolici /// DiscoveredSecuritySolutions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiscoveredSecuritySolutionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiscoveredSecuritySolutionsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetDiscoveredSecuritySolutionsAsync(cancellationToken); } /// @@ -3749,13 +4163,17 @@ public static AsyncPageable GetDiscoveredSecuritySol /// DiscoveredSecuritySolutions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiscoveredSecuritySolutions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiscoveredSecuritySolutions(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetDiscoveredSecuritySolutions(cancellationToken); } /// @@ -3770,13 +4188,17 @@ public static Pageable GetDiscoveredSecuritySolution /// securitySolutionsReferenceData_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAllSecuritySolutionsReferenceDataAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllSecuritySolutionsReferenceDataAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAllSecuritySolutionsReferenceDataAsync(cancellationToken); } /// @@ -3791,13 +4213,17 @@ public static AsyncPageable GetAllSecuritySoluti /// securitySolutionsReferenceData_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAllSecuritySolutionsReferenceData(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllSecuritySolutionsReferenceData(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAllSecuritySolutionsReferenceData(cancellationToken); } /// @@ -3812,13 +4238,17 @@ public static Pageable GetAllSecuritySolutionsRe /// ExternalSecuritySolutions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExternalSecuritySolutionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExternalSecuritySolutionsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetExternalSecuritySolutionsAsync(cancellationToken); } /// @@ -3833,13 +4263,17 @@ public static AsyncPageable GetExternalSecuritySolutio /// ExternalSecuritySolutions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetExternalSecuritySolutions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetExternalSecuritySolutions(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetExternalSecuritySolutions(cancellationToken); } /// @@ -3854,6 +4288,10 @@ public static Pageable GetExternalSecuritySolutions(th /// SecureScoreControls_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// OData expand. Optional. @@ -3861,7 +4299,7 @@ public static Pageable GetExternalSecuritySolutions(th /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSecureScoreControlsAsync(this SubscriptionResource subscriptionResource, SecurityScoreODataExpand? expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecureScoreControlsAsync(expand, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecureScoreControlsAsync(expand, cancellationToken); } /// @@ -3876,6 +4314,10 @@ public static AsyncPageable GetSecureScoreControlsAsy /// SecureScoreControls_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// OData expand. Optional. @@ -3883,7 +4325,7 @@ public static AsyncPageable GetSecureScoreControlsAsy /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSecureScoreControls(this SubscriptionResource subscriptionResource, SecurityScoreODataExpand? expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecureScoreControls(expand, cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecureScoreControls(expand, cancellationToken); } /// @@ -3898,13 +4340,17 @@ public static Pageable GetSecureScoreControls(this Su /// SecureScoreControlDefinitions_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecureScoreControlDefinitionsBySubscriptionAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecureScoreControlDefinitionsBySubscriptionAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecureScoreControlDefinitionsBySubscriptionAsync(cancellationToken); } /// @@ -3919,13 +4365,17 @@ public static AsyncPageable GetSecureScoreCont /// SecureScoreControlDefinitions_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecureScoreControlDefinitionsBySubscription(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecureScoreControlDefinitionsBySubscription(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecureScoreControlDefinitionsBySubscription(cancellationToken); } /// @@ -3940,13 +4390,17 @@ public static Pageable GetSecureScoreControlDe /// SecuritySolutions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecuritySolutionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecuritySolutionsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecuritySolutionsAsync(cancellationToken); } /// @@ -3961,13 +4415,17 @@ public static AsyncPageable GetSecuritySolutionsAsync(this Sub /// SecuritySolutions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecuritySolutions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecuritySolutions(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecuritySolutions(cancellationToken); } /// @@ -3982,13 +4440,17 @@ public static Pageable GetSecuritySolutions(this SubscriptionR /// Alerts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAlertsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAlertsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAlertsAsync(cancellationToken); } /// @@ -4003,13 +4465,17 @@ public static AsyncPageable GetAlertsAsync(this SubscriptionR /// Alerts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAlerts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAlerts(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetAlerts(cancellationToken); } /// @@ -4024,13 +4490,17 @@ public static Pageable GetAlerts(this SubscriptionResource su /// SoftwareInventories_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSoftwareInventoriesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSoftwareInventoriesAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSoftwareInventoriesAsync(cancellationToken); } /// @@ -4045,13 +4515,17 @@ public static AsyncPageable GetSoftwareInventoriesAsy /// SoftwareInventories_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSoftwareInventories(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSoftwareInventories(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSoftwareInventories(cancellationToken); } /// @@ -4066,13 +4540,17 @@ public static Pageable GetSoftwareInventories(this Su /// SecurityConnectors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecurityConnectorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityConnectorsAsync(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityConnectorsAsync(cancellationToken); } /// @@ -4087,21 +4565,31 @@ public static AsyncPageable GetSecurityConnectorsAsyn /// SecurityConnectors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecurityConnectors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSecurityConnectors(cancellationToken); + return GetMockableSecurityCenterSubscriptionResource(subscriptionResource).GetSecurityConnectors(cancellationToken); } - /// Gets a collection of TenantAssessmentMetadataResources in the TenantResource. + /// + /// Gets a collection of TenantAssessmentMetadataResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TenantAssessmentMetadataResources and their operations over a TenantAssessmentMetadataResource. public static TenantAssessmentMetadataCollection GetAllTenantAssessmentMetadata(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetAllTenantAssessmentMetadata(); + return GetMockableSecurityCenterTenantResource(tenantResource).GetAllTenantAssessmentMetadata(); } /// @@ -4116,16 +4604,20 @@ public static TenantAssessmentMetadataCollection GetAllTenantAssessmentMetadata( /// AssessmentsMetadata_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Assessment Key - Unique key for the assessment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTenantAssessmentMetadataAsync(this TenantResource tenantResource, string assessmentMetadataName, CancellationToken cancellationToken = default) { - return await tenantResource.GetAllTenantAssessmentMetadata().GetAsync(assessmentMetadataName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityCenterTenantResource(tenantResource).GetTenantAssessmentMetadataAsync(assessmentMetadataName, cancellationToken).ConfigureAwait(false); } /// @@ -4140,16 +4632,20 @@ public static async Task> GetTenantAs /// AssessmentsMetadata_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Assessment Key - Unique key for the assessment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTenantAssessmentMetadata(this TenantResource tenantResource, string assessmentMetadataName, CancellationToken cancellationToken = default) { - return tenantResource.GetAllTenantAssessmentMetadata().Get(assessmentMetadataName, cancellationToken); + return GetMockableSecurityCenterTenantResource(tenantResource).GetTenantAssessmentMetadata(assessmentMetadataName, cancellationToken); } /// @@ -4164,13 +4660,17 @@ public static Response GetTenantAssessmentMeta /// SecureScoreControlDefinitions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecureScoreControlDefinitionsAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetSecureScoreControlDefinitionsAsync(cancellationToken); + return GetMockableSecurityCenterTenantResource(tenantResource).GetSecureScoreControlDefinitionsAsync(cancellationToken); } /// @@ -4185,13 +4685,17 @@ public static AsyncPageable GetSecureScoreCont /// SecureScoreControlDefinitions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSecureScoreControlDefinitions(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetSecureScoreControlDefinitions(cancellationToken); + return GetMockableSecurityCenterTenantResource(tenantResource).GetSecureScoreControlDefinitions(cancellationToken); } } } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index bde99e4dee666..0000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,1110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.SecurityCenter.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _mdeOnboardingsClientDiagnostics; - private MdeOnboardingsRestOperations _mdeOnboardingsRestClient; - private ClientDiagnostics _customAssessmentAutomationClientDiagnostics; - private CustomAssessmentAutomationsRestOperations _customAssessmentAutomationRestClient; - private ClientDiagnostics _customEntityStoreAssignmentClientDiagnostics; - private CustomEntityStoreAssignmentsRestOperations _customEntityStoreAssignmentRestClient; - private ClientDiagnostics _iotSecuritySolutionClientDiagnostics; - private IotSecuritySolutionRestOperations _iotSecuritySolutionRestClient; - private ClientDiagnostics _tasksClientDiagnostics; - private TasksRestOperations _tasksRestClient; - private ClientDiagnostics _securityAutomationAutomationsClientDiagnostics; - private AutomationsRestOperations _securityAutomationAutomationsRestClient; - private ClientDiagnostics _adaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics; - private AdaptiveApplicationControlsRestOperations _adaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient; - private ClientDiagnostics _allowedConnectionsClientDiagnostics; - private AllowedConnectionsRestOperations _allowedConnectionsRestClient; - private ClientDiagnostics _topologyClientDiagnostics; - private TopologyRestOperations _topologyRestClient; - private ClientDiagnostics _jitNetworkAccessPolicyClientDiagnostics; - private JitNetworkAccessPoliciesRestOperations _jitNetworkAccessPolicyRestClient; - private ClientDiagnostics _discoveredSecuritySolutionsClientDiagnostics; - private DiscoveredSecuritySolutionsRestOperations _discoveredSecuritySolutionsRestClient; - private ClientDiagnostics _securitySolutionsReferenceDataClientDiagnostics; - private SecuritySolutionsReferenceDataRestOperations _securitySolutionsReferenceDataRestClient; - private ClientDiagnostics _externalSecuritySolutionsClientDiagnostics; - private ExternalSecuritySolutionsRestOperations _externalSecuritySolutionsRestClient; - private ClientDiagnostics _secureScoreControlsClientDiagnostics; - private SecureScoreControlsRestOperations _secureScoreControlsRestClient; - private ClientDiagnostics _secureScoreControlDefinitionsClientDiagnostics; - private SecureScoreControlDefinitionsRestOperations _secureScoreControlDefinitionsRestClient; - private ClientDiagnostics _securitySolutionsClientDiagnostics; - private SecuritySolutionsRestOperations _securitySolutionsRestClient; - private ClientDiagnostics _alertsClientDiagnostics; - private AlertsRestOperations _alertsRestClient; - private ClientDiagnostics _softwareInventoryClientDiagnostics; - private SoftwareInventoriesRestOperations _softwareInventoryRestClient; - private ClientDiagnostics _securityConnectorClientDiagnostics; - private SecurityConnectorsRestOperations _securityConnectorRestClient; - - /// 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 MdeOnboardingsClientDiagnostics => _mdeOnboardingsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private MdeOnboardingsRestOperations MdeOnboardingsRestClient => _mdeOnboardingsRestClient ??= new MdeOnboardingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics CustomAssessmentAutomationClientDiagnostics => _customAssessmentAutomationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", CustomAssessmentAutomationResource.ResourceType.Namespace, Diagnostics); - private CustomAssessmentAutomationsRestOperations CustomAssessmentAutomationRestClient => _customAssessmentAutomationRestClient ??= new CustomAssessmentAutomationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CustomAssessmentAutomationResource.ResourceType)); - private ClientDiagnostics CustomEntityStoreAssignmentClientDiagnostics => _customEntityStoreAssignmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", CustomEntityStoreAssignmentResource.ResourceType.Namespace, Diagnostics); - private CustomEntityStoreAssignmentsRestOperations CustomEntityStoreAssignmentRestClient => _customEntityStoreAssignmentRestClient ??= new CustomEntityStoreAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CustomEntityStoreAssignmentResource.ResourceType)); - private ClientDiagnostics IotSecuritySolutionClientDiagnostics => _iotSecuritySolutionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", IotSecuritySolutionResource.ResourceType.Namespace, Diagnostics); - private IotSecuritySolutionRestOperations IotSecuritySolutionRestClient => _iotSecuritySolutionRestClient ??= new IotSecuritySolutionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(IotSecuritySolutionResource.ResourceType)); - private ClientDiagnostics TasksClientDiagnostics => _tasksClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private TasksRestOperations TasksRestClient => _tasksRestClient ??= new TasksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SecurityAutomationAutomationsClientDiagnostics => _securityAutomationAutomationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SecurityAutomationResource.ResourceType.Namespace, Diagnostics); - private AutomationsRestOperations SecurityAutomationAutomationsRestClient => _securityAutomationAutomationsRestClient ??= new AutomationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecurityAutomationResource.ResourceType)); - private ClientDiagnostics AdaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics => _adaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", AdaptiveApplicationControlGroupResource.ResourceType.Namespace, Diagnostics); - private AdaptiveApplicationControlsRestOperations AdaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient => _adaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient ??= new AdaptiveApplicationControlsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AdaptiveApplicationControlGroupResource.ResourceType)); - private ClientDiagnostics AllowedConnectionsClientDiagnostics => _allowedConnectionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AllowedConnectionsRestOperations AllowedConnectionsRestClient => _allowedConnectionsRestClient ??= new AllowedConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics TopologyClientDiagnostics => _topologyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private TopologyRestOperations TopologyRestClient => _topologyRestClient ??= new TopologyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics JitNetworkAccessPolicyClientDiagnostics => _jitNetworkAccessPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", JitNetworkAccessPolicyResource.ResourceType.Namespace, Diagnostics); - private JitNetworkAccessPoliciesRestOperations JitNetworkAccessPolicyRestClient => _jitNetworkAccessPolicyRestClient ??= new JitNetworkAccessPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(JitNetworkAccessPolicyResource.ResourceType)); - private ClientDiagnostics DiscoveredSecuritySolutionsClientDiagnostics => _discoveredSecuritySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DiscoveredSecuritySolutionsRestOperations DiscoveredSecuritySolutionsRestClient => _discoveredSecuritySolutionsRestClient ??= new DiscoveredSecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics securitySolutionsReferenceDataClientDiagnostics => _securitySolutionsReferenceDataClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SecuritySolutionsReferenceDataRestOperations securitySolutionsReferenceDataRestClient => _securitySolutionsReferenceDataRestClient ??= new SecuritySolutionsReferenceDataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ExternalSecuritySolutionsClientDiagnostics => _externalSecuritySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ExternalSecuritySolutionsRestOperations ExternalSecuritySolutionsRestClient => _externalSecuritySolutionsRestClient ??= new ExternalSecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SecureScoreControlsClientDiagnostics => _secureScoreControlsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SecureScoreControlsRestOperations SecureScoreControlsRestClient => _secureScoreControlsRestClient ??= new SecureScoreControlsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SecureScoreControlDefinitionsClientDiagnostics => _secureScoreControlDefinitionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SecureScoreControlDefinitionsRestOperations SecureScoreControlDefinitionsRestClient => _secureScoreControlDefinitionsRestClient ??= new SecureScoreControlDefinitionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SecuritySolutionsClientDiagnostics => _securitySolutionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SecuritySolutionsRestOperations SecuritySolutionsRestClient => _securitySolutionsRestClient ??= new SecuritySolutionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AlertsClientDiagnostics => _alertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AlertsRestOperations AlertsRestClient => _alertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SoftwareInventoryClientDiagnostics => _softwareInventoryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SoftwareInventoryResource.ResourceType.Namespace, Diagnostics); - private SoftwareInventoriesRestOperations SoftwareInventoryRestClient => _softwareInventoryRestClient ??= new SoftwareInventoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SoftwareInventoryResource.ResourceType)); - private ClientDiagnostics SecurityConnectorClientDiagnostics => _securityConnectorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", SecurityConnectorResource.ResourceType.Namespace, Diagnostics); - private SecurityConnectorsRestOperations SecurityConnectorRestClient => _securityConnectorRestClient ??= new SecurityConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecurityConnectorResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of SecurityCenterPricingResources in the SubscriptionResource. - /// An object representing collection of SecurityCenterPricingResources and their operations over a SecurityCenterPricingResource. - public virtual SecurityCenterPricingCollection GetSecurityCenterPricings() - { - return GetCachedClient(Client => new SecurityCenterPricingCollection(Client, Id)); - } - - /// Gets a collection of SecurityCenterLocationResources in the SubscriptionResource. - /// An object representing collection of SecurityCenterLocationResources and their operations over a SecurityCenterLocationResource. - public virtual SecurityCenterLocationCollection GetSecurityCenterLocations() - { - return GetCachedClient(Client => new SecurityCenterLocationCollection(Client, Id)); - } - - /// Gets a collection of AutoProvisioningSettingResources in the SubscriptionResource. - /// An object representing collection of AutoProvisioningSettingResources and their operations over a AutoProvisioningSettingResource. - public virtual AutoProvisioningSettingCollection GetAutoProvisioningSettings() - { - return GetCachedClient(Client => new AutoProvisioningSettingCollection(Client, Id)); - } - - /// Gets a collection of SecurityContactResources in the SubscriptionResource. - /// An object representing collection of SecurityContactResources and their operations over a SecurityContactResource. - public virtual SecurityContactCollection GetSecurityContacts() - { - return GetCachedClient(Client => new SecurityContactCollection(Client, Id)); - } - - /// Gets a collection of SecurityWorkspaceSettingResources in the SubscriptionResource. - /// An object representing collection of SecurityWorkspaceSettingResources and their operations over a SecurityWorkspaceSettingResource. - public virtual SecurityWorkspaceSettingCollection GetSecurityWorkspaceSettings() - { - return GetCachedClient(Client => new SecurityWorkspaceSettingCollection(Client, Id)); - } - - /// Gets a collection of RegulatoryComplianceStandardResources in the SubscriptionResource. - /// An object representing collection of RegulatoryComplianceStandardResources and their operations over a RegulatoryComplianceStandardResource. - public virtual RegulatoryComplianceStandardCollection GetRegulatoryComplianceStandards() - { - return GetCachedClient(Client => new RegulatoryComplianceStandardCollection(Client, Id)); - } - - /// Gets a collection of SecurityAlertsSuppressionRuleResources in the SubscriptionResource. - /// An object representing collection of SecurityAlertsSuppressionRuleResources and their operations over a SecurityAlertsSuppressionRuleResource. - public virtual SecurityAlertsSuppressionRuleCollection GetSecurityAlertsSuppressionRules() - { - return GetCachedClient(Client => new SecurityAlertsSuppressionRuleCollection(Client, Id)); - } - - /// Gets a collection of SubscriptionAssessmentMetadataResources in the SubscriptionResource. - /// An object representing collection of SubscriptionAssessmentMetadataResources and their operations over a SubscriptionAssessmentMetadataResource. - public virtual SubscriptionAssessmentMetadataCollection GetAllSubscriptionAssessmentMetadata() - { - return GetCachedClient(Client => new SubscriptionAssessmentMetadataCollection(Client, Id)); - } - - /// Gets a collection of SecureScoreResources in the SubscriptionResource. - /// An object representing collection of SecureScoreResources and their operations over a SecureScoreResource. - public virtual SecureScoreCollection GetSecureScores() - { - return GetCachedClient(Client => new SecureScoreCollection(Client, Id)); - } - - /// Gets a collection of SecurityCloudConnectorResources in the SubscriptionResource. - /// An object representing collection of SecurityCloudConnectorResources and their operations over a SecurityCloudConnectorResource. - public virtual SecurityCloudConnectorCollection GetSecurityCloudConnectors() - { - return GetCachedClient(Client => new SecurityCloudConnectorCollection(Client, Id)); - } - - /// Gets a collection of SecuritySettingResources in the SubscriptionResource. - /// An object representing collection of SecuritySettingResources and their operations over a SecuritySettingResource. - public virtual SecuritySettingCollection GetSecuritySettings() - { - return GetCachedClient(Client => new SecuritySettingCollection(Client, Id)); - } - - /// Gets a collection of IngestionSettingResources in the SubscriptionResource. - /// An object representing collection of IngestionSettingResources and their operations over a IngestionSettingResource. - public virtual IngestionSettingCollection GetIngestionSettings() - { - return GetCachedClient(Client => new IngestionSettingCollection(Client, Id)); - } - - /// Gets a collection of SubscriptionSecurityApplicationResources in the SubscriptionResource. - /// An object representing collection of SubscriptionSecurityApplicationResources and their operations over a SubscriptionSecurityApplicationResource. - public virtual SubscriptionSecurityApplicationCollection GetSubscriptionSecurityApplications() - { - return GetCachedClient(Client => new SubscriptionSecurityApplicationCollection(Client, Id)); - } - - /// - /// The configuration or data needed to onboard the machine to MDE - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings - /// - /// - /// Operation Id - /// MdeOnboardings_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMdeOnboardingsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MdeOnboardingsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MdeOnboarding.DeserializeMdeOnboarding, MdeOnboardingsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMdeOnboardings", "value", null, cancellationToken); - } - - /// - /// The configuration or data needed to onboard the machine to MDE - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings - /// - /// - /// Operation Id - /// MdeOnboardings_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMdeOnboardings(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MdeOnboardingsRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, MdeOnboarding.DeserializeMdeOnboarding, MdeOnboardingsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetMdeOnboardings", "value", null, cancellationToken); - } - - /// - /// The default configuration or data needed to onboard the machine to MDE - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default - /// - /// - /// Operation Id - /// MdeOnboardings_Get - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetMdeOnboardingAsync(CancellationToken cancellationToken = default) - { - using var scope = MdeOnboardingsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetMdeOnboarding"); - scope.Start(); - try - { - var response = await MdeOnboardingsRestClient.GetAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// The default configuration or data needed to onboard the machine to MDE - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default - /// - /// - /// Operation Id - /// MdeOnboardings_Get - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetMdeOnboarding(CancellationToken cancellationToken = default) - { - using var scope = MdeOnboardingsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetMdeOnboarding"); - scope.Start(); - try - { - var response = MdeOnboardingsRestClient.Get(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List custom assessment automations by provided subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations - /// - /// - /// Operation Id - /// CustomAssessmentAutomations_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCustomAssessmentAutomationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CustomAssessmentAutomationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomAssessmentAutomationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CustomAssessmentAutomationResource(Client, CustomAssessmentAutomationData.DeserializeCustomAssessmentAutomationData(e)), CustomAssessmentAutomationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCustomAssessmentAutomations", "value", "nextLink", cancellationToken); - } - - /// - /// List custom assessment automations by provided subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations - /// - /// - /// Operation Id - /// CustomAssessmentAutomations_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCustomAssessmentAutomations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CustomAssessmentAutomationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomAssessmentAutomationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CustomAssessmentAutomationResource(Client, CustomAssessmentAutomationData.DeserializeCustomAssessmentAutomationData(e)), CustomAssessmentAutomationClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCustomAssessmentAutomations", "value", "nextLink", cancellationToken); - } - - /// - /// List custom entity store assignments by provided subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments - /// - /// - /// Operation Id - /// CustomEntityStoreAssignments_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCustomEntityStoreAssignmentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CustomEntityStoreAssignmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomEntityStoreAssignmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CustomEntityStoreAssignmentResource(Client, CustomEntityStoreAssignmentData.DeserializeCustomEntityStoreAssignmentData(e)), CustomEntityStoreAssignmentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCustomEntityStoreAssignments", "value", "nextLink", cancellationToken); - } - - /// - /// List custom entity store assignments by provided subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments - /// - /// - /// Operation Id - /// CustomEntityStoreAssignments_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCustomEntityStoreAssignments(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CustomEntityStoreAssignmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CustomEntityStoreAssignmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CustomEntityStoreAssignmentResource(Client, CustomEntityStoreAssignmentData.DeserializeCustomEntityStoreAssignmentData(e)), CustomEntityStoreAssignmentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetCustomEntityStoreAssignments", "value", "nextLink", cancellationToken); - } - - /// - /// Use this method to get the list of IoT Security solutions by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions - /// - /// - /// Operation Id - /// IotSecuritySolution_ListBySubscription - /// - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetIotSecuritySolutionsAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IotSecuritySolutionRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotSecuritySolutionRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IotSecuritySolutionResource(Client, IotSecuritySolutionData.DeserializeIotSecuritySolutionData(e)), IotSecuritySolutionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIotSecuritySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// Use this method to get the list of IoT Security solutions by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions - /// - /// - /// Operation Id - /// IotSecuritySolution_ListBySubscription - /// - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetIotSecuritySolutions(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => IotSecuritySolutionRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => IotSecuritySolutionRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IotSecuritySolutionResource(Client, IotSecuritySolutionData.DeserializeIotSecuritySolutionData(e)), IotSecuritySolutionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetIotSecuritySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// Recommended tasks that will help improve the security of the subscription proactively - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks - /// - /// - /// Operation Id - /// Tasks_List - /// - /// - /// - /// OData filter. Optional. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetTasksAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TasksRestClient.CreateListRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TasksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityTaskData.DeserializeSecurityTaskData, TasksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTasks", "value", "nextLink", cancellationToken); - } - - /// - /// Recommended tasks that will help improve the security of the subscription proactively - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/tasks - /// - /// - /// Operation Id - /// Tasks_List - /// - /// - /// - /// OData filter. Optional. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetTasks(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TasksRestClient.CreateListRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TasksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityTaskData.DeserializeSecurityTaskData, TasksClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTasks", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to get the next page of security automations for the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/automations - /// - /// - /// Operation Id - /// Automations_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecurityAutomationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityAutomationAutomationsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityAutomationAutomationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecurityAutomationResource(Client, SecurityAutomationData.DeserializeSecurityAutomationData(e)), SecurityAutomationAutomationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecurityAutomations", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response to get the next page of security automations for the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/automations - /// - /// - /// Operation Id - /// Automations_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecurityAutomations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityAutomationAutomationsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityAutomationAutomationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecurityAutomationResource(Client, SecurityAutomationData.DeserializeSecurityAutomationData(e)), SecurityAutomationAutomationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecurityAutomations", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of application control machine groups for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings - /// - /// - /// Operation Id - /// AdaptiveApplicationControls_List - /// - /// - /// - /// Include the policy rules. - /// Return output in a summarized form. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAdaptiveApplicationControlGroupsAsync(bool? includePathRecommendations = null, bool? summary = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AdaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient.CreateListRequest(Id.SubscriptionId, includePathRecommendations, summary); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AdaptiveApplicationControlGroupResource(Client, AdaptiveApplicationControlGroupData.DeserializeAdaptiveApplicationControlGroupData(e)), AdaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAdaptiveApplicationControlGroups", "value", null, cancellationToken); - } - - /// - /// Gets a list of application control machine groups for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings - /// - /// - /// Operation Id - /// AdaptiveApplicationControls_List - /// - /// - /// - /// Include the policy rules. - /// Return output in a summarized form. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAdaptiveApplicationControlGroups(bool? includePathRecommendations = null, bool? summary = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AdaptiveApplicationControlGroupAdaptiveApplicationControlsRestClient.CreateListRequest(Id.SubscriptionId, includePathRecommendations, summary); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AdaptiveApplicationControlGroupResource(Client, AdaptiveApplicationControlGroupData.DeserializeAdaptiveApplicationControlGroupData(e)), AdaptiveApplicationControlGroupAdaptiveApplicationControlsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAdaptiveApplicationControlGroups", "value", null, cancellationToken); - } - - /// - /// Gets the list of all possible traffic between resources for the subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections - /// - /// - /// Operation Id - /// AllowedConnections_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllowedConnectionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AllowedConnectionsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AllowedConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityCenterAllowedConnection.DeserializeSecurityCenterAllowedConnection, AllowedConnectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllowedConnections", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the list of all possible traffic between resources for the subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections - /// - /// - /// Operation Id - /// AllowedConnections_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllowedConnections(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AllowedConnectionsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AllowedConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityCenterAllowedConnection.DeserializeSecurityCenterAllowedConnection, AllowedConnectionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllowedConnections", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies - /// - /// - /// Operation Id - /// Topology_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetTopologiesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TopologyRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TopologyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityTopologyResource.DeserializeSecurityTopologyResource, TopologyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTopologies", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies - /// - /// - /// Operation Id - /// Topology_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetTopologies(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TopologyRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TopologyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityTopologyResource.DeserializeSecurityTopologyResource, TopologyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTopologies", "value", "nextLink", cancellationToken); - } - - /// - /// Policies for protecting resources using Just-in-Time access control. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies - /// - /// - /// Operation Id - /// JitNetworkAccessPolicies_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetJitNetworkAccessPoliciesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => JitNetworkAccessPolicyRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => JitNetworkAccessPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new JitNetworkAccessPolicyResource(Client, JitNetworkAccessPolicyData.DeserializeJitNetworkAccessPolicyData(e)), JitNetworkAccessPolicyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetJitNetworkAccessPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Policies for protecting resources using Just-in-Time access control. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies - /// - /// - /// Operation Id - /// JitNetworkAccessPolicies_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetJitNetworkAccessPolicies(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => JitNetworkAccessPolicyRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => JitNetworkAccessPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new JitNetworkAccessPolicyResource(Client, JitNetworkAccessPolicyData.DeserializeJitNetworkAccessPolicyData(e)), JitNetworkAccessPolicyClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetJitNetworkAccessPolicies", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions - /// - /// - /// Operation Id - /// DiscoveredSecuritySolutions_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDiscoveredSecuritySolutionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiscoveredSecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiscoveredSecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DiscoveredSecuritySolution.DeserializeDiscoveredSecuritySolution, DiscoveredSecuritySolutionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiscoveredSecuritySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions - /// - /// - /// Operation Id - /// DiscoveredSecuritySolutions_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDiscoveredSecuritySolutions(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiscoveredSecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiscoveredSecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DiscoveredSecuritySolution.DeserializeDiscoveredSecuritySolution, DiscoveredSecuritySolutionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiscoveredSecuritySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all supported Security Solutions for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData - /// - /// - /// Operation Id - /// securitySolutionsReferenceData_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllSecuritySolutionsReferenceDataAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => securitySolutionsReferenceDataRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, SecuritySolutionsReferenceData.DeserializeSecuritySolutionsReferenceData, securitySolutionsReferenceDataClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllSecuritySolutionsReferenceData", "value", null, cancellationToken); - } - - /// - /// Gets a list of all supported Security Solutions for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData - /// - /// - /// Operation Id - /// securitySolutionsReferenceData_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllSecuritySolutionsReferenceData(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => securitySolutionsReferenceDataRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, SecuritySolutionsReferenceData.DeserializeSecuritySolutionsReferenceData, securitySolutionsReferenceDataClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllSecuritySolutionsReferenceData", "value", null, cancellationToken); - } - - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions - /// - /// - /// Operation Id - /// ExternalSecuritySolutions_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetExternalSecuritySolutionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExternalSecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExternalSecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ExternalSecuritySolution.DeserializeExternalSecuritySolution, ExternalSecuritySolutionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExternalSecuritySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions - /// - /// - /// Operation Id - /// ExternalSecuritySolutions_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetExternalSecuritySolutions(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ExternalSecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ExternalSecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ExternalSecuritySolution.DeserializeExternalSecuritySolution, ExternalSecuritySolutionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetExternalSecuritySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// Get all security controls within a scope - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls - /// - /// - /// Operation Id - /// SecureScoreControls_List - /// - /// - /// - /// OData expand. Optional. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecureScoreControlsAsync(SecurityScoreODataExpand? expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlsRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecureScoreControlDetails.DeserializeSecureScoreControlDetails, SecureScoreControlsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecureScoreControls", "value", "nextLink", cancellationToken); - } - - /// - /// Get all security controls within a scope - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls - /// - /// - /// Operation Id - /// SecureScoreControls_List - /// - /// - /// - /// OData expand. Optional. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecureScoreControls(SecurityScoreODataExpand? expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlsRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecureScoreControlDetails.DeserializeSecureScoreControlDetails, SecureScoreControlsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecureScoreControls", "value", "nextLink", cancellationToken); - } - - /// - /// For a specified subscription, list the available security controls, their assessments, and the max score - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions - /// - /// - /// Operation Id - /// SecureScoreControlDefinitions_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecureScoreControlDefinitionsBySubscriptionAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlDefinitionsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlDefinitionsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecureScoreControlDefinitionItem.DeserializeSecureScoreControlDefinitionItem, SecureScoreControlDefinitionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecureScoreControlDefinitionsBySubscription", "value", "nextLink", cancellationToken); - } - - /// - /// For a specified subscription, list the available security controls, their assessments, and the max score - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions - /// - /// - /// Operation Id - /// SecureScoreControlDefinitions_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecureScoreControlDefinitionsBySubscription(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlDefinitionsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlDefinitionsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecureScoreControlDefinitionItem.DeserializeSecureScoreControlDefinitionItem, SecureScoreControlDefinitionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecureScoreControlDefinitionsBySubscription", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions - /// - /// - /// Operation Id - /// SecuritySolutions_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecuritySolutionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecuritySolution.DeserializeSecuritySolution, SecuritySolutionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecuritySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions - /// - /// - /// Operation Id - /// SecuritySolutions_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecuritySolutions(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecuritySolutionsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecuritySolutionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecuritySolution.DeserializeSecuritySolution, SecuritySolutionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecuritySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts - /// - /// - /// Operation Id - /// Alerts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAlertsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AlertsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecurityAlertData.DeserializeSecurityAlertData, AlertsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlerts", "value", "nextLink", cancellationToken); - } - - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts - /// - /// - /// Operation Id - /// Alerts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAlerts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AlertsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AlertsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecurityAlertData.DeserializeSecurityAlertData, AlertsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAlerts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the software inventory of all virtual machines in the subscriptions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories - /// - /// - /// Operation Id - /// SoftwareInventories_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSoftwareInventoriesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SoftwareInventoryRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SoftwareInventoryRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SoftwareInventoryResource(Client, SoftwareInventoryData.DeserializeSoftwareInventoryData(e)), SoftwareInventoryClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSoftwareInventories", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the software inventory of all virtual machines in the subscriptions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories - /// - /// - /// Operation Id - /// SoftwareInventories_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSoftwareInventories(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SoftwareInventoryRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SoftwareInventoryRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SoftwareInventoryResource(Client, SoftwareInventoryData.DeserializeSoftwareInventoryData(e)), SoftwareInventoryClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSoftwareInventories", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors - /// - /// - /// Operation Id - /// SecurityConnectors_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecurityConnectorsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityConnectorRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityConnectorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecurityConnectorResource(Client, SecurityConnectorData.DeserializeSecurityConnectorData(e)), SecurityConnectorClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecurityConnectors", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors - /// - /// - /// Operation Id - /// SecurityConnectors_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecurityConnectors(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecurityConnectorRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecurityConnectorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecurityConnectorResource(Client, SecurityConnectorData.DeserializeSecurityConnectorData(e)), SecurityConnectorClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSecurityConnectors", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index ed5a09bddc2d4..0000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.SecurityCenter.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _secureScoreControlDefinitionsClientDiagnostics; - private SecureScoreControlDefinitionsRestOperations _secureScoreControlDefinitionsRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics SecureScoreControlDefinitionsClientDiagnostics => _secureScoreControlDefinitionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SecureScoreControlDefinitionsRestOperations SecureScoreControlDefinitionsRestClient => _secureScoreControlDefinitionsRestClient ??= new SecureScoreControlDefinitionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of TenantAssessmentMetadataResources in the TenantResource. - /// An object representing collection of TenantAssessmentMetadataResources and their operations over a TenantAssessmentMetadataResource. - public virtual TenantAssessmentMetadataCollection GetAllTenantAssessmentMetadata() - { - return GetCachedClient(Client => new TenantAssessmentMetadataCollection(Client, Id)); - } - - /// - /// List the available security controls, their assessments, and the max score - /// - /// - /// Request Path - /// /providers/Microsoft.Security/secureScoreControlDefinitions - /// - /// - /// Operation Id - /// SecureScoreControlDefinitions_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSecureScoreControlDefinitionsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlDefinitionsRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlDefinitionsRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SecureScoreControlDefinitionItem.DeserializeSecureScoreControlDefinitionItem, SecureScoreControlDefinitionsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetSecureScoreControlDefinitions", "value", "nextLink", cancellationToken); - } - - /// - /// List the available security controls, their assessments, and the max score - /// - /// - /// Request Path - /// /providers/Microsoft.Security/secureScoreControlDefinitions - /// - /// - /// Operation Id - /// SecureScoreControlDefinitions_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSecureScoreControlDefinitions(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SecureScoreControlDefinitionsRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecureScoreControlDefinitionsRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SecureScoreControlDefinitionItem.DeserializeSecureScoreControlDefinitionItem, SecureScoreControlDefinitionsClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetSecureScoreControlDefinitions", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceAssignmentResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceAssignmentResource.cs index ba87f3add3094..001820bf7b5a4 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceAssignmentResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceAssignmentResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class GovernanceAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The assessmentName. + /// The assignmentKey. public static ResourceIdentifier CreateResourceIdentifier(string scope, string assessmentName, string assignmentKey) { var resourceId = $"{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceRuleResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceRuleResource.cs index 4587841999ec7..148479630fefb 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceRuleResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/GovernanceRuleResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class GovernanceRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The ruleId. public static ResourceIdentifier CreateResourceIdentifier(string scope, string ruleId) { var resourceId = $"{scope}/providers/Microsoft.Security/governanceRules/{ruleId}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingResource.cs index 15d5654eeb8d7..a535fe89e3cba 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingResource.cs @@ -28,6 +28,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class IngestionSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The ingestionSettingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string ingestionSettingName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedAlertResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedAlertResource.cs index 2ffb2d0fb7e24..e02b0b8e3342b 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedAlertResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedAlertResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityCenter public partial class IotSecurityAggregatedAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The solutionName. + /// The aggregatedAlertName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string solutionName, string aggregatedAlertName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedRecommendationResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedRecommendationResource.cs index cc189889a8700..3e2b30fc0f4f3 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedRecommendationResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecurityAggregatedRecommendationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityCenter public partial class IotSecurityAggregatedRecommendationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The solutionName. + /// The aggregatedRecommendationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string solutionName, string aggregatedRecommendationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsModelResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsModelResource.cs index 68a56801c3fa9..e76e6e16a3a9b 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsModelResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsModelResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class IotSecuritySolutionAnalyticsModelResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The solutionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string solutionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default"; @@ -90,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of IotSecurityAggregatedAlertResources and their operations over a IotSecurityAggregatedAlertResource. public virtual IotSecurityAggregatedAlertCollection GetIotSecurityAggregatedAlerts() { - return GetCachedClient(Client => new IotSecurityAggregatedAlertCollection(Client, Id)); + return GetCachedClient(client => new IotSecurityAggregatedAlertCollection(client, Id)); } /// @@ -108,8 +111,8 @@ public virtual IotSecurityAggregatedAlertCollection GetIotSecurityAggregatedAler /// /// Identifier of the aggregated alert. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIotSecurityAggregatedAlertAsync(string aggregatedAlertName, CancellationToken cancellationToken = default) { @@ -131,8 +134,8 @@ public virtual async Task> GetIotSe /// /// Identifier of the aggregated alert. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIotSecurityAggregatedAlert(string aggregatedAlertName, CancellationToken cancellationToken = default) { @@ -143,7 +146,7 @@ public virtual Response GetIotSecurityAggreg /// An object representing collection of IotSecurityAggregatedRecommendationResources and their operations over a IotSecurityAggregatedRecommendationResource. public virtual IotSecurityAggregatedRecommendationCollection GetIotSecurityAggregatedRecommendations() { - return GetCachedClient(Client => new IotSecurityAggregatedRecommendationCollection(Client, Id)); + return GetCachedClient(client => new IotSecurityAggregatedRecommendationCollection(client, Id)); } /// @@ -161,8 +164,8 @@ public virtual IotSecurityAggregatedRecommendationCollection GetIotSecurityAggre /// /// Name of the recommendation aggregated for this query. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIotSecurityAggregatedRecommendationAsync(string aggregatedRecommendationName, CancellationToken cancellationToken = default) { @@ -184,8 +187,8 @@ public virtual async Task> /// /// Name of the recommendation aggregated for this query. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIotSecurityAggregatedRecommendation(string aggregatedRecommendationName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionResource.cs index 6a65ac8503eb5..05c71cb281b99 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class IotSecuritySolutionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The solutionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string solutionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/JitNetworkAccessPolicyResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/JitNetworkAccessPolicyResource.cs index 6c885e495975e..54428dd48010f 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/JitNetworkAccessPolicyResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/JitNetworkAccessPolicyResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.SecurityCenter public partial class JitNetworkAccessPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ascLocation. + /// The jitNetworkAccessPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation ascLocation, string jitNetworkAccessPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentResource.cs index cf165cfcca219..f0f6013629278 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityCenter public partial class RegulatoryComplianceAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The regulatoryComplianceStandardName. + /// The regulatoryComplianceControlName. + /// The regulatoryComplianceAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string regulatoryComplianceStandardName, string regulatoryComplianceControlName, string regulatoryComplianceAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlResource.cs index a26741d950319..537a4187b9887 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class RegulatoryComplianceControlResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The regulatoryComplianceStandardName. + /// The regulatoryComplianceControlName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string regulatoryComplianceStandardName, string regulatoryComplianceControlName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}"; @@ -90,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RegulatoryComplianceAssessmentResources and their operations over a RegulatoryComplianceAssessmentResource. public virtual RegulatoryComplianceAssessmentCollection GetRegulatoryComplianceAssessments() { - return GetCachedClient(Client => new RegulatoryComplianceAssessmentCollection(Client, Id)); + return GetCachedClient(client => new RegulatoryComplianceAssessmentCollection(client, Id)); } /// @@ -108,8 +111,8 @@ public virtual RegulatoryComplianceAssessmentCollection GetRegulatoryComplianceA /// /// Name of the regulatory compliance assessment object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRegulatoryComplianceAssessmentAsync(string regulatoryComplianceAssessmentName, CancellationToken cancellationToken = default) { @@ -131,8 +134,8 @@ public virtual async Task> GetR /// /// Name of the regulatory compliance assessment object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRegulatoryComplianceAssessment(string regulatoryComplianceAssessmentName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardResource.cs index f271c4a10e309..0ec4b80e3a4e4 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class RegulatoryComplianceStandardResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The regulatoryComplianceStandardName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string regulatoryComplianceStandardName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}"; @@ -91,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RegulatoryComplianceControlResources and their operations over a RegulatoryComplianceControlResource. public virtual RegulatoryComplianceControlCollection GetRegulatoryComplianceControls() { - return GetCachedClient(Client => new RegulatoryComplianceControlCollection(Client, Id)); + return GetCachedClient(client => new RegulatoryComplianceControlCollection(client, Id)); } /// @@ -109,8 +111,8 @@ public virtual RegulatoryComplianceControlCollection GetRegulatoryComplianceCont /// /// Name of the regulatory compliance control object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRegulatoryComplianceControlAsync(string regulatoryComplianceControlName, CancellationToken cancellationToken = default) { @@ -132,8 +134,8 @@ public virtual async Task> GetRegu /// /// Name of the regulatory compliance control object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRegulatoryComplianceControl(string regulatoryComplianceControlName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityAlertResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityAlertResource.cs index 9991d72c8946b..736975bafc4a6 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityAlertResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityAlertResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.SecurityCenter public partial class ResourceGroupSecurityAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ascLocation. + /// The alertName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation ascLocation, string alertName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityTaskResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityTaskResource.cs index 6c9b0efc9450f..fac52c8255fe7 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityTaskResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ResourceGroupSecurityTaskResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.SecurityCenter public partial class ResourceGroupSecurityTaskResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The ascLocation. + /// The taskName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation ascLocation, string taskName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecureScoreResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecureScoreResource.cs index 4b9f5fbee08ec..ce1d3374fc207 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecureScoreResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecureScoreResource.cs @@ -28,6 +28,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecureScoreResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The secureScoreName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string secureScoreName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAlertsSuppressionRuleResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAlertsSuppressionRuleResource.cs index 678cae15371bc..eadd6cd93ca45 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAlertsSuppressionRuleResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAlertsSuppressionRuleResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityAlertsSuppressionRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The alertsSuppressionRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string alertsSuppressionRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentResource.cs index 89270bc272c2a..54f3233f31209 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceId. + /// The assessmentName. public static ResourceIdentifier CreateResourceIdentifier(string resourceId, string assessmentName) { var resourceId0 = $"{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"; @@ -91,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SecuritySubAssessmentResources and their operations over a SecuritySubAssessmentResource. public virtual SecuritySubAssessmentCollection GetSecuritySubAssessments() { - return GetCachedClient(Client => new SecuritySubAssessmentCollection(Client, Id)); + return GetCachedClient(client => new SecuritySubAssessmentCollection(client, Id)); } /// @@ -109,8 +111,8 @@ public virtual SecuritySubAssessmentCollection GetSecuritySubAssessments() /// /// The Sub-Assessment Key - Unique key for the sub-assessment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecuritySubAssessmentAsync(string subAssessmentName, CancellationToken cancellationToken = default) { @@ -132,8 +134,8 @@ public virtual async Task> GetSecuritySu /// /// The Sub-Assessment Key - Unique key for the sub-assessment type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecuritySubAssessment(string subAssessmentName, CancellationToken cancellationToken = default) { @@ -144,7 +146,7 @@ public virtual Response GetSecuritySubAssessment( /// An object representing collection of GovernanceAssignmentResources and their operations over a GovernanceAssignmentResource. public virtual GovernanceAssignmentCollection GetGovernanceAssignments() { - return GetCachedClient(Client => new GovernanceAssignmentCollection(Client, Id)); + return GetCachedClient(client => new GovernanceAssignmentCollection(client, Id)); } /// @@ -162,8 +164,8 @@ public virtual GovernanceAssignmentCollection GetGovernanceAssignments() /// /// The governance assignment key - the assessment key of the required governance assignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGovernanceAssignmentAsync(string assignmentKey, CancellationToken cancellationToken = default) { @@ -185,8 +187,8 @@ public virtual async Task> GetGovernanceA /// /// The governance assignment key - the assessment key of the required governance assignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGovernanceAssignment(string assignmentKey, CancellationToken cancellationToken = default) { diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAutomationResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAutomationResource.cs index 383e76506e59f..fb7362406851c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAutomationResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAutomationResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityAutomationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The automationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string automationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationResource.cs index 9d76a610e7c71..3005fa3539070 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationResource.cs @@ -28,6 +28,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityCenterLocationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The ascLocation. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation ascLocation) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}"; @@ -118,7 +120,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SubscriptionSecurityTaskResources and their operations over a SubscriptionSecurityTaskResource. public virtual SubscriptionSecurityTaskCollection GetSubscriptionSecurityTasks() { - return GetCachedClient(Client => new SubscriptionSecurityTaskCollection(Client, Id)); + return GetCachedClient(client => new SubscriptionSecurityTaskCollection(client, Id)); } /// @@ -136,8 +138,8 @@ public virtual SubscriptionSecurityTaskCollection GetSubscriptionSecurityTasks() /// /// Name of the task object, will be a GUID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSubscriptionSecurityTaskAsync(string taskName, CancellationToken cancellationToken = default) { @@ -159,8 +161,8 @@ public virtual async Task> GetSubscri /// /// Name of the task object, will be a GUID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSubscriptionSecurityTask(string taskName, CancellationToken cancellationToken = default) { @@ -171,7 +173,7 @@ public virtual Response GetSubscriptionSecurit /// An object representing collection of AdaptiveApplicationControlGroupResources and their operations over a AdaptiveApplicationControlGroupResource. public virtual AdaptiveApplicationControlGroupCollection GetAdaptiveApplicationControlGroups() { - return GetCachedClient(Client => new AdaptiveApplicationControlGroupCollection(Client, Id)); + return GetCachedClient(client => new AdaptiveApplicationControlGroupCollection(client, Id)); } /// @@ -189,8 +191,8 @@ public virtual AdaptiveApplicationControlGroupCollection GetAdaptiveApplicationC /// /// Name of an application control machine group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAdaptiveApplicationControlGroupAsync(string groupName, CancellationToken cancellationToken = default) { @@ -212,8 +214,8 @@ public virtual async Task> Get /// /// Name of an application control machine group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAdaptiveApplicationControlGroup(string groupName, CancellationToken cancellationToken = default) { @@ -224,7 +226,7 @@ public virtual Response GetAdaptiveAppl /// An object representing collection of SubscriptionSecurityAlertResources and their operations over a SubscriptionSecurityAlertResource. public virtual SubscriptionSecurityAlertCollection GetSubscriptionSecurityAlerts() { - return GetCachedClient(Client => new SubscriptionSecurityAlertCollection(Client, Id)); + return GetCachedClient(client => new SubscriptionSecurityAlertCollection(client, Id)); } /// @@ -242,8 +244,8 @@ public virtual SubscriptionSecurityAlertCollection GetSubscriptionSecurityAlerts /// /// Name of the alert object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSubscriptionSecurityAlertAsync(string alertName, CancellationToken cancellationToken = default) { @@ -265,8 +267,8 @@ public virtual async Task> GetSubscr /// /// Name of the alert object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSubscriptionSecurityAlert(string alertName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterPricingResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterPricingResource.cs index 50ee349aa4e21..9e37fdecce16e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterPricingResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterPricingResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityCenterPricingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The pricingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string pricingName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCloudConnectorResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCloudConnectorResource.cs index cf5493e3d76da..cd44d3aa8be64 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCloudConnectorResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCloudConnectorResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityCloudConnectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The connectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string connectorName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityComplianceResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityComplianceResource.cs index 95c661118d211..df4478b2d6ad9 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityComplianceResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityComplianceResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityComplianceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The complianceName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string complianceName) { var resourceId = $"{scope}/providers/Microsoft.Security/compliances/{complianceName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorApplicationResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorApplicationResource.cs index d6c0693cbbd71..03d180ec64854 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorApplicationResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorApplicationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityConnectorApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The securityConnectorName. + /// The applicationId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string securityConnectorName, string applicationId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorResource.cs index c88e577875ca6..c27f7d9a879bc 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityConnectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The securityConnectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string securityConnectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SecurityConnectorApplicationResources and their operations over a SecurityConnectorApplicationResource. public virtual SecurityConnectorApplicationCollection GetSecurityConnectorApplications() { - return GetCachedClient(Client => new SecurityConnectorApplicationCollection(Client, Id)); + return GetCachedClient(client => new SecurityConnectorApplicationCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual SecurityConnectorApplicationCollection GetSecurityConnectorApplic /// /// The security Application key - unique key for the standard application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityConnectorApplicationAsync(string applicationId, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetSec /// /// The security Application key - unique key for the standard application. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityConnectorApplication(string applicationId, CancellationToken cancellationToken = default) { diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityContactResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityContactResource.cs index c5387e8779009..7375b7c65eb2c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityContactResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityContactResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityContactResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The securityContactName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string securityContactName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySettingResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySettingResource.cs index 85678d24d8597..5ba87392654a3 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySettingResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySettingResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecuritySettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The settingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, SecuritySettingName settingName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySubAssessmentResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySubAssessmentResource.cs index a9c4057e566e8..0ee0c9d222454 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySubAssessmentResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecuritySubAssessmentResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecuritySubAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The assessmentName. + /// The subAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string assessmentName, string subAssessmentName) { var resourceId = $"{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityWorkspaceSettingResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityWorkspaceSettingResource.cs index 2b3a78ded72a6..9f608367f6ab0 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityWorkspaceSettingResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityWorkspaceSettingResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SecurityWorkspaceSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The workspaceSettingName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workspaceSettingName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentResource.cs index 35866a19af7bf..8e9c59ef76726 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.SecurityCenter public partial class ServerVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceNamespace. + /// The resourceType. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/default"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SoftwareInventoryResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SoftwareInventoryResource.cs index af830d1f22392..044d544ddd6c3 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SoftwareInventoryResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SoftwareInventoryResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SoftwareInventoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceNamespace. + /// The resourceType. + /// The resourceName. + /// The softwareName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string softwareName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRuleResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRuleResource.cs index 3b4590661cdae..a5ea67e3afff5 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRuleResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRuleResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SqlVulnerabilityAssessmentBaselineRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceId. + /// The ruleId. public static ResourceIdentifier CreateResourceIdentifier(string resourceId, string ruleId) { var resourceId0 = $"{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResource.cs index af0eee0569e9f..8f5984e20bf0d 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SqlVulnerabilityAssessmentScanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceId. + /// The scanId. public static ResourceIdentifier CreateResourceIdentifier(string resourceId, string scanId) { var resourceId0 = $"{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionAssessmentMetadataResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionAssessmentMetadataResource.cs index 6282617b8e46a..423ba94120f0d 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionAssessmentMetadataResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionAssessmentMetadataResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SubscriptionAssessmentMetadataResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The assessmentMetadataName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string assessmentMetadataName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityAlertResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityAlertResource.cs index 8ff9edc862cc4..4d3845852817c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityAlertResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityAlertResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SubscriptionSecurityAlertResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The ascLocation. + /// The alertName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation ascLocation, string alertName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityApplicationResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityApplicationResource.cs index 7de3a2dfac6c8..6740bf235ad3e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityApplicationResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityApplicationResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SubscriptionSecurityApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The applicationId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string applicationId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityTaskResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityTaskResource.cs index b9d2a2954b11d..2f06ca4c4d042 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityTaskResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SubscriptionSecurityTaskResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.SecurityCenter public partial class SubscriptionSecurityTaskResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The ascLocation. + /// The taskName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation ascLocation, string taskName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}"; diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/TenantAssessmentMetadataResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/TenantAssessmentMetadataResource.cs index b36cb23dfca25..95f1ed247dc4b 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/TenantAssessmentMetadataResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/TenantAssessmentMetadataResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.SecurityCenter public partial class TenantAssessmentMetadataResource : ArmResource { /// Generate the resource identifier of a instance. + /// The assessmentMetadataName. public static ResourceIdentifier CreateResourceIdentifier(string assessmentMetadataName) { var resourceId = $"/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"; diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/api/Azure.ResourceManager.SecurityDevOps.netstandard2.0.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/api/Azure.ResourceManager.SecurityDevOps.netstandard2.0.cs index 0f29c7faaff5f..d2c2aaa8d6944 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/api/Azure.ResourceManager.SecurityDevOps.netstandard2.0.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/api/Azure.ResourceManager.SecurityDevOps.netstandard2.0.cs @@ -19,7 +19,7 @@ protected AzureDevOpsConnectorCollection() { } } public partial class AzureDevOpsConnectorData : Azure.ResourceManager.Models.TrackedResourceData { - public AzureDevOpsConnectorData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AzureDevOpsConnectorData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.SecurityDevOps.Models.AzureDevOpsConnectorProperties Properties { get { throw null; } set { } } } public partial class AzureDevOpsConnectorResource : Azure.ResourceManager.ArmResource @@ -176,7 +176,7 @@ protected GitHubConnectorCollection() { } } public partial class GitHubConnectorData : Azure.ResourceManager.Models.TrackedResourceData { - public GitHubConnectorData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public GitHubConnectorData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.SecurityDevOps.Models.GitHubConnectorProperties Properties { get { throw null; } set { } } } public partial class GitHubConnectorResource : Azure.ResourceManager.ArmResource @@ -298,6 +298,38 @@ public static partial class SecurityDevOpsExtensions public static Azure.ResourceManager.SecurityDevOps.GitHubRepoResource GetGitHubRepoResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } } +namespace Azure.ResourceManager.SecurityDevOps.Mocking +{ + public partial class MockableSecurityDevOpsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSecurityDevOpsArmClient() { } + public virtual Azure.ResourceManager.SecurityDevOps.AzureDevOpsConnectorResource GetAzureDevOpsConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityDevOps.AzureDevOpsOrgResource GetAzureDevOpsOrgResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityDevOps.AzureDevOpsProjectResource GetAzureDevOpsProjectResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityDevOps.AzureDevOpsRepoResource GetAzureDevOpsRepoResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityDevOps.GitHubConnectorResource GetGitHubConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityDevOps.GitHubOwnerResource GetGitHubOwnerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityDevOps.GitHubRepoResource GetGitHubRepoResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSecurityDevOpsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSecurityDevOpsResourceGroupResource() { } + public virtual Azure.Response GetAzureDevOpsConnector(string azureDevOpsConnectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAzureDevOpsConnectorAsync(string azureDevOpsConnectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityDevOps.AzureDevOpsConnectorCollection GetAzureDevOpsConnectors() { throw null; } + public virtual Azure.Response GetGitHubConnector(string gitHubConnectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGitHubConnectorAsync(string gitHubConnectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecurityDevOps.GitHubConnectorCollection GetGitHubConnectors() { throw null; } + } + public partial class MockableSecurityDevOpsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSecurityDevOpsSubscriptionResource() { } + public virtual Azure.Pageable GetAzureDevOpsConnectors(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAzureDevOpsConnectorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetGitHubConnectors(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGitHubConnectorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.SecurityDevOps.Models { public partial class ActionableRemediation diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorResource.cs index ecc1412ef679e..f94c71f969306 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.SecurityDevOps public partial class AzureDevOpsConnectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureDevOpsConnectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureDevOpsConnectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}"; @@ -103,7 +106,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AzureDevOpsOrgResources and their operations over a AzureDevOpsOrgResource. public virtual AzureDevOpsOrgCollection GetAzureDevOpsOrgs() { - return GetCachedClient(Client => new AzureDevOpsOrgCollection(Client, Id)); + return GetCachedClient(client => new AzureDevOpsOrgCollection(client, Id)); } /// @@ -121,8 +124,8 @@ public virtual AzureDevOpsOrgCollection GetAzureDevOpsOrgs() /// /// Name of the AzureDevOps Org. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAzureDevOpsOrgAsync(string azureDevOpsOrgName, CancellationToken cancellationToken = default) { @@ -144,8 +147,8 @@ public virtual async Task> GetAzureDevOpsOrgAsy /// /// Name of the AzureDevOps Org. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAzureDevOpsOrg(string azureDevOpsOrgName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgResource.cs index e74d2177be67e..576cde3299a61 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityDevOps public partial class AzureDevOpsOrgResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureDevOpsConnectorName. + /// The azureDevOpsOrgName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureDevOpsConnectorName, string azureDevOpsOrgName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AzureDevOpsProjectResources and their operations over a AzureDevOpsProjectResource. public virtual AzureDevOpsProjectCollection GetAzureDevOpsProjects() { - return GetCachedClient(Client => new AzureDevOpsProjectCollection(Client, Id)); + return GetCachedClient(client => new AzureDevOpsProjectCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual AzureDevOpsProjectCollection GetAzureDevOpsProjects() /// /// Name of the AzureDevOps Project. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAzureDevOpsProjectAsync(string azureDevOpsProjectName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetAzureDevOpsPr /// /// Name of the AzureDevOps Project. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAzureDevOpsProject(string azureDevOpsProjectName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectResource.cs index fd28dd88590a2..5f4fb261aa196 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.SecurityDevOps public partial class AzureDevOpsProjectResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureDevOpsConnectorName. + /// The azureDevOpsOrgName. + /// The azureDevOpsProjectName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureDevOpsConnectorName, string azureDevOpsOrgName, string azureDevOpsProjectName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName}/projects/{azureDevOpsProjectName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AzureDevOpsRepoResources and their operations over a AzureDevOpsRepoResource. public virtual AzureDevOpsRepoCollection GetAzureDevOpsRepos() { - return GetCachedClient(Client => new AzureDevOpsRepoCollection(Client, Id)); + return GetCachedClient(client => new AzureDevOpsRepoCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual AzureDevOpsRepoCollection GetAzureDevOpsRepos() /// /// Name of the AzureDevOps Repo. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAzureDevOpsRepoAsync(string azureDevOpsRepoName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetAzureDevOpsRepoA /// /// Name of the AzureDevOps Repo. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAzureDevOpsRepo(string azureDevOpsRepoName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsRepoResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsRepoResource.cs index 6047f9f3be2f4..f6dca03c1340b 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsRepoResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsRepoResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.SecurityDevOps public partial class AzureDevOpsRepoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureDevOpsConnectorName. + /// The azureDevOpsOrgName. + /// The azureDevOpsProjectName. + /// The azureDevOpsRepoName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureDevOpsConnectorName, string azureDevOpsOrgName, string azureDevOpsProjectName, string azureDevOpsRepoName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName}/orgs/{azureDevOpsOrgName}/projects/{azureDevOpsProjectName}/repos/{azureDevOpsRepoName}"; diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsArmClient.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsArmClient.cs new file mode 100644 index 0000000000000..3151c6e9d68e4 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.SecurityDevOps; + +namespace Azure.ResourceManager.SecurityDevOps.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSecurityDevOpsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSecurityDevOpsArmClient() + { + } + + /// 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 MockableSecurityDevOpsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSecurityDevOpsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AzureDevOpsConnectorResource GetAzureDevOpsConnectorResource(ResourceIdentifier id) + { + AzureDevOpsConnectorResource.ValidateResourceId(id); + return new AzureDevOpsConnectorResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AzureDevOpsRepoResource GetAzureDevOpsRepoResource(ResourceIdentifier id) + { + AzureDevOpsRepoResource.ValidateResourceId(id); + return new AzureDevOpsRepoResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AzureDevOpsOrgResource GetAzureDevOpsOrgResource(ResourceIdentifier id) + { + AzureDevOpsOrgResource.ValidateResourceId(id); + return new AzureDevOpsOrgResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AzureDevOpsProjectResource GetAzureDevOpsProjectResource(ResourceIdentifier id) + { + AzureDevOpsProjectResource.ValidateResourceId(id); + return new AzureDevOpsProjectResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GitHubConnectorResource GetGitHubConnectorResource(ResourceIdentifier id) + { + GitHubConnectorResource.ValidateResourceId(id); + return new GitHubConnectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GitHubRepoResource GetGitHubRepoResource(ResourceIdentifier id) + { + GitHubRepoResource.ValidateResourceId(id); + return new GitHubRepoResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GitHubOwnerResource GetGitHubOwnerResource(ResourceIdentifier id) + { + GitHubOwnerResource.ValidateResourceId(id); + return new GitHubOwnerResource(Client, id); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsResourceGroupResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsResourceGroupResource.cs new file mode 100644 index 0000000000000..47ce936239718 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.SecurityDevOps; + +namespace Azure.ResourceManager.SecurityDevOps.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSecurityDevOpsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSecurityDevOpsResourceGroupResource() + { + } + + /// 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 MockableSecurityDevOpsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AzureDevOpsConnectorResources in the ResourceGroupResource. + /// An object representing collection of AzureDevOpsConnectorResources and their operations over a AzureDevOpsConnectorResource. + public virtual AzureDevOpsConnectorCollection GetAzureDevOpsConnectors() + { + return GetCachedClient(client => new AzureDevOpsConnectorCollection(client, Id)); + } + + /// + /// Returns a monitored AzureDevOps Connector resource for a given ID. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName} + /// + /// + /// Operation Id + /// AzureDevOpsConnector_Get + /// + /// + /// + /// Name of the AzureDevOps Connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAzureDevOpsConnectorAsync(string azureDevOpsConnectorName, CancellationToken cancellationToken = default) + { + return await GetAzureDevOpsConnectors().GetAsync(azureDevOpsConnectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a monitored AzureDevOps Connector resource for a given ID. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors/{azureDevOpsConnectorName} + /// + /// + /// Operation Id + /// AzureDevOpsConnector_Get + /// + /// + /// + /// Name of the AzureDevOps Connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAzureDevOpsConnector(string azureDevOpsConnectorName, CancellationToken cancellationToken = default) + { + return GetAzureDevOpsConnectors().Get(azureDevOpsConnectorName, cancellationToken); + } + + /// Gets a collection of GitHubConnectorResources in the ResourceGroupResource. + /// An object representing collection of GitHubConnectorResources and their operations over a GitHubConnectorResource. + public virtual GitHubConnectorCollection GetGitHubConnectors() + { + return GetCachedClient(client => new GitHubConnectorCollection(client, Id)); + } + + /// + /// Returns a monitored GitHub Connector resource for a given ID. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/gitHubConnectors/{gitHubConnectorName} + /// + /// + /// Operation Id + /// GitHubConnector_Get + /// + /// + /// + /// Name of the GitHub Connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGitHubConnectorAsync(string gitHubConnectorName, CancellationToken cancellationToken = default) + { + return await GetGitHubConnectors().GetAsync(gitHubConnectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a monitored GitHub Connector resource for a given ID. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/gitHubConnectors/{gitHubConnectorName} + /// + /// + /// Operation Id + /// GitHubConnector_Get + /// + /// + /// + /// Name of the GitHub Connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGitHubConnector(string gitHubConnectorName, CancellationToken cancellationToken = default) + { + return GetGitHubConnectors().Get(gitHubConnectorName, cancellationToken); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsSubscriptionResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsSubscriptionResource.cs new file mode 100644 index 0000000000000..c3ae02c36df1e --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsSubscriptionResource.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.SecurityDevOps; + +namespace Azure.ResourceManager.SecurityDevOps.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSecurityDevOpsSubscriptionResource : ArmResource + { + private ClientDiagnostics _azureDevOpsConnectorClientDiagnostics; + private AzureDevOpsConnectorRestOperations _azureDevOpsConnectorRestClient; + private ClientDiagnostics _gitHubConnectorClientDiagnostics; + private GitHubConnectorRestOperations _gitHubConnectorRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSecurityDevOpsSubscriptionResource() + { + } + + /// 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 MockableSecurityDevOpsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AzureDevOpsConnectorClientDiagnostics => _azureDevOpsConnectorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityDevOps", AzureDevOpsConnectorResource.ResourceType.Namespace, Diagnostics); + private AzureDevOpsConnectorRestOperations AzureDevOpsConnectorRestClient => _azureDevOpsConnectorRestClient ??= new AzureDevOpsConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AzureDevOpsConnectorResource.ResourceType)); + private ClientDiagnostics GitHubConnectorClientDiagnostics => _gitHubConnectorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityDevOps", GitHubConnectorResource.ResourceType.Namespace, Diagnostics); + private GitHubConnectorRestOperations GitHubConnectorRestClient => _gitHubConnectorRestClient ??= new GitHubConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GitHubConnectorResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns a list of monitored AzureDevOps Connectors. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors + /// + /// + /// Operation Id + /// AzureDevOpsConnector_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAzureDevOpsConnectorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureDevOpsConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureDevOpsConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AzureDevOpsConnectorResource(Client, AzureDevOpsConnectorData.DeserializeAzureDevOpsConnectorData(e)), AzureDevOpsConnectorClientDiagnostics, Pipeline, "MockableSecurityDevOpsSubscriptionResource.GetAzureDevOpsConnectors", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of monitored AzureDevOps Connectors. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors + /// + /// + /// Operation Id + /// AzureDevOpsConnector_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAzureDevOpsConnectors(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureDevOpsConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureDevOpsConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AzureDevOpsConnectorResource(Client, AzureDevOpsConnectorData.DeserializeAzureDevOpsConnectorData(e)), AzureDevOpsConnectorClientDiagnostics, Pipeline, "MockableSecurityDevOpsSubscriptionResource.GetAzureDevOpsConnectors", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of monitored GitHub Connectors. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecurityDevOps/gitHubConnectors + /// + /// + /// Operation Id + /// GitHubConnector_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGitHubConnectorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GitHubConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GitHubConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GitHubConnectorResource(Client, GitHubConnectorData.DeserializeGitHubConnectorData(e)), GitHubConnectorClientDiagnostics, Pipeline, "MockableSecurityDevOpsSubscriptionResource.GetGitHubConnectors", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of monitored GitHub Connectors. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecurityDevOps/gitHubConnectors + /// + /// + /// Operation Id + /// GitHubConnector_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGitHubConnectors(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GitHubConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GitHubConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GitHubConnectorResource(Client, GitHubConnectorData.DeserializeGitHubConnectorData(e)), GitHubConnectorClientDiagnostics, Pipeline, "MockableSecurityDevOpsSubscriptionResource.GetGitHubConnectors", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index ec763b017b047..0000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.SecurityDevOps -{ - /// 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 AzureDevOpsConnectorResources in the ResourceGroupResource. - /// An object representing collection of AzureDevOpsConnectorResources and their operations over a AzureDevOpsConnectorResource. - public virtual AzureDevOpsConnectorCollection GetAzureDevOpsConnectors() - { - return GetCachedClient(Client => new AzureDevOpsConnectorCollection(Client, Id)); - } - - /// Gets a collection of GitHubConnectorResources in the ResourceGroupResource. - /// An object representing collection of GitHubConnectorResources and their operations over a GitHubConnectorResource. - public virtual GitHubConnectorCollection GetGitHubConnectors() - { - return GetCachedClient(Client => new GitHubConnectorCollection(Client, Id)); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/SecurityDevOpsExtensions.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/SecurityDevOpsExtensions.cs index ac48fc5d20c2b..f1c10b31679c3 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/SecurityDevOpsExtensions.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/SecurityDevOpsExtensions.cs @@ -12,182 +12,152 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.SecurityDevOps.Mocking; namespace Azure.ResourceManager.SecurityDevOps { /// A class to add extension methods to Azure.ResourceManager.SecurityDevOps. public static partial class SecurityDevOpsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSecurityDevOpsArmClient GetMockableSecurityDevOpsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSecurityDevOpsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSecurityDevOpsResourceGroupResource GetMockableSecurityDevOpsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSecurityDevOpsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSecurityDevOpsSubscriptionResource GetMockableSecurityDevOpsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSecurityDevOpsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AzureDevOpsConnectorResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AzureDevOpsConnectorResource GetAzureDevOpsConnectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AzureDevOpsConnectorResource.ValidateResourceId(id); - return new AzureDevOpsConnectorResource(client, id); - } - ); + return GetMockableSecurityDevOpsArmClient(client).GetAzureDevOpsConnectorResource(id); } - #endregion - #region AzureDevOpsRepoResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AzureDevOpsRepoResource GetAzureDevOpsRepoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AzureDevOpsRepoResource.ValidateResourceId(id); - return new AzureDevOpsRepoResource(client, id); - } - ); + return GetMockableSecurityDevOpsArmClient(client).GetAzureDevOpsRepoResource(id); } - #endregion - #region AzureDevOpsOrgResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AzureDevOpsOrgResource GetAzureDevOpsOrgResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AzureDevOpsOrgResource.ValidateResourceId(id); - return new AzureDevOpsOrgResource(client, id); - } - ); + return GetMockableSecurityDevOpsArmClient(client).GetAzureDevOpsOrgResource(id); } - #endregion - #region AzureDevOpsProjectResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AzureDevOpsProjectResource GetAzureDevOpsProjectResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AzureDevOpsProjectResource.ValidateResourceId(id); - return new AzureDevOpsProjectResource(client, id); - } - ); + return GetMockableSecurityDevOpsArmClient(client).GetAzureDevOpsProjectResource(id); } - #endregion - #region GitHubConnectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GitHubConnectorResource GetGitHubConnectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GitHubConnectorResource.ValidateResourceId(id); - return new GitHubConnectorResource(client, id); - } - ); + return GetMockableSecurityDevOpsArmClient(client).GetGitHubConnectorResource(id); } - #endregion - #region GitHubRepoResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GitHubRepoResource GetGitHubRepoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GitHubRepoResource.ValidateResourceId(id); - return new GitHubRepoResource(client, id); - } - ); + return GetMockableSecurityDevOpsArmClient(client).GetGitHubRepoResource(id); } - #endregion - #region GitHubOwnerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GitHubOwnerResource GetGitHubOwnerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GitHubOwnerResource.ValidateResourceId(id); - return new GitHubOwnerResource(client, id); - } - ); + return GetMockableSecurityDevOpsArmClient(client).GetGitHubOwnerResource(id); } - #endregion - /// Gets a collection of AzureDevOpsConnectorResources in the ResourceGroupResource. + /// + /// Gets a collection of AzureDevOpsConnectorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AzureDevOpsConnectorResources and their operations over a AzureDevOpsConnectorResource. public static AzureDevOpsConnectorCollection GetAzureDevOpsConnectors(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAzureDevOpsConnectors(); + return GetMockableSecurityDevOpsResourceGroupResource(resourceGroupResource).GetAzureDevOpsConnectors(); } /// @@ -202,16 +172,20 @@ public static AzureDevOpsConnectorCollection GetAzureDevOpsConnectors(this Resou /// AzureDevOpsConnector_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the AzureDevOps Connector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAzureDevOpsConnectorAsync(this ResourceGroupResource resourceGroupResource, string azureDevOpsConnectorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAzureDevOpsConnectors().GetAsync(azureDevOpsConnectorName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityDevOpsResourceGroupResource(resourceGroupResource).GetAzureDevOpsConnectorAsync(azureDevOpsConnectorName, cancellationToken).ConfigureAwait(false); } /// @@ -226,24 +200,34 @@ public static async Task> GetAzureDevOpsC /// AzureDevOpsConnector_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the AzureDevOps Connector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAzureDevOpsConnector(this ResourceGroupResource resourceGroupResource, string azureDevOpsConnectorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAzureDevOpsConnectors().Get(azureDevOpsConnectorName, cancellationToken); + return GetMockableSecurityDevOpsResourceGroupResource(resourceGroupResource).GetAzureDevOpsConnector(azureDevOpsConnectorName, cancellationToken); } - /// Gets a collection of GitHubConnectorResources in the ResourceGroupResource. + /// + /// Gets a collection of GitHubConnectorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of GitHubConnectorResources and their operations over a GitHubConnectorResource. public static GitHubConnectorCollection GetGitHubConnectors(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetGitHubConnectors(); + return GetMockableSecurityDevOpsResourceGroupResource(resourceGroupResource).GetGitHubConnectors(); } /// @@ -258,16 +242,20 @@ public static GitHubConnectorCollection GetGitHubConnectors(this ResourceGroupRe /// GitHubConnector_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the GitHub Connector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetGitHubConnectorAsync(this ResourceGroupResource resourceGroupResource, string gitHubConnectorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetGitHubConnectors().GetAsync(gitHubConnectorName, cancellationToken).ConfigureAwait(false); + return await GetMockableSecurityDevOpsResourceGroupResource(resourceGroupResource).GetGitHubConnectorAsync(gitHubConnectorName, cancellationToken).ConfigureAwait(false); } /// @@ -282,16 +270,20 @@ public static async Task> GetGitHubConnectorAs /// GitHubConnector_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the GitHub Connector. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetGitHubConnector(this ResourceGroupResource resourceGroupResource, string gitHubConnectorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetGitHubConnectors().Get(gitHubConnectorName, cancellationToken); + return GetMockableSecurityDevOpsResourceGroupResource(resourceGroupResource).GetGitHubConnector(gitHubConnectorName, cancellationToken); } /// @@ -306,13 +298,17 @@ public static Response GetGitHubConnector(this Resource /// AzureDevOpsConnector_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzureDevOpsConnectorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureDevOpsConnectorsAsync(cancellationToken); + return GetMockableSecurityDevOpsSubscriptionResource(subscriptionResource).GetAzureDevOpsConnectorsAsync(cancellationToken); } /// @@ -327,13 +323,17 @@ public static AsyncPageable GetAzureDevOpsConnecto /// AzureDevOpsConnector_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAzureDevOpsConnectors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAzureDevOpsConnectors(cancellationToken); + return GetMockableSecurityDevOpsSubscriptionResource(subscriptionResource).GetAzureDevOpsConnectors(cancellationToken); } /// @@ -348,13 +348,17 @@ public static Pageable GetAzureDevOpsConnectors(th /// GitHubConnector_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetGitHubConnectorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGitHubConnectorsAsync(cancellationToken); + return GetMockableSecurityDevOpsSubscriptionResource(subscriptionResource).GetGitHubConnectorsAsync(cancellationToken); } /// @@ -369,13 +373,17 @@ public static AsyncPageable GetGitHubConnectorsAsync(th /// GitHubConnector_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetGitHubConnectors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGitHubConnectors(cancellationToken); + return GetMockableSecurityDevOpsSubscriptionResource(subscriptionResource).GetGitHubConnectors(cancellationToken); } } } diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 339f090321a94..0000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.SecurityDevOps -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _azureDevOpsConnectorClientDiagnostics; - private AzureDevOpsConnectorRestOperations _azureDevOpsConnectorRestClient; - private ClientDiagnostics _gitHubConnectorClientDiagnostics; - private GitHubConnectorRestOperations _gitHubConnectorRestClient; - - /// 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 AzureDevOpsConnectorClientDiagnostics => _azureDevOpsConnectorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityDevOps", AzureDevOpsConnectorResource.ResourceType.Namespace, Diagnostics); - private AzureDevOpsConnectorRestOperations AzureDevOpsConnectorRestClient => _azureDevOpsConnectorRestClient ??= new AzureDevOpsConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AzureDevOpsConnectorResource.ResourceType)); - private ClientDiagnostics GitHubConnectorClientDiagnostics => _gitHubConnectorClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecurityDevOps", GitHubConnectorResource.ResourceType.Namespace, Diagnostics); - private GitHubConnectorRestOperations GitHubConnectorRestClient => _gitHubConnectorRestClient ??= new GitHubConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(GitHubConnectorResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns a list of monitored AzureDevOps Connectors. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors - /// - /// - /// Operation Id - /// AzureDevOpsConnector_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAzureDevOpsConnectorsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzureDevOpsConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureDevOpsConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AzureDevOpsConnectorResource(Client, AzureDevOpsConnectorData.DeserializeAzureDevOpsConnectorData(e)), AzureDevOpsConnectorClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAzureDevOpsConnectors", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of monitored AzureDevOps Connectors. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SecurityDevOps/azureDevOpsConnectors - /// - /// - /// Operation Id - /// AzureDevOpsConnector_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAzureDevOpsConnectors(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AzureDevOpsConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureDevOpsConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AzureDevOpsConnectorResource(Client, AzureDevOpsConnectorData.DeserializeAzureDevOpsConnectorData(e)), AzureDevOpsConnectorClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAzureDevOpsConnectors", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of monitored GitHub Connectors. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SecurityDevOps/gitHubConnectors - /// - /// - /// Operation Id - /// GitHubConnector_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetGitHubConnectorsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => GitHubConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GitHubConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new GitHubConnectorResource(Client, GitHubConnectorData.DeserializeGitHubConnectorData(e)), GitHubConnectorClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGitHubConnectors", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of monitored GitHub Connectors. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SecurityDevOps/gitHubConnectors - /// - /// - /// Operation Id - /// GitHubConnector_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetGitHubConnectors(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => GitHubConnectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GitHubConnectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new GitHubConnectorResource(Client, GitHubConnectorData.DeserializeGitHubConnectorData(e)), GitHubConnectorClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGitHubConnectors", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorResource.cs index 101cc31e51a22..364cbdc73cc56 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.SecurityDevOps public partial class GitHubConnectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The gitHubConnectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string gitHubConnectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/gitHubConnectors/{gitHubConnectorName}"; @@ -103,7 +106,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GitHubOwnerResources and their operations over a GitHubOwnerResource. public virtual GitHubOwnerCollection GetGitHubOwners() { - return GetCachedClient(Client => new GitHubOwnerCollection(Client, Id)); + return GetCachedClient(client => new GitHubOwnerCollection(client, Id)); } /// @@ -121,8 +124,8 @@ public virtual GitHubOwnerCollection GetGitHubOwners() /// /// Name of the GitHub Owner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGitHubOwnerAsync(string gitHubOwnerName, CancellationToken cancellationToken = default) { @@ -144,8 +147,8 @@ public virtual async Task> GetGitHubOwnerAsync(str /// /// Name of the GitHub Owner. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGitHubOwner(string gitHubOwnerName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerResource.cs index 96d927437c3e0..0cd7dce22c49f 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityDevOps public partial class GitHubOwnerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The gitHubConnectorName. + /// The gitHubOwnerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string gitHubConnectorName, string gitHubOwnerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/gitHubConnectors/{gitHubConnectorName}/owners/{gitHubOwnerName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of GitHubRepoResources and their operations over a GitHubRepoResource. public virtual GitHubRepoCollection GetGitHubRepos() { - return GetCachedClient(Client => new GitHubRepoCollection(Client, Id)); + return GetCachedClient(client => new GitHubRepoCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual GitHubRepoCollection GetGitHubRepos() /// /// Name of the GitHub Repo. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetGitHubRepoAsync(string gitHubRepoName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetGitHubRepoAsync(strin /// /// Name of the GitHub Repo. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetGitHubRepo(string gitHubRepoName, CancellationToken cancellationToken = default) { diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubRepoResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubRepoResource.cs index fe3f56c7bafad..f7616507208d1 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubRepoResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubRepoResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.SecurityDevOps public partial class GitHubRepoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The gitHubConnectorName. + /// The gitHubOwnerName. + /// The gitHubRepoName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string gitHubConnectorName, string gitHubOwnerName, string gitHubRepoName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityDevOps/gitHubConnectors/{gitHubConnectorName}/owners/{gitHubOwnerName}/repos/{gitHubRepoName}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/api/Azure.ResourceManager.SecurityInsights.netstandard2.0.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/api/Azure.ResourceManager.SecurityInsights.netstandard2.0.cs index c2817901fa058..b73376637d73b 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/api/Azure.ResourceManager.SecurityInsights.netstandard2.0.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/api/Azure.ResourceManager.SecurityInsights.netstandard2.0.cs @@ -654,6 +654,32 @@ protected SecurityMLAnalyticsSettingResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecurityInsights.SecurityMLAnalyticsSettingData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.SecurityInsights.Mocking +{ + public partial class MockableSecurityInsightsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSecurityInsightsArmClient() { } + public virtual Azure.ResourceManager.SecurityInsights.OperationalInsightsWorkspaceSecurityInsightsResource GetOperationalInsightsWorkspaceSecurityInsightsResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsAlertRuleActionResource GetSecurityInsightsAlertRuleActionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsAlertRuleResource GetSecurityInsightsAlertRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsAlertRuleTemplateResource GetSecurityInsightsAlertRuleTemplateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsAutomationRuleResource GetSecurityInsightsAutomationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsBookmarkResource GetSecurityInsightsBookmarkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsDataConnectorResource GetSecurityInsightsDataConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsIncidentCommentResource GetSecurityInsightsIncidentCommentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsIncidentRelationResource GetSecurityInsightsIncidentRelationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsIncidentResource GetSecurityInsightsIncidentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsSentinelOnboardingStateResource GetSecurityInsightsSentinelOnboardingStateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsThreatIntelligenceIndicatorResource GetSecurityInsightsThreatIntelligenceIndicatorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsWatchlistItemResource GetSecurityInsightsWatchlistItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityInsightsWatchlistResource GetSecurityInsightsWatchlistResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecurityInsights.SecurityMLAnalyticsSettingResource GetSecurityMLAnalyticsSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSecurityInsightsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSecurityInsightsResourceGroupResource() { } + } +} namespace Azure.ResourceManager.SecurityInsights.Models { public partial class AlertRuleTemplateDataSource diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/MockableSecurityInsightsArmClient.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/MockableSecurityInsightsArmClient.cs new file mode 100644 index 0000000000000..e2bfb3dc62efd --- /dev/null +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/MockableSecurityInsightsArmClient.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.SecurityInsights; + +namespace Azure.ResourceManager.SecurityInsights.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSecurityInsightsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSecurityInsightsArmClient() + { + } + + /// 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 MockableSecurityInsightsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSecurityInsightsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsAlertRuleResource GetSecurityInsightsAlertRuleResource(ResourceIdentifier id) + { + SecurityInsightsAlertRuleResource.ValidateResourceId(id); + return new SecurityInsightsAlertRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsAlertRuleActionResource GetSecurityInsightsAlertRuleActionResource(ResourceIdentifier id) + { + SecurityInsightsAlertRuleActionResource.ValidateResourceId(id); + return new SecurityInsightsAlertRuleActionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsAlertRuleTemplateResource GetSecurityInsightsAlertRuleTemplateResource(ResourceIdentifier id) + { + SecurityInsightsAlertRuleTemplateResource.ValidateResourceId(id); + return new SecurityInsightsAlertRuleTemplateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsAutomationRuleResource GetSecurityInsightsAutomationRuleResource(ResourceIdentifier id) + { + SecurityInsightsAutomationRuleResource.ValidateResourceId(id); + return new SecurityInsightsAutomationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsBookmarkResource GetSecurityInsightsBookmarkResource(ResourceIdentifier id) + { + SecurityInsightsBookmarkResource.ValidateResourceId(id); + return new SecurityInsightsBookmarkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsDataConnectorResource GetSecurityInsightsDataConnectorResource(ResourceIdentifier id) + { + SecurityInsightsDataConnectorResource.ValidateResourceId(id); + return new SecurityInsightsDataConnectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsIncidentResource GetSecurityInsightsIncidentResource(ResourceIdentifier id) + { + SecurityInsightsIncidentResource.ValidateResourceId(id); + return new SecurityInsightsIncidentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsIncidentCommentResource GetSecurityInsightsIncidentCommentResource(ResourceIdentifier id) + { + SecurityInsightsIncidentCommentResource.ValidateResourceId(id); + return new SecurityInsightsIncidentCommentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsIncidentRelationResource GetSecurityInsightsIncidentRelationResource(ResourceIdentifier id) + { + SecurityInsightsIncidentRelationResource.ValidateResourceId(id); + return new SecurityInsightsIncidentRelationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsSentinelOnboardingStateResource GetSecurityInsightsSentinelOnboardingStateResource(ResourceIdentifier id) + { + SecurityInsightsSentinelOnboardingStateResource.ValidateResourceId(id); + return new SecurityInsightsSentinelOnboardingStateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityMLAnalyticsSettingResource GetSecurityMLAnalyticsSettingResource(ResourceIdentifier id) + { + SecurityMLAnalyticsSettingResource.ValidateResourceId(id); + return new SecurityMLAnalyticsSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsThreatIntelligenceIndicatorResource GetSecurityInsightsThreatIntelligenceIndicatorResource(ResourceIdentifier id) + { + SecurityInsightsThreatIntelligenceIndicatorResource.ValidateResourceId(id); + return new SecurityInsightsThreatIntelligenceIndicatorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsWatchlistResource GetSecurityInsightsWatchlistResource(ResourceIdentifier id) + { + SecurityInsightsWatchlistResource.ValidateResourceId(id); + return new SecurityInsightsWatchlistResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecurityInsightsWatchlistItemResource GetSecurityInsightsWatchlistItemResource(ResourceIdentifier id) + { + SecurityInsightsWatchlistItemResource.ValidateResourceId(id); + return new SecurityInsightsWatchlistItemResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OperationalInsightsWorkspaceSecurityInsightsResource GetOperationalInsightsWorkspaceSecurityInsightsResource(ResourceIdentifier id) + { + OperationalInsightsWorkspaceSecurityInsightsResource.ValidateResourceId(id); + return new OperationalInsightsWorkspaceSecurityInsightsResource(Client, id); + } + } +} diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/MockableSecurityInsightsResourceGroupResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/MockableSecurityInsightsResourceGroupResource.cs new file mode 100644 index 0000000000000..419da813b1a81 --- /dev/null +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/MockableSecurityInsightsResourceGroupResource.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.SecurityInsights.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSecurityInsightsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSecurityInsightsResourceGroupResource() + { + } + + /// 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 MockableSecurityInsightsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + } +} diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index c510da1b67e24..0000000000000 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.SecurityInsights -{ - /// 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; - } - } -} diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/SecurityInsightsExtensions.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/SecurityInsightsExtensions.cs index 59e6473a9cd9f..a817ce7b3fd36 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/SecurityInsightsExtensions.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/Extensions/SecurityInsightsExtensions.cs @@ -7,310 +7,261 @@ using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.SecurityInsights.Mocking; namespace Azure.ResourceManager.SecurityInsights { /// A class to add extension methods to Azure.ResourceManager.SecurityInsights. public static partial class SecurityInsightsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSecurityInsightsArmClient GetMockableSecurityInsightsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSecurityInsightsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSecurityInsightsResourceGroupResource GetMockableSecurityInsightsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSecurityInsightsResourceGroupResource(client, resource.Id)); } - #region SecurityInsightsAlertRuleResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsAlertRuleResource GetSecurityInsightsAlertRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsAlertRuleResource.ValidateResourceId(id); - return new SecurityInsightsAlertRuleResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsAlertRuleResource(id); } - #endregion - #region SecurityInsightsAlertRuleActionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsAlertRuleActionResource GetSecurityInsightsAlertRuleActionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsAlertRuleActionResource.ValidateResourceId(id); - return new SecurityInsightsAlertRuleActionResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsAlertRuleActionResource(id); } - #endregion - #region SecurityInsightsAlertRuleTemplateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsAlertRuleTemplateResource GetSecurityInsightsAlertRuleTemplateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsAlertRuleTemplateResource.ValidateResourceId(id); - return new SecurityInsightsAlertRuleTemplateResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsAlertRuleTemplateResource(id); } - #endregion - #region SecurityInsightsAutomationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsAutomationRuleResource GetSecurityInsightsAutomationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsAutomationRuleResource.ValidateResourceId(id); - return new SecurityInsightsAutomationRuleResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsAutomationRuleResource(id); } - #endregion - #region SecurityInsightsBookmarkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsBookmarkResource GetSecurityInsightsBookmarkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsBookmarkResource.ValidateResourceId(id); - return new SecurityInsightsBookmarkResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsBookmarkResource(id); } - #endregion - #region SecurityInsightsDataConnectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsDataConnectorResource GetSecurityInsightsDataConnectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsDataConnectorResource.ValidateResourceId(id); - return new SecurityInsightsDataConnectorResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsDataConnectorResource(id); } - #endregion - #region SecurityInsightsIncidentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsIncidentResource GetSecurityInsightsIncidentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsIncidentResource.ValidateResourceId(id); - return new SecurityInsightsIncidentResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsIncidentResource(id); } - #endregion - #region SecurityInsightsIncidentCommentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsIncidentCommentResource GetSecurityInsightsIncidentCommentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsIncidentCommentResource.ValidateResourceId(id); - return new SecurityInsightsIncidentCommentResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsIncidentCommentResource(id); } - #endregion - #region SecurityInsightsIncidentRelationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsIncidentRelationResource GetSecurityInsightsIncidentRelationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsIncidentRelationResource.ValidateResourceId(id); - return new SecurityInsightsIncidentRelationResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsIncidentRelationResource(id); } - #endregion - #region SecurityInsightsSentinelOnboardingStateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsSentinelOnboardingStateResource GetSecurityInsightsSentinelOnboardingStateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsSentinelOnboardingStateResource.ValidateResourceId(id); - return new SecurityInsightsSentinelOnboardingStateResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsSentinelOnboardingStateResource(id); } - #endregion - #region SecurityMLAnalyticsSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityMLAnalyticsSettingResource GetSecurityMLAnalyticsSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityMLAnalyticsSettingResource.ValidateResourceId(id); - return new SecurityMLAnalyticsSettingResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityMLAnalyticsSettingResource(id); } - #endregion - #region SecurityInsightsThreatIntelligenceIndicatorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsThreatIntelligenceIndicatorResource GetSecurityInsightsThreatIntelligenceIndicatorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsThreatIntelligenceIndicatorResource.ValidateResourceId(id); - return new SecurityInsightsThreatIntelligenceIndicatorResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsThreatIntelligenceIndicatorResource(id); } - #endregion - #region SecurityInsightsWatchlistResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsWatchlistResource GetSecurityInsightsWatchlistResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsWatchlistResource.ValidateResourceId(id); - return new SecurityInsightsWatchlistResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsWatchlistResource(id); } - #endregion - #region SecurityInsightsWatchlistItemResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SecurityInsightsWatchlistItemResource GetSecurityInsightsWatchlistItemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SecurityInsightsWatchlistItemResource.ValidateResourceId(id); - return new SecurityInsightsWatchlistItemResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetSecurityInsightsWatchlistItemResource(id); } - #endregion - #region OperationalInsightsWorkspaceSecurityInsightsResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OperationalInsightsWorkspaceSecurityInsightsResource GetOperationalInsightsWorkspaceSecurityInsightsResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OperationalInsightsWorkspaceSecurityInsightsResource.ValidateResourceId(id); - return new OperationalInsightsWorkspaceSecurityInsightsResource(client, id); - } - ); + return GetMockableSecurityInsightsArmClient(client).GetOperationalInsightsWorkspaceSecurityInsightsResource(id); } - #endregion } } diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/OperationalInsightsWorkspaceSecurityInsightsResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/OperationalInsightsWorkspaceSecurityInsightsResource.cs index 4e17138e30447..93690e23eb127 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/OperationalInsightsWorkspaceSecurityInsightsResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/OperationalInsightsWorkspaceSecurityInsightsResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.SecurityInsights public partial class OperationalInsightsWorkspaceSecurityInsightsResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. internal static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}"; @@ -68,7 +71,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SecurityInsightsAlertRuleResources and their operations over a SecurityInsightsAlertRuleResource. public virtual SecurityInsightsAlertRuleCollection GetSecurityInsightsAlertRules() { - return GetCachedClient(Client => new SecurityInsightsAlertRuleCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsAlertRuleCollection(client, Id)); } /// @@ -86,8 +89,8 @@ public virtual SecurityInsightsAlertRuleCollection GetSecurityInsightsAlertRules /// /// Alert rule ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsAlertRuleAsync(string ruleId, CancellationToken cancellationToken = default) { @@ -109,8 +112,8 @@ public virtual async Task> GetSecuri /// /// Alert rule ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsAlertRule(string ruleId, CancellationToken cancellationToken = default) { @@ -121,7 +124,7 @@ public virtual Response GetSecurityInsightsAl /// An object representing collection of SecurityInsightsAlertRuleTemplateResources and their operations over a SecurityInsightsAlertRuleTemplateResource. public virtual SecurityInsightsAlertRuleTemplateCollection GetSecurityInsightsAlertRuleTemplates() { - return GetCachedClient(Client => new SecurityInsightsAlertRuleTemplateCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsAlertRuleTemplateCollection(client, Id)); } /// @@ -139,8 +142,8 @@ public virtual SecurityInsightsAlertRuleTemplateCollection GetSecurityInsightsAl /// /// Alert rule template ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsAlertRuleTemplateAsync(string alertRuleTemplateId, CancellationToken cancellationToken = default) { @@ -162,8 +165,8 @@ public virtual async Task> G /// /// Alert rule template ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsAlertRuleTemplate(string alertRuleTemplateId, CancellationToken cancellationToken = default) { @@ -174,7 +177,7 @@ public virtual Response GetSecurityIn /// An object representing collection of SecurityInsightsAutomationRuleResources and their operations over a SecurityInsightsAutomationRuleResource. public virtual SecurityInsightsAutomationRuleCollection GetSecurityInsightsAutomationRules() { - return GetCachedClient(Client => new SecurityInsightsAutomationRuleCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsAutomationRuleCollection(client, Id)); } /// @@ -192,8 +195,8 @@ public virtual SecurityInsightsAutomationRuleCollection GetSecurityInsightsAutom /// /// Automation rule ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsAutomationRuleAsync(string automationRuleId, CancellationToken cancellationToken = default) { @@ -215,8 +218,8 @@ public virtual async Task> GetS /// /// Automation rule ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsAutomationRule(string automationRuleId, CancellationToken cancellationToken = default) { @@ -227,7 +230,7 @@ public virtual Response GetSecurityInsig /// An object representing collection of SecurityInsightsBookmarkResources and their operations over a SecurityInsightsBookmarkResource. public virtual SecurityInsightsBookmarkCollection GetSecurityInsightsBookmarks() { - return GetCachedClient(Client => new SecurityInsightsBookmarkCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsBookmarkCollection(client, Id)); } /// @@ -245,8 +248,8 @@ public virtual SecurityInsightsBookmarkCollection GetSecurityInsightsBookmarks() /// /// Bookmark ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsBookmarkAsync(string bookmarkId, CancellationToken cancellationToken = default) { @@ -268,8 +271,8 @@ public virtual async Task> GetSecurit /// /// Bookmark ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsBookmark(string bookmarkId, CancellationToken cancellationToken = default) { @@ -280,7 +283,7 @@ public virtual Response GetSecurityInsightsBoo /// An object representing collection of SecurityInsightsDataConnectorResources and their operations over a SecurityInsightsDataConnectorResource. public virtual SecurityInsightsDataConnectorCollection GetSecurityInsightsDataConnectors() { - return GetCachedClient(Client => new SecurityInsightsDataConnectorCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsDataConnectorCollection(client, Id)); } /// @@ -298,8 +301,8 @@ public virtual SecurityInsightsDataConnectorCollection GetSecurityInsightsDataCo /// /// Connector ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsDataConnectorAsync(string dataConnectorId, CancellationToken cancellationToken = default) { @@ -321,8 +324,8 @@ public virtual async Task> GetSe /// /// Connector ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsDataConnector(string dataConnectorId, CancellationToken cancellationToken = default) { @@ -333,7 +336,7 @@ public virtual Response GetSecurityInsigh /// An object representing collection of SecurityInsightsIncidentResources and their operations over a SecurityInsightsIncidentResource. public virtual SecurityInsightsIncidentCollection GetSecurityInsightsIncidents() { - return GetCachedClient(Client => new SecurityInsightsIncidentCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsIncidentCollection(client, Id)); } /// @@ -351,8 +354,8 @@ public virtual SecurityInsightsIncidentCollection GetSecurityInsightsIncidents() /// /// Incident ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsIncidentAsync(string incidentId, CancellationToken cancellationToken = default) { @@ -374,8 +377,8 @@ public virtual async Task> GetSecurit /// /// Incident ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsIncident(string incidentId, CancellationToken cancellationToken = default) { @@ -386,7 +389,7 @@ public virtual Response GetSecurityInsightsInc /// An object representing collection of SecurityInsightsSentinelOnboardingStateResources and their operations over a SecurityInsightsSentinelOnboardingStateResource. public virtual SecurityInsightsSentinelOnboardingStateCollection GetSecurityInsightsSentinelOnboardingStates() { - return GetCachedClient(Client => new SecurityInsightsSentinelOnboardingStateCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsSentinelOnboardingStateCollection(client, Id)); } /// @@ -404,8 +407,8 @@ public virtual SecurityInsightsSentinelOnboardingStateCollection GetSecurityInsi /// /// The Sentinel onboarding state name. Supports - default. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsSentinelOnboardingStateAsync(string sentinelOnboardingStateName, CancellationToken cancellationToken = default) { @@ -427,8 +430,8 @@ public virtual async Task /// The Sentinel onboarding state name. Supports - default. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsSentinelOnboardingState(string sentinelOnboardingStateName, CancellationToken cancellationToken = default) { @@ -439,7 +442,7 @@ public virtual Response GetSecu /// An object representing collection of SecurityMLAnalyticsSettingResources and their operations over a SecurityMLAnalyticsSettingResource. public virtual SecurityMLAnalyticsSettingCollection GetSecurityMLAnalyticsSettings() { - return GetCachedClient(Client => new SecurityMLAnalyticsSettingCollection(Client, Id)); + return GetCachedClient(client => new SecurityMLAnalyticsSettingCollection(client, Id)); } /// @@ -457,8 +460,8 @@ public virtual SecurityMLAnalyticsSettingCollection GetSecurityMLAnalyticsSettin /// /// Security ML Analytics Settings resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityMLAnalyticsSettingAsync(string settingsResourceName, CancellationToken cancellationToken = default) { @@ -480,8 +483,8 @@ public virtual async Task> GetSecur /// /// Security ML Analytics Settings resource name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityMLAnalyticsSetting(string settingsResourceName, CancellationToken cancellationToken = default) { @@ -492,7 +495,7 @@ public virtual Response GetSecurityMLAnalyti /// An object representing collection of SecurityInsightsThreatIntelligenceIndicatorResources and their operations over a SecurityInsightsThreatIntelligenceIndicatorResource. public virtual SecurityInsightsThreatIntelligenceIndicatorCollection GetSecurityInsightsThreatIntelligenceIndicators() { - return GetCachedClient(Client => new SecurityInsightsThreatIntelligenceIndicatorCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsThreatIntelligenceIndicatorCollection(client, Id)); } /// @@ -510,8 +513,8 @@ public virtual SecurityInsightsThreatIntelligenceIndicatorCollection GetSecurity /// /// Threat intelligence indicator name field. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsThreatIntelligenceIndicatorAsync(string name, CancellationToken cancellationToken = default) { @@ -533,8 +536,8 @@ public virtual async Task /// Threat intelligence indicator name field. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsThreatIntelligenceIndicator(string name, CancellationToken cancellationToken = default) { @@ -545,7 +548,7 @@ public virtual Response Get /// An object representing collection of SecurityInsightsWatchlistResources and their operations over a SecurityInsightsWatchlistResource. public virtual SecurityInsightsWatchlistCollection GetSecurityInsightsWatchlists() { - return GetCachedClient(Client => new SecurityInsightsWatchlistCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsWatchlistCollection(client, Id)); } /// @@ -563,8 +566,8 @@ public virtual SecurityInsightsWatchlistCollection GetSecurityInsightsWatchlists /// /// The watchlist alias. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsWatchlistAsync(string watchlistAlias, CancellationToken cancellationToken = default) { @@ -586,8 +589,8 @@ public virtual async Task> GetSecuri /// /// The watchlist alias. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsWatchlist(string watchlistAlias, CancellationToken cancellationToken = default) { diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleActionResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleActionResource.cs index ad95459c90a2a..1170e194418e2 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleActionResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleActionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsAlertRuleActionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The ruleId. + /// The actionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string ruleId, string actionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleResource.cs index 90618390c0095..d9014103ee405 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsAlertRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The ruleId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string ruleId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SecurityInsightsAlertRuleActionResources and their operations over a SecurityInsightsAlertRuleActionResource. public virtual SecurityInsightsAlertRuleActionCollection GetSecurityInsightsAlertRuleActions() { - return GetCachedClient(Client => new SecurityInsightsAlertRuleActionCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsAlertRuleActionCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual SecurityInsightsAlertRuleActionCollection GetSecurityInsightsAler /// /// Action ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsAlertRuleActionAsync(string actionId, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> Get /// /// Action ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsAlertRuleAction(string actionId, CancellationToken cancellationToken = default) { diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleTemplateResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleTemplateResource.cs index 656c285601442..8bf1ae1b5b80a 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleTemplateResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleTemplateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsAlertRuleTemplateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The alertRuleTemplateId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string alertRuleTemplateId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAutomationRuleResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAutomationRuleResource.cs index c6eef3a6b6394..bc8c6551c9ccb 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAutomationRuleResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAutomationRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsAutomationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The automationRuleId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string automationRuleId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsBookmarkResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsBookmarkResource.cs index 41c01d6d26053..2a00513e856f5 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsBookmarkResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsBookmarkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsBookmarkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The bookmarkId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string bookmarkId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsDataConnectorResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsDataConnectorResource.cs index 0b414498c1ecb..8967d6545e2ff 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsDataConnectorResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsDataConnectorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsDataConnectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The dataConnectorId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string dataConnectorId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCommentResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCommentResource.cs index 5d86e7ebdeb2b..c0d2fa04d3d77 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCommentResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentCommentResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsIncidentCommentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The incidentId. + /// The incidentCommentId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentRelationResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentRelationResource.cs index e86c790e448e8..dfd227e9a8865 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentRelationResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentRelationResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsIncidentRelationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The incidentId. + /// The relationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string incidentId, string relationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentResource.cs index bd213dd82b007..f2a10bf8fb7bf 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsIncidentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The incidentId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string incidentId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SecurityInsightsIncidentCommentResources and their operations over a SecurityInsightsIncidentCommentResource. public virtual SecurityInsightsIncidentCommentCollection GetSecurityInsightsIncidentComments() { - return GetCachedClient(Client => new SecurityInsightsIncidentCommentCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsIncidentCommentCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual SecurityInsightsIncidentCommentCollection GetSecurityInsightsInci /// /// Incident comment ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsIncidentCommentAsync(string incidentCommentId, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> Get /// /// Incident comment ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsIncidentComment(string incidentCommentId, CancellationToken cancellationToken = default) { @@ -145,7 +149,7 @@ public virtual Response GetSecurityInsi /// An object representing collection of SecurityInsightsIncidentRelationResources and their operations over a SecurityInsightsIncidentRelationResource. public virtual SecurityInsightsIncidentRelationCollection GetSecurityInsightsIncidentRelations() { - return GetCachedClient(Client => new SecurityInsightsIncidentRelationCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsIncidentRelationCollection(client, Id)); } /// @@ -163,8 +167,8 @@ public virtual SecurityInsightsIncidentRelationCollection GetSecurityInsightsInc /// /// Relation Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsIncidentRelationAsync(string relationName, CancellationToken cancellationToken = default) { @@ -186,8 +190,8 @@ public virtual async Task> Ge /// /// Relation Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsIncidentRelation(string relationName, CancellationToken cancellationToken = default) { diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsSentinelOnboardingStateResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsSentinelOnboardingStateResource.cs index e0957a6abea49..bbf158fa0b122 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsSentinelOnboardingStateResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsSentinelOnboardingStateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsSentinelOnboardingStateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sentinelOnboardingStateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sentinelOnboardingStateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsThreatIntelligenceIndicatorResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsThreatIntelligenceIndicatorResource.cs index 65c8a76a8ac01..e07aee43e0807 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsThreatIntelligenceIndicatorResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsThreatIntelligenceIndicatorResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsThreatIntelligenceIndicatorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistItemResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistItemResource.cs index ec46d2e3e2600..3ff4828672bff 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistItemResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistItemResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsWatchlistItemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The watchlistAlias. + /// The watchlistItemId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string watchlistAlias, string watchlistItemId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}"; diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistResource.cs index fc44183f98a1a..0ffd7df5f2a0a 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityInsightsWatchlistResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The watchlistAlias. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string watchlistAlias) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SecurityInsightsWatchlistItemResources and their operations over a SecurityInsightsWatchlistItemResource. public virtual SecurityInsightsWatchlistItemCollection GetSecurityInsightsWatchlistItems() { - return GetCachedClient(Client => new SecurityInsightsWatchlistItemCollection(Client, Id)); + return GetCachedClient(client => new SecurityInsightsWatchlistItemCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual SecurityInsightsWatchlistItemCollection GetSecurityInsightsWatchl /// /// The watchlist item id (GUID). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSecurityInsightsWatchlistItemAsync(string watchlistItemId, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetSe /// /// The watchlist item id (GUID). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSecurityInsightsWatchlistItem(string watchlistItemId, CancellationToken cancellationToken = default) { diff --git a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityMLAnalyticsSettingResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityMLAnalyticsSettingResource.cs index 5fd73f5a91f17..93ecf7485840e 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityMLAnalyticsSettingResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityMLAnalyticsSettingResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SecurityInsights public partial class SecurityMLAnalyticsSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The settingsResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string settingsResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName}"; diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/CHANGELOG.md b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/CHANGELOG.md index a16d1be988dc3..938e07787e229 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/CHANGELOG.md +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/CHANGELOG.md @@ -1,14 +1,14 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0-beta.1 (2023-11-06) ### Features Added +Discovery +GUidedTroubleshooter +Solutions ### Breaking Changes - -### Bugs Fixed - -### Other Changes +Discovery API contract change ## 1.0.0 (2023-06-06) diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/api/Azure.ResourceManager.SelfHelp.netstandard2.0.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/api/Azure.ResourceManager.SelfHelp.netstandard2.0.cs index 2913b753f4580..bca99651a7b46 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/api/Azure.ResourceManager.SelfHelp.netstandard2.0.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/api/Azure.ResourceManager.SelfHelp.netstandard2.0.cs @@ -43,18 +43,329 @@ public static partial class SelfHelpExtensions public static Azure.ResourceManager.SelfHelp.SelfHelpDiagnosticCollection GetSelfHelpDiagnostics(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } public static Azure.Pageable GetSelfHelpDiscoverySolutions(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string filter = null, string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetSelfHelpDiscoverySolutionsAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string filter = null, string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SelfHelp.SolutionResource GetSolutionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetSolutionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSolutionResourceAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SelfHelp.SolutionResourceCollection GetSolutionResources(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.ResourceManager.SelfHelp.TroubleshooterResource GetTroubleshooterResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetTroubleshooterResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetTroubleshooterResourceAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SelfHelp.TroubleshooterResourceCollection GetTroubleshooterResources(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + } + public partial class SolutionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SolutionResource() { } + public virtual Azure.ResourceManager.SelfHelp.SolutionResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string scope, string solutionResourceName) { 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.SelfHelp.Models.SolutionResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SelfHelp.Models.SolutionResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SolutionResourceCollection : Azure.ResourceManager.ArmCollection + { + protected SolutionResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string solutionResourceName, Azure.ResourceManager.SelfHelp.SolutionResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string solutionResourceName, Azure.ResourceManager.SelfHelp.SolutionResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SolutionResourceData : Azure.ResourceManager.Models.ResourceData + { + public SolutionResourceData() { } + public Azure.ResourceManager.SelfHelp.Models.SolutionResourceProperties Properties { get { throw null; } set { } } + } + public partial class TroubleshooterResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TroubleshooterResource() { } + public virtual Azure.ResourceManager.SelfHelp.TroubleshooterResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response Continue(Azure.ResourceManager.SelfHelp.Models.ContinueRequestBody continueRequestBody = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ContinueAsync(Azure.ResourceManager.SelfHelp.Models.ContinueRequestBody continueRequestBody = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string scope, string troubleshooterName) { throw null; } + public virtual Azure.Response End(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task EndAsync(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 Restart(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RestartAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.SelfHelp.TroubleshooterResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SelfHelp.TroubleshooterResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class TroubleshooterResourceCollection : Azure.ResourceManager.ArmCollection + { + protected TroubleshooterResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string troubleshooterName, Azure.ResourceManager.SelfHelp.TroubleshooterResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string troubleshooterName, Azure.ResourceManager.SelfHelp.TroubleshooterResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class TroubleshooterResourceData : Azure.ResourceManager.Models.ResourceData + { + public TroubleshooterResourceData() { } + public System.Collections.Generic.IDictionary Parameters { get { throw null; } } + public Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState? ProvisioningState { get { throw null; } } + public string SolutionId { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList Steps { get { throw null; } } + } +} +namespace Azure.ResourceManager.SelfHelp.Mocking +{ + public partial class MockableSelfHelpArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSelfHelpArmClient() { } + public virtual Azure.Response CheckSelfHelpNameAvailability(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.SelfHelp.Models.SelfHelpNameAvailabilityContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckSelfHelpNameAvailabilityAsync(Azure.Core.ResourceIdentifier scope, Azure.ResourceManager.SelfHelp.Models.SelfHelpNameAvailabilityContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSelfHelpDiagnostic(Azure.Core.ResourceIdentifier scope, string diagnosticsResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSelfHelpDiagnosticAsync(Azure.Core.ResourceIdentifier scope, string diagnosticsResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SelfHelp.SelfHelpDiagnosticResource GetSelfHelpDiagnosticResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SelfHelp.SelfHelpDiagnosticCollection GetSelfHelpDiagnostics(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Pageable GetSelfHelpDiscoverySolutions(Azure.Core.ResourceIdentifier scope, string filter = null, string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSelfHelpDiscoverySolutionsAsync(Azure.Core.ResourceIdentifier scope, string filter = null, string skiptoken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SelfHelp.SolutionResource GetSolutionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetSolutionResource(Azure.Core.ResourceIdentifier scope, string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSolutionResourceAsync(Azure.Core.ResourceIdentifier scope, string solutionResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SelfHelp.SolutionResourceCollection GetSolutionResources(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.ResourceManager.SelfHelp.TroubleshooterResource GetTroubleshooterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetTroubleshooterResource(Azure.Core.ResourceIdentifier scope, string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTroubleshooterResourceAsync(Azure.Core.ResourceIdentifier scope, string troubleshooterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SelfHelp.TroubleshooterResourceCollection GetTroubleshooterResources(Azure.Core.ResourceIdentifier scope) { throw null; } } } namespace Azure.ResourceManager.SelfHelp.Models { + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AggregationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AggregationType(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.AggregationType Avg { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.AggregationType Count { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.AggregationType Max { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.AggregationType Min { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.AggregationType Sum { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.AggregationType 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.SelfHelp.Models.AggregationType left, Azure.ResourceManager.SelfHelp.Models.AggregationType right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.AggregationType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.AggregationType left, Azure.ResourceManager.SelfHelp.Models.AggregationType right) { throw null; } + public override string ToString() { throw null; } + } public static partial class ArmSelfHelpModelFactory { + public static Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResult AutomatedCheckResult(string result = null, Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType? resultType = default(Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType?)) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.ResponseConfig ResponseConfig(string key = null, string value = null) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.ResponseValidationProperties ResponseValidationProperties(string regex = null, bool? isRequired = default(bool?), string validationErrorMessage = null, long? maxLength = default(long?)) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.RestartTroubleshooterResult RestartTroubleshooterResult(string troubleshooterResourceName = null) { throw null; } public static Azure.ResourceManager.SelfHelp.SelfHelpDiagnosticData SelfHelpDiagnosticData(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 globalParameters = null, System.Collections.Generic.IEnumerable insights = null, System.DateTimeOffset? acceptedOn = default(System.DateTimeOffset?), Azure.ResourceManager.SelfHelp.Models.SelfHelpProvisioningState? provisioningState = default(Azure.ResourceManager.SelfHelp.Models.SelfHelpProvisioningState?), System.Collections.Generic.IEnumerable diagnostics = null) { throw null; } public static Azure.ResourceManager.SelfHelp.Models.SelfHelpDiagnosticInfo SelfHelpDiagnosticInfo(string solutionId = null, Azure.ResourceManager.SelfHelp.Models.SelfHelpDiagnosticStatus? status = default(Azure.ResourceManager.SelfHelp.Models.SelfHelpDiagnosticStatus?), System.Collections.Generic.IEnumerable insights = null, Azure.ResourceManager.SelfHelp.Models.SelfHelpError error = null) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This function is obsolete and will be removed in a future release.", false)] public static Azure.ResourceManager.SelfHelp.Models.SelfHelpDiagnosticInsight SelfHelpDiagnosticInsight(string id = null, string title = null, string results = null, Azure.ResourceManager.SelfHelp.Models.SelfHelpImportanceLevel? insightImportanceLevel = default(Azure.ResourceManager.SelfHelp.Models.SelfHelpImportanceLevel?)) { throw null; } public static Azure.ResourceManager.SelfHelp.Models.SelfHelpError SelfHelpError(string code = null, string errorType = null, string message = null, System.Collections.Generic.IEnumerable details = null) { throw null; } public static Azure.ResourceManager.SelfHelp.Models.SelfHelpNameAvailabilityResult SelfHelpNameAvailabilityResult(bool? isNameAvailable = default(bool?), string reason = null, string message = null) { throw null; } - public static Azure.ResourceManager.SelfHelp.Models.SelfHelpSolutionMetadata SelfHelpSolutionMetadata(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string solutionId = null, string solutionType = null, string description = null, System.Collections.Generic.IEnumerable> requiredParameterSets = null) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpSolutionMetadata SelfHelpSolutionMetadata(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.IEnumerable solutions = null) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpSolutionMetadata SelfHelpSolutionMetadata(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, string solutionId, string solutionType, string description, System.Collections.Generic.IEnumerable> requiredParameterSets) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpStep SelfHelpStep(string id = null, string title = null, string description = null, string guidance = null, Azure.ResourceManager.SelfHelp.Models.ExecutionStatus? executionStatus = default(Azure.ResourceManager.SelfHelp.Models.ExecutionStatus?), string executionStatusDescription = null, Azure.ResourceManager.SelfHelp.Models.SelfHelpType? stepType = default(Azure.ResourceManager.SelfHelp.Models.SelfHelpType?), bool? isLastStep = default(bool?), System.Collections.Generic.IEnumerable inputs = null, Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResult automatedCheckResults = null, System.Collections.Generic.IEnumerable insights = null, Azure.ResponseError error = null) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.SolutionMetadataProperties SolutionMetadataProperties(string solutionId = null, Azure.ResourceManager.SelfHelp.Models.SolutionType? solutionType = default(Azure.ResourceManager.SelfHelp.Models.SolutionType?), string description = null, System.Collections.Generic.IEnumerable requiredInputs = null) { throw null; } + public static Azure.ResourceManager.SelfHelp.SolutionResourceData SolutionResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.SelfHelp.Models.SolutionResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.StepInput StepInput(string questionId = null, string questionType = null, string questionContent = null, Azure.ResourceManager.SelfHelp.Models.QuestionContentType? questionContentType = default(Azure.ResourceManager.SelfHelp.Models.QuestionContentType?), string responseHint = null, string recommendedOption = null, string selectedOptionValue = null, Azure.ResourceManager.SelfHelp.Models.ResponseValidationProperties responseValidationProperties = null, System.Collections.Generic.IEnumerable responseOptions = null) { throw null; } + public static Azure.ResourceManager.SelfHelp.TroubleshooterResourceData TroubleshooterResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string solutionId = null, System.Collections.Generic.IDictionary parameters = null, Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState? provisioningState = default(Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState?), System.Collections.Generic.IEnumerable steps = null) { throw null; } + } + public partial class AutomatedCheckResult + { + internal AutomatedCheckResult() { } + public string Result { get { throw null; } } + public Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType? ResultType { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AutomatedCheckResultType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AutomatedCheckResultType(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType Error { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType Information { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType Success { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType 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.SelfHelp.Models.AutomatedCheckResultType left, Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType left, Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResultType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ContinueRequestBody + { + public ContinueRequestBody() { } + public System.Collections.Generic.IList Responses { get { throw null; } } + public string StepId { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ExecutionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ExecutionStatus(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.ExecutionStatus Failed { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.ExecutionStatus Running { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.ExecutionStatus Success { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.ExecutionStatus Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.ExecutionStatus 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.SelfHelp.Models.ExecutionStatus left, Azure.ResourceManager.SelfHelp.Models.ExecutionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.ExecutionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.ExecutionStatus left, Azure.ResourceManager.SelfHelp.Models.ExecutionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class MetricsBasedChart + { + public MetricsBasedChart() { } + public Azure.ResourceManager.SelfHelp.Models.AggregationType? AggregationType { get { throw null; } set { } } + public System.Collections.Generic.IList Filter { get { throw null; } } + public string Name { get { throw null; } set { } } + public string ReplacementKey { get { throw null; } set { } } + public System.TimeSpan? TimeSpanDuration { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct QuestionContentType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QuestionContentType(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.QuestionContentType Html { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.QuestionContentType Markdown { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.QuestionContentType Text { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.QuestionContentType 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.SelfHelp.Models.QuestionContentType left, Azure.ResourceManager.SelfHelp.Models.QuestionContentType right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.QuestionContentType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.QuestionContentType left, Azure.ResourceManager.SelfHelp.Models.QuestionContentType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct QuestionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QuestionType(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.QuestionType Dropdown { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.QuestionType MultiLineInfoBox { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.QuestionType RadioButton { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.QuestionType TextInput { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.QuestionType 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.SelfHelp.Models.QuestionType left, Azure.ResourceManager.SelfHelp.Models.QuestionType right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.QuestionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.QuestionType left, Azure.ResourceManager.SelfHelp.Models.QuestionType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ReplacementMaps + { + public ReplacementMaps() { } + public System.Collections.Generic.IList Diagnostics { get { throw null; } } + public System.Collections.Generic.IList MetricsBasedCharts { get { throw null; } } + public System.Collections.Generic.IList Troubleshooters { get { throw null; } } + public System.Collections.Generic.IList VideoGroups { get { throw null; } } + public System.Collections.Generic.IList Videos { get { throw null; } } + public System.Collections.Generic.IList WebResults { get { throw null; } } + } + public partial class ResponseConfig + { + internal ResponseConfig() { } + public string Key { get { throw null; } } + public string Value { get { throw null; } } + } + public partial class ResponseValidationProperties + { + internal ResponseValidationProperties() { } + public bool? IsRequired { get { throw null; } } + public long? MaxLength { get { throw null; } } + public string Regex { get { throw null; } } + public string ValidationErrorMessage { get { throw null; } } + } + public partial class RestartTroubleshooterResult + { + internal RestartTroubleshooterResult() { } + public string TroubleshooterResourceName { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResultType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResultType(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.ResultType Community { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.ResultType Documentation { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.ResultType 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.SelfHelp.Models.ResultType left, Azure.ResourceManager.SelfHelp.Models.ResultType right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.ResultType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.ResultType left, Azure.ResourceManager.SelfHelp.Models.ResultType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SearchResult + { + public SearchResult() { } + public Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence? Confidence { get { throw null; } set { } } + public string Content { get { throw null; } set { } } + public string Link { get { throw null; } set { } } + public int? Rank { get { throw null; } set { } } + public Azure.ResourceManager.SelfHelp.Models.ResultType? ResultType { get { throw null; } set { } } + public string SolutionId { get { throw null; } set { } } + public string Source { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SelfHelpConfidence : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SelfHelpConfidence(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence High { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence Low { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence Medium { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence 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.SelfHelp.Models.SelfHelpConfidence left, Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence left, Azure.ResourceManager.SelfHelp.Models.SelfHelpConfidence right) { throw null; } + public override string ToString() { throw null; } } public partial class SelfHelpDiagnosticInfo { @@ -66,11 +377,11 @@ internal SelfHelpDiagnosticInfo() { } } public partial class SelfHelpDiagnosticInsight { - internal SelfHelpDiagnosticInsight() { } - public string Id { get { throw null; } } - public Azure.ResourceManager.SelfHelp.Models.SelfHelpImportanceLevel? InsightImportanceLevel { get { throw null; } } - public string Results { get { throw null; } } - public string Title { get { throw null; } } + public SelfHelpDiagnosticInsight() { } + public string Id { get { throw null; } set { } } + public Azure.ResourceManager.SelfHelp.Models.SelfHelpImportanceLevel? InsightImportanceLevel { get { throw null; } set { } } + public string Results { get { throw null; } set { } } + public string Title { get { throw null; } set { } } } public partial class SelfHelpDiagnosticInvocation { @@ -107,6 +418,13 @@ internal SelfHelpError() { } public string ErrorType { get { throw null; } } public string Message { get { throw null; } } } + public partial class SelfHelpFilter + { + public SelfHelpFilter() { } + public string Name { get { throw null; } set { } } + public string Operator { get { throw null; } set { } } + public string Values { get { throw null; } set { } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct SelfHelpImportanceLevel : System.IEquatable { @@ -126,6 +444,25 @@ internal SelfHelpError() { } public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.SelfHelpImportanceLevel left, Azure.ResourceManager.SelfHelp.Models.SelfHelpImportanceLevel right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SelfHelpName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SelfHelpName(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpName ProblemClassificationId { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpName ReplacementKey { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpName SolutionId { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.SelfHelpName 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.SelfHelp.Models.SelfHelpName left, Azure.ResourceManager.SelfHelp.Models.SelfHelpName right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.SelfHelpName (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.SelfHelpName left, Azure.ResourceManager.SelfHelp.Models.SelfHelpName right) { throw null; } + public override string ToString() { throw null; } + } public partial class SelfHelpNameAvailabilityContent { public SelfHelpNameAvailabilityContent() { } @@ -159,12 +496,209 @@ internal SelfHelpNameAvailabilityResult() { } public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.SelfHelpProvisioningState left, Azure.ResourceManager.SelfHelp.Models.SelfHelpProvisioningState right) { throw null; } public override string ToString() { throw null; } } + public partial class SelfHelpSection + { + public SelfHelpSection() { } + public string Content { get { throw null; } set { } } + public Azure.ResourceManager.SelfHelp.Models.ReplacementMaps ReplacementMaps { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + } public partial class SelfHelpSolutionMetadata : Azure.ResourceManager.Models.ResourceData { public SelfHelpSolutionMetadata() { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public string Description { get { throw null; } set { } } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public System.Collections.Generic.IList> RequiredParameterSets { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public string SolutionId { get { throw null; } set { } } + public System.Collections.Generic.IList Solutions { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public string SolutionType { get { throw null; } set { } } } + public partial class SelfHelpStep + { + internal SelfHelpStep() { } + public Azure.ResourceManager.SelfHelp.Models.AutomatedCheckResult AutomatedCheckResults { get { throw null; } } + public string Description { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public Azure.ResourceManager.SelfHelp.Models.ExecutionStatus? ExecutionStatus { get { throw null; } } + public string ExecutionStatusDescription { get { throw null; } } + public string Guidance { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Inputs { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Insights { get { throw null; } } + public bool? IsLastStep { get { throw null; } } + public Azure.ResourceManager.SelfHelp.Models.SelfHelpType? StepType { get { throw null; } } + public string Title { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SelfHelpType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SelfHelpType(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpType AutomatedCheck { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpType Decision { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpType Insight { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SelfHelpType Solution { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.SelfHelpType 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.SelfHelp.Models.SelfHelpType left, Azure.ResourceManager.SelfHelp.Models.SelfHelpType right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.SelfHelpType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.SelfHelpType left, Azure.ResourceManager.SelfHelp.Models.SelfHelpType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SelfHelpVideo : Azure.ResourceManager.SelfHelp.Models.VideoGroupVideo + { + public SelfHelpVideo() { } + public string ReplacementKey { get { throw null; } set { } } + } + public partial class SolutionMetadataProperties + { + public SolutionMetadataProperties() { } + public string Description { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredInputs { get { throw null; } } + public string SolutionId { get { throw null; } set { } } + public Azure.ResourceManager.SelfHelp.Models.SolutionType? SolutionType { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SolutionProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SolutionProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState 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.SelfHelp.Models.SolutionProvisioningState left, Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState left, Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SolutionResourcePatch + { + public SolutionResourcePatch() { } + public Azure.ResourceManager.SelfHelp.Models.SolutionResourceProperties Properties { get { throw null; } set { } } + } + public partial class SolutionResourceProperties + { + public SolutionResourceProperties() { } + public string Content { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Parameters { get { throw null; } } + public Azure.ResourceManager.SelfHelp.Models.SolutionProvisioningState? ProvisioningState { get { throw null; } set { } } + public Azure.ResourceManager.SelfHelp.Models.ReplacementMaps ReplacementMaps { get { throw null; } set { } } + public System.Collections.Generic.IList Sections { get { throw null; } } + public string SolutionId { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + public System.Collections.Generic.IList TriggerCriteria { get { throw null; } } + } + public partial class SolutionsDiagnostic + { + public SolutionsDiagnostic() { } + public System.Collections.Generic.IList Insights { get { throw null; } } + public string ReplacementKey { get { throw null; } set { } } + public System.Collections.Generic.IList RequiredParameters { get { throw null; } } + public string SolutionId { get { throw null; } set { } } + public Azure.ResourceManager.SelfHelp.Models.SelfHelpDiagnosticStatus? Status { get { throw null; } set { } } + public string StatusDetails { get { throw null; } set { } } + } + public partial class SolutionsTroubleshooters + { + public SolutionsTroubleshooters() { } + public string SolutionId { get { throw null; } set { } } + public string Summary { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SolutionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SolutionType(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.SolutionType Diagnostics { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.SolutionType Solutions { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.SolutionType 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.SelfHelp.Models.SolutionType left, Azure.ResourceManager.SelfHelp.Models.SolutionType right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.SolutionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.SolutionType left, Azure.ResourceManager.SelfHelp.Models.SolutionType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class StepInput + { + internal StepInput() { } + public string QuestionContent { get { throw null; } } + public Azure.ResourceManager.SelfHelp.Models.QuestionContentType? QuestionContentType { get { throw null; } } + public string QuestionId { get { throw null; } } + public string QuestionType { get { throw null; } } + public string RecommendedOption { get { throw null; } } + public string ResponseHint { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ResponseOptions { get { throw null; } } + public Azure.ResourceManager.SelfHelp.Models.ResponseValidationProperties ResponseValidationProperties { get { throw null; } } + public string SelectedOptionValue { get { throw null; } } + } + public partial class TriggerCriterion + { + public TriggerCriterion() { } + public Azure.ResourceManager.SelfHelp.Models.SelfHelpName? Name { get { throw null; } set { } } + public string Value { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TroubleshooterProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TroubleshooterProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState AutoContinue { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState Running { get { throw null; } } + public static Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState 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.SelfHelp.Models.TroubleshooterProvisioningState left, Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState left, Azure.ResourceManager.SelfHelp.Models.TroubleshooterProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TroubleshooterResult + { + public TroubleshooterResult() { } + public string QuestionId { get { throw null; } set { } } + public Azure.ResourceManager.SelfHelp.Models.QuestionType? QuestionType { get { throw null; } set { } } + public string Response { get { throw null; } set { } } + } + public partial class VideoGroup + { + public VideoGroup() { } + public string ReplacementKey { get { throw null; } set { } } + public System.Collections.Generic.IList Videos { get { throw null; } } + } + public partial class VideoGroupVideo + { + public VideoGroupVideo() { } + public string Src { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + } + public partial class WebResult + { + public WebResult() { } + public string ReplacementKey { get { throw null; } set { } } + public System.Collections.Generic.IList SearchResults { get { throw null; } } + } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/assets.json b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/assets.json index e96ed1a2caabb..abb986aff165e 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/assets.json +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/assets.json @@ -1,6 +1,6 @@ { - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "net", - "TagPrefix": "net/selfhelp/Azure.ResourceManager.SelfHelp", - "Tag": "net/selfhelp/Azure.ResourceManager.SelfHelp_ee92231566" + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/selfhelp/Azure.ResourceManager.SelfHelp", + "Tag": "net/selfhelp/Azure.ResourceManager.SelfHelp_45eb17d60c" } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticCollection.cs index 233706a7ffab0..6912cb7e5884b 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticCollection.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_SelfHelpDiagnosticCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreatesADiagnosticForAKeyVaultResource() { - // Generated from example definition: specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/CreateDiagnosticForKeyVaultResource.json + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/CreateDiagnosticForKeyVaultResource.json // this example is just showing the usage of "Diagnostics_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -34,7 +34,7 @@ public async Task CreateOrUpdate_CreatesADiagnosticForAKeyVaultResource() // for more information of creating ArmResource, please refer to the document of ArmResource // get the collection of this SelfHelpDiagnosticResource - string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; + string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); SelfHelpDiagnosticCollection collection = client.GetSelfHelpDiagnostics(scopeId); @@ -56,7 +56,7 @@ public async Task CreateOrUpdate_CreatesADiagnosticForAKeyVaultResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetsADiagnosticForAKeyVaultResource() { - // Generated from example definition: specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/GetDiagnosticForKeyVaultResource.json + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/GetDiagnosticForKeyVaultResource.json // this example is just showing the usage of "Diagnostics_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -68,7 +68,7 @@ public async Task Get_GetsADiagnosticForAKeyVaultResource() // for more information of creating ArmResource, please refer to the document of ArmResource // get the collection of this SelfHelpDiagnosticResource - string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; + string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); SelfHelpDiagnosticCollection collection = client.GetSelfHelpDiagnostics(scopeId); @@ -88,7 +88,7 @@ public async Task Get_GetsADiagnosticForAKeyVaultResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetsADiagnosticForAKeyVaultResource() { - // Generated from example definition: specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/GetDiagnosticForKeyVaultResource.json + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/GetDiagnosticForKeyVaultResource.json // this example is just showing the usage of "Diagnostics_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -100,7 +100,7 @@ public async Task Exists_GetsADiagnosticForAKeyVaultResource() // for more information of creating ArmResource, please refer to the document of ArmResource // get the collection of this SelfHelpDiagnosticResource - string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; + string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); SelfHelpDiagnosticCollection collection = client.GetSelfHelpDiagnostics(scopeId); @@ -116,7 +116,7 @@ public async Task Exists_GetsADiagnosticForAKeyVaultResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetsADiagnosticForAKeyVaultResource() { - // Generated from example definition: specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/GetDiagnosticForKeyVaultResource.json + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/GetDiagnosticForKeyVaultResource.json // this example is just showing the usage of "Diagnostics_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -128,7 +128,7 @@ public async Task GetIfExists_GetsADiagnosticForAKeyVaultResource() // for more information of creating ArmResource, please refer to the document of ArmResource // get the collection of this SelfHelpDiagnosticResource - string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; + string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); SelfHelpDiagnosticCollection collection = client.GetSelfHelpDiagnostics(scopeId); diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticResource.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticResource.cs index 9671d2921dfbf..2a6077cd3dd96 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticResource.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SelfHelpDiagnosticResource.cs @@ -22,7 +22,7 @@ public partial class Sample_SelfHelpDiagnosticResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreatesADiagnosticForAKeyVaultResource() { - // Generated from example definition: specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/CreateDiagnosticForKeyVaultResource.json + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/CreateDiagnosticForKeyVaultResource.json // this example is just showing the usage of "Diagnostics_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -32,7 +32,7 @@ public async Task Update_CreatesADiagnosticForAKeyVaultResource() // this example assumes you already have this SelfHelpDiagnosticResource created on azure // for more information of creating SelfHelpDiagnosticResource, please refer to the document of SelfHelpDiagnosticResource - string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; + string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; string diagnosticsResourceName = "VMNotWorkingInsight"; ResourceIdentifier selfHelpDiagnosticResourceId = SelfHelpDiagnosticResource.CreateResourceIdentifier(scope, diagnosticsResourceName); SelfHelpDiagnosticResource selfHelpDiagnostic = client.GetSelfHelpDiagnosticResource(selfHelpDiagnosticResourceId); @@ -54,7 +54,7 @@ public async Task Update_CreatesADiagnosticForAKeyVaultResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetsADiagnosticForAKeyVaultResource() { - // Generated from example definition: specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/GetDiagnosticForKeyVaultResource.json + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/GetDiagnosticForKeyVaultResource.json // this example is just showing the usage of "Diagnostics_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -64,7 +64,7 @@ public async Task Get_GetsADiagnosticForAKeyVaultResource() // this example assumes you already have this SelfHelpDiagnosticResource created on azure // for more information of creating SelfHelpDiagnosticResource, please refer to the document of SelfHelpDiagnosticResource - string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; + string scope = "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourceGroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read"; string diagnosticsResourceName = "VMNotWorkingInsight"; ResourceIdentifier selfHelpDiagnosticResourceId = SelfHelpDiagnosticResource.CreateResourceIdentifier(scope, diagnosticsResourceName); SelfHelpDiagnosticResource selfHelpDiagnostic = client.GetSelfHelpDiagnosticResource(selfHelpDiagnosticResourceId); diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResource.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResource.cs new file mode 100644 index 0000000000000..d0132d4178227 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResource.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.SelfHelp; +using Azure.ResourceManager.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp.Samples +{ + public partial class Sample_SolutionResource + { + // Solution_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SolutionGet() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Get.json + // this example is just showing the usage of "Solution_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionResource created on azure + // for more information of creating SolutionResource, please refer to the document of SolutionResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + string solutionResourceName = "SolutionResource1"; + ResourceIdentifier solutionResourceId = SolutionResource.CreateResourceIdentifier(scope, solutionResourceName); + SolutionResource solutionResource = client.GetSolutionResource(solutionResourceId); + + // invoke the operation + SolutionResource result = await solutionResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Solution_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_SolutionUpdate() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Update.json + // this example is just showing the usage of "Solution_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SolutionResource created on azure + // for more information of creating SolutionResource, please refer to the document of SolutionResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + string solutionResourceName = "SolutionResourceName1"; + ResourceIdentifier solutionResourceId = SolutionResource.CreateResourceIdentifier(scope, solutionResourceName); + SolutionResource solutionResource = client.GetSolutionResource(solutionResourceId); + + // invoke the operation + SolutionResourcePatch patch = new SolutionResourcePatch(); + ArmOperation lro = await solutionResource.UpdateAsync(WaitUntil.Completed, patch); + SolutionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResourceCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResourceCollection.cs new file mode 100644 index 0000000000000..8d1b6db1070be --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResourceCollection.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.SelfHelp; +using Azure.ResourceManager.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp.Samples +{ + public partial class Sample_SolutionResourceCollection + { + // Solution_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_SolutionCreate() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Create.json + // this example is just showing the usage of "Solution_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + SolutionResourceCollection collection = client.GetSolutionResources(scopeId); + + // invoke the operation + string solutionResourceName = "SolutionResourceName1"; + SolutionResourceData data = new SolutionResourceData() + { + Properties = new SolutionResourceProperties() + { + TriggerCriteria = +{ +new TriggerCriterion() +{ +Name = SelfHelpName.SolutionId, +Value = "SolutionId1", +} +}, + Parameters = +{ +["resourceUri"] = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, solutionResourceName, data); + SolutionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Solution_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SolutionGet() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Get.json + // this example is just showing the usage of "Solution_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + SolutionResourceCollection collection = client.GetSolutionResources(scopeId); + + // invoke the operation + string solutionResourceName = "SolutionResource1"; + SolutionResource result = await collection.GetAsync(solutionResourceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Solution_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_SolutionGet() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Get.json + // this example is just showing the usage of "Solution_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + SolutionResourceCollection collection = client.GetSolutionResources(scopeId); + + // invoke the operation + string solutionResourceName = "SolutionResource1"; + bool result = await collection.ExistsAsync(solutionResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Solution_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_SolutionGet() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Solution_Get.json + // this example is just showing the usage of "Solution_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this SolutionResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + SolutionResourceCollection collection = client.GetSolutionResources(scopeId); + + // invoke the operation + string solutionResourceName = "SolutionResource1"; + NullableResponse response = await collection.GetIfExistsAsync(solutionResourceName); + SolutionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SolutionResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_TroubleshooterResource.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_TroubleshooterResource.cs new file mode 100644 index 0000000000000..ec7db5558288a --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_TroubleshooterResource.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.SelfHelp; +using Azure.ResourceManager.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp.Samples +{ + public partial class Sample_TroubleshooterResource + { + // Troubleshooters_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_TroubleshootersCreate() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Create.json + // this example is just showing the usage of "Troubleshooters_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TroubleshooterResource created on azure + // for more information of creating TroubleshooterResource, please refer to the document of TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + ResourceIdentifier troubleshooterResourceId = TroubleshooterResource.CreateResourceIdentifier(scope, troubleshooterName); + TroubleshooterResource troubleshooterResource = client.GetTroubleshooterResource(troubleshooterResourceId); + + // invoke the operation + TroubleshooterResourceData data = new TroubleshooterResourceData() + { + SolutionId = "SampleTroubleshooterSolutionId", + Parameters = +{ +["ResourceURI"] = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", +}, + }; + ArmOperation lro = await troubleshooterResource.UpdateAsync(WaitUntil.Completed, data); + TroubleshooterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TroubleshooterResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Troubleshooters_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_TroubleshootersGet() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Get.json + // this example is just showing the usage of "Troubleshooters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TroubleshooterResource created on azure + // for more information of creating TroubleshooterResource, please refer to the document of TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + ResourceIdentifier troubleshooterResourceId = TroubleshooterResource.CreateResourceIdentifier(scope, troubleshooterName); + TroubleshooterResource troubleshooterResource = client.GetTroubleshooterResource(troubleshooterResourceId); + + // invoke the operation + TroubleshooterResource result = await troubleshooterResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TroubleshooterResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Troubleshooter_Continue + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Continue_TroubleshooterContinue() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Continue.json + // this example is just showing the usage of "Troubleshooters_Continue" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TroubleshooterResource created on azure + // for more information of creating TroubleshooterResource, please refer to the document of TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + ResourceIdentifier troubleshooterResourceId = TroubleshooterResource.CreateResourceIdentifier(scope, troubleshooterName); + TroubleshooterResource troubleshooterResource = client.GetTroubleshooterResource(troubleshooterResourceId); + + // invoke the operation + ContinueRequestBody continueRequestBody = new ContinueRequestBody() + { + StepId = "SampleStepId", + Responses = +{ +new TroubleshooterResult() +{ +QuestionId = "SampleQuestionId", +QuestionType = new QuestionType("Text"), +Response = "Connection exception", +} +}, + }; + await troubleshooterResource.ContinueAsync(continueRequestBody: continueRequestBody); + + Console.WriteLine($"Succeeded"); + } + + // Troubleshooters_End + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task End_TroubleshootersEnd() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_End.json + // this example is just showing the usage of "Troubleshooters_End" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TroubleshooterResource created on azure + // for more information of creating TroubleshooterResource, please refer to the document of TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + ResourceIdentifier troubleshooterResourceId = TroubleshooterResource.CreateResourceIdentifier(scope, troubleshooterName); + TroubleshooterResource troubleshooterResource = client.GetTroubleshooterResource(troubleshooterResourceId); + + // invoke the operation + await troubleshooterResource.EndAsync(); + + Console.WriteLine($"Succeeded"); + } + + // Troubleshooters_Restart + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Restart_TroubleshootersRestart() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Restart.json + // this example is just showing the usage of "Troubleshooters_Restart" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TroubleshooterResource created on azure + // for more information of creating TroubleshooterResource, please refer to the document of TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + ResourceIdentifier troubleshooterResourceId = TroubleshooterResource.CreateResourceIdentifier(scope, troubleshooterName); + TroubleshooterResource troubleshooterResource = client.GetTroubleshooterResource(troubleshooterResourceId); + + // invoke the operation + RestartTroubleshooterResult result = await troubleshooterResource.RestartAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_TroubleshooterResourceCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_TroubleshooterResourceCollection.cs new file mode 100644 index 0000000000000..3f6545ff000dc --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_TroubleshooterResourceCollection.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.SelfHelp; + +namespace Azure.ResourceManager.SelfHelp.Samples +{ + public partial class Sample_TroubleshooterResourceCollection + { + // Troubleshooters_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_TroubleshootersCreate() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Create.json + // this example is just showing the usage of "Troubleshooters_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + TroubleshooterResourceCollection collection = client.GetTroubleshooterResources(scopeId); + + // invoke the operation + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + TroubleshooterResourceData data = new TroubleshooterResourceData() + { + SolutionId = "SampleTroubleshooterSolutionId", + Parameters = +{ +["ResourceURI"] = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, troubleshooterName, data); + TroubleshooterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TroubleshooterResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Troubleshooters_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_TroubleshootersGet() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Get.json + // this example is just showing the usage of "Troubleshooters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + TroubleshooterResourceCollection collection = client.GetTroubleshooterResources(scopeId); + + // invoke the operation + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + TroubleshooterResource result = await collection.GetAsync(troubleshooterName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TroubleshooterResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Troubleshooters_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_TroubleshootersGet() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Get.json + // this example is just showing the usage of "Troubleshooters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + TroubleshooterResourceCollection collection = client.GetTroubleshooterResources(scopeId); + + // invoke the operation + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + bool result = await collection.ExistsAsync(troubleshooterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Troubleshooters_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_TroubleshootersGet() + { + // Generated from example definition: specification/help/resource-manager/Microsoft.Help/preview/2023-09-01-preview/examples/Troubleshooter_Get.json + // this example is just showing the usage of "Troubleshooters_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this TroubleshooterResource + string scope = "subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-rp"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", scope)); + TroubleshooterResourceCollection collection = client.GetTroubleshooterResources(scopeId); + + // invoke the operation + string troubleshooterName = "abf168ed-1b54-454a-86f6-e4b62253d3b1"; + NullableResponse response = await collection.GetIfExistsAsync(troubleshooterName); + TroubleshooterResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + TroubleshooterResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/ArmSelfHelpModelFactory.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/ArmSelfHelpModelFactory.cs new file mode 100644 index 0000000000000..0627c6c889df1 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/ArmSelfHelpModelFactory.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public static partial class ArmSelfHelpModelFactory + { + /// Initializes a new instance of SelfHelpDiagnosticInsight. + /// + /// Article id. + /// Serialized Name: Insight.id + /// + /// + /// This insight's title. + /// Serialized Name: Insight.title + /// + /// + /// Detailed result content. + /// Serialized Name: Insight.results + /// + /// + /// Importance level of the insight. + /// Serialized Name: Insight.importanceLevel + /// + /// A new instance for mocking. + [Obsolete("This function is obsolete and will be removed in a future release.", false)] + [EditorBrowsable(EditorBrowsableState.Never)] + public static SelfHelpDiagnosticInsight SelfHelpDiagnosticInsight(string id = null, string title = null, string results = null, SelfHelpImportanceLevel? insightImportanceLevel = null) + { + return new SelfHelpDiagnosticInsight(id, title, results, insightImportanceLevel); + } + + /// Initializes a new instance of SelfHelpSolutionMetadata. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Solution Id. + /// Solution Type. + /// A detailed description of solution. + /// Required parameters for invoking this particular solution. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static SelfHelpSolutionMetadata SelfHelpSolutionMetadata(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string solutionId, string solutionType, string description, IEnumerable> requiredParameterSets) + { + return new SelfHelpSolutionMetadata(id, name, resourceType, systemData, default); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/Models/SelfHelpSolutionMetadata.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/Models/SelfHelpSolutionMetadata.Serialization.cs new file mode 100644 index 0000000000000..8437520020555 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/Models/SelfHelpSolutionMetadata.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + [CodeGenSuppress("global::Azure.Core.IUtf8JsonSerializable.Write", typeof(Utf8JsonWriter))] + public partial class SelfHelpSolutionMetadata : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SolutionId)) + { + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + } + if (Optional.IsDefined(SolutionType)) + { + writer.WritePropertyName("solutionType"u8); + writer.WriteStringValue(SolutionType); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(RequiredParameterSets)) + { + writer.WritePropertyName("requiredParameterSets"u8); + writer.WriteStartArray(); + foreach (var item in RequiredParameterSets) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStartArray(); + foreach (var item0 in item) + { + writer.WriteStringValue(item0); + } + writer.WriteEndArray(); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Solutions)) + { + writer.WritePropertyName("solutions"u8); + writer.WriteStartArray(); + foreach (var item in Solutions) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SelfHelpSolutionMetadata DeserializeSelfHelpSolutionMetadata(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional solutionId = default; + Optional solutionType = default; + Optional description = default; + Optional>> requiredParameterSets = default; + Optional> solutions = default; + foreach (var property in element.EnumerateObject()) + { + 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("solutionId"u8)) + { + solutionId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("solutionType"u8)) + { + solutionType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("requiredParameterSets"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List> array = new List>(); + foreach (var item in property0.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + List array0 = new List(); + foreach (var item0 in item.EnumerateArray()) + { + array0.Add(item0.GetString()); + } + array.Add(array0); + } + } + requiredParameterSets = array; + continue; + } + if (property0.NameEquals("solutions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(SolutionMetadataProperties.DeserializeSolutionMetadataProperties(item)); + } + solutions = array; + continue; + } + } + continue; + } + } + return new SelfHelpSolutionMetadata(id, name, type, systemData.Value, solutionId.Value, solutionType.Value, description.Value, Optional.ToList(requiredParameterSets), Optional.ToList(solutions)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/Models/SelfHelpSolutionMetadata.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/Models/SelfHelpSolutionMetadata.cs new file mode 100644 index 0000000000000..ce676ca35d432 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Custom/Models/SelfHelpSolutionMetadata.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.ComponentModel; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SelfHelpSolutionMetadata + { + /// Solution Id. + [EditorBrowsable(EditorBrowsableState.Never)] + public string SolutionId { get; set; } + + /// Solution Type. + [EditorBrowsable(EditorBrowsableState.Never)] + public string SolutionType { get; set; } + + /// A detailed description of solution. + [EditorBrowsable(EditorBrowsableState.Never)] + public string Description { get; set; } + + /// Required parameters for invoking this particular solution. + [EditorBrowsable(EditorBrowsableState.Never)] + public IList> RequiredParameterSets { get; } + + /// Initializes a new instance of SelfHelpSolutionMetadata. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Solution Id. + /// Solution Type. + /// A detailed description of solution. + /// Required parameters for invoking this particular solution. + /// List of metadata. + internal SelfHelpSolutionMetadata(ResourceIdentifier id, string name, ResourceType resourceType, ResourceManager.Models.SystemData systemData, string solutionId, string solutionType, string description, IList> requiredParameterSets, IList solutions) : base(id, name, resourceType, systemData) + { + SolutionId = solutionId; + SolutionType = solutionType; + Description = description; + RequiredParameterSets = requiredParameterSets; + Solutions = solutions; + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/ArmSelfHelpModelFactory.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/ArmSelfHelpModelFactory.cs index 22047ec637985..7c4e2c4762474 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/ArmSelfHelpModelFactory.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/ArmSelfHelpModelFactory.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.SelfHelp; @@ -60,17 +61,6 @@ public static SelfHelpDiagnosticInfo SelfHelpDiagnosticInfo(string solutionId = return new SelfHelpDiagnosticInfo(solutionId, status, insights?.ToList(), error); } - /// Initializes a new instance of SelfHelpDiagnosticInsight. - /// Article id. - /// This insight's title. - /// Detailed result content. - /// Importance level of the insight. - /// A new instance for mocking. - public static SelfHelpDiagnosticInsight SelfHelpDiagnosticInsight(string id = null, string title = null, string results = null, SelfHelpImportanceLevel? insightImportanceLevel = null) - { - return new SelfHelpDiagnosticInsight(id, title, results, insightImportanceLevel); - } - /// Initializes a new instance of SelfHelpError. /// Service specific error code which serves as the substatus for the HTTP error code. /// Service specific error type which serves as additional context for the error herein. @@ -89,16 +79,133 @@ public static SelfHelpError SelfHelpError(string code = null, string errorType = /// The name. /// The resourceType. /// The systemData. + /// List of metadata. + /// A new instance for mocking. + public static SelfHelpSolutionMetadata SelfHelpSolutionMetadata(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable solutions = null) + { + solutions ??= new List(); + + return new SelfHelpSolutionMetadata(id, name, resourceType, systemData, solutions?.ToList()); + } + + /// Initializes a new instance of SolutionMetadataProperties. /// Solution Id. /// Solution Type. /// A detailed description of solution. - /// Required parameters for invoking this particular solution. - /// A new instance for mocking. - public static SelfHelpSolutionMetadata SelfHelpSolutionMetadata(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string solutionId = null, string solutionType = null, string description = null, IEnumerable> requiredParameterSets = null) + /// Required parameters for invoking this particular solution. + /// A new instance for mocking. + public static SolutionMetadataProperties SolutionMetadataProperties(string solutionId = null, SolutionType? solutionType = null, string description = null, IEnumerable requiredInputs = null) { - requiredParameterSets ??= new List>(); + requiredInputs ??= new List(); - return new SelfHelpSolutionMetadata(id, name, resourceType, systemData, solutionId, solutionType, description, requiredParameterSets?.ToList()); + return new SolutionMetadataProperties(solutionId, solutionType, description, requiredInputs?.ToList()); + } + + /// Initializes a new instance of SolutionResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Solution result. + /// A new instance for mocking. + public static SolutionResourceData SolutionResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SolutionResourceProperties properties = null) + { + return new SolutionResourceData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of TroubleshooterResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Solution Id to identify single troubleshooter. + /// Client input parameters to run Troubleshooter Resource. + /// Status of troubleshooter provisioning. + /// List of step object. + /// A new instance for mocking. + public static TroubleshooterResourceData TroubleshooterResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string solutionId = null, IDictionary parameters = null, TroubleshooterProvisioningState? provisioningState = null, IEnumerable steps = null) + { + parameters ??= new Dictionary(); + steps ??= new List(); + + return new TroubleshooterResourceData(id, name, resourceType, systemData, solutionId, parameters, provisioningState, steps?.ToList()); + } + + /// Initializes a new instance of SelfHelpStep. + /// Unique step id. + /// Step title. + /// Step description. + /// Get or sets the Step guidance. + /// Status of Troubleshooter Step execution. + /// This field has more detailed status description of the execution status. + /// Type of Troubleshooting step. + /// is this last step of the workflow. + /// + /// Only for AutomatedStep type. + /// + /// The error detail. + /// A new instance for mocking. + public static SelfHelpStep SelfHelpStep(string id = null, string title = null, string description = null, string guidance = null, ExecutionStatus? executionStatus = null, string executionStatusDescription = null, SelfHelpType? stepType = null, bool? isLastStep = null, IEnumerable inputs = null, AutomatedCheckResult automatedCheckResults = null, IEnumerable insights = null, ResponseError error = null) + { + inputs ??= new List(); + insights ??= new List(); + + return new SelfHelpStep(id, title, description, guidance, executionStatus, executionStatusDescription, stepType, isLastStep, inputs?.ToList(), automatedCheckResults, insights?.ToList(), error); + } + + /// Initializes a new instance of StepInput. + /// Use Index as QuestionId. + /// Text Input. Will be a single line input. + /// User question content. + /// Default is Text. + /// Place holder text for response hints. + /// Result of Automate step. + /// Text of response that was selected. + /// Troubleshooter step input response validation properties. + /// + /// A new instance for mocking. + public static StepInput StepInput(string questionId = null, string questionType = null, string questionContent = null, QuestionContentType? questionContentType = null, string responseHint = null, string recommendedOption = null, string selectedOptionValue = null, ResponseValidationProperties responseValidationProperties = null, IEnumerable responseOptions = null) + { + responseOptions ??= new List(); + + return new StepInput(questionId, questionType, questionContent, questionContentType, responseHint, recommendedOption, selectedOptionValue, responseValidationProperties, responseOptions?.ToList()); + } + + /// Initializes a new instance of ResponseValidationProperties. + /// Regex used for the input validation. + /// Default True. + /// Validation Error Message. + /// Max text input (open Ended Text). + /// A new instance for mocking. + public static ResponseValidationProperties ResponseValidationProperties(string regex = null, bool? isRequired = null, string validationErrorMessage = null, long? maxLength = null) + { + return new ResponseValidationProperties(regex, isRequired, validationErrorMessage, maxLength); + } + + /// Initializes a new instance of ResponseConfig. + /// Unique string. + /// Option description. + /// A new instance for mocking. + public static ResponseConfig ResponseConfig(string key = null, string value = null) + { + return new ResponseConfig(key, value); + } + + /// Initializes a new instance of AutomatedCheckResult. + /// Insight Article Content. + /// Type of Result. + /// A new instance for mocking. + public static AutomatedCheckResult AutomatedCheckResult(string result = null, AutomatedCheckResultType? resultType = null) + { + return new AutomatedCheckResult(result, resultType); + } + + /// Initializes a new instance of RestartTroubleshooterResult. + /// Updated TroubleshooterResource Name . + /// A new instance for mocking. + public static RestartTroubleshooterResult RestartTroubleshooterResult(string troubleshooterResourceName = null) + { + return new RestartTroubleshooterResult(troubleshooterResourceName); } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index a7ff29fc7b837..0000000000000 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.SelfHelp.Models; - -namespace Azure.ResourceManager.SelfHelp -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - private ClientDiagnostics _selfHelpDiagnosticDiagnosticsClientDiagnostics; - private DiagnosticsRestOperations _selfHelpDiagnosticDiagnosticsRestClient; - private ClientDiagnostics _discoverySolutionClientDiagnostics; - private DiscoverySolutionRestOperations _discoverySolutionRestClient; - - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics SelfHelpDiagnosticDiagnosticsClientDiagnostics => _selfHelpDiagnosticDiagnosticsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SelfHelp", SelfHelpDiagnosticResource.ResourceType.Namespace, Diagnostics); - private DiagnosticsRestOperations SelfHelpDiagnosticDiagnosticsRestClient => _selfHelpDiagnosticDiagnosticsRestClient ??= new DiagnosticsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SelfHelpDiagnosticResource.ResourceType)); - private ClientDiagnostics DiscoverySolutionClientDiagnostics => _discoverySolutionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SelfHelp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DiscoverySolutionRestOperations DiscoverySolutionRestClient => _discoverySolutionRestClient ??= new DiscoverySolutionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of SelfHelpDiagnosticResources in the ArmResource. - /// An object representing collection of SelfHelpDiagnosticResources and their operations over a SelfHelpDiagnosticResource. - public virtual SelfHelpDiagnosticCollection GetSelfHelpDiagnostics() - { - return GetCachedClient(Client => new SelfHelpDiagnosticCollection(Client, Id)); - } - - /// - /// This API is used to check the uniqueness of a resource name used for a diagnostic check. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Help/checkNameAvailability - /// - /// - /// Operation Id - /// Diagnostics_CheckNameAvailability - /// - /// - /// - /// The required parameters for availability check. - /// The cancellation token to use. - public virtual async Task> CheckSelfHelpNameAvailabilityAsync(SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) - { - using var scope = SelfHelpDiagnosticDiagnosticsClientDiagnostics.CreateScope("ArmResourceExtensionClient.CheckSelfHelpNameAvailability"); - scope.Start(); - try - { - var response = await SelfHelpDiagnosticDiagnosticsRestClient.CheckNameAvailabilityAsync(Id, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This API is used to check the uniqueness of a resource name used for a diagnostic check. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Help/checkNameAvailability - /// - /// - /// Operation Id - /// Diagnostics_CheckNameAvailability - /// - /// - /// - /// The required parameters for availability check. - /// The cancellation token to use. - public virtual Response CheckSelfHelpNameAvailability(SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) - { - using var scope = SelfHelpDiagnosticDiagnosticsClientDiagnostics.CreateScope("ArmResourceExtensionClient.CheckSelfHelpNameAvailability"); - scope.Start(); - try - { - var response = SelfHelpDiagnosticDiagnosticsRestClient.CheckNameAvailability(Id, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Help/discoverySolutions - /// - /// - /// Operation Id - /// DiscoverySolution_List - /// - /// - /// - /// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSelfHelpDiscoverySolutionsAsync(string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiscoverySolutionRestClient.CreateListRequest(Id, filter, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiscoverySolutionRestClient.CreateListNextPageRequest(nextLink, Id, filter, skiptoken); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SelfHelpSolutionMetadata.DeserializeSelfHelpSolutionMetadata, DiscoverySolutionClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetSelfHelpDiscoverySolutions", "value", "nextLink", cancellationToken); - } - - /// - /// Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Help/discoverySolutions - /// - /// - /// Operation Id - /// DiscoverySolution_List - /// - /// - /// - /// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSelfHelpDiscoverySolutions(string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiscoverySolutionRestClient.CreateListRequest(Id, filter, skiptoken); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiscoverySolutionRestClient.CreateListNextPageRequest(nextLink, Id, filter, skiptoken); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SelfHelpSolutionMetadata.DeserializeSelfHelpSolutionMetadata, DiscoverySolutionClientDiagnostics, Pipeline, "ArmResourceExtensionClient.GetSelfHelpDiscoverySolutions", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/MockableSelfHelpArmClient.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/MockableSelfHelpArmClient.cs new file mode 100644 index 0000000000000..8bbeb383dad8e --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/MockableSelfHelpArmClient.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.SelfHelp; +using Azure.ResourceManager.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSelfHelpArmClient : ArmResource + { + private ClientDiagnostics _checkNameAvailabilityClientDiagnostics; + private CheckNameAvailabilityRestOperations _checkNameAvailabilityRestClient; + private ClientDiagnostics _discoverySolutionClientDiagnostics; + private DiscoverySolutionRestOperations _discoverySolutionRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSelfHelpArmClient() + { + } + + /// 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 MockableSelfHelpArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSelfHelpArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private ClientDiagnostics CheckNameAvailabilityClientDiagnostics => _checkNameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SelfHelp", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CheckNameAvailabilityRestOperations CheckNameAvailabilityRestClient => _checkNameAvailabilityRestClient ??= new CheckNameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DiscoverySolutionClientDiagnostics => _discoverySolutionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SelfHelp", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DiscoverySolutionRestOperations DiscoverySolutionRestClient => _discoverySolutionRestClient ??= new DiscoverySolutionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SelfHelpDiagnosticResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of SelfHelpDiagnosticResources and their operations over a SelfHelpDiagnosticResource. + public virtual SelfHelpDiagnosticCollection GetSelfHelpDiagnostics(ResourceIdentifier scope) + { + return new SelfHelpDiagnosticCollection(Client, scope); + } + + /// + /// Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName} + /// + /// + /// Operation Id + /// Diagnostics_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Unique resource name for insight resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSelfHelpDiagnosticAsync(ResourceIdentifier scope, string diagnosticsResourceName, CancellationToken cancellationToken = default) + { + return await GetSelfHelpDiagnostics(scope).GetAsync(diagnosticsResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName} + /// + /// + /// Operation Id + /// Diagnostics_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Unique resource name for insight resources. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSelfHelpDiagnostic(ResourceIdentifier scope, string diagnosticsResourceName, CancellationToken cancellationToken = default) + { + return GetSelfHelpDiagnostics(scope).Get(diagnosticsResourceName, cancellationToken); + } + + /// Gets a collection of SolutionResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of SolutionResources and their operations over a SolutionResource. + public virtual SolutionResourceCollection GetSolutionResources(ResourceIdentifier scope) + { + return new SolutionResourceCollection(Client, scope); + } + + /// + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Solution resource Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSolutionResourceAsync(ResourceIdentifier scope, string solutionResourceName, CancellationToken cancellationToken = default) + { + return await GetSolutionResources(scope).GetAsync(solutionResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Solution resource Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSolutionResource(ResourceIdentifier scope, string solutionResourceName, CancellationToken cancellationToken = default) + { + return GetSolutionResources(scope).Get(solutionResourceName, cancellationToken); + } + + /// Gets a collection of TroubleshooterResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of TroubleshooterResources and their operations over a TroubleshooterResource. + public virtual TroubleshooterResourceCollection GetTroubleshooterResources(ResourceIdentifier scope) + { + return new TroubleshooterResourceCollection(Client, scope); + } + + /// + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTroubleshooterResourceAsync(ResourceIdentifier scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + return await GetTroubleshooterResources(scope).GetAsync(troubleshooterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTroubleshooterResource(ResourceIdentifier scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + return GetTroubleshooterResources(scope).Get(troubleshooterName, cancellationToken); + } + + /// + /// This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or solutions + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Post + /// + /// + /// + /// The scope to use. + /// The required parameters for availability check. + /// The cancellation token to use. + public virtual async Task> CheckSelfHelpNameAvailabilityAsync(ResourceIdentifier scope, SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + using var scope0 = CheckNameAvailabilityClientDiagnostics.CreateScope("MockableSelfHelpArmClient.CheckSelfHelpNameAvailability"); + scope0.Start(); + try + { + var response = await CheckNameAvailabilityRestClient.PostAsync(scope, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or solutions + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability_Post + /// + /// + /// + /// The scope to use. + /// The required parameters for availability check. + /// The cancellation token to use. + public virtual Response CheckSelfHelpNameAvailability(ResourceIdentifier scope, SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + using var scope0 = CheckNameAvailabilityClientDiagnostics.CreateScope("MockableSelfHelpArmClient.CheckSelfHelpNameAvailability"); + scope0.Start(); + try + { + var response = CheckNameAvailabilityRestClient.Post(scope, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.Failed(e); + throw; + } + } + + /// + /// Lists the relevant Azure diagnostics and solutions using [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics and solutions. We will do our best to return the most effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input : problemClassificationId (Use the [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics and Solutions API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/discoverySolutions + /// + /// + /// Operation Id + /// DiscoverySolution_List + /// + /// + /// + /// The scope to use. + /// 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'. + /// Skiptoken is only used if a previous operation returned a partial result. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSelfHelpDiscoverySolutionsAsync(ResourceIdentifier scope, string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiscoverySolutionRestClient.CreateListRequest(scope, filter, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiscoverySolutionRestClient.CreateListNextPageRequest(nextLink, scope, filter, skiptoken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SelfHelpSolutionMetadata.DeserializeSelfHelpSolutionMetadata, DiscoverySolutionClientDiagnostics, Pipeline, "MockableSelfHelpArmClient.GetSelfHelpDiscoverySolutions", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the relevant Azure diagnostics and solutions using [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics and solutions. We will do our best to return the most effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input : problemClassificationId (Use the [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics and Solutions API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/discoverySolutions + /// + /// + /// Operation Id + /// DiscoverySolution_List + /// + /// + /// + /// The scope to use. + /// 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'. + /// Skiptoken is only used if a previous operation returned a partial result. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSelfHelpDiscoverySolutions(ResourceIdentifier scope, string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiscoverySolutionRestClient.CreateListRequest(scope, filter, skiptoken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiscoverySolutionRestClient.CreateListNextPageRequest(nextLink, scope, filter, skiptoken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SelfHelpSolutionMetadata.DeserializeSelfHelpSolutionMetadata, DiscoverySolutionClientDiagnostics, Pipeline, "MockableSelfHelpArmClient.GetSelfHelpDiscoverySolutions", "value", "nextLink", cancellationToken); + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SelfHelpDiagnosticResource GetSelfHelpDiagnosticResource(ResourceIdentifier id) + { + SelfHelpDiagnosticResource.ValidateResourceId(id); + return new SelfHelpDiagnosticResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SolutionResource GetSolutionResource(ResourceIdentifier id) + { + SolutionResource.ValidateResourceId(id); + return new SolutionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TroubleshooterResource GetTroubleshooterResource(ResourceIdentifier id) + { + TroubleshooterResource.ValidateResourceId(id); + return new TroubleshooterResource(Client, id); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/SelfHelpExtensions.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/SelfHelpExtensions.cs index 6014931d31f7c..be9783157157b 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/SelfHelpExtensions.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/SelfHelpExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.SelfHelp.Mocking; using Azure.ResourceManager.SelfHelp.Models; namespace Azure.ResourceManager.SelfHelp @@ -18,47 +19,24 @@ namespace Azure.ResourceManager.SelfHelp /// A class to add extension methods to Azure.ResourceManager.SelfHelp. public static partial class SelfHelpExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableSelfHelpArmClient GetMockableSelfHelpArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSelfHelpArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); - } - #region SelfHelpDiagnosticResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of SelfHelpDiagnosticResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static SelfHelpDiagnosticResource GetSelfHelpDiagnosticResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - SelfHelpDiagnosticResource.ValidateResourceId(id); - return new SelfHelpDiagnosticResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of SelfHelpDiagnosticResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of SelfHelpDiagnosticResources and their operations over a SelfHelpDiagnosticResource. public static SelfHelpDiagnosticCollection GetSelfHelpDiagnostics(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetSelfHelpDiagnostics(); + return GetMockableSelfHelpArmClient(client).GetSelfHelpDiagnostics(scope); } /// @@ -73,17 +51,21 @@ public static SelfHelpDiagnosticCollection GetSelfHelpDiagnostics(this ArmClient /// Diagnostics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Unique resource name for insight resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSelfHelpDiagnosticAsync(this ArmClient client, ResourceIdentifier scope, string diagnosticsResourceName, CancellationToken cancellationToken = default) { - return await client.GetSelfHelpDiagnostics(scope).GetAsync(diagnosticsResourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableSelfHelpArmClient(client).GetSelfHelpDiagnosticAsync(scope, diagnosticsResourceName, cancellationToken).ConfigureAwait(false); } /// @@ -98,21 +80,171 @@ public static async Task> GetSelfHelpDiagno /// Diagnostics_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// Unique resource name for insight resources. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSelfHelpDiagnostic(this ArmClient client, ResourceIdentifier scope, string diagnosticsResourceName, CancellationToken cancellationToken = default) { - return client.GetSelfHelpDiagnostics(scope).Get(diagnosticsResourceName, cancellationToken); + return GetMockableSelfHelpArmClient(client).GetSelfHelpDiagnostic(scope, diagnosticsResourceName, cancellationToken); + } + + /// + /// Gets a collection of SolutionResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of SolutionResources and their operations over a SolutionResource. + public static SolutionResourceCollection GetSolutionResources(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableSelfHelpArmClient(client).GetSolutionResources(scope); + } + + /// + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Solution resource Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSolutionResourceAsync(this ArmClient client, ResourceIdentifier scope, string solutionResourceName, CancellationToken cancellationToken = default) + { + return await GetMockableSelfHelpArmClient(client).GetSolutionResourceAsync(scope, solutionResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Solution resource Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSolutionResource(this ArmClient client, ResourceIdentifier scope, string solutionResourceName, CancellationToken cancellationToken = default) + { + return GetMockableSelfHelpArmClient(client).GetSolutionResource(scope, solutionResourceName, cancellationToken); + } + + /// + /// Gets a collection of TroubleshooterResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// An object representing collection of TroubleshooterResources and their operations over a TroubleshooterResource. + public static TroubleshooterResourceCollection GetTroubleshooterResources(this ArmClient client, ResourceIdentifier scope) + { + return GetMockableSelfHelpArmClient(client).GetTroubleshooterResources(scope); } /// - /// This API is used to check the uniqueness of a resource name used for a diagnostic check. + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetTroubleshooterResourceAsync(this ArmClient client, ResourceIdentifier scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + return await GetMockableSelfHelpArmClient(client).GetTroubleshooterResourceAsync(scope, troubleshooterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetTroubleshooterResource(this ArmClient client, ResourceIdentifier scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + return GetMockableSelfHelpArmClient(client).GetTroubleshooterResource(scope, troubleshooterName, cancellationToken); + } + + /// + /// This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or solutions /// /// /// Request Path @@ -120,9 +252,13 @@ public static Response GetSelfHelpDiagnostic(this Ar /// /// /// Operation Id - /// Diagnostics_CheckNameAvailability + /// CheckNameAvailability_Post /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -130,11 +266,11 @@ public static Response GetSelfHelpDiagnostic(this Ar /// The cancellation token to use. public static async Task> CheckSelfHelpNameAvailabilityAsync(this ArmClient client, ResourceIdentifier scope, SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) { - return await GetArmResourceExtensionClient(client, scope).CheckSelfHelpNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableSelfHelpArmClient(client).CheckSelfHelpNameAvailabilityAsync(scope, content, cancellationToken).ConfigureAwait(false); } /// - /// This API is used to check the uniqueness of a resource name used for a diagnostic check. + /// This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or solutions /// /// /// Request Path @@ -142,9 +278,13 @@ public static async Task> CheckSelfHelp /// /// /// Operation Id - /// Diagnostics_CheckNameAvailability + /// CheckNameAvailability_Post /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -152,11 +292,11 @@ public static async Task> CheckSelfHelp /// The cancellation token to use. public static Response CheckSelfHelpNameAvailability(this ArmClient client, ResourceIdentifier scope, SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).CheckSelfHelpNameAvailability(content, cancellationToken); + return GetMockableSelfHelpArmClient(client).CheckSelfHelpNameAvailability(scope, content, cancellationToken); } /// - /// Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. + /// Lists the relevant Azure diagnostics and solutions using [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics and solutions. We will do our best to return the most effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input : problemClassificationId (Use the [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics and Solutions API. /// /// /// Request Path @@ -167,19 +307,23 @@ public static Response CheckSelfHelpNameAvailabi /// DiscoverySolution_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'. + /// Skiptoken is only used if a previous operation returned a partial result. /// The cancellation token to use. public static AsyncPageable GetSelfHelpDiscoverySolutionsAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetSelfHelpDiscoverySolutionsAsync(filter, skiptoken, cancellationToken); + return GetMockableSelfHelpArmClient(client).GetSelfHelpDiscoverySolutionsAsync(scope, filter, skiptoken, cancellationToken); } /// - /// Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. + /// Lists the relevant Azure diagnostics and solutions using [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics and solutions. We will do our best to return the most effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input : problemClassificationId (Use the [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics and Solutions API. /// /// /// Request Path @@ -190,15 +334,67 @@ public static AsyncPageable GetSelfHelpDiscoverySoluti /// DiscoverySolution_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'. + /// Skiptoken is only used if a previous operation returned a partial result. /// The cancellation token to use. public static Pageable GetSelfHelpDiscoverySolutions(this ArmClient client, ResourceIdentifier scope, string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) { - return GetArmResourceExtensionClient(client, scope).GetSelfHelpDiscoverySolutions(filter, skiptoken, cancellationToken); + return GetMockableSelfHelpArmClient(client).GetSelfHelpDiscoverySolutions(scope, filter, skiptoken, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SelfHelpDiagnosticResource GetSelfHelpDiagnosticResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableSelfHelpArmClient(client).GetSelfHelpDiagnosticResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SolutionResource GetSolutionResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableSelfHelpArmClient(client).GetSolutionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static TroubleshooterResource GetTroubleshooterResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableSelfHelpArmClient(client).GetTroubleshooterResource(id); } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/LongRunningOperation/SolutionResourceOperationSource.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/LongRunningOperation/SolutionResourceOperationSource.cs new file mode 100644 index 0000000000000..edeeea88bd866 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/LongRunningOperation/SolutionResourceOperationSource.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.SelfHelp +{ + internal class SolutionResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SolutionResourceOperationSource(ArmClient client) + { + _client = client; + } + + SolutionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SolutionResourceData.DeserializeSolutionResourceData(document.RootElement); + return new SolutionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SolutionResourceData.DeserializeSolutionResourceData(document.RootElement); + return new SolutionResource(_client, data); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AggregationType.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AggregationType.cs new file mode 100644 index 0000000000000..14e269e3b03d8 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AggregationType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Allowed values are Sum, Avg, Count, Min, Max. Default is Sum. + public readonly partial struct AggregationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AggregationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SumValue = "Sum"; + private const string AvgValue = "Avg"; + private const string CountValue = "Count"; + private const string MinValue = "Min"; + private const string MaxValue = "Max"; + + /// Sum. + public static AggregationType Sum { get; } = new AggregationType(SumValue); + /// Avg. + public static AggregationType Avg { get; } = new AggregationType(AvgValue); + /// Count. + public static AggregationType Count { get; } = new AggregationType(CountValue); + /// Min. + public static AggregationType Min { get; } = new AggregationType(MinValue); + /// Max. + public static AggregationType Max { get; } = new AggregationType(MaxValue); + /// Determines if two values are the same. + public static bool operator ==(AggregationType left, AggregationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AggregationType left, AggregationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AggregationType(string value) => new AggregationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AggregationType other && Equals(other); + /// + public bool Equals(AggregationType 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResult.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResult.Serialization.cs new file mode 100644 index 0000000000000..07d05ab014e3c --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResult.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class AutomatedCheckResult + { + internal static AutomatedCheckResult DeserializeAutomatedCheckResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional result = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + result = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new AutomatedCheckResultType(property.Value.GetString()); + continue; + } + } + return new AutomatedCheckResult(result.Value, Optional.ToNullable(type)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResult.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResult.cs new file mode 100644 index 0000000000000..4a5e2557fe5ae --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Only for AutomatedStep type. + public partial class AutomatedCheckResult + { + /// Initializes a new instance of AutomatedCheckResult. + internal AutomatedCheckResult() + { + } + + /// Initializes a new instance of AutomatedCheckResult. + /// Insight Article Content. + /// Type of Result. + internal AutomatedCheckResult(string result, AutomatedCheckResultType? resultType) + { + Result = result; + ResultType = resultType; + } + + /// Insight Article Content. + public string Result { get; } + /// Type of Result. + public AutomatedCheckResultType? ResultType { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResultType.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResultType.cs new file mode 100644 index 0000000000000..775c367fd0b6d --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/AutomatedCheckResultType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Type of Result. + public readonly partial struct AutomatedCheckResultType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AutomatedCheckResultType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SuccessValue = "Success"; + private const string WarningValue = "Warning"; + private const string ErrorValue = "Error"; + private const string InformationValue = "Information"; + + /// Success. + public static AutomatedCheckResultType Success { get; } = new AutomatedCheckResultType(SuccessValue); + /// Warning. + public static AutomatedCheckResultType Warning { get; } = new AutomatedCheckResultType(WarningValue); + /// Error. + public static AutomatedCheckResultType Error { get; } = new AutomatedCheckResultType(ErrorValue); + /// Information. + public static AutomatedCheckResultType Information { get; } = new AutomatedCheckResultType(InformationValue); + /// Determines if two values are the same. + public static bool operator ==(AutomatedCheckResultType left, AutomatedCheckResultType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AutomatedCheckResultType left, AutomatedCheckResultType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AutomatedCheckResultType(string value) => new AutomatedCheckResultType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AutomatedCheckResultType other && Equals(other); + /// + public bool Equals(AutomatedCheckResultType 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ContinueRequestBody.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ContinueRequestBody.Serialization.cs new file mode 100644 index 0000000000000..043b2bf24629d --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ContinueRequestBody.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.SelfHelp.Models +{ + public partial class ContinueRequestBody : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(StepId)) + { + writer.WritePropertyName("stepId"u8); + writer.WriteStringValue(StepId); + } + if (Optional.IsCollectionDefined(Responses)) + { + writer.WritePropertyName("responses"u8); + writer.WriteStartArray(); + foreach (var item in Responses) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ContinueRequestBody.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ContinueRequestBody.cs new file mode 100644 index 0000000000000..c373aaecc25c3 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ContinueRequestBody.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Troubleshooter ContinueRequest body. + public partial class ContinueRequestBody + { + /// Initializes a new instance of ContinueRequestBody. + public ContinueRequestBody() + { + Responses = new ChangeTrackingList(); + } + + /// Unique id of the result. + public string StepId { get; set; } + /// Gets the responses. + public IList Responses { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ExecutionStatus.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ExecutionStatus.cs new file mode 100644 index 0000000000000..90526d16c3266 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ExecutionStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Status of Troubleshooter Step execution. + public readonly partial struct ExecutionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ExecutionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SuccessValue = "Success"; + private const string RunningValue = "Running"; + private const string FailedValue = "Failed"; + private const string WarningValue = "Warning"; + + /// Success. + public static ExecutionStatus Success { get; } = new ExecutionStatus(SuccessValue); + /// Running. + public static ExecutionStatus Running { get; } = new ExecutionStatus(RunningValue); + /// Failed. + public static ExecutionStatus Failed { get; } = new ExecutionStatus(FailedValue); + /// Warning. + public static ExecutionStatus Warning { get; } = new ExecutionStatus(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(ExecutionStatus left, ExecutionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ExecutionStatus left, ExecutionStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ExecutionStatus(string value) => new ExecutionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ExecutionStatus other && Equals(other); + /// + public bool Equals(ExecutionStatus 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.Serialization.cs new file mode 100644 index 0000000000000..2c0e956dd5551 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + internal partial class FilterGroup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Filter)) + { + writer.WritePropertyName("filter"u8); + writer.WriteStartArray(); + foreach (var item in Filter) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static FilterGroup DeserializeFilterGroup(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> filter = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("filter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SelfHelpFilter.DeserializeSelfHelpFilter(item)); + } + filter = array; + continue; + } + } + return new FilterGroup(Optional.ToList(filter)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.cs new file mode 100644 index 0000000000000..b706676218b09 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Filter group. + internal partial class FilterGroup + { + /// Initializes a new instance of FilterGroup. + public FilterGroup() + { + Filter = new ChangeTrackingList(); + } + + /// Initializes a new instance of FilterGroup. + /// List of filters. + internal FilterGroup(IList filter) + { + Filter = filter; + } + + /// List of filters. + public IList Filter { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.Serialization.cs new file mode 100644 index 0000000000000..3ae41aa753842 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.Serialization.cs @@ -0,0 +1,112 @@ +// 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.SelfHelp.Models +{ + public partial class MetricsBasedChart : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(AggregationType)) + { + writer.WritePropertyName("aggregationType"u8); + writer.WriteStringValue(AggregationType.Value.ToString()); + } + if (Optional.IsDefined(TimeSpanDuration)) + { + writer.WritePropertyName("timeSpanDuration"u8); + writer.WriteStringValue(TimeSpanDuration.Value, "P"); + } + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(FilterGroup)) + { + writer.WritePropertyName("filterGroup"u8); + writer.WriteObjectValue(FilterGroup); + } + if (Optional.IsDefined(ReplacementKey)) + { + writer.WritePropertyName("replacementKey"u8); + writer.WriteStringValue(ReplacementKey); + } + writer.WriteEndObject(); + } + + internal static MetricsBasedChart DeserializeMetricsBasedChart(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional aggregationType = default; + Optional timeSpanDuration = default; + Optional title = default; + Optional filterGroup = default; + Optional replacementKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("aggregationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + aggregationType = new AggregationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("timeSpanDuration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeSpanDuration = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("filterGroup"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filterGroup = FilterGroup.DeserializeFilterGroup(property.Value); + continue; + } + if (property.NameEquals("replacementKey"u8)) + { + replacementKey = property.Value.GetString(); + continue; + } + } + return new MetricsBasedChart(name.Value, Optional.ToNullable(aggregationType), Optional.ToNullable(timeSpanDuration), title.Value, filterGroup.Value, replacementKey.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.cs new file mode 100644 index 0000000000000..34171f0ad5971 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Solutions metrics based chart. + public partial class MetricsBasedChart + { + /// Initializes a new instance of MetricsBasedChart. + public MetricsBasedChart() + { + } + + /// Initializes a new instance of MetricsBasedChart. + /// Chart name. + /// Allowed values are Sum, Avg, Count, Min, Max. Default is Sum. + /// Time span duration. + /// Chart title. + /// Filter group. + /// Place holder used in HTML Content replace control with the content. + internal MetricsBasedChart(string name, AggregationType? aggregationType, TimeSpan? timeSpanDuration, string title, FilterGroup filterGroup, string replacementKey) + { + Name = name; + AggregationType = aggregationType; + TimeSpanDuration = timeSpanDuration; + Title = title; + FilterGroup = filterGroup; + ReplacementKey = replacementKey; + } + + /// Chart name. + public string Name { get; set; } + /// Allowed values are Sum, Avg, Count, Min, Max. Default is Sum. + public AggregationType? AggregationType { get; set; } + /// Time span duration. + public TimeSpan? TimeSpanDuration { get; set; } + /// Chart title. + public string Title { get; set; } + /// Filter group. + internal FilterGroup FilterGroup { get; set; } + /// List of filters. + public IList Filter + { + get + { + if (FilterGroup is null) + FilterGroup = new FilterGroup(); + return FilterGroup.Filter; + } + } + + /// Place holder used in HTML Content replace control with the content. + public string ReplacementKey { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/QuestionContentType.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/QuestionContentType.cs new file mode 100644 index 0000000000000..684ef0bfb50b0 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/QuestionContentType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Default is Text. + public readonly partial struct QuestionContentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QuestionContentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TextValue = "Text"; + private const string HtmlValue = "Html"; + private const string MarkdownValue = "Markdown"; + + /// Text. + public static QuestionContentType Text { get; } = new QuestionContentType(TextValue); + /// Html. + public static QuestionContentType Html { get; } = new QuestionContentType(HtmlValue); + /// Markdown. + public static QuestionContentType Markdown { get; } = new QuestionContentType(MarkdownValue); + /// Determines if two values are the same. + public static bool operator ==(QuestionContentType left, QuestionContentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QuestionContentType left, QuestionContentType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator QuestionContentType(string value) => new QuestionContentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QuestionContentType other && Equals(other); + /// + public bool Equals(QuestionContentType 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/QuestionType.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/QuestionType.cs new file mode 100644 index 0000000000000..d15407ed224a0 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/QuestionType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Text Input. Will be a single line input. + public readonly partial struct QuestionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QuestionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RadioButtonValue = "RadioButton"; + private const string DropdownValue = "Dropdown"; + private const string TextInputValue = "TextInput"; + private const string MultiLineInfoBoxValue = "MultiLineInfoBox"; + + /// SingleChoice radio button. + public static QuestionType RadioButton { get; } = new QuestionType(RadioButtonValue); + /// SingleChoice dropdown. + public static QuestionType Dropdown { get; } = new QuestionType(DropdownValue); + /// Text Input. + public static QuestionType TextInput { get; } = new QuestionType(TextInputValue); + /// MultiLineInfoBox. + public static QuestionType MultiLineInfoBox { get; } = new QuestionType(MultiLineInfoBoxValue); + /// Determines if two values are the same. + public static bool operator ==(QuestionType left, QuestionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QuestionType left, QuestionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator QuestionType(string value) => new QuestionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QuestionType other && Equals(other); + /// + public bool Equals(QuestionType 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.Serialization.cs new file mode 100644 index 0000000000000..69e6ff6ecb463 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.Serialization.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class ReplacementMaps : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(WebResults)) + { + writer.WritePropertyName("webResults"u8); + writer.WriteStartArray(); + foreach (var item in WebResults) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Diagnostics)) + { + writer.WritePropertyName("diagnostics"u8); + writer.WriteStartArray(); + foreach (var item in Diagnostics) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Troubleshooters)) + { + writer.WritePropertyName("troubleshooters"u8); + writer.WriteStartArray(); + foreach (var item in Troubleshooters) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MetricsBasedCharts)) + { + writer.WritePropertyName("metricsBasedCharts"u8); + writer.WriteStartArray(); + foreach (var item in MetricsBasedCharts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Videos)) + { + writer.WritePropertyName("videos"u8); + writer.WriteStartArray(); + foreach (var item in Videos) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(VideoGroups)) + { + writer.WritePropertyName("videoGroups"u8); + writer.WriteStartArray(); + foreach (var item in VideoGroups) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ReplacementMaps DeserializeReplacementMaps(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> webResults = default; + Optional> diagnostics = default; + Optional> troubleshooters = default; + Optional> metricsBasedCharts = default; + Optional> videos = default; + Optional> videoGroups = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("webResults"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WebResult.DeserializeWebResult(item)); + } + webResults = array; + continue; + } + if (property.NameEquals("diagnostics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SolutionsDiagnostic.DeserializeSolutionsDiagnostic(item)); + } + diagnostics = array; + continue; + } + if (property.NameEquals("troubleshooters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SolutionsTroubleshooters.DeserializeSolutionsTroubleshooters(item)); + } + troubleshooters = array; + continue; + } + if (property.NameEquals("metricsBasedCharts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetricsBasedChart.DeserializeMetricsBasedChart(item)); + } + metricsBasedCharts = array; + continue; + } + if (property.NameEquals("videos"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SelfHelpVideo.DeserializeSelfHelpVideo(item)); + } + videos = array; + continue; + } + if (property.NameEquals("videoGroups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VideoGroup.DeserializeVideoGroup(item)); + } + videoGroups = array; + continue; + } + } + return new ReplacementMaps(Optional.ToList(webResults), Optional.ToList(diagnostics), Optional.ToList(troubleshooters), Optional.ToList(metricsBasedCharts), Optional.ToList(videos), Optional.ToList(videoGroups)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.cs new file mode 100644 index 0000000000000..2571f55f14ee4 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Solution replacement maps. + public partial class ReplacementMaps + { + /// Initializes a new instance of ReplacementMaps. + public ReplacementMaps() + { + WebResults = new ChangeTrackingList(); + Diagnostics = new ChangeTrackingList(); + Troubleshooters = new ChangeTrackingList(); + MetricsBasedCharts = new ChangeTrackingList(); + Videos = new ChangeTrackingList(); + VideoGroups = new ChangeTrackingList(); + } + + /// Initializes a new instance of ReplacementMaps. + /// Solution AzureKB results. + /// Solution diagnostics results. + /// Solutions Troubleshooters. + /// Solution metrics based charts. + /// Video solutions, which have the power to engage the customer by stimulating their senses. + /// Group of Videos. + internal ReplacementMaps(IList webResults, IList diagnostics, IList troubleshooters, IList metricsBasedCharts, IList videos, IList videoGroups) + { + WebResults = webResults; + Diagnostics = diagnostics; + Troubleshooters = troubleshooters; + MetricsBasedCharts = metricsBasedCharts; + Videos = videos; + VideoGroups = videoGroups; + } + + /// Solution AzureKB results. + public IList WebResults { get; } + /// Solution diagnostics results. + public IList Diagnostics { get; } + /// Solutions Troubleshooters. + public IList Troubleshooters { get; } + /// Solution metrics based charts. + public IList MetricsBasedCharts { get; } + /// Video solutions, which have the power to engage the customer by stimulating their senses. + public IList Videos { get; } + /// Group of Videos. + public IList VideoGroups { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseConfig.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseConfig.Serialization.cs new file mode 100644 index 0000000000000..95a24115ee785 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseConfig.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class ResponseConfig + { + internal static ResponseConfig DeserializeResponseConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional key = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + } + return new ResponseConfig(key.Value, value.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseConfig.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseConfig.cs new file mode 100644 index 0000000000000..cfc773d3581ca --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseConfig.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// The status of the resource. + public partial class ResponseConfig + { + /// Initializes a new instance of ResponseConfig. + internal ResponseConfig() + { + } + + /// Initializes a new instance of ResponseConfig. + /// Unique string. + /// Option description. + internal ResponseConfig(string key, string value) + { + Key = key; + Value = value; + } + + /// Unique string. + public string Key { get; } + /// Option description. + public string Value { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseValidationProperties.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseValidationProperties.Serialization.cs new file mode 100644 index 0000000000000..a866915d22ab9 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseValidationProperties.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class ResponseValidationProperties + { + internal static ResponseValidationProperties DeserializeResponseValidationProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional regex = default; + Optional isRequired = default; + Optional validationErrorMessage = default; + Optional maxLength = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("regex"u8)) + { + regex = property.Value.GetString(); + continue; + } + if (property.NameEquals("isRequired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isRequired = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("validationErrorMessage"u8)) + { + validationErrorMessage = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxLength"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxLength = property.Value.GetInt64(); + continue; + } + } + return new ResponseValidationProperties(regex.Value, Optional.ToNullable(isRequired), validationErrorMessage.Value, Optional.ToNullable(maxLength)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseValidationProperties.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseValidationProperties.cs new file mode 100644 index 0000000000000..a851ad8256345 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResponseValidationProperties.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Troubleshooter step input response validation properties. + public partial class ResponseValidationProperties + { + /// Initializes a new instance of ResponseValidationProperties. + internal ResponseValidationProperties() + { + } + + /// Initializes a new instance of ResponseValidationProperties. + /// Regex used for the input validation. + /// Default True. + /// Validation Error Message. + /// Max text input (open Ended Text). + internal ResponseValidationProperties(string regex, bool? isRequired, string validationErrorMessage, long? maxLength) + { + Regex = regex; + IsRequired = isRequired; + ValidationErrorMessage = validationErrorMessage; + MaxLength = maxLength; + } + + /// Regex used for the input validation. + public string Regex { get; } + /// Default True. + public bool? IsRequired { get; } + /// Validation Error Message. + public string ValidationErrorMessage { get; } + /// Max text input (open Ended Text). + public long? MaxLength { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/RestartTroubleshooterResult.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/RestartTroubleshooterResult.Serialization.cs new file mode 100644 index 0000000000000..8ea011ce57a03 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/RestartTroubleshooterResult.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class RestartTroubleshooterResult + { + internal static RestartTroubleshooterResult DeserializeRestartTroubleshooterResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional troubleshooterResourceName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("troubleshooterResourceName"u8)) + { + troubleshooterResourceName = property.Value.GetString(); + continue; + } + } + return new RestartTroubleshooterResult(troubleshooterResourceName.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/RestartTroubleshooterResult.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/RestartTroubleshooterResult.cs new file mode 100644 index 0000000000000..47d72be94069e --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/RestartTroubleshooterResult.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Troubleshooter restart response. + public partial class RestartTroubleshooterResult + { + /// Initializes a new instance of RestartTroubleshooterResult. + internal RestartTroubleshooterResult() + { + } + + /// Initializes a new instance of RestartTroubleshooterResult. + /// Updated TroubleshooterResource Name . + internal RestartTroubleshooterResult(string troubleshooterResourceName) + { + TroubleshooterResourceName = troubleshooterResourceName; + } + + /// Updated TroubleshooterResource Name . + public string TroubleshooterResourceName { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResultType.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResultType.cs new file mode 100644 index 0000000000000..cbf27abaef194 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResultType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Result type of the search result. + public readonly partial struct ResultType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResultType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CommunityValue = "Community"; + private const string DocumentationValue = "Documentation"; + + /// Community. + public static ResultType Community { get; } = new ResultType(CommunityValue); + /// Documentation. + public static ResultType Documentation { get; } = new ResultType(DocumentationValue); + /// Determines if two values are the same. + public static bool operator ==(ResultType left, ResultType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResultType left, ResultType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ResultType(string value) => new ResultType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResultType other && Equals(other); + /// + public bool Equals(ResultType 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SearchResult.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SearchResult.Serialization.cs new file mode 100644 index 0000000000000..a86aff9540f73 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SearchResult.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SearchResult : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SolutionId)) + { + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Confidence)) + { + writer.WritePropertyName("confidence"u8); + writer.WriteStringValue(Confidence.Value.ToString()); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(Source); + } + if (Optional.IsDefined(ResultType)) + { + writer.WritePropertyName("resultType"u8); + writer.WriteStringValue(ResultType.Value.ToString()); + } + if (Optional.IsDefined(Rank)) + { + writer.WritePropertyName("rank"u8); + writer.WriteNumberValue(Rank.Value); + } + if (Optional.IsDefined(Link)) + { + writer.WritePropertyName("link"u8); + writer.WriteStringValue(Link); + } + writer.WriteEndObject(); + } + + internal static SearchResult DeserializeSearchResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional solutionId = default; + Optional content = default; + Optional title = default; + Optional confidence = default; + Optional source = default; + Optional resultType = default; + Optional rank = default; + Optional link = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutionId"u8)) + { + solutionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidence"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidence = new SelfHelpConfidence(property.Value.GetString()); + continue; + } + if (property.NameEquals("source"u8)) + { + source = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultType = new ResultType(property.Value.GetString()); + continue; + } + if (property.NameEquals("rank"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rank = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("link"u8)) + { + link = property.Value.GetString(); + continue; + } + } + return new SearchResult(solutionId.Value, content.Value, title.Value, Optional.ToNullable(confidence), source.Value, Optional.ToNullable(resultType), Optional.ToNullable(rank), link.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SearchResult.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SearchResult.cs new file mode 100644 index 0000000000000..62d3b1953e219 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SearchResult.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Details of an AzureKB search result. + public partial class SearchResult + { + /// Initializes a new instance of SearchResult. + public SearchResult() + { + } + + /// Initializes a new instance of SearchResult. + /// Unique id of the result. + /// Content of the search result. + /// Title of the search result. + /// Confidence of the search result. + /// Source of the search result. + /// Result type of the search result. + /// rank of the search result. + /// Link to the document. + internal SearchResult(string solutionId, string content, string title, SelfHelpConfidence? confidence, string source, ResultType? resultType, int? rank, string link) + { + SolutionId = solutionId; + Content = content; + Title = title; + Confidence = confidence; + Source = source; + ResultType = resultType; + Rank = rank; + Link = link; + } + + /// Unique id of the result. + public string SolutionId { get; set; } + /// Content of the search result. + public string Content { get; set; } + /// Title of the search result. + public string Title { get; set; } + /// Confidence of the search result. + public SelfHelpConfidence? Confidence { get; set; } + /// Source of the search result. + public string Source { get; set; } + /// Result type of the search result. + public ResultType? ResultType { get; set; } + /// rank of the search result. + public int? Rank { get; set; } + /// Link to the document. + public string Link { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpConfidence.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpConfidence.cs new file mode 100644 index 0000000000000..c2d9d71943a89 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpConfidence.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Confidence of the search result. + public readonly partial struct SelfHelpConfidence : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SelfHelpConfidence(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LowValue = "Low"; + private const string MediumValue = "Medium"; + private const string HighValue = "High"; + + /// Low. + public static SelfHelpConfidence Low { get; } = new SelfHelpConfidence(LowValue); + /// Medium. + public static SelfHelpConfidence Medium { get; } = new SelfHelpConfidence(MediumValue); + /// High. + public static SelfHelpConfidence High { get; } = new SelfHelpConfidence(HighValue); + /// Determines if two values are the same. + public static bool operator ==(SelfHelpConfidence left, SelfHelpConfidence right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SelfHelpConfidence left, SelfHelpConfidence right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SelfHelpConfidence(string value) => new SelfHelpConfidence(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SelfHelpConfidence other && Equals(other); + /// + public bool Equals(SelfHelpConfidence 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiagnosticInsight.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiagnosticInsight.Serialization.cs index 82d44ce1b6c0d..5dd407f89bcd6 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiagnosticInsight.Serialization.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiagnosticInsight.Serialization.cs @@ -10,8 +10,34 @@ namespace Azure.ResourceManager.SelfHelp.Models { - public partial class SelfHelpDiagnosticInsight + public partial class SelfHelpDiagnosticInsight : IUtf8JsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Results)) + { + writer.WritePropertyName("results"u8); + writer.WriteStringValue(Results); + } + if (Optional.IsDefined(InsightImportanceLevel)) + { + writer.WritePropertyName("importanceLevel"u8); + writer.WriteStringValue(InsightImportanceLevel.Value.ToString()); + } + writer.WriteEndObject(); + } + internal static SelfHelpDiagnosticInsight DeserializeSelfHelpDiagnosticInsight(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiagnosticInsight.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiagnosticInsight.cs index 1e7d1f7e37373..f6a9a8395f264 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiagnosticInsight.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiagnosticInsight.cs @@ -7,11 +7,11 @@ namespace Azure.ResourceManager.SelfHelp.Models { - /// Detailed insights(s) obtained via the invocation of an insight diagnostic troubleshooter. + /// Detailed insights(s) obtained via the invocation of an insight diagnostic. public partial class SelfHelpDiagnosticInsight { /// Initializes a new instance of SelfHelpDiagnosticInsight. - internal SelfHelpDiagnosticInsight() + public SelfHelpDiagnosticInsight() { } @@ -29,12 +29,12 @@ internal SelfHelpDiagnosticInsight(string id, string title, string results, Self } /// Article id. - public string Id { get; } + public string Id { get; set; } /// This insight's title. - public string Title { get; } + public string Title { get; set; } /// Detailed result content. - public string Results { get; } + public string Results { get; set; } /// Importance level of the insight. - public SelfHelpImportanceLevel? InsightImportanceLevel { get; } + public SelfHelpImportanceLevel? InsightImportanceLevel { get; set; } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiscoverySolutionResult.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiscoverySolutionResult.cs index d6c5470306a16..06cd268623b66 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiscoverySolutionResult.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpDiscoverySolutionResult.cs @@ -20,7 +20,7 @@ internal SelfHelpDiscoverySolutionResult() } /// Initializes a new instance of SelfHelpDiscoverySolutionResult. - /// The list of solution metadata. + /// The list of metadata. /// The link used to get the next page of solution metadata. internal SelfHelpDiscoverySolutionResult(IReadOnlyList value, string nextLink) { @@ -28,7 +28,7 @@ internal SelfHelpDiscoverySolutionResult(IReadOnlyList NextLink = nextLink; } - /// The list of solution metadata. + /// The list of metadata. public IReadOnlyList Value { get; } /// The link used to get the next page of solution metadata. public string NextLink { get; } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.Serialization.cs new file mode 100644 index 0000000000000..438e7189bc36f --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SelfHelpFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStringValue(Values); + } + if (Optional.IsDefined(Operator)) + { + writer.WritePropertyName("operator"u8); + writer.WriteStringValue(Operator); + } + writer.WriteEndObject(); + } + + internal static SelfHelpFilter DeserializeSelfHelpFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional values = default; + Optional @operator = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("values"u8)) + { + values = property.Value.GetString(); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = property.Value.GetString(); + continue; + } + } + return new SelfHelpFilter(name.Value, values.Value, @operator.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.cs new file mode 100644 index 0000000000000..0b299ceec09b6 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Filter criterion. + public partial class SelfHelpFilter + { + /// Initializes a new instance of SelfHelpFilter. + public SelfHelpFilter() + { + } + + /// Initializes a new instance of SelfHelpFilter. + /// Filter name. + /// Filter values. + /// Filter operator. + internal SelfHelpFilter(string name, string values, string @operator) + { + Name = name; + Values = values; + Operator = @operator; + } + + /// Filter name. + public string Name { get; set; } + /// Filter values. + public string Values { get; set; } + /// Filter operator. + public string Operator { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpName.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpName.cs new file mode 100644 index 0000000000000..375fb4c1fab97 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpName.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Trigger criterion name. + public readonly partial struct SelfHelpName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SelfHelpName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SolutionIdValue = "SolutionId"; + private const string ProblemClassificationIdValue = "ProblemClassificationId"; + private const string ReplacementKeyValue = "ReplacementKey"; + + /// SolutionId. + public static SelfHelpName SolutionId { get; } = new SelfHelpName(SolutionIdValue); + /// ProblemClassificationId. + public static SelfHelpName ProblemClassificationId { get; } = new SelfHelpName(ProblemClassificationIdValue); + /// ReplacementKey. + public static SelfHelpName ReplacementKey { get; } = new SelfHelpName(ReplacementKeyValue); + /// Determines if two values are the same. + public static bool operator ==(SelfHelpName left, SelfHelpName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SelfHelpName left, SelfHelpName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SelfHelpName(string value) => new SelfHelpName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SelfHelpName other && Equals(other); + /// + public bool Equals(SelfHelpName 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSection.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSection.Serialization.cs new file mode 100644 index 0000000000000..3d7b66d2e9111 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSection.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SelfHelpSection : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + if (Optional.IsDefined(ReplacementMaps)) + { + writer.WritePropertyName("replacementMaps"u8); + writer.WriteObjectValue(ReplacementMaps); + } + writer.WriteEndObject(); + } + + internal static SelfHelpSection DeserializeSelfHelpSection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional title = default; + Optional content = default; + Optional replacementMaps = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (property.NameEquals("replacementMaps"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replacementMaps = ReplacementMaps.DeserializeReplacementMaps(property.Value); + continue; + } + } + return new SelfHelpSection(title.Value, content.Value, replacementMaps.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSection.cs new file mode 100644 index 0000000000000..afa495d73c3a9 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSection.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Part of the solution and are dividers in the solution rendering. + public partial class SelfHelpSection + { + /// Initializes a new instance of SelfHelpSection. + public SelfHelpSection() + { + } + + /// Initializes a new instance of SelfHelpSection. + /// Solution sections title. + /// Solution sections content. + /// Solution replacement maps. + internal SelfHelpSection(string title, string content, ReplacementMaps replacementMaps) + { + Title = title; + Content = content; + ReplacementMaps = replacementMaps; + } + + /// Solution sections title. + public string Title { get; set; } + /// Solution sections content. + public string Content { get; set; } + /// Solution replacement maps. + public ReplacementMaps ReplacementMaps { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSolutionMetadata.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSolutionMetadata.Serialization.cs index c2cabdb405c4d..b1bc15912bb2b 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSolutionMetadata.Serialization.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSolutionMetadata.Serialization.cs @@ -5,154 +5,12 @@ #nullable disable -using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.SelfHelp.Models { public partial class SelfHelpSolutionMetadata : IUtf8JsonSerializable { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(SolutionId)) - { - writer.WritePropertyName("solutionId"u8); - writer.WriteStringValue(SolutionId); - } - if (Optional.IsDefined(SolutionType)) - { - writer.WritePropertyName("solutionType"u8); - writer.WriteStringValue(SolutionType); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsCollectionDefined(RequiredParameterSets)) - { - writer.WritePropertyName("requiredParameterSets"u8); - writer.WriteStartArray(); - foreach (var item in RequiredParameterSets) - { - if (item == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteStartArray(); - foreach (var item0 in item) - { - writer.WriteStringValue(item0); - } - writer.WriteEndArray(); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static SelfHelpSolutionMetadata DeserializeSelfHelpSolutionMetadata(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - Optional systemData = default; - Optional solutionId = default; - Optional solutionType = default; - Optional description = default; - Optional>> requiredParameterSets = default; - foreach (var property in element.EnumerateObject()) - { - 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("solutionId"u8)) - { - solutionId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("solutionType"u8)) - { - solutionType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("requiredParameterSets"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List> array = new List>(); - foreach (var item in property0.Value.EnumerateArray()) - { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - List array0 = new List(); - foreach (var item0 in item.EnumerateArray()) - { - array0.Add(item0.GetString()); - } - array.Add(array0); - } - } - requiredParameterSets = array; - continue; - } - } - continue; - } - } - return new SelfHelpSolutionMetadata(id, name, type, systemData.Value, solutionId.Value, solutionType.Value, description.Value, Optional.ToList(requiredParameterSets)); - } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSolutionMetadata.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSolutionMetadata.cs index 618e88c2bcfea..41380b0593c9d 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSolutionMetadata.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpSolutionMetadata.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.SelfHelp.Models { - /// Solution Metadata resource. + /// Metadata resource. public partial class SelfHelpSolutionMetadata : ResourceData { /// Initializes a new instance of SelfHelpSolutionMetadata. public SelfHelpSolutionMetadata() { - RequiredParameterSets = new ChangeTrackingList>(); + Solutions = new ChangeTrackingList(); } /// Initializes a new instance of SelfHelpSolutionMetadata. @@ -25,25 +25,13 @@ public SelfHelpSolutionMetadata() /// The name. /// The resourceType. /// The systemData. - /// Solution Id. - /// Solution Type. - /// A detailed description of solution. - /// Required parameters for invoking this particular solution. - internal SelfHelpSolutionMetadata(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string solutionId, string solutionType, string description, IList> requiredParameterSets) : base(id, name, resourceType, systemData) + /// List of metadata. + internal SelfHelpSolutionMetadata(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList solutions) : base(id, name, resourceType, systemData) { - SolutionId = solutionId; - SolutionType = solutionType; - Description = description; - RequiredParameterSets = requiredParameterSets; + Solutions = solutions; } - /// Solution Id. - public string SolutionId { get; set; } - /// Solution Type. - public string SolutionType { get; set; } - /// A detailed description of solution. - public string Description { get; set; } - /// Required parameters for invoking this particular solution. - public IList> RequiredParameterSets { get; } + /// List of metadata. + public IList Solutions { get; } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpStep.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpStep.Serialization.cs new file mode 100644 index 0000000000000..cb0b8265f0b3f --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpStep.Serialization.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SelfHelpStep + { + internal static SelfHelpStep DeserializeSelfHelpStep(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional title = default; + Optional description = default; + Optional guidance = default; + Optional executionStatus = default; + Optional executionStatusDescription = default; + Optional type = default; + Optional isLastStep = default; + Optional> inputs = default; + Optional automatedCheckResults = default; + Optional> insights = default; + Optional error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("guidance"u8)) + { + guidance = property.Value.GetString(); + continue; + } + if (property.NameEquals("executionStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + executionStatus = new ExecutionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("executionStatusDescription"u8)) + { + executionStatusDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new SelfHelpType(property.Value.GetString()); + continue; + } + if (property.NameEquals("isLastStep"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isLastStep = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("inputs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StepInput.DeserializeStepInput(item)); + } + inputs = array; + continue; + } + if (property.NameEquals("automatedCheckResults"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + automatedCheckResults = AutomatedCheckResult.DeserializeAutomatedCheckResult(property.Value); + continue; + } + if (property.NameEquals("insights"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SelfHelpDiagnosticInsight.DeserializeSelfHelpDiagnosticInsight(item)); + } + insights = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new SelfHelpStep(id.Value, title.Value, description.Value, guidance.Value, Optional.ToNullable(executionStatus), executionStatusDescription.Value, Optional.ToNullable(type), Optional.ToNullable(isLastStep), Optional.ToList(inputs), automatedCheckResults.Value, Optional.ToList(insights), error.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpStep.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpStep.cs new file mode 100644 index 0000000000000..bd5fcd10713c2 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpStep.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Troubleshooter step. + public partial class SelfHelpStep + { + /// Initializes a new instance of SelfHelpStep. + internal SelfHelpStep() + { + Inputs = new ChangeTrackingList(); + Insights = new ChangeTrackingList(); + } + + /// Initializes a new instance of SelfHelpStep. + /// Unique step id. + /// Step title. + /// Step description. + /// Get or sets the Step guidance. + /// Status of Troubleshooter Step execution. + /// This field has more detailed status description of the execution status. + /// Type of Troubleshooting step. + /// is this last step of the workflow. + /// + /// Only for AutomatedStep type. + /// + /// The error detail. + internal SelfHelpStep(string id, string title, string description, string guidance, ExecutionStatus? executionStatus, string executionStatusDescription, SelfHelpType? stepType, bool? isLastStep, IReadOnlyList inputs, AutomatedCheckResult automatedCheckResults, IReadOnlyList insights, ResponseError error) + { + Id = id; + Title = title; + Description = description; + Guidance = guidance; + ExecutionStatus = executionStatus; + ExecutionStatusDescription = executionStatusDescription; + StepType = stepType; + IsLastStep = isLastStep; + Inputs = inputs; + AutomatedCheckResults = automatedCheckResults; + Insights = insights; + Error = error; + } + + /// Unique step id. + public string Id { get; } + /// Step title. + public string Title { get; } + /// Step description. + public string Description { get; } + /// Get or sets the Step guidance. + public string Guidance { get; } + /// Status of Troubleshooter Step execution. + public ExecutionStatus? ExecutionStatus { get; } + /// This field has more detailed status description of the execution status. + public string ExecutionStatusDescription { get; } + /// Type of Troubleshooting step. + public SelfHelpType? StepType { get; } + /// is this last step of the workflow. + public bool? IsLastStep { get; } + /// Gets the inputs. + public IReadOnlyList Inputs { get; } + /// Only for AutomatedStep type. + public AutomatedCheckResult AutomatedCheckResults { get; } + /// Gets the insights. + public IReadOnlyList Insights { get; } + /// The error detail. + public ResponseError Error { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpType.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpType.cs new file mode 100644 index 0000000000000..271d4a4c2096a --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Type of Troubleshooting step. + public readonly partial struct SelfHelpType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SelfHelpType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DecisionValue = "Decision"; + private const string SolutionValue = "Solution"; + private const string InsightValue = "Insight"; + private const string AutomatedCheckValue = "AutomatedCheck"; + + /// Decision. + public static SelfHelpType Decision { get; } = new SelfHelpType(DecisionValue); + /// Solution. + public static SelfHelpType Solution { get; } = new SelfHelpType(SolutionValue); + /// Insight. + public static SelfHelpType Insight { get; } = new SelfHelpType(InsightValue); + /// AutomatedCheck. + public static SelfHelpType AutomatedCheck { get; } = new SelfHelpType(AutomatedCheckValue); + /// Determines if two values are the same. + public static bool operator ==(SelfHelpType left, SelfHelpType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SelfHelpType left, SelfHelpType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SelfHelpType(string value) => new SelfHelpType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SelfHelpType other && Equals(other); + /// + public bool Equals(SelfHelpType 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpVideo.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpVideo.Serialization.cs new file mode 100644 index 0000000000000..0bc4abc566944 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpVideo.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SelfHelpVideo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ReplacementKey)) + { + writer.WritePropertyName("replacementKey"u8); + writer.WriteStringValue(ReplacementKey); + } + if (Optional.IsDefined(Src)) + { + writer.WritePropertyName("src"u8); + writer.WriteStringValue(Src); + } + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + writer.WriteEndObject(); + } + + internal static SelfHelpVideo DeserializeSelfHelpVideo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional replacementKey = default; + Optional src = default; + Optional title = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("replacementKey"u8)) + { + replacementKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("src"u8)) + { + src = property.Value.GetString(); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + } + return new SelfHelpVideo(src.Value, title.Value, replacementKey.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpVideo.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpVideo.cs new file mode 100644 index 0000000000000..0f10dc040924e --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpVideo.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Video detail. + public partial class SelfHelpVideo : VideoGroupVideo + { + /// Initializes a new instance of SelfHelpVideo. + public SelfHelpVideo() + { + } + + /// Initializes a new instance of SelfHelpVideo. + /// Link to the video. + /// Title of the video. + /// Place holder used in HTML Content replace control with the insight content. + internal SelfHelpVideo(string src, string title, string replacementKey) : base(src, title) + { + ReplacementKey = replacementKey; + } + + /// Place holder used in HTML Content replace control with the insight content. + public string ReplacementKey { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionMetadataProperties.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionMetadataProperties.Serialization.cs new file mode 100644 index 0000000000000..e1d170d0a7852 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionMetadataProperties.Serialization.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SolutionMetadataProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SolutionId)) + { + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + } + writer.WriteEndObject(); + } + + internal static SolutionMetadataProperties DeserializeSolutionMetadataProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional solutionId = default; + Optional solutionType = default; + Optional description = default; + Optional> requiredInputs = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutionId"u8)) + { + solutionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("solutionType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + solutionType = new SolutionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredInputs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredInputs = array; + continue; + } + } + return new SolutionMetadataProperties(solutionId.Value, Optional.ToNullable(solutionType), description.Value, Optional.ToList(requiredInputs)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionMetadataProperties.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionMetadataProperties.cs new file mode 100644 index 0000000000000..ca2f53286aa54 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionMetadataProperties.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Metadata Properties. + public partial class SolutionMetadataProperties + { + /// Initializes a new instance of SolutionMetadataProperties. + public SolutionMetadataProperties() + { + RequiredInputs = new ChangeTrackingList(); + } + + /// Initializes a new instance of SolutionMetadataProperties. + /// Solution Id. + /// Solution Type. + /// A detailed description of solution. + /// Required parameters for invoking this particular solution. + internal SolutionMetadataProperties(string solutionId, SolutionType? solutionType, string description, IReadOnlyList requiredInputs) + { + SolutionId = solutionId; + SolutionType = solutionType; + Description = description; + RequiredInputs = requiredInputs; + } + + /// Solution Id. + public string SolutionId { get; set; } + /// Solution Type. + public SolutionType? SolutionType { get; } + /// A detailed description of solution. + public string Description { get; } + /// Required parameters for invoking this particular solution. + public IReadOnlyList RequiredInputs { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionProvisioningState.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionProvisioningState.cs new file mode 100644 index 0000000000000..fdfe0aec6dc07 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Status of solution provisioning. + public readonly partial struct SolutionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SolutionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Succeeded. + public static SolutionProvisioningState Succeeded { get; } = new SolutionProvisioningState(SucceededValue); + /// Failed. + public static SolutionProvisioningState Failed { get; } = new SolutionProvisioningState(FailedValue); + /// Canceled. + public static SolutionProvisioningState Canceled { get; } = new SolutionProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(SolutionProvisioningState left, SolutionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SolutionProvisioningState left, SolutionProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SolutionProvisioningState(string value) => new SolutionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SolutionProvisioningState other && Equals(other); + /// + public bool Equals(SolutionProvisioningState 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceData.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceData.Serialization.cs new file mode 100644 index 0000000000000..e8612bb2825e0 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceData.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + public partial class SolutionResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static SolutionResourceData DeserializeSolutionResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SolutionResourceProperties.DeserializeSolutionResourceProperties(property.Value); + 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; + } + } + return new SolutionResourceData(id, name, type, systemData.Value, properties.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourcePatch.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourcePatch.Serialization.cs new file mode 100644 index 0000000000000..216f578408085 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourcePatch.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SolutionResourcePatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourcePatch.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourcePatch.cs new file mode 100644 index 0000000000000..2304400596843 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourcePatch.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Solution response. + public partial class SolutionResourcePatch + { + /// Initializes a new instance of SolutionResourcePatch. + public SolutionResourcePatch() + { + } + + /// Solution result. + public SolutionResourceProperties Properties { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceProperties.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceProperties.Serialization.cs new file mode 100644 index 0000000000000..16973af1fc0bf --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceProperties.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SolutionResourceProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(TriggerCriteria)) + { + writer.WritePropertyName("triggerCriteria"u8); + writer.WriteStartArray(); + foreach (var item in TriggerCriteria) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(SolutionId)) + { + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + } + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + if (Optional.IsDefined(ReplacementMaps)) + { + writer.WritePropertyName("replacementMaps"u8); + writer.WriteObjectValue(ReplacementMaps); + } + if (Optional.IsCollectionDefined(Sections)) + { + writer.WritePropertyName("sections"u8); + writer.WriteStartArray(); + foreach (var item in Sections) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static SolutionResourceProperties DeserializeSolutionResourceProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> triggerCriteria = default; + Optional> parameters = default; + Optional solutionId = default; + Optional provisioningState = default; + Optional title = default; + Optional content = default; + Optional replacementMaps = default; + Optional> sections = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("triggerCriteria"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TriggerCriterion.DeserializeTriggerCriterion(item)); + } + triggerCriteria = array; + continue; + } + if (property.NameEquals("parameters"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()); + } + parameters = dictionary; + continue; + } + if (property.NameEquals("solutionId"u8)) + { + solutionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new SolutionProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (property.NameEquals("replacementMaps"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replacementMaps = ReplacementMaps.DeserializeReplacementMaps(property.Value); + continue; + } + if (property.NameEquals("sections"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SelfHelpSection.DeserializeSelfHelpSection(item)); + } + sections = array; + continue; + } + } + return new SolutionResourceProperties(Optional.ToList(triggerCriteria), Optional.ToDictionary(parameters), solutionId.Value, Optional.ToNullable(provisioningState), title.Value, content.Value, replacementMaps.Value, Optional.ToList(sections)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceProperties.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceProperties.cs new file mode 100644 index 0000000000000..0026d13cf6c01 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionResourceProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Solution result. + public partial class SolutionResourceProperties + { + /// Initializes a new instance of SolutionResourceProperties. + public SolutionResourceProperties() + { + TriggerCriteria = new ChangeTrackingList(); + Parameters = new ChangeTrackingDictionary(); + Sections = new ChangeTrackingList(); + } + + /// Initializes a new instance of SolutionResourceProperties. + /// Solution request trigger criteria. + /// Client input parameters to run Solution. + /// Solution Id to identify single solution. + /// Status of solution provisioning. + /// The title. + /// The HTML content that needs to be rendered and shown to customer. + /// Solution replacement maps. + /// List of section object. + internal SolutionResourceProperties(IList triggerCriteria, IDictionary parameters, string solutionId, SolutionProvisioningState? provisioningState, string title, string content, ReplacementMaps replacementMaps, IList sections) + { + TriggerCriteria = triggerCriteria; + Parameters = parameters; + SolutionId = solutionId; + ProvisioningState = provisioningState; + Title = title; + Content = content; + ReplacementMaps = replacementMaps; + Sections = sections; + } + + /// Solution request trigger criteria. + public IList TriggerCriteria { get; } + /// Client input parameters to run Solution. + public IDictionary Parameters { get; } + /// Solution Id to identify single solution. + public string SolutionId { get; set; } + /// Status of solution provisioning. + public SolutionProvisioningState? ProvisioningState { get; set; } + /// The title. + public string Title { get; set; } + /// The HTML content that needs to be rendered and shown to customer. + public string Content { get; set; } + /// Solution replacement maps. + public ReplacementMaps ReplacementMaps { get; set; } + /// List of section object. + public IList Sections { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionType.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionType.cs new file mode 100644 index 0000000000000..f42e83c77599d --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Solution Type. + public readonly partial struct SolutionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SolutionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DiagnosticsValue = "Diagnostics"; + private const string SolutionsValue = "Solutions"; + + /// Diagnostics resource type. + public static SolutionType Diagnostics { get; } = new SolutionType(DiagnosticsValue); + /// Solutions resource type. + public static SolutionType Solutions { get; } = new SolutionType(SolutionsValue); + /// Determines if two values are the same. + public static bool operator ==(SolutionType left, SolutionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SolutionType left, SolutionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SolutionType(string value) => new SolutionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SolutionType other && Equals(other); + /// + public bool Equals(SolutionType 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsDiagnostic.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsDiagnostic.Serialization.cs new file mode 100644 index 0000000000000..5bece991534d1 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsDiagnostic.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SolutionsDiagnostic : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SolutionId)) + { + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(StatusDetails)) + { + writer.WritePropertyName("statusDetails"u8); + writer.WriteStringValue(StatusDetails); + } + if (Optional.IsDefined(ReplacementKey)) + { + writer.WritePropertyName("replacementKey"u8); + writer.WriteStringValue(ReplacementKey); + } + if (Optional.IsCollectionDefined(RequiredParameters)) + { + writer.WritePropertyName("requiredParameters"u8); + writer.WriteStartArray(); + foreach (var item in RequiredParameters) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Insights)) + { + writer.WritePropertyName("insights"u8); + writer.WriteStartArray(); + foreach (var item in Insights) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static SolutionsDiagnostic DeserializeSolutionsDiagnostic(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional solutionId = default; + Optional status = default; + Optional statusDetails = default; + Optional replacementKey = default; + Optional> requiredParameters = default; + Optional> insights = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutionId"u8)) + { + solutionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new SelfHelpDiagnosticStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("statusDetails"u8)) + { + statusDetails = property.Value.GetString(); + continue; + } + if (property.NameEquals("replacementKey"u8)) + { + replacementKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredParameters = array; + continue; + } + if (property.NameEquals("insights"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SelfHelpDiagnosticInsight.DeserializeSelfHelpDiagnosticInsight(item)); + } + insights = array; + continue; + } + } + return new SolutionsDiagnostic(solutionId.Value, Optional.ToNullable(status), statusDetails.Value, replacementKey.Value, Optional.ToList(requiredParameters), Optional.ToList(insights)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsDiagnostic.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsDiagnostic.cs new file mode 100644 index 0000000000000..658070688f5d0 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsDiagnostic.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Solutions Diagnostic. + public partial class SolutionsDiagnostic + { + /// Initializes a new instance of SolutionsDiagnostic. + public SolutionsDiagnostic() + { + RequiredParameters = new ChangeTrackingList(); + Insights = new ChangeTrackingList(); + } + + /// Initializes a new instance of SolutionsDiagnostic. + /// Solution Id to identify single Solutions Diagnostic. + /// Denotes the status of the diagnostic resource. + /// Details of the status. + /// Place holder used in HTML Content replace control with the content. + /// Required parameters of this item. + /// Diagnostic insights. + internal SolutionsDiagnostic(string solutionId, SelfHelpDiagnosticStatus? status, string statusDetails, string replacementKey, IList requiredParameters, IList insights) + { + SolutionId = solutionId; + Status = status; + StatusDetails = statusDetails; + ReplacementKey = replacementKey; + RequiredParameters = requiredParameters; + Insights = insights; + } + + /// Solution Id to identify single Solutions Diagnostic. + public string SolutionId { get; set; } + /// Denotes the status of the diagnostic resource. + public SelfHelpDiagnosticStatus? Status { get; set; } + /// Details of the status. + public string StatusDetails { get; set; } + /// Place holder used in HTML Content replace control with the content. + public string ReplacementKey { get; set; } + /// Required parameters of this item. + public IList RequiredParameters { get; } + /// Diagnostic insights. + public IList Insights { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsTroubleshooters.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsTroubleshooters.Serialization.cs new file mode 100644 index 0000000000000..55d3cb2ad9fb4 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsTroubleshooters.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class SolutionsTroubleshooters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SolutionId)) + { + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + } + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Summary)) + { + writer.WritePropertyName("summary"u8); + writer.WriteStringValue(Summary); + } + writer.WriteEndObject(); + } + + internal static SolutionsTroubleshooters DeserializeSolutionsTroubleshooters(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional solutionId = default; + Optional title = default; + Optional summary = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutionId"u8)) + { + solutionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("summary"u8)) + { + summary = property.Value.GetString(); + continue; + } + } + return new SolutionsTroubleshooters(solutionId.Value, title.Value, summary.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsTroubleshooters.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsTroubleshooters.cs new file mode 100644 index 0000000000000..2a49781e8ab6c --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SolutionsTroubleshooters.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Troubleshooters in Solutions. + public partial class SolutionsTroubleshooters + { + /// Initializes a new instance of SolutionsTroubleshooters. + public SolutionsTroubleshooters() + { + } + + /// Initializes a new instance of SolutionsTroubleshooters. + /// Solution Id to identify single Solutions Troubleshooter. + /// Troubleshooter title. + /// Troubleshooter summary. + internal SolutionsTroubleshooters(string solutionId, string title, string summary) + { + SolutionId = solutionId; + Title = title; + Summary = summary; + } + + /// Solution Id to identify single Solutions Troubleshooter. + public string SolutionId { get; set; } + /// Troubleshooter title. + public string Title { get; set; } + /// Troubleshooter summary. + public string Summary { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/StepInput.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/StepInput.Serialization.cs new file mode 100644 index 0000000000000..57acdd39a21fa --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/StepInput.Serialization.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class StepInput + { + internal static StepInput DeserializeStepInput(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional questionId = default; + Optional questionType = default; + Optional questionContent = default; + Optional questionContentType = default; + Optional responseHint = default; + Optional recommendedOption = default; + Optional selectedOptionValue = default; + Optional responseValidationProperties = default; + Optional> responseOptions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("questionId"u8)) + { + questionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("questionType"u8)) + { + questionType = property.Value.GetString(); + continue; + } + if (property.NameEquals("questionContent"u8)) + { + questionContent = property.Value.GetString(); + continue; + } + if (property.NameEquals("questionContentType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + questionContentType = new QuestionContentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("responseHint"u8)) + { + responseHint = property.Value.GetString(); + continue; + } + if (property.NameEquals("recommendedOption"u8)) + { + recommendedOption = property.Value.GetString(); + continue; + } + if (property.NameEquals("selectedOptionValue"u8)) + { + selectedOptionValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("responseValidationProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + responseValidationProperties = ResponseValidationProperties.DeserializeResponseValidationProperties(property.Value); + continue; + } + if (property.NameEquals("responseOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResponseConfig.DeserializeResponseConfig(item)); + } + responseOptions = array; + continue; + } + } + return new StepInput(questionId.Value, questionType.Value, questionContent.Value, Optional.ToNullable(questionContentType), responseHint.Value, recommendedOption.Value, selectedOptionValue.Value, responseValidationProperties.Value, Optional.ToList(responseOptions)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/StepInput.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/StepInput.cs new file mode 100644 index 0000000000000..a7179a85c8da1 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/StepInput.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Details of step input. + public partial class StepInput + { + /// Initializes a new instance of StepInput. + internal StepInput() + { + ResponseOptions = new ChangeTrackingList(); + } + + /// Initializes a new instance of StepInput. + /// Use Index as QuestionId. + /// Text Input. Will be a single line input. + /// User question content. + /// Default is Text. + /// Place holder text for response hints. + /// Result of Automate step. + /// Text of response that was selected. + /// Troubleshooter step input response validation properties. + /// + internal StepInput(string questionId, string questionType, string questionContent, QuestionContentType? questionContentType, string responseHint, string recommendedOption, string selectedOptionValue, ResponseValidationProperties responseValidationProperties, IReadOnlyList responseOptions) + { + QuestionId = questionId; + QuestionType = questionType; + QuestionContent = questionContent; + QuestionContentType = questionContentType; + ResponseHint = responseHint; + RecommendedOption = recommendedOption; + SelectedOptionValue = selectedOptionValue; + ResponseValidationProperties = responseValidationProperties; + ResponseOptions = responseOptions; + } + + /// Use Index as QuestionId. + public string QuestionId { get; } + /// Text Input. Will be a single line input. + public string QuestionType { get; } + /// User question content. + public string QuestionContent { get; } + /// Default is Text. + public QuestionContentType? QuestionContentType { get; } + /// Place holder text for response hints. + public string ResponseHint { get; } + /// Result of Automate step. + public string RecommendedOption { get; } + /// Text of response that was selected. + public string SelectedOptionValue { get; } + /// Troubleshooter step input response validation properties. + public ResponseValidationProperties ResponseValidationProperties { get; } + /// Gets the response options. + public IReadOnlyList ResponseOptions { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TriggerCriterion.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TriggerCriterion.Serialization.cs new file mode 100644 index 0000000000000..2386a4e0a5c9c --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TriggerCriterion.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class TriggerCriterion : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.Value.ToString()); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WriteEndObject(); + } + + internal static TriggerCriterion DeserializeTriggerCriterion(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = new SelfHelpName(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + } + return new TriggerCriterion(Optional.ToNullable(name), value.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TriggerCriterion.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TriggerCriterion.cs new file mode 100644 index 0000000000000..70feabfc0eb42 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TriggerCriterion.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Solution request trigger criterion. SolutionId/ProblemClassificationId is the only supported trigger type for Solution PUT request. ReplacementKey is the only supported trigger type for Solution PATCH request. + public partial class TriggerCriterion + { + /// Initializes a new instance of TriggerCriterion. + public TriggerCriterion() + { + } + + /// Initializes a new instance of TriggerCriterion. + /// Trigger criterion name. + /// Trigger criterion value. + internal TriggerCriterion(SelfHelpName? name, string value) + { + Name = name; + Value = value; + } + + /// Trigger criterion name. + public SelfHelpName? Name { get; set; } + /// Trigger criterion value. + public string Value { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterProvisioningState.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterProvisioningState.cs new file mode 100644 index 0000000000000..5fcae150b3811 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Status of troubleshooter provisioning. + public readonly partial struct TroubleshooterProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TroubleshooterProvisioningState(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 RunningValue = "Running"; + private const string AutoContinueValue = "AutoContinue"; + + /// Succeeded. + public static TroubleshooterProvisioningState Succeeded { get; } = new TroubleshooterProvisioningState(SucceededValue); + /// Failed. + public static TroubleshooterProvisioningState Failed { get; } = new TroubleshooterProvisioningState(FailedValue); + /// Canceled. + public static TroubleshooterProvisioningState Canceled { get; } = new TroubleshooterProvisioningState(CanceledValue); + /// Running. + public static TroubleshooterProvisioningState Running { get; } = new TroubleshooterProvisioningState(RunningValue); + /// AutoContinue. + public static TroubleshooterProvisioningState AutoContinue { get; } = new TroubleshooterProvisioningState(AutoContinueValue); + /// Determines if two values are the same. + public static bool operator ==(TroubleshooterProvisioningState left, TroubleshooterProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TroubleshooterProvisioningState left, TroubleshooterProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TroubleshooterProvisioningState(string value) => new TroubleshooterProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TroubleshooterProvisioningState other && Equals(other); + /// + public bool Equals(TroubleshooterProvisioningState 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/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResourceData.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResourceData.Serialization.cs new file mode 100644 index 0000000000000..0ad8def064697 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResourceData.Serialization.cs @@ -0,0 +1,141 @@ +// 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.Models; +using Azure.ResourceManager.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + public partial class TroubleshooterResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SolutionId)) + { + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TroubleshooterResourceData DeserializeTroubleshooterResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional solutionId = default; + Optional> parameters = default; + Optional provisioningState = default; + Optional> steps = default; + foreach (var property in element.EnumerateObject()) + { + 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("solutionId"u8)) + { + solutionId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + parameters = dictionary; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new TroubleshooterProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("steps"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(SelfHelpStep.DeserializeSelfHelpStep(item)); + } + steps = array; + continue; + } + } + continue; + } + } + return new TroubleshooterResourceData(id, name, type, systemData.Value, solutionId.Value, Optional.ToDictionary(parameters), Optional.ToNullable(provisioningState), Optional.ToList(steps)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResult.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResult.Serialization.cs new file mode 100644 index 0000000000000..6e13be7b5786f --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResult.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.SelfHelp.Models +{ + public partial class TroubleshooterResult : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(QuestionId)) + { + writer.WritePropertyName("questionId"u8); + writer.WriteStringValue(QuestionId); + } + if (Optional.IsDefined(QuestionType)) + { + writer.WritePropertyName("questionType"u8); + writer.WriteStringValue(QuestionType.Value.ToString()); + } + if (Optional.IsDefined(Response)) + { + writer.WritePropertyName("response"u8); + writer.WriteStringValue(Response); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResult.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResult.cs new file mode 100644 index 0000000000000..bb7d9f23fa467 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/TroubleshooterResult.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// User Response for Troubleshooter continue request. + public partial class TroubleshooterResult + { + /// Initializes a new instance of TroubleshooterResult. + public TroubleshooterResult() + { + } + + /// id of the question. + public string QuestionId { get; set; } + /// Text Input. Will be a single line input. + public QuestionType? QuestionType { get; set; } + /// Response key for SingleInput. For Multi-line test/open ended question it is free form text. + public string Response { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroup.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroup.Serialization.cs new file mode 100644 index 0000000000000..a0936a9dbe9f3 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroup.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class VideoGroup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Videos)) + { + writer.WritePropertyName("videos"u8); + writer.WriteStartArray(); + foreach (var item in Videos) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ReplacementKey)) + { + writer.WritePropertyName("replacementKey"u8); + writer.WriteStringValue(ReplacementKey); + } + writer.WriteEndObject(); + } + + internal static VideoGroup DeserializeVideoGroup(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> videos = default; + Optional replacementKey = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("videos"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VideoGroupVideo.DeserializeVideoGroupVideo(item)); + } + videos = array; + continue; + } + if (property.NameEquals("replacementKey"u8)) + { + replacementKey = property.Value.GetString(); + continue; + } + } + return new VideoGroup(Optional.ToList(videos), replacementKey.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroup.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroup.cs new file mode 100644 index 0000000000000..df38543959fc1 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroup.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Video group detail. + public partial class VideoGroup + { + /// Initializes a new instance of VideoGroup. + public VideoGroup() + { + Videos = new ChangeTrackingList(); + } + + /// Initializes a new instance of VideoGroup. + /// List of videos will be shown to customers. + /// Place holder used in HTML Content replace control with the insight content. + internal VideoGroup(IList videos, string replacementKey) + { + Videos = videos; + ReplacementKey = replacementKey; + } + + /// List of videos will be shown to customers. + public IList Videos { get; } + /// Place holder used in HTML Content replace control with the insight content. + public string ReplacementKey { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroupVideo.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroupVideo.Serialization.cs new file mode 100644 index 0000000000000..e1cef3a1b326b --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroupVideo.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class VideoGroupVideo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Src)) + { + writer.WritePropertyName("src"u8); + writer.WriteStringValue(Src); + } + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + writer.WriteEndObject(); + } + + internal static VideoGroupVideo DeserializeVideoGroupVideo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional src = default; + Optional title = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("src"u8)) + { + src = property.Value.GetString(); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + } + return new VideoGroupVideo(src.Value, title.Value); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroupVideo.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroupVideo.cs new file mode 100644 index 0000000000000..9e3e9b0b5a7a2 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/VideoGroupVideo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// VideoGroup video detail. + public partial class VideoGroupVideo + { + /// Initializes a new instance of VideoGroupVideo. + public VideoGroupVideo() + { + } + + /// Initializes a new instance of VideoGroupVideo. + /// Link to the video. + /// Title of the video. + internal VideoGroupVideo(string src, string title) + { + Src = src; + Title = title; + } + + /// Link to the video. + public string Src { get; set; } + /// Title of the video. + public string Title { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/WebResult.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/WebResult.Serialization.cs new file mode 100644 index 0000000000000..dda18fffcf1ea --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/WebResult.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + public partial class WebResult : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ReplacementKey)) + { + writer.WritePropertyName("replacementKey"u8); + writer.WriteStringValue(ReplacementKey); + } + if (Optional.IsCollectionDefined(SearchResults)) + { + writer.WritePropertyName("searchResults"u8); + writer.WriteStartArray(); + foreach (var item in SearchResults) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static WebResult DeserializeWebResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional replacementKey = default; + Optional> searchResults = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("replacementKey"u8)) + { + replacementKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("searchResults"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SearchResult.DeserializeSearchResult(item)); + } + searchResults = array; + continue; + } + } + return new WebResult(replacementKey.Value, Optional.ToList(searchResults)); + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/WebResult.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/WebResult.cs new file mode 100644 index 0000000000000..90949341d8d45 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/WebResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// AzureKB web result. + public partial class WebResult + { + /// Initializes a new instance of WebResult. + public WebResult() + { + SearchResults = new ChangeTrackingList(); + } + + /// Initializes a new instance of WebResult. + /// Place holder used in HTML Content replace control with the content. + /// AzureKB search results. + internal WebResult(string replacementKey, IList searchResults) + { + ReplacementKey = replacementKey; + SearchResults = searchResults; + } + + /// Place holder used in HTML Content replace control with the content. + public string ReplacementKey { get; set; } + /// AzureKB search results. + public IList SearchResults { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs new file mode 100644 index 0000000000000..8afd5c2a01d96 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/CheckNameAvailabilityRestOperations.cs @@ -0,0 +1,114 @@ +// 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.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + internal partial class CheckNameAvailabilityRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of CheckNameAvailabilityRestOperations. + /// 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 CheckNameAvailabilityRestOperations(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-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreatePostRequest(string scope, SelfHelpNameAvailabilityContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (content != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + } + _userAgent.Apply(message); + return message; + } + + /// This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or solutions. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// The required parameters for availability check. + /// The cancellation token to use. + /// is null. + public async Task> PostAsync(string scope, SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreatePostRequest(scope, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SelfHelpNameAvailabilityResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SelfHelpNameAvailabilityResult.DeserializeSelfHelpNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or solutions. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// The required parameters for availability check. + /// The cancellation token to use. + /// is null. + public Response Post(string scope, SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreatePostRequest(scope, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SelfHelpNameAvailabilityResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SelfHelpNameAvailabilityResult.DeserializeSelfHelpNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/DiagnosticsRestOperations.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/DiagnosticsRestOperations.cs index 62c7897162ec9..3d54a3fa8e561 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/DiagnosticsRestOperations.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/DiagnosticsRestOperations.cs @@ -12,7 +12,6 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.SelfHelp.Models; namespace Azure.ResourceManager.SelfHelp { @@ -33,84 +32,10 @@ public DiagnosticsRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateCheckNameAvailabilityRequest(string scope, SelfHelpNameAvailabilityContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.Help/checkNameAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (content != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content); - request.Content = content0; - } - _userAgent.Apply(message); - return message; - } - - /// This API is used to check the uniqueness of a resource name used for a diagnostic check. - /// This is an extension resource provider and only resource level extension is supported at the moment. - /// The required parameters for availability check. - /// The cancellation token to use. - /// is null. - public async Task> CheckNameAvailabilityAsync(string scope, SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(scope, nameof(scope)); - - using var message = CreateCheckNameAvailabilityRequest(scope, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SelfHelpNameAvailabilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SelfHelpNameAvailabilityResult.DeserializeSelfHelpNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// This API is used to check the uniqueness of a resource name used for a diagnostic check. - /// This is an extension resource provider and only resource level extension is supported at the moment. - /// The required parameters for availability check. - /// The cancellation token to use. - /// is null. - public Response CheckNameAvailability(string scope, SelfHelpNameAvailabilityContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(scope, nameof(scope)); - - using var message = CreateCheckNameAvailabilityRequest(scope, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SelfHelpNameAvailabilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = SelfHelpNameAvailabilityResult.DeserializeSelfHelpNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - internal HttpMessage CreateCreateRequest(string scope, string diagnosticsResourceName, SelfHelpDiagnosticData data) { var message = _pipeline.CreateMessage(); @@ -133,7 +58,7 @@ internal HttpMessage CreateCreateRequest(string scope, string diagnosticsResourc return message; } - /// Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. + /// Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery solutions. <br/>Diagnostics tells you precisely the root cause of the issue and the steps to address it. You can get diagnostics once you discover the relevant solution for your Azure issue. <br/><br/> <b>Note: </b> requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics API. /// This is an extension resource provider and only resource level extension is supported at the moment. /// Unique resource name for insight resources. /// The required request body for this insightResource invocation. @@ -158,7 +83,7 @@ public async Task CreateAsync(string scope, string diagnosticsResource } } - /// Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. + /// Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery solutions. <br/>Diagnostics tells you precisely the root cause of the issue and the steps to address it. You can get diagnostics once you discover the relevant solution for your Azure issue. <br/><br/> <b>Note: </b> requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics API. /// This is an extension resource provider and only resource level extension is supported at the moment. /// Unique resource name for insight resources. /// The required request body for this insightResource invocation. diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/DiscoverySolutionRestOperations.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/DiscoverySolutionRestOperations.cs index b342a305c19ce..2471a34da28df 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/DiscoverySolutionRestOperations.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/DiscoverySolutionRestOperations.cs @@ -33,7 +33,7 @@ public DiscoverySolutionRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-06-01"; + _apiVersion = apiVersion ?? "2023-09-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -62,10 +62,10 @@ internal HttpMessage CreateListRequest(string scope, string filter, string skipt return message; } - /// Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. + /// Lists the relevant Azure diagnostics and solutions using [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics and solutions. We will do our best to return the most effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input : problemClassificationId (Use the [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics and Solutions API. /// This is an extension resource provider and only resource level extension is supported at the moment. - /// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'. + /// Skiptoken is only used if a previous operation returned a partial result. /// The cancellation token to use. /// is null. public async Task> ListAsync(string scope, string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) @@ -88,10 +88,10 @@ public async Task> ListAsync(string sc } } - /// Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. + /// Lists the relevant Azure diagnostics and solutions using [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics and solutions. We will do our best to return the most effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input : problemClassificationId (Use the [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics and Solutions API. /// This is an extension resource provider and only resource level extension is supported at the moment. - /// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'. + /// Skiptoken is only used if a previous operation returned a partial result. /// The cancellation token to use. /// is null. public Response List(string scope, string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) @@ -128,11 +128,11 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string scope, st return message; } - /// Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. + /// Lists the relevant Azure diagnostics and solutions using [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics and solutions. We will do our best to return the most effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input : problemClassificationId (Use the [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics and Solutions API. /// The URL to the next page of results. /// This is an extension resource provider and only resource level extension is supported at the moment. - /// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'. + /// Skiptoken is only used if a previous operation returned a partial result. /// The cancellation token to use. /// or is null. public async Task> ListNextPageAsync(string nextLink, string scope, string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) @@ -156,11 +156,11 @@ public async Task> ListNextPageAsync(s } } - /// Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API. + /// Lists the relevant Azure diagnostics and solutions using [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API, which identifies relevant Azure diagnostics and solutions. We will do our best to return the most effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input : problemClassificationId (Use the [problemClassification API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics and Solutions API. /// The URL to the next page of results. /// This is an extension resource provider and only resource level extension is supported at the moment. - /// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. - /// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + /// 'ProblemClassificationId' or 'Id' is a mandatory filter to get solutions ids. It also supports optional 'ResourceType' and 'SolutionType' filters. The filter supports only 'and', 'or' and 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'. + /// Skiptoken is only used if a previous operation returned a partial result. /// The cancellation token to use. /// or is null. public Response ListNextPage(string nextLink, string scope, string filter = null, string skiptoken = null, CancellationToken cancellationToken = default) diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/SolutionRestOperations.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/SolutionRestOperations.cs new file mode 100644 index 0000000000000..cba36188800f3 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/SolutionRestOperations.cs @@ -0,0 +1,260 @@ +// 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.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + internal partial class SolutionRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SolutionRestOperations. + /// 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 SolutionRestOperations(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-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateCreateRequest(string scope, string solutionResourceName, SolutionResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/solutions/", false); + uri.AppendPath(solutionResourceName, 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; + } + + /// Creates a solution for the specific Azure resource or subscription using the triggering criteria ‘solutionId and requiredInputs’ from discovery solutions.<br/> Solutions are a rich, insightful and a centralized self help experience that brings all the relevant content to troubleshoot an Azure issue into a unified experience. Solutions include the following components : Text, Diagnostics , Troubleshooters, Images , Video tutorials, Tables , custom charts, images , AzureKB, etc, with capabilities to support new solutions types in the future. Each solution type may require one or more ‘requiredParameters’ that are required to execute the individual solution component. In the absence of the ‘requiredParameters’ it is likely that some of the solutions might fail execution, and you might see an empty response. <br/><br/> <b>Note:</b> <br/>1. ‘requiredInputs’ from Discovery solutions response must be passed via ‘parameters’ in the request body of Solutions API. <br/>2. ‘requiredParameters’ from the Solutions response is the same as ‘ additionalParameters’ in the request for diagnostics <br/>3. ‘requiredParameters’ from the Solutions response is the same as ‘properties.parameters’ in the request for Troubleshooters. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Solution resource Name. + /// The required request body for this solution resource creation. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string scope, string solutionResourceName, SolutionResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(scope, solutionResourceName, 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); + } + } + + /// Creates a solution for the specific Azure resource or subscription using the triggering criteria ‘solutionId and requiredInputs’ from discovery solutions.<br/> Solutions are a rich, insightful and a centralized self help experience that brings all the relevant content to troubleshoot an Azure issue into a unified experience. Solutions include the following components : Text, Diagnostics , Troubleshooters, Images , Video tutorials, Tables , custom charts, images , AzureKB, etc, with capabilities to support new solutions types in the future. Each solution type may require one or more ‘requiredParameters’ that are required to execute the individual solution component. In the absence of the ‘requiredParameters’ it is likely that some of the solutions might fail execution, and you might see an empty response. <br/><br/> <b>Note:</b> <br/>1. ‘requiredInputs’ from Discovery solutions response must be passed via ‘parameters’ in the request body of Solutions API. <br/>2. ‘requiredParameters’ from the Solutions response is the same as ‘ additionalParameters’ in the request for diagnostics <br/>3. ‘requiredParameters’ from the Solutions response is the same as ‘properties.parameters’ in the request for Troubleshooters. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Solution resource Name. + /// The required request body for this solution resource creation. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response Create(string scope, string solutionResourceName, SolutionResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(scope, solutionResourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string scope, string solutionResourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/solutions/", false); + uri.AppendPath(solutionResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Solution resource Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string scope, string solutionResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + + using var message = CreateGetRequest(scope, solutionResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SolutionResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SolutionResourceData.DeserializeSolutionResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SolutionResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Solution resource Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Get(string scope, string solutionResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + + using var message = CreateGetRequest(scope, solutionResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SolutionResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SolutionResourceData.DeserializeSolutionResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SolutionResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string scope, string solutionResourceName, SolutionResourcePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/solutions/", false); + uri.AppendPath(solutionResourceName, 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 the requiredInputs or additional information needed to execute the solution. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Solution resource Name. + /// The required request body for updating a solution resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string scope, string solutionResourceName, SolutionResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(scope, solutionResourceName, 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 the requiredInputs or additional information needed to execute the solution. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Solution resource Name. + /// The required request body for updating a solution resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response Update(string scope, string solutionResourceName, SolutionResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(scope, solutionResourceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/TroubleshootersRestOperations.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/TroubleshootersRestOperations.cs new file mode 100644 index 0000000000000..2fae59ab5ffaf --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/RestOperations/TroubleshootersRestOperations.cs @@ -0,0 +1,406 @@ +// 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.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + internal partial class TroubleshootersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TroubleshootersRestOperations. + /// 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 TroubleshootersRestOperations(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-09-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateCreateRequest(string scope, string troubleshooterName, TroubleshooterResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/troubleshooters/", false); + uri.AppendPath(troubleshooterName, 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; + } + + /// Creates the specific troubleshooter action under a resource or subscription using the ‘solutionId’ and ‘properties.parameters’ as the trigger. <br/> Troubleshooters are step-by-step interactive guidance that scope the problem by collecting additional inputs from you in each stage while troubleshooting an Azure issue. You will be guided down decision tree style workflow and the best possible solution will be presented at the end of the workflow. <br/> Create API creates the Troubleshooter API using ‘parameters’ and ‘solutionId’ <br/> After creating the Troubleshooter instance, the following APIs can be used:<br/> CONTINUE API: to move to the next step in the flow <br/>GET API: to identify the next step after executing the CONTINUE API. <br/><br/> <b>Note:</b> ‘requiredParameters’ from solutions response must be passed via ‘properties. parameters’ in the request body of Troubleshooters API. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The required request body for this Troubleshooter resource creation. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> CreateAsync(string scope, string troubleshooterName, TroubleshooterResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(scope, troubleshooterName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + TroubleshooterResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TroubleshooterResourceData.DeserializeTroubleshooterResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates the specific troubleshooter action under a resource or subscription using the ‘solutionId’ and ‘properties.parameters’ as the trigger. <br/> Troubleshooters are step-by-step interactive guidance that scope the problem by collecting additional inputs from you in each stage while troubleshooting an Azure issue. You will be guided down decision tree style workflow and the best possible solution will be presented at the end of the workflow. <br/> Create API creates the Troubleshooter API using ‘parameters’ and ‘solutionId’ <br/> After creating the Troubleshooter instance, the following APIs can be used:<br/> CONTINUE API: to move to the next step in the flow <br/>GET API: to identify the next step after executing the CONTINUE API. <br/><br/> <b>Note:</b> ‘requiredParameters’ from solutions response must be passed via ‘properties. parameters’ in the request body of Troubleshooters API. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The required request body for this Troubleshooter resource creation. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response Create(string scope, string troubleshooterName, TroubleshooterResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(scope, troubleshooterName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + TroubleshooterResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TroubleshooterResourceData.DeserializeTroubleshooterResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string scope, string troubleshooterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/troubleshooters/", false); + uri.AppendPath(troubleshooterName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var message = CreateGetRequest(scope, troubleshooterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TroubleshooterResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TroubleshooterResourceData.DeserializeTroubleshooterResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TroubleshooterResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Get(string scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var message = CreateGetRequest(scope, troubleshooterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TroubleshooterResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TroubleshooterResourceData.DeserializeTroubleshooterResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TroubleshooterResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateContinueRequest(string scope, string troubleshooterName, ContinueRequestBody continueRequestBody) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/troubleshooters/", false); + uri.AppendPath(troubleshooterName, true); + uri.AppendPath("/continue", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (continueRequestBody != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(continueRequestBody); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Uses ‘stepId’ and ‘responses’ as the trigger to continue the troubleshooting steps for the respective troubleshooter resource name. <br/>Continue API is used to provide inputs that are required for the specific troubleshooter to progress into the next step in the process. This API is used after the Troubleshooter has been created using the Create API. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The required request body for going to next step in Troubleshooter resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task ContinueAsync(string scope, string troubleshooterName, ContinueRequestBody continueRequestBody = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var message = CreateContinueRequest(scope, troubleshooterName, continueRequestBody); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Uses ‘stepId’ and ‘responses’ as the trigger to continue the troubleshooting steps for the respective troubleshooter resource name. <br/>Continue API is used to provide inputs that are required for the specific troubleshooter to progress into the next step in the process. This API is used after the Troubleshooter has been created using the Create API. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The required request body for going to next step in Troubleshooter resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Continue(string scope, string troubleshooterName, ContinueRequestBody continueRequestBody = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var message = CreateContinueRequest(scope, troubleshooterName, continueRequestBody); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateEndRequest(string scope, string troubleshooterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/troubleshooters/", false); + uri.AppendPath(troubleshooterName, true); + uri.AppendPath("/end", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Ends the troubleshooter action. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task EndAsync(string scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var message = CreateEndRequest(scope, troubleshooterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Ends the troubleshooter action. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response End(string scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var message = CreateEndRequest(scope, troubleshooterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRestartRequest(string scope, string troubleshooterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Help/troubleshooters/", false); + uri.AppendPath(troubleshooterName, true); + uri.AppendPath("/restart", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Restarts the troubleshooter API using applicable troubleshooter resource name as the input.<br/> It returns new resource name which should be used in subsequent request. The old resource name is obsolete after this API is invoked. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> RestartAsync(string scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var message = CreateRestartRequest(scope, troubleshooterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestartTroubleshooterResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestartTroubleshooterResult.DeserializeRestartTroubleshooterResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Restarts the troubleshooter API using applicable troubleshooter resource name as the input.<br/> It returns new resource name which should be used in subsequent request. The old resource name is obsolete after this API is invoked. + /// This is an extension resource provider and only resource level extension is supported at the moment. + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Restart(string scope, string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var message = CreateRestartRequest(scope, troubleshooterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestartTroubleshooterResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestartTroubleshooterResult.DeserializeRestartTroubleshooterResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticCollection.cs index 9015a6273799e..7b6df5ff251f2 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticCollection.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticCollection.cs @@ -41,7 +41,7 @@ internal SelfHelpDiagnosticCollection(ArmClient client, ResourceIdentifier id) : } /// - /// Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API + /// Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery solutions. <br/>Diagnostics tells you precisely the root cause of the issue and the steps to address it. You can get diagnostics once you discover the relevant solution for your Azure issue. <br/><br/> <b>Note: </b> requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics API. /// /// /// Request Path @@ -82,7 +82,7 @@ public virtual async Task> CreateOrUpda } /// - /// Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API + /// Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery solutions. <br/>Diagnostics tells you precisely the root cause of the issue and the steps to address it. You can get diagnostics once you discover the relevant solution for your Azure issue. <br/><br/> <b>Note: </b> requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics API. /// /// /// Request Path diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticResource.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticResource.cs index fa31bad144356..4863b5f572651 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticResource.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SelfHelpDiagnosticResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.SelfHelp public partial class SelfHelpDiagnosticResource : ArmResource { /// Generate the resource identifier of a instance. + /// The scope. + /// The diagnosticsResourceName. public static ResourceIdentifier CreateResourceIdentifier(string scope, string diagnosticsResourceName) { var resourceId = $"{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}"; @@ -151,7 +153,7 @@ public virtual Response Get(CancellationToken cancel } /// - /// Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API + /// Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery solutions. <br/>Diagnostics tells you precisely the root cause of the issue and the steps to address it. You can get diagnostics once you discover the relevant solution for your Azure issue. <br/><br/> <b>Note: </b> requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics API. /// /// /// Request Path @@ -189,7 +191,7 @@ public virtual async Task> UpdateAsync( } /// - /// Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API + /// Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery solutions. <br/>Diagnostics tells you precisely the root cause of the issue and the steps to address it. You can get diagnostics once you discover the relevant solution for your Azure issue. <br/><br/> <b>Note: </b> requiredInputs’ from Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics API. /// /// /// Request Path diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResource.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResource.cs new file mode 100644 index 0000000000000..a53d975533b2e --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResource.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +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.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + /// + /// A Class representing a SolutionResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSolutionResource method. + /// Otherwise you can get one from its parent resource using the GetSolutionResource method. + /// + public partial class SolutionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The scope. + /// The solutionResourceName. + public static ResourceIdentifier CreateResourceIdentifier(string scope, string solutionResourceName) + { + var resourceId = $"{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _solutionResourceSolutionClientDiagnostics; + private readonly SolutionRestOperations _solutionResourceSolutionRestClient; + private readonly SolutionResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected SolutionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SolutionResource(ArmClient client, SolutionResourceData 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 SolutionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _solutionResourceSolutionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SelfHelp", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string solutionResourceSolutionApiVersion); + _solutionResourceSolutionRestClient = new SolutionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, solutionResourceSolutionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Help/solutions"; + + /// 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 SolutionResourceData 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 the solution using the applicable solutionResourceName while creating the solution. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResource.Get"); + scope.Start(); + try + { + var response = await _solutionResourceSolutionRestClient.GetAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResource.Get"); + scope.Start(); + try + { + var response = _solutionResourceSolutionRestClient.Get(Id.Parent, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the requiredInputs or additional information needed to execute the solution + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_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 required request body for updating a solution resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SolutionResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResource.Update"); + scope.Start(); + try + { + var response = await _solutionResourceSolutionRestClient.UpdateAsync(Id.Parent, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new SelfHelpArmOperation(new SolutionResourceOperationSource(Client), _solutionResourceSolutionClientDiagnostics, Pipeline, _solutionResourceSolutionRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the requiredInputs or additional information needed to execute the solution + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_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 required request body for updating a solution resource. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SolutionResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResource.Update"); + scope.Start(); + try + { + var response = _solutionResourceSolutionRestClient.Update(Id.Parent, Id.Name, patch, cancellationToken); + var operation = new SelfHelpArmOperation(new SolutionResourceOperationSource(Client), _solutionResourceSolutionClientDiagnostics, Pipeline, _solutionResourceSolutionRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResourceCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResourceCollection.cs new file mode 100644 index 0000000000000..126fc88b916a0 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResourceCollection.cs @@ -0,0 +1,343 @@ +// 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.SelfHelp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSolutionResources method from an instance of . + /// + public partial class SolutionResourceCollection : ArmCollection + { + private readonly ClientDiagnostics _solutionResourceSolutionClientDiagnostics; + private readonly SolutionRestOperations _solutionResourceSolutionRestClient; + + /// Initializes a new instance of the class for mocking. + protected SolutionResourceCollection() + { + } + + /// 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 SolutionResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _solutionResourceSolutionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SelfHelp", SolutionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SolutionResource.ResourceType, out string solutionResourceSolutionApiVersion); + _solutionResourceSolutionRestClient = new SolutionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, solutionResourceSolutionApiVersion); + } + + /// + /// Creates a solution for the specific Azure resource or subscription using the triggering criteria ‘solutionId and requiredInputs’ from discovery solutions.<br/> Solutions are a rich, insightful and a centralized self help experience that brings all the relevant content to troubleshoot an Azure issue into a unified experience. Solutions include the following components : Text, Diagnostics , Troubleshooters, Images , Video tutorials, Tables , custom charts, images , AzureKB, etc, with capabilities to support new solutions types in the future. Each solution type may require one or more ‘requiredParameters’ that are required to execute the individual solution component. In the absence of the ‘requiredParameters’ it is likely that some of the solutions might fail execution, and you might see an empty response. <br/><br/> <b>Note:</b> <br/>1. ‘requiredInputs’ from Discovery solutions response must be passed via ‘parameters’ in the request body of Solutions API. <br/>2. ‘requiredParameters’ from the Solutions response is the same as ‘ additionalParameters’ in the request for diagnostics <br/>3. ‘requiredParameters’ from the Solutions response is the same as ‘properties.parameters’ in the request for Troubleshooters + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Create + /// + /// + /// + /// 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. + /// Solution resource Name. + /// The required request body for this solution resource creation. + /// 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 solutionResourceName, SolutionResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _solutionResourceSolutionRestClient.CreateAsync(Id, solutionResourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new SelfHelpArmOperation(new SolutionResourceOperationSource(Client), _solutionResourceSolutionClientDiagnostics, Pipeline, _solutionResourceSolutionRestClient.CreateCreateRequest(Id, solutionResourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a solution for the specific Azure resource or subscription using the triggering criteria ‘solutionId and requiredInputs’ from discovery solutions.<br/> Solutions are a rich, insightful and a centralized self help experience that brings all the relevant content to troubleshoot an Azure issue into a unified experience. Solutions include the following components : Text, Diagnostics , Troubleshooters, Images , Video tutorials, Tables , custom charts, images , AzureKB, etc, with capabilities to support new solutions types in the future. Each solution type may require one or more ‘requiredParameters’ that are required to execute the individual solution component. In the absence of the ‘requiredParameters’ it is likely that some of the solutions might fail execution, and you might see an empty response. <br/><br/> <b>Note:</b> <br/>1. ‘requiredInputs’ from Discovery solutions response must be passed via ‘parameters’ in the request body of Solutions API. <br/>2. ‘requiredParameters’ from the Solutions response is the same as ‘ additionalParameters’ in the request for diagnostics <br/>3. ‘requiredParameters’ from the Solutions response is the same as ‘properties.parameters’ in the request for Troubleshooters + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Create + /// + /// + /// + /// 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. + /// Solution resource Name. + /// The required request body for this solution resource creation. + /// 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 solutionResourceName, SolutionResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _solutionResourceSolutionRestClient.Create(Id, solutionResourceName, data, cancellationToken); + var operation = new SelfHelpArmOperation(new SolutionResourceOperationSource(Client), _solutionResourceSolutionClientDiagnostics, Pipeline, _solutionResourceSolutionRestClient.CreateCreateRequest(Id, solutionResourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// Solution resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string solutionResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResourceCollection.Get"); + scope.Start(); + try + { + var response = await _solutionResourceSolutionRestClient.GetAsync(Id, solutionResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the solution using the applicable solutionResourceName while creating the solution. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// Solution resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string solutionResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResourceCollection.Get"); + scope.Start(); + try + { + var response = _solutionResourceSolutionRestClient.Get(Id, solutionResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SolutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// Solution resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string solutionResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _solutionResourceSolutionRestClient.GetAsync(Id, solutionResourceName, 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 + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// Solution resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string solutionResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResourceCollection.Exists"); + scope.Start(); + try + { + var response = _solutionResourceSolutionRestClient.Get(Id, solutionResourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// Solution resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string solutionResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _solutionResourceSolutionRestClient.GetAsync(Id, solutionResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SolutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} + /// + /// + /// Operation Id + /// Solution_Get + /// + /// + /// + /// Solution resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string solutionResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(solutionResourceName, nameof(solutionResourceName)); + + using var scope = _solutionResourceSolutionClientDiagnostics.CreateScope("SolutionResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _solutionResourceSolutionRestClient.Get(Id, solutionResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SolutionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResourceData.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResourceData.cs new file mode 100644 index 0000000000000..2981f2e2cb80b --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/SolutionResourceData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + /// + /// A class representing the SolutionResource data model. + /// Solution response. + /// + public partial class SolutionResourceData : ResourceData + { + /// Initializes a new instance of SolutionResourceData. + public SolutionResourceData() + { + } + + /// Initializes a new instance of SolutionResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Solution result. + internal SolutionResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SolutionResourceProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Solution result. + public SolutionResourceProperties Properties { get; set; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResource.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResource.cs new file mode 100644 index 0000000000000..fa983de47aaa4 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResource.cs @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +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.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + /// + /// A Class representing a TroubleshooterResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetTroubleshooterResource method. + /// Otherwise you can get one from its parent resource using the GetTroubleshooterResource method. + /// + public partial class TroubleshooterResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The scope. + /// The troubleshooterName. + public static ResourceIdentifier CreateResourceIdentifier(string scope, string troubleshooterName) + { + var resourceId = $"{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _troubleshooterResourceTroubleshootersClientDiagnostics; + private readonly TroubleshootersRestOperations _troubleshooterResourceTroubleshootersRestClient; + private readonly TroubleshooterResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected TroubleshooterResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal TroubleshooterResource(ArmClient client, TroubleshooterResourceData 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 TroubleshooterResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _troubleshooterResourceTroubleshootersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SelfHelp", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string troubleshooterResourceTroubleshootersApiVersion); + _troubleshooterResourceTroubleshootersRestClient = new TroubleshootersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, troubleshooterResourceTroubleshootersApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Help/troubleshooters"; + + /// 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 TroubleshooterResourceData 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)); + } + + /// + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.Get"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.GetAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TroubleshooterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.Get"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.Get(Id.Parent, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TroubleshooterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the specific troubleshooter action under a resource or subscription using the ‘solutionId’ and ‘properties.parameters’ as the trigger. <br/> Troubleshooters are step-by-step interactive guidance that scope the problem by collecting additional inputs from you in each stage while troubleshooting an Azure issue. You will be guided down decision tree style workflow and the best possible solution will be presented at the end of the workflow. <br/> Create API creates the Troubleshooter API using ‘parameters’ and ‘solutionId’ <br/> After creating the Troubleshooter instance, the following APIs can be used:<br/> CONTINUE API: to move to the next step in the flow <br/>GET API: to identify the next step after executing the CONTINUE API. <br/><br/> <b>Note:</b> ‘requiredParameters’ from solutions response must be passed via ‘properties. parameters’ in the request body of Troubleshooters API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Create + /// + /// + /// + /// 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 required request body for this Troubleshooter resource creation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TroubleshooterResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.Update"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.CreateAsync(Id.Parent, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new SelfHelpArmOperation(Response.FromValue(new TroubleshooterResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the specific troubleshooter action under a resource or subscription using the ‘solutionId’ and ‘properties.parameters’ as the trigger. <br/> Troubleshooters are step-by-step interactive guidance that scope the problem by collecting additional inputs from you in each stage while troubleshooting an Azure issue. You will be guided down decision tree style workflow and the best possible solution will be presented at the end of the workflow. <br/> Create API creates the Troubleshooter API using ‘parameters’ and ‘solutionId’ <br/> After creating the Troubleshooter instance, the following APIs can be used:<br/> CONTINUE API: to move to the next step in the flow <br/>GET API: to identify the next step after executing the CONTINUE API. <br/><br/> <b>Note:</b> ‘requiredParameters’ from solutions response must be passed via ‘properties. parameters’ in the request body of Troubleshooters API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Create + /// + /// + /// + /// 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 required request body for this Troubleshooter resource creation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TroubleshooterResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.Update"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.Create(Id.Parent, Id.Name, data, cancellationToken); + var operation = new SelfHelpArmOperation(Response.FromValue(new TroubleshooterResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Uses ‘stepId’ and ‘responses’ as the trigger to continue the troubleshooting steps for the respective troubleshooter resource name. <br/>Continue API is used to provide inputs that are required for the specific troubleshooter to progress into the next step in the process. This API is used after the Troubleshooter has been created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/continue + /// + /// + /// Operation Id + /// Troubleshooters_Continue + /// + /// + /// + /// The required request body for going to next step in Troubleshooter resource. + /// The cancellation token to use. + public virtual async Task ContinueAsync(ContinueRequestBody continueRequestBody = null, CancellationToken cancellationToken = default) + { + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.Continue"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.ContinueAsync(Id.Parent, Id.Name, continueRequestBody, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Uses ‘stepId’ and ‘responses’ as the trigger to continue the troubleshooting steps for the respective troubleshooter resource name. <br/>Continue API is used to provide inputs that are required for the specific troubleshooter to progress into the next step in the process. This API is used after the Troubleshooter has been created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/continue + /// + /// + /// Operation Id + /// Troubleshooters_Continue + /// + /// + /// + /// The required request body for going to next step in Troubleshooter resource. + /// The cancellation token to use. + public virtual Response Continue(ContinueRequestBody continueRequestBody = null, CancellationToken cancellationToken = default) + { + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.Continue"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.Continue(Id.Parent, Id.Name, continueRequestBody, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Ends the troubleshooter action + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/end + /// + /// + /// Operation Id + /// Troubleshooters_End + /// + /// + /// + /// The cancellation token to use. + public virtual async Task EndAsync(CancellationToken cancellationToken = default) + { + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.End"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.EndAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Ends the troubleshooter action + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/end + /// + /// + /// Operation Id + /// Troubleshooters_End + /// + /// + /// + /// The cancellation token to use. + public virtual Response End(CancellationToken cancellationToken = default) + { + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.End"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.End(Id.Parent, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Restarts the troubleshooter API using applicable troubleshooter resource name as the input.<br/> It returns new resource name which should be used in subsequent request. The old resource name is obsolete after this API is invoked. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/restart + /// + /// + /// Operation Id + /// Troubleshooters_Restart + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> RestartAsync(CancellationToken cancellationToken = default) + { + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.Restart"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.RestartAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Restarts the troubleshooter API using applicable troubleshooter resource name as the input.<br/> It returns new resource name which should be used in subsequent request. The old resource name is obsolete after this API is invoked. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName}/restart + /// + /// + /// Operation Id + /// Troubleshooters_Restart + /// + /// + /// + /// The cancellation token to use. + public virtual Response Restart(CancellationToken cancellationToken = default) + { + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResource.Restart"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.Restart(Id.Parent, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResourceCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResourceCollection.cs new file mode 100644 index 0000000000000..6e0cbbc8347e9 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResourceCollection.cs @@ -0,0 +1,343 @@ +// 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.SelfHelp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetTroubleshooterResources method from an instance of . + /// + public partial class TroubleshooterResourceCollection : ArmCollection + { + private readonly ClientDiagnostics _troubleshooterResourceTroubleshootersClientDiagnostics; + private readonly TroubleshootersRestOperations _troubleshooterResourceTroubleshootersRestClient; + + /// Initializes a new instance of the class for mocking. + protected TroubleshooterResourceCollection() + { + } + + /// 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 TroubleshooterResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _troubleshooterResourceTroubleshootersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SelfHelp", TroubleshooterResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(TroubleshooterResource.ResourceType, out string troubleshooterResourceTroubleshootersApiVersion); + _troubleshooterResourceTroubleshootersRestClient = new TroubleshootersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, troubleshooterResourceTroubleshootersApiVersion); + } + + /// + /// Creates the specific troubleshooter action under a resource or subscription using the ‘solutionId’ and ‘properties.parameters’ as the trigger. <br/> Troubleshooters are step-by-step interactive guidance that scope the problem by collecting additional inputs from you in each stage while troubleshooting an Azure issue. You will be guided down decision tree style workflow and the best possible solution will be presented at the end of the workflow. <br/> Create API creates the Troubleshooter API using ‘parameters’ and ‘solutionId’ <br/> After creating the Troubleshooter instance, the following APIs can be used:<br/> CONTINUE API: to move to the next step in the flow <br/>GET API: to identify the next step after executing the CONTINUE API. <br/><br/> <b>Note:</b> ‘requiredParameters’ from solutions response must be passed via ‘properties. parameters’ in the request body of Troubleshooters API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Create + /// + /// + /// + /// 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. + /// Troubleshooter resource Name. + /// The required request body for this Troubleshooter resource creation. + /// 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 troubleshooterName, TroubleshooterResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.CreateAsync(Id, troubleshooterName, data, cancellationToken).ConfigureAwait(false); + var operation = new SelfHelpArmOperation(Response.FromValue(new TroubleshooterResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the specific troubleshooter action under a resource or subscription using the ‘solutionId’ and ‘properties.parameters’ as the trigger. <br/> Troubleshooters are step-by-step interactive guidance that scope the problem by collecting additional inputs from you in each stage while troubleshooting an Azure issue. You will be guided down decision tree style workflow and the best possible solution will be presented at the end of the workflow. <br/> Create API creates the Troubleshooter API using ‘parameters’ and ‘solutionId’ <br/> After creating the Troubleshooter instance, the following APIs can be used:<br/> CONTINUE API: to move to the next step in the flow <br/>GET API: to identify the next step after executing the CONTINUE API. <br/><br/> <b>Note:</b> ‘requiredParameters’ from solutions response must be passed via ‘properties. parameters’ in the request body of Troubleshooters API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Create + /// + /// + /// + /// 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. + /// Troubleshooter resource Name. + /// The required request body for this Troubleshooter resource creation. + /// 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 troubleshooterName, TroubleshooterResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.Create(Id, troubleshooterName, data, cancellationToken); + var operation = new SelfHelpArmOperation(Response.FromValue(new TroubleshooterResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResourceCollection.Get"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.GetAsync(Id, troubleshooterName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TroubleshooterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets troubleshooter instance result which includes the step status/result of the troubleshooter resource name that is being executed.<br/> Get API is used to retrieve the result of a Troubleshooter instance, which includes the status and result of each step in the Troubleshooter workflow. This API requires the Troubleshooter resource name that was created using the Create API. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResourceCollection.Get"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.Get(Id, troubleshooterName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TroubleshooterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.GetAsync(Id, troubleshooterName, 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 + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResourceCollection.Exists"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.Get(Id, troubleshooterName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _troubleshooterResourceTroubleshootersRestClient.GetAsync(Id, troubleshooterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TroubleshooterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} + /// + /// + /// Operation Id + /// Troubleshooters_Get + /// + /// + /// + /// Troubleshooter resource Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string troubleshooterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(troubleshooterName, nameof(troubleshooterName)); + + using var scope = _troubleshooterResourceTroubleshootersClientDiagnostics.CreateScope("TroubleshooterResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _troubleshooterResourceTroubleshootersRestClient.Get(Id, troubleshooterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TroubleshooterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResourceData.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResourceData.cs new file mode 100644 index 0000000000000..c09ef5b59f5b7 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/TroubleshooterResourceData.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.SelfHelp.Models; + +namespace Azure.ResourceManager.SelfHelp +{ + /// + /// A class representing the TroubleshooterResource data model. + /// Troubleshooter response. + /// + public partial class TroubleshooterResourceData : ResourceData + { + /// Initializes a new instance of TroubleshooterResourceData. + public TroubleshooterResourceData() + { + Parameters = new ChangeTrackingDictionary(); + Steps = new ChangeTrackingList(); + } + + /// Initializes a new instance of TroubleshooterResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Solution Id to identify single troubleshooter. + /// Client input parameters to run Troubleshooter Resource. + /// Status of troubleshooter provisioning. + /// List of step object. + internal TroubleshooterResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string solutionId, IDictionary parameters, TroubleshooterProvisioningState? provisioningState, IReadOnlyList steps) : base(id, name, resourceType, systemData) + { + SolutionId = solutionId; + Parameters = parameters; + ProvisioningState = provisioningState; + Steps = steps; + } + + /// Solution Id to identify single troubleshooter. + public string SolutionId { get; set; } + /// Client input parameters to run Troubleshooter Resource. + public IDictionary Parameters { get; } + /// Status of troubleshooter provisioning. + public TroubleshooterProvisioningState? ProvisioningState { get; } + /// List of step object. + public IReadOnlyList Steps { get; } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/autorest.md b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/autorest.md index 5c1c5fc8ed81f..e69fb6e2960bf 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/autorest.md +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/autorest.md @@ -7,8 +7,8 @@ azure-arm: true csharp: true library-name: SelfHelp namespace: Azure.ResourceManager.SelfHelp -require: https://github.com/Azure/azure-rest-api-specs/blob/2ced92ea3d86dbe78f1927a8c4c89767cb48e46a/specification/help/resource-manager/readme.md -tag: package-2023-06-01 +require: https://github.com/Azure/azure-rest-api-specs/blob/3eb9ec8e9c8f717c6b461c4c0f49a4662fb948fd/specification/help/resource-manager/readme.md +tag: package-2023-09-01-preview output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -56,6 +56,8 @@ acronym-mapping: list-exception: - /{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName} +- /{scope}/providers/Microsoft.Help/solutions/{solutionResourceName} +- /{scope}/providers/Microsoft.Help/troubleshooters/{troubleshooterName} rename-mapping: DiagnosticResource: SelfHelpDiagnostic @@ -74,10 +76,29 @@ rename-mapping: Error: SelfHelpError DiagnosticInvocation: SelfHelpDiagnosticInvocation ImportanceLevel: SelfHelpImportanceLevel - ProvisioningState: SelfHelpProvisioningState + DiagnosticProvisioningState: SelfHelpProvisioningState + Filter: SelfHelpFilter + Confidence: SelfHelpConfidence + Section: SelfHelpSection + Video: SelfHelpVideo + Step: SelfHelpStep + Type: SelfHelpType + Name: SelfHelpName + RestartTroubleshooterResponse: RestartTroubleshooterResult + TroubleshooterResponse: TroubleshooterResult + ResponseOption: ResponseConfig override-operation-name: - Diagnostics_CheckNameAvailability: CheckSelfHelpNameAvailability + CheckNameAvailability_Post: CheckSelfHelpNameAvailability DiscoverySolution_List: GetSelfHelpDiscoverySolutions +directive: + - from: help.json + where: $.definitions.MetricsBasedChart + transform: > + $.properties.timeSpanDuration['format'] = 'duration'; + - from: help.json + where: $.definitions.Step.properties.type + transform: > + $["x-ms-client-name"] = 'StepType'; ``` diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/Azure.ResourceManager.SelfHelp.Tests.csproj b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/Azure.ResourceManager.SelfHelp.Tests.csproj index f36b9096a4c9f..af8486f990616 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/Azure.ResourceManager.SelfHelp.Tests.csproj +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/Azure.ResourceManager.SelfHelp.Tests.csproj @@ -1,9 +1,4 @@  - - - - - diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/CheckNameAvailabilityTests.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/CheckNameAvailabilityTests.cs index 04f1ff7c41f19..26d09f6bff3c9 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/CheckNameAvailabilityTests.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/CheckNameAvailabilityTests.cs @@ -6,7 +6,6 @@ namespace Azure.ResourceManager.SelfHelp.Tests using Azure.Core.TestFramework; using Azure.Core; using System.Threading.Tasks; - using Azure.ResourceManager.SelfHelp.Tests; using NUnit.Framework; using System; using Azure.ResourceManager.SelfHelp.Models; diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/DiagnosticsTests.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/DiagnosticsTests.cs index 7d3041ded1a3b..5445016d4bc0b 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/DiagnosticsTests.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/DiagnosticsTests.cs @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -namespace Azure.ResourceManager.SelfHelp.Tests.Scenario +namespace Azure.ResourceManager.SelfHelp.Tests { using Azure.Core.TestFramework; using Azure.Core; using System.Threading.Tasks; - using Azure.ResourceManager.SelfHelp.Tests; using NUnit.Framework; using System; using Azure.ResourceManager.SelfHelp.Models; diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/DiscoverySolutionsTests.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/DiscoverySolutionsTests.cs index ff7011e002cca..c91fe75b4828d 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/DiscoverySolutionsTests.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/DiscoverySolutionsTests.cs @@ -6,7 +6,6 @@ namespace Azure.ResourceManager.SelfHelp.Tests using Azure.Core.TestFramework; using Azure.Core; using System.Threading.Tasks; - using Azure.ResourceManager.SelfHelp.Tests; using NUnit.Framework; using System; using Azure.ResourceManager.SelfHelp.Models; @@ -28,7 +27,7 @@ public async Task ListDisocverySolutionsTest() var insightsResourceName = Recording.GenerateAssetName("testResource"); ResourceIdentifier scope = new ResourceIdentifier($"/subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{resourceName}"); - var listDisocverySolutionsData = Client.GetSelfHelpDiscoverySolutionsAsync(scope); + var listDisocverySolutionsData = Client.GetSelfHelpDiscoverySolutionsAsync(scope, "ProblemClassificationId eq 'a93e16a3-9f43-a003-6ac0-e5f6caa90cb9'"); var response = await listDisocverySolutionsData.ToEnumerableAsync(); Assert.NotNull(response.First()); } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/SolutionsTests.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/SolutionsTests.cs new file mode 100644 index 0000000000000..2c4de34ba36e2 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/SolutionsTests.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.ResourceManager.SelfHelp.Tests +{ + using Azure.Core.TestFramework; + using Azure.Core; + using System.Threading.Tasks; + using NUnit.Framework; + using System; + using Azure.ResourceManager.SelfHelp.Models; + using System.Collections.Generic; + + public class SolutionsTests : SelfHelpManagementTestBase + { + public SolutionsTests(bool isAsync) : base(isAsync)//, RecordedTestMode.Record) + { + } + + [Test] + [RecordedTest] + public async Task CreateAndGetSolutionsTest() + { + var subId = "6bded6d5-a6af-43e1-96d3-bf71f6f5f8ba"; + var resourceGroupName = "DiagnosticsRp-Gateway-Public-Dev-Global"; + var resourceName = "DiagRpGwPubDev"; + var solutionResourceName = Recording.GenerateAssetName("testResource"); + ResourceIdentifier scope = new ResourceIdentifier($"/subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{resourceName}"); + SolutionResourceData resourceData = CreateSolutionResourceData(scope); + + var createSolutionData = await Client.GetSolutionResources(scope).CreateOrUpdateAsync(WaitUntil.Started, solutionResourceName, resourceData); + Assert.NotNull(createSolutionData); + + var readSolutionData = await Client.GetSolutionResourceAsync(scope, solutionResourceName); + Assert.NotNull(readSolutionData); + } + + private SolutionResourceData CreateSolutionResourceData(ResourceIdentifier scope) + { + List triggerCriterionList = new List() + { + new TriggerCriterion + { + Name = "SolutionId", + Value = "keyvault-lostdeletedkeys-apollo-solution" + } + }; + Dictionary parameters = new Dictionary() + { + { "SearchText","Can not RDP"} + }; + + List sections = new List(); + SolutionResourceProperties properties = new SolutionResourceProperties(triggerCriterionList, parameters, null, null, null, null, null, sections); + ResourceType resourceType = new ResourceType("Microsoft.KeyVault/vaults"); + var data = new SolutionResourceData(scope, null, resourceType, null, properties); + + return data; + } + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/TroubleshooterTests.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/TroubleshooterTests.cs new file mode 100644 index 0000000000000..140b902d914a3 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/tests/TroubleshooterTests.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.ResourceManager.SelfHelp.Tests +{ + using Azure.Core.TestFramework; + using Azure.Core; + using System.Threading.Tasks; + using NUnit.Framework; + using System; + using Azure.ResourceManager.SelfHelp.Models; + using System.Collections.Generic; + + public class TroubleshooterTests : SelfHelpManagementTestBase + { + private bool isAsync = true; + public TroubleshooterTests(bool isAsync) : base(isAsync)//, RecordedTestMode.Record) + { + this.isAsync = isAsync; + } + + [Test] + public async Task CreateAndGetTroubleshooterTest() + { + var subId = "6bded6d5-a6af-43e1-96d3-bf71f6f5f8ba"; + var resourceGroupName = "DiagnosticsRp-Gateway-Public-Dev-Global"; + var resourceName = "DiagRpGwPubDev"; + var troubleshooterResourceName = string.Empty; + + //We have hard-coded the troubleshooterResourceName since Recording.GenerateAssetName(Guid.NewGuid().ToString()) does not generate + //a GUID. If we just use Guid.NewGuid().ToString() it will create new GUID everytime but it wont be able to match the + //test recordings + //If you need to update the tests + //1.Generate new guid and update the troubleshooterResourceName + //2.Run the test in record mode to record the tests with new troubleshooterResourceName + //3.Push the recordings to the assets-sdk + if (isAsync) + { + troubleshooterResourceName = "0c16f71c-e791-4da2-80d7-f93ddfa2c239"; + } + else + { + troubleshooterResourceName = "cc5feaab-3b50-40b9-aaa4-754b6b5e3898"; + } + + ResourceIdentifier scope = new ResourceIdentifier($"/subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{resourceName}"); + TroubleshooterResourceData resourceData = CreateTroubleshooterResourceData(scope); + + var createTroubleshooterData = await Client.GetTroubleshooterResources(scope).CreateOrUpdateAsync(WaitUntil.Started, troubleshooterResourceName, resourceData); + Assert.NotNull(createTroubleshooterData); + + var readTroubleshooterData = await Client.GetTroubleshooterResourceAsync(scope, troubleshooterResourceName); + Assert.NotNull(readTroubleshooterData); + } + + private TroubleshooterResourceData CreateTroubleshooterResourceData(ResourceIdentifier scope) + { + Dictionary parameters = new Dictionary() + { + { "ResourceUri","/subscriptions/02d59989-f8a9-4b69-9919-1ef51df4eff6/resourceGroups/AcisValidation/providers/Microsoft.Compute/virtualMachines/vm-for-validation-port-80"}, + { "PuID", "100320019A2D7EB8"}, + { "SubscriptionId", "02d59989-f8a9-4b69-9919-1ef51df4eff6"}, + { "SapId", "1c2f964e-9219-e8fe-f027-95330b445941" }, + { "language", "en-us" }, + { "SessionId", "63e88074-1ac0-475a-8aee-e33f8477a4b3" }, + { "TimeZone", "GMT-0800 (Pacific Standard Time)" }, + { "TimeZoneOffset", "480" }, + { "TenantId", "72f988bf-86f1-41af-91ab-2d7cd011db47" }, + { "ProductId", "15571" }, + { "UserIPAddress", "174.164.29.4" } + }; + + List sections = new List< SelfHelpSection>(); + ResourceType resourceType = new ResourceType("Microsoft.KeyVault/vaults"); + var data = new TroubleshooterResourceData(scope, null, resourceType, null, "e104dbdf-9e14-4c9f-bc78-21ac90382231", parameters, null, null); + + return data; + } + } +} diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/samples/Sample14_AMQPMessage.md b/sdk/servicebus/Azure.Messaging.ServiceBus/samples/Sample14_AMQPMessage.md index 0c381ccf14727..f16bf1d72cfd4 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/samples/Sample14_AMQPMessage.md +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/samples/Sample14_AMQPMessage.md @@ -4,7 +4,7 @@ This sample demonstrates how to interact with the underlying AMQP message used b ## Message body -The most common scenario where you may need to inspect the underlying AMQP message is in interop scenarios where you are receiving a message that has a non-standard body. The [AMQP specification](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format) allows three types of message body: a series of data sections, a value section, or a series of sequence sections. When using the `ServiceBusMessage.Body` property, you are implicitly using a single `data` section as the message body. If you are consuming from a queue or subscription in which the producer is sending messages with a non-standard body, you would need to the following: +The most common scenario where you may need to inspect the underlying AMQP message is in interop scenarios where you are receiving a message that has a non-standard body. The [AMQP specification](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format) allows three types of message body: a series of data sections, a value section, or a series of sequence sections. When using the `ServiceBusMessage.Body` property, you are implicitly using a single `data` section as the message body. If you are consuming from a queue or subscription in which the producer is sending messages with a non-standard body, you would need to do the following: ```C# Snippet:ServiceBusInspectMessageBody ServiceBusReceiver receiver = client.CreateReceiver(queueName); diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Processor/ServiceBusProcessor.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Processor/ServiceBusProcessor.cs index 4be0bd20a0c02..1647a958af5be 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/src/Processor/ServiceBusProcessor.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/src/Processor/ServiceBusProcessor.cs @@ -277,6 +277,7 @@ protected ServiceBusProcessor() { // assign default options since some of the properties reach into the options Options = new ServiceBusProcessorOptions(); + _sessionIds = Array.Empty(); } /// diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/ProcessorTests.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/ProcessorTests.cs index a664f355127cd..61e14485b8816 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/ProcessorTests.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/ProcessorTests.cs @@ -462,6 +462,22 @@ public async Task CannotStartProcessorWhenConnectionIsClosed() await processor.DisposeAsync(); } + [Test] + public void CanUpdateConcurrencyOnMockProcessor() + { + var mockProcessor = new Mock { CallBase = true }; + mockProcessor.Object.UpdateConcurrency(5); + Assert.AreEqual(5, mockProcessor.Object.MaxConcurrentCalls); + } + + [Test] + public void CanUpdatePrefetchOnMockProcessor() + { + var mockProcessor = new Mock() { CallBase = true }; + mockProcessor.Object.UpdatePrefetchCount(10); + Assert.AreEqual(10, mockProcessor.Object.PrefetchCount); + } + [Test] public async Task CloseRespectsCancellationToken() { diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/SessionProcessorTests.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/SessionProcessorTests.cs index 78ac0ea48d30d..3075643d65622 100644 --- a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/SessionProcessorTests.cs +++ b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Processor/SessionProcessorTests.cs @@ -446,6 +446,23 @@ public async Task CanRaiseLockLostOnMockProcessor() Assert.IsTrue(sessionCloseCalled); } + [Test] + public void CanUpdateConcurrencyOnMockSessionProcessor() + { + var mockProcessor = new MockSessionProcessor(); + mockProcessor.UpdateConcurrency(5, 2); + Assert.AreEqual(5, mockProcessor.MaxConcurrentSessions); + Assert.AreEqual(2, mockProcessor.MaxConcurrentCallsPerSession); + } + + [Test] + public void CanUpdatePrefetchOnMockSessionProcessor() + { + var mockProcessor = new MockSessionProcessor(); + mockProcessor.UpdatePrefetchCount(10); + Assert.AreEqual(10, mockProcessor.PrefetchCount); + } + [Test] public async Task CloseRespectsCancellationToken() { diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/api/Azure.ResourceManager.ServiceBus.netstandard2.0.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/api/Azure.ResourceManager.ServiceBus.netstandard2.0.cs index 167e51bb48f2a..22195de3ebe8c 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/api/Azure.ResourceManager.ServiceBus.netstandard2.0.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/api/Azure.ResourceManager.ServiceBus.netstandard2.0.cs @@ -203,7 +203,7 @@ protected ServiceBusNamespaceCollection() { } } public partial class ServiceBusNamespaceData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceBusNamespaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceBusNamespaceData(Azure.Core.AzureLocation location) { } public string AlternateName { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -614,6 +614,41 @@ protected ServiceBusTopicResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceBus.ServiceBusTopicData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ServiceBus.Mocking +{ + public partial class MockableServiceBusArmClient : Azure.ResourceManager.ArmResource + { + protected MockableServiceBusArmClient() { } + public virtual Azure.ResourceManager.ServiceBus.MigrationConfigurationResource GetMigrationConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusDisasterRecoveryAuthorizationRuleResource GetServiceBusDisasterRecoveryAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusDisasterRecoveryResource GetServiceBusDisasterRecoveryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusNamespaceAuthorizationRuleResource GetServiceBusNamespaceAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusNamespaceResource GetServiceBusNamespaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusNetworkRuleSetResource GetServiceBusNetworkRuleSetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusPrivateEndpointConnectionResource GetServiceBusPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusQueueAuthorizationRuleResource GetServiceBusQueueAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusQueueResource GetServiceBusQueueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusRuleResource GetServiceBusRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusSubscriptionResource GetServiceBusSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusTopicAuthorizationRuleResource GetServiceBusTopicAuthorizationRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusTopicResource GetServiceBusTopicResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableServiceBusResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceBusResourceGroupResource() { } + public virtual Azure.Response GetServiceBusNamespace(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceBusNamespaceAsync(string namespaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ServiceBus.ServiceBusNamespaceCollection GetServiceBusNamespaces() { throw null; } + } + public partial class MockableServiceBusSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceBusSubscriptionResource() { } + public virtual Azure.Response CheckServiceBusNamespaceNameAvailability(Azure.ResourceManager.ServiceBus.Models.ServiceBusNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckServiceBusNamespaceNameAvailabilityAsync(Azure.ResourceManager.ServiceBus.Models.ServiceBusNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetServiceBusNamespaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetServiceBusNamespacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ServiceBus.Models { public static partial class ArmServiceBusModelFactory @@ -809,7 +844,7 @@ internal ServiceBusNameAvailabilityResult() { } } public partial class ServiceBusNamespacePatch : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceBusNamespacePatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceBusNamespacePatch(Azure.Core.AzureLocation location) { } public string AlternateName { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public bool? DisableLocalAuth { get { throw null; } set { } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusArmClient.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusArmClient.cs new file mode 100644 index 0000000000000..9e4f0d2ece2f5 --- /dev/null +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusArmClient.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceBus; + +namespace Azure.ResourceManager.ServiceBus.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableServiceBusArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceBusArmClient() + { + } + + /// 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 MockableServiceBusArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableServiceBusArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusNamespaceResource GetServiceBusNamespaceResource(ResourceIdentifier id) + { + ServiceBusNamespaceResource.ValidateResourceId(id); + return new ServiceBusNamespaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusNetworkRuleSetResource GetServiceBusNetworkRuleSetResource(ResourceIdentifier id) + { + ServiceBusNetworkRuleSetResource.ValidateResourceId(id); + return new ServiceBusNetworkRuleSetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusPrivateEndpointConnectionResource GetServiceBusPrivateEndpointConnectionResource(ResourceIdentifier id) + { + ServiceBusPrivateEndpointConnectionResource.ValidateResourceId(id); + return new ServiceBusPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusDisasterRecoveryResource GetServiceBusDisasterRecoveryResource(ResourceIdentifier id) + { + ServiceBusDisasterRecoveryResource.ValidateResourceId(id); + return new ServiceBusDisasterRecoveryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MigrationConfigurationResource GetMigrationConfigurationResource(ResourceIdentifier id) + { + MigrationConfigurationResource.ValidateResourceId(id); + return new MigrationConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusNamespaceAuthorizationRuleResource GetServiceBusNamespaceAuthorizationRuleResource(ResourceIdentifier id) + { + ServiceBusNamespaceAuthorizationRuleResource.ValidateResourceId(id); + return new ServiceBusNamespaceAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusQueueAuthorizationRuleResource GetServiceBusQueueAuthorizationRuleResource(ResourceIdentifier id) + { + ServiceBusQueueAuthorizationRuleResource.ValidateResourceId(id); + return new ServiceBusQueueAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusTopicAuthorizationRuleResource GetServiceBusTopicAuthorizationRuleResource(ResourceIdentifier id) + { + ServiceBusTopicAuthorizationRuleResource.ValidateResourceId(id); + return new ServiceBusTopicAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusDisasterRecoveryAuthorizationRuleResource GetServiceBusDisasterRecoveryAuthorizationRuleResource(ResourceIdentifier id) + { + ServiceBusDisasterRecoveryAuthorizationRuleResource.ValidateResourceId(id); + return new ServiceBusDisasterRecoveryAuthorizationRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusQueueResource GetServiceBusQueueResource(ResourceIdentifier id) + { + ServiceBusQueueResource.ValidateResourceId(id); + return new ServiceBusQueueResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusTopicResource GetServiceBusTopicResource(ResourceIdentifier id) + { + ServiceBusTopicResource.ValidateResourceId(id); + return new ServiceBusTopicResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusRuleResource GetServiceBusRuleResource(ResourceIdentifier id) + { + ServiceBusRuleResource.ValidateResourceId(id); + return new ServiceBusRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceBusSubscriptionResource GetServiceBusSubscriptionResource(ResourceIdentifier id) + { + ServiceBusSubscriptionResource.ValidateResourceId(id); + return new ServiceBusSubscriptionResource(Client, id); + } + } +} diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusResourceGroupResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusResourceGroupResource.cs new file mode 100644 index 0000000000000..fbbe0911b11db --- /dev/null +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ServiceBus; + +namespace Azure.ResourceManager.ServiceBus.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableServiceBusResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceBusResourceGroupResource() + { + } + + /// 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 MockableServiceBusResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ServiceBusNamespaceResources in the ResourceGroupResource. + /// An object representing collection of ServiceBusNamespaceResources and their operations over a ServiceBusNamespaceResource. + public virtual ServiceBusNamespaceCollection GetServiceBusNamespaces() + { + return GetCachedClient(client => new ServiceBusNamespaceCollection(client, Id)); + } + + /// + /// Gets a description for the specified namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceBusNamespaceAsync(string namespaceName, CancellationToken cancellationToken = default) + { + return await GetServiceBusNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a description for the specified namespace. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName} + /// + /// + /// Operation Id + /// Namespaces_Get + /// + /// + /// + /// The namespace name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceBusNamespace(string namespaceName, CancellationToken cancellationToken = default) + { + return GetServiceBusNamespaces().Get(namespaceName, cancellationToken); + } + } +} diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusSubscriptionResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusSubscriptionResource.cs new file mode 100644 index 0000000000000..971fbb4633cd8 --- /dev/null +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/MockableServiceBusSubscriptionResource.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceBus; +using Azure.ResourceManager.ServiceBus.Models; + +namespace Azure.ResourceManager.ServiceBus.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableServiceBusSubscriptionResource : ArmResource + { + private ClientDiagnostics _serviceBusNamespaceNamespacesClientDiagnostics; + private NamespacesRestOperations _serviceBusNamespaceNamespacesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableServiceBusSubscriptionResource() + { + } + + /// 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 MockableServiceBusSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ServiceBusNamespaceNamespacesClientDiagnostics => _serviceBusNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceBus", ServiceBusNamespaceResource.ResourceType.Namespace, Diagnostics); + private NamespacesRestOperations ServiceBusNamespaceNamespacesRestClient => _serviceBusNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceBusNamespaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all the available namespaces within the subscription, irrespective of the resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces + /// + /// + /// Operation Id + /// Namespaces_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetServiceBusNamespacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceBusNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceBusNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceBusNamespaceResource(Client, ServiceBusNamespaceData.DeserializeServiceBusNamespaceData(e)), ServiceBusNamespaceNamespacesClientDiagnostics, Pipeline, "MockableServiceBusSubscriptionResource.GetServiceBusNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all the available namespaces within the subscription, irrespective of the resource groups. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces + /// + /// + /// Operation Id + /// Namespaces_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetServiceBusNamespaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceBusNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceBusNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceBusNamespaceResource(Client, ServiceBusNamespaceData.DeserializeServiceBusNamespaceData(e)), ServiceBusNamespaceNamespacesClientDiagnostics, Pipeline, "MockableServiceBusSubscriptionResource.GetServiceBusNamespaces", "value", "nextLink", cancellationToken); + } + + /// + /// Check the give namespace name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability + /// + /// + /// Operation Id + /// Namespaces_CheckNameAvailability + /// + /// + /// + /// Parameters to check availability of the given namespace name. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckServiceBusNamespaceNameAvailabilityAsync(ServiceBusNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceBusNamespaceNamespacesClientDiagnostics.CreateScope("MockableServiceBusSubscriptionResource.CheckServiceBusNamespaceNameAvailability"); + scope.Start(); + try + { + var response = await ServiceBusNamespaceNamespacesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the give namespace name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability + /// + /// + /// Operation Id + /// Namespaces_CheckNameAvailability + /// + /// + /// + /// Parameters to check availability of the given namespace name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckServiceBusNamespaceNameAvailability(ServiceBusNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ServiceBusNamespaceNamespacesClientDiagnostics.CreateScope("MockableServiceBusSubscriptionResource.CheckServiceBusNamespaceNameAvailability"); + scope.Start(); + try + { + var response = ServiceBusNamespaceNamespacesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 6652f51f2486f..0000000000000 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ServiceBus -{ - /// 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 ServiceBusNamespaceResources in the ResourceGroupResource. - /// An object representing collection of ServiceBusNamespaceResources and their operations over a ServiceBusNamespaceResource. - public virtual ServiceBusNamespaceCollection GetServiceBusNamespaces() - { - return GetCachedClient(Client => new ServiceBusNamespaceCollection(Client, Id)); - } - } -} diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/ServiceBusExtensions.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/ServiceBusExtensions.cs index fef5f9ebf64b2..55e3f3d89184e 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/ServiceBusExtensions.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/ServiceBusExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceBus.Mocking; using Azure.ResourceManager.ServiceBus.Models; namespace Azure.ResourceManager.ServiceBus @@ -19,290 +20,241 @@ namespace Azure.ResourceManager.ServiceBus /// A class to add extension methods to Azure.ResourceManager.ServiceBus. public static partial class ServiceBusExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableServiceBusArmClient GetMockableServiceBusArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableServiceBusArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableServiceBusResourceGroupResource GetMockableServiceBusResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableServiceBusResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableServiceBusSubscriptionResource GetMockableServiceBusSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableServiceBusSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ServiceBusNamespaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusNamespaceResource GetServiceBusNamespaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusNamespaceResource.ValidateResourceId(id); - return new ServiceBusNamespaceResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusNamespaceResource(id); } - #endregion - #region ServiceBusNetworkRuleSetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusNetworkRuleSetResource GetServiceBusNetworkRuleSetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusNetworkRuleSetResource.ValidateResourceId(id); - return new ServiceBusNetworkRuleSetResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusNetworkRuleSetResource(id); } - #endregion - #region ServiceBusPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusPrivateEndpointConnectionResource GetServiceBusPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusPrivateEndpointConnectionResource.ValidateResourceId(id); - return new ServiceBusPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusPrivateEndpointConnectionResource(id); } - #endregion - #region ServiceBusDisasterRecoveryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusDisasterRecoveryResource GetServiceBusDisasterRecoveryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusDisasterRecoveryResource.ValidateResourceId(id); - return new ServiceBusDisasterRecoveryResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusDisasterRecoveryResource(id); } - #endregion - #region MigrationConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MigrationConfigurationResource GetMigrationConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MigrationConfigurationResource.ValidateResourceId(id); - return new MigrationConfigurationResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetMigrationConfigurationResource(id); } - #endregion - #region ServiceBusNamespaceAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusNamespaceAuthorizationRuleResource GetServiceBusNamespaceAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusNamespaceAuthorizationRuleResource.ValidateResourceId(id); - return new ServiceBusNamespaceAuthorizationRuleResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusNamespaceAuthorizationRuleResource(id); } - #endregion - #region ServiceBusQueueAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusQueueAuthorizationRuleResource GetServiceBusQueueAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusQueueAuthorizationRuleResource.ValidateResourceId(id); - return new ServiceBusQueueAuthorizationRuleResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusQueueAuthorizationRuleResource(id); } - #endregion - #region ServiceBusTopicAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusTopicAuthorizationRuleResource GetServiceBusTopicAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusTopicAuthorizationRuleResource.ValidateResourceId(id); - return new ServiceBusTopicAuthorizationRuleResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusTopicAuthorizationRuleResource(id); } - #endregion - #region ServiceBusDisasterRecoveryAuthorizationRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusDisasterRecoveryAuthorizationRuleResource GetServiceBusDisasterRecoveryAuthorizationRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusDisasterRecoveryAuthorizationRuleResource.ValidateResourceId(id); - return new ServiceBusDisasterRecoveryAuthorizationRuleResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusDisasterRecoveryAuthorizationRuleResource(id); } - #endregion - #region ServiceBusQueueResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusQueueResource GetServiceBusQueueResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusQueueResource.ValidateResourceId(id); - return new ServiceBusQueueResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusQueueResource(id); } - #endregion - #region ServiceBusTopicResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusTopicResource GetServiceBusTopicResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusTopicResource.ValidateResourceId(id); - return new ServiceBusTopicResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusTopicResource(id); } - #endregion - #region ServiceBusRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusRuleResource GetServiceBusRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusRuleResource.ValidateResourceId(id); - return new ServiceBusRuleResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusRuleResource(id); } - #endregion - #region ServiceBusSubscriptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceBusSubscriptionResource GetServiceBusSubscriptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceBusSubscriptionResource.ValidateResourceId(id); - return new ServiceBusSubscriptionResource(client, id); - } - ); + return GetMockableServiceBusArmClient(client).GetServiceBusSubscriptionResource(id); } - #endregion - /// Gets a collection of ServiceBusNamespaceResources in the ResourceGroupResource. + /// + /// Gets a collection of ServiceBusNamespaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ServiceBusNamespaceResources and their operations over a ServiceBusNamespaceResource. public static ServiceBusNamespaceCollection GetServiceBusNamespaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetServiceBusNamespaces(); + return GetMockableServiceBusResourceGroupResource(resourceGroupResource).GetServiceBusNamespaces(); } /// @@ -317,16 +269,20 @@ public static ServiceBusNamespaceCollection GetServiceBusNamespaces(this Resourc /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetServiceBusNamespaceAsync(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetServiceBusNamespaces().GetAsync(namespaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceBusResourceGroupResource(resourceGroupResource).GetServiceBusNamespaceAsync(namespaceName, cancellationToken).ConfigureAwait(false); } /// @@ -341,16 +297,20 @@ public static async Task> GetServiceBusNam /// Namespaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The namespace name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetServiceBusNamespace(this ResourceGroupResource resourceGroupResource, string namespaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetServiceBusNamespaces().Get(namespaceName, cancellationToken); + return GetMockableServiceBusResourceGroupResource(resourceGroupResource).GetServiceBusNamespace(namespaceName, cancellationToken); } /// @@ -365,13 +325,17 @@ public static Response GetServiceBusNamespace(this /// Namespaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServiceBusNamespacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceBusNamespacesAsync(cancellationToken); + return GetMockableServiceBusSubscriptionResource(subscriptionResource).GetServiceBusNamespacesAsync(cancellationToken); } /// @@ -386,13 +350,17 @@ public static AsyncPageable GetServiceBusNamespaces /// Namespaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServiceBusNamespaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceBusNamespaces(cancellationToken); + return GetMockableServiceBusSubscriptionResource(subscriptionResource).GetServiceBusNamespaces(cancellationToken); } /// @@ -407,6 +375,10 @@ public static Pageable GetServiceBusNamespaces(this /// Namespaces_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters to check availability of the given namespace name. @@ -414,9 +386,7 @@ public static Pageable GetServiceBusNamespaces(this /// is null. public static async Task> CheckServiceBusNamespaceNameAvailabilityAsync(this SubscriptionResource subscriptionResource, ServiceBusNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckServiceBusNamespaceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceBusSubscriptionResource(subscriptionResource).CheckServiceBusNamespaceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -431,6 +401,10 @@ public static async Task> CheckServic /// Namespaces_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Parameters to check availability of the given namespace name. @@ -438,9 +412,7 @@ public static async Task> CheckServic /// is null. public static Response CheckServiceBusNamespaceNameAvailability(this SubscriptionResource subscriptionResource, ServiceBusNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckServiceBusNamespaceNameAvailability(content, cancellationToken); + return GetMockableServiceBusSubscriptionResource(subscriptionResource).CheckServiceBusNamespaceNameAvailability(content, cancellationToken); } } } diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d1e70e9f81deb..0000000000000 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ServiceBus.Models; - -namespace Azure.ResourceManager.ServiceBus -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _serviceBusNamespaceNamespacesClientDiagnostics; - private NamespacesRestOperations _serviceBusNamespaceNamespacesRestClient; - - /// 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 ServiceBusNamespaceNamespacesClientDiagnostics => _serviceBusNamespaceNamespacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceBus", ServiceBusNamespaceResource.ResourceType.Namespace, Diagnostics); - private NamespacesRestOperations ServiceBusNamespaceNamespacesRestClient => _serviceBusNamespaceNamespacesRestClient ??= new NamespacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceBusNamespaceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets all the available namespaces within the subscription, irrespective of the resource groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces - /// - /// - /// Operation Id - /// Namespaces_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetServiceBusNamespacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceBusNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceBusNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceBusNamespaceResource(Client, ServiceBusNamespaceData.DeserializeServiceBusNamespaceData(e)), ServiceBusNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServiceBusNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all the available namespaces within the subscription, irrespective of the resource groups. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces - /// - /// - /// Operation Id - /// Namespaces_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetServiceBusNamespaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceBusNamespaceNamespacesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceBusNamespaceNamespacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceBusNamespaceResource(Client, ServiceBusNamespaceData.DeserializeServiceBusNamespaceData(e)), ServiceBusNamespaceNamespacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServiceBusNamespaces", "value", "nextLink", cancellationToken); - } - - /// - /// Check the give namespace name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability - /// - /// - /// Operation Id - /// Namespaces_CheckNameAvailability - /// - /// - /// - /// Parameters to check availability of the given namespace name. - /// The cancellation token to use. - public virtual async Task> CheckServiceBusNamespaceNameAvailabilityAsync(ServiceBusNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceBusNamespaceNamespacesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckServiceBusNamespaceNameAvailability"); - scope.Start(); - try - { - var response = await ServiceBusNamespaceNamespacesRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the give namespace name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability - /// - /// - /// Operation Id - /// Namespaces_CheckNameAvailability - /// - /// - /// - /// Parameters to check availability of the given namespace name. - /// The cancellation token to use. - public virtual Response CheckServiceBusNamespaceNameAvailability(ServiceBusNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = ServiceBusNamespaceNamespacesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckServiceBusNamespaceNameAvailability"); - scope.Start(); - try - { - var response = ServiceBusNamespaceNamespacesRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/MigrationConfigurationResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/MigrationConfigurationResource.cs index dc14db7155e0a..81cbcc1ed283a 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/MigrationConfigurationResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/MigrationConfigurationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ServiceBus public partial class MigrationConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The configName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, MigrationConfigurationName configName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}"; diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryAuthorizationRuleResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryAuthorizationRuleResource.cs index 879bbff5d2d13..aeb702920a74f 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryAuthorizationRuleResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryAuthorizationRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusDisasterRecoveryAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The alias. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string @alias, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{@alias}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryResource.cs index 72ab87823819a..4bee391392506 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusDisasterRecoveryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The alias. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string @alias) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{@alias}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceBusDisasterRecoveryAuthorizationRuleResources and their operations over a ServiceBusDisasterRecoveryAuthorizationRuleResource. public virtual ServiceBusDisasterRecoveryAuthorizationRuleCollection GetServiceBusDisasterRecoveryAuthorizationRules() { - return GetCachedClient(Client => new ServiceBusDisasterRecoveryAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusDisasterRecoveryAuthorizationRuleCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual ServiceBusDisasterRecoveryAuthorizationRuleCollection GetServiceB /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusDisasterRecoveryAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusDisasterRecoveryAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceAuthorizationRuleResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceAuthorizationRuleResource.cs index 2d2b8bed2762c..2a55c3b88b0a0 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceAuthorizationRuleResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceAuthorizationRuleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusNamespaceAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}"; diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceResource.cs index 6d75e151295f8..0accbcc1a59e7 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusNamespaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}"; @@ -110,7 +113,7 @@ public virtual ServiceBusNetworkRuleSetResource GetServiceBusNetworkRuleSet() /// An object representing collection of ServiceBusPrivateEndpointConnectionResources and their operations over a ServiceBusPrivateEndpointConnectionResource. public virtual ServiceBusPrivateEndpointConnectionCollection GetServiceBusPrivateEndpointConnections() { - return GetCachedClient(Client => new ServiceBusPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusPrivateEndpointConnectionCollection(client, Id)); } /// @@ -128,8 +131,8 @@ public virtual ServiceBusPrivateEndpointConnectionCollection GetServiceBusPrivat /// /// The PrivateEndpointConnection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -151,8 +154,8 @@ public virtual async Task> /// /// The PrivateEndpointConnection name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -163,7 +166,7 @@ public virtual Response GetServiceB /// An object representing collection of ServiceBusDisasterRecoveryResources and their operations over a ServiceBusDisasterRecoveryResource. public virtual ServiceBusDisasterRecoveryCollection GetServiceBusDisasterRecoveries() { - return GetCachedClient(Client => new ServiceBusDisasterRecoveryCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusDisasterRecoveryCollection(client, Id)); } /// @@ -181,12 +184,12 @@ public virtual ServiceBusDisasterRecoveryCollection GetServiceBusDisasterRecover /// /// The Disaster Recovery configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusDisasterRecoveryAsync(string @alias, CancellationToken cancellationToken = default) { - return await GetServiceBusDisasterRecoveries().GetAsync(alias, cancellationToken).ConfigureAwait(false); + return await GetServiceBusDisasterRecoveries().GetAsync(@alias, cancellationToken).ConfigureAwait(false); } /// @@ -204,19 +207,19 @@ public virtual async Task> GetServi /// /// The Disaster Recovery configuration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusDisasterRecovery(string @alias, CancellationToken cancellationToken = default) { - return GetServiceBusDisasterRecoveries().Get(alias, cancellationToken); + return GetServiceBusDisasterRecoveries().Get(@alias, cancellationToken); } /// Gets a collection of MigrationConfigurationResources in the ServiceBusNamespace. /// An object representing collection of MigrationConfigurationResources and their operations over a MigrationConfigurationResource. public virtual MigrationConfigurationCollection GetMigrationConfigurations() { - return GetCachedClient(Client => new MigrationConfigurationCollection(Client, Id)); + return GetCachedClient(client => new MigrationConfigurationCollection(client, Id)); } /// @@ -265,7 +268,7 @@ public virtual Response GetMigrationConfiguratio /// An object representing collection of ServiceBusNamespaceAuthorizationRuleResources and their operations over a ServiceBusNamespaceAuthorizationRuleResource. public virtual ServiceBusNamespaceAuthorizationRuleCollection GetServiceBusNamespaceAuthorizationRules() { - return GetCachedClient(Client => new ServiceBusNamespaceAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusNamespaceAuthorizationRuleCollection(client, Id)); } /// @@ -283,8 +286,8 @@ public virtual ServiceBusNamespaceAuthorizationRuleCollection GetServiceBusNames /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusNamespaceAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -306,8 +309,8 @@ public virtual async Task /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusNamespaceAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -318,7 +321,7 @@ public virtual Response GetService /// An object representing collection of ServiceBusQueueResources and their operations over a ServiceBusQueueResource. public virtual ServiceBusQueueCollection GetServiceBusQueues() { - return GetCachedClient(Client => new ServiceBusQueueCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusQueueCollection(client, Id)); } /// @@ -336,8 +339,8 @@ public virtual ServiceBusQueueCollection GetServiceBusQueues() /// /// The queue name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusQueueAsync(string queueName, CancellationToken cancellationToken = default) { @@ -359,8 +362,8 @@ public virtual async Task> GetServiceBusQueueA /// /// The queue name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusQueue(string queueName, CancellationToken cancellationToken = default) { @@ -371,7 +374,7 @@ public virtual Response GetServiceBusQueue(string queue /// An object representing collection of ServiceBusTopicResources and their operations over a ServiceBusTopicResource. public virtual ServiceBusTopicCollection GetServiceBusTopics() { - return GetCachedClient(Client => new ServiceBusTopicCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusTopicCollection(client, Id)); } /// @@ -389,8 +392,8 @@ public virtual ServiceBusTopicCollection GetServiceBusTopics() /// /// The topic name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusTopicAsync(string topicName, CancellationToken cancellationToken = default) { @@ -412,8 +415,8 @@ public virtual async Task> GetServiceBusTopicA /// /// The topic name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusTopic(string topicName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNetworkRuleSetResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNetworkRuleSetResource.cs index d4486cf5419a8..4b7702902fdaa 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNetworkRuleSetResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNetworkRuleSetResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusNetworkRuleSetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default"; diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusPrivateEndpointConnectionResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusPrivateEndpointConnectionResource.cs index 7351f731a41c7..4b4430d3a3322 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusPrivateEndpointConnectionResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueAuthorizationRuleResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueAuthorizationRuleResource.cs index 4e240d04c8fab..891b87eae1e70 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueAuthorizationRuleResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueAuthorizationRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusQueueAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The queueName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string queueName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueResource.cs index 8163b51ca37cb..345ace77ce0c6 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusQueueResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The queueName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string queueName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceBusQueueAuthorizationRuleResources and their operations over a ServiceBusQueueAuthorizationRuleResource. public virtual ServiceBusQueueAuthorizationRuleCollection GetServiceBusQueueAuthorizationRules() { - return GetCachedClient(Client => new ServiceBusQueueAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusQueueAuthorizationRuleCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual ServiceBusQueueAuthorizationRuleCollection GetServiceBusQueueAuth /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusQueueAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> Ge /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusQueueAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusRuleResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusRuleResource.cs index c1129318cbed6..c6e5cae9c6266 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusRuleResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusRuleResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The topicName. + /// The subscriptionName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string subscriptionName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}"; diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionResource.cs index fa61339166d8c..d3faf992e8902 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusSubscriptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The topicName. + /// The subscriptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string subscriptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceBusRuleResources and their operations over a ServiceBusRuleResource. public virtual ServiceBusRuleCollection GetServiceBusRules() { - return GetCachedClient(Client => new ServiceBusRuleCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusRuleCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual ServiceBusRuleCollection GetServiceBusRules() /// /// The rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusRuleAsync(string ruleName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetServiceBusRuleAsy /// /// The rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusRule(string ruleName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicAuthorizationRuleResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicAuthorizationRuleResource.cs index 41e96ecef33b0..708cc654d0a9a 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicAuthorizationRuleResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicAuthorizationRuleResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusTopicAuthorizationRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The topicName. + /// The authorizationRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicName, string authorizationRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}"; diff --git a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicResource.cs index fd951cfd07089..6e55c33b11cec 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.ServiceBus public partial class ServiceBusTopicResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The namespaceName. + /// The topicName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string namespaceName, string topicName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceBusTopicAuthorizationRuleResources and their operations over a ServiceBusTopicAuthorizationRuleResource. public virtual ServiceBusTopicAuthorizationRuleCollection GetServiceBusTopicAuthorizationRules() { - return GetCachedClient(Client => new ServiceBusTopicAuthorizationRuleCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusTopicAuthorizationRuleCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual ServiceBusTopicAuthorizationRuleCollection GetServiceBusTopicAuth /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusTopicAuthorizationRuleAsync(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> Ge /// /// The authorization rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusTopicAuthorizationRule(string authorizationRuleName, CancellationToken cancellationToken = default) { @@ -143,7 +147,7 @@ public virtual Response GetServiceBusT /// An object representing collection of ServiceBusSubscriptionResources and their operations over a ServiceBusSubscriptionResource. public virtual ServiceBusSubscriptionCollection GetServiceBusSubscriptions() { - return GetCachedClient(Client => new ServiceBusSubscriptionCollection(Client, Id)); + return GetCachedClient(client => new ServiceBusSubscriptionCollection(client, Id)); } /// @@ -161,8 +165,8 @@ public virtual ServiceBusSubscriptionCollection GetServiceBusSubscriptions() /// /// The subscription name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceBusSubscriptionAsync(string subscriptionName, CancellationToken cancellationToken = default) { @@ -184,8 +188,8 @@ public virtual async Task> GetServiceBu /// /// The subscription name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceBusSubscription(string subscriptionName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/api/Microsoft.Azure.WebJobs.Extensions.ServiceBus.net6.0.cs b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/api/Microsoft.Azure.WebJobs.Extensions.ServiceBus.net6.0.cs new file mode 100644 index 0000000000000..54f867273d900 --- /dev/null +++ b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/api/Microsoft.Azure.WebJobs.Extensions.ServiceBus.net6.0.cs @@ -0,0 +1,128 @@ +namespace Microsoft.Azure.WebJobs +{ + [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Method | System.AttributeTargets.Parameter)] + public sealed partial class ServiceBusAccountAttribute : System.Attribute, Microsoft.Azure.WebJobs.IConnectionProvider + { + public ServiceBusAccountAttribute(string account) { } + public string Account { get { throw null; } } + string Microsoft.Azure.WebJobs.IConnectionProvider.Connection { get { throw null; } set { } } + } + [Microsoft.Azure.WebJobs.ConnectionProviderAttribute(typeof(Microsoft.Azure.WebJobs.ServiceBusAccountAttribute))] + [Microsoft.Azure.WebJobs.Description.BindingAttribute] + [System.AttributeUsageAttribute(System.AttributeTargets.Parameter | System.AttributeTargets.ReturnValue)] + [System.Diagnostics.DebuggerDisplayAttribute("{QueueOrTopicName,nq}")] + public sealed partial class ServiceBusAttribute : System.Attribute, Microsoft.Azure.WebJobs.IConnectionProvider + { + public ServiceBusAttribute(string queueOrTopicName, Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType entityType = Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType.Queue) { } + public string Connection { get { throw null; } set { } } + public Microsoft.Azure.WebJobs.ServiceBus.ServiceBusEntityType EntityType { get { throw null; } set { } } + public string QueueOrTopicName { get { throw null; } } + } + [Microsoft.Azure.WebJobs.ConnectionProviderAttribute(typeof(Microsoft.Azure.WebJobs.ServiceBusAccountAttribute))] + [Microsoft.Azure.WebJobs.Description.BindingAttribute] + [System.AttributeUsageAttribute(System.AttributeTargets.Parameter)] + [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplay,nq}")] + public sealed partial class ServiceBusTriggerAttribute : System.Attribute, Microsoft.Azure.WebJobs.IConnectionProvider + { + public ServiceBusTriggerAttribute(string queueName) { } + public ServiceBusTriggerAttribute(string topicName, string subscriptionName) { } + public bool AutoCompleteMessages { get { throw null; } set { } } + public string Connection { get { throw null; } set { } } + public bool IsSessionsEnabled { get { throw null; } set { } } + public string QueueName { get { throw null; } } + public string SubscriptionName { get { throw null; } } + public string TopicName { get { throw null; } } + } +} +namespace Microsoft.Azure.WebJobs.ServiceBus +{ + public partial class MessageProcessor + { + protected internal MessageProcessor(Azure.Messaging.ServiceBus.ServiceBusProcessor processor) { } + protected internal Azure.Messaging.ServiceBus.ServiceBusProcessor Processor { get { throw null; } } + protected internal virtual System.Threading.Tasks.Task BeginProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken) { throw null; } + protected internal virtual System.Threading.Tasks.Task CompleteProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class MessagingProvider + { + public MessagingProvider(Microsoft.Extensions.Options.IOptions options) { } + protected internal virtual Azure.Messaging.ServiceBus.ServiceBusReceiver CreateBatchMessageReceiver(Azure.Messaging.ServiceBus.ServiceBusClient client, string entityPath, Azure.Messaging.ServiceBus.ServiceBusReceiverOptions options) { throw null; } + protected internal virtual Azure.Messaging.ServiceBus.ServiceBusClient CreateClient(string fullyQualifiedNamespace, Azure.Core.TokenCredential credential, Azure.Messaging.ServiceBus.ServiceBusClientOptions options) { throw null; } + protected internal virtual Azure.Messaging.ServiceBus.ServiceBusClient CreateClient(string connectionString, Azure.Messaging.ServiceBus.ServiceBusClientOptions options) { throw null; } + protected internal virtual Microsoft.Azure.WebJobs.ServiceBus.MessageProcessor CreateMessageProcessor(Azure.Messaging.ServiceBus.ServiceBusClient client, string entityPath, Azure.Messaging.ServiceBus.ServiceBusProcessorOptions options) { throw null; } + protected internal virtual Azure.Messaging.ServiceBus.ServiceBusSender CreateMessageSender(Azure.Messaging.ServiceBus.ServiceBusClient client, string entityPath) { throw null; } + protected internal virtual Azure.Messaging.ServiceBus.ServiceBusProcessor CreateProcessor(Azure.Messaging.ServiceBus.ServiceBusClient client, string entityPath, Azure.Messaging.ServiceBus.ServiceBusProcessorOptions options) { throw null; } + protected internal virtual Microsoft.Azure.WebJobs.ServiceBus.SessionMessageProcessor CreateSessionMessageProcessor(Azure.Messaging.ServiceBus.ServiceBusClient client, string entityPath, Azure.Messaging.ServiceBus.ServiceBusSessionProcessorOptions options) { throw null; } + protected internal virtual Azure.Messaging.ServiceBus.ServiceBusSessionProcessor CreateSessionProcessor(Azure.Messaging.ServiceBus.ServiceBusClient client, string entityPath, Azure.Messaging.ServiceBus.ServiceBusSessionProcessorOptions options) { throw null; } + } + public enum ServiceBusEntityType + { + Queue = 0, + Topic = 1, + } + public partial class ServiceBusMessageActions + { + protected ServiceBusMessageActions() { } + public virtual System.Threading.Tasks.Task AbandonMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Collections.Generic.IDictionary propertiesToModify = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CompleteMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeadLetterMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Collections.Generic.Dictionary propertiesToModify, string deadLetterReason, string deadLetterErrorDescription = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeadLetterMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Collections.Generic.IDictionary propertiesToModify = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeadLetterMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, string deadLetterReason, string deadLetterErrorDescription = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeferMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Collections.Generic.IDictionary propertiesToModify = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task RenewMessageLockAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ServiceBusOptions : Microsoft.Azure.WebJobs.Hosting.IOptionsFormatter + { + public ServiceBusOptions() { } + public bool AutoCompleteMessages { get { throw null; } set { } } + public Azure.Messaging.ServiceBus.ServiceBusRetryOptions ClientRetryOptions { get { throw null; } set { } } + public bool EnableCrossEntityTransactions { get { throw null; } set { } } + public Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { throw null; } set { } } + public System.TimeSpan MaxAutoLockRenewalDuration { get { throw null; } set { } } + public System.TimeSpan MaxBatchWaitTime { get { throw null; } set { } } + public int MaxConcurrentCalls { get { throw null; } set { } } + public int MaxConcurrentCallsPerSession { get { throw null; } set { } } + public int MaxConcurrentSessions { get { throw null; } set { } } + public int MaxMessageBatchSize { get { throw null; } set { } } + public int MinMessageBatchSize { get { throw null; } set { } } + public int PrefetchCount { get { throw null; } set { } } + public System.Func ProcessErrorAsync { get { throw null; } set { } } + public System.Func SessionClosingAsync { get { throw null; } set { } } + public System.TimeSpan? SessionIdleTimeout { get { throw null; } set { } } + public System.Func SessionInitializingAsync { get { throw null; } set { } } + public Azure.Messaging.ServiceBus.ServiceBusTransportType TransportType { get { throw null; } set { } } + public System.Net.IWebProxy WebProxy { get { throw null; } set { } } + string Microsoft.Azure.WebJobs.Hosting.IOptionsFormatter.Format() { throw null; } + } + public partial class ServiceBusReceiveActions + { + protected ServiceBusReceiveActions() { } + public virtual System.Threading.Tasks.Task> PeekMessagesAsync(int maxMessages, long? fromSequenceNumber = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ReceiveDeferredMessagesAsync(System.Collections.Generic.IEnumerable sequenceNumbers, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ReceiveMessagesAsync(int maxMessages, System.TimeSpan? maxWaitTime = default(System.TimeSpan?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ServiceBusSessionMessageActions : Microsoft.Azure.WebJobs.ServiceBus.ServiceBusMessageActions + { + protected ServiceBusSessionMessageActions() { } + public virtual System.DateTimeOffset SessionLockedUntil { get { throw null; } } + public virtual System.Threading.Tasks.Task GetSessionStateAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual void ReleaseSession() { } + public virtual System.Threading.Tasks.Task RenewSessionLockAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task SetSessionStateAsync(System.BinaryData sessionState, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SessionMessageProcessor + { + protected internal SessionMessageProcessor(Azure.Messaging.ServiceBus.ServiceBusSessionProcessor processor) { } + protected internal Azure.Messaging.ServiceBus.ServiceBusSessionProcessor Processor { get { throw null; } } + protected internal virtual System.Threading.Tasks.Task BeginProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusSessionMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Threading.CancellationToken cancellationToken) { throw null; } + protected internal virtual System.Threading.Tasks.Task CompleteProcessingMessageAsync(Microsoft.Azure.WebJobs.ServiceBus.ServiceBusSessionMessageActions actions, Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, Microsoft.Azure.WebJobs.Host.Executors.FunctionResult result, System.Threading.CancellationToken cancellationToken) { throw null; } + } +} +namespace Microsoft.Extensions.Hosting +{ + public static partial class ServiceBusHostBuilderExtensions + { + public static Microsoft.Azure.WebJobs.IWebJobsBuilder AddServiceBus(this Microsoft.Azure.WebJobs.IWebJobsBuilder builder) { throw null; } + public static Microsoft.Azure.WebJobs.IWebJobsBuilder AddServiceBus(this Microsoft.Azure.WebJobs.IWebJobsBuilder builder, System.Action configure) { throw null; } + } +} diff --git a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusHostBuilderExtensions.cs b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusHostBuilderExtensions.cs index 5c67e2dc787ad..b53483ae28490 100644 --- a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusHostBuilderExtensions.cs +++ b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Config/ServiceBusHostBuilderExtensions.cs @@ -81,6 +81,10 @@ public static IWebJobsBuilder AddServiceBus(this IWebJobsBuilder builder, Action "SessionHandlerOptions:MaxConcurrentSessions", options.MaxConcurrentSessions); + options.MaxMessageBatchSize = section.GetValue( + "BatchOptions:MaxMessageCount", + options.MaxMessageBatchSize); + var proxy = section.GetValue("WebProxy"); if (!string.IsNullOrEmpty(proxy)) { diff --git a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/tests/Config/ServiceBusHostBuilderExtensionsTests.cs b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/tests/Config/ServiceBusHostBuilderExtensionsTests.cs index 8cd62cfd404db..8f8cdcee9a328 100644 --- a/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/tests/Config/ServiceBusHostBuilderExtensionsTests.cs +++ b/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/tests/Config/ServiceBusHostBuilderExtensionsTests.cs @@ -31,6 +31,7 @@ public void ConfigureOptions_AppliesValuesCorrectly_BackCompat() Assert.AreEqual(123, options.PrefetchCount); Assert.AreEqual(123, options.MaxConcurrentCalls); + Assert.AreEqual(123, options.MaxMessageBatchSize); Assert.False(options.AutoCompleteMessages); Assert.AreEqual(TimeSpan.FromSeconds(15), options.MaxAutoLockRenewalDuration); } diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/api/Azure.ResourceManager.ServiceFabric.netstandard2.0.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/api/Azure.ResourceManager.ServiceFabric.netstandard2.0.cs index afd8c74316e54..ce44782332b07 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/api/Azure.ResourceManager.ServiceFabric.netstandard2.0.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/api/Azure.ResourceManager.ServiceFabric.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ServiceFabricApplicationCollection() { } } public partial class ServiceFabricApplicationData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricApplicationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricApplicationData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList ManagedIdentities { get { throw null; } } @@ -75,7 +75,7 @@ protected ServiceFabricApplicationTypeCollection() { } } public partial class ServiceFabricApplicationTypeData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricApplicationTypeData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricApplicationTypeData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public string ProvisioningState { get { throw null; } } } @@ -121,7 +121,7 @@ protected ServiceFabricApplicationTypeVersionCollection() { } } public partial class ServiceFabricApplicationTypeVersionData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricApplicationTypeVersionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricApplicationTypeVersionData(Azure.Core.AzureLocation location) { } public System.Uri AppPackageUri { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyDictionary DefaultParameterList { get { throw null; } } public Azure.ETag? ETag { get { throw null; } } @@ -166,7 +166,7 @@ protected ServiceFabricClusterCollection() { } } public partial class ServiceFabricClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricClusterData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList AddOnFeatures { get { throw null; } } public System.Collections.Generic.IReadOnlyList AvailableClusterVersions { get { throw null; } } public Azure.ResourceManager.ServiceFabric.Models.ClusterAadSetting AzureActiveDirectory { get { throw null; } set { } } @@ -269,7 +269,7 @@ protected ServiceFabricServiceCollection() { } } public partial class ServiceFabricServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricServiceData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList CorrelationScheme { get { throw null; } } public Azure.ResourceManager.ServiceFabric.Models.ApplicationMoveCost? DefaultMoveCost { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } @@ -303,6 +303,39 @@ protected ServiceFabricServiceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ServiceFabric.Models.ServiceFabricServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ServiceFabric.Mocking +{ + public partial class MockableServiceFabricArmClient : Azure.ResourceManager.ArmResource + { + protected MockableServiceFabricArmClient() { } + public virtual Azure.ResourceManager.ServiceFabric.ServiceFabricApplicationResource GetServiceFabricApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabric.ServiceFabricApplicationTypeResource GetServiceFabricApplicationTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabric.ServiceFabricApplicationTypeVersionResource GetServiceFabricApplicationTypeVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabric.ServiceFabricClusterResource GetServiceFabricClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabric.ServiceFabricServiceResource GetServiceFabricServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableServiceFabricResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceFabricResourceGroupResource() { } + public virtual Azure.Response GetServiceFabricCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceFabricClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ServiceFabric.ServiceFabricClusterCollection GetServiceFabricClusters() { throw null; } + } + public partial class MockableServiceFabricSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceFabricSubscriptionResource() { } + public virtual Azure.Pageable GetClusterVersions(Azure.Core.AzureLocation location, string clusterVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetClusterVersions(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetClusterVersionsAsync(Azure.Core.AzureLocation location, string clusterVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetClusterVersionsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetClusterVersionsByEnvironment(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabric.Models.ClusterVersionsEnvironment environment, string clusterVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetClusterVersionsByEnvironment(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabric.Models.ClusterVersionsEnvironment environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetClusterVersionsByEnvironmentAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabric.Models.ClusterVersionsEnvironment environment, string clusterVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetClusterVersionsByEnvironmentAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabric.Models.ClusterVersionsEnvironment environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetServiceFabricClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetServiceFabricClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ServiceFabric.Models { public partial class ApplicationDeltaHealthPolicy @@ -829,7 +862,7 @@ public ServiceCorrelationDescription(Azure.ResourceManager.ServiceFabric.Models. } public partial class ServiceFabricApplicationPatch : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricApplicationPatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricApplicationPatch(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public System.Collections.Generic.IList ManagedIdentities { get { throw null; } } public long? MaximumNodes { get { throw null; } set { } } @@ -915,7 +948,7 @@ public ServiceFabricClusterPatch() { } } public partial class ServiceFabricServicePatch : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricServicePatch(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricServicePatch(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList CorrelationScheme { get { throw null; } } public Azure.ResourceManager.ServiceFabric.Models.ApplicationMoveCost? DefaultMoveCost { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricArmClient.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricArmClient.cs new file mode 100644 index 0000000000000..5dffcd71f936b --- /dev/null +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceFabric; + +namespace Azure.ResourceManager.ServiceFabric.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableServiceFabricArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceFabricArmClient() + { + } + + /// 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 MockableServiceFabricArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableServiceFabricArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricClusterResource GetServiceFabricClusterResource(ResourceIdentifier id) + { + ServiceFabricClusterResource.ValidateResourceId(id); + return new ServiceFabricClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricApplicationTypeResource GetServiceFabricApplicationTypeResource(ResourceIdentifier id) + { + ServiceFabricApplicationTypeResource.ValidateResourceId(id); + return new ServiceFabricApplicationTypeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricApplicationTypeVersionResource GetServiceFabricApplicationTypeVersionResource(ResourceIdentifier id) + { + ServiceFabricApplicationTypeVersionResource.ValidateResourceId(id); + return new ServiceFabricApplicationTypeVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricApplicationResource GetServiceFabricApplicationResource(ResourceIdentifier id) + { + ServiceFabricApplicationResource.ValidateResourceId(id); + return new ServiceFabricApplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricServiceResource GetServiceFabricServiceResource(ResourceIdentifier id) + { + ServiceFabricServiceResource.ValidateResourceId(id); + return new ServiceFabricServiceResource(Client, id); + } + } +} diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricResourceGroupResource.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricResourceGroupResource.cs new file mode 100644 index 0000000000000..818136e2663fa --- /dev/null +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ServiceFabric; + +namespace Azure.ResourceManager.ServiceFabric.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableServiceFabricResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceFabricResourceGroupResource() + { + } + + /// 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 MockableServiceFabricResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ServiceFabricClusterResources in the ResourceGroupResource. + /// An object representing collection of ServiceFabricClusterResources and their operations over a ServiceFabricClusterResource. + public virtual ServiceFabricClusterCollection GetServiceFabricClusters() + { + return GetCachedClient(client => new ServiceFabricClusterCollection(client, Id)); + } + + /// + /// Get a Service Fabric cluster resource created or in the process of being created in the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceFabricClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetServiceFabricClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Service Fabric cluster resource created or in the process of being created in the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceFabricCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetServiceFabricClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricSubscriptionResource.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricSubscriptionResource.cs new file mode 100644 index 0000000000000..5b5b5055758af --- /dev/null +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/MockableServiceFabricSubscriptionResource.cs @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceFabric; +using Azure.ResourceManager.ServiceFabric.Models; + +namespace Azure.ResourceManager.ServiceFabric.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableServiceFabricSubscriptionResource : ArmResource + { + private ClientDiagnostics _serviceFabricClusterClustersClientDiagnostics; + private ClustersRestOperations _serviceFabricClusterClustersRestClient; + private ClientDiagnostics _clusterVersionsClientDiagnostics; + private ClusterVersionsRestOperations _clusterVersionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableServiceFabricSubscriptionResource() + { + } + + /// 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 MockableServiceFabricSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ServiceFabricClusterClustersClientDiagnostics => _serviceFabricClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabric", ServiceFabricClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations ServiceFabricClusterClustersRestClient => _serviceFabricClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceFabricClusterResource.ResourceType)); + private ClientDiagnostics ClusterVersionsClientDiagnostics => _clusterVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabric", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ClusterVersionsRestOperations ClusterVersionsRestClient => _clusterVersionsRestClient ??= new ClusterVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all Service Fabric cluster resources created or in the process of being created in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetServiceFabricClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceFabricClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServiceFabricClusterResource(Client, ServiceFabricClusterData.DeserializeServiceFabricClusterData(e)), ServiceFabricClusterClustersClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetServiceFabricClusters", "value", null, cancellationToken); + } + + /// + /// Gets all Service Fabric cluster resources created or in the process of being created in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters + /// + /// + /// Operation Id + /// Clusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetServiceFabricClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceFabricClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServiceFabricClusterResource(Client, ServiceFabricClusterData.DeserializeServiceFabricClusterData(e)), ServiceFabricClusterClustersClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetServiceFabricClusters", "value", null, cancellationToken); + } + + /// + /// Gets information about an available Service Fabric cluster code version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion} + /// + /// + /// Operation Id + /// ClusterVersions_Get + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cluster code version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetClusterVersionsAsync(AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateGetRequest(Id.SubscriptionId, location, clusterVersion); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetClusterVersions", "value", null, cancellationToken); + } + + /// + /// Gets information about an available Service Fabric cluster code version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion} + /// + /// + /// Operation Id + /// ClusterVersions_Get + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cluster code version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetClusterVersions(AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateGetRequest(Id.SubscriptionId, location, clusterVersion); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetClusterVersions", "value", null, cancellationToken); + } + + /// + /// Gets information about an available Service Fabric cluster code version by environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion} + /// + /// + /// Operation Id + /// ClusterVersions_GetByEnvironment + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The operating system of the cluster. The default means all. + /// The cluster code version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetClusterVersionsByEnvironmentAsync(AzureLocation location, ClusterVersionsEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateGetByEnvironmentRequest(Id.SubscriptionId, location, environment, clusterVersion); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetClusterVersionsByEnvironment", "value", null, cancellationToken); + } + + /// + /// Gets information about an available Service Fabric cluster code version by environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion} + /// + /// + /// Operation Id + /// ClusterVersions_GetByEnvironment + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The operating system of the cluster. The default means all. + /// The cluster code version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetClusterVersionsByEnvironment(AzureLocation location, ClusterVersionsEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateGetByEnvironmentRequest(Id.SubscriptionId, location, environment, clusterVersion); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetClusterVersionsByEnvironment", "value", null, cancellationToken); + } + + /// + /// Gets all available code versions for Service Fabric cluster resources by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions + /// + /// + /// Operation Id + /// ClusterVersions_List + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetClusterVersionsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetClusterVersions", "value", null, cancellationToken); + } + + /// + /// Gets all available code versions for Service Fabric cluster resources by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions + /// + /// + /// Operation Id + /// ClusterVersions_List + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetClusterVersions(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetClusterVersions", "value", null, cancellationToken); + } + + /// + /// Gets all available code versions for Service Fabric cluster resources by environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions + /// + /// + /// Operation Id + /// ClusterVersions_ListByEnvironment + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The operating system of the cluster. The default means all. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetClusterVersionsByEnvironmentAsync(AzureLocation location, ClusterVersionsEnvironment environment, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateListByEnvironmentRequest(Id.SubscriptionId, location, environment); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetClusterVersionsByEnvironment", "value", null, cancellationToken); + } + + /// + /// Gets all available code versions for Service Fabric cluster resources by environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions + /// + /// + /// Operation Id + /// ClusterVersions_ListByEnvironment + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The operating system of the cluster. The default means all. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetClusterVersionsByEnvironment(AzureLocation location, ClusterVersionsEnvironment environment, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateListByEnvironmentRequest(Id.SubscriptionId, location, environment); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "MockableServiceFabricSubscriptionResource.GetClusterVersionsByEnvironment", "value", null, cancellationToken); + } + } +} diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 28ce17f04db22..0000000000000 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ServiceFabric -{ - /// 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 ServiceFabricClusterResources in the ResourceGroupResource. - /// An object representing collection of ServiceFabricClusterResources and their operations over a ServiceFabricClusterResource. - public virtual ServiceFabricClusterCollection GetServiceFabricClusters() - { - return GetCachedClient(Client => new ServiceFabricClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/ServiceFabricExtensions.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/ServiceFabricExtensions.cs index bb1b205f68c4e..5b411ce6efc53 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/ServiceFabricExtensions.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/ServiceFabricExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceFabric.Mocking; using Azure.ResourceManager.ServiceFabric.Models; namespace Azure.ResourceManager.ServiceFabric @@ -19,138 +20,113 @@ namespace Azure.ResourceManager.ServiceFabric /// A class to add extension methods to Azure.ResourceManager.ServiceFabric. public static partial class ServiceFabricExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableServiceFabricArmClient GetMockableServiceFabricArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableServiceFabricArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableServiceFabricResourceGroupResource GetMockableServiceFabricResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableServiceFabricResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableServiceFabricSubscriptionResource GetMockableServiceFabricSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableServiceFabricSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ServiceFabricClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricClusterResource GetServiceFabricClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricClusterResource.ValidateResourceId(id); - return new ServiceFabricClusterResource(client, id); - } - ); + return GetMockableServiceFabricArmClient(client).GetServiceFabricClusterResource(id); } - #endregion - #region ServiceFabricApplicationTypeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricApplicationTypeResource GetServiceFabricApplicationTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricApplicationTypeResource.ValidateResourceId(id); - return new ServiceFabricApplicationTypeResource(client, id); - } - ); + return GetMockableServiceFabricArmClient(client).GetServiceFabricApplicationTypeResource(id); } - #endregion - #region ServiceFabricApplicationTypeVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricApplicationTypeVersionResource GetServiceFabricApplicationTypeVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricApplicationTypeVersionResource.ValidateResourceId(id); - return new ServiceFabricApplicationTypeVersionResource(client, id); - } - ); + return GetMockableServiceFabricArmClient(client).GetServiceFabricApplicationTypeVersionResource(id); } - #endregion - #region ServiceFabricApplicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricApplicationResource GetServiceFabricApplicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricApplicationResource.ValidateResourceId(id); - return new ServiceFabricApplicationResource(client, id); - } - ); + return GetMockableServiceFabricArmClient(client).GetServiceFabricApplicationResource(id); } - #endregion - #region ServiceFabricServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricServiceResource GetServiceFabricServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricServiceResource.ValidateResourceId(id); - return new ServiceFabricServiceResource(client, id); - } - ); + return GetMockableServiceFabricArmClient(client).GetServiceFabricServiceResource(id); } - #endregion - /// Gets a collection of ServiceFabricClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of ServiceFabricClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ServiceFabricClusterResources and their operations over a ServiceFabricClusterResource. public static ServiceFabricClusterCollection GetServiceFabricClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetServiceFabricClusters(); + return GetMockableServiceFabricResourceGroupResource(resourceGroupResource).GetServiceFabricClusters(); } /// @@ -165,16 +141,20 @@ public static ServiceFabricClusterCollection GetServiceFabricClusters(this Resou /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetServiceFabricClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetServiceFabricClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceFabricResourceGroupResource(resourceGroupResource).GetServiceFabricClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -189,16 +169,20 @@ public static async Task> GetServiceFabri /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetServiceFabricCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetServiceFabricClusters().Get(clusterName, cancellationToken); + return GetMockableServiceFabricResourceGroupResource(resourceGroupResource).GetServiceFabricCluster(clusterName, cancellationToken); } /// @@ -213,13 +197,17 @@ public static Response GetServiceFabricCluster(thi /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServiceFabricClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceFabricClustersAsync(cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetServiceFabricClustersAsync(cancellationToken); } /// @@ -234,13 +222,17 @@ public static AsyncPageable GetServiceFabricCluste /// Clusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServiceFabricClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceFabricClusters(cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetServiceFabricClusters(cancellationToken); } /// @@ -255,6 +247,10 @@ public static Pageable GetServiceFabricClusters(th /// ClusterVersions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -265,9 +261,7 @@ public static Pageable GetServiceFabricClusters(th /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetClusterVersionsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClusterVersionsAsync(location, clusterVersion, cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetClusterVersionsAsync(location, clusterVersion, cancellationToken); } /// @@ -282,6 +276,10 @@ public static AsyncPageable GetClusterVersionsAsync(t /// ClusterVersions_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -292,9 +290,7 @@ public static AsyncPageable GetClusterVersionsAsync(t /// A collection of that may take multiple service requests to iterate over. public static Pageable GetClusterVersions(this SubscriptionResource subscriptionResource, AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClusterVersions(location, clusterVersion, cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetClusterVersions(location, clusterVersion, cancellationToken); } /// @@ -309,6 +305,10 @@ public static Pageable GetClusterVersions(this Subscr /// ClusterVersions_GetByEnvironment /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -320,9 +320,7 @@ public static Pageable GetClusterVersions(this Subscr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetClusterVersionsByEnvironmentAsync(this SubscriptionResource subscriptionResource, AzureLocation location, ClusterVersionsEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClusterVersionsByEnvironmentAsync(location, environment, clusterVersion, cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetClusterVersionsByEnvironmentAsync(location, environment, clusterVersion, cancellationToken); } /// @@ -337,6 +335,10 @@ public static AsyncPageable GetClusterVersionsByEnvir /// ClusterVersions_GetByEnvironment /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -348,9 +350,7 @@ public static AsyncPageable GetClusterVersionsByEnvir /// A collection of that may take multiple service requests to iterate over. public static Pageable GetClusterVersionsByEnvironment(this SubscriptionResource subscriptionResource, AzureLocation location, ClusterVersionsEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClusterVersionsByEnvironment(location, environment, clusterVersion, cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetClusterVersionsByEnvironment(location, environment, clusterVersion, cancellationToken); } /// @@ -365,6 +365,10 @@ public static Pageable GetClusterVersionsByEnvironmen /// ClusterVersions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -372,7 +376,7 @@ public static Pageable GetClusterVersionsByEnvironmen /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetClusterVersionsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClusterVersionsAsync(location, cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetClusterVersionsAsync(location, cancellationToken); } /// @@ -387,6 +391,10 @@ public static AsyncPageable GetClusterVersionsAsync(t /// ClusterVersions_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -394,7 +402,7 @@ public static AsyncPageable GetClusterVersionsAsync(t /// A collection of that may take multiple service requests to iterate over. public static Pageable GetClusterVersions(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClusterVersions(location, cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetClusterVersions(location, cancellationToken); } /// @@ -409,6 +417,10 @@ public static Pageable GetClusterVersions(this Subscr /// ClusterVersions_ListByEnvironment /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -417,7 +429,7 @@ public static Pageable GetClusterVersions(this Subscr /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetClusterVersionsByEnvironmentAsync(this SubscriptionResource subscriptionResource, AzureLocation location, ClusterVersionsEnvironment environment, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClusterVersionsByEnvironmentAsync(location, environment, cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetClusterVersionsByEnvironmentAsync(location, environment, cancellationToken); } /// @@ -432,6 +444,10 @@ public static AsyncPageable GetClusterVersionsByEnvir /// ClusterVersions_ListByEnvironment /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -440,7 +456,7 @@ public static AsyncPageable GetClusterVersionsByEnvir /// A collection of that may take multiple service requests to iterate over. public static Pageable GetClusterVersionsByEnvironment(this SubscriptionResource subscriptionResource, AzureLocation location, ClusterVersionsEnvironment environment, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetClusterVersionsByEnvironment(location, environment, cancellationToken); + return GetMockableServiceFabricSubscriptionResource(subscriptionResource).GetClusterVersionsByEnvironment(location, environment, cancellationToken); } } } diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 34822c3d9aac5..0000000000000 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ServiceFabric.Models; - -namespace Azure.ResourceManager.ServiceFabric -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _serviceFabricClusterClustersClientDiagnostics; - private ClustersRestOperations _serviceFabricClusterClustersRestClient; - private ClientDiagnostics _clusterVersionsClientDiagnostics; - private ClusterVersionsRestOperations _clusterVersionsRestClient; - - /// 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 ServiceFabricClusterClustersClientDiagnostics => _serviceFabricClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabric", ServiceFabricClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations ServiceFabricClusterClustersRestClient => _serviceFabricClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceFabricClusterResource.ResourceType)); - private ClientDiagnostics ClusterVersionsClientDiagnostics => _clusterVersionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabric", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ClusterVersionsRestOperations ClusterVersionsRestClient => _clusterVersionsRestClient ??= new ClusterVersionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets all Service Fabric cluster resources created or in the process of being created in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetServiceFabricClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceFabricClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ServiceFabricClusterResource(Client, ServiceFabricClusterData.DeserializeServiceFabricClusterData(e)), ServiceFabricClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServiceFabricClusters", "value", null, cancellationToken); - } - - /// - /// Gets all Service Fabric cluster resources created or in the process of being created in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters - /// - /// - /// Operation Id - /// Clusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetServiceFabricClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceFabricClusterClustersRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ServiceFabricClusterResource(Client, ServiceFabricClusterData.DeserializeServiceFabricClusterData(e)), ServiceFabricClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServiceFabricClusters", "value", null, cancellationToken); - } - - /// - /// Gets information about an available Service Fabric cluster code version. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion} - /// - /// - /// Operation Id - /// ClusterVersions_Get - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cluster code version. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetClusterVersionsAsync(AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateGetRequest(Id.SubscriptionId, location, clusterVersion); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClusterVersions", "value", null, cancellationToken); - } - - /// - /// Gets information about an available Service Fabric cluster code version. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion} - /// - /// - /// Operation Id - /// ClusterVersions_Get - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cluster code version. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetClusterVersions(AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateGetRequest(Id.SubscriptionId, location, clusterVersion); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClusterVersions", "value", null, cancellationToken); - } - - /// - /// Gets information about an available Service Fabric cluster code version by environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion} - /// - /// - /// Operation Id - /// ClusterVersions_GetByEnvironment - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The operating system of the cluster. The default means all. - /// The cluster code version. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetClusterVersionsByEnvironmentAsync(AzureLocation location, ClusterVersionsEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateGetByEnvironmentRequest(Id.SubscriptionId, location, environment, clusterVersion); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClusterVersionsByEnvironment", "value", null, cancellationToken); - } - - /// - /// Gets information about an available Service Fabric cluster code version by environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion} - /// - /// - /// Operation Id - /// ClusterVersions_GetByEnvironment - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The operating system of the cluster. The default means all. - /// The cluster code version. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetClusterVersionsByEnvironment(AzureLocation location, ClusterVersionsEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateGetByEnvironmentRequest(Id.SubscriptionId, location, environment, clusterVersion); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClusterVersionsByEnvironment", "value", null, cancellationToken); - } - - /// - /// Gets all available code versions for Service Fabric cluster resources by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions - /// - /// - /// Operation Id - /// ClusterVersions_List - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetClusterVersionsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClusterVersions", "value", null, cancellationToken); - } - - /// - /// Gets all available code versions for Service Fabric cluster resources by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions - /// - /// - /// Operation Id - /// ClusterVersions_List - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetClusterVersions(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClusterVersions", "value", null, cancellationToken); - } - - /// - /// Gets all available code versions for Service Fabric cluster resources by environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions - /// - /// - /// Operation Id - /// ClusterVersions_ListByEnvironment - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The operating system of the cluster. The default means all. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetClusterVersionsByEnvironmentAsync(AzureLocation location, ClusterVersionsEnvironment environment, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateListByEnvironmentRequest(Id.SubscriptionId, location, environment); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClusterVersionsByEnvironment", "value", null, cancellationToken); - } - - /// - /// Gets all available code versions for Service Fabric cluster resources by environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions - /// - /// - /// Operation Id - /// ClusterVersions_ListByEnvironment - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The operating system of the cluster. The default means all. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetClusterVersionsByEnvironment(AzureLocation location, ClusterVersionsEnvironment environment, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ClusterVersionsRestClient.CreateListByEnvironmentRequest(Id.SubscriptionId, location, environment); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ClusterCodeVersionsResult.DeserializeClusterCodeVersionsResult, ClusterVersionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetClusterVersionsByEnvironment", "value", null, cancellationToken); - } - } -} diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationResource.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationResource.cs index a3c166e993ba6..8f869f1cd8f80 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationResource.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ServiceFabric public partial class ServiceFabricApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceFabricServiceResources and their operations over a ServiceFabricServiceResource. public virtual ServiceFabricServiceCollection GetServiceFabricServices() { - return GetCachedClient(Client => new ServiceFabricServiceCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricServiceCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual ServiceFabricServiceCollection GetServiceFabricServices() /// /// The name of the service resource in the format of {applicationName}~{serviceName}. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricServiceAsync(string serviceName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetServiceFabr /// /// The name of the service resource in the format of {applicationName}~{serviceName}. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricService(string serviceName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeResource.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeResource.cs index f085f49c2ac1c..60a9ea34ef3a2 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeResource.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.ServiceFabric public partial class ServiceFabricApplicationTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceFabricApplicationTypeVersionResources and their operations over a ServiceFabricApplicationTypeVersionResource. public virtual ServiceFabricApplicationTypeVersionCollection GetServiceFabricApplicationTypeVersions() { - return GetCachedClient(Client => new ServiceFabricApplicationTypeVersionCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricApplicationTypeVersionCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual ServiceFabricApplicationTypeVersionCollection GetServiceFabricApp /// /// The application type version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricApplicationTypeVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> /// /// The application type version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricApplicationTypeVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeVersionResource.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeVersionResource.cs index dc4478829d7df..4e7e5000f85bb 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeVersionResource.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeVersionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.ServiceFabric public partial class ServiceFabricApplicationTypeVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationTypeName. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationTypeName, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"; diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterResource.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterResource.cs index df7de23164ac8..ad70e758a110e 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterResource.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ServiceFabric public partial class ServiceFabricClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceFabricApplicationTypeResources and their operations over a ServiceFabricApplicationTypeResource. public virtual ServiceFabricApplicationTypeCollection GetServiceFabricApplicationTypes() { - return GetCachedClient(Client => new ServiceFabricApplicationTypeCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricApplicationTypeCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual ServiceFabricApplicationTypeCollection GetServiceFabricApplicatio /// /// The name of the application type name resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricApplicationTypeAsync(string applicationTypeName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetSer /// /// The name of the application type name resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricApplicationType(string applicationTypeName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetServiceFabricAp /// An object representing collection of ServiceFabricApplicationResources and their operations over a ServiceFabricApplicationResource. public virtual ServiceFabricApplicationCollection GetServiceFabricApplications() { - return GetCachedClient(Client => new ServiceFabricApplicationCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricApplicationCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual ServiceFabricApplicationCollection GetServiceFabricApplications() /// /// The name of the application resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricApplicationAsync(string applicationName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetService /// /// The name of the application resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricApplication(string applicationName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricServiceResource.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricServiceResource.cs index 7ff2b7d9a1c05..722eefce08979 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricServiceResource.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricServiceResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.ServiceFabric public partial class ServiceFabricServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"; diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/api/Azure.ResourceManager.ServiceFabricManagedClusters.netstandard2.0.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/api/Azure.ResourceManager.ServiceFabricManagedClusters.netstandard2.0.cs index 9961eeddb34d0..a093705fe0cd3 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/api/Azure.ResourceManager.ServiceFabricManagedClusters.netstandard2.0.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/api/Azure.ResourceManager.ServiceFabricManagedClusters.netstandard2.0.cs @@ -19,7 +19,7 @@ protected ServiceFabricManagedApplicationCollection() { } } public partial class ServiceFabricManagedApplicationData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricManagedApplicationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricManagedApplicationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList ManagedIdentities { get { throw null; } } public System.Collections.Generic.IDictionary Parameters { get { throw null; } } @@ -69,7 +69,7 @@ protected ServiceFabricManagedApplicationTypeCollection() { } } public partial class ServiceFabricManagedApplicationTypeData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricManagedApplicationTypeData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricManagedApplicationTypeData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } } public partial class ServiceFabricManagedApplicationTypeResource : Azure.ResourceManager.ArmResource @@ -114,7 +114,7 @@ protected ServiceFabricManagedApplicationTypeVersionCollection() { } } public partial class ServiceFabricManagedApplicationTypeVersionData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricManagedApplicationTypeVersionData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricManagedApplicationTypeVersionData(Azure.Core.AzureLocation location) { } public System.Uri AppPackageUri { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } } @@ -157,8 +157,8 @@ protected ServiceFabricManagedClusterCollection() { } } public partial class ServiceFabricManagedClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricManagedClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } - public ServiceFabricManagedClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabricManagedClusters.Models.ServiceFabricManagedClustersSku sku) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricManagedClusterData(Azure.Core.AzureLocation location) { } + public ServiceFabricManagedClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabricManagedClusters.Models.ServiceFabricManagedClustersSku sku) { } public System.Collections.Generic.IList AddOnFeatures { get { throw null; } } public string AdminPassword { get { throw null; } set { } } public string AdminUserName { get { throw null; } set { } } @@ -366,7 +366,7 @@ protected ServiceFabricManagedServiceCollection() { } } public partial class ServiceFabricManagedServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public ServiceFabricManagedServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ServiceFabricManagedServiceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ServiceFabricManagedClusters.Models.ManagedServiceProperties Properties { get { throw null; } set { } } } public partial class ServiceFabricManagedServiceResource : Azure.ResourceManager.ArmResource @@ -390,6 +390,44 @@ protected ServiceFabricManagedServiceResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.ServiceFabricManagedClusters.Models.ServiceFabricManagedServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ServiceFabricManagedClusters.Mocking +{ + public partial class MockableServiceFabricManagedClustersArmClient : Azure.ResourceManager.ArmResource + { + protected MockableServiceFabricManagedClustersArmClient() { } + public virtual Azure.ResourceManager.ServiceFabricManagedClusters.ServiceFabricManagedApplicationResource GetServiceFabricManagedApplicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabricManagedClusters.ServiceFabricManagedApplicationTypeResource GetServiceFabricManagedApplicationTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabricManagedClusters.ServiceFabricManagedApplicationTypeVersionResource GetServiceFabricManagedApplicationTypeVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabricManagedClusters.ServiceFabricManagedClusterResource GetServiceFabricManagedClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabricManagedClusters.ServiceFabricManagedNodeTypeResource GetServiceFabricManagedNodeTypeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceFabricManagedClusters.ServiceFabricManagedServiceResource GetServiceFabricManagedServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableServiceFabricManagedClustersResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceFabricManagedClustersResourceGroupResource() { } + public virtual Azure.Response GetServiceFabricManagedCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetServiceFabricManagedClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ServiceFabricManagedClusters.ServiceFabricManagedClusterCollection GetServiceFabricManagedClusters() { throw null; } + } + public partial class MockableServiceFabricManagedClustersSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceFabricManagedClustersSubscriptionResource() { } + public virtual Azure.Response GetManagedClusterVersion(Azure.Core.AzureLocation location, string clusterVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedClusterVersionAsync(Azure.Core.AzureLocation location, string clusterVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetManagedClusterVersionByEnvironment(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabricManagedClusters.Models.ManagedClusterVersionEnvironment environment, string clusterVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedClusterVersionByEnvironmentAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabricManagedClusters.Models.ManagedClusterVersionEnvironment environment, string clusterVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedClusterVersions(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedClusterVersionsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedClusterVersionsByEnvironment(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabricManagedClusters.Models.ManagedClusterVersionEnvironment environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedClusterVersionsByEnvironmentAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.ServiceFabricManagedClusters.Models.ManagedClusterVersionEnvironment environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetManagedUnsupportedVmSize(Azure.Core.AzureLocation location, string vmSize, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedUnsupportedVmSizeAsync(Azure.Core.AzureLocation location, string vmSize, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedUnsupportedVmSizes(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedUnsupportedVmSizesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetServiceFabricManagedClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetServiceFabricManagedClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ServiceFabricManagedClusters.Models { public partial class ApplicationHealthPolicy diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersArmClient.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersArmClient.cs new file mode 100644 index 0000000000000..71307359e3db7 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersArmClient.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceFabricManagedClusters; + +namespace Azure.ResourceManager.ServiceFabricManagedClusters.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableServiceFabricManagedClustersArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceFabricManagedClustersArmClient() + { + } + + /// 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 MockableServiceFabricManagedClustersArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableServiceFabricManagedClustersArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricManagedApplicationTypeResource GetServiceFabricManagedApplicationTypeResource(ResourceIdentifier id) + { + ServiceFabricManagedApplicationTypeResource.ValidateResourceId(id); + return new ServiceFabricManagedApplicationTypeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricManagedApplicationTypeVersionResource GetServiceFabricManagedApplicationTypeVersionResource(ResourceIdentifier id) + { + ServiceFabricManagedApplicationTypeVersionResource.ValidateResourceId(id); + return new ServiceFabricManagedApplicationTypeVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricManagedApplicationResource GetServiceFabricManagedApplicationResource(ResourceIdentifier id) + { + ServiceFabricManagedApplicationResource.ValidateResourceId(id); + return new ServiceFabricManagedApplicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricManagedServiceResource GetServiceFabricManagedServiceResource(ResourceIdentifier id) + { + ServiceFabricManagedServiceResource.ValidateResourceId(id); + return new ServiceFabricManagedServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricManagedClusterResource GetServiceFabricManagedClusterResource(ResourceIdentifier id) + { + ServiceFabricManagedClusterResource.ValidateResourceId(id); + return new ServiceFabricManagedClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceFabricManagedNodeTypeResource GetServiceFabricManagedNodeTypeResource(ResourceIdentifier id) + { + ServiceFabricManagedNodeTypeResource.ValidateResourceId(id); + return new ServiceFabricManagedNodeTypeResource(Client, id); + } + } +} diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersResourceGroupResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersResourceGroupResource.cs new file mode 100644 index 0000000000000..5258f4f8945d7 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ServiceFabricManagedClusters; + +namespace Azure.ResourceManager.ServiceFabricManagedClusters.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableServiceFabricManagedClustersResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceFabricManagedClustersResourceGroupResource() + { + } + + /// 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 MockableServiceFabricManagedClustersResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ServiceFabricManagedClusterResources in the ResourceGroupResource. + /// An object representing collection of ServiceFabricManagedClusterResources and their operations over a ServiceFabricManagedClusterResource. + public virtual ServiceFabricManagedClusterCollection GetServiceFabricManagedClusters() + { + return GetCachedClient(client => new ServiceFabricManagedClusterCollection(client, Id)); + } + + /// + /// Get a Service Fabric managed cluster resource created or in the process of being created in the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName} + /// + /// + /// Operation Id + /// ManagedClusters_Get + /// + /// + /// + /// The name of the cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetServiceFabricManagedClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetServiceFabricManagedClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Service Fabric managed cluster resource created or in the process of being created in the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName} + /// + /// + /// Operation Id + /// ManagedClusters_Get + /// + /// + /// + /// The name of the cluster resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetServiceFabricManagedCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetServiceFabricManagedClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersSubscriptionResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersSubscriptionResource.cs new file mode 100644 index 0000000000000..b21fba357585c --- /dev/null +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/MockableServiceFabricManagedClustersSubscriptionResource.cs @@ -0,0 +1,454 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceFabricManagedClusters; +using Azure.ResourceManager.ServiceFabricManagedClusters.Models; + +namespace Azure.ResourceManager.ServiceFabricManagedClusters.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableServiceFabricManagedClustersSubscriptionResource : ArmResource + { + private ClientDiagnostics _serviceFabricManagedClusterManagedClustersClientDiagnostics; + private ManagedClustersRestOperations _serviceFabricManagedClusterManagedClustersRestClient; + private ClientDiagnostics _managedClusterVersionClientDiagnostics; + private ManagedClusterVersionRestOperations _managedClusterVersionRestClient; + private ClientDiagnostics _managedUnsupportedVmSizesClientDiagnostics; + private ManagedUnsupportedVMSizesRestOperations _managedUnsupportedVmSizesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableServiceFabricManagedClustersSubscriptionResource() + { + } + + /// 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 MockableServiceFabricManagedClustersSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ServiceFabricManagedClusterManagedClustersClientDiagnostics => _serviceFabricManagedClusterManagedClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabricManagedClusters", ServiceFabricManagedClusterResource.ResourceType.Namespace, Diagnostics); + private ManagedClustersRestOperations ServiceFabricManagedClusterManagedClustersRestClient => _serviceFabricManagedClusterManagedClustersRestClient ??= new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceFabricManagedClusterResource.ResourceType)); + private ClientDiagnostics ManagedClusterVersionClientDiagnostics => _managedClusterVersionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabricManagedClusters", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ManagedClusterVersionRestOperations ManagedClusterVersionRestClient => _managedClusterVersionRestClient ??= new ManagedClusterVersionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics managedUnsupportedVMSizesClientDiagnostics => _managedUnsupportedVmSizesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabricManagedClusters", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ManagedUnsupportedVMSizesRestOperations managedUnsupportedVMSizesRestClient => _managedUnsupportedVmSizesRestClient ??= new ManagedUnsupportedVMSizesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all Service Fabric cluster resources created or in the process of being created in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters + /// + /// + /// Operation Id + /// ManagedClusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetServiceFabricManagedClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceFabricManagedClusterManagedClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceFabricManagedClusterManagedClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceFabricManagedClusterResource(Client, ServiceFabricManagedClusterData.DeserializeServiceFabricManagedClusterData(e)), ServiceFabricManagedClusterManagedClustersClientDiagnostics, Pipeline, "MockableServiceFabricManagedClustersSubscriptionResource.GetServiceFabricManagedClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all Service Fabric cluster resources created or in the process of being created in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters + /// + /// + /// Operation Id + /// ManagedClusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetServiceFabricManagedClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceFabricManagedClusterManagedClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceFabricManagedClusterManagedClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceFabricManagedClusterResource(Client, ServiceFabricManagedClusterData.DeserializeServiceFabricManagedClusterData(e)), ServiceFabricManagedClusterManagedClustersClientDiagnostics, Pipeline, "MockableServiceFabricManagedClustersSubscriptionResource.GetServiceFabricManagedClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets information about an available Service Fabric managed cluster code version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion} + /// + /// + /// Operation Id + /// ManagedClusterVersion_Get + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cluster code version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetManagedClusterVersionAsync(AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); + + using var scope = ManagedClusterVersionClientDiagnostics.CreateScope("MockableServiceFabricManagedClustersSubscriptionResource.GetManagedClusterVersion"); + scope.Start(); + try + { + var response = await ManagedClusterVersionRestClient.GetAsync(Id.SubscriptionId, location, clusterVersion, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about an available Service Fabric managed cluster code version. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion} + /// + /// + /// Operation Id + /// ManagedClusterVersion_Get + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cluster code version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetManagedClusterVersion(AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); + + using var scope = ManagedClusterVersionClientDiagnostics.CreateScope("MockableServiceFabricManagedClustersSubscriptionResource.GetManagedClusterVersion"); + scope.Start(); + try + { + var response = ManagedClusterVersionRestClient.Get(Id.SubscriptionId, location, clusterVersion, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about an available Service Fabric cluster code version by environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions/{clusterVersion} + /// + /// + /// Operation Id + /// ManagedClusterVersion_GetByEnvironment + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The operating system of the cluster. The default means all. + /// The cluster code version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetManagedClusterVersionByEnvironmentAsync(AzureLocation location, ManagedClusterVersionEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); + + using var scope = ManagedClusterVersionClientDiagnostics.CreateScope("MockableServiceFabricManagedClustersSubscriptionResource.GetManagedClusterVersionByEnvironment"); + scope.Start(); + try + { + var response = await ManagedClusterVersionRestClient.GetByEnvironmentAsync(Id.SubscriptionId, location, environment, clusterVersion, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets information about an available Service Fabric cluster code version by environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions/{clusterVersion} + /// + /// + /// Operation Id + /// ManagedClusterVersion_GetByEnvironment + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The operating system of the cluster. The default means all. + /// The cluster code version. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetManagedClusterVersionByEnvironment(AzureLocation location, ManagedClusterVersionEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); + + using var scope = ManagedClusterVersionClientDiagnostics.CreateScope("MockableServiceFabricManagedClustersSubscriptionResource.GetManagedClusterVersionByEnvironment"); + scope.Start(); + try + { + var response = ManagedClusterVersionRestClient.GetByEnvironment(Id.SubscriptionId, location, environment, clusterVersion, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all available code versions for Service Fabric cluster resources by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions + /// + /// + /// Operation Id + /// ManagedClusterVersion_List + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedClusterVersionsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterVersionRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ServiceFabricManagedClusterVersion.DeserializeServiceFabricManagedClusterVersion, ManagedClusterVersionClientDiagnostics, Pipeline, "MockableServiceFabricManagedClustersSubscriptionResource.GetManagedClusterVersions", "", null, cancellationToken); + } + + /// + /// Gets all available code versions for Service Fabric cluster resources by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions + /// + /// + /// Operation Id + /// ManagedClusterVersion_List + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedClusterVersions(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterVersionRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ServiceFabricManagedClusterVersion.DeserializeServiceFabricManagedClusterVersion, ManagedClusterVersionClientDiagnostics, Pipeline, "MockableServiceFabricManagedClustersSubscriptionResource.GetManagedClusterVersions", "", null, cancellationToken); + } + + /// + /// Gets all available code versions for Service Fabric cluster resources by environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions + /// + /// + /// Operation Id + /// ManagedClusterVersion_ListByEnvironment + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The operating system of the cluster. The default means all. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedClusterVersionsByEnvironmentAsync(AzureLocation location, ManagedClusterVersionEnvironment environment, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterVersionRestClient.CreateListByEnvironmentRequest(Id.SubscriptionId, location, environment); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ServiceFabricManagedClusterVersion.DeserializeServiceFabricManagedClusterVersion, ManagedClusterVersionClientDiagnostics, Pipeline, "MockableServiceFabricManagedClustersSubscriptionResource.GetManagedClusterVersionsByEnvironment", "", null, cancellationToken); + } + + /// + /// Gets all available code versions for Service Fabric cluster resources by environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions + /// + /// + /// Operation Id + /// ManagedClusterVersion_ListByEnvironment + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The operating system of the cluster. The default means all. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedClusterVersionsByEnvironment(AzureLocation location, ManagedClusterVersionEnvironment environment, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterVersionRestClient.CreateListByEnvironmentRequest(Id.SubscriptionId, location, environment); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ServiceFabricManagedClusterVersion.DeserializeServiceFabricManagedClusterVersion, ManagedClusterVersionClientDiagnostics, Pipeline, "MockableServiceFabricManagedClustersSubscriptionResource.GetManagedClusterVersionsByEnvironment", "", null, cancellationToken); + } + + /// + /// Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes + /// + /// + /// Operation Id + /// managedUnsupportedVMSizes_List + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedUnsupportedVmSizesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => managedUnsupportedVMSizesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => managedUnsupportedVMSizesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ServiceFabricManagedUnsupportedVmSize.DeserializeServiceFabricManagedUnsupportedVmSize, managedUnsupportedVMSizesClientDiagnostics, Pipeline, "MockableServiceFabricManagedClustersSubscriptionResource.GetManagedUnsupportedVmSizes", "value", "nextLink", cancellationToken); + } + + /// + /// Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes + /// + /// + /// Operation Id + /// managedUnsupportedVMSizes_List + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedUnsupportedVmSizes(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => managedUnsupportedVMSizesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => managedUnsupportedVMSizesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ServiceFabricManagedUnsupportedVmSize.DeserializeServiceFabricManagedUnsupportedVmSize, managedUnsupportedVMSizesClientDiagnostics, Pipeline, "MockableServiceFabricManagedClustersSubscriptionResource.GetManagedUnsupportedVmSizes", "value", "nextLink", cancellationToken); + } + + /// + /// Get unsupported vm size for Service Fabric Managed Clusters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize} + /// + /// + /// Operation Id + /// managedUnsupportedVMSizes_Get + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// VM Size name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetManagedUnsupportedVmSizeAsync(AzureLocation location, string vmSize, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmSize, nameof(vmSize)); + + using var scope = managedUnsupportedVMSizesClientDiagnostics.CreateScope("MockableServiceFabricManagedClustersSubscriptionResource.GetManagedUnsupportedVmSize"); + scope.Start(); + try + { + var response = await managedUnsupportedVMSizesRestClient.GetAsync(Id.SubscriptionId, location, vmSize, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get unsupported vm size for Service Fabric Managed Clusters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize} + /// + /// + /// Operation Id + /// managedUnsupportedVMSizes_Get + /// + /// + /// + /// The location for the cluster code versions. This is different from cluster location. + /// VM Size name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetManagedUnsupportedVmSize(AzureLocation location, string vmSize, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vmSize, nameof(vmSize)); + + using var scope = managedUnsupportedVMSizesClientDiagnostics.CreateScope("MockableServiceFabricManagedClustersSubscriptionResource.GetManagedUnsupportedVmSize"); + scope.Start(); + try + { + var response = managedUnsupportedVMSizesRestClient.Get(Id.SubscriptionId, location, vmSize, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 31de4bc614fac..0000000000000 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ServiceFabricManagedClusters -{ - /// 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 ServiceFabricManagedClusterResources in the ResourceGroupResource. - /// An object representing collection of ServiceFabricManagedClusterResources and their operations over a ServiceFabricManagedClusterResource. - public virtual ServiceFabricManagedClusterCollection GetServiceFabricManagedClusters() - { - return GetCachedClient(Client => new ServiceFabricManagedClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/ServiceFabricManagedClustersExtensions.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/ServiceFabricManagedClustersExtensions.cs index a0e90ab9a1f73..b1d8779ee0c89 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/ServiceFabricManagedClustersExtensions.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/ServiceFabricManagedClustersExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceFabricManagedClusters.Mocking; using Azure.ResourceManager.ServiceFabricManagedClusters.Models; namespace Azure.ResourceManager.ServiceFabricManagedClusters @@ -19,157 +20,129 @@ namespace Azure.ResourceManager.ServiceFabricManagedClusters /// A class to add extension methods to Azure.ResourceManager.ServiceFabricManagedClusters. public static partial class ServiceFabricManagedClustersExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableServiceFabricManagedClustersArmClient GetMockableServiceFabricManagedClustersArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableServiceFabricManagedClustersArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableServiceFabricManagedClustersResourceGroupResource GetMockableServiceFabricManagedClustersResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableServiceFabricManagedClustersResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableServiceFabricManagedClustersSubscriptionResource GetMockableServiceFabricManagedClustersSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableServiceFabricManagedClustersSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region ServiceFabricManagedApplicationTypeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricManagedApplicationTypeResource GetServiceFabricManagedApplicationTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricManagedApplicationTypeResource.ValidateResourceId(id); - return new ServiceFabricManagedApplicationTypeResource(client, id); - } - ); + return GetMockableServiceFabricManagedClustersArmClient(client).GetServiceFabricManagedApplicationTypeResource(id); } - #endregion - #region ServiceFabricManagedApplicationTypeVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricManagedApplicationTypeVersionResource GetServiceFabricManagedApplicationTypeVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricManagedApplicationTypeVersionResource.ValidateResourceId(id); - return new ServiceFabricManagedApplicationTypeVersionResource(client, id); - } - ); + return GetMockableServiceFabricManagedClustersArmClient(client).GetServiceFabricManagedApplicationTypeVersionResource(id); } - #endregion - #region ServiceFabricManagedApplicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricManagedApplicationResource GetServiceFabricManagedApplicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricManagedApplicationResource.ValidateResourceId(id); - return new ServiceFabricManagedApplicationResource(client, id); - } - ); + return GetMockableServiceFabricManagedClustersArmClient(client).GetServiceFabricManagedApplicationResource(id); } - #endregion - #region ServiceFabricManagedServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricManagedServiceResource GetServiceFabricManagedServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricManagedServiceResource.ValidateResourceId(id); - return new ServiceFabricManagedServiceResource(client, id); - } - ); + return GetMockableServiceFabricManagedClustersArmClient(client).GetServiceFabricManagedServiceResource(id); } - #endregion - #region ServiceFabricManagedClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricManagedClusterResource GetServiceFabricManagedClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricManagedClusterResource.ValidateResourceId(id); - return new ServiceFabricManagedClusterResource(client, id); - } - ); + return GetMockableServiceFabricManagedClustersArmClient(client).GetServiceFabricManagedClusterResource(id); } - #endregion - #region ServiceFabricManagedNodeTypeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceFabricManagedNodeTypeResource GetServiceFabricManagedNodeTypeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceFabricManagedNodeTypeResource.ValidateResourceId(id); - return new ServiceFabricManagedNodeTypeResource(client, id); - } - ); + return GetMockableServiceFabricManagedClustersArmClient(client).GetServiceFabricManagedNodeTypeResource(id); } - #endregion - /// Gets a collection of ServiceFabricManagedClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of ServiceFabricManagedClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ServiceFabricManagedClusterResources and their operations over a ServiceFabricManagedClusterResource. public static ServiceFabricManagedClusterCollection GetServiceFabricManagedClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetServiceFabricManagedClusters(); + return GetMockableServiceFabricManagedClustersResourceGroupResource(resourceGroupResource).GetServiceFabricManagedClusters(); } /// @@ -184,16 +157,20 @@ public static ServiceFabricManagedClusterCollection GetServiceFabricManagedClust /// ManagedClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetServiceFabricManagedClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetServiceFabricManagedClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceFabricManagedClustersResourceGroupResource(resourceGroupResource).GetServiceFabricManagedClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -208,16 +185,20 @@ public static async Task> GetServi /// ManagedClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetServiceFabricManagedCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetServiceFabricManagedClusters().Get(clusterName, cancellationToken); + return GetMockableServiceFabricManagedClustersResourceGroupResource(resourceGroupResource).GetServiceFabricManagedCluster(clusterName, cancellationToken); } /// @@ -232,13 +213,17 @@ public static Response GetServiceFabricMana /// ManagedClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServiceFabricManagedClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceFabricManagedClustersAsync(cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetServiceFabricManagedClustersAsync(cancellationToken); } /// @@ -253,13 +238,17 @@ public static AsyncPageable GetServiceFabri /// ManagedClusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetServiceFabricManagedClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetServiceFabricManagedClusters(cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetServiceFabricManagedClusters(cancellationToken); } /// @@ -274,6 +263,10 @@ public static Pageable GetServiceFabricMana /// ManagedClusterVersion_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -283,9 +276,7 @@ public static Pageable GetServiceFabricMana /// is null. public static async Task> GetManagedClusterVersionAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterVersionAsync(location, clusterVersion, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedClusterVersionAsync(location, clusterVersion, cancellationToken).ConfigureAwait(false); } /// @@ -300,6 +291,10 @@ public static async Task> GetManage /// ManagedClusterVersion_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -309,9 +304,7 @@ public static async Task> GetManage /// is null. public static Response GetManagedClusterVersion(this SubscriptionResource subscriptionResource, AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterVersion(location, clusterVersion, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedClusterVersion(location, clusterVersion, cancellationToken); } /// @@ -326,6 +319,10 @@ public static Response GetManagedClusterVers /// ManagedClusterVersion_GetByEnvironment /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -336,9 +333,7 @@ public static Response GetManagedClusterVers /// is null. public static async Task> GetManagedClusterVersionByEnvironmentAsync(this SubscriptionResource subscriptionResource, AzureLocation location, ManagedClusterVersionEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterVersionByEnvironmentAsync(location, environment, clusterVersion, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedClusterVersionByEnvironmentAsync(location, environment, clusterVersion, cancellationToken).ConfigureAwait(false); } /// @@ -353,6 +348,10 @@ public static async Task> GetManage /// ManagedClusterVersion_GetByEnvironment /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -363,9 +362,7 @@ public static async Task> GetManage /// is null. public static Response GetManagedClusterVersionByEnvironment(this SubscriptionResource subscriptionResource, AzureLocation location, ManagedClusterVersionEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(clusterVersion, nameof(clusterVersion)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterVersionByEnvironment(location, environment, clusterVersion, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedClusterVersionByEnvironment(location, environment, clusterVersion, cancellationToken); } /// @@ -380,6 +377,10 @@ public static Response GetManagedClusterVers /// ManagedClusterVersion_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -387,7 +388,7 @@ public static Response GetManagedClusterVers /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetManagedClusterVersionsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterVersionsAsync(location, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedClusterVersionsAsync(location, cancellationToken); } /// @@ -402,6 +403,10 @@ public static AsyncPageable GetManagedCluste /// ManagedClusterVersion_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -409,7 +414,7 @@ public static AsyncPageable GetManagedCluste /// A collection of that may take multiple service requests to iterate over. public static Pageable GetManagedClusterVersions(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterVersions(location, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedClusterVersions(location, cancellationToken); } /// @@ -424,6 +429,10 @@ public static Pageable GetManagedClusterVers /// ManagedClusterVersion_ListByEnvironment /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -432,7 +441,7 @@ public static Pageable GetManagedClusterVers /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetManagedClusterVersionsByEnvironmentAsync(this SubscriptionResource subscriptionResource, AzureLocation location, ManagedClusterVersionEnvironment environment, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterVersionsByEnvironmentAsync(location, environment, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedClusterVersionsByEnvironmentAsync(location, environment, cancellationToken); } /// @@ -447,6 +456,10 @@ public static AsyncPageable GetManagedCluste /// ManagedClusterVersion_ListByEnvironment /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -455,7 +468,7 @@ public static AsyncPageable GetManagedCluste /// A collection of that may take multiple service requests to iterate over. public static Pageable GetManagedClusterVersionsByEnvironment(this SubscriptionResource subscriptionResource, AzureLocation location, ManagedClusterVersionEnvironment environment, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedClusterVersionsByEnvironment(location, environment, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedClusterVersionsByEnvironment(location, environment, cancellationToken); } /// @@ -470,6 +483,10 @@ public static Pageable GetManagedClusterVers /// managedUnsupportedVMSizes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -477,7 +494,7 @@ public static Pageable GetManagedClusterVers /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetManagedUnsupportedVmSizesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedUnsupportedVmSizesAsync(location, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedUnsupportedVmSizesAsync(location, cancellationToken); } /// @@ -492,6 +509,10 @@ public static AsyncPageable GetManagedUns /// managedUnsupportedVMSizes_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -499,7 +520,7 @@ public static AsyncPageable GetManagedUns /// A collection of that may take multiple service requests to iterate over. public static Pageable GetManagedUnsupportedVmSizes(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedUnsupportedVmSizes(location, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedUnsupportedVmSizes(location, cancellationToken); } /// @@ -514,6 +535,10 @@ public static Pageable GetManagedUnsuppor /// managedUnsupportedVMSizes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -523,9 +548,7 @@ public static Pageable GetManagedUnsuppor /// is null. public static async Task> GetManagedUnsupportedVmSizeAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string vmSize, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vmSize, nameof(vmSize)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedUnsupportedVmSizeAsync(location, vmSize, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedUnsupportedVmSizeAsync(location, vmSize, cancellationToken).ConfigureAwait(false); } /// @@ -540,6 +563,10 @@ public static async Task> GetMan /// managedUnsupportedVMSizes_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location for the cluster code versions. This is different from cluster location. @@ -549,9 +576,7 @@ public static async Task> GetMan /// is null. public static Response GetManagedUnsupportedVmSize(this SubscriptionResource subscriptionResource, AzureLocation location, string vmSize, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(vmSize, nameof(vmSize)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedUnsupportedVmSize(location, vmSize, cancellationToken); + return GetMockableServiceFabricManagedClustersSubscriptionResource(subscriptionResource).GetManagedUnsupportedVmSize(location, vmSize, cancellationToken); } } } diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 16abc5487daba..0000000000000 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,429 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.ServiceFabricManagedClusters.Models; - -namespace Azure.ResourceManager.ServiceFabricManagedClusters -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _serviceFabricManagedClusterManagedClustersClientDiagnostics; - private ManagedClustersRestOperations _serviceFabricManagedClusterManagedClustersRestClient; - private ClientDiagnostics _managedClusterVersionClientDiagnostics; - private ManagedClusterVersionRestOperations _managedClusterVersionRestClient; - private ClientDiagnostics _managedUnsupportedVmSizesClientDiagnostics; - private ManagedUnsupportedVMSizesRestOperations _managedUnsupportedVmSizesRestClient; - - /// 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 ServiceFabricManagedClusterManagedClustersClientDiagnostics => _serviceFabricManagedClusterManagedClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabricManagedClusters", ServiceFabricManagedClusterResource.ResourceType.Namespace, Diagnostics); - private ManagedClustersRestOperations ServiceFabricManagedClusterManagedClustersRestClient => _serviceFabricManagedClusterManagedClustersRestClient ??= new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ServiceFabricManagedClusterResource.ResourceType)); - private ClientDiagnostics ManagedClusterVersionClientDiagnostics => _managedClusterVersionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabricManagedClusters", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ManagedClusterVersionRestOperations ManagedClusterVersionRestClient => _managedClusterVersionRestClient ??= new ManagedClusterVersionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics managedUnsupportedVMSizesClientDiagnostics => _managedUnsupportedVmSizesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceFabricManagedClusters", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ManagedUnsupportedVMSizesRestOperations managedUnsupportedVMSizesRestClient => _managedUnsupportedVmSizesRestClient ??= new ManagedUnsupportedVMSizesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets all Service Fabric cluster resources created or in the process of being created in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters - /// - /// - /// Operation Id - /// ManagedClusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetServiceFabricManagedClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceFabricManagedClusterManagedClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceFabricManagedClusterManagedClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ServiceFabricManagedClusterResource(Client, ServiceFabricManagedClusterData.DeserializeServiceFabricManagedClusterData(e)), ServiceFabricManagedClusterManagedClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServiceFabricManagedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all Service Fabric cluster resources created or in the process of being created in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters - /// - /// - /// Operation Id - /// ManagedClusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetServiceFabricManagedClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ServiceFabricManagedClusterManagedClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ServiceFabricManagedClusterManagedClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ServiceFabricManagedClusterResource(Client, ServiceFabricManagedClusterData.DeserializeServiceFabricManagedClusterData(e)), ServiceFabricManagedClusterManagedClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetServiceFabricManagedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets information about an available Service Fabric managed cluster code version. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion} - /// - /// - /// Operation Id - /// ManagedClusterVersion_Get - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cluster code version. - /// The cancellation token to use. - public virtual async Task> GetManagedClusterVersionAsync(AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) - { - using var scope = ManagedClusterVersionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedClusterVersion"); - scope.Start(); - try - { - var response = await ManagedClusterVersionRestClient.GetAsync(Id.SubscriptionId, location, clusterVersion, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets information about an available Service Fabric managed cluster code version. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion} - /// - /// - /// Operation Id - /// ManagedClusterVersion_Get - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cluster code version. - /// The cancellation token to use. - public virtual Response GetManagedClusterVersion(AzureLocation location, string clusterVersion, CancellationToken cancellationToken = default) - { - using var scope = ManagedClusterVersionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedClusterVersion"); - scope.Start(); - try - { - var response = ManagedClusterVersionRestClient.Get(Id.SubscriptionId, location, clusterVersion, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets information about an available Service Fabric cluster code version by environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions/{clusterVersion} - /// - /// - /// Operation Id - /// ManagedClusterVersion_GetByEnvironment - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The operating system of the cluster. The default means all. - /// The cluster code version. - /// The cancellation token to use. - public virtual async Task> GetManagedClusterVersionByEnvironmentAsync(AzureLocation location, ManagedClusterVersionEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) - { - using var scope = ManagedClusterVersionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedClusterVersionByEnvironment"); - scope.Start(); - try - { - var response = await ManagedClusterVersionRestClient.GetByEnvironmentAsync(Id.SubscriptionId, location, environment, clusterVersion, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets information about an available Service Fabric cluster code version by environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions/{clusterVersion} - /// - /// - /// Operation Id - /// ManagedClusterVersion_GetByEnvironment - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The operating system of the cluster. The default means all. - /// The cluster code version. - /// The cancellation token to use. - public virtual Response GetManagedClusterVersionByEnvironment(AzureLocation location, ManagedClusterVersionEnvironment environment, string clusterVersion, CancellationToken cancellationToken = default) - { - using var scope = ManagedClusterVersionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedClusterVersionByEnvironment"); - scope.Start(); - try - { - var response = ManagedClusterVersionRestClient.GetByEnvironment(Id.SubscriptionId, location, environment, clusterVersion, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets all available code versions for Service Fabric cluster resources by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions - /// - /// - /// Operation Id - /// ManagedClusterVersion_List - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedClusterVersionsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterVersionRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ServiceFabricManagedClusterVersion.DeserializeServiceFabricManagedClusterVersion, ManagedClusterVersionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterVersions", "", null, cancellationToken); - } - - /// - /// Gets all available code versions for Service Fabric cluster resources by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions - /// - /// - /// Operation Id - /// ManagedClusterVersion_List - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedClusterVersions(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterVersionRestClient.CreateListRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ServiceFabricManagedClusterVersion.DeserializeServiceFabricManagedClusterVersion, ManagedClusterVersionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterVersions", "", null, cancellationToken); - } - - /// - /// Gets all available code versions for Service Fabric cluster resources by environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions - /// - /// - /// Operation Id - /// ManagedClusterVersion_ListByEnvironment - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The operating system of the cluster. The default means all. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedClusterVersionsByEnvironmentAsync(AzureLocation location, ManagedClusterVersionEnvironment environment, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterVersionRestClient.CreateListByEnvironmentRequest(Id.SubscriptionId, location, environment); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, ServiceFabricManagedClusterVersion.DeserializeServiceFabricManagedClusterVersion, ManagedClusterVersionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterVersionsByEnvironment", "", null, cancellationToken); - } - - /// - /// Gets all available code versions for Service Fabric cluster resources by environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions - /// - /// - /// Operation Id - /// ManagedClusterVersion_ListByEnvironment - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The operating system of the cluster. The default means all. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedClusterVersionsByEnvironment(AzureLocation location, ManagedClusterVersionEnvironment environment, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedClusterVersionRestClient.CreateListByEnvironmentRequest(Id.SubscriptionId, location, environment); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, ServiceFabricManagedClusterVersion.DeserializeServiceFabricManagedClusterVersion, ManagedClusterVersionClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedClusterVersionsByEnvironment", "", null, cancellationToken); - } - - /// - /// Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes - /// - /// - /// Operation Id - /// managedUnsupportedVMSizes_List - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedUnsupportedVmSizesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => managedUnsupportedVMSizesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => managedUnsupportedVMSizesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ServiceFabricManagedUnsupportedVmSize.DeserializeServiceFabricManagedUnsupportedVmSize, managedUnsupportedVMSizesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedUnsupportedVmSizes", "value", "nextLink", cancellationToken); - } - - /// - /// Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes - /// - /// - /// Operation Id - /// managedUnsupportedVMSizes_List - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedUnsupportedVmSizes(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => managedUnsupportedVMSizesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => managedUnsupportedVMSizesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ServiceFabricManagedUnsupportedVmSize.DeserializeServiceFabricManagedUnsupportedVmSize, managedUnsupportedVMSizesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedUnsupportedVmSizes", "value", "nextLink", cancellationToken); - } - - /// - /// Get unsupported vm size for Service Fabric Managed Clusters. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize} - /// - /// - /// Operation Id - /// managedUnsupportedVMSizes_Get - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// VM Size name. - /// The cancellation token to use. - public virtual async Task> GetManagedUnsupportedVmSizeAsync(AzureLocation location, string vmSize, CancellationToken cancellationToken = default) - { - using var scope = managedUnsupportedVMSizesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedUnsupportedVmSize"); - scope.Start(); - try - { - var response = await managedUnsupportedVMSizesRestClient.GetAsync(Id.SubscriptionId, location, vmSize, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get unsupported vm size for Service Fabric Managed Clusters. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize} - /// - /// - /// Operation Id - /// managedUnsupportedVMSizes_Get - /// - /// - /// - /// The location for the cluster code versions. This is different from cluster location. - /// VM Size name. - /// The cancellation token to use. - public virtual Response GetManagedUnsupportedVmSize(AzureLocation location, string vmSize, CancellationToken cancellationToken = default) - { - using var scope = managedUnsupportedVMSizesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetManagedUnsupportedVmSize"); - scope.Start(); - try - { - var response = managedUnsupportedVMSizesRestClient.Get(Id.SubscriptionId, location, vmSize, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationResource.cs index de84ce3b3da23..4f22875acc046 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ServiceFabricManagedClusters public partial class ServiceFabricManagedApplicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceFabricManagedServiceResources and their operations over a ServiceFabricManagedServiceResource. public virtual ServiceFabricManagedServiceCollection GetServiceFabricManagedServices() { - return GetCachedClient(Client => new ServiceFabricManagedServiceCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricManagedServiceCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual ServiceFabricManagedServiceCollection GetServiceFabricManagedServ /// /// The name of the service resource in the format of {applicationName}~{serviceName}. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricManagedServiceAsync(string serviceName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetServ /// /// The name of the service resource in the format of {applicationName}~{serviceName}. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricManagedService(string serviceName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeResource.cs index a04764e44fea5..3d830b57c69a3 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ServiceFabricManagedClusters public partial class ServiceFabricManagedApplicationTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceFabricManagedApplicationTypeVersionResources and their operations over a ServiceFabricManagedApplicationTypeVersionResource. public virtual ServiceFabricManagedApplicationTypeVersionCollection GetServiceFabricManagedApplicationTypeVersions() { - return GetCachedClient(Client => new ServiceFabricManagedApplicationTypeVersionCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricManagedApplicationTypeVersionCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual ServiceFabricManagedApplicationTypeVersionCollection GetServiceFa /// /// The application type version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricManagedApplicationTypeVersionAsync(string version, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task /// The application type version. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricManagedApplicationTypeVersion(string version, CancellationToken cancellationToken = default) { diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeVersionResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeVersionResource.cs index 84c39a5ffcc9d..e74977e84905f 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeVersionResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeVersionResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.ServiceFabricManagedClusters public partial class ServiceFabricManagedApplicationTypeVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationTypeName. + /// The version. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationTypeName, string version) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"; diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterResource.cs index 68004e3871cb9..c1626db52f457 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ServiceFabricManagedClusters public partial class ServiceFabricManagedClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}"; @@ -97,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ServiceFabricManagedApplicationTypeResources and their operations over a ServiceFabricManagedApplicationTypeResource. public virtual ServiceFabricManagedApplicationTypeCollection GetServiceFabricManagedApplicationTypes() { - return GetCachedClient(Client => new ServiceFabricManagedApplicationTypeCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricManagedApplicationTypeCollection(client, Id)); } /// @@ -115,8 +118,8 @@ public virtual ServiceFabricManagedApplicationTypeCollection GetServiceFabricMan /// /// The name of the application type name resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricManagedApplicationTypeAsync(string applicationTypeName, CancellationToken cancellationToken = default) { @@ -138,8 +141,8 @@ public virtual async Task> /// /// The name of the application type name resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricManagedApplicationType(string applicationTypeName, CancellationToken cancellationToken = default) { @@ -150,7 +153,7 @@ public virtual Response GetServiceF /// An object representing collection of ServiceFabricManagedApplicationResources and their operations over a ServiceFabricManagedApplicationResource. public virtual ServiceFabricManagedApplicationCollection GetServiceFabricManagedApplications() { - return GetCachedClient(Client => new ServiceFabricManagedApplicationCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricManagedApplicationCollection(client, Id)); } /// @@ -168,8 +171,8 @@ public virtual ServiceFabricManagedApplicationCollection GetServiceFabricManaged /// /// The name of the application resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricManagedApplicationAsync(string applicationName, CancellationToken cancellationToken = default) { @@ -191,8 +194,8 @@ public virtual async Task> Get /// /// The name of the application resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricManagedApplication(string applicationName, CancellationToken cancellationToken = default) { @@ -203,7 +206,7 @@ public virtual Response GetServiceFabri /// An object representing collection of ServiceFabricManagedNodeTypeResources and their operations over a ServiceFabricManagedNodeTypeResource. public virtual ServiceFabricManagedNodeTypeCollection GetServiceFabricManagedNodeTypes() { - return GetCachedClient(Client => new ServiceFabricManagedNodeTypeCollection(Client, Id)); + return GetCachedClient(client => new ServiceFabricManagedNodeTypeCollection(client, Id)); } /// @@ -221,8 +224,8 @@ public virtual ServiceFabricManagedNodeTypeCollection GetServiceFabricManagedNod /// /// The name of the node type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceFabricManagedNodeTypeAsync(string nodeTypeName, CancellationToken cancellationToken = default) { @@ -244,8 +247,8 @@ public virtual async Task> GetSer /// /// The name of the node type. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceFabricManagedNodeType(string nodeTypeName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedNodeTypeResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedNodeTypeResource.cs index d2c1586c5d082..89d503f0b478b 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedNodeTypeResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedNodeTypeResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.ServiceFabricManagedClusters public partial class ServiceFabricManagedNodeTypeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The nodeTypeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string nodeTypeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}"; diff --git a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedServiceResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedServiceResource.cs index ec7dac6a877f0..9592e5289c408 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedServiceResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedServiceResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.ServiceFabricManagedClusters public partial class ServiceFabricManagedServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The applicationName. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string applicationName, string serviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}"; diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/api/Azure.ResourceManager.ServiceLinker.netstandard2.0.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/api/Azure.ResourceManager.ServiceLinker.netstandard2.0.cs index ff4d5fd3c4d4c..15d3891959c6f 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/api/Azure.ResourceManager.ServiceLinker.netstandard2.0.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/api/Azure.ResourceManager.ServiceLinker.netstandard2.0.cs @@ -57,6 +57,24 @@ public static partial class ServiceLinkerExtensions public static Azure.ResourceManager.ServiceLinker.LinkerResourceCollection GetLinkerResources(this Azure.ResourceManager.ArmResource armResource) { throw null; } } } +namespace Azure.ResourceManager.ServiceLinker.Mocking +{ + public partial class MockableServiceLinkerArmClient : Azure.ResourceManager.ArmResource + { + protected MockableServiceLinkerArmClient() { } + public virtual Azure.ResourceManager.ServiceLinker.LinkerResource GetLinkerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.Response GetLinkerResource(Azure.Core.ResourceIdentifier scope, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLinkerResourceAsync(Azure.Core.ResourceIdentifier scope, string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ServiceLinker.LinkerResourceCollection GetLinkerResources(Azure.Core.ResourceIdentifier scope) { throw null; } + } + public partial class MockableServiceLinkerArmResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceLinkerArmResource() { } + public virtual Azure.Response GetLinkerResource(string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetLinkerResourceAsync(string linkerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ServiceLinker.LinkerResourceCollection GetLinkerResources() { throw null; } + } +} namespace Azure.ResourceManager.ServiceLinker.Models { public static partial class ArmServiceLinkerModelFactory diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 940967455699b..0000000000000 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ArmResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ServiceLinker -{ - /// A class to add extension methods to ArmResource. - internal partial class ArmResourceExtensionClient : ArmResource - { - /// Initializes a new instance of the class for mocking. - protected ArmResourceExtensionClient() - { - } - - /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of LinkerResources in the ArmResource. - /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public virtual LinkerResourceCollection GetLinkerResources() - { - return GetCachedClient(Client => new LinkerResourceCollection(Client, Id)); - } - } -} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs new file mode 100644 index 0000000000000..659900e2dda28 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs @@ -0,0 +1,111 @@ +// 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.ServiceLinker; + +namespace Azure.ResourceManager.ServiceLinker.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableServiceLinkerArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceLinkerArmClient() + { + } + + /// 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 MockableServiceLinkerArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableServiceLinkerArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LinkerResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of LinkerResources and their operations over a LinkerResource. + public virtual LinkerResourceCollection GetLinkerResources(ResourceIdentifier scope) + { + return new LinkerResourceCollection(Client, scope); + } + + /// + /// Returns Linker resource for a given name. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} + /// + /// + /// Operation Id + /// Linker_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name Linker resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLinkerResourceAsync(ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + { + return await GetLinkerResources(scope).GetAsync(linkerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns Linker resource for a given name. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} + /// + /// + /// Operation Id + /// Linker_Get + /// + /// + /// + /// The scope that the resource will apply against. + /// The name Linker resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLinkerResource(ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + { + return GetLinkerResources(scope).Get(linkerName, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LinkerResource GetLinkerResource(ResourceIdentifier id) + { + LinkerResource.ValidateResourceId(id); + return new LinkerResource(Client, id); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs new file mode 100644 index 0000000000000..329fcb51f95d2 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs @@ -0,0 +1,92 @@ +// 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.ServiceLinker; + +namespace Azure.ResourceManager.ServiceLinker.Mocking +{ + /// A class to add extension methods to ArmResource. + public partial class MockableServiceLinkerArmResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceLinkerArmResource() + { + } + + /// 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 MockableServiceLinkerArmResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LinkerResources in the ArmResource. + /// An object representing collection of LinkerResources and their operations over a LinkerResource. + public virtual LinkerResourceCollection GetLinkerResources() + { + return GetCachedClient(client => new LinkerResourceCollection(client, Id)); + } + + /// + /// Returns Linker resource for a given name. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} + /// + /// + /// Operation Id + /// Linker_Get + /// + /// + /// + /// The name Linker resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLinkerResourceAsync(string linkerName, CancellationToken cancellationToken = default) + { + return await GetLinkerResources().GetAsync(linkerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns Linker resource for a given name. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName} + /// + /// + /// Operation Id + /// Linker_Get + /// + /// + /// + /// The name Linker resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLinkerResource(string linkerName, CancellationToken cancellationToken = default) + { + return GetLinkerResources().Get(linkerName, cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs index f1a3409e3a646..fda809c116956 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs @@ -11,61 +11,36 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker.Mocking; namespace Azure.ResourceManager.ServiceLinker { /// A class to add extension methods to Azure.ResourceManager.ServiceLinker. public static partial class ServiceLinkerExtensions { - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmResource resource) + private static MockableServiceLinkerArmClient GetMockableServiceLinkerArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ArmResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableServiceLinkerArmClient(client0)); } - private static ArmResourceExtensionClient GetArmResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableServiceLinkerArmResource GetMockableServiceLinkerArmResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ArmResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableServiceLinkerArmResource(client, resource.Id)); } - #region LinkerResource + /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets a collection of LinkerResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static LinkerResource GetLinkerResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - LinkerResource.ValidateResourceId(id); - return new LinkerResource(client, id); - } - ); - } - #endregion - - /// Gets a collection of LinkerResources in the ArmResource. - /// The instance the method will execute against. - /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public static LinkerResourceCollection GetLinkerResources(this ArmResource armResource) - { - return GetArmResourceExtensionClient(armResource).GetLinkerResources(); - } - - /// Gets a collection of LinkerResources in the ArmResource. - /// The instance the method will execute against. /// The scope that the resource will apply against. /// An object representing collection of LinkerResources and their operations over a LinkerResource. public static LinkerResourceCollection GetLinkerResources(this ArmClient client, ResourceIdentifier scope) { - return GetArmResourceExtensionClient(client, scope).GetLinkerResources(); + return GetMockableServiceLinkerArmClient(client).GetLinkerResources(scope); } /// @@ -80,16 +55,21 @@ public static LinkerResourceCollection GetLinkerResources(this ArmClient client, /// Linker_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// - /// The instance the method will execute against. + /// The instance the method will execute against. + /// The scope that the resource will apply against. /// The name Linker resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetLinkerResourceAsync(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) + public static async Task> GetLinkerResourceAsync(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) { - return await armResource.GetLinkerResources().GetAsync(linkerName, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceLinkerArmClient(client).GetLinkerResourceAsync(scope, linkerName, cancellationToken).ConfigureAwait(false); } /// @@ -104,17 +84,51 @@ public static async Task> GetLinkerResourceAsync(this A /// Linker_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// The name Linker resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetLinkerResourceAsync(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + public static Response GetLinkerResource(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) { - return await client.GetLinkerResources(scope).GetAsync(linkerName, cancellationToken).ConfigureAwait(false); + return GetMockableServiceLinkerArmClient(client).GetLinkerResource(scope, linkerName, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static LinkerResource GetLinkerResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableServiceLinkerArmClient(client).GetLinkerResource(id); + } + + /// + /// Gets a collection of LinkerResources in the ArmResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// An object representing collection of LinkerResources and their operations over a LinkerResource. + public static LinkerResourceCollection GetLinkerResources(this ArmResource armResource) + { + return GetMockableServiceLinkerArmResource(armResource).GetLinkerResources(); } /// @@ -129,16 +143,20 @@ public static async Task> GetLinkerResourceAsync(this A /// Linker_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name Linker resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetLinkerResource(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) + public static async Task> GetLinkerResourceAsync(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) { - return armResource.GetLinkerResources().Get(linkerName, cancellationToken); + return await GetMockableServiceLinkerArmResource(armResource).GetLinkerResourceAsync(linkerName, cancellationToken).ConfigureAwait(false); } /// @@ -153,17 +171,20 @@ public static Response GetLinkerResource(this ArmResource armRes /// Linker_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// - /// The instance the method will execute against. - /// The scope that the resource will apply against. + /// The instance the method will execute against. /// The name Linker resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetLinkerResource(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + public static Response GetLinkerResource(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) { - return client.GetLinkerResources(scope).Get(linkerName, cancellationToken); + return GetMockableServiceLinkerArmResource(armResource).GetLinkerResource(linkerName, cancellationToken); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs index 7eea8b5c8aceb..5e9b485839753 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.ServiceLinker public partial class LinkerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The linkerName. public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string linkerName) { var resourceId = $"{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}"; diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/CHANGELOG.md b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/CHANGELOG.md index 939be93b15e24..34bfd79f8ea79 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/CHANGELOG.md +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.1.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,13 @@ ### Other Changes +## 1.0.0 (2023-11-01) + +### Features Added + +- Perform CRUD Operations for Application Gateway for Containers (AGC). +- Use the latest API version for (2023-11-01) + ## 1.0.0-beta.2 (2023-05-31) ### Features Added diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/README.md b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/README.md index 707361a8e9df9..a45004793d6e3 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/README.md +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/README.md @@ -19,7 +19,7 @@ This library follows the [new Azure SDK guidelines](https://azure.github.io/azur Install the Microsoft Azure ServiceNetworking management library for .NET with [NuGet](https://www.nuget.org/): ```dotnetcli -dotnet add package Azure.ResourceManager.ServiceNetworking --prerelease +dotnet add package Azure.ResourceManager.ServiceNetworking ``` ### Prerequisites diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/api/Azure.ResourceManager.ServiceNetworking.netstandard2.0.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/api/Azure.ResourceManager.ServiceNetworking.netstandard2.0.cs index 1eccc4c88ed18..f47c18d809b63 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/api/Azure.ResourceManager.ServiceNetworking.netstandard2.0.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/api/Azure.ResourceManager.ServiceNetworking.netstandard2.0.cs @@ -19,7 +19,7 @@ protected AssociationCollection() { } } public partial class AssociationData : Azure.ResourceManager.Models.TrackedResourceData { - public AssociationData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AssociationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.ServiceNetworking.Models.AssociationType? AssociationType { get { throw null; } set { } } public Azure.ResourceManager.ServiceNetworking.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } @@ -63,7 +63,7 @@ protected FrontendCollection() { } } public partial class FrontendData : Azure.ResourceManager.Models.TrackedResourceData { - public FrontendData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public FrontendData(Azure.Core.AzureLocation location) { } public string Fqdn { get { throw null; } } public Azure.ResourceManager.ServiceNetworking.Models.ProvisioningState? ProvisioningState { get { throw null; } } } @@ -117,7 +117,7 @@ protected TrafficControllerCollection() { } } public partial class TrafficControllerData : Azure.ResourceManager.Models.TrackedResourceData { - public TrafficControllerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public TrafficControllerData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList Associations { get { throw null; } } public System.Collections.Generic.IReadOnlyList ConfigurationEndpoints { get { throw null; } } public System.Collections.Generic.IReadOnlyList Frontends { get { throw null; } } @@ -150,6 +150,29 @@ protected TrafficControllerResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.ServiceNetworking.Models.TrafficControllerPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.ServiceNetworking.Mocking +{ + public partial class MockableServiceNetworkingArmClient : Azure.ResourceManager.ArmResource + { + protected MockableServiceNetworkingArmClient() { } + public virtual Azure.ResourceManager.ServiceNetworking.AssociationResource GetAssociationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceNetworking.FrontendResource GetFrontendResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ServiceNetworking.TrafficControllerResource GetTrafficControllerResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableServiceNetworkingResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceNetworkingResourceGroupResource() { } + public virtual Azure.Response GetTrafficController(string trafficControllerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTrafficControllerAsync(string trafficControllerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ServiceNetworking.TrafficControllerCollection GetTrafficControllers() { throw null; } + } + public partial class MockableServiceNetworkingSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableServiceNetworkingSubscriptionResource() { } + public virtual Azure.Pageable GetTrafficControllers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTrafficControllersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.ServiceNetworking.Models { public static partial class ArmServiceNetworkingModelFactory diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationCollection.cs index 85868b9972f84..d473595f35720 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_AssociationCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAssociations() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationsGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationsGet.json // this example is just showing the usage of "AssociationsInterface_ListByTrafficController" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task GetAll_GetAssociations() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAssociation() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationGet.json // this example is just showing the usage of "AssociationsInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task Get_GetAssociation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAssociation() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationGet.json // this example is just showing the usage of "AssociationsInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +126,7 @@ public async Task Exists_GetAssociation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAssociation() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationGet.json // this example is just showing the usage of "AssociationsInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +169,7 @@ public async Task GetIfExists_GetAssociation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PutAssociation() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationPut.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationPut.json // this example is just showing the usage of "AssociationsInterface_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationResource.cs index 78edc5495dc43..38d8976535e5a 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_AssociationResource.cs @@ -23,7 +23,7 @@ public partial class Sample_AssociationResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAssociation() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationGet.json // this example is just showing the usage of "AssociationsInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Get_GetAssociation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateAssociation() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationPatch.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationPatch.json // this example is just showing the usage of "AssociationsInterface_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,7 +92,7 @@ public async Task Update_UpdateAssociation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAssociation() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/AssociationDelete.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/AssociationDelete.json // this example is just showing the usage of "AssociationsInterface_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendCollection.cs index 3fc1969baf864..a93a4dd3a42d4 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_FrontendCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetFrontends() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendsGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendsGet.json // this example is just showing the usage of "FrontendsInterface_ListByTrafficController" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,7 +59,7 @@ public async Task GetAll_GetFrontends() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetFrontend() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendGet.json // this example is just showing the usage of "FrontendsInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -94,7 +94,7 @@ public async Task Get_GetFrontend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetFrontend() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendGet.json // this example is just showing the usage of "FrontendsInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Exists_GetFrontend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetFrontend() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendGet.json // this example is just showing the usage of "FrontendsInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +168,7 @@ public async Task GetIfExists_GetFrontend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PutFrontend() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendPut.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendPut.json // this example is just showing the usage of "FrontendsInterface_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendResource.cs index bcdad3c92d0b7..52b0149ce3a29 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_FrontendResource.cs @@ -23,7 +23,7 @@ public partial class Sample_FrontendResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetFrontend() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendGet.json // this example is just showing the usage of "FrontendsInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Get_GetFrontend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateFrontend() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendPatch.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendPatch.json // this example is just showing the usage of "FrontendsInterface_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task Update_UpdateFrontend() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteFrontend() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/FrontendDelete.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/FrontendDelete.json // this example is just showing the usage of "FrontendsInterface_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs index d0878d03f999b..a91f6048f8848 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_TrafficControllerCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetTrafficControllers() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllersGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllersGet.json // this example is just showing the usage of "TrafficControllerInterface_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,7 +59,7 @@ public async Task GetAll_GetTrafficControllers() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetTrafficController() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerGet.json // this example is just showing the usage of "TrafficControllerInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task Get_GetTrafficController() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetTrafficController() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerGet.json // this example is just showing the usage of "TrafficControllerInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -123,7 +123,7 @@ public async Task Exists_GetTrafficController() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetTrafficController() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerGet.json // this example is just showing the usage of "TrafficControllerInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -165,7 +165,7 @@ public async Task GetIfExists_GetTrafficController() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PutTrafficController() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerPut.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerPut.json // this example is just showing the usage of "TrafficControllerInterface_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerResource.cs index 085afe327a95b..f9c3cd5a4e10a 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/samples/Generated/Samples/Sample_TrafficControllerResource.cs @@ -24,7 +24,7 @@ public partial class Sample_TrafficControllerResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetTrafficControllers_GetTrafficControllersList() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllersGetList.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllersGetList.json // this example is just showing the usage of "TrafficControllerInterface_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetTrafficControllers_GetTrafficControllersList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetTrafficController() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerGet.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerGet.json // this example is just showing the usage of "TrafficControllerInterface_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -87,7 +87,7 @@ public async Task Get_GetTrafficController() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PatchTrafficController() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerPatch.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerPatch.json // this example is just showing the usage of "TrafficControllerInterface_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Update_PatchTrafficController() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteTrafficController() { - // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/cadl/examples/TrafficControllerDelete.json + // Generated from example definition: specification/servicenetworking/resource-manager/Microsoft.ServiceNetworking/stable/2023-11-01/examples/TrafficControllerDelete.json // this example is just showing the usage of "TrafficControllerInterface_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Azure.ResourceManager.ServiceNetworking.csproj b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Azure.ResourceManager.ServiceNetworking.csproj index 39f1f479a9e9f..7ef27db62177c 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Azure.ResourceManager.ServiceNetworking.csproj +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Azure.ResourceManager.ServiceNetworking.csproj @@ -1,6 +1,8 @@ - 1.0.0-beta.3 + 1.1.0-beta.1 + + 1.0.0 Azure.ResourceManager.ServiceNetworking Azure Resource Manager client SDK for Azure resource provider ServiceNetworking. azure;management;arm;resource manager;servicenetworking diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/AssociationResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/AssociationResource.cs index 6f8843fe4d74c..857f3b02ff3b0 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/AssociationResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/AssociationResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ServiceNetworking public partial class AssociationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The trafficControllerName. + /// The associationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string trafficControllerName, string associationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}"; diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingArmClient.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingArmClient.cs new file mode 100644 index 0000000000000..255c0e0eb687f --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceNetworking; + +namespace Azure.ResourceManager.ServiceNetworking.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableServiceNetworkingArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceNetworkingArmClient() + { + } + + /// 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 MockableServiceNetworkingArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableServiceNetworkingArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TrafficControllerResource GetTrafficControllerResource(ResourceIdentifier id) + { + TrafficControllerResource.ValidateResourceId(id); + return new TrafficControllerResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AssociationResource GetAssociationResource(ResourceIdentifier id) + { + AssociationResource.ValidateResourceId(id); + return new AssociationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FrontendResource GetFrontendResource(ResourceIdentifier id) + { + FrontendResource.ValidateResourceId(id); + return new FrontendResource(Client, id); + } + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingResourceGroupResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingResourceGroupResource.cs new file mode 100644 index 0000000000000..8ace95a8f03f6 --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.ServiceNetworking; + +namespace Azure.ResourceManager.ServiceNetworking.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableServiceNetworkingResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceNetworkingResourceGroupResource() + { + } + + /// 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 MockableServiceNetworkingResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of TrafficControllerResources in the ResourceGroupResource. + /// An object representing collection of TrafficControllerResources and their operations over a TrafficControllerResource. + public virtual TrafficControllerCollection GetTrafficControllers() + { + return GetCachedClient(client => new TrafficControllerCollection(client, Id)); + } + + /// + /// Get a TrafficController + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName} + /// + /// + /// Operation Id + /// TrafficControllerInterface_Get + /// + /// + /// + /// traffic controller name for path. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTrafficControllerAsync(string trafficControllerName, CancellationToken cancellationToken = default) + { + return await GetTrafficControllers().GetAsync(trafficControllerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a TrafficController + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName} + /// + /// + /// Operation Id + /// TrafficControllerInterface_Get + /// + /// + /// + /// traffic controller name for path. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTrafficController(string trafficControllerName, CancellationToken cancellationToken = default) + { + return GetTrafficControllers().Get(trafficControllerName, cancellationToken); + } + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingSubscriptionResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingSubscriptionResource.cs new file mode 100644 index 0000000000000..f6cb174ec359c --- /dev/null +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/MockableServiceNetworkingSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceNetworking; + +namespace Azure.ResourceManager.ServiceNetworking.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableServiceNetworkingSubscriptionResource : ArmResource + { + private ClientDiagnostics _trafficControllerTrafficControllerInterfaceClientDiagnostics; + private TrafficControllerInterfaceRestOperations _trafficControllerTrafficControllerInterfaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableServiceNetworkingSubscriptionResource() + { + } + + /// 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 MockableServiceNetworkingSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics TrafficControllerTrafficControllerInterfaceClientDiagnostics => _trafficControllerTrafficControllerInterfaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceNetworking", TrafficControllerResource.ResourceType.Namespace, Diagnostics); + private TrafficControllerInterfaceRestOperations TrafficControllerTrafficControllerInterfaceRestClient => _trafficControllerTrafficControllerInterfaceRestClient ??= new TrafficControllerInterfaceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TrafficControllerResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List TrafficController resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers + /// + /// + /// Operation Id + /// TrafficControllerInterface_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetTrafficControllersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TrafficControllerTrafficControllerInterfaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrafficControllerTrafficControllerInterfaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TrafficControllerResource(Client, TrafficControllerData.DeserializeTrafficControllerData(e)), TrafficControllerTrafficControllerInterfaceClientDiagnostics, Pipeline, "MockableServiceNetworkingSubscriptionResource.GetTrafficControllers", "value", "nextLink", cancellationToken); + } + + /// + /// List TrafficController resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers + /// + /// + /// Operation Id + /// TrafficControllerInterface_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetTrafficControllers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TrafficControllerTrafficControllerInterfaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrafficControllerTrafficControllerInterfaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TrafficControllerResource(Client, TrafficControllerData.DeserializeTrafficControllerData(e)), TrafficControllerTrafficControllerInterfaceClientDiagnostics, Pipeline, "MockableServiceNetworkingSubscriptionResource.GetTrafficControllers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 20b630f516e4c..0000000000000 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ServiceNetworking -{ - /// 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 TrafficControllerResources in the ResourceGroupResource. - /// An object representing collection of TrafficControllerResources and their operations over a TrafficControllerResource. - public virtual TrafficControllerCollection GetTrafficControllers() - { - return GetCachedClient(Client => new TrafficControllerCollection(Client, Id)); - } - } -} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ServiceNetworkingExtensions.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ServiceNetworkingExtensions.cs index a15715cccf4d8..c3ea9e69c9c2a 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ServiceNetworkingExtensions.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/ServiceNetworkingExtensions.cs @@ -12,106 +12,88 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceNetworking.Mocking; namespace Azure.ResourceManager.ServiceNetworking { /// A class to add extension methods to Azure.ResourceManager.ServiceNetworking. public static partial class ServiceNetworkingExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableServiceNetworkingArmClient GetMockableServiceNetworkingArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableServiceNetworkingArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableServiceNetworkingResourceGroupResource GetMockableServiceNetworkingResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableServiceNetworkingResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableServiceNetworkingSubscriptionResource GetMockableServiceNetworkingSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableServiceNetworkingSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region TrafficControllerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TrafficControllerResource GetTrafficControllerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TrafficControllerResource.ValidateResourceId(id); - return new TrafficControllerResource(client, id); - } - ); + return GetMockableServiceNetworkingArmClient(client).GetTrafficControllerResource(id); } - #endregion - #region AssociationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AssociationResource GetAssociationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AssociationResource.ValidateResourceId(id); - return new AssociationResource(client, id); - } - ); + return GetMockableServiceNetworkingArmClient(client).GetAssociationResource(id); } - #endregion - #region FrontendResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FrontendResource GetFrontendResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FrontendResource.ValidateResourceId(id); - return new FrontendResource(client, id); - } - ); + return GetMockableServiceNetworkingArmClient(client).GetFrontendResource(id); } - #endregion - /// Gets a collection of TrafficControllerResources in the ResourceGroupResource. + /// + /// Gets a collection of TrafficControllerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TrafficControllerResources and their operations over a TrafficControllerResource. public static TrafficControllerCollection GetTrafficControllers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetTrafficControllers(); + return GetMockableServiceNetworkingResourceGroupResource(resourceGroupResource).GetTrafficControllers(); } /// @@ -126,16 +108,20 @@ public static TrafficControllerCollection GetTrafficControllers(this ResourceGro /// TrafficControllerInterface_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// traffic controller name for path. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTrafficControllerAsync(this ResourceGroupResource resourceGroupResource, string trafficControllerName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetTrafficControllers().GetAsync(trafficControllerName, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceNetworkingResourceGroupResource(resourceGroupResource).GetTrafficControllerAsync(trafficControllerName, cancellationToken).ConfigureAwait(false); } /// @@ -150,16 +136,20 @@ public static async Task> GetTrafficControll /// TrafficControllerInterface_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// traffic controller name for path. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTrafficController(this ResourceGroupResource resourceGroupResource, string trafficControllerName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetTrafficControllers().Get(trafficControllerName, cancellationToken); + return GetMockableServiceNetworkingResourceGroupResource(resourceGroupResource).GetTrafficController(trafficControllerName, cancellationToken); } /// @@ -174,13 +164,17 @@ public static Response GetTrafficController(this Reso /// TrafficControllerInterface_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetTrafficControllersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTrafficControllersAsync(cancellationToken); + return GetMockableServiceNetworkingSubscriptionResource(subscriptionResource).GetTrafficControllersAsync(cancellationToken); } /// @@ -195,13 +189,17 @@ public static AsyncPageable GetTrafficControllersAsyn /// TrafficControllerInterface_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetTrafficControllers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTrafficControllers(cancellationToken); + return GetMockableServiceNetworkingSubscriptionResource(subscriptionResource).GetTrafficControllers(cancellationToken); } } } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 46fbf10fb19d7..0000000000000 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.ServiceNetworking -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _trafficControllerTrafficControllerInterfaceClientDiagnostics; - private TrafficControllerInterfaceRestOperations _trafficControllerTrafficControllerInterfaceRestClient; - - /// 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 TrafficControllerTrafficControllerInterfaceClientDiagnostics => _trafficControllerTrafficControllerInterfaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceNetworking", TrafficControllerResource.ResourceType.Namespace, Diagnostics); - private TrafficControllerInterfaceRestOperations TrafficControllerTrafficControllerInterfaceRestClient => _trafficControllerTrafficControllerInterfaceRestClient ??= new TrafficControllerInterfaceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TrafficControllerResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List TrafficController resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers - /// - /// - /// Operation Id - /// TrafficControllerInterface_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetTrafficControllersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TrafficControllerTrafficControllerInterfaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrafficControllerTrafficControllerInterfaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TrafficControllerResource(Client, TrafficControllerData.DeserializeTrafficControllerData(e)), TrafficControllerTrafficControllerInterfaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTrafficControllers", "value", "nextLink", cancellationToken); - } - - /// - /// List TrafficController resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers - /// - /// - /// Operation Id - /// TrafficControllerInterface_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetTrafficControllers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TrafficControllerTrafficControllerInterfaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrafficControllerTrafficControllerInterfaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TrafficControllerResource(Client, TrafficControllerData.DeserializeTrafficControllerData(e)), TrafficControllerTrafficControllerInterfaceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTrafficControllers", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/FrontendResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/FrontendResource.cs index 988d902f142e1..2d95053e62c6d 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/FrontendResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/FrontendResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.ServiceNetworking public partial class FrontendResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The trafficControllerName. + /// The frontendName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string trafficControllerName, string frontendName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}"; diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/AssociationsInterfaceRestOperations.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/AssociationsInterfaceRestOperations.cs index 64197c47fcb5a..342fe7a7f0f58 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/AssociationsInterfaceRestOperations.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/AssociationsInterfaceRestOperations.cs @@ -33,7 +33,7 @@ public AssociationsInterfaceRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01-preview"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/FrontendsInterfaceRestOperations.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/FrontendsInterfaceRestOperations.cs index 5e417df646200..346337712b8e7 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/FrontendsInterfaceRestOperations.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/FrontendsInterfaceRestOperations.cs @@ -33,7 +33,7 @@ public FrontendsInterfaceRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01-preview"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/TrafficControllerInterfaceRestOperations.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/TrafficControllerInterfaceRestOperations.cs index ac5c5bf0281d4..7edab6faa0241 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/TrafficControllerInterfaceRestOperations.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/RestOperations/TrafficControllerInterfaceRestOperations.cs @@ -33,7 +33,7 @@ public TrafficControllerInterfaceRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01-preview"; + _apiVersion = apiVersion ?? "2023-11-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs index d5fbc6c07239a..db44d039d55d3 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.ServiceNetworking public partial class TrafficControllerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The trafficControllerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string trafficControllerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AssociationResources and their operations over a AssociationResource. public virtual AssociationCollection GetAssociations() { - return GetCachedClient(Client => new AssociationCollection(Client, Id)); + return GetCachedClient(client => new AssociationCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual AssociationCollection GetAssociations() /// /// Name of Association. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAssociationAsync(string associationName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetAssociationAsync(str /// /// Name of Association. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAssociation(string associationName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetAssociation(string associationNa /// An object representing collection of FrontendResources and their operations over a FrontendResource. public virtual FrontendCollection GetFrontends() { - return GetCachedClient(Client => new FrontendCollection(Client, Id)); + return GetCachedClient(client => new FrontendCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual FrontendCollection GetFrontends() /// /// Frontends. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFrontendAsync(string frontendName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetFrontendAsync(string fr /// /// Frontends. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFrontend(string frontendName, CancellationToken cancellationToken = default) { diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/autorest.md b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/autorest.md index 8aa31a5ef3234..cc9b380720162 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/autorest.md +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true csharp: true library-name: ServiceNetworking namespace: Azure.ResourceManager.ServiceNetworking -require: https://github.com/Azure/azure-rest-api-specs/blob/b53cd31f04037e6f1b82dfc68d086e2d108eda13/specification/servicenetworking/resource-manager/readme.md +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/9837baba3ca259b4f2a3f736593311f445c35c63/specification/servicenetworking/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: diff --git a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/tests/Tests/TrafficControllerTests.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/tests/Tests/TrafficControllerTests.cs index ac09c2e87cf62..d012a4b2e9541 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/tests/Tests/TrafficControllerTests.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/tests/Tests/TrafficControllerTests.cs @@ -3,22 +3,13 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Azure.Core.TestFramework; using Azure.ResourceManager.Resources; -using Azure.ResourceManager.Resources.Models; -using Azure.ResourceManager.ServiceNetworking; using Azure.ResourceManager.Network; using Azure.Core; using NUnit.Framework; -using Azure.ResourceManager.ServiceNetworking.Models; -using System.IO.Pipelines; -using Castle.Core.Resource; -using System.Xml.Linq; using Azure.ResourceManager.Network.Models; -using AssociationType = Azure.ResourceManager.ServiceNetworking.Models.AssociationType; using Azure.ResourceManager.ServiceNetworking.Tests; namespace Azure.ResourceManager.ServiceNetworking.TrafficController.Tests.Tests @@ -81,7 +72,7 @@ private async Task> CreateFrontendAsync(ResourceG //Frontend Data object that is used to create the new frontend object. FrontendData fnd = new FrontendData(location) { - Location = location, + Location = location }; //Performing the Create/PUT operation and returning the result. return await frontends.CreateOrUpdateAsync(WaitUntil.Completed, frontendName, fnd); diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/api/Azure.ResourceManager.SignalR.netstandard2.0.cs b/sdk/signalr/Azure.ResourceManager.SignalR/api/Azure.ResourceManager.SignalR.netstandard2.0.cs index 672945a59339c..280000f32a01c 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/api/Azure.ResourceManager.SignalR.netstandard2.0.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/api/Azure.ResourceManager.SignalR.netstandard2.0.cs @@ -96,7 +96,7 @@ protected SignalRCustomDomainResource() { } } public partial class SignalRData : Azure.ResourceManager.Models.TrackedResourceData { - public SignalRData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SignalRData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList CorsAllowedOrigins { get { throw null; } } public bool? DisableAadAuth { get { throw null; } set { } } public bool? DisableLocalAuth { get { throw null; } set { } } @@ -259,6 +259,35 @@ public SignalRSharedPrivateLinkResourceData() { } public Azure.ResourceManager.SignalR.Models.SignalRSharedPrivateLinkResourceStatus? Status { get { throw null; } } } } +namespace Azure.ResourceManager.SignalR.Mocking +{ + public partial class MockableSignalRArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSignalRArmClient() { } + public virtual Azure.ResourceManager.SignalR.SignalRCustomCertificateResource GetSignalRCustomCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SignalR.SignalRCustomDomainResource GetSignalRCustomDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SignalR.SignalRPrivateEndpointConnectionResource GetSignalRPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SignalR.SignalRResource GetSignalRResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SignalR.SignalRSharedPrivateLinkResource GetSignalRSharedPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSignalRResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSignalRResourceGroupResource() { } + public virtual Azure.Response GetSignalR(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSignalRAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SignalR.SignalRCollection GetSignalRs() { throw null; } + } + public partial class MockableSignalRSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSignalRSubscriptionResource() { } + public virtual Azure.Response CheckSignalRNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.SignalR.Models.SignalRNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckSignalRNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.SignalR.Models.SignalRNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSignalRs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSignalRsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsages(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.SignalR.Models { public static partial class ArmSignalRModelFactory diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRArmClient.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRArmClient.cs new file mode 100644 index 0000000000000..9b7dc3a1bfa61 --- /dev/null +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.SignalR; + +namespace Azure.ResourceManager.SignalR.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSignalRArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSignalRArmClient() + { + } + + /// 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 MockableSignalRArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSignalRArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SignalRResource GetSignalRResource(ResourceIdentifier id) + { + SignalRResource.ValidateResourceId(id); + return new SignalRResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SignalRCustomCertificateResource GetSignalRCustomCertificateResource(ResourceIdentifier id) + { + SignalRCustomCertificateResource.ValidateResourceId(id); + return new SignalRCustomCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SignalRCustomDomainResource GetSignalRCustomDomainResource(ResourceIdentifier id) + { + SignalRCustomDomainResource.ValidateResourceId(id); + return new SignalRCustomDomainResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SignalRPrivateEndpointConnectionResource GetSignalRPrivateEndpointConnectionResource(ResourceIdentifier id) + { + SignalRPrivateEndpointConnectionResource.ValidateResourceId(id); + return new SignalRPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SignalRSharedPrivateLinkResource GetSignalRSharedPrivateLinkResource(ResourceIdentifier id) + { + SignalRSharedPrivateLinkResource.ValidateResourceId(id); + return new SignalRSharedPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRResourceGroupResource.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRResourceGroupResource.cs new file mode 100644 index 0000000000000..0e3833ec9b50d --- /dev/null +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.SignalR; + +namespace Azure.ResourceManager.SignalR.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSignalRResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSignalRResourceGroupResource() + { + } + + /// 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 MockableSignalRResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SignalRResources in the ResourceGroupResource. + /// An object representing collection of SignalRResources and their operations over a SignalRResource. + public virtual SignalRCollection GetSignalRs() + { + return GetCachedClient(client => new SignalRCollection(client, Id)); + } + + /// + /// Get the resource and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName} + /// + /// + /// Operation Id + /// SignalR_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSignalRAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetSignalRs().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the resource and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName} + /// + /// + /// Operation Id + /// SignalR_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSignalR(string resourceName, CancellationToken cancellationToken = default) + { + return GetSignalRs().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRSubscriptionResource.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRSubscriptionResource.cs new file mode 100644 index 0000000000000..cfbd14a59e735 --- /dev/null +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/MockableSignalRSubscriptionResource.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.SignalR; +using Azure.ResourceManager.SignalR.Models; + +namespace Azure.ResourceManager.SignalR.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSignalRSubscriptionResource : ArmResource + { + private ClientDiagnostics _signalRClientDiagnostics; + private SignalRRestOperations _signalRRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSignalRSubscriptionResource() + { + } + + /// 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 MockableSignalRSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SignalRClientDiagnostics => _signalRClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SignalR", SignalRResource.ResourceType.Namespace, Diagnostics); + private SignalRRestOperations SignalRRestClient => _signalRRestClient ??= new SignalRRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SignalRResource.ResourceType)); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SignalR", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks that the resource name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// SignalR_CheckNameAvailability + /// + /// + /// + /// the region. + /// Parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckSignalRNameAvailabilityAsync(AzureLocation location, SignalRNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SignalRClientDiagnostics.CreateScope("MockableSignalRSubscriptionResource.CheckSignalRNameAvailability"); + scope.Start(); + try + { + var response = await SignalRRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the resource name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// SignalR_CheckNameAvailability + /// + /// + /// + /// the region. + /// Parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual Response CheckSignalRNameAvailability(AzureLocation location, SignalRNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SignalRClientDiagnostics.CreateScope("MockableSignalRSubscriptionResource.CheckSignalRNameAvailability"); + scope.Start(); + try + { + var response = SignalRRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR + /// + /// + /// Operation Id + /// SignalR_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSignalRsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SignalRRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SignalRRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SignalRResource(Client, SignalRData.DeserializeSignalRData(e)), SignalRClientDiagnostics, Pipeline, "MockableSignalRSubscriptionResource.GetSignalRs", "value", "nextLink", cancellationToken); + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR + /// + /// + /// Operation Id + /// SignalR_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSignalRs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SignalRRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SignalRRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SignalRResource(Client, SignalRData.DeserializeSignalRData(e)), SignalRClientDiagnostics, Pipeline, "MockableSignalRSubscriptionResource.GetSignalRs", "value", "nextLink", cancellationToken); + } + + /// + /// List resource usage quotas by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// the location like "eastus". + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SignalRUsage.DeserializeSignalRUsage, UsagesClientDiagnostics, Pipeline, "MockableSignalRSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// List resource usage quotas by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// the location like "eastus". + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SignalRUsage.DeserializeSignalRUsage, UsagesClientDiagnostics, Pipeline, "MockableSignalRSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 4788d040f89d0..0000000000000 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.SignalR -{ - /// 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 SignalRResources in the ResourceGroupResource. - /// An object representing collection of SignalRResources and their operations over a SignalRResource. - public virtual SignalRCollection GetSignalRs() - { - return GetCachedClient(Client => new SignalRCollection(Client, Id)); - } - } -} diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/SignalRExtensions.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/SignalRExtensions.cs index 351a90fc8fa14..354c8ee51e69a 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/SignalRExtensions.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/SignalRExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.SignalR.Mocking; using Azure.ResourceManager.SignalR.Models; namespace Azure.ResourceManager.SignalR @@ -19,138 +20,113 @@ namespace Azure.ResourceManager.SignalR /// A class to add extension methods to Azure.ResourceManager.SignalR. public static partial class SignalRExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSignalRArmClient GetMockableSignalRArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSignalRArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSignalRResourceGroupResource GetMockableSignalRResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSignalRResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSignalRSubscriptionResource GetMockableSignalRSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSignalRSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region SignalRResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SignalRResource GetSignalRResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SignalRResource.ValidateResourceId(id); - return new SignalRResource(client, id); - } - ); + return GetMockableSignalRArmClient(client).GetSignalRResource(id); } - #endregion - #region SignalRCustomCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SignalRCustomCertificateResource GetSignalRCustomCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SignalRCustomCertificateResource.ValidateResourceId(id); - return new SignalRCustomCertificateResource(client, id); - } - ); + return GetMockableSignalRArmClient(client).GetSignalRCustomCertificateResource(id); } - #endregion - #region SignalRCustomDomainResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SignalRCustomDomainResource GetSignalRCustomDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SignalRCustomDomainResource.ValidateResourceId(id); - return new SignalRCustomDomainResource(client, id); - } - ); + return GetMockableSignalRArmClient(client).GetSignalRCustomDomainResource(id); } - #endregion - #region SignalRPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SignalRPrivateEndpointConnectionResource GetSignalRPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SignalRPrivateEndpointConnectionResource.ValidateResourceId(id); - return new SignalRPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableSignalRArmClient(client).GetSignalRPrivateEndpointConnectionResource(id); } - #endregion - #region SignalRSharedPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SignalRSharedPrivateLinkResource GetSignalRSharedPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SignalRSharedPrivateLinkResource.ValidateResourceId(id); - return new SignalRSharedPrivateLinkResource(client, id); - } - ); + return GetMockableSignalRArmClient(client).GetSignalRSharedPrivateLinkResource(id); } - #endregion - /// Gets a collection of SignalRResources in the ResourceGroupResource. + /// + /// Gets a collection of SignalRResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SignalRResources and their operations over a SignalRResource. public static SignalRCollection GetSignalRs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSignalRs(); + return GetMockableSignalRResourceGroupResource(resourceGroupResource).GetSignalRs(); } /// @@ -165,16 +141,20 @@ public static SignalRCollection GetSignalRs(this ResourceGroupResource resourceG /// SignalR_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSignalRAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSignalRs().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableSignalRResourceGroupResource(resourceGroupResource).GetSignalRAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -189,16 +169,20 @@ public static async Task> GetSignalRAsync(this Resourc /// SignalR_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSignalR(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSignalRs().Get(resourceName, cancellationToken); + return GetMockableSignalRResourceGroupResource(resourceGroupResource).GetSignalR(resourceName, cancellationToken); } /// @@ -213,6 +197,10 @@ public static Response GetSignalR(this ResourceGroupResource re /// SignalR_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the region. @@ -221,9 +209,7 @@ public static Response GetSignalR(this ResourceGroupResource re /// is null. public static async Task> CheckSignalRNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, SignalRNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSignalRNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableSignalRSubscriptionResource(subscriptionResource).CheckSignalRNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -238,6 +224,10 @@ public static async Task> CheckSignalRNa /// SignalR_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the region. @@ -246,9 +236,7 @@ public static async Task> CheckSignalRNa /// is null. public static Response CheckSignalRNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, SignalRNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSignalRNameAvailability(location, content, cancellationToken); + return GetMockableSignalRSubscriptionResource(subscriptionResource).CheckSignalRNameAvailability(location, content, cancellationToken); } /// @@ -263,13 +251,17 @@ public static Response CheckSignalRNameAvailabili /// SignalR_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSignalRsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSignalRsAsync(cancellationToken); + return GetMockableSignalRSubscriptionResource(subscriptionResource).GetSignalRsAsync(cancellationToken); } /// @@ -284,13 +276,17 @@ public static AsyncPageable GetSignalRsAsync(this SubscriptionR /// SignalR_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSignalRs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSignalRs(cancellationToken); + return GetMockableSignalRSubscriptionResource(subscriptionResource).GetSignalRs(cancellationToken); } /// @@ -305,6 +301,10 @@ public static Pageable GetSignalRs(this SubscriptionResource su /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the location like "eastus". @@ -312,7 +312,7 @@ public static Pageable GetSignalRs(this SubscriptionResource su /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesAsync(location, cancellationToken); + return GetMockableSignalRSubscriptionResource(subscriptionResource).GetUsagesAsync(location, cancellationToken); } /// @@ -327,6 +327,10 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionResour /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the location like "eastus". @@ -334,7 +338,7 @@ public static AsyncPageable GetUsagesAsync(this SubscriptionResour /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsages(location, cancellationToken); + return GetMockableSignalRSubscriptionResource(subscriptionResource).GetUsages(location, cancellationToken); } } } diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 6c46ba833069e..0000000000000 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.SignalR.Models; - -namespace Azure.ResourceManager.SignalR -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _signalRClientDiagnostics; - private SignalRRestOperations _signalRRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - - /// 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 SignalRClientDiagnostics => _signalRClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SignalR", SignalRResource.ResourceType.Namespace, Diagnostics); - private SignalRRestOperations SignalRRestClient => _signalRRestClient ??= new SignalRRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SignalRResource.ResourceType)); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SignalR", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks that the resource name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// SignalR_CheckNameAvailability - /// - /// - /// - /// the region. - /// Parameters supplied to the operation. - /// The cancellation token to use. - public virtual async Task> CheckSignalRNameAvailabilityAsync(AzureLocation location, SignalRNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SignalRClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSignalRNameAvailability"); - scope.Start(); - try - { - var response = await SignalRRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the resource name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// SignalR_CheckNameAvailability - /// - /// - /// - /// the region. - /// Parameters supplied to the operation. - /// The cancellation token to use. - public virtual Response CheckSignalRNameAvailability(AzureLocation location, SignalRNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SignalRClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSignalRNameAvailability"); - scope.Start(); - try - { - var response = SignalRRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR - /// - /// - /// Operation Id - /// SignalR_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSignalRsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SignalRRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SignalRRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SignalRResource(Client, SignalRData.DeserializeSignalRData(e)), SignalRClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSignalRs", "value", "nextLink", cancellationToken); - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR - /// - /// - /// Operation Id - /// SignalR_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSignalRs(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SignalRRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SignalRRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SignalRResource(Client, SignalRData.DeserializeSignalRData(e)), SignalRClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSignalRs", "value", "nextLink", cancellationToken); - } - - /// - /// List resource usage quotas by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// the location like "eastus". - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SignalRUsage.DeserializeSignalRUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// List resource usage quotas by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// the location like "eastus". - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SignalRUsage.DeserializeSignalRUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomCertificateResource.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomCertificateResource.cs index c97f66fa42f28..44dbf6cd34f3d 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomCertificateResource.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomCertificateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SignalR public partial class SignalRCustomCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customCertificates/{certificateName}"; diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomDomainResource.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomDomainResource.cs index 2d6dbb0daad18..1ea0087b4979b 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomDomainResource.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRCustomDomainResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SignalR public partial class SignalRCustomDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customDomains/{name}"; diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRPrivateEndpointConnectionResource.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRPrivateEndpointConnectionResource.cs index a2424e5535071..327ae68b62be1 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRPrivateEndpointConnectionResource.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SignalR public partial class SignalRPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRResource.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRResource.cs index bc6fc8286e1de..fc26d9a5a0530 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRResource.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.SignalR public partial class SignalRResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SignalRCustomCertificateResources and their operations over a SignalRCustomCertificateResource. public virtual SignalRCustomCertificateCollection GetSignalRCustomCertificates() { - return GetCachedClient(Client => new SignalRCustomCertificateCollection(Client, Id)); + return GetCachedClient(client => new SignalRCustomCertificateCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual SignalRCustomCertificateCollection GetSignalRCustomCertificates() /// /// Custom certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSignalRCustomCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetSignalR /// /// Custom certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSignalRCustomCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetSignalRCustomCertif /// An object representing collection of SignalRCustomDomainResources and their operations over a SignalRCustomDomainResource. public virtual SignalRCustomDomainCollection GetSignalRCustomDomains() { - return GetCachedClient(Client => new SignalRCustomDomainCollection(Client, Id)); + return GetCachedClient(client => new SignalRCustomDomainCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual SignalRCustomDomainCollection GetSignalRCustomDomains() /// /// Custom domain name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSignalRCustomDomainAsync(string name, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> GetSignalRCusto /// /// Custom domain name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSignalRCustomDomain(string name, CancellationToken cancellationToken = default) { @@ -204,7 +207,7 @@ public virtual Response GetSignalRCustomDomain(stri /// An object representing collection of SignalRPrivateEndpointConnectionResources and their operations over a SignalRPrivateEndpointConnectionResource. public virtual SignalRPrivateEndpointConnectionCollection GetSignalRPrivateEndpointConnections() { - return GetCachedClient(Client => new SignalRPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new SignalRPrivateEndpointConnectionCollection(client, Id)); } /// @@ -222,8 +225,8 @@ public virtual SignalRPrivateEndpointConnectionCollection GetSignalRPrivateEndpo /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSignalRPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -245,8 +248,8 @@ public virtual async Task> Ge /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSignalRPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -257,7 +260,7 @@ public virtual Response GetSignalRPriv /// An object representing collection of SignalRSharedPrivateLinkResources and their operations over a SignalRSharedPrivateLinkResource. public virtual SignalRSharedPrivateLinkResourceCollection GetSignalRSharedPrivateLinkResources() { - return GetCachedClient(Client => new SignalRSharedPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new SignalRSharedPrivateLinkResourceCollection(client, Id)); } /// @@ -275,8 +278,8 @@ public virtual SignalRSharedPrivateLinkResourceCollection GetSignalRSharedPrivat /// /// The name of the shared private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSignalRSharedPrivateLinkResourceAsync(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) { @@ -298,8 +301,8 @@ public virtual async Task> GetSignalR /// /// The name of the shared private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSignalRSharedPrivateLinkResource(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRSharedPrivateLinkResource.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRSharedPrivateLinkResource.cs index 2ad48a3b6e3d2..40089c267ac89 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRSharedPrivateLinkResource.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRSharedPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SignalR public partial class SignalRSharedPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The sharedPrivateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string sharedPrivateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}"; diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/api/Azure.ResourceManager.Sphere.netstandard2.0.cs b/sdk/sphere/Azure.ResourceManager.Sphere/api/Azure.ResourceManager.Sphere.netstandard2.0.cs index e00da8ae1ab9b..eb859cb9403bf 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/api/Azure.ResourceManager.Sphere.netstandard2.0.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/api/Azure.ResourceManager.Sphere.netstandard2.0.cs @@ -19,7 +19,7 @@ protected SphereCatalogCollection() { } } public partial class SphereCatalogData : Azure.ResourceManager.Models.TrackedResourceData { - public SphereCatalogData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SphereCatalogData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Sphere.Models.SphereProvisioningState? ProvisioningState { get { throw null; } } } public partial class SphereCatalogResource : Azure.ResourceManager.ArmResource @@ -340,6 +340,33 @@ protected SphereProductResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sphere.Models.SphereProductPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Sphere.Mocking +{ + public partial class MockableSphereArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSphereArmClient() { } + public virtual Azure.ResourceManager.Sphere.SphereCatalogResource GetSphereCatalogResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sphere.SphereCertificateResource GetSphereCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sphere.SphereDeploymentResource GetSphereDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sphere.SphereDeviceGroupResource GetSphereDeviceGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sphere.SphereDeviceResource GetSphereDeviceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sphere.SphereImageResource GetSphereImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sphere.SphereProductResource GetSphereProductResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSphereResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSphereResourceGroupResource() { } + public virtual Azure.Response GetSphereCatalog(string catalogName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSphereCatalogAsync(string catalogName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sphere.SphereCatalogCollection GetSphereCatalogs() { throw null; } + } + public partial class MockableSphereSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSphereSubscriptionResource() { } + public virtual Azure.Pageable GetSphereCatalogs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSphereCatalogsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Sphere.Models { public static partial class ArmSphereModelFactory diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereArmClient.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereArmClient.cs new file mode 100644 index 0000000000000..a114bab6d0ba5 --- /dev/null +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Sphere; + +namespace Azure.ResourceManager.Sphere.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSphereArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSphereArmClient() + { + } + + /// 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 MockableSphereArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSphereArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SphereCatalogResource GetSphereCatalogResource(ResourceIdentifier id) + { + SphereCatalogResource.ValidateResourceId(id); + return new SphereCatalogResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SphereCertificateResource GetSphereCertificateResource(ResourceIdentifier id) + { + SphereCertificateResource.ValidateResourceId(id); + return new SphereCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SphereImageResource GetSphereImageResource(ResourceIdentifier id) + { + SphereImageResource.ValidateResourceId(id); + return new SphereImageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SphereProductResource GetSphereProductResource(ResourceIdentifier id) + { + SphereProductResource.ValidateResourceId(id); + return new SphereProductResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SphereDeviceGroupResource GetSphereDeviceGroupResource(ResourceIdentifier id) + { + SphereDeviceGroupResource.ValidateResourceId(id); + return new SphereDeviceGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SphereDeploymentResource GetSphereDeploymentResource(ResourceIdentifier id) + { + SphereDeploymentResource.ValidateResourceId(id); + return new SphereDeploymentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SphereDeviceResource GetSphereDeviceResource(ResourceIdentifier id) + { + SphereDeviceResource.ValidateResourceId(id); + return new SphereDeviceResource(Client, id); + } + } +} diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereResourceGroupResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereResourceGroupResource.cs new file mode 100644 index 0000000000000..3fa4ce50be757 --- /dev/null +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.Sphere; + +namespace Azure.ResourceManager.Sphere.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSphereResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSphereResourceGroupResource() + { + } + + /// 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 MockableSphereResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SphereCatalogResources in the ResourceGroupResource. + /// An object representing collection of SphereCatalogResources and their operations over a SphereCatalogResource. + public virtual SphereCatalogCollection GetSphereCatalogs() + { + return GetCachedClient(client => new SphereCatalogCollection(client, Id)); + } + + /// + /// Get a Catalog + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName} + /// + /// + /// Operation Id + /// Catalogs_Get + /// + /// + /// + /// Name of catalog. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSphereCatalogAsync(string catalogName, CancellationToken cancellationToken = default) + { + return await GetSphereCatalogs().GetAsync(catalogName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Catalog + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName} + /// + /// + /// Operation Id + /// Catalogs_Get + /// + /// + /// + /// Name of catalog. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSphereCatalog(string catalogName, CancellationToken cancellationToken = default) + { + return GetSphereCatalogs().Get(catalogName, cancellationToken); + } + } +} diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereSubscriptionResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereSubscriptionResource.cs new file mode 100644 index 0000000000000..c62d8e3902c15 --- /dev/null +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/MockableSphereSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Sphere; + +namespace Azure.ResourceManager.Sphere.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSphereSubscriptionResource : ArmResource + { + private ClientDiagnostics _sphereCatalogCatalogsClientDiagnostics; + private CatalogsRestOperations _sphereCatalogCatalogsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSphereSubscriptionResource() + { + } + + /// 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 MockableSphereSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SphereCatalogCatalogsClientDiagnostics => _sphereCatalogCatalogsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sphere", SphereCatalogResource.ResourceType.Namespace, Diagnostics); + private CatalogsRestOperations SphereCatalogCatalogsRestClient => _sphereCatalogCatalogsRestClient ??= new CatalogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SphereCatalogResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Catalog resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs + /// + /// + /// Operation Id + /// Catalogs_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSphereCatalogsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SphereCatalogCatalogsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SphereCatalogCatalogsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SphereCatalogResource(Client, SphereCatalogData.DeserializeSphereCatalogData(e)), SphereCatalogCatalogsClientDiagnostics, Pipeline, "MockableSphereSubscriptionResource.GetSphereCatalogs", "value", "nextLink", cancellationToken); + } + + /// + /// List Catalog resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs + /// + /// + /// Operation Id + /// Catalogs_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSphereCatalogs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SphereCatalogCatalogsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SphereCatalogCatalogsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SphereCatalogResource(Client, SphereCatalogData.DeserializeSphereCatalogData(e)), SphereCatalogCatalogsClientDiagnostics, Pipeline, "MockableSphereSubscriptionResource.GetSphereCatalogs", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 0e9a62ddc4be7..0000000000000 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Sphere -{ - /// 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 SphereCatalogResources in the ResourceGroupResource. - /// An object representing collection of SphereCatalogResources and their operations over a SphereCatalogResource. - public virtual SphereCatalogCollection GetSphereCatalogs() - { - return GetCachedClient(Client => new SphereCatalogCollection(Client, Id)); - } - } -} diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/SphereExtensions.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/SphereExtensions.cs index 2440fbd67ed15..0cf0124f73c90 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/SphereExtensions.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/SphereExtensions.cs @@ -12,182 +12,152 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Sphere.Mocking; namespace Azure.ResourceManager.Sphere { /// A class to add extension methods to Azure.ResourceManager.Sphere. public static partial class SphereExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSphereArmClient GetMockableSphereArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSphereArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSphereResourceGroupResource GetMockableSphereResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSphereResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSphereSubscriptionResource GetMockableSphereSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSphereSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region SphereCatalogResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SphereCatalogResource GetSphereCatalogResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SphereCatalogResource.ValidateResourceId(id); - return new SphereCatalogResource(client, id); - } - ); + return GetMockableSphereArmClient(client).GetSphereCatalogResource(id); } - #endregion - #region SphereCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SphereCertificateResource GetSphereCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SphereCertificateResource.ValidateResourceId(id); - return new SphereCertificateResource(client, id); - } - ); + return GetMockableSphereArmClient(client).GetSphereCertificateResource(id); } - #endregion - #region SphereImageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SphereImageResource GetSphereImageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SphereImageResource.ValidateResourceId(id); - return new SphereImageResource(client, id); - } - ); + return GetMockableSphereArmClient(client).GetSphereImageResource(id); } - #endregion - #region SphereProductResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SphereProductResource GetSphereProductResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SphereProductResource.ValidateResourceId(id); - return new SphereProductResource(client, id); - } - ); + return GetMockableSphereArmClient(client).GetSphereProductResource(id); } - #endregion - #region SphereDeviceGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SphereDeviceGroupResource GetSphereDeviceGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SphereDeviceGroupResource.ValidateResourceId(id); - return new SphereDeviceGroupResource(client, id); - } - ); + return GetMockableSphereArmClient(client).GetSphereDeviceGroupResource(id); } - #endregion - #region SphereDeploymentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SphereDeploymentResource GetSphereDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SphereDeploymentResource.ValidateResourceId(id); - return new SphereDeploymentResource(client, id); - } - ); + return GetMockableSphereArmClient(client).GetSphereDeploymentResource(id); } - #endregion - #region SphereDeviceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SphereDeviceResource GetSphereDeviceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SphereDeviceResource.ValidateResourceId(id); - return new SphereDeviceResource(client, id); - } - ); + return GetMockableSphereArmClient(client).GetSphereDeviceResource(id); } - #endregion - /// Gets a collection of SphereCatalogResources in the ResourceGroupResource. + /// + /// Gets a collection of SphereCatalogResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SphereCatalogResources and their operations over a SphereCatalogResource. public static SphereCatalogCollection GetSphereCatalogs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSphereCatalogs(); + return GetMockableSphereResourceGroupResource(resourceGroupResource).GetSphereCatalogs(); } /// @@ -202,16 +172,20 @@ public static SphereCatalogCollection GetSphereCatalogs(this ResourceGroupResour /// Catalogs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of catalog. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSphereCatalogAsync(this ResourceGroupResource resourceGroupResource, string catalogName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSphereCatalogs().GetAsync(catalogName, cancellationToken).ConfigureAwait(false); + return await GetMockableSphereResourceGroupResource(resourceGroupResource).GetSphereCatalogAsync(catalogName, cancellationToken).ConfigureAwait(false); } /// @@ -226,16 +200,20 @@ public static async Task> GetSphereCatalogAsync( /// Catalogs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of catalog. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSphereCatalog(this ResourceGroupResource resourceGroupResource, string catalogName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSphereCatalogs().Get(catalogName, cancellationToken); + return GetMockableSphereResourceGroupResource(resourceGroupResource).GetSphereCatalog(catalogName, cancellationToken); } /// @@ -250,13 +228,17 @@ public static Response GetSphereCatalog(this ResourceGrou /// Catalogs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSphereCatalogsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSphereCatalogsAsync(cancellationToken); + return GetMockableSphereSubscriptionResource(subscriptionResource).GetSphereCatalogsAsync(cancellationToken); } /// @@ -271,13 +253,17 @@ public static AsyncPageable GetSphereCatalogsAsync(this S /// Catalogs_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSphereCatalogs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSphereCatalogs(cancellationToken); + return GetMockableSphereSubscriptionResource(subscriptionResource).GetSphereCatalogs(cancellationToken); } } } diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 602d50e4c441d..0000000000000 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Sphere -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _sphereCatalogCatalogsClientDiagnostics; - private CatalogsRestOperations _sphereCatalogCatalogsRestClient; - - /// 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 SphereCatalogCatalogsClientDiagnostics => _sphereCatalogCatalogsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sphere", SphereCatalogResource.ResourceType.Namespace, Diagnostics); - private CatalogsRestOperations SphereCatalogCatalogsRestClient => _sphereCatalogCatalogsRestClient ??= new CatalogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SphereCatalogResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List Catalog resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs - /// - /// - /// Operation Id - /// Catalogs_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSphereCatalogsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SphereCatalogCatalogsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SphereCatalogCatalogsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SphereCatalogResource(Client, SphereCatalogData.DeserializeSphereCatalogData(e)), SphereCatalogCatalogsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSphereCatalogs", "value", "nextLink", cancellationToken); - } - - /// - /// List Catalog resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs - /// - /// - /// Operation Id - /// Catalogs_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSphereCatalogs(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SphereCatalogCatalogsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SphereCatalogCatalogsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SphereCatalogResource(Client, SphereCatalogData.DeserializeSphereCatalogData(e)), SphereCatalogCatalogsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSphereCatalogs", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogResource.cs index 4602db841878e..0220555ad8a6d 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Sphere public partial class SphereCatalogResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The catalogName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string catalogName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SphereCertificateResources and their operations over a SphereCertificateResource. public virtual SphereCertificateCollection GetSphereCertificates() { - return GetCachedClient(Client => new SphereCertificateCollection(Client, Id)); + return GetCachedClient(client => new SphereCertificateCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual SphereCertificateCollection GetSphereCertificates() /// /// Serial number of the certificate. Use '.default' to get current active certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSphereCertificateAsync(string serialNumber, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetSphereCertific /// /// Serial number of the certificate. Use '.default' to get current active certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSphereCertificate(string serialNumber, CancellationToken cancellationToken = default) { @@ -147,7 +150,7 @@ public virtual Response GetSphereCertificate(string s /// An object representing collection of SphereImageResources and their operations over a SphereImageResource. public virtual SphereImageCollection GetSphereImages() { - return GetCachedClient(Client => new SphereImageCollection(Client, Id)); + return GetCachedClient(client => new SphereImageCollection(client, Id)); } /// @@ -165,8 +168,8 @@ public virtual SphereImageCollection GetSphereImages() /// /// Image name. Use .default for image creation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSphereImageAsync(string imageName, CancellationToken cancellationToken = default) { @@ -188,8 +191,8 @@ public virtual async Task> GetSphereImageAsync(str /// /// Image name. Use .default for image creation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSphereImage(string imageName, CancellationToken cancellationToken = default) { @@ -200,7 +203,7 @@ public virtual Response GetSphereImage(string imageName, Ca /// An object representing collection of SphereProductResources and their operations over a SphereProductResource. public virtual SphereProductCollection GetSphereProducts() { - return GetCachedClient(Client => new SphereProductCollection(Client, Id)); + return GetCachedClient(client => new SphereProductCollection(client, Id)); } /// @@ -218,8 +221,8 @@ public virtual SphereProductCollection GetSphereProducts() /// /// Name of product. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSphereProductAsync(string productName, CancellationToken cancellationToken = default) { @@ -241,8 +244,8 @@ public virtual async Task> GetSphereProductAsync /// /// Name of product. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSphereProduct(string productName, CancellationToken cancellationToken = default) { diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCertificateResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCertificateResource.cs index 283f1621b0d22..29023141cbc60 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCertificateResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCertificateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sphere public partial class SphereCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The catalogName. + /// The serialNumber. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string catalogName, string serialNumber) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}"; diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeploymentResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeploymentResource.cs index 21e6aed2ba899..fd534fe67e4bb 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeploymentResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeploymentResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Sphere public partial class SphereDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The catalogName. + /// The productName. + /// The deviceGroupName. + /// The deploymentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string catalogName, string productName, string deviceGroupName, string deploymentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}"; diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupResource.cs index 703fd7b096b5d..4a4a62da761f6 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sphere public partial class SphereDeviceGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The catalogName. + /// The productName. + /// The deviceGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string catalogName, string productName, string deviceGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SphereDeploymentResources and their operations over a SphereDeploymentResource. public virtual SphereDeploymentCollection GetSphereDeployments() { - return GetCachedClient(Client => new SphereDeploymentCollection(Client, Id)); + return GetCachedClient(client => new SphereDeploymentCollection(client, Id)); } /// @@ -109,8 +114,8 @@ public virtual SphereDeploymentCollection GetSphereDeployments() /// /// Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSphereDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) { @@ -132,8 +137,8 @@ public virtual async Task> GetSphereDeploymen /// /// Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSphereDeployment(string deploymentName, CancellationToken cancellationToken = default) { @@ -144,7 +149,7 @@ public virtual Response GetSphereDeployment(string dep /// An object representing collection of SphereDeviceResources and their operations over a SphereDeviceResource. public virtual SphereDeviceCollection GetSphereDevices() { - return GetCachedClient(Client => new SphereDeviceCollection(Client, Id)); + return GetCachedClient(client => new SphereDeviceCollection(client, Id)); } /// @@ -162,8 +167,8 @@ public virtual SphereDeviceCollection GetSphereDevices() /// /// Device name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSphereDeviceAsync(string deviceName, CancellationToken cancellationToken = default) { @@ -185,8 +190,8 @@ public virtual async Task> GetSphereDeviceAsync(s /// /// Device name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSphereDevice(string deviceName, CancellationToken cancellationToken = default) { diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceResource.cs index cc9fbd24d7747..827cd21637d76 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Sphere public partial class SphereDeviceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The catalogName. + /// The productName. + /// The deviceGroupName. + /// The deviceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string catalogName, string productName, string deviceGroupName, string deviceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}"; diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereImageResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereImageResource.cs index 76ef47d9086ac..2afde39d91ba8 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereImageResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereImageResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sphere public partial class SphereImageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The catalogName. + /// The imageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string catalogName, string imageName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}"; diff --git a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductResource.cs index b4debe9a2901a..0cfc58a416bac 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Sphere public partial class SphereProductResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The catalogName. + /// The productName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string catalogName, string productName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SphereDeviceGroupResources and their operations over a SphereDeviceGroupResource. public virtual SphereDeviceGroupCollection GetSphereDeviceGroups() { - return GetCachedClient(Client => new SphereDeviceGroupCollection(Client, Id)); + return GetCachedClient(client => new SphereDeviceGroupCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual SphereDeviceGroupCollection GetSphereDeviceGroups() /// /// Name of device group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSphereDeviceGroupAsync(string deviceGroupName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task> GetSphereDeviceGr /// /// Name of device group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSphereDeviceGroup(string deviceGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs index 438eed7458045..fd4155e12c41c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs @@ -256,7 +256,7 @@ protected ElasticPoolCollection() { } } public partial class ElasticPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public ElasticPoolData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ElasticPoolData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Sql.Models.SqlAvailabilityZoneType? AvailabilityZone { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public int? HighAvailabilityReplicaCount { get { throw null; } set { } } @@ -631,7 +631,7 @@ protected InstancePoolCollection() { } } public partial class InstancePoolData : Azure.ResourceManager.Models.TrackedResourceData { - public InstancePoolData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public InstancePoolData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? LicenseType { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } @@ -976,7 +976,7 @@ protected ManagedDatabaseColumnResource() { } } public partial class ManagedDatabaseData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedDatabaseData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedDatabaseData(Azure.Core.AzureLocation location) { } public bool? AllowAutoCompleteRestore { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.CatalogCollationType? CatalogCollation { get { throw null; } set { } } public string Collation { get { throw null; } set { } } @@ -1470,7 +1470,7 @@ protected ManagedInstanceCollection() { } } public partial class ManagedInstanceData : Azure.ResourceManager.Models.TrackedResourceData { - public ManagedInstanceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public ManagedInstanceData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator Administrators { get { throw null; } set { } } @@ -2463,7 +2463,7 @@ protected RestorableDroppedDatabaseCollection() { } } public partial class RestorableDroppedDatabaseData : Azure.ResourceManager.Models.TrackedResourceData { - public RestorableDroppedDatabaseData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public RestorableDroppedDatabaseData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? BackupStorageRedundancy { get { throw null; } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string DatabaseName { get { throw null; } } @@ -2522,7 +2522,7 @@ protected RestorableDroppedManagedDatabaseCollection() { } } public partial class RestorableDroppedManagedDatabaseData : Azure.ResourceManager.Models.TrackedResourceData { - public RestorableDroppedManagedDatabaseData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public RestorableDroppedManagedDatabaseData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? CreatedOn { get { throw null; } } public string DatabaseName { get { throw null; } } public System.DateTimeOffset? DeletedOn { get { throw null; } } @@ -2830,7 +2830,7 @@ protected SqlDatabaseColumnResource() { } } public partial class SqlDatabaseData : Azure.ResourceManager.Models.TrackedResourceData { - public SqlDatabaseData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SqlDatabaseData(Azure.Core.AzureLocation location) { } public int? AutoPauseDelay { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlAvailabilityZoneType? AvailabilityZone { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.CatalogCollationType? CatalogCollation { get { throw null; } set { } } @@ -3974,7 +3974,7 @@ protected SqlServerConnectionPolicyResource() { } } public partial class SqlServerData : Azure.ResourceManager.Models.TrackedResourceData { - public SqlServerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SqlServerData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ServerExternalAdministrator Administrators { get { throw null; } set { } } @@ -4172,7 +4172,7 @@ protected SqlServerJobAgentCollection() { } } public partial class SqlServerJobAgentData : Azure.ResourceManager.Models.TrackedResourceData { - public SqlServerJobAgentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SqlServerJobAgentData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier DatabaseId { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.JobAgentState? State { get { throw null; } } @@ -5375,7 +5375,7 @@ protected VirtualClusterCollection() { } } public partial class VirtualClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public VirtualClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VirtualClusterData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList ChildResources { get { throw null; } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("This property is obsolete and will be removed in a future release", false)] @@ -5508,6 +5508,250 @@ protected WorkloadGroupResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.WorkloadGroupData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Sql.Mocking +{ + public partial class MockableSqlArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSqlArmClient() { } + public virtual Azure.ResourceManager.Sql.BackupShortTermRetentionPolicyResource GetBackupShortTermRetentionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.DatabaseAdvancedThreatProtectionResource GetDatabaseAdvancedThreatProtectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.DataMaskingPolicyResource GetDataMaskingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.DataWarehouseUserActivityResource GetDataWarehouseUserActivityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.DeletedServerResource GetDeletedServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.DistributedAvailabilityGroupResource GetDistributedAvailabilityGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ElasticPoolResource GetElasticPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.EncryptionProtectorResource GetEncryptionProtectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.EndpointCertificateResource GetEndpointCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ExtendedDatabaseBlobAuditingPolicyResource GetExtendedDatabaseBlobAuditingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ExtendedServerBlobAuditingPolicyResource GetExtendedServerBlobAuditingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.FailoverGroupResource GetFailoverGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.GeoBackupPolicyResource GetGeoBackupPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.InstanceFailoverGroupResource GetInstanceFailoverGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.InstancePoolResource GetInstancePoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.IPv6FirewallRuleResource GetIPv6FirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.LedgerDigestUploadResource GetLedgerDigestUploadResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.LogicalDatabaseTransparentDataEncryptionResource GetLogicalDatabaseTransparentDataEncryptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.MaintenanceWindowOptionResource GetMaintenanceWindowOptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.MaintenanceWindowsResource GetMaintenanceWindowsResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedBackupShortTermRetentionPolicyResource GetManagedBackupShortTermRetentionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseAdvancedThreatProtectionResource GetManagedDatabaseAdvancedThreatProtectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseColumnResource GetManagedDatabaseColumnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseResource GetManagedDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseRestoreDetailResource GetManagedDatabaseRestoreDetailResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseSchemaResource GetManagedDatabaseSchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseSecurityAlertPolicyResource GetManagedDatabaseSecurityAlertPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseSensitivityLabelResource GetManagedDatabaseSensitivityLabelResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseTableResource GetManagedDatabaseTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseVulnerabilityAssessmentResource GetManagedDatabaseVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource GetManagedDatabaseVulnerabilityAssessmentRuleBaselineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedDatabaseVulnerabilityAssessmentScanResource GetManagedDatabaseVulnerabilityAssessmentScanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceAdministratorResource GetManagedInstanceAdministratorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceAdvancedThreatProtectionResource GetManagedInstanceAdvancedThreatProtectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceAzureADOnlyAuthenticationResource GetManagedInstanceAzureADOnlyAuthenticationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceDtcResource GetManagedInstanceDtcResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceEncryptionProtectorResource GetManagedInstanceEncryptionProtectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceKeyResource GetManagedInstanceKeyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceLongTermRetentionPolicyResource GetManagedInstanceLongTermRetentionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceOperationResource GetManagedInstanceOperationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstancePrivateEndpointConnectionResource GetManagedInstancePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstancePrivateLinkResource GetManagedInstancePrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceResource GetManagedInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceServerConfigurationOptionResource GetManagedInstanceServerConfigurationOptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceServerTrustCertificateResource GetManagedInstanceServerTrustCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceStartStopScheduleResource GetManagedInstanceStartStopScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceVulnerabilityAssessmentResource GetManagedInstanceVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedLedgerDigestUploadResource GetManagedLedgerDigestUploadResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource GetManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedServerDnsAliasResource GetManagedServerDnsAliasResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedServerSecurityAlertPolicyResource GetManagedServerSecurityAlertPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedTransparentDataEncryptionResource GetManagedTransparentDataEncryptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.OutboundFirewallRuleResource GetOutboundFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.RecommendedActionResource GetRecommendedActionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.RecoverableDatabaseResource GetRecoverableDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.RecoverableManagedDatabaseResource GetRecoverableManagedDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ResourceGroupLongTermRetentionManagedInstanceBackupResource GetResourceGroupLongTermRetentionManagedInstanceBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.RestorableDroppedDatabaseResource GetRestorableDroppedDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.RestorableDroppedManagedDatabaseResource GetRestorableDroppedManagedDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ServerAdvancedThreatProtectionResource GetServerAdvancedThreatProtectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.ServiceObjectiveResource GetServiceObjectiveResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlAgentConfigurationResource GetSqlAgentConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseAdvisorResource GetSqlDatabaseAdvisorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseAutomaticTuningResource GetSqlDatabaseAutomaticTuningResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseBlobAuditingPolicyResource GetSqlDatabaseBlobAuditingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseColumnResource GetSqlDatabaseColumnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseResource GetSqlDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseSchemaResource GetSqlDatabaseSchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseSecurityAlertPolicyResource GetSqlDatabaseSecurityAlertPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseSensitivityLabelResource GetSqlDatabaseSensitivityLabelResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseSqlVulnerabilityAssessmentBaselineResource GetSqlDatabaseSqlVulnerabilityAssessmentBaselineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource GetSqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseSqlVulnerabilityAssessmentResource GetSqlDatabaseSqlVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseSqlVulnerabilityAssessmentScanResource GetSqlDatabaseSqlVulnerabilityAssessmentScanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseSqlVulnerabilityAssessmentScanResultResource GetSqlDatabaseSqlVulnerabilityAssessmentScanResultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseTableResource GetSqlDatabaseTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseVulnerabilityAssessmentResource GetSqlDatabaseVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseVulnerabilityAssessmentRuleBaselineResource GetSqlDatabaseVulnerabilityAssessmentRuleBaselineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlDatabaseVulnerabilityAssessmentScanResource GetSqlDatabaseVulnerabilityAssessmentScanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlFirewallRuleResource GetSqlFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlPrivateEndpointConnectionResource GetSqlPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlPrivateLinkResource GetSqlPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerAdvisorResource GetSqlServerAdvisorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerAutomaticTuningResource GetSqlServerAutomaticTuningResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerAzureADAdministratorResource GetSqlServerAzureADAdministratorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerAzureADOnlyAuthenticationResource GetSqlServerAzureADOnlyAuthenticationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerBlobAuditingPolicyResource GetSqlServerBlobAuditingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerCommunicationLinkResource GetSqlServerCommunicationLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerConnectionPolicyResource GetSqlServerConnectionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseReplicationLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerDatabaseRestorePointResource GetSqlServerDatabaseRestorePointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerDevOpsAuditingSettingResource GetSqlServerDevOpsAuditingSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerDnsAliasResource GetSqlServerDnsAliasResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobAgentResource GetSqlServerJobAgentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobCredentialResource GetSqlServerJobCredentialResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobExecutionResource GetSqlServerJobExecutionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobExecutionStepResource GetSqlServerJobExecutionStepResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobExecutionStepTargetResource GetSqlServerJobExecutionStepTargetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobResource GetSqlServerJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobStepResource GetSqlServerJobStepResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobTargetGroupResource GetSqlServerJobTargetGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobVersionResource GetSqlServerJobVersionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerJobVersionStepResource GetSqlServerJobVersionStepResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerKeyResource GetSqlServerKeyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerResource GetSqlServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerSecurityAlertPolicyResource GetSqlServerSecurityAlertPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerSqlVulnerabilityAssessmentBaselineResource GetSqlServerSqlVulnerabilityAssessmentBaselineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerSqlVulnerabilityAssessmentBaselineRuleResource GetSqlServerSqlVulnerabilityAssessmentBaselineRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerSqlVulnerabilityAssessmentResource GetSqlServerSqlVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerSqlVulnerabilityAssessmentScanResource GetSqlServerSqlVulnerabilityAssessmentScanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerSqlVulnerabilityAssessmentScanResultResource GetSqlServerSqlVulnerabilityAssessmentScanResultResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerTrustGroupResource GetSqlServerTrustGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerVirtualNetworkRuleResource GetSqlServerVirtualNetworkRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerVulnerabilityAssessmentResource GetSqlServerVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlTimeZoneResource GetSqlTimeZoneResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SubscriptionLongTermRetentionManagedInstanceBackupResource GetSubscriptionLongTermRetentionManagedInstanceBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SubscriptionUsageResource GetSubscriptionUsageResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SyncAgentResource GetSyncAgentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SyncGroupResource GetSyncGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.SyncMemberResource GetSyncMemberResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.VirtualClusterResource GetVirtualClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.WorkloadClassifierResource GetWorkloadClassifierResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.WorkloadGroupResource GetWorkloadGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSqlResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSqlResourceGroupResource() { } + public virtual Azure.Response GetInstanceFailoverGroup(Azure.Core.AzureLocation locationName, string failoverGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInstanceFailoverGroupAsync(Azure.Core.AzureLocation locationName, string failoverGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.InstanceFailoverGroupCollection GetInstanceFailoverGroups(Azure.Core.AzureLocation locationName) { throw null; } + public virtual Azure.Response GetInstancePool(string instancePoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInstancePoolAsync(string instancePoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.InstancePoolCollection GetInstancePools() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetLongTermRetentionBackupsByResourceGroupLocation(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetLongTermRetentionBackupsByResourceGroupLocationAsync(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetLongTermRetentionBackupsByResourceGroupServer(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetLongTermRetentionBackupsByResourceGroupServerAsync(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLongTermRetentionBackupsWithLocation(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLongTermRetentionBackupsWithServer(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLongTermRetentionBackupsWithServerAsync(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance(Azure.Core.AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstanceAsync(Azure.Core.AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocationAsync(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLongTermRetentionManagedInstanceBackupsWithInstance(Azure.Core.AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(Azure.Core.AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLongTermRetentionManagedInstanceBackupsWithLocation(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetManagedInstance(string managedInstanceName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedInstanceAsync(string managedInstanceName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.ManagedInstanceCollection GetManagedInstances() { throw null; } + public virtual Azure.Response GetResourceGroupLongTermRetentionBackup(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceGroupLongTermRetentionBackupAsync(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) { throw null; } + public virtual Azure.Response GetResourceGroupLongTermRetentionManagedInstanceBackup(Azure.Core.AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceGroupLongTermRetentionManagedInstanceBackupAsync(Azure.Core.AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.ResourceGroupLongTermRetentionManagedInstanceBackupCollection GetResourceGroupLongTermRetentionManagedInstanceBackups(Azure.Core.AzureLocation locationName, string managedInstanceName, string databaseName) { throw null; } + public virtual Azure.Response GetSqlServer(string serverName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSqlServerAsync(string serverName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerCollection GetSqlServers() { throw null; } + public virtual Azure.Response GetSqlServerTrustGroup(Azure.Core.AzureLocation locationName, string serverTrustGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSqlServerTrustGroupAsync(Azure.Core.AzureLocation locationName, string serverTrustGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlServerTrustGroupCollection GetSqlServerTrustGroups(Azure.Core.AzureLocation locationName) { throw null; } + public virtual Azure.Response GetVirtualCluster(string virtualClusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVirtualClusterAsync(string virtualClusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.VirtualClusterCollection GetVirtualClusters() { throw null; } + } + public partial class MockableSqlSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSqlSubscriptionResource() { } + public virtual Azure.Response CheckSqlServerNameAvailability(Azure.ResourceManager.Sql.Models.SqlNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckSqlServerNameAvailabilityAsync(Azure.ResourceManager.Sql.Models.SqlNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetCapabilitiesByLocation(Azure.Core.AzureLocation locationName, Azure.ResourceManager.Sql.Models.SqlCapabilityGroup? include = default(Azure.ResourceManager.Sql.Models.SqlCapabilityGroup?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCapabilitiesByLocationAsync(Azure.Core.AzureLocation locationName, Azure.ResourceManager.Sql.Models.SqlCapabilityGroup? include = default(Azure.ResourceManager.Sql.Models.SqlCapabilityGroup?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeletedServer(Azure.Core.AzureLocation locationName, string deletedServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeletedServerAsync(Azure.Core.AzureLocation locationName, string deletedServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.DeletedServerCollection GetDeletedServers(Azure.Core.AzureLocation locationName) { throw null; } + public virtual Azure.Pageable GetDeletedServers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedServersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetInstancePools(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetInstancePoolsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetLongTermRetentionBackupsByLocation(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetLongTermRetentionBackupsByLocationAsync(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetLongTermRetentionBackupsByServer(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetLongTermRetentionBackupsByServerAsync(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLongTermRetentionBackupsWithLocation(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLongTermRetentionBackupsWithServer(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLongTermRetentionBackupsWithServerAsync(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetLongTermRetentionManagedInstanceBackupsByInstance(Azure.Core.AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(Azure.Core.AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.Pageable GetLongTermRetentionManagedInstanceBackupsByLocation(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public virtual Azure.AsyncPageable GetLongTermRetentionManagedInstanceBackupsByLocationAsync(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLongTermRetentionManagedInstanceBackupsWithInstance(Azure.Core.AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(Azure.Core.AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetLongTermRetentionManagedInstanceBackupsWithLocation(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(Azure.Core.AzureLocation locationName, bool? onlyLatestPerDatabase = default(bool?), Azure.ResourceManager.Sql.Models.SqlDatabaseState? databaseState = default(Azure.ResourceManager.Sql.Models.SqlDatabaseState?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetManagedInstances(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetManagedInstancesAsync(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSqlServers(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSqlServersAsync(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSqlTimeZone(Azure.Core.AzureLocation locationName, string timeZoneId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSqlTimeZoneAsync(Azure.Core.AzureLocation locationName, string timeZoneId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.SqlTimeZoneCollection GetSqlTimeZones(Azure.Core.AzureLocation locationName) { throw null; } + public virtual Azure.Response GetSubscriptionLongTermRetentionBackup(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionLongTermRetentionBackupAsync(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongTermRetentionBackups(Azure.Core.AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) { throw null; } + public virtual Azure.Response GetSubscriptionLongTermRetentionManagedInstanceBackup(Azure.Core.AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionLongTermRetentionManagedInstanceBackupAsync(Azure.Core.AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.SubscriptionLongTermRetentionManagedInstanceBackupCollection GetSubscriptionLongTermRetentionManagedInstanceBackups(Azure.Core.AzureLocation locationName, string managedInstanceName, string databaseName) { throw null; } + public virtual Azure.Response GetSubscriptionUsage(Azure.Core.AzureLocation locationName, string usageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionUsageAsync(Azure.Core.AzureLocation locationName, string usageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.SubscriptionUsageCollection GetSubscriptionUsages(Azure.Core.AzureLocation locationName) { throw null; } + public virtual Azure.Pageable GetSyncDatabaseIdsSyncGroups(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(Azure.Core.AzureLocation locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVirtualClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVirtualClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Sql.Models { public enum ActionRetryableState diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/MockableSqlResourceGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/MockableSqlResourceGroupResource.cs new file mode 100644 index 0000000000000..d1578f9074822 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/MockableSqlResourceGroupResource.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.ComponentModel; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSqlResourceGroupResource : ArmResource + { + /// + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByResourceGroupLocation + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetLongTermRetentionBackupsByResourceGroupLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupLocation"); + scope.Start(); + try + { + var response = await LongTermRetentionBackupsRestClient.ListByResourceGroupLocationAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupLocation"); + scope.Start(); + try + { + var response = await LongTermRetentionBackupsRestClient.ListByResourceGroupLocationNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByResourceGroupLocation + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetLongTermRetentionBackupsByResourceGroupLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupLocation"); + scope.Start(); + try + { + var response = LongTermRetentionBackupsRestClient.ListByResourceGroupLocation(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupLocation"); + scope.Start(); + try + { + var response = LongTermRetentionBackupsRestClient.ListByResourceGroupLocationNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByResourceGroupServer + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetLongTermRetentionBackupsByResourceGroupServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupServer"); + scope.Start(); + try + { + var response = await LongTermRetentionBackupsRestClient.ListByResourceGroupServerAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupServer"); + scope.Start(); + try + { + var response = await LongTermRetentionBackupsRestClient.ListByResourceGroupServerNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByResourceGroupServer + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetLongTermRetentionBackupsByResourceGroupServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupServer"); + scope.Start(); + try + { + var response = LongTermRetentionBackupsRestClient.ListByResourceGroupServer(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupServer"); + scope.Start(); + try + { + var response = LongTermRetentionBackupsRestClient.ListByResourceGroupServerNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance + /// + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstanceAsync(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance"); + scope.Start(); + try + { + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance"); + scope.Start(); + try + { + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance + /// + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance"); + scope.Start(); + try + { + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupInstance(Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance"); + scope.Start(); + try + { + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for managed databases in a given location. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation"); + scope.Start(); + try + { + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupLocationAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation"); + scope.Start(); + try + { + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupLocationNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for managed databases in a given location. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation"); + scope.Start(); + try + { + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupLocation(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation"); + scope.Start(); + try + { + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupLocationNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/MockableSqlSubscriptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/MockableSqlSubscriptionResource.cs new file mode 100644 index 0000000000000..b6aa0d5eb7dd8 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/MockableSqlSubscriptionResource.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.ComponentModel; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSqlSubscriptionResource : ArmResource + { + /// + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByLocation + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetLongTermRetentionBackupsByLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + scope.Start(); + try + { + var response = await LongTermRetentionBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + scope.Start(); + try + { + var response = await LongTermRetentionBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByLocation + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetLongTermRetentionBackupsByLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + scope.Start(); + try + { + var response = LongTermRetentionBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); + scope.Start(); + try + { + var response = LongTermRetentionBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByServer + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetLongTermRetentionBackupsByServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + scope.Start(); + try + { + var response = await LongTermRetentionBackupsRestClient.ListByServerAsync(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + scope.Start(); + try + { + var response = await LongTermRetentionBackupsRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given server. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// Operation Id: LongTermRetentionBackups_ListByServer + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetLongTermRetentionBackupsByServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + scope.Start(); + try + { + var response = LongTermRetentionBackupsRestClient.ListByServer(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); + scope.Start(); + try + { + var response = LongTermRetentionBackupsRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance + /// + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + scope.Start(); + try + { + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceAsync(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + scope.Start(); + try + { + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance + /// + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByInstance(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + scope.Start(); + try + { + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstance(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); + scope.Start(); + try + { + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for managed databases in a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); + scope.Start(); + try + { + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); + scope.Start(); + try + { + var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Lists the long term retention backups for managed databases in a given location. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); + scope.Start(); + try + { + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); + scope.Start(); + try + { + var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 948ba19fdfbb8..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,382 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByResourceGroupLocation - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsByResourceGroupLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionBackupsRestClient.ListByResourceGroupLocationAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionBackupsRestClient.ListByResourceGroupLocationNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByResourceGroupLocation - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsByResourceGroupLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupLocation"); - scope.Start(); - try - { - var response = LongTermRetentionBackupsRestClient.ListByResourceGroupLocation(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupLocation"); - scope.Start(); - try - { - var response = LongTermRetentionBackupsRestClient.ListByResourceGroupLocationNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByResourceGroupServer - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsByResourceGroupServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupServer"); - scope.Start(); - try - { - var response = await LongTermRetentionBackupsRestClient.ListByResourceGroupServerAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupServer"); - scope.Start(); - try - { - var response = await LongTermRetentionBackupsRestClient.ListByResourceGroupServerNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByResourceGroupServer - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsByResourceGroupServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupServer"); - scope.Start(); - try - { - var response = LongTermRetentionBackupsRestClient.ListByResourceGroupServer(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsByResourceGroupServer"); - scope.Start(); - try - { - var response = LongTermRetentionBackupsRestClient.ListByResourceGroupServerNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given managed instance. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance - /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstanceAsync(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupInstanceAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupInstanceNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given managed instance. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance - /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupInstance(Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupInstanceNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for managed databases in a given location. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupLocationAsync(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupLocationNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for managed databases in a given location. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupLocation(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByResourceGroupLocationNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/SqlExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/SqlExtensions.cs index 1bc80aefdde5f..a56475ef3a2bd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/SqlExtensions.cs @@ -37,7 +37,7 @@ public static partial class SqlExtensions [EditorBrowsable(EditorBrowsableState.Never)] public static AsyncPageable GetLongTermRetentionBackupsByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -62,7 +62,7 @@ public static AsyncPageable GetLong [EditorBrowsable(EditorBrowsableState.Never)] public static Pageable GetLongTermRetentionBackupsByLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsByLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -90,9 +90,7 @@ public static Pageable GetLongTermR [EditorBrowsable(EditorBrowsableState.Never)] public static AsyncPageable GetLongTermRetentionBackupsByServerAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -120,9 +118,7 @@ public static AsyncPageable GetLong [EditorBrowsable(EditorBrowsableState.Never)] public static Pageable GetLongTermRetentionBackupsByServer(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionBackupsByServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsByServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -150,9 +146,7 @@ public static Pageable GetLongTermR [EditorBrowsable(EditorBrowsableState.Never)] public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -180,9 +174,7 @@ public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstance(this SubscriptionResource subscriptionResource, AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsByInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsByInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -207,7 +199,7 @@ public static Pageable GetLongTermRetentionManagedInstanceBackupsByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -232,7 +224,7 @@ public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsByLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsByLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsByLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -257,7 +249,7 @@ public static Pageable GetLongTermRetentionBackupsByResourceGroupLocationAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionBackupsByResourceGroupLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsByResourceGroupLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -282,7 +274,7 @@ public static AsyncPageable GetLong [EditorBrowsable(EditorBrowsableState.Never)] public static Pageable GetLongTermRetentionBackupsByResourceGroupLocation(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionBackupsByResourceGroupLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsByResourceGroupLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -310,9 +302,7 @@ public static Pageable GetLongTermR [EditorBrowsable(EditorBrowsableState.Never)] public static AsyncPageable GetLongTermRetentionBackupsByResourceGroupServerAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionBackupsByResourceGroupServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsByResourceGroupServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -340,9 +330,7 @@ public static AsyncPageable GetLong [EditorBrowsable(EditorBrowsableState.Never)] public static Pageable GetLongTermRetentionBackupsByResourceGroupServer(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionBackupsByResourceGroupServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsByResourceGroupServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -370,9 +358,7 @@ public static Pageable GetLongTermR [EditorBrowsable(EditorBrowsableState.Never)] public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstanceAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -400,9 +386,7 @@ public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsByResourceGroupInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -427,7 +411,7 @@ public static Pageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocationAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -452,7 +436,7 @@ public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsByResourceGroupLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index e909badd7e8c8..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Custom/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,382 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByLocation - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsByLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByLocation - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsByLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByServer - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsByServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); - scope.Start(); - try - { - var response = await LongTermRetentionBackupsRestClient.ListByServerAsync(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); - scope.Start(); - try - { - var response = await LongTermRetentionBackupsRestClient.ListByServerNextPageAsync(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given server. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// Operation Id: LongTermRetentionBackups_ListByServer - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsByServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); - scope.Start(); - try - { - var response = LongTermRetentionBackupsRestClient.ListByServer(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsByServer"); - scope.Start(); - try - { - var response = LongTermRetentionBackupsRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given managed instance. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance - /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByInstanceAsync(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceAsync(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPageAsync(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for a given managed instance. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByInstance - /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByInstance(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstance(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByInstance"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByInstanceNextPage(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for managed databases in a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsByLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = await LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPageAsync(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Lists the long term retention backups for managed databases in a given location. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// Operation Id: LongTermRetentionManagedInstanceBackups_ListByLocation - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsByLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocation(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = LongTermRetentionManagedInstanceBackupsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsByLocation"); - scope.Start(); - try - { - var response = LongTermRetentionManagedInstanceBackupsRestClient.ListByLocationNextPage(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPolicyResource.cs index 668ba4ec79b95..05de6294b3144 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class BackupShortTermRetentionPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, ShortTermRetentionPolicyName policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicyResource.cs index 5f8772902d042..22f267741c9bb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicyResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Sql public partial class DataMaskingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/Default"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivityResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivityResource.cs index baa56818cf64d..c57780d75a7a3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivityResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivityResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class DataWarehouseUserActivityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The dataWarehouseUserActivityName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvancedThreatProtectionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvancedThreatProtectionResource.cs index f0b1a558a2b14..ee22f6b1a50d8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvancedThreatProtectionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvancedThreatProtectionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class DatabaseAdvancedThreatProtectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The advancedThreatProtectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, AdvancedThreatProtectionName advancedThreatProtectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServerResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServerResource.cs index 934f15d96f28f..834838bd66eb7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServerResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServerResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Sql public partial class DeletedServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. + /// The deletedServerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation locationName, string deletedServerName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs index d4fa06cd0231d..ccef473dabe83 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class DistributedAvailabilityGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The distributedAvailabilityGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolResource.cs index f8cd82a4ed9a2..5d3cdee162bfb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Sql public partial class ElasticPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The elasticPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string elasticPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorResource.cs index 700690536ced2..02677c65de0b9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class EncryptionProtectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The encryptionProtectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateResource.cs index 50d55859e9047..aa0261174a0ae 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EndpointCertificateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class EndpointCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The endpointType. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string endpointType) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyResource.cs index 361a94a05883a..c788f0e130079 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ExtendedDatabaseBlobAuditingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The blobAuditingPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyResource.cs index 2c60b6b18dca5..a26791bc16acb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ExtendedServerBlobAuditingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The blobAuditingPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs new file mode 100644 index 0000000000000..338990c9744b3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs @@ -0,0 +1,1551 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSqlArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSqlArmClient() + { + } + + /// 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 MockableSqlArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSqlArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataMaskingPolicyResource GetDataMaskingPolicyResource(ResourceIdentifier id) + { + DataMaskingPolicyResource.ValidateResourceId(id); + return new DataMaskingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GeoBackupPolicyResource GetGeoBackupPolicyResource(ResourceIdentifier id) + { + GeoBackupPolicyResource.ValidateResourceId(id); + return new GeoBackupPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerCommunicationLinkResource GetSqlServerCommunicationLinkResource(ResourceIdentifier id) + { + SqlServerCommunicationLinkResource.ValidateResourceId(id); + return new SqlServerCommunicationLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServiceObjectiveResource GetServiceObjectiveResource(ResourceIdentifier id) + { + ServiceObjectiveResource.ValidateResourceId(id); + return new ServiceObjectiveResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseAdvisorResource GetSqlDatabaseAdvisorResource(ResourceIdentifier id) + { + SqlDatabaseAdvisorResource.ValidateResourceId(id); + return new SqlDatabaseAdvisorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerAdvisorResource GetSqlServerAdvisorResource(ResourceIdentifier id) + { + SqlServerAdvisorResource.ValidateResourceId(id); + return new SqlServerAdvisorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseAutomaticTuningResource GetSqlDatabaseAutomaticTuningResource(ResourceIdentifier id) + { + SqlDatabaseAutomaticTuningResource.ValidateResourceId(id); + return new SqlDatabaseAutomaticTuningResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseColumnResource GetSqlDatabaseColumnResource(ResourceIdentifier id) + { + SqlDatabaseColumnResource.ValidateResourceId(id); + return new SqlDatabaseColumnResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseColumnResource GetManagedDatabaseColumnResource(ResourceIdentifier id) + { + ManagedDatabaseColumnResource.ValidateResourceId(id); + return new ManagedDatabaseColumnResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RecommendedActionResource GetRecommendedActionResource(ResourceIdentifier id) + { + RecommendedActionResource.ValidateResourceId(id); + return new RecommendedActionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseSchemaResource GetSqlDatabaseSchemaResource(ResourceIdentifier id) + { + SqlDatabaseSchemaResource.ValidateResourceId(id); + return new SqlDatabaseSchemaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseSchemaResource GetManagedDatabaseSchemaResource(ResourceIdentifier id) + { + ManagedDatabaseSchemaResource.ValidateResourceId(id); + return new ManagedDatabaseSchemaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseSecurityAlertPolicyResource GetSqlDatabaseSecurityAlertPolicyResource(ResourceIdentifier id) + { + SqlDatabaseSecurityAlertPolicyResource.ValidateResourceId(id); + return new SqlDatabaseSecurityAlertPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseTableResource GetSqlDatabaseTableResource(ResourceIdentifier id) + { + SqlDatabaseTableResource.ValidateResourceId(id); + return new SqlDatabaseTableResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseTableResource GetManagedDatabaseTableResource(ResourceIdentifier id) + { + ManagedDatabaseTableResource.ValidateResourceId(id); + return new ManagedDatabaseTableResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseVulnerabilityAssessmentRuleBaselineResource GetSqlDatabaseVulnerabilityAssessmentRuleBaselineResource(ResourceIdentifier id) + { + SqlDatabaseVulnerabilityAssessmentRuleBaselineResource.ValidateResourceId(id); + return new SqlDatabaseVulnerabilityAssessmentRuleBaselineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource GetManagedDatabaseVulnerabilityAssessmentRuleBaselineResource(ResourceIdentifier id) + { + ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource.ValidateResourceId(id); + return new ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseVulnerabilityAssessmentResource GetSqlDatabaseVulnerabilityAssessmentResource(ResourceIdentifier id) + { + SqlDatabaseVulnerabilityAssessmentResource.ValidateResourceId(id); + return new SqlDatabaseVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseVulnerabilityAssessmentResource GetManagedDatabaseVulnerabilityAssessmentResource(ResourceIdentifier id) + { + ManagedDatabaseVulnerabilityAssessmentResource.ValidateResourceId(id); + return new ManagedDatabaseVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseVulnerabilityAssessmentScanResource GetSqlDatabaseVulnerabilityAssessmentScanResource(ResourceIdentifier id) + { + SqlDatabaseVulnerabilityAssessmentScanResource.ValidateResourceId(id); + return new SqlDatabaseVulnerabilityAssessmentScanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseVulnerabilityAssessmentScanResource GetManagedDatabaseVulnerabilityAssessmentScanResource(ResourceIdentifier id) + { + ManagedDatabaseVulnerabilityAssessmentScanResource.ValidateResourceId(id); + return new ManagedDatabaseVulnerabilityAssessmentScanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataWarehouseUserActivityResource GetDataWarehouseUserActivityResource(ResourceIdentifier id) + { + DataWarehouseUserActivityResource.ValidateResourceId(id); + return new DataWarehouseUserActivityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeletedServerResource GetDeletedServerResource(ResourceIdentifier id) + { + DeletedServerResource.ValidateResourceId(id); + return new DeletedServerResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EncryptionProtectorResource GetEncryptionProtectorResource(ResourceIdentifier id) + { + EncryptionProtectorResource.ValidateResourceId(id); + return new EncryptionProtectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlFirewallRuleResource GetSqlFirewallRuleResource(ResourceIdentifier id) + { + SqlFirewallRuleResource.ValidateResourceId(id); + return new SqlFirewallRuleResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual InstancePoolResource GetInstancePoolResource(ResourceIdentifier id) + { + InstancePoolResource.ValidateResourceId(id); + return new InstancePoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobAgentResource GetSqlServerJobAgentResource(ResourceIdentifier id) + { + SqlServerJobAgentResource.ValidateResourceId(id); + return new SqlServerJobAgentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobCredentialResource GetSqlServerJobCredentialResource(ResourceIdentifier id) + { + SqlServerJobCredentialResource.ValidateResourceId(id); + return new SqlServerJobCredentialResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobExecutionResource GetSqlServerJobExecutionResource(ResourceIdentifier id) + { + SqlServerJobExecutionResource.ValidateResourceId(id); + return new SqlServerJobExecutionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobExecutionStepResource GetSqlServerJobExecutionStepResource(ResourceIdentifier id) + { + SqlServerJobExecutionStepResource.ValidateResourceId(id); + return new SqlServerJobExecutionStepResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobExecutionStepTargetResource GetSqlServerJobExecutionStepTargetResource(ResourceIdentifier id) + { + SqlServerJobExecutionStepTargetResource.ValidateResourceId(id); + return new SqlServerJobExecutionStepTargetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobResource GetSqlServerJobResource(ResourceIdentifier id) + { + SqlServerJobResource.ValidateResourceId(id); + return new SqlServerJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobVersionStepResource GetSqlServerJobVersionStepResource(ResourceIdentifier id) + { + SqlServerJobVersionStepResource.ValidateResourceId(id); + return new SqlServerJobVersionStepResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobStepResource GetSqlServerJobStepResource(ResourceIdentifier id) + { + SqlServerJobStepResource.ValidateResourceId(id); + return new SqlServerJobStepResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobTargetGroupResource GetSqlServerJobTargetGroupResource(ResourceIdentifier id) + { + SqlServerJobTargetGroupResource.ValidateResourceId(id); + return new SqlServerJobTargetGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerJobVersionResource GetSqlServerJobVersionResource(ResourceIdentifier id) + { + SqlServerJobVersionResource.ValidateResourceId(id); + return new SqlServerJobVersionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(ResourceIdentifier id) + { + LongTermRetentionPolicyResource.ValidateResourceId(id); + return new LongTermRetentionPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MaintenanceWindowOptionResource GetMaintenanceWindowOptionResource(ResourceIdentifier id) + { + MaintenanceWindowOptionResource.ValidateResourceId(id); + return new MaintenanceWindowOptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MaintenanceWindowsResource GetMaintenanceWindowsResource(ResourceIdentifier id) + { + MaintenanceWindowsResource.ValidateResourceId(id); + return new MaintenanceWindowsResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedBackupShortTermRetentionPolicyResource GetManagedBackupShortTermRetentionPolicyResource(ResourceIdentifier id) + { + ManagedBackupShortTermRetentionPolicyResource.ValidateResourceId(id); + return new ManagedBackupShortTermRetentionPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource GetManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource(ResourceIdentifier id) + { + ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource.ValidateResourceId(id); + return new ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseSecurityAlertPolicyResource GetManagedDatabaseSecurityAlertPolicyResource(ResourceIdentifier id) + { + ManagedDatabaseSecurityAlertPolicyResource.ValidateResourceId(id); + return new ManagedDatabaseSecurityAlertPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedTransparentDataEncryptionResource GetManagedTransparentDataEncryptionResource(ResourceIdentifier id) + { + ManagedTransparentDataEncryptionResource.ValidateResourceId(id); + return new ManagedTransparentDataEncryptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceAdministratorResource GetManagedInstanceAdministratorResource(ResourceIdentifier id) + { + ManagedInstanceAdministratorResource.ValidateResourceId(id); + return new ManagedInstanceAdministratorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceAzureADOnlyAuthenticationResource GetManagedInstanceAzureADOnlyAuthenticationResource(ResourceIdentifier id) + { + ManagedInstanceAzureADOnlyAuthenticationResource.ValidateResourceId(id); + return new ManagedInstanceAzureADOnlyAuthenticationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceEncryptionProtectorResource GetManagedInstanceEncryptionProtectorResource(ResourceIdentifier id) + { + ManagedInstanceEncryptionProtectorResource.ValidateResourceId(id); + return new ManagedInstanceEncryptionProtectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceKeyResource GetManagedInstanceKeyResource(ResourceIdentifier id) + { + ManagedInstanceKeyResource.ValidateResourceId(id); + return new ManagedInstanceKeyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceLongTermRetentionPolicyResource GetManagedInstanceLongTermRetentionPolicyResource(ResourceIdentifier id) + { + ManagedInstanceLongTermRetentionPolicyResource.ValidateResourceId(id); + return new ManagedInstanceLongTermRetentionPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceOperationResource GetManagedInstanceOperationResource(ResourceIdentifier id) + { + ManagedInstanceOperationResource.ValidateResourceId(id); + return new ManagedInstanceOperationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstancePrivateEndpointConnectionResource GetManagedInstancePrivateEndpointConnectionResource(ResourceIdentifier id) + { + ManagedInstancePrivateEndpointConnectionResource.ValidateResourceId(id); + return new ManagedInstancePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstancePrivateLinkResource GetManagedInstancePrivateLinkResource(ResourceIdentifier id) + { + ManagedInstancePrivateLinkResource.ValidateResourceId(id); + return new ManagedInstancePrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceVulnerabilityAssessmentResource GetManagedInstanceVulnerabilityAssessmentResource(ResourceIdentifier id) + { + ManagedInstanceVulnerabilityAssessmentResource.ValidateResourceId(id); + return new ManagedInstanceVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedServerSecurityAlertPolicyResource GetManagedServerSecurityAlertPolicyResource(ResourceIdentifier id) + { + ManagedServerSecurityAlertPolicyResource.ValidateResourceId(id); + return new ManagedServerSecurityAlertPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlPrivateEndpointConnectionResource GetSqlPrivateEndpointConnectionResource(ResourceIdentifier id) + { + SqlPrivateEndpointConnectionResource.ValidateResourceId(id); + return new SqlPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlPrivateLinkResource GetSqlPrivateLinkResource(ResourceIdentifier id) + { + SqlPrivateLinkResource.ValidateResourceId(id); + return new SqlPrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RecoverableManagedDatabaseResource GetRecoverableManagedDatabaseResource(ResourceIdentifier id) + { + RecoverableManagedDatabaseResource.ValidateResourceId(id); + return new RecoverableManagedDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerDatabaseRestorePointResource GetSqlServerDatabaseRestorePointResource(ResourceIdentifier id) + { + SqlServerDatabaseRestorePointResource.ValidateResourceId(id); + return new SqlServerDatabaseRestorePointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerAutomaticTuningResource GetSqlServerAutomaticTuningResource(ResourceIdentifier id) + { + SqlServerAutomaticTuningResource.ValidateResourceId(id); + return new SqlServerAutomaticTuningResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerAzureADAdministratorResource GetSqlServerAzureADAdministratorResource(ResourceIdentifier id) + { + SqlServerAzureADAdministratorResource.ValidateResourceId(id); + return new SqlServerAzureADAdministratorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerAzureADOnlyAuthenticationResource GetSqlServerAzureADOnlyAuthenticationResource(ResourceIdentifier id) + { + SqlServerAzureADOnlyAuthenticationResource.ValidateResourceId(id); + return new SqlServerAzureADOnlyAuthenticationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerDevOpsAuditingSettingResource GetSqlServerDevOpsAuditingSettingResource(ResourceIdentifier id) + { + SqlServerDevOpsAuditingSettingResource.ValidateResourceId(id); + return new SqlServerDevOpsAuditingSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerDnsAliasResource GetSqlServerDnsAliasResource(ResourceIdentifier id) + { + SqlServerDnsAliasResource.ValidateResourceId(id); + return new SqlServerDnsAliasResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerKeyResource GetSqlServerKeyResource(ResourceIdentifier id) + { + SqlServerKeyResource.ValidateResourceId(id); + return new SqlServerKeyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerSecurityAlertPolicyResource GetSqlServerSecurityAlertPolicyResource(ResourceIdentifier id) + { + SqlServerSecurityAlertPolicyResource.ValidateResourceId(id); + return new SqlServerSecurityAlertPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerTrustGroupResource GetSqlServerTrustGroupResource(ResourceIdentifier id) + { + SqlServerTrustGroupResource.ValidateResourceId(id); + return new SqlServerTrustGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerVulnerabilityAssessmentResource GetSqlServerVulnerabilityAssessmentResource(ResourceIdentifier id) + { + SqlServerVulnerabilityAssessmentResource.ValidateResourceId(id); + return new SqlServerVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlAgentConfigurationResource GetSqlAgentConfigurationResource(ResourceIdentifier id) + { + SqlAgentConfigurationResource.ValidateResourceId(id); + return new SqlAgentConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionUsageResource GetSubscriptionUsageResource(ResourceIdentifier id) + { + SubscriptionUsageResource.ValidateResourceId(id); + return new SubscriptionUsageResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SyncAgentResource GetSyncAgentResource(ResourceIdentifier id) + { + SyncAgentResource.ValidateResourceId(id); + return new SyncAgentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SyncGroupResource GetSyncGroupResource(ResourceIdentifier id) + { + SyncGroupResource.ValidateResourceId(id); + return new SyncGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SyncMemberResource GetSyncMemberResource(ResourceIdentifier id) + { + SyncMemberResource.ValidateResourceId(id); + return new SyncMemberResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlTimeZoneResource GetSqlTimeZoneResource(ResourceIdentifier id) + { + SqlTimeZoneResource.ValidateResourceId(id); + return new SqlTimeZoneResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerVirtualNetworkRuleResource GetSqlServerVirtualNetworkRuleResource(ResourceIdentifier id) + { + SqlServerVirtualNetworkRuleResource.ValidateResourceId(id); + return new SqlServerVirtualNetworkRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadClassifierResource GetWorkloadClassifierResource(ResourceIdentifier id) + { + WorkloadClassifierResource.ValidateResourceId(id); + return new WorkloadClassifierResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadGroupResource GetWorkloadGroupResource(ResourceIdentifier id) + { + WorkloadGroupResource.ValidateResourceId(id); + return new WorkloadGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupShortTermRetentionPolicyResource GetBackupShortTermRetentionPolicyResource(ResourceIdentifier id) + { + BackupShortTermRetentionPolicyResource.ValidateResourceId(id); + return new BackupShortTermRetentionPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LedgerDigestUploadResource GetLedgerDigestUploadResource(ResourceIdentifier id) + { + LedgerDigestUploadResource.ValidateResourceId(id); + return new LedgerDigestUploadResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual OutboundFirewallRuleResource GetOutboundFirewallRuleResource(ResourceIdentifier id) + { + OutboundFirewallRuleResource.ValidateResourceId(id); + return new OutboundFirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(ResourceIdentifier id) + { + SubscriptionLongTermRetentionBackupResource.ValidateResourceId(id); + return new SubscriptionLongTermRetentionBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(ResourceIdentifier id) + { + ResourceGroupLongTermRetentionBackupResource.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionLongTermRetentionManagedInstanceBackupResource GetSubscriptionLongTermRetentionManagedInstanceBackupResource(ResourceIdentifier id) + { + SubscriptionLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); + return new SubscriptionLongTermRetentionManagedInstanceBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ResourceGroupLongTermRetentionManagedInstanceBackupResource GetResourceGroupLongTermRetentionManagedInstanceBackupResource(ResourceIdentifier id) + { + ResourceGroupLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); + return new ResourceGroupLongTermRetentionManagedInstanceBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RestorableDroppedManagedDatabaseResource GetRestorableDroppedManagedDatabaseResource(ResourceIdentifier id) + { + RestorableDroppedManagedDatabaseResource.ValidateResourceId(id); + return new RestorableDroppedManagedDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerConnectionPolicyResource GetSqlServerConnectionPolicyResource(ResourceIdentifier id) + { + SqlServerConnectionPolicyResource.ValidateResourceId(id); + return new SqlServerConnectionPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DistributedAvailabilityGroupResource GetDistributedAvailabilityGroupResource(ResourceIdentifier id) + { + DistributedAvailabilityGroupResource.ValidateResourceId(id); + return new DistributedAvailabilityGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceServerTrustCertificateResource GetManagedInstanceServerTrustCertificateResource(ResourceIdentifier id) + { + ManagedInstanceServerTrustCertificateResource.ValidateResourceId(id); + return new ManagedInstanceServerTrustCertificateResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EndpointCertificateResource GetEndpointCertificateResource(ResourceIdentifier id) + { + EndpointCertificateResource.ValidateResourceId(id); + return new EndpointCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseSensitivityLabelResource GetManagedDatabaseSensitivityLabelResource(ResourceIdentifier id) + { + ManagedDatabaseSensitivityLabelResource.ValidateResourceId(id); + return new ManagedDatabaseSensitivityLabelResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseSensitivityLabelResource GetSqlDatabaseSensitivityLabelResource(ResourceIdentifier id) + { + SqlDatabaseSensitivityLabelResource.ValidateResourceId(id); + return new SqlDatabaseSensitivityLabelResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerBlobAuditingPolicyResource GetSqlServerBlobAuditingPolicyResource(ResourceIdentifier id) + { + SqlServerBlobAuditingPolicyResource.ValidateResourceId(id); + return new SqlServerBlobAuditingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseBlobAuditingPolicyResource GetSqlDatabaseBlobAuditingPolicyResource(ResourceIdentifier id) + { + SqlDatabaseBlobAuditingPolicyResource.ValidateResourceId(id); + return new SqlDatabaseBlobAuditingPolicyResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExtendedDatabaseBlobAuditingPolicyResource GetExtendedDatabaseBlobAuditingPolicyResource(ResourceIdentifier id) + { + ExtendedDatabaseBlobAuditingPolicyResource.ValidateResourceId(id); + return new ExtendedDatabaseBlobAuditingPolicyResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ExtendedServerBlobAuditingPolicyResource GetExtendedServerBlobAuditingPolicyResource(ResourceIdentifier id) + { + ExtendedServerBlobAuditingPolicyResource.ValidateResourceId(id); + return new ExtendedServerBlobAuditingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DatabaseAdvancedThreatProtectionResource GetDatabaseAdvancedThreatProtectionResource(ResourceIdentifier id) + { + DatabaseAdvancedThreatProtectionResource.ValidateResourceId(id); + return new DatabaseAdvancedThreatProtectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ServerAdvancedThreatProtectionResource GetServerAdvancedThreatProtectionResource(ResourceIdentifier id) + { + ServerAdvancedThreatProtectionResource.ValidateResourceId(id); + return new ServerAdvancedThreatProtectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedServerDnsAliasResource GetManagedServerDnsAliasResource(ResourceIdentifier id) + { + ManagedServerDnsAliasResource.ValidateResourceId(id); + return new ManagedServerDnsAliasResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseAdvancedThreatProtectionResource GetManagedDatabaseAdvancedThreatProtectionResource(ResourceIdentifier id) + { + ManagedDatabaseAdvancedThreatProtectionResource.ValidateResourceId(id); + return new ManagedDatabaseAdvancedThreatProtectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceAdvancedThreatProtectionResource GetManagedInstanceAdvancedThreatProtectionResource(ResourceIdentifier id) + { + ManagedInstanceAdvancedThreatProtectionResource.ValidateResourceId(id); + return new ManagedInstanceAdvancedThreatProtectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseReplicationLinkResource(ResourceIdentifier id) + { + SqlServerDatabaseReplicationLinkResource.ValidateResourceId(id); + return new SqlServerDatabaseReplicationLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceDtcResource GetManagedInstanceDtcResource(ResourceIdentifier id) + { + ManagedInstanceDtcResource.ValidateResourceId(id); + return new ManagedInstanceDtcResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VirtualClusterResource GetVirtualClusterResource(ResourceIdentifier id) + { + VirtualClusterResource.ValidateResourceId(id); + return new VirtualClusterResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual InstanceFailoverGroupResource GetInstanceFailoverGroupResource(ResourceIdentifier id) + { + InstanceFailoverGroupResource.ValidateResourceId(id); + return new InstanceFailoverGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseRestoreDetailResource GetManagedDatabaseRestoreDetailResource(ResourceIdentifier id) + { + ManagedDatabaseRestoreDetailResource.ValidateResourceId(id); + return new ManagedDatabaseRestoreDetailResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseResource GetSqlDatabaseResource(ResourceIdentifier id) + { + SqlDatabaseResource.ValidateResourceId(id); + return new SqlDatabaseResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ElasticPoolResource GetElasticPoolResource(ResourceIdentifier id) + { + ElasticPoolResource.ValidateResourceId(id); + return new ElasticPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedDatabaseResource GetManagedDatabaseResource(ResourceIdentifier id) + { + ManagedDatabaseResource.ValidateResourceId(id); + return new ManagedDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceResource GetManagedInstanceResource(ResourceIdentifier id) + { + ManagedInstanceResource.ValidateResourceId(id); + return new ManagedInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedLedgerDigestUploadResource GetManagedLedgerDigestUploadResource(ResourceIdentifier id) + { + ManagedLedgerDigestUploadResource.ValidateResourceId(id); + return new ManagedLedgerDigestUploadResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RecoverableDatabaseResource GetRecoverableDatabaseResource(ResourceIdentifier id) + { + RecoverableDatabaseResource.ValidateResourceId(id); + return new RecoverableDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RestorableDroppedDatabaseResource GetRestorableDroppedDatabaseResource(ResourceIdentifier id) + { + RestorableDroppedDatabaseResource.ValidateResourceId(id); + return new RestorableDroppedDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceServerConfigurationOptionResource GetManagedInstanceServerConfigurationOptionResource(ResourceIdentifier id) + { + ManagedInstanceServerConfigurationOptionResource.ValidateResourceId(id); + return new ManagedInstanceServerConfigurationOptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedInstanceStartStopScheduleResource GetManagedInstanceStartStopScheduleResource(ResourceIdentifier id) + { + ManagedInstanceStartStopScheduleResource.ValidateResourceId(id); + return new ManagedInstanceStartStopScheduleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogicalDatabaseTransparentDataEncryptionResource GetLogicalDatabaseTransparentDataEncryptionResource(ResourceIdentifier id) + { + LogicalDatabaseTransparentDataEncryptionResource.ValidateResourceId(id); + return new LogicalDatabaseTransparentDataEncryptionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual IPv6FirewallRuleResource GetIPv6FirewallRuleResource(ResourceIdentifier id) + { + IPv6FirewallRuleResource.ValidateResourceId(id); + return new IPv6FirewallRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerSqlVulnerabilityAssessmentBaselineResource GetSqlServerSqlVulnerabilityAssessmentBaselineResource(ResourceIdentifier id) + { + SqlServerSqlVulnerabilityAssessmentBaselineResource.ValidateResourceId(id); + return new SqlServerSqlVulnerabilityAssessmentBaselineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseSqlVulnerabilityAssessmentBaselineResource GetSqlDatabaseSqlVulnerabilityAssessmentBaselineResource(ResourceIdentifier id) + { + SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.ValidateResourceId(id); + return new SqlDatabaseSqlVulnerabilityAssessmentBaselineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerSqlVulnerabilityAssessmentBaselineRuleResource GetSqlServerSqlVulnerabilityAssessmentBaselineRuleResource(ResourceIdentifier id) + { + SqlServerSqlVulnerabilityAssessmentBaselineRuleResource.ValidateResourceId(id); + return new SqlServerSqlVulnerabilityAssessmentBaselineRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource GetSqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource(ResourceIdentifier id) + { + SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource.ValidateResourceId(id); + return new SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerSqlVulnerabilityAssessmentScanResultResource GetSqlServerSqlVulnerabilityAssessmentScanResultResource(ResourceIdentifier id) + { + SqlServerSqlVulnerabilityAssessmentScanResultResource.ValidateResourceId(id); + return new SqlServerSqlVulnerabilityAssessmentScanResultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseSqlVulnerabilityAssessmentScanResultResource GetSqlDatabaseSqlVulnerabilityAssessmentScanResultResource(ResourceIdentifier id) + { + SqlDatabaseSqlVulnerabilityAssessmentScanResultResource.ValidateResourceId(id); + return new SqlDatabaseSqlVulnerabilityAssessmentScanResultResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerSqlVulnerabilityAssessmentScanResource GetSqlServerSqlVulnerabilityAssessmentScanResource(ResourceIdentifier id) + { + SqlServerSqlVulnerabilityAssessmentScanResource.ValidateResourceId(id); + return new SqlServerSqlVulnerabilityAssessmentScanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseSqlVulnerabilityAssessmentScanResource GetSqlDatabaseSqlVulnerabilityAssessmentScanResource(ResourceIdentifier id) + { + SqlDatabaseSqlVulnerabilityAssessmentScanResource.ValidateResourceId(id); + return new SqlDatabaseSqlVulnerabilityAssessmentScanResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerSqlVulnerabilityAssessmentResource GetSqlServerSqlVulnerabilityAssessmentResource(ResourceIdentifier id) + { + SqlServerSqlVulnerabilityAssessmentResource.ValidateResourceId(id); + return new SqlServerSqlVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlDatabaseSqlVulnerabilityAssessmentResource GetSqlDatabaseSqlVulnerabilityAssessmentResource(ResourceIdentifier id) + { + SqlDatabaseSqlVulnerabilityAssessmentResource.ValidateResourceId(id); + return new SqlDatabaseSqlVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlServerResource GetSqlServerResource(ResourceIdentifier id) + { + SqlServerResource.ValidateResourceId(id); + return new SqlServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FailoverGroupResource GetFailoverGroupResource(ResourceIdentifier id) + { + FailoverGroupResource.ValidateResourceId(id); + return new FailoverGroupResource(Client, id); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs new file mode 100644 index 0000000000000..38d2f45777fcd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs @@ -0,0 +1,728 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSqlResourceGroupResource : ArmResource + { + private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; + private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; + private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; + private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSqlResourceGroupResource() + { + } + + /// 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 MockableSqlResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. + public virtual InstancePoolCollection GetInstancePools() + { + return GetCachedClient(client => new InstancePoolCollection(client, Id)); + } + + /// + /// Gets an instance pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// + /// + /// Operation Id + /// InstancePools_Get + /// + /// + /// + /// The name of the instance pool to be retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInstancePoolAsync(string instancePoolName, CancellationToken cancellationToken = default) + { + return await GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an instance pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// + /// + /// Operation Id + /// InstancePools_Get + /// + /// + /// + /// The name of the instance pool to be retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInstancePool(string instancePoolName, CancellationToken cancellationToken = default) + { + return GetInstancePools().Get(instancePoolName, cancellationToken); + } + + /// Gets a collection of SqlServerTrustGroupResources in the ResourceGroupResource. + /// The name of the region where the resource is located. + /// An object representing collection of SqlServerTrustGroupResources and their operations over a SqlServerTrustGroupResource. + public virtual SqlServerTrustGroupCollection GetSqlServerTrustGroups(AzureLocation locationName) + { + return new SqlServerTrustGroupCollection(Client, Id, locationName); + } + + /// + /// Gets a server trust group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} + /// + /// + /// Operation Id + /// ServerTrustGroups_Get + /// + /// + /// + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlServerTrustGroupAsync(AzureLocation locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + return await GetSqlServerTrustGroups(locationName).GetAsync(serverTrustGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a server trust group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName} + /// + /// + /// Operation Id + /// ServerTrustGroups_Get + /// + /// + /// + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlServerTrustGroup(AzureLocation locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + return GetSqlServerTrustGroups(locationName).Get(serverTrustGroupName, cancellationToken); + } + + /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. + public virtual ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) + { + return new ResourceGroupLongTermRetentionBackupCollection(Client, Id, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + } + + /// + /// Gets a long term retention backup. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionBackups_GetByResourceGroup + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceGroupLongTermRetentionBackupAsync(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + return await GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a long term retention backup. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionBackups_GetByResourceGroup + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceGroupLongTermRetentionBackup(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + return GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); + } + + /// Gets a collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources in the ResourceGroupResource. + /// The location of the database. + /// The name of the managed instance. + /// The name of the managed database. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources and their operations over a ResourceGroupLongTermRetentionManagedInstanceBackupResource. + public virtual ResourceGroupLongTermRetentionManagedInstanceBackupCollection GetResourceGroupLongTermRetentionManagedInstanceBackups(AzureLocation locationName, string managedInstanceName, string databaseName) + { + return new ResourceGroupLongTermRetentionManagedInstanceBackupCollection(Client, Id, locationName, managedInstanceName, databaseName); + } + + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup + /// + /// + /// + /// The location of the database. + /// The name of the managed instance. + /// The name of the managed database. + /// The backup name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetResourceGroupLongTermRetentionManagedInstanceBackupAsync(AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) + { + return await GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup + /// + /// + /// + /// The location of the database. + /// The name of the managed instance. + /// The name of the managed database. + /// The backup name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetResourceGroupLongTermRetentionManagedInstanceBackup(AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) + { + return GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName).Get(backupName, cancellationToken); + } + + /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. + /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. + public virtual VirtualClusterCollection GetVirtualClusters() + { + return GetCachedClient(client => new VirtualClusterCollection(client, Id)); + } + + /// + /// Gets a virtual cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} + /// + /// + /// Operation Id + /// VirtualClusters_Get + /// + /// + /// + /// The name of the virtual cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVirtualClusterAsync(string virtualClusterName, CancellationToken cancellationToken = default) + { + return await GetVirtualClusters().GetAsync(virtualClusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a virtual cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName} + /// + /// + /// Operation Id + /// VirtualClusters_Get + /// + /// + /// + /// The name of the virtual cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVirtualCluster(string virtualClusterName, CancellationToken cancellationToken = default) + { + return GetVirtualClusters().Get(virtualClusterName, cancellationToken); + } + + /// Gets a collection of InstanceFailoverGroupResources in the ResourceGroupResource. + /// The name of the region where the resource is located. + /// An object representing collection of InstanceFailoverGroupResources and their operations over a InstanceFailoverGroupResource. + public virtual InstanceFailoverGroupCollection GetInstanceFailoverGroups(AzureLocation locationName) + { + return new InstanceFailoverGroupCollection(Client, Id, locationName); + } + + /// + /// Gets a failover group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} + /// + /// + /// Operation Id + /// InstanceFailoverGroups_Get + /// + /// + /// + /// The name of the region where the resource is located. + /// The name of the failover group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInstanceFailoverGroupAsync(AzureLocation locationName, string failoverGroupName, CancellationToken cancellationToken = default) + { + return await GetInstanceFailoverGroups(locationName).GetAsync(failoverGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a failover group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName} + /// + /// + /// Operation Id + /// InstanceFailoverGroups_Get + /// + /// + /// + /// The name of the region where the resource is located. + /// The name of the failover group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInstanceFailoverGroup(AzureLocation locationName, string failoverGroupName, CancellationToken cancellationToken = default) + { + return GetInstanceFailoverGroups(locationName).Get(failoverGroupName, cancellationToken); + } + + /// Gets a collection of ManagedInstanceResources in the ResourceGroupResource. + /// An object representing collection of ManagedInstanceResources and their operations over a ManagedInstanceResource. + public virtual ManagedInstanceCollection GetManagedInstances() + { + return GetCachedClient(client => new ManagedInstanceCollection(client, Id)); + } + + /// + /// Gets a managed instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// + /// + /// Operation Id + /// ManagedInstances_Get + /// + /// + /// + /// The name of the managed instance. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedInstanceAsync(string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetManagedInstances().GetAsync(managedInstanceName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// + /// + /// Operation Id + /// ManagedInstances_Get + /// + /// + /// + /// The name of the managed instance. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedInstance(string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) + { + return GetManagedInstances().Get(managedInstanceName, expand, cancellationToken); + } + + /// Gets a collection of SqlServerResources in the ResourceGroupResource. + /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. + public virtual SqlServerCollection GetSqlServers() + { + return GetCachedClient(client => new SqlServerCollection(client, Id)); + } + + /// + /// Gets a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlServerAsync(string serverName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetSqlServers().GetAsync(serverName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName} + /// + /// + /// Operation Id + /// Servers_Get + /// + /// + /// + /// The name of the server. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlServer(string serverName, string expand = null, CancellationToken cancellationToken = default) + { + return GetSqlServers().Get(serverName, expand, cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupLocation + /// + /// + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupLocation + /// + /// + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupServer + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionBackupsWithServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByResourceGroupServer + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionBackupsWithServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance + /// + /// + /// + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupInstanceRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupInstanceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithInstance", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance + /// + /// + /// + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsWithInstance(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupInstanceRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupInstanceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithInstance", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for managed databases in a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation + /// + /// + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for managed databases in a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation + /// + /// + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlResourceGroupResource.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs new file mode 100644 index 0000000000000..47d234de5f558 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs @@ -0,0 +1,1000 @@ +// 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 Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.Sql; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSqlSubscriptionResource : ArmResource + { + private ClientDiagnostics _deletedServerClientDiagnostics; + private DeletedServersRestOperations _deletedServerRestClient; + private ClientDiagnostics _instancePoolClientDiagnostics; + private InstancePoolsRestOperations _instancePoolRestClient; + private ClientDiagnostics _capabilitiesClientDiagnostics; + private CapabilitiesRestOperations _capabilitiesRestClient; + private ClientDiagnostics _syncGroupClientDiagnostics; + private SyncGroupsRestOperations _syncGroupRestClient; + private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; + private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; + private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; + private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; + private ClientDiagnostics _virtualClusterClientDiagnostics; + private VirtualClustersRestOperations _virtualClusterRestClient; + private ClientDiagnostics _managedInstanceClientDiagnostics; + private ManagedInstancesRestOperations _managedInstanceRestClient; + private ClientDiagnostics _sqlServerServersClientDiagnostics; + private ServersRestOperations _sqlServerServersRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSqlSubscriptionResource() + { + } + + /// 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 MockableSqlSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DeletedServerClientDiagnostics => _deletedServerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", DeletedServerResource.ResourceType.Namespace, Diagnostics); + private DeletedServersRestOperations DeletedServerRestClient => _deletedServerRestClient ??= new DeletedServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedServerResource.ResourceType)); + private ClientDiagnostics InstancePoolClientDiagnostics => _instancePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", InstancePoolResource.ResourceType.Namespace, Diagnostics); + private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstancePoolResource.ResourceType)); + private ClientDiagnostics CapabilitiesClientDiagnostics => _capabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CapabilitiesRestOperations CapabilitiesRestClient => _capabilitiesRestClient ??= new CapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SyncGroupClientDiagnostics => _syncGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SyncGroupResource.ResourceType.Namespace, Diagnostics); + private SyncGroupsRestOperations SyncGroupRestClient => _syncGroupRestClient ??= new SyncGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SyncGroupResource.ResourceType)); + private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics VirtualClusterClientDiagnostics => _virtualClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", VirtualClusterResource.ResourceType.Namespace, Diagnostics); + private VirtualClustersRestOperations VirtualClusterRestClient => _virtualClusterRestClient ??= new VirtualClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualClusterResource.ResourceType)); + private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); + private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); + private ClientDiagnostics SqlServerServersClientDiagnostics => _sqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServerResource.ResourceType.Namespace, Diagnostics); + private ServersRestOperations SqlServerServersRestClient => _sqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlServerResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DeletedServerResources in the SubscriptionResource. + /// The name of the region where the resource is located. + /// An object representing collection of DeletedServerResources and their operations over a DeletedServerResource. + public virtual DeletedServerCollection GetDeletedServers(AzureLocation locationName) + { + return new DeletedServerCollection(Client, Id, locationName); + } + + /// + /// Gets a deleted server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName} + /// + /// + /// Operation Id + /// DeletedServers_Get + /// + /// + /// + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeletedServerAsync(AzureLocation locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + return await GetDeletedServers(locationName).GetAsync(deletedServerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deleted server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName} + /// + /// + /// Operation Id + /// DeletedServers_Get + /// + /// + /// + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeletedServer(AzureLocation locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + return GetDeletedServers(locationName).Get(deletedServerName, cancellationToken); + } + + /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. + /// The name of the region where the resource is located. + /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. + public virtual SubscriptionUsageCollection GetSubscriptionUsages(AzureLocation locationName) + { + return new SubscriptionUsageCollection(Client, Id, locationName); + } + + /// + /// Gets a subscription usage metric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} + /// + /// + /// Operation Id + /// SubscriptionUsages_Get + /// + /// + /// + /// The name of the region where the resource is located. + /// Name of usage metric to return. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionUsageAsync(AzureLocation locationName, string usageName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionUsages(locationName).GetAsync(usageName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a subscription usage metric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName} + /// + /// + /// Operation Id + /// SubscriptionUsages_Get + /// + /// + /// + /// The name of the region where the resource is located. + /// Name of usage metric to return. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionUsage(AzureLocation locationName, string usageName, CancellationToken cancellationToken = default) + { + return GetSubscriptionUsages(locationName).Get(usageName, cancellationToken); + } + + /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. + /// The String to use. + /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. + public virtual SqlTimeZoneCollection GetSqlTimeZones(AzureLocation locationName) + { + return new SqlTimeZoneCollection(Client, Id, locationName); + } + + /// + /// Gets a managed instance time zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} + /// + /// + /// Operation Id + /// TimeZones_Get + /// + /// + /// + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlTimeZoneAsync(AzureLocation locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + return await GetSqlTimeZones(locationName).GetAsync(timeZoneId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed instance time zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId} + /// + /// + /// Operation Id + /// TimeZones_Get + /// + /// + /// + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlTimeZone(AzureLocation locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + return GetSqlTimeZones(locationName).Get(timeZoneId, cancellationToken); + } + + /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of SubscriptionLongTermRetentionBackupResources and their operations over a SubscriptionLongTermRetentionBackupResource. + public virtual SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongTermRetentionBackups(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) + { + return new SubscriptionLongTermRetentionBackupCollection(Client, Id, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + } + + /// + /// Gets a long term retention backup. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionBackups_Get + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionLongTermRetentionBackupAsync(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a long term retention backup. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionBackups_Get + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionLongTermRetentionBackup(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + return GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); + } + + /// Gets a collection of SubscriptionLongTermRetentionManagedInstanceBackupResources in the SubscriptionResource. + /// The location of the database. + /// The name of the managed instance. + /// The name of the managed database. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of SubscriptionLongTermRetentionManagedInstanceBackupResources and their operations over a SubscriptionLongTermRetentionManagedInstanceBackupResource. + public virtual SubscriptionLongTermRetentionManagedInstanceBackupCollection GetSubscriptionLongTermRetentionManagedInstanceBackups(AzureLocation locationName, string managedInstanceName, string databaseName) + { + return new SubscriptionLongTermRetentionManagedInstanceBackupCollection(Client, Id, locationName, managedInstanceName, databaseName); + } + + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_Get + /// + /// + /// + /// The location of the database. + /// The name of the managed instance. + /// The name of the managed database. + /// The backup name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionLongTermRetentionManagedInstanceBackupAsync(AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a long term retention backup for a managed database. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName} + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_Get + /// + /// + /// + /// The location of the database. + /// The name of the managed instance. + /// The name of the managed database. + /// The backup name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionLongTermRetentionManagedInstanceBackup(AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) + { + return GetSubscriptionLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName).Get(backupName, cancellationToken); + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers + /// + /// + /// Operation Id + /// DeletedServers_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedServersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedServerRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedServerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetDeletedServers", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers + /// + /// + /// Operation Id + /// DeletedServers_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedServers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedServerRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedServerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetDeletedServers", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetInstancePoolsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetInstancePools(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the subscription capabilities available for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities + /// + /// + /// Operation Id + /// Capabilities_ListByLocation + /// + /// + /// + /// The location name whose capabilities are retrieved. + /// If specified, restricts the response to only include the selected item. + /// The cancellation token to use. + public virtual async Task> GetCapabilitiesByLocationAsync(AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) + { + using var scope = CapabilitiesClientDiagnostics.CreateScope("MockableSqlSubscriptionResource.GetCapabilitiesByLocation"); + scope.Start(); + try + { + var response = await CapabilitiesRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, include, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the subscription capabilities available for the specified location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities + /// + /// + /// Operation Id + /// Capabilities_ListByLocation + /// + /// + /// + /// The location name whose capabilities are retrieved. + /// If specified, restricts the response to only include the selected item. + /// The cancellation token to use. + public virtual Response GetCapabilitiesByLocation(AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) + { + using var scope = CapabilitiesClientDiagnostics.CreateScope("MockableSqlSubscriptionResource.GetCapabilitiesByLocation"); + scope.Start(); + try + { + var response = CapabilitiesRestClient.ListByLocation(Id.SubscriptionId, locationName, include, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a collection of sync database ids. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// + /// + /// Operation Id + /// SyncGroups_ListSyncDatabaseIds + /// + /// + /// + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SyncGroupRestClient.CreateListSyncDatabaseIdsRequest(Id.SubscriptionId, locationName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SyncGroupRestClient.CreateListSyncDatabaseIdsNextPageRequest(nextLink, Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), SyncGroupClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetSyncDatabaseIdsSyncGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a collection of sync database ids. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds + /// + /// + /// Operation Id + /// SyncGroups_ListSyncDatabaseIds + /// + /// + /// + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSyncDatabaseIdsSyncGroups(AzureLocation locationName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SyncGroupRestClient.CreateListSyncDatabaseIdsRequest(Id.SubscriptionId, locationName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SyncGroupRestClient.CreateListSyncDatabaseIdsNextPageRequest(nextLink, Id.SubscriptionId, locationName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), SyncGroupClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetSyncDatabaseIdsSyncGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByLocation + /// + /// + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByLocation + /// + /// + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByServer + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionBackupsWithServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByServerRequest(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given server. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups + /// + /// + /// Operation Id + /// LongTermRetentionBackups_ListByServer + /// + /// + /// + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionBackupsWithServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByServerRequest(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_ListByInstance + /// + /// + /// + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByInstanceRequest(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByInstanceNextPageRequest(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionManagedInstanceBackupsWithInstance", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for a given managed instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_ListByInstance + /// + /// + /// + /// The location of the database. + /// The name of the managed instance. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsWithInstance(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByInstanceRequest(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByInstanceNextPageRequest(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionManagedInstanceBackupsWithInstance", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for managed databases in a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_ListByLocation + /// + /// + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the long term retention backups for managed databases in a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups + /// + /// + /// Operation Id + /// LongTermRetentionManagedInstanceBackups_ListByLocation + /// + /// + /// + /// The location of the database. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLongTermRetentionManagedInstanceBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all virtualClusters in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// + /// + /// Operation Id + /// VirtualClusters_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualClusterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualClusterResource(Client, VirtualClusterData.DeserializeVirtualClusterData(e)), VirtualClusterClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetVirtualClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all virtualClusters in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters + /// + /// + /// Operation Id + /// VirtualClusters_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualClusterRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualClusterResource(Client, VirtualClusterData.DeserializeVirtualClusterData(e)), VirtualClusterClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetVirtualClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// + /// + /// Operation Id + /// ManagedInstances_List + /// + /// + /// + /// The child resources to include in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedInstanceRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedInstanceResource(Client, ManagedInstanceData.DeserializeManagedInstanceData(e)), ManagedInstanceClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetManagedInstances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// + /// + /// Operation Id + /// ManagedInstances_List + /// + /// + /// + /// The child resources to include in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedInstanceRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedInstanceResource(Client, ManagedInstanceData.DeserializeManagedInstanceData(e)), ManagedInstanceClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetManagedInstances", "value", "nextLink", cancellationToken); + } + + /// + /// Determines whether a resource can be created with the specified name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// + /// + /// Operation Id + /// Servers_CheckNameAvailability + /// + /// + /// + /// The name availability request parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckSqlServerNameAvailabilityAsync(SqlNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SqlServerServersClientDiagnostics.CreateScope("MockableSqlSubscriptionResource.CheckSqlServerNameAvailability"); + scope.Start(); + try + { + var response = await SqlServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Determines whether a resource can be created with the specified name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability + /// + /// + /// Operation Id + /// Servers_CheckNameAvailability + /// + /// + /// + /// The name availability request parameters. + /// The cancellation token to use. + /// is null. + public virtual Response CheckSqlServerNameAvailability(SqlNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SqlServerServersClientDiagnostics.CreateScope("MockableSqlSubscriptionResource.CheckSqlServerNameAvailability"); + scope.Start(); + try + { + var response = SqlServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of all servers in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The child resources to include in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSqlServersAsync(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SqlServerServersRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlServerResource(Client, SqlServerData.DeserializeSqlServerData(e)), SqlServerServersClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetSqlServers", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all servers in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers + /// + /// + /// Operation Id + /// Servers_List + /// + /// + /// + /// The child resources to include in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSqlServers(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SqlServerServersRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlServerResource(Client, SqlServerData.DeserializeSqlServerData(e)), SqlServerServersClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetSqlServers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d8e89b3d63a50..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; - private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; - private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; - private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; - - /// 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 ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. - /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. - public virtual InstancePoolCollection GetInstancePools() - { - return GetCachedClient(Client => new InstancePoolCollection(Client, Id)); - } - - /// Gets a collection of SqlServerTrustGroupResources in the ResourceGroupResource. - /// The name of the region where the resource is located. - /// An object representing collection of SqlServerTrustGroupResources and their operations over a SqlServerTrustGroupResource. - public virtual SqlServerTrustGroupCollection GetSqlServerTrustGroups(AzureLocation locationName) - { - return new SqlServerTrustGroupCollection(Client, Id, locationName); - } - - /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. - public virtual ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) - { - return new ResourceGroupLongTermRetentionBackupCollection(Client, Id, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - } - - /// Gets a collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources in the ResourceGroupResource. - /// The location of the database. - /// The name of the managed instance. - /// The name of the managed database. - /// An object representing collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources and their operations over a ResourceGroupLongTermRetentionManagedInstanceBackupResource. - public virtual ResourceGroupLongTermRetentionManagedInstanceBackupCollection GetResourceGroupLongTermRetentionManagedInstanceBackups(AzureLocation locationName, string managedInstanceName, string databaseName) - { - return new ResourceGroupLongTermRetentionManagedInstanceBackupCollection(Client, Id, locationName, managedInstanceName, databaseName); - } - - /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. - /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. - public virtual VirtualClusterCollection GetVirtualClusters() - { - return GetCachedClient(Client => new VirtualClusterCollection(Client, Id)); - } - - /// Gets a collection of InstanceFailoverGroupResources in the ResourceGroupResource. - /// The name of the region where the resource is located. - /// An object representing collection of InstanceFailoverGroupResources and their operations over a InstanceFailoverGroupResource. - public virtual InstanceFailoverGroupCollection GetInstanceFailoverGroups(AzureLocation locationName) - { - return new InstanceFailoverGroupCollection(Client, Id, locationName); - } - - /// Gets a collection of ManagedInstanceResources in the ResourceGroupResource. - /// An object representing collection of ManagedInstanceResources and their operations over a ManagedInstanceResource. - public virtual ManagedInstanceCollection GetManagedInstances() - { - return GetCachedClient(Client => new ManagedInstanceCollection(Client, Id)); - } - - /// Gets a collection of SqlServerResources in the ResourceGroupResource. - /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. - public virtual SqlServerCollection GetSqlServers() - { - return GetCachedClient(Client => new SqlServerCollection(Client, Id)); - } - - /// - /// Lists the long term retention backups for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupLocation - /// - /// - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupLocation - /// - /// - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given server. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupServer - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsWithServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given server. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByResourceGroupServer - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsWithServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByResourceGroupServerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given managed instance. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance - /// - /// - /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupInstanceRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupInstanceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsWithInstance", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given managed instance. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance - /// - /// - /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsWithInstance(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupInstanceRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupInstanceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsWithInstance", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for managed databases in a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation - /// - /// - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for managed databases in a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation - /// - /// - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationRequest(Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByResourceGroupLocationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs index fd3093d6ab124..66bf00adace08 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs @@ -13,6 +13,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.Resources; using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.Sql.Mocking; using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql @@ -20,2437 +21,2049 @@ namespace Azure.ResourceManager.Sql /// A class to add extension methods to Azure.ResourceManager.Sql. public static partial class SqlExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSqlArmClient GetMockableSqlArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSqlArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSqlResourceGroupResource GetMockableSqlResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSqlResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSqlSubscriptionResource GetMockableSqlSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSqlSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DataMaskingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataMaskingPolicyResource GetDataMaskingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataMaskingPolicyResource.ValidateResourceId(id); - return new DataMaskingPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetDataMaskingPolicyResource(id); } - #endregion - #region GeoBackupPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static GeoBackupPolicyResource GetGeoBackupPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - GeoBackupPolicyResource.ValidateResourceId(id); - return new GeoBackupPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetGeoBackupPolicyResource(id); } - #endregion - #region SqlServerCommunicationLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerCommunicationLinkResource GetSqlServerCommunicationLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerCommunicationLinkResource.ValidateResourceId(id); - return new SqlServerCommunicationLinkResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerCommunicationLinkResource(id); } - #endregion - #region ServiceObjectiveResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServiceObjectiveResource GetServiceObjectiveResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServiceObjectiveResource.ValidateResourceId(id); - return new ServiceObjectiveResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetServiceObjectiveResource(id); } - #endregion - #region SqlDatabaseAdvisorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseAdvisorResource GetSqlDatabaseAdvisorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseAdvisorResource.ValidateResourceId(id); - return new SqlDatabaseAdvisorResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseAdvisorResource(id); } - #endregion - #region SqlServerAdvisorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerAdvisorResource GetSqlServerAdvisorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerAdvisorResource.ValidateResourceId(id); - return new SqlServerAdvisorResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerAdvisorResource(id); } - #endregion - #region SqlDatabaseAutomaticTuningResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseAutomaticTuningResource GetSqlDatabaseAutomaticTuningResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseAutomaticTuningResource.ValidateResourceId(id); - return new SqlDatabaseAutomaticTuningResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseAutomaticTuningResource(id); } - #endregion - #region SqlDatabaseColumnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseColumnResource GetSqlDatabaseColumnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseColumnResource.ValidateResourceId(id); - return new SqlDatabaseColumnResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseColumnResource(id); } - #endregion - #region ManagedDatabaseColumnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseColumnResource GetManagedDatabaseColumnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseColumnResource.ValidateResourceId(id); - return new ManagedDatabaseColumnResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseColumnResource(id); } - #endregion - #region RecommendedActionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RecommendedActionResource GetRecommendedActionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RecommendedActionResource.ValidateResourceId(id); - return new RecommendedActionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetRecommendedActionResource(id); } - #endregion - #region SqlDatabaseSchemaResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseSchemaResource GetSqlDatabaseSchemaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseSchemaResource.ValidateResourceId(id); - return new SqlDatabaseSchemaResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseSchemaResource(id); } - #endregion - #region ManagedDatabaseSchemaResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseSchemaResource GetManagedDatabaseSchemaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseSchemaResource.ValidateResourceId(id); - return new ManagedDatabaseSchemaResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseSchemaResource(id); } - #endregion - #region SqlDatabaseSecurityAlertPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseSecurityAlertPolicyResource GetSqlDatabaseSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseSecurityAlertPolicyResource.ValidateResourceId(id); - return new SqlDatabaseSecurityAlertPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseSecurityAlertPolicyResource(id); } - #endregion - #region SqlDatabaseTableResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseTableResource GetSqlDatabaseTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseTableResource.ValidateResourceId(id); - return new SqlDatabaseTableResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseTableResource(id); } - #endregion - #region ManagedDatabaseTableResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseTableResource GetManagedDatabaseTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseTableResource.ValidateResourceId(id); - return new ManagedDatabaseTableResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseTableResource(id); } - #endregion - #region SqlDatabaseVulnerabilityAssessmentRuleBaselineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseVulnerabilityAssessmentRuleBaselineResource GetSqlDatabaseVulnerabilityAssessmentRuleBaselineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseVulnerabilityAssessmentRuleBaselineResource.ValidateResourceId(id); - return new SqlDatabaseVulnerabilityAssessmentRuleBaselineResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseVulnerabilityAssessmentRuleBaselineResource(id); } - #endregion - #region ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource GetManagedDatabaseVulnerabilityAssessmentRuleBaselineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource.ValidateResourceId(id); - return new ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseVulnerabilityAssessmentRuleBaselineResource(id); } - #endregion - #region SqlDatabaseVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseVulnerabilityAssessmentResource GetSqlDatabaseVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseVulnerabilityAssessmentResource.ValidateResourceId(id); - return new SqlDatabaseVulnerabilityAssessmentResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseVulnerabilityAssessmentResource(id); } - #endregion - #region ManagedDatabaseVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseVulnerabilityAssessmentResource GetManagedDatabaseVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseVulnerabilityAssessmentResource.ValidateResourceId(id); - return new ManagedDatabaseVulnerabilityAssessmentResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseVulnerabilityAssessmentResource(id); } - #endregion - #region SqlDatabaseVulnerabilityAssessmentScanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseVulnerabilityAssessmentScanResource GetSqlDatabaseVulnerabilityAssessmentScanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseVulnerabilityAssessmentScanResource.ValidateResourceId(id); - return new SqlDatabaseVulnerabilityAssessmentScanResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseVulnerabilityAssessmentScanResource(id); } - #endregion - #region ManagedDatabaseVulnerabilityAssessmentScanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseVulnerabilityAssessmentScanResource GetManagedDatabaseVulnerabilityAssessmentScanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseVulnerabilityAssessmentScanResource.ValidateResourceId(id); - return new ManagedDatabaseVulnerabilityAssessmentScanResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseVulnerabilityAssessmentScanResource(id); } - #endregion - #region DataWarehouseUserActivityResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DataWarehouseUserActivityResource GetDataWarehouseUserActivityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DataWarehouseUserActivityResource.ValidateResourceId(id); - return new DataWarehouseUserActivityResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetDataWarehouseUserActivityResource(id); } - #endregion - #region DeletedServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeletedServerResource GetDeletedServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeletedServerResource.ValidateResourceId(id); - return new DeletedServerResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetDeletedServerResource(id); } - #endregion - #region EncryptionProtectorResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EncryptionProtectorResource GetEncryptionProtectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EncryptionProtectorResource.ValidateResourceId(id); - return new EncryptionProtectorResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetEncryptionProtectorResource(id); } - #endregion - #region SqlFirewallRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlFirewallRuleResource GetSqlFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlFirewallRuleResource.ValidateResourceId(id); - return new SqlFirewallRuleResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlFirewallRuleResource(id); } - #endregion - #region InstancePoolResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static InstancePoolResource GetInstancePoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - InstancePoolResource.ValidateResourceId(id); - return new InstancePoolResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetInstancePoolResource(id); } - #endregion - #region SqlServerJobAgentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobAgentResource GetSqlServerJobAgentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobAgentResource.ValidateResourceId(id); - return new SqlServerJobAgentResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobAgentResource(id); } - #endregion - #region SqlServerJobCredentialResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobCredentialResource GetSqlServerJobCredentialResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobCredentialResource.ValidateResourceId(id); - return new SqlServerJobCredentialResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobCredentialResource(id); } - #endregion - #region SqlServerJobExecutionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobExecutionResource GetSqlServerJobExecutionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobExecutionResource.ValidateResourceId(id); - return new SqlServerJobExecutionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobExecutionResource(id); } - #endregion - #region SqlServerJobExecutionStepResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobExecutionStepResource GetSqlServerJobExecutionStepResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobExecutionStepResource.ValidateResourceId(id); - return new SqlServerJobExecutionStepResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobExecutionStepResource(id); } - #endregion - #region SqlServerJobExecutionStepTargetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobExecutionStepTargetResource GetSqlServerJobExecutionStepTargetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobExecutionStepTargetResource.ValidateResourceId(id); - return new SqlServerJobExecutionStepTargetResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobExecutionStepTargetResource(id); } - #endregion - #region SqlServerJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobResource GetSqlServerJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobResource.ValidateResourceId(id); - return new SqlServerJobResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobResource(id); } - #endregion - #region SqlServerJobVersionStepResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobVersionStepResource GetSqlServerJobVersionStepResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobVersionStepResource.ValidateResourceId(id); - return new SqlServerJobVersionStepResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobVersionStepResource(id); } - #endregion - #region SqlServerJobStepResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobStepResource GetSqlServerJobStepResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobStepResource.ValidateResourceId(id); - return new SqlServerJobStepResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobStepResource(id); } - #endregion - #region SqlServerJobTargetGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobTargetGroupResource GetSqlServerJobTargetGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobTargetGroupResource.ValidateResourceId(id); - return new SqlServerJobTargetGroupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobTargetGroupResource(id); } - #endregion - #region SqlServerJobVersionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerJobVersionResource GetSqlServerJobVersionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerJobVersionResource.ValidateResourceId(id); - return new SqlServerJobVersionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerJobVersionResource(id); } - #endregion - #region LongTermRetentionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LongTermRetentionPolicyResource.ValidateResourceId(id); - return new LongTermRetentionPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetLongTermRetentionPolicyResource(id); } - #endregion - #region MaintenanceWindowOptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MaintenanceWindowOptionResource GetMaintenanceWindowOptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MaintenanceWindowOptionResource.ValidateResourceId(id); - return new MaintenanceWindowOptionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetMaintenanceWindowOptionResource(id); } - #endregion - #region MaintenanceWindowsResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MaintenanceWindowsResource GetMaintenanceWindowsResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MaintenanceWindowsResource.ValidateResourceId(id); - return new MaintenanceWindowsResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetMaintenanceWindowsResource(id); } - #endregion - #region ManagedBackupShortTermRetentionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedBackupShortTermRetentionPolicyResource GetManagedBackupShortTermRetentionPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedBackupShortTermRetentionPolicyResource.ValidateResourceId(id); - return new ManagedBackupShortTermRetentionPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedBackupShortTermRetentionPolicyResource(id); } - #endregion - #region ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource GetManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource.ValidateResourceId(id); - return new ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource(id); } - #endregion - #region ManagedDatabaseSecurityAlertPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseSecurityAlertPolicyResource GetManagedDatabaseSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseSecurityAlertPolicyResource.ValidateResourceId(id); - return new ManagedDatabaseSecurityAlertPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseSecurityAlertPolicyResource(id); } - #endregion - #region ManagedTransparentDataEncryptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedTransparentDataEncryptionResource GetManagedTransparentDataEncryptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedTransparentDataEncryptionResource.ValidateResourceId(id); - return new ManagedTransparentDataEncryptionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedTransparentDataEncryptionResource(id); } - #endregion - #region ManagedInstanceAdministratorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceAdministratorResource GetManagedInstanceAdministratorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceAdministratorResource.ValidateResourceId(id); - return new ManagedInstanceAdministratorResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceAdministratorResource(id); } - #endregion - #region ManagedInstanceAzureADOnlyAuthenticationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceAzureADOnlyAuthenticationResource GetManagedInstanceAzureADOnlyAuthenticationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceAzureADOnlyAuthenticationResource.ValidateResourceId(id); - return new ManagedInstanceAzureADOnlyAuthenticationResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceAzureADOnlyAuthenticationResource(id); } - #endregion - #region ManagedInstanceEncryptionProtectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceEncryptionProtectorResource GetManagedInstanceEncryptionProtectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceEncryptionProtectorResource.ValidateResourceId(id); - return new ManagedInstanceEncryptionProtectorResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceEncryptionProtectorResource(id); } - #endregion - #region ManagedInstanceKeyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceKeyResource GetManagedInstanceKeyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceKeyResource.ValidateResourceId(id); - return new ManagedInstanceKeyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceKeyResource(id); } - #endregion - #region ManagedInstanceLongTermRetentionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceLongTermRetentionPolicyResource GetManagedInstanceLongTermRetentionPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceLongTermRetentionPolicyResource.ValidateResourceId(id); - return new ManagedInstanceLongTermRetentionPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceLongTermRetentionPolicyResource(id); } - #endregion - #region ManagedInstanceOperationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceOperationResource GetManagedInstanceOperationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceOperationResource.ValidateResourceId(id); - return new ManagedInstanceOperationResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceOperationResource(id); } - #endregion - #region ManagedInstancePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstancePrivateEndpointConnectionResource GetManagedInstancePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstancePrivateEndpointConnectionResource.ValidateResourceId(id); - return new ManagedInstancePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstancePrivateEndpointConnectionResource(id); } - #endregion - #region ManagedInstancePrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstancePrivateLinkResource GetManagedInstancePrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstancePrivateLinkResource.ValidateResourceId(id); - return new ManagedInstancePrivateLinkResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstancePrivateLinkResource(id); } - #endregion - #region ManagedInstanceVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceVulnerabilityAssessmentResource GetManagedInstanceVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceVulnerabilityAssessmentResource.ValidateResourceId(id); - return new ManagedInstanceVulnerabilityAssessmentResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceVulnerabilityAssessmentResource(id); } - #endregion - #region ManagedServerSecurityAlertPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedServerSecurityAlertPolicyResource GetManagedServerSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedServerSecurityAlertPolicyResource.ValidateResourceId(id); - return new ManagedServerSecurityAlertPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedServerSecurityAlertPolicyResource(id); } - #endregion - #region SqlPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlPrivateEndpointConnectionResource GetSqlPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlPrivateEndpointConnectionResource.ValidateResourceId(id); - return new SqlPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlPrivateEndpointConnectionResource(id); } - #endregion - #region SqlPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlPrivateLinkResource GetSqlPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlPrivateLinkResource.ValidateResourceId(id); - return new SqlPrivateLinkResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlPrivateLinkResource(id); } - #endregion - #region RecoverableManagedDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RecoverableManagedDatabaseResource GetRecoverableManagedDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RecoverableManagedDatabaseResource.ValidateResourceId(id); - return new RecoverableManagedDatabaseResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetRecoverableManagedDatabaseResource(id); } - #endregion - #region SqlServerDatabaseRestorePointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerDatabaseRestorePointResource GetSqlServerDatabaseRestorePointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerDatabaseRestorePointResource.ValidateResourceId(id); - return new SqlServerDatabaseRestorePointResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerDatabaseRestorePointResource(id); } - #endregion - #region SqlServerAutomaticTuningResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerAutomaticTuningResource GetSqlServerAutomaticTuningResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerAutomaticTuningResource.ValidateResourceId(id); - return new SqlServerAutomaticTuningResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerAutomaticTuningResource(id); } - #endregion - #region SqlServerAzureADAdministratorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerAzureADAdministratorResource GetSqlServerAzureADAdministratorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerAzureADAdministratorResource.ValidateResourceId(id); - return new SqlServerAzureADAdministratorResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerAzureADAdministratorResource(id); } - #endregion - #region SqlServerAzureADOnlyAuthenticationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerAzureADOnlyAuthenticationResource GetSqlServerAzureADOnlyAuthenticationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerAzureADOnlyAuthenticationResource.ValidateResourceId(id); - return new SqlServerAzureADOnlyAuthenticationResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerAzureADOnlyAuthenticationResource(id); } - #endregion - #region SqlServerDevOpsAuditingSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerDevOpsAuditingSettingResource GetSqlServerDevOpsAuditingSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerDevOpsAuditingSettingResource.ValidateResourceId(id); - return new SqlServerDevOpsAuditingSettingResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerDevOpsAuditingSettingResource(id); } - #endregion - #region SqlServerDnsAliasResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerDnsAliasResource GetSqlServerDnsAliasResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerDnsAliasResource.ValidateResourceId(id); - return new SqlServerDnsAliasResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerDnsAliasResource(id); } - #endregion - #region SqlServerKeyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerKeyResource GetSqlServerKeyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerKeyResource.ValidateResourceId(id); - return new SqlServerKeyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerKeyResource(id); } - #endregion - #region SqlServerSecurityAlertPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerSecurityAlertPolicyResource GetSqlServerSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerSecurityAlertPolicyResource.ValidateResourceId(id); - return new SqlServerSecurityAlertPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerSecurityAlertPolicyResource(id); } - #endregion - #region SqlServerTrustGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerTrustGroupResource GetSqlServerTrustGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerTrustGroupResource.ValidateResourceId(id); - return new SqlServerTrustGroupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerTrustGroupResource(id); } - #endregion - #region SqlServerVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerVulnerabilityAssessmentResource GetSqlServerVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerVulnerabilityAssessmentResource.ValidateResourceId(id); - return new SqlServerVulnerabilityAssessmentResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerVulnerabilityAssessmentResource(id); } - #endregion - #region SqlAgentConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlAgentConfigurationResource GetSqlAgentConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlAgentConfigurationResource.ValidateResourceId(id); - return new SqlAgentConfigurationResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlAgentConfigurationResource(id); } - #endregion - #region SubscriptionUsageResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubscriptionUsageResource GetSubscriptionUsageResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionUsageResource.ValidateResourceId(id); - return new SubscriptionUsageResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSubscriptionUsageResource(id); } - #endregion - #region SyncAgentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SyncAgentResource GetSyncAgentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SyncAgentResource.ValidateResourceId(id); - return new SyncAgentResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSyncAgentResource(id); } - #endregion - #region SyncGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SyncGroupResource GetSyncGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SyncGroupResource.ValidateResourceId(id); - return new SyncGroupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSyncGroupResource(id); } - #endregion - #region SyncMemberResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SyncMemberResource GetSyncMemberResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SyncMemberResource.ValidateResourceId(id); - return new SyncMemberResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSyncMemberResource(id); } - #endregion - #region SqlTimeZoneResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlTimeZoneResource GetSqlTimeZoneResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlTimeZoneResource.ValidateResourceId(id); - return new SqlTimeZoneResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlTimeZoneResource(id); } - #endregion - #region SqlServerVirtualNetworkRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerVirtualNetworkRuleResource GetSqlServerVirtualNetworkRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerVirtualNetworkRuleResource.ValidateResourceId(id); - return new SqlServerVirtualNetworkRuleResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerVirtualNetworkRuleResource(id); } - #endregion - #region WorkloadClassifierResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadClassifierResource GetWorkloadClassifierResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadClassifierResource.ValidateResourceId(id); - return new WorkloadClassifierResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetWorkloadClassifierResource(id); } - #endregion - #region WorkloadGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WorkloadGroupResource GetWorkloadGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WorkloadGroupResource.ValidateResourceId(id); - return new WorkloadGroupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetWorkloadGroupResource(id); } - #endregion - #region BackupShortTermRetentionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BackupShortTermRetentionPolicyResource GetBackupShortTermRetentionPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BackupShortTermRetentionPolicyResource.ValidateResourceId(id); - return new BackupShortTermRetentionPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetBackupShortTermRetentionPolicyResource(id); } - #endregion - #region LedgerDigestUploadResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LedgerDigestUploadResource GetLedgerDigestUploadResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LedgerDigestUploadResource.ValidateResourceId(id); - return new LedgerDigestUploadResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetLedgerDigestUploadResource(id); } - #endregion - #region OutboundFirewallRuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static OutboundFirewallRuleResource GetOutboundFirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - OutboundFirewallRuleResource.ValidateResourceId(id); - return new OutboundFirewallRuleResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetOutboundFirewallRuleResource(id); } - #endregion - #region SubscriptionLongTermRetentionBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubscriptionLongTermRetentionBackupResource GetSubscriptionLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionLongTermRetentionBackupResource.ValidateResourceId(id); - return new SubscriptionLongTermRetentionBackupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSubscriptionLongTermRetentionBackupResource(id); } - #endregion - #region ResourceGroupLongTermRetentionBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourceGroupLongTermRetentionBackupResource GetResourceGroupLongTermRetentionBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceGroupLongTermRetentionBackupResource.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionBackupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetResourceGroupLongTermRetentionBackupResource(id); } - #endregion - #region SubscriptionLongTermRetentionManagedInstanceBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubscriptionLongTermRetentionManagedInstanceBackupResource GetSubscriptionLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); - return new SubscriptionLongTermRetentionManagedInstanceBackupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSubscriptionLongTermRetentionManagedInstanceBackupResource(id); } - #endregion - #region ResourceGroupLongTermRetentionManagedInstanceBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ResourceGroupLongTermRetentionManagedInstanceBackupResource GetResourceGroupLongTermRetentionManagedInstanceBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ResourceGroupLongTermRetentionManagedInstanceBackupResource.ValidateResourceId(id); - return new ResourceGroupLongTermRetentionManagedInstanceBackupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetResourceGroupLongTermRetentionManagedInstanceBackupResource(id); } - #endregion - #region RestorableDroppedManagedDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RestorableDroppedManagedDatabaseResource GetRestorableDroppedManagedDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RestorableDroppedManagedDatabaseResource.ValidateResourceId(id); - return new RestorableDroppedManagedDatabaseResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetRestorableDroppedManagedDatabaseResource(id); } - #endregion - #region SqlServerConnectionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerConnectionPolicyResource GetSqlServerConnectionPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerConnectionPolicyResource.ValidateResourceId(id); - return new SqlServerConnectionPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerConnectionPolicyResource(id); } - #endregion - #region DistributedAvailabilityGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DistributedAvailabilityGroupResource GetDistributedAvailabilityGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DistributedAvailabilityGroupResource.ValidateResourceId(id); - return new DistributedAvailabilityGroupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetDistributedAvailabilityGroupResource(id); } - #endregion - #region ManagedInstanceServerTrustCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceServerTrustCertificateResource GetManagedInstanceServerTrustCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceServerTrustCertificateResource.ValidateResourceId(id); - return new ManagedInstanceServerTrustCertificateResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceServerTrustCertificateResource(id); } - #endregion - #region EndpointCertificateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EndpointCertificateResource GetEndpointCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EndpointCertificateResource.ValidateResourceId(id); - return new EndpointCertificateResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetEndpointCertificateResource(id); } - #endregion - #region ManagedDatabaseSensitivityLabelResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseSensitivityLabelResource GetManagedDatabaseSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseSensitivityLabelResource.ValidateResourceId(id); - return new ManagedDatabaseSensitivityLabelResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseSensitivityLabelResource(id); } - #endregion - #region SqlDatabaseSensitivityLabelResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseSensitivityLabelResource GetSqlDatabaseSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseSensitivityLabelResource.ValidateResourceId(id); - return new SqlDatabaseSensitivityLabelResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseSensitivityLabelResource(id); } - #endregion - #region SqlServerBlobAuditingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerBlobAuditingPolicyResource GetSqlServerBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerBlobAuditingPolicyResource.ValidateResourceId(id); - return new SqlServerBlobAuditingPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerBlobAuditingPolicyResource(id); } - #endregion - #region SqlDatabaseBlobAuditingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseBlobAuditingPolicyResource GetSqlDatabaseBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseBlobAuditingPolicyResource.ValidateResourceId(id); - return new SqlDatabaseBlobAuditingPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseBlobAuditingPolicyResource(id); } - #endregion - #region ExtendedDatabaseBlobAuditingPolicyResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExtendedDatabaseBlobAuditingPolicyResource GetExtendedDatabaseBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExtendedDatabaseBlobAuditingPolicyResource.ValidateResourceId(id); - return new ExtendedDatabaseBlobAuditingPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetExtendedDatabaseBlobAuditingPolicyResource(id); } - #endregion - #region ExtendedServerBlobAuditingPolicyResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ExtendedServerBlobAuditingPolicyResource GetExtendedServerBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ExtendedServerBlobAuditingPolicyResource.ValidateResourceId(id); - return new ExtendedServerBlobAuditingPolicyResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetExtendedServerBlobAuditingPolicyResource(id); } - #endregion - #region DatabaseAdvancedThreatProtectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DatabaseAdvancedThreatProtectionResource GetDatabaseAdvancedThreatProtectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DatabaseAdvancedThreatProtectionResource.ValidateResourceId(id); - return new DatabaseAdvancedThreatProtectionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetDatabaseAdvancedThreatProtectionResource(id); } - #endregion - #region ServerAdvancedThreatProtectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ServerAdvancedThreatProtectionResource GetServerAdvancedThreatProtectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ServerAdvancedThreatProtectionResource.ValidateResourceId(id); - return new ServerAdvancedThreatProtectionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetServerAdvancedThreatProtectionResource(id); } - #endregion - #region ManagedServerDnsAliasResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedServerDnsAliasResource GetManagedServerDnsAliasResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedServerDnsAliasResource.ValidateResourceId(id); - return new ManagedServerDnsAliasResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedServerDnsAliasResource(id); } - #endregion - #region ManagedDatabaseAdvancedThreatProtectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseAdvancedThreatProtectionResource GetManagedDatabaseAdvancedThreatProtectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseAdvancedThreatProtectionResource.ValidateResourceId(id); - return new ManagedDatabaseAdvancedThreatProtectionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseAdvancedThreatProtectionResource(id); } - #endregion - #region ManagedInstanceAdvancedThreatProtectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceAdvancedThreatProtectionResource GetManagedInstanceAdvancedThreatProtectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceAdvancedThreatProtectionResource.ValidateResourceId(id); - return new ManagedInstanceAdvancedThreatProtectionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceAdvancedThreatProtectionResource(id); } - #endregion - #region SqlServerDatabaseReplicationLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseReplicationLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerDatabaseReplicationLinkResource.ValidateResourceId(id); - return new SqlServerDatabaseReplicationLinkResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerDatabaseReplicationLinkResource(id); } - #endregion - #region ManagedInstanceDtcResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceDtcResource GetManagedInstanceDtcResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceDtcResource.ValidateResourceId(id); - return new ManagedInstanceDtcResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceDtcResource(id); } - #endregion - #region VirtualClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VirtualClusterResource GetVirtualClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VirtualClusterResource.ValidateResourceId(id); - return new VirtualClusterResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetVirtualClusterResource(id); } - #endregion - #region InstanceFailoverGroupResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static InstanceFailoverGroupResource GetInstanceFailoverGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - InstanceFailoverGroupResource.ValidateResourceId(id); - return new InstanceFailoverGroupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetInstanceFailoverGroupResource(id); } - #endregion - #region ManagedDatabaseRestoreDetailResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseRestoreDetailResource GetManagedDatabaseRestoreDetailResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseRestoreDetailResource.ValidateResourceId(id); - return new ManagedDatabaseRestoreDetailResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseRestoreDetailResource(id); } - #endregion - #region SqlDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseResource GetSqlDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseResource.ValidateResourceId(id); - return new SqlDatabaseResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseResource(id); } - #endregion - #region ElasticPoolResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ElasticPoolResource GetElasticPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ElasticPoolResource.ValidateResourceId(id); - return new ElasticPoolResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetElasticPoolResource(id); } - #endregion - #region ManagedDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedDatabaseResource GetManagedDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedDatabaseResource.ValidateResourceId(id); - return new ManagedDatabaseResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedDatabaseResource(id); } - #endregion - #region ManagedInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceResource GetManagedInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceResource.ValidateResourceId(id); - return new ManagedInstanceResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceResource(id); } - #endregion - #region ManagedLedgerDigestUploadResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedLedgerDigestUploadResource GetManagedLedgerDigestUploadResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedLedgerDigestUploadResource.ValidateResourceId(id); - return new ManagedLedgerDigestUploadResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedLedgerDigestUploadResource(id); } - #endregion - #region RecoverableDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RecoverableDatabaseResource GetRecoverableDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RecoverableDatabaseResource.ValidateResourceId(id); - return new RecoverableDatabaseResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetRecoverableDatabaseResource(id); } - #endregion - #region RestorableDroppedDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static RestorableDroppedDatabaseResource GetRestorableDroppedDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - RestorableDroppedDatabaseResource.ValidateResourceId(id); - return new RestorableDroppedDatabaseResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetRestorableDroppedDatabaseResource(id); } - #endregion - #region ManagedInstanceServerConfigurationOptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceServerConfigurationOptionResource GetManagedInstanceServerConfigurationOptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceServerConfigurationOptionResource.ValidateResourceId(id); - return new ManagedInstanceServerConfigurationOptionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceServerConfigurationOptionResource(id); } - #endregion - #region ManagedInstanceStartStopScheduleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ManagedInstanceStartStopScheduleResource GetManagedInstanceStartStopScheduleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ManagedInstanceStartStopScheduleResource.ValidateResourceId(id); - return new ManagedInstanceStartStopScheduleResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetManagedInstanceStartStopScheduleResource(id); } - #endregion - #region LogicalDatabaseTransparentDataEncryptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogicalDatabaseTransparentDataEncryptionResource GetLogicalDatabaseTransparentDataEncryptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogicalDatabaseTransparentDataEncryptionResource.ValidateResourceId(id); - return new LogicalDatabaseTransparentDataEncryptionResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetLogicalDatabaseTransparentDataEncryptionResource(id); } - #endregion - #region IPv6FirewallRuleResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static IPv6FirewallRuleResource GetIPv6FirewallRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - IPv6FirewallRuleResource.ValidateResourceId(id); - return new IPv6FirewallRuleResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetIPv6FirewallRuleResource(id); } - #endregion - #region SqlServerSqlVulnerabilityAssessmentBaselineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerSqlVulnerabilityAssessmentBaselineResource GetSqlServerSqlVulnerabilityAssessmentBaselineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerSqlVulnerabilityAssessmentBaselineResource.ValidateResourceId(id); - return new SqlServerSqlVulnerabilityAssessmentBaselineResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerSqlVulnerabilityAssessmentBaselineResource(id); } - #endregion - #region SqlDatabaseSqlVulnerabilityAssessmentBaselineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseSqlVulnerabilityAssessmentBaselineResource GetSqlDatabaseSqlVulnerabilityAssessmentBaselineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.ValidateResourceId(id); - return new SqlDatabaseSqlVulnerabilityAssessmentBaselineResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseSqlVulnerabilityAssessmentBaselineResource(id); } - #endregion - #region SqlServerSqlVulnerabilityAssessmentBaselineRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerSqlVulnerabilityAssessmentBaselineRuleResource GetSqlServerSqlVulnerabilityAssessmentBaselineRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerSqlVulnerabilityAssessmentBaselineRuleResource.ValidateResourceId(id); - return new SqlServerSqlVulnerabilityAssessmentBaselineRuleResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerSqlVulnerabilityAssessmentBaselineRuleResource(id); } - #endregion - #region SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource GetSqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource.ValidateResourceId(id); - return new SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource(id); } - #endregion - #region SqlServerSqlVulnerabilityAssessmentScanResultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerSqlVulnerabilityAssessmentScanResultResource GetSqlServerSqlVulnerabilityAssessmentScanResultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerSqlVulnerabilityAssessmentScanResultResource.ValidateResourceId(id); - return new SqlServerSqlVulnerabilityAssessmentScanResultResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerSqlVulnerabilityAssessmentScanResultResource(id); } - #endregion - #region SqlDatabaseSqlVulnerabilityAssessmentScanResultResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseSqlVulnerabilityAssessmentScanResultResource GetSqlDatabaseSqlVulnerabilityAssessmentScanResultResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseSqlVulnerabilityAssessmentScanResultResource.ValidateResourceId(id); - return new SqlDatabaseSqlVulnerabilityAssessmentScanResultResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseSqlVulnerabilityAssessmentScanResultResource(id); } - #endregion - #region SqlServerSqlVulnerabilityAssessmentScanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerSqlVulnerabilityAssessmentScanResource GetSqlServerSqlVulnerabilityAssessmentScanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerSqlVulnerabilityAssessmentScanResource.ValidateResourceId(id); - return new SqlServerSqlVulnerabilityAssessmentScanResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerSqlVulnerabilityAssessmentScanResource(id); } - #endregion - #region SqlDatabaseSqlVulnerabilityAssessmentScanResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseSqlVulnerabilityAssessmentScanResource GetSqlDatabaseSqlVulnerabilityAssessmentScanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseSqlVulnerabilityAssessmentScanResource.ValidateResourceId(id); - return new SqlDatabaseSqlVulnerabilityAssessmentScanResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseSqlVulnerabilityAssessmentScanResource(id); } - #endregion - #region SqlServerSqlVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerSqlVulnerabilityAssessmentResource GetSqlServerSqlVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerSqlVulnerabilityAssessmentResource.ValidateResourceId(id); - return new SqlServerSqlVulnerabilityAssessmentResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerSqlVulnerabilityAssessmentResource(id); } - #endregion - #region SqlDatabaseSqlVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlDatabaseSqlVulnerabilityAssessmentResource GetSqlDatabaseSqlVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlDatabaseSqlVulnerabilityAssessmentResource.ValidateResourceId(id); - return new SqlDatabaseSqlVulnerabilityAssessmentResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlDatabaseSqlVulnerabilityAssessmentResource(id); } - #endregion - #region SqlServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlServerResource GetSqlServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlServerResource.ValidateResourceId(id); - return new SqlServerResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetSqlServerResource(id); } - #endregion - #region FailoverGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FailoverGroupResource GetFailoverGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FailoverGroupResource.ValidateResourceId(id); - return new FailoverGroupResource(client, id); - } - ); + return GetMockableSqlArmClient(client).GetFailoverGroupResource(id); } - #endregion - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// + /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetInstancePools(); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePools(); } /// @@ -2465,16 +2078,20 @@ public static InstancePoolCollection GetInstancePools(this ResourceGroupResource /// InstancePools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the instance pool to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePoolAsync(instancePoolName, cancellationToken).ConfigureAwait(false); } /// @@ -2489,25 +2106,35 @@ public static async Task> GetInstancePoolAsync(th /// InstancePools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the instance pool to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetInstancePools().Get(instancePoolName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePool(instancePoolName, cancellationToken); } - /// Gets a collection of SqlServerTrustGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of SqlServerTrustGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// An object representing collection of SqlServerTrustGroupResources and their operations over a SqlServerTrustGroupResource. public static SqlServerTrustGroupCollection GetSqlServerTrustGroups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSqlServerTrustGroups(locationName); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetSqlServerTrustGroups(locationName); } /// @@ -2522,17 +2149,21 @@ public static SqlServerTrustGroupCollection GetSqlServerTrustGroups(this Resourc /// ServerTrustGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// The name of the server trust group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSqlServerTrustGroupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSqlServerTrustGroups(locationName).GetAsync(serverTrustGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetSqlServerTrustGroupAsync(locationName, serverTrustGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -2547,33 +2178,40 @@ public static async Task> GetSqlServerTrus /// ServerTrustGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// The name of the server trust group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSqlServerTrustGroup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSqlServerTrustGroups(locationName).Get(serverTrustGroupName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetSqlServerTrustGroup(locationName, serverTrustGroupName, cancellationToken); } - /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. + /// + /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The location of the database. /// The name of the server. /// The name of the database. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. public static ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); } /// @@ -2588,6 +2226,10 @@ public static ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLon /// LongTermRetentionBackups_GetByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -2595,12 +2237,12 @@ public static ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLon /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceGroupLongTermRetentionBackupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackupAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); } /// @@ -2615,6 +2257,10 @@ public static async Task> /// LongTermRetentionBackups_GetByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -2622,28 +2268,31 @@ public static async Task> /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceGroupLongTermRetentionBackup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackup(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); } - /// Gets a collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources in the ResourceGroupResource. + /// + /// Gets a collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The location of the database. /// The name of the managed instance. /// The name of the managed database. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. /// An object representing collection of ResourceGroupLongTermRetentionManagedInstanceBackupResources and their operations over a ResourceGroupLongTermRetentionManagedInstanceBackupResource. public static ResourceGroupLongTermRetentionManagedInstanceBackupCollection GetResourceGroupLongTermRetentionManagedInstanceBackups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName); } /// @@ -2658,6 +2307,10 @@ public static ResourceGroupLongTermRetentionManagedInstanceBackupCollection GetR /// LongTermRetentionManagedInstanceBackups_GetByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -2665,12 +2318,12 @@ public static ResourceGroupLongTermRetentionManagedInstanceBackupCollection GetR /// The name of the managed database. /// The backup name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetResourceGroupLongTermRetentionManagedInstanceBackupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackupAsync(locationName, managedInstanceName, databaseName, backupName, cancellationToken).ConfigureAwait(false); } /// @@ -2685,6 +2338,10 @@ public static async TaskLongTermRetentionManagedInstanceBackups_GetByResourceGroup /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -2692,20 +2349,26 @@ public static async Task The name of the managed database. /// The backup name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetResourceGroupLongTermRetentionManagedInstanceBackup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetResourceGroupLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName).Get(backupName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionManagedInstanceBackup(locationName, managedInstanceName, databaseName, backupName, cancellationToken); } - /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of VirtualClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VirtualClusterResources and their operations over a VirtualClusterResource. public static VirtualClusterCollection GetVirtualClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVirtualClusters(); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetVirtualClusters(); } /// @@ -2720,16 +2383,20 @@ public static VirtualClusterCollection GetVirtualClusters(this ResourceGroupReso /// VirtualClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVirtualClusterAsync(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVirtualClusters().GetAsync(virtualClusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetVirtualClusterAsync(virtualClusterName, cancellationToken).ConfigureAwait(false); } /// @@ -2744,25 +2411,35 @@ public static async Task> GetVirtualClusterAsyn /// VirtualClusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the virtual cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVirtualCluster(this ResourceGroupResource resourceGroupResource, string virtualClusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVirtualClusters().Get(virtualClusterName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetVirtualCluster(virtualClusterName, cancellationToken); } - /// Gets a collection of InstanceFailoverGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of InstanceFailoverGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// An object representing collection of InstanceFailoverGroupResources and their operations over a InstanceFailoverGroupResource. public static InstanceFailoverGroupCollection GetInstanceFailoverGroups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetInstanceFailoverGroups(locationName); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstanceFailoverGroups(locationName); } /// @@ -2777,17 +2454,21 @@ public static InstanceFailoverGroupCollection GetInstanceFailoverGroups(this Res /// InstanceFailoverGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// The name of the failover group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetInstanceFailoverGroupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string failoverGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetInstanceFailoverGroups(locationName).GetAsync(failoverGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstanceFailoverGroupAsync(locationName, failoverGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -2802,25 +2483,35 @@ public static async Task> GetInstanceFai /// InstanceFailoverGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// The name of the failover group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetInstanceFailoverGroup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string failoverGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetInstanceFailoverGroups(locationName).Get(failoverGroupName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstanceFailoverGroup(locationName, failoverGroupName, cancellationToken); } - /// Gets a collection of ManagedInstanceResources in the ResourceGroupResource. + /// + /// Gets a collection of ManagedInstanceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of ManagedInstanceResources and their operations over a ManagedInstanceResource. public static ManagedInstanceCollection GetManagedInstances(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetManagedInstances(); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstances(); } /// @@ -2835,17 +2526,21 @@ public static ManagedInstanceCollection GetManagedInstances(this ResourceGroupRe /// ManagedInstances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed instance. /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetManagedInstanceAsync(this ResourceGroupResource resourceGroupResource, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetManagedInstances().GetAsync(managedInstanceName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstanceAsync(managedInstanceName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -2860,25 +2555,35 @@ public static async Task> GetManagedInstanceAs /// ManagedInstances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the managed instance. /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetManagedInstance(this ResourceGroupResource resourceGroupResource, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetManagedInstances().Get(managedInstanceName, expand, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstance(managedInstanceName, expand, cancellationToken); } - /// Gets a collection of SqlServerResources in the ResourceGroupResource. + /// + /// Gets a collection of SqlServerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. public static SqlServerCollection GetSqlServers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSqlServers(); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetSqlServers(); } /// @@ -2893,17 +2598,21 @@ public static SqlServerCollection GetSqlServers(this ResourceGroupResource resou /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSqlServerAsync(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSqlServers().GetAsync(serverName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetSqlServerAsync(serverName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -2918,17 +2627,21 @@ public static async Task> GetSqlServerAsync(this Res /// Servers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the server. /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSqlServer(this ResourceGroupResource resourceGroupResource, string serverName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSqlServers().Get(serverName, expand, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetSqlServer(serverName, expand, cancellationToken); } /// @@ -2943,6 +2656,10 @@ public static Response GetSqlServer(this ResourceGroupResourc /// LongTermRetentionBackups_ListByResourceGroupLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -2952,7 +2669,7 @@ public static Response GetSqlServer(this ResourceGroupResourc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -2967,6 +2684,10 @@ public static AsyncPageable GetLongTermRetentionBac /// LongTermRetentionBackups_ListByResourceGroupLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -2976,7 +2697,7 @@ public static AsyncPageable GetLongTermRetentionBac /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLongTermRetentionBackupsWithLocation(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -2991,6 +2712,10 @@ public static Pageable GetLongTermRetentionBackupsW /// LongTermRetentionBackups_ListByResourceGroupServer /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3003,9 +2728,7 @@ public static Pageable GetLongTermRetentionBackupsW /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLongTermRetentionBackupsWithServerAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3020,6 +2743,10 @@ public static AsyncPageable GetLongTermRetentionBac /// LongTermRetentionBackups_ListByResourceGroupServer /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3032,9 +2759,7 @@ public static AsyncPageable GetLongTermRetentionBac /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLongTermRetentionBackupsWithServer(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3049,6 +2774,10 @@ public static Pageable GetLongTermRetentionBackupsW /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3061,9 +2790,7 @@ public static Pageable GetLongTermRetentionBackupsW /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3078,6 +2805,10 @@ public static AsyncPageable GetLongT /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3090,9 +2821,7 @@ public static AsyncPageable GetLongT /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLongTermRetentionManagedInstanceBackupsWithInstance(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsWithInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsWithInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3107,6 +2836,10 @@ public static Pageable GetLongTermRe /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3116,7 +2849,7 @@ public static Pageable GetLongTermRe /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3131,6 +2864,10 @@ public static AsyncPageable GetLongT /// LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3140,16 +2877,22 @@ public static AsyncPageable GetLongT /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLongTermRetentionManagedInstanceBackupsWithLocation(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetLongTermRetentionManagedInstanceBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } - /// Gets a collection of DeletedServerResources in the SubscriptionResource. + /// + /// Gets a collection of DeletedServerResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// An object representing collection of DeletedServerResources and their operations over a DeletedServerResource. public static DeletedServerCollection GetDeletedServers(this SubscriptionResource subscriptionResource, AzureLocation locationName) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedServers(locationName); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServers(locationName); } /// @@ -3164,17 +2907,21 @@ public static DeletedServerCollection GetDeletedServers(this SubscriptionResourc /// DeletedServers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// The name of the deleted server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDeletedServerAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string deletedServerName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetDeletedServers(locationName).GetAsync(deletedServerName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServerAsync(locationName, deletedServerName, cancellationToken).ConfigureAwait(false); } /// @@ -3189,26 +2936,36 @@ public static async Task> GetDeletedServerAsync( /// DeletedServers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// The name of the deleted server. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDeletedServer(this SubscriptionResource subscriptionResource, AzureLocation locationName, string deletedServerName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetDeletedServers(locationName).Get(deletedServerName, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServer(locationName, deletedServerName, cancellationToken); } - /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. public static SubscriptionUsageCollection GetSubscriptionUsages(this SubscriptionResource subscriptionResource, AzureLocation locationName) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionUsages(locationName); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionUsages(locationName); } /// @@ -3223,17 +2980,21 @@ public static SubscriptionUsageCollection GetSubscriptionUsages(this Subscriptio /// SubscriptionUsages_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// Name of usage metric to return. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionUsageAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string usageName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionUsages(locationName).GetAsync(usageName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionUsageAsync(locationName, usageName, cancellationToken).ConfigureAwait(false); } /// @@ -3248,26 +3009,36 @@ public static async Task> GetSubscriptionUsa /// SubscriptionUsages_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. /// Name of usage metric to return. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionUsage(this SubscriptionResource subscriptionResource, AzureLocation locationName, string usageName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionUsages(locationName).Get(usageName, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionUsage(locationName, usageName, cancellationToken); } - /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. + /// + /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The String to use. /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. public static SqlTimeZoneCollection GetSqlTimeZones(this SubscriptionResource subscriptionResource, AzureLocation locationName) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlTimeZones(locationName); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSqlTimeZones(locationName); } /// @@ -3282,17 +3053,21 @@ public static SqlTimeZoneCollection GetSqlTimeZones(this SubscriptionResource su /// TimeZones_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSqlTimeZoneAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string timeZoneId, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSqlTimeZones(locationName).GetAsync(timeZoneId, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetSqlTimeZoneAsync(locationName, timeZoneId, cancellationToken).ConfigureAwait(false); } /// @@ -3307,33 +3082,40 @@ public static async Task> GetSqlTimeZoneAsync(this /// TimeZones_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSqlTimeZone(this SubscriptionResource subscriptionResource, AzureLocation locationName, string timeZoneId, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSqlTimeZones(locationName).Get(timeZoneId, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSqlTimeZone(locationName, timeZoneId, cancellationToken); } - /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The location of the database. /// The name of the server. /// The name of the database. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. /// An object representing collection of SubscriptionLongTermRetentionBackupResources and their operations over a SubscriptionLongTermRetentionBackupResource. public static SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongTermRetentionBackups(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - Argument.AssertNotNullOrEmpty(longTermRetentionDatabaseName, nameof(longTermRetentionDatabaseName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); } /// @@ -3348,6 +3130,10 @@ public static SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongT /// LongTermRetentionBackups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3355,12 +3141,12 @@ public static SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongT /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionLongTermRetentionBackupAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackupAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); } /// @@ -3375,6 +3161,10 @@ public static async Task> /// LongTermRetentionBackups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3382,28 +3172,31 @@ public static async Task> /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionLongTermRetentionBackup(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionBackup(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); } - /// Gets a collection of SubscriptionLongTermRetentionManagedInstanceBackupResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionLongTermRetentionManagedInstanceBackupResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The location of the database. /// The name of the managed instance. /// The name of the managed database. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. /// An object representing collection of SubscriptionLongTermRetentionManagedInstanceBackupResources and their operations over a SubscriptionLongTermRetentionManagedInstanceBackupResource. public static SubscriptionLongTermRetentionManagedInstanceBackupCollection GetSubscriptionLongTermRetentionManagedInstanceBackups(this SubscriptionResource subscriptionResource, AzureLocation locationName, string managedInstanceName, string databaseName) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - Argument.AssertNotNullOrEmpty(databaseName, nameof(databaseName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName); } /// @@ -3418,6 +3211,10 @@ public static SubscriptionLongTermRetentionManagedInstanceBackupCollection GetSu /// LongTermRetentionManagedInstanceBackups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3425,12 +3222,12 @@ public static SubscriptionLongTermRetentionManagedInstanceBackupCollection GetSu /// The name of the managed database. /// The backup name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionLongTermRetentionManagedInstanceBackupAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName).GetAsync(backupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionManagedInstanceBackupAsync(locationName, managedInstanceName, databaseName, backupName, cancellationToken).ConfigureAwait(false); } /// @@ -3445,6 +3242,10 @@ public static async TaskLongTermRetentionManagedInstanceBackups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3452,12 +3253,12 @@ public static async Task The name of the managed database. /// The backup name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionLongTermRetentionManagedInstanceBackup(this SubscriptionResource subscriptionResource, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionLongTermRetentionManagedInstanceBackups(locationName, managedInstanceName, databaseName).Get(backupName, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSubscriptionLongTermRetentionManagedInstanceBackup(locationName, managedInstanceName, databaseName, backupName, cancellationToken); } /// @@ -3472,13 +3273,17 @@ public static ResponseDeletedServers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedServersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedServersAsync(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServersAsync(cancellationToken); } /// @@ -3493,13 +3298,17 @@ public static AsyncPageable GetDeletedServersAsync(this S /// DeletedServers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedServers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedServers(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServers(cancellationToken); } /// @@ -3514,13 +3323,17 @@ public static Pageable GetDeletedServers(this Subscriptio /// InstancePools_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetInstancePoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetInstancePoolsAsync(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePoolsAsync(cancellationToken); } /// @@ -3535,13 +3348,17 @@ public static AsyncPageable GetInstancePoolsAsync(this Sub /// InstancePools_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetInstancePools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetInstancePools(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePools(cancellationToken); } /// @@ -3556,6 +3373,10 @@ public static Pageable GetInstancePools(this SubscriptionR /// Capabilities_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location name whose capabilities are retrieved. @@ -3563,7 +3384,7 @@ public static Pageable GetInstancePools(this SubscriptionR /// The cancellation token to use. public static async Task> GetCapabilitiesByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapabilitiesByLocationAsync(locationName, include, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlSubscriptionResource(subscriptionResource).GetCapabilitiesByLocationAsync(locationName, include, cancellationToken).ConfigureAwait(false); } /// @@ -3578,6 +3399,10 @@ public static async Task> GetCapabilitiesByLoc /// Capabilities_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location name whose capabilities are retrieved. @@ -3585,7 +3410,7 @@ public static async Task> GetCapabilitiesByLoc /// The cancellation token to use. public static Response GetCapabilitiesByLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetCapabilitiesByLocation(locationName, include, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetCapabilitiesByLocation(locationName, include, cancellationToken); } /// @@ -3600,6 +3425,10 @@ public static Response GetCapabilitiesByLocation(this S /// SyncGroups_ListSyncDatabaseIds /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. @@ -3607,7 +3436,7 @@ public static Response GetCapabilitiesByLocation(this S /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSyncDatabaseIdsSyncGroupsAsync(locationName, cancellationToken); } /// @@ -3622,6 +3451,10 @@ public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this /// SyncGroups_ListSyncDatabaseIds /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region where the resource is located. @@ -3629,7 +3462,7 @@ public static AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSyncDatabaseIdsSyncGroups(this SubscriptionResource subscriptionResource, AzureLocation locationName, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSyncDatabaseIdsSyncGroups(locationName, cancellationToken); } /// @@ -3644,6 +3477,10 @@ public static Pageable GetSyncDatabaseIdsSyncGroups(this Subscripti /// LongTermRetentionBackups_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3653,7 +3490,7 @@ public static Pageable GetSyncDatabaseIdsSyncGroups(this Subscripti /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3668,6 +3505,10 @@ public static AsyncPageable GetLongTermRetentionBac /// LongTermRetentionBackups_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3677,7 +3518,7 @@ public static AsyncPageable GetLongTermRetentionBac /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLongTermRetentionBackupsWithLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3692,6 +3533,10 @@ public static Pageable GetLongTermRetentionBackupsW /// LongTermRetentionBackups_ListByServer /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3704,9 +3549,7 @@ public static Pageable GetLongTermRetentionBackupsW /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLongTermRetentionBackupsWithServerAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3721,6 +3564,10 @@ public static AsyncPageable GetLongTermRetentionBac /// LongTermRetentionBackups_ListByServer /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3733,9 +3580,7 @@ public static AsyncPageable GetLongTermRetentionBac /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLongTermRetentionBackupsWithServer(this SubscriptionResource subscriptionResource, AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(longTermRetentionServerName, nameof(longTermRetentionServerName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3750,6 +3595,10 @@ public static Pageable GetLongTermRetentionBackupsW /// LongTermRetentionManagedInstanceBackups_ListByInstance /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3762,9 +3611,7 @@ public static Pageable GetLongTermRetentionBackupsW /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3779,6 +3626,10 @@ public static AsyncPageable GetLongT /// LongTermRetentionManagedInstanceBackups_ListByInstance /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3791,9 +3642,7 @@ public static AsyncPageable GetLongT /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLongTermRetentionManagedInstanceBackupsWithInstance(this SubscriptionResource subscriptionResource, AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsWithInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsWithInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3808,6 +3657,10 @@ public static Pageable GetLongTermRe /// LongTermRetentionManagedInstanceBackups_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3817,7 +3670,7 @@ public static Pageable GetLongTermRe /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3832,6 +3685,10 @@ public static AsyncPageable GetLongT /// LongTermRetentionManagedInstanceBackups_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the database. @@ -3841,7 +3698,7 @@ public static AsyncPageable GetLongT /// A collection of that may take multiple service requests to iterate over. public static Pageable GetLongTermRetentionManagedInstanceBackupsWithLocation(this SubscriptionResource subscriptionResource, AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionManagedInstanceBackupsWithLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); } /// @@ -3856,13 +3713,17 @@ public static Pageable GetLongTermRe /// VirtualClusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualClustersAsync(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetVirtualClustersAsync(cancellationToken); } /// @@ -3877,13 +3738,17 @@ public static AsyncPageable GetVirtualClustersAsync(this /// VirtualClusters_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVirtualClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVirtualClusters(cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetVirtualClusters(cancellationToken); } /// @@ -3898,6 +3763,10 @@ public static Pageable GetVirtualClusters(this Subscript /// ManagedInstances_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The child resources to include in the response. @@ -3905,7 +3774,7 @@ public static Pageable GetVirtualClusters(this Subscript /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetManagedInstancesAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedInstancesAsync(expand, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetManagedInstancesAsync(expand, cancellationToken); } /// @@ -3920,6 +3789,10 @@ public static AsyncPageable GetManagedInstancesAsync(th /// ManagedInstances_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The child resources to include in the response. @@ -3927,7 +3800,7 @@ public static AsyncPageable GetManagedInstancesAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetManagedInstances(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedInstances(expand, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetManagedInstances(expand, cancellationToken); } /// @@ -3942,6 +3815,10 @@ public static Pageable GetManagedInstances(this Subscri /// Servers_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name availability request parameters. @@ -3949,9 +3826,7 @@ public static Pageable GetManagedInstances(this Subscri /// is null. public static async Task> CheckSqlServerNameAvailabilityAsync(this SubscriptionResource subscriptionResource, SqlNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSqlServerNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlSubscriptionResource(subscriptionResource).CheckSqlServerNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -3966,6 +3841,10 @@ public static async Task> CheckSqlServerNa /// Servers_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name availability request parameters. @@ -3973,9 +3852,7 @@ public static async Task> CheckSqlServerNa /// is null. public static Response CheckSqlServerNameAvailability(this SubscriptionResource subscriptionResource, SqlNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSqlServerNameAvailability(content, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).CheckSqlServerNameAvailability(content, cancellationToken); } /// @@ -3990,6 +3867,10 @@ public static Response CheckSqlServerNameAvailabili /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The child resources to include in the response. @@ -3997,7 +3878,7 @@ public static Response CheckSqlServerNameAvailabili /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetSqlServersAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlServersAsync(expand, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSqlServersAsync(expand, cancellationToken); } /// @@ -4012,6 +3893,10 @@ public static AsyncPageable GetSqlServersAsync(this Subscript /// Servers_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The child resources to include in the response. @@ -4019,7 +3904,7 @@ public static AsyncPageable GetSqlServersAsync(this Subscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetSqlServers(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlServers(expand, cancellationToken); + return GetMockableSqlSubscriptionResource(subscriptionResource).GetSqlServers(expand, cancellationToken); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index aefd96deaf4b2..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,725 +0,0 @@ -// 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 Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Resources.Models; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _deletedServerClientDiagnostics; - private DeletedServersRestOperations _deletedServerRestClient; - private ClientDiagnostics _instancePoolClientDiagnostics; - private InstancePoolsRestOperations _instancePoolRestClient; - private ClientDiagnostics _capabilitiesClientDiagnostics; - private CapabilitiesRestOperations _capabilitiesRestClient; - private ClientDiagnostics _syncGroupClientDiagnostics; - private SyncGroupsRestOperations _syncGroupRestClient; - private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; - private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; - private ClientDiagnostics _longTermRetentionManagedInstanceBackupsClientDiagnostics; - private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; - private ClientDiagnostics _virtualClusterClientDiagnostics; - private VirtualClustersRestOperations _virtualClusterRestClient; - private ClientDiagnostics _managedInstanceClientDiagnostics; - private ManagedInstancesRestOperations _managedInstanceRestClient; - private ClientDiagnostics _sqlServerServersClientDiagnostics; - private ServersRestOperations _sqlServerServersRestClient; - - /// 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 DeletedServerClientDiagnostics => _deletedServerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", DeletedServerResource.ResourceType.Namespace, Diagnostics); - private DeletedServersRestOperations DeletedServerRestClient => _deletedServerRestClient ??= new DeletedServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedServerResource.ResourceType)); - private ClientDiagnostics InstancePoolClientDiagnostics => _instancePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", InstancePoolResource.ResourceType.Namespace, Diagnostics); - private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstancePoolResource.ResourceType)); - private ClientDiagnostics CapabilitiesClientDiagnostics => _capabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CapabilitiesRestOperations CapabilitiesRestClient => _capabilitiesRestClient ??= new CapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SyncGroupClientDiagnostics => _syncGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SyncGroupResource.ResourceType.Namespace, Diagnostics); - private SyncGroupsRestOperations SyncGroupRestClient => _syncGroupRestClient ??= new SyncGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SyncGroupResource.ResourceType)); - private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics LongTermRetentionManagedInstanceBackupsClientDiagnostics => _longTermRetentionManagedInstanceBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics VirtualClusterClientDiagnostics => _virtualClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", VirtualClusterResource.ResourceType.Namespace, Diagnostics); - private VirtualClustersRestOperations VirtualClusterRestClient => _virtualClusterRestClient ??= new VirtualClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualClusterResource.ResourceType)); - private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); - private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); - private ClientDiagnostics SqlServerServersClientDiagnostics => _sqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServerResource.ResourceType.Namespace, Diagnostics); - private ServersRestOperations SqlServerServersRestClient => _sqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlServerResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DeletedServerResources in the SubscriptionResource. - /// The name of the region where the resource is located. - /// An object representing collection of DeletedServerResources and their operations over a DeletedServerResource. - public virtual DeletedServerCollection GetDeletedServers(AzureLocation locationName) - { - return new DeletedServerCollection(Client, Id, locationName); - } - - /// Gets a collection of SubscriptionUsageResources in the SubscriptionResource. - /// The name of the region where the resource is located. - /// An object representing collection of SubscriptionUsageResources and their operations over a SubscriptionUsageResource. - public virtual SubscriptionUsageCollection GetSubscriptionUsages(AzureLocation locationName) - { - return new SubscriptionUsageCollection(Client, Id, locationName); - } - - /// Gets a collection of SqlTimeZoneResources in the SubscriptionResource. - /// The String to use. - /// An object representing collection of SqlTimeZoneResources and their operations over a SqlTimeZoneResource. - public virtual SqlTimeZoneCollection GetSqlTimeZones(AzureLocation locationName) - { - return new SqlTimeZoneCollection(Client, Id, locationName); - } - - /// Gets a collection of SubscriptionLongTermRetentionBackupResources in the SubscriptionResource. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// An object representing collection of SubscriptionLongTermRetentionBackupResources and their operations over a SubscriptionLongTermRetentionBackupResource. - public virtual SubscriptionLongTermRetentionBackupCollection GetSubscriptionLongTermRetentionBackups(AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) - { - return new SubscriptionLongTermRetentionBackupCollection(Client, Id, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); - } - - /// Gets a collection of SubscriptionLongTermRetentionManagedInstanceBackupResources in the SubscriptionResource. - /// The location of the database. - /// The name of the managed instance. - /// The name of the managed database. - /// An object representing collection of SubscriptionLongTermRetentionManagedInstanceBackupResources and their operations over a SubscriptionLongTermRetentionManagedInstanceBackupResource. - public virtual SubscriptionLongTermRetentionManagedInstanceBackupCollection GetSubscriptionLongTermRetentionManagedInstanceBackups(AzureLocation locationName, string managedInstanceName, string databaseName) - { - return new SubscriptionLongTermRetentionManagedInstanceBackupCollection(Client, Id, locationName, managedInstanceName, databaseName); - } - - /// - /// Gets a list of all deleted servers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers - /// - /// - /// Operation Id - /// DeletedServers_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedServersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedServerRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedServerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedServers", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all deleted servers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers - /// - /// - /// Operation Id - /// DeletedServers_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedServers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedServerRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedServerRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedServers", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all instance pools in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools - /// - /// - /// Operation Id - /// InstancePools_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetInstancePoolsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetInstancePools", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all instance pools in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools - /// - /// - /// Operation Id - /// InstancePools_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetInstancePools(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetInstancePools", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the subscription capabilities available for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities - /// - /// - /// Operation Id - /// Capabilities_ListByLocation - /// - /// - /// - /// The location name whose capabilities are retrieved. - /// If specified, restricts the response to only include the selected item. - /// The cancellation token to use. - public virtual async Task> GetCapabilitiesByLocationAsync(AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) - { - using var scope = CapabilitiesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetCapabilitiesByLocation"); - scope.Start(); - try - { - var response = await CapabilitiesRestClient.ListByLocationAsync(Id.SubscriptionId, locationName, include, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the subscription capabilities available for the specified location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities - /// - /// - /// Operation Id - /// Capabilities_ListByLocation - /// - /// - /// - /// The location name whose capabilities are retrieved. - /// If specified, restricts the response to only include the selected item. - /// The cancellation token to use. - public virtual Response GetCapabilitiesByLocation(AzureLocation locationName, SqlCapabilityGroup? include = null, CancellationToken cancellationToken = default) - { - using var scope = CapabilitiesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetCapabilitiesByLocation"); - scope.Start(); - try - { - var response = CapabilitiesRestClient.ListByLocation(Id.SubscriptionId, locationName, include, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a collection of sync database ids. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// - /// - /// Operation Id - /// SyncGroups_ListSyncDatabaseIds - /// - /// - /// - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSyncDatabaseIdsSyncGroupsAsync(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SyncGroupRestClient.CreateListSyncDatabaseIdsRequest(Id.SubscriptionId, locationName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SyncGroupRestClient.CreateListSyncDatabaseIdsNextPageRequest(nextLink, Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), SyncGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a collection of sync database ids. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds - /// - /// - /// Operation Id - /// SyncGroups_ListSyncDatabaseIds - /// - /// - /// - /// The name of the region where the resource is located. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSyncDatabaseIdsSyncGroups(AzureLocation locationName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SyncGroupRestClient.CreateListSyncDatabaseIdsRequest(Id.SubscriptionId, locationName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SyncGroupRestClient.CreateListSyncDatabaseIdsNextPageRequest(nextLink, Id.SubscriptionId, locationName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), SyncGroupClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSyncDatabaseIdsSyncGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByLocation - /// - /// - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByLocation - /// - /// - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given server. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByServer - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionBackupsWithServerAsync(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByServerRequest(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given server. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups - /// - /// - /// Operation Id - /// LongTermRetentionBackups_ListByServer - /// - /// - /// - /// The location of the database. - /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionBackupsWithServer(AzureLocation locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionBackupsRestClient.CreateListByServerRequest(Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionBackupsRestClient.CreateListByServerNextPageRequest(nextLink, Id.SubscriptionId, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData, LongTermRetentionBackupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given managed instance. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_ListByInstance - /// - /// - /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithInstanceAsync(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByInstanceRequest(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByInstanceNextPageRequest(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsWithInstance", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for a given managed instance. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_ListByInstance - /// - /// - /// - /// The location of the database. - /// The name of the managed instance. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsWithInstance(AzureLocation locationName, string managedInstanceName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByInstanceRequest(Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByInstanceNextPageRequest(nextLink, Id.SubscriptionId, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsWithInstance", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for managed databases in a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_ListByLocation - /// - /// - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLongTermRetentionManagedInstanceBackupsWithLocationAsync(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the long term retention backups for managed databases in a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstanceBackups - /// - /// - /// Operation Id - /// LongTermRetentionManagedInstanceBackups_ListByLocation - /// - /// - /// - /// The location of the database. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLongTermRetentionManagedInstanceBackupsWithLocation(AzureLocation locationName, bool? onlyLatestPerDatabase = null, SqlDatabaseState? databaseState = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByLocationRequest(Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LongTermRetentionManagedInstanceBackupsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, locationName, onlyLatestPerDatabase, databaseState); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ManagedInstanceLongTermRetentionBackupData.DeserializeManagedInstanceLongTermRetentionBackupData, LongTermRetentionManagedInstanceBackupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetLongTermRetentionManagedInstanceBackupsWithLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all virtualClusters in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// - /// - /// Operation Id - /// VirtualClusters_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualClusterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualClusterResource(Client, VirtualClusterData.DeserializeVirtualClusterData(e)), VirtualClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all virtualClusters in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters - /// - /// - /// Operation Id - /// VirtualClusters_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualClusterRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualClusterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualClusterResource(Client, VirtualClusterData.DeserializeVirtualClusterData(e)), VirtualClusterClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVirtualClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// - /// - /// Operation Id - /// ManagedInstances_List - /// - /// - /// - /// The child resources to include in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedInstanceRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedInstanceResource(Client, ManagedInstanceData.DeserializeManagedInstanceData(e)), ManagedInstanceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedInstances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// - /// - /// Operation Id - /// ManagedInstances_List - /// - /// - /// - /// The child resources to include in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedInstanceRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedInstanceResource(Client, ManagedInstanceData.DeserializeManagedInstanceData(e)), ManagedInstanceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedInstances", "value", "nextLink", cancellationToken); - } - - /// - /// Determines whether a resource can be created with the specified name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// - /// - /// Operation Id - /// Servers_CheckNameAvailability - /// - /// - /// - /// The name availability request parameters. - /// The cancellation token to use. - public virtual async Task> CheckSqlServerNameAvailabilityAsync(SqlNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSqlServerNameAvailability"); - scope.Start(); - try - { - var response = await SqlServerServersRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Determines whether a resource can be created with the specified name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability - /// - /// - /// Operation Id - /// Servers_CheckNameAvailability - /// - /// - /// - /// The name availability request parameters. - /// The cancellation token to use. - public virtual Response CheckSqlServerNameAvailability(SqlNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SqlServerServersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSqlServerNameAvailability"); - scope.Start(); - try - { - var response = SqlServerServersRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of all servers in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The child resources to include in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSqlServersAsync(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SqlServerServersRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlServerResource(Client, SqlServerData.DeserializeSqlServerData(e)), SqlServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSqlServers", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all servers in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers - /// - /// - /// Operation Id - /// Servers_List - /// - /// - /// - /// The child resources to include in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSqlServers(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SqlServerServersRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlServerResource(Client, SqlServerData.DeserializeSqlServerData(e)), SqlServerServersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSqlServers", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupResource.cs index bd73b459ec105..31b807b351813 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Sql public partial class FailoverGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The failoverGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string failoverGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/GeoBackupPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/GeoBackupPolicyResource.cs index 76f5d41bc0e60..0265b112e8519 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/GeoBackupPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/GeoBackupPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class GeoBackupPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The geoBackupPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, GeoBackupPolicyName geoBackupPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleResource.cs index 346aa05ab68c5..2decec8f543ea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/IPv6FirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class IPv6FirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupResource.cs index bbdfe67a783a9..d745cd824ad4e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class InstanceFailoverGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The locationName. + /// The failoverGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation locationName, string failoverGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs index 187d70130f691..892a2cb9bd0e9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Sql public partial class InstancePoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instancePoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instancePoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadResource.cs index 718b17f028531..38117673259fb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class LedgerDigestUploadResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The ledgerDigestUploads. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LogicalDatabaseTransparentDataEncryptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LogicalDatabaseTransparentDataEncryptionResource.cs index 4597ad0fccdec..cc92175bc1333 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LogicalDatabaseTransparentDataEncryptionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LogicalDatabaseTransparentDataEncryptionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class LogicalDatabaseTransparentDataEncryptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The tdeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyResource.cs index 4b8a79f443a27..48e9f3a50b3ef 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class LongTermRetentionPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionResource.cs index a6bfa93f752d4..c3916c645167a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class MaintenanceWindowOptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindowOptions/current"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsResource.cs index 1e407c26075e9..59193c41b70d6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class MaintenanceWindowsResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindows/current"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPolicyResource.cs index 347563e68a209..6ffd6dd1c9be2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedBackupShortTermRetentionPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, ManagedShortTermRetentionPolicyName policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseAdvancedThreatProtectionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseAdvancedThreatProtectionResource.cs index 94d9c2284660f..e00de08258e78 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseAdvancedThreatProtectionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseAdvancedThreatProtectionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseAdvancedThreatProtectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The advancedThreatProtectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, AdvancedThreatProtectionName advancedThreatProtectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnResource.cs index 7e08437db91ca..c581966fa45d3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseColumnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The schemaName. + /// The tableName. + /// The columnName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}"; @@ -96,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedDatabaseSensitivityLabelResources and their operations over a ManagedDatabaseSensitivityLabelResource. public virtual ManagedDatabaseSensitivityLabelCollection GetManagedDatabaseSensitivityLabels() { - return GetCachedClient(Client => new ManagedDatabaseSensitivityLabelCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseSensitivityLabelCollection(client, Id)); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs index c2526226ab991..8cc9342e1bcad 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}"; @@ -111,7 +115,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedDatabaseSchemaResources and their operations over a ManagedDatabaseSchemaResource. public virtual ManagedDatabaseSchemaCollection GetManagedDatabaseSchemas() { - return GetCachedClient(Client => new ManagedDatabaseSchemaCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseSchemaCollection(client, Id)); } /// @@ -129,8 +133,8 @@ public virtual ManagedDatabaseSchemaCollection GetManagedDatabaseSchemas() /// /// The name of the schema. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedDatabaseSchemaAsync(string schemaName, CancellationToken cancellationToken = default) { @@ -152,8 +156,8 @@ public virtual async Task> GetManagedDat /// /// The name of the schema. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedDatabaseSchema(string schemaName, CancellationToken cancellationToken = default) { @@ -164,7 +168,7 @@ public virtual Response GetManagedDatabaseSchema( /// An object representing collection of ManagedDatabaseVulnerabilityAssessmentResources and their operations over a ManagedDatabaseVulnerabilityAssessmentResource. public virtual ManagedDatabaseVulnerabilityAssessmentCollection GetManagedDatabaseVulnerabilityAssessments() { - return GetCachedClient(Client => new ManagedDatabaseVulnerabilityAssessmentCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseVulnerabilityAssessmentCollection(client, Id)); } /// @@ -213,7 +217,7 @@ public virtual Response GetManag /// An object representing collection of ManagedBackupShortTermRetentionPolicyResources and their operations over a ManagedBackupShortTermRetentionPolicyResource. public virtual ManagedBackupShortTermRetentionPolicyCollection GetManagedBackupShortTermRetentionPolicies() { - return GetCachedClient(Client => new ManagedBackupShortTermRetentionPolicyCollection(Client, Id)); + return GetCachedClient(client => new ManagedBackupShortTermRetentionPolicyCollection(client, Id)); } /// @@ -262,7 +266,7 @@ public virtual Response GetManage /// An object representing collection of ManagedDatabaseSecurityAlertPolicyResources and their operations over a ManagedDatabaseSecurityAlertPolicyResource. public virtual ManagedDatabaseSecurityAlertPolicyCollection GetManagedDatabaseSecurityAlertPolicies() { - return GetCachedClient(Client => new ManagedDatabaseSecurityAlertPolicyCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseSecurityAlertPolicyCollection(client, Id)); } /// @@ -311,7 +315,7 @@ public virtual Response GetManagedDa /// An object representing collection of ManagedTransparentDataEncryptionResources and their operations over a ManagedTransparentDataEncryptionResource. public virtual ManagedTransparentDataEncryptionCollection GetManagedTransparentDataEncryptions() { - return GetCachedClient(Client => new ManagedTransparentDataEncryptionCollection(Client, Id)); + return GetCachedClient(client => new ManagedTransparentDataEncryptionCollection(client, Id)); } /// @@ -360,7 +364,7 @@ public virtual Response GetManagedTran /// An object representing collection of ManagedInstanceLongTermRetentionPolicyResources and their operations over a ManagedInstanceLongTermRetentionPolicyResource. public virtual ManagedInstanceLongTermRetentionPolicyCollection GetManagedInstanceLongTermRetentionPolicies() { - return GetCachedClient(Client => new ManagedInstanceLongTermRetentionPolicyCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceLongTermRetentionPolicyCollection(client, Id)); } /// @@ -409,7 +413,7 @@ public virtual Response GetManag /// An object representing collection of ManagedDatabaseAdvancedThreatProtectionResources and their operations over a ManagedDatabaseAdvancedThreatProtectionResource. public virtual ManagedDatabaseAdvancedThreatProtectionCollection GetManagedDatabaseAdvancedThreatProtections() { - return GetCachedClient(Client => new ManagedDatabaseAdvancedThreatProtectionCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseAdvancedThreatProtectionCollection(client, Id)); } /// @@ -458,7 +462,7 @@ public virtual Response GetMana /// An object representing collection of ManagedDatabaseRestoreDetailResources and their operations over a ManagedDatabaseRestoreDetailResource. public virtual ManagedDatabaseRestoreDetailCollection GetManagedDatabaseRestoreDetails() { - return GetCachedClient(Client => new ManagedDatabaseRestoreDetailCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseRestoreDetailCollection(client, Id)); } /// @@ -507,7 +511,7 @@ public virtual Response GetManagedDatabase /// An object representing collection of ManagedLedgerDigestUploadResources and their operations over a ManagedLedgerDigestUploadResource. public virtual ManagedLedgerDigestUploadCollection GetManagedLedgerDigestUploads() { - return GetCachedClient(Client => new ManagedLedgerDigestUploadCollection(Client, Id)); + return GetCachedClient(client => new ManagedLedgerDigestUploadCollection(client, Id)); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailResource.cs index 1cc5a8ac11f5a..d3c1ec236eb38 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseRestoreDetailResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The restoreDetailsName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, RestoreDetailsName restoreDetailsName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails/{restoreDetailsName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaResource.cs index 1e2e8f0180a2a..70a20ebc094fc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseSchemaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The schemaName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedDatabaseTableResources and their operations over a ManagedDatabaseTableResource. public virtual ManagedDatabaseTableCollection GetManagedDatabaseTables() { - return GetCachedClient(Client => new ManagedDatabaseTableCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseTableCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual ManagedDatabaseTableCollection GetManagedDatabaseTables() /// /// The name of the table. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedDatabaseTableAsync(string tableName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetManagedData /// /// The name of the table. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedDatabaseTable(string tableName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPolicyResource.cs index 4b1cf6d0e1553..80b19a084fbef 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseSecurityAlertPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The securityAlertPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, SqlSecurityAlertPolicyName securityAlertPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelResource.cs index b4569fa3e4fcf..dee09be49d3b1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelResource.cs @@ -26,6 +26,14 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseSensitivityLabelResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The schemaName. + /// The tableName. + /// The columnName. + /// The sensitivityLabelSource. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableResource.cs index 31d4ec4eac938..48ef56611362a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseTableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The schemaName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}"; @@ -90,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedDatabaseColumnResources and their operations over a ManagedDatabaseColumnResource. public virtual ManagedDatabaseColumnCollection GetManagedDatabaseColumns() { - return GetCachedClient(Client => new ManagedDatabaseColumnCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseColumnCollection(client, Id)); } /// @@ -108,8 +114,8 @@ public virtual ManagedDatabaseColumnCollection GetManagedDatabaseColumns() /// /// The name of the column. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedDatabaseColumnAsync(string columnName, CancellationToken cancellationToken = default) { @@ -131,8 +137,8 @@ public virtual async Task> GetManagedDat /// /// The name of the column. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedDatabaseColumn(string columnName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentResource.cs index 4eac801917f37..d301e7820a1a5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The vulnerabilityAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedDatabaseVulnerabilityAssessmentRuleBaselineResources and their operations over a ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource. public virtual ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection GetManagedDatabaseVulnerabilityAssessmentRuleBaselines() { - return GetCachedClient(Client => new ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection(client, Id)); } /// @@ -110,8 +115,8 @@ public virtual ManagedDatabaseVulnerabilityAssessmentRuleBaselineCollection GetM /// The vulnerability assessment rule ID. /// The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedDatabaseVulnerabilityAssessmentRuleBaselineAsync(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) { @@ -134,8 +139,8 @@ public virtual async Task The vulnerability assessment rule ID. /// The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedDatabaseVulnerabilityAssessmentRuleBaseline(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) { @@ -146,7 +151,7 @@ public virtual Response An object representing collection of ManagedDatabaseVulnerabilityAssessmentScanResources and their operations over a ManagedDatabaseVulnerabilityAssessmentScanResource. public virtual ManagedDatabaseVulnerabilityAssessmentScanCollection GetManagedDatabaseVulnerabilityAssessmentScans() { - return GetCachedClient(Client => new ManagedDatabaseVulnerabilityAssessmentScanCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseVulnerabilityAssessmentScanCollection(client, Id)); } /// @@ -164,8 +169,8 @@ public virtual ManagedDatabaseVulnerabilityAssessmentScanCollection GetManagedDa /// /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedDatabaseVulnerabilityAssessmentScanAsync(string scanId, CancellationToken cancellationToken = default) { @@ -187,8 +192,8 @@ public virtual async Task /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedDatabaseVulnerabilityAssessmentScan(string scanId, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource.cs index 6219a642d4979..a7b916d567e8c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseVulnerabilityAssessmentRuleBaselineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The vulnerabilityAssessmentName. + /// The ruleId. + /// The baselineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScanResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScanResource.cs index f921ead452467..fc8c15862c86c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScanResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScanResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Sql public partial class ManagedDatabaseVulnerabilityAssessmentScanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The vulnerabilityAssessmentName. + /// The scanId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorResource.cs index d9bef7a7b9f56..0fe3eae7134a5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceAdministratorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The administratorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, SqlAdministratorName administratorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdvancedThreatProtectionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdvancedThreatProtectionResource.cs index ee2e0dd278b1f..60a200fe44205 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdvancedThreatProtectionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdvancedThreatProtectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceAdvancedThreatProtectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The advancedThreatProtectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, AdvancedThreatProtectionName advancedThreatProtectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationResource.cs index abc1668721246..a39b87bc1b102 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceAzureADOnlyAuthenticationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The authenticationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcResource.cs index 3c5abc2988df7..06b56e8a712a7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceDtcResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceDtcResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The dtcName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, DtcName dtcName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorResource.cs index 90c9d78b4b188..7ec39dc07c2d4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceEncryptionProtectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The encryptionProtectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, EncryptionProtectorName encryptionProtectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeyResource.cs index 418a817968da1..398101d9b71db 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceKeyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The keyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string keyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/keys/{keyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPolicyResource.cs index 2e91942cb58e1..92f49eac15780 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceLongTermRetentionPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, ManagedInstanceLongTermRetentionPolicyName policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperationResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperationResource.cs index 32f41ece9a64c..90416344028c4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperationResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceOperationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The operationId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, Guid operationId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionResource.cs index 838da8c6ab9b5..bd2341a05b9d8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstancePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResource.cs index 191e6cdfafd97..185ce98b6ecb4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstancePrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateLinkResources/{groupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs index c258a8241a2e9..100171bfdd890 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}"; @@ -108,7 +111,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedInstanceAdministratorResources and their operations over a ManagedInstanceAdministratorResource. public virtual ManagedInstanceAdministratorCollection GetManagedInstanceAdministrators() { - return GetCachedClient(Client => new ManagedInstanceAdministratorCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceAdministratorCollection(client, Id)); } /// @@ -157,7 +160,7 @@ public virtual Response GetManagedInstance /// An object representing collection of ManagedInstanceAzureADOnlyAuthenticationResources and their operations over a ManagedInstanceAzureADOnlyAuthenticationResource. public virtual ManagedInstanceAzureADOnlyAuthenticationCollection GetManagedInstanceAzureADOnlyAuthentications() { - return GetCachedClient(Client => new ManagedInstanceAzureADOnlyAuthenticationCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceAzureADOnlyAuthenticationCollection(client, Id)); } /// @@ -206,7 +209,7 @@ public virtual Response GetMan /// An object representing collection of ManagedInstanceEncryptionProtectorResources and their operations over a ManagedInstanceEncryptionProtectorResource. public virtual ManagedInstanceEncryptionProtectorCollection GetManagedInstanceEncryptionProtectors() { - return GetCachedClient(Client => new ManagedInstanceEncryptionProtectorCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceEncryptionProtectorCollection(client, Id)); } /// @@ -255,7 +258,7 @@ public virtual Response GetManagedIn /// An object representing collection of ManagedInstanceKeyResources and their operations over a ManagedInstanceKeyResource. public virtual ManagedInstanceKeyCollection GetManagedInstanceKeys() { - return GetCachedClient(Client => new ManagedInstanceKeyCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceKeyCollection(client, Id)); } /// @@ -273,8 +276,8 @@ public virtual ManagedInstanceKeyCollection GetManagedInstanceKeys() /// /// The name of the managed instance key to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedInstanceKeyAsync(string keyName, CancellationToken cancellationToken = default) { @@ -296,8 +299,8 @@ public virtual async Task> GetManagedInstan /// /// The name of the managed instance key to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedInstanceKey(string keyName, CancellationToken cancellationToken = default) { @@ -308,7 +311,7 @@ public virtual Response GetManagedInstanceKey(string /// An object representing collection of ManagedInstanceOperationResources and their operations over a ManagedInstanceOperationResource. public virtual ManagedInstanceOperationCollection GetManagedInstanceOperations() { - return GetCachedClient(Client => new ManagedInstanceOperationCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceOperationCollection(client, Id)); } /// @@ -357,7 +360,7 @@ public virtual Response GetManagedInstanceOper /// An object representing collection of ManagedInstancePrivateEndpointConnectionResources and their operations over a ManagedInstancePrivateEndpointConnectionResource. public virtual ManagedInstancePrivateEndpointConnectionCollection GetManagedInstancePrivateEndpointConnections() { - return GetCachedClient(Client => new ManagedInstancePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstancePrivateEndpointConnectionCollection(client, Id)); } /// @@ -375,8 +378,8 @@ public virtual ManagedInstancePrivateEndpointConnectionCollection GetManagedInst /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedInstancePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -398,8 +401,8 @@ public virtual async Task /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedInstancePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -410,7 +413,7 @@ public virtual Response GetMan /// An object representing collection of ManagedInstancePrivateLinkResources and their operations over a ManagedInstancePrivateLinkResource. public virtual ManagedInstancePrivateLinkCollection GetManagedInstancePrivateLinks() { - return GetCachedClient(Client => new ManagedInstancePrivateLinkCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstancePrivateLinkCollection(client, Id)); } /// @@ -428,8 +431,8 @@ public virtual ManagedInstancePrivateLinkCollection GetManagedInstancePrivateLin /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedInstancePrivateLinkAsync(string groupName, CancellationToken cancellationToken = default) { @@ -451,8 +454,8 @@ public virtual async Task> GetManag /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedInstancePrivateLink(string groupName, CancellationToken cancellationToken = default) { @@ -463,7 +466,7 @@ public virtual Response GetManagedInstancePr /// An object representing collection of ManagedInstanceVulnerabilityAssessmentResources and their operations over a ManagedInstanceVulnerabilityAssessmentResource. public virtual ManagedInstanceVulnerabilityAssessmentCollection GetManagedInstanceVulnerabilityAssessments() { - return GetCachedClient(Client => new ManagedInstanceVulnerabilityAssessmentCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceVulnerabilityAssessmentCollection(client, Id)); } /// @@ -512,7 +515,7 @@ public virtual Response GetManag /// An object representing collection of ManagedServerSecurityAlertPolicyResources and their operations over a ManagedServerSecurityAlertPolicyResource. public virtual ManagedServerSecurityAlertPolicyCollection GetManagedServerSecurityAlertPolicies() { - return GetCachedClient(Client => new ManagedServerSecurityAlertPolicyCollection(Client, Id)); + return GetCachedClient(client => new ManagedServerSecurityAlertPolicyCollection(client, Id)); } /// @@ -561,7 +564,7 @@ public virtual Response GetManagedServ /// An object representing collection of RecoverableManagedDatabaseResources and their operations over a RecoverableManagedDatabaseResource. public virtual RecoverableManagedDatabaseCollection GetRecoverableManagedDatabases() { - return GetCachedClient(Client => new RecoverableManagedDatabaseCollection(Client, Id)); + return GetCachedClient(client => new RecoverableManagedDatabaseCollection(client, Id)); } /// @@ -579,8 +582,8 @@ public virtual RecoverableManagedDatabaseCollection GetRecoverableManagedDatabas /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRecoverableManagedDatabaseAsync(string recoverableDatabaseName, CancellationToken cancellationToken = default) { @@ -602,8 +605,8 @@ public virtual async Task> GetRecov /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRecoverableManagedDatabase(string recoverableDatabaseName, CancellationToken cancellationToken = default) { @@ -621,7 +624,7 @@ public virtual SqlAgentConfigurationResource GetSqlAgentConfiguration() /// An object representing collection of RestorableDroppedManagedDatabaseResources and their operations over a RestorableDroppedManagedDatabaseResource. public virtual RestorableDroppedManagedDatabaseCollection GetRestorableDroppedManagedDatabases() { - return GetCachedClient(Client => new RestorableDroppedManagedDatabaseCollection(Client, Id)); + return GetCachedClient(client => new RestorableDroppedManagedDatabaseCollection(client, Id)); } /// @@ -639,8 +642,8 @@ public virtual RestorableDroppedManagedDatabaseCollection GetRestorableDroppedMa /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRestorableDroppedManagedDatabaseAsync(string restorableDroppedDatabaseId, CancellationToken cancellationToken = default) { @@ -662,8 +665,8 @@ public virtual async Task> Ge /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRestorableDroppedManagedDatabase(string restorableDroppedDatabaseId, CancellationToken cancellationToken = default) { @@ -674,7 +677,7 @@ public virtual Response GetRestorableD /// An object representing collection of DistributedAvailabilityGroupResources and their operations over a DistributedAvailabilityGroupResource. public virtual DistributedAvailabilityGroupCollection GetDistributedAvailabilityGroups() { - return GetCachedClient(Client => new DistributedAvailabilityGroupCollection(Client, Id)); + return GetCachedClient(client => new DistributedAvailabilityGroupCollection(client, Id)); } /// @@ -692,8 +695,8 @@ public virtual DistributedAvailabilityGroupCollection GetDistributedAvailability /// /// The distributed availability group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDistributedAvailabilityGroupAsync(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) { @@ -715,8 +718,8 @@ public virtual async Task> GetDis /// /// The distributed availability group name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDistributedAvailabilityGroup(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) { @@ -727,7 +730,7 @@ public virtual Response GetDistributedAvai /// An object representing collection of ManagedInstanceServerTrustCertificateResources and their operations over a ManagedInstanceServerTrustCertificateResource. public virtual ManagedInstanceServerTrustCertificateCollection GetManagedInstanceServerTrustCertificates() { - return GetCachedClient(Client => new ManagedInstanceServerTrustCertificateCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceServerTrustCertificateCollection(client, Id)); } /// @@ -745,8 +748,8 @@ public virtual ManagedInstanceServerTrustCertificateCollection GetManagedInstanc /// /// Name of of the certificate to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedInstanceServerTrustCertificateAsync(string certificateName, CancellationToken cancellationToken = default) { @@ -768,8 +771,8 @@ public virtual async Task /// Name of of the certificate to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedInstanceServerTrustCertificate(string certificateName, CancellationToken cancellationToken = default) { @@ -780,7 +783,7 @@ public virtual Response GetManage /// An object representing collection of EndpointCertificateResources and their operations over a EndpointCertificateResource. public virtual EndpointCertificateCollection GetEndpointCertificates() { - return GetCachedClient(Client => new EndpointCertificateCollection(Client, Id)); + return GetCachedClient(client => new EndpointCertificateCollection(client, Id)); } /// @@ -798,8 +801,8 @@ public virtual EndpointCertificateCollection GetEndpointCertificates() /// /// Type of the endpoint whose certificate the customer is looking for. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEndpointCertificateAsync(string endpointType, CancellationToken cancellationToken = default) { @@ -821,8 +824,8 @@ public virtual async Task> GetEndpointCert /// /// Type of the endpoint whose certificate the customer is looking for. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEndpointCertificate(string endpointType, CancellationToken cancellationToken = default) { @@ -833,7 +836,7 @@ public virtual Response GetEndpointCertificate(stri /// An object representing collection of ManagedServerDnsAliasResources and their operations over a ManagedServerDnsAliasResource. public virtual ManagedServerDnsAliasCollection GetManagedServerDnsAliases() { - return GetCachedClient(Client => new ManagedServerDnsAliasCollection(Client, Id)); + return GetCachedClient(client => new ManagedServerDnsAliasCollection(client, Id)); } /// @@ -851,8 +854,8 @@ public virtual ManagedServerDnsAliasCollection GetManagedServerDnsAliases() /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedServerDnsAliasAsync(string dnsAliasName, CancellationToken cancellationToken = default) { @@ -874,8 +877,8 @@ public virtual async Task> GetManagedSer /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedServerDnsAlias(string dnsAliasName, CancellationToken cancellationToken = default) { @@ -886,7 +889,7 @@ public virtual Response GetManagedServerDnsAlias( /// An object representing collection of ManagedInstanceAdvancedThreatProtectionResources and their operations over a ManagedInstanceAdvancedThreatProtectionResource. public virtual ManagedInstanceAdvancedThreatProtectionCollection GetManagedInstanceAdvancedThreatProtections() { - return GetCachedClient(Client => new ManagedInstanceAdvancedThreatProtectionCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceAdvancedThreatProtectionCollection(client, Id)); } /// @@ -935,7 +938,7 @@ public virtual Response GetMana /// An object representing collection of ManagedInstanceDtcResources and their operations over a ManagedInstanceDtcResource. public virtual ManagedInstanceDtcCollection GetManagedInstanceDtcs() { - return GetCachedClient(Client => new ManagedInstanceDtcCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceDtcCollection(client, Id)); } /// @@ -984,7 +987,7 @@ public virtual Response GetManagedInstanceDtc(DtcNam /// An object representing collection of ManagedDatabaseResources and their operations over a ManagedDatabaseResource. public virtual ManagedDatabaseCollection GetManagedDatabases() { - return GetCachedClient(Client => new ManagedDatabaseCollection(Client, Id)); + return GetCachedClient(client => new ManagedDatabaseCollection(client, Id)); } /// @@ -1002,8 +1005,8 @@ public virtual ManagedDatabaseCollection GetManagedDatabases() /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetManagedDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -1025,8 +1028,8 @@ public virtual async Task> GetManagedDatabaseA /// /// The name of the database. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetManagedDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -1037,7 +1040,7 @@ public virtual Response GetManagedDatabase(string datab /// An object representing collection of ManagedInstanceServerConfigurationOptionResources and their operations over a ManagedInstanceServerConfigurationOptionResource. public virtual ManagedInstanceServerConfigurationOptionCollection GetManagedInstanceServerConfigurationOptions() { - return GetCachedClient(Client => new ManagedInstanceServerConfigurationOptionCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceServerConfigurationOptionCollection(client, Id)); } /// @@ -1086,7 +1089,7 @@ public virtual Response GetMan /// An object representing collection of ManagedInstanceStartStopScheduleResources and their operations over a ManagedInstanceStartStopScheduleResource. public virtual ManagedInstanceStartStopScheduleCollection GetManagedInstanceStartStopSchedules() { - return GetCachedClient(Client => new ManagedInstanceStartStopScheduleCollection(Client, Id)); + return GetCachedClient(client => new ManagedInstanceStartStopScheduleCollection(client, Id)); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerConfigurationOptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerConfigurationOptionResource.cs index 4242cf3051701..8ce62070c8681 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerConfigurationOptionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerConfigurationOptionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceServerConfigurationOptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The serverConfigurationOptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, ManagedInstanceServerConfigurationOptionName serverConfigurationOptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerTrustCertificateResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerTrustCertificateResource.cs index e3b88b12ec263..f010b3e215252 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerTrustCertificateResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceServerTrustCertificateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceServerTrustCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The certificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string certificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceStartStopScheduleResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceStartStopScheduleResource.cs index 50a687ecb856c..a33de269cbe31 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceStartStopScheduleResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceStartStopScheduleResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceStartStopScheduleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The startStopScheduleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, ManagedInstanceStartStopScheduleName startStopScheduleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentResource.cs index 1816357840f43..51e7e70260407 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedInstanceVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The vulnerabilityAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedLedgerDigestUploadResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedLedgerDigestUploadResource.cs index 8d460ed46a6cd..3339b899b1834 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedLedgerDigestUploadResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedLedgerDigestUploadResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedLedgerDigestUploadResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The ledgerDigestUploads. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, ManagedLedgerDigestUploadsName ledgerDigestUploads) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource.cs index 518d60b7c45b5..6e1a986e99ba0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The restorableDroppedDatabaseId. + /// The policyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs index fa95151fdb865..ef94c14ed3b7d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerDnsAliasResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedServerDnsAliasResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The dnsAliasName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string dnsAliasName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPolicyResource.cs index 21f1f3c717344..ac34169496baf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ManagedServerSecurityAlertPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The securityAlertPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, SqlSecurityAlertPolicyName securityAlertPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedTransparentDataEncryptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedTransparentDataEncryptionResource.cs index 785c6b5e73078..b84b82e133bf8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedTransparentDataEncryptionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedTransparentDataEncryptionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class ManagedTransparentDataEncryptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The databaseName. + /// The tdeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption/{tdeName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRuleResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRuleResource.cs index 40f8c147f7cf3..6eafe249a77a9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRuleResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class OutboundFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The outboundRuleFqdn. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string outboundRuleFqdn) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/outboundFirewallRules/{outboundRuleFqdn}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedActionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedActionResource.cs index 01c22964e5e37..1b50db738afeb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedActionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedActionResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Sql public partial class RecommendedActionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The advisorName. + /// The recommendedActionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableDatabaseResource.cs index 769efd848aa20..eb200b1637bf6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableDatabaseResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class RecoverableDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabaseResource.cs index be570c09810ad..de12d4c67e545 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabaseResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class RecoverableManagedDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The recoverableDatabaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string recoverableDatabaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupResource.cs index badf0d856d24f..b43f6c0f0f7c4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionBackupResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.Sql public partial class ResourceGroupLongTermRetentionBackupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The locationName. + /// The longTermRetentionServerName. + /// The longTermRetentionDatabaseName. + /// The backupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionManagedInstanceBackupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionManagedInstanceBackupResource.cs index fb7a7f57a1ab8..596fbc14dd920 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionManagedInstanceBackupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ResourceGroupLongTermRetentionManagedInstanceBackupResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Sql public partial class ResourceGroupLongTermRetentionManagedInstanceBackupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The locationName. + /// The managedInstanceName. + /// The databaseName. + /// The backupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseResource.cs index 4707f51fbcd7e..14ad422ce335f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabaseResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class RestorableDroppedDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The restorableDroppedDatabaseId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string restorableDroppedDatabaseId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseResource.cs index cabaca176a2cd..fcbfb22e337f5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class RestorableDroppedManagedDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. + /// The restorableDroppedDatabaseId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResources and their operations over a ManagedRestorableDroppedDbBackupShortTermRetentionPolicyResource. public virtual ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection GetManagedRestorableDroppedDbBackupShortTermRetentionPolicies() { - return GetCachedClient(Client => new ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection(Client, Id)); + return GetCachedClient(client => new ManagedRestorableDroppedDbBackupShortTermRetentionPolicyCollection(client, Id)); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvancedThreatProtectionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvancedThreatProtectionResource.cs index ef055106efe50..cb0015ecd7a83 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvancedThreatProtectionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvancedThreatProtectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class ServerAdvancedThreatProtectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The advancedThreatProtectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, AdvancedThreatProtectionName advancedThreatProtectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceObjectiveResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceObjectiveResource.cs index 180c599075116..bf4fde58763e1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceObjectiveResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceObjectiveResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class ServiceObjectiveResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The serviceObjectiveName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string serviceObjectiveName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentConfigurationResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentConfigurationResource.cs index 4c793c783d79f..b81b5c1314aa8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentConfigurationResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentConfigurationResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Sql public partial class SqlAgentConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The managedInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/sqlAgent/current"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorResource.cs index 5244b3a9438ad..e6bf018f21c82 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseAdvisorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The advisorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string advisorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of RecommendedActionResources and their operations over a RecommendedActionResource. public virtual RecommendedActionCollection GetRecommendedActions() { - return GetCachedClient(Client => new RecommendedActionCollection(Client, Id)); + return GetCachedClient(client => new RecommendedActionCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual RecommendedActionCollection GetRecommendedActions() /// /// The name of Database Recommended Action. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRecommendedActionAsync(string recommendedActionName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetRecommendedAct /// /// The name of Database Recommended Action. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRecommendedAction(string recommendedActionName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAutomaticTuningResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAutomaticTuningResource.cs index be879b01d8492..3c7710813dd17 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAutomaticTuningResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAutomaticTuningResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseAutomaticTuningResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseBlobAuditingPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseBlobAuditingPolicyResource.cs index fe6dd1ef05097..adfc74a83d68e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseBlobAuditingPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseBlobAuditingPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseBlobAuditingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The blobAuditingPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, BlobAuditingPolicyName blobAuditingPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnResource.cs index 45d445d1d8b4a..423e47aef84be 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseColumnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The schemaName. + /// The tableName. + /// The columnName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}"; @@ -96,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlDatabaseSensitivityLabelResources and their operations over a SqlDatabaseSensitivityLabelResource. public virtual SqlDatabaseSensitivityLabelCollection GetSqlDatabaseSensitivityLabels() { - return GetCachedClient(Client => new SqlDatabaseSensitivityLabelCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseSensitivityLabelCollection(client, Id)); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs index 10983732e0e41..23f2ff72e3e20 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}"; @@ -143,7 +147,7 @@ public virtual DataMaskingPolicyResource GetDataMaskingPolicy() /// An object representing collection of GeoBackupPolicyResources and their operations over a GeoBackupPolicyResource. public virtual GeoBackupPolicyCollection GetGeoBackupPolicies() { - return GetCachedClient(Client => new GeoBackupPolicyCollection(Client, Id)); + return GetCachedClient(client => new GeoBackupPolicyCollection(client, Id)); } /// @@ -192,7 +196,7 @@ public virtual Response GetGeoBackupPolicy(GeoBackupPol /// An object representing collection of SqlDatabaseAdvisorResources and their operations over a SqlDatabaseAdvisorResource. public virtual SqlDatabaseAdvisorCollection GetSqlDatabaseAdvisors() { - return GetCachedClient(Client => new SqlDatabaseAdvisorCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseAdvisorCollection(client, Id)); } /// @@ -210,8 +214,8 @@ public virtual SqlDatabaseAdvisorCollection GetSqlDatabaseAdvisors() /// /// The name of the Database Advisor. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseAdvisorAsync(string advisorName, CancellationToken cancellationToken = default) { @@ -233,8 +237,8 @@ public virtual async Task> GetSqlDatabaseAd /// /// The name of the Database Advisor. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseAdvisor(string advisorName, CancellationToken cancellationToken = default) { @@ -252,7 +256,7 @@ public virtual SqlDatabaseAutomaticTuningResource GetSqlDatabaseAutomaticTuning( /// An object representing collection of SqlDatabaseSchemaResources and their operations over a SqlDatabaseSchemaResource. public virtual SqlDatabaseSchemaCollection GetSqlDatabaseSchemas() { - return GetCachedClient(Client => new SqlDatabaseSchemaCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseSchemaCollection(client, Id)); } /// @@ -270,8 +274,8 @@ public virtual SqlDatabaseSchemaCollection GetSqlDatabaseSchemas() /// /// The name of the schema. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseSchemaAsync(string schemaName, CancellationToken cancellationToken = default) { @@ -293,8 +297,8 @@ public virtual async Task> GetSqlDatabaseSch /// /// The name of the schema. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseSchema(string schemaName, CancellationToken cancellationToken = default) { @@ -305,7 +309,7 @@ public virtual Response GetSqlDatabaseSchema(string s /// An object representing collection of SqlDatabaseSecurityAlertPolicyResources and their operations over a SqlDatabaseSecurityAlertPolicyResource. public virtual SqlDatabaseSecurityAlertPolicyCollection GetSqlDatabaseSecurityAlertPolicies() { - return GetCachedClient(Client => new SqlDatabaseSecurityAlertPolicyCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseSecurityAlertPolicyCollection(client, Id)); } /// @@ -354,7 +358,7 @@ public virtual Response GetSqlDatabaseSe /// An object representing collection of SqlDatabaseVulnerabilityAssessmentResources and their operations over a SqlDatabaseVulnerabilityAssessmentResource. public virtual SqlDatabaseVulnerabilityAssessmentCollection GetSqlDatabaseVulnerabilityAssessments() { - return GetCachedClient(Client => new SqlDatabaseVulnerabilityAssessmentCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseVulnerabilityAssessmentCollection(client, Id)); } /// @@ -403,7 +407,7 @@ public virtual Response GetSqlDataba /// An object representing collection of DataWarehouseUserActivityResources and their operations over a DataWarehouseUserActivityResource. public virtual DataWarehouseUserActivityCollection GetDataWarehouseUserActivities() { - return GetCachedClient(Client => new DataWarehouseUserActivityCollection(Client, Id)); + return GetCachedClient(client => new DataWarehouseUserActivityCollection(client, Id)); } /// @@ -452,7 +456,7 @@ public virtual Response GetDataWarehouseUserA /// An object representing collection of LongTermRetentionPolicyResources and their operations over a LongTermRetentionPolicyResource. public virtual LongTermRetentionPolicyCollection GetLongTermRetentionPolicies() { - return GetCachedClient(Client => new LongTermRetentionPolicyCollection(Client, Id)); + return GetCachedClient(client => new LongTermRetentionPolicyCollection(client, Id)); } /// @@ -515,7 +519,7 @@ public virtual MaintenanceWindowsResource GetMaintenanceWindows() /// An object representing collection of SqlServerDatabaseRestorePointResources and their operations over a SqlServerDatabaseRestorePointResource. public virtual SqlServerDatabaseRestorePointCollection GetSqlServerDatabaseRestorePoints() { - return GetCachedClient(Client => new SqlServerDatabaseRestorePointCollection(Client, Id)); + return GetCachedClient(client => new SqlServerDatabaseRestorePointCollection(client, Id)); } /// @@ -533,8 +537,8 @@ public virtual SqlServerDatabaseRestorePointCollection GetSqlServerDatabaseResto /// /// The name of the restore point. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerDatabaseRestorePointAsync(string restorePointName, CancellationToken cancellationToken = default) { @@ -556,8 +560,8 @@ public virtual async Task> GetSq /// /// The name of the restore point. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerDatabaseRestorePoint(string restorePointName, CancellationToken cancellationToken = default) { @@ -568,7 +572,7 @@ public virtual Response GetSqlServerDatab /// An object representing collection of SyncGroupResources and their operations over a SyncGroupResource. public virtual SyncGroupCollection GetSyncGroups() { - return GetCachedClient(Client => new SyncGroupCollection(Client, Id)); + return GetCachedClient(client => new SyncGroupCollection(client, Id)); } /// @@ -586,8 +590,8 @@ public virtual SyncGroupCollection GetSyncGroups() /// /// The name of the sync group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSyncGroupAsync(string syncGroupName, CancellationToken cancellationToken = default) { @@ -609,8 +613,8 @@ public virtual async Task> GetSyncGroupAsync(string /// /// The name of the sync group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSyncGroup(string syncGroupName, CancellationToken cancellationToken = default) { @@ -621,7 +625,7 @@ public virtual Response GetSyncGroup(string syncGroupName, Ca /// An object representing collection of WorkloadGroupResources and their operations over a WorkloadGroupResource. public virtual WorkloadGroupCollection GetWorkloadGroups() { - return GetCachedClient(Client => new WorkloadGroupCollection(Client, Id)); + return GetCachedClient(client => new WorkloadGroupCollection(client, Id)); } /// @@ -639,8 +643,8 @@ public virtual WorkloadGroupCollection GetWorkloadGroups() /// /// The name of the workload group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadGroupAsync(string workloadGroupName, CancellationToken cancellationToken = default) { @@ -662,8 +666,8 @@ public virtual async Task> GetWorkloadGroupAsync /// /// The name of the workload group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadGroup(string workloadGroupName, CancellationToken cancellationToken = default) { @@ -674,7 +678,7 @@ public virtual Response GetWorkloadGroup(string workloadG /// An object representing collection of BackupShortTermRetentionPolicyResources and their operations over a BackupShortTermRetentionPolicyResource. public virtual BackupShortTermRetentionPolicyCollection GetBackupShortTermRetentionPolicies() { - return GetCachedClient(Client => new BackupShortTermRetentionPolicyCollection(Client, Id)); + return GetCachedClient(client => new BackupShortTermRetentionPolicyCollection(client, Id)); } /// @@ -723,7 +727,7 @@ public virtual Response GetBackupShortTe /// An object representing collection of LedgerDigestUploadResources and their operations over a LedgerDigestUploadResource. public virtual LedgerDigestUploadCollection GetLedgerDigestUploads() { - return GetCachedClient(Client => new LedgerDigestUploadCollection(Client, Id)); + return GetCachedClient(client => new LedgerDigestUploadCollection(client, Id)); } /// @@ -772,7 +776,7 @@ public virtual Response GetLedgerDigestUpload(Ledger /// An object representing collection of SqlDatabaseBlobAuditingPolicyResources and their operations over a SqlDatabaseBlobAuditingPolicyResource. public virtual SqlDatabaseBlobAuditingPolicyCollection GetSqlDatabaseBlobAuditingPolicies() { - return GetCachedClient(Client => new SqlDatabaseBlobAuditingPolicyCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseBlobAuditingPolicyCollection(client, Id)); } /// @@ -821,7 +825,7 @@ public virtual Response GetSqlDatabaseBlo /// An object representing collection of ExtendedDatabaseBlobAuditingPolicyResources and their operations over a ExtendedDatabaseBlobAuditingPolicyResource. public virtual ExtendedDatabaseBlobAuditingPolicyCollection GetExtendedDatabaseBlobAuditingPolicies() { - return GetCachedClient(Client => new ExtendedDatabaseBlobAuditingPolicyCollection(Client, Id)); + return GetCachedClient(client => new ExtendedDatabaseBlobAuditingPolicyCollection(client, Id)); } /// @@ -870,7 +874,7 @@ public virtual Response GetExtendedD /// An object representing collection of DatabaseAdvancedThreatProtectionResources and their operations over a DatabaseAdvancedThreatProtectionResource. public virtual DatabaseAdvancedThreatProtectionCollection GetDatabaseAdvancedThreatProtections() { - return GetCachedClient(Client => new DatabaseAdvancedThreatProtectionCollection(Client, Id)); + return GetCachedClient(client => new DatabaseAdvancedThreatProtectionCollection(client, Id)); } /// @@ -919,7 +923,7 @@ public virtual Response GetDatabaseAdv /// An object representing collection of SqlServerDatabaseReplicationLinkResources and their operations over a SqlServerDatabaseReplicationLinkResource. public virtual SqlServerDatabaseReplicationLinkCollection GetSqlServerDatabaseReplicationLinks() { - return GetCachedClient(Client => new SqlServerDatabaseReplicationLinkCollection(Client, Id)); + return GetCachedClient(client => new SqlServerDatabaseReplicationLinkCollection(client, Id)); } /// @@ -937,8 +941,8 @@ public virtual SqlServerDatabaseReplicationLinkCollection GetSqlServerDatabaseRe /// /// The name of the replication link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerDatabaseReplicationLinkAsync(string linkId, CancellationToken cancellationToken = default) { @@ -960,8 +964,8 @@ public virtual async Task> Ge /// /// The name of the replication link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerDatabaseReplicationLink(string linkId, CancellationToken cancellationToken = default) { @@ -972,7 +976,7 @@ public virtual Response GetSqlServerDa /// An object representing collection of LogicalDatabaseTransparentDataEncryptionResources and their operations over a LogicalDatabaseTransparentDataEncryptionResource. public virtual LogicalDatabaseTransparentDataEncryptionCollection GetLogicalDatabaseTransparentDataEncryptions() { - return GetCachedClient(Client => new LogicalDatabaseTransparentDataEncryptionCollection(Client, Id)); + return GetCachedClient(client => new LogicalDatabaseTransparentDataEncryptionCollection(client, Id)); } /// @@ -1021,7 +1025,7 @@ public virtual Response GetLog /// An object representing collection of SqlDatabaseSqlVulnerabilityAssessmentResources and their operations over a SqlDatabaseSqlVulnerabilityAssessmentResource. public virtual SqlDatabaseSqlVulnerabilityAssessmentCollection GetSqlDatabaseSqlVulnerabilityAssessments() { - return GetCachedClient(Client => new SqlDatabaseSqlVulnerabilityAssessmentCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseSqlVulnerabilityAssessmentCollection(client, Id)); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaResource.cs index 7a3dd71b4bfa6..4a9f47e868953 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseSchemaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The schemaName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlDatabaseTableResources and their operations over a SqlDatabaseTableResource. public virtual SqlDatabaseTableCollection GetSqlDatabaseTables() { - return GetCachedClient(Client => new SqlDatabaseTableCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseTableCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual SqlDatabaseTableCollection GetSqlDatabaseTables() /// /// The name of the table. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseTableAsync(string tableName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetSqlDatabaseTabl /// /// The name of the table. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseTable(string tableName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSecurityAlertPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSecurityAlertPolicyResource.cs index 3eb804f0301af..269cb5b0aeded 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSecurityAlertPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSecurityAlertPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseSecurityAlertPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The securityAlertPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, SqlSecurityAlertPolicyName securityAlertPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSensitivityLabelResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSensitivityLabelResource.cs index 832d789478f96..b14532a6d57af 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSensitivityLabelResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSensitivityLabelResource.cs @@ -26,6 +26,14 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseSensitivityLabelResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The schemaName. + /// The tableName. + /// The columnName. + /// The sensitivityLabelSource. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, SensitivityLabelSource sensitivityLabelSource) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.cs index 4599cf5f7ffec..660b934a9f606 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseSqlVulnerabilityAssessmentBaselineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The vulnerabilityAssessmentName. + /// The baselineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, SqlVulnerabilityAssessmentBaselineName baselineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}"; @@ -91,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResources and their operations over a SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource. public virtual SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection GetSqlDatabaseSqlVulnerabilityAssessmentBaselineRules() { - return GetCachedClient(Client => new SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection(client, Id)); } /// @@ -109,8 +115,8 @@ public virtual SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleCollection GetSq /// /// The vulnerability assessment rule ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseSqlVulnerabilityAssessmentBaselineRuleAsync(string ruleId, CancellationToken cancellationToken = default) { @@ -132,8 +138,8 @@ public virtual async Task /// The vulnerability assessment rule ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseSqlVulnerabilityAssessmentBaselineRule(string ruleId, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource.cs index e50105555bd3c..505ea6c8b3a3c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseSqlVulnerabilityAssessmentBaselineRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The vulnerabilityAssessmentName. + /// The baselineName. + /// The ruleId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, SqlVulnerabilityAssessmentBaselineName baselineName, string ruleId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentResource.cs index 96382bf2f6f63..e4a8cfd4f71f2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseSqlVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The vulnerabilityAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}"; @@ -95,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlDatabaseSqlVulnerabilityAssessmentBaselineResources and their operations over a SqlDatabaseSqlVulnerabilityAssessmentBaselineResource. public virtual SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection GetSqlDatabaseSqlVulnerabilityAssessmentBaselines() { - return GetCachedClient(Client => new SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseSqlVulnerabilityAssessmentBaselineCollection(client, Id)); } /// @@ -144,7 +149,7 @@ public virtual Response G /// An object representing collection of SqlDatabaseSqlVulnerabilityAssessmentScanResources and their operations over a SqlDatabaseSqlVulnerabilityAssessmentScanResource. public virtual SqlDatabaseSqlVulnerabilityAssessmentScanCollection GetSqlDatabaseSqlVulnerabilityAssessmentScans() { - return GetCachedClient(Client => new SqlDatabaseSqlVulnerabilityAssessmentScanCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseSqlVulnerabilityAssessmentScanCollection(client, Id)); } /// @@ -162,8 +167,8 @@ public virtual SqlDatabaseSqlVulnerabilityAssessmentScanCollection GetSqlDatabas /// /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseSqlVulnerabilityAssessmentScanAsync(string scanId, CancellationToken cancellationToken = default) { @@ -185,8 +190,8 @@ public virtual async Task /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseSqlVulnerabilityAssessmentScan(string scanId, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResource.cs index bfeb096da31b0..d477d55364321 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseSqlVulnerabilityAssessmentScanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The vulnerabilityAssessmentName. + /// The scanId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}"; @@ -91,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlDatabaseSqlVulnerabilityAssessmentScanResultResources and their operations over a SqlDatabaseSqlVulnerabilityAssessmentScanResultResource. public virtual SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection GetSqlDatabaseSqlVulnerabilityAssessmentScanResults() { - return GetCachedClient(Client => new SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection(client, Id)); } /// @@ -109,8 +115,8 @@ public virtual SqlDatabaseSqlVulnerabilityAssessmentScanResultCollection GetSqlD /// /// The scan result id of the specific result to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseSqlVulnerabilityAssessmentScanResultAsync(string scanResultId, CancellationToken cancellationToken = default) { @@ -132,8 +138,8 @@ public virtual async Task /// The scan result id of the specific result to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseSqlVulnerabilityAssessmentScanResult(string scanResultId, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResultResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResultResource.cs index 8d9af83256359..6f1568967d663 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResultResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResultResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseSqlVulnerabilityAssessmentScanResultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The vulnerabilityAssessmentName. + /// The scanId. + /// The scanResultId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, string scanResultId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults/{scanResultId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableResource.cs index 9c32dd2a52bec..8076d39637a64 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseTableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The schemaName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}"; @@ -90,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlDatabaseColumnResources and their operations over a SqlDatabaseColumnResource. public virtual SqlDatabaseColumnCollection GetSqlDatabaseColumns() { - return GetCachedClient(Client => new SqlDatabaseColumnCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseColumnCollection(client, Id)); } /// @@ -108,8 +114,8 @@ public virtual SqlDatabaseColumnCollection GetSqlDatabaseColumns() /// /// The name of the column. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseColumnAsync(string columnName, CancellationToken cancellationToken = default) { @@ -131,8 +137,8 @@ public virtual async Task> GetSqlDatabaseCol /// /// The name of the column. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseColumn(string columnName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentResource.cs index a892a39868b9a..cdeb1fc44e80c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The vulnerabilityAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlDatabaseVulnerabilityAssessmentRuleBaselineResources and their operations over a SqlDatabaseVulnerabilityAssessmentRuleBaselineResource. public virtual SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection GetSqlDatabaseVulnerabilityAssessmentRuleBaselines() { - return GetCachedClient(Client => new SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection(client, Id)); } /// @@ -110,8 +115,8 @@ public virtual SqlDatabaseVulnerabilityAssessmentRuleBaselineCollection GetSqlDa /// The vulnerability assessment rule ID. /// The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseVulnerabilityAssessmentRuleBaselineAsync(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) { @@ -134,8 +139,8 @@ public virtual async Task The vulnerability assessment rule ID. /// The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseVulnerabilityAssessmentRuleBaseline(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) { @@ -146,7 +151,7 @@ public virtual Response /// An object representing collection of SqlDatabaseVulnerabilityAssessmentScanResources and their operations over a SqlDatabaseVulnerabilityAssessmentScanResource. public virtual SqlDatabaseVulnerabilityAssessmentScanCollection GetSqlDatabaseVulnerabilityAssessmentScans() { - return GetCachedClient(Client => new SqlDatabaseVulnerabilityAssessmentScanCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseVulnerabilityAssessmentScanCollection(client, Id)); } /// @@ -164,8 +169,8 @@ public virtual SqlDatabaseVulnerabilityAssessmentScanCollection GetSqlDatabaseVu /// /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseVulnerabilityAssessmentScanAsync(string scanId, CancellationToken cancellationToken = default) { @@ -187,8 +192,8 @@ public virtual async Task /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabaseVulnerabilityAssessmentScan(string scanId, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentRuleBaselineResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentRuleBaselineResource.cs index 60af9be1692e6..035fd72c3fdfa 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentRuleBaselineResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentRuleBaselineResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseVulnerabilityAssessmentRuleBaselineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The vulnerabilityAssessmentName. + /// The ruleId. + /// The baselineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentScanResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentScanResource.cs index 3d91ccfb58fa3..20f2393c35956 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentScanResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentScanResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlDatabaseVulnerabilityAssessmentScanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The vulnerabilityAssessmentName. + /// The scanId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlFirewallRuleResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlFirewallRuleResource.cs index 84c879dc0b963..b35ecbcf357da 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlFirewallRuleResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlFirewallRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlFirewallRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The firewallRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string firewallRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateEndpointConnectionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateEndpointConnectionResource.cs index 74a24c9bb2ac1..1ccdc725a71d5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateEndpointConnectionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateLinkResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateLinkResource.cs index 7b4b2c81129ff..0d72001c312d6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateLinkResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The groupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string groupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/privateLinkResources/{groupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAdvisorResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAdvisorResource.cs index 7af2a8568aa7e..8c301657e4a7b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAdvisorResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAdvisorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerAdvisorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The advisorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string advisorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAutomaticTuningResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAutomaticTuningResource.cs index 7dbf98bd0ac31..9562a5139233e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAutomaticTuningResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAutomaticTuningResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerAutomaticTuningResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADAdministratorResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADAdministratorResource.cs index 8ec558b333f72..e2c1fce2c7b56 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADAdministratorResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADAdministratorResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerAzureADAdministratorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The administratorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, SqlAdministratorName administratorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADOnlyAuthenticationResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADOnlyAuthenticationResource.cs index f3be67652370e..0c216cec6f5b4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADOnlyAuthenticationResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerAzureADOnlyAuthenticationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerAzureADOnlyAuthenticationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The authenticationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, AuthenticationName authenticationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/azureADOnlyAuthentications/{authenticationName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerBlobAuditingPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerBlobAuditingPolicyResource.cs index 8a33c968d22d5..4ef13e39ba197 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerBlobAuditingPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerBlobAuditingPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerBlobAuditingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The blobAuditingPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, BlobAuditingPolicyName blobAuditingPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/auditingSettings/{blobAuditingPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCommunicationLinkResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCommunicationLinkResource.cs index 18e3be3009f52..6c37a6f5e8cd4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCommunicationLinkResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerCommunicationLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerCommunicationLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The communicationLinkName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string communicationLinkName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/communicationLinks/{communicationLinkName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerConnectionPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerConnectionPolicyResource.cs index 477459e550be2..f388ed036313d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerConnectionPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerConnectionPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerConnectionPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The connectionPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkResource.cs index 9eaebe86c33e3..59e9d097e1e4d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseReplicationLinkResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerDatabaseReplicationLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The linkId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string linkId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseRestorePointResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseRestorePointResource.cs index 7f2b37b88ba3a..eb45bb574cc89 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseRestorePointResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDatabaseRestorePointResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerDatabaseRestorePointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The restorePointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string restorePointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDevOpsAuditingSettingResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDevOpsAuditingSettingResource.cs index 5262043a67458..d6d928f616bc1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDevOpsAuditingSettingResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDevOpsAuditingSettingResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerDevOpsAuditingSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The devOpsAuditingSettingsName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string devOpsAuditingSettingsName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDnsAliasResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDnsAliasResource.cs index ef73ac9782168..f3cb93d5db679 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDnsAliasResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerDnsAliasResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerDnsAliasResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The dnsAliasName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string dnsAliasName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs index 27dd2c6d7d81d..b94026af76187 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobAgentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}"; @@ -98,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerJobCredentialResources and their operations over a SqlServerJobCredentialResource. public virtual SqlServerJobCredentialCollection GetSqlServerJobCredentials() { - return GetCachedClient(Client => new SqlServerJobCredentialCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobCredentialCollection(client, Id)); } /// @@ -116,8 +120,8 @@ public virtual SqlServerJobCredentialCollection GetSqlServerJobCredentials() /// /// The name of the credential. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerJobCredentialAsync(string credentialName, CancellationToken cancellationToken = default) { @@ -139,8 +143,8 @@ public virtual async Task> GetSqlServer /// /// The name of the credential. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerJobCredential(string credentialName, CancellationToken cancellationToken = default) { @@ -151,7 +155,7 @@ public virtual Response GetSqlServerJobCredentia /// An object representing collection of SqlServerJobResources and their operations over a SqlServerJobResource. public virtual SqlServerJobCollection GetSqlServerJobs() { - return GetCachedClient(Client => new SqlServerJobCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobCollection(client, Id)); } /// @@ -169,8 +173,8 @@ public virtual SqlServerJobCollection GetSqlServerJobs() /// /// The name of the job to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerJobAsync(string jobName, CancellationToken cancellationToken = default) { @@ -192,8 +196,8 @@ public virtual async Task> GetSqlServerJobAsync(s /// /// The name of the job to get. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerJob(string jobName, CancellationToken cancellationToken = default) { @@ -204,7 +208,7 @@ public virtual Response GetSqlServerJob(string jobName, Ca /// An object representing collection of SqlServerJobTargetGroupResources and their operations over a SqlServerJobTargetGroupResource. public virtual SqlServerJobTargetGroupCollection GetSqlServerJobTargetGroups() { - return GetCachedClient(Client => new SqlServerJobTargetGroupCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobTargetGroupCollection(client, Id)); } /// @@ -222,8 +226,8 @@ public virtual SqlServerJobTargetGroupCollection GetSqlServerJobTargetGroups() /// /// The name of the target group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerJobTargetGroupAsync(string targetGroupName, CancellationToken cancellationToken = default) { @@ -245,8 +249,8 @@ public virtual async Task> GetSqlServe /// /// The name of the target group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerJobTargetGroup(string targetGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCredentialResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCredentialResource.cs index 707ccab5d6885..eed46829c97bf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCredentialResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobCredentialResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobCredentialResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The credentialName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string credentialName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionResource.cs index a6b80d17a5e99..35c927c1146ce 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobExecutionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The jobName. + /// The jobExecutionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string jobName, Guid jobExecutionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}"; @@ -90,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerJobExecutionStepResources and their operations over a SqlServerJobExecutionStepResource. public virtual SqlServerJobExecutionStepCollection GetSqlServerJobExecutionSteps() { - return GetCachedClient(Client => new SqlServerJobExecutionStepCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobExecutionStepCollection(client, Id)); } /// @@ -108,8 +114,8 @@ public virtual SqlServerJobExecutionStepCollection GetSqlServerJobExecutionSteps /// /// The name of the step. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerJobExecutionStepAsync(string stepName, CancellationToken cancellationToken = default) { @@ -131,8 +137,8 @@ public virtual async Task> GetSqlSer /// /// The name of the step. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerJobExecutionStep(string stepName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepResource.cs index 6c2e4e6ac1b9f..9fc70cf690810 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepResource.cs @@ -25,6 +25,13 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobExecutionStepResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The jobName. + /// The jobExecutionId. + /// The stepName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string jobName, Guid jobExecutionId, string stepName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}"; @@ -90,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerJobExecutionStepTargetResources and their operations over a SqlServerJobExecutionStepTargetResource. public virtual SqlServerJobExecutionStepTargetCollection GetSqlServerJobExecutionStepTargets() { - return GetCachedClient(Client => new SqlServerJobExecutionStepTargetCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobExecutionStepTargetCollection(client, Id)); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepTargetResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepTargetResource.cs index d4ba1fe5688a3..e638a4048aa8c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepTargetResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepTargetResource.cs @@ -25,6 +25,14 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobExecutionStepTargetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The jobName. + /// The jobExecutionId. + /// The stepName. + /// The targetId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string jobName, Guid jobExecutionId, string stepName, Guid targetId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets/{targetId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobResource.cs index 0713e30617059..805b9e5251688 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}"; @@ -95,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerJobExecutionResources and their operations over a SqlServerJobExecutionResource. public virtual SqlServerJobExecutionCollection GetSqlServerJobExecutions() { - return GetCachedClient(Client => new SqlServerJobExecutionCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobExecutionCollection(client, Id)); } /// @@ -144,7 +149,7 @@ public virtual Response GetSqlServerJobExecution( /// An object representing collection of SqlServerJobStepResources and their operations over a SqlServerJobStepResource. public virtual SqlServerJobStepCollection GetSqlServerJobSteps() { - return GetCachedClient(Client => new SqlServerJobStepCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobStepCollection(client, Id)); } /// @@ -162,8 +167,8 @@ public virtual SqlServerJobStepCollection GetSqlServerJobSteps() /// /// The name of the job step. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerJobStepAsync(string stepName, CancellationToken cancellationToken = default) { @@ -185,8 +190,8 @@ public virtual async Task> GetSqlServerJobSte /// /// The name of the job step. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerJobStep(string stepName, CancellationToken cancellationToken = default) { @@ -197,7 +202,7 @@ public virtual Response GetSqlServerJobStep(string ste /// An object representing collection of SqlServerJobVersionResources and their operations over a SqlServerJobVersionResource. public virtual SqlServerJobVersionCollection GetSqlServerJobVersions() { - return GetCachedClient(Client => new SqlServerJobVersionCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobVersionCollection(client, Id)); } /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobStepResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobStepResource.cs index 33a1f5c7805b0..74a6a9b92ab65 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobStepResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobStepResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobStepResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The jobName. + /// The stepName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string jobName, string stepName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobTargetGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobTargetGroupResource.cs index 1f1b65b10020b..5b403c623dee7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobTargetGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobTargetGroupResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobTargetGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The targetGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string targetGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionResource.cs index 001b8264d6d73..da7704bcf611f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobVersionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The jobName. + /// The jobVersion. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string jobName, int jobVersion) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}"; @@ -90,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerJobVersionStepResources and their operations over a SqlServerJobVersionStepResource. public virtual SqlServerJobVersionStepCollection GetSqlServerJobVersionSteps() { - return GetCachedClient(Client => new SqlServerJobVersionStepCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobVersionStepCollection(client, Id)); } /// @@ -108,8 +114,8 @@ public virtual SqlServerJobVersionStepCollection GetSqlServerJobVersionSteps() /// /// The name of the job step. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerJobVersionStepAsync(string stepName, CancellationToken cancellationToken = default) { @@ -131,8 +137,8 @@ public virtual async Task> GetSqlServe /// /// The name of the job step. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerJobVersionStep(string stepName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionStepResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionStepResource.cs index f053c2968fa91..b895894b2b5ec 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionStepResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionStepResource.cs @@ -25,6 +25,13 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerJobVersionStepResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The jobName. + /// The jobVersion. + /// The stepName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string jobName, int jobVersion, string stepName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerKeyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerKeyResource.cs index 08c2bb89a6ff4..a5d220fdc3154 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerKeyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerKeyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerKeyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The keyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string keyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs index 6cc822786c4a7..c2a6b0e113523 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}"; @@ -116,7 +119,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerCommunicationLinkResources and their operations over a SqlServerCommunicationLinkResource. public virtual SqlServerCommunicationLinkCollection GetSqlServerCommunicationLinks() { - return GetCachedClient(Client => new SqlServerCommunicationLinkCollection(Client, Id)); + return GetCachedClient(client => new SqlServerCommunicationLinkCollection(client, Id)); } /// @@ -134,8 +137,8 @@ public virtual SqlServerCommunicationLinkCollection GetSqlServerCommunicationLin /// /// The name of the server communication link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerCommunicationLinkAsync(string communicationLinkName, CancellationToken cancellationToken = default) { @@ -157,8 +160,8 @@ public virtual async Task> GetSqlSe /// /// The name of the server communication link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerCommunicationLink(string communicationLinkName, CancellationToken cancellationToken = default) { @@ -169,7 +172,7 @@ public virtual Response GetSqlServerCommunic /// An object representing collection of ServiceObjectiveResources and their operations over a ServiceObjectiveResource. public virtual ServiceObjectiveCollection GetServiceObjectives() { - return GetCachedClient(Client => new ServiceObjectiveCollection(Client, Id)); + return GetCachedClient(client => new ServiceObjectiveCollection(client, Id)); } /// @@ -187,8 +190,8 @@ public virtual ServiceObjectiveCollection GetServiceObjectives() /// /// The name of the service objective to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetServiceObjectiveAsync(string serviceObjectiveName, CancellationToken cancellationToken = default) { @@ -210,8 +213,8 @@ public virtual async Task> GetServiceObjectiv /// /// The name of the service objective to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetServiceObjective(string serviceObjectiveName, CancellationToken cancellationToken = default) { @@ -222,7 +225,7 @@ public virtual Response GetServiceObjective(string ser /// An object representing collection of SqlServerAdvisorResources and their operations over a SqlServerAdvisorResource. public virtual SqlServerAdvisorCollection GetSqlServerAdvisors() { - return GetCachedClient(Client => new SqlServerAdvisorCollection(Client, Id)); + return GetCachedClient(client => new SqlServerAdvisorCollection(client, Id)); } /// @@ -240,8 +243,8 @@ public virtual SqlServerAdvisorCollection GetSqlServerAdvisors() /// /// The name of the Server Advisor. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerAdvisorAsync(string advisorName, CancellationToken cancellationToken = default) { @@ -263,8 +266,8 @@ public virtual async Task> GetSqlServerAdviso /// /// The name of the Server Advisor. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerAdvisor(string advisorName, CancellationToken cancellationToken = default) { @@ -275,7 +278,7 @@ public virtual Response GetSqlServerAdvisor(string adv /// An object representing collection of EncryptionProtectorResources and their operations over a EncryptionProtectorResource. public virtual EncryptionProtectorCollection GetEncryptionProtectors() { - return GetCachedClient(Client => new EncryptionProtectorCollection(Client, Id)); + return GetCachedClient(client => new EncryptionProtectorCollection(client, Id)); } /// @@ -324,7 +327,7 @@ public virtual Response GetEncryptionProtector(Encr /// An object representing collection of SqlFirewallRuleResources and their operations over a SqlFirewallRuleResource. public virtual SqlFirewallRuleCollection GetSqlFirewallRules() { - return GetCachedClient(Client => new SqlFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new SqlFirewallRuleCollection(client, Id)); } /// @@ -342,8 +345,8 @@ public virtual SqlFirewallRuleCollection GetSqlFirewallRules() /// /// The name of the firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlFirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -365,8 +368,8 @@ public virtual async Task> GetSqlFirewallRuleA /// /// The name of the firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlFirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -377,7 +380,7 @@ public virtual Response GetSqlFirewallRule(string firew /// An object representing collection of SqlServerJobAgentResources and their operations over a SqlServerJobAgentResource. public virtual SqlServerJobAgentCollection GetSqlServerJobAgents() { - return GetCachedClient(Client => new SqlServerJobAgentCollection(Client, Id)); + return GetCachedClient(client => new SqlServerJobAgentCollection(client, Id)); } /// @@ -395,8 +398,8 @@ public virtual SqlServerJobAgentCollection GetSqlServerJobAgents() /// /// The name of the job agent to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerJobAgentAsync(string jobAgentName, CancellationToken cancellationToken = default) { @@ -418,8 +421,8 @@ public virtual async Task> GetSqlServerJobAg /// /// The name of the job agent to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerJobAgent(string jobAgentName, CancellationToken cancellationToken = default) { @@ -430,7 +433,7 @@ public virtual Response GetSqlServerJobAgent(string j /// An object representing collection of SqlPrivateEndpointConnectionResources and their operations over a SqlPrivateEndpointConnectionResource. public virtual SqlPrivateEndpointConnectionCollection GetSqlPrivateEndpointConnections() { - return GetCachedClient(Client => new SqlPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new SqlPrivateEndpointConnectionCollection(client, Id)); } /// @@ -448,8 +451,8 @@ public virtual SqlPrivateEndpointConnectionCollection GetSqlPrivateEndpointConne /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -471,8 +474,8 @@ public virtual async Task> GetSql /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -483,7 +486,7 @@ public virtual Response GetSqlPrivateEndpo /// An object representing collection of SqlPrivateLinkResources and their operations over a SqlPrivateLinkResource. public virtual SqlPrivateLinkResourceCollection GetSqlPrivateLinkResources() { - return GetCachedClient(Client => new SqlPrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new SqlPrivateLinkResourceCollection(client, Id)); } /// @@ -501,8 +504,8 @@ public virtual SqlPrivateLinkResourceCollection GetSqlPrivateLinkResources() /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlPrivateLinkResourceAsync(string groupName, CancellationToken cancellationToken = default) { @@ -524,8 +527,8 @@ public virtual async Task> GetSqlPrivateLinkRes /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlPrivateLinkResource(string groupName, CancellationToken cancellationToken = default) { @@ -543,7 +546,7 @@ public virtual SqlServerAutomaticTuningResource GetSqlServerAutomaticTuning() /// An object representing collection of SqlServerAzureADAdministratorResources and their operations over a SqlServerAzureADAdministratorResource. public virtual SqlServerAzureADAdministratorCollection GetSqlServerAzureADAdministrators() { - return GetCachedClient(Client => new SqlServerAzureADAdministratorCollection(Client, Id)); + return GetCachedClient(client => new SqlServerAzureADAdministratorCollection(client, Id)); } /// @@ -592,7 +595,7 @@ public virtual Response GetSqlServerAzure /// An object representing collection of SqlServerAzureADOnlyAuthenticationResources and their operations over a SqlServerAzureADOnlyAuthenticationResource. public virtual SqlServerAzureADOnlyAuthenticationCollection GetSqlServerAzureADOnlyAuthentications() { - return GetCachedClient(Client => new SqlServerAzureADOnlyAuthenticationCollection(Client, Id)); + return GetCachedClient(client => new SqlServerAzureADOnlyAuthenticationCollection(client, Id)); } /// @@ -641,7 +644,7 @@ public virtual Response GetSqlServer /// An object representing collection of SqlServerDevOpsAuditingSettingResources and their operations over a SqlServerDevOpsAuditingSettingResource. public virtual SqlServerDevOpsAuditingSettingCollection GetSqlServerDevOpsAuditingSettings() { - return GetCachedClient(Client => new SqlServerDevOpsAuditingSettingCollection(Client, Id)); + return GetCachedClient(client => new SqlServerDevOpsAuditingSettingCollection(client, Id)); } /// @@ -659,8 +662,8 @@ public virtual SqlServerDevOpsAuditingSettingCollection GetSqlServerDevOpsAuditi /// /// The name of the devops audit settings. This should always be Default. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerDevOpsAuditingSettingAsync(string devOpsAuditingSettingsName, CancellationToken cancellationToken = default) { @@ -682,8 +685,8 @@ public virtual async Task> GetS /// /// The name of the devops audit settings. This should always be Default. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerDevOpsAuditingSetting(string devOpsAuditingSettingsName, CancellationToken cancellationToken = default) { @@ -694,7 +697,7 @@ public virtual Response GetSqlServerDevO /// An object representing collection of SqlServerDnsAliasResources and their operations over a SqlServerDnsAliasResource. public virtual SqlServerDnsAliasCollection GetSqlServerDnsAliases() { - return GetCachedClient(Client => new SqlServerDnsAliasCollection(Client, Id)); + return GetCachedClient(client => new SqlServerDnsAliasCollection(client, Id)); } /// @@ -712,8 +715,8 @@ public virtual SqlServerDnsAliasCollection GetSqlServerDnsAliases() /// /// The name of the server dns alias. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerDnsAliasAsync(string dnsAliasName, CancellationToken cancellationToken = default) { @@ -735,8 +738,8 @@ public virtual async Task> GetSqlServerDnsAl /// /// The name of the server dns alias. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerDnsAlias(string dnsAliasName, CancellationToken cancellationToken = default) { @@ -747,7 +750,7 @@ public virtual Response GetSqlServerDnsAlias(string d /// An object representing collection of SqlServerKeyResources and their operations over a SqlServerKeyResource. public virtual SqlServerKeyCollection GetSqlServerKeys() { - return GetCachedClient(Client => new SqlServerKeyCollection(Client, Id)); + return GetCachedClient(client => new SqlServerKeyCollection(client, Id)); } /// @@ -765,8 +768,8 @@ public virtual SqlServerKeyCollection GetSqlServerKeys() /// /// The name of the server key to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerKeyAsync(string keyName, CancellationToken cancellationToken = default) { @@ -788,8 +791,8 @@ public virtual async Task> GetSqlServerKeyAsync(s /// /// The name of the server key to be retrieved. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerKey(string keyName, CancellationToken cancellationToken = default) { @@ -800,7 +803,7 @@ public virtual Response GetSqlServerKey(string keyName, Ca /// An object representing collection of SqlServerSecurityAlertPolicyResources and their operations over a SqlServerSecurityAlertPolicyResource. public virtual SqlServerSecurityAlertPolicyCollection GetSqlServerSecurityAlertPolicies() { - return GetCachedClient(Client => new SqlServerSecurityAlertPolicyCollection(Client, Id)); + return GetCachedClient(client => new SqlServerSecurityAlertPolicyCollection(client, Id)); } /// @@ -849,7 +852,7 @@ public virtual Response GetSqlServerSecuri /// An object representing collection of SqlServerVulnerabilityAssessmentResources and their operations over a SqlServerVulnerabilityAssessmentResource. public virtual SqlServerVulnerabilityAssessmentCollection GetSqlServerVulnerabilityAssessments() { - return GetCachedClient(Client => new SqlServerVulnerabilityAssessmentCollection(Client, Id)); + return GetCachedClient(client => new SqlServerVulnerabilityAssessmentCollection(client, Id)); } /// @@ -898,7 +901,7 @@ public virtual Response GetSqlServerVu /// An object representing collection of SyncAgentResources and their operations over a SyncAgentResource. public virtual SyncAgentCollection GetSyncAgents() { - return GetCachedClient(Client => new SyncAgentCollection(Client, Id)); + return GetCachedClient(client => new SyncAgentCollection(client, Id)); } /// @@ -916,8 +919,8 @@ public virtual SyncAgentCollection GetSyncAgents() /// /// The name of the sync agent. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSyncAgentAsync(string syncAgentName, CancellationToken cancellationToken = default) { @@ -939,8 +942,8 @@ public virtual async Task> GetSyncAgentAsync(string /// /// The name of the sync agent. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSyncAgent(string syncAgentName, CancellationToken cancellationToken = default) { @@ -951,7 +954,7 @@ public virtual Response GetSyncAgent(string syncAgentName, Ca /// An object representing collection of SqlServerVirtualNetworkRuleResources and their operations over a SqlServerVirtualNetworkRuleResource. public virtual SqlServerVirtualNetworkRuleCollection GetSqlServerVirtualNetworkRules() { - return GetCachedClient(Client => new SqlServerVirtualNetworkRuleCollection(Client, Id)); + return GetCachedClient(client => new SqlServerVirtualNetworkRuleCollection(client, Id)); } /// @@ -969,8 +972,8 @@ public virtual SqlServerVirtualNetworkRuleCollection GetSqlServerVirtualNetworkR /// /// The name of the virtual network rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerVirtualNetworkRuleAsync(string virtualNetworkRuleName, CancellationToken cancellationToken = default) { @@ -992,8 +995,8 @@ public virtual async Task> GetSqlS /// /// The name of the virtual network rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerVirtualNetworkRule(string virtualNetworkRuleName, CancellationToken cancellationToken = default) { @@ -1004,7 +1007,7 @@ public virtual Response GetSqlServerVirtual /// An object representing collection of OutboundFirewallRuleResources and their operations over a OutboundFirewallRuleResource. public virtual OutboundFirewallRuleCollection GetOutboundFirewallRules() { - return GetCachedClient(Client => new OutboundFirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new OutboundFirewallRuleCollection(client, Id)); } /// @@ -1022,8 +1025,8 @@ public virtual OutboundFirewallRuleCollection GetOutboundFirewallRules() /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetOutboundFirewallRuleAsync(string outboundRuleFqdn, CancellationToken cancellationToken = default) { @@ -1045,8 +1048,8 @@ public virtual async Task> GetOutboundFir /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetOutboundFirewallRule(string outboundRuleFqdn, CancellationToken cancellationToken = default) { @@ -1057,7 +1060,7 @@ public virtual Response GetOutboundFirewallRule(st /// An object representing collection of SqlServerConnectionPolicyResources and their operations over a SqlServerConnectionPolicyResource. public virtual SqlServerConnectionPolicyCollection GetSqlServerConnectionPolicies() { - return GetCachedClient(Client => new SqlServerConnectionPolicyCollection(Client, Id)); + return GetCachedClient(client => new SqlServerConnectionPolicyCollection(client, Id)); } /// @@ -1106,7 +1109,7 @@ public virtual Response GetSqlServerConnectio /// An object representing collection of SqlServerBlobAuditingPolicyResources and their operations over a SqlServerBlobAuditingPolicyResource. public virtual SqlServerBlobAuditingPolicyCollection GetSqlServerBlobAuditingPolicies() { - return GetCachedClient(Client => new SqlServerBlobAuditingPolicyCollection(Client, Id)); + return GetCachedClient(client => new SqlServerBlobAuditingPolicyCollection(client, Id)); } /// @@ -1155,7 +1158,7 @@ public virtual Response GetSqlServerBlobAud /// An object representing collection of ExtendedServerBlobAuditingPolicyResources and their operations over a ExtendedServerBlobAuditingPolicyResource. public virtual ExtendedServerBlobAuditingPolicyCollection GetExtendedServerBlobAuditingPolicies() { - return GetCachedClient(Client => new ExtendedServerBlobAuditingPolicyCollection(Client, Id)); + return GetCachedClient(client => new ExtendedServerBlobAuditingPolicyCollection(client, Id)); } /// @@ -1204,7 +1207,7 @@ public virtual Response GetExtendedSer /// An object representing collection of ServerAdvancedThreatProtectionResources and their operations over a ServerAdvancedThreatProtectionResource. public virtual ServerAdvancedThreatProtectionCollection GetServerAdvancedThreatProtections() { - return GetCachedClient(Client => new ServerAdvancedThreatProtectionCollection(Client, Id)); + return GetCachedClient(client => new ServerAdvancedThreatProtectionCollection(client, Id)); } /// @@ -1253,7 +1256,7 @@ public virtual Response GetServerAdvance /// An object representing collection of SqlDatabaseResources and their operations over a SqlDatabaseResource. public virtual SqlDatabaseCollection GetSqlDatabases() { - return GetCachedClient(Client => new SqlDatabaseCollection(Client, Id)); + return GetCachedClient(client => new SqlDatabaseCollection(client, Id)); } /// @@ -1273,8 +1276,8 @@ public virtual SqlDatabaseCollection GetSqlDatabases() /// The child resources to include in the response. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlDatabaseAsync(string databaseName, string expand = null, string filter = null, CancellationToken cancellationToken = default) { @@ -1298,8 +1301,8 @@ public virtual async Task> GetSqlDatabaseAsync(str /// The child resources to include in the response. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlDatabase(string databaseName, string expand = null, string filter = null, CancellationToken cancellationToken = default) { @@ -1310,7 +1313,7 @@ public virtual Response GetSqlDatabase(string databaseName, /// An object representing collection of ElasticPoolResources and their operations over a ElasticPoolResource. public virtual ElasticPoolCollection GetElasticPools() { - return GetCachedClient(Client => new ElasticPoolCollection(Client, Id)); + return GetCachedClient(client => new ElasticPoolCollection(client, Id)); } /// @@ -1328,8 +1331,8 @@ public virtual ElasticPoolCollection GetElasticPools() /// /// The name of the elastic pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetElasticPoolAsync(string elasticPoolName, CancellationToken cancellationToken = default) { @@ -1351,8 +1354,8 @@ public virtual async Task> GetElasticPoolAsync(str /// /// The name of the elastic pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetElasticPool(string elasticPoolName, CancellationToken cancellationToken = default) { @@ -1363,7 +1366,7 @@ public virtual Response GetElasticPool(string elasticPoolNa /// An object representing collection of RecoverableDatabaseResources and their operations over a RecoverableDatabaseResource. public virtual RecoverableDatabaseCollection GetRecoverableDatabases() { - return GetCachedClient(Client => new RecoverableDatabaseCollection(Client, Id)); + return GetCachedClient(client => new RecoverableDatabaseCollection(client, Id)); } /// @@ -1383,8 +1386,8 @@ public virtual RecoverableDatabaseCollection GetRecoverableDatabases() /// The child resources to include in the response. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRecoverableDatabaseAsync(string databaseName, string expand = null, string filter = null, CancellationToken cancellationToken = default) { @@ -1408,8 +1411,8 @@ public virtual async Task> GetRecoverableD /// The child resources to include in the response. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRecoverableDatabase(string databaseName, string expand = null, string filter = null, CancellationToken cancellationToken = default) { @@ -1420,7 +1423,7 @@ public virtual Response GetRecoverableDatabase(stri /// An object representing collection of RestorableDroppedDatabaseResources and their operations over a RestorableDroppedDatabaseResource. public virtual RestorableDroppedDatabaseCollection GetRestorableDroppedDatabases() { - return GetCachedClient(Client => new RestorableDroppedDatabaseCollection(Client, Id)); + return GetCachedClient(client => new RestorableDroppedDatabaseCollection(client, Id)); } /// @@ -1440,8 +1443,8 @@ public virtual RestorableDroppedDatabaseCollection GetRestorableDroppedDatabases /// The child resources to include in the response. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetRestorableDroppedDatabaseAsync(string restorableDroppedDatabaseId, string expand = null, string filter = null, CancellationToken cancellationToken = default) { @@ -1465,8 +1468,8 @@ public virtual async Task> GetRestor /// The child resources to include in the response. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetRestorableDroppedDatabase(string restorableDroppedDatabaseId, string expand = null, string filter = null, CancellationToken cancellationToken = default) { @@ -1477,7 +1480,7 @@ public virtual Response GetRestorableDroppedD /// An object representing collection of IPv6FirewallRuleResources and their operations over a IPv6FirewallRuleResource. public virtual IPv6FirewallRuleCollection GetIPv6FirewallRules() { - return GetCachedClient(Client => new IPv6FirewallRuleCollection(Client, Id)); + return GetCachedClient(client => new IPv6FirewallRuleCollection(client, Id)); } /// @@ -1495,8 +1498,8 @@ public virtual IPv6FirewallRuleCollection GetIPv6FirewallRules() /// /// The name of the firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetIPv6FirewallRuleAsync(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -1518,8 +1521,8 @@ public virtual async Task> GetIPv6FirewallRul /// /// The name of the firewall rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetIPv6FirewallRule(string firewallRuleName, CancellationToken cancellationToken = default) { @@ -1530,7 +1533,7 @@ public virtual Response GetIPv6FirewallRule(string fir /// An object representing collection of SqlServerSqlVulnerabilityAssessmentResources and their operations over a SqlServerSqlVulnerabilityAssessmentResource. public virtual SqlServerSqlVulnerabilityAssessmentCollection GetSqlServerSqlVulnerabilityAssessments() { - return GetCachedClient(Client => new SqlServerSqlVulnerabilityAssessmentCollection(Client, Id)); + return GetCachedClient(client => new SqlServerSqlVulnerabilityAssessmentCollection(client, Id)); } /// @@ -1579,7 +1582,7 @@ public virtual Response GetSqlServe /// An object representing collection of FailoverGroupResources and their operations over a FailoverGroupResource. public virtual FailoverGroupCollection GetFailoverGroups() { - return GetCachedClient(Client => new FailoverGroupCollection(Client, Id)); + return GetCachedClient(client => new FailoverGroupCollection(client, Id)); } /// @@ -1597,8 +1600,8 @@ public virtual FailoverGroupCollection GetFailoverGroups() /// /// The name of the failover group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFailoverGroupAsync(string failoverGroupName, CancellationToken cancellationToken = default) { @@ -1620,8 +1623,8 @@ public virtual async Task> GetFailoverGroupAsync /// /// The name of the failover group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFailoverGroup(string failoverGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSecurityAlertPolicyResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSecurityAlertPolicyResource.cs index 11df29d2a3484..e9c7b5f4ad958 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSecurityAlertPolicyResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSecurityAlertPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerSecurityAlertPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The securityAlertPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, SqlSecurityAlertPolicyName securityAlertPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineResource.cs index 819e0e71b2821..391bed2d5bfa0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerSqlVulnerabilityAssessmentBaselineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The vulnerabilityAssessmentName. + /// The baselineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName, SqlVulnerabilityAssessmentBaselineName baselineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}"; @@ -96,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerSqlVulnerabilityAssessmentBaselineRuleResources and their operations over a SqlServerSqlVulnerabilityAssessmentBaselineRuleResource. public virtual SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection GetSqlServerSqlVulnerabilityAssessmentBaselineRules() { - return GetCachedClient(Client => new SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection(Client, Id)); + return GetCachedClient(client => new SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection(client, Id)); } /// @@ -114,8 +119,8 @@ public virtual SqlServerSqlVulnerabilityAssessmentBaselineRuleCollection GetSqlS /// /// The vulnerability assessment rule ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerSqlVulnerabilityAssessmentBaselineRuleAsync(string ruleId, CancellationToken cancellationToken = default) { @@ -137,8 +142,8 @@ public virtual async Task /// The vulnerability assessment rule ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerSqlVulnerabilityAssessmentBaselineRule(string ruleId, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineRuleResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineRuleResource.cs index 7ed6906d44325..9862cec77895f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineRuleResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineRuleResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerSqlVulnerabilityAssessmentBaselineRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The vulnerabilityAssessmentName. + /// The baselineName. + /// The ruleId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName, SqlVulnerabilityAssessmentBaselineName baselineName, string ruleId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}/rules/{ruleId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentResource.cs index 0cf6d6c876419..cadfa9da89912 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerSqlVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The vulnerabilityAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}"; @@ -100,7 +104,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerSqlVulnerabilityAssessmentBaselineResources and their operations over a SqlServerSqlVulnerabilityAssessmentBaselineResource. public virtual SqlServerSqlVulnerabilityAssessmentBaselineCollection GetSqlServerSqlVulnerabilityAssessmentBaselines() { - return GetCachedClient(Client => new SqlServerSqlVulnerabilityAssessmentBaselineCollection(Client, Id)); + return GetCachedClient(client => new SqlServerSqlVulnerabilityAssessmentBaselineCollection(client, Id)); } /// @@ -149,7 +153,7 @@ public virtual Response Get /// An object representing collection of SqlServerSqlVulnerabilityAssessmentScanResources and their operations over a SqlServerSqlVulnerabilityAssessmentScanResource. public virtual SqlServerSqlVulnerabilityAssessmentScanCollection GetSqlServerSqlVulnerabilityAssessmentScans() { - return GetCachedClient(Client => new SqlServerSqlVulnerabilityAssessmentScanCollection(Client, Id)); + return GetCachedClient(client => new SqlServerSqlVulnerabilityAssessmentScanCollection(client, Id)); } /// @@ -167,8 +171,8 @@ public virtual SqlServerSqlVulnerabilityAssessmentScanCollection GetSqlServerSql /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerSqlVulnerabilityAssessmentScanAsync(string scanId, CancellationToken cancellationToken = default) { @@ -190,8 +194,8 @@ public virtual async Task /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerSqlVulnerabilityAssessmentScan(string scanId, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResource.cs index 7888ef6d998d8..2b41cf9b94670 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerSqlVulnerabilityAssessmentScanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The vulnerabilityAssessmentName. + /// The scanId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SqlServerSqlVulnerabilityAssessmentScanResultResources and their operations over a SqlServerSqlVulnerabilityAssessmentScanResultResource. public virtual SqlServerSqlVulnerabilityAssessmentScanResultCollection GetSqlServerSqlVulnerabilityAssessmentScanResults() { - return GetCachedClient(Client => new SqlServerSqlVulnerabilityAssessmentScanResultCollection(Client, Id)); + return GetCachedClient(client => new SqlServerSqlVulnerabilityAssessmentScanResultCollection(client, Id)); } /// @@ -109,8 +114,8 @@ public virtual SqlServerSqlVulnerabilityAssessmentScanResultCollection GetSqlSer /// /// The scan result id of the specific result to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSqlServerSqlVulnerabilityAssessmentScanResultAsync(string scanResultId, CancellationToken cancellationToken = default) { @@ -132,8 +137,8 @@ public virtual async Task /// The scan result id of the specific result to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSqlServerSqlVulnerabilityAssessmentScanResult(string scanResultId, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResultResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResultResource.cs index 36e4fc333816a..7302d27d53c9f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResultResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResultResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerSqlVulnerabilityAssessmentScanResultResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The vulnerabilityAssessmentName. + /// The scanId. + /// The scanResultId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, string scanResultId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults/{scanResultId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerTrustGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerTrustGroupResource.cs index 016c35bb33abb..acfbf44d6dfc1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerTrustGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerTrustGroupResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerTrustGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The locationName. + /// The serverTrustGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation locationName, string serverTrustGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/serverTrustGroups/{serverTrustGroupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVirtualNetworkRuleResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVirtualNetworkRuleResource.cs index f448dc727b1ec..6f7dc11386601 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVirtualNetworkRuleResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVirtualNetworkRuleResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerVirtualNetworkRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The virtualNetworkRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string virtualNetworkRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVulnerabilityAssessmentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVulnerabilityAssessmentResource.cs index 0ffae5f5f0dba..c69dab8744e9f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerVulnerabilityAssessmentResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Sql public partial class SqlServerVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The vulnerabilityAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlTimeZoneResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlTimeZoneResource.cs index 2ef3f89b082b0..3b0531961f8e2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlTimeZoneResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlTimeZoneResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Sql public partial class SqlTimeZoneResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. + /// The timeZoneId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation locationName, string timeZoneId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupResource.cs index ebc262b0ba464..4906d8f369928 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionBackupResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.Sql public partial class SubscriptionLongTermRetentionBackupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. + /// The longTermRetentionServerName. + /// The longTermRetentionDatabaseName. + /// The backupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionManagedInstanceBackupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionManagedInstanceBackupResource.cs index eb1049d63315b..d92492c0eb595 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionManagedInstanceBackupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionLongTermRetentionManagedInstanceBackupResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Sql public partial class SubscriptionLongTermRetentionManagedInstanceBackupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. + /// The managedInstanceName. + /// The databaseName. + /// The backupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation locationName, string managedInstanceName, string databaseName, string backupName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsageResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsageResource.cs index 0f3525e092883..bb6bce6c6378f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsageResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsageResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Sql public partial class SubscriptionUsageResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The locationName. + /// The usageName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation locationName, string usageName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentResource.cs index 16092e7aba4c5..5b0cd0b19e7c1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Sql public partial class SyncAgentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The syncAgentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string syncAgentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupResource.cs index 3612a51205afd..a7a2ebd7a22bd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.Sql public partial class SyncGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The syncGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string syncGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}"; @@ -92,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SyncMemberResources and their operations over a SyncMemberResource. public virtual SyncMemberCollection GetSyncMembers() { - return GetCachedClient(Client => new SyncMemberCollection(Client, Id)); + return GetCachedClient(client => new SyncMemberCollection(client, Id)); } /// @@ -110,8 +115,8 @@ public virtual SyncMemberCollection GetSyncMembers() /// /// The name of the sync member. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSyncMemberAsync(string syncMemberName, CancellationToken cancellationToken = default) { @@ -133,8 +138,8 @@ public virtual async Task> GetSyncMemberAsync(strin /// /// The name of the sync member. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSyncMember(string syncMemberName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMemberResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMemberResource.cs index ed75cd529c23b..756e3f234615a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMemberResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMemberResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.Sql public partial class SyncMemberResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The syncGroupName. + /// The syncMemberName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClusterResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClusterResource.cs index 8ce09cfe84c90..be27bc81c1535 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClusterResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClusterResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Sql public partial class VirtualClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The virtualClusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string virtualClusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifierResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifierResource.cs index 29b55cfcd21cb..fedfff1c6381e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifierResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifierResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Sql public partial class WorkloadClassifierResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The workloadGroupName. + /// The workloadClassifierName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string workloadGroupName, string workloadClassifierName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}"; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupResource.cs index 3a4f261720051..9f5b48cf4e31f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Sql public partial class WorkloadGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The databaseName. + /// The workloadGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string databaseName, string workloadGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of WorkloadClassifierResources and their operations over a WorkloadClassifierResource. public virtual WorkloadClassifierCollection GetWorkloadClassifiers() { - return GetCachedClient(Client => new WorkloadClassifierCollection(Client, Id)); + return GetCachedClient(client => new WorkloadClassifierCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual WorkloadClassifierCollection GetWorkloadClassifiers() /// /// The name of the workload classifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWorkloadClassifierAsync(string workloadClassifierName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetWorkloadClass /// /// The name of the workload classifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWorkloadClassifier(string workloadClassifierName, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/api/Azure.ResourceManager.SqlVirtualMachine.netstandard2.0.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/api/Azure.ResourceManager.SqlVirtualMachine.netstandard2.0.cs index 21e35d3446e7e..ad275490040cc 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/api/Azure.ResourceManager.SqlVirtualMachine.netstandard2.0.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/api/Azure.ResourceManager.SqlVirtualMachine.netstandard2.0.cs @@ -77,7 +77,7 @@ protected SqlVmCollection() { } } public partial class SqlVmData : Azure.ResourceManager.Models.TrackedResourceData { - public SqlVmData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SqlVmData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.SqlVirtualMachine.Models.SqlVmAssessmentSettings AssessmentSettings { get { throw null; } set { } } public Azure.ResourceManager.SqlVirtualMachine.Models.SqlVmAutoBackupSettings AutoBackupSettings { get { throw null; } set { } } public Azure.ResourceManager.SqlVirtualMachine.Models.SqlVmAutoPatchingSettings AutoPatchingSettings { get { throw null; } set { } } @@ -114,7 +114,7 @@ protected SqlVmGroupCollection() { } } public partial class SqlVmGroupData : Azure.ResourceManager.Models.TrackedResourceData { - public SqlVmGroupData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SqlVmGroupData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.SqlVirtualMachine.Models.SqlVmClusterConfiguration? ClusterConfiguration { get { throw null; } } public Azure.ResourceManager.SqlVirtualMachine.Models.SqlVmClusterManagerType? ClusterManagerType { get { throw null; } } public string ProvisioningState { get { throw null; } } @@ -173,6 +173,34 @@ protected SqlVmResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SqlVirtualMachine.Models.SqlVmPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.SqlVirtualMachine.Mocking +{ + public partial class MockableSqlVirtualMachineArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSqlVirtualMachineArmClient() { } + public virtual Azure.ResourceManager.SqlVirtualMachine.AvailabilityGroupListenerResource GetAvailabilityGroupListenerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SqlVirtualMachine.SqlVmGroupResource GetSqlVmGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SqlVirtualMachine.SqlVmResource GetSqlVmResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSqlVirtualMachineResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSqlVirtualMachineResourceGroupResource() { } + public virtual Azure.Response GetSqlVm(string sqlVmName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSqlVmAsync(string sqlVmName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSqlVmGroup(string sqlVmGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSqlVmGroupAsync(string sqlVmGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SqlVirtualMachine.SqlVmGroupCollection GetSqlVmGroups() { throw null; } + public virtual Azure.ResourceManager.SqlVirtualMachine.SqlVmCollection GetSqlVms() { throw null; } + } + public partial class MockableSqlVirtualMachineSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSqlVirtualMachineSubscriptionResource() { } + public virtual Azure.Pageable GetSqlVmGroups(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSqlVmGroupsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSqlVms(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSqlVmsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.SqlVirtualMachine.Models { public static partial class ArmSqlVirtualMachineModelFactory diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/AvailabilityGroupListenerResource.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/AvailabilityGroupListenerResource.cs index 9e63f7f1940ba..c67c06662e820 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/AvailabilityGroupListenerResource.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/AvailabilityGroupListenerResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.SqlVirtualMachine public partial class AvailabilityGroupListenerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sqlVmGroupName. + /// The availabilityGroupListenerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sqlVmGroupName, string availabilityGroupListenerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVmGroupName}/availabilityGroupListeners/{availabilityGroupListenerName}"; diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineArmClient.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineArmClient.cs new file mode 100644 index 0000000000000..a3bb9fc190a5e --- /dev/null +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.SqlVirtualMachine; + +namespace Azure.ResourceManager.SqlVirtualMachine.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSqlVirtualMachineArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSqlVirtualMachineArmClient() + { + } + + /// 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 MockableSqlVirtualMachineArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSqlVirtualMachineArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AvailabilityGroupListenerResource GetAvailabilityGroupListenerResource(ResourceIdentifier id) + { + AvailabilityGroupListenerResource.ValidateResourceId(id); + return new AvailabilityGroupListenerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlVmGroupResource GetSqlVmGroupResource(ResourceIdentifier id) + { + SqlVmGroupResource.ValidateResourceId(id); + return new SqlVmGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SqlVmResource GetSqlVmResource(ResourceIdentifier id) + { + SqlVmResource.ValidateResourceId(id); + return new SqlVmResource(Client, id); + } + } +} diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineResourceGroupResource.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineResourceGroupResource.cs new file mode 100644 index 0000000000000..0b866fd7f3862 --- /dev/null +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineResourceGroupResource.cs @@ -0,0 +1,147 @@ +// 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.SqlVirtualMachine; + +namespace Azure.ResourceManager.SqlVirtualMachine.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSqlVirtualMachineResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSqlVirtualMachineResourceGroupResource() + { + } + + /// 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 MockableSqlVirtualMachineResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SqlVmGroupResources in the ResourceGroupResource. + /// An object representing collection of SqlVmGroupResources and their operations over a SqlVmGroupResource. + public virtual SqlVmGroupCollection GetSqlVmGroups() + { + return GetCachedClient(client => new SqlVmGroupCollection(client, Id)); + } + + /// + /// Gets a SQL virtual machine group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName} + /// + /// + /// Operation Id + /// SqlVirtualMachineGroups_Get + /// + /// + /// + /// Name of the SQL virtual machine group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlVmGroupAsync(string sqlVmGroupName, CancellationToken cancellationToken = default) + { + return await GetSqlVmGroups().GetAsync(sqlVmGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a SQL virtual machine group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName} + /// + /// + /// Operation Id + /// SqlVirtualMachineGroups_Get + /// + /// + /// + /// Name of the SQL virtual machine group. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlVmGroup(string sqlVmGroupName, CancellationToken cancellationToken = default) + { + return GetSqlVmGroups().Get(sqlVmGroupName, cancellationToken); + } + + /// Gets a collection of SqlVmResources in the ResourceGroupResource. + /// An object representing collection of SqlVmResources and their operations over a SqlVmResource. + public virtual SqlVmCollection GetSqlVms() + { + return GetCachedClient(client => new SqlVmCollection(client, Id)); + } + + /// + /// Gets a SQL virtual machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName} + /// + /// + /// Operation Id + /// SqlVirtualMachines_Get + /// + /// + /// + /// Name of the SQL virtual machine. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSqlVmAsync(string sqlVmName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetSqlVms().GetAsync(sqlVmName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a SQL virtual machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName} + /// + /// + /// Operation Id + /// SqlVirtualMachines_Get + /// + /// + /// + /// Name of the SQL virtual machine. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSqlVm(string sqlVmName, string expand = null, CancellationToken cancellationToken = default) + { + return GetSqlVms().Get(sqlVmName, expand, cancellationToken); + } + } +} diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineSubscriptionResource.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineSubscriptionResource.cs new file mode 100644 index 0000000000000..80a2c3d90f4d8 --- /dev/null +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineSubscriptionResource.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.SqlVirtualMachine; + +namespace Azure.ResourceManager.SqlVirtualMachine.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSqlVirtualMachineSubscriptionResource : ArmResource + { + private ClientDiagnostics _sqlVmGroupSqlVmGroupsClientDiagnostics; + private SqlVirtualMachineGroupsRestOperations _sqlVmGroupSqlVmGroupsRestClient; + private ClientDiagnostics _sqlVmSqlVirtualMachinesClientDiagnostics; + private SqlVirtualMachinesRestOperations _sqlVmSqlVirtualMachinesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSqlVirtualMachineSubscriptionResource() + { + } + + /// 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 MockableSqlVirtualMachineSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SqlVmGroupSqlVirtualMachineGroupsClientDiagnostics => _sqlVmGroupSqlVmGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SqlVirtualMachine", SqlVmGroupResource.ResourceType.Namespace, Diagnostics); + private SqlVirtualMachineGroupsRestOperations SqlVmGroupSqlVirtualMachineGroupsRestClient => _sqlVmGroupSqlVmGroupsRestClient ??= new SqlVirtualMachineGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlVmGroupResource.ResourceType)); + private ClientDiagnostics SqlVmSqlVirtualMachinesClientDiagnostics => _sqlVmSqlVirtualMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SqlVirtualMachine", SqlVmResource.ResourceType.Namespace, Diagnostics); + private SqlVirtualMachinesRestOperations SqlVmSqlVirtualMachinesRestClient => _sqlVmSqlVirtualMachinesRestClient ??= new SqlVirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlVmResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all SQL virtual machine groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups + /// + /// + /// Operation Id + /// SqlVirtualMachineGroups_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSqlVmGroupsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SqlVmGroupSqlVirtualMachineGroupsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlVmGroupSqlVirtualMachineGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlVmGroupResource(Client, SqlVmGroupData.DeserializeSqlVmGroupData(e)), SqlVmGroupSqlVirtualMachineGroupsClientDiagnostics, Pipeline, "MockableSqlVirtualMachineSubscriptionResource.GetSqlVmGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all SQL virtual machine groups in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups + /// + /// + /// Operation Id + /// SqlVirtualMachineGroups_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSqlVmGroups(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SqlVmGroupSqlVirtualMachineGroupsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlVmGroupSqlVirtualMachineGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlVmGroupResource(Client, SqlVmGroupData.DeserializeSqlVmGroupData(e)), SqlVmGroupSqlVirtualMachineGroupsClientDiagnostics, Pipeline, "MockableSqlVirtualMachineSubscriptionResource.GetSqlVmGroups", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all SQL virtual machines in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines + /// + /// + /// Operation Id + /// SqlVirtualMachines_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSqlVmsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SqlVmSqlVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlVmSqlVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlVmResource(Client, SqlVmData.DeserializeSqlVmData(e)), SqlVmSqlVirtualMachinesClientDiagnostics, Pipeline, "MockableSqlVirtualMachineSubscriptionResource.GetSqlVms", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all SQL virtual machines in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines + /// + /// + /// Operation Id + /// SqlVirtualMachines_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSqlVms(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SqlVmSqlVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlVmSqlVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlVmResource(Client, SqlVmData.DeserializeSqlVmData(e)), SqlVmSqlVirtualMachinesClientDiagnostics, Pipeline, "MockableSqlVirtualMachineSubscriptionResource.GetSqlVms", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index d69906e0a11eb..0000000000000 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.SqlVirtualMachine -{ - /// 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 SqlVmGroupResources in the ResourceGroupResource. - /// An object representing collection of SqlVmGroupResources and their operations over a SqlVmGroupResource. - public virtual SqlVmGroupCollection GetSqlVmGroups() - { - return GetCachedClient(Client => new SqlVmGroupCollection(Client, Id)); - } - - /// Gets a collection of SqlVmResources in the ResourceGroupResource. - /// An object representing collection of SqlVmResources and their operations over a SqlVmResource. - public virtual SqlVmCollection GetSqlVms() - { - return GetCachedClient(Client => new SqlVmCollection(Client, Id)); - } - } -} diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/SqlVirtualMachineExtensions.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/SqlVirtualMachineExtensions.cs index 61beb79b45308..9f8e0896232c5 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/SqlVirtualMachineExtensions.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/SqlVirtualMachineExtensions.cs @@ -12,106 +12,88 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.SqlVirtualMachine.Mocking; namespace Azure.ResourceManager.SqlVirtualMachine { /// A class to add extension methods to Azure.ResourceManager.SqlVirtualMachine. public static partial class SqlVirtualMachineExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSqlVirtualMachineArmClient GetMockableSqlVirtualMachineArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSqlVirtualMachineArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSqlVirtualMachineResourceGroupResource GetMockableSqlVirtualMachineResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSqlVirtualMachineResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSqlVirtualMachineSubscriptionResource GetMockableSqlVirtualMachineSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSqlVirtualMachineSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AvailabilityGroupListenerResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AvailabilityGroupListenerResource GetAvailabilityGroupListenerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AvailabilityGroupListenerResource.ValidateResourceId(id); - return new AvailabilityGroupListenerResource(client, id); - } - ); + return GetMockableSqlVirtualMachineArmClient(client).GetAvailabilityGroupListenerResource(id); } - #endregion - #region SqlVmGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlVmGroupResource GetSqlVmGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlVmGroupResource.ValidateResourceId(id); - return new SqlVmGroupResource(client, id); - } - ); + return GetMockableSqlVirtualMachineArmClient(client).GetSqlVmGroupResource(id); } - #endregion - #region SqlVmResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SqlVmResource GetSqlVmResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SqlVmResource.ValidateResourceId(id); - return new SqlVmResource(client, id); - } - ); + return GetMockableSqlVirtualMachineArmClient(client).GetSqlVmResource(id); } - #endregion - /// Gets a collection of SqlVmGroupResources in the ResourceGroupResource. + /// + /// Gets a collection of SqlVmGroupResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SqlVmGroupResources and their operations over a SqlVmGroupResource. public static SqlVmGroupCollection GetSqlVmGroups(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSqlVmGroups(); + return GetMockableSqlVirtualMachineResourceGroupResource(resourceGroupResource).GetSqlVmGroups(); } /// @@ -126,16 +108,20 @@ public static SqlVmGroupCollection GetSqlVmGroups(this ResourceGroupResource res /// SqlVirtualMachineGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the SQL virtual machine group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSqlVmGroupAsync(this ResourceGroupResource resourceGroupResource, string sqlVmGroupName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSqlVmGroups().GetAsync(sqlVmGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlVirtualMachineResourceGroupResource(resourceGroupResource).GetSqlVmGroupAsync(sqlVmGroupName, cancellationToken).ConfigureAwait(false); } /// @@ -150,24 +136,34 @@ public static async Task> GetSqlVmGroupAsync(this R /// SqlVirtualMachineGroups_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the SQL virtual machine group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSqlVmGroup(this ResourceGroupResource resourceGroupResource, string sqlVmGroupName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSqlVmGroups().Get(sqlVmGroupName, cancellationToken); + return GetMockableSqlVirtualMachineResourceGroupResource(resourceGroupResource).GetSqlVmGroup(sqlVmGroupName, cancellationToken); } - /// Gets a collection of SqlVmResources in the ResourceGroupResource. + /// + /// Gets a collection of SqlVmResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SqlVmResources and their operations over a SqlVmResource. public static SqlVmCollection GetSqlVms(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSqlVms(); + return GetMockableSqlVirtualMachineResourceGroupResource(resourceGroupResource).GetSqlVms(); } /// @@ -182,17 +178,21 @@ public static SqlVmCollection GetSqlVms(this ResourceGroupResource resourceGroup /// SqlVirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the SQL virtual machine. /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSqlVmAsync(this ResourceGroupResource resourceGroupResource, string sqlVmName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSqlVms().GetAsync(sqlVmName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlVirtualMachineResourceGroupResource(resourceGroupResource).GetSqlVmAsync(sqlVmName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -207,17 +207,21 @@ public static async Task> GetSqlVmAsync(this ResourceGro /// SqlVirtualMachines_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the SQL virtual machine. /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSqlVm(this ResourceGroupResource resourceGroupResource, string sqlVmName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSqlVms().Get(sqlVmName, expand, cancellationToken); + return GetMockableSqlVirtualMachineResourceGroupResource(resourceGroupResource).GetSqlVm(sqlVmName, expand, cancellationToken); } /// @@ -232,13 +236,17 @@ public static Response GetSqlVm(this ResourceGroupResource resour /// SqlVirtualMachineGroups_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSqlVmGroupsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlVmGroupsAsync(cancellationToken); + return GetMockableSqlVirtualMachineSubscriptionResource(subscriptionResource).GetSqlVmGroupsAsync(cancellationToken); } /// @@ -253,13 +261,17 @@ public static AsyncPageable GetSqlVmGroupsAsync(this Subscri /// SqlVirtualMachineGroups_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSqlVmGroups(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlVmGroups(cancellationToken); + return GetMockableSqlVirtualMachineSubscriptionResource(subscriptionResource).GetSqlVmGroups(cancellationToken); } /// @@ -274,13 +286,17 @@ public static Pageable GetSqlVmGroups(this SubscriptionResou /// SqlVirtualMachines_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSqlVmsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlVmsAsync(cancellationToken); + return GetMockableSqlVirtualMachineSubscriptionResource(subscriptionResource).GetSqlVmsAsync(cancellationToken); } /// @@ -295,13 +311,17 @@ public static AsyncPageable GetSqlVmsAsync(this SubscriptionResou /// SqlVirtualMachines_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSqlVms(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSqlVms(cancellationToken); + return GetMockableSqlVirtualMachineSubscriptionResource(subscriptionResource).GetSqlVms(cancellationToken); } } } diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 67f20c2e2358a..0000000000000 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.SqlVirtualMachine -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _sqlVmGroupSqlVmGroupsClientDiagnostics; - private SqlVirtualMachineGroupsRestOperations _sqlVmGroupSqlVmGroupsRestClient; - private ClientDiagnostics _sqlVmSqlVirtualMachinesClientDiagnostics; - private SqlVirtualMachinesRestOperations _sqlVmSqlVirtualMachinesRestClient; - - /// 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 SqlVmGroupSqlVirtualMachineGroupsClientDiagnostics => _sqlVmGroupSqlVmGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SqlVirtualMachine", SqlVmGroupResource.ResourceType.Namespace, Diagnostics); - private SqlVirtualMachineGroupsRestOperations SqlVmGroupSqlVirtualMachineGroupsRestClient => _sqlVmGroupSqlVmGroupsRestClient ??= new SqlVirtualMachineGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlVmGroupResource.ResourceType)); - private ClientDiagnostics SqlVmSqlVirtualMachinesClientDiagnostics => _sqlVmSqlVirtualMachinesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SqlVirtualMachine", SqlVmResource.ResourceType.Namespace, Diagnostics); - private SqlVirtualMachinesRestOperations SqlVmSqlVirtualMachinesRestClient => _sqlVmSqlVirtualMachinesRestClient ??= new SqlVirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlVmResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets all SQL virtual machine groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups - /// - /// - /// Operation Id - /// SqlVirtualMachineGroups_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSqlVmGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SqlVmGroupSqlVirtualMachineGroupsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlVmGroupSqlVirtualMachineGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlVmGroupResource(Client, SqlVmGroupData.DeserializeSqlVmGroupData(e)), SqlVmGroupSqlVirtualMachineGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSqlVmGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all SQL virtual machine groups in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups - /// - /// - /// Operation Id - /// SqlVirtualMachineGroups_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSqlVmGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SqlVmGroupSqlVirtualMachineGroupsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlVmGroupSqlVirtualMachineGroupsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlVmGroupResource(Client, SqlVmGroupData.DeserializeSqlVmGroupData(e)), SqlVmGroupSqlVirtualMachineGroupsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSqlVmGroups", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all SQL virtual machines in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines - /// - /// - /// Operation Id - /// SqlVirtualMachines_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSqlVmsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SqlVmSqlVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlVmSqlVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SqlVmResource(Client, SqlVmData.DeserializeSqlVmData(e)), SqlVmSqlVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSqlVms", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all SQL virtual machines in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines - /// - /// - /// Operation Id - /// SqlVirtualMachines_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSqlVms(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SqlVmSqlVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlVmSqlVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlVmResource(Client, SqlVmData.DeserializeSqlVmData(e)), SqlVmSqlVirtualMachinesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSqlVms", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupResource.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupResource.cs index de52f02ba5892..83d0e4a7fbfa8 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupResource.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.SqlVirtualMachine public partial class SqlVmGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sqlVmGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sqlVmGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVmGroupName}"; @@ -99,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AvailabilityGroupListenerResources and their operations over a AvailabilityGroupListenerResource. public virtual AvailabilityGroupListenerCollection GetAvailabilityGroupListeners() { - return GetCachedClient(Client => new AvailabilityGroupListenerCollection(Client, Id)); + return GetCachedClient(client => new AvailabilityGroupListenerCollection(client, Id)); } /// @@ -118,8 +121,8 @@ public virtual AvailabilityGroupListenerCollection GetAvailabilityGroupListeners /// Name of the availability group listener. /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAvailabilityGroupListenerAsync(string availabilityGroupListenerName, string expand = null, CancellationToken cancellationToken = default) { @@ -142,8 +145,8 @@ public virtual async Task> GetAvaila /// Name of the availability group listener. /// The child resources to include in the response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAvailabilityGroupListener(string availabilityGroupListenerName, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmResource.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmResource.cs index 88e2a69381e78..b13f0418623e9 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmResource.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.SqlVirtualMachine public partial class SqlVmResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sqlVmName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sqlVmName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVmName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/CHANGELOG.md b/sdk/storage/Azure.ResourceManager.Storage/CHANGELOG.md index 77e22c02055be..b5f3a58bf43bf 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/CHANGELOG.md +++ b/sdk/storage/Azure.ResourceManager.Storage/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.2.0-beta.2 (Unreleased) +## 1.2.0-beta.3 (Unreleased) ### Features Added @@ -10,6 +10,12 @@ ### Other Changes +## 1.2.0-beta.2 (2023-08-14) + +### Features Added + +- Make `StorageArmClientMockingExtension`, `StorageResourceGroupMockingExtension`, `StorageSubscriptionMockingExtension` public for mocking the extension methods. + ## 1.2.0-beta.1 (2023-05-31) ### Features Added diff --git a/sdk/storage/Azure.ResourceManager.Storage/api/Azure.ResourceManager.Storage.netstandard2.0.cs b/sdk/storage/Azure.ResourceManager.Storage/api/Azure.ResourceManager.Storage.netstandard2.0.cs index 1e5fe2402bb2e..c2d74fdbfa849 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/api/Azure.ResourceManager.Storage.netstandard2.0.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/api/Azure.ResourceManager.Storage.netstandard2.0.cs @@ -370,7 +370,7 @@ protected StorageAccountCollection() { } } public partial class StorageAccountData : Azure.ResourceManager.Models.TrackedResourceData { - public StorageAccountData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StorageAccountData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Storage.Models.StorageAccountAccessTier? AccessTier { get { throw null; } } public bool? AllowBlobPublicAccess { get { throw null; } set { } } public bool? AllowCrossTenantReplication { get { throw null; } set { } } @@ -727,6 +727,54 @@ protected TableServiceResource() { } public virtual Azure.ResourceManager.Storage.TableCollection GetTables() { throw null; } } } +namespace Azure.ResourceManager.Storage.Mocking +{ + public partial class MockableStorageArmClient : Azure.ResourceManager.ArmResource + { + protected MockableStorageArmClient() { } + public virtual Azure.ResourceManager.Storage.BlobContainerResource GetBlobContainerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.BlobInventoryPolicyResource GetBlobInventoryPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.BlobServiceResource GetBlobServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.DeletedAccountResource GetDeletedAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.EncryptionScopeResource GetEncryptionScopeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.FileServiceResource GetFileServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.FileShareResource GetFileShareResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.ImmutabilityPolicyResource GetImmutabilityPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.ObjectReplicationPolicyResource GetObjectReplicationPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.QueueServiceResource GetQueueServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.StorageAccountLocalUserResource GetStorageAccountLocalUserResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.StorageAccountManagementPolicyResource GetStorageAccountManagementPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.StorageAccountResource GetStorageAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.StoragePrivateEndpointConnectionResource GetStoragePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.StorageQueueResource GetStorageQueueResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.TableResource GetTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Storage.TableServiceResource GetTableServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableStorageResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableStorageResourceGroupResource() { } + public virtual Azure.Response GetStorageAccount(string accountName, Azure.ResourceManager.Storage.Models.StorageAccountExpand? expand = default(Azure.ResourceManager.Storage.Models.StorageAccountExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetStorageAccountAsync(string accountName, Azure.ResourceManager.Storage.Models.StorageAccountExpand? expand = default(Azure.ResourceManager.Storage.Models.StorageAccountExpand?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Storage.StorageAccountCollection GetStorageAccounts() { throw null; } + } + public partial class MockableStorageSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableStorageSubscriptionResource() { } + public virtual Azure.Response CheckStorageAccountNameAvailability(Azure.ResourceManager.Storage.Models.StorageAccountNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckStorageAccountNameAvailabilityAsync(Azure.ResourceManager.Storage.Models.StorageAccountNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeletedAccount(Azure.Core.AzureLocation location, string deletedAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeletedAccountAsync(Azure.Core.AzureLocation location, string deletedAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Storage.DeletedAccountCollection GetDeletedAccounts() { throw null; } + public virtual Azure.Pageable GetDeletedAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStorageAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsagesByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Storage.Models { public partial class AccountImmutabilityPolicy diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Azure.ResourceManager.Storage.csproj b/sdk/storage/Azure.ResourceManager.Storage/src/Azure.ResourceManager.Storage.csproj index 107c40bdba5fe..4fa050e420de5 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Azure.ResourceManager.Storage.csproj +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Azure.ResourceManager.Storage.csproj @@ -1,6 +1,6 @@ - 1.2.0-beta.2 + 1.2.0-beta.3 1.1.1 Azure.ResourceManager.Storage diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobContainerResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobContainerResource.cs index 5f6a40df0d8fa..26fc720062d29 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobContainerResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobContainerResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Storage public partial class BlobContainerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The containerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string containerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobInventoryPolicyResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobInventoryPolicyResource.cs index 0c4ca2e4e434f..0e5cb26d55fe2 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobInventoryPolicyResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobInventoryPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Storage public partial class BlobInventoryPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The blobInventoryPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, BlobInventoryPolicyName blobInventoryPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobServiceResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobServiceResource.cs index 467a18b31000f..85119b48ec3c4 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobServiceResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobServiceResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Storage public partial class BlobServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default"; @@ -90,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of BlobContainerResources and their operations over a BlobContainerResource. public virtual BlobContainerCollection GetBlobContainers() { - return GetCachedClient(Client => new BlobContainerCollection(Client, Id)); + return GetCachedClient(client => new BlobContainerCollection(client, Id)); } /// @@ -108,8 +111,8 @@ public virtual BlobContainerCollection GetBlobContainers() /// /// The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetBlobContainerAsync(string containerName, CancellationToken cancellationToken = default) { @@ -131,8 +134,8 @@ public virtual async Task> GetBlobContainerAsync /// /// The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetBlobContainer(string containerName, CancellationToken cancellationToken = default) { diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/DeletedAccountResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/DeletedAccountResource.cs index 00aa4a684adc1..cc1ca83a7fa1c 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/DeletedAccountResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/DeletedAccountResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Storage public partial class DeletedAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The deletedAccountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string deletedAccountName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/EncryptionScopeResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/EncryptionScopeResource.cs index f0f4252570ba3..d639c1ef2de72 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/EncryptionScopeResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/EncryptionScopeResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Storage public partial class EncryptionScopeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The encryptionScopeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageArmClient.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageArmClient.cs new file mode 100644 index 0000000000000..09e1ec3b2729c --- /dev/null +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageArmClient.cs @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Storage; + +namespace Azure.ResourceManager.Storage.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableStorageArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageArmClient() + { + } + + /// 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 MockableStorageArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableStorageArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageAccountResource GetStorageAccountResource(ResourceIdentifier id) + { + StorageAccountResource.ValidateResourceId(id); + return new StorageAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeletedAccountResource GetDeletedAccountResource(ResourceIdentifier id) + { + DeletedAccountResource.ValidateResourceId(id); + return new DeletedAccountResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageAccountManagementPolicyResource GetStorageAccountManagementPolicyResource(ResourceIdentifier id) + { + StorageAccountManagementPolicyResource.ValidateResourceId(id); + return new StorageAccountManagementPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BlobInventoryPolicyResource GetBlobInventoryPolicyResource(ResourceIdentifier id) + { + BlobInventoryPolicyResource.ValidateResourceId(id); + return new BlobInventoryPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StoragePrivateEndpointConnectionResource GetStoragePrivateEndpointConnectionResource(ResourceIdentifier id) + { + StoragePrivateEndpointConnectionResource.ValidateResourceId(id); + return new StoragePrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ObjectReplicationPolicyResource GetObjectReplicationPolicyResource(ResourceIdentifier id) + { + ObjectReplicationPolicyResource.ValidateResourceId(id); + return new ObjectReplicationPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageAccountLocalUserResource GetStorageAccountLocalUserResource(ResourceIdentifier id) + { + StorageAccountLocalUserResource.ValidateResourceId(id); + return new StorageAccountLocalUserResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual EncryptionScopeResource GetEncryptionScopeResource(ResourceIdentifier id) + { + EncryptionScopeResource.ValidateResourceId(id); + return new EncryptionScopeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BlobServiceResource GetBlobServiceResource(ResourceIdentifier id) + { + BlobServiceResource.ValidateResourceId(id); + return new BlobServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BlobContainerResource GetBlobContainerResource(ResourceIdentifier id) + { + BlobContainerResource.ValidateResourceId(id); + return new BlobContainerResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual ImmutabilityPolicyResource GetImmutabilityPolicyResource(ResourceIdentifier id) + { + ImmutabilityPolicyResource.ValidateResourceId(id); + return new ImmutabilityPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FileServiceResource GetFileServiceResource(ResourceIdentifier id) + { + FileServiceResource.ValidateResourceId(id); + return new FileServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual FileShareResource GetFileShareResource(ResourceIdentifier id) + { + FileShareResource.ValidateResourceId(id); + return new FileShareResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual QueueServiceResource GetQueueServiceResource(ResourceIdentifier id) + { + QueueServiceResource.ValidateResourceId(id); + return new QueueServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageQueueResource GetStorageQueueResource(ResourceIdentifier id) + { + StorageQueueResource.ValidateResourceId(id); + return new StorageQueueResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TableServiceResource GetTableServiceResource(ResourceIdentifier id) + { + TableServiceResource.ValidateResourceId(id); + return new TableServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TableResource GetTableResource(ResourceIdentifier id) + { + TableResource.ValidateResourceId(id); + return new TableResource(Client, id); + } + } +} diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageResourceGroupResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageResourceGroupResource.cs new file mode 100644 index 0000000000000..b68017e2f5ced --- /dev/null +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageResourceGroupResource.cs @@ -0,0 +1,95 @@ +// 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.Storage; +using Azure.ResourceManager.Storage.Models; + +namespace Azure.ResourceManager.Storage.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableStorageResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageResourceGroupResource() + { + } + + /// 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 MockableStorageResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of StorageAccountResources in the ResourceGroupResource. + /// An object representing collection of StorageAccountResources and their operations over a StorageAccountResource. + public virtual StorageAccountCollection GetStorageAccounts() + { + return GetCachedClient(client => new StorageAccountCollection(client, Id)); + } + + /// + /// Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName} + /// + /// + /// Operation Id + /// StorageAccounts_GetProperties + /// + /// + /// + /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + /// May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStorageAccountAsync(string accountName, StorageAccountExpand? expand = null, CancellationToken cancellationToken = default) + { + return await GetStorageAccounts().GetAsync(accountName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName} + /// + /// + /// Operation Id + /// StorageAccounts_GetProperties + /// + /// + /// + /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + /// May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStorageAccount(string accountName, StorageAccountExpand? expand = null, CancellationToken cancellationToken = default) + { + return GetStorageAccounts().Get(accountName, expand, cancellationToken); + } + } +} diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageSubscriptionResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageSubscriptionResource.cs new file mode 100644 index 0000000000000..ab1986d9d63c9 --- /dev/null +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageSubscriptionResource.cs @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Storage; +using Azure.ResourceManager.Storage.Models; + +namespace Azure.ResourceManager.Storage.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableStorageSubscriptionResource : ArmResource + { + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; + private ClientDiagnostics _storageAccountClientDiagnostics; + private StorageAccountsRestOperations _storageAccountRestClient; + private ClientDiagnostics _deletedAccountClientDiagnostics; + private DeletedAccountsRestOperations _deletedAccountRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableStorageSubscriptionResource() + { + } + + /// 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 MockableStorageSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storage", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics StorageAccountClientDiagnostics => _storageAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storage", StorageAccountResource.ResourceType.Namespace, Diagnostics); + private StorageAccountsRestOperations StorageAccountRestClient => _storageAccountRestClient ??= new StorageAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageAccountResource.ResourceType)); + private ClientDiagnostics DeletedAccountClientDiagnostics => _deletedAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storage", DeletedAccountResource.ResourceType.Namespace, Diagnostics); + private DeletedAccountsRestOperations DeletedAccountRestClient => _deletedAccountRestClient ??= new DeletedAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedAccountResource.ResourceType)); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storage", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DeletedAccountResources in the SubscriptionResource. + /// An object representing collection of DeletedAccountResources and their operations over a DeletedAccountResource. + public virtual DeletedAccountCollection GetDeletedAccounts() + { + return GetCachedClient(client => new DeletedAccountCollection(client, Id)); + } + + /// + /// Get properties of specified deleted account resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName} + /// + /// + /// Operation Id + /// DeletedAccounts_Get + /// + /// + /// + /// The location of the deleted storage account. + /// Name of the deleted storage account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeletedAccountAsync(AzureLocation location, string deletedAccountName, CancellationToken cancellationToken = default) + { + return await GetDeletedAccounts().GetAsync(location, deletedAccountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get properties of specified deleted account resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName} + /// + /// + /// Operation Id + /// DeletedAccounts_Get + /// + /// + /// + /// The location of the deleted storage account. + /// Name of the deleted storage account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeletedAccount(AzureLocation location, string deletedAccountName, CancellationToken cancellationToken = default) + { + return GetDeletedAccounts().Get(location, deletedAccountName, cancellationToken); + } + + /// + /// Lists the available SKUs supported by Microsoft.Storage for given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, StorageSkuInformation.DeserializeStorageSkuInformation, SkusClientDiagnostics, Pipeline, "MockableStorageSubscriptionResource.GetSkus", "value", null, cancellationToken); + } + + /// + /// Lists the available SKUs supported by Microsoft.Storage for given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, StorageSkuInformation.DeserializeStorageSkuInformation, SkusClientDiagnostics, Pipeline, "MockableStorageSubscriptionResource.GetSkus", "value", null, cancellationToken); + } + + /// + /// Checks that the storage account name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability + /// + /// + /// Operation Id + /// StorageAccounts_CheckNameAvailability + /// + /// + /// + /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckStorageAccountNameAvailabilityAsync(StorageAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = StorageAccountClientDiagnostics.CreateScope("MockableStorageSubscriptionResource.CheckStorageAccountNameAvailability"); + scope.Start(); + try + { + var response = await StorageAccountRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the storage account name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability + /// + /// + /// Operation Id + /// StorageAccounts_CheckNameAvailability + /// + /// + /// + /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + /// The cancellation token to use. + /// is null. + public virtual Response CheckStorageAccountNameAvailability(StorageAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = StorageAccountClientDiagnostics.CreateScope("MockableStorageSubscriptionResource.CheckStorageAccountNameAvailability"); + scope.Start(); + try + { + var response = StorageAccountRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts + /// + /// + /// Operation Id + /// StorageAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageAccountRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageAccountResource(Client, StorageAccountData.DeserializeStorageAccountData(e)), StorageAccountClientDiagnostics, Pipeline, "MockableStorageSubscriptionResource.GetStorageAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts + /// + /// + /// Operation Id + /// StorageAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageAccountRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageAccountResource(Client, StorageAccountData.DeserializeStorageAccountData(e)), StorageAccountClientDiagnostics, Pipeline, "MockableStorageSubscriptionResource.GetStorageAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists deleted accounts under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts + /// + /// + /// Operation Id + /// DeletedAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedAccountsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedAccountRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedAccountResource(Client, DeletedAccountData.DeserializeDeletedAccountData(e)), DeletedAccountClientDiagnostics, Pipeline, "MockableStorageSubscriptionResource.GetDeletedAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Lists deleted accounts under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts + /// + /// + /// Operation Id + /// DeletedAccounts_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedAccounts(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedAccountRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedAccountResource(Client, DeletedAccountData.DeserializeDeletedAccountData(e)), DeletedAccountClientDiagnostics, Pipeline, "MockableStorageSubscriptionResource.GetDeletedAccounts", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the current usage count and the limit for the resources of the location under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListByLocation + /// + /// + /// + /// The location of the Azure Storage resource. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, StorageUsage.DeserializeStorageUsage, UsagesClientDiagnostics, Pipeline, "MockableStorageSubscriptionResource.GetUsagesByLocation", "value", null, cancellationToken); + } + + /// + /// Gets the current usage count and the limit for the resources of the location under the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_ListByLocation + /// + /// + /// + /// The location of the Azure Storage resource. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsagesByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, StorageUsage.DeserializeStorageUsage, UsagesClientDiagnostics, Pipeline, "MockableStorageSubscriptionResource.GetUsagesByLocation", "value", null, cancellationToken); + } + } +} diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 5283e3414155f..0000000000000 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Storage -{ - /// 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 StorageAccountResources in the ResourceGroupResource. - /// An object representing collection of StorageAccountResources and their operations over a StorageAccountResource. - public virtual StorageAccountCollection GetStorageAccounts() - { - return GetCachedClient(Client => new StorageAccountCollection(Client, Id)); - } - } -} diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/StorageExtensions.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/StorageExtensions.cs index ca92c4f28b289..13e247804bd34 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/StorageExtensions.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/StorageExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Storage.Mocking; using Azure.ResourceManager.Storage.Models; namespace Azure.ResourceManager.Storage @@ -19,366 +20,305 @@ namespace Azure.ResourceManager.Storage /// A class to add extension methods to Azure.ResourceManager.Storage. public static partial class StorageExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableStorageArmClient GetMockableStorageArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableStorageArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableStorageResourceGroupResource GetMockableStorageResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableStorageResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableStorageSubscriptionResource GetMockableStorageSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableStorageSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region StorageAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageAccountResource GetStorageAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageAccountResource.ValidateResourceId(id); - return new StorageAccountResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetStorageAccountResource(id); } - #endregion - #region DeletedAccountResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeletedAccountResource GetDeletedAccountResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeletedAccountResource.ValidateResourceId(id); - return new DeletedAccountResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetDeletedAccountResource(id); } - #endregion - #region StorageAccountManagementPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageAccountManagementPolicyResource GetStorageAccountManagementPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageAccountManagementPolicyResource.ValidateResourceId(id); - return new StorageAccountManagementPolicyResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetStorageAccountManagementPolicyResource(id); } - #endregion - #region BlobInventoryPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BlobInventoryPolicyResource GetBlobInventoryPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BlobInventoryPolicyResource.ValidateResourceId(id); - return new BlobInventoryPolicyResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetBlobInventoryPolicyResource(id); } - #endregion - #region StoragePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StoragePrivateEndpointConnectionResource GetStoragePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StoragePrivateEndpointConnectionResource.ValidateResourceId(id); - return new StoragePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetStoragePrivateEndpointConnectionResource(id); } - #endregion - #region ObjectReplicationPolicyResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ObjectReplicationPolicyResource GetObjectReplicationPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ObjectReplicationPolicyResource.ValidateResourceId(id); - return new ObjectReplicationPolicyResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetObjectReplicationPolicyResource(id); } - #endregion - #region StorageAccountLocalUserResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageAccountLocalUserResource GetStorageAccountLocalUserResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageAccountLocalUserResource.ValidateResourceId(id); - return new StorageAccountLocalUserResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetStorageAccountLocalUserResource(id); } - #endregion - #region EncryptionScopeResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static EncryptionScopeResource GetEncryptionScopeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - EncryptionScopeResource.ValidateResourceId(id); - return new EncryptionScopeResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetEncryptionScopeResource(id); } - #endregion - #region BlobServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BlobServiceResource GetBlobServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BlobServiceResource.ValidateResourceId(id); - return new BlobServiceResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetBlobServiceResource(id); } - #endregion - #region BlobContainerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BlobContainerResource GetBlobContainerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BlobContainerResource.ValidateResourceId(id); - return new BlobContainerResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetBlobContainerResource(id); } - #endregion - #region ImmutabilityPolicyResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ImmutabilityPolicyResource GetImmutabilityPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ImmutabilityPolicyResource.ValidateResourceId(id); - return new ImmutabilityPolicyResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetImmutabilityPolicyResource(id); } - #endregion - #region FileServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FileServiceResource GetFileServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FileServiceResource.ValidateResourceId(id); - return new FileServiceResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetFileServiceResource(id); } - #endregion - #region FileShareResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static FileShareResource GetFileShareResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - FileShareResource.ValidateResourceId(id); - return new FileShareResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetFileShareResource(id); } - #endregion - #region QueueServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static QueueServiceResource GetQueueServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - QueueServiceResource.ValidateResourceId(id); - return new QueueServiceResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetQueueServiceResource(id); } - #endregion - #region StorageQueueResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageQueueResource GetStorageQueueResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageQueueResource.ValidateResourceId(id); - return new StorageQueueResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetStorageQueueResource(id); } - #endregion - #region TableServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TableServiceResource GetTableServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TableServiceResource.ValidateResourceId(id); - return new TableServiceResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetTableServiceResource(id); } - #endregion - #region TableResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TableResource GetTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TableResource.ValidateResourceId(id); - return new TableResource(client, id); - } - ); + return GetMockableStorageArmClient(client).GetTableResource(id); } - #endregion - /// Gets a collection of StorageAccountResources in the ResourceGroupResource. + /// + /// Gets a collection of StorageAccountResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of StorageAccountResources and their operations over a StorageAccountResource. public static StorageAccountCollection GetStorageAccounts(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageAccounts(); + return GetMockableStorageResourceGroupResource(resourceGroupResource).GetStorageAccounts(); } /// @@ -393,17 +333,21 @@ public static StorageAccountCollection GetStorageAccounts(this ResourceGroupReso /// StorageAccounts_GetProperties /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. /// May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetStorageAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, StorageAccountExpand? expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetStorageAccounts().GetAsync(accountName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageResourceGroupResource(resourceGroupResource).GetStorageAccountAsync(accountName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -418,25 +362,35 @@ public static async Task> GetStorageAccountAsyn /// StorageAccounts_GetProperties /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. /// May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetStorageAccount(this ResourceGroupResource resourceGroupResource, string accountName, StorageAccountExpand? expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetStorageAccounts().Get(accountName, expand, cancellationToken); + return GetMockableStorageResourceGroupResource(resourceGroupResource).GetStorageAccount(accountName, expand, cancellationToken); } - /// Gets a collection of DeletedAccountResources in the SubscriptionResource. + /// + /// Gets a collection of DeletedAccountResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DeletedAccountResources and their operations over a DeletedAccountResource. public static DeletedAccountCollection GetDeletedAccounts(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedAccounts(); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetDeletedAccounts(); } /// @@ -451,17 +405,21 @@ public static DeletedAccountCollection GetDeletedAccounts(this SubscriptionResou /// DeletedAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the deleted storage account. /// Name of the deleted storage account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDeletedAccountAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string deletedAccountName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetDeletedAccounts().GetAsync(location, deletedAccountName, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageSubscriptionResource(subscriptionResource).GetDeletedAccountAsync(location, deletedAccountName, cancellationToken).ConfigureAwait(false); } /// @@ -476,17 +434,21 @@ public static async Task> GetDeletedAccountAsyn /// DeletedAccounts_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the deleted storage account. /// Name of the deleted storage account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDeletedAccount(this SubscriptionResource subscriptionResource, AzureLocation location, string deletedAccountName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetDeletedAccounts().Get(location, deletedAccountName, cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetDeletedAccount(location, deletedAccountName, cancellationToken); } /// @@ -501,13 +463,17 @@ public static Response GetDeletedAccount(this Subscripti /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusAsync(cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetSkusAsync(cancellationToken); } /// @@ -522,13 +488,17 @@ public static AsyncPageable GetSkusAsync(this Subscriptio /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkus(cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetSkus(cancellationToken); } /// @@ -543,6 +513,10 @@ public static Pageable GetSkus(this SubscriptionResource /// StorageAccounts_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @@ -550,9 +524,7 @@ public static Pageable GetSkus(this SubscriptionResource /// is null. public static async Task> CheckStorageAccountNameAvailabilityAsync(this SubscriptionResource subscriptionResource, StorageAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckStorageAccountNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageSubscriptionResource(subscriptionResource).CheckStorageAccountNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -567,6 +539,10 @@ public static async Task> CheckSt /// StorageAccounts_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @@ -574,9 +550,7 @@ public static async Task> CheckSt /// is null. public static Response CheckStorageAccountNameAvailability(this SubscriptionResource subscriptionResource, StorageAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckStorageAccountNameAvailability(content, cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).CheckStorageAccountNameAvailability(content, cancellationToken); } /// @@ -591,13 +565,17 @@ public static Response CheckStorageAccount /// StorageAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageAccountsAsync(cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetStorageAccountsAsync(cancellationToken); } /// @@ -612,13 +590,17 @@ public static AsyncPageable GetStorageAccountsAsync(this /// StorageAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageAccounts(cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetStorageAccounts(cancellationToken); } /// @@ -633,13 +615,17 @@ public static Pageable GetStorageAccounts(this Subscript /// DeletedAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedAccountsAsync(cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetDeletedAccountsAsync(cancellationToken); } /// @@ -654,13 +640,17 @@ public static AsyncPageable GetDeletedAccountsAsync(this /// DeletedAccounts_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDeletedAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedAccounts(cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetDeletedAccounts(cancellationToken); } /// @@ -675,6 +665,10 @@ public static Pageable GetDeletedAccounts(this Subscript /// Usages_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the Azure Storage resource. @@ -682,7 +676,7 @@ public static Pageable GetDeletedAccounts(this Subscript /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesByLocationAsync(location, cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetUsagesByLocationAsync(location, cancellationToken); } /// @@ -697,6 +691,10 @@ public static AsyncPageable GetUsagesByLocationAsync(this Subscrip /// Usages_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the Azure Storage resource. @@ -704,7 +702,7 @@ public static AsyncPageable GetUsagesByLocationAsync(this Subscrip /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsagesByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesByLocation(location, cancellationToken); + return GetMockableStorageSubscriptionResource(subscriptionResource).GetUsagesByLocation(location, cancellationToken); } } } diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index ccb6b97229885..0000000000000 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Storage.Models; - -namespace Azure.ResourceManager.Storage -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; - private ClientDiagnostics _storageAccountClientDiagnostics; - private StorageAccountsRestOperations _storageAccountRestClient; - private ClientDiagnostics _deletedAccountClientDiagnostics; - private DeletedAccountsRestOperations _deletedAccountRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - - /// 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 SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storage", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics StorageAccountClientDiagnostics => _storageAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storage", StorageAccountResource.ResourceType.Namespace, Diagnostics); - private StorageAccountsRestOperations StorageAccountRestClient => _storageAccountRestClient ??= new StorageAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageAccountResource.ResourceType)); - private ClientDiagnostics DeletedAccountClientDiagnostics => _deletedAccountClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storage", DeletedAccountResource.ResourceType.Namespace, Diagnostics); - private DeletedAccountsRestOperations DeletedAccountRestClient => _deletedAccountRestClient ??= new DeletedAccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedAccountResource.ResourceType)); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Storage", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DeletedAccountResources in the SubscriptionResource. - /// An object representing collection of DeletedAccountResources and their operations over a DeletedAccountResource. - public virtual DeletedAccountCollection GetDeletedAccounts() - { - return GetCachedClient(Client => new DeletedAccountCollection(Client, Id)); - } - - /// - /// Lists the available SKUs supported by Microsoft.Storage for given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, StorageSkuInformation.DeserializeStorageSkuInformation, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", null, cancellationToken); - } - - /// - /// Lists the available SKUs supported by Microsoft.Storage for given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, StorageSkuInformation.DeserializeStorageSkuInformation, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkus", "value", null, cancellationToken); - } - - /// - /// Checks that the storage account name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability - /// - /// - /// Operation Id - /// StorageAccounts_CheckNameAvailability - /// - /// - /// - /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - /// The cancellation token to use. - public virtual async Task> CheckStorageAccountNameAvailabilityAsync(StorageAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = StorageAccountClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckStorageAccountNameAvailability"); - scope.Start(); - try - { - var response = await StorageAccountRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the storage account name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability - /// - /// - /// Operation Id - /// StorageAccounts_CheckNameAvailability - /// - /// - /// - /// The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - /// The cancellation token to use. - public virtual Response CheckStorageAccountNameAvailability(StorageAccountNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = StorageAccountClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckStorageAccountNameAvailability"); - scope.Start(); - try - { - var response = StorageAccountRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts - /// - /// - /// Operation Id - /// StorageAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageAccountRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageAccountResource(Client, StorageAccountData.DeserializeStorageAccountData(e)), StorageAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts - /// - /// - /// Operation Id - /// StorageAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageAccountRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageAccountResource(Client, StorageAccountData.DeserializeStorageAccountData(e)), StorageAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Lists deleted accounts under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts - /// - /// - /// Operation Id - /// DeletedAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedAccountRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedAccountResource(Client, DeletedAccountData.DeserializeDeletedAccountData(e)), DeletedAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Lists deleted accounts under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts - /// - /// - /// Operation Id - /// DeletedAccounts_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedAccountRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedAccountResource(Client, DeletedAccountData.DeserializeDeletedAccountData(e)), DeletedAccountClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the current usage count and the limit for the resources of the location under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_ListByLocation - /// - /// - /// - /// The location of the Azure Storage resource. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, StorageUsage.DeserializeStorageUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesByLocation", "value", null, cancellationToken); - } - - /// - /// Gets the current usage count and the limit for the resources of the location under the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_ListByLocation - /// - /// - /// - /// The location of the Azure Storage resource. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsagesByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, StorageUsage.DeserializeStorageUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsagesByLocation", "value", null, cancellationToken); - } - } -} diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileServiceResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileServiceResource.cs index 3d0509967fc32..43b229dca5e19 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileServiceResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileServiceResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Storage public partial class FileServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default"; @@ -90,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of FileShareResources and their operations over a FileShareResource. public virtual FileShareCollection GetFileShares() { - return GetCachedClient(Client => new FileShareCollection(Client, Id)); + return GetCachedClient(client => new FileShareCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual FileShareCollection GetFileShares() /// Optional, used to expand the properties within share's properties. Valid values are: stats. Should be passed as a string with delimiter ','. /// Optional, used to retrieve properties of a snapshot. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetFileShareAsync(string shareName, string expand = null, string xMsSnapshot = null, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetFileShareAsync(string /// Optional, used to expand the properties within share's properties. Valid values are: stats. Should be passed as a string with delimiter ','. /// Optional, used to retrieve properties of a snapshot. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetFileShare(string shareName, string expand = null, string xMsSnapshot = null, CancellationToken cancellationToken = default) { diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileShareResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileShareResource.cs index 1b6a06468267e..38ff9bd0fe130 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileShareResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileShareResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Storage public partial class FileShareResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The shareName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string shareName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ImmutabilityPolicyResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ImmutabilityPolicyResource.cs index 802f7f3f61ecf..7a6bbe439cc4f 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ImmutabilityPolicyResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ImmutabilityPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Storage public partial class ImmutabilityPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The containerName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string containerName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ObjectReplicationPolicyResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ObjectReplicationPolicyResource.cs index 6499238996469..5b5b22c7c9a5e 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ObjectReplicationPolicyResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/ObjectReplicationPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Storage public partial class ObjectReplicationPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The objectReplicationPolicyId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string objectReplicationPolicyId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/QueueServiceResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/QueueServiceResource.cs index 315a9eda7d16d..e76f27398be44 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/QueueServiceResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/QueueServiceResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Storage public partial class QueueServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default"; @@ -90,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StorageQueueResources and their operations over a StorageQueueResource. public virtual StorageQueueCollection GetStorageQueues() { - return GetCachedClient(Client => new StorageQueueCollection(Client, Id)); + return GetCachedClient(client => new StorageQueueCollection(client, Id)); } /// @@ -108,8 +111,8 @@ public virtual StorageQueueCollection GetStorageQueues() /// /// A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageQueueAsync(string queueName, CancellationToken cancellationToken = default) { @@ -131,8 +134,8 @@ public virtual async Task> GetStorageQueueAsync(s /// /// A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageQueue(string queueName, CancellationToken cancellationToken = default) { diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountLocalUserResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountLocalUserResource.cs index 0490d9af578f1..9dcaf7d4e2d31 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountLocalUserResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountLocalUserResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Storage public partial class StorageAccountLocalUserResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The username. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string username) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountManagementPolicyResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountManagementPolicyResource.cs index 69ee37eac9fc7..2e990405f6b45 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountManagementPolicyResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountManagementPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Storage public partial class StorageAccountManagementPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The managementPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, ManagementPolicyName managementPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountResource.cs index e363dc33f4e78..591df5437f430 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Storage public partial class StorageAccountResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"; @@ -112,7 +115,7 @@ public virtual BlobInventoryPolicyResource GetBlobInventoryPolicy() /// An object representing collection of StoragePrivateEndpointConnectionResources and their operations over a StoragePrivateEndpointConnectionResource. public virtual StoragePrivateEndpointConnectionCollection GetStoragePrivateEndpointConnections() { - return GetCachedClient(Client => new StoragePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new StoragePrivateEndpointConnectionCollection(client, Id)); } /// @@ -130,8 +133,8 @@ public virtual StoragePrivateEndpointConnectionCollection GetStoragePrivateEndpo /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStoragePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -153,8 +156,8 @@ public virtual async Task> Ge /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStoragePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -165,7 +168,7 @@ public virtual Response GetStoragePriv /// An object representing collection of ObjectReplicationPolicyResources and their operations over a ObjectReplicationPolicyResource. public virtual ObjectReplicationPolicyCollection GetObjectReplicationPolicies() { - return GetCachedClient(Client => new ObjectReplicationPolicyCollection(Client, Id)); + return GetCachedClient(client => new ObjectReplicationPolicyCollection(client, Id)); } /// @@ -183,8 +186,8 @@ public virtual ObjectReplicationPolicyCollection GetObjectReplicationPolicies() /// /// For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetObjectReplicationPolicyAsync(string objectReplicationPolicyId, CancellationToken cancellationToken = default) { @@ -206,8 +209,8 @@ public virtual async Task> GetObjectRe /// /// For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetObjectReplicationPolicy(string objectReplicationPolicyId, CancellationToken cancellationToken = default) { @@ -218,7 +221,7 @@ public virtual Response GetObjectReplicationPol /// An object representing collection of StorageAccountLocalUserResources and their operations over a StorageAccountLocalUserResource. public virtual StorageAccountLocalUserCollection GetStorageAccountLocalUsers() { - return GetCachedClient(Client => new StorageAccountLocalUserCollection(Client, Id)); + return GetCachedClient(client => new StorageAccountLocalUserCollection(client, Id)); } /// @@ -236,8 +239,8 @@ public virtual StorageAccountLocalUserCollection GetStorageAccountLocalUsers() /// /// The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageAccountLocalUserAsync(string username, CancellationToken cancellationToken = default) { @@ -259,8 +262,8 @@ public virtual async Task> GetStorageA /// /// The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageAccountLocalUser(string username, CancellationToken cancellationToken = default) { @@ -271,7 +274,7 @@ public virtual Response GetStorageAccountLocalU /// An object representing collection of EncryptionScopeResources and their operations over a EncryptionScopeResource. public virtual EncryptionScopeCollection GetEncryptionScopes() { - return GetCachedClient(Client => new EncryptionScopeCollection(Client, Id)); + return GetCachedClient(client => new EncryptionScopeCollection(client, Id)); } /// @@ -289,8 +292,8 @@ public virtual EncryptionScopeCollection GetEncryptionScopes() /// /// The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetEncryptionScopeAsync(string encryptionScopeName, CancellationToken cancellationToken = default) { @@ -312,8 +315,8 @@ public virtual async Task> GetEncryptionScopeA /// /// The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetEncryptionScope(string encryptionScopeName, CancellationToken cancellationToken = default) { diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StoragePrivateEndpointConnectionResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StoragePrivateEndpointConnectionResource.cs index 5734d49deea3c..b2d42590aae06 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StoragePrivateEndpointConnectionResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StoragePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Storage public partial class StoragePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageQueueResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageQueueResource.cs index 744282e4c0a27..a4c444597fe12 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageQueueResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageQueueResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Storage public partial class StorageQueueResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The queueName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string queueName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableResource.cs index 664078b301dc8..6d4efb9ef9897 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Storage public partial class TableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}"; diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableServiceResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableServiceResource.cs index 4708c04ddbd0b..ea04e71cb9853 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableServiceResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableServiceResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Storage public partial class TableServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default"; @@ -90,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of TableResources and their operations over a TableResource. public virtual TableCollection GetTables() { - return GetCachedClient(Client => new TableCollection(Client, Id)); + return GetCachedClient(client => new TableCollection(client, Id)); } /// @@ -108,8 +111,8 @@ public virtual TableCollection GetTables() /// /// A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTableAsync(string tableName, CancellationToken cancellationToken = default) { @@ -131,8 +134,8 @@ public virtual async Task> GetTableAsync(string tableNam /// /// A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTable(string tableName, CancellationToken cancellationToken = default) { diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs index 89bdc27d0216b..b06694e9f84cb 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlobStorageResourceContainer.cs @@ -150,5 +150,19 @@ private string ApplyOptionalPrefix(string path) => IsDirectory ? string.Join("/", DirectoryPrefix, path) : path; + + // We will require containers to be created before the transfer starts + // Since blobs is a flat namespace, we do not need to create directories (as they are virtual). + protected override Task CreateIfNotExistsAsync(CancellationToken cancellationToken) + => Task.CompletedTask; + + protected override StorageResourceContainer GetChildStorageResourceContainer(string path) + { + BlobStorageResourceContainerOptions options = _options.DeepCopy(); + options.BlobDirectoryPrefix = string.Join("/", DirectoryPrefix, path); + return new BlobStorageResourceContainer( + BlobContainerClient, + options); + } } } diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs index 52243239fb1d3..0debaf844ff99 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/src/DataMovementBlobsExtensions.cs @@ -471,5 +471,23 @@ internal static BlobStorageResourceContainerOptions GetBlobContainerOptions( BlobOptions = baseOptions, }; } + + internal static BlobStorageResourceContainerOptions DeepCopy(this BlobStorageResourceContainerOptions options) + => new BlobStorageResourceContainerOptions() + { + BlobType = options?.BlobType ?? BlobType.Block, + BlobDirectoryPrefix = options?.BlobDirectoryPrefix, + BlobOptions = new BlobStorageResourceOptions() + { + Metadata = options?.BlobOptions?.Metadata, + Tags = options?.BlobOptions?.Tags, + HttpHeaders = options?.BlobOptions?.HttpHeaders, + AccessTier = options?.BlobOptions?.AccessTier, + DestinationImmutabilityPolicy = options?.BlobOptions?.DestinationImmutabilityPolicy, + LegalHold = options?.BlobOptions?.LegalHold, + UploadTransferValidationOptions = options?.BlobOptions?.UploadTransferValidationOptions, + DownloadTransferValidationOptions = options?.BlobOptions?.DownloadTransferValidationOptions, + } + }; } } diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/Azure.Storage.DataMovement.Files.Shares.csproj b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/Azure.Storage.DataMovement.Files.Shares.csproj index 8d4bed65f1754..3126c27f07636 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/Azure.Storage.DataMovement.Files.Shares.csproj +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/Azure.Storage.DataMovement.Files.Shares.csproj @@ -31,8 +31,15 @@ + + + + + + + diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/DataMovementShareConstants.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/DataMovementShareConstants.cs index a0c773c0901df..cb838b1214a3b 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/DataMovementShareConstants.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/DataMovementShareConstants.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Text; +using static Azure.Storage.DataMovement.DataMovementConstants; namespace Azure.Storage.DataMovement.Files.Shares { @@ -13,5 +14,33 @@ internal class DataMovementShareConstants public const int MB = KB * 1024; internal const int MaxRange = 4 * MB; + + internal class SourceCheckpointData + { + internal const int DataSize = 0; + } + + internal class DestinationCheckpointData + { + internal const int SchemaVersion = 1; + + internal const int VersionIndex = 0; + + internal const int ContentTypeOffsetIndex = VersionIndex + IntSizeInBytes; + internal const int ContentTypeLengthIndex = ContentTypeOffsetIndex + IntSizeInBytes; + internal const int ContentEncodingOffsetIndex = ContentTypeLengthIndex + IntSizeInBytes; + internal const int ContentEncodingLengthIndex = ContentEncodingOffsetIndex + IntSizeInBytes; + internal const int ContentLanguageOffsetIndex = ContentEncodingLengthIndex + IntSizeInBytes; + internal const int ContentLanguageLengthIndex = ContentLanguageOffsetIndex + IntSizeInBytes; + internal const int ContentDispositionOffsetIndex = ContentLanguageLengthIndex + IntSizeInBytes; + internal const int ContentDispositionLengthIndex = ContentDispositionOffsetIndex + IntSizeInBytes; + internal const int CacheControlOffsetIndex = ContentDispositionLengthIndex + IntSizeInBytes; + internal const int CacheControlLengthIndex = CacheControlOffsetIndex + IntSizeInBytes; + + internal const int MetadataOffsetIndex = CacheControlLengthIndex + IntSizeInBytes; + internal const int MetadataLengthIndex = MetadataOffsetIndex + IntSizeInBytes; + + internal const int VariableLengthStartIndex = MetadataLengthIndex + IntSizeInBytes; + } } } diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/DataMovementSharesExtensions.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/DataMovementSharesExtensions.cs index eca0c2ed3d99b..58cf1f38ef18a 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/DataMovementSharesExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/DataMovementSharesExtensions.cs @@ -25,10 +25,12 @@ internal static ShareFileUploadRangeOptions ToShareFileUploadRangeOptions( }; internal static ShareFileUploadRangeFromUriOptions ToShareFileUploadRangeFromUriOptions( - this ShareFileStorageResourceOptions options) + this ShareFileStorageResourceOptions options, + HttpAuthorization sourceAuthorization) => new() { Conditions = options?.DestinationConditions, + SourceAuthentication = sourceAuthorization }; internal static StorageResourceProperties ToStorageResourceProperties( diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareDirectoryStorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareDirectoryStorageResourceContainer.cs index 863839eeda4a9..c1449fc230ef3 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareDirectoryStorageResourceContainer.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareDirectoryStorageResourceContainer.cs @@ -43,10 +43,17 @@ protected override StorageResourceItem GetStorageResourceReference(string path) protected override async IAsyncEnumerable GetStorageResourcesAsync( [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await foreach (ShareFileClient client in PathScanner.ScanFilesAsync( + await foreach ((ShareDirectoryClient dir, ShareFileClient file) in PathScanner.ScanAsync( ShareDirectoryClient, cancellationToken).ConfigureAwait(false)) { - yield return new ShareFileStorageResource(client, ResourceOptions); + if (file != default) + { + yield return new ShareFileStorageResource(file, ResourceOptions); + } + else + { + yield return new ShareDirectoryStorageResourceContainer(dir, ResourceOptions); + } } } @@ -57,7 +64,19 @@ protected override StorageResourceCheckpointData GetSourceCheckpointData() protected override StorageResourceCheckpointData GetDestinationCheckpointData() { - return new ShareFileDestinationCheckpointData(); + return new ShareFileDestinationCheckpointData(null, null); } + + protected override async Task CreateIfNotExistsAsync(CancellationToken cancellationToken = default) + { + await ShareDirectoryClient.CreateIfNotExistsAsync( + metadata: default, + smbProperties: default, + filePermission: default, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + + protected override StorageResourceContainer GetChildStorageResourceContainer(string path) + => new ShareDirectoryStorageResourceContainer(ShareDirectoryClient.GetSubdirectoryClient(path), ResourceOptions); } } diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileDestinationCheckpointData.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileDestinationCheckpointData.cs index da27081b0b78b..99d4a7ee9bc2c 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileDestinationCheckpointData.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileDestinationCheckpointData.cs @@ -1,16 +1,196 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.IO; +using System.Text; +using Azure.Core; +using Azure.Storage.Files.Shares.Models; +using Metadata = System.Collections.Generic.IDictionary; namespace Azure.Storage.DataMovement.Files.Shares { internal class ShareFileDestinationCheckpointData : StorageResourceCheckpointData { - public override int Length => 0; + private const char HeaderDelimiter = Constants.CommaChar; + + /// + /// Schema version. + /// + public int Version; + + /// + /// The content headers for the destination blob. + /// + public ShareFileHttpHeaders ContentHeaders; + private byte[] _contentTypeBytes; + private byte[] _contentEncodingBytes; + private byte[] _contentLanguageBytes; + private byte[] _contentDispositionBytes; + private byte[] _cacheControlBytes; + + /// + /// The metadata for the destination blob. + /// + public Metadata Metadata; + private byte[] _metadataBytes; + + public override int Length => CalculateLength(); + + public ShareFileDestinationCheckpointData( + ShareFileHttpHeaders contentHeaders, + Metadata metadata) + { + Version = DataMovementShareConstants.DestinationCheckpointData.SchemaVersion; + ContentHeaders = contentHeaders; + _contentTypeBytes = ContentHeaders?.ContentType != default ? Encoding.UTF8.GetBytes(ContentHeaders.ContentType) : Array.Empty(); + _contentEncodingBytes = ContentHeaders?.ContentEncoding != default ? Encoding.UTF8.GetBytes(string.Join(HeaderDelimiter.ToString(), ContentHeaders.ContentEncoding)) : Array.Empty(); + _contentLanguageBytes = ContentHeaders?.ContentLanguage != default ? Encoding.UTF8.GetBytes(string.Join(HeaderDelimiter.ToString(), ContentHeaders.ContentLanguage)) : Array.Empty(); + _contentDispositionBytes = ContentHeaders?.ContentDisposition != default ? Encoding.UTF8.GetBytes(ContentHeaders.ContentDisposition) : Array.Empty(); + _cacheControlBytes = ContentHeaders?.CacheControl != default ? Encoding.UTF8.GetBytes(ContentHeaders.CacheControl) : Array.Empty(); + Metadata = metadata; + _metadataBytes = Metadata != default ? Encoding.UTF8.GetBytes(Metadata.DictionaryToString()) : Array.Empty(); + } + + internal void SerializeInternal(Stream stream) => Serialize(stream); protected override void Serialize(Stream stream) { + Argument.AssertNotNull(stream, nameof(stream)); + + int currentVariableLengthIndex = DataMovementShareConstants.DestinationCheckpointData.VariableLengthStartIndex; + BinaryWriter writer = new(stream); + + // Version + writer.Write(Version); + + // Fixed position offset/lengths for variable length info + writer.WriteVariableLengthFieldInfo(_contentTypeBytes.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(_contentEncodingBytes.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(_contentLanguageBytes.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(_contentDispositionBytes.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(_cacheControlBytes.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(_metadataBytes.Length, ref currentVariableLengthIndex); + + // Variable length info + writer.Write(_contentTypeBytes); + writer.Write(_contentEncodingBytes); + writer.Write(_contentLanguageBytes); + writer.Write(_contentDispositionBytes); + writer.Write(_cacheControlBytes); + writer.Write(_metadataBytes); + } + + internal static ShareFileDestinationCheckpointData Deserialize(Stream stream) + { + Argument.AssertNotNull(stream, nameof(stream)); + + BinaryReader reader = new BinaryReader(stream); + + // Version + int version = reader.ReadInt32(); + if (version != DataMovementShareConstants.DestinationCheckpointData.SchemaVersion) + { + throw Storage.Errors.UnsupportedJobSchemaVersionHeader(version.ToString()); + } + + // ContentType offset/length + int contentTypeOffset = reader.ReadInt32(); + int contentTypeLength = reader.ReadInt32(); + + // ContentEncoding offset/length + int contentEncodingOffset = reader.ReadInt32(); + int contentEncodingLength = reader.ReadInt32(); + + // ContentLanguage offset/length + int contentLanguageOffset = reader.ReadInt32(); + int contentLanguageLength = reader.ReadInt32(); + + // ContentDisposition offset/length + int contentDispositionOffset = reader.ReadInt32(); + int contentDispositionLength = reader.ReadInt32(); + + // CacheControl offset/length + int cacheControlOffset = reader.ReadInt32(); + int cacheControlLength = reader.ReadInt32(); + + // Metadata offset/length + int metadataOffset = reader.ReadInt32(); + int metadataLength = reader.ReadInt32(); + + // ContentType + string contentType = null; + if (contentTypeOffset > 0) + { + reader.BaseStream.Position = contentTypeOffset; + contentType = Encoding.UTF8.GetString(reader.ReadBytes(contentTypeLength)); + } + + // ContentEncoding + string contentEncoding = null; + if (contentEncodingOffset > 0) + { + reader.BaseStream.Position = contentEncodingOffset; + contentEncoding = Encoding.UTF8.GetString(reader.ReadBytes(contentEncodingLength)); + } + + // ContentLanguage + string contentLanguage = null; + if (contentLanguageOffset > 0) + { + reader.BaseStream.Position = contentLanguageOffset; + contentLanguage = Encoding.UTF8.GetString(reader.ReadBytes(contentLanguageLength)); + } + + // ContentDisposition + string contentDisposition = null; + if (contentDispositionOffset > 0) + { + reader.BaseStream.Position = contentDispositionOffset; + contentDisposition = Encoding.UTF8.GetString(reader.ReadBytes(contentDispositionLength)); + } + + // CacheControl + string cacheControl = null; + if (cacheControlOffset > 0) + { + reader.BaseStream.Position = cacheControlOffset; + cacheControl = Encoding.UTF8.GetString(reader.ReadBytes(cacheControlLength)); + } + + // Metadata + string metadataString = string.Empty; + if (metadataOffset > 0) + { + reader.BaseStream.Position = metadataOffset; + metadataString = Encoding.UTF8.GetString(reader.ReadBytes(metadataLength)); + } + + ShareFileHttpHeaders contentHeaders = new() + { + ContentType = contentType, + ContentEncoding = contentEncoding.Split(HeaderDelimiter), + ContentLanguage = contentLanguage.Split(HeaderDelimiter), + ContentDisposition = contentDisposition, + CacheControl = cacheControl, + }; + + return new( + contentHeaders, + metadataString.ToDictionary(nameof(metadataString))); + } + + private int CalculateLength() + { + // Length is fixed size fields plus length of each variable length field + int length = DataMovementShareConstants.DestinationCheckpointData.VariableLengthStartIndex; + length += _contentTypeBytes.Length; + length += _contentEncodingBytes.Length; + length += _contentLanguageBytes.Length; + length += _contentDispositionBytes.Length; + length += _cacheControlBytes.Length; + length += _metadataBytes.Length; + return length; } } } diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileSourceCheckpointData.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileSourceCheckpointData.cs index 9b0bc38010add..29f104eedc1d2 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileSourceCheckpointData.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileSourceCheckpointData.cs @@ -9,8 +9,12 @@ internal class ShareFileSourceCheckpointData : StorageResourceCheckpointData { public override int Length => 0; + internal void SerializeInternal(Stream stream) => Serialize(stream); + protected override void Serialize(Stream stream) { } + + internal static ShareFileSourceCheckpointData Deserialize(Stream stream) => new(); } } diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileStorageResource.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileStorageResource.cs index 4a49a80b6a2ff..06bd423821db2 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileStorageResource.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileStorageResource.cs @@ -116,7 +116,7 @@ await ShareFileClient.UploadRangeFromUriAsync( sourceUri: sourceResource.Uri, range: range, sourceRange: range, - options: _options.ToShareFileUploadRangeFromUriOptions(), + options: _options.ToShareFileUploadRangeFromUriOptions(options?.SourceAuthentication), cancellationToken: cancellationToken).ConfigureAwait(false); } @@ -165,7 +165,7 @@ await ShareFileClient.UploadRangeFromUriAsync( sourceUri: sourceResource.Uri, range: new HttpRange(0, completeLength), sourceRange: new HttpRange(0, completeLength), - options: _options.ToShareFileUploadRangeFromUriOptions(), + options: _options.ToShareFileUploadRangeFromUriOptions(options?.SourceAuthentication), cancellationToken: cancellationToken).ConfigureAwait(false); } } @@ -211,7 +211,7 @@ protected override StorageResourceCheckpointData GetSourceCheckpointData() protected override StorageResourceCheckpointData GetDestinationCheckpointData() { - return new ShareFileDestinationCheckpointData(); + return new ShareFileDestinationCheckpointData(null, null); } } diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/Azure.Storage.DataMovement.Files.Shares.Tests.csproj b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/Azure.Storage.DataMovement.Files.Shares.Tests.csproj index de152cde090fa..b0a6b1f0a9414 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/Azure.Storage.DataMovement.Files.Shares.Tests.csproj +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/Azure.Storage.DataMovement.Files.Shares.Tests.csproj @@ -14,9 +14,6 @@ - - - @@ -26,8 +23,8 @@ - - + + @@ -43,9 +40,13 @@ + + + + diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ClientBuilderExtensions.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ClientBuilderExtensions.cs index 973d321c3e8ee..0bd6ecb2ee86d 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ClientBuilderExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ClientBuilderExtensions.cs @@ -10,7 +10,8 @@ using SharesClientBuilder = Azure.Storage.Test.Shared.ClientBuilder< Azure.Storage.Files.Shares.ShareServiceClient, Azure.Storage.Files.Shares.ShareClientOptions>; -using Azure.Storage.Files.Shares.Models; +using System.Threading; +using Azure.Core; namespace Azure.Storage.DataMovement.Files.Shares.Tests { @@ -43,24 +44,15 @@ public static SharesClientBuilder GetNewShareClientBuilder(TenantConfigurationBu (uri, azureSasCredential, clientOptions) => new ShareServiceClient(uri, azureSasCredential, clientOptions), () => new ShareClientOptions(serviceVersion)); - public static ShareServiceClient GetServiceClient_OAuthAccount_SharedKey(this SharesClientBuilder clientBuilder) => - clientBuilder.GetServiceClientFromSharedKeyConfig(clientBuilder.Tenants.TestConfigOAuth); - - public static ShareServiceClient GetServiceClient_OAuth( - this SharesClientBuilder clientBuilder, ShareClientOptions options = default) - { - options ??= clientBuilder.GetOptions(); - options.ShareTokenIntent = ShareTokenIntent.Backup; - return clientBuilder.GetServiceClientFromOauthConfig(clientBuilder.Tenants.TestConfigOAuth, options); - } - public static async Task GetTestShareAsync( this SharesClientBuilder clientBuilder, ShareServiceClient service = default, string shareName = default, IDictionary metadata = default, - ShareClientOptions options = default) + ShareClientOptions options = default, + CancellationToken cancellationToken = default) { + CancellationHelper.ThrowIfCancellationRequested(cancellationToken); service ??= clientBuilder.GetServiceClientFromSharedKeyConfig(clientBuilder.Tenants.TestConfigDefault, options); metadata ??= new Dictionary(StringComparer.OrdinalIgnoreCase); shareName ??= clientBuilder.GetNewShareName(); diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDestinationCheckpointDataTests.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDestinationCheckpointDataTests.cs new file mode 100644 index 0000000000000..25d20779a5264 --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDestinationCheckpointDataTests.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.IO; +using System.Text; +using Azure.Storage.Files.Shares.Models; +using Azure.Storage.Test; +using NUnit.Framework; +using Metadata = System.Collections.Generic.IDictionary; + +namespace Azure.Storage.DataMovement.Files.Shares.Tests +{ + public class ShareDestinationCheckpointDataTests + { + private const string DefaultContentType = "text/plain"; + private readonly string[] DefaultContentEncoding = new string[] { "gzip" }; + private readonly string[] DefaultContentLanguage = new string[] { "en-US" }; + private const string DefaultContentDisposition = "inline"; + private const string DefaultCacheControl = "no-cache"; + private readonly Metadata DefaultMetadata = DataProvider.BuildMetadata(); + + private ShareFileDestinationCheckpointData CreateDefault() + { + return new ShareFileDestinationCheckpointData( + new ShareFileHttpHeaders() + { + ContentType = DefaultContentType, + ContentEncoding = DefaultContentEncoding, + ContentLanguage = DefaultContentLanguage, + ContentDisposition = DefaultContentDisposition, + CacheControl = DefaultCacheControl, + }, + DefaultMetadata); + } + + private void AssertEquals(ShareFileDestinationCheckpointData left, ShareFileDestinationCheckpointData right) + { + Assert.That(left.Version, Is.EqualTo(right.Version)); + Assert.That(left.ContentHeaders.ContentType, Is.EqualTo(right.ContentHeaders.ContentType)); + Assert.That(left.ContentHeaders.ContentEncoding, Is.EqualTo(right.ContentHeaders.ContentEncoding)); + Assert.That(left.ContentHeaders.ContentLanguage, Is.EqualTo(right.ContentHeaders.ContentLanguage)); + Assert.That(left.ContentHeaders.ContentDisposition, Is.EqualTo(right.ContentHeaders.ContentDisposition)); + Assert.That(left.ContentHeaders.CacheControl, Is.EqualTo(right.ContentHeaders.CacheControl)); + Assert.That(left.Metadata, Is.EqualTo(right.Metadata)); + } + + private byte[] CreateSerializedDefault() + { + using MemoryStream stream = new(); + using BinaryWriter writer = new(stream); + + byte[] contentType = Encoding.UTF8.GetBytes(DefaultContentType); + byte[] contentEncoding = Encoding.UTF8.GetBytes(string.Join(",", DefaultContentEncoding)); + byte[] contentLanguage = Encoding.UTF8.GetBytes(string.Join(",", DefaultContentLanguage)); + byte[] contentDisposition = Encoding.UTF8.GetBytes(DefaultContentDisposition); + byte[] cacheControl = Encoding.UTF8.GetBytes(DefaultCacheControl); + byte[] metadata = Encoding.UTF8.GetBytes(DefaultMetadata.DictionaryToString()); + + int currentVariableLengthIndex = DataMovementShareConstants.DestinationCheckpointData.VariableLengthStartIndex; + writer.Write(DataMovementShareConstants.DestinationCheckpointData.SchemaVersion); + writer.WriteVariableLengthFieldInfo(contentType.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(contentEncoding.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(contentLanguage.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(contentDisposition.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(cacheControl.Length, ref currentVariableLengthIndex); + writer.WriteVariableLengthFieldInfo(metadata.Length, ref currentVariableLengthIndex); + writer.Write(contentType); + writer.Write(contentEncoding); + writer.Write(contentLanguage); + writer.Write(contentDisposition); + writer.Write(cacheControl); + writer.Write(metadata); + + return stream.ToArray(); + } + + [Test] + public void Ctor() + { + ShareFileDestinationCheckpointData data = CreateDefault(); + + Assert.That(data.Version, Is.EqualTo(DataMovementShareConstants.DestinationCheckpointData.SchemaVersion)); + Assert.That(data.ContentHeaders.ContentType, Is.EqualTo(DefaultContentType)); + Assert.That(data.ContentHeaders.ContentEncoding, Is.EqualTo(DefaultContentEncoding)); + Assert.That(data.ContentHeaders.ContentLanguage, Is.EqualTo(DefaultContentLanguage)); + Assert.That(data.ContentHeaders.ContentDisposition, Is.EqualTo(DefaultContentDisposition)); + Assert.That(data.ContentHeaders.CacheControl, Is.EqualTo(DefaultCacheControl)); + Assert.That(data.Metadata, Is.EqualTo(DefaultMetadata)); + } + + [Test] + public void Serialize() + { + byte[] expected = CreateSerializedDefault(); + + ShareFileDestinationCheckpointData data = CreateDefault(); + byte[] actual; + using (MemoryStream stream = new()) + { + data.SerializeInternal(stream); + actual = stream.ToArray(); + } + + Assert.That(expected, Is.EqualTo(actual)); + } + + [Test] + public void Deserialize() + { + byte[] serialized = CreateSerializedDefault(); + ShareFileDestinationCheckpointData deserialized; + + using (MemoryStream stream = new(serialized)) + { + deserialized = ShareFileDestinationCheckpointData.Deserialize(stream); + } + + AssertEquals(deserialized, CreateDefault()); + } + + [Test] + public void RoundTrip() + { + ShareFileDestinationCheckpointData original = CreateDefault(); + using MemoryStream serialized = new(); + original.SerializeInternal(serialized); + serialized.Position = 0; + ShareFileDestinationCheckpointData deserialized = ShareFileDestinationCheckpointData.Deserialize(serialized); + + AssertEquals(original, deserialized); + } + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStartTransferCopyTests.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStartTransferCopyTests.cs new file mode 100644 index 0000000000000..794681a64f2c3 --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStartTransferCopyTests.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using Azure.Storage.DataMovement.Tests; +using Azure.Storage.Files.Shares; +using Azure.Storage.Files.Shares.Models; +using Azure.Storage.Test.Shared; +using Azure.Storage.Files.Shares.Tests; +using NUnit.Framework; +using System.Security.AccessControl; +using Microsoft.Extensions.Options; +using System.Threading; +using Azure.Core; + +namespace Azure.Storage.DataMovement.Files.Shares.Tests +{ + [ShareClientTestFixture] + public class ShareDirectoryStartTransferCopyTests : StartTransferDirectoryCopyTestBase< + ShareServiceClient, + ShareClient, + ShareClientOptions, + ShareServiceClient, + ShareClient, + ShareClientOptions, + StorageTestEnvironment> + { + private const string _fileResourcePrefix = "test-file-"; + private const string _expectedOverwriteExceptionMessage = "Cannot overwrite file."; + + public ShareDirectoryStartTransferCopyTests(bool async, ShareClientOptions.ServiceVersion serviceVersion) + : base(async, _expectedOverwriteExceptionMessage, _fileResourcePrefix, null /* RecordedTestMode.Record /* to re-record */) + { + SourceClientBuilder = ClientBuilderExtensions.GetNewShareClientBuilder(Tenants, serviceVersion); + DestinationClientBuilder = ClientBuilderExtensions.GetNewShareClientBuilder(Tenants, serviceVersion); + } + + protected override async Task CreateObjectInSourceAsync( + ShareClient container, + long? objectLength = null, + string objectName = null, + Stream contents = default, + CancellationToken cancellationToken = default) + => await CreateShareFileAsync(container, objectLength, objectName, contents, cancellationToken); + + protected override async Task CreateObjectInDestinationAsync( + ShareClient container, + long? objectLength = null, + string objectName = null, + Stream contents = null, + CancellationToken cancellationToken = default) + => await CreateShareFileAsync(container, objectLength, objectName, contents, cancellationToken); + + protected override async Task> GetDestinationDisposingContainerAsync( + ShareServiceClient service = null, + string containerName = null, + CancellationToken cancellationToken = default) + => await DestinationClientBuilder.GetTestShareAsync(service, containerName, cancellationToken: cancellationToken); + + protected override StorageResourceContainer GetDestinationStorageResourceContainer(ShareClient containerClient, string prefix) + => new ShareDirectoryStorageResourceContainer(containerClient.GetDirectoryClient(prefix), default); + + protected override ShareClient GetOAuthSourceContainerClient(string containerName) + { + ShareClientOptions options = SourceClientBuilder.GetOptions(); + options.ShareTokenIntent = ShareTokenIntent.Backup; + ShareServiceClient oauthService = SourceClientBuilder.GetServiceClientFromOauthConfig(Tenants.TestConfigOAuth, options); + return oauthService.GetShareClient(containerName); + } + + protected override ShareClient GetOAuthDestinationContainerClient(string containerName) + { + ShareClientOptions options = DestinationClientBuilder.GetOptions(); + options.ShareTokenIntent = ShareTokenIntent.Backup; + ShareServiceClient oauthService = DestinationClientBuilder.GetServiceClientFromOauthConfig(Tenants.TestConfigOAuth, options); + return oauthService.GetShareClient(containerName); + } + + protected override async Task> GetSourceDisposingContainerAsync(ShareServiceClient service = null, string containerName = null, CancellationToken cancellationToken = default) + { + service ??= SourceClientBuilder.GetServiceClientFromSharedKeyConfig(SourceClientBuilder.Tenants.TestConfigDefault, SourceClientBuilder.GetOptions()); + ShareServiceClient sasService = new ShareServiceClient(service.GenerateAccountSasUri( + Sas.AccountSasPermissions.All, + SourceClientBuilder.Recording.UtcNow.AddDays(1), + Sas.AccountSasResourceTypes.All), + SourceClientBuilder.GetOptions()); + return await SourceClientBuilder.GetTestShareAsync(sasService, containerName, cancellationToken: cancellationToken); + } + + protected override StorageResourceContainer GetSourceStorageResourceContainer(ShareClient containerClient, string prefix = null) + => new ShareDirectoryStorageResourceContainer(containerClient.GetDirectoryClient(prefix), default); + + protected override async Task CreateDirectoryInSourceAsync(ShareClient sourceContainer, string directoryPath, CancellationToken cancellationToken = default) + => await CreateDirectoryTreeAsync(sourceContainer, directoryPath, cancellationToken); + + protected override async Task CreateDirectoryInDestinationAsync(ShareClient destinationContainer, string directoryPath, CancellationToken cancellationToken = default) + => await CreateDirectoryTreeAsync(destinationContainer, directoryPath, cancellationToken); + + protected override async Task VerifyEmptyDestinationContainerAsync( + ShareClient destinationContainer, + string destinationPrefix, + CancellationToken cancellationToken = default) + { + CancellationHelper.ThrowIfCancellationRequested(cancellationToken); + ShareDirectoryClient destinationDirectory = string.IsNullOrEmpty(destinationPrefix) ? + destinationContainer.GetRootDirectoryClient() : + destinationContainer.GetDirectoryClient(destinationPrefix); + IList items = await destinationDirectory.GetFilesAndDirectoriesAsync(cancellationToken: cancellationToken).ToListAsync(); + Assert.IsEmpty(items); + } + + protected override async Task VerifyResultsAsync( + ShareClient sourceContainer, + string sourcePrefix, + ShareClient destinationContainer, + string destinationPrefix, + CancellationToken cancellationToken = default) + { + CancellationHelper.ThrowIfCancellationRequested(cancellationToken); + + // List all files in source blob folder path + List sourceFileNames = new List(); + List sourceDirectoryNames = new List(); + + // Get source directory client and list the paths + ShareDirectoryClient sourceDirectory = string.IsNullOrEmpty(sourcePrefix) ? + sourceContainer.GetRootDirectoryClient() : + sourceContainer.GetDirectoryClient(sourcePrefix); + await foreach (Page page in sourceDirectory.GetFilesAndDirectoriesAsync().AsPages()) + { + sourceFileNames.AddRange(page.Values.Where((ShareFileItem item) => !item.IsDirectory).Select((ShareFileItem item) => item.Name)); + sourceDirectoryNames.AddRange(page.Values.Where((ShareFileItem item) => item.IsDirectory).Select((ShareFileItem item) => item.Name)); + } + + // List all files in the destination blob folder path + List destinationFileNames = new List(); + List destinationDirectoryNames = new List(); + + ShareDirectoryClient destinationDirectory = string.IsNullOrEmpty(destinationPrefix) ? + destinationContainer.GetRootDirectoryClient() : + destinationContainer.GetDirectoryClient(destinationPrefix); + await foreach (Page page in destinationDirectory.GetFilesAndDirectoriesAsync().AsPages()) + { + destinationFileNames.AddRange(page.Values.Where((ShareFileItem item) => !item.IsDirectory).Select((ShareFileItem item) => item.Name)); + destinationDirectoryNames.AddRange(page.Values.Where((ShareFileItem item) => item.IsDirectory).Select((ShareFileItem item) => item.Name)); + } + + // Assert subdirectories + Assert.AreEqual(sourceDirectoryNames.Count, destinationDirectoryNames.Count); + Assert.AreEqual(sourceDirectoryNames, destinationDirectoryNames); + + // Assert file and file contents + Assert.AreEqual(sourceFileNames.Count, destinationFileNames.Count); + for (int i = 0; i < sourceFileNames.Count; i++) + { + Assert.AreEqual( + sourceFileNames[i], + destinationFileNames[i]); + + // Verify Download + string sourceFileName = Path.Combine(sourcePrefix, sourceFileNames[i]); + using Stream sourceStream = await sourceDirectory.GetFileClient(sourceFileNames[i]).OpenReadAsync(cancellationToken: cancellationToken); + using Stream destinationStream = await destinationDirectory.GetFileClient(destinationFileNames[i]).OpenReadAsync(cancellationToken: cancellationToken); + Assert.AreEqual(sourceStream, destinationStream); + } + } + + private async Task CreateShareFileAsync( + ShareClient container, + long? objectLength = null, + string objectName = null, + Stream contents = default, + CancellationToken cancellationToken = default) + { + CancellationHelper.ThrowIfCancellationRequested(cancellationToken); + objectName ??= GetNewObjectName(); + if (!objectLength.HasValue) + { + throw new InvalidOperationException($"Cannot create share file without size specified. Specify {nameof(objectLength)}."); + } + ShareFileClient fileClient = container.GetRootDirectoryClient().GetFileClient(objectName); + await fileClient.CreateAsync(objectLength.Value); + + if (contents != default) + { + await fileClient.UploadAsync(contents, cancellationToken: cancellationToken); + } + } + + private async Task CreateDirectoryTreeAsync(ShareClient container, string directoryPath, CancellationToken cancellationToken = default) + { + CancellationHelper.ThrowIfCancellationRequested(cancellationToken); + ShareDirectoryClient directory = container.GetRootDirectoryClient().GetSubdirectoryClient(directoryPath); + await directory.CreateIfNotExistsAsync(cancellationToken: cancellationToken); + } + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStartTransferDownloadTests.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStartTransferDownloadTests.cs new file mode 100644 index 0000000000000..5f5734ec28bb6 --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStartTransferDownloadTests.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Storage.DataMovement.Tests; +using Azure.Storage.Files.Shares; +using Azure.Storage.Files.Shares.Tests; +using Azure.Storage.Test.Shared; + +namespace Azure.Storage.DataMovement.Files.Shares.Tests +{ + [ShareClientTestFixture] + public class ShareDirectoryStartTransferDownloadTests + : StartTransferDirectoryDownloadTestBase< + ShareServiceClient, + ShareClient, + ShareClientOptions, + StorageTestEnvironment> + { + private const string _fileResourcePrefix = "test-file-"; + private const string _dirResourcePrefix = "test-file-"; + private const string _expectedOverwriteExceptionMessage = "Cannot overwrite file."; + + public ShareDirectoryStartTransferDownloadTests( + bool async, + ShareClientOptions.ServiceVersion serviceVersion) + : base(async, _expectedOverwriteExceptionMessage, _fileResourcePrefix, _dirResourcePrefix, null /* RecordedTestMode.Record /* to re-record */) + { + ClientBuilder = ClientBuilderExtensions.GetNewShareClientBuilder(Tenants, serviceVersion); + } + + protected override async Task> GetDisposingContainerAsync(ShareServiceClient service = null, string containerName = null) + => await ClientBuilder.GetTestShareAsync(service, containerName); + + protected override async Task CreateObjectClientAsync( + ShareClient container, + long? objectLength, + string objectName, + bool createResource = false, + ShareClientOptions options = null, + Stream contents = null, + CancellationToken cancellationToken = default) + { + objectName ??= GetNewObjectName(); + if (!objectLength.HasValue) + { + throw new InvalidOperationException($"Cannot create share file without size specified. Specify {nameof(objectLength)}."); + } + ShareFileClient fileClient = container.GetRootDirectoryClient().GetFileClient(objectName); + await fileClient.CreateAsync(objectLength.Value, cancellationToken: cancellationToken); + + if (contents != default) + { + await fileClient.UploadAsync(contents, cancellationToken: cancellationToken); + } + } + + protected override TransferValidator.ListFilesAsync GetSourceLister(ShareClient container, string prefix) + => TransferValidator.GetShareFilesLister(container, prefix); + + protected override StorageResourceContainer GetStorageResourceContainer(ShareClient container, string directoryPath) + { + ShareDirectoryClient directory = string.IsNullOrEmpty(directoryPath) ? + container.GetRootDirectoryClient() : + container.GetDirectoryClient(directoryPath); + return new ShareDirectoryStorageResourceContainer(directory, new ShareFileStorageResourceOptions()); + } + + protected override async Task SetupSourceDirectoryAsync( + ShareClient container, + string directoryPath, + List<(string PathName, int Size)> fileSizes, + CancellationToken cancellationToken) + { + ShareDirectoryClient parentDirectory = string.IsNullOrEmpty(directoryPath) ? + container.GetRootDirectoryClient() : + container.GetDirectoryClient(directoryPath); + if (!string.IsNullOrEmpty(directoryPath)) + { + await parentDirectory.CreateIfNotExistsAsync(cancellationToken: cancellationToken); + } + HashSet subDirectoryNames = new() { directoryPath }; + foreach ((string filePath, long size) in fileSizes) + { + CancellationHelper.ThrowIfCancellationRequested(cancellationToken); + + // Check if the parent subdirectory is already created, + // if not create it before making the files + int fileNameIndex = filePath.LastIndexOf('/'); + string subDirectoryName = fileNameIndex > 0 ? filePath.Substring(0, fileNameIndex) : ""; + string fileName = fileNameIndex > 0 ? filePath.Substring(fileNameIndex + 1) : filePath; + + // Create parent subdirectory if it does not currently exist. + ShareDirectoryClient subdirectory = string.IsNullOrEmpty(subDirectoryName) ? + container.GetRootDirectoryClient() : + container.GetDirectoryClient(subDirectoryName); + + if (!string.IsNullOrEmpty(subDirectoryName) && + !subDirectoryNames.Contains(subDirectoryName)) + { + await subdirectory.CreateIfNotExistsAsync(cancellationToken: cancellationToken); + subDirectoryNames.Add(subDirectoryName); + } + + using (Stream data = await CreateLimitedMemoryStream(size)) + { + ShareFileClient fileClient = subdirectory.GetFileClient(fileName); + await fileClient.CreateAsync(size, cancellationToken: cancellationToken); + if (size > 0) + { + await fileClient.UploadAsync(data, cancellationToken: cancellationToken); + } + } + } + } + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStorageResourceContainerTests.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStorageResourceContainerTests.cs index 327b072cd6376..1b06dcd0a35f6 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStorageResourceContainerTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareDirectoryStorageResourceContainerTests.cs @@ -7,8 +7,12 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Azure.Core.TestFramework; using Azure.Storage.Files.Shares; +using Azure.Storage.Files.Shares.Models; +using Azure.Storage.Test; using Azure.Storage.Tests; +using BenchmarkDotNet.Toolchains.Roslyn; using Moq; using NUnit.Framework; @@ -16,13 +20,19 @@ namespace Azure.Storage.DataMovement.Files.Shares.Tests { internal class ShareDirectoryStorageResourceContainerTests { - private async IAsyncEnumerable ToAsyncEnumerable(IEnumerable items) + private async IAsyncEnumerable<(TDirectory Directory, TFile File)> ToAsyncEnumerable( + IEnumerable directories, + IEnumerable files) { - foreach (var item in items) + if (files.Count() != directories.Count()) + { + throw new ArgumentException("Items and Directories should be the same amount"); + } + for (int i = 0; i < files.Count(); i++) { // returning async enumerable must be an async method // so we need something to await - yield return await Task.FromResult(item); + yield return await Task.FromResult((directories.ElementAt(i), files.ElementAt(i))); } } @@ -31,15 +41,21 @@ public async Task GetStorageResourcesCallsPathScannerCorrectly() { // Given clients Mock mainClient = new(); - List> expectedFiles = Enumerable.Range(0, 10) + int pathCount = 10; + List> expectedFiles = Enumerable.Range(0, pathCount) .Select(i => new Mock()) .ToList(); + List> expectedDirectories = Enumerable.Range(0, pathCount) + .Select(i => new Mock()) + .ToList(); // And a mock path scanner Mock pathScanner = new(); - pathScanner.Setup(p => p.ScanFilesAsync(mainClient.Object, It.IsAny())) + pathScanner.Setup(p => p.ScanAsync(mainClient.Object, It.IsAny())) .Returns( - (dir, cancellationToken) => ToAsyncEnumerable(expectedFiles.Select(m => m.Object))); + (dir, cancellationToken) => ToAsyncEnumerable( + expectedDirectories.Select(m => m.Object), + expectedFiles.Select(m => m.Object))); // Setup StorageResourceContainer ShareDirectoryStorageResourceContainer resource = new(mainClient.Object, default) @@ -61,7 +77,7 @@ public async Task GetStorageResourcesCallsPathScannerCorrectly() public void GetCorrectStorageResourceItem() { // Given a resource container - ShareDirectoryClient startingDir = new(new Uri("https://myaccount.file.core.windows.net/myshare/mydir")); + ShareDirectoryClient startingDir = new(new Uri("https://myaccount.file.core.windows.net/myshare/mydir"), new ShareClientOptions()); ShareDirectoryStorageResourceContainer resourceContainer = new(startingDir, default); // and a subpath to get @@ -79,5 +95,86 @@ public void GetCorrectStorageResourceItem() Is.EqualTo(startingDir.Path + "/" + string.Join("/", pathSegments))); Assert.That(fileResourceItem.ShareFileClient.Name, Is.EqualTo(pathSegments.Last())); } + + [Test] + public async Task CreateIfNotExists() + { + // Arrange + Mock mock = new(new Uri("https://myaccount.file.core.windows.net/myshare/mydir"), new ShareClientOptions()); + mock.Setup(b => b.CreateIfNotExistsAsync(It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) + .Returns(Task.FromResult(Response.FromValue( + SharesModelFactory.StorageDirectoryInfo( + eTag: new ETag("etag"), + lastModified: DateTimeOffset.UtcNow, + filePermissionKey: default, + fileAttributes: default, + fileCreationTime: DateTimeOffset.MinValue, + fileLastWriteTime: DateTimeOffset.MinValue, + fileChangeTime: DateTimeOffset.MinValue, + fileId: default, + fileParentId: default), + new MockResponse(200)))); + + ShareDirectoryStorageResourceContainer resourceContainer = new(mock.Object, default); + + // Act + await resourceContainer.CreateIfNotExistsInternalAsync(); + + // Assert + mock.Verify(b => b.CreateIfNotExistsAsync(It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny()), + Times.Once()); + mock.VerifyNoOtherCalls(); + } + + [Test] + public async Task CreateIfNotExists_Error() + { + // Arrange + Mock mock = new(new Uri("https://myaccount.file.core.windows.net/myshare/mydir"), new ShareClientOptions()); + mock.Setup(b => b.CreateIfNotExistsAsync(It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) + .Throws(new RequestFailedException(status: 404, message: "The parent path does not exist.", errorCode: "ResourceNotFound", default)); + + ShareDirectoryStorageResourceContainer resourceContainer = new(mock.Object, default); + + // Act + await TestHelper.AssertExpectedExceptionAsync( + resourceContainer.CreateIfNotExistsInternalAsync(), + e => + { + Assert.AreEqual("ResourceNotFound", e.ErrorCode); + }); + + mock.Verify(b => b.CreateIfNotExistsAsync(It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny()), + Times.Once()); + mock.VerifyNoOtherCalls(); + } + + [Test] + public void GetChildStorageResourceContainer() + { + // Arrange + Uri uri = new Uri("https://storageaccount.file.core.windows.net/container/directory"); + Mock mock = new Mock(uri, new ShareClientOptions()); + mock.Setup(b => b.Uri).Returns(uri); + mock.Setup(b => b.GetSubdirectoryClient(It.IsAny())) + .Returns((path) => + { + UriBuilder builder = new UriBuilder(uri); + builder.Path = string.Join("/", builder.Path, path); + return new ShareDirectoryClient(builder.Uri); + }); + + ShareDirectoryStorageResourceContainer containerResource = + new(mock.Object, new ShareFileStorageResourceOptions()); + + // Act + string childPath = "foo"; + StorageResourceContainer childContainer = containerResource.GetChildStorageResourceContainerInternal(childPath); + + // Assert + UriBuilder builder = new UriBuilder(containerResource.Uri); + builder.Path = string.Join("/", builder.Path, childPath); + Assert.AreEqual(builder.Uri, childContainer.Uri); + } } } diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareFileStartTransferDownloadTests.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareFileStartTransferDownloadTests.cs index 9edff7785fd49..a06ca0d72178c 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareFileStartTransferDownloadTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareFileStartTransferDownloadTests.cs @@ -2,10 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Azure.Storage.DataMovement.Tests; using Azure.Storage.Files.Shares; diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareSourceCheckpointDataTests.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareSourceCheckpointDataTests.cs new file mode 100644 index 0000000000000..3e3ab27823b9d --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/ShareSourceCheckpointDataTests.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.IO; +using NUnit.Framework; + +namespace Azure.Storage.DataMovement.Files.Shares.Tests +{ + public class ShareSourceCheckpointDataTests + { + [Test] + public void Ctor() + { + ShareFileSourceCheckpointData data = new(); + } + + [Test] + public void Serialize() + { + byte[] expected = Array.Empty(); + + ShareFileSourceCheckpointData data = new(); + byte[] actual; + using (MemoryStream stream = new()) + { + data.SerializeInternal(stream); + actual = stream.ToArray(); + } + + Assert.That(expected, Is.EqualTo(actual)); + } + + [Test] + public void Deserialize() + { + ShareFileSourceCheckpointData deserialized; + + using (MemoryStream stream = new()) + { + deserialized = ShareFileSourceCheckpointData.Deserialize(Stream.Null); + } + } + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/TransferValidator.Shares.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/TransferValidator.Shares.cs new file mode 100644 index 0000000000000..8c6917ae007c1 --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/tests/TransferValidator.Shares.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Azure.Storage.Files.Shares; +using Azure.Storage.Files.Shares.Models; + +namespace Azure.Storage.DataMovement.Tests +{ + public partial class TransferValidator + { + public class ShareResourceEnumerationItem : IResourceEnumerationItem + { + private readonly ShareFileClient _client; + + public string RelativePath { get; } + + public ShareResourceEnumerationItem(ShareFileClient client, string relativePath) + { + _client = client; + RelativePath = relativePath; + } + + public async Task OpenReadAsync(CancellationToken cancellationToken) + { + return await _client.OpenReadAsync(cancellationToken: cancellationToken); + } + } + + public static ListFilesAsync GetShareFilesLister(ShareClient container, string prefix) + { + async Task> ListFiles(CancellationToken cancellationToken) + { + List result = new(); + ShareDirectoryClient directory = string.IsNullOrEmpty(prefix) ? + container.GetRootDirectoryClient() : + container.GetDirectoryClient(prefix); + + Queue toScan = new(); + toScan.Enqueue(directory); + + while (toScan.Count > 0) + { + ShareDirectoryClient current = toScan.Dequeue(); + await foreach (ShareFileItem item in current.GetFilesAndDirectoriesAsync( + cancellationToken: cancellationToken).ConfigureAwait(false)) + { + if (item.IsDirectory) + { + ShareDirectoryClient subdir = current.GetSubdirectoryClient(item.Name); + toScan.Enqueue(subdir); + } + else + { + string relativePath = ""; + if (string.IsNullOrEmpty(current.Path)) + { + relativePath = item.Name; + } + else if (string.IsNullOrEmpty(prefix)) + { + relativePath = string.Join("/", current.Path, item.Name); + } + else + { + relativePath = + prefix != current.Name ? + string.Join("/", current.Path.Substring(prefix.Length + 1), item.Name) : + item.Name; + } + result.Add(new ShareResourceEnumerationItem(current.GetFileClient(item.Name), relativePath)); + } + } + } + return result; + } + return ListFiles; + } + + public static ListFilesAsync GetFileListerSingle(ShareFileClient file, string relativePath) + { + Task> ListFiles(CancellationToken cancellationToken) + { + return Task.FromResult(new List + { + new ShareResourceEnumerationItem(file, relativePath) + }); + } + return ListFiles; + } + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs b/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs index 4140218d0bdb5..58bdd57ce296a 100644 --- a/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs +++ b/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs @@ -129,6 +129,8 @@ public abstract partial class StorageResourceContainer : Azure.Storage.DataMovem { protected StorageResourceContainer() { } protected internal override bool IsContainer { get { throw null; } } + protected internal abstract System.Threading.Tasks.Task CreateIfNotExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract Azure.Storage.DataMovement.StorageResourceContainer GetChildStorageResourceContainer(string path); protected internal abstract Azure.Storage.DataMovement.StorageResourceItem GetStorageResourceReference(string path); protected internal abstract System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } diff --git a/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs b/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs index 4140218d0bdb5..58bdd57ce296a 100644 --- a/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs @@ -129,6 +129,8 @@ public abstract partial class StorageResourceContainer : Azure.Storage.DataMovem { protected StorageResourceContainer() { } protected internal override bool IsContainer { get { throw null; } } + protected internal abstract System.Threading.Tasks.Task CreateIfNotExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + protected internal abstract Azure.Storage.DataMovement.StorageResourceContainer GetChildStorageResourceContainer(string path); protected internal abstract Azure.Storage.DataMovement.StorageResourceItem GetStorageResourceReference(string path); protected internal abstract System.Collections.Generic.IAsyncEnumerable GetStorageResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPartInternal.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPartInternal.cs index ce1bea76bdd0c..ea38713c0b76f 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPartInternal.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/JobPartInternal.cs @@ -451,20 +451,17 @@ public async virtual Task CleanupAbortedJobPartAsync() /// /// Serializes the respective job part and adds it to the checkpointer. /// - /// Number of chunks in the job part. - /// - public async virtual Task AddJobPartToCheckpointerAsync(int chunksTotal) + public async virtual Task AddJobPartToCheckpointerAsync() { - JobPartPlanHeader header = this.ToJobPartPlanHeader(jobStatus: JobPartStatus); + JobPartPlanHeader header = this.ToJobPartPlanHeader(); using (Stream stream = new MemoryStream()) { header.Serialize(stream); await _checkpointer.AddNewJobPartAsync( - transferId: _dataTransfer.Id, - partNumber: PartNumber, - chunksTotal: chunksTotal, - headerStream: stream, - cancellationToken: _cancellationToken).ConfigureAwait(false); + transferId: _dataTransfer.Id, + partNumber: PartNumber, + headerStream: stream, + cancellationToken: _cancellationToken).ConfigureAwait(false); } } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/FolderPropertiesMode.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/FolderPropertiesMode.cs deleted file mode 100644 index fa77942a2b0c5..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/FolderPropertiesMode.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Storage.DataMovement.JobPlan -{ - /// - /// SMB Feature whether to preserve permissions on the folder - /// - internal enum FolderPropertiesMode - { - None = 0, - NoFolders = 1, - AllFoldersExceptRoot = 2, - AllFolders = 3, - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartDeleteSnapshotsOption.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartDeleteSnapshotsOption.cs deleted file mode 100644 index 6564189d9f9e7..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartDeleteSnapshotsOption.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Storage.DataMovement.JobPlan -{ - /// - /// Required if the blob has associated snapshots. Specify one of the following two options: - /// include: Delete the base blob and all of its snapshots. - /// only: Delete only the blob's snapshots and not the blob itself - /// - internal enum JobPartDeleteSnapshotsOption - { - /// - /// none - /// - None = 0, - - /// - /// include - /// - IncludeSnapshots = 1, - - /// - /// only - /// - OnlySnapshots = 2, - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPermanentDeleteOption.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPermanentDeleteOption.cs deleted file mode 100644 index 9959910a9aa8c..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPermanentDeleteOption.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Storage.DataMovement.JobPlan -{ - /// - /// Permanent Delete Options - /// - /// TODO: Consider removing since the SDK does not support deleting - /// customer data permanently - /// - internal enum JobPartPermanentDeleteOption - { - None = 0, - Snapshots = 1, - Versions = 2, - SnapshotsAndVersions = 3, - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanBlockBlobTier.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanBlockBlobTier.cs deleted file mode 100644 index 358cad4c6675e..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanBlockBlobTier.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Storage.DataMovement.JobPlan -{ - internal enum JobPartPlanBlockBlobTier - { - /// None. - None = 0, - /// Hot. - Hot = 1, - /// Cool. - Cool = 2, - /// Archive. - Archive = 3, - /// Cold. - Cold = 4, - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanDestinationBlob.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanDestinationBlob.cs deleted file mode 100644 index 98567c159e473..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanDestinationBlob.cs +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -using System.Collections.Generic; - -namespace Azure.Storage.DataMovement.JobPlan -{ - /// - /// Describes the structure of a destination blob. - /// - /// Comes to a total of 6311 bytes - /// - internal class JobPartPlanDestinationBlob - { - /// - /// Blob Type - /// - public JobPlanBlobType BlobType; - - /// - /// Represents user decision to interpret the content-encoding from source file - /// - public bool NoGuessMimeType; - - /// - /// Specifies the length of MIME content type of the blob - /// - public ushort ContentTypeLength; - - /// - /// Specifies the MIME content type of the blob. The default type is application/octet-stream - /// - public string ContentType; - - /// - /// Specifies length of content encoding which have been applied to the blob. - /// - public ushort ContentEncodingLength; - - /// - /// Specifies the MIME content type of the blob. The default type is application/octet-stream - /// - public string ContentEncoding; - - /// - /// Specifies length of content language which has been applied to the blob. - /// - public ushort ContentLanguageLength; - - /// - /// Specifies which content language has been applied to the blob. - /// - public string ContentLanguage; - - /// - /// Specifies length of content disposition which has been applied to the blob. - /// - public ushort ContentDispositionLength; - - /// - /// Specifies the content disposition of the blob - /// - public string ContentDisposition; - - /// - /// Specifies the length of the cache control which has been applied to the blob. - /// - public ushort CacheControlLength; - - /// - /// Specifies the cache control of the blob - /// - public string CacheControl; - - /// - /// Specifies the tier if this is a block or page blob respectfully. Only one or none can be specified at a time. - /// - public JobPartPlanBlockBlobTier BlockBlobTier; - public JobPartPlanPageBlobTier PageBlobTier; - - /// - /// Controls uploading of MD5 hashes - /// - public bool PutMd5; - - /// - /// Length of metadata - /// - public ushort MetadataLength; - - /// - /// Metadata - /// - public string Metadata; - - /// - /// Length of blob tags - /// - public long BlobTagsLength; - - /// - /// Blob Tags - /// - public string BlobTags; - - /// - /// Is source encrypted? - /// - public bool IsSourceEncrypted; - - /// - /// CPK encryption scope. - /// - public ushort CpkScopeInfoLength; - - /// - /// Length of CPK encryption scope. - /// - public string CpkScopeInfo; - - /// - /// Specifies the maximum size of block which determines the number of chunks and chunk size of a transfer - /// - public long BlockSize; - - public JobPartPlanDestinationBlob( - JobPlanBlobType blobType, - bool noGuessMimeType, - string contentType, - string contentEncoding, - string contentLanguage, - string contentDisposition, - string cacheControl, - JobPartPlanBlockBlobTier blockBlobTier, - JobPartPlanPageBlobTier pageBlobTier, - bool putMd5, - string metadata, - string blobTags, - bool isSourceEncrypted, - string cpkScopeInfo, - long blockSize) - : this( - blobType: blobType, - noGuessMimeType: noGuessMimeType, - contentType: contentType, - contentEncoding: contentEncoding, - contentLanguage: contentLanguage, - contentDisposition: contentDisposition, - cacheControl: cacheControl, - blockBlobTier: blockBlobTier, - pageBlobTier: pageBlobTier, - putMd5: putMd5, - metadata: metadata.ToDictionary(nameof(metadata)), - blobTags: blobTags.ToDictionary(nameof(blobTags)), - isSourceEncrypted: isSourceEncrypted, - cpkScopeInfo: cpkScopeInfo, - blockSize: blockSize) - { - } - - public JobPartPlanDestinationBlob( - JobPlanBlobType blobType, - bool noGuessMimeType, - string contentType, - string contentEncoding, - string contentLanguage, - string contentDisposition, - string cacheControl, - JobPartPlanBlockBlobTier blockBlobTier, - JobPartPlanPageBlobTier pageBlobTier, - bool putMd5, - IDictionary metadata, - IDictionary blobTags, - bool isSourceEncrypted, - string cpkScopeInfo, - long blockSize) - { - BlobType = blobType; - NoGuessMimeType = noGuessMimeType; - if (contentType.Length <= DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength) - { - ContentType = contentType; - ContentTypeLength = (ushort) contentType.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(ContentType), - expectedSize: DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength, - actualSize: contentType.Length); - } - if (contentEncoding.Length <= DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength) - { - ContentEncoding = contentEncoding; - ContentEncodingLength = (ushort) contentEncoding.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(ContentEncoding), - expectedSize: DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength, - actualSize: contentEncoding.Length); - } - if (contentLanguage.Length <= DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength) - { - ContentLanguage = contentLanguage; - ContentLanguageLength = (ushort) contentLanguage.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(ContentLanguage), - expectedSize: DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength, - actualSize: contentLanguage.Length); - } - if (contentDisposition.Length <= DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength) - { - ContentDisposition = contentDisposition; - ContentDispositionLength = (ushort) contentDisposition.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(ContentDisposition), - expectedSize: DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength, - actualSize: contentDisposition.Length); - } - if (cacheControl.Length <= DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength) - { - CacheControl = cacheControl; - CacheControlLength = (ushort) cacheControl.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(CacheControl), - expectedSize: DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength, - actualSize: cacheControl.Length); - } - BlockBlobTier = blockBlobTier; - PageBlobTier = pageBlobTier; - PutMd5 = putMd5; - string metadataConvert = metadata.DictionaryToString(); - if (metadataConvert.Length <= DataMovementConstants.JobPartPlanFile.MetadataStrMaxLength) - { - Metadata = metadataConvert; - MetadataLength = (ushort) metadataConvert.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(Metadata), - expectedSize: DataMovementConstants.JobPartPlanFile.MetadataStrMaxLength, - actualSize: metadataConvert.Length); - } - string blobTagsConvert = blobTags.DictionaryToString(); - if (blobTagsConvert.Length <= DataMovementConstants.JobPartPlanFile.BlobTagsStrMaxLength) - { - BlobTags = blobTagsConvert; - BlobTagsLength = blobTagsConvert.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(blobTags), - expectedSize: DataMovementConstants.JobPartPlanFile.BlobTagsStrMaxLength, - actualSize: blobTagsConvert.Length); - } - IsSourceEncrypted = isSourceEncrypted; - if (cpkScopeInfo.Length <= DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength) - { - CpkScopeInfo = cpkScopeInfo; - CpkScopeInfoLength = (ushort) cpkScopeInfo.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(CpkScopeInfo), - expectedSize: DataMovementConstants.JobPartPlanFile.HeaderValueMaxLength, - actualSize: cpkScopeInfo.Length); - } - BlockSize = blockSize; - } - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanDestinationLocal.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanDestinationLocal.cs deleted file mode 100644 index e6f69bd3b7d94..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanDestinationLocal.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Storage.DataMovement.JobPlan -{ - /// - /// This matching the JobPartPlanDstLocal of azcopy - /// - internal class JobPartPlanDestinationLocal - { - // Once set, the following fields are constants; they should never be modified - - // Specifies whether the timestamp of destination file has to be set to the modified time of source file - public bool PreserveLastModifiedTime; - - // Says how checksum verification failures should be actioned - // TODO: Probably use an Enum once feature is implemented - public byte ChecksumVerificationOption; - - public JobPartPlanDestinationLocal( - bool preserveLastModifiedTime, - byte checksumVerificationOption) - { - PreserveLastModifiedTime = preserveLastModifiedTime; - ChecksumVerificationOption = checksumVerificationOption; - } - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanFileName.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanFileName.cs index adc057dc1681b..b0f6944afa378 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanFileName.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanFileName.cs @@ -12,18 +12,17 @@ namespace Azure.Storage.DataMovement.JobPlan /// Saved Job Part Plan File /// /// Format of the job part plan file name - /// {transferid}--{jobpartNumber}.steV{schemaVersion} + /// {transferid}.{jobpartNumber}.ndmpart /// e.g. will look like - /// 204b6e20-e642-fb40-4597-4a35ff5e199f--00001.steV17 + /// 204b6e20-e642-fb40-4597-4a35ff5e199f.00001.ndmpart /// where the following information would be /// transfer id: 204b6e20-e642-fb40-4597-4a35ff5e199f /// job part number: 00001 - /// version schema: 17 /// internal class JobPartPlanFileName { /// - /// Prefix path + /// Prefix path. /// public string PrefixPath { get; } @@ -40,12 +39,6 @@ internal class JobPartPlanFileName /// public int JobPartNumber { get; } - /// - /// Schema version of the job part plan file. As the schema can change we have - /// to keep track the version number. - /// - public string SchemaVersion { get; } - /// /// Full path of the file. /// @@ -59,14 +52,12 @@ protected JobPartPlanFileName() /// Creates Job Part Plan File Name /// /// Path to where all checkpointer files are stored. - /// - /// - /// + /// The transfer id. + /// The job part number. public JobPartPlanFileName( string checkpointerPath, string id, - int jobPartNumber, - string schemaVersion = DataMovementConstants.JobPartPlanFile.SchemaVersion) + int jobPartNumber) { Argument.AssertNotNullOrEmpty(checkpointerPath, nameof(checkpointerPath)); Argument.AssertNotNullOrEmpty(id, nameof(id)); @@ -74,9 +65,8 @@ public JobPartPlanFileName( PrefixPath = checkpointerPath; Id = id; JobPartNumber = jobPartNumber; - SchemaVersion = schemaVersion; - string fileName = $"{Id}--{JobPartNumber.ToString("D5", NumberFormatInfo.CurrentInfo)}{DataMovementConstants.JobPartPlanFile.FileExtension}{SchemaVersion}"; + string fileName = $"{Id}.{JobPartNumber.ToString("D5", NumberFormatInfo.CurrentInfo)}{DataMovementConstants.JobPartPlanFile.FileExtension}"; FullPath = Path.Combine(PrefixPath, fileName); } @@ -86,49 +76,40 @@ public JobPartPlanFileName(string fullPath) Argument.CheckNotNullOrEmpty(fullPath, nameof(fullPath)); PrefixPath = Path.GetDirectoryName(fullPath); - if (!Path.HasExtension(fullPath)) + if (!Path.HasExtension(fullPath) || + !Path.GetExtension(fullPath).Equals(DataMovementConstants.JobPartPlanFile.FileExtension)) { throw Errors.InvalidJobPartFileNameExtension(fullPath); } string fileName = Path.GetFileNameWithoutExtension(fullPath); - string extension = Path.GetExtension(fullPath); // Format of the job plan file name - // {transferid}--{jobpartNumber}.steV{schemaVersion} + // {transferid}.{jobpartNumber}.ndmpart + + string[] fileNameSplit = fileName.Split('.'); + if (fileNameSplit.Length != 2) + { + throw Errors.InvalidJobPartFileName(fullPath); + } // Check for valid Transfer Id - int endTransferIdIndex = fileName.IndexOf(DataMovementConstants.JobPartPlanFile.JobPlanFileNameDelimiter, StringComparison.InvariantCultureIgnoreCase); - if (endTransferIdIndex != DataMovementConstants.JobPartPlanFile.IdSize) + if (fileNameSplit[0].Length != DataMovementConstants.JobPartPlanFile.IdSize) { throw Errors.InvalidTransferIdFileName(fullPath); } - Id = fileName.Substring(0, endTransferIdIndex); + Id = fileNameSplit[0]; // Check for valid transfer part number - int partStartIndex = endTransferIdIndex + DataMovementConstants.JobPartPlanFile.JobPlanFileNameDelimiter.Length; - int endPartIndex = fileName.Length; - - if (endPartIndex - partStartIndex != DataMovementConstants.JobPartPlanFile.JobPartLength) + if (fileNameSplit[1].Length != DataMovementConstants.JobPartPlanFile.JobPartLength) { throw Errors.InvalidJobPartNumberFileName(fullPath); } - if (!int.TryParse( - fileName.Substring(partStartIndex, DataMovementConstants.JobPartPlanFile.JobPartLength), - NumberStyles.Number, - CultureInfo.InvariantCulture, - out int jobPartNumber)) + if (!int.TryParse(fileNameSplit[1], NumberStyles.Number, CultureInfo.InvariantCulture, out int jobPartNumber)) { throw Errors.InvalidJobPartNumberFileName(fullPath); } JobPartNumber = jobPartNumber; - string fullExtension = string.Concat(DataMovementConstants.JobPartPlanFile.FileExtension, DataMovementConstants.JobPartPlanFile.SchemaVersion); - if (!fullExtension.Equals(extension)) - { - throw Errors.InvalidSchemaVersionFileName(extension); - } - SchemaVersion = DataMovementConstants.JobPartPlanFile.SchemaVersion; - FullPath = fullPath; } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanHeader.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanHeader.cs index 20b7e7b7a8377..85b7db205362e 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanHeader.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanHeader.cs @@ -3,931 +3,311 @@ using System; using System.IO; +using System.Text; using Azure.Core; namespace Azure.Storage.DataMovement.JobPlan { - /// - /// Stores the Job Part Header information to resume from. - /// internal class JobPartPlanHeader { /// - /// The version of data schema format of header - /// This will seem weird because we will have a schema for how we store the data - /// when the schema changes this version will increment - /// - /// TODO: Consider changing to an int when GA comes. - /// TODO: In public preview we should - /// leave the version as "b1", instead of complete ints. + /// The schema version. /// public string Version; /// - /// The start time of the job part. - /// - public DateTimeOffset StartTime; - - /// - /// The Transfer/Job Id - /// - /// Size of a GUID. + /// The Transfer/Job Id. /// public string TransferId; /// - /// Job Part's part number (0+) + /// Job Part's part number (0+). /// public long PartNumber; /// - /// The length of the source resource identifier + /// The creation time of the job part. /// - public ushort SourceResourceIdLength; + public DateTimeOffset CreateTime; /// - /// The identifier of the source resource + /// A string identifier for the source resource. /// - public string SourceResourceId; + public string SourceTypeId; /// - /// The length of the source root path + /// A string identifier for the destination resource. /// - public ushort SourcePathLength; + public string DestinationTypeId; /// - /// The source path + /// The source path. /// public string SourcePath; /// - /// The length of the source path query - /// - public ushort SourceExtraQueryLength; - - /// - /// Extra query params applicable to the source - /// - public string SourceExtraQuery; - - /// - /// The length of the destination resource identifier - /// - public ushort DestinationResourceIdLength; - - /// - /// The identifier of the destination resource - /// - public string DestinationResourceId; - - /// - /// The length of the destination root path - /// - public ushort DestinationPathLength; - - /// - /// The destination path + /// The destination path. /// public string DestinationPath; /// - /// The length of the destination path query - /// - public ushort DestinationExtraQueryLength; - - /// - /// Extra query params applicable to the dest + /// Whether the destination should be overriden or not. /// - public string DestinationExtraQuery; + public bool Overwrite; /// - /// True if this is the Job's last part; else false + /// Ths intial transfer size for the transfer. /// - public bool IsFinalPart; + public long InitialTransferSize; /// - /// True if the existing blobs needs to be overwritten. + /// The chunk size to use for the transfer. /// - public bool ForceWrite; + public long ChunkSize; /// - /// Supplements ForceWrite with an additional setting for Azure Files. If true, the read-only attribute will be cleared before we overwrite - /// - public bool ForceIfReadOnly; - - /// - /// if true, source data with encodings that represent compression are automatically decompressed when downloading - /// - public bool AutoDecompress; - - /// - /// The Job Part's priority + /// The job part priority (future use). /// public byte Priority; /// - /// Time to live after completion is used to persists the file on disk of specified time after the completion of JobPartOrder - /// - public DateTimeOffset TTLAfterCompletion; - - /// - /// The location of the transfer's source and destination - /// - public JobPlanOperation JobPlanOperation; - - /// - /// option specifying how folders will be handled - /// - public FolderPropertiesMode FolderPropertyMode; - - /// - /// The number of transfers in the Job part - /// - public long NumberChunks; - - /// - /// Additional data for blob destinations - /// Holds the additional information about the blob - /// - public JobPartPlanDestinationBlob DstBlobData; - - /// - /// Additional data for local destinations - /// - public JobPartPlanDestinationLocal DstLocalData; - - /// - /// If applicable the SMB information - /// - public bool PreserveSMBPermissions; - - /// - /// Whether to preserve SMB info - /// - public bool PreserveSMBInfo; - - /// - /// S2SGetPropertiesInBackend represents whether to enable get S3 objects' or Azure files' properties during s2s copy in backend. - /// - public bool S2SGetPropertiesInBackend; - - /// - /// S2SSourceChangeValidation represents whether user wants to check if source has changed after enumerating. - /// - public bool S2SSourceChangeValidation; - - /// - /// DestLengthValidation represents whether the user wants to check if the destination has a different content-length - /// - public bool DestLengthValidation; - - /// - /// S2SInvalidMetadataHandleOption represents how user wants to handle invalid metadata. - /// - /// TODO: update to a struc tto handle the S2S Invalid metadata handle option - /// - public byte S2SInvalidMetadataHandleOption; - - /// - /// For delete operation specify what to do with snapshots + /// The current status of the job part. /// - public JobPartDeleteSnapshotsOption DeleteSnapshotsOption; + public DataTransferStatus JobPartStatus; - /// - /// Permanent Delete Option - /// - public JobPartPermanentDeleteOption PermanentDeleteOption; - - /// - /// Rehydrate Priority type - /// - public JobPartPlanRehydratePriorityType RehydratePriorityType; - - // Any fields below this comment are NOT constants; they may change over as the job part is processed. - // Care must be taken to read/write to these fields in a thread-safe way! - - // jobStatus_doNotUse represents the current status of JobPartPlan - // jobStatus_doNotUse is a private member whose value can be accessed by Status and SetJobStatus - // jobStatus_doNotUse should not be directly accessed anywhere except by the Status and SetJobStatus - public DataTransferStatus AtomicJobStatus; - - public DataTransferStatus AtomicPartStatus; - - internal JobPartPlanHeader( + public JobPartPlanHeader( string version, - DateTimeOffset startTime, string transferId, long partNumber, - string sourceResourceId, + DateTimeOffset createTime, + string sourceTypeId, + string destinationTypeId, string sourcePath, - string sourceExtraQuery, - string destinationResourceId, string destinationPath, - string destinationExtraQuery, - bool isFinalPart, - bool forceWrite, - bool forceIfReadOnly, - bool autoDecompress, + bool overwrite, + long initialTransferSize, + long chunkSize, byte priority, - DateTimeOffset ttlAfterCompletion, - JobPlanOperation jobPlanOperation, - FolderPropertiesMode folderPropertyMode, - long numberChunks, - JobPartPlanDestinationBlob dstBlobData, - JobPartPlanDestinationLocal dstLocalData, - bool preserveSMBPermissions, - bool preserveSMBInfo, - bool s2sGetPropertiesInBackend, - bool s2sSourceChangeValidation, - bool destLengthValidation, - byte s2sInvalidMetadataHandleOption, - JobPartDeleteSnapshotsOption deleteSnapshotsOption, - JobPartPermanentDeleteOption permanentDeleteOption, - JobPartPlanRehydratePriorityType rehydratePriorityType, - DataTransferStatus atomicJobStatus, - DataTransferStatus atomicPartStatus) + DataTransferStatus jobPartStatus) { - // Version String size verification Argument.AssertNotNullOrEmpty(version, nameof(version)); - Argument.AssertNotNull(startTime, nameof(startTime)); Argument.AssertNotNullOrEmpty(transferId, nameof(transferId)); + Argument.AssertNotNull(createTime, nameof(createTime)); + Argument.AssertNotNullOrEmpty(sourceTypeId, nameof(sourceTypeId)); + Argument.AssertNotNullOrWhiteSpace(destinationTypeId, nameof(destinationTypeId)); Argument.AssertNotNullOrEmpty(sourcePath, nameof(sourcePath)); Argument.AssertNotNullOrWhiteSpace(destinationPath, nameof(destinationPath)); - Argument.AssertNotNull(ttlAfterCompletion, nameof(ttlAfterCompletion)); - Argument.AssertNotNull(dstBlobData, nameof(dstBlobData)); - Argument.AssertNotNull(dstLocalData, nameof(dstLocalData)); - // Version - if (version.Length == DataMovementConstants.JobPartPlanFile.VersionStrLength) - { - Version = version; - } - else + Argument.AssertNotNull(jobPartStatus, nameof(jobPartStatus)); + + if (version.Length != DataMovementConstants.JobPartPlanFile.VersionStrLength) { - throw Errors.InvalidPlanFileElement( + throw Errors.InvalidPartHeaderElementLength( elementName: nameof(Version), expectedSize: DataMovementConstants.JobPartPlanFile.VersionStrLength, actualSize: version.Length); } - StartTime = startTime; - // TransferId - if (transferId.Length == DataMovementConstants.JobPartPlanFile.TransferIdStrLength) - { - TransferId = transferId; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(TransferId), - expectedSize: DataMovementConstants.JobPartPlanFile.TransferIdStrLength, - actualSize: transferId.Length); - } - PartNumber = partNumber; - // Source resource type - if (sourceResourceId.Length <= DataMovementConstants.JobPartPlanFile.ResourceIdMaxStrLength) - { - SourceResourceId = sourceResourceId; - SourceResourceIdLength = (ushort) sourceResourceId.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(sourceResourceId), - expectedSize: DataMovementConstants.JobPartPlanFile.ResourceIdMaxStrLength, - actualSize: sourceResourceId.Length); - } - // SourcePath - if (sourcePath.Length <= DataMovementConstants.JobPartPlanFile.PathStrMaxLength) - { - SourcePath = sourcePath; - SourcePathLength = (ushort) sourcePath.Length; - } - else + if (!Guid.TryParse(transferId, out Guid _)) { - throw Errors.InvalidPlanFileElement( - elementName: nameof(SourcePath), - expectedSize: DataMovementConstants.JobPartPlanFile.PathStrMaxLength, - actualSize: sourcePath.Length); + throw Errors.InvalidPartHeaderElement(nameof(transferId), transferId); } - // SourceQuery - if (sourceExtraQuery.Length <= DataMovementConstants.JobPartPlanFile.ExtraQueryMaxLength) + if (sourceTypeId.Length > DataMovementConstants.JobPartPlanFile.TypeIdMaxStrLength) { - SourceExtraQuery = sourceExtraQuery; - SourceExtraQueryLength = (ushort) sourceExtraQuery.Length; + throw Errors.InvalidPartHeaderElementLength( + elementName: nameof(sourceTypeId), + expectedSize: DataMovementConstants.JobPartPlanFile.TypeIdMaxStrLength, + actualSize: sourceTypeId.Length); } - else + if (destinationTypeId.Length > DataMovementConstants.JobPartPlanFile.TypeIdMaxStrLength) { - throw Errors.InvalidPlanFileElement( - elementName: nameof(SourceExtraQuery), - expectedSize: DataMovementConstants.JobPartPlanFile.ExtraQueryMaxLength, - actualSize: sourceExtraQuery.Length); + throw Errors.InvalidPartHeaderElementLength( + elementName: nameof(destinationTypeId), + expectedSize: DataMovementConstants.JobPartPlanFile.TypeIdMaxStrLength, + actualSize: destinationTypeId.Length); } - // Destination resource type - if (destinationResourceId.Length <= DataMovementConstants.JobPartPlanFile.ResourceIdMaxStrLength) - { - DestinationResourceId = destinationResourceId; - DestinationResourceIdLength = (ushort)destinationResourceId.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(destinationResourceId), - expectedSize: DataMovementConstants.JobPartPlanFile.ResourceIdMaxStrLength, - actualSize: destinationResourceId.Length); - } - // DestinationPath - if (destinationPath.Length <= DataMovementConstants.JobPartPlanFile.PathStrMaxLength) - { - DestinationPath = destinationPath; - DestinationPathLength = (ushort) destinationPath.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(DestinationPath), - expectedSize: DataMovementConstants.JobPartPlanFile.PathStrMaxLength, - actualSize: destinationPath.Length); - } - // DestinationQuery - if (destinationExtraQuery.Length <= DataMovementConstants.JobPartPlanFile.ExtraQueryMaxLength) - { - DestinationExtraQuery = destinationExtraQuery; - DestinationExtraQueryLength = (ushort) destinationExtraQuery.Length; - } - else - { - throw Errors.InvalidPlanFileElement( - elementName: nameof(DestinationExtraQuery), - expectedSize: DataMovementConstants.JobPartPlanFile.ExtraQueryMaxLength, - actualSize: destinationExtraQuery.Length); - } - IsFinalPart = isFinalPart; - ForceWrite = forceWrite; - ForceIfReadOnly = forceIfReadOnly; - AutoDecompress = autoDecompress; + + Version = version; + TransferId = transferId; + PartNumber = partNumber; + CreateTime = createTime; + SourceTypeId = sourceTypeId; + DestinationTypeId = destinationTypeId; + SourcePath = sourcePath; + DestinationPath = destinationPath; + Overwrite = overwrite; + InitialTransferSize = initialTransferSize; + ChunkSize = chunkSize; Priority = priority; - TTLAfterCompletion = ttlAfterCompletion; - JobPlanOperation = jobPlanOperation; - FolderPropertyMode = folderPropertyMode; - NumberChunks = numberChunks; - DstBlobData = dstBlobData; - DstLocalData = dstLocalData; - PreserveSMBPermissions = preserveSMBPermissions; - PreserveSMBInfo = preserveSMBInfo; - S2SGetPropertiesInBackend = s2sGetPropertiesInBackend; - S2SSourceChangeValidation = s2sSourceChangeValidation; - DestLengthValidation = destLengthValidation; - S2SInvalidMetadataHandleOption = s2sInvalidMetadataHandleOption; - DeleteSnapshotsOption = deleteSnapshotsOption; - PermanentDeleteOption = permanentDeleteOption; - RehydratePriorityType = rehydratePriorityType; - AtomicJobStatus = atomicJobStatus; - AtomicPartStatus = atomicPartStatus; + JobPartStatus = jobPartStatus; } - /// - /// Serializes the to the specified . - /// - /// The to which the serialized will be written. public void Serialize(Stream stream) { - if (stream is null) - { - throw new ArgumentNullException(nameof(stream)); - } - + Argument.AssertNotNull(stream, nameof(stream)); BinaryWriter writer = new BinaryWriter(stream); + int currentVariableLengthIndex = DataMovementConstants.JobPartPlanFile.VariableLengthStartIndex; // Version - WriteString(writer, Version, DataMovementConstants.JobPartPlanFile.VersionStrNumBytes); - - // StartTime - writer.Write(StartTime.Ticks); + writer.WritePaddedString(Version, DataMovementConstants.JobPartPlanFile.VersionStrNumBytes); - // TransferId - WriteString(writer, TransferId, DataMovementConstants.JobPartPlanFile.TransferIdStrNumBytes); + // TransferId (write as bytes) + Guid transferId = Guid.Parse(TransferId); + writer.Write(transferId.ToByteArray()); // PartNumber writer.Write(PartNumber); - // SourceResourceIdLength - writer.Write(SourceResourceIdLength); + // CreateTime + writer.Write(CreateTime.Ticks); - // SourceResourceId - WriteString(writer, SourceResourceId, DataMovementConstants.JobPartPlanFile.ResourceIdNumBytes); + // SourceTypeId + writer.WritePaddedString(SourceTypeId, DataMovementConstants.JobPartPlanFile.TypeIdNumBytes); - // SourcePathLength - writer.Write(SourcePathLength); + // DestinationTypeId + writer.WritePaddedString(DestinationTypeId, DataMovementConstants.JobPartPlanFile.TypeIdNumBytes); - // SourcePath - WriteString(writer, SourcePath, DataMovementConstants.JobPartPlanFile.PathStrNumBytes); - - // SourceExtraQueryLength - writer.Write(SourceExtraQueryLength); - - // SourceExtraQuery - WriteString(writer, SourceExtraQuery, DataMovementConstants.JobPartPlanFile.ExtraQueryNumBytes); - - // DestinationResourceIdLength - writer.Write(DestinationResourceIdLength); + // SourcePath offset/length + byte[] sourcePathBytes = Encoding.UTF8.GetBytes(SourcePath); + writer.WriteVariableLengthFieldInfo(sourcePathBytes.Length, ref currentVariableLengthIndex); - // DestinationResourceId - WriteString(writer, DestinationResourceId, DataMovementConstants.JobPartPlanFile.ResourceIdNumBytes); - - // DestinationPathLength - writer.Write(DestinationPathLength); - - // DestinationPath - WriteString(writer, DestinationPath, DataMovementConstants.JobPartPlanFile.PathStrNumBytes); + // DestinationPath offset/length + byte[] destinationPathBytes = Encoding.UTF8.GetBytes(DestinationPath); + writer.WriteVariableLengthFieldInfo(destinationPathBytes.Length, ref currentVariableLengthIndex); - // DestinationExtraQueryLength - writer.Write(DestinationExtraQueryLength); + // Overwrite + writer.Write(Overwrite); - // DestinationExtraQuery - WriteString(writer, DestinationExtraQuery, DataMovementConstants.JobPartPlanFile.ExtraQueryNumBytes); + // InitialTransferSize + writer.Write(InitialTransferSize); - // IsFinalPart - writer.Write(Convert.ToByte(IsFinalPart)); - - // ForceWrite - writer.Write(Convert.ToByte(ForceWrite)); - - // ForceIfReadOnly - writer.Write(Convert.ToByte(ForceIfReadOnly)); - - // AutoDecompress - writer.Write(Convert.ToByte(AutoDecompress)); + // ChunkSize + writer.Write(ChunkSize); // Priority writer.Write(Priority); - // TTLAfterCompletion - writer.Write(TTLAfterCompletion.Ticks); - - // FromTo - writer.Write((byte)JobPlanOperation); - - // FolderPropertyOption - writer.Write((byte)FolderPropertyMode); - - // NumberChunks - writer.Write(NumberChunks); - - // DstBlobData.BlobType - writer.Write((byte)DstBlobData.BlobType); - - // DstBlobData.NoGuessMimeType - writer.Write(Convert.ToByte(DstBlobData.NoGuessMimeType)); - - // DstBlobData.ContentTypeLength - writer.Write(DstBlobData.ContentTypeLength); - - // DstBlobData.ContentType - WriteString(writer, DstBlobData.ContentType, DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - - // DstBlobData.ContentEncodingLength - writer.Write(DstBlobData.ContentEncodingLength); - - // DstBlobData.ContentEncoding - WriteString(writer, DstBlobData.ContentEncoding, DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - - // DstBlobData.ContentLanguageLength - writer.Write(DstBlobData.ContentLanguageLength); - - // DstBlobData.ContentLanguage - WriteString(writer, DstBlobData.ContentLanguage, DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - - // DstBlobData.ContentDispositionLength - writer.Write(DstBlobData.ContentDispositionLength); - - // DstBlobData.ContentDisposition - WriteString(writer, DstBlobData.ContentDisposition, DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - - // DstBlobData.CacheControlLength - writer.Write(DstBlobData.CacheControlLength); - - // DstBlobData.CacheControl - WriteString(writer, DstBlobData.CacheControl, DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - - // DstBlobData.BlockBlobTier - writer.Write((byte)DstBlobData.BlockBlobTier); - - // DstBlobData.PageBlobTier - writer.Write((byte)DstBlobData.PageBlobTier); - - // DstBlobData.PutMd5 - writer.Write(Convert.ToByte(DstBlobData.PutMd5)); - - // DstBlobData.MetadataLength - writer.Write(DstBlobData.MetadataLength); - - // DstBlobData.Metadata - WriteString(writer, DstBlobData.Metadata, DataMovementConstants.JobPartPlanFile.MetadataStrNumBytes); - - // DstBlobData.BlobTagsLength - writer.Write(DstBlobData.BlobTagsLength); - - // DstBlobData.BlobTags - WriteString(writer, DstBlobData.BlobTags, DataMovementConstants.JobPartPlanFile.BlobTagsStrNumBytes); - - // DstBlobData.IsSourceEncrypted - writer.Write(DstBlobData.IsSourceEncrypted); - - // DstBlobData.CpkScopeInfoLength - writer.Write(DstBlobData.CpkScopeInfoLength); - - // DstBlobData.CpkScopeInfo - WriteString(writer, DstBlobData.CpkScopeInfo, DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - - // DstBlobData.BlockSize - writer.Write(DstBlobData.BlockSize); - - // DstLocalData.PreserveLastModifiedTime - writer.Write(Convert.ToByte(DstLocalData.PreserveLastModifiedTime)); + // JobPartStatus + writer.Write((int)JobPartStatus.ToJobPlanStatus()); - // DstLocalData.MD5VerificationOption - writer.Write(DstLocalData.ChecksumVerificationOption); - - // PreserveSMBPermissions - writer.Write(Convert.ToByte(PreserveSMBPermissions)); - - // PreserveSMBInfo - writer.Write(Convert.ToByte(PreserveSMBInfo)); - - // S2SGetPropertiesInBackend - writer.Write(Convert.ToByte(S2SGetPropertiesInBackend)); - - // S2SSourceChangeValidationBuffer - writer.Write(Convert.ToByte(S2SSourceChangeValidation)); - - // DestLengthValidation - writer.Write(Convert.ToByte(DestLengthValidation)); - - // S2SInvalidMetadataHandleOption - writer.Write(S2SInvalidMetadataHandleOption); - - // DeleteSnapshotsOption - writer.Write((byte)DeleteSnapshotsOption); - - // PermanentDeleteOption - writer.Write((byte)PermanentDeleteOption); - - // RehydratePriorityType - writer.Write((byte)RehydratePriorityType); - - // AtomicJobStatus.State - writer.Write((byte)AtomicJobStatus.State); - - // AtomicJobStatus.HasFailedItems - writer.Write(Convert.ToByte(AtomicJobStatus.HasFailedItems)); - - // AtomicJobStatus.HasSkippedItems - writer.Write(Convert.ToByte(AtomicJobStatus.HasSkippedItems)); - - // AtomicPartStatus.State - writer.Write((byte)AtomicPartStatus.State); - - // AtomicPartStatus.HasFailedItems - writer.Write(Convert.ToByte(AtomicPartStatus.HasFailedItems)); + // SourcePath + writer.Write(sourcePathBytes); - // AtomicPartStatus.HasSkippedItems - writer.Write(Convert.ToByte(AtomicPartStatus.HasSkippedItems)); + // DestinationPath + writer.Write(destinationPathBytes); } public static JobPartPlanHeader Deserialize(Stream stream) { - if (stream is null) - { - throw new ArgumentNullException(nameof(stream)); - } - + Argument.AssertNotNull(stream, nameof(stream)); BinaryReader reader = new BinaryReader(stream); reader.BaseStream.Position = 0; // Version - byte[] versionBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.VersionStrNumBytes); - string version = versionBuffer.ToString(DataMovementConstants.JobPartPlanFile.VersionStrLength); + string version = reader.ReadPaddedString(DataMovementConstants.JobPartPlanFile.VersionStrNumBytes); // Assert the schema version before continuing CheckSchemaVersion(version); - // Start Time - byte[] startTimeBuffer = reader.ReadBytes(DataMovementConstants.LongSizeInBytes); - DateTimeOffset startTime = new DateTimeOffset(startTimeBuffer.ToLong(), new TimeSpan(0, 0, 0)); - - // Transfer Id - byte[] transferIdBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.TransferIdStrNumBytes); - string transferId = transferIdBuffer.ToString(DataMovementConstants.JobPartPlanFile.TransferIdStrLength); + // TransferId + byte[] transferIdBuffer = reader.ReadBytes(DataMovementConstants.GuidSizeInBytes); + string transferId = new Guid(transferIdBuffer).ToString(); - // Job Part Number + // PartNumber byte[] partNumberBuffer = reader.ReadBytes(DataMovementConstants.LongSizeInBytes); long partNumber = partNumberBuffer.ToLong(); - // SourceResourceIdLength - byte[] sourceResourceIdLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort sourceResourceIdLength = sourceResourceIdLengthBuffer.ToUShort(); + // CreateTime + long createTimeTicks = reader.ReadInt64(); + DateTimeOffset createTime = new DateTimeOffset(createTimeTicks, new TimeSpan(0, 0, 0)); - // SourceResourceId - byte[] sourceResourceIdBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.ResourceIdNumBytes); - string sourceResourceId = sourceResourceIdBuffer.ToString(sourceResourceIdLength); + // SourceTypeId + string sourceTypeId = reader.ReadPaddedString(DataMovementConstants.JobPartPlanFile.TypeIdNumBytes); - // SourcePathLength - byte[] sourcePathLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort sourcePathLength = sourcePathLengthBuffer.ToUShort(); + // DestinationTypeId + string destinationTypeId = reader.ReadPaddedString(DataMovementConstants.JobPartPlanFile.TypeIdNumBytes); - // SourcePath - byte[] sourcePathBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.PathStrNumBytes); - string sourcePath = sourcePathBuffer.ToString(sourcePathLength); - - // SourceExtraQueryLength - byte[] sourceExtraQueryLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort sourceExtraQueryLength = sourceExtraQueryLengthBuffer.ToUShort(); - - // SourceExtraQuery - byte[] sourceExtraQueryBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.ExtraQueryNumBytes); - string sourceExtraQuery = sourceExtraQueryBuffer.ToString(sourceExtraQueryLength); - - // DestinationResourceIdLength - byte[] destinationResourceIdLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort destinationResourceIdLength = destinationResourceIdLengthBuffer.ToUShort(); + // SourcePath offset/length + int sourcePathOffset = reader.ReadInt32(); + int sourcePathLength = reader.ReadInt32(); - // DestinationResourceId - byte[] destinationResourceIdBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.ResourceIdNumBytes); - string destinationResourceId = destinationResourceIdBuffer.ToString(destinationResourceIdLength); - - // DestinationPathLength - byte[] destinationPathLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort destinationPathLength = destinationPathLengthBuffer.ToUShort(); - - // DestinationPath - byte[] destinationPathBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.PathStrNumBytes); - string destinationPath = destinationPathBuffer.ToString(destinationPathLength); + // DestinationPath offset/length + int destinationPathOffset = reader.ReadInt32(); + int destinationPathLength = reader.ReadInt32(); - // DestinationExtraQueryLength - byte[] destinationExtraQueryLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort destinationExtraQueryLength = destinationExtraQueryLengthBuffer.ToUShort(); + // Overwrite + byte overwriteByte = reader.ReadByte(); + bool overwrite = Convert.ToBoolean(overwriteByte); - // DestinationExtraQuery - byte[] destinationExtraQueryBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.ExtraQueryNumBytes); - string destinationExtraQuery = destinationExtraQueryBuffer.ToString(destinationExtraQueryLength); + // InitialTransferSize + long initialTransferSize = reader.ReadInt64(); - // IsFinalPart - byte isFinalPartByte = reader.ReadByte(); - bool isFinalPart = Convert.ToBoolean(isFinalPartByte); - - // ForceWrite - byte forceWriteByte = reader.ReadByte(); - bool forceWrite = Convert.ToBoolean(forceWriteByte); - - // ForceIfReadOnly - byte forceIfReadOnlyByte = reader.ReadByte(); - bool forceIfReadOnly = Convert.ToBoolean(forceIfReadOnlyByte); - - // AutoDecompress - byte autoDecompressByte = reader.ReadByte(); - bool autoDecompress = Convert.ToBoolean(autoDecompressByte); + // ChunkSize + long chunkSize = reader.ReadInt64(); // Priority byte priority = reader.ReadByte(); - // TTLAfterCompletion - byte[] ttlAfterCompletionBuffer = reader.ReadBytes(DataMovementConstants.LongSizeInBytes); - DateTimeOffset ttlAfterCompletion = new DateTimeOffset(ttlAfterCompletionBuffer.ToLong(), new TimeSpan(0, 0, 0)); - - // JobPlanOperation - byte fromToByte = reader.ReadByte(); - JobPlanOperation fromTo = (JobPlanOperation)fromToByte; - - // FolderPropertyOption - byte folderPropertyOptionByte = reader.ReadByte(); - FolderPropertiesMode folderPropertyMode = (FolderPropertiesMode)folderPropertyOptionByte; - - // NumberChunks - byte[] numberChunksBuffer = reader.ReadBytes(DataMovementConstants.LongSizeInBytes); - long numberChunks = numberChunksBuffer.ToLong(); - - // DstBlobData.BlobType - byte blobTypeByte = reader.ReadByte(); - JobPlanBlobType blobType = (JobPlanBlobType)blobTypeByte; - - // DstBlobData.NoGuessMimeType - byte noGuessMimeTypeByte = reader.ReadByte(); - bool noGuessMimeType = Convert.ToBoolean(noGuessMimeTypeByte); - - // DstBlobData.ContentTypeLength - byte[] contentTypeLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort contentTypeLength = contentTypeLengthBuffer.ToUShort(); - - // DstBlobData.ContentType - byte[] contentTypeBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - string contentType = contentTypeBuffer.ToString(contentTypeLength); - - // DstBlobData.ContentEncodingLength - byte[] contentEncodingLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort contentEncodingLength = contentEncodingLengthBuffer.ToUShort(); - - // DstBlobData.ContentEncoding - byte[] contentEncodingBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - string contentEncoding = contentEncodingBuffer.ToString(contentEncodingLength); - - // DstBlobData.ContentLanguageLength - byte[] contentLanguageLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort contentLanguageLength = contentLanguageLengthBuffer.ToUShort(); - - // DstBlobData.ContentLanguage - byte[] contentLanguageBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - string contentLanguage = contentLanguageBuffer.ToString(contentLanguageLength); - - // DstBlobData.ContentDispositionLength - byte[] contentDispositionLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort contentDispositionLength = contentDispositionLengthBuffer.ToUShort(); - - // DstBlobData.ContentDisposition - byte[] contentDispositionBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - string contentDisposition = contentDispositionBuffer.ToString(contentDispositionLength); - - // DstBlobData.CacheControlLength - byte[] cacheControlLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort cacheControlLength = cacheControlLengthBuffer.ToUShort(); - - // DstBlobData.CacheControl - byte[] cacheControlBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - string cacheControl = cacheControlBuffer.ToString(cacheControlLength); - - // DstBlobData.BlockBlobTier - byte blockBlobTierByte = reader.ReadByte(); - JobPartPlanBlockBlobTier blockBlobTier = (JobPartPlanBlockBlobTier)blockBlobTierByte; - - // DstBlobData.PageBlobTier - byte pageBlobTierByte = reader.ReadByte(); - JobPartPlanPageBlobTier pageBlobTier = (JobPartPlanPageBlobTier)pageBlobTierByte; - - // DstBlobData.PutMd5 - byte putMd5Byte = reader.ReadByte(); - bool putMd5 = Convert.ToBoolean(putMd5Byte); - - // DstBlobData.MetadataLength - byte[] metadataLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort metadataLength = metadataLengthBuffer.ToUShort(); - - // DstBlobData.Metadata - byte[] metadataBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.MetadataStrNumBytes); - string metadata = metadataBuffer.ToString(metadataLength); - - // DstBlobData.BlobTagsLength - byte[] blobTagsLengthBuffer = reader.ReadBytes(DataMovementConstants.LongSizeInBytes); - long blobTagsLength = blobTagsLengthBuffer.ToLong(); - - // DstBlobData.BlobTags - byte[] blobTagsBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.BlobTagsStrNumBytes); - string blobTags = blobTagsBuffer.ToString(blobTagsLength); - - // DstBlobData.IsSourceEncrypted - bool isSourceEncrypted = Convert.ToBoolean(reader.ReadByte()); - - // DstBlobData.CpkScopeInfoLength - byte[] cpkScopeInfoLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort cpkScopeInfoLength = cpkScopeInfoLengthBuffer.ToUShort(); - - // DstBlobData.CpkScopeInfo - byte[] cpkScopeInfoBuffer = reader.ReadBytes(DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes); - string cpkScopeInfo = cpkScopeInfoBuffer.ToString(cpkScopeInfoLength); - - // DstBlobData.BlockSize - byte[] blockSizeLengthBuffer = reader.ReadBytes(DataMovementConstants.LongSizeInBytes); - long blockSize = blockSizeLengthBuffer.ToLong(); + // JobPartStatus + JobPlanStatus jobPlanStatus = (JobPlanStatus)reader.ReadInt32(); + DataTransferStatus jobPartStatus = jobPlanStatus.ToDataTransferStatus(); - // DstLocalData.PreserveLastModifiedTime - bool preserveLastModifiedTime = Convert.ToBoolean(reader.ReadByte()); - - // DstBlobData.MD5VerificationOption - byte checksumVerificationOption = reader.ReadByte(); - - // preserveSMBPermissions - bool preserveSMBPermissions = Convert.ToBoolean(reader.ReadByte()); - - // PreserveSMBInfo - bool preserveSMBInfo = Convert.ToBoolean(reader.ReadByte()); - - // S2SGetPropertiesInBackend - bool s2sGetPropertiesInBackend = Convert.ToBoolean(reader.ReadByte()); - - // S2SSourceChangeValidation - bool s2sSourceChangeValidation = Convert.ToBoolean(reader.ReadByte()); - - // DestLengthValidation - bool destLengthValidation = Convert.ToBoolean(reader.ReadByte()); - - // S2SInvalidMetadataHandleOption - byte s2sInvalidMetadataHandleOption = reader.ReadByte(); - - // DeleteSnapshotsOption - byte deleteSnapshotsOptionByte = reader.ReadByte(); - JobPartDeleteSnapshotsOption deleteSnapshotsOption = (JobPartDeleteSnapshotsOption)deleteSnapshotsOptionByte; - - // PermanentDeleteOption - byte permanentDeleteOptionByte = reader.ReadByte(); - JobPartPermanentDeleteOption permanentDeleteOption = (JobPartPermanentDeleteOption)permanentDeleteOptionByte; - - // RehydratePriorityType - byte rehydratePriorityTypeByte = reader.ReadByte(); - JobPartPlanRehydratePriorityType rehydratePriorityType = (JobPartPlanRehydratePriorityType)rehydratePriorityTypeByte; - - // AtomicJobStatus.State - byte atomicJobStatusByte = reader.ReadByte(); - DataTransferState jobStatusState = (DataTransferState)atomicJobStatusByte; - - // AtomicJobStatus.HasFailedItems - bool jobStatusHasFailed = Convert.ToBoolean(reader.ReadByte()); - - // AtomicJobStatus.HasSkippedItems - bool jobStatusHasSkipped = Convert.ToBoolean(reader.ReadByte()); - - // AtomicPartStatus.State - byte atomicPartStatusByte = reader.ReadByte(); - DataTransferState partStatusState = (DataTransferState)atomicPartStatusByte; - - // AtomicPartStatus.HasFailedItems - bool partStatusHasFailed = Convert.ToBoolean(reader.ReadByte()); - - // AtomicPartStatus.HasSkippedItems - bool partStatusHasSkipped = Convert.ToBoolean(reader.ReadByte()); - - DataTransferStatus atomicJobStatus = new DataTransferStatus( - jobStatusState, - jobStatusHasFailed, - jobStatusHasSkipped); - - DataTransferStatus atomicPartStatus = new DataTransferStatus( - partStatusState, - partStatusHasFailed, - partStatusHasSkipped); - - JobPartPlanDestinationBlob dstBlobData = new JobPartPlanDestinationBlob( - blobType: blobType, - noGuessMimeType: noGuessMimeType, - contentType: contentType, - contentEncoding: contentEncoding, - contentLanguage: contentLanguage, - contentDisposition: contentDisposition, - cacheControl: cacheControl, - blockBlobTier: blockBlobTier, - pageBlobTier: pageBlobTier, - putMd5: putMd5, - metadata: metadata, - blobTags: blobTags, - isSourceEncrypted: isSourceEncrypted, - cpkScopeInfo: cpkScopeInfo, - blockSize: blockSize); + // SourcePath + string sourcePath = null; + if (sourcePathOffset > 0) + { + reader.BaseStream.Position = sourcePathOffset; + byte[] parentSourcePathBytes = reader.ReadBytes(sourcePathLength); + sourcePath = parentSourcePathBytes.ToString(sourcePathLength); + } - JobPartPlanDestinationLocal dstLocalData = new JobPartPlanDestinationLocal( - preserveLastModifiedTime: preserveLastModifiedTime, - checksumVerificationOption: checksumVerificationOption); + // DestinationPath + string destinationPath = null; + if (destinationPathOffset > 0) + { + reader.BaseStream.Position = destinationPathOffset; + byte[] parentSourcePathBytes = reader.ReadBytes(destinationPathLength); + destinationPath = parentSourcePathBytes.ToString(destinationPathLength); + } return new JobPartPlanHeader( - version: version, - startTime: startTime, - transferId: transferId, - partNumber: partNumber, - sourceResourceId: sourceResourceId, - sourcePath: sourcePath, - sourceExtraQuery: sourceExtraQuery, - destinationResourceId: destinationResourceId, - destinationPath: destinationPath, - destinationExtraQuery: destinationExtraQuery, - isFinalPart: isFinalPart, - forceWrite: forceWrite, - forceIfReadOnly: forceIfReadOnly, - autoDecompress: autoDecompress, - priority: priority, - ttlAfterCompletion: ttlAfterCompletion, - jobPlanOperation: fromTo, - folderPropertyMode: folderPropertyMode, - numberChunks: numberChunks, - dstBlobData: dstBlobData, - dstLocalData: dstLocalData, - preserveSMBPermissions: preserveSMBPermissions, - preserveSMBInfo: preserveSMBInfo, - s2sGetPropertiesInBackend: s2sGetPropertiesInBackend, - s2sSourceChangeValidation: s2sSourceChangeValidation, - destLengthValidation: destLengthValidation, - s2sInvalidMetadataHandleOption: s2sInvalidMetadataHandleOption, - deleteSnapshotsOption: deleteSnapshotsOption, - permanentDeleteOption: permanentDeleteOption, - rehydratePriorityType: rehydratePriorityType, - atomicJobStatus: atomicJobStatus, - atomicPartStatus: atomicPartStatus); + version, + transferId, + partNumber, + createTime, + sourceTypeId, + destinationTypeId, + sourcePath, + destinationPath, + overwrite, + initialTransferSize, + chunkSize, + priority, + jobPartStatus); } - private static void WriteString(BinaryWriter writer, string value, int setSizeInBytes) + /// + /// Internal equals for testing. + /// + internal bool Equals(JobPartPlanHeader other) { - writer.Write(value.ToCharArray()); - - int padding = setSizeInBytes - value.Length; - if (padding > 0) + if (other is null) { - char[] paddingArray = new char[padding]; - writer.Write(paddingArray); + return false; } + + return + (Version == other.Version) && + (TransferId == other.TransferId) && + (PartNumber == other.PartNumber) && + (CreateTime == other.CreateTime) && + (SourceTypeId == other.SourceTypeId) && + (DestinationTypeId == other.DestinationTypeId) && + (SourcePath == other.SourcePath) && + (DestinationPath == other.DestinationPath) && + (Overwrite == other.Overwrite) && + (InitialTransferSize == other.InitialTransferSize) && + (ChunkSize == other.ChunkSize) && + (Priority == other.Priority) && + (JobPartStatus == other.JobPartStatus); } private static void CheckSchemaVersion(string version) diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanPageBlobTier.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanPageBlobTier.cs deleted file mode 100644 index bf5c7b3ae7528..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanPageBlobTier.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Storage.DataMovement.JobPlan -{ - internal enum JobPartPlanPageBlobTier - { - /// None. - None = 0, - /// P4. - P4 = 4, - /// P6. - P6 = 6, - /// P10. - P10 = 10, - /// P15. - P15 = 15, - /// P20. - P20 = 20, - /// P30. - P30 = 30, - /// P40. - P40 = 40, - /// P50. - P50 = 50, - /// P60. - P60 = 60, - /// P70. - P70 = 70, - /// P80. - P80 = 80, - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanRehydratePriorityType.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanRehydratePriorityType.cs deleted file mode 100644 index 755b161b4f0cf..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPartPlanRehydratePriorityType.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Storage.DataMovement.JobPlan -{ - internal enum JobPartPlanRehydratePriorityType - { - None = 0, - Standard = 1, - High = 2 - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanBlobType.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanBlobType.cs deleted file mode 100644 index 65707dd02931f..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanBlobType.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Storage.DataMovement.JobPlan -{ - internal enum JobPlanBlobType - { - /// - /// Detect blob type - /// - Detect = 0, - /// - /// Block Blob - /// - BlockBlob = 1, - /// - /// Page Blob - /// - PageBlob = 2, - /// - /// Append Blob - /// - AppendBlob = 3, - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanFile.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanFile.cs index 7427946b1df00..fe3e406e919bb 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanFile.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanFile.cs @@ -50,7 +50,7 @@ public static async Task CreateJobPlanFileAsync( Argument.AssertNotNullOrEmpty(id, nameof(id)); Argument.AssertNotNull(headerStream, nameof(headerStream)); - string fileName = $"{id}.{DataMovementConstants.JobPlanFile.FileExtension}"; + string fileName = $"{id}{DataMovementConstants.JobPlanFile.FileExtension}"; string filePath = Path.Combine(checkpointerPath, fileName); JobPlanFile jobPlanFile = new(id, filePath); diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanHeader.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanHeader.cs index 5d1615ccdc809..95704de261b57 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanHeader.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/JobPlan/JobPlanHeader.cs @@ -99,6 +99,7 @@ public JobPlanHeader( Argument.AssertNotNullOrEmpty(transferId, nameof(transferId)); Argument.AssertNotNullOrEmpty(sourceProviderId, nameof(sourceProviderId)); Argument.AssertNotNullOrEmpty(destinationProviderId, nameof(destinationProviderId)); + Argument.AssertNotNull(jobStatus, nameof(jobStatus)); Argument.AssertNotNull(createTime, nameof(createTime)); Argument.AssertNotNullOrEmpty(parentSourcePath, nameof(parentSourcePath)); Argument.AssertNotNullOrEmpty(parentDestinationPath, nameof(parentDestinationPath)); @@ -168,7 +169,7 @@ public void Serialize(Stream stream) BinaryWriter writer = new BinaryWriter(stream); // Version - WritePaddedString(writer, Version, DataMovementConstants.JobPlanFile.VersionStrNumBytes); + writer.WritePaddedString(Version, DataMovementConstants.JobPlanFile.VersionStrNumBytes); // TransferId (write as bytes) Guid transferId = Guid.Parse(TransferId); @@ -181,10 +182,10 @@ public void Serialize(Stream stream) writer.Write((byte)OperationType); // SourceProviderId - WritePaddedString(writer, SourceProviderId, DataMovementConstants.JobPlanFile.ProviderIdNumBytes); + writer.WritePaddedString(SourceProviderId, DataMovementConstants.JobPlanFile.ProviderIdNumBytes); // DestinationProviderId - WritePaddedString(writer, DestinationProviderId, DataMovementConstants.JobPlanFile.ProviderIdNumBytes); + writer.WritePaddedString(DestinationProviderId, DataMovementConstants.JobPlanFile.ProviderIdNumBytes); // IsContainer writer.Write(Convert.ToByte(IsContainer)); @@ -246,10 +247,10 @@ public static JobPlanHeader Deserialize(Stream stream) JobPlanOperation operationType = (JobPlanOperation)operationTypeByte; // SourceProviderId - string sourceProviderId = ReadPaddedString(reader, DataMovementConstants.JobPlanFile.ProviderIdNumBytes); + string sourceProviderId = reader.ReadPaddedString(DataMovementConstants.JobPlanFile.ProviderIdNumBytes); // DestinationProviderId - string destProviderId = ReadPaddedString(reader, DataMovementConstants.JobPlanFile.ProviderIdNumBytes); + string destProviderId = reader.ReadPaddedString(DataMovementConstants.JobPlanFile.ProviderIdNumBytes); // IsContainer byte isContainerByte = reader.ReadByte(); @@ -328,25 +329,6 @@ public static JobPlanHeader Deserialize(Stream stream) destinationCheckpointData); } - private static void WritePaddedString(BinaryWriter writer, string value, int setSizeInBytes) - { - byte[] valueBytes = Encoding.UTF8.GetBytes(value); - writer.Write(valueBytes); - - int padding = setSizeInBytes - valueBytes.Length; - if (padding > 0) - { - char[] paddingArray = new char[padding]; - writer.Write(paddingArray); - } - } - - private static string ReadPaddedString(BinaryReader reader, int numBytes) - { - byte[] stringBytes = reader.ReadBytes(numBytes); - return stringBytes.ToString(numBytes).TrimEnd('\0'); - } - private static void CheckSchemaVersion(string version) { if (version != DataMovementConstants.JobPlanFile.SchemaVersion) diff --git a/sdk/storage/Azure.Storage.DataMovement/src/JobPlanExtensions.cs b/sdk/storage/Azure.Storage.DataMovement/src/JobPlanExtensions.cs index d8368553b2ab2..95953487fefc8 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/JobPlanExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/JobPlanExtensions.cs @@ -3,7 +3,6 @@ using System; using System.IO; -using System.IO.MemoryMappedFiles; using System.Threading; using System.Threading.Tasks; using Azure.Storage.DataMovement.JobPlan; @@ -12,52 +11,6 @@ namespace Azure.Storage.DataMovement { internal static partial class JobPlanExtensions { - internal static JobPartPlanHeader GetJobPartPlanHeader(this JobPartPlanFileName fileName) - { - JobPartPlanHeader result; - int bufferSize = DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes; - - using MemoryMappedFile memoryMappedFile = MemoryMappedFile.CreateFromFile(fileName.ToString()); - using (MemoryMappedViewStream stream = memoryMappedFile.CreateViewStream(0, bufferSize, MemoryMappedFileAccess.Read)) - { - if (!stream.CanRead) - { - throw Errors.CannotReadMmfStream(fileName.ToString()); - } - result = JobPartPlanHeader.Deserialize(stream); - } - return result; - } - - internal static async Task GetHeaderUShortValue( - this TransferCheckpointer checkpointer, - string transferId, - int startIndex, - int streamReadLength, - int valueLength, - CancellationToken cancellationToken) - { - string value; - using (Stream stream = await checkpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 0, - offset: startIndex, - length: streamReadLength, - cancellationToken: cancellationToken).ConfigureAwait(false)) - { - BinaryReader reader = new BinaryReader(stream); - - // Read Path Length - byte[] pathLengthBuffer = reader.ReadBytes(DataMovementConstants.UShortSizeInBytes); - ushort pathLength = pathLengthBuffer.ToUShort(); - - // Read Path - byte[] pathBuffer = reader.ReadBytes(valueLength); - value = pathBuffer.ToString(pathLength); - } - return value; - } - internal static async Task GetHeaderLongValue( this TransferCheckpointer checkpointer, string transferId, diff --git a/sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs index 8b0383e1f820d..28c67ffee4a74 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/LocalDirectoryStorageResourceContainer.cs @@ -6,6 +6,7 @@ using System.IO; using System.Runtime.CompilerServices; using System.Threading; +using System.Threading.Tasks; using Azure.Core; namespace Azure.Storage.DataMovement @@ -72,9 +73,17 @@ protected internal override async IAsyncEnumerable GetStorageRe PathScanner scanner = new PathScanner(_uri.LocalPath); foreach (FileSystemInfo fileSystemInfo in scanner.Scan(false)) { - // Skip over directories for now since directory creation is unnecessary. - if (!fileSystemInfo.Attributes.HasFlag(FileAttributes.Directory)) + if (fileSystemInfo.Attributes.HasFlag(FileAttributes.Directory)) { + // Directory - but check for the case where it returns the directory you're currently listing + if (fileSystemInfo.FullName != _uri.LocalPath) + { + yield return new LocalDirectoryStorageResourceContainer(fileSystemInfo.FullName); + } + } + else + { + // File yield return new LocalFileStorageResource(fileSystemInfo.FullName); } } @@ -89,5 +98,15 @@ protected internal override StorageResourceCheckpointData GetDestinationCheckpoi { return new LocalDestinationCheckpointData(); } + + protected internal override Task CreateIfNotExistsAsync(CancellationToken cancellationToken = default) + => Task.CompletedTask; + + protected internal override StorageResourceContainer GetChildStorageResourceContainer(string path) + { + UriBuilder uri = new UriBuilder(_uri); + uri.Path = Path.Combine(uri.Path, path); + return new LocalDirectoryStorageResourceContainer(uri.Uri); + } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/LocalTransferCheckpointer.cs b/sdk/storage/Azure.Storage.DataMovement/src/LocalTransferCheckpointer.cs index b36b131725f67..0b87991b39d8f 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/LocalTransferCheckpointer.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/LocalTransferCheckpointer.cs @@ -61,6 +61,10 @@ public override async Task AddNewJobAsync( StorageResource destination, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(transferId, nameof(transferId)); + Argument.AssertNotNull(source, nameof(source)); + Argument.AssertNotNull(destination, nameof(destination)); + if (_transferStates.ContainsKey(transferId)) { throw Errors.CollisionTransferIdCheckpointer(transferId); @@ -97,13 +101,11 @@ public override async Task AddNewJobAsync( public override async Task AddNewJobPartAsync( string transferId, int partNumber, - int chunksTotal, Stream headerStream, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(transferId, nameof(transferId)); Argument.AssertNotNull(partNumber, nameof(partNumber)); - Argument.AssertNotNull(chunksTotal, nameof(chunksTotal)); Argument.AssertNotNull(headerStream, nameof(headerStream)); headerStream.Position = 0; @@ -328,8 +330,8 @@ public override async Task SetJobPartTransferStatusAsync( DataTransferStatus status, CancellationToken cancellationToken = default) { - long length = DataMovementConstants.OneByte * 3; - int offset = DataMovementConstants.JobPartPlanFile.AtomicPartStatusStateIndex; + long length = DataMovementConstants.IntSizeInBytes; + int offset = DataMovementConstants.JobPartPlanFile.JobPartStatusIndex; CancellationHelper.ThrowIfCancellationRequested(cancellationToken); @@ -340,27 +342,13 @@ public override async Task SetJobPartTransferStatusAsync( // Lock MMF await file.WriteLock.WaitAsync(cancellationToken).ConfigureAwait(false); - using (MemoryMappedFile mmf = MemoryMappedFile.CreateFromFile( - path: file.FilePath, - mode: FileMode.Open, - mapName: null, - capacity: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) + using (MemoryMappedFile mmf = MemoryMappedFile.CreateFromFile(file.FilePath, FileMode.Open)) + using (MemoryMappedViewAccessor accessor = mmf.CreateViewAccessor(offset, length)) { - using (MemoryMappedViewAccessor accessor = mmf.CreateViewAccessor(offset, length)) - { - accessor.Write( - position: 0, - value: (byte)status.State); - accessor.Write( - position: 1, - value: status.HasFailedItems); - accessor.Write( - position: 2, - value: status.HasSkippedItems); - // to flush to the underlying file that supports the mmf - accessor.Flush(); - } + accessor.Write(0, (int)status.ToJobPlanStatus()); + accessor.Flush(); } + // Release MMF file.WriteLock.Release(); } @@ -381,11 +369,12 @@ public override async Task SetJobPartTransferStatusAsync( /// private void InitializeExistingCheckpointer() { + // Enumerate the filesystem + IEnumerable checkpointFiles = Directory.EnumerateFiles(_pathToCheckpointer); + // First, retrieve all valid job plan files - foreach (string path in Directory.EnumerateFiles( - _pathToCheckpointer, - $"*.{DataMovementConstants.JobPlanFile.FileExtension}", - SearchOption.TopDirectoryOnly)) + foreach (string path in checkpointFiles + .Where(p => Path.GetExtension(p) == DataMovementConstants.JobPlanFile.FileExtension)) { // TODO: Should we check for valid schema version inside file now? JobPlanFile jobPlanFile = JobPlanFile.LoadExistingJobPlanFile(path); @@ -400,10 +389,8 @@ private void InitializeExistingCheckpointer() } // Retrieve all valid job part plan files stored in the checkpointer path. - foreach (string path in Directory.EnumerateFiles(_pathToCheckpointer, "*", SearchOption.TopDirectoryOnly) - .Where(f => Path.HasExtension(string.Concat( - DataMovementConstants.JobPartPlanFile.FileExtension, - DataMovementConstants.JobPartPlanFile.SchemaVersion)))) + foreach (string path in checkpointFiles + .Where(p => Path.GetExtension(p) == DataMovementConstants.JobPartPlanFile.FileExtension)) { // Ensure each file has the correct format if (JobPartPlanFileName.TryParseJobPartPlanFileName(path, out JobPartPlanFileName partPlanFileName)) diff --git a/sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceJobPart.cs b/sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceJobPart.cs index 68411abee85f0..454fdc7702608 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceJobPart.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceJobPart.cs @@ -89,7 +89,7 @@ public static async Task CreateJobPartAsync( { // Create Job Part file as we're initializing the job part ServiceToServiceJobPart part = new ServiceToServiceJobPart(job, partNumber); - await part.AddJobPartToCheckpointerAsync(1).ConfigureAwait(false); // For now we only store 1 chunk + await part.AddJobPartToCheckpointerAsync().ConfigureAwait(false); return part; } @@ -112,7 +112,7 @@ public static async Task CreateJobPartAsync( length: length); if (!partPlanFileExists) { - await part.AddJobPartToCheckpointerAsync(1).ConfigureAwait(false); // For now we only store 1 chunk + await part.AddJobPartToCheckpointerAsync().ConfigureAwait(false); } return part; } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceTransferJob.cs b/sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceTransferJob.cs index 5e8926f3fa63b..733a1179880e4 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceTransferJob.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/ServiceToServiceTransferJob.cs @@ -171,31 +171,46 @@ private async IAsyncEnumerable GetStorageResourcesAsync() } StorageResource current = enumerator.Current; - if (!existingSources.Contains(current.Uri)) + + if (current.IsContainer) { + // Create sub-container string containerUriPath = _sourceResourceContainer.Uri.GetPath(); - string sourceName = string.IsNullOrEmpty(containerUriPath) + string subContainerPath = string.IsNullOrEmpty(containerUriPath) ? current.Uri.GetPath() : current.Uri.GetPath().Substring(containerUriPath.Length + 1); - - ServiceToServiceJobPart part; - try - { - part = await ServiceToServiceJobPart.CreateJobPartAsync( - job: this, - partNumber: partNumber, - sourceResource: (StorageResourceItem)current, - destinationResource: _destinationResourceContainer.GetStorageResourceReference(sourceName)) - .ConfigureAwait(false); - AppendJobPart(part); - } - catch (Exception ex) + StorageResourceContainer subContainer = + _destinationResourceContainer.GetChildStorageResourceContainer(subContainerPath); + await subContainer.CreateIfNotExistsAsync().ConfigureAwait(false); + } + else + { + if (!existingSources.Contains(current.Uri)) { - await InvokeFailedArgAsync(ex).ConfigureAwait(false); - yield break; + string containerUriPath = _sourceResourceContainer.Uri.GetPath(); + string sourceName = string.IsNullOrEmpty(containerUriPath) + ? current.Uri.GetPath() + : current.Uri.GetPath().Substring(containerUriPath.Length + 1); + + ServiceToServiceJobPart part; + try + { + part = await ServiceToServiceJobPart.CreateJobPartAsync( + job: this, + partNumber: partNumber, + sourceResource: (StorageResourceItem)current, + destinationResource: _destinationResourceContainer.GetStorageResourceReference(sourceName)) + .ConfigureAwait(false); + AppendJobPart(part); + } + catch (Exception ex) + { + await InvokeFailedArgAsync(ex).ConfigureAwait(false); + yield break; + } + yield return part; + partNumber++; } - yield return part; - partNumber++; } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/Shared/CheckpointerExtensions.cs b/sdk/storage/Azure.Storage.DataMovement/src/Shared/CheckpointerExtensions.cs index 3424079970b1c..682a0715dfb1a 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/Shared/CheckpointerExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/Shared/CheckpointerExtensions.cs @@ -78,6 +78,25 @@ internal static void WriteVariableLengthFieldInfo( writer.Write(length); } + internal static void WritePaddedString(this BinaryWriter writer, string value, int setSizeInBytes) + { + byte[] valueBytes = Encoding.UTF8.GetBytes(value); + writer.Write(valueBytes); + + int padding = setSizeInBytes - valueBytes.Length; + if (padding > 0) + { + char[] paddingArray = new char[padding]; + writer.Write(paddingArray); + } + } + + internal static string ReadPaddedString(this BinaryReader reader, int numBytes) + { + byte[] stringBytes = reader.ReadBytes(numBytes); + return stringBytes.ToString(numBytes).TrimEnd('\0'); + } + internal static string ToSanitizedString(this Uri uri) { UriBuilder builder = new(uri); diff --git a/sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementConstants.cs b/sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementConstants.cs index 951c58d7851de..f1de3678cc375 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementConstants.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementConstants.cs @@ -56,7 +56,6 @@ internal static class Log internal const int OneByte = 1; internal const int LongSizeInBytes = 8; - internal const int UShortSizeInBytes = 2; internal const int IntSizeInBytes = 4; internal const int GuidSizeInBytes = 16; @@ -68,7 +67,7 @@ internal static class JobPlanFile internal const string SchemaVersion_b1 = "b1"; internal const string SchemaVersion = SchemaVersion_b1; - internal const string FileExtension = "ndm"; + internal const string FileExtension = ".ndm"; internal const int VersionStrLength = 2; internal const int VersionStrNumBytes = VersionStrLength * 2; @@ -105,171 +104,33 @@ internal static class JobPartPlanFile internal const string SchemaVersion_b3 = "b3"; internal const string SchemaVersion = SchemaVersion_b3; // TODO: remove b for beta - // Job Plan file extension. e.g. the file extension will look like {transferid}--{jobpartNumber}.steV{schemaVersion} - internal const string FileExtension = ".steV"; - internal const string JobPlanFileNameDelimiter = "--"; + // Job Plan file extension. e.g. the file extension will look like {transferid}.{jobpartNumber}.ndmpart + internal const string FileExtension = ".ndmpart"; internal const int JobPartLength = 5; internal const int IdSize = 36; // Size of a guid with hyphens - internal const int CustomHeaderMaxBytes = 256; // UTF-8 encoding, so 2 bytes per char internal const int VersionStrLength = 2; internal const int VersionStrNumBytes = VersionStrLength * 2; - internal const int TransferIdStrLength = 36; - internal const int TransferIdStrNumBytes = TransferIdStrLength * 2; - internal const int ResourceIdMaxStrLength = 20; - internal const int ResourceIdNumBytes = ResourceIdMaxStrLength * 2; - internal const int PathStrMaxLength = 4096; - internal const int PathStrNumBytes = PathStrMaxLength * 2; - internal const int ExtraQueryMaxLength = 1000; - internal const int ExtraQueryNumBytes = ExtraQueryMaxLength * 2; - internal const int HeaderValueMaxLength = 1000; - internal const int HeaderValueNumBytes = HeaderValueMaxLength * 2; - internal const int MetadataStrMaxLength = 4096; - internal const int MetadataStrNumBytes = MetadataStrMaxLength * 2; - internal const int BlobTagsStrMaxLength = 4096; - internal const int BlobTagsStrNumBytes = BlobTagsStrMaxLength * 2; + internal const int TypeIdMaxStrLength = 10; + internal const int TypeIdNumBytes = TypeIdMaxStrLength * 2; - /// Index: 0 - internal const int VersionIndex = 0; // Index: 0 - /// Index: 4 - internal const int StartTimeIndex = VersionIndex + VersionStrNumBytes; - /// Index: 12 - internal const int TransferIdIndex = StartTimeIndex + LongSizeInBytes; - /// Index: 84 - internal const int PartNumberIndex = TransferIdIndex + TransferIdStrNumBytes; - /// Index: 92 - internal const int SourceResourceIdLengthIndex = PartNumberIndex + LongSizeInBytes; - /// Index: 94 - internal const int SourceResourceIdIndex = SourceResourceIdLengthIndex + UShortSizeInBytes; - - /// Index: 134 - internal const int SourcePathLengthIndex = SourceResourceIdIndex + ResourceIdNumBytes; - /// Index: 136 - internal const int SourcePathIndex = SourcePathLengthIndex + UShortSizeInBytes; - /// Index: 8328 - internal const int SourceExtraQueryLengthIndex = SourcePathIndex + PathStrNumBytes; - /// Index: 8330 - internal const int SourceExtraQueryIndex = SourceExtraQueryLengthIndex + UShortSizeInBytes; - /// Index: 10330 - internal const int DestinationResourceIdLengthIndex = SourceExtraQueryIndex + ExtraQueryNumBytes; - /// Index: 10332 - internal const int DestinationResourceIdIndex = DestinationResourceIdLengthIndex + UShortSizeInBytes; - /// Index: 10372 - internal const int DestinationPathLengthIndex = DestinationResourceIdIndex + ResourceIdNumBytes; - /// Index: 10374 - internal const int DestinationPathIndex = DestinationPathLengthIndex + UShortSizeInBytes; - /// Index: 18566 - internal const int DestinationExtraQueryLengthIndex = DestinationPathIndex + PathStrNumBytes; - /// Index: 18568 - internal const int DestinationExtraQueryIndex = DestinationExtraQueryLengthIndex + UShortSizeInBytes; - /// Index: 20568 - internal const int IsFinalPartIndex = DestinationExtraQueryIndex + ExtraQueryNumBytes; - /// Index: 20569 - internal const int ForceWriteIndex = IsFinalPartIndex + OneByte; - /// Index: 20570 - internal const int ForceIfReadOnlyIndex = ForceWriteIndex + OneByte; - /// Index: 20571 - internal const int AutoDecompressIndex = ForceIfReadOnlyIndex + OneByte; - /// Index: 20572 - internal const int PriorityIndex = AutoDecompressIndex + OneByte; - /// Index: 20573 - internal const int TTLAfterCompletionIndex = PriorityIndex + OneByte; - /// Index: 20581 - internal const int FromToIndex = TTLAfterCompletionIndex + LongSizeInBytes; - /// Index: 20582 - internal const int FolderPropertyModeIndex = FromToIndex + OneByte; - /// Index: 20583 - internal const int NumberChunksIndex = FolderPropertyModeIndex + OneByte; - - // JobPartPlanDestinationBlob Indexes - /// Index: 20591 - internal const int DstBlobTypeIndex = NumberChunksIndex + LongSizeInBytes; - /// Index: 20592 - internal const int DstBlobNoGuessMimeTypeIndex = DstBlobTypeIndex + OneByte; - /// Index: 20593 - internal const int DstBlobContentTypeLengthIndex = DstBlobNoGuessMimeTypeIndex + OneByte; - /// Index: 20595 - internal const int DstBlobContentTypeIndex = DstBlobContentTypeLengthIndex + UShortSizeInBytes; - /// Index: 22595 - internal const int DstBlobContentEncodingLengthIndex = DstBlobContentTypeIndex + HeaderValueNumBytes; - /// Index: 22597 - internal const int DstBlobContentEncodingIndex = DstBlobContentEncodingLengthIndex + UShortSizeInBytes; - /// Index: 24597 - internal const int DstBlobContentLanguageLengthIndex = DstBlobContentEncodingIndex + HeaderValueNumBytes; - /// Index: 24599 - internal const int DstBlobContentLanguageIndex = DstBlobContentLanguageLengthIndex + UShortSizeInBytes; - /// Index: 26599 - internal const int DstBlobContentDispositionLengthIndex = DstBlobContentLanguageIndex + HeaderValueNumBytes; - /// Index: 26601 - internal const int DstBlobContentDispositionIndex = DstBlobContentDispositionLengthIndex + UShortSizeInBytes; - /// Index: 28601 - internal const int DstBlobCacheControlLengthIndex = DstBlobContentDispositionIndex + HeaderValueNumBytes; - /// Index: 28603 - internal const int DstBlobCacheControlIndex = DstBlobCacheControlLengthIndex + UShortSizeInBytes; - /// Index: 30603 - internal const int DstBlobBlockBlobTierIndex = DstBlobCacheControlIndex + HeaderValueNumBytes; - /// Index: 30604 - internal const int DstBlobPageBlobTierIndex = DstBlobBlockBlobTierIndex + OneByte; - /// Index: 30605 - internal const int DstBlobPutMd5Index = DstBlobPageBlobTierIndex + OneByte; - /// Index: 30606 - internal const int DstBlobMetadataLengthIndex = DstBlobPutMd5Index + OneByte; - /// Index: 30608 - internal const int DstBlobMetadataIndex = DstBlobMetadataLengthIndex + UShortSizeInBytes; - /// Index: 38800 - internal const int DstBlobTagsLengthIndex = DstBlobMetadataIndex + MetadataStrNumBytes; - /// Index: 38808 - internal const int DstBlobTagsIndex = DstBlobTagsLengthIndex + LongSizeInBytes; - /// Index: 47000 - internal const int DstBlobIsSourceEncrypted = DstBlobTagsIndex + BlobTagsStrNumBytes; - /// Index: 47001 - internal const int DstBlobCpkScopeInfoLengthIndex = DstBlobIsSourceEncrypted + OneByte; - /// Index: 47003 - internal const int DstBlobCpkScopeInfoIndex = DstBlobCpkScopeInfoLengthIndex + UShortSizeInBytes; - /// Index: 49003 - internal const int DstBlobBlockSizeIndex = DstBlobCpkScopeInfoIndex + HeaderValueNumBytes; - - // JobPartPlanDestinationLocal Indexes - /// Index: 49011 - internal const int DstLocalPreserveLastModifiedTimeIndex = DstBlobBlockSizeIndex + LongSizeInBytes; - /// Index: 49012 - internal const int DstLocalMD5VerificationOptionIndex = DstLocalPreserveLastModifiedTimeIndex + OneByte; - - /// Index: 49013 - internal const int PreserveSMBPermissionsIndex = DstLocalMD5VerificationOptionIndex + OneByte; - /// Index: 49014 - internal const int PreserveSMBInfoIndex = PreserveSMBPermissionsIndex + OneByte; - /// Index: 49015 - internal const int S2SGetPropertiesInBackendIndex = PreserveSMBInfoIndex + OneByte; - /// Index: 49016 - internal const int S2SSourceChangeValidationIndex = S2SGetPropertiesInBackendIndex + OneByte; - /// Index: 49017 - internal const int DestLengthValidationIndex = S2SSourceChangeValidationIndex + OneByte; - /// Index: 49018 - internal const int S2SInvalidMetadataHandleOptionIndex = DestLengthValidationIndex + OneByte; - /// Index: 49019 - internal const int DeleteSnapshotsOptionIndex = S2SInvalidMetadataHandleOptionIndex + OneByte; - /// Index: 49020 - internal const int PermanentDeleteOptionIndex = DeleteSnapshotsOptionIndex + OneByte; - /// Index: 49021 - internal const int RehydratePriorityTypeIndex = PermanentDeleteOptionIndex + OneByte; - /// Index: 49022 - internal const int AtomicJobStatusStateIndex = RehydratePriorityTypeIndex + OneByte; - /// Index: 49023 - internal const int AtomicJobStatusHasFailedIndex = AtomicJobStatusStateIndex + OneByte; - /// Index: 49024 - internal const int AtomicJobStatusHasSkippedIndex = AtomicJobStatusHasFailedIndex + OneByte; - /// Index: 49025 - internal const int AtomicPartStatusStateIndex = AtomicJobStatusHasSkippedIndex + OneByte; - /// Index: 49026 - internal const int AtomicPartStatusHasFailedIndex = AtomicPartStatusStateIndex + OneByte; - /// Index: 49027 - internal const int AtomicPartStatusHasSkippedIndex = AtomicPartStatusHasFailedIndex + OneByte; - /// - /// Size of the JobPart Header: 49029 - /// - internal const int JobPartHeaderSizeInBytes = AtomicPartStatusHasSkippedIndex + OneByte; + internal const int VersionIndex = 0; + internal const int TransferIdIndex = VersionIndex + VersionStrNumBytes; + internal const int PartNumberIndex = TransferIdIndex + GuidSizeInBytes; + internal const int CreateTimeIndex = PartNumberIndex + LongSizeInBytes; + internal const int SourceTypeIdIndex = CreateTimeIndex + LongSizeInBytes; + internal const int DestinationTypeIdIndex = SourceTypeIdIndex + TypeIdNumBytes; + internal const int SourcePathOffsetIndex = DestinationTypeIdIndex + TypeIdNumBytes; + internal const int SourcePathLengthIndex = SourcePathOffsetIndex + IntSizeInBytes; + internal const int DestinationPathOffsetIndex = SourcePathLengthIndex + IntSizeInBytes; + internal const int DestinationPathLengthIndex = DestinationPathOffsetIndex + IntSizeInBytes; + internal const int OverwriteIndex = DestinationPathLengthIndex + IntSizeInBytes; + internal const int InitialTransferSizeIndex = OverwriteIndex + OneByte; + internal const int ChunkSizeIndex = InitialTransferSizeIndex + LongSizeInBytes; + internal const int PriorityIndex = ChunkSizeIndex + LongSizeInBytes; + internal const int JobPartStatusIndex = PriorityIndex + OneByte; + internal const int VariableLengthStartIndex = JobPartStatusIndex + IntSizeInBytes; } internal static class ErrorCode diff --git a/sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementExtensions.cs b/sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementExtensions.cs index de00ca6dbce4c..ad752a7d8a33c 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/Shared/DataMovementExtensions.cs @@ -29,7 +29,7 @@ public static async Task ToJobPartAsync( JobPartPlanHeader header = JobPartPlanHeader.Deserialize(planFileStream); // Apply credentials to the saved transfer job path - DataTransferStatus jobPartStatus = header.AtomicJobStatus; + DataTransferStatus jobPartStatus = header.JobPartStatus; StreamToUriJobPart jobPart = await StreamToUriJobPart.CreateJobPartAsync( job: baseJob, partNumber: Convert.ToInt32(header.PartNumber), @@ -54,7 +54,7 @@ public static async Task ToJobPartAsync( JobPartPlanHeader header = JobPartPlanHeader.Deserialize(planFileStream); // Apply credentials to the saved transfer job path - DataTransferStatus jobPartStatus = header.AtomicJobStatus; + DataTransferStatus jobPartStatus = header.JobPartStatus; ServiceToServiceJobPart jobPart = await ServiceToServiceJobPart.CreateJobPartAsync( job: baseJob, partNumber: Convert.ToInt32(header.PartNumber), @@ -79,7 +79,7 @@ public static async Task ToJobPartAsync( JobPartPlanHeader header = JobPartPlanHeader.Deserialize(planFileStream); // Apply credentials to the saved transfer job path - DataTransferStatus jobPartStatus = header.AtomicJobStatus; + DataTransferStatus jobPartStatus = header.JobPartStatus; UriToStreamJobPart jobPart = await UriToStreamJobPart.CreateJobPartAsync( job: baseJob, partNumber: Convert.ToInt32(header.PartNumber), @@ -108,7 +108,7 @@ public static async Task ToJobPartAsync( string childSourceName = childSourcePath.Substring(sourceResource.Uri.AbsoluteUri.Length + 1); string childDestinationPath = header.DestinationPath; string childDestinationName = childDestinationPath.Substring(destinationResource.Uri.AbsoluteUri.Length + 1); - DataTransferStatus jobPartStatus = header.AtomicJobStatus; + DataTransferStatus jobPartStatus = header.JobPartStatus; StreamToUriJobPart jobPart = await StreamToUriJobPart.CreateJobPartAsync( job: baseJob, partNumber: Convert.ToInt32(header.PartNumber), @@ -135,7 +135,7 @@ public static async Task ToJobPartAsync( // Apply credentials to the saved transfer job path string childSourcePath = header.SourcePath; string childDestinationPath = header.DestinationPath; - DataTransferStatus jobPartStatus = header.AtomicJobStatus; + DataTransferStatus jobPartStatus = header.JobPartStatus; ServiceToServiceJobPart jobPart = await ServiceToServiceJobPart.CreateJobPartAsync( job: baseJob, partNumber: Convert.ToInt32(header.PartNumber), @@ -164,7 +164,7 @@ public static async Task ToJobPartAsync( string childSourceName = childSourcePath.Substring(sourceResource.Uri.AbsoluteUri.Length + 1); string childDestinationPath = header.DestinationPath; string childDestinationName = childDestinationPath.Substring(destinationResource.Uri.AbsoluteUri.Length + 1); - DataTransferStatus jobPartStatus = header.AtomicJobStatus; + DataTransferStatus jobPartStatus = header.JobPartStatus; UriToStreamJobPart jobPart = await UriToStreamJobPart.CreateJobPartAsync( job: baseJob, partNumber: Convert.ToInt32(header.PartNumber), @@ -182,65 +182,25 @@ public static async Task ToJobPartAsync( /// /// Translate the initial job part header to a job plan format file /// - internal static JobPartPlanHeader ToJobPartPlanHeader(this JobPartInternal jobPart, DataTransferStatus jobStatus) + internal static JobPartPlanHeader ToJobPartPlanHeader(this JobPartInternal jobPart) { - JobPartPlanDestinationBlob dstBlobData = new JobPartPlanDestinationBlob( - blobType: JobPlanBlobType.Detect, // TODO: update when supported - noGuessMimeType: false, // TODO: update when supported - contentType: "", // TODO: update when supported - contentEncoding: "", // TODO: update when supported - contentLanguage: "", // TODO: update when supported - contentDisposition: "", // TODO: update when supported - cacheControl: "", // TODO: update when supported - blockBlobTier: JobPartPlanBlockBlobTier.None,// TODO: update when supported - pageBlobTier: JobPartPlanPageBlobTier.None,// TODO: update when supported - putMd5: false,// TODO: update when supported - metadata: "",// TODO: update when supported - blobTags: "",// TODO: update when supported - isSourceEncrypted: false,// TODO: update when supported - cpkScopeInfo: "",// TODO: update when supported - blockSize: jobPart._maximumTransferChunkSize); - - JobPartPlanDestinationLocal dstLocalData = new JobPartPlanDestinationLocal( - preserveLastModifiedTime: false, // TODO: update when supported - checksumVerificationOption: 0); // TODO: update when supported - string sourcePath = jobPart._sourceResource.Uri.ToSanitizedString(); string destinationPath = jobPart._destinationResource.Uri.ToSanitizedString(); return new JobPartPlanHeader( version: DataMovementConstants.JobPartPlanFile.SchemaVersion, - startTime: DateTimeOffset.UtcNow, // TODO: update to job start time transferId: jobPart._dataTransfer.Id, - partNumber: (uint)jobPart.PartNumber, - sourceResourceId: jobPart._sourceResource.ResourceId, + partNumber: jobPart.PartNumber, + createTime: DateTimeOffset.UtcNow, + sourceTypeId: jobPart._sourceResource.ResourceId, + destinationTypeId: jobPart._destinationResource.ResourceId, sourcePath: sourcePath, - sourceExtraQuery: "", // TODO: convert options to string - destinationResourceId: jobPart._destinationResource.ResourceId, destinationPath: destinationPath, - destinationExtraQuery: "", // TODO: convert options to string - isFinalPart: false, - forceWrite: jobPart._createMode == StorageResourceCreationPreference.OverwriteIfExists, // TODO: change to enum value - forceIfReadOnly: false, // TODO: revisit for Azure Files - autoDecompress: false, // TODO: revisit if we want to support this feature + overwrite: jobPart._createMode == StorageResourceCreationPreference.OverwriteIfExists, + initialTransferSize: jobPart._initialTransferSize, + chunkSize: jobPart._maximumTransferChunkSize, priority: 0, // TODO: add priority feature - ttlAfterCompletion: DateTimeOffset.MinValue, // TODO: revisit for Azure Files - jobPlanOperation: 0, // TODO: revisit when we add this feature - folderPropertyMode: FolderPropertiesMode.None, // TODO: revisit for Azure Files - numberChunks: 0, // TODO: revisit when added - dstBlobData: dstBlobData, // TODO: revisit when we add feature to cache this info - dstLocalData: dstLocalData, // TODO: revisit when we add feature to cache this info - preserveSMBPermissions: false, // TODO: revisit for Azure Files - preserveSMBInfo: false, // TODO: revisit for Azure Files - s2sGetPropertiesInBackend: false, // TODO: revisit for Azure Files - s2sSourceChangeValidation: false, // TODO: revisit for Azure Files - destLengthValidation: false, // TODO: revisit when features is added - s2sInvalidMetadataHandleOption: 0, // TODO: revisit when supported - deleteSnapshotsOption: JobPartDeleteSnapshotsOption.None, // TODO: revisit when feature is added - permanentDeleteOption: JobPartPermanentDeleteOption.None, // TODO: revisit when feature is added - rehydratePriorityType: JobPartPlanRehydratePriorityType.None, // TODO: revisit when feature is added - atomicJobStatus: jobStatus, - atomicPartStatus: jobPart.JobPartStatus); + jobPartStatus: jobPart.JobPartStatus); } /// @@ -278,10 +238,10 @@ internal static void VerifyJobPartPlanHeader(this JobPartInternal jobPart, JobPa } // Check CreateMode / Overwrite - if ((header.ForceWrite && jobPart._createMode != StorageResourceCreationPreference.OverwriteIfExists) || - (!header.ForceWrite && jobPart._createMode == StorageResourceCreationPreference.OverwriteIfExists)) + if ((header.Overwrite && jobPart._createMode != StorageResourceCreationPreference.OverwriteIfExists) || + (!header.Overwrite && jobPart._createMode == StorageResourceCreationPreference.OverwriteIfExists)) { - throw Errors.MismatchResumeCreateMode(header.ForceWrite, jobPart._createMode); + throw Errors.MismatchResumeCreateMode(header.Overwrite, jobPart._createMode); } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/Shared/Errors.DataMovement.cs b/sdk/storage/Azure.Storage.DataMovement/src/Shared/Errors.DataMovement.cs index 69a9fd5bf724c..8795df72decf9 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/Shared/Errors.DataMovement.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/Shared/Errors.DataMovement.cs @@ -58,6 +58,9 @@ public static ArgumentException CollisionJobPart(string transferId, int jobPart) public static ArgumentException MissingCheckpointerPath(string directoryPath) => throw new ArgumentException($"Could not initialize the LocalTransferCheckpointer because the folderPath passed does not exist. Please create the {directoryPath}, folder path first."); + public static ArgumentException InvalidJobPartFileName(string fileName) + => new ArgumentException($"Invalid Checkpoint File: The following checkpoint file contains an invalid file name {fileName}"); + public static ArgumentException InvalidTransferIdFileName(string fileName) => new ArgumentException($"Invalid Checkpoint File: The following checkpoint file contains a Transfer ID that is invalid {fileName}"); @@ -67,14 +70,14 @@ public static ArgumentException InvalidJobPartFileNameExtension(string fileName) public static ArgumentException InvalidJobPartNumberFileName(string fileName) => new ArgumentException($"Invalid Job Part Plan File: The following Job Part Plan file contains an invalid Job Part Number, could not convert to a integer: {fileName}"); - public static ArgumentException InvalidSchemaVersionFileName(string schemaVersion) - => new ArgumentException($"Invalid Job Part Plan File: Job Part Schema version: {schemaVersion} does not match the Schema Version supported by the package: {DataMovementConstants.JobPartPlanFile.SchemaVersion}. Please consider altering the package version that supports the respective version."); + public static ArgumentException InvalidPartHeaderElementLength(string elementName, int expectedSize, int actualSize) + => new ArgumentException($"Invalid Job Part Plan File: Attempt to set element, \"{elementName}\" failed.\n Expected size: {expectedSize}\n Actual Size: {actualSize}"); - public static ArgumentException InvalidPlanFileElement(string elementName, int expectedSize, int actualSize) - => throw new ArgumentException($"Invalid Job Part Plan File: Attempt to set element, \"{elementName}\" failed.\n Expected size: {expectedSize}\n Actual Size: {actualSize}"); + public static ArgumentException InvalidPartHeaderElement(string elementName, string elementValue) + => new ArgumentException($"Invalid Job Part Plan File: Attempt to set element, \"{elementName}\" with value \"{elementValue}\" failed."); public static ArgumentException InvalidStringToDictionary(string elementName, string value) - => throw new ArgumentException($"Invalid Job Part Plan File: Attempt to set element, \"{elementName}\" failed.\n Expected format stored was invalid, \"{value}\""); + => new ArgumentException($"Invalid Job Part Plan File: Attempt to set element, \"{elementName}\" failed.\n Expected format stored was invalid, \"{value}\""); public static IOException LocalFileAlreadyExists(string pathName) => new IOException($"File path `{pathName}` already exists. Cannot overwrite file."); diff --git a/sdk/storage/Azure.Storage.DataMovement/src/Shared/StorageResourceContainerInternal.cs b/sdk/storage/Azure.Storage.DataMovement/src/Shared/StorageResourceContainerInternal.cs index 9aeb4e0d5b908..2edd22a507e5a 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/Shared/StorageResourceContainerInternal.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/Shared/StorageResourceContainerInternal.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; namespace Azure.Storage.DataMovement { @@ -20,5 +21,11 @@ internal IAsyncEnumerable GetStorageResourcesInternalAsync( internal StorageResourceItem GetStorageResourceReferenceInternal(string path) => GetStorageResourceReference(path); + + internal Task CreateIfNotExistsInternalAsync(CancellationToken cancellationToken = default) + => CreateIfNotExistsAsync(cancellationToken); + + internal StorageResourceContainer GetChildStorageResourceContainerInternal(string path) + => GetChildStorageResourceContainer(path); } } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceContainer.cs index 1503623a4d605..886f2b9449f03 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceContainer.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/StorageResourceContainer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; namespace Azure.Storage.DataMovement { @@ -28,6 +29,21 @@ protected internal abstract IAsyncEnumerable GetStorageResource /// protected internal abstract StorageResourceItem GetStorageResourceReference(string path); + /// + /// Creates storage resource container if it does not already exists. + /// + /// + protected internal abstract Task CreateIfNotExistsAsync(CancellationToken cancellationToken = default); + + /// + /// Gets the child StorageResourceContainer of the respective container. + /// + /// + /// The path of the child container. + /// + /// + protected internal abstract StorageResourceContainer GetChildStorageResourceContainer(string path); + /// /// Storage Resource is a container. /// diff --git a/sdk/storage/Azure.Storage.DataMovement/src/StreamToUriJobPart.cs b/sdk/storage/Azure.Storage.DataMovement/src/StreamToUriJobPart.cs index d1cc783dd054b..ef1ce3ad5cd72 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/StreamToUriJobPart.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/StreamToUriJobPart.cs @@ -89,7 +89,7 @@ public static async Task CreateJobPartAsync( { // Create Job Part file as we're initializing the job part StreamToUriJobPart part = new StreamToUriJobPart(job, partNumber); - await part.AddJobPartToCheckpointerAsync(1).ConfigureAwait(false); // For now we only store 1 chunk + await part.AddJobPartToCheckpointerAsync().ConfigureAwait(false); return part; } @@ -112,7 +112,7 @@ public static async Task CreateJobPartAsync( length: length); if (!partPlanFileExists) { - await part.AddJobPartToCheckpointerAsync(1).ConfigureAwait(false); // For now we only store 1 chunk + await part.AddJobPartToCheckpointerAsync().ConfigureAwait(false); } return part; } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/StreamToUriTransferJob.cs b/sdk/storage/Azure.Storage.DataMovement/src/StreamToUriTransferJob.cs index 2691762d08974..2ca04b94c144b 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/StreamToUriTransferJob.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/StreamToUriTransferJob.cs @@ -169,31 +169,46 @@ private async IAsyncEnumerable GetStorageResourcesAsync() } StorageResource current = enumerator.Current; - if (!existingSources.Contains(current.Uri)) + + if (current.IsContainer) { + // Create sub-container string containerUriPath = _sourceResourceContainer.Uri.GetPath(); - string sourceName = string.IsNullOrEmpty(containerUriPath) + string subContainerPath = string.IsNullOrEmpty(containerUriPath) ? current.Uri.GetPath() : current.Uri.GetPath().Substring(containerUriPath.Length + 1); - - StreamToUriJobPart part; - try - { - part = await StreamToUriJobPart.CreateJobPartAsync( - job: this, - partNumber: partNumber, - sourceResource: (StorageResourceItem)current, - destinationResource: _destinationResourceContainer.GetStorageResourceReference(sourceName)) - .ConfigureAwait(false); - AppendJobPart(part); - } - catch (Exception ex) + StorageResourceContainer subContainer = + _destinationResourceContainer.GetChildStorageResourceContainer(subContainerPath); + await subContainer.CreateIfNotExistsAsync().ConfigureAwait(false); + } + else + { + if (!existingSources.Contains(current.Uri)) { - await InvokeFailedArgAsync(ex).ConfigureAwait(false); - yield break; + string containerUriPath = _sourceResourceContainer.Uri.GetPath(); + string sourceName = string.IsNullOrEmpty(containerUriPath) + ? current.Uri.GetPath() + : current.Uri.GetPath().Substring(containerUriPath.Length + 1); + + StreamToUriJobPart part; + try + { + part = await StreamToUriJobPart.CreateJobPartAsync( + job: this, + partNumber: partNumber, + sourceResource: (StorageResourceItem)current, + destinationResource: _destinationResourceContainer.GetStorageResourceReference(sourceName)) + .ConfigureAwait(false); + AppendJobPart(part); + } + catch (Exception ex) + { + await InvokeFailedArgAsync(ex).ConfigureAwait(false); + yield break; + } + yield return part; + partNumber++; } - yield return part; - partNumber++; } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/src/TransferCheckpointer.cs b/sdk/storage/Azure.Storage.DataMovement/src/TransferCheckpointer.cs index aaeeed368b9e2..879fcf91bd3b1 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/TransferCheckpointer.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/TransferCheckpointer.cs @@ -44,7 +44,6 @@ public abstract Task AddNewJobAsync( /// /// The transfer ID. /// The job part number. - /// The total chunks for the part. /// A to the job part plan header. /// /// Optional to propagate @@ -53,7 +52,6 @@ public abstract Task AddNewJobAsync( public abstract Task AddNewJobPartAsync( string transferId, int partNumber, - int chunksTotal, Stream headerStream, CancellationToken cancellationToken = default); diff --git a/sdk/storage/Azure.Storage.DataMovement/src/UriToStreamJobPart.cs b/sdk/storage/Azure.Storage.DataMovement/src/UriToStreamJobPart.cs index bc86ff3a50ffd..79dc77ffa5842 100644 --- a/sdk/storage/Azure.Storage.DataMovement/src/UriToStreamJobPart.cs +++ b/sdk/storage/Azure.Storage.DataMovement/src/UriToStreamJobPart.cs @@ -85,7 +85,7 @@ public static async Task CreateJobPartAsync( { // Create Job Part file as we're initializing the job part UriToStreamJobPart part = new UriToStreamJobPart(job, partNumber); - await part.AddJobPartToCheckpointerAsync(1).ConfigureAwait(false); // For now we only store 1 chunk + await part.AddJobPartToCheckpointerAsync().ConfigureAwait(false); return part; } @@ -108,7 +108,7 @@ public static async Task CreateJobPartAsync( length: length); if (!partPlanFileExists) { - await part.AddJobPartToCheckpointerAsync(1).ConfigureAwait(false); // For now we only store 1 chunk + await part.AddJobPartToCheckpointerAsync().ConfigureAwait(false); } return part; } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/BlobStorageResourceContainerTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/BlobStorageResourceContainerTests.cs index 2f5206a3489fe..e3713589485de 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/BlobStorageResourceContainerTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/BlobStorageResourceContainerTests.cs @@ -12,6 +12,7 @@ using Azure.Storage.Blobs.Tests; using Azure.Storage.DataMovement.Tests; using DMBlobs::Azure.Storage.DataMovement.Blobs; +using Moq; using NUnit.Framework; namespace Azure.Storage.DataMovement.Blobs.Tests @@ -114,5 +115,27 @@ public async Task GetChildStorageResourceAsync() Assert.IsNotNull(properties); Assert.IsNotNull(properties.ETag); } + + [Test] + public void GetChildStorageResourceContainer() + { + // Arrange + Uri uri = new Uri("https://storageaccount.blob.core.windows.net/container"); + Mock mock = new(uri, new BlobClientOptions()); + mock.Setup(b => b.Uri).Returns(uri); + + string prefix = "foo"; + StorageResourceContainer containerResource = + new BlobStorageResourceContainer(mock.Object, new() { BlobDirectoryPrefix = prefix }); + + // Act + string childPath = "bar"; + StorageResourceContainer childContainer = containerResource.GetChildStorageResourceContainer(childPath); + + // Assert + UriBuilder builder = new UriBuilder(containerResource.Uri); + builder.Path = string.Join("/", builder.Path, childPath); + Assert.AreEqual(builder.Uri, childContainer.Uri); + } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/CheckpointerTesting.cs b/sdk/storage/Azure.Storage.DataMovement/tests/CheckpointerTesting.cs index 2947248c6c5d4..17787870cccdb 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/CheckpointerTesting.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/CheckpointerTesting.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using Azure.Storage.DataMovement.JobPlan; -using Azure.Storage.Test; -using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using System; @@ -11,191 +9,83 @@ namespace Azure.Storage.DataMovement.Tests { - internal class CheckpointerTesting + internal static class CheckpointerTesting { - private const int KB = 1024; - private const int MB = 1024 * KB; - internal const string DefaultTransferId = - "c591bacc-5552-4c5c-b068-552685ec5cd5"; + internal const string DefaultTransferId = "c591bacc-5552-4c5c-b068-552685ec5cd5"; internal const long DefaultPartNumber = 5; - internal static readonly DateTimeOffset DefaultStartTime - = new DateTimeOffset(2023, 03, 13, 15, 24, 6, default); internal const string DefaultSourceProviderId = "test"; - internal const string DefaultSourceResourceId = "LocalFile"; + internal const string DefaultSourceTypeId = "LocalFile"; internal const string DefaultSourcePath = "C:/sample-source"; internal const string DefaultWebSourcePath = "https://example.com/source"; - internal const string DefaultSourceQuery = "sourcequery"; internal const string DefaultDestinationProviderId = "test"; - internal const string DefaultDestinationResourceId = "LocalFile"; + internal const string DefaultDestinationTypeId = "BlockBlob"; internal const string DefaultDestinationPath = "C:/sample-destination"; internal const string DefaultWebDestinationPath = "https://example.com/destination"; - internal const string DefaultDestinationQuery = "destquery"; + internal const long DefaultInitialTransferSize = 32 * Constants.MB; + internal const long DefaultChunkSize = 4 * Constants.MB; internal const byte DefaultPriority = 0; - internal static readonly DateTimeOffset DefaultTtlAfterCompletion = DateTimeOffset.MaxValue; internal const JobPlanOperation DefaultJobPlanOperation = JobPlanOperation.Upload; - internal const FolderPropertiesMode DefaultFolderPropertiesMode = FolderPropertiesMode.None; - internal const long DefaultNumberChunks = 1; - internal const JobPlanBlobType DefaultBlobType = JobPlanBlobType.BlockBlob; - internal const string DefaultContentType = "ContentType / type"; - internal const string DefaultContentEncoding = "UTF8"; - internal const string DefaultContentLanguage = "content-language"; - internal const string DefaultContentDisposition = "content-disposition"; - internal const string DefaultCacheControl = "cache-control"; - internal const JobPartPlanBlockBlobTier DefaultBlockBlobTier = JobPartPlanBlockBlobTier.None; - internal const JobPartPlanPageBlobTier DefaultPageBlobTier = JobPartPlanPageBlobTier.None; - internal const string DefaultCpkScopeInfo = "cpk-scope-info"; - internal const long DefaultBlockSize = 4 * KB; + internal const long DefaultBlockSize = 4 * Constants.KB; internal const byte DefaultS2sInvalidMetadataHandleOption = 0; internal const byte DefaultChecksumVerificationOption = 0; - internal const JobPartDeleteSnapshotsOption DefaultDeleteSnapshotsOption = JobPartDeleteSnapshotsOption.None; - internal const JobPartPermanentDeleteOption DefaultPermanentDeleteOption = JobPartPermanentDeleteOption.None; - internal const JobPartPlanRehydratePriorityType DefaultRehydratePriorityType = JobPartPlanRehydratePriorityType.None; + internal static readonly DateTimeOffset DefaultCreateTime = new DateTimeOffset(2023, 08, 28, 17, 26, 0, default); internal static readonly DataTransferStatus DefaultJobStatus = new DataTransferStatus(DataTransferState.Queued, false, false); internal static readonly DataTransferStatus DefaultPartStatus = new DataTransferStatus(DataTransferState.Queued, false, false); - internal static readonly DateTimeOffset DefaultCreateTime = new DateTimeOffset(2023, 08, 28, 17, 26, 0, default); internal static JobPartPlanHeader CreateDefaultJobPartHeader( string version = DataMovementConstants.JobPartPlanFile.SchemaVersion, - DateTimeOffset startTime = default, string transferId = DefaultTransferId, long partNumber = DefaultPartNumber, - string sourceResourceId = DefaultSourceResourceId, + DateTimeOffset createTime = default, + string sourceTypeId = DefaultSourceTypeId, + string destinationTypeId = DefaultDestinationTypeId, string sourcePath = DefaultSourcePath, - string sourceExtraQuery = DefaultSourceQuery, - string destinationResourceId = DefaultDestinationResourceId, string destinationPath = DefaultDestinationPath, - string destinationExtraQuery = DefaultDestinationQuery, - bool isFinalPart = false, - bool forceWrite = false, - bool forceIfReadOnly = false, - bool autoDecompress = false, + bool overwrite = false, + long initialTransferSize = DefaultInitialTransferSize, + long chunkSize = DefaultChunkSize, byte priority = DefaultPriority, - DateTimeOffset ttlAfterCompletion = default, - JobPlanOperation fromTo = DefaultJobPlanOperation, - FolderPropertiesMode folderPropertyMode = DefaultFolderPropertiesMode, - long numberChunks = DefaultNumberChunks, - JobPlanBlobType blobType = DefaultBlobType, - bool noGuessMimeType = false, - string contentType = DefaultContentType, - string contentEncoding = DefaultContentEncoding, - string contentLanguage = DefaultContentLanguage, - string contentDisposition = DefaultContentDisposition, - string cacheControl = DefaultCacheControl, - JobPartPlanBlockBlobTier blockBlobTier = DefaultBlockBlobTier, - JobPartPlanPageBlobTier pageBlobTier = DefaultPageBlobTier, - bool putMd5 = false, - IDictionary metadata = default, - IDictionary blobTags = default, - bool isSourceEncrypted = false, - string cpkScopeInfo = DefaultCpkScopeInfo, - long blockSize = DefaultBlockSize, - bool preserveLastModifiedTime = false, - byte checksumVerificationOption = DefaultChecksumVerificationOption, - bool preserveSMBPermissions = false, - bool preserveSMBInfo = false, - bool s2sGetPropertiesInBackend = false, - bool s2sSourceChangeValidation = false, - bool destLengthValidation = false, - byte s2sInvalidMetadataHandleOption = DefaultS2sInvalidMetadataHandleOption, - JobPartDeleteSnapshotsOption deleteSnapshotsOption = DefaultDeleteSnapshotsOption, - JobPartPermanentDeleteOption permanentDeleteOption = DefaultPermanentDeleteOption, - JobPartPlanRehydratePriorityType rehydratePriorityType = DefaultRehydratePriorityType, - DataTransferStatus atomicJobStatus = default, - DataTransferStatus atomicPartStatus = default) + DataTransferStatus jobPartStatus = default) { - if (startTime == default) - { - startTime = DefaultStartTime; - } - if (ttlAfterCompletion == default) + if (createTime == default) { - ttlAfterCompletion = DefaultTtlAfterCompletion; + createTime = DefaultCreateTime; } - metadata ??= DataProvider.BuildMetadata(); - blobTags ??= DataProvider.BuildTags(); - atomicJobStatus ??= DefaultJobStatus; - atomicPartStatus ??= DefaultPartStatus; - - JobPartPlanDestinationBlob dstBlobData = new JobPartPlanDestinationBlob( - blobType: blobType, - noGuessMimeType: noGuessMimeType, - contentType: contentType, - contentEncoding: contentEncoding, - contentLanguage: contentLanguage, - contentDisposition: contentDisposition, - cacheControl: cacheControl, - blockBlobTier: blockBlobTier, - pageBlobTier: pageBlobTier, - putMd5: putMd5, - metadata: metadata, - blobTags: blobTags, - isSourceEncrypted: isSourceEncrypted, - cpkScopeInfo: cpkScopeInfo, - blockSize: blockSize); - - JobPartPlanDestinationLocal dstLocalData = new JobPartPlanDestinationLocal( - preserveLastModifiedTime: preserveLastModifiedTime, - checksumVerificationOption: checksumVerificationOption); + jobPartStatus ??= DefaultPartStatus; return new JobPartPlanHeader( - version: version, - startTime: startTime, - transferId: transferId, - partNumber: partNumber, - sourceResourceId: sourceResourceId, - sourcePath: sourcePath, - sourceExtraQuery: sourceExtraQuery, - destinationResourceId: destinationResourceId, - destinationPath: destinationPath, - destinationExtraQuery: destinationExtraQuery, - isFinalPart: isFinalPart, - forceWrite: forceWrite, - forceIfReadOnly: forceIfReadOnly, - autoDecompress: autoDecompress, - priority: priority, - ttlAfterCompletion: ttlAfterCompletion, - jobPlanOperation: fromTo, - folderPropertyMode: folderPropertyMode, - numberChunks: numberChunks, - dstBlobData: dstBlobData, - dstLocalData: dstLocalData, - preserveSMBPermissions: preserveSMBPermissions, - preserveSMBInfo: preserveSMBInfo, - s2sGetPropertiesInBackend: s2sGetPropertiesInBackend, - s2sSourceChangeValidation: s2sSourceChangeValidation, - destLengthValidation: destLengthValidation, - s2sInvalidMetadataHandleOption: s2sInvalidMetadataHandleOption, - deleteSnapshotsOption: deleteSnapshotsOption, - permanentDeleteOption: permanentDeleteOption, - rehydratePriorityType: rehydratePriorityType, - atomicJobStatus: atomicJobStatus, - atomicPartStatus: atomicPartStatus); + version, + transferId, + partNumber, + createTime, + sourceTypeId, + destinationTypeId, + sourcePath, + destinationPath, + overwrite, + initialTransferSize, + chunkSize, + priority, + jobPartStatus); } - internal static async Task AssertJobPlanHeaderAsync(JobPartPlanHeader header, Stream stream) + internal static async Task AssertJobPlanHeaderAsync( + this TransferCheckpointer checkpointer, + string transferId, + int partNumber, + JobPartPlanHeader expectedHeader) { - int headerSize = DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes; - using var originalHeaderStream = new MemoryStream(headerSize); - header.Serialize(originalHeaderStream); - originalHeaderStream.Seek(0, SeekOrigin.Begin); - stream.Seek(0, SeekOrigin.Begin); - - for (var i = 0; i < headerSize; i += (int)DefaultBlockSize * 5 / 2) + JobPartPlanHeader actualHeader; + using (Stream actualStream = await checkpointer.ReadJobPartPlanFileAsync( + transferId: transferId, + partNumber: partNumber, + offset: 0, + length: 0)) // Read whole file { - var startIndex = i; - var count = Math.Min((int)DefaultBlockSize, (int)(headerSize - startIndex)); - - var buffer = new byte[count]; - var actual = new byte[count]; - stream.Seek(i, SeekOrigin.Begin); - originalHeaderStream.Seek(i, SeekOrigin.Begin); - await stream.ReadAsync(buffer, 0, count); - await originalHeaderStream.ReadAsync(actual, 0, count); - - CollectionAssert.AreEqual( - actual, - buffer); + actualHeader = JobPartPlanHeader.Deserialize(actualStream); } + + Assert.That(actualHeader.Equals(expectedHeader)); } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanFileNameTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanFileNameTests.cs index 4d08a6904208c..af1352f5e7fdd 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanFileNameTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanFileNameTests.cs @@ -11,8 +11,6 @@ namespace Azure.Storage.DataMovement.Tests { public class JobPartPlanFileNameTests { - private string schemaVersion = DataMovementConstants.JobPartPlanFile.SchemaVersion; - public JobPartPlanFileNameTests() { } @@ -20,120 +18,99 @@ public JobPartPlanFileNameTests() [Test] public void Ctor() { - // "12345678-1234-1234-1234-123456789abc--001.steV01" + // "12345678-1234-1234-1234-123456789abc.00001.ndmpart" // Transfer Id: 12345678-1234-1234-1234-123456789abc - // Part Num: 001 - JobPartPlanFileName jobFileName = new JobPartPlanFileName($"12345678-1234-1234-1234-123456789abc--00001.steV{schemaVersion}"); + // Part Num: 1 + JobPartPlanFileName jobFileName = new JobPartPlanFileName($"12345678-1234-1234-1234-123456789abc.00001.ndmpart"); Assert.AreEqual("", jobFileName.PrefixPath); Assert.AreEqual("12345678-1234-1234-1234-123456789abc", jobFileName.Id); Assert.AreEqual(1, jobFileName.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName.SchemaVersion); - // "randomtransferidthataddsupto36charac--jobpart.steV01" + // "randomtransferidthataddsupto36charac.jobpart.ndmpart" // Transfer Id: randomtransferidthataddsupto36charac - // Part Num: 001 - JobPartPlanFileName jobFileName2 = new JobPartPlanFileName($"randomtransferidthataddsupto36charac--00001.steV{schemaVersion}"); + // Part Num: 1 + JobPartPlanFileName jobFileName2 = new JobPartPlanFileName($"randomtransferidthataddsupto36charac.00210.ndmpart"); Assert.AreEqual("", jobFileName.PrefixPath); Assert.AreEqual("randomtransferidthataddsupto36charac", jobFileName2.Id); - Assert.AreEqual(1, jobFileName2.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName2.SchemaVersion); - - // "abcdefgh-abcd-abcd-abcd-123456789abc.steV02" - // Transfer Id: abcdefgh-abcd-abcd-abcd-123456789abc - // Part Num: 210 - JobPartPlanFileName jobFileName3 = new JobPartPlanFileName($"abcdefgh-abcd-abcd-abcd-123456789abc--00210.steV{schemaVersion}"); - - Assert.AreEqual("", jobFileName.PrefixPath); - Assert.AreEqual("abcdefgh-abcd-abcd-abcd-123456789abc", jobFileName3.Id); - Assert.AreEqual(210, jobFileName3.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName3.SchemaVersion); + Assert.AreEqual(210, jobFileName2.JobPartNumber); } [Test] public void Ctor_FullPath() { - // "12345678-1234-1234-1234-123456789abc--00001.steV01" + // "12345678-1234-1234-1234-123456789abc.00001.ndmpart" // Transfer Id: 12345678-1234-1234-1234-123456789abc - // Part Num: 001 + // Part Num: 1 string tempPath = Path.GetTempPath().TrimEnd(Path.DirectorySeparatorChar); - string pathName1 = Path.Combine(tempPath, $"12345678-1234-1234-1234-123456789abc--00001.steV{schemaVersion}"); + string pathName1 = Path.Combine(tempPath, $"12345678-1234-1234-1234-123456789abc.00001.ndmpart"); JobPartPlanFileName jobFileName = new JobPartPlanFileName(pathName1); Assert.AreEqual(tempPath, jobFileName.PrefixPath); Assert.AreEqual("12345678-1234-1234-1234-123456789abc", jobFileName.Id); Assert.AreEqual(1, jobFileName.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName.SchemaVersion); - // "randomtransferidthataddsupto36charac--00001.steV01" + // "randomtransferidthataddsupto36charac.00001.ndmpart" // Transfer Id: randomtransferidthataddsupto36charac - // Part Num: 001 - string pathName2 = Path.Combine(tempPath, $"randomtransferidthataddsupto36charac--00001.steV{schemaVersion}"); + // Part Num: 1 + string pathName2 = Path.Combine(tempPath, $"randomtransferidthataddsupto36charac.00001.ndmpart"); JobPartPlanFileName jobFileName2 = new JobPartPlanFileName(pathName2); Assert.AreEqual(tempPath, jobFileName2.PrefixPath); Assert.AreEqual("randomtransferidthataddsupto36charac", jobFileName2.Id); Assert.AreEqual(1, jobFileName2.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName2.SchemaVersion); - // "abcdefgh-abcd-abcd-abcd-123456789abc--00210.steV02" + // "abcdefgh-abcd-abcd-abcd-123456789abc.00210.ndmpart" // Transfer Id: abcdefgh-abcd-abcd-abcd-123456789abc // Part Num: 210 string prefixPath3 = Path.Combine("folder", "sub"); - string pathName3 = Path.Combine(prefixPath3, $"abcdefgh-abcd-abcd-abcd-123456789abc--00210.steV{schemaVersion}"); + string pathName3 = Path.Combine(prefixPath3, $"abcdefgh-abcd-abcd-abcd-123456789abc.00210.ndmpart"); JobPartPlanFileName jobFileName3 = new JobPartPlanFileName(pathName3); Assert.AreEqual(prefixPath3, jobFileName3.PrefixPath); Assert.AreEqual("abcdefgh-abcd-abcd-abcd-123456789abc", jobFileName3.Id); Assert.AreEqual(210, jobFileName3.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName3.SchemaVersion); } [Test] public void Ctor_Divided() { - // "12345678-1234-1234-1234-123456789abc--001.steV01" + // "12345678-1234-1234-1234-123456789abc.001.ndmpart" // Transfer Id: 12345678-1234-1234-1234-123456789abc // Part Num: 001 JobPartPlanFileName jobFileName = new JobPartPlanFileName( checkpointerPath: "C:\\folder\\subfolder", id: "12345678-1234-1234-1234-123456789abc", - jobPartNumber: 1, - schemaVersion: schemaVersion); + jobPartNumber: 1); Assert.AreEqual("C:\\folder\\subfolder", jobFileName.PrefixPath); Assert.AreEqual("12345678-1234-1234-1234-123456789abc", jobFileName.Id); Assert.AreEqual(1, jobFileName.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName.SchemaVersion); - // "randomtransferidthataddsupto36charac--jobpart.steV01" + // "randomtransferidthataddsupto36charac.jobpart.ndmpart" // Transfer Id: randomtransferidthataddsupto36charac - // Part Num: 001 + // Part Num: 1 JobPartPlanFileName jobFileName2 = new JobPartPlanFileName( checkpointerPath: "F:\\folder\\foo", id: "randomtransferidthataddsupto36charac", - jobPartNumber: 1, - schemaVersion: schemaVersion); + jobPartNumber: 1); Assert.AreEqual("F:\\folder\\foo", jobFileName2.PrefixPath); Assert.AreEqual("randomtransferidthataddsupto36charac", jobFileName2.Id); Assert.AreEqual(1, jobFileName2.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName2.SchemaVersion); - // "abcdefgh-abcd-abcd-abcd-123456789abc.steV02" + // "abcdefgh-abcd-abcd-abcd-123456789abc.00210.ndmpart" // Transfer Id: abcdefgh-abcd-abcd-abcd-123456789abc // Part Num: 210 JobPartPlanFileName jobFileName3 = new JobPartPlanFileName( checkpointerPath: "\\folder\\sub", id: "abcdefgh-abcd-abcd-abcd-123456789abc", - jobPartNumber: 210, - schemaVersion: schemaVersion); + jobPartNumber: 210); Assert.AreEqual("\\folder\\sub", jobFileName3.PrefixPath); Assert.AreEqual("abcdefgh-abcd-abcd-abcd-123456789abc", jobFileName3.Id); Assert.AreEqual(210, jobFileName3.JobPartNumber); - Assert.AreEqual(schemaVersion, jobFileName3.SchemaVersion); } [Test] @@ -152,56 +129,47 @@ public void Ctor_Error() e => e.Message.Contains("Invalid Job Part Plan File")); TestHelper.AssertExpectedException( - () => new JobPartPlanFileName("invalidJobId--001.steV01"), + () => new JobPartPlanFileName("invalidJobId.001.ndmpart"), e => e.Message.Contains("Invalid Checkpoint File")); TestHelper.AssertExpectedException( - () => new JobPartPlanFileName("abcdefgh-abcd-abcd-abcd-123456789abc--XY.steV01"), + () => new JobPartPlanFileName("abcdefgh-abcd-abcd-abcd-123456789abc.XY.ndmpart"), e => e.Message.Contains("Invalid Job Part Plan File")); TestHelper.AssertExpectedException( - () => new JobPartPlanFileName("abcdefgh-abcd-abcd-abcd-123456789abc--001.txt"), + () => new JobPartPlanFileName("abcdefgh-abcd-abcd-abcd-123456789abc.001.txt"), e => e.Message.Contains("Invalid Job Part Plan File")); } [Test] public void ToStringTest() { - // "12345678-1234-1234-1234-123456789abc--001.steV01" - string originalPath = $"12345678-1234-1234-1234-123456789abc--00001.steV{schemaVersion}"; + string originalPath = $"12345678-1234-1234-1234-123456789abc.00001.ndmpart"; JobPartPlanFileName jobFileName = new JobPartPlanFileName(originalPath); Assert.AreEqual(originalPath, jobFileName.ToString()); - // "randomtransferidthataddsupto36charac--jobpart.steV01" - string originalPath2 = $"randomtransferidthataddsupto36charac--00001.steV{schemaVersion}"; + string originalPath2 = $"randomtransferidthataddsupto36charac.00210.ndmpart"; JobPartPlanFileName jobFileName2 = new JobPartPlanFileName(originalPath2); Assert.AreEqual(originalPath2, jobFileName2.ToString()); - - // "abcdefgh-abcd-abcd-abcd-123456789abc.steV02" - string originalPath3 = $"abcdefgh-abcd-abcd-abcd-123456789abc--00210.steV{schemaVersion}"; - JobPartPlanFileName jobFileName3 = new JobPartPlanFileName(originalPath3); - Assert.AreEqual(originalPath3, jobFileName3.ToString()); } [Test] public void ToString_FullPath() { - // "C:/folder/subfolder/12345678-1234-1234-1234-123456789abc--00001.steV01" + // "C:/folder/subfolder/12345678-1234-1234-1234-123456789abc.00001.ndmpart" string tempPath = Path.GetTempPath().TrimEnd(Path.DirectorySeparatorChar); - string originalPath = Path.Combine(tempPath, $"12345678-1234-1234-1234-123456789abc--00001.steV{schemaVersion}"); + string originalPath = Path.Combine(tempPath, $"12345678-1234-1234-1234-123456789abc.00001.ndmpart"); JobPartPlanFileName jobFileName = new JobPartPlanFileName(originalPath); Assert.AreEqual(originalPath, jobFileName.ToString()); - // "F:/folder/foo/randomtransferidthataddsupto36charac--00001.steV01" - string originalPath2 = Path.Combine(tempPath, $"randomtransferidthataddsupto36charac--00001.steV{schemaVersion}"); + // "F:/folder/foo/randomtransferidthataddsupto36charac.00001.ndmpart" + string originalPath2 = Path.Combine(tempPath, $"randomtransferidthataddsupto36charac.00001.ndmpart"); JobPartPlanFileName jobFileName2 = new JobPartPlanFileName(originalPath2); Assert.AreEqual(originalPath2, jobFileName2.ToString()); - // "/folder/sub/abcdefgh-abcd-abcd-abcd-123456789abc--00210.steV02" - // Transfer Id: abcdefgh-abcd-abcd-abcd-123456789abc - // Part Num: 210 + // "/folder/sub/abcdefgh-abcd-abcd-abcd-123456789abc.00210.ndmpart" string prefixPath3 = Path.Combine("folder", "sub"); - string originalPath3 = Path.Combine(prefixPath3, $"abcdefgh-abcd-abcd-abcd-123456789abc--00210.steV{schemaVersion}"); + string originalPath3 = Path.Combine(prefixPath3, $"abcdefgh-abcd-abcd-abcd-123456789abc.00210.ndmpart"); JobPartPlanFileName jobFileName3 = new JobPartPlanFileName(originalPath3); Assert.AreEqual(originalPath3, jobFileName3.ToString()); } @@ -209,35 +177,30 @@ public void ToString_FullPath() [Test] public void ToString_Divided() { - // "C:/folder/subfolder/12345678-1234-1234-1234-123456789abc--00001.steV01" + // "C:/folder/subfolder/12345678-1234-1234-1234-123456789abc.00001.ndmpart" string tempPath = Path.GetTempPath().TrimEnd(Path.DirectorySeparatorChar); - string originalPath = Path.Combine(tempPath, $"12345678-1234-1234-1234-123456789abc--00001.steV{schemaVersion}"); + string originalPath = Path.Combine(tempPath, $"12345678-1234-1234-1234-123456789abc.00001.ndmpart"); JobPartPlanFileName jobFileName = new JobPartPlanFileName( checkpointerPath: tempPath, id: "12345678-1234-1234-1234-123456789abc", - jobPartNumber: 1, - schemaVersion: schemaVersion); + jobPartNumber: 1); Assert.AreEqual(originalPath, jobFileName.ToString()); - // "F:/folder/foo/randomtransferidthataddsupto36charac--00001.steV01" - string originalPath2 = Path.Combine(tempPath, $"randomtransferidthataddsupto36charac--00001.steV{schemaVersion}"); + // "F:/folder/foo/randomtransferidthataddsupto36charac.00001.ndmpart" + string originalPath2 = Path.Combine(tempPath, $"randomtransferidthataddsupto36charac.00001.ndmpart"); JobPartPlanFileName jobFileName2 = new JobPartPlanFileName( checkpointerPath: tempPath, id: "randomtransferidthataddsupto36charac", - jobPartNumber: 1, - schemaVersion: schemaVersion); + jobPartNumber: 1); Assert.AreEqual(originalPath2, jobFileName2.ToString()); - // "/folder/sub/abcdefgh-abcd-abcd-abcd-123456789abc--00210.steV02" - // Transfer Id: abcdefgh-abcd-abcd-abcd-123456789abc - // Part Num: 210 + // "/folder/sub/abcdefgh-abcd-abcd-abcd-123456789abc.00210.ndmpart" string prefixPath3 = Path.Combine("folder", "sub"); - string originalPath3 = Path.Combine(prefixPath3, $"abcdefgh-abcd-abcd-abcd-123456789abc--00210.steV{schemaVersion}"); + string originalPath3 = Path.Combine(prefixPath3, $"abcdefgh-abcd-abcd-abcd-123456789abc.00210.ndmpart"); JobPartPlanFileName jobFileName3 = new JobPartPlanFileName( checkpointerPath: prefixPath3, id: "abcdefgh-abcd-abcd-abcd-123456789abc", - jobPartNumber: 210, - schemaVersion: schemaVersion); + jobPartNumber: 210); Assert.AreEqual(originalPath3, jobFileName3.ToString()); } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanHeaderTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanHeaderTests.cs index cd555c0942471..087bcc27f643d 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanHeaderTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanHeaderTests.cs @@ -2,11 +2,8 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.IO; -using System.Threading.Tasks; using Azure.Storage.DataMovement.JobPlan; -using Azure.Storage.Test; using NUnit.Framework; using static Azure.Storage.DataMovement.Tests.CheckpointerTesting; @@ -14,17 +11,6 @@ namespace Azure.Storage.DataMovement.Tests { public class JobPartPlanHeaderTests : DataMovementTestBase { - private static string DictionaryToString(IDictionary dict) - { - string concatStr = ""; - foreach (KeyValuePair kv in dict) - { - // e.g. store like "header=value;" - concatStr = string.Concat(concatStr, $"{kv.Key}={kv.Value};"); - } - return concatStr; - } - public JobPartPlanHeaderTests(bool async) : base(async, default) { } @@ -32,392 +18,42 @@ public JobPartPlanHeaderTests(bool async) : base(async, default) [Test] public void Ctor() { - IDictionary metadata = DataProvider.BuildMetadata(); - IDictionary blobTags = DataProvider.BuildTags(); - - JobPartPlanHeader header = CreateDefaultJobPartHeader( - metadata: metadata, - blobTags: blobTags); + JobPartPlanHeader header = CreateDefaultJobPartHeader(); - Assert.AreEqual(header.Version, DataMovementConstants.JobPartPlanFile.SchemaVersion); - Assert.AreEqual(header.StartTime, DefaultStartTime); - Assert.AreEqual(header.TransferId, DefaultTransferId); - Assert.AreEqual(header.PartNumber, DefaultPartNumber); - Assert.AreEqual(header.SourceResourceId, DefaultSourceResourceId); - Assert.AreEqual(header.SourcePath, DefaultSourcePath); - Assert.AreEqual(header.SourcePathLength, DefaultSourcePath.Length); - Assert.AreEqual(header.SourceExtraQuery, DefaultSourceQuery); - Assert.AreEqual(header.SourceExtraQueryLength, DefaultSourceQuery.Length); - Assert.AreEqual(header.DestinationResourceId, DefaultDestinationResourceId); - Assert.AreEqual(header.DestinationPath, DefaultDestinationPath); - Assert.AreEqual(header.DestinationPathLength, DefaultDestinationPath.Length); - Assert.AreEqual(header.DestinationExtraQuery, DefaultDestinationQuery); - Assert.AreEqual(header.DestinationExtraQueryLength, DefaultDestinationQuery.Length); - Assert.IsFalse(header.IsFinalPart); - Assert.IsFalse(header.ForceWrite); - Assert.IsFalse(header.ForceIfReadOnly); - Assert.IsFalse(header.AutoDecompress); - Assert.AreEqual(header.Priority, DefaultPriority); - Assert.AreEqual(header.TTLAfterCompletion, DefaultTtlAfterCompletion); - Assert.AreEqual(header.JobPlanOperation, DefaultJobPlanOperation); - Assert.AreEqual(header.FolderPropertyMode, DefaultFolderPropertiesMode); - Assert.AreEqual(header.NumberChunks, DefaultNumberChunks); - Assert.AreEqual(header.DstBlobData.BlobType, DefaultBlobType); - Assert.IsFalse(header.DstBlobData.NoGuessMimeType); - Assert.AreEqual(header.DstBlobData.ContentType, DefaultContentType); - Assert.AreEqual(header.DstBlobData.ContentTypeLength, DefaultContentType.Length); - Assert.AreEqual(header.DstBlobData.ContentEncoding, DefaultContentEncoding); - Assert.AreEqual(header.DstBlobData.ContentEncodingLength, DefaultContentEncoding.Length); - Assert.AreEqual(header.DstBlobData.ContentLanguage, DefaultContentLanguage); - Assert.AreEqual(header.DstBlobData.ContentLanguageLength, DefaultContentLanguage.Length); - Assert.AreEqual(header.DstBlobData.ContentDisposition, DefaultContentDisposition); - Assert.AreEqual(header.DstBlobData.ContentDispositionLength, DefaultContentDisposition.Length); - Assert.AreEqual(header.DstBlobData.CacheControl, DefaultCacheControl); - Assert.AreEqual(header.DstBlobData.CacheControlLength, DefaultCacheControl.Length); - Assert.AreEqual(header.DstBlobData.BlockBlobTier, DefaultBlockBlobTier); - Assert.AreEqual(header.DstBlobData.PageBlobTier, DefaultPageBlobTier); - Assert.IsFalse(header.DstBlobData.PutMd5); - string metadataStr = DictionaryToString(metadata); - Assert.AreEqual(header.DstBlobData.Metadata, metadataStr); - Assert.AreEqual(header.DstBlobData.MetadataLength, metadataStr.Length); - string blobTagsStr = DictionaryToString(blobTags); - Assert.AreEqual(header.DstBlobData.BlobTags, blobTagsStr); - Assert.AreEqual(header.DstBlobData.BlobTagsLength, blobTagsStr.Length); - Assert.IsFalse(header.DstBlobData.IsSourceEncrypted); - Assert.AreEqual(header.DstBlobData.CpkScopeInfo, DefaultCpkScopeInfo); - Assert.AreEqual(header.DstBlobData.CpkScopeInfoLength, DefaultCpkScopeInfo.Length); - Assert.AreEqual(header.DstBlobData.BlockSize, DefaultBlockSize); - Assert.IsFalse(header.DstLocalData.PreserveLastModifiedTime); - Assert.AreEqual(header.DstLocalData.ChecksumVerificationOption, DefaultChecksumVerificationOption); - Assert.IsFalse(header.PreserveSMBPermissions); - Assert.IsFalse(header.PreserveSMBInfo); - Assert.IsFalse(header.S2SGetPropertiesInBackend); - Assert.IsFalse(header.S2SSourceChangeValidation); - Assert.IsFalse(header.DestLengthValidation); - Assert.AreEqual(header.S2SInvalidMetadataHandleOption, DefaultS2sInvalidMetadataHandleOption); - Assert.AreEqual(header.DeleteSnapshotsOption, DefaultDeleteSnapshotsOption); - Assert.AreEqual(header.PermanentDeleteOption, DefaultPermanentDeleteOption); - Assert.AreEqual(header.RehydratePriorityType, DefaultRehydratePriorityType); - Assert.AreEqual(header.AtomicJobStatus, DefaultJobStatus); - Assert.AreEqual(header.AtomicPartStatus, DefaultPartStatus); + Assert.AreEqual(DataMovementConstants.JobPartPlanFile.SchemaVersion, header.Version); + Assert.AreEqual(DefaultTransferId, header.TransferId); + Assert.AreEqual(DefaultPartNumber, header.PartNumber); + Assert.AreEqual(DefaultCreateTime, header.CreateTime); + Assert.AreEqual(DefaultSourceTypeId, header.SourceTypeId); + Assert.AreEqual(DefaultDestinationTypeId, header.DestinationTypeId); + Assert.AreEqual(DefaultSourcePath, header.SourcePath); + Assert.AreEqual(DefaultDestinationPath, header.DestinationPath); + Assert.IsFalse(header.Overwrite); + Assert.AreEqual(DefaultInitialTransferSize, header.InitialTransferSize); + Assert.AreEqual(DefaultChunkSize, header.ChunkSize); + Assert.AreEqual(DefaultPriority, header.Priority); + Assert.AreEqual(DefaultPartStatus, header.JobPartStatus); } [Test] - public async Task Serialize() + public void Serialize() { // Arrange - IDictionary metadata = DataProvider.BuildMetadata(); - IDictionary blobTags = DataProvider.BuildTags(); - - JobPartPlanHeader header = CreateDefaultJobPartHeader( - metadata: metadata, - blobTags: blobTags); + JobPartPlanHeader header = CreateDefaultJobPartHeader(); + string samplePath = Path.Combine("Resources", "SampleJobPartPlanFile.b3.ndmpart"); - using (Stream stream = new MemoryStream(DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) + using (MemoryStream headerStream = new MemoryStream()) + using (FileStream fileStream = File.OpenRead(samplePath)) { // Act - header.Serialize(stream); + header.Serialize(headerStream); // Assert - stream.Position = 0; - - int versionSize = DataMovementConstants.JobPartPlanFile.VersionStrNumBytes; - byte[] versionBuffer = new byte[versionSize]; - await stream.ReadAsync(versionBuffer, 0, versionSize); - Assert.AreEqual(DataMovementConstants.JobPartPlanFile.SchemaVersion.ToByteArray(versionSize), versionBuffer); - - int startTimeSize = DataMovementConstants.LongSizeInBytes; - byte[] startTimeBuffer = new byte[startTimeSize]; - await stream.ReadAsync(startTimeBuffer, 0, startTimeSize); - Assert.AreEqual(DefaultStartTime.Ticks.ToByteArray(startTimeSize), startTimeBuffer); - - int transferIdSize = DataMovementConstants.JobPartPlanFile.TransferIdStrNumBytes; - byte[] transferIdBuffer = new byte[transferIdSize]; - await stream.ReadAsync(transferIdBuffer, 0, transferIdSize); - Assert.AreEqual(DefaultTransferId.ToByteArray(transferIdSize), transferIdBuffer); - - int partNumberSize = DataMovementConstants.LongSizeInBytes; - byte[] partNumberBuffer = new byte[partNumberSize]; - await stream.ReadAsync(partNumberBuffer, 0, partNumberSize); - Assert.AreEqual(DefaultPartNumber.ToByteArray(partNumberSize), partNumberBuffer); - - int sourceResourceIdLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] sourceResourceIdLengthBuffer = new byte[sourceResourceIdLengthSize]; - await stream.ReadAsync(sourceResourceIdLengthBuffer, 0, sourceResourceIdLengthSize); - Assert.AreEqual(((ushort)DefaultSourceResourceId.Length).ToByteArray(sourceResourceIdLengthSize), sourceResourceIdLengthBuffer); - - int sourceResourceIdSize = DataMovementConstants.JobPartPlanFile.ResourceIdNumBytes; - byte[] sourceResourceIdBuffer = new byte[sourceResourceIdSize]; - await stream.ReadAsync(sourceResourceIdBuffer, 0, sourceResourceIdSize); - Assert.AreEqual(DefaultSourceResourceId.ToByteArray(sourceResourceIdSize), sourceResourceIdBuffer); - - int sourcePathLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] sourcePathLengthBuffer = new byte[sourcePathLengthSize]; - await stream.ReadAsync(sourcePathLengthBuffer, 0, sourcePathLengthSize); - Assert.AreEqual(((ushort)DefaultSourcePath.Length).ToByteArray(sourcePathLengthSize), sourcePathLengthBuffer); - - int sourcePathSize = DataMovementConstants.JobPartPlanFile.PathStrNumBytes; - byte[] sourcePathBuffer = new byte[sourcePathSize]; - await stream.ReadAsync(sourcePathBuffer, 0, sourcePathSize); - Assert.AreEqual(DefaultSourcePath.ToByteArray(sourcePathSize), sourcePathBuffer); - - int sourceExtraQueryLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] sourceExtraQueryLengthBuffer = new byte[sourceExtraQueryLengthSize]; - await stream.ReadAsync(sourceExtraQueryLengthBuffer, 0, sourceExtraQueryLengthSize); - Assert.AreEqual(((ushort)DefaultSourceQuery.Length).ToByteArray(sourceExtraQueryLengthSize), sourceExtraQueryLengthBuffer); - - int sourceExtraQuerySize = DataMovementConstants.JobPartPlanFile.ExtraQueryNumBytes; - byte[] sourceExtraQueryBuffer = new byte[sourceExtraQuerySize]; - await stream.ReadAsync(sourceExtraQueryBuffer, 0, sourceExtraQuerySize); - Assert.AreEqual(DefaultSourceQuery.ToByteArray(sourceExtraQuerySize), sourceExtraQueryBuffer); - - int destinationResourceIdLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] destinationResourceIdLengthBuffer = new byte[destinationResourceIdLengthSize]; - await stream.ReadAsync(destinationResourceIdLengthBuffer, 0, destinationResourceIdLengthSize); - Assert.AreEqual(((ushort)DefaultDestinationResourceId.Length).ToByteArray(destinationResourceIdLengthSize), destinationResourceIdLengthBuffer); - - int destinationResourceIdSize = DataMovementConstants.JobPartPlanFile.ResourceIdNumBytes; - byte[] destinationResourceIdBuffer = new byte[destinationResourceIdSize]; - await stream.ReadAsync(destinationResourceIdBuffer, 0, destinationResourceIdSize); - Assert.AreEqual(DefaultDestinationResourceId.ToByteArray(destinationResourceIdSize), destinationResourceIdBuffer); - - int destinationPathLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] destinationPathLengthBuffer = new byte[destinationPathLengthSize]; - await stream.ReadAsync(destinationPathLengthBuffer, 0, destinationPathLengthSize); - Assert.AreEqual(((ushort)DefaultDestinationPath.Length).ToByteArray(destinationPathLengthSize), destinationPathLengthBuffer); - - int destinationPathSize = DataMovementConstants.JobPartPlanFile.PathStrNumBytes; - byte[] destinationPathBuffer = new byte[destinationPathSize]; - await stream.ReadAsync(destinationPathBuffer, 0, destinationPathSize); - Assert.AreEqual(DefaultDestinationPath.ToByteArray(destinationPathSize), destinationPathBuffer); - - int destinationExtraQueryLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] destinationExtraQueryLengthBuffer = new byte[destinationExtraQueryLengthSize]; - await stream.ReadAsync(destinationExtraQueryLengthBuffer, 0, destinationExtraQueryLengthSize); - Assert.AreEqual(((ushort)DefaultDestinationQuery.Length).ToByteArray(destinationExtraQueryLengthSize), destinationExtraQueryLengthBuffer); - - int destinationExtraQuerySize = DataMovementConstants.JobPartPlanFile.ExtraQueryNumBytes; - byte[] destinationExtraQueryBuffer = new byte[destinationExtraQuerySize]; - await stream.ReadAsync(destinationExtraQueryBuffer, 0, destinationExtraQuerySize); - Assert.AreEqual(DefaultDestinationQuery.ToByteArray(destinationExtraQuerySize), destinationExtraQueryBuffer); - - int oneByte = DataMovementConstants.OneByte; - byte[] isFinalPartBuffer = new byte[oneByte]; - await stream.ReadAsync(isFinalPartBuffer, 0, oneByte); - Assert.AreEqual(0, isFinalPartBuffer[0]); - - byte[] forceWriteBuffer = new byte[oneByte]; - await stream.ReadAsync(forceWriteBuffer, 0, forceWriteBuffer.Length); - Assert.AreEqual(0, forceWriteBuffer[0]); - - byte[] forceIfReadOnlyBuffer = new byte[oneByte]; - await stream.ReadAsync(forceIfReadOnlyBuffer, 0, oneByte); - Assert.AreEqual(0, forceIfReadOnlyBuffer[0]); - - byte[] autoDecompressBuffer = new byte[oneByte]; - await stream.ReadAsync(autoDecompressBuffer, 0, oneByte); - Assert.AreEqual(0, autoDecompressBuffer[0]); - - byte[] priorityBuffer = new byte[oneByte]; - await stream.ReadAsync(priorityBuffer, 0, oneByte); - Assert.AreEqual(0, priorityBuffer[0]); - - int ttlAfterCompletionSize = DataMovementConstants.LongSizeInBytes; - byte[] ttlAfterCompletionBuffer = new byte[ttlAfterCompletionSize]; - await stream.ReadAsync(ttlAfterCompletionBuffer, 0, ttlAfterCompletionSize); - Assert.AreEqual(DefaultTtlAfterCompletion.Ticks.ToByteArray(ttlAfterCompletionSize), ttlAfterCompletionBuffer); - - byte[] fromToBuffer = new byte[oneByte]; - await stream.ReadAsync(fromToBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultJobPlanOperation, fromToBuffer[0]); - - byte[] folderPropertyModeBuffer = new byte[oneByte]; - await stream.ReadAsync(folderPropertyModeBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultFolderPropertiesMode, folderPropertyModeBuffer[0]); - - int numberChunksSize = DataMovementConstants.LongSizeInBytes; - byte[] numberChunksBuffer = new byte[numberChunksSize]; - await stream.ReadAsync(numberChunksBuffer, 0, numberChunksSize); - Assert.AreEqual(DefaultNumberChunks.ToByteArray(numberChunksSize), numberChunksBuffer); - - byte[] blobTypeBuffer = new byte[oneByte]; - await stream.ReadAsync(blobTypeBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultBlobType, blobTypeBuffer[0]); - - byte[] noGuessMimeTypeBuffer = new byte[oneByte]; - await stream.ReadAsync(noGuessMimeTypeBuffer, 0, oneByte); - Assert.AreEqual(0, noGuessMimeTypeBuffer[0]); - - int contentTypeLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] contentTypeLengthBuffer = new byte[contentTypeLengthSize]; - await stream.ReadAsync(contentTypeLengthBuffer, 0, contentTypeLengthSize); - Assert.AreEqual(((ushort)DefaultContentType.Length).ToByteArray(contentTypeLengthSize), contentTypeLengthBuffer); - - int contentTypeSize = DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes; - byte[] contentTypeBuffer = new byte[contentTypeSize]; - await stream.ReadAsync(contentTypeBuffer, 0, contentTypeSize); - Assert.AreEqual(DefaultContentType.ToByteArray(contentTypeSize), contentTypeBuffer); - - int contentEncodingLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] contentEncodingLengthBuffer = new byte[contentEncodingLengthSize]; - await stream.ReadAsync(contentEncodingLengthBuffer, 0, contentEncodingLengthSize); - Assert.AreEqual(((ushort)DefaultContentEncoding.Length).ToByteArray(contentEncodingLengthSize), contentEncodingLengthBuffer); + BinaryReader reader = new(fileStream); + byte[] expected = reader.ReadBytes((int)fileStream.Length); + byte[] actual = headerStream.ToArray(); - int contentEncodingSize = DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes; - byte[] contentEncodingBuffer = new byte[contentEncodingSize]; - await stream.ReadAsync(contentEncodingBuffer, 0, contentEncodingSize); - Assert.AreEqual(DefaultContentEncoding.ToByteArray(contentEncodingSize), contentEncodingBuffer); - - int contentLanguageLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] contentLanguageLengthBuffer = new byte[contentLanguageLengthSize]; - await stream.ReadAsync(contentLanguageLengthBuffer, 0, contentLanguageLengthSize); - Assert.AreEqual(((ushort)DefaultContentLanguage.Length).ToByteArray(contentLanguageLengthSize), contentLanguageLengthBuffer); - - int contentLanguageSize = DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes; - byte[] contentLanguageBuffer = new byte[contentLanguageSize]; - await stream.ReadAsync(contentLanguageBuffer, 0, contentLanguageSize); - Assert.AreEqual(DefaultContentLanguage.ToByteArray(contentLanguageSize), contentLanguageBuffer); - - int contentDispositionLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] contentDispositionLengthBuffer = new byte[contentDispositionLengthSize]; - await stream.ReadAsync(contentDispositionLengthBuffer, 0, contentDispositionLengthSize); - Assert.AreEqual(((ushort)DefaultContentDisposition.Length).ToByteArray(contentDispositionLengthSize), contentDispositionLengthBuffer); - - int contentDispositionSize = DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes; - byte[] contentDispositionBuffer = new byte[contentDispositionSize]; - await stream.ReadAsync(contentDispositionBuffer, 0, contentDispositionSize); - Assert.AreEqual(DefaultContentDisposition.ToByteArray(contentDispositionSize), contentDispositionBuffer); - - int cacheControlLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] cacheControlLengthBuffer = new byte[cacheControlLengthSize]; - await stream.ReadAsync(cacheControlLengthBuffer, 0, cacheControlLengthSize); - Assert.AreEqual(((ushort)DefaultCacheControl.Length).ToByteArray(cacheControlLengthSize), cacheControlLengthBuffer); - - int cacheControlSize = DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes; - byte[] cacheControlBuffer = new byte[cacheControlSize]; - await stream.ReadAsync(cacheControlBuffer, 0, cacheControlSize); - Assert.AreEqual(DefaultCacheControl.ToByteArray(cacheControlSize), cacheControlBuffer); - - byte[] blockBlobTierBuffer = new byte[oneByte]; - await stream.ReadAsync(blockBlobTierBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultBlockBlobTier, blockBlobTierBuffer[0]); - - byte[] pageBlobTierBuffer = new byte[oneByte]; - await stream.ReadAsync(pageBlobTierBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultPageBlobTier, pageBlobTierBuffer[0]); - - byte[] putMd5Buffer = new byte[oneByte]; - await stream.ReadAsync(putMd5Buffer, 0, oneByte); - Assert.AreEqual(0, putMd5Buffer[0]); - - string metadataStr = DictionaryToString(metadata); - int metadataLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] metadataLengthBuffer = new byte[metadataLengthSize]; - await stream.ReadAsync(metadataLengthBuffer, 0, metadataLengthSize); - Assert.AreEqual(((ushort)metadataStr.Length).ToByteArray(metadataLengthSize), metadataLengthBuffer); - - int metadataSize = DataMovementConstants.JobPartPlanFile.MetadataStrNumBytes; - byte[] metadataBuffer = new byte[metadataSize]; - await stream.ReadAsync(metadataBuffer, 0, metadataSize); - Assert.AreEqual(metadataStr.ToByteArray(metadataSize), metadataBuffer); - - string blobTagsStr = DictionaryToString(blobTags); - int blobTagsLengthSize = DataMovementConstants.LongSizeInBytes; - byte[] blobTagsLengthBuffer = new byte[blobTagsLengthSize]; - await stream.ReadAsync(blobTagsLengthBuffer, 0, blobTagsLengthSize); - Assert.AreEqual(((long)blobTagsStr.Length).ToByteArray(blobTagsLengthSize), blobTagsLengthBuffer); - - int blobTagsSize = DataMovementConstants.JobPartPlanFile.BlobTagsStrNumBytes; - byte[] blobTagsBuffer = new byte[blobTagsSize]; - await stream.ReadAsync(blobTagsBuffer, 0, blobTagsSize); - Assert.AreEqual(blobTagsStr.ToByteArray(blobTagsSize), blobTagsBuffer); - - byte[] isSourceEncryptedBuffer = new byte[oneByte]; - await stream.ReadAsync(isSourceEncryptedBuffer, 0, oneByte); - Assert.AreEqual(0, isSourceEncryptedBuffer[0]); - - int cpkScopeInfoLengthSize = DataMovementConstants.UShortSizeInBytes; - byte[] cpkScopeInfoLengthBuffer = new byte[cpkScopeInfoLengthSize]; - await stream.ReadAsync(cpkScopeInfoLengthBuffer, 0, cpkScopeInfoLengthSize); - Assert.AreEqual(((ushort)DefaultCpkScopeInfo.Length).ToByteArray(cpkScopeInfoLengthSize), cpkScopeInfoLengthBuffer); - - int cpkScopeInfoSize = DataMovementConstants.JobPartPlanFile.HeaderValueNumBytes; - byte[] cpkScopeInfoBuffer = new byte[cpkScopeInfoSize]; - await stream.ReadAsync(cpkScopeInfoBuffer, 0, cpkScopeInfoSize); - Assert.AreEqual(DefaultCpkScopeInfo.ToByteArray(cpkScopeInfoSize), cpkScopeInfoBuffer); - - int blockSizeLengthSize = DataMovementConstants.LongSizeInBytes; - byte[] blockSizeLengthBuffer = new byte[blockSizeLengthSize]; - await stream.ReadAsync(blockSizeLengthBuffer, 0, blockSizeLengthSize); - Assert.AreEqual(DefaultBlockSize.ToByteArray(blockSizeLengthSize), blockSizeLengthBuffer); - - byte[] preserveLastModifiedTimeBuffer = new byte[oneByte]; - await stream.ReadAsync(preserveLastModifiedTimeBuffer, 0, oneByte); - Assert.AreEqual(0, preserveLastModifiedTimeBuffer[0]); - - byte[] checksumVerificationOptionBuffer = new byte[oneByte]; - await stream.ReadAsync(checksumVerificationOptionBuffer, 0, oneByte); - Assert.AreEqual(DefaultChecksumVerificationOption, checksumVerificationOptionBuffer[0]); - - byte[] preserveSMBPermissionsBuffer = new byte[oneByte]; - await stream.ReadAsync(preserveSMBPermissionsBuffer, 0, oneByte); - Assert.AreEqual(0, preserveSMBPermissionsBuffer[0]); - - byte[] preserveSMBInfoBuffer = new byte[oneByte]; - await stream.ReadAsync(preserveSMBInfoBuffer, 0, oneByte); - Assert.AreEqual(0, preserveSMBInfoBuffer[0]); - - byte[] s2sGetPropertiesInBackendBuffer = new byte[oneByte]; - await stream.ReadAsync(s2sGetPropertiesInBackendBuffer, 0, oneByte); - Assert.AreEqual(0, s2sGetPropertiesInBackendBuffer[0]); - - byte[] s2sSourceChangeValidationBuffer = new byte[oneByte]; - await stream.ReadAsync(s2sSourceChangeValidationBuffer, 0, oneByte); - Assert.AreEqual(0, s2sSourceChangeValidationBuffer[0]); - - byte[] destLengthValidationBuffer = new byte[oneByte]; - await stream.ReadAsync(destLengthValidationBuffer, 0, oneByte); - Assert.AreEqual(0, destLengthValidationBuffer[0]); - - byte[] s2sInvalidMetadataHandleOptionBuffer = new byte[oneByte]; - await stream.ReadAsync(s2sInvalidMetadataHandleOptionBuffer, 0, oneByte); - Assert.AreEqual(DefaultS2sInvalidMetadataHandleOption, s2sInvalidMetadataHandleOptionBuffer[0]); - - byte[] deleteSnapshotsOptionBuffer = new byte[oneByte]; - await stream.ReadAsync(deleteSnapshotsOptionBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultDeleteSnapshotsOption, deleteSnapshotsOptionBuffer[0]); - - byte[] permanentDeleteOptionBuffer = new byte[oneByte]; - await stream.ReadAsync(permanentDeleteOptionBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultPermanentDeleteOption, permanentDeleteOptionBuffer[0]); - - byte[] rehydratePriorityTypeBuffer = new byte[oneByte]; - await stream.ReadAsync(rehydratePriorityTypeBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultRehydratePriorityType, rehydratePriorityTypeBuffer[0]); - - byte[] atomicJobStateBuffer = new byte[oneByte]; - await stream.ReadAsync(atomicJobStateBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultJobStatus.State, atomicJobStateBuffer[0]); - - byte[] atomicJobHasFailedItemsBuffer = new byte[oneByte]; - await stream.ReadAsync(atomicJobHasFailedItemsBuffer, 0, oneByte); - Assert.AreEqual(Convert.ToByte(DefaultJobStatus.HasFailedItems), atomicJobHasFailedItemsBuffer[0]); - - byte[] atomicJobHasSkippedItemsBuffer = new byte[oneByte]; - await stream.ReadAsync(atomicJobHasSkippedItemsBuffer, 0, oneByte); - Assert.AreEqual(Convert.ToByte(DefaultJobStatus.HasSkippedItems), atomicJobHasSkippedItemsBuffer[0]); - - byte[] atomicPartStateBuffer = new byte[oneByte]; - await stream.ReadAsync(atomicPartStateBuffer, 0, oneByte); - Assert.AreEqual((byte)DefaultPartStatus.State, atomicPartStateBuffer[0]); - - byte[] atomiPartHasFailedItemsBuffer = new byte[oneByte]; - await stream.ReadAsync(atomiPartHasFailedItemsBuffer, 0, oneByte); - Assert.AreEqual(Convert.ToByte(DefaultJobStatus.HasFailedItems), atomiPartHasFailedItemsBuffer[0]); - - byte[] atomicPartHasSkippedItemsBuffer = new byte[oneByte]; - await stream.ReadAsync(atomicPartHasSkippedItemsBuffer, 0, oneByte); - Assert.AreEqual(Convert.ToByte(DefaultJobStatus.HasSkippedItems), atomicPartHasSkippedItemsBuffer[0]); + CollectionAssert.AreEqual(expected, actual); } } @@ -434,22 +70,16 @@ public void Serialize_Error() } [Test] - public void Deserialize() + public void Deserialize() { - // Arrange - IDictionary metadata = DataProvider.BuildMetadata(); - IDictionary blobTags = DataProvider.BuildTags(); - - JobPartPlanHeader header = CreateDefaultJobPartHeader( - metadata: metadata, - blobTags: blobTags); + JobPartPlanHeader header = CreateDefaultJobPartHeader(); - using (Stream stream = new MemoryStream(DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) + using (Stream stream = new MemoryStream()) { header.Serialize(stream); // Act / Assert - DeserializeAndVerify(stream, DataMovementConstants.JobPartPlanFile.SchemaVersion, metadata, blobTags); + DeserializeAndVerify(stream, DataMovementConstants.JobPartPlanFile.SchemaVersion); } } @@ -485,97 +115,42 @@ public void Deserialize_File_Version_b2() public void Deserialize_File_Version_b3() { // Arrange - string samplePath = Path.Combine("Resources", "SampleJobPartPlanFile.steVb3"); + string samplePath = Path.Combine("Resources", "SampleJobPartPlanFile.b3.ndmpart"); using (FileStream stream = File.OpenRead(samplePath)) { // Act / Assert - DeserializeAndVerify(stream, DataMovementConstants.JobPartPlanFile.SchemaVersion_b3, DataProvider.BuildMetadata(), DataProvider.BuildTags()); + DeserializeAndVerify(stream, DataMovementConstants.JobPartPlanFile.SchemaVersion_b3); } } [Test] public void Deserialize_Error() { - // Arrange - JobPartPlanHeader header = CreateDefaultJobPartHeader(); - // Act / Assert Assert.Catch( () => JobPartPlanHeader.Deserialize(default)); } private void DeserializeAndVerify( - Stream stream, - string schemaVersion, - IDictionary metadata, - IDictionary blobTags) + Stream stream, + string schemaVersion) { JobPartPlanHeader deserializedHeader = JobPartPlanHeader.Deserialize(stream); // Assert - Assert.AreEqual(deserializedHeader.Version, schemaVersion); - Assert.AreEqual(deserializedHeader.StartTime, DefaultStartTime); - Assert.AreEqual(deserializedHeader.TransferId, DefaultTransferId); - Assert.AreEqual(deserializedHeader.PartNumber, DefaultPartNumber); - Assert.AreEqual(deserializedHeader.SourcePath, DefaultSourcePath); - Assert.AreEqual(deserializedHeader.SourcePathLength, DefaultSourcePath.Length); - Assert.AreEqual(deserializedHeader.SourceExtraQuery, DefaultSourceQuery); - Assert.AreEqual(deserializedHeader.SourceExtraQueryLength, DefaultSourceQuery.Length); - Assert.AreEqual(deserializedHeader.DestinationPath, DefaultDestinationPath); - Assert.AreEqual(deserializedHeader.DestinationPathLength, DefaultDestinationPath.Length); - Assert.AreEqual(deserializedHeader.DestinationExtraQuery, DefaultDestinationQuery); - Assert.AreEqual(deserializedHeader.DestinationExtraQueryLength, DefaultDestinationQuery.Length); - Assert.IsFalse(deserializedHeader.IsFinalPart); - Assert.IsFalse(deserializedHeader.ForceWrite); - Assert.IsFalse(deserializedHeader.ForceIfReadOnly); - Assert.IsFalse(deserializedHeader.AutoDecompress); - Assert.AreEqual(deserializedHeader.Priority, DefaultPriority); - Assert.AreEqual(deserializedHeader.TTLAfterCompletion, DefaultTtlAfterCompletion); - Assert.AreEqual(deserializedHeader.JobPlanOperation, DefaultJobPlanOperation); - Assert.AreEqual(deserializedHeader.FolderPropertyMode, DefaultFolderPropertiesMode); - Assert.AreEqual(deserializedHeader.NumberChunks, DefaultNumberChunks); - Assert.AreEqual(deserializedHeader.DstBlobData.BlobType, DefaultBlobType); - Assert.IsFalse(deserializedHeader.DstBlobData.NoGuessMimeType); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentType, DefaultContentType); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentTypeLength, DefaultContentType.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentEncoding, DefaultContentEncoding); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentEncodingLength, DefaultContentEncoding.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentLanguage, DefaultContentLanguage); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentLanguageLength, DefaultContentLanguage.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentDisposition, DefaultContentDisposition); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentDispositionLength, DefaultContentDisposition.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.CacheControl, DefaultCacheControl); - Assert.AreEqual(deserializedHeader.DstBlobData.CacheControlLength, DefaultCacheControl.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.BlockBlobTier, DefaultBlockBlobTier); - Assert.AreEqual(deserializedHeader.DstBlobData.PageBlobTier, DefaultPageBlobTier); - Assert.IsFalse(deserializedHeader.DstBlobData.PutMd5); - string metadataStr = DictionaryToString(metadata); - Assert.AreEqual(deserializedHeader.DstBlobData.Metadata, metadataStr); - Assert.AreEqual(deserializedHeader.DstBlobData.MetadataLength, metadataStr.Length); - string blobTagsStr = DictionaryToString(blobTags); - Assert.AreEqual(deserializedHeader.DstBlobData.BlobTags, blobTagsStr); - Assert.AreEqual(deserializedHeader.DstBlobData.BlobTagsLength, blobTagsStr.Length); - Assert.IsFalse(deserializedHeader.DstBlobData.IsSourceEncrypted); - Assert.AreEqual(deserializedHeader.DstBlobData.CpkScopeInfo, DefaultCpkScopeInfo); - Assert.AreEqual(deserializedHeader.DstBlobData.CpkScopeInfoLength, DefaultCpkScopeInfo.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.BlockSize, DefaultBlockSize); - Assert.IsFalse(deserializedHeader.DstLocalData.PreserveLastModifiedTime); - Assert.AreEqual(deserializedHeader.DstLocalData.ChecksumVerificationOption, DefaultChecksumVerificationOption); - Assert.IsFalse(deserializedHeader.PreserveSMBPermissions); - Assert.IsFalse(deserializedHeader.PreserveSMBInfo); - Assert.IsFalse(deserializedHeader.S2SGetPropertiesInBackend); - Assert.IsFalse(deserializedHeader.S2SSourceChangeValidation); - Assert.IsFalse(deserializedHeader.DestLengthValidation); - Assert.AreEqual(deserializedHeader.S2SInvalidMetadataHandleOption, DefaultS2sInvalidMetadataHandleOption); - Assert.AreEqual(deserializedHeader.DeleteSnapshotsOption, DefaultDeleteSnapshotsOption); - Assert.AreEqual(deserializedHeader.PermanentDeleteOption, DefaultPermanentDeleteOption); - Assert.AreEqual(deserializedHeader.RehydratePriorityType, DefaultRehydratePriorityType); - Assert.AreEqual(DefaultJobStatus.State, deserializedHeader.AtomicJobStatus.State); - Assert.AreEqual(DefaultJobStatus.HasFailedItems, deserializedHeader.AtomicJobStatus.HasFailedItems); - Assert.AreEqual(DefaultJobStatus.HasSkippedItems, deserializedHeader.AtomicJobStatus.HasSkippedItems); - Assert.AreEqual(DefaultPartStatus.State, deserializedHeader.AtomicPartStatus.State); - Assert.AreEqual(DefaultPartStatus.HasFailedItems, deserializedHeader.AtomicPartStatus.HasFailedItems); - Assert.AreEqual(DefaultPartStatus.HasSkippedItems, deserializedHeader.AtomicPartStatus.HasSkippedItems); + Assert.AreEqual(schemaVersion, deserializedHeader.Version); + Assert.AreEqual(DefaultTransferId, deserializedHeader.TransferId); + Assert.AreEqual(DefaultPartNumber, deserializedHeader.PartNumber); + Assert.AreEqual(DefaultCreateTime, deserializedHeader.CreateTime); + Assert.AreEqual(DefaultSourceTypeId, deserializedHeader.SourceTypeId); + Assert.AreEqual(DefaultDestinationTypeId, deserializedHeader.DestinationTypeId); + Assert.AreEqual(DefaultSourcePath, deserializedHeader.SourcePath); + Assert.AreEqual(DefaultDestinationPath, deserializedHeader.DestinationPath); + Assert.IsFalse(deserializedHeader.Overwrite); + Assert.AreEqual(DefaultInitialTransferSize, deserializedHeader.InitialTransferSize); + Assert.AreEqual(DefaultChunkSize, deserializedHeader.ChunkSize); + Assert.AreEqual(DefaultPriority, deserializedHeader.Priority); + Assert.AreEqual(DefaultPartStatus, deserializedHeader.JobPartStatus); } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/JobPlanFileTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/JobPlanFileTests.cs index 0f88510834411..f1f1955c15b78 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/JobPlanFileTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/JobPlanFileTests.cs @@ -32,7 +32,7 @@ public async Task CreateJobPlanFileAsync() id: transferId, headerStream: stream); } - string filePath = Path.Combine(test.DirectoryPath, $"{transferId}.{DataMovementConstants.JobPlanFile.FileExtension}"); + string filePath = Path.Combine(test.DirectoryPath, $"{transferId}{DataMovementConstants.JobPlanFile.FileExtension}"); Assert.NotNull(file); Assert.AreEqual(transferId, file.Id); @@ -46,7 +46,7 @@ public async Task LoadExistingJobPlanFile() string transferId = GetNewTransferId(); // Setup existing job plan file - string filePath = Path.Combine(test.DirectoryPath, $"{transferId}.{DataMovementConstants.JobPlanFile.FileExtension}"); + string filePath = Path.Combine(test.DirectoryPath, $"{transferId}{DataMovementConstants.JobPlanFile.FileExtension}"); var data = Encoding.UTF8.GetBytes("Hello World!"); using (FileStream fileStream = File.OpenWrite(filePath)) { diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/LocalDirectoryStorageResourceTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/LocalDirectoryStorageResourceTests.cs index e0801b9795729..b136b68175cb8 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/LocalDirectoryStorageResourceTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/LocalDirectoryStorageResourceTests.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; using NUnit.Framework; @@ -134,5 +135,20 @@ public async Task GetChildStorageResourceAsync_SubDir() await resource.GetPropertiesAsync().ConfigureAwait(false); } } + + [Test] + public void GetChildStorageResourceContainer() + { + using DisposingLocalDirectory test = DisposingLocalDirectory.GetTestDirectory(); + string folderPath = test.DirectoryPath; + + StorageResourceContainer container = new LocalDirectoryStorageResourceContainer(folderPath); + + string childPath = "childPath"; + StorageResourceContainer childContainer = container.GetChildStorageResourceContainer(childPath); + + string fullPath = Path.Combine(folderPath, childPath); + Assert.AreEqual(childContainer.Uri, new Uri(fullPath)); + } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerFactory.cs b/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerFactory.cs index 8d513542bd19c..d3e136a4ed89c 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerFactory.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerFactory.cs @@ -12,40 +12,10 @@ namespace Azure.Storage.DataMovement.Tests internal class LocalTransferCheckpointerFactory { internal const int _partCountDefault = 5; - internal const string _testTransferId = - "c591bacc-5552-4c5c-b068-552685ec5cd5"; - internal const long _testPartNumber = 5; - internal static readonly DateTimeOffset _testStartTime - = new DateTimeOffset(2023, 03, 13, 15, 24, 6, default); internal const string _testSourceProviderId = "test"; - internal const string _testSourceResourceId = "LocalFile"; internal const string _testSourcePath = "C:/sample-source"; - internal const string _testSourceQuery = "sourcequery"; internal const string _testDestinationProviderId = "test"; - internal const string _testDestinationResourceId = "LocalFile"; internal const string _testDestinationPath = "C:/sample-destination"; - internal const string _testDestinationQuery = "destquery"; - internal const byte _testPriority = 0; - internal static readonly DateTimeOffset _testTtlAfterCompletion = DateTimeOffset.MaxValue; - internal const JobPlanOperation _testJobPlanOperation = JobPlanOperation.Upload; - internal const FolderPropertiesMode _testFolderPropertiesMode = FolderPropertiesMode.None; - internal const long _testNumberChunks = 1; - internal const JobPlanBlobType _testBlobType = JobPlanBlobType.BlockBlob; - internal const string _testContentType = "ContentType / type"; - internal const string _testContentEncoding = "UTF8"; - internal const string _testContentLanguage = "content-language"; - internal const string _testContentDisposition = "content-disposition"; - internal const string _testCacheControl = "cache-control"; - internal const JobPartPlanBlockBlobTier _testBlockBlobTier = JobPartPlanBlockBlobTier.None; - internal const JobPartPlanPageBlobTier _testPageBlobTier = JobPartPlanPageBlobTier.None; - internal const string _testCpkScopeInfo = "cpk-scope-info"; - internal const long _testBlockSize = 4 * Constants.KB; - internal const byte _testS2sInvalidMetadataHandleOption = 0; - internal const byte _testChecksumVerificationOption = 0; - internal const JobPartDeleteSnapshotsOption _testDeleteSnapshotsOption = JobPartDeleteSnapshotsOption.None; - internal const JobPartPermanentDeleteOption _testPermanentDeleteOption = JobPartPermanentDeleteOption.None; - internal const JobPartPlanRehydratePriorityType _testRehydratePriorityType = JobPartPlanRehydratePriorityType.None; - internal static readonly DataTransferStatus _testJobStatus = new DataTransferStatus(DataTransferState.Queued, false, false); internal static readonly DataTransferStatus _testPartStatus = new DataTransferStatus(DataTransferState.Queued, false, false); private string _checkpointerPath; @@ -97,8 +67,8 @@ internal void CreateStubJobPartPlanFilesAsync( DataTransferStatus status = default, List sourcePaths = default, List destinationPaths = default, - string sourceResourceId = "LocalFile", - string destinationResourceId = "LocalFile") + string sourceTypeId = "LocalFile", + string destinationTypeId = "LocalFile") { status ??= _testPartStatus; // Populate sourcePaths if not provided @@ -126,19 +96,18 @@ internal void CreateStubJobPartPlanFilesAsync( { // Populate the JobPlanFile with a pseudo job plan header - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber, - sourceResourceId: sourceResourceId, + sourceTypeId: sourceTypeId, + destinationTypeId: destinationTypeId, sourcePath: sourcePaths.ElementAt(partNumber), - destinationResourceId: destinationResourceId, destinationPath: destinationPaths.ElementAt(partNumber), - atomicJobStatus: status, - atomicPartStatus: status); + jobPartStatus: status); JobPartPlanFileName fileName = new JobPartPlanFileName(checkpointerPath, transferId, partNumber); - using (FileStream stream = File.Create(fileName.FullPath, DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) + using (FileStream stream = File.Create(fileName.FullPath)) { header.Serialize(stream); } @@ -176,146 +145,13 @@ internal void CreateStubJobPlanFile( sourceCheckpointData, destinationCheckpointData); - string filePath = Path.Combine(checkpointPath, $"{transferId}.{DataMovementConstants.JobPlanFile.FileExtension}"); + string filePath = Path.Combine(checkpointPath, $"{transferId}{DataMovementConstants.JobPlanFile.FileExtension}"); using (FileStream stream = File.Create(filePath)) { header.Serialize(stream); } } - internal JobPartPlanHeader CreateDefaultJobPartHeader( - string version = DataMovementConstants.JobPartPlanFile.SchemaVersion, - DateTimeOffset startTime = default, - string transferId = _testTransferId, - long partNumber = _testPartNumber, - string sourceResourceId = _testSourceResourceId, - string sourcePath = _testSourcePath, - string sourceExtraQuery = _testSourceQuery, - string destinationResourceId = _testDestinationResourceId, - string destinationPath = _testDestinationPath, - string destinationExtraQuery = _testDestinationQuery, - bool isFinalPart = false, - bool forceWrite = false, - bool forceIfReadOnly = false, - bool autoDecompress = false, - byte priority = _testPriority, - DateTimeOffset ttlAfterCompletion = default, - JobPlanOperation fromTo = _testJobPlanOperation, - FolderPropertiesMode folderPropertyMode = _testFolderPropertiesMode, - long numberChunks = _testNumberChunks, - JobPlanBlobType blobType = _testBlobType, - bool noGuessMimeType = false, - string contentType = _testContentType, - string contentEncoding = _testContentEncoding, - string contentLanguage = _testContentLanguage, - string contentDisposition = _testContentDisposition, - string cacheControl = _testCacheControl, - JobPartPlanBlockBlobTier blockBlobTier = _testBlockBlobTier, - JobPartPlanPageBlobTier pageBlobTier = _testPageBlobTier, - bool putMd5 = false, - IDictionary metadata = default, - IDictionary blobTags = default, - bool isSourceEncrypted = false, - string cpkScopeInfo = _testCpkScopeInfo, - long blockSize = _testBlockSize, - bool preserveLastModifiedTime = false, - byte checksumVerificationOption = _testChecksumVerificationOption, - bool preserveSMBPermissions = false, - bool preserveSMBInfo = false, - bool s2sGetPropertiesInBackend = false, - bool s2sSourceChangeValidation = false, - bool destLengthValidation = false, - byte s2sInvalidMetadataHandleOption = _testS2sInvalidMetadataHandleOption, - JobPartDeleteSnapshotsOption deleteSnapshotsOption = _testDeleteSnapshotsOption, - JobPartPermanentDeleteOption permanentDeleteOption = _testPermanentDeleteOption, - JobPartPlanRehydratePriorityType rehydratePriorityType = _testRehydratePriorityType, - DataTransferStatus atomicJobStatus = default, - DataTransferStatus atomicPartStatus = default) - { - atomicJobStatus ??= _testJobStatus; - atomicPartStatus ??= _testPartStatus; - if (startTime == default) - { - startTime = _testStartTime; - } - if (ttlAfterCompletion == default) - { - ttlAfterCompletion = _testTtlAfterCompletion; - } - metadata ??= BuildMetadata(); - blobTags ??= BuildTags(); - - JobPartPlanDestinationBlob dstBlobData = new JobPartPlanDestinationBlob( - blobType: blobType, - noGuessMimeType: noGuessMimeType, - contentType: contentType, - contentEncoding: contentEncoding, - contentLanguage: contentLanguage, - contentDisposition: contentDisposition, - cacheControl: cacheControl, - blockBlobTier: blockBlobTier, - pageBlobTier: pageBlobTier, - putMd5: putMd5, - metadata: metadata, - blobTags: blobTags, - isSourceEncrypted: isSourceEncrypted, - cpkScopeInfo: cpkScopeInfo, - blockSize: blockSize); - - JobPartPlanDestinationLocal dstLocalData = new JobPartPlanDestinationLocal( - preserveLastModifiedTime: preserveLastModifiedTime, - checksumVerificationOption: checksumVerificationOption); - - return new JobPartPlanHeader( - version: version, - startTime: startTime, - transferId: transferId, - partNumber: partNumber, - sourceResourceId: sourceResourceId, - sourcePath: sourcePath, - sourceExtraQuery: sourceExtraQuery, - destinationResourceId: destinationResourceId, - destinationPath: destinationPath, - destinationExtraQuery: destinationExtraQuery, - isFinalPart: isFinalPart, - forceWrite: forceWrite, - forceIfReadOnly: forceIfReadOnly, - autoDecompress: autoDecompress, - priority: priority, - ttlAfterCompletion: ttlAfterCompletion, - jobPlanOperation: fromTo, - folderPropertyMode: folderPropertyMode, - numberChunks: numberChunks, - dstBlobData: dstBlobData, - dstLocalData: dstLocalData, - preserveSMBPermissions: preserveSMBPermissions, - preserveSMBInfo: preserveSMBInfo, - s2sGetPropertiesInBackend: s2sGetPropertiesInBackend, - s2sSourceChangeValidation: s2sSourceChangeValidation, - destLengthValidation: destLengthValidation, - s2sInvalidMetadataHandleOption: s2sInvalidMetadataHandleOption, - deleteSnapshotsOption: deleteSnapshotsOption, - permanentDeleteOption: permanentDeleteOption, - rehydratePriorityType: rehydratePriorityType, - atomicJobStatus: atomicJobStatus, - atomicPartStatus: atomicPartStatus); - } - public static string GetNewTransferId() => Guid.NewGuid().ToString(); - private IDictionary BuildMetadata() - => new Dictionary(StringComparer.OrdinalIgnoreCase) - { - { "foo", "bar" }, - { "meta", "data" }, - { "Capital", "letter" }, - { "UPPER", "case" } - }; - - private Dictionary BuildTags() - => new Dictionary - { - { "tagKey0", "tagValue0" }, - { "tagKey1", "tagValue1" } - }; } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerTests.cs index ca431b3208b8e..65797ee304285 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerTests.cs @@ -66,7 +66,7 @@ internal void CreateStubJobPartPlanFile( JobPartPlanFileName fileName = new JobPartPlanFileName(checkpointerPath, transferId, i); - using (FileStream stream = File.Create(fileName.FullPath, DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) + using (FileStream stream = File.Create(fileName.FullPath)) { header.Serialize(stream); } @@ -197,7 +197,6 @@ public async Task AddNewJobPartAsync() // Arrange string transferId = GetNewTransferId(); int partNumber = 0; - int chunksTotal = 1; JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -214,7 +213,6 @@ public async Task AddNewJobPartAsync() await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: partNumber, - chunksTotal: chunksTotal, headerStream: stream); } @@ -226,15 +224,7 @@ await transferCheckpointer.AddNewJobPartAsync( int partCount = await transferCheckpointer.CurrentJobPartCountAsync(transferId); Assert.AreEqual(1, partCount); - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: partNumber, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - // Assert - await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); - } + await transferCheckpointer.AssertJobPlanHeaderAsync(transferId, partNumber, header); } [Test] @@ -244,7 +234,6 @@ public async Task AddNewJobPartAsync_Error() string transferId = GetNewTransferId(); int partNumber = 0; - int chunksTotal = 1; JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -260,7 +249,6 @@ public async Task AddNewJobPartAsync_Error() await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: partNumber, - chunksTotal: chunksTotal, headerStream: stream); // Add the same job part twice @@ -268,7 +256,6 @@ await transferCheckpointer.AddNewJobPartAsync( async () => await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: partNumber, - chunksTotal: chunksTotal, headerStream: stream)); } @@ -288,7 +275,6 @@ public async Task AddNewJobPartAsync_MultipleParts() // Add multiple parts for the same job string transferId = GetNewTransferId(); - int chunksTotal = 1; JobPartPlanHeader header1 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 0); @@ -313,7 +299,6 @@ public async Task AddNewJobPartAsync_MultipleParts() await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 0, - chunksTotal: chunksTotal, headerStream: stream); } using (Stream stream = new MemoryStream()) @@ -323,7 +308,6 @@ await transferCheckpointer.AddNewJobPartAsync( await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 1, - chunksTotal: chunksTotal, headerStream: stream); } using (Stream stream = new MemoryStream()) @@ -333,7 +317,6 @@ await transferCheckpointer.AddNewJobPartAsync( await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 2, - chunksTotal: chunksTotal, headerStream: stream); } using (Stream stream = new MemoryStream()) @@ -343,7 +326,6 @@ await transferCheckpointer.AddNewJobPartAsync( await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 3, - chunksTotal: chunksTotal, headerStream: stream); } @@ -352,45 +334,10 @@ await transferCheckpointer.AddNewJobPartAsync( Assert.AreEqual(1, transferIds.Count); Assert.IsTrue(transferIds.Contains(transferId)); - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 0, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - // Assert - await CheckpointerTesting.AssertJobPlanHeaderAsync(header1, stream); - } - - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 1, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - // Assert - await CheckpointerTesting.AssertJobPlanHeaderAsync(header2, stream); - } - - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 2, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - // Assert - await CheckpointerTesting.AssertJobPlanHeaderAsync(header3, stream); - } - - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 3, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - // Assert - await CheckpointerTesting.AssertJobPlanHeaderAsync(header4, stream); - } + await transferCheckpointer.AssertJobPlanHeaderAsync(transferId, 0, header1); + await transferCheckpointer.AssertJobPlanHeaderAsync(transferId, 1, header2); + await transferCheckpointer.AssertJobPlanHeaderAsync(transferId, 2, header3); + await transferCheckpointer.AssertJobPlanHeaderAsync(transferId, 3, header4); } [Test] @@ -413,7 +360,6 @@ public async Task AddNewJobPartAsync_AddAfterRemove() await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 1, - chunksTotal: 2, headerStream: stream); } await transferCheckpointer.TryRemoveStoredTransferAsync(transferId); @@ -425,7 +371,6 @@ await transferCheckpointer.AddNewJobPartAsync( await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 1, - chunksTotal: 2, headerStream: stream); } @@ -434,15 +379,7 @@ await transferCheckpointer.AddNewJobPartAsync( Assert.AreEqual(1, transferIds.Count); Assert.IsTrue(transferIds.Contains(transferId)); - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 1, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - // Assert - await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); - } + await transferCheckpointer.AssertJobPlanHeaderAsync(transferId, 1, header); } [Test] @@ -615,7 +552,6 @@ public async Task CurrentJobPartCountAsync_OneJob() // Arrange string transferId = GetNewTransferId(); int partNumber = 0; - int chunksTotal = 1; JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -631,7 +567,6 @@ public async Task CurrentJobPartCountAsync_OneJob() await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: partNumber, - chunksTotal: chunksTotal, headerStream: stream); } @@ -649,7 +584,6 @@ public async Task CurrentJobPartCountAsync_MultipleJobs() // Arrange string transferId = GetNewTransferId(); - int chunksTotal = 1; JobPartPlanHeader header1 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 0); @@ -674,7 +608,6 @@ public async Task CurrentJobPartCountAsync_MultipleJobs() await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 0, - chunksTotal: chunksTotal, headerStream: stream); } using (Stream stream = new MemoryStream()) @@ -684,7 +617,6 @@ await transferCheckpointer.AddNewJobPartAsync( await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 1, - chunksTotal: chunksTotal, headerStream: stream); } using (Stream stream = new MemoryStream()) @@ -694,7 +626,6 @@ await transferCheckpointer.AddNewJobPartAsync( await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 2, - chunksTotal: chunksTotal, headerStream: stream); } using (Stream stream = new MemoryStream()) @@ -704,7 +635,6 @@ await transferCheckpointer.AddNewJobPartAsync( await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: 3, - chunksTotal: chunksTotal, headerStream: stream); } @@ -793,7 +723,6 @@ public async Task ReadJobPartPlanFileAsync() // Arrange string transferId = GetNewTransferId(); int partNumber = 0; - int chunksTotal = 1; JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -808,20 +737,11 @@ public async Task ReadJobPartPlanFileAsync() await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: partNumber, - chunksTotal: chunksTotal, headerStream: stream); } // Act - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: partNumber, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - // Assert - await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); - } + await transferCheckpointer.AssertJobPlanHeaderAsync(transferId, partNumber, header); } [Test] @@ -841,7 +761,7 @@ public void ReadJobPartPlanFileAsync_Error() transferId: transferId, partNumber: partNumber, offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)); + length: 0)); } [Test] @@ -917,148 +837,24 @@ public async Task SetJobTransferStatusAsync() // Arrange string transferId = GetNewTransferId(); - int partNumber = 0; - int chunksTotal = 1; DataTransferStatus newStatus = SuccessfulCompletedStatus; - JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( - transferId: transferId, - partNumber: partNumber); TransferCheckpointer transferCheckpointer = new LocalTransferCheckpointer(test.DirectoryPath); - await AddJobToCheckpointer(transferCheckpointer, transferId); - using (MemoryStream stream = new MemoryStream()) - { - header.Serialize(stream); - - await transferCheckpointer.AddNewJobPartAsync( - transferId: transferId, - partNumber: partNumber, - chunksTotal: chunksTotal, - headerStream: stream); - } // Act await transferCheckpointer.SetJobTransferStatusAsync(transferId, newStatus); // Assert - header.AtomicJobStatus = newStatus; - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: partNumber, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); - } - } - - [Test] - public async Task SetJobTransferStatusAsync_MultipleParts() - { - using DisposingLocalDirectory test = DisposingLocalDirectory.GetTestDirectory(); - - // Arrange - string transferId = GetNewTransferId(); - int chunksTotal = 1; - DataTransferStatus newStatus = SuccessfulCompletedStatus; - JobPartPlanHeader header1 = CheckpointerTesting.CreateDefaultJobPartHeader( - transferId: transferId, - partNumber: 0); - JobPartPlanHeader header2 = CheckpointerTesting.CreateDefaultJobPartHeader( - transferId: transferId, - partNumber: 1); - JobPartPlanHeader header3 = CheckpointerTesting.CreateDefaultJobPartHeader( - transferId: transferId, - partNumber: 2); - JobPartPlanHeader header4 = CheckpointerTesting.CreateDefaultJobPartHeader( - transferId: transferId, - partNumber: 3); - - TransferCheckpointer transferCheckpointer = new LocalTransferCheckpointer(test.DirectoryPath); - - await AddJobToCheckpointer(transferCheckpointer, transferId); - - using (Stream stream = new MemoryStream()) - { - header1.Serialize(stream); - - await transferCheckpointer.AddNewJobPartAsync( - transferId: transferId, - partNumber: 0, - chunksTotal: chunksTotal, - headerStream: stream); - } - using (Stream stream = new MemoryStream()) - { - header2.Serialize(stream); - - await transferCheckpointer.AddNewJobPartAsync( - transferId: transferId, - partNumber: 1, - chunksTotal: chunksTotal, - headerStream: stream); - } - using (Stream stream = new MemoryStream()) - { - header3.Serialize(stream); - - await transferCheckpointer.AddNewJobPartAsync( - transferId: transferId, - partNumber: 2, - chunksTotal: chunksTotal, - headerStream: stream); - } - using (Stream stream = new MemoryStream()) + using (Stream stream = await transferCheckpointer.ReadJobPlanFileAsync( + transferId, + DataMovementConstants.JobPlanFile.JobStatusIndex, + DataMovementConstants.IntSizeInBytes)) { - header4.Serialize(stream); - - await transferCheckpointer.AddNewJobPartAsync( - transferId: transferId, - partNumber: 3, - chunksTotal: chunksTotal, - headerStream: stream); - } - - // Act - await transferCheckpointer.SetJobTransferStatusAsync(transferId, newStatus); + BinaryReader reader = new BinaryReader(stream); + JobPlanStatus jobPlanStatus = (JobPlanStatus)reader.ReadInt32(); - // Assert - header1.AtomicJobStatus = newStatus; - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 0, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - await CheckpointerTesting.AssertJobPlanHeaderAsync(header1, stream); - } - header2.AtomicJobStatus = newStatus; - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 1, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - await CheckpointerTesting.AssertJobPlanHeaderAsync(header2, stream); - } - header3.AtomicJobStatus = newStatus; - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 2, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - await CheckpointerTesting.AssertJobPlanHeaderAsync(header3, stream); - } - header4.AtomicJobStatus = newStatus; - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: 3, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - await CheckpointerTesting.AssertJobPlanHeaderAsync(header4, stream); + Assert.That(jobPlanStatus.ToDataTransferStatus(), Is.EqualTo(newStatus)); } } @@ -1069,11 +865,7 @@ public void SetJobTransferStatusAsync_Error() // Arrange string transferId = GetNewTransferId(); - int partNumber = 0; DataTransferStatus newStatus = SuccessfulCompletedStatus; - JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( - transferId: transferId, - partNumber: partNumber); TransferCheckpointer transferCheckpointer = new LocalTransferCheckpointer(test.DirectoryPath); @@ -1090,7 +882,6 @@ public async Task SetJobPartTransferStatusAsync() // Arrange string transferId = GetNewTransferId(); int partNumber = 0; - int chunksTotal = 1; // originally the default is set to Queued DataTransferStatus newStatus = SuccessfulCompletedStatus; JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( @@ -1107,7 +898,6 @@ public async Task SetJobPartTransferStatusAsync() await transferCheckpointer.AddNewJobPartAsync( transferId: transferId, partNumber: partNumber, - chunksTotal: chunksTotal, headerStream: stream); } @@ -1115,15 +905,8 @@ await transferCheckpointer.AddNewJobPartAsync( await transferCheckpointer.SetJobPartTransferStatusAsync(transferId, partNumber, newStatus); // Assert - header.AtomicPartStatus = newStatus; - using (Stream stream = await transferCheckpointer.ReadJobPartPlanFileAsync( - transferId: transferId, - partNumber: partNumber, - offset: 0, - length: DataMovementConstants.JobPartPlanFile.JobPartHeaderSizeInBytes)) - { - await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); - } + header.JobPartStatus = newStatus; + await transferCheckpointer.AssertJobPlanHeaderAsync(transferId, partNumber, header); } [Test] diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Resources/SampleJobPartPlanFile.b3.ndmpart b/sdk/storage/Azure.Storage.DataMovement/tests/Resources/SampleJobPartPlanFile.b3.ndmpart new file mode 100644 index 0000000000000..3bcf786284a64 Binary files /dev/null and b/sdk/storage/Azure.Storage.DataMovement/tests/Resources/SampleJobPartPlanFile.b3.ndmpart differ diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/MemoryStorageResourceContainer.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/MemoryStorageResourceContainer.cs index 757a7daea9d21..8164d12ef050d 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/MemoryStorageResourceContainer.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/MemoryStorageResourceContainer.cs @@ -93,5 +93,15 @@ private IEnumerable GetStorageResources(bool includeContainers) } } } + + protected internal override Task CreateIfNotExistsAsync(CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } + + protected internal override StorageResourceContainer GetChildStorageResourceContainer(string path) + { + throw new NotImplementedException(); + } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/StartTransferDirectoryCopyTestBase.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/StartTransferDirectoryCopyTestBase.cs new file mode 100644 index 0000000000000..2f834ebafee8d --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/StartTransferDirectoryCopyTestBase.cs @@ -0,0 +1,907 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.Storage.Test.Shared; +using NUnit.Framework; + +namespace Azure.Storage.DataMovement.Tests +{ + public abstract class StartTransferDirectoryCopyTestBase + : StorageTestBase + where TSourceServiceClient : class + where TSourceContainerClient : class + where TSourceClientOptions : ClientOptions + where TDestinationServiceClient : class + where TDestinationContainerClient : class + where TDestinationClientOptions : ClientOptions + where TEnvironment : StorageTestEnvironment, new() + { + private readonly string _generatedResourceNamePrefix; + private readonly string _expectedOverwriteExceptionMessage; + private readonly string _firstItemName; + + public ClientBuilder SourceClientBuilder { get; protected set; } + public ClientBuilder DestinationClientBuilder { get; protected set; } + + /// + /// Constructor for TransferManager.StartTransferAsync tests + /// + /// The async is defaulted to true, since we do not have sync StartTransfer methods. + /// + /// + /// + public StartTransferDirectoryCopyTestBase( + bool async, + string expectedOverwriteExceptionMessage, + string generatedResourceNamePrefix = default, + RecordedTestMode? mode = null) : base(async, mode) + { + Argument.CheckNotNullOrEmpty(expectedOverwriteExceptionMessage, nameof(expectedOverwriteExceptionMessage)); + _generatedResourceNamePrefix = generatedResourceNamePrefix ?? "test-resource-"; + _expectedOverwriteExceptionMessage = expectedOverwriteExceptionMessage; + _firstItemName = "item1"; + } + + #region Service-Specific Methods + /// + /// Gets the service client using OAuth to authenticate. + /// + protected abstract TSourceContainerClient GetOAuthSourceContainerClient(string containerName); + + /// + /// Gets a service-specific disposing container for use with tests in this class. + /// + /// Optionally specified service client to get container from. + /// Optional container name specification. + protected abstract Task> GetSourceDisposingContainerAsync( + TSourceServiceClient service = default, + string containerName = default, + CancellationToken cancellationToken = default); + + /// + /// Gets the specific storage resource from the given TDestinationObjectClient + /// e.g. ShareFileClient to a ShareFileStorageResource, BlockBlobClient to a BlockBlobStorageResource. + /// + /// The object client to create the storage resource object. + /// The path of the directory. + /// + protected abstract StorageResourceContainer GetSourceStorageResourceContainer(TSourceContainerClient containerClient, string directoryPath); + + /// + /// Creates the directory within the source container. + /// + /// + /// The respective source container to create the directory in. + /// + /// + /// The directory path. + /// + protected abstract Task CreateDirectoryInSourceAsync( + TSourceContainerClient sourceContainer, + string directoryPath, + CancellationToken cancellationToken = default); + + /// + /// Creates the object in the source storage resource container. + /// + /// The length to create the object of. + /// The name of the object to create. + /// The contents to set in the object. + /// + protected abstract Task CreateObjectInSourceAsync( + TSourceContainerClient container, + long? objectLength = null, + string objectName = null, + Stream contents = default, + CancellationToken cancellationToken = default); + + /// + /// Gets a service-specific disposing container for use with tests in this class. + /// + /// Optionally specified service client to get container from. + /// Optional container name specification. + protected abstract Task> GetDestinationDisposingContainerAsync( + TDestinationServiceClient service = default, + string containerName = default, + CancellationToken cancellationToken = default); + + /// + /// Gets the service client using OAuth to authenticate. + /// + protected abstract TDestinationContainerClient GetOAuthDestinationContainerClient(string containerName); + + /// + /// Gets the specific storage resource from the given TDestinationObjectClient + /// e.g. ShareFileClient to a ShareFileStorageResource, BlockBlobClient to a BlockBlobStorageResource. + /// + /// The object client to create the storage resource object. + /// + protected abstract StorageResourceContainer GetDestinationStorageResourceContainer(TDestinationContainerClient sourceContainerClient, string directoryPath); + + /// + /// Creates the directory within the source container. Will also create any parent directories if required and is a hierarchical structure. + /// + /// + /// The respective source container to create the directory in. + /// + /// + /// The directory path. If parent paths are required, will also create any parent directories if required and is a hierarchical structure. + /// + protected abstract Task CreateDirectoryInDestinationAsync( + TDestinationContainerClient destinationContainer, + string directoryPath, + CancellationToken cancellationToken = default); + + /// + /// Creates the object in the source storage resource container. + /// + /// The length to create the object of. + /// The name of the object to create. + /// The contents to set in the object. + /// + protected abstract Task CreateObjectInDestinationAsync( + TDestinationContainerClient container, + long? objectLength = null, + string objectName = null, + Stream contents = default, + CancellationToken cancellationToken = default); + + /// + /// Verifies that the destination container is empty when we expect it to be. + /// + /// + /// The respective destination container to verify empty contents. + /// + /// + protected abstract Task VerifyEmptyDestinationContainerAsync( + TDestinationContainerClient destinationContainer, + string destinationPrefix, + CancellationToken cancellationToken = default); + + /// + /// Verifies the results between the source and the destination container. + /// + /// The source client to check the contents and compare against the destination. + /// The destinatiojn client to check the contents and compare against the source. + /// Optional. The prefix to start listing at the source container. + /// Optional. The prefix to start listing at the destination container. + /// + protected abstract Task VerifyResultsAsync( + TSourceContainerClient sourceContainer, + string sourcePrefix, + TDestinationContainerClient destinationContainer, + string destinationPrefix, + CancellationToken cancellationToken = default); + #endregion + + protected string GetNewObjectName() + => _generatedResourceNamePrefix + SourceClientBuilder.Recording.Random.NewGuid(); + + /// + /// Upload and verify the contents of the items + /// + /// By default in this function an event argument will be added to the options event handler + /// to detect when the upload has finished. + /// + /// The source container which will contains the source items + /// The source prefix/folder + /// The destination local path to download the items to + /// + /// How long we should wait until we cancel the operation. If this timeout is reached the test will fail. + /// + /// Options for the transfer manager + /// Options for the transfer Options + /// + private async Task CopyDirectoryAndVerifyAsync( + TSourceContainerClient sourceContainer, + TDestinationContainerClient destinationContainer, + string sourcePrefix, + string destinationPrefix, + int itemTransferCount, + int waitTimeInSec = 30, + TransferManagerOptions transferManagerOptions = default, + DataTransferOptions options = default) + { + // Set transfer options + options ??= new DataTransferOptions(); + TestEventsRaised testEventFailed = new TestEventsRaised(options); + + transferManagerOptions ??= new TransferManagerOptions() + { + ErrorHandling = DataTransferErrorMode.ContinueOnFailure + }; + + // Initialize transferManager + TransferManager transferManager = new TransferManager(transferManagerOptions); + + StorageResourceContainer sourceResource = + GetSourceStorageResourceContainer(sourceContainer, sourcePrefix); + StorageResourceContainer destinationResource = + GetDestinationStorageResourceContainer(destinationContainer, destinationPrefix); + + DataTransfer transfer = await transferManager.StartTransferAsync(sourceResource, destinationResource, options); + + // Assert + CancellationTokenSource tokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(waitTimeInSec)); + await transfer.WaitForCompletionAsync(tokenSource.Token); + + await testEventFailed.AssertContainerCompletedCheck(itemTransferCount); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + + // List all files in source folder path + await VerifyResultsAsync( + sourceContainer: sourceContainer, + sourcePrefix: sourcePrefix, + destinationContainer: destinationContainer, + destinationPrefix: destinationPrefix); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + [TestCase(0, 10)] + [TestCase(100, 10)] + [TestCase(Constants.KB, 10)] + public async Task DirectoryToDirectory_SmallSize(long size, int waitTimeInSec) + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + string sourcePrefix = "sourceFolder"; + string destinationPrefix = "destinationFolder"; + + await CreateDirectoryInSourceAsync(source.Container, sourcePrefix); + string itemName1 = string.Join("/", sourcePrefix, GetNewObjectName()); + string itemName2 = string.Join("/", sourcePrefix, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName1); + await CreateObjectInSourceAsync(source.Container, size, itemName2); + + string subDirName = string.Join("/", sourcePrefix, "bar"); + await CreateDirectoryInSourceAsync(source.Container, subDirName); + string itemName3 = string.Join("/", subDirName, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName3); + + string subDirName2 = string.Join("/", sourcePrefix, "pik"); + await CreateDirectoryInSourceAsync(source.Container, subDirName2); + string itemName4 = string.Join("/", subDirName2, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName4); + + await CreateDirectoryInDestinationAsync(destination.Container, destinationPrefix); + + await CopyDirectoryAndVerifyAsync( + source.Container, + destination.Container, + sourcePrefix, + destinationPrefix, + 4, + waitTimeInSec).ConfigureAwait(false); + } + + [Ignore("These tests currently take 40+ mins for little additional coverage")] + [Test] + [LiveOnly] + [TestCase(4 * Constants.MB, 20)] + [TestCase(4 * Constants.MB, 200)] + [TestCase(257 * Constants.MB, 500)] + [TestCase(Constants.GB, 500)] + public async Task DirectoryToDirectory_LargeSize(long size, int waitTimeInSec) + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + string sourcePrefix = "sourceFolder"; + + await CreateDirectoryInSourceAsync(source.Container, sourcePrefix); + string itemName1 = string.Join("/", sourcePrefix, GetNewObjectName()); + string itemName2 = string.Join("/", sourcePrefix, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName1); + await CreateObjectInSourceAsync(source.Container, size, itemName2); + + string subDirName = string.Join("/", sourcePrefix, "bar"); + await CreateDirectoryInSourceAsync(source.Container, subDirName); + string itemName3 = string.Join("/", subDirName, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName3); + + string subDirName2 = string.Join("/", sourcePrefix, "pik"); + await CreateDirectoryInSourceAsync(source.Container, subDirName2); + string itemName4 = string.Join("/", subDirName2, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName4); + + string destinationPrefix = "destFolder"; + await CreateDirectoryInDestinationAsync(destination.Container, destinationPrefix); + + await CopyDirectoryAndVerifyAsync( + source.Container, + destination.Container, + sourcePrefix, + destinationPrefix, + waitTimeInSec).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DirectoryToDirectory_EmptyFolder() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + var sourcePath = GetNewObjectName(); + var destinationPath = GetNewObjectName(); + + // Set up resources + await CreateDirectoryInSourceAsync(source.Container, sourcePath); + StorageResourceContainer sourceResource = GetSourceStorageResourceContainer(source.Container, sourcePath); + await CreateDirectoryInDestinationAsync(destination.Container, destinationPath); + StorageResourceContainer destinationResource = GetDestinationStorageResourceContainer(destination.Container, destinationPath); + + TransferManagerOptions managerOptions = new TransferManagerOptions() + { + ErrorHandling = DataTransferErrorMode.ContinueOnFailure, + MaximumConcurrency = 1, + }; + TransferManager transferManager = new TransferManager(managerOptions); + DataTransferOptions options = new DataTransferOptions(); + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Act + DataTransfer transfer = await transferManager.StartTransferAsync(sourceResource, destinationResource, options); + + CancellationTokenSource tokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(10)); + await transfer.WaitForCompletionAsync(tokenSource.Token); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + + // Assert + await VerifyEmptyDestinationContainerAsync(destination.Container, destinationPath); + testEventsRaised.AssertUnexpectedFailureCheck(); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DirectoryToDirectory_SingleFile() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + string sourcePrefix = "sourceFolder"; + + string itemName1 = string.Join("/", sourcePrefix, GetNewObjectName()); + await CreateDirectoryInSourceAsync(source.Container, sourcePrefix); + await CreateObjectInSourceAsync(source.Container, Constants.KB, itemName1); + + string destinationPrefix = "destFolder"; + + await CreateDirectoryInDestinationAsync(destination.Container, destinationPrefix); + await CopyDirectoryAndVerifyAsync( + sourceContainer: source.Container, + destinationContainer: destination.Container, + sourcePrefix: sourcePrefix, + destinationPrefix: destinationPrefix, + itemTransferCount: 1).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DirectoryToDirectory_ManySubDirectories() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + string sourcePrefix = "sourceFolder"; + + await CreateDirectoryInSourceAsync(source.Container, sourcePrefix); + string subDir1 = string.Join("/", sourcePrefix, "foo"); + await CreateDirectoryInSourceAsync(source.Container, subDir1); + string itemName1 = string.Join("/", subDir1, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, Constants.KB, itemName1); + string subDir2 = string.Join("/", sourcePrefix, "rul"); + await CreateDirectoryInSourceAsync(source.Container, subDir2); + string itemName2 = string.Join("/", subDir2, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, Constants.KB, itemName2); + string subDir3 = string.Join("/", sourcePrefix, "pik"); + await CreateDirectoryInSourceAsync(source.Container, subDir3); + string itemName3 = string.Join("/", subDir3, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, Constants.KB, itemName3); + + string destinationPrefix = "destFolder"; + + await CreateDirectoryInDestinationAsync(destination.Container, destinationPrefix); + await CopyDirectoryAndVerifyAsync( + sourceContainer: source.Container, + destinationContainer: destination.Container, + sourcePrefix: sourcePrefix, + destinationPrefix: destinationPrefix, + itemTransferCount: 3).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + [TestCase(1)] + [TestCase(2)] + [TestCase(3)] + public async Task DirectoryToDirectory_SubDirectoriesLevels(int level) + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + string sourcePrefix = "sourceFolder"; + + await CreateDirectoryInSourceAsync(source.Container, sourcePrefix); + + string subDirPrefix = sourcePrefix; + for (int i = 0; i < level; i++) + { + subDirPrefix = string.Join("/", subDirPrefix, $"folder{i}"); + await CreateDirectoryInSourceAsync(source.Container, subDirPrefix); + string fullFilePath = string.Join("/", subDirPrefix, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, Constants.KB, fullFilePath); + } + + string destinationPrefix = "destFolder"; + await CreateDirectoryInDestinationAsync(destination.Container, destinationPrefix); + + await CopyDirectoryAndVerifyAsync( + source.Container, + destination.Container, + sourcePrefix, + destinationPrefix, + itemTransferCount: level).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DirectoryToDirectory_OverwriteExists() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + long size = Constants.KB; + string sourcePrefix = "sourceFolder"; + string destinationPrefix = "destPrefix"; + + await CreateDirectoryInSourceAsync(source.Container, sourcePrefix); + await CreateDirectoryInDestinationAsync(destination.Container, destinationPrefix); + + string itemName1 = string.Join("/", sourcePrefix, _firstItemName); + await CreateObjectInSourceAsync(source.Container, size, itemName1); + + // Create same object in the destination, so when both files are seen overwrite will trigger. + string destItemName1 = string.Join("/", destinationPrefix, _firstItemName); + await CreateObjectInDestinationAsync(destination.Container, size, destItemName1); + + string itemName2 = string.Join("/", sourcePrefix, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName2); + + string subDirName = string.Join("/", sourcePrefix, "bar"); + await CreateDirectoryInSourceAsync(source.Container, subDirName); + string itemName3 = string.Join("/", subDirName, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName3); + + string subDirName2 = string.Join("/", sourcePrefix, "pik"); + await CreateDirectoryInSourceAsync(source.Container, subDirName2); + string itemName4 = string.Join("/", subDirName2, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName4); + + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.OverwriteIfExists + }; + + // Act + await CopyDirectoryAndVerifyAsync( + source.Container, + destination.Container, + sourcePrefix, + destinationPrefix, + itemTransferCount: 4, + options: options).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DirectoryToDirectory_OverwriteNotExists() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + long size = Constants.KB; + string sourcePrefix = "sourceFolder"; + string destinationPrefix = "destPrefix"; + + await CreateDirectoryInSourceAsync(source.Container, sourcePrefix); + await CreateDirectoryInDestinationAsync(destination.Container, destinationPrefix); + + string itemName1 = string.Join("/", sourcePrefix, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName1); + + string itemName2 = string.Join("/", sourcePrefix, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName2); + + string subDirName = string.Join("/", sourcePrefix, "bar"); + await CreateDirectoryInSourceAsync(source.Container, subDirName); + string itemName3 = string.Join("/", subDirName, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName3); + + string subDirName2 = string.Join("/", sourcePrefix, "pik"); + await CreateDirectoryInSourceAsync(source.Container, subDirName2); + string itemName4 = string.Join("/", subDirName2, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName4); + + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.OverwriteIfExists + }; + + // Act + await CopyDirectoryAndVerifyAsync( + source.Container, + destination.Container, + sourcePrefix, + destinationPrefix, + itemTransferCount: 4, + options: options).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DirectoryToDirectory_OAuth() + { + // Arrange + long size = Constants.KB; + int waitTimeInSec = 20; + string sourceContainerName = GetNewObjectName(); + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(containerName: sourceContainerName); + TSourceContainerClient oauthSourceContainer = GetOAuthSourceContainerClient(containerName: sourceContainerName); + + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + TDestinationContainerClient oauthDestinationContainer = GetOAuthDestinationContainerClient(containerName: sourceContainerName); + + string sourcePrefix = "sourceFolder"; + string destinationPrefix = "destFolder"; + + await CreateDirectoryInSourceAsync(oauthSourceContainer, sourcePrefix); + await CreateDirectoryInDestinationAsync(oauthDestinationContainer, destinationPrefix); + + string itemName1 = string.Join("/", sourcePrefix, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName1); + + string itemName2 = string.Join("/", sourcePrefix, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName2); + + string subDirName = string.Join("/", sourcePrefix, "bar"); + await CreateDirectoryInSourceAsync(source.Container, subDirName); + string itemName3 = string.Join("/", subDirName, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName3); + + string subDirName2 = string.Join("/", sourcePrefix, "pik"); + await CreateDirectoryInSourceAsync(source.Container, subDirName2); + string itemName4 = string.Join("/", subDirName2, GetNewObjectName()); + await CreateObjectInSourceAsync(source.Container, size, itemName4); + + await CopyDirectoryAndVerifyAsync( + oauthSourceContainer, + oauthDestinationContainer, + sourcePrefix, + destinationPrefix, + 4, + waitTimeInSec).ConfigureAwait(false); + } + + #region Single Concurrency + private async Task CreateDirectoryTree( + TSourceContainerClient client, + string sourcePrefix, + int size) + { + string itemName1 = string.Join("/", sourcePrefix, _firstItemName); + string itemName2 = string.Join("/", sourcePrefix, "item2"); + await CreateObjectInSourceAsync(client, size, itemName1); + await CreateObjectInSourceAsync(client, size, itemName2); + + string subDirPath = string.Join("/", sourcePrefix, "bar"); + await CreateDirectoryInSourceAsync(client, subDirPath); + string itemName3 = string.Join("/", subDirPath, "item3"); + await CreateObjectInSourceAsync(client, size, itemName3); + + string subDirPath2 = string.Join("/", sourcePrefix, "pik"); + await CreateDirectoryInSourceAsync(client, subDirPath2); + string itemName4 = string.Join("/", subDirPath2, "item4"); + await CreateObjectInSourceAsync(client, size, itemName4); + } + + private async Task CreateStartTransfer( + TSourceContainerClient sourceContainer, + TDestinationContainerClient destinationContainer, + int concurrency, + bool createFailedCondition = false, + DataTransferOptions options = default, + int size = Constants.KB) + { + // Arrange + string sourcePrefix = "sourceFolder"; + string destPrefix = "destFolder"; + await CreateDirectoryInSourceAsync(sourceContainer, sourcePrefix); + await CreateDirectoryInDestinationAsync(destinationContainer, destPrefix); + await CreateDirectoryTree(sourceContainer, sourcePrefix, size); + + // Create storage resource containers + StorageResourceContainer sourceResource = GetSourceStorageResourceContainer(sourceContainer, sourcePrefix); + StorageResourceContainer destinationResource = GetDestinationStorageResourceContainer(destinationContainer, destPrefix); + + if (createFailedCondition) + { + // To create an expected failure, create an item that is supposed to be transferred over. + // If we don't enable overwrite, a failure should be thrown. + string fullDestPath = string.Join("/", destPrefix, _firstItemName); + await CreateObjectInDestinationAsync(destinationContainer, size, fullDestPath); + } + + // Create Transfer Manager with single threaded operation + TransferManagerOptions managerOptions = new TransferManagerOptions() + { + MaximumConcurrency = concurrency, + }; + TransferManager transferManager = new TransferManager(managerOptions); + + // Start transfer and await for completion. + return await transferManager.StartTransferAsync( + sourceResource, + destinationResource, + options).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_AwaitCompletion() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + // Create transfer to do a AwaitCompletion + DataTransferOptions options = new DataTransferOptions(); + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + DataTransfer transfer = await CreateStartTransfer( + source.Container, + destination.Container, + 1, + options: options); + + // Act + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + await transfer.WaitForCompletionAsync(cancellationTokenSource.Token).ConfigureAwait(false); + + // Assert + testEventsRaised.AssertUnexpectedFailureCheck(); + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_AwaitCompletion_Failed() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.FailIfExists + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create transfer to do a AwaitCompletion + DataTransfer transfer = await CreateStartTransfer( + source.Container, + destination.Container, + 1, + createFailedCondition: true, + options: options); + + // Act + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + await transfer.WaitForCompletionAsync(cancellationTokenSource.Token).ConfigureAwait(false); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasFailedItems); + await testEventsRaised.AssertContainerCompletedWithFailedCheck(1); + Assert.IsTrue(testEventsRaised.FailedEvents.First().Exception.Message.Contains(_expectedOverwriteExceptionMessage)); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_AwaitCompletion_Skipped() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + // Create transfer options with Skipping available + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.SkipIfExists + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create transfer to do a AwaitCompletion + DataTransfer transfer = await CreateStartTransfer( + source.Container, + destination.Container, + 1, + createFailedCondition: true, + options: options); + + // Act + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + await transfer.WaitForCompletionAsync(cancellationTokenSource.Token).ConfigureAwait(false); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasSkippedItems); + await testEventsRaised.AssertContainerCompletedWithSkippedCheck(1); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_EnsureCompleted() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + // Create transfer to do a EnsureCompleted + DataTransferOptions options = new DataTransferOptions(); + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + DataTransfer transfer = await CreateStartTransfer( + source.Container, + destination.Container, + 1, + options: options); + + // Act + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + transfer.WaitForCompletion(cancellationTokenSource.Token); + + // Assert + testEventsRaised.AssertUnexpectedFailureCheck(); + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_EnsureCompleted_Failed() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.FailIfExists + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create transfer to do a AwaitCompletion + DataTransfer transfer = await CreateStartTransfer( + source.Container, + destination.Container, + 1, + createFailedCondition: true, + options: options); + + // Act + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + transfer.WaitForCompletion(cancellationTokenSource.Token); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasFailedItems); + await testEventsRaised.AssertContainerCompletedWithFailedCheck(1); + Assert.IsTrue(testEventsRaised.FailedEvents.First().Exception.Message.Contains(_expectedOverwriteExceptionMessage)); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_EnsureCompleted_Skipped() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + // Create transfer options with Skipping available + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.SkipIfExists + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create transfer to do a EnsureCompleted + DataTransfer transfer = await CreateStartTransfer( + source.Container, + destination.Container, + 1, + createFailedCondition: true, + options: options); + + // Act + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + transfer.WaitForCompletion(cancellationTokenSource.Token); + + // Assert + testEventsRaised.AssertUnexpectedFailureCheck(); + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasSkippedItems); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_EnsureCompleted_Failed_SmallChunks() + { + // Arrange + await using IDisposingContainer source = await GetSourceDisposingContainerAsync(); + await using IDisposingContainer destination = await GetDestinationDisposingContainerAsync(); + + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.FailIfExists, + InitialTransferSize = 512, + MaximumTransferChunkSize = 512 + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create transfer to do a AwaitCompletion + DataTransfer transfer = await CreateStartTransfer( + source.Container, + destination.Container, + 1, + createFailedCondition: true, + options: options, + size: Constants.KB * 4); + + // Act + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + transfer.WaitForCompletion(cancellationTokenSource.Token); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasFailedItems); + Assert.IsTrue(testEventsRaised.FailedEvents.First().Exception.Message.Contains(_expectedOverwriteExceptionMessage)); + await testEventsRaised.AssertContainerCompletedWithFailedCheck(1); + } + #endregion + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/StartTransferDirectoryDownloadTestBase.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/StartTransferDirectoryDownloadTestBase.cs new file mode 100644 index 0000000000000..36cc285664bfc --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/StartTransferDirectoryDownloadTestBase.cs @@ -0,0 +1,708 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.Storage.Test.Shared; +using NUnit.Framework; + +namespace Azure.Storage.DataMovement.Tests +{ + public abstract class StartTransferDirectoryDownloadTestBase< + TServiceClient, + TContainerClient, + TClientOptions, + TEnvironment> : StorageTestBase + where TServiceClient : class + where TContainerClient : class + where TClientOptions : ClientOptions + where TEnvironment : StorageTestEnvironment, new() + { + private readonly string _generatedResourceNamePrefix; + private readonly string _generatedDirectoryNamePrefix; + private readonly string _expectedOverwriteExceptionMessage; + private const string _firstItemName = "item1"; + public ClientBuilder ClientBuilder { get; protected set; } + + /// + /// Constructor for TransferManager.StartTransferAsync tests + /// + /// The async is defaulted to true, since we do not have sync StartTransfer methods. + /// + /// + /// To confirm the correct overwrite exception was thrown, we check against + /// this exception message to verify. + /// + /// + /// + public StartTransferDirectoryDownloadTestBase( + bool async, + string expectedOverwriteExceptionMessage, + string generatedResourceNamePrefix = default, + string generatedDirectoryNamePrefix = default, + RecordedTestMode? mode = null) : base(async, mode) + { + Argument.CheckNotNullOrEmpty(expectedOverwriteExceptionMessage, nameof(expectedOverwriteExceptionMessage)); + _generatedResourceNamePrefix = generatedResourceNamePrefix ?? "test-resource-"; + _generatedDirectoryNamePrefix = generatedDirectoryNamePrefix ?? "test-dir-"; + _expectedOverwriteExceptionMessage = expectedOverwriteExceptionMessage; + } + + #region Service-Specific Methods + /// + /// Gets a service-specific disposing container for use with tests in this class. + /// + /// Optionally specified service client to get container from. + /// Optional container name specification. + protected abstract Task> GetDisposingContainerAsync( + TServiceClient service = default, + string containerName = default); + + /// + /// Gets the specific storage resource from the given TDestinationObjectClient + /// e.g. ShareFileClient to a ShareFileStorageResource, BlockBlobClient to a BlockBlobStorageResource. + /// + /// The object client to create the storage resource object. + /// The path of the directory. + /// + protected abstract StorageResourceContainer GetStorageResourceContainer(TContainerClient container, string directoryPath); + + /// + /// Gets a new service-specific child object client from a given container, e.g. a BlobClient from a + /// TContainerClient or a TObjectClient from a ShareClient. + /// + /// Container to get resource from. + /// Sets the resource size in bytes, for resources that require this upfront. + /// Whether to call CreateAsync on the resource, if necessary. + /// Optional name for the resource. + /// ClientOptions for the resource client. + /// If specified, the contents will be uploaded to the object client. + protected abstract Task CreateObjectClientAsync( + TContainerClient container, + long? objectLength, + string objectName, + bool createResource = false, + TClientOptions options = default, + Stream contents = default, + CancellationToken cancellationToken = default); + + /// + /// Setups up the source directory to prepare to be downloaded. + /// + /// The respective container to setup to be downloaded. + /// The directory path prefix to set up at. + /// The list of file names and sizes + /// The cancellation token for timeout purposes. + /// + protected abstract Task SetupSourceDirectoryAsync( + TContainerClient container, + string directoryPath, + List<(string PathName, int Size)> fileSizes, + CancellationToken cancellationToken); + + /// + /// Gets the respective lister on the TContainerClient. + /// + /// Respective container to list. + /// The prefix to list from. + protected abstract TransferValidator.ListFilesAsync GetSourceLister(TContainerClient container, string prefix); + #endregion + + protected string GetNewDirectoryName() + => _generatedDirectoryNamePrefix + ClientBuilder.Recording.Random.NewGuid(); + + protected string GetNewObjectName() + => _generatedResourceNamePrefix + ClientBuilder.Recording.Random.NewGuid(); + + #region DirectoryDownloadTests + /// + /// Upload and verify the contents of the directory + /// + /// By default in this function an event argument will be added to the options event handler + /// to detect when the upload has finished. + /// + /// The source container which will contains the source items + /// The source prefix/folder + /// The source paths relative to the sourcePrefix + /// Options for the transfer manager + /// Options for the transfer Options + /// + private async Task DownloadDirectoryAndVerifyAsync( + TContainerClient sourceContainer, + string sourcePrefix, + List<(string PathName, int Size)> itemSizes, + TransferManagerOptions transferManagerOptions = default, + DataTransferOptions options = default, + CancellationToken cancellationToken = default) + { + await SetupSourceDirectoryAsync(sourceContainer, sourcePrefix, itemSizes, cancellationToken); + + using DisposingLocalDirectory disposingLocalDirectory = DisposingLocalDirectory.GetTestDirectory(); + + // Set transfer options + options ??= new DataTransferOptions(); + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + transferManagerOptions ??= new TransferManagerOptions() + { + ErrorHandling = DataTransferErrorMode.ContinueOnFailure + }; + + StorageResourceContainer sourceResource = GetStorageResourceContainer(sourceContainer, sourcePrefix); + LocalFilesStorageResourceProvider localProvider = new(); + StorageResourceContainer destinationResource = localProvider.FromDirectory(disposingLocalDirectory.DirectoryPath); + + await new TransferValidator().TransferAndVerifyAsync( + sourceResource, + destinationResource, + GetSourceLister(sourceContainer, sourcePrefix), + TransferValidator.GetLocalFileLister(disposingLocalDirectory.DirectoryPath), + itemSizes.Count, + options, + cancellationToken); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + [TestCase(0, 10)] + [TestCase(100, 10)] + [TestCase(Constants.KB, 10)] + public async Task DownloadDirectoryAsync_Small(int size, int waitInSec) + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + string sourceDirectoryName = "foo"; + + List itemNames = new() + { + string.Join("/", sourceDirectoryName, GetNewObjectName()), + string.Join("/", sourceDirectoryName, GetNewObjectName()), + string.Join("/", sourceDirectoryName, "bar", GetNewObjectName()), + string.Join("/", sourceDirectoryName, "bar", "pik", GetNewObjectName()), + }; + + CancellationTokenSource cts = new(); + cts.CancelAfter(TimeSpan.FromSeconds(waitInSec)); + await DownloadDirectoryAndVerifyAsync( + test.Container, + sourceDirectoryName, + itemNames.Select(name => (name, size)).ToList(), + cancellationToken: cts.Token).ConfigureAwait(false); + } + + [Ignore("These tests currently take 40+ mins for little additional coverage")] + [Test] + [LiveOnly] + [TestCase(4 * Constants.MB, 20)] + [TestCase(257 * Constants.MB, 500)] + [TestCase(400 * Constants.MB, 200)] + [TestCase(Constants.GB, 500)] + public async Task DownloadDirectoryAsync_Large(int size, int waitInSec) + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + string sourceDirectoryName = "foo"; + + List itemNames = new() + { + string.Join("/", sourceDirectoryName, GetNewObjectName()), + string.Join("/", sourceDirectoryName, GetNewObjectName()), + string.Join("/", sourceDirectoryName, "bar", GetNewObjectName()), + string.Join("/", sourceDirectoryName, "bar", "pik", GetNewObjectName()), + }; + + CancellationTokenSource cts = new(); + cts.CancelAfter(waitInSec); + await DownloadDirectoryAndVerifyAsync( + test.Container, + sourceDirectoryName, + itemNames.Select(name => (name, size)).ToList(), + cancellationToken: cts.Token).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DownloadDirectoryAsync_Empty() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string sourceDirectoryName = "foo"; + string destinationFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + + await SetupSourceDirectoryAsync(test.Container, sourceDirectoryName, new(), cancellationTokenSource.Token); + + // Initialize transferManager + TransferManager transferManager = new TransferManager(); + DataTransferOptions options = new DataTransferOptions(); + TestEventsRaised testEventRaised = new TestEventsRaised(options); + + StorageResourceContainer sourceResource = GetStorageResourceContainer(test.Container, sourceDirectoryName); + LocalFilesStorageResourceProvider localProvider = new(); + StorageResourceContainer destinationResource = localProvider.FromDirectory(destinationFolder); + + DataTransfer transfer = await transferManager.StartTransferAsync(sourceResource, destinationResource, options); + await transfer.WaitForCompletionAsync(cancellationTokenSource.Token); + + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + + List localItemsAfterDownload = Directory.GetFiles(destinationFolder, "*", SearchOption.AllDirectories).ToList(); + + // Assert + Assert.IsEmpty(localItemsAfterDownload); + testEventRaised.AssertUnexpectedFailureCheck(); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DownloadDirectoryAsync_SingleFile() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + string sourceDirectoryName = GetNewDirectoryName(); + await DownloadDirectoryAndVerifyAsync( + test.Container, + sourceDirectoryName, + new List<(string, int)> { ($"{sourceDirectoryName}/{GetNewObjectName()}", Constants.KB) }) + .ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DownloadDirectoryAsync_ManySubDirectories() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string tempFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + string directoryName = "foo"; + string fullSourceFolderPath = CreateRandomDirectory(tempFolder, directoryName); + List itemNames = new() + { + string.Join("/", directoryName, "bar", GetNewObjectName()), + string.Join("/", directoryName, "rul", GetNewObjectName()), + string.Join("/", directoryName, "pik", GetNewObjectName()), + }; + + await DownloadDirectoryAndVerifyAsync( + sourceContainer: test.Container, + sourcePrefix: directoryName, + itemNames.Select(name => (name, Constants.KB)).ToList()).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + [TestCase(1)] + [TestCase(2)] + [TestCase(3)] + public async Task DownloadDirectoryAsync_SubDirectoriesLevels(int level) + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + string sourcePrefix = "foo"; + + List itemNames = new List(); + + string prefix = sourcePrefix; + for (int i = 0; i < level; i++) + { + prefix = string.Join("/", prefix, $"folder{i}"); + itemNames.Add(string.Join("/", prefix, GetNewObjectName())); + } + + string destinationFolder = CreateRandomDirectory(Path.GetTempPath()); + + await DownloadDirectoryAndVerifyAsync( + test.Container, + sourcePrefix, + itemNames.Select(name => (name, Constants.KB)).ToList()).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DownloadDirectoryAsync_SmallChunks_ManyFiles() + { + // Arrange + int size = 2 * Constants.KB; + await using IDisposingContainer test = await GetDisposingContainerAsync(); + + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string tempFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + string directoryName = "foo"; + + List itemNames = new List(); + + foreach (var _ in Enumerable.Range(0, 5)) + { + itemNames.Add(string.Join("/", directoryName, GetNewObjectName())); + } + foreach (var _ in Enumerable.Range(0, 3)) + { + itemNames.Add(string.Join("/", directoryName, "bar", GetNewObjectName())); + } + foreach (var _ in Enumerable.Range(0, 2)) + { + itemNames.Add(string.Join("/", directoryName, "rul", GetNewObjectName())); + } + + TransferManagerOptions transferManagerOptions = new TransferManagerOptions() + { + ErrorHandling = DataTransferErrorMode.StopOnAnyFailure, + MaximumConcurrency = 3 + }; + DataTransferOptions options = new DataTransferOptions() + { + InitialTransferSize = 512, + MaximumTransferChunkSize = 512 + }; + + // Act / Assert + await DownloadDirectoryAndVerifyAsync( + sourceContainer: test.Container, + sourcePrefix: directoryName, + itemNames.Select(name => (name, size)).ToList(), + transferManagerOptions: transferManagerOptions, + options: options).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task DownloadDirectoryAsync_Root() + { + // Arrange + int size = Constants.KB; + string[] items = { "file1", "dir1/file1", "dir1/file2", "dir1/file3", "dir2/file1" }; + + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory destination = DisposingLocalDirectory.GetTestDirectory(); + + // Act / Assert + await DownloadDirectoryAndVerifyAsync( + sourceContainer: test.Container, + sourcePrefix: "", + items.Select(name => (name, size)).ToList()).ConfigureAwait(false); + } + #endregion DirectoryDownloadTests + + #region Single Concurrency + private async Task CreateSourceDirectoryTree( + TContainerClient container, + string sourceDirectoryName, + int size, + CancellationToken cancellationToken = default) + { + string[] itemNames = new string[] + { + $"{sourceDirectoryName}/{_firstItemName}", + $"{sourceDirectoryName}/item2", + $"{sourceDirectoryName}/bar/item3", + $"{sourceDirectoryName}/foo/item4", + }; + await SetupSourceDirectoryAsync( + container, + sourceDirectoryName, + itemNames.Select(name => (name, size)).ToList(), + cancellationToken); + } + + private async Task CreateStartTransfer( + TContainerClient containerClient, + string destinationFolder, + int concurrency, + DataTransferOptions options = default, + int size = Constants.KB, + CancellationToken cancellationToken = default) + { + // Arrange + string sourcePrefix = "sourceFolder"; + await CreateSourceDirectoryTree(containerClient, sourcePrefix, size, cancellationToken); + + // Create storage resources + StorageResourceContainer sourceResource = GetStorageResourceContainer(containerClient, sourcePrefix); + LocalFilesStorageResourceProvider files = new(); + StorageResource destinationResource = files.FromDirectory(destinationFolder); + + // Create Transfer Manager with single threaded operation + TransferManagerOptions managerOptions = new TransferManagerOptions() + { + MaximumConcurrency = concurrency, + }; + TransferManager transferManager = new TransferManager(managerOptions); + + // Start transfer and await for completion. + return await transferManager.StartTransferAsync( + sourceResource, + destinationResource, + options).ConfigureAwait(false); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_AwaitCompletion() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string destinationFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + + // Create transfer to do a AwaitCompletion + DataTransferOptions options = new DataTransferOptions(); + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + DataTransfer transfer = await CreateStartTransfer( + test.Container, + destinationFolder, + 1, + options: options, + cancellationToken: cancellationTokenSource.Token); + + // Act + await transfer.WaitForCompletionAsync(cancellationTokenSource.Token).ConfigureAwait(false); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + await testEventsRaised.AssertContainerCompletedCheck(4); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_AwaitCompletion_Failed() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string destinationFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.FailIfExists + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create at least one of the dest files to make it fail + File.Create(string.Join("/", destinationFolder, _firstItemName)).Close(); + + // Create transfer to do a AwaitCompletion + DataTransfer transfer = await CreateStartTransfer( + test.Container, + destinationFolder, + 1, + options: options, + cancellationToken: cancellationTokenSource.Token); + + // Act + await transfer.WaitForCompletionAsync(cancellationTokenSource.Token).ConfigureAwait(false); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasFailedItems); + Assert.IsTrue(testEventsRaised.FailedEvents.First().Exception.Message.Contains(_expectedOverwriteExceptionMessage)); + await testEventsRaised.AssertContainerCompletedWithFailedCheck(1); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_AwaitCompletion_Skipped() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string destinationFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + + // Create transfer options with Skipping available + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.SkipIfExists + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create at least one of the dest files to make it fail + File.Create(string.Join("/", destinationFolder, _firstItemName)).Dispose(); + + // Create transfer to do a AwaitCompletion + DataTransfer transfer = await CreateStartTransfer( + test.Container, + destinationFolder, + 1, + options: options, + cancellationToken: cancellationTokenSource.Token); + + // Act + await transfer.WaitForCompletionAsync(cancellationTokenSource.Token).ConfigureAwait(false); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasSkippedItems); + await testEventsRaised.AssertContainerCompletedWithSkippedCheck(1); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_EnsureCompleted() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string destinationFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + + // Create transfer to do a EnsureCompleted + DataTransferOptions options = new DataTransferOptions(); + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + DataTransfer transfer = await CreateStartTransfer( + test.Container, + destinationFolder, + 1, + options: options, + cancellationToken: cancellationTokenSource.Token); + + // Act + transfer.WaitForCompletion(cancellationTokenSource.Token); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + await testEventsRaised.AssertContainerCompletedCheck(4); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_EnsureCompleted_Failed() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string destinationFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.FailIfExists + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create at least one of the dest files to make it fail + File.Create(string.Join("/", destinationFolder, _firstItemName)).Close(); + + // Create transfer to do a AwaitCompletion + DataTransfer transfer = await CreateStartTransfer( + test.Container, + destinationFolder, + 1, + options: options, + cancellationToken: cancellationTokenSource.Token); + + // Act + transfer.WaitForCompletion(cancellationTokenSource.Token); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasFailedItems); + Assert.IsTrue(testEventsRaised.FailedEvents.First().Exception.Message.Contains(_expectedOverwriteExceptionMessage)); + await testEventsRaised.AssertContainerCompletedWithFailedCheck(1); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_EnsureCompleted_Skipped() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string destinationFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + + // Create transfer options with Skipping available + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.SkipIfExists + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create at least one of the dest files to make it fail + File.Create(string.Join("/", destinationFolder, _firstItemName)).Close(); + + // Create transfer to do a EnsureCompleted + DataTransfer transfer = await CreateStartTransfer( + test.Container, + destinationFolder, + 1, + options: options, + cancellationToken: cancellationTokenSource.Token); + + // Act + transfer.WaitForCompletion(cancellationTokenSource.Token); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasSkippedItems); + await testEventsRaised.AssertContainerCompletedWithSkippedCheck(1); + } + + [Test] + [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 + public async Task StartTransfer_EnsureCompleted_Failed_SmallChunks() + { + // Arrange + await using IDisposingContainer test = await GetDisposingContainerAsync(); + using DisposingLocalDirectory testDirectory = DisposingLocalDirectory.GetTestDirectory(); + string destinationFolder = CreateRandomDirectory(testDirectory.DirectoryPath); + CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); + + DataTransferOptions options = new DataTransferOptions() + { + CreationPreference = StorageResourceCreationPreference.FailIfExists, + InitialTransferSize = 512, + MaximumTransferChunkSize = 512 + }; + TestEventsRaised testEventsRaised = new TestEventsRaised(options); + + // Create at least one of the dest files to make it fail + File.Create(string.Join("/", destinationFolder, _firstItemName)).Close(); + + // Create transfer to do a AwaitCompletion + DataTransfer transfer = await CreateStartTransfer( + test.Container, + destinationFolder, + 1, + options: options, + size: Constants.KB * 4, + cancellationToken: cancellationTokenSource.Token); + + // Act + transfer.WaitForCompletion(cancellationTokenSource.Token); + + // Assert + Assert.NotNull(transfer); + Assert.IsTrue(transfer.HasCompleted); + Assert.AreEqual(DataTransferState.Completed, transfer.TransferStatus.State); + Assert.AreEqual(true, transfer.TransferStatus.HasFailedItems); + Assert.IsTrue(testEventsRaised.FailedEvents.First().Exception.Message.Contains(_expectedOverwriteExceptionMessage)); + await testEventsRaised.AssertContainerCompletedWithFailedCheck(1); + } + #endregion + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.Local.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.Local.cs index 40eea82dfb16f..6316d21e193b4 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.Local.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.Local.cs @@ -8,7 +8,7 @@ namespace Azure.Storage.DataMovement.Tests { - internal partial class TransferValidator + public partial class TransferValidator { public class LocalFileResourceEnumerationItem : IResourceEnumerationItem { diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.cs index 62f3f3bd0f6eb..ede5c7ab6c94b 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferValidator.cs @@ -11,7 +11,7 @@ namespace Azure.Storage.DataMovement.Tests { - internal partial class TransferValidator + public partial class TransferValidator { public interface IResourceEnumerationItem { diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/TransferValidator.Blobs.cs b/sdk/storage/Azure.Storage.DataMovement/tests/TransferValidator.Blobs.cs index 47f50ae510ae2..96dc9346517b3 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/TransferValidator.Blobs.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/TransferValidator.Blobs.cs @@ -11,7 +11,7 @@ namespace Azure.Storage.DataMovement.Tests { - internal partial class TransferValidator + public partial class TransferValidator { public class BlobResourceEnumerationItem : IResourceEnumerationItem { diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs index fa9720fe9c94d..1d5c4cec38de1 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs @@ -523,7 +523,7 @@ protected static async Task GetCopyAuthorizationHeaderAsync( if (client.ClientConfiguration.TokenCredential != default) { AccessToken accessToken = await client.ClientConfiguration.TokenCredential.GetTokenAsync( - new TokenRequestContext(new string[] { client.ClientConfiguration.Audience.ToString() }), + new TokenRequestContext(new string[] { client.ClientConfiguration.Audience.CreateDefaultScope() }), cancellationToken).ConfigureAwait(false); return new HttpAuthorization( Constants.CopyHttpAuthorization.BearerScheme, diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/api/Azure.ResourceManager.StorageCache.netstandard2.0.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/api/Azure.ResourceManager.StorageCache.netstandard2.0.cs index 1f94c98d6ce34..cf4d6cfc8f88c 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/api/Azure.ResourceManager.StorageCache.netstandard2.0.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/api/Azure.ResourceManager.StorageCache.netstandard2.0.cs @@ -19,7 +19,7 @@ protected AmlFileSystemCollection() { } } public partial class AmlFileSystemData : Azure.ResourceManager.Models.TrackedResourceData { - public AmlFileSystemData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AmlFileSystemData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.StorageCache.Models.AmlFileSystemClientInfo ClientInfo { get { throw null; } } public string FilesystemSubnet { get { throw null; } set { } } public Azure.ResourceManager.StorageCache.Models.AmlFileSystemHealth Health { get { throw null; } } @@ -76,7 +76,7 @@ protected StorageCacheCollection() { } } public partial class StorageCacheData : Azure.ResourceManager.Models.TrackedResourceData { - public StorageCacheData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StorageCacheData(Azure.Core.AzureLocation location) { } public int? CacheSizeGB { get { throw null; } set { } } public Azure.ResourceManager.StorageCache.Models.StorageCacheDirectorySettings DirectoryServicesSettings { get { throw null; } set { } } public Azure.ResourceManager.StorageCache.Models.StorageCacheEncryptionSettings EncryptionSettings { get { throw null; } set { } } @@ -227,6 +227,44 @@ protected StorageTargetResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.StorageCache.StorageTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.StorageCache.Mocking +{ + public partial class MockableStorageCacheArmClient : Azure.ResourceManager.ArmResource + { + protected MockableStorageCacheArmClient() { } + public virtual Azure.ResourceManager.StorageCache.AmlFileSystemResource GetAmlFileSystemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageCache.StorageCacheResource GetStorageCacheResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageCache.StorageTargetResource GetStorageTargetResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableStorageCacheResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableStorageCacheResourceGroupResource() { } + public virtual Azure.Response GetAmlFileSystem(string amlFileSystemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAmlFileSystemAsync(string amlFileSystemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.StorageCache.AmlFileSystemCollection GetAmlFileSystems() { throw null; } + public virtual Azure.Response GetStorageCache(string cacheName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetStorageCacheAsync(string cacheName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.StorageCache.StorageCacheCollection GetStorageCaches() { throw null; } + } + public partial class MockableStorageCacheSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableStorageCacheSubscriptionResource() { } + public virtual Azure.Response CheckAmlFSSubnets(Azure.ResourceManager.StorageCache.Models.AmlFileSystemSubnetContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckAmlFSSubnetsAsync(Azure.ResourceManager.StorageCache.Models.AmlFileSystemSubnetContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAmlFileSystems(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAmlFileSystemsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRequiredAmlFSSubnetsSize(Azure.ResourceManager.StorageCache.Models.RequiredAmlFileSystemSubnetsSizeContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRequiredAmlFSSubnetsSizeAsync(Azure.ResourceManager.StorageCache.Models.RequiredAmlFileSystemSubnetsSizeContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStorageCaches(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageCachesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStorageCacheSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageCacheSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStorageCacheUsages(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageCacheUsagesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsageModels(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsageModelsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.StorageCache.Models { public partial class AmlFileSystemArchive diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/AmlFileSystemResource.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/AmlFileSystemResource.cs index e9ac812f0ea4a..963ef3cbc0ad2 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/AmlFileSystemResource.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/AmlFileSystemResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.StorageCache public partial class AmlFileSystemResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The amlFileSystemName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string amlFileSystemName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFileSystemName}"; diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheArmClient.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheArmClient.cs new file mode 100644 index 0000000000000..ef31c9492ef87 --- /dev/null +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.StorageCache; + +namespace Azure.ResourceManager.StorageCache.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableStorageCacheArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageCacheArmClient() + { + } + + /// 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 MockableStorageCacheArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableStorageCacheArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AmlFileSystemResource GetAmlFileSystemResource(ResourceIdentifier id) + { + AmlFileSystemResource.ValidateResourceId(id); + return new AmlFileSystemResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageCacheResource GetStorageCacheResource(ResourceIdentifier id) + { + StorageCacheResource.ValidateResourceId(id); + return new StorageCacheResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageTargetResource GetStorageTargetResource(ResourceIdentifier id) + { + StorageTargetResource.ValidateResourceId(id); + return new StorageTargetResource(Client, id); + } + } +} diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheResourceGroupResource.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheResourceGroupResource.cs new file mode 100644 index 0000000000000..3230f71b40894 --- /dev/null +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.StorageCache; + +namespace Azure.ResourceManager.StorageCache.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableStorageCacheResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageCacheResourceGroupResource() + { + } + + /// 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 MockableStorageCacheResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AmlFileSystemResources in the ResourceGroupResource. + /// An object representing collection of AmlFileSystemResources and their operations over a AmlFileSystemResource. + public virtual AmlFileSystemCollection GetAmlFileSystems() + { + return GetCachedClient(client => new AmlFileSystemCollection(client, Id)); + } + + /// + /// Returns an AML file system. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName} + /// + /// + /// Operation Id + /// amlFilesystems_Get + /// + /// + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAmlFileSystemAsync(string amlFileSystemName, CancellationToken cancellationToken = default) + { + return await GetAmlFileSystems().GetAsync(amlFileSystemName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns an AML file system. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName} + /// + /// + /// Operation Id + /// amlFilesystems_Get + /// + /// + /// + /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAmlFileSystem(string amlFileSystemName, CancellationToken cancellationToken = default) + { + return GetAmlFileSystems().Get(amlFileSystemName, cancellationToken); + } + + /// Gets a collection of StorageCacheResources in the ResourceGroupResource. + /// An object representing collection of StorageCacheResources and their operations over a StorageCacheResource. + public virtual StorageCacheCollection GetStorageCaches() + { + return GetCachedClient(client => new StorageCacheCollection(client, Id)); + } + + /// + /// Returns a cache. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName} + /// + /// + /// Operation Id + /// Caches_Get + /// + /// + /// + /// Name of cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStorageCacheAsync(string cacheName, CancellationToken cancellationToken = default) + { + return await GetStorageCaches().GetAsync(cacheName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a cache. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName} + /// + /// + /// Operation Id + /// Caches_Get + /// + /// + /// + /// Name of cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStorageCache(string cacheName, CancellationToken cancellationToken = default) + { + return GetStorageCaches().Get(cacheName, cancellationToken); + } + } +} diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheSubscriptionResource.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheSubscriptionResource.cs new file mode 100644 index 0000000000000..185d6e3fb786d --- /dev/null +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/MockableStorageCacheSubscriptionResource.cs @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.StorageCache; +using Azure.ResourceManager.StorageCache.Models; + +namespace Azure.ResourceManager.StorageCache.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableStorageCacheSubscriptionResource : ArmResource + { + private ClientDiagnostics _amlFileSystemamlFilesystemsClientDiagnostics; + private AmlFilesystemsRestOperations _amlFileSystemamlFilesystemsRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private StorageCacheManagementRestOperations _defaultRestClient; + private ClientDiagnostics _skusClientDiagnostics; + private SkusRestOperations _skusRestClient; + private ClientDiagnostics _usageModelsClientDiagnostics; + private UsageModelsRestOperations _usageModelsRestClient; + private ClientDiagnostics _ascUsagesClientDiagnostics; + private AscUsagesRestOperations _ascUsagesRestClient; + private ClientDiagnostics _storageCacheCachesClientDiagnostics; + private CachesRestOperations _storageCacheCachesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableStorageCacheSubscriptionResource() + { + } + + /// 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 MockableStorageCacheSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AmlFileSystemamlFilesystemsClientDiagnostics => _amlFileSystemamlFilesystemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", AmlFileSystemResource.ResourceType.Namespace, Diagnostics); + private AmlFilesystemsRestOperations AmlFileSystemamlFilesystemsRestClient => _amlFileSystemamlFilesystemsRestClient ??= new AmlFilesystemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AmlFileSystemResource.ResourceType)); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private StorageCacheManagementRestOperations DefaultRestClient => _defaultRestClient ??= new StorageCacheManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics UsageModelsClientDiagnostics => _usageModelsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsageModelsRestOperations UsageModelsRestClient => _usageModelsRestClient ??= new UsageModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AscUsagesClientDiagnostics => _ascUsagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AscUsagesRestOperations AscUsagesRestClient => _ascUsagesRestClient ??= new AscUsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics StorageCacheCachesClientDiagnostics => _storageCacheCachesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", StorageCacheResource.ResourceType.Namespace, Diagnostics); + private CachesRestOperations StorageCacheCachesRestClient => _storageCacheCachesRestClient ??= new CachesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageCacheResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns all AML file systems the user has access to under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/amlFilesystems + /// + /// + /// Operation Id + /// amlFilesystems_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAmlFileSystemsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AmlFileSystemamlFilesystemsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AmlFileSystemamlFilesystemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AmlFileSystemResource(Client, AmlFileSystemData.DeserializeAmlFileSystemData(e)), AmlFileSystemamlFilesystemsClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetAmlFileSystems", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all AML file systems the user has access to under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/amlFilesystems + /// + /// + /// Operation Id + /// amlFilesystems_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAmlFileSystems(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AmlFileSystemamlFilesystemsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AmlFileSystemamlFilesystemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AmlFileSystemResource(Client, AmlFileSystemData.DeserializeAmlFileSystemData(e)), AmlFileSystemamlFilesystemsClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetAmlFileSystems", "value", "nextLink", cancellationToken); + } + + /// + /// Check that subnets will be valid for AML file system create calls. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets + /// + /// + /// Operation Id + /// checkAmlFSSubnets + /// + /// + /// + /// Information about the subnets to validate. + /// The cancellation token to use. + public virtual async Task CheckAmlFSSubnetsAsync(AmlFileSystemSubnetContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableStorageCacheSubscriptionResource.CheckAmlFSSubnets"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckAmlFSSubnetsAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check that subnets will be valid for AML file system create calls. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets + /// + /// + /// Operation Id + /// checkAmlFSSubnets + /// + /// + /// + /// Information about the subnets to validate. + /// The cancellation token to use. + public virtual Response CheckAmlFSSubnets(AmlFileSystemSubnetContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableStorageCacheSubscriptionResource.CheckAmlFSSubnets"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckAmlFSSubnets(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the number of available IP addresses needed for the AML file system information provided. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize + /// + /// + /// Operation Id + /// getRequiredAmlFSSubnetsSize + /// + /// + /// + /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// The cancellation token to use. + public virtual async Task> GetRequiredAmlFSSubnetsSizeAsync(RequiredAmlFileSystemSubnetsSizeContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableStorageCacheSubscriptionResource.GetRequiredAmlFSSubnetsSize"); + scope.Start(); + try + { + var response = await DefaultRestClient.GetRequiredAmlFSSubnetsSizeAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the number of available IP addresses needed for the AML file system information provided. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize + /// + /// + /// Operation Id + /// getRequiredAmlFSSubnetsSize + /// + /// + /// + /// Information to determine the number of available IPs a subnet will need to host the AML file system. + /// The cancellation token to use. + public virtual Response GetRequiredAmlFSSubnetsSize(RequiredAmlFileSystemSubnetsSizeContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableStorageCacheSubscriptionResource.GetRequiredAmlFSSubnetsSize"); + scope.Start(); + try + { + var response = DefaultRestClient.GetRequiredAmlFSSubnetsSize(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the list of StorageCache.Cache SKUs available to this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageCacheSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, StorageCacheSku.DeserializeStorageCacheSku, SkusClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetStorageCacheSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of StorageCache.Cache SKUs available to this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus + /// + /// + /// Operation Id + /// Skus_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageCacheSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, StorageCacheSku.DeserializeStorageCacheSku, SkusClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetStorageCacheSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of cache usage models available to this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels + /// + /// + /// Operation Id + /// UsageModels_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsageModelsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsageModelsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageModelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, StorageCacheUsageModel.DeserializeStorageCacheUsageModel, UsageModelsClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetUsageModels", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of cache usage models available to this subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels + /// + /// + /// Operation Id + /// UsageModels_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsageModels(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsageModelsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageModelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, StorageCacheUsageModel.DeserializeStorageCacheUsageModel, UsageModelsClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetUsageModels", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the quantity used and quota limit for resources + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages + /// + /// + /// Operation Id + /// AscUsages_List + /// + /// + /// + /// The name of the region to query for usage information. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageCacheUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AscUsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AscUsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, StorageCacheUsage.DeserializeStorageCacheUsage, AscUsagesClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetStorageCacheUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the quantity used and quota limit for resources + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages + /// + /// + /// Operation Id + /// AscUsages_List + /// + /// + /// + /// The name of the region to query for usage information. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageCacheUsages(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AscUsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AscUsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, StorageCacheUsage.DeserializeStorageCacheUsage, AscUsagesClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetStorageCacheUsages", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all caches the user has access to under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches + /// + /// + /// Operation Id + /// Caches_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageCachesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageCacheCachesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageCacheCachesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageCacheResource(Client, StorageCacheData.DeserializeStorageCacheData(e)), StorageCacheCachesClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetStorageCaches", "value", "nextLink", cancellationToken); + } + + /// + /// Returns all caches the user has access to under a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches + /// + /// + /// Operation Id + /// Caches_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageCaches(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageCacheCachesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageCacheCachesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageCacheResource(Client, StorageCacheData.DeserializeStorageCacheData(e)), StorageCacheCachesClientDiagnostics, Pipeline, "MockableStorageCacheSubscriptionResource.GetStorageCaches", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 62200da008929..0000000000000 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.StorageCache -{ - /// 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 AmlFileSystemResources in the ResourceGroupResource. - /// An object representing collection of AmlFileSystemResources and their operations over a AmlFileSystemResource. - public virtual AmlFileSystemCollection GetAmlFileSystems() - { - return GetCachedClient(Client => new AmlFileSystemCollection(Client, Id)); - } - - /// Gets a collection of StorageCacheResources in the ResourceGroupResource. - /// An object representing collection of StorageCacheResources and their operations over a StorageCacheResource. - public virtual StorageCacheCollection GetStorageCaches() - { - return GetCachedClient(Client => new StorageCacheCollection(Client, Id)); - } - } -} diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/StorageCacheExtensions.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/StorageCacheExtensions.cs index 43cac92f1980a..69e4bacd0fa3c 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/StorageCacheExtensions.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/StorageCacheExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.StorageCache.Mocking; using Azure.ResourceManager.StorageCache.Models; namespace Azure.ResourceManager.StorageCache @@ -19,100 +20,81 @@ namespace Azure.ResourceManager.StorageCache /// A class to add extension methods to Azure.ResourceManager.StorageCache. public static partial class StorageCacheExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableStorageCacheArmClient GetMockableStorageCacheArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableStorageCacheArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableStorageCacheResourceGroupResource GetMockableStorageCacheResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableStorageCacheResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableStorageCacheSubscriptionResource GetMockableStorageCacheSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableStorageCacheSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region AmlFileSystemResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AmlFileSystemResource GetAmlFileSystemResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AmlFileSystemResource.ValidateResourceId(id); - return new AmlFileSystemResource(client, id); - } - ); + return GetMockableStorageCacheArmClient(client).GetAmlFileSystemResource(id); } - #endregion - #region StorageCacheResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageCacheResource GetStorageCacheResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageCacheResource.ValidateResourceId(id); - return new StorageCacheResource(client, id); - } - ); + return GetMockableStorageCacheArmClient(client).GetStorageCacheResource(id); } - #endregion - #region StorageTargetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageTargetResource GetStorageTargetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageTargetResource.ValidateResourceId(id); - return new StorageTargetResource(client, id); - } - ); + return GetMockableStorageCacheArmClient(client).GetStorageTargetResource(id); } - #endregion - /// Gets a collection of AmlFileSystemResources in the ResourceGroupResource. + /// + /// Gets a collection of AmlFileSystemResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AmlFileSystemResources and their operations over a AmlFileSystemResource. public static AmlFileSystemCollection GetAmlFileSystems(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAmlFileSystems(); + return GetMockableStorageCacheResourceGroupResource(resourceGroupResource).GetAmlFileSystems(); } /// @@ -127,16 +109,20 @@ public static AmlFileSystemCollection GetAmlFileSystems(this ResourceGroupResour /// amlFilesystems_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAmlFileSystemAsync(this ResourceGroupResource resourceGroupResource, string amlFileSystemName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAmlFileSystems().GetAsync(amlFileSystemName, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageCacheResourceGroupResource(resourceGroupResource).GetAmlFileSystemAsync(amlFileSystemName, cancellationToken).ConfigureAwait(false); } /// @@ -151,24 +137,34 @@ public static async Task> GetAmlFileSystemAsync( /// amlFilesystems_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and end with alphanumeric. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAmlFileSystem(this ResourceGroupResource resourceGroupResource, string amlFileSystemName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAmlFileSystems().Get(amlFileSystemName, cancellationToken); + return GetMockableStorageCacheResourceGroupResource(resourceGroupResource).GetAmlFileSystem(amlFileSystemName, cancellationToken); } - /// Gets a collection of StorageCacheResources in the ResourceGroupResource. + /// + /// Gets a collection of StorageCacheResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of StorageCacheResources and their operations over a StorageCacheResource. public static StorageCacheCollection GetStorageCaches(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageCaches(); + return GetMockableStorageCacheResourceGroupResource(resourceGroupResource).GetStorageCaches(); } /// @@ -183,16 +179,20 @@ public static StorageCacheCollection GetStorageCaches(this ResourceGroupResource /// Caches_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetStorageCacheAsync(this ResourceGroupResource resourceGroupResource, string cacheName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetStorageCaches().GetAsync(cacheName, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageCacheResourceGroupResource(resourceGroupResource).GetStorageCacheAsync(cacheName, cancellationToken).ConfigureAwait(false); } /// @@ -207,16 +207,20 @@ public static async Task> GetStorageCacheAsync(th /// Caches_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetStorageCache(this ResourceGroupResource resourceGroupResource, string cacheName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetStorageCaches().Get(cacheName, cancellationToken); + return GetMockableStorageCacheResourceGroupResource(resourceGroupResource).GetStorageCache(cacheName, cancellationToken); } /// @@ -231,13 +235,17 @@ public static Response GetStorageCache(this ResourceGroupR /// amlFilesystems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAmlFileSystemsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAmlFileSystemsAsync(cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetAmlFileSystemsAsync(cancellationToken); } /// @@ -252,13 +260,17 @@ public static AsyncPageable GetAmlFileSystemsAsync(this S /// amlFilesystems_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAmlFileSystems(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAmlFileSystems(cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetAmlFileSystems(cancellationToken); } /// @@ -273,13 +285,17 @@ public static Pageable GetAmlFileSystems(this Subscriptio /// checkAmlFSSubnets /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Information about the subnets to validate. /// The cancellation token to use. public static async Task CheckAmlFSSubnetsAsync(this SubscriptionResource subscriptionResource, AmlFileSystemSubnetContent content = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAmlFSSubnetsAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageCacheSubscriptionResource(subscriptionResource).CheckAmlFSSubnetsAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -294,13 +310,17 @@ public static async Task CheckAmlFSSubnetsAsync(this SubscriptionResou /// checkAmlFSSubnets /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Information about the subnets to validate. /// The cancellation token to use. public static Response CheckAmlFSSubnets(this SubscriptionResource subscriptionResource, AmlFileSystemSubnetContent content = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAmlFSSubnets(content, cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).CheckAmlFSSubnets(content, cancellationToken); } /// @@ -315,13 +335,17 @@ public static Response CheckAmlFSSubnets(this SubscriptionResource subscriptionR /// getRequiredAmlFSSubnetsSize /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Information to determine the number of available IPs a subnet will need to host the AML file system. /// The cancellation token to use. public static async Task> GetRequiredAmlFSSubnetsSizeAsync(this SubscriptionResource subscriptionResource, RequiredAmlFileSystemSubnetsSizeContent content = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetRequiredAmlFSSubnetsSizeAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetRequiredAmlFSSubnetsSizeAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -336,13 +360,17 @@ public static async Task> GetRequired /// getRequiredAmlFSSubnetsSize /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Information to determine the number of available IPs a subnet will need to host the AML file system. /// The cancellation token to use. public static Response GetRequiredAmlFSSubnetsSize(this SubscriptionResource subscriptionResource, RequiredAmlFileSystemSubnetsSizeContent content = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRequiredAmlFSSubnetsSize(content, cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetRequiredAmlFSSubnetsSize(content, cancellationToken); } /// @@ -357,13 +385,17 @@ public static Response GetRequiredAmlFSSubnets /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageCacheSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageCacheSkusAsync(cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetStorageCacheSkusAsync(cancellationToken); } /// @@ -378,13 +410,17 @@ public static AsyncPageable GetStorageCacheSkusAsync(this Subsc /// Skus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageCacheSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageCacheSkus(cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetStorageCacheSkus(cancellationToken); } /// @@ -399,13 +435,17 @@ public static Pageable GetStorageCacheSkus(this SubscriptionRes /// UsageModels_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetUsageModelsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsageModelsAsync(cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetUsageModelsAsync(cancellationToken); } /// @@ -420,13 +460,17 @@ public static AsyncPageable GetUsageModelsAsync(this Sub /// UsageModels_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetUsageModels(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsageModels(cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetUsageModels(cancellationToken); } /// @@ -441,6 +485,10 @@ public static Pageable GetUsageModels(this SubscriptionR /// AscUsages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region to query for usage information. @@ -448,7 +496,7 @@ public static Pageable GetUsageModels(this SubscriptionR /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetStorageCacheUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageCacheUsagesAsync(location, cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetStorageCacheUsagesAsync(location, cancellationToken); } /// @@ -463,6 +511,10 @@ public static AsyncPageable GetStorageCacheUsagesAsync(this S /// AscUsages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the region to query for usage information. @@ -470,7 +522,7 @@ public static AsyncPageable GetStorageCacheUsagesAsync(this S /// A collection of that may take multiple service requests to iterate over. public static Pageable GetStorageCacheUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageCacheUsages(location, cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetStorageCacheUsages(location, cancellationToken); } /// @@ -485,13 +537,17 @@ public static Pageable GetStorageCacheUsages(this Subscriptio /// Caches_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageCachesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageCachesAsync(cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetStorageCachesAsync(cancellationToken); } /// @@ -506,13 +562,17 @@ public static AsyncPageable GetStorageCachesAsync(this Sub /// Caches_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageCaches(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageCaches(cancellationToken); + return GetMockableStorageCacheSubscriptionResource(subscriptionResource).GetStorageCaches(cancellationToken); } } } diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 726aaed7e1098..0000000000000 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.StorageCache.Models; - -namespace Azure.ResourceManager.StorageCache -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _amlFileSystemamlFilesystemsClientDiagnostics; - private AmlFilesystemsRestOperations _amlFileSystemamlFilesystemsRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private StorageCacheManagementRestOperations _defaultRestClient; - private ClientDiagnostics _skusClientDiagnostics; - private SkusRestOperations _skusRestClient; - private ClientDiagnostics _usageModelsClientDiagnostics; - private UsageModelsRestOperations _usageModelsRestClient; - private ClientDiagnostics _ascUsagesClientDiagnostics; - private AscUsagesRestOperations _ascUsagesRestClient; - private ClientDiagnostics _storageCacheCachesClientDiagnostics; - private CachesRestOperations _storageCacheCachesRestClient; - - /// 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 AmlFileSystemamlFilesystemsClientDiagnostics => _amlFileSystemamlFilesystemsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", AmlFileSystemResource.ResourceType.Namespace, Diagnostics); - private AmlFilesystemsRestOperations AmlFileSystemamlFilesystemsRestClient => _amlFileSystemamlFilesystemsRestClient ??= new AmlFilesystemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AmlFileSystemResource.ResourceType)); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private StorageCacheManagementRestOperations DefaultRestClient => _defaultRestClient ??= new StorageCacheManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SkusClientDiagnostics => _skusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SkusRestOperations SkusRestClient => _skusRestClient ??= new SkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics UsageModelsClientDiagnostics => _usageModelsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsageModelsRestOperations UsageModelsRestClient => _usageModelsRestClient ??= new UsageModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AscUsagesClientDiagnostics => _ascUsagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AscUsagesRestOperations AscUsagesRestClient => _ascUsagesRestClient ??= new AscUsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics StorageCacheCachesClientDiagnostics => _storageCacheCachesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageCache", StorageCacheResource.ResourceType.Namespace, Diagnostics); - private CachesRestOperations StorageCacheCachesRestClient => _storageCacheCachesRestClient ??= new CachesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageCacheResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns all AML file systems the user has access to under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/amlFilesystems - /// - /// - /// Operation Id - /// amlFilesystems_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAmlFileSystemsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AmlFileSystemamlFilesystemsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AmlFileSystemamlFilesystemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AmlFileSystemResource(Client, AmlFileSystemData.DeserializeAmlFileSystemData(e)), AmlFileSystemamlFilesystemsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAmlFileSystems", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all AML file systems the user has access to under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/amlFilesystems - /// - /// - /// Operation Id - /// amlFilesystems_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAmlFileSystems(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AmlFileSystemamlFilesystemsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AmlFileSystemamlFilesystemsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AmlFileSystemResource(Client, AmlFileSystemData.DeserializeAmlFileSystemData(e)), AmlFileSystemamlFilesystemsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAmlFileSystems", "value", "nextLink", cancellationToken); - } - - /// - /// Check that subnets will be valid for AML file system create calls. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets - /// - /// - /// Operation Id - /// checkAmlFSSubnets - /// - /// - /// - /// Information about the subnets to validate. - /// The cancellation token to use. - public virtual async Task CheckAmlFSSubnetsAsync(AmlFileSystemSubnetContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAmlFSSubnets"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckAmlFSSubnetsAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check that subnets will be valid for AML file system create calls. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/checkAmlFSSubnets - /// - /// - /// Operation Id - /// checkAmlFSSubnets - /// - /// - /// - /// Information about the subnets to validate. - /// The cancellation token to use. - public virtual Response CheckAmlFSSubnets(AmlFileSystemSubnetContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAmlFSSubnets"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckAmlFSSubnets(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the number of available IP addresses needed for the AML file system information provided. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize - /// - /// - /// Operation Id - /// getRequiredAmlFSSubnetsSize - /// - /// - /// - /// Information to determine the number of available IPs a subnet will need to host the AML file system. - /// The cancellation token to use. - public virtual async Task> GetRequiredAmlFSSubnetsSizeAsync(RequiredAmlFileSystemSubnetsSizeContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRequiredAmlFSSubnetsSize"); - scope.Start(); - try - { - var response = await DefaultRestClient.GetRequiredAmlFSSubnetsSizeAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the number of available IP addresses needed for the AML file system information provided. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/getRequiredAmlFSSubnetsSize - /// - /// - /// Operation Id - /// getRequiredAmlFSSubnetsSize - /// - /// - /// - /// Information to determine the number of available IPs a subnet will need to host the AML file system. - /// The cancellation token to use. - public virtual Response GetRequiredAmlFSSubnetsSize(RequiredAmlFileSystemSubnetsSizeContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetRequiredAmlFSSubnetsSize"); - scope.Start(); - try - { - var response = DefaultRestClient.GetRequiredAmlFSSubnetsSize(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the list of StorageCache.Cache SKUs available to this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageCacheSkusAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, StorageCacheSku.DeserializeStorageCacheSku, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageCacheSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Get the list of StorageCache.Cache SKUs available to this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus - /// - /// - /// Operation Id - /// Skus_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageCacheSkus(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SkusRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, StorageCacheSku.DeserializeStorageCacheSku, SkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageCacheSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Get the list of cache usage models available to this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels - /// - /// - /// Operation Id - /// UsageModels_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsageModelsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsageModelsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageModelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, StorageCacheUsageModel.DeserializeStorageCacheUsageModel, UsageModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsageModels", "value", "nextLink", cancellationToken); - } - - /// - /// Get the list of cache usage models available to this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels - /// - /// - /// Operation Id - /// UsageModels_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsageModels(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsageModelsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsageModelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, StorageCacheUsageModel.DeserializeStorageCacheUsageModel, UsageModelsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsageModels", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the quantity used and quota limit for resources - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages - /// - /// - /// Operation Id - /// AscUsages_List - /// - /// - /// - /// The name of the region to query for usage information. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageCacheUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AscUsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AscUsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, StorageCacheUsage.DeserializeStorageCacheUsage, AscUsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageCacheUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Gets the quantity used and quota limit for resources - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages - /// - /// - /// Operation Id - /// AscUsages_List - /// - /// - /// - /// The name of the region to query for usage information. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageCacheUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AscUsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AscUsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, StorageCacheUsage.DeserializeStorageCacheUsage, AscUsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageCacheUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all caches the user has access to under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches - /// - /// - /// Operation Id - /// Caches_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageCachesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageCacheCachesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageCacheCachesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageCacheResource(Client, StorageCacheData.DeserializeStorageCacheData(e)), StorageCacheCachesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageCaches", "value", "nextLink", cancellationToken); - } - - /// - /// Returns all caches the user has access to under a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches - /// - /// - /// Operation Id - /// Caches_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageCaches(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageCacheCachesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageCacheCachesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageCacheResource(Client, StorageCacheData.DeserializeStorageCacheData(e)), StorageCacheCachesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageCaches", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheResource.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheResource.cs index f656ba2a921a6..9f900242195b5 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheResource.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.StorageCache public partial class StorageCacheResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cacheName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cacheName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StorageTargetResources and their operations over a StorageTargetResource. public virtual StorageTargetCollection GetStorageTargets() { - return GetCachedClient(Client => new StorageTargetCollection(Client, Id)); + return GetCachedClient(client => new StorageTargetCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual StorageTargetCollection GetStorageTargets() /// /// Name of Storage Target. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageTargetAsync(string storageTargetName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetStorageTargetAsync /// /// Name of Storage Target. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageTarget(string storageTargetName, CancellationToken cancellationToken = default) { diff --git a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageTargetResource.cs b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageTargetResource.cs index 7f0152fccc54c..0ab1ae7e14043 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageTargetResource.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageTargetResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.StorageCache public partial class StorageTargetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cacheName. + /// The storageTargetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cacheName, string storageTargetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"; diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/CHANGELOG.md b/sdk/storagemover/Azure.ResourceManager.StorageMover/CHANGELOG.md index de6030705ab7a..5e1c99d781867 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/CHANGELOG.md +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.2.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.1.0 (2023-10-30) ### Features Added diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/api/Azure.ResourceManager.StorageMover.netstandard2.0.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/api/Azure.ResourceManager.StorageMover.netstandard2.0.cs index 918fd80da9144..61e89e187e30f 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/api/Azure.ResourceManager.StorageMover.netstandard2.0.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/api/Azure.ResourceManager.StorageMover.netstandard2.0.cs @@ -179,7 +179,7 @@ protected StorageMoverCollection() { } } public partial class StorageMoverData : Azure.ResourceManager.Models.TrackedResourceData { - public StorageMoverData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StorageMoverData(Azure.Core.AzureLocation location) { } public string Description { get { throw null; } set { } } public Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? ProvisioningState { get { throw null; } } } @@ -303,6 +303,32 @@ protected StorageMoverResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.StorageMover.Models.StorageMoverPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.StorageMover.Mocking +{ + public partial class MockableStorageMoverArmClient : Azure.ResourceManager.ArmResource + { + protected MockableStorageMoverArmClient() { } + public virtual Azure.ResourceManager.StorageMover.JobDefinitionResource GetJobDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageMover.JobRunResource GetJobRunResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageMover.StorageMoverAgentResource GetStorageMoverAgentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageMover.StorageMoverEndpointResource GetStorageMoverEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageMover.StorageMoverProjectResource GetStorageMoverProjectResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageMover.StorageMoverResource GetStorageMoverResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableStorageMoverResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableStorageMoverResourceGroupResource() { } + public virtual Azure.Response GetStorageMover(string storageMoverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetStorageMoverAsync(string storageMoverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.StorageMover.StorageMoverCollection GetStorageMovers() { throw null; } + } + public partial class MockableStorageMoverSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableStorageMoverSubscriptionResource() { } + public virtual Azure.Pageable GetStorageMovers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageMoversAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.StorageMover.Models { public static partial class ArmStorageMoverModelFactory diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Azure.ResourceManager.StorageMover.csproj b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Azure.ResourceManager.StorageMover.csproj index 2c70b793aa2e9..05308a35241e2 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Azure.ResourceManager.StorageMover.csproj +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Azure.ResourceManager.StorageMover.csproj @@ -1,8 +1,8 @@ - 1.1.0 + 1.2.0-beta.1 - 1.0.1 + 1.1.0 Azure.ResourceManager.StorageMover Azure Resource Manager client SDK for Azure resource provider StorageMover azure;management;arm;resource manager;storagemover diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverArmClient.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverArmClient.cs new file mode 100644 index 0000000000000..d401b1d5d6a8d --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverArmClient.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.StorageMover; + +namespace Azure.ResourceManager.StorageMover.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableStorageMoverArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageMoverArmClient() + { + } + + /// 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 MockableStorageMoverArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableStorageMoverArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageMoverResource GetStorageMoverResource(ResourceIdentifier id) + { + StorageMoverResource.ValidateResourceId(id); + return new StorageMoverResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageMoverAgentResource GetStorageMoverAgentResource(ResourceIdentifier id) + { + StorageMoverAgentResource.ValidateResourceId(id); + return new StorageMoverAgentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageMoverEndpointResource GetStorageMoverEndpointResource(ResourceIdentifier id) + { + StorageMoverEndpointResource.ValidateResourceId(id); + return new StorageMoverEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageMoverProjectResource GetStorageMoverProjectResource(ResourceIdentifier id) + { + StorageMoverProjectResource.ValidateResourceId(id); + return new StorageMoverProjectResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual JobDefinitionResource GetJobDefinitionResource(ResourceIdentifier id) + { + JobDefinitionResource.ValidateResourceId(id); + return new JobDefinitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual JobRunResource GetJobRunResource(ResourceIdentifier id) + { + JobRunResource.ValidateResourceId(id); + return new JobRunResource(Client, id); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverResourceGroupResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverResourceGroupResource.cs new file mode 100644 index 0000000000000..cefd71e4920e9 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.StorageMover; + +namespace Azure.ResourceManager.StorageMover.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableStorageMoverResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageMoverResourceGroupResource() + { + } + + /// 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 MockableStorageMoverResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of StorageMoverResources in the ResourceGroupResource. + /// An object representing collection of StorageMoverResources and their operations over a StorageMoverResource. + public virtual StorageMoverCollection GetStorageMovers() + { + return GetCachedClient(client => new StorageMoverCollection(client, Id)); + } + + /// + /// Gets a Storage Mover resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName} + /// + /// + /// Operation Id + /// StorageMovers_Get + /// + /// + /// + /// The name of the Storage Mover resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStorageMoverAsync(string storageMoverName, CancellationToken cancellationToken = default) + { + return await GetStorageMovers().GetAsync(storageMoverName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Storage Mover resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName} + /// + /// + /// Operation Id + /// StorageMovers_Get + /// + /// + /// + /// The name of the Storage Mover resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStorageMover(string storageMoverName, CancellationToken cancellationToken = default) + { + return GetStorageMovers().Get(storageMoverName, cancellationToken); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverSubscriptionResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverSubscriptionResource.cs new file mode 100644 index 0000000000000..e56d0323d50c6 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/MockableStorageMoverSubscriptionResource.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.StorageMover; + +namespace Azure.ResourceManager.StorageMover.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableStorageMoverSubscriptionResource : ArmResource + { + private ClientDiagnostics _storageMoverClientDiagnostics; + private StorageMoversRestOperations _storageMoverRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableStorageMoverSubscriptionResource() + { + } + + /// 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 MockableStorageMoverSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics StorageMoverClientDiagnostics => _storageMoverClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageMover", StorageMoverResource.ResourceType.Namespace, Diagnostics); + private StorageMoversRestOperations StorageMoverRestClient => _storageMoverRestClient ??= new StorageMoversRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageMoverResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all Storage Movers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageMover/storageMovers + /// + /// + /// Operation Id + /// StorageMovers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageMoversAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageMoverRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageMoverRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageMoverResource(Client, StorageMoverData.DeserializeStorageMoverData(e)), StorageMoverClientDiagnostics, Pipeline, "MockableStorageMoverSubscriptionResource.GetStorageMovers", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all Storage Movers in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageMover/storageMovers + /// + /// + /// Operation Id + /// StorageMovers_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageMovers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageMoverRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageMoverRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageMoverResource(Client, StorageMoverData.DeserializeStorageMoverData(e)), StorageMoverClientDiagnostics, Pipeline, "MockableStorageMoverSubscriptionResource.GetStorageMovers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index c52fbfd40f434..0000000000000 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.StorageMover -{ - /// 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 StorageMoverResources in the ResourceGroupResource. - /// An object representing collection of StorageMoverResources and their operations over a StorageMoverResource. - public virtual StorageMoverCollection GetStorageMovers() - { - return GetCachedClient(Client => new StorageMoverCollection(Client, Id)); - } - } -} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/StorageMoverExtensions.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/StorageMoverExtensions.cs index 37bc4a95afa34..0c151972a0c74 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/StorageMoverExtensions.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/StorageMoverExtensions.cs @@ -12,163 +12,136 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.StorageMover.Mocking; namespace Azure.ResourceManager.StorageMover { /// A class to add extension methods to Azure.ResourceManager.StorageMover. public static partial class StorageMoverExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableStorageMoverArmClient GetMockableStorageMoverArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableStorageMoverArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableStorageMoverResourceGroupResource GetMockableStorageMoverResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableStorageMoverResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableStorageMoverSubscriptionResource GetMockableStorageMoverSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableStorageMoverSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region StorageMoverResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageMoverResource GetStorageMoverResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageMoverResource.ValidateResourceId(id); - return new StorageMoverResource(client, id); - } - ); + return GetMockableStorageMoverArmClient(client).GetStorageMoverResource(id); } - #endregion - #region StorageMoverAgentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageMoverAgentResource GetStorageMoverAgentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageMoverAgentResource.ValidateResourceId(id); - return new StorageMoverAgentResource(client, id); - } - ); + return GetMockableStorageMoverArmClient(client).GetStorageMoverAgentResource(id); } - #endregion - #region StorageMoverEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageMoverEndpointResource GetStorageMoverEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageMoverEndpointResource.ValidateResourceId(id); - return new StorageMoverEndpointResource(client, id); - } - ); + return GetMockableStorageMoverArmClient(client).GetStorageMoverEndpointResource(id); } - #endregion - #region StorageMoverProjectResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageMoverProjectResource GetStorageMoverProjectResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageMoverProjectResource.ValidateResourceId(id); - return new StorageMoverProjectResource(client, id); - } - ); + return GetMockableStorageMoverArmClient(client).GetStorageMoverProjectResource(id); } - #endregion - #region JobDefinitionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static JobDefinitionResource GetJobDefinitionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - JobDefinitionResource.ValidateResourceId(id); - return new JobDefinitionResource(client, id); - } - ); + return GetMockableStorageMoverArmClient(client).GetJobDefinitionResource(id); } - #endregion - #region JobRunResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static JobRunResource GetJobRunResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - JobRunResource.ValidateResourceId(id); - return new JobRunResource(client, id); - } - ); + return GetMockableStorageMoverArmClient(client).GetJobRunResource(id); } - #endregion - /// Gets a collection of StorageMoverResources in the ResourceGroupResource. + /// + /// Gets a collection of StorageMoverResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of StorageMoverResources and their operations over a StorageMoverResource. public static StorageMoverCollection GetStorageMovers(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageMovers(); + return GetMockableStorageMoverResourceGroupResource(resourceGroupResource).GetStorageMovers(); } /// @@ -183,16 +156,20 @@ public static StorageMoverCollection GetStorageMovers(this ResourceGroupResource /// StorageMovers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Storage Mover resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetStorageMoverAsync(this ResourceGroupResource resourceGroupResource, string storageMoverName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetStorageMovers().GetAsync(storageMoverName, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageMoverResourceGroupResource(resourceGroupResource).GetStorageMoverAsync(storageMoverName, cancellationToken).ConfigureAwait(false); } /// @@ -207,16 +184,20 @@ public static async Task> GetStorageMoverAsync(th /// StorageMovers_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Storage Mover resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetStorageMover(this ResourceGroupResource resourceGroupResource, string storageMoverName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetStorageMovers().Get(storageMoverName, cancellationToken); + return GetMockableStorageMoverResourceGroupResource(resourceGroupResource).GetStorageMover(storageMoverName, cancellationToken); } /// @@ -231,13 +212,17 @@ public static Response GetStorageMover(this ResourceGroupR /// StorageMovers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageMoversAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageMoversAsync(cancellationToken); + return GetMockableStorageMoverSubscriptionResource(subscriptionResource).GetStorageMoversAsync(cancellationToken); } /// @@ -252,13 +237,17 @@ public static AsyncPageable GetStorageMoversAsync(this Sub /// StorageMovers_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageMovers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageMovers(cancellationToken); + return GetMockableStorageMoverSubscriptionResource(subscriptionResource).GetStorageMovers(cancellationToken); } } } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 46a2b2c0e9708..0000000000000 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.StorageMover -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _storageMoverClientDiagnostics; - private StorageMoversRestOperations _storageMoverRestClient; - - /// 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 StorageMoverClientDiagnostics => _storageMoverClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageMover", StorageMoverResource.ResourceType.Namespace, Diagnostics); - private StorageMoversRestOperations StorageMoverRestClient => _storageMoverRestClient ??= new StorageMoversRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageMoverResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all Storage Movers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageMover/storageMovers - /// - /// - /// Operation Id - /// StorageMovers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageMoversAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageMoverRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageMoverRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageMoverResource(Client, StorageMoverData.DeserializeStorageMoverData(e)), StorageMoverClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageMovers", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all Storage Movers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageMover/storageMovers - /// - /// - /// Operation Id - /// StorageMovers_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageMovers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageMoverRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageMoverRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageMoverResource(Client, StorageMoverData.DeserializeStorageMoverData(e)), StorageMoverClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageMovers", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionResource.cs index c5373f91d5df8..11b41d0fb391d 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.StorageMover public partial class JobDefinitionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageMoverName. + /// The projectName. + /// The jobDefinitionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageMoverName, string projectName, string jobDefinitionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of JobRunResources and their operations over a JobRunResource. public virtual JobRunCollection GetJobRuns() { - return GetCachedClient(Client => new JobRunCollection(Client, Id)); + return GetCachedClient(client => new JobRunCollection(client, Id)); } /// @@ -109,8 +114,8 @@ public virtual JobRunCollection GetJobRuns() /// /// The name of the Job Run resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetJobRunAsync(string jobRunName, CancellationToken cancellationToken = default) { @@ -132,8 +137,8 @@ public virtual async Task> GetJobRunAsync(string jobRun /// /// The name of the Job Run resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetJobRun(string jobRunName, CancellationToken cancellationToken = default) { diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobRunResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobRunResource.cs index ed6de01a14321..320526e7a7e75 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobRunResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobRunResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.StorageMover public partial class JobRunResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageMoverName. + /// The projectName. + /// The jobDefinitionName. + /// The jobRunName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageMoverName, string projectName, string jobDefinitionName, string jobRunName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/jobRuns/{jobRunName}"; diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverAgentResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverAgentResource.cs index f794688c39b80..bed073a193425 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverAgentResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverAgentResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StorageMover public partial class StorageMoverAgentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageMoverName. + /// The agentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageMoverName, string agentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents/{agentName}"; diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointResource.cs index e1bdee809c375..f08d3ba24d683 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StorageMover public partial class StorageMoverEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageMoverName. + /// The endpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageMoverName, string endpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints/{endpointName}"; diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectResource.cs index 4cc96b97d1633..8124b5887d2c1 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StorageMover public partial class StorageMoverProjectResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageMoverName. + /// The projectName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageMoverName, string projectName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of JobDefinitionResources and their operations over a JobDefinitionResource. public virtual JobDefinitionCollection GetJobDefinitions() { - return GetCachedClient(Client => new JobDefinitionCollection(Client, Id)); + return GetCachedClient(client => new JobDefinitionCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual JobDefinitionCollection GetJobDefinitions() /// /// The name of the Job Definition resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetJobDefinitionAsync(string jobDefinitionName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetJobDefinitionAsync /// /// The name of the Job Definition resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetJobDefinition(string jobDefinitionName, CancellationToken cancellationToken = default) { diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverResource.cs index 202d9fd9b4915..b76bdceeaf52c 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.StorageMover public partial class StorageMoverResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageMoverName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageMoverName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StorageMoverAgentResources and their operations over a StorageMoverAgentResource. public virtual StorageMoverAgentCollection GetStorageMoverAgents() { - return GetCachedClient(Client => new StorageMoverAgentCollection(Client, Id)); + return GetCachedClient(client => new StorageMoverAgentCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual StorageMoverAgentCollection GetStorageMoverAgents() /// /// The name of the Agent resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageMoverAgentAsync(string agentName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetStorageMoverAg /// /// The name of the Agent resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageMoverAgent(string agentName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetStorageMoverAgent(string a /// An object representing collection of StorageMoverEndpointResources and their operations over a StorageMoverEndpointResource. public virtual StorageMoverEndpointCollection GetStorageMoverEndpoints() { - return GetCachedClient(Client => new StorageMoverEndpointCollection(Client, Id)); + return GetCachedClient(client => new StorageMoverEndpointCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual StorageMoverEndpointCollection GetStorageMoverEndpoints() /// /// The name of the Endpoint resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageMoverEndpointAsync(string endpointName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetStorageMove /// /// The name of the Endpoint resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageMoverEndpoint(string endpointName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetStorageMoverEndpoint(st /// An object representing collection of StorageMoverProjectResources and their operations over a StorageMoverProjectResource. public virtual StorageMoverProjectCollection GetStorageMoverProjects() { - return GetCachedClient(Client => new StorageMoverProjectCollection(Client, Id)); + return GetCachedClient(client => new StorageMoverProjectCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual StorageMoverProjectCollection GetStorageMoverProjects() /// /// The name of the Project resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageMoverProjectAsync(string projectName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetStorageMover /// /// The name of the Project resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageMoverProject(string projectName, CancellationToken cancellationToken = default) { diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/api/Azure.ResourceManager.StoragePool.netstandard2.0.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/api/Azure.ResourceManager.StoragePool.netstandard2.0.cs index 5eb78fd49aaa0..75a6955e9a2e9 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/api/Azure.ResourceManager.StoragePool.netstandard2.0.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/api/Azure.ResourceManager.StoragePool.netstandard2.0.cs @@ -19,7 +19,7 @@ protected DiskPoolCollection() { } } public partial class DiskPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public DiskPoolData(Azure.Core.AzureLocation location, Azure.ResourceManager.StoragePool.Models.DiskPoolIscsiTargetProvisioningState provisioningState, System.Collections.Generic.IEnumerable availabilityZones, Azure.ResourceManager.StoragePool.Models.StoragePoolOperationalStatus status, Azure.Core.ResourceIdentifier subnetId) : base (default(Azure.Core.AzureLocation)) { } + public DiskPoolData(Azure.Core.AzureLocation location, Azure.ResourceManager.StoragePool.Models.DiskPoolIscsiTargetProvisioningState provisioningState, System.Collections.Generic.IEnumerable availabilityZones, Azure.ResourceManager.StoragePool.Models.StoragePoolOperationalStatus status, Azure.Core.ResourceIdentifier subnetId) { } public System.Collections.Generic.IList AdditionalCapabilities { get { throw null; } } public System.Collections.Generic.IList AvailabilityZones { get { throw null; } } public System.Collections.Generic.IList Disks { get { throw null; } } @@ -122,6 +122,32 @@ public static partial class StoragePoolExtensions public static Azure.AsyncPageable GetResourceSkusAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.StoragePool.Mocking +{ + public partial class MockableStoragePoolArmClient : Azure.ResourceManager.ArmResource + { + protected MockableStoragePoolArmClient() { } + public virtual Azure.ResourceManager.StoragePool.DiskPoolIscsiTargetResource GetDiskPoolIscsiTargetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StoragePool.DiskPoolResource GetDiskPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableStoragePoolResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableStoragePoolResourceGroupResource() { } + public virtual Azure.Response GetDiskPool(string diskPoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDiskPoolAsync(string diskPoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.StoragePool.DiskPoolCollection GetDiskPools() { throw null; } + } + public partial class MockableStoragePoolSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableStoragePoolSubscriptionResource() { } + public virtual Azure.Pageable GetDiskPools(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDiskPoolsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDiskPoolZones(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDiskPoolZonesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetResourceSkus(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetResourceSkusAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.StoragePool.Models { public static partial class ArmStoragePoolModelFactory diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolIscsiTargetResource.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolIscsiTargetResource.cs index eaa13da77765a..aa9e0bceb4183 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolIscsiTargetResource.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolIscsiTargetResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StoragePool public partial class DiskPoolIscsiTargetResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The diskPoolName. + /// The iscsiTargetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string diskPoolName, string iscsiTargetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}"; diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolResource.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolResource.cs index ce502d22237ec..4be9e597cd710 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolResource.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.StoragePool public partial class DiskPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The diskPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string diskPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DiskPoolIscsiTargetResources and their operations over a DiskPoolIscsiTargetResource. public virtual DiskPoolIscsiTargetCollection GetDiskPoolIscsiTargets() { - return GetCachedClient(Client => new DiskPoolIscsiTargetCollection(Client, Id)); + return GetCachedClient(client => new DiskPoolIscsiTargetCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual DiskPoolIscsiTargetCollection GetDiskPoolIscsiTargets() /// /// The name of the iSCSI Target. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDiskPoolIscsiTargetAsync(string iscsiTargetName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetDiskPoolIscs /// /// The name of the iSCSI Target. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDiskPoolIscsiTarget(string iscsiTargetName, CancellationToken cancellationToken = default) { diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolArmClient.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolArmClient.cs new file mode 100644 index 0000000000000..4dcd62c8f6ee7 --- /dev/null +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.StoragePool; + +namespace Azure.ResourceManager.StoragePool.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableStoragePoolArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStoragePoolArmClient() + { + } + + /// 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 MockableStoragePoolArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableStoragePoolArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiskPoolResource GetDiskPoolResource(ResourceIdentifier id) + { + DiskPoolResource.ValidateResourceId(id); + return new DiskPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DiskPoolIscsiTargetResource GetDiskPoolIscsiTargetResource(ResourceIdentifier id) + { + DiskPoolIscsiTargetResource.ValidateResourceId(id); + return new DiskPoolIscsiTargetResource(Client, id); + } + } +} diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolResourceGroupResource.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolResourceGroupResource.cs new file mode 100644 index 0000000000000..34b3a60f09d2d --- /dev/null +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.StoragePool; + +namespace Azure.ResourceManager.StoragePool.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableStoragePoolResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStoragePoolResourceGroupResource() + { + } + + /// 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 MockableStoragePoolResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DiskPoolResources in the ResourceGroupResource. + /// An object representing collection of DiskPoolResources and their operations over a DiskPoolResource. + public virtual DiskPoolCollection GetDiskPools() + { + return GetCachedClient(client => new DiskPoolCollection(client, Id)); + } + + /// + /// Get a Disk pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName} + /// + /// + /// Operation Id + /// DiskPools_Get + /// + /// + /// + /// The name of the Disk Pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDiskPoolAsync(string diskPoolName, CancellationToken cancellationToken = default) + { + return await GetDiskPools().GetAsync(diskPoolName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Disk pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName} + /// + /// + /// Operation Id + /// DiskPools_Get + /// + /// + /// + /// The name of the Disk Pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDiskPool(string diskPoolName, CancellationToken cancellationToken = default) + { + return GetDiskPools().Get(diskPoolName, cancellationToken); + } + } +} diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolSubscriptionResource.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolSubscriptionResource.cs new file mode 100644 index 0000000000000..0eef13fbb2765 --- /dev/null +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/MockableStoragePoolSubscriptionResource.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.StoragePool; +using Azure.ResourceManager.StoragePool.Models; + +namespace Azure.ResourceManager.StoragePool.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableStoragePoolSubscriptionResource : ArmResource + { + private ClientDiagnostics _diskPoolClientDiagnostics; + private DiskPoolsRestOperations _diskPoolRestClient; + private ClientDiagnostics _diskPoolZonesClientDiagnostics; + private DiskPoolZonesRestOperations _diskPoolZonesRestClient; + private ClientDiagnostics _resourceSkusClientDiagnostics; + private ResourceSkusRestOperations _resourceSkusRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableStoragePoolSubscriptionResource() + { + } + + /// 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 MockableStoragePoolSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DiskPoolClientDiagnostics => _diskPoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StoragePool", DiskPoolResource.ResourceType.Namespace, Diagnostics); + private DiskPoolsRestOperations DiskPoolRestClient => _diskPoolRestClient ??= new DiskPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DiskPoolResource.ResourceType)); + private ClientDiagnostics DiskPoolZonesClientDiagnostics => _diskPoolZonesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StoragePool", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DiskPoolZonesRestOperations DiskPoolZonesRestClient => _diskPoolZonesRestClient ??= new DiskPoolZonesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ResourceSkusClientDiagnostics => _resourceSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StoragePool", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceSkusRestOperations ResourceSkusRestClient => _resourceSkusRestClient ??= new ResourceSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets a list of Disk Pools in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/diskPools + /// + /// + /// Operation Id + /// DiskPools_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDiskPoolsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskPoolRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskPoolRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskPoolResource(Client, DiskPoolData.DeserializeDiskPoolData(e)), DiskPoolClientDiagnostics, Pipeline, "MockableStoragePoolSubscriptionResource.GetDiskPools", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of Disk Pools in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/diskPools + /// + /// + /// Operation Id + /// DiskPools_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDiskPools(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskPoolRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskPoolRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskPoolResource(Client, DiskPoolData.DeserializeDiskPoolData(e)), DiskPoolClientDiagnostics, Pipeline, "MockableStoragePoolSubscriptionResource.GetDiskPools", "value", "nextLink", cancellationToken); + } + + /// + /// Lists available Disk Pool Skus in an Azure location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/diskPoolZones + /// + /// + /// Operation Id + /// DiskPoolZones_List + /// + /// + /// + /// The location of the resource. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDiskPoolZonesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskPoolZonesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskPoolZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DiskPoolZoneInfo.DeserializeDiskPoolZoneInfo, DiskPoolZonesClientDiagnostics, Pipeline, "MockableStoragePoolSubscriptionResource.GetDiskPoolZones", "value", "nextLink", cancellationToken); + } + + /// + /// Lists available Disk Pool Skus in an Azure location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/diskPoolZones + /// + /// + /// Operation Id + /// DiskPoolZones_List + /// + /// + /// + /// The location of the resource. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDiskPoolZones(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DiskPoolZonesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskPoolZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DiskPoolZoneInfo.DeserializeDiskPoolZoneInfo, DiskPoolZonesClientDiagnostics, Pipeline, "MockableStoragePoolSubscriptionResource.GetDiskPoolZones", "value", "nextLink", cancellationToken); + } + + /// + /// Lists available StoragePool resources and skus in an Azure location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/skus + /// + /// + /// Operation Id + /// ResourceSkus_List + /// + /// + /// + /// The location of the resource. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetResourceSkusAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, StoragePoolSkuInfo.DeserializeStoragePoolSkuInfo, ResourceSkusClientDiagnostics, Pipeline, "MockableStoragePoolSubscriptionResource.GetResourceSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Lists available StoragePool resources and skus in an Azure location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/skus + /// + /// + /// Operation Id + /// ResourceSkus_List + /// + /// + /// + /// The location of the resource. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetResourceSkus(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, StoragePoolSkuInfo.DeserializeStoragePoolSkuInfo, ResourceSkusClientDiagnostics, Pipeline, "MockableStoragePoolSubscriptionResource.GetResourceSkus", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 6698c42f3252d..0000000000000 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.StoragePool -{ - /// 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 DiskPoolResources in the ResourceGroupResource. - /// An object representing collection of DiskPoolResources and their operations over a DiskPoolResource. - public virtual DiskPoolCollection GetDiskPools() - { - return GetCachedClient(Client => new DiskPoolCollection(Client, Id)); - } - } -} diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/StoragePoolExtensions.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/StoragePoolExtensions.cs index 1b68977665fc2..d6589097e40da 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/StoragePoolExtensions.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/StoragePoolExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.StoragePool.Mocking; using Azure.ResourceManager.StoragePool.Models; namespace Azure.ResourceManager.StoragePool @@ -19,81 +20,65 @@ namespace Azure.ResourceManager.StoragePool /// A class to add extension methods to Azure.ResourceManager.StoragePool. public static partial class StoragePoolExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableStoragePoolArmClient GetMockableStoragePoolArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableStoragePoolArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableStoragePoolResourceGroupResource GetMockableStoragePoolResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableStoragePoolResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableStoragePoolSubscriptionResource GetMockableStoragePoolSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableStoragePoolSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region DiskPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DiskPoolResource GetDiskPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DiskPoolResource.ValidateResourceId(id); - return new DiskPoolResource(client, id); - } - ); + return GetMockableStoragePoolArmClient(client).GetDiskPoolResource(id); } - #endregion - #region DiskPoolIscsiTargetResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DiskPoolIscsiTargetResource GetDiskPoolIscsiTargetResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DiskPoolIscsiTargetResource.ValidateResourceId(id); - return new DiskPoolIscsiTargetResource(client, id); - } - ); + return GetMockableStoragePoolArmClient(client).GetDiskPoolIscsiTargetResource(id); } - #endregion - /// Gets a collection of DiskPoolResources in the ResourceGroupResource. + /// + /// Gets a collection of DiskPoolResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DiskPoolResources and their operations over a DiskPoolResource. public static DiskPoolCollection GetDiskPools(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDiskPools(); + return GetMockableStoragePoolResourceGroupResource(resourceGroupResource).GetDiskPools(); } /// @@ -108,16 +93,20 @@ public static DiskPoolCollection GetDiskPools(this ResourceGroupResource resourc /// DiskPools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Disk Pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDiskPoolAsync(this ResourceGroupResource resourceGroupResource, string diskPoolName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetDiskPools().GetAsync(diskPoolName, cancellationToken).ConfigureAwait(false); + return await GetMockableStoragePoolResourceGroupResource(resourceGroupResource).GetDiskPoolAsync(diskPoolName, cancellationToken).ConfigureAwait(false); } /// @@ -132,16 +121,20 @@ public static async Task> GetDiskPoolAsync(this Resou /// DiskPools_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Disk Pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDiskPool(this ResourceGroupResource resourceGroupResource, string diskPoolName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetDiskPools().Get(diskPoolName, cancellationToken); + return GetMockableStoragePoolResourceGroupResource(resourceGroupResource).GetDiskPool(diskPoolName, cancellationToken); } /// @@ -156,13 +149,17 @@ public static Response GetDiskPool(this ResourceGroupResource /// DiskPools_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiskPoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskPoolsAsync(cancellationToken); + return GetMockableStoragePoolSubscriptionResource(subscriptionResource).GetDiskPoolsAsync(cancellationToken); } /// @@ -177,13 +174,17 @@ public static AsyncPageable GetDiskPoolsAsync(this Subscriptio /// DiskPools_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetDiskPools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskPools(cancellationToken); + return GetMockableStoragePoolSubscriptionResource(subscriptionResource).GetDiskPools(cancellationToken); } /// @@ -198,6 +199,10 @@ public static Pageable GetDiskPools(this SubscriptionResource /// DiskPoolZones_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -205,7 +210,7 @@ public static Pageable GetDiskPools(this SubscriptionResource /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDiskPoolZonesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskPoolZonesAsync(location, cancellationToken); + return GetMockableStoragePoolSubscriptionResource(subscriptionResource).GetDiskPoolZonesAsync(location, cancellationToken); } /// @@ -220,6 +225,10 @@ public static AsyncPageable GetDiskPoolZonesAsync(this Subscri /// DiskPoolZones_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -227,7 +236,7 @@ public static AsyncPageable GetDiskPoolZonesAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDiskPoolZones(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDiskPoolZones(location, cancellationToken); + return GetMockableStoragePoolSubscriptionResource(subscriptionResource).GetDiskPoolZones(location, cancellationToken); } /// @@ -242,6 +251,10 @@ public static Pageable GetDiskPoolZones(this SubscriptionResou /// ResourceSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -249,7 +262,7 @@ public static Pageable GetDiskPoolZones(this SubscriptionResou /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetResourceSkusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceSkusAsync(location, cancellationToken); + return GetMockableStoragePoolSubscriptionResource(subscriptionResource).GetResourceSkusAsync(location, cancellationToken); } /// @@ -264,6 +277,10 @@ public static AsyncPageable GetResourceSkusAsync(this Subscr /// ResourceSkus_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location of the resource. @@ -271,7 +288,7 @@ public static AsyncPageable GetResourceSkusAsync(this Subscr /// A collection of that may take multiple service requests to iterate over. public static Pageable GetResourceSkus(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetResourceSkus(location, cancellationToken); + return GetMockableStoragePoolSubscriptionResource(subscriptionResource).GetResourceSkus(location, cancellationToken); } } } diff --git a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 223f73b1f11a5..0000000000000 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.StoragePool.Models; - -namespace Azure.ResourceManager.StoragePool -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _diskPoolClientDiagnostics; - private DiskPoolsRestOperations _diskPoolRestClient; - private ClientDiagnostics _diskPoolZonesClientDiagnostics; - private DiskPoolZonesRestOperations _diskPoolZonesRestClient; - private ClientDiagnostics _resourceSkusClientDiagnostics; - private ResourceSkusRestOperations _resourceSkusRestClient; - - /// 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 DiskPoolClientDiagnostics => _diskPoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StoragePool", DiskPoolResource.ResourceType.Namespace, Diagnostics); - private DiskPoolsRestOperations DiskPoolRestClient => _diskPoolRestClient ??= new DiskPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DiskPoolResource.ResourceType)); - private ClientDiagnostics DiskPoolZonesClientDiagnostics => _diskPoolZonesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StoragePool", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DiskPoolZonesRestOperations DiskPoolZonesRestClient => _diskPoolZonesRestClient ??= new DiskPoolZonesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ResourceSkusClientDiagnostics => _resourceSkusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StoragePool", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceSkusRestOperations ResourceSkusRestClient => _resourceSkusRestClient ??= new ResourceSkusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets a list of Disk Pools in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/diskPools - /// - /// - /// Operation Id - /// DiskPools_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDiskPoolsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskPoolRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskPoolRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DiskPoolResource(Client, DiskPoolData.DeserializeDiskPoolData(e)), DiskPoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskPools", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of Disk Pools in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/diskPools - /// - /// - /// Operation Id - /// DiskPools_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDiskPools(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskPoolRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskPoolRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DiskPoolResource(Client, DiskPoolData.DeserializeDiskPoolData(e)), DiskPoolClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskPools", "value", "nextLink", cancellationToken); - } - - /// - /// Lists available Disk Pool Skus in an Azure location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/diskPoolZones - /// - /// - /// Operation Id - /// DiskPoolZones_List - /// - /// - /// - /// The location of the resource. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDiskPoolZonesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskPoolZonesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskPoolZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DiskPoolZoneInfo.DeserializeDiskPoolZoneInfo, DiskPoolZonesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskPoolZones", "value", "nextLink", cancellationToken); - } - - /// - /// Lists available Disk Pool Skus in an Azure location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/diskPoolZones - /// - /// - /// Operation Id - /// DiskPoolZones_List - /// - /// - /// - /// The location of the resource. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDiskPoolZones(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DiskPoolZonesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DiskPoolZonesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DiskPoolZoneInfo.DeserializeDiskPoolZoneInfo, DiskPoolZonesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDiskPoolZones", "value", "nextLink", cancellationToken); - } - - /// - /// Lists available StoragePool resources and skus in an Azure location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/skus - /// - /// - /// Operation Id - /// ResourceSkus_List - /// - /// - /// - /// The location of the resource. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetResourceSkusAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, StoragePoolSkuInfo.DeserializeStoragePoolSkuInfo, ResourceSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceSkus", "value", "nextLink", cancellationToken); - } - - /// - /// Lists available StoragePool resources and skus in an Azure location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/locations/{location}/skus - /// - /// - /// Operation Id - /// ResourceSkus_List - /// - /// - /// - /// The location of the resource. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetResourceSkus(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceSkusRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceSkusRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, StoragePoolSkuInfo.DeserializeStoragePoolSkuInfo, ResourceSkusClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetResourceSkus", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/api/Azure.ResourceManager.StorageSync.netstandard2.0.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/api/Azure.ResourceManager.StorageSync.netstandard2.0.cs index c9b3d40c52a4f..a0cd9fbef239b 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/api/Azure.ResourceManager.StorageSync.netstandard2.0.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/api/Azure.ResourceManager.StorageSync.netstandard2.0.cs @@ -293,7 +293,7 @@ protected StorageSyncServiceCollection() { } } public partial class StorageSyncServiceData : Azure.ResourceManager.Models.TrackedResourceData { - public StorageSyncServiceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StorageSyncServiceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.StorageSync.Models.IncomingTrafficPolicy? IncomingTrafficPolicy { get { throw null; } set { } } public string LastOperationName { get { throw null; } } public string LastWorkflowId { get { throw null; } } @@ -376,6 +376,35 @@ protected StorageSyncWorkflowResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.StorageSync.Mocking +{ + public partial class MockableStorageSyncArmClient : Azure.ResourceManager.ArmResource + { + protected MockableStorageSyncArmClient() { } + public virtual Azure.ResourceManager.StorageSync.CloudEndpointResource GetCloudEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageSync.StorageSyncGroupResource GetStorageSyncGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageSync.StorageSyncPrivateEndpointConnectionResource GetStorageSyncPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageSync.StorageSyncRegisteredServerResource GetStorageSyncRegisteredServerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageSync.StorageSyncServerEndpointResource GetStorageSyncServerEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageSync.StorageSyncServiceResource GetStorageSyncServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StorageSync.StorageSyncWorkflowResource GetStorageSyncWorkflowResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableStorageSyncResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableStorageSyncResourceGroupResource() { } + public virtual Azure.Response GetStorageSyncService(string storageSyncServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetStorageSyncServiceAsync(string storageSyncServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.StorageSync.StorageSyncServiceCollection GetStorageSyncServices() { throw null; } + } + public partial class MockableStorageSyncSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableStorageSyncSubscriptionResource() { } + public virtual Azure.Response CheckStorageSyncNameAvailability(string locationName, Azure.ResourceManager.StorageSync.Models.StorageSyncNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckStorageSyncNameAvailabilityAsync(string locationName, Azure.ResourceManager.StorageSync.Models.StorageSyncNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStorageSyncServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStorageSyncServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.StorageSync.Models { public static partial class ArmStorageSyncModelFactory diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/CloudEndpointResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/CloudEndpointResource.cs index 21a36da37626b..4664ebee0910b 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/CloudEndpointResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/CloudEndpointResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.StorageSync public partial class CloudEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageSyncServiceName. + /// The syncGroupName. + /// The cloudEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}"; diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncArmClient.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncArmClient.cs new file mode 100644 index 0000000000000..e2b71b3d4888d --- /dev/null +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.StorageSync; + +namespace Azure.ResourceManager.StorageSync.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableStorageSyncArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageSyncArmClient() + { + } + + /// 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 MockableStorageSyncArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableStorageSyncArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageSyncServiceResource GetStorageSyncServiceResource(ResourceIdentifier id) + { + StorageSyncServiceResource.ValidateResourceId(id); + return new StorageSyncServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageSyncPrivateEndpointConnectionResource GetStorageSyncPrivateEndpointConnectionResource(ResourceIdentifier id) + { + StorageSyncPrivateEndpointConnectionResource.ValidateResourceId(id); + return new StorageSyncPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageSyncGroupResource GetStorageSyncGroupResource(ResourceIdentifier id) + { + StorageSyncGroupResource.ValidateResourceId(id); + return new StorageSyncGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CloudEndpointResource GetCloudEndpointResource(ResourceIdentifier id) + { + CloudEndpointResource.ValidateResourceId(id); + return new CloudEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageSyncServerEndpointResource GetStorageSyncServerEndpointResource(ResourceIdentifier id) + { + StorageSyncServerEndpointResource.ValidateResourceId(id); + return new StorageSyncServerEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageSyncRegisteredServerResource GetStorageSyncRegisteredServerResource(ResourceIdentifier id) + { + StorageSyncRegisteredServerResource.ValidateResourceId(id); + return new StorageSyncRegisteredServerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StorageSyncWorkflowResource GetStorageSyncWorkflowResource(ResourceIdentifier id) + { + StorageSyncWorkflowResource.ValidateResourceId(id); + return new StorageSyncWorkflowResource(Client, id); + } + } +} diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncResourceGroupResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncResourceGroupResource.cs new file mode 100644 index 0000000000000..a20c452e84630 --- /dev/null +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.StorageSync; + +namespace Azure.ResourceManager.StorageSync.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableStorageSyncResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStorageSyncResourceGroupResource() + { + } + + /// 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 MockableStorageSyncResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of StorageSyncServiceResources in the ResourceGroupResource. + /// An object representing collection of StorageSyncServiceResources and their operations over a StorageSyncServiceResource. + public virtual StorageSyncServiceCollection GetStorageSyncServices() + { + return GetCachedClient(client => new StorageSyncServiceCollection(client, Id)); + } + + /// + /// Get a given StorageSyncService. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName} + /// + /// + /// Operation Id + /// StorageSyncServices_Get + /// + /// + /// + /// Name of Storage Sync Service resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStorageSyncServiceAsync(string storageSyncServiceName, CancellationToken cancellationToken = default) + { + return await GetStorageSyncServices().GetAsync(storageSyncServiceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a given StorageSyncService. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName} + /// + /// + /// Operation Id + /// StorageSyncServices_Get + /// + /// + /// + /// Name of Storage Sync Service resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStorageSyncService(string storageSyncServiceName, CancellationToken cancellationToken = default) + { + return GetStorageSyncServices().Get(storageSyncServiceName, cancellationToken); + } + } +} diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncSubscriptionResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncSubscriptionResource.cs new file mode 100644 index 0000000000000..985b8935baf81 --- /dev/null +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncSubscriptionResource.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.StorageSync; +using Azure.ResourceManager.StorageSync.Models; + +namespace Azure.ResourceManager.StorageSync.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableStorageSyncSubscriptionResource : ArmResource + { + private ClientDiagnostics _storageSyncServiceClientDiagnostics; + private StorageSyncServicesRestOperations _storageSyncServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableStorageSyncSubscriptionResource() + { + } + + /// 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 MockableStorageSyncSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics StorageSyncServiceClientDiagnostics => _storageSyncServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageSync", StorageSyncServiceResource.ResourceType.Namespace, Diagnostics); + private StorageSyncServicesRestOperations StorageSyncServiceRestClient => _storageSyncServiceRestClient ??= new StorageSyncServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageSyncServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Check the give namespace name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// StorageSyncServices_CheckNameAvailability + /// + /// + /// + /// The desired region for the name check. + /// Parameters to check availability of the given namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CheckStorageSyncNameAvailabilityAsync(string locationName, StorageSyncNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = StorageSyncServiceClientDiagnostics.CreateScope("MockableStorageSyncSubscriptionResource.CheckStorageSyncNameAvailability"); + scope.Start(); + try + { + var response = await StorageSyncServiceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the give namespace name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability + /// + /// + /// Operation Id + /// StorageSyncServices_CheckNameAvailability + /// + /// + /// + /// The desired region for the name check. + /// Parameters to check availability of the given namespace name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response CheckStorageSyncNameAvailability(string locationName, StorageSyncNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = StorageSyncServiceClientDiagnostics.CreateScope("MockableStorageSyncSubscriptionResource.CheckStorageSyncNameAvailability"); + scope.Start(); + try + { + var response = StorageSyncServiceRestClient.CheckNameAvailability(Id.SubscriptionId, locationName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a StorageSyncService list by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices + /// + /// + /// Operation Id + /// StorageSyncServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageSyncServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageSyncServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new StorageSyncServiceResource(Client, StorageSyncServiceData.DeserializeStorageSyncServiceData(e)), StorageSyncServiceClientDiagnostics, Pipeline, "MockableStorageSyncSubscriptionResource.GetStorageSyncServices", "value", null, cancellationToken); + } + + /// + /// Get a StorageSyncService list by subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices + /// + /// + /// Operation Id + /// StorageSyncServices_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageSyncServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageSyncServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new StorageSyncServiceResource(Client, StorageSyncServiceData.DeserializeStorageSyncServiceData(e)), StorageSyncServiceClientDiagnostics, Pipeline, "MockableStorageSyncSubscriptionResource.GetStorageSyncServices", "value", null, cancellationToken); + } + } +} diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index c5274b6edc5c6..0000000000000 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.StorageSync -{ - /// 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 StorageSyncServiceResources in the ResourceGroupResource. - /// An object representing collection of StorageSyncServiceResources and their operations over a StorageSyncServiceResource. - public virtual StorageSyncServiceCollection GetStorageSyncServices() - { - return GetCachedClient(Client => new StorageSyncServiceCollection(Client, Id)); - } - } -} diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/StorageSyncExtensions.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/StorageSyncExtensions.cs index 7f0698e250c8b..d7672f263118e 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/StorageSyncExtensions.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/StorageSyncExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.StorageSync.Mocking; using Azure.ResourceManager.StorageSync.Models; namespace Azure.ResourceManager.StorageSync @@ -19,176 +20,145 @@ namespace Azure.ResourceManager.StorageSync /// A class to add extension methods to Azure.ResourceManager.StorageSync. public static partial class StorageSyncExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableStorageSyncArmClient GetMockableStorageSyncArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableStorageSyncArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableStorageSyncResourceGroupResource GetMockableStorageSyncResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableStorageSyncResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableStorageSyncSubscriptionResource GetMockableStorageSyncSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableStorageSyncSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region StorageSyncServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageSyncServiceResource GetStorageSyncServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageSyncServiceResource.ValidateResourceId(id); - return new StorageSyncServiceResource(client, id); - } - ); + return GetMockableStorageSyncArmClient(client).GetStorageSyncServiceResource(id); } - #endregion - #region StorageSyncPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageSyncPrivateEndpointConnectionResource GetStorageSyncPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageSyncPrivateEndpointConnectionResource.ValidateResourceId(id); - return new StorageSyncPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableStorageSyncArmClient(client).GetStorageSyncPrivateEndpointConnectionResource(id); } - #endregion - #region StorageSyncGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageSyncGroupResource GetStorageSyncGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageSyncGroupResource.ValidateResourceId(id); - return new StorageSyncGroupResource(client, id); - } - ); + return GetMockableStorageSyncArmClient(client).GetStorageSyncGroupResource(id); } - #endregion - #region CloudEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CloudEndpointResource GetCloudEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CloudEndpointResource.ValidateResourceId(id); - return new CloudEndpointResource(client, id); - } - ); + return GetMockableStorageSyncArmClient(client).GetCloudEndpointResource(id); } - #endregion - #region StorageSyncServerEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageSyncServerEndpointResource GetStorageSyncServerEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageSyncServerEndpointResource.ValidateResourceId(id); - return new StorageSyncServerEndpointResource(client, id); - } - ); + return GetMockableStorageSyncArmClient(client).GetStorageSyncServerEndpointResource(id); } - #endregion - #region StorageSyncRegisteredServerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageSyncRegisteredServerResource GetStorageSyncRegisteredServerResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageSyncRegisteredServerResource.ValidateResourceId(id); - return new StorageSyncRegisteredServerResource(client, id); - } - ); + return GetMockableStorageSyncArmClient(client).GetStorageSyncRegisteredServerResource(id); } - #endregion - #region StorageSyncWorkflowResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StorageSyncWorkflowResource GetStorageSyncWorkflowResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StorageSyncWorkflowResource.ValidateResourceId(id); - return new StorageSyncWorkflowResource(client, id); - } - ); + return GetMockableStorageSyncArmClient(client).GetStorageSyncWorkflowResource(id); } - #endregion - /// Gets a collection of StorageSyncServiceResources in the ResourceGroupResource. + /// + /// Gets a collection of StorageSyncServiceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of StorageSyncServiceResources and their operations over a StorageSyncServiceResource. public static StorageSyncServiceCollection GetStorageSyncServices(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStorageSyncServices(); + return GetMockableStorageSyncResourceGroupResource(resourceGroupResource).GetStorageSyncServices(); } /// @@ -203,16 +173,20 @@ public static StorageSyncServiceCollection GetStorageSyncServices(this ResourceG /// StorageSyncServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of Storage Sync Service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetStorageSyncServiceAsync(this ResourceGroupResource resourceGroupResource, string storageSyncServiceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetStorageSyncServices().GetAsync(storageSyncServiceName, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageSyncResourceGroupResource(resourceGroupResource).GetStorageSyncServiceAsync(storageSyncServiceName, cancellationToken).ConfigureAwait(false); } /// @@ -227,16 +201,20 @@ public static async Task> GetStorageSyncSer /// StorageSyncServices_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of Storage Sync Service resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetStorageSyncService(this ResourceGroupResource resourceGroupResource, string storageSyncServiceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetStorageSyncServices().Get(storageSyncServiceName, cancellationToken); + return GetMockableStorageSyncResourceGroupResource(resourceGroupResource).GetStorageSyncService(storageSyncServiceName, cancellationToken); } /// @@ -251,6 +229,10 @@ public static Response GetStorageSyncService(this Re /// StorageSyncServices_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The desired region for the name check. @@ -260,10 +242,7 @@ public static Response GetStorageSyncService(this Re /// or is null. public static async Task> CheckStorageSyncNameAvailabilityAsync(this SubscriptionResource subscriptionResource, string locationName, StorageSyncNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckStorageSyncNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); + return await GetMockableStorageSyncSubscriptionResource(subscriptionResource).CheckStorageSyncNameAvailabilityAsync(locationName, content, cancellationToken).ConfigureAwait(false); } /// @@ -278,6 +257,10 @@ public static async Task> CheckStora /// StorageSyncServices_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The desired region for the name check. @@ -287,10 +270,7 @@ public static async Task> CheckStora /// or is null. public static Response CheckStorageSyncNameAvailability(this SubscriptionResource subscriptionResource, string locationName, StorageSyncNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(locationName, nameof(locationName)); - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckStorageSyncNameAvailability(locationName, content, cancellationToken); + return GetMockableStorageSyncSubscriptionResource(subscriptionResource).CheckStorageSyncNameAvailability(locationName, content, cancellationToken); } /// @@ -305,13 +285,17 @@ public static Response CheckStorageSyncNameAv /// StorageSyncServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageSyncServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageSyncServicesAsync(cancellationToken); + return GetMockableStorageSyncSubscriptionResource(subscriptionResource).GetStorageSyncServicesAsync(cancellationToken); } /// @@ -326,13 +310,17 @@ public static AsyncPageable GetStorageSyncServicesAs /// StorageSyncServices_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStorageSyncServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStorageSyncServices(cancellationToken); + return GetMockableStorageSyncSubscriptionResource(subscriptionResource).GetStorageSyncServices(cancellationToken); } } } diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index e67cff5463bb9..0000000000000 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.StorageSync.Models; - -namespace Azure.ResourceManager.StorageSync -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _storageSyncServiceClientDiagnostics; - private StorageSyncServicesRestOperations _storageSyncServiceRestClient; - - /// 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 StorageSyncServiceClientDiagnostics => _storageSyncServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StorageSync", StorageSyncServiceResource.ResourceType.Namespace, Diagnostics); - private StorageSyncServicesRestOperations StorageSyncServiceRestClient => _storageSyncServiceRestClient ??= new StorageSyncServicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StorageSyncServiceResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Check the give namespace name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// StorageSyncServices_CheckNameAvailability - /// - /// - /// - /// The desired region for the name check. - /// Parameters to check availability of the given namespace name. - /// The cancellation token to use. - public virtual async Task> CheckStorageSyncNameAvailabilityAsync(string locationName, StorageSyncNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = StorageSyncServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckStorageSyncNameAvailability"); - scope.Start(); - try - { - var response = await StorageSyncServiceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, locationName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the give namespace name availability. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability - /// - /// - /// Operation Id - /// StorageSyncServices_CheckNameAvailability - /// - /// - /// - /// The desired region for the name check. - /// Parameters to check availability of the given namespace name. - /// The cancellation token to use. - public virtual Response CheckStorageSyncNameAvailability(string locationName, StorageSyncNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = StorageSyncServiceClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckStorageSyncNameAvailability"); - scope.Start(); - try - { - var response = StorageSyncServiceRestClient.CheckNameAvailability(Id.SubscriptionId, locationName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a StorageSyncService list by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices - /// - /// - /// Operation Id - /// StorageSyncServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageSyncServicesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageSyncServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new StorageSyncServiceResource(Client, StorageSyncServiceData.DeserializeStorageSyncServiceData(e)), StorageSyncServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageSyncServices", "value", null, cancellationToken); - } - - /// - /// Get a StorageSyncService list by subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices - /// - /// - /// Operation Id - /// StorageSyncServices_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageSyncServices(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageSyncServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new StorageSyncServiceResource(Client, StorageSyncServiceData.DeserializeStorageSyncServiceData(e)), StorageSyncServiceClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStorageSyncServices", "value", null, cancellationToken); - } - } -} diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupResource.cs index ded93ef8aedb2..31dff1ba9295d 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StorageSync public partial class StorageSyncGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageSyncServiceName. + /// The syncGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageSyncServiceName, string syncGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}"; @@ -91,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CloudEndpointResources and their operations over a CloudEndpointResource. public virtual CloudEndpointCollection GetCloudEndpoints() { - return GetCachedClient(Client => new CloudEndpointCollection(Client, Id)); + return GetCachedClient(client => new CloudEndpointCollection(client, Id)); } /// @@ -109,8 +113,8 @@ public virtual CloudEndpointCollection GetCloudEndpoints() /// /// Name of Cloud Endpoint object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCloudEndpointAsync(string cloudEndpointName, CancellationToken cancellationToken = default) { @@ -132,8 +136,8 @@ public virtual async Task> GetCloudEndpointAsync /// /// Name of Cloud Endpoint object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCloudEndpoint(string cloudEndpointName, CancellationToken cancellationToken = default) { @@ -144,7 +148,7 @@ public virtual Response GetCloudEndpoint(string cloudEndp /// An object representing collection of StorageSyncServerEndpointResources and their operations over a StorageSyncServerEndpointResource. public virtual StorageSyncServerEndpointCollection GetStorageSyncServerEndpoints() { - return GetCachedClient(Client => new StorageSyncServerEndpointCollection(Client, Id)); + return GetCachedClient(client => new StorageSyncServerEndpointCollection(client, Id)); } /// @@ -162,8 +166,8 @@ public virtual StorageSyncServerEndpointCollection GetStorageSyncServerEndpoints /// /// Name of Server Endpoint object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageSyncServerEndpointAsync(string serverEndpointName, CancellationToken cancellationToken = default) { @@ -185,8 +189,8 @@ public virtual async Task> GetStorag /// /// Name of Server Endpoint object. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageSyncServerEndpoint(string serverEndpointName, CancellationToken cancellationToken = default) { diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncPrivateEndpointConnectionResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncPrivateEndpointConnectionResource.cs index 764bf12324d29..a545171105636 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncPrivateEndpointConnectionResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.StorageSync public partial class StorageSyncPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageSyncServiceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncRegisteredServerResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncRegisteredServerResource.cs index 70143626271a8..6a7454e9caa8c 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncRegisteredServerResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncRegisteredServerResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StorageSync public partial class StorageSyncRegisteredServerResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageSyncServiceName. + /// The serverId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageSyncServiceName, Guid serverId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}"; diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServerEndpointResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServerEndpointResource.cs index f2fd3b9889c12..12a759483209a 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServerEndpointResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServerEndpointResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.StorageSync public partial class StorageSyncServerEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageSyncServiceName. + /// The syncGroupName. + /// The serverEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageSyncServiceName, string syncGroupName, string serverEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}"; diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceResource.cs index 7eeaf292079d0..e6f9dd68b2ad4 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.StorageSync public partial class StorageSyncServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageSyncServiceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageSyncServiceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StorageSyncPrivateEndpointConnectionResources and their operations over a StorageSyncPrivateEndpointConnectionResource. public virtual StorageSyncPrivateEndpointConnectionCollection GetStorageSyncPrivateEndpointConnections() { - return GetCachedClient(Client => new StorageSyncPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new StorageSyncPrivateEndpointConnectionCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual StorageSyncPrivateEndpointConnectionCollection GetStorageSyncPriv /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageSyncPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageSyncPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetStorage /// An object representing collection of StorageSyncGroupResources and their operations over a StorageSyncGroupResource. public virtual StorageSyncGroupCollection GetStorageSyncGroups() { - return GetCachedClient(Client => new StorageSyncGroupCollection(Client, Id)); + return GetCachedClient(client => new StorageSyncGroupCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual StorageSyncGroupCollection GetStorageSyncGroups() /// /// Name of Sync Group resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageSyncGroupAsync(string syncGroupName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> GetStorageSyncGrou /// /// Name of Sync Group resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageSyncGroup(string syncGroupName, CancellationToken cancellationToken = default) { @@ -204,7 +207,7 @@ public virtual Response GetStorageSyncGroup(string syn /// An object representing collection of StorageSyncRegisteredServerResources and their operations over a StorageSyncRegisteredServerResource. public virtual StorageSyncRegisteredServerCollection GetStorageSyncRegisteredServers() { - return GetCachedClient(Client => new StorageSyncRegisteredServerCollection(Client, Id)); + return GetCachedClient(client => new StorageSyncRegisteredServerCollection(client, Id)); } /// @@ -253,7 +256,7 @@ public virtual Response GetStorageSyncRegis /// An object representing collection of StorageSyncWorkflowResources and their operations over a StorageSyncWorkflowResource. public virtual StorageSyncWorkflowCollection GetStorageSyncWorkflows() { - return GetCachedClient(Client => new StorageSyncWorkflowCollection(Client, Id)); + return GetCachedClient(client => new StorageSyncWorkflowCollection(client, Id)); } /// @@ -271,8 +274,8 @@ public virtual StorageSyncWorkflowCollection GetStorageSyncWorkflows() /// /// workflow Id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStorageSyncWorkflowAsync(string workflowId, CancellationToken cancellationToken = default) { @@ -294,8 +297,8 @@ public virtual async Task> GetStorageSyncW /// /// workflow Id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStorageSyncWorkflow(string workflowId, CancellationToken cancellationToken = default) { diff --git a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncWorkflowResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncWorkflowResource.cs index 7998cb3c80997..93168bf25f7e1 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncWorkflowResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncWorkflowResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.StorageSync public partial class StorageSyncWorkflowResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The storageSyncServiceName. + /// The workflowId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string storageSyncServiceName, string workflowId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}"; diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/api/Azure.ResourceManager.StreamAnalytics.netstandard2.0.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/api/Azure.ResourceManager.StreamAnalytics.netstandard2.0.cs index d7ffc305fc64c..3d2ef18221615 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/api/Azure.ResourceManager.StreamAnalytics.netstandard2.0.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/api/Azure.ResourceManager.StreamAnalytics.netstandard2.0.cs @@ -19,7 +19,7 @@ protected StreamAnalyticsClusterCollection() { } } public partial class StreamAnalyticsClusterData : Azure.ResourceManager.Models.TrackedResourceData { - public StreamAnalyticsClusterData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StreamAnalyticsClusterData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsClusterProperties Properties { get { throw null; } set { } } public Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsClusterSku Sku { get { throw null; } set { } } @@ -137,7 +137,7 @@ protected StreamingJobCollection() { } } public partial class StreamingJobData : Azure.ResourceManager.Models.TrackedResourceData { - public StreamingJobData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StreamingJobData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier ClusterId { get { throw null; } set { } } public Azure.ResourceManager.StreamAnalytics.Models.StreamingJobCompatibilityLevel? CompatibilityLevel { get { throw null; } set { } } public Azure.ResourceManager.StreamAnalytics.Models.StreamingJobContentStoragePolicy? ContentStoragePolicy { get { throw null; } set { } } @@ -361,6 +361,50 @@ protected StreamingJobTransformationResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.StreamAnalytics.StreamingJobTransformationData data, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.StreamAnalytics.Mocking +{ + public partial class MockableStreamAnalyticsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableStreamAnalyticsArmClient() { } + public virtual Azure.ResourceManager.StreamAnalytics.StreamAnalyticsClusterResource GetStreamAnalyticsClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StreamAnalytics.StreamAnalyticsPrivateEndpointResource GetStreamAnalyticsPrivateEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StreamAnalytics.StreamingJobFunctionResource GetStreamingJobFunctionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StreamAnalytics.StreamingJobInputResource GetStreamingJobInputResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StreamAnalytics.StreamingJobOutputResource GetStreamingJobOutputResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StreamAnalytics.StreamingJobResource GetStreamingJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.StreamAnalytics.StreamingJobTransformationResource GetStreamingJobTransformationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableStreamAnalyticsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableStreamAnalyticsResourceGroupResource() { } + public virtual Azure.Response GetStreamAnalyticsCluster(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetStreamAnalyticsClusterAsync(string clusterName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.StreamAnalytics.StreamAnalyticsClusterCollection GetStreamAnalyticsClusters() { throw null; } + public virtual Azure.Response GetStreamingJob(string jobName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetStreamingJobAsync(string jobName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.StreamAnalytics.StreamingJobCollection GetStreamingJobs() { throw null; } + } + public partial class MockableStreamAnalyticsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableStreamAnalyticsSubscriptionResource() { } + public virtual Azure.Response CompileQuerySubscription(Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsCompileQuery compileQuery, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CompileQuerySubscriptionAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsCompileQuery compileQuery, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQuotasSubscriptions(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQuotasSubscriptionsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStreamAnalyticsClusters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStreamAnalyticsClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStreamingJobs(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStreamingJobsAsync(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation SampleInputSubscription(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsSampleInputContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SampleInputSubscriptionAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsSampleInputContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation TestInputSubscription(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsTestContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> TestInputSubscriptionAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsTestContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation TestOutputSubscription(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsTestOutput testOutput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> TestOutputSubscriptionAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsTestOutput testOutput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation TestQuerySubscription(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsTestQuery testQuery, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> TestQuerySubscriptionAsync(Azure.WaitUntil waitUntil, Azure.Core.AzureLocation location, Azure.ResourceManager.StreamAnalytics.Models.StreamAnalyticsTestQuery testQuery, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.StreamAnalytics.Models { public partial class AggregateFunctionProperties : Azure.ResourceManager.StreamAnalytics.Models.StreamingJobFunctionProperties diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsArmClient.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsArmClient.cs new file mode 100644 index 0000000000000..d3f92c0b2e45f --- /dev/null +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.StreamAnalytics; + +namespace Azure.ResourceManager.StreamAnalytics.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableStreamAnalyticsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStreamAnalyticsArmClient() + { + } + + /// 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 MockableStreamAnalyticsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableStreamAnalyticsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamingJobFunctionResource GetStreamingJobFunctionResource(ResourceIdentifier id) + { + StreamingJobFunctionResource.ValidateResourceId(id); + return new StreamingJobFunctionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamingJobInputResource GetStreamingJobInputResource(ResourceIdentifier id) + { + StreamingJobInputResource.ValidateResourceId(id); + return new StreamingJobInputResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamingJobOutputResource GetStreamingJobOutputResource(ResourceIdentifier id) + { + StreamingJobOutputResource.ValidateResourceId(id); + return new StreamingJobOutputResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamingJobResource GetStreamingJobResource(ResourceIdentifier id) + { + StreamingJobResource.ValidateResourceId(id); + return new StreamingJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamingJobTransformationResource GetStreamingJobTransformationResource(ResourceIdentifier id) + { + StreamingJobTransformationResource.ValidateResourceId(id); + return new StreamingJobTransformationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamAnalyticsClusterResource GetStreamAnalyticsClusterResource(ResourceIdentifier id) + { + StreamAnalyticsClusterResource.ValidateResourceId(id); + return new StreamAnalyticsClusterResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StreamAnalyticsPrivateEndpointResource GetStreamAnalyticsPrivateEndpointResource(ResourceIdentifier id) + { + StreamAnalyticsPrivateEndpointResource.ValidateResourceId(id); + return new StreamAnalyticsPrivateEndpointResource(Client, id); + } + } +} diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsResourceGroupResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsResourceGroupResource.cs new file mode 100644 index 0000000000000..fba5b099c0f3f --- /dev/null +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsResourceGroupResource.cs @@ -0,0 +1,147 @@ +// 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.StreamAnalytics; + +namespace Azure.ResourceManager.StreamAnalytics.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableStreamAnalyticsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableStreamAnalyticsResourceGroupResource() + { + } + + /// 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 MockableStreamAnalyticsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of StreamingJobResources in the ResourceGroupResource. + /// An object representing collection of StreamingJobResources and their operations over a StreamingJobResource. + public virtual StreamingJobCollection GetStreamingJobs() + { + return GetCachedClient(client => new StreamingJobCollection(client, Id)); + } + + /// + /// Gets details about the specified streaming job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName} + /// + /// + /// Operation Id + /// StreamingJobs_Get + /// + /// + /// + /// The name of the streaming job. + /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStreamingJobAsync(string jobName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetStreamingJobs().GetAsync(jobName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details about the specified streaming job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName} + /// + /// + /// Operation Id + /// StreamingJobs_Get + /// + /// + /// + /// The name of the streaming job. + /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStreamingJob(string jobName, string expand = null, CancellationToken cancellationToken = default) + { + return GetStreamingJobs().Get(jobName, expand, cancellationToken); + } + + /// Gets a collection of StreamAnalyticsClusterResources in the ResourceGroupResource. + /// An object representing collection of StreamAnalyticsClusterResources and their operations over a StreamAnalyticsClusterResource. + public virtual StreamAnalyticsClusterCollection GetStreamAnalyticsClusters() + { + return GetCachedClient(client => new StreamAnalyticsClusterCollection(client, Id)); + } + + /// + /// Gets information about the specified cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStreamAnalyticsClusterAsync(string clusterName, CancellationToken cancellationToken = default) + { + return await GetStreamAnalyticsClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName} + /// + /// + /// Operation Id + /// Clusters_Get + /// + /// + /// + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStreamAnalyticsCluster(string clusterName, CancellationToken cancellationToken = default) + { + return GetStreamAnalyticsClusters().Get(clusterName, cancellationToken); + } + } +} diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsSubscriptionResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsSubscriptionResource.cs new file mode 100644 index 0000000000000..59dd521eeac38 --- /dev/null +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/MockableStreamAnalyticsSubscriptionResource.cs @@ -0,0 +1,572 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.StreamAnalytics; +using Azure.ResourceManager.StreamAnalytics.Models; + +namespace Azure.ResourceManager.StreamAnalytics.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableStreamAnalyticsSubscriptionResource : ArmResource + { + private ClientDiagnostics _streamingJobClientDiagnostics; + private StreamingJobsRestOperations _streamingJobRestClient; + private ClientDiagnostics _subscriptionsClientDiagnostics; + private SubscriptionsRestOperations _subscriptionsRestClient; + private ClientDiagnostics _streamAnalyticsClusterClustersClientDiagnostics; + private ClustersRestOperations _streamAnalyticsClusterClustersRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableStreamAnalyticsSubscriptionResource() + { + } + + /// 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 MockableStreamAnalyticsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics StreamingJobClientDiagnostics => _streamingJobClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StreamAnalytics", StreamingJobResource.ResourceType.Namespace, Diagnostics); + private StreamingJobsRestOperations StreamingJobRestClient => _streamingJobRestClient ??= new StreamingJobsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StreamingJobResource.ResourceType)); + private ClientDiagnostics SubscriptionsClientDiagnostics => _subscriptionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StreamAnalytics", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SubscriptionsRestOperations SubscriptionsRestClient => _subscriptionsRestClient ??= new SubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics StreamAnalyticsClusterClustersClientDiagnostics => _streamAnalyticsClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StreamAnalytics", StreamAnalyticsClusterResource.ResourceType.Namespace, Diagnostics); + private ClustersRestOperations StreamAnalyticsClusterClustersRestClient => _streamAnalyticsClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StreamAnalyticsClusterResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists all of the streaming jobs in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs + /// + /// + /// Operation Id + /// StreamingJobs_List + /// + /// + /// + /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStreamingJobsAsync(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StreamingJobRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StreamingJobRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StreamingJobResource(Client, StreamingJobData.DeserializeStreamingJobData(e)), StreamingJobClientDiagnostics, Pipeline, "MockableStreamAnalyticsSubscriptionResource.GetStreamingJobs", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the streaming jobs in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs + /// + /// + /// Operation Id + /// StreamingJobs_List + /// + /// + /// + /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStreamingJobs(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StreamingJobRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StreamingJobRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StreamingJobResource(Client, StreamingJobData.DeserializeStreamingJobData(e)), StreamingJobClientDiagnostics, Pipeline, "MockableStreamAnalyticsSubscriptionResource.GetStreamingJobs", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves the subscription's current quota information in a particular region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas + /// + /// + /// Operation Id + /// Subscriptions_ListQuotas + /// + /// + /// + /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetQuotasSubscriptionsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SubscriptionsRestClient.CreateListQuotasRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, StreamAnalyticsSubscriptionQuota.DeserializeStreamAnalyticsSubscriptionQuota, SubscriptionsClientDiagnostics, Pipeline, "MockableStreamAnalyticsSubscriptionResource.GetQuotasSubscriptions", "value", null, cancellationToken); + } + + /// + /// Retrieves the subscription's current quota information in a particular region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas + /// + /// + /// Operation Id + /// Subscriptions_ListQuotas + /// + /// + /// + /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetQuotasSubscriptions(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SubscriptionsRestClient.CreateListQuotasRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, StreamAnalyticsSubscriptionQuota.DeserializeStreamAnalyticsSubscriptionQuota, SubscriptionsClientDiagnostics, Pipeline, "MockableStreamAnalyticsSubscriptionResource.GetQuotasSubscriptions", "value", null, cancellationToken); + } + + /// + /// Test the Stream Analytics query on a sample input. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testQuery + /// + /// + /// Operation Id + /// Subscriptions_TestQuery + /// + /// + /// + /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// The query testing object that defines the input, output, and transformation for the query testing. + /// The cancellation token to use. + /// is null. + public virtual async Task> TestQuerySubscriptionAsync(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestQuery testQuery, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(testQuery, nameof(testQuery)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.TestQuerySubscription"); + scope.Start(); + try + { + var response = await SubscriptionsRestClient.TestQueryAsync(Id.SubscriptionId, location, testQuery, cancellationToken).ConfigureAwait(false); + var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsQueryTestingResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestQueryRequest(Id.SubscriptionId, location, testQuery).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Test the Stream Analytics query on a sample input. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testQuery + /// + /// + /// Operation Id + /// Subscriptions_TestQuery + /// + /// + /// + /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// The query testing object that defines the input, output, and transformation for the query testing. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation TestQuerySubscription(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestQuery testQuery, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(testQuery, nameof(testQuery)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.TestQuerySubscription"); + scope.Start(); + try + { + var response = SubscriptionsRestClient.TestQuery(Id.SubscriptionId, location, testQuery, cancellationToken); + var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsQueryTestingResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestQueryRequest(Id.SubscriptionId, location, testQuery).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Compile the Stream Analytics query. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/compileQuery + /// + /// + /// Operation Id + /// Subscriptions_CompileQuery + /// + /// + /// + /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// The query compilation object which defines the input, output, and transformation for the query compilation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CompileQuerySubscriptionAsync(AzureLocation location, StreamAnalyticsCompileQuery compileQuery, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(compileQuery, nameof(compileQuery)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.CompileQuerySubscription"); + scope.Start(); + try + { + var response = await SubscriptionsRestClient.CompileQueryAsync(Id.SubscriptionId, location, compileQuery, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Compile the Stream Analytics query. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/compileQuery + /// + /// + /// Operation Id + /// Subscriptions_CompileQuery + /// + /// + /// + /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// The query compilation object which defines the input, output, and transformation for the query compilation. + /// The cancellation token to use. + /// is null. + public virtual Response CompileQuerySubscription(AzureLocation location, StreamAnalyticsCompileQuery compileQuery, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(compileQuery, nameof(compileQuery)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.CompileQuerySubscription"); + scope.Start(); + try + { + var response = SubscriptionsRestClient.CompileQuery(Id.SubscriptionId, location, compileQuery, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Sample the Stream Analytics input data. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/sampleInput + /// + /// + /// Operation Id + /// Subscriptions_SampleInput + /// + /// + /// + /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// Defines the necessary parameters for sampling the Stream Analytics input data. + /// The cancellation token to use. + /// is null. + public virtual async Task> SampleInputSubscriptionAsync(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsSampleInputContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.SampleInputSubscription"); + scope.Start(); + try + { + var response = await SubscriptionsRestClient.SampleInputAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsSampleInputResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateSampleInputRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Sample the Stream Analytics input data. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/sampleInput + /// + /// + /// Operation Id + /// Subscriptions_SampleInput + /// + /// + /// + /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// Defines the necessary parameters for sampling the Stream Analytics input data. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation SampleInputSubscription(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsSampleInputContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.SampleInputSubscription"); + scope.Start(); + try + { + var response = SubscriptionsRestClient.SampleInput(Id.SubscriptionId, location, content, cancellationToken); + var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsSampleInputResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateSampleInputRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Test the Stream Analytics input. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testInput + /// + /// + /// Operation Id + /// Subscriptions_TestInput + /// + /// + /// + /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// Defines the necessary parameters for testing the Stream Analytics input. + /// The cancellation token to use. + /// is null. + public virtual async Task> TestInputSubscriptionAsync(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.TestInputSubscription"); + scope.Start(); + try + { + var response = await SubscriptionsRestClient.TestInputAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsTestDatasourceResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestInputRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Test the Stream Analytics input. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testInput + /// + /// + /// Operation Id + /// Subscriptions_TestInput + /// + /// + /// + /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// Defines the necessary parameters for testing the Stream Analytics input. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation TestInputSubscription(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.TestInputSubscription"); + scope.Start(); + try + { + var response = SubscriptionsRestClient.TestInput(Id.SubscriptionId, location, content, cancellationToken); + var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsTestDatasourceResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestInputRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Test the Stream Analytics output. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testOutput + /// + /// + /// Operation Id + /// Subscriptions_TestOutput + /// + /// + /// + /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// Defines the necessary parameters for testing the Stream Analytics output. + /// The cancellation token to use. + /// is null. + public virtual async Task> TestOutputSubscriptionAsync(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestOutput testOutput, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(testOutput, nameof(testOutput)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.TestOutputSubscription"); + scope.Start(); + try + { + var response = await SubscriptionsRestClient.TestOutputAsync(Id.SubscriptionId, location, testOutput, cancellationToken).ConfigureAwait(false); + var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsTestDatasourceResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestOutputRequest(Id.SubscriptionId, location, testOutput).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Test the Stream Analytics output. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testOutput + /// + /// + /// Operation Id + /// Subscriptions_TestOutput + /// + /// + /// + /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. + /// Defines the necessary parameters for testing the Stream Analytics output. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation TestOutputSubscription(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestOutput testOutput, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(testOutput, nameof(testOutput)); + + using var scope = SubscriptionsClientDiagnostics.CreateScope("MockableStreamAnalyticsSubscriptionResource.TestOutputSubscription"); + scope.Start(); + try + { + var response = SubscriptionsRestClient.TestOutput(Id.SubscriptionId, location, testOutput, cancellationToken); + var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsTestDatasourceResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestOutputRequest(Id.SubscriptionId, location, testOutput).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all of the clusters in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters + /// + /// + /// Operation Id + /// Clusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStreamAnalyticsClustersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StreamAnalyticsClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StreamAnalyticsClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StreamAnalyticsClusterResource(Client, StreamAnalyticsClusterData.DeserializeStreamAnalyticsClusterData(e)), StreamAnalyticsClusterClustersClientDiagnostics, Pipeline, "MockableStreamAnalyticsSubscriptionResource.GetStreamAnalyticsClusters", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all of the clusters in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters + /// + /// + /// Operation Id + /// Clusters_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStreamAnalyticsClusters(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StreamAnalyticsClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StreamAnalyticsClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StreamAnalyticsClusterResource(Client, StreamAnalyticsClusterData.DeserializeStreamAnalyticsClusterData(e)), StreamAnalyticsClusterClustersClientDiagnostics, Pipeline, "MockableStreamAnalyticsSubscriptionResource.GetStreamAnalyticsClusters", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 84a4593d2e739..0000000000000 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.StreamAnalytics -{ - /// 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 StreamingJobResources in the ResourceGroupResource. - /// An object representing collection of StreamingJobResources and their operations over a StreamingJobResource. - public virtual StreamingJobCollection GetStreamingJobs() - { - return GetCachedClient(Client => new StreamingJobCollection(Client, Id)); - } - - /// Gets a collection of StreamAnalyticsClusterResources in the ResourceGroupResource. - /// An object representing collection of StreamAnalyticsClusterResources and their operations over a StreamAnalyticsClusterResource. - public virtual StreamAnalyticsClusterCollection GetStreamAnalyticsClusters() - { - return GetCachedClient(Client => new StreamAnalyticsClusterCollection(Client, Id)); - } - } -} diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/StreamAnalyticsExtensions.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/StreamAnalyticsExtensions.cs index 407a34ad78625..409e91a51ad5e 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/StreamAnalyticsExtensions.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/StreamAnalyticsExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.StreamAnalytics.Mocking; using Azure.ResourceManager.StreamAnalytics.Models; namespace Azure.ResourceManager.StreamAnalytics @@ -19,176 +20,145 @@ namespace Azure.ResourceManager.StreamAnalytics /// A class to add extension methods to Azure.ResourceManager.StreamAnalytics. public static partial class StreamAnalyticsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableStreamAnalyticsArmClient GetMockableStreamAnalyticsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableStreamAnalyticsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableStreamAnalyticsResourceGroupResource GetMockableStreamAnalyticsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableStreamAnalyticsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableStreamAnalyticsSubscriptionResource GetMockableStreamAnalyticsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableStreamAnalyticsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region StreamingJobFunctionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamingJobFunctionResource GetStreamingJobFunctionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamingJobFunctionResource.ValidateResourceId(id); - return new StreamingJobFunctionResource(client, id); - } - ); + return GetMockableStreamAnalyticsArmClient(client).GetStreamingJobFunctionResource(id); } - #endregion - #region StreamingJobInputResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamingJobInputResource GetStreamingJobInputResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamingJobInputResource.ValidateResourceId(id); - return new StreamingJobInputResource(client, id); - } - ); + return GetMockableStreamAnalyticsArmClient(client).GetStreamingJobInputResource(id); } - #endregion - #region StreamingJobOutputResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamingJobOutputResource GetStreamingJobOutputResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamingJobOutputResource.ValidateResourceId(id); - return new StreamingJobOutputResource(client, id); - } - ); + return GetMockableStreamAnalyticsArmClient(client).GetStreamingJobOutputResource(id); } - #endregion - #region StreamingJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamingJobResource GetStreamingJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamingJobResource.ValidateResourceId(id); - return new StreamingJobResource(client, id); - } - ); + return GetMockableStreamAnalyticsArmClient(client).GetStreamingJobResource(id); } - #endregion - #region StreamingJobTransformationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamingJobTransformationResource GetStreamingJobTransformationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamingJobTransformationResource.ValidateResourceId(id); - return new StreamingJobTransformationResource(client, id); - } - ); + return GetMockableStreamAnalyticsArmClient(client).GetStreamingJobTransformationResource(id); } - #endregion - #region StreamAnalyticsClusterResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamAnalyticsClusterResource GetStreamAnalyticsClusterResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamAnalyticsClusterResource.ValidateResourceId(id); - return new StreamAnalyticsClusterResource(client, id); - } - ); + return GetMockableStreamAnalyticsArmClient(client).GetStreamAnalyticsClusterResource(id); } - #endregion - #region StreamAnalyticsPrivateEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StreamAnalyticsPrivateEndpointResource GetStreamAnalyticsPrivateEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StreamAnalyticsPrivateEndpointResource.ValidateResourceId(id); - return new StreamAnalyticsPrivateEndpointResource(client, id); - } - ); + return GetMockableStreamAnalyticsArmClient(client).GetStreamAnalyticsPrivateEndpointResource(id); } - #endregion - /// Gets a collection of StreamingJobResources in the ResourceGroupResource. + /// + /// Gets a collection of StreamingJobResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of StreamingJobResources and their operations over a StreamingJobResource. public static StreamingJobCollection GetStreamingJobs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStreamingJobs(); + return GetMockableStreamAnalyticsResourceGroupResource(resourceGroupResource).GetStreamingJobs(); } /// @@ -203,17 +173,21 @@ public static StreamingJobCollection GetStreamingJobs(this ResourceGroupResource /// StreamingJobs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the streaming job. /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetStreamingJobAsync(this ResourceGroupResource resourceGroupResource, string jobName, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetStreamingJobs().GetAsync(jobName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableStreamAnalyticsResourceGroupResource(resourceGroupResource).GetStreamingJobAsync(jobName, expand, cancellationToken).ConfigureAwait(false); } /// @@ -228,25 +202,35 @@ public static async Task> GetStreamingJobAsync(th /// StreamingJobs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the streaming job. /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetStreamingJob(this ResourceGroupResource resourceGroupResource, string jobName, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetStreamingJobs().Get(jobName, expand, cancellationToken); + return GetMockableStreamAnalyticsResourceGroupResource(resourceGroupResource).GetStreamingJob(jobName, expand, cancellationToken); } - /// Gets a collection of StreamAnalyticsClusterResources in the ResourceGroupResource. + /// + /// Gets a collection of StreamAnalyticsClusterResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of StreamAnalyticsClusterResources and their operations over a StreamAnalyticsClusterResource. public static StreamAnalyticsClusterCollection GetStreamAnalyticsClusters(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStreamAnalyticsClusters(); + return GetMockableStreamAnalyticsResourceGroupResource(resourceGroupResource).GetStreamAnalyticsClusters(); } /// @@ -261,16 +245,20 @@ public static StreamAnalyticsClusterCollection GetStreamAnalyticsClusters(this R /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetStreamAnalyticsClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetStreamAnalyticsClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); + return await GetMockableStreamAnalyticsResourceGroupResource(resourceGroupResource).GetStreamAnalyticsClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } /// @@ -285,16 +273,20 @@ public static async Task> GetStreamAnal /// Clusters_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetStreamAnalyticsCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetStreamAnalyticsClusters().Get(clusterName, cancellationToken); + return GetMockableStreamAnalyticsResourceGroupResource(resourceGroupResource).GetStreamAnalyticsCluster(clusterName, cancellationToken); } /// @@ -309,6 +301,10 @@ public static Response GetStreamAnalyticsCluster /// StreamingJobs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. @@ -316,7 +312,7 @@ public static Response GetStreamAnalyticsCluster /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetStreamingJobsAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStreamingJobsAsync(expand, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).GetStreamingJobsAsync(expand, cancellationToken); } /// @@ -331,6 +327,10 @@ public static AsyncPageable GetStreamingJobsAsync(this Sub /// StreamingJobs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. @@ -338,7 +338,7 @@ public static AsyncPageable GetStreamingJobsAsync(this Sub /// A collection of that may take multiple service requests to iterate over. public static Pageable GetStreamingJobs(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStreamingJobs(expand, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).GetStreamingJobs(expand, cancellationToken); } /// @@ -353,6 +353,10 @@ public static Pageable GetStreamingJobs(this SubscriptionR /// Subscriptions_ListQuotas /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. @@ -360,7 +364,7 @@ public static Pageable GetStreamingJobs(this SubscriptionR /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetQuotasSubscriptionsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetQuotasSubscriptionsAsync(location, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).GetQuotasSubscriptionsAsync(location, cancellationToken); } /// @@ -375,6 +379,10 @@ public static AsyncPageable GetQuotasSubscript /// Subscriptions_ListQuotas /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. @@ -382,7 +390,7 @@ public static AsyncPageable GetQuotasSubscript /// A collection of that may take multiple service requests to iterate over. public static Pageable GetQuotasSubscriptions(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetQuotasSubscriptions(location, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).GetQuotasSubscriptions(location, cancellationToken); } /// @@ -397,6 +405,10 @@ public static Pageable GetQuotasSubscriptions( /// Subscriptions_TestQuery /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -406,9 +418,7 @@ public static Pageable GetQuotasSubscriptions( /// is null. public static async Task> TestQuerySubscriptionAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestQuery testQuery, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(testQuery, nameof(testQuery)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).TestQuerySubscriptionAsync(waitUntil, location, testQuery, cancellationToken).ConfigureAwait(false); + return await GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).TestQuerySubscriptionAsync(waitUntil, location, testQuery, cancellationToken).ConfigureAwait(false); } /// @@ -423,6 +433,10 @@ public static async Task> TestQu /// Subscriptions_TestQuery /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -432,9 +446,7 @@ public static async Task> TestQu /// is null. public static ArmOperation TestQuerySubscription(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestQuery testQuery, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(testQuery, nameof(testQuery)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).TestQuerySubscription(waitUntil, location, testQuery, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).TestQuerySubscription(waitUntil, location, testQuery, cancellationToken); } /// @@ -449,6 +461,10 @@ public static ArmOperation TestQuerySubscript /// Subscriptions_CompileQuery /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. @@ -457,9 +473,7 @@ public static ArmOperation TestQuerySubscript /// is null. public static async Task> CompileQuerySubscriptionAsync(this SubscriptionResource subscriptionResource, AzureLocation location, StreamAnalyticsCompileQuery compileQuery, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(compileQuery, nameof(compileQuery)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CompileQuerySubscriptionAsync(location, compileQuery, cancellationToken).ConfigureAwait(false); + return await GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).CompileQuerySubscriptionAsync(location, compileQuery, cancellationToken).ConfigureAwait(false); } /// @@ -474,6 +488,10 @@ public static async Task> Compil /// Subscriptions_CompileQuery /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. @@ -482,9 +500,7 @@ public static async Task> Compil /// is null. public static Response CompileQuerySubscription(this SubscriptionResource subscriptionResource, AzureLocation location, StreamAnalyticsCompileQuery compileQuery, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(compileQuery, nameof(compileQuery)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CompileQuerySubscription(location, compileQuery, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).CompileQuerySubscription(location, compileQuery, cancellationToken); } /// @@ -499,6 +515,10 @@ public static Response CompileQuerySubscr /// Subscriptions_SampleInput /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -508,9 +528,7 @@ public static Response CompileQuerySubscr /// is null. public static async Task> SampleInputSubscriptionAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, StreamAnalyticsSampleInputContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).SampleInputSubscriptionAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).SampleInputSubscriptionAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); } /// @@ -525,6 +543,10 @@ public static async Task> SampleI /// Subscriptions_SampleInput /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -534,9 +556,7 @@ public static async Task> SampleI /// is null. public static ArmOperation SampleInputSubscription(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, StreamAnalyticsSampleInputContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).SampleInputSubscription(waitUntil, location, content, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).SampleInputSubscription(waitUntil, location, content, cancellationToken); } /// @@ -551,6 +571,10 @@ public static ArmOperation SampleInputSubscrip /// Subscriptions_TestInput /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -560,9 +584,7 @@ public static ArmOperation SampleInputSubscrip /// is null. public static async Task> TestInputSubscriptionAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).TestInputSubscriptionAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).TestInputSubscriptionAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); } /// @@ -577,6 +599,10 @@ public static async Task> Test /// Subscriptions_TestInput /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -586,9 +612,7 @@ public static async Task> Test /// is null. public static ArmOperation TestInputSubscription(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).TestInputSubscription(waitUntil, location, content, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).TestInputSubscription(waitUntil, location, content, cancellationToken); } /// @@ -603,6 +627,10 @@ public static ArmOperation TestInputSubscri /// Subscriptions_TestOutput /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -612,9 +640,7 @@ public static ArmOperation TestInputSubscri /// is null. public static async Task> TestOutputSubscriptionAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestOutput testOutput, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(testOutput, nameof(testOutput)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).TestOutputSubscriptionAsync(waitUntil, location, testOutput, cancellationToken).ConfigureAwait(false); + return await GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).TestOutputSubscriptionAsync(waitUntil, location, testOutput, cancellationToken).ConfigureAwait(false); } /// @@ -629,6 +655,10 @@ public static async Task> Test /// Subscriptions_TestOutput /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -638,9 +668,7 @@ public static async Task> Test /// is null. public static ArmOperation TestOutputSubscription(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestOutput testOutput, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(testOutput, nameof(testOutput)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).TestOutputSubscription(waitUntil, location, testOutput, cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).TestOutputSubscription(waitUntil, location, testOutput, cancellationToken); } /// @@ -655,13 +683,17 @@ public static ArmOperation TestOutputSubscr /// Clusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStreamAnalyticsClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStreamAnalyticsClustersAsync(cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).GetStreamAnalyticsClustersAsync(cancellationToken); } /// @@ -676,13 +708,17 @@ public static AsyncPageable GetStreamAnalyticsCl /// Clusters_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStreamAnalyticsClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStreamAnalyticsClusters(cancellationToken); + return GetMockableStreamAnalyticsSubscriptionResource(subscriptionResource).GetStreamAnalyticsClusters(cancellationToken); } } } diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 9518ddcb0555e..0000000000000 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,541 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.StreamAnalytics.Models; - -namespace Azure.ResourceManager.StreamAnalytics -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _streamingJobClientDiagnostics; - private StreamingJobsRestOperations _streamingJobRestClient; - private ClientDiagnostics _subscriptionsClientDiagnostics; - private SubscriptionsRestOperations _subscriptionsRestClient; - private ClientDiagnostics _streamAnalyticsClusterClustersClientDiagnostics; - private ClustersRestOperations _streamAnalyticsClusterClustersRestClient; - - /// 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 StreamingJobClientDiagnostics => _streamingJobClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StreamAnalytics", StreamingJobResource.ResourceType.Namespace, Diagnostics); - private StreamingJobsRestOperations StreamingJobRestClient => _streamingJobRestClient ??= new StreamingJobsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StreamingJobResource.ResourceType)); - private ClientDiagnostics SubscriptionsClientDiagnostics => _subscriptionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StreamAnalytics", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SubscriptionsRestOperations SubscriptionsRestClient => _subscriptionsRestClient ??= new SubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics StreamAnalyticsClusterClustersClientDiagnostics => _streamAnalyticsClusterClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StreamAnalytics", StreamAnalyticsClusterResource.ResourceType.Namespace, Diagnostics); - private ClustersRestOperations StreamAnalyticsClusterClustersRestClient => _streamAnalyticsClusterClustersRestClient ??= new ClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StreamAnalyticsClusterResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Lists all of the streaming jobs in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs - /// - /// - /// Operation Id - /// StreamingJobs_List - /// - /// - /// - /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStreamingJobsAsync(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StreamingJobRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StreamingJobRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StreamingJobResource(Client, StreamingJobData.DeserializeStreamingJobData(e)), StreamingJobClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStreamingJobs", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the streaming jobs in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs - /// - /// - /// Operation Id - /// StreamingJobs_List - /// - /// - /// - /// The $expand OData query parameter. This is a comma-separated list of additional streaming job properties to include in the response, beyond the default set returned when this parameter is absent. The default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and 'functions'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStreamingJobs(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StreamingJobRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StreamingJobRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StreamingJobResource(Client, StreamingJobData.DeserializeStreamingJobData(e)), StreamingJobClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStreamingJobs", "value", "nextLink", cancellationToken); - } - - /// - /// Retrieves the subscription's current quota information in a particular region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas - /// - /// - /// Operation Id - /// Subscriptions_ListQuotas - /// - /// - /// - /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetQuotasSubscriptionsAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SubscriptionsRestClient.CreateListQuotasRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, StreamAnalyticsSubscriptionQuota.DeserializeStreamAnalyticsSubscriptionQuota, SubscriptionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQuotasSubscriptions", "value", null, cancellationToken); - } - - /// - /// Retrieves the subscription's current quota information in a particular region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas - /// - /// - /// Operation Id - /// Subscriptions_ListQuotas - /// - /// - /// - /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetQuotasSubscriptions(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SubscriptionsRestClient.CreateListQuotasRequest(Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, StreamAnalyticsSubscriptionQuota.DeserializeStreamAnalyticsSubscriptionQuota, SubscriptionsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetQuotasSubscriptions", "value", null, cancellationToken); - } - - /// - /// Test the Stream Analytics query on a sample input. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testQuery - /// - /// - /// Operation Id - /// Subscriptions_TestQuery - /// - /// - /// - /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// The query testing object that defines the input, output, and transformation for the query testing. - /// The cancellation token to use. - public virtual async Task> TestQuerySubscriptionAsync(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestQuery testQuery, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.TestQuerySubscription"); - scope.Start(); - try - { - var response = await SubscriptionsRestClient.TestQueryAsync(Id.SubscriptionId, location, testQuery, cancellationToken).ConfigureAwait(false); - var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsQueryTestingResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestQueryRequest(Id.SubscriptionId, location, testQuery).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Test the Stream Analytics query on a sample input. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testQuery - /// - /// - /// Operation Id - /// Subscriptions_TestQuery - /// - /// - /// - /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// The query testing object that defines the input, output, and transformation for the query testing. - /// The cancellation token to use. - public virtual ArmOperation TestQuerySubscription(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestQuery testQuery, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.TestQuerySubscription"); - scope.Start(); - try - { - var response = SubscriptionsRestClient.TestQuery(Id.SubscriptionId, location, testQuery, cancellationToken); - var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsQueryTestingResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestQueryRequest(Id.SubscriptionId, location, testQuery).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Compile the Stream Analytics query. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/compileQuery - /// - /// - /// Operation Id - /// Subscriptions_CompileQuery - /// - /// - /// - /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// The query compilation object which defines the input, output, and transformation for the query compilation. - /// The cancellation token to use. - public virtual async Task> CompileQuerySubscriptionAsync(AzureLocation location, StreamAnalyticsCompileQuery compileQuery, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CompileQuerySubscription"); - scope.Start(); - try - { - var response = await SubscriptionsRestClient.CompileQueryAsync(Id.SubscriptionId, location, compileQuery, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Compile the Stream Analytics query. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/compileQuery - /// - /// - /// Operation Id - /// Subscriptions_CompileQuery - /// - /// - /// - /// The region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// The query compilation object which defines the input, output, and transformation for the query compilation. - /// The cancellation token to use. - public virtual Response CompileQuerySubscription(AzureLocation location, StreamAnalyticsCompileQuery compileQuery, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CompileQuerySubscription"); - scope.Start(); - try - { - var response = SubscriptionsRestClient.CompileQuery(Id.SubscriptionId, location, compileQuery, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Sample the Stream Analytics input data. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/sampleInput - /// - /// - /// Operation Id - /// Subscriptions_SampleInput - /// - /// - /// - /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// Defines the necessary parameters for sampling the Stream Analytics input data. - /// The cancellation token to use. - public virtual async Task> SampleInputSubscriptionAsync(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsSampleInputContent content, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SampleInputSubscription"); - scope.Start(); - try - { - var response = await SubscriptionsRestClient.SampleInputAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsSampleInputResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateSampleInputRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Sample the Stream Analytics input data. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/sampleInput - /// - /// - /// Operation Id - /// Subscriptions_SampleInput - /// - /// - /// - /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// Defines the necessary parameters for sampling the Stream Analytics input data. - /// The cancellation token to use. - public virtual ArmOperation SampleInputSubscription(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsSampleInputContent content, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SampleInputSubscription"); - scope.Start(); - try - { - var response = SubscriptionsRestClient.SampleInput(Id.SubscriptionId, location, content, cancellationToken); - var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsSampleInputResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateSampleInputRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Test the Stream Analytics input. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testInput - /// - /// - /// Operation Id - /// Subscriptions_TestInput - /// - /// - /// - /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// Defines the necessary parameters for testing the Stream Analytics input. - /// The cancellation token to use. - public virtual async Task> TestInputSubscriptionAsync(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestContent content, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.TestInputSubscription"); - scope.Start(); - try - { - var response = await SubscriptionsRestClient.TestInputAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsTestDatasourceResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestInputRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Test the Stream Analytics input. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testInput - /// - /// - /// Operation Id - /// Subscriptions_TestInput - /// - /// - /// - /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// Defines the necessary parameters for testing the Stream Analytics input. - /// The cancellation token to use. - public virtual ArmOperation TestInputSubscription(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestContent content, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.TestInputSubscription"); - scope.Start(); - try - { - var response = SubscriptionsRestClient.TestInput(Id.SubscriptionId, location, content, cancellationToken); - var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsTestDatasourceResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestInputRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Test the Stream Analytics output. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testOutput - /// - /// - /// Operation Id - /// Subscriptions_TestOutput - /// - /// - /// - /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// Defines the necessary parameters for testing the Stream Analytics output. - /// The cancellation token to use. - public virtual async Task> TestOutputSubscriptionAsync(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestOutput testOutput, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.TestOutputSubscription"); - scope.Start(); - try - { - var response = await SubscriptionsRestClient.TestOutputAsync(Id.SubscriptionId, location, testOutput, cancellationToken).ConfigureAwait(false); - var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsTestDatasourceResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestOutputRequest(Id.SubscriptionId, location, testOutput).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Test the Stream Analytics output. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testOutput - /// - /// - /// Operation Id - /// Subscriptions_TestOutput - /// - /// - /// - /// 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 region to which the request is sent. You can find out which regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/. - /// Defines the necessary parameters for testing the Stream Analytics output. - /// The cancellation token to use. - public virtual ArmOperation TestOutputSubscription(WaitUntil waitUntil, AzureLocation location, StreamAnalyticsTestOutput testOutput, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.TestOutputSubscription"); - scope.Start(); - try - { - var response = SubscriptionsRestClient.TestOutput(Id.SubscriptionId, location, testOutput, cancellationToken); - var operation = new StreamAnalyticsArmOperation(new StreamAnalyticsTestDatasourceResultOperationSource(), SubscriptionsClientDiagnostics, Pipeline, SubscriptionsRestClient.CreateTestOutputRequest(Id.SubscriptionId, location, testOutput).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all of the clusters in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters - /// - /// - /// Operation Id - /// Clusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStreamAnalyticsClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StreamAnalyticsClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StreamAnalyticsClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StreamAnalyticsClusterResource(Client, StreamAnalyticsClusterData.DeserializeStreamAnalyticsClusterData(e)), StreamAnalyticsClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStreamAnalyticsClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all of the clusters in the given subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters - /// - /// - /// Operation Id - /// Clusters_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStreamAnalyticsClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StreamAnalyticsClusterClustersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StreamAnalyticsClusterClustersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StreamAnalyticsClusterResource(Client, StreamAnalyticsClusterData.DeserializeStreamAnalyticsClusterData(e)), StreamAnalyticsClusterClustersClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStreamAnalyticsClusters", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterResource.cs index f437c5ec109f6..b4676f2ff0977 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.StreamAnalytics public partial class StreamAnalyticsClusterResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StreamAnalyticsPrivateEndpointResources and their operations over a StreamAnalyticsPrivateEndpointResource. public virtual StreamAnalyticsPrivateEndpointCollection GetStreamAnalyticsPrivateEndpoints() { - return GetCachedClient(Client => new StreamAnalyticsPrivateEndpointCollection(Client, Id)); + return GetCachedClient(client => new StreamAnalyticsPrivateEndpointCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual StreamAnalyticsPrivateEndpointCollection GetStreamAnalyticsPrivat /// /// The name of the private endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStreamAnalyticsPrivateEndpointAsync(string privateEndpointName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetS /// /// The name of the private endpoint. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStreamAnalyticsPrivateEndpoint(string privateEndpointName, CancellationToken cancellationToken = default) { diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsPrivateEndpointResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsPrivateEndpointResource.cs index 9ac1f97d6444b..bb81a97b85cad 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsPrivateEndpointResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsPrivateEndpointResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.StreamAnalytics public partial class StreamAnalyticsPrivateEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + /// The privateEndpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName, string privateEndpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}"; diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobFunctionResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobFunctionResource.cs index 80b20bc306096..bb1761b8811af 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobFunctionResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobFunctionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StreamAnalytics public partial class StreamingJobFunctionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jobName. + /// The functionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jobName, string functionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}"; diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobInputResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobInputResource.cs index f1b0919f6c093..9e867ed0ec645 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobInputResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobInputResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StreamAnalytics public partial class StreamingJobInputResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jobName. + /// The inputName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jobName, string inputName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}"; diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobOutputResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobOutputResource.cs index 09d0a6a136d13..9ceaef2d041ce 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobOutputResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobOutputResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.StreamAnalytics public partial class StreamingJobOutputResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jobName. + /// The outputName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jobName, string outputName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}"; diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobResource.cs index 50901678a975a..9823ee91fb869 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.StreamAnalytics public partial class StreamingJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StreamingJobFunctionResources and their operations over a StreamingJobFunctionResource. public virtual StreamingJobFunctionCollection GetStreamingJobFunctions() { - return GetCachedClient(Client => new StreamingJobFunctionCollection(Client, Id)); + return GetCachedClient(client => new StreamingJobFunctionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual StreamingJobFunctionCollection GetStreamingJobFunctions() /// /// The name of the function. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStreamingJobFunctionAsync(string functionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetStreamingJo /// /// The name of the function. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStreamingJobFunction(string functionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetStreamingJobFunction(st /// An object representing collection of StreamingJobInputResources and their operations over a StreamingJobInputResource. public virtual StreamingJobInputCollection GetStreamingJobInputs() { - return GetCachedClient(Client => new StreamingJobInputCollection(Client, Id)); + return GetCachedClient(client => new StreamingJobInputCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual StreamingJobInputCollection GetStreamingJobInputs() /// /// The name of the input. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStreamingJobInputAsync(string inputName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetStreamingJobIn /// /// The name of the input. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStreamingJobInput(string inputName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetStreamingJobInput(string i /// An object representing collection of StreamingJobOutputResources and their operations over a StreamingJobOutputResource. public virtual StreamingJobOutputCollection GetStreamingJobOutputs() { - return GetCachedClient(Client => new StreamingJobOutputCollection(Client, Id)); + return GetCachedClient(client => new StreamingJobOutputCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual StreamingJobOutputCollection GetStreamingJobOutputs() /// /// The name of the output. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStreamingJobOutputAsync(string outputName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> GetStreamingJobO /// /// The name of the output. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStreamingJobOutput(string outputName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetStreamingJobOutput(string /// An object representing collection of StreamingJobTransformationResources and their operations over a StreamingJobTransformationResource. public virtual StreamingJobTransformationCollection GetStreamingJobTransformations() { - return GetCachedClient(Client => new StreamingJobTransformationCollection(Client, Id)); + return GetCachedClient(client => new StreamingJobTransformationCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual StreamingJobTransformationCollection GetStreamingJobTransformatio /// /// The name of the transformation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStreamingJobTransformationAsync(string transformationName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetStrea /// /// The name of the transformation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStreamingJobTransformation(string transformationName, CancellationToken cancellationToken = default) { diff --git a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobTransformationResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobTransformationResource.cs index 0452e034301ee..540e75256d773 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobTransformationResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobTransformationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.StreamAnalytics public partial class StreamingJobTransformationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The jobName. + /// The transformationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string jobName, string transformationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}"; diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/api/Azure.ResourceManager.Subscription.netstandard2.0.cs b/sdk/subscription/Azure.ResourceManager.Subscription/api/Azure.ResourceManager.Subscription.netstandard2.0.cs index 678fb0d5ca06a..8127df3274d4e 100644 --- a/sdk/subscription/Azure.ResourceManager.Subscription/api/Azure.ResourceManager.Subscription.netstandard2.0.cs +++ b/sdk/subscription/Azure.ResourceManager.Subscription/api/Azure.ResourceManager.Subscription.netstandard2.0.cs @@ -102,6 +102,41 @@ protected TenantPolicyResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Subscription.Mocking +{ + public partial class MockableSubscriptionArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSubscriptionArmClient() { } + public virtual Azure.ResourceManager.Subscription.BillingAccountPolicyResource GetBillingAccountPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Subscription.SubscriptionAliasResource GetSubscriptionAliasResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Subscription.TenantPolicyResource GetTenantPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSubscriptionSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSubscriptionSubscriptionResource() { } + public virtual Azure.Response CancelSubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CancelSubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response EnableSubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> EnableSubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RenameSubscription(Azure.ResourceManager.Subscription.Models.SubscriptionName body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RenameSubscriptionAsync(Azure.ResourceManager.Subscription.Models.SubscriptionName body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableSubscriptionTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableSubscriptionTenantResource() { } + public virtual Azure.ResourceManager.ArmOperation AcceptSubscriptionOwnership(Azure.WaitUntil waitUntil, string subscriptionId, Azure.ResourceManager.Subscription.Models.AcceptOwnershipContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AcceptSubscriptionOwnershipAsync(Azure.WaitUntil waitUntil, string subscriptionId, Azure.ResourceManager.Subscription.Models.AcceptOwnershipContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAcceptOwnershipStatus(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAcceptOwnershipStatusAsync(string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Subscription.BillingAccountPolicyCollection GetBillingAccountPolicies() { throw null; } + public virtual Azure.Response GetBillingAccountPolicy(string billingAccountId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetBillingAccountPolicyAsync(string billingAccountId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSubscriptionAlias(string aliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionAliasAsync(string aliasName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Subscription.SubscriptionAliasCollection GetSubscriptionAliases() { throw null; } + public virtual Azure.ResourceManager.Subscription.TenantPolicyResource GetTenantPolicy() { throw null; } + } +} namespace Azure.ResourceManager.Subscription.Models { public partial class AcceptOwnershipContent diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/BillingAccountPolicyResource.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/BillingAccountPolicyResource.cs index 80ba5cb6e17eb..8bb1e608b410b 100644 --- a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/BillingAccountPolicyResource.cs +++ b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/BillingAccountPolicyResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.Subscription public partial class BillingAccountPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The billingAccountId. public static ResourceIdentifier CreateResourceIdentifier(string billingAccountId) { var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default"; diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionArmClient.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionArmClient.cs new file mode 100644 index 0000000000000..5176ea2bdf087 --- /dev/null +++ b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionArmClient.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Subscription; + +namespace Azure.ResourceManager.Subscription.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSubscriptionArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSubscriptionArmClient() + { + } + + /// 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 MockableSubscriptionArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSubscriptionArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionAliasResource GetSubscriptionAliasResource(ResourceIdentifier id) + { + SubscriptionAliasResource.ValidateResourceId(id); + return new SubscriptionAliasResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantPolicyResource GetTenantPolicyResource(ResourceIdentifier id) + { + TenantPolicyResource.ValidateResourceId(id); + return new TenantPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BillingAccountPolicyResource GetBillingAccountPolicyResource(ResourceIdentifier id) + { + BillingAccountPolicyResource.ValidateResourceId(id); + return new BillingAccountPolicyResource(Client, id); + } + } +} diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionSubscriptionResource.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionSubscriptionResource.cs new file mode 100644 index 0000000000000..5e7599280e6a5 --- /dev/null +++ b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionSubscriptionResource.cs @@ -0,0 +1,235 @@ +// 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; +using Azure.ResourceManager.Subscription; +using Azure.ResourceManager.Subscription.Models; + +namespace Azure.ResourceManager.Subscription.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSubscriptionSubscriptionResource : ArmResource + { + private ClientDiagnostics _subscriptionClientDiagnostics; + private SubscriptionRestOperations _subscriptionRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSubscriptionSubscriptionResource() + { + } + + /// 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 MockableSubscriptionSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SubscriptionClientDiagnostics => _subscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Subscription", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SubscriptionRestOperations SubscriptionRestClient => _subscriptionRestClient ??= new SubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// The operation to cancel a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel + /// + /// + /// Operation Id + /// Subscription_Cancel + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> CancelSubscriptionAsync(CancellationToken cancellationToken = default) + { + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionSubscriptionResource.CancelSubscription"); + scope.Start(); + try + { + var response = await SubscriptionRestClient.CancelAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to cancel a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel + /// + /// + /// Operation Id + /// Subscription_Cancel + /// + /// + /// + /// The cancellation token to use. + public virtual Response CancelSubscription(CancellationToken cancellationToken = default) + { + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionSubscriptionResource.CancelSubscription"); + scope.Start(); + try + { + var response = SubscriptionRestClient.Cancel(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to rename a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename + /// + /// + /// Operation Id + /// Subscription_Rename + /// + /// + /// + /// Subscription Name. + /// The cancellation token to use. + /// is null. + public virtual async Task> RenameSubscriptionAsync(SubscriptionName body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionSubscriptionResource.RenameSubscription"); + scope.Start(); + try + { + var response = await SubscriptionRestClient.RenameAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to rename a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename + /// + /// + /// Operation Id + /// Subscription_Rename + /// + /// + /// + /// Subscription Name. + /// The cancellation token to use. + /// is null. + public virtual Response RenameSubscription(SubscriptionName body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionSubscriptionResource.RenameSubscription"); + scope.Start(); + try + { + var response = SubscriptionRestClient.Rename(Id.SubscriptionId, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to enable a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable + /// + /// + /// Operation Id + /// Subscription_Enable + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> EnableSubscriptionAsync(CancellationToken cancellationToken = default) + { + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionSubscriptionResource.EnableSubscription"); + scope.Start(); + try + { + var response = await SubscriptionRestClient.EnableAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to enable a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable + /// + /// + /// Operation Id + /// Subscription_Enable + /// + /// + /// + /// The cancellation token to use. + public virtual Response EnableSubscription(CancellationToken cancellationToken = default) + { + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionSubscriptionResource.EnableSubscription"); + scope.Start(); + try + { + var response = SubscriptionRestClient.Enable(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionTenantResource.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionTenantResource.cs new file mode 100644 index 0000000000000..a0b5c59273886 --- /dev/null +++ b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/MockableSubscriptionTenantResource.cs @@ -0,0 +1,312 @@ +// 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; +using Azure.ResourceManager.Subscription; +using Azure.ResourceManager.Subscription.Models; + +namespace Azure.ResourceManager.Subscription.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableSubscriptionTenantResource : ArmResource + { + private ClientDiagnostics _subscriptionClientDiagnostics; + private SubscriptionRestOperations _subscriptionRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSubscriptionTenantResource() + { + } + + /// 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 MockableSubscriptionTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SubscriptionClientDiagnostics => _subscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Subscription", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SubscriptionRestOperations SubscriptionRestClient => _subscriptionRestClient ??= new SubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SubscriptionAliasResources in the TenantResource. + /// An object representing collection of SubscriptionAliasResources and their operations over a SubscriptionAliasResource. + public virtual SubscriptionAliasCollection GetSubscriptionAliases() + { + return GetCachedClient(client => new SubscriptionAliasCollection(client, Id)); + } + + /// + /// Get Alias Subscription. + /// + /// + /// Request Path + /// /providers/Microsoft.Subscription/aliases/{aliasName} + /// + /// + /// Operation Id + /// Alias_Get + /// + /// + /// + /// AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionAliasAsync(string aliasName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionAliases().GetAsync(aliasName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Alias Subscription. + /// + /// + /// Request Path + /// /providers/Microsoft.Subscription/aliases/{aliasName} + /// + /// + /// Operation Id + /// Alias_Get + /// + /// + /// + /// AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionAlias(string aliasName, CancellationToken cancellationToken = default) + { + return GetSubscriptionAliases().Get(aliasName, cancellationToken); + } + + /// Gets an object representing a TenantPolicyResource along with the instance operations that can be performed on it in the TenantResource. + /// Returns a object. + public virtual TenantPolicyResource GetTenantPolicy() + { + return new TenantPolicyResource(Client, Id.AppendProviderResource("Microsoft.Subscription", "policies", "default")); + } + + /// Gets a collection of BillingAccountPolicyResources in the TenantResource. + /// An object representing collection of BillingAccountPolicyResources and their operations over a BillingAccountPolicyResource. + public virtual BillingAccountPolicyCollection GetBillingAccountPolicies() + { + return GetCachedClient(client => new BillingAccountPolicyCollection(client, Id)); + } + + /// + /// Get Billing Account Policy. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default + /// + /// + /// Operation Id + /// BillingAccount_GetPolicy + /// + /// + /// + /// Billing Account Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBillingAccountPolicyAsync(string billingAccountId, CancellationToken cancellationToken = default) + { + return await GetBillingAccountPolicies().GetAsync(billingAccountId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Billing Account Policy. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default + /// + /// + /// Operation Id + /// BillingAccount_GetPolicy + /// + /// + /// + /// Billing Account Id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBillingAccountPolicy(string billingAccountId, CancellationToken cancellationToken = default) + { + return GetBillingAccountPolicies().Get(billingAccountId, cancellationToken); + } + + /// + /// Accept subscription ownership. + /// + /// + /// Request Path + /// /providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership + /// + /// + /// Operation Id + /// Subscription_AcceptOwnership + /// + /// + /// + /// 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. + /// Subscription Id. + /// The AcceptOwnershipContent to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task AcceptSubscriptionOwnershipAsync(WaitUntil waitUntil, string subscriptionId, AcceptOwnershipContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionTenantResource.AcceptSubscriptionOwnership"); + scope.Start(); + try + { + var response = await SubscriptionRestClient.AcceptOwnershipAsync(subscriptionId, content, cancellationToken).ConfigureAwait(false); + var operation = new SubscriptionArmOperation(SubscriptionClientDiagnostics, Pipeline, SubscriptionRestClient.CreateAcceptOwnershipRequest(subscriptionId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Accept subscription ownership. + /// + /// + /// Request Path + /// /providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership + /// + /// + /// Operation Id + /// Subscription_AcceptOwnership + /// + /// + /// + /// 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. + /// Subscription Id. + /// The AcceptOwnershipContent to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation AcceptSubscriptionOwnership(WaitUntil waitUntil, string subscriptionId, AcceptOwnershipContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionTenantResource.AcceptSubscriptionOwnership"); + scope.Start(); + try + { + var response = SubscriptionRestClient.AcceptOwnership(subscriptionId, content, cancellationToken); + var operation = new SubscriptionArmOperation(SubscriptionClientDiagnostics, Pipeline, SubscriptionRestClient.CreateAcceptOwnershipRequest(subscriptionId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Accept subscription ownership status. + /// + /// + /// Request Path + /// /providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus + /// + /// + /// Operation Id + /// Subscription_AcceptOwnershipStatus + /// + /// + /// + /// Subscription Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAcceptOwnershipStatusAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionTenantResource.GetAcceptOwnershipStatus"); + scope.Start(); + try + { + var response = await SubscriptionRestClient.AcceptOwnershipStatusAsync(subscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Accept subscription ownership status. + /// + /// + /// Request Path + /// /providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus + /// + /// + /// Operation Id + /// Subscription_AcceptOwnershipStatus + /// + /// + /// + /// Subscription Id. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetAcceptOwnershipStatus(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var scope = SubscriptionClientDiagnostics.CreateScope("MockableSubscriptionTenantResource.GetAcceptOwnershipStatus"); + scope.Start(); + try + { + var response = SubscriptionRestClient.AcceptOwnershipStatus(subscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/SubscriptionExtensions.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/SubscriptionExtensions.cs index edb892b6dba8a..6e4d0e0164d10 100644 --- a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/SubscriptionExtensions.cs +++ b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/SubscriptionExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Subscription.Mocking; using Azure.ResourceManager.Subscription.Models; namespace Azure.ResourceManager.Subscription @@ -19,93 +20,68 @@ namespace Azure.ResourceManager.Subscription /// A class to add extension methods to Azure.ResourceManager.Subscription. public static partial class SubscriptionExtensions { - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSubscriptionArmClient GetMockableSubscriptionArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSubscriptionArmClient(client0)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSubscriptionSubscriptionResource GetMockableSubscriptionSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSubscriptionSubscriptionResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableSubscriptionTenantResource GetMockableSubscriptionTenantResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSubscriptionTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region SubscriptionAliasResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubscriptionAliasResource GetSubscriptionAliasResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionAliasResource.ValidateResourceId(id); - return new SubscriptionAliasResource(client, id); - } - ); + return GetMockableSubscriptionArmClient(client).GetSubscriptionAliasResource(id); } - #endregion - #region TenantPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TenantPolicyResource GetTenantPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TenantPolicyResource.ValidateResourceId(id); - return new TenantPolicyResource(client, id); - } - ); + return GetMockableSubscriptionArmClient(client).GetTenantPolicyResource(id); } - #endregion - #region BillingAccountPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static BillingAccountPolicyResource GetBillingAccountPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - BillingAccountPolicyResource.ValidateResourceId(id); - return new BillingAccountPolicyResource(client, id); - } - ); + return GetMockableSubscriptionArmClient(client).GetBillingAccountPolicyResource(id); } - #endregion /// /// The operation to cancel a subscription @@ -119,12 +95,16 @@ public static BillingAccountPolicyResource GetBillingAccountPolicyResource(this /// Subscription_Cancel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> CancelSubscriptionAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CancelSubscriptionAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableSubscriptionSubscriptionResource(subscriptionResource).CancelSubscriptionAsync(cancellationToken).ConfigureAwait(false); } /// @@ -139,12 +119,16 @@ public static async Task> CancelSubscriptionAsy /// Subscription_Cancel /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response CancelSubscription(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).CancelSubscription(cancellationToken); + return GetMockableSubscriptionSubscriptionResource(subscriptionResource).CancelSubscription(cancellationToken); } /// @@ -159,6 +143,10 @@ public static Response CancelSubscription(this Subscript /// Subscription_Rename /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Subscription Name. @@ -166,9 +154,7 @@ public static Response CancelSubscription(this Subscript /// is null. public static async Task> RenameSubscriptionAsync(this SubscriptionResource subscriptionResource, SubscriptionName body, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(body, nameof(body)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).RenameSubscriptionAsync(body, cancellationToken).ConfigureAwait(false); + return await GetMockableSubscriptionSubscriptionResource(subscriptionResource).RenameSubscriptionAsync(body, cancellationToken).ConfigureAwait(false); } /// @@ -183,6 +169,10 @@ public static async Task> RenameSubscriptionAsyn /// Subscription_Rename /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Subscription Name. @@ -190,9 +180,7 @@ public static async Task> RenameSubscriptionAsyn /// is null. public static Response RenameSubscription(this SubscriptionResource subscriptionResource, SubscriptionName body, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(body, nameof(body)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).RenameSubscription(body, cancellationToken); + return GetMockableSubscriptionSubscriptionResource(subscriptionResource).RenameSubscription(body, cancellationToken); } /// @@ -207,12 +195,16 @@ public static Response RenameSubscription(this Subscripti /// Subscription_Enable /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> EnableSubscriptionAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).EnableSubscriptionAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableSubscriptionSubscriptionResource(subscriptionResource).EnableSubscriptionAsync(cancellationToken).ConfigureAwait(false); } /// @@ -227,20 +219,30 @@ public static async Task> EnableSubscriptionAsyn /// Subscription_Enable /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response EnableSubscription(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).EnableSubscription(cancellationToken); + return GetMockableSubscriptionSubscriptionResource(subscriptionResource).EnableSubscription(cancellationToken); } - /// Gets a collection of SubscriptionAliasResources in the TenantResource. + /// + /// Gets a collection of SubscriptionAliasResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SubscriptionAliasResources and their operations over a SubscriptionAliasResource. public static SubscriptionAliasCollection GetSubscriptionAliases(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetSubscriptionAliases(); + return GetMockableSubscriptionTenantResource(tenantResource).GetSubscriptionAliases(); } /// @@ -255,16 +257,20 @@ public static SubscriptionAliasCollection GetSubscriptionAliases(this TenantReso /// Alias_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionAliasAsync(this TenantResource tenantResource, string aliasName, CancellationToken cancellationToken = default) { - return await tenantResource.GetSubscriptionAliases().GetAsync(aliasName, cancellationToken).ConfigureAwait(false); + return await GetMockableSubscriptionTenantResource(tenantResource).GetSubscriptionAliasAsync(aliasName, cancellationToken).ConfigureAwait(false); } /// @@ -279,32 +285,48 @@ public static async Task> GetSubscriptionAli /// Alias_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// AliasName is the name for the subscription creation request. Note that this is not the same as subscription name and this doesn’t have any other lifecycle need beyond the request for subscription creation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionAlias(this TenantResource tenantResource, string aliasName, CancellationToken cancellationToken = default) { - return tenantResource.GetSubscriptionAliases().Get(aliasName, cancellationToken); + return GetMockableSubscriptionTenantResource(tenantResource).GetSubscriptionAlias(aliasName, cancellationToken); } - /// Gets an object representing a TenantPolicyResource along with the instance operations that can be performed on it in the TenantResource. + /// + /// Gets an object representing a TenantPolicyResource along with the instance operations that can be performed on it in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Returns a object. public static TenantPolicyResource GetTenantPolicy(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetTenantPolicy(); + return GetMockableSubscriptionTenantResource(tenantResource).GetTenantPolicy(); } - /// Gets a collection of BillingAccountPolicyResources in the TenantResource. + /// + /// Gets a collection of BillingAccountPolicyResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of BillingAccountPolicyResources and their operations over a BillingAccountPolicyResource. public static BillingAccountPolicyCollection GetBillingAccountPolicies(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetBillingAccountPolicies(); + return GetMockableSubscriptionTenantResource(tenantResource).GetBillingAccountPolicies(); } /// @@ -319,16 +341,20 @@ public static BillingAccountPolicyCollection GetBillingAccountPolicies(this Tena /// BillingAccount_GetPolicy /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Billing Account Id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetBillingAccountPolicyAsync(this TenantResource tenantResource, string billingAccountId, CancellationToken cancellationToken = default) { - return await tenantResource.GetBillingAccountPolicies().GetAsync(billingAccountId, cancellationToken).ConfigureAwait(false); + return await GetMockableSubscriptionTenantResource(tenantResource).GetBillingAccountPolicyAsync(billingAccountId, cancellationToken).ConfigureAwait(false); } /// @@ -343,16 +369,20 @@ public static async Task> GetBillingAccou /// BillingAccount_GetPolicy /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Billing Account Id. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetBillingAccountPolicy(this TenantResource tenantResource, string billingAccountId, CancellationToken cancellationToken = default) { - return tenantResource.GetBillingAccountPolicies().Get(billingAccountId, cancellationToken); + return GetMockableSubscriptionTenantResource(tenantResource).GetBillingAccountPolicy(billingAccountId, cancellationToken); } /// @@ -367,6 +397,10 @@ public static Response GetBillingAccountPolicy(thi /// Subscription_AcceptOwnership /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -377,10 +411,7 @@ public static Response GetBillingAccountPolicy(thi /// or is null. public static async Task AcceptSubscriptionOwnershipAsync(this TenantResource tenantResource, WaitUntil waitUntil, string subscriptionId, AcceptOwnershipContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).AcceptSubscriptionOwnershipAsync(waitUntil, subscriptionId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableSubscriptionTenantResource(tenantResource).AcceptSubscriptionOwnershipAsync(waitUntil, subscriptionId, content, cancellationToken).ConfigureAwait(false); } /// @@ -395,6 +426,10 @@ public static async Task AcceptSubscriptionOwnershipAsync(this Ten /// Subscription_AcceptOwnership /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// 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. @@ -405,10 +440,7 @@ public static async Task AcceptSubscriptionOwnershipAsync(this Ten /// or is null. public static ArmOperation AcceptSubscriptionOwnership(this TenantResource tenantResource, WaitUntil waitUntil, string subscriptionId, AcceptOwnershipContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).AcceptSubscriptionOwnership(waitUntil, subscriptionId, content, cancellationToken); + return GetMockableSubscriptionTenantResource(tenantResource).AcceptSubscriptionOwnership(waitUntil, subscriptionId, content, cancellationToken); } /// @@ -423,6 +455,10 @@ public static ArmOperation AcceptSubscriptionOwnership(this TenantResource tenan /// Subscription_AcceptOwnershipStatus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Subscription Id. @@ -431,9 +467,7 @@ public static ArmOperation AcceptSubscriptionOwnership(this TenantResource tenan /// is null. public static async Task> GetAcceptOwnershipStatusAsync(this TenantResource tenantResource, string subscriptionId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - return await GetTenantResourceExtensionClient(tenantResource).GetAcceptOwnershipStatusAsync(subscriptionId, cancellationToken).ConfigureAwait(false); + return await GetMockableSubscriptionTenantResource(tenantResource).GetAcceptOwnershipStatusAsync(subscriptionId, cancellationToken).ConfigureAwait(false); } /// @@ -448,6 +482,10 @@ public static async Task> GetAcceptOwnershipStat /// Subscription_AcceptOwnershipStatus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Subscription Id. @@ -456,9 +494,7 @@ public static async Task> GetAcceptOwnershipStat /// is null. public static Response GetAcceptOwnershipStatus(this TenantResource tenantResource, string subscriptionId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - return GetTenantResourceExtensionClient(tenantResource).GetAcceptOwnershipStatus(subscriptionId, cancellationToken); + return GetMockableSubscriptionTenantResource(tenantResource).GetAcceptOwnershipStatus(subscriptionId, cancellationToken); } } } diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 379101de07723..0000000000000 --- a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,228 +0,0 @@ -// 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; -using Azure.ResourceManager.Subscription.Models; - -namespace Azure.ResourceManager.Subscription -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _subscriptionClientDiagnostics; - private SubscriptionRestOperations _subscriptionRestClient; - - /// 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 SubscriptionClientDiagnostics => _subscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Subscription", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SubscriptionRestOperations SubscriptionRestClient => _subscriptionRestClient ??= new SubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// The operation to cancel a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel - /// - /// - /// Operation Id - /// Subscription_Cancel - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> CancelSubscriptionAsync(CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CancelSubscription"); - scope.Start(); - try - { - var response = await SubscriptionRestClient.CancelAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// The operation to cancel a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel - /// - /// - /// Operation Id - /// Subscription_Cancel - /// - /// - /// - /// The cancellation token to use. - public virtual Response CancelSubscription(CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CancelSubscription"); - scope.Start(); - try - { - var response = SubscriptionRestClient.Cancel(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// The operation to rename a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename - /// - /// - /// Operation Id - /// Subscription_Rename - /// - /// - /// - /// Subscription Name. - /// The cancellation token to use. - public virtual async Task> RenameSubscriptionAsync(SubscriptionName body, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.RenameSubscription"); - scope.Start(); - try - { - var response = await SubscriptionRestClient.RenameAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// The operation to rename a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename - /// - /// - /// Operation Id - /// Subscription_Rename - /// - /// - /// - /// Subscription Name. - /// The cancellation token to use. - public virtual Response RenameSubscription(SubscriptionName body, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.RenameSubscription"); - scope.Start(); - try - { - var response = SubscriptionRestClient.Rename(Id.SubscriptionId, body, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// The operation to enable a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable - /// - /// - /// Operation Id - /// Subscription_Enable - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> EnableSubscriptionAsync(CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.EnableSubscription"); - scope.Start(); - try - { - var response = await SubscriptionRestClient.EnableAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// The operation to enable a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable - /// - /// - /// Operation Id - /// Subscription_Enable - /// - /// - /// - /// The cancellation token to use. - public virtual Response EnableSubscription(CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.EnableSubscription"); - scope.Start(); - try - { - var response = SubscriptionRestClient.Enable(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 7bc08b2df6392..0000000000000 --- a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,201 +0,0 @@ -// 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; -using Azure.ResourceManager.Subscription.Models; - -namespace Azure.ResourceManager.Subscription -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _subscriptionClientDiagnostics; - private SubscriptionRestOperations _subscriptionRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics SubscriptionClientDiagnostics => _subscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Subscription", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SubscriptionRestOperations SubscriptionRestClient => _subscriptionRestClient ??= new SubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of SubscriptionAliasResources in the TenantResource. - /// An object representing collection of SubscriptionAliasResources and their operations over a SubscriptionAliasResource. - public virtual SubscriptionAliasCollection GetSubscriptionAliases() - { - return GetCachedClient(Client => new SubscriptionAliasCollection(Client, Id)); - } - - /// Gets an object representing a TenantPolicyResource along with the instance operations that can be performed on it in the TenantResource. - /// Returns a object. - public virtual TenantPolicyResource GetTenantPolicy() - { - return new TenantPolicyResource(Client, Id.AppendProviderResource("Microsoft.Subscription", "policies", "default")); - } - - /// Gets a collection of BillingAccountPolicyResources in the TenantResource. - /// An object representing collection of BillingAccountPolicyResources and their operations over a BillingAccountPolicyResource. - public virtual BillingAccountPolicyCollection GetBillingAccountPolicies() - { - return GetCachedClient(Client => new BillingAccountPolicyCollection(Client, Id)); - } - - /// - /// Accept subscription ownership. - /// - /// - /// Request Path - /// /providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership - /// - /// - /// Operation Id - /// Subscription_AcceptOwnership - /// - /// - /// - /// 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. - /// Subscription Id. - /// The AcceptOwnershipContent to use. - /// The cancellation token to use. - public virtual async Task AcceptSubscriptionOwnershipAsync(WaitUntil waitUntil, string subscriptionId, AcceptOwnershipContent content, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("TenantResourceExtensionClient.AcceptSubscriptionOwnership"); - scope.Start(); - try - { - var response = await SubscriptionRestClient.AcceptOwnershipAsync(subscriptionId, content, cancellationToken).ConfigureAwait(false); - var operation = new SubscriptionArmOperation(SubscriptionClientDiagnostics, Pipeline, SubscriptionRestClient.CreateAcceptOwnershipRequest(subscriptionId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Accept subscription ownership. - /// - /// - /// Request Path - /// /providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership - /// - /// - /// Operation Id - /// Subscription_AcceptOwnership - /// - /// - /// - /// 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. - /// Subscription Id. - /// The AcceptOwnershipContent to use. - /// The cancellation token to use. - public virtual ArmOperation AcceptSubscriptionOwnership(WaitUntil waitUntil, string subscriptionId, AcceptOwnershipContent content, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("TenantResourceExtensionClient.AcceptSubscriptionOwnership"); - scope.Start(); - try - { - var response = SubscriptionRestClient.AcceptOwnership(subscriptionId, content, cancellationToken); - var operation = new SubscriptionArmOperation(SubscriptionClientDiagnostics, Pipeline, SubscriptionRestClient.CreateAcceptOwnershipRequest(subscriptionId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Accept subscription ownership status. - /// - /// - /// Request Path - /// /providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus - /// - /// - /// Operation Id - /// Subscription_AcceptOwnershipStatus - /// - /// - /// - /// Subscription Id. - /// The cancellation token to use. - public virtual async Task> GetAcceptOwnershipStatusAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetAcceptOwnershipStatus"); - scope.Start(); - try - { - var response = await SubscriptionRestClient.AcceptOwnershipStatusAsync(subscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Accept subscription ownership status. - /// - /// - /// Request Path - /// /providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus - /// - /// - /// Operation Id - /// Subscription_AcceptOwnershipStatus - /// - /// - /// - /// Subscription Id. - /// The cancellation token to use. - public virtual Response GetAcceptOwnershipStatus(string subscriptionId, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionClientDiagnostics.CreateScope("TenantResourceExtensionClient.GetAcceptOwnershipStatus"); - scope.Start(); - try - { - var response = SubscriptionRestClient.AcceptOwnershipStatus(subscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/SubscriptionAliasResource.cs b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/SubscriptionAliasResource.cs index d32916643c8e1..2f615936a218f 100644 --- a/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/SubscriptionAliasResource.cs +++ b/sdk/subscription/Azure.ResourceManager.Subscription/src/Generated/SubscriptionAliasResource.cs @@ -27,6 +27,7 @@ namespace Azure.ResourceManager.Subscription public partial class SubscriptionAliasResource : ArmResource { /// Generate the resource identifier of a instance. + /// The aliasName. public static ResourceIdentifier CreateResourceIdentifier(string aliasName) { var resourceId = $"/providers/Microsoft.Subscription/aliases/{aliasName}"; diff --git a/sdk/support/Azure.ResourceManager.Support/api/Azure.ResourceManager.Support.netstandard2.0.cs b/sdk/support/Azure.ResourceManager.Support/api/Azure.ResourceManager.Support.netstandard2.0.cs index fb08ffedba644..7501bc63a58a5 100644 --- a/sdk/support/Azure.ResourceManager.Support/api/Azure.ResourceManager.Support.netstandard2.0.cs +++ b/sdk/support/Azure.ResourceManager.Support/api/Azure.ResourceManager.Support.netstandard2.0.cs @@ -458,6 +458,52 @@ protected TenantSupportTicketResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Support.Models.UpdateSupportTicket updateSupportTicket, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Support.Mocking +{ + public partial class MockableSupportArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSupportArmClient() { } + public virtual Azure.ResourceManager.Support.ProblemClassificationResource GetProblemClassificationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SubscriptionFileWorkspaceResource GetSubscriptionFileWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SubscriptionSupportTicketResource GetSubscriptionSupportTicketResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SupportAzureServiceResource GetSupportAzureServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SupportTicketChatTranscriptResource GetSupportTicketChatTranscriptResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SupportTicketCommunicationResource GetSupportTicketCommunicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SupportTicketFileResource GetSupportTicketFileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SupportTicketNoSubChatTranscriptResource GetSupportTicketNoSubChatTranscriptResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SupportTicketNoSubCommunicationResource GetSupportTicketNoSubCommunicationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.SupportTicketNoSubFileResource GetSupportTicketNoSubFileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.TenantFileWorkspaceResource GetTenantFileWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Support.TenantSupportTicketResource GetTenantSupportTicketResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSupportSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSupportSubscriptionResource() { } + public virtual Azure.Response CheckSupportTicketNameAvailability(Azure.ResourceManager.Support.Models.SupportNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckSupportTicketNameAvailabilityAsync(Azure.ResourceManager.Support.Models.SupportNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSubscriptionFileWorkspace(string fileWorkspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionFileWorkspaceAsync(string fileWorkspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Support.SubscriptionFileWorkspaceCollection GetSubscriptionFileWorkspaces() { throw null; } + public virtual Azure.Response GetSubscriptionSupportTicket(string supportTicketName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionSupportTicketAsync(string supportTicketName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Support.SubscriptionSupportTicketCollection GetSubscriptionSupportTickets() { throw null; } + } + public partial class MockableSupportTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableSupportTenantResource() { } + public virtual Azure.Response CheckNameAvailabilitySupportTicketsNoSubscription(Azure.ResourceManager.Support.Models.SupportNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilitySupportTicketsNoSubscriptionAsync(Azure.ResourceManager.Support.Models.SupportNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSupportAzureService(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSupportAzureServiceAsync(string serviceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Support.SupportAzureServiceCollection GetSupportAzureServices() { throw null; } + public virtual Azure.Response GetTenantFileWorkspace(string fileWorkspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTenantFileWorkspaceAsync(string fileWorkspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Support.TenantFileWorkspaceCollection GetTenantFileWorkspaces() { throw null; } + public virtual Azure.Response GetTenantSupportTicket(string supportTicketName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTenantSupportTicketAsync(string supportTicketName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Support.TenantSupportTicketCollection GetTenantSupportTickets() { throw null; } + } +} namespace Azure.ResourceManager.Support.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportArmClient.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportArmClient.cs new file mode 100644 index 0000000000000..85cdc556b565b --- /dev/null +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportArmClient.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Support; + +namespace Azure.ResourceManager.Support.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSupportArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSupportArmClient() + { + } + + /// 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 MockableSupportArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSupportArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SupportAzureServiceResource GetSupportAzureServiceResource(ResourceIdentifier id) + { + SupportAzureServiceResource.ValidateResourceId(id); + return new SupportAzureServiceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ProblemClassificationResource GetProblemClassificationResource(ResourceIdentifier id) + { + ProblemClassificationResource.ValidateResourceId(id); + return new ProblemClassificationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionSupportTicketResource GetSubscriptionSupportTicketResource(ResourceIdentifier id) + { + SubscriptionSupportTicketResource.ValidateResourceId(id); + return new SubscriptionSupportTicketResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantSupportTicketResource GetTenantSupportTicketResource(ResourceIdentifier id) + { + TenantSupportTicketResource.ValidateResourceId(id); + return new TenantSupportTicketResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SupportTicketCommunicationResource GetSupportTicketCommunicationResource(ResourceIdentifier id) + { + SupportTicketCommunicationResource.ValidateResourceId(id); + return new SupportTicketCommunicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SupportTicketNoSubCommunicationResource GetSupportTicketNoSubCommunicationResource(ResourceIdentifier id) + { + SupportTicketNoSubCommunicationResource.ValidateResourceId(id); + return new SupportTicketNoSubCommunicationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SupportTicketChatTranscriptResource GetSupportTicketChatTranscriptResource(ResourceIdentifier id) + { + SupportTicketChatTranscriptResource.ValidateResourceId(id); + return new SupportTicketChatTranscriptResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SupportTicketNoSubChatTranscriptResource GetSupportTicketNoSubChatTranscriptResource(ResourceIdentifier id) + { + SupportTicketNoSubChatTranscriptResource.ValidateResourceId(id); + return new SupportTicketNoSubChatTranscriptResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SubscriptionFileWorkspaceResource GetSubscriptionFileWorkspaceResource(ResourceIdentifier id) + { + SubscriptionFileWorkspaceResource.ValidateResourceId(id); + return new SubscriptionFileWorkspaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantFileWorkspaceResource GetTenantFileWorkspaceResource(ResourceIdentifier id) + { + TenantFileWorkspaceResource.ValidateResourceId(id); + return new TenantFileWorkspaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SupportTicketFileResource GetSupportTicketFileResource(ResourceIdentifier id) + { + SupportTicketFileResource.ValidateResourceId(id); + return new SupportTicketFileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SupportTicketNoSubFileResource GetSupportTicketNoSubFileResource(ResourceIdentifier id) + { + SupportTicketNoSubFileResource.ValidateResourceId(id); + return new SupportTicketNoSubFileResource(Client, id); + } + } +} diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportSubscriptionResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportSubscriptionResource.cs new file mode 100644 index 0000000000000..5e54777134ee8 --- /dev/null +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportSubscriptionResource.cs @@ -0,0 +1,221 @@ +// 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; +using Azure.ResourceManager.Support; +using Azure.ResourceManager.Support.Models; + +namespace Azure.ResourceManager.Support.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSupportSubscriptionResource : ArmResource + { + private ClientDiagnostics _subscriptionSupportTicketSupportTicketsClientDiagnostics; + private SupportTicketsRestOperations _subscriptionSupportTicketSupportTicketsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSupportSubscriptionResource() + { + } + + /// 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 MockableSupportSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SubscriptionSupportTicketSupportTicketsClientDiagnostics => _subscriptionSupportTicketSupportTicketsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Support", SubscriptionSupportTicketResource.ResourceType.Namespace, Diagnostics); + private SupportTicketsRestOperations SubscriptionSupportTicketSupportTicketsRestClient => _subscriptionSupportTicketSupportTicketsRestClient ??= new SupportTicketsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SubscriptionSupportTicketResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SubscriptionSupportTicketResources in the SubscriptionResource. + /// An object representing collection of SubscriptionSupportTicketResources and their operations over a SubscriptionSupportTicketResource. + public virtual SubscriptionSupportTicketCollection GetSubscriptionSupportTickets() + { + return GetCachedClient(client => new SubscriptionSupportTicketCollection(client, Id)); + } + + /// + /// Get ticket details for an Azure subscription. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName} + /// + /// + /// Operation Id + /// SupportTickets_Get + /// + /// + /// + /// Support ticket name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionSupportTicketAsync(string supportTicketName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionSupportTickets().GetAsync(supportTicketName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get ticket details for an Azure subscription. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName} + /// + /// + /// Operation Id + /// SupportTickets_Get + /// + /// + /// + /// Support ticket name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionSupportTicket(string supportTicketName, CancellationToken cancellationToken = default) + { + return GetSubscriptionSupportTickets().Get(supportTicketName, cancellationToken); + } + + /// Gets a collection of SubscriptionFileWorkspaceResources in the SubscriptionResource. + /// An object representing collection of SubscriptionFileWorkspaceResources and their operations over a SubscriptionFileWorkspaceResource. + public virtual SubscriptionFileWorkspaceCollection GetSubscriptionFileWorkspaces() + { + return GetCachedClient(client => new SubscriptionFileWorkspaceCollection(client, Id)); + } + + /// + /// Gets details for a specific file workspace in an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName} + /// + /// + /// Operation Id + /// FileWorkspaces_Get + /// + /// + /// + /// File Workspace Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionFileWorkspaceAsync(string fileWorkspaceName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionFileWorkspaces().GetAsync(fileWorkspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details for a specific file workspace in an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName} + /// + /// + /// Operation Id + /// FileWorkspaces_Get + /// + /// + /// + /// File Workspace Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubscriptionFileWorkspace(string fileWorkspaceName, CancellationToken cancellationToken = default) + { + return GetSubscriptionFileWorkspaces().Get(fileWorkspaceName, cancellationToken); + } + + /// + /// Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/checkNameAvailability + /// + /// + /// Operation Id + /// SupportTickets_CheckNameAvailability + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckSupportTicketNameAvailabilityAsync(SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SubscriptionSupportTicketSupportTicketsClientDiagnostics.CreateScope("MockableSupportSubscriptionResource.CheckSupportTicketNameAvailability"); + scope.Start(); + try + { + var response = await SubscriptionSupportTicketSupportTicketsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/checkNameAvailability + /// + /// + /// Operation Id + /// SupportTickets_CheckNameAvailability + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckSupportTicketNameAvailability(SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SubscriptionSupportTicketSupportTicketsClientDiagnostics.CreateScope("MockableSupportSubscriptionResource.CheckSupportTicketNameAvailability"); + scope.Start(); + try + { + var response = SubscriptionSupportTicketSupportTicketsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportTenantResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportTenantResource.cs new file mode 100644 index 0000000000000..f52fb1b2eff51 --- /dev/null +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportTenantResource.cs @@ -0,0 +1,274 @@ +// 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; +using Azure.ResourceManager.Support; +using Azure.ResourceManager.Support.Models; + +namespace Azure.ResourceManager.Support.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableSupportTenantResource : ArmResource + { + private ClientDiagnostics _tenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics; + private SupportTicketsNoSubscriptionRestOperations _tenantSupportTicketSupportTicketsNoSubscriptionRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSupportTenantResource() + { + } + + /// 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 MockableSupportTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics TenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics => _tenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Support", TenantSupportTicketResource.ResourceType.Namespace, Diagnostics); + private SupportTicketsNoSubscriptionRestOperations TenantSupportTicketSupportTicketsNoSubscriptionRestClient => _tenantSupportTicketSupportTicketsNoSubscriptionRestClient ??= new SupportTicketsNoSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TenantSupportTicketResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SupportAzureServiceResources in the TenantResource. + /// An object representing collection of SupportAzureServiceResources and their operations over a SupportAzureServiceResource. + public virtual SupportAzureServiceCollection GetSupportAzureServices() + { + return GetCachedClient(client => new SupportAzureServiceCollection(client, Id)); + } + + /// + /// Gets a specific Azure service for support ticket creation. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Name of the Azure service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSupportAzureServiceAsync(string serviceName, CancellationToken cancellationToken = default) + { + return await GetSupportAzureServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a specific Azure service for support ticket creation. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/services/{serviceName} + /// + /// + /// Operation Id + /// Services_Get + /// + /// + /// + /// Name of the Azure service. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSupportAzureService(string serviceName, CancellationToken cancellationToken = default) + { + return GetSupportAzureServices().Get(serviceName, cancellationToken); + } + + /// Gets a collection of TenantSupportTicketResources in the TenantResource. + /// An object representing collection of TenantSupportTicketResources and their operations over a TenantSupportTicketResource. + public virtual TenantSupportTicketCollection GetTenantSupportTickets() + { + return GetCachedClient(client => new TenantSupportTicketCollection(client, Id)); + } + + /// + /// Gets details for a specific support ticket. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/supportTickets/{supportTicketName} + /// + /// + /// Operation Id + /// SupportTicketsNoSubscription_Get + /// + /// + /// + /// Support ticket name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTenantSupportTicketAsync(string supportTicketName, CancellationToken cancellationToken = default) + { + return await GetTenantSupportTickets().GetAsync(supportTicketName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details for a specific support ticket. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/supportTickets/{supportTicketName} + /// + /// + /// Operation Id + /// SupportTicketsNoSubscription_Get + /// + /// + /// + /// Support ticket name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTenantSupportTicket(string supportTicketName, CancellationToken cancellationToken = default) + { + return GetTenantSupportTickets().Get(supportTicketName, cancellationToken); + } + + /// Gets a collection of TenantFileWorkspaceResources in the TenantResource. + /// An object representing collection of TenantFileWorkspaceResources and their operations over a TenantFileWorkspaceResource. + public virtual TenantFileWorkspaceCollection GetTenantFileWorkspaces() + { + return GetCachedClient(client => new TenantFileWorkspaceCollection(client, Id)); + } + + /// + /// Gets details for a specific file workspace. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName} + /// + /// + /// Operation Id + /// FileWorkspacesNoSubscription_Get + /// + /// + /// + /// File Workspace Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTenantFileWorkspaceAsync(string fileWorkspaceName, CancellationToken cancellationToken = default) + { + return await GetTenantFileWorkspaces().GetAsync(fileWorkspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets details for a specific file workspace. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName} + /// + /// + /// Operation Id + /// FileWorkspacesNoSubscription_Get + /// + /// + /// + /// File Workspace Name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTenantFileWorkspace(string fileWorkspaceName, CancellationToken cancellationToken = default) + { + return GetTenantFileWorkspaces().Get(fileWorkspaceName, cancellationToken); + } + + /// + /// Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/checkNameAvailability + /// + /// + /// Operation Id + /// SupportTicketsNoSubscription_CheckNameAvailability + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNameAvailabilitySupportTicketsNoSubscriptionAsync(SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = TenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics.CreateScope("MockableSupportTenantResource.CheckNameAvailabilitySupportTicketsNoSubscription"); + scope.Start(); + try + { + var response = await TenantSupportTicketSupportTicketsNoSubscriptionRestClient.CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. + /// + /// + /// Request Path + /// /providers/Microsoft.Support/checkNameAvailability + /// + /// + /// Operation Id + /// SupportTicketsNoSubscription_CheckNameAvailability + /// + /// + /// + /// Input to check. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNameAvailabilitySupportTicketsNoSubscription(SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = TenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics.CreateScope("MockableSupportTenantResource.CheckNameAvailabilitySupportTicketsNoSubscription"); + scope.Start(); + try + { + var response = TenantSupportTicketSupportTicketsNoSubscriptionRestClient.CheckNameAvailability(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 442c4d69bf58d..0000000000000 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,122 +0,0 @@ -// 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; -using Azure.ResourceManager.Support.Models; - -namespace Azure.ResourceManager.Support -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _subscriptionSupportTicketSupportTicketsClientDiagnostics; - private SupportTicketsRestOperations _subscriptionSupportTicketSupportTicketsRestClient; - - /// 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 SubscriptionSupportTicketSupportTicketsClientDiagnostics => _subscriptionSupportTicketSupportTicketsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Support", SubscriptionSupportTicketResource.ResourceType.Namespace, Diagnostics); - private SupportTicketsRestOperations SubscriptionSupportTicketSupportTicketsRestClient => _subscriptionSupportTicketSupportTicketsRestClient ??= new SupportTicketsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SubscriptionSupportTicketResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of SubscriptionSupportTicketResources in the SubscriptionResource. - /// An object representing collection of SubscriptionSupportTicketResources and their operations over a SubscriptionSupportTicketResource. - public virtual SubscriptionSupportTicketCollection GetSubscriptionSupportTickets() - { - return GetCachedClient(Client => new SubscriptionSupportTicketCollection(Client, Id)); - } - - /// Gets a collection of SubscriptionFileWorkspaceResources in the SubscriptionResource. - /// An object representing collection of SubscriptionFileWorkspaceResources and their operations over a SubscriptionFileWorkspaceResource. - public virtual SubscriptionFileWorkspaceCollection GetSubscriptionFileWorkspaces() - { - return GetCachedClient(Client => new SubscriptionFileWorkspaceCollection(Client, Id)); - } - - /// - /// Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/checkNameAvailability - /// - /// - /// Operation Id - /// SupportTickets_CheckNameAvailability - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual async Task> CheckSupportTicketNameAvailabilityAsync(SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionSupportTicketSupportTicketsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSupportTicketNameAvailability"); - scope.Start(); - try - { - var response = await SubscriptionSupportTicketSupportTicketsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Support/checkNameAvailability - /// - /// - /// Operation Id - /// SupportTickets_CheckNameAvailability - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual Response CheckSupportTicketNameAvailability(SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SubscriptionSupportTicketSupportTicketsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSupportTicketNameAvailability"); - scope.Start(); - try - { - var response = SubscriptionSupportTicketSupportTicketsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/SupportExtensions.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/SupportExtensions.cs index 53de89b219643..0d57cbbefc06a 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/SupportExtensions.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/SupportExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Support.Mocking; using Azure.ResourceManager.Support.Models; namespace Azure.ResourceManager.Support @@ -19,271 +20,225 @@ namespace Azure.ResourceManager.Support /// A class to add extension methods to Azure.ResourceManager.Support. public static partial class SupportExtensions { - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSupportArmClient GetMockableSupportArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSupportArmClient(client0)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSupportSubscriptionResource GetMockableSupportSubscriptionResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSupportSubscriptionResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) + private static MockableSupportTenantResource GetMockableSupportTenantResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSupportTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region SupportAzureServiceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SupportAzureServiceResource GetSupportAzureServiceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SupportAzureServiceResource.ValidateResourceId(id); - return new SupportAzureServiceResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSupportAzureServiceResource(id); } - #endregion - #region ProblemClassificationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ProblemClassificationResource GetProblemClassificationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ProblemClassificationResource.ValidateResourceId(id); - return new ProblemClassificationResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetProblemClassificationResource(id); } - #endregion - #region SubscriptionSupportTicketResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubscriptionSupportTicketResource GetSubscriptionSupportTicketResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionSupportTicketResource.ValidateResourceId(id); - return new SubscriptionSupportTicketResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSubscriptionSupportTicketResource(id); } - #endregion - #region TenantSupportTicketResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TenantSupportTicketResource GetTenantSupportTicketResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TenantSupportTicketResource.ValidateResourceId(id); - return new TenantSupportTicketResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetTenantSupportTicketResource(id); } - #endregion - #region SupportTicketCommunicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SupportTicketCommunicationResource GetSupportTicketCommunicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SupportTicketCommunicationResource.ValidateResourceId(id); - return new SupportTicketCommunicationResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSupportTicketCommunicationResource(id); } - #endregion - #region SupportTicketNoSubCommunicationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SupportTicketNoSubCommunicationResource GetSupportTicketNoSubCommunicationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SupportTicketNoSubCommunicationResource.ValidateResourceId(id); - return new SupportTicketNoSubCommunicationResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSupportTicketNoSubCommunicationResource(id); } - #endregion - #region SupportTicketChatTranscriptResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SupportTicketChatTranscriptResource GetSupportTicketChatTranscriptResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SupportTicketChatTranscriptResource.ValidateResourceId(id); - return new SupportTicketChatTranscriptResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSupportTicketChatTranscriptResource(id); } - #endregion - #region SupportTicketNoSubChatTranscriptResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SupportTicketNoSubChatTranscriptResource GetSupportTicketNoSubChatTranscriptResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SupportTicketNoSubChatTranscriptResource.ValidateResourceId(id); - return new SupportTicketNoSubChatTranscriptResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSupportTicketNoSubChatTranscriptResource(id); } - #endregion - #region SubscriptionFileWorkspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SubscriptionFileWorkspaceResource GetSubscriptionFileWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SubscriptionFileWorkspaceResource.ValidateResourceId(id); - return new SubscriptionFileWorkspaceResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSubscriptionFileWorkspaceResource(id); } - #endregion - #region TenantFileWorkspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TenantFileWorkspaceResource GetTenantFileWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TenantFileWorkspaceResource.ValidateResourceId(id); - return new TenantFileWorkspaceResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetTenantFileWorkspaceResource(id); } - #endregion - #region SupportTicketFileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SupportTicketFileResource GetSupportTicketFileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SupportTicketFileResource.ValidateResourceId(id); - return new SupportTicketFileResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSupportTicketFileResource(id); } - #endregion - #region SupportTicketNoSubFileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SupportTicketNoSubFileResource GetSupportTicketNoSubFileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SupportTicketNoSubFileResource.ValidateResourceId(id); - return new SupportTicketNoSubFileResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSupportTicketNoSubFileResource(id); } - #endregion - /// Gets a collection of SubscriptionSupportTicketResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionSupportTicketResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SubscriptionSupportTicketResources and their operations over a SubscriptionSupportTicketResource. public static SubscriptionSupportTicketCollection GetSubscriptionSupportTickets(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionSupportTickets(); + return GetMockableSupportSubscriptionResource(subscriptionResource).GetSubscriptionSupportTickets(); } /// @@ -298,16 +253,20 @@ public static SubscriptionSupportTicketCollection GetSubscriptionSupportTickets( /// SupportTickets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Support ticket name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionSupportTicketAsync(this SubscriptionResource subscriptionResource, string supportTicketName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionSupportTickets().GetAsync(supportTicketName, cancellationToken).ConfigureAwait(false); + return await GetMockableSupportSubscriptionResource(subscriptionResource).GetSubscriptionSupportTicketAsync(supportTicketName, cancellationToken).ConfigureAwait(false); } /// @@ -322,24 +281,34 @@ public static async Task> GetSubscri /// SupportTickets_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Support ticket name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionSupportTicket(this SubscriptionResource subscriptionResource, string supportTicketName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionSupportTickets().Get(supportTicketName, cancellationToken); + return GetMockableSupportSubscriptionResource(subscriptionResource).GetSubscriptionSupportTicket(supportTicketName, cancellationToken); } - /// Gets a collection of SubscriptionFileWorkspaceResources in the SubscriptionResource. + /// + /// Gets a collection of SubscriptionFileWorkspaceResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SubscriptionFileWorkspaceResources and their operations over a SubscriptionFileWorkspaceResource. public static SubscriptionFileWorkspaceCollection GetSubscriptionFileWorkspaces(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSubscriptionFileWorkspaces(); + return GetMockableSupportSubscriptionResource(subscriptionResource).GetSubscriptionFileWorkspaces(); } /// @@ -354,16 +323,20 @@ public static SubscriptionFileWorkspaceCollection GetSubscriptionFileWorkspaces( /// FileWorkspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// File Workspace Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSubscriptionFileWorkspaceAsync(this SubscriptionResource subscriptionResource, string fileWorkspaceName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSubscriptionFileWorkspaces().GetAsync(fileWorkspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableSupportSubscriptionResource(subscriptionResource).GetSubscriptionFileWorkspaceAsync(fileWorkspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -378,16 +351,20 @@ public static async Task> GetSubscri /// FileWorkspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// File Workspace Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSubscriptionFileWorkspace(this SubscriptionResource subscriptionResource, string fileWorkspaceName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSubscriptionFileWorkspaces().Get(fileWorkspaceName, cancellationToken); + return GetMockableSupportSubscriptionResource(subscriptionResource).GetSubscriptionFileWorkspace(fileWorkspaceName, cancellationToken); } /// @@ -402,6 +379,10 @@ public static Response GetSubscriptionFileWor /// SupportTickets_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -409,9 +390,7 @@ public static Response GetSubscriptionFileWor /// is null. public static async Task> CheckSupportTicketNameAvailabilityAsync(this SubscriptionResource subscriptionResource, SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSupportTicketNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableSupportSubscriptionResource(subscriptionResource).CheckSupportTicketNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -426,6 +405,10 @@ public static async Task> CheckSupportTi /// SupportTickets_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -433,17 +416,21 @@ public static async Task> CheckSupportTi /// is null. public static Response CheckSupportTicketNameAvailability(this SubscriptionResource subscriptionResource, SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckSupportTicketNameAvailability(content, cancellationToken); + return GetMockableSupportSubscriptionResource(subscriptionResource).CheckSupportTicketNameAvailability(content, cancellationToken); } - /// Gets a collection of SupportAzureServiceResources in the TenantResource. + /// + /// Gets a collection of SupportAzureServiceResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SupportAzureServiceResources and their operations over a SupportAzureServiceResource. public static SupportAzureServiceCollection GetSupportAzureServices(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetSupportAzureServices(); + return GetMockableSupportTenantResource(tenantResource).GetSupportAzureServices(); } /// @@ -458,16 +445,20 @@ public static SupportAzureServiceCollection GetSupportAzureServices(this TenantR /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Azure service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSupportAzureServiceAsync(this TenantResource tenantResource, string serviceName, CancellationToken cancellationToken = default) { - return await tenantResource.GetSupportAzureServices().GetAsync(serviceName, cancellationToken).ConfigureAwait(false); + return await GetMockableSupportTenantResource(tenantResource).GetSupportAzureServiceAsync(serviceName, cancellationToken).ConfigureAwait(false); } /// @@ -482,24 +473,34 @@ public static async Task> GetSupportAzureS /// Services_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Azure service. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSupportAzureService(this TenantResource tenantResource, string serviceName, CancellationToken cancellationToken = default) { - return tenantResource.GetSupportAzureServices().Get(serviceName, cancellationToken); + return GetMockableSupportTenantResource(tenantResource).GetSupportAzureService(serviceName, cancellationToken); } - /// Gets a collection of TenantSupportTicketResources in the TenantResource. + /// + /// Gets a collection of TenantSupportTicketResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TenantSupportTicketResources and their operations over a TenantSupportTicketResource. public static TenantSupportTicketCollection GetTenantSupportTickets(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetTenantSupportTickets(); + return GetMockableSupportTenantResource(tenantResource).GetTenantSupportTickets(); } /// @@ -514,16 +515,20 @@ public static TenantSupportTicketCollection GetTenantSupportTickets(this TenantR /// SupportTicketsNoSubscription_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Support ticket name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTenantSupportTicketAsync(this TenantResource tenantResource, string supportTicketName, CancellationToken cancellationToken = default) { - return await tenantResource.GetTenantSupportTickets().GetAsync(supportTicketName, cancellationToken).ConfigureAwait(false); + return await GetMockableSupportTenantResource(tenantResource).GetTenantSupportTicketAsync(supportTicketName, cancellationToken).ConfigureAwait(false); } /// @@ -538,24 +543,34 @@ public static async Task> GetTenantSupport /// SupportTicketsNoSubscription_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Support ticket name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTenantSupportTicket(this TenantResource tenantResource, string supportTicketName, CancellationToken cancellationToken = default) { - return tenantResource.GetTenantSupportTickets().Get(supportTicketName, cancellationToken); + return GetMockableSupportTenantResource(tenantResource).GetTenantSupportTicket(supportTicketName, cancellationToken); } - /// Gets a collection of TenantFileWorkspaceResources in the TenantResource. + /// + /// Gets a collection of TenantFileWorkspaceResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TenantFileWorkspaceResources and their operations over a TenantFileWorkspaceResource. public static TenantFileWorkspaceCollection GetTenantFileWorkspaces(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetTenantFileWorkspaces(); + return GetMockableSupportTenantResource(tenantResource).GetTenantFileWorkspaces(); } /// @@ -570,16 +585,20 @@ public static TenantFileWorkspaceCollection GetTenantFileWorkspaces(this TenantR /// FileWorkspacesNoSubscription_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// File Workspace Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTenantFileWorkspaceAsync(this TenantResource tenantResource, string fileWorkspaceName, CancellationToken cancellationToken = default) { - return await tenantResource.GetTenantFileWorkspaces().GetAsync(fileWorkspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableSupportTenantResource(tenantResource).GetTenantFileWorkspaceAsync(fileWorkspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -594,16 +613,20 @@ public static async Task> GetTenantFileWor /// FileWorkspacesNoSubscription_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// File Workspace Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTenantFileWorkspace(this TenantResource tenantResource, string fileWorkspaceName, CancellationToken cancellationToken = default) { - return tenantResource.GetTenantFileWorkspaces().Get(fileWorkspaceName, cancellationToken); + return GetMockableSupportTenantResource(tenantResource).GetTenantFileWorkspace(fileWorkspaceName, cancellationToken); } /// @@ -618,6 +641,10 @@ public static Response GetTenantFileWorkspace(this /// SupportTicketsNoSubscription_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -625,9 +652,7 @@ public static Response GetTenantFileWorkspace(this /// is null. public static async Task> CheckNameAvailabilitySupportTicketsNoSubscriptionAsync(this TenantResource tenantResource, SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).CheckNameAvailabilitySupportTicketsNoSubscriptionAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableSupportTenantResource(tenantResource).CheckNameAvailabilitySupportTicketsNoSubscriptionAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -642,6 +667,10 @@ public static async Task> CheckNameAvail /// SupportTicketsNoSubscription_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -649,9 +678,7 @@ public static async Task> CheckNameAvail /// is null. public static Response CheckNameAvailabilitySupportTicketsNoSubscription(this TenantResource tenantResource, SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).CheckNameAvailabilitySupportTicketsNoSubscription(content, cancellationToken); + return GetMockableSupportTenantResource(tenantResource).CheckNameAvailabilitySupportTicketsNoSubscription(content, cancellationToken); } } } diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index f50b03ae7a52a..0000000000000 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,129 +0,0 @@ -// 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; -using Azure.ResourceManager.Support.Models; - -namespace Azure.ResourceManager.Support -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _tenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics; - private SupportTicketsNoSubscriptionRestOperations _tenantSupportTicketSupportTicketsNoSubscriptionRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics TenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics => _tenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Support", TenantSupportTicketResource.ResourceType.Namespace, Diagnostics); - private SupportTicketsNoSubscriptionRestOperations TenantSupportTicketSupportTicketsNoSubscriptionRestClient => _tenantSupportTicketSupportTicketsNoSubscriptionRestClient ??= new SupportTicketsNoSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TenantSupportTicketResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of SupportAzureServiceResources in the TenantResource. - /// An object representing collection of SupportAzureServiceResources and their operations over a SupportAzureServiceResource. - public virtual SupportAzureServiceCollection GetSupportAzureServices() - { - return GetCachedClient(Client => new SupportAzureServiceCollection(Client, Id)); - } - - /// Gets a collection of TenantSupportTicketResources in the TenantResource. - /// An object representing collection of TenantSupportTicketResources and their operations over a TenantSupportTicketResource. - public virtual TenantSupportTicketCollection GetTenantSupportTickets() - { - return GetCachedClient(Client => new TenantSupportTicketCollection(Client, Id)); - } - - /// Gets a collection of TenantFileWorkspaceResources in the TenantResource. - /// An object representing collection of TenantFileWorkspaceResources and their operations over a TenantFileWorkspaceResource. - public virtual TenantFileWorkspaceCollection GetTenantFileWorkspaces() - { - return GetCachedClient(Client => new TenantFileWorkspaceCollection(Client, Id)); - } - - /// - /// Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. - /// - /// - /// Request Path - /// /providers/Microsoft.Support/checkNameAvailability - /// - /// - /// Operation Id - /// SupportTicketsNoSubscription_CheckNameAvailability - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual async Task> CheckNameAvailabilitySupportTicketsNoSubscriptionAsync(SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = TenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckNameAvailabilitySupportTicketsNoSubscription"); - scope.Start(); - try - { - var response = await TenantSupportTicketSupportTicketsNoSubscriptionRestClient.CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. - /// - /// - /// Request Path - /// /providers/Microsoft.Support/checkNameAvailability - /// - /// - /// Operation Id - /// SupportTicketsNoSubscription_CheckNameAvailability - /// - /// - /// - /// Input to check. - /// The cancellation token to use. - public virtual Response CheckNameAvailabilitySupportTicketsNoSubscription(SupportNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = TenantSupportTicketSupportTicketsNoSubscriptionClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckNameAvailabilitySupportTicketsNoSubscription"); - scope.Start(); - try - { - var response = TenantSupportTicketSupportTicketsNoSubscriptionRestClient.CheckNameAvailability(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/ProblemClassificationResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/ProblemClassificationResource.cs index 28dba9f117fd5..89650cd714362 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/ProblemClassificationResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/ProblemClassificationResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Support public partial class ProblemClassificationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The serviceName. + /// The problemClassificationName. public static ResourceIdentifier CreateResourceIdentifier(string serviceName, string problemClassificationName) { var resourceId = $"/providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName}"; diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SubscriptionFileWorkspaceResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SubscriptionFileWorkspaceResource.cs index 2486bb527f7a9..7da1445d954eb 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SubscriptionFileWorkspaceResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SubscriptionFileWorkspaceResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Support public partial class SubscriptionFileWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The fileWorkspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string fileWorkspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}"; @@ -91,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SupportTicketFileResources and their operations over a SupportTicketFileResource. public virtual SupportTicketFileCollection GetSupportTicketFiles() { - return GetCachedClient(Client => new SupportTicketFileCollection(Client, Id)); + return GetCachedClient(client => new SupportTicketFileCollection(client, Id)); } /// @@ -109,8 +111,8 @@ public virtual SupportTicketFileCollection GetSupportTicketFiles() /// /// File Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSupportTicketFileAsync(string fileName, CancellationToken cancellationToken = default) { @@ -132,8 +134,8 @@ public virtual async Task> GetSupportTicketF /// /// File Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSupportTicketFile(string fileName, CancellationToken cancellationToken = default) { diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SubscriptionSupportTicketResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SubscriptionSupportTicketResource.cs index 9a126d05af85d..6e75927c9feea 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SubscriptionSupportTicketResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SubscriptionSupportTicketResource.cs @@ -27,6 +27,8 @@ namespace Azure.ResourceManager.Support public partial class SubscriptionSupportTicketResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The supportTicketName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string supportTicketName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}"; @@ -97,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SupportTicketCommunicationResources and their operations over a SupportTicketCommunicationResource. public virtual SupportTicketCommunicationCollection GetSupportTicketCommunications() { - return GetCachedClient(Client => new SupportTicketCommunicationCollection(Client, Id)); + return GetCachedClient(client => new SupportTicketCommunicationCollection(client, Id)); } /// @@ -115,8 +117,8 @@ public virtual SupportTicketCommunicationCollection GetSupportTicketCommunicatio /// /// Communication name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSupportTicketCommunicationAsync(string communicationName, CancellationToken cancellationToken = default) { @@ -138,8 +140,8 @@ public virtual async Task> GetSuppo /// /// Communication name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSupportTicketCommunication(string communicationName, CancellationToken cancellationToken = default) { @@ -150,7 +152,7 @@ public virtual Response GetSupportTicketComm /// An object representing collection of SupportTicketChatTranscriptResources and their operations over a SupportTicketChatTranscriptResource. public virtual SupportTicketChatTranscriptCollection GetSupportTicketChatTranscripts() { - return GetCachedClient(Client => new SupportTicketChatTranscriptCollection(Client, Id)); + return GetCachedClient(client => new SupportTicketChatTranscriptCollection(client, Id)); } /// @@ -168,8 +170,8 @@ public virtual SupportTicketChatTranscriptCollection GetSupportTicketChatTranscr /// /// ChatTranscript name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSupportTicketChatTranscriptAsync(string chatTranscriptName, CancellationToken cancellationToken = default) { @@ -191,8 +193,8 @@ public virtual async Task> GetSupp /// /// ChatTranscript name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSupportTicketChatTranscript(string chatTranscriptName, CancellationToken cancellationToken = default) { diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceResource.cs index 519f6c44777cb..9f66d85f22803 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.Support public partial class SupportAzureServiceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The serviceName. public static ResourceIdentifier CreateResourceIdentifier(string serviceName) { var resourceId = $"/providers/Microsoft.Support/services/{serviceName}"; @@ -91,7 +92,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of ProblemClassificationResources and their operations over a ProblemClassificationResource. public virtual ProblemClassificationCollection GetProblemClassifications() { - return GetCachedClient(Client => new ProblemClassificationCollection(Client, Id)); + return GetCachedClient(client => new ProblemClassificationCollection(client, Id)); } /// @@ -109,8 +110,8 @@ public virtual ProblemClassificationCollection GetProblemClassifications() /// /// Name of problem classification. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetProblemClassificationAsync(string problemClassificationName, CancellationToken cancellationToken = default) { @@ -132,8 +133,8 @@ public virtual async Task> GetProblemCla /// /// Name of problem classification. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetProblemClassification(string problemClassificationName, CancellationToken cancellationToken = default) { diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketChatTranscriptResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketChatTranscriptResource.cs index 0f03c625a4fa2..c5dafee661abb 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketChatTranscriptResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketChatTranscriptResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Support public partial class SupportTicketChatTranscriptResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The supportTicketName. + /// The chatTranscriptName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string supportTicketName, string chatTranscriptName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}"; diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCommunicationResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCommunicationResource.cs index 5904fb38c8527..752c180662c6e 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCommunicationResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketCommunicationResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Support public partial class SupportTicketCommunicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The supportTicketName. + /// The communicationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string supportTicketName, string communicationName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}"; diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketFileResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketFileResource.cs index e51136da48f19..3b912882c17d4 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketFileResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketFileResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.Support public partial class SupportTicketFileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The fileWorkspaceName. + /// The fileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string fileWorkspaceName, string fileName) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}"; diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubChatTranscriptResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubChatTranscriptResource.cs index a9850b695cbef..0c12742a9e196 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubChatTranscriptResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubChatTranscriptResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Support public partial class SupportTicketNoSubChatTranscriptResource : ArmResource { /// Generate the resource identifier of a instance. + /// The supportTicketName. + /// The chatTranscriptName. public static ResourceIdentifier CreateResourceIdentifier(string supportTicketName, string chatTranscriptName) { var resourceId = $"/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}"; diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubCommunicationResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubCommunicationResource.cs index b11d9a60d92a8..d7e704f3ea491 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubCommunicationResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubCommunicationResource.cs @@ -25,6 +25,8 @@ namespace Azure.ResourceManager.Support public partial class SupportTicketNoSubCommunicationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The supportTicketName. + /// The communicationName. public static ResourceIdentifier CreateResourceIdentifier(string supportTicketName, string communicationName) { var resourceId = $"/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}"; diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubFileResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubFileResource.cs index 492fdae39a8bb..971b08f196cda 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubFileResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketNoSubFileResource.cs @@ -26,6 +26,8 @@ namespace Azure.ResourceManager.Support public partial class SupportTicketNoSubFileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The fileWorkspaceName. + /// The fileName. public static ResourceIdentifier CreateResourceIdentifier(string fileWorkspaceName, string fileName) { var resourceId = $"/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}"; diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/TenantFileWorkspaceResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/TenantFileWorkspaceResource.cs index 6cfc3aff853c8..c6fab6542161b 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/TenantFileWorkspaceResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/TenantFileWorkspaceResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.Support public partial class TenantFileWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The fileWorkspaceName. public static ResourceIdentifier CreateResourceIdentifier(string fileWorkspaceName) { var resourceId = $"/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}"; @@ -91,7 +92,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SupportTicketNoSubFileResources and their operations over a SupportTicketNoSubFileResource. public virtual SupportTicketNoSubFileCollection GetSupportTicketNoSubFiles() { - return GetCachedClient(Client => new SupportTicketNoSubFileCollection(Client, Id)); + return GetCachedClient(client => new SupportTicketNoSubFileCollection(client, Id)); } /// @@ -109,8 +110,8 @@ public virtual SupportTicketNoSubFileCollection GetSupportTicketNoSubFiles() /// /// File Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSupportTicketNoSubFileAsync(string fileName, CancellationToken cancellationToken = default) { @@ -132,8 +133,8 @@ public virtual async Task> GetSupportTi /// /// File Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSupportTicketNoSubFile(string fileName, CancellationToken cancellationToken = default) { diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/TenantSupportTicketResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/TenantSupportTicketResource.cs index cd5a0b4e6449e..507280ec48e19 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/TenantSupportTicketResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/TenantSupportTicketResource.cs @@ -27,6 +27,7 @@ namespace Azure.ResourceManager.Support public partial class TenantSupportTicketResource : ArmResource { /// Generate the resource identifier of a instance. + /// The supportTicketName. public static ResourceIdentifier CreateResourceIdentifier(string supportTicketName) { var resourceId = $"/providers/Microsoft.Support/supportTickets/{supportTicketName}"; @@ -97,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SupportTicketNoSubCommunicationResources and their operations over a SupportTicketNoSubCommunicationResource. public virtual SupportTicketNoSubCommunicationCollection GetSupportTicketNoSubCommunications() { - return GetCachedClient(Client => new SupportTicketNoSubCommunicationCollection(Client, Id)); + return GetCachedClient(client => new SupportTicketNoSubCommunicationCollection(client, Id)); } /// @@ -115,8 +116,8 @@ public virtual SupportTicketNoSubCommunicationCollection GetSupportTicketNoSubCo /// /// Communication name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSupportTicketNoSubCommunicationAsync(string communicationName, CancellationToken cancellationToken = default) { @@ -138,8 +139,8 @@ public virtual async Task> Get /// /// Communication name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSupportTicketNoSubCommunication(string communicationName, CancellationToken cancellationToken = default) { @@ -150,7 +151,7 @@ public virtual Response GetSupportTicke /// An object representing collection of SupportTicketNoSubChatTranscriptResources and their operations over a SupportTicketNoSubChatTranscriptResource. public virtual SupportTicketNoSubChatTranscriptCollection GetSupportTicketNoSubChatTranscripts() { - return GetCachedClient(Client => new SupportTicketNoSubChatTranscriptCollection(Client, Id)); + return GetCachedClient(client => new SupportTicketNoSubChatTranscriptCollection(client, Id)); } /// @@ -168,8 +169,8 @@ public virtual SupportTicketNoSubChatTranscriptCollection GetSupportTicketNoSubC /// /// ChatTranscript name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSupportTicketNoSubChatTranscriptAsync(string chatTranscriptName, CancellationToken cancellationToken = default) { @@ -191,8 +192,8 @@ public virtual async Task> Ge /// /// ChatTranscript name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSupportTicketNoSubChatTranscript(string chatTranscriptName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/CHANGELOG.md b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/CHANGELOG.md index 63cbc0a378409..d4bb696609d8d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/CHANGELOG.md +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-preview.19 (Unreleased) +## 1.0.0-preview.20 (Unreleased) ### Features Added @@ -10,6 +10,11 @@ ### Other Changes +## 1.0.0-preview.19 (2023-10-30) +- Fix runNotebook sessionId from int to string +- Fix placeholder links causing 404s +- Sync expression Support From DataFactory To Synapse + ## 1.0.0-preview.18 (2023-08-08) - Added `authenticationType`, `containerUri`, `sasUri` and `sasToken` properties to BlobService - Added `setSystemVariable` proprety to SetVariableActivityTypeProperties diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/api/Azure.Analytics.Synapse.Artifacts.netstandard2.0.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/api/Azure.Analytics.Synapse.Artifacts.netstandard2.0.cs index 3eec82cea47b2..21f9f5014a95f 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/api/Azure.Analytics.Synapse.Artifacts.netstandard2.0.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/api/Azure.Analytics.Synapse.Artifacts.netstandard2.0.cs @@ -1119,7 +1119,7 @@ public AmazonRdsForSqlServerSource() { } public object ProduceAdditionalTypes { get { throw null; } set { } } public object SqlReaderQuery { get { throw null; } set { } } public object SqlReaderStoredProcedureName { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } } public partial class AmazonRdsForSqlServerTableDataset : Azure.Analytics.Synapse.Artifacts.Models.Dataset { @@ -1182,7 +1182,7 @@ public partial class AmazonS3ReadSettings : Azure.Analytics.Synapse.Artifacts.Mo { public AmazonS3ReadSettings() { } public object DeleteFilesAfterCompletion { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object FileListPath { get { throw null; } set { } } public object ModifiedDatetimeEnd { get { throw null; } set { } } public object ModifiedDatetimeStart { get { throw null; } set { } } @@ -1252,10 +1252,10 @@ public static partial class AnalyticsSynapseArtifactsModelFactory public static Azure.Analytics.Synapse.Artifacts.Models.Resource Resource(string id = null, string name = null, string type = null) { throw null; } public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookError RunNotebookError(string ename = null, string evalue = null, System.Collections.Generic.IEnumerable traceback = null) { throw null; } public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookResponse RunNotebookResponse(string message = null, Azure.Analytics.Synapse.Artifacts.Models.RunNotebookResult result = null) { throw null; } - public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookResult RunNotebookResult(string runId = null, string runStatus = null, string lastCheckedOn = null, long? sessionId = default(long?), string sparkPool = null, object sessionDetail = null, string exitValue = null, Azure.Analytics.Synapse.Artifacts.Models.RunNotebookError error = null) { throw null; } - public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshot RunNotebookSnapshot(string exitValue = null, string id = null, string notebook = null, Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSparkSessionOptions sessionOptions = null, bool? honorSessionTimeToLive = default(bool?), long? sessionId = default(long?), string sparkPool = null, System.Collections.Generic.IReadOnlyDictionary parameters = null, Azure.Analytics.Synapse.Artifacts.Models.NotebookResource notebookContent = null) { throw null; } + public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookResult RunNotebookResult(string runId = null, string runStatus = null, string lastCheckedOn = null, string sessionId = null, string sparkPool = null, object sessionDetail = null, string exitValue = null, Azure.Analytics.Synapse.Artifacts.Models.RunNotebookError error = null) { throw null; } + public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshot RunNotebookSnapshot(string exitValue = null, string id = null, string notebook = null, Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSparkSessionOptions sessionOptions = null, bool? honorSessionTimeToLive = default(bool?), string sessionId = null, string sparkPool = null, System.Collections.Generic.IReadOnlyDictionary parameters = null, Azure.Analytics.Synapse.Artifacts.Models.NotebookResource notebookContent = null) { throw null; } public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshotResponse RunNotebookSnapshotResponse(string message = null, Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshotResult result = null) { throw null; } - public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshotResult RunNotebookSnapshotResult(Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshot snapshot = null, Azure.Analytics.Synapse.Artifacts.Models.RunNotebookError error = null, string runId = null, string runStatus = null, string lastCheckedOn = null, long? sessionId = default(long?), string sparkPool = null) { throw null; } + public static Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshotResult RunNotebookSnapshotResult(Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshot snapshot = null, Azure.Analytics.Synapse.Artifacts.Models.RunNotebookError error = null, string runId = null, string runStatus = null, string lastCheckedOn = null, string sessionId = null, string sparkPool = null) { throw null; } public static Azure.Analytics.Synapse.Artifacts.Models.ScheduleTrigger ScheduleTrigger(string description = null, Azure.Analytics.Synapse.Artifacts.Models.TriggerRuntimeState? runtimeState = default(Azure.Analytics.Synapse.Artifacts.Models.TriggerRuntimeState?), System.Collections.Generic.IEnumerable annotations = null, System.Collections.Generic.IDictionary additionalProperties = null, System.Collections.Generic.IEnumerable pipelines = null, Azure.Analytics.Synapse.Artifacts.Models.ScheduleTriggerRecurrence recurrence = null) { throw null; } public static Azure.Analytics.Synapse.Artifacts.Models.SparkBatchJob SparkBatchJob(Azure.Analytics.Synapse.Artifacts.Models.SparkBatchJobState livyInfo = null, string name = null, string workspaceName = null, string sparkPoolName = null, string submitterName = null, string submitterId = null, string artifactId = null, Azure.Analytics.Synapse.Artifacts.Models.SparkJobType? jobType = default(Azure.Analytics.Synapse.Artifacts.Models.SparkJobType?), Azure.Analytics.Synapse.Artifacts.Models.SparkBatchJobResultType? result = default(Azure.Analytics.Synapse.Artifacts.Models.SparkBatchJobResultType?), Azure.Analytics.Synapse.Artifacts.Models.SparkScheduler scheduler = null, Azure.Analytics.Synapse.Artifacts.Models.SparkServicePlugin plugin = null, System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IReadOnlyDictionary tags = null, int id = 0, string appId = null, System.Collections.Generic.IReadOnlyDictionary appInfo = null, Azure.Analytics.Synapse.Artifacts.Models.LivyStates? state = default(Azure.Analytics.Synapse.Artifacts.Models.LivyStates?), System.Collections.Generic.IEnumerable logLines = null) { throw null; } public static Azure.Analytics.Synapse.Artifacts.Models.SparkBatchJobState SparkBatchJobState(System.DateTimeOffset? notStartedAt = default(System.DateTimeOffset?), System.DateTimeOffset? startingAt = default(System.DateTimeOffset?), System.DateTimeOffset? runningAt = default(System.DateTimeOffset?), System.DateTimeOffset? deadAt = default(System.DateTimeOffset?), System.DateTimeOffset? successAt = default(System.DateTimeOffset?), System.DateTimeOffset? terminatedAt = default(System.DateTimeOffset?), System.DateTimeOffset? recoveringAt = default(System.DateTimeOffset?), string currentState = null, Azure.Analytics.Synapse.Artifacts.Models.SparkRequest jobCreationRequest = null) { throw null; } @@ -1455,7 +1455,7 @@ public partial class AzureBlobStorageReadSettings : Azure.Analytics.Synapse.Arti { public AzureBlobStorageReadSettings() { } public object DeleteFilesAfterCompletion { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object FileListPath { get { throw null; } set { } } public object ModifiedDatetimeEnd { get { throw null; } set { } } public object ModifiedDatetimeStart { get { throw null; } set { } } @@ -1664,7 +1664,7 @@ public partial class AzureFileStorageReadSettings : Azure.Analytics.Synapse.Arti { public AzureFileStorageReadSettings() { } public object DeleteFilesAfterCompletion { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object FileListPath { get { throw null; } set { } } public object ModifiedDatetimeEnd { get { throw null; } set { } } public object ModifiedDatetimeStart { get { throw null; } set { } } @@ -1946,7 +1946,7 @@ public AzureSqlSink() { } public object PreCopyScript { get { throw null; } set { } } public object SqlWriterStoredProcedureName { get { throw null; } set { } } public object SqlWriterTableType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } public object StoredProcedureTableTypeParameterName { get { throw null; } set { } } public object TableOption { get { throw null; } set { } } } @@ -1959,7 +1959,7 @@ public AzureSqlSource() { } public object ProduceAdditionalTypes { get { throw null; } set { } } public object SqlReaderQuery { get { throw null; } set { } } public object SqlReaderStoredProcedureName { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } } public partial class AzureSqlTableDataset : Azure.Analytics.Synapse.Artifacts.Models.Dataset { @@ -3372,7 +3372,7 @@ public partial class FileServerReadSettings : Azure.Analytics.Synapse.Artifacts. { public FileServerReadSettings() { } public object DeleteFilesAfterCompletion { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object FileFilter { get { throw null; } set { } } public object FileListPath { get { throw null; } set { } } public object ModifiedDatetimeEnd { get { throw null; } set { } } @@ -3464,11 +3464,11 @@ public partial class FtpReadSettings : Azure.Analytics.Synapse.Artifacts.Models. public FtpReadSettings() { } public object DeleteFilesAfterCompletion { get { throw null; } set { } } public object DisableChunking { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object FileListPath { get { throw null; } set { } } public object PartitionRootPath { get { throw null; } set { } } public object Recursive { get { throw null; } set { } } - public bool? UseBinaryTransfer { get { throw null; } set { } } + public object UseBinaryTransfer { get { throw null; } set { } } public object WildcardFileName { get { throw null; } set { } } public object WildcardFolderPath { get { throw null; } set { } } } @@ -3627,7 +3627,7 @@ public partial class GoogleCloudStorageReadSettings : Azure.Analytics.Synapse.Ar { public GoogleCloudStorageReadSettings() { } public object DeleteFilesAfterCompletion { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object FileListPath { get { throw null; } set { } } public object ModifiedDatetimeEnd { get { throw null; } set { } } public object ModifiedDatetimeStart { get { throw null; } set { } } @@ -3723,7 +3723,7 @@ public partial class HdfsReadSettings : Azure.Analytics.Synapse.Artifacts.Models public HdfsReadSettings() { } public object DeleteFilesAfterCompletion { get { throw null; } set { } } public Azure.Analytics.Synapse.Artifacts.Models.DistcpSettings DistcpSettings { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object FileListPath { get { throw null; } set { } } public object ModifiedDatetimeEnd { get { throw null; } set { } } public object ModifiedDatetimeStart { get { throw null; } set { } } @@ -4006,8 +4006,9 @@ public HttpLinkedService(object url) { } public partial class HttpReadSettings : Azure.Analytics.Synapse.Artifacts.Models.StoreReadSettings { public HttpReadSettings() { } + public object AdditionalColumns { get { throw null; } set { } } public object AdditionalHeaders { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object PartitionRootPath { get { throw null; } set { } } public object RequestBody { get { throw null; } set { } } public object RequestMethod { get { throw null; } set { } } @@ -6113,7 +6114,7 @@ internal RunNotebookResult() { } public string RunId { get { throw null; } } public string RunStatus { get { throw null; } } public object SessionDetail { get { throw null; } } - public long? SessionId { get { throw null; } } + public string SessionId { get { throw null; } } public string SparkPool { get { throw null; } } } public partial class RunNotebookSnapshot @@ -6125,7 +6126,7 @@ internal RunNotebookSnapshot() { } public string Notebook { get { throw null; } } public Azure.Analytics.Synapse.Artifacts.Models.NotebookResource NotebookContent { get { throw null; } } public System.Collections.Generic.IReadOnlyDictionary Parameters { get { throw null; } } - public long? SessionId { get { throw null; } } + public string SessionId { get { throw null; } } public Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSparkSessionOptions SessionOptions { get { throw null; } } public string SparkPool { get { throw null; } } } @@ -6142,7 +6143,7 @@ internal RunNotebookSnapshotResult() { } public string LastCheckedOn { get { throw null; } } public string RunId { get { throw null; } } public string RunStatus { get { throw null; } } - public long? SessionId { get { throw null; } } + public string SessionId { get { throw null; } } public Azure.Analytics.Synapse.Artifacts.Models.RunNotebookSnapshot Snapshot { get { throw null; } } public string SparkPool { get { throw null; } } } @@ -6477,25 +6478,6 @@ public SapHanaLinkedService(object server) { } public object Server { get { throw null; } set { } } public object UserName { get { throw null; } set { } } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct SapHanaPartitionOption : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public SapHanaPartitionOption(string value) { throw null; } - public static Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption None { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption PhysicalPartitionsOfTable { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption SapHanaDynamicRange { get { throw null; } } - public bool Equals(Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption 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.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption left, Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption right) { throw null; } - public static implicit operator Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption (string value) { throw null; } - public static bool operator !=(Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption left, Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption right) { throw null; } - public override string ToString() { throw null; } - } public partial class SapHanaPartitionSettings { public SapHanaPartitionSettings() { } @@ -6505,7 +6487,7 @@ public partial class SapHanaSource : Azure.Analytics.Synapse.Artifacts.Models.Ta { public SapHanaSource() { } public object PacketSize { get { throw null; } set { } } - public Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionOption? PartitionOption { get { throw null; } set { } } + public object PartitionOption { get { throw null; } set { } } public Azure.Analytics.Synapse.Artifacts.Models.SapHanaPartitionSettings PartitionSettings { get { throw null; } set { } } public object Query { get { throw null; } set { } } } @@ -6601,28 +6583,6 @@ public SapTableLinkedService() { } public object SystemNumber { get { throw null; } set { } } public object UserName { get { throw null; } set { } } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct SapTablePartitionOption : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public SapTablePartitionOption(string value) { throw null; } - public static Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption None { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption PartitionOnCalendarDate { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption PartitionOnCalendarMonth { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption PartitionOnCalendarYear { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption PartitionOnInt { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption PartitionOnTime { get { throw null; } } - public bool Equals(Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption 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.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption left, Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption right) { throw null; } - public static implicit operator Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption (string value) { throw null; } - public static bool operator !=(Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption left, Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption right) { throw null; } - public override string ToString() { throw null; } - } public partial class SapTablePartitionSettings { public SapTablePartitionSettings() { } @@ -6641,7 +6601,7 @@ public partial class SapTableSource : Azure.Analytics.Synapse.Artifacts.Models.T public SapTableSource() { } public object BatchSize { get { throw null; } set { } } public object CustomRfcReadTableFunctionModule { get { throw null; } set { } } - public Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionOption? PartitionOption { get { throw null; } set { } } + public object PartitionOption { get { throw null; } set { } } public Azure.Analytics.Synapse.Artifacts.Models.SapTablePartitionSettings PartitionSettings { get { throw null; } set { } } public object RfcTableFields { get { throw null; } set { } } public object RfcTableOptions { get { throw null; } set { } } @@ -6696,6 +6656,7 @@ public partial class ScriptActivity : Azure.Analytics.Synapse.Artifacts.Models.E { public ScriptActivity(string name) : base (default(string)) { } public Azure.Analytics.Synapse.Artifacts.Models.ScriptActivityTypePropertiesLogSettings LogSettings { get { throw null; } set { } } + public object ScriptBlockExecutionTimeout { get { throw null; } set { } } public System.Collections.Generic.IList Scripts { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -6906,7 +6867,7 @@ public partial class SftpReadSettings : Azure.Analytics.Synapse.Artifacts.Models public SftpReadSettings() { } public object DeleteFilesAfterCompletion { get { throw null; } set { } } public object DisableChunking { get { throw null; } set { } } - public bool? EnablePartitionDiscovery { get { throw null; } set { } } + public object EnablePartitionDiscovery { get { throw null; } set { } } public object FileListPath { get { throw null; } set { } } public object ModifiedDatetimeEnd { get { throw null; } set { } } public object ModifiedDatetimeStart { get { throw null; } set { } } @@ -7439,7 +7400,7 @@ public SqlMISink() { } public object PreCopyScript { get { throw null; } set { } } public object SqlWriterStoredProcedureName { get { throw null; } set { } } public object SqlWriterTableType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } public object StoredProcedureTableTypeParameterName { get { throw null; } set { } } public object TableOption { get { throw null; } set { } } } @@ -7452,7 +7413,7 @@ public SqlMISource() { } public object ProduceAdditionalTypes { get { throw null; } set { } } public object SqlReaderQuery { get { throw null; } set { } } public object SqlReaderStoredProcedureName { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } } public partial class SqlPartitionSettings { @@ -7509,7 +7470,7 @@ public partial class SqlPoolStoredProcedureActivity : Azure.Analytics.Synapse.Ar public SqlPoolStoredProcedureActivity(string name, Azure.Analytics.Synapse.Artifacts.Models.SqlPoolReference sqlPool, object storedProcedureName) : base (default(string)) { } public Azure.Analytics.Synapse.Artifacts.Models.SqlPoolReference SqlPool { get { throw null; } set { } } public object StoredProcedureName { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } } public partial class SqlScript { @@ -7581,7 +7542,7 @@ public SqlServerSink() { } public object PreCopyScript { get { throw null; } set { } } public object SqlWriterStoredProcedureName { get { throw null; } set { } } public object SqlWriterTableType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } public object StoredProcedureTableTypeParameterName { get { throw null; } set { } } public object TableOption { get { throw null; } set { } } } @@ -7594,7 +7555,7 @@ public SqlServerSource() { } public object ProduceAdditionalTypes { get { throw null; } set { } } public object SqlReaderQuery { get { throw null; } set { } } public object SqlReaderStoredProcedureName { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } } public partial class SqlServerStoredProcedureActivity : Azure.Analytics.Synapse.Artifacts.Models.ExecutionActivity { @@ -7615,7 +7576,7 @@ public SqlSink() { } public object PreCopyScript { get { throw null; } set { } } public object SqlWriterStoredProcedureName { get { throw null; } set { } } public object SqlWriterTableType { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } public object StoredProcedureTableTypeParameterName { get { throw null; } set { } } public object TableOption { get { throw null; } set { } } } @@ -7627,7 +7588,7 @@ public SqlSource() { } public Azure.Analytics.Synapse.Artifacts.Models.SqlPartitionSettings PartitionSettings { get { throw null; } set { } } public object SqlReaderQuery { get { throw null; } set { } } public object SqlReaderStoredProcedureName { get { throw null; } set { } } - public System.Collections.Generic.IDictionary StoredProcedureParameters { get { throw null; } } + public object StoredProcedureParameters { get { throw null; } set { } } } public partial class SquareLinkedService : Azure.Analytics.Synapse.Artifacts.Models.LinkedService { @@ -7777,35 +7738,6 @@ public partial class StartDataFlowDebugSessionResponse public StartDataFlowDebugSessionResponse() { } public string JobVersion { get { throw null; } set { } } } - public partial class StoredProcedureParameter - { - public StoredProcedureParameter() { } - public Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType? Type { get { throw null; } set { } } - public object Value { get { throw null; } set { } } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct StoredProcedureParameterType : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public StoredProcedureParameterType(string value) { throw null; } - public static Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType Boolean { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType Date { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType Decimal { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType Guid { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType Int { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType Int64 { get { throw null; } } - public static Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType String { get { throw null; } } - public bool Equals(Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType 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.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType left, Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType right) { throw null; } - public static implicit operator Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType (string value) { throw null; } - public static bool operator !=(Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType left, Azure.Analytics.Synapse.Artifacts.Models.StoredProcedureParameterType right) { throw null; } - public override string ToString() { throw null; } - } public partial class StoreReadSettings { public StoreReadSettings() { } @@ -8348,7 +8280,7 @@ public WebActivityAuthentication(string type) { } public Azure.Analytics.Synapse.Artifacts.Models.SecretBase Pfx { get { throw null; } set { } } public object Resource { get { throw null; } set { } } public string Type { get { throw null; } set { } } - public string Username { get { throw null; } set { } } + public object Username { get { throw null; } set { } } public object UserTenant { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Azure.Analytics.Synapse.Artifacts.csproj b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Azure.Analytics.Synapse.Artifacts.csproj index cb77ef41a494a..520fe9348f01d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Azure.Analytics.Synapse.Artifacts.csproj +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Azure.Analytics.Synapse.Artifacts.csproj @@ -2,7 +2,7 @@ This is the Microsoft Azure Synapse Analytics Artifacts client library Azure.Analytics.Synapse.Artifacts - 1.0.0-preview.19 + 1.0.0-preview.20 Microsoft Azure Synapse Artifacts;$(PackageCommonTags) true $(RequiredTargetFrameworks) diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/AnalyticsSynapseArtifactsModelFactory.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/AnalyticsSynapseArtifactsModelFactory.cs index e3248d6c230dd..ce62bb82a2063 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/AnalyticsSynapseArtifactsModelFactory.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/AnalyticsSynapseArtifactsModelFactory.cs @@ -121,7 +121,7 @@ public static RunNotebookResponse RunNotebookResponse(string message = null, Run /// Output of exit command. /// Run notebook error. /// A new instance for mocking. - public static RunNotebookResult RunNotebookResult(string runId = null, string runStatus = null, string lastCheckedOn = null, long? sessionId = null, string sparkPool = null, object sessionDetail = null, string exitValue = null, RunNotebookError error = null) + public static RunNotebookResult RunNotebookResult(string runId = null, string runStatus = null, string lastCheckedOn = null, string sessionId = null, string sparkPool = null, object sessionDetail = null, string exitValue = null, RunNotebookError error = null) { return new RunNotebookResult(runId, runStatus, lastCheckedOn, sessionId, sparkPool, sessionDetail, exitValue, error); } @@ -156,7 +156,7 @@ public static RunNotebookSnapshotResponse RunNotebookSnapshotResponse(string mes /// Livy session id. /// SparkPool name. /// A new instance for mocking. - public static RunNotebookSnapshotResult RunNotebookSnapshotResult(RunNotebookSnapshot snapshot = null, RunNotebookError error = null, string runId = null, string runStatus = null, string lastCheckedOn = null, long? sessionId = null, string sparkPool = null) + public static RunNotebookSnapshotResult RunNotebookSnapshotResult(RunNotebookSnapshot snapshot = null, RunNotebookError error = null, string runId = null, string runStatus = null, string lastCheckedOn = null, string sessionId = null, string sparkPool = null) { return new RunNotebookSnapshotResult(snapshot, error, runId, runStatus, lastCheckedOn, sessionId, sparkPool); } @@ -172,7 +172,7 @@ public static RunNotebookSnapshotResult RunNotebookSnapshotResult(RunNotebookSna /// Run notebook parameters. /// Notebook resource type. /// A new instance for mocking. - public static RunNotebookSnapshot RunNotebookSnapshot(string exitValue = null, string id = null, string notebook = null, RunNotebookSparkSessionOptions sessionOptions = null, bool? honorSessionTimeToLive = null, long? sessionId = null, string sparkPool = null, IReadOnlyDictionary parameters = null, NotebookResource notebookContent = null) + public static RunNotebookSnapshot RunNotebookSnapshot(string exitValue = null, string id = null, string notebook = null, RunNotebookSparkSessionOptions sessionOptions = null, bool? honorSessionTimeToLive = null, string sessionId = null, string sparkPool = null, IReadOnlyDictionary parameters = null, NotebookResource notebookContent = null) { parameters ??= new Dictionary(); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/BigDataPoolsClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/BigDataPoolsClient.cs index 3e077512416f2..774062c6ebd6e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/BigDataPoolsClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/BigDataPoolsClient.cs @@ -28,7 +28,7 @@ protected BigDataPoolsClient() } /// Initializes a new instance of BigDataPoolsClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public BigDataPoolsClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public BigDataPoolsClient(Uri endpoint, TokenCredential credential, ArtifactsCli /// Initializes a new instance of BigDataPoolsClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal BigDataPoolsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/BigDataPoolsRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/BigDataPoolsRestClient.cs index e0042a1d0e495..91cf8e6d165d6 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/BigDataPoolsRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/BigDataPoolsRestClient.cs @@ -27,7 +27,7 @@ internal partial class BigDataPoolsRestClient /// Initializes a new instance of BigDataPoolsRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public BigDataPoolsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowClient.cs index ace097ea164d9..7a8bdcd5f4e30 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowClient.cs @@ -29,7 +29,7 @@ protected DataFlowClient() } /// Initializes a new instance of DataFlowClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public DataFlowClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public DataFlowClient(Uri endpoint, TokenCredential credential, ArtifactsClientO /// Initializes a new instance of DataFlowClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal DataFlowClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowDebugSessionClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowDebugSessionClient.cs index 967f20654897d..d70b92c6a775c 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowDebugSessionClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowDebugSessionClient.cs @@ -29,7 +29,7 @@ protected DataFlowDebugSessionClient() } /// Initializes a new instance of DataFlowDebugSessionClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public DataFlowDebugSessionClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public DataFlowDebugSessionClient(Uri endpoint, TokenCredential credential, Arti /// Initializes a new instance of DataFlowDebugSessionClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal DataFlowDebugSessionClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowDebugSessionRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowDebugSessionRestClient.cs index a316913378e1f..ad5e20dc5cabe 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowDebugSessionRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowDebugSessionRestClient.cs @@ -27,7 +27,7 @@ internal partial class DataFlowDebugSessionRestClient /// Initializes a new instance of DataFlowDebugSessionRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public DataFlowDebugSessionRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowRestClient.cs index be865af636c81..b8856536b944e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DataFlowRestClient.cs @@ -27,7 +27,7 @@ internal partial class DataFlowRestClient /// Initializes a new instance of DataFlowRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public DataFlowRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DatasetClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DatasetClient.cs index 0b33038d92754..b3d1a54976b18 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DatasetClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DatasetClient.cs @@ -29,7 +29,7 @@ protected DatasetClient() } /// Initializes a new instance of DatasetClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public DatasetClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public DatasetClient(Uri endpoint, TokenCredential credential, ArtifactsClientOp /// Initializes a new instance of DatasetClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal DatasetClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DatasetRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DatasetRestClient.cs index 4e9f4e459d7a3..9d6c46653709e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DatasetRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/DatasetRestClient.cs @@ -27,7 +27,7 @@ internal partial class DatasetRestClient /// Initializes a new instance of DatasetRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public DatasetRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/IntegrationRuntimesClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/IntegrationRuntimesClient.cs index d5ba571926180..1f2ba0b90a96c 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/IntegrationRuntimesClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/IntegrationRuntimesClient.cs @@ -28,7 +28,7 @@ protected IntegrationRuntimesClient() } /// Initializes a new instance of IntegrationRuntimesClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public IntegrationRuntimesClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public IntegrationRuntimesClient(Uri endpoint, TokenCredential credential, Artif /// Initializes a new instance of IntegrationRuntimesClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal IntegrationRuntimesClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/IntegrationRuntimesRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/IntegrationRuntimesRestClient.cs index d4c6e6d934948..4711dc5b60d25 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/IntegrationRuntimesRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/IntegrationRuntimesRestClient.cs @@ -27,7 +27,7 @@ internal partial class IntegrationRuntimesRestClient /// Initializes a new instance of IntegrationRuntimesRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public IntegrationRuntimesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptClient.cs index 56836a5ab2d74..c284a922f8eb4 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptClient.cs @@ -28,7 +28,7 @@ protected KqlScriptClient() } /// Initializes a new instance of KqlScriptClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public KqlScriptClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public KqlScriptClient(Uri endpoint, TokenCredential credential, ArtifactsClient /// Initializes a new instance of KqlScriptClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal KqlScriptClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptRestClient.cs index a641ef9ffb8bb..fa272fc6ef918 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptRestClient.cs @@ -27,7 +27,7 @@ internal partial class KqlScriptRestClient /// Initializes a new instance of KqlScriptRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public KqlScriptRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptsClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptsClient.cs index 939a1ab7415a5..2ff5f5a79e682 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptsClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptsClient.cs @@ -28,7 +28,7 @@ protected KqlScriptsClient() } /// Initializes a new instance of KqlScriptsClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public KqlScriptsClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public KqlScriptsClient(Uri endpoint, TokenCredential credential, ArtifactsClien /// Initializes a new instance of KqlScriptsClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal KqlScriptsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptsRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptsRestClient.cs index 5d41ff307e71e..cfebdf16c91d9 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptsRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/KqlScriptsRestClient.cs @@ -27,7 +27,7 @@ internal partial class KqlScriptsRestClient /// Initializes a new instance of KqlScriptsRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public KqlScriptsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LibraryClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LibraryClient.cs index c24a89bb46769..88b01a7ad8edf 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LibraryClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LibraryClient.cs @@ -30,7 +30,7 @@ protected LibraryClient() } /// Initializes a new instance of LibraryClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public LibraryClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -54,7 +54,7 @@ public LibraryClient(Uri endpoint, TokenCredential credential, ArtifactsClientOp /// Initializes a new instance of LibraryClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal LibraryClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LibraryRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LibraryRestClient.cs index 3630fc4f66068..986335a8d025d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LibraryRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LibraryRestClient.cs @@ -28,7 +28,7 @@ internal partial class LibraryRestClient /// Initializes a new instance of LibraryRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public LibraryRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkConnectionClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkConnectionClient.cs index 745988db0a771..c0a4317c163bd 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkConnectionClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkConnectionClient.cs @@ -29,7 +29,7 @@ protected LinkConnectionClient() } /// Initializes a new instance of LinkConnectionClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public LinkConnectionClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public LinkConnectionClient(Uri endpoint, TokenCredential credential, ArtifactsC /// Initializes a new instance of LinkConnectionClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal LinkConnectionClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkConnectionRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkConnectionRestClient.cs index 260f7f8e15aa2..80134ea9f436b 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkConnectionRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkConnectionRestClient.cs @@ -27,7 +27,7 @@ internal partial class LinkConnectionRestClient /// Initializes a new instance of LinkConnectionRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public LinkConnectionRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkedServiceClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkedServiceClient.cs index 0d1ae21168cfd..73ff15ac8c07c 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkedServiceClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkedServiceClient.cs @@ -29,7 +29,7 @@ protected LinkedServiceClient() } /// Initializes a new instance of LinkedServiceClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public LinkedServiceClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public LinkedServiceClient(Uri endpoint, TokenCredential credential, ArtifactsCl /// Initializes a new instance of LinkedServiceClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal LinkedServiceClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkedServiceRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkedServiceRestClient.cs index e7a2d12b56690..0138763a630c9 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkedServiceRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/LinkedServiceRestClient.cs @@ -27,7 +27,7 @@ internal partial class LinkedServiceRestClient /// Initializes a new instance of LinkedServiceRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public LinkedServiceRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/MetastoreClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/MetastoreClient.cs index 07725b064f577..a287350d22a00 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/MetastoreClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/MetastoreClient.cs @@ -28,7 +28,7 @@ protected MetastoreClient() } /// Initializes a new instance of MetastoreClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public MetastoreClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public MetastoreClient(Uri endpoint, TokenCredential credential, ArtifactsClient /// Initializes a new instance of MetastoreClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal MetastoreClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/MetastoreRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/MetastoreRestClient.cs index cf3381af66054..dfdc8d0c10763 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/MetastoreRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/MetastoreRestClient.cs @@ -27,7 +27,7 @@ internal partial class MetastoreRestClient /// Initializes a new instance of MetastoreRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public MetastoreRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonRdsForSqlServerSource.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonRdsForSqlServerSource.Serialization.cs index 6e2cd87b304f3..ea0c2094483b7 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonRdsForSqlServerSource.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonRdsForSqlServerSource.Serialization.cs @@ -29,16 +29,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sqlReaderStoredProcedureName"u8); writer.WriteObjectValue(SqlReaderStoredProcedureName); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(IsolationLevel)) { @@ -103,7 +97,7 @@ internal static AmazonRdsForSqlServerSource DeserializeAmazonRdsForSqlServerSour } Optional sqlReaderQuery = default; Optional sqlReaderStoredProcedureName = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional isolationLevel = default; Optional produceAdditionalTypes = default; Optional partitionOption = default; @@ -142,12 +136,7 @@ internal static AmazonRdsForSqlServerSource DeserializeAmazonRdsForSqlServerSour { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("isolationLevel"u8)) @@ -239,7 +228,7 @@ internal static AmazonRdsForSqlServerSource DeserializeAmazonRdsForSqlServerSour additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new AmazonRdsForSqlServerSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, Optional.ToDictionary(storedProcedureParameters), isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); + return new AmazonRdsForSqlServerSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, storedProcedureParameters.Value, isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); } internal partial class AmazonRdsForSqlServerSourceConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonRdsForSqlServerSource.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonRdsForSqlServerSource.cs index 7b57da5976686..76d5a405654dc 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonRdsForSqlServerSource.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonRdsForSqlServerSource.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class AmazonRdsForSqlServerSource : TabularSource /// Initializes a new instance of AmazonRdsForSqlServerSource. public AmazonRdsForSqlServerSource() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "AmazonRdsForSqlServerSource"; } @@ -35,7 +33,7 @@ public AmazonRdsForSqlServerSource() /// Which additional types to produce. /// The partition mechanism that will be used for Sql read in parallel. Possible values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". /// The settings that will be leveraged for Sql source partitioning. - internal AmazonRdsForSqlServerSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, IDictionary storedProcedureParameters, object isolationLevel, object produceAdditionalTypes, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) + internal AmazonRdsForSqlServerSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, object storedProcedureParameters, object isolationLevel, object produceAdditionalTypes, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) { SqlReaderQuery = sqlReaderQuery; SqlReaderStoredProcedureName = sqlReaderStoredProcedureName; @@ -52,7 +50,7 @@ internal AmazonRdsForSqlServerSource(string type, object sourceRetryCount, objec /// Name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). public object SqlReaderStoredProcedureName { get; set; } /// Value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// Specifies the transaction locking behavior for the SQL source. Allowed values: ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: string (or Expression with resultType string). public object IsolationLevel { get; set; } /// Which additional types to produce. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonS3ReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonS3ReadSettings.Serialization.cs index adf3207bb7de1..3bd965abf4657 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonS3ReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonS3ReadSettings.Serialization.cs @@ -47,7 +47,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { @@ -95,7 +95,7 @@ internal static AmazonS3ReadSettings DeserializeAmazonS3ReadSettings(JsonElement Optional wildcardFileName = default; Optional prefix = default; Optional fileListPath = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; Optional deleteFilesAfterCompletion = default; Optional modifiedDatetimeStart = default; @@ -157,7 +157,7 @@ internal static AmazonS3ReadSettings DeserializeAmazonS3ReadSettings(JsonElement { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -213,7 +213,7 @@ internal static AmazonS3ReadSettings DeserializeAmazonS3ReadSettings(JsonElement additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new AmazonS3ReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); + return new AmazonS3ReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } internal partial class AmazonS3ReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonS3ReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonS3ReadSettings.cs index 32765462f1180..9d3e8ae8a5639 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonS3ReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AmazonS3ReadSettings.cs @@ -27,12 +27,12 @@ public AmazonS3ReadSettings() /// AmazonS3 wildcardFileName. Type: string (or Expression with resultType string). /// The prefix filter for the S3 object name. Type: string (or Expression with resultType string). /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). /// The start of file's modified datetime. Type: string (or Expression with resultType string). /// The end of file's modified datetime. Type: string (or Expression with resultType string). - internal AmazonS3ReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object prefix, object fileListPath, bool? enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd) : base(type, maxConcurrentConnections, additionalProperties) + internal AmazonS3ReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object prefix, object fileListPath, object enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; @@ -57,8 +57,8 @@ internal AmazonS3ReadSettings(string type, object maxConcurrentConnections, IDic public object Prefix { get; set; } /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). public object FileListPath { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureBlobStorageReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureBlobStorageReadSettings.Serialization.cs index bca967b138d31..922b778b5b264 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureBlobStorageReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureBlobStorageReadSettings.Serialization.cs @@ -47,7 +47,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { @@ -95,7 +95,7 @@ internal static AzureBlobStorageReadSettings DeserializeAzureBlobStorageReadSett Optional wildcardFileName = default; Optional prefix = default; Optional fileListPath = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; Optional deleteFilesAfterCompletion = default; Optional modifiedDatetimeStart = default; @@ -157,7 +157,7 @@ internal static AzureBlobStorageReadSettings DeserializeAzureBlobStorageReadSett { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -213,7 +213,7 @@ internal static AzureBlobStorageReadSettings DeserializeAzureBlobStorageReadSett additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new AzureBlobStorageReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); + return new AzureBlobStorageReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } internal partial class AzureBlobStorageReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureBlobStorageReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureBlobStorageReadSettings.cs index abbc23c5cbb59..ea9ad0333bb78 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureBlobStorageReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureBlobStorageReadSettings.cs @@ -27,12 +27,12 @@ public AzureBlobStorageReadSettings() /// Azure blob wildcardFileName. Type: string (or Expression with resultType string). /// The prefix filter for the Azure Blob name. Type: string (or Expression with resultType string). /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). /// The start of file's modified datetime. Type: string (or Expression with resultType string). /// The end of file's modified datetime. Type: string (or Expression with resultType string). - internal AzureBlobStorageReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object prefix, object fileListPath, bool? enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd) : base(type, maxConcurrentConnections, additionalProperties) + internal AzureBlobStorageReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object prefix, object fileListPath, object enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; @@ -57,8 +57,8 @@ internal AzureBlobStorageReadSettings(string type, object maxConcurrentConnectio public object Prefix { get; set; } /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). public object FileListPath { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureFileStorageReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureFileStorageReadSettings.Serialization.cs index cf1a9e2d0d8be..a29b018108065 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureFileStorageReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureFileStorageReadSettings.Serialization.cs @@ -47,7 +47,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { @@ -95,7 +95,7 @@ internal static AzureFileStorageReadSettings DeserializeAzureFileStorageReadSett Optional wildcardFileName = default; Optional prefix = default; Optional fileListPath = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; Optional deleteFilesAfterCompletion = default; Optional modifiedDatetimeStart = default; @@ -157,7 +157,7 @@ internal static AzureFileStorageReadSettings DeserializeAzureFileStorageReadSett { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -213,7 +213,7 @@ internal static AzureFileStorageReadSettings DeserializeAzureFileStorageReadSett additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new AzureFileStorageReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); + return new AzureFileStorageReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } internal partial class AzureFileStorageReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureFileStorageReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureFileStorageReadSettings.cs index 777d07910405a..4c86c12216e51 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureFileStorageReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureFileStorageReadSettings.cs @@ -27,12 +27,12 @@ public AzureFileStorageReadSettings() /// Azure File Storage wildcardFileName. Type: string (or Expression with resultType string). /// The prefix filter for the Azure File name starting from root path. Type: string (or Expression with resultType string). /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). /// The start of file's modified datetime. Type: string (or Expression with resultType string). /// The end of file's modified datetime. Type: string (or Expression with resultType string). - internal AzureFileStorageReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object prefix, object fileListPath, bool? enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd) : base(type, maxConcurrentConnections, additionalProperties) + internal AzureFileStorageReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object prefix, object fileListPath, object enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; @@ -57,8 +57,8 @@ internal AzureFileStorageReadSettings(string type, object maxConcurrentConnectio public object Prefix { get; set; } /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). public object FileListPath { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSink.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSink.Serialization.cs index 67962e12af33a..b280aa77198b2 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSink.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSink.Serialization.cs @@ -34,16 +34,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("preCopyScript"u8); writer.WriteObjectValue(PreCopyScript); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(StoredProcedureTableTypeParameterName)) { @@ -99,7 +93,7 @@ internal static AzureSqlSink DeserializeAzureSqlSink(JsonElement element) Optional sqlWriterStoredProcedureName = default; Optional sqlWriterTableType = default; Optional preCopyScript = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional storedProcedureTableTypeParameterName = default; Optional tableOption = default; string type = default; @@ -145,12 +139,7 @@ internal static AzureSqlSink DeserializeAzureSqlSink(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("storedProcedureTableTypeParameterName"u8)) @@ -224,7 +213,7 @@ internal static AzureSqlSink DeserializeAzureSqlSink(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new AzureSqlSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, Optional.ToDictionary(storedProcedureParameters), storedProcedureTableTypeParameterName.Value, tableOption.Value); + return new AzureSqlSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, storedProcedureParameters.Value, storedProcedureTableTypeParameterName.Value, tableOption.Value); } internal partial class AzureSqlSinkConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSink.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSink.cs index 998b55ab59d89..a12c21e3c5af4 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSink.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSink.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class AzureSqlSink : CopySink /// Initializes a new instance of AzureSqlSink. public AzureSqlSink() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "AzureSqlSink"; } @@ -34,7 +32,7 @@ public AzureSqlSink() /// SQL stored procedure parameters. /// The stored procedure parameter name of the table type. Type: string (or Expression with resultType string). /// The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string). - internal AzureSqlSink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object sqlWriterStoredProcedureName, object sqlWriterTableType, object preCopyScript, IDictionary storedProcedureParameters, object storedProcedureTableTypeParameterName, object tableOption) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) + internal AzureSqlSink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object sqlWriterStoredProcedureName, object sqlWriterTableType, object preCopyScript, object storedProcedureParameters, object storedProcedureTableTypeParameterName, object tableOption) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) { SqlWriterStoredProcedureName = sqlWriterStoredProcedureName; SqlWriterTableType = sqlWriterTableType; @@ -52,7 +50,7 @@ internal AzureSqlSink(string type, object writeBatchSize, object writeBatchTimeo /// SQL pre-copy script. Type: string (or Expression with resultType string). public object PreCopyScript { get; set; } /// SQL stored procedure parameters. - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// The stored procedure parameter name of the table type. Type: string (or Expression with resultType string). public object StoredProcedureTableTypeParameterName { get; set; } /// The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSource.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSource.Serialization.cs index 22f5f01b78f6f..1e5720622c5fd 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSource.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSource.Serialization.cs @@ -29,16 +29,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sqlReaderStoredProcedureName"u8); writer.WriteObjectValue(SqlReaderStoredProcedureName); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(IsolationLevel)) { @@ -103,7 +97,7 @@ internal static AzureSqlSource DeserializeAzureSqlSource(JsonElement element) } Optional sqlReaderQuery = default; Optional sqlReaderStoredProcedureName = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional isolationLevel = default; Optional produceAdditionalTypes = default; Optional partitionOption = default; @@ -142,12 +136,7 @@ internal static AzureSqlSource DeserializeAzureSqlSource(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("isolationLevel"u8)) @@ -239,7 +228,7 @@ internal static AzureSqlSource DeserializeAzureSqlSource(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new AzureSqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, Optional.ToDictionary(storedProcedureParameters), isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); + return new AzureSqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, storedProcedureParameters.Value, isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); } internal partial class AzureSqlSourceConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSource.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSource.cs index e357a5178ebf8..f00b20a1670ad 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSource.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/AzureSqlSource.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class AzureSqlSource : TabularSource /// Initializes a new instance of AzureSqlSource. public AzureSqlSource() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "AzureSqlSource"; } @@ -35,7 +33,7 @@ public AzureSqlSource() /// Which additional types to produce. /// The partition mechanism that will be used for Sql read in parallel. Possible values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". /// The settings that will be leveraged for Sql source partitioning. - internal AzureSqlSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, IDictionary storedProcedureParameters, object isolationLevel, object produceAdditionalTypes, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) + internal AzureSqlSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, object storedProcedureParameters, object isolationLevel, object produceAdditionalTypes, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) { SqlReaderQuery = sqlReaderQuery; SqlReaderStoredProcedureName = sqlReaderStoredProcedureName; @@ -52,7 +50,7 @@ internal AzureSqlSource(string type, object sourceRetryCount, object sourceRetry /// Name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). public object SqlReaderStoredProcedureName { get; set; } /// Value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// Specifies the transaction locking behavior for the SQL source. Allowed values: ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: string (or Expression with resultType string). public object IsolationLevel { get; set; } /// Which additional types to produce. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.Serialization.cs index 72f8469764fa4..8405bef18d6dc 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.Serialization.cs @@ -42,7 +42,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { @@ -94,7 +94,7 @@ internal static FileServerReadSettings DeserializeFileServerReadSettings(JsonEle Optional wildcardFolderPath = default; Optional wildcardFileName = default; Optional fileListPath = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; Optional deleteFilesAfterCompletion = default; Optional modifiedDatetimeStart = default; @@ -148,7 +148,7 @@ internal static FileServerReadSettings DeserializeFileServerReadSettings(JsonEle { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -213,7 +213,7 @@ internal static FileServerReadSettings DeserializeFileServerReadSettings(JsonEle additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new FileServerReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, fileListPath.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, fileFilter.Value); + return new FileServerReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, fileFilter.Value); } internal partial class FileServerReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.cs index 3dca4693f92e3..a88e1f2e5b569 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.cs @@ -26,13 +26,13 @@ public FileServerReadSettings() /// FileServer wildcardFolderPath. Type: string (or Expression with resultType string). /// FileServer wildcardFileName. Type: string (or Expression with resultType string). /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). /// The start of file's modified datetime. Type: string (or Expression with resultType string). /// The end of file's modified datetime. Type: string (or Expression with resultType string). /// Specify a filter to be used to select a subset of files in the folderPath rather than all files. Type: string (or Expression with resultType string). - internal FileServerReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object fileListPath, bool? enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd, object fileFilter) : base(type, maxConcurrentConnections, additionalProperties) + internal FileServerReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object fileListPath, object enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd, object fileFilter) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; @@ -55,8 +55,8 @@ internal FileServerReadSettings(string type, object maxConcurrentConnections, ID public object WildcardFileName { get; set; } /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). public object FileListPath { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FtpReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FtpReadSettings.Serialization.cs index 88443b0adba5e..58ed08b79c483 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FtpReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FtpReadSettings.Serialization.cs @@ -37,7 +37,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { @@ -57,7 +57,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(UseBinaryTransfer)) { writer.WritePropertyName("useBinaryTransfer"u8); - writer.WriteBooleanValue(UseBinaryTransfer.Value); + writer.WriteObjectValue(UseBinaryTransfer); } if (Optional.IsDefined(DisableChunking)) { @@ -88,11 +88,11 @@ internal static FtpReadSettings DeserializeFtpReadSettings(JsonElement element) Optional recursive = default; Optional wildcardFolderPath = default; Optional wildcardFileName = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; Optional deleteFilesAfterCompletion = default; Optional fileListPath = default; - Optional useBinaryTransfer = default; + Optional useBinaryTransfer = default; Optional disableChunking = default; string type = default; Optional maxConcurrentConnections = default; @@ -133,7 +133,7 @@ internal static FtpReadSettings DeserializeFtpReadSettings(JsonElement element) { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -169,7 +169,7 @@ internal static FtpReadSettings DeserializeFtpReadSettings(JsonElement element) { continue; } - useBinaryTransfer = property.Value.GetBoolean(); + useBinaryTransfer = property.Value.GetObject(); continue; } if (property.NameEquals("disableChunking"u8)) @@ -198,7 +198,7 @@ internal static FtpReadSettings DeserializeFtpReadSettings(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new FtpReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value, deleteFilesAfterCompletion.Value, fileListPath.Value, Optional.ToNullable(useBinaryTransfer), disableChunking.Value); + return new FtpReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, fileListPath.Value, useBinaryTransfer.Value, disableChunking.Value); } internal partial class FtpReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FtpReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FtpReadSettings.cs index 3e61ef4f85571..81ad42072f89e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FtpReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FtpReadSettings.cs @@ -25,13 +25,13 @@ public FtpReadSettings() /// If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). /// Ftp wildcardFolderPath. Type: string (or Expression with resultType string). /// Ftp wildcardFileName. Type: string (or Expression with resultType string). - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). - /// Specify whether to use binary transfer mode for FTP stores. + /// Specify whether to use binary transfer mode for FTP stores. Type: boolean (or Expression with resultType boolean). /// If true, disable parallel reading within each file. Default is false. Type: boolean (or Expression with resultType boolean). - internal FtpReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, bool? enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object fileListPath, bool? useBinaryTransfer, object disableChunking) : base(type, maxConcurrentConnections, additionalProperties) + internal FtpReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object fileListPath, object useBinaryTransfer, object disableChunking) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; @@ -51,16 +51,16 @@ internal FtpReadSettings(string type, object maxConcurrentConnections, IDictiona public object WildcardFolderPath { get; set; } /// Ftp wildcardFileName. Type: string (or Expression with resultType string). public object WildcardFileName { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). public object DeleteFilesAfterCompletion { get; set; } /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). public object FileListPath { get; set; } - /// Specify whether to use binary transfer mode for FTP stores. - public bool? UseBinaryTransfer { get; set; } + /// Specify whether to use binary transfer mode for FTP stores. Type: boolean (or Expression with resultType boolean). + public object UseBinaryTransfer { get; set; } /// If true, disable parallel reading within each file. Default is false. Type: boolean (or Expression with resultType boolean). public object DisableChunking { get; set; } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/GoogleCloudStorageReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/GoogleCloudStorageReadSettings.Serialization.cs index 41dfc02937244..c910eaa8a7b40 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/GoogleCloudStorageReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/GoogleCloudStorageReadSettings.Serialization.cs @@ -47,7 +47,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { @@ -95,7 +95,7 @@ internal static GoogleCloudStorageReadSettings DeserializeGoogleCloudStorageRead Optional wildcardFileName = default; Optional prefix = default; Optional fileListPath = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; Optional deleteFilesAfterCompletion = default; Optional modifiedDatetimeStart = default; @@ -157,7 +157,7 @@ internal static GoogleCloudStorageReadSettings DeserializeGoogleCloudStorageRead { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -213,7 +213,7 @@ internal static GoogleCloudStorageReadSettings DeserializeGoogleCloudStorageRead additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new GoogleCloudStorageReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); + return new GoogleCloudStorageReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, prefix.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value); } internal partial class GoogleCloudStorageReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/GoogleCloudStorageReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/GoogleCloudStorageReadSettings.cs index 4396641329cff..e31e4cdf3e436 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/GoogleCloudStorageReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/GoogleCloudStorageReadSettings.cs @@ -27,12 +27,12 @@ public GoogleCloudStorageReadSettings() /// Google Cloud Storage wildcardFileName. Type: string (or Expression with resultType string). /// The prefix filter for the Google Cloud Storage object name. Type: string (or Expression with resultType string). /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). /// The start of file's modified datetime. Type: string (or Expression with resultType string). /// The end of file's modified datetime. Type: string (or Expression with resultType string). - internal GoogleCloudStorageReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object prefix, object fileListPath, bool? enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd) : base(type, maxConcurrentConnections, additionalProperties) + internal GoogleCloudStorageReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object prefix, object fileListPath, object enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; @@ -57,8 +57,8 @@ internal GoogleCloudStorageReadSettings(string type, object maxConcurrentConnect public object Prefix { get; set; } /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). public object FileListPath { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HdfsReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HdfsReadSettings.Serialization.cs index c09d4eb112ff4..dd610a1fd2f69 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HdfsReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HdfsReadSettings.Serialization.cs @@ -42,7 +42,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { @@ -94,7 +94,7 @@ internal static HdfsReadSettings DeserializeHdfsReadSettings(JsonElement element Optional wildcardFolderPath = default; Optional wildcardFileName = default; Optional fileListPath = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; Optional modifiedDatetimeStart = default; Optional modifiedDatetimeEnd = default; @@ -148,7 +148,7 @@ internal static HdfsReadSettings DeserializeHdfsReadSettings(JsonElement element { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -213,7 +213,7 @@ internal static HdfsReadSettings DeserializeHdfsReadSettings(JsonElement element additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new HdfsReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, fileListPath.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, distcpSettings.Value, deleteFilesAfterCompletion.Value); + return new HdfsReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, fileListPath.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, distcpSettings.Value, deleteFilesAfterCompletion.Value); } internal partial class HdfsReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HdfsReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HdfsReadSettings.cs index 4722aaafd0d65..fefd180cc0bbd 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HdfsReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HdfsReadSettings.cs @@ -26,13 +26,13 @@ public HdfsReadSettings() /// HDFS wildcardFolderPath. Type: string (or Expression with resultType string). /// HDFS wildcardFileName. Type: string (or Expression with resultType string). /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). /// The start of file's modified datetime. Type: string (or Expression with resultType string). /// The end of file's modified datetime. Type: string (or Expression with resultType string). /// Specifies Distcp-related settings. /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). - internal HdfsReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object fileListPath, bool? enablePartitionDiscovery, object partitionRootPath, object modifiedDatetimeStart, object modifiedDatetimeEnd, DistcpSettings distcpSettings, object deleteFilesAfterCompletion) : base(type, maxConcurrentConnections, additionalProperties) + internal HdfsReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object fileListPath, object enablePartitionDiscovery, object partitionRootPath, object modifiedDatetimeStart, object modifiedDatetimeEnd, DistcpSettings distcpSettings, object deleteFilesAfterCompletion) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; @@ -55,8 +55,8 @@ internal HdfsReadSettings(string type, object maxConcurrentConnections, IDiction public object WildcardFileName { get; set; } /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). public object FileListPath { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } /// The start of file's modified datetime. Type: string (or Expression with resultType string). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HttpReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HttpReadSettings.Serialization.cs index 6fc265ea21bf7..6dd25e284b479 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HttpReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HttpReadSettings.Serialization.cs @@ -42,13 +42,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { writer.WritePropertyName("partitionRootPath"u8); writer.WriteObjectValue(PartitionRootPath); } + if (Optional.IsDefined(AdditionalColumns)) + { + writer.WritePropertyName("additionalColumns"u8); + writer.WriteObjectValue(AdditionalColumns); + } writer.WritePropertyName("type"u8); writer.WriteStringValue(Type); if (Optional.IsDefined(MaxConcurrentConnections)) @@ -74,8 +79,9 @@ internal static HttpReadSettings DeserializeHttpReadSettings(JsonElement element Optional requestBody = default; Optional additionalHeaders = default; Optional requestTimeout = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; + Optional additionalColumns = default; string type = default; Optional maxConcurrentConnections = default; IDictionary additionalProperties = default; @@ -124,7 +130,7 @@ internal static HttpReadSettings DeserializeHttpReadSettings(JsonElement element { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -136,6 +142,15 @@ internal static HttpReadSettings DeserializeHttpReadSettings(JsonElement element partitionRootPath = property.Value.GetObject(); continue; } + if (property.NameEquals("additionalColumns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalColumns = property.Value.GetObject(); + continue; + } if (property.NameEquals("type"u8)) { type = property.Value.GetString(); @@ -153,7 +168,7 @@ internal static HttpReadSettings DeserializeHttpReadSettings(JsonElement element additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new HttpReadSettings(type, maxConcurrentConnections.Value, additionalProperties, requestMethod.Value, requestBody.Value, additionalHeaders.Value, requestTimeout.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value); + return new HttpReadSettings(type, maxConcurrentConnections.Value, additionalProperties, requestMethod.Value, requestBody.Value, additionalHeaders.Value, requestTimeout.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, additionalColumns.Value); } internal partial class HttpReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HttpReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HttpReadSettings.cs index b9836441dcc55..58561d50c9fdd 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HttpReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/HttpReadSettings.cs @@ -9,7 +9,7 @@ namespace Azure.Analytics.Synapse.Artifacts.Models { - /// Sftp read settings. + /// Http read settings. public partial class HttpReadSettings : StoreReadSettings { /// Initializes a new instance of HttpReadSettings. @@ -26,9 +26,10 @@ public HttpReadSettings() /// The HTTP request body to the RESTful API if requestMethod is POST. Type: string (or Expression with resultType string). /// The additional HTTP headers in the request to the RESTful API. Type: string (or Expression with resultType string). /// Specifies the timeout for a HTTP client to get HTTP response from HTTP server. - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). - internal HttpReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object requestMethod, object requestBody, object additionalHeaders, object requestTimeout, bool? enablePartitionDiscovery, object partitionRootPath) : base(type, maxConcurrentConnections, additionalProperties) + /// Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects). + internal HttpReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object requestMethod, object requestBody, object additionalHeaders, object requestTimeout, object enablePartitionDiscovery, object partitionRootPath, object additionalColumns) : base(type, maxConcurrentConnections, additionalProperties) { RequestMethod = requestMethod; RequestBody = requestBody; @@ -36,6 +37,7 @@ internal HttpReadSettings(string type, object maxConcurrentConnections, IDiction RequestTimeout = requestTimeout; EnablePartitionDiscovery = enablePartitionDiscovery; PartitionRootPath = partitionRootPath; + AdditionalColumns = additionalColumns; Type = type ?? "HttpReadSettings"; } @@ -47,9 +49,11 @@ internal HttpReadSettings(string type, object maxConcurrentConnections, IDiction public object AdditionalHeaders { get; set; } /// Specifies the timeout for a HTTP client to get HTTP response from HTTP server. public object RequestTimeout { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } + /// Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects). + public object AdditionalColumns { get; set; } } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookResult.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookResult.Serialization.cs index ca7d4e63349ef..90d4a038a2b74 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookResult.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookResult.Serialization.cs @@ -24,7 +24,7 @@ internal static RunNotebookResult DeserializeRunNotebookResult(JsonElement eleme Optional runId = default; Optional runStatus = default; Optional lastCheckedOn = default; - Optional sessionId = default; + Optional sessionId = default; Optional sparkPool = default; Optional sessionDetail = default; Optional exitValue = default; @@ -48,11 +48,7 @@ internal static RunNotebookResult DeserializeRunNotebookResult(JsonElement eleme } if (property.NameEquals("sessionId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionId = property.Value.GetInt64(); + sessionId = property.Value.GetString(); continue; } if (property.NameEquals("sparkPool"u8)) @@ -84,7 +80,7 @@ internal static RunNotebookResult DeserializeRunNotebookResult(JsonElement eleme continue; } } - return new RunNotebookResult(runId.Value, runStatus.Value, lastCheckedOn.Value, Optional.ToNullable(sessionId), sparkPool.Value, sessionDetail.Value, exitValue.Value, error.Value); + return new RunNotebookResult(runId.Value, runStatus.Value, lastCheckedOn.Value, sessionId.Value, sparkPool.Value, sessionDetail.Value, exitValue.Value, error.Value); } internal partial class RunNotebookResultConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookResult.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookResult.cs index 15d3bcdb15ab9..b591ff6631adf 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookResult.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookResult.cs @@ -24,7 +24,7 @@ internal RunNotebookResult() /// Run notebook session details. /// Output of exit command. /// Run notebook error. - internal RunNotebookResult(string runId, string runStatus, string lastCheckedOn, long? sessionId, string sparkPool, object sessionDetail, string exitValue, RunNotebookError error) + internal RunNotebookResult(string runId, string runStatus, string lastCheckedOn, string sessionId, string sparkPool, object sessionDetail, string exitValue, RunNotebookError error) { RunId = runId; RunStatus = runStatus; @@ -43,7 +43,7 @@ internal RunNotebookResult(string runId, string runStatus, string lastCheckedOn, /// Timestamp of last update. public string LastCheckedOn { get; } /// Livy session id. - public long? SessionId { get; } + public string SessionId { get; } /// SparkPool name. public string SparkPool { get; } /// Run notebook session details. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshot.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshot.Serialization.cs index c43071812cbae..45723d26c705a 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshot.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshot.Serialization.cs @@ -27,7 +27,7 @@ internal static RunNotebookSnapshot DeserializeRunNotebookSnapshot(JsonElement e string notebook = default; Optional sessionOptions = default; Optional honorSessionTimeToLive = default; - Optional sessionId = default; + Optional sessionId = default; Optional sparkPool = default; Optional> parameters = default; Optional notebookContent = default; @@ -68,11 +68,7 @@ internal static RunNotebookSnapshot DeserializeRunNotebookSnapshot(JsonElement e } if (property.NameEquals("sessionId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionId = property.Value.GetInt64(); + sessionId = property.Value.GetString(); continue; } if (property.NameEquals("sparkPool"u8)) @@ -104,7 +100,7 @@ internal static RunNotebookSnapshot DeserializeRunNotebookSnapshot(JsonElement e continue; } } - return new RunNotebookSnapshot(exitValue.Value, id, notebook, sessionOptions.Value, Optional.ToNullable(honorSessionTimeToLive), Optional.ToNullable(sessionId), sparkPool.Value, Optional.ToDictionary(parameters), notebookContent.Value); + return new RunNotebookSnapshot(exitValue.Value, id, notebook, sessionOptions.Value, Optional.ToNullable(honorSessionTimeToLive), sessionId.Value, sparkPool.Value, Optional.ToDictionary(parameters), notebookContent.Value); } internal partial class RunNotebookSnapshotConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshot.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshot.cs index 2434f587b6bd0..46010a765bfa5 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshot.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshot.cs @@ -38,7 +38,7 @@ internal RunNotebookSnapshot(string id, string notebook) /// SparkPool name. /// Run notebook parameters. /// Notebook resource type. - internal RunNotebookSnapshot(string exitValue, string id, string notebook, RunNotebookSparkSessionOptions sessionOptions, bool? honorSessionTimeToLive, long? sessionId, string sparkPool, IReadOnlyDictionary parameters, NotebookResource notebookContent) + internal RunNotebookSnapshot(string exitValue, string id, string notebook, RunNotebookSparkSessionOptions sessionOptions, bool? honorSessionTimeToLive, string sessionId, string sparkPool, IReadOnlyDictionary parameters, NotebookResource notebookContent) { ExitValue = exitValue; Id = id; @@ -62,7 +62,7 @@ internal RunNotebookSnapshot(string exitValue, string id, string notebook, RunNo /// Whether session should run till time to live after run completes. public bool? HonorSessionTimeToLive { get; } /// Livy session id. - public long? SessionId { get; } + public string SessionId { get; } /// SparkPool name. public string SparkPool { get; } /// Run notebook parameters. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshotResult.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshotResult.Serialization.cs index 183d3f66f1c3f..d98ad67f1ae40 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshotResult.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshotResult.Serialization.cs @@ -26,7 +26,7 @@ internal static RunNotebookSnapshotResult DeserializeRunNotebookSnapshotResult(J string runId = default; string runStatus = default; Optional lastCheckedOn = default; - Optional sessionId = default; + Optional sessionId = default; Optional sparkPool = default; foreach (var property in element.EnumerateObject()) { @@ -61,11 +61,7 @@ internal static RunNotebookSnapshotResult DeserializeRunNotebookSnapshotResult(J } if (property.NameEquals("sessionId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionId = property.Value.GetInt64(); + sessionId = property.Value.GetString(); continue; } if (property.NameEquals("sparkPool"u8)) @@ -74,7 +70,7 @@ internal static RunNotebookSnapshotResult DeserializeRunNotebookSnapshotResult(J continue; } } - return new RunNotebookSnapshotResult(snapshot, error.Value, runId, runStatus, lastCheckedOn.Value, Optional.ToNullable(sessionId), sparkPool.Value); + return new RunNotebookSnapshotResult(snapshot, error.Value, runId, runStatus, lastCheckedOn.Value, sessionId.Value, sparkPool.Value); } internal partial class RunNotebookSnapshotResultConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshotResult.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshotResult.cs index 7e9ec0e6a5be7..05bdd60a4b026 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshotResult.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/RunNotebookSnapshotResult.cs @@ -37,7 +37,7 @@ internal RunNotebookSnapshotResult(RunNotebookSnapshot snapshot, string runId, s /// Timestamp of last update. /// Livy session id. /// SparkPool name. - internal RunNotebookSnapshotResult(RunNotebookSnapshot snapshot, RunNotebookError error, string runId, string runStatus, string lastCheckedOn, long? sessionId, string sparkPool) + internal RunNotebookSnapshotResult(RunNotebookSnapshot snapshot, RunNotebookError error, string runId, string runStatus, string lastCheckedOn, string sessionId, string sparkPool) { Snapshot = snapshot; Error = error; @@ -59,7 +59,7 @@ internal RunNotebookSnapshotResult(RunNotebookSnapshot snapshot, RunNotebookErro /// Timestamp of last update. public string LastCheckedOn { get; } /// Livy session id. - public long? SessionId { get; } + public string SessionId { get; } /// SparkPool name. public string SparkPool { get; } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaPartitionOption.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaPartitionOption.cs index 2e05a0289cd32..e4c4c58456299 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaPartitionOption.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaPartitionOption.cs @@ -11,7 +11,7 @@ namespace Azure.Analytics.Synapse.Artifacts.Models { /// The partition mechanism that will be used for SAP HANA read in parallel. - public readonly partial struct SapHanaPartitionOption : IEquatable + internal readonly partial struct SapHanaPartitionOption : IEquatable { private readonly string _value; diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaSource.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaSource.Serialization.cs index fb028db591242..5f54817432ee3 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaSource.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaSource.Serialization.cs @@ -32,7 +32,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionOption)) { writer.WritePropertyName("partitionOption"u8); - writer.WriteStringValue(PartitionOption.Value.ToString()); + writer.WriteObjectValue(PartitionOption); } if (Optional.IsDefined(PartitionSettings)) { @@ -82,7 +82,7 @@ internal static SapHanaSource DeserializeSapHanaSource(JsonElement element) } Optional query = default; Optional packetSize = default; - Optional partitionOption = default; + Optional partitionOption = default; Optional partitionSettings = default; Optional queryTimeout = default; Optional additionalColumns = default; @@ -118,7 +118,7 @@ internal static SapHanaSource DeserializeSapHanaSource(JsonElement element) { continue; } - partitionOption = new SapHanaPartitionOption(property.Value.GetString()); + partitionOption = property.Value.GetObject(); continue; } if (property.NameEquals("partitionSettings"u8)) @@ -183,7 +183,7 @@ internal static SapHanaSource DeserializeSapHanaSource(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SapHanaSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, packetSize.Value, Optional.ToNullable(partitionOption), partitionSettings.Value); + return new SapHanaSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, query.Value, packetSize.Value, partitionOption.Value, partitionSettings.Value); } internal partial class SapHanaSourceConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaSource.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaSource.cs index e355f8f64d043..6ffdb9015d003 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaSource.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapHanaSource.cs @@ -28,9 +28,9 @@ public SapHanaSource() /// Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or Expression with resultType array of objects). /// SAP HANA Sql query. Type: string (or Expression with resultType string). /// The packet size of data read from SAP HANA. Type: integer(or Expression with resultType integer). - /// The partition mechanism that will be used for SAP HANA read in parallel. + /// The partition mechanism that will be used for SAP HANA read in parallel. Possible values include: "None", "PhysicalPartitionsOfTable", "SapHanaDynamicRange". /// The settings that will be leveraged for SAP HANA source partitioning. - internal SapHanaSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object query, object packetSize, SapHanaPartitionOption? partitionOption, SapHanaPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) + internal SapHanaSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object query, object packetSize, object partitionOption, SapHanaPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) { Query = query; PacketSize = packetSize; @@ -43,8 +43,8 @@ internal SapHanaSource(string type, object sourceRetryCount, object sourceRetryW public object Query { get; set; } /// The packet size of data read from SAP HANA. Type: integer(or Expression with resultType integer). public object PacketSize { get; set; } - /// The partition mechanism that will be used for SAP HANA read in parallel. - public SapHanaPartitionOption? PartitionOption { get; set; } + /// The partition mechanism that will be used for SAP HANA read in parallel. Possible values include: "None", "PhysicalPartitionsOfTable", "SapHanaDynamicRange". + public object PartitionOption { get; set; } /// The settings that will be leveraged for SAP HANA source partitioning. public SapHanaPartitionSettings PartitionSettings { get; set; } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTablePartitionOption.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTablePartitionOption.cs index 3e6cb959b3f92..c2226509782bc 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTablePartitionOption.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTablePartitionOption.cs @@ -11,7 +11,7 @@ namespace Azure.Analytics.Synapse.Artifacts.Models { /// The partition mechanism that will be used for SAP table read in parallel. - public readonly partial struct SapTablePartitionOption : IEquatable + internal readonly partial struct SapTablePartitionOption : IEquatable { private readonly string _value; diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTableSource.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTableSource.Serialization.cs index a68091c98a4be..26a0316b3ed83 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTableSource.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTableSource.Serialization.cs @@ -57,7 +57,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PartitionOption)) { writer.WritePropertyName("partitionOption"u8); - writer.WriteStringValue(PartitionOption.Value.ToString()); + writer.WriteObjectValue(PartitionOption); } if (Optional.IsDefined(PartitionSettings)) { @@ -112,7 +112,7 @@ internal static SapTableSource DeserializeSapTableSource(JsonElement element) Optional batchSize = default; Optional customRfcReadTableFunctionModule = default; Optional sapDataColumnDelimiter = default; - Optional partitionOption = default; + Optional partitionOption = default; Optional partitionSettings = default; Optional queryTimeout = default; Optional additionalColumns = default; @@ -193,7 +193,7 @@ internal static SapTableSource DeserializeSapTableSource(JsonElement element) { continue; } - partitionOption = new SapTablePartitionOption(property.Value.GetString()); + partitionOption = property.Value.GetObject(); continue; } if (property.NameEquals("partitionSettings"u8)) @@ -258,7 +258,7 @@ internal static SapTableSource DeserializeSapTableSource(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SapTableSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, rowCount.Value, rowSkips.Value, rfcTableFields.Value, rfcTableOptions.Value, batchSize.Value, customRfcReadTableFunctionModule.Value, sapDataColumnDelimiter.Value, Optional.ToNullable(partitionOption), partitionSettings.Value); + return new SapTableSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, rowCount.Value, rowSkips.Value, rfcTableFields.Value, rfcTableOptions.Value, batchSize.Value, customRfcReadTableFunctionModule.Value, sapDataColumnDelimiter.Value, partitionOption.Value, partitionSettings.Value); } internal partial class SapTableSourceConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTableSource.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTableSource.cs index 6990b47f3197e..8a98e3f42b59b 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTableSource.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SapTableSource.cs @@ -33,9 +33,9 @@ public SapTableSource() /// Specifies the maximum number of rows that will be retrieved at a time when retrieving data from SAP Table. Type: integer (or Expression with resultType integer). /// Specifies the custom RFC function module that will be used to read data from SAP Table. Type: string (or Expression with resultType string). /// The single character that will be used as delimiter passed to SAP RFC as well as splitting the output data retrieved. Type: string (or Expression with resultType string). - /// The partition mechanism that will be used for SAP table read in parallel. + /// The partition mechanism that will be used for SAP table read in parallel. Possible values include: "None", "PartitionOnInt", "PartitionOnCalendarYear", "PartitionOnCalendarMonth", "PartitionOnCalendarDate", "PartitionOnTime". /// The settings that will be leveraged for SAP table source partitioning. - internal SapTableSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object rowCount, object rowSkips, object rfcTableFields, object rfcTableOptions, object batchSize, object customRfcReadTableFunctionModule, object sapDataColumnDelimiter, SapTablePartitionOption? partitionOption, SapTablePartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) + internal SapTableSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object rowCount, object rowSkips, object rfcTableFields, object rfcTableOptions, object batchSize, object customRfcReadTableFunctionModule, object sapDataColumnDelimiter, object partitionOption, SapTablePartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) { RowCount = rowCount; RowSkips = rowSkips; @@ -63,8 +63,8 @@ internal SapTableSource(string type, object sourceRetryCount, object sourceRetry public object CustomRfcReadTableFunctionModule { get; set; } /// The single character that will be used as delimiter passed to SAP RFC as well as splitting the output data retrieved. Type: string (or Expression with resultType string). public object SapDataColumnDelimiter { get; set; } - /// The partition mechanism that will be used for SAP table read in parallel. - public SapTablePartitionOption? PartitionOption { get; set; } + /// The partition mechanism that will be used for SAP table read in parallel. Possible values include: "None", "PartitionOnInt", "PartitionOnCalendarYear", "PartitionOnCalendarMonth", "PartitionOnCalendarDate", "PartitionOnTime". + public object PartitionOption { get; set; } /// The settings that will be leveraged for SAP table source partitioning. public SapTablePartitionSettings PartitionSettings { get; set; } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ScriptActivity.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ScriptActivity.Serialization.cs index 5f2e459ac7c22..cb56f2ad18209 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ScriptActivity.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ScriptActivity.Serialization.cs @@ -70,6 +70,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("typeProperties"u8); writer.WriteStartObject(); + if (Optional.IsDefined(ScriptBlockExecutionTimeout)) + { + writer.WritePropertyName("scriptBlockExecutionTimeout"u8); + writer.WriteObjectValue(ScriptBlockExecutionTimeout); + } if (Optional.IsCollectionDefined(Scripts)) { writer.WritePropertyName("scripts"u8); @@ -109,6 +114,7 @@ internal static ScriptActivity DeserializeScriptActivity(JsonElement element) Optional onInactiveMarkAs = default; Optional> dependsOn = default; Optional> userProperties = default; + Optional scriptBlockExecutionTimeout = default; Optional> scripts = default; Optional logSettings = default; IDictionary additionalProperties = default; @@ -203,6 +209,15 @@ internal static ScriptActivity DeserializeScriptActivity(JsonElement element) } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("scriptBlockExecutionTimeout"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scriptBlockExecutionTimeout = property0.Value.GetObject(); + continue; + } if (property0.NameEquals("scripts"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -232,7 +247,7 @@ internal static ScriptActivity DeserializeScriptActivity(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new ScriptActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName.Value, policy.Value, Optional.ToList(scripts), logSettings.Value); + return new ScriptActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, linkedServiceName.Value, policy.Value, scriptBlockExecutionTimeout.Value, Optional.ToList(scripts), logSettings.Value); } internal partial class ScriptActivityConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ScriptActivity.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ScriptActivity.cs index ef43906b292c6..fc7cf6942530d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ScriptActivity.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ScriptActivity.cs @@ -36,15 +36,19 @@ public ScriptActivity(string name) : base(name) /// Additional Properties. /// Linked service reference. /// Activity policy. + /// ScriptBlock execution timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). /// Array of script blocks. Type: array. /// Log settings of script activity. - internal ScriptActivity(string name, string type, string description, ActivityState? state, ActivityOnInactiveMarkAs? onInactiveMarkAs, IList dependsOn, IList userProperties, IDictionary additionalProperties, LinkedServiceReference linkedServiceName, ActivityPolicy policy, IList scripts, ScriptActivityTypePropertiesLogSettings logSettings) : base(name, type, description, state, onInactiveMarkAs, dependsOn, userProperties, additionalProperties, linkedServiceName, policy) + internal ScriptActivity(string name, string type, string description, ActivityState? state, ActivityOnInactiveMarkAs? onInactiveMarkAs, IList dependsOn, IList userProperties, IDictionary additionalProperties, LinkedServiceReference linkedServiceName, ActivityPolicy policy, object scriptBlockExecutionTimeout, IList scripts, ScriptActivityTypePropertiesLogSettings logSettings) : base(name, type, description, state, onInactiveMarkAs, dependsOn, userProperties, additionalProperties, linkedServiceName, policy) { + ScriptBlockExecutionTimeout = scriptBlockExecutionTimeout; Scripts = scripts; LogSettings = logSettings; Type = type ?? "Script"; } + /// ScriptBlock execution timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + public object ScriptBlockExecutionTimeout { get; set; } /// Array of script blocks. Type: array. public IList Scripts { get; } /// Log settings of script activity. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SftpReadSettings.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SftpReadSettings.Serialization.cs index 78f000e4a34a5..6115f34fbfe6c 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SftpReadSettings.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SftpReadSettings.Serialization.cs @@ -37,7 +37,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(EnablePartitionDiscovery)) { writer.WritePropertyName("enablePartitionDiscovery"u8); - writer.WriteBooleanValue(EnablePartitionDiscovery.Value); + writer.WriteObjectValue(EnablePartitionDiscovery); } if (Optional.IsDefined(PartitionRootPath)) { @@ -93,7 +93,7 @@ internal static SftpReadSettings DeserializeSftpReadSettings(JsonElement element Optional recursive = default; Optional wildcardFolderPath = default; Optional wildcardFileName = default; - Optional enablePartitionDiscovery = default; + Optional enablePartitionDiscovery = default; Optional partitionRootPath = default; Optional fileListPath = default; Optional deleteFilesAfterCompletion = default; @@ -139,7 +139,7 @@ internal static SftpReadSettings DeserializeSftpReadSettings(JsonElement element { continue; } - enablePartitionDiscovery = property.Value.GetBoolean(); + enablePartitionDiscovery = property.Value.GetObject(); continue; } if (property.NameEquals("partitionRootPath"u8)) @@ -213,7 +213,7 @@ internal static SftpReadSettings DeserializeSftpReadSettings(JsonElement element additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SftpReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, Optional.ToNullable(enablePartitionDiscovery), partitionRootPath.Value, fileListPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, disableChunking.Value); + return new SftpReadSettings(type, maxConcurrentConnections.Value, additionalProperties, recursive.Value, wildcardFolderPath.Value, wildcardFileName.Value, enablePartitionDiscovery.Value, partitionRootPath.Value, fileListPath.Value, deleteFilesAfterCompletion.Value, modifiedDatetimeStart.Value, modifiedDatetimeEnd.Value, disableChunking.Value); } internal partial class SftpReadSettingsConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SftpReadSettings.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SftpReadSettings.cs index b24c13e6e5440..c04abdb5f8137 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SftpReadSettings.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SftpReadSettings.cs @@ -25,14 +25,14 @@ public SftpReadSettings() /// If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). /// Sftp wildcardFolderPath. Type: string (or Expression with resultType string). /// Sftp wildcardFileName. Type: string (or Expression with resultType string). - /// Indicates whether to enable partition discovery. + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). /// Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). /// The start of file's modified datetime. Type: string (or Expression with resultType string). /// The end of file's modified datetime. Type: string (or Expression with resultType string). /// If true, disable parallel reading within each file. Default is false. Type: boolean (or Expression with resultType boolean). - internal SftpReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, bool? enablePartitionDiscovery, object partitionRootPath, object fileListPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd, object disableChunking) : base(type, maxConcurrentConnections, additionalProperties) + internal SftpReadSettings(string type, object maxConcurrentConnections, IDictionary additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object enablePartitionDiscovery, object partitionRootPath, object fileListPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd, object disableChunking) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; @@ -53,8 +53,8 @@ internal SftpReadSettings(string type, object maxConcurrentConnections, IDiction public object WildcardFolderPath { get; set; } /// Sftp wildcardFileName. Type: string (or Expression with resultType string). public object WildcardFileName { get; set; } - /// Indicates whether to enable partition discovery. - public bool? EnablePartitionDiscovery { get; set; } + /// Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). + public object EnablePartitionDiscovery { get; set; } /// Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). public object PartitionRootPath { get; set; } /// Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISink.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISink.Serialization.cs index efed409df2b69..39170a10add47 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISink.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISink.Serialization.cs @@ -34,16 +34,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("preCopyScript"u8); writer.WriteObjectValue(PreCopyScript); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(StoredProcedureTableTypeParameterName)) { @@ -99,7 +93,7 @@ internal static SqlMISink DeserializeSqlMISink(JsonElement element) Optional sqlWriterStoredProcedureName = default; Optional sqlWriterTableType = default; Optional preCopyScript = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional storedProcedureTableTypeParameterName = default; Optional tableOption = default; string type = default; @@ -145,12 +139,7 @@ internal static SqlMISink DeserializeSqlMISink(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("storedProcedureTableTypeParameterName"u8)) @@ -224,7 +213,7 @@ internal static SqlMISink DeserializeSqlMISink(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SqlMISink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, Optional.ToDictionary(storedProcedureParameters), storedProcedureTableTypeParameterName.Value, tableOption.Value); + return new SqlMISink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, storedProcedureParameters.Value, storedProcedureTableTypeParameterName.Value, tableOption.Value); } internal partial class SqlMISinkConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISink.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISink.cs index 9aa957011ac24..427579c9279e6 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISink.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISink.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class SqlMISink : CopySink /// Initializes a new instance of SqlMISink. public SqlMISink() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "SqlMISink"; } @@ -34,7 +32,7 @@ public SqlMISink() /// SQL stored procedure parameters. /// The stored procedure parameter name of the table type. Type: string (or Expression with resultType string). /// The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string). - internal SqlMISink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object sqlWriterStoredProcedureName, object sqlWriterTableType, object preCopyScript, IDictionary storedProcedureParameters, object storedProcedureTableTypeParameterName, object tableOption) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) + internal SqlMISink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object sqlWriterStoredProcedureName, object sqlWriterTableType, object preCopyScript, object storedProcedureParameters, object storedProcedureTableTypeParameterName, object tableOption) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) { SqlWriterStoredProcedureName = sqlWriterStoredProcedureName; SqlWriterTableType = sqlWriterTableType; @@ -52,7 +50,7 @@ internal SqlMISink(string type, object writeBatchSize, object writeBatchTimeout, /// SQL pre-copy script. Type: string (or Expression with resultType string). public object PreCopyScript { get; set; } /// SQL stored procedure parameters. - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// The stored procedure parameter name of the table type. Type: string (or Expression with resultType string). public object StoredProcedureTableTypeParameterName { get; set; } /// The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISource.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISource.Serialization.cs index a9b25bc09a3d1..29eb5834928ef 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISource.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISource.Serialization.cs @@ -29,16 +29,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sqlReaderStoredProcedureName"u8); writer.WriteObjectValue(SqlReaderStoredProcedureName); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(IsolationLevel)) { @@ -103,7 +97,7 @@ internal static SqlMISource DeserializeSqlMISource(JsonElement element) } Optional sqlReaderQuery = default; Optional sqlReaderStoredProcedureName = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional isolationLevel = default; Optional produceAdditionalTypes = default; Optional partitionOption = default; @@ -142,12 +136,7 @@ internal static SqlMISource DeserializeSqlMISource(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("isolationLevel"u8)) @@ -239,7 +228,7 @@ internal static SqlMISource DeserializeSqlMISource(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SqlMISource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, Optional.ToDictionary(storedProcedureParameters), isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); + return new SqlMISource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, storedProcedureParameters.Value, isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); } internal partial class SqlMISourceConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISource.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISource.cs index 6b7e4a4c8c99b..528f3cbd3a401 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISource.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlMISource.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class SqlMISource : TabularSource /// Initializes a new instance of SqlMISource. public SqlMISource() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "SqlMISource"; } @@ -35,7 +33,7 @@ public SqlMISource() /// Which additional types to produce. /// The partition mechanism that will be used for Sql read in parallel. Possible values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". /// The settings that will be leveraged for Sql source partitioning. - internal SqlMISource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, IDictionary storedProcedureParameters, object isolationLevel, object produceAdditionalTypes, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) + internal SqlMISource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, object storedProcedureParameters, object isolationLevel, object produceAdditionalTypes, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) { SqlReaderQuery = sqlReaderQuery; SqlReaderStoredProcedureName = sqlReaderStoredProcedureName; @@ -52,7 +50,7 @@ internal SqlMISource(string type, object sourceRetryCount, object sourceRetryWai /// Name of the stored procedure for a Azure SQL Managed Instance source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). public object SqlReaderStoredProcedureName { get; set; } /// Value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// Specifies the transaction locking behavior for the SQL source. Allowed values: ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: string (or Expression with resultType string). public object IsolationLevel { get; set; } /// Which additional types to produce. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlPoolStoredProcedureActivity.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlPoolStoredProcedureActivity.Serialization.cs index 0ea4799d0e4d8..289d7f7df94e5 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlPoolStoredProcedureActivity.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlPoolStoredProcedureActivity.Serialization.cs @@ -64,16 +64,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("storedProcedureName"u8); writer.WriteObjectValue(StoredProcedureName); - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } writer.WriteEndObject(); foreach (var item in AdditionalProperties) @@ -99,7 +93,7 @@ internal static SqlPoolStoredProcedureActivity DeserializeSqlPoolStoredProcedure Optional> dependsOn = default; Optional> userProperties = default; object storedProcedureName = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; IDictionary additionalProperties = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -190,12 +184,7 @@ internal static SqlPoolStoredProcedureActivity DeserializeSqlPoolStoredProcedure { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property1.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property0.Value.GetObject(); continue; } } @@ -204,7 +193,7 @@ internal static SqlPoolStoredProcedureActivity DeserializeSqlPoolStoredProcedure additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SqlPoolStoredProcedureActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, sqlPool, storedProcedureName, Optional.ToDictionary(storedProcedureParameters)); + return new SqlPoolStoredProcedureActivity(name, type, description.Value, Optional.ToNullable(state), Optional.ToNullable(onInactiveMarkAs), Optional.ToList(dependsOn), Optional.ToList(userProperties), additionalProperties, sqlPool, storedProcedureName, storedProcedureParameters.Value); } internal partial class SqlPoolStoredProcedureActivityConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlPoolStoredProcedureActivity.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlPoolStoredProcedureActivity.cs index a0d1b1c1c04f4..e555d7b2f0514 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlPoolStoredProcedureActivity.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlPoolStoredProcedureActivity.cs @@ -27,7 +27,6 @@ public SqlPoolStoredProcedureActivity(string name, SqlPoolReference sqlPool, obj SqlPool = sqlPool; StoredProcedureName = storedProcedureName; - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "SqlPoolStoredProcedure"; } @@ -43,7 +42,7 @@ public SqlPoolStoredProcedureActivity(string name, SqlPoolReference sqlPool, obj /// SQL pool stored procedure reference. /// Stored procedure name. Type: string (or Expression with resultType string). /// Value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". - internal SqlPoolStoredProcedureActivity(string name, string type, string description, ActivityState? state, ActivityOnInactiveMarkAs? onInactiveMarkAs, IList dependsOn, IList userProperties, IDictionary additionalProperties, SqlPoolReference sqlPool, object storedProcedureName, IDictionary storedProcedureParameters) : base(name, type, description, state, onInactiveMarkAs, dependsOn, userProperties, additionalProperties) + internal SqlPoolStoredProcedureActivity(string name, string type, string description, ActivityState? state, ActivityOnInactiveMarkAs? onInactiveMarkAs, IList dependsOn, IList userProperties, IDictionary additionalProperties, SqlPoolReference sqlPool, object storedProcedureName, object storedProcedureParameters) : base(name, type, description, state, onInactiveMarkAs, dependsOn, userProperties, additionalProperties) { SqlPool = sqlPool; StoredProcedureName = storedProcedureName; @@ -56,6 +55,6 @@ internal SqlPoolStoredProcedureActivity(string name, string type, string descrip /// Stored procedure name. Type: string (or Expression with resultType string). public object StoredProcedureName { get; set; } /// Value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSink.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSink.Serialization.cs index 497855df3f25a..fd7bd360842b6 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSink.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSink.Serialization.cs @@ -34,16 +34,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("preCopyScript"u8); writer.WriteObjectValue(PreCopyScript); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(StoredProcedureTableTypeParameterName)) { @@ -99,7 +93,7 @@ internal static SqlServerSink DeserializeSqlServerSink(JsonElement element) Optional sqlWriterStoredProcedureName = default; Optional sqlWriterTableType = default; Optional preCopyScript = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional storedProcedureTableTypeParameterName = default; Optional tableOption = default; string type = default; @@ -145,12 +139,7 @@ internal static SqlServerSink DeserializeSqlServerSink(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("storedProcedureTableTypeParameterName"u8)) @@ -224,7 +213,7 @@ internal static SqlServerSink DeserializeSqlServerSink(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SqlServerSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, Optional.ToDictionary(storedProcedureParameters), storedProcedureTableTypeParameterName.Value, tableOption.Value); + return new SqlServerSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, storedProcedureParameters.Value, storedProcedureTableTypeParameterName.Value, tableOption.Value); } internal partial class SqlServerSinkConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSink.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSink.cs index 6a9296069e5cb..6533f1fdd3ac9 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSink.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSink.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class SqlServerSink : CopySink /// Initializes a new instance of SqlServerSink. public SqlServerSink() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "SqlServerSink"; } @@ -34,7 +32,7 @@ public SqlServerSink() /// SQL stored procedure parameters. /// The stored procedure parameter name of the table type. Type: string (or Expression with resultType string). /// The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string). - internal SqlServerSink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object sqlWriterStoredProcedureName, object sqlWriterTableType, object preCopyScript, IDictionary storedProcedureParameters, object storedProcedureTableTypeParameterName, object tableOption) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) + internal SqlServerSink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object sqlWriterStoredProcedureName, object sqlWriterTableType, object preCopyScript, object storedProcedureParameters, object storedProcedureTableTypeParameterName, object tableOption) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) { SqlWriterStoredProcedureName = sqlWriterStoredProcedureName; SqlWriterTableType = sqlWriterTableType; @@ -52,7 +50,7 @@ internal SqlServerSink(string type, object writeBatchSize, object writeBatchTime /// SQL pre-copy script. Type: string (or Expression with resultType string). public object PreCopyScript { get; set; } /// SQL stored procedure parameters. - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// The stored procedure parameter name of the table type. Type: string (or Expression with resultType string). public object StoredProcedureTableTypeParameterName { get; set; } /// The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSource.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSource.Serialization.cs index 47438d1687fdc..549bf5c5506f3 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSource.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSource.Serialization.cs @@ -29,16 +29,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sqlReaderStoredProcedureName"u8); writer.WriteObjectValue(SqlReaderStoredProcedureName); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(IsolationLevel)) { @@ -103,7 +97,7 @@ internal static SqlServerSource DeserializeSqlServerSource(JsonElement element) } Optional sqlReaderQuery = default; Optional sqlReaderStoredProcedureName = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional isolationLevel = default; Optional produceAdditionalTypes = default; Optional partitionOption = default; @@ -142,12 +136,7 @@ internal static SqlServerSource DeserializeSqlServerSource(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("isolationLevel"u8)) @@ -239,7 +228,7 @@ internal static SqlServerSource DeserializeSqlServerSource(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SqlServerSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, Optional.ToDictionary(storedProcedureParameters), isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); + return new SqlServerSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, storedProcedureParameters.Value, isolationLevel.Value, produceAdditionalTypes.Value, partitionOption.Value, partitionSettings.Value); } internal partial class SqlServerSourceConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSource.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSource.cs index 26a9d55a0f0f0..9ed5d4c4159d3 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSource.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlServerSource.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class SqlServerSource : TabularSource /// Initializes a new instance of SqlServerSource. public SqlServerSource() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "SqlServerSource"; } @@ -35,7 +33,7 @@ public SqlServerSource() /// Which additional types to produce. /// The partition mechanism that will be used for Sql read in parallel. Possible values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". /// The settings that will be leveraged for Sql source partitioning. - internal SqlServerSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, IDictionary storedProcedureParameters, object isolationLevel, object produceAdditionalTypes, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) + internal SqlServerSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, object storedProcedureParameters, object isolationLevel, object produceAdditionalTypes, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) { SqlReaderQuery = sqlReaderQuery; SqlReaderStoredProcedureName = sqlReaderStoredProcedureName; @@ -52,7 +50,7 @@ internal SqlServerSource(string type, object sourceRetryCount, object sourceRetr /// Name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). public object SqlReaderStoredProcedureName { get; set; } /// Value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// Specifies the transaction locking behavior for the SQL source. Allowed values: ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: string (or Expression with resultType string). public object IsolationLevel { get; set; } /// Which additional types to produce. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSink.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSink.Serialization.cs index a4102910a2e6c..960c94be5b4cc 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSink.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSink.Serialization.cs @@ -34,16 +34,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("preCopyScript"u8); writer.WriteObjectValue(PreCopyScript); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(StoredProcedureTableTypeParameterName)) { @@ -99,7 +93,7 @@ internal static SqlSink DeserializeSqlSink(JsonElement element) Optional sqlWriterStoredProcedureName = default; Optional sqlWriterTableType = default; Optional preCopyScript = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional storedProcedureTableTypeParameterName = default; Optional tableOption = default; string type = default; @@ -145,12 +139,7 @@ internal static SqlSink DeserializeSqlSink(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("storedProcedureTableTypeParameterName"u8)) @@ -224,7 +213,7 @@ internal static SqlSink DeserializeSqlSink(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SqlSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, Optional.ToDictionary(storedProcedureParameters), storedProcedureTableTypeParameterName.Value, tableOption.Value); + return new SqlSink(type, writeBatchSize.Value, writeBatchTimeout.Value, sinkRetryCount.Value, sinkRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, sqlWriterStoredProcedureName.Value, sqlWriterTableType.Value, preCopyScript.Value, storedProcedureParameters.Value, storedProcedureTableTypeParameterName.Value, tableOption.Value); } internal partial class SqlSinkConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSink.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSink.cs index b1308ba9787d7..85716e1cfdd29 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSink.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSink.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class SqlSink : CopySink /// Initializes a new instance of SqlSink. public SqlSink() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "SqlSink"; } @@ -34,7 +32,7 @@ public SqlSink() /// SQL stored procedure parameters. /// The stored procedure parameter name of the table type. Type: string (or Expression with resultType string). /// The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string). - internal SqlSink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object sqlWriterStoredProcedureName, object sqlWriterTableType, object preCopyScript, IDictionary storedProcedureParameters, object storedProcedureTableTypeParameterName, object tableOption) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) + internal SqlSink(string type, object writeBatchSize, object writeBatchTimeout, object sinkRetryCount, object sinkRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object sqlWriterStoredProcedureName, object sqlWriterTableType, object preCopyScript, object storedProcedureParameters, object storedProcedureTableTypeParameterName, object tableOption) : base(type, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections, additionalProperties) { SqlWriterStoredProcedureName = sqlWriterStoredProcedureName; SqlWriterTableType = sqlWriterTableType; @@ -52,7 +50,7 @@ internal SqlSink(string type, object writeBatchSize, object writeBatchTimeout, o /// SQL pre-copy script. Type: string (or Expression with resultType string). public object PreCopyScript { get; set; } /// SQL stored procedure parameters. - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// The stored procedure parameter name of the table type. Type: string (or Expression with resultType string). public object StoredProcedureTableTypeParameterName { get; set; } /// The option to handle sink table, such as autoCreate. For now only 'autoCreate' value is supported. Type: string (or Expression with resultType string). diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSource.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSource.Serialization.cs index bd122263746dd..732e550c44c6e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSource.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSource.Serialization.cs @@ -29,16 +29,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sqlReaderStoredProcedureName"u8); writer.WriteObjectValue(SqlReaderStoredProcedureName); } - if (Optional.IsCollectionDefined(StoredProcedureParameters)) + if (Optional.IsDefined(StoredProcedureParameters)) { writer.WritePropertyName("storedProcedureParameters"u8); - writer.WriteStartObject(); - foreach (var item in StoredProcedureParameters) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); + writer.WriteObjectValue(StoredProcedureParameters); } if (Optional.IsDefined(IsolationLevel)) { @@ -98,7 +92,7 @@ internal static SqlSource DeserializeSqlSource(JsonElement element) } Optional sqlReaderQuery = default; Optional sqlReaderStoredProcedureName = default; - Optional> storedProcedureParameters = default; + Optional storedProcedureParameters = default; Optional isolationLevel = default; Optional partitionOption = default; Optional partitionSettings = default; @@ -136,12 +130,7 @@ internal static SqlSource DeserializeSqlSource(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, StoredProcedureParameter.DeserializeStoredProcedureParameter(property0.Value)); - } - storedProcedureParameters = dictionary; + storedProcedureParameters = property.Value.GetObject(); continue; } if (property.NameEquals("isolationLevel"u8)) @@ -224,7 +213,7 @@ internal static SqlSource DeserializeSqlSource(JsonElement element) additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; - return new SqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, Optional.ToDictionary(storedProcedureParameters), isolationLevel.Value, partitionOption.Value, partitionSettings.Value); + return new SqlSource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, additionalColumns.Value, sqlReaderQuery.Value, sqlReaderStoredProcedureName.Value, storedProcedureParameters.Value, isolationLevel.Value, partitionOption.Value, partitionSettings.Value); } internal partial class SqlSourceConverter : JsonConverter diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSource.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSource.cs index 7ac73913d9803..a2a50b6b8861b 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSource.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SqlSource.cs @@ -6,7 +6,6 @@ #nullable disable using System.Collections.Generic; -using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { @@ -16,7 +15,6 @@ public partial class SqlSource : TabularSource /// Initializes a new instance of SqlSource. public SqlSource() { - StoredProcedureParameters = new ChangeTrackingDictionary(); Type = "SqlSource"; } @@ -34,7 +32,7 @@ public SqlSource() /// Specifies the transaction locking behavior for the SQL source. Allowed values: ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: string (or Expression with resultType string). /// The partition mechanism that will be used for Sql read in parallel. Possible values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". /// The settings that will be leveraged for Sql source partitioning. - internal SqlSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, IDictionary storedProcedureParameters, object isolationLevel, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) + internal SqlSource(string type, object sourceRetryCount, object sourceRetryWait, object maxConcurrentConnections, IDictionary additionalProperties, object queryTimeout, object additionalColumns, object sqlReaderQuery, object sqlReaderStoredProcedureName, object storedProcedureParameters, object isolationLevel, object partitionOption, SqlPartitionSettings partitionSettings) : base(type, sourceRetryCount, sourceRetryWait, maxConcurrentConnections, additionalProperties, queryTimeout, additionalColumns) { SqlReaderQuery = sqlReaderQuery; SqlReaderStoredProcedureName = sqlReaderStoredProcedureName; @@ -50,7 +48,7 @@ internal SqlSource(string type, object sourceRetryCount, object sourceRetryWait, /// Name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). public object SqlReaderStoredProcedureName { get; set; } /// Value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". - public IDictionary StoredProcedureParameters { get; } + public object StoredProcedureParameters { get; set; } /// Specifies the transaction locking behavior for the SQL source. Allowed values: ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: string (or Expression with resultType string). public object IsolationLevel { get; set; } /// The partition mechanism that will be used for Sql read in parallel. Possible values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameter.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameter.Serialization.cs deleted file mode 100644 index 64421eb970e1e..0000000000000 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameter.Serialization.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; -using Azure.Core; - -namespace Azure.Analytics.Synapse.Artifacts.Models -{ - [JsonConverter(typeof(StoredProcedureParameterConverter))] - public partial class StoredProcedureParameter : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Value)) - { - if (Value != null) - { - writer.WritePropertyName("value"u8); - writer.WriteObjectValue(Value); - } - else - { - writer.WriteNull("value"); - } - } - if (Optional.IsDefined(Type)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(Type.Value.ToString()); - } - writer.WriteEndObject(); - } - - internal static StoredProcedureParameter DeserializeStoredProcedureParameter(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional value = default; - Optional type = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - value = null; - continue; - } - value = property.Value.GetObject(); - continue; - } - if (property.NameEquals("type"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type = new StoredProcedureParameterType(property.Value.GetString()); - continue; - } - } - return new StoredProcedureParameter(value.Value, Optional.ToNullable(type)); - } - - internal partial class StoredProcedureParameterConverter : JsonConverter - { - public override void Write(Utf8JsonWriter writer, StoredProcedureParameter model, JsonSerializerOptions options) - { - writer.WriteObjectValue(model); - } - public override StoredProcedureParameter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - using var document = JsonDocument.ParseValue(ref reader); - return DeserializeStoredProcedureParameter(document.RootElement); - } - } - } -} diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameter.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameter.cs index 43df072d992da..2c016af66fe2b 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameter.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameter.cs @@ -8,25 +8,16 @@ namespace Azure.Analytics.Synapse.Artifacts.Models { /// SQL stored procedure parameter. - public partial class StoredProcedureParameter + internal partial class StoredProcedureParameter { /// Initializes a new instance of StoredProcedureParameter. - public StoredProcedureParameter() + internal StoredProcedureParameter() { } - /// Initializes a new instance of StoredProcedureParameter. - /// Stored procedure parameter value. Type: string (or Expression with resultType string). - /// Stored procedure parameter type. - internal StoredProcedureParameter(object value, StoredProcedureParameterType? type) - { - Value = value; - Type = type; - } - /// Stored procedure parameter value. Type: string (or Expression with resultType string). - public object Value { get; set; } + public object Value { get; } /// Stored procedure parameter type. - public StoredProcedureParameterType? Type { get; set; } + public StoredProcedureParameterType? Type { get; } } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameterType.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameterType.cs index 95efe4ffa09f7..1d609e372f732 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameterType.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/StoredProcedureParameterType.cs @@ -11,7 +11,7 @@ namespace Azure.Analytics.Synapse.Artifacts.Models { /// Stored procedure parameter type. - public readonly partial struct StoredProcedureParameterType : IEquatable + internal readonly partial struct StoredProcedureParameterType : IEquatable { private readonly string _value; diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/WebActivityAuthentication.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/WebActivityAuthentication.Serialization.cs index 23c94ab735fce..1a9d76bb20d76 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/WebActivityAuthentication.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/WebActivityAuthentication.Serialization.cs @@ -28,7 +28,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Username)) { writer.WritePropertyName("username"u8); - writer.WriteStringValue(Username); + writer.WriteObjectValue(Username); } if (Optional.IsDefined(Password)) { @@ -61,7 +61,7 @@ internal static WebActivityAuthentication DeserializeWebActivityAuthentication(J } string type = default; Optional pfx = default; - Optional username = default; + Optional username = default; Optional password = default; Optional resource = default; Optional userTenant = default; @@ -84,7 +84,11 @@ internal static WebActivityAuthentication DeserializeWebActivityAuthentication(J } if (property.NameEquals("username"u8)) { - username = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + username = property.Value.GetObject(); continue; } if (property.NameEquals("password"u8)) diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/WebActivityAuthentication.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/WebActivityAuthentication.cs index b71d540b23269..bdbccf793cd5d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/WebActivityAuthentication.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/WebActivityAuthentication.cs @@ -30,7 +30,7 @@ public WebActivityAuthentication(string type) /// 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 . /// - /// Web activity authentication user name for basic authentication. + /// Web activity authentication user name for basic authentication. Type: string (or Expression with resultType string). /// /// Password for the PFX file or basic authentication. /// 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. @@ -39,7 +39,7 @@ public WebActivityAuthentication(string type) /// Resource for which Azure Auth token will be requested when using MSI Authentication. Type: string (or Expression with resultType string). /// TenantId for which Azure Auth token will be requested when using ServicePrincipal Authentication. Type: string (or Expression with resultType string). /// The credential reference containing authentication information. - internal WebActivityAuthentication(string type, SecretBase pfx, string username, SecretBase password, object resource, object userTenant, CredentialReference credential) + internal WebActivityAuthentication(string type, SecretBase pfx, object username, SecretBase password, object resource, object userTenant, CredentialReference credential) { Type = type; Pfx = pfx; @@ -58,8 +58,8 @@ internal WebActivityAuthentication(string type, SecretBase pfx, string username, /// The available derived classes include and . /// public SecretBase Pfx { get; set; } - /// Web activity authentication user name for basic authentication. - public string Username { get; set; } + /// Web activity authentication user name for basic authentication. Type: string (or Expression with resultType string). + public object Username { get; set; } /// /// Password for the PFX file or basic authentication. /// 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. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookClient.cs index 5afe50856bf63..9486a9a53632c 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookClient.cs @@ -29,7 +29,7 @@ protected NotebookClient() } /// Initializes a new instance of NotebookClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public NotebookClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public NotebookClient(Uri endpoint, TokenCredential credential, ArtifactsClientO /// Initializes a new instance of NotebookClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal NotebookClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookOperationResultClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookOperationResultClient.cs index 8bc4a2ba9776f..9bda3113f99ac 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookOperationResultClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookOperationResultClient.cs @@ -27,7 +27,7 @@ protected NotebookOperationResultClient() } /// Initializes a new instance of NotebookOperationResultClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public NotebookOperationResultClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -51,7 +51,7 @@ public NotebookOperationResultClient(Uri endpoint, TokenCredential credential, A /// Initializes a new instance of NotebookOperationResultClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal NotebookOperationResultClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookOperationResultRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookOperationResultRestClient.cs index 56dfdb66e69bb..94aa7472ef105 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookOperationResultRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookOperationResultRestClient.cs @@ -25,7 +25,7 @@ internal partial class NotebookOperationResultRestClient /// Initializes a new instance of NotebookOperationResultRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public NotebookOperationResultRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookRestClient.cs index 13719286653d5..1bcb665f1b54c 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/NotebookRestClient.cs @@ -27,7 +27,7 @@ internal partial class NotebookRestClient /// Initializes a new instance of NotebookRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public NotebookRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineClient.cs index 6c3e5a286035c..417de2b6cce72 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineClient.cs @@ -30,7 +30,7 @@ protected PipelineClient() } /// Initializes a new instance of PipelineClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public PipelineClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -54,7 +54,7 @@ public PipelineClient(Uri endpoint, TokenCredential credential, ArtifactsClientO /// Initializes a new instance of PipelineClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal PipelineClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRestClient.cs index 00ecddd439e78..266fb68410a85 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRestClient.cs @@ -28,7 +28,7 @@ internal partial class PipelineRestClient /// Initializes a new instance of PipelineRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public PipelineRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRunClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRunClient.cs index 7ae33642f8686..15897a126a31b 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRunClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRunClient.cs @@ -28,7 +28,7 @@ protected PipelineRunClient() } /// Initializes a new instance of PipelineRunClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public PipelineRunClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public PipelineRunClient(Uri endpoint, TokenCredential credential, ArtifactsClie /// Initializes a new instance of PipelineRunClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal PipelineRunClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRunRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRunRestClient.cs index 99e3a57062c05..0b0258a058a7e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRunRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/PipelineRunRestClient.cs @@ -27,7 +27,7 @@ internal partial class PipelineRunRestClient /// Initializes a new instance of PipelineRunRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public PipelineRunRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/RunNotebookClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/RunNotebookClient.cs index c5666dc22a2b5..c338baf31dbfc 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/RunNotebookClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/RunNotebookClient.cs @@ -28,7 +28,7 @@ protected RunNotebookClient() } /// Initializes a new instance of RunNotebookClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public RunNotebookClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public RunNotebookClient(Uri endpoint, TokenCredential credential, ArtifactsClie /// Initializes a new instance of RunNotebookClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal RunNotebookClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/RunNotebookRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/RunNotebookRestClient.cs index 3a9fef1d5d848..76ad7063aaa73 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/RunNotebookRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/RunNotebookRestClient.cs @@ -27,7 +27,7 @@ internal partial class RunNotebookRestClient /// Initializes a new instance of RunNotebookRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public RunNotebookRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkConfigurationClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkConfigurationClient.cs index 18e5e30dfb084..3fe36d29be49e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkConfigurationClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkConfigurationClient.cs @@ -29,7 +29,7 @@ protected SparkConfigurationClient() } /// Initializes a new instance of SparkConfigurationClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public SparkConfigurationClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public SparkConfigurationClient(Uri endpoint, TokenCredential credential, Artifa /// Initializes a new instance of SparkConfigurationClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal SparkConfigurationClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkConfigurationRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkConfigurationRestClient.cs index 8bea92612c0f9..2646c03c35a90 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkConfigurationRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkConfigurationRestClient.cs @@ -27,7 +27,7 @@ internal partial class SparkConfigurationRestClient /// Initializes a new instance of SparkConfigurationRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public SparkConfigurationRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkJobDefinitionClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkJobDefinitionClient.cs index 9ce90903b988a..0f2e2750ddbee 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkJobDefinitionClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkJobDefinitionClient.cs @@ -29,7 +29,7 @@ protected SparkJobDefinitionClient() } /// Initializes a new instance of SparkJobDefinitionClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public SparkJobDefinitionClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public SparkJobDefinitionClient(Uri endpoint, TokenCredential credential, Artifa /// Initializes a new instance of SparkJobDefinitionClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal SparkJobDefinitionClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkJobDefinitionRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkJobDefinitionRestClient.cs index 4e9fe1b7b0277..2ec3a8c725e94 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkJobDefinitionRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SparkJobDefinitionRestClient.cs @@ -27,7 +27,7 @@ internal partial class SparkJobDefinitionRestClient /// Initializes a new instance of SparkJobDefinitionRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public SparkJobDefinitionRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlPoolsClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlPoolsClient.cs index 46cc95e68babb..fb01b07942ef8 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlPoolsClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlPoolsClient.cs @@ -28,7 +28,7 @@ protected SqlPoolsClient() } /// Initializes a new instance of SqlPoolsClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public SqlPoolsClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public SqlPoolsClient(Uri endpoint, TokenCredential credential, ArtifactsClientO /// Initializes a new instance of SqlPoolsClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal SqlPoolsClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlPoolsRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlPoolsRestClient.cs index d83a55afa8798..c5ad0f8188958 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlPoolsRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlPoolsRestClient.cs @@ -27,7 +27,7 @@ internal partial class SqlPoolsRestClient /// Initializes a new instance of SqlPoolsRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public SqlPoolsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlScriptClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlScriptClient.cs index cfc3a6c5a66e5..fcdf67bb132d8 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlScriptClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlScriptClient.cs @@ -29,7 +29,7 @@ protected SqlScriptClient() } /// Initializes a new instance of SqlScriptClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public SqlScriptClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public SqlScriptClient(Uri endpoint, TokenCredential credential, ArtifactsClient /// Initializes a new instance of SqlScriptClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal SqlScriptClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlScriptRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlScriptRestClient.cs index ed0b360102582..275d8e06b6ed3 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlScriptRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/SqlScriptRestClient.cs @@ -27,7 +27,7 @@ internal partial class SqlScriptRestClient /// Initializes a new instance of SqlScriptRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public SqlScriptRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerClient.cs index a053904a09473..9078001f2f130 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerClient.cs @@ -29,7 +29,7 @@ protected TriggerClient() } /// Initializes a new instance of TriggerClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public TriggerClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -53,7 +53,7 @@ public TriggerClient(Uri endpoint, TokenCredential credential, ArtifactsClientOp /// Initializes a new instance of TriggerClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal TriggerClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRestClient.cs index a23c6ae930763..1055ad2ee811e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRestClient.cs @@ -27,7 +27,7 @@ internal partial class TriggerRestClient /// Initializes a new instance of TriggerRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public TriggerRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRunClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRunClient.cs index 82e64865dba71..d1196b00d14c2 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRunClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRunClient.cs @@ -28,7 +28,7 @@ protected TriggerRunClient() } /// Initializes a new instance of TriggerRunClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public TriggerRunClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public TriggerRunClient(Uri endpoint, TokenCredential credential, ArtifactsClien /// Initializes a new instance of TriggerRunClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal TriggerRunClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRunRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRunRestClient.cs index 00fc4625a4d84..8da062891a4d0 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRunRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/TriggerRunRestClient.cs @@ -27,7 +27,7 @@ internal partial class TriggerRunRestClient /// Initializes a new instance of TriggerRunRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public TriggerRunRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceClient.cs index 08f7bbfad2d78..5410a84470959 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceClient.cs @@ -28,7 +28,7 @@ protected WorkspaceClient() } /// Initializes a new instance of WorkspaceClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public WorkspaceClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public WorkspaceClient(Uri endpoint, TokenCredential credential, ArtifactsClient /// Initializes a new instance of WorkspaceClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal WorkspaceClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceGitRepoManagementClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceGitRepoManagementClient.cs index 032f203a78989..0c0bd45b0b82b 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceGitRepoManagementClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceGitRepoManagementClient.cs @@ -28,7 +28,7 @@ protected WorkspaceGitRepoManagementClient() } /// Initializes a new instance of WorkspaceGitRepoManagementClient. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. public WorkspaceGitRepoManagementClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options = null) @@ -52,7 +52,7 @@ public WorkspaceGitRepoManagementClient(Uri endpoint, TokenCredential credential /// Initializes a new instance of WorkspaceGitRepoManagementClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. internal WorkspaceGitRepoManagementClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceGitRepoManagementRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceGitRepoManagementRestClient.cs index 6f15d7094f74a..167de27b417cd 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceGitRepoManagementRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceGitRepoManagementRestClient.cs @@ -27,7 +27,7 @@ internal partial class WorkspaceGitRepoManagementRestClient /// Initializes a new instance of WorkspaceGitRepoManagementRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public WorkspaceGitRepoManagementRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceRestClient.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceRestClient.cs index b04d3e89bb36c..f06acfaccecc0 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceRestClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/WorkspaceRestClient.cs @@ -27,7 +27,7 @@ internal partial class WorkspaceRestClient /// Initializes a new instance of WorkspaceRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. + /// The workspace development endpoint, for example `https://myworkspace.dev.azuresynapse.net`. /// , or is null. public WorkspaceRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint) { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md index b05cdd538863d..4785cd71bd102 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md @@ -8,7 +8,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml tag: package-artifacts-composite-v7 require: - - https://github.com/Azure/azure-rest-api-specs/blob/1e56b6fbe36e2dcbaccd342f108b7c6efb175181/specification/synapse/data-plane/readme.md + - https://github.com/Azure/azure-rest-api-specs/blob/5ae522bc106bf8609c6cb379e584aa3e0e2639f3/specification/synapse/data-plane/readme.md namespace: Azure.Analytics.Synapse.Artifacts generation1-convenience-client: true public-clients: true diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/api/Azure.ResourceManager.Synapse.netstandard2.0.cs b/sdk/synapse/Azure.ResourceManager.Synapse/api/Azure.ResourceManager.Synapse.netstandard2.0.cs index 8f12dd0c40ce6..c1a5f55cafac5 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/api/Azure.ResourceManager.Synapse.netstandard2.0.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/api/Azure.ResourceManager.Synapse.netstandard2.0.cs @@ -97,7 +97,7 @@ protected SynapseBigDataPoolInfoCollection() { } } public partial class SynapseBigDataPoolInfoData : Azure.ResourceManager.Models.TrackedResourceData { - public SynapseBigDataPoolInfoData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SynapseBigDataPoolInfoData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Synapse.Models.BigDataPoolAutoPauseProperties AutoPause { get { throw null; } set { } } public Azure.ResourceManager.Synapse.Models.BigDataPoolAutoScaleProperties AutoScale { get { throw null; } set { } } public int? CacheSize { get { throw null; } set { } } @@ -828,7 +828,7 @@ protected SynapseKustoPoolCollection() { } } public partial class SynapseKustoPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public SynapseKustoPoolData(Azure.Core.AzureLocation location, Azure.ResourceManager.Synapse.Models.SynapseDataSourceSku sku) : base (default(Azure.Core.AzureLocation)) { } + public SynapseKustoPoolData(Azure.Core.AzureLocation location, Azure.ResourceManager.Synapse.Models.SynapseDataSourceSku sku) { } public System.Uri DataIngestionUri { get { throw null; } } public bool? EnablePurge { get { throw null; } set { } } public bool? EnableStreamingIngest { get { throw null; } set { } } @@ -1090,7 +1090,7 @@ protected SynapsePrivateLinkHubCollection() { } } public partial class SynapsePrivateLinkHubData : Azure.ResourceManager.Models.TrackedResourceData { - public SynapsePrivateLinkHubData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SynapsePrivateLinkHubData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public string ProvisioningState { get { throw null; } set { } } } @@ -1612,7 +1612,7 @@ protected SynapseSqlPoolConnectionPolicyResource() { } } public partial class SynapseSqlPoolData : Azure.ResourceManager.Models.TrackedResourceData { - public SynapseSqlPoolData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SynapseSqlPoolData(Azure.Core.AzureLocation location) { } public string Collation { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ResourceManager.Synapse.Models.SqlPoolCreateMode? CreateMode { get { throw null; } set { } } @@ -2089,7 +2089,7 @@ protected SynapseWorkspaceCollection() { } } public partial class SynapseWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData { - public SynapseWorkspaceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SynapseWorkspaceData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier AdlaResourceId { get { throw null; } } public System.Collections.Generic.IDictionary ConnectivityEndpoints { get { throw null; } } public Azure.ResourceManager.Synapse.Models.SynapseDataLakeStorageAccountDetails DefaultDataLakeStorage { get { throw null; } set { } } @@ -2237,6 +2237,89 @@ protected SynapseWorkspaceSqlAdministratorResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Synapse.Mocking +{ + public partial class MockableSynapseArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSynapseArmClient() { } + public virtual Azure.ResourceManager.Synapse.SynapseAadOnlyAuthenticationResource GetSynapseAadOnlyAuthenticationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseAttachedDatabaseConfigurationResource GetSynapseAttachedDatabaseConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseBigDataPoolInfoResource GetSynapseBigDataPoolInfoResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseClusterPrincipalAssignmentResource GetSynapseClusterPrincipalAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseDatabasePrincipalAssignmentResource GetSynapseDatabasePrincipalAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseDatabaseResource GetSynapseDatabaseResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseDataConnectionResource GetSynapseDataConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseDataMaskingPolicyResource GetSynapseDataMaskingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseDataMaskingRuleResource GetSynapseDataMaskingRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseDataWarehouseUserActivityResource GetSynapseDataWarehouseUserActivityResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseDedicatedSqlMinimalTlsSettingResource GetSynapseDedicatedSqlMinimalTlsSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseEncryptionProtectorResource GetSynapseEncryptionProtectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseExtendedServerBlobAuditingPolicyResource GetSynapseExtendedServerBlobAuditingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseExtendedSqlPoolBlobAuditingPolicyResource GetSynapseExtendedSqlPoolBlobAuditingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseGeoBackupPolicyResource GetSynapseGeoBackupPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseIntegrationRuntimeResource GetSynapseIntegrationRuntimeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseIPFirewallRuleInfoResource GetSynapseIPFirewallRuleInfoResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseKeyResource GetSynapseKeyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseKustoPoolResource GetSynapseKustoPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseLibraryResource GetSynapseLibraryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseMaintenanceWindowOptionResource GetSynapseMaintenanceWindowOptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseMaintenanceWindowResource GetSynapseMaintenanceWindowResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseManagedIdentitySqlControlSettingResource GetSynapseManagedIdentitySqlControlSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseMetadataSyncConfigurationResource GetSynapseMetadataSyncConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapsePrivateEndpointConnectionForPrivateLinkHubResource GetSynapsePrivateEndpointConnectionForPrivateLinkHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapsePrivateEndpointConnectionResource GetSynapsePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapsePrivateLinkHubResource GetSynapsePrivateLinkHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapsePrivateLinkResource GetSynapsePrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseRecoverableSqlPoolResource GetSynapseRecoverableSqlPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseReplicationLinkResource GetSynapseReplicationLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseRestorableDroppedSqlPoolResource GetSynapseRestorableDroppedSqlPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseRestorePointResource GetSynapseRestorePointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSensitivityLabelResource GetSynapseSensitivityLabelResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseServerBlobAuditingPolicyResource GetSynapseServerBlobAuditingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseServerSecurityAlertPolicyResource GetSynapseServerSecurityAlertPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseServerVulnerabilityAssessmentResource GetSynapseServerVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSparkConfigurationResource GetSynapseSparkConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolBlobAuditingPolicyResource GetSynapseSqlPoolBlobAuditingPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolColumnResource GetSynapseSqlPoolColumnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolConnectionPolicyResource GetSynapseSqlPoolConnectionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolResource GetSynapseSqlPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolSchemaResource GetSynapseSqlPoolSchemaResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolSecurityAlertPolicyResource GetSynapseSqlPoolSecurityAlertPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolTableResource GetSynapseSqlPoolTableResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolVulnerabilityAssessmentResource GetSynapseSqlPoolVulnerabilityAssessmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource GetSynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseTransparentDataEncryptionResource GetSynapseTransparentDataEncryptionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseVulnerabilityAssessmentScanRecordResource GetSynapseVulnerabilityAssessmentScanRecordResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseWorkloadClassifierResource GetSynapseWorkloadClassifierResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseWorkloadGroupResource GetSynapseWorkloadGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseWorkspaceAdministratorResource GetSynapseWorkspaceAdministratorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseWorkspacePrivateLinkResource GetSynapseWorkspacePrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseWorkspaceResource GetSynapseWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseWorkspaceSqlAdministratorResource GetSynapseWorkspaceSqlAdministratorResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSynapseResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSynapseResourceGroupResource() { } + public virtual Azure.Response GetSynapsePrivateLinkHub(string privateLinkHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSynapsePrivateLinkHubAsync(string privateLinkHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapsePrivateLinkHubCollection GetSynapsePrivateLinkHubs() { throw null; } + public virtual Azure.Response GetSynapseWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSynapseWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Synapse.SynapseWorkspaceCollection GetSynapseWorkspaces() { throw null; } + } + public partial class MockableSynapseSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSynapseSubscriptionResource() { } + public virtual Azure.Response CheckKustoPoolNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.Synapse.Models.KustoPoolNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckKustoPoolNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Synapse.Models.KustoPoolNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkusKustoPools(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusKustoPoolsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSynapsePrivateLinkHubs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSynapsePrivateLinkHubsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSynapseWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSynapseWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Synapse.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseArmClient.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseArmClient.cs new file mode 100644 index 0000000000000..085dfdfa418fb --- /dev/null +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseArmClient.cs @@ -0,0 +1,687 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Synapse; + +namespace Azure.ResourceManager.Synapse.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSynapseArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSynapseArmClient() + { + } + + /// 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 MockableSynapseArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSynapseArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseAadOnlyAuthenticationResource GetSynapseAadOnlyAuthenticationResource(ResourceIdentifier id) + { + SynapseAadOnlyAuthenticationResource.ValidateResourceId(id); + return new SynapseAadOnlyAuthenticationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseIPFirewallRuleInfoResource GetSynapseIPFirewallRuleInfoResource(ResourceIdentifier id) + { + SynapseIPFirewallRuleInfoResource.ValidateResourceId(id); + return new SynapseIPFirewallRuleInfoResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseKeyResource GetSynapseKeyResource(ResourceIdentifier id) + { + SynapseKeyResource.ValidateResourceId(id); + return new SynapseKeyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapsePrivateEndpointConnectionResource GetSynapsePrivateEndpointConnectionResource(ResourceIdentifier id) + { + SynapsePrivateEndpointConnectionResource.ValidateResourceId(id); + return new SynapsePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseWorkspacePrivateLinkResource GetSynapseWorkspacePrivateLinkResource(ResourceIdentifier id) + { + SynapseWorkspacePrivateLinkResource.ValidateResourceId(id); + return new SynapseWorkspacePrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapsePrivateLinkResource GetSynapsePrivateLinkResource(ResourceIdentifier id) + { + SynapsePrivateLinkResource.ValidateResourceId(id); + return new SynapsePrivateLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapsePrivateLinkHubResource GetSynapsePrivateLinkHubResource(ResourceIdentifier id) + { + SynapsePrivateLinkHubResource.ValidateResourceId(id); + return new SynapsePrivateLinkHubResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapsePrivateEndpointConnectionForPrivateLinkHubResource GetSynapsePrivateEndpointConnectionForPrivateLinkHubResource(ResourceIdentifier id) + { + SynapsePrivateEndpointConnectionForPrivateLinkHubResource.ValidateResourceId(id); + return new SynapsePrivateEndpointConnectionForPrivateLinkHubResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolResource GetSynapseSqlPoolResource(ResourceIdentifier id) + { + SynapseSqlPoolResource.ValidateResourceId(id); + return new SynapseSqlPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseMetadataSyncConfigurationResource GetSynapseMetadataSyncConfigurationResource(ResourceIdentifier id) + { + SynapseMetadataSyncConfigurationResource.ValidateResourceId(id); + return new SynapseMetadataSyncConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseGeoBackupPolicyResource GetSynapseGeoBackupPolicyResource(ResourceIdentifier id) + { + SynapseGeoBackupPolicyResource.ValidateResourceId(id); + return new SynapseGeoBackupPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseDataWarehouseUserActivityResource GetSynapseDataWarehouseUserActivityResource(ResourceIdentifier id) + { + SynapseDataWarehouseUserActivityResource.ValidateResourceId(id); + return new SynapseDataWarehouseUserActivityResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseRestorePointResource GetSynapseRestorePointResource(ResourceIdentifier id) + { + SynapseRestorePointResource.ValidateResourceId(id); + return new SynapseRestorePointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseReplicationLinkResource GetSynapseReplicationLinkResource(ResourceIdentifier id) + { + SynapseReplicationLinkResource.ValidateResourceId(id); + return new SynapseReplicationLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseMaintenanceWindowResource GetSynapseMaintenanceWindowResource(ResourceIdentifier id) + { + SynapseMaintenanceWindowResource.ValidateResourceId(id); + return new SynapseMaintenanceWindowResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseMaintenanceWindowOptionResource GetSynapseMaintenanceWindowOptionResource(ResourceIdentifier id) + { + SynapseMaintenanceWindowOptionResource.ValidateResourceId(id); + return new SynapseMaintenanceWindowOptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseTransparentDataEncryptionResource GetSynapseTransparentDataEncryptionResource(ResourceIdentifier id) + { + SynapseTransparentDataEncryptionResource.ValidateResourceId(id); + return new SynapseTransparentDataEncryptionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolBlobAuditingPolicyResource GetSynapseSqlPoolBlobAuditingPolicyResource(ResourceIdentifier id) + { + SynapseSqlPoolBlobAuditingPolicyResource.ValidateResourceId(id); + return new SynapseSqlPoolBlobAuditingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSensitivityLabelResource GetSynapseSensitivityLabelResource(ResourceIdentifier id) + { + SynapseSensitivityLabelResource.ValidateResourceId(id); + return new SynapseSensitivityLabelResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolSchemaResource GetSynapseSqlPoolSchemaResource(ResourceIdentifier id) + { + SynapseSqlPoolSchemaResource.ValidateResourceId(id); + return new SynapseSqlPoolSchemaResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolTableResource GetSynapseSqlPoolTableResource(ResourceIdentifier id) + { + SynapseSqlPoolTableResource.ValidateResourceId(id); + return new SynapseSqlPoolTableResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolConnectionPolicyResource GetSynapseSqlPoolConnectionPolicyResource(ResourceIdentifier id) + { + SynapseSqlPoolConnectionPolicyResource.ValidateResourceId(id); + return new SynapseSqlPoolConnectionPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolVulnerabilityAssessmentResource GetSynapseSqlPoolVulnerabilityAssessmentResource(ResourceIdentifier id) + { + SynapseSqlPoolVulnerabilityAssessmentResource.ValidateResourceId(id); + return new SynapseSqlPoolVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseVulnerabilityAssessmentScanRecordResource GetSynapseVulnerabilityAssessmentScanRecordResource(ResourceIdentifier id) + { + SynapseVulnerabilityAssessmentScanRecordResource.ValidateResourceId(id); + return new SynapseVulnerabilityAssessmentScanRecordResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolSecurityAlertPolicyResource GetSynapseSqlPoolSecurityAlertPolicyResource(ResourceIdentifier id) + { + SynapseSqlPoolSecurityAlertPolicyResource.ValidateResourceId(id); + return new SynapseSqlPoolSecurityAlertPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource GetSynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource(ResourceIdentifier id) + { + SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource.ValidateResourceId(id); + return new SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseExtendedSqlPoolBlobAuditingPolicyResource GetSynapseExtendedSqlPoolBlobAuditingPolicyResource(ResourceIdentifier id) + { + SynapseExtendedSqlPoolBlobAuditingPolicyResource.ValidateResourceId(id); + return new SynapseExtendedSqlPoolBlobAuditingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseDataMaskingPolicyResource GetSynapseDataMaskingPolicyResource(ResourceIdentifier id) + { + SynapseDataMaskingPolicyResource.ValidateResourceId(id); + return new SynapseDataMaskingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseDataMaskingRuleResource GetSynapseDataMaskingRuleResource(ResourceIdentifier id) + { + SynapseDataMaskingRuleResource.ValidateResourceId(id); + return new SynapseDataMaskingRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSqlPoolColumnResource GetSynapseSqlPoolColumnResource(ResourceIdentifier id) + { + SynapseSqlPoolColumnResource.ValidateResourceId(id); + return new SynapseSqlPoolColumnResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseWorkloadGroupResource GetSynapseWorkloadGroupResource(ResourceIdentifier id) + { + SynapseWorkloadGroupResource.ValidateResourceId(id); + return new SynapseWorkloadGroupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseWorkloadClassifierResource GetSynapseWorkloadClassifierResource(ResourceIdentifier id) + { + SynapseWorkloadClassifierResource.ValidateResourceId(id); + return new SynapseWorkloadClassifierResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseServerBlobAuditingPolicyResource GetSynapseServerBlobAuditingPolicyResource(ResourceIdentifier id) + { + SynapseServerBlobAuditingPolicyResource.ValidateResourceId(id); + return new SynapseServerBlobAuditingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseExtendedServerBlobAuditingPolicyResource GetSynapseExtendedServerBlobAuditingPolicyResource(ResourceIdentifier id) + { + SynapseExtendedServerBlobAuditingPolicyResource.ValidateResourceId(id); + return new SynapseExtendedServerBlobAuditingPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseServerSecurityAlertPolicyResource GetSynapseServerSecurityAlertPolicyResource(ResourceIdentifier id) + { + SynapseServerSecurityAlertPolicyResource.ValidateResourceId(id); + return new SynapseServerSecurityAlertPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseServerVulnerabilityAssessmentResource GetSynapseServerVulnerabilityAssessmentResource(ResourceIdentifier id) + { + SynapseServerVulnerabilityAssessmentResource.ValidateResourceId(id); + return new SynapseServerVulnerabilityAssessmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseEncryptionProtectorResource GetSynapseEncryptionProtectorResource(ResourceIdentifier id) + { + SynapseEncryptionProtectorResource.ValidateResourceId(id); + return new SynapseEncryptionProtectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseRecoverableSqlPoolResource GetSynapseRecoverableSqlPoolResource(ResourceIdentifier id) + { + SynapseRecoverableSqlPoolResource.ValidateResourceId(id); + return new SynapseRecoverableSqlPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseDedicatedSqlMinimalTlsSettingResource GetSynapseDedicatedSqlMinimalTlsSettingResource(ResourceIdentifier id) + { + SynapseDedicatedSqlMinimalTlsSettingResource.ValidateResourceId(id); + return new SynapseDedicatedSqlMinimalTlsSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseWorkspaceResource GetSynapseWorkspaceResource(ResourceIdentifier id) + { + SynapseWorkspaceResource.ValidateResourceId(id); + return new SynapseWorkspaceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseWorkspaceAdministratorResource GetSynapseWorkspaceAdministratorResource(ResourceIdentifier id) + { + SynapseWorkspaceAdministratorResource.ValidateResourceId(id); + return new SynapseWorkspaceAdministratorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseWorkspaceSqlAdministratorResource GetSynapseWorkspaceSqlAdministratorResource(ResourceIdentifier id) + { + SynapseWorkspaceSqlAdministratorResource.ValidateResourceId(id); + return new SynapseWorkspaceSqlAdministratorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseManagedIdentitySqlControlSettingResource GetSynapseManagedIdentitySqlControlSettingResource(ResourceIdentifier id) + { + SynapseManagedIdentitySqlControlSettingResource.ValidateResourceId(id); + return new SynapseManagedIdentitySqlControlSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseRestorableDroppedSqlPoolResource GetSynapseRestorableDroppedSqlPoolResource(ResourceIdentifier id) + { + SynapseRestorableDroppedSqlPoolResource.ValidateResourceId(id); + return new SynapseRestorableDroppedSqlPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseBigDataPoolInfoResource GetSynapseBigDataPoolInfoResource(ResourceIdentifier id) + { + SynapseBigDataPoolInfoResource.ValidateResourceId(id); + return new SynapseBigDataPoolInfoResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseLibraryResource GetSynapseLibraryResource(ResourceIdentifier id) + { + SynapseLibraryResource.ValidateResourceId(id); + return new SynapseLibraryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseIntegrationRuntimeResource GetSynapseIntegrationRuntimeResource(ResourceIdentifier id) + { + SynapseIntegrationRuntimeResource.ValidateResourceId(id); + return new SynapseIntegrationRuntimeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseSparkConfigurationResource GetSynapseSparkConfigurationResource(ResourceIdentifier id) + { + SynapseSparkConfigurationResource.ValidateResourceId(id); + return new SynapseSparkConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseKustoPoolResource GetSynapseKustoPoolResource(ResourceIdentifier id) + { + SynapseKustoPoolResource.ValidateResourceId(id); + return new SynapseKustoPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseAttachedDatabaseConfigurationResource GetSynapseAttachedDatabaseConfigurationResource(ResourceIdentifier id) + { + SynapseAttachedDatabaseConfigurationResource.ValidateResourceId(id); + return new SynapseAttachedDatabaseConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseDatabaseResource GetSynapseDatabaseResource(ResourceIdentifier id) + { + SynapseDatabaseResource.ValidateResourceId(id); + return new SynapseDatabaseResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseDataConnectionResource GetSynapseDataConnectionResource(ResourceIdentifier id) + { + SynapseDataConnectionResource.ValidateResourceId(id); + return new SynapseDataConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseClusterPrincipalAssignmentResource GetSynapseClusterPrincipalAssignmentResource(ResourceIdentifier id) + { + SynapseClusterPrincipalAssignmentResource.ValidateResourceId(id); + return new SynapseClusterPrincipalAssignmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SynapseDatabasePrincipalAssignmentResource GetSynapseDatabasePrincipalAssignmentResource(ResourceIdentifier id) + { + SynapseDatabasePrincipalAssignmentResource.ValidateResourceId(id); + return new SynapseDatabasePrincipalAssignmentResource(Client, id); + } + } +} diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseResourceGroupResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseResourceGroupResource.cs new file mode 100644 index 0000000000000..471908a511880 --- /dev/null +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.Synapse; + +namespace Azure.ResourceManager.Synapse.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSynapseResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSynapseResourceGroupResource() + { + } + + /// 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 MockableSynapseResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SynapsePrivateLinkHubResources in the ResourceGroupResource. + /// An object representing collection of SynapsePrivateLinkHubResources and their operations over a SynapsePrivateLinkHubResource. + public virtual SynapsePrivateLinkHubCollection GetSynapsePrivateLinkHubs() + { + return GetCachedClient(client => new SynapsePrivateLinkHubCollection(client, Id)); + } + + /// + /// Gets a privateLinkHub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName} + /// + /// + /// Operation Id + /// PrivateLinkHubs_Get + /// + /// + /// + /// Name of the privateLinkHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSynapsePrivateLinkHubAsync(string privateLinkHubName, CancellationToken cancellationToken = default) + { + return await GetSynapsePrivateLinkHubs().GetAsync(privateLinkHubName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a privateLinkHub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName} + /// + /// + /// Operation Id + /// PrivateLinkHubs_Get + /// + /// + /// + /// Name of the privateLinkHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSynapsePrivateLinkHub(string privateLinkHubName, CancellationToken cancellationToken = default) + { + return GetSynapsePrivateLinkHubs().Get(privateLinkHubName, cancellationToken); + } + + /// Gets a collection of SynapseWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of SynapseWorkspaceResources and their operations over a SynapseWorkspaceResource. + public virtual SynapseWorkspaceCollection GetSynapseWorkspaces() + { + return GetCachedClient(client => new SynapseWorkspaceCollection(client, Id)); + } + + /// + /// Gets a workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSynapseWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetSynapseWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// Workspaces_Get + /// + /// + /// + /// The name of the workspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSynapseWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetSynapseWorkspaces().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseSubscriptionResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseSubscriptionResource.cs new file mode 100644 index 0000000000000..76fe734fad05a --- /dev/null +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/MockableSynapseSubscriptionResource.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Synapse; +using Azure.ResourceManager.Synapse.Models; + +namespace Azure.ResourceManager.Synapse.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSynapseSubscriptionResource : ArmResource + { + private ClientDiagnostics _synapsePrivateLinkHubPrivateLinkHubsClientDiagnostics; + private PrivateLinkHubsRestOperations _synapsePrivateLinkHubPrivateLinkHubsRestClient; + private ClientDiagnostics _synapseWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _synapseWorkspaceWorkspacesRestClient; + private ClientDiagnostics _synapseKustoPoolKustoPoolsClientDiagnostics; + private KustoPoolsRestOperations _synapseKustoPoolKustoPoolsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSynapseSubscriptionResource() + { + } + + /// 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 MockableSynapseSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SynapsePrivateLinkHubPrivateLinkHubsClientDiagnostics => _synapsePrivateLinkHubPrivateLinkHubsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Synapse", SynapsePrivateLinkHubResource.ResourceType.Namespace, Diagnostics); + private PrivateLinkHubsRestOperations SynapsePrivateLinkHubPrivateLinkHubsRestClient => _synapsePrivateLinkHubPrivateLinkHubsRestClient ??= new PrivateLinkHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SynapsePrivateLinkHubResource.ResourceType)); + private ClientDiagnostics SynapseWorkspaceWorkspacesClientDiagnostics => _synapseWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Synapse", SynapseWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations SynapseWorkspaceWorkspacesRestClient => _synapseWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SynapseWorkspaceResource.ResourceType)); + private ClientDiagnostics SynapseKustoPoolKustoPoolsClientDiagnostics => _synapseKustoPoolKustoPoolsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Synapse", SynapseKustoPoolResource.ResourceType.Namespace, Diagnostics); + private KustoPoolsRestOperations SynapseKustoPoolKustoPoolsRestClient => _synapseKustoPoolKustoPoolsRestClient ??= new KustoPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SynapseKustoPoolResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Returns a list of privateLinkHubs in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs + /// + /// + /// Operation Id + /// PrivateLinkHubs_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSynapsePrivateLinkHubsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SynapsePrivateLinkHubPrivateLinkHubsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SynapsePrivateLinkHubPrivateLinkHubsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SynapsePrivateLinkHubResource(Client, SynapsePrivateLinkHubData.DeserializeSynapsePrivateLinkHubData(e)), SynapsePrivateLinkHubPrivateLinkHubsClientDiagnostics, Pipeline, "MockableSynapseSubscriptionResource.GetSynapsePrivateLinkHubs", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of privateLinkHubs in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs + /// + /// + /// Operation Id + /// PrivateLinkHubs_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSynapsePrivateLinkHubs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SynapsePrivateLinkHubPrivateLinkHubsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SynapsePrivateLinkHubPrivateLinkHubsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SynapsePrivateLinkHubResource(Client, SynapsePrivateLinkHubData.DeserializeSynapsePrivateLinkHubData(e)), SynapsePrivateLinkHubPrivateLinkHubsClientDiagnostics, Pipeline, "MockableSynapseSubscriptionResource.GetSynapsePrivateLinkHubs", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of workspaces in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces + /// + /// + /// Operation Id + /// Workspaces_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSynapseWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SynapseWorkspaceWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SynapseWorkspaceWorkspacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SynapseWorkspaceResource(Client, SynapseWorkspaceData.DeserializeSynapseWorkspaceData(e)), SynapseWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableSynapseSubscriptionResource.GetSynapseWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Returns a list of workspaces in a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces + /// + /// + /// Operation Id + /// Workspaces_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSynapseWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SynapseWorkspaceWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SynapseWorkspaceWorkspacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SynapseWorkspaceResource(Client, SynapseWorkspaceData.DeserializeSynapseWorkspaceData(e)), SynapseWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableSynapseSubscriptionResource.GetSynapseWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Lists eligible SKUs for Kusto Pool resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus + /// + /// + /// Operation Id + /// KustoPools_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusKustoPoolsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SynapseKustoPoolKustoPoolsRestClient.CreateListSkusRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, KustoPoolSkuDescription.DeserializeKustoPoolSkuDescription, SynapseKustoPoolKustoPoolsClientDiagnostics, Pipeline, "MockableSynapseSubscriptionResource.GetSkusKustoPools", "value", null, cancellationToken); + } + + /// + /// Lists eligible SKUs for Kusto Pool resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus + /// + /// + /// Operation Id + /// KustoPools_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkusKustoPools(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SynapseKustoPoolKustoPoolsRestClient.CreateListSkusRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, KustoPoolSkuDescription.DeserializeKustoPoolSkuDescription, SynapseKustoPoolKustoPoolsClientDiagnostics, Pipeline, "MockableSynapseSubscriptionResource.GetSkusKustoPools", "value", null, cancellationToken); + } + + /// + /// Checks that the kusto pool name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability + /// + /// + /// Operation Id + /// KustoPools_CheckNameAvailability + /// + /// + /// + /// The name of Azure region. + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckKustoPoolNameAvailabilityAsync(AzureLocation location, KustoPoolNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SynapseKustoPoolKustoPoolsClientDiagnostics.CreateScope("MockableSynapseSubscriptionResource.CheckKustoPoolNameAvailability"); + scope.Start(); + try + { + var response = await SynapseKustoPoolKustoPoolsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the kusto pool name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability + /// + /// + /// Operation Id + /// KustoPools_CheckNameAvailability + /// + /// + /// + /// The name of Azure region. + /// The name of the cluster. + /// The cancellation token to use. + /// is null. + public virtual Response CheckKustoPoolNameAvailability(AzureLocation location, KustoPoolNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = SynapseKustoPoolKustoPoolsClientDiagnostics.CreateScope("MockableSynapseSubscriptionResource.CheckKustoPoolNameAvailability"); + scope.Start(); + try + { + var response = SynapseKustoPoolKustoPoolsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 8075636c1e275..0000000000000 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Synapse -{ - /// 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 SynapsePrivateLinkHubResources in the ResourceGroupResource. - /// An object representing collection of SynapsePrivateLinkHubResources and their operations over a SynapsePrivateLinkHubResource. - public virtual SynapsePrivateLinkHubCollection GetSynapsePrivateLinkHubs() - { - return GetCachedClient(Client => new SynapsePrivateLinkHubCollection(Client, Id)); - } - - /// Gets a collection of SynapseWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of SynapseWorkspaceResources and their operations over a SynapseWorkspaceResource. - public virtual SynapseWorkspaceCollection GetSynapseWorkspaces() - { - return GetCachedClient(Client => new SynapseWorkspaceCollection(Client, Id)); - } - } -} diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index a48e7d51276be..0000000000000 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Synapse.Models; - -namespace Azure.ResourceManager.Synapse -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _synapsePrivateLinkHubPrivateLinkHubsClientDiagnostics; - private PrivateLinkHubsRestOperations _synapsePrivateLinkHubPrivateLinkHubsRestClient; - private ClientDiagnostics _synapseWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _synapseWorkspaceWorkspacesRestClient; - private ClientDiagnostics _synapseKustoPoolKustoPoolsClientDiagnostics; - private KustoPoolsRestOperations _synapseKustoPoolKustoPoolsRestClient; - - /// 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 SynapsePrivateLinkHubPrivateLinkHubsClientDiagnostics => _synapsePrivateLinkHubPrivateLinkHubsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Synapse", SynapsePrivateLinkHubResource.ResourceType.Namespace, Diagnostics); - private PrivateLinkHubsRestOperations SynapsePrivateLinkHubPrivateLinkHubsRestClient => _synapsePrivateLinkHubPrivateLinkHubsRestClient ??= new PrivateLinkHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SynapsePrivateLinkHubResource.ResourceType)); - private ClientDiagnostics SynapseWorkspaceWorkspacesClientDiagnostics => _synapseWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Synapse", SynapseWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations SynapseWorkspaceWorkspacesRestClient => _synapseWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SynapseWorkspaceResource.ResourceType)); - private ClientDiagnostics SynapseKustoPoolKustoPoolsClientDiagnostics => _synapseKustoPoolKustoPoolsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Synapse", SynapseKustoPoolResource.ResourceType.Namespace, Diagnostics); - private KustoPoolsRestOperations SynapseKustoPoolKustoPoolsRestClient => _synapseKustoPoolKustoPoolsRestClient ??= new KustoPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SynapseKustoPoolResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Returns a list of privateLinkHubs in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs - /// - /// - /// Operation Id - /// PrivateLinkHubs_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSynapsePrivateLinkHubsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SynapsePrivateLinkHubPrivateLinkHubsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SynapsePrivateLinkHubPrivateLinkHubsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SynapsePrivateLinkHubResource(Client, SynapsePrivateLinkHubData.DeserializeSynapsePrivateLinkHubData(e)), SynapsePrivateLinkHubPrivateLinkHubsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSynapsePrivateLinkHubs", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of privateLinkHubs in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs - /// - /// - /// Operation Id - /// PrivateLinkHubs_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSynapsePrivateLinkHubs(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SynapsePrivateLinkHubPrivateLinkHubsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SynapsePrivateLinkHubPrivateLinkHubsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SynapsePrivateLinkHubResource(Client, SynapsePrivateLinkHubData.DeserializeSynapsePrivateLinkHubData(e)), SynapsePrivateLinkHubPrivateLinkHubsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSynapsePrivateLinkHubs", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of workspaces in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces - /// - /// - /// Operation Id - /// Workspaces_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSynapseWorkspacesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SynapseWorkspaceWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SynapseWorkspaceWorkspacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SynapseWorkspaceResource(Client, SynapseWorkspaceData.DeserializeSynapseWorkspaceData(e)), SynapseWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSynapseWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of workspaces in a subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces - /// - /// - /// Operation Id - /// Workspaces_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSynapseWorkspaces(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SynapseWorkspaceWorkspacesRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SynapseWorkspaceWorkspacesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SynapseWorkspaceResource(Client, SynapseWorkspaceData.DeserializeSynapseWorkspaceData(e)), SynapseWorkspaceWorkspacesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSynapseWorkspaces", "value", "nextLink", cancellationToken); - } - - /// - /// Lists eligible SKUs for Kusto Pool resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus - /// - /// - /// Operation Id - /// KustoPools_ListSkus - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSkusKustoPoolsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SynapseKustoPoolKustoPoolsRestClient.CreateListSkusRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, KustoPoolSkuDescription.DeserializeKustoPoolSkuDescription, SynapseKustoPoolKustoPoolsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkusKustoPools", "value", null, cancellationToken); - } - - /// - /// Lists eligible SKUs for Kusto Pool resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus - /// - /// - /// Operation Id - /// KustoPools_ListSkus - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSkusKustoPools(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SynapseKustoPoolKustoPoolsRestClient.CreateListSkusRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, KustoPoolSkuDescription.DeserializeKustoPoolSkuDescription, SynapseKustoPoolKustoPoolsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSkusKustoPools", "value", null, cancellationToken); - } - - /// - /// Checks that the kusto pool name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability - /// - /// - /// Operation Id - /// KustoPools_CheckNameAvailability - /// - /// - /// - /// The name of Azure region. - /// The name of the cluster. - /// The cancellation token to use. - public virtual async Task> CheckKustoPoolNameAvailabilityAsync(AzureLocation location, KustoPoolNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SynapseKustoPoolKustoPoolsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckKustoPoolNameAvailability"); - scope.Start(); - try - { - var response = await SynapseKustoPoolKustoPoolsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the kusto pool name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability - /// - /// - /// Operation Id - /// KustoPools_CheckNameAvailability - /// - /// - /// - /// The name of Azure region. - /// The name of the cluster. - /// The cancellation token to use. - public virtual Response CheckKustoPoolNameAvailability(AzureLocation location, KustoPoolNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = SynapseKustoPoolKustoPoolsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckKustoPoolNameAvailability"); - scope.Start(); - try - { - var response = SynapseKustoPoolKustoPoolsRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/SynapseExtensions.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/SynapseExtensions.cs index f5cbc1dd43c69..0472ee2df0fbc 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/SynapseExtensions.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/Extensions/SynapseExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Synapse.Mocking; using Azure.ResourceManager.Synapse.Models; namespace Azure.ResourceManager.Synapse @@ -19,1069 +20,897 @@ namespace Azure.ResourceManager.Synapse /// A class to add extension methods to Azure.ResourceManager.Synapse. public static partial class SynapseExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableSynapseArmClient GetMockableSynapseArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableSynapseArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableSynapseResourceGroupResource GetMockableSynapseResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableSynapseResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableSynapseSubscriptionResource GetMockableSynapseSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableSynapseSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region SynapseAadOnlyAuthenticationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseAadOnlyAuthenticationResource GetSynapseAadOnlyAuthenticationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseAadOnlyAuthenticationResource.ValidateResourceId(id); - return new SynapseAadOnlyAuthenticationResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseAadOnlyAuthenticationResource(id); } - #endregion - #region SynapseIPFirewallRuleInfoResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseIPFirewallRuleInfoResource GetSynapseIPFirewallRuleInfoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseIPFirewallRuleInfoResource.ValidateResourceId(id); - return new SynapseIPFirewallRuleInfoResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseIPFirewallRuleInfoResource(id); } - #endregion - #region SynapseKeyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseKeyResource GetSynapseKeyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseKeyResource.ValidateResourceId(id); - return new SynapseKeyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseKeyResource(id); } - #endregion - #region SynapsePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapsePrivateEndpointConnectionResource GetSynapsePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapsePrivateEndpointConnectionResource.ValidateResourceId(id); - return new SynapsePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapsePrivateEndpointConnectionResource(id); } - #endregion - #region SynapseWorkspacePrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseWorkspacePrivateLinkResource GetSynapseWorkspacePrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseWorkspacePrivateLinkResource.ValidateResourceId(id); - return new SynapseWorkspacePrivateLinkResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseWorkspacePrivateLinkResource(id); } - #endregion - #region SynapsePrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapsePrivateLinkResource GetSynapsePrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapsePrivateLinkResource.ValidateResourceId(id); - return new SynapsePrivateLinkResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapsePrivateLinkResource(id); } - #endregion - #region SynapsePrivateLinkHubResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapsePrivateLinkHubResource GetSynapsePrivateLinkHubResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapsePrivateLinkHubResource.ValidateResourceId(id); - return new SynapsePrivateLinkHubResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapsePrivateLinkHubResource(id); } - #endregion - #region SynapsePrivateEndpointConnectionForPrivateLinkHubResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapsePrivateEndpointConnectionForPrivateLinkHubResource GetSynapsePrivateEndpointConnectionForPrivateLinkHubResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapsePrivateEndpointConnectionForPrivateLinkHubResource.ValidateResourceId(id); - return new SynapsePrivateEndpointConnectionForPrivateLinkHubResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapsePrivateEndpointConnectionForPrivateLinkHubResource(id); } - #endregion - #region SynapseSqlPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolResource GetSynapseSqlPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolResource.ValidateResourceId(id); - return new SynapseSqlPoolResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolResource(id); } - #endregion - #region SynapseMetadataSyncConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseMetadataSyncConfigurationResource GetSynapseMetadataSyncConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseMetadataSyncConfigurationResource.ValidateResourceId(id); - return new SynapseMetadataSyncConfigurationResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseMetadataSyncConfigurationResource(id); } - #endregion - #region SynapseGeoBackupPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseGeoBackupPolicyResource GetSynapseGeoBackupPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseGeoBackupPolicyResource.ValidateResourceId(id); - return new SynapseGeoBackupPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseGeoBackupPolicyResource(id); } - #endregion - #region SynapseDataWarehouseUserActivityResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseDataWarehouseUserActivityResource GetSynapseDataWarehouseUserActivityResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseDataWarehouseUserActivityResource.ValidateResourceId(id); - return new SynapseDataWarehouseUserActivityResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseDataWarehouseUserActivityResource(id); } - #endregion - #region SynapseRestorePointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseRestorePointResource GetSynapseRestorePointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseRestorePointResource.ValidateResourceId(id); - return new SynapseRestorePointResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseRestorePointResource(id); } - #endregion - #region SynapseReplicationLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseReplicationLinkResource GetSynapseReplicationLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseReplicationLinkResource.ValidateResourceId(id); - return new SynapseReplicationLinkResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseReplicationLinkResource(id); } - #endregion - #region SynapseMaintenanceWindowResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseMaintenanceWindowResource GetSynapseMaintenanceWindowResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseMaintenanceWindowResource.ValidateResourceId(id); - return new SynapseMaintenanceWindowResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseMaintenanceWindowResource(id); } - #endregion - #region SynapseMaintenanceWindowOptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseMaintenanceWindowOptionResource GetSynapseMaintenanceWindowOptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseMaintenanceWindowOptionResource.ValidateResourceId(id); - return new SynapseMaintenanceWindowOptionResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseMaintenanceWindowOptionResource(id); } - #endregion - #region SynapseTransparentDataEncryptionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseTransparentDataEncryptionResource GetSynapseTransparentDataEncryptionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseTransparentDataEncryptionResource.ValidateResourceId(id); - return new SynapseTransparentDataEncryptionResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseTransparentDataEncryptionResource(id); } - #endregion - #region SynapseSqlPoolBlobAuditingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolBlobAuditingPolicyResource GetSynapseSqlPoolBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolBlobAuditingPolicyResource.ValidateResourceId(id); - return new SynapseSqlPoolBlobAuditingPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolBlobAuditingPolicyResource(id); } - #endregion - #region SynapseSensitivityLabelResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSensitivityLabelResource GetSynapseSensitivityLabelResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSensitivityLabelResource.ValidateResourceId(id); - return new SynapseSensitivityLabelResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSensitivityLabelResource(id); } - #endregion - #region SynapseSqlPoolSchemaResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolSchemaResource GetSynapseSqlPoolSchemaResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolSchemaResource.ValidateResourceId(id); - return new SynapseSqlPoolSchemaResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolSchemaResource(id); } - #endregion - #region SynapseSqlPoolTableResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolTableResource GetSynapseSqlPoolTableResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolTableResource.ValidateResourceId(id); - return new SynapseSqlPoolTableResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolTableResource(id); } - #endregion - #region SynapseSqlPoolConnectionPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolConnectionPolicyResource GetSynapseSqlPoolConnectionPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolConnectionPolicyResource.ValidateResourceId(id); - return new SynapseSqlPoolConnectionPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolConnectionPolicyResource(id); } - #endregion - #region SynapseSqlPoolVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolVulnerabilityAssessmentResource GetSynapseSqlPoolVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolVulnerabilityAssessmentResource.ValidateResourceId(id); - return new SynapseSqlPoolVulnerabilityAssessmentResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolVulnerabilityAssessmentResource(id); } - #endregion - #region SynapseVulnerabilityAssessmentScanRecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseVulnerabilityAssessmentScanRecordResource GetSynapseVulnerabilityAssessmentScanRecordResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseVulnerabilityAssessmentScanRecordResource.ValidateResourceId(id); - return new SynapseVulnerabilityAssessmentScanRecordResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseVulnerabilityAssessmentScanRecordResource(id); } - #endregion - #region SynapseSqlPoolSecurityAlertPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolSecurityAlertPolicyResource GetSynapseSqlPoolSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolSecurityAlertPolicyResource.ValidateResourceId(id); - return new SynapseSqlPoolSecurityAlertPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolSecurityAlertPolicyResource(id); } - #endregion - #region SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource GetSynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource.ValidateResourceId(id); - return new SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource(id); } - #endregion - #region SynapseExtendedSqlPoolBlobAuditingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseExtendedSqlPoolBlobAuditingPolicyResource GetSynapseExtendedSqlPoolBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseExtendedSqlPoolBlobAuditingPolicyResource.ValidateResourceId(id); - return new SynapseExtendedSqlPoolBlobAuditingPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseExtendedSqlPoolBlobAuditingPolicyResource(id); } - #endregion - #region SynapseDataMaskingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseDataMaskingPolicyResource GetSynapseDataMaskingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseDataMaskingPolicyResource.ValidateResourceId(id); - return new SynapseDataMaskingPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseDataMaskingPolicyResource(id); } - #endregion - #region SynapseDataMaskingRuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseDataMaskingRuleResource GetSynapseDataMaskingRuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseDataMaskingRuleResource.ValidateResourceId(id); - return new SynapseDataMaskingRuleResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseDataMaskingRuleResource(id); } - #endregion - #region SynapseSqlPoolColumnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSqlPoolColumnResource GetSynapseSqlPoolColumnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSqlPoolColumnResource.ValidateResourceId(id); - return new SynapseSqlPoolColumnResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSqlPoolColumnResource(id); } - #endregion - #region SynapseWorkloadGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseWorkloadGroupResource GetSynapseWorkloadGroupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseWorkloadGroupResource.ValidateResourceId(id); - return new SynapseWorkloadGroupResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseWorkloadGroupResource(id); } - #endregion - #region SynapseWorkloadClassifierResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseWorkloadClassifierResource GetSynapseWorkloadClassifierResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseWorkloadClassifierResource.ValidateResourceId(id); - return new SynapseWorkloadClassifierResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseWorkloadClassifierResource(id); } - #endregion - #region SynapseServerBlobAuditingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseServerBlobAuditingPolicyResource GetSynapseServerBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseServerBlobAuditingPolicyResource.ValidateResourceId(id); - return new SynapseServerBlobAuditingPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseServerBlobAuditingPolicyResource(id); } - #endregion - #region SynapseExtendedServerBlobAuditingPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseExtendedServerBlobAuditingPolicyResource GetSynapseExtendedServerBlobAuditingPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseExtendedServerBlobAuditingPolicyResource.ValidateResourceId(id); - return new SynapseExtendedServerBlobAuditingPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseExtendedServerBlobAuditingPolicyResource(id); } - #endregion - #region SynapseServerSecurityAlertPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseServerSecurityAlertPolicyResource GetSynapseServerSecurityAlertPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseServerSecurityAlertPolicyResource.ValidateResourceId(id); - return new SynapseServerSecurityAlertPolicyResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseServerSecurityAlertPolicyResource(id); } - #endregion - #region SynapseServerVulnerabilityAssessmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseServerVulnerabilityAssessmentResource GetSynapseServerVulnerabilityAssessmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseServerVulnerabilityAssessmentResource.ValidateResourceId(id); - return new SynapseServerVulnerabilityAssessmentResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseServerVulnerabilityAssessmentResource(id); } - #endregion - #region SynapseEncryptionProtectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseEncryptionProtectorResource GetSynapseEncryptionProtectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseEncryptionProtectorResource.ValidateResourceId(id); - return new SynapseEncryptionProtectorResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseEncryptionProtectorResource(id); } - #endregion - #region SynapseRecoverableSqlPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseRecoverableSqlPoolResource GetSynapseRecoverableSqlPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseRecoverableSqlPoolResource.ValidateResourceId(id); - return new SynapseRecoverableSqlPoolResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseRecoverableSqlPoolResource(id); } - #endregion - #region SynapseDedicatedSqlMinimalTlsSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseDedicatedSqlMinimalTlsSettingResource GetSynapseDedicatedSqlMinimalTlsSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseDedicatedSqlMinimalTlsSettingResource.ValidateResourceId(id); - return new SynapseDedicatedSqlMinimalTlsSettingResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseDedicatedSqlMinimalTlsSettingResource(id); } - #endregion - #region SynapseWorkspaceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseWorkspaceResource GetSynapseWorkspaceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseWorkspaceResource.ValidateResourceId(id); - return new SynapseWorkspaceResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseWorkspaceResource(id); } - #endregion - #region SynapseWorkspaceAdministratorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseWorkspaceAdministratorResource GetSynapseWorkspaceAdministratorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseWorkspaceAdministratorResource.ValidateResourceId(id); - return new SynapseWorkspaceAdministratorResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseWorkspaceAdministratorResource(id); } - #endregion - #region SynapseWorkspaceSqlAdministratorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseWorkspaceSqlAdministratorResource GetSynapseWorkspaceSqlAdministratorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseWorkspaceSqlAdministratorResource.ValidateResourceId(id); - return new SynapseWorkspaceSqlAdministratorResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseWorkspaceSqlAdministratorResource(id); } - #endregion - #region SynapseManagedIdentitySqlControlSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseManagedIdentitySqlControlSettingResource GetSynapseManagedIdentitySqlControlSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseManagedIdentitySqlControlSettingResource.ValidateResourceId(id); - return new SynapseManagedIdentitySqlControlSettingResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseManagedIdentitySqlControlSettingResource(id); } - #endregion - #region SynapseRestorableDroppedSqlPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseRestorableDroppedSqlPoolResource GetSynapseRestorableDroppedSqlPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseRestorableDroppedSqlPoolResource.ValidateResourceId(id); - return new SynapseRestorableDroppedSqlPoolResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseRestorableDroppedSqlPoolResource(id); } - #endregion - #region SynapseBigDataPoolInfoResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseBigDataPoolInfoResource GetSynapseBigDataPoolInfoResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseBigDataPoolInfoResource.ValidateResourceId(id); - return new SynapseBigDataPoolInfoResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseBigDataPoolInfoResource(id); } - #endregion - #region SynapseLibraryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseLibraryResource GetSynapseLibraryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseLibraryResource.ValidateResourceId(id); - return new SynapseLibraryResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseLibraryResource(id); } - #endregion - #region SynapseIntegrationRuntimeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseIntegrationRuntimeResource GetSynapseIntegrationRuntimeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseIntegrationRuntimeResource.ValidateResourceId(id); - return new SynapseIntegrationRuntimeResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseIntegrationRuntimeResource(id); } - #endregion - #region SynapseSparkConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseSparkConfigurationResource GetSynapseSparkConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseSparkConfigurationResource.ValidateResourceId(id); - return new SynapseSparkConfigurationResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseSparkConfigurationResource(id); } - #endregion - #region SynapseKustoPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseKustoPoolResource GetSynapseKustoPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseKustoPoolResource.ValidateResourceId(id); - return new SynapseKustoPoolResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseKustoPoolResource(id); } - #endregion - #region SynapseAttachedDatabaseConfigurationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseAttachedDatabaseConfigurationResource GetSynapseAttachedDatabaseConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseAttachedDatabaseConfigurationResource.ValidateResourceId(id); - return new SynapseAttachedDatabaseConfigurationResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseAttachedDatabaseConfigurationResource(id); } - #endregion - #region SynapseDatabaseResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseDatabaseResource GetSynapseDatabaseResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseDatabaseResource.ValidateResourceId(id); - return new SynapseDatabaseResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseDatabaseResource(id); } - #endregion - #region SynapseDataConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseDataConnectionResource GetSynapseDataConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseDataConnectionResource.ValidateResourceId(id); - return new SynapseDataConnectionResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseDataConnectionResource(id); } - #endregion - #region SynapseClusterPrincipalAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseClusterPrincipalAssignmentResource GetSynapseClusterPrincipalAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseClusterPrincipalAssignmentResource.ValidateResourceId(id); - return new SynapseClusterPrincipalAssignmentResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseClusterPrincipalAssignmentResource(id); } - #endregion - #region SynapseDatabasePrincipalAssignmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SynapseDatabasePrincipalAssignmentResource GetSynapseDatabasePrincipalAssignmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SynapseDatabasePrincipalAssignmentResource.ValidateResourceId(id); - return new SynapseDatabasePrincipalAssignmentResource(client, id); - } - ); + return GetMockableSynapseArmClient(client).GetSynapseDatabasePrincipalAssignmentResource(id); } - #endregion - /// Gets a collection of SynapsePrivateLinkHubResources in the ResourceGroupResource. + /// + /// Gets a collection of SynapsePrivateLinkHubResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SynapsePrivateLinkHubResources and their operations over a SynapsePrivateLinkHubResource. public static SynapsePrivateLinkHubCollection GetSynapsePrivateLinkHubs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSynapsePrivateLinkHubs(); + return GetMockableSynapseResourceGroupResource(resourceGroupResource).GetSynapsePrivateLinkHubs(); } /// @@ -1096,16 +925,20 @@ public static SynapsePrivateLinkHubCollection GetSynapsePrivateLinkHubs(this Res /// PrivateLinkHubs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the privateLinkHub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSynapsePrivateLinkHubAsync(this ResourceGroupResource resourceGroupResource, string privateLinkHubName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSynapsePrivateLinkHubs().GetAsync(privateLinkHubName, cancellationToken).ConfigureAwait(false); + return await GetMockableSynapseResourceGroupResource(resourceGroupResource).GetSynapsePrivateLinkHubAsync(privateLinkHubName, cancellationToken).ConfigureAwait(false); } /// @@ -1120,24 +953,34 @@ public static async Task> GetSynapsePriv /// PrivateLinkHubs_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the privateLinkHub. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSynapsePrivateLinkHub(this ResourceGroupResource resourceGroupResource, string privateLinkHubName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSynapsePrivateLinkHubs().Get(privateLinkHubName, cancellationToken); + return GetMockableSynapseResourceGroupResource(resourceGroupResource).GetSynapsePrivateLinkHub(privateLinkHubName, cancellationToken); } - /// Gets a collection of SynapseWorkspaceResources in the ResourceGroupResource. + /// + /// Gets a collection of SynapseWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SynapseWorkspaceResources and their operations over a SynapseWorkspaceResource. public static SynapseWorkspaceCollection GetSynapseWorkspaces(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSynapseWorkspaces(); + return GetMockableSynapseResourceGroupResource(resourceGroupResource).GetSynapseWorkspaces(); } /// @@ -1152,16 +995,20 @@ public static SynapseWorkspaceCollection GetSynapseWorkspaces(this ResourceGroup /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSynapseWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSynapseWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableSynapseResourceGroupResource(resourceGroupResource).GetSynapseWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// @@ -1176,16 +1023,20 @@ public static async Task> GetSynapseWorkspace /// Workspaces_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the workspace. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSynapseWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSynapseWorkspaces().Get(workspaceName, cancellationToken); + return GetMockableSynapseResourceGroupResource(resourceGroupResource).GetSynapseWorkspace(workspaceName, cancellationToken); } /// @@ -1200,13 +1051,17 @@ public static Response GetSynapseWorkspace(this Resour /// PrivateLinkHubs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSynapsePrivateLinkHubsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSynapsePrivateLinkHubsAsync(cancellationToken); + return GetMockableSynapseSubscriptionResource(subscriptionResource).GetSynapsePrivateLinkHubsAsync(cancellationToken); } /// @@ -1221,13 +1076,17 @@ public static AsyncPageable GetSynapsePrivateLink /// PrivateLinkHubs_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSynapsePrivateLinkHubs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSynapsePrivateLinkHubs(cancellationToken); + return GetMockableSynapseSubscriptionResource(subscriptionResource).GetSynapsePrivateLinkHubs(cancellationToken); } /// @@ -1242,13 +1101,17 @@ public static Pageable GetSynapsePrivateLinkHubs( /// Workspaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSynapseWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSynapseWorkspacesAsync(cancellationToken); + return GetMockableSynapseSubscriptionResource(subscriptionResource).GetSynapseWorkspacesAsync(cancellationToken); } /// @@ -1263,13 +1126,17 @@ public static AsyncPageable GetSynapseWorkspacesAsync( /// Workspaces_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSynapseWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSynapseWorkspaces(cancellationToken); + return GetMockableSynapseSubscriptionResource(subscriptionResource).GetSynapseWorkspaces(cancellationToken); } /// @@ -1284,13 +1151,17 @@ public static Pageable GetSynapseWorkspaces(this Subsc /// KustoPools_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkusKustoPoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusKustoPoolsAsync(cancellationToken); + return GetMockableSynapseSubscriptionResource(subscriptionResource).GetSkusKustoPoolsAsync(cancellationToken); } /// @@ -1305,13 +1176,17 @@ public static AsyncPageable GetSkusKustoPoolsAsync(this /// KustoPools_ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSkusKustoPools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusKustoPools(cancellationToken); + return GetMockableSynapseSubscriptionResource(subscriptionResource).GetSkusKustoPools(cancellationToken); } /// @@ -1326,6 +1201,10 @@ public static Pageable GetSkusKustoPools(this Subscript /// KustoPools_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -1334,9 +1213,7 @@ public static Pageable GetSkusKustoPools(this Subscript /// is null. public static async Task> CheckKustoPoolNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, KustoPoolNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckKustoPoolNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableSynapseSubscriptionResource(subscriptionResource).CheckKustoPoolNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -1351,6 +1228,10 @@ public static async Task> CheckKustoPo /// KustoPools_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -1359,9 +1240,7 @@ public static async Task> CheckKustoPo /// is null. public static Response CheckKustoPoolNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, KustoPoolNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckKustoPoolNameAvailability(location, content, cancellationToken); + return GetMockableSynapseSubscriptionResource(subscriptionResource).CheckKustoPoolNameAvailability(location, content, cancellationToken); } } } diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAadOnlyAuthenticationResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAadOnlyAuthenticationResource.cs index 8cf5abfac333f..9e864630085dd 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAadOnlyAuthenticationResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAadOnlyAuthenticationResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseAadOnlyAuthenticationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The azureADOnlyAuthenticationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, SynapseAadOnlyAuthenticationName azureADOnlyAuthenticationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAttachedDatabaseConfigurationResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAttachedDatabaseConfigurationResource.cs index f2a0d3c42ea40..2213d4873dce5 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAttachedDatabaseConfigurationResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseAttachedDatabaseConfigurationResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseAttachedDatabaseConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The kustoPoolName. + /// The attachedDatabaseConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseBigDataPoolInfoResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseBigDataPoolInfoResource.cs index 7adee1ddf1304..bb7b5b7f168a6 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseBigDataPoolInfoResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseBigDataPoolInfoResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseBigDataPoolInfoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The bigDataPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string bigDataPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseClusterPrincipalAssignmentResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseClusterPrincipalAssignmentResource.cs index 09d26e9bf203b..ae756649516c1 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseClusterPrincipalAssignmentResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseClusterPrincipalAssignmentResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseClusterPrincipalAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The kustoPoolName. + /// The principalAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string kustoPoolName, string principalAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataConnectionResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataConnectionResource.cs index 264fdd7e429b6..3e3f28575bc56 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataConnectionResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataConnectionResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseDataConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The kustoPoolName. + /// The databaseName. + /// The dataConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingPolicyResource.cs index 7d784d0ab0d26..56d3271774a65 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseDataMaskingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/Default"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseDataMaskingRuleResources and their operations over a SynapseDataMaskingRuleResource. public virtual SynapseDataMaskingRuleCollection GetSynapseDataMaskingRules() { - return GetCachedClient(Client => new SynapseDataMaskingRuleCollection(Client, Id)); + return GetCachedClient(client => new SynapseDataMaskingRuleCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual SynapseDataMaskingRuleCollection GetSynapseDataMaskingRules() /// /// The name of the data masking rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseDataMaskingRuleAsync(string dataMaskingRuleName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetSynapseDa /// /// The name of the data masking rule. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseDataMaskingRule(string dataMaskingRuleName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingRuleResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingRuleResource.cs index 73d21435f0c63..641646640d957 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingRuleResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingRuleResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseDataMaskingRuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The dataMaskingRuleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string dataMaskingRuleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/Default/rules/{dataMaskingRuleName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataWarehouseUserActivityResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataWarehouseUserActivityResource.cs index bfd56f9fe22da..780b80088fc30 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataWarehouseUserActivityResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataWarehouseUserActivityResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseDataWarehouseUserActivityResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The dataWarehouseUserActivityName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, SynapseDataWarehouseUserActivityName dataWarehouseUserActivityName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabasePrincipalAssignmentResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabasePrincipalAssignmentResource.cs index 83a516fb24780..06e96ca02e1fc 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabasePrincipalAssignmentResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabasePrincipalAssignmentResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseDatabasePrincipalAssignmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The kustoPoolName. + /// The databaseName. + /// The principalAssignmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseResource.cs index 11d08868d64d4..866556e769aaa 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseDatabaseResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The kustoPoolName. + /// The databaseName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}"; @@ -101,7 +106,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseDataConnectionResources and their operations over a SynapseDataConnectionResource. public virtual SynapseDataConnectionCollection GetSynapseDataConnections() { - return GetCachedClient(Client => new SynapseDataConnectionCollection(Client, Id)); + return GetCachedClient(client => new SynapseDataConnectionCollection(client, Id)); } /// @@ -119,8 +124,8 @@ public virtual SynapseDataConnectionCollection GetSynapseDataConnections() /// /// The name of the data connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseDataConnectionAsync(string dataConnectionName, CancellationToken cancellationToken = default) { @@ -142,8 +147,8 @@ public virtual async Task> GetSynapseDat /// /// The name of the data connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseDataConnection(string dataConnectionName, CancellationToken cancellationToken = default) { @@ -154,7 +159,7 @@ public virtual Response GetSynapseDataConnection( /// An object representing collection of SynapseDatabasePrincipalAssignmentResources and their operations over a SynapseDatabasePrincipalAssignmentResource. public virtual SynapseDatabasePrincipalAssignmentCollection GetSynapseDatabasePrincipalAssignments() { - return GetCachedClient(Client => new SynapseDatabasePrincipalAssignmentCollection(Client, Id)); + return GetCachedClient(client => new SynapseDatabasePrincipalAssignmentCollection(client, Id)); } /// @@ -172,8 +177,8 @@ public virtual SynapseDatabasePrincipalAssignmentCollection GetSynapseDatabasePr /// /// The name of the Kusto principalAssignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseDatabasePrincipalAssignmentAsync(string principalAssignmentName, CancellationToken cancellationToken = default) { @@ -195,8 +200,8 @@ public virtual async Task> /// /// The name of the Kusto principalAssignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseDatabasePrincipalAssignment(string principalAssignmentName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDedicatedSqlMinimalTlsSettingResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDedicatedSqlMinimalTlsSettingResource.cs index 8ffe332fdfdb1..e1c0f0531abaf 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDedicatedSqlMinimalTlsSettingResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDedicatedSqlMinimalTlsSettingResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseDedicatedSqlMinimalTlsSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The dedicatedSQLminimalTlsSettingsName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string dedicatedSQLminimalTlsSettingsName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/dedicatedSQLminimalTlsSettings/{dedicatedSQLminimalTlsSettingsName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseEncryptionProtectorResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseEncryptionProtectorResource.cs index 86ed4339085c1..10fc17b185132 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseEncryptionProtectorResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseEncryptionProtectorResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseEncryptionProtectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The encryptionProtectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, SynapseEncryptionProtectorName encryptionProtectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedServerBlobAuditingPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedServerBlobAuditingPolicyResource.cs index 6aa6a743c36c5..cbb0cca4025a5 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedServerBlobAuditingPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedServerBlobAuditingPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseExtendedServerBlobAuditingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The blobAuditingPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, SynapseBlobAuditingPolicyName blobAuditingPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedSqlPoolBlobAuditingPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedSqlPoolBlobAuditingPolicyResource.cs index f8778e500e593..56e2d19f3e926 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedSqlPoolBlobAuditingPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseExtendedSqlPoolBlobAuditingPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseExtendedSqlPoolBlobAuditingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/default"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseGeoBackupPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseGeoBackupPolicyResource.cs index 0ac4281302d86..37a87f37a96c3 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseGeoBackupPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseGeoBackupPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseGeoBackupPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The geoBackupPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, SynapseGeoBackupPolicyName geoBackupPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIPFirewallRuleInfoResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIPFirewallRuleInfoResource.cs index d792bbeb51033..227a6599d518a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIPFirewallRuleInfoResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIPFirewallRuleInfoResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseIPFirewallRuleInfoResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The ruleName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string ruleName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIntegrationRuntimeResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIntegrationRuntimeResource.cs index a15d1d3fa1568..993c252880724 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIntegrationRuntimeResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseIntegrationRuntimeResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseIntegrationRuntimeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The integrationRuntimeName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string integrationRuntimeName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKeyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKeyResource.cs index fa826b7d78f01..ef3f2472612d5 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKeyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKeyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseKeyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The keyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string keyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolResource.cs index 937a3d380a1b8..5bd829de6688b 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseKustoPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The kustoPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string kustoPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}"; @@ -106,7 +110,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseAttachedDatabaseConfigurationResources and their operations over a SynapseAttachedDatabaseConfigurationResource. public virtual SynapseAttachedDatabaseConfigurationCollection GetSynapseAttachedDatabaseConfigurations() { - return GetCachedClient(Client => new SynapseAttachedDatabaseConfigurationCollection(Client, Id)); + return GetCachedClient(client => new SynapseAttachedDatabaseConfigurationCollection(client, Id)); } /// @@ -124,8 +128,8 @@ public virtual SynapseAttachedDatabaseConfigurationCollection GetSynapseAttached /// /// The name of the attached database configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseAttachedDatabaseConfigurationAsync(string attachedDatabaseConfigurationName, CancellationToken cancellationToken = default) { @@ -147,8 +151,8 @@ public virtual async Task /// /// The name of the attached database configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseAttachedDatabaseConfiguration(string attachedDatabaseConfigurationName, CancellationToken cancellationToken = default) { @@ -159,7 +163,7 @@ public virtual Response GetSynapse /// An object representing collection of SynapseDatabaseResources and their operations over a SynapseDatabaseResource. public virtual SynapseDatabaseCollection GetSynapseDatabases() { - return GetCachedClient(Client => new SynapseDatabaseCollection(Client, Id)); + return GetCachedClient(client => new SynapseDatabaseCollection(client, Id)); } /// @@ -177,8 +181,8 @@ public virtual SynapseDatabaseCollection GetSynapseDatabases() /// /// The name of the database in the Kusto pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseDatabaseAsync(string databaseName, CancellationToken cancellationToken = default) { @@ -200,8 +204,8 @@ public virtual async Task> GetSynapseDatabaseA /// /// The name of the database in the Kusto pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseDatabase(string databaseName, CancellationToken cancellationToken = default) { @@ -212,7 +216,7 @@ public virtual Response GetSynapseDatabase(string datab /// An object representing collection of SynapseClusterPrincipalAssignmentResources and their operations over a SynapseClusterPrincipalAssignmentResource. public virtual SynapseClusterPrincipalAssignmentCollection GetSynapseClusterPrincipalAssignments() { - return GetCachedClient(Client => new SynapseClusterPrincipalAssignmentCollection(Client, Id)); + return GetCachedClient(client => new SynapseClusterPrincipalAssignmentCollection(client, Id)); } /// @@ -230,8 +234,8 @@ public virtual SynapseClusterPrincipalAssignmentCollection GetSynapseClusterPrin /// /// The name of the Kusto principalAssignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseClusterPrincipalAssignmentAsync(string principalAssignmentName, CancellationToken cancellationToken = default) { @@ -253,8 +257,8 @@ public virtual async Task> G /// /// The name of the Kusto principalAssignment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseClusterPrincipalAssignment(string principalAssignmentName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseLibraryResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseLibraryResource.cs index 9df81902c7325..f893cb7a281b2 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseLibraryResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseLibraryResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseLibraryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The libraryName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string libraryName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/libraries/{libraryName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMaintenanceWindowOptionResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMaintenanceWindowOptionResource.cs index b010507a36b41..a967b616819c2 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMaintenanceWindowOptionResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMaintenanceWindowOptionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseMaintenanceWindowOptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenanceWindowOptions/current"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMaintenanceWindowResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMaintenanceWindowResource.cs index 61f6f3557d196..7f71996d31fbc 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMaintenanceWindowResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMaintenanceWindowResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseMaintenanceWindowResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseManagedIdentitySqlControlSettingResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseManagedIdentitySqlControlSettingResource.cs index 4cb42c08c692e..6afb5832f0db8 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseManagedIdentitySqlControlSettingResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseManagedIdentitySqlControlSettingResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseManagedIdentitySqlControlSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMetadataSyncConfigurationResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMetadataSyncConfigurationResource.cs index 6c10fd10da768..4f21484f20381 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMetadataSyncConfigurationResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseMetadataSyncConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseMetadataSyncConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionForPrivateLinkHubResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionForPrivateLinkHubResource.cs index b63f0f7fb8735..089cd735ac76a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionForPrivateLinkHubResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionForPrivateLinkHubResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapsePrivateEndpointConnectionForPrivateLinkHubResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateLinkHubName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateLinkHubName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionResource.cs index bb123da25f758..9d5d7805c6096 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapsePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubResource.cs index 4304d83a1a967..d1900e713d324 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.Synapse public partial class SynapsePrivateLinkHubResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateLinkHubName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateLinkHubName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapsePrivateLinkResources and their operations over a SynapsePrivateLinkResource. public virtual SynapsePrivateLinkResourceCollection GetSynapsePrivateLinkResources() { - return GetCachedClient(Client => new SynapsePrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new SynapsePrivateLinkResourceCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual SynapsePrivateLinkResourceCollection GetSynapsePrivateLinkResourc /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapsePrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetSynapsePrivat /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapsePrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetSynapsePrivateLinkResourc /// An object representing collection of SynapsePrivateEndpointConnectionForPrivateLinkHubResources and their operations over a SynapsePrivateEndpointConnectionForPrivateLinkHubResource. public virtual SynapsePrivateEndpointConnectionForPrivateLinkHubCollection GetSynapsePrivateEndpointConnectionForPrivateLinkHubs() { - return GetCachedClient(Client => new SynapsePrivateEndpointConnectionForPrivateLinkHubCollection(Client, Id)); + return GetCachedClient(client => new SynapsePrivateEndpointConnectionForPrivateLinkHubCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual SynapsePrivateEndpointConnectionForPrivateLinkHubCollection GetSy /// /// Name of the privateEndpointConnection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapsePrivateEndpointConnectionForPrivateLinkHubAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task /// Name of the privateEndpointConnection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapsePrivateEndpointConnectionForPrivateLinkHub(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkResource.cs index a27eeb443f72f..94378e23d7614 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapsePrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The privateLinkHubName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateLinkHubName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRecoverableSqlPoolResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRecoverableSqlPoolResource.cs index b503229681f9d..21dd7b9b33e45 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRecoverableSqlPoolResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRecoverableSqlPoolResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseRecoverableSqlPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlPoolName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseReplicationLinkResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseReplicationLinkResource.cs index c3bc2f5da1205..0df43aa214ceb 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseReplicationLinkResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseReplicationLinkResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseReplicationLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The linkId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string linkId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks/{linkId}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorableDroppedSqlPoolResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorableDroppedSqlPoolResource.cs index 1288cd164e744..35dceec10bbd8 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorableDroppedSqlPoolResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorableDroppedSqlPoolResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseRestorableDroppedSqlPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The restorableDroppedSqlPoolId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string restorableDroppedSqlPoolId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorePointResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorePointResource.cs index 2cb6cf2c4b9cb..4b78beaad6fad 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorePointResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseRestorePointResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseRestorePointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The restorePointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string restorePointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSensitivityLabelResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSensitivityLabelResource.cs index 772ed4b9c6341..1ec97e37d4b1a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSensitivityLabelResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSensitivityLabelResource.cs @@ -26,6 +26,14 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSensitivityLabelResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The schemaName. + /// The tableName. + /// The columnName. + /// The sensitivityLabelSource. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName, SynapseSensitivityLabelSource sensitivityLabelSource) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerBlobAuditingPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerBlobAuditingPolicyResource.cs index cca76a644c142..0dd0078ae8b0f 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerBlobAuditingPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerBlobAuditingPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseServerBlobAuditingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The blobAuditingPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, SynapseBlobAuditingPolicyName blobAuditingPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerSecurityAlertPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerSecurityAlertPolicyResource.cs index e364d2623b1ae..3a1285328ce67 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerSecurityAlertPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerSecurityAlertPolicyResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseServerSecurityAlertPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The securityAlertPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, SqlServerSecurityAlertPolicyName securityAlertPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerVulnerabilityAssessmentResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerVulnerabilityAssessmentResource.cs index 023bad4f95830..e08ca1e107341 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerVulnerabilityAssessmentResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseServerVulnerabilityAssessmentResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseServerVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The vulnerabilityAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSparkConfigurationResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSparkConfigurationResource.cs index 288d07158495e..5a1abbfbb770f 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSparkConfigurationResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSparkConfigurationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSparkConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sparkConfigurationName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sparkConfigurationName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sparkconfigurations/{sparkConfigurationName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolBlobAuditingPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolBlobAuditingPolicyResource.cs index 5cc229d5b1f83..3711a3737afb4 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolBlobAuditingPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolBlobAuditingPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolBlobAuditingPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/default"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnResource.cs index c0a2fd94b55d6..db7206c4b89ce 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolColumnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The schemaName. + /// The tableName. + /// The columnName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName, string columnName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}"; @@ -96,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseSensitivityLabelResources and their operations over a SynapseSensitivityLabelResource. public virtual SynapseSensitivityLabelCollection GetSynapseSensitivityLabels() { - return GetCachedClient(Client => new SynapseSensitivityLabelCollection(Client, Id)); + return GetCachedClient(client => new SynapseSensitivityLabelCollection(client, Id)); } /// diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolConnectionPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolConnectionPolicyResource.cs index 048e5de8f5344..599acbbd3fd37 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolConnectionPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolConnectionPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolConnectionPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The connectionPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolConnectionPolicyName connectionPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolResource.cs index 98d4c7988cfec..7cb1a376cc810 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}"; @@ -118,7 +122,7 @@ public virtual SynapseMetadataSyncConfigurationResource GetSynapseMetadataSyncCo /// An object representing collection of SynapseGeoBackupPolicyResources and their operations over a SynapseGeoBackupPolicyResource. public virtual SynapseGeoBackupPolicyCollection GetSynapseGeoBackupPolicies() { - return GetCachedClient(Client => new SynapseGeoBackupPolicyCollection(Client, Id)); + return GetCachedClient(client => new SynapseGeoBackupPolicyCollection(client, Id)); } /// @@ -167,7 +171,7 @@ public virtual Response GetSynapseGeoBackupPolic /// An object representing collection of SynapseDataWarehouseUserActivityResources and their operations over a SynapseDataWarehouseUserActivityResource. public virtual SynapseDataWarehouseUserActivityCollection GetSynapseDataWarehouseUserActivities() { - return GetCachedClient(Client => new SynapseDataWarehouseUserActivityCollection(Client, Id)); + return GetCachedClient(client => new SynapseDataWarehouseUserActivityCollection(client, Id)); } /// @@ -216,7 +220,7 @@ public virtual Response GetSynapseData /// An object representing collection of SynapseRestorePointResources and their operations over a SynapseRestorePointResource. public virtual SynapseRestorePointCollection GetSynapseRestorePoints() { - return GetCachedClient(Client => new SynapseRestorePointCollection(Client, Id)); + return GetCachedClient(client => new SynapseRestorePointCollection(client, Id)); } /// @@ -234,8 +238,8 @@ public virtual SynapseRestorePointCollection GetSynapseRestorePoints() /// /// The name of the restore point. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseRestorePointAsync(string restorePointName, CancellationToken cancellationToken = default) { @@ -257,8 +261,8 @@ public virtual async Task> GetSynapseResto /// /// The name of the restore point. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseRestorePoint(string restorePointName, CancellationToken cancellationToken = default) { @@ -269,7 +273,7 @@ public virtual Response GetSynapseRestorePoint(stri /// An object representing collection of SynapseReplicationLinkResources and their operations over a SynapseReplicationLinkResource. public virtual SynapseReplicationLinkCollection GetSynapseReplicationLinks() { - return GetCachedClient(Client => new SynapseReplicationLinkCollection(Client, Id)); + return GetCachedClient(client => new SynapseReplicationLinkCollection(client, Id)); } /// @@ -287,8 +291,8 @@ public virtual SynapseReplicationLinkCollection GetSynapseReplicationLinks() /// /// The ID of the replication link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseReplicationLinkAsync(string linkId, CancellationToken cancellationToken = default) { @@ -310,8 +314,8 @@ public virtual async Task> GetSynapseRe /// /// The ID of the replication link. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseReplicationLink(string linkId, CancellationToken cancellationToken = default) { @@ -336,7 +340,7 @@ public virtual SynapseMaintenanceWindowOptionResource GetSynapseMaintenanceWindo /// An object representing collection of SynapseTransparentDataEncryptionResources and their operations over a SynapseTransparentDataEncryptionResource. public virtual SynapseTransparentDataEncryptionCollection GetSynapseTransparentDataEncryptions() { - return GetCachedClient(Client => new SynapseTransparentDataEncryptionCollection(Client, Id)); + return GetCachedClient(client => new SynapseTransparentDataEncryptionCollection(client, Id)); } /// @@ -392,7 +396,7 @@ public virtual SynapseSqlPoolBlobAuditingPolicyResource GetSynapseSqlPoolBlobAud /// An object representing collection of SynapseSqlPoolSchemaResources and their operations over a SynapseSqlPoolSchemaResource. public virtual SynapseSqlPoolSchemaCollection GetSynapseSqlPoolSchemas() { - return GetCachedClient(Client => new SynapseSqlPoolSchemaCollection(Client, Id)); + return GetCachedClient(client => new SynapseSqlPoolSchemaCollection(client, Id)); } /// @@ -410,8 +414,8 @@ public virtual SynapseSqlPoolSchemaCollection GetSynapseSqlPoolSchemas() /// /// The name of the schema. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseSqlPoolSchemaAsync(string schemaName, CancellationToken cancellationToken = default) { @@ -433,8 +437,8 @@ public virtual async Task> GetSynapseSqlP /// /// The name of the schema. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseSqlPoolSchema(string schemaName, CancellationToken cancellationToken = default) { @@ -445,7 +449,7 @@ public virtual Response GetSynapseSqlPoolSchema(st /// An object representing collection of SynapseSqlPoolConnectionPolicyResources and their operations over a SynapseSqlPoolConnectionPolicyResource. public virtual SynapseSqlPoolConnectionPolicyCollection GetSynapseSqlPoolConnectionPolicies() { - return GetCachedClient(Client => new SynapseSqlPoolConnectionPolicyCollection(Client, Id)); + return GetCachedClient(client => new SynapseSqlPoolConnectionPolicyCollection(client, Id)); } /// @@ -494,7 +498,7 @@ public virtual Response GetSynapseSqlPoo /// An object representing collection of SynapseSqlPoolVulnerabilityAssessmentResources and their operations over a SynapseSqlPoolVulnerabilityAssessmentResource. public virtual SynapseSqlPoolVulnerabilityAssessmentCollection GetSynapseSqlPoolVulnerabilityAssessments() { - return GetCachedClient(Client => new SynapseSqlPoolVulnerabilityAssessmentCollection(Client, Id)); + return GetCachedClient(client => new SynapseSqlPoolVulnerabilityAssessmentCollection(client, Id)); } /// @@ -543,7 +547,7 @@ public virtual Response GetSynaps /// An object representing collection of SynapseSqlPoolSecurityAlertPolicyResources and their operations over a SynapseSqlPoolSecurityAlertPolicyResource. public virtual SynapseSqlPoolSecurityAlertPolicyCollection GetSynapseSqlPoolSecurityAlertPolicies() { - return GetCachedClient(Client => new SynapseSqlPoolSecurityAlertPolicyCollection(Client, Id)); + return GetCachedClient(client => new SynapseSqlPoolSecurityAlertPolicyCollection(client, Id)); } /// @@ -606,7 +610,7 @@ public virtual SynapseDataMaskingPolicyResource GetSynapseDataMaskingPolicy() /// An object representing collection of SynapseWorkloadGroupResources and their operations over a SynapseWorkloadGroupResource. public virtual SynapseWorkloadGroupCollection GetSynapseWorkloadGroups() { - return GetCachedClient(Client => new SynapseWorkloadGroupCollection(Client, Id)); + return GetCachedClient(client => new SynapseWorkloadGroupCollection(client, Id)); } /// @@ -624,8 +628,8 @@ public virtual SynapseWorkloadGroupCollection GetSynapseWorkloadGroups() /// /// The name of the workload group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseWorkloadGroupAsync(string workloadGroupName, CancellationToken cancellationToken = default) { @@ -647,8 +651,8 @@ public virtual async Task> GetSynapseWork /// /// The name of the workload group. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseWorkloadGroup(string workloadGroupName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaResource.cs index db9460bb216e3..a7a0509ef0381 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolSchemaResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The schemaName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseSqlPoolTableResources and their operations over a SynapseSqlPoolTableResource. public virtual SynapseSqlPoolTableCollection GetSynapseSqlPoolTables() { - return GetCachedClient(Client => new SynapseSqlPoolTableCollection(Client, Id)); + return GetCachedClient(client => new SynapseSqlPoolTableCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual SynapseSqlPoolTableCollection GetSynapseSqlPoolTables() /// /// The name of the table. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseSqlPoolTableAsync(string tableName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetSynapseSqlPo /// /// The name of the table. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseSqlPoolTable(string tableName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSecurityAlertPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSecurityAlertPolicyResource.cs index 04549e28adb0c..b27419d31e188 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSecurityAlertPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSecurityAlertPolicyResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolSecurityAlertPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The securityAlertPolicyName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, SqlPoolSecurityAlertPolicyName securityAlertPolicyName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableResource.cs index 7df41c3159892..efcf38169f314 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolTableResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The schemaName. + /// The tableName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string schemaName, string tableName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}"; @@ -90,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseSqlPoolColumnResources and their operations over a SynapseSqlPoolColumnResource. public virtual SynapseSqlPoolColumnCollection GetSynapseSqlPoolColumns() { - return GetCachedClient(Client => new SynapseSqlPoolColumnCollection(Client, Id)); + return GetCachedClient(client => new SynapseSqlPoolColumnCollection(client, Id)); } /// @@ -108,8 +114,8 @@ public virtual SynapseSqlPoolColumnCollection GetSynapseSqlPoolColumns() /// /// The name of the column. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseSqlPoolColumnAsync(string columnName, CancellationToken cancellationToken = default) { @@ -131,8 +137,8 @@ public virtual async Task> GetSynapseSqlP /// /// The name of the column. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseSqlPoolColumn(string columnName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentResource.cs index 3e814a675a813..f768d6691a77f 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolVulnerabilityAssessmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The vulnerabilityAssessmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}"; @@ -91,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseVulnerabilityAssessmentScanRecordResources and their operations over a SynapseVulnerabilityAssessmentScanRecordResource. public virtual SynapseVulnerabilityAssessmentScanRecordCollection GetSynapseVulnerabilityAssessmentScanRecords() { - return GetCachedClient(Client => new SynapseVulnerabilityAssessmentScanRecordCollection(Client, Id)); + return GetCachedClient(client => new SynapseVulnerabilityAssessmentScanRecordCollection(client, Id)); } /// @@ -109,8 +114,8 @@ public virtual SynapseVulnerabilityAssessmentScanRecordCollection GetSynapseVuln /// /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseVulnerabilityAssessmentScanRecordAsync(string scanId, CancellationToken cancellationToken = default) { @@ -132,8 +137,8 @@ public virtual async Task /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseVulnerabilityAssessmentScanRecord(string scanId, CancellationToken cancellationToken = default) { @@ -144,7 +149,7 @@ public virtual Response GetSyn /// An object representing collection of SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResources and their operations over a SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource. public virtual SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection GetSynapseSqlPoolVulnerabilityAssessmentRuleBaselines() { - return GetCachedClient(Client => new SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection(Client, Id)); + return GetCachedClient(client => new SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection(client, Id)); } /// @@ -163,8 +168,8 @@ public virtual SynapseSqlPoolVulnerabilityAssessmentRuleBaselineCollection GetSy /// The vulnerability assessment rule ID. /// The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for server level rule). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseSqlPoolVulnerabilityAssessmentRuleBaselineAsync(string ruleId, SynapseVulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) { @@ -187,8 +192,8 @@ public virtual async Task The vulnerability assessment rule ID. /// The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for server level rule). /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseSqlPoolVulnerabilityAssessmentRuleBaseline(string ruleId, SynapseVulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource.cs index 58476f0a28c41..a79d311ad70e6 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseSqlPoolVulnerabilityAssessmentRuleBaselineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The vulnerabilityAssessmentName. + /// The ruleId. + /// The baselineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName, string ruleId, SynapseVulnerabilityAssessmentPolicyBaselineName baselineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseTransparentDataEncryptionResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseTransparentDataEncryptionResource.cs index 7c63576d85033..5deb21c4e879a 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseTransparentDataEncryptionResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseTransparentDataEncryptionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseTransparentDataEncryptionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The transparentDataEncryptionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, SynapseTransparentDataEncryptionName transparentDataEncryptionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseVulnerabilityAssessmentScanRecordResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseVulnerabilityAssessmentScanRecordResource.cs index a92873cb7d0d3..1d56081340f30 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseVulnerabilityAssessmentScanRecordResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseVulnerabilityAssessmentScanRecordResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseVulnerabilityAssessmentScanRecordResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The vulnerabilityAssessmentName. + /// The scanId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, SynapseVulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadClassifierResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadClassifierResource.cs index f80d62c1e43ce..e8f0dbba0a8df 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadClassifierResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadClassifierResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseWorkloadClassifierResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The workloadGroupName. + /// The workloadClassifierName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string workloadGroupName, string workloadClassifierName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupResource.cs index 82785de75f0f4..6135377687631 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseWorkloadGroupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The sqlPoolName. + /// The workloadGroupName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string sqlPoolName, string workloadGroupName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseWorkloadClassifierResources and their operations over a SynapseWorkloadClassifierResource. public virtual SynapseWorkloadClassifierCollection GetSynapseWorkloadClassifiers() { - return GetCachedClient(Client => new SynapseWorkloadClassifierCollection(Client, Id)); + return GetCachedClient(client => new SynapseWorkloadClassifierCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual SynapseWorkloadClassifierCollection GetSynapseWorkloadClassifiers /// /// The name of the workload classifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseWorkloadClassifierAsync(string workloadClassifierName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetSynaps /// /// The name of the workload classifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseWorkloadClassifier(string workloadClassifierName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceAdministratorResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceAdministratorResource.cs index 097aa84f66b24..a2c6655f9c143 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceAdministratorResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceAdministratorResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseWorkspaceAdministratorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspacePrivateLinkResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspacePrivateLinkResource.cs index 820b1de9de57a..59115888e5be6 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspacePrivateLinkResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspacePrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseWorkspacePrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + /// The privateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName}"; diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceResource.cs index 61f3185f5a7a6..ffd9b4576db74 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseWorkspaceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}"; @@ -103,7 +106,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SynapseAadOnlyAuthenticationResources and their operations over a SynapseAadOnlyAuthenticationResource. public virtual SynapseAadOnlyAuthenticationCollection GetSynapseAadOnlyAuthentications() { - return GetCachedClient(Client => new SynapseAadOnlyAuthenticationCollection(Client, Id)); + return GetCachedClient(client => new SynapseAadOnlyAuthenticationCollection(client, Id)); } /// @@ -152,7 +155,7 @@ public virtual Response GetSynapseAadOnlyA /// An object representing collection of SynapseIPFirewallRuleInfoResources and their operations over a SynapseIPFirewallRuleInfoResource. public virtual SynapseIPFirewallRuleInfoCollection GetSynapseIPFirewallRuleInfos() { - return GetCachedClient(Client => new SynapseIPFirewallRuleInfoCollection(Client, Id)); + return GetCachedClient(client => new SynapseIPFirewallRuleInfoCollection(client, Id)); } /// @@ -170,8 +173,8 @@ public virtual SynapseIPFirewallRuleInfoCollection GetSynapseIPFirewallRuleInfos /// /// The IP firewall rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseIPFirewallRuleInfoAsync(string ruleName, CancellationToken cancellationToken = default) { @@ -193,8 +196,8 @@ public virtual async Task> GetSynaps /// /// The IP firewall rule name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseIPFirewallRuleInfo(string ruleName, CancellationToken cancellationToken = default) { @@ -205,7 +208,7 @@ public virtual Response GetSynapseIPFirewallR /// An object representing collection of SynapseKeyResources and their operations over a SynapseKeyResource. public virtual SynapseKeyCollection GetSynapseKeys() { - return GetCachedClient(Client => new SynapseKeyCollection(Client, Id)); + return GetCachedClient(client => new SynapseKeyCollection(client, Id)); } /// @@ -223,8 +226,8 @@ public virtual SynapseKeyCollection GetSynapseKeys() /// /// The name of the workspace key. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseKeyAsync(string keyName, CancellationToken cancellationToken = default) { @@ -246,8 +249,8 @@ public virtual async Task> GetSynapseKeyAsync(strin /// /// The name of the workspace key. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseKey(string keyName, CancellationToken cancellationToken = default) { @@ -258,7 +261,7 @@ public virtual Response GetSynapseKey(string keyName, Cancel /// An object representing collection of SynapsePrivateEndpointConnectionResources and their operations over a SynapsePrivateEndpointConnectionResource. public virtual SynapsePrivateEndpointConnectionCollection GetSynapsePrivateEndpointConnections() { - return GetCachedClient(Client => new SynapsePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new SynapsePrivateEndpointConnectionCollection(client, Id)); } /// @@ -276,8 +279,8 @@ public virtual SynapsePrivateEndpointConnectionCollection GetSynapsePrivateEndpo /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapsePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -299,8 +302,8 @@ public virtual async Task> Ge /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapsePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -311,7 +314,7 @@ public virtual Response GetSynapsePriv /// An object representing collection of SynapseWorkspacePrivateLinkResources and their operations over a SynapseWorkspacePrivateLinkResource. public virtual SynapseWorkspacePrivateLinkResourceCollection GetSynapseWorkspacePrivateLinkResources() { - return GetCachedClient(Client => new SynapseWorkspacePrivateLinkResourceCollection(Client, Id)); + return GetCachedClient(client => new SynapseWorkspacePrivateLinkResourceCollection(client, Id)); } /// @@ -329,8 +332,8 @@ public virtual SynapseWorkspacePrivateLinkResourceCollection GetSynapseWorkspace /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseWorkspacePrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -352,8 +355,8 @@ public virtual async Task> GetSyna /// /// The name of the private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseWorkspacePrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) { @@ -364,7 +367,7 @@ public virtual Response GetSynapseWorkspace /// An object representing collection of SynapseSqlPoolResources and their operations over a SynapseSqlPoolResource. public virtual SynapseSqlPoolCollection GetSynapseSqlPools() { - return GetCachedClient(Client => new SynapseSqlPoolCollection(Client, Id)); + return GetCachedClient(client => new SynapseSqlPoolCollection(client, Id)); } /// @@ -382,8 +385,8 @@ public virtual SynapseSqlPoolCollection GetSynapseSqlPools() /// /// SQL pool name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseSqlPoolAsync(string sqlPoolName, CancellationToken cancellationToken = default) { @@ -405,8 +408,8 @@ public virtual async Task> GetSynapseSqlPoolAsy /// /// SQL pool name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseSqlPool(string sqlPoolName, CancellationToken cancellationToken = default) { @@ -417,7 +420,7 @@ public virtual Response GetSynapseSqlPool(string sqlPool /// An object representing collection of SynapseServerBlobAuditingPolicyResources and their operations over a SynapseServerBlobAuditingPolicyResource. public virtual SynapseServerBlobAuditingPolicyCollection GetSynapseServerBlobAuditingPolicies() { - return GetCachedClient(Client => new SynapseServerBlobAuditingPolicyCollection(Client, Id)); + return GetCachedClient(client => new SynapseServerBlobAuditingPolicyCollection(client, Id)); } /// @@ -466,7 +469,7 @@ public virtual Response GetSynapseServe /// An object representing collection of SynapseExtendedServerBlobAuditingPolicyResources and their operations over a SynapseExtendedServerBlobAuditingPolicyResource. public virtual SynapseExtendedServerBlobAuditingPolicyCollection GetSynapseExtendedServerBlobAuditingPolicies() { - return GetCachedClient(Client => new SynapseExtendedServerBlobAuditingPolicyCollection(Client, Id)); + return GetCachedClient(client => new SynapseExtendedServerBlobAuditingPolicyCollection(client, Id)); } /// @@ -515,7 +518,7 @@ public virtual Response GetSyna /// An object representing collection of SynapseServerSecurityAlertPolicyResources and their operations over a SynapseServerSecurityAlertPolicyResource. public virtual SynapseServerSecurityAlertPolicyCollection GetSynapseServerSecurityAlertPolicies() { - return GetCachedClient(Client => new SynapseServerSecurityAlertPolicyCollection(Client, Id)); + return GetCachedClient(client => new SynapseServerSecurityAlertPolicyCollection(client, Id)); } /// @@ -564,7 +567,7 @@ public virtual Response GetSynapseServ /// An object representing collection of SynapseServerVulnerabilityAssessmentResources and their operations over a SynapseServerVulnerabilityAssessmentResource. public virtual SynapseServerVulnerabilityAssessmentCollection GetSynapseServerVulnerabilityAssessments() { - return GetCachedClient(Client => new SynapseServerVulnerabilityAssessmentCollection(Client, Id)); + return GetCachedClient(client => new SynapseServerVulnerabilityAssessmentCollection(client, Id)); } /// @@ -613,7 +616,7 @@ public virtual Response GetSynapse /// An object representing collection of SynapseEncryptionProtectorResources and their operations over a SynapseEncryptionProtectorResource. public virtual SynapseEncryptionProtectorCollection GetSynapseEncryptionProtectors() { - return GetCachedClient(Client => new SynapseEncryptionProtectorCollection(Client, Id)); + return GetCachedClient(client => new SynapseEncryptionProtectorCollection(client, Id)); } /// @@ -662,7 +665,7 @@ public virtual Response GetSynapseEncryption /// An object representing collection of SynapseRecoverableSqlPoolResources and their operations over a SynapseRecoverableSqlPoolResource. public virtual SynapseRecoverableSqlPoolCollection GetSynapseRecoverableSqlPools() { - return GetCachedClient(Client => new SynapseRecoverableSqlPoolCollection(Client, Id)); + return GetCachedClient(client => new SynapseRecoverableSqlPoolCollection(client, Id)); } /// @@ -680,8 +683,8 @@ public virtual SynapseRecoverableSqlPoolCollection GetSynapseRecoverableSqlPools /// /// The name of the sql pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseRecoverableSqlPoolAsync(string sqlPoolName, CancellationToken cancellationToken = default) { @@ -703,8 +706,8 @@ public virtual async Task> GetSynaps /// /// The name of the sql pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseRecoverableSqlPool(string sqlPoolName, CancellationToken cancellationToken = default) { @@ -715,7 +718,7 @@ public virtual Response GetSynapseRecoverable /// An object representing collection of SynapseDedicatedSqlMinimalTlsSettingResources and their operations over a SynapseDedicatedSqlMinimalTlsSettingResource. public virtual SynapseDedicatedSqlMinimalTlsSettingCollection GetSynapseDedicatedSqlMinimalTlsSettings() { - return GetCachedClient(Client => new SynapseDedicatedSqlMinimalTlsSettingCollection(Client, Id)); + return GetCachedClient(client => new SynapseDedicatedSqlMinimalTlsSettingCollection(client, Id)); } /// @@ -733,8 +736,8 @@ public virtual SynapseDedicatedSqlMinimalTlsSettingCollection GetSynapseDedicate /// /// The name of the dedicated sql minimal tls settings. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseDedicatedSqlMinimalTlsSettingAsync(string dedicatedSQLminimalTlsSettingsName, CancellationToken cancellationToken = default) { @@ -756,8 +759,8 @@ public virtual async Task /// /// The name of the dedicated sql minimal tls settings. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseDedicatedSqlMinimalTlsSetting(string dedicatedSQLminimalTlsSettingsName, CancellationToken cancellationToken = default) { @@ -789,7 +792,7 @@ public virtual SynapseManagedIdentitySqlControlSettingResource GetSynapseManaged /// An object representing collection of SynapseRestorableDroppedSqlPoolResources and their operations over a SynapseRestorableDroppedSqlPoolResource. public virtual SynapseRestorableDroppedSqlPoolCollection GetSynapseRestorableDroppedSqlPools() { - return GetCachedClient(Client => new SynapseRestorableDroppedSqlPoolCollection(Client, Id)); + return GetCachedClient(client => new SynapseRestorableDroppedSqlPoolCollection(client, Id)); } /// @@ -807,8 +810,8 @@ public virtual SynapseRestorableDroppedSqlPoolCollection GetSynapseRestorableDro /// /// The id of the deleted Sql Pool in the form of sqlPoolName,deletionTimeInFileTimeFormat. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseRestorableDroppedSqlPoolAsync(string restorableDroppedSqlPoolId, CancellationToken cancellationToken = default) { @@ -830,8 +833,8 @@ public virtual async Task> Get /// /// The id of the deleted Sql Pool in the form of sqlPoolName,deletionTimeInFileTimeFormat. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseRestorableDroppedSqlPool(string restorableDroppedSqlPoolId, CancellationToken cancellationToken = default) { @@ -842,7 +845,7 @@ public virtual Response GetSynapseResto /// An object representing collection of SynapseBigDataPoolInfoResources and their operations over a SynapseBigDataPoolInfoResource. public virtual SynapseBigDataPoolInfoCollection GetSynapseBigDataPoolInfos() { - return GetCachedClient(Client => new SynapseBigDataPoolInfoCollection(Client, Id)); + return GetCachedClient(client => new SynapseBigDataPoolInfoCollection(client, Id)); } /// @@ -860,8 +863,8 @@ public virtual SynapseBigDataPoolInfoCollection GetSynapseBigDataPoolInfos() /// /// Big Data pool name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseBigDataPoolInfoAsync(string bigDataPoolName, CancellationToken cancellationToken = default) { @@ -883,8 +886,8 @@ public virtual async Task> GetSynapseBi /// /// Big Data pool name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseBigDataPoolInfo(string bigDataPoolName, CancellationToken cancellationToken = default) { @@ -895,7 +898,7 @@ public virtual Response GetSynapseBigDataPoolInf /// An object representing collection of SynapseLibraryResources and their operations over a SynapseLibraryResource. public virtual SynapseLibraryCollection GetSynapseLibraries() { - return GetCachedClient(Client => new SynapseLibraryCollection(Client, Id)); + return GetCachedClient(client => new SynapseLibraryCollection(client, Id)); } /// @@ -913,8 +916,8 @@ public virtual SynapseLibraryCollection GetSynapseLibraries() /// /// Library name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseLibraryAsync(string libraryName, CancellationToken cancellationToken = default) { @@ -936,8 +939,8 @@ public virtual async Task> GetSynapseLibraryAsy /// /// Library name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseLibrary(string libraryName, CancellationToken cancellationToken = default) { @@ -948,7 +951,7 @@ public virtual Response GetSynapseLibrary(string library /// An object representing collection of SynapseIntegrationRuntimeResources and their operations over a SynapseIntegrationRuntimeResource. public virtual SynapseIntegrationRuntimeCollection GetSynapseIntegrationRuntimes() { - return GetCachedClient(Client => new SynapseIntegrationRuntimeCollection(Client, Id)); + return GetCachedClient(client => new SynapseIntegrationRuntimeCollection(client, Id)); } /// @@ -967,8 +970,8 @@ public virtual SynapseIntegrationRuntimeCollection GetSynapseIntegrationRuntimes /// Integration runtime name. /// ETag of the integration runtime entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseIntegrationRuntimeAsync(string integrationRuntimeName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -991,8 +994,8 @@ public virtual async Task> GetSynaps /// Integration runtime name. /// ETag of the integration runtime entity. Should only be specified for get. If the ETag matches the existing entity tag, or if * was provided, then no content will be returned. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseIntegrationRuntime(string integrationRuntimeName, string ifNoneMatch = null, CancellationToken cancellationToken = default) { @@ -1003,7 +1006,7 @@ public virtual Response GetSynapseIntegration /// An object representing collection of SynapseSparkConfigurationResources and their operations over a SynapseSparkConfigurationResource. public virtual SynapseSparkConfigurationCollection GetSynapseSparkConfigurations() { - return GetCachedClient(Client => new SynapseSparkConfigurationCollection(Client, Id)); + return GetCachedClient(client => new SynapseSparkConfigurationCollection(client, Id)); } /// @@ -1021,8 +1024,8 @@ public virtual SynapseSparkConfigurationCollection GetSynapseSparkConfigurations /// /// SparkConfiguration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseSparkConfigurationAsync(string sparkConfigurationName, CancellationToken cancellationToken = default) { @@ -1044,8 +1047,8 @@ public virtual async Task> GetSynaps /// /// SparkConfiguration name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseSparkConfiguration(string sparkConfigurationName, CancellationToken cancellationToken = default) { @@ -1056,7 +1059,7 @@ public virtual Response GetSynapseSparkConfig /// An object representing collection of SynapseKustoPoolResources and their operations over a SynapseKustoPoolResource. public virtual SynapseKustoPoolCollection GetSynapseKustoPools() { - return GetCachedClient(Client => new SynapseKustoPoolCollection(Client, Id)); + return GetCachedClient(client => new SynapseKustoPoolCollection(client, Id)); } /// @@ -1074,8 +1077,8 @@ public virtual SynapseKustoPoolCollection GetSynapseKustoPools() /// /// The name of the Kusto pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSynapseKustoPoolAsync(string kustoPoolName, CancellationToken cancellationToken = default) { @@ -1097,8 +1100,8 @@ public virtual async Task> GetSynapseKustoPoo /// /// The name of the Kusto pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSynapseKustoPool(string kustoPoolName, CancellationToken cancellationToken = default) { diff --git a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceSqlAdministratorResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceSqlAdministratorResource.cs index eaab25192d7d4..eb49daaf66626 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceSqlAdministratorResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceSqlAdministratorResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Synapse public partial class SynapseWorkspaceSqlAdministratorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory"; diff --git a/sdk/tables/Azure.Data.Tables/src/autorest.md b/sdk/tables/Azure.Data.Tables/src/autorest.md index b0cf1356a418c..43ddaf9f7a197 100644 --- a/sdk/tables/Azure.Data.Tables/src/autorest.md +++ b/sdk/tables/Azure.Data.Tables/src/autorest.md @@ -37,5 +37,7 @@ directive: from: swagger-document where: $.definitions.AccessPolicy transform: > + $.properties.Start["x-nullable"] = true; + $.properties.Expiry["x-nullable"] = true; $.properties.Permission["x-nullable"] = true; ``` diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/api/Azure.ResourceManager.TrafficManager.netstandard2.0.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/api/Azure.ResourceManager.TrafficManager.netstandard2.0.cs index 0f9d00dae9718..a2de5687c1a8f 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/api/Azure.ResourceManager.TrafficManager.netstandard2.0.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/api/Azure.ResourceManager.TrafficManager.netstandard2.0.cs @@ -186,6 +186,41 @@ protected TrafficManagerUserMetricsResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.TrafficManager.Mocking +{ + public partial class MockableTrafficManagerArmClient : Azure.ResourceManager.ArmResource + { + protected MockableTrafficManagerArmClient() { } + public virtual Azure.ResourceManager.TrafficManager.TrafficManagerEndpointResource GetTrafficManagerEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.TrafficManager.TrafficManagerGeographicHierarchyResource GetTrafficManagerGeographicHierarchyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.TrafficManager.TrafficManagerHeatMapResource GetTrafficManagerHeatMapResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.TrafficManager.TrafficManagerProfileResource GetTrafficManagerProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.TrafficManager.TrafficManagerUserMetricsResource GetTrafficManagerUserMetricsResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableTrafficManagerResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableTrafficManagerResourceGroupResource() { } + public virtual Azure.Response GetTrafficManagerProfile(string profileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTrafficManagerProfileAsync(string profileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.TrafficManager.TrafficManagerProfileCollection GetTrafficManagerProfiles() { throw null; } + } + public partial class MockableTrafficManagerSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableTrafficManagerSubscriptionResource() { } + public virtual Azure.Response CheckTrafficManagerNameAvailabilityV2(Azure.ResourceManager.TrafficManager.Models.TrafficManagerRelativeDnsNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckTrafficManagerNameAvailabilityV2Async(Azure.ResourceManager.TrafficManager.Models.TrafficManagerRelativeDnsNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetTrafficManagerProfiles(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetTrafficManagerProfilesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.TrafficManager.TrafficManagerUserMetricsResource GetTrafficManagerUserMetrics() { throw null; } + } + public partial class MockableTrafficManagerTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableTrafficManagerTenantResource() { } + public virtual Azure.Response CheckTrafficManagerRelativeDnsNameAvailability(Azure.ResourceManager.TrafficManager.Models.TrafficManagerRelativeDnsNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckTrafficManagerRelativeDnsNameAvailabilityAsync(Azure.ResourceManager.TrafficManager.Models.TrafficManagerRelativeDnsNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.TrafficManager.TrafficManagerGeographicHierarchyResource GetTrafficManagerGeographicHierarchy() { throw null; } + } +} namespace Azure.ResourceManager.TrafficManager.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerArmClient.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerArmClient.cs new file mode 100644 index 0000000000000..c1b600cd945c5 --- /dev/null +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerArmClient.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.TrafficManager; + +namespace Azure.ResourceManager.TrafficManager.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableTrafficManagerArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableTrafficManagerArmClient() + { + } + + /// 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 MockableTrafficManagerArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableTrafficManagerArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TrafficManagerEndpointResource GetTrafficManagerEndpointResource(ResourceIdentifier id) + { + TrafficManagerEndpointResource.ValidateResourceId(id); + return new TrafficManagerEndpointResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TrafficManagerProfileResource GetTrafficManagerProfileResource(ResourceIdentifier id) + { + TrafficManagerProfileResource.ValidateResourceId(id); + return new TrafficManagerProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TrafficManagerGeographicHierarchyResource GetTrafficManagerGeographicHierarchyResource(ResourceIdentifier id) + { + TrafficManagerGeographicHierarchyResource.ValidateResourceId(id); + return new TrafficManagerGeographicHierarchyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TrafficManagerHeatMapResource GetTrafficManagerHeatMapResource(ResourceIdentifier id) + { + TrafficManagerHeatMapResource.ValidateResourceId(id); + return new TrafficManagerHeatMapResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TrafficManagerUserMetricsResource GetTrafficManagerUserMetricsResource(ResourceIdentifier id) + { + TrafficManagerUserMetricsResource.ValidateResourceId(id); + return new TrafficManagerUserMetricsResource(Client, id); + } + } +} diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerResourceGroupResource.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerResourceGroupResource.cs new file mode 100644 index 0000000000000..407401526ac7a --- /dev/null +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.TrafficManager; + +namespace Azure.ResourceManager.TrafficManager.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableTrafficManagerResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableTrafficManagerResourceGroupResource() + { + } + + /// 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 MockableTrafficManagerResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of TrafficManagerProfileResources in the ResourceGroupResource. + /// An object representing collection of TrafficManagerProfileResources and their operations over a TrafficManagerProfileResource. + public virtual TrafficManagerProfileCollection GetTrafficManagerProfiles() + { + return GetCachedClient(client => new TrafficManagerProfileCollection(client, Id)); + } + + /// + /// Gets a Traffic Manager profile. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// The name of the Traffic Manager profile. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTrafficManagerProfileAsync(string profileName, CancellationToken cancellationToken = default) + { + return await GetTrafficManagerProfiles().GetAsync(profileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Traffic Manager profile. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName} + /// + /// + /// Operation Id + /// Profiles_Get + /// + /// + /// + /// The name of the Traffic Manager profile. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTrafficManagerProfile(string profileName, CancellationToken cancellationToken = default) + { + return GetTrafficManagerProfiles().Get(profileName, cancellationToken); + } + } +} diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerSubscriptionResource.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerSubscriptionResource.cs new file mode 100644 index 0000000000000..f101a646561a8 --- /dev/null +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerSubscriptionResource.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.TrafficManager; +using Azure.ResourceManager.TrafficManager.Models; + +namespace Azure.ResourceManager.TrafficManager.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableTrafficManagerSubscriptionResource : ArmResource + { + private ClientDiagnostics _trafficManagerProfileProfilesClientDiagnostics; + private ProfilesRestOperations _trafficManagerProfileProfilesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableTrafficManagerSubscriptionResource() + { + } + + /// 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 MockableTrafficManagerSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics TrafficManagerProfileProfilesClientDiagnostics => _trafficManagerProfileProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.TrafficManager", TrafficManagerProfileResource.ResourceType.Namespace, Diagnostics); + private ProfilesRestOperations TrafficManagerProfileProfilesRestClient => _trafficManagerProfileProfilesRestClient ??= new ProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TrafficManagerProfileResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets an object representing a TrafficManagerUserMetricsResource along with the instance operations that can be performed on it in the SubscriptionResource. + /// Returns a object. + public virtual TrafficManagerUserMetricsResource GetTrafficManagerUserMetrics() + { + return new TrafficManagerUserMetricsResource(Client, Id.AppendProviderResource("Microsoft.Network", "trafficManagerUserMetricsKeys", "default")); + } + + /// + /// Checks the availability of a Traffic Manager Relative DNS name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/checkTrafficManagerNameAvailabilityV2 + /// + /// + /// Operation Id + /// Profiles_checkTrafficManagerNameAvailabilityV2 + /// + /// + /// + /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckTrafficManagerNameAvailabilityV2Async(TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = TrafficManagerProfileProfilesClientDiagnostics.CreateScope("MockableTrafficManagerSubscriptionResource.CheckTrafficManagerNameAvailabilityV2"); + scope.Start(); + try + { + var response = await TrafficManagerProfileProfilesRestClient.CheckTrafficManagerNameAvailabilityV2Async(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks the availability of a Traffic Manager Relative DNS name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/checkTrafficManagerNameAvailabilityV2 + /// + /// + /// Operation Id + /// Profiles_checkTrafficManagerNameAvailabilityV2 + /// + /// + /// + /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. + /// The cancellation token to use. + /// is null. + public virtual Response CheckTrafficManagerNameAvailabilityV2(TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = TrafficManagerProfileProfilesClientDiagnostics.CreateScope("MockableTrafficManagerSubscriptionResource.CheckTrafficManagerNameAvailabilityV2"); + scope.Start(); + try + { + var response = TrafficManagerProfileProfilesRestClient.CheckTrafficManagerNameAvailabilityV2(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all Traffic Manager profiles within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles + /// + /// + /// Operation Id + /// Profiles_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetTrafficManagerProfilesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TrafficManagerProfileProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new TrafficManagerProfileResource(Client, TrafficManagerProfileData.DeserializeTrafficManagerProfileData(e)), TrafficManagerProfileProfilesClientDiagnostics, Pipeline, "MockableTrafficManagerSubscriptionResource.GetTrafficManagerProfiles", "value", null, cancellationToken); + } + + /// + /// Lists all Traffic Manager profiles within a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles + /// + /// + /// Operation Id + /// Profiles_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetTrafficManagerProfiles(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => TrafficManagerProfileProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new TrafficManagerProfileResource(Client, TrafficManagerProfileData.DeserializeTrafficManagerProfileData(e)), TrafficManagerProfileProfilesClientDiagnostics, Pipeline, "MockableTrafficManagerSubscriptionResource.GetTrafficManagerProfiles", "value", null, cancellationToken); + } + } +} diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerTenantResource.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerTenantResource.cs new file mode 100644 index 0000000000000..56ccc1cf05570 --- /dev/null +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/MockableTrafficManagerTenantResource.cs @@ -0,0 +1,122 @@ +// 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; +using Azure.ResourceManager.TrafficManager; +using Azure.ResourceManager.TrafficManager.Models; + +namespace Azure.ResourceManager.TrafficManager.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableTrafficManagerTenantResource : ArmResource + { + private ClientDiagnostics _trafficManagerProfileProfilesClientDiagnostics; + private ProfilesRestOperations _trafficManagerProfileProfilesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableTrafficManagerTenantResource() + { + } + + /// 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 MockableTrafficManagerTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics TrafficManagerProfileProfilesClientDiagnostics => _trafficManagerProfileProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.TrafficManager", TrafficManagerProfileResource.ResourceType.Namespace, Diagnostics); + private ProfilesRestOperations TrafficManagerProfileProfilesRestClient => _trafficManagerProfileProfilesRestClient ??= new ProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TrafficManagerProfileResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets an object representing a TrafficManagerGeographicHierarchyResource along with the instance operations that can be performed on it in the TenantResource. + /// Returns a object. + public virtual TrafficManagerGeographicHierarchyResource GetTrafficManagerGeographicHierarchy() + { + return new TrafficManagerGeographicHierarchyResource(Client, Id.AppendProviderResource("Microsoft.Network", "trafficManagerGeographicHierarchies", "default")); + } + + /// + /// Checks the availability of a Traffic Manager Relative DNS name. + /// + /// + /// Request Path + /// /providers/Microsoft.Network/checkTrafficManagerNameAvailability + /// + /// + /// Operation Id + /// Profiles_CheckTrafficManagerRelativeDnsNameAvailability + /// + /// + /// + /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckTrafficManagerRelativeDnsNameAvailabilityAsync(TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = TrafficManagerProfileProfilesClientDiagnostics.CreateScope("MockableTrafficManagerTenantResource.CheckTrafficManagerRelativeDnsNameAvailability"); + scope.Start(); + try + { + var response = await TrafficManagerProfileProfilesRestClient.CheckTrafficManagerRelativeDnsNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks the availability of a Traffic Manager Relative DNS name. + /// + /// + /// Request Path + /// /providers/Microsoft.Network/checkTrafficManagerNameAvailability + /// + /// + /// Operation Id + /// Profiles_CheckTrafficManagerRelativeDnsNameAvailability + /// + /// + /// + /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. + /// The cancellation token to use. + /// is null. + public virtual Response CheckTrafficManagerRelativeDnsNameAvailability(TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = TrafficManagerProfileProfilesClientDiagnostics.CreateScope("MockableTrafficManagerTenantResource.CheckTrafficManagerRelativeDnsNameAvailability"); + scope.Start(); + try + { + var response = TrafficManagerProfileProfilesRestClient.CheckTrafficManagerRelativeDnsNameAvailability(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 5acd415ef629c..0000000000000 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.TrafficManager -{ - /// 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 TrafficManagerProfileResources in the ResourceGroupResource. - /// An object representing collection of TrafficManagerProfileResources and their operations over a TrafficManagerProfileResource. - public virtual TrafficManagerProfileCollection GetTrafficManagerProfiles() - { - return GetCachedClient(Client => new TrafficManagerProfileCollection(Client, Id)); - } - } -} diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index d9082f7b170ae..0000000000000 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.TrafficManager.Models; - -namespace Azure.ResourceManager.TrafficManager -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _trafficManagerProfileProfilesClientDiagnostics; - private ProfilesRestOperations _trafficManagerProfileProfilesRestClient; - - /// 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 TrafficManagerProfileProfilesClientDiagnostics => _trafficManagerProfileProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.TrafficManager", TrafficManagerProfileResource.ResourceType.Namespace, Diagnostics); - private ProfilesRestOperations TrafficManagerProfileProfilesRestClient => _trafficManagerProfileProfilesRestClient ??= new ProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TrafficManagerProfileResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets an object representing a TrafficManagerUserMetricsResource along with the instance operations that can be performed on it in the SubscriptionResource. - /// Returns a object. - public virtual TrafficManagerUserMetricsResource GetTrafficManagerUserMetrics() - { - return new TrafficManagerUserMetricsResource(Client, Id.AppendProviderResource("Microsoft.Network", "trafficManagerUserMetricsKeys", "default")); - } - - /// - /// Checks the availability of a Traffic Manager Relative DNS name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/checkTrafficManagerNameAvailabilityV2 - /// - /// - /// Operation Id - /// Profiles_checkTrafficManagerNameAvailabilityV2 - /// - /// - /// - /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. - /// The cancellation token to use. - public virtual async Task> CheckTrafficManagerNameAvailabilityV2Async(TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = TrafficManagerProfileProfilesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckTrafficManagerNameAvailabilityV2"); - scope.Start(); - try - { - var response = await TrafficManagerProfileProfilesRestClient.CheckTrafficManagerNameAvailabilityV2Async(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks the availability of a Traffic Manager Relative DNS name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/checkTrafficManagerNameAvailabilityV2 - /// - /// - /// Operation Id - /// Profiles_checkTrafficManagerNameAvailabilityV2 - /// - /// - /// - /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. - /// The cancellation token to use. - public virtual Response CheckTrafficManagerNameAvailabilityV2(TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = TrafficManagerProfileProfilesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckTrafficManagerNameAvailabilityV2"); - scope.Start(); - try - { - var response = TrafficManagerProfileProfilesRestClient.CheckTrafficManagerNameAvailabilityV2(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists all Traffic Manager profiles within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles - /// - /// - /// Operation Id - /// Profiles_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetTrafficManagerProfilesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TrafficManagerProfileProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new TrafficManagerProfileResource(Client, TrafficManagerProfileData.DeserializeTrafficManagerProfileData(e)), TrafficManagerProfileProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTrafficManagerProfiles", "value", null, cancellationToken); - } - - /// - /// Lists all Traffic Manager profiles within a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles - /// - /// - /// Operation Id - /// Profiles_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetTrafficManagerProfiles(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TrafficManagerProfileProfilesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new TrafficManagerProfileResource(Client, TrafficManagerProfileData.DeserializeTrafficManagerProfileData(e)), TrafficManagerProfileProfilesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetTrafficManagerProfiles", "value", null, cancellationToken); - } - } -} diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 8ae33a4d10b34..0000000000000 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,115 +0,0 @@ -// 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; -using Azure.ResourceManager.TrafficManager.Models; - -namespace Azure.ResourceManager.TrafficManager -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _trafficManagerProfileProfilesClientDiagnostics; - private ProfilesRestOperations _trafficManagerProfileProfilesRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics TrafficManagerProfileProfilesClientDiagnostics => _trafficManagerProfileProfilesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.TrafficManager", TrafficManagerProfileResource.ResourceType.Namespace, Diagnostics); - private ProfilesRestOperations TrafficManagerProfileProfilesRestClient => _trafficManagerProfileProfilesRestClient ??= new ProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(TrafficManagerProfileResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets an object representing a TrafficManagerGeographicHierarchyResource along with the instance operations that can be performed on it in the TenantResource. - /// Returns a object. - public virtual TrafficManagerGeographicHierarchyResource GetTrafficManagerGeographicHierarchy() - { - return new TrafficManagerGeographicHierarchyResource(Client, Id.AppendProviderResource("Microsoft.Network", "trafficManagerGeographicHierarchies", "default")); - } - - /// - /// Checks the availability of a Traffic Manager Relative DNS name. - /// - /// - /// Request Path - /// /providers/Microsoft.Network/checkTrafficManagerNameAvailability - /// - /// - /// Operation Id - /// Profiles_CheckTrafficManagerRelativeDnsNameAvailability - /// - /// - /// - /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. - /// The cancellation token to use. - public virtual async Task> CheckTrafficManagerRelativeDnsNameAvailabilityAsync(TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = TrafficManagerProfileProfilesClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckTrafficManagerRelativeDnsNameAvailability"); - scope.Start(); - try - { - var response = await TrafficManagerProfileProfilesRestClient.CheckTrafficManagerRelativeDnsNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks the availability of a Traffic Manager Relative DNS name. - /// - /// - /// Request Path - /// /providers/Microsoft.Network/checkTrafficManagerNameAvailability - /// - /// - /// Operation Id - /// Profiles_CheckTrafficManagerRelativeDnsNameAvailability - /// - /// - /// - /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. - /// The cancellation token to use. - public virtual Response CheckTrafficManagerRelativeDnsNameAvailability(TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = TrafficManagerProfileProfilesClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckTrafficManagerRelativeDnsNameAvailability"); - scope.Start(); - try - { - var response = TrafficManagerProfileProfilesRestClient.CheckTrafficManagerRelativeDnsNameAvailability(content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/TrafficManagerExtensions.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/TrafficManagerExtensions.cs index eadf8eb9cabc9..2437823348c41 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/TrafficManagerExtensions.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/Extensions/TrafficManagerExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TrafficManager.Mocking; using Azure.ResourceManager.TrafficManager.Models; namespace Azure.ResourceManager.TrafficManager @@ -19,154 +20,118 @@ namespace Azure.ResourceManager.TrafficManager /// A class to add extension methods to Azure.ResourceManager.TrafficManager. public static partial class TrafficManagerExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableTrafficManagerArmClient GetMockableTrafficManagerArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableTrafficManagerArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableTrafficManagerResourceGroupResource GetMockableTrafficManagerResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableTrafficManagerResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableTrafficManagerSubscriptionResource GetMockableTrafficManagerSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableTrafficManagerSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableTrafficManagerTenantResource GetMockableTrafficManagerTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableTrafficManagerTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region TrafficManagerEndpointResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TrafficManagerEndpointResource GetTrafficManagerEndpointResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TrafficManagerEndpointResource.ValidateResourceId(id); - return new TrafficManagerEndpointResource(client, id); - } - ); + return GetMockableTrafficManagerArmClient(client).GetTrafficManagerEndpointResource(id); } - #endregion - #region TrafficManagerProfileResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TrafficManagerProfileResource GetTrafficManagerProfileResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TrafficManagerProfileResource.ValidateResourceId(id); - return new TrafficManagerProfileResource(client, id); - } - ); + return GetMockableTrafficManagerArmClient(client).GetTrafficManagerProfileResource(id); } - #endregion - #region TrafficManagerGeographicHierarchyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TrafficManagerGeographicHierarchyResource GetTrafficManagerGeographicHierarchyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TrafficManagerGeographicHierarchyResource.ValidateResourceId(id); - return new TrafficManagerGeographicHierarchyResource(client, id); - } - ); + return GetMockableTrafficManagerArmClient(client).GetTrafficManagerGeographicHierarchyResource(id); } - #endregion - #region TrafficManagerHeatMapResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TrafficManagerHeatMapResource GetTrafficManagerHeatMapResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TrafficManagerHeatMapResource.ValidateResourceId(id); - return new TrafficManagerHeatMapResource(client, id); - } - ); + return GetMockableTrafficManagerArmClient(client).GetTrafficManagerHeatMapResource(id); } - #endregion - #region TrafficManagerUserMetricsResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TrafficManagerUserMetricsResource GetTrafficManagerUserMetricsResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TrafficManagerUserMetricsResource.ValidateResourceId(id); - return new TrafficManagerUserMetricsResource(client, id); - } - ); + return GetMockableTrafficManagerArmClient(client).GetTrafficManagerUserMetricsResource(id); } - #endregion - /// Gets a collection of TrafficManagerProfileResources in the ResourceGroupResource. + /// + /// Gets a collection of TrafficManagerProfileResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TrafficManagerProfileResources and their operations over a TrafficManagerProfileResource. public static TrafficManagerProfileCollection GetTrafficManagerProfiles(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetTrafficManagerProfiles(); + return GetMockableTrafficManagerResourceGroupResource(resourceGroupResource).GetTrafficManagerProfiles(); } /// @@ -181,16 +146,20 @@ public static TrafficManagerProfileCollection GetTrafficManagerProfiles(this Res /// Profiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Traffic Manager profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTrafficManagerProfileAsync(this ResourceGroupResource resourceGroupResource, string profileName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetTrafficManagerProfiles().GetAsync(profileName, cancellationToken).ConfigureAwait(false); + return await GetMockableTrafficManagerResourceGroupResource(resourceGroupResource).GetTrafficManagerProfileAsync(profileName, cancellationToken).ConfigureAwait(false); } /// @@ -205,24 +174,34 @@ public static async Task> GetTrafficMana /// Profiles_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Traffic Manager profile. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTrafficManagerProfile(this ResourceGroupResource resourceGroupResource, string profileName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetTrafficManagerProfiles().Get(profileName, cancellationToken); + return GetMockableTrafficManagerResourceGroupResource(resourceGroupResource).GetTrafficManagerProfile(profileName, cancellationToken); } - /// Gets an object representing a TrafficManagerUserMetricsResource along with the instance operations that can be performed on it in the SubscriptionResource. + /// + /// Gets an object representing a TrafficManagerUserMetricsResource along with the instance operations that can be performed on it in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Returns a object. public static TrafficManagerUserMetricsResource GetTrafficManagerUserMetrics(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTrafficManagerUserMetrics(); + return GetMockableTrafficManagerSubscriptionResource(subscriptionResource).GetTrafficManagerUserMetrics(); } /// @@ -237,6 +216,10 @@ public static TrafficManagerUserMetricsResource GetTrafficManagerUserMetrics(thi /// Profiles_checkTrafficManagerNameAvailabilityV2 /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. @@ -244,9 +227,7 @@ public static TrafficManagerUserMetricsResource GetTrafficManagerUserMetrics(thi /// is null. public static async Task> CheckTrafficManagerNameAvailabilityV2Async(this SubscriptionResource subscriptionResource, TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckTrafficManagerNameAvailabilityV2Async(content, cancellationToken).ConfigureAwait(false); + return await GetMockableTrafficManagerSubscriptionResource(subscriptionResource).CheckTrafficManagerNameAvailabilityV2Async(content, cancellationToken).ConfigureAwait(false); } /// @@ -261,6 +242,10 @@ public static async Task> CheckTr /// Profiles_checkTrafficManagerNameAvailabilityV2 /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. @@ -268,9 +253,7 @@ public static async Task> CheckTr /// is null. public static Response CheckTrafficManagerNameAvailabilityV2(this SubscriptionResource subscriptionResource, TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckTrafficManagerNameAvailabilityV2(content, cancellationToken); + return GetMockableTrafficManagerSubscriptionResource(subscriptionResource).CheckTrafficManagerNameAvailabilityV2(content, cancellationToken); } /// @@ -285,13 +268,17 @@ public static Response CheckTrafficManager /// Profiles_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetTrafficManagerProfilesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTrafficManagerProfilesAsync(cancellationToken); + return GetMockableTrafficManagerSubscriptionResource(subscriptionResource).GetTrafficManagerProfilesAsync(cancellationToken); } /// @@ -306,21 +293,31 @@ public static AsyncPageable GetTrafficManagerProf /// Profiles_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetTrafficManagerProfiles(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTrafficManagerProfiles(cancellationToken); + return GetMockableTrafficManagerSubscriptionResource(subscriptionResource).GetTrafficManagerProfiles(cancellationToken); } - /// Gets an object representing a TrafficManagerGeographicHierarchyResource along with the instance operations that can be performed on it in the TenantResource. + /// + /// Gets an object representing a TrafficManagerGeographicHierarchyResource along with the instance operations that can be performed on it in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Returns a object. public static TrafficManagerGeographicHierarchyResource GetTrafficManagerGeographicHierarchy(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetTrafficManagerGeographicHierarchy(); + return GetMockableTrafficManagerTenantResource(tenantResource).GetTrafficManagerGeographicHierarchy(); } /// @@ -335,6 +332,10 @@ public static TrafficManagerGeographicHierarchyResource GetTrafficManagerGeograp /// Profiles_CheckTrafficManagerRelativeDnsNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. @@ -342,9 +343,7 @@ public static TrafficManagerGeographicHierarchyResource GetTrafficManagerGeograp /// is null. public static async Task> CheckTrafficManagerRelativeDnsNameAvailabilityAsync(this TenantResource tenantResource, TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetTenantResourceExtensionClient(tenantResource).CheckTrafficManagerRelativeDnsNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableTrafficManagerTenantResource(tenantResource).CheckTrafficManagerRelativeDnsNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -359,6 +358,10 @@ public static async Task> CheckTr /// Profiles_CheckTrafficManagerRelativeDnsNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability operation. @@ -366,9 +369,7 @@ public static async Task> CheckTr /// is null. public static Response CheckTrafficManagerRelativeDnsNameAvailability(this TenantResource tenantResource, TrafficManagerRelativeDnsNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetTenantResourceExtensionClient(tenantResource).CheckTrafficManagerRelativeDnsNameAvailability(content, cancellationToken); + return GetMockableTrafficManagerTenantResource(tenantResource).CheckTrafficManagerRelativeDnsNameAvailability(content, cancellationToken); } } } diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerEndpointResource.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerEndpointResource.cs index 63c6d1992c8e0..5124b84e66745 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerEndpointResource.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerEndpointResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.TrafficManager public partial class TrafficManagerEndpointResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The endpointType. + /// The endpointName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, string endpointType, string endpointName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}"; diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerHeatMapResource.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerHeatMapResource.cs index ebe126f00eae8..8c806526a408c 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerHeatMapResource.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerHeatMapResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.TrafficManager public partial class TrafficManagerHeatMapResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. + /// The heatMapType. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName, TrafficManagerHeatMapType heatMapType) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType}"; diff --git a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileResource.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileResource.cs index 550b5d8b63fbb..fc782776d818e 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileResource.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.TrafficManager public partial class TrafficManagerProfileResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The profileName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string profileName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of TrafficManagerEndpointResources and their operations over a TrafficManagerEndpointResource. public virtual TrafficManagerEndpointCollection GetTrafficManagerEndpoints() { - return GetCachedClient(Client => new TrafficManagerEndpointCollection(Client, Id)); + return GetCachedClient(client => new TrafficManagerEndpointCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual TrafficManagerEndpointCollection GetTrafficManagerEndpoints() /// The type of the Traffic Manager endpoint. Only AzureEndpoints, ExternalEndpoints and NestedEndpoints are allowed here. /// The name of the Traffic Manager endpoint. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetTrafficManagerEndpointAsync(string endpointType, string endpointName, CancellationToken cancellationToken = default) { @@ -136,8 +139,8 @@ public virtual async Task> GetTrafficMa /// The type of the Traffic Manager endpoint. Only AzureEndpoints, ExternalEndpoints and NestedEndpoints are allowed here. /// The name of the Traffic Manager endpoint. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetTrafficManagerEndpoint(string endpointType, string endpointName, CancellationToken cancellationToken = default) { @@ -148,7 +151,7 @@ public virtual Response GetTrafficManagerEndpoin /// An object representing collection of TrafficManagerHeatMapResources and their operations over a TrafficManagerHeatMapResource. public virtual TrafficManagerHeatMapCollection GetTrafficManagerHeatMaps() { - return GetCachedClient(Client => new TrafficManagerHeatMapCollection(Client, Id)); + return GetCachedClient(client => new TrafficManagerHeatMapCollection(client, Id)); } /// diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/api/Azure.ResourceManager.VoiceServices.netstandard2.0.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/api/Azure.ResourceManager.VoiceServices.netstandard2.0.cs index 173a4fe830424..95a99d052ca20 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/api/Azure.ResourceManager.VoiceServices.netstandard2.0.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/api/Azure.ResourceManager.VoiceServices.netstandard2.0.cs @@ -19,7 +19,7 @@ protected VoiceServicesCommunicationsGatewayCollection() { } } public partial class VoiceServicesCommunicationsGatewayData : Azure.ResourceManager.Models.TrackedResourceData { - public VoiceServicesCommunicationsGatewayData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VoiceServicesCommunicationsGatewayData(Azure.Core.AzureLocation location) { } public System.BinaryData ApiBridge { get { throw null; } set { } } public string AutoGeneratedDomainNameLabel { get { throw null; } } public Azure.ResourceManager.VoiceServices.Models.VoiceServicesAutoGeneratedDomainNameLabelScope? AutoGeneratedDomainNameLabelScope { get { throw null; } set { } } @@ -88,7 +88,7 @@ protected VoiceServicesTestLineCollection() { } } public partial class VoiceServicesTestLineData : Azure.ResourceManager.Models.TrackedResourceData { - public VoiceServicesTestLineData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public VoiceServicesTestLineData(Azure.Core.AzureLocation location) { } public string PhoneNumber { get { throw null; } set { } } public Azure.ResourceManager.VoiceServices.Models.VoiceServicesProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.VoiceServices.Models.VoiceServicesTestLinePurpose? Purpose { get { throw null; } set { } } @@ -114,6 +114,30 @@ protected VoiceServicesTestLineResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.VoiceServices.Models.VoiceServicesTestLinePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.VoiceServices.Mocking +{ + public partial class MockableVoiceServicesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableVoiceServicesArmClient() { } + public virtual Azure.ResourceManager.VoiceServices.VoiceServicesCommunicationsGatewayResource GetVoiceServicesCommunicationsGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.VoiceServices.VoiceServicesTestLineResource GetVoiceServicesTestLineResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableVoiceServicesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableVoiceServicesResourceGroupResource() { } + public virtual Azure.Response GetVoiceServicesCommunicationsGateway(string communicationsGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetVoiceServicesCommunicationsGatewayAsync(string communicationsGatewayName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.VoiceServices.VoiceServicesCommunicationsGatewayCollection GetVoiceServicesCommunicationsGateways() { throw null; } + } + public partial class MockableVoiceServicesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableVoiceServicesSubscriptionResource() { } + public virtual Azure.Response CheckVoiceServicesNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.VoiceServices.Models.VoiceServicesCheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckVoiceServicesNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.VoiceServices.Models.VoiceServicesCheckNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVoiceServicesCommunicationsGateways(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVoiceServicesCommunicationsGatewaysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.VoiceServices.Models { public static partial class ArmVoiceServicesModelFactory diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesArmClient.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesArmClient.cs new file mode 100644 index 0000000000000..59d543e3db95d --- /dev/null +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.VoiceServices; + +namespace Azure.ResourceManager.VoiceServices.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableVoiceServicesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableVoiceServicesArmClient() + { + } + + /// 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 MockableVoiceServicesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableVoiceServicesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VoiceServicesCommunicationsGatewayResource GetVoiceServicesCommunicationsGatewayResource(ResourceIdentifier id) + { + VoiceServicesCommunicationsGatewayResource.ValidateResourceId(id); + return new VoiceServicesCommunicationsGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VoiceServicesTestLineResource GetVoiceServicesTestLineResource(ResourceIdentifier id) + { + VoiceServicesTestLineResource.ValidateResourceId(id); + return new VoiceServicesTestLineResource(Client, id); + } + } +} diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesResourceGroupResource.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesResourceGroupResource.cs new file mode 100644 index 0000000000000..ca3e19eb822f1 --- /dev/null +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.VoiceServices; + +namespace Azure.ResourceManager.VoiceServices.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableVoiceServicesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableVoiceServicesResourceGroupResource() + { + } + + /// 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 MockableVoiceServicesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of VoiceServicesCommunicationsGatewayResources in the ResourceGroupResource. + /// An object representing collection of VoiceServicesCommunicationsGatewayResources and their operations over a VoiceServicesCommunicationsGatewayResource. + public virtual VoiceServicesCommunicationsGatewayCollection GetVoiceServicesCommunicationsGateways() + { + return GetCachedClient(client => new VoiceServicesCommunicationsGatewayCollection(client, Id)); + } + + /// + /// Get a CommunicationsGateway + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices/communicationsGateways/{communicationsGatewayName} + /// + /// + /// Operation Id + /// CommunicationsGateways_Get + /// + /// + /// + /// Unique identifier for this deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVoiceServicesCommunicationsGatewayAsync(string communicationsGatewayName, CancellationToken cancellationToken = default) + { + return await GetVoiceServicesCommunicationsGateways().GetAsync(communicationsGatewayName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a CommunicationsGateway + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices/communicationsGateways/{communicationsGatewayName} + /// + /// + /// Operation Id + /// CommunicationsGateways_Get + /// + /// + /// + /// Unique identifier for this deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVoiceServicesCommunicationsGateway(string communicationsGatewayName, CancellationToken cancellationToken = default) + { + return GetVoiceServicesCommunicationsGateways().Get(communicationsGatewayName, cancellationToken); + } + } +} diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesSubscriptionResource.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesSubscriptionResource.cs new file mode 100644 index 0000000000000..9efeb00e99f5c --- /dev/null +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesSubscriptionResource.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.VoiceServices; +using Azure.ResourceManager.VoiceServices.Models; + +namespace Azure.ResourceManager.VoiceServices.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableVoiceServicesSubscriptionResource : ArmResource + { + private ClientDiagnostics _voiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics; + private CommunicationsGatewaysRestOperations _voiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient; + private ClientDiagnostics _nameAvailabilityClientDiagnostics; + private NameAvailabilityRestOperations _nameAvailabilityRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableVoiceServicesSubscriptionResource() + { + } + + /// 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 MockableVoiceServicesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics VoiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics => _voiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.VoiceServices", VoiceServicesCommunicationsGatewayResource.ResourceType.Namespace, Diagnostics); + private CommunicationsGatewaysRestOperations VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient => _voiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient ??= new CommunicationsGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VoiceServicesCommunicationsGatewayResource.ResourceType)); + private ClientDiagnostics NameAvailabilityClientDiagnostics => _nameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.VoiceServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private NameAvailabilityRestOperations NameAvailabilityRestClient => _nameAvailabilityRestClient ??= new NameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List CommunicationsGateway resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/communicationsGateways + /// + /// + /// Operation Id + /// CommunicationsGateways_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVoiceServicesCommunicationsGatewaysAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VoiceServicesCommunicationsGatewayResource(Client, VoiceServicesCommunicationsGatewayData.DeserializeVoiceServicesCommunicationsGatewayData(e)), VoiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics, Pipeline, "MockableVoiceServicesSubscriptionResource.GetVoiceServicesCommunicationsGateways", "value", "nextLink", cancellationToken); + } + + /// + /// List CommunicationsGateway resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/communicationsGateways + /// + /// + /// Operation Id + /// CommunicationsGateways_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVoiceServicesCommunicationsGateways(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VoiceServicesCommunicationsGatewayResource(Client, VoiceServicesCommunicationsGatewayData.DeserializeVoiceServicesCommunicationsGatewayData(e)), VoiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics, Pipeline, "MockableVoiceServicesSubscriptionResource.GetVoiceServicesCommunicationsGateways", "value", "nextLink", cancellationToken); + } + + /// + /// Check whether the resource name is available in the given region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// NameAvailability_CheckLocal + /// + /// + /// + /// The location in which uniqueness will be verified. + /// The check availability request body. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckVoiceServicesNameAvailabilityAsync(AzureLocation location, VoiceServicesCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NameAvailabilityClientDiagnostics.CreateScope("MockableVoiceServicesSubscriptionResource.CheckVoiceServicesNameAvailability"); + scope.Start(); + try + { + var response = await NameAvailabilityRestClient.CheckLocalAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check whether the resource name is available in the given region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// NameAvailability_CheckLocal + /// + /// + /// + /// The location in which uniqueness will be verified. + /// The check availability request body. + /// The cancellation token to use. + /// is null. + public virtual Response CheckVoiceServicesNameAvailability(AzureLocation location, VoiceServicesCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = NameAvailabilityClientDiagnostics.CreateScope("MockableVoiceServicesSubscriptionResource.CheckVoiceServicesNameAvailability"); + scope.Start(); + try + { + var response = NameAvailabilityRestClient.CheckLocal(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 39869e5cebc4c..0000000000000 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.VoiceServices -{ - /// 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 VoiceServicesCommunicationsGatewayResources in the ResourceGroupResource. - /// An object representing collection of VoiceServicesCommunicationsGatewayResources and their operations over a VoiceServicesCommunicationsGatewayResource. - public virtual VoiceServicesCommunicationsGatewayCollection GetVoiceServicesCommunicationsGateways() - { - return GetCachedClient(Client => new VoiceServicesCommunicationsGatewayCollection(Client, Id)); - } - } -} diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index dd076a6b992b9..0000000000000 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.VoiceServices.Models; - -namespace Azure.ResourceManager.VoiceServices -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _voiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics; - private CommunicationsGatewaysRestOperations _voiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient; - private ClientDiagnostics _nameAvailabilityClientDiagnostics; - private NameAvailabilityRestOperations _nameAvailabilityRestClient; - - /// 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 VoiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics => _voiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.VoiceServices", VoiceServicesCommunicationsGatewayResource.ResourceType.Namespace, Diagnostics); - private CommunicationsGatewaysRestOperations VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient => _voiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient ??= new CommunicationsGatewaysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VoiceServicesCommunicationsGatewayResource.ResourceType)); - private ClientDiagnostics NameAvailabilityClientDiagnostics => _nameAvailabilityClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.VoiceServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private NameAvailabilityRestOperations NameAvailabilityRestClient => _nameAvailabilityRestClient ??= new NameAvailabilityRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List CommunicationsGateway resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/communicationsGateways - /// - /// - /// Operation Id - /// CommunicationsGateways_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVoiceServicesCommunicationsGatewaysAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VoiceServicesCommunicationsGatewayResource(Client, VoiceServicesCommunicationsGatewayData.DeserializeVoiceServicesCommunicationsGatewayData(e)), VoiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVoiceServicesCommunicationsGateways", "value", "nextLink", cancellationToken); - } - - /// - /// List CommunicationsGateway resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/communicationsGateways - /// - /// - /// Operation Id - /// CommunicationsGateways_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVoiceServicesCommunicationsGateways(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VoiceServicesCommunicationsGatewayCommunicationsGatewaysRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VoiceServicesCommunicationsGatewayResource(Client, VoiceServicesCommunicationsGatewayData.DeserializeVoiceServicesCommunicationsGatewayData(e)), VoiceServicesCommunicationsGatewayCommunicationsGatewaysClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetVoiceServicesCommunicationsGateways", "value", "nextLink", cancellationToken); - } - - /// - /// Check whether the resource name is available in the given region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// NameAvailability_CheckLocal - /// - /// - /// - /// The location in which uniqueness will be verified. - /// The check availability request body. - /// The cancellation token to use. - public virtual async Task> CheckVoiceServicesNameAvailabilityAsync(AzureLocation location, VoiceServicesCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckVoiceServicesNameAvailability"); - scope.Start(); - try - { - var response = await NameAvailabilityRestClient.CheckLocalAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Check whether the resource name is available in the given region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// NameAvailability_CheckLocal - /// - /// - /// - /// The location in which uniqueness will be verified. - /// The check availability request body. - /// The cancellation token to use. - public virtual Response CheckVoiceServicesNameAvailability(AzureLocation location, VoiceServicesCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = NameAvailabilityClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckVoiceServicesNameAvailability"); - scope.Start(); - try - { - var response = NameAvailabilityRestClient.CheckLocal(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/VoiceServicesExtensions.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/VoiceServicesExtensions.cs index da5a349f8804c..d369cdda90e70 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/VoiceServicesExtensions.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/VoiceServicesExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.VoiceServices.Mocking; using Azure.ResourceManager.VoiceServices.Models; namespace Azure.ResourceManager.VoiceServices @@ -19,81 +20,65 @@ namespace Azure.ResourceManager.VoiceServices /// A class to add extension methods to Azure.ResourceManager.VoiceServices. public static partial class VoiceServicesExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableVoiceServicesArmClient GetMockableVoiceServicesArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableVoiceServicesArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableVoiceServicesResourceGroupResource GetMockableVoiceServicesResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableVoiceServicesResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableVoiceServicesSubscriptionResource GetMockableVoiceServicesSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableVoiceServicesSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region VoiceServicesCommunicationsGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VoiceServicesCommunicationsGatewayResource GetVoiceServicesCommunicationsGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VoiceServicesCommunicationsGatewayResource.ValidateResourceId(id); - return new VoiceServicesCommunicationsGatewayResource(client, id); - } - ); + return GetMockableVoiceServicesArmClient(client).GetVoiceServicesCommunicationsGatewayResource(id); } - #endregion - #region VoiceServicesTestLineResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static VoiceServicesTestLineResource GetVoiceServicesTestLineResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - VoiceServicesTestLineResource.ValidateResourceId(id); - return new VoiceServicesTestLineResource(client, id); - } - ); + return GetMockableVoiceServicesArmClient(client).GetVoiceServicesTestLineResource(id); } - #endregion - /// Gets a collection of VoiceServicesCommunicationsGatewayResources in the ResourceGroupResource. + /// + /// Gets a collection of VoiceServicesCommunicationsGatewayResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of VoiceServicesCommunicationsGatewayResources and their operations over a VoiceServicesCommunicationsGatewayResource. public static VoiceServicesCommunicationsGatewayCollection GetVoiceServicesCommunicationsGateways(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetVoiceServicesCommunicationsGateways(); + return GetMockableVoiceServicesResourceGroupResource(resourceGroupResource).GetVoiceServicesCommunicationsGateways(); } /// @@ -108,16 +93,20 @@ public static VoiceServicesCommunicationsGatewayCollection GetVoiceServicesCommu /// CommunicationsGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Unique identifier for this deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetVoiceServicesCommunicationsGatewayAsync(this ResourceGroupResource resourceGroupResource, string communicationsGatewayName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetVoiceServicesCommunicationsGateways().GetAsync(communicationsGatewayName, cancellationToken).ConfigureAwait(false); + return await GetMockableVoiceServicesResourceGroupResource(resourceGroupResource).GetVoiceServicesCommunicationsGatewayAsync(communicationsGatewayName, cancellationToken).ConfigureAwait(false); } /// @@ -132,16 +121,20 @@ public static async Task> G /// CommunicationsGateways_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Unique identifier for this deployment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetVoiceServicesCommunicationsGateway(this ResourceGroupResource resourceGroupResource, string communicationsGatewayName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetVoiceServicesCommunicationsGateways().Get(communicationsGatewayName, cancellationToken); + return GetMockableVoiceServicesResourceGroupResource(resourceGroupResource).GetVoiceServicesCommunicationsGateway(communicationsGatewayName, cancellationToken); } /// @@ -156,13 +149,17 @@ public static Response GetVoiceServi /// CommunicationsGateways_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVoiceServicesCommunicationsGatewaysAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVoiceServicesCommunicationsGatewaysAsync(cancellationToken); + return GetMockableVoiceServicesSubscriptionResource(subscriptionResource).GetVoiceServicesCommunicationsGatewaysAsync(cancellationToken); } /// @@ -177,13 +174,17 @@ public static AsyncPageable GetVoice /// CommunicationsGateways_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetVoiceServicesCommunicationsGateways(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetVoiceServicesCommunicationsGateways(cancellationToken); + return GetMockableVoiceServicesSubscriptionResource(subscriptionResource).GetVoiceServicesCommunicationsGateways(cancellationToken); } /// @@ -198,6 +199,10 @@ public static Pageable GetVoiceServi /// NameAvailability_CheckLocal /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location in which uniqueness will be verified. @@ -206,9 +211,7 @@ public static Pageable GetVoiceServi /// is null. public static async Task> CheckVoiceServicesNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, VoiceServicesCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckVoiceServicesNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableVoiceServicesSubscriptionResource(subscriptionResource).CheckVoiceServicesNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -223,6 +226,10 @@ public static async Task> Che /// NameAvailability_CheckLocal /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The location in which uniqueness will be verified. @@ -231,9 +238,7 @@ public static async Task> Che /// is null. public static Response CheckVoiceServicesNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, VoiceServicesCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckVoiceServicesNameAvailability(location, content, cancellationToken); + return GetMockableVoiceServicesSubscriptionResource(subscriptionResource).CheckVoiceServicesNameAvailability(location, content, cancellationToken); } } } diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayResource.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayResource.cs index 8b46fc37f5b73..348ce63f68f41 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayResource.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.VoiceServices public partial class VoiceServicesCommunicationsGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The communicationsGatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string communicationsGatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices/communicationsGateways/{communicationsGatewayName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of VoiceServicesTestLineResources and their operations over a VoiceServicesTestLineResource. public virtual VoiceServicesTestLineCollection GetVoiceServicesTestLines() { - return GetCachedClient(Client => new VoiceServicesTestLineCollection(Client, Id)); + return GetCachedClient(client => new VoiceServicesTestLineCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual VoiceServicesTestLineCollection GetVoiceServicesTestLines() /// /// Unique identifier for this test line. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetVoiceServicesTestLineAsync(string testLineName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetVoiceServi /// /// Unique identifier for this test line. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetVoiceServicesTestLine(string testLineName, CancellationToken cancellationToken = default) { diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesTestLineResource.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesTestLineResource.cs index 5f237d515887e..35c8f4bffbfb3 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesTestLineResource.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesTestLineResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.VoiceServices public partial class VoiceServicesTestLineResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The communicationsGatewayName. + /// The testLineName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string communicationsGatewayName, string testLineName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices/communicationsGateways/{communicationsGatewayName}/testLines/{testLineName}"; diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/api/Azure.ResourceManager.WebPubSub.netstandard2.0.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/api/Azure.ResourceManager.WebPubSub.netstandard2.0.cs index 222f4103449f8..0cec2e79d73a9 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/api/Azure.ResourceManager.WebPubSub.netstandard2.0.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/api/Azure.ResourceManager.WebPubSub.netstandard2.0.cs @@ -19,7 +19,7 @@ protected WebPubSubCollection() { } } public partial class WebPubSubData : Azure.ResourceManager.Models.TrackedResourceData { - public WebPubSubData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public WebPubSubData(Azure.Core.AzureLocation location) { } public string ExternalIP { get { throw null; } } public string HostName { get { throw null; } } public string HostNamePrefix { get { throw null; } } @@ -210,6 +210,34 @@ protected WebPubSubSharedPrivateLinkResource() { } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.WebPubSub.WebPubSubSharedPrivateLinkData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.WebPubSub.Mocking +{ + public partial class MockableWebPubSubArmClient : Azure.ResourceManager.ArmResource + { + protected MockableWebPubSubArmClient() { } + public virtual Azure.ResourceManager.WebPubSub.WebPubSubHubResource GetWebPubSubHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.WebPubSub.WebPubSubPrivateEndpointConnectionResource GetWebPubSubPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.WebPubSub.WebPubSubResource GetWebPubSubResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.WebPubSub.WebPubSubSharedPrivateLinkResource GetWebPubSubSharedPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableWebPubSubResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableWebPubSubResourceGroupResource() { } + public virtual Azure.Response GetWebPubSub(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWebPubSubAsync(string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.WebPubSub.WebPubSubCollection GetWebPubSubs() { throw null; } + } + public partial class MockableWebPubSubSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableWebPubSubSubscriptionResource() { } + public virtual Azure.Response CheckWebPubSubNameAvailability(Azure.Core.AzureLocation location, Azure.ResourceManager.WebPubSub.Models.WebPubSubNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckWebPubSubNameAvailabilityAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.WebPubSub.Models.WebPubSubNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsages(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWebPubSubs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWebPubSubsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.WebPubSub.Models { [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubArmClient.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubArmClient.cs new file mode 100644 index 0000000000000..779faedda6ed3 --- /dev/null +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubArmClient.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.WebPubSub; + +namespace Azure.ResourceManager.WebPubSub.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableWebPubSubArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableWebPubSubArmClient() + { + } + + /// 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 MockableWebPubSubArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableWebPubSubArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebPubSubResource GetWebPubSubResource(ResourceIdentifier id) + { + WebPubSubResource.ValidateResourceId(id); + return new WebPubSubResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebPubSubHubResource GetWebPubSubHubResource(ResourceIdentifier id) + { + WebPubSubHubResource.ValidateResourceId(id); + return new WebPubSubHubResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebPubSubPrivateEndpointConnectionResource GetWebPubSubPrivateEndpointConnectionResource(ResourceIdentifier id) + { + WebPubSubPrivateEndpointConnectionResource.ValidateResourceId(id); + return new WebPubSubPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebPubSubSharedPrivateLinkResource GetWebPubSubSharedPrivateLinkResource(ResourceIdentifier id) + { + WebPubSubSharedPrivateLinkResource.ValidateResourceId(id); + return new WebPubSubSharedPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubResourceGroupResource.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubResourceGroupResource.cs new file mode 100644 index 0000000000000..390b3ba9e666f --- /dev/null +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubResourceGroupResource.cs @@ -0,0 +1,92 @@ +// 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.WebPubSub; + +namespace Azure.ResourceManager.WebPubSub.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableWebPubSubResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableWebPubSubResourceGroupResource() + { + } + + /// 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 MockableWebPubSubResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of WebPubSubResources in the ResourceGroupResource. + /// An object representing collection of WebPubSubResources and their operations over a WebPubSubResource. + public virtual WebPubSubCollection GetWebPubSubs() + { + return GetCachedClient(client => new WebPubSubCollection(client, Id)); + } + + /// + /// Get the resource and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName} + /// + /// + /// Operation Id + /// WebPubSub_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWebPubSubAsync(string resourceName, CancellationToken cancellationToken = default) + { + return await GetWebPubSubs().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the resource and its properties. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName} + /// + /// + /// Operation Id + /// WebPubSub_Get + /// + /// + /// + /// The name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWebPubSub(string resourceName, CancellationToken cancellationToken = default) + { + return GetWebPubSubs().Get(resourceName, cancellationToken); + } + } +} diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubSubscriptionResource.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubSubscriptionResource.cs new file mode 100644 index 0000000000000..8269c3674bca6 --- /dev/null +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/MockableWebPubSubSubscriptionResource.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.WebPubSub; +using Azure.ResourceManager.WebPubSub.Models; + +namespace Azure.ResourceManager.WebPubSub.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableWebPubSubSubscriptionResource : ArmResource + { + private ClientDiagnostics _webPubSubClientDiagnostics; + private WebPubSubRestOperations _webPubSubRestClient; + private ClientDiagnostics _usagesClientDiagnostics; + private UsagesRestOperations _usagesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableWebPubSubSubscriptionResource() + { + } + + /// 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 MockableWebPubSubSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics WebPubSubClientDiagnostics => _webPubSubClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.WebPubSub", WebPubSubResource.ResourceType.Namespace, Diagnostics); + private WebPubSubRestOperations WebPubSubRestClient => _webPubSubRestClient ??= new WebPubSubRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WebPubSubResource.ResourceType)); + private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.WebPubSub", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Checks that the resource name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// WebPubSub_CheckNameAvailability + /// + /// + /// + /// the region. + /// Parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckWebPubSubNameAvailabilityAsync(AzureLocation location, WebPubSubNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = WebPubSubClientDiagnostics.CreateScope("MockableWebPubSubSubscriptionResource.CheckWebPubSubNameAvailability"); + scope.Start(); + try + { + var response = await WebPubSubRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the resource name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// WebPubSub_CheckNameAvailability + /// + /// + /// + /// the region. + /// Parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual Response CheckWebPubSubNameAvailability(AzureLocation location, WebPubSubNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = WebPubSubClientDiagnostics.CreateScope("MockableWebPubSubSubscriptionResource.CheckWebPubSubNameAvailability"); + scope.Start(); + try + { + var response = WebPubSubRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub + /// + /// + /// Operation Id + /// WebPubSub_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWebPubSubsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WebPubSubRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebPubSubRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebPubSubResource(Client, WebPubSubData.DeserializeWebPubSubData(e)), WebPubSubClientDiagnostics, Pipeline, "MockableWebPubSubSubscriptionResource.GetWebPubSubs", "value", "nextLink", cancellationToken); + } + + /// + /// Handles requests to list all resources in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub + /// + /// + /// Operation Id + /// WebPubSub_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWebPubSubs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WebPubSubRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebPubSubRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebPubSubResource(Client, WebPubSubData.DeserializeWebPubSubData(e)), WebPubSubClientDiagnostics, Pipeline, "MockableWebPubSubSubscriptionResource.GetWebPubSubs", "value", "nextLink", cancellationToken); + } + + /// + /// List resource usage quotas by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// the location like "eastus". + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SignalRServiceUsage.DeserializeSignalRServiceUsage, UsagesClientDiagnostics, Pipeline, "MockableWebPubSubSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + + /// + /// List resource usage quotas by location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages + /// + /// + /// Operation Id + /// Usages_List + /// + /// + /// + /// the location like "eastus". + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SignalRServiceUsage.DeserializeSignalRServiceUsage, UsagesClientDiagnostics, Pipeline, "MockableWebPubSubSubscriptionResource.GetUsages", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index e863b9d79eca7..0000000000000 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.WebPubSub -{ - /// 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 WebPubSubResources in the ResourceGroupResource. - /// An object representing collection of WebPubSubResources and their operations over a WebPubSubResource. - public virtual WebPubSubCollection GetWebPubSubs() - { - return GetCachedClient(Client => new WebPubSubCollection(Client, Id)); - } - } -} diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 411ed6d4d4e91..0000000000000 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.WebPubSub.Models; - -namespace Azure.ResourceManager.WebPubSub -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _webPubSubClientDiagnostics; - private WebPubSubRestOperations _webPubSubRestClient; - private ClientDiagnostics _usagesClientDiagnostics; - private UsagesRestOperations _usagesRestClient; - - /// 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 WebPubSubClientDiagnostics => _webPubSubClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.WebPubSub", WebPubSubResource.ResourceType.Namespace, Diagnostics); - private WebPubSubRestOperations WebPubSubRestClient => _webPubSubRestClient ??= new WebPubSubRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WebPubSubResource.ResourceType)); - private ClientDiagnostics UsagesClientDiagnostics => _usagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.WebPubSub", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private UsagesRestOperations UsagesRestClient => _usagesRestClient ??= new UsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Checks that the resource name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// WebPubSub_CheckNameAvailability - /// - /// - /// - /// the region. - /// Parameters supplied to the operation. - /// The cancellation token to use. - public virtual async Task> CheckWebPubSubNameAvailabilityAsync(AzureLocation location, WebPubSubNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = WebPubSubClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckWebPubSubNameAvailability"); - scope.Start(); - try - { - var response = await WebPubSubRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks that the resource name is valid and is not already in use. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// WebPubSub_CheckNameAvailability - /// - /// - /// - /// the region. - /// Parameters supplied to the operation. - /// The cancellation token to use. - public virtual Response CheckWebPubSubNameAvailability(AzureLocation location, WebPubSubNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = WebPubSubClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckWebPubSubNameAvailability"); - scope.Start(); - try - { - var response = WebPubSubRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub - /// - /// - /// Operation Id - /// WebPubSub_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWebPubSubsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WebPubSubRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebPubSubRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebPubSubResource(Client, WebPubSubData.DeserializeWebPubSubData(e)), WebPubSubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebPubSubs", "value", "nextLink", cancellationToken); - } - - /// - /// Handles requests to list all resources in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub - /// - /// - /// Operation Id - /// WebPubSub_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWebPubSubs(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WebPubSubRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebPubSubRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebPubSubResource(Client, WebPubSubData.DeserializeWebPubSubData(e)), WebPubSubClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebPubSubs", "value", "nextLink", cancellationToken); - } - - /// - /// List resource usage quotas by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// the location like "eastus". - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SignalRServiceUsage.DeserializeSignalRServiceUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - - /// - /// List resource usage quotas by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages - /// - /// - /// Operation Id - /// Usages_List - /// - /// - /// - /// the location like "eastus". - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => UsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => UsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SignalRServiceUsage.DeserializeSignalRServiceUsage, UsagesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetUsages", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/WebPubSubExtensions.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/WebPubSubExtensions.cs index 00131a5ddfbff..cd47a9a31ed02 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/WebPubSubExtensions.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/Extensions/WebPubSubExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.WebPubSub.Mocking; using Azure.ResourceManager.WebPubSub.Models; namespace Azure.ResourceManager.WebPubSub @@ -19,119 +20,97 @@ namespace Azure.ResourceManager.WebPubSub /// A class to add extension methods to Azure.ResourceManager.WebPubSub. public static partial class WebPubSubExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableWebPubSubArmClient GetMockableWebPubSubArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableWebPubSubArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableWebPubSubResourceGroupResource GetMockableWebPubSubResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableWebPubSubResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableWebPubSubSubscriptionResource GetMockableWebPubSubSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableWebPubSubSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region WebPubSubResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebPubSubResource GetWebPubSubResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebPubSubResource.ValidateResourceId(id); - return new WebPubSubResource(client, id); - } - ); + return GetMockableWebPubSubArmClient(client).GetWebPubSubResource(id); } - #endregion - #region WebPubSubHubResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebPubSubHubResource GetWebPubSubHubResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebPubSubHubResource.ValidateResourceId(id); - return new WebPubSubHubResource(client, id); - } - ); + return GetMockableWebPubSubArmClient(client).GetWebPubSubHubResource(id); } - #endregion - #region WebPubSubPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebPubSubPrivateEndpointConnectionResource GetWebPubSubPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebPubSubPrivateEndpointConnectionResource.ValidateResourceId(id); - return new WebPubSubPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableWebPubSubArmClient(client).GetWebPubSubPrivateEndpointConnectionResource(id); } - #endregion - #region WebPubSubSharedPrivateLinkResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebPubSubSharedPrivateLinkResource GetWebPubSubSharedPrivateLinkResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebPubSubSharedPrivateLinkResource.ValidateResourceId(id); - return new WebPubSubSharedPrivateLinkResource(client, id); - } - ); + return GetMockableWebPubSubArmClient(client).GetWebPubSubSharedPrivateLinkResource(id); } - #endregion - /// Gets a collection of WebPubSubResources in the ResourceGroupResource. + /// + /// Gets a collection of WebPubSubResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of WebPubSubResources and their operations over a WebPubSubResource. public static WebPubSubCollection GetWebPubSubs(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetWebPubSubs(); + return GetMockableWebPubSubResourceGroupResource(resourceGroupResource).GetWebPubSubs(); } /// @@ -146,16 +125,20 @@ public static WebPubSubCollection GetWebPubSubs(this ResourceGroupResource resou /// WebPubSub_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetWebPubSubAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetWebPubSubs().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableWebPubSubResourceGroupResource(resourceGroupResource).GetWebPubSubAsync(resourceName, cancellationToken).ConfigureAwait(false); } /// @@ -170,16 +153,20 @@ public static async Task> GetWebPubSubAsync(this Res /// WebPubSub_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetWebPubSub(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetWebPubSubs().Get(resourceName, cancellationToken); + return GetMockableWebPubSubResourceGroupResource(resourceGroupResource).GetWebPubSub(resourceName, cancellationToken); } /// @@ -194,6 +181,10 @@ public static Response GetWebPubSub(this ResourceGroupResourc /// WebPubSub_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the region. @@ -202,9 +193,7 @@ public static Response GetWebPubSub(this ResourceGroupResourc /// is null. public static async Task> CheckWebPubSubNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, WebPubSubNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckWebPubSubNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableWebPubSubSubscriptionResource(subscriptionResource).CheckWebPubSubNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -219,6 +208,10 @@ public static async Task> CheckWebPubSubName /// WebPubSub_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the region. @@ -227,9 +220,7 @@ public static async Task> CheckWebPubSubName /// is null. public static Response CheckWebPubSubNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, WebPubSubNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckWebPubSubNameAvailability(location, content, cancellationToken); + return GetMockableWebPubSubSubscriptionResource(subscriptionResource).CheckWebPubSubNameAvailability(location, content, cancellationToken); } /// @@ -244,13 +235,17 @@ public static Response CheckWebPubSubNameAvailability /// WebPubSub_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetWebPubSubsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWebPubSubsAsync(cancellationToken); + return GetMockableWebPubSubSubscriptionResource(subscriptionResource).GetWebPubSubsAsync(cancellationToken); } /// @@ -265,13 +260,17 @@ public static AsyncPageable GetWebPubSubsAsync(this Subscript /// WebPubSub_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetWebPubSubs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWebPubSubs(cancellationToken); + return GetMockableWebPubSubSubscriptionResource(subscriptionResource).GetWebPubSubs(cancellationToken); } /// @@ -286,6 +285,10 @@ public static Pageable GetWebPubSubs(this SubscriptionResourc /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the location like "eastus". @@ -293,7 +296,7 @@ public static Pageable GetWebPubSubs(this SubscriptionResourc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsagesAsync(location, cancellationToken); + return GetMockableWebPubSubSubscriptionResource(subscriptionResource).GetUsagesAsync(location, cancellationToken); } /// @@ -308,6 +311,10 @@ public static AsyncPageable GetUsagesAsync(this Subscriptio /// Usages_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// the location like "eastus". @@ -315,7 +322,7 @@ public static AsyncPageable GetUsagesAsync(this Subscriptio /// A collection of that may take multiple service requests to iterate over. public static Pageable GetUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetUsages(location, cancellationToken); + return GetMockableWebPubSubSubscriptionResource(subscriptionResource).GetUsages(location, cancellationToken); } } } diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubHubResource.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubHubResource.cs index 40fb5cf3c82c9..b869d0cadaf12 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubHubResource.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubHubResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.WebPubSub public partial class WebPubSubHubResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The hubName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string hubName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}"; diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubPrivateEndpointConnectionResource.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubPrivateEndpointConnectionResource.cs index d65c213f5c77e..e42fddc3ba5df 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubPrivateEndpointConnectionResource.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubPrivateEndpointConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.WebPubSub public partial class WebPubSubPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubResource.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubResource.cs index f48c72a1a171b..83468cedc0efb 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubResource.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.WebPubSub public partial class WebPubSubResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}"; @@ -98,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of WebPubSubHubResources and their operations over a WebPubSubHubResource. public virtual WebPubSubHubCollection GetWebPubSubHubs() { - return GetCachedClient(Client => new WebPubSubHubCollection(Client, Id)); + return GetCachedClient(client => new WebPubSubHubCollection(client, Id)); } /// @@ -116,8 +119,8 @@ public virtual WebPubSubHubCollection GetWebPubSubHubs() /// /// The hub name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebPubSubHubAsync(string hubName, CancellationToken cancellationToken = default) { @@ -139,8 +142,8 @@ public virtual async Task> GetWebPubSubHubAsync(s /// /// The hub name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebPubSubHub(string hubName, CancellationToken cancellationToken = default) { @@ -151,7 +154,7 @@ public virtual Response GetWebPubSubHub(string hubName, Ca /// An object representing collection of WebPubSubPrivateEndpointConnectionResources and their operations over a WebPubSubPrivateEndpointConnectionResource. public virtual WebPubSubPrivateEndpointConnectionCollection GetWebPubSubPrivateEndpointConnections() { - return GetCachedClient(Client => new WebPubSubPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new WebPubSubPrivateEndpointConnectionCollection(client, Id)); } /// @@ -169,8 +172,8 @@ public virtual WebPubSubPrivateEndpointConnectionCollection GetWebPubSubPrivateE /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebPubSubPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -192,8 +195,8 @@ public virtual async Task> /// /// The name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebPubSubPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -204,7 +207,7 @@ public virtual Response GetWebPubSub /// An object representing collection of WebPubSubSharedPrivateLinkResources and their operations over a WebPubSubSharedPrivateLinkResource. public virtual WebPubSubSharedPrivateLinkCollection GetWebPubSubSharedPrivateLinks() { - return GetCachedClient(Client => new WebPubSubSharedPrivateLinkCollection(Client, Id)); + return GetCachedClient(client => new WebPubSubSharedPrivateLinkCollection(client, Id)); } /// @@ -222,8 +225,8 @@ public virtual WebPubSubSharedPrivateLinkCollection GetWebPubSubSharedPrivateLin /// /// The name of the shared private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebPubSubSharedPrivateLinkAsync(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) { @@ -245,8 +248,8 @@ public virtual async Task> GetWebPu /// /// The name of the shared private link resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebPubSubSharedPrivateLink(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) { diff --git a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubSharedPrivateLinkResource.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubSharedPrivateLinkResource.cs index a8cd2bf40a444..77078eefb5545 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubSharedPrivateLinkResource.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubSharedPrivateLinkResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.WebPubSub public partial class WebPubSubSharedPrivateLinkResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The resourceName. + /// The sharedPrivateLinkResourceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string sharedPrivateLinkResourceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs b/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs index aec648b5ec678..9274c2151a4e0 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs @@ -33,7 +33,7 @@ protected AppCertificateCollection() { } } public partial class AppCertificateData : Azure.ResourceManager.Models.TrackedResourceData { - public AppCertificateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AppCertificateData(Azure.Core.AzureLocation location) { } public string CanonicalName { get { throw null; } set { } } public byte[] CerBlob { get { throw null; } } public string DomainValidationMethod { get { throw null; } set { } } @@ -93,7 +93,7 @@ protected AppServiceCertificateCollection() { } } public partial class AppServiceCertificateData : Azure.ResourceManager.Models.TrackedResourceData { - public AppServiceCertificateData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AppServiceCertificateData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier KeyVaultId { get { throw null; } set { } } public string KeyVaultSecretName { get { throw null; } set { } } public string Kind { get { throw null; } set { } } @@ -118,7 +118,7 @@ protected AppServiceCertificateOrderCollection() { } } public partial class AppServiceCertificateOrderData : Azure.ResourceManager.Models.TrackedResourceData { - public AppServiceCertificateOrderData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AppServiceCertificateOrderData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IReadOnlyList AppServiceCertificateNotRenewableReasons { get { throw null; } } public System.Collections.Generic.IDictionary Certificates { get { throw null; } } public Azure.ResourceManager.AppService.Models.CertificateOrderContact Contact { get { throw null; } } @@ -220,7 +220,7 @@ protected AppServiceDomainCollection() { } } public partial class AppServiceDomainData : Azure.ResourceManager.Models.TrackedResourceData { - public AppServiceDomainData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AppServiceDomainData(Azure.Core.AzureLocation location) { } public string AuthCode { get { throw null; } set { } } public Azure.ResourceManager.AppService.Models.DomainPurchaseConsent Consent { get { throw null; } set { } } public Azure.ResourceManager.AppService.Models.RegistrationContactInfo ContactAdmin { get { throw null; } set { } } @@ -281,7 +281,7 @@ protected AppServiceEnvironmentCollection() { } } public partial class AppServiceEnvironmentData : Azure.ResourceManager.Models.TrackedResourceData { - public AppServiceEnvironmentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AppServiceEnvironmentData(Azure.Core.AzureLocation location) { } public System.Collections.Generic.IList ClusterSettings { get { throw null; } } public int? DedicatedHostCount { get { throw null; } set { } } public string DnsSuffix { get { throw null; } set { } } @@ -611,7 +611,7 @@ protected AppServicePlanCollection() { } } public partial class AppServicePlanData : Azure.ResourceManager.Models.TrackedResourceData { - public AppServicePlanData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public AppServicePlanData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public System.DateTimeOffset? FreeOfferExpireOn { get { throw null; } set { } } public string GeoRegion { get { throw null; } } @@ -1213,7 +1213,7 @@ protected KubeEnvironmentCollection() { } } public partial class KubeEnvironmentData : Azure.ResourceManager.Models.TrackedResourceData { - public KubeEnvironmentData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public KubeEnvironmentData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier AksResourceId { get { throw null; } set { } } public Azure.ResourceManager.AppService.Models.AppLogsConfiguration AppLogsConfiguration { get { throw null; } set { } } public Azure.ResourceManager.AppService.Models.ArcConfiguration ArcConfiguration { get { throw null; } set { } } @@ -1322,7 +1322,7 @@ protected NetworkFeatureResource() { } } public partial class PremierAddOnData : Azure.ResourceManager.Models.TrackedResourceData { - public PremierAddOnData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public PremierAddOnData(Azure.Core.AzureLocation location) { } public string Kind { get { throw null; } set { } } public string MarketplaceOffer { get { throw null; } set { } } public string MarketplacePublisher { get { throw null; } set { } } @@ -3066,7 +3066,7 @@ protected StaticSiteCustomDomainOverviewResource() { } } public partial class StaticSiteData : Azure.ResourceManager.Models.TrackedResourceData { - public StaticSiteData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public StaticSiteData(Azure.Core.AzureLocation location) { } public bool? AllowConfigFileUpdates { get { throw null; } set { } } public string Branch { get { throw null; } set { } } public Azure.ResourceManager.AppService.Models.StaticSiteBuildProperties BuildProperties { get { throw null; } set { } } @@ -3417,7 +3417,7 @@ protected WebSiteContinuousWebJobResource() { } } public partial class WebSiteData : Azure.ResourceManager.Models.TrackedResourceData { - public WebSiteData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public WebSiteData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier AppServicePlanId { get { throw null; } set { } } public Azure.ResourceManager.AppService.Models.WebSiteAvailabilityState? AvailabilityState { get { throw null; } } public string ClientCertExclusionPaths { get { throw null; } set { } } @@ -4530,6 +4530,248 @@ protected WebSiteWebJobResource() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.AppService.Mocking +{ + public partial class MockableAppServiceArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAppServiceArmClient() { } + public virtual Azure.ResourceManager.AppService.AppCertificateResource GetAppCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceCertificateOrderResource GetAppServiceCertificateOrderResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceCertificateResource GetAppServiceCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceDomainResource GetAppServiceDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceEnvironmentResource GetAppServiceEnvironmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServicePlanHybridConnectionNamespaceRelayResource GetAppServicePlanHybridConnectionNamespaceRelayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServicePlanResource GetAppServicePlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServicePlanVirtualNetworkConnectionGatewayResource GetAppServicePlanVirtualNetworkConnectionGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServicePlanVirtualNetworkConnectionResource GetAppServicePlanVirtualNetworkConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceSourceControlResource GetAppServiceSourceControlResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.AseV3NetworkingConfigurationResource GetAseV3NetworkingConfigurationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.CertificateOrderDetectorResource GetCertificateOrderDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.DeletedSiteResource GetDeletedSiteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.DomainOwnershipIdentifierResource GetDomainOwnershipIdentifierResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.HostingEnvironmentDetectorResource GetHostingEnvironmentDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.HostingEnvironmentMultiRolePoolResource GetHostingEnvironmentMultiRolePoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.HostingEnvironmentPrivateEndpointConnectionResource GetHostingEnvironmentPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.HostingEnvironmentRecommendationResource GetHostingEnvironmentRecommendationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.HostingEnvironmentWorkerPoolResource GetHostingEnvironmentWorkerPoolResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.HybridConnectionLimitResource GetHybridConnectionLimitResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.KubeEnvironmentResource GetKubeEnvironmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.LogsSiteConfigResource GetLogsSiteConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.LogsSiteSlotConfigResource GetLogsSiteSlotConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.MigrateMySqlStatusResource GetMigrateMySqlStatusResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.NetworkFeatureResource GetNetworkFeatureResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.PublishingUserResource GetPublishingUserResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.ScmSiteBasicPublishingCredentialsPolicyResource GetScmSiteBasicPublishingCredentialsPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.ScmSiteSlotBasicPublishingCredentialsPolicyResource GetScmSiteSlotBasicPublishingCredentialsPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteBackupResource GetSiteBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteConfigAppsettingResource GetSiteConfigAppsettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteConfigSnapshotResource GetSiteConfigSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteDeploymentResource GetSiteDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteDetectorResource GetSiteDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteDiagnosticAnalysisResource GetSiteDiagnosticAnalysisResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteDiagnosticDetectorResource GetSiteDiagnosticDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteDiagnosticResource GetSiteDiagnosticResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteDomainOwnershipIdentifierResource GetSiteDomainOwnershipIdentifierResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteExtensionResource GetSiteExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteFunctionResource GetSiteFunctionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteHostNameBindingResource GetSiteHostNameBindingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteHybridConnectionNamespaceRelayResource GetSiteHybridConnectionNamespaceRelayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteInstanceExtensionResource GetSiteInstanceExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteInstanceProcessModuleResource GetSiteInstanceProcessModuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteInstanceProcessResource GetSiteInstanceProcessResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteInstanceResource GetSiteInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteNetworkConfigResource GetSiteNetworkConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SitePrivateEndpointConnectionResource GetSitePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteProcessModuleResource GetSiteProcessModuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteProcessResource GetSiteProcessResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SitePublicCertificateResource GetSitePublicCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteRecommendationResource GetSiteRecommendationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotBackupResource GetSiteSlotBackupResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotConfigSnapshotResource GetSiteSlotConfigSnapshotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotDeploymentResource GetSiteSlotDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotDetectorResource GetSiteSlotDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotDiagnosticAnalysisResource GetSiteSlotDiagnosticAnalysisResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotDiagnosticDetectorResource GetSiteSlotDiagnosticDetectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotDiagnosticResource GetSiteSlotDiagnosticResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotDomainOwnershipIdentifierResource GetSiteSlotDomainOwnershipIdentifierResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotExtensionResource GetSiteSlotExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotFunctionResource GetSiteSlotFunctionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotHostNameBindingResource GetSiteSlotHostNameBindingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotHybridConnectionNamespaceRelayResource GetSiteSlotHybridConnectionNamespaceRelayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotInstanceExtensionResource GetSiteSlotInstanceExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotInstanceProcessModuleResource GetSiteSlotInstanceProcessModuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotInstanceProcessResource GetSiteSlotInstanceProcessResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotInstanceResource GetSiteSlotInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotNetworkConfigResource GetSiteSlotNetworkConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotPrivateEndpointConnectionResource GetSiteSlotPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotProcessModuleResource GetSiteSlotProcessModuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotProcessResource GetSiteSlotProcessResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotVirtualNetworkConnectionGatewayResource GetSiteSlotVirtualNetworkConnectionGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteSlotVirtualNetworkConnectionResource GetSiteSlotVirtualNetworkConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteVirtualNetworkConnectionGatewayResource GetSiteVirtualNetworkConnectionGatewayResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SiteVirtualNetworkConnectionResource GetSiteVirtualNetworkConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.SlotConfigNamesResource GetSlotConfigNamesResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.StaticSiteBuildResource GetStaticSiteBuildResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.StaticSiteBuildUserProvidedFunctionAppResource GetStaticSiteBuildUserProvidedFunctionAppResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.StaticSiteCustomDomainOverviewResource GetStaticSiteCustomDomainOverviewResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.StaticSitePrivateEndpointConnectionResource GetStaticSitePrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.StaticSiteResource GetStaticSiteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.StaticSiteUserProvidedFunctionAppResource GetStaticSiteUserProvidedFunctionAppResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.TopLevelDomainResource GetTopLevelDomainResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteConfigConnectionStringResource GetWebSiteConfigConnectionStringResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteConfigResource GetWebSiteConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteContinuousWebJobResource GetWebSiteContinuousWebJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteExtensionResource GetWebSiteExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteFtpPublishingCredentialsPolicyResource GetWebSiteFtpPublishingCredentialsPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteHybridConnectionResource GetWebSiteHybridConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSitePremierAddonResource GetWebSitePremierAddonResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSitePrivateAccessResource GetWebSitePrivateAccessResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteResource GetWebSiteResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteResourceHealthMetadataResource GetWebSiteResourceHealthMetadataResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotConfigAppSettingResource GetWebSiteSlotConfigAppSettingResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotConfigConnectionStringResource GetWebSiteSlotConfigConnectionStringResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotConfigResource GetWebSiteSlotConfigResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotContinuousWebJobResource GetWebSiteSlotContinuousWebJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotExtensionResource GetWebSiteSlotExtensionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotFtpPublishingCredentialsPolicyResource GetWebSiteSlotFtpPublishingCredentialsPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotHybridConnectionResource GetWebSiteSlotHybridConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotPremierAddOnResource GetWebSiteSlotPremierAddOnResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotPrivateAccessResource GetWebSiteSlotPrivateAccessResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotPublicCertificateResource GetWebSiteSlotPublicCertificateResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotResource GetWebSiteSlotResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotResourceHealthMetadataResource GetWebSiteSlotResourceHealthMetadataResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotSourceControlResource GetWebSiteSlotSourceControlResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotTriggeredWebJobHistoryResource GetWebSiteSlotTriggeredWebJobHistoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotTriggeredWebJobResource GetWebSiteSlotTriggeredWebJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSlotWebJobResource GetWebSiteSlotWebJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteSourceControlResource GetWebSiteSourceControlResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteTriggeredWebJobHistoryResource GetWebSiteTriggeredWebJobHistoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteTriggeredwebJobResource GetWebSiteTriggeredwebJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteWebJobResource GetWebSiteWebJobResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAppServiceResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAppServiceResourceGroupResource() { } + public virtual Azure.Pageable GetAllResourceHealthMetadataData(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllResourceHealthMetadataDataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAppCertificate(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppCertificateAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.AppCertificateCollection GetAppCertificates() { throw null; } + public virtual Azure.Response GetAppServiceCertificateOrder(string certificateOrderName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppServiceCertificateOrderAsync(string certificateOrderName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceCertificateOrderCollection GetAppServiceCertificateOrders() { throw null; } + public virtual Azure.Response GetAppServiceDomain(string domainName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppServiceDomainAsync(string domainName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceDomainCollection GetAppServiceDomains() { throw null; } + public virtual Azure.Response GetAppServiceEnvironment(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppServiceEnvironmentAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceEnvironmentCollection GetAppServiceEnvironments() { throw null; } + public virtual Azure.Response GetAppServicePlan(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppServicePlanAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServicePlanCollection GetAppServicePlans() { throw null; } + public virtual Azure.Response GetKubeEnvironment(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKubeEnvironmentAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.KubeEnvironmentCollection GetKubeEnvironments() { throw null; } + public virtual Azure.Response GetStaticSite(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetStaticSiteAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.StaticSiteCollection GetStaticSites() { throw null; } + public virtual Azure.Response GetWebSite(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWebSiteAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.WebSiteCollection GetWebSites() { throw null; } + public virtual Azure.Response Validate(Azure.ResourceManager.AppService.Models.AppServiceValidateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateAsync(Azure.ResourceManager.AppService.Models.AppServiceValidateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAppServiceSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAppServiceSubscriptionResource() { } + public virtual Azure.Response CheckAppServiceDomainRegistrationAvailability(Azure.ResourceManager.AppService.Models.AppServiceDomainNameIdentifier identifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckAppServiceDomainRegistrationAvailabilityAsync(Azure.ResourceManager.AppService.Models.AppServiceDomainNameIdentifier identifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckAppServiceNameAvailability(Azure.ResourceManager.AppService.Models.ResourceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckAppServiceNameAvailabilityAsync(Azure.ResourceManager.AppService.Models.ResourceNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DisableAppServiceRecommendation(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DisableAppServiceRecommendationAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllResourceHealthMetadata(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllResourceHealthMetadataAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllSiteIdentifierData(Azure.ResourceManager.AppService.Models.AppServiceDomainNameIdentifier nameIdentifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllSiteIdentifierDataAsync(Azure.ResourceManager.AppService.Models.AppServiceDomainNameIdentifier nameIdentifier, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppCertificates(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppCertificatesAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppServiceCertificateOrders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppServiceCertificateOrdersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetAppServiceDeploymentLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppServiceDeploymentLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppServiceDomainRecommendations(Azure.ResourceManager.AppService.Models.DomainRecommendationSearchContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppServiceDomainRecommendationsAsync(Azure.ResourceManager.AppService.Models.DomainRecommendationSearchContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppServiceDomains(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppServiceDomainsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppServiceEnvironments(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppServiceEnvironmentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAppServicePlans(bool? detailed = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAppServicePlansAsync(bool? detailed = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableStacksOnPremProviders(Azure.ResourceManager.AppService.Models.ProviderOSTypeSelected? osTypeSelected = default(Azure.ResourceManager.AppService.Models.ProviderOSTypeSelected?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableStacksOnPremProvidersAsync(Azure.ResourceManager.AppService.Models.ProviderOSTypeSelected? osTypeSelected = default(Azure.ResourceManager.AppService.Models.ProviderOSTypeSelected?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBillingMeters(string billingLocation = null, string osType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBillingMetersAsync(string billingLocation = null, string osType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetControlCenterSsoRequestDomain(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetControlCenterSsoRequestDomainAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeletedSite(string deletedSiteId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeletedSiteAsync(string deletedSiteId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.DeletedSiteCollection GetDeletedSites() { throw null; } + public virtual Azure.Pageable GetDeletedSitesByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeletedSitesByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeletedWebAppByLocationDeletedWebApp(Azure.Core.AzureLocation location, string deletedSiteId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeletedWebAppByLocationDeletedWebAppAsync(Azure.Core.AzureLocation location, string deletedSiteId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetGeoRegions(Azure.ResourceManager.AppService.Models.AppServiceSkuName? sku = default(Azure.ResourceManager.AppService.Models.AppServiceSkuName?), bool? linuxWorkersEnabled = default(bool?), bool? xenonWorkersEnabled = default(bool?), bool? linuxDynamicWorkersEnabled = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGeoRegionsAsync(Azure.ResourceManager.AppService.Models.AppServiceSkuName? sku = default(Azure.ResourceManager.AppService.Models.AppServiceSkuName?), bool? linuxWorkersEnabled = default(bool?), bool? xenonWorkersEnabled = default(bool?), bool? linuxDynamicWorkersEnabled = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetKubeEnvironments(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetKubeEnvironmentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPremierAddOnOffers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPremierAddOnOffersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRecommendations(bool? featured = default(bool?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRecommendationsAsync(bool? featured = default(bool?), string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetStaticSites(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetStaticSitesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTopLevelDomain(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTopLevelDomainAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.TopLevelDomainCollection GetTopLevelDomains() { throw null; } + public virtual Azure.Pageable GetWebSites(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWebSitesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response PreviewStaticSiteWorkflow(Azure.Core.AzureLocation location, Azure.ResourceManager.AppService.Models.StaticSitesWorkflowPreviewContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PreviewStaticSiteWorkflowAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.AppService.Models.StaticSitesWorkflowPreviewContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ResetAllRecommendationFilters(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ResetAllRecommendationFiltersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ValidateAppServiceCertificateOrderPurchaseInformation(Azure.ResourceManager.AppService.AppServiceCertificateOrderData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ValidateAppServiceCertificateOrderPurchaseInformationAsync(Azure.ResourceManager.AppService.AppServiceCertificateOrderData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response VerifyHostingEnvironmentVnet(Azure.ResourceManager.AppService.Models.AppServiceVirtualNetworkValidationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> VerifyHostingEnvironmentVnetAsync(Azure.ResourceManager.AppService.Models.AppServiceVirtualNetworkValidationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MockableAppServiceTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableAppServiceTenantResource() { } + public virtual Azure.Response GetAppServiceSourceControl(string sourceControlType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAppServiceSourceControlAsync(string sourceControlType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.AppServiceSourceControlCollection GetAppServiceSourceControls() { throw null; } + public virtual Azure.Pageable GetAvailableStacksProviders(Azure.ResourceManager.AppService.Models.ProviderOSTypeSelected? osTypeSelected = default(Azure.ResourceManager.AppService.Models.ProviderOSTypeSelected?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableStacksProvidersAsync(Azure.ResourceManager.AppService.Models.ProviderOSTypeSelected? osTypeSelected = default(Azure.ResourceManager.AppService.Models.ProviderOSTypeSelected?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetFunctionAppStacksForLocationProviders(Azure.Core.AzureLocation location, Azure.ResourceManager.AppService.Models.ProviderStackOSType? stackOSType = default(Azure.ResourceManager.AppService.Models.ProviderStackOSType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFunctionAppStacksForLocationProvidersAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.AppService.Models.ProviderStackOSType? stackOSType = default(Azure.ResourceManager.AppService.Models.ProviderStackOSType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetFunctionAppStacksProviders(Azure.ResourceManager.AppService.Models.ProviderStackOSType? stackOSType = default(Azure.ResourceManager.AppService.Models.ProviderStackOSType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetFunctionAppStacksProvidersAsync(Azure.ResourceManager.AppService.Models.ProviderStackOSType? stackOSType = default(Azure.ResourceManager.AppService.Models.ProviderStackOSType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetOperationsCertificateRegistrationProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationsCertificateRegistrationProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetOperationsDomainRegistrationProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationsDomainRegistrationProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetOperationsProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOperationsProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AppService.PublishingUserResource GetPublishingUser() { throw null; } + public virtual Azure.Pageable GetWebAppStacksByLocation(Azure.Core.AzureLocation location, Azure.ResourceManager.AppService.Models.ProviderStackOSType? stackOSType = default(Azure.ResourceManager.AppService.Models.ProviderStackOSType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWebAppStacksByLocationAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.AppService.Models.ProviderStackOSType? stackOSType = default(Azure.ResourceManager.AppService.Models.ProviderStackOSType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWebAppStacksProviders(Azure.ResourceManager.AppService.Models.ProviderStackOSType? stackOSType = default(Azure.ResourceManager.AppService.Models.ProviderStackOSType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWebAppStacksProvidersAsync(Azure.ResourceManager.AppService.Models.ProviderStackOSType? stackOSType = default(Azure.ResourceManager.AppService.Models.ProviderStackOSType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.AppService.Models { public partial class AbnormalTimePeriod diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/AppServiceExtensions.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/AppServiceExtensions.cs index d90bdf7f64bfb..205c761f75166 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/AppServiceExtensions.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/AppServiceExtensions.cs @@ -5,10 +5,7 @@ using System; using System.Threading; -using System.Threading.Tasks; -using Azure; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.AppService.Models; using Azure.ResourceManager.Resources; @@ -37,9 +34,7 @@ public static partial class AppServiceExtensions /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAllSiteIdentifierDataAsync(this SubscriptionResource subscriptionResource, AppServiceDomainNameIdentifier nameIdentifier, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nameIdentifier, nameof(nameIdentifier)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllSiteIdentifierDataAsync(nameIdentifier, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAllSiteIdentifierDataAsync(nameIdentifier, cancellationToken); } /// @@ -62,9 +57,7 @@ public static AsyncPageable GetAllSiteIdentifierDataAs /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAllSiteIdentifierData(this SubscriptionResource subscriptionResource, AppServiceDomainNameIdentifier nameIdentifier, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nameIdentifier, nameof(nameIdentifier)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllSiteIdentifierData(nameIdentifier, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAllSiteIdentifierData(nameIdentifier, cancellationToken); } /// @@ -85,7 +78,7 @@ public static Pageable GetAllSiteIdentifierData(this S /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAllResourceHealthMetadataDataAsync(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAllResourceHealthMetadataDataAsync(cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAllResourceHealthMetadataDataAsync(cancellationToken); } /// @@ -106,7 +99,7 @@ public static AsyncPageable GetAllResourceHealthMeta /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAllResourceHealthMetadataData(this ResourceGroupResource resourceGroupResource, CancellationToken cancellationToken = default) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAllResourceHealthMetadataData(cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAllResourceHealthMetadataData(cancellationToken); } /// @@ -118,15 +111,9 @@ public static Pageable GetAllResourceHealthMetadataD /// Returns a object. public static WebSiteTriggeredwebJobResource GetWebSiteTriggeredwebJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteTriggeredwebJobResource.ValidateResourceId(id); - return new WebSiteTriggeredwebJobResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteTriggeredwebJobResource(id); } - #region WebSiteSlotTriggeredWebJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -136,16 +123,9 @@ public static WebSiteTriggeredwebJobResource GetWebSiteTriggeredwebJobResource(t /// Returns a object. public static WebSiteSlotTriggeredWebJobResource GetWebSiteSlotTriggeredWebJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotTriggeredWebJobResource.ValidateResourceId(id); - return new WebSiteSlotTriggeredWebJobResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotTriggeredWebJobResource(id); } - #endregion - #region WebSiteSlotTriggeredWebJobHistoryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -155,16 +135,9 @@ public static WebSiteSlotTriggeredWebJobResource GetWebSiteSlotTriggeredWebJobRe /// Returns a object. public static WebSiteSlotTriggeredWebJobHistoryResource GetWebSiteSlotTriggeredWebJobHistoryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotTriggeredWebJobHistoryResource.ValidateResourceId(id); - return new WebSiteSlotTriggeredWebJobHistoryResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotTriggeredWebJobHistoryResource(id); } - #endregion - #region WebSiteTriggeredWebJobHistoryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -174,13 +147,7 @@ public static WebSiteSlotTriggeredWebJobHistoryResource GetWebSiteSlotTriggeredW /// Returns a object. public static WebSiteTriggeredWebJobHistoryResource GetWebSiteTriggeredWebJobHistoryResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteTriggeredWebJobHistoryResource.ValidateResourceId(id); - return new WebSiteTriggeredWebJobHistoryResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteTriggeredWebJobHistoryResource(id); } - #endregion } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceArmClient.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceArmClient.cs new file mode 100644 index 0000000000000..95083447eea71 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService; + +namespace Azure.ResourceManager.AppService.Mocking +{ + public partial class MockableAppServiceArmClient : ArmResource + { + // we have to customize this because the WebSiteTriggeredwebJobResource.CreateResourceIdentifier method now has an overload and the generated version cannot compile + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteTriggeredwebJobResource GetWebSiteTriggeredwebJobResource(ResourceIdentifier id) + { + WebSiteTriggeredwebJobResource.ValidateResourceId(id); + return new WebSiteTriggeredwebJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotTriggeredWebJobResource GetWebSiteSlotTriggeredWebJobResource(ResourceIdentifier id) + { + WebSiteSlotTriggeredWebJobResource.ValidateResourceId(id); + return new WebSiteSlotTriggeredWebJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotTriggeredWebJobHistoryResource GetWebSiteSlotTriggeredWebJobHistoryResource(ResourceIdentifier id) + { + WebSiteSlotTriggeredWebJobHistoryResource.ValidateResourceId(id); + return new WebSiteSlotTriggeredWebJobHistoryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteTriggeredWebJobHistoryResource GetWebSiteTriggeredWebJobHistoryResource(ResourceIdentifier id) + { + WebSiteTriggeredWebJobHistoryResource.ValidateResourceId(id); + return new WebSiteTriggeredWebJobHistoryResource(Client, id); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceResourceGroupResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceResourceGroupResource.cs new file mode 100644 index 0000000000000..026de3c6473e2 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceResourceGroupResource.cs @@ -0,0 +1,100 @@ +// 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.Core; + +namespace Azure.ResourceManager.AppService.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAppServiceResourceGroupResource : ArmResource + { + /// + /// Description for List all ResourceHealthMetadata for all sites in the resource group in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata + /// Operation Id: ResourceHealthMetadata_ListByResourceGroup + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllResourceHealthMetadataDataAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = ResourceHealthMetadataClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllResourceHealthMetadataData"); + scope.Start(); + try + { + var response = await ResourceHealthMetadataRestClient.ListByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = ResourceHealthMetadataClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllResourceHealthMetadataData"); + scope.Start(); + try + { + var response = await ResourceHealthMetadataRestClient.ListByResourceGroupNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Description for List all ResourceHealthMetadata for all sites in the resource group in the subscription. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata + /// Operation Id: ResourceHealthMetadata_ListByResourceGroup + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllResourceHealthMetadataData(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = ResourceHealthMetadataClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllResourceHealthMetadataData"); + scope.Start(); + try + { + var response = ResourceHealthMetadataRestClient.ListByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = ResourceHealthMetadataClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllResourceHealthMetadataData"); + scope.Start(); + try + { + var response = ResourceHealthMetadataRestClient.ListByResourceGroupNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceSubscriptionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceSubscriptionResource.cs new file mode 100644 index 0000000000000..cdbdb5897db86 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/MockableAppServiceSubscriptionResource.cs @@ -0,0 +1,107 @@ +// 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.Core; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAppServiceSubscriptionResource : ArmResource + { + /// + /// Description for List all apps that are assigned to a hostname. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName + /// Operation Id: ListSiteIdentifiersAssignedToHostName + /// + /// Hostname information. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllSiteIdentifierDataAsync(AppServiceDomainNameIdentifier nameIdentifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nameIdentifier, nameof(nameIdentifier)); + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAllSiteIdentifierData"); + scope.Start(); + try + { + var response = await DefaultRestClient.ListSiteIdentifiersAssignedToHostNameAsync(Id.SubscriptionId, nameIdentifier, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAllSiteIdentifierData"); + scope.Start(); + try + { + var response = await DefaultRestClient.ListSiteIdentifiersAssignedToHostNameNextPageAsync(nextLink, Id.SubscriptionId, nameIdentifier, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// + /// Description for List all apps that are assigned to a hostname. + /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName + /// Operation Id: ListSiteIdentifiersAssignedToHostName + /// + /// Hostname information. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllSiteIdentifierData(AppServiceDomainNameIdentifier nameIdentifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nameIdentifier, nameof(nameIdentifier)); + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAllSiteIdentifierData"); + scope.Start(); + try + { + var response = DefaultRestClient.ListSiteIdentifiersAssignedToHostName(Id.SubscriptionId, nameIdentifier, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAllSiteIdentifierData"); + scope.Start(); + try + { + var response = DefaultRestClient.ListSiteIdentifiersAssignedToHostNameNextPage(nextLink, Id.SubscriptionId, nameIdentifier, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 97da3b7284075..0000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,104 +0,0 @@ -// 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; -using Azure.ResourceManager.AppService.Models; - -namespace Azure.ResourceManager.AppService -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - /// - /// Description for List all ResourceHealthMetadata for all sites in the resource group in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata - /// Operation Id: ResourceHealthMetadata_ListByResourceGroup - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllResourceHealthMetadataDataAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = ResourceHealthMetadataClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllResourceHealthMetadataData"); - scope.Start(); - try - { - var response = await ResourceHealthMetadataRestClient.ListByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = ResourceHealthMetadataClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllResourceHealthMetadataData"); - scope.Start(); - try - { - var response = await ResourceHealthMetadataRestClient.ListByResourceGroupNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Description for List all ResourceHealthMetadata for all sites in the resource group in the subscription. - /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/resourceHealthMetadata - /// Operation Id: ResourceHealthMetadata_ListByResourceGroup - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllResourceHealthMetadataData(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = ResourceHealthMetadataClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllResourceHealthMetadataData"); - scope.Start(); - try - { - var response = ResourceHealthMetadataRestClient.ListByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = ResourceHealthMetadataClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.GetAllResourceHealthMetadataData"); - scope.Start(); - try - { - var response = ResourceHealthMetadataRestClient.ListByResourceGroupNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 35d9efbd6b9c0..0000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Customization/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; - -namespace Azure.ResourceManager.AppService -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - /// - /// Description for List all apps that are assigned to a hostname. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName - /// Operation Id: ListSiteIdentifiersAssignedToHostName - /// - /// Hostname information. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllSiteIdentifierDataAsync(AppServiceDomainNameIdentifier nameIdentifier, CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAllSiteIdentifierData"); - scope.Start(); - try - { - var response = await DefaultRestClient.ListSiteIdentifiersAssignedToHostNameAsync(Id.SubscriptionId, nameIdentifier, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAllSiteIdentifierData"); - scope.Start(); - try - { - var response = await DefaultRestClient.ListSiteIdentifiersAssignedToHostNameNextPageAsync(nextLink, Id.SubscriptionId, nameIdentifier, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// - /// Description for List all apps that are assigned to a hostname. - /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Web/listSitesAssignedToHostName - /// Operation Id: ListSiteIdentifiersAssignedToHostName - /// - /// Hostname information. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllSiteIdentifierData(AppServiceDomainNameIdentifier nameIdentifier, CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAllSiteIdentifierData"); - scope.Start(); - try - { - var response = DefaultRestClient.ListSiteIdentifiersAssignedToHostName(Id.SubscriptionId, nameIdentifier, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAllSiteIdentifierData"); - scope.Start(); - try - { - var response = DefaultRestClient.ListSiteIdentifiersAssignedToHostNameNextPage(nextLink, Id.SubscriptionId, nameIdentifier, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateResource.cs index e19dcadb79f1b..705b192aa6d1a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.AppService public partial class AppCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs index 7dcacd87640ae..537cd0e572986 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.AppService public partial class AppServiceCertificateOrderResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The certificateOrderName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string certificateOrderName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppServiceCertificateResources and their operations over a AppServiceCertificateResource. public virtual AppServiceCertificateCollection GetAppServiceCertificates() { - return GetCachedClient(Client => new AppServiceCertificateCollection(Client, Id)); + return GetCachedClient(client => new AppServiceCertificateCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual AppServiceCertificateCollection GetAppServiceCertificates() /// /// Name of the certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppServiceCertificateAsync(string name, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> GetAppService /// /// Name of the certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppServiceCertificate(string name, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetAppServiceCertificate( /// An object representing collection of CertificateOrderDetectorResources and their operations over a CertificateOrderDetectorResource. public virtual CertificateOrderDetectorCollection GetCertificateOrderDetectors() { - return GetCachedClient(Client => new CertificateOrderDetectorCollection(Client, Id)); + return GetCachedClient(client => new CertificateOrderDetectorCollection(client, Id)); } /// @@ -167,8 +170,8 @@ public virtual CertificateOrderDetectorCollection GetCertificateOrderDetectors() /// The end time for the detector response. /// The time grain for the detector response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCertificateOrderDetectorAsync(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) { @@ -193,8 +196,8 @@ public virtual async Task> GetCertifi /// The end time for the detector response. /// The time grain for the detector response. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCertificateOrderDetector(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateResource.cs index 040e2cdf69923..451e05c7e78bb 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class AppServiceCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The certificateOrderName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string certificateOrderName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/certificates/{name}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs index b266a7948be6c..b91111998bdde 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.AppService public partial class AppServiceDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The domainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string domainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}"; @@ -92,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of DomainOwnershipIdentifierResources and their operations over a DomainOwnershipIdentifierResource. public virtual DomainOwnershipIdentifierCollection GetDomainOwnershipIdentifiers() { - return GetCachedClient(Client => new DomainOwnershipIdentifierCollection(Client, Id)); + return GetCachedClient(client => new DomainOwnershipIdentifierCollection(client, Id)); } /// @@ -110,8 +113,8 @@ public virtual DomainOwnershipIdentifierCollection GetDomainOwnershipIdentifiers /// /// Name of identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetDomainOwnershipIdentifierAsync(string name, CancellationToken cancellationToken = default) { @@ -133,8 +136,8 @@ public virtual async Task> GetDomain /// /// Name of identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetDomainOwnershipIdentifier(string name, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs index bc74773e71148..fafc5bb274719 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.AppService public partial class AppServiceEnvironmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}"; @@ -102,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HostingEnvironmentDetectorResources and their operations over a HostingEnvironmentDetectorResource. public virtual HostingEnvironmentDetectorCollection GetHostingEnvironmentDetectors() { - return GetCachedClient(Client => new HostingEnvironmentDetectorCollection(Client, Id)); + return GetCachedClient(client => new HostingEnvironmentDetectorCollection(client, Id)); } /// @@ -123,8 +126,8 @@ public virtual HostingEnvironmentDetectorCollection GetHostingEnvironmentDetecto /// End Time. /// Time Grain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHostingEnvironmentDetectorAsync(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) { @@ -149,8 +152,8 @@ public virtual async Task> GetHosti /// End Time. /// Time Grain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHostingEnvironmentDetector(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) { @@ -175,7 +178,7 @@ public virtual HostingEnvironmentMultiRolePoolResource GetHostingEnvironmentMult /// An object representing collection of HostingEnvironmentWorkerPoolResources and their operations over a HostingEnvironmentWorkerPoolResource. public virtual HostingEnvironmentWorkerPoolCollection GetHostingEnvironmentWorkerPools() { - return GetCachedClient(Client => new HostingEnvironmentWorkerPoolCollection(Client, Id)); + return GetCachedClient(client => new HostingEnvironmentWorkerPoolCollection(client, Id)); } /// @@ -193,8 +196,8 @@ public virtual HostingEnvironmentWorkerPoolCollection GetHostingEnvironmentWorke /// /// Name of the worker pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHostingEnvironmentWorkerPoolAsync(string workerPoolName, CancellationToken cancellationToken = default) { @@ -216,8 +219,8 @@ public virtual async Task> GetHos /// /// Name of the worker pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHostingEnvironmentWorkerPool(string workerPoolName, CancellationToken cancellationToken = default) { @@ -228,7 +231,7 @@ public virtual Response GetHostingEnvironm /// An object representing collection of HostingEnvironmentPrivateEndpointConnectionResources and their operations over a HostingEnvironmentPrivateEndpointConnectionResource. public virtual HostingEnvironmentPrivateEndpointConnectionCollection GetHostingEnvironmentPrivateEndpointConnections() { - return GetCachedClient(Client => new HostingEnvironmentPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new HostingEnvironmentPrivateEndpointConnectionCollection(client, Id)); } /// @@ -246,8 +249,8 @@ public virtual HostingEnvironmentPrivateEndpointConnectionCollection GetHostingE /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHostingEnvironmentPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -269,8 +272,8 @@ public virtual async Task /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHostingEnvironmentPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -281,7 +284,7 @@ public virtual Response Get /// An object representing collection of HostingEnvironmentRecommendationResources and their operations over a HostingEnvironmentRecommendationResource. public virtual HostingEnvironmentRecommendationCollection GetHostingEnvironmentRecommendations() { - return GetCachedClient(Client => new HostingEnvironmentRecommendationCollection(Client, Id)); + return GetCachedClient(client => new HostingEnvironmentRecommendationCollection(client, Id)); } /// @@ -301,8 +304,8 @@ public virtual HostingEnvironmentRecommendationCollection GetHostingEnvironmentR /// Specify <code>true</code> to update the last-seen timestamp of the recommendation object. /// The GUID of the recommendation object if you query an expired one. You don't need to specify it to query an active entry. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHostingEnvironmentRecommendationAsync(string name, bool? updateSeen = null, string recommendationId = null, CancellationToken cancellationToken = default) { @@ -326,8 +329,8 @@ public virtual async Task> Ge /// Specify <code>true</code> to update the last-seen timestamp of the recommendation object. /// The GUID of the recommendation object if you query an expired one. You don't need to specify it to query an active entry. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHostingEnvironmentRecommendation(string name, bool? updateSeen = null, string recommendationId = null, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs index 908875b4592b8..8d916cbfbdfe5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs @@ -27,6 +27,11 @@ namespace Azure.ResourceManager.AppService public partial class AppServicePlanHybridConnectionNamespaceRelayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The namespaceName. + /// The relayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs index c5dd2f2c9db59..d872909b4b4bc 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.AppService public partial class AppServicePlanResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppServicePlanHybridConnectionNamespaceRelayResources and their operations over a AppServicePlanHybridConnectionNamespaceRelayResource. public virtual AppServicePlanHybridConnectionNamespaceRelayCollection GetAppServicePlanHybridConnectionNamespaceRelays() { - return GetCachedClient(Client => new AppServicePlanHybridConnectionNamespaceRelayCollection(Client, Id)); + return GetCachedClient(client => new AppServicePlanHybridConnectionNamespaceRelayCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual AppServicePlanHybridConnectionNamespaceRelayCollection GetAppServ /// Name of the Service Bus namespace. /// Name of the Service Bus relay. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppServicePlanHybridConnectionNamespaceRelayAsync(string namespaceName, string relayName, CancellationToken cancellationToken = default) { @@ -136,8 +139,8 @@ public virtual async Task Name of the Service Bus namespace. /// Name of the Service Bus relay. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppServicePlanHybridConnectionNamespaceRelay(string namespaceName, string relayName, CancellationToken cancellationToken = default) { @@ -155,7 +158,7 @@ public virtual HybridConnectionLimitResource GetHybridConnectionLimit() /// An object representing collection of AppServicePlanVirtualNetworkConnectionResources and their operations over a AppServicePlanVirtualNetworkConnectionResource. public virtual AppServicePlanVirtualNetworkConnectionCollection GetAppServicePlanVirtualNetworkConnections() { - return GetCachedClient(Client => new AppServicePlanVirtualNetworkConnectionCollection(Client, Id)); + return GetCachedClient(client => new AppServicePlanVirtualNetworkConnectionCollection(client, Id)); } /// @@ -173,8 +176,8 @@ public virtual AppServicePlanVirtualNetworkConnectionCollection GetAppServicePla /// /// Name of the Virtual Network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppServicePlanVirtualNetworkConnectionAsync(string vnetName, CancellationToken cancellationToken = default) { @@ -196,8 +199,8 @@ public virtual async Task /// Name of the Virtual Network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppServicePlanVirtualNetworkConnection(string vnetName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayResource.cs index 1b35a7a85a0d8..52d54f3c12bcb 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class AppServicePlanVirtualNetworkConnectionGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The vnetName. + /// The gatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string vnetName, string gatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs index d24b51e5da15b..bf985b12e81c8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppService public partial class AppServicePlanVirtualNetworkConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The vnetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string vnetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of AppServicePlanVirtualNetworkConnectionGatewayResources and their operations over a AppServicePlanVirtualNetworkConnectionGatewayResource. public virtual AppServicePlanVirtualNetworkConnectionGatewayCollection GetAppServicePlanVirtualNetworkConnectionGateways() { - return GetCachedClient(Client => new AppServicePlanVirtualNetworkConnectionGatewayCollection(Client, Id)); + return GetCachedClient(client => new AppServicePlanVirtualNetworkConnectionGatewayCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual AppServicePlanVirtualNetworkConnectionGatewayCollection GetAppSer /// /// Name of the gateway. Only the 'primary' gateway is supported. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetAppServicePlanVirtualNetworkConnectionGatewayAsync(string gatewayName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task /// Name of the gateway. Only the 'primary' gateway is supported. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetAppServicePlanVirtualNetworkConnectionGateway(string gatewayName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlResource.cs index a9dd6fe0e4066..f60190de1f710 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlResource.cs @@ -26,6 +26,7 @@ namespace Azure.ResourceManager.AppService public partial class AppServiceSourceControlResource : ArmResource { /// Generate the resource identifier of a instance. + /// The sourceControlType. public static ResourceIdentifier CreateResourceIdentifier(string sourceControlType) { var resourceId = $"/providers/Microsoft.Web/sourcecontrols/{sourceControlType}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationResource.cs index b9f3d4ae4a8f8..e696a37cbf55e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class AseV3NetworkingConfigurationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/networking"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorResource.cs index 7f2665a8727e0..f538ce800ae27 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class CertificateOrderDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The certificateOrderName. + /// The detectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string certificateOrderName, string detectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName}/detectors/{detectorName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteResource.cs index bc19717363633..a686787edc152 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteResource.cs @@ -28,6 +28,8 @@ namespace Azure.ResourceManager.AppService public partial class DeletedSiteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The deletedSiteId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string deletedSiteId) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites/{deletedSiteId}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierResource.cs index 6ba016f16e6fe..94442cdcbe975 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class DomainOwnershipIdentifierResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The domainName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string domainName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs index daa9d5a452516..a26905af1132f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs @@ -11,6 +11,7 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Mocking; using Azure.ResourceManager.AppService.Models; using Azure.ResourceManager.Resources; @@ -19,2130 +20,1782 @@ namespace Azure.ResourceManager.AppService /// A class to add extension methods to Azure.ResourceManager.AppService. public static partial class AppServiceExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableAppServiceArmClient GetMockableAppServiceArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableAppServiceArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAppServiceResourceGroupResource GetMockableAppServiceResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAppServiceResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableAppServiceSubscriptionResource GetMockableAppServiceSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableAppServiceSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableAppServiceTenantResource GetMockableAppServiceTenantResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableAppServiceTenantResource(client, resource.Id)); } - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmResource resource) - { - return resource.GetCachedClient(client => - { - return new TenantResourceExtensionClient(client, resource.Id); - }); - } - - private static TenantResourceExtensionClient GetTenantResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new TenantResourceExtensionClient(client, scope); - }); - } - #region AppServiceCertificateOrderResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServiceCertificateOrderResource GetAppServiceCertificateOrderResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServiceCertificateOrderResource.ValidateResourceId(id); - return new AppServiceCertificateOrderResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServiceCertificateOrderResource(id); } - #endregion - #region AppServiceCertificateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServiceCertificateResource GetAppServiceCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServiceCertificateResource.ValidateResourceId(id); - return new AppServiceCertificateResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServiceCertificateResource(id); } - #endregion - #region CertificateOrderDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static CertificateOrderDetectorResource GetCertificateOrderDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - CertificateOrderDetectorResource.ValidateResourceId(id); - return new CertificateOrderDetectorResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetCertificateOrderDetectorResource(id); } - #endregion - #region HostingEnvironmentDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HostingEnvironmentDetectorResource GetHostingEnvironmentDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HostingEnvironmentDetectorResource.ValidateResourceId(id); - return new HostingEnvironmentDetectorResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetHostingEnvironmentDetectorResource(id); } - #endregion - #region SiteDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteDetectorResource GetSiteDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteDetectorResource.ValidateResourceId(id); - return new SiteDetectorResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteDetectorResource(id); } - #endregion - #region SiteSlotDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotDetectorResource GetSiteSlotDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotDetectorResource.ValidateResourceId(id); - return new SiteSlotDetectorResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotDetectorResource(id); } - #endregion - #region AppServiceDomainResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServiceDomainResource GetAppServiceDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServiceDomainResource.ValidateResourceId(id); - return new AppServiceDomainResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServiceDomainResource(id); } - #endregion - #region DomainOwnershipIdentifierResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DomainOwnershipIdentifierResource GetDomainOwnershipIdentifierResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DomainOwnershipIdentifierResource.ValidateResourceId(id); - return new DomainOwnershipIdentifierResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetDomainOwnershipIdentifierResource(id); } - #endregion - #region TopLevelDomainResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static TopLevelDomainResource GetTopLevelDomainResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - TopLevelDomainResource.ValidateResourceId(id); - return new TopLevelDomainResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetTopLevelDomainResource(id); } - #endregion - #region AppServiceEnvironmentResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServiceEnvironmentResource GetAppServiceEnvironmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServiceEnvironmentResource.ValidateResourceId(id); - return new AppServiceEnvironmentResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServiceEnvironmentResource(id); } - #endregion - #region AseV3NetworkingConfigurationResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AseV3NetworkingConfigurationResource GetAseV3NetworkingConfigurationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AseV3NetworkingConfigurationResource.ValidateResourceId(id); - return new AseV3NetworkingConfigurationResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAseV3NetworkingConfigurationResource(id); } - #endregion - #region HostingEnvironmentMultiRolePoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HostingEnvironmentMultiRolePoolResource GetHostingEnvironmentMultiRolePoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HostingEnvironmentMultiRolePoolResource.ValidateResourceId(id); - return new HostingEnvironmentMultiRolePoolResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetHostingEnvironmentMultiRolePoolResource(id); } - #endregion - #region HostingEnvironmentWorkerPoolResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HostingEnvironmentWorkerPoolResource GetHostingEnvironmentWorkerPoolResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HostingEnvironmentWorkerPoolResource.ValidateResourceId(id); - return new HostingEnvironmentWorkerPoolResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetHostingEnvironmentWorkerPoolResource(id); } - #endregion - #region HostingEnvironmentPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HostingEnvironmentPrivateEndpointConnectionResource GetHostingEnvironmentPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HostingEnvironmentPrivateEndpointConnectionResource.ValidateResourceId(id); - return new HostingEnvironmentPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetHostingEnvironmentPrivateEndpointConnectionResource(id); } - #endregion - #region StaticSitePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StaticSitePrivateEndpointConnectionResource GetStaticSitePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StaticSitePrivateEndpointConnectionResource.ValidateResourceId(id); - return new StaticSitePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetStaticSitePrivateEndpointConnectionResource(id); } - #endregion - #region SitePrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SitePrivateEndpointConnectionResource GetSitePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SitePrivateEndpointConnectionResource.ValidateResourceId(id); - return new SitePrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSitePrivateEndpointConnectionResource(id); } - #endregion - #region SiteSlotPrivateEndpointConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotPrivateEndpointConnectionResource GetSiteSlotPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotPrivateEndpointConnectionResource.ValidateResourceId(id); - return new SiteSlotPrivateEndpointConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotPrivateEndpointConnectionResource(id); } - #endregion - #region AppServicePlanResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServicePlanResource GetAppServicePlanResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServicePlanResource.ValidateResourceId(id); - return new AppServicePlanResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServicePlanResource(id); } - #endregion - #region AppServicePlanHybridConnectionNamespaceRelayResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServicePlanHybridConnectionNamespaceRelayResource GetAppServicePlanHybridConnectionNamespaceRelayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServicePlanHybridConnectionNamespaceRelayResource.ValidateResourceId(id); - return new AppServicePlanHybridConnectionNamespaceRelayResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServicePlanHybridConnectionNamespaceRelayResource(id); } - #endregion - #region SiteHybridConnectionNamespaceRelayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteHybridConnectionNamespaceRelayResource GetSiteHybridConnectionNamespaceRelayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteHybridConnectionNamespaceRelayResource.ValidateResourceId(id); - return new SiteHybridConnectionNamespaceRelayResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteHybridConnectionNamespaceRelayResource(id); } - #endregion - #region SiteSlotHybridConnectionNamespaceRelayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotHybridConnectionNamespaceRelayResource GetSiteSlotHybridConnectionNamespaceRelayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotHybridConnectionNamespaceRelayResource.ValidateResourceId(id); - return new SiteSlotHybridConnectionNamespaceRelayResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotHybridConnectionNamespaceRelayResource(id); } - #endregion - #region HybridConnectionLimitResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HybridConnectionLimitResource GetHybridConnectionLimitResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HybridConnectionLimitResource.ValidateResourceId(id); - return new HybridConnectionLimitResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetHybridConnectionLimitResource(id); } - #endregion - #region AppServicePlanVirtualNetworkConnectionResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServicePlanVirtualNetworkConnectionResource GetAppServicePlanVirtualNetworkConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServicePlanVirtualNetworkConnectionResource.ValidateResourceId(id); - return new AppServicePlanVirtualNetworkConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServicePlanVirtualNetworkConnectionResource(id); } - #endregion - #region SiteSlotVirtualNetworkConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotVirtualNetworkConnectionResource GetSiteSlotVirtualNetworkConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotVirtualNetworkConnectionResource.ValidateResourceId(id); - return new SiteSlotVirtualNetworkConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotVirtualNetworkConnectionResource(id); } - #endregion - #region SiteVirtualNetworkConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteVirtualNetworkConnectionResource GetSiteVirtualNetworkConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteVirtualNetworkConnectionResource.ValidateResourceId(id); - return new SiteVirtualNetworkConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteVirtualNetworkConnectionResource(id); } - #endregion - #region AppServicePlanVirtualNetworkConnectionGatewayResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServicePlanVirtualNetworkConnectionGatewayResource GetAppServicePlanVirtualNetworkConnectionGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServicePlanVirtualNetworkConnectionGatewayResource.ValidateResourceId(id); - return new AppServicePlanVirtualNetworkConnectionGatewayResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServicePlanVirtualNetworkConnectionGatewayResource(id); } - #endregion - #region SiteSlotVirtualNetworkConnectionGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotVirtualNetworkConnectionGatewayResource GetSiteSlotVirtualNetworkConnectionGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotVirtualNetworkConnectionGatewayResource.ValidateResourceId(id); - return new SiteSlotVirtualNetworkConnectionGatewayResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotVirtualNetworkConnectionGatewayResource(id); } - #endregion - #region SiteVirtualNetworkConnectionGatewayResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteVirtualNetworkConnectionGatewayResource GetSiteVirtualNetworkConnectionGatewayResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteVirtualNetworkConnectionGatewayResource.ValidateResourceId(id); - return new SiteVirtualNetworkConnectionGatewayResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteVirtualNetworkConnectionGatewayResource(id); } - #endregion - #region AppCertificateResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppCertificateResource GetAppCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppCertificateResource.ValidateResourceId(id); - return new AppCertificateResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppCertificateResource(id); } - #endregion - #region SiteDiagnosticResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteDiagnosticResource GetSiteDiagnosticResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteDiagnosticResource.ValidateResourceId(id); - return new SiteDiagnosticResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteDiagnosticResource(id); } - #endregion - #region SiteSlotDiagnosticResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotDiagnosticResource GetSiteSlotDiagnosticResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotDiagnosticResource.ValidateResourceId(id); - return new SiteSlotDiagnosticResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotDiagnosticResource(id); } - #endregion - #region SiteDiagnosticAnalysisResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteDiagnosticAnalysisResource GetSiteDiagnosticAnalysisResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteDiagnosticAnalysisResource.ValidateResourceId(id); - return new SiteDiagnosticAnalysisResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteDiagnosticAnalysisResource(id); } - #endregion - #region SiteSlotDiagnosticAnalysisResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotDiagnosticAnalysisResource GetSiteSlotDiagnosticAnalysisResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotDiagnosticAnalysisResource.ValidateResourceId(id); - return new SiteSlotDiagnosticAnalysisResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotDiagnosticAnalysisResource(id); } - #endregion - #region SiteDiagnosticDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteDiagnosticDetectorResource GetSiteDiagnosticDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteDiagnosticDetectorResource.ValidateResourceId(id); - return new SiteDiagnosticDetectorResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteDiagnosticDetectorResource(id); } - #endregion - #region SiteSlotDiagnosticDetectorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotDiagnosticDetectorResource GetSiteSlotDiagnosticDetectorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotDiagnosticDetectorResource.ValidateResourceId(id); - return new SiteSlotDiagnosticDetectorResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotDiagnosticDetectorResource(id); } - #endregion - #region DeletedSiteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static DeletedSiteResource GetDeletedSiteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - DeletedSiteResource.ValidateResourceId(id); - return new DeletedSiteResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetDeletedSiteResource(id); } - #endregion - #region KubeEnvironmentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static KubeEnvironmentResource GetKubeEnvironmentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - KubeEnvironmentResource.ValidateResourceId(id); - return new KubeEnvironmentResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetKubeEnvironmentResource(id); } - #endregion - #region HostingEnvironmentRecommendationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HostingEnvironmentRecommendationResource GetHostingEnvironmentRecommendationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HostingEnvironmentRecommendationResource.ValidateResourceId(id); - return new HostingEnvironmentRecommendationResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetHostingEnvironmentRecommendationResource(id); } - #endregion - #region SiteRecommendationResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteRecommendationResource GetSiteRecommendationResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteRecommendationResource.ValidateResourceId(id); - return new SiteRecommendationResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteRecommendationResource(id); } - #endregion - #region WebSiteResourceHealthMetadataResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteResourceHealthMetadataResource GetWebSiteResourceHealthMetadataResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteResourceHealthMetadataResource.ValidateResourceId(id); - return new WebSiteResourceHealthMetadataResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteResourceHealthMetadataResource(id); } - #endregion - #region WebSiteSlotResourceHealthMetadataResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotResourceHealthMetadataResource GetWebSiteSlotResourceHealthMetadataResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotResourceHealthMetadataResource.ValidateResourceId(id); - return new WebSiteSlotResourceHealthMetadataResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotResourceHealthMetadataResource(id); } - #endregion - #region PublishingUserResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static PublishingUserResource GetPublishingUserResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - PublishingUserResource.ValidateResourceId(id); - return new PublishingUserResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetPublishingUserResource(id); } - #endregion - #region AppServiceSourceControlResource /// /// 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static AppServiceSourceControlResource GetAppServiceSourceControlResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - AppServiceSourceControlResource.ValidateResourceId(id); - return new AppServiceSourceControlResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetAppServiceSourceControlResource(id); } - #endregion - #region StaticSiteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StaticSiteResource GetStaticSiteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StaticSiteResource.ValidateResourceId(id); - return new StaticSiteResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetStaticSiteResource(id); } - #endregion - #region StaticSiteBuildResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StaticSiteBuildResource GetStaticSiteBuildResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StaticSiteBuildResource.ValidateResourceId(id); - return new StaticSiteBuildResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetStaticSiteBuildResource(id); } - #endregion - #region StaticSiteBuildUserProvidedFunctionAppResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StaticSiteBuildUserProvidedFunctionAppResource GetStaticSiteBuildUserProvidedFunctionAppResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StaticSiteBuildUserProvidedFunctionAppResource.ValidateResourceId(id); - return new StaticSiteBuildUserProvidedFunctionAppResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetStaticSiteBuildUserProvidedFunctionAppResource(id); } - #endregion - #region StaticSiteUserProvidedFunctionAppResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StaticSiteUserProvidedFunctionAppResource GetStaticSiteUserProvidedFunctionAppResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StaticSiteUserProvidedFunctionAppResource.ValidateResourceId(id); - return new StaticSiteUserProvidedFunctionAppResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetStaticSiteUserProvidedFunctionAppResource(id); } - #endregion - #region StaticSiteCustomDomainOverviewResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static StaticSiteCustomDomainOverviewResource GetStaticSiteCustomDomainOverviewResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - StaticSiteCustomDomainOverviewResource.ValidateResourceId(id); - return new StaticSiteCustomDomainOverviewResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetStaticSiteCustomDomainOverviewResource(id); } - #endregion - #region WebSiteResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteResource GetWebSiteResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteResource.ValidateResourceId(id); - return new WebSiteResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteResource(id); } - #endregion - #region WebSiteSlotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotResource GetWebSiteSlotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotResource.ValidateResourceId(id); - return new WebSiteSlotResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotResource(id); } - #endregion - #region SiteBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteBackupResource GetSiteBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteBackupResource.ValidateResourceId(id); - return new SiteBackupResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteBackupResource(id); } - #endregion - #region SiteSlotBackupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotBackupResource GetSiteSlotBackupResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotBackupResource.ValidateResourceId(id); - return new SiteSlotBackupResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotBackupResource(id); } - #endregion - #region WebSiteFtpPublishingCredentialsPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteFtpPublishingCredentialsPolicyResource GetWebSiteFtpPublishingCredentialsPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteFtpPublishingCredentialsPolicyResource.ValidateResourceId(id); - return new WebSiteFtpPublishingCredentialsPolicyResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteFtpPublishingCredentialsPolicyResource(id); } - #endregion - #region ScmSiteBasicPublishingCredentialsPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScmSiteBasicPublishingCredentialsPolicyResource GetScmSiteBasicPublishingCredentialsPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScmSiteBasicPublishingCredentialsPolicyResource.ValidateResourceId(id); - return new ScmSiteBasicPublishingCredentialsPolicyResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetScmSiteBasicPublishingCredentialsPolicyResource(id); } - #endregion - #region WebSiteSlotFtpPublishingCredentialsPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotFtpPublishingCredentialsPolicyResource GetWebSiteSlotFtpPublishingCredentialsPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotFtpPublishingCredentialsPolicyResource.ValidateResourceId(id); - return new WebSiteSlotFtpPublishingCredentialsPolicyResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotFtpPublishingCredentialsPolicyResource(id); } - #endregion - #region ScmSiteSlotBasicPublishingCredentialsPolicyResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static ScmSiteSlotBasicPublishingCredentialsPolicyResource GetScmSiteSlotBasicPublishingCredentialsPolicyResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - ScmSiteSlotBasicPublishingCredentialsPolicyResource.ValidateResourceId(id); - return new ScmSiteSlotBasicPublishingCredentialsPolicyResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetScmSiteSlotBasicPublishingCredentialsPolicyResource(id); } - #endregion - #region SiteConfigAppsettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteConfigAppsettingResource GetSiteConfigAppsettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteConfigAppsettingResource.ValidateResourceId(id); - return new SiteConfigAppsettingResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteConfigAppsettingResource(id); } - #endregion - #region WebSiteConfigConnectionStringResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteConfigConnectionStringResource GetWebSiteConfigConnectionStringResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteConfigConnectionStringResource.ValidateResourceId(id); - return new WebSiteConfigConnectionStringResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteConfigConnectionStringResource(id); } - #endregion - #region WebSiteSlotConfigAppSettingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotConfigAppSettingResource GetWebSiteSlotConfigAppSettingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotConfigAppSettingResource.ValidateResourceId(id); - return new WebSiteSlotConfigAppSettingResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotConfigAppSettingResource(id); } - #endregion - #region WebSiteSlotConfigConnectionStringResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotConfigConnectionStringResource GetWebSiteSlotConfigConnectionStringResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotConfigConnectionStringResource.ValidateResourceId(id); - return new WebSiteSlotConfigConnectionStringResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotConfigConnectionStringResource(id); } - #endregion - #region LogsSiteConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogsSiteConfigResource GetLogsSiteConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogsSiteConfigResource.ValidateResourceId(id); - return new LogsSiteConfigResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetLogsSiteConfigResource(id); } - #endregion - #region LogsSiteSlotConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static LogsSiteSlotConfigResource GetLogsSiteSlotConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - LogsSiteSlotConfigResource.ValidateResourceId(id); - return new LogsSiteSlotConfigResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetLogsSiteSlotConfigResource(id); } - #endregion - #region SlotConfigNamesResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SlotConfigNamesResource GetSlotConfigNamesResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SlotConfigNamesResource.ValidateResourceId(id); - return new SlotConfigNamesResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSlotConfigNamesResource(id); } - #endregion - #region WebSiteConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteConfigResource GetWebSiteConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteConfigResource.ValidateResourceId(id); - return new WebSiteConfigResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteConfigResource(id); } - #endregion - #region SiteConfigSnapshotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteConfigSnapshotResource GetSiteConfigSnapshotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteConfigSnapshotResource.ValidateResourceId(id); - return new SiteConfigSnapshotResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteConfigSnapshotResource(id); } - #endregion - #region WebSiteSlotConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotConfigResource GetWebSiteSlotConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotConfigResource.ValidateResourceId(id); - return new WebSiteSlotConfigResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotConfigResource(id); } - #endregion - #region SiteSlotConfigSnapshotResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotConfigSnapshotResource GetSiteSlotConfigSnapshotResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotConfigSnapshotResource.ValidateResourceId(id); - return new SiteSlotConfigSnapshotResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotConfigSnapshotResource(id); } - #endregion - #region WebSiteContinuousWebJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteContinuousWebJobResource GetWebSiteContinuousWebJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteContinuousWebJobResource.ValidateResourceId(id); - return new WebSiteContinuousWebJobResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteContinuousWebJobResource(id); } - #endregion - #region WebSiteSlotContinuousWebJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotContinuousWebJobResource GetWebSiteSlotContinuousWebJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotContinuousWebJobResource.ValidateResourceId(id); - return new WebSiteSlotContinuousWebJobResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotContinuousWebJobResource(id); } - #endregion - #region SiteDeploymentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteDeploymentResource GetSiteDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteDeploymentResource.ValidateResourceId(id); - return new SiteDeploymentResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteDeploymentResource(id); } - #endregion - #region SiteSlotDeploymentResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotDeploymentResource GetSiteSlotDeploymentResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotDeploymentResource.ValidateResourceId(id); - return new SiteSlotDeploymentResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotDeploymentResource(id); } - #endregion - #region SiteDomainOwnershipIdentifierResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteDomainOwnershipIdentifierResource GetSiteDomainOwnershipIdentifierResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteDomainOwnershipIdentifierResource.ValidateResourceId(id); - return new SiteDomainOwnershipIdentifierResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteDomainOwnershipIdentifierResource(id); } - #endregion - #region SiteSlotDomainOwnershipIdentifierResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotDomainOwnershipIdentifierResource GetSiteSlotDomainOwnershipIdentifierResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotDomainOwnershipIdentifierResource.ValidateResourceId(id); - return new SiteSlotDomainOwnershipIdentifierResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotDomainOwnershipIdentifierResource(id); } - #endregion - #region SiteExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteExtensionResource GetSiteExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteExtensionResource.ValidateResourceId(id); - return new SiteExtensionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteExtensionResource(id); } - #endregion - #region SiteInstanceExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteInstanceExtensionResource GetSiteInstanceExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteInstanceExtensionResource.ValidateResourceId(id); - return new SiteInstanceExtensionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteInstanceExtensionResource(id); } - #endregion - #region SiteSlotExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotExtensionResource GetSiteSlotExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotExtensionResource.ValidateResourceId(id); - return new SiteSlotExtensionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotExtensionResource(id); } - #endregion - #region SiteSlotInstanceExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotInstanceExtensionResource GetSiteSlotInstanceExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotInstanceExtensionResource.ValidateResourceId(id); - return new SiteSlotInstanceExtensionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotInstanceExtensionResource(id); } - #endregion - #region SiteFunctionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteFunctionResource GetSiteFunctionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteFunctionResource.ValidateResourceId(id); - return new SiteFunctionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteFunctionResource(id); } - #endregion - #region SiteSlotFunctionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotFunctionResource GetSiteSlotFunctionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotFunctionResource.ValidateResourceId(id); - return new SiteSlotFunctionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotFunctionResource(id); } - #endregion - #region SiteHostNameBindingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteHostNameBindingResource GetSiteHostNameBindingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteHostNameBindingResource.ValidateResourceId(id); - return new SiteHostNameBindingResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteHostNameBindingResource(id); } - #endregion - #region SiteSlotHostNameBindingResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotHostNameBindingResource GetSiteSlotHostNameBindingResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotHostNameBindingResource.ValidateResourceId(id); - return new SiteSlotHostNameBindingResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotHostNameBindingResource(id); } - #endregion - #region WebSiteHybridConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteHybridConnectionResource GetWebSiteHybridConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteHybridConnectionResource.ValidateResourceId(id); - return new WebSiteHybridConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteHybridConnectionResource(id); } - #endregion - #region WebSiteSlotHybridConnectionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotHybridConnectionResource GetWebSiteSlotHybridConnectionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotHybridConnectionResource.ValidateResourceId(id); - return new WebSiteSlotHybridConnectionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotHybridConnectionResource(id); } - #endregion - #region SiteInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteInstanceResource GetSiteInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteInstanceResource.ValidateResourceId(id); - return new SiteInstanceResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteInstanceResource(id); } - #endregion - #region SiteSlotInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotInstanceResource GetSiteSlotInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotInstanceResource.ValidateResourceId(id); - return new SiteSlotInstanceResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotInstanceResource(id); } - #endregion - #region SiteInstanceProcessResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteInstanceProcessResource GetSiteInstanceProcessResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteInstanceProcessResource.ValidateResourceId(id); - return new SiteInstanceProcessResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteInstanceProcessResource(id); } - #endregion - #region SiteProcessResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteProcessResource GetSiteProcessResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteProcessResource.ValidateResourceId(id); - return new SiteProcessResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteProcessResource(id); } - #endregion - #region SiteSlotInstanceProcessResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotInstanceProcessResource GetSiteSlotInstanceProcessResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotInstanceProcessResource.ValidateResourceId(id); - return new SiteSlotInstanceProcessResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotInstanceProcessResource(id); } - #endregion - #region SiteSlotProcessResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotProcessResource GetSiteSlotProcessResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotProcessResource.ValidateResourceId(id); - return new SiteSlotProcessResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotProcessResource(id); } - #endregion - #region SiteInstanceProcessModuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteInstanceProcessModuleResource GetSiteInstanceProcessModuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteInstanceProcessModuleResource.ValidateResourceId(id); - return new SiteInstanceProcessModuleResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteInstanceProcessModuleResource(id); } - #endregion - #region SiteProcessModuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteProcessModuleResource GetSiteProcessModuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteProcessModuleResource.ValidateResourceId(id); - return new SiteProcessModuleResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteProcessModuleResource(id); } - #endregion - #region SiteSlotInstanceProcessModuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotInstanceProcessModuleResource GetSiteSlotInstanceProcessModuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotInstanceProcessModuleResource.ValidateResourceId(id); - return new SiteSlotInstanceProcessModuleResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotInstanceProcessModuleResource(id); } - #endregion - #region SiteSlotProcessModuleResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotProcessModuleResource GetSiteSlotProcessModuleResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotProcessModuleResource.ValidateResourceId(id); - return new SiteSlotProcessModuleResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotProcessModuleResource(id); } - #endregion - #region SiteNetworkConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteNetworkConfigResource GetSiteNetworkConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteNetworkConfigResource.ValidateResourceId(id); - return new SiteNetworkConfigResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteNetworkConfigResource(id); } - #endregion - #region SiteSlotNetworkConfigResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SiteSlotNetworkConfigResource GetSiteSlotNetworkConfigResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SiteSlotNetworkConfigResource.ValidateResourceId(id); - return new SiteSlotNetworkConfigResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSiteSlotNetworkConfigResource(id); } - #endregion - #region WebSitePremierAddonResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSitePremierAddonResource GetWebSitePremierAddonResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSitePremierAddonResource.ValidateResourceId(id); - return new WebSitePremierAddonResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSitePremierAddonResource(id); } - #endregion - #region WebSiteSlotPremierAddOnResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotPremierAddOnResource GetWebSiteSlotPremierAddOnResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotPremierAddOnResource.ValidateResourceId(id); - return new WebSiteSlotPremierAddOnResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotPremierAddOnResource(id); } - #endregion - #region WebSitePrivateAccessResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSitePrivateAccessResource GetWebSitePrivateAccessResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSitePrivateAccessResource.ValidateResourceId(id); - return new WebSitePrivateAccessResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSitePrivateAccessResource(id); } - #endregion - #region WebSiteSlotPrivateAccessResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotPrivateAccessResource GetWebSiteSlotPrivateAccessResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotPrivateAccessResource.ValidateResourceId(id); - return new WebSiteSlotPrivateAccessResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotPrivateAccessResource(id); } - #endregion - #region SitePublicCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SitePublicCertificateResource GetSitePublicCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SitePublicCertificateResource.ValidateResourceId(id); - return new SitePublicCertificateResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetSitePublicCertificateResource(id); } - #endregion - #region WebSiteSlotPublicCertificateResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotPublicCertificateResource GetWebSiteSlotPublicCertificateResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotPublicCertificateResource.ValidateResourceId(id); - return new WebSiteSlotPublicCertificateResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotPublicCertificateResource(id); } - #endregion - #region WebSiteExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteExtensionResource GetWebSiteExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteExtensionResource.ValidateResourceId(id); - return new WebSiteExtensionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteExtensionResource(id); } - #endregion - #region WebSiteSlotExtensionResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotExtensionResource GetWebSiteSlotExtensionResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotExtensionResource.ValidateResourceId(id); - return new WebSiteSlotExtensionResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotExtensionResource(id); } - #endregion - #region MigrateMySqlStatusResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static MigrateMySqlStatusResource GetMigrateMySqlStatusResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - MigrateMySqlStatusResource.ValidateResourceId(id); - return new MigrateMySqlStatusResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetMigrateMySqlStatusResource(id); } - #endregion - #region NetworkFeatureResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static NetworkFeatureResource GetNetworkFeatureResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - NetworkFeatureResource.ValidateResourceId(id); - return new NetworkFeatureResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetNetworkFeatureResource(id); } - #endregion - #region WebSiteSlotSourceControlResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotSourceControlResource GetWebSiteSlotSourceControlResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotSourceControlResource.ValidateResourceId(id); - return new WebSiteSlotSourceControlResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotSourceControlResource(id); } - #endregion - #region WebSiteSourceControlResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSourceControlResource GetWebSiteSourceControlResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSourceControlResource.ValidateResourceId(id); - return new WebSiteSourceControlResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSourceControlResource(id); } - #endregion - #region WebSiteSlotWebJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteSlotWebJobResource GetWebSiteSlotWebJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteSlotWebJobResource.ValidateResourceId(id); - return new WebSiteSlotWebJobResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteSlotWebJobResource(id); } - #endregion - #region WebSiteWebJobResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static WebSiteWebJobResource GetWebSiteWebJobResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - WebSiteWebJobResource.ValidateResourceId(id); - return new WebSiteWebJobResource(client, id); - } - ); + return GetMockableAppServiceArmClient(client).GetWebSiteWebJobResource(id); } - #endregion - /// Gets a collection of AppServiceCertificateOrderResources in the ResourceGroupResource. + /// + /// Gets a collection of AppServiceCertificateOrderResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AppServiceCertificateOrderResources and their operations over a AppServiceCertificateOrderResource. public static AppServiceCertificateOrderCollection GetAppServiceCertificateOrders(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAppServiceCertificateOrders(); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceCertificateOrders(); } /// @@ -2157,16 +1810,20 @@ public static AppServiceCertificateOrderCollection GetAppServiceCertificateOrder /// AppServiceCertificateOrders_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the certificate order.. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAppServiceCertificateOrderAsync(this ResourceGroupResource resourceGroupResource, string certificateOrderName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAppServiceCertificateOrders().GetAsync(certificateOrderName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceCertificateOrderAsync(certificateOrderName, cancellationToken).ConfigureAwait(false); } /// @@ -2181,24 +1838,34 @@ public static async Task> GetAppSer /// AppServiceCertificateOrders_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the certificate order.. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAppServiceCertificateOrder(this ResourceGroupResource resourceGroupResource, string certificateOrderName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAppServiceCertificateOrders().Get(certificateOrderName, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceCertificateOrder(certificateOrderName, cancellationToken); } - /// Gets a collection of AppServiceDomainResources in the ResourceGroupResource. + /// + /// Gets a collection of AppServiceDomainResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AppServiceDomainResources and their operations over a AppServiceDomainResource. public static AppServiceDomainCollection GetAppServiceDomains(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAppServiceDomains(); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceDomains(); } /// @@ -2213,16 +1880,20 @@ public static AppServiceDomainCollection GetAppServiceDomains(this ResourceGroup /// Domains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAppServiceDomainAsync(this ResourceGroupResource resourceGroupResource, string domainName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAppServiceDomains().GetAsync(domainName, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceDomainAsync(domainName, cancellationToken).ConfigureAwait(false); } /// @@ -2237,24 +1908,34 @@ public static async Task> GetAppServiceDomain /// Domains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAppServiceDomain(this ResourceGroupResource resourceGroupResource, string domainName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAppServiceDomains().Get(domainName, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceDomain(domainName, cancellationToken); } - /// Gets a collection of AppServiceEnvironmentResources in the ResourceGroupResource. + /// + /// Gets a collection of AppServiceEnvironmentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AppServiceEnvironmentResources and their operations over a AppServiceEnvironmentResource. public static AppServiceEnvironmentCollection GetAppServiceEnvironments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAppServiceEnvironments(); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceEnvironments(); } /// @@ -2269,16 +1950,20 @@ public static AppServiceEnvironmentCollection GetAppServiceEnvironments(this Res /// AppServiceEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the App Service Environment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAppServiceEnvironmentAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAppServiceEnvironments().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceEnvironmentAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -2293,24 +1978,34 @@ public static async Task> GetAppServiceE /// AppServiceEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the App Service Environment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAppServiceEnvironment(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAppServiceEnvironments().Get(name, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServiceEnvironment(name, cancellationToken); } - /// Gets a collection of AppServicePlanResources in the ResourceGroupResource. + /// + /// Gets a collection of AppServicePlanResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AppServicePlanResources and their operations over a AppServicePlanResource. public static AppServicePlanCollection GetAppServicePlans(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAppServicePlans(); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServicePlans(); } /// @@ -2325,16 +2020,20 @@ public static AppServicePlanCollection GetAppServicePlans(this ResourceGroupReso /// AppServicePlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the App Service plan. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAppServicePlanAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAppServicePlans().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServicePlanAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -2349,24 +2048,34 @@ public static async Task> GetAppServicePlanAsyn /// AppServicePlans_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the App Service plan. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAppServicePlan(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAppServicePlans().Get(name, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppServicePlan(name, cancellationToken); } - /// Gets a collection of AppCertificateResources in the ResourceGroupResource. + /// + /// Gets a collection of AppCertificateResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AppCertificateResources and their operations over a AppCertificateResource. public static AppCertificateCollection GetAppCertificates(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetAppCertificates(); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppCertificates(); } /// @@ -2381,16 +2090,20 @@ public static AppCertificateCollection GetAppCertificates(this ResourceGroupReso /// Certificates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAppCertificateAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetAppCertificates().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppCertificateAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -2405,24 +2118,34 @@ public static async Task> GetAppCertificateAsyn /// Certificates_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the certificate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAppCertificate(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetAppCertificates().Get(name, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppCertificate(name, cancellationToken); } - /// Gets a collection of KubeEnvironmentResources in the ResourceGroupResource. + /// + /// Gets a collection of KubeEnvironmentResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of KubeEnvironmentResources and their operations over a KubeEnvironmentResource. public static KubeEnvironmentCollection GetKubeEnvironments(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetKubeEnvironments(); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetKubeEnvironments(); } /// @@ -2437,16 +2160,20 @@ public static KubeEnvironmentCollection GetKubeEnvironments(this ResourceGroupRe /// KubeEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Kubernetes Environment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetKubeEnvironmentAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetKubeEnvironments().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetKubeEnvironmentAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -2461,24 +2188,34 @@ public static async Task> GetKubeEnvironmentAs /// KubeEnvironments_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the Kubernetes Environment. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetKubeEnvironment(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetKubeEnvironments().Get(name, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetKubeEnvironment(name, cancellationToken); } - /// Gets a collection of StaticSiteResources in the ResourceGroupResource. + /// + /// Gets a collection of StaticSiteResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of StaticSiteResources and their operations over a StaticSiteResource. public static StaticSiteCollection GetStaticSites(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetStaticSites(); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetStaticSites(); } /// @@ -2493,16 +2230,20 @@ public static StaticSiteCollection GetStaticSites(this ResourceGroupResource res /// StaticSites_GetStaticSite /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the static site. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetStaticSiteAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetStaticSites().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetStaticSiteAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -2517,24 +2258,34 @@ public static async Task> GetStaticSiteAsync(this R /// StaticSites_GetStaticSite /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the static site. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetStaticSite(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetStaticSites().Get(name, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetStaticSite(name, cancellationToken); } - /// Gets a collection of WebSiteResources in the ResourceGroupResource. + /// + /// Gets a collection of WebSiteResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of WebSiteResources and their operations over a WebSiteResource. public static WebSiteCollection GetWebSites(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetWebSites(); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetWebSites(); } /// @@ -2549,16 +2300,20 @@ public static WebSiteCollection GetWebSites(this ResourceGroupResource resourceG /// WebApps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the app. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetWebSiteAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetWebSites().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetWebSiteAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -2573,16 +2328,20 @@ public static async Task> GetWebSiteAsync(this Resourc /// WebApps_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the app. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetWebSite(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetWebSites().Get(name, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetWebSite(name, cancellationToken); } /// @@ -2597,6 +2356,10 @@ public static Response GetWebSite(this ResourceGroupResource re /// Validate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Request with the resources to validate. @@ -2604,9 +2367,7 @@ public static Response GetWebSite(this ResourceGroupResource re /// is null. public static async Task> ValidateAsync(this ResourceGroupResource resourceGroupResource, AppServiceValidateContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).ValidateAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).ValidateAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -2621,6 +2382,10 @@ public static async Task> ValidateAsync(this /// Validate /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Request with the resources to validate. @@ -2628,17 +2393,21 @@ public static async Task> ValidateAsync(this /// is null. public static Response Validate(this ResourceGroupResource resourceGroupResource, AppServiceValidateContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).Validate(content, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).Validate(content, cancellationToken); } - /// Gets a collection of TopLevelDomainResources in the SubscriptionResource. + /// + /// Gets a collection of TopLevelDomainResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of TopLevelDomainResources and their operations over a TopLevelDomainResource. public static TopLevelDomainCollection GetTopLevelDomains(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetTopLevelDomains(); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetTopLevelDomains(); } /// @@ -2653,16 +2422,20 @@ public static TopLevelDomainCollection GetTopLevelDomains(this SubscriptionResou /// TopLevelDomains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the top-level domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetTopLevelDomainAsync(this SubscriptionResource subscriptionResource, string name, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetTopLevelDomains().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).GetTopLevelDomainAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -2677,24 +2450,34 @@ public static async Task> GetTopLevelDomainAsyn /// TopLevelDomains_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the top-level domain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetTopLevelDomain(this SubscriptionResource subscriptionResource, string name, CancellationToken cancellationToken = default) { - return subscriptionResource.GetTopLevelDomains().Get(name, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetTopLevelDomain(name, cancellationToken); } - /// Gets a collection of DeletedSiteResources in the SubscriptionResource. + /// + /// Gets a collection of DeletedSiteResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of DeletedSiteResources and their operations over a DeletedSiteResource. public static DeletedSiteCollection GetDeletedSites(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedSites(); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetDeletedSites(); } /// @@ -2709,16 +2492,20 @@ public static DeletedSiteCollection GetDeletedSites(this SubscriptionResource su /// Global_GetDeletedWebApp /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The numeric ID of the deleted app, e.g. 12345. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetDeletedSiteAsync(this SubscriptionResource subscriptionResource, string deletedSiteId, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetDeletedSites().GetAsync(deletedSiteId, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).GetDeletedSiteAsync(deletedSiteId, cancellationToken).ConfigureAwait(false); } /// @@ -2733,16 +2520,20 @@ public static async Task> GetDeletedSiteAsync(this /// Global_GetDeletedWebApp /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The numeric ID of the deleted app, e.g. 12345. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetDeletedSite(this SubscriptionResource subscriptionResource, string deletedSiteId, CancellationToken cancellationToken = default) { - return subscriptionResource.GetDeletedSites().Get(deletedSiteId, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetDeletedSite(deletedSiteId, cancellationToken); } /// @@ -2757,13 +2548,17 @@ public static Response GetDeletedSite(this SubscriptionReso /// AppServiceCertificateOrders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppServiceCertificateOrdersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceCertificateOrdersAsync(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceCertificateOrdersAsync(cancellationToken); } /// @@ -2778,13 +2573,17 @@ public static AsyncPageable GetAppServiceCer /// AppServiceCertificateOrders_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppServiceCertificateOrders(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceCertificateOrders(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceCertificateOrders(cancellationToken); } /// @@ -2799,6 +2598,10 @@ public static Pageable GetAppServiceCertific /// AppServiceCertificateOrders_ValidatePurchaseInformation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Information for a certificate order. @@ -2806,9 +2609,7 @@ public static Pageable GetAppServiceCertific /// is null. public static async Task ValidateAppServiceCertificateOrderPurchaseInformationAsync(this SubscriptionResource subscriptionResource, AppServiceCertificateOrderData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateAppServiceCertificateOrderPurchaseInformationAsync(data, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).ValidateAppServiceCertificateOrderPurchaseInformationAsync(data, cancellationToken).ConfigureAwait(false); } /// @@ -2823,6 +2624,10 @@ public static async Task ValidateAppServiceCertificateOrderPurchaseInf /// AppServiceCertificateOrders_ValidatePurchaseInformation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Information for a certificate order. @@ -2830,9 +2635,7 @@ public static async Task ValidateAppServiceCertificateOrderPurchaseInf /// is null. public static Response ValidateAppServiceCertificateOrderPurchaseInformation(this SubscriptionResource subscriptionResource, AppServiceCertificateOrderData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).ValidateAppServiceCertificateOrderPurchaseInformation(data, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).ValidateAppServiceCertificateOrderPurchaseInformation(data, cancellationToken); } /// @@ -2847,6 +2650,10 @@ public static Response ValidateAppServiceCertificateOrderPurchaseInformation(thi /// Domains_CheckAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the domain. @@ -2854,9 +2661,7 @@ public static Response ValidateAppServiceCertificateOrderPurchaseInformation(thi /// is null. public static async Task> CheckAppServiceDomainRegistrationAvailabilityAsync(this SubscriptionResource subscriptionResource, AppServiceDomainNameIdentifier identifier, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(identifier, nameof(identifier)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAppServiceDomainRegistrationAvailabilityAsync(identifier, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).CheckAppServiceDomainRegistrationAvailabilityAsync(identifier, cancellationToken).ConfigureAwait(false); } /// @@ -2871,6 +2676,10 @@ public static async Task> CheckAppServic /// Domains_CheckAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the domain. @@ -2878,9 +2687,7 @@ public static async Task> CheckAppServic /// is null. public static Response CheckAppServiceDomainRegistrationAvailability(this SubscriptionResource subscriptionResource, AppServiceDomainNameIdentifier identifier, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(identifier, nameof(identifier)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAppServiceDomainRegistrationAvailability(identifier, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).CheckAppServiceDomainRegistrationAvailability(identifier, cancellationToken); } /// @@ -2895,13 +2702,17 @@ public static Response CheckAppServiceDomainRegis /// Domains_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppServiceDomainsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceDomainsAsync(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceDomainsAsync(cancellationToken); } /// @@ -2916,13 +2727,17 @@ public static AsyncPageable GetAppServiceDomainsAsync( /// Domains_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppServiceDomains(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceDomains(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceDomains(cancellationToken); } /// @@ -2937,12 +2752,16 @@ public static Pageable GetAppServiceDomains(this Subsc /// Domains_GetControlCenterSsoRequest /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetControlCenterSsoRequestDomainAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetControlCenterSsoRequestDomainAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).GetControlCenterSsoRequestDomainAsync(cancellationToken).ConfigureAwait(false); } /// @@ -2957,12 +2776,16 @@ public static async Task> GetControl /// Domains_GetControlCenterSsoRequest /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetControlCenterSsoRequestDomain(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetControlCenterSsoRequestDomain(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetControlCenterSsoRequestDomain(cancellationToken); } /// @@ -2977,6 +2800,10 @@ public static Response GetControlCenterSsoReq /// Domains_ListRecommendations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Search parameters for domain name recommendations. @@ -2985,9 +2812,7 @@ public static Response GetControlCenterSsoReq /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAppServiceDomainRecommendationsAsync(this SubscriptionResource subscriptionResource, DomainRecommendationSearchContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceDomainRecommendationsAsync(content, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceDomainRecommendationsAsync(content, cancellationToken); } /// @@ -3002,6 +2827,10 @@ public static AsyncPageable GetAppServiceDomainR /// Domains_ListRecommendations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Search parameters for domain name recommendations. @@ -3010,9 +2839,7 @@ public static AsyncPageable GetAppServiceDomainR /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAppServiceDomainRecommendations(this SubscriptionResource subscriptionResource, DomainRecommendationSearchContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceDomainRecommendations(content, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceDomainRecommendations(content, cancellationToken); } /// @@ -3027,13 +2854,17 @@ public static Pageable GetAppServiceDomainRecomm /// AppServiceEnvironments_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppServiceEnvironmentsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceEnvironmentsAsync(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceEnvironmentsAsync(cancellationToken); } /// @@ -3048,13 +2879,17 @@ public static AsyncPageable GetAppServiceEnvironm /// AppServiceEnvironments_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAppServiceEnvironments(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceEnvironments(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceEnvironments(cancellationToken); } /// @@ -3069,6 +2904,10 @@ public static Pageable GetAppServiceEnvironments( /// AppServicePlans_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// @@ -3079,7 +2918,7 @@ public static Pageable GetAppServiceEnvironments( /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAppServicePlansAsync(this SubscriptionResource subscriptionResource, bool? detailed = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServicePlansAsync(detailed, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServicePlansAsync(detailed, cancellationToken); } /// @@ -3094,6 +2933,10 @@ public static AsyncPageable GetAppServicePlansAsync(this /// AppServicePlans_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// @@ -3104,7 +2947,7 @@ public static AsyncPageable GetAppServicePlansAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAppServicePlans(this SubscriptionResource subscriptionResource, bool? detailed = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServicePlans(detailed, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServicePlans(detailed, cancellationToken); } /// @@ -3119,6 +2962,10 @@ public static Pageable GetAppServicePlans(this Subscript /// Certificates_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Return only information specified in the filter (using OData syntax). For example: $filter=KeyVaultId eq 'KeyVaultId'. @@ -3126,7 +2973,7 @@ public static Pageable GetAppServicePlans(this Subscript /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAppCertificatesAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppCertificatesAsync(filter, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppCertificatesAsync(filter, cancellationToken); } /// @@ -3141,6 +2988,10 @@ public static AsyncPageable GetAppCertificatesAsync(this /// Certificates_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Return only information specified in the filter (using OData syntax). For example: $filter=KeyVaultId eq 'KeyVaultId'. @@ -3148,7 +2999,7 @@ public static AsyncPageable GetAppCertificatesAsync(this /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAppCertificates(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppCertificates(filter, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppCertificates(filter, cancellationToken); } /// @@ -3163,6 +3014,10 @@ public static Pageable GetAppCertificates(this Subscript /// DeletedWebApps_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -3170,7 +3025,7 @@ public static Pageable GetAppCertificates(this Subscript /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDeletedSitesByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedSitesByLocationAsync(location, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetDeletedSitesByLocationAsync(location, cancellationToken); } /// @@ -3185,6 +3040,10 @@ public static AsyncPageable GetDeletedSitesByLocationAsync( /// DeletedWebApps_ListByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -3192,7 +3051,7 @@ public static AsyncPageable GetDeletedSitesByLocationAsync( /// A collection of that may take multiple service requests to iterate over. public static Pageable GetDeletedSitesByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedSitesByLocation(location, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetDeletedSitesByLocation(location, cancellationToken); } /// @@ -3207,6 +3066,10 @@ public static Pageable GetDeletedSitesByLocation(this Subsc /// DeletedWebApps_GetDeletedWebAppByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -3216,9 +3079,7 @@ public static Pageable GetDeletedSitesByLocation(this Subsc /// is null. public static async Task> GetDeletedWebAppByLocationDeletedWebAppAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string deletedSiteId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deletedSiteId, nameof(deletedSiteId)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedWebAppByLocationDeletedWebAppAsync(location, deletedSiteId, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).GetDeletedWebAppByLocationDeletedWebAppAsync(location, deletedSiteId, cancellationToken).ConfigureAwait(false); } /// @@ -3233,6 +3094,10 @@ public static async Task> GetDeletedWebAppByLocati /// DeletedWebApps_GetDeletedWebAppByLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The String to use. @@ -3242,9 +3107,7 @@ public static async Task> GetDeletedWebAppByLocati /// is null. public static Response GetDeletedWebAppByLocationDeletedWebApp(this SubscriptionResource subscriptionResource, AzureLocation location, string deletedSiteId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(deletedSiteId, nameof(deletedSiteId)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDeletedWebAppByLocationDeletedWebApp(location, deletedSiteId, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetDeletedWebAppByLocationDeletedWebApp(location, deletedSiteId, cancellationToken); } /// @@ -3259,13 +3122,17 @@ public static Response GetDeletedWebAppByLocationDeletedWeb /// KubeEnvironments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetKubeEnvironmentsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetKubeEnvironmentsAsync(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetKubeEnvironmentsAsync(cancellationToken); } /// @@ -3280,13 +3147,17 @@ public static AsyncPageable GetKubeEnvironmentsAsync(th /// KubeEnvironments_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetKubeEnvironments(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetKubeEnvironments(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetKubeEnvironments(cancellationToken); } /// @@ -3301,6 +3172,10 @@ public static Pageable GetKubeEnvironments(this Subscri /// Provider_GetAvailableStacksOnPrem /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ProviderOSTypeSelected to use. @@ -3308,7 +3183,7 @@ public static Pageable GetKubeEnvironments(this Subscri /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableStacksOnPremProvidersAsync(this SubscriptionResource subscriptionResource, ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableStacksOnPremProvidersAsync(osTypeSelected, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAvailableStacksOnPremProvidersAsync(osTypeSelected, cancellationToken); } /// @@ -3323,6 +3198,10 @@ public static AsyncPageable GetAvailableStacksOnPremPr /// Provider_GetAvailableStacksOnPrem /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ProviderOSTypeSelected to use. @@ -3330,7 +3209,7 @@ public static AsyncPageable GetAvailableStacksOnPremPr /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableStacksOnPremProviders(this SubscriptionResource subscriptionResource, ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAvailableStacksOnPremProviders(osTypeSelected, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAvailableStacksOnPremProviders(osTypeSelected, cancellationToken); } /// @@ -3345,6 +3224,10 @@ public static Pageable GetAvailableStacksOnPremProvide /// Recommendations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. @@ -3353,7 +3236,7 @@ public static Pageable GetAvailableStacksOnPremProvide /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetRecommendationsAsync(this SubscriptionResource subscriptionResource, bool? featured = null, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRecommendationsAsync(featured, filter, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetRecommendationsAsync(featured, filter, cancellationToken); } /// @@ -3368,6 +3251,10 @@ public static AsyncPageable GetRecommendationsAsync(th /// Recommendations_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. @@ -3376,7 +3263,7 @@ public static AsyncPageable GetRecommendationsAsync(th /// A collection of that may take multiple service requests to iterate over. public static Pageable GetRecommendations(this SubscriptionResource subscriptionResource, bool? featured = null, string filter = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetRecommendations(featured, filter, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetRecommendations(featured, filter, cancellationToken); } /// @@ -3391,12 +3278,16 @@ public static Pageable GetRecommendations(this Subscri /// Recommendations_ResetAllFilters /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task ResetAllRecommendationFiltersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).ResetAllRecommendationFiltersAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).ResetAllRecommendationFiltersAsync(cancellationToken).ConfigureAwait(false); } /// @@ -3411,12 +3302,16 @@ public static async Task ResetAllRecommendationFiltersAsync(this Subsc /// Recommendations_ResetAllFilters /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response ResetAllRecommendationFilters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).ResetAllRecommendationFilters(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).ResetAllRecommendationFilters(cancellationToken); } /// @@ -3431,6 +3326,10 @@ public static Response ResetAllRecommendationFilters(this SubscriptionResource s /// Recommendations_DisableRecommendationForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Rule name. @@ -3439,9 +3338,7 @@ public static Response ResetAllRecommendationFilters(this SubscriptionResource s /// is null. public static async Task DisableAppServiceRecommendationAsync(this SubscriptionResource subscriptionResource, string name, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).DisableAppServiceRecommendationAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).DisableAppServiceRecommendationAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -3456,6 +3353,10 @@ public static async Task DisableAppServiceRecommendationAsync(this Sub /// Recommendations_DisableRecommendationForSubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Rule name. @@ -3464,9 +3365,7 @@ public static async Task DisableAppServiceRecommendationAsync(this Sub /// is null. public static Response DisableAppServiceRecommendation(this SubscriptionResource subscriptionResource, string name, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).DisableAppServiceRecommendation(name, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).DisableAppServiceRecommendation(name, cancellationToken); } /// @@ -3481,13 +3380,17 @@ public static Response DisableAppServiceRecommendation(this SubscriptionResource /// ResourceHealthMetadata_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAllResourceHealthMetadataAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllResourceHealthMetadataAsync(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAllResourceHealthMetadataAsync(cancellationToken); } /// @@ -3502,13 +3405,17 @@ public static AsyncPageable GetAllResourceHealthMeta /// ResourceHealthMetadata_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetAllResourceHealthMetadata(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAllResourceHealthMetadata(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAllResourceHealthMetadata(cancellationToken); } /// @@ -3523,6 +3430,10 @@ public static Pageable GetAllResourceHealthMetadata( /// ListBillingMeters /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure Location of billable resource. @@ -3531,7 +3442,7 @@ public static Pageable GetAllResourceHealthMetadata( /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetBillingMetersAsync(this SubscriptionResource subscriptionResource, string billingLocation = null, string osType = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBillingMetersAsync(billingLocation, osType, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetBillingMetersAsync(billingLocation, osType, cancellationToken); } /// @@ -3546,6 +3457,10 @@ public static AsyncPageable GetBillingMetersAsync(this S /// ListBillingMeters /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Azure Location of billable resource. @@ -3554,7 +3469,7 @@ public static AsyncPageable GetBillingMetersAsync(this S /// A collection of that may take multiple service requests to iterate over. public static Pageable GetBillingMeters(this SubscriptionResource subscriptionResource, string billingLocation = null, string osType = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetBillingMeters(billingLocation, osType, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetBillingMeters(billingLocation, osType, cancellationToken); } /// @@ -3569,6 +3484,10 @@ public static Pageable GetBillingMeters(this Subscriptio /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name availability request. @@ -3576,9 +3495,7 @@ public static Pageable GetBillingMeters(this Subscriptio /// is null. public static async Task> CheckAppServiceNameAvailabilityAsync(this SubscriptionResource subscriptionResource, ResourceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAppServiceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).CheckAppServiceNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -3593,6 +3510,10 @@ public static async Task> CheckAppServiceName /// CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name availability request. @@ -3600,9 +3521,7 @@ public static async Task> CheckAppServiceName /// is null. public static Response CheckAppServiceNameAvailability(this SubscriptionResource subscriptionResource, ResourceNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckAppServiceNameAvailability(content, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).CheckAppServiceNameAvailability(content, cancellationToken); } /// @@ -3617,12 +3536,16 @@ public static Response CheckAppServiceNameAvailability /// GetSubscriptionDeploymentLocations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetAppServiceDeploymentLocationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceDeploymentLocationsAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceDeploymentLocationsAsync(cancellationToken).ConfigureAwait(false); } /// @@ -3637,12 +3560,16 @@ public static async Task> GetAppServiceD /// GetSubscriptionDeploymentLocations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetAppServiceDeploymentLocations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetAppServiceDeploymentLocations(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceDeploymentLocations(cancellationToken); } /// @@ -3657,6 +3584,10 @@ public static Response GetAppServiceDeploymentLoc /// ListGeoRegions /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of SKU used to filter the regions. @@ -3667,7 +3598,7 @@ public static Response GetAppServiceDeploymentLoc /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetGeoRegionsAsync(this SubscriptionResource subscriptionResource, AppServiceSkuName? sku = null, bool? linuxWorkersEnabled = null, bool? xenonWorkersEnabled = null, bool? linuxDynamicWorkersEnabled = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGeoRegionsAsync(sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetGeoRegionsAsync(sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled, cancellationToken); } /// @@ -3682,6 +3613,10 @@ public static AsyncPageable GetGeoRegionsAsync(this Subscri /// ListGeoRegions /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of SKU used to filter the regions. @@ -3692,7 +3627,7 @@ public static AsyncPageable GetGeoRegionsAsync(this Subscri /// A collection of that may take multiple service requests to iterate over. public static Pageable GetGeoRegions(this SubscriptionResource subscriptionResource, AppServiceSkuName? sku = null, bool? linuxWorkersEnabled = null, bool? xenonWorkersEnabled = null, bool? linuxDynamicWorkersEnabled = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetGeoRegions(sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetGeoRegions(sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled, cancellationToken); } /// @@ -3707,13 +3642,17 @@ public static Pageable GetGeoRegions(this SubscriptionResou /// ListPremierAddOnOffers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPremierAddOnOffersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPremierAddOnOffersAsync(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetPremierAddOnOffersAsync(cancellationToken); } /// @@ -3728,13 +3667,17 @@ public static AsyncPageable GetPremierAddOnOffersAsync(this S /// ListPremierAddOnOffers /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetPremierAddOnOffers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetPremierAddOnOffers(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetPremierAddOnOffers(cancellationToken); } /// @@ -3749,12 +3692,16 @@ public static Pageable GetPremierAddOnOffers(this Subscriptio /// ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static async Task> GetSkusAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkusAsync(cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).GetSkusAsync(cancellationToken).ConfigureAwait(false); } /// @@ -3769,12 +3716,16 @@ public static async Task> GetSkusAsync(this Subscr /// ListSkus /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The cancellation token to use. public static Response GetSkus(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSkus(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetSkus(cancellationToken); } /// @@ -3789,6 +3740,10 @@ public static Response GetSkus(this SubscriptionResource su /// VerifyHostingEnvironmentVnet /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// VNET information. @@ -3796,9 +3751,7 @@ public static Response GetSkus(this SubscriptionResource su /// is null. public static async Task> VerifyHostingEnvironmentVnetAsync(this SubscriptionResource subscriptionResource, AppServiceVirtualNetworkValidationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).VerifyHostingEnvironmentVnetAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).VerifyHostingEnvironmentVnetAsync(content, cancellationToken).ConfigureAwait(false); } /// @@ -3813,6 +3766,10 @@ public static async Task> Verif /// VerifyHostingEnvironmentVnet /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// VNET information. @@ -3820,9 +3777,7 @@ public static async Task> Verif /// is null. public static Response VerifyHostingEnvironmentVnet(this SubscriptionResource subscriptionResource, AppServiceVirtualNetworkValidationContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).VerifyHostingEnvironmentVnet(content, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).VerifyHostingEnvironmentVnet(content, cancellationToken); } /// @@ -3837,6 +3792,10 @@ public static Response VerifyHostingEnvi /// StaticSites_PreviewWorkflow /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location where you plan to create the static site. @@ -3845,9 +3804,7 @@ public static Response VerifyHostingEnvi /// is null. public static async Task> PreviewStaticSiteWorkflowAsync(this SubscriptionResource subscriptionResource, AzureLocation location, StaticSitesWorkflowPreviewContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return await GetSubscriptionResourceExtensionClient(subscriptionResource).PreviewStaticSiteWorkflowAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceSubscriptionResource(subscriptionResource).PreviewStaticSiteWorkflowAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -3862,6 +3819,10 @@ public static async Task> PreviewStaticSite /// StaticSites_PreviewWorkflow /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Location where you plan to create the static site. @@ -3870,9 +3831,7 @@ public static async Task> PreviewStaticSite /// is null. public static Response PreviewStaticSiteWorkflow(this SubscriptionResource subscriptionResource, AzureLocation location, StaticSitesWorkflowPreviewContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - return GetSubscriptionResourceExtensionClient(subscriptionResource).PreviewStaticSiteWorkflow(location, content, cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).PreviewStaticSiteWorkflow(location, content, cancellationToken); } /// @@ -3887,13 +3846,17 @@ public static Response PreviewStaticSiteWorkflow(thi /// StaticSites_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStaticSitesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStaticSitesAsync(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetStaticSitesAsync(cancellationToken); } /// @@ -3908,13 +3871,17 @@ public static AsyncPageable GetStaticSitesAsync(this Subscri /// StaticSites_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetStaticSites(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetStaticSites(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetStaticSites(cancellationToken); } /// @@ -3929,13 +3896,17 @@ public static Pageable GetStaticSites(this SubscriptionResou /// WebApps_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetWebSitesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWebSitesAsync(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetWebSitesAsync(cancellationToken); } /// @@ -3950,29 +3921,45 @@ public static AsyncPageable GetWebSitesAsync(this SubscriptionR /// WebApps_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetWebSites(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetWebSites(cancellationToken); + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetWebSites(cancellationToken); } - /// Gets an object representing a PublishingUserResource along with the instance operations that can be performed on it in the TenantResource. + /// + /// Gets an object representing a PublishingUserResource along with the instance operations that can be performed on it in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// Returns a object. public static PublishingUserResource GetPublishingUser(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetPublishingUser(); + return GetMockableAppServiceTenantResource(tenantResource).GetPublishingUser(); } - /// Gets a collection of AppServiceSourceControlResources in the TenantResource. + /// + /// Gets a collection of AppServiceSourceControlResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of AppServiceSourceControlResources and their operations over a AppServiceSourceControlResource. public static AppServiceSourceControlCollection GetAppServiceSourceControls(this TenantResource tenantResource) { - return GetTenantResourceExtensionClient(tenantResource).GetAppServiceSourceControls(); + return GetMockableAppServiceTenantResource(tenantResource).GetAppServiceSourceControls(); } /// @@ -3987,16 +3974,20 @@ public static AppServiceSourceControlCollection GetAppServiceSourceControls(this /// GetSourceControl /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Type of source control. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetAppServiceSourceControlAsync(this TenantResource tenantResource, string sourceControlType, CancellationToken cancellationToken = default) { - return await tenantResource.GetAppServiceSourceControls().GetAsync(sourceControlType, cancellationToken).ConfigureAwait(false); + return await GetMockableAppServiceTenantResource(tenantResource).GetAppServiceSourceControlAsync(sourceControlType, cancellationToken).ConfigureAwait(false); } /// @@ -4011,16 +4002,20 @@ public static async Task> GetAppServic /// GetSourceControl /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Type of source control. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetAppServiceSourceControl(this TenantResource tenantResource, string sourceControlType, CancellationToken cancellationToken = default) { - return tenantResource.GetAppServiceSourceControls().Get(sourceControlType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetAppServiceSourceControl(sourceControlType, cancellationToken); } /// @@ -4035,13 +4030,17 @@ public static Response GetAppServiceSourceContr /// CertificateRegistrationProvider_ListOperations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsCertificateRegistrationProvidersAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsCertificateRegistrationProvidersAsync(cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetOperationsCertificateRegistrationProvidersAsync(cancellationToken); } /// @@ -4056,13 +4055,17 @@ public static AsyncPageable GetOperationsCertificateReg /// CertificateRegistrationProvider_ListOperations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsCertificateRegistrationProviders(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsCertificateRegistrationProviders(cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetOperationsCertificateRegistrationProviders(cancellationToken); } /// @@ -4077,13 +4080,17 @@ public static Pageable GetOperationsCertificateRegistra /// DomainRegistrationProvider_ListOperations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsDomainRegistrationProvidersAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsDomainRegistrationProvidersAsync(cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetOperationsDomainRegistrationProvidersAsync(cancellationToken); } /// @@ -4098,13 +4105,17 @@ public static AsyncPageable GetOperationsDomainRegistra /// DomainRegistrationProvider_ListOperations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsDomainRegistrationProviders(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsDomainRegistrationProviders(cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetOperationsDomainRegistrationProviders(cancellationToken); } /// @@ -4119,6 +4130,10 @@ public static Pageable GetOperationsDomainRegistrationP /// Provider_GetAvailableStacks /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ProviderOSTypeSelected to use. @@ -4126,7 +4141,7 @@ public static Pageable GetOperationsDomainRegistrationP /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAvailableStacksProvidersAsync(this TenantResource tenantResource, ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetAvailableStacksProvidersAsync(osTypeSelected, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetAvailableStacksProvidersAsync(osTypeSelected, cancellationToken); } /// @@ -4141,6 +4156,10 @@ public static AsyncPageable GetAvailableStacksProvider /// Provider_GetAvailableStacks /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The ProviderOSTypeSelected to use. @@ -4148,7 +4167,7 @@ public static AsyncPageable GetAvailableStacksProvider /// A collection of that may take multiple service requests to iterate over. public static Pageable GetAvailableStacksProviders(this TenantResource tenantResource, ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetAvailableStacksProviders(osTypeSelected, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetAvailableStacksProviders(osTypeSelected, cancellationToken); } /// @@ -4163,6 +4182,10 @@ public static Pageable GetAvailableStacksProviders(thi /// Provider_GetFunctionAppStacks /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Stack OS Type. @@ -4170,7 +4193,7 @@ public static Pageable GetAvailableStacksProviders(thi /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetFunctionAppStacksProvidersAsync(this TenantResource tenantResource, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetFunctionAppStacksProvidersAsync(stackOSType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetFunctionAppStacksProvidersAsync(stackOSType, cancellationToken); } /// @@ -4185,6 +4208,10 @@ public static AsyncPageable GetFunctionAppStacksProvidersAsync /// Provider_GetFunctionAppStacks /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Stack OS Type. @@ -4192,7 +4219,7 @@ public static AsyncPageable GetFunctionAppStacksProvidersAsync /// A collection of that may take multiple service requests to iterate over. public static Pageable GetFunctionAppStacksProviders(this TenantResource tenantResource, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetFunctionAppStacksProviders(stackOSType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetFunctionAppStacksProviders(stackOSType, cancellationToken); } /// @@ -4207,6 +4234,10 @@ public static Pageable GetFunctionAppStacksProviders(this Tena /// Provider_GetFunctionAppStacksForLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Function App stack location. @@ -4215,7 +4246,7 @@ public static Pageable GetFunctionAppStacksProviders(this Tena /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetFunctionAppStacksForLocationProvidersAsync(this TenantResource tenantResource, AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetFunctionAppStacksForLocationProvidersAsync(location, stackOSType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetFunctionAppStacksForLocationProvidersAsync(location, stackOSType, cancellationToken); } /// @@ -4230,6 +4261,10 @@ public static AsyncPageable GetFunctionAppStacksForLocationPro /// Provider_GetFunctionAppStacksForLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Function App stack location. @@ -4238,7 +4273,7 @@ public static AsyncPageable GetFunctionAppStacksForLocationPro /// A collection of that may take multiple service requests to iterate over. public static Pageable GetFunctionAppStacksForLocationProviders(this TenantResource tenantResource, AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetFunctionAppStacksForLocationProviders(location, stackOSType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetFunctionAppStacksForLocationProviders(location, stackOSType, cancellationToken); } /// @@ -4253,6 +4288,10 @@ public static Pageable GetFunctionAppStacksForLocationProvider /// Provider_GetWebAppStacksForLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Web App stack location. @@ -4261,7 +4300,7 @@ public static Pageable GetFunctionAppStacksForLocationProvider /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetWebAppStacksByLocationAsync(this TenantResource tenantResource, AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetWebAppStacksByLocationAsync(location, stackOSType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetWebAppStacksByLocationAsync(location, stackOSType, cancellationToken); } /// @@ -4276,6 +4315,10 @@ public static AsyncPageable GetWebAppStacksByLocationAsync(this Ten /// Provider_GetWebAppStacksForLocation /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Web App stack location. @@ -4284,7 +4327,7 @@ public static AsyncPageable GetWebAppStacksByLocationAsync(this Ten /// A collection of that may take multiple service requests to iterate over. public static Pageable GetWebAppStacksByLocation(this TenantResource tenantResource, AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetWebAppStacksByLocation(location, stackOSType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetWebAppStacksByLocation(location, stackOSType, cancellationToken); } /// @@ -4299,13 +4342,17 @@ public static Pageable GetWebAppStacksByLocation(this TenantResourc /// Provider_ListOperations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsProvidersAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsProvidersAsync(cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetOperationsProvidersAsync(cancellationToken); } /// @@ -4320,13 +4367,17 @@ public static AsyncPageable GetOperationsProvidersAsync /// Provider_ListOperations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetOperationsProviders(this TenantResource tenantResource, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetOperationsProviders(cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetOperationsProviders(cancellationToken); } /// @@ -4341,6 +4392,10 @@ public static Pageable GetOperationsProviders(this Tena /// Provider_GetWebAppStacks /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Stack OS Type. @@ -4348,7 +4403,7 @@ public static Pageable GetOperationsProviders(this Tena /// An async collection of that may take multiple service requests to iterate over. public static AsyncPageable GetWebAppStacksProvidersAsync(this TenantResource tenantResource, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetWebAppStacksProvidersAsync(stackOSType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetWebAppStacksProvidersAsync(stackOSType, cancellationToken); } /// @@ -4363,6 +4418,10 @@ public static AsyncPageable GetWebAppStacksProvidersAsync(this Tena /// Provider_GetWebAppStacks /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Stack OS Type. @@ -4370,7 +4429,7 @@ public static AsyncPageable GetWebAppStacksProvidersAsync(this Tena /// A collection of that may take multiple service requests to iterate over. public static Pageable GetWebAppStacksProviders(this TenantResource tenantResource, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) { - return GetTenantResourceExtensionClient(tenantResource).GetWebAppStacksProviders(stackOSType, cancellationToken); + return GetMockableAppServiceTenantResource(tenantResource).GetWebAppStacksProviders(stackOSType, cancellationToken); } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceArmClient.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceArmClient.cs new file mode 100644 index 0000000000000..c7b8e6773d6af --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceArmClient.cs @@ -0,0 +1,1347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService; + +namespace Azure.ResourceManager.AppService.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAppServiceArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAppServiceArmClient() + { + } + + /// 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 MockableAppServiceArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAppServiceArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServiceCertificateOrderResource GetAppServiceCertificateOrderResource(ResourceIdentifier id) + { + AppServiceCertificateOrderResource.ValidateResourceId(id); + return new AppServiceCertificateOrderResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServiceCertificateResource GetAppServiceCertificateResource(ResourceIdentifier id) + { + AppServiceCertificateResource.ValidateResourceId(id); + return new AppServiceCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CertificateOrderDetectorResource GetCertificateOrderDetectorResource(ResourceIdentifier id) + { + CertificateOrderDetectorResource.ValidateResourceId(id); + return new CertificateOrderDetectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HostingEnvironmentDetectorResource GetHostingEnvironmentDetectorResource(ResourceIdentifier id) + { + HostingEnvironmentDetectorResource.ValidateResourceId(id); + return new HostingEnvironmentDetectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteDetectorResource GetSiteDetectorResource(ResourceIdentifier id) + { + SiteDetectorResource.ValidateResourceId(id); + return new SiteDetectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotDetectorResource GetSiteSlotDetectorResource(ResourceIdentifier id) + { + SiteSlotDetectorResource.ValidateResourceId(id); + return new SiteSlotDetectorResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServiceDomainResource GetAppServiceDomainResource(ResourceIdentifier id) + { + AppServiceDomainResource.ValidateResourceId(id); + return new AppServiceDomainResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DomainOwnershipIdentifierResource GetDomainOwnershipIdentifierResource(ResourceIdentifier id) + { + DomainOwnershipIdentifierResource.ValidateResourceId(id); + return new DomainOwnershipIdentifierResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TopLevelDomainResource GetTopLevelDomainResource(ResourceIdentifier id) + { + TopLevelDomainResource.ValidateResourceId(id); + return new TopLevelDomainResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServiceEnvironmentResource GetAppServiceEnvironmentResource(ResourceIdentifier id) + { + AppServiceEnvironmentResource.ValidateResourceId(id); + return new AppServiceEnvironmentResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AseV3NetworkingConfigurationResource GetAseV3NetworkingConfigurationResource(ResourceIdentifier id) + { + AseV3NetworkingConfigurationResource.ValidateResourceId(id); + return new AseV3NetworkingConfigurationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HostingEnvironmentMultiRolePoolResource GetHostingEnvironmentMultiRolePoolResource(ResourceIdentifier id) + { + HostingEnvironmentMultiRolePoolResource.ValidateResourceId(id); + return new HostingEnvironmentMultiRolePoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HostingEnvironmentWorkerPoolResource GetHostingEnvironmentWorkerPoolResource(ResourceIdentifier id) + { + HostingEnvironmentWorkerPoolResource.ValidateResourceId(id); + return new HostingEnvironmentWorkerPoolResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HostingEnvironmentPrivateEndpointConnectionResource GetHostingEnvironmentPrivateEndpointConnectionResource(ResourceIdentifier id) + { + HostingEnvironmentPrivateEndpointConnectionResource.ValidateResourceId(id); + return new HostingEnvironmentPrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSitePrivateEndpointConnectionResource GetStaticSitePrivateEndpointConnectionResource(ResourceIdentifier id) + { + StaticSitePrivateEndpointConnectionResource.ValidateResourceId(id); + return new StaticSitePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SitePrivateEndpointConnectionResource GetSitePrivateEndpointConnectionResource(ResourceIdentifier id) + { + SitePrivateEndpointConnectionResource.ValidateResourceId(id); + return new SitePrivateEndpointConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotPrivateEndpointConnectionResource GetSiteSlotPrivateEndpointConnectionResource(ResourceIdentifier id) + { + SiteSlotPrivateEndpointConnectionResource.ValidateResourceId(id); + return new SiteSlotPrivateEndpointConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServicePlanResource GetAppServicePlanResource(ResourceIdentifier id) + { + AppServicePlanResource.ValidateResourceId(id); + return new AppServicePlanResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServicePlanHybridConnectionNamespaceRelayResource GetAppServicePlanHybridConnectionNamespaceRelayResource(ResourceIdentifier id) + { + AppServicePlanHybridConnectionNamespaceRelayResource.ValidateResourceId(id); + return new AppServicePlanHybridConnectionNamespaceRelayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteHybridConnectionNamespaceRelayResource GetSiteHybridConnectionNamespaceRelayResource(ResourceIdentifier id) + { + SiteHybridConnectionNamespaceRelayResource.ValidateResourceId(id); + return new SiteHybridConnectionNamespaceRelayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotHybridConnectionNamespaceRelayResource GetSiteSlotHybridConnectionNamespaceRelayResource(ResourceIdentifier id) + { + SiteSlotHybridConnectionNamespaceRelayResource.ValidateResourceId(id); + return new SiteSlotHybridConnectionNamespaceRelayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HybridConnectionLimitResource GetHybridConnectionLimitResource(ResourceIdentifier id) + { + HybridConnectionLimitResource.ValidateResourceId(id); + return new HybridConnectionLimitResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServicePlanVirtualNetworkConnectionResource GetAppServicePlanVirtualNetworkConnectionResource(ResourceIdentifier id) + { + AppServicePlanVirtualNetworkConnectionResource.ValidateResourceId(id); + return new AppServicePlanVirtualNetworkConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotVirtualNetworkConnectionResource GetSiteSlotVirtualNetworkConnectionResource(ResourceIdentifier id) + { + SiteSlotVirtualNetworkConnectionResource.ValidateResourceId(id); + return new SiteSlotVirtualNetworkConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteVirtualNetworkConnectionResource GetSiteVirtualNetworkConnectionResource(ResourceIdentifier id) + { + SiteVirtualNetworkConnectionResource.ValidateResourceId(id); + return new SiteVirtualNetworkConnectionResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServicePlanVirtualNetworkConnectionGatewayResource GetAppServicePlanVirtualNetworkConnectionGatewayResource(ResourceIdentifier id) + { + AppServicePlanVirtualNetworkConnectionGatewayResource.ValidateResourceId(id); + return new AppServicePlanVirtualNetworkConnectionGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotVirtualNetworkConnectionGatewayResource GetSiteSlotVirtualNetworkConnectionGatewayResource(ResourceIdentifier id) + { + SiteSlotVirtualNetworkConnectionGatewayResource.ValidateResourceId(id); + return new SiteSlotVirtualNetworkConnectionGatewayResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteVirtualNetworkConnectionGatewayResource GetSiteVirtualNetworkConnectionGatewayResource(ResourceIdentifier id) + { + SiteVirtualNetworkConnectionGatewayResource.ValidateResourceId(id); + return new SiteVirtualNetworkConnectionGatewayResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppCertificateResource GetAppCertificateResource(ResourceIdentifier id) + { + AppCertificateResource.ValidateResourceId(id); + return new AppCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteDiagnosticResource GetSiteDiagnosticResource(ResourceIdentifier id) + { + SiteDiagnosticResource.ValidateResourceId(id); + return new SiteDiagnosticResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotDiagnosticResource GetSiteSlotDiagnosticResource(ResourceIdentifier id) + { + SiteSlotDiagnosticResource.ValidateResourceId(id); + return new SiteSlotDiagnosticResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteDiagnosticAnalysisResource GetSiteDiagnosticAnalysisResource(ResourceIdentifier id) + { + SiteDiagnosticAnalysisResource.ValidateResourceId(id); + return new SiteDiagnosticAnalysisResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotDiagnosticAnalysisResource GetSiteSlotDiagnosticAnalysisResource(ResourceIdentifier id) + { + SiteSlotDiagnosticAnalysisResource.ValidateResourceId(id); + return new SiteSlotDiagnosticAnalysisResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteDiagnosticDetectorResource GetSiteDiagnosticDetectorResource(ResourceIdentifier id) + { + SiteDiagnosticDetectorResource.ValidateResourceId(id); + return new SiteDiagnosticDetectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotDiagnosticDetectorResource GetSiteSlotDiagnosticDetectorResource(ResourceIdentifier id) + { + SiteSlotDiagnosticDetectorResource.ValidateResourceId(id); + return new SiteSlotDiagnosticDetectorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DeletedSiteResource GetDeletedSiteResource(ResourceIdentifier id) + { + DeletedSiteResource.ValidateResourceId(id); + return new DeletedSiteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KubeEnvironmentResource GetKubeEnvironmentResource(ResourceIdentifier id) + { + KubeEnvironmentResource.ValidateResourceId(id); + return new KubeEnvironmentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HostingEnvironmentRecommendationResource GetHostingEnvironmentRecommendationResource(ResourceIdentifier id) + { + HostingEnvironmentRecommendationResource.ValidateResourceId(id); + return new HostingEnvironmentRecommendationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteRecommendationResource GetSiteRecommendationResource(ResourceIdentifier id) + { + SiteRecommendationResource.ValidateResourceId(id); + return new SiteRecommendationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteResourceHealthMetadataResource GetWebSiteResourceHealthMetadataResource(ResourceIdentifier id) + { + WebSiteResourceHealthMetadataResource.ValidateResourceId(id); + return new WebSiteResourceHealthMetadataResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotResourceHealthMetadataResource GetWebSiteSlotResourceHealthMetadataResource(ResourceIdentifier id) + { + WebSiteSlotResourceHealthMetadataResource.ValidateResourceId(id); + return new WebSiteSlotResourceHealthMetadataResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PublishingUserResource GetPublishingUserResource(ResourceIdentifier id) + { + PublishingUserResource.ValidateResourceId(id); + return new PublishingUserResource(Client, id); + } + + /// + /// 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 resource ID of the resource to get. + /// Returns a object. + public virtual AppServiceSourceControlResource GetAppServiceSourceControlResource(ResourceIdentifier id) + { + AppServiceSourceControlResource.ValidateResourceId(id); + return new AppServiceSourceControlResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteResource GetStaticSiteResource(ResourceIdentifier id) + { + StaticSiteResource.ValidateResourceId(id); + return new StaticSiteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteBuildResource GetStaticSiteBuildResource(ResourceIdentifier id) + { + StaticSiteBuildResource.ValidateResourceId(id); + return new StaticSiteBuildResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteBuildUserProvidedFunctionAppResource GetStaticSiteBuildUserProvidedFunctionAppResource(ResourceIdentifier id) + { + StaticSiteBuildUserProvidedFunctionAppResource.ValidateResourceId(id); + return new StaticSiteBuildUserProvidedFunctionAppResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteUserProvidedFunctionAppResource GetStaticSiteUserProvidedFunctionAppResource(ResourceIdentifier id) + { + StaticSiteUserProvidedFunctionAppResource.ValidateResourceId(id); + return new StaticSiteUserProvidedFunctionAppResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteCustomDomainOverviewResource GetStaticSiteCustomDomainOverviewResource(ResourceIdentifier id) + { + StaticSiteCustomDomainOverviewResource.ValidateResourceId(id); + return new StaticSiteCustomDomainOverviewResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteResource GetWebSiteResource(ResourceIdentifier id) + { + WebSiteResource.ValidateResourceId(id); + return new WebSiteResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotResource GetWebSiteSlotResource(ResourceIdentifier id) + { + WebSiteSlotResource.ValidateResourceId(id); + return new WebSiteSlotResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteBackupResource GetSiteBackupResource(ResourceIdentifier id) + { + SiteBackupResource.ValidateResourceId(id); + return new SiteBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotBackupResource GetSiteSlotBackupResource(ResourceIdentifier id) + { + SiteSlotBackupResource.ValidateResourceId(id); + return new SiteSlotBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteFtpPublishingCredentialsPolicyResource GetWebSiteFtpPublishingCredentialsPolicyResource(ResourceIdentifier id) + { + WebSiteFtpPublishingCredentialsPolicyResource.ValidateResourceId(id); + return new WebSiteFtpPublishingCredentialsPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScmSiteBasicPublishingCredentialsPolicyResource GetScmSiteBasicPublishingCredentialsPolicyResource(ResourceIdentifier id) + { + ScmSiteBasicPublishingCredentialsPolicyResource.ValidateResourceId(id); + return new ScmSiteBasicPublishingCredentialsPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotFtpPublishingCredentialsPolicyResource GetWebSiteSlotFtpPublishingCredentialsPolicyResource(ResourceIdentifier id) + { + WebSiteSlotFtpPublishingCredentialsPolicyResource.ValidateResourceId(id); + return new WebSiteSlotFtpPublishingCredentialsPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScmSiteSlotBasicPublishingCredentialsPolicyResource GetScmSiteSlotBasicPublishingCredentialsPolicyResource(ResourceIdentifier id) + { + ScmSiteSlotBasicPublishingCredentialsPolicyResource.ValidateResourceId(id); + return new ScmSiteSlotBasicPublishingCredentialsPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteConfigAppsettingResource GetSiteConfigAppsettingResource(ResourceIdentifier id) + { + SiteConfigAppsettingResource.ValidateResourceId(id); + return new SiteConfigAppsettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteConfigConnectionStringResource GetWebSiteConfigConnectionStringResource(ResourceIdentifier id) + { + WebSiteConfigConnectionStringResource.ValidateResourceId(id); + return new WebSiteConfigConnectionStringResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotConfigAppSettingResource GetWebSiteSlotConfigAppSettingResource(ResourceIdentifier id) + { + WebSiteSlotConfigAppSettingResource.ValidateResourceId(id); + return new WebSiteSlotConfigAppSettingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotConfigConnectionStringResource GetWebSiteSlotConfigConnectionStringResource(ResourceIdentifier id) + { + WebSiteSlotConfigConnectionStringResource.ValidateResourceId(id); + return new WebSiteSlotConfigConnectionStringResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogsSiteConfigResource GetLogsSiteConfigResource(ResourceIdentifier id) + { + LogsSiteConfigResource.ValidateResourceId(id); + return new LogsSiteConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LogsSiteSlotConfigResource GetLogsSiteSlotConfigResource(ResourceIdentifier id) + { + LogsSiteSlotConfigResource.ValidateResourceId(id); + return new LogsSiteSlotConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SlotConfigNamesResource GetSlotConfigNamesResource(ResourceIdentifier id) + { + SlotConfigNamesResource.ValidateResourceId(id); + return new SlotConfigNamesResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteConfigResource GetWebSiteConfigResource(ResourceIdentifier id) + { + WebSiteConfigResource.ValidateResourceId(id); + return new WebSiteConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteConfigSnapshotResource GetSiteConfigSnapshotResource(ResourceIdentifier id) + { + SiteConfigSnapshotResource.ValidateResourceId(id); + return new SiteConfigSnapshotResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotConfigResource GetWebSiteSlotConfigResource(ResourceIdentifier id) + { + WebSiteSlotConfigResource.ValidateResourceId(id); + return new WebSiteSlotConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotConfigSnapshotResource GetSiteSlotConfigSnapshotResource(ResourceIdentifier id) + { + SiteSlotConfigSnapshotResource.ValidateResourceId(id); + return new SiteSlotConfigSnapshotResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteContinuousWebJobResource GetWebSiteContinuousWebJobResource(ResourceIdentifier id) + { + WebSiteContinuousWebJobResource.ValidateResourceId(id); + return new WebSiteContinuousWebJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotContinuousWebJobResource GetWebSiteSlotContinuousWebJobResource(ResourceIdentifier id) + { + WebSiteSlotContinuousWebJobResource.ValidateResourceId(id); + return new WebSiteSlotContinuousWebJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteDeploymentResource GetSiteDeploymentResource(ResourceIdentifier id) + { + SiteDeploymentResource.ValidateResourceId(id); + return new SiteDeploymentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotDeploymentResource GetSiteSlotDeploymentResource(ResourceIdentifier id) + { + SiteSlotDeploymentResource.ValidateResourceId(id); + return new SiteSlotDeploymentResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteDomainOwnershipIdentifierResource GetSiteDomainOwnershipIdentifierResource(ResourceIdentifier id) + { + SiteDomainOwnershipIdentifierResource.ValidateResourceId(id); + return new SiteDomainOwnershipIdentifierResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotDomainOwnershipIdentifierResource GetSiteSlotDomainOwnershipIdentifierResource(ResourceIdentifier id) + { + SiteSlotDomainOwnershipIdentifierResource.ValidateResourceId(id); + return new SiteSlotDomainOwnershipIdentifierResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteExtensionResource GetSiteExtensionResource(ResourceIdentifier id) + { + SiteExtensionResource.ValidateResourceId(id); + return new SiteExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteInstanceExtensionResource GetSiteInstanceExtensionResource(ResourceIdentifier id) + { + SiteInstanceExtensionResource.ValidateResourceId(id); + return new SiteInstanceExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotExtensionResource GetSiteSlotExtensionResource(ResourceIdentifier id) + { + SiteSlotExtensionResource.ValidateResourceId(id); + return new SiteSlotExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotInstanceExtensionResource GetSiteSlotInstanceExtensionResource(ResourceIdentifier id) + { + SiteSlotInstanceExtensionResource.ValidateResourceId(id); + return new SiteSlotInstanceExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteFunctionResource GetSiteFunctionResource(ResourceIdentifier id) + { + SiteFunctionResource.ValidateResourceId(id); + return new SiteFunctionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotFunctionResource GetSiteSlotFunctionResource(ResourceIdentifier id) + { + SiteSlotFunctionResource.ValidateResourceId(id); + return new SiteSlotFunctionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteHostNameBindingResource GetSiteHostNameBindingResource(ResourceIdentifier id) + { + SiteHostNameBindingResource.ValidateResourceId(id); + return new SiteHostNameBindingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotHostNameBindingResource GetSiteSlotHostNameBindingResource(ResourceIdentifier id) + { + SiteSlotHostNameBindingResource.ValidateResourceId(id); + return new SiteSlotHostNameBindingResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteHybridConnectionResource GetWebSiteHybridConnectionResource(ResourceIdentifier id) + { + WebSiteHybridConnectionResource.ValidateResourceId(id); + return new WebSiteHybridConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotHybridConnectionResource GetWebSiteSlotHybridConnectionResource(ResourceIdentifier id) + { + WebSiteSlotHybridConnectionResource.ValidateResourceId(id); + return new WebSiteSlotHybridConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteInstanceResource GetSiteInstanceResource(ResourceIdentifier id) + { + SiteInstanceResource.ValidateResourceId(id); + return new SiteInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotInstanceResource GetSiteSlotInstanceResource(ResourceIdentifier id) + { + SiteSlotInstanceResource.ValidateResourceId(id); + return new SiteSlotInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteInstanceProcessResource GetSiteInstanceProcessResource(ResourceIdentifier id) + { + SiteInstanceProcessResource.ValidateResourceId(id); + return new SiteInstanceProcessResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteProcessResource GetSiteProcessResource(ResourceIdentifier id) + { + SiteProcessResource.ValidateResourceId(id); + return new SiteProcessResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotInstanceProcessResource GetSiteSlotInstanceProcessResource(ResourceIdentifier id) + { + SiteSlotInstanceProcessResource.ValidateResourceId(id); + return new SiteSlotInstanceProcessResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotProcessResource GetSiteSlotProcessResource(ResourceIdentifier id) + { + SiteSlotProcessResource.ValidateResourceId(id); + return new SiteSlotProcessResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteInstanceProcessModuleResource GetSiteInstanceProcessModuleResource(ResourceIdentifier id) + { + SiteInstanceProcessModuleResource.ValidateResourceId(id); + return new SiteInstanceProcessModuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteProcessModuleResource GetSiteProcessModuleResource(ResourceIdentifier id) + { + SiteProcessModuleResource.ValidateResourceId(id); + return new SiteProcessModuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotInstanceProcessModuleResource GetSiteSlotInstanceProcessModuleResource(ResourceIdentifier id) + { + SiteSlotInstanceProcessModuleResource.ValidateResourceId(id); + return new SiteSlotInstanceProcessModuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotProcessModuleResource GetSiteSlotProcessModuleResource(ResourceIdentifier id) + { + SiteSlotProcessModuleResource.ValidateResourceId(id); + return new SiteSlotProcessModuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteNetworkConfigResource GetSiteNetworkConfigResource(ResourceIdentifier id) + { + SiteNetworkConfigResource.ValidateResourceId(id); + return new SiteNetworkConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotNetworkConfigResource GetSiteSlotNetworkConfigResource(ResourceIdentifier id) + { + SiteSlotNetworkConfigResource.ValidateResourceId(id); + return new SiteSlotNetworkConfigResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSitePremierAddonResource GetWebSitePremierAddonResource(ResourceIdentifier id) + { + WebSitePremierAddonResource.ValidateResourceId(id); + return new WebSitePremierAddonResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotPremierAddOnResource GetWebSiteSlotPremierAddOnResource(ResourceIdentifier id) + { + WebSiteSlotPremierAddOnResource.ValidateResourceId(id); + return new WebSiteSlotPremierAddOnResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSitePrivateAccessResource GetWebSitePrivateAccessResource(ResourceIdentifier id) + { + WebSitePrivateAccessResource.ValidateResourceId(id); + return new WebSitePrivateAccessResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotPrivateAccessResource GetWebSiteSlotPrivateAccessResource(ResourceIdentifier id) + { + WebSiteSlotPrivateAccessResource.ValidateResourceId(id); + return new WebSiteSlotPrivateAccessResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SitePublicCertificateResource GetSitePublicCertificateResource(ResourceIdentifier id) + { + SitePublicCertificateResource.ValidateResourceId(id); + return new SitePublicCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotPublicCertificateResource GetWebSiteSlotPublicCertificateResource(ResourceIdentifier id) + { + WebSiteSlotPublicCertificateResource.ValidateResourceId(id); + return new WebSiteSlotPublicCertificateResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteExtensionResource GetWebSiteExtensionResource(ResourceIdentifier id) + { + WebSiteExtensionResource.ValidateResourceId(id); + return new WebSiteExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotExtensionResource GetWebSiteSlotExtensionResource(ResourceIdentifier id) + { + WebSiteSlotExtensionResource.ValidateResourceId(id); + return new WebSiteSlotExtensionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual MigrateMySqlStatusResource GetMigrateMySqlStatusResource(ResourceIdentifier id) + { + MigrateMySqlStatusResource.ValidateResourceId(id); + return new MigrateMySqlStatusResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetworkFeatureResource GetNetworkFeatureResource(ResourceIdentifier id) + { + NetworkFeatureResource.ValidateResourceId(id); + return new NetworkFeatureResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotSourceControlResource GetWebSiteSlotSourceControlResource(ResourceIdentifier id) + { + WebSiteSlotSourceControlResource.ValidateResourceId(id); + return new WebSiteSlotSourceControlResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSourceControlResource GetWebSiteSourceControlResource(ResourceIdentifier id) + { + WebSiteSourceControlResource.ValidateResourceId(id); + return new WebSiteSourceControlResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteSlotWebJobResource GetWebSiteSlotWebJobResource(ResourceIdentifier id) + { + WebSiteSlotWebJobResource.ValidateResourceId(id); + return new WebSiteSlotWebJobResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WebSiteWebJobResource GetWebSiteWebJobResource(ResourceIdentifier id) + { + WebSiteWebJobResource.ValidateResourceId(id); + return new WebSiteWebJobResource(Client, id); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceResourceGroupResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceResourceGroupResource.cs new file mode 100644 index 0000000000000..6c38ae7206f77 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceResourceGroupResource.cs @@ -0,0 +1,544 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAppServiceResourceGroupResource : ArmResource + { + private ClientDiagnostics _resourceHealthMetadataClientDiagnostics; + private ResourceHealthMetadataRestOperations _resourceHealthMetadataRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private WebSiteManagementRestOperations _defaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAppServiceResourceGroupResource() + { + } + + /// 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 MockableAppServiceResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ResourceHealthMetadataClientDiagnostics => _resourceHealthMetadataClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceHealthMetadataRestOperations ResourceHealthMetadataRestClient => _resourceHealthMetadataRestClient ??= new ResourceHealthMetadataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private WebSiteManagementRestOperations DefaultRestClient => _defaultRestClient ??= new WebSiteManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AppServiceCertificateOrderResources in the ResourceGroupResource. + /// An object representing collection of AppServiceCertificateOrderResources and their operations over a AppServiceCertificateOrderResource. + public virtual AppServiceCertificateOrderCollection GetAppServiceCertificateOrders() + { + return GetCachedClient(client => new AppServiceCertificateOrderCollection(client, Id)); + } + + /// + /// Description for Get a certificate order. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName} + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_Get + /// + /// + /// + /// Name of the certificate order.. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAppServiceCertificateOrderAsync(string certificateOrderName, CancellationToken cancellationToken = default) + { + return await GetAppServiceCertificateOrders().GetAsync(certificateOrderName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Get a certificate order. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CertificateRegistration/certificateOrders/{certificateOrderName} + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_Get + /// + /// + /// + /// Name of the certificate order.. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAppServiceCertificateOrder(string certificateOrderName, CancellationToken cancellationToken = default) + { + return GetAppServiceCertificateOrders().Get(certificateOrderName, cancellationToken); + } + + /// Gets a collection of AppServiceDomainResources in the ResourceGroupResource. + /// An object representing collection of AppServiceDomainResources and their operations over a AppServiceDomainResource. + public virtual AppServiceDomainCollection GetAppServiceDomains() + { + return GetCachedClient(client => new AppServiceDomainCollection(client, Id)); + } + + /// + /// Description for Get a domain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAppServiceDomainAsync(string domainName, CancellationToken cancellationToken = default) + { + return await GetAppServiceDomains().GetAsync(domainName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Get a domain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName} + /// + /// + /// Operation Id + /// Domains_Get + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAppServiceDomain(string domainName, CancellationToken cancellationToken = default) + { + return GetAppServiceDomains().Get(domainName, cancellationToken); + } + + /// Gets a collection of AppServiceEnvironmentResources in the ResourceGroupResource. + /// An object representing collection of AppServiceEnvironmentResources and their operations over a AppServiceEnvironmentResource. + public virtual AppServiceEnvironmentCollection GetAppServiceEnvironments() + { + return GetCachedClient(client => new AppServiceEnvironmentCollection(client, Id)); + } + + /// + /// Description for Get the properties of an App Service Environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name} + /// + /// + /// Operation Id + /// AppServiceEnvironments_Get + /// + /// + /// + /// Name of the App Service Environment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAppServiceEnvironmentAsync(string name, CancellationToken cancellationToken = default) + { + return await GetAppServiceEnvironments().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Get the properties of an App Service Environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name} + /// + /// + /// Operation Id + /// AppServiceEnvironments_Get + /// + /// + /// + /// Name of the App Service Environment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAppServiceEnvironment(string name, CancellationToken cancellationToken = default) + { + return GetAppServiceEnvironments().Get(name, cancellationToken); + } + + /// Gets a collection of AppServicePlanResources in the ResourceGroupResource. + /// An object representing collection of AppServicePlanResources and their operations over a AppServicePlanResource. + public virtual AppServicePlanCollection GetAppServicePlans() + { + return GetCachedClient(client => new AppServicePlanCollection(client, Id)); + } + + /// + /// Description for Get an App Service plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name} + /// + /// + /// Operation Id + /// AppServicePlans_Get + /// + /// + /// + /// Name of the App Service plan. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAppServicePlanAsync(string name, CancellationToken cancellationToken = default) + { + return await GetAppServicePlans().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Get an App Service plan. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name} + /// + /// + /// Operation Id + /// AppServicePlans_Get + /// + /// + /// + /// Name of the App Service plan. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAppServicePlan(string name, CancellationToken cancellationToken = default) + { + return GetAppServicePlans().Get(name, cancellationToken); + } + + /// Gets a collection of AppCertificateResources in the ResourceGroupResource. + /// An object representing collection of AppCertificateResources and their operations over a AppCertificateResource. + public virtual AppCertificateCollection GetAppCertificates() + { + return GetCachedClient(client => new AppCertificateCollection(client, Id)); + } + + /// + /// Description for Get a certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// Name of the certificate. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAppCertificateAsync(string name, CancellationToken cancellationToken = default) + { + return await GetAppCertificates().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Get a certificate. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/certificates/{name} + /// + /// + /// Operation Id + /// Certificates_Get + /// + /// + /// + /// Name of the certificate. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAppCertificate(string name, CancellationToken cancellationToken = default) + { + return GetAppCertificates().Get(name, cancellationToken); + } + + /// Gets a collection of KubeEnvironmentResources in the ResourceGroupResource. + /// An object representing collection of KubeEnvironmentResources and their operations over a KubeEnvironmentResource. + public virtual KubeEnvironmentCollection GetKubeEnvironments() + { + return GetCachedClient(client => new KubeEnvironmentCollection(client, Id)); + } + + /// + /// Description for Get the properties of a Kubernetes Environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments/{name} + /// + /// + /// Operation Id + /// KubeEnvironments_Get + /// + /// + /// + /// Name of the Kubernetes Environment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKubeEnvironmentAsync(string name, CancellationToken cancellationToken = default) + { + return await GetKubeEnvironments().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Get the properties of a Kubernetes Environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments/{name} + /// + /// + /// Operation Id + /// KubeEnvironments_Get + /// + /// + /// + /// Name of the Kubernetes Environment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKubeEnvironment(string name, CancellationToken cancellationToken = default) + { + return GetKubeEnvironments().Get(name, cancellationToken); + } + + /// Gets a collection of StaticSiteResources in the ResourceGroupResource. + /// An object representing collection of StaticSiteResources and their operations over a StaticSiteResource. + public virtual StaticSiteCollection GetStaticSites() + { + return GetCachedClient(client => new StaticSiteCollection(client, Id)); + } + + /// + /// Description for Gets the details of a static site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name} + /// + /// + /// Operation Id + /// StaticSites_GetStaticSite + /// + /// + /// + /// Name of the static site. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStaticSiteAsync(string name, CancellationToken cancellationToken = default) + { + return await GetStaticSites().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Gets the details of a static site. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name} + /// + /// + /// Operation Id + /// StaticSites_GetStaticSite + /// + /// + /// + /// Name of the static site. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStaticSite(string name, CancellationToken cancellationToken = default) + { + return GetStaticSites().Get(name, cancellationToken); + } + + /// Gets a collection of WebSiteResources in the ResourceGroupResource. + /// An object representing collection of WebSiteResources and their operations over a WebSiteResource. + public virtual WebSiteCollection GetWebSites() + { + return GetCachedClient(client => new WebSiteCollection(client, Id)); + } + + /// + /// Description for Gets the details of a web, mobile, or API app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// + /// + /// Operation Id + /// WebApps_Get + /// + /// + /// + /// Name of the app. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWebSiteAsync(string name, CancellationToken cancellationToken = default) + { + return await GetWebSites().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Gets the details of a web, mobile, or API app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// + /// + /// Operation Id + /// WebApps_Get + /// + /// + /// + /// Name of the app. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWebSite(string name, CancellationToken cancellationToken = default) + { + return GetWebSites().Get(name, cancellationToken); + } + + /// + /// Description for Validate if a resource can be created. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate + /// + /// + /// Operation Id + /// Validate + /// + /// + /// + /// Request with the resources to validate. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateAsync(AppServiceValidateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceResourceGroupResource.Validate"); + scope.Start(); + try + { + var response = await DefaultRestClient.ValidateAsync(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Validate if a resource can be created. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate + /// + /// + /// Operation Id + /// Validate + /// + /// + /// + /// Request with the resources to validate. + /// The cancellation token to use. + /// is null. + public virtual Response Validate(AppServiceValidateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceResourceGroupResource.Validate"); + scope.Start(); + try + { + var response = DefaultRestClient.Validate(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceSubscriptionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceSubscriptionResource.cs new file mode 100644 index 0000000000000..d6b66dc029c45 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceSubscriptionResource.cs @@ -0,0 +1,1680 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAppServiceSubscriptionResource : ArmResource + { + private ClientDiagnostics _appServiceCertificateOrderClientDiagnostics; + private AppServiceCertificateOrdersRestOperations _appServiceCertificateOrderRestClient; + private ClientDiagnostics _appServiceCertificateOrdersClientDiagnostics; + private AppServiceCertificateOrdersRestOperations _appServiceCertificateOrdersRestClient; + private ClientDiagnostics _domainsClientDiagnostics; + private DomainsRestOperations _domainsRestClient; + private ClientDiagnostics _appServiceDomainDomainsClientDiagnostics; + private DomainsRestOperations _appServiceDomainDomainsRestClient; + private ClientDiagnostics _appServiceEnvironmentClientDiagnostics; + private AppServiceEnvironmentsRestOperations _appServiceEnvironmentRestClient; + private ClientDiagnostics _appServicePlanClientDiagnostics; + private AppServicePlansRestOperations _appServicePlanRestClient; + private ClientDiagnostics _appCertificateCertificatesClientDiagnostics; + private CertificatesRestOperations _appCertificateCertificatesRestClient; + private ClientDiagnostics _deletedSiteDeletedWebAppsClientDiagnostics; + private DeletedWebAppsRestOperations _deletedSiteDeletedWebAppsRestClient; + private ClientDiagnostics _kubeEnvironmentClientDiagnostics; + private KubeEnvironmentsRestOperations _kubeEnvironmentRestClient; + private ClientDiagnostics _providerClientDiagnostics; + private ProviderRestOperations _providerRestClient; + private ClientDiagnostics _recommendationsClientDiagnostics; + private RecommendationsRestOperations _recommendationsRestClient; + private ClientDiagnostics _resourceHealthMetadataClientDiagnostics; + private ResourceHealthMetadataRestOperations _resourceHealthMetadataRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private WebSiteManagementRestOperations _defaultRestClient; + private ClientDiagnostics _staticSitesClientDiagnostics; + private StaticSitesRestOperations _staticSitesRestClient; + private ClientDiagnostics _staticSiteClientDiagnostics; + private StaticSitesRestOperations _staticSiteRestClient; + private ClientDiagnostics _webSiteWebAppsClientDiagnostics; + private WebAppsRestOperations _webSiteWebAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAppServiceSubscriptionResource() + { + } + + /// 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 MockableAppServiceSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AppServiceCertificateOrderClientDiagnostics => _appServiceCertificateOrderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppServiceCertificateOrderResource.ResourceType.Namespace, Diagnostics); + private AppServiceCertificateOrdersRestOperations AppServiceCertificateOrderRestClient => _appServiceCertificateOrderRestClient ??= new AppServiceCertificateOrdersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServiceCertificateOrderResource.ResourceType)); + private ClientDiagnostics AppServiceCertificateOrdersClientDiagnostics => _appServiceCertificateOrdersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AppServiceCertificateOrdersRestOperations AppServiceCertificateOrdersRestClient => _appServiceCertificateOrdersRestClient ??= new AppServiceCertificateOrdersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DomainsClientDiagnostics => _domainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DomainsRestOperations DomainsRestClient => _domainsRestClient ??= new DomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AppServiceDomainDomainsClientDiagnostics => _appServiceDomainDomainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppServiceDomainResource.ResourceType.Namespace, Diagnostics); + private DomainsRestOperations AppServiceDomainDomainsRestClient => _appServiceDomainDomainsRestClient ??= new DomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServiceDomainResource.ResourceType)); + private ClientDiagnostics AppServiceEnvironmentClientDiagnostics => _appServiceEnvironmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppServiceEnvironmentResource.ResourceType.Namespace, Diagnostics); + private AppServiceEnvironmentsRestOperations AppServiceEnvironmentRestClient => _appServiceEnvironmentRestClient ??= new AppServiceEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServiceEnvironmentResource.ResourceType)); + private ClientDiagnostics AppServicePlanClientDiagnostics => _appServicePlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppServicePlanResource.ResourceType.Namespace, Diagnostics); + private AppServicePlansRestOperations AppServicePlanRestClient => _appServicePlanRestClient ??= new AppServicePlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServicePlanResource.ResourceType)); + private ClientDiagnostics AppCertificateCertificatesClientDiagnostics => _appCertificateCertificatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppCertificateResource.ResourceType.Namespace, Diagnostics); + private CertificatesRestOperations AppCertificateCertificatesRestClient => _appCertificateCertificatesRestClient ??= new CertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppCertificateResource.ResourceType)); + private ClientDiagnostics DeletedSiteDeletedWebAppsClientDiagnostics => _deletedSiteDeletedWebAppsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", DeletedSiteResource.ResourceType.Namespace, Diagnostics); + private DeletedWebAppsRestOperations DeletedSiteDeletedWebAppsRestClient => _deletedSiteDeletedWebAppsRestClient ??= new DeletedWebAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedSiteResource.ResourceType)); + private ClientDiagnostics KubeEnvironmentClientDiagnostics => _kubeEnvironmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", KubeEnvironmentResource.ResourceType.Namespace, Diagnostics); + private KubeEnvironmentsRestOperations KubeEnvironmentRestClient => _kubeEnvironmentRestClient ??= new KubeEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KubeEnvironmentResource.ResourceType)); + private ClientDiagnostics ProviderClientDiagnostics => _providerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ProviderRestOperations ProviderRestClient => _providerRestClient ??= new ProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics RecommendationsClientDiagnostics => _recommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private RecommendationsRestOperations RecommendationsRestClient => _recommendationsRestClient ??= new RecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ResourceHealthMetadataClientDiagnostics => _resourceHealthMetadataClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ResourceHealthMetadataRestOperations ResourceHealthMetadataRestClient => _resourceHealthMetadataRestClient ??= new ResourceHealthMetadataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private WebSiteManagementRestOperations DefaultRestClient => _defaultRestClient ??= new WebSiteManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics StaticSitesClientDiagnostics => _staticSitesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private StaticSitesRestOperations StaticSitesRestClient => _staticSitesRestClient ??= new StaticSitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics StaticSiteClientDiagnostics => _staticSiteClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", StaticSiteResource.ResourceType.Namespace, Diagnostics); + private StaticSitesRestOperations StaticSiteRestClient => _staticSiteRestClient ??= new StaticSitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StaticSiteResource.ResourceType)); + private ClientDiagnostics WebSiteWebAppsClientDiagnostics => _webSiteWebAppsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", WebSiteResource.ResourceType.Namespace, Diagnostics); + private WebAppsRestOperations WebSiteWebAppsRestClient => _webSiteWebAppsRestClient ??= new WebAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WebSiteResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of TopLevelDomainResources in the SubscriptionResource. + /// An object representing collection of TopLevelDomainResources and their operations over a TopLevelDomainResource. + public virtual TopLevelDomainCollection GetTopLevelDomains() + { + return GetCachedClient(client => new TopLevelDomainCollection(client, Id)); + } + + /// + /// Description for Get details of a top-level domain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name} + /// + /// + /// Operation Id + /// TopLevelDomains_Get + /// + /// + /// + /// Name of the top-level domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTopLevelDomainAsync(string name, CancellationToken cancellationToken = default) + { + return await GetTopLevelDomains().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Get details of a top-level domain. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name} + /// + /// + /// Operation Id + /// TopLevelDomains_Get + /// + /// + /// + /// Name of the top-level domain. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTopLevelDomain(string name, CancellationToken cancellationToken = default) + { + return GetTopLevelDomains().Get(name, cancellationToken); + } + + /// Gets a collection of DeletedSiteResources in the SubscriptionResource. + /// An object representing collection of DeletedSiteResources and their operations over a DeletedSiteResource. + public virtual DeletedSiteCollection GetDeletedSites() + { + return GetCachedClient(client => new DeletedSiteCollection(client, Id)); + } + + /// + /// Description for Get deleted app for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + /// + /// + /// Operation Id + /// Global_GetDeletedWebApp + /// + /// + /// + /// The numeric ID of the deleted app, e.g. 12345. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDeletedSiteAsync(string deletedSiteId, CancellationToken cancellationToken = default) + { + return await GetDeletedSites().GetAsync(deletedSiteId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Get deleted app for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + /// + /// + /// Operation Id + /// Global_GetDeletedWebApp + /// + /// + /// + /// The numeric ID of the deleted app, e.g. 12345. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDeletedSite(string deletedSiteId, CancellationToken cancellationToken = default) + { + return GetDeletedSites().Get(deletedSiteId, cancellationToken); + } + + /// + /// Description for List all certificate orders in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppServiceCertificateOrdersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceCertificateOrderRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceCertificateOrderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppServiceCertificateOrderResource(Client, AppServiceCertificateOrderData.DeserializeAppServiceCertificateOrderData(e)), AppServiceCertificateOrderClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServiceCertificateOrders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for List all certificate orders in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppServiceCertificateOrders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceCertificateOrderRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceCertificateOrderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppServiceCertificateOrderResource(Client, AppServiceCertificateOrderData.DeserializeAppServiceCertificateOrderData(e)), AppServiceCertificateOrderClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServiceCertificateOrders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Validate information for a certificate order. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_ValidatePurchaseInformation + /// + /// + /// + /// Information for a certificate order. + /// The cancellation token to use. + /// is null. + public virtual async Task ValidateAppServiceCertificateOrderPurchaseInformationAsync(AppServiceCertificateOrderData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = AppServiceCertificateOrdersClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.ValidateAppServiceCertificateOrderPurchaseInformation"); + scope.Start(); + try + { + var response = await AppServiceCertificateOrdersRestClient.ValidatePurchaseInformationAsync(Id.SubscriptionId, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Validate information for a certificate order. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation + /// + /// + /// Operation Id + /// AppServiceCertificateOrders_ValidatePurchaseInformation + /// + /// + /// + /// Information for a certificate order. + /// The cancellation token to use. + /// is null. + public virtual Response ValidateAppServiceCertificateOrderPurchaseInformation(AppServiceCertificateOrderData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = AppServiceCertificateOrdersClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.ValidateAppServiceCertificateOrderPurchaseInformation"); + scope.Start(); + try + { + var response = AppServiceCertificateOrdersRestClient.ValidatePurchaseInformation(Id.SubscriptionId, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Check if a domain is available for registration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability + /// + /// + /// Operation Id + /// Domains_CheckAvailability + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckAppServiceDomainRegistrationAvailabilityAsync(AppServiceDomainNameIdentifier identifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(identifier, nameof(identifier)); + + using var scope = DomainsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.CheckAppServiceDomainRegistrationAvailability"); + scope.Start(); + try + { + var response = await DomainsRestClient.CheckAvailabilityAsync(Id.SubscriptionId, identifier, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Check if a domain is available for registration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability + /// + /// + /// Operation Id + /// Domains_CheckAvailability + /// + /// + /// + /// Name of the domain. + /// The cancellation token to use. + /// is null. + public virtual Response CheckAppServiceDomainRegistrationAvailability(AppServiceDomainNameIdentifier identifier, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(identifier, nameof(identifier)); + + using var scope = DomainsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.CheckAppServiceDomainRegistrationAvailability"); + scope.Start(); + try + { + var response = DomainsRestClient.CheckAvailability(Id.SubscriptionId, identifier, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Get all domains in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains + /// + /// + /// Operation Id + /// Domains_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppServiceDomainsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceDomainDomainsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceDomainDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppServiceDomainResource(Client, AppServiceDomainData.DeserializeAppServiceDomainData(e)), AppServiceDomainDomainsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServiceDomains", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all domains in a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains + /// + /// + /// Operation Id + /// Domains_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppServiceDomains(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceDomainDomainsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceDomainDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppServiceDomainResource(Client, AppServiceDomainData.DeserializeAppServiceDomainData(e)), AppServiceDomainDomainsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServiceDomains", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Generate a single sign-on request for the domain management portal. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest + /// + /// + /// Operation Id + /// Domains_GetControlCenterSsoRequest + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetControlCenterSsoRequestDomainAsync(CancellationToken cancellationToken = default) + { + using var scope = DomainsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.GetControlCenterSsoRequestDomain"); + scope.Start(); + try + { + var response = await DomainsRestClient.GetControlCenterSsoRequestAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Generate a single sign-on request for the domain management portal. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest + /// + /// + /// Operation Id + /// Domains_GetControlCenterSsoRequest + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetControlCenterSsoRequestDomain(CancellationToken cancellationToken = default) + { + using var scope = DomainsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.GetControlCenterSsoRequestDomain"); + scope.Start(); + try + { + var response = DomainsRestClient.GetControlCenterSsoRequest(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Get domain name recommendations based on keywords. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations + /// + /// + /// Operation Id + /// Domains_ListRecommendations + /// + /// + /// + /// Search parameters for domain name recommendations. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppServiceDomainRecommendationsAsync(DomainRecommendationSearchContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DomainsRestClient.CreateListRecommendationsRequest(Id.SubscriptionId, content); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DomainsRestClient.CreateListRecommendationsNextPageRequest(nextLink, Id.SubscriptionId, content); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceDomainNameIdentifier.DeserializeAppServiceDomainNameIdentifier, DomainsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServiceDomainRecommendations", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get domain name recommendations based on keywords. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations + /// + /// + /// Operation Id + /// Domains_ListRecommendations + /// + /// + /// + /// Search parameters for domain name recommendations. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppServiceDomainRecommendations(DomainRecommendationSearchContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DomainsRestClient.CreateListRecommendationsRequest(Id.SubscriptionId, content); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DomainsRestClient.CreateListRecommendationsNextPageRequest(nextLink, Id.SubscriptionId, content); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceDomainNameIdentifier.DeserializeAppServiceDomainNameIdentifier, DomainsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServiceDomainRecommendations", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all App Service Environments for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments + /// + /// + /// Operation Id + /// AppServiceEnvironments_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppServiceEnvironmentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceEnvironmentRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceEnvironmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppServiceEnvironmentResource(Client, AppServiceEnvironmentData.DeserializeAppServiceEnvironmentData(e)), AppServiceEnvironmentClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServiceEnvironments", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all App Service Environments for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments + /// + /// + /// Operation Id + /// AppServiceEnvironments_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppServiceEnvironments(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceEnvironmentRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceEnvironmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppServiceEnvironmentResource(Client, AppServiceEnvironmentData.DeserializeAppServiceEnvironmentData(e)), AppServiceEnvironmentClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServiceEnvironments", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all App Service plans for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms + /// + /// + /// Operation Id + /// AppServicePlans_List + /// + /// + /// + /// + /// Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. + /// Retrieval of all properties may increase the API latency. + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppServicePlansAsync(bool? detailed = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppServicePlanRestClient.CreateListRequest(Id.SubscriptionId, detailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServicePlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, detailed); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppServicePlanResource(Client, AppServicePlanData.DeserializeAppServicePlanData(e)), AppServicePlanClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServicePlans", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all App Service plans for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms + /// + /// + /// Operation Id + /// AppServicePlans_List + /// + /// + /// + /// + /// Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. + /// Retrieval of all properties may increase the API latency. + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppServicePlans(bool? detailed = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppServicePlanRestClient.CreateListRequest(Id.SubscriptionId, detailed); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServicePlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, detailed); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppServicePlanResource(Client, AppServicePlanData.DeserializeAppServicePlanData(e)), AppServicePlanClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppServicePlans", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all certificates for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates + /// + /// + /// Operation Id + /// Certificates_List + /// + /// + /// + /// Return only information specified in the filter (using OData syntax). For example: $filter=KeyVaultId eq 'KeyVaultId'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppCertificatesAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppCertificateCertificatesRestClient.CreateListRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppCertificateCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppCertificateResource(Client, AppCertificateData.DeserializeAppCertificateData(e)), AppCertificateCertificatesClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppCertificates", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all certificates for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates + /// + /// + /// Operation Id + /// Certificates_List + /// + /// + /// + /// Return only information specified in the filter (using OData syntax). For example: $filter=KeyVaultId eq 'KeyVaultId'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppCertificates(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AppCertificateCertificatesRestClient.CreateListRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppCertificateCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppCertificateResource(Client, AppCertificateData.DeserializeAppCertificateData(e)), AppCertificateCertificatesClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppCertificates", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all deleted apps for a subscription at location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites + /// + /// + /// Operation Id + /// DeletedWebApps_ListByLocation + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeletedSitesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedSiteDeletedWebAppsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedSiteDeletedWebAppsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedSiteResource(Client, DeletedSiteData.DeserializeDeletedSiteData(e)), DeletedSiteDeletedWebAppsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetDeletedSitesByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all deleted apps for a subscription at location + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites + /// + /// + /// Operation Id + /// DeletedWebApps_ListByLocation + /// + /// + /// + /// The String to use. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeletedSitesByLocation(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedSiteDeletedWebAppsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedSiteDeletedWebAppsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedSiteResource(Client, DeletedSiteData.DeserializeDeletedSiteData(e)), DeletedSiteDeletedWebAppsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetDeletedSitesByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get deleted app for a subscription at location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId} + /// + /// + /// Operation Id + /// DeletedWebApps_GetDeletedWebAppByLocation + /// + /// + /// + /// The String to use. + /// The numeric ID of the deleted app, e.g. 12345. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetDeletedWebAppByLocationDeletedWebAppAsync(AzureLocation location, string deletedSiteId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deletedSiteId, nameof(deletedSiteId)); + + using var scope = DeletedSiteDeletedWebAppsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.GetDeletedWebAppByLocationDeletedWebApp"); + scope.Start(); + try + { + var response = await DeletedSiteDeletedWebAppsRestClient.GetDeletedWebAppByLocationAsync(Id.SubscriptionId, location, deletedSiteId, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DeletedSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Get deleted app for a subscription at location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId} + /// + /// + /// Operation Id + /// DeletedWebApps_GetDeletedWebAppByLocation + /// + /// + /// + /// The String to use. + /// The numeric ID of the deleted app, e.g. 12345. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetDeletedWebAppByLocationDeletedWebApp(AzureLocation location, string deletedSiteId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deletedSiteId, nameof(deletedSiteId)); + + using var scope = DeletedSiteDeletedWebAppsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.GetDeletedWebAppByLocationDeletedWebApp"); + scope.Start(); + try + { + var response = DeletedSiteDeletedWebAppsRestClient.GetDeletedWebAppByLocation(Id.SubscriptionId, location, deletedSiteId, cancellationToken); + return Response.FromValue(new DeletedSiteResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Get all Kubernetes Environments for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/kubeEnvironments + /// + /// + /// Operation Id + /// KubeEnvironments_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetKubeEnvironmentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KubeEnvironmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KubeEnvironmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KubeEnvironmentResource(Client, KubeEnvironmentData.DeserializeKubeEnvironmentData(e)), KubeEnvironmentClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetKubeEnvironments", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all Kubernetes Environments for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/kubeEnvironments + /// + /// + /// Operation Id + /// KubeEnvironments_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetKubeEnvironments(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KubeEnvironmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KubeEnvironmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KubeEnvironmentResource(Client, KubeEnvironmentData.DeserializeKubeEnvironmentData(e)), KubeEnvironmentClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetKubeEnvironments", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available application frameworks and their versions + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks + /// + /// + /// Operation Id + /// Provider_GetAvailableStacksOnPrem + /// + /// + /// + /// The ProviderOSTypeSelected to use. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableStacksOnPremProvidersAsync(ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetAvailableStacksOnPremRequest(Id.SubscriptionId, osTypeSelected); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetAvailableStacksOnPremNextPageRequest(nextLink, Id.SubscriptionId, osTypeSelected); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApplicationStackResource.DeserializeApplicationStackResource, ProviderClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAvailableStacksOnPremProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available application frameworks and their versions + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks + /// + /// + /// Operation Id + /// Provider_GetAvailableStacksOnPrem + /// + /// + /// + /// The ProviderOSTypeSelected to use. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableStacksOnPremProviders(ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetAvailableStacksOnPremRequest(Id.SubscriptionId, osTypeSelected); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetAvailableStacksOnPremNextPageRequest(nextLink, Id.SubscriptionId, osTypeSelected); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApplicationStackResource.DeserializeApplicationStackResource, ProviderClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAvailableStacksOnPremProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for List all recommendations for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations + /// + /// + /// Operation Id + /// Recommendations_List + /// + /// + /// + /// Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. + /// Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRecommendationsAsync(bool? featured = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RecommendationsRestClient.CreateListRequest(Id.SubscriptionId, featured, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RecommendationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, featured, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceRecommendation.DeserializeAppServiceRecommendation, RecommendationsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetRecommendations", "value", "nextLink", cancellationToken); + } + + /// + /// Description for List all recommendations for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations + /// + /// + /// Operation Id + /// Recommendations_List + /// + /// + /// + /// Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. + /// Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRecommendations(bool? featured = null, string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RecommendationsRestClient.CreateListRequest(Id.SubscriptionId, featured, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RecommendationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, featured, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceRecommendation.DeserializeAppServiceRecommendation, RecommendationsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetRecommendations", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Reset all recommendation opt-out settings for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset + /// + /// + /// Operation Id + /// Recommendations_ResetAllFilters + /// + /// + /// + /// The cancellation token to use. + public virtual async Task ResetAllRecommendationFiltersAsync(CancellationToken cancellationToken = default) + { + using var scope = RecommendationsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.ResetAllRecommendationFilters"); + scope.Start(); + try + { + var response = await RecommendationsRestClient.ResetAllFiltersAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Reset all recommendation opt-out settings for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset + /// + /// + /// Operation Id + /// Recommendations_ResetAllFilters + /// + /// + /// + /// The cancellation token to use. + public virtual Response ResetAllRecommendationFilters(CancellationToken cancellationToken = default) + { + using var scope = RecommendationsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.ResetAllRecommendationFilters"); + scope.Start(); + try + { + var response = RecommendationsRestClient.ResetAllFilters(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Disables the specified rule so it will not apply to a subscription in the future. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable + /// + /// + /// Operation Id + /// Recommendations_DisableRecommendationForSubscription + /// + /// + /// + /// Rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task DisableAppServiceRecommendationAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = RecommendationsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.DisableAppServiceRecommendation"); + scope.Start(); + try + { + var response = await RecommendationsRestClient.DisableRecommendationForSubscriptionAsync(Id.SubscriptionId, name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Disables the specified rule so it will not apply to a subscription in the future. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable + /// + /// + /// Operation Id + /// Recommendations_DisableRecommendationForSubscription + /// + /// + /// + /// Rule name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response DisableAppServiceRecommendation(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = RecommendationsClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.DisableAppServiceRecommendation"); + scope.Start(); + try + { + var response = RecommendationsRestClient.DisableRecommendationForSubscription(Id.SubscriptionId, name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for List all ResourceHealthMetadata for all sites in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata + /// + /// + /// Operation Id + /// ResourceHealthMetadata_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllResourceHealthMetadataAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceHealthMetadataRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceHealthMetadataRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthMetadataData.DeserializeResourceHealthMetadataData, ResourceHealthMetadataClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAllResourceHealthMetadata", "value", "nextLink", cancellationToken); + } + + /// + /// Description for List all ResourceHealthMetadata for all sites in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata + /// + /// + /// Operation Id + /// ResourceHealthMetadata_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAllResourceHealthMetadata(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceHealthMetadataRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceHealthMetadataRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthMetadataData.DeserializeResourceHealthMetadataData, ResourceHealthMetadataClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAllResourceHealthMetadata", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Gets a list of meters for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters + /// + /// + /// Operation Id + /// ListBillingMeters + /// + /// + /// + /// Azure Location of billable resource. + /// App Service OS type meters used for. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBillingMetersAsync(string billingLocation = null, string osType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListBillingMetersRequest(Id.SubscriptionId, billingLocation, osType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListBillingMetersNextPageRequest(nextLink, Id.SubscriptionId, billingLocation, osType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceBillingMeter.DeserializeAppServiceBillingMeter, DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetBillingMeters", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Gets a list of meters for a given location. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters + /// + /// + /// Operation Id + /// ListBillingMeters + /// + /// + /// + /// Azure Location of billable resource. + /// App Service OS type meters used for. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBillingMeters(string billingLocation = null, string osType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListBillingMetersRequest(Id.SubscriptionId, billingLocation, osType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListBillingMetersNextPageRequest(nextLink, Id.SubscriptionId, billingLocation, osType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceBillingMeter.DeserializeAppServiceBillingMeter, DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetBillingMeters", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Check if a resource name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// Name availability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckAppServiceNameAvailabilityAsync(ResourceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.CheckAppServiceNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Check if a resource name is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// Name availability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckAppServiceNameAvailability(ResourceNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.CheckAppServiceNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Gets list of available geo regions plus ministamps + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations + /// + /// + /// Operation Id + /// GetSubscriptionDeploymentLocations + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAppServiceDeploymentLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.GetAppServiceDeploymentLocations"); + scope.Start(); + try + { + var response = await DefaultRestClient.GetSubscriptionDeploymentLocationsAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Gets list of available geo regions plus ministamps + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations + /// + /// + /// Operation Id + /// GetSubscriptionDeploymentLocations + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetAppServiceDeploymentLocations(CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.GetAppServiceDeploymentLocations"); + scope.Start(); + try + { + var response = DefaultRestClient.GetSubscriptionDeploymentLocations(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Get a list of available geographical regions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions + /// + /// + /// Operation Id + /// ListGeoRegions + /// + /// + /// + /// Name of SKU used to filter the regions. + /// Specify <code>true</code> if you want to filter to only regions that support Linux workers. + /// Specify <code>true</code> if you want to filter to only regions that support Xenon workers. + /// Specify <code>true</code> if you want to filter to only regions that support Linux Consumption Workers. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGeoRegionsAsync(AppServiceSkuName? sku = null, bool? linuxWorkersEnabled = null, bool? xenonWorkersEnabled = null, bool? linuxDynamicWorkersEnabled = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListGeoRegionsRequest(Id.SubscriptionId, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListGeoRegionsNextPageRequest(nextLink, Id.SubscriptionId, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceGeoRegion.DeserializeAppServiceGeoRegion, DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetGeoRegions", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get a list of available geographical regions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions + /// + /// + /// Operation Id + /// ListGeoRegions + /// + /// + /// + /// Name of SKU used to filter the regions. + /// Specify <code>true</code> if you want to filter to only regions that support Linux workers. + /// Specify <code>true</code> if you want to filter to only regions that support Xenon workers. + /// Specify <code>true</code> if you want to filter to only regions that support Linux Consumption Workers. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGeoRegions(AppServiceSkuName? sku = null, bool? linuxWorkersEnabled = null, bool? xenonWorkersEnabled = null, bool? linuxDynamicWorkersEnabled = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListGeoRegionsRequest(Id.SubscriptionId, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListGeoRegionsNextPageRequest(nextLink, Id.SubscriptionId, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceGeoRegion.DeserializeAppServiceGeoRegion, DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetGeoRegions", "value", "nextLink", cancellationToken); + } + + /// + /// Description for List all premier add-on offers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers + /// + /// + /// Operation Id + /// ListPremierAddOnOffers + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPremierAddOnOffersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListPremierAddOnOffersRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListPremierAddOnOffersNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PremierAddOnOffer.DeserializePremierAddOnOffer, DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetPremierAddOnOffers", "value", "nextLink", cancellationToken); + } + + /// + /// Description for List all premier add-on offers. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers + /// + /// + /// Operation Id + /// ListPremierAddOnOffers + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPremierAddOnOffers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListPremierAddOnOffersRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListPremierAddOnOffersNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PremierAddOnOffer.DeserializePremierAddOnOffer, DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetPremierAddOnOffers", "value", "nextLink", cancellationToken); + } + + /// + /// Description for List all SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/skus + /// + /// + /// Operation Id + /// ListSkus + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetSkusAsync(CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.GetSkus"); + scope.Start(); + try + { + var response = await DefaultRestClient.ListSkusAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for List all SKUs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/skus + /// + /// + /// Operation Id + /// ListSkus + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetSkus(CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.GetSkus"); + scope.Start(); + try + { + var response = DefaultRestClient.ListSkus(Id.SubscriptionId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet + /// + /// + /// Operation Id + /// VerifyHostingEnvironmentVnet + /// + /// + /// + /// VNET information. + /// The cancellation token to use. + /// is null. + public virtual async Task> VerifyHostingEnvironmentVnetAsync(AppServiceVirtualNetworkValidationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.VerifyHostingEnvironmentVnet"); + scope.Start(); + try + { + var response = await DefaultRestClient.VerifyHostingEnvironmentVnetAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet + /// + /// + /// Operation Id + /// VerifyHostingEnvironmentVnet + /// + /// + /// + /// VNET information. + /// The cancellation token to use. + /// is null. + public virtual Response VerifyHostingEnvironmentVnet(AppServiceVirtualNetworkValidationContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.VerifyHostingEnvironmentVnet"); + scope.Start(); + try + { + var response = DefaultRestClient.VerifyHostingEnvironmentVnet(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Generates a preview workflow file for the static site + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/previewStaticSiteWorkflowFile + /// + /// + /// Operation Id + /// StaticSites_PreviewWorkflow + /// + /// + /// + /// Location where you plan to create the static site. + /// A JSON representation of the StaticSitesWorkflowPreviewRequest properties. See example. + /// The cancellation token to use. + /// is null. + public virtual async Task> PreviewStaticSiteWorkflowAsync(AzureLocation location, StaticSitesWorkflowPreviewContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = StaticSitesClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.PreviewStaticSiteWorkflow"); + scope.Start(); + try + { + var response = await StaticSitesRestClient.PreviewWorkflowAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Generates a preview workflow file for the static site + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/previewStaticSiteWorkflowFile + /// + /// + /// Operation Id + /// StaticSites_PreviewWorkflow + /// + /// + /// + /// Location where you plan to create the static site. + /// A JSON representation of the StaticSitesWorkflowPreviewRequest properties. See example. + /// The cancellation token to use. + /// is null. + public virtual Response PreviewStaticSiteWorkflow(AzureLocation location, StaticSitesWorkflowPreviewContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = StaticSitesClientDiagnostics.CreateScope("MockableAppServiceSubscriptionResource.PreviewStaticSiteWorkflow"); + scope.Start(); + try + { + var response = StaticSitesRestClient.PreviewWorkflow(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Get all Static Sites for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/staticSites + /// + /// + /// Operation Id + /// StaticSites_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStaticSitesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StaticSiteRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StaticSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StaticSiteResource(Client, StaticSiteData.DeserializeStaticSiteData(e)), StaticSiteClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetStaticSites", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all Static Sites for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/staticSites + /// + /// + /// Operation Id + /// StaticSites_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStaticSites(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => StaticSiteRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StaticSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StaticSiteResource(Client, StaticSiteData.DeserializeStaticSiteData(e)), StaticSiteClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetStaticSites", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all apps for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/sites + /// + /// + /// Operation Id + /// WebApps_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWebSitesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WebSiteWebAppsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebSiteWebAppsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebSiteResource(Client, WebSiteData.DeserializeWebSiteData(e)), WebSiteWebAppsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetWebSites", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get all apps for a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/sites + /// + /// + /// Operation Id + /// WebApps_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWebSites(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WebSiteWebAppsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebSiteWebAppsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebSiteResource(Client, WebSiteData.DeserializeWebSiteData(e)), WebSiteWebAppsClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetWebSites", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceTenantResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceTenantResource.cs new file mode 100644 index 0000000000000..fa9ca4b4ec1dd --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceTenantResource.cs @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableAppServiceTenantResource : ArmResource + { + private ClientDiagnostics _certificateRegistrationProviderClientDiagnostics; + private CertificateRegistrationProviderRestOperations _certificateRegistrationProviderRestClient; + private ClientDiagnostics _domainRegistrationProviderClientDiagnostics; + private DomainRegistrationProviderRestOperations _domainRegistrationProviderRestClient; + private ClientDiagnostics _providerClientDiagnostics; + private ProviderRestOperations _providerRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAppServiceTenantResource() + { + } + + /// 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 MockableAppServiceTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics CertificateRegistrationProviderClientDiagnostics => _certificateRegistrationProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private CertificateRegistrationProviderRestOperations CertificateRegistrationProviderRestClient => _certificateRegistrationProviderRestClient ??= new CertificateRegistrationProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DomainRegistrationProviderClientDiagnostics => _domainRegistrationProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private DomainRegistrationProviderRestOperations DomainRegistrationProviderRestClient => _domainRegistrationProviderRestClient ??= new DomainRegistrationProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ProviderClientDiagnostics => _providerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ProviderRestOperations ProviderRestClient => _providerRestClient ??= new ProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets an object representing a PublishingUserResource along with the instance operations that can be performed on it in the TenantResource. + /// Returns a object. + public virtual PublishingUserResource GetPublishingUser() + { + return new PublishingUserResource(Client, Id.AppendProviderResource("Microsoft.Web", "publishingUsers", "web")); + } + + /// Gets a collection of AppServiceSourceControlResources in the TenantResource. + /// An object representing collection of AppServiceSourceControlResources and their operations over a AppServiceSourceControlResource. + public virtual AppServiceSourceControlCollection GetAppServiceSourceControls() + { + return GetCachedClient(client => new AppServiceSourceControlCollection(client, Id)); + } + + /// + /// Description for Gets source control token + /// + /// + /// Request Path + /// /providers/Microsoft.Web/sourcecontrols/{sourceControlType} + /// + /// + /// Operation Id + /// GetSourceControl + /// + /// + /// + /// Type of source control. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAppServiceSourceControlAsync(string sourceControlType, CancellationToken cancellationToken = default) + { + return await GetAppServiceSourceControls().GetAsync(sourceControlType, cancellationToken).ConfigureAwait(false); + } + + /// + /// Description for Gets source control token + /// + /// + /// Request Path + /// /providers/Microsoft.Web/sourcecontrols/{sourceControlType} + /// + /// + /// Operation Id + /// GetSourceControl + /// + /// + /// + /// Type of source control. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAppServiceSourceControl(string sourceControlType, CancellationToken cancellationToken = default) + { + return GetAppServiceSourceControls().Get(sourceControlType, cancellationToken); + } + + /// + /// Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider + /// + /// + /// Request Path + /// /providers/Microsoft.CertificateRegistration/operations + /// + /// + /// Operation Id + /// CertificateRegistrationProvider_ListOperations + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationsCertificateRegistrationProvidersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CertificateRegistrationProviderRestClient.CreateListOperationsRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CertificateRegistrationProviderRestClient.CreateListOperationsNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, CertificateRegistrationProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetOperationsCertificateRegistrationProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider + /// + /// + /// Request Path + /// /providers/Microsoft.CertificateRegistration/operations + /// + /// + /// Operation Id + /// CertificateRegistrationProvider_ListOperations + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperationsCertificateRegistrationProviders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CertificateRegistrationProviderRestClient.CreateListOperationsRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CertificateRegistrationProviderRestClient.CreateListOperationsNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, CertificateRegistrationProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetOperationsCertificateRegistrationProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider + /// + /// + /// Request Path + /// /providers/Microsoft.DomainRegistration/operations + /// + /// + /// Operation Id + /// DomainRegistrationProvider_ListOperations + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationsDomainRegistrationProvidersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DomainRegistrationProviderRestClient.CreateListOperationsRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DomainRegistrationProviderRestClient.CreateListOperationsNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, DomainRegistrationProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetOperationsDomainRegistrationProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider + /// + /// + /// Request Path + /// /providers/Microsoft.DomainRegistration/operations + /// + /// + /// Operation Id + /// DomainRegistrationProvider_ListOperations + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperationsDomainRegistrationProviders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DomainRegistrationProviderRestClient.CreateListOperationsRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DomainRegistrationProviderRestClient.CreateListOperationsNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, DomainRegistrationProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetOperationsDomainRegistrationProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available application frameworks and their versions + /// + /// + /// Request Path + /// /providers/Microsoft.Web/availableStacks + /// + /// + /// Operation Id + /// Provider_GetAvailableStacks + /// + /// + /// + /// The ProviderOSTypeSelected to use. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAvailableStacksProvidersAsync(ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetAvailableStacksRequest(osTypeSelected); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetAvailableStacksNextPageRequest(nextLink, osTypeSelected); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApplicationStackResource.DeserializeApplicationStackResource, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetAvailableStacksProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available application frameworks and their versions + /// + /// + /// Request Path + /// /providers/Microsoft.Web/availableStacks + /// + /// + /// Operation Id + /// Provider_GetAvailableStacks + /// + /// + /// + /// The ProviderOSTypeSelected to use. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAvailableStacksProviders(ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetAvailableStacksRequest(osTypeSelected); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetAvailableStacksNextPageRequest(nextLink, osTypeSelected); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApplicationStackResource.DeserializeApplicationStackResource, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetAvailableStacksProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available Function app frameworks and their versions + /// + /// + /// Request Path + /// /providers/Microsoft.Web/functionAppStacks + /// + /// + /// Operation Id + /// Provider_GetFunctionAppStacks + /// + /// + /// + /// Stack OS Type. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFunctionAppStacksProvidersAsync(ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetFunctionAppStacksRequest(stackOSType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetFunctionAppStacksNextPageRequest(nextLink, stackOSType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, FunctionAppStack.DeserializeFunctionAppStack, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetFunctionAppStacksProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available Function app frameworks and their versions + /// + /// + /// Request Path + /// /providers/Microsoft.Web/functionAppStacks + /// + /// + /// Operation Id + /// Provider_GetFunctionAppStacks + /// + /// + /// + /// Stack OS Type. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFunctionAppStacksProviders(ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetFunctionAppStacksRequest(stackOSType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetFunctionAppStacksNextPageRequest(nextLink, stackOSType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, FunctionAppStack.DeserializeFunctionAppStack, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetFunctionAppStacksProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available Function app frameworks and their versions for location + /// + /// + /// Request Path + /// /providers/Microsoft.Web/locations/{location}/functionAppStacks + /// + /// + /// Operation Id + /// Provider_GetFunctionAppStacksForLocation + /// + /// + /// + /// Function App stack location. + /// Stack OS Type. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFunctionAppStacksForLocationProvidersAsync(AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetFunctionAppStacksForLocationRequest(location, stackOSType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetFunctionAppStacksForLocationNextPageRequest(nextLink, location, stackOSType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, FunctionAppStack.DeserializeFunctionAppStack, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetFunctionAppStacksForLocationProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available Function app frameworks and their versions for location + /// + /// + /// Request Path + /// /providers/Microsoft.Web/locations/{location}/functionAppStacks + /// + /// + /// Operation Id + /// Provider_GetFunctionAppStacksForLocation + /// + /// + /// + /// Function App stack location. + /// Stack OS Type. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFunctionAppStacksForLocationProviders(AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetFunctionAppStacksForLocationRequest(location, stackOSType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetFunctionAppStacksForLocationNextPageRequest(nextLink, location, stackOSType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, FunctionAppStack.DeserializeFunctionAppStack, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetFunctionAppStacksForLocationProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available Web app frameworks and their versions for location + /// + /// + /// Request Path + /// /providers/Microsoft.Web/locations/{location}/webAppStacks + /// + /// + /// Operation Id + /// Provider_GetWebAppStacksForLocation + /// + /// + /// + /// Web App stack location. + /// Stack OS Type. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWebAppStacksByLocationAsync(AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetWebAppStacksForLocationRequest(location, stackOSType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetWebAppStacksForLocationNextPageRequest(nextLink, location, stackOSType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, WebAppStack.DeserializeWebAppStack, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetWebAppStacksByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available Web app frameworks and their versions for location + /// + /// + /// Request Path + /// /providers/Microsoft.Web/locations/{location}/webAppStacks + /// + /// + /// Operation Id + /// Provider_GetWebAppStacksForLocation + /// + /// + /// + /// Web App stack location. + /// Stack OS Type. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWebAppStacksByLocation(AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetWebAppStacksForLocationRequest(location, stackOSType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetWebAppStacksForLocationNextPageRequest(nextLink, location, stackOSType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, WebAppStack.DeserializeWebAppStack, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetWebAppStacksByLocation", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions + /// + /// + /// Request Path + /// /providers/Microsoft.Web/operations + /// + /// + /// Operation Id + /// Provider_ListOperations + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOperationsProvidersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateListOperationsRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateListOperationsNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetOperationsProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions + /// + /// + /// Request Path + /// /providers/Microsoft.Web/operations + /// + /// + /// Operation Id + /// Provider_ListOperations + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOperationsProviders(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateListOperationsRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateListOperationsNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetOperationsProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available Web app frameworks and their versions + /// + /// + /// Request Path + /// /providers/Microsoft.Web/webAppStacks + /// + /// + /// Operation Id + /// Provider_GetWebAppStacks + /// + /// + /// + /// Stack OS Type. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWebAppStacksProvidersAsync(ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetWebAppStacksRequest(stackOSType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetWebAppStacksNextPageRequest(nextLink, stackOSType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, WebAppStack.DeserializeWebAppStack, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetWebAppStacksProviders", "value", "nextLink", cancellationToken); + } + + /// + /// Description for Get available Web app frameworks and their versions + /// + /// + /// Request Path + /// /providers/Microsoft.Web/webAppStacks + /// + /// + /// Operation Id + /// Provider_GetWebAppStacks + /// + /// + /// + /// Stack OS Type. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWebAppStacksProviders(ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetWebAppStacksRequest(stackOSType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetWebAppStacksNextPageRequest(nextLink, stackOSType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, WebAppStack.DeserializeWebAppStack, ProviderClientDiagnostics, Pipeline, "MockableAppServiceTenantResource.GetWebAppStacksProviders", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index b27c064647b3f..0000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; - -namespace Azure.ResourceManager.AppService -{ - /// A class to add extension methods to ResourceGroupResource. - internal partial class ResourceGroupResourceExtensionClient : ArmResource - { - private ClientDiagnostics _resourceHealthMetadataClientDiagnostics; - private ResourceHealthMetadataRestOperations _resourceHealthMetadataRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private WebSiteManagementRestOperations _defaultRestClient; - - /// 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 ClientDiagnostics ResourceHealthMetadataClientDiagnostics => _resourceHealthMetadataClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceHealthMetadataRestOperations ResourceHealthMetadataRestClient => _resourceHealthMetadataRestClient ??= new ResourceHealthMetadataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private WebSiteManagementRestOperations DefaultRestClient => _defaultRestClient ??= new WebSiteManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of AppServiceCertificateOrderResources in the ResourceGroupResource. - /// An object representing collection of AppServiceCertificateOrderResources and their operations over a AppServiceCertificateOrderResource. - public virtual AppServiceCertificateOrderCollection GetAppServiceCertificateOrders() - { - return GetCachedClient(Client => new AppServiceCertificateOrderCollection(Client, Id)); - } - - /// Gets a collection of AppServiceDomainResources in the ResourceGroupResource. - /// An object representing collection of AppServiceDomainResources and their operations over a AppServiceDomainResource. - public virtual AppServiceDomainCollection GetAppServiceDomains() - { - return GetCachedClient(Client => new AppServiceDomainCollection(Client, Id)); - } - - /// Gets a collection of AppServiceEnvironmentResources in the ResourceGroupResource. - /// An object representing collection of AppServiceEnvironmentResources and their operations over a AppServiceEnvironmentResource. - public virtual AppServiceEnvironmentCollection GetAppServiceEnvironments() - { - return GetCachedClient(Client => new AppServiceEnvironmentCollection(Client, Id)); - } - - /// Gets a collection of AppServicePlanResources in the ResourceGroupResource. - /// An object representing collection of AppServicePlanResources and their operations over a AppServicePlanResource. - public virtual AppServicePlanCollection GetAppServicePlans() - { - return GetCachedClient(Client => new AppServicePlanCollection(Client, Id)); - } - - /// Gets a collection of AppCertificateResources in the ResourceGroupResource. - /// An object representing collection of AppCertificateResources and their operations over a AppCertificateResource. - public virtual AppCertificateCollection GetAppCertificates() - { - return GetCachedClient(Client => new AppCertificateCollection(Client, Id)); - } - - /// Gets a collection of KubeEnvironmentResources in the ResourceGroupResource. - /// An object representing collection of KubeEnvironmentResources and their operations over a KubeEnvironmentResource. - public virtual KubeEnvironmentCollection GetKubeEnvironments() - { - return GetCachedClient(Client => new KubeEnvironmentCollection(Client, Id)); - } - - /// Gets a collection of StaticSiteResources in the ResourceGroupResource. - /// An object representing collection of StaticSiteResources and their operations over a StaticSiteResource. - public virtual StaticSiteCollection GetStaticSites() - { - return GetCachedClient(Client => new StaticSiteCollection(Client, Id)); - } - - /// Gets a collection of WebSiteResources in the ResourceGroupResource. - /// An object representing collection of WebSiteResources and their operations over a WebSiteResource. - public virtual WebSiteCollection GetWebSites() - { - return GetCachedClient(Client => new WebSiteCollection(Client, Id)); - } - - /// - /// Description for Validate if a resource can be created. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate - /// - /// - /// Operation Id - /// Validate - /// - /// - /// - /// Request with the resources to validate. - /// The cancellation token to use. - public virtual async Task> ValidateAsync(AppServiceValidateContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.Validate"); - scope.Start(); - try - { - var response = await DefaultRestClient.ValidateAsync(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Validate if a resource can be created. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/validate - /// - /// - /// Operation Id - /// Validate - /// - /// - /// - /// Request with the resources to validate. - /// The cancellation token to use. - public virtual Response Validate(AppServiceValidateContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.Validate"); - scope.Start(); - try - { - var response = DefaultRestClient.Validate(Id.SubscriptionId, Id.ResourceGroupName, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 46d254760391b..0000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,1535 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; - -namespace Azure.ResourceManager.AppService -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _appServiceCertificateOrderClientDiagnostics; - private AppServiceCertificateOrdersRestOperations _appServiceCertificateOrderRestClient; - private ClientDiagnostics _appServiceCertificateOrdersClientDiagnostics; - private AppServiceCertificateOrdersRestOperations _appServiceCertificateOrdersRestClient; - private ClientDiagnostics _domainsClientDiagnostics; - private DomainsRestOperations _domainsRestClient; - private ClientDiagnostics _appServiceDomainDomainsClientDiagnostics; - private DomainsRestOperations _appServiceDomainDomainsRestClient; - private ClientDiagnostics _appServiceEnvironmentClientDiagnostics; - private AppServiceEnvironmentsRestOperations _appServiceEnvironmentRestClient; - private ClientDiagnostics _appServicePlanClientDiagnostics; - private AppServicePlansRestOperations _appServicePlanRestClient; - private ClientDiagnostics _appCertificateCertificatesClientDiagnostics; - private CertificatesRestOperations _appCertificateCertificatesRestClient; - private ClientDiagnostics _deletedSiteDeletedWebAppsClientDiagnostics; - private DeletedWebAppsRestOperations _deletedSiteDeletedWebAppsRestClient; - private ClientDiagnostics _kubeEnvironmentClientDiagnostics; - private KubeEnvironmentsRestOperations _kubeEnvironmentRestClient; - private ClientDiagnostics _providerClientDiagnostics; - private ProviderRestOperations _providerRestClient; - private ClientDiagnostics _recommendationsClientDiagnostics; - private RecommendationsRestOperations _recommendationsRestClient; - private ClientDiagnostics _resourceHealthMetadataClientDiagnostics; - private ResourceHealthMetadataRestOperations _resourceHealthMetadataRestClient; - private ClientDiagnostics _defaultClientDiagnostics; - private WebSiteManagementRestOperations _defaultRestClient; - private ClientDiagnostics _staticSitesClientDiagnostics; - private StaticSitesRestOperations _staticSitesRestClient; - private ClientDiagnostics _staticSiteClientDiagnostics; - private StaticSitesRestOperations _staticSiteRestClient; - private ClientDiagnostics _webSiteWebAppsClientDiagnostics; - private WebAppsRestOperations _webSiteWebAppsRestClient; - - /// 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 AppServiceCertificateOrderClientDiagnostics => _appServiceCertificateOrderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppServiceCertificateOrderResource.ResourceType.Namespace, Diagnostics); - private AppServiceCertificateOrdersRestOperations AppServiceCertificateOrderRestClient => _appServiceCertificateOrderRestClient ??= new AppServiceCertificateOrdersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServiceCertificateOrderResource.ResourceType)); - private ClientDiagnostics AppServiceCertificateOrdersClientDiagnostics => _appServiceCertificateOrdersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AppServiceCertificateOrdersRestOperations AppServiceCertificateOrdersRestClient => _appServiceCertificateOrdersRestClient ??= new AppServiceCertificateOrdersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DomainsClientDiagnostics => _domainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DomainsRestOperations DomainsRestClient => _domainsRestClient ??= new DomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics AppServiceDomainDomainsClientDiagnostics => _appServiceDomainDomainsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppServiceDomainResource.ResourceType.Namespace, Diagnostics); - private DomainsRestOperations AppServiceDomainDomainsRestClient => _appServiceDomainDomainsRestClient ??= new DomainsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServiceDomainResource.ResourceType)); - private ClientDiagnostics AppServiceEnvironmentClientDiagnostics => _appServiceEnvironmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppServiceEnvironmentResource.ResourceType.Namespace, Diagnostics); - private AppServiceEnvironmentsRestOperations AppServiceEnvironmentRestClient => _appServiceEnvironmentRestClient ??= new AppServiceEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServiceEnvironmentResource.ResourceType)); - private ClientDiagnostics AppServicePlanClientDiagnostics => _appServicePlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppServicePlanResource.ResourceType.Namespace, Diagnostics); - private AppServicePlansRestOperations AppServicePlanRestClient => _appServicePlanRestClient ??= new AppServicePlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServicePlanResource.ResourceType)); - private ClientDiagnostics AppCertificateCertificatesClientDiagnostics => _appCertificateCertificatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppCertificateResource.ResourceType.Namespace, Diagnostics); - private CertificatesRestOperations AppCertificateCertificatesRestClient => _appCertificateCertificatesRestClient ??= new CertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppCertificateResource.ResourceType)); - private ClientDiagnostics DeletedSiteDeletedWebAppsClientDiagnostics => _deletedSiteDeletedWebAppsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", DeletedSiteResource.ResourceType.Namespace, Diagnostics); - private DeletedWebAppsRestOperations DeletedSiteDeletedWebAppsRestClient => _deletedSiteDeletedWebAppsRestClient ??= new DeletedWebAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedSiteResource.ResourceType)); - private ClientDiagnostics KubeEnvironmentClientDiagnostics => _kubeEnvironmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", KubeEnvironmentResource.ResourceType.Namespace, Diagnostics); - private KubeEnvironmentsRestOperations KubeEnvironmentRestClient => _kubeEnvironmentRestClient ??= new KubeEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KubeEnvironmentResource.ResourceType)); - private ClientDiagnostics ProviderClientDiagnostics => _providerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ProviderRestOperations ProviderRestClient => _providerRestClient ??= new ProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics RecommendationsClientDiagnostics => _recommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private RecommendationsRestOperations RecommendationsRestClient => _recommendationsRestClient ??= new RecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ResourceHealthMetadataClientDiagnostics => _resourceHealthMetadataClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ResourceHealthMetadataRestOperations ResourceHealthMetadataRestClient => _resourceHealthMetadataRestClient ??= new ResourceHealthMetadataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private WebSiteManagementRestOperations DefaultRestClient => _defaultRestClient ??= new WebSiteManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics StaticSitesClientDiagnostics => _staticSitesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private StaticSitesRestOperations StaticSitesRestClient => _staticSitesRestClient ??= new StaticSitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics StaticSiteClientDiagnostics => _staticSiteClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", StaticSiteResource.ResourceType.Namespace, Diagnostics); - private StaticSitesRestOperations StaticSiteRestClient => _staticSiteRestClient ??= new StaticSitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StaticSiteResource.ResourceType)); - private ClientDiagnostics WebSiteWebAppsClientDiagnostics => _webSiteWebAppsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", WebSiteResource.ResourceType.Namespace, Diagnostics); - private WebAppsRestOperations WebSiteWebAppsRestClient => _webSiteWebAppsRestClient ??= new WebAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WebSiteResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of TopLevelDomainResources in the SubscriptionResource. - /// An object representing collection of TopLevelDomainResources and their operations over a TopLevelDomainResource. - public virtual TopLevelDomainCollection GetTopLevelDomains() - { - return GetCachedClient(Client => new TopLevelDomainCollection(Client, Id)); - } - - /// Gets a collection of DeletedSiteResources in the SubscriptionResource. - /// An object representing collection of DeletedSiteResources and their operations over a DeletedSiteResource. - public virtual DeletedSiteCollection GetDeletedSites() - { - return GetCachedClient(Client => new DeletedSiteCollection(Client, Id)); - } - - /// - /// Description for List all certificate orders in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders - /// - /// - /// Operation Id - /// AppServiceCertificateOrders_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppServiceCertificateOrdersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceCertificateOrderRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceCertificateOrderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppServiceCertificateOrderResource(Client, AppServiceCertificateOrderData.DeserializeAppServiceCertificateOrderData(e)), AppServiceCertificateOrderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServiceCertificateOrders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for List all certificate orders in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/certificateOrders - /// - /// - /// Operation Id - /// AppServiceCertificateOrders_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppServiceCertificateOrders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceCertificateOrderRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceCertificateOrderRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppServiceCertificateOrderResource(Client, AppServiceCertificateOrderData.DeserializeAppServiceCertificateOrderData(e)), AppServiceCertificateOrderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServiceCertificateOrders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Validate information for a certificate order. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation - /// - /// - /// Operation Id - /// AppServiceCertificateOrders_ValidatePurchaseInformation - /// - /// - /// - /// Information for a certificate order. - /// The cancellation token to use. - public virtual async Task ValidateAppServiceCertificateOrderPurchaseInformationAsync(AppServiceCertificateOrderData data, CancellationToken cancellationToken = default) - { - using var scope = AppServiceCertificateOrdersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateAppServiceCertificateOrderPurchaseInformation"); - scope.Start(); - try - { - var response = await AppServiceCertificateOrdersRestClient.ValidatePurchaseInformationAsync(Id.SubscriptionId, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Validate information for a certificate order. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.CertificateRegistration/validateCertificateRegistrationInformation - /// - /// - /// Operation Id - /// AppServiceCertificateOrders_ValidatePurchaseInformation - /// - /// - /// - /// Information for a certificate order. - /// The cancellation token to use. - public virtual Response ValidateAppServiceCertificateOrderPurchaseInformation(AppServiceCertificateOrderData data, CancellationToken cancellationToken = default) - { - using var scope = AppServiceCertificateOrdersClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ValidateAppServiceCertificateOrderPurchaseInformation"); - scope.Start(); - try - { - var response = AppServiceCertificateOrdersRestClient.ValidatePurchaseInformation(Id.SubscriptionId, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Check if a domain is available for registration. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability - /// - /// - /// Operation Id - /// Domains_CheckAvailability - /// - /// - /// - /// Name of the domain. - /// The cancellation token to use. - public virtual async Task> CheckAppServiceDomainRegistrationAvailabilityAsync(AppServiceDomainNameIdentifier identifier, CancellationToken cancellationToken = default) - { - using var scope = DomainsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAppServiceDomainRegistrationAvailability"); - scope.Start(); - try - { - var response = await DomainsRestClient.CheckAvailabilityAsync(Id.SubscriptionId, identifier, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Check if a domain is available for registration. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability - /// - /// - /// Operation Id - /// Domains_CheckAvailability - /// - /// - /// - /// Name of the domain. - /// The cancellation token to use. - public virtual Response CheckAppServiceDomainRegistrationAvailability(AppServiceDomainNameIdentifier identifier, CancellationToken cancellationToken = default) - { - using var scope = DomainsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAppServiceDomainRegistrationAvailability"); - scope.Start(); - try - { - var response = DomainsRestClient.CheckAvailability(Id.SubscriptionId, identifier, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Get all domains in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains - /// - /// - /// Operation Id - /// Domains_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppServiceDomainsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceDomainDomainsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceDomainDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppServiceDomainResource(Client, AppServiceDomainData.DeserializeAppServiceDomainData(e)), AppServiceDomainDomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServiceDomains", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all domains in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains - /// - /// - /// Operation Id - /// Domains_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppServiceDomains(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceDomainDomainsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceDomainDomainsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppServiceDomainResource(Client, AppServiceDomainData.DeserializeAppServiceDomainData(e)), AppServiceDomainDomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServiceDomains", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Generate a single sign-on request for the domain management portal. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest - /// - /// - /// Operation Id - /// Domains_GetControlCenterSsoRequest - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetControlCenterSsoRequestDomainAsync(CancellationToken cancellationToken = default) - { - using var scope = DomainsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetControlCenterSsoRequestDomain"); - scope.Start(); - try - { - var response = await DomainsRestClient.GetControlCenterSsoRequestAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Generate a single sign-on request for the domain management portal. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest - /// - /// - /// Operation Id - /// Domains_GetControlCenterSsoRequest - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetControlCenterSsoRequestDomain(CancellationToken cancellationToken = default) - { - using var scope = DomainsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetControlCenterSsoRequestDomain"); - scope.Start(); - try - { - var response = DomainsRestClient.GetControlCenterSsoRequest(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Get domain name recommendations based on keywords. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations - /// - /// - /// Operation Id - /// Domains_ListRecommendations - /// - /// - /// - /// Search parameters for domain name recommendations. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppServiceDomainRecommendationsAsync(DomainRecommendationSearchContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DomainsRestClient.CreateListRecommendationsRequest(Id.SubscriptionId, content); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DomainsRestClient.CreateListRecommendationsNextPageRequest(nextLink, Id.SubscriptionId, content); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceDomainNameIdentifier.DeserializeAppServiceDomainNameIdentifier, DomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServiceDomainRecommendations", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get domain name recommendations based on keywords. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations - /// - /// - /// Operation Id - /// Domains_ListRecommendations - /// - /// - /// - /// Search parameters for domain name recommendations. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppServiceDomainRecommendations(DomainRecommendationSearchContent content, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DomainsRestClient.CreateListRecommendationsRequest(Id.SubscriptionId, content); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DomainsRestClient.CreateListRecommendationsNextPageRequest(nextLink, Id.SubscriptionId, content); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceDomainNameIdentifier.DeserializeAppServiceDomainNameIdentifier, DomainsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServiceDomainRecommendations", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all App Service Environments for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments - /// - /// - /// Operation Id - /// AppServiceEnvironments_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppServiceEnvironmentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceEnvironmentRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceEnvironmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppServiceEnvironmentResource(Client, AppServiceEnvironmentData.DeserializeAppServiceEnvironmentData(e)), AppServiceEnvironmentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServiceEnvironments", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all App Service Environments for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/hostingEnvironments - /// - /// - /// Operation Id - /// AppServiceEnvironments_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppServiceEnvironments(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppServiceEnvironmentRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServiceEnvironmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppServiceEnvironmentResource(Client, AppServiceEnvironmentData.DeserializeAppServiceEnvironmentData(e)), AppServiceEnvironmentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServiceEnvironments", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all App Service plans for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms - /// - /// - /// Operation Id - /// AppServicePlans_List - /// - /// - /// - /// - /// Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. - /// Retrieval of all properties may increase the API latency. - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppServicePlansAsync(bool? detailed = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppServicePlanRestClient.CreateListRequest(Id.SubscriptionId, detailed); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServicePlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, detailed); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppServicePlanResource(Client, AppServicePlanData.DeserializeAppServicePlanData(e)), AppServicePlanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServicePlans", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all App Service plans for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms - /// - /// - /// Operation Id - /// AppServicePlans_List - /// - /// - /// - /// - /// Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. - /// Retrieval of all properties may increase the API latency. - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppServicePlans(bool? detailed = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppServicePlanRestClient.CreateListRequest(Id.SubscriptionId, detailed); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppServicePlanRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, detailed); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppServicePlanResource(Client, AppServicePlanData.DeserializeAppServicePlanData(e)), AppServicePlanClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppServicePlans", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all certificates for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates - /// - /// - /// Operation Id - /// Certificates_List - /// - /// - /// - /// Return only information specified in the filter (using OData syntax). For example: $filter=KeyVaultId eq 'KeyVaultId'. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAppCertificatesAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppCertificateCertificatesRestClient.CreateListRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppCertificateCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppCertificateResource(Client, AppCertificateData.DeserializeAppCertificateData(e)), AppCertificateCertificatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppCertificates", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all certificates for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/certificates - /// - /// - /// Operation Id - /// Certificates_List - /// - /// - /// - /// Return only information specified in the filter (using OData syntax). For example: $filter=KeyVaultId eq 'KeyVaultId'. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAppCertificates(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppCertificateCertificatesRestClient.CreateListRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppCertificateCertificatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppCertificateResource(Client, AppCertificateData.DeserializeAppCertificateData(e)), AppCertificateCertificatesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAppCertificates", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all deleted apps for a subscription at location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites - /// - /// - /// Operation Id - /// DeletedWebApps_ListByLocation - /// - /// - /// - /// The String to use. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDeletedSitesByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedSiteDeletedWebAppsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedSiteDeletedWebAppsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedSiteResource(Client, DeletedSiteData.DeserializeDeletedSiteData(e)), DeletedSiteDeletedWebAppsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedSitesByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all deleted apps for a subscription at location - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites - /// - /// - /// Operation Id - /// DeletedWebApps_ListByLocation - /// - /// - /// - /// The String to use. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDeletedSitesByLocation(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedSiteDeletedWebAppsRestClient.CreateListByLocationRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedSiteDeletedWebAppsRestClient.CreateListByLocationNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedSiteResource(Client, DeletedSiteData.DeserializeDeletedSiteData(e)), DeletedSiteDeletedWebAppsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDeletedSitesByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get deleted app for a subscription at location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId} - /// - /// - /// Operation Id - /// DeletedWebApps_GetDeletedWebAppByLocation - /// - /// - /// - /// The String to use. - /// The numeric ID of the deleted app, e.g. 12345. - /// The cancellation token to use. - public virtual async Task> GetDeletedWebAppByLocationDeletedWebAppAsync(AzureLocation location, string deletedSiteId, CancellationToken cancellationToken = default) - { - using var scope = DeletedSiteDeletedWebAppsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetDeletedWebAppByLocationDeletedWebApp"); - scope.Start(); - try - { - var response = await DeletedSiteDeletedWebAppsRestClient.GetDeletedWebAppByLocationAsync(Id.SubscriptionId, location, deletedSiteId, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DeletedSiteResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Get deleted app for a subscription at location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/deletedSites/{deletedSiteId} - /// - /// - /// Operation Id - /// DeletedWebApps_GetDeletedWebAppByLocation - /// - /// - /// - /// The String to use. - /// The numeric ID of the deleted app, e.g. 12345. - /// The cancellation token to use. - public virtual Response GetDeletedWebAppByLocationDeletedWebApp(AzureLocation location, string deletedSiteId, CancellationToken cancellationToken = default) - { - using var scope = DeletedSiteDeletedWebAppsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetDeletedWebAppByLocationDeletedWebApp"); - scope.Start(); - try - { - var response = DeletedSiteDeletedWebAppsRestClient.GetDeletedWebAppByLocation(Id.SubscriptionId, location, deletedSiteId, cancellationToken); - return Response.FromValue(new DeletedSiteResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Get all Kubernetes Environments for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/kubeEnvironments - /// - /// - /// Operation Id - /// KubeEnvironments_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetKubeEnvironmentsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => KubeEnvironmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KubeEnvironmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KubeEnvironmentResource(Client, KubeEnvironmentData.DeserializeKubeEnvironmentData(e)), KubeEnvironmentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetKubeEnvironments", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all Kubernetes Environments for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/kubeEnvironments - /// - /// - /// Operation Id - /// KubeEnvironments_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetKubeEnvironments(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => KubeEnvironmentRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KubeEnvironmentRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KubeEnvironmentResource(Client, KubeEnvironmentData.DeserializeKubeEnvironmentData(e)), KubeEnvironmentClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetKubeEnvironments", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available application frameworks and their versions - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks - /// - /// - /// Operation Id - /// Provider_GetAvailableStacksOnPrem - /// - /// - /// - /// The ProviderOSTypeSelected to use. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableStacksOnPremProvidersAsync(ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetAvailableStacksOnPremRequest(Id.SubscriptionId, osTypeSelected); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetAvailableStacksOnPremNextPageRequest(nextLink, Id.SubscriptionId, osTypeSelected); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApplicationStackResource.DeserializeApplicationStackResource, ProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableStacksOnPremProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available application frameworks and their versions - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/availableStacks - /// - /// - /// Operation Id - /// Provider_GetAvailableStacksOnPrem - /// - /// - /// - /// The ProviderOSTypeSelected to use. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableStacksOnPremProviders(ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetAvailableStacksOnPremRequest(Id.SubscriptionId, osTypeSelected); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetAvailableStacksOnPremNextPageRequest(nextLink, Id.SubscriptionId, osTypeSelected); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApplicationStackResource.DeserializeApplicationStackResource, ProviderClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAvailableStacksOnPremProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for List all recommendations for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations - /// - /// - /// Operation Id - /// Recommendations_List - /// - /// - /// - /// Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. - /// Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetRecommendationsAsync(bool? featured = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RecommendationsRestClient.CreateListRequest(Id.SubscriptionId, featured, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RecommendationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, featured, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceRecommendation.DeserializeAppServiceRecommendation, RecommendationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRecommendations", "value", "nextLink", cancellationToken); - } - - /// - /// Description for List all recommendations for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations - /// - /// - /// Operation Id - /// Recommendations_List - /// - /// - /// - /// Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. - /// Filter is specified by using OData syntax. Example: $filter=channel eq 'Api' or channel eq 'Notification' and startTime eq 2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq duration'[PT1H|PT1M|P1D]. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetRecommendations(bool? featured = null, string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => RecommendationsRestClient.CreateListRequest(Id.SubscriptionId, featured, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RecommendationsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, featured, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceRecommendation.DeserializeAppServiceRecommendation, RecommendationsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetRecommendations", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Reset all recommendation opt-out settings for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset - /// - /// - /// Operation Id - /// Recommendations_ResetAllFilters - /// - /// - /// - /// The cancellation token to use. - public virtual async Task ResetAllRecommendationFiltersAsync(CancellationToken cancellationToken = default) - { - using var scope = RecommendationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ResetAllRecommendationFilters"); - scope.Start(); - try - { - var response = await RecommendationsRestClient.ResetAllFiltersAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Reset all recommendation opt-out settings for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset - /// - /// - /// Operation Id - /// Recommendations_ResetAllFilters - /// - /// - /// - /// The cancellation token to use. - public virtual Response ResetAllRecommendationFilters(CancellationToken cancellationToken = default) - { - using var scope = RecommendationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.ResetAllRecommendationFilters"); - scope.Start(); - try - { - var response = RecommendationsRestClient.ResetAllFilters(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Disables the specified rule so it will not apply to a subscription in the future. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable - /// - /// - /// Operation Id - /// Recommendations_DisableRecommendationForSubscription - /// - /// - /// - /// Rule name. - /// The cancellation token to use. - public virtual async Task DisableAppServiceRecommendationAsync(string name, CancellationToken cancellationToken = default) - { - using var scope = RecommendationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.DisableAppServiceRecommendation"); - scope.Start(); - try - { - var response = await RecommendationsRestClient.DisableRecommendationForSubscriptionAsync(Id.SubscriptionId, name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Disables the specified rule so it will not apply to a subscription in the future. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable - /// - /// - /// Operation Id - /// Recommendations_DisableRecommendationForSubscription - /// - /// - /// - /// Rule name. - /// The cancellation token to use. - public virtual Response DisableAppServiceRecommendation(string name, CancellationToken cancellationToken = default) - { - using var scope = RecommendationsClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.DisableAppServiceRecommendation"); - scope.Start(); - try - { - var response = RecommendationsRestClient.DisableRecommendationForSubscription(Id.SubscriptionId, name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for List all ResourceHealthMetadata for all sites in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata - /// - /// - /// Operation Id - /// ResourceHealthMetadata_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllResourceHealthMetadataAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceHealthMetadataRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceHealthMetadataRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthMetadataData.DeserializeResourceHealthMetadataData, ResourceHealthMetadataClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllResourceHealthMetadata", "value", "nextLink", cancellationToken); - } - - /// - /// Description for List all ResourceHealthMetadata for all sites in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/resourceHealthMetadata - /// - /// - /// Operation Id - /// ResourceHealthMetadata_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllResourceHealthMetadata(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceHealthMetadataRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceHealthMetadataRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthMetadataData.DeserializeResourceHealthMetadataData, ResourceHealthMetadataClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetAllResourceHealthMetadata", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Gets a list of meters for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters - /// - /// - /// Operation Id - /// ListBillingMeters - /// - /// - /// - /// Azure Location of billable resource. - /// App Service OS type meters used for. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBillingMetersAsync(string billingLocation = null, string osType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListBillingMetersRequest(Id.SubscriptionId, billingLocation, osType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListBillingMetersNextPageRequest(nextLink, Id.SubscriptionId, billingLocation, osType); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceBillingMeter.DeserializeAppServiceBillingMeter, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBillingMeters", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Gets a list of meters for a given location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters - /// - /// - /// Operation Id - /// ListBillingMeters - /// - /// - /// - /// Azure Location of billable resource. - /// App Service OS type meters used for. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBillingMeters(string billingLocation = null, string osType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListBillingMetersRequest(Id.SubscriptionId, billingLocation, osType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListBillingMetersNextPageRequest(nextLink, Id.SubscriptionId, billingLocation, osType); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceBillingMeter.DeserializeAppServiceBillingMeter, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetBillingMeters", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Check if a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// Name availability request. - /// The cancellation token to use. - public virtual async Task> CheckAppServiceNameAvailabilityAsync(ResourceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAppServiceNameAvailability"); - scope.Start(); - try - { - var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Check if a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/checknameavailability - /// - /// - /// Operation Id - /// CheckNameAvailability - /// - /// - /// - /// Name availability request. - /// The cancellation token to use. - public virtual Response CheckAppServiceNameAvailability(ResourceNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckAppServiceNameAvailability"); - scope.Start(); - try - { - var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Gets list of available geo regions plus ministamps - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations - /// - /// - /// Operation Id - /// GetSubscriptionDeploymentLocations - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAppServiceDeploymentLocationsAsync(CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAppServiceDeploymentLocations"); - scope.Start(); - try - { - var response = await DefaultRestClient.GetSubscriptionDeploymentLocationsAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Gets list of available geo regions plus ministamps - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/deploymentLocations - /// - /// - /// Operation Id - /// GetSubscriptionDeploymentLocations - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetAppServiceDeploymentLocations(CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetAppServiceDeploymentLocations"); - scope.Start(); - try - { - var response = DefaultRestClient.GetSubscriptionDeploymentLocations(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Get a list of available geographical regions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions - /// - /// - /// Operation Id - /// ListGeoRegions - /// - /// - /// - /// Name of SKU used to filter the regions. - /// Specify <code>true</code> if you want to filter to only regions that support Linux workers. - /// Specify <code>true</code> if you want to filter to only regions that support Xenon workers. - /// Specify <code>true</code> if you want to filter to only regions that support Linux Consumption Workers. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetGeoRegionsAsync(AppServiceSkuName? sku = null, bool? linuxWorkersEnabled = null, bool? xenonWorkersEnabled = null, bool? linuxDynamicWorkersEnabled = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListGeoRegionsRequest(Id.SubscriptionId, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListGeoRegionsNextPageRequest(nextLink, Id.SubscriptionId, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceGeoRegion.DeserializeAppServiceGeoRegion, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGeoRegions", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get a list of available geographical regions. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/geoRegions - /// - /// - /// Operation Id - /// ListGeoRegions - /// - /// - /// - /// Name of SKU used to filter the regions. - /// Specify <code>true</code> if you want to filter to only regions that support Linux workers. - /// Specify <code>true</code> if you want to filter to only regions that support Xenon workers. - /// Specify <code>true</code> if you want to filter to only regions that support Linux Consumption Workers. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetGeoRegions(AppServiceSkuName? sku = null, bool? linuxWorkersEnabled = null, bool? xenonWorkersEnabled = null, bool? linuxDynamicWorkersEnabled = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListGeoRegionsRequest(Id.SubscriptionId, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListGeoRegionsNextPageRequest(nextLink, Id.SubscriptionId, sku, linuxWorkersEnabled, xenonWorkersEnabled, linuxDynamicWorkersEnabled); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceGeoRegion.DeserializeAppServiceGeoRegion, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetGeoRegions", "value", "nextLink", cancellationToken); - } - - /// - /// Description for List all premier add-on offers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers - /// - /// - /// Operation Id - /// ListPremierAddOnOffers - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPremierAddOnOffersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListPremierAddOnOffersRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListPremierAddOnOffersNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PremierAddOnOffer.DeserializePremierAddOnOffer, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPremierAddOnOffers", "value", "nextLink", cancellationToken); - } - - /// - /// Description for List all premier add-on offers. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers - /// - /// - /// Operation Id - /// ListPremierAddOnOffers - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPremierAddOnOffers(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListPremierAddOnOffersRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListPremierAddOnOffersNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PremierAddOnOffer.DeserializePremierAddOnOffer, DefaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetPremierAddOnOffers", "value", "nextLink", cancellationToken); - } - - /// - /// Description for List all SKUs. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/skus - /// - /// - /// Operation Id - /// ListSkus - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetSkusAsync(CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSkus"); - scope.Start(); - try - { - var response = await DefaultRestClient.ListSkusAsync(Id.SubscriptionId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for List all SKUs. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/skus - /// - /// - /// Operation Id - /// ListSkus - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetSkus(CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetSkus"); - scope.Start(); - try - { - var response = DefaultRestClient.ListSkus(Id.SubscriptionId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet - /// - /// - /// Operation Id - /// VerifyHostingEnvironmentVnet - /// - /// - /// - /// VNET information. - /// The cancellation token to use. - public virtual async Task> VerifyHostingEnvironmentVnetAsync(AppServiceVirtualNetworkValidationContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.VerifyHostingEnvironmentVnet"); - scope.Start(); - try - { - var response = await DefaultRestClient.VerifyHostingEnvironmentVnetAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/verifyHostingEnvironmentVnet - /// - /// - /// Operation Id - /// VerifyHostingEnvironmentVnet - /// - /// - /// - /// VNET information. - /// The cancellation token to use. - public virtual Response VerifyHostingEnvironmentVnet(AppServiceVirtualNetworkValidationContent content, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.VerifyHostingEnvironmentVnet"); - scope.Start(); - try - { - var response = DefaultRestClient.VerifyHostingEnvironmentVnet(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Generates a preview workflow file for the static site - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/previewStaticSiteWorkflowFile - /// - /// - /// Operation Id - /// StaticSites_PreviewWorkflow - /// - /// - /// - /// Location where you plan to create the static site. - /// A JSON representation of the StaticSitesWorkflowPreviewRequest properties. See example. - /// The cancellation token to use. - public virtual async Task> PreviewStaticSiteWorkflowAsync(AzureLocation location, StaticSitesWorkflowPreviewContent content, CancellationToken cancellationToken = default) - { - using var scope = StaticSitesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.PreviewStaticSiteWorkflow"); - scope.Start(); - try - { - var response = await StaticSitesRestClient.PreviewWorkflowAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Generates a preview workflow file for the static site - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/previewStaticSiteWorkflowFile - /// - /// - /// Operation Id - /// StaticSites_PreviewWorkflow - /// - /// - /// - /// Location where you plan to create the static site. - /// A JSON representation of the StaticSitesWorkflowPreviewRequest properties. See example. - /// The cancellation token to use. - public virtual Response PreviewStaticSiteWorkflow(AzureLocation location, StaticSitesWorkflowPreviewContent content, CancellationToken cancellationToken = default) - { - using var scope = StaticSitesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.PreviewStaticSiteWorkflow"); - scope.Start(); - try - { - var response = StaticSitesRestClient.PreviewWorkflow(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Description for Get all Static Sites for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/staticSites - /// - /// - /// Operation Id - /// StaticSites_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStaticSitesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StaticSiteRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StaticSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StaticSiteResource(Client, StaticSiteData.DeserializeStaticSiteData(e)), StaticSiteClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStaticSites", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all Static Sites for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/staticSites - /// - /// - /// Operation Id - /// StaticSites_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStaticSites(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => StaticSiteRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StaticSiteRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StaticSiteResource(Client, StaticSiteData.DeserializeStaticSiteData(e)), StaticSiteClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetStaticSites", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all apps for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/sites - /// - /// - /// Operation Id - /// WebApps_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWebSitesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WebSiteWebAppsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebSiteWebAppsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WebSiteResource(Client, WebSiteData.DeserializeWebSiteData(e)), WebSiteWebAppsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebSites", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get all apps for a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/sites - /// - /// - /// Operation Id - /// WebApps_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWebSites(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => WebSiteWebAppsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WebSiteWebAppsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WebSiteResource(Client, WebSiteData.DeserializeWebSiteData(e)), WebSiteWebAppsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetWebSites", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/TenantResourceExtensionClient.cs deleted file mode 100644 index 8cf7bd48db70e..0000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/TenantResourceExtensionClient.cs +++ /dev/null @@ -1,433 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; - -namespace Azure.ResourceManager.AppService -{ - /// A class to add extension methods to TenantResource. - internal partial class TenantResourceExtensionClient : ArmResource - { - private ClientDiagnostics _certificateRegistrationProviderClientDiagnostics; - private CertificateRegistrationProviderRestOperations _certificateRegistrationProviderRestClient; - private ClientDiagnostics _domainRegistrationProviderClientDiagnostics; - private DomainRegistrationProviderRestOperations _domainRegistrationProviderRestClient; - private ClientDiagnostics _providerClientDiagnostics; - private ProviderRestOperations _providerRestClient; - - /// Initializes a new instance of the class for mocking. - protected TenantResourceExtensionClient() - { - } - - /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics CertificateRegistrationProviderClientDiagnostics => _certificateRegistrationProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private CertificateRegistrationProviderRestOperations CertificateRegistrationProviderRestClient => _certificateRegistrationProviderRestClient ??= new CertificateRegistrationProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics DomainRegistrationProviderClientDiagnostics => _domainRegistrationProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DomainRegistrationProviderRestOperations DomainRegistrationProviderRestClient => _domainRegistrationProviderRestClient ??= new DomainRegistrationProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ProviderClientDiagnostics => _providerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ProviderRestOperations ProviderRestClient => _providerRestClient ??= new ProviderRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets an object representing a PublishingUserResource along with the instance operations that can be performed on it in the TenantResource. - /// Returns a object. - public virtual PublishingUserResource GetPublishingUser() - { - return new PublishingUserResource(Client, Id.AppendProviderResource("Microsoft.Web", "publishingUsers", "web")); - } - - /// Gets a collection of AppServiceSourceControlResources in the TenantResource. - /// An object representing collection of AppServiceSourceControlResources and their operations over a AppServiceSourceControlResource. - public virtual AppServiceSourceControlCollection GetAppServiceSourceControls() - { - return GetCachedClient(Client => new AppServiceSourceControlCollection(Client, Id)); - } - - /// - /// Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider - /// - /// - /// Request Path - /// /providers/Microsoft.CertificateRegistration/operations - /// - /// - /// Operation Id - /// CertificateRegistrationProvider_ListOperations - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationsCertificateRegistrationProvidersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CertificateRegistrationProviderRestClient.CreateListOperationsRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CertificateRegistrationProviderRestClient.CreateListOperationsNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, CertificateRegistrationProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperationsCertificateRegistrationProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider - /// - /// - /// Request Path - /// /providers/Microsoft.CertificateRegistration/operations - /// - /// - /// Operation Id - /// CertificateRegistrationProvider_ListOperations - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationsCertificateRegistrationProviders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CertificateRegistrationProviderRestClient.CreateListOperationsRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CertificateRegistrationProviderRestClient.CreateListOperationsNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, CertificateRegistrationProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperationsCertificateRegistrationProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider - /// - /// - /// Request Path - /// /providers/Microsoft.DomainRegistration/operations - /// - /// - /// Operation Id - /// DomainRegistrationProvider_ListOperations - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationsDomainRegistrationProvidersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DomainRegistrationProviderRestClient.CreateListOperationsRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DomainRegistrationProviderRestClient.CreateListOperationsNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, DomainRegistrationProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperationsDomainRegistrationProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider - /// - /// - /// Request Path - /// /providers/Microsoft.DomainRegistration/operations - /// - /// - /// Operation Id - /// DomainRegistrationProvider_ListOperations - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationsDomainRegistrationProviders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => DomainRegistrationProviderRestClient.CreateListOperationsRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DomainRegistrationProviderRestClient.CreateListOperationsNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, DomainRegistrationProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperationsDomainRegistrationProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available application frameworks and their versions - /// - /// - /// Request Path - /// /providers/Microsoft.Web/availableStacks - /// - /// - /// Operation Id - /// Provider_GetAvailableStacks - /// - /// - /// - /// The ProviderOSTypeSelected to use. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAvailableStacksProvidersAsync(ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetAvailableStacksRequest(osTypeSelected); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetAvailableStacksNextPageRequest(nextLink, osTypeSelected); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ApplicationStackResource.DeserializeApplicationStackResource, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetAvailableStacksProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available application frameworks and their versions - /// - /// - /// Request Path - /// /providers/Microsoft.Web/availableStacks - /// - /// - /// Operation Id - /// Provider_GetAvailableStacks - /// - /// - /// - /// The ProviderOSTypeSelected to use. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAvailableStacksProviders(ProviderOSTypeSelected? osTypeSelected = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetAvailableStacksRequest(osTypeSelected); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetAvailableStacksNextPageRequest(nextLink, osTypeSelected); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ApplicationStackResource.DeserializeApplicationStackResource, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetAvailableStacksProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available Function app frameworks and their versions - /// - /// - /// Request Path - /// /providers/Microsoft.Web/functionAppStacks - /// - /// - /// Operation Id - /// Provider_GetFunctionAppStacks - /// - /// - /// - /// Stack OS Type. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetFunctionAppStacksProvidersAsync(ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetFunctionAppStacksRequest(stackOSType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetFunctionAppStacksNextPageRequest(nextLink, stackOSType); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, FunctionAppStack.DeserializeFunctionAppStack, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetFunctionAppStacksProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available Function app frameworks and their versions - /// - /// - /// Request Path - /// /providers/Microsoft.Web/functionAppStacks - /// - /// - /// Operation Id - /// Provider_GetFunctionAppStacks - /// - /// - /// - /// Stack OS Type. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetFunctionAppStacksProviders(ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetFunctionAppStacksRequest(stackOSType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetFunctionAppStacksNextPageRequest(nextLink, stackOSType); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, FunctionAppStack.DeserializeFunctionAppStack, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetFunctionAppStacksProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available Function app frameworks and their versions for location - /// - /// - /// Request Path - /// /providers/Microsoft.Web/locations/{location}/functionAppStacks - /// - /// - /// Operation Id - /// Provider_GetFunctionAppStacksForLocation - /// - /// - /// - /// Function App stack location. - /// Stack OS Type. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetFunctionAppStacksForLocationProvidersAsync(AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetFunctionAppStacksForLocationRequest(location, stackOSType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetFunctionAppStacksForLocationNextPageRequest(nextLink, location, stackOSType); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, FunctionAppStack.DeserializeFunctionAppStack, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetFunctionAppStacksForLocationProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available Function app frameworks and their versions for location - /// - /// - /// Request Path - /// /providers/Microsoft.Web/locations/{location}/functionAppStacks - /// - /// - /// Operation Id - /// Provider_GetFunctionAppStacksForLocation - /// - /// - /// - /// Function App stack location. - /// Stack OS Type. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetFunctionAppStacksForLocationProviders(AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetFunctionAppStacksForLocationRequest(location, stackOSType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetFunctionAppStacksForLocationNextPageRequest(nextLink, location, stackOSType); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, FunctionAppStack.DeserializeFunctionAppStack, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetFunctionAppStacksForLocationProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available Web app frameworks and their versions for location - /// - /// - /// Request Path - /// /providers/Microsoft.Web/locations/{location}/webAppStacks - /// - /// - /// Operation Id - /// Provider_GetWebAppStacksForLocation - /// - /// - /// - /// Web App stack location. - /// Stack OS Type. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWebAppStacksByLocationAsync(AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetWebAppStacksForLocationRequest(location, stackOSType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetWebAppStacksForLocationNextPageRequest(nextLink, location, stackOSType); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, WebAppStack.DeserializeWebAppStack, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetWebAppStacksByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available Web app frameworks and their versions for location - /// - /// - /// Request Path - /// /providers/Microsoft.Web/locations/{location}/webAppStacks - /// - /// - /// Operation Id - /// Provider_GetWebAppStacksForLocation - /// - /// - /// - /// Web App stack location. - /// Stack OS Type. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWebAppStacksByLocation(AzureLocation location, ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetWebAppStacksForLocationRequest(location, stackOSType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetWebAppStacksForLocationNextPageRequest(nextLink, location, stackOSType); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, WebAppStack.DeserializeWebAppStack, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetWebAppStacksByLocation", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions - /// - /// - /// Request Path - /// /providers/Microsoft.Web/operations - /// - /// - /// Operation Id - /// Provider_ListOperations - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOperationsProvidersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateListOperationsRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateListOperationsNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperationsProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Gets all available operations for the Microsoft.Web resource provider. Also exposes resource metric definitions - /// - /// - /// Request Path - /// /providers/Microsoft.Web/operations - /// - /// - /// Operation Id - /// Provider_ListOperations - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOperationsProviders(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateListOperationsRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateListOperationsNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CsmOperationDescription.DeserializeCsmOperationDescription, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetOperationsProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available Web app frameworks and their versions - /// - /// - /// Request Path - /// /providers/Microsoft.Web/webAppStacks - /// - /// - /// Operation Id - /// Provider_GetWebAppStacks - /// - /// - /// - /// Stack OS Type. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWebAppStacksProvidersAsync(ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetWebAppStacksRequest(stackOSType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetWebAppStacksNextPageRequest(nextLink, stackOSType); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, WebAppStack.DeserializeWebAppStack, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetWebAppStacksProviders", "value", "nextLink", cancellationToken); - } - - /// - /// Description for Get available Web app frameworks and their versions - /// - /// - /// Request Path - /// /providers/Microsoft.Web/webAppStacks - /// - /// - /// Operation Id - /// Provider_GetWebAppStacks - /// - /// - /// - /// Stack OS Type. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWebAppStacksProviders(ProviderStackOSType? stackOSType = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ProviderRestClient.CreateGetWebAppStacksRequest(stackOSType); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ProviderRestClient.CreateGetWebAppStacksNextPageRequest(nextLink, stackOSType); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, WebAppStack.DeserializeWebAppStack, ProviderClientDiagnostics, Pipeline, "TenantResourceExtensionClient.GetWebAppStacksProviders", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorResource.cs index 5aa3bfed24966..58aeafd9c16f3 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class HostingEnvironmentDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The detectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string detectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/detectors/{detectorName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentMultiRolePoolResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentMultiRolePoolResource.cs index 1c57c20a8ede9..465aee22b5dfa 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentMultiRolePoolResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentMultiRolePoolResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.AppService public partial class HostingEnvironmentMultiRolePoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionResource.cs index 14aa1fef98f05..1aab7948f50d9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class HostingEnvironmentPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationResource.cs index fad6e4800ac11..136e2a43d79bc 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class HostingEnvironmentRecommendationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostingEnvironmentName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostingEnvironmentName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{hostingEnvironmentName}/recommendations/{name}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolResource.cs index 81d7202a69eeb..f561ff6908a89 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppService public partial class HostingEnvironmentWorkerPoolResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The workerPoolName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string workerPoolName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitResource.cs index d9c019157e58d..1e6dfb72a9d6c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class HybridConnectionLimitResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentResource.cs index af83a41b86eb3..de4a062c142e6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.AppService public partial class KubeEnvironmentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/kubeEnvironments/{name}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteConfigResource.cs index 2cde80921f06a..171a99a8b39e7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteConfigResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class LogsSiteConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/logs"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteSlotConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteSlotConfigResource.cs index 3a1c4b96605d1..a9f19b6e69371 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteSlotConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteSlotConfigResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class LogsSiteSlotConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/logs"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusResource.cs index e2292598cfab1..c34eb037f4b6d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class MigrateMySqlStatusResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/NetworkFeatureResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/NetworkFeatureResource.cs index 0870251ef1a26..d1e41d06b8c2f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/NetworkFeatureResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/NetworkFeatureResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class NetworkFeatureResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The view. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string view) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkFeatures/{view}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ScmSiteBasicPublishingCredentialsPolicyResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ScmSiteBasicPublishingCredentialsPolicyResource.cs index 4ed414f1160a7..5f040ee15626e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ScmSiteBasicPublishingCredentialsPolicyResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ScmSiteBasicPublishingCredentialsPolicyResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class ScmSiteBasicPublishingCredentialsPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ScmSiteSlotBasicPublishingCredentialsPolicyResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ScmSiteSlotBasicPublishingCredentialsPolicyResource.cs index 21e1d5eaa3759..8f1a857a51d29 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ScmSiteSlotBasicPublishingCredentialsPolicyResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ScmSiteSlotBasicPublishingCredentialsPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class ScmSiteSlotBasicPublishingCredentialsPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/basicPublishingCredentialsPolicies/scm"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteBackupResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteBackupResource.cs index ac3d260ada861..3c900f960d6fa 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteBackupResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteBackupResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteBackupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The backupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string backupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigAppsettingResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigAppsettingResource.cs index 527090d6728eb..0948a2c8784c1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigAppsettingResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigAppsettingResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteConfigAppsettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The appSettingKey. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string appSettingKey) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/appsettings/{appSettingKey}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigSnapshotResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigSnapshotResource.cs index 0d459c60aa476..57dff933f1632 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigSnapshotResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigSnapshotResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteConfigSnapshotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The snapshotId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string snapshotId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web/snapshots/{snapshotId}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDeploymentResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDeploymentResource.cs index cbcee2272b952..b8f6aea784f16 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDeploymentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDeploymentResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string id) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/deployments/{id}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDetectorResource.cs index 6906c904853ad..e44bee05460ac 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDetectorResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The detectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string detectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/detectors/{detectorName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticAnalysisResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticAnalysisResource.cs index 8d61af8b88fda..38af83deaafb7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticAnalysisResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticAnalysisResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteDiagnosticAnalysisResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The diagnosticCategory. + /// The analysisName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string diagnosticCategory, string analysisName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/analyses/{analysisName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticDetectorResource.cs index 818fe5ef72a99..c5c6886f24829 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticDetectorResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteDiagnosticDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The diagnosticCategory. + /// The detectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string diagnosticCategory, string detectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}/detectors/{detectorName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticResource.cs index 83a5ee8749a75..4798b7e759474 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteDiagnosticResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The diagnosticCategory. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string diagnosticCategory) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/diagnostics/{diagnosticCategory}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteDiagnosticAnalysisResources and their operations over a SiteDiagnosticAnalysisResource. public virtual SiteDiagnosticAnalysisCollection GetSiteDiagnosticAnalyses() { - return GetCachedClient(Client => new SiteDiagnosticAnalysisCollection(Client, Id)); + return GetCachedClient(client => new SiteDiagnosticAnalysisCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual SiteDiagnosticAnalysisCollection GetSiteDiagnosticAnalyses() /// /// Analysis Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteDiagnosticAnalysisAsync(string analysisName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetSiteDiagn /// /// Analysis Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteDiagnosticAnalysis(string analysisName, CancellationToken cancellationToken = default) { @@ -143,7 +147,7 @@ public virtual Response GetSiteDiagnosticAnalysi /// An object representing collection of SiteDiagnosticDetectorResources and their operations over a SiteDiagnosticDetectorResource. public virtual SiteDiagnosticDetectorCollection GetSiteDiagnosticDetectors() { - return GetCachedClient(Client => new SiteDiagnosticDetectorCollection(Client, Id)); + return GetCachedClient(client => new SiteDiagnosticDetectorCollection(client, Id)); } /// @@ -161,8 +165,8 @@ public virtual SiteDiagnosticDetectorCollection GetSiteDiagnosticDetectors() /// /// Detector Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteDiagnosticDetectorAsync(string detectorName, CancellationToken cancellationToken = default) { @@ -184,8 +188,8 @@ public virtual async Task> GetSiteDiagn /// /// Detector Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteDiagnosticDetector(string detectorName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDomainOwnershipIdentifierResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDomainOwnershipIdentifierResource.cs index 84ab72bcdd614..0d3f8a3c64710 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDomainOwnershipIdentifierResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDomainOwnershipIdentifierResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteDomainOwnershipIdentifierResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The domainOwnershipIdentifierName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string domainOwnershipIdentifierName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtensionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtensionResource.cs index 5db82c6b8033c..49ae9b85d36e8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtensionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtensionResource.cs @@ -26,6 +26,9 @@ namespace Azure.ResourceManager.AppService public partial class SiteExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteFunctionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteFunctionResource.cs index 9d5042b04dcf5..b4f0a98ea4b99 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteFunctionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteFunctionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteFunctionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The functionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string functionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHostNameBindingResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHostNameBindingResource.cs index fa8dd4e31ed28..236e79b5e5b71 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHostNameBindingResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHostNameBindingResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteHostNameBindingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The hostName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string hostName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hostNameBindings/{hostName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionNamespaceRelayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionNamespaceRelayResource.cs index 72e4a0d56be30..520ea63a5aa57 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionNamespaceRelayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionNamespaceRelayResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteHybridConnectionNamespaceRelayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The namespaceName. + /// The relayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string namespaceName, string relayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtensionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtensionResource.cs index 3e985de370d01..d5b4f0272b90b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtensionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtensionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteInstanceExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The instanceId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string instanceId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessModuleResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessModuleResource.cs index 4b7df59b997a4..e799f3b9e08c4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessModuleResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessModuleResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.AppService public partial class SiteInstanceProcessModuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The instanceId. + /// The processId. + /// The baseAddress. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string instanceId, string processId, string baseAddress) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessResource.cs index 6ab4188a698ac..5b2ae03edc3c6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessResource.cs @@ -28,6 +28,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteInstanceProcessResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The instanceId. + /// The processId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string instanceId, string processId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/processes/{processId}"; @@ -93,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteInstanceProcessModuleResources and their operations over a SiteInstanceProcessModuleResource. public virtual SiteInstanceProcessModuleCollection GetSiteInstanceProcessModules() { - return GetCachedClient(Client => new SiteInstanceProcessModuleCollection(Client, Id)); + return GetCachedClient(client => new SiteInstanceProcessModuleCollection(client, Id)); } /// @@ -111,8 +116,8 @@ public virtual SiteInstanceProcessModuleCollection GetSiteInstanceProcessModules /// /// Module base address. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteInstanceProcessModuleAsync(string baseAddress, CancellationToken cancellationToken = default) { @@ -134,8 +139,8 @@ public virtual async Task> GetSiteIn /// /// Module base address. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteInstanceProcessModule(string baseAddress, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceResource.cs index fad9077a07a30..60895dcf8f70c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The instanceId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string instanceId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}"; @@ -97,7 +101,7 @@ public virtual SiteInstanceExtensionResource GetSiteInstanceExtension() /// An object representing collection of SiteInstanceProcessResources and their operations over a SiteInstanceProcessResource. public virtual SiteInstanceProcessCollection GetSiteInstanceProcesses() { - return GetCachedClient(Client => new SiteInstanceProcessCollection(Client, Id)); + return GetCachedClient(client => new SiteInstanceProcessCollection(client, Id)); } /// @@ -115,8 +119,8 @@ public virtual SiteInstanceProcessCollection GetSiteInstanceProcesses() /// /// PID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteInstanceProcessAsync(string processId, CancellationToken cancellationToken = default) { @@ -138,8 +142,8 @@ public virtual async Task> GetSiteInstance /// /// PID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteInstanceProcess(string processId, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfigResource.cs index ce66ede913eaa..b1c22178ef0d9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfigResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class SiteNetworkConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePrivateEndpointConnectionResource.cs index 9df2be96a2d77..d978620c2d563 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePrivateEndpointConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class SitePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessModuleResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessModuleResource.cs index 97ec75ff3e03b..fe1451b73a50d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessModuleResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessModuleResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteProcessModuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The processId. + /// The baseAddress. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string processId, string baseAddress) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}/modules/{baseAddress}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessResource.cs index af893bff5e451..aea9d2a74bd4b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteProcessResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The processId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string processId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/processes/{processId}"; @@ -93,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteProcessModuleResources and their operations over a SiteProcessModuleResource. public virtual SiteProcessModuleCollection GetSiteProcessModules() { - return GetCachedClient(Client => new SiteProcessModuleCollection(Client, Id)); + return GetCachedClient(client => new SiteProcessModuleCollection(client, Id)); } /// @@ -111,8 +115,8 @@ public virtual SiteProcessModuleCollection GetSiteProcessModules() /// /// Module base address. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteProcessModuleAsync(string baseAddress, CancellationToken cancellationToken = default) { @@ -134,8 +138,8 @@ public virtual async Task> GetSiteProcessMod /// /// Module base address. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteProcessModule(string baseAddress, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePublicCertificateResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePublicCertificateResource.cs index 63a940d41752b..1922035b8fe5d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePublicCertificateResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePublicCertificateResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SitePublicCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The publicCertificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string publicCertificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/publicCertificates/{publicCertificateName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteRecommendationResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteRecommendationResource.cs index e696ab3a3ef20..45de5a3b25ece 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteRecommendationResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteRecommendationResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteRecommendationResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotBackupResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotBackupResource.cs index 25d6b0211623c..b689bd5e5699c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotBackupResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotBackupResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotBackupResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The backupId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string backupId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/backups/{backupId}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigSnapshotResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigSnapshotResource.cs index 428a0e085c93c..ec53739d0b66e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigSnapshotResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigSnapshotResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotConfigSnapshotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The snapshotId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string snapshotId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web/snapshots/{snapshotId}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDeploymentResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDeploymentResource.cs index 46470ed505f0e..2618aad71d78e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDeploymentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDeploymentResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotDeploymentResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string id) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/deployments/{id}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDetectorResource.cs index 9f8bdcc5f4716..ce270b651aa8d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDetectorResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The slot. + /// The detectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string slot, string detectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/detectors/{detectorName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticAnalysisResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticAnalysisResource.cs index 9b096e6abbb82..aa3628d23b332 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticAnalysisResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticAnalysisResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotDiagnosticAnalysisResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The slot. + /// The diagnosticCategory. + /// The analysisName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string slot, string diagnosticCategory, string analysisName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/analyses/{analysisName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticDetectorResource.cs index 397bdc69214d2..e5d3e7a56b5d7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticDetectorResource.cs @@ -26,6 +26,12 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotDiagnosticDetectorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The slot. + /// The diagnosticCategory. + /// The detectorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string slot, string diagnosticCategory, string detectorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}/detectors/{detectorName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticResource.cs index ffe76c7d42cba..03b6e20b09396 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotDiagnosticResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The siteName. + /// The slot. + /// The diagnosticCategory. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string siteName, string slot, string diagnosticCategory) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slot}/diagnostics/{diagnosticCategory}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteSlotDiagnosticAnalysisResources and their operations over a SiteSlotDiagnosticAnalysisResource. public virtual SiteSlotDiagnosticAnalysisCollection GetSiteSlotDiagnosticAnalyses() { - return GetCachedClient(Client => new SiteSlotDiagnosticAnalysisCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotDiagnosticAnalysisCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual SiteSlotDiagnosticAnalysisCollection GetSiteSlotDiagnosticAnalyse /// /// Analysis Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotDiagnosticAnalysisAsync(string analysisName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> GetSiteS /// /// Analysis Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotDiagnosticAnalysis(string analysisName, CancellationToken cancellationToken = default) { @@ -143,7 +148,7 @@ public virtual Response GetSiteSlotDiagnosti /// An object representing collection of SiteSlotDiagnosticDetectorResources and their operations over a SiteSlotDiagnosticDetectorResource. public virtual SiteSlotDiagnosticDetectorCollection GetSiteSlotDiagnosticDetectors() { - return GetCachedClient(Client => new SiteSlotDiagnosticDetectorCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotDiagnosticDetectorCollection(client, Id)); } /// @@ -161,8 +166,8 @@ public virtual SiteSlotDiagnosticDetectorCollection GetSiteSlotDiagnosticDetecto /// /// Detector Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotDiagnosticDetectorAsync(string detectorName, CancellationToken cancellationToken = default) { @@ -184,8 +189,8 @@ public virtual async Task> GetSiteS /// /// Detector Name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotDiagnosticDetector(string detectorName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDomainOwnershipIdentifierResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDomainOwnershipIdentifierResource.cs index 7d8a00f680373..d36d23f713cd7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDomainOwnershipIdentifierResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDomainOwnershipIdentifierResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotDomainOwnershipIdentifierResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The domainOwnershipIdentifierName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string domainOwnershipIdentifierName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/domainOwnershipIdentifiers/{domainOwnershipIdentifierName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtensionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtensionResource.cs index 7d61f655e3ae9..0f417599d9764 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtensionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtensionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotFunctionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotFunctionResource.cs index 71351cf440a47..c029dab803c85 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotFunctionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotFunctionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotFunctionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The functionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string functionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/functions/{functionName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHostNameBindingResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHostNameBindingResource.cs index e0e1a57ed5eb8..3c2db67468103 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHostNameBindingResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHostNameBindingResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotHostNameBindingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The hostName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string hostName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHybridConnectionNamespaceRelayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHybridConnectionNamespaceRelayResource.cs index 447cb633e5534..3c64deae68735 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHybridConnectionNamespaceRelayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotHybridConnectionNamespaceRelayResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotHybridConnectionNamespaceRelayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The namespaceName. + /// The relayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string namespaceName, string relayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtensionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtensionResource.cs index def72e68cb7f3..9465a0c5d77bd 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtensionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtensionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotInstanceExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The instanceId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string instanceId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessModuleResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessModuleResource.cs index 94d53002b5e28..d2d222bb5930b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessModuleResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessModuleResource.cs @@ -25,6 +25,13 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotInstanceProcessModuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The instanceId. + /// The processId. + /// The baseAddress. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string instanceId, string processId, string baseAddress) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}/modules/{baseAddress}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessResource.cs index 482c68c2a3471..c813c09d11b10 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessResource.cs @@ -28,6 +28,12 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotInstanceProcessResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The instanceId. + /// The processId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string instanceId, string processId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/processes/{processId}"; @@ -93,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteSlotInstanceProcessModuleResources and their operations over a SiteSlotInstanceProcessModuleResource. public virtual SiteSlotInstanceProcessModuleCollection GetSiteSlotInstanceProcessModules() { - return GetCachedClient(Client => new SiteSlotInstanceProcessModuleCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotInstanceProcessModuleCollection(client, Id)); } /// @@ -111,8 +117,8 @@ public virtual SiteSlotInstanceProcessModuleCollection GetSiteSlotInstanceProces /// /// Module base address. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotInstanceProcessModuleAsync(string baseAddress, CancellationToken cancellationToken = default) { @@ -134,8 +140,8 @@ public virtual async Task> GetSi /// /// Module base address. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotInstanceProcessModule(string baseAddress, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceResource.cs index d37c9cfc51b42..ca1c348ed07b8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The instanceId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string instanceId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}"; @@ -97,7 +102,7 @@ public virtual SiteSlotInstanceExtensionResource GetSiteSlotInstanceExtension() /// An object representing collection of SiteSlotInstanceProcessResources and their operations over a SiteSlotInstanceProcessResource. public virtual SiteSlotInstanceProcessCollection GetSiteSlotInstanceProcesses() { - return GetCachedClient(Client => new SiteSlotInstanceProcessCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotInstanceProcessCollection(client, Id)); } /// @@ -115,8 +120,8 @@ public virtual SiteSlotInstanceProcessCollection GetSiteSlotInstanceProcesses() /// /// PID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotInstanceProcessAsync(string processId, CancellationToken cancellationToken = default) { @@ -138,8 +143,8 @@ public virtual async Task> GetSiteSlot /// /// PID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotInstanceProcess(string processId, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotNetworkConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotNetworkConfigResource.cs index aab57039ffe15..77bceffac26ac 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotNetworkConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotNetworkConfigResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotNetworkConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/networkConfig/virtualNetwork"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateEndpointConnectionResource.cs index 3d961f7e33558..542c83f6d9b25 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateEndpointConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateEndpointConnectionResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotPrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessModuleResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessModuleResource.cs index dca2a0544414d..1551d90673618 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessModuleResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessModuleResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotProcessModuleResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The processId. + /// The baseAddress. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string processId, string baseAddress) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}/modules/{baseAddress}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessResource.cs index 8ae47c3d5a707..7f267f9157dda 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessResource.cs @@ -28,6 +28,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotProcessResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The processId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string processId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/processes/{processId}"; @@ -93,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteSlotProcessModuleResources and their operations over a SiteSlotProcessModuleResource. public virtual SiteSlotProcessModuleCollection GetSiteSlotProcessModules() { - return GetCachedClient(Client => new SiteSlotProcessModuleCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotProcessModuleCollection(client, Id)); } /// @@ -111,8 +116,8 @@ public virtual SiteSlotProcessModuleCollection GetSiteSlotProcessModules() /// /// Module base address. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotProcessModuleAsync(string baseAddress, CancellationToken cancellationToken = default) { @@ -134,8 +139,8 @@ public virtual async Task> GetSiteSlotPr /// /// Module base address. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotProcessModule(string baseAddress, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionGatewayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionGatewayResource.cs index 4e31cedcb0a72..7bcc93b108dd8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionGatewayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionGatewayResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotVirtualNetworkConnectionGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The vnetName. + /// The gatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string vnetName, string gatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionResource.cs index 90f17472bbf3d..1f020da29acbe 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteSlotVirtualNetworkConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The vnetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string vnetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/virtualNetworkConnections/{vnetName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteSlotVirtualNetworkConnectionGatewayResources and their operations over a SiteSlotVirtualNetworkConnectionGatewayResource. public virtual SiteSlotVirtualNetworkConnectionGatewayCollection GetSiteSlotVirtualNetworkConnectionGateways() { - return GetCachedClient(Client => new SiteSlotVirtualNetworkConnectionGatewayCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotVirtualNetworkConnectionGatewayCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual SiteSlotVirtualNetworkConnectionGatewayCollection GetSiteSlotVirt /// /// Name of the gateway. Currently, the only supported string is "primary". /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotVirtualNetworkConnectionGatewayAsync(string gatewayName, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task /// Name of the gateway. Currently, the only supported string is "primary". /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotVirtualNetworkConnectionGateway(string gatewayName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionGatewayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionGatewayResource.cs index 3c7cb069fefc6..81cfa708223b5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionGatewayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionGatewayResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class SiteVirtualNetworkConnectionGatewayResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The vnetName. + /// The gatewayName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string vnetName, string gatewayName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionResource.cs index 70be53ed33568..9eaf085565d8d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class SiteVirtualNetworkConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The vnetName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string vnetName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/virtualNetworkConnections/{vnetName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteVirtualNetworkConnectionGatewayResources and their operations over a SiteVirtualNetworkConnectionGatewayResource. public virtual SiteVirtualNetworkConnectionGatewayCollection GetSiteVirtualNetworkConnectionGateways() { - return GetCachedClient(Client => new SiteVirtualNetworkConnectionGatewayCollection(Client, Id)); + return GetCachedClient(client => new SiteVirtualNetworkConnectionGatewayCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual SiteVirtualNetworkConnectionGatewayCollection GetSiteVirtualNetwo /// /// Name of the gateway. Currently, the only supported string is "primary". /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteVirtualNetworkConnectionGatewayAsync(string gatewayName, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> /// /// Name of the gateway. Currently, the only supported string is "primary". /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteVirtualNetworkConnectionGateway(string gatewayName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SlotConfigNamesResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SlotConfigNamesResource.cs index f8f53bae98ccb..3be154319eb88 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SlotConfigNamesResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SlotConfigNamesResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class SlotConfigNamesResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildResource.cs index 602fdaff14075..f91e76310bce3 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppService public partial class StaticSiteBuildResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The environmentName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string environmentName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}"; @@ -92,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StaticSiteBuildUserProvidedFunctionAppResources and their operations over a StaticSiteBuildUserProvidedFunctionAppResource. public virtual StaticSiteBuildUserProvidedFunctionAppCollection GetStaticSiteBuildUserProvidedFunctionApps() { - return GetCachedClient(Client => new StaticSiteBuildUserProvidedFunctionAppCollection(Client, Id)); + return GetCachedClient(client => new StaticSiteBuildUserProvidedFunctionAppCollection(client, Id)); } /// @@ -110,8 +114,8 @@ public virtual StaticSiteBuildUserProvidedFunctionAppCollection GetStaticSiteBui /// /// Name of the function app registered with the static site build. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStaticSiteBuildUserProvidedFunctionAppAsync(string functionAppName, CancellationToken cancellationToken = default) { @@ -133,8 +137,8 @@ public virtual async Task /// Name of the function app registered with the static site build. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStaticSiteBuildUserProvidedFunctionApp(string functionAppName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildUserProvidedFunctionAppResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildUserProvidedFunctionAppResource.cs index dbb98f650a732..0710af66fc338 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildUserProvidedFunctionAppResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildUserProvidedFunctionAppResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class StaticSiteBuildUserProvidedFunctionAppResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The environmentName. + /// The functionAppName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string environmentName, string functionAppName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/builds/{environmentName}/userProvidedFunctionApps/{functionAppName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCustomDomainOverviewResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCustomDomainOverviewResource.cs index 898f16333b3a7..cccae63e4f610 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCustomDomainOverviewResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteCustomDomainOverviewResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class StaticSiteCustomDomainOverviewResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The domainName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string domainName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSitePrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSitePrivateEndpointConnectionResource.cs index d302505075aed..f0f667033729b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSitePrivateEndpointConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSitePrivateEndpointConnectionResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class StaticSitePrivateEndpointConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The privateEndpointConnectionName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/privateEndpointConnections/{privateEndpointConnectionName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteResource.cs index 24ab5e43332ca..adcdd89c7fe11 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteResource.cs @@ -28,6 +28,9 @@ namespace Azure.ResourceManager.AppService public partial class StaticSiteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}"; @@ -93,7 +96,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of StaticSitePrivateEndpointConnectionResources and their operations over a StaticSitePrivateEndpointConnectionResource. public virtual StaticSitePrivateEndpointConnectionCollection GetStaticSitePrivateEndpointConnections() { - return GetCachedClient(Client => new StaticSitePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new StaticSitePrivateEndpointConnectionCollection(client, Id)); } /// @@ -111,8 +114,8 @@ public virtual StaticSitePrivateEndpointConnectionCollection GetStaticSitePrivat /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStaticSitePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -134,8 +137,8 @@ public virtual async Task> /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStaticSitePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -146,7 +149,7 @@ public virtual Response GetStaticSi /// An object representing collection of StaticSiteBuildResources and their operations over a StaticSiteBuildResource. public virtual StaticSiteBuildCollection GetStaticSiteBuilds() { - return GetCachedClient(Client => new StaticSiteBuildCollection(Client, Id)); + return GetCachedClient(client => new StaticSiteBuildCollection(client, Id)); } /// @@ -164,8 +167,8 @@ public virtual StaticSiteBuildCollection GetStaticSiteBuilds() /// /// The stage site identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStaticSiteBuildAsync(string environmentName, CancellationToken cancellationToken = default) { @@ -187,8 +190,8 @@ public virtual async Task> GetStaticSiteBuildA /// /// The stage site identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStaticSiteBuild(string environmentName, CancellationToken cancellationToken = default) { @@ -199,7 +202,7 @@ public virtual Response GetStaticSiteBuild(string envir /// An object representing collection of StaticSiteUserProvidedFunctionAppResources and their operations over a StaticSiteUserProvidedFunctionAppResource. public virtual StaticSiteUserProvidedFunctionAppCollection GetStaticSiteUserProvidedFunctionApps() { - return GetCachedClient(Client => new StaticSiteUserProvidedFunctionAppCollection(Client, Id)); + return GetCachedClient(client => new StaticSiteUserProvidedFunctionAppCollection(client, Id)); } /// @@ -217,8 +220,8 @@ public virtual StaticSiteUserProvidedFunctionAppCollection GetStaticSiteUserProv /// /// Name of the function app registered with the static site. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStaticSiteUserProvidedFunctionAppAsync(string functionAppName, CancellationToken cancellationToken = default) { @@ -240,8 +243,8 @@ public virtual async Task> G /// /// Name of the function app registered with the static site. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStaticSiteUserProvidedFunctionApp(string functionAppName, CancellationToken cancellationToken = default) { @@ -252,7 +255,7 @@ public virtual Response GetStaticSite /// An object representing collection of StaticSiteCustomDomainOverviewResources and their operations over a StaticSiteCustomDomainOverviewResource. public virtual StaticSiteCustomDomainOverviewCollection GetStaticSiteCustomDomainOverviews() { - return GetCachedClient(Client => new StaticSiteCustomDomainOverviewCollection(Client, Id)); + return GetCachedClient(client => new StaticSiteCustomDomainOverviewCollection(client, Id)); } /// @@ -270,8 +273,8 @@ public virtual StaticSiteCustomDomainOverviewCollection GetStaticSiteCustomDomai /// /// The custom domain name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetStaticSiteCustomDomainOverviewAsync(string domainName, CancellationToken cancellationToken = default) { @@ -293,8 +296,8 @@ public virtual async Task> GetS /// /// The custom domain name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetStaticSiteCustomDomainOverview(string domainName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteUserProvidedFunctionAppResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteUserProvidedFunctionAppResource.cs index 005466936cbdf..f0ca312d3225e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteUserProvidedFunctionAppResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteUserProvidedFunctionAppResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class StaticSiteUserProvidedFunctionAppResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The functionAppName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string functionAppName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/userProvidedFunctionApps/{functionAppName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/TopLevelDomainResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/TopLevelDomainResource.cs index 7bdbf5f046405..ab59affa28996 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/TopLevelDomainResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/TopLevelDomainResource.cs @@ -28,6 +28,8 @@ namespace Azure.ResourceManager.AppService public partial class TopLevelDomainResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string name) { var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigConnectionStringResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigConnectionStringResource.cs index 78dfddda2b6df..1fcad48317578 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigConnectionStringResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigConnectionStringResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteConfigConnectionStringResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The connectionStringKey. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string connectionStringKey) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigResource.cs index e4423518ae4c8..c24e0a3b0a115 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigResource.cs @@ -27,6 +27,9 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web"; @@ -97,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteConfigSnapshotResources and their operations over a SiteConfigSnapshotResource. public virtual SiteConfigSnapshotCollection GetSiteConfigSnapshots() { - return GetCachedClient(Client => new SiteConfigSnapshotCollection(Client, Id)); + return GetCachedClient(client => new SiteConfigSnapshotCollection(client, Id)); } /// @@ -115,8 +118,8 @@ public virtual SiteConfigSnapshotCollection GetSiteConfigSnapshots() /// /// The ID of the snapshot to read. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteConfigSnapshotAsync(string snapshotId, CancellationToken cancellationToken = default) { @@ -138,8 +141,8 @@ public virtual async Task> GetSiteConfigSna /// /// The ID of the snapshot to read. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteConfigSnapshot(string snapshotId, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteContinuousWebJobResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteContinuousWebJobResource.cs index 19f05fc3d1dd0..26d45dd25f507 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteContinuousWebJobResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteContinuousWebJobResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteContinuousWebJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The webJobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string webJobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteExtensionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteExtensionResource.cs index 5d8de993aca0a..098e14390beb5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteExtensionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteExtensionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The siteExtensionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string siteExtensionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/siteextensions/{siteExtensionId}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteFtpPublishingCredentialsPolicyResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteFtpPublishingCredentialsPolicyResource.cs index 5d2ec6a635f10..0607a7ef31727 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteFtpPublishingCredentialsPolicyResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteFtpPublishingCredentialsPolicyResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteFtpPublishingCredentialsPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteHybridConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteHybridConnectionResource.cs index 31ae005ebbf34..650ebc54c289a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteHybridConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteHybridConnectionResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteHybridConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The entityName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string entityName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePremierAddonResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePremierAddonResource.cs index 85adeb7cf16db..fb0576283f145 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePremierAddonResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePremierAddonResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSitePremierAddonResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The premierAddOnName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string premierAddOnName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePrivateAccessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePrivateAccessResource.cs index 50bcc658e835f..66d72f1310789 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePrivateAccessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSitePrivateAccessResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class WebSitePrivateAccessResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/privateAccess/virtualNetworks"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs index 31ef4b70e113f..a8677448f6e61 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs @@ -30,6 +30,9 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}"; @@ -104,7 +107,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteDetectorResources and their operations over a SiteDetectorResource. public virtual SiteDetectorCollection GetSiteDetectors() { - return GetCachedClient(Client => new SiteDetectorCollection(Client, Id)); + return GetCachedClient(client => new SiteDetectorCollection(client, Id)); } /// @@ -125,8 +128,8 @@ public virtual SiteDetectorCollection GetSiteDetectors() /// End Time. /// Time Grain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteDetectorAsync(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) { @@ -151,8 +154,8 @@ public virtual async Task> GetSiteDetectorAsync(s /// End Time. /// Time Grain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteDetector(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) { @@ -163,7 +166,7 @@ public virtual Response GetSiteDetector(string detectorNam /// An object representing collection of SitePrivateEndpointConnectionResources and their operations over a SitePrivateEndpointConnectionResource. public virtual SitePrivateEndpointConnectionCollection GetSitePrivateEndpointConnections() { - return GetCachedClient(Client => new SitePrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new SitePrivateEndpointConnectionCollection(client, Id)); } /// @@ -181,8 +184,8 @@ public virtual SitePrivateEndpointConnectionCollection GetSitePrivateEndpointCon /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSitePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -204,8 +207,8 @@ public virtual async Task> GetSi /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSitePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -216,7 +219,7 @@ public virtual Response GetSitePrivateEnd /// An object representing collection of SiteHybridConnectionNamespaceRelayResources and their operations over a SiteHybridConnectionNamespaceRelayResource. public virtual SiteHybridConnectionNamespaceRelayCollection GetSiteHybridConnectionNamespaceRelays() { - return GetCachedClient(Client => new SiteHybridConnectionNamespaceRelayCollection(Client, Id)); + return GetCachedClient(client => new SiteHybridConnectionNamespaceRelayCollection(client, Id)); } /// @@ -235,8 +238,8 @@ public virtual SiteHybridConnectionNamespaceRelayCollection GetSiteHybridConnect /// The namespace for this hybrid connection. /// The relay name for this hybrid connection. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteHybridConnectionNamespaceRelayAsync(string namespaceName, string relayName, CancellationToken cancellationToken = default) { @@ -259,8 +262,8 @@ public virtual async Task> /// The namespace for this hybrid connection. /// The relay name for this hybrid connection. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteHybridConnectionNamespaceRelay(string namespaceName, string relayName, CancellationToken cancellationToken = default) { @@ -271,7 +274,7 @@ public virtual Response GetSiteHybri /// An object representing collection of SiteVirtualNetworkConnectionResources and their operations over a SiteVirtualNetworkConnectionResource. public virtual SiteVirtualNetworkConnectionCollection GetSiteVirtualNetworkConnections() { - return GetCachedClient(Client => new SiteVirtualNetworkConnectionCollection(Client, Id)); + return GetCachedClient(client => new SiteVirtualNetworkConnectionCollection(client, Id)); } /// @@ -289,8 +292,8 @@ public virtual SiteVirtualNetworkConnectionCollection GetSiteVirtualNetworkConne /// /// Name of the virtual network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteVirtualNetworkConnectionAsync(string vnetName, CancellationToken cancellationToken = default) { @@ -312,8 +315,8 @@ public virtual async Task> GetSit /// /// Name of the virtual network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteVirtualNetworkConnection(string vnetName, CancellationToken cancellationToken = default) { @@ -324,7 +327,7 @@ public virtual Response GetSiteVirtualNetw /// An object representing collection of SiteDiagnosticResources and their operations over a SiteDiagnosticResource. public virtual SiteDiagnosticCollection GetSiteDiagnostics() { - return GetCachedClient(Client => new SiteDiagnosticCollection(Client, Id)); + return GetCachedClient(client => new SiteDiagnosticCollection(client, Id)); } /// @@ -342,8 +345,8 @@ public virtual SiteDiagnosticCollection GetSiteDiagnostics() /// /// Diagnostic Category. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteDiagnosticAsync(string diagnosticCategory, CancellationToken cancellationToken = default) { @@ -365,8 +368,8 @@ public virtual async Task> GetSiteDiagnosticAsy /// /// Diagnostic Category. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteDiagnostic(string diagnosticCategory, CancellationToken cancellationToken = default) { @@ -377,7 +380,7 @@ public virtual Response GetSiteDiagnostic(string diagnos /// An object representing collection of SiteRecommendationResources and their operations over a SiteRecommendationResource. public virtual SiteRecommendationCollection GetSiteRecommendations() { - return GetCachedClient(Client => new SiteRecommendationCollection(Client, Id)); + return GetCachedClient(client => new SiteRecommendationCollection(client, Id)); } /// @@ -397,8 +400,8 @@ public virtual SiteRecommendationCollection GetSiteRecommendations() /// Specify <code>true</code> to update the last-seen timestamp of the recommendation object. /// The GUID of the recommendation object if you query an expired one. You don't need to specify it to query an active entry. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteRecommendationAsync(string name, bool? updateSeen = null, string recommendationId = null, CancellationToken cancellationToken = default) { @@ -422,8 +425,8 @@ public virtual async Task> GetSiteRecommend /// Specify <code>true</code> to update the last-seen timestamp of the recommendation object. /// The GUID of the recommendation object if you query an expired one. You don't need to specify it to query an active entry. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteRecommendation(string name, bool? updateSeen = null, string recommendationId = null, CancellationToken cancellationToken = default) { @@ -441,7 +444,7 @@ public virtual WebSiteResourceHealthMetadataResource GetWebSiteResourceHealthMet /// An object representing collection of WebSiteSlotResources and their operations over a WebSiteSlotResource. public virtual WebSiteSlotCollection GetWebSiteSlots() { - return GetCachedClient(Client => new WebSiteSlotCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotCollection(client, Id)); } /// @@ -459,8 +462,8 @@ public virtual WebSiteSlotCollection GetWebSiteSlots() /// /// Name of the deployment slot. By default, this API returns the production slot. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotAsync(string slot, CancellationToken cancellationToken = default) { @@ -482,8 +485,8 @@ public virtual async Task> GetWebSiteSlotAsync(str /// /// Name of the deployment slot. By default, this API returns the production slot. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlot(string slot, CancellationToken cancellationToken = default) { @@ -494,7 +497,7 @@ public virtual Response GetWebSiteSlot(string slot, Cancell /// An object representing collection of SiteBackupResources and their operations over a SiteBackupResource. public virtual SiteBackupCollection GetSiteBackups() { - return GetCachedClient(Client => new SiteBackupCollection(Client, Id)); + return GetCachedClient(client => new SiteBackupCollection(client, Id)); } /// @@ -512,8 +515,8 @@ public virtual SiteBackupCollection GetSiteBackups() /// /// ID of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteBackupAsync(string backupId, CancellationToken cancellationToken = default) { @@ -535,8 +538,8 @@ public virtual async Task> GetSiteBackupAsync(strin /// /// ID of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteBackup(string backupId, CancellationToken cancellationToken = default) { @@ -561,7 +564,7 @@ public virtual ScmSiteBasicPublishingCredentialsPolicyResource GetScmSiteBasicPu /// An object representing collection of SiteConfigAppsettingResources and their operations over a SiteConfigAppsettingResource. public virtual SiteConfigAppsettingCollection GetSiteConfigAppsettings() { - return GetCachedClient(Client => new SiteConfigAppsettingCollection(Client, Id)); + return GetCachedClient(client => new SiteConfigAppsettingCollection(client, Id)); } /// @@ -579,8 +582,8 @@ public virtual SiteConfigAppsettingCollection GetSiteConfigAppsettings() /// /// App Setting key name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteConfigAppsettingAsync(string appSettingKey, CancellationToken cancellationToken = default) { @@ -602,8 +605,8 @@ public virtual async Task> GetSiteConfigA /// /// App Setting key name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteConfigAppsetting(string appSettingKey, CancellationToken cancellationToken = default) { @@ -614,7 +617,7 @@ public virtual Response GetSiteConfigAppsetting(st /// An object representing collection of WebSiteConfigConnectionStringResources and their operations over a WebSiteConfigConnectionStringResource. public virtual WebSiteConfigConnectionStringCollection GetWebSiteConfigConnectionStrings() { - return GetCachedClient(Client => new WebSiteConfigConnectionStringCollection(Client, Id)); + return GetCachedClient(client => new WebSiteConfigConnectionStringCollection(client, Id)); } /// @@ -632,8 +635,8 @@ public virtual WebSiteConfigConnectionStringCollection GetWebSiteConfigConnectio /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteConfigConnectionStringAsync(string connectionStringKey, CancellationToken cancellationToken = default) { @@ -655,8 +658,8 @@ public virtual async Task> GetWe /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteConfigConnectionString(string connectionStringKey, CancellationToken cancellationToken = default) { @@ -688,7 +691,7 @@ public virtual WebSiteConfigResource GetWebSiteConfig() /// An object representing collection of WebSiteContinuousWebJobResources and their operations over a WebSiteContinuousWebJobResource. public virtual WebSiteContinuousWebJobCollection GetWebSiteContinuousWebJobs() { - return GetCachedClient(Client => new WebSiteContinuousWebJobCollection(Client, Id)); + return GetCachedClient(client => new WebSiteContinuousWebJobCollection(client, Id)); } /// @@ -706,8 +709,8 @@ public virtual WebSiteContinuousWebJobCollection GetWebSiteContinuousWebJobs() /// /// Name of Web Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteContinuousWebJobAsync(string webJobName, CancellationToken cancellationToken = default) { @@ -729,8 +732,8 @@ public virtual async Task> GetWebSiteC /// /// Name of Web Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteContinuousWebJob(string webJobName, CancellationToken cancellationToken = default) { @@ -741,7 +744,7 @@ public virtual Response GetWebSiteContinuousWeb /// An object representing collection of SiteDeploymentResources and their operations over a SiteDeploymentResource. public virtual SiteDeploymentCollection GetSiteDeployments() { - return GetCachedClient(Client => new SiteDeploymentCollection(Client, Id)); + return GetCachedClient(client => new SiteDeploymentCollection(client, Id)); } /// @@ -759,8 +762,8 @@ public virtual SiteDeploymentCollection GetSiteDeployments() /// /// Deployment ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteDeploymentAsync(string id, CancellationToken cancellationToken = default) { @@ -782,8 +785,8 @@ public virtual async Task> GetSiteDeploymentAsy /// /// Deployment ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteDeployment(string id, CancellationToken cancellationToken = default) { @@ -794,7 +797,7 @@ public virtual Response GetSiteDeployment(string id, Can /// An object representing collection of SiteDomainOwnershipIdentifierResources and their operations over a SiteDomainOwnershipIdentifierResource. public virtual SiteDomainOwnershipIdentifierCollection GetSiteDomainOwnershipIdentifiers() { - return GetCachedClient(Client => new SiteDomainOwnershipIdentifierCollection(Client, Id)); + return GetCachedClient(client => new SiteDomainOwnershipIdentifierCollection(client, Id)); } /// @@ -812,8 +815,8 @@ public virtual SiteDomainOwnershipIdentifierCollection GetSiteDomainOwnershipIde /// /// Name of domain ownership identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteDomainOwnershipIdentifierAsync(string domainOwnershipIdentifierName, CancellationToken cancellationToken = default) { @@ -835,8 +838,8 @@ public virtual async Task> GetSi /// /// Name of domain ownership identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteDomainOwnershipIdentifier(string domainOwnershipIdentifierName, CancellationToken cancellationToken = default) { @@ -854,7 +857,7 @@ public virtual SiteExtensionResource GetSiteExtension() /// An object representing collection of SiteFunctionResources and their operations over a SiteFunctionResource. public virtual SiteFunctionCollection GetSiteFunctions() { - return GetCachedClient(Client => new SiteFunctionCollection(Client, Id)); + return GetCachedClient(client => new SiteFunctionCollection(client, Id)); } /// @@ -872,8 +875,8 @@ public virtual SiteFunctionCollection GetSiteFunctions() /// /// Function name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteFunctionAsync(string functionName, CancellationToken cancellationToken = default) { @@ -895,8 +898,8 @@ public virtual async Task> GetSiteFunctionAsync(s /// /// Function name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteFunction(string functionName, CancellationToken cancellationToken = default) { @@ -907,7 +910,7 @@ public virtual Response GetSiteFunction(string functionNam /// An object representing collection of SiteHostNameBindingResources and their operations over a SiteHostNameBindingResource. public virtual SiteHostNameBindingCollection GetSiteHostNameBindings() { - return GetCachedClient(Client => new SiteHostNameBindingCollection(Client, Id)); + return GetCachedClient(client => new SiteHostNameBindingCollection(client, Id)); } /// @@ -925,8 +928,8 @@ public virtual SiteHostNameBindingCollection GetSiteHostNameBindings() /// /// Hostname in the hostname binding. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteHostNameBindingAsync(string hostName, CancellationToken cancellationToken = default) { @@ -948,8 +951,8 @@ public virtual async Task> GetSiteHostName /// /// Hostname in the hostname binding. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteHostNameBinding(string hostName, CancellationToken cancellationToken = default) { @@ -960,7 +963,7 @@ public virtual Response GetSiteHostNameBinding(stri /// An object representing collection of WebSiteHybridConnectionResources and their operations over a WebSiteHybridConnectionResource. public virtual WebSiteHybridConnectionCollection GetWebSiteHybridConnections() { - return GetCachedClient(Client => new WebSiteHybridConnectionCollection(Client, Id)); + return GetCachedClient(client => new WebSiteHybridConnectionCollection(client, Id)); } /// @@ -978,8 +981,8 @@ public virtual WebSiteHybridConnectionCollection GetWebSiteHybridConnections() /// /// Name of the hybrid connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteHybridConnectionAsync(string entityName, CancellationToken cancellationToken = default) { @@ -1001,8 +1004,8 @@ public virtual async Task> GetWebSiteH /// /// Name of the hybrid connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteHybridConnection(string entityName, CancellationToken cancellationToken = default) { @@ -1013,7 +1016,7 @@ public virtual Response GetWebSiteHybridConnect /// An object representing collection of SiteInstanceResources and their operations over a SiteInstanceResource. public virtual SiteInstanceCollection GetSiteInstances() { - return GetCachedClient(Client => new SiteInstanceCollection(Client, Id)); + return GetCachedClient(client => new SiteInstanceCollection(client, Id)); } /// @@ -1031,8 +1034,8 @@ public virtual SiteInstanceCollection GetSiteInstances() /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteInstanceAsync(string instanceId, CancellationToken cancellationToken = default) { @@ -1054,8 +1057,8 @@ public virtual async Task> GetSiteInstanceAsync(s /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteInstance(string instanceId, CancellationToken cancellationToken = default) { @@ -1066,7 +1069,7 @@ public virtual Response GetSiteInstance(string instanceId, /// An object representing collection of SiteProcessResources and their operations over a SiteProcessResource. public virtual SiteProcessCollection GetSiteProcesses() { - return GetCachedClient(Client => new SiteProcessCollection(Client, Id)); + return GetCachedClient(client => new SiteProcessCollection(client, Id)); } /// @@ -1084,8 +1087,8 @@ public virtual SiteProcessCollection GetSiteProcesses() /// /// PID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteProcessAsync(string processId, CancellationToken cancellationToken = default) { @@ -1107,8 +1110,8 @@ public virtual async Task> GetSiteProcessAsync(str /// /// PID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteProcess(string processId, CancellationToken cancellationToken = default) { @@ -1126,7 +1129,7 @@ public virtual SiteNetworkConfigResource GetSiteNetworkConfig() /// An object representing collection of WebSitePremierAddonResources and their operations over a WebSitePremierAddonResource. public virtual WebSitePremierAddonCollection GetWebSitePremierAddons() { - return GetCachedClient(Client => new WebSitePremierAddonCollection(Client, Id)); + return GetCachedClient(client => new WebSitePremierAddonCollection(client, Id)); } /// @@ -1144,8 +1147,8 @@ public virtual WebSitePremierAddonCollection GetWebSitePremierAddons() /// /// Add-on name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSitePremierAddonAsync(string premierAddOnName, CancellationToken cancellationToken = default) { @@ -1167,8 +1170,8 @@ public virtual async Task> GetWebSitePremi /// /// Add-on name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSitePremierAddon(string premierAddOnName, CancellationToken cancellationToken = default) { @@ -1186,7 +1189,7 @@ public virtual WebSitePrivateAccessResource GetWebSitePrivateAccess() /// An object representing collection of SitePublicCertificateResources and their operations over a SitePublicCertificateResource. public virtual SitePublicCertificateCollection GetSitePublicCertificates() { - return GetCachedClient(Client => new SitePublicCertificateCollection(Client, Id)); + return GetCachedClient(client => new SitePublicCertificateCollection(client, Id)); } /// @@ -1204,8 +1207,8 @@ public virtual SitePublicCertificateCollection GetSitePublicCertificates() /// /// Public certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSitePublicCertificateAsync(string publicCertificateName, CancellationToken cancellationToken = default) { @@ -1227,8 +1230,8 @@ public virtual async Task> GetSitePublic /// /// Public certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSitePublicCertificate(string publicCertificateName, CancellationToken cancellationToken = default) { @@ -1239,7 +1242,7 @@ public virtual Response GetSitePublicCertificate( /// An object representing collection of WebSiteExtensionResources and their operations over a WebSiteExtensionResource. public virtual WebSiteExtensionCollection GetWebSiteExtensions() { - return GetCachedClient(Client => new WebSiteExtensionCollection(Client, Id)); + return GetCachedClient(client => new WebSiteExtensionCollection(client, Id)); } /// @@ -1257,8 +1260,8 @@ public virtual WebSiteExtensionCollection GetWebSiteExtensions() /// /// Site extension name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteExtensionAsync(string siteExtensionId, CancellationToken cancellationToken = default) { @@ -1280,8 +1283,8 @@ public virtual async Task> GetWebSiteExtensio /// /// Site extension name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteExtension(string siteExtensionId, CancellationToken cancellationToken = default) { @@ -1299,7 +1302,7 @@ public virtual WebSiteSourceControlResource GetWebSiteSourceControl() /// An object representing collection of WebSiteTriggeredwebJobResources and their operations over a WebSiteTriggeredwebJobResource. public virtual WebSiteTriggeredwebJobCollection GetWebSiteTriggeredwebJobs() { - return GetCachedClient(Client => new WebSiteTriggeredwebJobCollection(Client, Id)); + return GetCachedClient(client => new WebSiteTriggeredwebJobCollection(client, Id)); } /// @@ -1317,8 +1320,8 @@ public virtual WebSiteTriggeredwebJobCollection GetWebSiteTriggeredwebJobs() /// /// Name of Web Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteTriggeredwebJobAsync(string webJobName, CancellationToken cancellationToken = default) { @@ -1340,8 +1343,8 @@ public virtual async Task> GetWebSiteTr /// /// Name of Web Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteTriggeredwebJob(string webJobName, CancellationToken cancellationToken = default) { @@ -1352,7 +1355,7 @@ public virtual Response GetWebSiteTriggeredwebJo /// An object representing collection of WebSiteWebJobResources and their operations over a WebSiteWebJobResource. public virtual WebSiteWebJobCollection GetWebSiteWebJobs() { - return GetCachedClient(Client => new WebSiteWebJobCollection(Client, Id)); + return GetCachedClient(client => new WebSiteWebJobCollection(client, Id)); } /// @@ -1370,8 +1373,8 @@ public virtual WebSiteWebJobCollection GetWebSiteWebJobs() /// /// Name of the web job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteWebJobAsync(string webJobName, CancellationToken cancellationToken = default) { @@ -1393,8 +1396,8 @@ public virtual async Task> GetWebSiteWebJobAsync /// /// Name of the web job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteWebJob(string webJobName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResourceHealthMetadataResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResourceHealthMetadataResource.cs index 1cd7be5603650..2980a40a85cba 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResourceHealthMetadataResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResourceHealthMetadataResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteResourceHealthMetadataResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/resourceHealthMetadata/default"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigAppSettingResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigAppSettingResource.cs index 8037fe4a807fe..b59f822f39b6d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigAppSettingResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigAppSettingResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotConfigAppSettingResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The appSettingKey. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string appSettingKey) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigConnectionStringResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigConnectionStringResource.cs index fb968874fd9eb..1453bc69c0373 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigConnectionStringResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigConnectionStringResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotConfigConnectionStringResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The connectionStringKey. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string connectionStringKey) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigResource.cs index 17426bbe3cafd..37d65499a936b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigResource.cs @@ -27,6 +27,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotConfigResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/web"; @@ -97,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteSlotConfigSnapshotResources and their operations over a SiteSlotConfigSnapshotResource. public virtual SiteSlotConfigSnapshotCollection GetSiteSlotConfigSnapshots() { - return GetCachedClient(Client => new SiteSlotConfigSnapshotCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotConfigSnapshotCollection(client, Id)); } /// @@ -115,8 +119,8 @@ public virtual SiteSlotConfigSnapshotCollection GetSiteSlotConfigSnapshots() /// /// The ID of the snapshot to read. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotConfigSnapshotAsync(string snapshotId, CancellationToken cancellationToken = default) { @@ -138,8 +142,8 @@ public virtual async Task> GetSiteSlotC /// /// The ID of the snapshot to read. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotConfigSnapshot(string snapshotId, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotContinuousWebJobResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotContinuousWebJobResource.cs index 07e471d03c06e..ac1da2b5ece39 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotContinuousWebJobResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotContinuousWebJobResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotContinuousWebJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The webJobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string webJobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotExtensionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotExtensionResource.cs index b3c1c0a74a9ae..84e09b7bfea9f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotExtensionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotExtensionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotExtensionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The siteExtensionId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string siteExtensionId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/siteextensions/{siteExtensionId}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotFtpPublishingCredentialsPolicyResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotFtpPublishingCredentialsPolicyResource.cs index a6d29899c3426..fbf168299a0e0 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotFtpPublishingCredentialsPolicyResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotFtpPublishingCredentialsPolicyResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotFtpPublishingCredentialsPolicyResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/basicPublishingCredentialsPolicies/ftp"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotHybridConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotHybridConnectionResource.cs index 0d3e1c0d94db1..b5758c1dcc095 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotHybridConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotHybridConnectionResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotHybridConnectionResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The entityName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string entityName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hybridconnection/{entityName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPremierAddOnResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPremierAddOnResource.cs index ec6b9d37353fa..7e8b6b8b434fb 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPremierAddOnResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPremierAddOnResource.cs @@ -26,6 +26,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotPremierAddOnResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The premierAddOnName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string premierAddOnName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPrivateAccessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPrivateAccessResource.cs index 34ea2ed65f8ba..46bfa6a641885 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPrivateAccessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPrivateAccessResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotPrivateAccessResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPublicCertificateResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPublicCertificateResource.cs index 4479d3fdbbaa7..ae0cc052e7ea6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPublicCertificateResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotPublicCertificateResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotPublicCertificateResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The publicCertificateName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string publicCertificateName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/publicCertificates/{publicCertificateName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs index 39ecd472b57c4..6ec30888a191c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs @@ -29,6 +29,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}"; @@ -94,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SiteSlotDetectorResources and their operations over a SiteSlotDetectorResource. public virtual SiteSlotDetectorCollection GetSiteSlotDetectors() { - return GetCachedClient(Client => new SiteSlotDetectorCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotDetectorCollection(client, Id)); } /// @@ -115,8 +119,8 @@ public virtual SiteSlotDetectorCollection GetSiteSlotDetectors() /// End Time. /// Time Grain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotDetectorAsync(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) { @@ -141,8 +145,8 @@ public virtual async Task> GetSiteSlotDetecto /// End Time. /// Time Grain. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotDetector(string detectorName, DateTimeOffset? startTime = null, DateTimeOffset? endTime = null, string timeGrain = null, CancellationToken cancellationToken = default) { @@ -153,7 +157,7 @@ public virtual Response GetSiteSlotDetector(string det /// An object representing collection of SiteSlotPrivateEndpointConnectionResources and their operations over a SiteSlotPrivateEndpointConnectionResource. public virtual SiteSlotPrivateEndpointConnectionCollection GetSiteSlotPrivateEndpointConnections() { - return GetCachedClient(Client => new SiteSlotPrivateEndpointConnectionCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotPrivateEndpointConnectionCollection(client, Id)); } /// @@ -171,8 +175,8 @@ public virtual SiteSlotPrivateEndpointConnectionCollection GetSiteSlotPrivateEnd /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -194,8 +198,8 @@ public virtual async Task> G /// /// Name of the private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -206,7 +210,7 @@ public virtual Response GetSiteSlotPr /// An object representing collection of SiteSlotHybridConnectionNamespaceRelayResources and their operations over a SiteSlotHybridConnectionNamespaceRelayResource. public virtual SiteSlotHybridConnectionNamespaceRelayCollection GetSiteSlotHybridConnectionNamespaceRelays() { - return GetCachedClient(Client => new SiteSlotHybridConnectionNamespaceRelayCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotHybridConnectionNamespaceRelayCollection(client, Id)); } /// @@ -225,8 +229,8 @@ public virtual SiteSlotHybridConnectionNamespaceRelayCollection GetSiteSlotHybri /// The namespace for this hybrid connection. /// The relay name for this hybrid connection. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotHybridConnectionNamespaceRelayAsync(string namespaceName, string relayName, CancellationToken cancellationToken = default) { @@ -249,8 +253,8 @@ public virtual async Task The namespace for this hybrid connection. /// The relay name for this hybrid connection. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotHybridConnectionNamespaceRelay(string namespaceName, string relayName, CancellationToken cancellationToken = default) { @@ -261,7 +265,7 @@ public virtual Response GetSiteS /// An object representing collection of SiteSlotVirtualNetworkConnectionResources and their operations over a SiteSlotVirtualNetworkConnectionResource. public virtual SiteSlotVirtualNetworkConnectionCollection GetSiteSlotVirtualNetworkConnections() { - return GetCachedClient(Client => new SiteSlotVirtualNetworkConnectionCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotVirtualNetworkConnectionCollection(client, Id)); } /// @@ -279,8 +283,8 @@ public virtual SiteSlotVirtualNetworkConnectionCollection GetSiteSlotVirtualNetw /// /// Name of the virtual network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotVirtualNetworkConnectionAsync(string vnetName, CancellationToken cancellationToken = default) { @@ -302,8 +306,8 @@ public virtual async Task> Ge /// /// Name of the virtual network. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotVirtualNetworkConnection(string vnetName, CancellationToken cancellationToken = default) { @@ -314,7 +318,7 @@ public virtual Response GetSiteSlotVir /// An object representing collection of SiteSlotDiagnosticResources and their operations over a SiteSlotDiagnosticResource. public virtual SiteSlotDiagnosticCollection GetSiteSlotDiagnostics() { - return GetCachedClient(Client => new SiteSlotDiagnosticCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotDiagnosticCollection(client, Id)); } /// @@ -332,8 +336,8 @@ public virtual SiteSlotDiagnosticCollection GetSiteSlotDiagnostics() /// /// Diagnostic Category. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotDiagnosticAsync(string diagnosticCategory, CancellationToken cancellationToken = default) { @@ -355,8 +359,8 @@ public virtual async Task> GetSiteSlotDiagn /// /// Diagnostic Category. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotDiagnostic(string diagnosticCategory, CancellationToken cancellationToken = default) { @@ -374,7 +378,7 @@ public virtual WebSiteSlotResourceHealthMetadataResource GetWebSiteSlotResourceH /// An object representing collection of SiteSlotBackupResources and their operations over a SiteSlotBackupResource. public virtual SiteSlotBackupCollection GetSiteSlotBackups() { - return GetCachedClient(Client => new SiteSlotBackupCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotBackupCollection(client, Id)); } /// @@ -392,8 +396,8 @@ public virtual SiteSlotBackupCollection GetSiteSlotBackups() /// /// ID of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotBackupAsync(string backupId, CancellationToken cancellationToken = default) { @@ -415,8 +419,8 @@ public virtual async Task> GetSiteSlotBackupAsy /// /// ID of the backup. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotBackup(string backupId, CancellationToken cancellationToken = default) { @@ -441,7 +445,7 @@ public virtual ScmSiteSlotBasicPublishingCredentialsPolicyResource GetScmSiteSlo /// An object representing collection of WebSiteSlotConfigAppSettingResources and their operations over a WebSiteSlotConfigAppSettingResource. public virtual WebSiteSlotConfigAppSettingCollection GetWebSiteSlotConfigAppSettings() { - return GetCachedClient(Client => new WebSiteSlotConfigAppSettingCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotConfigAppSettingCollection(client, Id)); } /// @@ -459,8 +463,8 @@ public virtual WebSiteSlotConfigAppSettingCollection GetWebSiteSlotConfigAppSett /// /// App Setting key name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotConfigAppSettingAsync(string appSettingKey, CancellationToken cancellationToken = default) { @@ -482,8 +486,8 @@ public virtual async Task> GetWebS /// /// App Setting key name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotConfigAppSetting(string appSettingKey, CancellationToken cancellationToken = default) { @@ -494,7 +498,7 @@ public virtual Response GetWebSiteSlotConfi /// An object representing collection of WebSiteSlotConfigConnectionStringResources and their operations over a WebSiteSlotConfigConnectionStringResource. public virtual WebSiteSlotConfigConnectionStringCollection GetWebSiteSlotConfigConnectionStrings() { - return GetCachedClient(Client => new WebSiteSlotConfigConnectionStringCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotConfigConnectionStringCollection(client, Id)); } /// @@ -512,8 +516,8 @@ public virtual WebSiteSlotConfigConnectionStringCollection GetWebSiteSlotConfigC /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotConfigConnectionStringAsync(string connectionStringKey, CancellationToken cancellationToken = default) { @@ -535,8 +539,8 @@ public virtual async Task> G /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotConfigConnectionString(string connectionStringKey, CancellationToken cancellationToken = default) { @@ -561,7 +565,7 @@ public virtual WebSiteSlotConfigResource GetWebSiteSlotConfig() /// An object representing collection of WebSiteSlotContinuousWebJobResources and their operations over a WebSiteSlotContinuousWebJobResource. public virtual WebSiteSlotContinuousWebJobCollection GetWebSiteSlotContinuousWebJobs() { - return GetCachedClient(Client => new WebSiteSlotContinuousWebJobCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotContinuousWebJobCollection(client, Id)); } /// @@ -579,8 +583,8 @@ public virtual WebSiteSlotContinuousWebJobCollection GetWebSiteSlotContinuousWeb /// /// Name of Web Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotContinuousWebJobAsync(string webJobName, CancellationToken cancellationToken = default) { @@ -602,8 +606,8 @@ public virtual async Task> GetWebS /// /// Name of Web Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotContinuousWebJob(string webJobName, CancellationToken cancellationToken = default) { @@ -614,7 +618,7 @@ public virtual Response GetWebSiteSlotConti /// An object representing collection of SiteSlotDeploymentResources and their operations over a SiteSlotDeploymentResource. public virtual SiteSlotDeploymentCollection GetSiteSlotDeployments() { - return GetCachedClient(Client => new SiteSlotDeploymentCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotDeploymentCollection(client, Id)); } /// @@ -632,8 +636,8 @@ public virtual SiteSlotDeploymentCollection GetSiteSlotDeployments() /// /// Deployment ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotDeploymentAsync(string id, CancellationToken cancellationToken = default) { @@ -655,8 +659,8 @@ public virtual async Task> GetSiteSlotDeplo /// /// Deployment ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotDeployment(string id, CancellationToken cancellationToken = default) { @@ -667,7 +671,7 @@ public virtual Response GetSiteSlotDeployment(string /// An object representing collection of SiteSlotDomainOwnershipIdentifierResources and their operations over a SiteSlotDomainOwnershipIdentifierResource. public virtual SiteSlotDomainOwnershipIdentifierCollection GetSiteSlotDomainOwnershipIdentifiers() { - return GetCachedClient(Client => new SiteSlotDomainOwnershipIdentifierCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotDomainOwnershipIdentifierCollection(client, Id)); } /// @@ -685,8 +689,8 @@ public virtual SiteSlotDomainOwnershipIdentifierCollection GetSiteSlotDomainOwne /// /// Name of domain ownership identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotDomainOwnershipIdentifierAsync(string domainOwnershipIdentifierName, CancellationToken cancellationToken = default) { @@ -708,8 +712,8 @@ public virtual async Task> G /// /// Name of domain ownership identifier. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotDomainOwnershipIdentifier(string domainOwnershipIdentifierName, CancellationToken cancellationToken = default) { @@ -727,7 +731,7 @@ public virtual SiteSlotExtensionResource GetSiteSlotExtension() /// An object representing collection of SiteSlotFunctionResources and their operations over a SiteSlotFunctionResource. public virtual SiteSlotFunctionCollection GetSiteSlotFunctions() { - return GetCachedClient(Client => new SiteSlotFunctionCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotFunctionCollection(client, Id)); } /// @@ -745,8 +749,8 @@ public virtual SiteSlotFunctionCollection GetSiteSlotFunctions() /// /// Function name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotFunctionAsync(string functionName, CancellationToken cancellationToken = default) { @@ -768,8 +772,8 @@ public virtual async Task> GetSiteSlotFunctio /// /// Function name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotFunction(string functionName, CancellationToken cancellationToken = default) { @@ -780,7 +784,7 @@ public virtual Response GetSiteSlotFunction(string fun /// An object representing collection of SiteSlotHostNameBindingResources and their operations over a SiteSlotHostNameBindingResource. public virtual SiteSlotHostNameBindingCollection GetSiteSlotHostNameBindings() { - return GetCachedClient(Client => new SiteSlotHostNameBindingCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotHostNameBindingCollection(client, Id)); } /// @@ -798,8 +802,8 @@ public virtual SiteSlotHostNameBindingCollection GetSiteSlotHostNameBindings() /// /// Hostname in the hostname binding. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotHostNameBindingAsync(string hostName, CancellationToken cancellationToken = default) { @@ -821,8 +825,8 @@ public virtual async Task> GetSiteSlot /// /// Hostname in the hostname binding. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotHostNameBinding(string hostName, CancellationToken cancellationToken = default) { @@ -833,7 +837,7 @@ public virtual Response GetSiteSlotHostNameBind /// An object representing collection of WebSiteSlotHybridConnectionResources and their operations over a WebSiteSlotHybridConnectionResource. public virtual WebSiteSlotHybridConnectionCollection GetWebSiteSlotHybridConnections() { - return GetCachedClient(Client => new WebSiteSlotHybridConnectionCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotHybridConnectionCollection(client, Id)); } /// @@ -851,8 +855,8 @@ public virtual WebSiteSlotHybridConnectionCollection GetWebSiteSlotHybridConnect /// /// Name of the hybrid connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotHybridConnectionAsync(string entityName, CancellationToken cancellationToken = default) { @@ -874,8 +878,8 @@ public virtual async Task> GetWebS /// /// Name of the hybrid connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotHybridConnection(string entityName, CancellationToken cancellationToken = default) { @@ -886,7 +890,7 @@ public virtual Response GetWebSiteSlotHybri /// An object representing collection of SiteSlotInstanceResources and their operations over a SiteSlotInstanceResource. public virtual SiteSlotInstanceCollection GetSiteSlotInstances() { - return GetCachedClient(Client => new SiteSlotInstanceCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotInstanceCollection(client, Id)); } /// @@ -904,8 +908,8 @@ public virtual SiteSlotInstanceCollection GetSiteSlotInstances() /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotInstanceAsync(string instanceId, CancellationToken cancellationToken = default) { @@ -927,8 +931,8 @@ public virtual async Task> GetSiteSlotInstanc /// /// The String to use. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotInstance(string instanceId, CancellationToken cancellationToken = default) { @@ -939,7 +943,7 @@ public virtual Response GetSiteSlotInstance(string ins /// An object representing collection of SiteSlotProcessResources and their operations over a SiteSlotProcessResource. public virtual SiteSlotProcessCollection GetSiteSlotProcesses() { - return GetCachedClient(Client => new SiteSlotProcessCollection(Client, Id)); + return GetCachedClient(client => new SiteSlotProcessCollection(client, Id)); } /// @@ -957,8 +961,8 @@ public virtual SiteSlotProcessCollection GetSiteSlotProcesses() /// /// PID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSiteSlotProcessAsync(string processId, CancellationToken cancellationToken = default) { @@ -980,8 +984,8 @@ public virtual async Task> GetSiteSlotProcessA /// /// PID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSiteSlotProcess(string processId, CancellationToken cancellationToken = default) { @@ -999,7 +1003,7 @@ public virtual SiteSlotNetworkConfigResource GetSiteSlotNetworkConfig() /// An object representing collection of WebSiteSlotPremierAddOnResources and their operations over a WebSiteSlotPremierAddOnResource. public virtual WebSiteSlotPremierAddOnCollection GetWebSiteSlotPremierAddOns() { - return GetCachedClient(Client => new WebSiteSlotPremierAddOnCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotPremierAddOnCollection(client, Id)); } /// @@ -1017,8 +1021,8 @@ public virtual WebSiteSlotPremierAddOnCollection GetWebSiteSlotPremierAddOns() /// /// Add-on name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotPremierAddOnAsync(string premierAddOnName, CancellationToken cancellationToken = default) { @@ -1040,8 +1044,8 @@ public virtual async Task> GetWebSiteS /// /// Add-on name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotPremierAddOn(string premierAddOnName, CancellationToken cancellationToken = default) { @@ -1059,7 +1063,7 @@ public virtual WebSiteSlotPrivateAccessResource GetWebSiteSlotPrivateAccess() /// An object representing collection of WebSiteSlotPublicCertificateResources and their operations over a WebSiteSlotPublicCertificateResource. public virtual WebSiteSlotPublicCertificateCollection GetWebSiteSlotPublicCertificates() { - return GetCachedClient(Client => new WebSiteSlotPublicCertificateCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotPublicCertificateCollection(client, Id)); } /// @@ -1077,8 +1081,8 @@ public virtual WebSiteSlotPublicCertificateCollection GetWebSiteSlotPublicCertif /// /// Public certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotPublicCertificateAsync(string publicCertificateName, CancellationToken cancellationToken = default) { @@ -1100,8 +1104,8 @@ public virtual async Task> GetWeb /// /// Public certificate name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotPublicCertificate(string publicCertificateName, CancellationToken cancellationToken = default) { @@ -1112,7 +1116,7 @@ public virtual Response GetWebSiteSlotPubl /// An object representing collection of WebSiteSlotExtensionResources and their operations over a WebSiteSlotExtensionResource. public virtual WebSiteSlotExtensionCollection GetWebSiteSlotExtensions() { - return GetCachedClient(Client => new WebSiteSlotExtensionCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotExtensionCollection(client, Id)); } /// @@ -1130,8 +1134,8 @@ public virtual WebSiteSlotExtensionCollection GetWebSiteSlotExtensions() /// /// Site extension name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotExtensionAsync(string siteExtensionId, CancellationToken cancellationToken = default) { @@ -1153,8 +1157,8 @@ public virtual async Task> GetWebSiteSlot /// /// Site extension name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotExtension(string siteExtensionId, CancellationToken cancellationToken = default) { @@ -1172,7 +1176,7 @@ public virtual MigrateMySqlStatusResource GetMigrateMySqlStatus() /// An object representing collection of NetworkFeatureResources and their operations over a NetworkFeatureResource. public virtual NetworkFeatureCollection GetNetworkFeatures() { - return GetCachedClient(Client => new NetworkFeatureCollection(Client, Id)); + return GetCachedClient(client => new NetworkFeatureCollection(client, Id)); } /// @@ -1190,8 +1194,8 @@ public virtual NetworkFeatureCollection GetNetworkFeatures() /// /// The type of view. Only "summary" is supported at this time. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetNetworkFeatureAsync(string view, CancellationToken cancellationToken = default) { @@ -1213,8 +1217,8 @@ public virtual async Task> GetNetworkFeatureAsy /// /// The type of view. Only "summary" is supported at this time. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetNetworkFeature(string view, CancellationToken cancellationToken = default) { @@ -1232,7 +1236,7 @@ public virtual WebSiteSlotSourceControlResource GetWebSiteSlotSourceControl() /// An object representing collection of WebSiteSlotTriggeredWebJobResources and their operations over a WebSiteSlotTriggeredWebJobResource. public virtual WebSiteSlotTriggeredWebJobCollection GetWebSiteSlotTriggeredWebJobs() { - return GetCachedClient(Client => new WebSiteSlotTriggeredWebJobCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotTriggeredWebJobCollection(client, Id)); } /// @@ -1250,8 +1254,8 @@ public virtual WebSiteSlotTriggeredWebJobCollection GetWebSiteSlotTriggeredWebJo /// /// Name of Web Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotTriggeredWebJobAsync(string webJobName, CancellationToken cancellationToken = default) { @@ -1273,8 +1277,8 @@ public virtual async Task> GetWebSi /// /// Name of Web Job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotTriggeredWebJob(string webJobName, CancellationToken cancellationToken = default) { @@ -1285,7 +1289,7 @@ public virtual Response GetWebSiteSlotTrigge /// An object representing collection of WebSiteSlotWebJobResources and their operations over a WebSiteSlotWebJobResource. public virtual WebSiteSlotWebJobCollection GetWebSiteSlotWebJobs() { - return GetCachedClient(Client => new WebSiteSlotWebJobCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotWebJobCollection(client, Id)); } /// @@ -1303,8 +1307,8 @@ public virtual WebSiteSlotWebJobCollection GetWebSiteSlotWebJobs() /// /// Name of the web job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotWebJobAsync(string webJobName, CancellationToken cancellationToken = default) { @@ -1326,8 +1330,8 @@ public virtual async Task> GetWebSiteSlotWeb /// /// Name of the web job. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotWebJob(string webJobName, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResourceHealthMetadataResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResourceHealthMetadataResource.cs index 1ecc52046085b..a2c643c6f1337 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResourceHealthMetadataResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResourceHealthMetadataResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotResourceHealthMetadataResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/resourceHealthMetadata/default"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotSourceControlResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotSourceControlResource.cs index 80ab2c25cee22..29bbfd5fba25d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotSourceControlResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotSourceControlResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotSourceControlResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobHistoryResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobHistoryResource.cs index 10f3608358454..176bc2cc894b1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobHistoryResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobHistoryResource.cs @@ -25,6 +25,12 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotTriggeredWebJobHistoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The webJobName. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string webJobName, string id) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobResource.cs index fa0ee8f4c2cb5..ce9f0c039a7d6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotTriggeredWebJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The webJobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string webJobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}"; @@ -90,7 +95,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of WebSiteSlotTriggeredWebJobHistoryResources and their operations over a WebSiteSlotTriggeredWebJobHistoryResource. public virtual WebSiteSlotTriggeredWebJobHistoryCollection GetWebSiteSlotTriggeredWebJobHistories() { - return GetCachedClient(Client => new WebSiteSlotTriggeredWebJobHistoryCollection(Client, Id)); + return GetCachedClient(client => new WebSiteSlotTriggeredWebJobHistoryCollection(client, Id)); } /// @@ -108,8 +113,8 @@ public virtual WebSiteSlotTriggeredWebJobHistoryCollection GetWebSiteSlotTrigger /// /// History ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteSlotTriggeredWebJobHistoryAsync(string id, CancellationToken cancellationToken = default) { @@ -131,8 +136,8 @@ public virtual async Task> G /// /// History ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteSlotTriggeredWebJobHistory(string id, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotWebJobResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotWebJobResource.cs index 38c267f880bf4..8438cfa550ab3 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotWebJobResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotWebJobResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSlotWebJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + /// The webJobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot, string webJobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSourceControlResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSourceControlResource.cs index 4379c3f5608dd..5bd6d5b03ad61 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSourceControlResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSourceControlResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteSourceControlResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredWebJobHistoryResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredWebJobHistoryResource.cs index dd1409c9ec6d3..bf174c5b66e11 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredWebJobHistoryResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredWebJobHistoryResource.cs @@ -25,6 +25,11 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteTriggeredWebJobHistoryResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The webJobName. + /// The id. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string webJobName, string id) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id}"; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobResource.cs index 5c32bee20bb06..7d5b2e762fe47 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteTriggeredwebJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The webJobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string webJobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}"; @@ -90,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of WebSiteTriggeredWebJobHistoryResources and their operations over a WebSiteTriggeredWebJobHistoryResource. public virtual WebSiteTriggeredWebJobHistoryCollection GetWebSiteTriggeredWebJobHistories() { - return GetCachedClient(Client => new WebSiteTriggeredWebJobHistoryCollection(Client, Id)); + return GetCachedClient(client => new WebSiteTriggeredWebJobHistoryCollection(client, Id)); } /// @@ -108,8 +112,8 @@ public virtual WebSiteTriggeredWebJobHistoryCollection GetWebSiteTriggeredWebJob /// /// History ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetWebSiteTriggeredWebJobHistoryAsync(string id, CancellationToken cancellationToken = default) { @@ -131,8 +135,8 @@ public virtual async Task> GetWe /// /// History ID. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetWebSiteTriggeredWebJobHistory(string id, CancellationToken cancellationToken = default) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteWebJobResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteWebJobResource.cs index 43a87d5b33304..5c3ee583c3a30 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteWebJobResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteWebJobResource.cs @@ -25,6 +25,10 @@ namespace Azure.ResourceManager.AppService public partial class WebSiteWebJobResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The webJobName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string webJobName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName}"; diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/api/Azure.ResourceManager.WorkloadMonitor.netstandard2.0.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/api/Azure.ResourceManager.WorkloadMonitor.netstandard2.0.cs index 21481d5cdcddd..9ad31e62b3dd8 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/api/Azure.ResourceManager.WorkloadMonitor.netstandard2.0.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/api/Azure.ResourceManager.WorkloadMonitor.netstandard2.0.cs @@ -90,6 +90,22 @@ public static partial class WorkloadMonitorExtensions public static Azure.ResourceManager.WorkloadMonitor.HealthMonitorStateChangeResource GetHealthMonitorStateChangeResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } } +namespace Azure.ResourceManager.WorkloadMonitor.Mocking +{ + public partial class MockableWorkloadMonitorArmClient : Azure.ResourceManager.ArmResource + { + protected MockableWorkloadMonitorArmClient() { } + public virtual Azure.ResourceManager.WorkloadMonitor.HealthMonitorResource GetHealthMonitorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.WorkloadMonitor.HealthMonitorStateChangeResource GetHealthMonitorStateChangeResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableWorkloadMonitorResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableWorkloadMonitorResourceGroupResource() { } + public virtual Azure.Response GetHealthMonitor(string providerName, string resourceCollectionName, string resourceName, string monitorId, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHealthMonitorAsync(string providerName, string resourceCollectionName, string resourceName, string monitorId, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.WorkloadMonitor.HealthMonitorCollection GetHealthMonitors(string providerName, string resourceCollectionName, string resourceName) { throw null; } + } +} namespace Azure.ResourceManager.WorkloadMonitor.Models { public static partial class ArmWorkloadMonitorModelFactory diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/MockableWorkloadMonitorArmClient.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/MockableWorkloadMonitorArmClient.cs new file mode 100644 index 0000000000000..0044a8b739d08 --- /dev/null +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/MockableWorkloadMonitorArmClient.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.WorkloadMonitor; + +namespace Azure.ResourceManager.WorkloadMonitor.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableWorkloadMonitorArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableWorkloadMonitorArmClient() + { + } + + /// 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 MockableWorkloadMonitorArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableWorkloadMonitorArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthMonitorResource GetHealthMonitorResource(ResourceIdentifier id) + { + HealthMonitorResource.ValidateResourceId(id); + return new HealthMonitorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual HealthMonitorStateChangeResource GetHealthMonitorStateChangeResource(ResourceIdentifier id) + { + HealthMonitorStateChangeResource.ValidateResourceId(id); + return new HealthMonitorStateChangeResource(Client, id); + } + } +} diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/MockableWorkloadMonitorResourceGroupResource.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/MockableWorkloadMonitorResourceGroupResource.cs new file mode 100644 index 0000000000000..0044180d56fa2 --- /dev/null +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/MockableWorkloadMonitorResourceGroupResource.cs @@ -0,0 +1,105 @@ +// 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.WorkloadMonitor; + +namespace Azure.ResourceManager.WorkloadMonitor.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableWorkloadMonitorResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableWorkloadMonitorResourceGroupResource() + { + } + + /// 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 MockableWorkloadMonitorResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of HealthMonitorResources in the ResourceGroupResource. + /// The provider name (ex: Microsoft.Compute for virtual machines). + /// The resource collection name (ex: virtualMachines for virtual machines). + /// The name of the virtual machine. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// An object representing collection of HealthMonitorResources and their operations over a HealthMonitorResource. + public virtual HealthMonitorCollection GetHealthMonitors(string providerName, string resourceCollectionName, string resourceName) + { + return new HealthMonitorCollection(Client, Id, providerName, resourceCollectionName, resourceName); + } + + /// + /// Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the monitor's evidence and configuration). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId} + /// + /// + /// Operation Id + /// HealthMonitors_Get + /// + /// + /// + /// The provider name (ex: Microsoft.Compute for virtual machines). + /// The resource collection name (ex: virtualMachines for virtual machines). + /// The name of the virtual machine. + /// The monitor Id of the virtual machine. + /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetHealthMonitorAsync(string providerName, string resourceCollectionName, string resourceName, string monitorId, string expand = null, CancellationToken cancellationToken = default) + { + return await GetHealthMonitors(providerName, resourceCollectionName, resourceName).GetAsync(monitorId, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the monitor's evidence and configuration). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId} + /// + /// + /// Operation Id + /// HealthMonitors_Get + /// + /// + /// + /// The provider name (ex: Microsoft.Compute for virtual machines). + /// The resource collection name (ex: virtualMachines for virtual machines). + /// The name of the virtual machine. + /// The monitor Id of the virtual machine. + /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetHealthMonitor(string providerName, string resourceCollectionName, string resourceName, string monitorId, string expand = null, CancellationToken cancellationToken = default) + { + return GetHealthMonitors(providerName, resourceCollectionName, resourceName).Get(monitorId, expand, cancellationToken); + } + } +} diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 123e4331487e8..0000000000000 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.WorkloadMonitor -{ - /// 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 HealthMonitorResources in the ResourceGroupResource. - /// The provider name (ex: Microsoft.Compute for virtual machines). - /// The resource collection name (ex: virtualMachines for virtual machines). - /// The name of the virtual machine. - /// An object representing collection of HealthMonitorResources and their operations over a HealthMonitorResource. - public virtual HealthMonitorCollection GetHealthMonitors(string providerName, string resourceCollectionName, string resourceName) - { - return new HealthMonitorCollection(Client, Id, providerName, resourceCollectionName, resourceName); - } - } -} diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/WorkloadMonitorExtensions.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/WorkloadMonitorExtensions.cs index f4ca2693506fc..93a5e7946e8c8 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/WorkloadMonitorExtensions.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/Extensions/WorkloadMonitorExtensions.cs @@ -12,80 +12,72 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.WorkloadMonitor.Mocking; namespace Azure.ResourceManager.WorkloadMonitor { /// A class to add extension methods to Azure.ResourceManager.WorkloadMonitor. public static partial class WorkloadMonitorExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableWorkloadMonitorArmClient GetMockableWorkloadMonitorArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableWorkloadMonitorArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableWorkloadMonitorResourceGroupResource GetMockableWorkloadMonitorResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableWorkloadMonitorResourceGroupResource(client, resource.Id)); } - #region HealthMonitorResource + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthMonitorResource GetHealthMonitorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthMonitorResource.ValidateResourceId(id); - return new HealthMonitorResource(client, id); - } - ); + return GetMockableWorkloadMonitorArmClient(client).GetHealthMonitorResource(id); } - #endregion - #region HealthMonitorStateChangeResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static HealthMonitorStateChangeResource GetHealthMonitorStateChangeResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - HealthMonitorStateChangeResource.ValidateResourceId(id); - return new HealthMonitorStateChangeResource(client, id); - } - ); + return GetMockableWorkloadMonitorArmClient(client).GetHealthMonitorStateChangeResource(id); } - #endregion - /// Gets a collection of HealthMonitorResources in the ResourceGroupResource. + /// + /// Gets a collection of HealthMonitorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// The provider name (ex: Microsoft.Compute for virtual machines). /// The resource collection name (ex: virtualMachines for virtual machines). /// The name of the virtual machine. - /// , or is an empty string, and was expected to be non-empty. /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// An object representing collection of HealthMonitorResources and their operations over a HealthMonitorResource. public static HealthMonitorCollection GetHealthMonitors(this ResourceGroupResource resourceGroupResource, string providerName, string resourceCollectionName, string resourceName) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceCollectionName, nameof(resourceCollectionName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetHealthMonitors(providerName, resourceCollectionName, resourceName); + return GetMockableWorkloadMonitorResourceGroupResource(resourceGroupResource).GetHealthMonitors(providerName, resourceCollectionName, resourceName); } /// @@ -100,6 +92,10 @@ public static HealthMonitorCollection GetHealthMonitors(this ResourceGroupResour /// HealthMonitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The provider name (ex: Microsoft.Compute for virtual machines). @@ -108,12 +104,12 @@ public static HealthMonitorCollection GetHealthMonitors(this ResourceGroupResour /// The monitor Id of the virtual machine. /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetHealthMonitorAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceCollectionName, string resourceName, string monitorId, string expand = null, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetHealthMonitors(providerName, resourceCollectionName, resourceName).GetAsync(monitorId, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableWorkloadMonitorResourceGroupResource(resourceGroupResource).GetHealthMonitorAsync(providerName, resourceCollectionName, resourceName, monitorId, expand, cancellationToken).ConfigureAwait(false); } /// @@ -128,6 +124,10 @@ public static async Task> GetHealthMonitorAsync( /// HealthMonitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The provider name (ex: Microsoft.Compute for virtual machines). @@ -136,12 +136,12 @@ public static async Task> GetHealthMonitorAsync( /// The monitor Id of the virtual machine. /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetHealthMonitor(this ResourceGroupResource resourceGroupResource, string providerName, string resourceCollectionName, string resourceName, string monitorId, string expand = null, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetHealthMonitors(providerName, resourceCollectionName, resourceName).Get(monitorId, expand, cancellationToken); + return GetMockableWorkloadMonitorResourceGroupResource(resourceGroupResource).GetHealthMonitor(providerName, resourceCollectionName, resourceName, monitorId, expand, cancellationToken); } } } diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorResource.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorResource.cs index f73d7c4fd9fa6..fcc623a3ad732 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorResource.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorResource.cs @@ -27,6 +27,12 @@ namespace Azure.ResourceManager.WorkloadMonitor public partial class HealthMonitorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The providerName. + /// The resourceCollectionName. + /// The resourceName. + /// The monitorId. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string resourceCollectionName, string resourceName, string monitorId) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}"; @@ -92,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of HealthMonitorStateChangeResources and their operations over a HealthMonitorStateChangeResource. public virtual HealthMonitorStateChangeCollection GetHealthMonitorStateChanges() { - return GetCachedClient(Client => new HealthMonitorStateChangeCollection(Client, Id)); + return GetCachedClient(client => new HealthMonitorStateChangeCollection(client, Id)); } /// @@ -111,8 +117,8 @@ public virtual HealthMonitorStateChangeCollection GetHealthMonitorStateChanges() /// The timestamp of the state change (unix format). /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetHealthMonitorStateChangeAsync(string timestampUnix, string expand = null, CancellationToken cancellationToken = default) { @@ -135,8 +141,8 @@ public virtual async Task> GetHealthM /// The timestamp of the state change (unix format). /// Optionally expand the monitor’s evidence and/or configuration. Example: $expand=evidence,configuration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetHealthMonitorStateChange(string timestampUnix, string expand = null, CancellationToken cancellationToken = default) { diff --git a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorStateChangeResource.cs b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorStateChangeResource.cs index da027313471ce..5de900969a6fe 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorStateChangeResource.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorStateChangeResource.cs @@ -26,6 +26,13 @@ namespace Azure.ResourceManager.WorkloadMonitor public partial class HealthMonitorStateChangeResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The providerName. + /// The resourceCollectionName. + /// The resourceName. + /// The monitorId. + /// The timestampUnix. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string resourceCollectionName, string resourceName, string monitorId, string timestampUnix) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}/history/{timestampUnix}"; diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/api/Azure.ResourceManager.Workloads.netstandard2.0.cs b/sdk/workloads/Azure.ResourceManager.Workloads/api/Azure.ResourceManager.Workloads.netstandard2.0.cs index d6c8b92044e4c..0f11cd7e952aa 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/api/Azure.ResourceManager.Workloads.netstandard2.0.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/api/Azure.ResourceManager.Workloads.netstandard2.0.cs @@ -19,7 +19,7 @@ protected SapApplicationServerInstanceCollection() { } } public partial class SapApplicationServerInstanceData : Azure.ResourceManager.Models.TrackedResourceData { - public SapApplicationServerInstanceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SapApplicationServerInstanceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Workloads.Models.SapVirtualInstanceErrorDetail ErrorsProperties { get { throw null; } } public long? GatewayPort { get { throw null; } } public Azure.ResourceManager.Workloads.Models.SapHealthState? Health { get { throw null; } } @@ -79,7 +79,7 @@ protected SapCentralServerInstanceCollection() { } } public partial class SapCentralServerInstanceData : Azure.ResourceManager.Models.TrackedResourceData { - public SapCentralServerInstanceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SapCentralServerInstanceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Workloads.Models.EnqueueReplicationServerProperties EnqueueReplicationServerProperties { get { throw null; } set { } } public Azure.ResourceManager.Workloads.Models.EnqueueServerProperties EnqueueServerProperties { get { throw null; } set { } } public Azure.ResourceManager.Workloads.Models.SapVirtualInstanceErrorDetail ErrorsProperties { get { throw null; } } @@ -138,7 +138,7 @@ protected SapDatabaseInstanceCollection() { } } public partial class SapDatabaseInstanceData : Azure.ResourceManager.Models.TrackedResourceData { - public SapDatabaseInstanceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SapDatabaseInstanceData(Azure.Core.AzureLocation location) { } public string DatabaseSid { get { throw null; } } public string DatabaseType { get { throw null; } } public Azure.ResourceManager.Workloads.Models.SapVirtualInstanceErrorDetail ErrorsProperties { get { throw null; } } @@ -215,7 +215,7 @@ protected SapMonitorCollection() { } } public partial class SapMonitorData : Azure.ResourceManager.Models.TrackedResourceData { - public SapMonitorData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public SapMonitorData(Azure.Core.AzureLocation location) { } public Azure.Core.AzureLocation? AppLocation { get { throw null; } set { } } public Azure.ResponseError Errors { get { throw null; } } public Azure.ResourceManager.Workloads.Models.UserAssignedServiceIdentity Identity { get { throw null; } set { } } @@ -310,7 +310,7 @@ protected SapVirtualInstanceCollection() { } } public partial class SapVirtualInstanceData : Azure.ResourceManager.Models.TrackedResourceData { - public SapVirtualInstanceData(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapEnvironmentType environment, Azure.ResourceManager.Workloads.Models.SapProductType sapProduct, Azure.ResourceManager.Workloads.Models.SapConfiguration configuration) : base (default(Azure.Core.AzureLocation)) { } + public SapVirtualInstanceData(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapEnvironmentType environment, Azure.ResourceManager.Workloads.Models.SapProductType sapProduct, Azure.ResourceManager.Workloads.Models.SapConfiguration configuration) { } public Azure.ResourceManager.Workloads.Models.SapConfiguration Configuration { get { throw null; } set { } } public Azure.ResourceManager.Workloads.Models.SapEnvironmentType Environment { get { throw null; } set { } } public Azure.ResourceManager.Workloads.Models.SapVirtualInstanceErrorDetail ErrorsProperties { get { throw null; } } @@ -384,6 +384,46 @@ public static partial class WorkloadsExtensions public static System.Threading.Tasks.Task> SapSupportedSkuAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapSupportedSkusContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } +namespace Azure.ResourceManager.Workloads.Mocking +{ + public partial class MockableWorkloadsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableWorkloadsArmClient() { } + public virtual Azure.ResourceManager.Workloads.SapApplicationServerInstanceResource GetSapApplicationServerInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Workloads.SapCentralServerInstanceResource GetSapCentralServerInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Workloads.SapDatabaseInstanceResource GetSapDatabaseInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Workloads.SapLandscapeMonitorResource GetSapLandscapeMonitorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Workloads.SapMonitorResource GetSapMonitorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Workloads.SapProviderInstanceResource GetSapProviderInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Workloads.SapVirtualInstanceResource GetSapVirtualInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableWorkloadsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableWorkloadsResourceGroupResource() { } + public virtual Azure.Response GetSapMonitor(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSapMonitorAsync(string monitorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Workloads.SapMonitorCollection GetSapMonitors() { throw null; } + public virtual Azure.Response GetSapVirtualInstance(string sapVirtualInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSapVirtualInstanceAsync(string sapVirtualInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Workloads.SapVirtualInstanceCollection GetSapVirtualInstances() { throw null; } + } + public partial class MockableWorkloadsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableWorkloadsSubscriptionResource() { } + public virtual Azure.Pageable GetSapMonitors(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSapMonitorsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSapVirtualInstances(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSapVirtualInstancesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SapAvailabilityZoneDetails(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapAvailabilityZoneDetailsContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SapAvailabilityZoneDetailsAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapAvailabilityZoneDetailsContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SapDiskConfigurations(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapDiskConfigurationsContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SapDiskConfigurationsAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapDiskConfigurationsContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SapSizingRecommendations(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapSizingRecommendationContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SapSizingRecommendationsAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapSizingRecommendationContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SapSupportedSku(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapSupportedSkusContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SapSupportedSkuAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.Workloads.Models.SapSupportedSkusContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} namespace Azure.ResourceManager.Workloads.Models { public partial class ApplicationServerConfiguration diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsArmClient.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsArmClient.cs new file mode 100644 index 0000000000000..b9bf16fb4f36c --- /dev/null +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsArmClient.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Workloads; + +namespace Azure.ResourceManager.Workloads.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableWorkloadsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableWorkloadsArmClient() + { + } + + /// 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 MockableWorkloadsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableWorkloadsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SapVirtualInstanceResource GetSapVirtualInstanceResource(ResourceIdentifier id) + { + SapVirtualInstanceResource.ValidateResourceId(id); + return new SapVirtualInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SapCentralServerInstanceResource GetSapCentralServerInstanceResource(ResourceIdentifier id) + { + SapCentralServerInstanceResource.ValidateResourceId(id); + return new SapCentralServerInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SapDatabaseInstanceResource GetSapDatabaseInstanceResource(ResourceIdentifier id) + { + SapDatabaseInstanceResource.ValidateResourceId(id); + return new SapDatabaseInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SapApplicationServerInstanceResource GetSapApplicationServerInstanceResource(ResourceIdentifier id) + { + SapApplicationServerInstanceResource.ValidateResourceId(id); + return new SapApplicationServerInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SapMonitorResource GetSapMonitorResource(ResourceIdentifier id) + { + SapMonitorResource.ValidateResourceId(id); + return new SapMonitorResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SapProviderInstanceResource GetSapProviderInstanceResource(ResourceIdentifier id) + { + SapProviderInstanceResource.ValidateResourceId(id); + return new SapProviderInstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SapLandscapeMonitorResource GetSapLandscapeMonitorResource(ResourceIdentifier id) + { + SapLandscapeMonitorResource.ValidateResourceId(id); + return new SapLandscapeMonitorResource(Client, id); + } + } +} diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsResourceGroupResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsResourceGroupResource.cs new file mode 100644 index 0000000000000..b444d60ad5205 --- /dev/null +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsResourceGroupResource.cs @@ -0,0 +1,145 @@ +// 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.Workloads; + +namespace Azure.ResourceManager.Workloads.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableWorkloadsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableWorkloadsResourceGroupResource() + { + } + + /// 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 MockableWorkloadsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SapVirtualInstanceResources in the ResourceGroupResource. + /// An object representing collection of SapVirtualInstanceResources and their operations over a SapVirtualInstanceResource. + public virtual SapVirtualInstanceCollection GetSapVirtualInstances() + { + return GetCachedClient(client => new SapVirtualInstanceCollection(client, Id)); + } + + /// + /// Gets a Virtual Instance for SAP solutions resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName} + /// + /// + /// Operation Id + /// SAPVirtualInstances_Get + /// + /// + /// + /// The name of the Virtual Instances for SAP solutions resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSapVirtualInstanceAsync(string sapVirtualInstanceName, CancellationToken cancellationToken = default) + { + return await GetSapVirtualInstances().GetAsync(sapVirtualInstanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Virtual Instance for SAP solutions resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName} + /// + /// + /// Operation Id + /// SAPVirtualInstances_Get + /// + /// + /// + /// The name of the Virtual Instances for SAP solutions resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSapVirtualInstance(string sapVirtualInstanceName, CancellationToken cancellationToken = default) + { + return GetSapVirtualInstances().Get(sapVirtualInstanceName, cancellationToken); + } + + /// Gets a collection of SapMonitorResources in the ResourceGroupResource. + /// An object representing collection of SapMonitorResources and their operations over a SapMonitorResource. + public virtual SapMonitorCollection GetSapMonitors() + { + return GetCachedClient(client => new SapMonitorCollection(client, Id)); + } + + /// + /// Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName} + /// + /// + /// Operation Id + /// monitors_Get + /// + /// + /// + /// Name of the SAP monitor resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSapMonitorAsync(string monitorName, CancellationToken cancellationToken = default) + { + return await GetSapMonitors().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName} + /// + /// + /// Operation Id + /// monitors_Get + /// + /// + /// + /// Name of the SAP monitor resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSapMonitor(string monitorName, CancellationToken cancellationToken = default) + { + return GetSapMonitors().Get(monitorName, cancellationToken); + } + } +} diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsSubscriptionResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsSubscriptionResource.cs new file mode 100644 index 0000000000000..f194264aa6199 --- /dev/null +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/MockableWorkloadsSubscriptionResource.cs @@ -0,0 +1,400 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Workloads; +using Azure.ResourceManager.Workloads.Models; + +namespace Azure.ResourceManager.Workloads.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableWorkloadsSubscriptionResource : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private WorkloadsRestOperations _defaultRestClient; + private ClientDiagnostics _sapVirtualInstanceSapVirtualInstancesClientDiagnostics; + private SAPVirtualInstancesRestOperations _sapVirtualInstanceSapVirtualInstancesRestClient; + private ClientDiagnostics _sapMonitormonitorsClientDiagnostics; + private MonitorsRestOperations _sapMonitormonitorsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableWorkloadsSubscriptionResource() + { + } + + /// 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 MockableWorkloadsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Workloads", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private WorkloadsRestOperations DefaultRestClient => _defaultRestClient ??= new WorkloadsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics SapVirtualInstanceSAPVirtualInstancesClientDiagnostics => _sapVirtualInstanceSapVirtualInstancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Workloads", SapVirtualInstanceResource.ResourceType.Namespace, Diagnostics); + private SAPVirtualInstancesRestOperations SapVirtualInstanceSAPVirtualInstancesRestClient => _sapVirtualInstanceSapVirtualInstancesRestClient ??= new SAPVirtualInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SapVirtualInstanceResource.ResourceType)); + private ClientDiagnostics SapMonitormonitorsClientDiagnostics => _sapMonitormonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Workloads", SapMonitorResource.ResourceType.Namespace, Diagnostics); + private MonitorsRestOperations SapMonitormonitorsRestClient => _sapMonitormonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SapMonitorResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Get SAP sizing recommendations by providing input SAPS for application tier and memory required for database tier + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations + /// + /// + /// Operation Id + /// SAPSizingRecommendations + /// + /// + /// + /// The name of Azure region. + /// SAP Sizing Recommendation Request body. + /// The cancellation token to use. + public virtual async Task> SapSizingRecommendationsAsync(AzureLocation location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableWorkloadsSubscriptionResource.SapSizingRecommendations"); + scope.Start(); + try + { + var response = await DefaultRestClient.SapSizingRecommendationsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get SAP sizing recommendations by providing input SAPS for application tier and memory required for database tier + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations + /// + /// + /// Operation Id + /// SAPSizingRecommendations + /// + /// + /// + /// The name of Azure region. + /// SAP Sizing Recommendation Request body. + /// The cancellation token to use. + public virtual Response SapSizingRecommendations(AzureLocation location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableWorkloadsSubscriptionResource.SapSizingRecommendations"); + scope.Start(); + try + { + var response = DefaultRestClient.SapSizingRecommendations(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a list of SAP supported SKUs for ASCS, Application and Database tier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku + /// + /// + /// Operation Id + /// SAPSupportedSku + /// + /// + /// + /// The name of Azure region. + /// SAP Supported SKU Request body. + /// The cancellation token to use. + public virtual async Task> SapSupportedSkuAsync(AzureLocation location, SapSupportedSkusContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableWorkloadsSubscriptionResource.SapSupportedSku"); + scope.Start(); + try + { + var response = await DefaultRestClient.SapSupportedSkuAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a list of SAP supported SKUs for ASCS, Application and Database tier. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku + /// + /// + /// Operation Id + /// SAPSupportedSku + /// + /// + /// + /// The name of Azure region. + /// SAP Supported SKU Request body. + /// The cancellation token to use. + public virtual Response SapSupportedSku(AzureLocation location, SapSupportedSkusContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableWorkloadsSubscriptionResource.SapSupportedSku"); + scope.Start(); + try + { + var response = DefaultRestClient.SapSupportedSku(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the SAP Disk Configuration Layout prod/non-prod SAP System. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations + /// + /// + /// Operation Id + /// SAPDiskConfigurations + /// + /// + /// + /// The name of Azure region. + /// SAP Disk Configurations Request body. + /// The cancellation token to use. + public virtual async Task> SapDiskConfigurationsAsync(AzureLocation location, SapDiskConfigurationsContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableWorkloadsSubscriptionResource.SapDiskConfigurations"); + scope.Start(); + try + { + var response = await DefaultRestClient.SapDiskConfigurationsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the SAP Disk Configuration Layout prod/non-prod SAP System. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations + /// + /// + /// Operation Id + /// SAPDiskConfigurations + /// + /// + /// + /// The name of Azure region. + /// SAP Disk Configurations Request body. + /// The cancellation token to use. + public virtual Response SapDiskConfigurations(AzureLocation location, SapDiskConfigurationsContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableWorkloadsSubscriptionResource.SapDiskConfigurations"); + scope.Start(); + try + { + var response = DefaultRestClient.SapDiskConfigurations(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the recommended SAP Availability Zone Pair Details for your region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails + /// + /// + /// Operation Id + /// SAPAvailabilityZoneDetails + /// + /// + /// + /// The name of Azure region. + /// SAP Availability Zone Details Request body. + /// The cancellation token to use. + public virtual async Task> SapAvailabilityZoneDetailsAsync(AzureLocation location, SapAvailabilityZoneDetailsContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableWorkloadsSubscriptionResource.SapAvailabilityZoneDetails"); + scope.Start(); + try + { + var response = await DefaultRestClient.SapAvailabilityZoneDetailsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the recommended SAP Availability Zone Pair Details for your region. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails + /// + /// + /// Operation Id + /// SAPAvailabilityZoneDetails + /// + /// + /// + /// The name of Azure region. + /// SAP Availability Zone Details Request body. + /// The cancellation token to use. + public virtual Response SapAvailabilityZoneDetails(AzureLocation location, SapAvailabilityZoneDetailsContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("MockableWorkloadsSubscriptionResource.SapAvailabilityZoneDetails"); + scope.Start(); + try + { + var response = DefaultRestClient.SapAvailabilityZoneDetails(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances + /// + /// + /// Operation Id + /// SAPVirtualInstances_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSapVirtualInstancesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SapVirtualInstanceSAPVirtualInstancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SapVirtualInstanceSAPVirtualInstancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SapVirtualInstanceResource(Client, SapVirtualInstanceData.DeserializeSapVirtualInstanceData(e)), SapVirtualInstanceSAPVirtualInstancesClientDiagnostics, Pipeline, "MockableWorkloadsSubscriptionResource.GetSapVirtualInstances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances + /// + /// + /// Operation Id + /// SAPVirtualInstances_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSapVirtualInstances(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SapVirtualInstanceSAPVirtualInstancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SapVirtualInstanceSAPVirtualInstancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SapVirtualInstanceResource(Client, SapVirtualInstanceData.DeserializeSapVirtualInstanceData(e)), SapVirtualInstanceSAPVirtualInstancesClientDiagnostics, Pipeline, "MockableWorkloadsSubscriptionResource.GetSapVirtualInstances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors + /// + /// + /// Operation Id + /// monitors_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSapMonitorsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SapMonitormonitorsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SapMonitormonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SapMonitorResource(Client, SapMonitorData.DeserializeSapMonitorData(e)), SapMonitormonitorsClientDiagnostics, Pipeline, "MockableWorkloadsSubscriptionResource.GetSapMonitors", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors + /// + /// + /// Operation Id + /// monitors_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSapMonitors(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SapMonitormonitorsRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SapMonitormonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SapMonitorResource(Client, SapMonitorData.DeserializeSapMonitorData(e)), SapMonitormonitorsClientDiagnostics, Pipeline, "MockableWorkloadsSubscriptionResource.GetSapMonitors", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs deleted file mode 100644 index 2a4a6b730ed1f..0000000000000 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Workloads -{ - /// 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 SapVirtualInstanceResources in the ResourceGroupResource. - /// An object representing collection of SapVirtualInstanceResources and their operations over a SapVirtualInstanceResource. - public virtual SapVirtualInstanceCollection GetSapVirtualInstances() - { - return GetCachedClient(Client => new SapVirtualInstanceCollection(Client, Id)); - } - - /// Gets a collection of SapMonitorResources in the ResourceGroupResource. - /// An object representing collection of SapMonitorResources and their operations over a SapMonitorResource. - public virtual SapMonitorCollection GetSapMonitors() - { - return GetCachedClient(Client => new SapMonitorCollection(Client, Id)); - } - } -} diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs deleted file mode 100644 index 10ec8a07075a9..0000000000000 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ /dev/null @@ -1,399 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Workloads.Models; - -namespace Azure.ResourceManager.Workloads -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _defaultClientDiagnostics; - private WorkloadsRestOperations _defaultRestClient; - private ClientDiagnostics _sapVirtualInstanceSapVirtualInstancesClientDiagnostics; - private SAPVirtualInstancesRestOperations _sapVirtualInstanceSapVirtualInstancesRestClient; - private ClientDiagnostics _sapMonitormonitorsClientDiagnostics; - private MonitorsRestOperations _sapMonitormonitorsRestClient; - - /// 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 DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Workloads", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private WorkloadsRestOperations DefaultRestClient => _defaultRestClient ??= new WorkloadsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SapVirtualInstanceSAPVirtualInstancesClientDiagnostics => _sapVirtualInstanceSapVirtualInstancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Workloads", SapVirtualInstanceResource.ResourceType.Namespace, Diagnostics); - private SAPVirtualInstancesRestOperations SapVirtualInstanceSAPVirtualInstancesRestClient => _sapVirtualInstanceSapVirtualInstancesRestClient ??= new SAPVirtualInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SapVirtualInstanceResource.ResourceType)); - private ClientDiagnostics SapMonitormonitorsClientDiagnostics => _sapMonitormonitorsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Workloads", SapMonitorResource.ResourceType.Namespace, Diagnostics); - private MonitorsRestOperations SapMonitormonitorsRestClient => _sapMonitormonitorsRestClient ??= new MonitorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SapMonitorResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Get SAP sizing recommendations by providing input SAPS for application tier and memory required for database tier - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations - /// - /// - /// Operation Id - /// SAPSizingRecommendations - /// - /// - /// - /// The name of Azure region. - /// SAP Sizing Recommendation Request body. - /// The cancellation token to use. - public virtual async Task> SapSizingRecommendationsAsync(AzureLocation location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapSizingRecommendations"); - scope.Start(); - try - { - var response = await DefaultRestClient.SapSizingRecommendationsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get SAP sizing recommendations by providing input SAPS for application tier and memory required for database tier - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations - /// - /// - /// Operation Id - /// SAPSizingRecommendations - /// - /// - /// - /// The name of Azure region. - /// SAP Sizing Recommendation Request body. - /// The cancellation token to use. - public virtual Response SapSizingRecommendations(AzureLocation location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapSizingRecommendations"); - scope.Start(); - try - { - var response = DefaultRestClient.SapSizingRecommendations(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a list of SAP supported SKUs for ASCS, Application and Database tier. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku - /// - /// - /// Operation Id - /// SAPSupportedSku - /// - /// - /// - /// The name of Azure region. - /// SAP Supported SKU Request body. - /// The cancellation token to use. - public virtual async Task> SapSupportedSkuAsync(AzureLocation location, SapSupportedSkusContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapSupportedSku"); - scope.Start(); - try - { - var response = await DefaultRestClient.SapSupportedSkuAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a list of SAP supported SKUs for ASCS, Application and Database tier. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku - /// - /// - /// Operation Id - /// SAPSupportedSku - /// - /// - /// - /// The name of Azure region. - /// SAP Supported SKU Request body. - /// The cancellation token to use. - public virtual Response SapSupportedSku(AzureLocation location, SapSupportedSkusContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapSupportedSku"); - scope.Start(); - try - { - var response = DefaultRestClient.SapSupportedSku(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the SAP Disk Configuration Layout prod/non-prod SAP System. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations - /// - /// - /// Operation Id - /// SAPDiskConfigurations - /// - /// - /// - /// The name of Azure region. - /// SAP Disk Configurations Request body. - /// The cancellation token to use. - public virtual async Task> SapDiskConfigurationsAsync(AzureLocation location, SapDiskConfigurationsContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapDiskConfigurations"); - scope.Start(); - try - { - var response = await DefaultRestClient.SapDiskConfigurationsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the SAP Disk Configuration Layout prod/non-prod SAP System. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations - /// - /// - /// Operation Id - /// SAPDiskConfigurations - /// - /// - /// - /// The name of Azure region. - /// SAP Disk Configurations Request body. - /// The cancellation token to use. - public virtual Response SapDiskConfigurations(AzureLocation location, SapDiskConfigurationsContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapDiskConfigurations"); - scope.Start(); - try - { - var response = DefaultRestClient.SapDiskConfigurations(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the recommended SAP Availability Zone Pair Details for your region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails - /// - /// - /// Operation Id - /// SAPAvailabilityZoneDetails - /// - /// - /// - /// The name of Azure region. - /// SAP Availability Zone Details Request body. - /// The cancellation token to use. - public virtual async Task> SapAvailabilityZoneDetailsAsync(AzureLocation location, SapAvailabilityZoneDetailsContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapAvailabilityZoneDetails"); - scope.Start(); - try - { - var response = await DefaultRestClient.SapAvailabilityZoneDetailsAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the recommended SAP Availability Zone Pair Details for your region. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails - /// - /// - /// Operation Id - /// SAPAvailabilityZoneDetails - /// - /// - /// - /// The name of Azure region. - /// SAP Availability Zone Details Request body. - /// The cancellation token to use. - public virtual Response SapAvailabilityZoneDetails(AzureLocation location, SapAvailabilityZoneDetailsContent content = null, CancellationToken cancellationToken = default) - { - using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapAvailabilityZoneDetails"); - scope.Start(); - try - { - var response = DefaultRestClient.SapAvailabilityZoneDetails(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets all Virtual Instances for SAP solutions resources in a Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances - /// - /// - /// Operation Id - /// SAPVirtualInstances_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSapVirtualInstancesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SapVirtualInstanceSAPVirtualInstancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SapVirtualInstanceSAPVirtualInstancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SapVirtualInstanceResource(Client, SapVirtualInstanceData.DeserializeSapVirtualInstanceData(e)), SapVirtualInstanceSAPVirtualInstancesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSapVirtualInstances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets all Virtual Instances for SAP solutions resources in a Subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances - /// - /// - /// Operation Id - /// SAPVirtualInstances_ListBySubscription - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSapVirtualInstances(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SapVirtualInstanceSAPVirtualInstancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SapVirtualInstanceSAPVirtualInstancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SapVirtualInstanceResource(Client, SapVirtualInstanceData.DeserializeSapVirtualInstanceData(e)), SapVirtualInstanceSAPVirtualInstancesClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSapVirtualInstances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors - /// - /// - /// Operation Id - /// monitors_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetSapMonitorsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SapMonitormonitorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SapMonitormonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SapMonitorResource(Client, SapMonitorData.DeserializeSapMonitorData(e)), SapMonitormonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSapMonitors", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors - /// - /// - /// Operation Id - /// monitors_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetSapMonitors(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => SapMonitormonitorsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SapMonitormonitorsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SapMonitorResource(Client, SapMonitorData.DeserializeSapMonitorData(e)), SapMonitormonitorsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetSapMonitors", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/WorkloadsExtensions.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/WorkloadsExtensions.cs index 951403ed3a570..56ca63e21a164 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/WorkloadsExtensions.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/Extensions/WorkloadsExtensions.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Workloads.Mocking; using Azure.ResourceManager.Workloads.Models; namespace Azure.ResourceManager.Workloads @@ -19,176 +20,145 @@ namespace Azure.ResourceManager.Workloads /// A class to add extension methods to Azure.ResourceManager.Workloads. public static partial class WorkloadsExtensions { - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + private static MockableWorkloadsArmClient GetMockableWorkloadsArmClient(ArmClient client) { - return resource.GetCachedClient(client => - { - return new ResourceGroupResourceExtensionClient(client, resource.Id); - }); + return client.GetCachedClient(client0 => new MockableWorkloadsArmClient(client0)); } - private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + private static MockableWorkloadsResourceGroupResource GetMockableWorkloadsResourceGroupResource(ArmResource resource) { - return client.GetResourceClient(() => - { - return new ResourceGroupResourceExtensionClient(client, scope); - }); + return resource.GetCachedClient(client => new MockableWorkloadsResourceGroupResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + private static MockableWorkloadsSubscriptionResource GetMockableWorkloadsSubscriptionResource(ArmResource resource) { - return resource.GetCachedClient(client => - { - return new SubscriptionResourceExtensionClient(client, resource.Id); - }); + return resource.GetCachedClient(client => new MockableWorkloadsSubscriptionResource(client, resource.Id)); } - private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) - { - return client.GetResourceClient(() => - { - return new SubscriptionResourceExtensionClient(client, scope); - }); - } - #region SapVirtualInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SapVirtualInstanceResource GetSapVirtualInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SapVirtualInstanceResource.ValidateResourceId(id); - return new SapVirtualInstanceResource(client, id); - } - ); + return GetMockableWorkloadsArmClient(client).GetSapVirtualInstanceResource(id); } - #endregion - #region SapCentralServerInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SapCentralServerInstanceResource GetSapCentralServerInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SapCentralServerInstanceResource.ValidateResourceId(id); - return new SapCentralServerInstanceResource(client, id); - } - ); + return GetMockableWorkloadsArmClient(client).GetSapCentralServerInstanceResource(id); } - #endregion - #region SapDatabaseInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SapDatabaseInstanceResource GetSapDatabaseInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SapDatabaseInstanceResource.ValidateResourceId(id); - return new SapDatabaseInstanceResource(client, id); - } - ); + return GetMockableWorkloadsArmClient(client).GetSapDatabaseInstanceResource(id); } - #endregion - #region SapApplicationServerInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SapApplicationServerInstanceResource GetSapApplicationServerInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SapApplicationServerInstanceResource.ValidateResourceId(id); - return new SapApplicationServerInstanceResource(client, id); - } - ); + return GetMockableWorkloadsArmClient(client).GetSapApplicationServerInstanceResource(id); } - #endregion - #region SapMonitorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SapMonitorResource GetSapMonitorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SapMonitorResource.ValidateResourceId(id); - return new SapMonitorResource(client, id); - } - ); + return GetMockableWorkloadsArmClient(client).GetSapMonitorResource(id); } - #endregion - #region SapProviderInstanceResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SapProviderInstanceResource GetSapProviderInstanceResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SapProviderInstanceResource.ValidateResourceId(id); - return new SapProviderInstanceResource(client, id); - } - ); + return GetMockableWorkloadsArmClient(client).GetSapProviderInstanceResource(id); } - #endregion - #region SapLandscapeMonitorResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SapLandscapeMonitorResource GetSapLandscapeMonitorResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SapLandscapeMonitorResource.ValidateResourceId(id); - return new SapLandscapeMonitorResource(client, id); - } - ); + return GetMockableWorkloadsArmClient(client).GetSapLandscapeMonitorResource(id); } - #endregion - /// Gets a collection of SapVirtualInstanceResources in the ResourceGroupResource. + /// + /// Gets a collection of SapVirtualInstanceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SapVirtualInstanceResources and their operations over a SapVirtualInstanceResource. public static SapVirtualInstanceCollection GetSapVirtualInstances(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSapVirtualInstances(); + return GetMockableWorkloadsResourceGroupResource(resourceGroupResource).GetSapVirtualInstances(); } /// @@ -203,16 +173,20 @@ public static SapVirtualInstanceCollection GetSapVirtualInstances(this ResourceG /// SAPVirtualInstances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Virtual Instances for SAP solutions resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSapVirtualInstanceAsync(this ResourceGroupResource resourceGroupResource, string sapVirtualInstanceName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSapVirtualInstances().GetAsync(sapVirtualInstanceName, cancellationToken).ConfigureAwait(false); + return await GetMockableWorkloadsResourceGroupResource(resourceGroupResource).GetSapVirtualInstanceAsync(sapVirtualInstanceName, cancellationToken).ConfigureAwait(false); } /// @@ -227,24 +201,34 @@ public static async Task> GetSapVirtualInst /// SAPVirtualInstances_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of the Virtual Instances for SAP solutions resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSapVirtualInstance(this ResourceGroupResource resourceGroupResource, string sapVirtualInstanceName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSapVirtualInstances().Get(sapVirtualInstanceName, cancellationToken); + return GetMockableWorkloadsResourceGroupResource(resourceGroupResource).GetSapVirtualInstance(sapVirtualInstanceName, cancellationToken); } - /// Gets a collection of SapMonitorResources in the ResourceGroupResource. + /// + /// Gets a collection of SapMonitorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SapMonitorResources and their operations over a SapMonitorResource. public static SapMonitorCollection GetSapMonitors(this ResourceGroupResource resourceGroupResource) { - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetSapMonitors(); + return GetMockableWorkloadsResourceGroupResource(resourceGroupResource).GetSapMonitors(); } /// @@ -259,16 +243,20 @@ public static SapMonitorCollection GetSapMonitors(this ResourceGroupResource res /// monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the SAP monitor resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static async Task> GetSapMonitorAsync(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetSapMonitors().GetAsync(monitorName, cancellationToken).ConfigureAwait(false); + return await GetMockableWorkloadsResourceGroupResource(resourceGroupResource).GetSapMonitorAsync(monitorName, cancellationToken).ConfigureAwait(false); } /// @@ -283,16 +271,20 @@ public static async Task> GetSapMonitorAsync(this R /// monitors_Get /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Name of the SAP monitor resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public static Response GetSapMonitor(this ResourceGroupResource resourceGroupResource, string monitorName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetSapMonitors().Get(monitorName, cancellationToken); + return GetMockableWorkloadsResourceGroupResource(resourceGroupResource).GetSapMonitor(monitorName, cancellationToken); } /// @@ -307,6 +299,10 @@ public static Response GetSapMonitor(this ResourceGroupResou /// SAPSizingRecommendations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -314,7 +310,7 @@ public static Response GetSapMonitor(this ResourceGroupResou /// The cancellation token to use. public static async Task> SapSizingRecommendationsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).SapSizingRecommendationsAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableWorkloadsSubscriptionResource(subscriptionResource).SapSizingRecommendationsAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -329,6 +325,10 @@ public static async Task> SapSizingRecom /// SAPSizingRecommendations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -336,7 +336,7 @@ public static async Task> SapSizingRecom /// The cancellation token to use. public static Response SapSizingRecommendations(this SubscriptionResource subscriptionResource, AzureLocation location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).SapSizingRecommendations(location, content, cancellationToken); + return GetMockableWorkloadsSubscriptionResource(subscriptionResource).SapSizingRecommendations(location, content, cancellationToken); } /// @@ -351,6 +351,10 @@ public static Response SapSizingRecommendations(t /// SAPSupportedSku /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -358,7 +362,7 @@ public static Response SapSizingRecommendations(t /// The cancellation token to use. public static async Task> SapSupportedSkuAsync(this SubscriptionResource subscriptionResource, AzureLocation location, SapSupportedSkusContent content = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).SapSupportedSkuAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableWorkloadsSubscriptionResource(subscriptionResource).SapSupportedSkuAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -373,6 +377,10 @@ public static async Task> SapSupportedS /// SAPSupportedSku /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -380,7 +388,7 @@ public static async Task> SapSupportedS /// The cancellation token to use. public static Response SapSupportedSku(this SubscriptionResource subscriptionResource, AzureLocation location, SapSupportedSkusContent content = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).SapSupportedSku(location, content, cancellationToken); + return GetMockableWorkloadsSubscriptionResource(subscriptionResource).SapSupportedSku(location, content, cancellationToken); } /// @@ -395,6 +403,10 @@ public static Response SapSupportedSku(this Subs /// SAPDiskConfigurations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -402,7 +414,7 @@ public static Response SapSupportedSku(this Subs /// The cancellation token to use. public static async Task> SapDiskConfigurationsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, SapDiskConfigurationsContent content = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).SapDiskConfigurationsAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableWorkloadsSubscriptionResource(subscriptionResource).SapDiskConfigurationsAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -417,6 +429,10 @@ public static async Task> SapDiskConfigura /// SAPDiskConfigurations /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -424,7 +440,7 @@ public static async Task> SapDiskConfigura /// The cancellation token to use. public static Response SapDiskConfigurations(this SubscriptionResource subscriptionResource, AzureLocation location, SapDiskConfigurationsContent content = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).SapDiskConfigurations(location, content, cancellationToken); + return GetMockableWorkloadsSubscriptionResource(subscriptionResource).SapDiskConfigurations(location, content, cancellationToken); } /// @@ -439,6 +455,10 @@ public static Response SapDiskConfigurations(this S /// SAPAvailabilityZoneDetails /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -446,7 +466,7 @@ public static Response SapDiskConfigurations(this S /// The cancellation token to use. public static async Task> SapAvailabilityZoneDetailsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, SapAvailabilityZoneDetailsContent content = null, CancellationToken cancellationToken = default) { - return await GetSubscriptionResourceExtensionClient(subscriptionResource).SapAvailabilityZoneDetailsAsync(location, content, cancellationToken).ConfigureAwait(false); + return await GetMockableWorkloadsSubscriptionResource(subscriptionResource).SapAvailabilityZoneDetailsAsync(location, content, cancellationToken).ConfigureAwait(false); } /// @@ -461,6 +481,10 @@ public static async Task> SapAvailabi /// SAPAvailabilityZoneDetails /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The name of Azure region. @@ -468,7 +492,7 @@ public static async Task> SapAvailabi /// The cancellation token to use. public static Response SapAvailabilityZoneDetails(this SubscriptionResource subscriptionResource, AzureLocation location, SapAvailabilityZoneDetailsContent content = null, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).SapAvailabilityZoneDetails(location, content, cancellationToken); + return GetMockableWorkloadsSubscriptionResource(subscriptionResource).SapAvailabilityZoneDetails(location, content, cancellationToken); } /// @@ -483,13 +507,17 @@ public static Response SapAvailabilityZoneDeta /// SAPVirtualInstances_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSapVirtualInstancesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSapVirtualInstancesAsync(cancellationToken); + return GetMockableWorkloadsSubscriptionResource(subscriptionResource).GetSapVirtualInstancesAsync(cancellationToken); } /// @@ -504,13 +532,17 @@ public static AsyncPageable GetSapVirtualInstancesAs /// SAPVirtualInstances_ListBySubscription /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSapVirtualInstances(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSapVirtualInstances(cancellationToken); + return GetMockableWorkloadsSubscriptionResource(subscriptionResource).GetSapVirtualInstances(cancellationToken); } /// @@ -525,13 +557,17 @@ public static Pageable GetSapVirtualInstances(this S /// monitors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSapMonitorsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSapMonitorsAsync(cancellationToken); + return GetMockableWorkloadsSubscriptionResource(subscriptionResource).GetSapMonitorsAsync(cancellationToken); } /// @@ -546,13 +582,17 @@ public static AsyncPageable GetSapMonitorsAsync(this Subscri /// monitors_List /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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 GetSapMonitors(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSapMonitors(cancellationToken); + return GetMockableWorkloadsSubscriptionResource(subscriptionResource).GetSapMonitors(cancellationToken); } } } diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapApplicationServerInstanceResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapApplicationServerInstanceResource.cs index 1bf0b801747de..1be2977a74f62 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapApplicationServerInstanceResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapApplicationServerInstanceResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Workloads public partial class SapApplicationServerInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sapVirtualInstanceName. + /// The applicationInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}"; diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapCentralServerInstanceResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapCentralServerInstanceResource.cs index bcf30cfa942d0..0a9c794037746 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapCentralServerInstanceResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapCentralServerInstanceResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Workloads public partial class SapCentralServerInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sapVirtualInstanceName. + /// The centralInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}"; diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapDatabaseInstanceResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapDatabaseInstanceResource.cs index ba3f43100df2a..42d7580d8e109 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapDatabaseInstanceResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapDatabaseInstanceResource.cs @@ -28,6 +28,10 @@ namespace Azure.ResourceManager.Workloads public partial class SapDatabaseInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sapVirtualInstanceName. + /// The databaseInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}"; diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapLandscapeMonitorResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapLandscapeMonitorResource.cs index dfbd00f7b6dbd..e00cefe7e96c1 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapLandscapeMonitorResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapLandscapeMonitorResource.cs @@ -25,6 +25,9 @@ namespace Azure.ResourceManager.Workloads public partial class SapLandscapeMonitorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default"; diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorResource.cs index 931e734039af1..f969312f43e29 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Workloads public partial class SapMonitorResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SapProviderInstanceResources and their operations over a SapProviderInstanceResource. public virtual SapProviderInstanceCollection GetSapProviderInstances() { - return GetCachedClient(Client => new SapProviderInstanceCollection(Client, Id)); + return GetCachedClient(client => new SapProviderInstanceCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual SapProviderInstanceCollection GetSapProviderInstances() /// /// Name of the provider instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSapProviderInstanceAsync(string providerInstanceName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetSapProviderI /// /// Name of the provider instance. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSapProviderInstance(string providerInstanceName, CancellationToken cancellationToken = default) { diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapProviderInstanceResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapProviderInstanceResource.cs index f54988bb684b6..a9b0fcc1861b3 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapProviderInstanceResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapProviderInstanceResource.cs @@ -26,6 +26,10 @@ namespace Azure.ResourceManager.Workloads public partial class SapProviderInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The monitorName. + /// The providerInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string monitorName, string providerInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}"; diff --git a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceResource.cs index 898ef6de1223b..84e3ab973588f 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceResource.cs @@ -29,6 +29,9 @@ namespace Azure.ResourceManager.Workloads public partial class SapVirtualInstanceResource : ArmResource { /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The sapVirtualInstanceName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string sapVirtualInstanceName) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}"; @@ -94,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of SapCentralServerInstanceResources and their operations over a SapCentralServerInstanceResource. public virtual SapCentralServerInstanceCollection GetSapCentralServerInstances() { - return GetCachedClient(Client => new SapCentralServerInstanceCollection(Client, Id)); + return GetCachedClient(client => new SapCentralServerInstanceCollection(client, Id)); } /// @@ -112,8 +115,8 @@ public virtual SapCentralServerInstanceCollection GetSapCentralServerInstances() /// /// Central Services Instance resource name string modeled as parameter for auto generation to work correctly. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSapCentralServerInstanceAsync(string centralInstanceName, CancellationToken cancellationToken = default) { @@ -135,8 +138,8 @@ public virtual async Task> GetSapCent /// /// Central Services Instance resource name string modeled as parameter for auto generation to work correctly. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSapCentralServerInstance(string centralInstanceName, CancellationToken cancellationToken = default) { @@ -147,7 +150,7 @@ public virtual Response GetSapCentralServerIns /// An object representing collection of SapDatabaseInstanceResources and their operations over a SapDatabaseInstanceResource. public virtual SapDatabaseInstanceCollection GetSapDatabaseInstances() { - return GetCachedClient(Client => new SapDatabaseInstanceCollection(Client, Id)); + return GetCachedClient(client => new SapDatabaseInstanceCollection(client, Id)); } /// @@ -165,8 +168,8 @@ public virtual SapDatabaseInstanceCollection GetSapDatabaseInstances() /// /// Database resource name string modeled as parameter for auto generation to work correctly. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSapDatabaseInstanceAsync(string databaseInstanceName, CancellationToken cancellationToken = default) { @@ -188,8 +191,8 @@ public virtual async Task> GetSapDatabaseI /// /// Database resource name string modeled as parameter for auto generation to work correctly. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSapDatabaseInstance(string databaseInstanceName, CancellationToken cancellationToken = default) { @@ -200,7 +203,7 @@ public virtual Response GetSapDatabaseInstance(stri /// An object representing collection of SapApplicationServerInstanceResources and their operations over a SapApplicationServerInstanceResource. public virtual SapApplicationServerInstanceCollection GetSapApplicationServerInstances() { - return GetCachedClient(Client => new SapApplicationServerInstanceCollection(Client, Id)); + return GetCachedClient(client => new SapApplicationServerInstanceCollection(client, Id)); } /// @@ -218,8 +221,8 @@ public virtual SapApplicationServerInstanceCollection GetSapApplicationServerIns /// /// The name of SAP Application Server instance resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetSapApplicationServerInstanceAsync(string applicationInstanceName, CancellationToken cancellationToken = default) { @@ -241,8 +244,8 @@ public virtual async Task> GetSap /// /// The name of SAP Application Server instance resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetSapApplicationServerInstance(string applicationInstanceName, CancellationToken cancellationToken = default) {